QtAutogen: Only add source files to the target if AUTORCC is ON.
The qtx_add_resources() macro adds the resource file to the output list to maintain file-level dependencies. Having the qrc file in a target sources is a precondition for AUTORCC to function. When processing the source files of a target, only add the generated qrc_<file>.cpp to the target sources if AUTORCC is ON. This avoids pre-porting conflict with the macro. Reported-by: Micha Hergarden
This commit is contained in:
parent
f748b59e20
commit
8f8edeb09b
|
@ -487,19 +487,23 @@ void cmQtAutoGenerators::SetupSourceFiles(cmTarget const* target)
|
|||
}
|
||||
|
||||
std::string ext = sf->GetExtension();
|
||||
if (ext == "qrc"
|
||||
&& !cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTORCC")))
|
||||
{
|
||||
std::string basename = cmsys::SystemTools::
|
||||
GetFilenameWithoutLastExtension(absFile);
|
||||
|
||||
std::string rcc_output_file = makefile->GetCurrentOutputDirectory();
|
||||
rcc_output_file += "/qrc_" + basename + ".cpp";
|
||||
makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
|
||||
rcc_output_file.c_str(), false);
|
||||
cmSourceFile* rccCppSource
|
||||
= makefile->GetOrCreateSource(rcc_output_file.c_str(), true);
|
||||
newRccFiles.push_back(rccCppSource);
|
||||
if (target->GetPropertyAsBool("AUTORCC"))
|
||||
{
|
||||
if (ext == "qrc"
|
||||
&& !cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTORCC")))
|
||||
{
|
||||
std::string basename = cmsys::SystemTools::
|
||||
GetFilenameWithoutLastExtension(absFile);
|
||||
|
||||
std::string rcc_output_file = makefile->GetCurrentOutputDirectory();
|
||||
rcc_output_file += "/qrc_" + basename + ".cpp";
|
||||
makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
|
||||
rcc_output_file.c_str(), false);
|
||||
cmSourceFile* rccCppSource
|
||||
= makefile->GetOrCreateSource(rcc_output_file.c_str(), true);
|
||||
newRccFiles.push_back(rccCppSource);
|
||||
}
|
||||
}
|
||||
|
||||
if (!generated)
|
||||
|
|
|
@ -82,7 +82,13 @@ target_link_libraries(libC LINK_PUBLIC libB)
|
|||
|
||||
target_link_libraries(QtAutogen codeeditorLib ${QT_LIBRARIES} libC)
|
||||
|
||||
add_library(empty STATIC empty.cpp)
|
||||
# Add not_generated_file.qrc to the source list to get the file-level
|
||||
# dependency, but don't generate a c++ file from it. Disable the AUTORCC
|
||||
# feature for this target. This tests that qrc files in the sources don't
|
||||
# have an effect on generation if AUTORCC is off.
|
||||
add_library(empty STATIC empty.cpp not_generated_file.qrc)
|
||||
set_target_properties(empty PROPERTIES AUTORCC OFF)
|
||||
|
||||
set_target_properties(empty PROPERTIES AUTOMOC TRUE)
|
||||
target_link_libraries(empty no_link_language)
|
||||
add_library(no_link_language STATIC empty.h)
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource>
|
||||
<file>abc.cpp</file>
|
||||
</qresource>
|
||||
</RCC>
|
Loading…
Reference in New Issue