-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
executable file
·85 lines (67 loc) · 2.05 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
85
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)
# Make sure CMake won't try to generate rules for moc (we will do it ourselves)
set(CMAKE_AUTOMOC OFF)
set(CMAKE_AUTOUIC 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
3DCore
3DExtras
3DRender
3DExtras
REQUIRED)
# Make sure CMake won't try to generate rules for moc (we will do it ourselves)
set(CMAKE_AUTOMOC OFF)
# 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")
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/)
# Examples
option(BUILD_EXAMPLES "Build example executables" ON)
if(BUILD_EXAMPLES)
add_subdirectory(examples/)
endif(BUILD_EXAMPLES)