-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
45 lines (36 loc) · 1.08 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
cmake_minimum_required(VERSION 3.10)
project(MY_ENUM VERSION 1.0
DESCRIPTION "Small c++ macro library to add compile-time introspection to c++ enum classes."
LANGUAGES CXX)
option(USE_FMT_STRING_VIEW "Use string_view from fmt library" OFF)
if(USE_FMT_STRING_VIEW)
set (CMAKE_CXX_STANDARD 14)
find_package(fmt 5.2 REQUIRED)
set (STRING_VIEW_LIB fmt::fmt)
else()
set (CMAKE_CXX_STANDARD 17)
add_definitions(-DMY_ENUM_USE_STD_STRING_VIEW)
set (STRING_VIEW_LIB)
endif()
add_library(MyEnum INTERFACE)
# needed for boost preprocessor only
find_package(Boost 1.62 REQUIRED)
set(MY_ENUM_HEADER_FILES
../Enum.h
../EnumO.h
../impl/EnumDetails.h
../EnumFlags.h
../EnumFlagsO.h
../impl/EnumFlagsDetails.h
../impl/CompilerAttributes.h
../impl/StringView.h)
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
include(CTest)
endif()
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
add_subdirectory(tests)
endif()
option(BUILD_EXAMPLES "Build examples." ON)
if(BUILD_EXAMPLES)
add_subdirectory(examples)
endif()