iOS: Allow specifying CMAKE_MACOSX_BUNDLE in toolchain file

Currently CMAKE_MACOSX_BUNDLE is always set to true when compiling
for iOS. This poses a problem when using the source file
variant of try_compile. Even if a custom value is passed via
the CMAKE_FLAGS option, it would still be overridden by the
Darwin.cmake file.

Only set the value in case no other value was provided before.
This commit is contained in:
Alexandru Croitor
2019-04-30 13:31:16 +02:00
parent 4eebc52eca
commit 1011350694

View File

@@ -1,7 +1,9 @@
set(APPLE 1)
if(CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS")
set(CMAKE_MACOSX_BUNDLE ON)
if(NOT DEFINED CMAKE_MACOSX_BUNDLE)
set(CMAKE_MACOSX_BUNDLE ON)
endif()
set(CMAKE_FIND_ROOT_PATH "${_CMAKE_OSX_SYSROOT_PATH}")
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)