forked from qt-creator/qt-creator
Qt Creator Plugin Wizard: Add custom target to run Qt Creator
This commit will add the CMake boilerplate code that will just allow the resulted plugin project to "Run". A custom CMake target named "RunQtCreator" will be created. The Qt Creator executable referenced by the Qt Creator "Devel" package will be used as command whth the '-pluginpath' of the newely created plugin. Change-Id: I503a2bc5004ab2c890032e0af0cb1f4bbfcd4326 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -55,3 +55,21 @@ add_qtc_plugin(%{PluginName}
|
||||
%{ConstantsHdrFileName}
|
||||
%{TrHdrFileName}
|
||||
)
|
||||
|
||||
# Enable the Run button in Qt Creator
|
||||
get_target_property(QtCreatorCorePath QtCreator::Core LOCATION)
|
||||
find_program(QtCreatorExecutable
|
||||
NAMES
|
||||
qtcreator "Qt Creator"
|
||||
PATHS
|
||||
"${QtCreatorCorePath}/../../../bin"
|
||||
"${QtCreatorCorePath}/../../../MacOS"
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
if (QtCreatorExecutable)
|
||||
add_custom_target(RunQtCreator
|
||||
COMMAND ${QtCreatorExecutable} -pluginpath $<TARGET_FILE_DIR:%{PluginName}>
|
||||
DEPENDS %{PluginName}
|
||||
)
|
||||
set_target_properties(RunQtCreator PROPERTIES FOLDER "qtc_runnable")
|
||||
endif()
|
||||
|
@@ -14,7 +14,12 @@ relative or absolute path to this plugin directory.
|
||||
|
||||
## How to Run
|
||||
|
||||
Run a compatible Qt Creator with the additional command line argument
|
||||
From the command line run
|
||||
|
||||
cmake --build . --target RunQtCreator
|
||||
|
||||
`RunQtCreator` is a custom CMake target that will use the <path to qtcreator> referenced above to
|
||||
start the Qt Creator executable with the following parameters
|
||||
|
||||
-pluginpath <path_to_plugin>
|
||||
|
||||
@@ -24,13 +29,3 @@ where `<path_to_plugin>` is the path to the resulting plugin library in the buil
|
||||
|
||||
You might want to add `-temporarycleansettings` (or `-tcs`) to ensure that the opened Qt Creator
|
||||
instance cannot mess with your user-global Qt Creator settings.
|
||||
|
||||
When building and running the plugin from Qt Creator, you can use
|
||||
|
||||
-pluginpath "%{buildDir}/lib/qtcreator/plugins" -tcs
|
||||
|
||||
on Windows and Linux, or
|
||||
|
||||
-pluginpath "%{buildDir}/Qt Creator.app/Contents/PlugIns" -tcs
|
||||
|
||||
for the `Command line arguments` field in the run settings.
|
||||
|
Reference in New Issue
Block a user