forked from sakura-editor/sakura
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
47 lines (36 loc) · 1.33 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
cmake_minimum_required(VERSION 3.6)
include(${CMAKE_SOURCE_DIR}/runtime.cmake)
project (sakura-unittest)
option(BUILD_GTEST "Build GoogleTest." ON)
option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF)
enable_language(CXX)
set(CMAKE_CXX_STANDARD 17) # C++17...
set(CMAKE_CXX_STANDARD_REQUIRED ON) #...is required...
# switch DLL or static library by specifying by command line
set (LIB_TYPE STATIC)
if (BUILD_SHARED_LIBS)
# User wants to build Dynamic Libraries, so change the LIB_TYPE variable to CMake keyword 'SHARED'
set (LIB_TYPE SHARED)
endif (BUILD_SHARED_LIBS)
# set Target Directories
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
if(BUILD_GTEST)
add_subdirectory(googletest)
endif()
add_subdirectory(compiletests)
add_subdirectory(unittests)
# turn on solution folder
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# create solution folder
if(BUILD_GTEST)
set_target_properties(gtest PROPERTIES FOLDER GoogleTest)
set_target_properties(gmock PROPERTIES FOLDER GoogleTest)
endif()
set_target_properties(tests1 PROPERTIES FOLDER Tests)
# specify startup project
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT tests1)
# enable testing
enable_testing()
# add test
add_test(NAME unitTest1 COMMAND tests1)