Updated ios toolchain file with version from https://github.com/leetal/ios-cmake

--- cmake/ios.toolchain.cmake
+++ cmake/ios.toolchain.cmake
@@ -1,261 +1,931 @@
-# This file is based off of the Platform/Darwin.cmake and Platform/UnixPaths.cmake
-# files which are included with CMake 2.8.4
-# It has been altered for iOS development
-
-# Options:
-#
-# IOS_PLATFORM = OS (default) or SIMULATOR
-#   This decides if SDKS will be selected from the iPhoneOS.platform or iPhoneSimulator.platform folders
-#   If not specified, it can be inferred if you pass CMAKE_OSX_ARCHITECTURES
-#	Otherwise the default is OS
-#   OS - used to build for iPhone and iPad physical devices, which have an arm arch.
-#   SIMULATOR - used to build for the Simulator platforms, which have an x86 arch.
-#
-# CMAKE_IOS_DEVELOPER_ROOT = automatic(default) or /path/to/platform/Developer folder
-#   By default this location is automatically chosen based on the IOS_PLATFORM value above.
-#   If set manually, it will override the default location and force the user of a particular Developer Platform
-#
-# CMAKE_IOS_SDK_ROOT = automatic(default) or /path/to/platform/Developer/SDKs/SDK folder
-#   By default this location is automatcially chosen based on the CMAKE_IOS_DEVELOPER_ROOT value.
-#   In this case it will always be the most up-to-date SDK found in the CMAKE_IOS_DEVELOPER_ROOT path.
-#   If set manually, this will force the use of a specific SDK version
-# This toolchain defines the following variables for use externally:
-#
-# IOS_SDK_VERSION: Version of iOS SDK being used.
-# CMAKE_OSX_ARCHITECTURES: Architectures being compiled for (generated from IOS_PLATFORM).
+# This file is part of the ios-cmake project. It was retrieved from
+# https://github.com/leetal/ios-cmake.git, which is a fork of
+# https://github.com/gerstrong/ios-cmake.git, which is a fork of
+# https://github.com/cristeab/ios-cmake.git, which is a fork of
+# https://code.google.com/p/ios-cmake/. Which in turn is based off of
+# the Platform/Darwin.cmake and Platform/UnixPaths.cmake files which
+# are included with CMake 2.8.4
+#
+# The ios-cmake project is licensed under the new BSD license.
+#
+# Copyright (c) 2014, Bogdan Cristea and LTE Engineering Software,
+# Kitware, Inc., Insight Software Consortium.  All rights reserved.
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# This file is based off of the Platform/Darwin.cmake and
+# Platform/UnixPaths.cmake files which are included with CMake 2.8.4
+# It has been altered for iOS development.
+#
+# Updated by Alex Stewart (alexs.mac@gmail.com)
+#
+# *****************************************************************************
+#      Now maintained by Alexander Widerberg (widerbergaren [at] gmail.com)
+#                      under the BSD-3-Clause license
+#                   https://github.com/leetal/ios-cmake
+# *****************************************************************************
+#
+#                           INFORMATION / HELP
+#
+# The following options control the behaviour of this toolchain:
+#
+# PLATFORM: (default "OS64")
+#    OS = Build for iPhoneOS.
+#    OS64 = Build for arm64 iphoneOS.
+#    OS64COMBINED = Build for arm64 x86_64 iphoneOS. Combined into FAT STATIC lib (supported on 3.14+ of CMakewith "-G Xcode" argument ONLY)
+#    SIMULATOR = Build for x86 i386 iphoneOS Simulator.
+#    SIMULATOR64 = Build for x86_64 iphoneOS Simulator.
+#    SIMULATORARM64 = Build for arm64 iphoneOS Simulator.
+#    TVOS = Build for arm64 tvOS.
+#    TVOSCOMBINED = Build for arm64 x86_64 tvOS. Combined into FAT STATIC lib (supported on 3.14+ of CMake with "-G Xcode" argument ONLY)
+#    SIMULATOR_TVOS = Build for x86_64 tvOS Simulator.
+#    WATCHOS = Build for armv7k arm64_32 for watchOS.
+#    WATCHOSCOMBINED = Build for armv7k arm64_32 x86_64 watchOS. Combined into FAT STATIC lib (supported on 3.14+ of CMake with "-G Xcode" argument ONLY)
+#    SIMULATOR_WATCHOS = Build for x86_64 for watchOS Simulator.
+#    MAC = Build for x86_64 macOS.
+#    MAC_ARM64 = Build for Apple Silicon macOS.
+#    MAC_CATALYST = Build for x86_64 macOS with Catalyst support (iOS toolchain on macOS).
+#                   Note: The build argument "MACOSX_DEPLOYMENT_TARGET" can be used to control min-version of macOS
+#    MAC_CATALYST_ARM64 = Build for Apple Silicon macOS with Catalyst support (iOS toolchain on macOS).
+#                         Note: The build argument "MACOSX_DEPLOYMENT_TARGET" can be used to control min-version of macOS
+#
+# CMAKE_OSX_SYSROOT: Path to the SDK to use.  By default this is
+#    automatically determined from PLATFORM and xcodebuild, but
+#    can also be manually specified (although this should not be required).
+#
+# CMAKE_DEVELOPER_ROOT: Path to the Developer directory for the platform
+#    being compiled for.  By default this is automatically determined from
+#    CMAKE_OSX_SYSROOT, but can also be manually specified (although this should
+#    not be required).
+#
+# DEPLOYMENT_TARGET: Minimum SDK version to target. Default 2.0 on watchOS and 9.0 on tvOS+iOS
+#
+# ENABLE_BITCODE: (1|0) Enables or disables bitcode support. Default 1 (true)
+#
+# ENABLE_ARC: (1|0) Enables or disables ARC support. Default 1 (true, ARC enabled by default)
+#
+# ENABLE_VISIBILITY: (1|0) Enables or disables symbol visibility support. Default 0 (false, visibility hidden by default)
+#
+# ENABLE_STRICT_TRY_COMPILE: (1|0) Enables or disables strict try_compile() on all Check* directives (will run linker
+#    to actually check if linking is possible). Default 0 (false, will set CMAKE_TRY_COMPILE_TARGET_TYPE to STATIC_LIBRARY)
+#
+# ARCHS: (armv7 armv7s armv7k arm64 arm64_32 i386 x86_64) If specified, will override the default architectures for the given PLATFORM
+#    OS = armv7 armv7s arm64 (if applicable)
+#    OS64 = arm64 (if applicable)
+#    SIMULATOR = i386
+#    SIMULATOR64 = x86_64
+#    SIMULATORARM64 = arm64
+#    TVOS = arm64
+#    SIMULATOR_TVOS = x86_64 (i386 has since long been deprecated)
+#    WATCHOS = armv7k arm64_32 (if applicable)
+#    SIMULATOR_WATCHOS = x86_64 (i386 has since long been deprecated)
+#    MAC = x86_64
+#    MAC_ARM64 = arm64
+#    MAC_CATALYST = x86_64
+#    MAC_CATALYST_ARM64 = arm64
+#
+# This toolchain defines the following properties (available via get_property()) for use externally:
+#
+# PLATFORM: The currently targeted platform.
+# XCODE_VERSION: Version number (not including Build version) of Xcode detected.
+# SDK_VERSION: Version of SDK being used.
+# OSX_ARCHITECTURES: Architectures being compiled for (generated from PLATFORM).
+# APPLE_TARGET_TRIPLE: Used by autoconf build systems. NOTE: If "ARCHS" are overridden, this will *NOT* be set!
 #
 # This toolchain defines the following macros for use externally:
 #
-# set_xcode_property (TARGET XCODE_PROPERTY XCODE_VALUE)
-#   A convenience macro for setting xcode specific properties on targets
-#   example: set_xcode_property (myioslib IPHONEOS_DEPLOYMENT_TARGET "3.1").
+# set_xcode_property (TARGET XCODE_PROPERTY XCODE_VALUE XCODE_VARIANT)
+#   A convenience macro for setting xcode specific properties on targets.
+#   Available variants are: All, Release, RelWithDebInfo, Debug, MinSizeRel
+#   example: set_xcode_property (myioslib IPHONEOS_DEPLOYMENT_TARGET "3.1" "all").
 #
 # find_host_package (PROGRAM ARGS)
 #   A macro used to find executable programs on the host system, not within the
-#   iOS environment.  Thanks to the android-cmake project for providing the
+#   environment. Thanks to the android-cmake project for providing the
 #   command.
-
-#########
-
-# Default to building for iPhoneOS if not specified otherwise, and we cannot
-# determine the platform from the CMAKE_OSX_ARCHITECTURES variable.  The use
-# of CMAKE_OSX_ARCHITECTURES is such that try_compile() projects can correctly
-# determine the value of IOS_PLATFORM from the root project, as
-# CMAKE_OSX_ARCHITECTURES is propagated to them by CMake.
-if (NOT DEFINED IOS_PLATFORM)
-  if (CMAKE_OSX_ARCHITECTURES)
-    if (CMAKE_OSX_ARCHITECTURES MATCHES ".*arm.*")
-      set(IOS_PLATFORM "OS")
-    elseif (CMAKE_OSX_ARCHITECTURES MATCHES "i386")
-      set(IOS_PLATFORM "SIMULATOR")
-    elseif (CMAKE_OSX_ARCHITECTURES MATCHES "x86_64")
-      set(IOS_PLATFORM "SIMULATOR")
+#
+
+cmake_minimum_required(VERSION 3.8.0)
+
+# CMake invokes the toolchain file twice during the first build, but only once during subsequent rebuilds.
+if(DEFINED ENV{_IOS_TOOLCHAIN_HAS_RUN})
+  return()
+endif()
+set(ENV{_IOS_TOOLCHAIN_HAS_RUN} true)
+
+###############################################################################
+#                                  OPTIONS                                    #
+###############################################################################
+
+option(DROP_32_BIT "Drops the 32-bit targets universally." YES)
+
+###############################################################################
+#                                END OPTIONS                                  #
+###############################################################################
+
+# List of supported platform values
+list(APPEND _supported_platforms
+        "OS" "OS64" "OS64COMBINED" "SIMULATOR" "SIMULATOR64" "SIMULATORARM64"
+        "TVOS" "TVOSCOMBINED" "SIMULATOR_TVOS"
+        "WATCHOS" "WATCHOSCOMBINED" "SIMULATOR_WATCHOS"
+        "MAC" "MAC_ARM64"
+        "MAC_CATALYST" "MAC_CATALYST_ARM64")
+
+# Cache what generator is used
+set(USED_CMAKE_GENERATOR "${CMAKE_GENERATOR}")
+
+# Check if using a CMake version capable of building combined FAT builds (simulator and target slices combined in one static lib)
+if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.14")
+  set(MODERN_CMAKE YES)
+endif()
+
+# Get the Xcode version being used.
+# Problem: CMake runs toolchain files multiple times, but can't read cache variables on some runs.
+# Workaround: On first run (in which cache variables are always accessible), set an intermediary environment variable.
+#
+# NOTE: This pattern is used i many places in this toolchain to speed up checks of all sorts
+if(DEFINED XCODE_VERSION_INT)
+  # Environment variables are always preserved.
+  set(ENV{_XCODE_VERSION_INT} "${XCODE_VERSION_INT}")
+elseif(DEFINED ENV{_XCODE_VERSION_INT})
+  set(XCODE_VERSION_INT "$ENV{_XCODE_VERSION_INT}")
+elseif(NOT DEFINED XCODE_VERSION_INT)
+  find_program(XCODEBUILD_EXECUTABLE xcodebuild)
+  if(NOT XCODEBUILD_EXECUTABLE)
+    message(FATAL_ERROR "xcodebuild not found. Please install either the standalone commandline tools or Xcode.")
+  endif()
+  execute_process(COMMAND ${XCODEBUILD_EXECUTABLE} -version
+          OUTPUT_VARIABLE XCODE_VERSION_INT
+          ERROR_QUIET
+          OUTPUT_STRIP_TRAILING_WHITESPACE)
+  string(REGEX MATCH "Xcode [0-9\\.]+" XCODE_VERSION_INT "${XCODE_VERSION_INT}")
+  string(REGEX REPLACE "Xcode ([0-9\\.]+)" "\\1" XCODE_VERSION_INT "${XCODE_VERSION_INT}")
+  set(XCODE_VERSION_INT "${XCODE_VERSION_INT}" CACHE INTERNAL "")
+endif()
+
+# Assuming that xcode 12.0 is installed you most probably have ios sdk 14.0 or later installed (tested on Big Sur)
+# if you don't set a deployment target it will be set the way you only get 64-bit builds
+if(NOT DEFINED DEPLOYMENT_TARGET AND XCODE_VERSION_INT VERSION_GREATER 12.0)
+  # Temporarily fix the arm64 issues in CMake install-combined by excluding arm64 for simulator builds (needed for Apple Silicon...)
+  set(CMAKE_XCODE_ATTRIBUTE_EXCLUDED_ARCHS[sdk=iphonesimulator*] "arm64")
+endif()
+
+# Check if the platform variable is set
+if(DEFINED PLATFORM)
+  # Environment variables are always preserved.
+  set(ENV{_PLATFORM} "${PLATFORM}")
+elseif(DEFINED ENV{_PLATFORM})
+  set(PLATFORM "$ENV{_PLATFORM}")
+elseif(NOT DEFINED PLATFORM)
+  message(FATAL_ERROR "PLATFORM argument not set. Bailing configure since I don't know what target you want to build for!")
+endif ()
+
+if(PLATFORM MATCHES ".*COMBINED" AND NOT CMAKE_GENERATOR MATCHES "Xcode")
+  message(FATAL_ERROR "The combined builds support requires Xcode to be used as generator via '-G Xcode' command-line argument in CMake")
+endif()
+
+# Safeguard that the platform value is set and is one of the supported values
+list(FIND _supported_platforms ${PLATFORM} contains_PLATFORM)
+if("${contains_PLATFORM}" EQUAL "-1")
+  string(REPLACE ";"  "\n * " _supported_platforms_formatted "${_supported_platforms}")
+  message(FATAL_ERROR " Invalid PLATFORM specified! Current value: ${PLATFORM}.\n"
+          " Supported PLATFORM values: \n * ${_supported_platforms_formatted}")
+endif()
+
+# Check if Apple Silicon is supported
+if(PLATFORM MATCHES "^(MAC_ARM64)$|^(MAC_CATALYST_ARM64)$" AND ${CMAKE_VERSION} VERSION_LESS "3.19.5")
+  message(FATAL_ERROR "Apple Silicon builds requires a minimum of CMake 3.19.5")
+endif()
+
+# Touch toolchain variable to suppress "unused variable" warning.
+# This happens if CMake is invoked with the same command line the second time.
+if(CMAKE_TOOLCHAIN_FILE)
+endif()
+
+# Fix for PThread library not in path
+set(CMAKE_THREAD_LIBS_INIT "-lpthread")
+set(CMAKE_HAVE_THREADS_LIBRARY 1)
+set(CMAKE_USE_WIN32_THREADS_INIT 0)
+set(CMAKE_USE_PTHREADS_INIT 1)
+
+# Specify minimum version of deployment target.
+if(NOT DEFINED DEPLOYMENT_TARGET)
+  if (PLATFORM MATCHES "WATCHOS")
+    # Unless specified, SDK version 4.0 is used by default as minimum target version (watchOS).
+    set(DEPLOYMENT_TARGET "4.0")
+  elseif(PLATFORM STREQUAL "MAC")
+    # Unless specified, SDK version 10.13 (High sierra) is used by default as minimum target version (macos).
+    set(DEPLOYMENT_TARGET "10.13")
+  elseif(PLATFORM STREQUAL "MAC_ARM64")
+    # Unless specified, SDK version 11.0 (Big Sur) is used by default as minimum target version (macos on arm).
+    set(DEPLOYMENT_TARGET "11.0")
+  elseif(PLATFORM STREQUAL "MAC_CATALYST" OR PLATFORM STREQUAL "MAC_CATALYST_ARM64")
+    # Unless specified, SDK version 13.0 is used by default as minimum target version (mac catalyst minimum requirement).
+    set(DEPLOYMENT_TARGET "13.0")
+  else()
+    # Unless specified, SDK version 11.0 is used by default as minimum target version (iOS, tvOS).
+    set(DEPLOYMENT_TARGET "11.0")
+  endif()
+  message(STATUS "[DEFAULTS] Using the default min-version since DEPLOYMENT_TARGET not provided!")
+elseif(DEFINED DEPLOYMENT_TARGET AND PLATFORM MATCHES "^MAC_CATALYST" AND ${DEPLOYMENT_TARGET} VERSION_LESS "13.0")
+  message(FATAL_ERROR "Mac Catalyst builds requires a minimum deployment target of 13.0!")
+endif()
+
+# Store the DEPLOYMENT_TARGET in the cache
+set(DEPLOYMENT_TARGET "${DEPLOYMENT_TARGET}" CACHE INTERNAL "")
+
+# Handle the case where we are targeting iOS and a version above 10.3.4 (32-bit support dropped officially)
+if(PLATFORM STREQUAL "OS" AND DEPLOYMENT_TARGET VERSION_GREATER_EQUAL 10.3.4)
+  set(PLATFORM "OS64")
+  message(STATUS "Targeting minimum SDK version ${DEPLOYMENT_TARGET}. Dropping 32-bit support.")
+elseif(PLATFORM STREQUAL "SIMULATOR" AND DEPLOYMENT_TARGET VERSION_GREATER_EQUAL 10.3.4)
+  set(PLATFORM "SIMULATOR64")
+  message(STATUS "Targeting minimum SDK version ${DEPLOYMENT_TARGET}. Dropping 32-bit support.")
+endif()
+
+set(PLATFORM_INT "${PLATFORM}")
+
+if(DEFINED ARCHS)
+  string(REPLACE ";" "-" ARCHS_SPLIT "${ARCHS}")
+endif()
+
+# Determine the platform name and architectures for use in xcodebuild commands
+# from the specified PLATFORM_INT name.
+if(PLATFORM_INT STREQUAL "OS")
+  set(SDK_NAME iphoneos)
+  if(NOT ARCHS)
+    set(ARCHS armv7 armv7s arm64)
+    set(APPLE_TARGET_TRIPLE_INT arm-apple-ios$${DEPLOYMENT_TARGET})
+  else()
+    set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-ios${DEPLOYMENT_TARGET})
+  endif()
+elseif(PLATFORM_INT STREQUAL "OS64")
+  set(SDK_NAME iphoneos)
+  if(NOT ARCHS)
+    if (XCODE_VERSION_INT VERSION_GREATER 10.0)
+      set(ARCHS arm64) # Add arm64e when Apple have fixed the integration issues with it, libarclite_iphoneos.a is currently missung bitcode markers for example
+    else()
+      set(ARCHS arm64)
     endif()
