[CMake] Configuring different output file names for debug and
release
Mike Jackson
imikejackson at gmail.com
Fri May 11 09:48:04 EDT 2007
On May 11, 2007, at 9:35 AM, Joshua Jensen wrote:
> 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
I used to try an fight Xcode on the Debug/Release folders and I
basically gave up. It was too much messing around with Cmake and
Xcode to be worth it. I just let Cmake do its thing and Xcode do its
thing and everything seems to work out just fine. I can build and
debug without a problem.
<shameless plug> I actually use Eclipse with the CDT plugin to do VTK/
Qt C++ development on the Mac. Combined with CMake and a few changes
to the default Eclipse settings is a great combination</shameless plug>
--
Mike Jackson Senior Research Engineer
Innovative Management & Technology Services
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20070511/81dad4af/attachment.htm
More information about the CMake
mailing list