Tools: Fix esptool arguments and use flash size detection if selected

Closes https://github.com/espressif/esp-idf/issues/8798

--- components/esptool_py/project_include.cmake
+++ components/esptool_py/project_include.cmake
@@ -26,7 +26,7 @@

 set(ESPTOOLPY_CHIP "${chip_model}")

-set(ESPTOOLPY_FLASH_OPTIONS
+set(ELF2IMAGE_FLASH_OPTIONS
     --flash_mode ${ESPFLASHMODE}
     --flash_freq ${ESPFLASHFREQ}
     --flash_size ${ESPFLASHSIZE}
@@ -59,7 +59,7 @@
 endif()

 if(CONFIG_ESPTOOLPY_FLASHSIZE_DETECT)
-    # Set ESPFLASHSIZE to 'detect' *after* elf2image options are generated,
+    # Set ESPFLASHSIZE to 'detect' *after* ELF2IMAGE_FLASH_OPTIONS are generated,
     # as elf2image can't have 'detect' as an option...
     set(ESPFLASHSIZE detect)
 endif()
@@ -87,7 +87,7 @@
 #
 if(CONFIG_APP_BUILD_GENERATE_BINARIES)
     add_custom_command(OUTPUT "${build_dir}/.bin_timestamp"
-        COMMAND ${ESPTOOLPY} elf2image ${ESPTOOLPY_FLASH_OPTIONS} ${esptool_elf2image_args}
+        COMMAND ${ESPTOOLPY} elf2image ${ELF2IMAGE_FLASH_OPTIONS} ${esptool_elf2image_args}
             -o "${build_dir}/${unsigned_project_binary}" "${elf_dir}/${elf}"
         COMMAND ${CMAKE_COMMAND} -E echo "Generated ${build_dir}/${unsigned_project_binary}"
         COMMAND ${CMAKE_COMMAND} -E md5sum "${build_dir}/${unsigned_project_binary}" > "${build_dir}/.bin_timestamp"
@@ -183,7 +183,8 @@
 endif()

 idf_component_set_property(esptool_py FLASH_ARGS "${esptool_flash_main_args}")
-idf_component_set_property(esptool_py FLASH_SUB_ARGS "${ESPTOOLPY_FLASH_OPTIONS}")
+idf_component_set_property(esptool_py FLASH_SUB_ARGS "--flash_mode ${ESPFLASHMODE} --flash_freq ${ESPFLASHFREQ} \
+--flash_size ${ESPFLASHSIZE}")

 function(esptool_py_partition_needs_encryption retencrypted partition_name)
     # Check if encryption is enabled


SuperBuild: freetype does not support shared lib


ENH: Update SCIFIO to latest version on 08/29/2016

https://github.com/scifio/scifio-imageio/compare/d6ce39d855d5078589efed93f785c7289769c3c6...eb391a74e77b161e0f070539237193528c628f7b

Change-Id: If7a96c28eca18ff6164795145cb80500b7b115f6

--- Modules/Remote/SCIFIO.remote.cmake
+++ Modules/Remote/SCIFIO.remote.cmake
@@ -1,5 +1,5 @@
 itk_fetch_module(SCIFIO
   "SCIFIO (Bioformats) ImageIO plugin for ITK"
   GIT_REPOSITORY ${git_protocol}://github.com/scifio/scifio-imageio.git
-  GIT_TAG d6ce39d855d5078589efed93f785c7289769c3c6
+  GIT_TAG eb391a74e77b161e0f070539237193528c628f7b
   )


Added comment about why shared ICU4C libraries are required on Windows, and disabled shared libraries by default.

--- dependencies/Icu4c/build.cmake
+++ dependencies/Icu4c/build.cmake
@@ -48,13 +48,12 @@

 		set(EnableDebugOption)
 		set(DisableReleaseOption)
-		string(COMPARE EQUAL "${Configuration}" "Debug" IsDebug)
-		if(IsDebug)
+		if("${Configuration}" STREQUAL "Debug")
 			set(EnableDebugOption --enable-debug)
 			set(DisableReleaseOption --disable-release)
 		endif()

-		set(DisableSharedOption)
+		set(DisableSharedOption --disable-shared)
 		set(PrefixOption "${InstallDirectoryDefault}")
 		set(CppFlagsOption)
 		if(WIN32)
@@ -68,13 +67,15 @@
 			if(NOT ${Status} EQUAL 0)
 				message(FATAL_ERROR "The ICU4C install directory path could not be converted to Unix format: ${Status}")
 			endif()
+
+			# On Windows, the shared libraries must be built for Boost ICU detection to succeed.
+			set(DisableSharedOption)
 		else()
 			if(APPLE)
 				set(System MacOSX)
 			else()
 				set(System Linux)
 			endif()
-			set(DisableSharedOption --disable-shared)
 			set(CppFlagsOption CPPFLAGS=-DU_CHARSET_IS_UTF8=1)
 		endif()


From Jean-Sebastien Guay, added non pkg-config based ffmpeg search scheme.

--- CMakeModules/FindFFmpeg.cmake
+++ CMakeModules/FindFFmpeg.cmake
@@ -1,44 +1,108 @@
 # Locate ffmpeg
 # This module defines
 # FFMPEG_LIBRARIES
-# FFMPEG_FOUND, if false, do not try to link to ffmpeg
+# FFMPEG_FOUND, if false, do not try to link to ffmpeg
 # FFMPEG_INCLUDE_DIR, where to find the headers
 #
 # $FFMPEG_DIR is an environment variable that would
 # correspond to the ./configure --prefix=$FFMPEG_DIR
 #
-# Created by Robert Osfield.
+# Created by Robert Osfield.

-#use pkg-config to find various modes
-INCLUDE(FindPkgConfig OPTIONAL)
+# Macro to find header and lib directories
+# example: FFMPEG_FIND(AVFORMAT avformat avformat.h)
+MACRO(FFMPEG_FIND varname shortname headername)
+    # First try to find header directly in include directory
+    FIND_PATH(FFMPEG_${varname}_INCLUDE_DIRS ${headername}
+        ${FFMPEG_ROOT}/include
+        $ENV{FFMPEG_DIR}/include
+        $ENV{OSGDIR}/include
+        $ENV{OSG_ROOT}/include
+        ~/Library/Frameworks
+        /Library/Frameworks
+        /usr/local/include
+        /usr/include/
+        /sw/include # Fink
+        /opt/local/include # DarwinPorts
+        /opt/csw/include # Blastwave
+        /opt/include
+        /usr/freeware/include
+    )

-IF(PKG_CONFIG_FOUND)
+    # If not found, try to find it in a subdirectory. Tanguy's build has
+    # avformat.h in include/libavformat, so this catches that case. If that's
+    # standard, perhaps we can keep just this case.
+    IF(NOT FFMPEG_${varname}_INCLUDE_DIRS)
+        FIND_PATH(FFMPEG_${varname}_INCLUDE_DIRS lib${shortname}/${headername}
+            ${FFMPEG_ROOT}/include
+            $ENV{FFMPEG_DIR}/include
+            $ENV{OSGDIR}/include
+            $ENV{OSG_ROOT}/include
+            ~/Library/Frameworks
+            /Library/Frameworks
+            /usr/local/include
+            /usr/include/
+            /sw/include # Fink
+            /opt/local/include # DarwinPorts
+            /opt/csw/include # Blastwave
+            /opt/include
+            /usr/freeware/include
+        )
+    ENDIF(NOT FFMPEG_${varname}_INCLUDE_DIRS)

-    INCLUDE(FindPkgConfig)
+    FIND_LIBRARY(FFMPEG_${varname}_LIBRARIES
+        NAMES ${shortname}
+        PATHS
+        ${FFMPEG_ROOT}/lib
+        $ENV{FFMPEG_DIR}/lib
+        $ENV{OSGDIR}/lib
+        $ENV{OSG_ROOT}/lib
+        ~/Library/Frameworks
+        /Library/Frameworks
+        /usr/local/lib
+        /usr/local/lib64
+        /usr/lib
+        /usr/lib64
+        /sw/lib
+        /opt/local/lib
+        /opt/csw/lib
+        /opt/lib
+        /usr/freeware/lib64
+    )

-    pkg_check_modules(FFMPEG_LIBAVFORMAT libavformat)
-    pkg_check_modules(FFMPEG_LIBAVDEVICE libavdevice)
-    pkg_check_modules(FFMPEG_LIBAVCODEC libavcodec)
-    pkg_check_modules(FFMPEG_LIBAVUTIL libavutil)
-    pkg_check_modules(FFMPEG_LIBSWSCALE libswscale)
+    IF   (FFMPEG_${varname}_LIBRARIES)
+        SET(FFMPEG_${varname}_FOUND 1)
+    ENDIF(FFMPEG_${varname}_LIBRARIES)

-ENDIF(PKG_CONFIG_FOUND)
+ENDMACRO(FFMPEG_FIND)
+
+SET(FFMPEG_ROOT "$ENV{FFMPEG_DIR}" CACHE PATH "Location of FFMPEG")
+
+FFMPEG_FIND(LIBAVFORMAT avformat avformat.h)
+FFMPEG_FIND(LIBAVDEVICE avdevice avdevice.h)
+FFMPEG_FIND(LIBAVCODEC  avcodec  avcodec.h)
+FFMPEG_FIND(LIBAVUTIL   avutil   avutil.h)
+FFMPEG_FIND(LIBSWSCALE  swscale  swscale.h)  # not sure about the header to look for here.

 SET(FFMPEG_FOUND "NO")
+# Note we don't check FFMPEG_LIBSWSCALE_FOUND here, it's optional.
 IF   (FFMPEG_LIBAVFORMAT_FOUND AND FFMPEG_LIBAVDEVICE_FOUND AND FFMPEG_LIBAVCODEC_FOUND AND FFMPEG_LIBAVUTIL_FOUND)
-
+
     SET(FFMPEG_FOUND "YES")

     SET(FFMPEG_INCLUDE_DIRS ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS})

     SET(FFMPEG_LIBRARY_DIRS ${FFMPEG_LIBAVFORMAT_LIBRARY_DIRS})

+    # Note we don't add FFMPEG_LIBSWSCALE_LIBRARIES here, it will be added if found later.
     SET(FFMPEG_LIBRARIES
         ${FFMPEG_LIBAVFORMAT_LIBRARIES}
         ${FFMPEG_LIBAVDEVICE_LIBRARIES}
         ${FFMPEG_LIBAVCODEC_LIBRARIES}
         ${FFMPEG_LIBAVUTIL_LIBRARIES})
-
+
+ELSE (FFMPEG_LIBAVFORMAT_FOUND AND FFMPEG_LIBAVDEVICE_FOUND AND FFMPEG_LIBAVCODEC_FOUND AND FFMPEG_LIBAVUTIL_FOUND)
+
+    MESSAGE(STATUS "Could not find FFMPEG")
+
 ENDIF(FFMPEG_LIBAVFORMAT_FOUND AND FFMPEG_LIBAVDEVICE_FOUND AND FFMPEG_LIBAVCODEC_FOUND AND FFMPEG_LIBAVUTIL_FOUND)
-
-


fixed this stupid path detector ?

fixed this stupid path detector ?

--- FindTorch.cmake
+++ FindTorch.cmake
@@ -2,7 +2,7 @@
 # Find Torch (luaT+TH)

 if (TORCH_PREFIX)
-   find_program (TORCH_EXECUTABLE lua ${TORCH_PREFIX}/bin)
+   find_program (TORCH_EXECUTABLE lua ${TORCH_PREFIX}/bin NO_DEFAULT_PATH)
 endif (TORCH_PREFIX)

 if (NOT TORCH_EXECUTABLE)


Fix hwloc finder to find installations in prefix path first

--- Findhwloc.cmake
+++ Findhwloc.cmake
@@ -9,6 +9,13 @@

 if(HWLOC_ROOT)
   set(ENV{PKG_CONFIG_PATH} "${HWLOC_ROOT}/lib/pkgconfig")
+else()
+  foreach(PREFIX ${CMAKE_PREFIX_PATH})
+    set(PKG_CONFIG_PATH "${PKG_CONFIG_PATH}:${PREFIX}/lib/pkgconfig")
+  endforeach()
+  message(    "${PKG_CONFIG_PATH}:$ENV{PKG_CONFIG_PATH}")
+  set(ENV{PKG_CONFIG_PATH}
+    "${PKG_CONFIG_PATH}:$ENV{PKG_CONFIG_PATH}")
 endif()

 if(HWLOC_FIND_QUIETLY)


Squashed '3rdparty/github/cmake-utils/' changes from 620edd76..8e9d5627

8e9d5627 Add check of sys/stat.h
aba1b14d Add check of fcntl.h

git-subtree-dir: 3rdparty/github/cmake-utils
git-subtree-split: 8e9d5627f60b4286bbe1f9d70b7b7fa08b10398b

--- cmake/MyPackageCheckCommonIncludeFiles.cmake
+++ cmake/MyPackageCheckCommonIncludeFiles.cmake
@@ -7,9 +7,11 @@
   CHECK_INCLUDE_FILE ("stdint.h"     HAVE_STDINT_H)
   CHECK_INCLUDE_FILE ("sys/time.h"   HAVE_SYS_TIME_H)
   CHECK_INCLUDE_FILE ("sys/types.h"  HAVE_SYS_TYPES_H)
+  CHECK_INCLUDE_FILE ("sys/stat.h"   HAVE_SYS_STAT_H)
   CHECK_INCLUDE_FILE ("errno.h"      HAVE_ERRNO_H)
   CHECK_INCLUDE_FILE ("string.h"     HAVE_STRING_H)
   CHECK_INCLUDE_FILE ("unistd.h"     HAVE_UNISTD_H)
   CHECK_INCLUDE_FILE ("io.h"         HAVE_IO_H)
   CHECK_INCLUDE_FILE ("time.h"       HAVE_TIME_H)
+  CHECK_INCLUDE_FILE ("fcntl.h"      HAVE_FCNTL_H)
 ENDMACRO()


[CMake] Support cross-compiling with multi-stage builds

When using multi-stage builds, we would like support cross-compilation.
Example is 2-stage build when the first stage is compiled for host while
the second stage is compiled for the target.

Normally, the second stage would be also used for compiling runtimes,
but that's not possible when cross-compiling, so we use the first stage
compiler instead. However, we still want to use the second stage paths.
To do so, we set the -resource-dir of the first stage compiler to point
to the resource directory of the second stage.

We also need compiler tools that support the target architecture. These
tools are not guaranteed to be present on the host, but in case of
multi-stage build, we can build these tools in the first stage.

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

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

--- cmake/modules/LLVMExternalProjectUtils.cmake
+++ cmake/modules/LLVMExternalProjectUtils.cmake
@@ -162,8 +162,35 @@
                       -DCMAKE_OBJDUMP=${CMAKE_OBJDUMP}
                       -DCMAKE_STRIP=${CMAKE_STRIP})
     set(llvm_config_path ${LLVM_CONFIG_PATH})
+
+    if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+      string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
+             ${PACKAGE_VERSION})
+      set(resource_dir "${LLVM_LIBRARY_DIR}/clang/${CLANG_VERSION}")
+      set(flag_types ASM C CXX MODULE_LINKER SHARED_LINKER EXE_LINKER)
+      foreach(type ${flag_types})
+        set(${type}_flag -DCMAKE_${type}_FLAGS=-resource-dir=${resource_dir})
+      endforeach()
+      string(REPLACE ";" "|" flag_string "${flag_types}")
+      foreach(arg ${ARG_CMAKE_ARGS})
+        if(arg MATCHES "^-DCMAKE_(${flag_string})_FLAGS")
+          foreach(type ${flag_types})
+            if(arg MATCHES "^-DCMAKE_${type}_FLAGS")
+              string(REGEX REPLACE "^-DCMAKE_${type}_FLAGS=(.*)$" "\\1" flag_value "${arg}")
+              set(${type}_flag "${${type}_flag} ${flag_value}")
+            endif()
+          endforeach()
+        else()
+          list(APPEND cmake_args ${arg})
+        endif()
+      endforeach()
+      foreach(type ${flag_types})
+        list(APPEND cmake_args ${${type}_flag})
+      endforeach()
+    endif()
   else()
     set(llvm_config_path "$<TARGET_FILE:llvm-config>")
