-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
80 lines (68 loc) · 2.13 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
68
69
70
71
72
73
74
75
76
77
78
79
80
cmake_minimum_required(VERSION 3.10.0)
project(dummyupdate)
include_directories(include vendor/libdummy/include)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} \
-L${CMAKE_CURRENT_SOURCE_DIR}/vendor/libdummy/build")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
add_subdirectory("vendor/libdummy")
find_package(Boost)
include_directories(${Boost_INCLUDE_DIR})
link_directories(${Boost_LIBRARY_DIRS})
macro(GroupSources curdir)
file(
GLOB children RELATIVE ${PROJECT_SOURCE_DIR}/${curdir}
${PROJECT_SOURCE_DIR}/${curdir}/*
)
foreach(child ${children})
if(IS_DIRECTORY ${PROJECT_SOURCE_DIR}/${curdir}/${child})
GroupSources(${curdir}/${child})
else()
string(REPLACE "/" "\\" groupname ${curdir})
source_group(
${groupname}
FILES
${PROJECT_SOURCE_DIR}/${curdir}/${child}
)
endif()
endforeach()
endmacro()
file(GLOB_RECURSE SOURCES "src/*.cpp")
file(GLOB_RECURSE HEADERS "include/*.hpp")
GroupSources(include)
GroupSources(src)
set(CLIENT_LINK_LIBRARIES
${Boost_LIBRARIES}
dummy
)
# On Linux, explicitly pass libraries.
if (UNIX)
set(CLIENT_LINK_LIBRARIES
${CLIENT_LINK_LIBRARIES}
pthread
)
add_executable(dummyupdate ${SOURCES} ${HEADERS})
endif (UNIX)
IF (WIN32)
add_executable(dummyupdate WIN32 ${SOURCES} ${HEADERS})
SET_TARGET_PROPERTIES (dummyupdate
PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:console"
)
SET_TARGET_PROPERTIES (dummyupdate
PROPERTIES LINK_FLAGS_RELEASE
"/SUBSYSTEM:windows /ENTRY:mainCRTStartup"
)
SET_TARGET_PROPERTIES (dummyupdate
PROPERTIES LINK_FLAGS_MINSIZEREL
"/SUBSYSTEM:windows /ENTRY:mainCRTStartup"
)
SET_TARGET_PROPERTIES (dummyupdate
PROPERTIES LINK_FLAGS_RELWITHDEBINFO
"/SUBSYSTEM:windows /ENTRY:mainCRTStartup"
)
ENDIF (WIN32)
target_include_directories(dummyupdate PUBLIC ${Boost_INCLUDE_DIRS})
target_link_libraries(dummyupdate
${CLIENT_LINK_LIBRARIES}
)