[CMake] Eliminate Debug/Release directories and name executables based on configuration

James Ihrig jeihrig at gmail.com
Mon Aug 9 14:23:17 EDT 2010


Hello,

I'm using CMake for Visual Studio as well as Makefiles for Linux. In
windows, debug and release directories seem to be added for the executables.

I actually would like to do three things:

1) Test for a debug or release build
2) Name the executable created based on it's build. (myProgram_d.exe for
debug, myProgram.exe for release.)
3) Place the output executables into the bin directory without debug and
release directories.

I have not found a way to test for the build type but I have tried these
together, and in various combinations:

set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/../Demo/bin)
set(RUNTIME_OUTPUT_BINARY ${PROJECT_BINARY_DIR}/../Demo/bin)
set(RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PROJECT_BINARY_DIR}/../Demo/bin)
set(RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJECT_BINARY_DIR}/../Demo/bin)
set(RUNTIME_OUTPUT_NAME_DEBUG demo_d.exe)
set(RUNTIME_OUTPUT_NAME_RELEASE demo.exe)

The closest I can come are these executables:
Demo\bin\Debug\helloDemo.exe
Demo\bin\Release\helloDemo.exe

What I want is:
Demo\bin\demo_d.exe
Demo\bin\demo.exe

Any help or suggestions would be greatly appreciated!
-Jim


P.S.
For anyone curious what my main CMakeLists.txt looks like, here it is:
http://codepad.org/Yuev7TWJ
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100809/c5a90dc1/attachment.htm>


More information about the CMake mailing list