use new FindTBB.cmake obtained from https://github.com/justusc/FindTBB

--- cmake/Modules/FindTBB.cmake
+++ cmake/Modules/FindTBB.cmake
@@ -1,283 +1,303 @@
-# Locate Intel Threading Building Blocks include paths and libraries
-# FindTBB.cmake can be found at https://code.google.com/p/findtbb/
-# Written by Hannes Hofmann <hannes.hofmann _at_ informatik.uni-erlangen.de>
-# Improvements by Gino van den Bergen <gino _at_ dtecta.com>,
-#   Florian Uhlig <F.Uhlig _at_ gsi.de>,
-#   Jiri Marsik <jiri.marsik89 _at_ gmail.com>
-
-# The MIT License
-#
-# Copyright (c) 2011 Hannes Hofmann
-#
+# The MIT License (MIT)
+#
+# Copyright (c) 2015 Justus Calvin
+#
 # Permission is hereby granted, free of charge, to any person obtaining a copy
 # of this software and associated documentation files (the "Software"), to deal
 # in the Software without restriction, including without limitation the rights
 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 # copies of the Software, and to permit persons to whom the Software is
 # furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
+#
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+#
 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-# GvdB: This module uses the environment variable TBB_ARCH_PLATFORM which defines architecture and compiler.
-#   e.g. "ia32/vc8" or "em64t/cc4.1.0_libc2.4_kernel2.6.16.21"
-#   TBB_ARCH_PLATFORM is set by the build script tbbvars[.bat|.sh|.csh], which can be found
-#   in the TBB installation directory (TBB_INSTALL_DIR).
-#
-# GvdB: Mac OS X distribution places libraries directly in lib directory.
-#
-# For backwards compatibility, you may explicitely set the CMake variables TBB_ARCHITECTURE and TBB_COMPILER.
-# TBB_ARCHITECTURE [ ia32 | em64t | itanium ]
-#   which architecture to use
-# TBB_COMPILER e.g. vc9 or cc3.2.3_libc2.3.2_kernel2.4.21 or cc4.0.1_os10.4.9
-#   which compiler to use (detected automatically on Windows)
-
-# This module respects
-# TBB_INSTALL_DIR or $ENV{TBB21_INSTALL_DIR} or $ENV{TBB_INSTALL_DIR}
-
-# This module defines
-# TBB_INCLUDE_DIRS, where to find task_scheduler_init.h, etc.
-# TBB_LIBRARY_DIRS, where to find libtbb, libtbbmalloc
-# TBB_DEBUG_LIBRARY_DIRS, where to find libtbb_debug, libtbbmalloc_debug
-# TBB_INSTALL_DIR, the base TBB install directory
-# TBB_LIBRARIES, the libraries to link against to use TBB.
-# TBB_DEBUG_LIBRARIES, the libraries to link against to use TBB with debug symbols.
-# TBB_FOUND, If false, don't try to use TBB.
-# TBB_INTERFACE_VERSION, as defined in tbb/tbb_stddef.h
-
-
-if (WIN32)
-    # has em64t/vc8 em64t/vc9
-    # has ia32/vc7.1 ia32/vc8 ia32/vc9
-    set(_TBB_DEFAULT_INSTALL_DIR "C:/Program Files/Intel/TBB" "C:/Program Files (x86)/Intel/TBB")
-    set(_TBB_LIB_NAME "tbb")
-    set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
-    set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
-    set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")
-    if (MSVC71)
-        set (_TBB_COMPILER "vc7.1")
-    endif(MSVC71)
-    if (MSVC80)
-        set(_TBB_COMPILER "vc8")
-    endif(MSVC80)
-    if (MSVC90)
-        set(_TBB_COMPILER "vc9")
-    endif(MSVC90)
-    if(MSVC10)
-        set(_TBB_COMPILER "vc10")
-    endif(MSVC10)
-    # Todo: add other Windows compilers such as ICL.
-    set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
-endif (WIN32)
-
-if (UNIX)
-    if (APPLE)
-        # MAC
-        set(_TBB_DEFAULT_INSTALL_DIR "/Library/Frameworks/Intel_TBB.framework/Versions")
-        # libs: libtbb.dylib, libtbbmalloc.dylib, *_debug
-        set(_TBB_LIB_NAME "tbb")
-        set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
-        set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
-        set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")
-        # default flavor on apple: ia32/cc4.0.1_os10.4.9
-        # Jiri: There is no reason to presume there is only one flavor and
-        #       that user's setting of variables should be ignored.
-        if(NOT TBB_COMPILER)
-            set(_TBB_COMPILER "cc4.0.1_os10.4.9")
-        elseif (NOT TBB_COMPILER)
-            set(_TBB_COMPILER ${TBB_COMPILER})
-        endif(NOT TBB_COMPILER)
-        if(NOT TBB_ARCHITECTURE)
-            set(_TBB_ARCHITECTURE "ia32")
-        elseif(NOT TBB_ARCHITECTURE)
-            set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
-        endif(NOT TBB_ARCHITECTURE)
-    else (APPLE)
-        # LINUX
-        set(_TBB_DEFAULT_INSTALL_DIR "/opt/intel/tbb" "/usr/local/include" "/usr/include")
-        set(_TBB_LIB_NAME "tbb")
-        set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
-        set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
-        set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")
-        # has em64t/cc3.2.3_libc2.3.2_kernel2.4.21 em64t/cc3.3.3_libc2.3.3_kernel2.6.5 em64t/cc3.4.3_libc2.3.4_kernel2.6.9 em64t/cc4.1.0_libc2.4_kernel2.6.16.21
-        # has ia32/*
-        # has itanium/*
-        set(_TBB_COMPILER ${TBB_COMPILER})
-        set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
-    endif (APPLE)
-endif (UNIX)
-
-if (CMAKE_SYSTEM MATCHES "SunOS.*")
-# SUN
-# not yet supported
-# has em64t/cc3.4.3_kernel5.10
-# has ia32/*
-endif (CMAKE_SYSTEM MATCHES "SunOS.*")
-
-
-#-- Clear the public variables
-set (TBB_FOUND "NO")
-
-
-#-- Find TBB install dir and set ${_TBB_INSTALL_DIR} and cached ${TBB_INSTALL_DIR}
-# first: use CMake variable TBB_INSTALL_DIR
-if (TBB_INSTALL_DIR)
-    set (_TBB_INSTALL_DIR ${TBB_INSTALL_DIR})
-endif (TBB_INSTALL_DIR)
-# second: use environment variable
-if (NOT _TBB_INSTALL_DIR)
-    if (NOT "$ENV{TBB_INSTALL_DIR}" STREQUAL "")
-        set (_TBB_INSTALL_DIR $ENV{TBB_INSTALL_DIR})
-    endif (NOT "$ENV{TBB_INSTALL_DIR}" STREQUAL "")
-    # Intel recommends setting TBB21_INSTALL_DIR
-    if (NOT "$ENV{TBB21_INSTALL_DIR}" STREQUAL "")
-        set (_TBB_INSTALL_DIR $ENV{TBB21_INSTALL_DIR})
-    endif (NOT "$ENV{TBB21_INSTALL_DIR}" STREQUAL "")
-    if (NOT "$ENV{TBB22_INSTALL_DIR}" STREQUAL "")
-        set (_TBB_INSTALL_DIR $ENV{TBB22_INSTALL_DIR})
-    endif (NOT "$ENV{TBB22_INSTALL_DIR}" STREQUAL "")
-    if (NOT "$ENV{TBB30_INSTALL_DIR}" STREQUAL "")
-        set (_TBB_INSTALL_DIR $ENV{TBB30_INSTALL_DIR})
-    endif (NOT "$ENV{TBB30_INSTALL_DIR}" STREQUAL "")
-endif (NOT _TBB_INSTALL_DIR)
-# third: try to find path automatically
-if (NOT _TBB_INSTALL_DIR)
-    if (_TBB_DEFAULT_INSTALL_DIR)
-        set (_TBB_INSTALL_DIR ${_TBB_DEFAULT_INSTALL_DIR})
-    endif (_TBB_DEFAULT_INSTALL_DIR)
-endif (NOT _TBB_INSTALL_DIR)
-# sanity check
-if (NOT _TBB_INSTALL_DIR)
-    message ("ERROR: Unable to find Intel TBB install directory. ${_TBB_INSTALL_DIR}")
-else (NOT _TBB_INSTALL_DIR)
-# finally: set the cached CMake variable TBB_INSTALL_DIR
-if (NOT TBB_INSTALL_DIR)
-    set (TBB_INSTALL_DIR ${_TBB_INSTALL_DIR} CACHE PATH "Intel TBB install directory")
-    mark_as_advanced(TBB_INSTALL_DIR)
-endif (NOT TBB_INSTALL_DIR)
-
-
-#-- A macro to rewrite the paths of the library. This is necessary, because
-#   find_library() always found the em64t/vc9 version of the TBB libs
-macro(TBB_CORRECT_LIB_DIR var_name)
-#    if (NOT "${_TBB_ARCHITECTURE}" STREQUAL "em64t")
-        string(REPLACE em64t "${_TBB_ARCHITECTURE}" ${var_name} ${${var_name}})
-#    endif (NOT "${_TBB_ARCHITECTURE}" STREQUAL "em64t")
-    string(REPLACE ia32 "${_TBB_ARCHITECTURE}" ${var_name} ${${var_name}})
-    string(REPLACE vc7.1 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
-    string(REPLACE vc8 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
-    string(REPLACE vc9 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
-    string(REPLACE vc10 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
-endmacro(TBB_CORRECT_LIB_DIR var_content)
-
-
-#-- Look for include directory and set ${TBB_INCLUDE_DIR}
-set (TBB_INC_SEARCH_DIR ${_TBB_INSTALL_DIR}/include)
-# Jiri: tbbvars now sets the CPATH environment variable to the directory
-#       containing the headers.
-find_path(TBB_INCLUDE_DIR
-    tbb/task_scheduler_init.h
-    PATHS ${TBB_INC_SEARCH_DIR} ENV CPATH
-)
-mark_as_advanced(TBB_INCLUDE_DIR)
-
-
-#-- Look for libraries
-# GvdB: $ENV{TBB_ARCH_PLATFORM} is set by the build script tbbvars[.bat|.sh|.csh]
-if (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "")
-    set (_TBB_LIBRARY_DIR
-         ${_TBB_INSTALL_DIR}/lib/$ENV{TBB_ARCH_PLATFORM}
-         ${_TBB_INSTALL_DIR}/$ENV{TBB_ARCH_PLATFORM}/lib
-        )
-endif (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "")
-# Jiri: This block isn't mutually exclusive with the previous one
-#       (hence no else), instead I test if the user really specified
-#       the variables in question.
-if ((NOT ${TBB_ARCHITECTURE} STREQUAL "") AND (NOT ${TBB_COMPILER} STREQUAL ""))
-    # HH: deprecated
-    message(STATUS "[Warning] FindTBB.cmake: The use of TBB_ARCHITECTURE and TBB_COMPILER is deprecated and may not be supported in future versions. Please set \$ENV{TBB_ARCH_PLATFORM} (using tbbvars.[bat|csh|sh]).")
-    # Jiri: It doesn't hurt to look in more places, so I store the hints from
-    #       ENV{TBB_ARCH_PLATFORM} and the TBB_ARCHITECTURE and TBB_COMPILER
-    #       variables and search them both.
-    set (_TBB_LIBRARY_DIR "${_TBB_INSTALL_DIR}/${_TBB_ARCHITECTURE}/${_TBB_COMPILER}/lib" ${_TBB_LIBRARY_DIR})
-endif ((NOT ${TBB_ARCHITECTURE} STREQUAL "") AND (NOT ${TBB_COMPILER} STREQUAL ""))
-
-# GvdB: Mac OS X distribution places libraries directly in lib directory.
-list(APPEND _TBB_LIBRARY_DIR ${_TBB_INSTALL_DIR}/lib)
-
-# Jiri: No reason not to check the default paths. From recent versions,
-#       tbbvars has started exporting the LIBRARY_PATH and LD_LIBRARY_PATH
-#       variables, which now point to the directories of the lib files.
-#       It all makes more sense to use the ${_TBB_LIBRARY_DIR} as a HINTS
-#       argument instead of the implicit PATHS as it isn't hard-coded
-#       but computed by system introspection. Searching the LIBRARY_PATH
-#       and LD_LIBRARY_PATH environment variables is now even more important
-#       that tbbvars doesn't export TBB_ARCH_PLATFORM and it facilitates
-#       the use of TBB built from sources.
-find_library(TBB_LIBRARY ${_TBB_LIB_NAME} HINTS ${_TBB_LIBRARY_DIR}
-        PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
-find_library(TBB_MALLOC_LIBRARY ${_TBB_LIB_MALLOC_NAME} HINTS ${_TBB_LIBRARY_DIR}
-        PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
-
-#Extract path from TBB_LIBRARY name
-get_filename_component(TBB_LIBRARY_DIR ${TBB_LIBRARY} PATH)
-
-#TBB_CORRECT_LIB_DIR(TBB_LIBRARY)
-#TBB_CORRECT_LIB_DIR(TBB_MALLOC_LIBRARY)
-mark_as_advanced(TBB_LIBRARY TBB_MALLOC_LIBRARY)
-
-#-- Look for debug libraries
-# Jiri: Changed the same way as for the release libraries.
-find_library(TBB_LIBRARY_DEBUG ${_TBB_LIB_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
-        PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
-find_library(TBB_MALLOC_LIBRARY_DEBUG ${_TBB_LIB_MALLOC_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
-        PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
-
-# Jiri: Self-built TBB stores the debug libraries in a separate directory.
-#       Extract path from TBB_LIBRARY_DEBUG name
-get_filename_component(TBB_LIBRARY_DEBUG_DIR ${TBB_LIBRARY_DEBUG} PATH)
-
-#TBB_CORRECT_LIB_DIR(TBB_LIBRARY_DEBUG)
-#TBB_CORRECT_LIB_DIR(TBB_MALLOC_LIBRARY_DEBUG)
-mark_as_advanced(TBB_LIBRARY_DEBUG TBB_MALLOC_LIBRARY_DEBUG)
-
-
-if (TBB_INCLUDE_DIR)
-    if (TBB_LIBRARY)
-        set (TBB_FOUND "YES")
-        set (TBB_LIBRARIES ${TBB_LIBRARY} ${TBB_MALLOC_LIBRARY} ${TBB_LIBRARIES})
-        set (TBB_DEBUG_LIBRARIES ${TBB_LIBRARY_DEBUG} ${TBB_MALLOC_LIBRARY_DEBUG} ${TBB_DEBUG_LIBRARIES})
-        set (TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR} CACHE PATH "TBB include directory" FORCE)
-        set (TBB_LIBRARY_DIRS ${TBB_LIBRARY_DIR} CACHE PATH "TBB library directory" FORCE)
-        # Jiri: Self-built TBB stores the debug libraries in a separate directory.
-        set (TBB_DEBUG_LIBRARY_DIRS ${TBB_LIBRARY_DEBUG_DIR} CACHE PATH "TBB debug library directory" FORCE)
-        mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARY_DIRS TBB_DEBUG_LIBRARY_DIRS TBB_LIBRARIES TBB_DEBUG_LIBRARIES)
-        message(STATUS "Found Intel TBB")
-    endif (TBB_LIBRARY)
-endif (TBB_INCLUDE_DIR)
-
-if (NOT TBB_FOUND)
-    message("ERROR: Intel TBB NOT found!")
-    message(STATUS "Looked for Threading Building Blocks in ${_TBB_INSTALL_DIR}")
-    # do only throw fatal, if this pkg is REQUIRED
-    if (TBB_FIND_REQUIRED)
-        message(FATAL_ERROR "Could NOT find TBB library.")
-    endif (TBB_FIND_REQUIRED)
-endif (NOT TBB_FOUND)
-
-endif (NOT _TBB_INSTALL_DIR)
-
-if (TBB_FOUND)
-	set(TBB_INTERFACE_VERSION 0)
-	FILE(READ "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h" _TBB_VERSION_CONTENTS)
-	STRING(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1" TBB_INTERFACE_VERSION "${_TBB_VERSION_CONTENTS}")
-	set(TBB_INTERFACE_VERSION "${TBB_INTERFACE_VERSION}")
-endif (TBB_FOUND)
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+#
+# FindTBB
+# -------
+#
+# Find TBB include directories and libraries.
+#
+# Usage:
+#
+#  find_package(TBB [major[.minor]] [EXACT]
+#               [QUIET] [REQUIRED]
+#               [[COMPONENTS] [components...]]
+#               [OPTIONAL_COMPONENTS components...])
+#
+# where the allowed components are tbbmalloc and tbb_preview. Users may modify
+# the behavior of this module with the following variables:
+#
+# * TBB_ROOT_DIR          - The base directory the of TBB installation.
+# * TBB_INCLUDE_DIR       - The directory that contains the TBB headers files.
+# * TBB_LIBRARY           - The directory that contains the TBB library files.
+# * TBB_<library>_LIBRARY - The path of the TBB the corresponding TBB library.
+#                           These libraries, if specified, override the
+#                           corresponding library search results, where <library>
+#                           may be tbb, tbb_debug, tbbmalloc, tbbmalloc_debug,
+#                           tbb_preview, or tbb_preview_debug.
+# * TBB_USE_DEBUG_BUILD   - The debug version of tbb libraries, if present, will
+#                           be used instead of the release version.
+#
+# Users may modify the behavior of this module with the following environment
+# variables:
+#
+# * TBB_INSTALL_DIR
+# * TBBROOT
+# * LIBRARY_PATH
+#
+# This module will set the following variables:
+#
+# * TBB_FOUND             - Set to false, or undefined, if we haven’t found, or
+#                           don’t want to use TBB.
+# * TBB_<component>_FOUND - If False, optional <component> part of TBB sytem is
+#                           not available.
+# * TBB_VERSION           - The full version string
+# * TBB_VERSION_MAJOR     - The major version
+# * TBB_VERSION_MINOR     - The minor version
+# * TBB_INTERFACE_VERSION - The interface version number defined in
+#                           tbb/tbb_stddef.h.
+# * TBB_<library>_LIBRARY_RELEASE - The path of the TBB release version of
+#                           <library>, where <library> may be tbb, tbb_debug,
+#                           tbbmalloc, tbbmalloc_debug, tbb_preview, or
+#                           tbb_preview_debug.
+# * TBB_<library>_LIBRARY_DEGUG - The path of the TBB release version of
+#                           <library>, where <library> may be tbb, tbb_debug,
+#                           tbbmalloc, tbbmalloc_debug, tbb_preview, or
+#                           tbb_preview_debug.
+#
+# The following varibles should be used to build and link with TBB:
+#
+# * TBB_INCLUDE_DIRS        - The include directory for TBB.
+# * TBB_LIBRARIES           - The libraries to link against to use TBB.
+# * TBB_LIBRARIES_RELEASE   - The release libraries to link against to use TBB.
+# * TBB_LIBRARIES_DEBUG     - The debug libraries to link against to use TBB.
+# * TBB_DEFINITIONS         - Definitions to use when compiling code that uses
+#                             TBB.
+# * TBB_DEFINITIONS_RELEASE - Definitions to use when compiling release code that
+#                             uses TBB.
+# * TBB_DEFINITIONS_DEBUG   - Definitions to use when compiling debug code that
+#                             uses TBB.
+#
+# This module will also create the "tbb" target that may be used when building
+# executables and libraries.
+
+include(FindPackageHandleStandardArgs)
+
+if(NOT TBB_FOUND)
+
+  ##################################
+  # Check the build type
+  ##################################
+
+  if(NOT DEFINED TBB_USE_DEBUG_BUILD)
+    if(CMAKE_BUILD_TYPE MATCHES "(Debug|DEBUG|debug|RelWithDebInfo|RELWITHDEBINFO|relwithdebinfo)")
+      set(TBB_BUILD_TYPE DEBUG)
+    else()
+      set(TBB_BUILD_TYPE RELEASE)
+    endif()
+  elseif(TBB_USE_DEBUG_BUILD)
+    set(TBB_BUILD_TYPE DEBUG)
+  else()
+    set(TBB_BUILD_TYPE RELEASE)
+  endif()
+
+  ##################################
+  # Set the TBB search directories
+  ##################################
+
+  # Define search paths based on user input and environment variables
+  set(TBB_SEARCH_DIR ${TBB_ROOT_DIR} $ENV{TBB_INSTALL_DIR} $ENV{TBBROOT})
+
+  # Define the search directories based on the current platform
+  if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
+    set(TBB_DEFAULT_SEARCH_DIR "C:/Program Files/Intel/TBB"
+                               "C:/Program Files (x86)/Intel/TBB")
+
+    # Set the target architecture
+    if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+      set(TBB_ARCHITECTURE "intel64")
+    else()
+      set(TBB_ARCHITECTURE "ia32")
+    endif()
+
+    # Set the TBB search library path search suffix based on the version of VC
+    if(WINDOWS_STORE)
+      set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc11_ui")
+    elseif(MSVC14)
+      set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc14")
+    elseif(MSVC12)
+      set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc12")
+    elseif(MSVC11)
+      set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc11")
+    elseif(MSVC10)
+      set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc10")
+    endif()
+
+    # Add the library path search suffix for the VC independent version of TBB
+    list(APPEND TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc_mt")
+
+  elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+    # OS X
+    set(TBB_DEFAULT_SEARCH_DIR "/opt/intel/tbb")
+
+    # TODO: Check to see which C++ library is being used by the compiler.
+    if(NOT ${CMAKE_SYSTEM_VERSION} VERSION_LESS 13.0)
+      # The default C++ library on OS X 10.9 and later is libc++
+      set(TBB_LIB_PATH_SUFFIX "lib/libc++" "lib")
+    else()
+      set(TBB_LIB_PATH_SUFFIX "lib")
+    endif()
+  elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+    # Linux
+    set(TBB_DEFAULT_SEARCH_DIR "/opt/intel/tbb")
+
+    # TODO: Check compiler version to see the suffix should be <arch>/gcc4.1 or
+    #       <arch>/gcc4.1. For now, assume that the compiler is more recent than
+    #       gcc 4.4.x or later.
+    if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
+      set(TBB_LIB_PATH_SUFFIX "lib/intel64/gcc4.4")
+    elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$")
+      set(TBB_LIB_PATH_SUFFIX "lib/ia32/gcc4.4")
+    endif()
+  endif()
+
+  ##################################
+  # Find the TBB include dir
+  ##################################
+
+  find_path(TBB_INCLUDE_DIRS tbb/tbb.h
+      HINTS ${TBB_INCLUDE_DIR} ${TBB_SEARCH_DIR}
+      PATHS ${TBB_DEFAULT_SEARCH_DIR}
+      PATH_SUFFIXES include)
+
+  ##################################
+  # Set version strings
+  ##################################
+
+  if(TBB_INCLUDE_DIRS)
+    file(READ "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h" _tbb_version_file)
+    string(REGEX REPLACE ".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1"
+        TBB_VERSION_MAJOR "${_tbb_version_file}")
+    string(REGEX REPLACE ".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1"
+        TBB_VERSION_MINOR "${_tbb_version_file}")
+    string(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1"
+        TBB_INTERFACE_VERSION "${_tbb_version_file}")
+    set(TBB_VERSION "${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR}")
+  endif()
+
+  ##################################
+  # Find TBB components
+  ##################################
+
+  if(TBB_VERSION VERSION_LESS 4.3)
+    set(TBB_SEARCH_COMPOMPONENTS tbb_preview tbbmalloc tbb)
+  else()
+    set(TBB_SEARCH_COMPOMPONENTS tbb_preview tbbmalloc_proxy tbbmalloc tbb)
+  endif()
+
+  # Find each component
+  foreach(_comp ${TBB_SEARCH_COMPOMPONENTS})
+    if(";${TBB_FIND_COMPONENTS};tbb;" MATCHES ";${_comp};")
+
+      # Search for the libraries
+      find_library(TBB_${_comp}_LIBRARY_RELEASE ${_comp}
+          HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR}
+          PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH
+          PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX})
+
+      find_library(TBB_${_comp}_LIBRARY_DEBUG ${_comp}_debug
+          HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR}
+          PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH
+          PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX})
+
+      if(TBB_${_comp}_LIBRARY_DEBUG)
+        list(APPEND TBB_LIBRARIES_DEBUG "${TBB_${_comp}_LIBRARY_DEBUG}")
+      endif()
+      if(TBB_${_comp}_LIBRARY_RELEASE)
+        list(APPEND TBB_LIBRARIES_RELEASE "${TBB_${_comp}_LIBRARY_RELEASE}")
+      endif()
+      if(TBB_${_comp}_LIBRARY_${TBB_BUILD_TYPE} AND NOT TBB_${_comp}_LIBRARY)
+        set(TBB_${_comp}_LIBRARY "${TBB_${_comp}_LIBRARY_${TBB_BUILD_TYPE}}")
+      endif()
+
+      if(TBB_${_comp}_LIBRARY AND EXISTS "${TBB_${_comp}_LIBRARY}")
+        set(TBB_${_comp}_FOUND TRUE)
+      else()
+        set(TBB_${_comp}_FOUND FALSE)
+      endif()
+
+      # Mark internal variables as advanced
+      mark_as_advanced(TBB_${_comp}_LIBRARY_RELEASE)
+      mark_as_advanced(TBB_${_comp}_LIBRARY_DEBUG)
+      mark_as_advanced(TBB_${_comp}_LIBRARY)
+
+    endif()
+  endforeach()
+
+  ##################################
+  # Set compile flags and libraries
+  ##################################
+
+  set(TBB_DEFINITIONS_RELEASE "")
+  set(TBB_DEFINITIONS_DEBUG "-DTBB_USE_DEBUG=1")
+
+  if(TBB_LIBRARIES_${TBB_BUILD_TYPE})
+    set(TBB_DEFINITIONS "${TBB_DEFINITIONS_${TBB_BUILD_TYPE}}")
+    set(TBB_LIBRARIES "${TBB_LIBRARIES_${TBB_BUILD_TYPE}}")
+  elseif(TBB_LIBRARIES_RELEASE)
+    set(TBB_DEFINITIONS "${TBB_DEFINITIONS_RELEASE}")
+    set(TBB_LIBRARIES "${TBB_LIBRARIES_RELEASE}")
+  elseif(TBB_LIBRARIES_DEBUG)
+    set(TBB_DEFINITIONS "${TBB_DEFINITIONS_DEBUG}")
+    set(TBB_LIBRARIES "${TBB_LIBRARIES_DEBUG}")
+  endif()
+
+  find_package_handle_standard_args(TBB
+      REQUIRED_VARS TBB_INCLUDE_DIRS TBB_LIBRARIES
+      HANDLE_COMPONENTS
+      VERSION_VAR TBB_VERSION)
+
+  ##################################
+  # Create targets
+  ##################################
+
+  if(NOT CMAKE_VERSION VERSION_LESS 3.0 AND TBB_FOUND)
+    add_library(tbb SHARED IMPORTED)
+    set_target_properties(tbb PROPERTIES
+          INTERFACE_INCLUDE_DIRECTORIES  ${TBB_INCLUDE_DIRS}
+          IMPORTED_LOCATION              ${TBB_LIBRARIES})
+    if(TBB_LIBRARIES_RELEASE AND TBB_LIBRARIES_DEBUG)
+      set_target_properties(tbb PROPERTIES
+          INTERFACE_COMPILE_DEFINITIONS "$<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:TBB_USE_DEBUG=1>"
+          IMPORTED_LOCATION_DEBUG          ${TBB_LIBRARIES_DEBUG}
+          IMPORTED_LOCATION_RELWITHDEBINFO ${TBB_LIBRARIES_DEBUG}
+          IMPORTED_LOCATION_RELEASE        ${TBB_LIBRARIES_RELEASE}
+          IMPORTED_LOCATION_MINSIZEREL     ${TBB_LIBRARIES_RELEASE}
+          )
+    elseif(TBB_LIBRARIES_RELEASE)
+      set_target_properties(tbb PROPERTIES IMPORTED_LOCATION ${TBB_LIBRARIES_RELEASE})
+    else()
+      set_target_properties(tbb PROPERTIES
+          INTERFACE_COMPILE_DEFINITIONS "${TBB_DEFINITIONS_DEBUG}"
+          IMPORTED_LOCATION              ${TBB_LIBRARIES_DEBUG}
+          )
+    endif()
+  endif()
+
+  mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARIES)
+
+  unset(TBB_ARCHITECTURE)
+  unset(TBB_BUILD_TYPE)
+  unset(TBB_LIB_PATH_SUFFIX)
+  unset(TBB_DEFAULT_SEARCH_DIR)
+
+endif()


Disable TBB on Android for mips

Disable TBB on Android for mips

--- cmake/OpenCVDetectTBB.cmake
+++ cmake/OpenCVDetectTBB.cmake
@@ -1,4 +1,4 @@
-if(ANDROID)
+if(ANDROID AND NOT MIPS)
   add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/tbb")
   include_directories(SYSTEM ${TBB_INCLUDE_DIRS})
   set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} tbb)
@@ -21,11 +21,11 @@
 endif()

 if(NOT HAVE_TBB)
-  set(TBB_DEFAULT_INCLUDE_DIRS
-    "/opt/intel/tbb" "/usr/local/include" "/usr/include"
-    "C:/Program Files/Intel/TBB" "C:/Program Files (x86)/Intel/TBB"
-    "C:/Program Files (x86)/tbb/include"
-    "C:/Program Files (x86)/tbb/include"
+  set(TBB_DEFAULT_INCLUDE_DIRS
+    "/opt/intel/tbb" "/usr/local/include" "/usr/include"
+    "C:/Program Files/Intel/TBB" "C:/Program Files (x86)/Intel/TBB"
+    "C:/Program Files (x86)/tbb/include"
+    "C:/Program Files (x86)/tbb/include"
     "${CMAKE_INSTALL_PREFIX}/include")

   find_path(TBB_INCLUDE_DIRS "tbb/tbb.h" PATHS ${TBB_INCLUDE_DIR} ${TBB_DEFAULT_INCLUDE_DIRS} DOC "The path to TBB headers")


[CMake] Fix symlink refactor for multi-configuration generators

This fix, while a bit complicated, preserves the reusability while fixing the issues reported on llvm-commits with visual studio generators.

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

--- cmake/modules/AddLLVM.cmake
+++ cmake/modules/AddLLVM.cmake
@@ -1238,14 +1238,34 @@

 function(add_llvm_tool_symlink link_name target)
   cmake_parse_arguments(ARG "ALWAYS_GENERATE" "OUTPUT_DIR" "" ${ARGN})
+  # This got a bit gross... For multi-configuration generators the target
+  # properties return the resolved value of the string, not the build system
+  # expression. To reconstruct the platform-agnostic path we have to do some
+  # magic. First we grab one of the types, and a type-specific path. Then from
+  # the type-specific path we find the last occurrence of the type in the path,
+  # and replace it with CMAKE_CFG_INTDIR. This allows the build step to be type
+  # agnostic again.
   if(NOT ARG_OUTPUT_DIR)
+    if(CMAKE_CONFIGURATION_TYPES)
+      list(GET CMAKE_CONFIGURATION_TYPES 0 first_type)
+      string(TOUPPER ${first_type} first_type_upper)
+      set(first_type_suffix _${first_type_upper})
+    endif()
     get_target_property(target_type ${target} TYPE)
     if(${target_type} STREQUAL "STATIC_LIBRARY")
-      get_target_property(ARG_OUTPUT_DIR ${target} ARCHIVE_OUTPUT_DIRECTORY)
+      get_target_property(ARG_OUTPUT_DIR ${target} ARCHIVE_OUTPUT_DIRECTORY${first_type_suffix})
     elseif(UNIX AND ${target_type} STREQUAL "SHARED_LIBRARY")
-      get_target_property(ARG_OUTPUT_DIR ${target} LIBRARY_OUTPUT_DIRECTORY)
+      get_target_property(ARG_OUTPUT_DIR ${target} LIBRARY_OUTPUT_DIRECTORY${first_type_suffix})
     else()
-      get_target_property(ARG_OUTPUT_DIR ${target} RUNTIME_OUTPUT_DIRECTORY)
+      get_target_property(ARG_OUTPUT_DIR ${target} RUNTIME_OUTPUT_DIRECTORY${first_type_suffix})
+    endif()
+    if(CMAKE_CONFIGURATION_TYPES)
+      string(FIND "${ARG_OUTPUT_DIR}" "/${first_type}/" type_start REVERSE)
+      string(SUBSTRING "${ARG_OUTPUT_DIR}" 0 ${type_start} path_prefix)
+      string(SUBSTRING "${ARG_OUTPUT_DIR}" ${type_start} -1 path_suffix)
+      string(REPLACE "/${first_type}/" "/${CMAKE_CFG_INTDIR}/"
+             path_suffix ${path_suffix})
+      set(ARG_OUTPUT_DIR ${path_prefix}${path_suffix})
     endif()
   endif()


FindVdt.cmake: create imported target and detect version

Old versions of Vdt (0.4.1 and below) do not export version information,
but ROOT needs 0.4.0 at least, because of the vdt/tanh.h header, so we
deduce the version based on the existence of that header and require the
minimum version that ROOT needs. This file now also creates an imported
target that can be used within ROOT to link against VDT with dependencies
taken care of automatically. Fixes ROOT-9885.

--- cmake/modules/FindVdt.cmake
+++ cmake/modules/FindVdt.cmake
@@ -1,20 +1,76 @@
-# - Locate vdt library
-# Defines:
+#.rst:
+# FindVdt
+# -------
 #
-#  VDT_FOUND
-#  VDT_INCLUDE_DIRS
-#  VDT_LIBRARIES
+# Find the Vdt library header and define variables.
+#
+# Imported Targets
+# ^^^^^^^^^^^^^^^^
+#
+# This module defines :prop_tgt:`IMPORTED` target ``VDT::VDT``,
+# if Vdt has been found.
+#
+# Result Variables
+# ^^^^^^^^^^^^^^^^
+#
+# This module defines the following variables:
+#
+# ::
+#
+#   VDT_FOUND          - True if Vdt is found.
+#   VDT_INCLUDE_DIRS   - Where to find vdt/vdtMath.h
+#
+# ::
+#
+#   VDT_VERSION        - The version of Vdt found (x.y.z)
+#   VDT_VERSION_MAJOR  - The major version of Vdt
+#   VDT_VERSION_MINOR  - The minor version of Vdt
+#   VDT_VERSION_PATCH  - The patch version of Vdt
+#

-find_path(VDT_INCLUDE_DIR NAMES vdt/vdtMath.h  HINTS ${VDT_DIR}/include /usr/include/vdt)
-find_library(VDT_LIBRARY NAMES vdt HINTS ${VDT_DIR}/lib/ $ENV{VDT_DIR}/lib/ /usr/lib)
+if(NOT VDT_INCLUDE_DIR)
+  find_path(VDT_INCLUDE_DIR NAME vdt/vdtMath.h PATH_SUFFIXES include)
+endif()

-set(VDT_INCLUDE_DIRS ${VDT_INCLUDE_DIR})
-set(VDT_LIBRARIES ${VDT_LIBRARY})
+if(NOT VDT_LIBRARY)
+  find_library(VDT_LIBRARY NAMES vdt)
+endif()

+mark_as_advanced(VDT_INCLUDE_DIR VDT_LIBRARY)

-# handle the QUIETLY and REQUIRED arguments and set VDT_FOUND to TRUE if
-# all listed variables are TRUE
-INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(VDT DEFAULT_MSG VDT_INCLUDE_DIR VDT_LIBRARY)
+if(VDT_INCLUDE_DIR)
+  file(STRINGS "${VDT_INCLUDE_DIR}/vdt/vdtMath.h" VDT_H REGEX "^#define VDT_VERSION_[A-Z]+[ ]+[0-9]+.*$")
+  string(REGEX REPLACE ".+VDT_VERSION_MAJOR[ ]+([0-9]+).*$" "\\1" VDT_VERSION_MAJOR "${VDT_H}")
+  string(REGEX REPLACE ".+VDT_VERSION_MINOR[ ]+([0-9]+).*$" "\\1" VDT_VERSION_MINOR "${VDT_H}")
+  string(REGEX REPLACE ".+VDT_VERSION_PATCH[ ]+([0-9]+).*$" "\\1" VDT_VERSION_PATCH "${VDT_H}")
+  set(VDT_VERSION "${VDT_VERSION_MAJOR}.${VDT_VERSION_MINOR}.${VDT_VERSION_PATCH}")
+  if("${VDT_VERSION}" STREQUAL "..")
+    if(EXISTS "${VDT_INCLUDE_DIR}/vdt/tanh.h")
+      set(VDT_VERSION "0.4")
+    else()
+      set(VDT_VERSION "0.3")
+    endif()
+  endif()
+endif()

-mark_as_advanced(VDT_FOUND VDT_INCLUDE_DIRS VDT_LIBRARIES)
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Vdt FOUND_VAR VDT_FOUND
+  REQUIRED_VARS VDT_INCLUDE_DIR VDT_LIBRARY VERSION_VAR VDT_VERSION)
+
+if(VDT_FOUND)
+  set(VDT_INCLUDE_DIRS ${VDT_INCLUDE_DIR})
+
+  if(NOT VDT_LIBRARIES)
+    set(VDT_LIBRARIES ${VDT_LIBRARY})
+  endif()
+
+  if(NOT TARGET VDT::VDT)
+    add_library(VDT::VDT UNKNOWN IMPORTED)
+
+    set_target_properties(VDT::VDT
+      PROPERTIES
+        IMPORTED_LOCATION "${VDT_LIBRARY}"
+        INTERFACE_INCLUDE_DIRECTORIES "${VDT_INCLUDE_DIRS}"
+    )
+  endif()
+endif()


More complete WARNING messages about when documentation build software is
missing.

svn path=/trunk/; revision=7238

--- cmake/modules/docbook.cmake
+++ cmake/modules/docbook.cmake
@@ -61,12 +61,33 @@
     check_perl_modules(PERL_XML_DOM XML::DOM)
   endif(PERL_FOUND)
   find_program(DB2X_TEXIXML db2x_texixml)
+  if(NOT DB2X_TEXIXML)
+    message(STATUS "WARNING: db2x_texixml not found")
+  endif(NOT DB2X_TEXIXML)
   find_program(DB2X_XSLTPROC db2x_xsltproc)
+  if(NOT DB2X_XSLTPROC)
+    message(STATUS "WARNING: db2x_xsltproc not found")
+  endif(NOT DB2X_XSLTPROC)
   find_program(OPENJADE openjade)
+  if(NOT OPENJADE)
+    message(STATUS "WARNING: openjade not found")
+  endif(NOT OPENJADE)
   find_program(JADETEX jadetex)
+  if(NOT JADETEX)
+    message(STATUS "WARNING: jadetex not found")
+  endif(NOT JADETEX)
   find_program(PDFJADETEX pdfjadetex)
+  if(NOT PDFJADETEX)
+    message(STATUS "WARNING: pdfjadetex not found")
+  endif(NOT PDFJADETEX)
   find_program(DVIPS dvips)
+  if(NOT DVIPS)
+    message(STATUS "WARNING: dvips not found")
+  endif(NOT DVIPS)
   find_program(MAKEINFO makeinfo)
+  if(NOT MAKEINFO)
+    message(STATUS "WARNING: makeinfo not found")
+  endif(NOT MAKEINFO)
   # Use include style here since FindUnixCommands is a simple module and
   # clearly not meant to be an official FindXXX module.
   include(FindUnixCommands)
@@ -80,22 +101,34 @@

   if(NOT PERL_FOUND OR NOT PERL_XML_SAX OR NOT DB2X_TEXIXML OR NOT DB2X_XSLTPROC OR NOT MAKEINFO)
     set(BUILD_INFO OFF)
-    message("Not building info documentation - required programs are missing")
+    message(STATUS
+    "WARNING: Not building info documentation - "
+    "required programs are missing"
+    )
   endif(NOT PERL_FOUND OR NOT PERL_XML_SAX OR NOT DB2X_TEXIXML OR NOT DB2X_XSLTPROC OR NOT MAKEINFO)

   if(NOT PERL_FOUND OR NOT PERL_XML_PARSER OR NOT PERL_XML_DOM)
     set(BUILD_MAN OFF)
-    message("Not building man documentation - required programs are missing")
+    message(STATUS
+    "WARNING: Not building man documentation - "
+    "required programs are missing"
+    )
   endif(NOT PERL_FOUND OR NOT PERL_XML_PARSER OR NOT PERL_XML_DOM)

   if(NOT OPENJADE)
     set(BUILD_HTML OFF)
-    message("Not building html documentation - required programs are missing")
+    message(STATUS
+    "WARNING: Not building html documentation - "
+    "required programs are missing"
+    )
   endif(NOT OPENJADE)

   if(NOT OPENJADE OR NOT JADETEX OR NOT PDFJADETEX OR NOT DVIPS OR NOT GZIP)
     set(BUILD_PRINT OFF)
-    message("Not building print documentation - required programs are missing")
+    message(STATUS
+    "WARNING: Not building print documentation - "
+    "required programs are missing"
+    )
   endif(NOT OPENJADE OR NOT JADETEX OR NOT PDFJADETEX OR NOT DVIPS OR NOT GZIP)

   set(JADELOG "jadeout.log")
@@ -159,14 +192,20 @@
   if(BUILD_PRINT)
     if(NOT HAVE_DSSSL_DTD OR NOT HAVE_PRINT_SS OR NOT HAVE_DB_DTD)
       set(BUILD_PRINT OFF)
-      message("Not building print documentation - dtd files / style sheets are missing")
+      message(STATUS
+      "WARNING: Not building print documentation - "
+      "dtd files / style sheets are missing"
+      )
     endif(NOT HAVE_DSSSL_DTD OR NOT HAVE_PRINT_SS OR NOT HAVE_DB_DTD)
   endif(BUILD_PRINT)

   if(BUILD_HTML)
     if(NOT HAVE_DSSSL_DTD OR NOT HAVE_HTML_SS OR NOT HAVE_DB_DTD)
       set(BUILD_HTML OFF)
-      message("Not building html documentation - dtd files / style sheets are missing")
+      message(STATUS
+      "WARNING: Not building html documentation - "
+      "dtd files / style sheets are missing"
+      )
     endif(NOT HAVE_DSSSL_DTD OR NOT HAVE_HTML_SS OR NOT HAVE_DB_DTD)
   endif(BUILD_HTML)


cmake: remove usage of qi_uniq_global

cmake: remove usage of qi_uniq_global

Change-Id: Iab2e607728f65bd17e24c1381950e316c148e89c

--- cmake/qibuild/general.cmake
+++ cmake/qibuild/general.cmake
@@ -101,10 +101,21 @@
   endif()
 endif()

-qi_uniq_global(CMAKE_FIND_ROOT_PATH)
-qi_uniq_global(CMAKE_PREFIX_PATH)
-qi_uniq_global(CMAKE_MODULE_PATH)
-#qi_uniq_global(CMAKE_INCLUDE_PATH)
+if (DEFINED  CMAKE_FIND_ROOT_PATH)
+  list(REVERSE           CMAKE_FIND_ROOT_PATH)
+  list(REMOVE_DUPLICATES CMAKE_FIND_ROOT_PATH)
+  list(REVERSE           CMAKE_FIND_ROOT_PATH)
+endif()
+if (DEFINED  CMAKE_PREFIX_PATH)
+  list(REVERSE           CMAKE_PREFIX_PATH)
+  list(REMOVE_DUPLICATES CMAKE_PREFIX_PATH)
+  list(REVERSE           CMAKE_PREFIX_PATH)
+endif()
+if (DEFINED  CMAKE_MODULE_PATH)
+  list(REVERSE           CMAKE_MODULE_PATH)
+  list(REMOVE_DUPLICATES CMAKE_MODULE_PATH)
+  list(REVERSE           CMAKE_MODULE_PATH)
+endif()

 qi_debug("CMAKE_FIND_ROOT_PATH  = ${CMAKE_FIND_ROOT_PATH}")
 qi_debug("CMAKE_PREFIX_PATH     = ${CMAKE_PREFIX_PATH}")


Update pnm++ with fixes for Windows

Update pnm++ with fixes for Windows

--- cmake/third_party/pnm.cmake
+++ cmake/third_party/pnm.cmake
@@ -7,8 +7,8 @@
 include(FetchContent)
 FetchContent_Declare(
     pnm
-    GIT_REPOSITORY https://github.com/pierre-dejoue/pnm.git
-    GIT_TAG 0f0e26912bc4dc4561c8e3f4d3c4bb367f3e9bb2
+    GIT_REPOSITORY https://github.com/ToruNiina/pnm.git
+    GIT_TAG be7ea4f5ad140c4c073e6e8c8575301be257f7aa
 )
 FetchContent_Populate(pnm)


Changed FindJNI.cmake to be found in the Ubuntu Installer.

--- cmake_modules/FindJNI.cmake
+++ cmake_modules/FindJNI.cmake
@@ -103,6 +103,7 @@
   ${_JAVA_HOME}
   /usr/lib
   /usr/local/lib
+  /usr/lib/jvm/java-6-openjdk/jre/lib/{libarch}
   /usr/lib/jvm/java/lib
   /usr/lib/java/jre/lib/{libarch}
   /usr/local/lib/java/jre/lib/{libarch}
@@ -113,7 +114,6 @@
   /usr/lib/jvm/java-6-sun/jre/lib/{libarch}
   /usr/lib/jvm/java-1.5.0-sun/jre/lib/{libarch}
   /usr/lib/jvm/java-6-sun-1.6.0.00/jre/lib/{libarch}       # can this one be removed according to #8821 ? Alex
-  /usr/lib/jvm/java-6-openjdk/jre/lib/{libarch}
   /usr/lib/jvm/java-openjdk/jre/lib/{libarch}
   # Debian specific paths for default JVM
   /usr/lib/jvm/default-java/jre/lib/{libarch}


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

--- Modules/ThirdParty/KWSys/src/KWSys/kwsysDateStamp.cmake
+++ Modules/ThirdParty/KWSys/src/KWSys/kwsysDateStamp.cmake
@@ -18,4 +18,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 01)

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


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

--- Modules/ThirdParty/KWSys/src/KWSys/kwsysDateStamp.cmake
+++ Modules/ThirdParty/KWSys/src/KWSys/kwsysDateStamp.cmake
@@ -18,4 +18,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 10)

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


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

--- Modules/ThirdParty/KWSys/src/KWSys/kwsysDateStamp.cmake
+++ Modules/ThirdParty/KWSys/src/KWSys/kwsysDateStamp.cmake
@@ -18,4 +18,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 09)

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


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

