D
D
Dolarun2022-02-24 10:28:31
CMake
Dolarun, 2022-02-24 10:28:31

What is the scope of CMake's "global entities"?

If I bring subdirectoryin link_librariesseveral libraries, will the added libraries be visible in the root CMakeLists? If not, how can I do it link_librarieslocally for all targets in a subdirectory?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
res2001, 2022-02-24
@Dolarun

Here they write: https://cmake.org/cmake/help/v3.10/command/link_li...
that this will only affect targets created in the current or lower CMakeLists.
I suspect that the link_libraries just changes the variable. And the variables in cmake behave by default as described, i.e. The changes are visible here and below. In order for them to be visible above, dances with a tambourine are needed, which, apparently, is not in link_libraries.
At the same time, targets created in nested CMakeLists are perfectly visible in all other CMakeLists, not necessarily lower in the hierarchy, but also in another branch.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question