[CMake] Change the default output path in Visual Studio

Nils Gladitz nilsgladitz at gmail.com
Mon Mar 30 09:31:08 EDT 2015


On 03/30/2015 03:25 PM, Petr Bena wrote:
> I have following problem:
>
> I got a project with plugins, each plugin and core is a separate cmake
> project, however core includes all of them
>
> When I configure "core" it also configures all plugins and running
> "make" also make core, all libraries and plugins.
>
> My problem however is the default location of these plugins in Visual
> Studio, the default folder layout is:
>
> CORE/Release/program.exe
> CORE/extensions/ext1/Release/extension1.dll
> CORE/extensions/ext2/Release/extension_bla.dll
>
> What I need is:
>
> CORE/Release/program.exe
> CORE/Release/extensions/extension1.dll
> CORE/Release/extensions/extension_bla.dll
>
> I can do this by right clicking every single extension -> project
> config -> output path in Visual Studio. But everytime I rerun cmake
> which generates solution files I have to do that again and it's quite
> annoying, is there a way to make the default output path different?
>

You could set CMAKE_RUNTIME_OUTPUT_DIRECTORY [1] (before you create your 
targets).

Nils

[1] 
http://www.cmake.org/cmake/help/v3.2/variable/CMAKE_RUNTIME_OUTPUT_DIRECTORY.html


More information about the CMake mailing list