--- Modules/ThirdParty/KWSys/src/KWSys/kwsysDateStamp.cmake
+++ Modules/ThirdParty/KWSys/src/KWSys/kwsysDateStamp.cmake
@@ -18,4 +18,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 06)

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


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

--- Modules/ThirdParty/KWSys/src/KWSys/kwsysDateStamp.cmake
+++ Modules/ThirdParty/KWSys/src/KWSys/kwsysDateStamp.cmake
@@ -18,4 +18,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 09)

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


Added -Wno-unknown-warning-option to PNaCl toolchain file

--- cmake-toolchains/pnacl.toolchain.cmake
+++ cmake-toolchains/pnacl.toolchain.cmake
@@ -101,11 +101,11 @@
 set(CMAKE_SYSTEM_INCLUDE_PATH "${NACL_TOOLCHAIN_ROOT}/usr/include")

 # compiler flags
-set(CMAKE_CXX_FLAGS "${FIPS_NACL_EXCEPTION_FLAGS} ${FIPS_NACL_RTTI_FLAGS} -std=c++11 -pthread -D_XOPEN_SOURCE=600 -Wno-multichar -Wall -Wextra -Wno-unused-parameter -Wno-unknown-pragmas -Wno-ignored-qualifiers -Wno-long-long -Wno-overloaded-virtual -Wno-unused-volatile-lvalue -Wno-deprecated-writable-strings -Wno-inconsistent-missing-override")
+set(CMAKE_CXX_FLAGS "${FIPS_NACL_EXCEPTION_FLAGS} ${FIPS_NACL_RTTI_FLAGS} -std=c++11 -pthread -D_XOPEN_SOURCE=600 -Wno-multichar -Wall -Wextra -Wno-unused-parameter -Wno-unknown-pragmas -Wno-ignored-qualifiers -Wno-long-long -Wno-overloaded-virtual -Wno-unused-volatile-lvalue -Wno-deprecated-writable-strings -Wno-inconsistent-missing-override -Wno-unknown-warning-option")
 set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
 set(CMAKE_CXX_FLAGS_DEBUG "-O0 -D_DEBUG_ -D_DEBUG -DNACL_SDK_DEBUG -DFIPS_DEBUG=1")

-set(CMAKE_C_FLAGS "-pthread -D_XOPEN_SOURCE=600 -Wno-multichar -Wall -Wextra -Wno-unused-parameter -Wno-unknown-pragmas -Wno-ignored-qualifiers -Wno-long-long -Wno-overloaded-virtual -Wno-unused-volatile-lvalue  -Wno-deprecated-writable-strings")
+set(CMAKE_C_FLAGS "-pthread -D_XOPEN_SOURCE=600 -Wno-multichar -Wall -Wextra -Wno-unused-parameter -Wno-unknown-pragmas -Wno-ignored-qualifiers -Wno-long-long -Wno-overloaded-virtual -Wno-unused-volatile-lvalue  -Wno-deprecated-writable-strings -Wno-unknown-warning-option")
 set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG")
 set(CMAKE_C_FLAGS_DEBUG "-O0 -D_DEBUG_ -D_DEBUG -g -DNACL_SDK_DEBUG -DFIPS_DEBUG=1")


Update CMake config paths

Update CMake config paths

--- cmake/configs/posix_sitl_default.cmake
+++ cmake/configs/posix_sitl_default.cmake
@@ -32,21 +32,17 @@
 	systemcmds/top
 	systemcmds/motor_ramp

-	modules/attitude_estimator_ekf
 	modules/attitude_estimator_q
 	modules/commander
 	modules/dataman
 	modules/ekf2
-	modules/ekf_att_pos_estimator
 	modules/fw_att_control
 	modules/fw_pos_control_l1
 	modules/land_detector
 	modules/logger
 	modules/mavlink
 	modules/mc_att_control
-	modules/mc_att_control_multiplatform
 	modules/mc_pos_control
-	modules/mc_pos_control_multiplatform
 	modules/navigator
 	modules/param
 	modules/position_estimator_inav
@@ -76,6 +72,10 @@
 	lib/terrain_estimation

 	examples/px4_simple_app
+	examples/mc_att_control_multiplatform
+	examples/mc_pos_control_multiplatform
+	examples/ekf_att_pos_estimator
+	examples/attitude_estimator_ekf

 	#
 	# Testing


[CMake] Add quotes to avoid failure on Windows node

Quotes are necessary in case the Python2_VERSION variable is not defined,
to prevent a missing operand in the expression that compares the
version.

--- cmake/modules/SearchRootCoreDeps.cmake
+++ cmake/modules/SearchRootCoreDeps.cmake
@@ -49,7 +49,7 @@
   if(DEFINED Python2_VERSION AND "${Python2_VERSION}" VERSION_LESS "2.7")
     message(WARNING "Ignoring Python2 installation: unsupported version ${Python2_VERSION} (version>=2.7 required)")
   endif()
-  if(Python2_Development_FOUND AND ${Python2_VERSION} VERSION_GREATER_EQUAL "2.7")
+  if(Python2_Development_FOUND AND "${Python2_VERSION}" VERSION_GREATER_EQUAL "2.7")
     if(NOT Python3_Development_FOUND)
       # Only Python2 was found, set as main
       set(PYTHON_EXECUTABLE "${Python2_EXECUTABLE}" CACHE INTERNAL "" FORCE)
@@ -75,7 +75,7 @@
     endif()
   endif()

-  if(NOT Python3_Development_FOUND AND (NOT Python2_Development_FOUND OR ${Python2_VERSION} VERSION_LESS "2.7"))
+  if(NOT Python3_Development_FOUND AND (NOT Python2_Development_FOUND OR "${Python2_VERSION}" VERSION_LESS "2.7"))
     message(FATAL_ERROR "No supported Python 2 or 3 were found")
   endif()


build: always use bundled b64

build: always use bundled b64

Signed-off-by: Leonardo Grasso <b1c1d8736f20db3fb6c1c66bb1455ed43909f0d8@leonardograsso.com>

--- cmake/modules/falcosecurity-libs.cmake
+++ cmake/modules/falcosecurity-libs.cmake
@@ -57,6 +57,7 @@
 set(WITH_CHISEL ON CACHE BOOL "")

 set(USE_BUNDLED_TBB ON CACHE BOOL "")
+set(USE_BUNDLED_B64 ON CACHE BOOL "")

 list(APPEND CMAKE_MODULE_PATH "${FALCOSECURITY_LIBS_SOURCE_DIR}/cmake/modules")


cmake/LinuxPackaging.cmake: manually exclude each dir for CentOS 7 RPM creation

Seems that using CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST works, but it's
required that each directory be added, even though it's parent
has already been added.

Signed-off-by: Alexandru Ardelean <685557f6b7c225d86b536740313ed51b24843a58@analog.com>

--- cmake/LinuxPackaging.cmake
+++ cmake/LinuxPackaging.cmake
@@ -8,6 +8,18 @@
 	set(CPACK_GENERATOR ${CPACK_GENERATOR};RPM)
 	set(CPACK_RPM_PACKAGE_REQUIRES "libaio >= 0.3.107, avahi >= 0.6.25, libusb1 >= 1.0.9, libxml2 >= 2.7.6")
 endif()
+
+# Add these for CentOS 7
+set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION
+	/lib
+	/lib/udev
+	/lib/udev/rules.d
+	/usr/sbin
+	/usr/lib/python2.7
+	/usr/lib/python2.7/site-packages
+	/usr/lib/pkgconfig
+	/usr/lib64/pkgconfig
+)

 set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0)
 set(CPACK_PACKAGE_VERSION_MAJOR ${LIBIIO_VERSION_MAJOR})


Fix COMPILE_DEFINITIONS propagation

Fix COMPILE_DEFINITIONS propagation

--- cmake/MyPackageStart.cmake
+++ cmake/MyPackageStart.cmake
@@ -88,8 +88,12 @@
   SET (CMAKE_POSITION_INDEPENDENT_CODE ON)
   if (("${CMAKE_C_COMPILER_ID} x" MATCHES "MSVC") OR MSVC)
     # Loosely based on http://www.hdfgroup.org/ftp/HDF/HDF_Current/src/unpacked/config/cmake/ConfigureChecks.cmake
-    FOREACH (_definition "WIN32_LEAN_AND_MEAN" "_CRT_SECURE_NO_WARNINGS" "_CRT_NONSTDC_NO_DEPRECATE")
-      LIST (FIND COMPILE_DEFINITIONS ${_definition} _index)
+    GET_DIRECTORY_PROPERTY (_DirDefs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_DEFINITIONS)
+    IF (MYPACKAGE_DEBUG)
+      MESSAGE (STATUS "[${PROJECT_NAME}-START-STATUS] Current COMPILE_DEFINITIONS is: ${_DirDefs}")
+    ENDIF ()
+    FOREACH (_definition WIN32_LEAN_AND_MEAN _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_DEPRECATE)
+      LIST (FIND _DirDefs ${_definition} _index)
       IF (${_index} GREATER -1)
         IF (MYPACKAGE_DEBUG)
           MESSAGE (STATUS "[${PROJECT_NAME}-START-STATUS] Compile definition ${_definition} already set")
@@ -98,9 +102,13 @@
         IF (MYPACKAGE_DEBUG)
           MESSAGE (STATUS "[${PROJECT_NAME}-START-STATUS] Adding compile definition ${_definition}")
         ENDIF ()
+	    ADD_DEFINITIONS("-D${_definition}")
       ENDIF ()
-      ADD_DEFINITIONS("-D${_definition}")
     ENDFOREACH ()
+    GET_DIRECTORY_PROPERTY (_DirDefs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_DEFINITIONS)
+    IF (MYPACKAGE_DEBUG)
+      MESSAGE (STATUS "[${PROJECT_NAME}-START-STATUS] New COMPILE_DEFINITIONS is: ${_DirDefs}")
+    ENDIF ()
   ELSE ()
     IF (MYPACKAGE_DEBUG)
       MESSAGE (STATUS "[${PROJECT_NAME}-START-STATUS] CMAKE_C_COMPILER_ID does not match MSVC: ${CMAKE_C_COMPILER_ID}")


CMake: stick to c++17 only for now. use utf-8

--- cmake/compileoptions.cmake
+++ cmake/compileoptions.cmake
@@ -79,8 +79,7 @@
             if(NOT IVW_USE_OPENMP)
                 list(APPEND comp_opts "/permissive-")
             endif()
-            list(APPEND comp_opts "/std:c++latest")
-            #list(APPEND comp_opts "/diagnostics:caret") not supporeted by cmake yet... https://developercommunity.visualstudio.com/content/problem/9385/cmakeliststxt-cannot-override-diagnosticsclassic-d.html
+            list(APPEND comp_opts "/utf-8")
         endif()
         if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR
             "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")


build_system: add define for Linux as well

This is needed for some ifdefs in the serial connection.

--- cmake/compiler_flags.cmake
+++ cmake/compiler_flags.cmake
@@ -38,6 +38,10 @@
     add_definitions("-DAPPLE")
 endif()

+if(LINUX)
+    add_definitions("-DLINUX")
+endif()
+
 # Add DEBUG define for Debug target because that is not done automatically.
 set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")


qibuild/cmake: target: fixes for mingw, cleaner code

* It'now a bit easier to understand (hopefully)

* on mingw, dll are created in sdk/bin/ unless a subfolder argument
has beed given, in this case, they end up in sdk/lib/SUBFOLDER.

--- cmake/qibuild/target.cmake
+++ cmake/qibuild/target.cmake
@@ -224,11 +224,7 @@
   cmake_parse_arguments(ARG "NOBINDLL;NO_INSTALL;NO_STAGE;NO_FPIC;SHARED;STATIC" "SUBFOLDER" "SRC;SUBMODULE;DEPENDS" ${ARGN})

   if (ARG_NOBINDLL)
-    # NOBINDLL was used for naoqi modules.
-    # We wanted them to end up in
-    # sdk/lib/naoqi/my_module.dll, and not in
-    # sdk/bin/my_module.dll  (which is the place dll should
-    # normally go on windows: next to the .exe)
+    # Kept here for historical reason: TODO: fix this in qibuild/compat.
     qi_deprecated("Use of NOBINDLL is deprectated")
   endif()
   qi_debug("qi_create_lib(${name} ${ARG_SUBFOLDER})")
@@ -280,48 +276,76 @@

   qi_use_lib("${name}" ${ARG_DEPENDS})

+
   if (MSVC)
     # always postfix debug lib/bin with _d ...
     set_target_properties("${name}" PROPERTIES DEBUG_POSTFIX "_d")
-    # ... and generate libraries and next to executables.
-    if("${ARG_SUBFOLDER}" STREQUAL "")
-    set_target_properties("${name}"
-      PROPERTIES
-        RUNTIME_OUTPUT_DIRECTORY "${QI_SDK_DIR}"
-        ARCHIVE_OUTPUT_DIRECTORY "${QI_SDK_DIR}"
-        LIBRARY_OUTPUT_DIRECTORY "${QI_SDK_DIR}"
-    )
+  endif()
+
+  # Handle output directories
+  if("${ARG_SUBFOLDER}" STREQUAL "")
+    if(WIN32)
+    # Always generate libraries and next to executables, when
+    # no subfolder is given
+      if(MSVC)
+        # Since VS always add the build configuration to the output
+        # directory, we have to use the same output directory for
+        # .exe and .dll, otherwise foo.exe will not be able to find
+        # foo.dll
+        set_target_properties("${name}"
+          PROPERTIES
+            LIBRARY_OUTPUT_DIRECTORY "${QI_SDK_DIR}"
+            RUNTIME_OUTPUT_DIRECTORY "${QI_SDK_DIR}"
+            ARCHIVE_OUTPUT_DIRECTORY "${QI_SDK_DIR}"
+        )
+      else()
+        # MinGW: just use QI_SDK_BIN for runtine targets.
+        set_target_properties("${name}" PROPERTIES
+          RUNTIME_OUTPUT_DIRECTORY "${QI_SDK_DIR}/${QI_SDK_BIN}"
+          LIBRARY_OUTPUT_DIRECTORY "${QI_SDK_DIR}/${QI_SDK_LIB}"
+          ARCHIVE_OUTPUT_DIRECTORY "${QI_SDK_DIR}/${QI_SDK_LIB}"
+        )
+      endif()
+    else() # no windows
+      set_target_properties("${name}" PROPERTIES
+            RUNTIME_OUTPUT_DIRerror: Cannot lock the ref 'ORIG_HEAD'.ECTORY "${QI_SDK_DIR}/${QI_SDK_LIB}"
+            LIBRARY_OUTPUT_DIRECTORY "${QI_SDK_DIR}/${QI_SDK_LIB}"
+            ARCHIVE_OUTPUT_DIRECTORY "${QI_SDK_DIR}/${QI_SDK_LIB}"
+          )
+    endif()
+  else()
+      # A subfolder has beed given, so the dll is in fact a plugin,
+      # and it should always be in sdk/lib/SUBFOLER
+      if (MSCV)
+        # You can't just use a _OUTPUT_DIRECTORY property, because VS will always
+        # append the build configuration to this path.
+        # After qi_create_bin(foo), foo.exe is in build/sdk/Release/foo.exe,
+        # So we need to copy paste hello.dll from build/src/hello/Release/hello.dll to
+        # build/sdk/Release/${SUBFOLER}/hello.dll
+        # We will achieve this using a post-build rule using post-copy-plugin.cmake.
+        configure_file(${QI_ROOT_DIR}/templates/post-copy-plugin.cmake
+                       ${CMAKE_BINARY_DIR}/post-copy-plugin.cmake
+                       COPYONLY)
+        get_target_property(_location_release "${name}" LOCATION_RELEASE)
+        get_target_property(_location_debug   "${name}" LOCATION_DEBUG)
+        add_custom_command(TARGET ${name} POST_BUILD
+          COMMAND
+            "${CMAKE_COMMAND}"
+            -DBUILD_TYPE=${CMAKE_CFG_INTDIR}
+            -DLOCATION_DEBUG="${_location_debug}"
+            -DLOCATION_RELEASE="${_location_release}"
+            -DOUTPUT="${QI_SDK_DIR}/${CMAKE_CFG_INTDIR}/${QI_SDK_LIB}/${ARG_SUBFOLDER}"
+            -P "${CMAKE_BINARY_DIR}/post-copy-plugin.cmake"
+            "${CMAKE_BINARY_DIR}"
+        )
     else()