-  endif()
-  if (NOT IOS_PLATFORM)
-    set(IOS_PLATFORM "OS")
-  endif()
-endif()
-set(IOS_PLATFORM ${IOS_PLATFORM} CACHE STRING
-  "Type of iOS platform for which to build.")
-
-# Check the platform selection and setup for developer root
-if ("${IOS_PLATFORM}" STREQUAL "OS")
-  set (XCODE_PLATFORM iPhoneOS)
-  set (IOS_PLATFORM_LOCATION "iPhoneOS.platform")
-  set (XCODE_IOS_PLATFORM iphoneos)
-  set (IOS_ARCH armv7 armv7s arm64)
-
-  # 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 (XCODE_PLATFORM iPhoneSimulator)
-  set (IOS_PLATFORM_LOCATION "iPhoneSimulator.platform")
-  set (XCODE_IOS_PLATFORM iphonesimulator)
-  set (IOS_ARCH i386 x86_64)
-
-  # 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 ()
-
+    set(APPLE_TARGET_TRIPLE_INT aarch64-apple-ios${DEPLOYMENT_TARGET})
+  else()
+    set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-ios${DEPLOYMENT_TARGET})
+  endif()
+elseif(PLATFORM_INT STREQUAL "OS64COMBINED")
+  set(SDK_NAME iphoneos)
+  if(MODERN_CMAKE)
+    if(NOT ARCHS)
+      if (XCODE_VERSION_INT VERSION_GREATER 10.0)
+        set(ARCHS arm64 x86_64) # Add arm64e when Apple have fixed the integration issues with it, libarclite_iphoneos.a is currently missung bitcode markers for example
+        set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=iphoneos*] "arm64")
+        set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=iphonesimulator*] "x86_64")
+        set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphoneos*] "arm64")
+        set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphonesimulator*] "x86_64")
+      else()
+        set(ARCHS arm64 x86_64)
+        set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=iphoneos*] "arm64")
+        set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=iphonesimulator*] "x86_64")
+        set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphoneos*] "arm64")
+        set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphonesimulator*] "x86_64")
+      endif()
+      set(APPLE_TARGET_TRIPLE_INT aarch64-x86_64-apple-ios${DEPLOYMENT_TARGET})
+    else()
+      set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-ios${DEPLOYMENT_TARGET})
+    endif()
+  else()
+    message(FATAL_ERROR "Please make sure that you are running CMake 3.14+ to make the OS64COMBINED setting work")
+  endif()
+elseif(PLATFORM_INT STREQUAL "SIMULATOR")
+  set(SDK_NAME iphonesimulator)
+  if(NOT ARCHS)
+    set(ARCHS i386)
+    set(APPLE_TARGET_TRIPLE_INT i386-apple-ios${DEPLOYMENT_TARGET}-simulator)
+  else()
+    set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-ios${DEPLOYMENT_TARGET}-simulator)
+  endif()
+  message(DEPRECATION "SIMULATOR IS DEPRECATED. Consider using SIMULATOR64 instead.")
+elseif(PLATFORM_INT STREQUAL "SIMULATOR64")
+  set(SDK_NAME iphonesimulator)
+  if(NOT ARCHS)
+    set(ARCHS x86_64)
+    set(APPLE_TARGET_TRIPLE_INT x86_64-apple-ios${DEPLOYMENT_TARGET}-simulator)
+  else()
+    set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-ios${DEPLOYMENT_TARGET}-simulator)
+  endif()
+elseif(PLATFORM_INT STREQUAL "SIMULATORARM64")
+  set(SDK_NAME iphonesimulator)
+  if(NOT ARCHS)
+    set(ARCHS arm64)
+    set(APPLE_TARGET_TRIPLE_INT aarch64-apple-ios${DEPLOYMENT_TARGET}-simulator)
+  else()
+    set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-ios${DEPLOYMENT_TARGET}-simulator)
+  endif()
+elseif(PLATFORM_INT STREQUAL "TVOS")
+  set(SDK_NAME appletvos)
+  if(NOT ARCHS)
+    set(ARCHS arm64)
+    set(APPLE_TARGET_TRIPLE_INT aarch64-apple-tvos${DEPLOYMENT_TARGET})
+  else()
+    set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-tvos${DEPLOYMENT_TARGET})
+  endif()
+elseif (PLATFORM_INT STREQUAL "TVOSCOMBINED")
+  set(SDK_NAME appletvos)
+  if(MODERN_CMAKE)
+    if(NOT ARCHS)
+      set(ARCHS arm64 x86_64)
+      set(APPLE_TARGET_TRIPLE_INT aarch64-x86_64-apple-tvos${DEPLOYMENT_TARGET})
+      set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=appletvos*] "arm64")
+      set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=appletvsimulator*] "x86_64")
+      set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=appletvos*] "arm64")
+      set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=appletvsimulator*] "x86_64")
+    else()
+      set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-tvos${DEPLOYMENT_TARGET})
+    endif()
+  else()
+    message(FATAL_ERROR "Please make sure that you are running CMake 3.14+ to make the TVOSCOMBINED setting work")
+  endif()
+elseif(PLATFORM_INT STREQUAL "SIMULATOR_TVOS")
+  set(SDK_NAME appletvsimulator)
+  if(NOT ARCHS)
+    set(ARCHS x86_64)
+    set(APPLE_TARGET_TRIPLE_INT x86_64-apple-tvos${DEPLOYMENT_TARGET}-simulator)
+  else()
+    set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-tvos${DEPLOYMENT_TARGET}-simulator)
+  endif()
+elseif(PLATFORM_INT STREQUAL "WATCHOS")
+  set(SDK_NAME watchos)
+  if(NOT ARCHS)
+    if (XCODE_VERSION_INT VERSION_GREATER 10.0)
+      set(ARCHS armv7k arm64_32)
+      set(APPLE_TARGET_TRIPLE_INT aarch64_32-apple-watchos${DEPLOYMENT_TARGET})
+    else()
+      set(ARCHS armv7k)
+      set(APPLE_TARGET_TRIPLE_INT arm-apple-watchos${DEPLOYMENT_TARGET})
+    endif()
+  else()
+    set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-watchos${DEPLOYMENT_TARGET})
+  endif()
+elseif(PLATFORM_INT STREQUAL "WATCHOSCOMBINED")
+  set(SDK_NAME watchos)
+  if(MODERN_CMAKE)
+    if(NOT ARCHS)
+      if (XCODE_VERSION_INT VERSION_GREATER 10.0)
+        set(ARCHS armv7k arm64_32 i386)
+        set(APPLE_TARGET_TRIPLE_INT aarch64_32-i386-apple-watchos${DEPLOYMENT_TARGET})
+        set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=watchos*] "armv7k arm64_32")
+        set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=watchsimulator*] "i386")
+        set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=watchos*] "armv7k arm64_32")
+        set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=watchsimulator*] "i386")
+      else()
+        set(ARCHS armv7k i386)
+        set(APPLE_TARGET_TRIPLE_INT arm-i386-apple-watchos${DEPLOYMENT_TARGET})
+        set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=watchos*] "armv7k")
+        set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=watchsimulator*] "i386")
+        set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=watchos*] "armv7k")
+        set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=watchsimulator*] "i386")
+      endif()
+    else()
+      set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-watchos${DEPLOYMENT_TARGET})
+    endif()
+  else()
+    message(FATAL_ERROR "Please make sure that you are running CMake 3.14+ to make the WATCHOSCOMBINED setting work")
+  endif()
+elseif(PLATFORM_INT STREQUAL "SIMULATOR_WATCHOS")
+  set(SDK_NAME watchsimulator)
+  if(NOT ARCHS)
+    set(ARCHS i386)
+    set(APPLE_TARGET_TRIPLE_INT i386-apple-watchos${DEPLOYMENT_TARGET}-simulator)
+  else()
+    set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-watchos${DEPLOYMENT_TARGET}-simulator)
+  endif()
+elseif(PLATFORM_INT STREQUAL "MAC" OR PLATFORM_INT STREQUAL "MAC_CATALYST")
+  set(SDK_NAME macosx)
+  if(NOT ARCHS)
+    set(ARCHS x86_64)
+  endif()
+  string(REPLACE ";" "-" ARCHS_SPLIT "${ARCHS}")
+  if(PLATFORM_INT STREQUAL "MAC")
+    set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-macosx${DEPLOYMENT_TARGET})
+  elseif(PLATFORM_INT STREQUAL "MAC_CATALYST")
+    set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-ios${DEPLOYMENT_TARGET}-macabi)
+  endif()
+elseif(PLATFORM_INT MATCHES "^(MAC_ARM64)$|^(MAC_CATALYST_ARM64)$")
+  set(SDK_NAME macosx)
+  if(NOT ARCHS)
+    set(ARCHS arm64)
+  endif()
+  string(REPLACE ";" "-" ARCHS_SPLIT "${ARCHS}")
+  if(PLATFORM_INT STREQUAL "MAC_ARM64")
+    set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-macosx${DEPLOYMENT_TARGET})
+  elseif(PLATFORM_INT STREQUAL "MAC_CATALYST_ARM64")
+    set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-ios${DEPLOYMENT_TARGET}-macabi)
+  endif()
+else()
+  message(FATAL_ERROR "Invalid PLATFORM: ${PLATFORM_INT}")
+endif()
+
+if(MODERN_CMAKE AND PLATFORM_INT MATCHES ".*COMBINED" AND NOT CMAKE_GENERATOR MATCHES "Xcode")
+  message(FATAL_ERROR "The COMBINED options only work with Xcode generator, -G Xcode")
+endif()
+
+if(CMAKE_GENERATOR MATCHES "Xcode" AND PLATFORM_INT MATCHES "^MAC_CATALYST")
+  set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
+  set(CMAKE_XCODE_ATTRIBUTE_SUPPORTED_PLATFORMS "macosx")
+  set(CMAKE_XCODE_EFFECTIVE_PLATFORMS "-maccatalyst")
+  if(NOT DEFINED MACOSX_DEPLOYMENT_TARGET)
+    set(CMAKE_XCODE_ATTRIBUTE_MACOSX_DEPLOYMENT_TARGET "10.15")
+  else()
+    set(CMAKE_XCODE_ATTRIBUTE_MACOSX_DEPLOYMENT_TARGET "${MACOSX_DEPLOYMENT_TARGET}")
+  endif()
+elseif(CMAKE_GENERATOR MATCHES "Xcode")
+  set(CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "${DEPLOYMENT_TARGET}")
+  if(NOT PLATFORM_INT MATCHES ".*COMBINED")
+    set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=${SDK_NAME}*] "${ARCHS}")
+    set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=${SDK_NAME}*] "${ARCHS}")
+  endif()
+endif()
+
+# If user did not specify the SDK root to use, then query xcodebuild for it.
+if(DEFINED CMAKE_OSX_SYSROOT_INT)
+  # Environment variables are always preserved.
+  set(ENV{_CMAKE_OSX_SYSROOT_INT} "${CMAKE_OSX_SYSROOT_INT}")
+elseif(DEFINED ENV{_CMAKE_OSX_SYSROOT_INT})
+  set(CMAKE_OSX_SYSROOT_INT "$ENV{_CMAKE_OSX_SYSROOT_INT}")
+elseif(NOT DEFINED CMAKE_OSX_SYSROOT_INT)
+  execute_process(COMMAND ${XCODEBUILD_EXECUTABLE} -version -sdk ${SDK_NAME} Path
+          OUTPUT_VARIABLE CMAKE_OSX_SYSROOT_INT
+          ERROR_QUIET
+          OUTPUT_STRIP_TRAILING_WHITESPACE)
+endif()
+
+if (NOT DEFINED CMAKE_OSX_SYSROOT_INT AND NOT DEFINED CMAKE_OSX_SYSROOT)
+  message(SEND_ERROR "Please make sure that Xcode is installed and that the toolchain"
+          "is pointing to the correct path. Please run:"
+          "sudo xcode-select -s /Applications/Xcode.app/Contents/Developer"
+          "and see if that fixes the problem for you.")
+  message(FATAL_ERROR "Invalid CMAKE_OSX_SYSROOT: ${CMAKE_OSX_SYSROOT} "
+          "does not exist.")
+elseif(DEFINED CMAKE_OSX_SYSROOT_INT)
+  set(CMAKE_OSX_SYSROOT_INT "${CMAKE_OSX_SYSROOT_INT}" CACHE INTERNAL "")
+  # Specify the location or name of the platform SDK to be used in CMAKE_OSX_SYSROOT.
+  set(CMAKE_OSX_SYSROOT "${CMAKE_OSX_SYSROOT_INT}" CACHE INTERNAL "")
+endif()
+
+# Use bitcode or not
+if(NOT DEFINED ENABLE_BITCODE AND NOT ARCHS MATCHES "((^|;|, )(i386|x86_64))+")
+  # Unless specified, enable bitcode support by default
+  message(STATUS "[DEFAULTS] Enabling bitcode support by default. ENABLE_BITCODE not provided!")
+  set(ENABLE_BITCODE TRUE)
+elseif(NOT DEFINED ENABLE_BITCODE)
+  message(STATUS "[DEFAULTS] Disabling bitcode support by default on simulators. ENABLE_BITCODE not provided for override!")
+  set(ENABLE_BITCODE FALSE)
+endif()
+set(ENABLE_BITCODE_INT ${ENABLE_BITCODE} CACHE BOOL
+        "Whether or not to enable bitcode" FORCE)
+# Use ARC or not
+if(NOT DEFINED ENABLE_ARC)
+  # Unless specified, enable ARC support by default
+  set(ENABLE_ARC TRUE)
+  message(STATUS "[DEFAULTS] Enabling ARC support by default. ENABLE_ARC not provided!")
+endif()
+set(ENABLE_ARC_INT ${ENABLE_ARC} CACHE BOOL "Whether or not to enable ARC" FORCE)
+# Use hidden visibility or not
+if(NOT DEFINED ENABLE_VISIBILITY)
+  # Unless specified, disable symbols visibility by default
+  set(ENABLE_VISIBILITY FALSE)
+  message(STATUS "[DEFAULTS] Hiding symbols visibility by default. ENABLE_VISIBILITY not provided!")
+endif()
+set(ENABLE_VISIBILITY_INT ${ENABLE_VISIBILITY} CACHE BOOL "Whether or not to hide symbols from the dynamic linker (-fvisibility=hidden)" FORCE)
+# Set strict compiler checks or not
+if(NOT DEFINED ENABLE_STRICT_TRY_COMPILE)
+  # Unless specified, disable strict try_compile()
+  set(ENABLE_STRICT_TRY_COMPILE FALSE)
+  message(STATUS "[DEFAULTS] Using NON-strict compiler checks by default. ENABLE_STRICT_TRY_COMPILE not provided!")
+endif()
+set(ENABLE_STRICT_TRY_COMPILE_INT ${ENABLE_STRICT_TRY_COMPILE} CACHE BOOL
+        "Whether or not to use strict compiler checks" FORCE)
+
+# Get the SDK version information.
+if(DEFINED SDK_VERSION)
+  # Environment variables are always preserved.
+  set(ENV{_SDK_VERSION} "${SDK_VERSION}")
+elseif(DEFINED ENV{_SDK_VERSION})
+  set(SDK_VERSION "$ENV{_SDK_VERSION}")
+elseif(NOT DEFINED SDK_VERSION)
+  execute_process(COMMAND ${XCODEBUILD_EXECUTABLE} -sdk ${CMAKE_OSX_SYSROOT_INT} -version SDKVersion
+          OUTPUT_VARIABLE SDK_VERSION
+          ERROR_QUIET
+          OUTPUT_STRIP_TRAILING_WHITESPACE)
+endif()
+
+# Find the Developer root for the specific iOS platform being compiled for
+# from CMAKE_OSX_SYSROOT.  Should be ../../ from SDK specified in
+# CMAKE_OSX_SYSROOT. There does not appear to be a direct way to obtain
+# this information from xcrun or xcodebuild.
+if (NOT DEFINED CMAKE_DEVELOPER_ROOT AND NOT CMAKE_GENERATOR MATCHES "Xcode")
+  get_filename_component(PLATFORM_SDK_DIR ${CMAKE_OSX_SYSROOT_INT} PATH)
+  get_filename_component(CMAKE_DEVELOPER_ROOT ${PLATFORM_SDK_DIR} PATH)
+  if (NOT EXISTS "${CMAKE_DEVELOPER_ROOT}")
+    message(FATAL_ERROR "Invalid CMAKE_DEVELOPER_ROOT: ${CMAKE_DEVELOPER_ROOT} does not exist.")
+  endif()
+endif()
+
+# Find the C & C++ compilers for the specified SDK.
+if(DEFINED CMAKE_C_COMPILER)
+  # Environment variables are always preserved.
+  set(ENV{_CMAKE_C_COMPILER} "${CMAKE_C_COMPILER}")
+elseif(DEFINED ENV{_CMAKE_C_COMPILER})
+  set(CMAKE_C_COMPILER "$ENV{_CMAKE_C_COMPILER}")
+  set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER})
+elseif(NOT DEFINED CMAKE_C_COMPILER)
+  execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT_INT} -find clang
+          OUTPUT_VARIABLE CMAKE_C_COMPILER
+          ERROR_QUIET
+          OUTPUT_STRIP_TRAILING_WHITESPACE)
+  set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER})
+endif()
+if(DEFINED CMAKE_CXX_COMPILER)
+  # Environment variables are always preserved.
+  set(ENV{_CMAKE_CXX_COMPILER} "${CMAKE_CXX_COMPILER}")
+elseif(DEFINED ENV{_CMAKE_CXX_COMPILER})
+  set(CMAKE_CXX_COMPILER "$ENV{_CMAKE_CXX_COMPILER}")
+elseif(NOT DEFINED CMAKE_CXX_COMPILER)
+  execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT_INT} -find clang++
+          OUTPUT_VARIABLE CMAKE_CXX_COMPILER
+          ERROR_QUIET
+          OUTPUT_STRIP_TRAILING_WHITESPACE)
+endif()
+# Find (Apple's) libtool.
+if(DEFINED BUILD_LIBTOOL)
+  # Environment variables are always preserved.
+  set(ENV{_BUILD_LIBTOOL} "${BUILD_LIBTOOL}")
+elseif(DEFINED ENV{_BUILD_LIBTOOL})
+  set(BUILD_LIBTOOL "$ENV{_BUILD_LIBTOOL}")
+elseif(NOT DEFINED BUILD_LIBTOOL)
+  execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT_INT} -find libtool
+          OUTPUT_VARIABLE BUILD_LIBTOOL
+          ERROR_QUIET
+          OUTPUT_STRIP_TRAILING_WHITESPACE)
+endif()
+# Find the toolchain's provided install_name_tool if none is found on the host
+if(DEFINED CMAKE_INSTALL_NAME_TOOL)
+  # Environment variables are always preserved.
+  set(ENV{_CMAKE_INSTALL_NAME_TOOL} "${CMAKE_INSTALL_NAME_TOOL}")
+elseif(DEFINED ENV{_CMAKE_INSTALL_NAME_TOOL})
+  set(CMAKE_INSTALL_NAME_TOOL "$ENV{_CMAKE_INSTALL_NAME_TOOL}")
+elseif(NOT DEFINED CMAKE_INSTALL_NAME_TOOL)
+  execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT_INT} -find install_name_tool
+          OUTPUT_VARIABLE CMAKE_INSTALL_NAME_TOOL_INT
+          ERROR_QUIET
+          OUTPUT_STRIP_TRAILING_WHITESPACE)
+  set(CMAKE_INSTALL_NAME_TOOL ${CMAKE_INSTALL_NAME_TOOL_INT} CACHE INTERNAL "")
+endif()
+
+# Configure libtool to be used instead of ar + ranlib to build static libraries.
+# This is required on Xcode 7+, but should also work on previous versions of
+# Xcode.
+get_property(languages GLOBAL PROPERTY ENABLED_LANGUAGES)
+foreach(lang ${languages})
+  set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "${BUILD_LIBTOOL} -static -o <TARGET> <LINK_FLAGS> <OBJECTS> " CACHE INTERNAL "")
+endforeach()
+
+# CMake 3.14+ support building for iOS, watchOS and tvOS out of the box.
+if(MODERN_CMAKE)
+  if(SDK_NAME MATCHES "iphone")
+    set(CMAKE_SYSTEM_NAME iOS)
+  elseif(SDK_NAME MATCHES "macosx")
+    set(CMAKE_SYSTEM_NAME Darwin)
+  elseif(SDK_NAME MATCHES "appletv")
+    set(CMAKE_SYSTEM_NAME tvOS)
+  elseif(SDK_NAME MATCHES "watch")
+    set(CMAKE_SYSTEM_NAME watchOS)
+  endif()
+  # Provide flags for a combined FAT library build on newer CMake versions
+  if(PLATFORM_INT MATCHES ".*COMBINED")
+    set(CMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH "NO")
+    set(CMAKE_IOS_INSTALL_COMBINED YES)
+    message(STATUS "Will combine built (static) artifacts into FAT lib...")
+  endif()
+elseif(NOT DEFINED CMAKE_SYSTEM_NAME AND ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.10")
+  # Legacy code path prior to CMake 3.14 or fallback if no CMAKE_SYSTEM_NAME specified
+  set(CMAKE_SYSTEM_NAME iOS)
+elseif(NOT DEFINED CMAKE_SYSTEM_NAME)
+  # Legacy code path prior to CMake 3.14 or fallback if no CMAKE_SYSTEM_NAME specified
+  set(CMAKE_SYSTEM_NAME Darwin)
+endif()
+# Standard settings.
+set(CMAKE_SYSTEM_VERSION ${SDK_VERSION} CACHE INTERNAL "")
+set(UNIX TRUE CACHE BOOL "")
+set(APPLE TRUE CACHE BOOL "")
+if(PLATFORM STREQUAL "MAC" OR PLATFORM STREQUAL "MAC_ARM64")
+  set(IOS FALSE CACHE BOOL "")
+  set(MACOS TRUE CACHE BOOL "")
+elseif(PLATFORM STREQUAL "MAC_CATALYST" OR PLATFORM STREQUAL "MAC_CATALYST_ARM64")
+  set(IOS TRUE CACHE BOOL "")
+  set(MACOS TRUE CACHE BOOL "")
+else()
+  set(IOS TRUE CACHE BOOL "")
+endif()
+set(CMAKE_AR ar CACHE FILEPATH "" FORCE)
+set(CMAKE_RANLIB ranlib CACHE FILEPATH "" FORCE)
+set(CMAKE_STRIP strip CACHE FILEPATH "" FORCE)
 # Set the architectures for which to build.
-if(NOT DEFINED CMAKE_OSX_ARCHITECTURES)
-  set(CMAKE_OSX_ARCHITECTURES ${IOS_ARCH})
-endif()
-message(STATUS "Configuring iOS build for ${CMAKE_OSX_ARCHITECTURES} architectures")
-set(CMAKE_OSX_ARCHITECTURES ${CMAKE_OSX_ARCHITECTURES} CACHE STRING "Build architecture for iOS")
-
-# Setup iOS developer location unless specified manually with CMAKE_IOS_DEVELOPER_ROOT
-if (NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT)
-    set (CMAKE_IOS_DEVELOPER_ROOT "/Applications/Xcode.app/Contents/Developer/Platforms/${IOS_PLATFORM_LOCATION}/Developer")
-endif ()
-set (CMAKE_IOS_DEVELOPER_ROOT ${CMAKE_IOS_DEVELOPER_ROOT} CACHE PATH "Location of iOS Platform")
-
-# Find and use the most recent iOS sdk unless specified manually with CMAKE_IOS_SDK_ROOT
-if (NOT DEFINED CMAKE_IOS_SDK_ROOT)
-  file (GLOB _CMAKE_IOS_SDKS "${CMAKE_IOS_DEVELOPER_ROOT}/SDKs/*")
-  if (_CMAKE_IOS_SDKS)
-    list (SORT _CMAKE_IOS_SDKS)
-    list (REVERSE _CMAKE_IOS_SDKS)
-    list (GET _CMAKE_IOS_SDKS 0 CMAKE_IOS_SDK_ROOT)
-  else ()
-    message (FATAL_ERROR "No iOS SDKs found in default search path ${CMAKE_IOS_DEVELOPER_ROOT}. Manually set CMAKE_IOS_SDK_ROOT or install the iOS SDK.")
-  endif ()
-  message (STATUS "Toolchain using default iOS SDK: ${CMAKE_IOS_SDK_ROOT}")
-endif ()
-set (CMAKE_IOS_SDK_ROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Location of the selected iOS SDK")
-
-# Get the SDK version information.
-execute_process(COMMAND xcodebuild -sdk ${CMAKE_IOS_SDK_ROOT} -version SDKVersion
-  OUTPUT_VARIABLE IOS_SDK_VERSION
-  ERROR_QUIET
-  OUTPUT_STRIP_TRAILING_WHITESPACE)
-
-execute_process(COMMAND xcode-select -p OUTPUT_VARIABLE XCODE_DEVELOPER_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
-set(XCODE_CPP_INCLUDE_DIR "${XCODE_DEVELOPER_DIR}/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1")
-set(XCODE_SDK_INCLUDE_DIR "${XCODE_DEVELOPER_DIR}/Platforms/${XCODE_PLATFORM}.platform/Developer/SDKs/${XCODE_PLATFORM}.sdk/usr/include")
-
-set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES "${XCODE_CPP_INCLUDE_DIR}")
-include_directories(BEFORE SYSTEM "${XCODE_SDK_INCLUDE_DIR}")
-
-set (CMAKE_OSX_SYSROOT ${XCODE_IOS_PLATFORM})
-
-# Specify minimum version of deployment target.
-# Unless specified, the latest SDK version is used by default.
-if(NOT DEFINED IOS_DEPLOYMENT_TARGET)
-  if(DEFINED CMAKE_OSX_DEPLOYMENT_TARGET)
-    set(IOS_DEPLOYMENT_TARGET "${CMAKE_OSX_DEPLOYMENT_TARGET}" CACHE STRING "minimum iOS deployment target")
-  else()
-	 set(IOS_DEPLOYMENT_TARGET "${IOS_SDK_VERSION}" CACHE STRING "minimum iOS deployment target")
-  endif()
-endif()
-
-set(XCODE_IOS_PLATFORM_VERSION_FLAGS "-m${XCODE_IOS_PLATFORM}-version-min=${IOS_DEPLOYMENT_TARGET}")
-
-if(CMAKE_GENERATOR MATCHES "Xcode")
-    set(CMAKE_XCODE_ATTRIBUTE_ARCHS "${IOS_ARCH}")
-    set(CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "${IOS_DEPLOYMENT_TARGET}")
-endif()
-
-message(STATUS "Building for minimum iOS version: ${IOS_DEPLOYMENT_TARGET}"
-               " (SDK version: ${IOS_SDK_VERSION})")
-
-# Standard settings
-set (CMAKE_SYSTEM_NAME Darwin)
-set (CMAKE_SYSTEM_VERSION ${IOS_SDK_VERSION})
-set (UNIX TRUE)
-set (APPLE TRUE)
-set (IOS TRUE)
-set (APPLE_IOS TRUE)
-
-# Force unset of OS X-specific deployment target (otherwise autopopulated), required as of cmake 2.8.10.
-set(CMAKE_OSX_DEPLOYMENT_TARGET "" CACHE STRING "Must be empty for iOS builds." FORCE)
-
-# Find the C & C++ compilers for the specified SDK.
-if (NOT CMAKE_C_COMPILER)
-  execute_process(COMMAND xcrun -sdk ${CMAKE_IOS_SDK_ROOT} -find clang
-    OUTPUT_VARIABLE CMAKE_C_COMPILER
-    ERROR_QUIET
-    OUTPUT_STRIP_TRAILING_WHITESPACE)
-endif()
-if (NOT CMAKE_CXX_COMPILER)
-  execute_process(COMMAND xcrun -sdk ${CMAKE_IOS_SDK_ROOT} -find clang++
-    OUTPUT_VARIABLE CMAKE_CXX_COMPILER
-    ERROR_QUIET
-    OUTPUT_STRIP_TRAILING_WHITESPACE)
-endif()
-
-set(CMAKE_CXX_COMPILER_FORCED TRUE)
-set(CMAKE_CXX_COMPILER_WORKS TRUE)
-set(CMAKE_C_COMPILER_FORCED TRUE)
-set(CMAKE_C_COMPILER_WORKS TRUE)
-
-# Hack: if a new cmake (which uses CMAKE_INSTALL_NAME_TOOL) runs on an old
-# build tree (where install_name_tool was hardcoded) and where
-# CMAKE_INSTALL_NAME_TOOL isn't in the cache and still cmake didn't fail in
-# CMakeFindBinUtils.cmake (because it isn't rerun) hardcode
-# CMAKE_INSTALL_NAME_TOOL here to install_name_tool, so it behaves as it did
-# before
-if (NOT DEFINED CMAKE_INSTALL_NAME_TOOL)
-  find_program(CMAKE_INSTALL_NAME_TOOL install_name_tool)
-endif (NOT DEFINED CMAKE_INSTALL_NAME_TOOL)
-
+set(CMAKE_OSX_ARCHITECTURES ${ARCHS} CACHE INTERNAL "")
+# Change the type of target generated for try_compile() so it'll work when cross-compiling, weak compiler checks
+if(NOT ENABLE_STRICT_TRY_COMPILE_INT)
+  set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
+endif()
 # All iOS/Darwin specific settings - some may be redundant.
+set(CMAKE_MACOSX_BUNDLE YES)
+set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
 set(CMAKE_SHARED_LIBRARY_PREFIX "lib")
 set(CMAKE_SHARED_LIBRARY_SUFFIX ".dylib")
 set(CMAKE_SHARED_MODULE_PREFIX "lib")
 set(CMAKE_SHARED_MODULE_SUFFIX ".so")
+set(CMAKE_C_COMPILER_ABI ELF)
+set(CMAKE_CXX_COMPILER_ABI ELF)
+set(CMAKE_C_HAS_ISYSROOT 1)
+set(CMAKE_CXX_HAS_ISYSROOT 1)
 set(CMAKE_MODULE_EXISTS 1)
 set(CMAKE_DL_LIBS "")
-
 set(CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG "-compatibility_version ")
 set(CMAKE_C_OSX_CURRENT_VERSION_FLAG "-current_version ")
 set(CMAKE_CXX_OSX_COMPATIBILITY_VERSION_FLAG "${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}")
 set(CMAKE_CXX_OSX_CURRENT_VERSION_FLAG "${CMAKE_C_OSX_CURRENT_VERSION_FLAG}")

-# Force variables set by FindThreads.cmake
-set(CMAKE_THREAD_LIBS_INIT "-lpthread")
-set(CMAKE_HAVE_THREADS_LIBRARY 1)
-set(CMAKE_USE_WIN32_THREADS_INIT 0)
-set(CMAKE_USE_PTHREADS_INIT 1)
-
-# change default target type for try_compile() calls (iOS doesn't support executable targets)
-set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
-
-# Hidden visibilty is required for cxx on iOS
-set(CMAKE_C_FLAGS_INIT "")
-set(CMAKE_C_FLAGS "${XCODE_IOS_PLATFORM_VERSION_FLAGS} ${CMAKE_C_FLAGS}" CACHE STRING "" FORCE)
-set(CMAKE_CXX_FLAGS_INIT "")
-set(CMAKE_CXX_FLAGS "${XCODE_IOS_PLATFORM_VERSION_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden ${CMAKE_CXX_FLAGS}" CACHE STRING "" FORCE)
-
-set(CMAKE_C_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_C_LINK_FLAGS}")
-set(CMAKE_CXX_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_CXX_LINK_FLAGS}")
+if(ARCHS MATCHES "((^|;|, )(arm64|arm64e|x86_64))+")
+  set(CMAKE_C_SIZEOF_DATA_PTR 8)
+  set(CMAKE_CXX_SIZEOF_DATA_PTR 8)
+  if(ARCHS MATCHES "((^|;|, )(arm64|arm64e))+")
+    set(CMAKE_SYSTEM_PROCESSOR "aarch64")
+  else()
+    set(CMAKE_SYSTEM_PROCESSOR "x86_64")
+  endif()
+else()
+  set(CMAKE_C_SIZEOF_DATA_PTR 4)
+  set(CMAKE_CXX_SIZEOF_DATA_PTR 4)
+  set(CMAKE_SYSTEM_PROCESSOR "arm")
+endif()
+
+# Note that only Xcode 7+ supports the newer more specific:
+# -m${SDK_NAME}-version-min flags, older versions of Xcode use:
+# -m(ios/ios-simulator)-version-min instead.
+if(${CMAKE_VERSION} VERSION_LESS "3.11")
+  if(PLATFORM_INT STREQUAL "OS" OR PLATFORM_INT STREQUAL "OS64")
+    if(XCODE_VERSION_INT VERSION_LESS 7.0)
+      set(SDK_NAME_VERSION_FLAGS
+              "-mios-version-min=${DEPLOYMENT_TARGET}")
+    else()
+      # Xcode 7.0+ uses flags we can build directly from SDK_NAME.
+      set(SDK_NAME_VERSION_FLAGS
+              "-m${SDK_NAME}-version-min=${DEPLOYMENT_TARGET}")
+    endif()
+  elseif(PLATFORM_INT STREQUAL "TVOS")
+    set(SDK_NAME_VERSION_FLAGS
+            "-mtvos-version-min=${DEPLOYMENT_TARGET}")
+  elseif(PLATFORM_INT STREQUAL "SIMULATOR_TVOS")
+    set(SDK_NAME_VERSION_FLAGS
+            "-mtvos-simulator-version-min=${DEPLOYMENT_TARGET}")
+  elseif(PLATFORM_INT STREQUAL "WATCHOS")
+    set(SDK_NAME_VERSION_FLAGS
+            "-mwatchos-version-min=${DEPLOYMENT_TARGET}")
+  elseif(PLATFORM_INT STREQUAL "SIMULATOR_WATCHOS")
+    set(SDK_NAME_VERSION_FLAGS
+            "-mwatchos-simulator-version-min=${DEPLOYMENT_TARGET}")
+  elseif(PLATFORM_INT STREQUAL "MAC")
+    set(SDK_NAME_VERSION_FLAGS
+            "-mmacosx-version-min=${DEPLOYMENT_TARGET}")
+  else()
+    # SIMULATOR or SIMULATOR64 both use -mios-simulator-version-min.
+    set(SDK_NAME_VERSION_FLAGS
+            "-mios-simulator-version-min=${DEPLOYMENT_TARGET}")
+  endif()
+elseif(NOT PLATFORM_INT MATCHES "^MAC_CATALYST")
+  # Newer versions of CMake sets the version min flags correctly, skip this for Mac Catalyst targets
+  set(CMAKE_OSX_DEPLOYMENT_TARGET ${DEPLOYMENT_TARGET})
+endif()
+
+if(DEFINED APPLE_TARGET_TRIPLE_INT)
+  set(APPLE_TARGET_TRIPLE ${APPLE_TARGET_TRIPLE_INT} CACHE INTERNAL "")
+  set(CMAKE_C_COMPILER_TARGET ${APPLE_TARGET_TRIPLE})
+  set(CMAKE_CXX_COMPILER_TARGET ${APPLE_TARGET_TRIPLE})
+  set(CMAKE_ASM_COMPILER_TARGET ${APPLE_TARGET_TRIPLE})
+endif()
+
+if(PLATFORM_INT MATCHES "^MAC_CATALYST")
+  set(C_TARGET_FLAGS "-isystem ${CMAKE_OSX_SYSROOT_INT}/System/iOSSupport/usr/include -iframework ${CMAKE_OSX_SYSROOT_INT}/System/iOSSupport/System/Library/Frameworks")
+endif()
+
+if(ENABLE_BITCODE_INT)
+  set(BITCODE "-fembed-bitcode")
+  set(CMAKE_XCODE_ATTRIBUTE_BITCODE_GENERATION_MODE "bitcode")
+  set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES")
+else()
+  set(BITCODE "")
+  set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO")
+endif()
+
+if(ENABLE_ARC_INT)
+  set(FOBJC_ARC "-fobjc-arc")
+  set(CMAKE_XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC "YES")
+else()
+  set(FOBJC_ARC "-fno-objc-arc")
+  set(CMAKE_XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC "NO")
+endif()
+
+if(NOT ENABLE_VISIBILITY_INT)
+  foreach(lang ${languages})
+    set(CMAKE_${lang}_VISIBILITY_PRESET "hidden" CACHE INTERNAL "")
+  endforeach()
+  set(CMAKE_XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN "YES")
+  set(VISIBILITY "-fvisibility=hidden -fvisibility-inlines-hidden")
+else()
+  foreach(lang ${languages})
+    set(CMAKE_${lang}_VISIBILITY_PRESET "default" CACHE INTERNAL "")
+  endforeach()
+  set(CMAKE_XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN "NO")
+  set(VISIBILITY "-fvisibility=default")
+endif()
+
+if(DEFINED APPLE_TARGET_TRIPLE)
+  set(APPLE_TARGET_TRIPLE_FLAG "-target ${APPLE_TARGET_TRIPLE}")
+endif()
+
+#Check if Xcode generator is used, since that will handle these flags automagically
+if(CMAKE_GENERATOR MATCHES "Xcode")
+  message(STATUS "Not setting any manual command-line buildflags, since Xcode is selected as generator.")
+else()
+  # Hidden visibility is required for C++ on iOS.
+  set(CMAKE_C_FLAGS "${C_TARGET_FLAGS} ${APPLE_TARGET_TRIPLE_FLAG} ${SDK_NAME_VERSION_FLAGS} ${BITCODE} -fobjc-abi-version=2 ${FOBJC_ARC} ${CMAKE_C_FLAGS}")
+  set(CMAKE_CXX_FLAGS "${C_TARGET_FLAGS} ${APPLE_TARGET_TRIPLE_FLAG} ${SDK_NAME_VERSION_FLAGS} ${BITCODE} ${VISIBILITY} -fobjc-abi-version=2 ${FOBJC_ARC} ${CMAKE_CXX_FLAGS}")
+  set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -O0 -g ${CMAKE_CXX_FLAGS_DEBUG}")
+  set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS} -DNDEBUG -Os -ffast-math ${CMAKE_CXX_FLAGS_MINSIZEREL}")
+  set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS} -DNDEBUG -O2 -g -ffast-math ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
+  set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -DNDEBUG -O3 -ffast-math ${CMAKE_CXX_FLAGS_RELEASE}")
+  set(CMAKE_C_LINK_FLAGS "${C_TARGET_FLAGS} ${SDK_NAME_VERSION_FLAGS} -Wl,-search_paths_first ${CMAKE_C_LINK_FLAGS}")
+  set(CMAKE_CXX_LINK_FLAGS "${C_TARGET_FLAGS} ${SDK_NAME_VERSION_FLAGS}  -Wl,-search_paths_first ${CMAKE_CXX_LINK_FLAGS}")
+  set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS} -x assembler-with-cpp -arch ${CMAKE_OSX_ARCHITECTURES} ${APPLE_TARGET_TRIPLE_FLAG}")
+endif()
+
+## Print status messages to inform of the current state
+message(STATUS "Configuring ${SDK_NAME} build for platform: ${PLATFORM_INT}, architecture(s): ${ARCHS}")
+message(STATUS "Using SDK: ${CMAKE_OSX_SYSROOT_INT}")
+message(STATUS "Using C compiler: ${CMAKE_C_COMPILER}")
+message(STATUS "Using CXX compiler: ${CMAKE_CXX_COMPILER}")
+message(STATUS "Using libtool: ${BUILD_LIBTOOL}")
+message(STATUS "Using install name tool: ${CMAKE_INSTALL_NAME_TOOL}")
+if(DEFINED APPLE_TARGET_TRIPLE)
+  message(STATUS "Autoconf target triple: ${APPLE_TARGET_TRIPLE}")
+endif()
+message(STATUS "Using minimum deployment version: ${DEPLOYMENT_TARGET}"
+        " (SDK version: ${SDK_VERSION})")
+if(MODERN_CMAKE)
+  message(STATUS "Merging integrated CMake 3.14+ iOS,tvOS,watchOS,macOS toolchain(s) with this toolchain!")
+endif()
+if(CMAKE_GENERATOR MATCHES "Xcode")
+  message(STATUS "Using Xcode version: ${XCODE_VERSION_INT}")
+endif()
+message(STATUS "CMake version: ${CMAKE_VERSION}")
+if(DEFINED SDK_NAME_VERSION_FLAGS)
+  message(STATUS "Using version flags: ${SDK_NAME_VERSION_FLAGS}")
+endif()
+message(STATUS "Using a data_ptr size of: ${CMAKE_CXX_SIZEOF_DATA_PTR}")
+if(ENABLE_BITCODE_INT)
+  message(STATUS "Bitcode: Enabled")
+else()
+  message(STATUS "Bitcode: Disabled")
+endif()
+
+if(ENABLE_ARC_INT)
+  message(STATUS "ARC: Enabled")
+else()
+  message(STATUS "ARC: Disabled")
+endif()
+
+if(ENABLE_VISIBILITY_INT)
+  message(STATUS "Hiding symbols: Disabled")
+else()
+  message(STATUS "Hiding symbols: Enabled")
+endif()
+
+# Set global properties
+set_property(GLOBAL PROPERTY PLATFORM "${PLATFORM}")
+set_property(GLOBAL PROPERTY APPLE_TARGET_TRIPLE "${APPLE_TARGET_TRIPLE_INT}")
+set_property(GLOBAL PROPERTY SDK_VERSION "${SDK_VERSION}")
+set_property(GLOBAL PROPERTY XCODE_VERSION "${XCODE_VERSION_INT}")
+set_property(GLOBAL PROPERTY OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}")
+
+# Export configurable variables for the try_compile() command.
+set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES
+        PLATFORM
+        XCODE_VERSION_INT
+        SDK_VERSION
+        DEPLOYMENT_TARGET
+        CMAKE_DEVELOPER_ROOT
+        CMAKE_OSX_SYSROOT_INT
+        ENABLE_BITCODE
+        ENABLE_ARC
+        CMAKE_ASM_COMPILER
+        CMAKE_C_COMPILER
+        CMAKE_C_COMPILER_TARGET
+        CMAKE_CXX_COMPILER
+        CMAKE_CXX_COMPILER_TARGET
+        BUILD_LIBTOOL
+        CMAKE_INSTALL_NAME_TOOL
+        CMAKE_C_FLAGS
+        CMAKE_CXX_FLAGS
+        CMAKE_CXX_FLAGS_DEBUG
+        CMAKE_CXX_FLAGS_MINSIZEREL
+        CMAKE_CXX_FLAGS_RELWITHDEBINFO
+        CMAKE_CXX_FLAGS_RELEASE
+        CMAKE_C_LINK_FLAGS
+        CMAKE_CXX_LINK_FLAGS
+        CMAKE_ASM_FLAGS
+        )

 set(CMAKE_PLATFORM_HAS_INSTALLNAME 1)
