Browse Source

iOS: Only set the CMAKE_FIND_ROOT_PATH_MODE_* variables when not defined

This allows overriding them in a toolchain file.
Alexandru Croitor 6 years ago
parent
commit
4783b842ba
1 changed files with 9 additions and 3 deletions
  1. 9 3
      Modules/Platform/Darwin.cmake

+ 9 - 3
Modules/Platform/Darwin.cmake

@@ -6,9 +6,15 @@ if(CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAK
   endif()
 
   list(APPEND CMAKE_FIND_ROOT_PATH "${_CMAKE_OSX_SYSROOT_PATH}")
-  set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-  set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
-  set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
+  if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_LIBRARY)
+      set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+  endif()
+  if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_INCLUDE)
+      set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+  endif()
+  if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_PACKAGE)
+      set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
+  endif()
 endif()
 
 # Darwin versions: