-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
213 lines (155 loc) · 7.22 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
cmake_minimum_required(VERSION 3.20)
## USER_SECTION_START 1
## USER_SECTION_END
## INFO
## Template version: 1.4.3
##
## This is a template for a CMake project.
## It is designed to be used with the Visual Studio
## IDE and the Qt framework.
##
## ********************************************************************************
## !!! IMPORTANT !!!
## CMAKE SETTINGS WITH THE MARK "<AUTO_REPLACED>" ARE AUTOMATICLY REPLACED
## BY THE LIBRARY MANAGER. DO NOT CHANGE NAMES OF SUCH PARAMETERS IF YOU USE
## THE LIBRARY MANAGER.
##
##
## ********************************************************************************
##
## You can add your own settings in between the USER SECTION START and USER SECTION END markers.
## Do not add more USER SECTION START or USER SECTION END markers.
## Code outside of the USER SECTION START and USER SECTION END markers will be overwritten by the library manager.
##
## --------------------------------------------------------------------------------
## -------------------- Project settings ------------------------------------------
## --------------------------------------------------------------------------------
include(cmake/utility.cmake)
# Name of the library
set(LIBRARY_NAME QSFML_EditorWidget) # <AUTO_REPLACED>
# Define is only active if the library is built
set(LIB_DEFINE QSFML_EDITOR_WIDGET_LIB) # <AUTO_REPLACED>
# macro to enable profiling
set(LIB_PROFILE_DEFINE QSFML_PROFILING) # <LIB_PROFILE_DEFINE>
# Enable/disable QT modules
set(QT_ENABLE ON) # <AUTO_REPLACED>
# Enable/disable QT deployment
set_if_not_defined(QT_DEPLOY ON) # <AUTO_REPLACED>
# Needed QT modules # <AUTO_REPLACED>
set(QT_MODULES
Core
Widgets
)
# Library file name settings
set(DEBUG_POSTFIX_STR "-d") # <AUTO_REPLACED>
set(STATIC_POSTFIX_STR "-s") # <AUTO_REPLACED>
set(PROFILING_POSTFIX_STR "-p") # <AUTO_REPLACED>
# Langauge settings
set(CMAKE_CXX_STANDARD 17) # <AUTO_REPLACED>
set(CMAKE_CXX_STANDARD_REQUIRED ON) # <AUTO_REPLACED>
## USER_SECTION_START 2
set_if_not_defined(CMAKE_CXX_COMPILER "g++")
set_if_not_defined(CMAKE_C_COMPILER "gcc")
## USER_SECTION_END
# --------------------------------------------------------------------------------
# -------------------- Build settings --------------------------------------------
# --------------------------------------------------------------------------------
set_if_not_defined(INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/installation) # Default install path
set_if_not_defined(RELATIVE_BUILD_FOLDER build) # Relative path to the build folder
set_if_not_defined(RELATIVE_INSTALL_LIB_FOLDER lib) # Relative path to the install folder
set_if_not_defined(RELATIVE_INSTALL_BIN_FOLDER bin) # Relative path to the install binary folder
set_if_not_defined(RELATIVE_INSTALL_INCLUDE_FOLDER include) # Relative path to the install include folder
set_if_not_defined(COMPILE_EXAMPLES ON) # <AUTO_REPLACED>
set_if_not_defined(COMPILE_UNITTESTS ON) # <AUTO_REPLACED>
# User specific defines which are added as defines to the compiler
# Note: The defines are only available inside the library.
# Do not use them in headers which are visible by the user of the library.
# Example:
# list(APPEND USER_SPECIFIC_DEFINES
# TEST_DEFINE
# )
#
list(APPEND USER_SPECIFIC_DEFINES)
# User specific defines which are added as defines to the compiler
# Note: The defines are available for all dependencies and the library.
# Example:
# list(APPEND USER_SPECIFIC_GLOBAL_DEFINES
# TEST_DEFINE
# )
#
list(APPEND USER_SPECIFIC_GLOBAL_DEFINES
LOGGER_ENABLE_DEBUG_BREAK_ON_ERROR
)
## USER_SECTION_START 3
## USER_SECTION_END
# --------------------------------------------------------------------------------
# -------------------- Dependencies ----------------------------------------------
# --------------------------------------------------------------------------------
## USER_SECTION_START 8
## USER_SECTION_END
set_if_not_defined(QT_INSTALL_BASE "C:\\Qt")
set_if_not_defined(QT_MAJOR_VERSION 5)
set_if_not_defined(QT_VERSION "autoFind")
set_if_not_defined(QT_COMPILER "autoFind")
## USER_SECTION_START 7
## USER_SECTION_END
# --------------------------------------------------------------------------------
# --------------------------------------------------------------------------------
# --------------------------------------------------------------------------------
project(${LIBRARY_NAME})
## USER_SECTION_START 9
## USER_SECTION_END
# Set output paths
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(CMAKE_INSTALL_PREFIX ${INSTALL_PREFIX} CACHE PATH "Installation base folder" FORCE)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/${RELATIVE_BUILD_FOLDER}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/${RELATIVE_BUILD_FOLDER}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/${RELATIVE_BUILD_FOLDER}")
set(INSTALL_LIB_PATH "${CMAKE_INSTALL_PREFIX}/${RELATIVE_INSTALL_LIB_FOLDER}")
set(INSTALL_BIN_PATH "${CMAKE_INSTALL_PREFIX}/${RELATIVE_INSTALL_BIN_FOLDER}")
set(INSTALL_INCLUDE_PATH "${CMAKE_INSTALL_PREFIX}/${RELATIVE_INSTALL_INCLUDE_FOLDER}")
set(FETCHCONTENT_BASE_DIR "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/dependencies/cache" CACHE PATH "Base directory for FetchContent" FORCE)
# Print output paths
message(STATUS "CMAKE_ARCHIVE_OUTPUT_DIRECTORY: ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}")
message(STATUS "CMAKE_LIBRARY_OUTPUT_DIRECTORY: ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
message(STATUS "CMAKE_RUNTIME_OUTPUT_DIRECTORY: ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
message(STATUS "INSTALL_LIB_PATH: ${INSTALL_LIB_PATH}")
message(STATUS "INSTALL_BIN_PATH: ${INSTALL_BIN_PATH}")
message(STATUS "INSTALL_INCLUDE_PATH: ${INSTALL_INCLUDE_PATH}")
message(STATUS "FETCHCONTENT_BASE_DIR: ${FETCHCONTENT_BASE_DIR}")
else()
# message(STATUS "This is an included CMakeLists.txt")
endif()
## USER_SECTION_START 10
## USER_SECTION_END
link_directories(${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
## USER_SECTION_START 4
## USER_SECTION_END
foreach(DEF ${USER_SPECIFIC_GLOBAL_DEFINES})
add_compile_definitions(${DEF})
endforeach()
## USER_SECTION_START 11
## USER_SECTION_END
include(cmake/QtLocator.cmake)
include(cmake/dependencies.cmake)
include(cmake/ExampleMaster.cmake)
## USER_SECTION_START 12
## USER_SECTION_END
# foreach(DEF ${DEPENDENCY_NAME_MACRO})
# add_compile_definitions(${DEF})
# endforeach()
## USER_SECTION_START 5
## USER_SECTION_END
add_subdirectory(core)
if(COMPILE_EXAMPLES AND NOT QSFML_EditorWidget_NO_EXAMPLES)
message("Include examples for ${LIBRARY_NAME}")
add_subdirectory(examples)
endif()
## USER_SECTION_START 13
## USER_SECTION_END
if(COMPILE_UNITTESTS AND NOT QSFML_EditorWidget_NO_UNITTESTS)
message("Include unittests for ${LIBRARY_NAME}")
add_subdirectory(unitTests)
endif()
## USER_SECTION_START 6
## USER_SECTION_END