[CMake] Xcode path issue

Michael Wild themiwi at gmail.com
Thu Jan 14 14:50:07 EST 2010


On 14. Jan, 2010, at 17:33 , Timothy Reaves wrote:

> 	Hello all.
> 
> 	In one of the projects I work on that uses cmake, there are lines of code like so:
> SET(SSPL ${SSPL} "${CMAKE_BINARY_DIR}/plugins/HelloStelModule/src/libHelloStelModule.a")
> and that seems to work for Linux and Windows.  But it doesn't on Mac with Xcode.  With Xcode, under ${CMAKE_BINARY_DIR} there is Debug and Release - a directory per variant I guess.
> 
> 	I can not seem to find the correct way to handle this.  Currently, I wait for the build to fail, then do this:
> ln -s `pwd`/src/Debug/libStelGuiLib.a src/
> to create a symlink from the location under Debug or Release to the root level.  What is the correct way?  
> 
> 	Thanks!


If libHelloStelModule.a is a CMake target, you don't need to specify its full path, you can use the target name for most purposes. If that isn't enough, put ${CMAKE_CFG_INTDIR} in the right place. This will resolve to Debug, Release etc. at build time. However, it can be tricky to use this variable correctly, because at CMake time it only expands to $(Configuration) (with the Xcode generator) or . (with the Makefile generator). So you must make sure that Xcode sees the $(Configuration) on the command line in order to get substituted correctly.

HTH

Michael



More information about the CMake mailing list