Remove preconfigured 3rd party libs options

This commit is contained in:
Maxime Gimeno 2020-10-05 14:37:38 +02:00
parent 0635d8992a
commit 27589e4b26
4 changed files with 19 additions and 45 deletions

View File

@ -610,8 +610,6 @@ endforeach()
# The following variables are in the cache just so subdirectories can set them persistently.
# But they are not intended to persist from run to run as normal cache variables.
# Similar variables are created when a library is detected.
#
cache_set(CGAL_3RD_PARTY_PRECONFIGURED "" )
cache_set(CGAL_3RD_PARTY_DEFINITIONS "" )
cache_set(CGAL_3RD_PARTY_INCLUDE_DIRS "" )
@ -619,7 +617,6 @@ cache_set(CGAL_3RD_PARTY_LIBRARIES "" )
cache_set(CGAL_3RD_PARTY_LIBRARIES_DIRS "" )
# default is on, but some use-cases need to set it to off, e.g., debian packages
option( CGAL_ENABLE_PRECONFIG "Select to allow to preconfiguration of external libraries" ON)
# additional info: some header files in CGAL add additional code if
# certain optional libs are installed, and some examples/tests rely on
@ -753,8 +750,6 @@ endforeach()
include_directories (${CGAL_INCLUDE_DIRS})
cache_get(CGAL_3RD_PARTY_PRECONFIGURED )
cache_get(CGAL_3RD_PARTY_DEFINITIONS )
cache_get(CGAL_3RD_PARTY_INCLUDE_DIRS )
cache_get(CGAL_3RD_PARTY_LIBRARIES )

View File

@ -308,9 +308,8 @@ if( NOT CGAL_MACROS_FILE_INCLUDED )
set( vlib "${CGAL_EXT_LIB_${component}_PREFIX}" )
if ( NOT CGAL_IGNORE_PRECONFIGURED_${component} AND ${vlib}_FOUND)
if (${vlib}_FOUND)
####message( STATUS "External library ${component} has been preconfigured")
use_lib( ${component} ${${vlib}_USE_FILE})
else()
@ -411,28 +410,24 @@ if( NOT CGAL_MACROS_FILE_INCLUDED )
foreach( lib ${CGAL_SUPPORTING_3RD_PARTY_LIBRARIES} )
list( FIND CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES "${lib}" POSITION )
# if lib is essential or preconfiguration for an activated library ...
if ( ("${POSITION}" STRGREATER "-1") OR ( CGAL_ENABLE_PRECONFIG AND WITH_${lib} ))
# if lib is essential ...
if ( ("${POSITION}" STRGREATER "-1") )
set (vlib ${CGAL_EXT_LIB_${lib}_PREFIX} )
#the next 'if' is needed to avoid ${vlib} config variables to be overidden in case of a local configuration change
file( APPEND ${CMAKE_BINARY_DIR}/CGALConfig.cmake "if (NOT CGAL_IGNORE_PRECONFIGURED_${lib})\n")
file( APPEND ${CMAKE_BINARY_DIR}/CGALConfig.cmake " set( ${vlib}_FOUND \"${${vlib}_FOUND}\" )\n")
file( APPEND ${CMAKE_BINARY_DIR}/CGALConfig.cmake " set( ${vlib}_USE_FILE \"${${vlib}_USE_FILE}\" )\n")
file( APPEND ${CMAKE_BINARY_DIR}/CGALConfig.cmake " set( ${vlib}_INCLUDE_DIR \"${${vlib}_INCLUDE_DIR}\" )\n")
file( APPEND ${CMAKE_BINARY_DIR}/CGALConfig.cmake " set( ${vlib}_LIBRARIES \"${${vlib}_LIBRARIES}\" )\n")
file( APPEND ${CMAKE_BINARY_DIR}/CGALConfig.cmake " set( ${vlib}_DEFINITIONS \"${${vlib}_DEFINITIONS}\" )\n")
file( APPEND ${CMAKE_BINARY_DIR}/CGALConfig.cmake "endif()\n\n")
#the next 'if' is needed to avoid ${vlib} config variables to be overidden in case of a local configuration change
file( APPEND ${CMAKE_BINARY_DIR}/config/CGALConfig.cmake "if (NOT CGAL_IGNORE_PRECONFIGURED_${lib})\n")
file( APPEND ${CMAKE_BINARY_DIR}/config/CGALConfig.cmake " set( ${vlib}_FOUND \"${${vlib}_FOUND}\")\n")
file( APPEND ${CMAKE_BINARY_DIR}/config/CGALConfig.cmake " set( ${vlib}_USE_FILE \"${${vlib}_USE_FILE}\" )\n")
file( APPEND ${CMAKE_BINARY_DIR}/config/CGALConfig.cmake " set( ${vlib}_INCLUDE_DIR \"${${vlib}_INCLUDE_DIR}\" )\n")
file( APPEND ${CMAKE_BINARY_DIR}/config/CGALConfig.cmake " set( ${vlib}_LIBRARIES \"${${vlib}_LIBRARIES}\" )\n")
file( APPEND ${CMAKE_BINARY_DIR}/config/CGALConfig.cmake " set( ${vlib}_DEFINITIONS \"${${vlib}_DEFINITIONS}\" )\n")
file( APPEND ${CMAKE_BINARY_DIR}/config/CGALConfig.cmake "endif()\n\n")
endif()
endforeach()

