-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
80 lines (64 loc) · 2.04 KB
/
CMakeLists.txt
File metadata and controls
80 lines (64 loc) · 2.04 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
cmake_minimum_required(VERSION 3.1.0)
project(consolebuffer
VERSION 0.1.0
DESCRIPTION ""
)
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17 CACHE STRING "")
endif()
if(CMAKE_CXX_STANDARD LESS 17)
message(FATAL_ERROR " C++ incompatible standard ${CMAKE_CXX_STANDARD}. Required C++17")
endif()
if (NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_CXX_COMPILER "g++")
#I prefer executable files in bin/ instead build/. Change it if you like.
#set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin") # build/bin/
#set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin) # bin/
endif()
#Compiler options
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /WX /permissive-")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic")# -Werror")
endif()
#OS options
option(MINGW_STATIC_LINK "Link MinGW dependencies statically." ON)
option(MSVC_STATIC_LINK "Link MSVC static C++ runtime library." OFF)
if(WIN32)
message("Windows OS detected.")
if(MSVC AND MSVC_STATIC_LINK)
message("Linking MSVC C++ runtime statically...")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MD /MT")
endif()
if(NOT MSVC AND MINGW_STATIC_LINK)
message("Linking MinGW dependencies statically...")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++ -static -pthread")
endif()
endif()
include_directories ("${PROJECT_SOURCE_DIR}/include")
#Build type options
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
message("Building Debug...")
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Release")
message("Building Release...")
endif()
include_directories(src include)
add_executable(benchmark_80x20
test/benchmark_80x20.cpp
)
add_executable(benchmark_triple
test/benchmark_triple.cpp
)
add_executable(benchmark_triple_utf8
test/benchmark_triple_utf8.cpp
)
add_executable(test_2d_buffer
test/test_2d_buffer.cpp
)
add_executable(BORRAME
test/BORRAME.cpp
)
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)