-      # After qi_create_bin(foo), foo.exe is in build/sdk/Release/foo.exe,
-      # So we need to copy paste hello.dll from build/src/hello/Release/hello.dll to
-      # build/sdk/Release/${SUBFOLER}/hello.dll
-      # We will achieve this using a post-build rule using post-copy-plugin.cmake.
-      configure_file(${QI_ROOT_DIR}/templates/post-copy-plugin.cmake
-                     ${CMAKE_BINARY_DIR}/post-copy-plugin.cmake
-                     COPYONLY)
-
-
-      get_target_property(_location_release "${name}" LOCATION_RELEASE)
-      get_target_property(_location_debug   "${name}" LOCATION_DEBUG)
-
-
-      add_custom_command(TARGET ${name} POST_BUILD
-        COMMAND
-          "${CMAKE_COMMAND}"
-          -DBUILD_TYPE=${CMAKE_CFG_INTDIR}
-          -DLOCATION_DEBUG="${_location_debug}"
-          -DLOCATION_RELEASE="${_location_release}"
-          -DOUTPUT="${QI_SDK_DIR}/${CMAKE_CFG_INTDIR}/${QI_SDK_LIB}/${ARG_SUBFOLDER}"
-          -P "${CMAKE_BINARY_DIR}/post-copy-plugin.cmake"
-          "${CMAKE_BINARY_DIR}"
+        # NO MSCV and a SUBFOLER : simply use _OUTPUT_DIRECTORY properties
+      set_target_properties("${name}" PROPERTIES
+          RUNTIME_OUTPUT_DIRECTORY "${QI_SDK_DIR}/${QI_SDK_LIB}/${ARG_SUBFOLDER}"
+          ARCHIVE_OUTPUT_DIRECTORY "${QI_SDK_DIR}/${QI_SDK_LIB}/${ARG_SUBFOLDER}"
+          LIBRARY_OUTPUT_DIRECTORY "${QI_SDK_DIR}/${QI_SDK_LIB}/${ARG_SUBFOLDER}"
       )
     endif()
-  else()
-    set_target_properties("${name}" PROPERTIES
-        RUNTIME_OUTPUT_DIRECTORY "${QI_SDK_DIR}/${QI_SDK_LIB}/${ARG_SUBFOLDER}"
-        ARCHIVE_OUTPUT_DIRECTORY "${QI_SDK_DIR}/${QI_SDK_LIB}/${ARG_SUBFOLDER}"
-        LIBRARY_OUTPUT_DIRECTORY "${QI_SDK_DIR}/${QI_SDK_LIB}/${ARG_SUBFOLDER}"
-    )
   endif()

   #make install rules


Tweak fix for CUDA not-enabled with ARB_ARCH specification. (#586)

Fixes #584.

* Add CUDA compile guard generator expression to architecture options iff CUDA is an enabled language.

--- cmake/CompilerOptions.cmake
+++ cmake/CompilerOptions.cmake
@@ -135,7 +135,8 @@
         endif()
     endif()

-    if (ARB_WITH_GPU)
+    get_property(enabled_languages GLOBAL PROPERTY ENABLED_LANGUAGES)
+    if ("CUDA" IN_LIST enabled_languages)
         # Prefix architecture options with `-Xcompiler=` when compiling CUDA sources, i.e.
         # with nvcc.
         set(arch_opt_cuda_guarded)
@@ -144,6 +145,8 @@
         endforeach()

         set("${optvar}" "${arch_opt_cuda_guarded}" PARENT_SCOPE)
+    else()
+        set("${optvar}" "${arch_opt}" PARENT_SCOPE)
     endif()

 endfunction()


add testing and unstable debian

add testing and unstable debian

--- cmake/EnumerateSystem.cmake
+++ cmake/EnumerateSystem.cmake
@@ -51,6 +51,12 @@
         if(${LINUX_VER} MATCHES "7")
           set(LINUX_VER "wheezy")
         endif()
+        if(${LINUX_VER} MATCHES "98")
+          set(LINUX_VER "testing")
+        endif()
+        if(${LINUX_VER} MATCHES "99")
+          set(LINUX_VER "unstable")
+        endif()
       endif(LINUX_ISSUE MATCHES "Debian")

       #Find CPU Arch


enable -fno-math-errno as we never check errno (#9281)

- disables setting of the errno variable as required by C89/C99 on calling math library routines

--- cmake/common/px4_base.cmake
+++ cmake/common/px4_base.cmake
@@ -361,7 +361,10 @@
 	set(_optimization_flags
 		-fno-strict-aliasing
 		-fomit-frame-pointer
+
+		-fno-math-errno
 		-funsafe-math-optimizations
+
 		-ffunction-sections
 		-fdata-sections
 		)


Update default.cmake

Update default.cmake

--- cmake/configs/default.cmake
+++ cmake/configs/default.cmake
@@ -24,7 +24,7 @@

 # NOTE: no names with spaces!

-hunter_config(puffin-stream VERSION 0.2.1.0)
+hunter_config(puffin-stream VERSION 0.2.2.0)
 hunter_config(puffin-buffer VERSION 0.3.0.0)
 hunter_config(AllTheFlopsThreads VERSION 0.1-p0)
 hunter_config(Android-Apk VERSION 1.1.13)


Improve iOSBuildHelpers.cmake

Improve iOSBuildHelpers.cmake

--- cmake/iOSBuildHelpers.cmake
+++ cmake/iOSBuildHelpers.cmake
@@ -1,15 +1,18 @@
 # Set the Base SDK (only change the SDKVER value, if for instance, you are building for iOS 5.0):
-SET(SDKVER "9.3")
+IF(NOT SDKVER)
+	MESSAGE(ERROR "Please define SDKVER variable for iOS")
+ENDIF()
+
 SET(DEVROOT "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer")
 SET(SDKROOT "${DEVROOT}/SDKs/iPhoneOS${SDKVER}.sdk")
 IF(EXISTS ${SDKROOT})
-	SET(CMAKE_OSX_SYSROOT "${SDKROOT}")
+	SET(CMAKE_OSX_SYSROOT "iphoneos${SDKVER}")
 ELSE()
 	MESSAGE("Warning, iOS Base SDK path not found: " ${SDKROOT})
 ENDIF()

 # Will resolve to "Standard (armv6 armv7)" on Xcode 4.0.2 and to "Standard (armv7)" on Xcode 4.2:
-SET(CMAKE_OSX_ARCHITECTURES "$(ARCHS_STANDARD_32_BIT)")
+SET(CMAKE_OSX_ARCHITECTURES "$(ARCHS_STANDARD)")

 # seamless toggle between device and simulator
 SET(CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos;-iphonesimulator")
@@ -27,4 +30,15 @@
 		TARGET_LINK_LIBRARIES(${appname} ${FRAMEWORK_${fwname}})
 		MESSAGE(STATUS "Framework ${fwname} found at ${FRAMEWORK_${fwname}}")
 	ENDIF()
-ENDMACRO(ADD_FRAMEWORK)+ENDMACRO(ADD_FRAMEWORK)
+
+# This little macro lets you set any XCode specific property.
+MACRO(SET_XCODE_PROPERTY TARGET XCODE_PROPERTY XCODE_VALUE)
+	SET_PROPERTY(TARGET ${TARGET} PROPERTY
+			XCODE_ATTRIBUTE_${XCODE_PROPERTY} ${XCODE_VALUE})
+ENDMACRO(SET_XCODE_PROPERTY)
+
+MACRO(SET_XCODE_PROPERTY_VARIANT TARGET XCODE_PROPERTY XCODE_VARIANT XCODE_VALUE)
+	SET_PROPERTY(TARGET ${TARGET} PROPERTY
+			XCODE_ATTRIBUTE_${XCODE_PROPERTY}[variant=${XCODE_VARIANT}] ${XCODE_VALUE})
+ENDMACRO(SET_XCODE_PROPERTY_VARIANT)


[CMake] Feed BUNDLE_PATH through llvm target wrappers

This feeds the new llvm_codsign BUNDLE_PATH option through from the llvm target wrapper functions, so that you can specify the BUNDLE_PATH on the target's codesign.

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

--- cmake/modules/AddLLVM.cmake
+++ cmake/modules/AddLLVM.cmake
@@ -390,7 +390,7 @@
 function(llvm_add_library name)
   cmake_parse_arguments(ARG
     "MODULE;SHARED;STATIC;OBJECT;DISABLE_LLVM_LINK_LLVM_DYLIB;SONAME;NO_INSTALL_RPATH"
-    "OUTPUT_NAME;PLUGIN_TOOL;ENTITLEMENTS"
+    "OUTPUT_NAME;PLUGIN_TOOL;ENTITLEMENTS;BUNDLE_PATH"
     "ADDITIONAL_HEADERS;DEPENDS;LINK_COMPONENTS;LINK_LIBS;OBJLIBS"
     ${ARGN})
   list(APPEND LLVM_COMMON_DEPENDS ${ARG_DEPENDS})
@@ -594,7 +594,7 @@

   if(ARG_SHARED OR ARG_MODULE)
     llvm_externalize_debuginfo(${name})
-    llvm_codesign(${name} ENTITLEMENTS ${ARG_ENTITLEMENTS})
+    llvm_codesign(${name} ENTITLEMENTS ${ARG_ENTITLEMENTS} BUNDLE_PATH ${ARG_BUNDLE_PATH})
   endif()
   # clang and newer versions of ninja use high-resolutions timestamps,
   # but older versions of libtool on Darwin don't, so the archive will
@@ -716,7 +716,7 @@
 macro(add_llvm_executable name)
   cmake_parse_arguments(ARG
     "DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO;NO_INSTALL_RPATH"
-    "ENTITLEMENTS"
+    "ENTITLEMENTS;BUNDLE_PATH"
     "DEPENDS"
     ${ARGN})

@@ -798,7 +798,7 @@
     target_link_libraries(${name} PRIVATE ${LLVM_PTHREAD_LIB})
   endif()

-  llvm_codesign(${name} ENTITLEMENTS ${ARG_ENTITLEMENTS})
+  llvm_codesign(${name} ENTITLEMENTS ${ARG_ENTITLEMENTS} BUNDLE_PATH ${ARG_BUNDLE_PATH})
 endmacro(add_llvm_executable name)

 function(export_executable_symbols target)


Extending FindLZ4.cmake with xxhash includes/library needed for LZ4 checksum functionality

--- cmake/modules/FindLZ4.cmake
+++ cmake/modules/FindLZ4.cmake
@@ -10,11 +10,21 @@
 endif()
 set(LZ4_FOUND 0)

-find_path(LZ4_INCLUDE_DIR lz4.h
+find_path(LZ4_INCLUDE_DIR NAMES lz4.h PATHS
   $ENV{LZ4_DIR}/include
+  /usr/include
   /usr/local/include
   /opt/lz4/include
   DOC "Specify the directory containing lz4.h"
+)
+
+# Checking for xxhash library includes (part of https://github.com/lz4/lz4.git,
+# but not provided in .deb and .rpm packages)
+find_path(XXHASH_INCLUDE_DIR NAMES xxhash.h PATHS
+  /usr/include
+  /usr/local/include
+  /opt/xxhash/include
+  DOC "Specify the directory containing xxhash.h"
 )

 find_library(LZ4_LIBRARY NAMES lz4 PATHS
@@ -29,13 +39,29 @@
   DOC "Specify the lz4 library here."
 )

-if(LZ4_INCLUDE_DIR AND LZ4_LIBRARY)
+# Checking for xxhash library, in case it was built separately from
+# https://github.com/Cyan4973/xxHash.git
+find_library(XXHASH_LIBRARY NAMES xxhash PATHS
+  /usr/local/lib
+  /usr/lib
+  DOC "Specify the xxhash library here."
+)
+
+if(LZ4_INCLUDE_DIR AND LZ4_LIBRARY AND XXHASH_INCLUDE_DIR)
   set(LZ4_FOUND 1)
   if(NOT LZ4_FIND_QUIETLY)
      message(STATUS "Found LZ4 includes at ${LZ4_INCLUDE_DIR}")
      message(STATUS "Found LZ4 library at ${LZ4_LIBRARY}")
+     message(STATUS "Found xxhash include at ${XXHASH_INCLUDE_DIR}")
   endif()
 endif()

 set(LZ4_LIBRARIES ${LZ4_LIBRARY})
-mark_as_advanced(LZ4_FOUND LZ4_LIBRARY LZ4_INCLUDE_DIR)
+if(XXHASH_LIBRARY)
+  list(APPEND LZ4_LIBRARIES ${XXHASH_LIBRARY})
+endif()
+if(NOT("${XXHASH_INCLUDE_DIR}" MATCHES ${LZ4_INCLUDE_DIR}))
+  list(APPEND LZ4_INCLUDE_DIR ${XXHASH_INCLUDE_DIR})
+endif()
+
+mark_as_advanced(LZ4_FOUND LZ4_LIBRARY LZ4_INCLUDE_DIR XXHASH_INCLUDE_DIR)


Added missing header and lib search paths for PNaCl

--- cmake/pnacl.toolchain.cmake
+++ cmake/pnacl.toolchain.cmake
@@ -40,6 +40,10 @@
 elseif()
     message(FATAL_ERROR "FIXME: set the right host toolchain in pnacl.toolchain.cmake!")
 endif()
+
+# standard header and lib search paths
+include_directories(${NACL_SDK_ROOT}/include)
+link_directories(${NACL_SDK_ROOT}/lib/pnacl/Release)

 include(CMakeForceCompiler)
 CMAKE_FORCE_C_COMPILER("${CMAKE_C_COMPILER}" GNU)


Linux fixes for new build system.

Linux fixes for new build system.

--- cmake/pumex_externals.cmake
+++ cmake/pumex_externals.cmake
@@ -11,7 +11,8 @@
   find_package( X11 REQUIRED )
   find_package( XCB REQUIRED )
   find_package( Threads REQUIRED )
-  list( APPEND PUMEX_LIBRARIES_PUBLIC XBC::XCB X11::X11 Threads::Threads )
+  list( APPEND PUMEX_PUBLIC_INCLUDES ${X11_INCLUDE_DIR} ${XCB_INCLUDE_DIRS} )
+  list( APPEND PUMEX_LIBRARIES_PUBLIC ${X11_LIBRARIES} ${XCB_LIBRARIES} Threads::Threads )
 endif()

 find_package( Vulkan REQUIRED )
@@ -43,7 +44,7 @@
   if(NOT glm_POPULATED)
     FetchContent_Populate(glm)
     add_subdirectory( ${glm_SOURCE_DIR} ${glm_BINARY_DIR} )
-	add_library( glm::glm ALIAS glm )
+    add_library( glm::glm ALIAS glm )
   endif()
   list( APPEND PUMEX_LIBRARIES_PUBLIC_DOWNLOADED glm::glm )
   list( APPEND PUMEX_PUBLIC_INCLUDES ${glm_SOURCE_DIR} )
@@ -66,7 +67,7 @@
   if(NOT gli_POPULATED)
     FetchContent_Populate(gli)
     add_subdirectory( ${gli_SOURCE_DIR} ${gli_BINARY_DIR} )
-	add_library( gli::gli ALIAS gli )
+    add_library( gli::gli ALIAS gli )
   endif()
   list( APPEND PUMEX_LIBRARIES_PUBLIC_DOWNLOADED gli::gli )
   list( APPEND PUMEX_PUBLIC_INCLUDES ${gli_SOURCE_DIR} )
@@ -89,7 +90,7 @@
     if(NOT args_POPULATED)
       FetchContent_Populate(args)
       add_subdirectory( ${args_SOURCE_DIR} ${args_BINARY_DIR} )
-	  add_library( args::args ALIAS args )
+      add_library( args::args ALIAS args )
     endif()
     list( APPEND PUMEX_LIBRARIES_EXAMPLES args::args )
     list( APPEND PUMEX_EXAMPLES_INCLUDES ${args_SOURCE_DIR} )
@@ -162,14 +163,15 @@
   if(NOT assimp_POPULATED)
     FetchContent_Populate(assimp)
     add_subdirectory( ${assimp_SOURCE_DIR} ${assimp_BINARY_DIR} )
-	add_library( Assimp::assimp ALIAS assimp )
+    add_library( Assimp::assimp ALIAS assimp )
   endif()
   list( APPEND PUMEX_LIBRARIES_PUBLIC_DOWNLOADED Assimp::assimp )
   list( APPEND PUMEX_PUBLIC_INCLUDES ${assimp_SOURCE_DIR}/include ${assimp_BINARY_DIR}/include )
   list( APPEND PUMEX_EXTERNAL_TARGETS_INSTALL assimp IrrXML )
 else()
-  find_package( assimp REQUIRED )
-  list( APPEND PUMEX_LIBRARIES_PUBLIC assimp::assimp )
+  find_package( Assimp REQUIRED )
+  list( APPEND PUMEX_PUBLIC_INCLUDES ${ASSIMP_INCLUDE_DIR} )
+  list( APPEND PUMEX_LIBRARIES_PUBLIC ${ASSIMP_LIBRARIES} )
 endif()

 if( PUMEX_DOWNLOAD_EXTERNAL_FREETYPE )
@@ -185,14 +187,15 @@
   if(NOT freetype_POPULATED)
     FetchContent_Populate(freetype)
     add_subdirectory( ${freetype_SOURCE_DIR} ${freetype_BINARY_DIR} )
-	add_library( freetype::freetype ALIAS freetype )
+    add_library( freetype::freetype ALIAS freetype )
   endif()
   list( APPEND PUMEX_LIBRARIES_PUBLIC_DOWNLOADED freetype::freetype )
   list( APPEND PUMEX_PUBLIC_INCLUDES ${freetype_SOURCE_DIR}/include ${freetype_BINARY_DIR}/include )
   list( APPEND PUMEX_EXTERNAL_TARGETS_INSTALL freetype )
 else()
-  find_package( freetype REQUIRED )
-  list( APPEND PUMEX_LIBRARIES_PUBLIC freetype::freetype )
+  find_package( Freetype REQUIRED )
+  list( APPEND PUMEX_PUBLIC_INCLUDES ${FREETYPE_INCLUDE_DIRS} )
+  list( APPEND PUMEX_LIBRARIES_PUBLIC ${FREETYPE_LIBRARIES} )
 endif()

 if( PUMEX_DOWNLOAD_EXTERNAL_TBB )
@@ -210,14 +213,15 @@
   if(NOT tbb_POPULATED)
     FetchContent_Populate(tbb)
     add_subdirectory( ${tbb_SOURCE_DIR} ${tbb_BINARY_DIR} )
-	add_library( tbb::tbb ALIAS tbb )
+    add_library( tbb::tbb ALIAS tbb )
   endif()
   list( APPEND PUMEX_LIBRARIES_PUBLIC_DOWNLOADED tbb::tbb )
   list( APPEND PUMEX_PUBLIC_INCLUDES ${tbb_SOURCE_DIR}/include )
   list( APPEND PUMEX_EXTERNAL_TARGETS_INSTALL tbb )
 else()
-  find_package( tbb COMPONENTS tbbmalloc tbbmalloc_proxy )
-  list( APPEND PUMEX_LIBRARIES_PUBLIC tbb::tbb )
+  find_package( TBB COMPONENTS tbbmalloc tbbmalloc_proxy )
+  list( APPEND PUMEX_PUBLIC_INCLUDES ${TBB_INCLUDE_DIRS} )
+  list( APPEND PUMEX_LIBRARIES_PUBLIC ${TBB_LIBRARIES} )
 endif()

 if(PUMEX_BUILD_QT)
@@ -240,14 +244,14 @@
     if(NOT png_POPULATED)
       FetchContent_Populate(png)
       add_subdirectory( ${png_SOURCE_DIR} ${png_BINARY_DIR} )
-	  add_library( png::png ALIAS png )
+      add_library( png::png ALIAS png )
     endif()
     list( APPEND PUMEX_LIBRARIES_PUBLIC_DOWNLOADED png::png )
     list( APPEND PUMEX_PUBLIC_INCLUDES ${png_SOURCE_DIR} ${png_BINARY_DIR} )
     list( APPEND PUMEX_EXTERNAL_TARGETS_INSTALL png )
   else()
-    find_package( png REQUIRED )
-    list( APPEND PUMEX_LIBRARIES_PUBLIC png::png )
+    find_package( PNG REQUIRED )
+    list( APPEND PUMEX_LIBRARIES_PUBLIC PNG::PNG )
   endif()

   if(PUMEX_DOWNLOAD_EXTERNAL_JPEG)
@@ -261,14 +265,14 @@
     if(NOT jpeg_POPULATED)
       FetchContent_Populate(jpeg)
       add_subdirectory( ${jpeg_SOURCE_DIR} ${jpeg_BINARY_DIR} )
-	  add_library( jpeg::jpeg ALIAS jpeg )
+      add_library( jpeg::jpeg ALIAS jpeg )
     endif()
     list( APPEND PUMEX_LIBRARIES_PUBLIC_DOWNLOADED jpeg::jpeg )
     list( APPEND PUMEX_PUBLIC_INCLUDES ${jpeg_SOURCE_DIR} ${jpeg_BINARY_DIR} )
     list( APPEND PUMEX_EXTERNAL_TARGETS_INSTALL jpeg )
   else()
-    find_package( jpeg REQUIRED )
-    list( APPEND PUMEX_LIBRARIES_PUBLIC jpeg::jpeg )
+    find_package( JPEG REQUIRED )
+    list( APPEND PUMEX_LIBRARIES_PUBLIC JPEG::JPEG )
   endif()
 endif()


[Build] Fixed a small typo in the detection of RPath condition rules.

--- config/project_config_embeddable.cmake
+++ config/project_config_embeddable.cmake
@@ -1279,9 +1279,11 @@
   endif (_publish_all_headers_flag)

   # Convenient message to the user/developer
-  if (NOT ${CMAKE_INSTALL_RPATH_USE_LINK_PATH}
+  if (NOT CMAKE_INSTALL_RPATH_USE_LINK_PATH
       AND "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr")
-    install (CODE "message (\"On Unix-based platforms, run export LD_LIBRARY_PATH=${INSTALL_LIB_DIR}:\$LD_LIBRARY_PATH once per session\")")
+    install (CODE "message (\"On Unix-based platforms, run "
+	  "export LD_LIBRARY_PATH=${INSTALL_LIB_DIR}:\$LD_LIBRARY_PATH "
+	  "once per session\")")
   endif()

 endmacro (module_library_add_standard)


[DSim -> TravelSim].

[DSim -> TravelSim].

--- config/project_config_embeddable.cmake
+++ config/project_config_embeddable.cmake
@@ -1068,21 +1068,21 @@
   endif (${ARGC} GREATER 0)

   find_package (DSim ${_required_version} REQUIRED
-	HINTS ${WITH_DSIM_PREFIX})
+	HINTS ${WITH_TVLSIM_PREFIX})
   if (DSim_FOUND)
     #
-    message (STATUS "Found DSim version: ${DSIM_VERSION}")
+    message (STATUS "Found DSim version: ${TVLSIM_VERSION}")

     # Update the list of include directories for the project
-    include_directories (${DSIM_INCLUDE_DIRS})
+    include_directories (${TVLSIM_INCLUDE_DIRS})

     # Update the list of dependencies for the project
-    set (PROJ_DEP_LIBS_FOR_LIB ${PROJ_DEP_LIBS_FOR_LIB} ${DSIM_LIBRARIES})
+    set (PROJ_DEP_LIBS_FOR_LIB ${PROJ_DEP_LIBS_FOR_LIB} ${TVLSIM_LIBRARIES})

   else (DSim_FOUND)
     set (ERROR_MSG "The DSim library cannot be found. If it is installed in")
     set (ERROR_MSG "${ERROR_MSG} a in a non standard directory, just invoke")
-    set (ERROR_MSG "${ERROR_MSG} 'cmake' specifying the -DWITH_DSIM_PREFIX=")
+    set (ERROR_MSG "${ERROR_MSG} 'cmake' specifying the -DWITH_TVLSIM_PREFIX=")
     set (ERROR_MSG "${ERROR_MSG}<DSim install path> variable.")
     message (FATAL_ERROR "${ERROR_MSG}")
   endif (DSim_FOUND)
@@ -2350,12 +2350,12 @@
   if (DSim_FOUND)
     message (STATUS)
     message (STATUS "* DSim:")
-    message (STATUS "  - DSIM_VERSION .................. : ${DSIM_VERSION}")
-    message (STATUS "  - DSIM_BINARY_DIRS .............. : ${DSIM_BINARY_DIRS}")
-    message (STATUS "  - DSIM_EXECUTABLES .............. : ${DSIM_EXECUTABLES}")
-    message (STATUS "  - DSIM_LIBRARY_DIRS ............. : ${DSIM_LIBRARY_DIRS}")
-    message (STATUS "  - DSIM_LIBRARIES ................ : ${DSIM_LIBRARIES}")
-    message (STATUS "  - DSIM_INCLUDE_DIRS ............. : ${DSIM_INCLUDE_DIRS}")
+    message (STATUS "  - TVLSIM_VERSION .................. : ${TVLSIM_VERSION}")
+    message (STATUS "  - TVLSIM_BINARY_DIRS .............. : ${TVLSIM_BINARY_DIRS}")
+    message (STATUS "  - TVLSIM_EXECUTABLES .............. : ${TVLSIM_EXECUTABLES}")
+    message (STATUS "  - TVLSIM_LIBRARY_DIRS ............. : ${TVLSIM_LIBRARY_DIRS}")
+    message (STATUS "  - TVLSIM_LIBRARIES ................ : ${TVLSIM_LIBRARIES}")
+    message (STATUS "  - TVLSIM_INCLUDE_DIRS ............. : ${TVLSIM_INCLUDE_DIRS}")
   endif (DSim_FOUND)
 endmacro (display_dsim)


[Config][CMake] Migrated to new FindPython3 (from deprecated FindPythonLibs)

--- config/project_config_embeddable.cmake
+++ config/project_config_embeddable.cmake
@@ -479,48 +479,36 @@
   unset (_required_version)
   if (${ARGC} GREATER 0)
     set (_required_version ${ARGV0})
-    message (STATUS "Requires PythonLibs-${_required_version}")
+    message (STATUS "Requires Python with version ${_required_version}; however just Python3 is considered here")
   else (${ARGC} GREATER 0)
-    message (STATUS "Requires PythonLibs without specifying any version")
+    message (STATUS "Requires Python3; any version will do")
   endif (${ARGC} GREATER 0)

   # The first check searches for the libraries and include paths.
   # However, on some older versions (e.g., on RedHat/CentOS 5.x),
   # only the static library is searched.
-  find_package (PythonLibs ${_required_version} REQUIRED)
+  find_package (Python3 COMPONENTS Interpreter Development REQUIRED)

   # The second check is to get the dynamic library for sure.
-  find_package (PythonLibsWrapper ${_required_version} REQUIRED)
-
-  if (PYTHONLIBS_FOUND)
-	# Derive the version of Python (for whatever reason, FindPythonLibs
-	# does not seem to provide that version variable.
-	get_filename_component (PYTHONLIBS_LIB_FILENAME ${PYTHON_LIBRARIES} NAME)
-	string (REGEX REPLACE "^libpython([0-9]+.[0-9]+).*$" "\\1"
-	  PYTHONLIBS_VERSION "${PYTHONLIBS_LIB_FILENAME}")
-
-	if (${PYTHONLIBS_VERSION_STRING} MATCHES "([0-9]).([0-9]).([0-9])")
-	  set (PY_MAJOR_VERSION "${CMAKE_MATCH_1}")
-	  set (PY_MINOR_VERSION "${CMAKE_MATCH_2}")
-	  set (PY_PATCH_VERSION "${CMAKE_MATCH_3}")
-	endif (${PYTHONLIBS_VERSION_STRING} MATCHES "([0-9]).([0-9]).([0-9])")
-
-	message (STATUS "Found PythonLibs ${PYTHONLIBS_VERSION} (${PYTHONLIBS_VERSION_STRING} / ${PY_MAJOR_VERSION}.${PY_MINOR_VERSION}.${PY_PATCH_VERSION})")
-
-	# Set the Python installation directory
-	set (INSTALL_PY_LIB_DIR
-	  ${INSTALL_LIB_DIR}/python${PYTHONLIBS_VERSION}/site-packages/py${PROJECT_NAME}
-	  CACHE PATH "Installation directory for Python libraries")
-
-	# Update the list of include directories for the project
-    include_directories (${PYTHON_INCLUDE_DIRS})
+  #find_package (PythonLibsWrapper ${_required_version} REQUIRED)
+
+  if (Python3_FOUND)
+    message (STATUS "Found Python3 ${Python3_VERSION} (${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}.${Python3_VERSION_PATCH})")
+
+    # Set the Python installation directory
+    set (INSTALL_PY_LIB_DIR
+      ${INSTALL_LIB_DIR}/python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}/site-packages/py${PROJECT_NAME}
+      CACHE PATH "Installation directory for Python libraries")
+
+    # Update the list of include directories for the project
+    include_directories (${Python3_INCLUDE_DIRS})

     # Update the list of dependencies for the project
-    list (APPEND PROJ_DEP_LIBS_FOR_LIB ${PYTHON_LIBRARIES})
-
-  else (PYTHONLIBS_FOUND)
+    list (APPEND PROJ_DEP_LIBS_FOR_LIB ${Python3_LIBRARIES})
+
+  else (Python3_FOUND)
 	message (FATAL_ERROR "Python libraries are missing. Please install them (e.g., 'python-devel' for the Fedora/RedHat package)")
-  endif (PYTHONLIBS_FOUND)
+  endif (Python3_FOUND)

 endmacro (get_python)

@@ -618,8 +606,8 @@
   #         On some platform/Boost version combinations, the Python version
   #         may be just the major version (2 or 3 as of 2019) or the major
   #         and minor versions (e.g., 27, 28, 34, 36, 37 as of 2019)
-  set (python_cpt_name1 "python${PY_MAJOR_VERSION}")
-  set (python_cpt_name2 "python${PY_MAJOR_VERSION}${PY_MINOR_VERSION}")
+  set (python_cpt_name1 "python${Python3_VERSION_MAJOR}")
+  set (python_cpt_name2 "python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}")
   set (Boost_USE_STATIC_LIBS OFF)
   set (Boost_USE_MULTITHREADED ON)
   set (Boost_USE_STATIC_RUNTIME OFF)
@@ -1473,7 +1461,7 @@
   set (exec_prefix   ${prefix})
   set (bindir        ${exec_prefix}/bin)
   set (libdir        ${exec_prefix}/${LIBDIR})
-  set (pylibdir	     ${libdir}/python${PYTHONLIBS_VERSION}/site-packages/py${PACKAGE})
+  set (pylibdir	     ${libdir}/python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}/site-packages/py${PACKAGE})
   set (libexecdir    ${exec_prefix}/libexec)
   set (sbindir       ${exec_prefix}/sbin)
   set (sysconfdir    ${prefix}/etc)
@@ -2555,27 +2543,26 @@

 # Python
 macro (display_python)
-  if (PYTHONLIBS_FOUND)
+  if (Python3_FOUND)
     message (STATUS)
-	message (STATUS "* Python:")
-	message (STATUS "  - PYTHONLIBS_VERSION ............ : ${PYTHONLIBS_VERSION}")
-	message (STATUS "  - PY_{MAJOR,MINOR,PATCH}_VERSION  : ${PY_MAJOR_VERSION}.${PY_MINOR_VERSION}.${PY_PATCH_VERSION}")
-	message (STATUS "  - PYTHON_LIBRARIES .............. : ${PYTHON_LIBRARIES}")
-	message (STATUS "  - PYTHON_INCLUDE_PATH ........... : ${PYTHON_INCLUDE_PATH}")
-	message (STATUS "  - PYTHON_INCLUDE_DIRS ........... : ${PYTHON_INCLUDE_DIRS}")
-	message (STATUS "  - PYTHON_DEBUG_LIBRARIES ........ : ${PYTHON_DEBUG_LIBRARIES}")
-	message (STATUS "  - Python_ADDITIONAL_VERSIONS .... : ${Python_ADDITIONAL_VERSIONS}")
-  endif (PYTHONLIBS_FOUND)
+    message (STATUS "* Python:")
+    message (STATUS "  - Python3_VERSION ............... : ${Python3_VERSION}")
+    message (STATUS "  - Python3_VERSION_{MJR,MNR,PTCH}  : ${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}.${Python3_VERSION_PATCH}")
+    message (STATUS "  - Python3_INCLUDE_DIRS .......... : ${Python3_INCLUDE_DIRS}")
+    message (STATUS "  - Python3_LIBRARIES ............. : ${Python3_LIBRARIES}")
+    message (STATUS "  - Python3_LIBRARY_DIRS .......... : ${Python3_LIBRARY_DIRS}")
+    message (STATUS "  - Python3_RUNTIME_LIBRARY_DIRS .. : ${Python3_RUNTIME_LIBRARY_DIRS}")
+  endif (Python3_FOUND)
 endmacro (display_python)

 # ICU
 macro (display_icu)
   if (ICU_FOUND)
     message (STATUS)
-	message (STATUS "* ICU:")
-	message (STATUS "  - ICU_VERSION ................... : ${ICU_VERSION}")
-	message (STATUS "  - ICU_LIBRARIES ................. : ${ICU_LIBRARIES}")
-	message (STATUS "  - ICU_INCLUDE_DIRS .............. : ${ICU_INCLUDE_DIR}")
+    message (STATUS "* ICU:")
+    message (STATUS "  - ICU_VERSION ................... : ${ICU_VERSION}")
+    message (STATUS "  - ICU_LIBRARIES ................. : ${ICU_LIBRARIES}")
+    message (STATUS "  - ICU_INCLUDE_DIRS .............. : ${ICU_INCLUDE_DIR}")
   endif (ICU_FOUND)
 endmacro (display_icu)


Updated intel target

Updated intel target

--- Targets/Intel.cmake
+++ Targets/Intel.cmake
@@ -4,6 +4,9 @@
 set(CMAKE_C_COMPILER mpiicc)
 set(CMAKE_Fortran_COMPILER mpiifort)
 set(CMAKE_CXX_COMPILER mpiicpc)
+
+# Library Files
+set(TOOLCHAIN_LIBS "-lblas -llapack")

 # Release suggestions
 set(CXX_TOOLCHAINFLAGS_RELEASE "-O3 -qopenmp -lgomp -fPIC")


try to make try_compile work when cross compiling

--- PyPort/compile-python.cmake
+++ PyPort/compile-python.cmake
@@ -15,6 +15,7 @@
 			-DBUILD_EXTENSIONS_AS_BUILTIN=ON
 			-DCMAKE_DEBUG_POSTFIX=${CMAKE_DEBUG_POSTFIX}
 			-DCMAKE_CROSSCOMPILING_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}
+			-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY
 			${PYTHON_LINK_OPT}
 		CACHE STRING "cmake options to use when building using submodule to build Python"
 	)


CMake: the CL_DISABLE_HALF checks printed scary-looking errors

This silences the checks (most compiler/device combos don't support
halfs anyway)

--- cmake/LLVM.cmake
+++ cmake/LLVM.cmake
@@ -251,7 +251,7 @@
 ####################################################################

 # try compile with any compiler (supplied as argument)
-macro(custom_try_compile_any COMPILER SUFFIX SOURCE RES_VAR)
+macro(custom_try_compile_any SILENT COMPILER SUFFIX SOURCE RES_VAR)
   string(RANDOM RNDNAME)
   set(RANDOM_FILENAME "${CMAKE_BINARY_DIR}/compile_test_${RNDNAME}.${SUFFIX}")
   file(WRITE "${RANDOM_FILENAME}" "${SOURCE}")
@@ -259,7 +259,7 @@
   math(EXPR LSIZE "${ARGC} - 4")

   execute_process(COMMAND "${COMPILER}" ${ARGN} "${RANDOM_FILENAME}" RESULT_VARIABLE ${RES_VAR} OUTPUT_VARIABLE OV ERROR_VARIABLE EV)
-  if(${${RES_VAR}})
+  if(${${RES_VAR}} AND (NOT ${SILENT}))
     message(STATUS " ########## The command: ")
     string(REPLACE ";" " " ARGN_STR "${ARGN}")
     message(STATUS "${COMPILER} ${ARGN_STR} ${RANDOM_FILENAME}")
@@ -285,7 +285,20 @@
   ${SOURCE2}

   }")
