2019-04-24 09:06:28 +00:00
|
|
|
add_library (mysqlxx
|
2020-03-12 22:26:16 +00:00
|
|
|
Connection.cpp
|
|
|
|
Exception.cpp
|
|
|
|
Query.cpp
|
|
|
|
ResultBase.cpp
|
|
|
|
UseQueryResult.cpp
|
|
|
|
Row.cpp
|
|
|
|
Value.cpp
|
|
|
|
Pool.cpp
|
|
|
|
PoolFactory.cpp
|
|
|
|
PoolWithFailover.cpp
|
2016-02-07 21:58:58 +00:00
|
|
|
)
|
|
|
|
|
2020-03-12 22:26:16 +00:00
|
|
|
target_include_directories (mysqlxx PUBLIC ..)
|
2017-08-03 12:44:39 +00:00
|
|
|
|
2021-11-21 14:35:33 +00:00
|
|
|
if (NOT USE_INTERNAL_MYSQL_LIBRARY)
|
2018-08-02 00:49:31 +00:00
|
|
|
set(PLATFORM_LIBRARIES ${CMAKE_DL_LIBS})
|
|
|
|
|
|
|
|
if (USE_MYSQL)
|
|
|
|
target_include_directories (mysqlxx SYSTEM PRIVATE ${MYSQL_INCLUDE_DIR})
|
|
|
|
endif ()
|
2017-09-04 17:04:33 +00:00
|
|
|
|
2018-08-02 00:49:31 +00:00
|
|
|
if (APPLE)
|
|
|
|
find_library (ICONV_LIBRARY iconv)
|
|
|
|
set (MYSQLCLIENT_LIBRARIES ${MYSQLCLIENT_LIBRARIES} ${STATIC_MYSQLCLIENT_LIB} ${ICONV_LIBRARY})
|
|
|
|
elseif (USE_STATIC_LIBRARIES AND STATIC_MYSQLCLIENT_LIB)
|
2018-11-21 19:20:27 +00:00
|
|
|
set (MYSQLCLIENT_LIBRARIES ${STATIC_MYSQLCLIENT_LIB})
|
2018-08-02 00:49:31 +00:00
|
|
|
endif ()
|
2016-12-01 22:44:59 +00:00
|
|
|
endif ()
|
2016-02-07 21:58:58 +00:00
|
|
|
|
2020-06-09 10:54:49 +00:00
|
|
|
target_link_libraries (mysqlxx
|
|
|
|
PUBLIC
|
|
|
|
common
|
|
|
|
PRIVATE
|
|
|
|
${MYSQLCLIENT_LIBRARIES}
|
|
|
|
${ZLIB_LIBRARIES}
|
|
|
|
)
|
|
|
|
|
2019-03-22 11:18:24 +00:00
|
|
|
if(OPENSSL_LIBRARIES)
|
|
|
|
target_link_libraries(mysqlxx PRIVATE ${OPENSSL_LIBRARIES})
|
|
|
|
endif()
|
2020-06-09 10:54:49 +00:00
|
|
|
|
2019-03-22 11:18:24 +00:00
|
|
|
target_link_libraries(mysqlxx PRIVATE ${PLATFORM_LIBRARIES})
|
|
|
|
|
|
|
|
if (NOT USE_INTERNAL_MYSQL_LIBRARY AND OPENSSL_INCLUDE_DIR)
|
2018-11-21 19:20:27 +00:00
|
|
|
target_include_directories (mysqlxx SYSTEM PRIVATE ${OPENSSL_INCLUDE_DIR})
|
|
|
|
endif ()
|
2016-12-01 22:44:59 +00:00
|
|
|
|
2021-08-23 17:07:05 +00:00
|
|
|
target_no_warning(mysqlxx reserved-macro-identifier)
|
|
|
|
|
2020-08-19 02:22:30 +00:00
|
|
|
if (NOT USE_INTERNAL_MYSQL_LIBRARY AND USE_STATIC_LIBRARIES)
|
|
|
|
message(WARNING "Statically linking with system mysql/mariadb only works "
|
|
|
|
"if mysql client libraries are built with same openssl version as "
|
|
|
|
"we are going to use now. It wouldn't work if GnuTLS is used. "
|
|
|
|
"Try -D\"USE_INTERNAL_MYSQL_LIBRARY\"=ON or -D\"ENABLE_MYSQL\"=OFF or "
|
|
|
|
"-D\"USE_STATIC_LIBRARIES\"=OFF")
|
|
|
|
endif ()
|
|
|
|
|
2016-12-01 22:44:59 +00:00
|
|
|
if (ENABLE_TESTS)
|
2020-03-12 22:26:16 +00:00
|
|
|
add_subdirectory (tests)
|
2017-04-10 17:43:30 +00:00
|
|
|
endif ()
|