-set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -headerpad_max_install_names")
-set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -headerpad_max_install_names")
+set(CMAKE_SHARED_LINKER_FLAGS "-rpath @executable_path/Frameworks -rpath @loader_path/Frameworks")
+set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names")
+set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -Wl,-headerpad_max_install_names")
 set(CMAKE_SHARED_MODULE_LOADER_C_FLAG "-Wl,-bundle_loader,")
 set(CMAKE_SHARED_MODULE_LOADER_CXX_FLAG "-Wl,-bundle_loader,")
-set(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".so" ".a")
-
-# Set the find root to the iOS developer roots and to user defined paths.
-set(CMAKE_FIND_ROOT_PATH ${CMAKE_IOS_DEVELOPER_ROOT} ${CMAKE_IOS_SDK_ROOT}
-  ${CMAKE_PREFIX_PATH} CACHE STRING "iOS find search path root" FORCE)
+set(CMAKE_FIND_LIBRARY_SUFFIXES ".tbd" ".dylib" ".so" ".a")
+set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-install_name")
+
+# Set the find root to the SDK developer roots.
+# Note: CMAKE_FIND_ROOT_PATH is only useful when cross-compiling. Thus, do not set on macOS builds.
+if(NOT PLATFORM_INT STREQUAL "MAC" AND NOT PLATFORM_INT STREQUAL "MAC_ARM64")
+  list(APPEND CMAKE_FIND_ROOT_PATH "${CMAKE_OSX_SYSROOT_INT}" CACHE INTERNAL "")
+  set(CMAKE_IGNORE_PATH "/System/Library/Frameworks;/usr/local/lib" CACHE INTERNAL "")
+endif()

 # Default to searching for frameworks first.
 set(CMAKE_FIND_FRAMEWORK FIRST)

 # Set up the default search directories for frameworks.
