rm user.cmake

rm user.cmake

--- config/user.cmake
+++ config/user.cmake
@@ -1,234 +0,0 @@
-# Copyright (c) 2010-2020, Lawrence Livermore National Security, LLC. Produced
-# at the Lawrence Livermore National Laboratory. All Rights reserved. See files
-# LICENSE and NOTICE for details. LLNL-CODE-806117.
-#
-# This file is part of the MFEM library. For more information and source code
-# availability visit https://mfem.org.
-#
-# MFEM is free software; you can redistribute it and/or modify it under the
-# terms of the BSD-3 license. We welcome feedback and contributions, see file
-# CONTRIBUTING.md for details.
-
-# See the file INSTALL for description of the configuration options.
-
-# Default options. To replace these, copy this file to user.cmake and modify it.
-
-if (NOT CMAKE_BUILD_TYPE)
-	set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
-      "Build type: Debug, Release, RelWithDebInfo, or MinSizeRel." FORCE)
-endif()
-
-# MFEM options. Set to mimic the default "defaults.mk" file.
-option(MFEM_USE_MPI "Enable MPI parallel build" ON)
-option(MFEM_USE_METIS "Enable METIS usage" ${MFEM_USE_MPI})
-option(MFEM_USE_EXCEPTIONS "Enable the use of exceptions" OFF)
-option(MFEM_USE_ZLIB "Enable zlib for compressed data streams." OFF)
-option(MFEM_USE_LIBUNWIND "Enable backtrace for errors." OFF)
-option(MFEM_USE_LAPACK "Enable LAPACK usage" ON)
-option(MFEM_THREAD_SAFE "Enable thread safety" OFF)
-option(MFEM_USE_OPENMP "Enable the OpenMP backend" OFF)
-option(MFEM_USE_LEGACY_OPENMP "Enable legacy OpenMP usage" OFF)
-option(MFEM_USE_MEMALLOC "Enable the internal MEMALLOC option." ON)
-option(MFEM_USE_SUNDIALS "Enable SUNDIALS usage" OFF)
-option(MFEM_USE_MESQUITE "Enable MESQUITE usage" OFF)
-option(MFEM_USE_SUITESPARSE "Enable SuiteSparse usage" ON)
-option(MFEM_USE_SUPERLU "Enable SuperLU_DIST usage" ON)
-option(MFEM_USE_STRUMPACK "Enable STRUMPACK usage" OFF)
-option(MFEM_USE_GINKGO "Enable Ginkgo usage" OFF)
-option(MFEM_USE_GNUTLS "Enable GNUTLS usage" OFF)
-option(MFEM_USE_GSLIB "Enable GSLIB usage" ON)
-option(MFEM_USE_NETCDF "Enable NETCDF usage" OFF)
-option(MFEM_USE_PETSC "Enable PETSc support." ON)
-option(MFEM_USE_SLEPC "Enable SLEPc support." ON)
-option(MFEM_USE_MPFR "Enable MPFR usage." OFF)
-option(MFEM_USE_SIDRE "Enable Axom/Sidre usage" OFF)
-option(MFEM_USE_CONDUIT "Enable Conduit usage" OFF)
-option(MFEM_USE_PUMI "Enable PUMI" OFF)
-option(MFEM_USE_HIOP "Enable HiOp" OFF)
-option(MFEM_USE_CUDA "Enable CUDA" OFF)
-option(MFEM_USE_OCCA "Enable OCCA" OFF)
-option(MFEM_USE_RAJA "Enable RAJA" OFF)
-option(MFEM_USE_CEED "Enable CEED" OFF)
-option(MFEM_USE_UMPIRE "Enable Umpire" OFF)
-option(MFEM_USE_SIMD "Enable use of SIMD intrinsics" OFF)
-option(MFEM_USE_ADIOS2 "Enable ADIOS2" OFF)
-option(MFEM_USE_ADEPT "Enable AD using ADEPT" OFF)
-option(MFEM_USE_FADBADPP "Enable AD using FADBAD++" OFF)
-option(MFEM_USE_CODIPACK "Enable AD using CoDiPack" OFF)
-option(MFEM_USE_EIGEN "Enable Eigen" OFF)
-option(MFEM_USE_ADFORWARD "Enable forward mode for AD" OFF)
-option(MFEM_USE_CALIPER "Enable Caliper support" OFF)
-option(MFEM_USE_BLITZ   "Enable Blitz support" ON)
-option(MFEM_USE_ALGOIM  "Enable Algoim support" ON)
-
-
-
-set(MFEM_MPI_NP 4 CACHE STRING "Number of processes used for MPI tests")
-
-# Allow a user to disable testing, examples, and/or miniapps at CONFIGURE TIME
-# if they don't want/need them (e.g. if MFEM is "just a dependency" and all they
-# need is the library, building all that stuff adds unnecessary overhead). Note
-# that the examples or miniapps can always be built using the targets 'examples'
-# or 'miniapps', respectively.
-option(MFEM_ENABLE_TESTING "Enable the ctest framework for testing" ON)
-option(MFEM_ENABLE_EXAMPLES "Build all of the examples" OFF)
-option(MFEM_ENABLE_MINIAPPS "Build all of the miniapps" ON)
-
-# Setting CXX/MPICXX on the command line or in user.cmake will overwrite the
-# autodetected C++ compiler.
-# set(CXX g++)
-
-# Set the target CUDA architecture
-set(CUDA_ARCH "sm_60" CACHE STRING "Target CUDA architecture.")
-
-set(MFEM_DIR ${CMAKE_CURRENT_SOURCE_DIR})
-
-# The *_DIR paths below will be the first place searched for the corresponding
-# headers and library. If these fail, then standard cmake search is performed.
-# Note: if the variables are already in the cache, they are not overwritten.
-
-set(HYPRE_DIR "/home/blaz/develop/dbg/petsc" CACHE PATH
-    "Path to the hypre library.")
-# If hypre was compiled to depend on BLAS and LAPACK:
-# set(HYPRE_REQUIRED_PACKAGES "BLAS" "LAPACK" CACHE STRING
-#     "Packages that HYPRE depends on.")
-
-set(METIS_DIR "/home/blaz/develop/dbg/petsc" CACHE PATH "Path to the METIS library.")
-
-set(LIBUNWIND_DIR "" CACHE PATH "Path to Libunwind.")
-
-# For sundials_nvecparhyp and nvecparallel remember to build with MPI_ENABLED=ON
-# and modify cmake variables for hypre for sundials
-set(SUNDIALS_DIR "/home/blaz/develop/dbg/sundials" CACHE PATH
-    "Path to the SUNDIALS library.")
-# The following may be necessary, if SUNDIALS was built with KLU:
-# set(SUNDIALS_REQUIRED_PACKAGES "SuiteSparse/KLU/AMD/BTF/COLAMD/config"
-#     CACHE STRING "Additional packages required by SUNDIALS.")
-
-set(MESQUITE_DIR "${MFEM_DIR}/../mesquite-2.99" CACHE PATH
-    "Path to the Mesquite library.")
-
-set(SuiteSparse_DIR "/home/blaz/develop/dbg/petsc" CACHE PATH
-    "Path to the SuiteSparse library.")
-set(SuiteSparse_REQUIRED_PACKAGES "BLAS" "METIS"
-    CACHE STRING "Additional packages required by SuiteSparse.")
-
-set(ParMETIS_DIR "/home/blaz/develop/dbg/petsc" CACHE PATH
-    "Path to the ParMETIS library.")
-set(ParMETIS_REQUIRED_PACKAGES "METIS" CACHE STRING
-    "Additional packages required by ParMETIS.")
-
-set(SuperLUDist_DIR "/home/blaz/develop/dbg/petsc" CACHE PATH
-    "Path to the SuperLU_DIST library.")
-# SuperLU_DIST may also depend on "OpenMP", depending on how it was compiled.
-set(SuperLUDist_REQUIRED_PACKAGES "MPI" "BLAS" "ParMETIS" CACHE STRING
-    "Additional packages required by SuperLU_DIST.")
-
-set(STRUMPACK_DIR "${MFEM_DIR}/../STRUMPACK-build" CACHE PATH
-    "Path to the STRUMPACK library.")
-# STRUMPACK may also depend on "OpenMP", depending on how it was compiled.
-# Starting with v2.2.0 of STRUMPACK, ParMETIS and Scotch are optional.
-set(STRUMPACK_REQUIRED_PACKAGES "MPI" "MPI_Fortran" "ParMETIS" "METIS"
-    "ScaLAPACK" "Scotch/ptscotch/ptscotcherr/scotch/scotcherr" CACHE STRING
-    "Additional packages required by STRUMPACK.")
-# If the MPI package does not find all required Fortran libraries:
-# set(STRUMPACK_REQUIRED_LIBRARIES "gfortran" "mpi_mpifh" CACHE STRING
-#     "Additional libraries required by STRUMPACK.")
-
-# The Scotch library, required by STRUMPACK <= v2.1.0, optional in STRUMPACK >=
-# v2.2.0.
-set(Scotch_DIR "/home/blaz/develop/dbg/petsc" CACHE PATH
-    "Path to the Scotch and PT-Scotch libraries.")
-set(Scotch_REQUIRED_PACKAGES "Threads" CACHE STRING
-    "Additional packages required by Scotch.")
-# Tell the "Threads" package/module to prefer pthreads.
-set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
-set(Threads_LIB_VARS CMAKE_THREAD_LIBS_INIT)
-
-# The ScaLAPACK library, required by STRUMPACK
-set(ScaLAPACK_DIR "${MFEM_DIR}/../scalapack-2.0.2/lib/cmake/scalapack-2.0.2"
-    CACHE PATH "Path to the configuration file scalapack-config.cmake")
-set(ScaLAPACK_TARGET_NAMES scalapack)
-# set(ScaLAPACK_TARGET_FORCE)
-# set(ScaLAPACK_IMPORT_CONFIG DEBUG)
-
-set(Ginkgo_DIR "${MFEM_DIR}/../ginkgo" CACHE PATH "Path to the Ginkgo library.")
-
-set(GNUTLS_DIR "" CACHE PATH "Path to the GnuTLS library.")
-
-set(GSLIB_DIR "/home/blaz/develop/dbg/gslib/build" CACHE PATH "Path to the GSLIB library.")
-
-set(NETCDF_DIR "/home/blaz/develop/dbg/petsc" CACHE PATH "Path to the NetCDF library.")
-# May need to add "HDF5" as requirement.
-set(NetCDF_REQUIRED_PACKAGES "" CACHE STRING
-    "Additional packages required by NetCDF.")
-
-set(PETSC_DIR "/home/blaz/develop/dbg/petsc" CACHE PATH
-    "Path to the PETSc main directory.")
-set(PETSC_ARCH "" CACHE STRING "PETSc build architecture.")
-
-set(SLEPC_DIR "/home/blaz/develop/dbg/petsc" CACHE PATH
-    "Path to the SLEPc main directory.")
-set(SLEPC_ARCH "" CACHE STRING "SLEPC build architecture.")
-
-set(MPFR_DIR "" CACHE PATH "Path to the MPFR library.")
-
-set(CONDUIT_DIR "${MFEM_DIR}/../conduit" CACHE PATH
-    "Path to the Conduit library.")
-
-set(AXOM_DIR "${MFEM_DIR}/../axom" CACHE PATH "Path to the Axom library.")
-# May need to add "Boost" as requirement.
-set(Axom_REQUIRED_PACKAGES "Conduit/relay/blueprint" CACHE STRING
-    "Additional packages required by Axom.")
-
-set(PUMI_DIR "${MFEM_DIR}/../pumi-2.1.0" CACHE STRING
-    "Directory where PUMI is installed")
-
-set(HIOP_DIR "${MFEM_DIR}/../hiop/install" CACHE STRING
-    "Directory where HiOp is installed")
-set(HIOP_REQUIRED_PACKAGES "BLAS" "LAPACK" CACHE STRING
-    "Packages that HiOp depends on.")
-
-set(CODIPACK_DIR "/home/blaz/develop/opt/CoDiPack"  CACHE STRING
-	"Directory where CoDiPack is installed")
-set(CODIPACK_INCLUDE_DIRS "/home/blaz/develop/opt/CoDiPack/include"
-	CACHE STRING "Path to CoDiPack headers.")
-
-set(OCCA_DIR "${MFEM_DIR}/../occa" CACHE PATH "Path to OCCA")
-set(RAJA_DIR "${MFEM_DIR}/../raja" CACHE PATH "Path to RAJA")
-set(CEED_DIR "${MFEM_DIR}/../libCEED" CACHE PATH "Path to libCEED")
-set(UMPIRE_DIR "${MFEM_DIR}/../umpire" CACHE PATH "Path to Umpire")
-
-set(BLAS_INCLUDE_DIRS "" CACHE STRING "Path to BLAS headers.")
-set(BLAS_LIBRARIES "/home/blaz/develop/dbg/petsc/lib/libopenblas.so" CACHE STRING "The BLAS library.")
-set(LAPACK_INCLUDE_DIRS "" CACHE STRING "Path to LAPACK headers.")
-set(LAPACK_LIBRARIES "" CACHE STRING "The LAPACK library.")
-
-
-set(ZLIB_INCLUDE_DIR "/home/blaz/develop/dbg/petsc/include" CACHE STRING "Path to ZLIB headers.")
-set(ZLIB_LIBRARIES "/home/blaz/develop/dbg/petsc/lib/libz.a" CACHE STRING "The ZLIB library.")
-
-set(ADEPT_INCLUDE_DIRS "${MFEM_DIR}/../adept-1.1/include" CACHE STRING "Path to ADEPT headers.")
-set(ADEPT_LIBRARIES "-L${MFEM_DIR}/../adept-1.1/lib -ladept" CACHE STRING "The ADEPT library.")
-
-set(FADBADPP_INCLUDE_DIRS "${MFEM_DIR}/../FADBAD++" CACHE STRING "Path to FADBAD++ headers.")
-set(FADBADPP_LIBRARIES "")
-
-set(CALIPER_DIR "/home/blaz/develop/dbg/caliper" CACHE PATH "Path to Caliper")
-set(CALIPER_INCLUDE_DIRS "/home/blaz/develop/dbg/caliper/include" CACHE PATH "Path to Caliper headers.")
-set(CALIPER_LIBRARIES "/home/blaz/develop/dbg/caliper/lib/libcaliper.so" CACHE STRING "The Caliper library.")
-
-set(BLITZ_DIR "/home/blaz/develop/dbg/blitz" CACHE PATH "Path to Blitz")
-set(BLITZ_INCLUDE_DIRS  "/home/blaz/develop/dbg/blitz/include" CACHE PATH "Path to Blitz headers.")
-set(BLITZ_LIBRARIES "/home/blaz/develop/dbg/blitz/lib/libblitz.a" CACHE PATH "Path to Blitz library.")
-
-set(ALGOIM_DIR "/home/blaz/develop/wrk/algoim" CACHE PATH "Path to Algoim")
-set(ALGOIM_INCLUDE_DIRS "/home/blaz/develop/wrk/algoim/src" CACHE PATH "Path to Algoin headers.")
-set(ALGOIM_LIBRARIES "" CACHE STRING "The Algoim library.")
-
-
-
-# Some useful variables:
-set(CMAKE_SKIP_PREPROCESSED_SOURCE_RULES ON) # Skip *.i rules
-set(CMAKE_SKIP_ASSEMBLY_SOURCE_RULES  ON)    # Skip *.s rules
-# set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "Verbose makefiles.")


- updated cmake for add_boost_test

 - updated cmake for add_boost_test

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

