Improve CMake modules

This commit is contained in:
Martchus 2017-02-11 02:31:43 +01:00
parent 8f2e3f0476
commit 26b8f069c6
5 changed files with 33 additions and 3 deletions

View File

@ -1,5 +1,9 @@
# determines the JavaScript provider (either Qt Script or Qt Declarative)
if(TARGET_CONFIG_DONE)
message(FATAL_ERROR "Can not include JsProviderConfig module when targets are already configured.")
endif()
include(QtLinkage)
set(JS_PROVIDER "auto" CACHE STRING "specifies the JavaScript provider: auto (default), qml, script or none")

View File

@ -2,7 +2,17 @@ cmake_minimum_required(VERSION 3.3.0 FATAL_ERROR)
# applies Qt specific configuration
# for GUI applications, QtGuiAppConfig must be included before
# after including this module, AppTarget must be included
# this module must be included before AppTarget/LibraryTarget
if(NOT BASIC_PROJECT_CONFIG_DONE)
message(FATAL_ERROR "Before including the QtConfig module, the BasicConfig module must be included.")
endif()
if(QT_CONFIGURED)
message(FATAL_ERROR "The QtConfig module can not be included when Qt usage has already been configured.")
endif()
if(TARGET_CONFIG_DONE)
message(FATAL_ERROR "Can not include QtConfig module when targets are already configured.")
endif()
# add the Core module as it is always required
# also add additional Qt/KF modules which must have been specified before if required
@ -300,3 +310,5 @@ if(WIDGETS_UI_FILES AND WIDGETS_GUI)
endforeach()
endif()
endif()
set(QT_CONFIGURED YES)

View File

@ -1,6 +1,16 @@
cmake_minimum_required(VERSION 3.3.0 FATAL_ERROR)
# after including this module, AppConfig must be included
if(NOT BASIC_PROJECT_CONFIG_DONE)
message(FATAL_ERROR "Before including the QtConfig module, the BasicConfig module must be included.")
endif()
if(QT_CONFIGURED)
message(FATAL_ERROR "The QtConfig module can not be included when Qt usage has already been configured.")
endif()
if(TARGET_CONFIG_DONE)
message(FATAL_ERROR "Can not include QtGuiConfig module when targets are already configured.")
endif()
# this module must be included before QtConfig and AppTarget/LibraryTarget
# enable Qt Widgets GUI
if(WIDGETS_GUI)

View File

@ -3,7 +3,6 @@ cmake_minimum_required(VERSION 3.3.0 FATAL_ERROR)
# determines the Qt linkage
if(NOT DEFINED QT_LINKAGE_DETERMINED)
set(QT_LINKAGE_DETERMINED true)
include(3rdParty)
# by default, require Qt 5.6 or higher
@ -99,4 +98,5 @@ if(NOT DEFINED QT_LINKAGE_DETERMINED)
message(STATUS "Linking ${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX} against static Qt 5 plugin ${QT5_${MODULE}_STATIC_PREFIX}Q${PLUGIN}Plugin")
endmacro()
set(QT_LINKAGE_DETERMINED YES)
endif(NOT DEFINED QT_LINKAGE_DETERMINED)

View File

@ -1,5 +1,9 @@
# determines the web view provider (either Qt WebKit or Qt WebEngine)
if(TARGET_CONFIG_DONE)
message(FATAL_ERROR "Can not include WebViewProviderConfig module when targets are already configured.")
endif()
include(QtLinkage)
set(WEBVIEW_PROVIDER "auto" CACHE STRING "specifies the web view provider: auto (default), webkit, webengine or none")