-set(CMAKE_SYSTEM_FRAMEWORK_PATH
-  ${CMAKE_IOS_SDK_ROOT}/System/Library/Frameworks
-  ${CMAKE_IOS_SDK_ROOT}/System/Library/PrivateFrameworks
-  ${CMAKE_IOS_SDK_ROOT}/Developer/Library/Frameworks)
-
-# Only search the specified iOS SDK, not the remainder of the host filesystem.
-set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
-set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
-set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
-
-# Find (Apple's) libtool.
-execute_process(COMMAND xcrun -sdk ${CMAKE_IOS_SDK_ROOT} -find libtool
-  OUTPUT_VARIABLE IOS_LIBTOOL
-  ERROR_QUIET
-  OUTPUT_STRIP_TRAILING_WHITESPACE)
-# Configure libtool to be used instead of ar + ranlib to build static libraries.
-# This is required on Xcode 7+, but should also work on previous versions of Xcode.
-set(CMAKE_C_CREATE_STATIC_LIBRARY
-  "${IOS_LIBTOOL} -static -o <TARGET> <LINK_FLAGS> <OBJECTS> ")
-set(CMAKE_CXX_CREATE_STATIC_LIBRARY
-  "${IOS_LIBTOOL} -static -o <TARGET> <LINK_FLAGS> <OBJECTS> ")
-
-# This little macro lets you set any XCode specific property.
-macro(set_xcode_property TARGET XCODE_PROPERTY XCODE_VALUE)
-  set_property(TARGET ${TARGET} PROPERTY
-    XCODE_ATTRIBUTE_${XCODE_PROPERTY} ${XCODE_VALUE})
+if(PLATFORM_INT MATCHES "^MAC_CATALYST")
+  set(CMAKE_FRAMEWORK_PATH
+          ${CMAKE_DEVELOPER_ROOT}/Library/PrivateFrameworks
+          ${CMAKE_OSX_SYSROOT_INT}/System/Library/Frameworks
+          ${CMAKE_OSX_SYSROOT_INT}/System/iOSSupport/System/Library/Frameworks
+          ${CMAKE_FRAMEWORK_PATH} CACHE INTERNAL "")
+else()
+  set(CMAKE_FRAMEWORK_PATH
+          ${CMAKE_DEVELOPER_ROOT}/Library/PrivateFrameworks
+          ${CMAKE_OSX_SYSROOT_INT}/System/Library/Frameworks
+          ${CMAKE_FRAMEWORK_PATH} CACHE INTERNAL "")
+endif()
+
+# By default, search both the specified iOS SDK and the remainder of the host filesystem.
+if(NOT CMAKE_FIND_ROOT_PATH_MODE_PROGRAM)
+  set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH CACHE INTERNAL "")
+endif()
+if(NOT CMAKE_FIND_ROOT_PATH_MODE_LIBRARY)
+  set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH CACHE INTERNAL "")
+endif()
+if(NOT CMAKE_FIND_ROOT_PATH_MODE_INCLUDE)
+  set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH CACHE INTERNAL "")
+endif()
+if(NOT CMAKE_FIND_ROOT_PATH_MODE_PACKAGE)
+  set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH CACHE INTERNAL "")
+endif()
+
+#
+# Some helper-macros below to simplify and beautify the CMakeFile
+#
+
+# This little macro lets you set any Xcode specific property.
+macro(set_xcode_property TARGET XCODE_PROPERTY XCODE_VALUE XCODE_RELVERSION)
+  set(XCODE_RELVERSION_I "${XCODE_RELVERSION}")
+  if(XCODE_RELVERSION_I STREQUAL "All")
+    set_property(TARGET ${TARGET} PROPERTY XCODE_ATTRIBUTE_${XCODE_PROPERTY} "${XCODE_VALUE}")
+  else()
+    set_property(TARGET ${TARGET} PROPERTY XCODE_ATTRIBUTE_${XCODE_PROPERTY}[variant=${XCODE_RELVERSION_I}] "${XCODE_VALUE}")
+  endif()
 endmacro(set_xcode_property)

 # This macro lets you find executable programs on the host system.
