summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake
blob: 7d14d195faf5b924fd9ad0c5686eca75987b1986 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
cmake_minimum_required(VERSION 3.3)

project(XcodeIOSInstallCombinedPrune CXX)

if(XCODE_VERSION VERSION_GREATER_EQUAL 9)
  set(CMAKE_OSX_DEPLOYMENT_TARGET 10)
endif()

set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf")

add_library(foo SHARED foo.cpp)
install(TARGETS foo DESTINATION lib)

add_library(baz SHARED foo.cpp)
set_target_properties(
  foo baz
  PROPERTIES
  XCODE_ATTRIBUTE_ARCHS[sdk=iphoneos*] armv7
  XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphoneos*] armv7
  XCODE_ATTRIBUTE_ARCHS[sdk=iphonesimulator*] x86_64
  XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphonesimulator*] x86_64
)

add_library(boo SHARED foo.cpp)
set_target_properties(
  boo
  PROPERTIES
  XCODE_ATTRIBUTE_ARCHS[sdk=iphoneos*] arm64
  XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphoneos*] arm64
  XCODE_ATTRIBUTE_ARCHS[sdk=iphonesimulator*] i386
  XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphonesimulator*] i386
)

add_custom_command(
  TARGET foo
  POST_BUILD
  COMMAND lipo -create $<TARGET_FILE:baz> $<TARGET_FILE:boo> -output $<TARGET_FILE:foo>
)