<div class="gmail_quote">On Fri, Jan 29, 2010 at 4:07 PM, Brian Davis <span dir="ltr"><<a href="mailto:bitminer@gmail.com">bitminer@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
ExternalProject_Add does not like BINARY_DIR same for multiple packages... Why?<br></blockquote><div><br></div><div>To avoid one package's output from clobbering another package's output. For CMake built projects, for example, the BINARY_DIR is where CMakeCache.txt ends up. There can only be one CMakeCache.txt in a directory, so there can only be one project for each BINARY_DIR.</div>
<div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">SET( THIRD_PARTY_PACKAGES<br> vtk-5.4.2<br> dcmtk-3.5.4<div class="im"><br> boost-cmake-1_41_0 <br>
</div>)<br><br>foreach( PACKAGE in ${THIRD_PARTY_PACKAGES} )<br>
<br> ExternalProject_Add(<br> ${PACKAGE}<br> DOWNLOAD_COMMAND ""<br> SOURCE_DIR ${TOP}/source/cpp/lib/3rdParty/Win/${PACKAGE}<br> BINARY_DIR ${BUILD_DIR}/ouput/bin<br> INSTALL_DIR ${INSTALL_PREFIX}<br>
)<br><br>endforeach( PACKAGE )<br></blockquote><div><br></div><div>Instead of "BINARY_DIR ${BUILD_DIR}/ouput/bin", try:</div><div><br></div><div> BINARY_DIR ${BUILD_DIR}/${PACKAGE}<br></div><div><br>
</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">from VS Studio I get:<br><br>1>1>CMake Error at cmake_install.cmake:31 (FILE):<br>1>1> file cannot create directory: C:/Program Files (x86)/VTK/lib/vtk-5.4.<br>
<br>and reading http:///<a href="http://www.kitware.com/products/archive/" target="_blank">www.kitware.com/products/archive/</a><em>kitware_quarterly1009</em>.<em>pdf</em> excerpt:<br>
<br><br>Install step<br>The INSTALL_DIR is underneath the calling project’s binary<br>directory. Use INSTALL_DIR to specify a different location.<br>Note that in addition to setting INSTALL_DIR, you also have<br>to pass -DCMAKE_INSTALL_PREFIX or --prefix to the CMake<br>
or configure command. It is not used automatically in the<br>configure step since not all projects follow this convention.<br><br># [INSTALL_DIR dir]<br><br><br>My projects must fall into the "not all projects follow this convention", but wait Kitware makes vtk and Kitware makes Cmake. Is Kitware not following it's own convention here or is something else going on?<br>
</blockquote><div><br></div><div>"Kitware projects" are built with CMake and all use CMAKE_INSTALL_PREFIX to determine the install directory. You should use CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX}</div>
<div>for "Kitware projects"</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br><br>I also get when I build dcmtk:<br><br>1>CMake Error: The source "C:/projects/NIH2009/source/branches/trunk/source/cpp/lib/3rdParty/Win/dcmtk-3.5.4/CMakeLists.txt" does not match the source "C:/projects/NIH2009/source/branches/trunk/source/cpp/lib/3rdParty/Win/vtk-5.4.2/CMakeLists.txt" used to generate cache. Re-run cmake with a different source directory.<br>
</blockquote><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Looks like there is some CMake cache cross mojonation going on here</blockquote><div><br></div>
<div>This is because of using the same BINARY_DIR for multiple ExternalProject_Add calls.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I guess I'll try:<br><br> ExternalProject_Add(<br> ${PACKAGE}<br> DOWNLOAD_COMMAND ""<br> SOURCE_DIR ${TOP}/source/cpp/lib/3rdParty/Win/${PACKAGE}<br>
# BINARY_DIR ${BUILD_DIR}/ouput/bin<br> INSTALL_DIR ${INSTALL_PREFIX}<br> CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX}<br> )<br><br>as:<br><br>C:\projects\NIH2009\source\branches\trunk\platform\tools\cmake-2.8.0-win32-x86\bin>cmake --help-module ExternalProject<div class="im">
<br>
cmake version 2.8.0<br></div> ExternalProject<br> Create custom targets to build projects in external trees<br><br> The 'ExternalProject_Add' function creates a custom target to drive<br> download, update/patch, configure, build, install and test steps of an<br>
external project:<br><br> ExternalProject_Add(<name> # Name for custom target<br> [DEPENDS projects...] # Targets on which the project depends<br> [PREFIX dir] # Root dir for entire project<br>
[LIST_SEPARATOR sep] # Sep to be replaced by ; in cmd lines<br> [TMP_DIR dir] # Directory to store temporary files<br> [STAMP_DIR dir] # Directory to store step timestamps<br>
#--Download step--------------<br> [DOWNLOAD_DIR dir] # Directory to store downloaded files<br> [DOWNLOAD_COMMAND cmd...] # Command to download source tree<br> [CVS_REPOSITORY cvsroot] # CVSROOT of CVS repository<br>
[CVS_MODULE mod] # Module to checkout from CVS repo<br> [CVS_TAG tag] # Tag to checkout from CVS repo<br> [SVN_REPOSITORY url] # URL of Subversion repo<br> [SVN_REVISION rev] # Revision to checkout from Subversion repo<br>
[URL /.../src.tgz] # Full path or URL of source<br> #--Update/Patch step----------<br> [UPDATE_COMMAND cmd...] # Source work-tree update command<br> [PATCH_COMMAND cmd...] # Command to patch downloaded source<br>
#--Configure step-------------<br> [SOURCE_DIR dir] # Source dir to be used for build<br> [CONFIGURE_COMMAND cmd...] # Build tree configuration command<br> [CMAKE_COMMAND /.../cmake] # Specify alternative cmake executable<br>
[CMAKE_GENERATOR gen] # Specify generator for native build<br> [CMAKE_ARGS args...] # Arguments to CMake command line<br> #--Build step-----------------<br> [BINARY_DIR dir] # Specify build dir location<br>
[BUILD_COMMAND cmd...] # Command to drive the native build<br> [BUILD_IN_SOURCE 1] # Use source dir for build dir<br> #--Install step---------------<br> [INSTALL_DIR dir] # Installation prefix<br>
[INSTALL_COMMAND cmd...] # Command to drive install after build<br> #--Test step---------------<br> [TEST_BEFORE_INSTALL 1] # Add test step executed before install step<br> [TEST_AFTER_INSTALL 1] # Add test step executed after install step<br>
[TEST_COMMAND cmd...] # Command to drive test<br> )<br><br> The *_DIR options specify directories for the project, with default<br> directories computed as follows. If the PREFIX option is given to<br>
ExternalProject_Add() or the EP_PREFIX directory property is set, then<br> an external project is built and installed under the specified prefix:<br><br> TMP_DIR = <prefix>/tmp<br> STAMP_DIR = <prefix>/src/<name>-stamp<br>
DOWNLOAD_DIR = <prefix>/src<br> SOURCE_DIR = <prefix>/src/<name><br> BINARY_DIR = <prefix>/src/<name>-build<br> INSTALL_DIR = <prefix><br><br>
Otherwise, if the EP_BASE directory property is set then components of<br>
an external project are stored under the specified base:<br><br> TMP_DIR = <base>/tmp/<name><br> STAMP_DIR = <base>/Stamp/<name><br> DOWNLOAD_DIR = <base>/Download/<name><br>
SOURCE_DIR = <base>/Source/<name><br> BINARY_DIR = <base>/Build/<name><br> INSTALL_DIR = <base>/Install/<name><br><br> If no PREFIX, EP_PREFIX, or EP_BASE is specified then the default is<br>
to set PREFIX to "<name>-prefix". Relative paths are interpreted with<br> respect to the build directory corresponding to the source directory<br> in which ExternalProject_Add is invoked.<br>
<br> If SOURCE_DIR is explicitly set to an existing directory the project<br> will be built from it. Otherwise a download step must be specified<br> using one of the DOWNLOAD_COMMAND, CVS_*, SVN_*, or URL options. The<br>
URL option may refer locally to a directory or source tarball, or<br> refer to a remote tarball (e.g. http://.../src.tgz).<br><br> The 'ExternalProject_Add_Step' function adds a custom step to an<br>
external project:<br><br> ExternalProject_Add_Step(<name> <step> # Names of project and custom step<br> [COMMAND cmd...] # Command line invoked by this step<br> [COMMENT "text..."] # Text printed when step executes<br>
[DEPENDEES steps...] # Steps on which this step depends<br> [DEPENDERS steps...] # Steps that depend on this step<br> [DEPENDS files...] # Files on which this step depends<br> [ALWAYS 1] # No stamp file, step always runs<br>
[WORKING_DIRECTORY dir] # Working directory for command<br> )<br><br> The command line, comment, and working directory of every standard and<br> custom step is processed to replace tokens <SOURCE_DIR>, <BINARY_DIR>,<br>
<INSTALL_DIR>, and <TMP_DIR> with corresponding property values.<br><br> The 'ExternalProject_Get_Property' function retrieves external project<br> target properties:<br><br> ExternalProject_Get_Property(<name> [prop1 [prop2 [...]]])<br>
<br> It stores property values in variables of the same name. Property<br> names correspond to the keyword argument names of<br> 'ExternalProject_Add'.<br><br><br> Defined in: C:/projects/NIH2009/source/branches/trunk/platform/tools/cmake-2.8.0-win32-x86/share/cmake-2.8/Modules/ExternalProject.cmake<br>
<br>Leads me to believe that I should use CMAKE_ARGS<br><br></blockquote><div><br></div><div><br></div><div>Is it getting any easier yet...?</div><div><br></div><div>Hopefully this is helpful,</div><div>David</div><div><br>
</div></div>