summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleg Morozenkov <m@oleg.rocks>2024-06-11 00:43:39 +0300
committerGitHub <noreply@github.com>2024-06-11 00:43:39 +0300
commita38e1b2752030254f400c0fb1e95f7340f2060c4 (patch)
tree22fa3eb3ce24eb72171c51d099e187e8434ff223
parent986a7b5242182614c25404bfef75fb09a762a8c1 (diff)
parente784a317a793aa7702e9abcf87921ccfd9cb875f (diff)
Merge pull request #293 from 7FM/find_package_support
CMake: add find_package support
-rw-r--r--CMakeLists.txt9
1 files changed, 8 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8008ac4..627af9c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -98,14 +98,21 @@ endif()
# building project
add_library(${PROJECT_NAME} ${SRC_LIST})
-target_include_directories(${PROJECT_NAME} PUBLIC include)
+target_include_directories(${PROJECT_NAME} PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+ $<INSTALL_INTERFACE:include>)
target_link_libraries(${PROJECT_NAME} ${LIB_LIST})
include(GNUInstallDirs)
install(TARGETS ${PROJECT_NAME}
+ EXPORT ${PROJECT_NAME}-targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+install(EXPORT ${PROJECT_NAME}-targets
+ NAMESPACE ${PROJECT_NAME}::
+ FILE ${PROJECT_NAME}Config.cmake
+ DESTINATION lib/cmake/${PROJECT_NAME})
set_property(TARGET ${PROJECT_NAME} PROPERTY POSITION_INDEPENDENT_CODE ON)
# ABI version