@@ -263,12 +933,13 @@
   set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
   set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER)
   set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER)
+  set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE NEVER)
+  set(_TOOLCHAIN_IOS ${IOS})
   set(IOS FALSE)
-
   find_package(${ARGN})
-
-  set(IOS TRUE)
-  set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
-  set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-  set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+  set(IOS ${_TOOLCHAIN_IOS})
+  set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
+  set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
+  set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
+  set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH)
 endmacro(find_host_package)


cmake: Define HAVE_ATTRIBUTE_PACKED if needed.

--- extras/buildsystem/cmake/include/config.cmake
+++ extras/buildsystem/cmake/include/config.cmake
@@ -97,6 +97,10 @@

 set( HAVE_DYNAMIC_PLUGINS ${ENABLE_DYNAMIC_PLUGINS})
 set( LIBEXT ${CMAKE_SHARED_MODULE_SUFFIX})
+
+check_c_source_compiles(
+    "struct __attribute__((__packed__)) foo { int a; } b; int main(){return 0;}"
+    HAVE_ATTRIBUTE_PACKED)

 ###########################################################
 # Headers checks


Removed extraneous paths

Removed extraneous paths

--- src/ibp/cmake/FindOpenSSL.cmake
+++ src/ibp/cmake/FindOpenSSL.cmake
@@ -13,7 +13,6 @@
 else (OPENSSL_INCLUDE_DIR AND OPENSSL_LIBRARIES)

   FIND_PATH(OPENSSL_INCLUDE_DIR openssl/ssl.h
-     $ENV{CMAKE_PREFIX_PATH}/include/
      $ENV{HOME}/include/
      /usr/include/
      /usr/local/include/
@@ -66,14 +65,12 @@

    FIND_LIBRARY(OPENSSL_LIBRARIES NAMES ssl ssleay32 ssleay32MD libeay32 libeay32MD
       PATHS
-      $ENV{CMAKE_PREFIX_PATH}/lib/
       $ENV{HOME}/lib/
       /usr/lib
       /usr/local/lib
    )
    FIND_LIBRARY(CRYPTO_LIBRARIES crypto
       PATHS
-      $ENV{CMAKE_PREFIX_PATH}/lib/
       $ENV{HOME}/lib/
       /usr/lib
       /usr/local/lib


also search simgrid where I usually install it on my disk

--- FindSimGrid.cmake
+++ FindSimGrid.cmake
@@ -16,11 +16,11 @@
 set(SimGrid_PATH ${SimGrid_PATH} CACHE PATH "Path to SimGrid library and include")
 find_path(SimGrid_INCLUDE_DIR
   NAMES simgrid_config.h
-  HINTS /usr/include /usr/local/include ${SimGrid_PATH}/include
+  HINTS /usr/include /usr/local/include ${SimGrid_PATH}/include /opt/simgrid/include
 )
 find_library(SimGrid_LIBRARY
   NAMES simgrid
-  HINTS /usr/lib /usr/local/lib ${SimGrid_PATH}/lib
+  HINTS /usr/lib /usr/local/lib ${SimGrid_PATH}/lib /opt/simgrid/lib
 )
 mark_as_advanced(SimGrid_INCLUDE_DIR)
 mark_as_advanced(SimGrid_LIBRARY)


CI: add testing step and remove OTB_DATA_ROOT

--- CI/main_ci.cmake
+++ CI/main_ci.cmake
@@ -39,7 +39,7 @@
 set (CMAKE_COMMAND "cmake")

 # Data directory setting
-set (OTB_DATA_ROOT "${OTB_SOURCE_DIR}/otb-data/") # todo
+# set (OTB_DATA_ROOT "${OTB_SOURCE_DIR}/otb-data/") # todo
 set (OTB_LARGEINPUT_ROOT "") # todo

@@ -74,6 +74,6 @@
   message( SEND_ERROR "An error occurs during ctest_build.")
 endif()

-# ctest_test(PARALLEL_LEVEL 8)
+ctest_test(PARALLEL_LEVEL 8)

 ctest_submit()


Improve vmmlib finder

Improve vmmlib finder

--- FindVMMLIB.cmake
+++ FindVMMLIB.cmake
@@ -10,9 +10,13 @@
   endif()
 endif()

-find_path(VMMLIB_INCLUDE_DIR vmmlib/vmmlib.hpp
+find_path(VMMLIB_INCLUDE_DIRS vmmlib/vmmlib.hpp
   $ENV{VMMLIB_ROOT}/include /usr/include /usr/local/include /opt/local/include)

-if(_vmmlib_output)
-  message(STATUS "Found vmmlib in ${VMMLIB_INCLUDE_DIR}")
+if(VMMLIB_INCLUDE_DIRS)
+  set(VMMLIB_FOUND 1)
+  set(VMMLIB_DEB_BUILD_DEPENDENCIES "vmmlib1-dev")
+  if(_vmmlib_output)
+    message(STATUS "Found vmmlib in ${VMMLIB_INCLUDE_DIRS}")
+  endif()
 endif()


Update to remove <lib> as prefix for contrib plugins

--- build/cmake/CondorPlugin.cmake
+++ build/cmake/CondorPlugin.cmake
@@ -31,7 +31,10 @@
     if (${_CNDR_TARGET}_loc)
         install (TARGETS ${_CNDR_TARGET} DESTINATION ${_INSTALL_LOC} )
     endif()
-
+
+    # disable the lib from name
+    set_property( TARGET ${_CNDR_TARGET} PROPERTY PREFIX "" )
+
     # the following will install the .pdb files, some hackery needs to occur because of build configuration is not known till runtime.
     if ( WINDOWS )
         if ( ${_COPY_PDBS} )


More path fixes.

More path fixes.

--- .cmake/ConfigureStandalone.cmake
+++ .cmake/ConfigureStandalone.cmake
@@ -1,9 +1,9 @@
 if (${BUILD_STANDALONE} MATCHES "true")
   message(STATUS "[standalone-build] ENABLED!")

-  set(BOOST_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/vendor/bin")
-  set(BOOST_INCLUDEDIR "${CMAKE_CURRENT_SOURCE_DIR}/bin/include")
-  set(BOOST_LIBRARYDIR "${CMAKE_CURRENT_SOURCE_DIR}/bin/lib")
+  set(BOOST_ROOT "/build/musikcube/vendor/bin")
+  set(BOOST_INCLUDEDIR "${CMAKE_CURRENT_SOURCE_DIR}/vendor/bin/include")
+  set(BOOST_LIBRARYDIR "${CMAKE_CURRENT_SOURCE_DIR}/vendor/bin/lib")
   set(Boost_NO_SYSTEM_PATHS ON)
   set(Boost_NO_BOOST_CMAKE ON)


CMake issue fixed

CMake issue fixed

--- STM32F303xC.cmake
+++ STM32F303xC.cmake
@@ -1,19 +1,15 @@
 #-DCMAKE_TOOLCHAIN_FILE=STM32F303xC.cmake
-INCLUDE(CMakeForceCompiler)
 SET(CMAKE_SYSTEM_NAME Generic)
 SET(CMAKE_SYSTEM_VERSION 1)
 # specify the cross compiler
-CMAKE_FORCE_C_COMPILER(arm-none-eabi-gcc GNU)
-CMAKE_FORCE_CXX_COMPILER(arm-none-eabi-g++ GNU)
+SET(CMAKE_C_COMPILER_WORKS 1)
+SET(CMAKE_C_COMPILER arm-none-eabi-gcc)
+SET(CMAKE_CXX_COMPILER arm-none-eabi-g++)

 SET(LINKER_SCRIPT ${CMAKE_SOURCE_DIR}/STM32F303VCTx_FLASH.ld)

 SET(COMMON_FLAGS "-g -mlittle-endian -mthumb -mcpu=cortex-m4 -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffreestanding --specs=nano.specs  --specs=nosys.specs --specs=rdimon.specs")
 #SET(COMMON_FLAGS "-mcpu=cortex-m0 -mthumb -mfloat-abi=soft -ffunction-sections -fdata-sections -g -fno-common -fmessage-length=0 --specs=nano.specs  --specs=nosys.specs ")
-SET(CMAKE_CXX_FLAGS "${COMMON_FLAGS} -std=c++11")
-SET(CMAKE_C_FLAGS "${COMMON_FLAGS} -std=gnu99")
-set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
-set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
-set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3")
-set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
-SET(CMAKE_EXE_LINKER_FLAGS "-Wl,-gc-sections,-M=binary.map -T ${LINKER_SCRIPT}")
+SET(CMAKE_CXX_FLAGS_INIT "${COMMON_FLAGS} -std=c++11")
+SET(CMAKE_C_FLAGS_INIT "${COMMON_FLAGS} -std=gnu99")
+SET(CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,-gc-sections,-M=binary.map -T ${LINKER_SCRIPT}")


CMake: Remove own FindLibXml2

CMake: Remove own FindLibXml2

Use the upstream one (available for ages)

--- cmake/modules/FindLibXml2.cmake
+++ cmake/modules/FindLibXml2.cmake
@@ -1,57 +0,0 @@
-# - Try to find LibXml2
-# Once done this will define
-#
-#  LIBXML2_FOUND - System has LibXml2
-#  LIBXML2_INCLUDE_DIR - The LibXml2 include directory
-#  LIBXML2_LIBRARIES - The libraries needed to use LibXml2
-#  LIBXML2_DEFINITIONS - Compiler switches required for using LibXml2
-#  LIBXML2_XMLLINT_EXECUTABLE - The XML checking tool xmllint coming with LibXml2
-
-# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-
-
-IF (LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARIES)
-   # in cache already
-   SET(LibXml2_FIND_QUIETLY TRUE)
-ENDIF ()
-
-IF (NOT WIN32)
-   # use pkg-config to get the directories and then use these values
-   # in the FIND_PATH() and FIND_LIBRARY() calls
-   FIND_PACKAGE(PkgConfig)
-   PKG_CHECK_MODULES(PC_LIBXML libxml-2.0)
-   SET(LIBXML2_DEFINITIONS ${PC_LIBXML_CFLAGS_OTHER})
-ENDIF ()
-
-FIND_PATH(LIBXML2_INCLUDE_DIR libxml/xpath.h
-   HINTS
-   ${PC_LIBXML_INCLUDEDIR}
-   ${PC_LIBXML_INCLUDE_DIRS}
-   PATH_SUFFIXES libxml2
-   )
-
-FIND_LIBRARY(LIBXML2_LIBRARIES NAMES xml2 libxml2
-   HINTS
-   ${PC_LIBXML_LIBDIR}
-   ${PC_LIBXML_LIBRARY_DIRS}
-   )
-
-FIND_PROGRAM(LIBXML2_XMLLINT_EXECUTABLE xmllint)
-# for backwards compat. with KDE 4.0.x:
-SET(XMLLINT_EXECUTABLE "${LIBXML2_XMLLINT_EXECUTABLE}")
-
-IF( NOT LIBXML2_XMLLINT_EXECUTABLE )
-   MESSAGE(STATUS "xmllint program not found. Install it if you want validate generated doc file.")
-ENDIF()
-
-
-INCLUDE(FindPackageHandleStandardArgs)
-
-# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if
-# all listed variables are TRUE
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR)
-
-MARK_AS_ADVANCED(LIBXML2_INCLUDE_DIR LIBXML2_LIBRARIES LIBXML2_XMLLINT_EXECUTABLE)


Set proto file path based on CMAKE_CURRENT_SOURCE_DIR (#600)

--- cmake/opentelemetry-proto.cmake
+++ cmake/opentelemetry-proto.cmake
@@ -1,4 +1,4 @@
-set(PROTO_PATH "${CMAKE_SOURCE_DIR}/third_party/opentelemetry-proto")
+set(PROTO_PATH "${CMAKE_CURRENT_SOURCE_DIR}/third_party/opentelemetry-proto")

 set(COMMON_PROTO "${PROTO_PATH}/opentelemetry/proto/common/v1/common.proto")
 set(RESOURCE_PROTO


Remove debug messages

Remove debug messages

--- TargetHooks.cmake
+++ TargetHooks.cmake
@@ -27,9 +27,7 @@

 # only ever define this macro once, just in case sub-projects include the same rules
 get_property(ADD_LIBRARY_DEFINED GLOBAL PROPERTY ADD_LIBRARY_MACRO_DEFINED)
-message("Testing ADD_LIBRARY_DEFINED gives result ${ADD_LIBRARY_DEFINED}")
 if(NOT ADD_LIBRARY_DEFINED)
-  message("Creating an add_library macro")
   set_property(GLOBAL PROPERTY ADD_LIBRARY_MACRO_DEFINED "1")
   macro(add_library _target)
     _add_library(${_target} ${ARGN})
@@ -69,9 +67,7 @@

       set_property(GLOBAL APPEND PROPERTY ${PROJECT_NAME}_ALL_DEP_TARGETS ${_target})
       set_property(GLOBAL APPEND PROPERTY ${PROJECT_NAME}_ALL_LIB_TARGETS ${_target})
-get_property(XXX_LIBRARY_TARGETS GLOBAL PROPERTY ${PROJECT_NAME}_ALL_LIB_TARGETS)

-message("We have added ${_target} to the ALL_LIB_TARGETS global which is now ${XXX_LIBRARY_TARGETS}")
     endif()
   endmacro()
 endif()


remove usb-1.0 headers from openni ones

remove usb-1.0 headers from openni ones

git-svn-id: 1af002208e930b4d920e7c2b948d1e98a012c795@4002 a9d63959-f2ad-4865-b262-bf0e56cfafb6

--- cmake/Modules/FindOpenNI.cmake
+++ cmake/Modules/FindOpenNI.cmake
@@ -66,8 +66,9 @@
 if(OPENNI_FOUND)
   set(HAVE_OPENNI ON)
   # Add the include directories
-  set(OPENNI_INCLUDE_DIRS ${OPENNI_INCLUDE_DIRS} ${USB_10_INCLUDE_DIR})
+  set(OPENNI_INCLUDE_DIRS ${OPENNI_INCLUDE_DIRS})
   include_directories(${OPENNI_INCLUDE_DIRS})
+	include_directories(${USB_10_INCLUDE_DIR})
   message(STATUS "OpenNI found (include: ${OPENNI_INCLUDE_DIRS}, lib: ${OPENNI_LIBRARY})")
 endif(OPENNI_FOUND)


Removed useless .*

Removed useless .*

--- cmake/OpenCVDetectPython.cmake
+++ cmake/OpenCVDetectPython.cmake
@@ -108,7 +108,7 @@
                         OUTPUT_QUIET
                         ERROR_VARIABLE SPHINX_OUTPUT
                         OUTPUT_STRIP_TRAILING_WHITESPACE)
-        if(SPHINX_OUTPUT MATCHES ".*Sphinx v([0-9][^ \n]*)")
+        if(SPHINX_OUTPUT MATCHES "Sphinx v([0-9][^ \n]*)")
           set(SPHINX_VERSION "${CMAKE_MATCH_1}")
           set(HAVE_SPHINX 1)
           message(STATUS "Found Sphinx ${SPHINX_VERSION}: ${SPHINX_BUILD}")


CMakeLists.txt: Properly detect and link libusb when no pkg-config

Signed-off-by: Andrew Andrianov <02e0a999c50b1f88df7a8f5a04e1b76b35ea6a88@ncrmnt.org>

--- cmake/modules/FindHidApi.cmake
+++ cmake/modules/FindHidApi.cmake
@@ -1,3 +1,6 @@
+# TODO: udev/libusb checks for systems missing pkg-config
+#
+#
 macro(check_bundled_hidapi_package)
   find_path(HIDAPI_DIR hidapi/hidapi.h NO_DEFAULT_PATH  PATHS ${CMAKE_SOURCE_DIR}/deps/hidapi ${CMAKE_SOURCE_DIR}/deps/hidapi-0.7.0 ${UHID_HIDAPI_DIR})
   if (NOT HIDAPI_DIR)
@@ -45,11 +48,14 @@
     message(STATUS "Failed to find system installation of hidapi")
   else()
     message(STATUS "Found HIDAPI: ${HIDAPI}")
-    find_library(LIBUSB libusb)
-    message(STATUS "Found HIDAPI: ${LIBUSB}")
+    if (NOT LIBUSB_FOUND)
+      find_library(LIBUSB usb-1.0)
+      message(STATUS "Found (manually) libusb: ${LIBUSB}")
+      set(LIBUSB_FOUND YES)
+      set(LIBUSB_LIBRARIES "${LIBUSB}")
+    endif()
     set(HIDAPI_LIBRARIES "${HIDAPI}")
-    set(LIBUSB_LIBRARIES "${HIDAPI}")
-    set(HIDAPI_STATIC_LIBRARIES "${HIDAPI} ${LIBUSB}")
+    set(HIDAPI_STATIC_LIBRARIES ${HIDAPI} ${LIBUSB_LIBRARIES})
     set(HIDAPI_FOUND YES)
     find_path(HIDAPI_INCLUDE_DIRS hidapi/hidapi.h)
     message(STATUS "Include files in: ${HIDAPI_INCLUDE_DIRS}")


Update versioning CMake module

Update versioning CMake module

--- cmake/modules/Versioning.cmake
+++ cmake/modules/Versioning.cmake
@@ -1,3 +1,17 @@
+# Set variables from version string
+#
+# Usage:
+#
+#   set_version_variables(version)
+#
+# Variables defined by this module:
+#
+#   VERSION_STRING    The full version string, e.g. 1.2.3-rc4
+#   VERSION_MAJOR     Major version number, e.g. 1 for 1.2.3-rc4
+#   VERSION_MINOR     Minor version number, e.g. 2 for 1.2.3-rc4
+#   VERSION_PATCH     Patch version number, e.g. 3 for 1.2.3-rc4
+#   VERSION_EXTRA     Extra version information, e.g. rc4 for 1.2.3-rc4
+#
 find_package(Git)

 # Set the GIT_BRANCH variable to the current Git branch. In case of error, set
@@ -63,7 +77,8 @@
   endif()
 endfunction()

-# Set the GIT_VERSION_TAG variable. In case of error, set the variable to an
+# Set the GIT_VERSION_TAG variable if a tag is present and matches the format
+# "vX.Y.Z[-rcW]". In case it does not or an error occurs, set the variable to an
 # empty string.
 function(set_git_version_tag_variable)
   execute_process(
@@ -77,6 +92,7 @@
   )
   if(git_result EQUAL 0)
     if(NOT git_output STREQUAL "")
+      # A Git tag has been found; check if it has the format "vX.Y.Z[-rcW]".
       if(git_output MATCHES "^v(0|[1-9][0-9]*)[.](0|[1-9][0-9]*)[.](0|[1-9][0-9]*)([-]rc[1-9][0-9]*)?$")
         set(GIT_VERSION_TAG "${git_output}" PARENT_SCOPE)
         message("Found Git tag ${git_output}")
@@ -94,12 +110,20 @@
   endif()
 endfunction()

+# Check format of version string, set VERSION_STRING and break it into
+# components if it has the format "X.Y.Z[-rcW]"; VERSION_EXTRA is set to an
+# empty string if "-rcW" is not present. If the version string does not match
+# that format, VERSION_MAJOR is set to "${version}" and the remaining component
+# variables are set to empty strings.
 macro(match_and_set_version_variables version)
   set(VERSION_STRING ${version})
+  # Check if version has the form "X.Y.Z[-rcW]".
   if(version MATCHES "^(0|[1-9][0-9]*)[.](0|[1-9][0-9]*)[.](0|[1-9][0-9]*)([-]rc[1-9][0-9]*)?$")
+    # Break the version string components into separate variables.
     set(VERSION_MAJOR "${CMAKE_MATCH_1}" PARENT_SCOPE)
     set(VERSION_MINOR "${CMAKE_MATCH_2}" PARENT_SCOPE)
     set(VERSION_PATCH "${CMAKE_MATCH_3}" PARENT_SCOPE)
+    # Extra version information is optional, so it might not be available.
     if(DEFINED CMAKE_MATCH_4)
       string(SUBSTRING "${CMAKE_MATCH_4}" 1 -1 VERSION_EXTRA_LOCAL)
       set(VERSION_EXTRA "${VERSION_EXTRA_LOCAL}" PARENT_SCOPE)
@@ -114,11 +138,14 @@
   endif()
 endmacro()

+# Main module function (see module documentation).
 function(set_version_variables version)
   if(GIT_FOUND)
     set_git_version_tag_variable()
     if(GIT_VERSION_TAG)
+      # The version tag has the form "vX.Y.Z[-rcW]"; skip the initial 'v'.
       string(SUBSTRING "${GIT_VERSION_TAG}" 1 -1 GIT_VERSION)
+      # If a version has been found in a tag, the version argument must match it.
       if(version STREQUAL GIT_VERSION)
         match_and_set_version_variables("${version}")
       else()
@@ -127,14 +154,18 @@
     else()
       set_git_branch_variable()
       set_git_short_ref_variable()
-      set_git_dirty_variable()
       if(GIT_BRANCH STREQUAL "" OR GIT_SHORT_REF STREQUAL "")
+        # Missing Git information, use provided version argument.
         match_and_set_version_variables("${version}")
       else()
+        # Building from Git repo with no tag with format "vX.Y.Z[-rcW]".
+        set_git_dirty_variable()
         match_and_set_version_variables("${GIT_BRANCH}-${GIT_SHORT_REF}${GIT_DIRTY}")
       endif()
     endif()
   else()
+    # Git package not found by CMake, use provided version argument.
+    message("Git not found for checking tags, using ${version}")
     match_and_set_version_variables("${version}")
   endif()
 endfunction()


Added Documents Menu

Added Documents Menu

--- cmake/platform/Propeller.cmake
+++ cmake/platform/Propeller.cmake
@@ -175,7 +175,10 @@
     endif()

     get_filename_component(COGC_FILE_PATH "${COGC_FILE}" DIRECTORY)
-    list(APPEND COGC_INCLUDE_LIST "${COGC_FILE_PATH}")
+    set(COGC_INCLUDE_LIST_2 ${COGC_INCLUDE_LIST})
+    list(APPEND COGC_INCLUDE_LIST_2 "-I" "${COGC_FILE_PATH}")
+    list(REMOVE_DUPLICATES COGC_INCLUDE_LIST_2)
+    list(REMOVE_ITEM COGC_INCLUDE_LIST_2 "-I")

     set(EX "#include[\t ]+[<\"](.+)[>\"]")

@@ -189,7 +192,7 @@

             set(FILE_PATH "")

-            foreach(COGC_INCLUDE ${COGC_INCLUDE_LIST})
+            foreach(COGC_INCLUDE ${COGC_INCLUDE_LIST_2})
                 if(EXISTS "${COGC_INCLUDE}/${FILE_NAME}")
                     set(FILE_PATH "${COGC_INCLUDE}/${FILE_NAME}")
                     break()
@@ -235,7 +238,10 @@
     endif()

     get_filename_component(SPIN_FILE_PATH "${SPIN_FILE}" DIRECTORY)
-    list(APPEND SPIN_INCLUDE_LIST "${SPIN_FILE_PATH}")
+    set(SPIN_INCLUDE_LIST_2 ${SPIN_INCLUDE_LIST})
+    list(APPEND SPIN_INCLUDE_LIST_2 "-I" "${SPIN_FILE_PATH}")
+    list(REMOVE_DUPLICATES SPIN_INCLUDE_LIST_2)
+    list(REMOVE_ITEM SPIN_INCLUDE_LIST_2 "-I")

     set(EX ".+(\\[.+\\])?[\t ]*:[\t ]*\"(.+)\"")

@@ -256,7 +262,7 @@

             set(FILE_PATH "")

-            foreach(SPIN_INCLUDE ${SPIN_INCLUDE_LIST})
+            foreach(SPIN_INCLUDE ${SPIN_INCLUDE_LIST_2})
                 if(EXISTS "${SPIN_INCLUDE}/${FILE_NAME}")
                     set(FILE_PATH "${SPIN_INCLUDE}/${FILE_NAME}")
                     break()
@@ -288,7 +294,7 @@

             set(FILE_PATH "")

-            foreach(SPIN_INCLUDE ${SPIN_INCLUDE_LIST})
+            foreach(SPIN_INCLUDE ${SPIN_INCLUDE_LIST_2})
                 if(EXISTS "${SPIN_INCLUDE}/${FILE_NAME}")
                     set(FILE_PATH "${SPIN_INCLUDE}/${FILE_NAME}")
                     break()
@@ -1043,21 +1049,21 @@

     set(LIB_TARGET_LIST "")

+    set(NO_RECURSE NO_RECURSE)
+
     foreach(LIBRARY_PATH ${LIBRARY_PATH_LIST})
-
-        set(NO_RECURSE NO_RECURSE)

         setup_library("${LIBRARY_PATH}"
         "${EXTRA_COMPILE_FLAGS}"
         "${EXTRA_LINK_FLAGS}")

-        unset(NO_RECURSE)
-
         if(LIB_TARGET)
             list(APPEND LIB_TARGET_LIST "${LIB_TARGET}")
         endif()

     endforeach()
+
+    unset(NO_RECURSE)

     set(LIB_TARGETS ${LIB_TARGET_LIST} PARENT_SCOPE)


Use lowercase for internal variable names

--- cmake/snippets/vxl_tests.cmake
+++ cmake/snippets/vxl_tests.cmake
@@ -27,13 +27,13 @@
 }
 ")

-    try_compile(VXL_HAS_FLOAT_DECLS_COMPILE
+    try_compile(vxl_has_float_decls_compile
       "${cmakefiles_dir}/vxl_has_float_decls"
       "${vxl_has_float_decls_path}"
       CMAKE_FLAGS
         "-DINCLUDE_DIRECTORIES=${VXL_VCL_INCLUDE_DIR}")

-    if (NOT VXL_HAS_FLOAT_DECLS_COMPILE)
+    if (NOT vxl_has_float_decls_compile)
       message(WARNING "VXL was compiled such that float declarations are in "
         "header files, but the `-pedantic` flag does not allow this, please "
         "continue at your own risk.")


COMP: fix jpeg configure build

COMP: fix jpeg configure build

--- SuperBuild/CMake/External_jpeg.cmake
+++ SuperBuild/CMake/External_jpeg.cmake
@@ -27,7 +27,12 @@
     ${JPEG_SB_SRC}/win/)

 else()
-  set(JPEG_CONFIGURE_COMMAND  "${SB_ENV_CONFIGURE_CMD};${JPEG_SB_SRC}/configure")
+  set(JPEG_CONFIGURE_COMMAND  "${SB_ENV_CONFIGURE_CMD};${JPEG_SB_SRC}/configure"
+    --prefix=${SB_INSTALL_PREFIX}
+    --without-java
+    --disable-dependency-tracking
+    --without-simd
+    )
   set(JPEG_PATCH_COMMAND)
 endif()


STYLE: Nightly Date Stamp

STYLE: Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -7,4 +7,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 06)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   15)
+SET(KWSYS_DATE_STAMP_DAY   16)


STYLE: Nightly Date Stamp

STYLE: Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -7,4 +7,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 04)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   21)
+SET(KWSYS_DATE_STAMP_DAY   22)


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -18,4 +18,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 04)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   26)
+SET(KWSYS_DATE_STAMP_DAY   27)


