Skip to content

Commit

Permalink
Rework install paths
Browse files Browse the repository at this point in the history
The install paths can now be configured by setting the corresponding
SOCI_INSTALL_* variables.

Additionally, this commit fixes the header files being installed under
.../soci/soci/bla.h (two "soci" subdirs) and now install properly under
.../soci/bla.h
  • Loading branch information
Krzmbrzl committed Sep 1, 2024
1 parent f4e01a4 commit 152dd9d
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 40 deletions.
6 changes: 2 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Note: we need >= v3.23 in order to make use of file sets for header installation
cmake_minimum_required(VERSION 3.23 FATAL_ERROR)

set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
Expand Down Expand Up @@ -103,10 +104,7 @@ set(SOCI_DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}" CACHE STRING "Specifies suffix f


include(soci_compiler_options)

include(GNUInstallDirs)

set(SOCI_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/soci-${PROJECT_VERSION}")
include(soci_install_dirs)

add_subdirectory(src)

Expand Down
8 changes: 4 additions & 4 deletions src/backends/db2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ target_link_libraries(soci_interface INTERFACE SOCI::DB2)
install(
TARGETS soci_db2
EXPORT SOCIDB2Targets
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}/soci"
RUNTIME DESTINATION "${SOCI_INSTALL_BINDIR}"
COMPONENT soci_runtime
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/soci"
LIBRARY DESTINATION "${SOCI_INSTALL_LIBDIR}"
COMPONENT soci_runtime
NAMELINK_COMPONENT soci_development
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}/soci"
ARCHIVE DESTINATION "${SOCI_INSTALL_LIBDIR}"
COMPONENT soci_development
FILE_SET headers DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/soci"
FILE_SET headers DESTINATION "${SOCI_INSTALL_INCLUDEDIR}"
COMPONENT soci_development
)
# Generate and install a targets file
Expand Down
8 changes: 4 additions & 4 deletions src/backends/empty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ target_link_libraries(soci_interface INTERFACE SOCI::Empty)
install(
TARGETS soci_empty
EXPORT SOCIEmptyTargets
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}/soci"
RUNTIME DESTINATION "${SOCI_INSTALL_BINDIR}"
COMPONENT soci_runtime
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/soci"
LIBRARY DESTINATION "${SOCI_INSTALL_LIBDIR}"
COMPONENT soci_runtime
NAMELINK_COMPONENT soci_development
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}/soci"
ARCHIVE DESTINATION "${SOCI_INSTALL_LIBDIR}"
COMPONENT soci_development
FILE_SET headers DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/soci"
FILE_SET headers DESTINATION "${SOCI_INSTALL_INCLUDEDIR}"
COMPONENT soci_development
)
# Generate and install a targets file
Expand Down
8 changes: 4 additions & 4 deletions src/backends/firebird/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ target_link_libraries(soci_interface INTERFACE SOCI::Firebird)
install(
TARGETS soci_firebird
EXPORT SOCIFirebirdTargets
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}/soci"
RUNTIME DESTINATION "${SOCI_INSTALL_BINDIR}"
COMPONENT soci_runtime
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/soci"
LIBRARY DESTINATION "${SOCI_INSTALL_LIBDIR}"
COMPONENT soci_runtime
NAMELINK_COMPONENT soci_development
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}/soci"
ARCHIVE DESTINATION "${SOCI_INSTALL_LIBDIR}"
COMPONENT soci_development
FILE_SET headers DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/soci"
FILE_SET headers DESTINATION "${SOCI_INSTALL_INCLUDEDIR}"
COMPONENT soci_development
)
# Generate and install a targets file
Expand Down
8 changes: 4 additions & 4 deletions src/backends/mysql/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ target_link_libraries(soci_interface INTERFACE SOCI::MySQL)
install(
TARGETS soci_mysql
EXPORT SOCIMySQLTargets
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}/soci"
RUNTIME DESTINATION "${SOCI_INSTALL_BINDIR}"
COMPONENT soci_runtime
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/soci"
LIBRARY DESTINATION "${SOCI_INSTALL_LIBDIR}"
COMPONENT soci_runtime
NAMELINK_COMPONENT soci_development
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}/soci"
ARCHIVE DESTINATION "${SOCI_INSTALL_LIBDIR}"
COMPONENT soci_development
FILE_SET headers DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/soci"
FILE_SET headers DESTINATION "${SOCI_INSTALL_INCLUDEDIR}"
COMPONENT soci_development
)
# Generate and install a targets file
Expand Down
8 changes: 4 additions & 4 deletions src/backends/odbc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ target_link_libraries(soci_interface INTERFACE SOCI::ODBC)
install(
TARGETS soci_odbc
EXPORT SOCIODBCTargets
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}/soci"
RUNTIME DESTINATION "${SOCI_INSTALL_BINDIR}"
COMPONENT soci_runtime
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/soci"
LIBRARY DESTINATION "${SOCI_INSTALL_LIBDIR}"
COMPONENT soci_runtime
NAMELINK_COMPONENT soci_development
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}/soci"
ARCHIVE DESTINATION "${SOCI_INSTALL_LIBDIR}"
COMPONENT soci_development
FILE_SET headers DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/soci"
FILE_SET headers DESTINATION "${SOCI_INSTALL_INCLUDEDIR}"
COMPONENT soci_development
)
# Generate and install a targets file
Expand Down
8 changes: 4 additions & 4 deletions src/backends/oracle/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ target_link_libraries(soci_interface INTERFACE SOCI::Oracle)
install(
TARGETS soci_oracle
EXPORT SOCIOracleTargets
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}/soci"
RUNTIME DESTINATION "${SOCI_INSTALL_BINDIR}"
COMPONENT soci_runtime
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/soci"
LIBRARY DESTINATION "${SOCI_INSTALL_LIBDIR}"
COMPONENT soci_runtime
NAMELINK_COMPONENT soci_development
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}/soci"
ARCHIVE DESTINATION "${SOCI_INSTALL_LIBDIR}"
COMPONENT soci_development
FILE_SET headers DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/soci"
FILE_SET headers DESTINATION "${SOCI_INSTALL_INCLUDEDIR}"
COMPONENT soci_development
)
# Generate and install a targets file
Expand Down
8 changes: 4 additions & 4 deletions src/backends/postgresql/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ target_link_libraries(soci_interface INTERFACE SOCI::PostgreSQL)
install(
TARGETS soci_postgresql
EXPORT SOCIPostgreSQLTargets
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}/soci"
RUNTIME DESTINATION "${SOCI_INSTALL_BINDIR}"
COMPONENT soci_runtime
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/soci"
LIBRARY DESTINATION "${SOCI_INSTALL_LIBDIR}"
COMPONENT soci_runtime
NAMELINK_COMPONENT soci_development
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}/soci"
ARCHIVE DESTINATION "${SOCI_INSTALL_LIBDIR}"
COMPONENT soci_development
FILE_SET headers DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/soci"
FILE_SET headers DESTINATION "${SOCI_INSTALL_INCLUDEDIR}"
COMPONENT soci_development
)
# Generate and install a targets file
Expand Down
8 changes: 4 additions & 4 deletions src/backends/sqlite3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ target_link_libraries(soci_interface INTERFACE SOCI::SQLite3)
install(
TARGETS soci_sqlite3
EXPORT SOCISQLite3Targets
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}/soci"
RUNTIME DESTINATION "${SOCI_INSTALL_BINDIR}"
COMPONENT soci_runtime
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/soci"
LIBRARY DESTINATION "${SOCI_INSTALL_LIBDIR}"
COMPONENT soci_runtime
NAMELINK_COMPONENT soci_development
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}/soci"
ARCHIVE DESTINATION "${SOCI_INSTALL_LIBDIR}"
COMPONENT soci_development
FILE_SET headers DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/soci"
FILE_SET headers DESTINATION "${SOCI_INSTALL_INCLUDEDIR}"
COMPONENT soci_development
)
# Generate and install a targets file
Expand Down
8 changes: 4 additions & 4 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,14 @@ endif()
install(
TARGETS soci_core
EXPORT SOCICoreTargets
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}/soci"
RUNTIME DESTINATION "${SOCI_INSTALL_BINDIR}"
COMPONENT soci_runtime
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/soci"
LIBRARY DESTINATION "${SOCI_INSTALL_LIBDIR}"
COMPONENT soci_runtime
NAMELINK_COMPONENT soci_development
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}/soci"
ARCHIVE DESTINATION "${SOCI_INSTALL_LIBDIR}"
COMPONENT soci_development
FILE_SET headers DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/soci"
FILE_SET headers DESTINATION "${SOCI_INSTALL_INCLUDEDIR}"
COMPONENT soci_development
)
# Generate and install a targets file
Expand Down

0 comments on commit 152dd9d

Please sign in to comment.