[CMake] Can't get include() to work!

Philip Lowman philip at yhbt.com
Tue Dec 2 08:11:58 EST 2008


On Mon, Dec 1, 2008 at 11:52 PM, Robert Dailey <rcdailey at gmail.com> wrote:

> On Mon, Dec 1, 2008 at 9:53 PM, Philip Lowman <philip at yhbt.com> wrote:
>
>> include( ${CMAKE_CURRENT_SOURCE_DIR}/includes.cmake)
>> should also work.
>> CMAKE_MODULE_PATH may also help you if you have a lot of includes.
>>
>> http://www.vtk.org/Wiki/CMake_Useful_Variables
>>
>
> I definitely tried this (using CMAKE_CURRENT_SOURCE_DIR) and it didn't
> work. I'll try Michael's method tomorrow and see if I get any different
> results.
>

I can't replicate this as a bug.  Maybe your setup differs substantially
from this (which works fine on CMake 2.6.2)?  Apparantly the use of
${CMAKE_CURRENT_SOURCE_DIR} is superfluous.


CMakeLists.txt:
PROJECT(foo)
INCLUDE(bar.cmake)
ADD_SUBDIRECTORY(subdir)

bar.cmake:
MESSAGE(bar)

subdir/CMakeLists.txt:
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/baz.cmake)

subdir/baz.cmake:
MESSAGE(baz)

-- 
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20081202/0bfb22f4/attachment.htm>


More information about the CMake mailing list