summaryrefslogtreecommitdiff
path: root/openmp
diff options
context:
space:
mode:
authorMichael Halkenhäuser <MichaelGerald.Halkenhauser@amd.com>2025-08-27 14:09:17 +0200
committerGitHub <noreply@github.com>2025-08-27 14:09:17 +0200
commitc5e1ac40f2457eeb47b4555198edf4a49b40675b (patch)
tree7ca5180a9e30ab53f595e251f0f7496e8c3fa19f /openmp
parentc209cca6775d05d2e19b169b44b319d4a9efc755 (diff)
[OpenMP][ompTest] Guard installation of all components (#155433)
Make installation of ompTest optional via: -DLIBOMPTEST_INSTALL_COMPONENTS=ON (default: OFF)
Diffstat (limited to 'openmp')
-rw-r--r--openmp/tools/omptest/CMakeLists.txt58
1 files changed, 33 insertions, 25 deletions
diff --git a/openmp/tools/omptest/CMakeLists.txt b/openmp/tools/omptest/CMakeLists.txt
index 10c0cd98ccbc..e585eeb095a3 100644
--- a/openmp/tools/omptest/CMakeLists.txt
+++ b/openmp/tools/omptest/CMakeLists.txt
@@ -12,6 +12,8 @@ option(LIBOMPTEST_BUILD_STANDALONE
${OPENMP_STANDALONE_BUILD})
option(LIBOMPTEST_BUILD_UNITTESTS
"Build ompTest's unit tests, requires GoogleTest." OFF)
+option(LIBOMPTEST_INSTALL_COMPONENTS
+ "Install ompTest library, headers and package files." OFF)
# Exit early if OMPT support or LLVM-tests were disabled by the user.
if((NOT ${LIBOMP_OMPT_SUPPORT}) OR (NOT ${LLVM_INCLUDE_TESTS}))
@@ -112,36 +114,42 @@ target_include_directories(omptest PUBLIC
target_compile_features(omptest PRIVATE cxx_std_17)
-# Create and install package configuration files.
+# Perform package configuration.
+set(OMPTEST_CONFIG_INSTALL_DIR "${OPENMP_INSTALL_LIBDIR}/cmake/openmp/omptest")
configure_package_config_file(
${CMAKE_CURRENT_SOURCE_DIR}/cmake/omptest-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/cmake/omptest-config.cmake
- INSTALL_DESTINATION "${OPENMP_INSTALL_LIBDIR}/cmake/openmp/omptest"
+ INSTALL_DESTINATION "${OMPTEST_CONFIG_INSTALL_DIR}"
)
-install(FILES ${omptest_BINARY_DIR}/cmake/omptest-config.cmake
- DESTINATION "${OPENMP_INSTALL_LIBDIR}/cmake/openmp/omptest")
-
-# Install libomptest header files: Copy header-files from include dir
-install(DIRECTORY ./include/
- DESTINATION "${LIBOMP_HEADERS_INSTALL_PATH}/omptest"
- FILES_MATCHING PATTERN "*.h")
-
-# Install library and export targets.
-# Note: find_package(omptest) may require setting of PATH_SUFFIXES
-# Example: "lib/cmake/openmp/omptest", this is due to the install location
-install(TARGETS omptest
- EXPORT OPENMPomptest
- LIBRARY COMPONENT omptest
- DESTINATION "${OPENMP_INSTALL_LIBDIR}"
- INCLUDES DESTINATION "${LIBOMP_HEADERS_INSTALL_PATH}/omptest")
-
-# Allow to link omptest by using: target_link_libraries( ... omptest::omptest)
-# Additionally, it automatically propagates the include directory.
-install(EXPORT OPENMPomptest
- DESTINATION "${OPENMP_INSTALL_LIBDIR}/cmake/openmp/omptest"
- NAMESPACE omptest::
- FILE omptest-targets.cmake)
+# Perform installation only if requested by the user.
+if(LIBOMPTEST_INSTALL_COMPONENTS)
+ # Install package configuration files.
+ install(FILES ${omptest_BINARY_DIR}/cmake/omptest-config.cmake
+ DESTINATION "${OMPTEST_CONFIG_INSTALL_DIR}")
+
+ # Install libomptest header files: Copy header-files from include dir
+ set(OMPTEST_HEADER_INSTALL_DIR "${LIBOMP_HEADERS_INSTALL_PATH}/omptest")
+ install(DIRECTORY ./include/
+ DESTINATION "${OMPTEST_HEADER_INSTALL_DIR}"
+ FILES_MATCHING PATTERN "*.h")
+
+ # Install library and export targets.
+ # Note: find_package(omptest) may require setting of PATH_SUFFIXES
+ # Example: "lib/cmake/openmp/omptest", this is due to the install location
+ install(TARGETS omptest
+ EXPORT OPENMPomptest
+ LIBRARY COMPONENT omptest
+ DESTINATION "${OPENMP_INSTALL_LIBDIR}"
+ INCLUDES DESTINATION "${OMPTEST_HEADER_INSTALL_DIR}")
+
+ # Allow to link omptest by using: target_link_libraries( ... omptest::omptest)
+ # Additionally, it automatically propagates the include directory.
+ install(EXPORT OPENMPomptest
+ DESTINATION "${OMPTEST_CONFIG_INSTALL_DIR}"
+ NAMESPACE omptest::
+ FILE omptest-targets.cmake)
+endif()
# Discover unit tests (added to check-openmp)
if(LIBOMPTEST_BUILD_UNITTESTS)