Search for soci before vendoring

This commit is contained in:
Mo Morsi
2019-10-30 12:55:04 -04:00
committed by Nik Bougalis
parent 9bd470f2c7
commit 6cda070fe0
2 changed files with 152 additions and 111 deletions

View File

@@ -0,0 +1,16 @@
find_package (PkgConfig REQUIRED)
# no soci pkgconfig
#pkg_search_module (soci_PC QUIET libsoci_core>=3.2)
if(static)
set(SOCI_LIB libsoci.a)
else()
set(SOCI_LIB libsoci_core.so)
endif()
find_library (soci
NAMES ${SOCI_LIB})
find_path (SOCI_INCLUDE_DIR
NAMES soci/soci.h)

View File

@@ -2,6 +2,26 @@
NIH dep: soci NIH dep: soci
#]===================================================================] #]===================================================================]
foreach (_comp core empty sqlite3)
add_library ("soci_${_comp}" STATIC IMPORTED GLOBAL)
endforeach ()
if (NOT WIN32)
find_package(soci)
endif()
if (soci)
foreach (_comp core empty sqlite3)
set_target_properties ("soci_${_comp}" PROPERTIES
IMPORTED_LOCATION_DEBUG
${soci}
IMPORTED_LOCATION_RELEASE
${soci}
INTERFACE_INCLUDE_DIRECTORIES
${SOCI_INCLUDE_DIR})
endforeach ()
else()
set (soci_lib_pre ${ep_lib_prefix}) set (soci_lib_pre ${ep_lib_prefix})
set (soci_lib_post "") set (soci_lib_post "")
if (WIN32) if (WIN32)
@@ -103,7 +123,6 @@ endif ()
file (MAKE_DIRECTORY ${SOURCE_DIR}/include) file (MAKE_DIRECTORY ${SOURCE_DIR}/include)
file (MAKE_DIRECTORY ${BINARY_DIR}/include) file (MAKE_DIRECTORY ${BINARY_DIR}/include)
foreach (_comp core empty sqlite3) foreach (_comp core empty sqlite3)
add_library ("soci_${_comp}" STATIC IMPORTED GLOBAL)
set_target_properties ("soci_${_comp}" PROPERTIES set_target_properties ("soci_${_comp}" PROPERTIES
IMPORTED_LOCATION_DEBUG IMPORTED_LOCATION_DEBUG
${BINARY_DIR}/lib/${soci_lib_pre}soci_${_comp}${soci_lib_post}_d${ep_lib_suffix} ${BINARY_DIR}/lib/${soci_lib_pre}soci_${_comp}${soci_lib_post}_d${ep_lib_suffix}
@@ -116,6 +135,12 @@ foreach (_comp core empty sqlite3)
if (NOT _comp STREQUAL "core") if (NOT _comp STREQUAL "core")
target_link_libraries ("soci_${_comp}" INTERFACE soci_core) target_link_libraries ("soci_${_comp}" INTERFACE soci_core)
endif () endif ()
endforeach ()
endif()
foreach (_comp core empty sqlite3)
exclude_if_included ("soci_${_comp}") exclude_if_included ("soci_${_comp}")
endforeach () endforeach ()
exclude_if_included (soci) exclude_if_included (soci)