polserver/cmake/SQL.cmake
turleypol e7fdfdf795
CMake target cleanup, removed configure options (#614)
* every 3rd party lib is now excluded from "all" build, meaning it gets
only build when actually used.
removed the cmake option to partially build, due to the above changes
this is no more needed, just build the target
streamlined 3rdparty target names, they all start with lib now

* renamed escriptgrammar target to escriptgrammar_codegen for
clarification
fixed dependency name

* corrected sources name

* readded missing include
2024-02-01 08:07:37 +01:00

32 lines
911 B
CMake

if(NOT HAVE_MYSQL)
return()
endif()
if(${windows})
if (${ARCH_BITS} EQUAL "64")
set(mysql_path ${POL_EXT_LIB_DIR}/mysql-connector-c-6.0.2-winx64)
else()
set(mysql_path ${POL_EXT_LIB_DIR}/mysql-connector-c-6.0.2-win32)
endif()
add_library(libsql SHARED IMPORTED)
set_target_properties(libsql PROPERTIES
IMPORTED_LOCATION ${mysql_path}/lib/libmysql.dll
IMPORTED_IMPLIB ${mysql_path}/lib/libmysql.lib
INTERFACE_INCLUDE_DIRECTORIES ${mysql_path}/include
FOLDER 3rdParty
)
else()
add_library(libsql INTERFACE IMPORTED)
if (APPLE)
pkg_search_module(MYSQL QUIET IMPORTED_TARGET mysqlclient)
set_target_properties(libsql PROPERTIES
INTERFACE_LINK_LIBRARIES PkgConfig::MYSQL
INTERFACE_INCLUDE_DIRECTORIES ${MYSQL_INCLUDEDIR}/..
)
else()
set_target_properties(libsql PROPERTIES
INTERFACE_LINK_LIBRARIES mysqlclient
)
endif()
endif()