[cmake] FindMUMPS: add missing steps for scotch and ptscotch linking

--- cmake/FindMUMPS.cmake
+++ cmake/FindMUMPS.cmake
@@ -15,7 +15,7 @@
 IF(IDONTWANTMPI)
   SET(__MUMPS_NAMES dmumps_seq dmumps)
 ELSE(IDONTWANTMPI)
-# on debian systems one may have mumps+[pt]scotch packages also
+# on debian systems one may have mumps+[pt]scotch packages also
   SET(__MUMPS_NAMES dmumps_ptscotch dmumps_scotch dmumps)
 ENDIF(IDONTWANTMPI)

@@ -54,22 +54,26 @@
   FIND_LIBRARY(MUMPS_COMMON_LIBRARY NAMES ${__MUMPS_COMMON_NAMES})
 ENDIF()

+IF(MUMPS_COMMON_LIBRARY)
+  MESSAGE(STATUS "Found ${MUMPS_COMMON_LIBRARY}")
+ENDIF()
+
 IF(MUMPS_LIBRARY_DIRECTORY)
-  FIND_LIBRARY(METIS_LIBRARY ptscotch PATHS "${MUMPS_LIBRARY_DIRECTORY}" NO_DEFAULT_PATH)
-  IF(NOT METIS_LIBRARY)
-    FIND_LIBRARY(METIS_LIBRARY ptscotch)
+  FIND_LIBRARY(PTSCOTCH_LIBRARY ptscotch PATHS "${MUMPS_LIBRARY_DIRECTORY}" NO_DEFAULT_PATH)
+  IF(NOT PTSCOTCH_LIBRARY)
+    FIND_LIBRARY(PTSCOTCH_LIBRARY ptscotch)
   ENDIF()
 ELSE(MUMPS_LIBRARY_DIRECTORY)
-  FIND_LIBRARY(METIS_LIBRARY ptscotch)
+  FIND_LIBRARY(PTSCOTCH_LIBRARY ptscotch)
 ENDIF(MUMPS_LIBRARY_DIRECTORY)

 IF(MUMPS_LIBRARY_DIRECTORY)
-  FIND_LIBRARY(METIS_LIBRARY scotch PATHS "${MUMPS_LIBRARY_DIRECTORY}" NO_DEFAULT_PATH)
-  IF(NOT METIS_LIBRARY)
-    FIND_LIBRARY(METIS_LIBRARY scotch)
+  FIND_LIBRARY(SCOTCH_LIBRARY scotch PATHS "${MUMPS_LIBRARY_DIRECTORY}" NO_DEFAULT_PATH)
+  IF(NOT SCOTCH_LIBRARY)
+    FIND_LIBRARY(SCOTCH_LIBRARY scotch)
   ENDIF()
 ELSE(MUMPS_LIBRARY_DIRECTORY)
-  FIND_LIBRARY(METIS_LIBRARY scotch)
+  FIND_LIBRARY(SCOTCH_LIBRARY scotch)
 ENDIF(MUMPS_LIBRARY_DIRECTORY)

@@ -106,12 +110,20 @@
 ENDIF()

-FIND_PACKAGE_HANDLE_STANDARD_ARGS(MUMPS
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(MUMPS
   REQUIRED_VARS MUMPS_LIBRARY MUMPS_INCLUDE_DIR)

 IF(MUMPS_LIBRARY)
   GET_FILENAME_COMPONENT(MUMPS_LIBRARY_DIRS ${MUMPS_LIBRARY} PATH)
   SET(MUMPS_LIBRARIES ${MUMPS_LIBRARY} ${MUMPS_COMMON_LIBRARY})
+
+  IF(PTSCOTCH_LIBRARY)
+    SET(MUMPS_LIBRARIES ${MUMPS_LIBRARIES} ${PTSCOTCH_LIBRARY})
+  ENDIF(PTSCOTCH_LIBRARY)
+
+  IF(SCOTCH_LIBRARY)
+    SET(MUMPS_LIBRARIES ${MUMPS_LIBRARIES} ${SCOTCH_LIBRARY})
+  ENDIF(SCOTCH_LIBRARY)

   IF(METIS_LIBRARY)
     SET(MUMPS_LIBRARIES ${MUMPS_LIBRARIES} ${METIS_LIBRARY})


Added MUMPS-5.1.0 and 5.1.1 support

Added MUMPS-5.1.0 and 5.1.1 support

--- cmake/FindMumps.cmake
+++ cmake/FindMumps.cmake
@@ -17,6 +17,8 @@

 set(LIB_SEARCH_PATH
   $ENV{MUMPS_ROOT}
+  ${CMAKE_SOURCE_DIR}/../MUMPS_5.1.1/lib
+  ${CMAKE_SOURCE_DIR}/../MUMPS_5.1.0/lib
   ${CMAKE_SOURCE_DIR}/../MUMPS_5.0.2/lib
   ${CMAKE_SOURCE_DIR}/../MUMPS_5.0.1/lib
   $ENV{HOME}/local/lib
@@ -41,6 +43,8 @@
 find_path(MUMPS_INCLUDE_PATH
   NAMES mumps_compat.h
   HINTS $ENV{MUMPS_ROOT}
+    ${CMAKE_SOURCE_DIR}/../MUMPS_5.1.1/include
+    ${CMAKE_SOURCE_DIR}/../MUMPS_5.1.0/include
     ${CMAKE_SOURCE_DIR}/../MUMPS_5.0.2/include
     ${CMAKE_SOURCE_DIR}/../MUMPS_5.0.1/include
     $ENV{HOME}/local/include


Committing Michael's patch for the FindNumPy.cmake script

--- cmake/FindNumPy.cmake
+++ cmake/FindNumPy.cmake
@@ -67,8 +67,12 @@
 # Convert the process output into a list
 string(REGEX REPLACE ";" "\\\\;" _NUMPY_VALUES ${_NUMPY_VALUES})
 string(REGEX REPLACE "\n" ";" _NUMPY_VALUES ${_NUMPY_VALUES})
-list(GET _NUMPY_VALUES 0 NUMPY_VERSION)
-list(GET _NUMPY_VALUES 1 NUMPY_INCLUDE_DIRS)
+# This modification was suggested by Michael Grant in order to avoid an issue
+# with MKL
+#list(GET _NUMPY_VALUES 0 NUMPY_VERSION)
+#list(GET _NUMPY_VALUES 1 NUMPY_INCLUDE_DIRS)
+list(GET _NUMPY_VALUES -2 NUMPY_VERSION)
+list(GET _NUMPY_VALUES -1 NUMPY_INCLUDE_DIRS)

 # Make sure all directory separators are '/'
 string(REGEX REPLACE "\\\\" "/" NUMPY_INCLUDE_DIRS ${NUMPY_INCLUDE_DIRS})


cleanup macro

cleanup macro

--- cmake/SuperFind.cmake
+++ cmake/SuperFind.cmake
@@ -1,16 +1,13 @@
 include(ExternalProject)

+find_package(Git)
 if(NOT WIN32)
   set(ep_base "/tmp/cmake-build/third-party")
 else()
-  set(ep_base "C://cmake-build//third-party")
+  set(ep_base "C:/cmake-build/third-party")
 endif()
-
 set_property(DIRECTORY PROPERTY "EP_BASE" ${ep_base})
-
 set(EP_URL "https://github.com/rashadkm")
-
-find_package(Git)

 function(super_find_package name)
   set(PKG_NAME ${name})
@@ -22,14 +19,15 @@
   endif ()

   if(EXISTS ${ep_base}/Build/${PKG_NAME}/${PKG_NAME}Config.cmake)
-    message(STATUS "[FIND_PACKAGE ${PKG_NAME} ] using config from ${ep_base}/Build/${PKG_NAME}")
+    message(STATUS "[SuperFind] ${PKG_NAME} using config from ${ep_base}/Build/${PKG_NAME}")
     find_package(${PKG_NAME} PATHS ${ep_base}/Build/${PKG_NAME})
   else()
-    message(STATUS "[FIND_PACKAGE ${PKG_NAME} ] no config")
+    message(STATUS "[SuperFind] ${PKG_NAME} no config")
     find_package(${PKG_NAME} QUIET)
   endif()

-  if(NOT ${PKG_NAME}_FOUND)
+  if(NOT ${PKG_NAME}_FOUND)
+    message(STATUS "[SuperFind] Adding ExternalProject ${PKG_NAME}. update add_dependencies() if needed")
     ExternalProject_Add(${PKG_NAME}
       GIT_REPOSITORY ${EP_URL}/${PKG_REPO}
       DOWNLOAD_COMMAND ""


add some explanation about CPP change in UseCyclus.cmake

--- cmake/UseCyclus.cmake
+++ cmake/UseCyclus.cmake
@@ -89,7 +89,11 @@

     # set cpp path
-
+    # Now use by default the $CPP enviromnement variable first, if not fallback
+    # on the previous behavior, so in order:
+    #   1- if defined use ${CPP}
+    #   2- if clang++ present use it
+    #   3- otherwise use cpp
     IF(DEFINED ENV{CPP})
         SET(SYS_CPP "$ENV{CPP}")
     ELSEIF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")


[cmake] Don't use VERSION_GREATER_EQUAL in cmake versions prior to 3.72.

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

--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -561,11 +561,12 @@
       OUTPUT_VARIABLE NINJA_VERSION
       OUTPUT_STRIP_TRAILING_WHITESPACE)
     set(NINJA_VERSION ${NINJA_VERSION} CACHE STRING "Ninja version number" FORCE)
+    message(STATUS "Ninja version: ${NINJA_VERSION}")
   endif()
 endif()

 if(CMAKE_GENERATOR STREQUAL "Ninja" AND
-    "${NINJA_VERSION}" VERSION_GREATER_EQUAL "1.9.0" AND
+    NOT "${NINJA_VERSION}" VERSION_LESS "1.9.0" AND
     CMAKE_HOST_APPLE AND CMAKE_HOST_SYSTEM_VERSION VERSION_GREATER "15.6.0")
   set(LLVM_TOUCH_STATIC_LIBRARIES ON)
 endif()


[opt-viewer] Check for pygments.lexer.c_cpp

Some systems still don't have this module which was introduced in
version 2.0 (CentOS 7, sigh).

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

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

--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -640,7 +640,8 @@
 string(REPLACE " " ";" LLVM_BINDINGS_LIST "${LLVM_BINDINGS}")

 function(find_python_module module)
-  string(TOUPPER ${module} module_upper)
+  string(REPLACE "." "_" module_name ${module})
+  string(TOUPPER ${module_name} module_upper)
   set(FOUND_VAR PY_${module_upper}_FOUND)

   execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" "import ${module}"
@@ -658,13 +659,16 @@

 set (PYTHON_MODULES
   pygments
+  # Some systems still don't have pygments.lexers.c_cpp which was introduced in
+  # version 2.0 in 2014...
+  pygments.lexers.c_cpp
   yaml
   )
 foreach(module ${PYTHON_MODULES})
   find_python_module(${module})
 endforeach()

-if(PY_PYGMENTS_FOUND AND PY_YAML_FOUND)
+if(PY_PYGMENTS_FOUND AND PY_PYGMENTS_LEXERS_C_CPP_FOUND AND PY_YAML_FOUND)
   set (LLVM_HAVE_OPT_VIEWER_MODULES 1)
 else()
   set (LLVM_HAVE_OPT_VIEWER_MODULES 0)


Enable COMPILER_RT_HAS_SANITIZER_COMMON on NetBSD

Summary:
Temporarily keep disabled COMPILER_RT_HAS_ASAN on NetBSD.

Part of the code inspired by the original work on libsanitizer in GCC 5.4 by Christos Zoulas.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, filcab, kcc, vitalybuka

Reviewed By: vitalybuka

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

Tags: #sanitizers

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

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

--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -470,7 +470,7 @@
 list_replace(COMPILER_RT_SANITIZERS_TO_BUILD all "${ALL_SANITIZERS}")

 if (SANITIZER_COMMON_SUPPORTED_ARCH AND NOT LLVM_USE_SANITIZER AND
-    (OS_NAME MATCHES "Android|Darwin|Linux|FreeBSD|Fuchsia" OR
+    (OS_NAME MATCHES "Android|Darwin|Linux|FreeBSD|NetBSD|Fuchsia" OR
     (OS_NAME MATCHES "Windows" AND (NOT MINGW AND NOT CYGWIN))))
   set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)
 else()
@@ -483,7 +483,8 @@
   set(COMPILER_RT_HAS_INTERCEPTION FALSE)
 endif()

-if (COMPILER_RT_HAS_SANITIZER_COMMON AND ASAN_SUPPORTED_ARCH)
+if (COMPILER_RT_HAS_SANITIZER_COMMON AND ASAN_SUPPORTED_ARCH AND
+    (NOT OS_NAME MATCHES "NetBSD"))
   set(COMPILER_RT_HAS_ASAN TRUE)
 else()
   set(COMPILER_RT_HAS_ASAN FALSE)


Adding LZMA as dep for XML2 on 2.8.0 or higher

LibXML2 config doesn't specify lzma as a dependency, which breaks
cross-compilation builds using new linkers (ld 2.21 or higher).

There is a bug on libxml2 to fix that, but since it's going to take
a while for things to go round and back, so we should have a harmless
addition of the library until then.

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

--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -300,6 +300,20 @@
 find_package(LibXml2)
 if (LIBXML2_FOUND)
   set(CLANG_HAVE_LIBXML 1)
+  # When cross-compiling, liblzma is not detected as a dependency for libxml2,
+  # which makes linking c-index-test fail. But for native builds, all libraries
+  # are installed and checked by CMake before Makefiles are generated and everything
+  # works according to the plan. However, if a -llzma is added to native builds,
+  # an additional requirement on the static liblzma.a is required, but will not
+  # be checked by CMake, breaking native compilation.
+  # Since this is only pertinent to cross-compilations, and there's no way CMake
+  # can check for every foreign library on every OS, we add the dep and warn the dev.
+  if ( DEFINED CMAKE_CROSSCOMPILING )
+    if (NOT PC_LIBXML_VERSION VERSION_LESS "2.8.0")
+      message(STATUS "Adding LZMA as a dep to XML2 for cross-compilation, make sure liblzma.a is available.")
+      set(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} "-llzma")
+    endif ()
+  endif ( CMAKE_CROSSCOMPILING )
 endif ()

 include(CheckCXXCompilerFlag)


Put executables in correct directory when building plugins

--- cmake/dtkPlugin.cmake
+++ cmake/dtkPlugin.cmake
@@ -21,6 +21,7 @@
 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/plugins/)
 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/)
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/plugins/)
+set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin/)

 add_definitions(${QT_DEFINITIONS})
 add_definitions(-DQT_PLUGIN)


ensure early exit when symlink creation fails


CDash does not like + in build names

CDash does not like + in build names

--- CMake/MITKDashboardScript.TEMPLATE.cmake
+++ CMake/MITKDashboardScript.TEMPLATE.cmake
@@ -13,7 +13,7 @@
 # Dashboard properties
 #

-set(MY_COMPILER "g++4.4.5")
+set(MY_COMPILER "gcc-4.4.5")
 # For Windows, e.g.
 #set(MY_COMPILER "VC9.0")


Bump patch version to 3

Bump patch version to 3

--- conf/RTFVersion.cmake
+++ conf/RTFVersion.cmake
@@ -9,7 +9,7 @@
 # bumping VERSION_PATCH
 set(RTF_VERSION_MAJOR "1")
 set(RTF_VERSION_MINOR "3")
-set(RTF_VERSION_PATCH "2")
+set(RTF_VERSION_PATCH "3")
 set(RTF_VERSION_TWEAK "")
 set(RTF_VERSION_STRING "")


Undid last change for log4cxx - breaks builds without explicit LOG4CXX_ROOT_DIR path

--- cmake/FindLog4CXX.cmake
+++ cmake/FindLog4CXX.cmake
@@ -55,7 +55,6 @@
         ${PC_LOG4CXX_INCLUDE_DIRS}
     PATH_SUFFIXES
 		log4cxx
-	NO_DEFAULT_PATH
 )

 find_library(LOG4CXX_LIBRARY
@@ -65,7 +64,6 @@
 		${LOG4CXX_ROOT_DIR}/lib
         ${PC_LOG4CXX_LIBDIR}
         ${PC_LOG4CXX_LIBRARY_DIRS}
-    NO_DEFAULT_PATH
 )

 include(FindPackageHandleStandardArgs)


Happy New Year 2017 last file update

Happy New Year 2017 last file update

--- cmake/FindTinyXML.cmake
+++ cmake/FindTinyXML.cmake
@@ -1,5 +1,5 @@
 ##################################################################################################
-#Copyright (c) 2013, Open Source Robotics Foundation
+#Copyright (c) 2013-2017, Open Source Robotics Foundation
 #All rights reserved.
 #
 #Redistribution and use in source and binary forms, with or without modification,


Implement configuration of all things Ada.

svn path=/trunk/; revision=7385

--- cmake/modules/ada.cmake
+++ cmake/modules/ada.cmake
@@ -1,7 +1,44 @@
-option(ENABLE_ada "Build Ada interface to PLplot" OFF)
-# Eventually configure this.
-set(GNATMAKE_EXECUTABLE gnatmake)
-# This location can be obtained from last element in object search path
-# generated by "gnatls -v" command.
-# This works for Debian stable.  Eventually configure this.
-set(GNAT_DIR /usr/lib/gcc-lib/i486-linux/3.3.5/adalib/)
+# cmake/modules/ada.cmake
+#
+# Copyright (C) 2007 Alan W. Irwin
+#
+# This file is part of PLplot.
+#
+# PLplot is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Library General Public License as published
+# by the Free Software Foundation; version 2 of the License.
+#
+# PLplot is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public License
+# along with the file PLplot; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+
+# Module for determining Ada bindings configuration options
+
+option(ENABLE_ada "Enable Ada bindings" OFF)
+
+if(ENABLE_ada)
+  find_program(GNATMAKE_EXECUTABLE gnatmake)
+  if(NOT GNATMAKE_EXECUTABLE)
+    message(STATUS "WARNING: "
+      "gnatmake not found. Disabling ada bindings")
+      set(ENABLE_ada OFF CACHE BOOL "Enable Ada bindings" FORCE)
+  endif(NOT GNATMAKE_EXECUTABLE)
+endif(ENABLE_ada)
+
+if(ENABLE_ada)
+  find_library(GNAT_LIB gnat)
+  if(NOT GNAT_LIB)
+    message(STATUS "WARNING: "
+      "gnat library not found. Disabling ada bindings")
+      set(ENABLE_ada OFF CACHE BOOL "Enable Ada bindings" FORCE)
+  endif(NOT GNAT_LIB)
+endif(ENABLE_ada)
+
+if(ENABLE_ada)
+  enable_language(Ada)
+endif(ENABLE_ada)


Fix bug in cmake macro 'do_glob_directory'.

--- cmake/DOMacros.cmake
+++ cmake/DOMacros.cmake
@@ -120,8 +120,8 @@
   set(DO_${curdir_name}_MASTER_HEADER ${DO_SOURCE_DIR}/${curdir_name}.hpp)
   source_group("Master Header File" FILES ${DO_${curdir_name}_MASTER_HEADER})

-  list(APPEND DO_${curdir_name}_HEADER_FILES
-       ${${DO_${curdir_name}_MASTER_HEADER}})
+  list(APPEND DO_${curdir_name}_HEADER_FILES
+       ${DO_${curdir_name}_MASTER_HEADER})

   message(STATUS "Master Header:\n ${DO_${curdir_name}_MASTER_HEADER}")
   message(STATUS "Header file list:\n ${DO_${curdir_name}_HEADER_FILES}")


Update to the latest FindBLAS.cmake available from Kitware.

--- cmake/FindBLAS.cmake
+++ cmake/FindBLAS.cmake
@@ -1,419 +1,775 @@
-# Find BLAS library
-#
-# This module finds an installed library that implements the BLAS
-# linear-algebra interface (see http://www.netlib.org/blas/).
-# The list of libraries searched for is mainly taken
-# from the autoconf macro file, acx_blas.m4 (distributed at
-# http://ac-archive.sourceforge.net/ac-archive/acx_blas.html).
-#
-# This module sets the following variables:
-#  BLAS_FOUND - set to true if a library implementing the BLAS interface
-#    is found
-#  BLAS_INCLUDE_DIR - Directories containing the BLAS header files
-#  BLAS_DEFINITIONS - Compilation options to use BLAS
-#  BLAS_LINKER_FLAGS - Linker flags to use BLAS (excluding -l
-#    and -L).
-#  BLAS_LIBRARIES_DIR - Directories containing the BLAS libraries.
-#     May be null if BLAS_LIBRARIES contains libraries name using full path.
-#  BLAS_LIBRARIES - List of libraries to link against BLAS interface.
-#     May be null if the compiler supports auto-link (e.g. VC++).
-#  BLAS_USE_FILE - The name of the cmake module to include to compile
-#     applications or libraries using BLAS.
-#
-# This module was modified by CGAL team:
-# - find libraries for a C++ compiler, instead of Fortran
-# - added BLAS_INCLUDE_DIR, BLAS_DEFINITIONS and BLAS_LIBRARIES_DIR
-# - removed BLAS95_LIBRARIES
+# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+#[=======================================================================[.rst:
+FindBLAS
+--------
+
+Find BLAS library
+
+This module finds an installed fortran library that implements the
+BLAS linear-algebra interface (see http://www.netlib.org/blas/).  The
+list of libraries searched for is taken from the autoconf macro file,
+acx_blas.m4 (distributed at
+http://ac-archive.sourceforge.net/ac-archive/acx_blas.html).
+
+Input Variables
+^^^^^^^^^^^^^^^
+
+The following variables may be set to influence this module's behavior:
+
+``BLA_STATIC``
+  if ``ON`` use static linkage
+
+``BLA_VENDOR``
+  If set, checks only the specified vendor, if not set checks all the
+  possibilities.  List of vendors valid in this module:
+
+  * Goto
+  * OpenBLAS
+  * FLAME
+  * ATLAS PhiPACK
+  * CXML
+  * DXML
+  * SunPerf
+  * SCSL
+  * SGIMATH
+  * IBMESSL
+  * Intel10_32 (intel mkl v10 32 bit)
+  * Intel10_64lp (intel mkl v10+ 64 bit, threaded code, lp64 model)
+  * Intel10_64lp_seq (intel mkl v10+ 64 bit, sequential code, lp64 model)
+  * Intel10_64ilp (intel mkl v10+ 64 bit, threaded code, ilp64 model)
+  * Intel10_64ilp_seq (intel mkl v10+ 64 bit, sequential code, ilp64 model)
+  * Intel (obsolete versions of mkl 32 and 64 bit)
+  * ACML
+  * ACML_MP
+  * ACML_GPU
+  * Apple
+  * NAS
+  * Generic
+
+``BLA_F95``
+  if ``ON`` tries to find the BLAS95 interfaces
+
+``BLA_PREFER_PKGCONFIG``
+  if set pkg-config will be used to search for a BLAS library first
+  and if one is found that is preferred
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This module defines the following variables:
+
+``BLAS_FOUND``
+  library implementing the BLAS interface is found
+``BLAS_LINKER_FLAGS``
+  uncached list of required linker flags (excluding -l and -L).
+``BLAS_LIBRARIES``
+  uncached list of libraries (using full path name) to link against
+  to use BLAS (may be empty if compiler implicitly links BLAS)
+``BLAS95_LIBRARIES``
+  uncached list of libraries (using full path name) to link against
+  to use BLAS95 interface
+``BLAS95_FOUND``
+  library implementing the BLAS95 interface is found
+
+.. note::
+
+  C or CXX must be enabled to use Intel MKL
+
+  For example, to use Intel MKL libraries and/or Intel compiler:
+
+  .. code-block:: cmake
+
+    set(BLA_VENDOR Intel10_64lp)
+    find_package(BLAS)
+#]=======================================================================]

 include(CheckFunctionExists)
-
-
-# This macro checks for the existence of the combination of fortran libraries
-# given by _list.  If the combination is found, this macro checks (using the
-# check_function_exists macro) whether can link against that library
-# combination using the name of a routine given by _name using the linker
-# flags given by _flags.  If the combination of libraries is found and passes
-# the link test, LIBRARIES is set to the list of complete library paths that
-# have been found and DEFINITIONS to the required definitions.
-# Otherwise, LIBRARIES is set to FALSE.
-# N.B. _prefix is the prefix applied to the names of all cached variables that
-# are generated internally and marked advanced by this macro.
-macro(check_fortran_libraries DEFINITIONS LIBRARIES _prefix _name _flags _list _path)
-  #message("DEBUG: check_fortran_libraries(${_list} in ${_path})")
-
-  # Check for the existence of the libraries given by _list
-  set(_libraries_found TRUE)
-  set(_libraries_work FALSE)
-  set(${DEFINITIONS} "")
-  set(${LIBRARIES} "")
+include(CheckFortranFunctionExists)
+include(CMakePushCheckState)
+include(FindPackageHandleStandardArgs)
+cmake_push_check_state()
+set(CMAKE_REQUIRED_QUIET ${BLAS_FIND_QUIETLY})
+
+set(_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
+
+# Check the language being used
+if( NOT (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED OR CMAKE_Fortran_COMPILER_LOADED) )
+  if(BLAS_FIND_REQUIRED)
+    message(FATAL_ERROR "FindBLAS requires Fortran, C, or C++ to be enabled.")
+  else()
+    message(STATUS "Looking for BLAS... - NOT found (Unsupported languages)")
+    return()
+  endif()
+endif()
+
+if(BLA_PREFER_PKGCONFIG)
+  find_package(PkgConfig)
+  pkg_check_modules(PKGC_BLAS blas)
+  if(PKGC_BLAS_FOUND)
+    set(BLAS_FOUND ${PKGC_BLAS_FOUND})
+    set(BLAS_LIBRARIES "${PKGC_BLAS_LINK_LIBRARIES}")
+    return()
+  endif()
+endif()
+
+macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread)
+  # This macro checks for the existence of the combination of fortran libraries
+  # given by _list.  If the combination is found, this macro checks (using the
+  # Check_Fortran_Function_Exists macro) whether can link against that library
+  # combination using the name of a routine given by _name using the linker
+  # flags given by _flags.  If the combination of libraries is found and passes
+  # the link test, LIBRARIES is set to the list of complete library paths that
+  # have been found.  Otherwise, LIBRARIES is set to FALSE.
+
+  # N.B. _prefix is the prefix applied to the names of all cached variables that
+  # are generated internally and marked advanced by this macro.
+
+  set(_libdir ${ARGN})
+
+  set(_libraries_work TRUE)
+  set(${LIBRARIES})
   set(_combined_name)
+  if (NOT _libdir)
+    if (WIN32)
+      set(_libdir ENV LIB)
+    elseif (APPLE)
+      set(_libdir ENV DYLD_LIBRARY_PATH)
+    else ()
+      set(_libdir ENV LD_LIBRARY_PATH)
+    endif ()
+  endif ()
+
+  list(APPEND _libdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
+
   foreach(_library ${_list})
     set(_combined_name ${_combined_name}_${_library})

-    if(_libraries_found)
-      # search first in ${_path}
+    if(_libraries_work)
+      if (BLA_STATIC)
+        if (WIN32)
+          set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
+        endif ()
+        if (APPLE)
+          set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
+        else ()
+          set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
+        endif ()
+      else ()
+        if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
+          # for ubuntu's libblas3gf and liblapack3gf packages
+          set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf)
+        endif ()
+      endif ()
       find_library(${_prefix}_${_library}_LIBRARY
-                  NAMES ${_library}
-                  PATHS ${_path} NO_DEFAULT_PATH
-                  )
-      # if not found, search in environment variables and system
-      if ( WIN32 )
-        find_library(${_prefix}_${_library}_LIBRARY
-                    NAMES ${_library}
-                    PATHS ENV LIB
-                    )
-      elseif ( APPLE )
-        find_library(${_prefix}_${_library}_LIBRARY
-                    NAMES ${_library}
-                    PATHS /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV DYLD_LIBRARY_PATH
-                    )
-      else ()
-        find_library(${_prefix}_${_library}_LIBRARY
-                    NAMES ${_library}
-                    PATHS /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV LD_LIBRARY_PATH
-                    )
-      endif()
+        NAMES ${_library}
+        PATHS ${_libdir}
+        )
       mark_as_advanced(${_prefix}_${_library}_LIBRARY)
       set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})
-      set(_libraries_found ${${_prefix}_${_library}_LIBRARY})
-    endif(_libraries_found)
-  endforeach(_library ${_list})
-  if(_libraries_found)
-    set(_libraries_found ${${LIBRARIES}})
-  endif()
-
-  # Test this combination of libraries with the Fortran/f2c interface.
-  # We test the Fortran interface first as it is well standardized.
-  if(_libraries_found AND NOT _libraries_work)
-    set(${DEFINITIONS}  "-D${_prefix}_USE_F2C")
-    set(${LIBRARIES}    ${_libraries_found})
-    # Some C++ linkers require the f2c library to link with Fortran libraries.
-    # I do not know which ones, thus I just add the f2c library if it is available.
-    find_package( F2C QUIET )
-    if ( F2C_FOUND )
-      set(${DEFINITIONS}  ${${DEFINITIONS}} ${F2C_DEFINITIONS})
-      set(${LIBRARIES}    ${${LIBRARIES}} ${F2C_LIBRARIES})
-    endif()
-    set(CMAKE_REQUIRED_DEFINITIONS  ${${DEFINITIONS}})
-    set(CMAKE_REQUIRED_LIBRARIES    ${_flags} ${${LIBRARIES}})
-    #message("DEBUG: CMAKE_REQUIRED_DEFINITIONS = ${CMAKE_REQUIRED_DEFINITIONS}")
-    #message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
-    # Check if function exists with f2c calling convention (ie a trailing underscore)
-    check_function_exists(${_name}_ ${_prefix}_${_name}_${_combined_name}_f2c_WORKS)
-    set(CMAKE_REQUIRED_DEFINITIONS} "")
-    set(CMAKE_REQUIRED_LIBRARIES    "")
-    mark_as_advanced(${_prefix}_${_name}_${_combined_name}_f2c_WORKS)
-    set(_libraries_work ${${_prefix}_${_name}_${_combined_name}_f2c_WORKS})
-  endif(_libraries_found AND NOT _libraries_work)
-
-  # If not found, test this combination of libraries with a C interface.
-  # A few implementations (ie ACML) provide a C interface. Unfortunately, there is no standard.
-  if(_libraries_found AND NOT _libraries_work)
-    set(${DEFINITIONS} "")
-    set(${LIBRARIES}   ${_libraries_found})
-    set(CMAKE_REQUIRED_DEFINITIONS "")
-    set(CMAKE_REQUIRED_LIBRARIES   ${_flags} ${${LIBRARIES}})
-    #message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
-    check_function_exists(${_name} ${_prefix}_${_name}${_combined_name}_WORKS)
-    set(CMAKE_REQUIRED_LIBRARIES "")
-    mark_as_advanced(${_prefix}_${_name}${_combined_name}_WORKS)
-    set(_libraries_work ${${_prefix}_${_name}${_combined_name}_WORKS})
-  endif(_libraries_found AND NOT _libraries_work)
-
-  # on failure
-  if(NOT _libraries_work)
-    set(${DEFINITIONS} "")
-    set(${LIBRARIES}   FALSE)
-  endif()
-  #message("DEBUG: ${DEFINITIONS} = ${${DEFINITIONS}}")
+      set(_libraries_work ${${_prefix}_${_library}_LIBRARY})
+    endif()
+  endforeach()
+  if(_libraries_work)
+    # Test this combination of libraries.
+    set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_thread})
+    #  message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
+    if (CMAKE_Fortran_COMPILER_LOADED)
+      check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS)
+    else()
+      check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS)
+    endif()
+    set(CMAKE_REQUIRED_LIBRARIES)
+    set(_libraries_work ${${_prefix}${_combined_name}_WORKS})
+  endif()
+  if(_libraries_work)
+    if("${_list}" STREQUAL "")
+      set(${LIBRARIES} "${LIBRARIES}-PLACEHOLDER-FOR-EMPTY-LIBRARIES")
+    else()
+      set(${LIBRARIES} ${${LIBRARIES}} ${_thread})  # for static link
+    endif()
+  else()
+    set(${LIBRARIES} FALSE)
+  endif()
   #message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}")
