Android toolchain: libstdc++ and libsupc are removed from explicit link libraries

# Please enter the commit message for your changes. Lines starting
# with '#' will be kept; you may remove them yourself if you want to.
# An empty message aborts the commit.
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
# Changes to be committed:
#   (use "git reset HEAD^1 <file>..." to unstage)
#
#	modified:   android/android.toolchain.cmake
#

--- android/android.toolchain.cmake
+++ android/android.toolchain.cmake
@@ -1,6 +1,6 @@
 # ------------------------------------------------------------------------------
 #  Android CMake toolchain file, for use with the Android NDK r5-r8
-#  Requires cmake 2.6.3 or newer (2.8.3 or newer is recommended).
+#  Requires cmake 2.6.3 or newer (2.8.5 or newer is recommended).
 #  See home page: http://code.google.com/p/android-cmake/
 #
 #  The file is mantained by the OpenCV project. And also can be found at
@@ -44,7 +44,8 @@
 #    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 values are:
+#
+#      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.
@@ -55,7 +56,9 @@
 #            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.
+#            See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation.
+#        "mips" - matches to the NDK ABI with the same name
+#            (not testes on real devices)
 #
 #    ANDROID_NATIVE_API_LEVEL=android-8 - level of Android API compile for.
 #      Option is read-only when standalone toolchain used.
@@ -183,12 +186,13 @@
 #   - modified August 2012
 #     [+] updated for NDK r8b
 #     [~] all intermediate files generated by toolchain are moved into CMakeFiles
+#     [~] libstdc++ and libsupc are removed from explicit link libraries
 # ------------------------------------------------------------------------------

 cmake_minimum_required( VERSION 2.6.3 )

 if( DEFINED CMAKE_CROSSCOMPILING )
- #subsequent toolchain loading is not really needed
+ # subsequent toolchain loading is not really needed
  return()
 endif()

@@ -199,7 +203,7 @@

 # this one is important
 set( CMAKE_SYSTEM_NAME Linux )
-#this one not so much
+# this one not so much
 set( CMAKE_SYSTEM_VERSION 1 )

 set( ANDROID_SUPPORTED_NDK_VERSIONS ${ANDROID_EXTRA_NDK_VERSIONS} -r8b -r8 -r7c -r7b -r7 -r6b -r6 -r5c -r5b -r5 "" )
@@ -331,11 +335,11 @@
 endmacro()

-#stl version: by default gnustl_static will be used
+# stl version: by default gnustl_static will be used
 set( ANDROID_USE_STLPORT FALSE CACHE BOOL "Experimental: use stlport_static instead of gnustl_static")
 mark_as_advanced( ANDROID_USE_STLPORT )

-#fight against cygwin
+# fight against cygwin
 set( ANDROID_FORBID_SYGWIN TRUE CACHE BOOL "Prevent cmake from working under cygwin and using cygwin tools")
 mark_as_advanced( ANDROID_FORBID_SYGWIN )
 if( ANDROID_FORBID_SYGWIN )
@@ -344,7 +348,7 @@
  endif()

  if( CMAKE_HOST_WIN32 )
-  #remove cygwin from PATH
+  # remove cygwin from PATH
   set( __new_path "$ENV{PATH}")
   __LIST_FILTER( __new_path "cygwin" )
   set(ENV{PATH} "${__new_path}")
@@ -352,7 +356,7 @@
  endif()
 endif()

-#detect current host platform
+# detect current host platform
 set( TOOL_OS_SUFFIX "" )
 if( CMAKE_HOST_APPLE )
  set( ANDROID_NDK_HOST_SYSTEM_NAME "darwin-x86" )
@@ -365,10 +369,10 @@
  message( FATAL_ERROR "Cross-compilation on your platform is not supported by this cmake toolchain" )
 endif()

-#see if we have path to Android NDK
+# see if we have path to Android NDK
 __INIT_VARIABLE( ANDROID_NDK PATH ENV_ANDROID_NDK )
 if( NOT ANDROID_NDK )
- #see if we have path to Android standalone toolchain
+ # 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 )

  if( NOT ANDROID_STANDALONE_TOOLCHAIN )
@@ -397,10 +401,10 @@
  endif( NOT ANDROID_STANDALONE_TOOLCHAIN )
 endif( NOT ANDROID_NDK )

-#remember found paths
+# remember found paths
 if( ANDROID_NDK )
  get_filename_component( ANDROID_NDK "${ANDROID_NDK}" ABSOLUTE )
- #try to detect change
+ # try to detect change
  if( CMAKE_AR )
   string( LENGTH "${ANDROID_NDK}" __length )
   string( SUBSTRING "${CMAKE_AR}" 0 ${__length} __androidNdkPreviousPath )
@@ -414,7 +418,7 @@
  set( BUILD_WITH_ANDROID_NDK True )
 elseif( ANDROID_STANDALONE_TOOLCHAIN )
  get_filename_component( ANDROID_STANDALONE_TOOLCHAIN "${ANDROID_STANDALONE_TOOLCHAIN}" ABSOLUTE )
- #try to detect change
+ # try to detect change
  if( CMAKE_AR )
   string( LENGTH "${ANDROID_STANDALONE_TOOLCHAIN}" __length )
   string( SUBSTRING "${CMAKE_AR}" 0 ${__length} __androidStandaloneToolchainPreviousPath )
@@ -438,7 +442,7 @@
       sudo ln -s ~/my-android-toolchain ${ANDROID_STANDALONE_TOOLCHAIN_SEARCH_PATH}" )
 endif()

-#get all the details about standalone toolchain
+# get all the details about standalone toolchain
 if( BUILD_WITH_STANDALONE_TOOLCHAIN )
  __DETECT_NATIVE_API_LEVEL( ANDROID_SUPPORTED_NATIVE_API_LEVELS "${ANDROID_STANDALONE_TOOLCHAIN}/sysroot/usr/include/android/api-level.h" )
  set( ANDROID_STANDALONE_TOOLCHAIN_API_LEVEL ${ANDROID_SUPPORTED_NATIVE_API_LEVELS} )
@@ -455,7 +459,7 @@
   set( __availableToolchainArchs "mipsel" )
  endif()
  if( ANDROID_COMPILER_VERSION )
-  #do not run gcc every time because it is relatevely expencive
+  # do not run gcc every time because it is relatevely expencive
   set( __availableToolchainCompilerVersions "${ANDROID_COMPILER_VERSION}" )
  else()
   execute_process( COMMAND "${ANDROID_STANDALONE_TOOLCHAIN}/bin/${__availableToolchainMachines}-gcc${TOOL_OS_SUFFIX}" --version
@@ -464,7 +468,7 @@
  endif()
 endif()

-#get all the details about NDK
+# get all the details about NDK
 if( BUILD_WITH_ANDROID_NDK )
  file( GLOB ANDROID_SUPPORTED_NATIVE_API_LEVELS RELATIVE "${ANDROID_NDK}/platforms" "${ANDROID_NDK}/platforms/android-*" )
  string( REPLACE "android-" "" ANDROID_SUPPORTED_NATIVE_API_LEVELS "${ANDROID_SUPPORTED_NATIVE_API_LEVELS}" )
@@ -490,7 +494,7 @@
  endif()
 endif()

-#build list of available ABIs
+# build list of available ABIs
 if( NOT ANDROID_SUPPORTED_ABIS )
  set( ANDROID_SUPPORTED_ABIS "" )
  set( __uniqToolchainArchNames ${__availableToolchainArchs} )
@@ -505,9 +509,9 @@
  endif()
 endif()

-#choose target ABI
+# choose target ABI
 __INIT_VARIABLE( ANDROID_ABI OBSOLETE_ARM_TARGET OBSOLETE_ARM_TARGETS VALUES ${ANDROID_SUPPORTED_ABIS} )
-#verify that target ABI is supported
+# verify that target ABI is supported
 list( FIND ANDROID_SUPPORTED_ABIS "${ANDROID_ABI}" __androidAbiIdx )
 if( __androidAbiIdx EQUAL -1 )
  string( REPLACE ";" "\", \"", PRINTABLE_ANDROID_SUPPORTED_ABIS  "${ANDROID_SUPPORTED_ABIS}" )
@@ -517,10 +521,10 @@
 endif()
 unset( __androidAbiIdx )

-#remember target ABI
+# 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 )

-#set target ABI options
+# set target ABI options
 if( ANDROID_ABI STREQUAL "x86" )
  set( X86 true )
  set( ANDROID_NDK_ABI_NAME "x86" )
@@ -545,7 +549,7 @@
  set( ANDROID_ARCH_NAME "arm" )
  set( ANDROID_ARCH_FULLNAME "arm" )
  set( CMAKE_SYSTEM_PROCESSOR "armv6" )
- #need always fallback to older platform
+ # need always fallback to older platform
  set( ARMEABI true )
 elseif( ANDROID_ABI STREQUAL "armeabi-v7a")
  set( ARMEABI_V7A true )
@@ -573,8 +577,8 @@
 endif()

 if( CMAKE_BINARY_DIR AND EXISTS "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeSystem.cmake" )
- #really dirty hack
- #it is not possible to change CMAKE_SYSTEM_PROCESSOR after the first run...
+ # really dirty hack
+ # it is not possible to change CMAKE_SYSTEM_PROCESSOR after the first run...
  file( APPEND "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeSystem.cmake" "SET(CMAKE_SYSTEM_PROCESSOR \"${CMAKE_SYSTEM_PROCESSOR}\")\n" )
 endif()

@@ -592,7 +596,7 @@
  unset( ANDROID_FORCE_ARM_BUILD CACHE )
 endif()

-#choose toolchain
+# choose toolchain
 if( ANDROID_TOOLCHAIN_NAME )
  list( FIND __availableToolchains "${ANDROID_TOOLCHAIN_NAME}" __toolchainIdx )
  if( __toolchainIdx EQUAL -1 )
@@ -637,10 +641,10 @@
 unset( __availableToolchainArchs )
 unset( __availableToolchainCompilerVersions )

-#choose native API level
+# 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}" )
-#validate
+# validate
 list( FIND ANDROID_SUPPORTED_NATIVE_API_LEVELS "${ANDROID_NATIVE_API_LEVEL}" __levelIdx )
 if( __levelIdx EQUAL -1 )
  message( SEND_ERROR "Specified Android native API level (${ANDROID_NATIVE_API_LEVEL}) is not supported by your NDK/toolchain." )
@@ -659,7 +663,7 @@
  set_property( CACHE ANDROID_NATIVE_API_LEVEL PROPERTY STRINGS ${ANDROID_SUPPORTED_NATIVE_API_LEVELS} )
 endif()

-#setup paths
+# setup paths
 if( BUILD_WITH_STANDALONE_TOOLCHAIN )
  set( ANDROID_TOOLCHAIN_ROOT "${ANDROID_STANDALONE_TOOLCHAIN}" )
  set( ANDROID_SYSROOT "${ANDROID_STANDALONE_TOOLCHAIN}/sysroot" )
@@ -689,7 +693,7 @@
 if( CMAKE_VERSION VERSION_LESS 2.8.5 )
  set( CMAKE_ASM_COMPILER_ARG1 "-c" )
 endif()
-#there may be a way to make cmake deduce these TODO deduce the rest of the tools
+# there may be a way to make cmake deduce these TODO deduce the rest of the tools
 set( CMAKE_STRIP        "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-strip${TOOL_OS_SUFFIX}"   CACHE PATH "strip" )
 set( CMAKE_AR           "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-ar${TOOL_OS_SUFFIX}"      CACHE PATH "archive" )
 set( CMAKE_LINKER       "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-ld${TOOL_OS_SUFFIX}"      CACHE PATH "linker" )
@@ -705,11 +709,12 @@
  endif()
  mark_as_advanced( CMAKE_INSTALL_NAME_TOOL )
 endif()
-#export directories
+
+# export directories
 set( ANDROID_SYSTEM_INCLUDE_DIRS "" )
 set( ANDROID_SYSTEM_LIB_DIRS "" )

-#setup output directories
+# 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" )

@@ -722,13 +727,13 @@
  set( LIBRARY_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/libs/${ANDROID_NDK_ABI_NAME}" CACHE PATH "path for android libs" )
 endif()

-#includes
+# includes
 list( APPEND ANDROID_SYSTEM_INCLUDE_DIRS "${ANDROID_SYSROOT}/usr/include" )
 if( __stlIncludePath AND EXISTS "${__stlIncludePath}" )
  list( APPEND ANDROID_SYSTEM_INCLUDE_DIRS "${__stlIncludePath}" )
 endif()

-#STL bits includes
+# c++ bits includes
 if( __stlLibPath AND EXISTS "${__stlLibPath}/include" )
  list( APPEND ANDROID_SYSTEM_INCLUDE_DIRS "${__stlLibPath}/include" )
 endif()
@@ -742,7 +747,7 @@
  list( APPEND ANDROID_SYSTEM_INCLUDE_DIRS "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/include/c++/${ANDROID_COMPILER_VERSION}/${ANDROID_TOOLCHAIN_MACHINE_NAME}" )
 endif()

-#flags and definitions
+# flags and definitions
 if(ANDROID_SYSROOT MATCHES "[ ;\"]")
  set( ANDROID_CXX_FLAGS "--sysroot=\"${ANDROID_SYSROOT}\"" )
  # quotes will break try_compile and compiler identification
@@ -766,7 +771,7 @@
 set( CMAKE_CXX_SIZEOF_DATA_PTR 4 )
 set( CMAKE_CXX_HAS_ISYSROOT 1 )
 set( CMAKE_CXX_COMPILER_ABI ELF )
-#force ASM compiler (required for CMake < 2.8.5)
+# force ASM compiler (required for CMake < 2.8.5)
 set( CMAKE_ASM_COMPILER_ID_RUN TRUE )
 set( CMAKE_ASM_COMPILER_ID GNU )
 set( CMAKE_ASM_COMPILER_WORKS TRUE )
@@ -796,17 +801,17 @@

 if( ANDROID_USE_STLPORT )
  set( _CMAKE_CXX_FLAGS "${_CMAKE_CXX_FLAGS} -fno-rtti -fno-exceptions" )
- set( _CMAKE_C_FLAGS "${_CMAKE_C_FLAGS} -fno-rtti -fno-exceptions" )
+ set( _CMAKE_C_FLAGS "${_CMAKE_C_FLAGS} -fno-exceptions" )
 else()
  set( _CMAKE_CXX_FLAGS "${_CMAKE_CXX_FLAGS} -frtti -fexceptions" )
  set( _CMAKE_C_FLAGS "${_CMAKE_C_FLAGS} -fexceptions" )
 endif()

-#release and debug flags
+# release and debug flags
 if( ARMEABI OR ARMEABI_V7A )
  if( NOT ANDROID_FORCE_ARM_BUILD AND NOT ARMEABI_V6 )
-  #It is recommended to use the -mthumb compiler flag to force the generation
-  #of 16-bit Thumb-1 instructions (the default being 32-bit ARM ones).
+  # It is recommended to use the -mthumb compiler flag to force the generation
+  # of 16-bit Thumb-1 instructions (the default being 32-bit ARM ones).
   # O3 instead of O2/Os in release mode - like cmake sets for desktop gcc
   set( _CMAKE_CXX_FLAGS_RELEASE "-mthumb -O3" )
   set( _CMAKE_C_FLAGS_RELEASE   "-mthumb -O3" )
@@ -836,7 +841,7 @@
 set( _CMAKE_CXX_FLAGS_DEBUG "${_CMAKE_CXX_FLAGS_DEBUG} -fno-strict-aliasing -fno-omit-frame-pointer -DDEBUG -D_DEBUG" )
 set( _CMAKE_C_FLAGS_DEBUG   "${_CMAKE_C_FLAGS_DEBUG}   -fno-strict-aliasing -fno-omit-frame-pointer -DDEBUG -D_DEBUG" )

-#ABI-specific flags
+# ABI-specific flags
 if( ARMEABI_V7A )
  set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -march=armv7-a -mfloat-abi=softfp" )
  if( NEON )
@@ -854,19 +859,18 @@
  set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS}" )#sse?
 endif()

-#linker flags
+# linker flags
 if( NOT DEFINED __ndklibspath )
  set( __ndklibspath "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/ndklibs/${ANDROID_NDK_ABI_NAME}" )
 endif()
-list( APPEND ANDROID_SYSTEM_LIB_DIRS "${__ndklibspath}" "${CMAKE_INSTALL_PREFIX}/libs/${ANDROID_NDK_ABI_NAME}" )
+list( APPEND ANDROID_SYSTEM_LIB_DIRS "${CMAKE_INSTALL_PREFIX}/libs/${ANDROID_NDK_ABI_NAME}" )
 set( ANDROID_LINKER_FLAGS "" )
-#STL
+
+# STL
 if( ANDROID_USE_STLPORT )
  if( EXISTS "${__stlLibPath}/libstlport_static.a" )
-  __COPY_IF_DIFFERENT( "${__stlLibPath}/libstlport_static.a" "${__ndklibspath}/libstlport_static.a" )
- endif()
- if( EXISTS "${__ndklibspath}/libstlport_static.a" )
-  set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -Wl,--start-group -lstlport_static" )
+  set( CMAKE_CXX_CREATE_SHARED_LIBRARY "<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES> \"${__stlLibPath}/libstlport_static.a\"")
+  set( CMAKE_CXX_CREATE_SHARED_MODULE  "<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES> \"${__stlLibPath}/libstlport_static.a\"")
  endif()
 else( ANDROID_USE_STLPORT )
  if( EXISTS "${__stlLibPath}/libgnustl_static.a" )
@@ -880,11 +884,6 @@
  elseif( EXISTS "${__stlLibPath}/libstdc++.a" )
   __COPY_IF_DIFFERENT( "${__stlLibPath}/libstdc++.a" "${__ndklibspath}/libstdc++.a" )
  endif()
- if( EXISTS "${__ndklibspath}/libstdc++.a" )
-  set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -lstdc++" )
- endif()
-
- #gcc exception & rtti support
  if( EXISTS "${__stlLibPath}/libsupc++.a" )
   __COPY_IF_DIFFERENT( "${__stlLibPath}/libsupc++.a" "${__ndklibspath}/libsupc++.a" )
  elseif( ANDROID_ARCH_NAME STREQUAL "arm" AND EXISTS "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/${CMAKE_SYSTEM_PROCESSOR}/thumb/libsupc++.a" )
@@ -896,16 +895,14 @@
  elseif( EXISTS "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/libsupc++.a" )
   __COPY_IF_DIFFERENT( "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/libsupc++.a" "${__ndklibspath}/libsupc++.a" )
  endif()
- if( EXISTS "${__ndklibspath}/libsupc++.a" )
-  set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -lsupc++" )
- endif()
+ list( APPEND ANDROID_SYSTEM_LIB_DIRS "${__ndklibspath}" )
 endif( ANDROID_USE_STLPORT )

-#cleanup for STL search
+# cleanup for STL search
 unset( __stlIncludePath )
 unset( __stlLibPath )

-#other linker flags
+# other linker flags
 __INIT_VARIABLE( ANDROID_NO_UNDEFINED OBSOLETE_NO_UNDEFINED VALUES ON )
 set( ANDROID_NO_UNDEFINED ${ANDROID_NO_UNDEFINED} CACHE BOOL "Show all undefined symbols as linker errors" FORCE )
 mark_as_advanced( ANDROID_NO_UNDEFINED )
@@ -914,7 +911,7 @@
 endif()

 if (ANDROID_NDK MATCHES "-r[56].?$")
- #libGLESv2.so in NDK's prior to r7 refers to exteranal symbols. So this flag option is required for all projects using OpenGL from native.
+ # libGLESv2.so in NDK's prior to r7 refers to exteranal 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 )
@@ -940,7 +937,7 @@
  set( ANDROID_LINKER_FLAGS "-Wl,--fix-cortex-a8 ${ANDROID_LINKER_FLAGS}" )
 endif()

-#cache flags
+# cache flags
 set( CMAKE_CXX_FLAGS "${_CMAKE_CXX_FLAGS}" CACHE STRING "c++ flags" )
 set( CMAKE_C_FLAGS "${_CMAKE_C_FLAGS}" CACHE STRING "c flags" )
 set( CMAKE_CXX_FLAGS_RELEASE "${_CMAKE_CXX_FLAGS_RELEASE}" CACHE STRING "c++ Release flags" )
@@ -954,7 +951,7 @@
 include_directories( SYSTEM ${ANDROID_SYSTEM_INCLUDE_DIRS} )
 link_directories( ${ANDROID_SYSTEM_LIB_DIRS} )

-#finish flags
+# finish flags
 set( ANDROID_CXX_FLAGS    "${ANDROID_CXX_FLAGS}"    CACHE INTERNAL "Extra Android compiler flags")
 set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS}" CACHE INTERNAL "Extra Android linker flags")
 set( CMAKE_CXX_FLAGS           "${ANDROID_CXX_FLAGS} ${CMAKE_CXX_FLAGS}" )
