From 03f84dc94b5e6c707fd56325b4354173f7f116ae Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Mon, 13 Nov 2017 14:28:51 +0100 Subject: [PATCH] Handle the compiler flags That setup was previously in `Installation/CMakeLists.txt`. --- .../modules/CGAL_SetupCGALDependencies.cmake | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake b/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake index e4c0a75f038..a1673d93304 100644 --- a/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake +++ b/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake @@ -98,10 +98,50 @@ function(CGAL_setup_CGAL_dependencies target) endif() use_CGAL_Boost_support(${target} ${keyword}) + foreach(dir ${CGAL_INCLUDE_DIRS}) target_include_directories(${target} ${keyword} $) endforeach() target_include_directories(${target} ${keyword} $) + + # Now setup compilation flags + if(MSVC) + target_compile_options(${target} ${keyword} + "-D_CRT_SECURE_NO_DEPRECATE;-D_SCL_SECURE_NO_DEPRECATE;-D_CRT_SECURE_NO_WARNINGS;-D_SCL_SECURE_NO_WARNINGS" + "/fp:strict" + "/fp:except-" + "/wd4503" # Suppress warnings C4503 about "decorated name length exceeded" + "/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} ${keyword} "/fp:strict") + else() + target_compile_options(${target} ${keyword} "-fp-model strict") + endif() + elseif(CMAKE_CXX_COMPILER_ID MATCHES "SunPro") + message( STATUS "Using SunPro compiler, using STLPort 4." ) + target_compile_options(${target} ${keyword} + "-features=extensions;-library=stlport4;-D_GNU_SOURCE") + target_link_libraries(${target} ${keyword} "-library=stlport4") + elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU") + if ( RUNNING_CGAL_AUTO_TEST ) + target_compile_options(${target} ${keyword} "-Wall") + endif() + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 3) + message( STATUS "Using gcc version 4 or later. Adding -frounding-math" ) + target_compile_options(${target} ${keyword} "-frounding-math") + endif() + if ( "${GCC_VERSION}" MATCHES "^4.2" ) + message( STATUS "Using gcc version 4.2. Adding -fno-strict-aliasing" ) + target_compile_options(${target} ${keyword} "-fno-strict-aliasing" ) + endif() + if ( "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "alpha" ) + message( STATUS "Using gcc on alpha. Adding -mieee -mfp-rounding-mode=d" ) + target_compile_options(${target} ${keyword} "-mieee -mfp-rounding-mode=d" ) + endif() + endif() endfunction()