poco/cmake/FindMySQL.cmake

95 lines
3.0 KiB
CMake
Raw Normal View History

SET(BINDIR32_ENV_NAME "ProgramFiles(x86)")
SET(BINDIR32 $ENV{${BINDIR32_ENV_NAME}})
2012-06-26 14:37:02 +02:00
find_path(MYSQL_INCLUDE_DIR mysql.h
/usr/include/mysql
/usr/local/include/mysql
/opt/mysql/mysql/include
/opt/mysql/mysql/include/mysql
/usr/local/mysql/include
/usr/local/mysql/include/mysql
$ENV{MYSQL_INCLUDE_DIR}
$ENV{MYSQL_DIR}/include
$ENV{ProgramFiles}/MySQL/*/include
${BINDIR32}/MySQL/include
2012-06-26 14:37:02 +02:00
$ENV{SystemDrive}/MySQL/*/include)
if (NOT MYSQL_INCLUDE_DIR)
find_path(MARIADB_INCLUDE_DIR mysql.h
/usr/include/mariadb
/usr/local/include/mariadb
/opt/mariadb/mariadb/include
/opt/mariadb/mariadb/include/mariadb
/usr/local/mariadb/include
/usr/local/mariadb/include/mariadb
$ENV{MARIADB_INCLUDE_DIR}
$ENV{MARIADB_DIR}/include)
endif (NOT MYSQL_INCLUDE_DIR)
2012-06-26 14:37:02 +02:00
if (WIN32)
if (CMAKE_BUILD_TYPE STREQUAL Debug)
set(libsuffixDist debug)
set(libsuffixBuild Debug)
else (CMAKE_BUILD_TYPE STREQUAL Debug)
set(libsuffixDist opt)
set(libsuffixBuild Release)
add_definitions(-DDBUG_OFF)
endif (CMAKE_BUILD_TYPE STREQUAL Debug)
find_library(MYSQL_LIB NAMES mysqlclient
PATHS
$ENV{MYSQL_DIR}/lib/${libsuffixDist}
$ENV{MYSQL_DIR}/libmysql/${libsuffixBuild}
$ENV{MYSQL_DIR}/client/${libsuffixBuild}
$ENV{ProgramFiles}/MySQL/*/lib/${libsuffixDist}
${BINDIR32}/MySQL/lib
2012-06-26 14:37:02 +02:00
$ENV{SystemDrive}/MySQL/*/lib/${libsuffixDist})
else (WIN32)
Cleanup cmake build system to use transitive dependency management from cmake (#2321) * Some cleanup in the root CMakeLists.txt * Cleanup cmake targets * Add find openssl modul for older cmake version * Set proper scope * Change crypto default to off * Fix openssl default to on * Remove global setting of C99 standard * Set from C11 to C99 * Fix for NetSSL win build * Set C99 compile features * Fix Windows build * Fix windows build * Cleanup poco unbundle definition * Fix PDF build * Remove unused set affinity * Add _CRT_SECURE_NO_WARNINGS as target compile definitions * Add _AFXDLL as target compile definitions * Remove commented out line * Refactor add_definitions to target_compile_definitons in Util * Refactor add_definitions to target_compile_definitons in XML * Remove THREADSAFE in data sql cmake build * Refactor add_definitions to target_compile_definition in cmake mysql * Refactor add_definitions to target_compile_definition in cmake odbc * Refactor add_definitions to target_compile_definition in cmake sqlite * Refactor add_definitions to target_compile_definitions in platform specific cmake * Add _DEBUG as compile definition * Add build dependencies between Foundation-testrunner and TestApp, TestLibrary in cmake build * Use cmake property to build shared libs * Cleanup POCO_NO_AUTOMATIC_LIBS. Set only for Windows in cmake build system * cleanup LIB_MODE_DEFINITIONS in cmake buld system * Add POCO_STATIC for CppUnit * Cleanup target link libraries and add option dependencies. * Add dependencies management in cmake * Update cmake documentation * Squashed commit of the following: commit 38c233f93fc8e9ad6e24d686c905eb18c86e19a7 Fix "invalid new-expression of abstract class type ApacheServerRequest" (#2231) - abstract method "bool secure() const" defined in HTTPServerRequest was implemented in ApacheServerRequest, one of its derived classes - a ap_log_error had one of its parameters changed for fixing a warning "passing NULL to non-pointer argument" - minor indentation problems corrected commit 4cbdfbe828943871618172f9e042176f115d61d8 Fix build dependencies * Improve database cmake build dependencies * Update doc * Update doc * Update cmake build commands * Set public on target link libraries in cmake build system * Fix PostgreSQL build * Fix PostgreSQL build in cmake * Fix PostgreSQL from SQL to Data * Squashed commit of the following: commit 1ba7d5dcbfb8d07860dd4efda33b31bedf6184c4 Add missing cmake file * Set path to PostgresSQL in AppVoyer * Try to fix AppVeyor build * show dir in appvoyer * Disable PostgreSQL build on Appvoyer * Refactor add_definitions to target_compile_definitions
2018-06-03 18:17:50 +02:00
find_library(MYSQL_LIB NAMES mysqlclient mysqlclient_r
2012-06-26 14:37:02 +02:00
PATHS
/usr/lib/mysql
/usr/local/lib/mysql
/usr/local/mysql/lib
/usr/local/mysql/lib/mysql
/opt/mysql/mysql/lib
/opt/mysql/mysql/lib/mysql
$ENV{MYSQL_DIR}/libmysql_r/.libs
$ENV{MYSQL_DIR}/lib
$ENV{MYSQL_DIR}/lib/mysql)
if (NOT MYSQL_LIB)
find_library(MARIADB_LIB NAMES mariadbclient
PATHS
/usr/lib/mariadb
/usr/local/lib/mariadb
/usr/local/mariadb/lib
/usr/local/mariadb/lib/mariadb
/opt/mariadb/mariadb/lib
/opt/mariadb/mariadb/lib/mariadb
$ENV{MARIADB_DIR}/libmariadb/.libs
$ENV{MARIADB_DIR}/lib
$ENV{MARIADB_DIR}/lib/mariadb)
endif (NOT MYSQL_LIB)
2012-06-26 14:37:02 +02:00
endif (WIN32)
if (MYSQL_INCLUDE_DIR AND MYSQL_LIB)
2012-06-26 14:37:02 +02:00
get_filename_component(MYSQL_LIB_DIR ${MYSQL_LIB} PATH)
set(MYSQL_FOUND TRUE)
message(STATUS "Found MySQL Include directory: ${MYSQL_INCLUDE_DIR} library directory: ${MYSQL_LIB_DIR}")
2012-06-26 14:37:02 +02:00
include_directories(${MYSQL_INCLUDE_DIR})
link_directories(${MYSQL_LIB_DIR})
elseif((MARIADB_INCLUDE_DIR OR MYSQL_INCLUDE_DIR) AND MARIADB_LIB)
get_filename_component(MYSQL_LIB_DIR ${MARIADB_LIB} PATH)
set(MYSQL_FOUND TRUE)
set(MYSQL_LIB ${MARIADB_LIB})
if(MARIADB_INCLUDE_DIR)
set(MYSQL_INCLUDE_DIR ${MARIADB_INCLUDE_DIR})
endif(MARIADB_INCLUDE_DIR)
message(STATUS "Found MariaDB Include directory: ${MYSQL_INCLUDE_DIR} library directory: ${MYSQL_LIB_DIR}")
message(STATUS "Use MariaDB for MySQL Support")
include_directories(${MYSQL_INCLUDE_DIR} )
link_directories(${MYSQL_LIB_DIR})
else ((MARIADB_INCLUDE_DIR OR MYSQL_INCLUDE_DIR) AND MARIADB_LIB)
message(STATUS "Couldn't find MySQL or MariaDB")
endif (MYSQL_INCLUDE_DIR AND MYSQL_LIB)