-
Notifications
You must be signed in to change notification settings - Fork 18
/
CMakeLists.txt
55 lines (42 loc) · 1.55 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
cmake_minimum_required(VERSION 3.22)
# -------- Project --------
project(directshow_camera LANGUAGES CXX VERSION 2.0.0)
# -------- Setting --------
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# C++20
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++latest")
# Path
set(DIRECTSHOW_CAMERA_PROJECT_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})
Set(DIRECTSHOW_CAMERA_PROJECT_SOURCES_PATH "${DIRECTSHOW_CAMERA_PROJECT_ROOT_PATH}/src/directshow_camera")
# Add cmake module
list(APPEND CMAKE_MODULE_PATH "${DIRECTSHOW_CAMERA_PROJECT_ROOT_PATH}/cmake")
# Initialize variables
include(CMakeUtils)
init_variables()
# -------- Dependencies --------
# 1. Window SDK, See cmake/AddWin10SDK.cmake
include(AddWin10SDK)
add_window10_sdk()
# 2. OpenCV, See cmake/InstallOpenCV.cmake
include(InstallOpenCV)
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
# Only install OpenCV when this project is built as the main project
install_opencv()
endif()
check_opencv()
# -------- Source --------
add_subdirectory("${DIRECTSHOW_CAMERA_PROJECT_SOURCES_PATH}/src")
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
# Only build examples and test when this project is built as the main project
# -------- Example --------
add_subdirectory("${DIRECTSHOW_CAMERA_PROJECT_SOURCES_PATH}/examples")
# -------- Test --------
include(CTest)
if(BUILD_TESTING)
enable_testing()
add_subdirectory("${DIRECTSHOW_CAMERA_PROJECT_SOURCES_PATH}/test")
endif()
endif()