-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
43 lines (34 loc) · 1.16 KB
/
CMakeLists.txt
File metadata and controls
43 lines (34 loc) · 1.16 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
cmake_minimum_required(VERSION 3.16)
set(CMAKE_CXX_STANDARD 14)
project(
value_param_gtest_eg
LANGUAGES CXX)
# Default build type is Release
set(default_build_type "Release")
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"
"MinSizeRel" "RelWithDebInfo")
endif()
# Set compile flags
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
# Set compile options
option(BUILD_TEST "if build unit test" OFF)
message("BUILD_TYPE=" ${CMAKE_BUILD_TYPE})
message("BUILD_TEST=" ${BUILD_TEST})
# Build src
file(GLOB SOURCES ${PROJECT_SOURCE_DIR}/src/*.cpp)
add_executable(value_param_gtest_eg ${SOURCES})
target_include_directories(value_param_gtest_eg BEFORE PUBLIC ${PROJECT_SOURCE_DIR}/include)
# Build test
if(${BUILD_TEST})
enable_testing()
add_subdirectory(test)
endif()