-
Notifications
You must be signed in to change notification settings - Fork 12
/
CMakeLists.txt
66 lines (53 loc) · 1.53 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
cmake_minimum_required(VERSION 3.0)
project(Magic)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include(Magic.cmake)
include_directories(
Include
ThirdParty/Asio/Include
ThirdParty/Brotli/c/include
ThirdParty/RapidJSON/Include
)
if(NOT Sanitize)
set(Analysis OFF)
else()
set(ENABLE_SANITIZER ${Sanitize})
endif()
set(BROTLI_DISABLE_TESTS ON)
# PARENT_SCOPE Exporting Variables
add_subdirectory(ThirdParty/Brotli)
file(GLOB_RECURSE HEADERS Include/Magic/*.h)
file(GLOB_RECURSE SOURCES Source/Magic/*.cpp)
set(BINARY Magic)
add_library(Magic STATIC ${HEADERS} ${SOURCES})
target_link_libraries(Magic ${BROTLI_LIBRARIES} ${MAGIC_DEPEND_LIBRARY})
set(BINARY
Gen
Create
${BINARY}
)
add_executable(Gen Tool/Generator.cpp)
add_executable(Create Tool/Create.cpp)
if(Trace STREQUAL ON)
add_definitions(-DTRACE)
endif()
if(Analysis STREQUAL ON)
if(DEFINED MAGIC_CLANG_INCLUDE AND DEFINED MAGIC_CLANG_LIBRARY)
set(BINARY ${BINARY} Analysis)
link_directories(${MAGIC_CLANG_LIBRARY})
include_directories(${MAGIC_CLANG_INCLUDE})
add_executable(Analysis Tool/Analysis.cpp)
target_link_libraries(Analysis clang)
endif()
endif()
install(TARGETS ${BINARY}
RUNTIME DESTINATION ${PROJECT_SOURCE_DIR}/Bin
ARCHIVE DESTINATION ${PROJECT_SOURCE_DIR}/Lib
)
if(Tests STREQUAL ON)
add_subdirectory(Tests)
endif()
if(Examples STREQUAL ON)
add_subdirectory(Examples/Base)
add_subdirectory(Examples/WebServer)
endif()