Thinking about this some more, I suspect Petr's comments may be on the
right track. What matters is the value of this variable in the scope of the
*directory* being processed. You need the CMAKE_INCLUDE_CURRENT_DIR
variable to be set in that directory scope, if I'm understanding the docs
Hi Tiago.
Yes, Craig's original comment applies. Targets do not have scope, variables
do. Because you're in a function, you'd need to set the variable using
PARENT_SCOPE to have it apply outside the function:
function(AddTest)
#...
set(CMAKE_INCLUDE_CURRENT_DIR ON PARENT_SCOPE)
#...
Are you sure what you want isn't to specify INTERFACE header directories on
whatever is being passed in as the ${TEST_LIBRARIES} libraries? If the
requirement to have the parent directory's source/binary dirs added to the
header search path is coming from those instead of the test's own
Hi Craig,
Maybe my problem description was lacking. Below is the function I have.
Both CMAKE_INCLUDE_CURRENT_DIR and the target are defined on the same
function scope, but this does not seem to work. I need to define
CMAKE_INCLUDE_CURRENT_DIR on the parent CMakeLists file.
function(AddTest)
function() introduces a new scope, so if you want changes you make to
variables inside the function to be visible outside the function, you need
to use set(... PARENT_SCOPE). Alternatively, a macro() does not introduce a
new scope, so replacing your function() with a macro() may also yield the
Hi,
Does CMAKE_INCLUDE_CURRENT_DIR need to be set outside of a function?
I have a function where I define an executable "add_executable". This
executable uses moc'ed Qt clasees, so I need to set
CMAKE_INCLUDE_CURRENT_DIR. It seems like I have to set it from the top
level script calling the