[CMake] Change the default output path in Visual Studio
Petr Bena
benapetr at gmail.com
Mon Mar 30 09:36:29 EDT 2015
Hi Nils,
Great! Could you please give me some mininal example and perhaps add
it to documentation page which is now kind of vague? From what is
written there, I suppose that this variable changes the runtime output
directory, but for all targets since it's set and until it's changed?
eg. if I have huge CMakeLists.txt file that includes other CMake files
using add_subdirectory I would wrap all add_subdirectory directives
with change to this variable? like:
RUNTIME_OUTPUT_DIRECTORY("extensions/")
add_subdirectory("extension/ext1")
# Now I should reset it back to what it was?
RUNTIME_OUTPUT_DIRECTORY("WHAT DO I PUT HERE??")
On Mon, Mar 30, 2015 at 3:31 PM, Nils Gladitz <nilsgladitz at gmail.com> wrote:
> 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