forked from simulton/QSchematic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
75 lines (65 loc) · 2.88 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
cmake_minimum_required(VERSION 3.23)
# Project
project(
qschematic
VERSION 1.6.0
LANGUAGES CXX
HOMEPAGE_URL https://github.com/simulton/qschematic
)
# User options
set(OPTION_BUILD_SHARED_DEFAULT ON)
if (MSVC)
set(OPTION_BUILD_SHARED_DEFAULT OFF)
endif()
option(QSCHEMATIC_BUILD_STATIC "Whether to build a static library" ON)
option(QSCHEMATIC_BUILD_SHARED "Whether to build a shared library" ${OPTION_BUILD_SHARED_DEFAULT})
option(QSCHEMATIC_BUILD_DEMO "Whether to build the demo project" ON)
option(QSCHEMATIC_DEPENDENCY_GPDS_DOWNLOAD "Whether to pull the GPDS dependency via FetchContent" ON)
# User settings
set(QSCHEMATIC_DEPENDENCY_GPDS_TARGET "gpds::gpds-static" CACHE STRING "The CMake target of the GPDS library to use")
set(CMAKE_DEBUG_POSTFIX d)
# When using MSVC, only allow enabling either static or shared libs but not both to prevent name conflicts on the resulting *.LIB targets
if (MSVC)
if (QSCHEMATIC_BUILD_STATIC AND QSCHEMATIC_BUILD_SHARED)
message(FATAL_ERROR "QSchematic: Can only build either the static or the shared library but not both at the same time when using MSVC.")
endif()
endif()
# Library target for internal usage (i.e. for demos, examples, tests, ...)
set(QSCHEMATIC_TARGET_INTERNAL qschematic-static)
if (NOT QSCHEMATIC_BUILD_STATIC)
set(QSCHEMATIC_TARGET_INTERNAL qschematic-shared)
endif()
# Project requirements
set(QSCHEMATIC_DEPENDENCY_GPDS_MINIMUM_VERSION "1.8.4")
set(QSCHEMATIC_DEPENDENCY_GPDS_DOWNLOAD_VERSION "1.8.4")
# Include the library
add_subdirectory(qschematic)
# Include the example(s)
if (QSCHEMATIC_BUILD_DEMO)
add_subdirectory(demo)
endif()
# Print options
message(STATUS "")
message(STATUS "-------------------------")
message(STATUS "QSchematic configuration:")
message(STATUS " version : " ${PROJECT_VERSION})
message(STATUS "")
message(STATUS " Build")
message(STATUS " Static : " ${QSCHEMATIC_BUILD_STATIC})
message(STATUS " Shared : " ${QSCHEMATIC_BUILD_SHARED})
message(STATUS " Demo : " ${QSCHEMATIC_BUILD_DEMO})
message(STATUS "")
message(STATUS " Dependencies")
message(STATUS " GPDS")
message(STATUS " Download : " ${QSCHEMATIC_DEPENDENCY_GPDS_DOWNLOAD})
message(STATUS " Target : " ${QSCHEMATIC_DEPENDENCY_GPDS_TARGET})
message(STATUS "-------------------------")
message(STATUS "")
################################################################################
# CPack #
################################################################################
set(CPACK_PACKAGE_VENDOR "Simulton GmbH")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A library for diagrams such as flowcharts or even proper engineering schematics within a Qt application.")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/license.txt")
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/readme.md")
include(CPack)