forked from GrammaTech/libehp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
54 lines (44 loc) · 1.44 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 Configuration
#
# Need 3.9 to support CXX_STANDARD=17
CMAKE_MINIMUM_REQUIRED(VERSION 3.9.0)
PROJECT(ehp)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
option(USE_ELFIO "Use the elfio library to parse elf files" OFF)
if(USE_ELFIO)
add_definitions(-DUSE_ELFIO=1)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/third-party/elfio-code/)
else()
add_definitions(-DUSE_ELFIO=0)
endif()
# Use C++17
set(CMAKE_CXX_STANDARD 17)
# Error if it's not available
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Base include path for ehp
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
if (${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC)
add_compile_options(/WX)
else()
add_compile_options(-Werror)
endif()
add_compile_options(-fPIC)
add_subdirectory(src)
# ---------------------------------------------------------------------------
# Export config for use by other CMake projects
# ---------------------------------------------------------------------------
export(TARGETS ehp FILE "${CMAKE_CURRENT_BINARY_DIR}/ehpTargets.cmake")
file(
WRITE "${CMAKE_CURRENT_BINARY_DIR}/ehpConfig.cmake"
"
include(\"\$\{CMAKE_CURRENT_LIST_DIR\}/ehpTargets.cmake\")
set_property(
TARGET ehp
APPEND PROPERTY
INTERFACE_INCLUDE_DIRECTORIES \"${CMAKE_BINARY_DIR}/include\"
)
"
)
export(PACKAGE ehp)