-
Notifications
You must be signed in to change notification settings - Fork 11
/
CMakeLists.txt
70 lines (55 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
if(CMAKE_MAJOR_VERSION LESS 3)
cmake_minimum_required(VERSION 2.6)
else()
if(CMAKE_MINOR_VERSION LESS 6)
cmake_minimum_required(VERSION 2.8.12)
else()
cmake_minimum_required(VERSION 3.6)
endif()
endif()
##project
project(openfec C)
include(GNUInstallDirs)
file(READ ${PROJECT_SOURCE_DIR}/.version VERSION_TAG)
string(REGEX REPLACE "\n$" "" VERSION_TAG "${VERSION_TAG}")
message(STATUS "Project version: ${VERSION_TAG}")
set(PROJECT_VERSION "${VERSION_TAG}")
set(PROJECT_DESCRIPTION "Application-Level Forward Erasure Correction implementation library")
ENABLE_TESTING()
if (PROFILING STREQUAL "ON")
else(PROFILING STREQUAL "ON")
endif(PROFILING STREQUAL "ON")
if (DEBUG STREQUAL "ON")
# Debug mode
ADD_DEFINITIONS(-DOF_DEBUG)
set(CMAKE_BUILD_TYPE Debug)
message(STATUS "Debug mode ON" )
else(DEBUG STREQUAL "ON")
# Release mode
set(CMAKE_BUILD_TYPE Release)
set(OPTIMIZE "3" CACHE STRING "Set optimization level (0-3 or DEFAULT)")
if (NOT OPTIMIZE STREQUAL "DEFAULT")
string(REGEX REPLACE "(-O[A-Za-z0-9]+)" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
string(REGEX REPLACE "(-O[A-Za-z0-9]+)" "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O${OPTIMIZE}")
endif()
message(STATUS "Debug mode OFF")
message(STATUS "Optimization level ${OPTIMIZE}")
endif (DEBUG STREQUAL "ON")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -Wno-unused-result")
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE}
CACHE STRING "output path for libraries")
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE}
CACHE STRING "output path for executables")
MARK_AS_ADVANCED(
LIBRARY_OUTPUT_PATH
EXECUTABLE_OUTPUT_PATH
)
option(INSTALL_DEVTOOLS "install developer tools to the system" OFF)
link_directories(${LIBRARY_OUTPUT_PATH})
add_subdirectory(pc)
add_subdirectory(src)
add_subdirectory(applis/eperftool)
add_subdirectory(applis/howto_examples/simple_client_server)
add_subdirectory(tools/descr_stats_v1.2)
add_subdirectory(tests)