<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; ">I am not going to tackle the point of how many CMakeLists.txt files you should have but I can tell you how to avoid all the CMake temp stuff.. <DIV><BR class="khtml-block-placeholder"></DIV><DIV>This is how I set up my projects currently.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>It looks as though we have similar arrangements of our source codes. So first, in your top level CMakeLists.txt file add the following AFTER the "project()" line but BEFORE the "subdirs()" line:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>#------ Setup output Directories ---------------------------------</DIV><DIV>SET (LIBRARY_OUTPUT_PATH</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>${PROJECT_BINARY_DIR}/Bin</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>CACHE PATH</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>"Single Directory for all Libraries"</DIV><DIV>)</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>#------ Setup the Executable output Directory ---------------------------------</DIV><DIV>SET (EXECUTABLE_OUTPUT_PATH</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>${PROJECT_BINARY_DIR}/Bin</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>CACHE PATH</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>"Single Directory for all Executables."</DIV><DIV>)</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I am going to assume a unix/terminal environment. Make the adjustments to tools for XP.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Now, what you do is create a directory at the same level as the top level CMakeLists.txt file, call it "Build". Now "cd" into the "Build" directory then run "cmake ../". This will generate all the CMake files and other stuff _inside_ the Build directory thus keeping your source tree clean. </DIV><DIV>Now type "make" in the same directory and your binaries will be built inside "./Build/Bin".</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>This makes things very convenient when you want to submit your source to CVS or clean out all the built products. Just blow away everything inside "Build" and redo the cmake.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I choose to do it this way because I use Eclipse with the CDT plugins to do C++ development. Eclipse/CDT works better if the built binaries are _within_ the project directory.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Kitware and others may tell you to do a true "out of source" build which means that you would create a directory at the same level as your main project directory, lets call it "test-build", and then from within "test-build" do a "cmake ../test". This is absolutely valid way to do things and depending on the size of your project may be preferable. I can not image using my method on a project like ParaView or VTK. It would work, but with a project _that_ large I would want to keep the project directories and the build directories distinctly separate.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Good Luck.</DIV><DIV><DIV> <SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Bitstream Vera Sans; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-- </DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Mike Jackson   Senior Research Engineer</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Innovative Management &amp; Technology Services</DIV><BR class="Apple-interchange-newline"></SPAN> </DIV><BR><DIV><DIV>On Dec 15, 2006, at 8:26 AM, Mehdi Rabah wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite">Hi everyone,<BR><BR>I'm new to cmake, and there's something simple I don't know how to do.<BR>Here what I wrote in CMakeLists.txt so far:<BR><BR>project(test)<BR>subdirs(src)<BR><BR>and in src directory I have another CMakeLists.txt :<BR><BR>add_executable(testApp Applications/testApp.cpp) <BR><BR>and what I want is that the compilation result of testApp.cpp goes into the ./bin directory, but by default it goes into ./src<BR>I use ccmake to set it to go to the bin directory, but when I run the compilation the makefile create a src/bin and use it. <BR><BR>How to set cmake so it write the binary in ./bin ?<BR>Also, in src I have a lot of temporary files (cmake_install.cmake, CMakeFiles, ...), how can I avoid having this in my subdirectories ? Should I write one only CMakeLists.txt in the root directory ?<BR><BR>Regards,<BR><BR>Mehdi<BR><BR><BR><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">_______________________________________________</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">CMake mailing list</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="mailto:CMake@cmake.org">CMake@cmake.org</A></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="http://www.cmake.org/mailman/listinfo/cmake">http://www.cmake.org/mailman/listinfo/cmake</A></DIV> </BLOCKQUOTE></DIV><BR></DIV></BODY></HTML>