fix: hide installation behind an option

Currently, every project pulling in SQLiteCpp automatically gets an
`make install` which installs SQLiteCpp into the system.
This is often not desired, since other projects only statically link.
The solution is to add another "SQLITECPP_install" option, which allows
to turn on/off this behavior.
This commit is contained in:
Simon Gene Gottlieb 2025-05-23 20:35:40 +02:00
parent 59a047b8d3
commit 47909c4afb

View File

@ -363,7 +363,8 @@ target_include_directories(SQLiteCpp
$<INSTALL_INTERFACE:include/>)
# Allow the library to be installed via "make install" and found with "find_package"
option(SQLITECPP_INSTALL "Enables the install target." ON)
if (SQLITECPP_INSTALL)
include(GNUInstallDirs)
install(TARGETS SQLiteCpp
EXPORT ${PROJECT_NAME}Targets
@ -387,6 +388,7 @@ install(FILES
${CMAKE_CURRENT_BINARY_DIR}/cmake/${PROJECT_NAME}Config.cmake
${CMAKE_CURRENT_BINARY_DIR}/cmake/${PROJECT_NAME}ConfigVersion.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
endif (SQLITECPP_INSTALL)
# Optional additional targets: