diff --git a/CMakeLists.txt b/CMakeLists.txt index 5aed0560d8f..c5ed5c14046 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -346,10 +346,12 @@ if(GINKGO_BUILD_DOC) endif() -# add escape character '\' and convert the list to string +# add escape character '\' for space string(REPLACE " " "\ " PKG_CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") +# add escape character '\' for space in regex mode list(TRANSFORM GINKGO_INTERFACE_LINK_FLAGS REPLACE " " "\\\\ ") list(TRANSFORM GINKGO_INTERFACE_CXX_FLAGS REPLACE " " "\\\\ ") +# convert the list to string string(REPLACE ";" " " GINKGO_INTERFACE_CXX_FLAGS "${GINKGO_INTERFACE_CXX_FLAGS}") string(REPLACE ";" " " GINKGO_INTERFACE_LINK_FLAGS "${GINKGO_INTERFACE_LINK_FLAGS}") configure_file(${Ginkgo_SOURCE_DIR}/cmake/ginkgo.pc.in diff --git a/cmake/information_helpers.cmake b/cmake/information_helpers.cmake index aead7339472..781f7ecd27c 100644 --- a/cmake/information_helpers.cmake +++ b/cmake/information_helpers.cmake @@ -25,10 +25,7 @@ macro(ginkgo_interface_libraries_recursively INTERFACE_LIBS) foreach(_libs ${INTERFACE_LIBS}) if (TARGET ${_libs}) if("${_libs}" MATCHES "ginkgo.*") - set(GINKGO_INTERFACE_LIB_NAME "-l${_libs}") - if(upper_CMAKE_BUILD_TYPE STREQUAL "DEBUG") - set(GINKGO_INTERFACE_LIB_NAME "${GINKGO_INTERFACE_LIB_NAME}${CMAKE_DEBUG_POSTFIX}") - endif() + set(GINKGO_INTERFACE_LIB_NAME "-l${_libs}$<$:${CMAKE_DEBUG_POSTFIX}>") list(APPEND GINKGO_INTERFACE_LIBS_FOUND "${GINKGO_INTERFACE_LIB_NAME}") endif() # Get the link flags and treat them @@ -81,12 +78,7 @@ macro(ginkgo_interface_information) unset(GINKGO_INTERFACE_LIBS_FOUND) unset(GINKGO_INTERFACE_CFLAGS_FOUND) # Prepare recursively populated library list - string(TOUPPER "${CMAKE_BUILD_TYPE}" upper_CMAKE_BUILD_TYPE) - if (upper_CMAKE_BUILD_TYPE STREQUAL "DEBUG") - list(APPEND GINKGO_INTERFACE_LIBS_FOUND "-lginkgo${CMAKE_DEBUG_POSTFIX}") - else() - list(APPEND GINKGO_INTERFACE_LIBS_FOUND "-lginkgo") - endif() + list(APPEND GINKGO_INTERFACE_LIBS_FOUND "-lginkgo$<$:${CMAKE_DEBUG_POSTFIX}>") # Prepare recursively populated include directory list list(APPEND GINKGO_INTERFACE_CFLAGS_FOUND "-I${CMAKE_INSTALL_PREFIX}/${GINKGO_INSTALL_INCLUDE_DIR}")