Reputation: 4888
Say a library (that I don't own) calls
include_directories(${SOME_CACHED_DIR})
with SOME_CACHED_DIR
as a cache var, can I then somehow predeclare SOME_CACHED_DIR
in the parent project like this:
set(SOME_CACHED_DIR CACHE STRING
$<BUILD_INTERFACE:${otherlib_BINARY_DIR}>
$<INSTALL_INTERFACE:${otherlib_INSTALL_DIR}>
)
So that I could differentiate out the directories for the build and install tree picked up by include_directories
? I tried to print out the resulting var using
file(GENERATE OUTPUT ${CMAKE_CURRENT_LIST_DIR}/genexpr.txt CONTENT ${SOME_CACHED_DIR})
But it always prints SOME_CACHED_DIR-NOTFOUND
.
EDIT: Corrected spelling mistake
Upvotes: 0
Views: 220