diff --git a/CGAL_Core/src/CGAL_Core/CMakeLists.txt b/CGAL_Core/src/CGAL_Core/CMakeLists.txt index 2cf43a93a5b..d3473694104 100644 --- a/CGAL_Core/src/CGAL_Core/CMakeLists.txt +++ b/CGAL_Core/src/CGAL_Core/CMakeLists.txt @@ -5,9 +5,7 @@ if(CGAL_Core_FOUND) collect_cgal_library(CGAL_Core "") - set(keyword INTERFACE) - - CGAL_setup_CGAL_Core_dependencies(CGAL_Core ${keyword}) + CGAL_setup_CGAL_Core_dependencies(CGAL_Core) message("libCGAL_Core is configured") endif() diff --git a/CGAL_ImageIO/src/CGAL_ImageIO/CMakeLists.txt b/CGAL_ImageIO/src/CGAL_ImageIO/CMakeLists.txt index 57b8e11b308..8b41bc21a87 100644 --- a/CGAL_ImageIO/src/CGAL_ImageIO/CMakeLists.txt +++ b/CGAL_ImageIO/src/CGAL_ImageIO/CMakeLists.txt @@ -4,9 +4,7 @@ collect_cgal_library( CGAL_ImageIO "") include(CGAL_SetupCGAL_ImageIODependencies) -set(keyword "INTERFACE") - -CGAL_setup_CGAL_ImageIO_dependencies(CGAL_ImageIO ${keyword}) +CGAL_setup_CGAL_ImageIO_dependencies(CGAL_ImageIO) if(COMMAND add_config_flag) set( CGAL_HAS_IMAGEIO TRUE ) diff --git a/GraphicsView/src/CGAL_Qt5/CMakeLists.txt b/GraphicsView/src/CGAL_Qt5/CMakeLists.txt index 46b26f2e1fd..ce9299388f3 100644 --- a/GraphicsView/src/CGAL_Qt5/CMakeLists.txt +++ b/GraphicsView/src/CGAL_Qt5/CMakeLists.txt @@ -16,9 +16,7 @@ message( STATUS "USING Qt5_VERSION = '${Qt5Core_VERSION_STRING}'" ) collect_cgal_library( CGAL_Qt5 "") -set(keyword "INTERFACE") - -CGAL_setup_CGAL_Qt5_dependencies( CGAL_Qt5 ${keyword}) +CGAL_setup_CGAL_Qt5_dependencies( CGAL_Qt5 ) if(COMMAND add_config_flag) set( CGAL_HAS_QT5 TRUE ) diff --git a/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake b/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake index 3df96613fe6..0745228def8 100644 --- a/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake +++ b/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake @@ -67,52 +67,47 @@ endif() # # Link the target with the dependencies of CGAL:: # -# CGAL_setup_CGAL_dependencies( target [INTERFACE] ) +# CGAL_setup_CGAL_dependencies( target ) # -# If the option ``INTERFACE`` is passed, the dependencies are +# The dependencies are # added using :command:`target_link_libraries` with the ``INTERFACE`` -# keyword, or ``PUBLIC`` otherwise. +# keyword. # function(CGAL_setup_CGAL_dependencies target) - if(ARGV1 STREQUAL INTERFACE) - set(keyword INTERFACE) - else() - set(keyword PUBLIC) - endif() if(CGAL_DISABLE_GMP) - target_compile_definitions(${target} ${keyword} CGAL_DISABLE_GMP=1) + target_compile_definitions(${target} INTERFACE CGAL_DISABLE_GMP=1) else() - use_CGAL_GMP_support(${target} ${keyword}) + use_CGAL_GMP_support(${target} INTERFACE) set(CGAL_USE_GMP TRUE CACHE INTERNAL "CGAL library is configured to use GMP") set(CGAL_USE_MPFR TRUE CACHE INTERNAL "CGAL library is configured to use MPFR") endif() if(WITH_LEDA) - use_CGAL_LEDA_support(${target} ${keyword}) + use_CGAL_LEDA_support(${target} INTERFACE) endif() if (RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE) - target_compile_definitions(${target} ${keyword} CGAL_TEST_SUITE=1) + target_compile_definitions(${target} INTERFACE CGAL_TEST_SUITE=1) endif() # CGAL now requires C++14. `decltype(auto)` is used as a marker of # C++14. - target_compile_features(${target} ${keyword} cxx_decltype_auto) + target_compile_features(${target} INTERFACE cxx_decltype_auto) - use_CGAL_Boost_support(${target} ${keyword}) + use_CGAL_Boost_support(${target} INTERFACE) foreach(dir ${CGAL_INCLUDE_DIRS}) - target_include_directories(${target} ${keyword} + target_include_directories(${target} INTERFACE $) endforeach() - target_include_directories(${target} ${keyword} + target_include_directories(${target} INTERFACE $) # Now setup compilation flags if(MSVC) - target_compile_options(${target} ${keyword} + 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} ${keyword} + target_compile_options(${target} INTERFACE /fp:strict /fp:except- /wd4503 # Suppress warnings C4503 about "decorated name length exceeded" @@ -120,7 +115,7 @@ function(CGAL_setup_CGAL_dependencies target) ) else() # The MSVC generator supports `$` since CMake 3.11. - target_compile_options(${target} ${keyword} + target_compile_options(${target} INTERFACE $<$:/fp:strict> $<$:/fp:except-> $<$:/wd4503> # Suppress warnings C4503 about "decorated name length exceeded" @@ -131,39 +126,39 @@ function(CGAL_setup_CGAL_dependencies target) if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11.0.3) message(STATUS "Apple Clang version ${CMAKE_CXX_COMPILER_VERSION} compiler detected") message(STATUS "Boost MP is turned off for all Apple Clang versions below 11.0.3!") - target_compile_options(${target} ${keyword} "-DCGAL_DO_NOT_USE_BOOST_MP") + target_compile_options(${target} INTERFACE "-DCGAL_DO_NOT_USE_BOOST_MP") endif() 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") + target_compile_options(${target} INTERFACE "/fp:strict") else() - target_compile_options(${target} ${keyword} "-fp-model" "strict") + target_compile_options(${target} INTERFACE "-fp-model" "strict") endif() elseif(CMAKE_CXX_COMPILER_ID MATCHES "SunPro") message( STATUS "Using SunPro compiler, using STLPort 4." ) - target_compile_options(${target} ${keyword} + target_compile_options(${target} INTERFACE "-features=extensions;-library=stlport4;-D_GNU_SOURCE") - target_link_libraries(${target} ${keyword} "-library=stlport4") + target_link_libraries(${target} INTERFACE "-library=stlport4") elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU") if ( RUNNING_CGAL_AUTO_TEST ) - target_compile_options(${target} ${keyword} "-Wall") + target_compile_options(${target} INTERFACE "-Wall") 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} ${keyword} "-frounding-math") + target_compile_options(${target} INTERFACE "-frounding-math") else() - target_compile_options(${target} ${keyword} "$<$:-frounding-math>") + target_compile_options(${target} INTERFACE "$<$:-frounding-math>") endif() 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" ) + target_compile_options(${target} INTERFACE "-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" ) + target_compile_options(${target} INTERFACE "-mieee" "-mfp-rounding-mode=d" ) endif() endif() endfunction() diff --git a/Installation/cmake/modules/CGAL_SetupCGAL_CoreDependencies.cmake b/Installation/cmake/modules/CGAL_SetupCGAL_CoreDependencies.cmake index 51c6bc73c4f..3387eae26c8 100644 --- a/Installation/cmake/modules/CGAL_SetupCGAL_CoreDependencies.cmake +++ b/Installation/cmake/modules/CGAL_SetupCGAL_CoreDependencies.cmake @@ -46,22 +46,16 @@ endif() # # Link the target with the dependencies of `CGAL_Core`:: # -# CGAL_setup_CGAL_Core_dependencies( target [INTERFACE] ) +# CGAL_setup_CGAL_Core_dependencies( target) # -# If the option ``INTERFACE`` is passed, the dependencies are +# The dependencies are # added using :command:`target_link_libraries` with the ``INTERFACE`` -# keyword, or ``PUBLIC`` otherwise. +# keyword. # function(CGAL_setup_CGAL_Core_dependencies target) - if(ARGV1 STREQUAL INTERFACE) - set(keyword INTERFACE) - else() - set(keyword PUBLIC) - endif() - - use_CGAL_GMP_support(CGAL_Core ${keyword}) - target_compile_definitions(${target} ${keyword} CGAL_USE_CORE=1) - target_link_libraries( CGAL_Core ${keyword} CGAL::CGAL ) + use_CGAL_GMP_support(CGAL_Core INTERFACE) + target_compile_definitions(${target} INTERFACE CGAL_USE_CORE=1) + target_link_libraries( CGAL_Core INTERFACE CGAL::CGAL ) endfunction() diff --git a/Installation/cmake/modules/CGAL_SetupCGAL_ImageIODependencies.cmake b/Installation/cmake/modules/CGAL_SetupCGAL_ImageIODependencies.cmake index 8ac856d0373..fd1d2bd7f2a 100644 --- a/Installation/cmake/modules/CGAL_SetupCGAL_ImageIODependencies.cmake +++ b/Installation/cmake/modules/CGAL_SetupCGAL_ImageIODependencies.cmake @@ -51,22 +51,14 @@ set(CGAL_ImageIO_FOUND TRUE) set_property(GLOBAL PROPERTY CGAL_ImageIO_FOUND TRUE) function(CGAL_setup_CGAL_ImageIO_dependencies target) - if(ARGV1 STREQUAL INTERFACE) - set(keyword INTERFACE) - else() - set(keyword PUBLIC) - endif() - target_link_libraries( CGAL_ImageIO ${keyword} CGAL::CGAL) + target_link_libraries( CGAL_ImageIO INTERFACE CGAL::CGAL) if(ZLIB_FOUND) - target_include_directories( CGAL_ImageIO SYSTEM ${keyword} ${ZLIB_INCLUDE_DIRS}) - target_link_libraries( CGAL_ImageIO ${keyword} ${ZLIB_LIBRARIES}) + target_include_directories( CGAL_ImageIO SYSTEM INTERFACE ${ZLIB_INCLUDE_DIRS}) + target_link_libraries( CGAL_ImageIO INTERFACE ${ZLIB_LIBRARIES}) - target_compile_definitions( CGAL_ImageIO ${keyword} CGAL_USE_ZLIB=1) - if(NOT ARGV1 STREQUAL INTERFACE) - set_target_properties(CGAL_ImageIO PROPERTIES CGAL_TARGET_USES_ZLIB TRUE) - endif() + target_compile_definitions( CGAL_ImageIO INTERFACE CGAL_USE_ZLIB=1) else() message( STATUS "NOTICE: libCGAL_ImageIO needs ZLib to read compressed files. That feature will not be activated.") endif() diff --git a/Installation/cmake/modules/CGAL_SetupCGAL_Qt5Dependencies.cmake b/Installation/cmake/modules/CGAL_SetupCGAL_Qt5Dependencies.cmake index 840560a6b06..083efb0f5ec 100644 --- a/Installation/cmake/modules/CGAL_SetupCGAL_Qt5Dependencies.cmake +++ b/Installation/cmake/modules/CGAL_SetupCGAL_Qt5Dependencies.cmake @@ -99,31 +99,26 @@ endif() # # Link the target with the dependencies of `CGAL_Qt5`:: # -# CGAL_setup_CGAL_Qt5_dependencies( target [INTERFACE] ) +# CGAL_setup_CGAL_Qt5_dependencies( target ) # -# If the option ``INTERFACE`` is passed, the dependencies are +# The dependencies are # added using :command:`target_link_libraries` with the ``INTERFACE`` -# keyword, or ``PUBLIC`` otherwise. +# keyword. # function(CGAL_setup_CGAL_Qt5_dependencies target) - if(ARGV1 STREQUAL INTERFACE) - set(keyword INTERFACE) - else() - set(keyword PUBLIC) - endif() if($ENV{CGAL_FAKE_PUBLIC_RELEASE}) - target_compile_definitions( ${target} ${keyword} CGAL_FAKE_PUBLIC_RELEASE=1 ) + target_compile_definitions( ${target} INTERFACE CGAL_FAKE_PUBLIC_RELEASE=1 ) endif() - target_link_libraries( ${target} ${keyword} CGAL::CGAL) - target_link_libraries( ${target} ${keyword} CGAL::Qt5_moc_and_resources) - target_link_libraries( ${target} ${keyword} Qt5::OpenGL Qt5::Svg Qt5::Xml) + target_link_libraries( ${target} INTERFACE CGAL::CGAL) + target_link_libraries( ${target} INTERFACE CGAL::Qt5_moc_and_resources) + target_link_libraries( ${target} INTERFACE Qt5::OpenGL Qt5::Svg Qt5::Xml) # Remove -Wdeprecated-copy, for g++ >= 9.0, because Qt5, as of # version 5.12, has a lot of [-Wdeprecated-copy] warnings. if( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9" ) - target_compile_options( ${target} ${keyword} "-Wno-deprecated-copy" "-Wno-cast-function-type" ) + target_compile_options( ${target} INTERFACE "-Wno-deprecated-copy" "-Wno-cast-function-type" ) endif() endfunction() diff --git a/Installation/cmake/modules/CGAL_SetupGMP.cmake b/Installation/cmake/modules/CGAL_SetupGMP.cmake index 6627df01796..4a1df74eabc 100644 --- a/Installation/cmake/modules/CGAL_SetupGMP.cmake +++ b/Installation/cmake/modules/CGAL_SetupGMP.cmake @@ -46,34 +46,29 @@ endif() # keyword, or ``PUBLIC`` otherwise. function(use_CGAL_GMP_support target) - if(ARGV1 STREQUAL INTERFACE) - set(keyword INTERFACE) - else() - set(keyword PUBLIC) - endif() if(NOT GMP_FOUND OR NOT MPFR_FOUND) message(FATAL_ERROR "CGAL requires GMP and MPFR.") return() endif() if(NOT GMP_INCLUDE_DIR STREQUAL "${CGAL_INSTALLATION_PACKAGE_DIR}/auxiliary/gmp/include") - target_include_directories(${target} SYSTEM ${keyword} ${GMP_INCLUDE_DIR}) + target_include_directories(${target} SYSTEM INTERFACE ${GMP_INCLUDE_DIR}) else() - target_include_directories(${target} SYSTEM ${keyword} + target_include_directories(${target} SYSTEM INTERFACE $ $) endif() if(NOT MPFR_INCLUDE_DIR STREQUAL "${CGAL_INSTALLATION_PACKAGE_DIR}/auxiliary/gmp/include") - target_include_directories(${target} SYSTEM ${keyword} ${MPFR_INCLUDE_DIR}) + target_include_directories(${target} SYSTEM INTERFACE ${MPFR_INCLUDE_DIR}) else() - target_include_directories(${target} SYSTEM ${keyword} + target_include_directories(${target} SYSTEM INTERFACE $ $) endif() if(WITH_GMPXX OR CGAL_WITH_GMPXX) - target_include_directories(${target} SYSTEM ${keyword} ${GMPXX_INCLUDE_DIR}) - target_link_libraries(${target} ${keyword} ${GMPXX_LIBRARIES}) - target_compile_definitions(${target} ${keyword} CGAL_USE_GMPXX=1) + target_include_directories(${target} SYSTEM INTERFACE ${GMPXX_INCLUDE_DIR}) + target_link_libraries(${target} INTERFACE ${GMPXX_LIBRARIES}) + target_compile_definitions(${target} INTERFACE CGAL_USE_GMPXX=1) endif() - target_link_libraries(${target} ${keyword} ${MPFR_LIBRARIES} ${GMP_LIBRARIES}) + target_link_libraries(${target} INTERFACE ${MPFR_LIBRARIES} ${GMP_LIBRARIES}) endfunction() diff --git a/Installation/cmake/modules/CGAL_SetupLEDA.cmake b/Installation/cmake/modules/CGAL_SetupLEDA.cmake index 72688b361ec..af207540058 100644 --- a/Installation/cmake/modules/CGAL_SetupLEDA.cmake +++ b/Installation/cmake/modules/CGAL_SetupLEDA.cmake @@ -32,11 +32,6 @@ find_package(LEDA) # keyword, or ``PUBLIC`` otherwise. function(use_CGAL_LEDA_support target) - if(ARGV1 STREQUAL INTERFACE) - set(keyword INTERFACE) - else() - set(keyword PUBLIC) - endif() if(NOT LEDA_FOUND) message(FATAL_ERROR "use_CGAL_LEDA_support is use whereas LEDA_FOUND is false.") return() @@ -45,12 +40,12 @@ function(use_CGAL_LEDA_support target) separate_arguments(LIST_LEDA_DEFINITIONS UNIX_COMMAND "${LEDA_DEFINITIONS} -DCGAL_USE_LEDA") if(CMAKE_VERSION VERSION_LESS 3.3) - target_compile_options(${target} ${keyword} ${LIST_LEDA_CXX_FLAGS}) + target_compile_options(${target} INTERFACE ${LIST_LEDA_CXX_FLAGS}) else() - target_compile_options(${target} ${keyword} $<$:${LIST_LEDA_CXX_FLAGS}>) + target_compile_options(${target} INTERFACE $<$:${LIST_LEDA_CXX_FLAGS}>) endif() - target_compile_options(${target} ${keyword} ${LIST_LEDA_DEFINITIONS}) + target_compile_options(${target} INTERFACE ${LIST_LEDA_DEFINITIONS}) - target_include_directories(${target} SYSTEM ${keyword} ${LEDA_INCLUDE_DIR}) - target_link_libraries(${target} ${keyword} ${LEDA_LIBRARIES} ${LEDA_LINKER_FLAGS}) + target_include_directories(${target} SYSTEM INTERFACE ${LEDA_INCLUDE_DIR}) + target_link_libraries(${target} INTERFACE ${LEDA_LIBRARIES} ${LEDA_LINKER_FLAGS}) endfunction() diff --git a/Installation/cmake/modules/CGAL_setup_target_dependencies.cmake b/Installation/cmake/modules/CGAL_setup_target_dependencies.cmake index 73a357b4d08..bed40154c80 100644 --- a/Installation/cmake/modules/CGAL_setup_target_dependencies.cmake +++ b/Installation/cmake/modules/CGAL_setup_target_dependencies.cmake @@ -1,17 +1,11 @@ function(CGAL_setup_target_dependencies target) - if(ARGV1 STREQUAL INTERFACE) - set(keyword INTERFACE) - else() - set(keyword PUBLIC) - endif() - if(${target} STREQUAL CGAL) - CGAL_setup_CGAL_dependencies(${target} ${keyword}) + CGAL_setup_CGAL_dependencies(${target}) elseif(${target} STREQUAL CGAL_Core) - CGAL_setup_CGAL_Core_dependencies(${target} ${keyword}) + CGAL_setup_CGAL_Core_dependencies(${target}) elseif(${target} STREQUAL CGAL_ImageIO) - CGAL_setup_CGAL_ImageIO_dependencies(${target} ${keyword}) + CGAL_setup_CGAL_ImageIO_dependencies(${target}) elseif(${target} STREQUAL CGAL_Qt5) - CGAL_setup_CGAL_Qt5_dependencies(${target} ${keyword}) + CGAL_setup_CGAL_Qt5_dependencies(${target}) endif() endfunction() diff --git a/Installation/lib/cmake/CGAL/CGALConfig.cmake b/Installation/lib/cmake/CGAL/CGALConfig.cmake index a69b0c21246..a87e74451d9 100644 --- a/Installation/lib/cmake/CGAL/CGALConfig.cmake +++ b/Installation/lib/cmake/CGAL/CGALConfig.cmake @@ -144,7 +144,7 @@ foreach(cgal_lib ${CGAL_LIBRARIES}) if(NOT TARGET CGAL::${cgal_lib}) add_library(CGAL::${cgal_lib} ALIAS ${cgal_lib}) endif() - CGAL_setup_target_dependencies(${cgal_lib} INTERFACE) + CGAL_setup_target_dependencies(${cgal_lib}) endif() endforeach() diff --git a/Installation/src/CGAL/CMakeLists.txt b/Installation/src/CGAL/CMakeLists.txt index b87886c9b97..64d72ad137d 100644 --- a/Installation/src/CGAL/CMakeLists.txt +++ b/Installation/src/CGAL/CMakeLists.txt @@ -4,9 +4,7 @@ collect_cgal_library(CGAL "") include(CGAL_SetupCGALDependencies) -set(keyword "INTERFACE") - -CGAL_setup_CGAL_dependencies(CGAL ${keyword}) +CGAL_setup_CGAL_dependencies(CGAL) if(NOT CGAL_DISABLE_GMP) get_dependency_version(GMP)