@@ -969,7 +966,7 @@
  set( CMAKE_EXE_LINKER_FLAGS    "${ANDROID_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}" )
 endif()

-#set these global flags for cmake client scripts to change behavior
+# set these global flags for cmake client scripts to change behavior
 set( ANDROID True )
 set( BUILD_ANDROID True )

@@ -982,7 +979,7 @@
 set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )

-#macro to find packages on the host OS
+# macro to find packages on the host OS
 macro( find_host_package )
  set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
  set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER )
@@ -1004,7 +1001,7 @@
 endmacro()

-#macro to find programs on the host OS
+# macro to find programs on the host OS
 macro( find_host_program )
  set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
  set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER )
@@ -1044,7 +1041,11 @@
  set( __toolchain_config "")
  foreach( __var ANDROID_ABI ANDROID_FORCE_ARM_BUILD ANDROID_NATIVE_API_LEVEL ANDROID_NO_UNDEFINED ANDROID_SO_UNDEFINED ANDROID_SET_OBSOLETE_VARIABLES LIBRARY_OUTPUT_PATH_ROOT ANDROID_USE_STLPORT ANDROID_FORBID_SYGWIN ANDROID_NDK ANDROID_STANDALONE_TOOLCHAIN ANDROID_FUNCTION_LEVEL_LINKING __ndklibspath )
   if( DEFINED ${__var} )
