-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
62 lines (51 loc) · 2.27 KB
/
CMakeLists.txt
File metadata and controls
62 lines (51 loc) · 2.27 KB
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
# To disable building of tests, please set the cache variable BUILD_TESTS to
# 0 from the cmake configuration command-line. The default is to BUILD_TESTS.
cmake_minimum_required (VERSION 3.14)
project (imageSource LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(THREADS_PREFER_PTHREAD_FLAG ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# Creates file "compile_commands.json" in the build directory. It is useful
# for integrating with external tools such as "clangd". Some IDEs, like
# VSCode, also use information contained in this file to resolve pre-processor
# includes and provide better code completion suggestions.
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if (NOT DEFINED ENV{KARABO} OR NOT EXISTS $ENV{KARABO})
# KARABO env var not defined or invalid - try to infer the directory of a
# Karabo installation.
include("${CMAKE_SOURCE_DIR}/cmake/infer_karabo_env.cmake")
inferKaraboEnv()
if (DEFINED ENV{KARABO} AND EXISTS $ENV{KARABO})
message(STATUS "Karabo installation found at '${KARABO_INST}'.")
message(STATUS "It will be used during the CMake configuration phase.")
else()
message(
FATAL_ERROR
"KARABO environment variable not set and no Karabo installation found."
)
endif()
endif()
# Creates an IMPORTED target for the Karabo Framework Library and stores the
# target name in the variable KARABO_LIB_TARGET_NAME to be used downstream.
if(EXISTS "$ENV{KARABO}/lib/cmake/import_karabo_lib_target.cmake")
# The Karabo installation the device is being built against is CMake-based.
include($ENV{KARABO}/lib/cmake/import_karabo_lib.cmake)
importKaraboLibTarget()
else()
# The Karabo installation the device is being built against is
# Netbeans-based.
include(cmake/import_karabo_lib_legacy.cmake)
importKaraboLibLegacy()
endif()
if(NOT DEFINED KARABO_LIB_TARGET_NAME)
message(FATAL_ERROR
"Failed to import Karabo Lib target - cannot proceed."
)
endif()
# Builds tests if BUILD_TESTS is true (the default).
# The setting below is overridden by any previously set value (e.g. defined by
# the user in the command line).
set(BUILD_TESTS OFF CACHE BOOL "Should build unit tests?")
add_subdirectory (src ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME})