mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-16 14:08:35 +08:00
Autogen/RCC: Disable zstd if it is not supported
Add the `--no-zstd` argument for `RCC` when `QT_FEATURE_zstd` is `OFF`. This causes user project builds to fail. That bug is fixed in Qt by https://codereview.qt-project.org/c/qt/qtbase/+/537546 but for the older versions, fix it here too. Fixes: #25664
This commit is contained in:

committed by
Brad King

parent
c673511263
commit
9e87df4d46
@@ -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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -9,3 +9,7 @@ target_link_libraries(dummy Qt${with_qt_version}::Core
|
|||||||
Qt${with_qt_version}::Gui)
|
Qt${with_qt_version}::Gui)
|
||||||
|
|
||||||
set_target_properties(dummy PROPERTIES AUTORCC ON)
|
set_target_properties(dummy PROPERTIES AUTORCC ON)
|
||||||
|
|
||||||
|
if(DEFINED ZSTD_VALUE)
|
||||||
|
set(QT_FEATURE_zstd ${ZSTD_VALUE})
|
||||||
|
endif()
|
||||||
|
@@ -463,4 +463,25 @@ ${make_program_stderr}
|
|||||||
endblock()
|
endblock()
|
||||||
endforeach()
|
endforeach()
|
||||||
endif()
|
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 ()
|
endif ()
|
||||||
|
Reference in New Issue
Block a user