-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
99 lines (81 loc) · 2.61 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
#
# This file is part of Escain Documentor tool
#
# Escain Documentor is free software: you can redistribute it and/or modify
# it under ther terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Escain Documentor is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Escain Documentor. If not, see <https://www.gnu.org/licenses/>.
#
# Author: Adrian Maire escain (at) gmail.com
#
cmake_minimum_required(VERSION 3.13)
cmake_policy( SET CMP0076 NEW )
project("EscainDocumentor")
macro( "SetupQtForProject" )
set( CMAKE_AUTOMOC ON)
set( CMAKE_AUTORCC ON)
set( CMAKE_AUTOUIC ON)
set( CMAKE_INCLUDE_CURRENT_DIR ON)
set( QT_USE_QMAIN TRUE) #Avoid console, need WIN32 in the add_executable on Windows
find_package(Qt5Widgets REQUIRED)
add_definitions(${Qt5Widgets_DEFINITIONS})
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
include_directories(${Qt5Widgets_INCLUDE_DIRS})
find_package(Qt5Xml REQUIRED)
find_package(Qt5WebEngineWidgets REQUIRED)
find_package(Qt5XmlPatterns REQUIRED)
endmacro()
function( "SetWarningLevel" TARGET)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
target_compile_options( ${TARGET} PRIVATE -Wall -pedantic)
endif()
if(CMAKE_BUILD_TOOL MATCHES "(msdev|devenv|nmake)")
target_compile_options( ${TARGET} PRIVATE /W2)
endif()
endfunction()
SetupQtForProject() #Before add_executable
set(TARGET "EscainDocumentor")
add_executable(${TARGET})
target_compile_features( ${TARGET} PUBLIC cxx_std_17)
SetWarningLevel(${TARGET})
# Add UIS
qt5_wrap_ui( UI_HEADERS "src/center.ui" )
qt5_add_resources( UI_RESOURCES "src/resources.qrc" )
#Build this project
set ( SOURCES
src/main.cpp
src/documentor.cpp
src/escain_web_engine.cpp
src/file_manager.cpp
src/setup_documentor.cpp
src/center.ui
src/resources.qrc
${UI_RESOURCES}
)
set ( HEADERS
src/documentor.hpp
src/escain_web_engine.hpp
src/file_manager.hpp
${UI_HEADERS}
)
set ( LIBS
Qt5::Widgets
Qt5::Xml
Qt5::WebEngineWidgets
Qt5::XmlPatterns
)
# Project name
target_sources( ${TARGET} PRIVATE ${SOURCES} PUBLIC ${HEADERS})
target_link_libraries(${TARGET} ${LIBS})
if(APPLE)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14" CACHE STRING "Minimum OS X deployment version")
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES MACOSX_BUNDLE TRUE)
endif()