Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aleh-arol
Copy link

…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.

@vector-of-bool
Copy link
Owner

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

@vector-of-bool
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants