Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix installed cmake package files #521

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cmake/PackageConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
# Include targets file. This will create IMPORTED target @PROJECT_NAME@
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake")

if(@BUILD_SHARED_LIBS@)
get_target_property(@PROJECT_NAME@_BUILD_TYPES @PROJECT_NAME@::@PROJECT_NAME@ IMPORTED_CONFIGURATIONS)
endif()
if(@BUILD_STATIC_LIBS@)
get_target_property(@PROJECT_NAME@_static_BUILD_TYPES @PROJECT_NAME@::@PROJECT_NAME@_static IMPORTED_CONFIGURATIONS)
endif()

check_required_components("@PROJECT_NAME@")
8 changes: 8 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,14 @@ CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/grib2.h.in" "${CMAKE_CURRENT_BINARY_

target_include_directories(${lib_name}_objlib PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}>"
$<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include>)
if(BUILD_SHARED_LIBS)
target_include_directories(${lib_name}_shared PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}>"
$<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include>)
endif()
if(BUILD_STATIC_LIBS)
target_include_directories(${lib_name}_static PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}>"
$<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include>)
endif()

if (NOT WIN32)
target_link_libraries(${lib_name}_objlib INTERFACE m)
Expand Down
Loading