[CMake] Can't get include() to work!
Michael Jackson
mike.jackson at bluequartz.net
Mon Dec 1 19:59:16 EST 2008
On Dec 1, 2008, at 5:12 PM, Robert Dailey wrote:
> For some reason I cannot get include() to work.
>
> In a CMakeLists.txt of mine (not the root CMakeLists.txt) I call the
> following:
>
> cmake_minimum_required( VERSION 2.6 )
> include( includes.cmake )
> project( vfx )
>
> And I have a file called includes.cmake in the same directory
> containing the CMakeLists.txt above. When I run cmake -G "Visual
> Studio 9 2008", I get the following output:
>
> C:\IT\work\jewett>cmake -G "Visual Studio 9 2008"
> CMake Error at vfx/CMakeLists.txt:2 (include):
> include could not find load file:
>
> includes.cmake
How is your cmake file being called? If it is being called with
"include(...)" then basically your file contents is substituted for
the "include(...)" call. So the file "includes.cmake" without any
leading prefix directory makes sense that it can not be found.
You basically need to get the current directory that CMake is
traversing to figure out what prefix to use.
Do you _really_ need to place the include(includes.cmake) BEFORE the
project() command? If you can swap these two lines then you can do
something like:
project (vfx)
include ( ${vfx_SOURCE_DIR}/includes.cmake ) and it should find the
"includes.cmake" file in the same directory as the vfx CMakeLists.txt
file.
Hope that helps.
_______________________________________________________
Mike Jackson mike.jackson at bluequartz.net
BlueQuartz Software www.bluequartz.net
Principal Software Engineer Dayton, Ohio
More information about the CMake
mailing list