cmrc icon indicating copy to clipboard operation
cmrc copied to clipboard

Add linker flags to the resource lib target to prevent 'unused' stati…

Open aleh-arol opened this issue 7 years ago • 2 comments

…c initialization removal.

This change is to to allow usage of static initializer from the generated resource lib. The key point is to use new CMake command and features that support cross platform passing of linker flags. So there are flags for GCC/Clang/MSVC that prevents stripping unused objects from generated lib. This functionality unfortunately only available in 3.12, so it's under AUTOLOAD conditional to allow using the old way without any hassle.

Minor changes - added "no AUTOMOC" property to keep CMake from complains when using Qt. Renamed "this_script" - just in case - to the more explicit name.

For now I tested only on GCC, I will test on MSVC/Clang in the upcoming days.

aleh-arol avatar Jul 12 '18 07:07 aleh-arol

Nice! I'll take a look when I find the time. Busy with CMake Tools for a few days.

vector-of-bool avatar Jul 12 '18 23:07 vector-of-bool

Ouch. It's been a while.

I'm in the midst of a refactor that will make the issue NLA. Instead of a global initializer, filesystem objects won't be accessed by a single global instance (rather using embedded_filesystem objects). Calling out to a function to get these objects will ensure that the necessary objects files are included in the final link.

vector-of-bool avatar Sep 05 '18 05:09 vector-of-bool