Просмотр исходного кода

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.
Alexandru Croitor 6 лет назад
Родитель
Сommit
1011350694
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      Modules/Platform/Darwin.cmake

+ 3 - 1
Modules/Platform/Darwin.cmake

@@ -1,7 +1,9 @@
 set(APPLE 1)
 set(APPLE 1)
 
 
 if(CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS")
 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 "${_CMAKE_OSX_SYSROOT_PATH}")
   set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
   set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)