Fix CMake scripts when GMP or MPFR is found under auxiliary/

This commit is contained in:
Laurent Rineau 2018-04-16 18:21:08 +02:00
parent 160d36af18
commit ee61c2752c
4 changed files with 31 additions and 25 deletions

View File

@ -902,7 +902,7 @@ install(PROGRAMS ${scripts} DESTINATION ${CGAL_INSTALL_BIN_DIR})
install(DIRECTORY ${CGAL_MODULES_REL_DIR}/ DESTINATION ${CGAL_INSTALL_CMAKE_DIR} )
install(FILES ${CGAL_MODULES_REL_DIR}/UseCGAL.cmake DESTINATION ${CGAL_INSTALL_CMAKE_DIR} )
if ( GMP_IN_AUXILIARY )
if ( GMP_IN_CGAL_AUXILIARY OR MPFR_IN_CGAL_AUXILIARY )
install(DIRECTORY auxiliary/gmp/include/ DESTINATION ${CGAL_INSTALL_INC_DIR} )
install(DIRECTORY auxiliary/gmp/lib/ DESTINATION ${CGAL_INSTALL_LIB_DIR} )
endif()

View File

@ -54,8 +54,22 @@ function(use_CGAL_GMP_support target)
return()
endif()
target_include_directories(${target} SYSTEM ${keyword} ${GMP_INCLUDE_DIR} ${MPFR_INCLUDE_DIR})
target_link_libraries(${target} ${keyword} ${GMP_LIBRARIES} ${MPFR_LIBRARIES})
if(NOT GMP_IN_CGAL_AUXILIARY)
target_include_directories(${target} SYSTEM ${keyword} ${GMP_INCLUDE_DIR})
else()
target_include_directories(${target} SYSTEM ${keyword}
$<BUILD_INTERFACE:${GMP_INCLUDE_DIR}>
$<INSTALL_INTERFACE:include>)
endif()
target_link_libraries(${target} ${keyword} ${GMP_LIBRARIES})
if(NOT MPFR_IN_CGAL_AUXILIARY)
target_include_directories(${target} SYSTEM ${keyword} ${MPFR_INCLUDE_DIR})
else()
target_include_directories(${target} SYSTEM ${keyword}
$<BUILD_INTERFACE:${MPFR_INCLUDE_DIR}>
$<INSTALL_INTERFACE:include>)
endif()
target_link_libraries(${target} ${keyword} ${MPFR_LIBRARIES})
if(WITH_GMPXX OR CGAL_WITH_GMPXX)
target_include_directories(${target} SYSTEM ${keyword} ${GMPXX_INCLUDE_DIR})
target_link_libraries(${target} ${keyword} ${GMPXX_LIBRARIES})

View File

@ -21,11 +21,7 @@ if(NOT GMP_LIBRARIES)
endif()
# Is it already configured?
if (GMP_in_cache)
set(GMP_FOUND TRUE)
else()
if( NOT GMP_in_cache )
find_path(GMP_INCLUDE_DIR
NAMES gmp.h
@ -36,10 +32,6 @@ else()
DOC "The directory containing the GMP header files"
)
if ( GMP_INCLUDE_DIR STREQUAL "${CGAL_INSTALLATION_PACKAGE_DIR}/auxiliary/gmp/include" )
cache_set( GMP_IN_CGAL_AUXILIARY TRUE )
endif()
find_library(GMP_LIBRARIES NAMES gmp libgmp-10 mpir
HINTS ENV GMP_LIB_DIR
ENV GMP_DIR
@ -57,6 +49,11 @@ else()
include( GMPConfig OPTIONAL )
endif()
find_package_handle_standard_args(GMP "DEFAULT_MSG" GMP_LIBRARIES GMP_INCLUDE_DIR)
endif()
find_package_handle_standard_args(GMP "DEFAULT_MSG" GMP_LIBRARIES GMP_INCLUDE_DIR)
if ( GMP_INCLUDE_DIR STREQUAL "${CGAL_INSTALLATION_PACKAGE_DIR}/auxiliary/gmp/include" )
cache_set( GMP_IN_CGAL_AUXILIARY TRUE )
endif()

View File

@ -20,11 +20,7 @@ if(NOT MPFR_LIBRARIES)
endif()
# Is it already configured?
if (MPFR_in_cache)
set(MPFR_FOUND TRUE)
else()
if (NOT MPFR_in_cache)
find_path(MPFR_INCLUDE_DIR
NAMES mpfr.h
@ -35,10 +31,6 @@ else()
DOC "The directory containing the MPFR header files"
)
if ( MPFR_INCLUDE_DIR STREQUAL "${CGAL_INSTALLATION_PACKAGE_DIR}/auxiliary/gmp/include" )
cache_set( MPFR_IN_CGAL_AUXILIARY TRUE )
endif()
find_library(MPFR_LIBRARIES NAMES mpfr libmpfr-4 libmpfr-1
HINTS ENV MPFR_LIB_DIR
ENV MPFR_DIR
@ -56,7 +48,10 @@ else()
include( MPFRConfig OPTIONAL )
endif()
find_package_handle_standard_args(MPFR "DEFAULT_MSG" MPFR_LIBRARIES MPFR_INCLUDE_DIR)
endif()
find_package_handle_standard_args(MPFR "DEFAULT_MSG" MPFR_LIBRARIES MPFR_INCLUDE_DIR)
if ( MPFR_INCLUDE_DIR STREQUAL "${CGAL_INSTALLATION_PACKAGE_DIR}/auxiliary/gmp/include" )
cache_set( MPFR_IN_CGAL_AUXILIARY TRUE )
endif()