diff options
author | Brad King <brad.king@kitware.com> | 2024-02-12 15:50:44 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2024-02-12 15:51:11 (GMT) |
commit | f3acc9b1ceb151c1b85574b5ea2fcf8c6d810225 (patch) | |
tree | e3d5c9fa85417e90c68587ed0d2873fa35084f3c | |
parent | 305c06328f5b039480fcce654696a2d2141d9e63 (diff) | |
parent | 9e87df4d468fb8d3a835cbdfeca30fee9586e00d (diff) | |
download | CMake-f3acc9b1ceb151c1b85574b5ea2fcf8c6d810225.zip CMake-f3acc9b1ceb151c1b85574b5ea2fcf8c6d810225.tar.gz CMake-f3acc9b1ceb151c1b85574b5ea2fcf8c6d810225.tar.bz2 |
Merge topic 'autogen-rcc-zstd' into release-3.29
9e87df4d46 Autogen/RCC: Disable zstd if it is not supported
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: alcroito <alexandru.croitor@qt.io>
Merge-request: !9232
-rw-r--r-- | Source/cmQtAutoGenInitializer.cxx | 21 | ||||
-rw-r--r-- | Tests/RunCMake/Autogen/RccExample.cmake | 4 | ||||
-rw-r--r-- | Tests/RunCMake/Autogen/RunCMakeTest.cmake | 21 |
3 files changed, 46 insertions, 0 deletions
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index aaf1817..8542206 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -883,6 +883,27 @@ bool cmQtAutoGenInitializer::InitRcc() } } + // Disable zstd if it is not supported + { + std::string const qtFeatureZSTD = "QT_FEATURE_zstd"; + if (this->GenTarget->Target->GetMakefile()->IsDefinitionSet( + qtFeatureZSTD)) { + const auto zstdDef = + this->GenTarget->Target->GetMakefile()->GetSafeDefinition( + qtFeatureZSTD); + const auto zstdVal = cmValue(zstdDef); + if (zstdVal.IsOff()) { + auto const& kw = this->GlobalInitializer->kw(); + auto rccOptions = this->GenTarget->GetSafeProperty(kw.AUTORCC_OPTIONS); + std::string const nozstd = "--no-zstd"; + if (rccOptions.find(nozstd) == std::string::npos) { + rccOptions.append(";" + nozstd + ";"); + } + this->GenTarget->Target->SetProperty(kw.AUTORCC_OPTIONS, rccOptions); + } + } + } + return true; } diff --git a/Tests/RunCMake/Autogen/RccExample.cmake b/Tests/RunCMake/Autogen/RccExample.cmake index 4554eb0..ade0fef 100644 --- a/Tests/RunCMake/Autogen/RccExample.cmake +++ b/Tests/RunCMake/Autogen/RccExample.cmake @@ -9,3 +9,7 @@ target_link_libraries(dummy Qt${with_qt_version}::Core Qt${with_qt_version}::Gui) set_target_properties(dummy PROPERTIES AUTORCC ON) + +if(DEFINED ZSTD_VALUE) + set(QT_FEATURE_zstd ${ZSTD_VALUE}) +endif() diff --git a/Tests/RunCMake/Autogen/RunCMakeTest.cmake b/Tests/RunCMake/Autogen/RunCMakeTest.cmake index d0bbbb0..0036551 100644 --- a/Tests/RunCMake/Autogen/RunCMakeTest.cmake +++ b/Tests/RunCMake/Autogen/RunCMakeTest.cmake @@ -463,4 +463,25 @@ ${make_program_stderr} endblock() endforeach() endif() + + if (QtCore_VERSION VERSION_GREATER_EQUAL 6) + if (RunCMake_GENERATOR MATCHES "Make|Ninja") + foreach(value IN ITEMS ON OFF) + block() + set(RunCMake_TEST_BINARY_DIR + ${RunCMake_BINARY_DIR}/RccNoZTSD-${value}-build) + run_cmake_with_options(RccExample ${RunCMake_TEST_OPTIONS} + -DCMAKE_AUTOGEN_VERBOSE=ON -DZSTD_VALUE=${value}) + if (value STREQUAL "OFF") + set(RunCMake_TEST_EXPECT_stdout "--no-zstd") + else() + set(RunCMake_TEST_NOT_EXPECT_stdout "--no-zstd") + endif() + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(RccNoZTSD-${value}-build ${CMAKE_COMMAND} + --build . --config Debug) + endblock() + endforeach() + endif() + endif() endif () |