[Cmake] cmake 1.8 INCLUDE_DIRECTORIES out-of-source problem

Zennard Sun zen at ll.mit.edu
Wed, 21 Jan 2004 17:33:27 -0500


Hi,
    I have a question regarding CMake 1.8.3.  I recently asked about how
to use relative pathnames with INCLUDE.  I was told to specify pathnames
relative to the source directory when using INCLUDE in 1.8.3.  However,
specifying paths from the source directory doesn't seem to work when
using INCLUDE_DIRECTORIES (in version 1.6.7, I would specify relative
pathnames for both INCLUDE and INCLUDE_DIRECTORIES from the build
directory).  For example, I have the following setup:

folder/src
(where the source files are as well as CMakeLists.txt)

folder/obj/linux
(the build directory where the out-of-source build goes)

folder/helper.txt
(a file I want to include into my CMakeLists.txt)

folder/otherstuff.h
(a file I want to include in my compilation)

In CMake 1.8.3, I would have:

SET(file_path .. CACHE PATH "Offset to file location")
INCLUDE(${file_path}/helper.txt)
INCLUDE_DIRECTORIES(${file_path})

but when I run cmake ../src from the folder/obj/linux directory, the
Makefile gives me "-I.." rather than "-I../.." in the compile line.
Should I use INCLUDE_DIRECTORIES differently than INCLUDE?  Thanks.


        -Zennard Sun