forked from cpp-ftw/ccsh
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
54 lines (41 loc) · 1.5 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
cmake_minimum_required (VERSION 2.6)
project (ccsh)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
option(WITH_LIB "Compile shared library." ON)
option(WITH_CLING "Compile cling front-end (interactive shell) as well, requires cling at /opt/cling." ON)
option(WITH_COMPILER "Compile ccshc." ON)
option(WITH_SAMPLE "Compile sample code as well, not required for release." ON)
option(WITH_TEST "Compile test code as well, not required for release." ON)
option(BOOST_FILESYSTEM "Use boost::filesystem instead of std::[experimental::]filesystem" OFF)
if(BOOST_FILESYSTEM)
find_package(Boost COMPONENTS filesystem system REQUIRED)
add_definitions(-DCCSH_FILESYSTEM_BOOST)
set(filesystem_lib "${Boost_LIBRARIES}")
else()
set(filesystem_lib "stdc++fs")
endif()
include_directories(include)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic") # warning level
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") # ensure C++11
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") # add debug symbols even in release
if(WITH_LIB)
add_subdirectory(lib)
endif()
if(WITH_COMPILER)
add_subdirectory(cc)
endif()
if(WITH_SAMPLE)
add_subdirectory(sample)
endif()
if(WITH_TEST)
add_subdirectory(test)
endif()
if(WITH_CLING)
add_subdirectory(ui)
endif()
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_BUILD_TYPE STREQUAL "Coverage")
include(CodeCoverage)
setup_target_for_coverage(coverage ccsh_test coverage)
else()
add_custom_target(coverage)
endif()