From 56f57215b6aa96385cdcac12b7d166791fa6e56e Mon Sep 17 00:00:00 2001 From: mbarbier Date: Wed, 27 Nov 2024 09:19:23 +0000 Subject: [PATCH] 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+ --- Installation/CMakeLists.txt | 4 ++-- .../modules/CGAL_SetupCGALDependencies.cmake | 16 ++++++++++++---- Number_types/include/CGAL/Interval_nt.h | 4 ++-- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Installation/CMakeLists.txt b/Installation/CMakeLists.txt index 11ade3231f1..18f6f45c05a 100644 --- a/Installation/CMakeLists.txt +++ b/Installation/CMakeLists.txt @@ -429,12 +429,12 @@ if("${CMAKE_CXX_COMPILER}" MATCHES "icl" OR "${CMAKE_CXX_COMPILER}" MATCHES ) else() 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) uniquely_add_flags(CGAL_CXX_FLAGS "/fp:strict") else() - uniquely_add_flags(CGAL_CXX_FLAGS "-fp-model strict") + uniquely_add_flags(CGAL_CXX_FLAGS "-fp-model=strict") endif() endif() endif() diff --git a/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake b/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake index 60e2bd25c4d..e3dadc7b4e4 100644 --- a/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake +++ b/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake @@ -132,11 +132,19 @@ function(CGAL_setup_CGAL_flags target) $<$:/bigobj> # Use /bigobj by default ) elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel") - message( STATUS "Using Intel Compiler. Adding -fp-model strict" ) - if(WIN32) - target_compile_options(${target} INTERFACE "/fp:strict") + # cuda knows how to deal with 'fp-model=strict' but not 'fp-model strict' + if(CMAKE_VERSION VERSION_LESS 3.3) + if(WIN32) + target_compile_options(${target} INTERFACE "/fp:strict") + else() + target_compile_options(${target} INTERFACE "-fp-model=strict") + endif() else() - target_compile_options(${target} INTERFACE "-fp-model" "strict") + if(WIN32) + target_compile_options(${target} INTERFACE "$<$:/fp:strict>") + else() + target_compile_options(${target} INTERFACE "$<$:-fp-model=strict>") + endif() endif() elseif(CMAKE_CXX_COMPILER_ID MATCHES "SunPro") message( STATUS "Using SunPro compiler, using STLPort 4." ) diff --git a/Number_types/include/CGAL/Interval_nt.h b/Number_types/include/CGAL/Interval_nt.h index 4a03e3ef882..f70312178b7 100644 --- a/Number_types/include/CGAL/Interval_nt.h +++ b/Number_types/include/CGAL/Interval_nt.h @@ -285,9 +285,9 @@ private: // the 2 negations and we get wrong rounding. typename Interval_nt<>::Internal_protector P; 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), - "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)?"); } };