forked from yhirose/cpp-peglib
-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
40 lines (30 loc) · 955 Bytes
/
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
cmake_minimum_required(VERSION 3.14)
project(peglib)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS OFF)
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:__cplusplus /utf-8 /D_CRT_SECURE_NO_DEPRECATE")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
endif()
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(add_link_deps Threads::Threads)
endif()
add_library(peglib INTERFACE)
target_include_directories(peglib INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
option(BUILD_TESTS "Build cpp-peglib tests" ON)
option(PEGLIB_BUILD_LINT "Build cpp-peglib lint utility" OFF)
option(PEGLIB_BUILD_EXAMPLES "Build cpp-peglib examples" OFF)
if (${BUILD_TESTS})
add_subdirectory(test)
enable_testing()
endif()
if (${PEGLIB_BUILD_LINT})
add_subdirectory(lint)
endif()
if (${PEGLIB_BUILD_EXAMPLES})
add_subdirectory(example)
endif()
install(FILES peglib.h DESTINATION include)