STYLE: Nightly Date Stamp

STYLE: Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -7,4 +7,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 10)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   23)
+SET(KWSYS_DATE_STAMP_DAY   24)


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -18,4 +18,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 12)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   03)
+SET(KWSYS_DATE_STAMP_DAY   04)


STYLE: Nightly Date Stamp

STYLE: Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -7,4 +7,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 10)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   06)
+SET(KWSYS_DATE_STAMP_DAY   07)


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -18,4 +18,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 03)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   16)
+SET(KWSYS_DATE_STAMP_DAY   17)


build: Clean up the find-module for StdFilesystem

The `check_cxx_source_compiles` function automatically sets cache
variables, which is more useful for our purposes.

--- cmake/FindStdFilesystem.cmake
+++ cmake/FindStdFilesystem.cmake
@@ -20,37 +20,46 @@
 # Copyright (C) 2018 Scylladb, Ltd.
 #

-set (_stdfilesystem_test_source ${CMAKE_CURRENT_LIST_DIR}/code_tests/StdFilesystem_test.cc)
+include (CheckCXXSourceCompiles)
+file (READ ${CMAKE_CURRENT_LIST_DIR}/code_tests/StdFilesystem_test.cc _stdfilesystem_test_code)

-try_compile (StdFilesystem_test_stdc++fs
-  ${CMAKE_CURRENT_BINARY_DIR}
-  SOURCES ${_stdfilesystem_test_source}
-  LINK_LIBRARIES stdc++fs)
+macro (_stdfilesystem_check_compiles var)
+  set (libraries ${ARGN})
+  set (CMAKE_REQUIRED_LIBRARIES ${libraries})
+  set (CMAKE_REQUIRED_FLAGS -std=gnu++14)
+  check_cxx_source_compiles ("${_stdfilesystem_test_code}" ${var})
+endmacro ()