--- rdo/rdo_studio/branches/dev_linux/cmake/add_boost_test.cmake
+++ rdo/rdo_studio/branches/dev_linux/cmake/add_boost_test.cmake
@@ -10,6 +10,10 @@
 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
 INCLUDE_DIRECTORIES(${RDO_BASE_DIRECTORY})

+IF(MSVC)
+    SET(Boost_USE_STATIC_LIBS   ON)
+    SET(Boost_USE_MULTITHREADED ON)
+ENDIF(MSVC)
 FIND_PACKAGE(Boost COMPONENTS unit_test_framework REQUIRED)
 INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})

@@ -17,12 +21,12 @@
 ADD_TEST(NAME ${ARGV0} COMMAND ${EXECUTABLE_OUTPUT_PATH}/${ARGV0})

 IF(MSVC)
-	SET_TARGET_PROPERTIES(${ARGV0} PROPERTIES COMPILE_FLAGS "/EHa")
+    SET_TARGET_PROPERTIES(${ARGV0} PROPERTIES COMPILE_FLAGS "/EHa")
 ENDIF(MSVC)

 TARGET_LINK_LIBRARIES(${ARGV0} ${Boost_LIBRARIES})

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

 ENDMACRO(ADD_BOOST_TEST)


COMP: superbuild: fix cmake cache entries in OTB

--- SuperBuild/CMake/External_otb.cmake
+++ SuperBuild/CMake/External_otb.cmake
@@ -142,10 +142,12 @@
 endif()

 # forward compilation flags
+set(OTB_SB_C_FLAGS "${SB_PRIOR_INCLUDE_FLAGS} ${CMAKE_C_FLAGS}")
+set(OTB_SB_CXX_FLAGS "${SB_PRIOR_INCLUDE_FLAGS} ${CMAKE_CXX_FLAGS}")
 set(OTB_SB_COMPILATION_FLAGS
     -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-    -DCMAKE_C_FLAGS:STRING="${SB_PRIOR_INCLUDE_FLAGS} ${CMAKE_C_FLAGS}"
-    -DCMAKE_CXX_FLAGS:STRING="${SB_PRIOR_INCLUDE_FLAGS} ${CMAKE_CXX_FLAGS}"
+    -DCMAKE_C_FLAGS:STRING=${OTB_SB_C_FLAGS}
+    -DCMAKE_CXX_FLAGS:STRING=${OTB_SB_CXX_FLAGS}
     -DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_EXE_LINKER_FLAGS}
     -DCMAKE_MODULE_LINKER_FLAGS:STRING=${CMAKE_MODULE_LINKER_FLAGS}
     -DCMAKE_SHARED_LINKER_FLAGS:STRING=${CMAKE_SHARED_LINKER_FLAGS}


BUG: fix qt5 compilation on ubuntu 18.04

This commit not only includes the bugfix for qt5 on ubuntu but also some improvments in the qt5 external project.

The fix concern only the following modification:

- add -qt-harfbuzz in the configure script to fix libz conflict

Other minor updates:

- upgrade qt version to last stable release 5.11.1
- remove commented cmake configuration related to qt4
- add options -optimize-size and -silent options in the configure script to optimize the package

see https://blog.qt.io/blog/2017/05/31/qt-lite-qt-5-9-lts/ for detail about the size optimization (contrl compiler flags)

silent option reduce the output generated in the build tree. Perhaps not a good idea...

--- SuperBuild/CMake/External_qt5.cmake
+++ SuperBuild/CMake/External_qt5.cmake
@@ -21,17 +21,6 @@
 INCLUDE_ONCE_MACRO(QT5)

 SETUP_SUPERBUILD(QT5)
-
-#RK: are we ready for QT4 build on linux?.
-#This comment here scares me away.
-#Installing QT4 from packages also need sqlite otherwise there is issue
-
-# if(UNIX AND NOT APPLE)
-#   message(STATUS "  SuperBuild may fail to compile Qt4. If so, you should install it via package manager.")
-# endif()
-
-
-#set(QT4_SB_ENABLE_GTK OFF CACHE INTERNAL "Enable GTK+ style with qt using -gtkstlye. Default is OFF")

 #NOTE: make sure your superbuild install directory does not contain any
 #Qt files from previous install of superbuild QT.
@@ -102,30 +91,14 @@
   -skip qtwinextras  \
   -skip qtx11extras  \
   -skip qtxmlpatterns \
-  -system-libpng -system-libjpeg -system-zlib -system-freetype")
-# "-prefix ${QT4_INSTALL_PREFIX_NATIVE} -L ${QT4_LIB_PREFIX_NATIVE} \
-# -I ${QT4_INCLUDE_PREFIX_NATIVE} -I ${QT4_INCLUDE_FREETYPE_NATIVE} \
-# -opensource -confirm-license -release -shared -nomake demos \
-# -nomake examples -nomake tools -no-phonon-backend -no-phonon -no-script \
-# -no-scripttools -no-multimedia -no-audio-backend -no-webkit -no-declarative \
-# -no-accessibility -no-qt3support -no-xmlpatterns -no-sql-sqlite -no-openssl \
-# -no-libtiff -no-libmng -system-libpng -system-libjpeg -system-zlib")
-
-#RK: building faling on mac. png include is in a macframework
-# if(USE_SYSTEM_PNG)
-  # set(QT4_SB_CONFIG "${QT4_SB_CONFIG} -I ${PNG_PNG_INCLUDE_DIR}")
-# endif()
+  -system-libpng -system-libjpeg -system-zlib -system-freetype -qt-harfbuzz -optimize-size -silent")

 if(UNIX)
   if(APPLE)
     set(QT5_SB_CONFIG "${QT5_SB_CONFIG} -no-framework")
-  else() #Linux
-#    if(QT5_SB_ENABLE_GTK)
-#      message(WARNING "QT5_SB_ENABLE_GTK support is experimental")
-#      set(QT5_SB_CONFIG "${QT5_SB_CONFIG} -sm -xrender -xrandr -gtkstyle")
-#    else()
+  else()
+      #Linux
       set(QT5_SB_CONFIG "${QT5_SB_CONFIG} -no-glib -no-fontconfig")
-#    endif()
   endif()
   #common for all unix
   set(QT5_SB_CONFIG "${QT5_SB_CONFIG} -no-dbus -no-icu -v")
@@ -151,52 +124,20 @@

 configure_file( ${QT5_CONFIGURE_COMMAND_IN} ${QT5_CONFIGURE_COMMAND} @ONLY )

-#Remove left over or previous installation from install prefix.
-#Existing files in install prefix was disturbing a second installation.
-#even after the QT4 directory is removed from build
-
-# add_custom_target(QT4-uninstall
-#   COMMAND ${CMAKE_COMMAND} -E remove_directory "${SB_INSTALL_PREFIX}/include/QtCore"
-#   COMMAND ${CMAKE_COMMAND} -E remove_directory "${SB_INSTALL_PREFIX}/include/QtDBus"
-#   COMMAND ${CMAKE_COMMAND} -E remove_directory "${SB_INSTALL_PREFIX}/include/QtGui"
-#   COMMAND ${CMAKE_COMMAND} -E remove_directory "${SB_INSTALL_PREFIX}/include/QtNetwork"
-#   COMMAND ${CMAKE_COMMAND} -E remove_directory "${SB_INSTALL_PREFIX}/include/QtOpenGL"
-#   COMMAND ${CMAKE_COMMAND} -E remove_directory "${SB_INSTALL_PREFIX}/include/QtSql"
-#   COMMAND ${CMAKE_COMMAND} -E remove_directory "${SB_INSTALL_PREFIX}/include/QtSvg"
-#   COMMAND ${CMAKE_COMMAND} -E remove_directory "${SB_INSTALL_PREFIX}/include/QtTest"
-#   COMMAND ${CMAKE_COMMAND} -E remove_directory "${SB_INSTALL_PREFIX}/include/QtXml"
-#   COMMAND ${CMAKE_COMMAND} -E remove_directory "${SB_INSTALL_PREFIX}/include/Qt"
-#   COMMAND ${CMAKE_COMMAND} -E remove_directory "${SB_INSTALL_PREFIX}/mkspecs"
-#   COMMAND ${CMAKE_COMMAND} -E remove_directory "${SB_INSTALL_PREFIX}/plugins"
-#   COMMAND ${CMAKE_COMMAND} -E remove_directory "${SB_INSTALL_PREFIX}/translations"
-#   COMMAND ${CMAKE_COMMAND} -E remove -f "${SB_INSTALL_PREFIX}/lib/libQt*"
-#   COMMAND ${CMAKE_COMMAND} -E remove -f "${SB_INSTALL_PREFIX}/lib/pkgconfig/Qt*"
-#   COMMAND ${CMAKE_COMMAND} -E remove -f "${SB_INSTALL_PREFIX}/bin/qmake${QT4_BIN_EXT}"
-#   COMMAND ${CMAKE_COMMAND} -E remove -f "${SB_INSTALL_PREFIX}/bin/lrelease${QT4_BIN_EXT}"
-#   COMMAND ${CMAKE_COMMAND} -E remove -f "${SB_INSTALL_PREFIX}/bin/moc${QT4_BIN_EXT}"
-#   COMMAND ${CMAKE_COMMAND} -E remove -f "${SB_INSTALL_PREFIX}/bin/rcc${QT4_BIN_EXT}"
-#   COMMAND ${CMAKE_COMMAND} -E remove -f "${SB_INSTALL_PREFIX}/bin/uic${QT4_BIN_EXT}"
-#   COMMAND ${CMAKE_COMMAND} -E remove -f "${SB_INSTALL_PREFIX}/bin/libQt*"
-#   WORKING_DIRECTORY "${SB_INSTALL_PREFIX}"
-#   )
-
-#adding it to dependencies will remove the files when configure QWT
-#list(APPEND QT4_DEPENDENCIES QT4-uninstall)
-
-  ExternalProject_Add(QT5
-    PREFIX QT5
-    URL "http://download.qt.io/official_releases/qt/5.10/5.10.1/single/qt-everywhere-src-5.10.1.tar.xz"
-    URL_MD5 7e167b9617e7bd64012daaacb85477af
-    BINARY_DIR ${QT5_SB_BUILD_DIR}
-    INSTALL_DIR ${SB_INSTALL_PREFIX}
-    DOWNLOAD_DIR ${DOWNLOAD_LOCATION}
-    CONFIGURE_COMMAND ${QT5_CONFIGURE_COMMAND}
-    DEPENDS ${QT5_DEPENDENCIES}
-    LOG_DOWNLOAD 1
-    LOG_CONFIGURE 1
-    LOG_BUILD 1
-    LOG_INSTALL 1
-    )
+ExternalProject_Add(QT5
+  PREFIX QT5
+  URL "http://download.qt.io/official_releases/qt/5.11/5.11.1/single/qt-everywhere-src-5.11.1.tar.xz"
+  URL_MD5 c6f0854d7de7bde80cfd8cc85bb7152b
+  BINARY_DIR ${QT5_SB_BUILD_DIR}
+  INSTALL_DIR ${SB_INSTALL_PREFIX}
+  DOWNLOAD_DIR ${DOWNLOAD_LOCATION}
+  CONFIGURE_COMMAND ${QT5_CONFIGURE_COMMAND}
+  DEPENDS ${QT5_DEPENDENCIES}
+  LOG_DOWNLOAD 1
+  LOG_CONFIGURE 1
+  LOG_BUILD 1
+  LOG_INSTALL 1
+  )

 SUPERBUILD_PATCH_SOURCE(QT5)

@@ -204,11 +145,11 @@

 if(UNIX AND NOT APPLE)
   ExternalProject_Add_Step(QT5 adding_font
-  COMMAND ${CMAKE_COMMAND}
-  -D BUILD_DIR=${QT5_SB_BUILD_DIR}
-  -D INSTALL_DIR=${SB_INSTALL_PREFIX}
-  -D DOWNLOAD_LOCATION=${DOWNLOAD_LOCATION}
-  -P ${CMAKE_SOURCE_DIR}/CMake/External_font.cmake
+  COMMAND ${CMAKE_COMMAND}
+  -D BUILD_DIR=${QT5_SB_BUILD_DIR}
+  -D INSTALL_DIR=${SB_INSTALL_PREFIX}
+  -D DOWNLOAD_LOCATION=${DOWNLOAD_LOCATION}
+  -P ${CMAKE_SOURCE_DIR}/CMake/External_font.cmake
   DEPENDEES install
   WORKING_DIRECTORY ${SB_INSTALL_PREFIX} )
 endif()


SuperBuild: change QT5 build directory

SuperBuild: change QT5 build directory

--- SuperBuild/CMake/External_qt5.cmake
+++ SuperBuild/CMake/External_qt5.cmake
@@ -180,7 +180,7 @@
     PREFIX QT5
     URL "http://download.qt.io/official_releases/qt/5.10/5.10.1/single/qt-everywhere-src-5.10.1.tar.xz"
     URL_MD5 7e167b9617e7bd64012daaacb85477af
-    BINARY_DIR ${QT5_SB_SRC}
+    BINARY_DIR ${QT5_SB_BUILD_DIR}
     INSTALL_DIR ${SB_INSTALL_PREFIX}
     DOWNLOAD_DIR ${DOWNLOAD_LOCATION}
     CONFIGURE_COMMAND ${QT5_CONFIGURE_COMMAND}


Use CCPPETMR fork for Gadgetron

Use CCPPETMR fork for Gadgetron

--- SuperBuild/External_Gadgetron.cmake
+++ SuperBuild/External_Gadgetron.cmake
@@ -41,7 +41,7 @@

   ### --- Project specific additions here
   set(Gadgetron_Install_Dir ${CMAKE_CURRENT_BINARY_DIR}/INSTALL)
-  set(${proj}_URL https://github.com/gadgetron/gadgetron )
+  set(${proj}_URL https://github.com/CCPPETMR/gadgetron )

   #message(STATUS "HDF5_ROOT in External_SIRF: " ${HDF5_ROOT})
   set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${CMAKE_CURRENT_BINARY_DIR}/INSTALL)


BUG: GIT_PROTOCOL was not defined if CTK was not enabled.

--- CMake/SuperBuild.cmake
+++ CMake/SuperBuild.cmake
@@ -39,6 +39,23 @@
 set( TubeTK_DEPENDS "" )

 set( gen "${CMAKE_GENERATOR}" )
+
+##
+## Find GIT and determine proper protocol for accessing GIT repos.
+##  - Users may need to choose HTTP is they are behind a firewall.
+##
+if( NOT GIT_EXECUTABLE )
+  find_package( Git REQUIRED )
+endif( NOT GIT_EXECUTABLE )
+
+option( GIT_PROTOCOL_HTTP
+  "Use HTTP for git access (useful if behind a firewall)" OFF )
+if( GIT_PROTOCOL_HTTP )
+  set( GIT_PROTOCOL "http" CACHE STRING "Git protocol for file transfer" )
+else( GIT_PROTOCOL_HTTP )
+  set( GIT_PROTOCOL "git" CACHE STRING "Git protocol for file transfer" )
+endif( GIT_PROTOCOL_HTTP )
+mark_as_advanced( GIT_PROTOCOL )

 ##
 ## Check if system TubeTK or superbuild TubeTK
@@ -302,19 +319,6 @@
     if( TubeTK_USE_CTK )

       if( NOT USE_SYSTEM_CTK )
-
-        if( NOT GIT_EXECUTABLE )
-          find_package( Git REQUIRED )
-        endif( NOT GIT_EXECUTABLE )
-
-        option( GIT_PROTOCOL_HTTP
-          "Use HTTP for git access (useful if behind a firewall)" OFF )
-        if( GIT_PROTOCOL_HTTP )
-          set( GIT_PROTOCOL "http" CACHE STRING "Git protocol for file transfer" )
-        else( GIT_PROTOCOL_HTTP )
-          set( GIT_PROTOCOL "git" CACHE STRING "Git protocol for file transfer" )
-        endif( GIT_PROTOCOL_HTTP )
-        mark_as_advanced( GIT_PROTOCOL )

         if( TubeTK_USE_VTK )
           if( NOT USE_SYSTEM_VTK )


Fixed test step

Fixed test step

--- Protobuf.cmake
+++ Protobuf.cmake
@@ -14,7 +14,7 @@
         CONFIGURE_COMMAND  pwd && ./autogen.sh && ./configure --prefix=${PROJECT_SOURCE_DIR}/external
         BUILD_COMMAND cd ${Protobuf_DOWNLOAD_DIR} & make
         #TEST_BEFORE_INSTALL 1
-        #TEST_COMMAND #cd ${protobuf_DOWNLOAD_DIR make check
+        #TEST_COMMAND cd ${Protobuf_DOWNLOAD_DIR} && make check
         INSTALL_COMMAND make install)

 include_directories(${Protobuf_INCLUDE_DIRS})


