-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
39 lines (30 loc) · 1.55 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
cmake_minimum_required(VERSION 2.6)
project(Crystal)
# Ensure all dependencies are existent.
execute_process(
COMMAND git submodule init
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
execute_process(
COMMAND git submodule update
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
add_subdirectory(depend/netlib)
# Set the C++ standard used by the Crystal library.
set(CMAKE_CXX_FLAGS "-std=c++17 -Wfatal-errors -g")
# Add Lock library include path.
include_directories(include)
# Select all source files.
file(GLOB_RECURSE crystal_sources ./src/*.cpp)
# Select all header files.
file(GLOB_RECURSE crystal_headers ./src/*.hpp ./src/*.inl)
# Add them to the Crystal library.
add_library(crystal STATIC ${crystal_sources} ${crystal_headers})
# Link the Crystal library with pthreads and netlib.
target_link_libraries(crystal pthread netlib)
# Creates an include directory containing all header files used in the Crystal library
# Add crystal/include/ to your include directories and access the files via #include <crystal/*>
file(COPY "src/" DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/include/crystal/ FILES_MATCHING PATTERN "*.hpp" PATTERN "*.inl")
file(COPY "LICENSE" DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/include/crystal/)
# Add includes from dependencies into the include directory.
file(COPY "depend/Lock/include/" DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/include/)
file(COPY "depend/netlib/include/" DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/include/)
file(COPY "depend/cppeie/include/" DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/include/)