-if (StdFilesystem_test_stdc++fs)
-  set (StdFilesystem_LIBRARY_NAME stdc++fs)
+# Try to compile without the library first.
+_stdfilesystem_check_compiles (StdFilesystem_NO_EXPLICIT_LINK)
+
+if (StdFilesystem_NO_EXPLICIT_LINK)
+  set (StdFilesystem_FOUND yes)
 else ()
-  # Try libc++.
-  try_compile (StdFilesystem_test_c++experimental
-    ${CMAKE_CURRENT_BINARY_DIR}
-    SOURCES ${_stdfilesystem_test_source}
-    LINK_LIBRARIES libc++experimental)
+  _stdfilesystem_check_compiles (StdFilesystem_STDCXXFS_LIBRARY
+    stdc++fs)

-  if (StdFilesystem_test_c++experimental)
-    set (StdFilesystem_LIBRARY_NAME c++experimental)
+  if (StdFilesystem_STDCXXFS_LIBRARY)
+    set (StdFilesystem_LIBRARY_NAME stdc++fs)
+  else ()
+    # Try libc++.
+    _stdfilesystem_check_compiles (StdFilesystem_CXXEXPERIMENTAL_LIBRARY
+      libc++experimental)
+
+    if (StdFilesystem_CXXEXPERIMENTAL_LIBRARY)
+      set (StdFilesystem_LIBRARY_NAME c++experimental)
+    endif ()
   endif ()
+
+  if (StdFilesystem_LIBRARY_NAME)
+    set (StdFilesystem_LIBRARIES -l${StdFilesystem_LIBRARY_NAME})
+  endif ()
+
+  include (FindPackageHandleStandardArgs)
+
+  find_package_handle_standard_args (StdFilesystem
+    REQUIRED_VARS StdFilesystem_LIBRARY_NAME)
 endif ()
-
-if (StdFilesystem_LIBRARY_NAME)
-  set (StdFilesystem_FOUND ON)
-  set (StdFilesystem_LIBRARIES -l${StdFilesystem_LIBRARY_NAME})
-endif ()
-
-include (FindPackageHandleStandardArgs)
-
-find_package_handle_standard_args (StdFilesystem
-  FOUND_VAR StdFilesystem_FOUND
-  REQUIRED_VARS StdFilesystem_LIBRARY_NAME)

 if (StdFilesystem_FOUND AND NOT (TARGET StdFilesystem::filesystem))
   add_library (StdFilesystem::filesystem INTERFACE IMPORTED)
@@ -59,5 +68,3 @@
     PROPERTIES
       INTERFACE_LINK_LIBRARIES ${StdFilesystem_LIBRARIES})
 endif ()
-
-mark_as_advanced (StdFilesystem_LIBRARY_NAME)


Removed duplicated line

Removed duplicated line

Former-commit-id: d21b79836b57ef11c2f549a32803e4cb5ca3524a

--- cmake/SetupDependencies.cmake
+++ cmake/SetupDependencies.cmake
@@ -6,8 +6,6 @@
 ### -lpthread which causes link errors downstream with         ###
 ###    -Wl,--whole-archive.... -Wl,--no-whole-archive          ###
 ##################################################################
-set(THREADS_PREFER_PTHREAD_FLAG TRUE)
-find_package(Threads)
 set(THREADS_PREFER_PTHREAD_FLAG TRUE)
 find_package(Threads REQUIRED)
 target_link_libraries(Threads::Threads INTERFACE rt dl)


Specify protoc/libprotobuf to depend on external protobuf build

--- cmake/external/protobuf.cmake
+++ cmake/external/protobuf.cmake
@@ -24,9 +24,11 @@

 ADD_LIBRARY(Protobuf STATIC IMPORTED)
 SET_PROPERTY(TARGET Protobuf PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/protobuf_project/src/protobuf/libprotobuf.a)
+ADD_DEPENDENCIES(Protobuf Protobuf_project)
 SET(Protobuf_LIBRARIES "")
 LIST(APPEND Protobuf_LIBRARIES Protobuf ${ZLIB_LIBRARIES})

 ADD_EXECUTABLE(Protobuf_PROTOC_EXECUTABLE IMPORTED)
 SET_PROPERTY(TARGET Protobuf_PROTOC_EXECUTABLE PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/protobuf_project/src/protobuf/protoc)
+ADD_DEPENDENCIES(Protobuf_PROTOC_EXECUTABLE Protobuf_project)
 SET(Protobuf_PROTOC_EXECUTABLE ${CMAKE_CURRENT_BINARY_DIR}/protobuf_project/src/protobuf/protoc)


update the cmake cmd, test=develop (#28344)

--- cmake/external/pybind11.cmake
+++ cmake/external/pybind11.cmake
@@ -34,6 +34,11 @@
         "${PYBIND_DOWNLOAD_CMD}"
         PREFIX            ${PYBIND_PREFIX_DIR}
         SOURCE_DIR        ${PYBIND_SOURCE_DIR}
+        # If we explicitly leave the `UPDATE_COMMAND` of the ExternalProject_Add
+        # function in CMakeLists blank, it will cause another parameter GIT_TAG
+        # to be modified without triggering incremental compilation, and the
+        # third-party library version changes cannot be incorporated.
+        # reference: https://cmake.org/cmake/help/latest/module/ExternalProject.html
         UPDATE_COMMAND    ""
         CONFIGURE_COMMAND ""
         BUILD_COMMAND     ""


The wxWidgets driver is also built if the stdint.h check fails - which is the case for Visual C++. The alternative definition in plplot.h is okay for this case.

svn path=/trunk/; revision=9025

--- cmake/modules/wxwidgets.cmake
+++ cmake/modules/wxwidgets.cmake
@@ -37,24 +37,13 @@
     "setting PLD_wxwidgets to OFF."
     )
     set(PLD_wxwidgets OFF CACHE BOOL "Enable wxwidgets device" FORCE)
+  else(NOT wxWidgets_FOUND)
+		# Check if stdint.h can be used from c++ (HAVE_CXX_STDINT_H)
+		include(TestForStdintCXX)
   endif(NOT wxWidgets_FOUND)
 endif(PLD_wxwidgets)

-# Need to add check if stdint.h can be used from c++ (HAVE_CXX_STDINT_H)
 if(PLD_wxwidgets)
-  include(TestForStdintCXX)
-  if(NOT CMAKE_CXX_STDINT_H)
-    message(STATUS
-    "WARNING: CXX compiler doesn't support using stdint.h so "
-    "setting PLD_wxwidgets to OFF."
-    )
-    set(PLD_wxwidgets OFF CACHE BOOL "Enable wxwidgets device" FORCE)
-  endif(NOT CMAKE_CXX_STDINT_H)
-endif(PLD_wxwidgets)
-
-if(PLD_wxwidgets)
-  #message("wxWidgets_INCLUDE_DIRS = ${wxWidgets_INCLUDE_DIRS}")
-  #message("wxWidgets_DEFINITIONS = ${wxWidgets_DEFINITIONS}")
   string(REGEX REPLACE ";" " -I"
   wxwidgets_COMPILE_FLAGS
   "-I${wxWidgets_INCLUDE_DIRS}"


Add missing deb dependency

Add missing deb dependency

--- SubProject.cmake
+++ SubProject.cmake
@@ -73,8 +73,8 @@
   endif()

   string(TOUPPER ${name} NAME)
-  list(APPEND ${NAME}_DEB_DEPENDS pkg-config git cmake git-review doxygen
-    ${OPTIONAL_DEBS})
+  list(APPEND ${NAME}_DEB_DEPENDS pkg-config git cmake git-review doxygen ccache
+    graphviz ${OPTIONAL_DEBS})
   set(${NAME}_BUILD_DEBS ${NAME}_DEB_DEPENDS)
   list(APPEND ${NAME}_DEB_DEPENDS ninja-build lcov cppcheck clang
     clang-format-3.5) # optional deb packages, not added to build spec


FIX (#6517): set correct cxx default flags also for MITK in superbuild

--- SuperBuild.cmake
+++ SuperBuild.cmake
@@ -207,6 +207,8 @@
     -DMITK_SUPERBUILD_BINARY_DIR:PATH=${MITK_BINARY_DIR}
     -DCMAKE_INSTALL_PREFIX:PATH=${ep_install_dir}
     -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
+	"-DCMAKE_CXX_FLAGS:STRING=${ep_common_CXX_FLAGS} ${MITK_CXX_FLAGS}"
+    "-DCMAKE_C_FLAGS:STRING=${ep_common_C_FLAGS} ${MITK_C_FLAGS}"
     -DMITK_CXX_FLAGS:STRING=${MITK_CXX_FLAGS}
     -DMITK_C_FLAGS:STRING=${MITK_C_FLAGS}
     -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}


Fix maven detection script

Fix maven detection script

Change-Id: I50026cef0b4e661b0c134c3bfbf6ae89b8130772

--- CMake/FindMaven.cmake
+++ CMake/FindMaven.cmake
@@ -11,10 +11,10 @@
 #
 #=============================================================================

-set (NPM_ROOT /usr/bin CACHE STRING "maven directory")
+set (MAVEN_ROOT /usr/bin CACHE STRING "maven directory")

-find_program(Maven_EXECUTABLE NAMES maven
-        HINTS ENV${NPM_ROOT}/maven ${NPM_ROOT}/maven)
+find_program(Maven_EXECUTABLE NAMES mvn
+        HINTS ENV${MAVEN_ROOT}/mvn ${MAVEN_ROOT}/mvn)

 # handle the QUIETLY and REQUIRED arguments and set Maven_FOUND to TRUE if
 # all listed variables are TRUE


Added lxml for pip

Added lxml for pip

--- third_party/pip_libraries.cmake
+++ third_party/pip_libraries.cmake
@@ -26,6 +26,7 @@
 pip_library(django django)
 pip_library(django-nonrel git+git://github.com/django-nonrel/django)
 pip_library(djangotoolbox git+git://github.com/django-nonrel/djangotoolbox)
+pip_library(lxml lxml)
 pip_library(marisa-trie marisa-trie CC=/usr/bin/gcc CXX=/usr/bin/g++)
 pip_library(mongodb-engine git+git://github.com/django-nonrel/mongodb-engine)
 pip_library(numpy numpy CC=/usr/bin/gcc)


Use ungenundtized name

Use ungenundtized name

--- bmi/bmif.pc.cmake
+++ bmi/bmif.pc.cmake
@@ -1,5 +1,5 @@
 Name: BMI
-Description: Basic Modeling Interface
+Description: Basic Model Interface
 Version: ${BMI_VERSION}
 Libs: -L${CMAKE_INSTALL_PREFIX}/lib -lbmif
 Cflags: -I${CMAKE_INSTALL_PREFIX}/include


[cmake]Fix broken dmd-build. Closes #20. Thanks to mwarning for troubleshooting and patching.

--- cmake/FindD.cmake
+++ cmake/FindD.cmake
@@ -30,54 +30,52 @@

 set(D_LIBS "dl") # Default D-libraries needed

-## Find D compiler and parse its version.
+## Find D compiler from user or PATH
 find_program(DC NAMES dmd ldc)
+set(DC "${DC}" CACHE STRING "Manually select compiler")
+
 if (DC)
-    get_filename_component(dc_path ${DC} PATH)
-    if("${dc_path}" STREQUAL ${CMAKE_BINARY_DIR})
-        get_filename_component(DC ${DC} NAME)
-    endif("${dc_path}" STREQUAL ${CMAKE_BINARY_DIR})
-    exec_program(${DC} ARGS "" OUTPUT_VARIABLE d_output)
-    string(REGEX MATCH "Digital Mars D Compiler v[0-9]\\.[0-9]+" dmd_version "${d_output}")
-    if (dmd_version)
+    get_filename_component(dc_name ${DC} NAME)
+
+    ## Configure for the found compiler
+    if (dc_name STREQUAL "dmd")
         set(D_IS_MARS true)
         set(D_IS_DMD true)
         set(D_COMPILER_NAME "Digital Mars D Compiler")
-        string(REGEX REPLACE "Digital Mars D Compiler v([0-9])\\.[0-9]+" "\\1" D_VERSION "${dmd_version}")
-        string(REGEX REPLACE "Digital Mars D Compiler v[0-9]\\.([0-9]+)" "\\1" D_FRONTEND "${dmd_version}")
-    else (dmd_version)
-        string(REGEX MATCH "LLVM-based D Compiler" is_ldc "${d_output}")
-        if (is_ldc)
-            if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "^i.86$")
-                set(LDC_DEFAULT_CPU "i686")
-            elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^(amd|x86[_-])64$")
-                set(LDC_DEFAULT_CPU "x86-64")
-            else (${CMAKE_SYSTEM_PROCESSOR} MATCHES "^i.86$")
-                set(LDC_DEFAULT_CPU "")
-            endif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^i.86$")
-            set(LDC_CPU ${LDC_DEFAULT_CPU} CACHE STRING "Set the CPU for LLVM to generate for")
-
-            exec_program(${DC} ARGS "--version" OUTPUT_VARIABLE d_output)
-            string(REGEX MATCH "based on DMD v[0-9]\\.[0-9]+" ldc_version "${d_output}")
-            set(D_IS_LLVM true)
-            set(D_IS_LDC true)
-
-            if(ldc_version)
-                set(D_IS_LLVM true)
-                set(D_COMPILER_NAME "LLVM-based D Compiler")
-                string(REGEX REPLACE "based on DMD v([0-9])\\.[0-9]+" "\\1" D_VERSION "${ldc_version}")
-                string(REGEX REPLACE "based on DMD v[0-9]\\.([0-9]+)" "\\1" D_FRONTEND "${ldc_version}")
-            else(ldc_version)
-                message(FATAL_ERROR "LDC compiler found, but the version can not be processed")
-            endif(ldc_version)
-        else (is_ldc)
-            message(FATAL_ERROR "D compiler are not found")
-        endif(is_ldc)
-    endif(dmd_version)
-    message(STATUS "D compiler found -- ${D_COMPILER_NAME} v${D_VERSION}.${D_FRONTEND}")
+        set(dc_version_switch "")
+    elseif (dc_name STREQUAL "ldc")
+        set(D_IS_LLVM true)
+        set(D_IS_LDC true)
+        set(D_COMPILER_NAME "LLVM-based D Compiler")
+        set(dc_version_switch "--version")
+
+        if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "^i.86$")
+            set(LDC_DEFAULT_CPU "i686")
+        elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^(amd|x86[_-])64$")
+            set(LDC_DEFAULT_CPU "x86-64")
+        else (${CMAKE_SYSTEM_PROCESSOR} MATCHES "^i.86$")
+            set(LDC_DEFAULT_CPU "")
+        endif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^i.86$")
+        set(LDC_CPU ${LDC_DEFAULT_CPU} CACHE STRING "Set the CPU for LLVM to generate for")
+    else (dc_name STREQUAL "dmd")
+        message(FATAL_ERROR "Unknown compiler ${DC}")
+    endif (dc_name STREQUAL "dmd")
+
+    ## Figure out versions.
+    exec_program(${DC} ARGS "${dc_version_switch}" OUTPUT_VARIABLE d_output)
+    string(REGEX MATCH "v([0-9])\\.([0-9]+)" matches "${d_output}")
+
+    if (NOT matches)
+        message(FATAL_ERROR "${DC} compiler output doesn't match")
+    endif (NOT matches)
+
+    set(D_VERSION "${CMAKE_MATCH_1}")
+    set(D_FRONTEND ${CMAKE_MATCH_2})
 else (DC)
-    message(FATAL_ERROR "D compliler are not found")
+    message(FATAL_ERROR "No D compiler found")
 endif (DC)
+
+message(STATUS "D compiler found -- ${D_COMPILER_NAME} v${D_VERSION}.${D_FRONTEND}")

 ## Get D compiler path.
 get_filename_component(DC_PATH ${DC} PATH)


Bump WSREP_PATCH_VERSION to 18

Bump WSREP_PATCH_VERSION to 18

--- cmake/wsrep.cmake
+++ cmake/wsrep.cmake
@@ -26,7 +26,7 @@
 OPTION(WITH_WSREP "WSREP replication API (to use, e.g. Galera Replication library)" ${with_wsrep_default})

 # Set the patch version
-SET(WSREP_PATCH_VERSION "17")
+SET(WSREP_PATCH_VERSION "18")

 # Obtain wsrep API version
 FILE(STRINGS "${MySQL_SOURCE_DIR}/wsrep/wsrep_api.h" WSREP_API_VERSION


add forgotten macro

add forgotten macro

--- config.h.in.cmake
+++ config.h.in.cmake
@@ -96,6 +96,9 @@
 /* "Using LLVM 4.0" */
 #cmakedefine LLVM_4_0

+/* "Using LLVM 5.0" */
+#cmakedefine LLVM_5_0
+
 #cmakedefine LLVM_BUILD_MODE_DEBUG

 #ifndef LLVM_VERSION


COMP: Fix different CMake if/endif for TubeTK_USE_BOOST.

--- Applications/TubeTKModules.cmake
+++ Applications/TubeTKModules.cmake
@@ -65,7 +65,7 @@
     ComputeImageQuantiles
     TransferLabelsToRegions
     TubeGraphKernel )
-endif( TubeTK_USE_Boost )
+endif( TubeTK_USE_BOOST )

 set( TubeTK_${proj}_VTK_MODULES )
 if( TubeTK_USE_VTK )


Fix two segfaulting geovis tests.

Fix two segfaulting geovis tests.

TestCoincidentGeoGraphRepresentation2D and TestLabeledGeoView2D
would segfault because the labelmapper won't work without
the freetype module which has a concrete implementation for parts of it.

Change-Id: I2c4df23fef91c75c37da6aa0dc435c9a9b00ea6a

--- Geovis/Core/module.cmake
+++ Geovis/Core/module.cmake
@@ -13,5 +13,6 @@
     vtkViewsGeovis
     vtkViewsInfovis
     vtkRenderingCore
+    vtkRenderingFreeTypeOpenGL
     vtkTestingRendering
   )


INCLUDE_INSTALL_DIR is set by KDE4 or QImagaBlitz in kdesupport

svn path=/trunk/kdesupport/akonadi/; revision=802188

--- akonadi.pc.cmake
+++ akonadi.pc.cmake
@@ -1,7 +1,7 @@
 prefix=@CMAKE_INSTALL_PREFIX@
 exec_prefix=@CMAKE_INSTALL_PREFIX@
 libdir=@LIB_INSTALL_DIR@
-includedir=@INCLUDE_INSTALL_DIR@
+includedir=@CMAKE_INSTALL_PREFIX@/include

 Name: Akonadi
 Description: Akonadi server and infrastructure needed to build client libraries and applications


ios.toolchain.cmake: add x86_64 target

ios.toolchain.cmake: add x86_64 target

--- cmake-toolchains/ios.toolchain.cmake
+++ cmake-toolchains/ios.toolchain.cmake
@@ -13,7 +13,7 @@

 set(CMAKE_SYSTEM_NAME iOS)
 set(CMAKE_OSX_SYSROOT "iphoneos")
-set(CMAKE_OSX_ARCHITECTURES "armv7;arm64")
+set(CMAKE_OSX_ARCHITECTURES "armv7;arm64;x86_64")
 set(CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos;-iphonesimulator")

 # define configurations


[CMAKE] Attach the linker flags to target properties

Summary:
This is achieved by using the `add_link_options` function instead of
appending the flags to the global `CMAKE_EXE_LINKER_FLAGS` variable.

Depends on D5035.

Test Plan:
  ninja check
Run the Gitian builds.

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D5037

--- cmake/modules/AddCompilerFlags.cmake
+++ cmake/modules/AddCompilerFlags.cmake
@@ -117,11 +117,8 @@
 	# Save the current linker flags
 	set(SAVE_CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS})

-	# If the flag is already set, avoid duplicating it
-	string(FIND "${CMAKE_EXE_LINKER_FLAGS}" "${FLAG}" FLAG_POSITION)
-	if(${FLAG_POSITION} LESS 0)
-		string(APPEND CMAKE_EXE_LINKER_FLAGS " ${FLAG}")
-	endif()
+	# Append the flag under test to the linker flags
+	string(APPEND CMAKE_EXE_LINKER_FLAGS " ${FLAG}")

 	# CHECK_CXX_COMPILER_FLAG calls CHECK_CXX_SOURCE_COMPILES which in turn
 	# calls try_compile, so it will check our flag
@@ -139,10 +136,8 @@

 		check_linker_flag(${FLAG_IS_SUPPORTED} ${f})

-		# If the flag is supported, add it to CMAKE_EXE_LINKER_FLAGS
 		if(${FLAG_IS_SUPPORTED})
-			string(APPEND CMAKE_EXE_LINKER_FLAGS " ${f}")
+			add_link_options(${f})
 		endif()
 	endforeach()
-	set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} PARENT_SCOPE)
 endfunction()


