-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
37 lines (33 loc) · 1.77 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 3.15)
# cmake general
cmake_policy(SET CMP0091 NEW)
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_DISABLE_IN_SOURCE_BUILD OFF)
set(CMAKE_SUPPRESS_REGENERATION ON)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/build/${CMAKE_BUILD_TYPE}/)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/build/${CMAKE_BUILD_TYPE}/)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/build/${CMAKE_BUILD_TYPE}/)
# doesnt work with native ninja generator
#set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
# msvc general
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX23_STANDARD_COMPILE_OPTION "-std:c++latest")
set(CMAKE_CXX23_EXTENSION_COMPILE_OPTION "-std:c++latest")
set(COMMON_COMPILE_FLAGS "/W3 /DUNICODE /D_UNICODE /D_WIN32_WINNT=0x0601 /DWIN32_LEAN_AND_MEAN /D_CRT_SECURE_NO_WARNINGS")
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CMAKE_CXX_FLAGS_RELEASE "${COMMON_COMPILE_FLAGS} /O2 /Gw -flto /DNDEBUG /MT")
set(CMAKE_C_FLAGS_RELEASE "${COMMON_COMPILE_FLAGS} /O2 /Gw -flto /DNDEBUG /MT")
set(CMAKE_CXX_FLAGS_DEBUG "${COMMON_COMPILE_FLAGS} /Od /Zi /DDEBUG /D_DEBUG /MTd")
set(CMAKE_C_FLAGS_DEBUG "${COMMON_COMPILE_FLAGS} /Od /Zi /DDEBUG /D_DEBUG /MTd")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(CMAKE_CXX_FLAGS_RELEASE "${COMMON_COMPILE_FLAGS} /O2 /Gw /GL /wd4458 /DNDEBUG /MT")
set(CMAKE_C_FLAGS_RELEASE "${COMMON_COMPILE_FLAGS} /O2 /Gw /GL /wd4458 /DNDEBUG /MT")
set(CMAKE_CXX_FLAGS_DEBUG "${COMMON_COMPILE_FLAGS} /Od /Zi /wd4458 /DDEBUG /D_DEBUG /MTd")
set(CMAKE_C_FLAGS_DEBUG "${COMMON_COMPILE_FLAGS} /Od /Zi /wd4458 /DDEBUG /D_DEBUG /MTd")
else()
message(FATAL_ERROR "Unsupported toolset, use MSVC or Clang for build")
endif()
set(OUT_DIR "" CACHE PATH "Dist dir")
# sources
add_subdirectory( deps )
add_subdirectory( src )