Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CMake: Fix gc_sections genex evaluation in pkgconfig file creation
The gc_sections linker flag was recently wrapped in a $<CXX_COMPILER_ID> genex to prevent adding it the command line when using an incompatible compiler. This causes an issue when generating .pc pkg-config files because $<CXX_COMPILER_ID> can't be used in the output of a file(GENERATE) call. Record the flag in a global property, both the genex-wrapped and bare forms, so that we can perform a string replacement when generating the pkg-config file to remove the genex wrapping. This is not perfect, in the sense that consumers of the .pc file might get the wrong flag if using an incompatible compiler, but it's better than outright failing the Qt build. Distros will be expected to patch the .pc files if necessary. Note the issue does not usually happen for regular Qt builds because gc_sections is only enabled automatically for static builds, but for static builds we don't currently generate .pc files. So the issue only happens in shared Qt builds where the gc_sections feature is enabled manually. Amends a2b6c2f Pick-to: 6.5 6.6 Fixes: QTBUG-115243 Change-Id: I3f6bdf86c24ee90b6da04994e458b438cc41fc7a Reviewed-by: Amir Masoud Abdol <[email protected]>
- Loading branch information