[CMake] simple question

Brandon J. Van Every bvanevery at gmail.com
Fri Dec 15 08:40:08 EST 2006


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

from the 2.4.5 docs:
ADD_SUBDIRECTORY(source_dir [binary_dir] [EXCLUDE_FROM_ALL])

You want:

PROJECT(test)
ADD_SUBDIRECTORY(src bin)


>
> Also, in src I have a lot of temporary files (cmake_install.cmake, 
> CMakeFiles, ...), how can I avoid having this in my subdirectories ? 

Do an out-of-directory build.  Then your src tree is never polluted by 
anything.


> Should I write one only CMakeLists.txt in the root directory ?

If your project is very simple, yes.



Cheers,
Brandon Van Every

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20061215/0b1c3fc2/attachment.htm


More information about the CMake mailing list