Skip to content

Commit

Permalink
fix: use GNUInstallDirs for installation locations (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
baszalmstra authored Oct 1, 2024
1 parent ce40c2e commit e19cf81
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 15 additions & 9 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,24 +106,30 @@ target_include_directories(
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include/resolvo>)

include(GNUInstallDirs)

export(
TARGETS Resolvo resolvo_cpp
NAMESPACE Resolvo::
FILE "${CMAKE_BINARY_DIR}/lib/cmake/Resolvo/ResolvoTargets.cmake")
install(
EXPORT ResolvoTargets
NAMESPACE Resolvo::
DESTINATION lib/cmake/Resolvo)
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Resolvo)

install(
TARGETS Resolvo resolvo_cpp
EXPORT ResolvoTargets
LIBRARY DESTINATION lib
PUBLIC_HEADER DESTINATION include/resolvo)

install(FILES $<TARGET_FILE:${resolvo_cpp_impl}> TYPE LIB)
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/resolvo)

if(WIN32)
install(FILES $<TARGET_LINKER_FILE:${resolvo_cpp_impl}> TYPE LIB)
if(BUILD_SHARED_LIBS)
install(FILES $<TARGET_FILE:${resolvo_cpp_impl}> TYPE BIN)
if(WIN32)
install(FILES $<TARGET_LINKER_FILE:${resolvo_cpp_impl}> TYPE LIB)
endif()
else()
install(FILES $<TARGET_FILE:${resolvo_cpp_impl}> TYPE LIB)
endif()

include(CMakePackageConfigHelpers)
Expand Down Expand Up @@ -160,7 +166,7 @@ function(_resolvo_write_configure_file)
configure_package_config_file(
"cmake/ResolvoConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/Resolvo/ResolvoConfig.cmake"
INSTALL_DESTINATION lib/cmake/resolvo)
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Resolvo)
endfunction()

cmake_language(DEFER CALL _resolvo_write_configure_file)
Expand All @@ -175,7 +181,7 @@ install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/Resolvo/ResolvoConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/Resolvo/ResolvoConfigVersion.cmake"
DESTINATION lib/cmake/Resolvo)
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Resolvo)

if(RESOLVO_BUILD_TESTING)
add_subdirectory(tests)
Expand Down
2 changes: 1 addition & 1 deletion cpp/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "resolvo_cpp"
description = "Resolvo C++ integration"
version = "0.2.0"
version = "0.2.1"
authors.workspace = true
keywords.workspace = true
categories.workspace = true
Expand Down

0 comments on commit e19cf81

Please sign in to comment.