FindTBB: Updated implementation to version proposed for CMake.

The new implementation of FindTBB is a better approach to search for tbb
on all platforms, and better obeys the CMake Find Module guidelines.

--- CMake/FindTBB.cmake
+++ CMake/FindTBB.cmake
@@ -1,283 +1,285 @@
-# Locate Intel Threading Building Blocks include paths and libraries
-# FindTBB.cmake can be found at https://code.google.com/p/findtbb/
-# Written by Hannes Hofmann <hannes.hofmann _at_ informatik.uni-erlangen.de>
-# Improvements by Gino van den Bergen <gino _at_ dtecta.com>,
-#   Florian Uhlig <F.Uhlig _at_ gsi.de>,
-#   Jiri Marsik <jiri.marsik89 _at_ gmail.com>
-
-# The MIT License
-#
-# Copyright (c) 2011 Hannes Hofmann
-#
-# 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_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()
-    if (MSVC80)
-        set(_TBB_COMPILER "vc8")
-    endif()
-    if (MSVC90)
-        set(_TBB_COMPILER "vc9")
-    endif()
-    if(MSVC10)
-        set(_TBB_COMPILER "vc10")
-    endif()
-    # Todo: add other Windows compilers such as ICL.
-    set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
+# - Find ThreadingBuildingBlocks include dirs and libraries
+# Use this module by invoking find_package with the form:
+#  find_package(TBB
+#    [REQUIRED]             # Fail with error if TBB is not found
+#    )                      #
+# Once done, this will define
+#
+#  TBB_FOUND - system has TBB
+#  TBB_INCLUDE_DIRS - the TBB include directories
+#  TBB_LIBRARIES - TBB libraries to be lined, doesn't include malloc or
+#                  malloc proxy
+#
+#  TBB_VERSION_MAJOR - Major Product Version Number
+#  TBB_VERSION_MINOR - Minor Product Version Number
+#  TBB_INTERFACE_VERSION - Engineering Focused Version Number
+#  TBB_COMPATIBLE_INTERFACE_VERSION - The oldest major interface version
+#                                     still supported. This uses the engineering
+#                                     focused interface version numbers.
+#
+#  TBB_MALLOC_FOUND - system has TBB malloc library
+#  TBB_MALLOC_INCLUDE_DIRS - the TBB malloc include directories
+#  TBB_MALLOC_LIBRARIES - The TBB malloc libraries to be lined
+#
+#  TBB_MALLOC_PROXY_FOUND - system has TBB malloc proxy library
+#  TBB_MALLOC_PROXY_INCLUDE_DIRS = the TBB malloc proxy include directories
+#  TBB_MALLOC_PROXY_LIBRARIES - The TBB malloc proxy libraries to be lined
+#
+#
+# This module reads hints about search locations from variables:
+#  ENV TBB_ARCH_PLATFORM for windows only
+#  ENV TBB_ROOT or just TBB_ROOT
+#
+#
+#
+# Modified by Robert Maynard from the original OGRE source
+#
+#-------------------------------------------------------------------
+# This file is part of the CMake build system for OGRE
+#     (Object-oriented Graphics Rendering Engine)
+# For the latest info, see http://www.ogre3d.org/
+#
+# The contents of this file are placed in the public domain. Feel
+# free to make use of it in any way you like.
+#-------------------------------------------------------------------
+#
+#=============================================================================
+# Copyright 2010-2012 Kitware, Inc.
+# Copyright 2012      Rolf Eike Beer <eike@sf-mail.de>
+#
+# 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.)
+
+
+#=============================================================================
+#  FindTBB helper functions and macros
+#
+
+#===============================================
+# Create search paths based on prefix path
+#===============================================
+macro(create_search_paths PREFIX)
+  foreach(dir ${${PREFIX}_PREFIX_PATH})
+    set(${PREFIX}_INC_SEARCH_PATH ${${PREFIX}_INC_SEARCH_PATH}
+      ${dir}/include ${dir}/Include ${dir}/include/${PREFIX})
+    set(${PREFIX}_LIB_SEARCH_PATH ${${PREFIX}_LIB_SEARCH_PATH}
+      ${dir}/lib ${dir}/Lib ${dir}/lib/${PREFIX} ${dir}/Libs)
+  endforeach(dir)
+endmacro(create_search_paths)
+
+#===============================================
+# Do the final processing for the package find.
+#===============================================
+macro(findpkg_finish PREFIX)
+  # skip if already processed during this run
+  if (NOT ${PREFIX}_FOUND)
+    if (${PREFIX}_INCLUDE_DIR AND ${PREFIX}_LIBRARY)
+      set(${PREFIX}_FOUND TRUE)
+      set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIR})
+      set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARY})
+    else ()
+      if (${PREFIX}_FIND_REQUIRED AND NOT ${PREFIX}_FIND_QUIETLY)
+        message(FATAL_ERROR "Required library ${PREFIX} not found.")
+      endif ()
+    endif ()
+
+   #mark the following variables as internal variables
+   mark_as_advanced(${PREFIX}_INCLUDE_DIR
+                    ${PREFIX}_LIBRARY
+                    ${PREFIX}_LIBRARY_DEBUG
+                    ${PREFIX}_LIBRARY_RELEASE)
+  endif ()
+endmacro(findpkg_finish)
+
+#===============================================
+# Generate debug names from given RELEASEease names
+#===============================================
+macro(get_debug_names PREFIX)
+  foreach(i ${${PREFIX}})
+    set(${PREFIX}_DEBUG ${${PREFIX}_DEBUG} ${i}d ${i}D ${i}_d ${i}_D ${i}_debug ${i})
+  endforeach(i)
+endmacro(get_debug_names)
+
+#===============================================
+# See if we have env vars to help us find tbb
+#===============================================
+macro(getenv_path VAR)
+   set(ENV_${VAR} $ENV{${VAR}})
+   # replace won't work if var is blank
+   if (ENV_${VAR})
+     string( REGEX REPLACE "\\\\" "/" ENV_${VAR} ${ENV_${VAR}} )
+   endif ()
+endmacro(getenv_path)
+
+#===============================================
+# Couple a set of RELEASEease AND debug libraries
+#===============================================
+macro(make_library_set PREFIX)
+  if (${PREFIX}_RELEASE AND ${PREFIX}_DEBUG)
+    set(${PREFIX} optimized ${${PREFIX}_RELEASE} debug ${${PREFIX}_DEBUG})
+  elseif (${PREFIX}_RELEASE)
+    set(${PREFIX} ${${PREFIX}_RELEASE})
+  elseif (${PREFIX}_DEBUG)
+    set(${PREFIX} ${${PREFIX}_DEBUG})
+  endif ()
+endmacro(make_library_set)
+
+
+#=============================================================================
+#  Now to actually find TBB
+#
+
+# Get path, convert backslashes as ${ENV_${var}}
+getenv_path(TBB_ROOT)
+# construct search paths
+set(TBB_PREFIX_PATH ${TBB_ROOT} ${ENV_TBB_ROOT})
+create_search_paths(TBB)
+
+# get the arch, only used by windows
+if($ENV{TBB_ARCH_PLATFORM})
+    set(TBB_ARCH_PLATFORM $ENV{TBB_ARCH_PLATFORM})
+endif()
+
+# For Windows, let's assume that the user might be using the precompiled
+# TBB packages from the main website. These use a rather awkward directory
+# structure (at least for automatically finding the right files) depending
+# on platform and compiler, but we'll do our best to accommodate it.
+# Not adding the same effort for the precompiled linux builds, though. Those
+# have different versions for CC compiler versions and linux kernels which
+# will never adequately match the user's setup, so there is no feasible way
+# to detect the "best" version to use. The user will have to manually
+# select the right files. (Chances are the distributions are shipping their
+# custom version of tbb, anyway, so the problem is probably nonexistant.)
+if (WIN32 AND MSVC)
+  set(COMPILER_PREFIX "vc7.1")
+  if (MSVC_VERSION EQUAL 1400)
+    set(COMPILER_PREFIX "vc8")
+  elseif(MSVC_VERSION EQUAL 1500)
+    set(COMPILER_PREFIX "vc9")
+  elseif(MSVC_VERSION EQUAL 1600)
+    set(COMPILER_PREFIX "vc10")
+  elseif(MSVC_VERSION EQUAL 1700)
+    set(COMPILER_PREFIX "vc11")
+  elseif(MSVC_VERSION EQUAL 1800)
+    set(COMPILER_PREFIX "vc12")
+  elseif(MSVC_VERSION EQUAL 1900)
+    set(COMPILER_PREFIX "vc14")
+  endif ()
+
+  # for each prefix path, add ia32/64\${COMPILER_PREFIX}\lib to the lib search path
+  foreach (dir ${TBB_PREFIX_PATH})
+    if (CMAKE_CL_64)
+      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia64/${COMPILER_PREFIX}/lib)
+      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia64/${COMPILER_PREFIX})
+      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/${COMPILER_PREFIX}/lib)
+      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64/${COMPILER_PREFIX})
+    else ()
+      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/${COMPILER_PREFIX}/lib)
+      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32/${COMPILER_PREFIX})
+    endif ()
+  endforeach ()
 endif ()

-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")
-        else ()
-            set(_TBB_COMPILER ${TBB_COMPILER})
-        endif()
-        if(NOT TBB_ARCHITECTURE)
-            set(_TBB_ARCHITECTURE "ia32")
-        else()
-            set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
-        endif()
-    else ()
-        # 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 ()
+foreach (dir ${TBB_PREFIX_PATH})
+  list(APPEND TBB_LIB_SEARCH_PATH ${dir}/${TBB_ARCH_PLATFORM}/lib)
+  list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/${TBB_ARCH_PLATFORM})
+  list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib)
+endforeach ()
+
+
+set(TBB_LIBRARY_NAMES tbb)
+get_debug_names(TBB_LIBRARY_NAMES)
+
+
+find_path(TBB_INCLUDE_DIR
+          NAMES tbb/tbb.h
+          PATHS ${TBB_INC_SEARCH_PATH})
+
+find_library(TBB_LIBRARY_RELEASE
+             NAMES ${TBB_LIBRARY_NAMES}
+             PATHS ${TBB_LIB_SEARCH_PATH})
+find_library(TBB_LIBRARY_DEBUG
+             NAMES ${TBB_LIBRARY_NAMES_DEBUG}
+             PATHS ${TBB_LIB_SEARCH_PATH})
+make_library_set(TBB_LIBRARY)
+
+findpkg_finish(TBB)
+
+#if we haven't found TBB no point on going any further
+if (NOT TBB_FOUND)
+  return()
 endif ()

