-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
71 lines (58 loc) · 1.95 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
cmake_minimum_required(VERSION 3.8)
project(yuca CXX)
include_directories(src)
set(SOURCE_FILES
src/yuca/yuca.hpp
src/yuca/types.hpp
src/yuca/key.hpp
src/yuca/key.cpp
src/yuca/document.hpp
src/yuca/document.cpp
src/yuca/indexer.hpp
src/yuca/indexer.cpp
src/yuca/utils.hpp
)
add_compile_options(-Wno-padded)
if(CMAKE_CXX_COMPILER_ID MATCHES Clang)
add_compile_options(
-Weverything
-Wno-c++98-compat
-Wno-global-constructors
-Wno-exit-time-destructors
-Wno-weak-vtables)
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES GNU)
add_compile_options(
-Wall
-Wextra
-Wpedantic
-Wparentheses
-Wvla
-Wno-format-zero-length
-fPIC)
endif()
# the libyuca_* libraries
add_library(yuca_shared SHARED ${SOURCE_FILES})
add_library(yuca_static STATIC ${SOURCE_FILES})
set_target_properties(yuca_shared PROPERTIES LINKER_LANGUAGE CXX)
set_target_properties(yuca_static PROPERTIES LINKER_LANGUAGE CXX)
target_compile_features(yuca_shared PUBLIC cxx_std_11)
target_compile_features(yuca_static PUBLIC cxx_std_11)
# demo executable to show how to use the library
add_executable(yuca_demo_shared demo.cpp)
add_executable(yuca_demo_static demo.cpp)
target_link_libraries(yuca_demo_shared yuca_shared)
target_link_libraries(yuca_demo_static yuca_static)
# unit tests with catch 2 (files are checked in the order they are declared, the ones on top first)
set(TEST_FILES
tests/utils_tests.cpp
tests/document_tests.cpp
tests/indexer_tests.cpp
tests/tests_main.cpp)
add_executable(yuca_tests ${SOURCE_FILES} ${TEST_FILES})
set_target_properties(yuca_tests PROPERTIES LINKER_LANGUAGE CXX)
# TODO: remove this when tests link to the library
target_compile_features(yuca_tests PUBLIC cxx_std_11)
install(TARGETS yuca_shared yuca_demo_shared
LIBRARY DESTINATION lib
RUNTIME DESTINATION doc)