-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
58 lines (46 loc) · 1.85 KB
/
CMakeLists.txt
File metadata and controls
58 lines (46 loc) · 1.85 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
cmake_minimum_required(VERSION 3.10)
project(
BitBishop
VERSION 0.1.3
LANGUAGES CXX
DESCRIPTION "BitBishop is a modern chess engine written in C++23, built as a personal learning project around bitboards, move generation, search, and engine architecture."
HOMEPAGE_URL "https://github.com/Hardcode3/BitBishop"
)
configure_file(${PROJECT_SOURCE_DIR}/cmake/BitBishop.h.in ${PROJECT_SOURCE_DIR}/build/BitBishop.h)
# Set C++ standard
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Activate folders to sort targets (useful on Visual Studio for instance)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Optionally compile the main executable program
set(COMPILE_EXEC "Compile executable targets or discard them" ON)
# Optionally compile the test suite using GTest
set(COMPILE_TESTS "Compile tests or discard them" ON)
# Optionally enable packaging and install/export configuration
set(COMPILE_PACKAGE "Packages and exports library and binaries" ON)
include(cmake/clang_format.cmake)
include(cmake/clang_tidy.cmake)
include(cmake/compile_options.cmake)
include(cmake/coverage/define_coverage_targets.cmake)
find_package(fmt CONFIG REQUIRED)
find_package(spdlog CONFIG REQUIRED)
add_subdirectory(src)
# Add the main executable if COMPILE_EXEC is ON
if (COMPILE_EXEC)
add_subdirectory(main)
endif ()
# Add test targets and enable CTest if COMPILE_TESTS is ON
if (COMPILE_TESTS)
enable_testing()
find_package(GTest CONFIG REQUIRED)
add_subdirectory(tests)
endif ()
# Setup packaging configuration and enable CPack if COMPILE_PACKAGE is ON
if (COMPILE_PACKAGE)
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
if (NOT DEFINED CPACK_GENERATOR)
set(CPACK_GENERATOR "TGZ" CACHE STRING "Default packaging type (e.g., TGZ, DEB, RPM)" FORCE)
endif ()
include(CPack)
endif ()