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

Support ::mylib which that target that exists at configure-time #169

Merged
merged 3 commits into from
Dec 4, 2024

Conversation

mrexodia
Copy link
Contributor

@mrexodia mrexodia commented Dec 4, 2024

[project]
name = "namespace"

[target.mylib]
type = "static"
sources = ["src/mylib.cpp"]

[target.myexe]
type = "executable"
sources = ["src/myexe.cpp"]
link-libraries = ["::mylibb"]

This will emit the following CMake:

if(NOT TARGET mylibb)
	message(FATAL_ERROR "Target \"mylibb\" referenced by \"myexe\" does not exist!")
endif()

target_link_libraries(
	mylibb
)

At configure-time it will error:

CMake Error at CMakeLists.txt:52 (message):
  Target "mylibb" referenced by "myexe" does not exist!

Relevant CMake issue: https://gitlab.kitware.com/cmake/cmake/-/issues/26497

@mrexodia mrexodia merged commit 49cdab3 into main Dec 4, 2024
8 checks passed
@mrexodia mrexodia deleted the namespace-targets branch December 4, 2024 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant