-
-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathCMakeLists.txt
58 lines (49 loc) · 1.99 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
cmake_minimum_required(VERSION 3.8)
project(inotify-cpp)
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
option(BUILD_EXAMPLE "Build inotify-cpp example program" ON)
option(BUILD_TEST "Build inotify-cpp unittest program" ON)
option(BUILD_SHARED_LIBS "Build inotify-cpp as a shared library" ON)
option(BUILD_STATIC_LIBS "Build inotify-cpp as a static library" OFF)
option(USE_BOOST_FILESYSTEM "Build with boost::filesystem" OFF)
if(USE_BOOST_FILESYSTEM)
list(APPEND USED_BOOST_LIBS filesystem)
endif()
if(BUILD_TEST)
list(APPEND USED_BOOST_LIBS unit_test_framework)
endif()
find_package(Boost 1.54.0 COMPONENTS ${USED_BOOST_LIBS} REQUIRED)
add_library(inotify-filesystem-adapter INTERFACE)
if(CMAKE_CXX_STANDARD LESS 17 OR USE_BOOST_FILESYSTEM)
add_definitions(-DUSE_BOOST_FILESYSTEM)
target_link_libraries(inotify-filesystem-adapter INTERFACE Boost::filesystem)
else()
target_link_libraries(inotify-filesystem-adapter INTERFACE stdc++fs)
endif()
add_subdirectory(src)
if(BUILD_EXAMPLE)
add_subdirectory(example)
endif()
if(BUILD_TEST)
enable_testing()
add_subdirectory(test)
endif()
message(STATUS "")
message(STATUS "")
message(STATUS "${PROJECT_NAME} configuration summary:")
message(STATUS "")
message(STATUS " CMake build type ................ : ${CMAKE_BUILD_TYPE}")
message(STATUS " Build shared libs .............. : ${BUILD_SHARED_LIBS}")
message(STATUS " Build static libs .............. : ${BUILD_STATIC_LIBS}")
message(STATUS " Build example .................. : ${BUILD_EXAMPLE}")
message(STATUS " Build test ...................... : ${BUILD_TEST}")
message(STATUS " Build c++ standard .............. : ${CMAKE_CXX_STANDARD}")
message(STATUS " Build with boost::filesystem .... : ${USE_BOOST_FILESYSTEM}")
message(STATUS "")
message(STATUS " Dependencies:")
message(STATUS " Boost version.................... : ${Boost_VERSION}")
message(STATUS " Boost root....................... : ${Boost_DIR}")
message(STATUS "")