-if (CMAKE_SYSTEM MATCHES "SunOS.*")
-# SUN
-# not yet supported
-# has em64t/cc3.4.3_kernel5.10
-# has ia32/*
-endif ()
-
-
-#-- Clear the public variables
-set (TBB_FOUND "NO")
-
-
-#-- Find TBB install dir and set ${_TBB_INSTALL_DIR} and cached ${TBB_INSTALL_DIR}
-# first: use CMake variable TBB_INSTALL_DIR
-if (TBB_INSTALL_DIR)
-    set (_TBB_INSTALL_DIR ${TBB_INSTALL_DIR})
-endif ()
-# 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 ()
-    # Intel recommends setting TBB21_INSTALL_DIR
-    if (NOT "$ENV{TBB21_INSTALL_DIR}" STREQUAL "")
-        set (_TBB_INSTALL_DIR $ENV{TBB21_INSTALL_DIR})
-    endif ()
-    if (NOT "$ENV{TBB22_INSTALL_DIR}" STREQUAL "")
-        set (_TBB_INSTALL_DIR $ENV{TBB22_INSTALL_DIR})
-    endif ()
-    if (NOT "$ENV{TBB30_INSTALL_DIR}" STREQUAL "")
-        set (_TBB_INSTALL_DIR $ENV{TBB30_INSTALL_DIR})
-    endif ()
-endif ()
-# 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 ()
-endif ()
-# sanity check
-if (NOT _TBB_INSTALL_DIR)
-    message ("ERROR: Unable to find Intel TBB install directory. ${_TBB_INSTALL_DIR}")
-else ()
-# 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 ()
-
-
-#-- 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 ()
-    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()
-
-
-#-- 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 ()
-# 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 ()
-
-# GvdB: Mac OS X distribution places libraries directly in lib directory.
-list(APPEND _TBB_LIBRARY_DIR ${_TBB_INSTALL_DIR}/lib)
-
-# Jiri: No reason not to check the default paths. From recent versions,
-#       tbbvars has started exporting the LIBRARY_PATH and LD_LIBRARY_PATH
-#       variables, which now point to the directories of the lib files.
-#       It all makes more sense to use the ${_TBB_LIBRARY_DIR} as a HINTS
-#       argument instead of the implicit PATHS as it isn't hard-coded
-#       but computed by system introspection. Searching the LIBRARY_PATH
-#       and LD_LIBRARY_PATH environment variables is now even more important
-#       that tbbvars doesn't export TBB_ARCH_PLATFORM and it facilitates
-#       the use of TBB built from sources.
-find_library(TBB_LIBRARY ${_TBB_LIB_NAME} HINTS ${_TBB_LIBRARY_DIR}
-        PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
-find_library(TBB_MALLOC_LIBRARY ${_TBB_LIB_MALLOC_NAME} HINTS ${_TBB_LIBRARY_DIR}
-        PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
-
-#Extract path from TBB_LIBRARY name
-get_filename_component(TBB_LIBRARY_DIR ${TBB_LIBRARY} PATH)
-
-#TBB_CORRECT_LIB_DIR(TBB_LIBRARY)
-#TBB_CORRECT_LIB_DIR(TBB_MALLOC_LIBRARY)
-mark_as_advanced(TBB_LIBRARY TBB_MALLOC_LIBRARY)
-
-#-- Look for debug libraries
-# Jiri: Changed the same way as for the release libraries.
-find_library(TBB_LIBRARY_DEBUG ${_TBB_LIB_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
-        PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
-find_library(TBB_MALLOC_LIBRARY_DEBUG ${_TBB_LIB_MALLOC_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
-        PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
-
-# Jiri: Self-built TBB stores the debug libraries in a separate directory.
-#       Extract path from TBB_LIBRARY_DEBUG name
-get_filename_component(TBB_LIBRARY_DEBUG_DIR ${TBB_LIBRARY_DEBUG} PATH)
-
-#TBB_CORRECT_LIB_DIR(TBB_LIBRARY_DEBUG)
-#TBB_CORRECT_LIB_DIR(TBB_MALLOC_LIBRARY_DEBUG)
-mark_as_advanced(TBB_LIBRARY_DEBUG TBB_MALLOC_LIBRARY_DEBUG)
-
-
-if (TBB_INCLUDE_DIR)
-    if (TBB_LIBRARY)
-        set (TBB_FOUND "YES")
-        set (TBB_LIBRARIES ${TBB_LIBRARY} ${TBB_MALLOC_LIBRARY} ${TBB_LIBRARIES})
-        set (TBB_DEBUG_LIBRARIES ${TBB_LIBRARY_DEBUG} ${TBB_MALLOC_LIBRARY_DEBUG} ${TBB_DEBUG_LIBRARIES})
-        set (TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR} CACHE PATH "TBB include directory" FORCE)
-        set (TBB_LIBRARY_DIRS ${TBB_LIBRARY_DIR} CACHE PATH "TBB library directory" FORCE)
-        # Jiri: Self-built TBB stores the debug libraries in a separate directory.
-        set (TBB_DEBUG_LIBRARY_DIRS ${TBB_LIBRARY_DEBUG_DIR} CACHE PATH "TBB debug library directory" FORCE)
-        mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARY_DIRS TBB_DEBUG_LIBRARY_DIRS TBB_LIBRARIES TBB_DEBUG_LIBRARIES)
-        message(STATUS "Found Intel TBB")
-    endif ()
-endif ()
-
-if (NOT TBB_FOUND)
-    message("ERROR: Intel TBB NOT found!")
-    message(STATUS "Looked for Threading Building Blocks in ${_TBB_INSTALL_DIR}")
-    # do only throw fatal, if this pkg is REQUIRED
-    if (TBB_FIND_REQUIRED)
-        message(FATAL_ERROR "Could NOT find TBB library.")
-    endif ()
-endif ()
-
-endif ()
-
-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 ()
+#=============================================================================
+# Look for TBB's malloc package
+set(TBB_MALLOC_LIBRARY_NAMES tbbmalloc)
+get_debug_names(TBB_MALLOC_LIBRARY_NAMES)
+
+find_path(TBB_MALLOC_INCLUDE_DIR
+          NAMES tbb/tbb.h
+          PATHS ${TBB_INC_SEARCH_PATH})
+
+find_library(TBB_MALLOC_LIBRARY_RELEASE
+             NAMES ${TBB_MALLOC_LIBRARY_NAMES}
+             PATHS ${TBB_LIB_SEARCH_PATH})
+find_library(TBB_MALLOC_LIBRARY_DEBUG
+             NAMES ${TBB_MALLOC_LIBRARY_NAMES_DEBUG}
+             PATHS ${TBB_LIB_SEARCH_PATH})
+make_library_set(TBB_MALLOC_LIBRARY)
+
+findpkg_finish(TBB_MALLOC)
+
+#=============================================================================
+# Look for TBB's malloc proxy package
+set(TBB_MALLOC_PROXY_LIBRARY_NAMES tbbmalloc_proxy)
+get_debug_names(TBB_MALLOC_PROXY_LIBRARY_NAMES)
+
+find_path(TBB_MALLOC_PROXY_INCLUDE_DIR
+          NAMES tbb/tbbmalloc_proxy.h
+          PATHS ${TBB_INC_SEARCH_PATH})
+
+find_library(TBB_MALLOC_PROXY_LIBRARY_RELEASE
+             NAMES ${TBB_MALLOC_PROXY_LIBRARY_NAMES}
+             PATHS ${TBB_LIB_SEARCH_PATH})
+find_library(TBB_MALLOC_PROXY_LIBRARY_DEBUG
+             NAMES ${TBB_MALLOC_PROXY_LIBRARY_NAMES_DEBUG}
+             PATHS ${TBB_LIB_SEARCH_PATH})
+make_library_set(TBB_MALLOC_PROXY_LIBRARY)
+
+findpkg_finish(TBB_MALLOC_PROXY)
+
+
+#=============================================================================
+#parse all the version numbers from tbb
+if(NOT TBB_VERSION)
+
+ #only read the start of the file
+ 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}")
+
+endif()


px4_fmuv5_stackcheck:Remove bl_update to fit

--- boards/px4/fmu-v5/stackcheck.cmake
+++ boards/px4/fmu-v5/stackcheck.cmake
@@ -84,7 +84,7 @@
 		airspeed_selector

 	SYSTEMCMDS
-		bl_update
+		#bl_update
 		config
 		dmesg
 		dumpfile


install script path

install script path

--- CMake/mitkMacroInstallPython.cmake
+++ CMake/mitkMacroInstallPython.cmake
@@ -105,8 +105,8 @@
   endif()

   if(Numpy_DIR)
-    install(DIRECTORY "${Numpy_DIR}"
-            DESTINATION bin/Python/numpy
+    install(DIRECTORY "${Numpy_DIR}/numpy"
+            DESTINATION bin/Python
             USE_SOURCE_PERMISSIONS
             COMPONENT Runtime)
   endif()


Continuing work on CHOP-609 build time improvements.  Fixed eroneous additional_INCLUDE_DIRS setting for unit tests.

--- indra/cmake/LLAddBuildTest.cmake
+++ indra/cmake/LLAddBuildTest.cmake
@@ -95,7 +95,7 @@
     IF(${name}_test_additional_INCLUDE_DIRS MATCHES NOTFOUND)
       SET(${name}_test_additional_INCLUDE_DIRS "")
     ENDIF(${name}_test_additional_INCLUDE_DIRS MATCHES NOTFOUND)
-    INCLUDE_DIRECTORIES(${alltest_INCLUDE_DIRS} ${name}_test_additional_INCLUDE_DIRS )
+    INCLUDE_DIRECTORIES(${alltest_INCLUDE_DIRS} ${${name}_test_additional_INCLUDE_DIRS} )
     IF(LL_TEST_VERBOSE)
       MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_INCLUDE_DIRS ${${name}_test_additional_INCLUDE_DIRS}")
     ENDIF(LL_TEST_VERBOSE)


RunBuildTest.cmake definitely needs the separate_arguments() command, else when you pass in a command string with command-line arguments, RunBuildTest.cmake attempts to search for a program whose filename is the entire command line. Uncommented separate_arguments(). Added SHARED_LIB_STAGING_DIR to LL_ADD_INTEGRATION_TEST LD_LIBRARY_PATH.

--- indra/cmake/LLAddBuildTest.cmake
+++ indra/cmake/LLAddBuildTest.cmake
@@ -210,9 +210,15 @@
     LIST(INSERT test_command test_exe_pos "${TEST_EXE}")
   ENDIF (test_exe_pos LESS 0)

+  IF(WINDOWS)
+    set(LD_LIBRARY_PATH ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR})
+  ELSE(WINDOWS)
+    set(LD_LIBRARY_PATH ${ARCH_PREBUILT_DIRS}:${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}:/usr/lib)
+  ENDIF(WINDOWS)
+
   SET(TEST_SCRIPT_CMD
     ${CMAKE_COMMAND}
-    -DLD_LIBRARY_PATH=${ARCH_PREBUILT_DIRS}:/usr/lib
+    -DLD_LIBRARY_PATH="${LD_LIBRARY_PATH}"
     -DTEST_CMD:STRING="${test_command}"
     -P ${CMAKE_SOURCE_DIR}/cmake/RunBuildTest.cmake
     )


Old cosmetic mods

Old cosmetic mods

--- cmake/FindLibUBE.cmake
+++ cmake/FindLibUBE.cmake
@@ -1,22 +1,14 @@
 #
-# Copyright 2013 by Idiap Research Institute, http://www.idiap.ch
+# Written by cfind.sh
+# Part of lube, https://github.com/pgarner/libube
+# See also https://cmake.org/Wiki/CMake:How_To_Find_Libraries
 #
-# See the file COPYING for the licence associated with this software.
+# The following should end up defined:
+#  LIBUBE_FOUND          - System has LibUBE
+#  LIBUBE_INCLUDE_DIR    - The LibUBE include directories
+#  LIBUBE_LIBRARIES      - The libraries needed to use LibUBE
+#  LIBUBE_DEFINITIONS    - Compiler switches required for using LibUBE
 #
-# Author(s):
-#   Phil Garner, December 2013
-#
-
-#
-# Try to find LibUBE; see
-#  https://cmake.org/Wiki/CMake:How_To_Find_Libraries
-# Once done this will define
-#  LIBUBE_FOUND          - System has libube
-#  LIBUBE_INCLUDE_DIRS   - The libube include directory
-#  LIBUBE_LIBRARIES      - The libraries needed to use Libube
-#  LIBUBE_DEFINITIONS    - Compiler switches required for using libube
-#
-
 find_package(PkgConfig)
 pkg_check_modules(PC_LIBUBE QUIET libube)

@@ -29,7 +21,7 @@
 )

 find_library(
-  LIBUBE_LIBRARY ube
+  LIBUBE_LIBRARY ube  # Without the lib- prefix
   HINTS ${PC_LIBUBE_LIBDIR} ${PC_LIBUBE_LIBRARY_DIRS}
 )


Update create_package

Update create_package

--- CreatePackage.cmake
+++ CreatePackage.cmake
@@ -32,7 +32,7 @@

 	message(STATUS "Creating package config file ${CREATE_PACKAGE_TARGET}.pc")

-	configure_file("${CMAKE_SOURCE_DIR}/cmake/pkg-config.pc.in" "${CREATE_PACKAGE_OUTPUT_DIR}/${CREATE_PACKAGE_TARGET}.pc" @ONLY)
+	configure_file("${PROJECT_SOURCE_DIR}/cmake/pkg-config.pc.in" "${CREATE_PACKAGE_OUTPUT_DIR}/${CREATE_PACKAGE_TARGET}.pc" @ONLY)

 	install(FILES "${CREATE_PACKAGE_OUTPUT_DIR}/${CREATE_PACKAGE_TARGET}.pc" DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig")


fixed potential issues with ARM compilation under Linux

--- common/cmake/gnu.cmake
+++ common/cmake/gnu.cmake
@@ -8,7 +8,10 @@
 ENDMACRO()

 IF (EMBREE_ARM)
-  # No thing to declare.
+  SET(FLAGS_SSE2 "-D__SSE__ -D__SSE2__")
+  SET(FLAGS_SSE42 "-D__SSE4_2__  -D__SSE4_1__")
+  SET(FLAGS_AVX "-D__AVX__ -D__SSE4_2__  -D__SSE4_1__  -D__BMI__ -D__BMI2__ -D__LZCNT__")
+  SET(FLAGS_AVX2 "-D__AVX2__ -D__AVX__ -D__SSE4_2__  -D__SSE4_1__  -D__BMI__ -D__BMI2__ -D__LZCNT__")
 ELSE ()
   _SET_IF_EMPTY(FLAGS_SSE2  "-msse2")
   _SET_IF_EMPTY(FLAGS_SSE42 "-msse4.2")
@@ -17,7 +20,7 @@
   _SET_IF_EMPTY(FLAGS_AVX512 "-mavx512f -mavx512dq -mavx512cd -mavx512bw -mavx512vl -mf16c -mavx2 -mfma -mlzcnt -mbmi -mbmi2 -mprefer-vector-width=256")
 ENDIF ()

-OPTION(EMBREE_IGNORE_CMAKE_CXX_FLAGS "When enabled Embree ignores default CMAKE_CXX_FLAGS." OFF)
+OPTION(EMBREE_IGNORE_CMAKE_CXX_FLAGS "When enabled Embree ignores default CMAKE_CXX_FLAGS." ON)
 IF (EMBREE_IGNORE_CMAKE_CXX_FLAGS)
   SET(CMAKE_CXX_FLAGS "")
 ENDIF()


COMP: Fix referenced ITK version to v5.1rc02

--- Superbuild/External-ITK.cmake
+++ Superbuild/External-ITK.cmake
@@ -2,7 +2,7 @@
 # Get and build itk

 if(NOT ITK_TAG)
-  set(ITK_TAG "ddbaeae13c1711fcb3010b6e81b108cb10677875")
+  set(ITK_TAG "v5.1rc02")
 endif()

 set(_vtk_args)


choose FastRTPS as the default if available

--- rmw_implementation_cmake/cmake/get_default_rmw_implementation.cmake
+++ rmw_implementation_cmake/cmake/get_default_rmw_implementation.cmake
@@ -32,8 +32,15 @@
   if("${RMW_IMPLEMENTATION}" STREQUAL "" AND
     "$ENV{RMW_IMPLEMENTATION}" STREQUAL ""
   )
-    # TODO detemine "default" implementation based on the available ones
-    list(GET _middleware_implementations 0 _middleware_implementation)
+    # prefer FastRTPS, otherwise first in alphabetical order
+    # the same logic is implemented in
+    # rclpy.impl.rmw_implementation_tools.import_rmw_implementation()
+    list(FIND _middleware_implementations "rmw_fastrtps_cpp" _index)
+    if(NOT _index EQUAL -1)
+      list(GET _middleware_implementations ${_index} _middleware_implementation)
+    else()
+      list(GET _middleware_implementations 0 _middleware_implementation)
+    endif()
   else()
     if(NOT "${RMW_IMPLEMENTATION}" STREQUAL "")
       set(_middleware_implementation "${RMW_IMPLEMENTATION}")


modules: updated FindGLFW.cmake.

modules: updated FindGLFW.cmake.

--- modules/FindGLFW.cmake
+++ modules/FindGLFW.cmake
@@ -43,11 +43,17 @@
 #   DEALINGS IN THE SOFTWARE.
 #

-# GLFW installs cmake package config files to shared/ folder which handles
-# dependencies in case GLFW is built statically. Try to find first, quietly, so
-# it doesn't print loud messages when it's not found, since that's okay.
-find_package(glfw3 CONFIG QUIET)
+# GLFW installs cmake package config files which handles dependencies in case
+# GLFW is built statically. Try to find first, quietly, so it doesn't print
+# loud messages when it's not found, since that's okay. If the glfw target
+# already exists, it means we're using it through a CMake subproject -- don't
+# attempt to find the package in that case.
+if(NOT TARGET glfw)
+    find_package(glfw3 CONFIG QUIET)
+endif()

+# If either a glfw config file was found or we have a subproject, point
+# GLFW::GLFW to that and exit -- nothing else to do here.
 if(TARGET glfw)
     if(NOT TARGET GLFW::GLFW)
         # Aliases of (global) targets are only supported in CMake 3.11, so we


[cmake] Set cram shell to use sh on mingw builds

--- .cmake/Modules/Cram.cmake
+++ .cmake/Modules/Cram.cmake
@@ -30,7 +30,23 @@
 set(ENV{CRITERION_JOBS} "1")
 set(ENV{CRITERION_DISABLE_TIME_MEASUREMENTS} "1")

-execute_process (COMMAND python -m cram -v "${CRAM_PATH}" TIMEOUT 60 RESULT_VARIABLE RES)
+if (WIN32)
+  if (NOT ENV{MINGW})
+    set (MINGW_HOME "C:/MinGW")
+  else ()
+    file (TO_CMAKE_PATH "$ENV{MINGW}" MINGW_HOME)
+  endif ()
+  if (NOT ENV{CRAM_SHELL} AND MINGW_HOME)
+    set (CRAM_SHELL "${MINGW_HOME}/msys/1.0/bin/sh.exe")
+  else ()
+    file (TO_CMAKE_PATH "$ENV{CRAM_SHELL}" CRAM_SHELL)
+  endif ()
+  if (CRAM_SHELL)
+    set(CRAM_OPTS "--shell=${CRAM_SHELL}")
+  endif ()
+endif ()
+
+execute_process (COMMAND python -m cram -v ${CRAM_OPTS} "${CRAM_PATH}" TIMEOUT 60 RESULT_VARIABLE RES)

 if (NOT RES STREQUAL "0")
   message (FATAL_ERROR "Cram tests failed")


Added libraries and includes to CMake macro_build_info

--- cmake/Modules/MacroBuildInfo.cmake
+++ cmake/Modules/MacroBuildInfo.cmake
@@ -1,5 +1,15 @@
 # Display build information

 macro(MACRO_BUILD_INFO)
-    message(STATUS "  Build Type: ${CMAKE_BUILD_TYPE}")
+    message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}")
+
+    message(STATUS "Includes:")
+    foreach(inc ${includes})
+        message("     ${inc}")
+    endforeach()
+
+    message(STATUS "Libraries:")
+    foreach(lib ${libraries})
+        message("     ${lib}")
+    endforeach()
 endmacro()


refs #6198 install jemalloc so mongo can use it (and eventually mysql too)

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

--- cmake_modules/TokuThirdParty.cmake
+++ cmake_modules/TokuThirdParty.cmake
@@ -24,6 +24,15 @@
 set_target_properties(jemalloc PROPERTIES IMPORTED_LOCATION
   "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/jemalloc/lib/libjemalloc_pic.a")
 add_dependencies(jemalloc build_jemalloc)
+add_library(jemalloc_nopic STATIC IMPORTED)
+set_target_properties(jemalloc_nopic PROPERTIES IMPORTED_LOCATION
+  "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/jemalloc/lib/libjemalloc.a")
+add_dependencies(jemalloc_nopic build_jemalloc)
+
+install(
+  DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/jemalloc/lib"
+  DESTINATION .
+  )

 ## add lzma with an external project
 set(xz_configure_opts --with-pic --enable-static)


refs #6566 Move xz sources into (tokudb)/third_party/ in preparation for git move

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

--- cmake_modules/TokuThirdParty.cmake
+++ cmake_modules/TokuThirdParty.cmake
@@ -46,9 +46,9 @@
   list(APPEND xz_configure_opts --enable-debug)
 endif ()

-set(XZ_SOURCE_DIR "${TOKU_SVNROOT}/xz-4.999.9beta" CACHE FILEPATH "Where to find sources for xz (lzma).")
+set(XZ_SOURCE_DIR "${TokuDB_SOURCE_DIR}/third_party/xz-4.999.9beta" CACHE FILEPATH "Where to find sources for xz (lzma).")
 if (NOT EXISTS "${XZ_SOURCE_DIR}/configure")
-  message(FATAL_ERROR "Can't find the xz sources.  Please check them out to ${XZ_SOURCE_DIR} or modify TOKU_SVNROOT (${TOKU_SVNROOT}) or XZ_SOURCE_DIR.")
+    message(FATAL_ERROR "Can't find the xz sources.  Please check them out to ${XZ_SOURCE_DIR} or modify TokuDB_SOURCE_DIR (${TokuDB_SOURCE_DIR}) or XZ_SOURCE_DIR.")
 endif ()

 FILE(GLOB XZ_ALL_FILES ${XZ_SOURCE_DIR}/*)


Small changes in BALLConfigBoost.cmake

Small changes in BALLConfigBoost.cmake

--- cmake/BALLConfigBoost.cmake
+++ cmake/BALLConfigBoost.cmake
@@ -1,7 +1,7 @@
 # Find and configure Boost library

 # Mandatory boost components
-SET(BALL_BOOST_COMPONENTS_MANDATORY
+SET(BALL_BOOST_COMPONENTS
 	bzip2
 	chrono
 	date_time
@@ -13,11 +13,8 @@
 	zlib
 )

-# Add optional boost components
-SET(BALL_BOOST_COMPONENTS ${BALL_BOOST_COMPONENTS_MANDATORY} regex)
-
 # Additional Boost versions that should be included by CMake
-# CMake 2.8.12, which is minimum for BALL, already knowns versions 1.33 up to 1.56
+# CMake 2.8.12, which is minimum for configuring BALL, already knowns versions 1.33 up to 1.56
 SET(Boost_ADDITIONAL_VERSIONS "1.60" "1.59" "1.58" "1.57")

 # Detailed messaging in case of failures
@@ -26,6 +23,7 @@
 # Invoke CMake FindBoost module
 FIND_PACKAGE(Boost 1.55 REQUIRED COMPONENTS ${BALL_BOOST_COMPONENTS})

+# Required definitions on Windows machines
 IF(WIN32)
 	ADD_DEFINITIONS(-DBOOST_ALL_NO_LIB)
 	ADD_DEFINITIONS(-DBOOST_ALL_DYN_LINK)


Fix the cmake MKL module for MacOS.

Fix the cmake MKL module for MacOS.

--- cmake/Modules/FindMKL.cmake
+++ cmake/Modules/FindMKL.cmake
@@ -44,17 +44,31 @@
         set(CMAKE_FIND_LIBRARY_SUFFIXES _dll.lib)
     endif()
 else()
-    if(MKL_STATAIC)
-        set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
+    if(APPLE)
+        if(MKL_STATAIC)
+            set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
+        else()
+            set(CMAKE_FIND_LIBRARY_SUFFIXES .dylib)
+        endif()
     else()
-        set(CMAKE_FIND_LIBRARY_SUFFIXES .so)
+        if(MKL_STATAIC)
+            set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
+        else()
+            set(CMAKE_FIND_LIBRARY_SUFFIXES .so)
+        endif()
     endif()
 endif()

 # MKL is composed by four layers: Interface, Threading, Computational and RTL
-set(MKL_LIBRARIES_PATH
-    # ${MKL_ROOT}/lib/ia32/
-    ${MKL_ROOT}/lib/intel64/)
+if(APPLE)
+    set(MKL_LIBRARIES_PATH
+        # ${MKL_ROOT}/lib/ia32/
+        ${MKL_ROOT}/lib/)
+else()
+    set(MKL_LIBRARIES_PATH
+        # ${MKL_ROOT}/lib/ia32/
+        ${MKL_ROOT}/lib/intel64/)
+endif()

 set(INTEL_LIBRARIES_PATH
     # ${INTEL_ROOT}/lib/ia32/


Squashed '3rdparty/github/cmake-utils/' changes from f79f3e62..b9337ca3

b9337ca3 Fix a FIXME_CMAKE_SINGLETON

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

--- cmake/MyPackageRepair.cmake
+++ cmake/MyPackageRepair.cmake
@@ -9,6 +9,8 @@
     GET_FILENAME_COMPONENT(FIXME_CMAKE_ABSOLUTE ${FIXME_CMAKE} ABSOLUTE)
     FILE(WRITE ${FIXME_CMAKE} "# CMake settings to be propagated whenever you want - typically used for ExternalProject_Add\n")
     MARK_AS_ADVANCED (FIXME_CMAKE_ABSOLUTE)
+    SET (FIXME_CMAKE_SINGLETON TRUE CACHE BOOL "__fixme__.cmake singleton")
+    MARK_AS_ADVANCED (FIXME_CMAKE_SINGLETON)
   ENDIF ()
   IF (NOT HAVE_STDINT_H)
     GET_PROPERTY(source_dir_set GLOBAL PROPERTY MYPACKAGE_SOURCE_DIR SET)
@@ -23,7 +25,7 @@
         CONFIGURE_FILE(${source_dir}/stdint.h.in ${MYPACKAGE_GENERATED_INCLUDE_DIR}/stdint.h)
         GET_FILENAME_COMPONENT(_MYPACKAGE_GENERATED_INCLUDE_DIR_ABSOLUTE ${MYPACKAGE_GENERATED_INCLUDE_DIR} ABSOLUTE)
         INCLUDE_DIRECTORIES(${_MYPACKAGE_GENERATED_INCLUDE_DIR_ABSOLUTE})
-        MESSAGE(STATUS "Appending for ${FIXME_CMAKE}: INCLUDE_DIRECTORIES(${_MYPACKAGE_GENERATED_INCLUDE_DIR_ABSOLUTE})")
+        MESSAGE(STATUS "Appending in ${FIXME_CMAKE}: INCLUDE_DIRECTORIES(${_MYPACKAGE_GENERATED_INCLUDE_DIR_ABSOLUTE})")
         FILE(APPEND ${FIXME_CMAKE} "INCLUDE_DIRECTORIES(${_MYPACKAGE_GENERATED_INCLUDE_DIR_ABSOLUTE})\n")
       ENDIF ()
       SET (STDINT_H_SINGLETON TRUE CACHE BOOL "C stdint.h repair singleton")


Update for C++14, C++17

Update for C++14, C++17

--- cmake/compiler_option.cmake
+++ cmake/compiler_option.cmake
@@ -1,4 +1,3 @@
-
 INCLUDE( CMakeParseArguments )
 INCLUDE( cmake_lib_utils )

@@ -14,20 +13,31 @@

   IF( CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" )
     # ref: http://msdn.microsoft.com/en-us/library/hh567368.aspx#corelanguagetable
-    IF( MSVC_VERSION LESS 1700 )
-      MESSAGE( SEND_ERROR "Visual Studio version is too low to use C++11 standard" )
+    IF( _CPP_STD_VERSION STREQUAL 11 )
+      IF( MSVC_VERSION LESS 1700 )
+        MESSAGE( SEND_ERROR "Visual Studio version is too low to use C++11 standard" )
+      ENDIF(  )
+    ELSEIF( _CPP_STD_VERSION STREQUAL 14 OR _CPP_STD_VERSION STREQUAL 17 )
+      IF( MSVC_VERSION LESS 1900 )
+        MESSAGE( SEND_ERROR "Visual Studio version is too low to use C++14/C++17 standard" )
+      ENDIF(  )
     ENDIF(  )
   ELSEIF( CMAKE_CXX_COMPILER_ID STREQUAL "Clang" )
     # ref: http://clang.llvm.org/cxx_status.html
-    IF( CMAKE_CXX_COMPILER_VERSION VERSION_LESS 2.9.0 )
-      MESSAGE( SEND_ERROR "Clang version is too low to use C++11 standard features : Clang(${CMAKE_CXX_COMPILER_VERSION})" )
-    ENDIF(  )
-
     IF( _CPP_STD_VERSION STREQUAL 11 )
+      IF( CMAKE_CXX_COMPILER_VERSION VERSION_LESS 2.9.0 )
+        MESSAGE( SEND_ERROR "Clang version is too low to use C++11 standard features : Clang(${CMAKE_CXX_COMPILER_VERSION})" )
+      ENDIF(  )
       SET( STD_CODE "c++11" )
     ELSEIF( _CPP_STD_VERSION STREQUAL 14 )
+      IF( CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4.0 )
+        MESSAGE( SEND_ERROR "Clang version is too low to use C++14 standard features : Clang(${CMAKE_CXX_COMPILER_VERSION})" )
+      ENDIF(  )
       SET( STD_CODE "c++1y" )
     ELSEIF( _CPP_STD_VERSION STREQUAL 17 )
+      IF( CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5.0 )
+        MESSAGE( SEND_ERROR "Clang version is too low to use C++17 standard features : Clang(${CMAKE_CXX_COMPILER_VERSION})" )
+      ENDIF(  )
       SET( STD_CODE "c++1z" )
     ENDIF()

@@ -45,14 +55,26 @@
     ENDIF(  )
   ELSEIF( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
     # ref: https://gcc.gnu.org/projects/cxx0x.html
-    IF( CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.3 )
-      MESSAGE( SEND_ERROR "GCC version is too low to use C++11 standard features : GCC(${CMAKE_CXX_COMPILER_VERSION})" )
-    ELSEIF( CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.7 )
-      SET( _CPP_STD_CODE "c++11" )
-    ELSE(  )
-      SET( _CPP_STD_CODE "c++0x" )
-    ENDIF(  )
+    IF( _CPP_STD_VERSION STREQUAL 11 )
+      IF( CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.3.0 )
+        MESSAGE( SEND_ERROR "GCC version is too low to use C++11 standard features : GCC(${CMAKE_CXX_COMPILER_VERSION})" )
+      ELSEIF( CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.7 )
+        SET( STD_CODE "c++11" )
+      ELSE(  )
+        SET( STD_CODE "c++0x" )
+      ENDIF(  )
+    ELSEIF( _CPP_STD_VERSION STREQUAL 14 )
+      IF( CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9.0 )
+        MESSAGE( SEND_ERROR "GCC version is too low to use C++14 standard features : Clang(${CMAKE_CXX_COMPILER_VERSION})" )
+      ENDIF(  )
+      SET( STD_CODE "c++14" )
+    ELSEIF( _CPP_STD_VERSION STREQUAL 17 )
+      IF( CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1.0 )
+        MESSAGE( SEND_ERROR "GCC version is too low to use C++17 standard features : Clang(${CMAKE_CXX_COMPILER_VERSION})" )
+      ENDIF(  )
+      SET( STD_CODE "c++1z" )
+    ENDIF()

-    SET_PROPERTY( ${_CPP_STD_MODE} ${_CPP_STD_TARGET} APPEND_STRING PROPERTY COMPILE_FLAGS " -std=${_CPP_STD_CODE}" )
+    SET_PROPERTY( ${_CPP_STD_MODE} ${_CPP_STD_TARGET} APPEND_STRING PROPERTY COMPILE_FLAGS " -std=${STD_CODE}" )
   ENDIF(  )
 ENDFUNCTION( SET_CPP_STD )


BUG: ResampleDTIlogEuclidean depends on SlicerExecutionModel

ResampleDTIlogEuclidean target was not specifying that ResampleDTIlogEuclidean needed SlicerExecutionModel to be built before ResampleDTIlogEuclidean. ResampleDTIlogEuclidean required GenerateCLP, and therefore required SlicerExecutionModel to be built before ResampleDTIlogEuclidean.

--- SuperBuild/FindExternalTools.cmake
+++ SuperBuild/FindExternalTools.cmake
@@ -498,7 +498,7 @@
   -DBUILD_GENERATECLP:BOOL=OFF
   -DITK_DIR:PATH=${ITK_DIR}
   -DGenerateCLP_DIR:PATH=${GenerateCLP_DIR}
-  DEPENDS ${ITK_DEPEND}
+  DEPENDS ${ITK_DEPEND} ${SlicerExecutionModel_DEPEND}
   )
 set( Tools
   ResampleDTIlogEuclidean


CMake: copy Gruntfile.js file to js folder if it exists

Change-Id: Ib086b95af862b59f9d71cded9fed250568f2c586

--- CMake/CodeGenerator.cmake
+++ CMake/CodeGenerator.cmake
@@ -792,6 +792,13 @@
       message (WARNING "LICENSE file on project root directory is missing")
     endif()

+    if (EXISTS ${PARAM_MODELS}/Gruntfile.js)
+      file (READ ${PARAM_MODELS}/Gruntfile.js GRUNTFILE)
+      file (WRITE ${CMAKE_BINARY_DIR}/js/Gruntfile.js ${GRUNTFILE})
+    else()
+      message (WARNING "Gruntfile.js file on ${PARAM_MODELS} is missing")
+    endif()
+
     if (${Npm_FOUND})
       add_custom_target(js
         COMMAND ${Npm_EXECUTABLE} pack


ENH: improve WrapperMacros and prepare for being used externally

--- CMake/WrapperMacros.cmake
+++ CMake/WrapperMacros.cmake
@@ -3,23 +3,36 @@
 macro(OTB_CREATE_APPLICATION)
   PARSE_ARGUMENTS(
       APPLICATION
-      "NAME;SOURCES;INCLUDE_DIRS;LINK_LIBRARIES"
+      "NAME;SOURCES;INCLUDE_DIRS;LINK_LIBRARIES;INSTALL_PATH"
       ""
       ${ARGN})

    set( APPLICATION_TARGET_NAME otbapp_${APPLICATION_NAME} )

-   include_directories(${CMAKE_SOURCE_DIR}/Code/Core ${CMAKE_SOURCE_DIR}/Code/Common )
+   # Build the library as a MODULE (shared lib even if OTB is built statically)
    include_directories(${APPLICATION_INCLUDE_DIRS})
    add_library(${APPLICATION_TARGET_NAME} MODULE ${APPLICATION_SOURCES})
    target_link_libraries(${APPLICATION_TARGET_NAME} OTBApplicationEngine ${APPLICATION_LINK_LIBRARIES})
+
+   # Remove the usual 'lib' prefix to make it clear it is a plugin
+   # and not a library to link against
    set_target_properties(${APPLICATION_TARGET_NAME} PROPERTIES PREFIX "")

+   # on Apple platform, a "MODULE" library gets a ".so" extension
+   # but the ITK factory mechanism looks for ".dylib"
    if (APPLE)
      set_target_properties(${APPLICATION_TARGET_NAME} PROPERTIES SUFFIX ".dylib")
    endif()

-   install(TARGETS ${APPLICATION_TARGET_NAME}
-           LIBRARY DESTINATION ${OTB_INSTALL_APP_DIR_CM24})
-
+   # When called from the OTB build system, use OTB_INSTALL_APP_DIR_CM24
+   if (NOT APPLICATION_INSTALL_PATH AND OTB_INSTALL_APP_DIR_CM24)
+     set(APPLICATION_INSTALL_PATH ${OTB_INSTALL_APP_DIR_CM24})
+   endif()
+
+   # Install only if a path has been provided
+   if (APPLICATION_INSTALL_PATH)
+     install(TARGETS ${APPLICATION_TARGET_NAME}
+             LIBRARY DESTINATION ${APPLICATION_INSTALL_PATH})
+   endif()
+
 endmacro(OTB_CREATE_APPLICATION)


Add back testbinch.

Add back testbinch.

Signed-off-by: Keith Rothman <1bc19627a439baf17510dc2d0b2d250c96d445a5@users.noreply.github.com>

--- make/devices.cmake
+++ make/devices.cmake
@@ -430,7 +430,7 @@

   set(DEVICE_FULL ${DEVICE}-${PACKAGE})
   set(FQDN ${ARCH}-${DEVICE_TYPE}-${DEVICE}-${PACKAGE})
-  set(OUT_LOCAL ${CMAKE_CURRENT_BINARY_DIR}/${NAME}/${FQDN})
+  set(OUT_LOCAL ${CMAKE_CURRENT_BINARY_DIR}/${FQDN})
   set(DIRECTORY_TARGET ${ADD_FPGA_TARGET_NAME}-${FQDN}-make-directory)
   add_custom_target(
     ${DIRECTORY_TARGET} ALL
@@ -606,6 +606,8 @@

   add_custom_target(${NAME}_bit ALL DEPENDS ${OUT_BITSTREAM})

+  # Generate verilog from bitstream
+  # -------------------------------------------------------------------------
   set(OUT_BIT_VERILOG ${OUT_LOCAL}/${TOP}_bit.v)
   get_target_property_required(BIT_TO_V ${ARCH} BIT_TO_V)
   get_target_property_required(BIT_TO_V_CMD ${ARCH} BIT_TO_V_CMD)
@@ -613,21 +615,29 @@
   separate_arguments(
     BIT_TO_V_CMD_FOR_TARGET_LIST UNIX_COMMAND ${BIT_TO_V_CMD_FOR_TARGET}
   )
+
   add_custom_command(
     OUTPUT ${OUT_BIT_VERILOG}
     COMMAND ${BIT_TO_V_CMD_FOR_TARGET_LIST}
-    DEPENDS ${BIT_TO_V}
+    DEPENDS ${BIT_TO_V} ${OUT_BITSTREAM}
     )

   add_custom_target(${NAME}_bit_v DEPENDS ${OUT_BIT_VERILOG})
-  make_file_target(FILE ${NAME}/${FQDN}/${TOP}_bit.v GENERATED)
-
+  make_file_target(FILE ${FQDN}/${TOP}_bit.v GENERATED)
+
+  # Add test bench targets
+  # -------------------------------------------------------------------------
   foreach(TESTBENCH ${ADD_FPGA_TARGET_TESTBENCH_SOURCES})
     get_filename_component(TESTBENCH_NAME ${TESTBENCH} NAME_WE)
     add_testbench(
       NAME testbench_${TESTBENCH_NAME}
       ARCH ${ARCH}
       SOURCES ${TESTBENCH} ${ADD_FPGA_TARGET_SOURCES}
+      )
+    add_testbench(
+      NAME testbinch_${TESTBENCH_NAME}
+      ARCH ${ARCH}
+      SOURCES ${TESTBENCH} ${FQDN}/${TOP}_bit.v
       )
   endforeach()
 endfunction()


Added hunter_cacheable include.

Added hunter_cacheable include.

--- cmake/projects/SDL2/hunter.cmake
+++ cmake/projects/SDL2/hunter.cmake
@@ -4,6 +4,7 @@
 include(hunter_add_version)
 include(hunter_download)
 include(hunter_pick_scheme)
+include(hunter_cacheable)

 hunter_add_version(
     PACKAGE_NAME


fix ffmpeg lib paths detection in Debian sid

--- cmakemodules/script_ffmpeg.cmake
+++ cmakemodules/script_ffmpeg.cmake
@@ -21,24 +21,38 @@
 		SET(CMAKE_MRPT_HAS_FFMPEG 1)
 		SET(CMAKE_MRPT_HAS_FFMPEG_SYSTEM 1)

-		INCLUDE_DIRECTORIES("${LIBAVCODEC_INCLUDEDIR}/")
-		INCLUDE_DIRECTORIES("${LIBAVCODEC_INCLUDEDIR}/ffmpeg")
-		INCLUDE_DIRECTORIES("${LIBAVCODEC_INCLUDEDIR}/libavcodec")
+		if (NOT "${LIBAVCODEC_INCLUDEDIR}" STREQUAL "")
+			INCLUDE_DIRECTORIES("${LIBAVCODEC_INCLUDEDIR}/")
+			INCLUDE_DIRECTORIES("${LIBAVCODEC_INCLUDEDIR}/ffmpeg")
+			INCLUDE_DIRECTORIES("${LIBAVCODEC_INCLUDEDIR}/libavcodec")

-		INCLUDE_DIRECTORIES("${LIBAVUTIL_INCLUDEDIR}")
+			INCLUDE_DIRECTORIES("${LIBAVUTIL_INCLUDEDIR}")
+		endif()

-		INCLUDE_DIRECTORIES("${LIBAVFORMAT_INCLUDEDIR}")
-		INCLUDE_DIRECTORIES("${LIBAVFORMAT_INCLUDEDIR}/ffmpeg")
-		INCLUDE_DIRECTORIES("${LIBAVFORMAT_INCLUDEDIR}/libavformat")
+		if (NOT "${LIBAVFORMAT_INCLUDEDIR}" STREQUAL "")
+			INCLUDE_DIRECTORIES("${LIBAVFORMAT_INCLUDEDIR}")
+			INCLUDE_DIRECTORIES("${LIBAVFORMAT_INCLUDEDIR}/ffmpeg")
+			INCLUDE_DIRECTORIES("${LIBAVFORMAT_INCLUDEDIR}/libavformat")
+		endif()

-		INCLUDE_DIRECTORIES("${LIBSWSCALE_INCLUDEDIR}")
-		INCLUDE_DIRECTORIES("${LIBSWSCALE_INCLUDEDIR}/ffmpeg")
-		INCLUDE_DIRECTORIES("${LIBSWSCALE_INCLUDEDIR}/libswscale")
+		if (NOT "${LIBSWSCALE_INCLUDEDIR}" STREQUAL "")
+			INCLUDE_DIRECTORIES("${LIBSWSCALE_INCLUDEDIR}")
+			INCLUDE_DIRECTORIES("${LIBSWSCALE_INCLUDEDIR}/ffmpeg")
+			INCLUDE_DIRECTORIES("${LIBSWSCALE_INCLUDEDIR}/libswscale")
+		endif()

-		LINK_DIRECTORIES("${LIBAVCODEC_LIBDIR}")
-		LINK_DIRECTORIES("${LIBAVUTIL_LIBDIR}")
-		LINK_DIRECTORIES("${LIBAVFORMAT_LIBDIR}")
-		LINK_DIRECTORIES("${LIBSWSCALE_LIBDIR}")
+		if (NOT "${LIBAVCODEC_LIBDIR}" STREQUAL "")
+			LINK_DIRECTORIES("${LIBAVCODEC_LIBDIR}")
+		endif()
+		if (NOT "${LIBAVUTIL_LIBDIR}" STREQUAL "")
+			LINK_DIRECTORIES("${LIBAVUTIL_LIBDIR}")
+		endif()
+		if (NOT "${LIBAVFORMAT_LIBDIR}" STREQUAL "")
+			LINK_DIRECTORIES("${LIBAVFORMAT_LIBDIR}")
+		endif()
+		if (NOT "${LIBSWSCALE_LIBDIR}" STREQUAL "")
+			LINK_DIRECTORIES("${LIBSWSCALE_LIBDIR}")
+		endif()

 		SET(MRPT_FFMPEG_LIBS_TO_LINK "${MRPT_FFMPEG_LIBS_TO_LINK}" "${LIBAVCODEC_LIBRARIES}" "${LIBAVFORMAT_LIBRARIES}" "${LIBAVUTIL_LIBRARIES}" "${LIBSWSCALE_LIBRARIES}")


Correct required version downstream find_packages

--- PackageConfig.cmake
+++ PackageConfig.cmake
@@ -49,7 +49,7 @@
   "@DEPENDENTS@"
   "if(NOT _fail)\n"
 # setup VERSION, INCLUDE_DIRS and DEB_DEPENDENCIES
-  "  set(${UPPER_PROJECT_NAME}_VERSION ${VERSION})\n"
+  "  set(${UPPER_PROJECT_NAME}_VERSION ${VERSION_MAJOR}.${VERSION_MINOR})\n"
   "  list(APPEND ${UPPER_PROJECT_NAME}_INCLUDE_DIRS \${${CMAKE_PROJECT_NAME}_PREFIX_DIR}/include)\n"
   "  set(${UPPER_PROJECT_NAME}_DEB_DEPENDENCIES \"${LOWER_PROJECT_NAME}${VERSION_ABI} (>= ${VERSION_MAJOR}.${VERSION_MINOR})\")\n"
   "  set(${UPPER_PROJECT_NAME}_DEB_LIB_DEPENDENCY \"${LOWER_PROJECT_NAME}${VERSION_ABI}-lib (>= ${VERSION_MAJOR}.${VERSION_MINOR})\")\n"


Reset components for subsequent find_package

--- PackageConfig.cmake
+++ PackageConfig.cmake
@@ -304,6 +304,8 @@
   set(${_dependent}_components "${${UPPER_PROJECT_NAME}_${_DEPENDENT}_COMPONENTS}")
   if(${_dependent}_components)
      set(_components "COMPONENTS ${${_dependent}_components}" )
+  else()
+     set(_components)
   endif()
   list(APPEND DEPENDENTS
     "set(_${${_dependent}_name}_libraries_backup \${${${_dependent}_name}_LIBRARIES})\n"


Updated comment about setting up dashboard to reflect how to get tests to run on windows

--- ctest/TEMPLATE-ctest-nightly.cmake
+++ ctest/TEMPLATE-ctest-nightly.cmake
@@ -5,6 +5,7 @@
 #    checkouts and testing.
 # 3. Test your setup by running manually with the command:
 #    ctest -S /your/path/ctest-nightly.cmake -V
+#       - If you are on windows, you need to add "-C Release" to the end of the above command in order to have the tests run.
 # 4. Follow the instructions here to schedule ctest to run each night as a cron job:
 #    https://cmake.org/Wiki/CMake_Scripting_Of_CTest#Setting_Up_Cron.2FScheduler
 # 5. Check the results on our dashboard:


update

update

--- modules/fmt.cmake
+++ modules/fmt.cmake
@@ -4,7 +4,8 @@
   file(GLOB SOURCE_FILES "fmt/src/*.cc")
   if(MSVC)
     # C4127: conditional expression is constant
-    set_source_files_properties(${SOURCE_FILES} PROPERTIES COMPILE_FLAGS "${PEDANTIC_COMPILE_FLAGS} /wd4127")
+    # C4702: unreachable code
+    set_source_files_properties(${SOURCE_FILES} PROPERTIES COMPILE_FLAGS "${PEDANTIC_COMPILE_FLAGS} /wd4127 /wd4702")
   else()
     set_source_files_properties(${SOURCE_FILES} PROPERTIES COMPILE_FLAGS "${PEDANTIC_COMPILE_FLAGS} -Wno-gnu-string-literal-operator-template -Wno-shadow")
   endif()


fix: Do not set PythonInterp_DIR in FindPythonInterp module [BASIS]

--- CMake/Basis/FindPythonInterp.cmake
+++ CMake/Basis/FindPythonInterp.cmake
@@ -199,8 +199,4 @@
 include(FindPackageHandleStandardArgs)
 FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonInterp REQUIRED_VARS PYTHON_EXECUTABLE VERSION_VAR PYTHON_VERSION_STRING)

-if (PYTHON_EXECUTABLE)
-  string (REGEX REPLACE "/+[Pp]ython[^/]*(\\.exe)?$" "" PythonInterp_DIR "${PYTHON_EXECUTABLE}")
-  string (REGEX REPLACE "/+[Bb]in$"                  "" PythonInterp_DIR "${PythonInterp_DIR}")
-endif ()
 mark_as_advanced(PYTHON_EXECUTABLE)


Do not force system pcap on MacOSX

Do not force system pcap on MacOSX

--- Projects/apple/pcap.cmake
+++ Projects/apple/pcap.cmake
@@ -1,3 +0,0 @@
-message(STATUS "Using system pcap.")
-add_external_project_or_use_system(pcap)
-set(USE_SYSTEM_pcap TRUE CACHE BOOL "" FORCE)


Bugfix. Fixes #4.

Bugfix. Fixes #4.

--- internal/testing.cmake
+++ internal/testing.cmake
@@ -19,21 +19,21 @@
 # The default test target will run all tests...
 # Here are additional targets that filter the labels appropriately
 ADD_CUSTOM_TARGET(test_small
-                 COMMAND /usr/local/bin/ctest -LE "medium|large"
+                 COMMAND ctest -LE "medium|large"
                  WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
                  COMMENT "Running all small tests"
                  VERBATIM
                  )

 ADD_CUSTOM_TARGET(test_medium
-                 COMMAND /usr/local/bin/ctest -LE "large"
+                 COMMAND ctest -LE "large"
                  WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
                  COMMENT "Running all small and mediuim tests"
                  VERBATIM
                  )

 ADD_CUSTOM_TARGET(test_large
-                 COMMAND /usr/local/bin/ctest
+                 COMMAND ctest
                  WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
                  COMMENT "Running all small, medium, and large tests"
                  VERBATIM


SVN_SILENT made messages (.desktop file) - always resolve ours

In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"

--- gstreamer/gstreamer.desktop.cmake
+++ gstreamer/gstreamer.desktop.cmake
@@ -68,6 +68,7 @@
 Name[zh_TW]=GStreamer

 Comment=Phonon GStreamer backend
+Comment[ast]=Backend de GStreamer pa Phonon
 Comment[bg]=Phonon GStreamer
 Comment[bs]=Gstreamer kao pozadina Phonona
 Comment[ca]=Dorsal GStreamer del Phonon


Added an -O2 options if FORTIFY_SOURCE since some GCC versions requires it

--- cmake/Modules/DefineCompilerFlags.cmake
+++ cmake/Modules/DefineCompilerFlags.cmake
@@ -56,7 +56,7 @@

     check_c_compiler_flag("-D_FORTIFY_SOURCE=2" WITH_FORTIFY_SOURCE)
     if (WITH_FORTIFY_SOURCE)
-      add_definitions(-D_FORTIFY_SOURCE=2)
+      add_definitions(-D_FORTIFY_SOURCE=2 -O2)
     endif (WITH_FORTIFY_SOURCE)
   endif (CMAKE_COMPILER_IS_GNUCC OR COMPILER_IS_CLANG)
 endif (UNIX)


Removed debug message from DockerPackaging (#120)

--- cmake/cmake_celix/DockerPackaging.cmake
+++ cmake/cmake_celix/DockerPackaging.cmake
@@ -324,7 +324,6 @@

   if(CELIX_BUILD_DOCKER_USE_DOCKER_DIR_TAR)
-    message("RB ${CMAKE_BINARY_DIR}/${DOCKER_IMAGE_NAME}.tar.gz")
     add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${DOCKER_IMAGE_NAME}.tar.gz
       COMMAND tar czf ${CMAKE_BINARY_DIR}/${DOCKER_IMAGE_NAME}.tar.gz --directory=$<TARGET_PROPERTY:${DOCKER_TARGET},DOCKER_LOC> .
       DEPENDS ${DOCKERFILE} ${DOCKER_TARGET}


 - reworked add_boost_test.cmake file : TARGET_LINK_LIBRARIES changed

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

--- rdo/rdo_studio/branches/dev_linux/cmake/add_boost_test.cmake
+++ rdo/rdo_studio/branches/dev_linux/cmake/add_boost_test.cmake
@@ -24,7 +24,7 @@
     SET_TARGET_PROPERTIES(${ARGV0} PROPERTIES COMPILE_FLAGS "/EHa")
 ENDIF(MSVC)

-TARGET_LINK_LIBRARIES(${ARGV0} ${Boost_LIBRARIES})
+TARGET_LINK_LIBRARIES(${ARGV0} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})

 SOURCE_GROUP(".test" FILES
     ${ARGN})


Correct ios.cmake file for simulator flag

--- ios.cmake
+++ ios.cmake
@@ -124,13 +124,13 @@
 set (CMAKE_OSX_SYSROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Sysroot used for iOS support")

 # set the architecture for iOS
-if (${IOS_PLATFORM} STREQUAL "OS")
+if (IOS_PLATFORM STREQUAL "OS")
     set (IOS_ARCH armv7 armv7s arm64)
-elseif (${IOS_PLATFORM} STREQUAL "SIMULATOR")
+elseif (IOS_PLATFORM STREQUAL "SIMULATOR")
     set (IOS_ARCH i386)
-elseif (${IOS_PLATFORM} STREQUAL "SIMULATOR64")
+elseif (IOS_PLATFORM STREQUAL "SIMULATOR64")
     set (IOS_ARCH x86_64)
-endif (${IOS_PLATFORM} STREQUAL "OS")
+endif ()

 set (CMAKE_OSX_ARCHITECTURES ${IOS_ARCH} CACHE string  "Build architecture for iOS")


Append LUA test ENVIRONMENT instead of overwriting in

Change-Id: I4aff296664a8af652142f8334141936cb5a5f9c1

--- CMake/sitkAddTest.cmake
+++ CMake/sitkAddTest.cmake
@@ -100,7 +100,7 @@
     PROPERTY ENVIRONMENT LUA_CPATH=$<TARGET_FILE:SimpleITKLuaModule_LUA>
     )
   set_property(TEST Lua.${name}
-    PROPERTY ENVIRONMENT SITK_NOSHOW=YES
+    APPEND PROPERTY ENVIRONMENT SITK_NOSHOW=YES
     )
 endfunction()


Treat lz4 as all other built-ins

Treat lz4 as all other built-ins

--- cmake/modules/SearchInstalledSoftware.cmake
+++ cmake/modules/SearchInstalledSoftware.cmake
@@ -137,7 +137,7 @@
 endif()
 # Note: the above if-statement may change the value of builtin_lz4 to ON.
 if(builtin_lz4)
-  set(lz4_version 1.7.5)
+  set(lz4_version v1.7.5)
   message(STATUS "Building LZ4 version ${lz4_version} included in ROOT itself")
   if(CMAKE_CXX_COMPILER_ID STREQUAL Clang)
     set(LZ4_CFLAGS "-Wno-format-nonliteral")
@@ -147,7 +147,7 @@
   set(LZ4_LIBRARIES ${CMAKE_BINARY_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}lz4${CMAKE_STATIC_LIBRARY_SUFFIX})
   ExternalProject_Add(
     LZ4
-    URL https://github.com/lz4/lz4/archive/v1.7.5.tar.gz
+    URL ${lcgpackages}/lz4-${lz4_version}.tar.gz
     URL_MD5 c9610c5ce97eb431dddddf0073d919b9
     INSTALL_DIR ${CMAKE_BINARY_DIR}
     CONFIGURE_COMMAND  /bin/sh -c "PREFIX=<INSTALL_DIR> make cmake"


Use dedicated build directory for cmake-cxx11 tests

Use "CheckCXX11Features" subdirectory to store all cmake-cxx11
tests. This helps to tidy the binary directory level where the
CheckCXX11Features module is included.

--- CMake/cmake-cxx11/Modules/CheckCXX11Features.cmake
+++ CMake/cmake-cxx11/Modules/CheckCXX11Features.cmake
@@ -81,7 +81,7 @@

 function(cxx11_check_feature FEATURE_NAME RESULT_VAR)
     if (NOT DEFINED ${RESULT_VAR})
-        set(_bindir "${CMAKE_CURRENT_BINARY_DIR}/cxx11_${FEATURE_NAME}")
+      set(_bindir "${CMAKE_CURRENT_BINARY_DIR}/CheckCXX11Features/cxx11_${FEATURE_NAME}")

         set(_SRCFILE_BASE ${CMAKE_CURRENT_LIST_DIR}/CheckCXX11Features/cxx11-test-${FEATURE_NAME})
         set(_LOG_NAME "\"${FEATURE_NAME}\"")


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

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

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


Disable CCI in travis testing

Disable CCI in travis testing

--- Testing/script/travis_script.cmake
+++ Testing/script/travis_script.cmake
@@ -122,7 +122,7 @@
 else()
   set(SOEXT so)
   set(PROC_NAME_OPT -r)
-  set(USE_CCI ON)
+  set(USE_CCI OFF)
   set(USE_SM ON)
 endif()


libgit2: depends on libssh2 on windows, too

now that it uses xpFindPkg() and cmake options aren't passed in, Windows
also depends on libssh2 (and it's dependencies)

issue https://github.com/smanders/externpro/issues/356

--- projects/libgit2.cmake
+++ projects/libgit2.cmake
@@ -27,11 +27,7 @@
   if(NOT (XP_DEFAULT OR XP_PRO_LIBGIT2))
     return()
   endif()
-  if(WIN32)
-    set(depTgts)
-  else()
-    xpBuildDeps(depTgts ${PRO_LIBGIT2})
-  endif()
+  xpBuildDeps(depTgts ${PRO_LIBGIT2})
   xpGetArgValue(${PRO_LIBGIT2} ARG NAME VALUE NAME)
   xpGetArgValue(${PRO_LIBGIT2} ARG VER VALUE VER)
   set(XP_CONFIGURE


Fix double inclusion protection.

Fix double inclusion protection.

	* build-aux/cmake/modules/Init.cmake: Set double inclusion check
	variable.

Signed-off-by: Nicolas Despres <abdeb541ca46f1651c9cc594d44e707056e73d5d@gostai.com>

--- build-aux/cmake/modules/Init.cmake
+++ build-aux/cmake/modules/Init.cmake
@@ -13,6 +13,7 @@
 # Set common variables used in all Gostai project using cmake.

 if(NOT DEFINED INIT_CMAKE)
+set(INIT_CMAKE)

 set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE)
 enable_testing()


cmake find boost: do not include regex in case of clang and C++11 and higher, update submodule papuga

--- cmake/boost.cmake
+++ cmake/boost.cmake
@@ -4,15 +4,15 @@
 find_package( Boost 1.57.0 COMPONENTS atomic QUIET)
 if( Boost_ATOMIC_FOUND )
 	if(APPLE OR WIN32)
-		find_package( Boost 1.57.0 REQUIRED COMPONENTS thread-mt system date_time atomic-mt regex )
+		find_package( Boost 1.57.0 REQUIRED COMPONENTS thread-mt system date_time atomic-mt )
 	else()
-		find_package( Boost 1.57.0 REQUIRED COMPONENTS thread system date_time atomic regex )
+		find_package( Boost 1.57.0 REQUIRED COMPONENTS thread system date_time atomic )
 	endif()
 else()
 	if(APPLE OR WIN32)
-		find_package( Boost 1.57.0 REQUIRED COMPONENTS thread-mt system date_time regex )
+		find_package( Boost 1.57.0 REQUIRED COMPONENTS thread-mt system date_time )
 	else()
-		find_package( Boost 1.57.0 REQUIRED COMPONENTS thread system date_time regex )
+		find_package( Boost 1.57.0 REQUIRED COMPONENTS thread system date_time )
 	endif()
 endif()


[sw] Update compile error for sw (#28419)

--- cmake/cblas.cmake
+++ cmake/cblas.cmake
@@ -102,7 +102,7 @@
   find_library(REFERENCE_CBLAS_LIBRARY NAMES cblas PATHS
         ${REFERENCE_CBLAS_LIB_SEARCH_PATHS})
   find_library(REFERENCE_BLAS_LIBRARY NAMES blas PATHS
-        ${REFERENCE_BLAS_LIB_SEARCH_PATHS})
+        ${REFERENCE_CBLAS_LIB_SEARCH_PATHS})

   if(REFERENCE_CBLAS_INCLUDE_DIR AND REFERENCE_CBLAS_LIBRARY)
     set(CBLAS_PROVIDER REFERENCE_CBLAS)
@@ -127,9 +127,9 @@
 # linear algebra libraries for cc_library(xxx SRCS xxx.c DEPS cblas)

 include_directories(${CBLAS_INC_DIR})
-if(NOT ${CBLAS_PROVIDER} STREQUAL MKLML)
+if(${CBLAS_PROVIDER} STREQUAL REFERENCE_CBLAS)
+  target_link_libraries(cblas gfortran ${CBLAS_LIBRARIES} ${REFERENCE_BLAS_LIBRARY})
+elseif(NOT ${CBLAS_PROVIDER} STREQUAL MKLML)
   target_link_libraries(cblas ${CBLAS_LIBRARIES})
-elseif(${CBLAS_PROVIDER} STREQUAL REFERENCE_CBLAS)
-  target_link_libraries(cblas gfortran ${CBLAS_LIBRARIES} ${REFERENCE_BLAS_LIBRARY})
 endif()


Shader generation update, optimized string and removed comments.

--- cmake/txt2h.cmake
+++ cmake/txt2h.cmake
@@ -6,9 +6,20 @@
 	set(the_list "${the_list}#define ${u_string_name}\n\n")
 	set(the_list "${the_list}#include <string>\n\n")
 	set(the_list "${the_list}const std::string ${string_name} =\n\"")
-    foreach(item ${ARGN})
-		string(REPLACE "\n" " NEWLINE\\\n" item_with_end ${item})
-		string(REPLACE "\"" "\\\"" item_done ${item_with_end})
+	set(items "${ARGN}")
+	string(REPLACE "\n" "\n;" item_list ${items})
+    foreach(item ${item_list})
+		# Removes comments (optimization)
+		string(FIND "${item}" "//" comment_pos)
+		if(NOT ${comment_pos} EQUAL -1)
+			string(SUBSTRING "${item}" 0 ${comment_pos} item)
+		endif()
+		if (NOT "${item}" STREQUAL "")
+			string(REPLACE "\n" " NEWLINE\\\n" item_with_end ${item})
+			string(REPLACE "\"" "\\\"" item_done ${item_with_end})
+		else()
+			set(item_done ${item})
+		endif()
         set(the_list "${the_list}${item_done}")
     endforeach()
     set(${retval} "${the_list}\";\n\n#endif\n")


Minor improvement CMakeLists to use generators

--- cmake/utils.cmake
+++ cmake/utils.cmake
@@ -25,12 +25,10 @@

 # Turn on warnings on the given target
 function(spdlog_enable_warnings target_name)
-	if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang")
-		target_compile_options(${target_name} PRIVATE -Wall -Wextra -Wconversion -pedantic -Wfatal-errors)
-	endif()
-	if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
-		target_compile_options(${target_name} PRIVATE /W4 /WX )
-	endif()
+    target_compile_options(${target_name} PRIVATE
+        $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
+            -Wall -Wextra -Wconversion -pedantic -Wfatal-errors>
+        $<$<CXX_COMPILER_ID:MSVC>:/W4 /WX>)
 endfunction()


Added CLAPACK_LINKER_FLAGS to the CMAKE_LINKER_FLAGS for applications.

--- copasi/CMakeConsoleApp.cmake
+++ copasi/CMakeConsoleApp.cmake
@@ -9,7 +9,7 @@
 # for apple we set the Accelerate framework

 set(SE_EXTERNAL_LIBS ${SE_EXTERNAL_LIBS} ${CLAPACK_LIBRARIES})
-#   LAPACK LDFLAGS    = ${CLAPACK_LINKER_FLAGS}
+set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} ${CLAPACK_LINKER_FLAGS})

 if(ENABLE_COPASI_SEDML)
 set(SE_EXTERNAL_LIBS ${SE_EXTERNAL_LIBS} ${LIBSEDML_LIBRARY})


Adding option to start fleshing out size-optimized flags for #898.

--- build_tools/cmake/iree_copts.cmake
+++ build_tools/cmake/iree_copts.cmake
@@ -132,6 +132,35 @@
 set(IREE_TEST_COPTS "${ABSL_TEST_COPTS}")

 #-------------------------------------------------------------------------------
+# Size-optimized build flags
+#-------------------------------------------------------------------------------
+
+  # TODO(#898): add a dedicated size-constrained configuration.
+if(${IREE_SIZE_OPTIMIZED})
+  iree_select_compiler_opts(IREE_SIZE_OPTIMIZED_DEFAULT_COPTS
+    MSVC_OR_CLANG_CL
+      "/GS-"
+      "/GL"
+      "/Gw"
+      "/Gy"
+      "/DNDEBUG"
+      "/DIREE_STATUS_MODE=0"
+  )
+  iree_select_compiler_opts(IREE_SIZE_OPTIMIZED_DEFAULT_LINKOPTS
+    MSVC_OR_CLANG_CL
+      "/LTCG"
+      "/opt:ref,icf"
+  )
+  # TODO(#898): make this only impact the runtime (IREE_RUNTIME_DEFAULT_...).
+  set(IREE_DEFAULT_COPTS
+      "${IREE_DEFAULT_COPTS}"
+      "${IREE_SIZE_OPTIMIZED_DEFAULT_COPTS}")
+  set(IREE_DEFAULT_LINKOPTS
+      "${IREE_DEFAULT_LINKOPTS}"
+      "${IREE_SIZE_OPTIMIZED_DEFAULT_LINKOPTS}")
+endif()
+
+#-------------------------------------------------------------------------------
 # Compiler: Clang/LLVM
 #-------------------------------------------------------------------------------


RPM_MOCK_BUILD: better error messages

RPM_MOCK_BUILD: better error messages

--- Modules/ManageRPM.cmake
+++ Modules/ManageRPM.cmake
@@ -349,10 +349,13 @@

 MACRO(RPM_MOCK_BUILD)
     IF(NOT _manage_rpm_dependency_missing )
-	FIND_PROGRAM(MOCK_CMD mock)
-	IF(MOCK_CMD STREQUAL "MOCK_CMD-NOTFOUND")
-	    M_MSG(${M_OFF} "mock is not found in PATH, mock support disabled.")
-	ELSE(MOCK_CMD STREQUAL "MOCK_CMD-NOTFOUND")
+	FIND_PROGRAM_ERROR_HANDLING(MOCK_CMD
+	    ERROR_MSG "mock not found, mock build support is disabled."
+	    ERROR_VAR _mock_missing
+	    VERBOSE_LEVEL ${M_OFF}
+	    FIND_ARGS NAMES mock
+	    )
+	IF(NOT _mock_missing)
 	    IF(NOT RPM_BUILD_ARCH STREQUAL "noarch")
 		IF(NOT DEFINED MOCK_RPM_DIST_TAG)
 		    STRING(REGEX MATCH "^fc([1-9][0-9]*)"  _fedora_mock_dist "${RPM_DIST_TAG}")
@@ -380,7 +383,7 @@
 		    DEPENDS ${PRJ_SRPM_FILE}
 		    )
 	    ENDIF(NOT RPM_BUILD_ARCH STREQUAL "noarch")
-	ENDIF(MOCK_CMD STREQUAL "MOCK_CMD-NOTFOUND")
+	ENDIF(NOT _mock_missing)
     ENDIF(NOT _manage_rpm_dependency_missing )

 ENDMACRO(RPM_MOCK_BUILD)


Reposition variable definitions

Reposition variable definitions

--- library/cmake/Modules/FindPHP.cmake
+++ library/cmake/Modules/FindPHP.cmake
@@ -35,16 +35,6 @@
 # This file has been modified to include the option to specify a "Development" component
 # and find Zend headers.  © Nightwave Studios, 2017.
 #
-
-set(PHP_FOUND FALSE)
-set(PHP_DEVELOPMENT_COMPONENT_FOUND FALSE)
-
-if(PHP_FIND_COMPONENTS)
-	foreach(component ${PHP_FIND_COMPONENTS})
-		string(TOUPPER ${component} _COMPONENT)
-		set(PHP_USE_${_COMPONENT} TRUE)
-	endforeach()
-endif()

 FIND_PROGRAM(PHP_CONFIG_EXECUTABLE NAMES php-config5 php-config4 php-config)

@@ -101,6 +91,14 @@
 	PHP_VERSION_STRING
 )

+if(PHP_FIND_COMPONENTS)
+	foreach(component ${PHP_FIND_COMPONENTS})
+		string(TOUPPER ${component} _COMPONENT)
+		set(PHP_USE_${_COMPONENT} TRUE)
+	endforeach()
+endif()
+
+set(PHP_DEVELOPMENT_COMPONENT_FOUND FALSE)
 set(PHP_DEVELOPMENT_COMPONENT_ACCPETED TRUE)
 if(PHP_USE_DEVELOPMENT_COMPONENT)
 	FIND_PATH(zend_path
@@ -116,7 +114,7 @@

 INCLUDE(FindPackageHandleStandardArgs)
 FIND_PACKAGE_HANDLE_STANDARD_ARGS(
-	php
+	PHP
 	DEFAULT_MSG
 	PHP_EXECUTABLE
 	PHP_CONFIG_EXECUTABLE


do not cache PCH

do not cache PCH

ccache does not correctly detect changed headers that are dependency of
PCH and returns cached PCH, which could be incorrect

--- pch.cmake
+++ pch.cmake
@@ -233,12 +233,8 @@

             set(COMPILER ${CMAKE_CXX_COMPILER})
             if(${COMPILER} MATCHES "ccache")
-    #            message("CCache will not give any boost when precompiled headers are used")
                 string(STRIP ${CMAKE_CXX_COMPILER_ARG1} CARG1)
-                set( COMPILER ${CMAKE_CXX_COMPILER} ${CARG1} )
-            endif()
-            if( CMAKE_CXX_COMPILER_LAUNCHER )
-                set( COMPILER ${CMAKE_CXX_COMPILER_LAUNCHER} ${COMPILER} )
+                set( COMPILER ${CARG1} )
             endif()

             list( REMOVE_DUPLICATES _compiler_FLAGS )


fix PCH on ninja/makefile build when using private link libraries

- this adds support for using target_link_libraries( target PRIVATE deps )

--- pch.cmake
+++ pch.cmake
@@ -45,7 +45,12 @@
 # SOFTWARE.

 macro(get_dependencies_compile_options target compileOptions compileDefinitions includeDirectories systemIncludeDirectories visited)
-    get_target_property(dependencies ${target} INTERFACE_LINK_LIBRARIES)
+    get_target_property( dependencies ${target} INTERFACE_LINK_LIBRARIES )
+    get_target_property( target_type ${target} TYPE )
+    if( NOT ${target_type} STREQUAL INTERFACE_LIBRARY )
+        get_target_property( private_dependencies ${target} LINK_LIBRARIES )
+        list( APPEND dependencies ${private_dependencies} )
+    endif()
     foreach(dep ${dependencies})
         if(TARGET ${dep} )
             # check if we already processed this dependency
@@ -179,7 +184,8 @@

             get_directory_property( _directory_flags INCLUDE_DIRECTORIES )
             get_target_property( _target_include_dirs ${_targetName} INCLUDE_DIRECTORIES )
-            foreach( item ${_directory_flags} ${_target_include_dirs} ${depsIncludeDirectories} )
+            get_target_property( _target_interface_include_dirs ${_targetName} INTERFACE_INCLUDE_DIRECTORIES )
+            foreach( item ${_directory_flags} ${_target_include_dirs} ${_target_interface_include_dirs} ${depsIncludeDirectories} )
                 filter_item( filtered_item ${item} )
                 if( filtered_item )
                     list( APPEND _compiler_FLAGS "-I${filtered_item}" )
@@ -237,6 +243,9 @@
             if( CMAKE_CXX_COMPILER_LAUNCHER )
                 set( COMPILER ${CMAKE_CXX_COMPILER_LAUNCHER} ${COMPILER} )
             endif()
+
+            list( REMOVE_DUPLICATES _compiler_FLAGS )
+
             SEPARATE_ARGUMENTS(_compiler_FLAGS)

             ADD_CUSTOM_COMMAND(


Don't derive REVDESCRIBE from VERSION_INFO

deb/rpm make dist-{deb,rpm} was broken when the tag was a bare version
(i.e 2.4.4) rather than a subsequent command (2.4.3-4-gdeadbeef).

Change-Id: I0b057631ec6f1e96c859c3f796e083642804c9be
Reviewed-on: http://review.couchbase.org/43449
Tested-by: Mark Nunberg <e7d42768707bf23038325b0b68d4b577e5f6064a@haskalah.org>
Reviewed-by: Subhashni Balakrishnan <7129c8e37b832c7bd362ff375532d24b98ef5162@gmail.com>

--- cmake/Modules/GetVersionInfo.cmake
+++ cmake/Modules/GetVersionInfo.cmake
@@ -17,8 +17,9 @@
 ENDMACRO()

 if (GIT_EXECUTABLE)
-    RUNGIT(LCB_REVDESCRIBE describe)
-    STRING(REPLACE "-" "_" LCB_VERSION "${LCB_REVDESCRIBE}")
+    RUNGIT(LCB_REVDESCRIBE describe --long)
+    RUNGIT(LCB_VERSION describe)
+    STRING(REPLACE "-" "_" LCB_VERSION "${LCB_VERSION}")
     MESSAGE(STATUS "Sanitized VERSION=${LCB_VERSION}")
     RUNGIT(LCB_VERSION_CHANGESET rev-parse HEAD)


python: support Python 3.7 and 3.8

python: support Python 3.7 and 3.8

Add 3.7 and 3.8 to the list of accepted Python 3 versions.

--- cmake/FindPython3Interp.cmake
+++ cmake/FindPython3Interp.cmake
@@ -39,7 +39,7 @@

 unset(_Python3_NAMES)

-set(_Python3_VERSIONS 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
+set(_Python3_VERSIONS 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)

 if(Python3Interp_FIND_VERSION)
     if(Python3Interp_FIND_VERSION_COUNT GREATER 1)


Added the option to build profiling binaries.

--- cmake/compiler_settings.cmake
+++ cmake/compiler_settings.cmake
@@ -29,11 +29,17 @@

 if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
   option(USE_ASAN "Instrument the build to use ASAN sanitizers" OFF)
+  option(PROFILING "Instrument the build to generate profiling binaries" OFF)
   if(USE_ASAN)
     set(ASAN_SANITIZERS "-fsanitize=address -fsanitize=leak -fsanitize=undefined -fsanitize=null -fsanitize=return -fsanitize=vptr -fsanitize-address-use-after-scope")
   endif()
-  set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DNOMINMAX -Wall -Werror -Wfatal-errors -Wpsabi -O0 -ggdb ${ASAN_SANITIZERS}")
-  set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${ASAN_SANITIZERS}")
+  if(PROFILING)
+    set(PROFILING_FLAGS "-pg")
+  endif()
+  set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DNOMINMAX -Wall -Werror -Wfatal-errors -Wpsabi -O0 -ggdb ${ASAN_SANITIZERS} ${PROFILING_FLAGS}")
+  set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${ASAN_SANITIZERS} ${PROFILING_FLAGS}")
   set(CMAKE_CXX_FLAGS_RELEASE
-      "${CMAKE_CXX_FLAGS_RELEASE} -DNOMINMAX -Wall -Werror -Wfatal-errors -Wpsabi -O3 -fomit-frame-pointer")
+      "${CMAKE_CXX_FLAGS_RELEASE} -DNOMINMAX -Wall -Werror -Wfatal-errors -Wpsabi -O3 -fomit-frame-pointer ${PROFILING_FLAGS}")
+  set(CMAKE_EXE_LINKER_FLAGS_RELEASE
+      "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${PROFILING_FLAGS}")
 endif()


Update FindDavix.cmake to use PkgConfig

Update FindDavix.cmake to use PkgConfig

--- cmake/modules/FindDavix.cmake
+++ cmake/modules/FindDavix.cmake
@@ -1,19 +1,78 @@
-# - Locate DAVIX library
-# Defines:
+#.rst:
+# FindDavix
+# -------
 #
-#  DAVIX_FOUND
-#  DAVIX_INCLUDE_DIR
-#  DAVIX_INCLUDE_DIRS (not cached)
-#  DAVIX_LIBRARIES
+# Find Davix library for file management over HTTP-based protocols.
+#
+# Imported Targets
+# ^^^^^^^^^^^^^^^^
+#
+# This module defines :prop_tgt:`IMPORTED` target:
+#
+# ``Davix::Davix``
+#   The libdavix library, if found.
+#
+# Result Variables
+# ^^^^^^^^^^^^^^^^
+#
+# This module will set the following variables in your project:
+#
+# ``DAVIX_FOUND``
+#   True if Davix has been found.
+# ``DAVIX_INCLUDE_DIRS``
+#   Where to find davix.hpp, etc.
+# ``DAVIX_LIBRARIES``
+#   The libraries to link against to use Davix.
+# ``DAVIX_VERSION``
+#   The version of the Davix library found (e.g. 0.6.4)
+#
+# Obsolete variables
+# ^^^^^^^^^^^^^^^^^^
+#
+# The following variables may also be set, for backwards compatibility:
+#
+# ``DAVIX_LIBRARY``
+#   where to find the DAVIX library.
+# ``DAVIX_INCLUDE_DIR``
+#   where to find the DAVIX headers (same as DAVIX_INCLUDE_DIRS)
+#
+# Since Davix depends on OpenSSL and LibXml2, none of the above will be defined
+# unless both packages can be found.

-find_path(DAVIX_INCLUDE_DIR NAMES davix.hpp PATH_SUFFIXES davix HINTS ${DAVIX}/include $ENV{DAVIX}/include ${DAVIX_DIR}/include $ENV{DAVIX_DIR}/include)
-find_library(DAVIX_LIBRARY NAMES davix HINTS ${DAVIX}/lib $ENV{DAVIX}/lib ${DAVIX_DIR}/lib $ENV{DAVIX_DIR}/lib64 ${DAVIX_DIR}/lib $ENV{DAVIX_DIR}/lib64)
+if(Davix_FIND_QUIETLY)
+  set(_FIND_DEPS_ARG QUIET)
+endif()

-set(DAVIX_INCLUDE_DIRS ${DAVIX_INCLUDE_DIR})
-set(DAVIX_LIBRARIES ${DAVIX_LIBRARY})
+foreach(var FOUND INCLUDE_DIR INCLUDE_DIRS LIBRARY LIBRARIES)
+  unset(DAVIX_${var} CACHE)
+endforeach()

-# Handle the QUIETLY and REQUIRED arguments and set DAVIX_FOUND to TRUE if all listed variables are TRUE
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(DAVIX DEFAULT_MSG DAVIX_INCLUDE_DIR DAVIX_LIBRARY)
+find_package(LibXml2 ${_FIND_DEPS_ARG})
+find_package(OpenSSL ${_FIND_DEPS_ARG})

-mark_as_advanced(DAVIX_FOUND DAVIX_INCLUDE_DIR DAVIX_LIBRARY)
+if(LIBXML2_FOUND AND OPENSSL_FOUND)
+  find_path(DAVIX_INCLUDE_DIR davix.hpp PATH_SUFFIXES davix/include)
+
+  if(${Davix_FIND_REQUIRED})
+    set(Davix_REQUIRED REQUIRED)
+  endif()
+
+  find_package(PkgConfig REQUIRED)
+  pkg_check_modules(DAVIX ${Davix_REQUIRED} davix>=${Davix_FIND_VERSION})
+
+  set(DAVIX_LIBRARIES ${DAVIX_LDFLAGS} ${LIBXML2_LIBRARIES} ${OPENSSL_LIBRARIES})
+  set(DAVIX_LIBRARY ${DAVIX_LIBRARIES})
+  set(DAVIX_INCLUDE_DIRS ${DAVIX_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIRS})
+  set(DAVIX_INCLUDE_DIR ${DAVIX_INCLUDE_DIRS})
+endif()
+
+if(DAVIX_FOUND AND NOT TARGET Davix::Davix)
+  add_library(Davix::Davix INTERFACE IMPORTED)
+  string(REPLACE "-D" "" DAVIX_DEFINITIONS ${DAVIX_CFLAGS_OTHER})
+  set_target_properties(Davix::Davix PROPERTIES
+    INTERFACE_COMPILE_DEFINITIONS "${DAVIX_DEFINITIONS}"
+    INTERFACE_INCLUDE_DIRECTORIES "${DAVIX_INCLUDE_DIRS}"
+    INTERFACE_LINK_LIBRARIES "${DAVIX_LIBRARIES}")
+endif()
+
+mark_as_advanced(DAVIX_INCLUDE_DIR DAVIX_LIBRARY)


Find OpenBLAS more aggressively.  This made a difference on Fedora 20

--- bench/btl/cmake/FindOPENBLAS.cmake
+++ bench/btl/cmake/FindOPENBLAS.cmake
@@ -3,7 +3,7 @@
   set(OPENBLAS_FIND_QUIETLY TRUE)
 endif (OPENBLAS_LIBRARIES)

-find_file(OPENBLAS_LIBRARIES libopenblas.so PATHS /usr/lib $ENV{OPENBLASDIR} ${LIB_INSTALL_DIR})
+find_file(OPENBLAS_LIBRARIES NAMES libopenblas.so libopenblas.so.0 PATHS /usr/lib /usr/lib64 $ENV{OPENBLASDIR} ${LIB_INSTALL_DIR})
 find_library(OPENBLAS_LIBRARIES openblas PATHS $ENV{OPENBLASDIR} ${LIB_INSTALL_DIR})

 if(OPENBLAS_LIBRARIES AND CMAKE_COMPILER_IS_GNUCXX)


COMP: Removed debugging message

COMP: Removed debugging message

--- CMake/DashboardScripts/run_experimental.cmake
+++ CMake/DashboardScripts/run_experimental.cmake
@@ -21,8 +21,6 @@
 #
 ##############################################################################

-MESSAGE( "HERE: _${SITE_EXPERIMENTAL_BUILD_TEST}_" )
-
 set( ENV{TUBETK_RUN_MODEL} "Experimental" )
 set( ENV{TUBETK_FORCE_BUILD} "1" )


ENH: gdal qualification message on one line in cmake configuration

--- Modules/ThirdParty/GDAL/otb-module-init.cmake
+++ Modules/ThirdParty/GDAL/otb-module-init.cmake
@@ -9,9 +9,6 @@
 endif()

 if(GDAL_CONFIG_CHECKING)
-
-	message(STATUS "Check if Gdal qualifies for Orfeo ToolBox")
-
 	set(MIN_MAJOR_VERSION 1)
 	set(MIN_MINOR_VERSION 10)

@@ -185,9 +182,9 @@

 	if(GDAL_QUALIFIES AND NOT COMPILE_ERRORS)
-		message(STATUS " >> Yes")
+          message(STATUS "Check if Gdal qualifies for Orfeo ToolBox -- yes.")
 	else()
-		message(STATUS " >> No")
+          message(STATUS "Check if Gdal qualifies for Orfeo ToolBox -- no.")
 	endif()


config.h.cmake modified

config.h.cmake modified

--- helen-compiler/cmake/config.h.cmake
+++ helen-compiler/cmake/config.h.cmake
@@ -13,4 +13,4 @@

 #define PROJECT_VERSION_PATCH "@PROJECT_VERSION_PATCH@"

-#endif+#endif


tomviz uses patch in the version number. Fixed that.

This fixes Windows packaging issues. The tomviz version varible affects
Linux builds too. Not sure if those packages needed this fix too (since
we don't have Linux dashboard). I am going to assume they do.

--- cmake/DetermineTomVizVersion.cmake
+++ cmake/DetermineTomVizVersion.cmake
@@ -18,7 +18,7 @@
     set(patch ${CMAKE_MATCH_3})
     set(patch_extra ${CMAKE_MATCH_4})

-    set(tomviz_version "${major}.${minor}" PARENT_SCOPE)
+    set(tomviz_version "${major}.${minor}.${patch}" PARENT_SCOPE)
     set(tomviz_version_major ${major} PARENT_SCOPE)
     set(tomviz_version_minor ${minor} PARENT_SCOPE)
     set(tomviz_version_patch ${patch} PARENT_SCOPE)


Print message with QtMobility version

Print message with QtMobility version

--- cmake/Modules/FindQtMobility.cmake
+++ cmake/Modules/FindQtMobility.cmake
@@ -81,6 +81,8 @@

         STRING(REGEX MATCH "MOBILITY_PATCH_VERSION = ([^\n]+)" QT_MOBILITY_PATCH_VERSION "${MOBILITY_CONFIG_FILE_CONTENTS}")
         SET(QT_MOBILITY_PATCH_VERSION ${CMAKE_MATCH_1})
+
+        message(STATUS "QtMobility version: ${QT_MOBILITY_VERSION}")
     ELSE()
         SET(QT_MOBILITY_VERSION 1.0.0)
         SET(QT_MOBILITY_MAJOR_VERSION 1)


don't use gnu extensions, just standard c++11

--- cmake/Modules/SetCXX2011Flag.cmake
+++ cmake/Modules/SetCXX2011Flag.cmake
@@ -31,7 +31,7 @@

 # Set support for C++ 2011
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
-CHECK_CXX_COMPILER_FLAG(-std=gnu++11 CXX_2011_FOUND)
+CHECK_CXX_COMPILER_FLAG(-std=c++11 CXX_2011_FOUND)
 if(NOT CXX_2011_FOUND)
   message(FATAL_ERROR "Your compiler does not support C++ 2011.")
 else()


Fixed printing in oskar_compiler_options.cmake.

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

 message("===============================================================================")
-message("-- INFO: Building mode = ${CMAKE_BUILD_TYPE}.")
+message("-- INFO: Build type: ${CMAKE_BUILD_TYPE}.")
 message("===============================================================================")

 set(BUILD_SHARED_LIBS ON)
@@ -230,7 +230,7 @@
     message(STATUS "")
     message(STATUS "****************************************************************************")
     message(STATUS "Compiler Options:")
-    message(STATUS "  Build Type: ${CMAKE_BUILD_TYPE}")
+    message(STATUS "  Build type: ${CMAKE_BUILD_TYPE}")
     message(STATUS "  C++ compiler: ${CMAKE_CXX_COMPILER}")
     message(STATUS "  C compiler: ${CMAKE_C_COMPILER}")
     if (${CMAKE_BUILD_TYPE} MATCHES release)


Update to modern CMake style

Update to modern CMake style

Change-Id: I6c64edc053d65fecb7db2d6a39a38c40e7fdf9ef

--- CMake/FindOSMesa.cmake
+++ CMake/FindOSMesa.cmake
@@ -6,23 +6,23 @@
 # OSMESA_LIBRARY      - Link this to use OSMesa

-IF (NOT OSMESA_INCLUDE_DIR)
-  FIND_PATH(OSMESA_INCLUDE_DIR GL/osmesa.h
+if(NOT OSMESA_INCLUDE_DIR)
+  find_path(OSMESA_INCLUDE_DIR GL/osmesa.h
     /usr/openwin/share/include
     /opt/graphics/OpenGL/include
   )
-ENDIF (NOT OSMESA_INCLUDE_DIR)
+endif()

 # This may be left blank if OSMesa symbols are included
 # in the main Mesa library
-IF (NOT OSMESA_LIBRARY)
-  FIND_LIBRARY(OSMESA_LIBRARY OSMesa
+if(NOT OSMESA_LIBRARY)
+  find_library(OSMESA_LIBRARY OSMesa
     /opt/graphics/OpenGL/lib
     /usr/openwin/lib
   )
-ENDIF (NOT OSMESA_LIBRARY)
+endif()

-INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(OSMesa  DEFAULT_MSG  OSMESA_LIBRARY  OSMESA_INCLUDE_DIR)
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(OSMesa  DEFAULT_MSG  OSMESA_LIBRARY  OSMESA_INCLUDE_DIR)

-MARK_AS_ADVANCED(OSMESA_INCLUDE_DIR OSMESA_LIBRARY)
+mark_as_advanced(OSMESA_INCLUDE_DIR OSMESA_LIBRARY)


Removed old CMakeModules folder

Removed old CMakeModules folder

--- CMakeModules/pch.cmake
+++ CMakeModules/pch.cmake
@@ -1,27 +0,0 @@
-
-
-# Adds a precompiled header
-MACRO(ADD_MSVC_PRECOMPILED_HEADER PrecompiledHeader PrecompiledSource SourcesVar)
-  if(MSVC)
-    set_source_files_properties(${PrecompiledSource}
-        PROPERTIES
-        COMPILE_FLAGS "/Yc${PrecompiledHeader}"
-        )
-    foreach( src_file ${${SourcesVar}} )
-        set_source_files_properties(
-            ${src_file}
-            PROPERTIES
-            COMPILE_FLAGS "/Yu${PrecompiledHeader}"
-            )
-    endforeach( src_file ${${SourcesVar}} )
-    list(APPEND ${SourcesVar} ${PrecompiledHeader} ${PrecompiledSource})
-  endif(MSVC)
-ENDMACRO(ADD_MSVC_PRECOMPILED_HEADER)
-
-function(ADD_MSVC_DISABLED_FILES SourceGroupName SourcesVar ...)
-  if(WIN32)
-    set_source_files_properties( ${ARGN} PROPERTIES HEADER_FILE_ONLY TRUE )
-    source_group(${SourceGroupName} FILES ${ARGN})
-	set(${SourcesVar} ${${SourcesVar}} ${ARGN} PARENT_SCOPE)
-  endif(WIN32)
-endfunction(ADD_MSVC_DISABLED_FILES)


fix configuration of OpenAL

fix configuration of OpenAL

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

--- CMakeModules/ConfigurePackages.cmake
+++ CMakeModules/ConfigurePackages.cmake
@@ -302,6 +302,12 @@
         NAMES OpenAL openal
         COMPONENTS al OpenAL32
         PREFIXES ${ENV_NAALI_DEP_PATH}/OpenAL ${ENV_NAALI_DEP_PATH}/OpenAL/libs/Win32)
+
+        if (OPENAL_FOUND)
+            set (OPENAL_LIBRARIES ${OPENAL_LIBRARY})
+            set (OPENAL_INCLUDE_DIRS ${OPENAL_INCLUDE_DIR})
+        endif()
+
         # Force include dir on MSVC
         if (MSVC)
   		   set (OPENAL_INCLUDE_DIRS ${ENV_NAALI_DEP_PATH}/OpenAL/include)


Uses celt 0.7.1

Uses celt 0.7.1

--- CMakeModules/ConfigurePackages.cmake
+++ CMakeModules/ConfigurePackages.cmake
@@ -399,7 +399,7 @@
 macro (configure_celt)
     sagase_configure_package(CELT
         NAMES libcelt
-        COMPONENTS libcelt celt # for celt.h
+        COMPONENTS celt0 libcelt celt # for celt.h
         PREFIXES ${ENV_NAALI_DEP_PATH}/celt)
     sagase_configure_report (CELT)
 endmacro (configure_celt)


Add newline in cmake module

Add newline in cmake module

--- Modules/FindSDL2.cmake
+++ Modules/FindSDL2.cmake
@@ -166,4 +166,4 @@

 INCLUDE(FindPackageHandleStandardArgs)

-FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR)+FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR)


MKL-TBB: removed tbb from dependencies list

--- cmake/OpenCVFindMKL.cmake
+++ cmake/OpenCVFindMKL.cmake
@@ -118,16 +118,10 @@

 elseif(NOT (MKL_VERSION_STR VERSION_LESS "11.3.0"))

-  foreach(MKL_ARCH ${MKL_ARCH_LIST})
-    list(APPEND mkl_lib_find_paths
-      ${MKL_ROOT_DIR}/../tbb/lib/${MKL_ARCH}
-    )
-  endforeach()
-
   set(mkl_lib_list "mkl_intel_${MKL_ARCH_SUFFIX}")

   if(MKL_WITH_TBB)
-    list(APPEND mkl_lib_list mkl_tbb_thread tbb)
+    list(APPEND mkl_lib_list mkl_tbb_thread)
   elseif(MKL_WITH_OPENMP)
     if(MSVC)
       list(APPEND mkl_lib_list mkl_intel_thread libiomp5md)
@@ -155,6 +149,7 @@
     endif()
     list(APPEND MKL_LIBRARIES ${${lib_var_name}})
   endforeach()
+  list(APPEND MKL_LIBRARIES ${OPENCV_EXTRA_MKL_LIBRARIES})
 endif()

 message(STATUS "Found MKL ${MKL_VERSION_STR} at: ${MKL_ROOT_DIR}")


Disable rtti

Disable rtti

--- cmake/PlatformLinux.cmake
+++ cmake/PlatformLinux.cmake
@@ -26,8 +26,10 @@
 set(LINUX_COMPILE_FLAGS
     -Wno-error=unknown-pragmas
     -fvisibility=hidden
-    -pthread -pipe
+    -pthread
+    -pipe
     -fPIC
+    -fno-rtti
     -Wreturn-type
     -Wfloat-equal
     -Wcast-qual
@@ -37,20 +39,17 @@
     -Wno-error=switch
     -fopenmp
 )
-# pthread       -> use pthread library
 # no-rtti       -> disable c++ rtti
-# no-exceptions -> disable exception handling
-# pipe          -> use pipes
 # fPIC          -> use position independent code
-# -Wreturn-type -Werror=return-type -> missing returns in functions and methods are handled as errors which stops the compilation
-# -Wshadow -> e.g. when a parameter is named like a member, too many warnings, disabled for now
 # -fvisibility=hidden -> only export symbols with __attribute__ ((visibility ("default")))

 set(LINUX_TEST_COMPILE_FLAGS
     -Wno-error=unknown-pragmas
     -fvisibility=hidden
-    -pthread -pipe
+    -pthread
+    -pipe
     -fPIC
+    -fno-rtti
     -Wreturn-type
     -Wcast-qual
     -Wcast-align


Updating zinc packaging to have a better os description and also adding in a generator for Mac OSX.  https://tracker.physiomeproject.org/show_bug.cgi?id=3439

git-svn-id: b9baf8c2d14a71b3ba9c27a102eb6e792fc13348@9700 3c1deb5b-d424-0410-962d-aba41a686d42

--- cmake/ZincPackaging.cmake
+++ cmake/ZincPackaging.cmake
@@ -11,8 +11,39 @@
 SET(CPACK_PACKAGE_VERSION_MINOR "${ZINC_MINOR_VERSION}")
 SET(CPACK_PACKAGE_VERSION_PATCH "${ZINC_PATCH_VERSION}")

-SET( CPACK_GENERATOR "TGZ;DEB" )
-SET( CPACK_DEBIAN_PACKAGE_MAINTAINER "Hugh Sorby" ) #required
-SET( CPACK_PACKAGE_FILE_NAME "zinc-${ZINC_VERSION}-${ZINC_ARCHITECTURE}-${CMAKE_SYSTEM}" )
+IF( UNIX AND NOT APPLE )
+	SET( ZINC_SYSTEM "Linux" )
+	SET( CPACK_GENERATOR "TGZ" )
+
+	EXECUTE_PROCESS(COMMAND cat /etc/issue RESULT_VARIABLE COMMAND_RESULT OUTPUT_VARIABLE COMMAND_OUTPUT ERROR_VARIABLE ERR_OUT)
+	IF( COMMAND_RESULT EQUAL 0 )
+		STRING( REGEX MATCH "^[^\\]*" COMMAND_OUTPUT ${COMMAND_OUTPUT} )
+		STRING( STRIP ${COMMAND_OUTPUT} COMMAND_OUTPUT )
+		message(STATUS "${COMMAND_OUTPUT}" )
+		STRING( REPLACE " " "-" ZINC_SYSTEM ${COMMAND_OUTPUT} )
+		STRING( FIND ${ZINC_SYSTEM} "Ubuntu" INDEX )
+		IF( INDEX EQUAL 0 )
+			SET( CPACK_DEBIAN_PACKAGE_MAINTAINER "Hugh Sorby" ) #required
+			SET( CPACK_GENERATOR "DEB" )
+		ENDIF()
+	ENDIF()
+ELSEIF( APPLE )
+	LIST( LENGTH LENGTH_ARCHS CMAKE_OSX_ARCHITECTURES )
+	message(STATUS "la=${LENGTH_ARCHS}-${CMAKE_OSX_ARCHITECTURES}")
+	message(STATUS "la=${CMAKE_SYSTEM_NAME}-${CMAKE_OSX_ARCHITECTURES}")
+	SET( ZINC_ARCHITECTURE "universal" )
+	EXECUTE_PROCESS(COMMAND sw_vers -productName RESULT_VARIABLE COMMAND_RESULT OUTPUT_VARIABLE PRODUCT_NAME )
+	STRING( STRIP ${PRODUCT_NAME} PRODUCT_NAME )
+	EXECUTE_PROCESS(COMMAND sw_vers -productVersion RESULT_VARIABLE COMMAND_RESULT OUTPUT_VARIABLE PRODUCT_VERSION )
+	STRING( STRIP ${PRODUCT_VERSION} PRODUCT_VERSION )
+	STRING( REPLACE " " "-" ZINC_SYSTEM "${PRODUCT_NAME} ${PRODUCT_VERSION}" )
+	SET( CPACK_GENERATOR "DragNDrop" )
+	SET( CPACK_BUNDLE_NAME "OpenCMISS(Zinc)" )
+ELSEIF( WIN32 )
+ENDIF()
+
+message(STATUS "'zinc-${ZINC_VERSION}-${ZINC_ARCHITECTURE}-${ZINC_SYSTEM}'" )
+SET( CPACK_PACKAGE_FILE_NAME "zinc-${ZINC_VERSION}-${ZINC_ARCHITECTURE}-${ZINC_SYSTEM}" )

 INCLUDE(CPack)
+


[cmake] fix build without documentation

[cmake] fix build without documentation

--- cmake/doxygen_tools.cmake
+++ cmake/doxygen_tools.cmake
@@ -100,17 +100,17 @@
       add_dependencies(doxyrest doxygen)
       add_dependencies(html doxyrest)
     endif()
+    # --- Generates conf.py, to describe sphinx setup ---
+    # !! Should be call after doxygen setup
+    # to have a propre DOXYGEN_INPUT value.
+    configure_file (
+      "${CMAKE_SOURCE_DIR}/docs/sphinx/conf.py.in"
+      "${CMAKE_BINARY_DIR}/docs/sphinx/conf.py" @ONLY)
+    configure_file(
+      "${DOXY_CONFIG}"
+      "${CMAKE_BINARY_DIR}/docs/sphinx/Doxyfile" @ONLY)
   endif()

-  # --- Generates conf.py, to describe sphinx setup ---
-  # !! Should be call after doxygen setup
-  # to have a propre DOXYGEN_INPUT value.
-  configure_file (
-    "${CMAKE_SOURCE_DIR}/docs/sphinx/conf.py.in"
-    "${CMAKE_BINARY_DIR}/docs/sphinx/conf.py" @ONLY)
-  configure_file(
-    "${DOXY_CONFIG}"
-    "${CMAKE_BINARY_DIR}/docs/sphinx/Doxyfile" @ONLY)

 endmacro()


CMake: Add a global disable flag for the CPU backend

The CPU backend is disabled by default and must be enabled with
the CMake variable NGRAPH_CPU_ENABLE set to true

--- cmake/external_llvm.cmake
+++ cmake/external_llvm.cmake
@@ -13,8 +13,8 @@

 include(ExternalProject)

-if((NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") AND
-    (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows"))
+if(NGRAPH_CPU_ENABLE AND (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") AND
+                         (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows"))
     message(STATUS "Fetching LLVM from llvm.org")
     set(LLVM_RELEASE_URL http://releases.llvm.org/5.0.0/clang+llvm-5.0.0-linux-x86_64-ubuntu16.04.tar.xz)
     set(LLVM_SHA1_HASH 9cb81c92aa4d3f9707a9b8413c4d24b8dee90c59)


Using global include_directories in g2dcomponent macro

--- cmake/gear2d-macros.cmake
+++ cmake/gear2d-macros.cmake
@@ -22,7 +22,7 @@
   message(STATUS "Component ${G2D_FAMILY}/${G2D_TYPE} from sources ${G2D_SOURCES}")
   add_library(${G2D_TYPE} MODULE ${G2D_SOURCES})
   add_library(${G2D_TYPE}-static STATIC ${G2D_SOURCES})
-  set_target_properties(${G2D_TYPE} PROPERTIES INCLUDE_DIRECTORIES ${GEAR2D_INCLUDE_DIR})
+  include_directories(${GEAR2D_INCLUDE_DIR})
   target_link_libraries(${G2D_TYPE} ${GEAR2D_LIBRARY})
   install(TARGETS ${G2D_TYPE} ${G2D_TYPE}-static LIBRARY DESTINATION ${Gear2D_COMPONENT_PREFIX}/${G2D_FAMILY} ARCHIVE DESTINATION ${Gear2D_COMPONENT_PREFIX}/${G2D_FAMILY})
 endfunction()


CUDA >= 7.5 supports clang with libc++

CUDA >= 7.5 supports clang with libc++

--- cmake/pcl_find_cuda.cmake
+++ cmake/pcl_find_cuda.cmake
@@ -1,15 +1,6 @@
 # Find CUDA

-# Recent versions of cmake set CUDA_HOST_COMPILER to CMAKE_C_COMPILER which
-# on OSX defaults to clang (/usr/bin/cc), but this is not a supported cuda
-# compiler.  So, here we will preemptively set CUDA_HOST_COMPILER to gcc if
-# that compiler exists in /usr/bin.  This will not override an existing cache
-# value if the user has passed CUDA_HOST_COMPILER on the command line.
-if (NOT DEFINED CUDA_HOST_COMPILER AND CMAKE_C_COMPILER_ID STREQUAL "Clang" AND EXISTS /usr/bin/gcc)
-  set(CUDA_HOST_COMPILER /usr/bin/gcc CACHE FILEPATH "Host side compiler used by NVCC")
-  message(STATUS "Setting CMAKE_HOST_COMPILER to /usr/bin/gcc instead of ${CMAKE_C_COMPILER}.  See http://dev.pointclouds.org/issues/979")
-endif()

 if(MSVC11)
 	# Setting this to true brakes Visual Studio builds.
@@ -22,6 +13,24 @@
 if(CUDA_FOUND)
 	message(STATUS "Found CUDA Toolkit v${CUDA_VERSION_STRING}")

+	if(${CUDA_VERSION_STRING} VERSION_LESS "7.5")
+	  # Recent versions of cmake set CUDA_HOST_COMPILER to CMAKE_C_COMPILER which
+	  # on OSX defaults to clang (/usr/bin/cc), but this is not a supported cuda
+	  # compiler.  So, here we will preemptively set CUDA_HOST_COMPILER to gcc if
+	  # that compiler exists in /usr/bin.  This will not override an existing cache
+	  # value if the user has passed CUDA_HOST_COMPILER on the command line.
+	  if (NOT DEFINED CUDA_HOST_COMPILER AND CMAKE_C_COMPILER_ID STREQUAL "Clang" AND EXISTS /usr/bin/gcc)
+	    set(CUDA_HOST_COMPILER /usr/bin/gcc CACHE FILEPATH "Host side compiler used by NVCC")
+	    message(STATUS "Setting CMAKE_HOST_COMPILER to /usr/bin/gcc instead of ${CMAKE_C_COMPILER}.  See http://dev.pointclouds.org/issues/979")
+	  endif()
+
+	  # Send a warning if CUDA_HOST_COMPILER is set to a compiler that is known
+	  # to be unsupported.
+	  if (CUDA_HOST_COMPILER STREQUAL CMAKE_C_COMPILER AND CMAKE_C_COMPILER_ID STREQUAL "Clang")
+	    message(WARNING "CUDA_HOST_COMPILER is set to an unsupported compiler: ${CMAKE_C_COMPILER}.  See http://dev.pointclouds.org/issues/979")
+	  endif()
+	endif()
+
 	# CUDA_ARCH_BIN is a space separated list of versions to include in output so-file. So you can set CUDA_ARCH_BIN = 10 11 12 13 20
 	# Also user can specify virtual arch in parenthesis to limit instructions  set,
 	# for example CUDA_ARCH_BIN = 11(11) 12(11) 13(11) 20(11) 21(11) -> forces using only sm_11 instructions.
@@ -54,11 +63,5 @@
 	# Guess this macros will be included in cmake distributive
 	include(${PCL_SOURCE_DIR}/cmake/CudaComputeTargetFlags.cmake)
 	APPEND_TARGET_ARCH_FLAGS()
-
-  # Send a warning if CUDA_HOST_COMPILER is set to a compiler that is known
-  # to be unsupported.
-  if (CUDA_HOST_COMPILER STREQUAL CMAKE_C_COMPILER AND CMAKE_C_COMPILER_ID STREQUAL "Clang")
-    message(WARNING "CUDA_HOST_COMPILER is set to an unsupported compiler: ${CMAKE_C_COMPILER}.  See http://dev.pointclouds.org/issues/979")
-  endif()

 endif()


Remove redundant BUILD_INTERFACE (#7345)

--- cmake/GoogleUtilities.cmake
+++ cmake/GoogleUtilities.cmake
@@ -37,7 +37,7 @@
 # GoogleUtilities
 target_include_directories(
   GoogleUtilities PRIVATE
-  $<BUILD_INTERFACE:${FIREBASE_EXTERNAL_SOURCE_DIR}/GoogleUtilities>
+  ${FIREBASE_EXTERNAL_SOURCE_DIR}/GoogleUtilities
 )

 firebase_ios_framework_public_headers(GoogleUtilities ${headers})


Moving clang omp support down to 3.5.0

Moving clang omp support down to 3.5.0

--- cmake/PVConfigProject.cmake
+++ cmake/PVConfigProject.cmake
@@ -95,7 +95,7 @@
       # Open source clang detected
       set(COMPILER_DETECTED ON)
       set(PV_NVCC_FLAGS ${CLANG_NVCC_FLAGS})
-      if (${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER "3.6.0")
+      if (${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER "3.5.0")
         # This is a clang that supports OpenMP. Note how Apple's clang has a version
         # number greater than this. What could go wrong?
         message(STATUS "Clang with OpenMP support detected")


updated distclean rule to not remove config.h.cmake files

--- cmake/TargetDistclean.cmake
+++ cmake/TargetDistclean.cmake
@@ -3,7 +3,7 @@
   ADD_CUSTOM_COMMAND(
     COMMENT "distribution clean"
     COMMAND $(MAKE_COMMAND) clean &&
-      find . \\! -path "./cmake/\\*" -path "\\*.cmake" -o -name CMakeFiles -o -name Makefile -o -name CMakeCache.txt -o -name Testing -o -name cmake_install.cmake -o -name install_manifest.txt -o -name "*.so" | xargs rm -rf
+      find . \\! -path "./cmake/\\*" \\! -name config.h.cmake -path "\\*.cmake" -o -name CMakeFiles -o -name Makefile -o -name CMakeCache.txt -o -name Testing -o -name cmake_install.cmake -o -name install_manifest.txt -o -name "*.so" | xargs rm -rf
     TARGET distclean
   )
 ENDIF(UNIX)


[CMake] add_llvm_library: Specify explicit suffix .imp to import library to avoid a warning between profile_rt-static and profile_rt-shared with lib/profile_rt.lib.

FIXME: It seems MS version of profile_rt.dll doesn't contain any export symbols.

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

--- cmake/modules/AddLLVM.cmake
+++ cmake/modules/AddLLVM.cmake
@@ -12,6 +12,11 @@

   if( BUILD_SHARED_LIBS )
     llvm_config( ${name} ${LLVM_LINK_COMPONENTS} )
+    if (MSVC)
+      set_target_properties(${name}
+        PROPERTIES
+        IMPORT_SUFFIX ".imp")
+    endif ()
   endif()

   # Ensure that the system libraries always comes last on the


More windows build fix attempts.

More windows build fix attempts.

The windows ninja build is now green, but msvs is still unhappy. Maybe that's
because the .def file was passed when building LTO_static, so only pass
symbol lists for shared libraries.

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

--- cmake/modules/AddLLVM.cmake
+++ cmake/modules/AddLLVM.cmake
@@ -86,10 +86,10 @@
         PROPERTIES
         IMPORT_SUFFIX ".imp")
     endif ()
-  endif()
-
-  if (LLVM_EXPORTED_SYMBOL_FILE)
-    add_llvm_symbol_exports( ${name} ${LLVM_EXPORTED_SYMBOL_FILE} )
+
+    if (LLVM_EXPORTED_SYMBOL_FILE)
+      add_llvm_symbol_exports( ${name} ${LLVM_EXPORTED_SYMBOL_FILE} )
+    endif()
   endif()

   # Ensure that the system libraries always comes last on the


Translate ENABLE_CLANG_{ARCMT,REWRITER,STATIC_ANALYZER} when generating
lit.site.cfg.

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

--- cmake/modules/AddLLVM.cmake
+++ cmake/modules/AddLLVM.cmake
@@ -295,6 +295,22 @@

   set(HOST_OS ${CMAKE_SYSTEM_NAME})
   set(HOST_ARCH ${CMAKE_SYSTEM_PROCESSOR})
+
+  if (CLANG_ENABLE_ARCMT)
+    set(ENABLE_CLANG_ARCMT "1")
+  else()
+    set(ENABLE_CLANG_ARCMT "0")
+  endif()
+  if (CLANG_ENABLE_REWRITER)
+    set(ENABLE_CLANG_REWRITER "1")
+  else()
+    set(ENABLE_CLANG_REWRITER "0")
+  endif()
+  if (CLANG_ENABLE_STATIC_ANALYZER)
+    set(ENABLE_CLANG_STATIC_ANALYZER "1")
+  else()
+    set(ENABLE_CLANG_STATIC_ANALYZER "0")
+  endif()

   configure_file(${input} ${output} @ONLY)
 endfunction()