diff options
author | Alexey Edelev <semlanik@gmail.com> | 2021-07-22 10:13:48 (GMT) |
---|---|---|
committer | Alexey Edelev <semlanik@gmail.com> | 2021-07-23 13:37:31 (GMT) |
commit | e5ec0e52f4f15f78bb973cdb03a61ef9c707c2fa (patch) | |
tree | 070f0eb729d32d5be2209a4752784adc9878afe8 /Source/cmQtAutoGenerator.cxx | |
parent | 41e9953143c37dfa50be30ff4e34c826e2f55c0b (diff) | |
download | CMake-e5ec0e52f4f15f78bb973cdb03a61ef9c707c2fa.zip CMake-e5ec0e52f4f15f78bb973cdb03a61ef9c707c2fa.tar.gz CMake-e5ec0e52f4f15f78bb973cdb03a61ef9c707c2fa.tar.bz2 |
AUTOUIC: Fix generating of dependency rules for UI header files
We could not rely on .ui files when generating the ninja rules
for the generated UI header files. .ui files might be added to the
target sources but never processed by AUTOUIC afterward, since UI
header files are never included in a source code. Instead of adding
dependency rules based on the .ui files, this approach scans
non-generated source files for includes of the UI header files,
as AUTOUIC does. This gives the consistent set of UI header files
at configure time, that could be used to generate byproducts rules
for the AUTOUIC. Also, the path to the generated UI header file depends
not on the .ui file location but on the include line is used in source
files.
Fixes: #16776
Diffstat (limited to 'Source/cmQtAutoGenerator.cxx')
-rw-r--r-- | Source/cmQtAutoGenerator.cxx | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/Source/cmQtAutoGenerator.cxx b/Source/cmQtAutoGenerator.cxx index 568926e..0c6b5e6 100644 --- a/Source/cmQtAutoGenerator.cxx +++ b/Source/cmQtAutoGenerator.cxx @@ -121,43 +121,6 @@ bool cmQtAutoGenerator::MakeParentDirectory(std::string const& filename) return success; } -bool cmQtAutoGenerator::FileRead(std::string& content, - std::string const& filename, - std::string* error) -{ - content.clear(); - if (!cmSystemTools::FileExists(filename, true)) { - if (error != nullptr) { - *error = "Not a file."; - } - return false; - } - - unsigned long const length = cmSystemTools::FileLength(filename); - cmsys::ifstream ifs(filename.c_str(), (std::ios::in | std::ios::binary)); - - // Use lambda to save destructor calls of ifs - return [&ifs, length, &content, error]() -> bool { - if (!ifs) { - if (error != nullptr) { - *error = "Opening the file for reading failed."; - } - return false; - } - content.reserve(length); - using IsIt = std::istreambuf_iterator<char>; - content.assign(IsIt{ ifs }, IsIt{}); - if (!ifs) { - content.clear(); - if (error != nullptr) { - *error = "Reading from the file failed."; - } - return false; - } - return true; - }(); -} - bool cmQtAutoGenerator::FileWrite(std::string const& filename, std::string const& content, std::string* error) |