-  custom_try_compile_any("${COMPILER}" ${SUFFIX} "${SOURCE_PROG}" ${RES_VAR} ${ARGN})
+  custom_try_compile_any(FALSE "${COMPILER}" ${SUFFIX} "${SOURCE_PROG}" ${RES_VAR} ${ARGN})
+endmacro()
+
+# convenience c/c++ source wrapper
+macro(custom_try_compile_c_cxx_silent COMPILER SUFFIX SOURCE1 SOURCE2 RES_VAR)
+  set(SOURCE_PROG "
+  ${SOURCE1}
+
+  int main(int argc, char** argv) {
+
+  ${SOURCE2}
+
+  }")
+  custom_try_compile_any(TRUE "${COMPILER}" ${SUFFIX} "${SOURCE_PROG}" ${RES_VAR} ${ARGN})
 endmacro()

 # clang++ try-compile macro
@@ -592,14 +605,15 @@

 if(NOT DEFINED ${CL_DISABLE_HALF})
   set(CL_DISABLE_HALF 0)
-  # TODO -march=CPU flags !
-  custom_try_compile_c_cxx("${CLANG}" "c" "__fp16 callfp16(__fp16 a) { return a * (__fp16)1.8; };" "__fp16 x=callfp16((__fp16)argc);" RESV -c ${CLANG_TARGET_OPTION}${LLC_TRIPLE} ${CLANG_MARCH_FLAG}${LLC_HOST_CPU})
+  message(STATUS "Checking fp16 support")
+  custom_try_compile_c_cxx_silent("${CLANG}" "c" "__fp16 callfp16(__fp16 a) { return a * (__fp16)1.8; };" "__fp16 x=callfp16((__fp16)argc);" RESV -c ${CLANG_TARGET_OPTION}${LLC_TRIPLE} ${CLANG_MARCH_FLAG}${LLC_HOST_CPU})
   if(RESV)
     set(CL_DISABLE_HALF 1)
   endif()
 endif()

 set(CL_DISABLE_HALF "${CL_DISABLE_HALF}" CACHE BOOL "Disable cl_khr_fp16 because fp16 is not supported")
+message(STATUS "fp16 disabled: ${CL_DISABLE_HALF}")

 ####################################################################


CMake: cleanup java.cmake

CMake: cleanup java.cmake

--- cmake/java.cmake
+++ cmake/java.cmake
@@ -1,5 +1,5 @@
-if (NOT BUILD_JAVA)
-	return()
+if(NOT BUILD_JAVA)
+  return()
 endif()

 find_package(SWIG REQUIRED)
@@ -7,5 +7,5 @@
 find_package(JNI REQUIRED)

 if(NOT TARGET ortools::ortools)
-	message(FATAL_ERROR "Java: missing ortools TARGET")
+  message(FATAL_ERROR "Java: missing ortools TARGET")
 endif()


ASAN: Remove useless CMake code

ASAN: Remove useless CMake code

--- cmake/ElektraCompiling.cmake
+++ cmake/ElektraCompiling.cmake
@@ -97,9 +97,6 @@

 if (ENABLE_ASAN)
 	set (EXTRA_FLAGS "${EXTRA_FLAGS} -fsanitize=undefined -fsanitize=address -fno-omit-frame-pointer")
-	if (NOT (APPLE OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" AND "${CMAKE_C_COMPILER_VERSION}" VERSION_GREATER "4.0")))
-		set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lubsan")
-	endif ()
 	set (ASAN_LIBRARY "-lasan") #this is needed for GIR to put asan in front

 	if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
@@ -107,10 +104,9 @@
 		set (EXTRA_FLAGS "${EXTRA_FLAGS} -fsanitize-blacklist=\"${CMAKE_SOURCE_DIR}/tests/sanitizer.blacklist\"")
 	endif ()

-	if (CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE)
+	if (CMAKE_COMPILER_IS_GNUCXX)
 		# Work around error “unrecognized option '--push-state'”
 		set (EXTRA_FLAGS "${EXTRA_FLAGS} -fuse-ld=gold")
-		set (CMAKE_SHARED_LINKER_FLAGS "-fsanitize=address ${CMAKE_SHARED_LINKER_FLAGS}")
 		# this is needed because of wrong pthread detection https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69443
 		find_package(Threads)
 		set (THREAD_LIBS_AS_NEEDED "-Wl,--as-needed ${CMAKE_THREAD_LIBS_INIT}")


Update FindNuke.cmake version

Update FindNuke.cmake version

--- cmake/Modules/FindNuke.cmake
+++ cmake/Modules/FindNuke.cmake
@@ -13,7 +13,13 @@
   list(GET _nuke_ROOT_DIRS 0 NUKE_ROOT)
 endif()

-string(REGEX MATCHALL "[0-9]+\\.[0-9]+v[0-9]" Nuke_VERSION ${NUKE_ROOT})
+string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\v([0-9]+)" "\\0;\\1;\\2;\\3" _nuke_VERSION_LIST ${NUKE_ROOT})
+
+list(GET _nuke_VERSION_LIST 1 Nuke_VERSION_MAJOR)
+list(GET _nuke_VERSION_LIST 2 Nuke_VERSION_MINOR)
+list(GET _nuke_VERSION_LIST 3 Nuke_VERSION_PATCH)
+
+set(Nuke_VERSION "${Nuke_VERSION_MAJOR}.${Nuke_VERSION_MINOR}v${Nuke_VERSION_PATCH}")

 find_path(
   Nuke_INCLUDE_DIR


Abort cmake generation if compiler does not support c++14

--- cmake/SetCompilerFlags.cmake
+++ cmake/SetCompilerFlags.cmake
@@ -18,7 +18,7 @@
 include(CheckCXXCompilerFlag)
 check_cxx_compiler_flag("-std=c++14" COMPILER_SUPPORTS_CXX14)
 if(NOT COMPILER_SUPPORTS_CXX14)
-  message(ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++14 support. Please use a different C++ compiler.")
+  message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++14 support. Please use a different C++ compiler.")
 endif()
 set(CMAKE_CXX_STANDARD 14)
 set(CMAKE_CXX_STANDARD_REQUIRED ON)


[android] Avoid linking twice with C++

[android] Avoid linking twice with C++

The Android targetted libraries already link (manually) with the Android
NDK C++ libraries. When using Clang and lld, an extra link to libc++ is
requested, which will fail because Android names it libc++_shared.so
instead. To avoid looking for the wrong name, and since the library is
referenced manually either way, request no linking with the standard C++
libraries (but add the math library in, which is implicitly linked when
C++ is linked, and it is needed for Glibc at least).

--- cmake/modules/AddSwift.cmake
+++ cmake/modules/AddSwift.cmake
@@ -430,6 +430,9 @@
     list(APPEND result "-Wl,-Bsymbolic")
   elseif("${LFLAGS_SDK}" STREQUAL "ANDROID")
     list(APPEND link_libraries "dl" "log" "atomic" "icudataswift" "icui18nswift" "icuucswift")
+    # We provide our own C++ below, so we ask the linker not to do it. However,
+    # we need to add the math library, which is linked implicitly by libc++.
+    list(APPEND result "-nostdlib++" "-lm")
     if("${LFLAGS_ARCH}" MATCHES armv7)
       list(APPEND result "${SWIFT_ANDROID_NDK_PATH}/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++_shared.so")
     elseif("${LFLAGS_ARCH}" MATCHES aarch64)


Do not link onnxruntime jni output with JNI_LIBRARIES

- Linking onnxruntime with JNI_LIBRARIES includes some unnecessary links to native libraries (e.g. libawt) which are not actually used or required by the output onnx library. This causes unsatisfied link exceptions when trying to load the onnx library without including these libraries.

--- cmake/onnxruntime_java.cmake
+++ cmake/onnxruntime_java.cmake
@@ -54,7 +54,7 @@
 add_library(onnxruntime4j_jni SHARED ${onnxruntime4j_native_src} ${onnxruntime4j_generated})
 onnxruntime_add_include_to_target(onnxruntime4j_jni onnxruntime_session)
 target_include_directories(onnxruntime4j_jni PRIVATE ${REPO_ROOT}/include ${REPO_ROOT}/java/src/main/native)
-target_link_libraries(onnxruntime4j_jni PUBLIC ${JNI_LIBRARIES} onnxruntime onnxruntime4j_generated)
+target_link_libraries(onnxruntime4j_jni PUBLIC onnxruntime onnxruntime4j_generated)

 # Now the jar, jni binary and shared lib binary have been built, now to build the jar with the binaries added.


BUG: itk::RGBPixel<unsigned short> needs to be wrapped for itkTIFFImageIO

By default, wrap itk::RGBPixel<unsigned short>.
If itk::RGBPixel<unsigned short> is not wrapped, a warning is displayed
at compilation time:
  itkTIFFImageIO: warning(4): ITK type not wrapped, or currently not known:\
    itk::RGBPixel< unsigned short >

Change-Id: I4ec9a868446163506c1608dcdcfb17f1ac4bb74c

--- Wrapping/WrapITKTypes.cmake
+++ Wrapping/WrapITKTypes.cmake
@@ -161,9 +161,8 @@
     ADD_TEMPLATE("${ITKM_UC}" "${ITKT_UC}")
   endif()

-  if(ITK_WRAP_rgb_unsigned_short)
-    ADD_TEMPLATE("${ITKM_US}" "${ITKT_US}")
-  endif()
+  # Required by itkTIFFImageIO
+  ADD_TEMPLATE("${ITKM_US}" "${ITKT_US}")

 END_WRAP_TYPE()
 set(itk_Wrap_RGBPixel ${WRAPPER_TEMPLATES})


reverted activation of Qt in OpenCV

reverted activation of Qt in OpenCV

--- CMakeExternals/OpenCV.cmake
+++ CMakeExternals/OpenCV.cmake
@@ -43,7 +43,7 @@
     # 12-09-11, muellerm, removed automatic usage again, since this will struggle with the MITK Qt application object
     if(MITK_USE_QT)
       list(APPEND additional_cmake_args
-           -DWITH_QT:BOOL=ON
+           -DWITH_QT:BOOL=OFF
            -DWITH_QT_OPENGL:BOOL=OFF
            -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}
           )


cmake: removed debug statements

cmake: removed debug statements

--- CMakeModules/hgscript.cmake
+++ CMakeModules/hgscript.cmake
@@ -9,8 +9,6 @@
 endif(MERCURIAL_FOUND)
 file(READ ${INPUT} CONTENT)
 string(REGEX REPLACE "#CSG_HG_ID#" "${THIS_HG_ID}" NEW_CONTENT "${CONTENT}")
-string(REGEX MATCH "Copyright.*License" XXX "${CONTENT}")
-message("hallo ${XXX}")
 file(WRITE "${OUTPUT}.tmp" "${NEW_CONTENT}")
 execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${OUTPUT}.tmp ${OUTPUT})
 execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${OUTPUT}.tmp)


Fix oneTBB package version in CMake integration (#446)

Signed-off-by: Zheltov, Sergey1 <2caecf572425dfc72b1e4daa2cc6a716d92adb58@intel.com>

--- cmake/scripts/cmake_gen_github_configs.cmake
+++ cmake/scripts/cmake_gen_github_configs.cmake
@@ -26,22 +26,18 @@
 file(READ ${CMAKE_CURRENT_LIST_DIR}/../../include/oneapi/tbb/version.h _tbb_version_info)
 string(REGEX REPLACE ".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1" _tbb_ver_major "${_tbb_version_info}")
 string(REGEX REPLACE ".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1" _tbb_ver_minor "${_tbb_version_info}")
-string(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1" _tbb_interface_ver "${_tbb_version_info}")
+string(REGEX REPLACE ".*#define TBB_VERSION_PATCH ([0-9]+).*" "\\1" _tbb_ver_patch "${_tbb_version_info}")
 string(REGEX REPLACE ".*#define __TBB_BINARY_VERSION ([0-9]+).*" "\\1" TBB_BINARY_VERSION "${_tbb_version_info}")
 file(READ ${CMAKE_CURRENT_LIST_DIR}/../../CMakeLists.txt _tbb_cmakelist)
 string(REGEX REPLACE ".*TBBMALLOC_BINARY_VERSION ([0-9]+).*" "\\1" TBBMALLOC_BINARY_VERSION "${_tbb_cmakelist}")
 set(TBBMALLOC_PROXY_BINARY_VERSION ${TBBMALLOC_BINARY_VERSION})
 string(REGEX REPLACE ".*TBBBIND_BINARY_VERSION ([0-9]+).*" "\\1" TBBBIND_BINARY_VERSION "${_tbb_cmakelist}")

-# Parse patch and tweak versions from interface version: e.g. 12014 --> 01 - patch version, 4 - tweak version.
-math(EXPR _tbb_ver_patch "${_tbb_interface_ver} % 1000 / 10")
-math(EXPR _tbb_ver_tweak "${_tbb_interface_ver} % 10")
-
 set(COMMON_ARGS
     TBB_ROOT_REL_PATH ${TBB_ROOT_REL_PATH}
     INC_REL_PATH ${INC_REL_PATH}
     LIB_REL_PATH ${LIB_REL_PATH}
-    VERSION ${_tbb_ver_major}.${_tbb_ver_minor}.${_tbb_ver_patch}.${_tbb_ver_tweak}
+    VERSION ${_tbb_ver_major}.${_tbb_ver_minor}.${_tbb_ver_patch}
     TBB_BINARY_VERSION ${TBB_BINARY_VERSION}
     TBBMALLOC_BINARY_VERSION ${TBBMALLOC_BINARY_VERSION}
     TBBMALLOC_PROXY_BINARY_VERSION ${TBBMALLOC_PROXY_BINARY_VERSION}


Fixed path-handling with gtest / EXECUTABLE_OUTPUT_PATH, #1331

--- core/rosbuild/private.cmake
+++ core/rosbuild/private.cmake
@@ -133,11 +133,10 @@
   # Create a legal target name, in case the target name has slashes in it
   string(REPLACE "/" "_" _testname ${exe})

-
   # Create target for this test
   add_custom_target(test_${_testname}
-                    COMMAND ${PROJECT_SOURCE_DIR}/${exe} --gtest_output=xml:$ENV{ROS_ROOT}/test/test_results/${PROJECT_NAME}/${_testname}.xml
-                    DEPENDS ${PROJECT_SOURCE_DIR}/${exe}
+                    COMMAND ${EXECUTABLE_OUTPUT_PATH}/${exe} --gtest_output=xml:$ENV{ROS_ROOT}/test/test_results/${PROJECT_NAME}/${_testname}.xml
+                    DEPENDS ${EXECUTABLE_OUTPUT_PATH}/${exe}
                     WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
                     VERBATIM)
   # Don't register to check xml output here, because we may have gotten


No need to remove CMakeCache.txt when doing update

--- Modules/ManageVersion.cmake
+++ Modules/ManageVersion.cmake
@@ -118,18 +118,14 @@
 	SET(CMAKE_CACHE_TXT "${CMAKE_BINARY_DIR}/CMakeCache.txt")

 	ADD_CUSTOM_COMMAND(OUTPUT ${CHANGELOG_FILE}
-	    COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_CACHE_TXT}
 	    COMMAND ${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR}
 	    DEPENDS ${RELEASE_NOTES_FILE} ${CHANGELOG_PREV_FILE}
-	    COMMENT "ChangeLog is older than ${RELEASE_NOTES_FILE}. Rebuilding"
+	    COMMENT "Building ${CHANGELOG_FILE}"
 	    VERBATIM
 	    )

 	ADD_CUSTOM_TARGET(changelog ALL
-	    COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_CACHE_TXT}
-	    COMMAND ${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR}
-	    DEPENDS ${RELEASE_NOTES_FILE} ${CHANGELOG_PREV_FILE}
-	    COMMENT "Building ChangeLog"
+	    DEPENDS ${CHANGELOG_FILE}
 	    VERBATIM
 	    )


[build/cmake] Add tigerlake Intel CPU architecture

--- src/cmakeFindModules/OptimizeForArchitecture.cmake
+++ src/cmakeFindModules/OptimizeForArchitecture.cmake
@@ -135,7 +135,9 @@
             set(TARGET_ARCHITECTURE "silvermont")
          elseif(_cpu_model EQUAL 102)
             set(TARGET_ARCHITECTURE "cannonlake")
-         elseif(_cpu_model EQUAL 142 OR _cpu_model EQUAL 158) # 8E, 9E
+         elseif(_cpu_model EQUAL 140)
+            set(TARGET_ARCHITECTURE "tigerlake")
+            elseif(_cpu_model EQUAL 142 OR _cpu_model EQUAL 158) # 8E, 9E
             set(TARGET_ARCHITECTURE "kaby-lake")
          elseif(_cpu_model EQUAL 85) # 55
             set(TARGET_ARCHITECTURE "skylake-avx512")
@@ -274,6 +276,11 @@
       _skylake_avx512()
       list(APPEND _available_vector_units_list "avx512ifma" "avx512vbmi")
    endmacro()
+   macro(_tigerlake)
+      list(APPEND _march_flag_list "tigerlake")
+      _skylake_avx512()
+      list(APPEND _available_vector_units_list "avx512f")
+   endmacro()
    macro(_knightslanding)
       list(APPEND _march_flag_list "knl")
       _broadwell()
@@ -309,6 +316,8 @@
       endif()
    elseif(TARGET_ARCHITECTURE STREQUAL "knl")
       _knightslanding()
+   elseif(TARGET_ARCHITECTURE STREQUAL "tigerlake")
+      _tigerlake()
    elseif(TARGET_ARCHITECTURE STREQUAL "cannonlake")
       _cannonlake()
    elseif(TARGET_ARCHITECTURE STREQUAL "kaby-lake")


fix idl name issue

fix idl name issue

--- cmake/modules/Build-packet-generator.cmake
+++ cmake/modules/Build-packet-generator.cmake
@@ -11,8 +11,10 @@

 if(WIN32 OR MINGW)
   set(DOWNLOAD_URL https://github.com/dev-osrose/IDL/releases/download/idl-latest/win64-packet_generator.zip)
+  set(EXEC_POSTFIX .exe)
 else()
   set(DOWNLOAD_URL https://github.com/dev-osrose/IDL/releases/download/idl-latest/linux-packet_generator.tar.gz)
+  set(EXEC_POSTFIX )
 endif()

 ExternalProject_Add(
@@ -20,7 +22,7 @@
   URL ${DOWNLOAD_URL}
   UPDATE_DISCONNECTED true
   CONFIGURE_COMMAND ""
-  BUILD_COMMAND ${CMAKE_COMMAND} -E copy <SOURCE_DIR>/packet_generator <INSTALL_DIR>/bin
+  BUILD_COMMAND ${CMAKE_COMMAND} -E copy <SOURCE_DIR>/packet_generator${EXEC_POSTFIX} <INSTALL_DIR>/bin
   INSTALL_COMMAND ""
   BUILD_BYPRODUCTS ${_byproducts}
   INSTALL_DIR ${IDL_INSTALL_DIR}


CMake is funky on detecting Intel 17 as GCC compatible.

Summary: This adds a fallback in case that the Intel compiler is failed to be detected correctly.

Reviewers: chapuni

Reviewed By: chapuni

Subscribers: llvm-commits, mgorny

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

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

--- cmake/modules/DetermineGCCCompatible.cmake
+++ cmake/modules/DetermineGCCCompatible.cmake
@@ -7,5 +7,7 @@
     set(LLVM_COMPILER_IS_GCC_COMPATIBLE OFF)
   elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
     set(LLVM_COMPILER_IS_GCC_COMPATIBLE ON)
+  elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel" )
+    set(LLVM_COMPILER_IS_GCC_COMPATIBLE ON)
   endif()
 endif()


- change URL of Libreoffice metalink for test metalink parser

--- test/functional/ctest_functional.cmake
+++ test/functional/ctest_functional.cmake
@@ -12,9 +12,9 @@
 set(http_lcgdm_file "${http_lcgdm_base}/davix-tests/testread0011")
 set(http_dynaFed_file "${http_dynaFed_base}/davix-tests/testread0011")

-set(metalink_url "http://download.documentfoundation.org/libreoffice/stable/4.2.3/deb/x86_64/LibreOffice_4.2.3_Linux_x86-64_deb.tar.gz")
-set(metalink3_url "http://download.documentfoundation.org/libreoffice/stable/4.2.3/deb/x86_64/LibreOffice_4.2.3_Linux_x86-64_deb.tar.gz.metalink")
-set(metalink_url_direct "http://download.documentfoundation.org/libreoffice/stable/4.2.3/deb/x86_64/LibreOffice_4.2.3_Linux_x86-64_deb.tar.gz.meta4")
+set(metalink_url "http://download.documentfoundation.org/libreoffice/stable/4.1.6/deb/x86_64/LibreOffice_4.1.6_Linux_x86-64_deb.tar.gz")
+set(metalink3_url "http://download.documentfoundation.org/libreoffice/stable/4.1.6/deb/x86_64/LibreOffice_4.1.6_Linux_x86-64_deb.tar.gz.metalink")
+set(metalink_url_direct "http://download.documentfoundation.org/libreoffice/stable/4.1.6/deb/x86_64/LibreOffice_4.1.6_Linux_x86-64_deb.tar.gz.meta4")

 test_dav_endpoint_ronly( ${http_desy_base} "proxy")


Revert "Update external protobuf codebase version for Windows cmake build"

This reverts commit 07bec47ba5db4c2f2e33ecb49f23253a371bfbbe.

--- 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 396336eb961b75f03b25824fe86cf6490fb75e3a)
+set(PROTOBUF_TAG b04e5cba356212e4e8c66c61bbe0c3a20537c5b9)

 if(WIN32)
   if(${CMAKE_GENERATOR} MATCHES "Visual Studio.*")


update remus

update remus

--- superbuild/versions.cmake
+++ superbuild/versions.cmake
@@ -151,14 +151,14 @@
 else()
   #unix and mac uses the stable release
   add_revision(zeroMQ
-    URL "http://download.zeromq.org/zeromq-2.2.0.tar.gz"
-    URL_MD5 1b11aae09b19d18276d0717b2ea288f6)
+    URL "http://download.zeromq.org/zeromq-3.2.5.tar.gz"
+    URL_MD5 d4189c152fbdc45b376a30bd643f67fd)

 endif()

 add_revision(remus
-  GIT_REPOSITORY http://public.kitware.com/Remus.git
-  GIT_TAG 3cf220e0529f512039daaf64478cbac84376f1d0
+  GIT_REPOSITORY https://github.com/Kitware/Remus.git
+  GIT_TAG v0.5.2
 )

 add_revision(kml


SVN_SILENT made messages (.desktop file)

--- plugins/morse/ktpaccountskcm_plugin_morse.desktop.cmake
+++ plugins/morse/ktpaccountskcm_plugin_morse.desktop.cmake
@@ -6,6 +6,7 @@
 Comment[da]=Brugerflade til brugertilpasset kontokonfiguration til konti der bruger forbindelseshåndteringen Morse.
 Comment[de]=Eigene Benutzeroberfläche zum Einrichten von Zugängen, die die Morse-Verbindungsverwaltung verwenden.
 Comment[en_GB]=Custom account configuration user interface for accounts using the Morse connection manager.
+Comment[et]=Morse ühendusehaldurit kasutavate kontode kohandatud konto seadistamise kasutajaliides
 Comment[fr]=Interface utilisateur personnalisée pour la configuration de comptes en utilisant le gestionnaire de connexions « Morse ».
 Comment[it]=Interfaccia utente personalizzata di configurazione account per account che usano il gestore di connessioni Morse.
 Comment[nl]=Gebruikersinterface voor aangepaste accountconfiguratie voor accounts die de Morse verbindingenbeheerder gebruiken.


source environment hooks in alphanumeric order

--- ament_cmake_core/cmake/environment_hooks/ament_generate_package_environment.cmake
+++ ament_cmake_core/cmake/environment_hooks/ament_generate_package_environment.cmake
@@ -36,15 +36,14 @@
       string(SUBSTRING "${name}" ${index} -1 extension)

       # collect package hooks to be sourced for this extension
-      set(SOURCE_HOOKS "")
-      set(source_command ".")
-      if("${extension} " STREQUAL "bat ")
-        set(source_command "call")
+      set(ENVIRONMENT_HOOKS "")
+      if(NOT "${_AMENT_CMAKE_ENVIRONMENT_HOOKS_${extension}} " STREQUAL " ")
+        list(SORT _AMENT_CMAKE_ENVIRONMENT_HOOKS_${extension})
+        foreach(hook ${_AMENT_CMAKE_ENVIRONMENT_HOOKS_${extension}})
+          set(ENVIRONMENT_HOOKS
+            "${ENVIRONMENT_HOOKS}ament_append_value AMENT_ENVIRONMENT_HOOKS \"$AMENT_CURRENT_PREFIX/${hook}\"\n")
+        endforeach()
       endif()
-      foreach(hook ${_AMENT_CMAKE_ENVIRONMENT_HOOKS_${extension}})
-        set(SOURCE_HOOKS
-          "${SOURCE_HOOKS}${source_command} \"$AMENT_CURRENT_PREFIX/${hook}\"\n")
-      endforeach()

       # expand template
       configure_file(


removed tcl lib

removed tcl lib

--- vtkCMakeOptions.cmake
+++ vtkCMakeOptions.cmake
@@ -17,7 +17,7 @@
     INCLUDE_DIRECTORIES(${VTK_SOURCE_DIR}/Hybrid)
     LINK_DIRECTORIES(${VTK_BINARY_DIR}/Hybrid)
   ELSE (VTK_USE_RENDERING)
-  # error message should go here
+    MESSAGE("The Hybrid option requires Rendering, but you do not have Rendering selected." "Warning")
   ENDIF (VTK_USE_RENDERING)
 ENDIF (VTK_USE_HYBRID)

@@ -54,10 +54,6 @@
   IF (TCL_INCLUDE_PATH)
     INCLUDE_DIRECTORIES(${TCL_INCLUDE_PATH})
   ENDIF (TCL_INCLUDE_PATH)
-  IF (TCL_LIBRARY)
-    LINK_LIBRARIES (${TCL_LIBRARY})
-  ENDIF (TCL_LIBRARY)
-
   FIND_FILE(VTK_WRAP_HINTS hints ${VTK_SOURCE_DIR}/Wrapping )
   UTILITY_SOURCE(VTK_WRAP_TCL_EXE vtkWrapTcl Wrapping vtkWrapTcl.c)
 ENDIF (VTK_WRAP_TCL)