No subject
Tue Aug 6 13:31:21 EDT 2013
<br>
get_filename_component( BUILD_PRODUCT_ROOT ${CMAKE_SOURCE_DIR}/../.. ABSOLU=
TE )<br>
set( CMAKE_MODULE_PATH<br>
=A0 =A0 "${BUILD_PRODUCT_ROOT}/cmake"<br>
=A0 =A0 "${BUILD_PRODUCT_ROOT}/cmake/find"<br>
)<br>
<br>
add_subdirectory( ${BUILD_PRODUCT_ROOT}/source source )<br>
<br>
Note that the script "root/source/CMakeLists.txt" is where I begi=
n<br>
defining targets, and it never steps into "build" (to avoid infin=
ite<br>
recursion).<br>
<br>
Later on (still in the root script) I do:<br>
<br>
include( common )<br>
<br>
This includes "root/cmake/common.cmake" as expected, but inside<b=
r>
common.cmake when I try to include a file (not a module) relative to<br>
common.cmake, it says it can't find it. Example:<br>
<br>
include( foo/bar/stuff.cmake )<br>
<br>
The absolute path for this would be:<br>
<br>
root/cmake/foo/bar/stuff.cmake<br>
<br>
Naturally I assume that when including a FILE (not a module!) that it<br>
is relative to the CMAKE_CURRENT_LIST_DIR, which in this case<br>
correctly displays as "root/cmake".<br>
<br>
Can anyone explain why I can't include files from common.cmake? Thanks<=
br>
in advance.<br></blockquote><div><br></div><div>Your expectation is wrong h=
ere, IMO. The include() command works very much like the preprocessor's=
#include in C/C++, it takes the content of the file and puts it verbatim i=
nto the place where the include() occurs. In particular once the data has b=
een read the command forgets where it came from and this is before the code=
gets executed. So the 'context' CMakeLists.txt file is still the o=
ne in root/build/.</div>
<div><br></div><div>Andreas=A0<br></div></div><br></div></div>
--089e0149ca3a10f2b104e5b16723--
More information about the CMake
mailing list