-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
92 lines (78 loc) · 3.02 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
cmake_minimum_required(VERSION 3.12)
cmake_policy(SET CMP0079 NEW)
string(TIMESTAMP PROJECT_VERSION_MAJOR %y)
string(TIMESTAMP PROJECT_VERSION_MINOR %m)
string(TIMESTAMP PROJECT_VERSION_PATCH %d)
string(TIMESTAMP PROJECT_VERSION_TWEAK %H)
project(
irafhy
VERSION
${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}.${PROJECT_VERSION_TWEAK}
DESCRIPTION
"Interval arithematic based Reachability Analysis Facility for Hybrid system"
LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_C_EXTENSIONS NO)
set(CMAKE_CXX_EXTENSIONS NO)
include(GNUInstallDirs)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/${CMAKE_INSTALL_LIBDIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/${CMAKE_INSTALL_LIBDIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/${CMAKE_INSTALL_BINDIR})
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
include(Marcros)
include_directories(/usr/local/include/antlr4-runtime)
option(ENABLE_STATIC_LIB "statically linked library" ON)
option(ENABLE_EXAMPLES "Enable generating examples" OFF)
option(ENABLE_TESTING "Enable Unit Testing" OFF)
option(ENABLE_DOC "Enable generating documents" OFF)
option(BUILD_SHARED_LIBS "Build libraries as shared as opposed to static" OFF)
# @brief: Enable building shared libraries with -DENABLE_STATIC_LIB=1
if(NOT ${ENABLE_STATIC_LIB})
set(BUILD_SHARED_LIBS ON)
endif()
if(NOT CMAKE_CONFIGURATION_TYPES)
if(NOT CMAKE_BUILD_TYPE)
message(STATUS "Setting build type to 'Release' as none was specified.")
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY VALUE "Release")
endif()
endif()
# Enable RPATH support for installed binaries and libraries
include(AddInstallRPATHSupport)
add_install_rpath_support(BIN_DIRS
"${CMAKE_INSTALL_FULL_BINDIR}"
LIB_DIRS
"${CMAKE_INSTALL_FULL_LIBDIR}"
INSTALL_NAME_DIR
"${CMAKE_INSTALL_FULL_LIBDIR}"
USE_LINK_PATH)
add_subdirectory(src)
include(InstallBasicPackageFiles)
install_basic_package_files(${PROJECT_NAME}
VERSION
${${PROJECT_NAME}_VERSION}
COMPATIBILITY
AnyNewerVersion
VARS_PREFIX
${PROJECT_NAME}
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
# Add the uninstall target
include(AddUninstallTarget)
# @brief compile options
target_compile_options(${PROJECT_NAME} PUBLIC -Wno-attributes -fPIC)
# @brief: Enable code coverage with -DENABLE_EXAMPLES=1
if(ENABLE_EXAMPLES)
message("Enable generating examples")
add_subdirectory(examples)
endif()
# @brief: Enable unit test with -DENABLE_TESTING=1
if(ENABLE_TESTING)
message("Enable unit testing")
enable_testing()
add_subdirectory(test)
endif()
# @brief: Enable document with -DENABLE_DOC=1
if(ENABLE_DOC)
message("Enable generating documents")
add_subdirectory(doc)
endif()