-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
98 lines (76 loc) · 2.94 KB
/
CMakeLists.txt
File metadata and controls
98 lines (76 loc) · 2.94 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
cmake_minimum_required(VERSION 3.25...3.31 FATAL_ERROR)
# No specific need for this version, but let's set *something* so
# the lower bound is known and enforced
set(MINIMUM_WINDOWS_VERSION "10.0.19041.0")
set(CMAKE_SYSTEM_VERSION "${MINIMUM_WINDOWS_VERSION}")
# Required for XAML resources in self-contained mode
set(CMAKE_INSTALL_BINDIR "." CACHE STRING "Path to install binaries relative to the root" FORCE)
set(CMAKE_INSTALL_DOCDIR "docs" CACHE STRING "Path to install documentation" FORCE)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
add_compile_options(
# Standard C++ exception behavior
"/EHsc"
# UTF-8 sources
"/utf-8"
)
# Require that targets exist
cmake_policy(SET CMP0079 NEW)
set(CMAKE_LINK_LIBRARIES_ONLY_TARGETS ON)
cmake_policy(SET CMP0028 NEW)
# Set extracted file timestamp to extract time
cmake_policy(SET CMP0135 NEW)
include(cmake/hybrid-crt.cmake)
set(VERSION_TWEAK 0 CACHE STRING "Final component of build number")
project(
HTCC
VERSION 1.6.1.${VERSION_TWEAK}
LANGUAGES CXX C)
if (NOT VERSION_TWEAK_LABEL)
set(VERSION_TWEAK_LABEL "local")
endif ()
option(IS_TAGGED_BUILD "Whether or not we're building a tagged version" OFF)
math(EXPR MINOR_VER_MOD_2 "${PROJECT_VERSION_MINOR} % 2")
math(EXPR PATCH_VER_MOD_2 "${PROJECT_VERSION_PATCH} % 2")
if (IS_TAGGED_BUILD AND MINOR_VER_MOD_2 EQUAL 0 AND PATCH_VER_MOD_2 EQUAL 0 AND NOT VERSION_TWEAK_LABEL STREQUAL "local")
set(IS_STABLE_BUILD_DEFAULT ON)
else ()
set(IS_STABLE_BUILD_DEFAULT OFF)
endif ()
option(IS_STABLE_BUILD "Whether or not we're building a stable release" ${IS_STABLE_BUILD_DEFAULT})
set(VERSION_SEMVER "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}+${VERSION_TWEAK_LABEL}.${PROJECT_VERSION_TWEAK}")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
include(output-paths)
include(smol-binaries)
message(STATUS "${CMAKE_PROJECT_NAME} v${CMAKE_PROJECT_VERSION}")
# Handy for CI
file(WRITE "${CMAKE_BINARY_DIR}/version.txt" "${CMAKE_PROJECT_VERSION}")
if (MSVC AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CLANG_CL 1 CACHE BOOL "Whether we're using clang-cl")
else ()
set(CLANG_CL 0)
endif ()
message(STATUS "Compiler: ${CMAKE_CXX_COMPILER_ID}")
message(STATUS "Simulated compiler: ${CMAKE_CXX_SIMULATE_ID}")
message(STATUS "MSVC: ${MSVC}")
message(STATUS "CLANG_CL: ${CLANG_CL}")
set(COMMON_COMPILE_OPTIONS "/DUNICODE" "/D_UNICODE")
if (MSVC AND NOT CLANG_CL)
list(
APPEND COMMON_COMPILE_OPTIONS
# Standards-compliant C++20 coroutines
"/await:strict"
# Synchronous writes to PDB files in case building with parallel CL.exe
"/FS"
# Include content and marker in error messages
"/diagnostics:caret"
)
endif ()
add_compile_options(${COMMON_COMPILE_OPTIONS})
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME Default)
add_subdirectory("third-party")
add_subdirectory("src")
add_subdirectory("reg")
add_subdirectory("scripts")
add_subdirectory("HTCC-Installer")