File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,7 +34,15 @@ function(embed_binary INPUT_PATH INPUT_FILE OUTPUT_OBJ_VAR)
3434 endif ()
3535 if (CMAKE_OSX_DEPLOYMENT_TARGET)
3636 if (CMAKE_SYSTEM_NAME STREQUAL "iOS" )
37- list (APPEND _asm_flags "-mios-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} " )
37+ # Distinguish device vs simulator: -mios-version-min tags objects as iOS
38+ # device, while -mios-simulator-version-min tags them as iOS simulator.
39+ # Using the wrong flag causes linker errors ("built for 'iOS'" when
40+ # linking for iOS-simulator).
41+ if (CMAKE_OSX_SYSROOT MATCHES "iphonesimulator" )
42+ list (APPEND _asm_flags "-mios-simulator-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} " )
43+ else ()
44+ list (APPEND _asm_flags "-mios-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} " )
45+ endif ()
3846 else ()
3947 list (APPEND _asm_flags "-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} " )
4048 endif ()
You can’t perform that action at this time.
0 commit comments