-   set( __toolchain_config "${__toolchain_config}set( ${__var} \"${${__var}}\" )\n" )
+   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" )
+   endif()
   endif()
  endforeach()
  file( WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/android.toolchain.config.cmake" "${__toolchain_config}" )


Add workaround for android builds.

Add workaround for android builds.

Add workaround for android builds.

--- run_ctest.cmake
+++ run_ctest.cmake
@@ -230,6 +230,8 @@
 ctest_read_custom_files(${CTEST_SOURCE_DIRECTORY})
 if(DEFINED ENV{CMAKE_TOOLCHAIN_FILE})
     ctest_configure(OPTIONS "-DCMAKE_TOOLCHAIN_FILE=$ENV{CMAKE_TOOLCHAIN_FILE}")
+elseif(DEFINED ENV{CMAKE_TOOLCHAIN_FILE} AND DEFINED ENV{CMAKE_ANDROID_ARCH_ABI})
+    ctest_configure(OPTIONS "-DCMAKE_TOOLCHAIN_FILE=$ENV{CMAKE_TOOLCHAIN_FILE} -DCMAKE_ANDROID_ARCH_ABI=$ENV{CMAKE_ANDROID_ARCH_ABI}")
 else()
     ctest_configure()
 endif()


style only

style only

--- rosidl_generator_c/cmake/rosidl_generator_c_generate_interfaces.cmake
+++ rosidl_generator_c/cmake/rosidl_generator_c_generate_interfaces.cmake
@@ -26,7 +26,7 @@
   string(LENGTH ${_idl_file} _idl_file_len)
   math(EXPR _idl_file_ext_pos "${_idl_file_len} - 4")
   string(SUBSTRING ${_idl_file} ${_idl_file_ext_pos} -1 _idl_file_ext)
-  if (${_idl_file_ext} STREQUAL ".msg")
+  if(${_idl_file_ext} STREQUAL ".msg")
     get_filename_component(name "${_idl_file}" NAME_WE)
     list(APPEND _generated_files
       "${_output_path}/${name}-c.h"
@@ -46,7 +46,7 @@
     string(LENGTH ${_idl_file} _idl_file_len)
     math(EXPR _idl_file_ext_pos "${_idl_file_len} - 4")
     string(SUBSTRING ${_idl_file} ${_idl_file_ext_pos} -1 _idl_file_ext)
-    if (${_idl_file_ext} STREQUAL ".msg")
+    if(${_idl_file_ext} STREQUAL ".msg")
       set(_abs_idl_file "${${_pkg_name}_DIR}/../${_idl_file}")
       normalize_path(_abs_idl_file "${_abs_idl_file}")
       list(APPEND _dependency_files "${_abs_idl_file}")


fptu-cmake: fix/workaround CMAKE 3.9 IPO warning for GoogleTest.

--- cmake.fptu/testing.cmake
+++ cmake.fptu/testing.cmake
@@ -77,8 +77,21 @@

     # Add googletest directly to our build. This defines
     # the gtest and gtest_main targets.
-    add_subdirectory(${gtest_root}
-      ${CMAKE_BINARY_DIR}/googletest-build)
+    add_subdirectory(${gtest_root} ${CMAKE_BINARY_DIR}/googletest-build EXCLUDE_FROM_ALL)
+    if(CMAKE_INTERPROCEDURAL_OPTIMIZATION AND NOT CMAKE_VERSION VERSION_LESS 3.9)
+      file(READ ${gtest_root}/CMakeLists.txt variable gtest_cmake_content)
+      string(TOLOWER "${gtest_cmake_content}" gtest_cmake_content)
+      string(FIND "${gtest_cmake_content}" "check_ipo_supported" gtest_ipo_supported)
+      if(NOT gtest_ipo_supported OR gtest_ipo_supported LESS 1)
+        message(STATUS "Disable INTERPROCEDURAL_OPTIMIZATION for GoogleTest (CMake-3.9's check_ipo_supported NOT FOUND inside)")
+        if(TARGET gtest)
+          set_property(TARGET gtest gtest_main PROPERTY INTERPROCEDURAL_OPTIMIZATION FALSE)
+        endif()
+        if(TARGET gmock)
+          set_property(TARGET gmock gmock_main PROPERTY INTERPROCEDURAL_OPTIMIZATION FALSE)
+        endif()
+      endif()
+    endif()

     if(CC_HAS_WERROR)
       if(MSVC)


cmake: fix if

cmake: fix if

--- cmake/DetectOpenCV.cmake
+++ cmake/DetectOpenCV.cmake
@@ -61,7 +61,7 @@
             if(NOT ${__MODULE_FOUND} EQUAL -1)

                 list(APPEND OpenCV_LIBS ${__OpenCV_LIBS_MISSING_ITEM})
-            endif(${__MODULE_FOUND} EQUAL -1)
+            endif()
         endforeach()

         list(APPEND OpenCV_LIBS ${OpenCV_LIBRARIES})


Fixed broken headers install layout

Fixed broken headers install layout

--- cmake/OpenCVModule.cmake
+++ cmake/OpenCVModule.cmake
@@ -426,8 +426,11 @@

   # only "public" headers need to be installed
   if(OPENCV_MODULE_${the_module}_HEADERS AND OPENCV_MODULES_PUBLIC MATCHES "(^|;)${the_module}(;|$)")
-    install(FILES ${OPENCV_MODULE_${the_module}_HEADERS}
-      DESTINATION ${OPENCV_INCLUDE_PREFIX}/opencv2/${name} COMPONENT main)
+    foreach(hdr ${OPENCV_MODULE_${the_module}_HEADERS})
+      if(hdr MATCHES "(opencv2/.*)/[^/]+.h(..)?$")
+        install(FILES ${hdr} DESTINATION "${OPENCV_INCLUDE_PREFIX}/${CMAKE_MATCH_1}" COMPONENT main)
+      endif()
+    endforeach()
   endif()
 endmacro()


Fixed typo in WindowsCache.cmake

Fixed typo in WindowsCache.cmake

--- cmake/WindowsCache.cmake
+++ cmake/WindowsCache.cmake
@@ -368,7 +368,7 @@
 SET(HAVE_BMOVE CACHE INTERNAL "")
 SET(HAVE_BSD_SIGNALS CACHE INTERNAL "")
 SET(HAVE_BSEARCH CACHE INTERNAL "")
-SET(HAVE_BSS_START CACHE INTENAL "")
+SET(HAVE_BSS_START CACHE INTERNAL "")
 SET(HAVE_BZERO CACHE INTERNAL "")
 SET(HAVE_CHOWN CACHE INTERNAL "")
 SET(HAVE_CLOCK_GETTIME CACHE INTERNAL "")


Try to get aiur dashboard update step working

--- cmake/aiur_nightly.cmake
+++ cmake/aiur_nightly.cmake
@@ -11,6 +11,7 @@
 set(CTEST_SITE "Aiur.kitware")
 set(CTEST_BUILD_NAME "Linux-master-nightly")
 set(CTEST_CMAKE_GENERATOR "Unix Makefiles")
+set(CTEST_UPDATE_COMMAND "git pull")

 ctest_start("Nightly")
 ctest_update(SOURCE ${CTEST_SOURCE_DIRECTORY})


add more sanitizers

add more sanitizers

--- cmake/ctest_script.cmake
+++ cmake/ctest_script.cmake
@@ -153,6 +153,7 @@
 # Empty previous directory before building (otherwise builds are incremental)
 #ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY})
 file(REMOVE_RECURSE ${CTEST_BINARY_DIRECTORY}/bin)
+file(REMOVE ${CTEST_BINARY_DIRECTORY}/CMakeCache.txt)

 if (test_coverage)
   find_program(CTEST_COVERAGE_COMMAND NAMES gcov)
@@ -161,14 +162,31 @@
   set(ENV{CFLAGS} "$ENV{CFLAGS} -g -O0 --coverage -fprofile-arcs -ftest-coverage")
 endif()

-if ("${CTEST_MEMORYCHECK_TYPE}" STREQUAL "Valgrind")
+if ("x${CTEST_MEMORYCHECK_TYPE}" STREQUAL "xValgrind")
   find_program(CTEST_MEMORYCHECK_COMMAND NAMES valgrind)
   set(MEMORYCHECK_SUPPRESSIONS_FILE "${CTEST_SOURCE_DIRECTORY}/cmake/valgrind_supp.txt")
   set(MEMORYCHECK_COMMAND_OPTIONS "--error-exitcode=1 --leak-check=yes -q")
   #--tool=memcheck --show-reachable=yes --num-callers=50 --track-origins=yes --trace-children=yes
-elif(CTEST_MEMORYCHECK_TYPE STREQUAL "AddressSanitizer")
-  set(ENV{CXXFLAGS} "$ENV{CXXFLAGS} -fsanitize=address -fno-omit-frame-pointer")
-  set(ENV{LDFLAGS}  "$ENV{LDFLAGS} -fsanitize=address")
+endif()
+if("x${CTEST_MEMORYCHECK_TYPE}" STREQUAL "xAddressSanitizer")
+  set(CXXFLAGS "$ENV{CXXFLAGS} -fsanitize=address -fno-omit-frame-pointer")
+  set(LDFLAGS  "$ENV{LDFLAGS} -fsanitize=address")
+endif()
+if("x${CTEST_MEMORYCHECK_TYPE}" STREQUAL "xLeakSanitizer")#part of AddressSanitizer
+  set(CXXFLAGS "$ENV{CXXFLAGS} -fsanitize=leak -fno-omit-frame-pointer")
+  set(LDFLAGS  "$ENV{LDFLAGS} -fsanitize=leak")
+endif()
+if("x${CTEST_MEMORYCHECK_TYPE}" STREQUAL "xMemorySanitizer")
+  set(CXXFLAGS "$ENV{CXXFLAGS} -fsanitize=memory -fno-omit-frame-pointer")
+  set(LDFLAGS  "$ENV{LDFLAGS} -fsanitize=memory")
+endif()
+if("x${CTEST_MEMORYCHECK_TYPE}" STREQUAL "xThreadSanitizer")
+  set(CXXFLAGS "$ENV{CXXFLAGS} -fsanitize=thread")
+  set(LDFLAGS  "$ENV{LDFLAGS} -fsanitize=thread")
+endif()
+if("x${CTEST_MEMORYCHECK_TYPE}" STREQUAL "xUndefinedBehaviorSanitizer")
+  set(CXXFLAGS "$ENV{CXXFLAGS} -fsanitize=undefined")
+  set(LDFLAGS  "$ENV{LDFLAGS} -fsanitize=undefined")
 endif()

 # Update type (eg. svn or git)


CMake: Only use precompiled headers on windows (inviwo/inviwo-dev#720)

--- cmake/globalconfig.cmake
+++ cmake/globalconfig.cmake
@@ -371,10 +371,10 @@

 #--------------------------------------------------------------------
 # Precompile headers
-if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+if(WIN32)
+    option(PRECOMPILED_HEADERS "Create and use precompilied headers" ON)
+else()
     option(PRECOMPILED_HEADERS "Create and use precompilied headers" OFF)
-else()
-    option(PRECOMPILED_HEADERS "Create and use precompilied headers" ON)
 endif()

 include(${CMAKE_CURRENT_LIST_DIR}/utilities/clean_library_list.cmake)


Remove redundant status message

Remove redundant status message

--- cmake/system_check.cmake
+++ cmake/system_check.cmake
@@ -121,7 +121,6 @@

 include(CheckIncludeFile)
 CHECK_INCLUDE_FILE("stdatomic.h" HAVE_C11)
-if (HAVE_C11 EQUAL 1)
-message (STATUS found stdatomic.h)
+if (HAVE_C11)
 set (CCOMMON_OPT "${CCOMMON_OPT} -DHAVE_C11")
 endif()


Add -march=skylake-avx512 to AVX512 compile check and suppress its output

--- cmake/system_check.cmake
+++ cmake/system_check.cmake
@@ -68,7 +68,7 @@

 if (X86_64 OR X86)
   file(WRITE ${PROJECT_BINARY_DIR}/avx512.tmp "int main(void){ __asm__ volatile(\"vbroadcastss -4 * 4(%rsi), %zmm2\"); }")
-execute_process(COMMAND ${CMAKE_C_COMPILER} -v -o ${PROJECT_BINARY_DIR}/avx512.o -x c ${PROJECT_BINARY_DIR}/avx512.tmp RESULT_VARIABLE NO_AVX512)
+execute_process(COMMAND ${CMAKE_C_COMPILER} -march=skylake-avx512 -v -o ${PROJECT_BINARY_DIR}/avx512.o -x c ${PROJECT_BINARY_DIR}/avx512.tmp OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE NO_AVX512)
 if (NO_AVX512 EQUAL 1)
 set (CCOMMON_OPT "${CCOMMON_OPT} -DNO_AVX512")
 endif()


CommonPackage: fix version with empty args

--- CommonPackage.cmake
+++ CommonPackage.cmake
@@ -13,6 +13,7 @@
 macro(COMMON_PACKAGE Name)
   string(TOUPPER ${Name} COMMON_PACKAGE_NAME)
   set(COMMON_PACKAGE_ARGS ${ARGN}) # ARGN is not a list. make one.
+  set(COMMON_PACKAGE_VERSION)

   if(COMMON_PACKAGE_ARGS)
     list(GET COMMON_PACKAGE_ARGS 0 COMMON_PACKAGE_VERSION)
@@ -27,7 +28,7 @@
   if(COMMON_PACKAGE_QUIET_POS EQUAL -1)
     set(COMMON_PACKAGE_QUIET)
   else()
-     set(COMMON_PACKAGE_QUIET "QUIET")
+    set(COMMON_PACKAGE_QUIET "QUIET")
   endif()

   list(FIND COMMON_PACKAGE_ARGS "REQUIRED" COMMON_PACKAGE_REQUIRED_POS)


Add CMAKE_MODULE_INSTALL_PATH to Common

Add CMAKE_MODULE_INSTALL_PATH to Common

--- Common.cmake
+++ Common.cmake
@@ -24,6 +24,9 @@
 file(MAKE_DIRECTORY ${OUTPUT_INCLUDE_DIR})
 include_directories(BEFORE ${CMAKE_SOURCE_DIR} ${OUTPUT_INCLUDE_DIR})

+string(REGEX REPLACE "share\/(.*)" "\1/Modules" CMAKE_MODULE_INSTALL_PATH
+  ${CMAKE_ROOT})
+
 # Boost settings
 if(MSVC)
   option(Boost_USE_STATIC_LIBS "Use boost static libs" ON)
@@ -33,7 +36,7 @@
 endif()
 add_definitions(-DBOOST_ALL_NO_LIB) # Don't use 'pragma lib' on Windows

-# Compiler setting
+# Compiler settings
 if(CMAKE_COMPILER_IS_GNUCXX)
   include(CompilerVersion)
   COMPILER_DUMPVERSION(GCC_COMPILER_VERSION)


WAR for CMake >=3.1 bug erasing $ENV{PKG_CONFIG_PATH}

--- Common.cmake
+++ Common.cmake
@@ -22,6 +22,12 @@
 cmake_policy(SET CMP0038 NEW) # Targets may not link directly to themselves.
 cmake_policy(SET CMP0048 NEW) # The project() command manages VERSION variables.
 cmake_policy(SET CMP0054 OLD) # Only interpret if() arguments as variables or keywords when unquoted.
+
+# WAR for CMake >=3.1 bug (observed with 3.2.3)
+# If not set to false, any call to pkg_check_modules() or pkg_search_module()
+# ERASES the $ENV{PKG_CONFIG_PATH}, so subsequent calls may fail to locate
+# a dependency which depends on this variable (e.g. in FindPoppler.cmake).
+set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH FALSE)

 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)


(split) COMP: Use FLTK zip file stored on Midas3.

Note from Bill Lorensen:

On my Ubuntu build, I tried the recently updated ITKApps.

I got this error:
svn: OPTIONS of 'http://seriss.com/public/fltk/fltk/branches/branch-1.3': authorization failed: Could not authenticate to server: rejected Basic challenge (http://seriss.com)

Then I tried a manual svn co of FLTK and got:
svn co http://seriss.com/public/fltk/fltk/branches/branch-1.3/ --username --password fltk-1.3
Password for 'default' GNOME keyring:
svn: OPTIONS of 'http://seriss.com/public/fltk/fltk/branches/branch-1.3': authorization failed: Could not authenticate to server: rejected Basic challenge (http://seriss.com)

So I looked at my
~/.subversion/config file and saw this line commented:
  password-stores = gnome-keyring,kwallet

when I changed it to:
 password-stores = kwallet

the superbuild downloaded fltk just fine.

To prevent SVN authentification issues, we use a zip file of the patched version FLTK stored on the ITK midas3.kitware.com community.

Change-Id: I33fbb855b096d3246da4f28afb4dbc28eb7606d3

--- External-FLTK.cmake
+++ External-FLTK.cmake
@@ -15,18 +15,11 @@

 set(FLTK_INSTALL_COMMAND ${CMAKE_MAKE_COMMAND} install)

-find_package(Subversion)
-if(NOT Subversion_SVN_EXECUTABLE)
-  message(FATAL_ERROR "error: could not find svn for checkout of ${name}")
-endif()
 ExternalProject_Add(FLTK
-  # Need to create our own version of svn checkout command because CMake <
-  # 2.8.12 does not support passing an empty string for the username and
-  # password.
-  DOWNLOAD_COMMAND ${Subversion_SVN_EXECUTABLE} co "http://seriss.com/public/fltk/fltk/branches/branch-1.3" -r "9815"
-    --non-interactive --username= --password= ${CMAKE_BINARY_DIR}/FLTK
+  # Patched version of FLTK 1.3 r9815
+  URL http://midas3.kitware.com/midas/download/bitstream/324025/FLTK-1.3-r9815-patched.zip
   UPDATE_COMMAND ""
-  PATCH_COMMAND ${FLTK_PATCH_COMMAND}
+  # PATCH_COMMAND ${FLTK_PATCH_COMMAND}
   SOURCE_DIR FLTK
   BINARY_DIR FLTK-build
   CMAKE_GENERATOR ${gen}


Moved to C++14.

Moved to C++14.

--- cmake/CompilerCheck.cmake
+++ cmake/CompilerCheck.cmake
@@ -1,3 +1,3 @@
-set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD 14)
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
 set(CMAKE_CXX_EXTENSIONS OFF)


Update cmake compiler gcc

Update cmake compiler gcc

--- cmake/Compilers/gcc.cmake
+++ cmake/Compilers/gcc.cmake
@@ -1,10 +1,10 @@
 # Copyright (c) 2014-2019 AscEmu Team <http://www.ascemu.org>

 include(CheckCXXCompilerFlag)
-CHECK_CXX_COMPILER_FLAG("-std=c++17" COMPILER_SUPPORTS_CXX14)
+CHECK_CXX_COMPILER_FLAG("-std=c++17" COMPILER_SUPPORTS_CXX17)

-if(NOT COMPILER_SUPPORTS_CXX14)
-    message(FATAL_ERROR "AscEmu requires at least GCC 6.2! Current version ${CMAKE_CXX_COMPILER} does not support c++14 feature")
+if(NOT COMPILER_SUPPORTS_CXX17)
+    message(FATAL_ERROR "AscEmu requires at least GCC 8! Current version ${CMAKE_CXX_COMPILER} does not support c++17 feature")
 endif()

 message(STATUS "Applying settings for ${CMAKE_CXX_COMPILER}")


Remove warnings when compiling ggo files

--- cmake/FindGengetopt.cmake
+++ cmake/FindGengetopt.cmake
@@ -31,4 +31,7 @@
     INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
   ENDFOREACH(GGO_FILE)
   SET_SOURCE_FILES_PROPERTIES(${${GGO_SRCS}} PROPERTIES GENERATED TRUE)
+  IF(CMAKE_COMPILER_IS_GNUCXX)
+    SET_SOURCE_FILES_PROPERTIES(${${GGO_SRCS}} PROPERTIES COMPILE_FLAGS "-Wno-unused-but-set-variable")
+  ENDIF(CMAKE_COMPILER_IS_GNUCXX)
 ENDMACRO (WRAP_GGO)


Fix MKL x86 detection on Windows

Fix MKL x86 detection on Windows

--- cmake/OpenCVFindMKL.cmake
+++ cmake/OpenCVFindMKL.cmake
@@ -79,12 +79,13 @@
     include(CheckTypeSize)
     CHECK_TYPE_SIZE(int _sizeof_int)
     if (_sizeof_int EQUAL 4)
-        set(MKL_LP64 "lp64")
+        set(MKL_ARCH_SUFFIX "lp64")
     else()
-        set(MKL_LP64 "ilp64")
+        set(MKL_ARCH_SUFFIX "ilp64")
     endif()
 else()
     set(MKL_ARCH "ia32")
+    set(MKL_ARCH_SUFFIX "c")
 endif()

 if(${MKL_VERSION_STR} VERSION_GREATER "11.3.0" OR ${MKL_VERSION_STR} VERSION_EQUAL "11.3.0")
@@ -94,7 +95,7 @@

     set(mkl_lib_list
         mkl_core
-        mkl_intel_${MKL_LP64})
+        mkl_intel_${MKL_ARCH_SUFFIX})

     if(MKL_WITH_TBB)
         list(APPEND mkl_lib_list mkl_tbb_thread tbb)
@@ -111,7 +112,6 @@
     message(STATUS "MKL version ${MKL_VERSION_STR} is not supported")
     mkl_fail()
 endif()
-

 set(MKL_LIBRARIES "")
 foreach(lib ${mkl_lib_list})
@@ -133,4 +133,4 @@
     #it's ugly but helps to avoid cyclic lib problem
     set(MKL_LIBRARIES ${MKL_LIBRARIES} ${MKL_LIBRARIES} ${MKL_LIBRARIES} "-lpthread" "-lm" "-ldl")
     set(MKL_LIBRARIES ${MKL_LIBRARIES} CACHE STRING "MKL libarries")
-endif()+endif()


Codegen: Fix LLVM package based build on MacOS

--- cmake/external_llvm.cmake
+++ cmake/external_llvm.cmake
@@ -76,7 +76,7 @@

 # Populate header and library paths from package-exported info
 # if we found system-level LLVM and Clang packages
-if(NOT LLVM_INCLUDE_DIR)
+if(LLVM_FOUND AND NOT LLVM_INCLUDE_DIR)
     set(LLVM_INCLUDE_DIR ${LLVM_INCLUDE_DIRS})
     set(LLVM_LIB_DIR ${LLVM_LIBRARY_DIRS})
     llvm_map_components_to_libnames(llvm_libs support core engine)


Fix issues around MYSQL_TCP_PORT_DEFAULT (should be really 0 all the time)

--- cmake/mysql_version.cmake
+++ cmake/mysql_version.cmake
@@ -84,7 +84,11 @@
 IF(NOT MYSQL_TCP_PORT)
   SET(MYSQL_TCP_PORT ${MYSQL_TCP_PORT_DEFAULT})
   SET(MYSQL_TCP_PORT_DEFAULT "0")
-ENDIF()
+ELSEIF(MYSQL_TCP_PORT EQUAL MYSQL_TCP_PORT_DEFAULT)
+  SET(MYSQL_TCP_PORT_DEFAULT "0")
+ENDIF()
+
+
 IF(NOT MYSQL_UNIX_ADDR)
   SET(MYSQL_UNIX_ADDR "/tmp/mysql.sock")
 ENDIF()


cmake: double quote for empty strings

cmake: double quote for empty strings

--- cmake/FindSSE.cmake
+++ cmake/FindSSE.cmake
@@ -4,7 +4,7 @@
 IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
    EXEC_PROGRAM(cat ARGS "/proc/cpuinfo" OUTPUT_VARIABLE CPUINFO)

-   STRING(REGEX REPLACE "^.*(sse2).*$" "\\1" SSE_THERE ${CPUINFO})
+   STRING(REGEX REPLACE "^.*(sse2).*$" "\\1" SSE_THERE "${CPUINFO}")
    STRING(COMPARE EQUAL "sse2" "${SSE_THERE}" SSE2_TRUE)
    IF (SSE2_TRUE)
       set(SSE2_FOUND true CACHE BOOL "SSE2 available on host")
@@ -13,14 +13,14 @@
    ENDIF (SSE2_TRUE)

    # /proc/cpuinfo apparently omits sse3 :(
-   STRING(REGEX REPLACE "^.*[^s](sse3).*$" "\\1" SSE_THERE ${CPUINFO})
+   STRING(REGEX REPLACE "^.*[^s](sse3).*$" "\\1" SSE_THERE "${CPUINFO}")
    STRING(COMPARE EQUAL "sse3" "${SSE_THERE}" SSE3_TRUE)
    IF (NOT SSE3_TRUE)
-      STRING(REGEX REPLACE "^.*(T2300).*$" "\\1" SSE_THERE ${CPUINFO})
+      STRING(REGEX REPLACE "^.*(T2300).*$" "\\1" SSE_THERE "${CPUINFO}")
       STRING(COMPARE EQUAL "T2300" "${SSE_THERE}" SSE3_TRUE)
    ENDIF (NOT SSE3_TRUE)

-   STRING(REGEX REPLACE "^.*(ssse3).*$" "\\1" SSE_THERE ${CPUINFO})
+   STRING(REGEX REPLACE "^.*(ssse3).*$" "\\1" SSE_THERE "${CPUINFO}")
    STRING(COMPARE EQUAL "ssse3" "${SSE_THERE}" SSSE3_TRUE)
    IF (SSE3_TRUE OR SSSE3_TRUE)
       set(SSE3_FOUND true CACHE BOOL "SSE3 available on host")
@@ -33,7 +33,7 @@
       set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host")
    ENDIF (SSSE3_TRUE)

-   STRING(REGEX REPLACE "^.*(sse4_1).*$" "\\1" SSE_THERE ${CPUINFO})
+   STRING(REGEX REPLACE "^.*(sse4_1).*$" "\\1" SSE_THERE "${CPUINFO}")
    STRING(COMPARE EQUAL "sse4_1" "${SSE_THERE}" SSE41_TRUE)
    IF (SSE41_TRUE)
       set(SSE4_1_FOUND true CACHE BOOL "SSE4.1 available on host")
@@ -41,7 +41,7 @@
       set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host")
    ENDIF (SSE41_TRUE)

-   STRING(REGEX REPLACE "^.*(avx).*$" "\\1" SSE_THERE ${CPUINFO})
+   STRING(REGEX REPLACE "^.*(avx).*$" "\\1" SSE_THERE "${CPUINFO}")
    STRING(COMPARE EQUAL "avx" "${SSE_THERE}" AVX_TRUE)
    IF (AVX_TRUE)
       set(AVX_FOUND true CACHE BOOL "AVX available on host")
@@ -52,7 +52,7 @@
    EXEC_PROGRAM("/usr/sbin/sysctl -n machdep.cpu.features" OUTPUT_VARIABLE
       CPUINFO)

-   STRING(REGEX REPLACE "^.*[^S](SSE2).*$" "\\1" SSE_THERE ${CPUINFO})
+   STRING(REGEX REPLACE "^.*[^S](SSE2).*$" "\\1" SSE_THERE "${CPUINFO}")
    STRING(COMPARE EQUAL "SSE2" "${SSE_THERE}" SSE2_TRUE)
    IF (SSE2_TRUE)
       set(SSE2_FOUND true CACHE BOOL "SSE2 available on host")
@@ -60,7 +60,7 @@
       set(SSE2_FOUND false CACHE BOOL "SSE2 available on host")
    ENDIF (SSE2_TRUE)

-   STRING(REGEX REPLACE "^.*[^S](SSE3).*$" "\\1" SSE_THERE ${CPUINFO})
+   STRING(REGEX REPLACE "^.*[^S](SSE3).*$" "\\1" SSE_THERE "${CPUINFO}")
    STRING(COMPARE EQUAL "SSE3" "${SSE_THERE}" SSE3_TRUE)
    IF (SSE3_TRUE)
       set(SSE3_FOUND true CACHE BOOL "SSE3 available on host")
@@ -68,7 +68,7 @@
       set(SSE3_FOUND false CACHE BOOL "SSE3 available on host")
    ENDIF (SSE3_TRUE)

-   STRING(REGEX REPLACE "^.*(SSSE3).*$" "\\1" SSE_THERE ${CPUINFO})
+   STRING(REGEX REPLACE "^.*(SSSE3).*$" "\\1" SSE_THERE "${CPUINFO}")
    STRING(COMPARE EQUAL "SSSE3" "${SSE_THERE}" SSSE3_TRUE)
    IF (SSSE3_TRUE)
       set(SSSE3_FOUND true CACHE BOOL "SSSE3 available on host")
@@ -76,7 +76,7 @@
       set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host")
    ENDIF (SSSE3_TRUE)

-   STRING(REGEX REPLACE "^.*(SSE4.1).*$" "\\1" SSE_THERE ${CPUINFO})
+   STRING(REGEX REPLACE "^.*(SSE4.1).*$" "\\1" SSE_THERE "${CPUINFO}")
    STRING(COMPARE EQUAL "SSE4.1" "${SSE_THERE}" SSE41_TRUE)
    IF (SSE41_TRUE)
       set(SSE4_1_FOUND true CACHE BOOL "SSE4.1 available on host")
@@ -84,7 +84,7 @@
       set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host")
    ENDIF (SSE41_TRUE)

-   STRING(REGEX REPLACE "^.*(AVX).*$" "\\1" SSE_THERE ${CPUINFO})
+   STRING(REGEX REPLACE "^.*(AVX).*$" "\\1" SSE_THERE "${CPUINFO}")
    STRING(COMPARE EQUAL "AVX" "${SSE_THERE}" AVX_TRUE)
    IF (AVX_TRUE)
       set(AVX_FOUND true CACHE BOOL "AVX available on host")


Add support for VS2015 & VS2017 in FindZMQ script

--- cmake/FindZMQ.cmake
+++ cmake/FindZMQ.cmake
@@ -56,14 +56,18 @@
     endforeach ()

     # Supported compilers
-    if (MSVC90)
+    if (MSVC_VERSION EQUAL 1500)
         set (compiler "v90")
-    elseif (MSVC10)
+    elseif (MSVC_VERSION EQUAL 1600)
         set (compiler "v100")
-    elseif (MSVC11)
+    elseif (MSVC_VERSION EQUAL 1700)
         set (compiler "v110")
-    elseif (MSVC12)
+    elseif (MSVC_VERSION EQUAL 1800)
         set (compiler "v120")
+    elseif (MSVC_VERSION EQUAL 1900)
+        set (compiler "v140")
+    elseif ((MSVC_VERSION GREATER 1909) AND (MSVC_VERSION LESS 1920))
+        set (compiler "v141")
     else ()
         set (compiler "NOTFOUND")
         set (canFind FALSE)


build: Clean up the find-module for lz4

build: Clean up the find-module for lz4

--- cmake/Findlz4.cmake
+++ cmake/Findlz4.cmake
@@ -20,31 +20,38 @@
 # Copyright (C) 2018 Scylladb, Ltd.
 #

-find_package (PkgConfig)
+find_package (PkgConfig REQUIRED)

-pkg_search_module (PC_lz4
-  REQUIRED
+pkg_search_module (lz4_PC
   QUIET
   liblz4)

+find_library (lz4_LIBRARY
+  NAMES lz4
+  HINTS
+    ${lz4_PC_LIBDIR}
+    ${lz4_PC_LIBRARY_DIRS})
+
 find_path (lz4_INCLUDE_DIR
   NAMES lz4.h
-  PATHS ${PC_lz4_INCLUDE_DIRS})
+  HINTS
+    ${lz4_PC_INCLUDEDIR}
+    ${lz4_PC_INCLUDEDIRS})

-find_library (lz4_LIBRARY
-  NAMES lz4
-  PATHS ${PC_lz4_LIBRARY_DIRS})
-
-set (lz4_VERSION ${PC_lz4_VERSION})
+mark_as_advanced (
+  lz4_LIBRARY
+  lz4_INCLUDE_DIR)

 include (FindPackageHandleStandardArgs)

 find_package_handle_standard_args (lz4
-  FOUND_VAR lz4_FOUND
   REQUIRED_VARS
+    lz4_LIBRARY
     lz4_INCLUDE_DIR
-    lz4_LIBRARY
-  VERSION_VAR lz4_VERSION)
+  VERSION_VAR lz4_PC_VERSION)
+
+set (lz4_LIBRARIES ${lz4_LIBRARY})
+set (lz4_INCLUDE_DIRS ${lz4_INCLUDE_DIR})

 if (lz4_FOUND)
   set (CMAKE_REQUIRED_LIBRARIES ${lz4_LIBRARY})
@@ -53,8 +60,6 @@
   check_symbol_exists (LZ4_compress_default
     ${lz4_INCLUDE_DIR}/lz4.h
     lz4_HAVE_COMPRESS_DEFAULT)
-
-  set (lz4_INCLUDE_DIRS ${lz4_INCLUDE_DIR})
 endif ()

 if (lz4_FOUND AND NOT (TARGET lz4::lz4))
@@ -63,10 +68,5 @@
   set_target_properties (lz4::lz4
     PROPERTIES
       IMPORTED_LOCATION ${lz4_LIBRARY}
-      INTERFACE_COMPILE_OPTIONS "${PC_lz4_CFLAGS_OTHER}"
-      INTERFACE_INCLUDE_DIRECTORIES ${lz4_INCLUDE_DIR})
+      INTERFACE_INCLUDE_DIRECTORIES ${lz4_INCLUDE_DIRS})
 endif ()
