-
Notifications
You must be signed in to change notification settings - Fork 10
/
CMakeLists.txt
53 lines (40 loc) · 2 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
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
project("sarus")
enable_testing()
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/modules)
set(CMAKE_CXX_OUTPUT_EXTENSION_REPLACE 1) # required for gcov (e.g. will generate example.gcno instead of example.cpp.gcno)
# build statically-linked executables
if(${BUILD_STATIC})
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
set(CMAKE_EXE_LINKER_FLAGS "-static")
set(CMAKE_LINK_SEARCH_START_STATIC TRUE)
set(CMAKE_LINK_SEARCH_END_STATIC TRUE)
set(Boost_USE_STATIC_LIBS ON)
endif(${BUILD_STATIC})
set(LIBEXECDIR ${CMAKE_INSTALL_PREFIX}/libexec CACHE PATH "libexec directory [$CMAKE_INSTALL_PREFIX/libexec]")
set(ENABLE_SSH TRUE CACHE BOOL "Build a statically-linked SSH software to be executed inside the container [TRUE]")
set(ENABLE_UNIT_TESTS TRUE CACHE BOOL "Build unit tests. Also downloads and builds the CppUTest framework [TRUE]")
set(ENABLE_TESTS_WITH_VALGRIND FALSE CACHE BOOL "Run each unit test through valgrind [FALSE]")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
message(STATUS "Installation directory: " ${CMAKE_INSTALL_PREFIX})
message(STATUS "Enable SSH support: " ${ENABLE_SSH})
include_directories(${CMAKE_SOURCE_DIR}/dep/rapidjson/include)
find_package(Boost REQUIRED COMPONENTS program_options filesystem regex)
include_directories(${Boost_INCLUDE_DIRS})
find_program(GIT_PATH git)
execute_process(COMMAND ${GIT_PATH} describe --tags --dirty --always
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE LATEST_GIT_TAG
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT LATEST_GIT_TAG)
set(LATEST_GIT_TAG VERSION-NOT-AVAILABLE)
endif(NOT LATEST_GIT_TAG)
message(STATUS "Sarus version: " ${LATEST_GIT_TAG})
add_subdirectory(dep)
add_subdirectory(etc)
add_subdirectory(src)
install(FILES configure_installation.sh DESTINATION ${CMAKE_INSTALL_PREFIX} PERMISSIONS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)