-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
56 lines (45 loc) · 1.41 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
cmake_minimum_required(VERSION 3.1)
project(meiose CXX)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(MEIOSE_PROFILE FALSE CACHE BOOL "Enable profiling in meiose's tests")
if(MEIOSE_PROFILE)
include(CodeCoverage)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COVERAGE_COMPILER_FLAGS}")
endif()
include_directories("./include")
set(CMAKE_CXX_STANDARD 14)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
set(MEIOSE_OPTIMIZE FALSE CACHE BOOL "Enable compiler optimization")
if(MEIOSE_OPTIMIZE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
endif()
endif()
set(HEADER_FILES
include/meiose/debug.hpp
include/meiose/endian.hpp
include/meiose/exceptions.hpp
include/meiose/meiose.hpp
include/meiose/json.hpp
include/meiose/msgpack.hpp
include/meiose/variant.hpp
)
set(SOURCE_FILES
src/debug.cpp
src/variant.cpp
src/json.cpp
src/msgpack.cpp
)
set(MEIOSE_BUILD_SHARED FALSE CACHE BOOL "Build shared library")
if(MEIOSE_BUILD_SHARED)
add_library(meiose SHARED ${SOURCE_FILES} ${HEADER_FILES})
endif()
set(MEIOSE_BUILD_STATIC TRUE CACHE BOOL "Build static library")
if(MEIOSE_BUILD_STATIC)
add_library(meiose-static STATIC ${SOURCE_FILES} ${HEADER_FILES})
endif()
set(MEIOSE_TESTS FALSE CACHE BOOL "Enable tests")
if(MEIOSE_TESTS)
enable_testing()
add_subdirectory(tests)
endif()