-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
56 lines (41 loc) · 1.65 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
cmake_minimum_required(VERSION 3.11)
project(ScopeGuard VERSION 0.3.13)
message(STATUS "~~~ ${PROJECT_NAME} v${PROJECT_VERSION} ~~~")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
option(SCOPEGUARD_UNITTEST "Build Unit Tests" ON)
option(SCOPEGUARD_ENABLE_COMPAT_HEADER "Enable compatible header 'scope'" OFF)
message(STATUS "Build Type : ${CMAKE_BUILD_TYPE}")
message(STATUS "Unit Tests : ${SCOPEGUARD_UNITTEST}")
message(STATUS "Compatible Header : ${SCOPEGUARD_ENABLE_COMPAT_HEADER}")
add_compile_options(-Wall
-Wextra
-pedantic
-pedantic-errors
-Werror
-Wshadow
-Wold-style-cast
-Wnull-dereference
-Wnon-virtual-dtor
-Woverloaded-virtual
)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
include(GNUInstallDirs)
add_library(ScopeGuard INTERFACE)
target_include_directories(ScopeGuard INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
if( SCOPEGUARD_ENABLE_COMPAT_HEADER )
configure_file(cmake/scope.in generated/scope COPYONLY)
target_include_directories(ScopeGuard INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/generated>
$<INSTALL_INTERFACE:include>
)
endif()
if( SCOPEGUARD_UNITTEST )
enable_testing()
add_subdirectory("test")
endif()
include(Install)