@@ -26,6 +26,30 @@ project(SQLiteModernCpp LANGUAGES CXX)
2626hunter_add_package(sqlite3)
2727find_package (sqlite3 CONFIG REQUIRED)
2828
29+ add_library (SQLiteModernCpp INTERFACE )
30+
31+ target_include_directories (SQLiteModernCpp INTERFACE
32+ $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR} /hdr>
33+ )
34+
35+ include (GNUInstallDirs)
36+
37+ install (
38+ TARGETS SQLiteModernCpp
39+ EXPORT SQLiteModernCpp
40+ )
41+
42+ install (
43+ EXPORT SQLiteModernCpp
44+ DESTINATION "${CMAKE_INSTALL_LIBDIR} /cmake/SQLiteModernCpp"
45+ FILE SQLiteModernCppConfig.cmake
46+ NAMESPACE SQLiteModernCpp::
47+ )
48+
49+ install (
50+ DIRECTORY ${CMAKE_CURRENT_LIST_DIR} /hdr/
51+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
52+ )
2953
3054if (BUILD_TESTING)
3155 hunter_add_package(Catch)
@@ -34,22 +58,22 @@ if(BUILD_TESTING)
3458 set (TEST_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} /tests)
3559 file (GLOB TEST_SOURCES ${TEST_SOURCE_DIR} /*.cc)
3660
37- IF (NOT ENABLE_SQLCIPHER_TESTS)
38- list (REMOVE_ITEM TEST_SOURCES ${TEST_SOURCE_DIR} /sqlcipher.cc)
39- ENDIF (NOT ENABLE_SQLCIPHER_TESTS)
61+ IF (NOT ENABLE_SQLCIPHER_TESTS)
62+ list (REMOVE_ITEM TEST_SOURCES ${TEST_SOURCE_DIR} /sqlcipher.cc)
63+ ENDIF (NOT ENABLE_SQLCIPHER_TESTS)
4064
41- enable_testing ()
65+ enable_testing ()
4266
43- add_executable (tests_runner ${TEST_SOURCES} )
44- target_include_directories (tests_runner INTERFACE ${SQLITE3_INCLUDE_DIRS} )
67+ add_executable (tests_runner ${TEST_SOURCES} )
68+ target_include_directories (tests_runner INTERFACE ${SQLITE3_INCLUDE_DIRS} )
4569
46- if (ENABLE_SQLCIPHER_TESTS)
47- target_link_libraries (tests_runner Catch2::Catch2 sqlite_modern_cpp sqlite3::sqlite3 -lsqlcipher)
48- else ()
49- target_link_libraries (tests_runner Catch2::Catch2 sqlite_modern_cpp sqlite3::sqlite3)
50- endif ()
70+ if (ENABLE_SQLCIPHER_TESTS)
71+ target_link_libraries (tests_runner Catch2::Catch2 sqlite_modern_cpp sqlite3::sqlite3 -lsqlcipher)
72+ else ()
73+ target_link_libraries (tests_runner Catch2::Catch2 sqlite_modern_cpp sqlite3::sqlite3)
74+ endif ()
5175
52- catch_discover_tests(tests_runner)
76+ catch_discover_tests(tests_runner)
5377
5478 target_compile_options (tests_runner PUBLIC $<$<CXX_COMPILER_ID:MSVC >:/Zc:__cplusplus>)
5579endif ()
@@ -58,7 +82,7 @@ endif()
5882# YCM is the code-completion engine for (neo)vim https://github.com/Valloric/YouCompleteMe
5983IF (EXISTS "${CMAKE_BINARY_DIR} /compile_commands.json" )
6084 EXECUTE_PROCESS (COMMAND ${CMAKE_COMMAND} -E copy_if_different
61- ${CMAKE_BINARY_DIR} /compile_commands.json
62- ${CMAKE_SOURCE_DIR} /compile_commands.json
63- )
85+ ${CMAKE_BINARY_DIR} /compile_commands.json
86+ ${CMAKE_SOURCE_DIR} /compile_commands.json
87+ )
6488ENDIF ()
0 commit comments