+    set(cmake_args ${ARG_CMAKE_ARGS})
   endif()

   ExternalProject_Add(${name}
@@ -187,7 +214,7 @@
                -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
                -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
                -DCMAKE_EXPORT_COMPILE_COMMANDS=1
-               ${ARG_CMAKE_ARGS}
+               ${cmake_args}
                ${PASSTHROUGH_VARIABLES}
     INSTALL_COMMAND ""
     STEP_TARGETS configure build


Create cache: Disable registry

Create cache: Disable registry

Duplicate set from `hunter_finalize` for non-Hunter packages

--- cmake/modules/hunter_create_cache_file.cmake
+++ cmake/modules/hunter_create_cache_file.cmake
@@ -196,6 +196,25 @@
       "set(CMAKE_POLICY_DEFAULT_CMP0069 NEW CACHE INTERNAL \"\")\n"
   )

+  # Disable package registry {
+  ### http://www.cmake.org/cmake/help/v3.1/manual/cmake-packages.7.html#disabling-the-package-registry
+  file(
+      APPEND
+      "${temp_path}"
+      "set(CMAKE_EXPORT_NO_PACKAGE_REGISTRY ON CACHE INTERNAL \"\")\n"
+  )
+  file(
+      APPEND
+      "${temp_path}"
+      "set(CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY ON CACHE INTERNAL \"\")\n"
+  )
+  file(
+      APPEND
+      "${temp_path}"
+      "set(CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY ON CACHE INTERNAL \"\")\n"
+  )
+  # }
+
   # Atomic operation
   file(RENAME "${temp_path}" "${cache_path}")
 endfunction()


FindMagnum.cmake: minor typographic fixes.

--- modules/FindMagnum.cmake
+++ modules/FindMagnum.cmake
@@ -76,7 +76,7 @@
 #   installation directory
 #  MAGNUM_PLUGINS_IMPORTER_INSTALL_DIR  - Importer plugin installation
 #   directory
-#  MAGNUM_PLUGINS_AUDIOIMPORTER_INSTALL_DIR  - Audio omporter plugin
+#  MAGNUM_PLUGINS_AUDIOIMPORTER_INSTALL_DIR - Audio omporter plugin
 #   installation directory
 #  MAGNUM_CMAKE_FIND_MODULE_INSTALL_DIR - Installation dir for CMake
 #   Find* modules


Fixed an issue with building LLVM on OS X.

Could that issue be a result of our build system having changed?...

--- src/plugins/3rdparty/LLVM/cmake/common.cmake
+++ src/plugins/3rdparty/LLVM/cmake/common.cmake
@@ -6,8 +6,6 @@
             _SCL_SECURE_NO_WARNINGS
             # Note: this is required to build LLVM in debug mode...
         )
-    ELSEIF(APPLE)
-        SET(LLVM_DEFINITIONS)
     ELSE()
         SET(LLVM_DEFINITIONS
             __STDC_FORMAT_MACROS


Generalize .github.com doc generation

Generalize .github.com doc generation

--- DoxygenRule.cmake
+++ DoxygenRule.cmake
@@ -19,10 +19,21 @@
   COMMENT "Generating API documentation using doxygen" VERBATIM)
 add_dependencies(doxygen doxygen_install)

+if(GIT_EXECUTABLE)
+  execute_process(COMMAND ${GIT_EXECUTABLE} config --get remote.origin.url
+    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE GIT_ORIGIN_URL)
+  string(REGEX REPLACE ".*github.com\\/(.*)\\/.*" "\\1" GIT_ORIGIN_ORG
+    ${GIT_ORIGIN_URL})
+  string(TOLOWER ${GIT_ORIGIN_ORG} GIT_ORIGIN_ORG)
+endif()
+if(NOT GIT_ORIGIN_ORG)
+  set(GIT_ORIGIN_ORG eyescale)
+endif()
+
 add_custom_target(github
-  COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_SOURCE_DIR}/../eyescale/${PROJECT_NAME}-${VERSION}
-  COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/doc/html ${CMAKE_SOURCE_DIR}/../eyescale/${PROJECT_NAME}-${VERSION}
-  COMMENT "Copying API documentation to eyescale.github.com/${PROJECT_NAME}-${VERSION}"
+  COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_SOURCE_DIR}/../${GIT_ORIGIN_ORG}/${PROJECT_NAME}-${VERSION}
+  COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/doc/html ${CMAKE_SOURCE_DIR}/../${GIT_ORIGIN_ORG}/${PROJECT_NAME}-${VERSION}
+  COMMENT "Copying API documentation to ${GIT_ORIGIN_ORG}.github.com/${PROJECT_NAME}-${VERSION}"
   VERBATIM)
 add_dependencies(github doxygen)


Allow usage of lists for DOXYGEN_EXTRA_INPUT

--- DoxygenRule.cmake
+++ DoxygenRule.cmake
@@ -84,6 +84,9 @@
 if(NOT COMMON_ORGANIZATION_NAME)
   set(COMMON_ORGANIZATION_NAME Unknown)
 endif()
+
+# list-to-string transform
+string(REPLACE ";" " " DOXYGEN_EXTRA_INPUT "${DOXYGEN_EXTRA_INPUT}")

 if(NOT DOXYGEN_CONFIG_FILE)
   # Assuming there exists a Doxyfile and that needs configuring


enh: FindTBB module that looks for individual components [BASIS]

