build: stop building clip tests and examples

--- cmake/SetupDependencies.cmake
+++ cmake/SetupDependencies.cmake
@@ -16,6 +16,10 @@
     NAME clip
     GIT_TAG "v1.2"
     GITHUB_REPOSITORY dacap/clip
+    OPTIONS
+        "CLIP_EXAMPLES FALSE"
+        "CLIP_TESTS FALSE"
+        "CLIP_X11_WITH_PNG FALSE"
 )

 CPMAddPackage(


Restrict nose and coverage finding to the Python interpreter found.

--- cmake/environmentchecks.cmake
+++ cmake/environmentchecks.cmake
@@ -34,13 +34,13 @@

 if(Python_Interpreter_FOUND)
   get_filename_component(PYTHON_DIR ${Python_EXECUTABLE} DIRECTORY)
-  find_program(COVERAGE_EXE NAMES  ${PRFERRED_COVERAGE_NAMES} coverage HINTS ${PYTHON_DIR})
+  find_program(COVERAGE_EXE NAMES  ${PRFERRED_COVERAGE_NAMES} coverage HINTS ${PYTHON_DIR} NO_DEFAULT_PATH)
   if(COVERAGE_EXE)
     message(STATUS "Found Coverage: ${COVERAGE_EXE}")
   else()
     message(STATUS "Did not find Coverage.")
   endif()
-  find_program(NOSETESTS_EXE NAMES  ${PRFERRED_NOSETESTS_NAMES} nosetests HINTS ${PYTHON_DIR})
+  find_program(NOSETESTS_EXE NAMES  ${PRFERRED_NOSETESTS_NAMES} nosetests HINTS ${PYTHON_DIR} NO_DEFAULT_PATH)
   if(NOSETESTS_EXE)
     message(STATUS "Found Nose: ${NOSETESTS_EXE}")
   else()


Fix message

Fix message

svn path=/trunk/KDE/kdepim/; revision=547530

--- cmake/modules/FindGpgme.cmake
+++ cmake/modules/FindGpgme.cmake
@@ -53,7 +53,6 @@

   if (NOT GPGME_FOUND)
       message(FATAL_ERROR "You are missing gpgme 0.4.5 or higher.
-    Download gpgme >= 0.4.5 from ftp://ftp.gnupg.org/gcrypt/alpha/gpgme
-    or use the --with-gpgme-prefix=/path/where/gpgme/is/installed option.")
+    Download gpgme >= 0.4.5 from ftp://ftp.gnupg.org/gcrypt/alpha/gpgme")
   endif (NOT GPGME_FOUND)
 endif (NOT GPGME_LIBRARIES OR NOT GPGME_INCLUDES)


cmake/modules/FindVIGRA.cmake: Move arguments to the other side of PATH symbol.

--- cmake/modules/FindVIGRA.cmake
+++ cmake/modules/FindVIGRA.cmake
@@ -19,7 +19,7 @@
 endif()

 # configVersion.hxx only present, after build of Vigra
-FIND_PATH(VIGRA_INCLUDE_DIR vigra/configVersion.hxx ${VIGRA_ROOT}/include PATHS ENV CPLUS_INCLUDE_PATH)
+FIND_PATH(VIGRA_INCLUDE_DIR vigra/configVersion.hxx PATHS ${VIGRA_ROOT}/include ENV CPLUS_INCLUDE_PATH)

 EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c
                             "import vigra.vigranumpycore; print vigra.vigranumpycore.__file__"


Tweak.

Tweak.

svn path=/trunk/; revision=7237

--- cmake/modules/CheckPerlModules.cmake
+++ cmake/modules/CheckPerlModules.cmake
@@ -17,7 +17,7 @@
 	  OUTPUT_QUIET
 	  ERROR_QUIET
 	  )
-	IF (NOT RESULT EQUAL 0)
+	IF(NOT RESULT EQUAL 0)
 	  SET(${VARIABLE} OFF)
 	  MESSAGE("Perl module ${MOD} not found")
 	ENDIF (NOT RESULT EQUAL 0)


Disable Vc if architecture is not x86_64

Vc only supports x86_64, but the previous condition allowed it to be
enabled on x86 systems, breaking the build.

--- cmake/modules/RootBuildOptions.cmake
+++ cmake/modules/RootBuildOptions.cmake
@@ -231,10 +231,10 @@
   set(builtin_veccore_defvalue ON)
 endif()

-#---VC does not support yet Arm and PPC processors----------------------------------------------
-if (CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64le")
-   message(STATUS "A system not supported by Vc, ${CMAKE_SYSTEM_PROCESSOR}, was detected. Disabling Vc by default.")
-   set(vc_defvalue OFF)
+#---Vc supports only x86_64 architecture-------------------------------------------------------
+if (NOT CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
+  message(STATUS "Vc does not support ${CMAKE_SYSTEM_PROCESSOR}. Support for Vc disabled.")
+  set(vc_defvalue OFF)
 endif()

 #---Options depending of CMake Generator-------------------------------------------------------


Change default  for davix option to OFF (CMake)

--- cmake/modules/RootBuildOptions.cmake
+++ cmake/modules/RootBuildOptions.cmake
@@ -59,7 +59,7 @@
   set(x11_defvalue ON)
   set(memstat_defvalue ON)
   set(explicitlink_defvalue ON)
-  set(davix_defvalue ON)
+  set(davix_defvalue OFF)
 endif()

 ROOT_BUILD_OPTION(afdsmgrd OFF "Dataset manager for PROOF-based analysis facilities")


Re-add some warning suppression for rp2040

--- hw/bsp/rp2040/family.cmake
+++ hw/bsp/rp2040/family.cmake
@@ -232,6 +232,25 @@

 	# This method must be called from the project scope to suppress known warnings in TinyUSB source files
 	function(suppress_tinyusb_warnings)
-		# there are currently no warnings to suppress, however this function must still exist
+		set_source_files_properties(
+					${PICO_TINYUSB_PATH}/src/device/usbd.c
+					PROPERTIES
+					COMPILE_FLAGS "-Wno-conversion")
+		set_source_files_properties(
+					${PICO_TINYUSB_PATH}/src/device/usbd_control.c
+					PROPERTIES
+					COMPILE_FLAGS "-Wno-conversion")
+		set_source_files_properties(
+					${PICO_TINYUSB_PATH}/src/class/cdc/cdc_device.c
+					PROPERTIES
+					COMPILE_FLAGS "-Wno-conversion")
+		set_source_files_properties(
+					${PICO_TINYUSB_PATH}/src/common/tusb_fifo.c
+					PROPERTIES
+					COMPILE_FLAGS "-Wno-conversion")
+		set_source_files_properties(
+					${PICO_TINYUSB_PATH}/src/tusb.c
+					PROPERTIES
+					COMPILE_FLAGS "-Wno-conversion")
 	endfunction()
 endif()


Use flatbuffers dependency from arrow

Use flatbuffers dependency from arrow

--- cmake/Modules/ConfigureArrow.cmake
+++ cmake/Modules/ConfigureArrow.cmake
@@ -36,3 +36,9 @@
 configure_file(${ARROW_GENERATED_IPC_DIR}/Message_generated.h ${CMAKE_SOURCE_DIR}/include/gdf/ipc/Message_generated.h COPYONLY)
 configure_file(${ARROW_GENERATED_IPC_DIR}/Schema_generated.h ${CMAKE_SOURCE_DIR}/include/gdf/ipc/Schema_generated.h COPYONLY)
 configure_file(${ARROW_GENERATED_IPC_DIR}/Tensor_generated.h ${CMAKE_SOURCE_DIR}/include/gdf/ipc/Tensor_generated.h COPYONLY)
+
+# Add transitive dependency: Flatbuffers
+set(FLATBUFFERS_ROOT ${ARROW_DOWNLOAD_BINARY_DIR}/arrow-prefix/src/arrow-build/flatbuffers_ep-prefix/src/flatbuffers_ep-install/)
+
+include_directories(${FLATBUFFERS_ROOT}/include/)
+link_directories(${FLATBUFFERS_ROOT}/lib/)


Add a warning regarding the need to define CMAKE_BUILD_TYPE for running tests

When running tests from within Visual Studio IDE the may fail if the current
build configuration doesn't match CMAKE_BUILD_TYPE or if CMAKE_BUILD_TYPE is
totally empty (which is the case for non-make-based generators).

--- cmake/Modules/SampPluginTest.cmake
+++ cmake/Modules/SampPluginTest.cmake
@@ -39,8 +39,15 @@
 	endif()

 	get_target_property(PLUGIN_PATH ${ARG_TARGET} LOCATION)
-	if(MSVC_IDE AND DEFINED CMAKE_BUILD_TYPE)
-		string(REPLACE "$(Configuration)" ${CMAKE_BUILD_TYPE} PLUGIN_PATH ${PLUGIN_PATH})
+
+	list(FIND CMAKE_CONFIGURATION_TYPES "${CMAKE_BUILD_TYPE}" index)
+	if(MSVC_IDE AND CMAKE_BUILD_TYPE AND NOT index EQUAL -1)
+		string(REPLACE "$(Configuration)" ${CMAKE_BUILD_TYPE}
+		       PLUGIN_PATH ${PLUGIN_PATH})
+	else()
+		message(AUTHOR_WARNING "CMAKE_BUILD_TYPE must be set to one of the "
+		                       "existing build configurations in order for "
+		                       "the tests to work")
 	endif()

 	list(APPEND arguments


Sometimes we get '11' instead of 'Segmentation fault'

--- cmake/modules/RootTestDriver.cmake
+++ cmake/modules/RootTestDriver.cmake
@@ -190,7 +190,7 @@
   else()
     execute_process(COMMAND ${_cmd} ${_out} ${_err} ${_cwd} RESULT_VARIABLE _rc)

-    if(_rc STREQUAL "Segmentation fault")
+    if(_rc STREQUAL "Segmentation fault" OR _rc EQUAL 11)
        message(STATUS "Got ${_rc}, retrying again once more...")
        execute_process(COMMAND ${_cmd} ${_out} ${_err} ${_cwd} RESULT_VARIABLE _rc)
     endif()


fixed build mode cmake log message

fixed build mode cmake log message


Update hunter.cmake

Update hunter.cmake

--- cmake/projects/Buffer/hunter.cmake
+++ cmake/projects/Buffer/hunter.cmake
@@ -7,7 +7,7 @@
     PACKAGE_NAME
     Buffer
     VERSION
-    "0.1.2"
+    "0.1.3"
     URL
     "https://github.com/designerror/buffer/archive/v0.1.3.tar.gz"
     SHA1


OpenCV: Fix GCC build

OpenCV: Fix GCC build

--- cmake/projects/OpenCV/hunter.cmake
+++ cmake/projects/OpenCV/hunter.cmake
@@ -398,6 +398,10 @@
         #  it might pick up the host version
         WITH_CUDA=OFF
         WITH_CUFFT=OFF
+        # Fix for https://travis-ci.org/xsacha/hunter/jobs/347083573
+        BUILD_opencv_dnn=OFF
+        # Fix for https://travis-ci.org/ingenue/hunter/builds/452039597
+        WITH_OPENEXR=OFF
 )

 # Pick a download scheme


qibuild tests: fix running tests on windows

Change-Id: I437635119a1658491b61e44f3cd15da81f4c8b23
Reviewed-on: http://gerrit.aldebaran.lan/28880
Reviewed-by: dmerejkowsky <1e4b13000fa8777df4cefd2fd8215187e3deb062@aldebaran-robotics.com>
Tested-by: dmerejkowsky <1e4b13000fa8777df4cefd2fd8215187e3deb062@aldebaran-robotics.com>

--- cmake/qibuild/internal/tests.cmake
+++ cmake/qibuild/internal/tests.cmake
@@ -57,6 +57,9 @@

     if(MSVC AND "${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
       set(_bin_path ${_bin_path}_d)
+    endif()
+    if(WIN32)
+      set(_bin_path "${_bin_path}.exe")
     endif()
   else()
     set(_executable "${target_name}")


fixed option

fixed option

[git-p4: depot-paths = "//sw/gpgpu/nvbio/main/": change = 18790543]

--- cmake-local/gcc.cmake
+++ cmake-local/gcc.cmake
@@ -2,7 +2,7 @@
     # common GCC compiler flags
     # we add -Wno-unknown-pragmas because of nvcc's #pragma unroll
     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-unknown-pragmas -Wstrict-aliasing=0")
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-unknown-pragmas -Wstrict-aliasing=0 -Wunused-local-typedefs=0")
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-unknown-pragmas -Wstrict-aliasing=0 -Wno-unused-local-typedefs")

     set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
     if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "Intel")


Update DeployQt4.

Update DeployQt4.

--- cmake/DeployQt4.cmake
+++ cmake/DeployQt4.cmake
@@ -56,7 +56,7 @@
 # (or <plugins_dir>) relative to <executable> and store the result in
 # <installed_plugin_path_var>. See documentation of INSTALL_QT4_PLUGIN_PATH.
 #
-#  INSTALL_QT4_EXECUTABLE(<executable> <qtplugins> [<libs> <dirs> <plugins_dir> <request_qt_conf>])
+#  INSTALL_QT4_EXECUTABLE(<executable> [<qtplugins> <libs> <dirs> <plugins_dir> <request_qt_conf>])
 # Installs Qt plugins, writes a Qt configuration file (if needed) and fixes up
 # a Qt4 executable using BundleUtilities so it is standalone and can be
 # drag-and-drop copied to another machine as long as all of the system
@@ -106,7 +106,8 @@
         set(${paths_var} ${paths_resolved} PARENT_SCOPE)
 endfunction()

-function(fixup_qt4_executable executable qtplugins)
+function(fixup_qt4_executable executable)
+        set(qtplugins ${ARGV1})
         set(libs ${ARGV2})
         set(dirs ${ARGV3})
         set(plugins_dir ${ARGV4})
@@ -150,7 +151,6 @@
         endforeach()

         resolve_qt4_paths(libs "${executable_path}")
-        resolve_qt4_paths(dirs "${executable_path}")

         if(write_qt_conf)
                 set(qt_conf_contents "[Paths]\nPlugins = ${plugins_dir}")
@@ -225,9 +225,11 @@
                 else()
                         string(TOUPPER "QT_${plugin}_PLUGIN" plugin_var)
                 endif()
-                set(plugin_release "${${plugin_var}_RELEASE}")
-                set(plugin_debug "${${plugin_var}_DEBUG}")
-                if(NOT EXISTS "${plugin_release}" AND NOT EXISTS "${plugin_debug}")
+                set(plugin_release_var "${plugin_var}_RELEASE")
+                set(plugin_debug_var "${plugin_var}_DEBUG")
+                set(plugin_release "${${plugin_release_var}}")
+                set(plugin_debug "${${plugin_debug_var}}")
+                if(DEFINED "${plugin_release_var}" AND DEFINED "${plugin_debug_var}" AND NOT EXISTS "${plugin_release}" AND NOT EXISTS "${plugin_debug}")
                         message(WARNING "Qt plugin \"${plugin}\" not recognized or found.")
                 endif()
                 install_qt4_plugin_path("${plugin_release}" "${executable}" "${copy}" "${installed_plugin_path_var}" "${plugins_dir}" "${component}" "Release|RelWithDebInfo|MinSizeRel")
@@ -264,7 +266,6 @@
         endforeach()

         resolve_qt4_paths(libs)
-        resolve_qt4_paths(dirs)

         install(CODE
                 " INCLUDE( \"${DeployQt4_cmake_dir}/DeployQt4.cmake\" )


More flexible CMSIS targets.

More flexible CMSIS targets.

--- cmake/FindCMSIS.cmake
+++ cmake/FindCMSIS.cmake
@@ -75,6 +75,20 @@
         NO_DEFAULT_PATH
     )
     list(APPEND CMSIS_SOURCES "${CMSIS_${FAMILY}_SOURCE}")
+
+	if ((NOT CMSIS_${FAMILY}_COMMON_INCLUDE) OR
+	    (NOT CMSIS_${FAMILY}_INCLUDE) OR
+	    (NOT CMSIS_${FAMILY}_SOURCE))
+		continue()
+	endif()
+
+    if(NOT (TARGET CMSIS::STM32::${FAMILY}))
+		add_library(CMSIS::STM32::${FAMILY} INTERFACE IMPORTED)
+		target_link_libraries(CMSIS::STM32::${FAMILY} INTERFACE STM32::${FAMILY})
+		target_include_directories(CMSIS::STM32::${FAMILY} INTERFACE "${CMSIS_${FAMILY}_COMMON_INCLUDE}")
+		target_include_directories(CMSIS::STM32::${FAMILY} INTERFACE "${CMSIS_${FAMILY}_INCLUDE}")
+        target_sources(CMSIS::STM32::${FAMILY} INTERFACE "${CMSIS_${FAMILY}_SOURCE}")
+	endif()

     set(DEVICES_FOUND TRUE)
     foreach(DEVICE ${DEVICES})
@@ -92,13 +106,15 @@
             set(DEVICES_FOUND FALSE)
             break()
         endif()
+
+		if(NOT (TARGET CMSIS::STM32::${FAMILY}::${TYPE}))
+			add_library(CMSIS::STM32::${FAMILY}::${TYPE} INTERFACE IMPORTED)
+			target_link_libraries(CMSIS::STM32::${FAMILY}::${TYPE} INTERFACE CMSIS::STM32::${FAMILY} STM32::${FAMILY}::${TYPE})
+			target_sources(CMSIS::STM32::${FAMILY}::${TYPE} INTERFACE "${CMSIS_${FAMILY}_${TYPE}_STARTUP}")
+		endif()

         add_library(CMSIS::STM32::${DEVICE} INTERFACE IMPORTED)
-        target_link_libraries(CMSIS::STM32::${DEVICE} INTERFACE STM32::${FAMILY}::${TYPE})
-        target_include_directories(CMSIS::STM32::${DEVICE} INTERFACE "${CMSIS_${FAMILY}_COMMON_INCLUDE}")
-        target_include_directories(CMSIS::STM32::${DEVICE} INTERFACE "${CMSIS_${FAMILY}_INCLUDE}")
-        target_sources(CMSIS::STM32::${DEVICE} INTERFACE "${CMSIS_${FAMILY}_SOURCE}")
-        target_sources(CMSIS::STM32::${DEVICE} INTERFACE "${CMSIS_${FAMILY}_${TYPE}_STARTUP}")
+        target_link_libraries(CMSIS::STM32::${DEVICE} INTERFACE CMSIS::STM32::${FAMILY}::${TYPE})
         cmsis_generate_default_linker_script(${FAMILY} ${DEVICE})
     endforeach()


FindCXX14: better variable name + cleanup

--- cmake/FindCXX14.cmake
+++ cmake/FindCXX14.cmake
@@ -47,18 +47,19 @@
 }
 ")

+set(SAVE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
 foreach(FLAG ${CXX14_FLAG_CANDIDATES})
-    set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
     set(CMAKE_REQUIRED_FLAGS "${FLAG}")
     unset(CXX14_FLAG_DETECTED CACHE)
     message(STATUS "Trying C++14 flag '${FLAG}'")
     check_cxx_source_compiles("${CXX14_TEST_SOURCE}" CXX14_FLAG_DETECTED)
-    set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
     if(CXX14_FLAG_DETECTED)
         set(CXX14_FLAGS_INTERNAL "${FLAG}")
         break()
     endif(CXX14_FLAG_DETECTED)
 endforeach(FLAG ${CXX14_FLAG_CANDIDATES})
+set(CMAKE_REQUIRED_FLAGS "${SAVE_CMAKE_REQUIRED_FLAGS}")
+unset(SAVE_CMAKE_REQUIRED_FLAGS)

 set(CXX14_FLAGS "${CXX14_FLAGS_INTERNAL}")


Fix MSVC compiler version to one where all tests pass.

--- cmake/configure.cmake
+++ cmake/configure.cmake
@@ -2,7 +2,7 @@
 file(MAKE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/msvc)
 file(MAKE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/msvc/build)
 message("Generating project files...")
-execute_process(COMMAND ${CMAKE_COMMAND} ${CMAKE_CURRENT_SOURCE_DIR} -T v142 -A Win32 -DCMAKE_SYSTEM_VERSION=10.0.19041.0
+execute_process(COMMAND ${CMAKE_COMMAND} ${CMAKE_CURRENT_SOURCE_DIR} -T v142,version=14.29.16.11 -A Win32 -DCMAKE_SYSTEM_VERSION=10.0.19041.0
   WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/msvc/build
   RESULT_VARIABLE success
 )


disabled test box

disabled test box

git-svn-id: e7ea667a1d39a4453c4efcc4ba7bca3d620c3f19@2370 a9d63959-f2ad-4865-b262-bf0e56cfafb6

--- cmake/dep_graph.cmake
+++ cmake/dep_graph.cmake
@@ -22,4 +22,9 @@
         endforeach(_dep)
       endif()
     endforeach(_ss)
+
+    #file(APPEND ${_dot_file}
+    #    "  \"test\" [style=\"filled\" fillcolor=\"#A3A27C\" shape=\"box\"];\n ")
+    file(APPEND ${_dot_file} "}\n")
 endfunction(MAKE_DEP_GRAPH)
+


[cmakeswitch to master branch for nd as external project

--- cmake/nd-config.cmake
+++ cmake/nd-config.cmake
@@ -12,7 +12,7 @@
   set(ND_GIT_REPOSITORY ssh://git@bitbucket.org/nclack/nd.git CACHE STRING "Location of the git repository for libnd.")
   ExternalProject_Add(libnd
     GIT_REPOSITORY ${ND_GIT_REPOSITORY}
-    GIT_TAG spin-off-plugins
+    # GIT_TAG spin-off-plugins
     # UPDATE_COMMAND ""
     # UPDATE_COMMAND ${GIT_EXECUTABLE} pull origin master
     LIST_SEPARATOR ^^


ARROW-5152: [Python] Fix CMake warnings

ARROW-5152: [Python] Fix CMake warnings

Author: Antoine Pitrou <antoine@python.org>

Closes #4134 from pitrou/ARROW-5152-py-fix-cmake-warnings and squashes the following commits:

a12183a6e <Antoine Pitrou> ARROW-5152:  Fix CMake warnings

--- cpp/cmake_modules/BuildUtils.cmake
+++ cpp/cmake_modules/BuildUtils.cmake
@@ -24,8 +24,8 @@
     "lib32"
     "lib"
     "bin"
-    "Library",
-    "Library/lib",
+    "Library"
+    "Library/lib"
     "Library/bin")
 set(INCLUDE_PATH_SUFFIXES "include" "Library" "Library/include")


Include community board in select (#567)

The compile breaks because of undeclared vars in I2C version for F4-Series boards. For this series version 1 has to be forced to use at two places in the cmake module.

By adding the community board string to the distinct list of F4 boards that select the correct version for I2C the compiler was happy and builds successfully.

Signed-off-by: piwi1263 <994bae4cbd153cbc1b284e543355271e6af76bb5@gmail.com>

--- CMake/Modules/CHIBIOS_STM32F4xx_sources.cmake
+++ CMake/Modules/CHIBIOS_STM32F4xx_sources.cmake
@@ -65,7 +65,11 @@
             ${PROJECT_BINARY_DIR}/ChibiOS_Source/os/hal/ports/STM32/LLD/DACv1
             ${PROJECT_BINARY_DIR}/ChibiOS_Source/os/hal/ports/STM32/LLD/DMAv2
             ${PROJECT_BINARY_DIR}/ChibiOS_Source/os/hal/ports/STM32/LLD/GPIOv2
-            if(${CHIBIOS_BOARD} STREQUAL "ST_STM32F429I_DISCOVERY" OR ${CHIBIOS_BOARD} STREQUAL "ST_STM32F4_DISCOVERY" OR ${CHIBIOS_BOARD} STREQUAL "MBN_QUAIL" OR ${CHIBIOS_BOARD} STREQUAL "NETDUINO3_WIFI")
+            if(${CHIBIOS_BOARD} STREQUAL "ST_STM32F429I_DISCOVERY" OR
+               ${CHIBIOS_BOARD} STREQUAL "ST_STM32F4_DISCOVERY" OR
+               ${CHIBIOS_BOARD} STREQUAL "MBN_QUAIL" OR
+               ${CHIBIOS_BOARD} STREQUAL "NETDUINO3_WIFI" OR
+               ${CHIBIOS_BOARD} STREQUAL "I2M_ELECTRON_NF")
                 ${PROJECT_BINARY_DIR}/ChibiOS_Source/os/hal/ports/STM32/LLD/I2Cv1
             else()
                 ${PROJECT_BINARY_DIR}/ChibiOS_Source/os/hal/ports/STM32/LLD/I2Cv2
@@ -96,7 +100,11 @@
 list(APPEND CHIBIOS_INCLUDE_DIRS ${PROJECT_BINARY_DIR}/ChibiOS_Source/os/hal/ports/STM32/LLD/DACv1)
 list(APPEND CHIBIOS_INCLUDE_DIRS ${PROJECT_BINARY_DIR}/ChibiOS_Source/os/hal/ports/STM32/LLD/DMAv2)
 list(APPEND CHIBIOS_INCLUDE_DIRS ${PROJECT_BINARY_DIR}/ChibiOS_Source/os/hal/ports/STM32/LLD/GPIOv2)
-if(${CHIBIOS_BOARD} STREQUAL "ST_STM32F429I_DISCOVERY" OR ${CHIBIOS_BOARD} STREQUAL "ST_STM32F4_DISCOVERY" OR ${CHIBIOS_BOARD} STREQUAL "MBN_QUAIL" OR ${CHIBIOS_BOARD} STREQUAL "NETDUINO3_WIFI")
+if(${CHIBIOS_BOARD} STREQUAL "ST_STM32F429I_DISCOVERY" OR
+   ${CHIBIOS_BOARD} STREQUAL "ST_STM32F4_DISCOVERY" OR
+   ${CHIBIOS_BOARD} STREQUAL "MBN_QUAIL" OR
+   ${CHIBIOS_BOARD} STREQUAL "NETDUINO3_WIFI" OR
+   ${CHIBIOS_BOARD} STREQUAL "I2M_ELECTRON_NF")
     list(APPEND CHIBIOS_INCLUDE_DIRS ${PROJECT_BINARY_DIR}/ChibiOS_Source/os/hal/ports/STM32/LLD/I2Cv1)
 else()
     list(APPEND CHIBIOS_INCLUDE_DIRS ${PROJECT_BINARY_DIR}/ChibiOS_Source/os/hal/ports/STM32/LLD/I2Cv2)


Also use glew32: different library name on Windows

Change-Id: Iec1b62920843eabcf3398792217bab600e801e97

--- cmake/FindGLEW.cmake
+++ cmake/FindGLEW.cmake
@@ -7,7 +7,7 @@
 #  GLEW_LIBRARY      - The GLEW library
 #
 find_path(GLEW_INCLUDE_DIR GL/glew.h)
-find_library(GLEW_LIBRARY GLEW)
+find_library(GLEW_LIBRARY NAMES GLEW glew32)

 set(GLEW_INCLUDE_DIRS "${GLEW_INCLUDE_DIR}")


Fix CMake GLEW finding routine

Fix CMake GLEW finding routine

--- cmake/FindGLEW.cmake
+++ cmake/FindGLEW.cmake
@@ -40,7 +40,7 @@
 MARK_AS_ADVANCED(GLEW_INCLUDE_DIR)

 # Look for the library.
-FIND_LIBRARY(GLEW_LIBRARY NAMES GLEW glew32)
+FIND_LIBRARY(GLEW_LIBRARY NAMES GLEW glew32 glew glew32s PATH_SUFFIXES lib64)
 MARK_AS_ADVANCED(GLEW_LIBRARY)

 # handle the QUIETLY and REQUIRED arguments and set GLEW_FOUND to TRUE if


Allow cmake to detect glew debug dlls.

Allow cmake to detect glew debug dlls.

--- cmake/FindGLEW.cmake
+++ cmake/FindGLEW.cmake
@@ -13,7 +13,7 @@
 		${PROJECT_SOURCE_DIR}/src/nvgl/glew/include
 		DOC "The directory where GL/glew.h resides")
 	FIND_LIBRARY( GLEW_LIBRARY
-		NAMES glew GLEW glew32 glew32s
+		NAMES glew GLEW glew32 glew32s glewd glew32d
 		PATHS
 		$ENV{PROGRAMFILES}/GLEW/lib
 		${PROJECT_SOURCE_DIR}/src/nvgl/glew/bin


Add default glog install location on Windows to search paths.

Change-Id: I083d368be48986e6780c11460f5a07b2f3b6c900

--- cmake/FindGlog.cmake
+++ cmake/FindGlog.cmake
@@ -108,25 +108,37 @@

 # Search user-installed locations first, so that we prefer user installs
 # to system installs where both exist.
-#
-# TODO: Add standard Windows search locations for glog.
 LIST(APPEND GLOG_CHECK_INCLUDE_DIRS
   /usr/local/include
   /usr/local/homebrew/include # Mac OS X
   /opt/local/var/macports/software # Mac OS X.
   /opt/local/include
   /usr/include)
+# Windows (for C:/Program Files prefix).
+LIST(APPEND GLOG_CHECK_PATH_SUFFIXES
+  glog/include
+  glog/Include
+  Glog/include
+  Glog/Include)
+
 LIST(APPEND GLOG_CHECK_LIBRARY_DIRS
   /usr/local/lib
   /usr/local/homebrew/lib # Mac OS X.
   /opt/local/lib
   /usr/lib)
+# Windows (for C:/Program Files prefix).
+LIST(APPEND GLOG_CHECK_LIBRARY_SUFFIXES
+  glog/lib
+  glog/Lib
+  Glog/lib
+  Glog/Lib)

 # Search supplied hint directories first if supplied.
 FIND_PATH(GLOG_INCLUDE_DIR
   NAMES glog/logging.h
   PATHS ${GLOG_INCLUDE_DIR_HINTS}
-  ${GLOG_CHECK_INCLUDE_DIRS})
+  ${GLOG_CHECK_INCLUDE_DIRS}
+  PATH_SUFFIXES ${GLOG_CHECK_PATH_SUFFIXES})
 IF (NOT GLOG_INCLUDE_DIR OR
     NOT EXISTS ${GLOG_INCLUDE_DIR})
   GLOG_REPORT_NOT_FOUND(
@@ -137,7 +149,8 @@

 FIND_LIBRARY(GLOG_LIBRARY NAMES glog
   PATHS ${GLOG_LIBRARY_DIR_HINTS}
-  ${GLOG_CHECK_LIBRARY_DIRS})
+  ${GLOG_CHECK_LIBRARY_DIRS}
+  PATH_SUFFIXES ${GLOG_CHECK_LIBRARY_SUFFIXES})
 IF (NOT GLOG_LIBRARY OR
     NOT EXISTS ${GLOG_LIBRARY})
   GLOG_REPORT_NOT_FOUND(


cmake: Enable server/client rules in case of 802.15.4 UPIPE driver

Networking apps may require these rules (as echo apps) even on
non-Ethernet based configuration.

Signed-off-by: Tomasz Bursztyka <ba81a3a719836727e6857ae83462b9f52ec41006@linux.intel.com>

--- cmake/emu/qemu.cmake
+++ cmake/emu/qemu.cmake
@@ -73,7 +73,7 @@
 # tests defined by CONFIG_NET_TEST.
 if(CONFIG_NETWORKING)
   if(CONFIG_NET_QEMU_SLIP)
-    if(CONFIG_NET_SLIP_TAP)
+    if((CONFIG_NET_SLIP_TAP) OR (CONFIG_IEEE802154_UPIPE))
       set(QEMU_NET_STACK 1)
     endif()
   endif()


linking libcrypto when ABI is enabled

linking libcrypto when ABI is enabled

--- cmake/examples.cmake
+++ cmake/examples.cmake
@@ -25,6 +25,9 @@
         ${Boost_THREAD_LIBRARY}
         ${CMAKE_THREAD_LIBS_INIT}
     )
+    if(ABI_ENALED)
+        target_link_libraries(${EXAMPLE_NAME} ${CRYPTOPP_LIBRARY})
+    endif()
     if(WIN32)
         target_link_libraries(${EXAMPLE_NAME} ws2_32)
     endif()


SQME findATLAST

SQME findATLAST

--- cmake/FindATLAS.cmake
+++ cmake/FindATLAS.cmake
@@ -146,10 +146,9 @@
 if (ATLAS_FOUND)
   set(ATLAS_INCLUDE_DIRS ${ATLAS_CBLAS_INCLUDE_DIR} ${ATLAS_CBLAS_INCLUDE_DIR})
   list(REMOVE_DUPLICATES ATLAS_INCLUDE_DIRS)
-  if(${CMAKE_C_COMPILER_ID} MATCHES "Clang" OR
-      ${CMAKE_C_COMPILER_ID} MATCHES "AppleClang" OR
-      ${CMAKE_C_COMPILER_ID} MATCHES "GNU" OR
-      ${CMAKE_C_COMPILER_ID} MATCHES "Intel"
+  if("${CMAKE_C_COMPILER_ID}" MATCHES ".*Clang.*" OR
+     "${CMAKE_C_COMPILER_ID}" MATCHES ".*GNU.*" OR
+     "${CMAKE_C_COMPILER_ID}" MATCHES ".*Intel.*"
       ) #NOT MSVC
     set(MATH_LIB m)
   endif()


Fix FindNumPy.cmake

Fix FindNumPy.cmake

--- cmake/FindNumPy.cmake
+++ cmake/FindNumPy.cmake
@@ -9,9 +9,9 @@
   set(NUMPY_FOUND FALSE)
   message(STATUS "NumPy import failure:\n${NUMPY_FIND_ERROR}")
 else()
-  find_path(NUMPY_INCLUDE_DIR numpy/arrayobject.h
-    HINTS "${__numpy_path}" "${NUMPY_FIND_OUTPUT}" NO_DEFAULT_PATH)
-  if(NUMPY_INCLUDE_DIR)
+  find_path(NUMPY_INCLUDE_PATH numpy/arrayobject.h
+    HINTS "${NUMPY_FIND_OUTPUT}" NO_DEFAULT_PATH)
+  if(NUMPY_INCLUDE_PATH)
     set(NUMPY_FOUND TRUE CACHE BOOL INTERNAL "NumPy found")
     INCLUDE(FindPackageHandleStandardArgs)
     FIND_PACKAGE_HANDLE_STANDARD_ARGS(NUMPY DEFAULT_MSG NUMPY_INCLUDE_PATH)


SWDEV-351337 - Add asic ID to staging for PAL

Change-Id: I64a24cc0118457d492d76063c808465d212b47bd

--- cmake/ROCclrPAL.cmake
+++ cmake/ROCclrPAL.cmake
@@ -43,6 +43,10 @@
 set(PAL_BUILD_NULL_DEVICE   OFF)
 set(PAL_BUILD_GFX6          ON)
 set(PAL_BUILD_GFX9          ON)
+set(PAL_BUILD_GFX11         ON)
+set(PAL_BUILD_NAVI31        ON)
+set(PAL_BUILD_NAVI32        ON)
+set(PAL_BUILD_NAVI33        ON)

 find_package(AMD_PAL)
 find_package(AMD_HSA_LOADER)


Fix cmake pathes

Fix cmake pathes

--- cmake/VIZConfig.cmake
+++ cmake/VIZConfig.cmake
@@ -1,7 +1,7 @@
 include("${CMAKE_CURRENT_LIST_DIR}/VIZTargets.cmake")

-find_path(VIZ_INCLUDE_DIR "viz" HINTS "${CMAKE_SOURCE_DIR}/include/" )
-find_library(VIZ_LIBRARY NAMES VIZ HINTS "${CMAKE_SOURCE_DIR}/lib/")
+find_path(VIZ_INCLUDE_DIR "viz" HINTS "${CMAKE_CURRENT_LIST_DIR}/../include/" )
+find_library(VIZ_LIBRARY NAMES VIZ HINTS "${CMAKE_CURRENT_LIST_DIR}/../lib/")

 set(VIZ_LIBRARIES ${VIZ_LIBRARY} )
 set(VIZ_INCLUDE_DIRS ${VIZ_INCLUDE_DIR} )


[scudo] Enable Scudo on PPC64

[scudo] Enable Scudo on PPC64

Summary:
In conjunction with the clang side change D48833, this will enable Scudo on
PPC64. I tested `check-scudo` on a powerpc64le box and everything passes.

Reviewers: eugenis, alekseyshl

Reviewed By: alekseyshl

Subscribers: mgorny, delcypher, #sanitizers, llvm-commits

Differential Revision: https://reviews.llvm.org/D48834

git-svn-id: c199f293c43da69278bea8e88f92242bf3aa95f7@336213 91177308-0d34-0410-b5e6-96231b3b80d8

--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -216,7 +216,7 @@
 set(ALL_SAFESTACK_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM64} ${MIPS32} ${MIPS64})
 set(ALL_CFI_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${MIPS64})
 set(ALL_ESAN_SUPPORTED_ARCH ${X86_64} ${MIPS64})
-set(ALL_SCUDO_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${MIPS32} ${MIPS64})
+set(ALL_SCUDO_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${MIPS32} ${MIPS64} ${PPC64})
 if(APPLE)
 set(ALL_XRAY_SUPPORTED_ARCH ${X86_64})
 else()


[CMake] Use __libc_start_main rather than fopen when checking for C library

The check_library_exists CMake uses a custom symbol definition. This
is a problem when checking for C library symbols because Clang
recognizes many of them as builtins, and returns the
-Wbuiltin-requires-header (or -Wincompatible-library-redeclaration)
error. When building with -Werror which is the default, this causes
the check_library_exists check fail making the build think that C
library isn't available.

To avoid this issue, we should use a symbol that isn't recognized by
Clang and wouldn't cause the same issue. __libc_start_main seems like
reasonable choice that fits the bill.

Differential Revision: https://reviews.llvm.org/D57142

git-svn-id: 6a9f6578bdee8d959f0ed58970538b4ab6004734@352341 91177308-0d34-0410-b5e6-96231b3b80d8

--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -2,7 +2,7 @@
 include(CheckCCompilerFlag)
 include(CheckCXXCompilerFlag)

-check_library_exists(c fopen "" LIBCXXABI_HAS_C_LIB)
+check_library_exists(c __libc_start_main "" LIBCXXABI_HAS_C_LIB)
 if (NOT LIBCXXABI_USE_COMPILER_RT)
   check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXXABI_HAS_GCC_S_LIB)
 endif ()


more adequate rpm settings

more adequate rpm settings

new MariaDB-shared no longer provides or replaces mysql-libs or mariadb-libs

--- cmake/cpack_rpm.cmake
+++ cmake/cpack_rpm.cmake
@@ -188,11 +188,8 @@
 # Argh! Different distributions call packages differently, to be a drop-in
 # replacement we have to fake distribution-speficic dependencies

-IF(RPM MATCHES "(rhel|centos)5")
-  ALTERNATIVE_NAME("shared" "mysql")
-ELSEIF(RPM MATCHES "(rhel|centos)6")
+IF(RPM MATCHES "(rhel|centos)6")
   ALTERNATIVE_NAME("client" "mysql")
-  ALTERNATIVE_NAME("shared" "mysql-libs")
 ELSEIF(RPM MATCHES "fedora" OR RPM MATCHES "(rhel|centos)7")
   SET(epoch 1) # this is fedora
   ALTERNATIVE_NAME("client" "mariadb")
@@ -200,8 +197,6 @@
   ALTERNATIVE_NAME("devel"  "mariadb-devel")
   ALTERNATIVE_NAME("server" "mariadb-server")
   ALTERNATIVE_NAME("server" "mysql-compat-server")
-  ALTERNATIVE_NAME("shared" "mariadb-libs")
-  ALTERNATIVE_NAME("shared" "mysql-libs")
   ALTERNATIVE_NAME("test"   "mariadb-test")
 ENDIF()


RPM packages should not obsolete themselves. Otherwise yum on fedora will not install them (rpm will, yum on centos and rhel will).

--- cmake/cpack_rpm.cmake
+++ cmake/cpack_rpm.cmake
@@ -66,7 +66,7 @@

 SET(CPACK_RPM_server_USER_FILELIST "%ignore /etc" "%ignore /etc/init.d")

-SET(CPACK_RPM_client_PACKAGE_OBSOLETES "mysql-client MariaDB-client MySQL-client MySQL-OurDelta-client")
+SET(CPACK_RPM_client_PACKAGE_OBSOLETES "mysql-client MySQL-client MySQL-OurDelta-client")
 SET(CPACK_RPM_client_PACKAGE_PROVIDES "MariaDB-client MySQL-client mysql-client")

 # this is a workaround for CPackRPM.cmake (as of 2.8.8) bug.
@@ -75,21 +75,21 @@
 SET(CPACK_RPM_common_PACKAGE_OBSOLETES "MySQL-common")
 SET(CPACK_RPM_common_PACKAGE_PROVIDES "MariaDB-common")

-SET(CPACK_RPM_devel_PACKAGE_OBSOLETES "mysql-devel MariaDB-devel MySQL-devel MySQL-OurDelta-devel")
+SET(CPACK_RPM_devel_PACKAGE_OBSOLETES "mysql-devel MySQL-devel MySQL-OurDelta-devel")
 SET(CPACK_RPM_devel_PACKAGE_PROVIDES "MariaDB-devel MySQL-devel mysql-devel")

-SET(CPACK_RPM_server_PACKAGE_OBSOLETES "MariaDB mysql mysql-server MariaDB-server MySQL-server MySQL-OurDelta-server")
+SET(CPACK_RPM_server_PACKAGE_OBSOLETES "MariaDB mysql mysql-server MySQL-server MySQL-OurDelta-server")
 SET(CPACK_RPM_server_PACKAGE_PROVIDES "MariaDB MariaDB-server MySQL-server config(MariaDB-server) msqlormysql mysql mysql-server")
 SET(CPACK_RPM_server_PRE_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-prein.sh)
 SET(CPACK_RPM_server_PRE_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-preun.sh)
 SET(CPACK_RPM_server_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-postin.sh)

-SET(CPACK_RPM_shared_PACKAGE_OBSOLETES "mysql-shared MySQL-shared-standard MySQL-shared-pro MySQL-shared-pro-cert MySQL-shared-pro-gpl MySQL-shared-pro-gpl-cert MariaDB-shared MySQL-shared MySQL-OurDelta-shared")
+SET(CPACK_RPM_shared_PACKAGE_OBSOLETES "mysql-shared MySQL-shared-standard MySQL-shared-pro MySQL-shared-pro-cert MySQL-shared-pro-gpl MySQL-shared-pro-gpl-cert MySQL-shared MySQL-OurDelta-shared")
 SET(CPACK_RPM_shared_PACKAGE_PROVIDES "MariaDB-shared MySQL-shared mysql-shared libmysqlclient.so.${SHARED_LIB_MAJOR_VERSION} libmysqlclient.so.${SHARED_LIB_MAJOR_VERSION}(libmysqlclient_${SHARED_LIB_MAJOR_VERSION}) libmysqlclient_r.so.${SHARED_LIB_MAJOR_VERSION} libmysqlclient_r.so.${SHARED_LIB_MAJOR_VERSION}(libmysqlclient_${SHARED_LIB_MAJOR_VERSION})")
 SET(CPACK_RPM_shared_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/shared-post.sh)
 SET(CPACK_RPM_shared_POST_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/shared-post.sh)

-SET(CPACK_RPM_test_PACKAGE_OBSOLETES "mysql-test MariaDB-test MySQL-test MySQL-OurDelta-test")
+SET(CPACK_RPM_test_PACKAGE_OBSOLETES "mysql-test MySQL-test MySQL-OurDelta-test")
 SET(CPACK_RPM_test_PACKAGE_PROVIDES "MariaDB-test MySQL-test mysql-test")

 # workaround for lots of perl dependencies added by rpmbuild


Move man2html.sh in build/config

Move man2html.sh in build/config

Summary: Let's avoid puluting the root.

Test Plan:
  cmake -GNinja ..

Check tha the file is now in the config folder.

Reviewers: #bitcoin_abc, jasonbcox

Reviewed By: #bitcoin_abc, jasonbcox

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

--- cmake/modules/InstallationHelper.cmake
+++ cmake/modules/InstallationHelper.cmake
@@ -180,17 +180,17 @@
 		set(OUTPUT_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_MANDIR}/html")
 		configure_file(
 			"${CMAKE_SOURCE_DIR}/cmake/templates/man2html.sh.in"
-			"${CMAKE_BINARY_DIR}/man2html.sh"
+			"${CMAKE_BINARY_DIR}/config/man2html.sh"
 			@ONLY
 		)

 		add_custom_target(install-manpages-html
 			COMMENT "Generating man pages for web rendering"
 			COMMAND
-				"${CMAKE_BINARY_DIR}/man2html.sh"
+				"${CMAKE_BINARY_DIR}/config/man2html.sh"
 			DEPENDS
 				install-manpages
-				"${CMAKE_BINARY_DIR}/man2html.sh"
+				"${CMAKE_BINARY_DIR}/config/man2html.sh"
 		)
 	endif()
 endfunction()


MAINT: clean up script.

MAINT: clean up script.

--- cmake/sara_installation_settings.cmake
+++ cmake/sara_installation_settings.cmake
@@ -48,12 +48,6 @@

   set(CPACK_COMPONENT_Sources_REQUIRED 1)
 endif ()
-
-# # DO-Sara component libraries
-# foreach (component ${DO_Sara_COMPONENTS})
-#   sara_message("Installing DO_Sara_${component}")
-#   include(${DO_Sara_${component}_USE_FILE})
-# endforeach (component)

 # List all available components for installation.


Do not treat warnings as errors

Do not treat warnings as errors

--- Compiler.cmake
+++ Compiler.cmake
@@ -139,7 +139,7 @@

   # http://www.ogre3d.org/forums/viewtopic.php?f=2&t=60015&start=0
   set(COMMON_CXX_FLAGS "/DWIN32 /D_WINDOWS /W3 /Zm500 /EHsc /GR")
-  set(COMMON_CXX_FLAGS_DEBUG "${COMMON_CXX_FLAGS_RELEASE} /WX")
+#  set(COMMON_CXX_FLAGS_DEBUG "${COMMON_CXX_FLAGS_RELEASE} /WX")
 endif()

 set(COMMON_C_FLAGS_RELWITHDEBINFO "${COMMON_C_FLAGS_RELWITHDEBINFO} -DNDEBUG")


Add PARENT_SCOPE to VTK TPL vars so ParaView can make use of them.

--- CMake/vtkThirdParty.cmake
+++ CMake/vtkThirdParty.cmake
@@ -10,7 +10,7 @@
     ENDIF(EXISTS ${CMAKE_ROOT}/Modules/Find${upper}.cmake)
     MARK_AS_ADVANCED(${upper}_INCLUDE_DIR ${upper}_LIBRARY)
     IF(${upper}_FOUND)
-      SET(VTK_${upper}_LIBRARIES ${${upper}_LIBRARIES})
+      SET(VTK_${upper}_LIBRARIES ${${upper}_LIBRARIES} PARENT_SCOPE)
       IF("${upper}" MATCHES "^PNG$")
         SET(PNG_INCLUDE_DIR ${PNG_PNG_INCLUDE_DIR})
         MARK_AS_ADVANCED(PNG_PNG_INCLUDE_DIR)
@@ -19,7 +19,7 @@
       MESSAGE(SEND_ERROR "VTK_USE_SYSTEM_${upper} is ON, but ${upper}_LIBRARY is NOTFOUND.")
     ENDIF(${upper}_FOUND)
   ELSE(VTK_USE_SYSTEM_${upper})
-    SET(VTK_${upper}_LIBRARIES vtk${lower})
+    SET(VTK_${upper}_LIBRARIES vtk${lower} PARENT_SCOPE)
   ENDIF(VTK_USE_SYSTEM_${upper})
 ENDMACRO(VTK_THIRD_PARTY_OPTION)


convert cmake build to sagase/use_package: fixed typeo

git-svn-id: 65dd0ccd495961f396d5302e5521154b071f0302@1274 5b2332b8-efa3-11de-8684-7d64432d61a3

--- CMakeModules/Sagase.cmake
+++ CMakeModules/Sagase.cmake
@@ -56,8 +56,8 @@
         foreach (pkgname ${path_names})

             set (includes ${includes}
-                ${prefix}/${pkgname}/includes
-                ${prefix}/includes/${pkgname})
+                ${prefix}/${pkgname}/include
+                ${prefix}/include/${pkgname})

             set (libraries ${libraries}
                 ${prefix}/${pkgname}/lib ${prefix}/lib/${pkgname}


Update FW

Update FW

--- cmake/Depthai/DepthaiDeviceSideConfig.cmake
+++ cmake/Depthai/DepthaiDeviceSideConfig.cmake
@@ -2,7 +2,7 @@
 set(DEPTHAI_DEVICE_SIDE_MATURITY "snapshot")

 # "full commit hash of device side binary"
-set(DEPTHAI_DEVICE_SIDE_COMMIT "127b920c32b208d5c49c604158358433bc7db2d7")
+set(DEPTHAI_DEVICE_SIDE_COMMIT "cae01e25ced0510ca2cba17e383fe0ef99e036b1")

 # "version if applicable"
 set(DEPTHAI_DEVICE_SIDE_VERSION "")


Hotfix for FW message cache coherency

Hotfix for FW message cache coherency

--- cmake/Depthai/DepthaiDeviceSideConfig.cmake
+++ cmake/Depthai/DepthaiDeviceSideConfig.cmake
@@ -2,7 +2,7 @@
 set(DEPTHAI_DEVICE_SIDE_MATURITY "snapshot")

 # "full commit hash of device side binary"
-set(DEPTHAI_DEVICE_SIDE_COMMIT "b81c795238f5ccf667829ae270c1c35876cdd206")
+set(DEPTHAI_DEVICE_SIDE_COMMIT "8e63c65cbb74103573a7bc5dbfcf765fd391ad0b")

 # "version if applicable"
 set(DEPTHAI_DEVICE_SIDE_VERSION "")


Crazyflie: Switch to logger

Crazyflie: Switch to logger

--- cmake/configs/nuttx_crazyflie_default.cmake
+++ cmake/configs/nuttx_crazyflie_default.cmake
@@ -70,7 +70,7 @@
 	#
 	# Logging
 	#
-	modules/sdlog2
+	modules/logger

 	#
 	# Library modules


Fail if cfitsio is not found and fail-on-missing=ON

--- cmake/modules/SearchInstalledSoftware.cmake
+++ cmake/modules/SearchInstalledSoftware.cmake
@@ -824,11 +824,15 @@
     set(CFITSIO_TARGET CFITSIO)
   else()
     message(STATUS "Looking for CFITSIO")
-    find_package(CFITSIO)
-    if(NOT CFITSIO_FOUND)
-      message(STATUS "CFITSIO not found. You can enable the option 'builtin_cfitsio' to build the library internally'")
-      message(STATUS "                   For the time being switching off 'fitsio' option")
-      set(fitsio OFF CACHE BOOL "" FORCE)
+    if(fail-on-missing)
+      find_package(CFITSIO REQUIRED)
+    else()
+      find_package(CFITSIO)
+      if(NOT CFITSIO_FOUND)
+        message(STATUS "CFITSIO not found. Switching off 'fitsio' option.")
+        message(STATUS "Please enable the option 'builtin_cfitsio' to build the library internally.")
+        set(fitsio OFF CACHE BOOL "" FORCE)
+      endif()
     endif()
   endif()
 endif()


esptool: (re)populate the secure boot signing key path

For project with reduced component list, secure boot signing key
path was not getting correctly. This change sets the secure boot
signing key path explicitly based on the relevant config option.

Closes https://github.com/espressif/esp-idf/issues/9578
Close IDFGH-8075

--- components/esptool_py/project_include.cmake
+++ components/esptool_py/project_include.cmake
@@ -140,6 +140,8 @@
 if(NOT BOOTLOADER_BUILD AND CONFIG_SECURE_SIGNED_APPS)
     if(CONFIG_SECURE_BOOT_BUILD_SIGNED_BINARIES)
         # for locally signed secure boot image, add a signing step to get from unsigned app to signed app
+        get_filename_component(secure_boot_signing_key "${CONFIG_SECURE_BOOT_SIGNING_KEY}"
+            ABSOLUTE BASE_DIR "${project_dir}")
         add_custom_command(OUTPUT "${build_dir}/.signed_bin_timestamp"
             COMMAND ${ESPSECUREPY} sign_data --version ${secure_boot_version} --keyfile ${secure_boot_signing_key}
                 -o "${build_dir}/${PROJECT_BIN}" "${build_dir}/${unsigned_project_binary}"


New version: 0.5.2

New version: 0.5.2

--- VERSION.cmake
+++ VERSION.cmake
@@ -1,3 +1,3 @@
 SET(HAWKEY_MAJOR "0")
 SET(HAWKEY_MINOR "5")
-SET(HAWKEY_PATCH "1")
+SET(HAWKEY_PATCH "2")


Update Android CMake support to revision 98d85aeb99921aca6ec8a5313c00e7b6a4a989dd of https://github.com/taka-no-me/android-cmake.

--- android/android.toolchain.cmake
+++ android/android.toolchain.cmake
@@ -29,12 +29,9 @@
 # POSSIBILITY OF SUCH DAMAGE.

 # ------------------------------------------------------------------------------
-#  Android CMake toolchain file, for use with the Android NDK r5-r9
-#  Requires cmake 2.6.3 or newer (2.8.5 or newer is recommended).
+#  Android CMake toolchain file, for use with the Android NDK r5-r10d
+#  Requires cmake 2.6.3 or newer (2.8.9 or newer is recommended).
 #  See home page: https://github.com/taka-no-me/android-cmake
-#
-#  The file is mantained by the OpenCV project. The latest version can be get at
-#  http://code.opencv.org/projects/opencv/repository/revisions/master/changes/android/android.toolchain.cmake
 #
 #  Usage Linux:
 #   $ export ANDROID_NDK=/absolute/path/to/the/android-ndk
@@ -42,15 +39,9 @@
 #   $ cmake -DCMAKE_TOOLCHAIN_FILE=path/to/the/android.toolchain.cmake ..
 #   $ make -j8
 #
-#  Usage Linux (using standalone toolchain):
-#   $ export ANDROID_STANDALONE_TOOLCHAIN=/absolute/path/to/android-toolchain
-#   $ mkdir build && cd build
-#   $ cmake -DCMAKE_TOOLCHAIN_FILE=path/to/the/android.toolchain.cmake ..
-#   $ make -j8
-#
 #  Usage Windows:
 #     You need native port of make to build your project.
-#     Android NDK r7 (or newer) already has make.exe on board.
+#     Android NDK r7 (and newer) already has make.exe on board.
 #     For older NDK you have to install it separately.
 #     For example, this one: http://gnuwin32.sourceforge.net/packages/make.htm
 #
@@ -66,50 +57,63 @@
 #    ANDROID_NDK=/opt/android-ndk - path to the NDK root.
 #      Can be set as environment variable. Can be set only at first cmake run.
 #
-#    ANDROID_STANDALONE_TOOLCHAIN=/opt/android-toolchain - path to the
-#      standalone toolchain. This option is not used if full NDK is found
-#      (ignored if ANDROID_NDK is set).
-#      Can be set as environment variable. Can be set only at first cmake run.
-#
 #    ANDROID_ABI=armeabi-v7a - specifies the target Application Binary
 #      Interface (ABI). This option nearly matches to the APP_ABI variable
 #      used by ndk-build tool from Android NDK.
 #
 #      Possible targets are:
-#        "armeabi" - matches to the NDK ABI with the same name.
-#           See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation.
-#        "armeabi-v7a" - matches to the NDK ABI with the same name.
-#           See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation.
+#        "armeabi" - ARMv5TE based CPU with software floating point operations
+#        "armeabi-v7a" - ARMv7 based devices with hardware FPU instructions
+#            this ABI target is used by default
 #        "armeabi-v7a with NEON" - same as armeabi-v7a, but
 #            sets NEON as floating-point unit
 #        "armeabi-v7a with VFPV3" - same as armeabi-v7a, but
-#            sets VFPV3 as floating-point unit (has 32 registers instead of 16).
-#        "armeabi-v6 with VFP" - tuned for ARMv6 processors having VFP.
-#        "x86" - matches to the NDK ABI with the same name.
-#            See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation.
-#        "mips" - matches to the NDK ABI with the same name.
-#            See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation.
+#            sets VFPV3 as floating-point unit (has 32 registers instead of 16)
+#        "armeabi-v6 with VFP" - tuned for ARMv6 processors having VFP
+#        "x86" - IA-32 instruction set
+#        "mips" - MIPS32 instruction set
+#
+#      64-bit ABIs for NDK r10 and newer:
+#        "arm64-v8a" - ARMv8 AArch64 instruction set
+#        "x86_64" - Intel64 instruction set (r1)
+#        "mips64" - MIPS64 instruction set (r6)
 #
 #    ANDROID_NATIVE_API_LEVEL=android-8 - level of Android API compile for.
 #      Option is read-only when standalone toolchain is used.
-#
-#    ANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.6 - the name of compiler
+#      Note: building for "android-L" requires explicit configuration.
+#
+#    ANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.9 - the name of compiler
 #      toolchain to be used. The list of possible values depends on the NDK
-#      version. For NDK r8c the possible values are:
-#
-#        * arm-linux-androideabi-4.4.3
+#      version. For NDK r10c the possible values are:
+#
+#        * aarch64-linux-android-4.9
+#        * aarch64-linux-android-clang3.4
+#        * aarch64-linux-android-clang3.5
 #        * arm-linux-androideabi-4.6
-#        * arm-linux-androideabi-clang3.1
-#        * mipsel-linux-android-4.4.3
+#        * arm-linux-androideabi-4.8
+#        * arm-linux-androideabi-4.9 (default)
+#        * arm-linux-androideabi-clang3.4
+#        * arm-linux-androideabi-clang3.5
+#        * mips64el-linux-android-4.9
+#        * mips64el-linux-android-clang3.4
+#        * mips64el-linux-android-clang3.5
 #        * mipsel-linux-android-4.6
-#        * mipsel-linux-android-clang3.1
-#        * x86-4.4.3
+#        * mipsel-linux-android-4.8
+#        * mipsel-linux-android-4.9
+#        * mipsel-linux-android-clang3.4
+#        * mipsel-linux-android-clang3.5
 #        * x86-4.6
-#        * x86-clang3.1
+#        * x86-4.8
+#        * x86-4.9
+#        * x86-clang3.4
+#        * x86-clang3.5
+#        * x86_64-4.9
+#        * x86_64-clang3.4
+#        * x86_64-clang3.5
 #
 #    ANDROID_FORCE_ARM_BUILD=OFF - set ON to generate 32-bit ARM instructions
-#      instead of Thumb. Is not available for "x86" (inapplicable) and
-#      "armeabi-v6 with VFP" (is forced to be ON) ABIs.
+#      instead of Thumb. Is not available for "armeabi-v6 with VFP"
+#      (is forced to be ON) ABI.
 #
 #    ANDROID_NO_UNDEFINED=ON - set ON to show all undefined symbols as linker
 #      errors even if they are not used.
@@ -117,13 +121,6 @@
 #    ANDROID_SO_UNDEFINED=OFF - set ON to allow undefined symbols in shared
 #      libraries. Automatically turned for NDK r5x and r6x due to GLESv2
 #      problems.
-#
-#    LIBRARY_OUTPUT_PATH_ROOT=${CMAKE_SOURCE_DIR} - where to output binary
-#      files. See additional details below.
-#
-#    ANDROID_SET_OBSOLETE_VARIABLES=ON - if set, then toolchain defines some
-#      obsolete variables which were used by previous versions of this file for
-#      backward compatibility.
 #
 #    ANDROID_STL=gnustl_static - specify the runtime to use.
 #
@@ -181,128 +178,10 @@
 #    ANDROID and BUILD_ANDROID will be set to true, you may test any of these
 #    variables to make necessary Android-specific configuration changes.
 #
-#    Also ARMEABI or ARMEABI_V7A or X86 or MIPS will be set true, mutually
-#    exclusive. NEON option will be set true if VFP is set to NEON.
-#
-#    LIBRARY_OUTPUT_PATH_ROOT should be set in cache to determine where Android
-#    libraries will be installed.
-#    Default is ${CMAKE_SOURCE_DIR}, and the android libs will always be
-#    under the ${LIBRARY_OUTPUT_PATH_ROOT}/libs/${ANDROID_NDK_ABI_NAME}
-#    (depending on the target ABI). This is convenient for Android packaging.
-#
-#  Change Log:
-#   - initial version December 2010
-#   - April 2011
-#     [+] added possibility to build with NDK (without standalone toolchain)
-#     [+] support cross-compilation on Windows (native, no cygwin support)
-#     [+] added compiler option to force "char" type to be signed
-#     [+] added toolchain option to compile to 32-bit ARM instructions
-#     [+] added toolchain option to disable SWIG search
-#     [+] added platform "armeabi-v7a with VFPV3"
-#     [~] ARM_TARGETS renamed to ARM_TARGET
-#     [+] EXECUTABLE_OUTPUT_PATH is set by toolchain (required on Windows)
-#     [~] Fixed bug with ANDROID_API_LEVEL variable
-#     [~] turn off SWIG search if it is not found first time
-#   - May 2011
-#     [~] ANDROID_LEVEL is renamed to ANDROID_API_LEVEL
-#     [+] ANDROID_API_LEVEL is detected by toolchain if not specified
-#     [~] added guard to prevent changing of output directories on the first
-#         cmake pass
-#     [~] toolchain exits with error if ARM_TARGET is not recognized
-#   - June 2011
-#     [~] default NDK path is updated for version r5c
-#     [+] variable CMAKE_SYSTEM_PROCESSOR is set based on ARM_TARGET
-#     [~] toolchain install directory is added to linker paths
-#     [-] removed SWIG-related stuff from toolchain
-#     [+] added macro find_host_package, find_host_program to search
-#         packages/programs on the host system
-#     [~] fixed path to STL library
-#   - July 2011
-#     [~] fixed options caching
-#     [~] search for all supported NDK versions
-#     [~] allowed spaces in NDK path
-#   - September 2011
-#     [~] updated for NDK r6b
-#   - November 2011
-#     [*] rewritten for NDK r7
-#     [+] x86 toolchain support (experimental)
-#     [+] added "armeabi-v6 with VFP" ABI for ARMv6 processors.
-#     [~] improved compiler and linker flags management
-#     [+] support different build flags for Release and Debug configurations
-#     [~] by default compiler flags the same as used by ndk-build (but only
-#         where reasonable)
-#     [~] ANDROID_NDK_TOOLCHAIN_ROOT is splitted to ANDROID_STANDALONE_TOOLCHAIN
-#         and ANDROID_TOOLCHAIN_ROOT
-#     [~] ARM_TARGET is renamed to ANDROID_ABI
-#     [~] ARMEABI_NDK_NAME is renamed to ANDROID_NDK_ABI_NAME
-#     [~] ANDROID_API_LEVEL is renamed to ANDROID_NATIVE_API_LEVEL
-#   - January 2012
-#     [+] added stlport_static support (experimental)
-#     [+] added special check for cygwin
-#     [+] filtered out hidden files (starting with .) while globbing inside NDK
-#     [+] automatically applied GLESv2 linkage fix for NDK revisions 5-6
-#     [+] added ANDROID_GET_ABI_RAWNAME to get NDK ABI names by CMake flags
-#   - February 2012
-#     [+] updated for NDK r7b
-#     [~] fixed cmake try_compile() command
-#     [~] Fix for missing install_name_tool on OS X
-#   - March 2012
-#     [~] fixed incorrect C compiler flags
-#     [~] fixed CMAKE_SYSTEM_PROCESSOR change on ANDROID_ABI change
-#     [+] improved toolchain loading speed
-#     [+] added assembler language support (.S)
-#     [+] allowed preset search paths and extra search suffixes
-#   - April 2012
-#     [+] updated for NDK r7c
-#     [~] fixed most of problems with compiler/linker flags and caching
-#     [+] added option ANDROID_FUNCTION_LEVEL_LINKING
-#   - May 2012
-#     [+] updated for NDK r8
-#     [+] added mips architecture support
-#   - August 2012
-#     [+] updated for NDK r8b
-#     [~] all intermediate files generated by toolchain are moved to CMakeFiles
-#     [~] libstdc++ and libsupc are removed from explicit link libraries
-#     [+] added CCache support (via NDK_CCACHE environment or cmake variable)
-#     [+] added gold linker support for NDK r8b
-#     [~] fixed mips linker flags for NDK r8b
-#   - September 2012
-#     [+] added NDK release name detection (see ANDROID_NDK_RELEASE)
-#     [+] added support for all C++ runtimes from NDK
-#         (system, gabi++, stlport, gnustl)
-#     [+] improved warnings on known issues of NDKs
-#     [~] use gold linker as default if available (NDK r8b)
-#     [~] globally turned off rpath
-#     [~] compiler options are aligned with NDK r8b
-#   - October 2012
-#     [~] fixed C++ linking: explicitly link with math library (OpenCV #2426)
-#   - November 2012
-#     [+] updated for NDK r8c
-#     [+] added support for clang compiler
-#   - December 2012
-#     [+] suppress warning about unused CMAKE_TOOLCHAIN_FILE variable
-#     [+] adjust API level to closest compatible as NDK does
-#     [~] fixed ccache full path search
-#     [+] updated for NDK r8d
-#     [~] compiler options are aligned with NDK r8d
-#   - March 2013
-#     [+] updated for NDK r8e (x86 version)
-#     [+] support x86_64 version of NDK
-#   - April 2013
-#     [+] support non-release NDK layouts (from Linaro git and Android git)
-#     [~] automatically detect if explicit link to crtbegin_*.o is needed
-#   - June 2013
-#     [~] fixed stl include path for standalone toolchain made by NDK >= r8c
-#   - July 2013
-#     [+] updated for NDK r9
-#   - November 2013
-#     [+] updated for NDK r9b
-#   - December 2013
-#     [+] updated for NDK r9c
-#   - January 2014
-#     [~] fix copying of shared STL
-#   - April 2014
-#     [+] updated for NDK r9d
+#    Also ARMEABI or ARMEABI_V7A or X86 or MIPS or ARM64_V8A or X86_64 or MIPS64
+#    will be set true, mutually exclusive. NEON option will be set true
+#    if VFP is set to NEON.
+#
 # ------------------------------------------------------------------------------

 cmake_minimum_required( VERSION 2.6.3 )
@@ -313,146 +192,146 @@
 endif()

 if( CMAKE_TOOLCHAIN_FILE )
- # touch toolchain variable only to suppress "unused variable" warning
-endif()
-
+ # touch toolchain variable to suppress "unused variable" warning
+endif()
+
+# inherit settings in recursive loads
 get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE )
 if( _CMAKE_IN_TRY_COMPILE )
  include( "${CMAKE_CURRENT_SOURCE_DIR}/../android.toolchain.config.cmake" OPTIONAL )
 endif()

 # this one is important
-set( CMAKE_SYSTEM_NAME Linux )
+if( CMAKE_VERSION VERSION_GREATER "3.0.99" )
+ set( CMAKE_SYSTEM_NAME Android )
+else()
+ set( CMAKE_SYSTEM_NAME Linux )
+endif()
+
 # this one not so much
 set( CMAKE_SYSTEM_VERSION 1 )

-# rpath makes low sence for Android
+# rpath makes low sense for Android
+set( CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "" )
 set( CMAKE_SKIP_RPATH TRUE CACHE BOOL "If set, runtime paths are not added when using shared libraries." )

-set( ANDROID_SUPPORTED_NDK_VERSIONS ${ANDROID_EXTRA_NDK_VERSIONS} -r9d -r9c -r9b -r9 -r8e -r8d -r8c -r8b -r8 -r7c -r7b -r7 -r6b -r6 -r5c -r5b -r5 "" )
-if(NOT DEFINED ANDROID_NDK_SEARCH_PATHS)
+# NDK search paths
+set( ANDROID_SUPPORTED_NDK_VERSIONS ${ANDROID_EXTRA_NDK_VERSIONS} -r10d -r10c -r10b -r10 -r9d -r9c -r9b -r9 -r8e -r8d -r8c -r8b -r8 -r7c -r7b -r7 -r6b -r6 -r5c -r5b -r5 "" )
+if( NOT DEFINED ANDROID_NDK_SEARCH_PATHS )
  if( CMAKE_HOST_WIN32 )
   file( TO_CMAKE_PATH "$ENV{PROGRAMFILES}" ANDROID_NDK_SEARCH_PATHS )
-  set( ANDROID_NDK_SEARCH_PATHS "${ANDROID_NDK_SEARCH_PATHS}/android-ndk" "$ENV{SystemDrive}/NVPACK/android-ndk" )
+  set( ANDROID_NDK_SEARCH_PATHS "${ANDROID_NDK_SEARCH_PATHS}" "$ENV{SystemDrive}/NVPACK" )
  else()
   file( TO_CMAKE_PATH "$ENV{HOME}" ANDROID_NDK_SEARCH_PATHS )
-  set( ANDROID_NDK_SEARCH_PATHS /opt/android-ndk "${ANDROID_NDK_SEARCH_PATHS}/NVPACK/android-ndk" )
- endif()
-endif()
-if(NOT DEFINED ANDROID_STANDALONE_TOOLCHAIN_SEARCH_PATH)
+  set( ANDROID_NDK_SEARCH_PATHS /opt "${ANDROID_NDK_SEARCH_PATHS}/NVPACK" )
+ endif()
+endif()
+if( NOT DEFINED ANDROID_STANDALONE_TOOLCHAIN_SEARCH_PATH )
  set( ANDROID_STANDALONE_TOOLCHAIN_SEARCH_PATH /opt/android-toolchain )
 endif()

+# known ABIs
 set( ANDROID_SUPPORTED_ABIS_arm "armeabi-v7a;armeabi;armeabi-v7a with NEON;armeabi-v7a with VFPV3;armeabi-v6 with VFP" )
+set( ANDROID_SUPPORTED_ABIS_arm64 "arm64-v8a" )
 set( ANDROID_SUPPORTED_ABIS_x86 "x86" )
-set( ANDROID_SUPPORTED_ABIS_mipsel "mips" )
-
+set( ANDROID_SUPPORTED_ABIS_x86_64 "x86_64" )
+set( ANDROID_SUPPORTED_ABIS_mips "mips" )
+set( ANDROID_SUPPORTED_ABIS_mips64 "mips64" )
+
+# API level defaults
 set( ANDROID_DEFAULT_NDK_API_LEVEL 8 )
+set( ANDROID_DEFAULT_NDK_API_LEVEL_arm64 21 )
 set( ANDROID_DEFAULT_NDK_API_LEVEL_x86 9 )
+set( ANDROID_DEFAULT_NDK_API_LEVEL_x86_64 21 )
 set( ANDROID_DEFAULT_NDK_API_LEVEL_mips 9 )
+set( ANDROID_DEFAULT_NDK_API_LEVEL_mips64 21 )

 macro( __LIST_FILTER listvar regex )
- if( ${listvar} )
-  foreach( __val ${${listvar}} )
-   if( __val MATCHES "${regex}" )
-    list( REMOVE_ITEM ${listvar} "${__val}" )
-   endif()
+  if( ${listvar} )
+    foreach( __val ${${listvar}} )
+      if( __val MATCHES "${regex}" )
+        list( REMOVE_ITEM ${listvar} "${__val}" )
+      endif()
+    endforeach()
+  endif()
+endmacro()
+
+macro( __INIT_VARIABLE var_name )
+  set( __test_path 0 )
+  foreach( __var ${ARGN} )
+    if( __var STREQUAL "PATH" )
+      set( __test_path 1 )
+      break()
+    endif()
   endforeach()
- endif()
+
+  if( __test_path AND NOT EXISTS "${${var_name}}" )
+    unset( ${var_name} CACHE )
+  endif()
+
+  if( " ${${var_name}}" STREQUAL " " )
+    set( __values 0 )
+    foreach( __var ${ARGN} )
+      if( __var STREQUAL "VALUES" )
+        set( __values 1 )
+      elseif( NOT __var STREQUAL "PATH" )
+        if( __var MATCHES "^ENV_.*$" )
+          string( REPLACE "ENV_" "" __var "${__var}" )
+          set( __value "$ENV{${__var}}" )
+        elseif( DEFINED ${__var} )
+          set( __value "${${__var}}" )
+        elseif( __values )
+          set( __value "${__var}" )
+        else()
+          set( __value "" )
+        endif()
+
+        if( NOT " ${__value}" STREQUAL " " AND (NOT __test_path OR EXISTS "${__value}") )
+          set( ${var_name} "${__value}" )
+          break()
+        endif()
+      endif()
+    endforeach()
+    unset( __value )
+    unset( __values )
+  endif()
+
+  if( __test_path )
+    file( TO_CMAKE_PATH "${${var_name}}" ${var_name} )
+  endif()
+  unset( __test_path )
 endmacro()

-macro( __INIT_VARIABLE var_name )
- set( __test_path 0 )
- foreach( __var ${ARGN} )
-  if( __var STREQUAL "PATH" )
-   set( __test_path 1 )
-   break()
-  endif()
- endforeach()
- if( __test_path AND NOT EXISTS "${${var_name}}" )
-  unset( ${var_name} CACHE )
- endif()
- if( "${${var_name}}" STREQUAL "" )
-  set( __values 0 )
-  foreach( __var ${ARGN} )
-   if( __var STREQUAL "VALUES" )
-    set( __values 1 )
-   elseif( NOT __var STREQUAL "PATH" )
-    set( __obsolete 0 )
-    if( __var MATCHES "^OBSOLETE_.*$" )
-     string( REPLACE "OBSOLETE_" "" __var "${__var}" )
-     set( __obsolete 1 )
-    endif()
-    if( __var MATCHES "^ENV_.*$" )
-     string( REPLACE "ENV_" "" __var "${__var}" )
-     set( __value "$ENV{${__var}}" )
-    elseif( DEFINED ${__var} )
-     set( __value "${${__var}}" )
-    else()
-     if( __values )
-      set( __value "${__var}" )
-     else()
-      set( __value "" )
-     endif()
-    endif()
-    if( NOT "${__value}" STREQUAL "" )
-     if( __test_path )
-      if( EXISTS "${__value}" )
-       file( TO_CMAKE_PATH "${__value}" ${var_name} )
-       if( __obsolete AND NOT _CMAKE_IN_TRY_COMPILE )
-        message( WARNING "Using value of obsolete variable ${__var} as initial value for ${var_name}. Please note, that ${__var} can be completely removed in future versions of the toolchain." )
-       endif()
-       break()
-      endif()
-     else()
-      set( ${var_name} "${__value}" )
-       if( __obsolete AND NOT _CMAKE_IN_TRY_COMPILE )
-        message( WARNING "Using value of obsolete variable ${__var} as initial value for ${var_name}. Please note, that ${__var} can be completely removed in future versions of the toolchain." )
-       endif()
-      break()
-     endif()
-    endif()
-   endif()
-  endforeach()
-  unset( __value )
-  unset( __values )
-  unset( __obsolete )
- elseif( __test_path )
-  file( TO_CMAKE_PATH "${${var_name}}" ${var_name} )
- endif()
- unset( __test_path )
-endmacro()
-
 macro( __DETECT_NATIVE_API_LEVEL _var _path )
- SET( __ndkApiLevelRegex "^[\t ]*#define[\t ]+__ANDROID_API__[\t ]+([0-9]+)[\t ]*$" )
- FILE( STRINGS ${_path} __apiFileContent REGEX "${__ndkApiLevelRegex}" )
- if( NOT __apiFileContent )
-  message( SEND_ERROR "Could not get Android native API level. Probably you have specified invalid level value, or your copy of NDK/toolchain is broken." )
- endif()
- string( REGEX REPLACE "${__ndkApiLevelRegex}" "\\1" ${_var} "${__apiFileContent}" )
- unset( __apiFileContent )
- unset( __ndkApiLevelRegex )
+  set( __ndkApiLevelRegex "^[\t ]*#define[\t ]+__ANDROID_API__[\t ]+([0-9]+)[\t ]*.*$" )
+  file( STRINGS ${_path} __apiFileContent REGEX "${__ndkApiLevelRegex}" )
+  if( NOT __apiFileContent )
+    message( SEND_ERROR "Could not get Android native API level. Probably you have specified invalid level value, or your copy of NDK/toolchain is broken." )
+  endif()
+  string( REGEX REPLACE "${__ndkApiLevelRegex}" "\\1" ${_var} "${__apiFileContent}" )
+  unset( __apiFileContent )
+  unset( __ndkApiLevelRegex )
 endmacro()

 macro( __DETECT_TOOLCHAIN_MACHINE_NAME _var _root )
  if( EXISTS "${_root}" )
-  file( GLOB __gccExePath RELATIVE "${_root}/bin/" "${_root}/bin/*-gcc${TOOL_OS_SUFFIX}" )
-  __LIST_FILTER( __gccExePath "^[.].*" )
-  list( LENGTH __gccExePath __gccExePathsCount )
-  if( NOT __gccExePathsCount EQUAL 1  AND NOT _CMAKE_IN_TRY_COMPILE )
-   message( WARNING "Could not determine machine name for compiler from ${_root}" )
-   set( ${_var} "" )
+    file( GLOB __gccExePath RELATIVE "${_root}/bin/" "${_root}/bin/*-gcc${TOOL_OS_SUFFIX}" )
+    __LIST_FILTER( __gccExePath "^[.].*" )
+    list( LENGTH __gccExePath __gccExePathsCount )
+    if( NOT __gccExePathsCount EQUAL 1  AND NOT _CMAKE_IN_TRY_COMPILE )
+      message( WARNING "Could not determine machine name for compiler from ${_root}" )
+      set( ${_var} "" )
+    else()
+      get_filename_component( __gccExeName "${__gccExePath}" NAME_WE )
+      string( REPLACE "-gcc" "" ${_var} "${__gccExeName}" )
+    endif()
+    unset( __gccExePath )
+    unset( __gccExePathsCount )
+    unset( __gccExeName )
   else()
-   get_filename_component( __gccExeName "${__gccExePath}" NAME_WE )
-   string( REPLACE "-gcc" "" ${_var} "${__gccExeName}" )
-  endif()
-  unset( __gccExePath )
-  unset( __gccExePathsCount )
-  unset( __gccExeName )
- else()
-  set( ${_var} "" )
- endif()
+    set( ${_var} "" )
+  endif()
 endmacro()

@@ -500,17 +379,19 @@
 endif()

 # see if we have path to Android NDK
-__INIT_VARIABLE( ANDROID_NDK PATH ENV_ANDROID_NDK )
+if( NOT ANDROID_NDK AND NOT ANDROID_STANDALONE_TOOLCHAIN )
+  __INIT_VARIABLE( ANDROID_NDK PATH ENV_ANDROID_NDK )
+endif()
 if( NOT ANDROID_NDK )
  # see if we have path to Android standalone toolchain
- __INIT_VARIABLE( ANDROID_STANDALONE_TOOLCHAIN PATH ENV_ANDROID_STANDALONE_TOOLCHAIN OBSOLETE_ANDROID_NDK_TOOLCHAIN_ROOT OBSOLETE_ENV_ANDROID_NDK_TOOLCHAIN_ROOT )
+ __INIT_VARIABLE( ANDROID_STANDALONE_TOOLCHAIN PATH ENV_ANDROID_STANDALONE_TOOLCHAIN )

  if( NOT ANDROID_STANDALONE_TOOLCHAIN )
   #try to find Android NDK in one of the the default locations
   set( __ndkSearchPaths )
   foreach( __ndkSearchPath ${ANDROID_NDK_SEARCH_PATHS} )
    foreach( suffix ${ANDROID_SUPPORTED_NDK_VERSIONS} )
-    list( APPEND __ndkSearchPaths "${__ndkSearchPath}${suffix}" )
+    list( APPEND __ndkSearchPaths "${__ndkSearchPath}/android-ndk${suffix}" )
    endforeach()
   endforeach()
   __INIT_VARIABLE( ANDROID_NDK PATH VALUES ${__ndkSearchPaths} )
@@ -537,12 +418,15 @@
  set( ANDROID_NDK "${ANDROID_NDK}" CACHE INTERNAL "Path of the Android NDK" FORCE )
  set( BUILD_WITH_ANDROID_NDK True )
  if( EXISTS "${ANDROID_NDK}/RELEASE.TXT" )
-  file( STRINGS "${ANDROID_NDK}/RELEASE.TXT" ANDROID_NDK_RELEASE_FULL LIMIT_COUNT 1 REGEX r[0-9]+[a-z]? )
-  string( REGEX MATCH r[0-9]+[a-z]? ANDROID_NDK_RELEASE "${ANDROID_NDK_RELEASE_FULL}" )
+  file( STRINGS "${ANDROID_NDK}/RELEASE.TXT" ANDROID_NDK_RELEASE_FULL LIMIT_COUNT 1 REGEX "r[0-9]+[a-z]?" )
+  string( REGEX MATCH "r([0-9]+)([a-z]?)" ANDROID_NDK_RELEASE "${ANDROID_NDK_RELEASE_FULL}" )
  else()
   set( ANDROID_NDK_RELEASE "r1x" )
   set( ANDROID_NDK_RELEASE_FULL "unreleased" )
  endif()
+ string( REGEX REPLACE "r([0-9]+)([a-z]?)" "\\1*1000" ANDROID_NDK_RELEASE_NUM "${ANDROID_NDK_RELEASE}" )
+ string( FIND " abcdefghijklmnopqastuvwxyz" "${CMAKE_MATCH_2}" __ndkReleaseLetterNum )
+ math( EXPR ANDROID_NDK_RELEASE_NUM "${ANDROID_NDK_RELEASE_NUM}+${__ndkReleaseLetterNum}" )
 elseif( ANDROID_STANDALONE_TOOLCHAIN )
  get_filename_component( ANDROID_STANDALONE_TOOLCHAIN "${ANDROID_STANDALONE_TOOLCHAIN}" ABSOLUTE )
  # try to detect change
@@ -565,7 +449,7 @@
     or
       export ANDROID_STANDALONE_TOOLCHAIN=~/my-android-toolchain
     or put the toolchain or NDK in the default path:
-      sudo ln -s ~/my-android-ndk ${ANDROID_NDK_SEARCH_PATH}
+      sudo ln -s ~/my-android-ndk ${ANDROID_NDK_SEARCH_PATH}/android-ndk
       sudo ln -s ~/my-android-toolchain ${ANDROID_STANDALONE_TOOLCHAIN_SEARCH_PATH}" )
 endif()

@@ -623,12 +507,18 @@
  if( NOT __availableToolchainMachines )
   message( FATAL_ERROR "Could not determine machine name of your toolchain. Probably your Android standalone toolchain is broken." )
  endif()
- if( __availableToolchainMachines MATCHES i686 )
+ if( __availableToolchainMachines MATCHES x86_64 )
+  set( __availableToolchainArchs "x86_64" )
+ elseif( __availableToolchainMachines MATCHES i686 )
   set( __availableToolchainArchs "x86" )
+ elseif( __availableToolchainMachines MATCHES aarch64 )
+  set( __availableToolchainArchs "arm64" )
  elseif( __availableToolchainMachines MATCHES arm )
   set( __availableToolchainArchs "arm" )
+ elseif( __availableToolchainMachines MATCHES mips64el )
+  set( __availableToolchainArchs "mips64" )
  elseif( __availableToolchainMachines MATCHES mipsel )
-  set( __availableToolchainArchs "mipsel" )
+  set( __availableToolchainArchs "mips" )
  endif()
  execute_process( COMMAND "${ANDROID_STANDALONE_TOOLCHAIN}/bin/${__availableToolchainMachines}-gcc${TOOL_OS_SUFFIX}" -dumpversion
                   OUTPUT_VARIABLE __availableToolchainCompilerVersions OUTPUT_STRIP_TRAILING_WHITESPACE )
@@ -644,24 +534,44 @@
 macro( __GLOB_NDK_TOOLCHAINS __availableToolchainsVar __availableToolchainsLst __toolchain_subpath )
  foreach( __toolchain ${${__availableToolchainsLst}} )
   if( "${__toolchain}" MATCHES "-clang3[.][0-9]$" AND NOT EXISTS "${ANDROID_NDK_TOOLCHAINS_PATH}/${__toolchain}${__toolchain_subpath}" )
-   string( REGEX REPLACE "-clang3[.][0-9]$" "-4.6" __gcc_toolchain "${__toolchain}" )
+   SET( __toolchainVersionRegex "^TOOLCHAIN_VERSION[\t ]+:=[\t ]+(.*)$" )
+   FILE( STRINGS "${ANDROID_NDK_TOOLCHAINS_PATH}/${__toolchain}/setup.mk" __toolchainVersionStr REGEX "${__toolchainVersionRegex}" )
+   if( __toolchainVersionStr )
+    string( REGEX REPLACE "${__toolchainVersionRegex}" "\\1" __toolchainVersionStr "${__toolchainVersionStr}" )
+    string( REGEX REPLACE "-clang3[.][0-9]$" "-${__toolchainVersionStr}" __gcc_toolchain "${__toolchain}" )
+   else()
+    string( REGEX REPLACE "-clang3[.][0-9]$" "-4.6" __gcc_toolchain "${__toolchain}" )
+   endif()
+   unset( __toolchainVersionStr )
+   unset( __toolchainVersionRegex )
   else()
    set( __gcc_toolchain "${__toolchain}" )
   endif()
   __DETECT_TOOLCHAIN_MACHINE_NAME( __machine "${ANDROID_NDK_TOOLCHAINS_PATH}/${__gcc_toolchain}${__toolchain_subpath}" )
   if( __machine )
    string( REGEX MATCH "[0-9]+[.][0-9]+([.][0-9x]+)?$" __version "${__gcc_toolchain}" )
-   if( __machine MATCHES i686 )
+   if( __machine MATCHES x86_64 )
+    set( __arch "x86_64" )
+   elseif( __machine MATCHES i686 )
     set( __arch "x86" )
+   elseif( __machine MATCHES aarch64 )
+    set( __arch "arm64" )
    elseif( __machine MATCHES arm )
     set( __arch "arm" )
+   elseif( __machine MATCHES mips64el )
+    set( __arch "mips64" )
    elseif( __machine MATCHES mipsel )
-    set( __arch "mipsel" )
+    set( __arch "mips" )
+   else()
+    set( __arch "" )
    endif()
-   list( APPEND __availableToolchainMachines "${__machine}" )
-   list( APPEND __availableToolchainArchs "${__arch}" )
-   list( APPEND __availableToolchainCompilerVersions "${__version}" )
-   list( APPEND ${__availableToolchainsVar} "${__toolchain}" )
+   #message("machine: !${__machine}!\narch: !${__arch}!\nversion: !${__version}!\ntoolchain: !${__toolchain}!\n")
+   if (__arch)
+    list( APPEND __availableToolchainMachines "${__machine}" )
+    list( APPEND __availableToolchainArchs "${__arch}" )
+    list( APPEND __availableToolchainCompilerVersions "${__version}" )
+    list( APPEND ${__availableToolchainsVar} "${__toolchain}" )
+   endif()
   endif()
   unset( __gcc_toolchain )
  endforeach()
@@ -721,7 +631,7 @@
 endif()

 # choose target ABI
-__INIT_VARIABLE( ANDROID_ABI OBSOLETE_ARM_TARGET OBSOLETE_ARM_TARGETS VALUES ${ANDROID_SUPPORTED_ABIS} )
+__INIT_VARIABLE( ANDROID_ABI VALUES ${ANDROID_SUPPORTED_ABIS} )
 # verify that target ABI is supported
 list( FIND ANDROID_SUPPORTED_ABIS "${ANDROID_ABI}" __androidAbiIdx )
 if( __androidAbiIdx EQUAL -1 )
@@ -737,28 +647,45 @@
  set( X86 true )
  set( ANDROID_NDK_ABI_NAME "x86" )
  set( ANDROID_ARCH_NAME "x86" )
- set( ANDROID_ARCH_FULLNAME "x86" )
  set( ANDROID_LLVM_TRIPLE "i686-none-linux-android" )
  set( CMAKE_SYSTEM_PROCESSOR "i686" )
+elseif( ANDROID_ABI STREQUAL "x86_64" )
+ set( X86 true )
+ set( X86_64 true )
+ set( ANDROID_NDK_ABI_NAME "x86_64" )
+ set( ANDROID_ARCH_NAME "x86_64" )
+ set( CMAKE_SYSTEM_PROCESSOR "x86_64" )
+ set( ANDROID_LLVM_TRIPLE "x86_64-none-linux-android" )
+elseif( ANDROID_ABI STREQUAL "mips64" )
+ set( MIPS64 true )
+ set( ANDROID_NDK_ABI_NAME "mips64" )
+ set( ANDROID_ARCH_NAME "mips64" )
+ set( ANDROID_LLVM_TRIPLE "mips64el-none-linux-android" )
+ set( CMAKE_SYSTEM_PROCESSOR "mips64" )
 elseif( ANDROID_ABI STREQUAL "mips" )
  set( MIPS true )
  set( ANDROID_NDK_ABI_NAME "mips" )
  set( ANDROID_ARCH_NAME "mips" )
- set( ANDROID_ARCH_FULLNAME "mipsel" )
  set( ANDROID_LLVM_TRIPLE "mipsel-none-linux-android" )
  set( CMAKE_SYSTEM_PROCESSOR "mips" )
+elseif( ANDROID_ABI STREQUAL "arm64-v8a" )
+ set( ARM64_V8A true )
+ set( ANDROID_NDK_ABI_NAME "arm64-v8a" )
+ set( ANDROID_ARCH_NAME "arm64" )
+ set( ANDROID_LLVM_TRIPLE "aarch64-none-linux-android" )
+ set( CMAKE_SYSTEM_PROCESSOR "aarch64" )
+ set( VFPV3 true )
+ set( NEON true )
 elseif( ANDROID_ABI STREQUAL "armeabi" )
  set( ARMEABI true )
  set( ANDROID_NDK_ABI_NAME "armeabi" )
  set( ANDROID_ARCH_NAME "arm" )
- set( ANDROID_ARCH_FULLNAME "arm" )
  set( ANDROID_LLVM_TRIPLE "armv5te-none-linux-androideabi" )
  set( CMAKE_SYSTEM_PROCESSOR "armv5te" )
 elseif( ANDROID_ABI STREQUAL "armeabi-v6 with VFP" )
  set( ARMEABI_V6 true )
  set( ANDROID_NDK_ABI_NAME "armeabi" )
  set( ANDROID_ARCH_NAME "arm" )
- set( ANDROID_ARCH_FULLNAME "arm" )
  set( ANDROID_LLVM_TRIPLE "armv5te-none-linux-androideabi" )
  set( CMAKE_SYSTEM_PROCESSOR "armv6" )
  # need always fallback to older platform
@@ -767,14 +694,12 @@
  set( ARMEABI_V7A true )
  set( ANDROID_NDK_ABI_NAME "armeabi-v7a" )
  set( ANDROID_ARCH_NAME "arm" )
- set( ANDROID_ARCH_FULLNAME "arm" )
  set( ANDROID_LLVM_TRIPLE "armv7-none-linux-androideabi" )
  set( CMAKE_SYSTEM_PROCESSOR "armv7-a" )
 elseif( ANDROID_ABI STREQUAL "armeabi-v7a with VFPV3" )
  set( ARMEABI_V7A true )
  set( ANDROID_NDK_ABI_NAME "armeabi-v7a" )
  set( ANDROID_ARCH_NAME "arm" )
- set( ANDROID_ARCH_FULLNAME "arm" )
  set( ANDROID_LLVM_TRIPLE "armv7-none-linux-androideabi" )
  set( CMAKE_SYSTEM_PROCESSOR "armv7-a" )
  set( VFPV3 true )
@@ -782,7 +707,6 @@
  set( ARMEABI_V7A true )
  set( ANDROID_NDK_ABI_NAME "armeabi-v7a" )
  set( ANDROID_ARCH_NAME "arm" )
- set( ANDROID_ARCH_FULLNAME "arm" )
  set( ANDROID_LLVM_TRIPLE "armv7-none-linux-androideabi" )
  set( CMAKE_SYSTEM_PROCESSOR "armv7-a" )
  set( VFPV3 true )
@@ -798,7 +722,7 @@
 endif()

 if( ANDROID_ARCH_NAME STREQUAL "arm" AND NOT ARMEABI_V6 )
- __INIT_VARIABLE( ANDROID_FORCE_ARM_BUILD OBSOLETE_FORCE_ARM VALUES OFF )
+ __INIT_VARIABLE( ANDROID_FORCE_ARM_BUILD VALUES OFF )
  set( ANDROID_FORCE_ARM_BUILD ${ANDROID_FORCE_ARM_BUILD} CACHE BOOL "Use 32-bit ARM instructions instead of Thumb-1" FORCE )
  mark_as_advanced( ANDROID_FORCE_ARM_BUILD )
 else()
@@ -816,7 +740,7 @@
 To configure the toolchain set CMake variable ANDROID_TOOLCHAIN_NAME to one of the following values:\n${toolchains_list}\n" )
  endif()
  list( GET __availableToolchainArchs ${__toolchainIdx} __toolchainArch )
- if( NOT __toolchainArch STREQUAL ANDROID_ARCH_FULLNAME )
+ if( NOT __toolchainArch STREQUAL ANDROID_ARCH_NAME )
   message( SEND_ERROR "Selected toolchain \"${ANDROID_TOOLCHAIN_NAME}\" is not able to compile binaries for the \"${ANDROID_ARCH_NAME}\" platform." )
  endif()
 else()
@@ -827,7 +751,7 @@
  math( EXPR __availableToolchainsCount "${__availableToolchainsCount}-1" )
  foreach( __idx RANGE ${__availableToolchainsCount} )
   list( GET __availableToolchainArchs ${__idx} __toolchainArch )
-  if( __toolchainArch STREQUAL ANDROID_ARCH_FULLNAME )
+  if( __toolchainArch STREQUAL ANDROID_ARCH_NAME )
    list( GET __availableToolchainCompilerVersions ${__idx} __toolchainVersion )
    string( REPLACE "x" "99" __toolchainVersion "${__toolchainVersion}")
    if( __toolchainVersion VERSION_GREATER __toolchainMaxVersion )
@@ -856,15 +780,16 @@

 # choose native API level
 __INIT_VARIABLE( ANDROID_NATIVE_API_LEVEL ENV_ANDROID_NATIVE_API_LEVEL ANDROID_API_LEVEL ENV_ANDROID_API_LEVEL ANDROID_STANDALONE_TOOLCHAIN_API_LEVEL ANDROID_DEFAULT_NDK_API_LEVEL_${ANDROID_ARCH_NAME} ANDROID_DEFAULT_NDK_API_LEVEL )
-string( REGEX MATCH "[0-9]+" ANDROID_NATIVE_API_LEVEL "${ANDROID_NATIVE_API_LEVEL}" )
+string( REPLACE "android-" "" ANDROID_NATIVE_API_LEVEL "${ANDROID_NATIVE_API_LEVEL}" )
+string( STRIP "${ANDROID_NATIVE_API_LEVEL}" ANDROID_NATIVE_API_LEVEL )
 # adjust API level
 set( __real_api_level ${ANDROID_DEFAULT_NDK_API_LEVEL_${ANDROID_ARCH_NAME}} )
 foreach( __level ${ANDROID_SUPPORTED_NATIVE_API_LEVELS} )
- if( NOT __level GREATER ANDROID_NATIVE_API_LEVEL AND NOT __level LESS __real_api_level )
+ if( (__level LESS ANDROID_NATIVE_API_LEVEL OR __level STREQUAL ANDROID_NATIVE_API_LEVEL) AND NOT __level LESS __real_api_level )
   set( __real_api_level ${__level} )
  endif()
 endforeach()
-if( __real_api_level AND NOT ANDROID_NATIVE_API_LEVEL EQUAL __real_api_level )
+if( __real_api_level AND NOT ANDROID_NATIVE_API_LEVEL STREQUAL __real_api_level )
  message( STATUS "Adjusting Android API level 'android-${ANDROID_NATIVE_API_LEVEL}' to 'android-${__real_api_level}'")
  set( ANDROID_NATIVE_API_LEVEL ${__real_api_level} )
 endif()
@@ -876,12 +801,13 @@
 else()
  if( BUILD_WITH_ANDROID_NDK )
   __DETECT_NATIVE_API_LEVEL( __realApiLevel "${ANDROID_NDK}/platforms/android-${ANDROID_NATIVE_API_LEVEL}/arch-${ANDROID_ARCH_NAME}/usr/include/android/api-level.h" )
-  if( NOT __realApiLevel EQUAL ANDROID_NATIVE_API_LEVEL )
+  if( NOT __realApiLevel EQUAL ANDROID_NATIVE_API_LEVEL AND NOT __realApiLevel GREATER 9000 )
    message( SEND_ERROR "Specified Android API level (${ANDROID_NATIVE_API_LEVEL}) does not match to the level found (${__realApiLevel}). Probably your copy of NDK is broken." )
   endif()
   unset( __realApiLevel )
  endif()
  set( ANDROID_NATIVE_API_LEVEL "${ANDROID_NATIVE_API_LEVEL}" CACHE STRING "Android API level for native code" FORCE )
+ set( CMAKE_ANDROID_API ${ANDROID_NATIVE_API_LEVEL} )
  if( CMAKE_VERSION VERSION_GREATER "2.8" )
   list( SORT ANDROID_SUPPORTED_NATIVE_API_LEVELS )
   set_property( CACHE ANDROID_NATIVE_API_LEVEL PROPERTY STRINGS ${ANDROID_SUPPORTED_NATIVE_API_LEVELS} )
@@ -893,23 +819,14 @@
 # remember target ABI
 set( ANDROID_ABI "${ANDROID_ABI}" CACHE STRING "The target ABI for Android. If arm, then armeabi-v7a is recommended for hardware floating point." FORCE )
 if( CMAKE_VERSION VERSION_GREATER "2.8" )
- list( SORT ANDROID_SUPPORTED_ABIS_${ANDROID_ARCH_FULLNAME} )
- set_property( CACHE ANDROID_ABI PROPERTY STRINGS ${ANDROID_SUPPORTED_ABIS_${ANDROID_ARCH_FULLNAME}} )
+ list( SORT ANDROID_SUPPORTED_ABIS_${ANDROID_ARCH_NAME} )
+ set_property( CACHE ANDROID_ABI PROPERTY STRINGS ${ANDROID_SUPPORTED_ABIS_${ANDROID_ARCH_NAME}} )
 endif()

 # runtime choice (STL, rtti, exceptions)
 if( NOT ANDROID_STL )
- # honor legacy ANDROID_USE_STLPORT
- if( DEFINED ANDROID_USE_STLPORT )
-  if( ANDROID_USE_STLPORT )
-   set( ANDROID_STL stlport_static )
-  endif()
-  message( WARNING "You are using an obsolete variable ANDROID_USE_STLPORT to select the STL variant. Use -DANDROID_STL=stlport_static instead." )
- endif()
- if( NOT ANDROID_STL )
   set( ANDROID_STL gnustl_static )
- endif()
 endif()
 set( ANDROID_STL "${ANDROID_STL}" CACHE STRING "C++ runtime" )
 set( ANDROID_STL_FORCE_FEATURES ON CACHE BOOL "automatically configure rtti and exceptions support based on C++ runtime" )
@@ -1036,7 +953,7 @@
  string( REGEX MATCH "[0-9]+[.][0-9]+" ANDROID_CLANG_VERSION "${ANDROID_CLANG_VERSION}")
 elseif( "${ANDROID_TOOLCHAIN_NAME}" MATCHES "-clang3[.][0-9]?$" )
  string( REGEX MATCH "3[.][0-9]$" ANDROID_CLANG_VERSION "${ANDROID_TOOLCHAIN_NAME}")
- string( REGEX REPLACE "-clang${ANDROID_CLANG_VERSION}$" "-4.6" ANDROID_GCC_TOOLCHAIN_NAME "${ANDROID_TOOLCHAIN_NAME}" )
+ string( REGEX REPLACE "-clang${ANDROID_CLANG_VERSION}$" "-${ANDROID_COMPILER_VERSION}" ANDROID_GCC_TOOLCHAIN_NAME "${ANDROID_TOOLCHAIN_NAME}" )
  if( NOT EXISTS "${ANDROID_NDK_TOOLCHAINS_PATH}/llvm-${ANDROID_CLANG_VERSION}${ANDROID_NDK_TOOLCHAINS_SUBPATH}/bin/clang${TOOL_OS_SUFFIX}" )
   message( FATAL_ERROR "Could not find the Clang compiler driver" )
  endif()
@@ -1069,7 +986,7 @@
   set( ANDROID_EXCEPTIONS       ON )
   set( ANDROID_STL_INCLUDE_DIRS "${ANDROID_NDK}/sources/cxx-stl/system/include" )
  elseif( ANDROID_STL MATCHES "gabi" )
-  if( ANDROID_NDK_RELEASE STRLESS "r7" )
+  if( ANDROID_NDK_RELEASE_NUM LESS 7000 ) # before r7
    message( FATAL_ERROR "gabi++ is not awailable in your NDK. You have to upgrade to NDK r7 or newer to use gabi++.")
   endif()
   set( ANDROID_RTTI             ON )
@@ -1077,12 +994,12 @@
   set( ANDROID_STL_INCLUDE_DIRS "${ANDROID_NDK}/sources/cxx-stl/gabi++/include" )
   set( __libstl                 "${ANDROID_NDK}/sources/cxx-stl/gabi++/libs/${ANDROID_NDK_ABI_NAME}/libgabi++_static.a" )
  elseif( ANDROID_STL MATCHES "stlport" )
-  if( NOT ANDROID_NDK_RELEASE STRLESS "r8d" )
+  if( NOT ANDROID_NDK_RELEASE_NUM LESS 8004 ) # before r8d
    set( ANDROID_EXCEPTIONS       ON )
   else()
    set( ANDROID_EXCEPTIONS       OFF )
   endif()
-  if( ANDROID_NDK_RELEASE STRLESS "r7" )
+  if( ANDROID_NDK_RELEASE_NUM LESS 7000 ) # before r7
    set( ANDROID_RTTI            OFF )
   else()
    set( ANDROID_RTTI            ON )
@@ -1103,7 +1020,7 @@
   else()
    set( __libstl                "${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++" )
   endif()
-  set( ANDROID_STL_INCLUDE_DIRS "${__libstl}/include" "${__libstl}/libs/${ANDROID_NDK_ABI_NAME}/include" )
+  set( ANDROID_STL_INCLUDE_DIRS "${__libstl}/include" "${__libstl}/libs/${ANDROID_NDK_ABI_NAME}/include" "${__libstl}/include/backward" )
   if( EXISTS "${__libstl}/libs/${ANDROID_NDK_ABI_NAME}/libgnustl_static.a" )
    set( __libstl                "${__libstl}/libs/${ANDROID_NDK_ABI_NAME}/libgnustl_static.a" )
   else()
@@ -1205,10 +1122,14 @@
 include( CMakeForceCompiler )
 CMAKE_FORCE_C_COMPILER( "${CMAKE_C_COMPILER}" GNU )
 if( ANDROID_COMPILER_IS_CLANG )
- set( CMAKE_C_COMPILER_ID Clang)
+ set( CMAKE_C_COMPILER_ID Clang )
 endif()
 set( CMAKE_C_PLATFORM_ID Linux )
-set( CMAKE_C_SIZEOF_DATA_PTR 4 )
+if( X86_64 OR MIPS64 OR ARM64_V8A )
+ set( CMAKE_C_SIZEOF_DATA_PTR 8 )
+else()
+ set( CMAKE_C_SIZEOF_DATA_PTR 4 )
+endif()
 set( CMAKE_C_HAS_ISYSROOT 1 )
 set( CMAKE_C_COMPILER_ABI ELF )
 CMAKE_FORCE_CXX_COMPILER( "${CMAKE_CXX_COMPILER}" GNU )
@@ -1216,7 +1137,7 @@
  set( CMAKE_CXX_COMPILER_ID Clang)
 endif()
 set( CMAKE_CXX_PLATFORM_ID Linux )
-set( CMAKE_CXX_SIZEOF_DATA_PTR 4 )
+set( CMAKE_CXX_SIZEOF_DATA_PTR ${CMAKE_C_SIZEOF_DATA_PTR} )
 set( CMAKE_CXX_HAS_ISYSROOT 1 )
 set( CMAKE_CXX_COMPILER_ABI ELF )
 set( CMAKE_CXX_SOURCE_FILE_EXTENSIONS cc cp cxx cpp CPP c++ C )
@@ -1227,6 +1148,14 @@
 set( CMAKE_ASM_COMPILER_FORCED TRUE )
 set( CMAKE_COMPILER_IS_GNUASM 1)
 set( CMAKE_ASM_SOURCE_FILE_EXTENSIONS s S asm )
+
+foreach( lang C CXX ASM )
+ if( ANDROID_COMPILER_IS_CLANG )
+  set( CMAKE_${lang}_COMPILER_VERSION ${ANDROID_CLANG_VERSION} )
+ else()
+  set( CMAKE_${lang}_COMPILER_VERSION ${ANDROID_COMPILER_VERSION} )
+ endif()
+endforeach()

 # flags and definitions
 remove_definitions( -DANDROID )
@@ -1257,8 +1186,15 @@
 endif()

 # NDK flags
-if( ARMEABI OR ARMEABI_V7A )
- set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -fpic -funwind-tables" )
+if (ARM64_V8A )
+ set( ANDROID_CXX_FLAGS         "${ANDROID_CXX_FLAGS} -funwind-tables" )
+ set( ANDROID_CXX_FLAGS_RELEASE "-fomit-frame-pointer -fstrict-aliasing" )
+ set( ANDROID_CXX_FLAGS_DEBUG   "-fno-omit-frame-pointer -fno-strict-aliasing" )
+ if( NOT ANDROID_COMPILER_IS_CLANG )
+  set( ANDROID_CXX_FLAGS_RELEASE "${ANDROID_CXX_FLAGS_RELEASE} -funswitch-loops -finline-limit=300" )
+ endif()
+elseif( ARMEABI OR ARMEABI_V7A)
+ set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -funwind-tables" )
  if( NOT ANDROID_FORCE_ARM_BUILD AND NOT ARMEABI_V6 )
   set( ANDROID_CXX_FLAGS_RELEASE "-mthumb -fomit-frame-pointer -fno-strict-aliasing" )
   set( ANDROID_CXX_FLAGS_DEBUG   "-marm -fno-omit-frame-pointer -fno-strict-aliasing" )
@@ -1273,17 +1209,15 @@
    set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -funswitch-loops -finline-limit=300" )
   endif()
  endif()
-elseif( X86 )
+elseif( X86 OR X86_64 )
  set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -funwind-tables" )
  if( NOT ANDROID_COMPILER_IS_CLANG )
   set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -funswitch-loops -finline-limit=300" )
- else()
-  set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -fPIC" )
  endif()
  set( ANDROID_CXX_FLAGS_RELEASE "-fomit-frame-pointer -fstrict-aliasing" )
  set( ANDROID_CXX_FLAGS_DEBUG   "-fno-omit-frame-pointer -fno-strict-aliasing" )
-elseif( MIPS )
- set( ANDROID_CXX_FLAGS         "${ANDROID_CXX_FLAGS} -fpic -fno-strict-aliasing -finline-functions -ffunction-sections -funwind-tables -fmessage-length=0" )
+elseif( MIPS OR MIPS64 )
+ set( ANDROID_CXX_FLAGS         "${ANDROID_CXX_FLAGS} -fno-strict-aliasing -finline-functions -funwind-tables -fmessage-length=0" )
  set( ANDROID_CXX_FLAGS_RELEASE "-fomit-frame-pointer" )
  set( ANDROID_CXX_FLAGS_DEBUG   "-fno-omit-frame-pointer" )
  if( NOT ANDROID_COMPILER_IS_CLANG )
@@ -1361,14 +1295,14 @@
 endif()

 # variables controlling optional build flags
-if (ANDROID_NDK_RELEASE STRLESS "r7")
+if( ANDROID_NDK_RELEASE_NUM LESS 7000 ) # before r7
  # libGLESv2.so in NDK's prior to r7 refers to missing external symbols.
  # So this flag option is required for all projects using OpenGL from native.
  __INIT_VARIABLE( ANDROID_SO_UNDEFINED                      VALUES ON )
 else()
  __INIT_VARIABLE( ANDROID_SO_UNDEFINED                      VALUES OFF )
 endif()
-__INIT_VARIABLE( ANDROID_NO_UNDEFINED OBSOLETE_NO_UNDEFINED VALUES ON )
+__INIT_VARIABLE( ANDROID_NO_UNDEFINED                       VALUES ON )
 __INIT_VARIABLE( ANDROID_FUNCTION_LEVEL_LINKING             VALUES ON )
 __INIT_VARIABLE( ANDROID_GOLD_LINKER                        VALUES ON )
 __INIT_VARIABLE( ANDROID_NOEXECSTACK                        VALUES ON )
@@ -1376,8 +1310,8 @@

 set( ANDROID_NO_UNDEFINED           ${ANDROID_NO_UNDEFINED}           CACHE BOOL "Show all undefined symbols as linker errors" )
 set( ANDROID_SO_UNDEFINED           ${ANDROID_SO_UNDEFINED}           CACHE BOOL "Allows or disallows undefined symbols in shared libraries" )
-set( ANDROID_FUNCTION_LEVEL_LINKING ${ANDROID_FUNCTION_LEVEL_LINKING} CACHE BOOL "Allows or disallows undefined symbols in shared libraries" )
-set( ANDROID_GOLD_LINKER            ${ANDROID_GOLD_LINKER}            CACHE BOOL "Enables gold linker (only avaialble for NDK r8b for ARM and x86 architectures on linux-86 and darwin-x86 hosts)" )
+set( ANDROID_FUNCTION_LEVEL_LINKING ${ANDROID_FUNCTION_LEVEL_LINKING} CACHE BOOL "Put each function in separate section and enable garbage collection of unused input sections at link time" )
+set( ANDROID_GOLD_LINKER            ${ANDROID_GOLD_LINKER}            CACHE BOOL "Enables gold linker" )
 set( ANDROID_NOEXECSTACK            ${ANDROID_NOEXECSTACK}            CACHE BOOL "Allows or disallows undefined symbols in shared libraries" )
 set( ANDROID_RELRO                  ${ANDROID_RELRO}                  CACHE BOOL "Enables RELRO - a memory corruption mitigation technique" )
 mark_as_advanced( ANDROID_NO_UNDEFINED ANDROID_SO_UNDEFINED ANDROID_FUNCTION_LEVEL_LINKING ANDROID_GOLD_LINKER ANDROID_NOEXECSTACK ANDROID_RELRO )
@@ -1412,9 +1346,9 @@
 endif()

 if( ANDROID_COMPILER_VERSION VERSION_EQUAL "4.6" )
- if( ANDROID_GOLD_LINKER AND (CMAKE_HOST_UNIX OR ANDROID_NDK_RELEASE STRGREATER "r8b") AND (ARMEABI OR ARMEABI_V7A OR X86) )
+ if( ANDROID_GOLD_LINKER AND (CMAKE_HOST_UNIX OR ANDROID_NDK_RELEASE_NUM GREATER 8002) AND (ARMEABI OR ARMEABI_V7A OR X86) )
   set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -fuse-ld=gold" )
- elseif( ANDROID_NDK_RELEASE STRGREATER "r8b")
+ elseif( ANDROID_NDK_RELEASE_NUM GREATER 8002 ) # after r8b
   set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -fuse-ld=bfd" )
  elseif( ANDROID_NDK_RELEASE STREQUAL "r8b" AND ARMEABI AND NOT _CMAKE_IN_TRY_COMPILE )
   message( WARNING "The default bfd linker from arm GCC 4.6 toolchain can fail with 'unresolvable R_ARM_THM_CALL relocation' error message. See https://code.google.com/p/android/issues/detail?id=35342
@@ -1438,13 +1372,7 @@
 endif()

 if( ANDROID_COMPILER_IS_CLANG )
- set( ANDROID_CXX_FLAGS "-Qunused-arguments ${ANDROID_CXX_FLAGS}" )
- if( ARMEABI_V7A AND NOT ANDROID_FORCE_ARM_BUILD )
-  set( ANDROID_CXX_FLAGS_RELEASE "-target thumbv7-none-linux-androideabi ${ANDROID_CXX_FLAGS_RELEASE}" )
-  set( ANDROID_CXX_FLAGS_DEBUG   "-target ${ANDROID_LLVM_TRIPLE} ${ANDROID_CXX_FLAGS_DEBUG}" )
- else()
-  set( ANDROID_CXX_FLAGS "-target ${ANDROID_LLVM_TRIPLE} ${ANDROID_CXX_FLAGS}" )
- endif()
+ set( ANDROID_CXX_FLAGS "-target ${ANDROID_LLVM_TRIPLE} -Qunused-arguments ${ANDROID_CXX_FLAGS}" )
  if( BUILD_WITH_ANDROID_NDK )
   set( ANDROID_CXX_FLAGS "-gcc-toolchain ${ANDROID_TOOLCHAIN_ROOT} ${ANDROID_CXX_FLAGS}" )
  endif()
@@ -1482,6 +1410,16 @@
  set( CMAKE_SHARED_LINKER_FLAGS "-Wl,-T,${ANDROID_NDK_TOOLCHAINS_PATH}/${ANDROID_GCC_TOOLCHAIN_NAME}/mipself.xsc ${CMAKE_SHARED_LINKER_FLAGS}" )
  set( CMAKE_MODULE_LINKER_FLAGS "-Wl,-T,${ANDROID_NDK_TOOLCHAINS_PATH}/${ANDROID_GCC_TOOLCHAIN_NAME}/mipself.xsc ${CMAKE_MODULE_LINKER_FLAGS}" )
  set( CMAKE_EXE_LINKER_FLAGS    "-Wl,-T,${ANDROID_NDK_TOOLCHAINS_PATH}/${ANDROID_GCC_TOOLCHAIN_NAME}/mipself.x ${CMAKE_EXE_LINKER_FLAGS}" )
+endif()
+
+# pie/pic
+if( NOT (ANDROID_NATIVE_API_LEVEL LESS 16) AND (NOT DEFINED ANDROID_APP_PIE OR ANDROID_APP_PIE) AND (CMAKE_VERSION VERSION_GREATER 2.8.8) )
+ set( CMAKE_POSITION_INDEPENDENT_CODE TRUE )
+ set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fPIE -pie")
+else()
+ set( CMAKE_POSITION_INDEPENDENT_CODE FALSE )
+ set( CMAKE_CXX_FLAGS "-fpic ${CMAKE_CXX_FLAGS}" )
+ set( CMAKE_C_FLAGS   "-fpic ${CMAKE_C_FLAGS}" )
 endif()

 # configure rtti
@@ -1547,27 +1485,31 @@
 endif()

 # setup output directories
-set( LIBRARY_OUTPUT_PATH_ROOT ${CMAKE_SOURCE_DIR} CACHE PATH "root for library output, set this to change where android libs are installed to" )
 set( CMAKE_INSTALL_PREFIX "${ANDROID_TOOLCHAIN_ROOT}/user" CACHE STRING "path for installing" )

-if(NOT _CMAKE_IN_TRY_COMPILE)
- if( EXISTS "${CMAKE_SOURCE_DIR}/jni/CMakeLists.txt" )
-  set( EXECUTABLE_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/bin/${ANDROID_NDK_ABI_NAME}" CACHE PATH "Output directory for applications" )
- else()
-  set( EXECUTABLE_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/bin" CACHE PATH "Output directory for applications" )
- endif()
- set( LIBRARY_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/libs/${ANDROID_NDK_ABI_NAME}" CACHE PATH "path for android libs" )
+if( DEFINED LIBRARY_OUTPUT_PATH_ROOT
+      OR EXISTS "${CMAKE_SOURCE_DIR}/AndroidManifest.xml"
+      OR (EXISTS "${CMAKE_SOURCE_DIR}/../AndroidManifest.xml" AND EXISTS "${CMAKE_SOURCE_DIR}/../jni/") )
+  set( LIBRARY_OUTPUT_PATH_ROOT ${CMAKE_SOURCE_DIR} CACHE PATH "Root for binaries output, set this to change where Android libs are installed to" )
+  if( NOT _CMAKE_IN_TRY_COMPILE )
+    if( EXISTS "${CMAKE_SOURCE_DIR}/jni/CMakeLists.txt" )
+      set( EXECUTABLE_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/bin/${ANDROID_NDK_ABI_NAME}" CACHE PATH "Output directory for applications" )
+    else()
+      set( EXECUTABLE_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/bin" CACHE PATH "Output directory for applications" )
+    endif()
+    set( LIBRARY_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/libs/${ANDROID_NDK_ABI_NAME}" CACHE PATH "Output directory for Android libs" )
+  endif()
 endif()

 # copy shaed stl library to build directory
-if( NOT _CMAKE_IN_TRY_COMPILE AND __libstl MATCHES "[.]so$" )
- get_filename_component( __libstlname "${__libstl}" NAME )
- execute_process( COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${__libstl}" "${LIBRARY_OUTPUT_PATH}/${__libstlname}" RESULT_VARIABLE __fileCopyProcess )
- if( NOT __fileCopyProcess EQUAL 0 OR NOT EXISTS "${LIBRARY_OUTPUT_PATH}/${__libstlname}")
-  message( SEND_ERROR "Failed copying of ${__libstl} to the ${LIBRARY_OUTPUT_PATH}/${__libstlname}" )
- endif()
- unset( __fileCopyProcess )
- unset( __libstlname )
+if( NOT _CMAKE_IN_TRY_COMPILE AND __libstl MATCHES "[.]so$" AND DEFINED LIBRARY_OUTPUT_PATH )
+  get_filename_component( __libstlname "${__libstl}" NAME )
+  execute_process( COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${__libstl}" "${LIBRARY_OUTPUT_PATH}/${__libstlname}" RESULT_VARIABLE __fileCopyProcess )
+  if( NOT __fileCopyProcess EQUAL 0 OR NOT EXISTS "${LIBRARY_OUTPUT_PATH}/${__libstlname}")
+    message( SEND_ERROR "Failed copying of ${__libstl} to the ${LIBRARY_OUTPUT_PATH}/${__libstlname}" )
+  endif()
+  unset( __fileCopyProcess )
+  unset( __libstlname )
 endif()

@@ -1628,25 +1570,10 @@
 endmacro()

-macro( ANDROID_GET_ABI_RAWNAME TOOLCHAIN_FLAG VAR )
- if( "${TOOLCHAIN_FLAG}" STREQUAL "ARMEABI" )
-  set( ${VAR} "armeabi" )
- elseif( "${TOOLCHAIN_FLAG}" STREQUAL "ARMEABI_V7A" )
-  set( ${VAR} "armeabi-v7a" )
- elseif( "${TOOLCHAIN_FLAG}" STREQUAL "X86" )
-  set( ${VAR} "x86" )
- elseif( "${TOOLCHAIN_FLAG}" STREQUAL "MIPS" )
-  set( ${VAR} "mips" )
- else()
-  set( ${VAR} "unknown" )
- endif()
-endmacro()
-
-
 # export toolchain settings for the try_compile() command
-if( NOT PROJECT_NAME STREQUAL "CMAKE_TRY_COMPILE" )
+if( NOT _CMAKE_IN_TRY_COMPILE )
  set( __toolchain_config "")
- foreach( __var NDK_CCACHE  LIBRARY_OUTPUT_PATH_ROOT  ANDROID_FORBID_SYGWIN  ANDROID_SET_OBSOLETE_VARIABLES
+ foreach( __var NDK_CCACHE  LIBRARY_OUTPUT_PATH_ROOT  ANDROID_FORBID_SYGWIN
                 ANDROID_NDK_HOST_X64
                 ANDROID_NDK
                 ANDROID_NDK_LAYOUT
@@ -1665,9 +1592,10 @@
                 ANDROID_RELRO
                 ANDROID_LIBM_PATH
                 ANDROID_EXPLICIT_CRT_LINK
+                ANDROID_APP_PIE
                 )
   if( DEFINED ${__var} )
-   if( "${__var}" MATCHES " ")
+   if( ${__var} MATCHES " ")
     set( __toolchain_config "${__toolchain_config}set( ${__var} \"${${__var}}\" CACHE INTERNAL \"\" )\n" )
    else()
     set( __toolchain_config "${__toolchain_config}set( ${__var} ${${__var}} CACHE INTERNAL \"\" )\n" )
@@ -1692,19 +1620,9 @@
 endif()

-# set some obsolete variables for backward compatibility
-set( ANDROID_SET_OBSOLETE_VARIABLES ON CACHE BOOL "Define obsolete Andrid-specific cmake variables" )
-mark_as_advanced( ANDROID_SET_OBSOLETE_VARIABLES )
-if( ANDROID_SET_OBSOLETE_VARIABLES )
- set( ANDROID_API_LEVEL ${ANDROID_NATIVE_API_LEVEL} )
- set( ARM_TARGET "${ANDROID_ABI}" )
- set( ARMEABI_NDK_NAME "${ANDROID_NDK_ABI_NAME}" )
-endif()
-
-
 # Variables controlling behavior or set by cmake toolchain:
-#   ANDROID_ABI : "armeabi-v7a" (default), "armeabi", "armeabi-v7a with NEON", "armeabi-v7a with VFPV3", "armeabi-v6 with VFP", "x86", "mips"
-#   ANDROID_NATIVE_API_LEVEL : 3,4,5,8,9,14 (depends on NDK version)
+#   ANDROID_ABI : "armeabi-v7a" (default), "armeabi", "armeabi-v7a with NEON", "armeabi-v7a with VFPV3", "armeabi-v6 with VFP", "x86", "mips", "arm64-v8a", "x86_64", "mips64"
+#   ANDROID_NATIVE_API_LEVEL : 3,4,5,8,9,14,15,16,17,18,19,21 (depends on NDK version)
 #   ANDROID_STL : gnustl_static/gnustl_shared/stlport_static/stlport_shared/gabi++_static/gabi++_shared/system_re/system/none
 #   ANDROID_FORBID_SYGWIN : ON/OFF
 #   ANDROID_NO_UNDEFINED : ON/OFF
@@ -1715,47 +1633,42 @@
 #   ANDROID_RELRO : ON/OFF
 #   ANDROID_FORCE_ARM_BUILD : ON/OFF
 #   ANDROID_STL_FORCE_FEATURES : ON/OFF
-#   ANDROID_SET_OBSOLETE_VARIABLES : ON/OFF
+#   ANDROID_LIBM_PATH : path to libm.so (set to something like $(TOP)/out/target/product/<product_name>/obj/lib/libm.so) to workaround unresolved `sincos`
 # Can be set only at the first run:
-#   ANDROID_NDK
-#   ANDROID_STANDALONE_TOOLCHAIN
+#   ANDROID_NDK : path to your NDK install
+#   NDK_CCACHE : path to your ccache executable
 #   ANDROID_TOOLCHAIN_NAME : the NDK name of compiler toolchain
 #   ANDROID_NDK_HOST_X64 : try to use x86_64 toolchain (default for x64 host systems)
 #   ANDROID_NDK_LAYOUT : the inner NDK structure (RELEASE, LINARO, ANDROID)
 #   LIBRARY_OUTPUT_PATH_ROOT : <any valid path>
-#   NDK_CCACHE : <path to your ccache executable>
-# Obsolete:
-#   ANDROID_API_LEVEL : superseded by ANDROID_NATIVE_API_LEVEL
-#   ARM_TARGET : superseded by ANDROID_ABI
-#   ARM_TARGETS : superseded by ANDROID_ABI (can be set only)
-#   ANDROID_NDK_TOOLCHAIN_ROOT : superseded by ANDROID_STANDALONE_TOOLCHAIN (can be set only)
-#   ANDROID_USE_STLPORT : superseded by ANDROID_STL=stlport_static
-#   ANDROID_LEVEL : superseded by ANDROID_NATIVE_API_LEVEL (completely removed)
+#   ANDROID_STANDALONE_TOOLCHAIN
 #
 # Primary read-only variables:
 #   ANDROID : always TRUE
 #   ARMEABI : TRUE for arm v6 and older devices
 #   ARMEABI_V6 : TRUE for arm v6
 #   ARMEABI_V7A : TRUE for arm v7a
+#   ARM64_V8A : TRUE for arm64-v8a
 #   NEON : TRUE if NEON unit is enabled
 #   VFPV3 : TRUE if VFP version 3 is enabled
 #   X86 : TRUE if configured for x86
+#   X86_64 : TRUE if configured for x86_64
 #   MIPS : TRUE if configured for mips
-#   BUILD_ANDROID : always TRUE
+#   MIPS64 : TRUE if configured for mips64
 #   BUILD_WITH_ANDROID_NDK : TRUE if NDK is used
 #   BUILD_WITH_STANDALONE_TOOLCHAIN : TRUE if standalone toolchain is used
 #   ANDROID_NDK_HOST_SYSTEM_NAME : "windows", "linux-x86" or "darwin-x86" depending on host platform
-#   ANDROID_NDK_ABI_NAME : "armeabi", "armeabi-v7a", "x86" or "mips" depending on ANDROID_ABI
-#   ANDROID_NDK_RELEASE : one of r5, r5b, r5c, r6, r6b, r7, r7b, r7c, r8, r8b, r8c, r8d, r8e, r9, r9b, r9c, r9d; set only for NDK
-#   ANDROID_ARCH_NAME : "arm" or "x86" or "mips" depending on ANDROID_ABI
+#   ANDROID_NDK_ABI_NAME : "armeabi", "armeabi-v7a", "x86", "mips", "arm64-v8a", "x86_64", "mips64" depending on ANDROID_ABI
+#   ANDROID_NDK_RELEASE : from r5 to r10d; set only for NDK
+#   ANDROID_NDK_RELEASE_NUM : numeric ANDROID_NDK_RELEASE version (1000*major+minor)
+#   ANDROID_ARCH_NAME : "arm", "x86", "mips", "arm64", "x86_64", "mips64" depending on ANDROID_ABI
 #   ANDROID_SYSROOT : path to the compiler sysroot
 #   TOOL_OS_SUFFIX : "" or ".exe" depending on host platform
 #   ANDROID_COMPILER_IS_CLANG : TRUE if clang compiler is used
-# Obsolete:
-#   ARMEABI_NDK_NAME : superseded by ANDROID_NDK_ABI_NAME
 #
 # Secondary (less stable) read-only variables:
-#   ANDROID_COMPILER_VERSION : GCC version used
+#   ANDROID_COMPILER_VERSION : GCC version used (not Clang version)
+#   ANDROID_CLANG_VERSION : version of clang compiler if clang is used
 #   ANDROID_CXX_FLAGS : C/C++ compiler flags required by Android platform
 #   ANDROID_SUPPORTED_ABIS : list of currently allowed values for ANDROID_ABI
 #   ANDROID_TOOLCHAIN_MACHINE_NAME : "arm-linux-androideabi", "arm-eabi" or "i686-android-linux"
@@ -1766,13 +1679,10 @@
 #   ANDROID_RTTI : if rtti is enabled by the runtime
 #   ANDROID_EXCEPTIONS : if exceptions are enabled by the runtime
 #   ANDROID_GCC_TOOLCHAIN_NAME : read-only, differs from ANDROID_TOOLCHAIN_NAME only if clang is used
-#   ANDROID_CLANG_VERSION : version of clang compiler if clang is used
-#   ANDROID_LIBM_PATH : path to libm.so (set to something like $(TOP)/out/target/product/<product_name>/obj/lib/libm.so) to workaround unresolved `sincos`
 #
 # Defaults:
 #   ANDROID_DEFAULT_NDK_API_LEVEL
 #   ANDROID_DEFAULT_NDK_API_LEVEL_${ARCH}
 #   ANDROID_NDK_SEARCH_PATHS
-#   ANDROID_STANDALONE_TOOLCHAIN_SEARCH_PATH
 #   ANDROID_SUPPORTED_ABIS_${ARCH}
 #   ANDROID_SUPPORTED_NDK_VERSIONS


Specify -Wno-old-style-cast only for C++.

--- cmake/Modules/CppUTestWarningFlags.cmake
+++ cmake/Modules/CppUTestWarningFlags.cmake
@@ -34,7 +34,6 @@
         Wsign-conversion
         Wno-padded
         Wno-disabled-macro-expansion
-        Wno-old-style-cast
         )

     if (NOT GMOCK AND NOT REAL_GTEST)
@@ -51,6 +50,7 @@
         Wno-global-constructors
         Wno-exit-time-destructors
         Wno-weak-vtables
+        Wno-old-style-cast
         )

     check_and_append_c_warning_flags(${WARNING_C_FLAGS})


Fix the MSVC version check.

Fix the MSVC version check.

I'm not sure what determines the minor version, but it appears
that it's possible for a fully updated, release version of
VS2015 with Update 3 can go (at least) as low as 19.00.24213.1.
Updating the compiler version check to account for this so we
don't generate superfluous warnings.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@290914 91177308-0d34-0410-b5e6-96231b3b80d8

--- cmake/modules/CheckCompilerVersion.cmake
+++ cmake/modules/CheckCompilerVersion.cmake
@@ -43,8 +43,8 @@
     elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
       if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0)
         message(FATAL_ERROR "Host Visual Studio must be at least 2015")
-      elseif(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.00.24215.1)
-        message(WARNING "Host Visual Studio should at least be 2015 Update 3 (MSVC 19.00.24215.1)"
+      elseif(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.00.24213.1)
+        message(WARNING "Host Visual Studio should at least be 2015 Update 3 (MSVC 19.00.24213.1)"
           "  due to miscompiles from earlier versions")
       endif()
     endif()