diff options
author | Louis Dionne <ldionne@apple.com> | 2019-04-09 18:35:56 +0000 |
---|---|---|
committer | Louis Dionne <ldionne@apple.com> | 2019-04-09 18:35:56 +0000 |
commit | f7433f9623533d7901fa1f0eb3bf0aaebbbbd73d (patch) | |
tree | eed63bb2db0d3933a8326b8de13821df291fb522 /pstl/CMakeLists.txt | |
parent | 61e77b11d1bf0fa02cfce416c56e6a598619d8db (diff) | |
download | llvm-f7433f9623533d7901fa1f0eb3bf0aaebbbbd73d.zip llvm-f7433f9623533d7901fa1f0eb3bf0aaebbbbd73d.tar.gz llvm-f7433f9623533d7901fa1f0eb3bf0aaebbbbd73d.tar.bz2 |
[pstl][CMake] Install CMake export files
This allows other projects to depend on PSTL using the classic CMake
find_package protocol.
llvm-svn: 358028
Diffstat (limited to 'pstl/CMakeLists.txt')
-rw-r--r-- | pstl/CMakeLists.txt | 42 |
1 files changed, 30 insertions, 12 deletions
diff --git a/pstl/CMakeLists.txt b/pstl/CMakeLists.txt index b6733bc..f4b14f7 100644 --- a/pstl/CMakeLists.txt +++ b/pstl/CMakeLists.txt @@ -27,6 +27,9 @@ if (NOT TBB_DIR) endif() endif() +############################################################################### +# Setup the ParallelSTL library target +############################################################################### add_library(ParallelSTL INTERFACE) add_library(pstl::ParallelSTL ALIAS ParallelSTL) target_compile_features(ParallelSTL INTERFACE cxx_std_17) @@ -55,19 +58,34 @@ target_include_directories(ParallelSTL $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>) +############################################################################### +# Setup tests +############################################################################### +enable_testing() +add_subdirectory(test) + +############################################################################### +# Install the target and the associated CMake files +############################################################################### include(CMakePackageConfigHelpers) -write_basic_package_version_file( - ${CMAKE_CURRENT_BINARY_DIR}/ParallelSTLConfigVersion.cmake - VERSION ${PROJECT_VERSION} - COMPATIBILITY AnyNewerVersion) +write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/ParallelSTLConfigVersion.cmake" + COMPATIBILITY ExactVersion) -configure_file( - cmake/ParallelSTLConfig.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/ParallelSTLConfig.cmake - @ONLY) +configure_file(cmake/ParallelSTLConfig.cmake.in + "${CMAKE_CURRENT_BINARY_DIR}/ParallelSTLConfig.cmake" + @ONLY) -export(TARGETS ParallelSTL NAMESPACE pstl:: FILE ParallelSTLTargets.cmake) -export(PACKAGE ParallelSTL) +install(TARGETS ParallelSTL + EXPORT ParallelSTLTargets) +install(EXPORT ParallelSTLTargets + FILE ParallelSTLTargets.cmake + NAMESPACE pstl:: + DESTINATION lib/cmake/ParallelSTL) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ParallelSTLConfig.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/ParallelSTLConfigVersion.cmake" + DESTINATION lib/cmake/ParallelSTL) +install(DIRECTORY include/pstl + DESTINATION include) -enable_testing() -add_subdirectory(test) +add_custom_target(install-pstl + COMMAND "${CMAKE_COMMAND}" -P "${PROJECT_BINARY_DIR}/cmake_install.cmake" -DCOMPONENT=ParallelSTL) |