Skip to content
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
45 changes: 45 additions & 0 deletions gotools-core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,49 @@ ELSE(WIN32)
)
ENDIF(WIN32)

# === Install Targets and Export Package ===

include(CMakePackageConfigHelpers)

# Install the GoToolsCore target with export set
install(TARGETS GoToolsCore
EXPORT GoToolsCoreTargets
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
)

# Install headers
install(DIRECTORY include/
DESTINATION include
FILES_MATCHING PATTERN "*.h"
)

# Export the targets to a file
install(EXPORT GoToolsCoreTargets
FILE GoToolsCoreTargets.cmake
#NAMESPACE GoTools:: # So consumer can do target_link_libraries(... GoTools::GoToolsCore)
DESTINATION lib/cmake/GoToolsCore
)

# Generate and install the Config and Version files
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/GoToolsCoreConfigVersion.cmake"
VERSION ${GoTools_VERSION_MAJOR}.${GoTools_VERSION_MINOR}.${GoTools_VERSION_PATCH}
COMPATIBILITY SameMajorVersion
)

configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/GoToolsCoreConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/GoToolsCoreConfig.cmake"
INSTALL_DESTINATION lib/cmake/GoToolsCore
)

install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/GoToolsCoreConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/GoToolsCoreConfigVersion.cmake"
DESTINATION lib/cmake/GoToolsCore
)

SET(CPACK_STRIP_FILES ${CPACK_STRIP_FILES} libGoToolsCore.so)
9 changes: 9 additions & 0 deletions gotools-core/cmake/GoToolsCoreConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@PACKAGE_INIT@

include("${CMAKE_CURRENT_LIST_DIR}/GoToolsCoreTargets.cmake")

# Legacy compatibility
set(GoTools_LIBRARIES GoToolsCore)

# Optionally set variables
set(GoToolsCore_INCLUDE_DIRS "@CMAKE_INSTALL_PREFIX@/include")
40 changes: 40 additions & 0 deletions lrsplines2D/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,44 @@ ELSE(WIN32)
)
ENDIF(WIN32)

# === Install and Export CMake Config Package ===

include(CMakePackageConfigHelpers)

# Install the GoLRspline2D target
install(TARGETS GoLRspline2D
EXPORT GoLRspline2DTargets
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
)

# Export the target without namespace
install(EXPORT GoLRspline2DTargets
FILE GoLRsplines2DTargets.cmake
DESTINATION lib/cmake/GoLRsplines2D
)

# Generate the version file for find_package()
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/GoLRsplines2DConfigVersion.cmake"
VERSION ${GoTools_ABI_VERSION}
COMPATIBILITY SameMajorVersion
)

# Generate the config file from template
configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/GoLRsplines2DConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/GoLRsplines2DConfig.cmake"
INSTALL_DESTINATION lib/cmake/GoLRsplines2D
)

# Install the generated config files
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/GoLRsplines2DConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/GoLRsplines2DConfigVersion.cmake"
DESTINATION lib/cmake/GoLRsplines2D
)

SET(CPACK_STRIP_FILES ${CPACK_STRIP_FILES} libGoLRspline2D.so)
9 changes: 9 additions & 0 deletions lrsplines2D/cmake/GoLRsplines2DConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@PACKAGE_INIT@

include("${CMAKE_CURRENT_LIST_DIR}/GoLRsplines2DTargets.cmake")

# Legacy compatibility
set(GoLRsplines2D_LIBRARIES GoLRspline2D)

# Optional include path var
set(GoLRsplines2D_INCLUDE_DIRS "@CMAKE_INSTALL_PREFIX@/include")
2 changes: 1 addition & 1 deletion sisl