[CMake] How to configure build output directory

Tron Thomas tron.thomas at verizon.net
Thu Jan 29 21:47:01 EST 2009


The point about the PATH needed for DLL's under this directory structure 
is something I forgot to take into account when I was contemplating how 
to organize things.  It would not work out well with what I had in 
mind.  Given that, I think I will have to consider a different strategy.

Philip Lowman wrote:
> On Tue, Jan 27, 2009 at 10:34 PM, Tron Thomas <tron.thomas at verizon.net 
> <mailto:tron.thomas at verizon.net>> wrote:
>
>     I want to use CMake to configure a project that will build several
>     applications.  I would like things such that each built program
>     ends up in a directory path like:
>     .../BuildDirectory/Debug/ApplicationName/AppliationName(.exe)
>
>
>     What is needed to cause CMake to configure this kind of build output?
>
>
> I'm not sure if you'll be able to easily get the "Debug" prior to the 
> "ApplicationName" because usually Visual Studio adds that.  If you can 
> live with "ApplicationName/Debug/ApplicationName.exe" the following 
> might work for you:
>
> add_execuable(ApplicationName foo.cc)
> set_target_properties(ApplicationName PROPERTIES 
> RUNTIME_OUTPUT_DIRECTORY ApplicationName)
>
> I would only consider this if you are building all static executables 
> or are willing to live with using the PATH environment variable to 
> keep DLLs in your path.  Otherwise you're very quickly going to run 
> into a problem running one or more of your executables and you'll have 
> to copy DLLs to every folder.
>
> -- 
> Philip Lowman




More information about the CMake mailing list