[cmake]: Fixed mock register function

[cmake]: Fixed mock register function

* REQUIRES was missing from multi value args

--- tools/cmake/component.cmake
+++ tools/cmake/component.cmake
@@ -530,7 +530,7 @@
 function(idf_component_mock)
     set(options)
     set(single_value)
-    set(multi_value MOCK_HEADER_FILES INCLUDE_DIRS)
+    set(multi_value MOCK_HEADER_FILES INCLUDE_DIRS REQUIRES)
     cmake_parse_arguments(_ "${options}" "${single_value}" "${multi_value}" ${ARGN})

     list(APPEND __REQUIRES "cmock")


Adapt the ODBC_LIBRARIES for Windows platform based on nanodbc.

--- CMake/Modules/FindODBC.cmake
+++ CMake/Modules/FindODBC.cmake
@@ -30,8 +30,8 @@
 #

 if (WIN32)
-    set (ODBC_INCLUDE_DIRS)     # The headers should be available in the default include search path
-    set (ODBC_LIBRARIES odbc32) # This should be also the case for MinGW cross-compiler toolchain
+    set (ODBC_INCLUDE_DIRS " ")     # The headers should be available in the default include search path
+    set (ODBC_LIBRARIES odbc32 odbccp32 ws2_32) # This should be also the case for MinGW cross-compiler toolchain
     set (ODBC_DEFINES)
     set (ODBC_VERSION 3)        # Assume it is 3
 else ()


ENH: Bump SEM for smaller sized CLI's that load faster.

This includes
Slicer/SlicerExecutionModel@8d607ff93a3be76274d9cedfb9f1148a6cdb6968
which makes the binary size of CLI's smaller and makes them load faster. This
commit has already been integrated into Slicer.

--- CMake/Superbuild/ExternalProjectsConfig.cmake
+++ CMake/Superbuild/ExternalProjectsConfig.cmake
@@ -92,7 +92,7 @@
 # Slicer Execution Model
 set( SlicerExecutionModel_URL
   ${github_protocol}://github.com/Slicer/SlicerExecutionModel.git )
-set( SlicerExecutionModel_HASH_OR_TAG 311eff9038be165c1341dab90196fbd7466e715a )
+set( SlicerExecutionModel_HASH_OR_TAG 112076be4f7ee59cc67099f12f2c4c16719070da )

 # Visualization Toolkit (3D Slicer fork)
 set( VTK_URL ${github_protocol}://github.com/Slicer/VTK.git )


CMake: Fix Cortex M7 flag passed to assembler

--- tools/cmake/cores/Cortex-M7.cmake
+++ tools/cmake/cores/Cortex-M7.cmake
@@ -28,7 +28,7 @@
             INTERFACE
                 $<$<COMPILE_LANGUAGE:C>:${compile_options}>
                 $<$<COMPILE_LANGUAGE:CXX>:${compile_options}>
-                $<$<COMPILE_LANGUAGE:ASM>:-mcpu=Cortex-M7.no_fp>
+                $<$<COMPILE_LANGUAGE:ASM>:${compile_options}>
         )

         target_link_options(${target}


Dependencies: update to latest SDL2 release

--- CMake/Dependencies.cmake
+++ CMake/Dependencies.cmake
@@ -111,15 +111,15 @@
     if(MSVC OR MINGW OR SKBUILD) # other platforms dont need this
         message(STATUS "Building SDL2")
         file(DOWNLOAD
-            https://libsdl.org/release/SDL2-2.0.14.tar.gz
-            ${PROJECT_BINARY_DIR}/SDL2-2.0.14.tar.gz)
+            https://libsdl.org/release/SDL2-2.0.18.tar.gz
+            ${PROJECT_BINARY_DIR}/SDL2-2.0.18.tar.gz)
         execute_process(COMMAND ${CMAKE_COMMAND}
-            -E tar xf SDL2-2.0.14.tar.gz WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
+            -E tar xf SDL2-2.0.18.tar.gz WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
         execute_process(COMMAND ${CMAKE_COMMAND}
             -E make_directory ${PROJECT_BINARY_DIR}/SDL2-build)
         execute_process(COMMAND ${BUILD_COMMAND_COMMON}
             -DSDL_STATIC=FALSE
-            ${PROJECT_BINARY_DIR}/SDL2-2.0.14
+            ${PROJECT_BINARY_DIR}/SDL2-2.0.18
             WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/SDL2-build)
         execute_process(COMMAND ${CMAKE_COMMAND}
             --build ${PROJECT_BINARY_DIR}/SDL2-build ${BUILD_COMMAND_OPTS})


COMP:  Removed m and stdc++ libraries in Wndows build.

--- CMake/UseMatlabMex.cmake
+++ CMake/UseMatlabMex.cmake
@@ -46,7 +46,7 @@
    ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 4)
   ENDIF(APPLE)
 ELSE(UNIX)
-  SET(MEX_LIBRARIES ${MATLAB_LIB_DIR}/libmx.lib ${MATLAB_LIB_DIR}/libmex.lib ${MATLAB_LIB_DIR}/libmat.lib m stdc++)
+  SET(MEX_LIBRARIES ${MATLAB_LIB_DIR}/libmx.lib ${MATLAB_LIB_DIR}/libmex.lib ${MATLAB_LIB_DIR}/libmat.lib)
   SET(MATLAB_ENGINE_LIBRARIES ${MATLAB_LIB_DIR}/libmx.lib ${MATLAB_LIB_DIR}/libeng.lib)
   SET(MEX_VER_FILE "")
   IF(CMAKE_SIZEOF_VOID_P EQUAL 4) # 32 bit


Use regular qRestAPI again, since all changes are integrated

--- CMakeExternals/CTK.cmake
+++ CMakeExternals/CTK.cmake
@@ -102,7 +102,7 @@
         -DDCMTK_URL:STRING=${MITK_THIRDPARTY_DOWNLOAD_PREFIX_URL}/CTK_DCMTK_085525e6.tar.gz
         # See bug 19073
         -DPythonQt_URL:STRING=${MITK_THIRDPARTY_DOWNLOAD_PREFIX_URL}/PythonQt_36ab9c7c.tar.gz
-        -DqRestAPI_URL:STRING=https://www.dropbox.com/s/ecrg9mc7ytw40li/qRestAPI_db64f424.tar.gz
+        -DqRestAPI_URL:STRING=${MITK_THIRDPARTY_DOWNLOAD_PREFIX_URL}/qRestAPI_c5e4c2a7.tar.gz
       CMAKE_CACHE_ARGS
         ${ep_common_cache_args}
       CMAKE_CACHE_DEFAULT_ARGS


COMP: Add Video label for _fetchData tests

--- Modules/VideoCore/Common/add_video_test.cmake
+++ Modules/VideoCore/Common/add_video_test.cmake
@@ -5,4 +5,5 @@
 macro(add_video_test)
   midas_add_test(${ARGV})
   set_property(TEST ${ARGV1} PROPERTY LABELS Video)
+  set_property(TEST ${ARGV1}_fetchData PROPERTY LABELS Video)
 endmacro(add_video_test)


fixed cpack options script

fixed cpack options script

--- Applications/Diffusion/CPackOptions.cmake
+++ Applications/Diffusion/CPackOptions.cmake
@@ -12,7 +12,7 @@

 # this should result in names like 2011.09, 2012.06, ...
 # version has to be set explicitly to avoid such things as CMake creating the install directory "MITK Diffusion 2011.."
-set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR})#.${CPACK_PACKAGE_VERSION_PATCH}")
+set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")#.${CPACK_PACKAGE_VERSION_PATCH}")

 set(CPACK_PACKAGE_FILE_NAME "MITK-Diffusion-${CPACK_PACKAGE_VERSION}-${CPACK_PACKAGE_ARCH}")


CMake: Fix lmu2png build with MSVC 2019

CMake: Fix lmu2png build with MSVC 2019

--- Modules/FindSDL2.cmake
+++ Modules/FindSDL2.cmake
@@ -239,7 +239,7 @@

 		if(WIN32)
 			set_property(TARGET SDL2::SDL2 APPEND_STRING PROPERTY
-				INTERFACE_LINK_LIBRARIES "winmm;imm32;version")
+				INTERFACE_LINK_LIBRARIES "winmm;imm32;version;setupapi")
 		elseif(APPLE)
 			find_library(COREVIDEO CoreVideo)
 			find_library(COCOA_LIBRARY Cocoa)


Use correct build order

Use correct build order

--- CMake/MITKDashboardDriverScript.cmake
+++ CMake/MITKDashboardDriverScript.cmake
@@ -304,13 +304,13 @@
         if(NOT build_errors AND external_project_superbuilddir)
           func_build_target("" "${CTEST_BINARY_DIRECTORY}/${external_project_superbuilddir}")
         endif()
+
+        if(NOT build_errors AND external_project_buildtarget)
+          func_build_target("${external_project_buildtarget}" "${CTEST_BINARY_DIRECTORY}/${external_project_superbuilddir}")
+        endif()

         if(NOT build_errors)
           func_build_target("" "${CTEST_BINARY_DIRECTORY}/${external_project_builddir}")
-        endif()
-
-        if(NOT build_errors AND external_project_buildtarget)
-          func_build_target("${external_project_buildtarget}" "${CTEST_BINARY_DIRECTORY}/${external_project_builddir}")
         endif()

         # HACK Unfortunately ctest_coverage ignores the build argument, try to force it...


Add custom target removed by error in commit 3d5a81f

--- build-options.cmake
+++ build-options.cmake
@@ -80,9 +80,9 @@
 include( ${LOMSE_ROOT_DIR}/build-version.cmake )

 #add_custom_target(build-version ALL
-#  COMMAND ${CMAKE_COMMAND} -D LOMSE_ROOT_DIR=${LOMSE_ROOT_DIR} -P ${LOMSE_ROOT_DIR}/build-version.cmake
-#  WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
-#  COMMENT "setting Lomse version information ...")
+  COMMAND ${CMAKE_COMMAND} -D LOMSE_ROOT_DIR=${LOMSE_ROOT_DIR} -P ${LOMSE_ROOT_DIR}/build-version.cmake
+  WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+  COMMENT "setting Lomse version information ...")

 # platform
 if(WIN32)


[FIX] CMake: quoted compiler flags input variables - fixes cmake 3.0 builds

--- util/cmake/SeqAnBuildSystem.cmake
+++ util/cmake/SeqAnBuildSystem.cmake
@@ -432,9 +432,9 @@
     else ()
       # Disable only Thrust warnings.
       string (REGEX REPLACE "-Wall" ""
-              SEQAN_CXX_FLAGS ${SEQAN_CXX_FLAGS})
+              SEQAN_CXX_FLAGS "${SEQAN_CXX_FLAGS}")
       string (REGEX REPLACE "-pedantic" ""
-              SEQAN_CXX_FLAGS ${SEQAN_CXX_FLAGS})
+              SEQAN_CXX_FLAGS "${SEQAN_CXX_FLAGS}")
       if (CMAKE_COMPILER_IS_GNUCXX OR COMPILER_IS_CLANG)
         set (SEQAN_CXX_FLAGS "${SEQAN_CXX_FLAGS} -Wno-unused-parameter")
       endif (CMAKE_COMPILER_IS_GNUCXX OR COMPILER_IS_CLANG)
@@ -696,9 +696,9 @@

     # Remove NDEBUG definition for tests.
     string (REGEX REPLACE "-DNDEBUG" ""
-            CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
+            CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
     string (REGEX REPLACE "-DNDEBUG" ""
-            CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
+            CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")

     # Conditionally enable coverage mode by setting the appropriate flags.
     if (MODEL STREQUAL "NightlyCoverage")


detect & setup fsanitize=bounds[-strict] option

--- cmake/utils.cmake
+++ cmake/utils.cmake
@@ -48,6 +48,12 @@
         set(CMAKE_REQUIRED_FLAGS "-fsanitize=integer")
         CHECK_CXX_SOURCE_COMPILES("${TEST_PROGRAM}" COMPILER_SUPPORTS_SANITIZE_INTEGER)

+        set(CMAKE_REQUIRED_FLAGS "-fsanitize=bounds")
+        CHECK_CXX_SOURCE_COMPILES("${TEST_PROGRAM}" COMPILER_SUPPORTS_SANITIZE_BOUNDS)
+
+        set(CMAKE_REQUIRED_FLAGS "-fsanitize=bounds-strict")
+        CHECK_CXX_SOURCE_COMPILES("${TEST_PROGRAM}" COMPILER_SUPPORTS_SANITIZE_BOUNDS_STRICT)
+
         if(COMPILER_SUPPORTS_SANITIZE_ADDRESS)
                 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
         endif()
@@ -62,6 +68,12 @@
         endif()
         if(COMPILER_SUPPORTS_SANITIZE_INTEGER)
                 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=integer")
+        endif()
+        if(COMPILER_SUPPORTS_SANITIZE_BOUNDS_STRICT)
+                set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=bounds-strict")
+        endif()
+        if(COMPILER_SUPPORTS_SANITIZE_BOUNDS)
+                set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=bounds")
         endif()

         to_parent()


generate shorter repo filenames

generate shorter repo filenames

--- Modules/CakePkg.cmake
+++ Modules/CakePkg.cmake
@@ -399,7 +399,11 @@
     endif()

     if(NOT destination)
-      set(resolved_destination ${CAKE_PKG_REPOS_DIR}/${url_cid})
+      # last dir of url + random
+      cake_get_humanish_part_of_url("${repo_url}")
+      get_filename_component(f "${ans}" NAME)
+      string(RANDOM LENGTH 2 ALPHABET 0123456789 r)
+      set(resolved_destination ${CAKE_PKG_REPOS_DIR}/${f}_${r})
     else()
       if(NOT IS_ABSOLUTE "${destination}")
         message(FATAL_ERROR "[cake_pkg] internal error, destination must be absolute.")


Start on improving component/imported targets

--- Modules/FindTBB.cmake
+++ Modules/FindTBB.cmake
@@ -1,6 +1,7 @@
 # The MIT License (MIT)
 #
 # Copyright (c) 2015 Justus Calvin
+# Modifications Copyright (c) 2017 Ben Morgan
 #
 # Permission is hereby granted, free of charge, to any person obtaining a copy
 # of this software and associated documentation files (the "Software"), to deal
@@ -170,7 +171,10 @@
 find_path(TBB_INCLUDE_DIR tbb/tbb.h
   HINTS ${TBB_INCLUDE_DIR} ${TBB_SEARCH_DIR}
   PATHS ${TBB_DEFAULT_SEARCH_DIR}
-  PATH_SUFFIXES include)
+  PATH_SUFFIXES include
+  DOC "TBB include directory"
+  )
+mark_as_advanced(TBB_INCLUDE_DIR)

 ##################################
 # Set version strings
@@ -186,84 +190,65 @@
   set(TBB_VERSION "${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR}")
 endif()

-##################################
-# Find TBB library and components
-##################################
-find_library(TBB_LIBRARY_RELEASE
-  NAMES tbb
-  HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR}
-  PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH
-  PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX}
-  )
-find_library(TBB_LIBRARY_DEBUG
-  NAMES tbb_debug
-  HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR}
-  PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH
-  PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX}
-  )
-
-if(TBB_VERSION VERSION_LESS 4.3)
-  set(TBB_SEARCH_COMPOMPONENTS tbb_preview tbbmalloc)
-else()
-  set(TBB_SEARCH_COMPOMPONENTS tbb_preview tbbmalloc_proxy tbbmalloc)
-endif()
-
-# Find each component
-foreach(_comp ${TBB_SEARCH_COMPOMPONENTS})
-  if(";${TBB_FIND_COMPONENTS};tbb;" MATCHES ";${_comp};")
-    # Search for the libraries
+########################################
+# Find TBB library and requested components
+##################################
+if(NOT TBB_LIBRARY)
+  find_library(TBB_LIBRARY_RELEASE
+    NAMES tbb
+    HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR}
+    PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH
+    PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX}
+    DOC "TBB library (release)"
+    )
+  find_library(TBB_LIBRARY_DEBUG
+    NAMES tbb_debug
+    HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR}
+    PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH
+    PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX}
+    DOC "TBB library (debug)"
+    )
+  mark_as_advanced(TBB_LIBRARY_RELEASE TBB_LIBRARY_DEBUG)
+  include(SelectLibraryConfigurations)
+  select_library_configurations(TBB)
+endif()
+
+# Don't as yet check that component is know
+#if(TBB_VERSION VERSION_LESS 4.3)
+#  set(TBB_SEARCH_COMPOMPONENTS tbb_preview tbbmalloc)
+#else()
+#  set(TBB_SEARCH_COMPOMPONENTS tbb_preview tbbmalloc_proxy tbbmalloc)
+#endif()
+
+foreach(_comp ${TBB_FIND_COMPONENTS})
+  if(NOT TBB_${_comp}_LIBRARY)
     find_library(TBB_${_comp}_LIBRARY_RELEASE ${_comp}
       HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR}
       PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH
