The -D flag worked perfectly. Thanks. Here's my script (.bat) for future developers:<div><br></div><div><div><div>@echo off</div><div>REM %1: project name</div><div><br></div><div>REM check if user entered an argument</div>
<div>if [%1]==[] goto error1</div><div>if exist %1 goto error2</div><div><br></div><div>REM Make CMake file</div><div>mkdir %1\src</div><div>echo PROJECT(%1) <span class="Apple-tab-span" style="white-space:pre">                                                                </span>> %1\src\CMakeLists.txt</div>
<div>echo FIND_PACKAGE(ITK) <span class="Apple-tab-span" style="white-space:pre">                                                                </span>>> %1\src\CMakeLists.txt</div><div>echo IF(ITK_FOUND) <span class="Apple-tab-span" style="white-space:pre">                                                                </span>>> %1\src\CMakeLists.txt</div>
<div>echo <span class="Apple-tab-span" style="white-space:pre">        </span>INCLUDE(${ITK_USE_FILE}) <span class="Apple-tab-span" style="white-space:pre">                                                </span>>> %1\src\CMakeLists.txt</div><div>echo ELSE(ITK_FOUND) <span class="Apple-tab-span" style="white-space:pre">                                                                </span>>> %1\src\CMakeLists.txt</div>
<div>echo MESSAGE(FATAL_ERROR <span class="Apple-tab-span" style="white-space:pre">                                                        </span>>> %1\src\CMakeLists.txt</div><div>echo "ITK not found. Please set ITK_DIR.") <span class="Apple-tab-span" style="white-space:pre">                                        </span>>> %1\src\CMakeLists.txt</div>
<div>echo ENDIF(ITK_FOUND) <span class="Apple-tab-span" style="white-space:pre">                                                                </span>>> %1\src\CMakeLists.txt</div><div>echo. <span class="Apple-tab-span" style="white-space:pre">                                                                                </span>>> %1\src\CMakeLists.txt</div>
<div>echo ADD_EXECUTABLE(%1 %1.cxx ) <span class="Apple-tab-span" style="white-space:pre">                                                </span>>> %1\src\CMakeLists.txt</div><div>echo. <span class="Apple-tab-span" style="white-space:pre">                                                                                </span>>> %1\src\CMakeLists.txt</div>
<div>echo TARGET_LINK_LIBRARIES(%1 ${ITK_LIBRARIES}) <span class="Apple-tab-span" style="white-space:pre">                                </span>>> %1\src\CMakeLists.txt</div><div>echo INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}) <span class="Apple-tab-span" style="white-space:pre">                                        </span>>> %1\src\CMakeLists.txt</div>
<div>echo INCLUDE_DIRECTORIES(C:/GitProjects/common) <span class="Apple-tab-span" style="white-space:pre">                                </span>>> %1\src\CMakeLists.txt</div><div><br></div><div>REM Make soure code</div><div>echo #include ^<itkImage.h^> <span class="Apple-tab-span" style="white-space:pre">                                                        </span>>> %1\src\%1.cxx</div>
<div>echo #include ^<iostream^> <span class="Apple-tab-span" style="white-space:pre">                                                        </span>>> %1\src\%1.cxx</div><div>echo. <span class="Apple-tab-span" style="white-space:pre">                                                                                </span>>> %1\src\%1.cxx</div>
<div>echo int main(int argc, char * argv[])<span class="Apple-tab-span" style="white-space:pre">                                                </span>>> %1\src\%1.cxx</div><div>echo { <span class="Apple-tab-span" style="white-space:pre">                                                                                </span>>> %1\src\%1.cxx</div>
<div>echo <span class="Apple-tab-span" style="white-space:pre">        </span>system("pause"); <span class="Apple-tab-span" style="white-space:pre">                                                        </span>>> %1\src\%1.cxx</div><div>echo <span class="Apple-tab-span" style="white-space:pre">        </span>return 0; <span class="Apple-tab-span" style="white-space:pre">                                                                </span>>> %1\src\%1.cxx</div>
<div>echo } <span class="Apple-tab-span" style="white-space:pre">                                                                                </span>>> %1\src\%1.cxx</div><div><br></div><div>mkdir %1\build</div><div>cd %1\build</div><div>cmake -G "Visual Studio 8 2005 Win64" -D ITK_DIR:PATH=C:/InsightToolkit-3.20.0/build64 ../src</div>
<div>%1.sln</div><div>exit</div><div><br></div><div>goto end</div><div><br></div><div>:error1</div><div>echo Error: Please enter project name as argument.</div><div>echo.</div><div>goto end</div><div><br></div><div>:error2</div>
<div>echo Error: Project already exists. Enter a new project name.</div><div>echo.</div><div><br></div><div>:end</div></div><div><br></div><div><br></div><div class="gmail_quote">On Mon, Jun 6, 2011 at 10:04 AM, Cory Quammen <span dir="ltr"><<a href="mailto:cquammen@cs.unc.edu">cquammen@cs.unc.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Neil,<br>
<br>
To set a specific ITK_DIR in a project that uses ITK, the command line option is<br>
<br>
-D ITK_DIR:STRING=/path/to/ITK/flavor/build<br>
<br>
If I recall correctly, it should appear before the -G option.<br>
<br>
Hope that helps,<br>
<br>
Cory<br>
<div><div></div><div class="h5"><br>
On Mon, Jun 6, 2011 at 9:52 AM, Neil Panjwani <<a href="mailto:paniwani@gmail.com">paniwani@gmail.com</a>> wrote:<br>
> That works great for building ITK, but for specific projects I need to set<br>
> the specific ITK_DIR because I have several flavors of ITK. How do I specify<br>
> that directory as a parameter to cmake via command line?<br>
><br>
> On Sun, Jun 5, 2011 at 7:28 PM, Luis Ibanez <<a href="mailto:luis.ibanez@kitware.com">luis.ibanez@kitware.com</a>> wrote:<br>
>><br>
>> Hi Neil,<br>
>><br>
>> from the command line,<br>
>> go to the binary directory<br>
>> where you want to build ITK<br>
>><br>
>> and type<br>
>><br>
>> cmake -G"Visual Studio 9 2008 Win64"<br>
>> path_to_itk_source_tree<br>
>><br>
>><br>
>> ---<br>
>><br>
>> There are other options, but this is probably<br>
>> the simplest one.<br>
>><br>
>><br>
>> Luis<br>
>><br>
>><br>
>> ------------------------------------------------<br>
>> On Mon, May 30, 2011 at 11:25 PM, Neil Panjwani <<a href="mailto:paniwani@gmail.com">paniwani@gmail.com</a>><br>
>> wrote:<br>
>> > Does someone have a script (batch, python, etc) to run Cmake via the<br>
>> > command<br>
>> > line in Windows to build ITK projects?<br>
>> > The only settings I need to change are source and bin directories,<br>
>> > ITK_DIR,<br>
>> > and the compiler (32 vs 64-bit). Thanks.<br>
>> > _____________________________________<br>
>> > Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>> ><br>
>> > Visit other Kitware open-source projects at<br>
>> > <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>> ><br>
>> > Kitware offers ITK Training Courses, for more information visit:<br>
>> > <a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
>> ><br>
>> > Please keep messages on-topic and check the ITK FAQ at:<br>
>> > <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
>> ><br>
>> > Follow this link to subscribe/unsubscribe:<br>
>> > <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
>> ><br>
>> ><br>
><br>
><br>
> _____________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Kitware offers ITK Training Courses, for more information visit:<br>
> <a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
><br>
> Please keep messages on-topic and check the ITK FAQ at:<br>
> <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
><br>
><br>
<br>
<br>
<br>
</div></div><font color="#888888">--<br>
Cory Quammen<br>
Computer Integrated Systems for Microscopy and Manipulation (CISMM)<br>
Department of Computer Science<br>
University of North Carolina at Chapel Hill<br>
<a href="http://www.cs.unc.edu/~cquammen" target="_blank">http://www.cs.unc.edu/~cquammen</a><br>
</font></blockquote></div><br></div>