-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
51 lines (41 loc) · 1.89 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
cmake_minimum_required (VERSION 3.8)
cmake_policy(SET CMP0079 NEW) # Settings policy
set(CMAKE_EXE_LINKER_FLAGS "-static") # Set static flag compiling
set(PROJECT_NAME "WebServer")
project (${PROJECT_NAME})
# Enable Hot Reload for MSVC compilers if supported.
if (POLICY CMP0141)
cmake_policy(SET CMP0141 NEW)
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<IF:$<AND:$<C_COMPILER_ID:MSVC>,$<CXX_COMPILER_ID:MSVC>>,$<$<CONFIG:Debug,RelWithDebInfo>:EditAndContinue>,$<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>>")
endif()
# BOOST setting
set(BOOST_ROOT "D:/Programming Projects/CPP Libraries/Boost") # The boost root path
set(Boost_NO_SYSTEM_PATHS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_STATIC_RUNTIME OFF)
set(BOOST_ALL_DYN_LINK OFF)
# Find BOOST package
find_package (Boost REQUIRED)
# If BOOST is found
if (Boost_FOUND)
include_directories(SYSTEM ${Boost_INCLUDE_DIR} ${asio_SOURCE_DIR}/asio/include) # to link the header files
endif ()
# Add "source" directory
add_subdirectory("source")
if(PRODUCTION_BUILD)
target_compile_definitions("${PROJECT_NAME}" PUBLIC DOMAINS_PATH="./domains/") # setup the DOMAINS_PATH
target_compile_definitions("${PROJECT_NAME}" PUBLIC PRODUCTION_BUILD=1) # remove the option to debug asserts.
else()
target_compile_definitions("${PROJECT_NAME}" PUBLIC DOMAINS_PATH="${CMAKE_CURRENT_SOURCE_DIR}/domains/") # This is useful to get an DOMAINS_PATH in your IDE during development
target_compile_definitions("${PROJECT_NAME}" PUBLIC PRODUCTION_BUILD=0) # add the option to debug asserts.
endif()
# If OS is Windows
if (WIN32)
target_link_libraries(${PROJECT_NAME} PRIVATE ws2_32 wsock32)
endif()
# If BOOST is found
if (Boost_FOUND)
include_directories(SYSTEM ${Boost_INCLUDE_DIR} ${asio_SOURCE_DIR}/asio/include) # to link the header files
target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES}) # to link library
endif ()