Skip to content

Commit 51b6401

Browse files
pbalcerbb-ur
authored andcommitted
fix static loader when building in-tree (#21477)
1 parent 643883f commit 51b6401

1 file changed

Lines changed: 30 additions & 25 deletions

File tree

CMakeLists.txt

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -379,32 +379,37 @@ if(UR_BUILD_TOOLS)
379379
add_subdirectory(tools)
380380
endif()
381381

382-
# Add the list of installed targets to the install. This includes the namespace
383-
# which all installed targets will be prefixed with, e.g. for the headers
384-
# target users will depend on ${PROJECT_NAME}::headers.
385-
install(
386-
EXPORT ${PROJECT_NAME}-targets
387-
FILE ${PROJECT_NAME}-targets.cmake
388-
NAMESPACE ${PROJECT_NAME}::
389-
DESTINATION lib/cmake/${PROJECT_NAME})
390-
391-
# Configure the package versions file for use in find_package when installed.
392-
write_basic_package_version_file(
393-
${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}-config-version.cmake
394-
COMPATIBILITY SameMajorVersion)
395-
# Configure the package file that is searched for by find_package when
396-
# installed.
397-
configure_package_config_file(
398-
${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}-config.cmake.in
399-
${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}-config.cmake
400-
INSTALL_DESTINATION lib/cmake/${PROJECT_NAME})
401-
402-
# Add the package files to the install.
403-
install(
404-
FILES
405-
${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}-config.cmake
382+
# The export set and package config files are only needed when UR is built as
383+
# a standalone project. When built in-tree (LLVM/SYCL), the
384+
# parent project provides its own install rules.
385+
if(UR_STANDALONE_BUILD)
386+
# Add the list of installed targets to the install. This includes the
387+
# namespace which all installed targets will be prefixed with, e.g. for
388+
# the headers target users will depend on ${PROJECT_NAME}::headers.
389+
install(
390+
EXPORT ${PROJECT_NAME}-targets
391+
FILE ${PROJECT_NAME}-targets.cmake
392+
NAMESPACE ${PROJECT_NAME}::
393+
DESTINATION lib/cmake/${PROJECT_NAME})
394+
395+
# Configure the package versions file for use in find_package when installed.
396+
write_basic_package_version_file(
406397
${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}-config-version.cmake
407-
DESTINATION lib/cmake/${PROJECT_NAME})
398+
COMPATIBILITY SameMajorVersion)
399+
# Configure the package file that is searched for by find_package when
400+
# installed.
401+
configure_package_config_file(
402+
${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}-config.cmake.in
403+
${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}-config.cmake
404+
INSTALL_DESTINATION lib/cmake/${PROJECT_NAME})
405+
406+
# Add the package files to the install.
407+
install(
408+
FILES
409+
${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}-config.cmake
410+
${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}-config-version.cmake
411+
DESTINATION lib/cmake/${PROJECT_NAME})
412+
endif()
408413

409414
set(API_JSON_FILE ${PROJECT_BINARY_DIR}/unified_runtime.json)
410415

0 commit comments

Comments
 (0)