-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
executable file
·84 lines (67 loc) · 1.93 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
80
81
82
83
84
cmake_minimum_required(VERSION 3.15)
project(mildred)
set(DESCRIPTION "Mildred - graphing / plotting leveraging Qt3D")
set(AUTHOR "T. Youngs")
set(VERSION_MAJOR "0")
set(VERSION_MINOR "1")
set(VERSION_PATCH "0")
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Set policy for automatic linkage of Qt libs to project
cmake_policy(SET CMP0020 NEW)
# Request C++17 Standard Support (Required for std::optional and auto types in
# lambda parameters)
set(CMAKE_CXX_STANDARD 17)
if(APPLE)
set(CMAKE_PREFIX_PATH "${QT_BASE_DIR}")
endif(APPLE)
find_package(OpenGL REQUIRED)
find_package(
Qt6
COMPONENTS Core
Gui
Widgets
Qml
Quick3D
3DCore
3DExtras
3DRender
3DExtras
REQUIRED)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
# Set policy for automatic linkage of Qt libs to project
cmake_policy(SET CMP0020 NEW)
# Perform platform-specific setup #
# -- Windows
if(WIN32)
# Add defines for Windows systems - NOMINMAX to prevent conflicts with
# std::min() and std::max()
add_definitions(-DNOMINMAX)
add_definitions(/Zc:__cplusplus)
endif(WIN32)
# -- Unix
if(UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Werror -Wall -Wextra")
endif(UNIX)
# -- OSX
if(APPLE)
# Set some specific C++11 related options here (set_property below does not
# seem to persist)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
set(CMAKE_OSX_ARCHITECTURES "x86_64")
add_definitions(-D_MAC)
endif(APPLE)
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR})
# Add main library subdir
add_subdirectory(src/)
option(BUILD_TESTS "Build test suite" OFF)
if(BUILD_TESTS)
enable_testing()
add_subdirectory(tests/)
endif(BUILD_TESTS)