-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
46 lines (38 loc) · 898 Bytes
/
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
project(gzat)
# Include header directories
include_directories("include")
# Include headers and sources
# Sources
file(GLOB sub_sources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"./source/*.cpp")
# Headers
file(GLOB sub_headers RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"./include/*.hpp")
# Testers
file(GLOB sub_testers RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"./test/*.cpp")
# Add to list of sources
set(sources ${sources} ${sub_sources})
set(headers ${headers} ${sub_headers})
set(testers ${testers} ${sub_testers})
# Set compilation flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O3 -fPIC -Werror")
# Compile library
add_library(
${PROJECT_NAME}
STATIC
${sources}
${headers}
)
# Compile test
add_executable(
${PROJECT_NAME}_test
${testers}
${headers}
)
target_link_libraries(
${PROJECT_NAME}_test
${PROJECT_NAME}
gtest
gtest_main
)