[gsl] Fix finding release libs in debug configurations. Fixes #2982.

This commit is contained in:
Robert Schumacher 2018-03-07 11:56:21 -08:00
parent 7221344fd8
commit a759caf15e
5 changed files with 22 additions and 5 deletions

View File

@ -63,10 +63,11 @@ target_link_libraries(gsl PUBLIC gslcblas)
if(INSTALL_HEADERS) if(INSTALL_HEADERS)
set_target_properties(gsl PROPERTIES PUBLIC_HEADER "${PUBLIC_HEADERS}") set_target_properties(gsl PROPERTIES PUBLIC_HEADER "${PUBLIC_HEADERS}")
endif() endif()
target_include_directories(gslcblas PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) target_include_directories(gslcblas PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(gsl PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) target_include_directories(gsl PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
# For the build, we need to copy all headers to the gsl directory # For the build, we need to copy all headers to the gsl directory
file(COPY ${PUBLIC_HEADERS} DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/gsl") file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/gsl)
file(COPY ${PUBLIC_HEADERS} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/gsl")
set(TARGET_INSTALL_OPTIONS) set(TARGET_INSTALL_OPTIONS)
if(INSTALL_HEADERS) if(INSTALL_HEADERS)

View File

@ -1,3 +1,3 @@
Source: gsl Source: gsl
Version: 2.4-2 Version: 2.4-3
Description: The GNU Scientific Library is a numerical library for C and C++ programmers Description: The GNU Scientific Library is a numerical library for C and C++ programmers

View File

@ -27,7 +27,7 @@ vcpkg_configure_cmake(
vcpkg_install_cmake() vcpkg_install_cmake()
# Handle copyright # Handle copyright
file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/gsl) file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/gsl)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/gsl/COPYING ${CURRENT_PACKAGES_DIR}/share/gsl/copyright) file(RENAME ${CURRENT_PACKAGES_DIR}/share/gsl/COPYING ${CURRENT_PACKAGES_DIR}/share/gsl/copyright)
vcpkg_copy_pdbs() vcpkg_copy_pdbs()

4
ports/gsl/usage Normal file
View File

@ -0,0 +1,4 @@
The package gsl is compatible with built-in CMake targets:
find_package(GSL REQUIRED)
target_link_libraries(main PRIVATE GSL::gsl GSL::gslcblas)

View File

@ -251,6 +251,18 @@ macro(find_package name)
set_target_properties(hdf5::${HDF5TARGET}-static PROPERTIES INTERFACE_LINK_LIBRARIES "hdf5::${HDF5TARGET}-shared") set_target_properties(hdf5::${HDF5TARGET}-static PROPERTIES INTERFACE_LINK_LIBRARIES "hdf5::${HDF5TARGET}-shared")
endif() endif()
endforeach() endforeach()
elseif("${name}" STREQUAL "GSL")
_find_package(${ARGV})
if(GSL_FOUND AND TARGET GSL::gsl)
set_property( TARGET GSL::gslcblas APPEND PROPERTY IMPORTED_CONFIGURATIONS Release )
set_property( TARGET GSL::gsl APPEND PROPERTY IMPORTED_CONFIGURATIONS Release )
if( EXISTS "${GSL_LIBRARY_DEBUG}" AND EXISTS "${GSL_CBLAS_LIBRARY_DEBUG}")
set_property( TARGET GSL::gsl APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
set_target_properties( GSL::gsl PROPERTIES IMPORTED_LOCATION_DEBUG "${GSL_LIBRARY_DEBUG}" )
set_property( TARGET GSL::gslcblas APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
set_target_properties( GSL::gslcblas PROPERTIES IMPORTED_LOCATION_DEBUG "${GSL_CBLAS_LIBRARY_DEBUG}" )
endif()
endif()
elseif("${name}" STREQUAL "CURL") elseif("${name}" STREQUAL "CURL")
_find_package(${ARGV}) _find_package(${ARGV})
if(CURL_FOUND) if(CURL_FOUND)