diff --git a/ports/gsl/CMakeLists.txt b/ports/gsl/CMakeLists.txt index eb38a44315..0027fe2916 100644 --- a/ports/gsl/CMakeLists.txt +++ b/ports/gsl/CMakeLists.txt @@ -63,10 +63,11 @@ target_link_libraries(gsl PUBLIC gslcblas) if(INSTALL_HEADERS) set_target_properties(gsl PROPERTIES PUBLIC_HEADER "${PUBLIC_HEADERS}") endif() -target_include_directories(gslcblas PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) -target_include_directories(gsl 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_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) # 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) if(INSTALL_HEADERS) diff --git a/ports/gsl/CONTROL b/ports/gsl/CONTROL index b6dc858dc9..f02ecc2eee 100644 --- a/ports/gsl/CONTROL +++ b/ports/gsl/CONTROL @@ -1,3 +1,3 @@ Source: gsl -Version: 2.4-2 +Version: 2.4-3 Description: The GNU Scientific Library is a numerical library for C and C++ programmers diff --git a/ports/gsl/portfile.cmake b/ports/gsl/portfile.cmake index 519fe47082..12c0526bcd 100644 --- a/ports/gsl/portfile.cmake +++ b/ports/gsl/portfile.cmake @@ -27,7 +27,7 @@ vcpkg_configure_cmake( vcpkg_install_cmake() # 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) vcpkg_copy_pdbs() diff --git a/ports/gsl/usage b/ports/gsl/usage new file mode 100644 index 0000000000..f1ae92436d --- /dev/null +++ b/ports/gsl/usage @@ -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) diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index b3e27b5d0c..a1989b23ab 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -251,6 +251,18 @@ macro(find_package name) set_target_properties(hdf5::${HDF5TARGET}-static PROPERTIES INTERFACE_LINK_LIBRARIES "hdf5::${HDF5TARGET}-shared") endif() 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") _find_package(${ARGV}) if(CURL_FOUND)