Whitespace tweak.

Whitespace tweak.

--- cmake/modules/plplot_functions.cmake
+++ cmake/modules/plplot_functions.cmake
@@ -142,7 +142,7 @@
   endforeach(example_pages ${examples_pages_LIST})

   set(${output_list} ${file_list} PARENT_SCOPE)
-endfunction(list_example_files )
+endfunction(list_example_files)

 function(TRANSFORM_VERSION numerical_result version)
   # internal_version ignores everything in version after any character that


build: Install botan to ARCH folder

build: Install botan to ARCH folder

--- cmake/botan.cmake
+++ cmake/botan.cmake
@@ -29,4 +29,4 @@
 set_target_properties(libbotan PROPERTIES IMPORTED_LOCATION ${BOTAN_LIB})

 install(FILES ${BOTAN_LIB} DESTINATION includeos/${ARCH}/lib)
-install(DIRECTORY ${BOTAN_INCLUDE} DESTINATION includeos/include)
+install(DIRECTORY ${BOTAN_INCLUDE} DESTINATION includeos/${ARCH}/include)


remove spurious line

remove spurious line

--- cmake/utils.cmake
+++ cmake/utils.cmake
@@ -126,7 +126,6 @@
         endif()
 endfunction()

-project(nano)
 # setup LTO
 function(setup_lto)
         set(CMAKE_REQUIRED_FLAGS "-flto")


CI: use ITK doxygen tag for doxygen

CI: use ITK doxygen tag for doxygen

--- CI/ubuntu-18.04-llvm-shark.cmake
+++ CI/ubuntu-18.04-llvm-shark.cmake
@@ -39,6 +39,15 @@
 if(NOT ${ci_do_doxygen} EQUAL -1)
   set(site_option
 "${site_option}
-BUILD_DOCUMENTATION:BOOL=ON")
+BUILD_DOCUMENTATION:BOOL=ON
+OTB_DOXYGEN_ITK_TAGFILE:FILEPATH=${CTEST_BINARY_DIRECTORY}/InsightDoxygenDocTag-4.13.0
+OTB_DOXYGEN_ITK_DOXYGEN_URL:STRING=\"https://itk.org/Doxygen413/html\"
+")
   set (ENABLE_DOXYGEN ON)
+  # The ITK doxygen tag file needs to be patched before being used for OTB
+  # See otb-devutils/Scripts/tagfile_fix.py
+  message(STATUS "Get resources for Doxygen build ...")
+  execute_process(COMMAND wget https://www.orfeo-toolbox.org/packages/archives/Doxygen/InsightDoxygenDocTag-4.13.0.gz
+                  COMMAND gzip -d InsightDoxygenDocTag-4.13.0.gz
+                  WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY})
 endif()


Add optional old_name to sitk_legacy_naming macro

Generalize the sitk_legacy_naming macro so that is can be used for any
CMake variable naming migration.

--- CMake/sitkSITKLegacyNaming.cmake
+++ CMake/sitkSITKLegacyNaming.cmake
@@ -1,7 +1,7 @@
 #
 # Migrate SITK prefixed CMake options to SimpleITK
 #
-# sitk_legacy_naming( new_var_name)
+# sitk_legacy_naming( new_var_name [old_var_name] )
 #   new_var_name - a variable name which has the prefix migrated from
 # "SITK" to SimpleITK.
 #
@@ -22,7 +22,12 @@

 macro(sitk_legacy_naming new_var_name )

-  string( REGEX REPLACE  "^SimpleITK_" "SITK_" old_var_name "${new_var_name}" )
+
+  if(NOT "${ARGV1}" STREQUAL "")
+    set( old_var_name ${ARGV1} )
+  else()
+    string( REGEX REPLACE  "^SimpleITK_" "SITK_" old_var_name "${new_var_name}" )
+  endif()

   if (DEFINED "${old_var_name}")
     message(WARNING "SimpleITK variable \"${old_var_name}\" is \


Use pkg-config in Portaudio.cmake

Use pkg-config in Portaudio.cmake

--- CMakeModules/FindPortaudio.cmake
+++ CMakeModules/FindPortaudio.cmake
@@ -4,20 +4,28 @@
   # in cache already
   SET(Portaudio_FOUND TRUE)
 ELSE (Portaudio_LIBRARIES AND Portaudio_INCLUDE_DIRS)
+  FIND_PACKAGE(PkgConfig)
+
+  IF (PKG_CONFIG_FOUND)
+    PKG_CHECK_MODULES(PKG_Portaudio portaudio-2.0)
+  ENDIF (PKG_CONFIG_FOUND)
+
   INCLUDE(LibFindMacros)

-  FIND_PATH(Portaudio_INCLUDE_DIR portaudio.h
-    HINTS ${Portaudio_INCLUDEDIR} ${Portaudio_SRCDIR}/include)
+  FIND_PATH(Portaudio_INCLUDE_DIR
+    NAMES portaudio.h
+    HINTS
+    ${PKG_Portaudio_INCLUDE_DIRS}
+    ${Portaudio_SRCDIR}/include)

   FIND_LIBRARY(Portaudio_LIBRARY
     NAMES portaudio
-    HINTS ${Portaudio_LIBDIR} ${Portaudio_SRCDIR}/lib/.libs )
-
-  # TODO make this automatic (parse .pc or .la)
-  SET(Portaudio_DEPENDS -lwinmm)
+    HINTS
+    ${PKG_Portaudio_LIBRARY_DIRS}
+    ${Portaudio_SRCDIR}/lib/.libs )

   SET(Portaudio_PROCESS_INCLUDES Portaudio_INCLUDE_DIR)
-  SET(Portaudio_PROCESS_LIBS Portaudio_LIBRARY Portaudio_DEPENDS)
+  SET(Portaudio_PROCESS_LIBS Portaudio_LIBRARY)
   LIBFIND_PROCESS(Portaudio)

 ENDIF (Portaudio_LIBRARIES AND Portaudio_INCLUDE_DIRS)


Report a CMake error if script compilation fails

--- CMake/ctkMacroCompilePythonScript.cmake
+++ CMake/ctkMacroCompilePythonScript.cmake
@@ -249,7 +249,11 @@

 execute_process(
   COMMAND \"@PYTHON_EXECUTABLE@\" \"@compile_all_script@\"
+  RESULT_VARIABLE result_var
   )
+if(NOT result_var STREQUAL 0)
+  message(FATAL_ERROR \"Failed to compile python scripts: ${target} \")
+endif()
 ")

     add_custom_command(


cmake: remove CMake policy CMP0000 and CMP0002 in unittest.cmake

Two CMake policies has been removed:
CMP0000 was introduced in CMake 2.6 and set to OLD, but with all Zephyr
        CMake files using cmake_minimum_required() then there is no
	reason for having this policy to OLD.
CMP0002 was introduced in CMake 2.6 and was set to NEW.

Signed-off-by: Torsten Rasmussen <a7c5b1d5a1f41fce6edfa3f7c2392ae0c59deafe@nordicsemi.no>

--- subsys/testsuite/unittest.cmake
+++ subsys/testsuite/unittest.cmake
@@ -1,8 +1,6 @@
 # SPDX-License-Identifier: Apache-2.0

 cmake_minimum_required(VERSION 3.20.0)
-cmake_policy(SET CMP0000 OLD)
-cmake_policy(SET CMP0002 NEW)

 enable_language(C CXX ASM)


Another variable that should not be expanded

--- scripts/PackageLookup.cmake
+++ scripts/PackageLookup.cmake
@@ -80,7 +80,7 @@
     # First try and find package (unless downloading by default)
     set(dolook TRUE)
     if(DOWNLOAD AND NOT recursive)
-        if(${CHECK})
+        if(CHECK)
             set(do_rootchange TRUE)
         endif()
         set(dolook FALSE)


0000534: cmake error

0000534: cmake error

git-svn-id: ab018d182bc98f655c1a5d04c2f074754dc1367a@5263 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d

--- cMake/FindSpnav.cmake
+++ cMake/FindSpnav.cmake
@@ -1,29 +1,35 @@
-# Find the spnav library and header.
-#
-# Sets the usual variables expected for find_package scripts:
-#
-# SPNAV_INCLUDE_DIR - header location
-# SPNAV_LIBRARIES - library to link against
-# SPNAV_FOUND - true if pugixml was found.
-
 IF(UNIX)

-    FIND_PATH(SPNAV_INCLUDE_DIR spnav.h)
+    set(TEST_SPNAV_CMAKE TRUE)
+
+    FIND_PATH(SPNAV_INCLUDE_PATH spnav.h
+    )

     FIND_LIBRARY(SPNAV_LIBRARY
         NAMES
         spnav libspnav
     )

-# Support the REQUIRED and QUIET arguments, and set SPNAV_FOUND if found.
-include(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Spnav DEFAULT_MSG SPNAV_LIBRARY
-                                  SPNAV_INCLUDE_DIR)
+    if(SPNAV_INCLUDE_PATH AND SPNAV_LIBRARY)
+        set(SPNAV_FOUND TRUE)
+        set(SPNAV_LIBRARIES ${SPNAV_LIBRARY})
+        set(SPNAV_INCLUDE_DIR ${SPNAV_INCLUDE_PATH})
+    endif(SPNAV_INCLUDE_PATH AND SPNAV_LIBRARY)

-if(SPNAV_FOUND)
-    set(SPNAV_LIBRARIES ${SPNAV_LIBRARY})
-endif()

-mark_as_advanced(SPANV_LIBRARY SPNAV_INCLUDE_DIR)
+
+    if(TEST_SPNAV_CMAKE)
+        if(SPNAV_INCLUDE_PATH)
+            MESSAGE("found spnav include path ${SPNAV_INCLUDE_PATH}")
+        else(SPNAV_INCLUDE_PATH)
+            MESSAGE("didn't find spnav include path")
+        endif(SPNAV_INCLUDE_PATH)
+
+        if(SPNAV_LIBRARY)
+            MESSAGE("found spnav library ${SPNAV_LIBRARY}")
+        else(SPNAV_LIBRARY)
+            MESSAGE("didn't find spnav library")
+        endif(SPNAV_LIBRARY)
+    endif(TEST_SPNAV_CMAKE)

 ENDIF(UNIX)