From c00c481e06233436c09d5c2f0fe259f045d2477e Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Thu, 5 May 2022 16:08:51 +0200 Subject: [PATCH] Remove workarounds for CMake<3.11 --- .../CGAL_Boost_iostreams_support.cmake | 13 +++------ Installation/cmake/modules/CGAL_Common.cmake | 7 ----- .../modules/CGAL_SetupCGALDependencies.cmake | 29 +++++-------------- .../cmake/modules/CGAL_SetupLEDA.cmake | 8 ++--- 4 files changed, 14 insertions(+), 43 deletions(-) diff --git a/Installation/cmake/modules/CGAL_Boost_iostreams_support.cmake b/Installation/cmake/modules/CGAL_Boost_iostreams_support.cmake index a8d1c4ddd45..fe21b264a68 100644 --- a/Installation/cmake/modules/CGAL_Boost_iostreams_support.cmake +++ b/Installation/cmake/modules/CGAL_Boost_iostreams_support.cmake @@ -1,3 +1,4 @@ +cmake_minimum_required(VERSION 3.11) if(Boost_IOSTREAMS_FOUND AND NOT TARGET CGAL::Boost_iostreams_support) if( WIN32 ) @@ -32,13 +33,7 @@ if(Boost_IOSTREAMS_FOUND AND NOT TARGET CGAL::Boost_iostreams_support) add_library(CGAL::Boost_iostreams_support INTERFACE IMPORTED) - if(CMAKE_VERSION VERSION_LESS 3.11) - set_target_properties(CGAL::Boost_iostreams_support PROPERTIES - INTERFACE_COMPILE_DEFINITIONS "CGAL_LINKED_WITH_BOOST_IOSTREAMS" - INTERFACE_LINK_LIBRARIES "${Boost_LIB};${ZLIB_LIBS}") - else() - set_target_properties(CGAL::Boost_iostreams_support PROPERTIES - INTERFACE_COMPILE_DEFINITIONS "CGAL_LINKED_WITH_BOOST_IOSTREAMS") - target_link_libraries(CGAL::Boost_iostreams_support INTERFACE ${Boost_LIB} ${ZLIB_LIBS}) - endif() + set_target_properties(CGAL::Boost_iostreams_support PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "CGAL_LINKED_WITH_BOOST_IOSTREAMS") + target_link_libraries(CGAL::Boost_iostreams_support INTERFACE ${Boost_LIB} ${ZLIB_LIBS}) endif() diff --git a/Installation/cmake/modules/CGAL_Common.cmake b/Installation/cmake/modules/CGAL_Common.cmake index c9c61644d23..92de4630099 100644 --- a/Installation/cmake/modules/CGAL_Common.cmake +++ b/Installation/cmake/modules/CGAL_Common.cmake @@ -17,13 +17,6 @@ if( NOT CGAL_COMMON_FILE_INCLUDED ) message( FATAL_ERROR "CMAKE_ROOT environment variable not set. It should point to the directory where CMake is installed.") endif() - # CMAKE_VERSION was introduced in 2.6.3 so we use it to detect the fact - if ( CMAKE_VERSION ) - set( CMAKE_2_6_3_OR_ABOVE TRUE ) - else() - set( CMAKE_2_6_3_OR_ABOVE FALSE ) - endif() - if ( WIN32 ) find_program(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin ) if(CMAKE_UNAME) diff --git a/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake b/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake index cb16e161fc7..f046f1e7e5b 100644 --- a/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake +++ b/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake @@ -23,6 +23,7 @@ # If set, the `LEDA` library will be searched and used to provide # the exact number types used by CGAL kernels. # +cmake_minimum_required(VERSION 3.11) if(CGAL_SetupCGALDependencies_included) return() endif() @@ -117,22 +118,12 @@ function(CGAL_setup_CGAL_dependencies target) if(MSVC) target_compile_options(${target} INTERFACE "-D_SCL_SECURE_NO_DEPRECATE;-D_SCL_SECURE_NO_WARNINGS") - if(CMAKE_VERSION VERSION_LESS 3.11) - target_compile_options(${target} INTERFACE - /fp:strict - /fp:except- - /wd4503 # Suppress warnings C4503 about "decorated name length exceeded" - /bigobj # Use /bigobj by default - ) - else() - # The MSVC generator supports `$` since CMake 3.11. - target_compile_options(${target} INTERFACE - $<$:/fp:strict> - $<$:/fp:except-> - $<$:/wd4503> # Suppress warnings C4503 about "decorated name length exceeded" - $<$:/bigobj> # Use /bigobj by default - ) - endif() + target_compile_options(${target} INTERFACE + $<$:/fp:strict> + $<$:/fp:except-> + $<$:/wd4503> # Suppress warnings C4503 about "decorated name length exceeded" + $<$:/bigobj> # Use /bigobj by default + ) elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang") if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11.0.3) message(STATUS "Apple Clang version ${CMAKE_CXX_COMPILER_VERSION} compiler detected") @@ -157,11 +148,7 @@ function(CGAL_setup_CGAL_dependencies target) endif() if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 3) message( STATUS "Using gcc version 4 or later. Adding -frounding-math" ) - if(CMAKE_VERSION VERSION_LESS 3.3) - target_compile_options(${target} INTERFACE "-frounding-math") - else() - target_compile_options(${target} INTERFACE "$<$:-frounding-math>") - endif() + target_compile_options(${target} INTERFACE "$<$:-frounding-math>") endif() if ( "${GCC_VERSION}" MATCHES "^4.2" ) message( STATUS "Using gcc version 4.2. Adding -fno-strict-aliasing" ) diff --git a/Installation/cmake/modules/CGAL_SetupLEDA.cmake b/Installation/cmake/modules/CGAL_SetupLEDA.cmake index af207540058..03e9c394532 100644 --- a/Installation/cmake/modules/CGAL_SetupLEDA.cmake +++ b/Installation/cmake/modules/CGAL_SetupLEDA.cmake @@ -9,7 +9,7 @@ # find_package(LEDA) # # and defines the function :command:`use_CGAL_LEDA_support`. - +cmake_minimum_required(VERSION 3.11) if(CGAL_SetupLEDA_included) return() endif() @@ -39,11 +39,7 @@ function(use_CGAL_LEDA_support target) separate_arguments(LIST_LEDA_CXX_FLAGS UNIX_COMMAND "${LEDA_CXX_FLAGS}") separate_arguments(LIST_LEDA_DEFINITIONS UNIX_COMMAND "${LEDA_DEFINITIONS} -DCGAL_USE_LEDA") - if(CMAKE_VERSION VERSION_LESS 3.3) - target_compile_options(${target} INTERFACE ${LIST_LEDA_CXX_FLAGS}) - else() - target_compile_options(${target} INTERFACE $<$:${LIST_LEDA_CXX_FLAGS}>) - endif() + target_compile_options(${target} INTERFACE $<$:${LIST_LEDA_CXX_FLAGS}>) target_compile_options(${target} INTERFACE ${LIST_LEDA_DEFINITIONS}) target_include_directories(${target} SYSTEM INTERFACE ${LEDA_INCLUDE_DIR})