[CMake] How to specify build output directory path?

David Aldrich david.aldrich.ntml at gmail.com
Wed Nov 13 12:34:54 EST 2019


Hi

I am rather confused about how to specify the output directory. I am
working on Windows with the Ninja generator and Microsoft toolset. My
default build type is Debug.  I am building a library and an executable:

add_subdirectory(../Kernel Kernel)
add_executable(MyExe ../Kernel/main.cpp)

The resulting directory structure, after a build, is:

Kernel       <== source files
    |--CMakeLists.txt
CMake
    |--CMakeLists.txt
    |-- build_msvc
            |--Kernel          <== library goes here
            |--debug          <==  exe goes here

I want the Kernel library to go into the 'debug' folder (where the exe is
correctly being put).

$CMAKE_RUNTIME_OUTPUT_DIRECTORY and  $RUNTIME_OUTPUT_DIRECTORY are
undefined.

How would I achieve this?

Which variable holds the exe output path: build_msvc/debug?

Best regards
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20191113/6ce640e7/attachment.html>


More information about the CMake mailing list