On Mon, Dec 1, 2008 at 7:59 PM, Michael Jackson <span dir="ltr"><<a href="mailto:mike.jackson@bluequartz.net">mike.jackson@bluequartz.net</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="Wj3C7c"><br>
On Dec 1, 2008, at 5:12 PM, Robert Dailey wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
For some reason I cannot get include() to work.<br>
<br>
In a CMakeLists.txt of mine (not the root CMakeLists.txt) I call the following:<br>
<br>
cmake_minimum_required( VERSION 2.6 )<br>
include( includes.cmake )<br>
project( vfx )<br>
<br>
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:<br>
<br>
C:\IT\work\jewett>cmake -G "Visual Studio 9 2008"<br>
CMake Error at vfx/CMakeLists.txt:2 (include):<br>
include could not find load file:<br>
<br>
includes.cmake<br>
</blockquote>
<br>
<br></div></div>
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.<br>
<br>
You basically need to get the current directory that CMake is traversing to figure out what prefix to use.<br>
<br>
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:<br>
<br>
project (vfx)<br>
include ( ${vfx_SOURCE_DIR}/includes.cmake ) and it should find the "includes.cmake" file in the same directory as the vfx CMakeLists.txt file.<br>
<br>
Hope that helps.</blockquote><div><br>include( ${CMAKE_CURRENT_SOURCE_DIR}/includes.cmake)<br>should also work.<br>CMAKE_MODULE_PATH may also help you if you have a lot of includes.<br><br><a href="http://www.vtk.org/Wiki/CMake_Useful_Variables">http://www.vtk.org/Wiki/CMake_Useful_Variables</a><br>
<br></div></div>-- <br>Philip Lowman<br>