-      PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX})
+      PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX}
+      )

     find_library(TBB_${_comp}_LIBRARY_DEBUG ${_comp}_debug
       HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR}
       PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH
-      PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX})
-
-    if(TBB_${_comp}_LIBRARY_DEBUG)
-      list(APPEND TBB_LIBRARIES_DEBUG "${TBB_${_comp}_LIBRARY_DEBUG}")
+      PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX}
+      )
+
+    mark_as_advanced(TBB_${_comp}_LIBRARY_RELEASE TBB_${_comp}_LIBRARY_DEBUG)
+    select_library_configurations(TBB_${_comp})
+    if(TBB_${_comp}_LIBRARY)
+      set(TBB_${_comp}_FOUND TRUE)
     endif()
-
-    if(TBB_${_comp}_LIBRARY_RELEASE)
-      list(APPEND TBB_LIBRARIES_RELEASE "${TBB_${_comp}_LIBRARY_RELEASE}")
-    endif()
-
-    if(TBB_${_comp}_LIBRARY_${TBB_BUILD_TYPE} AND NOT TBB_${_comp}_LIBRARY)
-      set(TBB_${_comp}_LIBRARY "${TBB_${_comp}_LIBRARY_${TBB_BUILD_TYPE}}")
-    endif()
-
-    if(TBB_${_comp}_LIBRARY AND EXISTS "${TBB_${_comp}_LIBRARY}")
-      set(TBB_${_comp}_FOUND TRUE)
-    else()
-      set(TBB_${_comp}_FOUND FALSE)
-    endif()
-
-    # Mark internal variables as advanced
-    mark_as_advanced(TBB_${_comp}_LIBRARY_RELEASE)
-    mark_as_advanced(TBB_${_comp}_LIBRARY_DEBUG)
-    mark_as_advanced(TBB_${_comp}_LIBRARY)
   endif()
 endforeach()

-##################################
-# Set compile flags and libraries
-##################################
-set(TBB_INCLUDE_DIRS "${TBB_INCLUDE_DIR}")
+# Need compile definitions for release/debug modes
+# Use "SelectLibraryConfigurations" logic to set a suitable TBB_DEFINITIONS?
+# Difficult though because add_definitions doesn't support generator expressions!
+# May just need to set TBB_DEFINITIONS appropriately and document multimode
+# case
 set(TBB_DEFINITIONS_RELEASE "")
 set(TBB_DEFINITIONS_DEBUG "-DTBB_USE_DEBUG=1")
-
-if(TBB_LIBRARIES_${TBB_BUILD_TYPE})
-  set(TBB_DEFINITIONS "${TBB_DEFINITIONS_${TBB_BUILD_TYPE}}")
-  set(TBB_LIBRARIES "${TBB_LIBRARIES_${TBB_BUILD_TYPE}}")
-elseif(TBB_LIBRARIES_RELEASE)
-  set(TBB_DEFINITIONS "${TBB_DEFINITIONS_RELEASE}")
-  set(TBB_LIBRARIES "${TBB_LIBRARIES_RELEASE}")
-elseif(TBB_LIBRARIES_DEBUG)
-  set(TBB_DEFINITIONS "${TBB_DEFINITIONS_DEBUG}")
-  set(TBB_LIBRARIES "${TBB_LIBRARIES_DEBUG}")
-endif()

 #-----------------------------------------------------------------------
 # Handle the QUIETLY/REQUIRED arguments and set TBB_FOUND to TRUE if
@@ -273,41 +258,52 @@
     TBB_FOUND
   REQUIRED_VARS
     TBB_INCLUDE_DIR
-    TBB_LIBRARIES
+    TBB_LIBRARY
   HANDLE_COMPONENTS
   VERSION_VAR
-  TBB_VERSION
+    TBB_VERSION
   )

-##################################
-# Create Imported targets
-# NB: Should create these individually rather than dumping
-#     contents of TBB_LIBRARIES
-##################################
-if(NOT CMAKE_VERSION VERSION_LESS 3.0 AND TBB_FOUND)
-  add_library(TBB::tbb SHARED IMPORTED)
-  set_target_properties(TBB::tbb PROPERTIES
-    INTERFACE_INCLUDE_DIRECTORIES  ${TBB_INCLUDE_DIRS}
-    IMPORTED_LOCATION              ${TBB_tbb_LIBRARY})
-  if(TBB_LIBRARIES_RELEASE AND TBB_LIBRARIES_DEBUG)
-    set_target_properties(tbb PROPERTIES
-      INTERFACE_COMPILE_DEFINITIONS "$<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:TBB_USE_DEBUG=1>"
-      IMPORTED_LOCATION_DEBUG          ${TBB_LIBRARIES_DEBUG}
-      IMPORTED_LOCATION_RELWITHDEBINFO ${TBB_LIBRARIES_DEBUG}
-      IMPORTED_LOCATION_RELEASE        ${TBB_LIBRARIES_RELEASE}
-      IMPORTED_LOCATION_MINSIZEREL     ${TBB_LIBRARIES_RELEASE}
+if(TBB_FOUND)
+  set(TBB_INCLUDE_DIRS "${TBB_INCLUDE_DIR}")
+  set(TBB_LIBRARIES "${TBB_LIBRARIES}")
+
+  # Add any requested components to LIBRARIES
+  foreach(_comp ${TBB_FIND_COMPONENTS})
+    if(TBB_${_comp}_FOUND)
+      set(TBB_LIBRARIES "${TBB_LIBRARIES} ${TBB_${_comp}_LIBRARIES}")
+    endif()
+  endforeach()
+
+  # On CMake >= 3, create imported targets
+  if(CMAKE_VERSION VERSION_GREATER 2.99 AND NOT TARGET TBB::tbb)
+    # TBB is always a shared library
+    add_library(TBB::tbb SHARED IMPORTED)
+    set_target_properties(TBB::tbb PROPERTIES
+      INTERFACE_INCLUDE_DIRECTORIES "${TBB_INCLUDE_DIRS}"
       )
-  elseif(TBB_LIBRARIES_RELEASE)
-    set_target_properties(tbb PROPERTIES IMPORTED_LOCATION ${TBB_LIBRARIES_RELEASE})
-  else()
-    set_target_properties(tbb PROPERTIES
-      INTERFACE_COMPILE_DEFINITIONS "${TBB_DEFINITIONS_DEBUG}"
-      IMPORTED_LOCATION              ${TBB_LIBRARIES_DEBUG}
-      )
-  endif()
-endif()
-
-mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARIES)
+    if(TBB_LIBRARY_RELEASE AND TBB_LIBRARY_DEBUG)
+      set_target_properties(TBB::tbb PROPERTIES
+        # Note setting vs latter Debug only one
+        # Have to be careful to apply correct -D flag for R-AND-D
+        # vs D only cases.
+        INTERFACE_COMPILE_DEFINITIONS "$<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:TBB_USE_DEBUG=1>"
+        IMPORTED_LOCATION_DEBUG          ${TBB_LIBRARY_DEBUG}
+        IMPORTED_LOCATION_RELWITHDEBINFO ${TBB_LIBRARY_DEBUG}
+        IMPORTED_LOCATION_RELEASE        ${TBB_LIBRARY_RELEASE}
+        IMPORTED_LOCATION_MINSIZEREL     ${TBB_LIBRARY_RELEASE}
+        )
+    elseif(TBB_LIBRARIES_RELEASE)
+      set_target_properties(TBB::tbb PROPERTIES IMPORTED_LOCATION ${TBB_LIBRARY_RELEASE})
+    else()
+      set_target_properties(TBB::tbb PROPERTIES
+        INTERFACE_COMPILE_DEFINITIONS "${TBB_DEFINITIONS_DEBUG}"
+        IMPORTED_LOCATION              "${TBB_LIBRARY_DEBUG}"
+        )
+    endif()
+  endif()
+endif()
+

 unset(TBB_ARCHITECTURE)
 unset(TBB_BUILD_TYPE)


SuperBuild: fix md5sum for ossim

SuperBuild: fix md5sum for ossim

--- SuperBuild/CMake/External_ossim.cmake
+++ SuperBuild/CMake/External_ossim.cmake
@@ -17,14 +17,14 @@
 else()
   SETUP_SUPERBUILD(PROJECT ${proj})
   message(STATUS "  Using OSSIM SuperBuild version")
-
+
   # declare dependencies
   ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(${proj} TIFF GEOTIFF GEOS JPEG OPENTHREADS FREETYPE)

   INCLUDE_SUPERBUILD_DEPENDENCIES(${${proj}_DEPENDENCIES})
   # set proj back to its original value
   set(proj OSSIM)
-
+
   ADD_SUPERBUILD_CMAKE_VAR(TIFF_INCLUDE_DIR)
   ADD_SUPERBUILD_CMAKE_VAR(TIFF_LIBRARY)
   ADD_SUPERBUILD_CMAKE_VAR(GEOTIFF_INCLUDE_DIR)
@@ -39,16 +39,16 @@
   ADD_SUPERBUILD_CMAKE_VAR(FREETYPE_LIBRARY)

   set(OSSIM_CXX_FLAGS  -D__STDC_CONSTANT_MACROS)
-
+
   if(MSVC)
     set(OSSIM_CXX_FLAGS /EHsc)
   endif()
-
+
   # archive version
   ExternalProject_Add(${proj}
     PREFIX ${proj}
     URL "https://www.orfeo-toolbox.org/packages/ossim-minimal-r23537.tar.gz"
-    URL_MD5 1a37403053711447a8f174bb875cca6b
+    URL_MD5 d41d8cd98f00b204e9800998ecf8427e
     BINARY_DIR ${OSSIM_SB_BUILD_DIR}
     INSTALL_DIR ${SB_INSTALL_PREFIX}
     DOWNLOAD_DIR ${DOWNLOAD_LOCATION}
@@ -70,14 +70,14 @@
     DEPENDS ${${proj}_DEPENDENCIES}
     CMAKE_COMMAND ${SB_CMAKE_COMMAND}
     )
-
+
   set(_SB_${proj}_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include)
   if(WIN32)
     set(_SB_${proj}_LIBRARY ${SB_INSTALL_PREFIX}/lib/ossim.lib)
   elseif(UNIX)
     set(_SB_${proj}_LIBRARY ${SB_INSTALL_PREFIX}/lib/libossim${CMAKE_SHARED_LIBRARY_SUFFIX})
   endif()
-
+
 endif()

 endif()


ENH: Update BRAINSTools version

ENH: Update BRAINSTools version

--- SuperBuild/External_BRAINSTools.cmake
+++ SuperBuild/External_BRAINSTools.cmake
@@ -129,7 +129,7 @@
       -DUSE_SYSTEM_ZLIB:BOOL=ON
       -Dzlib_DIR:PATH=${zlib_DIR}
       -DZLIB_ROOT:PATH=${zlib_DIR}
-      -DZLIB_INCLUDE_DIR:PATH=${zlib}_DIR}/include
+      -DZLIB_INCLUDE_DIR:PATH=${zlib_DIR}/include
       -DZLIB_LIBRARY:FILEPATH=${ZLIB_LIBRARY}
       -DUSE_BRAINSABC:BOOL=OFF
       -DUSE_BRAINSConstellationDetector:BOOL=OFF
@@ -167,7 +167,7 @@

   ### --- End Project specific additions
   set(${proj}_REPOSITORY "${git_protocol}://github.com/BRAINSia/BRAINSTools.git")
-  set(${proj}_GIT_TAG 33b739e7e6a414be41d44aca028b1304a2c0a440 )
+  set(${proj}_GIT_TAG 4aef8f72e4ee2f26020e75c73580f56a9eda3a97 )
   ExternalProject_Add(${proj}
     GIT_REPOSITORY ${${proj}_REPOSITORY}
     GIT_TAG ${${proj}_GIT_TAG}


env: fix third_party installation

env: fix third_party installation

Signed-off-by: Alessandro Comodi <622632e70fd6771cf2cd943f69e5e51ab66adef8@antmicro.com>

--- xc/common/cmake/arch_define.cmake
+++ xc/common/cmake/arch_define.cmake
@@ -137,7 +137,7 @@
         \${PLACE_CONSTR_TOOL_EXTRA_ARGS}"
     BITSTREAM_EXTENSION frames
     BIN_EXTENSION bit
-    FASM_TO_BIT ${PRJRAY_DIR}/utils/fasm2frames.py
+    FASM_TO_BIT ${PRJRAY_DIR}/prjxray/fasm2frames.py
     FASM_TO_BIT_CMD "${CMAKE_COMMAND} -E env \
     PYTHONPATH=${symbiflow-arch-defs_BINARY_DIR}/env/conda/lib/python3.7/site-packages:${PRJRAY_DIR}:${PRJRAY_DIR}/third_party/fasm \
     \${PYTHON3} \${FASM_TO_BIT} \


Reactivate `ImageProcessing` module.

Reactivate `ImageProcessing` module.

--- cmake/FindDO.cmake
+++ cmake/FindDO.cmake
@@ -51,7 +51,7 @@
   #do_append_components(DO_COMPONENTS KDTree)
   #do_append_components(DO_COMPONENTS ImageDrawing)
   # Image processing
-  #do_append_components(DO_COMPONENTS ImageProcessing)
+  do_append_components(DO_COMPONENTS ImageProcessing)
   # Geometry
   #do_append_components(DO_COMPONENTS Geometry)
   # Feature detection and description


Make consequent patches succeed

Make consequent patches succeed

--- cmake/cmocka.cmake
+++ cmake/cmocka.cmake
@@ -10,7 +10,7 @@
   GIT_REPOSITORY git://git.cryptomilk.org/projects/cmocka.git
   GIT_TAG cmocka-1.0.1
   PREFIX ${CMAKE_CURRENT_BINARY_DIR}/cmocka
-  PATCH_COMMAND "${GIT_EXECUTABLE}" apply "${CMAKE_CURRENT_LIST_DIR}/cmocka.vs2015.patch"
+  PATCH_COMMAND "${GIT_EXECUTABLE}" checkout . COMMAND "${GIT_EXECUTABLE}" apply "${CMAKE_CURRENT_LIST_DIR}/cmocka.vs2015.patch"
   INSTALL_COMMAND ""
 )


