Fixing ICPC usage with modern cmake and wrappers

Related to conan's conan-io/conan-center-index#25843

replaced 'fp-model strict' by 'fp-model=strict' https://www.intel.com/content/www/us/en/docs/cpp-compiler/developer-guide-reference/2021-8/fp-model-fp.html
for more compatibility with nvcc. as 'fp-model=strict' will be directly
transmited to the compiler while 'fp-model strict' will have 'strict'
being treated as a file input.

Also added a CXX only filter for newer cmake 3.3+
This commit is contained in:
mbarbier 2024-11-27 09:19:23 +00:00
parent 3f1759df88
commit 56f57215b6
3 changed files with 16 additions and 8 deletions

View File

@ -429,12 +429,12 @@ if("${CMAKE_CXX_COMPILER}" MATCHES "icl" OR "${CMAKE_CXX_COMPILER}" MATCHES
) )
else() else()
message( message(
STATUS "Using Intel Compiler version 11 or later. Adding -fp-model strict" STATUS "Using Intel Compiler version 11 or later. Adding -fp-model=strict"
) )
if(WIN32) if(WIN32)
uniquely_add_flags(CGAL_CXX_FLAGS "/fp:strict") uniquely_add_flags(CGAL_CXX_FLAGS "/fp:strict")
else() else()
uniquely_add_flags(CGAL_CXX_FLAGS "-fp-model strict") uniquely_add_flags(CGAL_CXX_FLAGS "-fp-model=strict")
endif() endif()
endif() endif()
endif() endif()

View File

@ -132,11 +132,19 @@ function(CGAL_setup_CGAL_flags target)
$<$<COMPILE_LANGUAGE:CXX>:/bigobj> # Use /bigobj by default $<$<COMPILE_LANGUAGE:CXX>:/bigobj> # Use /bigobj by default
) )
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel") elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
message( STATUS "Using Intel Compiler. Adding -fp-model strict" ) # cuda knows how to deal with 'fp-model=strict' but not 'fp-model strict'
if(WIN32) if(CMAKE_VERSION VERSION_LESS 3.3)
target_compile_options(${target} INTERFACE "/fp:strict") if(WIN32)
target_compile_options(${target} INTERFACE "/fp:strict")
else()
target_compile_options(${target} INTERFACE "-fp-model=strict")
endif()
else() else()
target_compile_options(${target} INTERFACE "-fp-model" "strict") if(WIN32)
target_compile_options(${target} INTERFACE "$<$<COMPILE_LANGUAGE:CXX>:/fp:strict>")
else()
target_compile_options(${target} INTERFACE "$<$<COMPILE_LANGUAGE:CXX>:-fp-model=strict>")
endif()
endif() endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES "SunPro") elseif(CMAKE_CXX_COMPILER_ID MATCHES "SunPro")
message( STATUS "Using SunPro compiler, using STLPort 4." ) message( STATUS "Using SunPro compiler, using STLPort 4." )

View File

@ -285,9 +285,9 @@ private:
// the 2 negations and we get wrong rounding. // the 2 negations and we get wrong rounding.
typename Interval_nt<>::Internal_protector P; typename Interval_nt<>::Internal_protector P;
CGAL_assertion_msg(-CGAL_IA_MUL(-1.1, 10.1) != CGAL_IA_MUL(1.1, 10.1), CGAL_assertion_msg(-CGAL_IA_MUL(-1.1, 10.1) != CGAL_IA_MUL(1.1, 10.1),
"Wrong rounding: did you forget the -frounding-math option if you use GCC (or -fp-model strict for Intel)?"); "Wrong rounding: did you forget the -frounding-math option if you use GCC (or -fp-model=strict for Intel)?");
CGAL_assertion_msg(-CGAL_IA_DIV(-1., 10) != CGAL_IA_DIV(1., 10), CGAL_assertion_msg(-CGAL_IA_DIV(-1., 10) != CGAL_IA_DIV(1., 10),
"Wrong rounding: did you forget the -frounding-math option if you use GCC (or -fp-model strict for Intel)?"); "Wrong rounding: did you forget the -frounding-math option if you use GCC (or -fp-model=strict for Intel)?");
} }
}; };