On Thu, Jan 28, 2010 at 5:23 PM, Brian Davis <span dir="ltr"><<a href="mailto:bitminer@gmail.com">bitminer@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Update: currently crying uncle ... and switching to
ExternalProject_Add. CMake and the third party libs were simply not
designed for this.<br>
<br>
Question on ExternalProject_Add above:<div class="im"><br>
<br>
<div>ExternalProject_Add(</div>
<div> DOWNLOAD_COMMAND ""</div>
<div> CMAKE_ARGS</div>
<div> -DMYPROJ_UBERBUILD:BOOL=OFF</div>
<div> SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}</div>
<div> ...</div>
<div>)</div>
<br></div>I had in my project:<br>
<br>
SET( THIRD_PARTY_SRC_DIR 3rdParty/Win )<div class="im"><br>
add_subdirectory( ${THIRD_PARTY_SRC_DIR}/vtk-5.4.2 ./vtk-5.4.2 )<br>
<br></div>
and so I replaced it with:<br>
<br>
ExternalProject_Add(<br>
vtk-5.4.2<br>
DOWNLOAD_COMMAND ""<br>
SOURCE_DIR ${THIRD_PARTY_SRC_DIR}/vtk-5.4.2<br>
# SOURCE_DIR C:\projects\NIH2009\source\branches\trunk\source\cpp\lib\3rdParty\Win\vtk-5.4.2<br>
SOURCE_DIR /source/cpp/lib/3rdParty/Win/vtk-5.4.2<br>
<br>
)<br>
<br>
Where these lines are in a CMakeLists.txt file located at:<br>
<br>
C:\projects\NIH2009\source\branches\trunk\source\cpp\lib\CMakeLists.txt<br>
<br>
but I get the error in Visual Studio:<br>
<br>
2>CMake Error: The source directory
"C:/projects/NIH2009/source/branches/trunk/build/dvip4-Win64/cpp_source/lib/3rdParty/Win/vtk-5.4.2"
does not appear to contain CMakeLists.txt.<br>
<br>
Note the prefixing of C:/projects/NIH2009/source/branches/trunk/build/dvip4-Win64/cpp_source/lib<br>
<br>
vtk is located at C:\projects\NIH2009\source\branches\trunk\source\cpp\lib\3rdParty\Win\vtk-5.4.2<br>
<br>
and project root CMakeLists.txt is at C:\projects\NIH2009\source\branches\trunk<br>
<br>
<br>
<br>
ExternalProject_Add(<br>
vtk-5.4.2<br>
DOWNLOAD_COMMAND ""<br>
SOURCE_DIR /source/cpp/lib/3rdParty/Win/vtk-5.4.2<br>
<br>
)<br>
<br>
and get: <br>
<br>
2>CMake Error: The source directory "/source/cpp/lib/3rdParty/Win/vtk-5.4.2" does not appear to contain CMakeLists.txt.<br>
<br>
so I try:<br>
<br>
SOURCE_DIR /3rdParty/Win/vtk-5.4.2<br>
<br>
2>CMake Error: The source directory "/3rdParty/Win/vtk-5.4.2" does not appear to contain CMakeLists.txt.<br>
<br>
<br>
so I try absolute path:<br>
<br>
<br>
ExternalProject_Add(<br>
vtk-5.4.2<br>
DOWNLOAD_COMMAND ""<br>
SOURCE_DIR C:\projects\NIH2009\source\branches\trunk\source\cpp\lib\3rdParty\Win\vtk-5.4.2<br>
}<br>
<br>
Ahhh the hacking... I am going to find my way out of this forest one day... and onto a desert.<br>
<br>
And now CMake finds the vtk goop. Now the question: Is there a
project relative directory syntax to use here or is ExternalProject not
like add_subdirectory in this regard?<br><font color="#888888">
<font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#888888"><br></font></font></font></blockquote><div><br></div><div>Relative path use is probably not well-defined for ExternalProject_Add.</div>
<div><br></div><div>If, as you say:</div><div> "vtk is located at C:\projects\NIH2009\source\branches\trunk\source\cpp\lib\3rdParty\Win\vtk-5.4.2 and project root CMakeLists.txt is at C:\projects\NIH2009\source\branches\trunk"<br>
</div><div><br></div><div><br></div><div>Then I would construct a call to ExternalProject_Add in the project root CMakeLists like this:</div><div> ExternalProject_Add(<br> vtk-5.4.2<br> DOWNLOAD_COMMAND ""<br>
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/source/cpp/lib/3rdParty/Win/vtk-5.4.2<br> )</div><div><br></div><div>All _DIR type arguments in CMake should be specified as full absolute paths unless there is documentation that tells you it's ok to use a relative path name and what directory such values should be relative to...</div>
<div><br></div><div>For ExternalProject_Add, it's best to use full path names with "/" separators for all _DIR parameters.</div><div><br></div><div><br></div><div>HTH,</div><div>David</div><div><br></div></div>