-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
96 lines (67 loc) · 2.07 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
cmake_minimum_required(VERSION 2.8)
project (witty_proj)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_EXTENSIONS OFF)
###########
# Debug or Release
###########
if (NOT CMAKE_BUILD_TYPE)
## set default to Debug
set(CMAKE_BUILD_TYPE Debug) # override with -DCMAKE_BUILD_TYPE=Debug
message("==> CMAKE_BUILD_TYPE empty. Changing it to Release.")
else()
message("==> CMAKE_BUILD_TYPE == ${CMAKE_BUILD_TYPE}.")
endif()
###########
# Warnings
###########
if (CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter -Wno-unused-variable") # suppress
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations") # suppress
endif ()
find_package(Boost COMPONENTS system thread signals)
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
set(libs ${libs} ${Boost_LIBRARIES})
endif()
if(WITTY_CUSTOM_INSTALL_PATH AND NOT "${WITTY_CUSTOM_INSTALL_PATH}" STREQUAL "")
set(ENV{PATH} "${WITTY_CUSTOM_INSTALL_PATH}/include:${WITTY_CUSTOM_INSTALL_PATH}/lib:$ENV{PATH}")
endif()
## FindWt.cmake
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
FIND_PACKAGE( Wt REQUIRED )
INCLUDE_DIRECTORIES( ${Wt_INCLUDE_DIR} )
# target_link_libraries( yourexe
# ${Wt_DEBUG_LIBRARY}
# ${Wt_HTTP_DEBUG_LIBRARY}
# ${Wt_EXT_DEBUG_LIBRARY}
# )
#
# # or
#
# target_link_libraries( yourexe
# ${Wt_LIBRARY}
# ${Wt_HTTP_LIBRARY}
# ${Wt_EXT_LIBRARY}
# )
#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../wt-3.3.5/build/install/include)
#link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../wt-3.3.5/build/install/lib)
set(target hello.wt)
set(src
hello.C
)
add_executable(${target} ${src})
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
target_link_libraries(${target}
${libs}
${Wt_LIBRARY} # wt
${Wt_HTTP_LIBRARY} # wthttp
)
else()
target_link_libraries(${target}
${libs}
${Wt_DEBUG_LIBRARY} # wtd or wt
${Wt_HTTP_DEBUG_LIBRARY} # wthttpd or wthttp
)
endif()