Ninja complains that file openblas.def does not exist

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

 add_custom_command(
-  TARGET ${OpenBLAS_LIBNAME} PRE_LINK
+  OUTPUT ${PROJECT_BINARY_DIR}/openblas.def
+  #TARGET ${OpenBLAS_LIBNAME} PRE_LINK
   COMMAND perl
   ARGS "${PROJECT_SOURCE_DIR}/exports/gensymbol" "win2k" "${ARCH_IN}" "dummy" "${EXPRECISION_IN}" "${NO_CBLAS_IN}" "${NO_LAPACK_IN}" "${NO_LAPACKE_IN}" "${NEED2UNDERSCORES_IN}" "${ONLY_CBLAS_IN}" "${SYMBOLPREFIX}" "${SYMBOLSUFFIX}" > "${PROJECT_BINARY_DIR}/openblas.def"
   COMMENT "Create openblas.def file"


default to installing library output to lib/ if no CMAKE_INSTALL_LIBDIR is set

--- cmake/macros.cmake
+++ cmake/macros.cmake
@@ -223,7 +223,11 @@
 macro(SET_INSTALL_DIRS)
   string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER)
   if (NOT DEFINED PDAL_LIB_INSTALL_DIR)
-      set(PDAL_LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}")
+      if (DEFINED CMAKE_INSTALL_LIBDIR)
+          set(PDAL_LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}")
+      else()
+          set(PDAL_LIB_INSTALL_DIR "lib")
+      endif()
   endif ()
     set(PDAL_INCLUDE_INSTALL_ROOT "include/")
     set(PDAL_INCLUDE_INSTALL_DIR


Do not link client plugins to mysqld

Do not link client plugins to mysqld

they might not be able to load after this.

--- cmake/plugin.cmake
+++ cmake/plugin.cmake
@@ -201,11 +201,13 @@
     # executable to the linker command line (it would result into link error).
     # Thus we skip TARGET_LINK_LIBRARIES on Linux, as it would only generate
     # an additional dependency.
-    IF(MSVC)
-      ADD_DEPENDENCIES(${target} gen_mysqld_lib)
-      TARGET_LINK_LIBRARIES(${target} mysqld_import_lib)
-    ELSEIF(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
-      TARGET_LINK_LIBRARIES (${target} mysqld)
+    IF(NOT ARG_CLIENT)
+      IF(MSVC)
+        ADD_DEPENDENCIES(${target} gen_mysqld_lib)
+        TARGET_LINK_LIBRARIES(${target} mysqld_import_lib)
+      ELSEIF(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
+        TARGET_LINK_LIBRARIES (${target} mysqld)
+      ENDIF()
     ENDIF()

     IF(ARG_LINK_LIBRARIES)


Update facts.cmake

Update facts.cmake

--- facts/facts.cmake
+++ facts/facts.cmake
@@ -515,37 +515,36 @@
 		INSTALL(  	TARGETS ${_TEST_NAME}_exe
 				DESTINATION ${BUILD_TYPE}/${_SUFFIX_DESTINATION}
 				CONFIGURATIONS ${BUILD_TYPE})
-		#  --gtest_repeat=1 --gtest_break_on_failure --gtest_shuffle --gmock_verbose=info
-		if (DEFINED VALGRIND_BUILD AND (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (CMAKE_BUILD_TYPE STREQUAL "Release"))
+		if (DEFINED TESTS_VALGRIND AND (TESTS_VALGRIND STREQUAL "TRUE") AND (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (CMAKE_BUILD_TYPE STREQUAL "Release"))
 			find_program(VALGRIND "valgrind")
 			if(VALGRIND)
 				add_test(
 					NAME ${_TEST_NAME}_memcheck
-					COMMAND "${VALGRIND}" --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes $<TARGET_FILE:${_TEST_NAME}_exe> --gmock_verbose=info
+					COMMAND "${VALGRIND}" --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes $<TARGET_FILE:${_TEST_NAME}_exe> --gmock_verbose=error
 					WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${BUILD_TYPE}
 					CONFIGURATIONS ${BUILD_TYPE}
 					)
 				add_test(
 					NAME ${_TEST_NAME}_cachegrind
-					COMMAND "${VALGRIND}" --tool=cachegrind $<TARGET_FILE:${_TEST_NAME}_exe> --gmock_verbose=info
+					COMMAND "${VALGRIND}" --tool=cachegrind $<TARGET_FILE:${_TEST_NAME}_exe> --gmock_verbose=error
 					WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${BUILD_TYPE}
 					CONFIGURATIONS ${BUILD_TYPE}
 					)
 				add_test(
 					NAME ${_TEST_NAME}_helgrind
-					COMMAND "${VALGRIND}" --tool=helgrind $<TARGET_FILE:${_TEST_NAME}_exe> --gmock_verbose=info
+					COMMAND "${VALGRIND}" --tool=helgrind $<TARGET_FILE:${_TEST_NAME}_exe> --gmock_verbose=error
 					WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${BUILD_TYPE}
 					CONFIGURATIONS ${BUILD_TYPE}
 					)
 				add_test(
 					NAME ${_TEST_NAME}_callgrind
-					COMMAND "${VALGRIND}" --tool=callgrind $<TARGET_FILE:${_TEST_NAME}_exe> --gmock_verbose=info
+					COMMAND "${VALGRIND}" --tool=callgrind $<TARGET_FILE:${_TEST_NAME}_exe> --gmock_verbose=error
 					WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${BUILD_TYPE}
 					CONFIGURATIONS ${BUILD_TYPE}
 					)
 				add_test(
 					NAME ${_TEST_NAME}_drd
-					COMMAND "${VALGRIND}" --tool=drd --read-var-info=yes $<TARGET_FILE:${_TEST_NAME}_exe> --gmock_verbose=info
+					COMMAND "${VALGRIND}" --tool=drd --read-var-info=yes $<TARGET_FILE:${_TEST_NAME}_exe> --gmock_verbose=error
 					WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${BUILD_TYPE}
 					CONFIGURATIONS ${BUILD_TYPE}
 					)


Add set_if_exists.

Add set_if_exists.

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

--- build-aux/cmake/modules/Tools.cmake
+++ build-aux/cmake/modules/Tools.cmake
@@ -45,6 +45,13 @@
       SET(${var} ${ARGN})
     ENDIF(NOT DEFINED "${var}")
   endmacro(SET_IF_NOT_SET var val)
+
+  # Set the variable with the given path if it exists.
+  function(set_if_exists var path)
+    if(EXISTS ${path})
+      set(${var} ${path} PARENT_SCOPE)
+    endif(EXISTS ${path})
+  endfunction(set_if_exists)

   # Check whether the given variables exists. Send an error message if it
   # doesn't.


config.h.in.cmake bugfix

config.h.in.cmake bugfix

POCL_KCACHE_SALT needs to be #defined, not #cmakedefined.

--- config.h.in.cmake
+++ config.h.in.cmake
@@ -19,6 +19,8 @@
 #define LLVM_VERSION "@LLVM_VERSION_FULL@"
 #endif

+#cmakedefine CLANG_IS_PATCHED_FOR_SPIR_CC
+
 #define CLANG "@CLANG@"

 /* clang++ executable */
@@ -33,11 +35,8 @@
 /* "Using a SPIR generator Clang from Khronos." */
 #cmakedefine CLANG_SPIR

-
 /* TODO in sources */
 #define KERNEL_CL_FLAGS  "@KERNEL_CL_FLAGS@"
-
-

 #define FORCED_CLFLAGS  "@FORCED_CLFLAGS@"

@@ -55,7 +54,6 @@
 #cmakedefine HAVE_POSIX_MEMALIGN

 #cmakedefine HAVE_HSA_EXT_AMD_H
-

 #define HOST  "@HOST@"

@@ -117,6 +115,7 @@

 #define PACKAGE_VERSION "@PACKAGE_VERSION@"

+#define POCL_KCACHE_SALT "@POCL_KCACHE_SALT@"

 #define POCL_KERNEL_CACHE_DEFAULT @POCL_KERNEL_CACHE_DEFAULT@

@@ -132,9 +131,6 @@

 /* The size of `__fp16', as computed by sizeof. */
 #define SIZEOF___FP16  @SIZEOF___FP16@
-
-#cmakedefine CLANG_IS_PATCHED_FOR_SPIR_CC
-#cmakedefine POCL_KCACHE_SALT "@POCL_KCACHE_SALT@"

 /* used in tce_common.c & pocl_llvm_api.cc  */
 #define SRCDIR  "@SRCDIR@"


Define lapack_complex_double in FindMKL.cmake to avoid reinterpret_cast hacks

Former-commit-id: 84426abc5ba615b4299d79abc82fe5b2ddc0b235

--- cmake/FindMKL.cmake
+++ cmake/FindMKL.cmake
@@ -422,6 +422,8 @@
     add_library(mkl::mkl INTERFACE IMPORTED)
     target_link_libraries(mkl::mkl INTERFACE ${MKL_TARGETS})
     target_compile_definitions(mkl::mkl INTERFACE MKL_AVAILABLE)
+    target_compile_definitions(mkl::mkl INTERFACE lapack_complex_float=std::complex<float>)
+    target_compile_definitions(mkl::mkl INTERFACE lapack_complex_double=std::complex<double>)
     if(blas IN_LIST MKL_FIND_COMPONENTS)
         add_library(BLAS::BLAS INTERFACE IMPORTED)
         target_link_libraries(BLAS::BLAS INTERFACE ${MKL_TARGETS})


Added TBB support for MSVC14 / Visual Studio 2015

--- cmake/FindTBB.cmake
+++ cmake/FindTBB.cmake
@@ -85,6 +85,8 @@
         set(WINPATH "${WINPATH}/vc11")
     elseif (MSVC12)
         set(WINPATH "${WINPATH}/vc12")
+    elseif (MSVC14)
+        set(WINPATH "${WINPATH}/vc14")
     endif()

     list(APPEND TBB_LIB_ARCH ${WINPATH})


FIX: remove duplicate

FIX: remove duplicate

--- cmake/generic.cmake
+++ cmake/generic.cmake
@@ -103,6 +103,7 @@
   foreach(lib ${libs})
     list(APPEND libs_deps ${${lib}_LIB_DEPENDS})
   endforeach()
+  list(REMOVE_DUPLICATES libs_deps)

   # To produce a library we need at least one source file.
   # It is created by add_custom_command below and will helps


Added mising lapacke files for CMake.

Added mising lapacke files for CMake.

--- cmake/lapacke.cmake
+++ cmake/lapacke.cmake
@@ -2038,6 +2038,59 @@
   lapacke_zlagsy_work.c
 )

+set(Utils_SRC
+lapacke_cgb_nancheck.c  lapacke_dpf_nancheck.c         lapacke_ssy_trans.c
+lapacke_cgb_trans.c     lapacke_dpf_trans.c            lapacke_stb_nancheck.c
+lapacke_cge_nancheck.c  lapacke_dpo_nancheck.c         lapacke_stb_trans.c
+lapacke_cge_trans.c     lapacke_dpo_trans.c            lapacke_stf_nancheck.c
+lapacke_cgg_nancheck.c  lapacke_dpp_nancheck.c         lapacke_stf_trans.c
+lapacke_cgg_trans.c     lapacke_dpp_trans.c            lapacke_stp_nancheck.c
+lapacke_cgt_nancheck.c  lapacke_dpt_nancheck.c         lapacke_stp_trans.c
+lapacke_chb_nancheck.c  lapacke_dsb_nancheck.c         lapacke_str_nancheck.c
+lapacke_chb_trans.c     lapacke_dsb_trans.c            lapacke_str_trans.c
+lapacke_che_nancheck.c  lapacke_dsp_nancheck.c         lapacke_xerbla.c
+lapacke_che_trans.c     lapacke_dsp_trans.c            lapacke_zgb_nancheck.c
+lapacke_chp_nancheck.c  lapacke_dst_nancheck.c         lapacke_zgb_trans.c
+lapacke_chp_trans.c     lapacke_dsy_nancheck.c         lapacke_zge_nancheck.c
+lapacke_chs_nancheck.c  lapacke_dsy_trans.c            lapacke_zge_trans.c
+lapacke_chs_trans.c     lapacke_dtb_nancheck.c         lapacke_zgg_nancheck.c
+lapacke_c_nancheck.c    lapacke_dtb_trans.c            lapacke_zgg_trans.c
+lapacke_cpb_nancheck.c  lapacke_dtf_nancheck.c         lapacke_zgt_nancheck.c
+lapacke_cpb_trans.c     lapacke_dtf_trans.c            lapacke_zhb_nancheck.c
+lapacke_cpf_nancheck.c  lapacke_dtp_nancheck.c         lapacke_zhb_trans.c
+lapacke_cpf_trans.c     lapacke_dtp_trans.c            lapacke_zhe_nancheck.c
+lapacke_cpo_nancheck.c  lapacke_dtr_nancheck.c         lapacke_zhe_trans.c
+lapacke_cpo_trans.c     lapacke_dtr_trans.c            lapacke_zhp_nancheck.c
+lapacke_cpp_nancheck.c  lapacke_lsame.c                lapacke_zhp_trans.c
+lapacke_cpp_trans.c     lapacke_make_complex_double.c  lapacke_zhs_nancheck.c
+lapacke_cpt_nancheck.c  lapacke_make_complex_float.c   lapacke_zhs_trans.c
+lapacke_csp_nancheck.c  lapacke_sgb_nancheck.c         lapacke_z_nancheck.c
+lapacke_csp_trans.c     lapacke_sgb_trans.c            lapacke_zpb_nancheck.c
+lapacke_cst_nancheck.c  lapacke_sge_nancheck.c         lapacke_zpb_trans.c
+lapacke_csy_nancheck.c  lapacke_sge_trans.c            lapacke_zpf_nancheck.c
+lapacke_csy_trans.c     lapacke_sgg_nancheck.c         lapacke_zpf_trans.c
+lapacke_ctb_nancheck.c  lapacke_sgg_trans.c            lapacke_zpo_nancheck.c
+lapacke_ctb_trans.c     lapacke_sgt_nancheck.c         lapacke_zpo_trans.c
+lapacke_ctf_nancheck.c  lapacke_shs_nancheck.c         lapacke_zpp_nancheck.c
+lapacke_ctf_trans.c     lapacke_shs_trans.c            lapacke_zpp_trans.c
+lapacke_ctp_nancheck.c  lapacke_s_nancheck.c           lapacke_zpt_nancheck.c
+lapacke_ctp_trans.c     lapacke_spb_nancheck.c         lapacke_zsp_nancheck.c
+lapacke_ctr_nancheck.c  lapacke_spb_trans.c            lapacke_zsp_trans.c
+lapacke_ctr_trans.c     lapacke_spf_nancheck.c         lapacke_zst_nancheck.c
+lapacke_dgb_nancheck.c  lapacke_spf_trans.c            lapacke_zsy_nancheck.c
+lapacke_dgb_trans.c     lapacke_spo_nancheck.c         lapacke_zsy_trans.c
+lapacke_dge_nancheck.c  lapacke_spo_trans.c            lapacke_ztb_nancheck.c
+lapacke_dge_trans.c     lapacke_spp_nancheck.c         lapacke_ztb_trans.c
+lapacke_dgg_nancheck.c  lapacke_spp_trans.c            lapacke_ztf_nancheck.c
+lapacke_dgg_trans.c     lapacke_spt_nancheck.c         lapacke_ztf_trans.c
+lapacke_dgt_nancheck.c  lapacke_ssb_nancheck.c         lapacke_ztp_nancheck.c
+lapacke_dhs_nancheck.c  lapacke_ssb_trans.c            lapacke_ztp_trans.c
+lapacke_dhs_trans.c     lapacke_ssp_nancheck.c         lapacke_ztr_nancheck.c
+lapacke_d_nancheck.c    lapacke_ssp_trans.c            lapacke_ztr_trans.c
+lapacke_dpb_nancheck.c  lapacke_sst_nancheck.c
+lapacke_dpb_trans.c     lapacke_ssy_nancheck.c
+)
+
 set(LAPACKE_REL_SRC "")
 if (BUILD_SINGLE)
   list(APPEND LAPACKE_REL_SRC ${SSRC})
@@ -2061,6 +2114,10 @@
   list(APPEND LAPACKE_SOURCES "${NETLIB_LAPACK_DIR}/LAPACKE/src/${LAE_FILE}")
 endforeach ()

+foreach (Utils_FILE ${Utils_SRC})
+  list(APPEND LAPACKE_SOURCES "${NETLIB_LAPACK_DIR}/LAPACKE/utils/${Utils_FILE}")
+endforeach ()
+
 set(lapacke_include_dir "${NETLIB_LAPACK_DIR}/LAPACKE/include")
 execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${lapacke_include_dir}/lapacke_mangling_with_flags.h" "${lapacke_include_dir}/lapacke_mangling.h")
 include_directories(${lapacke_include_dir})


cmake: fixed version handling

cmake: fixed version handling

Use VERSION in top directory to specify version

Signed-off-by: Anas Nashif <0d9952ec84ac43c159f6b7e7ed99a9080c00dd6e@intel.com>

--- cmake/version.cmake
+++ cmake/version.cmake
@@ -1,7 +1,23 @@
-set(PROJECT_VERSION_MAJOR 1)
-set(PROJECT_VERSION_MINOR 9)
-set(PROJECT_VERSION_PATCH 99)
-set(PROJECT_VERSION_TWEAK 0)
+include($ENV{ZEPHYR_BASE}/cmake/hex.cmake)
+file(READ $ENV{ZEPHYR_BASE}/VERSION ver)
+
+string(REGEX MATCH "VERSION_MAJOR = ([0-9]*)" _ ${ver})
+set(PROJECT_VERSION_MAJOR ${CMAKE_MATCH_1})
+
+string(REGEX MATCH "VERSION_MINOR = ([0-9]*)" _ ${ver})
+set(PROJECT_VERSION_MINOR ${CMAKE_MATCH_1})
+
+string(REGEX MATCH "PATCHLEVEL = ([0-9]*)" _ ${ver})
+set(PROJECT_VERSION_PATCH ${CMAKE_MATCH_1})
+
+string(REGEX MATCH "VERSION_TWEAK = ([0-9]*)" _ ${ver})
+set(PROJECT_VERSION_TWEAK ${CMAKE_MATCH_1})
+
+string(REGEX MATCH "EXTRAVERSION = (.*)" _ ${ver})
+set(PROJECT_VERSION_EXTRA ${CMAKE_MATCH_1})
+
+
+message("Zephyr version: ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")

 set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
 if(PROJECT_VERSION_TWEAK)
@@ -9,12 +25,19 @@
 endif()

 set(MAJOR ${PROJECT_VERSION_MAJOR}) # Temporary convenience variable
+set(MINOR ${PROJECT_VERSION_MINOR}) # Temporary convenience variable
+set(PATCH ${PROJECT_VERSION_PATCH}) # Temporary convenience variable

-math(EXPR ZEPHYR_VERSION_CODE                      "(${MAJOR} << 16) + (${MAJOR} << 8) + (${MAJOR})")
-math(EXPR KERNELVERSION                            "(${MAJOR} << 16) + (${MAJOR} << 8) + (${MAJOR})")
-math(EXPR KERNEL_VERSION_NUMBER "(${MAJOR} << 24) + (${MAJOR} << 16) + (${MAJOR} << 8) + ${PROJECT_VERSION_TWEAK}")
+math(EXPR ZEPHYR_VERSION_CODE                      "(${MAJOR} << 16) + (${MINOR} << 8) + (${PATCH})")
+math(EXPR KERNEL_VERSION_NUMBER_INT                "(${MAJOR} << 16) + (${MINOR} << 8) + (${PATCH})")
+math(EXPR KERNELVERSION_INT "(${MAJOR} << 24) + (${MINOR} << 16) + (${PATCH} << 8) + ${PROJECT_VERSION_TWEAK}")
+
+to_hex(${KERNELVERSION_INT} KERNELVERSION)
+to_hex(${KERNEL_VERSION_NUMBER_INT} KERNEL_VERSION_NUMBER)

 unset(MAJOR)
+unset(MINOR)
+unset(PATCH)

 set(KERNEL_VERSION_MAJOR      ${PROJECT_VERSION_MAJOR})
 set(KERNEL_VERSION_MINOR      ${PROJECT_VERSION_MINOR})


Change develop to latest and other branch will get the tag to decide which version it is staying on

--- cmake/version.cmake
+++ cmake/version.cmake
@@ -11,6 +11,20 @@
     RESULT_VARIABLE GIT_RESULT
     ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
   if (NOT ${GIT_RESULT})
+    # Get current branch name
+    execute_process(
+      COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref ${tmp_version}
+      WORKING_DIRECTORY ${PADDLE_SOURCE_DIR}
+      OUTPUT_VARIABLE GIT_BRANCH_NAME
+      RESULT_VARIABLE GIT_BRANCH_RESULT
+      ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
+    # If current branch is develop, then version will be latest
+    if (NOT ${GIT_BRANCH_RESULT})
+      if (${GIT_BRANCH_NAME} MATCHES "develop")
+        set(PADDLE_VERSION "latest")
+        continue()
+      endif()
+    endif()
     # Check the tag is a correct version
     if (${GIT_TAG_NAME} MATCHES "${COMMIT_VERSION_REGEX}")
       # if no tag was found, set PADDLE_VERSION to latest


update

update

--- cmake/DCS08961_SetupVariables.cmake
+++ cmake/DCS08961_SetupVariables.cmake
@@ -26,6 +26,7 @@
 # GLEW
 if(CMAKE_HOST_WIN32)
   set(GLEW_ROOT_DIR "C:/Tools/glew/1.12.0")
+  set(GLEW_COMPONENTS "COMPONENTS STATIC")
 endif()

 # GL[I|M]
@@ -44,7 +45,7 @@
   set(OGLplus_ROOT_DIR "C:/Tools/oglplus/oglplus-git/_install")
 else()
   if(UNIX)
-    set(OGLplus_ROOT_DIR "~/Projects/others/oglplus-develop-git/_install")
+    set(OGLplus_ROOT_DIR "~/Projects/others/oglplus-master-git/_install")
   endif()
 endif()


uncomment in DefineApproxMVBBSources

uncomment in DefineApproxMVBBSources

--- cmake/DefineApproxMVBBSources.cmake
+++ cmake/DefineApproxMVBBSources.cmake
@@ -16,12 +16,6 @@

     INCLUDE_GEOMETRYPREDICATES_SOURCE( ApproxMVBB_GEOMPRED_SRC ApproxMVBB_GEOMPRED_INC ApproxMVBB_GEOMPRED_INC_DIRS ApproxMVBB_GEOMPRED_TARGETS
         ${ApproxMVBB_ROOT_DIR}/external/GeometryPredicates ${ApproxMVBB_ROOT_DIR} ${ApproxMVBB_BINARY_DIR})
-
-    #INCLUDE_PUGIXML_SOURCE(           ApproxMVBB_PUGIXML_SRC ApproxMVBB_PUGIXML_INC ApproxMVBB_PUGIXML_INC_DIRS
-        #${ApproxMVBB_ROOT_DIR}/external/pugixml ${ApproxMVBB_ROOT_DIR} ${ApproxMVBB_BINARY_DIR})
-
-    #INCLUDE_META_SOURCE(           ApproxMVBB_META_SRC ApproxMVBB_META_INC ApproxMVBB_META_INC_DIRS
-        #${ApproxMVBB_ROOT_DIR}/external/meta ${ApproxMVBB_ROOT_DIR} ${ApproxMVBB_BINARY_DIR})


[cmake] Obtain LLVM_CMAKE_PATH from llvm-config if available

Use the new --cmakedir option to obtain LLVM_CMAKE_PATH straight from
llvm-config. Fallback to local reconstruction if llvm-config does not
support this option.

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

--- cmake/Modules/CompilerRTUtils.cmake
+++ cmake/Modules/CompilerRTUtils.cmake
@@ -219,8 +219,18 @@
   set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree")

   # Make use of LLVM CMake modules.
-  file(TO_CMAKE_PATH ${LLVM_BINARY_DIR} LLVM_BINARY_DIR_CMAKE_STYLE)
-  set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
+  # --cmakedir is supported since llvm r291218 (4.0 release)
+  execute_process(
+    COMMAND ${LLVM_CONFIG_PATH} --cmakedir
+    RESULT_VARIABLE HAD_ERROR
+    OUTPUT_VARIABLE CONFIG_OUTPUT)
+  if(NOT HAD_ERROR)
+    string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH)
+  else()
+    file(TO_CMAKE_PATH ${LLVM_BINARY_DIR} LLVM_BINARY_DIR_CMAKE_STYLE)
+    set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
+  endif()
+
   list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
   # Get some LLVM variables from LLVMConfig.
   include("${LLVM_CMAKE_PATH}/LLVMConfig.cmake")


clang-format custom target failes to build if building with libzmq

--- builds/cmake/Modules/ClangFormat.cmake
+++ builds/cmake/Modules/ClangFormat.cmake
@@ -19,7 +19,7 @@
 endif()

 add_custom_target(
-        clang-format
+        clang-format-czmq
         COMMAND ${CLANG_FORMAT} -style=file -i ${ALL_SOURCE_FILES}
 )

@@ -31,14 +31,14 @@
 configure_file(builds/cmake/clang-format-check.sh.in clang-format-check.sh @ONLY)

 add_custom_target(
-        clang-format-check
+        clang-format-czmq-check
         COMMAND chmod +x clang-format-check.sh
         COMMAND ./clang-format-check.sh
         COMMENT "Checking correct formatting according to .clang-format file using ${CLANG_FORMAT}"
 )

 add_custom_target(
-        clang-format-diff
+        clang-format-czmq-diff
         COMMAND ${CLANG_FORMAT} -style=file -i ${ALL_SOURCE_FILES}
         COMMAND git diff ${ALL_SOURCE_FILES}
         COMMENT "Formatting with clang-format (using ${CLANG_FORMAT}) and showing differences with latest commit"


cmake: Debug FindThreads

cmake: Debug FindThreads

git-svn-id: 3ec853389310512053d525963cab269c063bb453@1798745 13f79535-47bb-0310-9956-ffa450edef68

--- cmake/XercesMutexMgrSelection.cmake
+++ cmake/XercesMutexMgrSelection.cmake
@@ -22,6 +22,8 @@
 option(threads "Threading support" ON)

 if(threads)
+  set(THREADS_PREFER_PTHREAD_FLAG ON)
+  add_definitions(-D_THREAD_SAFE)
   find_package(Threads)

   if(TARGET Threads::Threads)


boards: arm: gd32f450i_eval: add jlink runner

Add jlink runner for GD32F450i_EVAL board.

Signed-off-by: HaiLong Yang <e068ec63ddb67eb5ecd1ae308a493d5a178e242e@pm.me>

--- boards/arm/gd32f450i_eval/board.cmake
+++ boards/arm/gd32f450i_eval/board.cmake
@@ -1,4 +1,8 @@
 # Copyright (c) 2021, Teslabs Engineering S.L.
+# Copyright (c) 2021, BrainCo Inc.
 # SPDX-License-Identifier: Apache-2.0

+board_runner_args(jlink "--device=GD32F450IK" "--speed=4000")
+
 include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
+include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)


cmake: Allow GetGitRevisionDescription to take arbitrary directory paths

--- tools/cmake/third_party/GetGitRevisionDescription.cmake
+++ tools/cmake/third_party/GetGitRevisionDescription.cmake
@@ -3,16 +3,16 @@
 # These functions force a re-configure on each git commit so that you can
 # trust the values of the variables in your build system.
 #
-#  get_git_head_revision(<refspecvar> <hashvar> [<additional arguments to git describe> ...])
+#  get_git_head_revision(<refspecvar> <hashvar> <repo dir> [<additional arguments to git describe> ...])
 #
 # Returns the refspec and sha hash of the current head revision
 #
-#  git_describe(<var> [<additional arguments to git describe> ...])
+#  git_describe(<var> <repo dir> [<additional arguments to git describe> ...])
 #
 # Returns the results of git describe on the source tree, and adjusting
 # the output so that it tests false if an error occurs.
 #
-#  git_get_exact_tag(<var> [<additional arguments to git describe> ...])
+#  git_get_exact_tag(<var> <repo dir> [<additional arguments to git describe> ...])
 #
 # Returns the results of git describe --exact-match on the source tree,
 # and adjusting the output so that it tests false if there was no exact
@@ -29,6 +29,9 @@
 # Distributed under the Boost Software License, Version 1.0.
 # (See accompanying file LICENSE_1_0.txt or copy at
 # http://www.boost.org/LICENSE_1_0.txt)
+#
+# Updated 2018 Espressif Systems to add _repo_dir argument
+# to get revision of other repositories

 if(__get_git_revision_description)
 	return()
@@ -39,8 +42,8 @@
 # to find the path to this module rather than the path to a calling list file
 get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)

-function(get_git_head_revision _refspecvar _hashvar)
-	set(GIT_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
+function(get_git_head_revision _refspecvar _hashvar _repo_dir)
+    set(GIT_PARENT_DIR "${_repo_dir}")
 	set(GIT_DIR "${GIT_PARENT_DIR}/.git")
 	while(NOT EXISTS "${GIT_DIR}")	# .git dir not found, search parent directories
 		set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}")
@@ -80,11 +83,11 @@
 	set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE)
 endfunction()

-function(git_describe _var)
+function(git_describe _var _repo_dir)
 	if(NOT GIT_FOUND)
 		find_package(Git QUIET)
 	endif()
-	get_git_head_revision(refspec hash)
+	get_git_head_revision(refspec hash "${_repo_dir}")
 	if(NOT GIT_FOUND)
 		set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
 		return()
@@ -124,7 +127,7 @@
 	set(${_var} "${out}" PARENT_SCOPE)
 endfunction()

-function(git_get_exact_tag _var)
-	git_describe(out --exact-match ${ARGN})
+function(git_get_exact_tag _var _repo_dir)
+	git_describe(out "${_repo_dir}" --exact-match ${ARGN})
 	set(${_var} "${out}" PARENT_SCOPE)
 endfunction()


removed special handling cmake file

removed special handling cmake file

--- config.attiny.cmake
+++ config.attiny.cmake
@@ -1,18 +0,0 @@
-# necessary settings for the chip we use
-set(MCU attiny45)
-set(F_CPU 8000000)
-set(BAUD 9600)
-
-# set the programmer and the device to use (default is to use simavr)
-set(PROGRAMMER usbasp)
-set(SERIAL_DEV /dev/cu.SLAB_USBtoUART)
-#set(PROGRAMMER arduino)
-#set(SERIAL_DEV /tmp/simavr-uart0)
-
-# only needed if we do floating point math and want to print floats with printf
-#set(EXTRA_LIBS "-lm -lprintf_flt")
-# show a list of libs linked
-set(EXTRA_LIBS "-Wl,--trace")
-
-# if you want to compile Arduino sketches, set this to the Arduino SDK dir (1.6.5)
-set(ARDUINO_SDK_PATH "/Applications/Arduino.app/Contents/Java" CACHE STRING "Arduino SDK Path")


Adding error to package_source if source missing

--- math/minuit2/StandAlone.cmake
+++ math/minuit2/StandAlone.cmake
@@ -146,7 +146,16 @@
 set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
 set(CPACK_RESOURCE_FILE_LICENSE "${LICENSE_FILE}")
 set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
-set(CPACK_SOURCE_GENERATOR "TGZ;ZIP")
+
+# Making a source package should fail if standalone has not been built
+# Setting an obvious package name in case a generator is manually specified
+if(minuit2-inroot AND NOT minuit2-standalone)
+    set(CPACK_SOURCE_GENERATOR "ERROR_MINUIT2_STANDALONE_OFF")
+    set(CPACK_SOURCE_PACKAGE_FILE_NAME "Minuit2-MISSING_FILES-Source")
+else()
+    set(CPACK_SOURCE_GENERATOR "TGZ;ZIP")
+endif()
+
 # CPack collects *everything* except what's listed here.
 set(CPACK_SOURCE_IGNORE_FILES
     /test/CMakeLists.txt


Add extra test label argument for vtk_module macro

This argument allow to set a label to the tests that
are automatically created within that module such as
the *-HeaderTest.

Usage example:

vtk_module(vtkPointSpriteGraphics
  DEPENDS
    vtkFiltersCore
  EXCLUDE_FROM_WRAP_HIERARCHY
  TEST_LABELS
    PARAVIEW
)

Change-Id: Id447c109c6e6523cbd980b91a9328ba11167d75d

--- CMake/vtkModuleMacros.cmake
+++ CMake/vtkModuleMacros.cmake
@@ -28,8 +28,9 @@
   set(${vtk-module}_EXCLUDE_FROM_ALL 0)
   set(${vtk-module}_EXCLUDE_FROM_WRAPPING 0)
   set(${vtk-module}_EXCLUDE_FROM_WRAP_HIERARCHY 0)
+  set(${vtk-module}_TEST_LABELS "")
   foreach(arg ${ARGN})
-  if("${arg}" MATCHES "^((|COMPILE_|TEST_|)DEPENDS|DESCRIPTION|TCL_NAME|IMPLEMENTS|DEFAULT|GROUPS)$")
+  if("${arg}" MATCHES "^((|COMPILE_|TEST_|)DEPENDS|DESCRIPTION|TCL_NAME|IMPLEMENTS|DEFAULT|GROUPS|TEST_LABELS)$")
       set(_doing "${arg}")
     elseif("${arg}" MATCHES "^EXCLUDE_FROM_ALL$")
       set(_doing "")
@@ -46,6 +47,8 @@
       message(AUTHOR_WARNING "Unknown argument [${arg}]")
     elseif("${_doing}" MATCHES "^DEPENDS$")
       list(APPEND ${vtk-module}_DEPENDS "${arg}")
+    elseif("${_doing}" MATCHES "^TEST_LABELS$")
+      list(APPEND ${vtk-module}_TEST_LABELS "${arg}")
     elseif("${_doing}" MATCHES "^TEST_DEPENDS$")
       list(APPEND ${vtk-module-test}_DEPENDS "${arg}")
     elseif("${_doing}" MATCHES "^COMPILE_DEPENDS$")
@@ -480,6 +483,9 @@
       COMMAND ${PYTHON_EXECUTABLE} ${VTK_SOURCE_DIR}/Testing/Core/HeaderTesting.py
                                    ${CMAKE_CURRENT_SOURCE_DIR} ${MOD}_EXPORT
       )
+    set_tests_properties(${vtk-module}-HeaderTest
+      PROPERTIES LABELS "${${vtk-module}_TEST_LABELS}"
+      )
   endif()

   if(BUILD_TESTING AND TCL_TCLSH)
@@ -495,6 +501,12 @@
       COMMAND ${TCL_TCLSH}
       ${VTK_SOURCE_DIR}/Testing/Core/PrintSelfCheck.tcl
       ${${vtk-module}_SOURCE_DIR})
+    set_tests_properties(${vtk-module}-TestSetObjectMacro
+      PROPERTIES LABELS "${${vtk-module}_TEST_LABELS}"
+      )
+    set_tests_properties(${vtk-module}-TestPrintSelf
+      PROPERTIES LABELS "${${vtk-module}_TEST_LABELS}"
+      )
   endif()

   # Add the module to the list of wrapped modules if necessary


Add module include directories before all other include directories

This commit add module include directories (BINARY_DIR and SOURCE_DIR)
before all other includes so they are searched before the rest,
this fix a bug where, eg. leftover header files generated from the Qt moc
in an unclean build directory could be found first if the Qt source files
were moved from one module to another

--- CMake/vtkModuleMacros.cmake
+++ CMake/vtkModuleMacros.cmake
@@ -160,6 +160,14 @@
 macro(vtk_module_impl)
   include(module.cmake OPTIONAL) # Load module meta-data

+  list(APPEND ${vtk-module}_INCLUDE_DIRS
+    ${${vtk-module}_BINARY_DIR}
+    ${${vtk-module}_SOURCE_DIR})
+  list(REMOVE_DUPLICATES ${vtk-module}_INCLUDE_DIRS)
+  if(${vtk-module}_INCLUDE_DIRS)
+    include_directories(${${vtk-module}_INCLUDE_DIRS})
+  endif()
+
   vtk_module_config(_dep ${${vtk-module}_DEPENDS})
   if(_dep_INCLUDE_DIRS)
     include_directories(${_dep_INCLUDE_DIRS})
@@ -179,14 +187,6 @@
     endif()
   endif()

-  list(APPEND ${vtk-module}_INCLUDE_DIRS
-    ${${vtk-module}_BINARY_DIR}
-    ${${vtk-module}_SOURCE_DIR})
-  list(REMOVE_DUPLICATES ${vtk-module}_INCLUDE_DIRS)
-
-  if(${vtk-module}_INCLUDE_DIRS)
-    include_directories(${${vtk-module}_INCLUDE_DIRS})
-  endif()
   if(${vtk-module}_SYSTEM_INCLUDE_DIRS)
     include_directories(${${vtk-module}_SYSTEM_INCLUDE_DIRS})
   endif()


[3531904] Update FindSoftimage.cmake to find Softimage 2013

--- CMake/Packages/FindSoftimage.cmake
+++ CMake/Packages/FindSoftimage.cmake
@@ -32,6 +32,7 @@
   "$ENV{ProgramFiles}/Autodesk/Softimage 2011 SP1/XSISDK"
   "$ENV{ProgramFiles}/Autodesk/Softimage 2012/XSISDK"
   "$ENV{ProgramFiles}/Autodesk/Softimage 2012 SP1/XSISDK"
+  "$ENV{ProgramFiles}/Autodesk/Softimage 2013/XSISDK"
   "C:/Softimage/XSI_6.0_x64/XSISDK"
   "C:/Softimage/XSI_6.01_x64/XSISDK"
   "C:/Softimage/XSI_6.02_x64/XSISDK"
@@ -45,6 +46,7 @@
   "$ENV{ProgramW6432}/Autodesk/Softimage 2011 SP1/XSISDK"
   "$ENV{ProgramW6432}/Autodesk/Softimage 2012/XSISDK"
   "$ENV{ProgramW6432}/Autodesk/Softimage 2012 SP1/XSISDK"
+  "$ENV{ProgramW6432}/Autodesk/Softimage 2013/XSISDK"
 )

 if (CMAKE_CL_64)