-
-mark_as_advanced (
-  lz4_INCLUDE_DIR
-  lz4_LIBRARY)


Upgrade libssh2 to 1.9.0 in cmake builds too

--- cmake/LibSSH2.cmake
+++ cmake/LibSSH2.cmake
@@ -1,6 +1,6 @@
-set(LibSSH2_Spec_URL "https://www.libssh2.org/download/libssh2-1.7.0.tar.gz")
-set(LibSSH2_Spec_ArchiveName libssh2-1.7.0.tar.gz)
-set(LibSSH2_Spec_ArchiveHash "SHA256=e4561fd43a50539a8c2ceb37841691baf03ecb7daf043766da1b112e4280d584")
+set(LibSSH2_Spec_URL "https://www.libssh2.org/download/libssh2-1.9.0.tar.gz")
+set(LibSSH2_Spec_ArchiveName libssh2-1.9.0.tar.gz)
+set(LibSSH2_Spec_ArchiveHash "SHA256=d5fb8bd563305fd1074dda90bd053fb2d29fc4bce048d182f96eaa466dfadafd")

 set(LibSSH2_Spec_MacLibraries libssh2.1.dylib)
 set(LibSSH2_Spec_MacLibrariesSymlinks libssh2*.dylib)


Make cmake QA targets optional