View File

@ -15,53 +15,41 @@ foreach (lib ${CGAL_SUPPORTING_3RD_PARTY_LIBRARIES})
if ("${POSITION}" STRGREATER "-1" OR WITH_${lib})
# In both cases CGAL_USE_<lib> will be finally set.
#message (STATUS "With ${lib} given or essential: pos=${POSITION}")
if ( CGAL_ENABLE_PRECONFIG )
message (STATUS "Preconfiguring library: ${lib} ...")
else()
message (STATUS "Configuring library: ${lib} ...")
endif()
message (STATUS "Configuring library: ${lib} ...")
find_package( ${lib} )
if ( ${vlib}_FOUND )
if ( CGAL_ENABLE_PRECONFIG )
message( STATUS "${lib} has been preconfigured:")
message( STATUS " Use${lib}-file: ${${vlib}_USE_FILE}")
message( STATUS " ${lib} include: ${${vlib}_INCLUDE_DIR}" )
message( STATUS " ${lib} libraries: ${${vlib}_LIBRARIES}" )
message( STATUS " ${lib} definitions: ${${vlib}_DEFINITIONS}" )
else()
message( STATUS "${lib} has been configured")
use_lib( ${vlib} ${${vlib}_USE_FILE})
endif()
if ( ${vlib}_FOUND )
message( STATUS "${lib} has been configured")
use_lib( ${vlib} ${${vlib}_USE_FILE})
# TODO EBEB what about Qt5, zlib etc?
set ( CGAL_USE_${vlib} TRUE )
# Part 2: Add some lib-specific definitions or obtain version
if (${lib} STREQUAL "GMP")
if (${lib} STREQUAL "GMP")
get_dependency_version(GMP)
endif()
if (${lib} STREQUAL "MPFR")
if (${lib} STREQUAL "MPFR")
set( MPFR_DEPENDENCY_INCLUDE_DIR ${GMP_INCLUDE_DIR} )
set( MPFR_DEPENDENCY_LIBRARIES ${GMP_LIBRARIES} )
get_dependency_version(MPFR)
endif()
if (${lib} STREQUAL "LEDA")
if (${lib} STREQUAL "LEDA")
# special case for LEDA - add a flag
message( STATUS "LEDA cxx flags: ${LEDA_CXX_FLAGS}" )
uniquely_add_flags( CMAKE_CXX_FLAGS ${LEDA_CXX_FLAGS} )
endif()
else()
else()
if ("${POSITION}" STRGREATER "-1") # if lib is essential
message( FATAL_ERROR "CGAL requires ${lib} to be found" )
endif()

View File

@ -3,7 +3,7 @@
if( MPFI_FOUND AND NOT MPFI_SETUP )
if (GMP_FOUND AND MPFR_FOUND)
if (GMP_FOUND AND MPFR_FOUND)
message( STATUS "UseMPFI" )
message( STATUS "MPFI include: ${MPFI_INCLUDE_DIR}" )
@ -30,11 +30,7 @@ if( MPFI_FOUND AND NOT MPFI_SETUP )
add_definitions( ${MPFI_DEFINITIONS} "-DCGAL_USE_MPFI" )
link_libraries( ${MPFI_LIBRARIES} )
else( COMPILED_MPFI_TEST AND MPFI_TEST_RESULT EQUAL 0)
if (CGAL_ENABLE_PRECONFIG)
message( STATUS "MPFI is incorrectly configured with CGAL" )
else()
message( STATUS "MPFI is incorrectly configured on this system" )
endif()
message( STATUS "MPFI is incorrectly configured on this system" )
message( STATUS
"Output of the failed MPFI test was:\n${MPFI_TEST_COMPILATION_OUTPUT}" )
message( STATUS "End of the MPFI test output" )