CMP0023¶
警告
該方針的 OLD 行為已在 CMake 版本 4.0 中移除。該方針必須透過呼叫 cmake_minimum_required() 或 cmake_policy() 設定為 NEW。
Plain and keyword target_link_libraries() signatures cannot be mixed.
CMake 2.8.12 introduced the target_link_libraries() signature using
the PUBLIC, PRIVATE, and INTERFACE keywords to generalize the
LINK_PUBLIC and LINK_PRIVATE keywords introduced in CMake 2.8.7.
Use of signatures with any of these keywords sets the link interface of a
target explicitly, even if empty. This produces confusing behavior
when used in combination with the historical behavior of the plain
target_link_libraries() signature. For example, consider the code:
target_link_libraries(mylib A)
target_link_libraries(mylib PRIVATE B)
After the first line the link interface has not been set explicitly so
CMake would use the link implementation, A, as the link interface.
However, the second line sets the link interface to empty. In order
to avoid this subtle behavior CMake now prefers to disallow mixing the
plain and keyword signatures of target_link_libraries() for a single
target.
The OLD behavior for this policy is to allow keyword and plain
target_link_libraries() signatures to be mixed. The NEW behavior for
this policy is to not to allow mixing of the keyword and plain
signatures.
此方針於 CMake 版本 2.8.12 中引入。在 CMake 版本 4.0 移除之前,它可以透過 cmake_policy() 或 cmake_minimum_required() 設定。如果未設定,CMake warned,並使用 OLD 行為。