-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
53 lines (35 loc) · 1.57 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
cmake_minimum_required(VERSION 3.8)
## Modern CMake is only available starting with version 3.0.0.
# alias cmakerelease='cmake $1 -DCMAKE_BUILD_TYPE=RELEASE'
#c++ standard
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(DEFAULT_BUILD_TYPE "Release")
#For CMake based projects, compile_commands.json generation auto-generated in the build tree.
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# cli alternative: cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .
project(lab1)
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to ${DEFAULT_BUILD_TYPE} as none was specified.")
set(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}" CACHE STRING "Choose the type of build" FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
endif ()
if(${PROJECT_SOURCE_DIR} STREQUAL ${PROJECT_BINARY_DIR})
message(FATAL_ERROR "In-source builds not allowed.${PROJECT_SOURCE_DIR} == ${PROJECT_BINARY_DIR} Please make a new directory (called a build directory) and run CMake from there.")
else()
message(STATUS "INFORMATION : Out-of-source build")
endif()
message(STATUS "Configuration stages")
add_executable(spy)
# Define headers for this library. PUBLIC headers are used for
# compiling the library, and will be added to consumers' build
# paths.
target_include_directories(spy
PRIVATE ${CMAKE_SOURCE_DIR}/include)
target_compile_definitions(spy
PRIVATE CMAKE_SPY)
target_compile_options(spy
PUBLIC -Wall)
add_subdirectory(src)