diff options
| author | David Aguilar <davvid@gmail.com> | 2025-09-28 23:35:14 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-29 06:35:14 +0000 |
| commit | 9936bccab1537e5430af449651db70c3f5d591df (patch) | |
| tree | dade30691baccf98d2d8e4429796c63cdaf7a970 | |
| parent | d5f3f477918769338dd5baa73ff560d10a5ca7e9 (diff) | |
cmake: install config files into the correct directory for find_package() (#8482)
cmake's find_package() will only find the configs when they are in a
slang/ subdirectory.
Co-authored-by: Mukund Keshava <mkeshava@nvidia.com>
| -rw-r--r-- | CMakeLists.txt | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index ae99959f7..dc22e75f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -530,14 +530,19 @@ write_basic_package_version_file( COMPATIBILITY SameMajorVersion ) -# Write SlangConfig.cmake which should allow find_pacakage(SLANG) to work correctly +# Write SlangConfig.cmake which should allow find_package(SLANG) to work correctly # SlangConfig.cmake will define slang::slang target that can be linked with using # target_link_libraries. It will also define SLANG_EXECUTABLE export variable that # should point to slangc if SLANG_ENABLE_SLANGC is ON. +if(WIN32) + set(SLANG_CMAKE_CONFIG_DIR cmake) +else() + set(SLANG_CMAKE_CONFIG_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}) +endif() configure_package_config_file( "${PROJECT_SOURCE_DIR}/cmake/SlangConfig.cmake.in" "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" - INSTALL_DESTINATION cmake + INSTALL_DESTINATION ${SLANG_CMAKE_CONFIG_DIR} ) # Conditionally handle the case for Emscripten where slang does not create @@ -549,7 +554,7 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten") EXPORT SlangTargets FILE ${PROJECT_NAME}Targets.cmake NAMESPACE ${PROJECT_NAME}:: - DESTINATION cmake + DESTINATION ${SLANG_CMAKE_CONFIG_DIR} ) endif() endif() @@ -558,5 +563,5 @@ install( FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" - DESTINATION cmake + DESTINATION ${SLANG_CMAKE_CONFIG_DIR} ) |
