2
0
mirror of https://github.com/boostorg/mysql.git synced 2026-01-19 04:22:12 +00:00
Files
mysql/CMakeLists.txt
Anarthal (Rubén Pérez) 6a82609638 caching_sha2_password can now be used without TLS
Fixed a problem that caused pfr_by_name<T> to fail compilation when T has no fields under older clang/libc++ versions.

close #313
close #483
2025-06-07 13:20:48 +02:00

97 lines
2.9 KiB
CMake

#
# Copyright (c) 2019-2025 Ruben Perez Hidalgo (rubenperez038 at gmail dot com)
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
cmake_minimum_required(VERSION 3.8...3.22)
# Project
project(boost_mysql VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
# Library
add_library(boost_mysql INTERFACE)
add_library(Boost::mysql ALIAS boost_mysql)
# Dependencies. If non-Boost dependencies are not found, we just bail out
find_package(Threads)
if(NOT Threads_FOUND)
message(STATUS "Boost.MySQL has been disabled, because the required package Threads hasn't been found")
return()
endif()
find_package(OpenSSL)
if(NOT OpenSSL_FOUND)
message(STATUS "Boost.MySQL has been disabled, because the required package OpenSSL hasn't been found")
return()
endif()
# This is generated by boostdep.
# Note that Boost::pfr is not listed because it's a peer dependency
target_link_libraries(
boost_mysql
INTERFACE
Boost::asio
Boost::assert
Boost::charconv
Boost::compat
Boost::config
Boost::container
Boost::core
Boost::describe
Boost::endian
Boost::intrusive
Boost::mp11
Boost::optional
Boost::system
Boost::throw_exception
Boost::variant2
Threads::Threads
OpenSSL::Crypto
OpenSSL::SSL
)
# Includes & features
target_include_directories(boost_mysql INTERFACE include)
target_compile_features(boost_mysql INTERFACE cxx_std_11)
# Don't run integration testing unless explicitly requested, since these require a running MySQL server
option(BOOST_MYSQL_INTEGRATION_TESTS OFF "Whether to build and run integration tests or not")
mark_as_advanced(BOOST_MYSQL_INTEGRATION_TESTS)
# List of server features that the CI DB server does not support.
# Disables running some integration tests and examples
set(BOOST_MYSQL_DISABLED_SERVER_FEATURES "" CACHE STRING
"A CMake list of server features not supported by the CI server, for integration tests"
)
mark_as_advanced(BOOST_MYSQL_DISABLED_SERVER_FEATURES)
# Don't build benchmarks unless explicitly requested, since these require the official
# MySQL and MariaDB client libraries
option(BOOST_MYSQL_BENCH OFF "Whether to build the benchmarks")
mark_as_advanced(BOOST_MYSQL_BENCH)
# Examples and tests
if(BUILD_TESTING)
# Contains some functions to share code between examples and tests
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/utils.cmake)
# Custom target tests; required by the Boost superproject
if(NOT TARGET tests)
add_custom_target(tests)
endif()
# Tests
add_subdirectory(test)
# All examples require a real server to run
if (BOOST_MYSQL_INTEGRATION_TESTS)
add_subdirectory(example)
endif()
endif()
if (BOOST_MYSQL_BENCH)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/utils.cmake)
add_subdirectory(bench)
endif()