Hey all,
the cmake documentation says:
If this variable is enabled, CMake automatically adds for each shared library target, static library target, module target and executable target, CMAKE_CURRENT_SOURCE_DIR and CMAKE_CURRENT_BINARY_DIR to the INTERFACE_INCLUDE_DIRECTORIES target property.
So I made a little test:
CMAKE_MINIMUM_REQUIRED(VERSION 3.16)
PROJECT(includetest)
INCLUDE(CMakePrintHelpers)
#Set the variables
SET(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
ADD_EXECUTABLE(main main.cpp)
#Print out INTERFACE_INCLUDE_DIRECTORIES
CMAKE_PRINT_PROPERTIES(TARGETS main PROPERTIES INTERFACE_INCLUDE_DIRECTORIES INCLUDE_DIRECTORIES)
I would expect that after running cmake on this CMakeLists.txt, it would print me out the directory where main
is located. Instead, the output is:
Properties for TARGET main:
main.INTERFACE_INCLUDE_DIRECTORIES = <NOTFOUND>
main.INCLUDE_DIRECTORIES = <NOTFOUND>
Which is not what is expected, and rather inconsistent with what the documentation says. Or did I miss something from the docs?
I am using CMake 3.16.3