Skip to content

Commit

Permalink
Add CMake install target
Browse files Browse the repository at this point in the history
  • Loading branch information
SpriteOvO committed Sep 11, 2023
1 parent 15d5221 commit 42ced28
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
23 changes: 22 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ if (SIGMATCH_DEV_MODE)
endif()
endif()

project(sigmatch LANGUAGES CXX VERSION 0.1.0)
project(sigmatch LANGUAGES CXX VERSION 0.2.0)

add_library(sigmatch INTERFACE)
add_library(sigmatch::sigmatch ALIAS sigmatch)
Expand Down Expand Up @@ -85,3 +85,24 @@ endif()
if (SIGMATCH_BUILD_BENCHMARKS)
# TODO
endif()

# Install
set(SIGMATCH_INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include")
set(SIGMATCH_INSTALL_CMAKE_DIR "${CMAKE_INSTALL_PREFIX}/lib/cmake/sigmatch")

include(CMakePackageConfigHelpers)

write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/sigmatch-config-version.cmake
VERSION ${sigmatch_VERSION}
COMPATIBILITY ExactVersion
)

install(DIRECTORY include/ DESTINATION ${SIGMATCH_INSTALL_INCLUDE_DIR})

install(TARGETS sigmatch EXPORT sigmatch-targets)
install(EXPORT sigmatch-targets NAMESPACE sigmatch:: DESTINATION "${SIGMATCH_INSTALL_CMAKE_DIR}")
install(
FILES cmake/sigmatch-config.cmake ${CMAKE_CURRENT_BINARY_DIR}/sigmatch-config-version.cmake
DESTINATION "${SIGMATCH_INSTALL_CMAKE_DIR}"
)
1 change: 1 addition & 0 deletions cmake/sigmatch-config.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include("${CMAKE_CURRENT_LIST_DIR}/sigmatch-targets.cmake")

0 comments on commit 42ced28

Please sign in to comment.