-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
81 lines (69 loc) · 2.52 KB
/
CMakeLists.txt
File metadata and controls
81 lines (69 loc) · 2.52 KB
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
cmake_minimum_required(VERSION 3.25)
project(DSMySQL
VERSION 4.8.0
DESCRIPTION "A portable C++23 type-safe MySQL query builder and database wrapper"
LANGUAGES CXX
)
# Configure git hooks at cmake configure time
if(EXISTS "${CMAKE_SOURCE_DIR}/.githooks")
execute_process(
COMMAND git config core.hooksPath .githooks
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
endif()
# Make local CMake helper modules available early (needed by fetched deps).
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(ProjectOptions)
include(CompilerOptions)
include(Dependencies)
# Auto-create .env from .env.example in tests/integration if missing
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/tests/integration/.env")
if(EXISTS "${CMAKE_SOURCE_DIR}/tests/integration/.env.example")
configure_file(
"${CMAKE_SOURCE_DIR}/tests/integration/.env.example"
"${CMAKE_SOURCE_DIR}/tests/integration/.env"
COPYONLY
)
message(STATUS "✓ Created tests/integration/.env from .env.example")
endif()
endif()
# Install git hooks on configure
if(EXISTS "${CMAKE_SOURCE_DIR}/.githooks")
file(COPY ${CMAKE_SOURCE_DIR}/.githooks/
DESTINATION ${CMAKE_SOURCE_DIR}/.git/hooks
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)
message(STATUS "✓ Git hooks installed")
endif()
# Enable testing via CTest (defines BUILD_TESTING)
include(CTest)
# Setup code coverage if enabled
if(ENABLE_COVERAGE)
include(CodeCoverage)
endif()
# Add library
add_subdirectory(lib)
# Add tests and examples only when DSMySQL is the top-level project
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
# Add tests
if(BUILD_TESTING)
add_subdirectory(tests)
endif()
# Add examples
if(BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
endif()
# Display configuration summary
message(STATUS "")
message(STATUS "===== DSMySQL Configuration =====")
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
message(STATUS "C++ compiler: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}")
message(STATUS "C++ standard: C++${CMAKE_CXX_STANDARD}")
message(STATUS "Build tests: ${BUILD_TESTING}")
message(STATUS "Build integration tests: ${BUILD_INTEGRATION_TESTS}")
message(STATUS "Skip Docker management: ${SKIP_DOCKER_MANAGEMENT}")
message(STATUS "Build examples: ${BUILD_EXAMPLES}")
message(STATUS "Enable coverage: ${ENABLE_COVERAGE}")
message(STATUS "Output directory: ${CMAKE_BINARY_DIR}")
message(STATUS "================================")
message(STATUS "")