[CMake] Defining output.

Brad King brad.king at kitware.com
Mon Feb 20 16:42:30 EST 2006


Jan Palach wrote:
> I trying to compile a library I developed in c++ with cmake. The problem 
> is that I have many files with the same name in  different directories. 
> Is there a way to indicate cmake to put the generated binaries in the 
> same structure as they are inside the project?. Can I indicate cmake to 
> put this files in a specific place?, How do I do this?.

By default executables and libraries go to the build tree locations 
corresponding to the source directory that added them.  Setting 
EXECUTABLE_OUTPUT_PATH and LIBRARY_OUTPUT_PATH at the top of the project 
will put all targets in the given directories.

I'm not sure what you mean by "many files with the same name".  If it is 
many source files each in a differently-named executable then that will 
not be a problem.  If you have an executable of the same name in every 
directory that is a problem.  Due to the limitations of Visual Studio 
and Xcode generators there can be only one target with a given name. 
However the logical name of the target and the name on disk do not have 
to be the same.  You can use SET_TARGET_PROPERTIES to set a target's 
OUTPUT_NAME property to change its name on disk.

-Brad


More information about the CMake mailing list