sheldonth/ios-cmake

-DIOS_PLATFORM=SIMULATOR not working with cmake 3.7.1

R1kk3r opened this issue · 2 comments

At line 75, the if/elseif/else branches use ${IOS_PLATFORM} with STREQUAL. Because the SIMULATOR variable exist as well, cmake sometimes dereference the string SIMULATOR as a variable and never enter the elseif branch.

The solution:

# Check the platform selection and setup for developer root
if (IOS_PLATFORM STREQUAL "OS")
	set (IOS_PLATFORM_LOCATION "iPhoneOS.platform")

	# This causes the installers to properly locate the output libraries
	set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos")
elseif (IOS_PLATFORM STREQUAL "SIMULATOR")
    set (SIMULATOR true)
	set (IOS_PLATFORM_LOCATION "iPhoneSimulator.platform")

	# This causes the installers to properly locate the output libraries
	set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator")
elseif (IOS_PLATFORM STREQUAL "SIMULATOR64")
    set (SIMULATOR true)
	set (IOS_PLATFORM_LOCATION "iPhoneSimulator.platform")

	# This causes the installers to properly locate the output libraries
	set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator")
else ()
	message (FATAL_ERROR "Unsupported IOS_PLATFORM value selected. Please choose OS or SIMULATOR")
endif ()

I noticed that with SIMULATOR, the generated file is still a x86_64 and not an i386. Fixed the issue by doing the same modification near line 127.

# set the architecture for iOS 
if (IOS_PLATFORM STREQUAL "OS")
    set (IOS_ARCH armv7 armv7s arm64)
elseif (IOS_PLATFORM STREQUAL "SIMULATOR")
    set (IOS_ARCH i386)
elseif (IOS_PLATFORM STREQUAL "SIMULATOR64")
    set (IOS_ARCH x86_64)
endif ()

@R1kk3r Integrated that update into master branch as well. Thanks a bunch.