Reintegrate the work of /branches/unsorted-branches/Test-no_autolink-for-gmp_mpfr-branch/Installation:

If(MSVC), create CMake variables CGAL_AUTO_LINK_GMP and CGAL_AUTO_LINK_GMP
that can be set to OFF to disable the autolinking for GMP and MPFR. Those
variables are stored in the cache, and in CGALConfig.cmake
This commit is contained in:
Laurent Rineau 2010-06-14 16:47:06 +00:00
parent 54b0fbc99a
commit f16e5d0698
5 changed files with 33 additions and 14 deletions

View File

@ -73,6 +73,8 @@ set(CGAL_Qt4_3RD_PARTY_LIBRARIES "@CGAL_Qt4_3RD_PARTY_LIBRARIES@" )
set(CGAL_VERSION "${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}.${CGAL_BUILD_VERSION}")
set(CGAL_GMP_VERSION "@GMP_VERSION@")
set(CGAL_MPFR_VERSION "@MPFR_VERSION@")
set(CGAL_AUTO_LINK_GMP "@CGAL_AUTO_LINK_GMP@")
set(CGAL_AUTO_LINK_MPFR "@CGAL_AUTO_LINK_MPFR@")
set(CGAL_USE_FILE "${CGAL_CMAKE_MODULE_PATH}/UseCGAL.cmake" )

View File

@ -6,6 +6,14 @@ if ( NOT CGAL_GENERATOR_SPECIFIC_SETTINGS_FILE_INCLUDED )
if ( MSVC )
message( STATUS "Target build enviroment supports auto-linking" )
set(CGAL_AUTO_LINK_ENABLED TRUE)
if(NOT CGAL_CONFIG_LOADED)
set(CGAL_AUTO_LINK_GMP TRUE
CACHE BOOL "Enable/Disable auto-linking for the external library GMP")
set(CGAL_AUTO_LINK_MPFR TRUE
CACHE BOOL "Enable/Disable auto-linking for the external library MPFR")
endif()
endif()
if ( MSVC10 )

View File

@ -16,6 +16,7 @@ if ( NOT CGAL_GMP_SETUP )
message( STATUS "MPFR include: ${MPFR_INCLUDE_DIR}" )
message( STATUS "MPFR libraries: ${MPFR_LIBRARIES}" )
message( STATUS "MPFR definitions: ${MPFR_DEFINITIONS}" )
set( MPFR_DEPENDENCY_LIBRARIES ${GMP_LIBRARIES} )
set( MPFR_DEPENDENCY_INCLUDE_DIR ${GMP_INCLUDE_DIR} )
get_dependency_version(MPFR)
@ -30,11 +31,18 @@ if ( NOT CGAL_GMP_SETUP )
add_to_cached_list(CGAL_3RD_PARTY_LIBRARIES_DIRS ${GMP_LIBRARIES_DIR} )
add_to_cached_list(CGAL_3RD_PARTY_DEFINITIONS ${GMP_DEFINITIONS} )
if ( NOT MSVC )
if ( NOT CGAL_AUTOLINK_MPFR )
add_to_cached_list(CGAL_3RD_PARTY_LIBRARIES ${MPFR_LIBRARIES} )
endif()
if ( NOT CGAL_AUTOLINK_GMP )
add_to_cached_list(CGAL_3RD_PARTY_LIBRARIES ${GMP_LIBRARIES} )
endif()
if ( MSVC AND NOT CGAL_AUTOLINK_MPFR )
add_to_cached_list(CGAL_3RD_PARTY_DEFINITIONS -DCGAL_NO_AUTOLINK_MPFR )
endif()
if ( MSVC AND NOT CGAL_NO_AUTOLINK_GMP )
add_to_cached_list(CGAL_3RD_PARTY_DEFINITIONS -DCGAL_NO_AUTOLINK_GMP )
endif()
else( MPFR_FOUND )
message("CGAL GMP support needs MPFR. GMP will not be supported.")

View File

@ -15,7 +15,7 @@ if(GMP_INCLUDE_DIR)
else()
set(GMP_in_cache FALSE)
endif()
if( CGAL_AUTO_LINK_ENABLED )
if( CGAL_AUTO_LINK_GMP )
if(NOT GMP_LIBRARIES_DIR)
set(GMP_in_cache FALSE)
endif()
@ -43,7 +43,7 @@ else()
cache_set( GMP_IN_CGAL_AUXILIARY TRUE )
endif()
if ( CGAL_AUTO_LINK_ENABLED )
if ( CGAL_AUTO_LINK_GMP )
find_path(GMP_LIBRARIES_DIR
NAMES "gmp-${CGAL_TOOLSET}-mt.lib" "gmp-${CGAL_TOOLSET}-mt-gd.lib"
@ -54,8 +54,9 @@ else()
else()
find_library(GMP_LIBRARIES NAMES gmp
find_library(GMP_LIBRARIES NAMES gmp gmp-1 gmp-2 gmp-3 gmp-4 gmp-5
PATHS ENV GMP_LIB_DIR
${CMAKE_SOURCE_DIR}/auxiliary/gmp/lib
DOC "Path to the GMP library"
)
@ -70,7 +71,7 @@ else()
include( GMPConfig OPTIONAL )
endif()
if(CGAL_AUTO_LINK_ENABLED)
if(CGAL_AUTO_LINK_GMP)
find_package_handle_standard_args(GMP "DEFAULT_MSG" GMP_LIBRARIES_DIR GMP_INCLUDE_DIR)
else()
find_package_handle_standard_args(GMP "DEFAULT_MSG" GMP_LIBRARIES GMP_INCLUDE_DIR)

View File

@ -15,7 +15,7 @@ if(MPFR_INCLUDE_DIR)
else()
set(MPFR_in_cache FALSE)
endif()
if( CGAL_AUTO_LINK_ENABLED )
if( CGAL_AUTO_LINK_MPFR )
if(NOT MPFR_LIBRARIES_DIR)
set(MPFR_in_cache FALSE)
endif()
@ -34,21 +34,21 @@ else()
find_path(MPFR_INCLUDE_DIR
NAMES mpfr.h
PATHS ${CMAKE_SOURCE_DIR}/auxiliary/gmp/include
ENV MPFR_INC_DIR
DOC "The directory containing the MPFR header files"
PATHS ENV MPFR_INC_DIR
${CMAKE_SOURCE_DIR}/auxiliary/gmp/include
DOC "The directory containing the MPFR header files"
)
if ( MPFR_INCLUDE_DIR STREQUAL "${CMAKE_SOURCE_DIR}/auxiliary/gmp/include" )
cache_set( MPFR_IN_CGAL_AUXILIARY TRUE )
endif()
if ( CGAL_AUTO_LINK_ENABLED )
if ( CGAL_AUTO_LINK_MPFR )
find_path(MPFR_LIBRARIES_DIR
NAMES "mpfr-${CGAL_TOOLSET}-mt.lib" "mpfr-${CGAL_TOOLSET}-mt-gd.lib"
PATHS ${CMAKE_SOURCE_DIR}/auxiliary/gmp/lib
ENV MPFR_LIB_DIR
PATHS ENV MPFR_LIB_DIR
${CMAKE_SOURCE_DIR}/auxiliary/gmp/lib
DOC "Directory containing the MPFR library"
)
@ -70,7 +70,7 @@ else()
include( MPFRConfig OPTIONAL )
endif()
if(CGAL_AUTO_LINK_ENABLED)
if(CGAL_AUTO_LINK_MPFR)
find_package_handle_standard_args(MPFR "DEFAULT_MSG" MPFR_LIBRARIES_DIR MPFR_INCLUDE_DIR)
else()
find_package_handle_standard_args(MPFR "DEFAULT_MSG" MPFR_LIBRARIES MPFR_INCLUDE_DIR)