]>
Commit | Line | Data |
---|---|---|
1e59de90 TL |
1 | diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt |
2 | index 3d0744740..293f187c5 100644 | |
3 | --- a/projects/CMake/CMakeLists.txt | |
4 | +++ b/projects/CMake/CMakeLists.txt | |
5 | @@ -146,3 +146,27 @@ set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY TRUE CACHE BOOL "Don't require all project | |
6 | ||
7 | install(DIRECTORY ${RXCPP_DIR}/Rx/v2/src/rxcpp/ DESTINATION include/rxcpp | |
8 | FILES_MATCHING PATTERN "*.hpp") | |
9 | + | |
10 | +# Here we are exporting TARGETS so that other projects can import rxcpp | |
11 | +# just with find_package(rxcpp CONFIG) after rxcpp is installed into system by "make install". | |
12 | +add_library(rxcpp INTERFACE) | |
13 | + | |
14 | +target_include_directories(rxcpp INTERFACE | |
15 | + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | |
16 | + $<INSTALL_INTERFACE:include/rxcpp> | |
17 | +) | |
18 | + | |
19 | +install(TARGETS rxcpp EXPORT rxcppConfig) | |
20 | +install(EXPORT rxcppConfig DESTINATION share/rxcpp/cmake) | |
21 | + | |
22 | +# When find_package(rxcpp SOME_VERSION REQUIRED) will be used in third party project | |
23 | +# where SOME_VERSION is any version incompatible with ${PROJECT_VERSION} then cmake will generate the error. | |
24 | +# It means you don't need track versions manually. | |
25 | +include(CMakePackageConfigHelpers) | |
26 | +write_basic_package_version_file("${PROJECT_BINARY_DIR}/rxcppConfigVersion.cmake" | |
27 | + VERSION | |
28 | + ${PROJECT_VERSION} | |
29 | + COMPATIBILITY | |
30 | + AnyNewerVersion | |
31 | +) | |
32 | +install(FILES "${PROJECT_BINARY_DIR}/rxcppConfigVersion.cmake" DESTINATION share/rxcpp/cmake) |