-endmacro(check_fortran_libraries)
-
-
-#
-# main
-#
-
-# Is it already configured?
-if (BLAS_LIBRARIES_DIR OR BLAS_LIBRARIES)
-
-  set(BLAS_FOUND TRUE)
-
-else()
-
-  # reset variables
-  set( BLAS_INCLUDE_DIR "" )
-  set( BLAS_DEFINITIONS "" )
-  set( BLAS_LINKER_FLAGS "" )
-  set( BLAS_LIBRARIES "" )
-  set( BLAS_LIBRARIES_DIR "" )
-
-    #
-    # If Unix, search for BLAS function in possible libraries
-    #
-
+endmacro()
+
+set(BLAS_LINKER_FLAGS)
+set(BLAS_LIBRARIES)
+set(BLAS95_LIBRARIES)
+if (NOT $ENV{BLA_VENDOR} STREQUAL "")
+  set(BLA_VENDOR $ENV{BLA_VENDOR})
+else ()
+  if(NOT BLA_VENDOR)
+    set(BLA_VENDOR "All")
+  endif()
+endif ()
+
+if (BLA_VENDOR STREQUAL "All")
+  if(NOT BLAS_LIBRARIES)
+    # Implicitly linked BLAS libraries
+    check_fortran_libraries(
+      BLAS_LIBRARIES
+      BLAS
+      sgemm
+      ""
+      ""
+      ""
+      )
+  endif()
+endif ()
+
+#BLAS in intel mkl 10+ library? (em64t 64bit)
+if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
+  if (NOT BLAS_LIBRARIES)
+
+    # System-specific settings
+    if (WIN32)
+      if (BLA_STATIC)
+        set(BLAS_mkl_DLL_SUFFIX "")
+      else()
+        set(BLAS_mkl_DLL_SUFFIX "_dll")
+      endif()
+    else()
+      if(CMAKE_Fortran_COMPILER_LOADED AND CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
+          set(BLAS_mkl_INTFACE "gf")
+          set(BLAS_mkl_THREADING "gnu")
+          set(BLAS_mkl_OMP "gomp")
+      else()
+          set(BLAS_mkl_INTFACE "intel")
+          set(BLAS_mkl_THREADING "intel")
+          set(BLAS_mkl_OMP "iomp5")
+      endif()
+      set(BLAS_mkl_LM "-lm")
+      set(BLAS_mkl_LDL "-ldl")
+    endif()
+
+    if (BLA_VENDOR MATCHES "_64ilp")
+      set(BLAS_mkl_ILP_MODE "ilp64")
+    else ()
+      set(BLAS_mkl_ILP_MODE "lp64")
+    endif ()
+
+    if (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED)
+      if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
+        find_package(Threads)
+      else()
+        find_package(Threads REQUIRED)
+      endif()
+
+      set(BLAS_SEARCH_LIBS "")
+
+      if(BLA_F95)
+        set(BLAS_mkl_SEARCH_SYMBOL sgemm_f95)
+        set(_LIBRARIES BLAS95_LIBRARIES)
+        if (WIN32)
+          # Find the main file (32-bit or 64-bit)
+          set(BLAS_SEARCH_LIBS_WIN_MAIN "")
+          if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
+            list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
+              "mkl_blas95${BLAS_mkl_DLL_SUFFIX} mkl_intel_c${BLAS_mkl_DLL_SUFFIX}")
+          endif()
+          if (BLA_VENDOR MATCHES "^Intel10_64i?lp" OR BLA_VENDOR STREQUAL "All")
+            list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
+              "mkl_blas95_${BLAS_mkl_ILP_MODE}${BLAS_mkl_DLL_SUFFIX} mkl_intel_${BLAS_mkl_ILP_MODE}${BLAS_mkl_DLL_SUFFIX}")
+          endif ()
+
+          # Add threading/sequential libs
+          set(BLAS_SEARCH_LIBS_WIN_THREAD "")
+          if (BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All")
+            list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
+              "mkl_sequential${BLAS_mkl_DLL_SUFFIX}")
+          endif()
+          if (NOT BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All")
+            # old version
+            list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
+              "libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
+            # mkl >= 10.3
+            list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
+              "libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
+          endif()
+
+          # Cartesian product of the above
+          foreach (MAIN ${BLAS_SEARCH_LIBS_WIN_MAIN})
+            foreach (THREAD ${BLAS_SEARCH_LIBS_WIN_THREAD})
+              list(APPEND BLAS_SEARCH_LIBS
+                "${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}")
+            endforeach()
+          endforeach()
+        else ()
+          if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
+            # old version
+            list(APPEND BLAS_SEARCH_LIBS
+              "mkl_blas95 mkl_${BLAS_mkl_INTFACE} mkl_${BLAS_mkl_THREADING}_thread mkl_core guide")
+
+            # mkl >= 10.3
+            list(APPEND BLAS_SEARCH_LIBS
+              "mkl_blas95 mkl_${BLAS_mkl_INTFACE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_OMP}")
+          endif ()
+          if (BLA_VENDOR MATCHES "^Intel10_64i?lp$" OR BLA_VENDOR STREQUAL "All")
+            # old version
+            list(APPEND BLAS_SEARCH_LIBS
+              "mkl_blas95 mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_THREADING}_thread mkl_core guide")
+
+            # mkl >= 10.3
+            list(APPEND BLAS_SEARCH_LIBS
+              "mkl_blas95_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_OMP}")
+          endif ()
+          if (BLA_VENDOR MATCHES "^Intel10_64i?lp_seq$" OR BLA_VENDOR STREQUAL "All")
+            list(APPEND BLAS_SEARCH_LIBS
+              "mkl_blas95_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_sequential mkl_core")
+          endif ()
+        endif ()
+      else ()
+        set(BLAS_mkl_SEARCH_SYMBOL sgemm)
+        set(_LIBRARIES BLAS_LIBRARIES)
+        if (WIN32)
+          # Find the main file (32-bit or 64-bit)
+          set(BLAS_SEARCH_LIBS_WIN_MAIN "")
+          if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
+            list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
+              "mkl_intel_c${BLAS_mkl_DLL_SUFFIX}")
+          endif()
+          if (BLA_VENDOR MATCHES "^Intel10_64i?lp" OR BLA_VENDOR STREQUAL "All")
+            list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN
+              "mkl_intel_${BLAS_mkl_ILP_MODE}${BLAS_mkl_DLL_SUFFIX}")
+          endif ()
+
+          # Add threading/sequential libs
+          set(BLAS_SEARCH_LIBS_WIN_THREAD "")
+          if (NOT BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All")
+            # old version
+            list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
+              "libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
+            # mkl >= 10.3
+            list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
+              "libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")
+          endif()
+          if (BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All")
+            list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD
+              "mkl_sequential${BLAS_mkl_DLL_SUFFIX}")
+          endif()
+
+          # Cartesian product of the above
+          foreach (MAIN ${BLAS_SEARCH_LIBS_WIN_MAIN})
+            foreach (THREAD ${BLAS_SEARCH_LIBS_WIN_THREAD})
+              list(APPEND BLAS_SEARCH_LIBS
+                "${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}")
+            endforeach()
+          endforeach()
+        else ()
+          if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
+            # old version
+            list(APPEND BLAS_SEARCH_LIBS
+              "mkl_${BLAS_mkl_INTFACE} mkl_${BLAS_mkl_THREADING}_thread mkl_core guide")
+
+            # mkl >= 10.3
+            list(APPEND BLAS_SEARCH_LIBS
+              "mkl_${BLAS_mkl_INTFACE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_OMP}")
+          endif ()
+          if (BLA_VENDOR MATCHES "^Intel10_64i?lp$" OR BLA_VENDOR STREQUAL "All")
+            # old version
+            list(APPEND BLAS_SEARCH_LIBS
+              "mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_THREADING}_thread mkl_core guide")
+
+            # mkl >= 10.3
+            list(APPEND BLAS_SEARCH_LIBS
+              "mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_OMP}")
+          endif ()
+          if (BLA_VENDOR MATCHES "^Intel10_64i?lp_seq$" OR BLA_VENDOR STREQUAL "All")
+            list(APPEND BLAS_SEARCH_LIBS
+              "mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_sequential mkl_core")
+          endif ()
+
+          #older vesions of intel mkl libs
+          if (BLA_VENDOR STREQUAL "Intel" OR BLA_VENDOR STREQUAL "All")
+            list(APPEND BLAS_SEARCH_LIBS
+              "mkl")
+            list(APPEND BLAS_SEARCH_LIBS
+              "mkl_ia32")
+            list(APPEND BLAS_SEARCH_LIBS
+              "mkl_em64t")
+          endif ()
+        endif ()
+      endif ()
+
+      foreach (IT ${BLAS_SEARCH_LIBS})
+        string(REPLACE " " ";" SEARCH_LIBS ${IT})
+        if (NOT ${_LIBRARIES})
+          check_fortran_libraries(
+            ${_LIBRARIES}
+            BLAS
+            ${BLAS_mkl_SEARCH_SYMBOL}
+            ""
+            "${SEARCH_LIBS}"
+            "${CMAKE_THREAD_LIBS_INIT};${BLAS_mkl_LM};${BLAS_mkl_LDL}"
+            )
+        endif ()
+      endforeach ()
+
+    endif ()
+    unset(BLAS_mkl_ILP_MODE)
+    unset(BLAS_mkl_INTFACE)
+    unset(BLAS_mkl_THREADING)
+    unset(BLAS_mkl_OMP)
+    unset(BLAS_mkl_DLL_SUFFIX)
+    unset(BLAS_mkl_LM)
+    unset(BLAS_mkl_LDL)
+  endif ()
+endif ()
+
+if(BLA_F95)
+  find_package_handle_standard_args(BLAS REQUIRED_VARS BLAS95_LIBRARIES)
+  set(BLAS95_FOUND ${BLAS_FOUND})
+  if(BLAS_FOUND)
+    set(BLAS_LIBRARIES "${BLAS95_LIBRARIES}")
+  endif()
+endif()
+
+if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")
+  if(NOT BLAS_LIBRARIES)
+    # gotoblas (http://www.tacc.utexas.edu/tacc-projects/gotoblas2)
+    check_fortran_libraries(
+      BLAS_LIBRARIES
+      BLAS
+      sgemm
+      ""
+      "goto2"
+      ""
+      )
+  endif()
+endif ()
+
+if (BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All")
+  if(NOT BLAS_LIBRARIES)
+    # OpenBLAS (http://www.openblas.net)
+    check_fortran_libraries(
+      BLAS_LIBRARIES
+      BLAS
+      sgemm
+      ""
+      "openblas"
+      ""
+      )
+  endif()
+endif ()
+
+if (BLA_VENDOR STREQUAL "FLAME" OR BLA_VENDOR STREQUAL "All")
+  if(NOT BLAS_LIBRARIES)
+    # FLAME's blis library (https://github.com/flame/blis)
+    check_fortran_libraries(
+      BLAS_LIBRARIES
+      BLAS
+      sgemm
+      ""
+      "blis"
+      ""
+      )
+  endif()
+endif ()
+
+if (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All")
+  if(NOT BLAS_LIBRARIES)
     # BLAS in ATLAS library? (http://math-atlas.sourceforge.net/)
-    if(NOT BLAS_LIBRARIES)
-      check_fortran_libraries(
-      BLAS_DEFINITIONS
-      BLAS_LIBRARIES
-      BLAS
-      sgemm
-      ""
-      "cblas;f77blas;atlas"
-      "${CGAL_TAUCS_LIBRARIES_DIR} ENV BLAS_LIB_DIR"
-      )
-    endif()
-
-    # BLAS in PhiPACK libraries? (requires generic BLAS lib, too)
-    if(NOT BLAS_LIBRARIES)
-      check_fortran_libraries(
-      BLAS_DEFINITIONS
+    check_fortran_libraries(
+      BLAS_LIBRARIES
+      BLAS
+      dgemm
+      ""
+      "f77blas;atlas"
+      ""
+      )
+  endif()
+endif ()
+
+# BLAS in PhiPACK libraries? (requires generic BLAS lib, too)
+if (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All")
+  if(NOT BLAS_LIBRARIES)
+    check_fortran_libraries(
       BLAS_LIBRARIES
       BLAS
       sgemm
       ""
       "sgemm;dgemm;blas"
-      "${CGAL_TAUCS_LIBRARIES_DIR} ENV BLAS_LIB_DIR"
-      )
-    endif()
-
-    # BLAS in Alpha CXML library?
-    if(NOT BLAS_LIBRARIES)
-      check_fortran_libraries(
-      BLAS_DEFINITIONS
+      ""
+      )
+  endif()
+endif ()
+
+# BLAS in Alpha CXML library?
+if (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All")
+  if(NOT BLAS_LIBRARIES)
+    check_fortran_libraries(
       BLAS_LIBRARIES
       BLAS
       sgemm
       ""
       "cxml"
-      "${CGAL_TAUCS_LIBRARIES_DIR} ENV BLAS_LIB_DIR"
-      )
-    endif()
-
-    # BLAS in Alpha DXML library? (now called CXML, see above)
-    if(NOT BLAS_LIBRARIES)
-      check_fortran_libraries(
-      BLAS_DEFINITIONS
+      ""
+      )
+  endif()
+endif ()
+
+# BLAS in Alpha DXML library? (now called CXML, see above)
+if (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All")
+  if(NOT BLAS_LIBRARIES)
+    check_fortran_libraries(
       BLAS_LIBRARIES
       BLAS
       sgemm
       ""
       "dxml"
-      "${CGAL_TAUCS_LIBRARIES_DIR} ENV BLAS_LIB_DIR"
-      )
-    endif()
-
-    # BLAS in Sun Performance library?
-    if(NOT BLAS_LIBRARIES)
-      check_fortran_libraries(
-      BLAS_DEFINITIONS
+      ""
+      )
+  endif()
+endif ()
+
+# BLAS in Sun Performance library?
+if (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All")
+  if(NOT BLAS_LIBRARIES)
+    check_fortran_libraries(
       BLAS_LIBRARIES
       BLAS
       sgemm
       "-xlic_lib=sunperf"
       "sunperf;sunmath"
-      "${CGAL_TAUCS_LIBRARIES_DIR} ENV BLAS_LIB_DIR"
-      )
-      if(BLAS_LIBRARIES)
-        # Extra linker flag
-        set(BLAS_LINKER_FLAGS "-xlic_lib=sunperf")
+      ""
+      )
+    if(BLAS_LIBRARIES)
+      set(BLAS_LINKER_FLAGS "-xlic_lib=sunperf")
+    endif()
+  endif()
+endif ()
+
+# BLAS in SCSL library?  (SGI/Cray Scientific Library)
+if (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All")
+  if(NOT BLAS_LIBRARIES)
+    check_fortran_libraries(
+      BLAS_LIBRARIES
+      BLAS
+      sgemm
+      ""
+      "scsl"
+      ""
+      )
+  endif()
+endif ()
+
+# BLAS in SGIMATH library?
+if (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All")
+  if(NOT BLAS_LIBRARIES)
+    check_fortran_libraries(
+      BLAS_LIBRARIES
+      BLAS
+      sgemm
+      ""
+      "complib.sgimath"
+      ""
+      )
+  endif()
+endif ()
+
+# BLAS in IBM ESSL library? (requires generic BLAS lib, too)
+if (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All")
+  if(NOT BLAS_LIBRARIES)
+    check_fortran_libraries(
+      BLAS_LIBRARIES
+      BLAS
+      sgemm
+      ""
+      "essl;blas"
+      ""
+      )
+  endif()
+endif ()
+
+#BLAS in acml library?
+if (BLA_VENDOR MATCHES "ACML" OR BLA_VENDOR STREQUAL "All")
+  if( ((BLA_VENDOR STREQUAL "ACML") AND (NOT BLAS_ACML_LIB_DIRS)) OR
+    ((BLA_VENDOR STREQUAL "ACML_MP") AND (NOT BLAS_ACML_MP_LIB_DIRS)) OR
+    ((BLA_VENDOR STREQUAL "ACML_GPU") AND (NOT BLAS_ACML_GPU_LIB_DIRS))
+    )
+  # try to find acml in "standard" paths
+  if( WIN32 )
+    file( GLOB _ACML_ROOT "C:/AMD/acml*/ACML-EULA.txt" )
+  else()
+    file( GLOB _ACML_ROOT "/opt/acml*/ACML-EULA.txt" )
+  endif()
+  if( WIN32 )
+    file( GLOB _ACML_GPU_ROOT "C:/AMD/acml*/GPGPUexamples" )
+  else()
+    file( GLOB _ACML_GPU_ROOT "/opt/acml*/GPGPUexamples" )
+  endif()
+  list(GET _ACML_ROOT 0 _ACML_ROOT)
+  list(GET _ACML_GPU_ROOT 0 _ACML_GPU_ROOT)
+  if( _ACML_ROOT )
+    get_filename_component( _ACML_ROOT ${_ACML_ROOT} PATH )
+    if( SIZEOF_INTEGER EQUAL 8 )
+      set( _ACML_PATH_SUFFIX "_int64" )
+    else()
+      set( _ACML_PATH_SUFFIX "" )
+    endif()
+    if( CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" )
+      set( _ACML_COMPILER32 "ifort32" )
+      set( _ACML_COMPILER64 "ifort64" )
+    elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "SunPro" )
+      set( _ACML_COMPILER32 "sun32" )
+      set( _ACML_COMPILER64 "sun64" )
+    elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "PGI" )
+      set( _ACML_COMPILER32 "pgi32" )
+      if( WIN32 )
+        set( _ACML_COMPILER64 "win64" )
+      else()
+        set( _ACML_COMPILER64 "pgi64" )
       endif()
-    endif()
-
-    # BLAS in SCSL library?  (SGI/Cray Scientific Library)
-    if(NOT BLAS_LIBRARIES)
-      check_fortran_libraries(
-      BLAS_DEFINITIONS
-      BLAS_LIBRARIES
-      BLAS
-      sgemm
-      ""
-      "scsl"
-      "${CGAL_TAUCS_LIBRARIES_DIR} ENV BLAS_LIB_DIR"
-      )
-    endif()
-
-    # BLAS in SGIMATH library?
-    if(NOT BLAS_LIBRARIES)
-      check_fortran_libraries(
-      BLAS_DEFINITIONS
-      BLAS_LIBRARIES
-      BLAS
-      sgemm
-      ""
-      "complib.sgimath"
-      "${CGAL_TAUCS_LIBRARIES_DIR} ENV BLAS_LIB_DIR"
-      )
-    endif()
-
-    # BLAS in IBM ESSL library? (requires generic BLAS lib, too)
-    if(NOT BLAS_LIBRARIES)
-      check_fortran_libraries(
-      BLAS_DEFINITIONS
-      BLAS_LIBRARIES
-      BLAS
-      sgemm
-      ""
-      "essl;blas"
-      "${CGAL_TAUCS_LIBRARIES_DIR} ENV BLAS_LIB_DIR"
-      )
-    endif()
-
-    #BLAS in intel mkl 10 library? (em64t 64bit)
-    if(NOT BLAS_LIBRARIES)
-      check_fortran_libraries(
-      BLAS_DEFINITIONS
-      BLAS_LIBRARIES
-      BLAS
-      sgemm
-      ""
-      "mkl_intel_lp64;mkl_intel_thread;mkl_core;guide;pthread"
-      "${CGAL_TAUCS_LIBRARIES_DIR} ENV BLAS_LIB_DIR"
-      )
-    endif()
-
-    ### windows version of intel mkl 10?
-    if(NOT BLAS_LIBRARIES)
-      check_fortran_libraries(
-      BLAS_DEFINITIONS
-      BLAS_LIBRARIES
-      BLAS
-      SGEMM
-      ""
-      "mkl_c_dll;mkl_intel_thread_dll;mkl_core_dll;libguide40"
-      "${CGAL_TAUCS_LIBRARIES_DIR} ENV BLAS_LIB_DIR"
-      )
-    endif()
-
-    #older versions of intel mkl libs
-
-    # BLAS in intel mkl library? (shared)
-    if(NOT BLAS_LIBRARIES)
-      check_fortran_libraries(
-      BLAS_DEFINITIONS
-      BLAS_LIBRARIES
-      BLAS
-      sgemm
-      ""
-      "mkl;guide;pthread"
-      "${CGAL_TAUCS_LIBRARIES_DIR} ENV BLAS_LIB_DIR"
-      )
-    endif()
-
-    #BLAS in intel mkl library? (static, 32bit)
-    if(NOT BLAS_LIBRARIES)
-      check_fortran_libraries(
-      BLAS_DEFINITIONS
-      BLAS_LIBRARIES
-      BLAS
-      sgemm
-      ""
-      "mkl_ia32;guide;pthread"
-      "${CGAL_TAUCS_LIBRARIES_DIR} ENV BLAS_LIB_DIR"
-      )
-    endif()
-
-    #BLAS in intel mkl library? (static, em64t 64bit)
-    if(NOT BLAS_LIBRARIES)
-      check_fortran_libraries(
-      BLAS_DEFINITIONS
-      BLAS_LIBRARIES
-      BLAS
-      sgemm
-      ""
-      "mkl_em64t;guide;pthread"
-      "${CGAL_TAUCS_LIBRARIES_DIR} ENV BLAS_LIB_DIR"
-      )
-    endif()
-
-    #BLAS in acml library?
-    if(NOT BLAS_LIBRARIES)
-      check_fortran_libraries(
-      BLAS_DEFINITIONS
-      BLAS_LIBRARIES
-      BLAS
-      sgemm
-      ""
-      "acml"
-      "${CGAL_TAUCS_LIBRARIES_DIR} ENV BLAS_LIB_DIR"
-      )
-    endif()
-
-    # Apple BLAS library?
-    if(NOT BLAS_LIBRARIES)
-      check_fortran_libraries(
-      BLAS_DEFINITIONS
-      BLAS_LIBRARIES
-      BLAS
-      sgemm
+    elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "Open64" )
+      # 32 bit builds not supported on Open64 but for code simplicity
+      # We'll just use the same directory twice
+      set( _ACML_COMPILER32 "open64_64" )
+      set( _ACML_COMPILER64 "open64_64" )
+    elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "NAG" )
+      set( _ACML_COMPILER32 "nag32" )
+      set( _ACML_COMPILER64 "nag64" )
+    else()
+      set( _ACML_COMPILER32 "gfortran32" )
+      set( _ACML_COMPILER64 "gfortran64" )
+    endif()
+
+    if( BLA_VENDOR STREQUAL "ACML_MP" )
+      set(_ACML_MP_LIB_DIRS
+        "${_ACML_ROOT}/${_ACML_COMPILER32}_mp${_ACML_PATH_SUFFIX}/lib"
+        "${_ACML_ROOT}/${_ACML_COMPILER64}_mp${_ACML_PATH_SUFFIX}/lib" )
+    else()
+      set(_ACML_LIB_DIRS
+        "${_ACML_ROOT}/${_ACML_COMPILER32}${_ACML_PATH_SUFFIX}/lib"
+        "${_ACML_ROOT}/${_ACML_COMPILER64}${_ACML_PATH_SUFFIX}/lib" )
+    endif()
+  endif()
+elseif(BLAS_${BLA_VENDOR}_LIB_DIRS)
+  set(_${BLA_VENDOR}_LIB_DIRS ${BLAS_${BLA_VENDOR}_LIB_DIRS})
+endif()
+
+if( BLA_VENDOR STREQUAL "ACML_MP" )
+  foreach( BLAS_ACML_MP_LIB_DIRS ${_ACML_MP_LIB_DIRS})
+    check_fortran_libraries (
+      BLAS_LIBRARIES
+      BLAS
+      sgemm
+      "" "acml_mp;acml_mv" "" ${BLAS_ACML_MP_LIB_DIRS}
+      )
+    if( BLAS_LIBRARIES )
+      break()
+    endif()
+  endforeach()
+elseif( BLA_VENDOR STREQUAL "ACML_GPU" )
+  foreach( BLAS_ACML_GPU_LIB_DIRS ${_ACML_GPU_LIB_DIRS})
+    check_fortran_libraries (
+      BLAS_LIBRARIES
+      BLAS
+      sgemm
+      "" "acml;acml_mv;CALBLAS" "" ${BLAS_ACML_GPU_LIB_DIRS}
+      )
+    if( BLAS_LIBRARIES )
+      break()
+    endif()
+  endforeach()
+else()
+  foreach( BLAS_ACML_LIB_DIRS ${_ACML_LIB_DIRS} )
+    check_fortran_libraries (
+      BLAS_LIBRARIES
+      BLAS
+      sgemm
+      "" "acml;acml_mv" "" ${BLAS_ACML_LIB_DIRS}
+      )
+    if( BLAS_LIBRARIES )
+      break()
+    endif()
+  endforeach()
+endif()
+
+# Either acml or acml_mp should be in LD_LIBRARY_PATH but not both
+if(NOT BLAS_LIBRARIES)
+  check_fortran_libraries(
+    BLAS_LIBRARIES
+    BLAS
+    sgemm
+    ""
+    "acml;acml_mv"
+    ""
+    )
+endif()
+if(NOT BLAS_LIBRARIES)
+  check_fortran_libraries(
+    BLAS_LIBRARIES
+    BLAS
+    sgemm
+    ""
+    "acml_mp;acml_mv"
+    ""
+    )
+endif()
+if(NOT BLAS_LIBRARIES)
+  check_fortran_libraries(
+    BLAS_LIBRARIES
+    BLAS
+    sgemm
+    ""
+    "acml;acml_mv;CALBLAS"
+    ""
+    )
+endif()
+endif () # ACML
+
+# Apple BLAS library?
+if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")
+  if(NOT BLAS_LIBRARIES)
+    check_fortran_libraries(
+      BLAS_LIBRARIES
+      BLAS
+      dgemm
       ""
       "Accelerate"
-      "${CGAL_TAUCS_LIBRARIES_DIR} ENV BLAS_LIB_DIR"
-      )
-    endif()
-
-    if ( NOT BLAS_LIBRARIES )
-      check_fortran_libraries(
-      BLAS_DEFINITIONS
-      BLAS_LIBRARIES
-      BLAS
-      sgemm
+      ""
+      )
+  endif()
+endif ()
+
+if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
+  if ( NOT BLAS_LIBRARIES )
+    check_fortran_libraries(
+      BLAS_LIBRARIES
+      BLAS
+      dgemm
       ""
       "vecLib"
-      "${CGAL_TAUCS_LIBRARIES_DIR} ENV BLAS_LIB_DIR"
-      )
-    endif ( NOT BLAS_LIBRARIES )
-
-    # Generic BLAS library?
-    # This configuration *must* be the last try as this library is notably slow.
-    if ( NOT BLAS_LIBRARIES )
-      check_fortran_libraries(
-      BLAS_DEFINITIONS
+      ""
+      )
+  endif ()
+endif ()
+
+# Generic BLAS library?
+if (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
+  if(NOT BLAS_LIBRARIES)
+    check_fortran_libraries(
       BLAS_LIBRARIES
       BLAS
       sgemm
       ""
       "blas"
-      "${CGAL_TAUCS_LIBRARIES_DIR} ENV BLAS_LIB_DIR"
-      )
-    endif()
-
-  if(BLAS_LIBRARIES_DIR OR BLAS_LIBRARIES)
-    set(BLAS_FOUND TRUE)
-  else()
-    set(BLAS_FOUND FALSE)
-  endif()
-
-  if(NOT BLAS_FIND_QUIETLY)
-    if(BLAS_FOUND)
-      message(STATUS "A library with BLAS API found.")
-    else(BLAS_FOUND)
-      if(BLAS_FIND_REQUIRED)
-        message(FATAL_ERROR "A required library with BLAS API not found. Please specify library location.")
-      else()
-        message(STATUS "A library with BLAS API not found. Please specify library location.")
-      endif()
-    endif(BLAS_FOUND)
-  endif(NOT BLAS_FIND_QUIETLY)
-
-  # Add variables to cache
-  set( BLAS_INCLUDE_DIR   "${BLAS_INCLUDE_DIR}"
-                          CACHE PATH "Directories containing the BLAS header files" FORCE )
-  set( BLAS_DEFINITIONS   "${BLAS_DEFINITIONS}"
-                          CACHE STRING "Compilation options to use BLAS" FORCE )
-  set( BLAS_LINKER_FLAGS  "${BLAS_LINKER_FLAGS}"
-                          CACHE STRING "Linker flags to use BLAS" FORCE )
-  set( BLAS_LIBRARIES     "${BLAS_LIBRARIES}"
-                          CACHE FILEPATH "BLAS libraries name" FORCE )
-  set( BLAS_LIBRARIES_DIR "${BLAS_LIBRARIES_DIR}"
-                          CACHE PATH "Directories containing the BLAS libraries" FORCE )
-
-  message("DEBUG: BLAS_INCLUDE_DIR = ${BLAS_INCLUDE_DIR}")
-  message("DEBUG: BLAS_DEFINITIONS = ${BLAS_DEFINITIONS}")
-  message("DEBUG: BLAS_LINKER_FLAGS = ${BLAS_LINKER_FLAGS}")
-  message("DEBUG: BLAS_LIBRARIES = ${BLAS_LIBRARIES}")
-  message("DEBUG: BLAS_LIBRARIES_DIR = ${BLAS_LIBRARIES_DIR}")
-  message("DEBUG: BLAS_FOUND = ${BLAS_FOUND}")
-
-endif(BLAS_LIBRARIES_DIR OR BLAS_LIBRARIES)
+      ""
+      )
+  endif()
+endif ()
+
+if(NOT BLA_F95)
+  find_package_handle_standard_args(BLAS REQUIRED_VARS BLAS_LIBRARIES)
+endif()
+
+# On compilers that implicitly link BLAS (such as ftn, cc, and CC on Cray HPC machines)
+# we used a placeholder for empty BLAS_LIBRARIES to get through our logic above.
+if (BLAS_LIBRARIES STREQUAL "BLAS_LIBRARIES-PLACEHOLDER-FOR-EMPTY-LIBRARIES")
+  set(BLAS_LIBRARIES "")
+endif()
+
+cmake_pop_check_state()


fix for the case when we want to create a test target without specifying the testee target

--- cmake/FindCUTI.cmake
+++ cmake/FindCUTI.cmake
@@ -127,8 +127,10 @@
     cuti_init_cppunit_libraries(${target})
   endif()

-	target_link_libraries(${target} PRIVATE debug ${CUTI_LIBRARIES_DEBUG} ${testee})
-	target_link_libraries(${target} PRIVATE optimized ${CUTI_LIBRARIES_RELEASE} ${testee})
+  if(NOT ${testee} STREQUAL "")
+    target_link_libraries(${target} PRIVATE debug ${CUTI_LIBRARIES_DEBUG} ${testee})
+    target_link_libraries(${target} PRIVATE optimized ${CUTI_LIBRARIES_RELEASE} ${testee})
+  endif()
   target_include_directories(${target} PUBLIC ${CUTI_INCLUDE_DIRS})

   if(${USE_CUTI_BACK_END})


[win] Add "d" postfix for external zlib in debug+dynamic on MSVC (e.g. "zlibd.lib")

--- cmake/FindSkia.cmake
+++ cmake/FindSkia.cmake
@@ -90,7 +90,10 @@
   if(UNIX)
     set(ZLIB_LIB_FILE "${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib/lib/${CMAKE_STATIC_LIBRARY_PREFIX}z${CMAKE_STATIC_LIBRARY_SUFFIX}")
   else()
-    set(ZLIB_LIB_FILE "${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib/lib/zlib${CMAKE_STATIC_LIBRARY_SUFFIX}")
+    if(MSVC)
+      set(ZLIB_MSVC_DEBUG_POSTFIX "d")
+    endif()
+    set(ZLIB_LIB_FILE "${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib/lib/zlib${ZLIB_MSVC_DEBUG_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}")
   endif()

   include(ExternalProject)


erthink-cmake: add -Wno-attributes for GCC < 9.x to avoid false-positive warnings.

--- cmake/compiler.cmake
+++ cmake/compiler.cmake
@@ -208,6 +208,7 @@
   check_compiler_flag("-Ominimal" CC_HAS_OMINIMAL)
   check_compiler_flag("-ffunction-sections -fdata-sections" CC_HAS_SECTIONS)
   check_compiler_flag("-ffast-math" CC_HAS_FASTMATH)
+  check_compiler_flag("-Wno-attributes" CC_HAS_WNO_ATTRIBUTES)

   # Check for an omp support
   set(CMAKE_REQUIRED_FLAGS "-fopenmp -Werror")
@@ -437,6 +438,12 @@
   endif()
   if(CC_HAS_FCXX_EXCEPTIONS)
     add_compile_flags("CXX" "-fcxx-exceptions -frtti")
+  endif()
+
+  if (CC_HAS_WNO_ATTRIBUTES AND CMAKE_COMPILER_IS_GNU${CMAKE_PRIMARY_LANG}
+      AND CMAKE_${CMAKE_PRIMARY_LANG}_COMPILER_VERSION VERSION_LESS 9)
+    # GCC < 9.x generates false-positive warnings for optimization attributes
+    add_compile_flags("C;CXX" "-Wno-attributes")
   endif()

   # In C a global variable without a storage specifier (static/extern) and


pulled some updates from drc/drc_lcmtypes version of lcmtypes.cmake

git-svn-id: cf55bc44fb097054a32fc70455a459c940dbbffc@7738 c9849af7-e679-4ec6-a44e-fc146a885bd3

--- cmake/lcmtypes.cmake
+++ cmake/lcmtypes.cmake
@@ -78,7 +78,7 @@
 #
 # ----
 # File: lcmtypes.cmake
-# Distributed with pods version: 12.01.11
+# Distributed with pods version: 12.09.21

 cmake_minimum_required(VERSION 2.6.0)

@@ -107,8 +107,6 @@
             list(APPEND ${msgvar} ${_msg})
         endif(${_msg} MATCHES "^[^\\.].*\\.lcm$")
     endforeach(_msg)
-#    message(STATUS "__tmplcmtypes = ${__tmplcmtypes}")
-#    message(STATUS "lcmtypes = ${${msgvar}}")
 endmacro()

 function(lcmgen)
@@ -170,7 +168,7 @@
     # run lcm-gen at compile time
     add_custom_target(lcmgen_c ALL
         COMMAND sh -c '[ -d ${_lcmtypes_c_dir} ] || mkdir -p ${_lcmtypes_c_dir}'
-        COMMAND sh -c '${LCM_GEN_EXECUTABLE} --lazy -c ${_lcmtypes} --c-cpath ${_lcmtypes_c_dir} --c-hpath ${_lcmtypes_c_dir}')
+        COMMAND sh -c '${LCM_GEN_EXECUTABLE} --lazy -c --c-cpath ${_lcmtypes_c_dir} --c-hpath ${_lcmtypes_c_dir} --cinclude lcmtypes  ${_lcmtypes}')

     # get a list of all generated .c and .h files
     file(GLOB _lcmtypes_c_files ${_lcmtypes_c_dir}/*.c)
@@ -276,7 +274,7 @@
     # run lcm-gen at compile time
     add_custom_target(lcmgen_cpp ALL
         COMMAND sh -c '[ -d ${_lcmtypes_cpp_dir} ] || mkdir -p ${_lcmtypes_cpp_dir}'
-        COMMAND sh -c '${LCM_GEN_EXECUTABLE} --lazy --cpp ${_lcmtypes} --cpp-hpath ${_lcmtypes_cpp_dir}')
+        COMMAND sh -c '${LCM_GEN_EXECUTABLE} --lazy --cpp  --cpp-hpath ${_lcmtypes_cpp_dir} --cpp-include lcmtypes ${_lcmtypes}')

     # get a list of all generated .hpp files
     file(GLOB_RECURSE _lcmtypes_hpp_files  ${_lcmtypes_cpp_dir}/*.hpp)
@@ -371,7 +369,7 @@

     # search for lcmtypes_*.jar files in well-known places and add them to the
     # classpath
-    foreach(pfx /usr /usr/local ${CMAKE_INSTALL_PREFIX})
+    foreach(pfx ${CMAKE_INSTALL_PREFIX} /usr /usr/local)
         file(GLOB_RECURSE jarfiles ${pfx}/share/java/lcmtypes_*.jar)
         foreach(jarfile ${jarfiles})
             set(java_classpath ${java_classpath}:${jarfile})


Change warning level to som more sane.

Change warning level to som more sane.

--- clang.cmake
+++ clang.cmake
@@ -1,7 +1,7 @@
 SET (CMAKE_C_COMPILER "clang")
 SET (CMAKE_CXX_COMPILER "clang++")

-SET(CMAKE_C_FLAGS "-pipe -Weverything -std=c99 -pedantic" CACHE STRING "" FORCE)
+SET(CMAKE_C_FLAGS "-pipe -Wall -Wextra -pedantic -std=c99" CACHE STRING "" FORCE)

 SET(CMAKE_C_FLAGS_RELEASE "-O2 -fomit-frame-pointer" CACHE STRING "" FORCE)
 SET(CMAKE_C_FLAGS_DEBUG "-O0 -ggdb" CACHE STRING "" FORCE)


ENH: Merge changes from main tree into VTK-5-2 branch. (cvs -q up -j1.9 -j1.10 CMake/vtkDetermineCompilerFlags.cmake)

--- CMake/vtkDetermineCompilerFlags.cmake
+++ CMake/vtkDetermineCompilerFlags.cmake
@@ -90,8 +90,15 @@
       "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -Wl,-flat_namespace,-U,_environ")
   ENDIF("${DARWIN_MAJOR_VERSION}" LESS 8)
   IF(CMAKE_COMPILER_IS_GNUCXX)
-    SET(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} -no-cpp-precomp")
-    SET(VTK_REQUIRED_CXX_FLAGS "${VTK_REQUIRED_CXX_FLAGS} -no-cpp-precomp")
+    # -no-cpp-precomp was a compiler flag present only in Apple's gcc and not
+    # in the FSF gcc. The flag is obsolete and totally removed in gcc 4.2
+    # and later. I believe it is only needed with gcc 3.3 and earlier.
+    INCLUDE(${VTK_SOURCE_DIR}/CMake/vtkCheckCXXAcceptsFlags.cmake)
+    vtkCHECK_CXX_ACCEPTS_FLAGS("-no-cpp-precomp" CXX_HAS_CPP_PRECOMP_FLAG)
+    IF(${CXX_HAS_CPP_PRECOMP_FLAG})
+      SET(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} -no-cpp-precomp")
+      SET(VTK_REQUIRED_CXX_FLAGS "${VTK_REQUIRED_CXX_FLAGS} -no-cpp-precomp")
+    ENDIF(${CXX_HAS_CPP_PRECOMP_FLAG})
     IF(NOT BUILD_SHARED_LIBS)
       SET(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} -mlong-branch")
       SET(VTK_REQUIRED_CXX_FLAGS "${VTK_REQUIRED_CXX_FLAGS} -mlong-branch")


Rephrase a comment

Rephrase a comment

git-svn-id: fbbf69ba8011aca0e74e1c67904b11cccbdbe66b@28165 0785d39b-7218-0410-832d-ea1e28bc413d

--- deal.II/cmake/checks/check_02_compiler_bugs.cmake
+++ deal.II/cmake/checks/check_02_compiler_bugs.cmake
@@ -109,7 +109,7 @@
 #

 # TODO: We use the mpi.h header file for this check. We should test this
-# bug with another header file than mpi.h ...
+# bug directly...
 CHECK_INCLUDE_FILE_CXX("mpi.h" HAVE_MPI_H)

 IF(HAVE_MPI_H)


iOS: enable bitcode only in release builds.

--- toolchains/apple.cmake
+++ toolchains/apple.cmake
@@ -41,8 +41,8 @@

   list( REMOVE_ITEM TNUN_compiler_release_flags -ffunction-sections )

-  set( CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES" )
-  set( CMAKE_XCODE_ATTRIBUTE_BITCODE_GENERATION_MODE "bitcode" ) # Without this, Xcode adds -fembed-bitcode-marker compile options instead of -fembed-bitcode
+  set( CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE[variant=Release] "YES" )
+  set( CMAKE_XCODE_ATTRIBUTE_BITCODE_GENERATION_MODE[variant=Release] "bitcode" ) # Without this, Xcode adds -fembed-bitcode-marker compile options instead of -fembed-bitcode
 endmacro()

 link_libraries( $<$<CONFIG:RELEASE>:-dead_strip> )


added: config workaround for clang 3.4+ and boost < 1.56 (upd)

--- share/hugh/cmake/CMakeAddons_SetupVariables.cmake
+++ share/hugh/cmake/CMakeAddons_SetupVariables.cmake
@@ -57,7 +57,7 @@
 # [https://svn.boost.org/trac/boost/ticket/9610]
 cma_print_variable(CMAKE_CXX_COMPILER_ID)
 cma_print_variable(CMAKE_CXX_COMPILER_VERSION)
-if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "CLANG" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 3.3)
+if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 3.3)
   find_package(Boost ${BOOST_MINIMUM_VERSION} QUIET)

   cma_print_variable(Boost_VERSION)


unbound: fix type checking

unbound: fix type checking

--- external/unbound/configure_checks.cmake
+++ external/unbound/configure_checks.cmake
@@ -104,10 +104,10 @@
   set(CMAKE_EXTRA_INCLUDE_FILES "${header}")
   check_type_size("${type}" "${variable}")

-  if (${variable} STREQUAL "")
+  if (NOT HAVE_${type})
     set("${variable}" "${default}" PARENT_SCOPE)
   else ()
-    set("${variable}" "" PARENT_SCOPE)
+    set("${variable}" "FALSE" PARENT_SCOPE)
   endif ()
 endfunction ()


ENH: upgrade openjpeg to 2.1.0

ENH: upgrade openjpeg to 2.1.0

--- SuperBuild/CMake/External_openjpeg.cmake
+++ SuperBuild/CMake/External_openjpeg.cmake
@@ -31,8 +31,8 @@

   ExternalProject_Add(${proj}
         PREFIX ${proj}
-        URL "http://sourceforge.net/projects/openjpeg.mirror/files/2.0.0/openjpeg-2.0.0.tar.gz/download"
-        URL_MD5 d9be274bddc0f47f268e484bdcaaa6c5
+        URL "http://sourceforge.net/projects/openjpeg.mirror/files/2.1.0/openjpeg-2.1.0.tar.gz/download"
+        URL_MD5 f6419fcc233df84f9a81eb36633c6db6
         BINARY_DIR ${OPENJPEG_SB_BUILD_DIR}
         INSTALL_DIR ${SB_INSTALL_PREFIX}
       DOWNLOAD_DIR ${DOWNLOAD_LOCATION}


SuperBuild: search in prefix/lib for qt and qwt dlls

--- SuperBuild/Packaging/PackageHelper.cmake
+++ SuperBuild/Packaging/PackageHelper.cmake
@@ -48,11 +48,16 @@

   set(PKG_SEARCHDIRS)
   if(WIN32)
-    file(GLOB MXE_GCC_LIB_DIR "${DEPENDENCIES_INSTALL_DIR}/bin/gcc*")
-    list(APPEND PKG_SEARCHDIRS ${MXE_GCC_LIB_DIR})
-    list(APPEND PKG_SEARCHDIRS "${DEPENDENCIES_INSTALL_DIR}/qt/bin") #Qt
-    list(APPEND PKG_SEARCHDIRS "${DEPENDENCIES_INSTALL_DIR}/qt/lib") #Qwt
-    list(APPEND PKG_SEARCHDIRS "${DEPENDENCIES_INSTALL_DIR}/bin") #mxe dlls
+    if(MSVC)
+      list(APPEND PKG_SEARCHDIRS "${DEPENDENCIES_INSTALL_DIR}/bin") #all other dlls
+      list(APPEND PKG_SEARCHDIRS "${DEPENDENCIES_INSTALL_DIR}/lib") #Qt & Qwt dlls
+    else()
+      file(GLOB MXE_GCC_LIB_DIR "${DEPENDENCIES_INSTALL_DIR}/bin/gcc*")
+      list(APPEND PKG_SEARCHDIRS ${MXE_GCC_LIB_DIR})
+      list(APPEND PKG_SEARCHDIRS "${DEPENDENCIES_INSTALL_DIR}/qt/bin") #Qt
+      list(APPEND PKG_SEARCHDIRS "${DEPENDENCIES_INSTALL_DIR}/qt/lib") #Qwt
+      list(APPEND PKG_SEARCHDIRS "${DEPENDENCIES_INSTALL_DIR}/bin") #mxe dlls
+    endif()
   else() #unixes
     list(APPEND PKG_SEARCHDIRS "${OTB_INSTALL_DIR}/lib") #so
     list(APPEND PKG_SEARCHDIRS "${DEPENDENCIES_INSTALL_DIR}/lib") #superbuild .so /.dylib


USE_RELATIVE is dead

USE_RELATIVE is dead

--- cmake/ArangoDBMacros.cmake
+++ cmake/ArangoDBMacros.cmake
@@ -5,121 +5,68 @@
   OFF
 )

-if (USE_RELATIVE)
-
-  # /etc -------------------------------
-  set(ETCDIR_NATIVE "./etc/relative")
-  set(ETCDIR_INSTALL "etc/relative")
-
-  # etcd -------------------------------
+# etc -------------------------------
+set(ETCDIR "" CACHE path "System configuration directory (defaults to prefix/etc)")
+
+# /etc -------------------------------
+if (ETCDIR STREQUAL "")
+  set(ETCDIR_NATIVE "${CMAKE_INSTALL_PREFIX}/etc/arangodb")
+  set(ETCDIR_INSTALL "etc/arangodb")
+else ()
+  set(ETCDIR_NATIVE "${ETCDIR}/arangodb")
+  set(ETCDIR_INSTALL "${ETCDIR}/arangodb")
+endif ()
+
+# MS stuff ---------------------------
+if (MSVC)
+  file(TO_NATIVE_PATH "${ETCDIR_INSTALL}" ETCDIR_INSTALL)
+  STRING(REGEX REPLACE "\\\\" "\\\\\\\\" ETCDIR_ESCAPED "${ETCDIR_INSTALL}")
+else ()
   file(TO_NATIVE_PATH "${ETCDIR_NATIVE}" ETCDIR_NATIVE)
   STRING(REGEX REPLACE "\\\\" "\\\\\\\\" ETCDIR_ESCAPED "${ETCDIR_NATIVE}")
-
-  # /var -------------------------------
-  set(VARDIR ""
-    CACHE path
-    "System configuration directory (defaults to prefix/var/arangodb)"
-  )
-
-  if (VARDIR STREQUAL "")
-    set(VARDIR_NATIVE "${CMAKE_INSTALL_PREFIX}/var")
-    set(VARDIR_INSTALL "var")
-  else ()
-    set(VARDIR_NATIVE "${VARDIR}")
-    set(VARDIR_INSTALL "${VARDIR}")
-  endif ()
-
-  file(TO_NATIVE_PATH "${VARDIR_NATIVE}" VARDIR_NATIVE)
-
-  # database
-  FILE(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/var/lib/arangodb")
-
-  # apps
-  FILE(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/var/lib/arangodb-apps")
-
-  # logs
-  FILE(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/var/log/arangodb")
-
-  # tri_package
-  set(TRI_PKGDATADIR "${CMAKE_INSTALL_PREFIX}/share/arangodb")
-
-  # resources
-  set(TRI_RESOURCEDIR "resources")
-
-  # MS stuff ---------------------------
-  if (MSVC)
-    set(ARANGODB_INSTALL_SBIN "bin")
-    set(TRI_SBINDIR "${CMAKE_INSTALL_PREFIX}/bin")
-  else ()
-    set(ARANGODB_INSTALL_SBIN "sbin")
-    set(TRI_SBINDIR "${CMAKE_INSTALL_PREFIX}/sbin")
-  endif ()
-
-  add_definitions("-D_SYSCONFDIR_=\"${ETCDIR_ESCAPED}\"")
-else ()
-  # etcd -------------------------------
-  set(ETCDIR "" CACHE path "System configuration directory (defaults to prefix/etc)")
-
-  # /etc -------------------------------
-  if (ETCDIR STREQUAL "")
-    set(ETCDIR_NATIVE "${CMAKE_INSTALL_PREFIX}/etc/arangodb")
-    set(ETCDIR_INSTALL "etc/arangodb")
-  else ()
-    set(ETCDIR_NATIVE "${ETCDIR}/arangodb")
-    set(ETCDIR_INSTALL "${ETCDIR}/arangodb")
-  endif ()
-
-  # MS stuff ---------------------------
-  if (MSVC)
-    file(TO_NATIVE_PATH "${ETCDIR_INSTALL}" ETCDIR_INSTALL)
-    STRING(REGEX REPLACE "\\\\" "\\\\\\\\" ETCDIR_ESCAPED "${ETCDIR_INSTALL}")
-  else ()
-    file(TO_NATIVE_PATH "${ETCDIR_NATIVE}" ETCDIR_NATIVE)
-    STRING(REGEX REPLACE "\\\\" "\\\\\\\\" ETCDIR_ESCAPED "${ETCDIR_NATIVE}")
-  endif ()
-
-  add_definitions("-D_SYSCONFDIR_=\"${ETCDIR_ESCAPED}\"")
-
-  # /var
-  set(VARDIR ""
-    CACHE path
-    "System configuration directory (defaults to prefix/var/arangodb)"
-  )
-
-  if (VARDIR STREQUAL "")
-    set(VARDIR_NATIVE "${CMAKE_INSTALL_PREFIX}/var")
-    set(VARDIR_INSTALL "var")
-  else ()
-    set(VARDIR_NATIVE "${VARDIR}")
-    set(VARDIR_INSTALL "${VARDIR}")
-  endif ()
-
-  file(TO_NATIVE_PATH "${VARDIR_NATIVE}" VARDIR_NATIVE)
-
-  # database directory
-  FILE(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/var/lib/arangodb")
-
-  # apps
-  FILE(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/var/lib/arangodb-apps")
-
-  # logs
-  FILE(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/var/log/arangodb")
-
-  # package
-  set(TRI_PKGDATADIR "${CMAKE_INSTALL_PREFIX}/share/arangodb")
-
-  # resources
-  set(TRI_RESOURCEDIR "resources")
-
-  # sbinaries
-  if (MSVC)
-    set(ARANGODB_INSTALL_SBIN "bin")
-    set(TRI_SBINDIR "${CMAKE_INSTALL_PREFIX}/bin")
-  else ()
-    set(ARANGODB_INSTALL_SBIN "sbin")
-    set(TRI_SBINDIR "${CMAKE_INSTALL_PREFIX}/sbin")
-  endif ()
-endif (USE_RELATIVE)
+endif ()
+
+add_definitions("-D_SYSCONFDIR_=\"${ETCDIR_ESCAPED}\"")
+
+# /var
+set(VARDIR ""
+  CACHE path
+  "System configuration directory (defaults to prefix/var/arangodb)"
+)
+
+if (VARDIR STREQUAL "")
+  set(VARDIR_NATIVE "${CMAKE_INSTALL_PREFIX}/var")
+  set(VARDIR_INSTALL "var")
+else ()
+  set(VARDIR_NATIVE "${VARDIR}")
+  set(VARDIR_INSTALL "${VARDIR}")
+endif ()
+
+file(TO_NATIVE_PATH "${VARDIR_NATIVE}" VARDIR_NATIVE)
+
+# database directory
+FILE(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/var/lib/arangodb")
+
+# apps
+FILE(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/var/lib/arangodb-apps")
+
+# logs
+FILE(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/var/log/arangodb")
+
+# package
+set(TRI_PKGDATADIR "${CMAKE_INSTALL_PREFIX}/share/arangodb")
+
+# resources
+set(TRI_RESOURCEDIR "resources")
+
+# sbinaries
+if (MSVC)
+  set(ARANGODB_INSTALL_SBIN "bin")
+  set(TRI_SBINDIR "${CMAKE_INSTALL_PREFIX}/bin")
+else ()
+  set(ARANGODB_INSTALL_SBIN "sbin")
+  set(TRI_SBINDIR "${CMAKE_INSTALL_PREFIX}/sbin")
+endif ()

 # MS Windows -------------------------------------------------------------------
 if (MSVC)


Disable some MSVC warnings by default

Disable some MSVC warnings by default

--- cmake/CompileOptions.cmake
+++ cmake/CompileOptions.cmake
@@ -61,6 +61,12 @@
     set(DEFAULT_COMPILE_OPTIONS ${DEFAULT_COMPILE_OPTIONS}
         /MP           # -> build with multiple processes
         /W4           # -> warning level 4
+        # /WX         # -> treat warnings as errors
+
+        /wd4251       # -> disable warning: 'identifier': class 'type' needs to have dll-interface to be used by clients of class 'type2'
+        /wd4592       # -> disable warning: 'identifier': symbol will be dynamically initialized (implementation limitation)
+        # /wd4201     # -> disable warning: nonstandard extension used: nameless struct/union (caused by GLM)
+        # /wd4127     # -> disable warning: conditional expression is constant (caused by Qt)

         $<$<CONFIG:Debug>:
         /RTCc         # -> value is assigned to a smaller data type and results in a data loss
@@ -72,6 +78,11 @@
         /GL           # -> whole program optimization: enable link-time code generation (disables Zi)
         /GF           # -> enable string pooling
         >
+    )
+
+    set(DEFAULT_COMPILE_DEFINITIONS ${DEFAULT_COMPILE_DEFINITIONS}
+        _SCL_SECURE_NO_WARNINGS  # Calling any one of the potentially unsafe methods in the Standard C++ Library
+        _CRT_SECURE_NO_WARNINGS  # Calling any one of the potentially unsafe methods in the CRT Library
     )
 endif ()


For now, using origin/master as the tag so I don't have to keep updating it to test changes.

--- cmake/FetchModernGPU.cmake
+++ cmake/FetchModernGPU.cmake
@@ -10,7 +10,7 @@
     moderngpu
     GIT_REPOSITORY https://github.com/neoblizz/moderngpu.git
     # tag at master branch of neoblizz/moderngpu.
-    GIT_TAG        005129d1cd70906f2b8bc17d95ee35560bc0e151
+    GIT_TAG        origin/master
 )

 FetchContent_GetProperties(moderngpu)


[misc] Fix typo in cmake error messages (#2249)

--- cmake/TaichiCXXFlags.cmake
+++ cmake/TaichiCXXFlags.cmake
@@ -27,11 +27,11 @@
         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -fsized-deallocation")
     elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
         message("GNU compiler detected. Using std=c++17.")
-        message(WARNING "It's detected that you are using GCC as compiler, this is an experimental feature. Consider add -DCMAKE_CXX_COMPILER=clang argument to CMake to switch to Clang (or MSVC on Windows).")
+        message(WARNING "It is detected that you are using gcc as the compiler. This is an experimental feature. Consider adding -DCMAKE_CXX_COMPILER=clang argument to CMake to switch to clang (or MSVC on Windows).")
         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -fsized-deallocation -Wno-class-memaccess -Wno-comment -Wno-sign-compare")
     else()
         message("Invalid compiler ${CMAKE_CXX_COMPILER_ID} detected.")
-        message(FATAL_ERROR "clang and MSVC are the only supported compilers for Taichi compiler development. Consider using 'cmake -DCMAKE_CXX_COMPILER=clang' if you are on Linux")
+        message(FATAL_ERROR "clang and MSVC are the only supported compilers for Taichi compiler development. Consider using 'cmake -DCMAKE_CXX_COMPILER=clang' if you are on Linux.")
     endif()
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall ")
 endif ()


builtins: windows has only one flavour on ARM

Windows on ARM is a hard-float only environment.  Don't try to build two copies
of the same library.

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

--- cmake/base-config-ix.cmake
+++ cmake/base-config-ix.cmake
@@ -153,8 +153,12 @@
       test_target_arch(mips "" "-mips32r2" "--target=mips-linux-gnu")
       test_target_arch(mips64 "" "-mips64r2" "--target=mips64-linux-gnu" "-mabi=64")
     elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "arm")
-      test_target_arch(arm "" "-march=armv7-a" "-mfloat-abi=soft")
-      test_target_arch(armhf "" "-march=armv7-a" "-mfloat-abi=hard")
+      if(WIN32)
+        test_target_arch(arm "" "" "")
+      else()
+        test_target_arch(arm "" "-march=armv7-a" "-mfloat-abi=soft")
+        test_target_arch(armhf "" "-march=armv7-a" "-mfloat-abi=hard")
+      endif()
     elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "aarch32")
       test_target_arch(aarch32 "" "-march=armv8-a")
     elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "aarch64")


build(cmake/modules): update driver version to 33c00f

This driver version, among other things (like userspace instrumentation
support) includes a fix for building the eBPF driver on CentOS 8
machines too.

Co-authored-by: Lorenzo Fontana <638e8f0171575864326f06d2a5f8e72287427b15@linux.com>
Signed-off-by: Leonardo Di Donato <2012e0ca99d70aa6c893822ff73002216e5dba72@gmail.com>

--- cmake/modules/sysdig.cmake
+++ cmake/modules/sysdig.cmake
@@ -26,8 +26,8 @@
 # To update sysdig version for the next release, change the default below
 # In case you want to test against another sysdig version just pass the variable - ie., `cmake -DSYSDIG_VERSION=dev ..`
 if(NOT SYSDIG_VERSION)
-  set(SYSDIG_VERSION "422ab408c5706fbdd45432646cc197eb79459169")
-  set(SYSDIG_CHECKSUM "SHA256=367db2a480bca327a46f901bcc8384f151231bcddba88c719a06cf13971f4ab5")
+  set(SYSDIG_VERSION "33c00f0063d3bc3f35082f2b99d5418180841efe")
+  set(SYSDIG_CHECKSUM "SHA256=3a5c84c0466a5db9da069511661133ac03986230f765d63f91763e9f7144951d")
 endif()
 set(PROBE_VERSION "${SYSDIG_VERSION}")


CMake: Remove MCU core specific option from ARM ASM options

--- cmake/toolchains/ARM.cmake
+++ cmake/toolchains/ARM.cmake
@@ -38,11 +38,14 @@
         $<$<COMPILE_LANGUAGE:CXX>:${common_options}>
 )

+set(asm_preproc_options
+    "--target=arm-arm-none-eabi,-D,MBED_CONF_PLATFORM_CRASH_CAPTURE_ENABLED"
+)
 target_compile_options(mbed-os
     PUBLIC
         $<$<COMPILE_LANGUAGE:ASM>:${MBED_STUDIO_ARM_COMPILER}>
         $<$<COMPILE_LANGUAGE:ASM>:--cpreproc>
-        $<$<COMPILE_LANGUAGE:ASM>:--cpreproc_opts=--target=arm-arm-none-eabi,-mcpu=cortex-m4,-D,__FPU_PRESENT,-D,MBED_CONF_PLATFORM_CRASH_CAPTURE_ENABLED>
+        $<$<COMPILE_LANGUAGE:ASM>:--cpreproc_opts=${asm_preproc_options}>
 )

 target_compile_definitions(mbed-os


fix typo

fix typo

--- cmake/vSMCFindSTDTBB.cmake
+++ cmake/vSMCFindSTDTBB.cmake
@@ -21,11 +21,11 @@
     SET (CMAKE_REQUIRED_DEFINITIONS ${SAFE_CMAKE_RQUIRED_DEFINITIONS}
         -DVSMC_HAS_CXX11LIB_FUTURE=1)
     CHECK_CXX_SOURCE_RUNS ("${VSMC_STDTBB_TEST_SOURCE}" VSMC_FUTURE_FOUND)
-    IF (NOT VSMC_DO_FUTURE)
+    IF (NOT VSMC_NO_FUTURE)
         SET (CMAKE_REQUIRED_DEFINITIONS ${SAFE_CMAKE_RQUIRED_DEFINITIONS}
             -DVSMC_HAS_CXX11LIB_FUTURE=0)
         CHECK_CXX_SOURCE_RUNS ("${VSMC_STDTBB_TEST_SOURCE}" VSMC_THREAD_FOUND)
-    ENDIF (NOT VSMC_DO_FUTURE)
+    ENDIF (NOT VSMC_NO_FUTURE)
     IF (VSMC_THREAD_FOUND OR VSMC_FUTURE_FOUND)
         SET (VSMC_THREAD_LINK_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}
             CACHE STRING "Link to thread")


Fixed finding conan on tetralith

Fixed finding conan on tetralith

Former-commit-id: 817d757b214214b66d42fd0b04b87f7c253196cf

--- cmake-modules/SetupDependenciesConan.cmake
+++ cmake-modules/SetupDependenciesConan.cmake
@@ -62,9 +62,12 @@
             HINTS ${CONAN_PREFIX} $ENV{CONAN_PREFIX} ${CONDA_PREFIX} $ENV{CONDA_PREFIX}
             PATHS $ENV{HOME}/anaconda3  $ENV{HOME}/miniconda3 $ENV{HOME}/anaconda $ENV{HOME}/miniconda $ENV{HOME}/.conda
             PATH_SUFFIXES bin envs/dmrg/bin
-            REQUIRED
     )
-    message(STATUS "Found conan: ${CONAN_COMMAND}")
+    if(NOT CONAN_COMMAND)
+        message(FATAL_ERROR "Could not find conan program executable")
+    else()
+        message(STATUS "Found conan: ${CONAN_COMMAND}")
+    endif()

     # Download cmake-conan automatically, you can also just copy the conan.cmake file
     if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")


Increase version requirement for Trilinos to 11.2

--- cmake/configure/configure_2_trilinos.cmake
+++ cmake/configure/configure_2_trilinos.cmake
@@ -67,31 +67,18 @@
     ENDIF()

     #
-    # Trilinos 10.6 had quite a number of bugs we ran into, see
-    # for example
-    #   https://software.sandia.gov/bugzilla/show_bug.cgi?id=5062
-    #   https://software.sandia.gov/bugzilla/show_bug.cgi?id=5319
+    # We require at least Trilinos 11.2
     #
-    # The same is unfortunately true for 10.8.[01]:
-    #   https://software.sandia.gov/bugzilla/show_bug.cgi?id=5370
-    #
-    IF((TRILINOS_VERSION_MAJOR EQUAL 10 AND
-        TRILINOS_VERSION_MINOR EQUAL 6)
-       OR
-       (TRILINOS_VERSION_MAJOR EQUAL 10 AND
-        TRILINOS_VERSION_MINOR EQUAL 8 AND
-        TRILINOS_VERSION_SUBMINOR LESS 2))
+    IF(TRILINOS_VERSION VERSION_LESS 11.2)

       MESSAGE(STATUS "Could not find a sufficient Trilinos installation: "
-        "Version ${TRILINOS_VERSION_MAJOR}.${TRILINOS_VERSION_MINOR}.${TRILINOS_VERSION_SUBMINOR} has bugs that make "
-        "it incompatible with deal.II. Please use versions before 10.6 or after 10.8.1"
+        "deal.II requires at least version 11.2, but version ${TRILINOS_VERSION} was found."
         )
       SET(TRILINOS_ADDITIONAL_ERROR_STRING
         ${TRILINOS_ADDITIONAL_ERROR_STRING}
         "The Trilinos installation (found at \"${TRILINOS_DIR}\")\n"
-        "with version ${TRILINOS_VERSION_MAJOR}.${TRILINOS_VERSION_MINOR}.${TRILINOS_VERSION_SUBMINOR} has bugs that make\n"
-        "it incompatible with deal.II. Please use versions before 10.6 or after\n"
-        "10.8.1.\n\n"
+        "with version ${TRILINOS_VERSION} is too old.\n"
+        "deal.II requires at least version 11.2.\n\n"
         )
       SET(${var} FALSE)
     ENDIF()


Honour the SKIP_STD argument

Honour the SKIP_STD argument

--- conan.cmake
+++ conan.cmake
@@ -318,7 +318,7 @@

 macro(parse_arguments)
-  set(options BASIC_SETUP CMAKE_TARGETS UPDATE KEEP_RPATHS NO_LOAD NO_OUTPUT_DIRS OUTPUT_QUIET NO_IMPORTS)
+  set(options BASIC_SETUP CMAKE_TARGETS UPDATE KEEP_RPATHS NO_LOAD NO_OUTPUT_DIRS OUTPUT_QUIET NO_IMPORTS SKIP_STD)
   set(oneValueArgs CONANFILE  ARCH BUILD_TYPE INSTALL_FOLDER CONAN_COMMAND)
   set(multiValueArgs DEBUG_PROFILE RELEASE_PROFILE RELWITHDEBINFO_PROFILE MINSIZEREL_PROFILE
                      PROFILE REQUIRES OPTIONS IMPORTS SETTINGS BUILD ENV GENERATORS PROFILE_AUTO
@@ -493,7 +493,7 @@
     endif()

     if(ARGUMENTS_BASIC_SETUP)
-        foreach(_option CMAKE_TARGETS KEEP_RPATHS NO_OUTPUT_DIRS)
+        foreach(_option CMAKE_TARGETS KEEP_RPATHS NO_OUTPUT_DIRS SKIP_STD)
             if(ARGUMENTS_${_option})
                 if(${_option} STREQUAL "CMAKE_TARGETS")
                     list(APPEND _setup_options "TARGETS")


Add compile flag for Irrlicht static lib usage in case of static lib build.

--- CMake/Options/OptionStaticLib.cmake
+++ CMake/Options/OptionStaticLib.cmake
@@ -4,7 +4,9 @@
 	message(STATUS "Build static library...")
 	ADD_DEFINITIONS(
 	-D_IRRIMGUI_STATIC_LIB_
+	-D_IRR_STATIC_LIB_
 	)
+
 else ()
 	message(STATUS "Build shared library...")
 endif ()


Only add visibility flags if compiling with gcc

--- CMake/Utils/OgreConfigTargets.cmake
+++ CMake/Utils/OgreConfigTargets.cmake
@@ -38,10 +38,12 @@
   if (OGRE_STATIC)
     # add static prefix, if compiling static version
     set_target_properties(${LIBNAME} PROPERTIES OUTPUT_NAME ${LIBNAME}Static)
-  else ()
-    # add GCC visibility flags to shared library build
-    set_target_properties(${LIBNAME} PROPERTIES COMPILE_FLAGS "${OGRE_GCC_VISIBILITY_FLAGS}")
-  endif ()
+  else (OGRE_STATIC)
+    if (CMAKE_COMPILER_IS_GNUCXX)
+      # add GCC visibility flags to shared library build
+      set_target_properties(${LIBNAME} PROPERTIES COMPILE_FLAGS "${OGRE_GCC_VISIBILITY_FLAGS}")
+	endif (CMAKE_COMPILER_IS_GNUCXX)
+  endif (OGRE_STATIC)
   install(TARGETS ${LIBNAME}
     RUNTIME DESTINATION "bin${OGRE_RELEASE_PATH}"
       CONFIGURATIONS Release MinSizeRel RelWithDebInfo None


CMake export broke install directory structures; disabled for the moment.

--- CMake/Utils/OgreConfigTargets.cmake
+++ CMake/Utils/OgreConfigTargets.cmake
@@ -48,33 +48,35 @@
 function(ogre_install_target TARGETNAME SUFFIX EXPORT)

 	if(EXPORT)
-	  install(TARGETS ${TARGETNAME}
-		EXPORT Ogre-exports
+	  install(TARGETS ${TARGETNAME} #EXPORT Ogre-exports
 		BUNDLE DESTINATION "bin${OGRE_RELEASE_PATH}" CONFIGURATIONS Release None ""
 		RUNTIME DESTINATION "bin${OGRE_RELEASE_PATH}" CONFIGURATIONS Release None ""
 		LIBRARY DESTINATION "lib${OGRE_LIB_RELEASE_PATH}${SUFFIX}" CONFIGURATIONS Release None ""
 		ARCHIVE DESTINATION "lib${OGRE_LIB_RELEASE_PATH}${SUFFIX}" CONFIGURATIONS Release None ""
 		FRAMEWORK DESTINATION "bin${OGRE_RELEASE_PATH}" CONFIGURATIONS Release None ""
-
+      )
+	  install(TARGETS ${TARGETNAME} #EXPORT Ogre-exports
 		BUNDLE DESTINATION "bin${OGRE_RELWDBG_PATH}" CONFIGURATIONS RelWithDebInfo
 		RUNTIME DESTINATION "bin${OGRE_RELWDBG_PATH}" CONFIGURATIONS RelWithDebInfo
 		LIBRARY DESTINATION "lib${OGRE_LIB_RELWDBG_PATH}${SUFFIX}" CONFIGURATIONS RelWithDebInfo
 		ARCHIVE DESTINATION "lib${OGRE_LIB_RELWDBG_PATH}${SUFFIX}" CONFIGURATIONS RelWithDebInfo
 		FRAMEWORK DESTINATION "bin${OGRE_RELWDBG_PATH}" CONFIGURATIONS RelWithDebInfo
-
+      )
+	  install(TARGETS ${TARGETNAME} #EXPORT Ogre-exports
 		BUNDLE DESTINATION "bin${OGRE_MINSIZE_PATH}" CONFIGURATIONS MinSizeRel
 		RUNTIME DESTINATION "bin${OGRE_MINSIZE_PATH}" CONFIGURATIONS MinSizeRel
 		LIBRARY DESTINATION "lib${OGRE_LIB_MINSIZE_PATH}${SUFFIX}" CONFIGURATIONS MinSizeRel
 		ARCHIVE DESTINATION "lib${OGRE_LIB_MINSIZE_PATH}${SUFFIX}" CONFIGURATIONS MinSizeRel
 		FRAMEWORK DESTINATION "bin${OGRE_MINSIZE_PATH}" CONFIGURATIONS MinSizeRel
-
+      )
+	  install(TARGETS ${TARGETNAME} #EXPORT Ogre-exports
 		BUNDLE DESTINATION "bin${OGRE_DEBUG_PATH}" CONFIGURATIONS Debug
 		RUNTIME DESTINATION "bin${OGRE_DEBUG_PATH}" CONFIGURATIONS Debug
 		LIBRARY DESTINATION "lib${OGRE_LIB_DEBUG_PATH}${SUFFIX}" CONFIGURATIONS Debug
 		ARCHIVE DESTINATION "lib${OGRE_LIB_DEBUG_PATH}${SUFFIX}" CONFIGURATIONS Debug
 		FRAMEWORK DESTINATION "bin${OGRE_DEBUG_PATH}" CONFIGURATIONS Debug
 	  )
-	  install(EXPORT Ogre-exports DESTINATION lib)
+	  #install(EXPORT Ogre-exports DESTINATION lib)
 	else()
 	  install(TARGETS ${TARGETNAME}
 		BUNDLE DESTINATION "bin${OGRE_RELEASE_PATH}" CONFIGURATIONS Release None ""
@@ -82,19 +84,22 @@
 		LIBRARY DESTINATION "lib${OGRE_LIB_RELEASE_PATH}${SUFFIX}" CONFIGURATIONS Release None ""
 		ARCHIVE DESTINATION "lib${OGRE_LIB_RELEASE_PATH}${SUFFIX}" CONFIGURATIONS Release None ""
 		FRAMEWORK DESTINATION "bin${OGRE_RELEASE_PATH}" CONFIGURATIONS Release None ""
-
+      )
+	  install(TARGETS ${TARGETNAME}
 		BUNDLE DESTINATION "bin${OGRE_RELWDBG_PATH}" CONFIGURATIONS RelWithDebInfo
 		RUNTIME DESTINATION "bin${OGRE_RELWDBG_PATH}" CONFIGURATIONS RelWithDebInfo
 		LIBRARY DESTINATION "lib${OGRE_LIB_RELWDBG_PATH}${SUFFIX}" CONFIGURATIONS RelWithDebInfo
 		ARCHIVE DESTINATION "lib${OGRE_LIB_RELWDBG_PATH}${SUFFIX}" CONFIGURATIONS RelWithDebInfo
 		FRAMEWORK DESTINATION "bin${OGRE_RELWDBG_PATH}" CONFIGURATIONS RelWithDebInfo
-
+      )
+	  install(TARGETS ${TARGETNAME}
 		BUNDLE DESTINATION "bin${OGRE_MINSIZE_PATH}" CONFIGURATIONS MinSizeRel
 		RUNTIME DESTINATION "bin${OGRE_MINSIZE_PATH}" CONFIGURATIONS MinSizeRel
 		LIBRARY DESTINATION "lib${OGRE_LIB_MINSIZE_PATH}${SUFFIX}" CONFIGURATIONS MinSizeRel
 		ARCHIVE DESTINATION "lib${OGRE_LIB_MINSIZE_PATH}${SUFFIX}" CONFIGURATIONS MinSizeRel
 		FRAMEWORK DESTINATION "bin${OGRE_MINSIZE_PATH}" CONFIGURATIONS MinSizeRel
-
+      )
+	  install(TARGETS ${TARGETNAME}
 		BUNDLE DESTINATION "bin${OGRE_DEBUG_PATH}" CONFIGURATIONS Debug
 		RUNTIME DESTINATION "bin${OGRE_DEBUG_PATH}" CONFIGURATIONS Debug
 		LIBRARY DESTINATION "lib${OGRE_LIB_DEBUG_PATH}${SUFFIX}" CONFIGURATIONS Debug


cmake: dts: Fix passing multiple EXTRA_DTC_FLAGS to gen_defines.py

Since EXTRA_DTC_FLAGS will be ';' seperated if we pass that as is if
there are multiple items in the list we'll get an error.  Sanitize
EXTRA_DTC_FLAGS by replacing ';' with ' ' before we call gen_defines.py

Signed-off-by: Kumar Gala <a5e5248af4cd4f0ed8c515f61d40a6e2db46a66e@linaro.org>

--- cmake/dts.cmake
+++ cmake/dts.cmake
@@ -210,9 +210,10 @@
   # Run gen_defines.py to create a header file, zephyr.dts, and edt.pickle.
   #

+  string(REPLACE ";" " " EXTRA_DTC_FLAGS_RAW "${EXTRA_DTC_FLAGS}")
   set(CMD_EXTRACT ${PYTHON_EXECUTABLE} ${GEN_DEFINES_SCRIPT}
   --dts ${BOARD}.dts.pre.tmp
-  --dtc-flags '${EXTRA_DTC_FLAGS}'
+  --dtc-flags '${EXTRA_DTC_FLAGS_RAW}'
   --bindings-dirs ${DTS_ROOT_BINDINGS}
   --header-out ${DEVICETREE_UNFIXED_H}
   --device-header-out ${DEVICE_EXTERN_H}


force cmake on MSVC

force cmake on MSVC

--- cmake/lib.cmake
+++ cmake/lib.cmake
@@ -1,4 +1,6 @@
-
+if(WIN32 OR MSVC)
+    set(SECP256K1_USE_CMAKE 1)
+endif()
 include(cmake/secp256k1.cmake)
 include(cmake/libscrypt.cmake)
 include(cmake/core.cmake)


Remove duplicate ${HALLEY_PROJECT_LIBS}

Remove duplicate ${HALLEY_PROJECT_LIBS}

--- cmake/HalleyProject.cmake
+++ cmake/HalleyProject.cmake
@@ -465,7 +465,7 @@
 		set_target_properties(${name} PROPERTIES SUFFIX ".bc")
 	endif()

-	SET(LINK_LIBRARIES ${HALLEY_PROJECT_LIBS})
+	SET(LINK_LIBRARIES "")
 	if (EMBED)
 		SET(LINK_LIBRARIES ${LINK_LIBRARIES} halley-ui halley-core halley-entity halley-audio halley-net halley-lua halley-utils ${HALLEY_PROJECT_EXTERNAL_LIBS})
 		if (USE_OPENGL OR USE_OPENGL_ES2 OR USE_OPENGL_ES3)


Fixes OpenMP cmake helper (removed caching, proper thread flags).

--- cmake/openmp-helper.cmake
+++ cmake/openmp-helper.cmake
@@ -1,22 +1,15 @@
-
-set(HELPER_OPENMP_FOUND OFF CACHE BOOL "OpenMP has been found, do not find again.")
-mark_as_advanced(GEARSHIFFT_OPENMP_FOUND)
-
-function(find_and_add_openmp TARGET)
+macro(find_and_add_openmp TARGET)
   set(_QUIET ${ARGN})

-  if(NOT HELPER_OPENMP_FOUND)
+  find_package(OpenMP ${_QUIET})

-    find_package(OpenMP ${_QUIET})
+  # Have to check several OPENMP_FOUND due to bug in
+  # one version of CMake and the docs (fixed in patch release)
+  # OpenMP is missing on macOS llvm default, for example
+  if(OpenMP_FOUND OR OPENMP_FOUND OR OpenMP_CXX_FOUND)

-    # Have to check several OPENMP_FOUND due to bug in
-    # one version of CMake and the docs (fixed in patch release)
-    # OpenMP is missing on macOS llvm default, for example
-    if(OpenMP_FOUND OR OPENMP_FOUND OR OpenMP_CXX_FOUND)
-
-      set(HELPER_OPENMP_FOUND ON CACHE BOOL "" FORCE)
-      find_package(Threads REQUIRED)
-
+    find_package(Threads REQUIRED)
+    if(Threads_FOUND)
       # CMake 3.9 FindOpenMP allows correct linking with Clang in more cases
       if(TARGET OpenMP::OpenMP_CXX)
         target_link_libraries(${TARGET} INTERFACE OpenMP::OpenMP_CXX)
@@ -28,9 +21,8 @@
         set_property(TARGET ${TARGET}
           PROPERTY INTERFACE_LINK_LIBRARIES ${OpenMP_CXX_FLAGS} Threads::Threads)
       endif()
+    endif()

-    endif() # OpenMP_FOUND
+  endif() # OpenMP_FOUND

-  endif()
-
-endfunction()
+endmacro()


trivial (#3954)

trivial (#3954)

--- cmake/util/FindLLVM.cmake
+++ cmake/util/FindLLVM.cmake
@@ -47,6 +47,7 @@
   elseif(NOT LLVM_CONFIG STREQUAL "OFF")
     # use llvm config
     message(STATUS "Use llvm-config=" ${LLVM_CONFIG})
+    separate_arguments(LLVM_CONFIG)
     execute_process(COMMAND ${LLVM_CONFIG} --libfiles
       OUTPUT_VARIABLE __llvm_libfiles)
     execute_process(COMMAND ${LLVM_CONFIG} --system-libs
@@ -60,7 +61,7 @@
     # definitions
     string(REGEX MATCHALL "(^| )-D[A-Za-z0-9_]*" LLVM_DEFINITIONS ${__llvm_cxxflags})
     # include dir
-    string(REGEX MATCHALL "(^| )-I[^ ]*" __llvm_include_flags ${__llvm_cxxflags})
+    string(REGEX MATCHALL "(^| )-I[^ ]*" __llvm_include_flags ${__llvm_cxxflags})
     set(LLVM_INCLUDE_DIRS "")
     foreach(__flag IN ITEMS ${__llvm_include_flags})
       string(REGEX REPLACE "(^| )-I" "" __dir "${__flag}")


[CI] help for debugging ctest failures

[CI] help for debugging ctest failures

--- CI/cmake/Docker.cmake
+++ CI/cmake/Docker.cmake
@@ -91,7 +91,7 @@
   string(REPLACE ":" "-" DOCKER_WORKDIR_VOLUME ${DOCKER_WORKDIR_VOLUME})
   string(REPLACE "." "-" DOCKER_WORKDIR_VOLUME ${DOCKER_WORKDIR_VOLUME})

-  set(CTEST_OPTIONS_WITHOUT_DOCKER)
+  set(CTEST_OPTIONS_WITHOUT_DOCKER "--output-on-failure")
   # List of options (-DOPTION=VALUE ...) to be passed to ctest
   # Warning : these are not siconos conf. options for cmake but
   # the options needed by ctest to prepare the pipeline (cmake, make ...)


better test output path

better test output path

--- CMake/Wk/WkTest.cmake
+++ CMake/Wk/WkTest.cmake
@@ -31,8 +31,10 @@
 				FILE ( MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/test/${CMAKE_BUILD_TYPE} )
 			ENDIF ( NOT EXISTS ${PROJECT_BINARY_DIR}/test/${CMAKE_BUILD_TYPE} )

-			#Set where main library & test executables should be founded (useful for debuging under VS)
-			SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/test)
+			#Set where test executables should be found
+			SET(${project_name}_TESTS_OUTPUT_PATH ${PROJECT_BINARY_DIR}/test CACHE PATH "Ouput directory for ${Project} tests.")
+			SET(EXECUTABLE_OUTPUT_PATH "${${project_name}_TESTS_OUTPUT_PATH}" CACHE INTERNAL "Internal CMake executables output directory. Do not edit." FORCE)
+
 			#SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)

 			#build


Migrate expat from sourceforge to github

--- SuperBuild/CMake/External_expat.cmake
+++ SuperBuild/CMake/External_expat.cmake
@@ -24,7 +24,7 @@

 ExternalProject_Add(EXPAT
   PREFIX EXPAT
-  URL "https://downloads.sourceforge.net/project/expat/expat/2.4.8/expat-2.4.8.tar.gz"
+  URL "https://github.com/libexpat/libexpat/releases/download/R_2_4_8/expat-2.4.8.tar.gz"
   URL_MD5 ce5fa3fa4d866d83ab0cfb00bb95b77a
   BINARY_DIR ${EXPAT_SB_BUILD_DIR}
   INSTALL_DIR ${SB_INSTALL_PREFIX}


Make sure BOOST_ROOT isn't set when we're searching default system paths

--- util/grappa.cmake
+++ util/grappa.cmake
@@ -31,7 +31,7 @@
   # if boost was not found in third-party, restore any user-specified pointers and search there and in standard paths
   #
   if(NOT Boost_FOUND)
-
+
     # restore any user-specified pointers
     if(Boost_NO_SYSTEM_PATHS_BACKUP)
       set(Boost_NO_SYSTEM_PATHS ${Boost_NO_SYSTEM_PATHS_BACKUP})
@@ -41,6 +41,7 @@
     if(BOOSTROOT_BACKUP)
       set(BOOSTROOT ${BOOSTROOT_BACKUP})
     endif()
+    unset(BOOST_ROOT)
     if(BOOST_ROOT_BACKUP)
       set(BOOST_ROOT ${BOOST_ROOT_BACKUP})
     endif()


Simple change so that it is possible to create binaries on MacOS 10.7 which will run on MacOS 10.6

--- configure.cmake
+++ configure.cmake
@@ -429,7 +429,9 @@
 CHECK_FUNCTION_EXISTS (strcoll HAVE_STRCOLL)
 CHECK_FUNCTION_EXISTS (strerror HAVE_STRERROR)
 CHECK_FUNCTION_EXISTS (strlcpy HAVE_STRLCPY)
+IF(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
 CHECK_FUNCTION_EXISTS (strnlen HAVE_STRNLEN)
+ENDIF()
 CHECK_FUNCTION_EXISTS (strlcat HAVE_STRLCAT)
 CHECK_FUNCTION_EXISTS (strsignal HAVE_STRSIGNAL)
 CHECK_FUNCTION_EXISTS (fgetln HAVE_FGETLN)


Fix var declaration

Fix var declaration

--- configure.cmake
+++ configure.cmake
@@ -24,7 +24,7 @@

 # LLVM_CONFIG_BIN: Directory containing llvm-config executable. Example:
 # set(LLVM_CONFIG_BIN "/Users/je23693/Documents/external-code/llvm5.0/build/bin")
-set(LLVM_CONFIG_BIN ${CMAKE_SOURCE_DIR}/"3rdParty/llvm/prefix/bin/")
+set(LLVM_CONFIG_BIN "${CMAKE_SOURCE_DIR}/3rdParty/llvm/prefix/bin/")

 # ISL paths
 set(ISL_INCLUDE_DIRECTORY "3rdParty/isl/build/include/")


Add -Wsuggest-override

Add -Wsuggest-override

--- cmake/Modules/CppUTestWarningFlags.cmake
+++ cmake/Modules/CppUTestWarningFlags.cmake
@@ -64,12 +64,13 @@

     if (DEFINED CMAKE_CXX_STANDARD AND NOT CMAKE_CXX_STANDARD EQUAL 98)
         set(WARNING_CXX_FLAGS
-           ${WARNING_CXX_FLAGS}
-           Wno-c++98-compat
-           Wno-c++98-compat-pedantic
-           Wno-c++14-compat
-           Wno-inconsistent-missing-destructor-override
-           )
+            ${WARNING_CXX_FLAGS}
+            Wno-c++98-compat
+            Wno-c++98-compat-pedantic
+            Wno-c++14-compat
+            Wno-inconsistent-missing-destructor-override
+            Wsuggest-override
+        )
     endif ()

     check_and_append_c_warning_flags(${WARNING_C_FLAGS})


Add a -ccbin flag in tabg_cuda__find_detect_arch() cmake function.

--- cmake/TbagFindPackage/FindTbagCUDA.cmake
+++ cmake/TbagFindPackage/FindTbagCUDA.cmake
@@ -77,7 +77,7 @@
                 "    return 0;"
                 "}")

-        execute_process (COMMAND "${CUDA_NVCC_EXECUTABLE}" "--run" "${__cuda_source_file}"
+        execute_process (COMMAND "${CUDA_NVCC_EXECUTABLE}" "--run" "${__cuda_source_file}" "-ccbin" "${CMAKE_CXX_COMPILER}"
                 WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/CMakeFiles/"
                 RESULT_VARIABLE __nvcc_exit_code
                 OUTPUT_VARIABLE __nvcc_output


Guard against variable name clashes.

Guard against variable name clashes.

--- cmake/usFunctionCheckCompilerFlags.cmake
+++ cmake/usFunctionCheckCompilerFlags.cmake
@@ -30,6 +30,10 @@
     message(FATAL_ERROR "FLAG_TO_TEST shouldn't be empty")
   endif()

+  # Save the contents of RESULT_VAR temporarily.
+  # This is needed in case ${RESULT_VAR} is one of the CMAKE_<LANG>_FLAGS_* variables.
+  set(_saved_result_var ${${RESULT_VAR}})
+
   # Clear all flags. If not, existing flags triggering warnings might lead to
   # false-negatives when checking for certain compiler flags.
   set(CMAKE_C_FLAGS )
@@ -58,7 +62,7 @@
   CHECK_CXX_COMPILER_FLAG(${FLAG_TO_TEST} HAS_CXX_FLAG_${suffix})

   if(HAS_CXX_FLAG_${suffix})
-    set(${RESULT_VAR} "${${RESULT_VAR}} ${FLAG_TO_TEST}" PARENT_SCOPE)
+    set(${RESULT_VAR} "${_saved_result_var} ${FLAG_TO_TEST}" PARENT_SCOPE)
   endif()

 endfunction()


ENH: Update the WikiExamples remote module commit hash.

Update the WikiExamples remote module commit hash.

Change-Id: Ib1e4d4ae03daecffb08d97f2b212edbaf39e14d1

--- Modules/Remote/WikiExamples.remote.cmake
+++ Modules/Remote/WikiExamples.remote.cmake
@@ -4,15 +4,15 @@

 # If the environment var WikiExamplesTag exists, use it
 if (NOT DEFINED ENV{WikiExamplesTag})
-  set(GIT_TAG 34dcc22d5e943130288a1b23a36c477a1ad1566a
+  set(GIT_TAG ee85e99ab3cdd0dd4bedbdd7893c48a09cab0244
      )
 else()
-  set(GIT_TAG 34dcc22d5e943130288a1b23a36c477a1ad1566a
+  set(GIT_TAG ee85e99ab3cdd0dd4bedbdd7893c48a09cab0244
      )
 endif()

 itk_fetch_module(WikiExamples
   "A collection of examples that illustrate how to use ITK."
   GIT_REPOSITORY ${git_protocol}://github.com/InsightSoftwareConsortium/ITKWikiExamples.git
-  GIT_TAG 34dcc22d5e943130288a1b23a36c477a1ad1566a
+  GIT_TAG ee85e99ab3cdd0dd4bedbdd7893c48a09cab0244
   )


project source file extensions :
        may be defined in <PROJECT_NAME>_SOURCE_FILE_EXTENSIONS
        (default all languages extensions)

git-svn-id: de9bbed4c30e0eb58fe8e7d66f5c80b71699a07c@989 bf01a9d7-0df3-0310-8ad4-b1c94d9ae2d5

--- Numerics/cmake/LibraryProjectSetup.cmake
+++ Numerics/cmake/LibraryProjectSetup.cmake
@@ -6,6 +6,7 @@
 # <PROJECT_NAME>_DIRS : sources directories
 # <PROJECT_NAME>_Unstable_SRCS : built only if -DUNSTABLE=ON
 # <PROJECT_NAME>_VERSION
+# <PROJECT_NAME>_SOURCE_FILE_EXENSIONS may contains the wanted sources extensions (default: all extensions)

 macro(LIBRARY_PROJECT_SETUP)

@@ -14,10 +15,36 @@

 set(_ALL_DIRS ${${PROJECT_NAME}_DIRS})

+#
+
+#
+
+if(NOT ${PROJECT_NAME}_SOURCE_FILE_EXTENSIONS)
+  # all extensions we know (should be done only with the project languages)
+  foreach(_EXT ${CMAKE_CXX_SOURCE_FILE_EXTENSIONS} ${CMAKE_C_SOURCE_FILE_EXTENSIONS} ${CMAKE_Fortran_SOURCE_FILE_EXTENSIONS} ${CMAKE_Java_SOURCE_FILE_EXTENSIONS} ${CMAKE_RC_SOURCE_FILE_EXTENSIONS})
+    list(APPEND _ALL_EXTS *.${_EXT})
+  endforeach(_EXT ${CMAKE_CXX_SOURCE_FILE_EXTENSIONS} ${CMAKE_C_SOURCE_FILE_EXTENSIONS} ${CMAKE_Fortran_SOURCE_FILE_EXTENSIONS} ${CMAKE_Java_SOURCE_FILE_EXTENSIONS} ${CMAKE_RC_SOURCE_FILE_EXTENSIONS})
+else(NOT ${PROJECT_NAME}_SOURCE_FILE_EXTENSIONS)
+  # specified extensions
+  foreach(_EXT ${${PROJECT_NAME}_SOURCE_FILE_EXTENSIONS})
+    list(APPEND _ALL_EXTS *.${_EXT})
+  endforeach(_EXT ${${PROJECT_NAME}_SOURCE_FILE_EXTENSIONS})
+endif(NOT ${PROJECT_NAME}_SOURCE_FILE_EXTENSIONS)
+
 foreach(_DIR ${_ALL_DIRS})
-  file(GLOB _DIR_FILES ${_DIR}/*.[hcf])
+  set(_DIR_FILES)
+  foreach(_EXT ${_ALL_EXTS})
+    file(GLOB _DIR_FILES_EXT ${_DIR}/${_EXT})
+    if(_DIR_FILES_EXT)
+      list(APPEND _DIR_FILES ${_DIR_FILES_EXT})
+    endif(_DIR_FILES_EXT)
+  endforeach(_EXT ${_ALL_EXTS})
   if(_DIR_FILES)
-    list(APPEND _ALL_FILES ${_DIR_FILES})
+    # this prevents duplication
+    if(NOT "${_DIR_FILES}_T")
+      set(${_DIR_FILES}_T T)
+      list(APPEND _ALL_FILES ${_DIR_FILES})
+    endif(NOT "${_DIR_FILES}_T")
   endif(_DIR_FILES)
 endforeach(_DIR ${_ALL_DIRS})


Revert "CMake, Add doc target, whose depends of doxygen."

This reverts commit 491d25216f69999ebb1c16b57818ae4626dd7622.

        * build-aux/cmake/modules/Doxygen.cmake: Here.

--- build-aux/cmake/modules/Doxygen.cmake
+++ build-aux/cmake/modules/Doxygen.cmake
@@ -126,8 +126,6 @@

   add_custom_target(doxygen ${DOXYGEN_EXECUTABLE} ${DOXY_CONFIG})
   add_dependencies(doxygen doxygen_mainpage)
-  add_custom_target(doc)
-  add_dependencies(doc doxygen)

   # create a windows help .chm file using hhc.exe
   # HTMLHelp DLL must be in path!


FIX: link Python.lib on windows

FIX: link Python.lib on windows

--- lib/smurff-cpp/cmake/scripts/FindPythonExtensions.cmake
+++ lib/smurff-cpp/cmake/scripts/FindPythonExtensions.cmake
@@ -351,6 +351,7 @@
   if(_is_module_lib OR _is_shared_lib)
     if(_is_module_lib AND WIN32 AND NOT CYGWIN)
       set_target_properties(${_target} PROPERTIES SUFFIX ".pyd")
+      target_link_libraries( ${_target} ${PYTHON_LIBRARIES} )
     endif()
     if( APPLE )
       set_target_properties( ${_target} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup" )


Compatibility fix for cppcheck 1.61 vs 1.68

--- CppcheckTargets.cmake
+++ CppcheckTargets.cmake
@@ -56,7 +56,7 @@

   set(_cppcheck_args ${CPPCHECK_IGNORED_PATHS} --error-exitcode=2
     --inline-suppr --suppress=preprocessorErrorDirective
-    ${CPPCHECK_EXTRA_ARGS})
+    --suppress=unmatchedSuppression ${CPPCHECK_EXTRA_ARGS})

   if(CPPCHECK_VERSION VERSION_LESS 1.68)
     list(APPEND _cppcheck_args --suppress=unmatchedSuppression)