[cmake-developers] Fixing bug #12506 (iOS install)

Gregor Jasny gjasny at googlemail.com
Wed Aug 26 15:53:42 EDT 2015


Hallo,

On 13/08/15 12:56, Ruslan Baratov wrote:
> On 13-Aug-15 08:46, Gregor Jasny wrote:
>> On 13/08/15 01:44, Ruslan Baratov via cmake-developers wrote:
>>> Sending patches with fix. Now it's possible to install simulator
>>> libraries by:
>>>
>>>  > cmake --build _builds --config Release --target install -- -sdk
>>> iphonesimulator
>>>
>>> and device libraries by:
>>>
>>>  > cmake --build _builds --config Release --target install -- -sdk
>>> iphoneos
>>>
>>> or from Xcode IDE (build target install).
>>>
>>> However this commands will install both libraries to the same location.
>>> This behaviour can be improved by adding some code that will do lipo of
>>> all libraries before install (i.e. universal libraries will be
>>> installed). This can be achieved by using ONLY_ACTIVE_ARCHS=NO while
>>> running Xcode build. The only question is about making install target
>>> depends on two type of builds (-sdk iphonesimulator and -sdk iphoneos).
>>
>> This was my preliminary work:
>>> https://github.com/gjasny/CMake/commit/978dca25ac387bdec894a1ba2c934317f5f6169f
>>>
>>
> This looks great! I've spent several hours trying to figure out how
> '$(EFFECTIVE_PLATFORM_NAME)' can be set to Xcode and some CMake friendly
> string to cmake_install.cmake script. I didn't know Xcode understand
> `${VAR}` syntax (probably it didn't, it's just expanded as an
> environment variable). I've tested your fix and it works fine for me.
> Since we don't need to replace string with path manually I think your
> solution is neater. I've added description to commit and rebased it, see
> attachment.

I just pushed the fix-ios-install topic including a test. Basically the
patch changes the invocation line of the script from

cmake -DBUILD_TYPE=Release-iphoneos -P cmake_install.cmake

to

cmake -DBUILD_TYPE=Release -DEFFECTIVE_PLATFORM_NAME=-iphoneos -P
cmake_install.cmake

and within the install script

file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/lib" TYPE
STATIC_LIBRARY FILES ".../Release/libfoo.a")


to

file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/lib" TYPE
STATIC_LIBRARY FILES ".../Release${EFFECTIVE_PLATFORM_NAME}/libfoo.a")


By keeping the ${EFFECTIVE_PLATFORM_NAME} a variable one is able to use
the same install script for iphoneos and iphonesimulator SDKs.

Please review and merge.

Thanks,
Gregor


More information about the cmake-developers mailing list