python library postfix for mac

python library postfix for mac

--- CMake/mitkMacroInstallPython.cmake
+++ CMake/mitkMacroInstallPython.cmake
@@ -1,8 +1,10 @@

 macro(MITK_INSTALL_PYTHON _python_libs _python_dirs)
   if(UNIX)
-    set(PYTHON_LIB_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX})
+    # apple and linux only supports .so as loadable extension
+    set(PYTHON_LIB_SUFFIX .so)
   else(WIN32)
+    # windows only supports pyd as loadable extension
     set(PYTHON_LIB_SUFFIX .pyd)
   endif()


[CMake][Python] The Python installation directory is now the standard one.

--- config/project_config_embeddable.cmake
+++ config/project_config_embeddable.cmake
@@ -113,8 +113,6 @@
   # Offer the user the choice of overriding the installation directories
   set (INSTALL_LIB_DIR ${LIBDIR} CACHE PATH
 	"Installation directory for libraries")
-  set (INSTALL_PY_LIB_DIR ${LIBDIR}/python${PYTHONLIBS_VERSION}/${PROJECT_NAME}
-	CACHE PATH "Installation directory for Python libraries")
   set (INSTALL_BIN_DIR bin CACHE PATH "Installation directory for executables")
   set (INSTALL_LIBEXEC_DIR CACHE PATH
 	"Installation directory for internal executables")
