diff options
author | Brad King <brad.king@kitware.com> | 2017-10-10 17:53:34 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-10-10 17:53:34 (GMT) |
commit | 0a5987fa599071acd7f98bba4c0ab42289040ef0 (patch) | |
tree | 7943976b1b14219bdaca41f3a5ed09e6c524a453 | |
parent | 25b16ba3dc07f7ebd53808b20819da128b9106cc (diff) | |
parent | e95429fd856903d3d0302be39607175457499e9d (diff) | |
download | CMake-0a5987fa599071acd7f98bba4c0ab42289040ef0.zip CMake-0a5987fa599071acd7f98bba4c0ab42289040ef0.tar.gz CMake-0a5987fa599071acd7f98bba4c0ab42289040ef0.tar.bz2 |
Merge branch 'autogen-skip-ui' into release-3.10
Merge-request: !1366
-rw-r--r-- | Help/prop_sf/AUTORCC_OPTIONS.rst | 13 | ||||
-rw-r--r-- | Help/prop_sf/AUTOUIC_OPTIONS.rst | 19 | ||||
-rw-r--r-- | Help/prop_sf/SKIP_AUTOUIC.rst | 5 | ||||
-rw-r--r-- | Help/prop_tgt/AUTORCC_OPTIONS.rst | 9 | ||||
-rw-r--r-- | Help/prop_tgt/AUTOUIC_OPTIONS.rst | 9 | ||||
-rw-r--r-- | Help/variable/CMAKE_AUTORCC_OPTIONS.rst | 11 | ||||
-rw-r--r-- | Help/variable/CMAKE_AUTOUIC_OPTIONS.rst | 11 | ||||
-rw-r--r-- | Source/cmQtAutoGeneratorInitializer.cxx | 16 |
8 files changed, 78 insertions, 15 deletions
diff --git a/Help/prop_sf/AUTORCC_OPTIONS.rst b/Help/prop_sf/AUTORCC_OPTIONS.rst index d9dc4d3..2bec033 100644 --- a/Help/prop_sf/AUTORCC_OPTIONS.rst +++ b/Help/prop_sf/AUTORCC_OPTIONS.rst @@ -9,5 +9,14 @@ optional ``OPTIONS`` argument of the :module:`qt4_add_resources() <FindQt4>` mac By default it is empty. -The options set on the ``.qrc`` source file may override :prop_tgt:`AUTORCC_OPTIONS` set -on the target. +The options set on the ``.qrc`` source file may override +:prop_tgt:`AUTORCC_OPTIONS` set on the target. + +EXAMPLE +^^^^^^^ + +.. code-block:: cmake + + # ... + set_property(SOURCE resources.qrc PROPERTY AUTORCC_OPTIONS "--compress;9") + # ... diff --git a/Help/prop_sf/AUTOUIC_OPTIONS.rst b/Help/prop_sf/AUTOUIC_OPTIONS.rst index bb48da9..e2f47ec 100644 --- a/Help/prop_sf/AUTOUIC_OPTIONS.rst +++ b/Help/prop_sf/AUTOUIC_OPTIONS.rst @@ -4,11 +4,20 @@ AUTOUIC_OPTIONS Additional options for ``uic`` when using :prop_tgt:`AUTOUIC` This property holds additional command line options -which will be used when ``uic`` is executed during the build via :prop_tgt:`AUTOUIC`, -i.e. it is equivalent to the optional ``OPTIONS`` argument of the -:module:`qt4_wrap_ui() <FindQt4>` macro. +which will be used when ``uic`` is executed during the build via +:prop_tgt:`AUTOUIC`, i.e. it is equivalent to the optional ``OPTIONS`` +argument of the :module:`qt4_wrap_ui() <FindQt4>` macro. By default it is empty. -The options set on the ``.ui`` source file may override :prop_tgt:`AUTOUIC_OPTIONS` set -on the target. +The options set on the ``.ui`` source file may override +:prop_tgt:`AUTOUIC_OPTIONS` set on the target. + +EXAMPLE +^^^^^^^ + +.. code-block:: cmake + + # ... + set_property(SOURCE widget.ui PROPERTY AUTOUIC_OPTIONS "--no-protection") + # ... diff --git a/Help/prop_sf/SKIP_AUTOUIC.rst b/Help/prop_sf/SKIP_AUTOUIC.rst index 4eda726..8c962db 100644 --- a/Help/prop_sf/SKIP_AUTOUIC.rst +++ b/Help/prop_sf/SKIP_AUTOUIC.rst @@ -3,6 +3,9 @@ SKIP_AUTOUIC Exclude the source file from :prop_tgt:`AUTOUIC` processing (for Qt projects). +:prop_sf:`SKIP_AUTOUIC` can be set on C++ header and source files and on +``.ui`` files. + For broader exclusion control see :prop_sf:`SKIP_AUTOGEN`. EXAMPLE @@ -12,4 +15,6 @@ EXAMPLE # ... set_property(SOURCE file.h PROPERTY SKIP_AUTOUIC ON) + set_property(SOURCE file.cpp PROPERTY SKIP_AUTOUIC ON) + set_property(SOURCE widget.ui PROPERTY SKIP_AUTOUIC ON) # ... diff --git a/Help/prop_tgt/AUTORCC_OPTIONS.rst b/Help/prop_tgt/AUTORCC_OPTIONS.rst index 8a0f632..d6ade5a 100644 --- a/Help/prop_tgt/AUTORCC_OPTIONS.rst +++ b/Help/prop_tgt/AUTORCC_OPTIONS.rst @@ -19,3 +19,12 @@ set on the ``.qrc`` source file. See the :manual:`cmake-qt(7)` manual for more information on using CMake with Qt. + +EXAMPLE +^^^^^^^ + +.. code-block:: cmake + + # ... + set_property(TARGET tgt PROPERTY AUTORCC_OPTIONS "--compress;9") + # ... diff --git a/Help/prop_tgt/AUTOUIC_OPTIONS.rst b/Help/prop_tgt/AUTOUIC_OPTIONS.rst index 9fb042e..3f613b9 100644 --- a/Help/prop_tgt/AUTOUIC_OPTIONS.rst +++ b/Help/prop_tgt/AUTOUIC_OPTIONS.rst @@ -23,3 +23,12 @@ expressions. See the :manual:`cmake-qt(7)` manual for more information on using CMake with Qt. + +EXAMPLE +^^^^^^^ + +.. code-block:: cmake + + # ... + set_property(TARGET tgt PROPERTY AUTOUIC_OPTIONS "--no-protection") + # ... diff --git a/Help/variable/CMAKE_AUTORCC_OPTIONS.rst b/Help/variable/CMAKE_AUTORCC_OPTIONS.rst index 298cb6b..815d39d 100644 --- a/Help/variable/CMAKE_AUTORCC_OPTIONS.rst +++ b/Help/variable/CMAKE_AUTORCC_OPTIONS.rst @@ -1,7 +1,16 @@ CMAKE_AUTORCC_OPTIONS --------------------- -Whether to handle ``rcc`` automatically for Qt targets. +Additional options for ``rcc`` when using :variable:`CMAKE_AUTORCC`. This variable is used to initialize the :prop_tgt:`AUTORCC_OPTIONS` property on all the targets. See that target property for additional information. + +EXAMPLE +^^^^^^^ + +.. code-block:: cmake + + # ... + set(CMAKE_AUTORCC_OPTIONS "--compress;9") + # ... diff --git a/Help/variable/CMAKE_AUTOUIC_OPTIONS.rst b/Help/variable/CMAKE_AUTOUIC_OPTIONS.rst index 3c9b8c4..28fa92f 100644 --- a/Help/variable/CMAKE_AUTOUIC_OPTIONS.rst +++ b/Help/variable/CMAKE_AUTOUIC_OPTIONS.rst @@ -1,7 +1,16 @@ CMAKE_AUTOUIC_OPTIONS --------------------- -Whether to handle ``uic`` automatically for Qt targets. +Additional options for ``uic`` when using :variable:`CMAKE_AUTOUIC`. This variable is used to initialize the :prop_tgt:`AUTOUIC_OPTIONS` property on all the targets. See that target property for additional information. + +EXAMPLE +^^^^^^^ + +.. code-block:: cmake + + # ... + set_property(CMAKE_AUTOUIC_OPTIONS "--no-protection") + # ... diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx index 217865b..e7080cd 100644 --- a/Source/cmQtAutoGeneratorInitializer.cxx +++ b/Source/cmQtAutoGeneratorInitializer.cxx @@ -452,8 +452,6 @@ static void SetupAutoTargetUic(cmQtAutoGenDigest const& digest, cmGeneratorTarget const* target = digest.Target; cmMakefile* makefile = target->Target->GetMakefile(); - AddDefinitionEscaped(makefile, "_uic_skip", setup.UicSkip); - // Uic search paths { std::vector<std::string> uicSearchPaths; @@ -489,21 +487,25 @@ static void SetupAutoTargetUic(cmQtAutoGenDigest const& digest, } } } - // Uic files options + // .ui files skip and options { std::vector<std::string> uiFileFiles; std::vector<std::vector<std::string>> uiFileOptions; { std::string const uiExt = "ui"; - const std::vector<cmSourceFile*>& srcFiles = makefile->GetSourceFiles(); - for (cmSourceFile* sf : srcFiles) { + for (cmSourceFile* sf : makefile->GetSourceFiles()) { // sf->GetExtension() is only valid after sf->GetFullPath() ... std::string const& fPath = sf->GetFullPath(); if (sf->GetExtension() == uiExt) { + std::string const absFile = cmSystemTools::GetRealPath(fPath); + // Check if the file should be skipped + if (sf->GetPropertyAsBool("SKIP_AUTOUIC") || + sf->GetPropertyAsBool("SKIP_AUTOGEN")) { + setup.UicSkip.insert(absFile); + } // Check if the files has uic options std::string const uicOpts = GetSafeProperty(sf, "AUTOUIC_OPTIONS"); if (!uicOpts.empty()) { - std::string const absFile = cmSystemTools::GetRealPath(fPath); // Check if file isn't skipped if (setup.UicSkip.count(absFile) == 0) { uiFileFiles.push_back(absFile); @@ -519,6 +521,8 @@ static void SetupAutoTargetUic(cmQtAutoGenDigest const& digest, AddDefinitionEscaped(makefile, "_qt_uic_options_options", uiFileOptions); } + AddDefinitionEscaped(makefile, "_uic_skip", setup.UicSkip); + // Uic executable { std::string err; |