All I have to say is that you all rocks :-)

Brandon Van Every, excuse my ignorance but what documentation are you
refering to ?
The cmake book ? I'm still student I can't afford a big book for a
compilation system, even if it's the greatest.
Maybe a "cmake quick guide" book just under the "mastering cmake" book could
be a good idea :)

* <javascript:document.masteringcmake.submit()>* On 12/15/06, Mike Jackson <
[EMAIL PROTECTED]> wrote:

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..
This is how I set up my projects currently.

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:

#------ Setup output Directories ---------------------------------
SET (LIBRARY_OUTPUT_PATH
${PROJECT_BINARY_DIR}/Bin
CACHE PATH
"Single Directory for all Libraries"
)

#------ Setup the Executable output Directory
---------------------------------
SET (EXECUTABLE_OUTPUT_PATH
${PROJECT_BINARY_DIR}/Bin
CACHE PATH
"Single Directory for all Executables."
)

I am going to assume a unix/terminal environment. Make the adjustments to
tools for XP.

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.
Now type "make" in the same directory and your binaries will be built
inside "./Build/Bin".

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.

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.

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.

Good Luck.
--
Mike Jackson   Senior Research Engineer
Innovative Management & Technology Services


On Dec 15, 2006, at 8:26 AM, Mehdi Rabah wrote:

Hi everyone,

I'm new to cmake, and there's something simple I don't know how to do.
Here what I wrote in CMakeLists.txt so far:

project(test)
subdirs(src)

and in src directory I have another CMakeLists.txt :

add_executable(testApp Applications/testApp.cpp)

and what I want is that the compilation result of testApp.cpp goes into
the ./bin directory, but by default it goes into ./src
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.

How to set cmake so it write the binary in ./bin ?
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 ?

Regards,

Mehdi


_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake



_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to