@@ -498,7 +496,11 @@
       PYTHONLIBS_VERSION "${PYTHONLIBS_LIB_FILENAME}")
 	message (STATUS "Found PythonLibs ${PYTHONLIBS_VERSION}")

-    # Update the list of include directories for the project
+	# Set the Python installation directory
+	set (INSTALL_PY_LIB_DIR ${INSTALL_LIB_DIR}/python${PYTHONLIBS_VERSION}/site-packages/libpy${PROJECT_NAME}
+	  CACHE PATH "Installation directory for Python libraries")
+
+	# Update the list of include directories for the project
     include_directories (${PYTHON_INCLUDE_DIRS})

     # Update the list of dependencies for the project
@@ -1420,7 +1422,7 @@
   set (exec_prefix   ${prefix})
   set (bindir        ${exec_prefix}/bin)
   set (libdir        ${exec_prefix}/${LIBDIR})
-  set (pylibdir	     ${libdir}/python${PYTHONLIBS_VERSION}/${PACKAGE})
+  set (pylibdir	     ${libdir}/python${PYTHONLIBS_VERSION}/site-packages/libpy${PACKAGE})
   set (libexecdir    ${exec_prefix}/libexec)
   set (sbindir       ${exec_prefix}/sbin)
   set (sysconfdir    ${prefix}/etc)


Fix missing protobuf flags.

Fix missing protobuf flags.

--- cmake/Modules/LightStepProtobuf.cmake
+++ cmake/Modules/LightStepProtobuf.cmake
@@ -37,6 +37,7 @@
          ${LIGHTSTEP_CARRIER_PB_CPP_FILE}
  COMMAND ${PROTOBUF_PROTOC_EXECUTABLE}
  ARGS "--proto_path=${PROTO_PATH}/third_party/googleapis"
+      ${PROTOBUF_INCLUDE_FLAGS}
       "--cpp_out=${GENERATED_PROTOBUF_PATH}"
       ${GOOGLE_API_HTTP_PROTO}
       ${GOOGLE_API_ANNOTATIONS_PROTO}


