Skip to content

Conversation

@M2-TE
Copy link
Contributor

@M2-TE M2-TE commented Dec 6, 2025

Having an alias forces CMake to check that it actually exists when e.g. linking to it:

  • target_link_libraries(exe PRIVATE gtl) allows CMake to configure without issue, despite gtl missing
  • target_link_libraries(exe PRIVATE gtl::gtl) enforces the existance of gtl

@greg7mdp
Copy link
Owner

greg7mdp commented Dec 6, 2025

Sounds good, thanks for the contribution @M2-TE .

Could you change your new line to add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) and I'll merge it.

@M2-TE
Copy link
Contributor Author

M2-TE commented Dec 7, 2025

Woops, midnight oversight. Sorry, done!

@greg7mdp greg7mdp merged commit 7fdccad into greg7mdp:main Dec 7, 2025
6 checks passed
@M2-TE M2-TE deleted the add-cmake-alias branch December 7, 2025 13:41
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

Successfully merging this pull request may close these issues.

2 participants