added CGAL_ENABLE_PRECONFIG (the default value has to be determined)

This commit is contained in:
Eric Berberich 2012-06-20 11:16:17 +00:00
parent 7a9557e414
commit 3fde316a6c
7 changed files with 38 additions and 24 deletions

View File

@ -1,7 +1,7 @@
# Created by the script cgal_create_cmake_script_with_options
# Created by the script cgal_create_CMakeLists
# This is the CMake script for compiling a set of CGAL applications.
project( Algebraic_kernel_d )
project( Algebraic_kernel_d_test )
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_GREATER 2.6)
@ -12,16 +12,9 @@ if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_GREATER 2.6)
endif()
endif()
set( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true )
if ( COMMAND cmake_policy )
cmake_policy( SET CMP0003 NEW )
endif()
# CGAL and its components
#find_package( CGAL QUIET COMPONENTS GMP MPFR MPFI RS3 )
find_package( CGAL QUIET COMPONENTS ALL_PRECONFIGURED_LIBS )
find_package( CGAL QUIET COMPONENTS Core GMP MPFR MPFI RS3 )
if ( NOT CGAL_FOUND )
message(STATUS "This project requires the CGAL library, and will not be compiled.")

View File

@ -541,10 +541,12 @@ cache_set(CGAL_3RD_PARTY_INCLUDE_DIRS "" )
cache_set(CGAL_3RD_PARTY_LIBRARIES "" )
cache_set(CGAL_3RD_PARTY_LIBRARIES_DIRS "" )
include(CGAL_SetupDependencies)
option( CGAL_ALLOW_ALL_PRECONFIGURED_LIBS_COMPONENT "Select to allow
# TODO default for CGAL_ENABLE_PRECONFIG = ON?
option( CGAL_ENABLE_PRECONFIG "Select to allow to preconfiguration of external libraries" OFF)
option( CGAL_ALLOW_ALL_PRECONFIGURED_LIBS_COMPONENT "Select to allow
to use all preconfigured external libraries" OFF)
include(CGAL_SetupDependencies)
message("== Detect external libraries (DONE) ==\n")

View File

@ -134,6 +134,7 @@ endforeach()
set( CGAL_REQUESTED_COMPONENTS ${CGAL_FIND_COMPONENTS} )
# for preconfigured libs
set(CGAL_ENABLE_PRECONFIG "@CGAL_ENABLE_PRECONFIG@")
set(CGAL_SUPPORTING_3RD_PARTY_LIBRARIES "@CGAL_SUPPORTING_3RD_PARTY_LIBRARIES@")
set(CGAL_MANDATORY_3RD_PARTY_LIBRARIES "@CGAL_MANDATORY_3RD_PARTY_LIBRARIES@")

View File

@ -134,6 +134,7 @@ endforeach()
set( CGAL_REQUESTED_COMPONENTS ${CGAL_FIND_COMPONENTS} )
# for preconfigured libs
set(CGAL_ENABLE_PRECONFIG "@CGAL_ENABLE_PRECONFIG@")
set(CGAL_SUPPORTING_3RD_PARTY_LIBRARIES "@CGAL_SUPPORTING_3RD_PARTY_LIBRARIES@")
set(CGAL_MANDATORY_3RD_PARTY_LIBRARIES "@CGAL_MANDATORY_3RD_PARTY_LIBRARIES@")

View File

@ -380,7 +380,9 @@ if( NOT CGAL_MACROS_FILE_INCLUDED )
# There is also a version of CGALConfig.cmake that is prepared in case CGAL in installed in CMAKE_INSTALL_PREFIX.
configure_file("${CGAL_MODULES_DIR}/CGALConfig_install.cmake.in" "${CMAKE_BINARY_DIR}/config/CGALConfig.cmake" @ONLY)
foreach( lib ${CGAL_SUPPORTING_3RD_PARTY_LIBRARIES} )
if (CGAL_ENABLE_PRECONFIG)
foreach( lib ${CGAL_SUPPORTING_3RD_PARTY_LIBRARIES} )
if ( WITH_${lib} )
@ -402,7 +404,8 @@ if( NOT CGAL_MACROS_FILE_INCLUDED )
endif ( WITH_${lib} )
endforeach()
endforeach()
endif()
endmacro()

View File

@ -14,20 +14,30 @@ foreach (lib ${CGAL_SUPPORTING_3RD_PARTY_LIBRARIES})
# message (STATUS "With ${lib} given")
message (STATUS "Preconfiguring library: ${lib} ...")
if ( CGAL_ENABLE_PRECONFIG )
message (STATUS "Preconfiguring library: ${lib} ...")
else()
message (STATUS "Configuring library: ${lib} ...")
endif()
find_package( ${lib} )
if ( ${vlib}_FOUND )
message( STATUS "${lib} has been preconfigured:")
message( STATUS " CGAL_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}" )
if ( CGAL_ENABLE_PRECONFIG )
message( STATUS "${lib} has been preconfigured:")
message( STATUS " CGAL_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()
# TODO EBEB what about Qt3, Qt4, zlib etc?
set ( CGAL_USE_${vlib} TRUE )
# Part 2: Add some lib-specific definitions or obtain version
if (${lib} STREQUAL "GMP")

View File

@ -30,7 +30,11 @@ 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)
message( STATUS "MPFI was incorrectly configured on this system" )
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
"Output of the failed MPFI test was:\n${MPFI_TEST_COMPILATION_OUTPUT}" )
message( STATUS "End of the MPFI test output" )