From c5ebd7c88e4654f149ea2eabf480d5154659d0ee Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Fri, 2 Apr 2021 14:30:02 +0200 Subject: [PATCH] dichotomize multiconfig generators --- Installation/cmake/modules/FindGMP.cmake | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Installation/cmake/modules/FindGMP.cmake b/Installation/cmake/modules/FindGMP.cmake index b10f245fd27..3f94b30ae9f 100644 --- a/Installation/cmake/modules/FindGMP.cmake +++ b/Installation/cmake/modules/FindGMP.cmake @@ -38,16 +38,28 @@ if( NOT GMP_in_cache ) PATH_SUFFIXES lib DOC "Path to the Release GMP library" ) - - find_library(GMP_LIBRARY_DEBUG NAMES gmpd libgmp-10 mpir + + find_library(GMP_LIBRARY_DEBUG NAMES gmpd libgmp-10 mpir HINTS ENV GMP_LIB_DIR ENV GMP_DIR ${CGAL_INSTALLATION_PACKAGE_DIR}/auxiliary/gmp/lib PATH_SUFFIXES lib DOC "Path to the Debug GMP library" ) - - set(GMP_LIBRARIES $,${GMP_LIBRARY_DEBUG},${GMP_LIBRARY_RELEASE}>) + + if(NOT GMP_LIBRARY_DEBUG) + set(GMP_LIBRARY_DEBUG ${GMP_LIBRARY_RELEASE}) + endif() + get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + if(IS_MULTI_CONFIG) + set(GMP_LIBRARIES $,${GMP_LIBRARY_DEBUG},${GMP_LIBRARY_RELEASE}>) +else() + if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") + set(GMP_LIBRARIES ${GMP_LIBRARY_DEBUG}) + else() + set(GMP_LIBRARIES ${GMP_LIBRARY_RELEASE}) + endif() +endif() if ( GMP_LIBRARIES ) get_filename_component(GMP_LIBRARIES_DIR ${GMP_LIBRARIES} PATH CACHE ) endif()