Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent Cmake from creating Debug/Release folders under EXECUTABLE_OUTPUT_PATH?

Tags:

cmake

I set EXECUTABLE_OUTPUT_PATH as ${CMAKE_BINARY_DIR}/bin but the executable is created in ${CMAKE_BINARY_DIR}/bin/Debug or ${CMAKE_BINARY_DIR}/bin/Release.

How can I make it put all output under ${CMAKE_BINARY_DIR}/bin without Debug/Release folders?

like image 249
ozgur Avatar asked Jul 28 '17 08:07

ozgur


2 Answers

Set variable CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG to the directory which will be used "as is" for Debug builds. Similarly, for Release builds variable CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE is used.

While you may set both these variables to the same value, note that executables created for release builds will overwrite ones for debug builds, which is not natural with CMake.

like image 151
Tsyvarev Avatar answered Nov 05 '22 07:11

Tsyvarev


CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE all letter must be capital,i wrote as CMAKE_RUNTIME_OUTPUT_DIRECTORY_Release and it didn't work.so stupid i am

like image 30
DaHeiBuHei Avatar answered Oct 23 '22 05:10

DaHeiBuHei