Skip to content

Commit

Permalink
Modify package config
Browse files Browse the repository at this point in the history
  • Loading branch information
obhi-d committed Nov 25, 2024
1 parent d282701 commit 097d4b3
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
24 changes: 24 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -338,3 +338,27 @@ install(DIRECTORY "${slang_SOURCE_DIR}/docs/" DESTINATION share/doc/slang)
install(DIRECTORY "${slang_SOURCE_DIR}/include" DESTINATION .)

include(CPack)

include(CMakePackageConfigHelpers)
write_basic_package_version_file("${PROJECT_NAME}ConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion)

configure_package_config_file(
"${PROJECT_SOURCE_DIR}/cmake/SlangConfig.cmake.in"
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION
cmake
)

install(TARGETS slang EXPORT SlangExportTarget)

install(EXPORT SlangExportTarget
FILE ${PROJECT_NAME}Targets.cmake
NAMESPACE ${PROJECT_NAME}::
DESTINATION cmake)

install(FILES
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION cmake)
6 changes: 6 additions & 0 deletions cmake/SlangConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

@PACKAGE_INIT@

include("${CMAKE_CURRENT_LIST_DIR}/slangTargets.cmake")
check_required_components("slang")

0 comments on commit 097d4b3

Please sign in to comment.