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

Use target_link_options to set -fuse-ld flag #6043

Merged
merged 2 commits into from
Nov 18, 2022

Conversation

RedBeard0531
Copy link
Contributor

This means that anything that transitively links to Realm::Storage will pick up this flag automatically. Due to how cmake handles target options, this will also be appended to the linker command line after anything set using add_link_options(), including the -fuse-ld=gold from our OpenSSL prebuilt.

I manually verified that if I point realm-js's submodule to this commit, it will start using lld for linking.

What, How & Why?

☑️ ToDos

  • 📝 Changelog update
  • [ ] 🚦 Tests (or not relevant)
  • [ ] C-API, if public C++ API changed.

This means that anything that transitively links to Realm::Storage will pick
up this flag automatically. Due to how cmake handles target options, this will
also be appended to the linker command line *after* anything set using
add_link_options(), including the -fuse-ld=gold from our OpenSSL prebuilt.
@RedBeard0531 RedBeard0531 requested a review from jedelbo November 18, 2022 10:33
@cla-bot cla-bot bot added the cla: yes label Nov 18, 2022
@@ -1,6 +1,6 @@
macro(build_fuzzer_variant variant)
add_executable(${variant} command_file.hpp command_file.cpp ${variant}.cpp)
target_link_libraries(${variant} realm-object-store)
target_link_libraries(${variant} ObjectStore)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By specifying the library name rather than the cmake target this was bypassing flag propagation. I didn't think that was intentional, so I change it to use the target name.

@@ -319,6 +319,9 @@ set_target_properties(Storage PROPERTIES
)

target_compile_options(Storage PUBLIC ${REALM_SANITIZER_FLAGS})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems weird that we are doing this unconditionally, but then doing it again on line 331 inside an if(NOT MSVC) block. But I didn't want to change that as part of this commit. 🤷

@RedBeard0531 RedBeard0531 merged commit 250ec98 into master Nov 18, 2022
@RedBeard0531 RedBeard0531 deleted the ms/make_linker_choice_viral branch November 18, 2022 13:48
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants