[CMake] Object library doesn't work with CMake 2.8.10.2 Xcode generator

Brad King brad.king at kitware.com
Fri Jan 4 09:42:32 EST 2013


On 01/03/2013 04:33 PM, Bin Chen wrote:
> clang: error: no such file or directory: '/Users/bchen/share/temp/cmake-obj-lib/b-xcode/Debug/liba.a'
> clang: error: no such file or directory: '/Users/bchen/share/temp/cmake-obj-lib/b-xcode/Debug/libb.a'

Xcode does not seem to recognize targets that do not actually list any
source files to compile.  It looks like our ObjectLibrary test has a
workaround for this by adding an empty "dummy.c":

 http://cmake.org/gitweb?p=cmake.git;a=blob;f=Tests/ObjectLibrary/CMakeLists.txt;hb=v2.8.10.2#l22

I just updated the documentation to note this suggestion:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=51988a4f

> Searched the build tree, it generated two libs with _obj.
> 
> ./test.build/Debug/a_obj.build/Objects-normal/liba_obj.a
> ./test.build/Debug/b_obj.build/Objects-normal/libb_obj.a

Xcode treats object files as intermediate products rather than first-class
so the only way to implement the compilation part of object libraries is
to pretend they are static libraries and then hide the .a files away where
no one should be bothered by them.  Ignore those.

-Brad


More information about the CMake mailing list