[CMake] Executable in the main directory

Enrique Izaguirre enrique.izaguirre at gmail.com
Wed Feb 2 16:53:22 EST 2011


Thanks a lot Eric

Actually I am trying to move a project already done to CMake, and it doesn't
have any executable in the top directory, it is now done in Windows under
Visual Studio.

In the top directory I have a CMakeLists,txt that calls each one of the
subdirectories in which I have also their respective CMakeLIsts.txt.

But I don't know at the end how to put everything together in an executable.
Because each directory compiles independently, like a module. I don't know
how it is done in Visual Studio.

Thanks again

Enrique

On Wed, Feb 2, 2011 at 3:42 PM, Eric Noulard <eric.noulard at gmail.com> wrote:

> 2011/2/2 Enrique Izaguirre <enrique.izaguirre at gmail.com>:
> > Hello,
> >
> > Is it possible to create an executable in your top directory if you don't
> > have there any program? I mean, if all your programs .c and .cpp are in
> > subdirectories contained in your top directory, each one with its own
> > CMakeLists.txt.
> >  I have three subdirectories, and all my programs are in these
> > subdirectories. I don't have any in my main directory, but the executable
> > should be created in the main directoy. Is it possible? How?
>
> Yes you can.
>
> You can control the output directory for executable/library using
> EXECUTABLE_OUTPUT_PATH
> and/or
> LIBRARY_OUTPUT_PATH
> see;
> http://www.cmake.org/Wiki/CMake_Useful_Variables
>
> From your question, I think you may be trying to do something that
> is not in the CMake-way-of-building.
>
> First of all using CMake ones tends to suggest to build 'out-of-tree':
> http://www.cmake.org/Wiki/CMake_FAQ#Out-of-source_build_trees
>
> Then do you need your executables "in the top dir" for devel purpose
> or something else?
>
>
> --
> Erk
> Membre de l'April - « promouvoir et défendre le logiciel libre » -
> http://www.april.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110202/f00770ba/attachment.htm>


More information about the CMake mailing list