From 2448ea79650842725f041978e1a8f9e06f6b580d Mon Sep 17 00:00:00 2001 From: FritzFlorian Date: Tue, 2 Apr 2019 14:56:56 +0200 Subject: [PATCH] Add support to install PLS as a cmake dependency in 3rd party projects. --- lib/pls/CMakeLists.txt | 22 +++++++++++++++++----- lib/pls/pls-config.cmake | 2 ++ 2 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 lib/pls/pls-config.cmake diff --git a/lib/pls/CMakeLists.txt b/lib/pls/CMakeLists.txt index 83d7e1a..078f698 100644 --- a/lib/pls/CMakeLists.txt +++ b/lib/pls/CMakeLists.txt @@ -32,18 +32,30 @@ target_link_libraries(pls # Rules for istalling the library on a system # ...binaries -install(TARGETS pls +INSTALL(TARGETS pls + EXPORT pls-targets LIBRARY - DESTINATION lib + DESTINATION lib/pls ARCHIVE - DESTINATION lib + DESTINATION lib/pls ) # ...all headers in `include` -INSTALL ( - DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ +INSTALL( + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/pls DESTINATION include FILES_MATCHING PATTERN "*.h*" ) +# ...allow our project to be a cmake dependency +install( + EXPORT pls-targets + FILE plsTargets.cmake + NAMESPACE pls:: + DESTINATION lib/pls +) +INSTALl( + FILES pls-config.cmake + DESTINATION lib/pls +) # Enable warnings/tidy code checking from our compiler target_compile_options(pls PRIVATE diff --git a/lib/pls/pls-config.cmake b/lib/pls/pls-config.cmake new file mode 100644 index 0000000..25d3a1f --- /dev/null +++ b/lib/pls/pls-config.cmake @@ -0,0 +1,2 @@ +get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) +include(${SELF_DIR}/plsTargets.cmake) -- libgit2 0.26.0