The -D flag worked perfectly. Thanks. Here&#39;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>&gt; %1\src\CMakeLists.txt</div>
<div>echo FIND_PACKAGE(ITK) <span class="Apple-tab-span" style="white-space:pre">                                                                </span>&gt;&gt; %1\src\CMakeLists.txt</div><div>echo IF(ITK_FOUND) <span class="Apple-tab-span" style="white-space:pre">                                                                </span>&gt;&gt; %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>&gt;&gt; %1\src\CMakeLists.txt</div><div>echo ELSE(ITK_FOUND) <span class="Apple-tab-span" style="white-space:pre">                                                                </span>&gt;&gt; %1\src\CMakeLists.txt</div>
<div>echo MESSAGE(FATAL_ERROR <span class="Apple-tab-span" style="white-space:pre">                                                        </span>&gt;&gt; %1\src\CMakeLists.txt</div><div>echo &quot;ITK not found. Please set ITK_DIR.&quot;) <span class="Apple-tab-span" style="white-space:pre">                                        </span>&gt;&gt; %1\src\CMakeLists.txt</div>
<div>echo ENDIF(ITK_FOUND) <span class="Apple-tab-span" style="white-space:pre">                                                                </span>&gt;&gt; %1\src\CMakeLists.txt</div><div>echo. <span class="Apple-tab-span" style="white-space:pre">                                                                                </span>&gt;&gt; %1\src\CMakeLists.txt</div>
<div>echo ADD_EXECUTABLE(%1 %1.cxx )  <span class="Apple-tab-span" style="white-space:pre">                                                </span>&gt;&gt; %1\src\CMakeLists.txt</div><div>echo. <span class="Apple-tab-span" style="white-space:pre">                                                                                </span>&gt;&gt; %1\src\CMakeLists.txt</div>
<div>echo TARGET_LINK_LIBRARIES(%1 ${ITK_LIBRARIES}) <span class="Apple-tab-span" style="white-space:pre">                                </span>&gt;&gt; %1\src\CMakeLists.txt</div><div>echo INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}) <span class="Apple-tab-span" style="white-space:pre">                                        </span>&gt;&gt; %1\src\CMakeLists.txt</div>
<div>echo INCLUDE_DIRECTORIES(C:/GitProjects/common) <span class="Apple-tab-span" style="white-space:pre">                                </span>&gt;&gt; %1\src\CMakeLists.txt</div><div><br></div><div>REM Make soure code</div><div>echo #include ^&lt;itkImage.h^&gt; <span class="Apple-tab-span" style="white-space:pre">                                                        </span>&gt;&gt; %1\src\%1.cxx</div>
<div>echo #include ^&lt;iostream^&gt; <span class="Apple-tab-span" style="white-space:pre">                                                        </span>&gt;&gt; %1\src\%1.cxx</div><div>echo. <span class="Apple-tab-span" style="white-space:pre">                                                                                </span>&gt;&gt; %1\src\%1.cxx</div>
<div>echo int main(int argc, char * argv[])<span class="Apple-tab-span" style="white-space:pre">                                                </span>&gt;&gt; %1\src\%1.cxx</div><div>echo { <span class="Apple-tab-span" style="white-space:pre">                                                                                </span>&gt;&gt; %1\src\%1.cxx</div>
<div>echo <span class="Apple-tab-span" style="white-space:pre">        </span>system(&quot;pause&quot;); <span class="Apple-tab-span" style="white-space:pre">                                                        </span>&gt;&gt; %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>&gt;&gt; %1\src\%1.cxx</div>
<div>echo } <span class="Apple-tab-span" style="white-space:pre">                                                                                </span>&gt;&gt; %1\src\%1.cxx</div><div><br></div><div>mkdir %1\build</div><div>cd %1\build</div><div>cmake -G &quot;Visual Studio 8 2005 Win64&quot; -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">&lt;<a href="mailto:cquammen@cs.unc.edu">cquammen@cs.unc.edu</a>&gt;</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 &lt;<a href="mailto:paniwani@gmail.com">paniwani@gmail.com</a>&gt; wrote:<br>
&gt; That works great for building ITK, but for specific projects I need to set<br>
&gt; the specific ITK_DIR because I have several flavors of ITK. How do I specify<br>
&gt; that directory as a parameter to cmake via command line?<br>
&gt;<br>
&gt; On Sun, Jun 5, 2011 at 7:28 PM, Luis Ibanez &lt;<a href="mailto:luis.ibanez@kitware.com">luis.ibanez@kitware.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; Hi Neil,<br>
&gt;&gt;<br>
&gt;&gt; from the command line,<br>
&gt;&gt; go to the binary directory<br>
&gt;&gt; where you want to build ITK<br>
&gt;&gt;<br>
&gt;&gt; and type<br>
&gt;&gt;<br>
&gt;&gt;   cmake   -G&quot;Visual Studio 9 2008 Win64&quot;<br>
&gt;&gt;      path_to_itk_source_tree<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; ---<br>
&gt;&gt;<br>
&gt;&gt; There are other options, but this is probably<br>
&gt;&gt; the simplest one.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;    Luis<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; ------------------------------------------------<br>
&gt;&gt; On Mon, May 30, 2011 at 11:25 PM, Neil Panjwani &lt;<a href="mailto:paniwani@gmail.com">paniwani@gmail.com</a>&gt;<br>
&gt;&gt; wrote:<br>
&gt;&gt; &gt; Does someone have a script (batch, python, etc) to run Cmake via the<br>
&gt;&gt; &gt; command<br>
&gt;&gt; &gt; line in Windows to build ITK projects?<br>
&gt;&gt; &gt; The only settings I need to change are source and bin directories,<br>
&gt;&gt; &gt; ITK_DIR,<br>
&gt;&gt; &gt; and the compiler (32 vs 64-bit). Thanks.<br>
&gt;&gt; &gt; _____________________________________<br>
&gt;&gt; &gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Visit other Kitware open-source projects at<br>
&gt;&gt; &gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Kitware offers ITK Training Courses, for more information visit:<br>
&gt;&gt; &gt; <a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Please keep messages on-topic and check the ITK FAQ at:<br>
&gt;&gt; &gt; <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Follow this link to subscribe/unsubscribe:<br>
&gt;&gt; &gt; <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;<br>
&gt;<br>
&gt; _____________________________________<br>
&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;<br>
&gt; Visit other Kitware open-source projects at<br>
&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;<br>
&gt; Kitware offers ITK Training Courses, for more information visit:<br>
&gt; <a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
&gt;<br>
&gt; Please keep messages on-topic and check the ITK FAQ at:<br>
&gt; <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
&gt;<br>
&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
&gt;<br>
&gt;<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>