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

Linker.cmake should use target_link_options instead of target_compile_options #72

Open
CramBL opened this issue Oct 21, 2023 · 0 comments

Comments

@CramBL
Copy link

CramBL commented Oct 21, 2023

target_compile_options(${project_name} INTERFACE ${LINKER_FLAG})

From my understanding target_compile_options can be replaced by the more appropriate target_link_options.

Motivation

Functionally there's no difference, but adding linker-specific flags to the compilation step will raise warnings e.g. clang: error: argument unused during compilation: '-fuse-ld=mold' [-Werror,-Wunused-command-line-argument] in certain setups.

Example from CI in a project of mine. Treating warnings as errors means this harmless warning caused CI to fail.

Using target_link_options resolved it.

Thank you for sharing and maintaining this template project, it is a tremendous help!

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

No branches or pull requests

1 participant