fix: hide installation behind an option (#512)

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:
Sébastien Rombauts 2025-05-27 09:50:11 +02:00 committed by GitHub
commit 1df768817e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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: