-
Notifications
You must be signed in to change notification settings - Fork 8
/
CMakeLists.txt
80 lines (62 loc) · 1.57 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#
# OSVR-Display is a library and set of utilities
# that can detect displays (monitors) and set their
# properties (e.g., resolution, orientation)
#
cmake_minimum_required(VERSION 3.1.0)
project(osvrDisplay)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(UseBackportedModules)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
#
# Detect available C++ language, library, and compiler features
#
include(WriteCompilerDetectionHeader)
write_compiler_detection_header(
FILE "${CMAKE_CURRENT_SOURCE_DIR}/osvr/Display/DisplayDefines.h"
PREFIX OSVR_DISPLAY
COMPILERS GNU Clang AppleClang MSVC
FEATURES cxx_override cxx_noexcept cxx_constexpr
)
include(EnableExtraCompilerWarnings)
globally_enable_extra_compiler_warnings()
#
# Options
#
option(OSVR_DISPLAY_BUILD_APPS "Build applications that use osvrDisplay." ON)
option(OSVR_DISPLAY_BUILD_TESTS "Build test programs and unit tests." ON)
#
# Dependencies
#
find_package(osvr REQUIRED)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR})
#
# Check Visual Studio version
#
set(HAVE_DOCOPT TRUE)
if(MSVC)
include(GetMSVCVersion)
get_msvc_major_version(_vs_major)
if("${_vs_major}" LESS "15")
set(HAVE_DOCOPT FALSE)
endif()
endif()
#
# Third-party libraries
#
add_subdirectory(vendor)
#
# Default installation directories
#
include(GNUInstallDirs)
add_subdirectory(osvr/Display)
if(OSVR_DISPLAY_BUILD_APPS)
add_subdirectory(apps)
endif()
include(CTest)
if(OSVR_DISPLAY_BUILD_TESTS)
add_subdirectory(test)
endif()