-
Notifications
You must be signed in to change notification settings - Fork 186
/
CMakeLists.txt
126 lines (98 loc) · 4.26 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# In order to make release or debug builds, set CMAKE_BUILD_TYPE to Release or Debug.
# In order to change the install prefix, set CMAKE_INSTALL_PREFIX.
# User customizations can be placed in this directory in a file named "local.cmake".
cmake_minimum_required(VERSION 3.5)
# <Package>_ROOT variables are now added to the path by default. We
# were explicitly using our _ROOT variables for this purpose, so the
# "NEW" policy should be fine, although we might want to revisit
# whether we should be doing things differently under the new policy.
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
if(POLICY CMP0144)
cmake_policy(SET CMP0144 OLD)
endif()
# Handle option without warnings in newer cmake
if(POLICY CMP0077)
cmake_policy(SET CMP0077 NEW)
endif()
project(pharos CXX C)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "RelWithDebInfo" "MinSizeRel")
include(AddCXXCompilerFlags)
add_cxx_compiler_flags(-pedantic -pedantic-errors -Wall -Wextra -Wshadow -Wstrict-aliasing -Wno-misleading-indentation "-ftemplate-depth=1024" "-ftrack-macro-expansion=0")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH true)
set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib")
set(BUILD_SHARED_LIBS true)
# Load the user's customizations, then the site customization, then
# the local customization. This lets the local customization take
# precedence over site when setting cache variables, and when setting
# non-cache variables.
include("${CMAKE_CURRENT_SOURCE_DIR}/local.cmake" OPTIONAL)
include("${CMAKE_CURRENT_SOURCE_DIR}/site.cmake" OPTIONAL)
include("${CMAKE_CURRENT_SOURCE_DIR}/local.cmake" OPTIONAL)
set(ROSE_ROOT "" CACHE PATH "The root directory of the ROSE library")
set(BOOST_ROOT "" CACHE PATH "The root directory of the Boost installation")
set(Z3_ROOT "" CACHE PATH "The root directory of the Z3 installation")
set(YamlCpp_ROOT "" CACHE PATH "The root directory of the yaml-cpp installation")
include("${CMAKE_CURRENT_SOURCE_DIR}/site.cmake" OPTIONAL)
include("${CMAKE_CURRENT_SOURCE_DIR}/local.cmake" OPTIONAL)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
message(STATUS "Using Build Type: ${CMAKE_BUILD_TYPE}")
set(CMAKE_CXX_EXTENSIONS off)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED on)
set(THREADS_PREFER_PTHREAD_FLAG on)
if(CMAKE_BUILD_TYPE STREQUAL "Release")
set(PHAROS_RELEASE true)
endif()
# Rose
# Anyone modifying this version should also manually modify libpharos/version.hpp.in. They
# should set the PHAROS_ROSE_MINIMUM_VERSION variable to match.
set(PHAROS_ROSE_MINIMUM_VERSION 0.11.145.16)
set(PHAROS_ROSE_MAXIMUM_VERSION)
find_package(Rose ${PHAROS_ROSE_MINIMUM_VERSION} REQUIRED)
if(PHAROS_ROSE_MAXIMUM_VERSION AND
ROSE_VERSION VERSION_GREATER_EQUAL PHAROS_ROSE_MAXIMUM_VERSION)
message(FATAL_ERROR
"This version of Pharos does not support versions of ROSE >= ${PHAROS_ROSE_MAXIMUM_VERSION}")
endif()
# Find git
find_package(Git REQUIRED)
# Global testing parameters
enable_testing()
add_subdirectory(tests)
set(PHAROS_TEST_OPS --no-site-file --no-user-file ${TESTCONFIG_SWITCH})
set(CTEST_TEST_TIMEOUT 300) # 5 minutes
# Add pod building
include(BuildPharosPod)
# Turn on or off the building of executables that are used as inputs to the testing process.
# Most of our tests run on pre-built executables that are comitted in the repository and do not
# require building. Having this variable be off will disable any tests that depend on the
# non-prebuilt test programs.
option(PHAROS_BUILD_TESTS "Builds optional test files" OFF)
mark_as_advanced(PHAROS_BUILD_TESTS)
if (PHAROS_BUILD_TESTS)
add_custom_target(built_tests ALL)
else()
add_custom_target(built_tests)
endif()
option(PHAROS_BROKEN_THREADS "Turns off multi-threding and mutexes" OFF)
if(PHAROS_BROKEN_THREADS)
add_definitions(-DPHAROS_BROKEN_THREADS)
endif()
# Add gtests
add_subdirectory(gtest)
option(PHAROS_FAIL_ON_WARNING "Cause compilation to fail if a warning is generated" OFF)
if(PHAROS_FAIL_ON_WARNING)
add_cxx_compiler_flags(-Werror)
endif()
# Add directories
add_subdirectory(libpharos)
add_subdirectory(tools)
add_subdirectory(share)
install(FILES README.md CONTRIBUTING.md LICENSE.md INSTALL.md DESTINATION share/doc/pharos
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)