Commit ddb5b097 authored by Brad King's avatar Brad King 💬
Browse files

Merge branch 'backport-autogen_noqt_warning' into release-3.13

Merge-request: !2787
parents 91fa6a47 dd39da55
......@@ -1500,6 +1500,31 @@ bool cmGlobalGenerator::QtAutoGen()
auto qtVersion = cmQtAutoGenInitializer::GetQtVersion(target);
// don't do anything if there is no Qt4 or Qt5Core (which contains moc)
if (qtVersion.Major != 4 && qtVersion.Major != 5) {
std::string msg = "AUTOGEN: No valid Qt version found for target ";
msg += target->GetName();
msg += ". ";
{
std::vector<std::string> lst;
if (mocEnabled) {
lst.emplace_back("AUTOMOC");
}
if (uicEnabled) {
lst.emplace_back("AUTOUIC");
}
if (rccEnabled) {
lst.emplace_back("AUTORCC");
}
msg += cmJoin(lst, ", ");
}
msg += " disabled. ";
msg += "Consider adding:\n";
if (uicEnabled) {
msg += " find_package(Qt5 COMPONENTS Widgets)\n";
} else {
msg += " find_package(Qt5 COMPONENTS Core)\n";
}
msg += "to your CMakeLists.txt file.";
target->Makefile->IssueMessage(cmake::AUTHOR_WARNING, msg);
continue;
}
......
cmake_minimum_required(VERSION 3.13)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)
^CMake Warning \(dev\) in CMakeLists.txt:
AUTOGEN: No valid Qt version found for target main. AUTOMOC, AUTOUIC,
AUTORCC disabled. Consider adding:
find_package\(Qt5 COMPONENTS Widgets\)
to your CMakeLists.txt file.
This warning is for project developers. Use -Wno-dev to suppress it.
enable_language(CXX)
add_executable(main empty.cpp)
set_property(TARGET main PROPERTY AUTOMOC 1)
set_property(TARGET main PROPERTY AUTORCC 1)
set_property(TARGET main PROPERTY AUTOUIC 1)
include(RunCMake)
run_cmake(NoQt)
......@@ -142,6 +142,7 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE)
endif()
add_RunCMake_test(AndroidTestUtilities)
add_RunCMake_test(Autogen)
add_RunCMake_test(BuildDepends)
if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja")
add_RunCMake_test(Byproducts)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment