mirror of https://github.com/CGAL/cgal
simplify CGAL_setup dependencies.
This commit is contained in:
parent
0f46df37df
commit
2ed89ef35e
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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 )
|
||||
|
|
|
|||
|
|
@ -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 )
|
||||
|
|
|
|||
|
|
@ -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
|
||||
$<BUILD_INTERFACE:${dir}>)
|
||||
endforeach()
|
||||
target_include_directories(${target} ${keyword}
|
||||
target_include_directories(${target} INTERFACE
|
||||
$<INSTALL_INTERFACE:include>)
|
||||
|
||||
# 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 `$<COMPILE_LANGUAGE: >` since CMake 3.11.
|
||||
target_compile_options(${target} ${keyword}
|
||||
target_compile_options(${target} INTERFACE
|
||||
$<$<COMPILE_LANGUAGE:CXX>:/fp:strict>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:/fp:except->
|
||||
$<$<COMPILE_LANGUAGE:CXX>:/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} "$<$<COMPILE_LANGUAGE:CXX>:-frounding-math>")
|
||||
target_compile_options(${target} INTERFACE "$<$<COMPILE_LANGUAGE:CXX>:-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()
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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
|
||||
$<BUILD_INTERFACE:${GMP_INCLUDE_DIR}>
|
||||
$<INSTALL_INTERFACE:include>)
|
||||
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
|
||||
$<BUILD_INTERFACE:${MPFR_INCLUDE_DIR}>
|
||||
$<INSTALL_INTERFACE:include>)
|
||||
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()
|
||||
|
|
|
|||
|
|
@ -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} $<$<COMPILE_LANGUAGE:CXX>:${LIST_LEDA_CXX_FLAGS}>)
|
||||
target_compile_options(${target} INTERFACE $<$<COMPILE_LANGUAGE:CXX>:${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()
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue