From 4e55ea945a16d1f31c5f63c2ad74d224d4e22876 Mon Sep 17 00:00:00 2001 From: Myroendan Date: Thu, 16 Nov 2023 20:17:57 +0100 Subject: [PATCH] Add support for CMake install - Fixed issue #109: CMakeLists.txt - add support for INSTALL command --- CMakeLists.txt | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d5541a1..f1b8ca3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -209,6 +209,14 @@ endif() # Only generate Debug and Release configuration types. set(CMAKE_CONFIGURATION_TYPES Debug Release) +set(SQLITE3MC_PUBLIC_HEADERS + src/sqlite3.h + src/sqlite3ext.h + src/sqlite3mc.h + src/sqlite3mc_vfs.h + src/sqlite3userauth.h +) + set(SQLITE3MC_BASE_SRCS src/sqlite3mc.c src/cipher_common.h @@ -218,12 +226,8 @@ set(SQLITE3MC_BASE_SRCS src/rijndael.h src/sha1.h src/sha2.h - src/sqlite3.h - src/sqlite3ext.h - src/sqlite3mc.h - src/sqlite3mc_vfs.h - src/sqlite3userauth.h src/test_windirent.h + ${SQLITE3MC_PUBLIC_HEADERS} ) set(SQLITE3MC_DLLRES_SRCS src/sqlite3mc.rc @@ -348,6 +352,14 @@ if(SQLITE3MC_STATIC_RUNTIME_LINK) endif() message("Will build ${SQLITE3MC_TARGET} as ${SQLITE3MC_LINK}") +set_target_properties(${SQLITE3MC_TARGET} PROPERTIES PUBLIC_HEADER "${SQLITE3MC_PUBLIC_HEADERS}") +INSTALL(TARGETS ${SQLITE3MC_TARGET} + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + PUBLIC_HEADER DESTINATION include/${CMAKE_PROJECT_NAME} + RUNTIME DESTINATION bin +) + # Shell Executable project if(SQLITE3MC_BUILD_SHELL) add_executable(${SQLITE3MC_SHELL_TARGET} @@ -392,4 +404,11 @@ if(SQLITE3MC_BUILD_SHELL) _Enable_MT(${SQLIT3MC_SHELL_TARGET}) endif() message("Will build ${SQLITE3MC_SHELL_TARGET}") + + INSTALL(TARGETS ${SQLITE3MC_SHELL_TARGET} + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + PUBLIC_HEADER DESTINATION include/${CMAKE_PROJECT_NAME} + RUNTIME DESTINATION bin + ) endif()