Using option for CMake options

This commit is contained in:
Martchus 2016-07-10 00:22:20 +02:00
parent d94f4e7dd8
commit c66d1513f9
4 changed files with 19 additions and 11 deletions

View File

@ -14,6 +14,8 @@ if(${JS_PROVIDER} STREQUAL "auto")
set(JS_DEFINITION "-D${META_PROJECT_VARNAME_UPPER}_USE_JSENGINE")
message(STATUS "No JavaScript provider explicitly specified, defaulting to Qt QML.")
else()
set(JS_PROVIDER "")
set(JS_DEFINITION "-D${META_PROJECT_VARNAME_UPPER}_NO_JSENGINE")
message(STATUS "No JavaScript provider available, features requiring JavaScript have been disabled.")
endif()
endif()

View File

@ -62,11 +62,19 @@ if(DBUS_FILES)
qt5_add_dbus_interfaces(SRC_FILES ${DBUS_FILES})
endif()
# built-in translations
option(BUILTIN_TRANSLATIONS "enables/disables built-in translations" OFF)
# TODO
# built-in icons
option(BUILTIN_ICONS "enables/disables built-in icons" OFF)
# TODO
# enable moc, uic and rcc
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
if(WIDGETS_UI_FILES AND "${WIDGETS_GUI}" STREQUAL "yes")
if(WIDGETS_UI_FILES AND WIDGETS_GUI)
set(CMAKE_AUTOUIC ON)
if(INSTALL_UI_HEADER)
# also add installd for header files generated by uic

View File

@ -1,8 +1,8 @@
# after including this module, AppConfig must be included
# enable Qt Widgets GUI
set(WIDGETS_GUI "yes" CACHE STRING "enables/disables building the Qt Widgets GUI: yes (default) or no")
if(${WIDGETS_GUI} STREQUAL "yes")
option(WIDGETS_GUI "enables/disables building the Qt Widgets GUI: yes (default) or no" ON)
if(WIDGETS_GUI)
add_definitions(
-DGUI_QTWIDGETS
-DMODEL_UNDO_SUPPORT
@ -15,15 +15,13 @@ if(${WIDGETS_GUI} STREQUAL "yes")
else()
message(STATUS "Qt Widgets GUI is not available.")
endif()
elseif(${WIDGETS_GUI} STREQUAL "no")
message(STATUS "Building WITHOUT Qt Widgets GUI.")
else()
message(FATAL_ERROR "Specification whether to build with Qt Widgets GUI is invalid (must be either yes or no).")
message(STATUS "Building WITHOUT Qt Widgets GUI.")
endif()
# enable Qt Quick GUI
set(QUICK_GUI "yes" CACHE STRING "enables/disables building the Qt Quick GUI: yes (default) or no")
if(${QUICK_GUI} STREQUAL "yes")
option(QUICK_GUI "enables/disables building the Qt Quick GUI: yes (default) or no" ON)
if(QUICK_GUI)
add_definitions(
-DGUI_QTQUICK
)
@ -35,10 +33,8 @@ if(${QUICK_GUI} STREQUAL "yes")
else()
message(STATUS "Qt Quick GUI is not available.")
endif()
elseif(${QUICK_GUI} STREQUAL "no")
message(STATUS "Building WITHOUT Qt Quick GUI.")
else()
message(FATAL_ERROR "Specification whether to build with Qt Quick GUI is invalid (must be either yes or no).")
message(STATUS "Building WITHOUT Qt Quick GUI.")
endif()
# set "GUI-type" to WIN32 to hide console under windows

View File

@ -14,6 +14,8 @@ if(${WEBVIEW_PROVIDER} STREQUAL "auto")
set(WEBVIEW_DEFINITION "-D${META_PROJECT_VARNAME_UPPER}_USE_WEBENGINE")
message(STATUS "No web view provider explicitly specified, defaulting to Qt WebEngine.")
else()
set(WEBVIEW_PROVIDER "")
set(WEBVIEW_DEFINITION "-D${META_PROJECT_VARNAME_UPPER}_NO_WEBVIEW")
message(STATUS "No web view provider available, web view has been disabled.")
endif()
endif()