forked from microsoft/vcpkg
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[soci] Fix dependencies in, intern, out (microsoft#34327)
- Loading branch information
Showing
14 changed files
with
229 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
diff --git a/cmake/dependencies/Boost.cmake b/cmake/dependencies/Boost.cmake | ||
index 366d32b..7ff041b 100644 | ||
--- a/cmake/dependencies/Boost.cmake | ||
+++ b/cmake/dependencies/Boost.cmake | ||
@@ -10,4 +10,6 @@ endif() | ||
set(Boost_RELEASE_VERSION | ||
"${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") | ||
|
||
+set(BOOST_FOUND "${Boost_FOUND}") | ||
+set(BOOST_LIBRARIES "${Boost_LIBRARIES}") | ||
boost_external_report(Boost RELEASE_VERSION INCLUDE_DIR LIBRARIES) | ||
diff --git a/cmake/dependencies/MySQL.cmake b/cmake/dependencies/MySQL.cmake | ||
index 5599b08..0a4ce0f 100644 | ||
--- a/cmake/dependencies/MySQL.cmake | ||
+++ b/cmake/dependencies/MySQL.cmake | ||
@@ -1,5 +1,9 @@ | ||
set(MySQL_FIND_QUIETLY TRUE) | ||
|
||
-find_package(MySQL) | ||
+find_package(MYSQL NAMES unofficial-libmysql REQUIRED) | ||
+set(MYSQL_LIBRARIES "$<TARGET_NAME:libmysql>") | ||
+if(TARGET mysqlclient AND NOT TARGET libmysql) | ||
+ set(MYSQL_LIBRARIES "$<TARGET_NAME:mysqlclient>") | ||
+endif() | ||
|
||
boost_external_report(MySQL INCLUDE_DIR LIBRARIES) | ||
diff --git a/cmake/dependencies/PostgreSQL.cmake b/cmake/dependencies/PostgreSQL.cmake | ||
index c6f2154..ef6bfcd 100644 | ||
--- a/cmake/dependencies/PostgreSQL.cmake | ||
+++ b/cmake/dependencies/PostgreSQL.cmake | ||
@@ -1,5 +1,8 @@ | ||
set(PostgreSQL_FIND_QUIETLY TRUE) | ||
|
||
-find_package(PostgreSQL) | ||
+find_package(PostgreSQL REQUIRED) | ||
+set(POSTGRESQL_FOUND TRUE) | ||
+set(POSTGRESQL_INCLUDE_DIRS "${PostgreSQL_INCLUDE_DIRS}") | ||
+set(POSTGRESQL_LIBRARIES "${PostgreSQL_LIBRARIES}") | ||
|
||
boost_external_report(PostgreSQL INCLUDE_DIRS LIBRARIES VERSION) | ||
diff --git a/cmake/dependencies/SQLite3.cmake b/cmake/dependencies/SQLite3.cmake | ||
index 0daa9a5..17775da 100644 | ||
--- a/cmake/dependencies/SQLite3.cmake | ||
+++ b/cmake/dependencies/SQLite3.cmake | ||
@@ -1,5 +1,6 @@ | ||
set(SQLITE3_FIND_QUIETLY TRUE) | ||
|
||
-find_package(SQLite3) | ||
+find_package(SQLITE3 NAMES unofficial-sqlite3 CONFIG REQUIRED) | ||
+set(SQLITE3_LIBRARIES unofficial::sqlite3::sqlite3) | ||
|
||
boost_external_report(SQLite3 INCLUDE_DIR LIBRARIES) | ||
diff --git a/cmake/resources/SOCIConfig.cmake.in b/cmake/resources/SOCIConfig.cmake.in | ||
index 8096a3c..354c18b 100644 | ||
--- a/cmake/resources/SOCIConfig.cmake.in | ||
+++ b/cmake/resources/SOCIConfig.cmake.in | ||
@@ -1,3 +1,11 @@ | ||
@PACKAGE_INIT@ | ||
|
||
+include(CMakeFindDependencyMacro) | ||
+if("@WITH_MYSQL@") | ||
+ find_dependency(unofficial-libmysql) | ||
+endif() | ||
+if("@WITH_SQLITE3@") | ||
+ find_dependency(unofficial-sqlite3) | ||
+endif() | ||
+ | ||
include(${CMAKE_CURRENT_LIST_DIR}/SOCITargets.cmake) | ||
diff --git a/include/soci/mysql/soci-mysql.h b/include/soci/mysql/soci-mysql.h | ||
index 376bb7e..fbe48fa 100644 | ||
--- a/include/soci/mysql/soci-mysql.h | ||
+++ b/include/soci/mysql/soci-mysql.h | ||
@@ -21,8 +21,8 @@ | ||
#ifdef _WIN32 | ||
#include <winsock.h> // SOCKET | ||
#endif // _WIN32 | ||
-#include <mysql.h> // MySQL Client | ||
-#include <errmsg.h> // MySQL Error codes | ||
+#include <mysql/mysql.h> // MySQL Client | ||
+#include <mysql/errmsg.h> // MySQL Error codes | ||
#include <vector> | ||
|
||
|
||
diff --git a/src/backends/CMakeLists.txt b/src/backends/CMakeLists.txt | ||
index 871e151..3cffc80 100644 | ||
--- a/src/backends/CMakeLists.txt | ||
+++ b/src/backends/CMakeLists.txt | ||
@@ -14,9 +14,9 @@ colormsg(_HIBLUE_ "Configuring SOCI backend libraries:") | ||
foreach(dep ${SOCI_BACKENDS_DB_DEPENDENCIES}) | ||
string(TOUPPER ${dep} depUP) | ||
if (WITH_${depUP}) | ||
- find_package(${dep}) | ||
- endif() | ||
- if(${dep}_FOUND OR ${depUP}_FOUND) | ||
+ if(NOT (${dep}_FOUND OR ${depUP}_FOUND)) | ||
+ message(FATAL_ERROR "${depUP} not found, check SociDependencies.cmake") | ||
+ endif() | ||
set(${depUP}_FOUND ON) | ||
else() | ||
set(${depUP}_FOUND OFF) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
soci provides CMake targets: | ||
|
||
find_package(soci CONFIG REQUIRED) | ||
target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:SOCI::soci_core>,SOCI::soci_core,SOCI::soci_core_static>) | ||
|
||
# Linking specific backends (enabled: @backends@) | ||
target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:SOCI::soci_<BACKEND>,SOCI::soci_<BACKEND>,SOCI::soci_<BACKEND>_static>) |
13 changes: 5 additions & 8 deletions
13
ports/soci/export-include-dirs.patch → ports/soci/usage-requirements.diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,33 @@ | ||
diff --git a/cmake/SociBackend.cmake b/cmake/SociBackend.cmake | ||
index 5d4ef0d..bb0edf2 100644 | ||
index 5d4ef0d..279cb75 100644 | ||
--- a/cmake/SociBackend.cmake | ||
+++ b/cmake/SociBackend.cmake | ||
@@ -159,8 +159,14 @@ macro(soci_backend NAME) | ||
@@ -159,8 +159,13 @@ macro(soci_backend NAME) | ||
${THIS_BACKEND_HEADERS}) | ||
|
||
target_link_libraries(${THIS_BACKEND_TARGET} | ||
+ PUBLIC | ||
${SOCI_CORE_TARGET} | ||
${THIS_BACKEND_DEPENDS_LIBRARIES}) | ||
+ | ||
+ target_include_directories(${THIS_BACKEND_TARGET} | ||
+ PUBLIC | ||
+ ${THIS_BACKEND_DEPENDS_INCLUDE_DIRS} | ||
+ ) | ||
|
||
if(WIN32) | ||
set_target_properties(${THIS_BACKEND_TARGET} | ||
@@ -197,9 +203,15 @@ macro(soci_backend NAME) | ||
@@ -197,8 +202,14 @@ macro(soci_backend NAME) | ||
|
||
# Still need to link the libraries for tests to work | ||
target_link_libraries (${THIS_BACKEND_TARGET_STATIC} | ||
+ PUBLIC | ||
+ ${SOCI_CORE_TARGET}_static | ||
${THIS_BACKEND_DEPENDS_LIBRARIES} | ||
) | ||
- | ||
+ | ||
+ target_include_directories(${THIS_BACKEND_TARGET_STATIC} | ||
+ PUBLIC | ||
+ ${THIS_BACKEND_DEPENDS_INCLUDE_DIRS} | ||
+ ) | ||
+ | ||
|
||
set_target_properties(${THIS_BACKEND_TARGET_STATIC} | ||
PROPERTIES | ||
OUTPUT_NAME ${THIS_BACKEND_OUTPUT_NAME} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
set(VCPKG_POLICY_EMPTY_PACKAGE enabled) | ||
|
||
vcpkg_cmake_configure(SOURCE_PATH "${CURRENT_PORT_DIR}/project") | ||
vcpkg_cmake_build() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
cmake_minimum_required(VERSION 3.7) | ||
project(soci-test CXX) | ||
|
||
if(APPLE) | ||
set(CMAKE_CXX_STANDARD 11) | ||
endif() | ||
|
||
add_executable(main main.cpp) | ||
|
||
find_package(SOCI CONFIG REQUIRED) | ||
target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:SOCI::soci_mysql>,SOCI::soci_mysql,SOCI::soci_mysql_static>) | ||
target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:SOCI::soci_postgresql>,SOCI::soci_postgresql,SOCI::soci_postgresql_static>) | ||
target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:SOCI::soci_sqlite3>,SOCI::soci_sqlite3,SOCI::soci_sqlite3_static>) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include <soci/soci.h> | ||
#include <soci/mysql/soci-mysql.h> | ||
#include <soci/postgresql/soci-postgresql.h> | ||
#include <soci/sqlite3/soci-sqlite3.h> | ||
|
||
int main() | ||
{ | ||
soci::session mysql_db(soci::mysql, "test:mysql"); | ||
soci::session pgsql_db(soci::postgresql, "test:postgresql"); | ||
soci::session sqlite3_db(soci::sqlite3, "test.db"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "vcpkg-ci-soci", | ||
"version-string": "ci", | ||
"description": "Validates soci", | ||
"supports": "x64 & (linux | osx | windows) & !uwp", | ||
"dependencies": [ | ||
{ | ||
"name": "soci", | ||
"features": [ | ||
"mysql", | ||
"postgresql", | ||
"sqlite3" | ||
] | ||
}, | ||
{ | ||
"name": "vcpkg-cmake", | ||
"host": true | ||
} | ||
] | ||
} |
Oops, something went wrong.