[CMake] How to use Xcode's macros together with XCODE_ATTRIBUTE_<an_attribute>?

Pedro d'Aquino budsbd at gmail.com
Thu Jul 15 14:26:42 EDT 2010


Hello,

I'm using CMake to build a Mac OS X app, generating an Xcode project. I have
two targets, say "projApp" and "projLib". I'd like for them to be built in
such a way that projLib's output is installed in a subdirectory of projApp's
output folder. I tried this:

set_target_properties(projApp PROPERTIES RUNTIME_OUTPUT_DIRECTORY
path/to/somewhere)
set_target_properties(projLib PROPERTIES LIBRARY_OUTPUT_DIRECTORY
path/to/somewhere/lib)

The thing is, Xcode actually puts projApp in
path/to/somewhere/[Debug|Release|RelWithDebInfo|MinSizeRel], so that doesn't
work. The configuration that controls this is called "Per-configuration
build products path", or CONFIGURATION_BUILD_DIR, whose default value is
$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME).  Then I tried this:

set_target_properties(projApp PROPERTIES RUNTIME_OUTPUT_DIRECTORY
path/to/somewhere)
set_target_properties(projLib PROPERTIES
XCODE_ATTRIBUTE_CONFIGURATION_BUILD_DIR
path/to/somewhere/$(CONFIGURATION)/lib)

Which should override CONFIGURATION_BUILD_DIR for projLib, thus putting it
in the right directory. However, when I try to open the generated xcodeproj,
Xcode says it can't parse the file and refuses to open the project.
Investigating further, it seems that any use of a $(VAR) macro in an Xcode
attribute renders the .xcodeproj unparsable.

Does anyone have any experience doing this? Is there perhaps an easier way
to achieve what I want?

Thanks,

Pedro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100715/5b1933b7/attachment.htm>


More information about the CMake mailing list