Closed ahundt closed 8 years ago
When you use basis_add_subdirectory
, are you sure that subdirectory exists? When you add the following before the call to add_subdirectory, what does it print?
set(SUBDIR "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}")
message("SUBDIR=${SUBDIR}")
if (IS_DIRECTORY "${SUBDIR}")
message ("Subdirectory ${SUBDIR} exists")
else ()
message ("Subdirectory ${SUBDIR} missing")
endif ()
Those are the only reasons why basis_add_subdirectory
would not give you the same result as add_subdirectory
.
yes, if I delete basis_
then it works correctly using the standard cmake call.
Regarding basis_include_directories
, it calls right on the first line CMake's include_directories
with the given arguments. Maybe there is a problem with the latest CMake...
function (basis_include_directories)
# CMake's include_directories ()
_include_directories (${ARGN})
# ...
endfunction ()
yes, if I delete
basis_
then it works correctly using the standard cmake call.
Well, but can you please add those lines to provide some more debug output ?
I just encountered the same issue with basis_add_subdirectory
. As it turns out, the problem is that within a macro, a variable is used which has the same name as the input argument of the macro, i.e.,
set(SUBDIR "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}")
For some reason, this may sometimes not change SUBDIR and hence the following IS_DIRECTORY
check fails when the path is not absolute.
good to see I'm not crazy :-)
Fixed in CMake BASIS Modules develop branch (see this commit).
If you create an
example
directory, and in it callbasis_add_subdirectory(dirname)
it will have no effect. If you switch that line to standardadd_subdirectory()
and in the subdirectory callbasis_include_directories(.)
with a header in.
, then do the normal cmake build with makefiles and runmake VERBOSE=1
you will see no-I/path/to/folder/that/was/dot
, that is the include never went through properly to cmake. I've seen this in other directories too, and verified thatBUILD_EXAMPLE ON
and that the cmake code wherebasis_add_subdirectory(dirname)
is called is actually being executed.I believe I've seen this on both OS X and Linux with the latest CMake and cmake-basis.