mirror of
https://github.com/allankoechke/soci.git
synced 2026-11-29 09:33:26 +00:00
Rename target SOCI::soci to SOCI::SOCI
We still keep a SOCI::soci target around, which we explicitly mark as deprecated. This way, code that is already using it will remain functional but they will be informed that they are supposed to use SOCI::SOCI instead. Closes #1297.
This commit is contained in:
committed by
Vadim Zeitlin
parent
9982e0c37f
commit
f2414e7509
@@ -250,9 +250,9 @@ In the example above, regression tests for the sample Empty backend and SQLite 3
|
||||
|
||||
CMake build produces set separate libraries for SOCI's core and all enabled backends.
|
||||
|
||||
If your project also uses CMake, you can simply use `find_package(SOCI)` to check for SOCI availability and `target_link_libraries()` to link with the `SOCI::soci` target. An example of a very simple CMake-based project using SOCI is provided in the `examples/connect` directory.
|
||||
If your project also uses CMake, you can simply use `find_package(SOCI)` to check for SOCI availability and `target_link_libraries()` to link with the `SOCI::SOCI` target. An example of a very simple CMake-based project using SOCI is provided in the `examples/connect` directory.
|
||||
|
||||
Alternatively, you can add SOCI as a subdirectory to your project and include it via `add_subdirectory()`. As before, `target_link_libraries()` is used to link with the `SOCI::soci` target. An example of this can be found in the directory `examples/subdir-include`.
|
||||
Alternatively, you can add SOCI as a subdirectory to your project and include it via `add_subdirectory()`. As before, `target_link_libraries()` is used to link with the `SOCI::SOCI` target. An example of this can be found in the directory `examples/subdir-include`.
|
||||
|
||||
If you don't use CMake but want to use SOCI in your program, you need to specify the paths to the SOCI headers and libraries in your build configuration and to
|
||||
tell the linker to link against the libraries you want to use in your program.
|
||||
|
||||
@@ -29,6 +29,6 @@ find_package(SOCI 4.1 COMPONENTS Empty REQUIRED)
|
||||
|
||||
add_executable(connect connect.cpp)
|
||||
|
||||
# Note that linking to SOCI::soci is enough to inherit
|
||||
# Note that linking to SOCI::SOCI is enough to inherit
|
||||
# all of SOCI's dependencies, include directories, etc.
|
||||
target_link_libraries(connect PRIVATE SOCI::soci)
|
||||
target_link_libraries(connect PRIVATE SOCI::SOCI)
|
||||
|
||||
@@ -40,8 +40,8 @@ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../.. ${SOCI_BINARY_DIR})
|
||||
|
||||
add_executable(subdir_include subdir-include.cpp)
|
||||
|
||||
# Link to SOCI (SOCI::soci will resolve all requested dependencies automatically)
|
||||
# Link to SOCI (SOCI::SOCI will resolve all requested dependencies automatically)
|
||||
target_link_libraries(subdir_include
|
||||
PRIVATE
|
||||
SOCI::soci
|
||||
SOCI::SOCI
|
||||
)
|
||||
|
||||
@@ -157,12 +157,18 @@ unset(__dep_dep_targets)
|
||||
check_required_components(SOCI)
|
||||
|
||||
if (NOT DEFINED SOCI_FOUND OR SOCI_FOUND)
|
||||
add_library(SOCI::soci INTERFACE IMPORTED)
|
||||
add_library(SOCI::SOCI INTERFACE IMPORTED)
|
||||
|
||||
foreach (__comp IN LISTS SOCI_FIND_COMPONENTS)
|
||||
target_link_libraries(SOCI::soci INTERFACE SOCI::${__comp})
|
||||
target_link_libraries(SOCI::SOCI INTERFACE SOCI::${__comp})
|
||||
endforeach()
|
||||
|
||||
# Shall be removed in SOCI v5
|
||||
add_library(soci_interface_deprecated INTERFACE)
|
||||
target_link_libraries(soci_interface_deprecated INTERFACE SOCI::SOCI)
|
||||
set_target_properties(soci_interface_deprecated PROPERTIES DEPRECATION "Use SOCI::SOCI (all-uppercase) instead of SOCI::soci")
|
||||
add_library(SOCI::soci ALIAS soci_interface_deprecated)
|
||||
|
||||
if (NOT SOCI_FIND_QUIETLY)
|
||||
list(JOIN SOCI_FIND_COMPONENTS ", " __components)
|
||||
message(STATUS "Found SOCI: ${CMAKE_CURRENT_LIST_FILE} (found version \"@PROJECT_VERSION@\") found components: ${__components}")
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
add_library(soci_interface INTERFACE)
|
||||
add_library(SOCI::soci ALIAS soci_interface)
|
||||
add_library(SOCI::SOCI ALIAS soci_interface)
|
||||
|
||||
if (SOCI_VERSION VERSION_LESS 5)
|
||||
add_library(soci_interface_deprecated INTERFACE)
|
||||
target_link_libraries(soci_interface_deprecated INTERFACE soci_interface)
|
||||
set_target_properties(soci_interface_deprecated PROPERTIES DEPRECATION "Use SOCI::SOCI (all-uppercase) instead of SOCI::soci")
|
||||
add_library(SOCI::soci ALIAS soci_interface_deprecated)
|
||||
endif()
|
||||
|
||||
set(SOCI_GENERATED_INCLUDES_DIR "${CMAKE_BINARY_DIR}/include")
|
||||
file(MAKE_DIRECTORY "${SOCI_GENERATED_INCLUDES_DIR}/soci")
|
||||
|
||||
Reference in New Issue
Block a user