-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
68 lines (55 loc) · 2.17 KB
/
CMakeLists.txt
File metadata and controls
68 lines (55 loc) · 2.17 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
63
64
65
66
67
68
# ------------------------------------------------------------------------------
# Part of the MQSS Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# ------------------------------------------------------------------------------
# set required cmake version
cmake_minimum_required(VERSION 3.19...3.30)
project(
qinfo
LANGUAGES C
VERSION 0.2.0
DESCRIPTION "QInfo Library")
# make scripts available to cmake
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
# check if this is the master project or used via add_subdirectory
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
set(QINFO_MASTER_PROJECT ON)
else()
set(QINFO_MASTER_PROJECT OFF)
endif()
option(QINFO_INSTALL "Generate installation instructions for QInfo"
${QINFO_MASTER_PROJECT})
option(BUILD_QINFO_TESTS "Also build tests for the QInfo project"
${QINFO_MASTER_PROJECT})
# enable organization of targets into folders
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Set a default build type if none was specified
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to 'Release' as none was specified.")
set(CMAKE_BUILD_TYPE
Release
CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui, ccmake
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
"MinSizeRel" "RelWithDebInfo")
endif()
# Generate compile_commands.json to make it easier to work with clang-based
# tools
set(CMAKE_EXPORT_COMPILE_COMMANDS
ON
CACHE BOOL "Export compile commands" FORCE)
# Require C standard
set_property(GLOBAL PROPERTY CMAKE_C_STANDARD_REQUIRED ON)
set_property(GLOBAL PROPERTY C_EXTENSIONS OFF)
include(cmake/ExternalDependencies.cmake)
# set the include directory for the build tree
set(QINFO_INCLUDE_BUILD_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/qinfo")
# add main library code
add_subdirectory(src)
# add test code
if(BUILD_QINFO_TESTS)
enable_testing()
include(GoogleTest)
add_subdirectory(test)
endif()