diff --git a/Installation/cmake/modules/FindGMP.cmake b/Installation/cmake/modules/FindGMP.cmake index ab182de3af4..c88a3d898e0 100644 --- a/Installation/cmake/modules/FindGMP.cmake +++ b/Installation/cmake/modules/FindGMP.cmake @@ -10,8 +10,23 @@ include(CGAL_FindPackageHandleStandardArgs) include(CGAL_GeneratorSpecificSettings) +if(GMP_INCLUDE_DIR) + set(GMP_in_cache TRUE) +else() + set(GMP_in_cache FALSE) +endif() +if( CGAL_AUTO_LINK_ENABLED ) + if(NOT GMP_LIBRARIES_DIR) + set(GMP_in_cache FALSE) + endif() +else() + if(NOT GMP_LIBRARIES) + set(GMP_in_cache FALSE) + endif() +endif() + # Is it already configured? -if (GMP_INCLUDE_DIR AND GMP_LIBRARIES_DIR ) +if (GMP_in_cache) set(GMP_FOUND TRUE) @@ -55,6 +70,10 @@ else() include( GMPConfig OPTIONAL ) endif() - find_package_handle_standard_args(GMP "DEFAULT_MSG" GMP_INCLUDE_DIR GMP_LIBRARIES_DIR) + if(CGAL_AUTO_LINK_ENABLED) + 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) + endif() endif() diff --git a/Installation/cmake/modules/FindMPFR.cmake b/Installation/cmake/modules/FindMPFR.cmake index e6b2a3fdd78..e556534d8aa 100644 --- a/Installation/cmake/modules/FindMPFR.cmake +++ b/Installation/cmake/modules/FindMPFR.cmake @@ -10,8 +10,23 @@ include(CGAL_FindPackageHandleStandardArgs) include(CGAL_GeneratorSpecificSettings) +if(MPFR_INCLUDE_DIR) + set(MPFR_in_cache TRUE) +else() + set(MPFR_in_cache FALSE) +endif() +if( CGAL_AUTO_LINK_ENABLED ) + if(NOT MPFR_LIBRARIES_DIR) + set(MPFR_in_cache FALSE) + endif() +else() + if(NOT MPFR_LIBRARIES) + set(MPFR_in_cache FALSE) + endif() +endif() + # Is it already configured? -if (MPFR_INCLUDE_DIR AND MPFR_LIBRARIES_DIR ) +if (MPFR_in_cache) set(MPFR_FOUND TRUE) @@ -54,8 +69,12 @@ else() if ( NOT MPFR_INCLUDE_DIR OR NOT MPFR_LIBRARIES_DIR ) include( MPFRConfig OPTIONAL ) endif() - - find_package_handle_standard_args(MPFR "DEFAULT_MSG" MPFR_INCLUDE_DIR MPFR_LIBRARIES_DIR) - + + if(CGAL_AUTO_LINK_ENABLED) + 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) + endif() + endif()