Update to be the same as the version from CMake 3.0.0-rc3 except the
tar.xz name patch is applied (see
<http://public.kitware.com/Bug/view.php?id=14318>) so that tar.xz
unpacking abilities of CMake can be used.

svn path=/trunk/; revision=13109

--- cmake/epa_build/ExternalProject.cmake
+++ cmake/epa_build/ExternalProject.cmake
@@ -1,7 +1,15 @@
-# - Create custom targets to build projects in external trees
-# The 'ExternalProject_Add' function creates a custom target to drive
+#.rst:
+# ExternalProject
+# ---------------
+#
+# Create custom targets to build projects in external trees
+#
+# The ``ExternalProject_Add`` function creates a custom target to drive
 # download, update/patch, configure, build, install and test steps of an
 # external project:
+#
+# .. code-block:: cmake
+#
 #  ExternalProject_Add(<name>    # Name for custom target
 #    [DEPENDS projects...]       # Targets on which the project depends
 #    [PREFIX dir]                # Root dir for entire project
@@ -22,6 +30,7 @@
 #    [SVN_TRUST_CERT 1 ]         # Trust the Subversion server site certificate
 #    [GIT_REPOSITORY url]        # URL of git repo
 #    [GIT_TAG tag]               # Git branch name, commit id or tag
+#    [GIT_SUBMODULES modules...] # Git submodules that shall be updated, all if empty
 #    [HG_REPOSITORY url]         # URL of mercurial repo
 #    [HG_TAG tag]                # Mercurial branch name, commit id or tag
 #    [URL /.../src.tgz]          # Full path or URL of source
@@ -62,40 +71,45 @@
 #   #--Custom targets-------------
 #    [STEP_TARGETS st1 st2 ...]  # Generate custom targets for these steps
 #    )
-# The *_DIR options specify directories for the project, with default
-# directories computed as follows.
-# If the PREFIX option is given to ExternalProject_Add() or the EP_PREFIX
-# directory property is set, then an external project is built and installed
-# under the specified prefix:
-#   TMP_DIR      = <prefix>/tmp
-#   STAMP_DIR    = <prefix>/src/<name>-stamp
-#   DOWNLOAD_DIR = <prefix>/src
-#   SOURCE_DIR   = <prefix>/src/<name>
-#   BINARY_DIR   = <prefix>/src/<name>-build
-#   INSTALL_DIR  = <prefix>
-# Otherwise, if the EP_BASE directory property is set then components
-# of an external project are stored under the specified base:
-#   TMP_DIR      = <base>/tmp/<name>
-#   STAMP_DIR    = <base>/Stamp/<name>
-#   DOWNLOAD_DIR = <base>/Download/<name>
-#   SOURCE_DIR   = <base>/Source/<name>
-#   BINARY_DIR   = <base>/Build/<name>
-#   INSTALL_DIR  = <base>/Install/<name>
-# If no PREFIX, EP_PREFIX, or EP_BASE is specified then the default
-# is to set PREFIX to "<name>-prefix".
-# Relative paths are interpreted with respect to the build directory
-# corresponding to the source directory in which ExternalProject_Add is
-# invoked.
-#
-# If SOURCE_DIR is explicitly set to an existing directory the project
-# will be built from it.
-# Otherwise a download step must be specified using one of the
-# DOWNLOAD_COMMAND, CVS_*, SVN_*, or URL options.
-# The URL option may refer locally to a directory or source tarball,
-# or refer to a remote tarball (e.g. http://.../src.tgz).
-#
-# The 'ExternalProject_Add_Step' function adds a custom step to an external
-# project:
+#
+# The ``*_DIR`` options specify directories for the project, with default
+# directories computed as follows.  If the ``PREFIX`` option is given to
+# ``ExternalProject_Add()`` or the ``EP_PREFIX`` directory property is set,
+# then an external project is built and installed under the specified prefix::
+#
+#  TMP_DIR      = <prefix>/tmp
+#  STAMP_DIR    = <prefix>/src/<name>-stamp
+#  DOWNLOAD_DIR = <prefix>/src
+#  SOURCE_DIR   = <prefix>/src/<name>
+#  BINARY_DIR   = <prefix>/src/<name>-build
+#  INSTALL_DIR  = <prefix>
+#
+# Otherwise, if the ``EP_BASE`` directory property is set then components
+# of an external project are stored under the specified base::
+#
+#  TMP_DIR      = <base>/tmp/<name>
+#  STAMP_DIR    = <base>/Stamp/<name>
+#  DOWNLOAD_DIR = <base>/Download/<name>
+#  SOURCE_DIR   = <base>/Source/<name>
+#  BINARY_DIR   = <base>/Build/<name>
+#  INSTALL_DIR  = <base>/Install/<name>
+#
+# If no ``PREFIX``, ``EP_PREFIX``, or ``EP_BASE`` is specified then the
+# default is to set ``PREFIX`` to ``<name>-prefix``.  Relative paths are
+# interpreted with respect to the build directory corresponding to the
+# source directory in which ``ExternalProject_Add`` is invoked.
+#
+# If ``SOURCE_DIR`` is explicitly set to an existing directory the project
+# will be built from it.  Otherwise a download step must be specified
+# using one of the ``DOWNLOAD_COMMAND``, ``CVS_*``, ``SVN_*``, or ``URL``
+# options.  The ``URL`` option may refer locally to a directory or source
+# tarball, or refer to a remote tarball (e.g. ``http://.../src.tgz``).
+#
+# The ``ExternalProject_Add_Step`` function adds a custom step to an
+# external project:
+#
+# .. code-block:: cmake
+#
 #  ExternalProject_Add_Step(<name> <step> # Names of project and custom step
 #    [COMMAND cmd...]        # Command line invoked by this step
 #    [COMMENT "text..."]     # Text printed when step executes
@@ -106,61 +120,66 @@
 #    [WORKING_DIRECTORY dir] # Working directory for command
 #    [LOG 1]                 # Wrap step in script to log output
 #    )
-# The command line, comment, and working directory of every standard
-# and custom step is processed to replace tokens
-# <SOURCE_DIR>,
-# <BINARY_DIR>,
-# <INSTALL_DIR>,
-# and <TMP_DIR>
-# with corresponding property values.
-#
-# Any builtin step that specifies a "<step>_COMMAND cmd..." or custom
-# step that specifies a "COMMAND cmd..." may specify additional command
-# lines using the form "COMMAND cmd...".  At build time the commands will
-# be executed in order and aborted if any one fails.  For example:
+#
+# The command line, comment, and working directory of every standard and
+# custom step is processed to replace tokens ``<SOURCE_DIR>``,
+# ``<BINARY_DIR>``, ``<INSTALL_DIR>``, and ``<TMP_DIR>`` with
+# corresponding property values.
+#
+# Any builtin step that specifies a ``<step>_COMMAND cmd...`` or custom
+# step that specifies a ``COMMAND cmd...`` may specify additional command
+# lines using the form ``COMMAND cmd...``.  At build time the commands
+# will be executed in order and aborted if any one fails.  For example::
+#
 #  ... BUILD_COMMAND make COMMAND echo done ...
-# specifies to run "make" and then "echo done" during the build step.
-# Whether the current working directory is preserved between commands
-# is not defined.  Behavior of shell operators like "&&" is not defined.
-#
-# The 'ExternalProject_Get_Property' function retrieves external project
-# target properties:
+#
+# specifies to run ``make`` and then ``echo done`` during the build step.
+# Whether the current working directory is preserved between commands is
+# not defined.  Behavior of shell operators like ``&&`` is not defined.
+#
+# The ``ExternalProject_Get_Property`` function retrieves external project
+# target properties::
+#
 #  ExternalProject_Get_Property(<name> [prop1 [prop2 [...]]])
-# It stores property values in variables of the same name.
-# Property names correspond to the keyword argument names of
-# 'ExternalProject_Add'.
-#
-# The 'ExternalProject_Add_StepTargets' function generates custom targets for
-# the steps listed:
+#
+# It stores property values in variables of the same name.  Property
+# names correspond to the keyword argument names of
+# ``ExternalProject_Add``.
+#
+# The ``ExternalProject_Add_StepTargets`` function generates custom
+# targets for the steps listed::
+#
 #  ExternalProject_Add_StepTargets(<name> [step1 [step2 [...]]])
 #
-# If STEP_TARGETS is set then ExternalProject_Add_StepTargets is automatically
-# called at the end of matching calls to ExternalProject_Add_Step. Pass
-# STEP_TARGETS explicitly to individual ExternalProject_Add calls, or
-# implicitly to all ExternalProject_Add calls by setting the directory property
-# EP_STEP_TARGETS.
-#
-# If STEP_TARGETS is not set, clients may still manually call
-# ExternalProject_Add_StepTargets after calling ExternalProject_Add or
-# ExternalProject_Add_Step.
+# If ``STEP_TARGETS`` is set then ``ExternalProject_Add_StepTargets`` is
+# automatically called at the end of matching calls to
+# ``ExternalProject_Add_Step``.  Pass ``STEP_TARGETS`` explicitly to
+# individual ``ExternalProject_Add`` calls, or implicitly to all
+# ``ExternalProject_Add`` calls by setting the directory property
+# ``EP_STEP_TARGETS``.
+#
+# If ``STEP_TARGETS`` is not set, clients may still manually call
+# ``ExternalProject_Add_StepTargets`` after calling
+# ``ExternalProject_Add`` or ``ExternalProject_Add_Step``.
 #
 # This functionality is provided to make it easy to drive the steps
-# independently of each other by specifying targets on build command lines.
-# For example, you may be submitting to a sub-project based dashboard, where
-# you want to drive the configure portion of the build, then submit to the
-# dashboard, followed by the build portion, followed by tests. If you invoke
-# a custom target that depends on a step halfway through the step dependency
-# chain, then all the previous steps will also run to ensure everything is
-# up to date.
-#
-# For example, to drive configure, build and test steps independently for each
-# ExternalProject_Add call in your project, write the following line prior to
-# any ExternalProject_Add calls in your CMakeLists file:
-#
-#   set_property(DIRECTORY PROPERTY EP_STEP_TARGETS configure build test)
+# independently of each other by specifying targets on build command
+# lines.  For example, you may be submitting to a sub-project based
+# dashboard, where you want to drive the configure portion of the build,
+# then submit to the dashboard, followed by the build portion, followed
+# by tests.  If you invoke a custom target that depends on a step
+# halfway through the step dependency chain, then all the previous steps
+# will also run to ensure everything is up to date.
+#
+# For example, to drive configure, build and test steps independently
+# for each ``ExternalProject_Add`` call in your project, write the following
+# line prior to any ``ExternalProject_Add`` calls in your ``CMakeLists.txt``
+# file::
+#
+#  set_property(DIRECTORY PROPERTY EP_STEP_TARGETS configure build test)

 #=============================================================================
-# Copyright 2008-2012 Kitware, Inc.
+# Copyright 2008-2013 Kitware, Inc.
 #
 # Distributed under the OSI-approved BSD License (the "License");
 # see accompanying file Copyright.txt for details.
@@ -271,7 +290,7 @@
   )

-function(_ep_write_gitclone_script script_filename source_dir git_EXECUTABLE git_repository git_tag src_name work_dir gitclone_infofile gitclone_stampfile)
+function(_ep_write_gitclone_script script_filename source_dir git_EXECUTABLE git_repository git_tag git_submodules src_name work_dir gitclone_infofile gitclone_stampfile)
   file(WRITE ${script_filename}
 "if(\"${git_tag}\" STREQUAL \"\")
   message(FATAL_ERROR \"Tag for git checkout should not be empty.\")
@@ -334,7 +353,7 @@
 endif()

 execute_process(
-  COMMAND \"${git_EXECUTABLE}\" submodule update --recursive
+  COMMAND \"${git_EXECUTABLE}\" submodule update --recursive ${git_submodules}
   WORKING_DIRECTORY \"${work_dir}/${src_name}\"
   RESULT_VARIABLE error_code
   )
@@ -422,7 +441,7 @@
 endfunction()

-function(_ep_write_gitupdate_script script_filename git_EXECUTABLE git_tag git_repository work_dir)
+function(_ep_write_gitupdate_script script_filename git_EXECUTABLE git_tag git_submodules git_repository work_dir)
   file(WRITE ${script_filename}
 "if(\"${git_tag}\" STREQUAL \"\")
   message(FATAL_ERROR \"Tag for git checkout should not be empty.\")
@@ -481,7 +500,7 @@
   endif()

   execute_process(
-    COMMAND \"${git_EXECUTABLE}\" submodule update --recursive
+    COMMAND \"${git_EXECUTABLE}\" submodule update --recursive ${git_submodules}
     WORKING_DIRECTORY \"${work_dir}/${src_name}\"
     RESULT_VARIABLE error_code
     )
@@ -567,13 +586,30 @@
 endfunction()

-function(_ep_write_verifyfile_script script_filename local hash)
+function(_ep_write_verifyfile_script script_filename local hash retries download_script)
   if("${hash}" MATCHES "${_ep_hash_regex}")
     set(algo "${CMAKE_MATCH_1}")
     string(TOLOWER "${CMAKE_MATCH_2}" expect_value)
     set(script_content "set(expect_value \"${expect_value}\")
-file(${algo} \"\${file}\" actual_value)
-if(\"\${actual_value}\" STREQUAL \"\${expect_value}\")
+set(attempt 0)
+set(succeeded 0)
+while(\${attempt} LESS ${retries} OR \${attempt} EQUAL ${retries} AND NOT \${succeeded})
+  file(${algo} \"\${file}\" actual_value)
+  if(\"\${actual_value}\" STREQUAL \"\${expect_value}\")
+    set(succeeded 1)
+  elseif(\${attempt} LESS ${retries})
+    message(STATUS \"${algo} hash of \${file}
+does not match expected value
+  expected: \${expect_value}
+    actual: \${actual_value}
+Retrying download.
+\")
+    file(REMOVE \"\${file}\")
+    execute_process(COMMAND ${CMAKE_COMMAND} -P \"${download_script}\")
+  endif()
+endwhile()
+
+if(\${succeeded})
   message(STATUS \"verifying file... done\")
 else()
   message(FATAL_ERROR \"error: ${algo} hash of
@@ -1112,7 +1148,7 @@
     set_property(SOURCE ${stamp_file} PROPERTY SYMBOLIC 1)
     set(touch)
   else()
-    set(touch ${TOUCH_EXECUTABLE} ${stamp_file})
+    set(touch ${CMAKE_COMMAND} -E touch ${stamp_file})
   endif()

   # Wrap with log script?
@@ -1288,6 +1324,7 @@
     if(NOT git_tag)
       set(git_tag "master")
     endif()
+    get_property(git_submodules TARGET ${name} PROPERTY _EP_GIT_SUBMODULES)

     # For the download step, and the git clone operation, only the repository
     # should be recorded in a configured RepositoryInfo file. If the repo
@@ -1312,7 +1349,7 @@
     # The script will delete the source directory and then call git clone.
     #
     _ep_write_gitclone_script(${tmp_dir}/${name}-gitclone.cmake ${source_dir}
-      ${GIT_EXECUTABLE} ${git_repository} ${git_tag} ${src_name} ${work_dir}
+      ${GIT_EXECUTABLE} ${git_repository} ${git_tag} "${git_submodules}" ${src_name} ${work_dir}
       ${stamp_dir}/${name}-gitinfo.txt ${stamp_dir}/${name}-gitclone-lastrun.txt
       )
     set(comment "Performing download step (git clone) for '${name}'")
@@ -1376,6 +1413,8 @@
     set(repository "external project URL")
     set(module "${url}")
     set(tag "${hash}")
+    set(retries 0)
+    set(download_script "")
     configure_file(
       "${CMAKE_ROOT}/Modules/RepositoryInfo.txt.in"
       "${stamp_dir}/${name}-urlinfo.txt"
@@ -1405,16 +1444,17 @@
         get_property(timeout TARGET ${name} PROPERTY _EP_TIMEOUT)
         get_property(tls_verify TARGET ${name} PROPERTY _EP_TLS_VERIFY)
         get_property(tls_cainfo TARGET ${name} PROPERTY _EP_TLS_CAINFO)
-        _ep_write_downloadfile_script("${stamp_dir}/download-${name}.cmake"
-          "${url}" "${file}" "${timeout}" "${hash}" "${tls_verify}" "${tls_cainfo}")
-        set(cmd ${CMAKE_COMMAND} -P ${stamp_dir}/download-${name}.cmake
+        set(download_script "${stamp_dir}/download-${name}.cmake")
+        _ep_write_downloadfile_script("${download_script}" "${url}" "${file}" "${timeout}" "${hash}" "${tls_verify}" "${tls_cainfo}")
+        set(cmd ${CMAKE_COMMAND} -P "${download_script}"
           COMMAND)
+        set(retries 3)
         set(comment "Performing download step (download, verify and extract) for '${name}'")
       else()
         set(file "${url}")
         set(comment "Performing download step (verify and extract) for '${name}'")
       endif()
-      _ep_write_verifyfile_script("${stamp_dir}/verify-${name}.cmake" "${file}" "${hash}")
+      _ep_write_verifyfile_script("${stamp_dir}/verify-${name}.cmake" "${file}" "${hash}" "${retries}" "${download_script}")
       list(APPEND cmd ${CMAKE_COMMAND} -P ${stamp_dir}/verify-${name}.cmake
         COMMAND)
       _ep_write_extractfile_script("${stamp_dir}/extract-${name}.cmake" "${name}" "${file}" "${source_dir}")
@@ -1503,8 +1543,9 @@
     if(NOT git_tag)
       set(git_tag "master")
     endif()
+    get_property(git_submodules TARGET ${name} PROPERTY _EP_GIT_SUBMODULES)
     _ep_write_gitupdate_script(${tmp_dir}/${name}-gitupdate.cmake
-      ${GIT_EXECUTABLE} ${git_tag} ${git_repository} ${work_dir}
+      ${GIT_EXECUTABLE} ${git_tag} "${git_submodules}" ${git_repository} ${work_dir}
       )
     set(cmd ${CMAKE_COMMAND} -P ${tmp_dir}/${name}-gitupdate.cmake)
     set(always 1)
@@ -1782,8 +1823,8 @@
     OUTPUT ${complete_outputs}
     COMMENT "Completed '${name}'"
     COMMAND ${CMAKE_COMMAND} -E make_directory ${cmf_dir}${cfgdir}
-    COMMAND ${TOUCH_EXECUTABLE} ${complete_stamp_file}
-    COMMAND ${TOUCH_EXECUTABLE} ${done_stamp_file}
+    COMMAND ${CMAKE_COMMAND} -E touch ${complete_stamp_file}
+    COMMAND ${CMAKE_COMMAND} -E touch ${done_stamp_file}
     DEPENDS ${install_stamp_file}
     VERBATIM
     )