CMake build: Add ability to disable building of individual plugins

Adds a cache entry "BUILD_PLUGIN_${NAME}", defaulting to ON which
can be set to OFF to disable building of a plugin.

Adds a extend_qtc_plugin function that should be used to add
properties to a plugin after add_qtc_plugin, instead of the
standard CMake functions target_... . The new function results
in a no-op if the plugin was disabled.

Change-Id: I57f6799620aea0aaa8b56acead4815ccced95911
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Eike Ziller
2019-05-21 12:22:35 +02:00
parent 9645687e53
commit 6fb9bf453f
23 changed files with 663 additions and 545 deletions

View File

@@ -29,17 +29,22 @@ add_qtc_plugin(Help
xbelsupport.cpp xbelsupport.h
)
if (APPLE)
find_library(FWWebKit WebKit)
find_library(FWAppKit AppKit)
target_link_libraries(Help PRIVATE ${FWWebKit} ${FWAppKit})
target_compile_definitions(Help PRIVATE QTC_MAC_NATIVE_HELPVIEWER)
target_sources(Help PRIVATE macwebkithelpviewer.h macwebkithelpviewer.mm)
endif()
find_library(FWWebKit WebKit)
find_library(FWAppKit AppKit)
extend_qtc_plugin(Help
CONDITION APPLE AND FWWebKit AND FWAppKit
DEPENDS ${FWWebKit} ${FWAppKit}
DEFINES QTC_MAC_NATIVE_HELPVIEWER
SOURCES
macwebkithelpviewer.h
macwebkithelpviewer.mm
)
find_package(Qt5WebEngineWidgets QUIET)
if (TARGET Qt5::WebEngineWidgets)
target_sources(Help PRIVATE webenginehelpviewer.cpp webenginehelpviewer.h)
target_link_libraries(Help PRIVATE Qt5::WebEngineWidgets)
endif()
extend_qtc_plugin(Help
CONDITION TARGET Qt5::WebEngineWidgets
DEPENDS Qt5::WebEngineWidgets
SOURCES
webenginehelpviewer.cpp
webenginehelpviewer.h
)