File: CMakeLists.txt

package info (click to toggle)
boost1.88 1.88.0-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 576,932 kB
  • sloc: cpp: 4,149,234; xml: 136,789; ansic: 35,092; python: 33,910; asm: 5,698; sh: 4,604; ada: 1,681; makefile: 1,633; pascal: 1,139; perl: 1,124; sql: 640; yacc: 478; ruby: 271; java: 77; lisp: 24; csh: 6
file content (90 lines) | stat: -rw-r--r-- 2,804 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#
# 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::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)

# Examples and tests
if(BUILD_TESTING)
    # Contains some functions to share code between examples and tests
    include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/test_utils.cmake)

    # Custom target tests; required by the Boost superproject
    if(NOT TARGET tests)
        add_custom_target(tests)
    endif()

    # Tests
    add_subdirectory(test)
    
    if (BOOST_MYSQL_INTEGRATION_TESTS)
        # All examples require a real server to run
        add_subdirectory(example)

        # We don't run benchmarks, but we build them to prevent code rotting.
        # Having them under BOOST_MYSQL_INTEGRATION_TESTS prevents them
        # from being built in superproject builds
        add_subdirectory(bench) 
    endif()
endif()