--- CMake/Basis/FindTBB.cmake
+++ CMake/Basis/FindTBB.cmake
@@ -1,286 +1,534 @@
-# 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>
-#
-# Modified by Andreas Schuh for CMake BASIS to accept TBB_DIR as alternative
-# to TBB_INSTALL_DIR and removed verbose "Found Intel TBB" message.
-
-# The MIT License
-#
-# Copyright (c) 2011 Hannes Hofmann
-#
-# 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 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_DIR or 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})
-elseif (TBB_DIR)
-  set (_TBB_INSTALL_DIR ${TBB_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)
-    endif (TBB_LIBRARY)
-endif (TBB_INCLUDE_DIR)
-
-if (NOT TBB_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)
+#.rst:
+# FindTBB
+# -------
+#
+# Find Intel's Threading Building Blocks (TBB) include path and libraries.
+#
+# This module reads hints about search locations from variables:
+#
+# ::
+#
+#    TBB_ROOT                         - Root directory of pre-built TBB package.
+#                                       Can be an environment variable instead. It is
+#                                       derived from the found TBB_INCLUDE_DIR if unset.
+#    TBB_ARCH_PLATFORM                - Environment variable which can be used to specify
+#                                       architecture and platform specific library path
+#                                       suffix (excluding "/lib/" suffix or prefix).
+#                                       For MSVC, the appropriate link library path of the
+#                                       official pre-built download package from the TBB
+#                                       web site is chosen by this module. The path suffix
+#                                       derived from this variable takes precedence.
+#
+# This module considers the following CMake variables set by find_package:
+#
+# ::
+#
+#    TBB_FIND_COMPONENTS              - Case-insensitive names of requested libraries:
+#                                       tbb, [tbb]malloc, [tbb]malloc_proxy
+#    TBB_FIND_REQUIRED_<C>            - Whether TBB library component <C> is required.
+#                                       TBB is considered to be not found when at least
+#                                       one required library or its include path is missing.
+#                                       When no TBB_FIND_COMPONENTS are specified, only the
+#                                       threading library "tbb" is required.
+#    TBB_FIND_REQUIRED                - Raise FATAL_ERROR when required components not found.
+#    TBB_FIND_QUIETLY                 - Suppress all other (status) messages.
+#
+# The TBB_DEBUG variable can be set to TRUE before find_package(TBB) to
+# enable verbose output which helps to debug the processing of this module:
+#
+# ::
+#
+#    set(TBB_DEBUG TRUE)
+#    find_package(TBB)
+#
+# This module defines the following variables:
+#
+# ::
+#
+#    TBB_FOUND                        - Whether TBB libraries were found.
+#    TBB_INCLUDE_DIR                  - TBB library include path where tbb/tbb_stddef.h is located.
+#                                       Used as HINTS for find_path of TBB_<C>_INCLUDE_DIR.
+#    TBB_INCLUDE_DIRS                 - Include paths of found TBB libraries.
+#    TBB_LIBRARIES                    - File paths of found TBB libraries.
+#    TBB_VERSION                      - Version for use in VERSION_LESS et al. comparisons.
+#    TBB_VERSION_MAJOR                - Major library version number.
+#    TBB_VERSION_MINOR                - Minor library version number.
+#    TBB_VERSION_STRING               - Version string for output messages.
+#    TBB_INTERFACE_VERSION            - API version number.
+#    TBB_COMPATIBLE_INTERFACE_VERSION - The oldest major version still supported.
+#
+# Additionally, for each requested component, this module defines the following variables:
+#
+# ::
+#
+#    TBB_TBB_FOUND                    - Whether TBB threading library was found.
+#    TBB_TBB_INCLUDE_DIR              - Include path of TBB threading library.
+#    TBB_TBB_INCLUDE_DIRS             - Include paths for use of TBB library.
+#    TBB_TBB_LIBRARIES                - TBB threading library and transitive link dependencies.
+#    TBB_TBB_LIBRARY_RELEASE          - File path of optimized TBB link library.
+#    TBB_TBB_LIBRARY_DEBUG            - File path of TBB link library with debug symbols.
+#    TBB_TBB_LIBRARY                  - File paths of both "optimized" and "debug" TBB threading link libraries.
+#                                       When only one of these is found, this variable is set to either
+#                                       TBB_TBB_LIBRARY_RELEASE or TBB_TBB_LIBRARY_DEBUG.
+#
+#    TBB_MALLOC_FOUND                 - Whether TBB malloc library was found.
+#    TBB_MALLOC_INCLUDE_DIR           - Include path of TBB malloc library.
+#    TBB_MALLOC_INCLUDE_DIRS          - Include paths for use of TBB malloc library.
+#    TBB_MALLOC_LIBRARIES             - TBB malloc library and transitive link dependencies.
+#    TBB_MALLOC_LIBRARY_RELEASE       - File path of optimized TBB malloc link library.
+#    TBB_MALLOC_LIBRARY_DEBUG         - File path of TBB malloc link library with debug symbols.
+#    TBB_MALLOC_LIBRARY               - File paths of both "optimized" and "debug" TBB malloc link libraries.
+#                                       When only one of these is found, this variable is set to either
+#                                       TBB_MALLOC_LIBRARY_RELEASE or TBB_MALLOC_LIBRARY_DEBUG.
+#
+#    TBB_MALLOC_PROXY_FOUND           - Whether TBB malloc proxy library was found.
+#    TBB_MALLOC_PROXY_INCLUDE_DIR     - Include path of TBB malloc proxy library.
+#    TBB_MALLOC_PROXY_INCLUDE_DIRS    - Include paths for use of TBB malloc proxy library.
+#    TBB_MALLOC_PROXY_LIBRARIES       - TBB malloc proxy library and transitive link dependencies.
+#    TBB_MALLOC_PROXY_LIBRARY_RELEASE - File path of optimized TBB malloc proxy link library.
+#    TBB_MALLOC_PROXY_LIBRARY_DEBUG   - File path of TBB malloc proxy link library with debug symbols.
+#    TBB_MALLOC_PROXY_LIBRARY         - File paths of both "optimized" and "debug" TBB malloc proxy link libraries.
+#                                       When only one of these is found, this variable is set to either
+#                                       TBB_MALLOC_PROXY_LIBRARY_RELEASE or TBB_MALLOC_PROXY_LIBRARY_DEBUG.
+#
+# of these, the following variables are added as advanced cache entries:
+#
+# ::
+#
+#    TBB_INCLUDE_DIR
+#    TBB_<C>_INCLUDE_DIR
+#    TBB_<C>_LIBRARY_RELEASE
+#    TBB_<C>_LIBRARY_DEBUG
+#
+# This module further defines the following import targets with the IMPORTED and INTERFACE
+# properties set appropriately such that only a target_link_libraries command is required
+# to declare the dependency of another target on the respective TBB library component.
+# The use of these import targets instead of above defined variables is recommended.
+#
+# ::
+#
+#    TBB::tbb          - TBB threading library.
+#    TBB::malloc       - TBB malloc library.
+#    TBB::malloc_proxy - TBB malloc proxy library.
+#
+# Example usage:
+#
+# ::
+#
+#    find_package(TBB REQUIRED COMPONENTS tbb OPTIONAL_COMPONENTS malloc)
+#
+#    add_executable(foo foo.cc)
+#    target_link_libraries(foo TBB::tbb)
+#    if (TARGET TBB::malloc)
+#    # or if (TBB_MALLOC_FOUND)
+#      target_link_libraries(foo TBB::malloc)
+#    endif ()
+#
+# This module was written by Andreas Schuh for CMake BASIS with inspiration
+# from the FindTBB module which was originally part of the Object-oriented
+# Graphics Rendering Engine (OGRE) project with modifications by Robert Maynard.
+
+#=============================================================================
+# Copyright 2016 Andreas Schuh <andreas.schuh.84@gmail.com>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+#  License text for the above reference.)
+
+if (NOT TBB_FIND_QUIETLY)
+  set(_TBB_FIND_STATUS "Looking for TBB")
+  if (TBB_FIND_COMPONENTS)
+    set(_TBB_FIND_STATUS "${_TBB_FIND_STATUS} [${TBB_FIND_COMPONENTS}]")
+  endif ()
+  if (NOT TBB_FIND_REQUIRED)
+    set(_TBB_FIND_STATUS "${_TBB_FIND_STATUS} (optional)")
+  endif ()
+  message(STATUS "${_TBB_FIND_STATUS}...")
+endif ()
+
+# ------------------------------------------------------------------------------
+# Default required/optional components
+if (NOT TBB_FIND_COMPONENTS)
+  set(TBB_FIND_COMPONENTS tbb malloc malloc_proxy)
+  set(TBB_FIND_REQUIRED_tbb          TRUE)
+  set(TBB_FIND_REQUIRED_malloc       FALSE)
+  set(TBB_FIND_REQUIRED_malloc_proxy FALSE)
+endif ()
+
+# ------------------------------------------------------------------------------
+# Normalize component names
+set(_TBB_FIND_COMPONENTS)
+foreach (__TBB_COMPONENT IN LISTS TBB_FIND_COMPONENTS)
+  string(TOUPPER "${__TBB_COMPONENT}" _TBB_COMPONENT)
+  string(REGEX REPLACE "^TBB_?([A-Z_]+)$" "\\1" _TBB_COMPONENT "${_TBB_COMPONENT}")
+  if (_TBB_COMPONENT MATCHES "^(TBB|MALLOC|MALLOC_PROXY)$")
+    set(_TBB_${_TBB_COMPONENT}_NAME ${__TBB_COMPONENT})
+    list(APPEND _TBB_FIND_COMPONENTS ${_TBB_COMPONENT})
+    if (TBB_FIND_REQUIRED_${__TBB_COMPONENT})
+      set(_TBB_FIND_REQUIRED_${_TBB_COMPONENT} TRUE)
+    else ()
+      set(_TBB_FIND_REQUIRED_${_TBB_COMPONENT} FALSE)
+    endif ()
+  else ()
+    message(FATAL_ERROR "Unknown TBB library component: ${__TBB_COMPONENT}\n"
+                        "Valid component names are: tbb, [tbb]malloc, [tbb]malloc_proxy")
+  endif ()
+endforeach ()
+unset(__TBB_COMPONENT)
+
+if (TBB_DEBUG)
+  message("** FindTBB: Components = [${_TBB_FIND_COMPONENTS}]")
+endif ()
+
+# ------------------------------------------------------------------------------
+# Names of headers and libraries for each component
+set(_TBB_TBB_LIB_NAMES_RELEASE          tbb)
+set(_TBB_TBB_LIB_NAMES_DEBUG            tbb_debug)
+set(_TBB_TBB_INC_NAMES                  tbb/tbb.h)
+
+set(_TBB_MALLOC_LIB_NAMES_RELEASE       tbbmalloc)
+set(_TBB_MALLOC_LIB_NAMES_DEBUG         tbbmalloc_debug)
+set(_TBB_MALLOC_INC_NAMES               tbb/tbb.h)
+
+set(_TBB_MALLOC_PROXY_LIB_NAMES_RELEASE tbbmalloc_proxy)
+set(_TBB_MALLOC_PROXY_LIB_NAMES_DEBUG   tbbmalloc_proxy_debug)
+set(_TBB_MALLOC_PROXY_INC_NAMES         tbb/tbbmalloc_proxy.h)
+
+# ------------------------------------------------------------------------------
+# Transitive link dependencies
+set(_TBB_TBB_LIB_LINK_DEPENDS)
+set(_TBB_MALLOC_LIB_LINK_DEPENDS)
+set(_TBB_MALLOC_PROXY_LIB_LINK_DEPENDS)
+
+if (UNIX AND NOT APPLE)
+  # On Linux, the TBB threading library requires librt.so
+  list(APPEND _TBB_TBB_LIB_LINK_DEPENDS rt)
+endif ()
+
+# ------------------------------------------------------------------------------
+# Construct a set of search paths
+set(_TBB_ARCH_PLATFORM $ENV{TBB_ARCH_PLATFORM})
+
+if (NOT TBB_ROOT)
+  file(TO_CMAKE_PATH "$ENV{TBB_ROOT}" TBB_ROOT)
+endif ()
+
+set(_TBB_INC_PATH_SUFFIXES include)
+
+set(_TBB_LIB_PATH_SUFFIXES)
+if (_TBB_ARCH_PLATFORM)
+  list(APPEND _TBB_LIB_PATH_SUFFIXES lib/${_TBB_ARCH_PLATFORM})
+  list(APPEND _TBB_LIB_PATH_SUFFIXES ${_TBB_ARCH_PLATFORM}/lib)
+endif ()
+list(APPEND _TBB_LIB_PATH_SUFFIXES lib)
+
+if (WIN32 AND MSVC AND CMAKE_GENERATOR MATCHES "Visual Studio ([0-9]+)")
+  set(_TBB_MSVS_VERSION ${CMAKE_MATCH_1})
+  if (CMAKE_CL_64)
+    list(APPEND _TBB_LIB_PATH_SUFFIXES lib/intel64/vc${_TBB_MSVS_VERSION})
+    list(APPEND _TBB_LIB_PATH_SUFFIXES intel64/vc${_TBB_MSVS_VERSION}/lib)
+    list(APPEND _TBB_LIB_PATH_SUFFIXES lib/ia64/vc${_TBB_MSVS_VERSION})
+    list(APPEND _TBB_LIB_PATH_SUFFIXES ia64/vc${_TBB_MSVS_VERSION}/lib)
+  else ()
+    list(APPEND _TBB_LIB_PATH_SUFFIXES lib/ia32/vc${_TBB_MSVS_VERSION})
+    list(APPEND _TBB_LIB_PATH_SUFFIXES ia32/vc${_TBB_MSVS_VERSION}/lib)
+  endif ()
+  unset(_TBB_MSVS_VERSION)
+endif ()
+
+if (TBB_DEBUG)
+  message("** FindTBB: Initial search paths:")
+  message("** FindTBB: - Root directory hints  = [${TBB_ROOT}]")
+  message("** FindTBB: - Include path suffixes = [${_TBB_INC_PATH_SUFFIXES}]")
+  message("** FindTBB: - Library path suffixes = [${_TBB_LIB_PATH_SUFFIXES}]")
+endif ()
+
+# ------------------------------------------------------------------------------
+# Find common include directory
+#
+# Looking for tbb/tbb_stddef.h because we use this path later to read this file
+# in order to extract the version information. The tbb.h header should be in the
+# same directory and is searched for separately as part of the "tbb" and "malloc"
+# component search. The TBB_INCLUDE_DIR is then used as HINTS.
+find_path(TBB_INCLUDE_DIR
+  NAMES tbb/tbb_stddef.h
+  HINTS ${TBB_ROOT}
+  PATH_SUFFIXES ${_TBB_INC_PATH_SUFFIXES}
+)
+
+mark_as_advanced(TBB_INCLUDE_DIR)
+
+# ------------------------------------------------------------------------------
+# Derive TBB_ROOT from TBB_INCLUDE_DIR if unset
+if (TBB_INCLUDE_DIR AND NOT TBB_ROOT)
+  if (_TBB_INC_PATH_SUFFIXES MATCHES "[^/;]/[^/;]")
+    string(LENGTH "${TBB_INCLUDE_DIR}" _TBB_INCLUDE_DIR_LENGTH)
+    foreach (_TBB_INC_PATH_SUFFIX IN LISTS _TBB_INC_PATH_SUFFIXES)
+      string(LENGTH "${_TBB_INC_PATH_SUFFIX}" _TBB_INC_PATH_SUFFIX_LENGTH)
+      if (_TBB_INC_PATH_SUFFIX_LENGTH GREATER 0)
+        math(EXPR _TBB_SUBSTRING_START "${_TBB_INCLUDE_DIR_LENGTH} - ${_TBB_INC_PATH_SUFFIX_LENGTH}")
+        string(SUBSTRING "${TBB_INCLUDE_DIR}" _TBB_SUBSTRING_START -1 _TBB_SUBSTRING)
+        if (_TBB_SUBSTRING STREQUAL _TBB_INC_PATH_SUFFIX)
+          if (_TBB_SUBSTRING_START GREATER 0)
+            string(SUBSTRING "${TBB_INCLUDE_DIR}" 0 _TBB_SUBSTRING_START TBB_ROOT)
+            string(REGEX REPLACE "/+$" "" TBB_ROOT "${TBB_ROOT}")
+          else ()
+            set(TBB_ROOT "/")
+          endif ()
+          break()
+        endif ()
+      endif ()
+    endforeach ()
+    unset(_TBB_SUBSTRING)
+    unset(_TBB_SUBSTRING_START)
+    unset(_TBB_INCLUDE_DIR_LENGTH)
+    unset(_TBB_INC_PATH_SUFFIX_LENGTH)
+  else ()
+    get_filename_component(TBB_ROOT "${TBB_INCLUDE_DIR}" DIRECTORY)
+  endif ()
+endif ()
+
+if (TBB_DEBUG)
+  message("** FindTBB: After initial search of TBB include path")
+  message("** FindTBB: - TBB_INCLUDE_DIR = ${TBB_INCLUDE_DIR}")
+  message("** FindTBB: - TBB_ROOT        = [${TBB_ROOT}]")
+endif ()
+
+# ------------------------------------------------------------------------------
+# Find library components
+set(TBB_INCLUDE_DIRS)
+set(TBB_LIBRARIES)
+
+foreach (_TBB_COMPONENT IN LISTS _TBB_FIND_COMPONENTS)
+  if (TBB_DEBUG)
+    message("** FindTBB: Looking for component ${_TBB_COMPONENT}...")
+  endif ()
+
+  # Find include path and library files of this component
+  find_path(TBB_${_TBB_COMPONENT}_INCLUDE_DIR
+    NAMES ${_TBB_${_TBB_COMPONENT}_INC_NAMES}
+    HINTS ${TBB_INCLUDE_DIR} ${TBB_ROOT}
+    PATH_SUFFIXES ${_TBB_INC_PATH_SUFFIXES}
+  )
+
+  find_library(TBB_${_TBB_COMPONENT}_LIBRARY_RELEASE
+    NAMES ${_TBB_${_TBB_COMPONENT}_LIB_NAMES_RELEASE}
+    HINTS ${TBB_ROOT}
+    PATH_SUFFIXES ${_TBB_LIB_PATH_SUFFIXES}
+  )
+
+  find_library(TBB_${_TBB_COMPONENT}_LIBRARY_DEBUG
+    NAMES ${_TBB_${_TBB_COMPONENT}_LIB_NAMES_DEBUG}
+    HINTS ${TBB_ROOT}
+    PATH_SUFFIXES ${_TBB_LIB_PATH_SUFFIXES}
+  )
+
+  if (TBB_DEBUG)
+    message("** FindTBB: - TBB_${_TBB_COMPONENT}_INCLUDE_DIR     = ${TBB_${_TBB_COMPONENT}_INCLUDE_DIR}")
+    message("** FindTBB: - TBB_${_TBB_COMPONENT}_LIBRARY_RELEASE = ${TBB_${_TBB_COMPONENT}_LIBRARY_RELEASE}")
+    message("** FindTBB: - TBB_${_TBB_COMPONENT}_LIBRARY_DEBUG   = ${TBB_${_TBB_COMPONENT}_LIBRARY_DEBUG}")
+  endif ()
+
+  # Mark cache entries as advanced
+  mark_as_advanced(TBB_${_TBB_COMPONENT}_INCLUDE_DIR)
+  mark_as_advanced(TBB_${_TBB_COMPONENT}_LIBRARY_RELEASE)
+  mark_as_advanced(TBB_${_TBB_COMPONENT}_LIBRARY_DEBUG)
+
+  # Set TBB_<C>_LIBRARY
+  if (TBB_${_TBB_COMPONENT}_LIBRARY_RELEASE AND TBB_${_TBB_COMPONENT}_LIBRARY_DEBUG)
+    set(TBB_${_TBB_COMPONENT}_LIBRARY
+      optimized ${TBB_${_TBB_COMPONENT}_LIBRARY_RELEASE}
+      debug     ${TBB_${_TBB_COMPONENT}_LIBRARY_DEBUG}
+    )
+  elseif (TBB_${_TBB_COMPONENT}_LIBRARY_RELEASE)
+    set(TBB_${_TBB_COMPONENT}_LIBRARY ${TBB_${_TBB_COMPONENT}_LIBRARY_RELEASE})
+  elseif (TBB_${_TBB_COMPONENT}_LIBRARY_DEBUG)
+    set(TBB_${_TBB_COMPONENT}_LIBRARY ${TBB_${_TBB_COMPONENT}_LIBRARY_DEBUG})
+  else ()
+    set(TBB_${_TBB_COMPONENT}_LIBRARY TBB_${_TBB_COMPONENT}_LIBRARY-NOTFOUND)
+  endif ()
+
+  # Set TBB_<C>_FOUND
+  if (TBB_${_TBB_COMPONENT}_INCLUDE_DIR AND TBB_${_TBB_COMPONENT}_LIBRARY)
+    set(TBB_${_TBB_COMPONENT}_FOUND TRUE)
+  else ()
+    set(TBB_${_TBB_COMPONENT}_FOUND FALSE)
+  endif ()
+  set(TBB_${_TBB_${_TBB_COMPONENT}_NAME}_FOUND ${TBB_${_TBB_COMPONENT}_FOUND})
+
+  if (TBB_${_TBB_COMPONENT}_FOUND)
+
+    # Add transitive dependencies
+    set(TBB_${_TBB_COMPONENT}_INCLUDE_DIRS ${TBB_${_TBB_COMPONENT}_INCLUDE_DIR})
+    set(TBB_${_TBB_COMPONENT}_LIBRARIES    ${TBB_${_TBB_COMPONENT}_LIBRARY})
+    if (_TBB_${_TBB_COMPONENT}_LIB_LINK_DEPENDS)
+      list(APPEND TBB_${_TBB_COMPONENT}_LIBRARIES "${_TBB_${_TBB_COMPONENT}_LIB_LINK_DEPENDS}")
+    endif ()
+
+    if (TBB_DEBUG)
+      message("** FindTBB: - TBB_${_TBB_COMPONENT}_INCLUDE_DIRS    = [${TBB_${_TBB_COMPONENT}_INCLUDE_DIRS}]")
+      message("** FindTBB: - TBB_${_TBB_COMPONENT}_LIBRARIES       = [${TBB_${_TBB_COMPONENT}_LIBRARIES}]")
+    endif ()
+
+    # Add to TBB_INCLUDE_DIRS and TBB_LIBRARIES
+    list(APPEND TBB_INCLUDE_DIRS ${TBB_${_TBB_COMPONENT}_INCLUDE_DIRS})
+    list(APPEND TBB_LIBRARIES    ${TBB_${_TBB_COMPONENT}_LIBRARIES})
+
+    # Add TBB::<C> import target
+    string(TOLOWER ${_TBB_COMPONENT} _TBB_TARGET_NAME)
+    set(_TBB_TARGET_NAME "TBB::${_TBB_TARGET_NAME}")
+    add_library(${_TBB_TARGET_NAME} SHARED IMPORTED)
+
+    set_target_properties(${_TBB_TARGET_NAME} PROPERTIES
+      INTERFACE_INCLUDE_DIRECTORIES     "${TBB_${_TBB_COMPONENT}_INCLUDE_DIRS}"
+      IMPORTED_LINK_INTERFACE_LANGUAGES CXX
+      IMPORTED_NO_SONAME                TRUE
+    )
+    if (_TBB_${_TBB_COMPONENT}_LIB_LINK_DEPENDS)
+      set_target_properties(${_TBB_TARGET_NAME} PROPERTIES
+        INTERFACE_LINK_LIBRARIES "${_TBB_${_TBB_COMPONENT}_LIB_LINK_DEPENDS}"
+      )
+    endif ()
+
+    foreach (_TBB_CONFIGURATION IN ITEMS DEBUG RELEASE)
+      if (TBB_${_TBB_COMPONENT}_LIBRARY_${_TBB_CONFIGURATION})
+        set_property(TARGET ${_TBB_TARGET_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${_TBB_CONFIGURATION})
+        if (WIN32)
+          set_target_properties(${_TBB_TARGET_NAME} PROPERTIES
+            IMPORTED_IMPLIB_${_TBB_CONFIGURATION} "${TBB_${_TBB_COMPONENT}_LIBRARY_${_TBB_CONFIGURATION}}"
+          )
+          string(REPLACE       "/lib/"   "/bin/" _TBB_LIB_PATH_DLL "${TBB_${_TBB_COMPONENT}_LIBRARY_${_TBB_CONFIGURATION}}")
+          string(REGEX REPLACE "\\.lib$" ".dll"  _TBB_LIB_PATH_DLL "${_TBB_LIB_PATH_DLL}")
+          if (EXISTS "${_TBB_LIB_PATH_DLL}")
+            set_target_properties(${_TBB_TARGET_NAME} PROPERTIES
+              IMPORTED_LOCATION_${_TBB_CONFIGURATION} "${_TBB_LIB_PATH_DLL}"
+            )
+            if (TBB_DEBUG)
+              message("** FindTBB: - IMPORTED_LOCATION_${_TBB_CONFIGURATION} = ${_TBB_LIB_PATH_DLL}")
+            endif ()
+          elseif (TBB_DEBUG)
+            message("** FindTBB: Could not determine ${_TBB_CONFIGURATION} DLL path from import library, tried: "
+                    "\n\t${_TBB_LIB_PATH_DLL}")
+          endif ()
+        else ()
+          set_target_properties(${_TBB_TARGET_NAME} PROPERTIES
+            IMPORTED_LOCATION_${_TBB_CONFIGURATION} "${TBB_${_TBB_COMPONENT}_LIBRARY_${_TBB_CONFIGURATION}}"
+          )
+        endif ()
+      endif ()
+    endforeach ()
+
+    if (TBB_DEBUG)
+      message("** FindTBB: Looking for component ${_TBB_COMPONENT}... - found")
+    endif ()
+
+  else ()
+
+    if (TBB_DEBUG)
+      message("** FindTBB: Looking for component ${_TBB_COMPONENT}... - not found")
+    endif ()
+    unset(TBB_${_TBB_COMPONENT}_INCLUDE_DIRS)
+    unset(TBB_${_TBB_COMPONENT}_LIBRARIES)
+
+  endif ()
+endforeach ()
+
+if (TBB_INCLUDE_DIRS)
+  list(REMOVE_DUPLICATES TBB_INCLUDE_DIRS)
+endif ()
+
+if (TBB_DEBUG)
+  message("** FindTBB: Include paths and libraries of all found components:")
+  message("** FindTBB: - TBB_INCLUDE_DIRS = [${TBB_INCLUDE_DIRS}]")
+  message("** FindTBB: - TBB_LIBRARIES    = [${TBB_LIBRARIES}]")
+endif ()
+
+# ------------------------------------------------------------------------------
+# Extract library version from start of tbb_stddef.h
+if (TBB_INCLUDE_DIR)
+  if (NOT DEFINED TBB_VERSION_MAJOR OR
+      NOT DEFINED TBB_VERSION_MINOR OR
+      NOT DEFINED TBB_INTERFACE_VERSION OR
+      NOT DEFINED TBB_COMPATIBLE_INTERFACE_VERSION)
+    file(READ "${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h" _TBB_VERSION_CONTENTS LIMIT 2048)
+    string(REGEX REPLACE
+      ".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1"
+      TBB_VERSION_MAJOR "${_TBB_VERSION_CONTENTS}"
+    )
+    string(REGEX REPLACE
+      ".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1"
+      TBB_VERSION_MINOR "${_TBB_VERSION_CONTENTS}"
+    )
+    string(REGEX REPLACE
+      ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1"
+      TBB_INTERFACE_VERSION "${_TBB_VERSION_CONTENTS}"
+    )
+    string(REGEX REPLACE
+      ".*#define TBB_COMPATIBLE_INTERFACE_VERSION ([0-9]+).*" "\\1"
+      TBB_COMPATIBLE_INTERFACE_VERSION "${_TBB_VERSION_CONTENTS}"
+    )
+    unset(_TBB_VERSION_CONTENTS)
+  endif ()
+  set(TBB_VERSION "${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR}")
+  set(TBB_VERSION_STRING "${TBB_VERSION}")
+else ()
+  unset(TBB_VERSION)
+  unset(TBB_VERSION_MAJOR)
+  unset(TBB_VERSION_MINOR)
+  unset(TBB_VERSION_STRING)
+  unset(TBB_INTERFACE_VERSION)
+  unset(TBB_COMPATIBLE_INTERFACE_VERSION)
+endif ()
+
+if (TBB_DEBUG)
+  message("** FindTBB: Version information from ${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h")
+  message("** FindTBB: - TBB_VERSION_STRING               = ${TBB_VERSION_STRING}")
+  message("** FindTBB: - TBB_VERSION_MAJOR                = ${TBB_VERSION_MAJOR}")
+  message("** FindTBB: - TBB_VERSION_MINOR                = ${TBB_VERSION_MINOR}")
+  message("** FindTBB: - TBB_INTERFACE_VERSION            = ${TBB_INTERFACE_VERSION}")
+  message("** FindTBB: - TBB_COMPATIBLE_INTERFACE_VERSION = ${TBB_COMPATIBLE_INTERFACE_VERSION}")
+endif ()
+
+# ------------------------------------------------------------------------------
+# Handle QUIET, REQUIRED, and [EXACT] VERSION arguments and set TBB_FOUND
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(TBB
+  REQUIRED_VARS TBB_INCLUDE_DIR
+  VERSION_VAR   TBB_VERSION
+  HANDLE_COMPONENTS
+)
+
+if (NOT TBB_FIND_QUIETLY)
+  if (TBB_FOUND)
+    message(STATUS "${_TBB_FIND_STATUS}... - found v${TBB_VERSION_STRING}")
+  else ()
+    message(STATUS "${_TBB_FIND_STATUS}... - not found")
+  endif ()
+endif ()
+
+# ------------------------------------------------------------------------------
+# Unset local auxiliary variables
+foreach (_TBB_COMPONENT IN ITEMS TBB MALLOC MALLOC_PROXY)
+  unset(_TBB_FIND_REQUIRED_${_TBB_COMPONENT})
+  unset(_TBB_${_TBB_COMPONENT}_LIB_NAMES_RELEASE)
+  unset(_TBB_${_TBB_COMPONENT}_LIB_NAMES_DEBUG)
+  unset(_TBB_${_TBB_COMPONENT}_LIB_LINK_DEPENDS)
+  unset(_TBB_${_TBB_COMPONENT}_INC_NAMES)
+  unset(_TBB_${_TBB_COMPONENT}_NAME)
+endforeach ()
+
+unset(_TBB_COMPONENT)
+unset(_TBB_TARGET_NAME)
+unset(_TBB_FIND_COMPONENTS)
+unset(_TBB_FIND_STATUS)
+unset(_TBB_INC_PATH_SUFFIXES)
+unset(_TBB_LIB_PATH_SUFFIXES)
+unset(_TBB_LIB_PATH_DLL)
+unset(_TBB_LIB_NAME)
+unset(_TBB_ARCH_PLATFORM)


COMP: add muparserx into PATH_SUFFIXES to find muparserx 4.x headers

--- CMake/FindMuParserX.cmake
+++ CMake/FindMuParserX.cmake
@@ -16,7 +16,7 @@
 endif()

 find_path( MUPARSERX_INCLUDE_DIR mpParser.h
-           PATH_SUFFIXES mpParser )
+           PATH_SUFFIXES mpParser muparserx)

 if(EXISTS "${MUPARSERX_INCLUDE_DIR}/mpDefines.h")
   file(READ "${MUPARSERX_INCLUDE_DIR}/mpDefines.h" _mpDefines_h_CONTENTS)


Updated cmake build options to accept CUDA_ARCH up to 21

git-svn-id: ca98999b6be072864c20d76aa7fea8859d0e03a1@3280 fa922fa7-2fde-0310-acd8-f43f465a7996

--- CMake_build_options.cmake
+++ CMake_build_options.cmake
@@ -76,13 +76,13 @@
     set(CUDA_ARCH 11 CACHE STRING "Target architecture to compile CUDA code for. Valid options are 10, 11, 12, or 13 (currently). They correspond to compute 1.0, 1.1, 1.2, and 1.3 GPU hardware")
     # the arch is going to be passed on a command line: verify it so the user doesn't make any blunders
     set(_cuda_arch_ok FALSE)
-    foreach(_valid_cuda_arch 10 11 12 13)
+    foreach(_valid_cuda_arch 10 11 12 13 20 21)
         if (CUDA_ARCH EQUAL ${_valid_cuda_arch})
             set(_cuda_arch_ok TRUE)
         endif (CUDA_ARCH EQUAL ${_valid_cuda_arch})
             endforeach(_valid_cuda_arch)
         if (NOT _cuda_arch_ok)
-            message(FATAL_ERROR "Wrong CUDA_ARCH specified. Must be one of 10, 11, 12, or 13")
+            message(FATAL_ERROR "Wrong CUDA_ARCH specified. Must be one of 10, 11, 12, 13, 20, or 21")
     endif (NOT _cuda_arch_ok)

     add_definitions(-DCUDA_ARCH=${CUDA_ARCH})


CMake: bug fix in HDF5 detection. Making CONFIG mode and MODULE mode consistent: both give out variables HDF5_LIBRARIES and HDF5_INCLUDE_DIRS

--- salome_adm/cmake_files/FindSalomeHDF5.cmake
+++ salome_adm/cmake_files/FindSalomeHDF5.cmake
@@ -29,6 +29,13 @@

 SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(HDF5 HDF5_INCLUDE_DIR 1)
 MARK_AS_ADVANCED(FORCE HDF5_INCLUDE_DIR HDF5_LIB)
+
+# Stupidly enough, CONFIG mode and MODULE mode for HDF5 do not return the same thing ...!
+SET(HDF5_INCLUDE_DIRS "${HDF5_INCLUDE_DIRS};${HDF5_INCLUDE_DIR}")
+# Same story with libraries - if in CONFIG mode, HDF5_LIBRARIES is not defined:
+IF(NOT DEFINED HDF5_LIBRARIES)
+  SET(HDF5_LIBRARIES hdf5)
+ENDIF()

 ##
 ## 7. Specific to HDF5 only:


install flag renamed from -i to -n (conflict with cmake -i)

--- src/cake.cmake
+++ src/cake.cmake
@@ -81,7 +81,7 @@
 #         build specific target (implies -b)
 #         note: you can specify multiple targets:
 #         -t tgt1 -t tgt2
-#     -i, --install
+#     -n, --install
 #         shortcut for --target=install
 #     --clean-first
 #     --use-stderr
@@ -173,7 +173,7 @@
 			set(last_switch "${a}")
 		elseif(a MATCHES "^(-C|-D|-U|-G|-T|-m|-c|--config=|-t|--target=)(.*)$")
 			list(APPEND cake_options "${a}")
-		elseif(a MATCHES "^(-W(no-)?dev|-N|--rm-bin|-R|--debug-release|-i|--install|--clean-first|--use-stderr)$")
+		elseif(a MATCHES "^(-W(no-)?dev|-N|--rm-bin|-R|--debug-release|-n|--install|--clean-first|--use-stderr)$")
 			list(APPEND cake_options "${a}")
 		elseif(a MATCHES "^--ide$")
 			set(opt_ide 1)
@@ -412,7 +412,7 @@
 			handle_opt_config(Release)
 		elseif(a MATCHES "^(-t|--target=)(.+)^")
 			handle_opt_target("${CMAKE_MATCH_2}")
-		elseif(a MATCHES "^-i|--install$")
+		elseif(a MATCHES "^-n|--install$")
 			handle_opt_target(install)
 		elseif(a MATCHES "^(--clean-first|--use-stderr)$")
 			list(APPEND opt_build "${a}")


Update along ITK superbuild build version along 5.1 development

--- SuperBuild/External_ITK.cmake
+++ SuperBuild/External_ITK.cmake
@@ -52,7 +52,7 @@
 mark_as_advanced(ITK_GIT_REPOSITORY)
 sitk_legacy_naming(ITK_GIT_REPOSITORY ITK_REPOSITORY)

-set(_DEFAULT_ITK_GIT_TAG "v5.1b01")
+set(_DEFAULT_ITK_GIT_TAG "9c5a74d213130f9e1f7bedb9ea34b4a5ae1f642e")
 set(ITK_GIT_TAG "${_DEFAULT_ITK_GIT_TAG}" CACHE STRING "Tag in ITK git repo")
 mark_as_advanced(ITK_GIT_TAG)
 set(ITK_TAG_COMMAND GIT_TAG "${ITK_GIT_TAG}")


Allow compilation with unified include directory

This makes it possible to compile OpenCV with for instance ndk-r16


MANAGE_DEPENENCY should be function, as macro does not play nice when called from different source dir

--- Modules/ManageDependency.cmake
+++ Modules/ManageDependency.cmake
@@ -6,127 +6,145 @@
 #   ManageFile
 #   ManageVersion
 #
-# Defines following macro:
+# Defines following functions:
 #   MANAGE_DEPENDENCY(listVar var [VER ver [EXACT]] [REQUIRED]
 #     [PROGRAM_NAMES name1 ...] [PKG_CONFIG pkgConfigName]
 #     [FEDORA_NAME fedoraPkgName] [DEVEL]
 #     )
 #     - Add a new dependency.
-#       Arguments:
-#       + listVar: List variable that hold all dependency of the same kind.
-#       + var: Main variable. It recommend to use uppercase name,
-#              such as GETTEXT
-#       + VER ver [EXACT]: Minimum version.
-#         Specify the exact version by providing "EXACT".
-#       + REQUIRED: Specify that this dependency is required.
-#       + PROGRAM_NAMES name1 ...: Executable to be found.
-#         If found, ${var}_EXECUTABLE is defined as the full path
-#         to the executable; if not found; the whole dependency is
-#         deemed as not found.
-#       + PKG_CONFIG pkgConfigName: Name of the pkg-config file
-#         exclude the directory and .pc. e.g. "gtk+-2.0"
-#       + FEDORA_NAME fedoraPkgName: Package name in Fedora.
-#         If not specified, use the lower case of ${var}.
-#         Note that '-devel' should be omitted here.
-#       + DEVEL: devel package is used. It will append '-devel'
-#         to fedoraPkgName
+#       * Parameters:
+#         + listVar: List variable store a kind of dependencies.
+#           Recognized lists:
+#           - BUILD_REQUIRES: Dependencies in build stage
+#           - REQUIRES:       Dependencies for runtime
+#           - REQUIRES_PRE:   Dependencies before the package install
+#           - REQUIRES_PREUN: Dependencies before the package uninstall
+#           - REQUIRES_POST:  Dependencies after the package install
+#           - REQUIRES_POSTUN:Dependencies after the package uninstall
+#         + var: Main variable. It recommend to use uppercase name,
+#           such as GETTEXT
+#         + VER ver [EXACT]: Minimum version.
+#           Specify the exact version by providing "EXACT".
+#         + REQUIRED: Specify that this dependency is required.
+#         + PROGRAM_NAMES name1 ...: Executable to be found.
+#           If found, ${var}_EXECUTABLE is defined as the full path
+#           to the executable; if not found; the whole dependency is
+#           deemed as not found.
+#         + PKG_CONFIG pkgConfigName: Name of the pkg-config file
+#           exclude the directory and .pc. e.g. "gtk+-2.0"
+#         + FEDORA_NAME fedoraPkgName: Package name in Fedora.
+#           If not specified, use the lower case of ${var}.
+#           Note that '-devel' should be omitted here.
+#         + DEVEL: devel package is used. It will append '-devel'
+#           to fedoraPkgName
 #
-IF(NOT DEFINED _MANAGE_DEPENDENCY_CMAKE_)
-    SET (_MANAGE_DEPENDENCY_CMAKE_ "DEFINED")
-    INCLUDE(ManageFile)
-    INCLUDE(ManageVariable)
+IF(DEFINED _MANAGE_DEPENDENCY_CMAKE_)
+    RETURN()
+ENDIF(DEFINED _MANAGE_DEPENDENCY_CMAKE_)
+SET (_MANAGE_DEPENDENCY_CMAKE_ "DEFINED")
+INCLUDE(ManageFile)
+INCLUDE(ManageVariable)

-    MACRO(MANAGE_DEPENDENCY listVar var)
-	SET(_validOptions "VER" "EXACT" "REQUIRED"
-	    "PROGRAM_NAMES" "PKG_CONFIG" "FEDORA_NAME" "DEVEL")
-	VARIABLE_PARSE_ARGN(${var} _validOptions ${ARGN})
-	UNSET(_ver)
-	UNSET(_rel)
-	IF(DEFINED ${var}_REQUIRED)
-	    SET(_verbose "${M_ERROR}")
-	    SET(_required "REQUIRED")
-	ELSE(DEFINED ${var}_REQUIRED)
-	    SET(_verbose "${M_OFF}")
-	    SET(_required "")
-	ENDIF(DEFINED ${var}_REQUIRED)
-	IF(${var}_VER)
-	    SET(_ver "${${var}_VER}")
-	    IF(DEFINED ${var}_EXACT)
-		SET(_rel "=")
-		SET(_exact "EXACT")
-	    ELSE(DEFINED ${var}_EXACT)
-		SET(_rel ">=")
-		SET(_exact "")
-	    ENDIF(DEFINED ${var}_EXACT)
-	ENDIF(${var}_VER)
+## This need to be here, otherwise the variable won't be available
+## the 2nd time called.
+FIND_PACKAGE(PkgConfig)

-	IF(${var}_PROGRAM_NAMES)
-	    MESSAGE(STATUS "checking for program '${${var}_PROGRAM_NAMES}'")
-	    FIND_PROGRAM(${var}_EXECUTABLE NAMES "${${var}_PROGRAM_NAMES}"
-		DOC "${var} executable"
-		)
-	    IF(${var}_EXECUTABLE-NOTFOUND)
-		M_MSG("${_verbose}" "Cannot found ${${var}_PROGRAM_NAMES} in path.")
-	    ELSE(${var}_EXECUTABLE-NOTFOUND)
-		MESSAGE(STATUS "   found ${${var}_EXECUTABLE}")
-	    ENDIF(${var}_EXECUTABLE-NOTFOUND)
-	    FIND_PROGRAM_ERROR_HANDLING(${var}_EXECUTABLE
-		VERBOSE_LEVEL "${_verbose}"
-		"${${var}_PROGRAM_NAMES}"
-		)
-	    MARK_AS_ADVANCED(${var}_EXECUTABLE)
-	ENDIF(${var}_PROGRAM_NAMES)
+## This is declared as function, because
+## macro does not play nice if listVar is required in different
+## source dir.
+FUNCTION(MANAGE_DEPENDENCY listVar var)
+    SET(_validOptions "VER" "EXACT" "REQUIRED"
+	"PROGRAM_NAMES" "PKG_CONFIG" "FEDORA_NAME" "DEVEL")
+    VARIABLE_PARSE_ARGN(${var} _validOptions ${ARGN})
+    UNSET(_ver)
+    UNSET(_rel)
+    IF(DEFINED ${var}_REQUIRED)
+	SET(_verbose "${M_ERROR}")
+	SET(_required "REQUIRED")
+    ELSE(DEFINED ${var}_REQUIRED)
+	SET(_verbose "${M_OFF}")
+	SET(_required "")
+    ENDIF(DEFINED ${var}_REQUIRED)
+    IF(${var}_VER)
+	SET(_ver "${${var}_VER}")
+	IF(DEFINED ${var}_EXACT)
+	    SET(_rel "=")
+	    SET(_exact "EXACT")
+	ELSE(DEFINED ${var}_EXACT)
+	    SET(_rel ">=")
+	    SET(_exact "")
+	ENDIF(DEFINED ${var}_EXACT)
+    ENDIF(${var}_VER)

-	IF(${var}_PKG_CONFIG)
-	    IF(NOT PKG_CONFIG_VERSION)
-		FIND_PACKAGE(PkgConfig REQUIRED)
-		## Auto-add pkgconfig as dependency
+    IF(${var}_PROGRAM_NAMES)
+	MESSAGE(STATUS "checking for program '${${var}_PROGRAM_NAMES}'")
+	FIND_PROGRAM(${var}_EXECUTABLE NAMES "${${var}_PROGRAM_NAMES}"
+	    DOC "${var} executable"
+	    )
+	IF(${var}_EXECUTABLE-NOTFOUND)
+	    M_MSG("${_verbose}" "Cannot found ${${var}_PROGRAM_NAMES} in path.")
+	ELSE(${var}_EXECUTABLE-NOTFOUND)
+	    MESSAGE(STATUS "   found ${${var}_EXECUTABLE}")
+	ENDIF(${var}_EXECUTABLE-NOTFOUND)
+	FIND_PROGRAM_ERROR_HANDLING(${var}_EXECUTABLE
+	    VERBOSE_LEVEL "${_verbose}"
+	    "${${var}_PROGRAM_NAMES}"
+	    )
+	MARK_AS_ADVANCED(${var}_EXECUTABLE)
+    ENDIF(${var}_PROGRAM_NAMES)
+
+    IF(${var}_PKG_CONFIG)
+	IF(PKG_CONFIG_EXECUTABLE)
+	    LIST(FIND ${listVar} "pkgconfig" _index)
+	    IF(_index EQUAL -1)
 		LIST(APPEND ${listVar} "pkgconfig")
-	    ENDIF(NOT PKG_CONFIG_VERSION)
-	    PKG_CHECK_MODULES(${var} ${_required}
-		"${${var}_PKG_CONFIG}${_rel}${_ver}")
-	    EXECUTE_PROCESS(COMMAND ${PKG_CONFIG_EXECUTABLE}
-		--print-variables "${${var}_PKG_CONFIG}"
-		OUTPUT_VARIABLE _variables
-		OUTPUT_STRIP_TRAILING_WHITESPACE
-		RESULT_VARIABLE _ret
-		)
-	    IF(NOT _ret)
-		STRING_SPLIT(${var}_VARIABLES "\n" "${_variables}")
-		FOREACH(_v ${${var}_VARIABLES})
-		    STRING(TOUPPER "${_v}" _u)
-		    EXECUTE_PROCESS(COMMAND ${PKG_CONFIG_EXECUTABLE}
-			--variable "${_v}" "${${var}_PKG_CONFIG}"
-			OUTPUT_VARIABLE ${var}_${_u}
-			OUTPUT_STRIP_TRAILING_WHITESPACE
-			)
-		    MARK_AS_ADVANCED(${var}_${_u})
-		    M_MSG(${M_INFO1} "${var}_${_u}=${${var}_${_u}}")
-		ENDFOREACH(_v ${var}_VARIABLES)
-	    ENDIF(NOT _ret)
-	ENDIF(${var}_PKG_CONFIG)
+	    ENDIF(_index EQUAL -1)
+	ELSE(PKG_CONFIG_EXECUTABLE)
+	    M_MSG(${M_ERROR} "pkgconfig is required with ${var}")
+	ENDIF(PKG_CONFIG_EXECUTABLE)
+	PKG_CHECK_MODULES(${var} ${_required}
+	    "${${var}_PKG_CONFIG}${_rel}${_ver}")
+	EXECUTE_PROCESS(COMMAND ${PKG_CONFIG_EXECUTABLE}
+	    --print-variables "${${var}_PKG_CONFIG}"
+	    OUTPUT_VARIABLE _variables
+	    OUTPUT_STRIP_TRAILING_WHITESPACE
+	    RESULT_VARIABLE _ret
+	    )
+	IF(NOT _ret)
+	    STRING_SPLIT(${var}_VARIABLES "\n" "${_variables}")
+	    FOREACH(_v ${${var}_VARIABLES})
+		STRING(TOUPPER "${_v}" _u)
+		EXECUTE_PROCESS(COMMAND ${PKG_CONFIG_EXECUTABLE}
+		    --variable "${_v}" "${${var}_PKG_CONFIG}"
+		    OUTPUT_VARIABLE ${var}_${_u}
+		    OUTPUT_STRIP_TRAILING_WHITESPACE
+		    )
+		MARK_AS_ADVANCED(${var}_${_u})
+		M_MSG(${M_INFO1} "${var}_${_u}=${${var}_${_u}}")
+	    ENDFOREACH(_v ${var}_VARIABLES)
+	ENDIF(NOT _ret)
+    ENDIF(${var}_PKG_CONFIG)

-	IF(${var}_FEDORA_NAME)
-	    SET(_name "${${var}_FEDORA_NAME}")
-	ELSE(${var}_FEDORA_NAME)
-	    STRING(TOLOWER "${var}" _name)
-	ENDIF(${var}_FEDORA_NAME)
+    IF(${var}_FEDORA_NAME)
+	SET(_name "${${var}_FEDORA_NAME}")
+    ELSE(${var}_FEDORA_NAME)
+	STRING(TOLOWER "${var}" _name)
+    ENDIF(${var}_FEDORA_NAME)

-	IF(DEFINED ${var}_DEVEL)
-	    SET(_name "${_name}-devel")
-	ENDIF(DEFINED ${var}_DEVEL)
-	IF("${_ver}" STREQUAL "")
-	    SET(_newDep  "${_name}")
-	ELSE("${_ver}" STREQUAL "")
-	    SET(_newDep  "${_name} ${_rel} ${_ver}")
-	ENDIF("${_ver}" STREQUAL "")
+    IF(DEFINED ${var}_DEVEL)
+	SET(_name "${_name}-devel")
+    ENDIF(DEFINED ${var}_DEVEL)
+    IF("${_ver}" STREQUAL "")
+	SET(_newDep  "${_name}")
+    ELSE("${_ver}" STREQUAL "")
+	SET(_newDep  "${_name} ${_rel} ${_ver}")
+    ENDIF("${_ver}" STREQUAL "")

-	## Insert when it's not duplicated
-	LIST(FIND ${listVar} "${_newDep}" _index)
-	IF(_index EQUAL -1)
-	    LIST(APPEND ${listVar} "${_newDep}")
-	    SET(${listVar} "${${listVar}}" CACHE INTERNAL "${listVar}")
-	ENDIF(_index EQUAL -1)
-    ENDMACRO(MANAGE_DEPENDENCY listVar var)
+    ## Insert when it's not duplicated
+    LIST(FIND ${listVar} "${_newDep}" _index)
+    IF(_index EQUAL -1)
+	LIST(APPEND ${listVar} "${_newDep}")
+    ENDIF(_index EQUAL -1)
+    SET(${listVar} "${${listVar}}" PARENT_SCOPE)
+ENDFUNCTION(MANAGE_DEPENDENCY)

-ENDIF(NOT DEFINED _MANAGE_DEPENDENCY_CMAKE_)


Add bash and python to make packages calls (#2193)

--- CMake/Packages.cmake
+++ CMake/Packages.cmake
@@ -2,8 +2,8 @@
 if(APPLE)
   add_custom_target(
     packages
-    COMMAND "${CMAKE_SOURCE_DIR}/tools/deployment/make_osx_package.sh"
-    COMMAND "${CMAKE_SOURCE_DIR}/tools/codegen/genapi.py" "${CMAKE_SOURCE_DIR}"
+    COMMAND bash "${CMAKE_SOURCE_DIR}/tools/deployment/make_osx_package.sh"
+    COMMAND python "${CMAKE_SOURCE_DIR}/tools/codegen/genapi.py" "${CMAKE_SOURCE_DIR}"
       "--output" "--directory" "${CMAKE_BINARY_DIR}"
     WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
     COMMENT "Building default OS X package (no custom config)" VERBATIM
@@ -143,10 +143,10 @@

   add_custom_target(
     packages
-    COMMAND "${CMAKE_SOURCE_DIR}/tools/deployment/make_linux_package.sh"
+    COMMAND bash "${CMAKE_SOURCE_DIR}/tools/deployment/make_linux_package.sh"
       -t ${PACKAGE_TYPE} -i "${PACKAGE_ITERATION}"
       -d "${PACKAGE_DEPENDENCIES}"
-    COMMAND "${CMAKE_SOURCE_DIR}/tools/codegen/genapi.py" "${CMAKE_SOURCE_DIR}"
+    COMMAND python "${CMAKE_SOURCE_DIR}/tools/codegen/genapi.py" "${CMAKE_SOURCE_DIR}"
       "--output" "--directory" "${CMAKE_BINARY_DIR}"
     WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
     COMMENT "Building linux packages (no custom config)" VERBATIM


small cmake fix

small cmake fix

--- CMakeOlxCommon.cmake
+++ CMakeOlxCommon.cmake
@@ -129,7 +129,7 @@
 ENDIF(NOT WIN32 AND NOT MINGW_CROSS_COMPILE)

-file(GLOB_RECURSE ALL_SRCS ${OLXROOTDIR}/src/*/*.c*)
+file(GLOB_RECURSE ALL_SRCS ${OLXROOTDIR}/src/*.c*)

 IF(APPLE)
 	file(GLOB_RECURSE MAC_SRCS ${OLXROOTDIR}/src/*.m*)


Link against librt for timing.

Link against librt for timing.

--- tests/Makefile_CL.cmake
+++ tests/Makefile_CL.cmake
@@ -6,10 +6,10 @@

 ifeq ($(HIPACC_TARGET),Midgard)
     CC = @NDK_CXX_COMPILER@ @NDK_CXX_FLAGS@ @NDK_INCLUDE_DIRS_STR@
-    LDFLAGS = @NDK_LINK_LIBRARIES_STR@ @EMBEDDED_OPENCL_LFLAGS@ -lm -ldl -lstdc++
+    LDFLAGS += @NDK_LINK_LIBRARIES_STR@ @EMBEDDED_OPENCL_LFLAGS@
     INC += @EMBEDDED_OPENCL_CFLAGS@
 else
-    LDFLAGS += -lpthread @OPENCL_LFLAGS@
+    LDFLAGS += -lpthread -lrt @OPENCL_LFLAGS@
     INC += @OPENCL_CFLAGS@
     CC = g++
 endif


Revert "HTCONDOR-1113 Don't set rpath on test binaries on macOS."

This reverts commit 3d52720c57a22555b496122f803bfb2fad97e798.

It turns out the batlab builds require the test binaries to have
relative library paths, since the build and test are done at different
times in different directories.

--- build/cmake/macros/CondorExeTest.cmake
+++ build/cmake/macros/CondorExeTest.cmake
@@ -41,6 +41,13 @@
 		add_dependencies(${LOCAL_${_CNDR_TARGET}} condor_version_obj)
 		condor_set_link_libs( ${LOCAL_${_CNDR_TARGET}} "${_LINK_LIBS};condor_version_obj" )

+		if ( DARWIN )
+			add_custom_command( TARGET ${LOCAL_${_CNDR_TARGET}}
+				POST_BUILD
+				WORKING_DIRECTORY ${TEST_TARGET_DIR}
+				COMMAND ${CMAKE_SOURCE_DIR}/src/condor_scripts/macosx_rewrite_libs ${LOCAL_${_CNDR_TARGET}} )
+		endif()
+
 		APPEND_VAR( CONDOR_TESTS ${LOCAL_${_CNDR_TARGET}} )

 	endif(BUILD_TESTING)


COMP: Handle OpenCV library search paths.

--- CMake/mitkFunctionGetLibrarySearchPaths.cmake
+++ CMake/mitkFunctionGetLibrarySearchPaths.cmake
@@ -62,6 +62,22 @@
     endif()
   endif()

+  if(OpenCV_DIR)
+    set(_opencv_link_directories
+      "${OpenCV_LIB_DIR_DBG}"
+      "${OpenCV_LIB_DIR_OPT}"
+      "${OpenCV_3RDPARTY_LIB_DIR_DBG}"
+      "${OpenCV_3RDPARTY_LIB_DIR_OPT}")
+    list(REMOVE_DUPLICATES _opencv_link_directories)
+    if(WIN32)
+      foreach(_opencv_link_directory ${_opencv_link_directories})
+        list(APPEND _dir_candidates "${_opencv_link_directory}/../bin")
+      endforeach()
+    else()
+      list(APPEND _dir_candidates ${_opencv_link_directories})
+    endif()
+  endif()
+
   if(MITK_USE_Python AND CTK_PYTHONQT_INSTALL_DIR)
     list(APPEND _dir_candidates "${CTK_PYTHONQT_INSTALL_DIR}/bin")
   endif()


added prefix for lua, when installing search tools.

--- scripts/TorchHelp.cmake
+++ scripts/TorchHelp.cmake
@@ -109,4 +109,4 @@

 ENDMACRO(ADD_TORCH_DOK)

-INSTALL(CODE "EXECUTE_PROCESS(COMMAND lua -ltorch -ldok -e \"dok.installsearch()\")")
+INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_INSTALL_PREFIX}/bin/lua -ltorch -ldok -e \"dok.installsearch()\")")


use current version (v0.11) of implot to have some bugs fixed

--- externals/CMakeExternals.cmake
+++ externals/CMakeExternals.cmake
@@ -482,7 +482,7 @@

     add_external_project(implot STATIC
       GIT_REPOSITORY https://github.com/epezent/implot.git
-      GIT_TAG "v0.8"
+      GIT_TAG "v0.11"
       BUILD_BYPRODUCTS "<INSTALL_DIR>/${IMPLOT_LIB}"
       DEPENDS imgui
       CMAKE_ARGS


The Protobuf CMake finder now uses the PROTOBUF_SRC_ROOT_FOLDER environment variable on Windows.

--- cmake_modules/FindProtobufPlugin.cmake
+++ cmake_modules/FindProtobufPlugin.cmake
@@ -208,7 +208,8 @@
     set(PROTOBUF_ORIG_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}")
     set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "")

-    find_path(PROTOBUF_SRC_ROOT_FOLDER protobuf.pc.in)
+    find_path(PROTOBUF_SRC_ROOT_FOLDER protobuf.pc.in
+              PATHS $ENV{PROTOBUF_SRC_ROOT_FOLDER})
 endif()

 # The Protobuf library


[Build] Added support to read the version from the CMake cache.

--- config/project_config_embeddable.cmake
+++ config/project_config_embeddable.cmake
@@ -139,6 +139,8 @@
 macro (store_in_cache)
   # Force some variables that could be defined in the command line to be
   # written to cache
+  set (PACKAGE_VERSION "${PACKAGE_VERSION}" CACHE STRING
+  "Version of the project/package")
   set (BUILD_SHARED_LIBS "${BUILD_SHARED_LIBS}" CACHE BOOL
 	"Set to OFF to build static libraries" FORCE)
   set (CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" CACHE PATH


[Build][Doc] Factorised the CMake-related helpers for the documentation (HTML, PDF and manual pages).

--- config/project_config_embeddable.cmake
+++ config/project_config_embeddable.cmake
@@ -1127,11 +1127,227 @@
 ###################################################################
 ##                         Documentation                         ##
 ###################################################################
+##
+# HTML pages and PDF reference manual
+##
+#
 macro (handle_html_doc)
   if (${INSTALL_DOC} STREQUAL "ON")
 	add_subdirectory (doc)
   endif (${INSTALL_DOC} STREQUAL "ON")
 endmacro (handle_html_doc)
+
+# Define the substitutes for the variables present in the Doxygen
+# configuration files. Note that PACKAGE, PACKAGE_NAME and PACKAGE_VERSION
+# are defined in the main CMakeLists.txt (of the top root directory).
+macro (doc_set_directories)
+  set (OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+  set (top_srcdir ${CMAKE_SOURCE_DIR})
+  set (srcdir ${CMAKE_CURRENT_SOURCE_DIR})
+endmacro (doc_set_directories)
+
+#
+macro (doc_add_web_pages)
+  # Set the documentation directories for the Doxygen configuration file
+  doc_set_directories()
+
+  # Convert the Doxygen configuration files (basically, just replace
+  # the @<variable>@ variables).
+  set (DOXYGEN_CFG_SRC doxygen_html.cfg.in)
+  set (DOXYGEN_CFG ${CMAKE_CURRENT_BINARY_DIR}/doxygen_html.cfg)
+  configure_file (${DOXYGEN_CFG_SRC} ${DOXYGEN_CFG} @ONLY)
+
+  ## Documentation sources
+  # (CSS) Style sheets
+  set (docstyles_DIR ${CMAKE_CURRENT_SOURCE_DIR}/styles)
+  set (style_SOURCES ${CPACK_PACKAGE_NAME}.css)
+  set (docstyles_SOURCES ${docstyles_DIR}/${style_SOURCES})
+  # Images
+  set (docimages_DIR ${CMAKE_CURRENT_SOURCE_DIR}/images)
+  set (image_SOURCES ${CPACK_PACKAGE_NAME}_logo.png sfx_logo.png favicon.ico)
+  set (docimages_SOURCES "")
+  foreach (_doc_img_src ${image_SOURCES})
+	list (APPEND docimages_SOURCES ${docimages_DIR}/${_doc_img_src})
+  endforeach (_doc_img_src ${image_SOURCES})
+  # Tutorial
+  FILE (GLOB doctutorial_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/tutorial/*.doc)
+  # Local
+  FILE (GLOB doclocaldoc_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/local/*.doc)
+  FILE (GLOB doclocalhtml_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/local/*.html)
+  set (doclocal_SOURCES ${doclocaldoc_SOURCES} ${doclocalhtml_SOURCES})
+  # Aggregating all the documentation sources
+  set (doc_SOURCES ${doctutorial_SOURCES} ${doclocal_SOURCES}
+	${docstyles_SOURCES} ${docimages_SOURCES})
+
+  # Latex reference manual source (.tex file), generated by Doxygen
+  set (REFMAN refman)
+  set (TEX_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/latex)
+  set (REFMAN_TEX ${REFMAN}.tex)
+  set (REFMAN_TEX_FULL ${TEX_GEN_DIR}/${REFMAN_TEX})
+
+  # Add the build rule for Doxygen
+  set (DOXYGEN_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/html/index.html)
+  add_custom_command (OUTPUT ${DOXYGEN_OUTPUT} ${REFMAN_TEX_FULL}
+	COMMAND ${DOXYGEN_EXECUTABLE} ARGS ${DOXYGEN_CFG}
+	DEPENDS ${DOXYGEN_CFG} ${doc_SOURCES}
+	COMMENT "Generating documentation with Doxygen, from '${DOXYGEN_CFG}'...")
+  # Add the 'doc' target, depending on the generated HTML documentation
+  add_custom_target (doc ALL DEPENDS ${DOXYGEN_OUTPUT})
+
+  ##
+  # Copy the needed files into the generated HTML directory
+  set (htmldoc_DIR ${CMAKE_CURRENT_BINARY_DIR}/html)
+  set (pdfdoc_DIR ${CMAKE_CURRENT_BINARY_DIR}/latex)
+
+  # (CSS) Style sheets
+  foreach (style_SRC ${style_SOURCES})
+	set (CSS_SRC_FULL_DIR ${docstyles_DIR}/${style_SRC})
+	set (CSS_GEN_FULL_DIR ${htmldoc_DIR}/${style_SRC})
+	add_custom_command (OUTPUT ${CSS_GEN_FULL_DIR}
+	  COMMAND ${CMAKE_COMMAND}
+	  ARGS -E copy ${CSS_SRC_FULL_DIR} ${CSS_GEN_FULL_DIR}
+	  DEPENDS ${DOXYGEN_OUTPUT} ${CSS_SRC_FULL_DIR}
+	  COMMENT "Copying style '${CSS_SRC_FULL_DIR}' into '${htmldoc_DIR}'...")
+	add_custom_target (css_${style_SRC} ALL DEPENDS ${CSS_GEN_FULL_DIR})
+  endforeach (style_SRC)
+
+  # Images
+  foreach (image_SRC ${image_SOURCES})
+	set (IMG_SRC_FULL_DIR ${docimages_DIR}/${image_SRC})
+	set (IMG_GEN_FULL_DIR ${htmldoc_DIR}/${image_SRC})
+	add_custom_command (OUTPUT ${IMG_GEN_FULL_DIR}
+	  COMMAND ${CMAKE_COMMAND}
+	  ARGS -E copy ${IMG_SRC_FULL_DIR} ${IMG_GEN_FULL_DIR}
+	  DEPENDS ${DOXYGEN_OUTPUT} ${IMG_SRC_FULL_DIR}
+	  COMMENT "Copying image '${IMG_SRC_FULL_DIR}' into '${htmldoc_DIR}'...")
+	add_custom_target (img_${image_SRC} ALL DEPENDS ${IMG_GEN_FULL_DIR})
+  endforeach (image_SRC)
+
+  ##
+  # PDF, generated by (Pdf)Latex from the Latex source file, itself generated
+  # by Doxygen (see above)
+  set (REFMAN_IDX ${REFMAN}.idx)
+  set (REFMAN_IDX_FULL ${TEX_GEN_DIR}/${REFMAN_IDX})
+  set (REFMAN_PDF ${REFMAN}.pdf)
+  set (REFMAN_PDF_FULL ${TEX_GEN_DIR}/${REFMAN_PDF})
+  # Note the "|| echo" addition to the pdflatex command, as that latter returns
+  # as if there were an error.
+  add_custom_command (OUTPUT ${REFMAN_IDX_FULL} ${REFMAN_PDF_FULL}
+	DEPENDS ${DOXYGEN_OUTPUT} ${REFMAN_TEX_FULL}
+	COMMAND ${CMAKE_COMMAND}
+	ARGS -E chdir ${TEX_GEN_DIR} pdflatex -interaction batchmode ${REFMAN_TEX} || echo "First PDF generation done."
+	COMMAND ${CMAKE_COMMAND}
+	ARGS -E chdir ${TEX_GEN_DIR} makeindex -q ${REFMAN_IDX}
+	COMMAND ${CMAKE_COMMAND}
+	ARGS -E chdir ${TEX_GEN_DIR} pdflatex -interaction batchmode ${REFMAN_TEX} || echo "Second PDF generation done."
+	COMMENT "Generating PDF Reference Manual ('${REFMAN_PDF}')..."
+	COMMAND ${CMAKE_COMMAND}
+	ARGS -E chdir ${TEX_GEN_DIR} test -f ${REFMAN_PDF} || echo "Warning: the PDF reference manual \\\('${REFMAN_PDF_FULL}'\\\) has failed to build. You can perform a simple re-build \\\('make' in the 'doc/latex' sub-directory\\\)."
+	COMMENT "Checking whether the PDF Reference Manual ('${REFMAN_PDF}') has been built...")
+  # Add the 'pdf' target, depending on the generated PDF manual
+  add_custom_target (pdf ALL DEPENDS ${REFMAN_PDF_FULL})
+
+  # Clean-up $build/html and $build/latex on 'make clean'
+  set_property (DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES
+	${htmldoc_DIR} ${pdfdoc_DIR})
+
+  ##
+  # Installation of the HTML documentation
+  set (DOC_PATH share/doc/${PROJECT_NAME}-${CPACK_PACKAGE_VERSION})
+  # HTML pages
+  install (DIRECTORY ${htmldoc_DIR} DESTINATION ${DOC_PATH})
+  # PDF reference manual
+  # Note: the 'OPTIONAL' ensures that even when the PDF file fails to be
+  # generated, the install process does not complain. If the PDF build fails,
+  # a simple re-build ('make' in the 'doc/latex' sub-directory) is usually
+  # enough.
+  install (FILES ${REFMAN_PDF_FULL} DESTINATION ${DOC_PATH}/html OPTIONAL)
+endmacro (doc_add_web_pages)
+
+##
+# Manual pages
+##
+macro (doc_add_man_pages)
+  # Specify the relative path where the manual pages are to be installed.
+  # That path is relative to the installation prefix. By default, the prefix
+  # is '/usr', and the manual page installation directory is therefore
+  # /usr/share/man
+  set (MAN_PATH "share/man")
+
+  # Specify the list of manual sections, e.g.:
+  #  * Section 1 (general commands)
+  #  * Section 3 (development)
+  set (man_section_list 1 2 3 4 5 6 7 8 9)
+
+  # Initialise the lists gathering information for each valid manual section
+  set (man_doxy_output_list "")
+  set (man_dir_list "")
+
+  # Parse the arguments
+  set (options "")
+  set (oneValueArgs "")
+
+  # Added one argument option for every manual section
+  foreach (man_sect ${man_section_list})
+	list (APPEND multiValueArgs MAN${man_sect})
+  endforeach (man_sect ${man_section_list})
+
+  cmake_parse_arguments (_man_arg "${options}" "${oneValueArgs}"
+	"${multiValueArgs}" ${ARGN})
+
+  # Set the documentation directories for the Doxygen configuration file
+  doc_set_directories()
+
+  # Browse all the manual sections
+  foreach (man_sect ${man_section_list})
+	# If the (current) macro was passed arguments for the current manual
+	# section, process the generation of manual pages (with Doxygen).
+	if (NOT "${_man_arg_MAN${man_sect}}" STREQUAL "")
+
+	  # Specify in which sub-directory the manual pages are to be found
+	  set (man${man_sect}_DIR ${CMAKE_CURRENT_BINARY_DIR}/man${man_sect})
+	  # Add that sub-directory to the dedicated list
+	  list (APPEND man_dir_list ${man${man_sect}_DIR})
+
+	  # Convert the Doxygen configuration files (basically, just replace
+	  # the @<variable>@ variables).
+	  set (man_doxy_cfg doxygen_man${man_sect}.cfg)
+	  set (DOXYGEN_CFG${man_sect}_SRC ${man_doxy_cfg}.in)
+	  set (DOXYGEN_CFG${man_sect} ${CMAKE_CURRENT_BINARY_DIR}/${man_doxy_cfg})
+	  configure_file (${DOXYGEN_CFG${man_sect}_SRC}
+		${DOXYGEN_CFG${man_sect}} @ONLY)
+
+	  # Manual page sources for the current manual section
+	  foreach (_doc_src ${_man_arg_MAN${man_sect}})
+		list (APPEND man${man_sect}_SOURCES ${_doc_src}.doc)
+	  endforeach (_doc_src ${_man_arg_MAN${man_sect}})
+
+	  # Add the build rule for Doxygen for section 1 manual pages
+	  set (DOXYGEN_OUTPUT${man_sect}
+		${man${man_sect}_DIR}/stdair-config.${man_sect})
+	  add_custom_command (OUTPUT ${DOXYGEN_OUTPUT${man_sect}}
+		COMMAND ${DOXYGEN_EXECUTABLE} ARGS ${DOXYGEN_CFG${man_sect}}
+		DEPENDS ${DOXYGEN_CFG${man_sect}} ${man${man_sect}_SOURCES}
+		COMMENT "Generating section ${man_sect} manual pages with Doxygen, from '${DOXYGEN_CFG${man_sect}}'...")
+
+	  # Add the current manual section output to the dedicated list,
+	  # so that it can then be added to the corresponding target (see below).
+	  list (APPEND man_doxy_output_list ${DOXYGEN_OUTPUT${man_sect}})
+
+	  # Specifiy what to do for the installation of the manual pages
+	  install (DIRECTORY "${man${man_sect}_DIR}" DESTINATION ${MAN_PATH})
+
+	endif (NOT "${_man_arg_MAN${man_sect}}" STREQUAL "")
+  endforeach (man_sect ${man_section_list})
+
+  # Add the 'man' target, depending on the generated manual page documentation
+  add_custom_target (man ALL DEPENDS ${man_doxy_output_list})
+
+  # Clean-up $build/man1 and $build/man3 on 'make clean'
+  set_property (DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES
+	${man_dir_list})
+
+endmacro (doc_add_man_pages)

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


[Doc] Fixed the logo for the generation of HTML pages.

--- config/project_config_embeddable.cmake
+++ config/project_config_embeddable.cmake
@@ -2118,7 +2118,7 @@
   set (docstyles_SOURCES ${docstyles_DIR}/${style_SOURCES})
   # Images
   set (docimages_DIR ${CMAKE_CURRENT_SOURCE_DIR}/images)
-  set (image_SOURCES ${CPACK_PACKAGE_NAME}_logo.png sfx_logo.png favicon.ico)
+  set (image_SOURCES ${CPACK_PACKAGE_NAME}_logo.png github_logo.png favicon.ico)
   set (docimages_SOURCES "")
   foreach (_doc_img_src ${image_SOURCES})
 	list (APPEND docimages_SOURCES ${docimages_DIR}/${_doc_img_src})


handle standard triplets

handle standard triplets

--- contrib/cmake/build_from_scratch.cmake
+++ contrib/cmake/build_from_scratch.cmake
@@ -27,9 +27,6 @@

 set(_triplet ${CMAKE_ARGV3})
 set(_sdk_dir "${_script_cwd}/../..")
-
-# Allows use of the VCPKG_XXXX variables defined in the triplet file
-include("${_script_cwd}/vcpkg_extra_triplets/${_triplet}.cmake")

 message(STATUS "Building for triplet ${_triplet} with SDK dir ${_sdk_dir}")

@@ -72,8 +69,10 @@

 if(WIN32)
     set(_3rdparty_tool_exe "${_3rdparty_sdk_dir}/Release/build3rdParty.exe")
+    set(_3rdparty_vcpkg_dir "${_3rdparty_sdk_dir}/Release/vcpkg/")
 else()
     set(_3rdparty_tool_exe "${_3rdparty_sdk_dir}/build3rdParty")
+    set(_3rdparty_vcpkg_dir "${_3rdparty_sdk_dir}/vcpkg/")
 endif()

 set(_3rdparty_tool_common_args
@@ -97,6 +96,26 @@
         ${_3rdparty_tool_common_args}
     WORKING_DIRECTORY ${_3rdparty_sdk_dir}
 )
+
+# Allows use of the VCPKG_XXXX variables defined in the triplet file
+# We search our own custom triplet folder, and then the standard ones searched by vcpkg
+foreach(_triplet_dir
+    "${_script_cwd}/vcpkg_extra_triplets/"
+    "${_3rdparty_vcpkg_dir}/triplets/"
+    "${_3rdparty_vcpkg_dir}/triplets/community"
+)
+    set(_triplet_file "${_triplet_dir}/${_triplet}.cmake")
+    if(EXISTS ${_triplet_file})
+        message(STATUS "Using triplet ${_triplet} at ${_triplet_file}")
+        include(${_triplet_file})
+        set(_triplet_file_found 1)
+        break()
+    endif()
+endforeach()
+
+if(NOT _triplet_file_found)
+    message(FATAL_ERROR "Could not find triplet ${_triplet} in Mega vcpkg_extra_triplets nor in vcpkg triplet folders")
+endif()

 # Now set up to build this repo
 # Logic between Windows and other platforms diverges slightly here:
@@ -160,7 +179,7 @@
         )

         execute_checked_command(
-            COMMAND ${_cmake}
+            COMMAND ${_cmake}
                 --build ${_build_dir}
                 --parallel 4
         )


GC TIME_WITH_SYS_TIME and TM_IN_SYS_TIME

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

--- include/llvm/Config/config.h.cmake
+++ include/llvm/Config/config.h.cmake
@@ -487,12 +487,6 @@
 /* Define to 1 if you have the ANSI C header files. */
 #undef STDC_HEADERS

-/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
-#undef TIME_WITH_SYS_TIME
-
-/* Define to 1 if your <sys/time.h> declares `struct tm'. */
-#undef TM_IN_SYS_TIME
-
 /* Define to `int' if <sys/types.h> does not define. */
 #undef pid_t


Refine the error report format

Refine the error report format

--- tests/system_tests/run_system_tests.sh.cmake
+++ tests/system_tests/run_system_tests.sh.cmake
@@ -135,7 +135,10 @@
 	msg+="\n"
 	if [ "x" != "x$FAILED_TESTS" ]; then
 		msg+="\n!!! $(echo "$FAILED_TESTS" | wc -w) failure(s)!!!"
-		msg+="\nFailed tests: $FAILED_TESTS"
+		msg+="\nFailed tests:\n"
+		for t in $FAILED_TESTS; do
+			msg+="\t$t\n"
+		done
 	elif [ $NUM_SKIP_TRANS -gt 0 -o $NUM_SKIP_COMPILE -gt 0 \
 							  -o $NUM_SKIP_EXECUTE -gt 0 ]; then
 		msg+="\nCompleted successfully with some tests skipped."


Setup resource copying on Xcode only, not Apple/GCC.

--- Source/CMake/Modules/Urho3D-CMake-magic.cmake
+++ Source/CMake/Modules/Urho3D-CMake-magic.cmake
@@ -165,7 +165,7 @@
             set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++ -static-libgcc")
             # Additional compiler flags for Windows ports of GCC
             set (CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG")
-            set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG")
+            set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG")
             # Reduce GCC optimization level from -O3 to -O2 for stability in RELEASE build type
             set (CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG")
             set (CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
@@ -199,7 +199,7 @@
     endif ()

     get_property (type TARGET ${TARGET_LIBRARY} PROPERTY TYPE)
-
+
     if (type MATCHES "STATIC|SHARED")
         if (WIN32)
             set (DEFINE_EXPORT "__declspec(dllexport)")
@@ -231,7 +231,7 @@
         message ("-- Following tests check whether compiler installed in this system has export/import and deprecated attributes support")
         message ("-- CMake will generate a suitable export header file for this system based on the test result")
         message ("-- It is OK to proceed to build Urho3D regardless of the test result")
-    endif ()
+    endif ()
     _test_compiler_hidden_visibility ()
     _test_compiler_has_deprecated ()
     if (NOT ANDROID)
@@ -294,7 +294,7 @@
 macro (setup_library)
     add_library (${TARGET_NAME} ${LIB_TYPE} ${SOURCE_FILES})
     setup_target ()
-
+
     if (CMAKE_PROJECT_NAME STREQUAL Urho3D AND NOT LIB_TYPE STREQUAL SHARED AND URHO3D_BUILD_TYPE MATCHES STATIC|SHARED)
         set (STATIC_LIBRARY_TARGETS ${STATIC_LIBRARY_TARGETS} ${TARGET_NAME} PARENT_SCOPE)
         if (URHO3D_BUILD_TYPE STREQUAL SHARED)
@@ -371,7 +371,7 @@
 # Macro for setting up an executable target with resources to copy
 macro (setup_main_executable)
     # Define resource files
-    if (APPLE)
+    if (XCODE)
         set (RESOURCE_FILES ${PROJECT_ROOT_DIR}/Bin/CoreData ${PROJECT_ROOT_DIR}/Bin/Data)
         set_source_files_properties(${RESOURCE_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
         set (SOURCE_FILES ${SOURCE_FILES} ${RESOURCE_FILES})
@@ -393,7 +393,7 @@
         # Setup target as main shared library
         set (LIB_TYPE SHARED)
         setup_library ()
-        # Copy target main shared library to Android library output path
+        # Copy target main shared library to Android library output path
         file (MAKE_DIRECTORY ${ANDROID_LIBRARY_OUTPUT_PATH})
         add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
             COMMAND ${CMAKE_STRIP} $<TARGET_FILE:${TARGET_NAME}>
@@ -421,7 +421,7 @@
         setup_executable ()
     endif ()

-    if (APPLE)
+    if (XCODE)
         get_target_property (TARGET_LOC ${TARGET_NAME} LOCATION)
         if (IOS)
             # Define a custom target to check for resource modification
@@ -443,13 +443,13 @@

 # Macro for adjusting library output name by dropping _suffix from the target name
 macro (adjust_library_name)
-    string (REGEX REPLACE "_.*$" "" LIB_NAME ${TARGET_NAME})
+    string (REGEX REPLACE "_.*$" "" LIB_NAME ${TARGET_NAME})
     set_target_properties (${TARGET_NAME} PROPERTIES OUTPUT_NAME ${LIB_NAME})
 endmacro ()

 # Macro for defining external library dependencies
 # The purpose of this macro is emulate CMake to set the external library dependencies transitively
-# It works for both targets setup within Urho3D project and outside Urho3D project that uses Urho3D as external static/shared library
+# It works for both targets setup within Urho3D project and outside Urho3D project that uses Urho3D as external static/shared library
 macro (define_dependency_libs TARGET)
     # ThirdParty/SDL external dependency
     if (${TARGET} MATCHES SDL|Main)
@@ -475,7 +475,7 @@
             set (LINK_LIBS_ONLY ${LINK_LIBS_ONLY} pthread)
         endif ()
     endif ()
-
+
     # Engine/Core external dependency
     if (${TARGET} MATCHES Core|Main)
         if (WIN32)
@@ -487,7 +487,7 @@
             set (LINK_LIBS_ONLY ${LINK_LIBS_ONLY} pthread)
         endif ()
     endif ()
-
+
     # Engine/Graphics external dependency
     if (${TARGET} MATCHES Graphics|Main)
         if (USE_OPENGL)
@@ -502,12 +502,12 @@
             set (ABSOLUTE_PATH_LIBS ${ABSOLUTE_PATH_LIBS} ${DIRECT3D_LIBRARY})
         endif ()
     endif ()
-
+
     # Main external dependency
     if (${TARGET} STREQUAL Main AND URHO3D_LIBRARIES)
         set (ABSOLUTE_PATH_LIBS ${ABSOLUTE_PATH_LIBS} ${URHO3D_LIBRARIES})
     endif ()
-
+
     if (LINK_LIBS_ONLY)
         list (SORT LINK_LIBS_ONLY)
         list (REMOVE_DUPLICATES LINK_LIBS_ONLY)


Add TODO to suppress 'not found' messages from pkgconfig when the module
subsequently attempts to locate the package by other means.

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

--- cmake/modules/FindOpenChange.cmake
+++ cmake/modules/FindOpenChange.cmake
@@ -19,6 +19,8 @@
 else (LIBMAPI_INCLUDE_DIRS AND LIBMAPI_LIBRARIES)
   if(NOT WIN32)
     find_package(PkgConfig)
+#TODO: Add QUIET parameter once kdelibs 4.3 is required for kdepim
+#    pkg_check_modules(libmapi QUIET libmapi)
     pkg_check_modules(libmapi libmapi)
   endif(NOT WIN32)


Minor problem with the logic

Minor problem with the logic

--- cmake/modules/RootTestDriver.cmake
+++ cmake/modules/RootTestDriver.cmake
@@ -90,7 +90,7 @@
   #---Return error is test returned an error code of write somthing to the stderr---------------------
   if(DEFINED RC AND (NOT _rc EQUAL RC))
     message(FATAL_ERROR "error code: ${_rc}")
-  elseif(_rc)
+  elseif(NOT DEFINED RC AND _rc)
     message(FATAL_ERROR "error code: ${_rc}")
   endif()
 endif()


refs #5368 merge what I wanted to: do helgrind/drd suppression in a nicer way

git-svn-id: b5c078ec0b4d3a50497e9dd3081db18a5b4f16e5@48328 c7de825b-a66e-492c-adef-691d508d4ae1

--- cmake_modules/TokuSetupCTest.cmake
+++ cmake_modules/TokuSetupCTest.cmake
@@ -90,48 +90,40 @@
   file(READ bash.suppressions bash_suppressions)
   file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/valgrind.suppressions" "${bash_suppressions}")

+  include(CMakeDependentOption)
+  set(helgrind_drd_depend_conditions "")
+  ## helgrind and drd are bad at dealing with freebsd's pthreads
+  ## implementation, see pkg-message at
+  ## http://www.freebsdports.info/ports/devel/valgrind.html
+  list(APPEND helgrind_drd_depend_conditions "NOT CMAKE_SYSTEM_NAME STREQUAL FreeBSD")
+  ## supposedly it's bad on darwin too, don't have a link for that, maybe
+  ## worth re-checking
+  list(APPEND helgrind_drd_depend_conditions "NOT CMAKE_SYSTEM_NAME STREQUAL Darwin")
+  ## no point doing it with gcov
+  list(APPEND helgrind_drd_depend_conditions "NOT USE_GCOV")
+  cmake_dependent_option(RUN_DRD_TESTS "Run some tests under drd." ON
+    "${helgrind_drd_depend_conditions}" OFF)
+  cmake_dependent_option(RUN_HELGRIND_TESTS "Run some tests under helgrind." ON
+    "${helgrind_drd_depend_conditions}" OFF)
+
   ## setup a function to write tests that will run with helgrind
   set(CMAKE_HELGRIND_COMMAND_STRING "valgrind --quiet --tool=helgrind --error-exitcode=1 --suppressions=${TokuDB_SOURCE_DIR}/src/tests/helgrind.suppressions --trace-children=yes --trace-children-skip=sh,*/sh,basename,*/basename,dirname,*/dirname,rm,*/rm,cp,*/cp,mv,*/mv,cat,*/cat,diff,*/diff,grep,*/grep,date,*/date,test,*/tokudb_dump* --trace-children-skip-by-arg=--only_create,--test,--no-shutdown,novalgrind")
   function(add_helgrind_test name)
-    if (CMAKE_SYSTEM_NAME MATCHES Darwin OR
-        ((CMAKE_CXX_COMPILER_ID MATCHES Intel) AND
-         (CMAKE_BUILD_TYPE MATCHES Release)) OR
-        USE_GCOV)
-      ## can't use helgrind on osx or with optimized intel, no point in
-      ## using it if we're doing coverage
-      add_test(
-        NAME ${name}
-        COMMAND ${ARGN}
-        )
-    else ()
-      separate_arguments(CMAKE_HELGRIND_COMMAND_STRING)
-      add_test(
-        NAME ${name}
-        COMMAND ${CMAKE_HELGRIND_COMMAND_STRING} ${ARGN}
-        )
-    endif ()
+    separate_arguments(CMAKE_HELGRIND_COMMAND_STRING)
+    add_test(
+      NAME ${name}
+      COMMAND ${CMAKE_HELGRIND_COMMAND_STRING} ${ARGN}
+      )
   endfunction(add_helgrind_test)

   ## setup a function to write tests that will run with drd
   set(CMAKE_DRD_COMMAND_STRING "valgrind --quiet --tool=drd --error-exitcode=1 --suppressions=${TokuDB_SOURCE_DIR}/src/tests/drd.suppressions --trace-children=yes --trace-children-skip=sh,*/sh,basename,*/basename,dirname,*/dirname,rm,*/rm,cp,*/cp,mv,*/mv,cat,*/cat,diff,*/diff,grep,*/grep,date,*/date,test,*/tokudb_dump* --trace-children-skip-by-arg=--only_create,--test,--no-shutdown,novalgrind")
   function(add_drd_test name)
-    if (CMAKE_SYSTEM_NAME MATCHES Darwin OR
-        ((CMAKE_CXX_COMPILER_ID MATCHES Intel) AND
-         (CMAKE_BUILD_TYPE MATCHES Release)) OR
-        USE_GCOV)
-      ## can't use drd on osx or with optimized intel, no point in
-      ## using it if we're doing coverage
-      add_test(
-        NAME ${name}
-        COMMAND ${ARGN}
-        )
-    else ()
-      separate_arguments(CMAKE_DRD_COMMAND_STRING)
-      add_test(
-        NAME ${name}
-        COMMAND ${CMAKE_DRD_COMMAND_STRING} ${ARGN}
-        )
-    endif ()
+    separate_arguments(CMAKE_DRD_COMMAND_STRING)
+    add_test(
+      NAME ${name}
+      COMMAND ${CMAKE_DRD_COMMAND_STRING} ${ARGN}
+      )
   endfunction(add_drd_test)

   option(RUN_LONG_TESTS "If set, run all tests, even the ones that take a long time to complete." OFF)


add 32 bit flag to older MinGW toolchain


Remove hack

Remove hack

--- CI/main_superbuild.cmake
+++ CI/main_superbuild.cmake
@@ -108,10 +108,6 @@
 set ( CONFIGURE_OPTIONS
   "${CONFIGURE_OPTIONS}-DCMAKE_PREFIX_PATH=${XDK_PATH};")

-# Hack because there is no more superbuild available (LIBKML)
-set ( CONFIGURE_OPTIONS
-  "${CONFIGURE_OPTIONS}-DOTB_USE_LIBKML:BOOL=OFF;" )
-
 # FIX ME this part might platform dependent
 set( GDAL_DATA "${XDK_PATH}/share/gdal" )
 set( GEOTIFF_CSV "${XDK_PATH}/share/epsg_csv" )


Fixed BUG #12688. Make FindFREETYPE smarter.

--- CMake/FindFREETYPE.cmake
+++ CMake/FindFREETYPE.cmake
@@ -15,6 +15,7 @@
 FIND_PATH(FREETYPE_INCLUDE_DIR_FTHEADER freetype/config/ftheader.h
   /usr/include/freetype2
   /usr/local/include/freetype2
+  PATH_SUFFIXES freetype2
 )

 FIND_LIBRARY(FREETYPE_LIBRARY freetype)


Promote TM2 version selection to 0.0.18.5448

Change-Id: I44cf76237e005f175523274717570e22a39eaf43
(cherry picked from commit d72b3ab0b9e34bb997ba5c775d77c1e1f4e25487)

--- third-party/libtm/versions.cmake
+++ third-party/libtm/versions.cmake
@@ -5,7 +5,7 @@
 # If FW source = Local - FW versions are defined according to /resources/remote_versions.log
 # If FW source = Internal - FW versions are defined according to fw.h, CentralAppFw.h, CentralBlFw.h
 set(INTERNAL_HOST_VERSION "0.19.3.1711")
-set(INTERNAL_FW_VERSION "0.0.18.5129")
+set(INTERNAL_FW_VERSION "0.0.18.5448")
 set(INTERNAL_CENTRAL_APP_VERSION "2.0.19.271")
 set(INTERNAL_CENTRAL_BL_VERSION "1.0.1.112")
 set(INTERNAL_FW_SOURCE "Remote" CACHE STRING "Select TM2 FW archive: Remote/Local (to avoid FW polling from remote server)")


Fixed issue where python dll wasn't being found.

--- tools/cmake/Win32PostBuild.cmake
+++ tools/cmake/Win32PostBuild.cmake
@@ -41,11 +41,11 @@
 )

 get_filename_component(PYTHON_DLL_PATH ${PYTHON_LIBRARY} PATH)
-string(REPLACE "/" "\\" PYTHON_DLL_PATH "${PYTHON_DLL_PATH}")
+string(REPLACE "/" "\\" PYTHON_DLL_PATH "${PYTHON_DLL_PATH}\\..\\DLLs")
 add_custom_command(
     TARGET DEPS
     POST_BUILD
-    COMMAND xcopy "${PYTHON_DLL_PATH}\\*.dll" "${WIN_PROJECT_BINARY_DIR}\\bin\\$\(Configuration\)" /D /I /Y /s
+    COMMAND xcopy "${PYTHON_DLL_PATH}\\python3.dll" "${WIN_PROJECT_BINARY_DIR}\\bin\\$\(Configuration\)" /D /I /Y /s
     VERBATIM
 )


Enhanced post-build automation for Android build to copy all dependent shared libraries to target library output directory.

--- Source/CMake/Modules/Urho3D-CMake-magic.cmake
+++ Source/CMake/Modules/Urho3D-CMake-magic.cmake
@@ -390,15 +390,15 @@
             COMMAND ${CMAKE_STRIP} $<TARGET_FILE:${TARGET_NAME}>
             COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different $<TARGET_FILE:${TARGET_NAME}> ${ANDROID_LIBRARY_OUTPUT_PATH}
             COMMENT "Stripping and copying the output shared library")
-        # For project references Urho3D as external shared library, also copy Urho3D shared library to Android library output path
-        if (URHO3D_LIBRARIES)
-            get_filename_component (URHO3D_LIBRARY_SUFFIX ${URHO3D_LIBRARIES} EXT)
-            if (URHO3D_LIBRARY_SUFFIX STREQUAL .so)
+        # Also copy other dependent shared libraries to Android library output path
+        foreach(FILE ${ABSOLUTE_PATH_LIBS})
+            get_filename_component (EXT ${FILE} EXT)
+            if (EXT STREQUAL .so)
                 add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
-                    COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${URHO3D_LIBRARIES} ${ANDROID_LIBRARY_OUTPUT_PATH}
-                    COMMENT "Copying Urho3D shared library to target library directory")
-            endif ()
-        endif ()
+                    COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${FILE} ${ANDROID_LIBRARY_OUTPUT_PATH}
+                    COMMENT "Copying other dependent shared library to target library directory")
+            endif ()
+        endforeach ()
     else ()
         if (WIN32)
             set (EXE_TYPE WIN32)