Make cmake QA targets optional

Revise the cmake QA-related targets, making them optional by default
and emitting warnings instead of errors if the dependencies are not
present.

--- cmake/code-qa.cmake
+++ cmake/code-qa.cmake
@@ -1,66 +1,76 @@
-# Run python code tests
-# Create Python distrubution package
+# Add targets for QA tasks:
+#   lint        Target for invoking pyling
+#   style       Target for invoking pycodestyle
+#   coverage    Target for invoking coverage
+#   doc         Target for invoking sphinx and producing the html docs
+#
+# If the dependencies for any of the targets cannot be found, they are skipped
+# with a warning, as they are considered not essential (ie. qiskit can be
+# executed and compiled even without them).
+
 find_program(PYTHON "python")
 if (NOT PYTHON)
     message(FATAL_ERROR "Couldn't find Python in your system. Please, install it and try again.")
 endif()

+# lint
 function(add_lint_target)
     find_program(PYLINT "pylint")
     if (NOT PYLINT)
-        message(FATAL_ERROR "Couldn't find pylint in your system. Please, install it and try again.")
+        message(WARNING "The 'lint' target will not be available: 'pylint' was not found.")
+    else()
+        add_custom_target(lint)
+        add_custom_command(TARGET lint
+            COMMAND ${PYLINT} -rn qiskit test
+            WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
     endif()
-
-    add_custom_target(lint)
-    add_custom_command(TARGET lint
-        COMMAND ${PYLINT} -rn qiskit test
-        WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
 endfunction()

+# style
 function(add_code_style_target)
     find_program(PYCODESTYLE "pycodestyle")
     if (NOT PYCODESTYLE)
-        message(SEND_ERROR "Couldn't find pycodestyle in your system. Please, install it and try again.")
+        message(WARNING "The 'style' target will not be available: 'pycodestyle' was not found.")
+    else()
+        add_custom_target(style)
+        add_custom_command(TARGET style
+            COMMAND ${PYCODESTYLE} --exclude=qiskit/tools --max-line-length=100
+                qiskit test
+            WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
     endif()
-
-    add_custom_target(style)
-    add_custom_command(TARGET style
-        COMMAND ${PYCODESTYLE} --exclude=qiskit/tools --max-line-length=100
-            qiskit test
-        WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
 endfunction()

+# coverage
 function(add_coverage_target)
     find_program(COV3 "coverage3")
     if (NOT COV3)
-        message(FATAL_ERROR "Couldn't find coverage3 in your system. Please, install it and try again.")
+        message(WARNING "The 'coverage' target will not be available: 'coverage3' was not found.")
+    else()
+        add_custom_target(coverage_erase)
+        add_custom_command(TARGET coverage_erase
+            COMMAND ${COV3} erase
+            WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
+        add_custom_target(coverage)
+        add_custom_command(TARGET coverage
+            COMMAND ${COV3} run --source qiskit -m unittest discover -s test -q
+            WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
+        add_custom_command(TARGET coverage
+            COMMAND ${COV3} report
+            WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
     endif()
-
-    add_custom_target(coverage_erase)
-    add_custom_command(TARGET coverage_erase
-        COMMAND ${COV3} erase
-        WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
-    add_custom_target(coverage)
-    add_custom_command(TARGET coverage
-        COMMAND ${COV3} run --source qiskit -m unittest discover -s test -q
-        WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
-    add_custom_command(TARGET coverage
-        COMMAND ${COV3} report
-        WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
 endfunction()

+# doc
 function(add_doc_target DOC_FORMAT SOURCE_DIR BUILD_DIR)
-    find_program(PYTHON python)
-    if(NOT PYTHON)
-        message(SEND_ERROR "Couldn't find python in your system. Please, install it and try again.")
-    endif()
     find_program(BETTER_APIDOC "better-apidoc")
     if(NOT BETTER_APIDOC)
-        message(SEND_ERROR "Couldn't find better-apidoc in your system. Please, install it and try again.")
+        message(WARNING "The 'doc' target will not be available: 'better-apidoc' was not found.")
+        return()
     endif()
     find_program(SPHINX_AUTOGEN "sphinx-autogen")
     if(NOT SPHINX_AUTOGEN)
-        message(SEND_ERROR "Couldn't find sphinx-autogen in your system. Please, install it and try again.")
+        message(WARNING "The 'doc' target will not be available: 'sphinx-autogen' was not found.")
+        return()
     endif()

     set(SPHINX ${PYTHON} -msphinx)


added missing *.pb.h *.pb.cc generation to fix distribute build issue

--- cmake/generic.cmake
+++ cmake/generic.cmake
@@ -597,6 +597,9 @@
           COMMAND ${PROTOBUF_PROTOC_EXECUTABLE}
           ARGS --grpc_out "${CMAKE_CURRENT_BINARY_DIR}" -I "${PROTO_PATH}"
           --plugin=protoc-gen-grpc="${GRPC_CPP_PLUGIN}" "${ABS_PROTO}"
+          COMMAND ${PROTOBUF_PROTOC_EXECUTABLE}
+          ARGS --cpp_out "${CMAKE_CURRENT_BINARY_DIR}" -I "${PROTO_PATH}"
+          "${ABS_PROTO}"
           DEPENDS "${ABS_PROTO}" ${PROTOBUF_PROTOC_EXECUTABLE} extern_grpc)

   # FIXME(typhoonzero): grpc generated code do not generate virtual-dtor, mark it


update protobuf to 3.5.1.1

update protobuf to 3.5.1.1

--- tensorflow/contrib/cmake/external/protobuf.cmake
+++ tensorflow/contrib/cmake/external/protobuf.cmake
@@ -16,7 +16,7 @@

 set(PROTOBUF_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/protobuf/src/protobuf/src)
 set(PROTOBUF_URL https://github.com/google/protobuf.git)
-set(PROTOBUF_TAG b04e5cba356212e4e8c66c61bbe0c3a20537c5b9)
+set(PROTOBUF_TAG 860bd12fec5c69e6529565165532b3d5108a7d97)

 if(WIN32)
   set(protobuf_STATIC_LIBRARIES


Tentative fix for older cmake versions.

Tentative fix for older cmake versions.

--- VAD_TIFF.cmake
+++ VAD_TIFF.cmake
@@ -1,4 +1,16 @@
 set(GIT_REPO "https://github.com/vadz/libtiff.git")
+
+function(vad_system)
+  vad_system_default(${ARGN})
+  if(TIFF_FOUND AND NOT TARGET TIFF::TIFF)
+    # Some earlier versions of cmake do not provide the TIFF::TIFF target.
+    message(STATUS "Creating the TIFF::TIFF imported target.")
+    add_library(TIFF::TIFF UNKNOWN IMPORTED)
+    set_target_properties(TIFF::TIFF PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${TIFF_INCLUDE_DIR}")
+    set_property(TARGET TIFF::TIFF APPEND PROPERTY IMPORTED_LOCATION "${TIFF_LIBRARIES}")
+    make_imported_targets_global()
+  endif()
+endfunction()

 function(vad_live)
   git_clone(TIFF)


Bug 880: manually edit the DartConfiguration.tcl file to get it working with cmake 3.0.x

--- cmake/EigenConfigureTesting.cmake
+++ cmake/EigenConfigureTesting.cmake
@@ -14,49 +14,18 @@
 # check whether /bin/bash exists
 find_file(EIGEN_BIN_BASH_EXISTS "/bin/bash" PATHS "/" NO_DEFAULT_PATH)

-# CMake/Ctest does not allow us to change the build command,
-# so we have to workaround by directly editing the generated DartConfiguration.tcl file
-# save CMAKE_MAKE_PROGRAM
-set(CMAKE_MAKE_PROGRAM_SAVE ${CMAKE_MAKE_PROGRAM})
-# and set a fake one
-set(CMAKE_MAKE_PROGRAM "@EIGEN_MAKECOMMAND_PLACEHOLDER@")
-
 # This call activates testing and generates the DartConfiguration.tcl
 include(CTest)

 set(EIGEN_TEST_BUILD_FLAGS "" CACHE STRING "Options passed to the build command of unit tests")

-# overwrite default DartConfiguration.tcl
-# The worarounds are different for each version of the MSVC IDE
-set(EIGEN_TEST_TARGET buildtests)
-if(MSVC_IDE)
-  if(CMAKE_MAKE_PROGRAM_SAVE MATCHES "devenv") # devenv
-    set(EIGEN_BUILD_COMMAND "${CMAKE_MAKE_PROGRAM_SAVE} Eigen.sln /build Release /project ${EIGEN_TEST_TARGET}")
-  else() # msbuild
-    set(EIGEN_BUILD_COMMAND "${CMAKE_MAKE_PROGRAM_SAVE} ${EIGEN_TEST_TARGET}.vcxproj /p:Configuration=\${CTEST_CONFIGURATION_TYPE}")
-  endif()
-
-  # append the build flags if provided
-  if(NOT "${EIGEN_TEST_BUILD_FLAGS}" MATCHES "^[ \t]*$")
-    set(EIGEN_BUILD_COMMAND "${EIGEN_BUILD_COMMAND} ${EIGEN_TEST_BUILD_FLAGS}")
-  endif()
-
-  # apply the dartconfig hack ...
-  set(EIGEN_MAKECOMMAND_PLACEHOLDER "${EIGEN_BUILD_COMMAND}\n#")
-else()
-  # for make and nmake
-  set(EIGEN_BUILD_COMMAND "${CMAKE_MAKE_PROGRAM_SAVE} ${EIGEN_TEST_TARGET} ${EIGEN_TEST_BUILD_FLAGS}")
-  set(EIGEN_MAKECOMMAND_PLACEHOLDER "${EIGEN_BUILD_COMMAND}")
-endif()
-
-configure_file(${CMAKE_CURRENT_BINARY_DIR}/DartConfiguration.tcl ${CMAKE_BINARY_DIR}/DartConfiguration.tcl)
-
-# restore default CMAKE_MAKE_PROGRAM
-set(CMAKE_MAKE_PROGRAM ${CMAKE_MAKE_PROGRAM_SAVE})
-
-# un-set temporary variables so that it is like they never existed
-unset(CMAKE_MAKE_PROGRAM_SAVE)
-unset(EIGEN_MAKECOMMAND_PLACEHOLDER)
+# Overwrite default DartConfiguration.tcl such that ctest can build our unit tests.
+# Recall that our unit tests are not in the "all" target, so we have to explicitely ask ctest to build our custom 'buildtests' target.
+# At this stage, we can also add custom flags to the build tool through the user defined EIGEN_TEST_BUILD_FLAGS variable.
+file(READ  "${CMAKE_CURRENT_BINARY_DIR}/DartConfiguration.tcl" EIGEN_DART_CONFIG_FILE)
+string(REGEX REPLACE "MakeCommand:.*DefaultCTestConfigurationType" "MakeCommand: ${CMAKE_COMMAND} --build . --target buildtests --config '' -- -i ${EIGEN_TEST_BUILD_FLAGS}\nDefaultCTestConfigurationType"
+       EIGEN_DART_CONFIG_FILE2 ${EIGEN_DART_CONFIG_FILE})
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/DartConfiguration.tcl" ${EIGEN_DART_CONFIG_FILE2})

 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CTestCustom.cmake.in ${CMAKE_BINARY_DIR}/CTestCustom.cmake)


Changed wintools download root to the softmotions.com

--- cmake/Modules/Win32LIBTools.cmake
+++ cmake/Modules/Win32LIBTools.cmake
@@ -15,7 +15,7 @@
 endif()

 set(WINTOOLS_DIR ${CMAKE_BINARY_DIR}/WINTOOLS)
-set(WINTOOLS_DL_ROOT "https://dl.dropboxusercontent.com/u/4709222/windev")
+set(WINTOOLS_DL_ROOT "http://softmotions.com/windev")

 if (NOT EXISTS ${WINTOOLS_DIR})
 	file(MAKE_DIRECTORY ${WINTOOLS_DIR})


Fix stdosl.h not being found when building with OSL

An important modification was not port over from the Blender repository.

Differential Revision: https://developer.blender.org/D8018

--- src/cmake/Modules/FindOpenShadingLanguage.cmake
+++ src/cmake/Modules/FindOpenShadingLanguage.cmake
@@ -70,6 +70,22 @@
              HINTS ${_osl_SEARCH_DIRS}
              PATH_SUFFIXES bin)

+get_filename_component(OSL_SHADER_HINT ${OSL_COMPILER} DIRECTORY)
+get_filename_component(OSL_SHADER_HINT ${OSL_SHADER_DIR}/../ ABSOLUTE)
+
+FIND_PATH(OSL_SHADER_DIR
+  NAMES
+    stdosl.h
+  HINTS
+    ${OSL_ROOT_DIR}
+    ${OSL_SHADER_HINT}
+    $ENV{OSLHOME}
+    /usr/share/OSL/
+    /usr/include/OSL/
+  PATH_SUFFIXES
+    shaders
+)
+
 # handle the QUIETLY and REQUIRED arguments and set OSL_FOUND to TRUE if
 # all listed variables are TRUE
 INCLUDE(FindPackageHandleStandardArgs)


Fix failing include

Fix failing include

--- CommonCTest.cmake
+++ CommonCTest.cmake
@@ -2,7 +2,7 @@
 #               2010-2014, Stefan Eilemann <eile@eyescale.ch>
 #               2014, Juan Hernando <jhernando@fi.upm.es>

-include(CommonCPPCTest.cmake)
+include(CommonCPPCTest)

 if(COVERAGE)
   coverage_report(run_cpp_tests)


Add POLLY_SKIP_SYSROOT variable

Add POLLY_SKIP_SYSROOT variable

--- compiler/gcc-cross-compile.cmake
+++ compiler/gcc-cross-compile.cmake
@@ -15,6 +15,8 @@
 else()
   set(POLLY_COMPILER_GCC_CROSS_COMPILE TRUE)
 endif()
+
+include(polly_add_cache_flag)

 if( CMAKE_TOOLCHAIN_FILE )
   # touch toolchain variable to suppress "unused variable" warning
@@ -47,15 +49,21 @@
   polly_fatal_error("CROSS_COMPILE_SYSROOT not set.")
 endif()

-set(SYSROOT_COMPILE_FLAG "--sysroot=${CROSS_COMPILE_SYSROOT}")
-polly_add_cache_flag(
-    CMAKE_C_FLAGS
-    "${SYSROOT_COMPILE_FLAG}"
-)
-polly_add_cache_flag(
-    CMAKE_CXX_FLAGS
-    "${SYSROOT_COMPILE_FLAG}"
-)
+if(POLLY_SKIP_SYSROOT)
+  # Do not modify CMAKE_{C,CXX}_FLAGS
+  # Workaround for x86_64-pc-linux-gcc error:
+  #   "this linker was not configured to use sysroots"
+else()
+  set(SYSROOT_COMPILE_FLAG "--sysroot=${CROSS_COMPILE_SYSROOT}")
+  polly_add_cache_flag(
+      CMAKE_C_FLAGS
+      "${SYSROOT_COMPILE_FLAG}"
+  )
+  polly_add_cache_flag(
+      CMAKE_CXX_FLAGS
+      "${SYSROOT_COMPILE_FLAG}"
+  )
+endif()

 # The (...)_PREFIX variable name refers to the Cross Compiler Triplet
 set(TOOLCHAIN_PATH_AND_PREFIX ${CROSS_COMPILE_TOOLCHAIN_PATH}/${CROSS_COMPILE_TOOLCHAIN_PREFIX})


Ignore patch version for github API doc

Ignore patch version for github API doc

--- DoxygenRule.cmake
+++ DoxygenRule.cmake
@@ -24,9 +24,9 @@
 add_dependencies(doxygen doxygen_install)

 add_custom_target(github
-  COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_SOURCE_DIR}/../${GIT_ORIGIN_org}/${PROJECT_NAME}-${VERSION}
-  COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/doc/html ${CMAKE_SOURCE_DIR}/../${GIT_ORIGIN_org}/${PROJECT_NAME}-${VERSION}
-  COMMENT "Copying API documentation to ${GIT_ORIGIN_org}.github.com/${PROJECT_NAME}-${VERSION}"
+  COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_SOURCE_DIR}/../${GIT_ORIGIN_org}/${PROJECT_NAME}-${VERSION_MAJOR}.${VERSION_MINOR}
+  COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/doc/html ${CMAKE_SOURCE_DIR}/../${GIT_ORIGIN_org}/${PROJECT_NAME}-${VERSION_MAJOR}.${VERSION_MINOR}
+  COMMENT "Copying API documentation to ${GIT_ORIGIN_org}.github.com/${PROJECT_NAME}-${VERSION_MAJOR}.${VERSION_MINOR}"
   VERBATIM)
 add_dependencies(github doxygen)


cl_offline_compiler.sh.in.cmake: add a hack required for CTS math divide test

same as in pocl_llvm_build_program()

--- cl_offline_compiler.sh.in.cmake
+++ cl_offline_compiler.sh.in.cmake
@@ -51,12 +51,23 @@
 fi

 CL_IS_30=false
+CL_FAST_MATH=false
+CL_UNSAFE_MATH=false
 BUILD_OPTIONS=""
 CL_STD="-cl-std=CL1.2"
+
 for i in "$@"; do
   case $i in
     -cl-std=*)
       CL_STD="$i"
+      shift
+      ;;
+    -cl-fast-relaxed-math)
+      CL_FAST_MATH=true
+      shift
+      ;;
+    -cl-unsafe-math)
+      CL_UNSAFE_MATH=true
       shift
       ;;
     *)
@@ -88,6 +99,16 @@
       CL_EXTS="${CL_EXTS},+__opencl_c_images"
     fi
   fi
+
+  if [ "$CL_FAST_MATH" = "true" ]; then
+    CL_EXT_DEFS="${CL_EXT_DEFS} -cl-finite-math-only"
+    CL_UNSAFE_MATH=true
+  fi
+
+  if [ "$CL_UNSAFE_MATH" = "true" ]; then
+    CL_EXT_DEFS="${CL_EXT_DEFS} -cl-no-signed-zeros -cl-mad-enable -ffp-contract=fast"
+  fi
+

   if [[ "$CL_DEVICE_VERSION" =~ "PoCL" ]] && [ "$CL_IS_30" = "true" ]; then
     if [[ "$CL_DEVICE_VERSION" =~ "basic" ]] || [[ "$CL_DEVICE_VERSION" =~ "pthread" ]]; then


ENH: Bump ITKMinimalPathExtraction tag

ENH: Bump ITKMinimalPathExtraction tag

Critical update to MinimalPathExtraction addresses changes
to ITK's FastMarching methods. Updating is required to avoid
exception being thrown.

--- Modules/Remote/MinimalPathExtraction.remote.cmake
+++ Modules/Remote/MinimalPathExtraction.remote.cmake
@@ -47,5 +47,5 @@
 "
   MODULE_COMPLIANCE_LEVEL 2
   GIT_REPOSITORY ${git_protocol}://github.com/InsightSoftwareConsortium/ITKMinimalPathExtraction.git
-  GIT_TAG 8efc30771a423c797aa16454c5d547ea5cab7c0e
+  GIT_TAG 72ef4ad37a341f6c5f1b0fe1c10e454a27980309
   )


- выключена оптимизация для бизона

 - выключена оптимизация для бизона

git-svn-id: 41bd7e47c31e4d43f97241d7529f6785d233c6d8@13105 23f926e6-80f1-49ca-85a0-60d4a27bb3ac

--- rdo/packages/cmake/trunk/split-bison.cmake
+++ rdo/packages/cmake/trunk/split-bison.cmake
@@ -16,6 +16,9 @@

 	SET(CPP_OUTPUT_FILE_1 ${GRAMMA_OUTPUT_PATH}/rdogram${Y_1}.cpp)
 	SET(CPP_OUTPUT_FILE_2 ${GRAMMA_OUTPUT_PATH}/rdogram${Y_2}.cpp)
+
+	SET_SOURCE_FILES_PROPERTIES(${GRAMMA_OUTPUT_PATH}/rdogram${Y_1}.cpp PROPERTIES COMPILE_FLAGS "/Od")
+	SET_SOURCE_FILES_PROPERTIES(${GRAMMA_OUTPUT_PATH}/rdogram${Y_2}.cpp PROPERTIES COMPILE_FLAGS "/Od")

 	SET(BISON_${INPUT_FILE}_OUTPUTS_1 ${CPP_OUTPUT_FILE_1})
 	SET(BISON_${INPUT_FILE}_OUTPUTS_2 ${CPP_OUTPUT_FILE_2})


Trying to find lapacke on ci

Trying to find lapacke on ci

Former-commit-id: b7a059d978ea1b1cbca4bbe445fc8a33c2417ea3

--- cmake-modules/FindLapacke.cmake
+++ cmake-modules/FindLapacke.cmake
@@ -84,9 +84,10 @@
                 target_link_libraries(lapacke::lapacke INTERFACE blas::blas lapack::lapack)
                 lapacke_message(STATUS "Looking for Lapacke in system - found: ${LAPACKE_LIBRARY}")
             else()
-                lapacke_message(STATUS "Looking for Lapacke in system - not found")
-                lapacke_message(STATUS "Tried LAPACKE_LIBRARY     : ${LAPACKE_LIBRARY} ")
-                lapacke_message(STATUS "Tried LAPACKE_INCLUDE_DIR : ${LAPACKE_INCLUDE_DIR} ")
+                message(STATUS "Looking for Lapacke in system - not found")
+                message(STATUS "Tried LAPACKE_LIBRARY     : ${LAPACKE_LIBRARY} ")
+                message(STATUS "Tried LAPACKE_INCLUDE_DIR : ${LAPACKE_INCLUDE_DIR} ")
+                message(WARNING "No version of lapacke could be found")
             endif()
         endif()
     endif()


distortosAppendToSavedConfiguration() does nothing for undefined vars

--- cmake/distortos-utilities.cmake
+++ cmake/distortos-utilities.cmake
@@ -97,6 +97,10 @@

 function(distortosAppendToSavedConfiguration name)
 	if(CMAKE_PROJECT_NAME STREQUAL "CMAKE_TRY_COMPILE")	# do nothing during compiler identification and checking
+		return()
+	endif()
+
+	if(NOT DEFINED "${name}")	# do nothing if variable is not defined
 		return()
 	endif()


CMake: Updated library dependence info.

CMake: Updated library dependence info.

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

--- cmake/modules/LLVMLibDeps.cmake
+++ cmake/modules/LLVMLibDeps.cmake
@@ -32,7 +32,8 @@
 set(MSVC_LIB_DEPS_LLVMMC LLVMSupport)
 set(MSVC_LIB_DEPS_LLVMMSIL LLVMAnalysis LLVMCodeGen LLVMCore LLVMMSILInfo LLVMScalarOpts LLVMSupport LLVMSystem LLVMTarget LLVMTransformUtils LLVMipa)
 set(MSVC_LIB_DEPS_LLVMMSILInfo LLVMCore LLVMSupport)
-set(MSVC_LIB_DEPS_LLVMMSP430 LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMSP430Info LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget)
+set(MSVC_LIB_DEPS_LLVMMSP430AsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMSP430Info LLVMSupport LLVMSystem LLVMTarget)
+set(MSVC_LIB_DEPS_LLVMMSP430CodeGen LLVMCodeGen LLVMCore LLVMMSP430Info LLVMSelectionDAG LLVMSupport LLVMTarget)
 set(MSVC_LIB_DEPS_LLVMMSP430Info LLVMSupport)
 set(MSVC_LIB_DEPS_LLVMMipsAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMipsCodeGen LLVMMipsInfo LLVMSupport LLVMSystem LLVMTarget)
 set(MSVC_LIB_DEPS_LLVMMipsCodeGen LLVMCodeGen LLVMCore LLVMMipsInfo LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget)


Fix the Linux 32-bit toolchain to append to the flags, not override

PiperOrigin-RevId: 291808636

--- cmake/toolchains/linux_32.cmake
+++ cmake/toolchains/linux_32.cmake
@@ -1,5 +1,5 @@
 # Toolchain file for building 32-bit Linux libraries

-set(CMAKE_C_FLAGS -m32)
-set(CMAKE_CXX_FLAGS -m32)
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
 set(CMAKE_LIBRARY_PATH "/usr/lib/i386-linux-gnu")


Fix build

Fix build

--- cmake/modules/hunter_test_string_not_empty.cmake
+++ cmake/modules/hunter_test_string_not_empty.cmake
@@ -7,4 +7,4 @@
   if(NOT test_string)
     hunter_fatal_error("Unexpected empty string")
   endif()
-endif()
+endfunction()


Tentative bugfixes.

Tentative bugfixes.

--- VigraAddDep.cmake
+++ VigraAddDep.cmake
@@ -184,36 +184,41 @@
 # In addition to calling the builtin find_package(), this function
 # will take care of exporting as global variables the variables defined by the builtin find_package(), and to make
 # the imported targets defined by the builtin find_package() global.
-function(find_package_plus NAME)
-  message(STATUS "Invoking the patched 'find_package()' function for dependency ${NAME}.")
+function(find_package_plus _VAD_NAME)
+  message(STATUS "Invoking the patched 'find_package()' function for dependency ${_VAD_NAME}.")
   # As a first step we want to erase from the cache all the variables that were exported by a previous call
-  # to find_package_plus(). These variables are stored in a variable called VAD_NEW_VARS_${NAME}, which we will
+  # to find_package_plus(). These variables are stored in a variable called VAD_NEW_VARS_${_VAD_NAME}, which we will
   # also remove.
-  foreach(_NEWVAR ${VAD_NEW_VARS_${NAME}})
+  foreach(_NEWVAR ${VAD_NEW_VARS_${_VAD_NAME}})
     unset(${_NEWVAR} CACHE)
   endforeach()
-  unset(VAD_NEW_VARS_${NAME} CACHE)
+  unset(VAD_NEW_VARS_${_VAD_NAME} CACHE)

   # Get the list of the currently defined variables.
-  get_cmake_property(_OLD_VARIABLES_${NAME} VARIABLES)
+  get_cmake_property(_OLD_VARIABLES_${_VAD_NAME} VARIABLES)
   # Call the original find_package().
-  _find_package(${NAME} ${ARGN})
+  _find_package(${_VAD_NAME} ${ARGN})
   # Detect new variables defined by find_package() and make them cached.
-  get_cmake_property(_NEW_VARIABLES_${NAME} VARIABLES)
+  get_cmake_property(_NEW_VARIABLES_${_VAD_NAME} VARIABLES)
   # Remove duplicates in the new vars list.
-  list(REMOVE_DUPLICATES _NEW_VARIABLES_${NAME})
+  list(REMOVE_DUPLICATES _NEW_VARIABLES_${_VAD_NAME})
   # Create a lower case version of the package name. We will use this in string matching below.
-  string(TOLOWER "${NAME}" _NAME_LOW)
+  string(TOLOWER "${_VAD_NAME}" _NAME_LOW)
   # Detect the new variables by looping over the new vars list and comparing its elements to the old vars.
   # We will append the detected variables to the _DIFFVARS list.
   set(_DIFFVARS)
-  foreach(_NEWVAR ${_NEW_VARIABLES_${NAME}})
-      list(FIND _OLD_VARIABLES_${NAME} "${_NEWVAR}" _NEWVARIDX)
+  foreach(_NEWVAR ${_NEW_VARIABLES_${_VAD_NAME}})
+      list(FIND _OLD_VARIABLES_${_VAD_NAME} "${_NEWVAR}" _NEWVARIDX)
       if(_NEWVARIDX EQUAL -1)
           # New var was not found among the old ones. We check if it is not an internal variable,
           # in which case we will add it to the cached variables.
           string(TOLOWER "${_NEWVAR}" _NEWVAR_LOW)
-          if(NOT _NEWVAR_LOW MATCHES "^_" AND NOT _NEWVAR_LOW MATCHES "^vad" AND NOT _NEWVAR_LOW MATCHES "^find_package")
+          # We forcefully exclude variables named in a certain way:
+          # - starts with underscore "_",
+          # - vad-related variables,
+          # - variables set by CMake's builtin find_package,
+          # - args* (these are arguments to macros/functions).
+          if(NOT _NEWVAR_LOW MATCHES "^_" AND NOT _NEWVAR_LOW MATCHES "^vad" AND NOT _NEWVAR_LOW MATCHES "^find_package" AND NOT _NEWVAR_LOW MATCHES "^argv[0-9]*" AND NOT _NEWVAR_LOW MATCHES "^argc" AND NOT _NEWVAR_LOW MATCHES "^argn")
             # Make sure we don't store multiline strings in the cache, as that is not supported.
             string(REPLACE "\n" ";" _NEWVAR_NO_NEWLINES "${${_NEWVAR}}")
             if(VAD_VERBOSE)
@@ -232,7 +237,7 @@
       endif()
   endforeach()
   # Store a list of the variables that were exported as cache variables.
-  set(VAD_NEW_VARS_${NAME} ${_DIFFVARS} CACHE INTERNAL "")
+  set(VAD_NEW_VARS_${_VAD_NAME} ${_DIFFVARS} CACHE INTERNAL "")

   # Now take care of turning any IMPORTED non-GLOBAL target defined by a find_package() call into a GLOBAL one.
   make_imported_targets_global()


Add tensorflow/contrib/linalg module to tf_python.cmake

--- tensorflow/contrib/cmake/tf_python.cmake
+++ tensorflow/contrib/cmake/tf_python.cmake
@@ -301,6 +301,10 @@
 add_python_module("tensorflow/contrib/learn/python/learn/tests")
 add_python_module("tensorflow/contrib/learn/python/learn/tests/dataframe")
 add_python_module("tensorflow/contrib/learn/python/learn/utils")
+add_python_module("tensorflow/contrib/linalg")
+add_python_module("tensorflow/contrib/linalg/python")
+add_python_module("tensorflow/contrib/linalg/python/ops")
+add_python_module("tensorflow/contrib/linalg/python/kernel_tests")
 add_python_module("tensorflow/contrib/linear_optimizer")
 add_python_module("tensorflow/contrib/linear_optimizer/kernels")
 add_python_module("tensorflow/contrib/linear_optimizer/kernels/g3doc")


Adding in text to fatal error out if used. It is being replaced with a configured file instead.

--- Resources/CMake/InstallMXASupportLibraries.cmake
+++ Resources/CMake/InstallMXASupportLibraries.cmake
@@ -1,7 +1,7 @@
 # ------------------------------------------------------------------------------
 # This CMake code installs the needed support libraries on NON OSX platforms
 # ------------------------------------------------------------------------------
-
+message(FATAL_ERROR " This file is NOT used anymore. ")
 #------- Macro to find and install the proper dynamic libraries ----------------
 MACRO (MXA_INSTALL_SUPPORT_LIBRARY basename)
     IF (HAVE_${basename}_DLL)


scripts: if 64-bit, find_library() should search the lib64 (#189)

--- bin/dsn.cmake
+++ bin/dsn.cmake
@@ -269,6 +269,11 @@
 function(dsn_setup_system_libs)
     find_package(Threads REQUIRED)

+    if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+        set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ON)
+        message(STATUS "FIND_LIBRARY_USE_LIB64_PATHS = ON")
+    endif()
+
     set(DSN_SYSTEM_LIBS "")

     find_library(DSN_LIB_RT NAMES rt)


use OGRE_LIB_DIRECTORY when determining OGRE_PLUGIN_PATH for OGREConfig.cmake

--- CMake/InstallResources.cmake
+++ CMake/InstallResources.cmake
@@ -212,7 +212,7 @@
 if(WIN32)
   set(OGRE_PLUGIN_DIR_CMAKE "bin")
 else()
-  set(OGRE_PLUGIN_DIR_CMAKE "lib/OGRE")
+  set(OGRE_PLUGIN_DIR_CMAKE "${OGRE_LIB_DIRECTORY}/OGRE")
 endif()
 configure_package_config_file(${OGRE_TEMPLATES_DIR}/OGREConfig.cmake.in ${PROJECT_BINARY_DIR}/cmake/OGREConfig.cmake
     INSTALL_DESTINATION ${OGRE_CMAKE_DIR}
@@ -229,4 +229,4 @@
 install(EXPORT OgreTargetsRelease CONFIGURATIONS Release None "" DESTINATION ${OGRE_CMAKE_DIR} FILE OgreTargets.cmake)
 install(EXPORT OgreTargetsRelWithDebInfo CONFIGURATIONS RelWithDebInfo DESTINATION ${OGRE_CMAKE_DIR} FILE OgreTargets.cmake)
 install(EXPORT OgreTargetsMinSizeRel CONFIGURATIONS MinSizeRel DESTINATION ${OGRE_CMAKE_DIR} FILE OgreTargets.cmake)
-install(EXPORT OgreTargetsDebug CONFIGURATIONS Debug DESTINATION ${OGRE_CMAKE_DIR} FILE OgreTargets.cmake)+install(EXPORT OgreTargetsDebug CONFIGURATIONS Debug DESTINATION ${OGRE_CMAKE_DIR} FILE OgreTargets.cmake)


vtkTestingMacros: Temporarily remove baselines from VTKData

Teach vtk_add_test_* remove baseline images for each test from the
VTKData or VTKLargeData tree.  This is a temporary change meant only for
use locally to transition VTKData and VTKLargeData baseline images to
ExternalData content links.

Change-Id: I510418dd367ae01995992bfb3b9df0bb021e27da

--- CMake/vtkTestingMacros.cmake
+++ CMake/vtkTestingMacros.cmake
@@ -1,12 +1,8 @@
 macro(vtk_test_data_transform data_dir base_dir name)
   set(module_base_dir ${${vtk-module}_SOURCE_DIR}/Testing/Data/Baseline)
   set(in "${data_dir}/Baseline/${base_dir}/${name}.png")
-  if(EXISTS "${in}")
-    file(GLOB in_ "${data_dir}/Baseline/${base_dir}/${name}_*.png")
-    file(COPY ${in} ${in_} DESTINATION ${module_base_dir})
-  else()
-    message(FATAL_ERROR "Baseline does not exist:\n ${in}")
-  endif()
+  file(GLOB in_ "${data_dir}/Baseline/${base_dir}/${name}_*.png")
+  file(REMOVE ${in} ${in_})
 endmacro()

 # -----------------------------------------------------------------------------


Fix error in FCLMacros.cmake

Fix error in FCLMacros.cmake

--- CMakeModules/FCLMacros.cmake
+++ CMakeModules/FCLMacros.cmake
@@ -19,18 +19,15 @@
   string(LENGTH ${_suffix_to_remove} suffix_length)
   foreach(header ${ARGN})
     string(LENGTH ${header} full_length)
-    string(
-      SUBSTRING
-      ${header}
-      ${suffix_length}
-      ${full_length}-${suffix_length}
-      header)
-      if(${header} MATCHES "/detail/")
-        continue()
-      endif()
-      if(${header} MATCHES "-impl.h")
-        continue()
-      endif()
+    math(EXPR relative_path "${full_length} - ${suffix_length}")
+    string(LENGTH ${relative_path} relative_path_length)
+    string(SUBSTRING ${header} ${suffix_length} ${relative_path_length} header)
+    if(${header} MATCHES "/detail/")
+      continue()
+    endif()
+    if(${header} MATCHES "-impl.h")
+      continue()
+    endif()
     fcl_append_to_cached_string(
       ${_var}
       ${_cacheDesc}"_HEADER_NAMES"


FindCBLAS.cmake: Fix setting CBLAS_INCLUDE_DIR if PkgConfig is used

--- CMakeModules/FindCBLAS.cmake
+++ CMakeModules/FindCBLAS.cmake
@@ -39,8 +39,14 @@
     LIST(APPEND CBLAS_LIBRARIES ${${PC_LIB}_LIBRARY})
   ENDFOREACH(PC_LIB)

-  FIND_PACKAGE_HANDLE_STANDARD_ARGS(CBLAS DEFAULT_MSG CBLAS_LIBRARIES)
-  MARK_AS_ADVANCED(CBLAS_LIBRARIES)
+  FIND_PATH(CBLAS_INCLUDE_DIRS NAMES cblas.h HINTS ${PC_CBLAS_INCLUDE_DIRS} )
+  IF (NOT CBLAS_INCLUDE_DIRS)
+    message(FATAL_ERROR "Something is wrong in your pkg-config file - cblas.h not found in ${PC_CBLAS_INCLUDE_DIRS}")
+  ENDIF (NOT CBLAS_INCLUDE_DIRS)
+  SET(CBLAS_INCLUDE_DIR ${CBLAS_INCLUDE_DIRS})
+
+  FIND_PACKAGE_HANDLE_STANDARD_ARGS(CBLAS DEFAULT_MSG CBLAS_LIBRARIES CBLAS_INCLUDE_DIR)
+  MARK_AS_ADVANCED(CBLAS_LIBRARIES CBLAS_INCLUDE_DIR)

 ELSE(PC_CBLAS_FOUND)


Add header-only package processing function

--- BdeBuildSystem/BdeTargetUtils.cmake
+++ BdeBuildSystem/BdeTargetUtils.cmake
@@ -546,3 +546,31 @@
         bbs_install_library(${target})
     endif()
 endfunction()
+
+function(bbs_setup_header_only_pkg pkg)
+    cmake_parse_arguments(PARSE_ARGV 1
+                          ""
+                          ""
+                          "SOURCE_DIR"
+                          "")
+    bbs_assert_no_unparsed_args("")
+
+    bbs_read_package_metadata(${pkg} ${CMAKE_CURRENT_SOURCE_DIR})
+
+    # Create package interface library with include folder.
+    add_library(${pkg}-iface INTERFACE)
+    bbs_add_target_include_dirs(${pkg}-iface INTERFACE ${${pkg}_INCLUDE_DIRS})
+
+    # Create package library with transitive dependency on interface.
+    add_library(${pkg} INTERFACE)
+    target_link_libraries(${pkg} INTERFACE ${pkg}-iface)
+
+    # Add inter-package dependencies for interface and package libraries.
+    foreach(p ${${pkg}_PCDEPS})
+        target_link_libraries(${pkg}-iface INTERFACE ${p}-iface)
+        target_link_libraries(${pkg} INTERFACE ${p})
+    endforeach()
+
+    list(APPEND bsl_INCLUDE_FILES ${${pkg}_INCLUDE_FILES})
+    set(bsl_INCLUDE_FILES  ${bsl_INCLUDE_FILES}  PARENT_SCOPE)
+endfunction()


build: XP_UNIX/XP_WIN switch

build: XP_UNIX/XP_WIN switch

--- CMakeModules/FindSpidermonkey.cmake
+++ CMakeModules/FindSpidermonkey.cmake
@@ -25,9 +25,15 @@
     SET(Spidermonkey_FIND_QUIETLY TRUE)
 ENDIF()

+IF(WIN32)
+    SET(SPIDERMONKEY_PLATFORM XP_WIN)
+ELSE()
+    SET(SPIDERMONKEY_PLATFORM XP_UNIX)
+ENDIF()
+
 SET(
     SPIDERMONKEY_DEFINITIONS
-    -DXP_UNIX -DJS_C_STRINGS_ARE_UTF8
+    -D${SPIDERMONKEY_PLATFORM} -DJS_C_STRINGS_ARE_UTF8
     CACHE STRING "Spidermonkey definitions")

 FIND_PATH(SPIDERMONKEY_INCLUDE_DIR js/jsapi.h)


cmake: Fixed test failure on AllocLetTestFree.Create.

--- cmake/Modules/CppUTestConfigurationOptions.cmake
+++ cmake/Modules/CppUTestConfigurationOptions.cmake
@@ -23,8 +23,10 @@

 if (MEMORY_LEAK_DETECTION)
     if (MSVC)
+        set(CPPUTEST_C_FLAGS "${CPPUTEST_C_FLAGS} /FI ${CppUTestRootDirectory}/include/CppUTest/MemoryLeakDetectorMallocMacros.h")
         set(CPPUTEST_CXX_FLAGS "${CPPUTEST_CXX_FLAGS} /FI ${CppUTestRootDirectory}/include/CppUTest/MemoryLeakDetectorMallocMacros.h")
     else (MSVC)
+        set(CPPUTEST_C_FLAGS "${CPPUTEST_C_FLAGS} -include ${CppUTestRootDirectory}/include/CppUTest/MemoryLeakDetectorMallocMacros.h")
         set(CPPUTEST_CXX_FLAGS "${CPPUTEST_CXX_FLAGS} -include ${CppUTestRootDirectory}/include/CppUTest/MemoryLeakDetectorNewMacros.h")
         set(CPPUTEST_CXX_FLAGS "${CPPUTEST_CXX_FLAGS} -include ${CppUTestRootDirectory}/include/CppUTest/MemoryLeakDetectorMallocMacros.h")
     endif (MSVC)


Make C++11 change backwards compatible

Make C++11 change backwards compatible

--- cmake/Modules/CppUTestConfigurationOptions.cmake
+++ cmake/Modules/CppUTestConfigurationOptions.cmake
@@ -85,16 +85,19 @@
         )
 endif()

+if(DEFINED C++11)
+    message(DEPRECATION
+        "The C++11 option is deprecated. "
+        "Set CMAKE_CXX_STANDARD explicitly."
+    )
+    if(C++11 AND NOT CMAKE_CXX_STANDARD)
+        set(CMAKE_CXX_STANDARD 11)
+    endif()
+endif()
+
 if (CMAKE_CXX_STANDARD)
     set(CMAKE_CXX_EXTENSIONS OFF)
 endif ()
-
-if(DEFINED C++11)
-    message(WARNING
-        "The C++11 option is no longer supported. "
-        "Set the CMAKE_CXX_STANDARD explicitly."
-    )
-endif()

 set(GMOCK_HOME $ENV{GMOCK_HOME})
 if (DEFINED ENV{GMOCK_HOME})


Undo changes for the location of X11 for MacOSX

--- cmake/modules/SearchInstalledSoftware.cmake
+++ cmake/modules/SearchInstalledSoftware.cmake
@@ -275,8 +275,7 @@
     endif()
   endif()
   if(APPLE)
-    find_path(OPENGL_INCLUDE_DIR GL/gl.h DOC "Include for OpenGL on OSX"
-              PATHS /opt/X11/include)
+    find_path(OPENGL_INCLUDE_DIR GL/gl.h DOC "Include for OpenGL on OSX")
   endif()
 endif()


SuperBuild: avoid variables in URL for source archive generator

--- SuperBuild/CMake/External_itk.cmake
+++ SuperBuild/CMake/External_itk.cmake
@@ -146,7 +146,7 @@

   ExternalProject_Add(ITK
     PREFIX ITK
-    URL "http://sourceforge.net/projects/itk/files/itk/${ITK_SB_VERSION}/InsightToolkit-${ITK_SB_VERSION_FULL}.tar.gz/download"
+    URL "http://sourceforge.net/projects/itk/files/itk/4.8/InsightToolkit-4.8.1.tar.gz/download"
     URL_MD5 b1ed53604de854501cb61f34f410420e
     SOURCE_DIR ${ITK_SB_SRC}
     BINARY_DIR ${ITK_SB_BUILD_DIR}


SuperBuild: obsolete option for OTB build

--- SuperBuild/CMake/External_otb.cmake
+++ SuperBuild/CMake/External_otb.cmake
@@ -187,7 +187,6 @@
   -DOTB_USE_MUPARSERX:BOOL=${OTB_USE_MUPARSERX}
   -DOTB_USE_OPENCV:BOOL=${OTB_USE_OPENCV}
   -DOTB_USE_SHARK:BOOL=${OTB_USE_SHARK}
-  -DOTB_USE_OPENJPEG:BOOL=OFF
   -DOTB_USE_QT4:BOOL=${OTB_USE_QT4}
   -DOTB_USE_SIFTFAST:BOOL=${OTB_USE_SIFTFAST}
   -DOTB_USE_OPENGL:BOOL=${OTB_USE_OPENGL}


WIN32 packaging: fix un-updated path to ico that prevented the nsis packaging

Having a wrong path for the CPACK_NSIS_MUI_ICON made NSIS fail with cryptic error:
CPack Error: Problem running NSIS command: "C:/Program Files (x86)/NSIS/makensis.exe" "C:/lv-b/_CPack_Packages/win64/NSIS/project.nsi"
Please check C:/lv-b/_CPack_Packages/win64/NSIS/NSISOutput.log for errors

--- Superbuild/Projects/win32/lidarview.bundle.cmake
+++ Superbuild/Projects/win32/lidarview.bundle.cmake
@@ -8,7 +8,7 @@

 set(CPACK_NSIS_HELP_LINK "https://www.paraview.org/lidarview/")
 set(${SOFTWARE_NAME}_description "${SOFTWARE_NAME} ${lidarview_version_full}")
-set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_LIST_DIR}/../../../SoftwareInformation/logo.ico")
+set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_LIST_DIR}/../../../Application/SoftwareInformation/logo.ico")

 set(library_paths "lib")


Add CONAN_OPTIONS

Add CONAN_OPTIONS

--- CMake/Conan.cmake
+++ CMake/Conan.cmake
@@ -13,6 +13,7 @@

   conan_add_remote(NAME bincrafters URL https://api.bintray.com/conan/bincrafters/public-conan)
   set(CONAN_DEPENDENCIES catch2/2.11.0 tl-expected/20190710)
+  set(CONAN_OPTIONS "")

   if(WIN32)
     list(APPEND CONAN_DEPENDENCIES propagate_const/1.0.0@public-conan/testing)
@@ -21,6 +22,7 @@

   if(NOT TI_IS_CLANG_CL)
     list(APPEND CONAN_DEPENDENCIES wxwidgets/3.1.2@bincrafters/stable)
+    list(APPEND CONAN_OPTIONS wxwidgets:compatibility=3.1 wxwidgets:debugreport=False)
   endif()

   conan_cmake_run(
@@ -30,5 +32,7 @@
     CMAKE_TARGETS # individual targets to link to
     BUILD
     missing
+    OPTIONS
+    ${CONAN_OPTIONS}
   )
 endmacro()


fbcode_builder: update ThriftCppLibrary to use fb_cmake_parse_args()

Summary:
Change ThriftCppLibrary to use `fb_cmake_parse_args()`

This code doesn't really care much about handling empty arguments, so we could
use the standard `cmake_parse_arguments()` function here instead of
`fb_cmake_parse_args()`.  However, it is slightly more convenient that
`fb_cmake_parse_args()` automatically errors out on unhandled arguments, so
that we don't have to check for this ourselves.

Reviewed By: wez

Differential Revision: D16738445

fbshipit-source-id: 67b9761f2ceaf7665bd336290bb44af32fec6f4a

--- build/fbcode_builder/CMake/ThriftCppLibrary.cmake
+++ build/fbcode_builder/CMake/ThriftCppLibrary.cmake
@@ -1,34 +1,13 @@
 # Copyright (c) Facebook, Inc. and its affiliates.
 # NOTE: If you change this file, fbcode/fboss/github/ThriftCppLibrary.cmake also
 # needs to be changed.  TODO: this should be handled via shipit.
+
+include(FBCMakeParseArgs)
+
 function(add_thrift_cpp2_library LIB_NAME THRIFT_FILE)
   # Parse the arguments
-  set(SERVICES)
-  set(DEPENDS)
-  set(GEN_ARGS)
-  set(mode "UNSET")
-  foreach(arg IN LISTS ARGN)
-    if("${arg}" STREQUAL "SERVICES")
-      set(mode "SERVICES")
-    elseif("${arg}" STREQUAL "DEPENDS")
-      set(mode "DEPENDS")
-    elseif("${arg}" STREQUAL "OPTIONS")
-      set(mode "OPTIONS")
-    else()
-      if("${mode}" STREQUAL "SERVICES")
-        list(APPEND SERVICES "${arg}")
-      elseif("${mode}" STREQUAL "DEPENDS")
-        list(APPEND DEPENDS "${arg}")
-      elseif("${mode}" STREQUAL "OPTIONS")
-        list(APPEND GEN_ARGS "${arg}")
-      else()
-        message(
-          FATAL_ERROR
-          "expected SERVICES, DEPENDS, or OPTIONS argument, found ${arg}"
-        )
-      endif()
-    endif()
-  endforeach()
+  set(multi_value_args SERVICES DEPENDS OPTIONS)
+  fb_cmake_parse_args(ARG "" "" "${multi_value_args}" "${ARGN}")

   get_filename_component(base ${THRIFT_FILE} NAME_WE)
   get_filename_component(
@@ -42,11 +21,11 @@
   get_filename_component(include_prefix ${include_prefix} DIRECTORY)

   if (NOT "${include_prefix}" STREQUAL "")
-    list(APPEND GEN_ARGS "include_prefix=${include_prefix}")
+    list(APPEND ARG_OPTIONS "include_prefix=${include_prefix}")
   endif()
   # CMake 3.12 is finally getting a list(JOIN) function, but until then
   # treating the list as a string and replacing the semicolons is good enough.
-  string(REPLACE ";" "," GEN_ARG_STR "${GEN_ARGS}")
+  string(REPLACE ";" "," GEN_ARG_STR "${ARG_OPTIONS}")

   # Compute the list of generated files
   list(APPEND generated_headers
@@ -61,7 +40,7 @@
     ${output_dir}/gen-cpp2/${base}_data.cpp
     ${output_dir}/gen-cpp2/${base}_types.cpp
   )
-  foreach(service IN LISTS SERVICES)
+  foreach(service IN LISTS ARG_SERVICES)
     list(APPEND generated_headers
       ${output_dir}/gen-cpp2/${service}.h
       ${output_dir}/gen-cpp2/${service}.tcc
@@ -77,7 +56,7 @@
   endforeach()

   list(APPEND thrift_include_options -I ${CMAKE_SOURCE_DIR})
-  foreach(depends IN LISTS DEPENDS)
+  foreach(depends IN LISTS ARG_DEPENDS)
     get_property(thrift_include_directory
       TARGET ${depends}
       PROPERTY THRIFT_INCLUDE_DIRECTORY)
@@ -114,7 +93,7 @@
     MAIN_DEPENDENCY
       ${THRIFT_FILE}
     DEPENDS
-      ${DEPENDS}
+      ${ARG_DEPENDS}
   )

   # Now emit the library rule to compile the sources
@@ -139,7 +118,7 @@
   target_link_libraries(
     ${LIB_NAME}
     PUBLIC
-      ${DEPENDS}
+      ${ARG_DEPENDS}
       FBThrift::thriftcpp2
       Folly::folly
   )


remove unproperly parsed CMake comment

remove unproperly parsed CMake comment

https://github.com/openscenegraph/OpenSceneGraph/issues/812

--- CMakeModules/FindFontconfig.cmake
+++ CMakeModules/FindFontconfig.cmake
@@ -1,7 +1,6 @@
 # Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
 # file Copyright.txt or https://cmake.org/licensing for details.

-#[=======================================================================[.rst:
 FindFontconfig
 --------------

@@ -29,9 +28,6 @@
 ``FONTCONFIG_COMPILE_OPTIONS``
   this should be passed to target_compile_options(), if the
   target is not used for linking
-
-#]=======================================================================]
-

 # use pkg-config to get the directories and then use these values
 # in the FIND_PATH() and FIND_LIBRARY() calls


ENH: vtkStreamingDemandDrivePipeline header file generally  not needed

--- Utilities/Upgrading/NewPipeConvertPolyData.cmake
+++ Utilities/Upgrading/NewPipeConvertPolyData.cmake
@@ -59,7 +59,7 @@
   IF (NOT "${CXX_CONTENTS}" MATCHES ".*vtkInformation.h.*")
     STRING (REGEX REPLACE
       "vtkObjectFactory.h"
-      "vtkInformation.h\"\n#include \"vtkInformationVector.h\"\n#include \"vtkObjectFactory.h\"\n#include \"vtkStreamingDemandDrivenPipeline.h"
+      "vtkInformation.h\"\n#include \"vtkInformationVector.h\"\n#include \"vtkObjectFactory.h"
       CXX_CONTENTS "${CXX_CONTENTS}")
   ENDIF (NOT "${CXX_CONTENTS}" MATCHES ".*vtkInformation.h.*")
 ENDIF ("${CXX_CONTENTS}" MATCHES ".*vtkInformation.*")


Updated boost compute version tags

Updated boost compute version tags

--- CMakeModules/build_boost_compute.cmake
+++ CMakeModules/build_boost_compute.cmake
@@ -1,6 +1,6 @@
-SET(VER 79aa8f9086fdf6ef6db78e889de0273b0eb7bd19)
+SET(VER cf5e40ee265f005b144c4e0dda945734188e8542)
 SET(URL https://github.com/boostorg/compute/archive/${VER}.tar.gz)
-SET(MD5 dba3318cbdac912dddce71f2a38ffa43)
+SET(MD5 a8d0bc4d70f3b7d65fea78327a4e067e)

 SET(thirdPartyDir "${CMAKE_BINARY_DIR}/third_party")
 SET(srcDir "${thirdPartyDir}/compute-${VER}")


Added another alternate, default location for DirectX SDK files. Reviewed by Mani

--- indra/cmake/DirectX.cmake
+++ indra/cmake/DirectX.cmake
@@ -6,6 +6,7 @@
             "C:/Program Files/Microsoft DirectX SDK (March 2008)/Include"
             "C:/Program Files/Microsoft DirectX SDK (November 2007)/Include"
             "C:/DX90SDK/Include"
+            "C:/Program Files/DX90SDK/Include"
             )
   if (DIRECTX_INCLUDE_DIR)
     include_directories(${DIRECTX_INCLUDE_DIR})
@@ -21,7 +22,7 @@
             "$ENV{DXSDK_DIR}/Lib/x86"
             "C:/Program Files/Microsoft DirectX SDK (March 2008)/Lib/x86"
             "C:/Program Files/Microsoft DirectX SDK (November 2007)/Lib/x86"
-            "C:/DX90SDK/Lib"
+            "C:/Program Files/DX90SDK/Lib"
             )
   if (DIRECTX_LIBRARY_DIR)
     if (DIRECTX_FIND_QUIETLY)


BUG :otbapp must be installed to lib/otb/application (always)

--- Packaging/install_rule.cmake
+++ Packaging/install_rule.cmake
@@ -42,17 +42,13 @@
       continue()
     elseif("${sfile_ABS_LOWER}" MATCHES "\\.la$")
       continue()
-    elseif("${sfile_NAME_LOWER}" MATCHES "^otbapp_")
-      set(install_dir "lib/otb/applications")
-      set(install_type PROGRAMS)
-      install_otbapp_wrapper_scripts(${sfile_NAME})
     else()
       if(UNIX)
-	#the last else() loop where we run a 'file' command to find file type and directory
-	set(install_type)
-	set(install_dir)
-	#this is whole other story
-	detect_using_file_command(${sfile_ABS} install_type install_dir)
+        #the last else() loop where we run a 'file' command to find file type and directory
+        set(install_type)
+        set(install_dir)
+        #this is whole other story
+        detect_using_file_command(${sfile_ABS} install_type install_dir)
       endif(UNIX)
     endif()

@@ -64,9 +60,18 @@
       continue()
     endif()

-    if(NOT install_type OR NOT install_type)
+    # This check comes outside the first if-elseif ladder
+    # because no matter what extension of file type, otbapp_* must go
+    # into lib/otb/applications
+  if("${sfile_NAME_LOWER}" MATCHES "^otbapp_")
+    install_otbapp_wrapper_scripts(${sfile_NAME})
+    set(install_dir "lib/otb/applications")
+    set(install_type PROGRAMS)
+  endif()
+
+    if(NOT install_type OR NOT install_dir)
       #throw fatal error and return
-      message(FATAL_ERROR "sfile_ABS=${sfile_ABS}.\ninstall_type=${install_dir}\ninstall_dir=${install_dir}")
+      message(FATAL_ERROR "sfile_ABS=${sfile_ABS}.\ninstall_type=${install_type}\ninstall_dir=${install_dir}")
       return()
     endif()