-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
67 lines (56 loc) · 2.24 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
cmake_minimum_required(VERSION 3.8)
project (ninjaDaemon)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(CMAKE_CXX_FLAGS_DEBUG "-Og -g")
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Werror ")
set(INCPATH_RAPIDJSON "${CMAKE_CURRENT_SOURCE_DIR}/third-party/rapidjson/include/")
set(INCPATH_PISTACHE "${CMAKE_CURRENT_SOURCE_DIR}/third-party/pistache/include/")
set(LIBPATH_PISTACHE "${CMAKE_CURRENT_SOURCE_DIR}/third-party/pistache/build/src/")
set(INCPATH_INIPP "${CMAKE_CURRENT_SOURCE_DIR}/third-party/inipp/")
LINK_DIRECTORIES(${LIBPATH_PISTACHE})
find_package(Threads REQUIRED)
##### Git submodules
find_package(Git QUIET)
if(GIT_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
# Update submodules as needed
option(GIT_SUBMODULE "Check submodules during build" ON)
if(GIT_SUBMODULE)
message(STATUS "Submodule update")
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --remote --init
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT)
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
message(FATAL_ERROR "git submodule update --remote --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
endif()
endif()
endif()
#####
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include ${INCPATH_RAPIDJSON} ${INCPATH_INIPP} ${INCPATH_PISTACHE})
file(GLOB SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp"
)
add_library(ninjaDaemonStatic STATIC ${SOURCES})
set_target_properties(ninjaDaemonStatic PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_link_libraries(ninjaDaemonStatic PUBLIC
Threads::Threads
stdc++fs
libpistache.a)
add_executable(ninjaDaemon ${SOURCES} "${CMAKE_CURRENT_SOURCE_DIR}/example/simpleExample.cpp")
target_link_libraries(ninjaDaemon PUBLIC
Threads::Threads
stdc++fs
libpistache.a)
file(GLOB SOURCES_RESTEXAMPLE
"${CMAKE_CURRENT_SOURCE_DIR}/example/pistacheExample/*.cpp"
)
add_executable(ninjaDaemonPistacheExample01 ${SOURCES} ${SOURCES_RESTEXAMPLE} )
target_link_libraries(ninjaDaemonPistacheExample01 PUBLIC
Threads::Threads
stdc++fs
libpistache.a)