[CMake] Configuring different output file names for debug and
release
Joshua Jensen
jjensen at workspacewhiz.com
Fri May 11 09:35:43 EDT 2007
Mike Jackson wrote:
> On May 11, 2007, at 7:55 AM, Angel Riesgo wrote:
>> My second question is how I can prevent CMake from adding "debug" and
>> "release" intermediate directories to the output path. In the
>> CMakeLists.txt file, I am setting LIBRARY_OUTPUT_PATH to a path
>> ending in lib/win/, but the Visual C++ project always has an extra
>> $(OutDir) appended to that. This means that the actual output
>> directory ends up being lib/win/debug or lib/win/release, which is
>> not what we want.
> Visual Studio adds the Debug and Release folders on its own. I have
> not found a way to change this although my knowledge of VC++ is limited.
Ignoring CMake, Visual Studio sets these directories via the Output
Directory project property. If the Linker Output File is a relative
path, the final name is Output Directory + Linker Output File. If the
Linker Output File is an absolute path, the final destination is just
Linker Output File.
In CMake, Linker Output File is an absolute path. The path scoping is
set by CMake itself. For my project, we have an image/ directory which
is supposed to be a near representation of the shipping build:
* image/
* Pathstorm.debug.exe
* Pathstorm.release.exe (yes, these both exist in the same
directory)
* Pathstorm.exe (a final shipping build)
* Various assets of large size such that having multiple copies
on the hard drive would just be a waste of space as they are shared by
the executables in this directory.
I was able to coax CMake into doing the following:
SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/image)
IF (CMAKE_GENERATOR MATCHES "Visual Studio")
SET_TARGET_PROPERTIES(${TargetName} PROPERTIES PREFIX "../")
SET_TARGET_PROPERTIES(${TargetName} PROPERTIES DEBUG_POSTFIX
".debug")
SET_TARGET_PROPERTIES(${TargetName} PROPERTIES RELEASE_POSTFIX
".release")
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio")
IF (CMAKE_GENERATOR MATCHES "Xcode")
# SET_TARGET_PROPERTIES(${TargetName} PROPERTIES PREFIX "../")
# SET_TARGET_PROPERTIES(${TargetName} PROPERTIES DEBUG_POSTFIX
"Debug")
# SET_TARGET_PROPERTIES(${TargetName} PROPERTIES RELEASE_POSTFIX
"Release")
ENDIF(CMAKE_GENERATOR MATCHES "Xcode")
Note that I tried to do it with Xcode, too. It only half worked. The
debugger would not recognize the executable, and I could never debug my
applications. :(
Josh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20070511/c6ffd61e/attachment.html
More information about the CMake
mailing list