cmake: support finding a cross compiled llvm

--- cmake/Findllvm.cmake
+++ cmake/Findllvm.cmake
@@ -7,117 +7,301 @@
 # LLVM_LIBRARIES
 # LLVM_LIBDIRS

-find_program(LLVM_CONFIG_EXE
-    NAMES llvm-config-10 llvm-config-10.0 llvm-config100 llvm-config
+if(ZIG_CROSSCOMPILING)
+  # Here we assume that we're cross compiling with Zig, of course. No reason
+  # to support more complicated setups. We also assume the experimental target
+  # AVR is enabled.
+
+  find_path(LLVM_INCLUDE_DIRS NAMES llvm/IR/IRBuilder.h
     PATHS
-        "/mingw64/bin"
-        "/c/msys64/mingw64/bin"
-        "c:/msys64/mingw64/bin"
-        "C:/Libraries/llvm-10.0.0/bin")
-
-if ("${LLVM_CONFIG_EXE}" STREQUAL "LLVM_CONFIG_EXE-NOTFOUND")
-  message(FATAL_ERROR "unable to find llvm-config")
+        /usr/lib/llvm/10/include
+        /usr/lib/llvm-10/include
+        /usr/lib/llvm-10.0/include
+        /usr/local/llvm100/include
+        /mingw64/include)
+
+    macro(FIND_AND_ADD_LLVM_LIB _libname_)
+      string(TOUPPER ${_libname_} _prettylibname_)
+      find_library(LLVM_${_prettylibname_}_LIB NAMES ${_libname_}
+        PATHS
+        ${LLVM_LIBDIRS}
+        /usr/lib/llvm/10/lib
+        /usr/lib/llvm-10/lib
+        /usr/lib/llvm-10.0/lib
+        /usr/local/llvm100/lib
+        /mingw64/lib
+        /c/msys64/mingw64/lib
+        c:\\msys64\\mingw64\\lib)
+      if(LLVM_${_prettylibname_}_LIB)
+        set(LLVM_LIBRARIES ${LLVM_LIBRARIES} ${LLVM_${_prettylibname_}_LIB})
+      endif()
+    endmacro(FIND_AND_ADD_LLVM_LIB)
+
+    # This list can be re-generated with `llvm-config --libfiles` and then
+    # reformatting using your favorite text editor. Note we do not execute
+    # `llvm-config` here because we are cross compiling.
+    FIND_AND_ADD_LLVM_LIB(LLVMXRay)
+    FIND_AND_ADD_LLVM_LIB(LLVMWindowsManifest)
+    FIND_AND_ADD_LLVM_LIB(LLVMTableGen)
+    FIND_AND_ADD_LLVM_LIB(LLVMSymbolize)
+    FIND_AND_ADD_LLVM_LIB(LLVMDebugInfoPDB)
+    FIND_AND_ADD_LLVM_LIB(LLVMOrcJIT)
+    FIND_AND_ADD_LLVM_LIB(LLVMOrcError)
+    FIND_AND_ADD_LLVM_LIB(LLVMJITLink)
+    FIND_AND_ADD_LLVM_LIB(LLVMObjectYAML)
+    FIND_AND_ADD_LLVM_LIB(LLVMMCA)
+    FIND_AND_ADD_LLVM_LIB(LLVMLTO)
+    FIND_AND_ADD_LLVM_LIB(LLVMPasses)
+    FIND_AND_ADD_LLVM_LIB(LLVMObjCARCOpts)
+    FIND_AND_ADD_LLVM_LIB(LLVMLineEditor)
+    FIND_AND_ADD_LLVM_LIB(LLVMLibDriver)
+    FIND_AND_ADD_LLVM_LIB(LLVMInterpreter)
+    FIND_AND_ADD_LLVM_LIB(LLVMFuzzMutate)
+    FIND_AND_ADD_LLVM_LIB(LLVMFrontendOpenMP)
+    FIND_AND_ADD_LLVM_LIB(LLVMMCJIT)
+    FIND_AND_ADD_LLVM_LIB(LLVMExecutionEngine)
+    FIND_AND_ADD_LLVM_LIB(LLVMRuntimeDyld)
+    FIND_AND_ADD_LLVM_LIB(LLVMDWARFLinker)
+    FIND_AND_ADD_LLVM_LIB(LLVMDlltoolDriver)
+    FIND_AND_ADD_LLVM_LIB(LLVMOption)
+    FIND_AND_ADD_LLVM_LIB(LLVMDebugInfoGSYM)
+    FIND_AND_ADD_LLVM_LIB(LLVMCoverage)
+    FIND_AND_ADD_LLVM_LIB(LLVMCoroutines)
+    FIND_AND_ADD_LLVM_LIB(LLVMAVRDisassembler)
+    FIND_AND_ADD_LLVM_LIB(LLVMAVRCodeGen)
+    FIND_AND_ADD_LLVM_LIB(LLVMAVRAsmParser)
+    FIND_AND_ADD_LLVM_LIB(LLVMAVRDesc)
+    FIND_AND_ADD_LLVM_LIB(LLVMAVRInfo)
+    FIND_AND_ADD_LLVM_LIB(LLVMXCoreDisassembler)
+    FIND_AND_ADD_LLVM_LIB(LLVMXCoreCodeGen)
+    FIND_AND_ADD_LLVM_LIB(LLVMXCoreDesc)
+    FIND_AND_ADD_LLVM_LIB(LLVMXCoreInfo)
+    FIND_AND_ADD_LLVM_LIB(LLVMX86Disassembler)
+    FIND_AND_ADD_LLVM_LIB(LLVMX86AsmParser)
+    FIND_AND_ADD_LLVM_LIB(LLVMX86CodeGen)
+    FIND_AND_ADD_LLVM_LIB(LLVMX86Desc)
+    FIND_AND_ADD_LLVM_LIB(LLVMX86Utils)
+    FIND_AND_ADD_LLVM_LIB(LLVMX86Info)
+    FIND_AND_ADD_LLVM_LIB(LLVMWebAssemblyDisassembler)
+    FIND_AND_ADD_LLVM_LIB(LLVMWebAssemblyCodeGen)
+    FIND_AND_ADD_LLVM_LIB(LLVMWebAssemblyDesc)
+    FIND_AND_ADD_LLVM_LIB(LLVMWebAssemblyAsmParser)
+    FIND_AND_ADD_LLVM_LIB(LLVMWebAssemblyInfo)
+    FIND_AND_ADD_LLVM_LIB(LLVMSystemZDisassembler)
+    FIND_AND_ADD_LLVM_LIB(LLVMSystemZCodeGen)
+    FIND_AND_ADD_LLVM_LIB(LLVMSystemZAsmParser)
+    FIND_AND_ADD_LLVM_LIB(LLVMSystemZDesc)
+    FIND_AND_ADD_LLVM_LIB(LLVMSystemZInfo)
+    FIND_AND_ADD_LLVM_LIB(LLVMSparcDisassembler)
+    FIND_AND_ADD_LLVM_LIB(LLVMSparcCodeGen)
+    FIND_AND_ADD_LLVM_LIB(LLVMSparcAsmParser)
+    FIND_AND_ADD_LLVM_LIB(LLVMSparcDesc)
+    FIND_AND_ADD_LLVM_LIB(LLVMSparcInfo)
+    FIND_AND_ADD_LLVM_LIB(LLVMRISCVDisassembler)
+    FIND_AND_ADD_LLVM_LIB(LLVMRISCVCodeGen)
+    FIND_AND_ADD_LLVM_LIB(LLVMRISCVAsmParser)
+    FIND_AND_ADD_LLVM_LIB(LLVMRISCVDesc)
+    FIND_AND_ADD_LLVM_LIB(LLVMRISCVUtils)
+    FIND_AND_ADD_LLVM_LIB(LLVMRISCVInfo)
+    FIND_AND_ADD_LLVM_LIB(LLVMPowerPCDisassembler)
+    FIND_AND_ADD_LLVM_LIB(LLVMPowerPCCodeGen)
+    FIND_AND_ADD_LLVM_LIB(LLVMPowerPCAsmParser)
+    FIND_AND_ADD_LLVM_LIB(LLVMPowerPCDesc)
+    FIND_AND_ADD_LLVM_LIB(LLVMPowerPCInfo)
+    FIND_AND_ADD_LLVM_LIB(LLVMNVPTXCodeGen)
+    FIND_AND_ADD_LLVM_LIB(LLVMNVPTXDesc)
+    FIND_AND_ADD_LLVM_LIB(LLVMNVPTXInfo)
+    FIND_AND_ADD_LLVM_LIB(LLVMMSP430Disassembler)
+    FIND_AND_ADD_LLVM_LIB(LLVMMSP430CodeGen)
+    FIND_AND_ADD_LLVM_LIB(LLVMMSP430AsmParser)
+    FIND_AND_ADD_LLVM_LIB(LLVMMSP430Desc)
+    FIND_AND_ADD_LLVM_LIB(LLVMMSP430Info)
+    FIND_AND_ADD_LLVM_LIB(LLVMMipsDisassembler)
+    FIND_AND_ADD_LLVM_LIB(LLVMMipsCodeGen)
+    FIND_AND_ADD_LLVM_LIB(LLVMMipsAsmParser)
+    FIND_AND_ADD_LLVM_LIB(LLVMMipsDesc)
+    FIND_AND_ADD_LLVM_LIB(LLVMMipsInfo)
+    FIND_AND_ADD_LLVM_LIB(LLVMLanaiDisassembler)
+    FIND_AND_ADD_LLVM_LIB(LLVMLanaiCodeGen)
+    FIND_AND_ADD_LLVM_LIB(LLVMLanaiAsmParser)
+    FIND_AND_ADD_LLVM_LIB(LLVMLanaiDesc)
+    FIND_AND_ADD_LLVM_LIB(LLVMLanaiInfo)
+    FIND_AND_ADD_LLVM_LIB(LLVMHexagonDisassembler)
+    FIND_AND_ADD_LLVM_LIB(LLVMHexagonCodeGen)
+    FIND_AND_ADD_LLVM_LIB(LLVMHexagonAsmParser)
+    FIND_AND_ADD_LLVM_LIB(LLVMHexagonDesc)
+    FIND_AND_ADD_LLVM_LIB(LLVMHexagonInfo)
+    FIND_AND_ADD_LLVM_LIB(LLVMBPFDisassembler)
+    FIND_AND_ADD_LLVM_LIB(LLVMBPFCodeGen)
+    FIND_AND_ADD_LLVM_LIB(LLVMBPFAsmParser)
+    FIND_AND_ADD_LLVM_LIB(LLVMBPFDesc)
+    FIND_AND_ADD_LLVM_LIB(LLVMBPFInfo)
+    FIND_AND_ADD_LLVM_LIB(LLVMARMDisassembler)
+    FIND_AND_ADD_LLVM_LIB(LLVMARMCodeGen)
+    FIND_AND_ADD_LLVM_LIB(LLVMARMAsmParser)
+    FIND_AND_ADD_LLVM_LIB(LLVMARMDesc)
+    FIND_AND_ADD_LLVM_LIB(LLVMARMUtils)
+    FIND_AND_ADD_LLVM_LIB(LLVMARMInfo)
+    FIND_AND_ADD_LLVM_LIB(LLVMAMDGPUDisassembler)
+    FIND_AND_ADD_LLVM_LIB(LLVMAMDGPUCodeGen)
+    FIND_AND_ADD_LLVM_LIB(LLVMMIRParser)
+    FIND_AND_ADD_LLVM_LIB(LLVMipo)
+    FIND_AND_ADD_LLVM_LIB(LLVMInstrumentation)
+    FIND_AND_ADD_LLVM_LIB(LLVMVectorize)
+    FIND_AND_ADD_LLVM_LIB(LLVMLinker)
+    FIND_AND_ADD_LLVM_LIB(LLVMIRReader)
+    FIND_AND_ADD_LLVM_LIB(LLVMAsmParser)
+    FIND_AND_ADD_LLVM_LIB(LLVMAMDGPUAsmParser)
+    FIND_AND_ADD_LLVM_LIB(LLVMAMDGPUDesc)
+    FIND_AND_ADD_LLVM_LIB(LLVMAMDGPUUtils)
+    FIND_AND_ADD_LLVM_LIB(LLVMAMDGPUInfo)
+    FIND_AND_ADD_LLVM_LIB(LLVMAArch64Disassembler)
+    FIND_AND_ADD_LLVM_LIB(LLVMMCDisassembler)
+    FIND_AND_ADD_LLVM_LIB(LLVMAArch64CodeGen)
+    FIND_AND_ADD_LLVM_LIB(LLVMCFGuard)
+    FIND_AND_ADD_LLVM_LIB(LLVMGlobalISel)
+    FIND_AND_ADD_LLVM_LIB(LLVMSelectionDAG)
+    FIND_AND_ADD_LLVM_LIB(LLVMAsmPrinter)
+    FIND_AND_ADD_LLVM_LIB(LLVMDebugInfoDWARF)
+    FIND_AND_ADD_LLVM_LIB(LLVMCodeGen)
+    FIND_AND_ADD_LLVM_LIB(LLVMTarget)
+    FIND_AND_ADD_LLVM_LIB(LLVMScalarOpts)
+    FIND_AND_ADD_LLVM_LIB(LLVMInstCombine)
+    FIND_AND_ADD_LLVM_LIB(LLVMAggressiveInstCombine)
+    FIND_AND_ADD_LLVM_LIB(LLVMTransformUtils)
+    FIND_AND_ADD_LLVM_LIB(LLVMBitWriter)
+    FIND_AND_ADD_LLVM_LIB(LLVMAnalysis)
+    FIND_AND_ADD_LLVM_LIB(LLVMProfileData)
+    FIND_AND_ADD_LLVM_LIB(LLVMObject)
+    FIND_AND_ADD_LLVM_LIB(LLVMTextAPI)
+    FIND_AND_ADD_LLVM_LIB(LLVMBitReader)
+    FIND_AND_ADD_LLVM_LIB(LLVMCore)
+    FIND_AND_ADD_LLVM_LIB(LLVMRemarks)
+    FIND_AND_ADD_LLVM_LIB(LLVMBitstreamReader)
+    FIND_AND_ADD_LLVM_LIB(LLVMAArch64AsmParser)
+    FIND_AND_ADD_LLVM_LIB(LLVMMCParser)
+    FIND_AND_ADD_LLVM_LIB(LLVMAArch64Desc)
+    FIND_AND_ADD_LLVM_LIB(LLVMMC)
+    FIND_AND_ADD_LLVM_LIB(LLVMDebugInfoCodeView)
+    FIND_AND_ADD_LLVM_LIB(LLVMDebugInfoMSF)
+    FIND_AND_ADD_LLVM_LIB(LLVMBinaryFormat)
+    FIND_AND_ADD_LLVM_LIB(LLVMAArch64Utils)
+    FIND_AND_ADD_LLVM_LIB(LLVMAArch64Info)
+    FIND_AND_ADD_LLVM_LIB(LLVMSupport)
+    FIND_AND_ADD_LLVM_LIB(LLVMDemangle)
+else()
+  find_program(LLVM_CONFIG_EXE
+      NAMES llvm-config-10 llvm-config-10.0 llvm-config100 llvm-config
+      PATHS
+          "/mingw64/bin"
+          "/c/msys64/mingw64/bin"
+          "c:/msys64/mingw64/bin"
+          "C:/Libraries/llvm-10.0.0/bin")
+
+  if ("${LLVM_CONFIG_EXE}" STREQUAL "LLVM_CONFIG_EXE-NOTFOUND")
+    message(FATAL_ERROR "unable to find llvm-config")
+  endif()
+
+  if ("${LLVM_CONFIG_EXE}" STREQUAL "LLVM_CONFIG_EXE-NOTFOUND")
+    message(FATAL_ERROR "unable to find llvm-config")
+  endif()
+
+  execute_process(
+  	COMMAND ${LLVM_CONFIG_EXE} --version
+  	OUTPUT_VARIABLE LLVM_CONFIG_VERSION
+  	OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+  if("${LLVM_CONFIG_VERSION}" VERSION_LESS 10)
+    message(FATAL_ERROR "expected LLVM 10.x but found ${LLVM_CONFIG_VERSION}")
+  endif()
+  if("${LLVM_CONFIG_VERSION}" VERSION_EQUAL 11)
+    message(FATAL_ERROR "expected LLVM 10.x but found ${LLVM_CONFIG_VERSION}")
+  endif()
+  if("${LLVM_CONFIG_VERSION}" VERSION_GREATER 11)
+    message(FATAL_ERROR "expected LLVM 10.x but found ${LLVM_CONFIG_VERSION}")
+  endif()
+
+  execute_process(
+  	COMMAND ${LLVM_CONFIG_EXE} --targets-built
+      OUTPUT_VARIABLE LLVM_TARGETS_BUILT_SPACES
+  	OUTPUT_STRIP_TRAILING_WHITESPACE)
+  string(REPLACE " " ";" LLVM_TARGETS_BUILT "${LLVM_TARGETS_BUILT_SPACES}")
+  function(NEED_TARGET TARGET_NAME)
+      list (FIND LLVM_TARGETS_BUILT "${TARGET_NAME}" _index)
+      if (${_index} EQUAL -1)
+          message(FATAL_ERROR "LLVM is missing target ${TARGET_NAME}. Zig requires LLVM to be built with all default targets enabled.")
+      endif()
+  endfunction(NEED_TARGET)
+  NEED_TARGET("AArch64")
+  NEED_TARGET("AMDGPU")
+  NEED_TARGET("ARM")
+  NEED_TARGET("BPF")
+  NEED_TARGET("Hexagon")
+  NEED_TARGET("Lanai")
+  NEED_TARGET("Mips")
+  NEED_TARGET("MSP430")
+  NEED_TARGET("NVPTX")
+  NEED_TARGET("PowerPC")
+  NEED_TARGET("RISCV")
+  NEED_TARGET("Sparc")
+  NEED_TARGET("SystemZ")
+  NEED_TARGET("WebAssembly")
+  NEED_TARGET("X86")
+  NEED_TARGET("XCore")
+
+  if(ZIG_STATIC_LLVM)
+    execute_process(
+        COMMAND ${LLVM_CONFIG_EXE} --libfiles --link-static
+        OUTPUT_VARIABLE LLVM_LIBRARIES_SPACES
+        OUTPUT_STRIP_TRAILING_WHITESPACE)
+    string(REPLACE " " ";" LLVM_LIBRARIES "${LLVM_LIBRARIES_SPACES}")
+
+    execute_process(
+        COMMAND ${LLVM_CONFIG_EXE} --system-libs --link-static
+        OUTPUT_VARIABLE LLVM_SYSTEM_LIBS_SPACES
+        OUTPUT_STRIP_TRAILING_WHITESPACE)
+    string(REPLACE " " ";" LLVM_SYSTEM_LIBS "${LLVM_SYSTEM_LIBS_SPACES}")
+
+    execute_process(
+        COMMAND ${LLVM_CONFIG_EXE} --libdir --link-static
+        OUTPUT_VARIABLE LLVM_LIBDIRS_SPACES
+        OUTPUT_STRIP_TRAILING_WHITESPACE)
+    string(REPLACE " " ";" LLVM_LIBDIRS "${LLVM_LIBDIRS_SPACES}")
+  endif()
+  if(NOT LLVM_LIBRARIES)
+    execute_process(
+        COMMAND ${LLVM_CONFIG_EXE} --libs
+        OUTPUT_VARIABLE LLVM_LIBRARIES_SPACES
+        OUTPUT_STRIP_TRAILING_WHITESPACE)
+    string(REPLACE " " ";" LLVM_LIBRARIES "${LLVM_LIBRARIES_SPACES}")
+
+    execute_process(
+        COMMAND ${LLVM_CONFIG_EXE} --system-libs
+        OUTPUT_VARIABLE LLVM_SYSTEM_LIBS_SPACES
+        OUTPUT_STRIP_TRAILING_WHITESPACE)
+    string(REPLACE " " ";" LLVM_SYSTEM_LIBS "${LLVM_SYSTEM_LIBS_SPACES}")
+
+    execute_process(
+        COMMAND ${LLVM_CONFIG_EXE} --libdir
+        OUTPUT_VARIABLE LLVM_LIBDIRS_SPACES
+        OUTPUT_STRIP_TRAILING_WHITESPACE)
+    string(REPLACE " " ";" LLVM_LIBDIRS "${LLVM_LIBDIRS_SPACES}")
+  endif()
+
+  execute_process(
+      COMMAND ${LLVM_CONFIG_EXE} --includedir
+      OUTPUT_VARIABLE LLVM_INCLUDE_DIRS
+      OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+  set(LLVM_LIBRARIES ${LLVM_LIBRARIES} ${LLVM_SYSTEM_LIBS})
+
+  if(NOT LLVM_LIBRARIES)
+    find_library(LLVM_LIBRARIES NAMES LLVM LLVM-10 LLVM-10.0)
+  endif()
+
+  link_directories("${CMAKE_PREFIX_PATH}/lib")
+  link_directories("${LLVM_LIBDIRS}")
 endif()
-
-if ("${LLVM_CONFIG_EXE}" STREQUAL "LLVM_CONFIG_EXE-NOTFOUND")
-  message(FATAL_ERROR "unable to find llvm-config")
-endif()
-
-execute_process(
-	COMMAND ${LLVM_CONFIG_EXE} --version
-	OUTPUT_VARIABLE LLVM_CONFIG_VERSION
-	OUTPUT_STRIP_TRAILING_WHITESPACE)
-
-if("${LLVM_CONFIG_VERSION}" VERSION_LESS 10)
-  message(FATAL_ERROR "expected LLVM 10.x but found ${LLVM_CONFIG_VERSION}")
-endif()
-if("${LLVM_CONFIG_VERSION}" VERSION_EQUAL 11)
-  message(FATAL_ERROR "expected LLVM 10.x but found ${LLVM_CONFIG_VERSION}")
-endif()
-if("${LLVM_CONFIG_VERSION}" VERSION_GREATER 11)
-  message(FATAL_ERROR "expected LLVM 10.x but found ${LLVM_CONFIG_VERSION}")
-endif()
-
-execute_process(
-	COMMAND ${LLVM_CONFIG_EXE} --targets-built
-    OUTPUT_VARIABLE LLVM_TARGETS_BUILT_SPACES
-	OUTPUT_STRIP_TRAILING_WHITESPACE)
-string(REPLACE " " ";" LLVM_TARGETS_BUILT "${LLVM_TARGETS_BUILT_SPACES}")
-function(NEED_TARGET TARGET_NAME)
-    list (FIND LLVM_TARGETS_BUILT "${TARGET_NAME}" _index)
-    if (${_index} EQUAL -1)
-        message(FATAL_ERROR "LLVM is missing target ${TARGET_NAME}. Zig requires LLVM to be built with all default targets enabled.")
-    endif()
-endfunction(NEED_TARGET)
-NEED_TARGET("AArch64")
-NEED_TARGET("AMDGPU")
-NEED_TARGET("ARM")
-NEED_TARGET("BPF")
-NEED_TARGET("Hexagon")
-NEED_TARGET("Lanai")
-NEED_TARGET("Mips")
-NEED_TARGET("MSP430")
-NEED_TARGET("NVPTX")
-NEED_TARGET("PowerPC")
-NEED_TARGET("RISCV")
-NEED_TARGET("Sparc")
-NEED_TARGET("SystemZ")
-NEED_TARGET("WebAssembly")
-NEED_TARGET("X86")
-NEED_TARGET("XCore")
-
-if(ZIG_STATIC_LLVM)
-  execute_process(
-      COMMAND ${LLVM_CONFIG_EXE} --libfiles --link-static
-      OUTPUT_VARIABLE LLVM_LIBRARIES_SPACES
-      OUTPUT_STRIP_TRAILING_WHITESPACE)
-  string(REPLACE " " ";" LLVM_LIBRARIES "${LLVM_LIBRARIES_SPACES}")
-
-  execute_process(
-      COMMAND ${LLVM_CONFIG_EXE} --system-libs --link-static
-      OUTPUT_VARIABLE LLVM_SYSTEM_LIBS_SPACES
-      OUTPUT_STRIP_TRAILING_WHITESPACE)
-  string(REPLACE " " ";" LLVM_SYSTEM_LIBS "${LLVM_SYSTEM_LIBS_SPACES}")
-
-  execute_process(
-      COMMAND ${LLVM_CONFIG_EXE} --libdir --link-static
-      OUTPUT_VARIABLE LLVM_LIBDIRS_SPACES
-      OUTPUT_STRIP_TRAILING_WHITESPACE)
-  string(REPLACE " " ";" LLVM_LIBDIRS "${LLVM_LIBDIRS_SPACES}")
-endif()
-if(NOT LLVM_LIBRARIES)
-  execute_process(
-      COMMAND ${LLVM_CONFIG_EXE} --libs
-      OUTPUT_VARIABLE LLVM_LIBRARIES_SPACES
-      OUTPUT_STRIP_TRAILING_WHITESPACE)
-  string(REPLACE " " ";" LLVM_LIBRARIES "${LLVM_LIBRARIES_SPACES}")
-
-  execute_process(
-      COMMAND ${LLVM_CONFIG_EXE} --system-libs
-      OUTPUT_VARIABLE LLVM_SYSTEM_LIBS_SPACES
-      OUTPUT_STRIP_TRAILING_WHITESPACE)
-  string(REPLACE " " ";" LLVM_SYSTEM_LIBS "${LLVM_SYSTEM_LIBS_SPACES}")
-
-  execute_process(
-      COMMAND ${LLVM_CONFIG_EXE} --libdir
-      OUTPUT_VARIABLE LLVM_LIBDIRS_SPACES
-      OUTPUT_STRIP_TRAILING_WHITESPACE)
-  string(REPLACE " " ";" LLVM_LIBDIRS "${LLVM_LIBDIRS_SPACES}")
-endif()
-
-execute_process(
-    COMMAND ${LLVM_CONFIG_EXE} --includedir
-    OUTPUT_VARIABLE LLVM_INCLUDE_DIRS
-    OUTPUT_STRIP_TRAILING_WHITESPACE)
-
-set(LLVM_LIBRARIES ${LLVM_LIBRARIES} ${LLVM_SYSTEM_LIBS})
-
-if(NOT LLVM_LIBRARIES)
-  find_library(LLVM_LIBRARIES NAMES LLVM LLVM-10 LLVM-10.0)
-endif()
-
-link_directories("${CMAKE_PREFIX_PATH}/lib")
-link_directories("${LLVM_LIBDIRS}")

 include(FindPackageHandleStandardArgs)
 find_package_handle_standard_args(LLVM DEFAULT_MSG LLVM_LIBRARIES LLVM_INCLUDE_DIRS)


also detect Open64 and Clang if CMAKE_CXX_COMPILER is not a path

--- cmake/VcMacros.cmake
+++ cmake/VcMacros.cmake
@@ -31,10 +31,10 @@
          set(Vc_COMPILER_IS_INTEL true)
          exec_program(${CMAKE_C_COMPILER} ARGS -dumpversion OUTPUT_VARIABLE Vc_ICC_VERSION)
          message(STATUS "Detected Compiler: Intel ${Vc_ICC_VERSION}")
-      elseif(CMAKE_CXX_COMPILER MATCHES "/(opencc|openCC)$")
+      elseif(CMAKE_CXX_COMPILER MATCHES "(opencc|openCC)$")
          set(Vc_COMPILER_IS_OPEN64 true)
          message(STATUS "Detected Compiler: Open64")
-      elseif(CMAKE_CXX_COMPILER MATCHES "/clang\\+\\+$")
+      elseif(CMAKE_CXX_COMPILER MATCHES "clang\\+\\+$")
          set(Vc_COMPILER_IS_CLANG true)
          message(STATUS "Detected Compiler: Clang")
       elseif(MSVC)


Add support for stlport ufid flag. (#19)

--- cmake/bde_ufid.cmake
+++ cmake/bde_ufid.cmake
@@ -19,7 +19,7 @@
 set(install_ufid_flags opt dbg exc mt safe safe2 pic shr)

 # These flags can appear in a valid ufid. The order of those flags is important.
-set(known_ufid_flags opt dbg exc mt 64 safe safe2 pic shr ndebug cpp11 cpp14 cpp17)
+set(known_ufid_flags opt dbg exc mt 64 safe safe2 stlport pic shr ndebug cpp11 cpp14 cpp17)

 #.rst:
 # bde_ufid_filter_flags
@@ -267,6 +267,8 @@
             $<${bde_ufid_is_cpp11}:BDE_BUILD_TARGET_CPP11>
             $<${bde_ufid_is_cpp14}:BDE_BUILD_TARGET_CPP14>
             $<${bde_ufid_is_cpp17}:BDE_BUILD_TARGET_CPP17>
+
+            $<${bde_ufid_is_stlport}:BDE_BUILD_TARGET_STLPORT>

             $<${bde_ufid_is_ndebug}:
                 NDEBUG
@@ -384,6 +386,10 @@
                     -features=except,
                     -features=no%except
                 >
+                $<${bde_ufid_is_stlport}:
+                    -library=stlport4
+                    -template=no%extdef
+                >
             >
             $<$<CXX_COMPILER_ID:XL>:
                 -qalias=noansi
@@ -435,6 +441,8 @@
             $<${bde_ufid_is_cpp14}:BDE_BUILD_TARGET_CPP14>
             $<${bde_ufid_is_cpp17}:BDE_BUILD_TARGET_CPP17>

+            $<${bde_ufid_is_stlport}:BDE_BUILD_TARGET_STLPORT>
+
             $<${bde_ufid_is_ndebug}:
                 NDEBUG
                 BDE_BUILD_TARGET_NDEBUG
@@ -539,6 +547,7 @@
                    m
                    sunmath
                 >
+                $<${bde_ufid_is_stlport}:-library=stlport4>
             >
             $<$<CXX_COMPILER_ID:XL>:
                 Threads::Threads


fixup regex-matching

fixup regex-matching

--- cmake/checkgdb.cmake
+++ cmake/checkgdb.cmake
@@ -7,7 +7,7 @@
 	#		--args ${EXECUTABLE} ${FILE} ${ARGS}
 	#			RESULT_VARIABLE GDB_RESULT)
 	#endif()
-	if ("${OUTPUT}" MATCHES ".*THE FOLLOWING TESTS FAILED.*")
+	if ("${OUTPUT}" MATCHES "THE FOLLOWING TESTS FAILED.*")
 		MESSAGE( FATAL_ERROR "FAIL:  ${ARGS}, EXITCODE:  ${RESULT}" )
 	endif ("${OUTPUT}" MATCHES ".*THE FOLLOWING TESTS FAILED.*")
 endif (RESULT)


erthink-cmake: adds guard from the CMake spoiled inside MSVC bundle.

--- cmake/compiler.cmake
+++ cmake/compiler.cmake
@@ -16,6 +16,11 @@
 cmake_minimum_required(VERSION 3.8.2)
 cmake_policy(PUSH)
 cmake_policy(VERSION 3.8.2)
+
+if (CMAKE_VERSION MATCHES ".*MSVC.*")
+  message(FATAL_ERROR "CMake from MSVC kit is unfit! "
+    "Please use the original CMake from https://cmake.org/download/")
+endif()

 if (NOT (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED))
   message(FATAL_ERROR "This module required C or C++ to be enabled")


Also should not be comitted

Also should not be comitted

--- cmake/compiler.cmake
+++ cmake/compiler.cmake
@@ -1,7 +1,7 @@

 if(UNIX)
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
+#  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
 else()
   add_definitions(-D_WIN32_WINNT=0x601)
   add_definitions(-D_CRT_SECURE_NO_WARNINGS)


fix standard choice

fix standard choice

git-svn-id: 6b1c4fe79111c0bc0cce83313250759594f8984b@8563 e128ff1e-fa79-4151-a8cb-522299a2c450

--- cmake/gsConfig.cmake
+++ cmake/gsConfig.cmake
@@ -85,11 +85,11 @@
   endif()
   unset(GISMO_BUILD_CPP11 CACHE)
 endif()
-set(CMAKE_CXX_STANDARD_DEFAULT 98)
+set(CMAKE_CXX_STANDARD_DEFAULT 11)
 if (NOT DEFINED CMAKE_CXX_STANDARD)
-    set(CMAKE_CXX_STANDARD 98 CACHE INTERNAL "")
-endif()
-set(CMAKE_CXX_STANDARD_REQUIRED ON)
+    set(CMAKE_CXX_STANDARD 11 CACHE INTERNAL "")
+endif()
+#set(CMAKE_CXX_STANDARD_REQUIRED ON)
 set(CMAKE_CXX_EXTENSIONS OFF)

 if (CMAKE_VERSION VERSION_LESS "3.1" AND CMAKE_COMPILER_IS_GNUCC)
@@ -104,7 +104,7 @@
         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
       endif()
     else()
-      message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++14 support.")
+      message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++14 support, use CMAKE_CXX_STANDARD=11 or 98.")
     endif()
   endif()

@@ -125,7 +125,7 @@
             set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
           endif()
         else()
-          message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support.")
+          message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support, use CMAKE_CXX_STANDARD=98.")
         endif()
      endif()
    endif()


cplex-shared.cmake: - Force cplex to be relocated, even if it was found previously. - Ensure we always use the STATIC library as input, even if a .so already exists.

--- cplex-shared.cmake
+++ cplex-shared.cmake
@@ -15,6 +15,12 @@
 # g++ -fpic -shared -Wl,-all_load libconcert.a -Wl,-noall_load -o libconcert.dylib
 # g++ -fpic -shared -Wl,-all_load libilocplex.a -Wl,-noall_load -L. -L../../../../concert/lib/x86-64_osx/static_pic -lcplex -lconcert -o libilocplex.dylib

+
+# Clear previously found location so we force it to be found again.
+set(CPLEX_LIBRARY CPLEX_LIBRARY-NOTFOUND)
+set(CPLEX_CONCERT_LIBRARY CPLEX_CONCERT_LIBRARY-NOTFOUND)
+set(CPLEX_ILOCPLEX_LIBRARY CPLEX_ILOCPLEX_LIBRARY-NOTFOUND)
+
 # Find the CPLEX static libraries (must already be installed somewhere)
 find_package( Cplex REQUIRED )

@@ -31,8 +37,8 @@
 ##
 ## -- Create a shared library from libcplex.a
 ##
-set( CPLEX_LIBRARY_STATIC ${CPLEX_LIBRARY} )
-get_filename_component(CPLEX_LIB_DIR "${CPLEX_LIBRARY_STATIC}" PATH)
+get_filename_component( CPLEX_LIBRARY_DIR ${CPLEX_LIBRARY} PATH )
+set( CPLEX_LIBRARY_STATIC ${CPLEX_LIBRARY_DIR}/libcplex.a )

 # Create an empty cpp file to use as a stand-in for cpp sources in the library
 set (EMPTY_CPP ${CMAKE_CURRENT_BINARY_DIR}/empty.cpp)
@@ -43,7 +49,7 @@
 set_target_properties( cplex-shared PROPERTIES
                        COMPILE_FLAGS ${SHARED_CPLEX_COMPILE_FLAGS}
                        OUTPUT_NAME cplex
-                       LIBRARY_OUTPUT_DIRECTORY ${CPLEX_LIB_DIR} )
+                       LIBRARY_OUTPUT_DIRECTORY ${CPLEX_LIBRARY_DIR} )

 get_property(CPLEX_LIB_LOCATION TARGET cplex-shared PROPERTY LOCATION)

@@ -51,23 +57,23 @@
 ##
 ## -- Create a shared library from libconcert.a
 ##
-set( CONCERT_LIBRARY_STATIC ${CPLEX_CONCERT_LIBRARY} )
-get_filename_component(CONCERT_LIB_DIR "${CONCERT_LIBRARY_STATIC}" PATH)
+get_filename_component( CONCERT_LIBRARY_DIR ${CPLEX_CONCERT_LIBRARY} PATH )
+set( CONCERT_LIBRARY_STATIC ${CONCERT_LIBRARY_DIR}/libconcert.a )

 add_library( concert-shared SHARED ${EMPTY_CPP} )
 target_link_libraries( concert-shared ${SHARED_CPLEX_LINK_FLAGS_1} ${CONCERT_LIBRARY_STATIC} ${SHARED_CPLEX_LINK_FLAGS_2} )
 set_target_properties( concert-shared PROPERTIES
                        COMPILE_FLAGS ${SHARED_CPLEX_COMPILE_FLAGS}
                        OUTPUT_NAME concert
-                       LIBRARY_OUTPUT_DIRECTORY ${CONCERT_LIB_DIR} )
+                       LIBRARY_OUTPUT_DIRECTORY ${CONCERT_LIBRARY_DIR} )

 get_property(CONCERT_LIB_LOCATION TARGET concert-shared PROPERTY LOCATION)

 ##
 ## -- Create a shared library from libilocplex.a, which depends on the above two libraries.
 ##
-set( ILOCPLEX_LIBRARY_STATIC ${CPLEX_ILOCPLEX_LIBRARY} )
-get_filename_component(ILOCPLEX_LIB_DIR "${ILOCPLEX_LIBRARY_STATIC}" PATH)
+get_filename_component( ILOCPLEX_LIBRARY_DIR ${CPLEX_ILOCPLEX_LIBRARY} PATH )
+set( ILOCPLEX_LIBRARY_STATIC ${ILOCPLEX_LIBRARY_DIR}/libilocplex.a )

 add_library( ilocplex-shared SHARED ${EMPTY_CPP} )
 add_dependencies( ilocplex-shared cplex-shared concert-shared )
@@ -75,4 +81,4 @@
 set_target_properties( ilocplex-shared PROPERTIES
                        COMPILE_FLAGS ${SHARED_CPLEX_COMPILE_FLAGS}
                        OUTPUT_NAME ilocplex
-                       LIBRARY_OUTPUT_DIRECTORY ${ILOCPLEX_LIB_DIR} )
+                       LIBRARY_OUTPUT_DIRECTORY ${ILOCPLEX_LIBRARY_DIR} )


Bug 880: automatically preserves buildtool flags when modifying DartConfiguration.tcl file.

--- cmake/EigenConfigureTesting.cmake
+++ cmake/EigenConfigureTesting.cmake
@@ -23,7 +23,12 @@
 # Recall that our unit tests are not in the "all" target, so we have to explicitely ask ctest to build our custom 'buildtests' target.
 # At this stage, we can also add custom flags to the build tool through the user defined EIGEN_TEST_BUILD_FLAGS variable.
 file(READ  "${CMAKE_CURRENT_BINARY_DIR}/DartConfiguration.tcl" EIGEN_DART_CONFIG_FILE)
-string(REGEX REPLACE "MakeCommand:.*DefaultCTestConfigurationType" "MakeCommand: ${CMAKE_COMMAND} --build . --target buildtests --config '' -- -i ${EIGEN_TEST_BUILD_FLAGS}\nDefaultCTestConfigurationType"
+# try to grab the default flags
+string(REGEX MATCH "MakeCommand:.*-- (.*)DefaultCTestConfigurationType" EIGEN_DUMMY ${EIGEN_DART_CONFIG_FILE})
+if(NOT CMAKE_MATCH_1)
+string(REGEX MATCH "MakeCommand:.*gmake (.*)DefaultCTestConfigurationType" EIGEN_DUMMY ${EIGEN_DART_CONFIG_FILE})
+endif()
+string(REGEX REPLACE "MakeCommand:.*DefaultCTestConfigurationType" "MakeCommand: ${CMAKE_COMMAND} --build . --target buildtests --config \"\${CTEST_CONFIGURATION_TYPE}\" -- ${CMAKE_MATCH_1} ${EIGEN_TEST_BUILD_FLAGS}\nDefaultCTestConfigurationType"
        EIGEN_DART_CONFIG_FILE2 ${EIGEN_DART_CONFIG_FILE})
 file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/DartConfiguration.tcl" ${EIGEN_DART_CONFIG_FILE2})


[CMake] Include sancov tool in Fuchsia toolchain

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

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@309724 91177308-0d34-0410-b5e6-96231b3b80d8

--- cmake/caches/Fuchsia-stage2.cmake
+++ cmake/caches/Fuchsia-stage2.cmake
@@ -68,6 +68,7 @@
   llvm-size
   llvm-symbolizer
   opt
+  sancov
   CACHE STRING "")

 set(LLVM_DISTRIBUTION_COMPONENTS


CMake: GCC: -Wsuggest-attribute=noreturn is not a error

WTH gcc, why so many dumb false-positives?

--- cmake/compiler-warnings-gcc.cmake
+++ cmake/compiler-warnings-gcc.cmake
@@ -30,7 +30,7 @@

 # cleanup this once we no longer need to support gcc-4.9
 # disabled for now, see https://github.com/darktable-org/rawspeed/issues/32
-if(CMAKE_CXX_COMPILER_ID AND NOT (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0))
+if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
   list(APPEND GCC_WARNING_FLAGS "shadow")
 endif()

@@ -49,6 +49,7 @@
   "suggest-final-methods"
   "suggest-final-types"
   "suggest-override"
+  "suggest-attribute=noreturn"
 )

 foreach(warning ${GCC_WARNING_FLAGS})


cmake: use CMAKE_CXX_COMPILER_VERSION to detect GCC version

Fixes: ROOT-9908

--- cmake/modules/CheckCompiler.cmake
+++ cmake/modules/CheckCompiler.cmake
@@ -60,10 +60,9 @@

 #---Obtain the major and minor version of the GNU compiler-------------------------------------------
 if (CMAKE_COMPILER_IS_GNUCXX)
-  exec_program(${CMAKE_C_COMPILER} ARGS "-dumpversion" OUTPUT_VARIABLE _gcc_version_info)
-  string(REGEX REPLACE "^([0-9]+).*$"                   "\\1" GCC_MAJOR ${_gcc_version_info})
-  string(REGEX REPLACE "^[0-9]+\\.([0-9]+).*$"          "\\1" GCC_MINOR ${_gcc_version_info})
-  string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" GCC_PATCH ${_gcc_version_info})
+  string(REGEX REPLACE "^([0-9]+).*$"                   "\\1" GCC_MAJOR ${CMAKE_CXX_COMPILER_VERSION})
+  string(REGEX REPLACE "^[0-9]+\\.([0-9]+).*$"          "\\1" GCC_MINOR ${CMAKE_CXX_COMPILER_VERSION})
+  string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" GCC_PATCH ${CMAKE_CXX_COMPILER_VERSION})

   if(GCC_PATCH MATCHES "\\.+")
     set(GCC_PATCH "")


Fix for ROOT-6459

Fix for ROOT-6459

--- cmake/modules/RootNewMacros.cmake
+++ cmake/modules/RootNewMacros.cmake
@@ -125,7 +125,7 @@
     endif()
     if(files)
       foreach(s ${files})
-        if(fp MATCHES "[*]" AND s MATCHES "(^|/)G__") # Eliminate G__* files only when using wildcards
+        if(s MATCHES "${cwd}/G__") # Eliminate G__* files only when using wildcards
         else()
           set(sources ${sources} ${s})
         endif()


add -cpp option to fortran intel compiler

--- cmake/modules/intel_fortran.cmake
+++ cmake/modules/intel_fortran.cmake
@@ -1,5 +1,5 @@
 set(CMAKE_Fortran_FLAGS_DEBUG
-    "${CMAKE_Fortran_FLAGS_DEBUG} -D__EZCU_DEBUG -g -O0 -debug all")
+    "${CMAKE_Fortran_FLAGS_DEBUG} -cpp -D__EZCU_DEBUG -g -O0 -debug all")
 set(CMAKE_Fortran_FLAGS_DEBUG
     "${CMAKE_Fortran_FLAGS_DEBUG} -check uninit -fp-stack-check -fp-model strict")
 set(CMAKE_Fortran_FLAGS_RELEASE


CMake +IDEs: allow .h to show up in projects

--- cmakemodules/DeclareMRPTLib.cmake
+++ cmakemodules/DeclareMRPTLib.cmake
@@ -106,19 +106,19 @@
 		"${CMAKE_SOURCE_DIR}/libs/${name}/src/*.cpp"
 		"${CMAKE_SOURCE_DIR}/libs/${name}/src/*.c"
 		"${CMAKE_SOURCE_DIR}/libs/${name}/src/*.cxx"
-#		"${CMAKE_SOURCE_DIR}/libs/${name}/src/*.h"
-#		"${CMAKE_SOURCE_DIR}/libs/${name}/include/mrpt/${name}/*.h"
-#		"${CMAKE_SOURCE_DIR}/libs/${name}/include/mrpt/${name}/*.hpp"
-#		"${CMAKE_SOURCE_DIR}/doc/doxygen-pages/lib_mrpt_${name}.h"
+		"${CMAKE_SOURCE_DIR}/libs/${name}/src/*.h"
+		"${CMAKE_SOURCE_DIR}/libs/${name}/include/mrpt/${name}/*.h"
+		"${CMAKE_SOURCE_DIR}/libs/${name}/include/mrpt/${name}/*.hpp"
+		"${CMAKE_SOURCE_DIR}/doc/doxygen-pages/lib_mrpt_${name}.h"
 		)
 	list(APPEND ${name}_EXTRA_SRCS_NAME
 		"${name}"
 		"${name}"
 		"${name}"
-#		"${name} Internal Headers"
-#		"${name} Public Headers"
-#		"${name} Public Headers"
-#		"Documentation"
+		"${name} Internal Headers"
+		"${name} Public Headers"
+		"${name} Public Headers"
+		"${name} docs Headers"
 		)
 	# Only add these ones for "normal" libraries:
 	if (NOT ${headers_only})
@@ -190,10 +190,12 @@
 	if (NOT ${headers_only})
 		# A libray target:
 		add_library(${name}
-			${all_${name}_srcs}      # sources
 			${MRPT_VERSION_RC_FILE}  # Only !="" in Win32: the .rc file with version info
 			)

+		# Add sources as and headers as PRIVATE sources:
+		target_sources(${name} PRIVATE ${all_${name}_srcs})
+
 		# private include dirs for this lib:
 		target_include_directories(${name} PRIVATE
 				$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/libs/${name}/src/> # To include ${name}-precomp.h
@@ -214,8 +216,12 @@
 	else()
 		# A hdr-only library: needs no real compiling
 		add_library(${name} INTERFACE)
+
+		REMOVE_MATCHING_FILES_FROM_LIST(".*.h" all_${name}_srcs)
+
 		# List of hdr files (for editing in IDEs,etc.):
 		target_sources(${name} INTERFACE ${all_${name}_srcs})
+
 		set(iftype INTERFACE)
 	endif ()


Instruct CMake not to issue compatibility warnings up to version 3.13 (#276)

--- cmake/VcMacros.cmake
+++ cmake/VcMacros.cmake
@@ -32,7 +32,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #=============================================================================

-cmake_minimum_required(VERSION 2.8.3)
+cmake_minimum_required(VERSION 2.8.3...3.13)

 get_filename_component(_currentDir "${CMAKE_CURRENT_LIST_FILE}" PATH)
 include ("${_currentDir}/UserWarning.cmake")


add check for invoking -ftrack-macro-expansion=0

git-svn-id: 6b1c4fe79111c0bc0cce83313250759594f8984b@5717 e128ff1e-fa79-4151-a8cb-522299a2c450

--- cmake/gsConfig.cmake
+++ cmake/gsConfig.cmake
@@ -164,7 +164,7 @@
 elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
   # Update if necessary
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long") # -Woverloaded-virtual -Wconversion -Wextra -pedantic
-  if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.7)
+  if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftrack-macro-expansion=0")
   endif()
 endif()


ftn tests require parmetis... again

ftn tests require parmetis... again

--- test/testing.cmake
+++ test/testing.cmake
@@ -262,7 +262,7 @@

 endif()

-if(ENGPAR_FORTRAN_INTERFACE)
+if (ENGPAR_FORTRAN_INTERFACE AND ENABLE_PARMETIS)
   mpi_test(ftnTest 2 ./ftnTest)
   mpi_test(splitAndBalanceFtn 4 ./splitAndBalanceFtn
     ${GRAPHS}/cube/cube ${GRAPHS}/cube/cube_4p)


CMake: disable some warnings that have been introduced in LLVM 11.

--- cmake/common.cmake
+++ cmake/common.cmake
@@ -125,6 +125,7 @@
   if(CLANG_TIDY_AVAILABLE)
     if(NOT "${_TARGET}" STREQUAL "cellml")
         set(_NO_BUGPRONE_EXCEPTION_ESCAPE -bugprone-exception-escape)
+        set(_NO_CPPCOREGUIDELINES_AVOID_NON_CONST_GLOBAL_VARIABLES -cppcoreguidelines-avoid-non-const-global-variables)
         set(_NO_CPPCOREGUIDELINES_PRO_TYPE_VARARG -cppcoreguidelines-pro-type-vararg)
         set(_NO_HICPP_VARARG -hicpp-vararg)
     endif()
@@ -143,6 +144,7 @@
       -cppcoreguidelines-init-variables
       -cppcoreguidelines-owning-memory
       -cppcoreguidelines-pro-type-reinterpret-cast
+      ${_NO_CPPCOREGUIDELINES_AVOID_NON_CONST_GLOBAL_VARIABLES}
       ${_NO_CPPCOREGUIDELINES_PRO_TYPE_VARARG}
       -cppcoreguidelines-slicing
       -cppcoreguidelines-special-member-functions
@@ -164,6 +166,7 @@
       -llvm-header-guard
       misc-*
       -misc-non-private-member-variables-in-classes
+      -misc-no-recursion
       modernize-*
       -modernize-make-shared
       -modernize-pass-by-value


cmake: require python 3.6 or later

cmake: require python 3.6 or later

Zephyr currently requires Python 3.4 or later. The core Python team
declared version 3.4 hit End of Life (EOL) in March, so there's no
reason to continue to support it if that's causing a burden, which it
is.

This commit allows Zephyr's Python scripts to depend on features
present in version 3.6 or later.

This does skip support for a currently active version of Python:

- Python 3.5 is actively supported by the core Python devs until 09/2020
- Zephyr's 2.2 release, the first which could include this change, is
  tentatively scheduled for 02/2020.

However, almost all supported platforms are either unaffected, or
their users can upgrade easily:

- Windows users who need to can upgrade Python with:
  choco upgrade python

- macOS users who need to can upgrade Python with:
  brew upgrade python3

- Red Hat Enterprise Linux users who need to upgrade can use
  Software Collections (SCLs), e.g. as described here:
  https://developers.redhat.com/blog/2018/08/13/install-python3-rhel/

- CentOS Linux users also have access to SCLs, as described here:
  https://wiki.centos.org/AdditionalResources/Repositories/SCL

- Ubuntu's current long-term support (LTS) release (Bionic Beaver,
  version 18.04) ships with Python 3.6. It and all later versions of
  Ubuntu won't be affected by this change.

- Debian's current stable release (Buster, version 10) ships Python 3.7
  and likewise won't be affected.

The impact of this change is therefore biggest for older versions of
Linux. In particular, these are impacted:

- Older Ubuntu LTS releases.

  - Ubuntu 16.04 ships Python 3.5; it is still supported by Canonical.
  - Ubuntu 14.04 ships Python 3.4, which is EOL. This Ubuntu version
    is also no longer getting standard support from Canonical. Paying
    customers are receiving security updates only.

  https://wiki.ubuntu.com/Releases

- Older Debian versions.

  - Debian 9 (stretch) ships Python 3.5 and is still a supported
    Debian version.
  - Debian 8 (jessie) ships Python 3.4, which is EOL. This Debian
    version is no longer receiving mainline maintenance by the Debian
    project. LTS updates are provided by interested community
    volunteers only.

  https://wiki.debian.org/LTS

Affected Linux users will no longer have a system Python 3 which works
"out of the box" with Zephyr after this change. Some ideas for these
users are:

- Use Zephyr v2.1 or v1.14 LTS, which are maintained and still
  support Python 3.4
- Compile Python 3.6 or later from source and use it within a venv:
  https://docs.python.org/3/library/venv.html
- Use something like https://github.com/pyenv/pyenv

Python 3.6 has compelling new features which make writing Zephyr's
scripts easier, and which it would be good to be able to rely upon.
This motivates moving from Python 3.4 to 3.6 instead of 3.5.

My personal killer 3.6 features motivating skipping 3.5 (YMMV):

- Windows console and file system encodings are UTF-8 (PEPs 528 and
  529): Zephyr's scripts, and many utilities related to git, broadly
  assume strings are UTF-8, so this is very helpful
- os.PathLike and the file system path protocol (PEP 519) allow
  intermixing "smart" paths in pathlib with existing os.path based
  code
- f-strings (PEP 0498) are a wonderful and efficient string
  interpolation mechanism
- CPython dictionaries are insertion ordered as an implementation
  detail starting with 3.6, which in practice helps with
  reproducibility (and *all* Python implementations have insertion
  ordered dicts starting with 3.7)

Signed-off-by: Martí Bolívar <9d90ac4c7bf6a305f6bfd81a23c7859bc883380e@nordicsemi.no>

--- cmake/python.cmake
+++ cmake/python.cmake
@@ -13,10 +13,10 @@
 # that we need to work around until we upgrade to 3.13. Until then we
 # maintain a patched copy in our repo. Bug:
 # https://github.com/zephyrproject-rtos/zephyr/issues/11103
-set(PythonInterp_FIND_VERSION 3.4)
+set(PythonInterp_FIND_VERSION 3.6)
 set(PythonInterp_FIND_VERSION_COUNT 2)
 set(PythonInterp_FIND_VERSION_MAJOR 3)
-set(PythonInterp_FIND_VERSION_MINOR 4)
+set(PythonInterp_FIND_VERSION_MINOR 6)
 set(PythonInterp_FIND_VERSION_EXACT 0)
 set(PythonInterp_FIND_REQUIRED 1)
 include(${ZEPHYR_BASE}/cmake/backports/FindPythonInterp.cmake)


Not quite at 1.0, set to 0.1.0 for now

Not quite at 1.0, set to 0.1.0 for now

--- projects/matviz.bundle.common.cmake
+++ projects/matviz.bundle.common.cmake
@@ -1,7 +1,7 @@
 # We hardcode the version numbers since we cannot determine versions during
 # configure stage.
-set (matviz_version_major 1)
-set (matviz_version_minor 0)
+set (matviz_version_major 0)
+set (matviz_version_minor 1)
 set (matviz_version_patch 0)
 set (matviz_version_suffix)
 set (matviz_version "${matviz_version_major}.${matviz_version_minor}.${matviz_version_patch}")


added new tests

added new tests

--- test/cpymadtest/CTestTestfile.cmake
+++ test/cpymadtest/CTestTestfile.cmake
@@ -9,3 +9,6 @@
    add_test(test_${PYTEST} ${PYTHON} test_${PYTEST}.py)
    set_tests_properties(test_${PYTEST} PROPERTIES LABELS SLOW FAIL_REGULAR_EXPRESSION "FAILED")
 endforeach()
+
+add_test(test_madx ${PYTHON} test_madx.py)
+add_test(test_resource ${PYTHON} test_resource.py)


Suppress more warnings.

Suppress more warnings.

--- opcua-config.cmake
+++ opcua-config.cmake
@@ -56,6 +56,7 @@

   target_compile_options(OPCUA PRIVATE
     /wd4047
+    /wd4090
   )

   target_link_libraries(OPCUA PUBLIC


CMake: Add find module for POCO.

CMake: Add find module for POCO.


Avoid a purge target if no files are copied

--- math/minuit2/StandAlone.cmake
+++ math/minuit2/StandAlone.cmake
@@ -130,9 +130,11 @@
 endif()

 # Add purge target
-get_property(COPY_STANDALONE_LISTING GLOBAL PROPERTY COPY_STANDALONE_LISTING)
-add_custom_target(purge
-    COMMAND ${CMAKE_COMMAND} -E remove ${COPY_STANDALONE_LISTING})
+if(minuit2-standalone)
+    get_property(COPY_STANDALONE_LISTING GLOBAL PROPERTY COPY_STANDALONE_LISTING)
+    add_custom_target(purge
+        COMMAND ${CMAKE_COMMAND} -E remove ${COPY_STANDALONE_LISTING})
+endif()


Adjusted CUDA Arches (#41628)

Adjusted CUDA Arches (#41628)

--- cmake/cuda.cmake
+++ cmake/cuda.cmake
@@ -11,7 +11,7 @@
   add_definitions(-DNEW_RELEASE_ALL)
   set(paddle_known_gpu_archs "35 50 52 60 61 70 75 80 86")
   set(paddle_known_gpu_archs10 "35 50 52 60 61 70 75")
-  set(paddle_known_gpu_archs11 "35 50 60 61 70 75 80")
+  set(paddle_known_gpu_archs11 "50 60 61 70 75 80")
 elseif(NEW_RELEASE_PYPI)
   message("Using New Release Strategy - Cubin Packge")
   add_definitions(-DNEW_RELEASE_PYPI)


Fix GL feature detection for hwloc

Fix GL feature detection for hwloc

--- Findhwloc.cmake
+++ Findhwloc.cmake
@@ -40,7 +40,7 @@
   find_package_handle_standard_args(HWLOC DEFAULT_MSG HWLOC_LIBRARIES
     HWLOC_INCLUDE_DIRS)

-  if(NOT ${HWLOC_VERSION} VERSION_LESS 1.5.0)
+  if(NOT ${HWLOC_VERSION} VERSION_LESS 1.7.0)
     set(HWLOC_GL_FOUND 1)
   endif()


BUG: Remove Azure ExternalData resource.

The Azure grant that provided this resource has expired.

Change-Id: Id05a5b77359e17ecb35dd7aef4ac3ea6c8a9e7f9

--- CMake/ITKExternalData.cmake
+++ CMake/ITKExternalData.cmake
@@ -31,9 +31,6 @@
 mark_as_advanced(ExternalData_URL_TEMPLATES)
 if(NOT ITK_FORBID_DOWNLOADS)
   list(APPEND ExternalData_URL_TEMPLATES
-    # Data published on Azure
-    "http://itkexternaldata.blob.core.windows.net/%(algo:lower)/%(hash)"
-
     # Data published on MIDAS
     "http://midas3.kitware.com/midas/api/rest?method=midas.bitstream.download&checksum=%(hash)&algorithm=%(algo)"


Added gdal/gdal.h to header search path, and gdal1.4.1 to the lib search path.

git-svn-id: 23b6355f2bb369032457de4eb5f713ee134f73a8@7224 16af8721-9629-0410-8352-f15c8da7e697

--- CMakeModules/FindGDAL.cmake
+++ CMakeModules/FindGDAL.cmake
@@ -9,7 +9,7 @@
 #
 # Created by Robert Osfield.

-FIND_PATH(GDAL_INCLUDE_DIR gdal.h
+FIND_PATH(GDAL_INCLUDE_DIR gdal.h gdal/gdal.h
         ${GDAL_DIR}/include
     $ENV{GDAL_DIR}/include
     $ENV{GDAL_DIR}
@@ -29,7 +29,7 @@
 )

 FIND_LIBRARY(GDAL_LIBRARY
-    NAMES gdal gdal_i gdal1.4.0 gdal1.3.2
+    NAMES gdal gdal_i gdal1.4.0 gdal1.4.1 gdal1.3.2
     PATHS
     ${GDAL_DIR}/lib
     $ENV{GDAL_DIR}/lib


[cmake] Turn on the -Wbool-conversion flag.

This would have caught a problem caused by an upstream source code change in the
merge.

Swift SVN r32925

--- cmake/modules/SwiftSharedCMakeConfig.cmake
+++ cmake/modules/SwiftSharedCMakeConfig.cmake
@@ -366,6 +366,9 @@
   # Check for '-fapplication-extension'.  On OSX/iOS we wish to link all
   # dynamic libraries with this flag.
   check_cxx_compiler_flag("-fapplication-extension" CXX_SUPPORTS_FAPPLICATION_EXTENSION)
+
+  check_cxx_compiler_flag("-Werror -Wbool-conversion" CXX_SUPPORTS_BOOL_CONVERSION_WARNING_FLAG)
+  append_if(CXX_SUPPORTS_BOOL_CONVERSION_WARNING_FLAG "-Wbool-conversion" CMAKE_CXX_FLAGS)
 endmacro()

 # Like 'llvm_config()', but uses libraries from the selected build


fix libxslt finder

fix libxslt finder

Change-Id: I79a4f7d518ef4a94ca8cd6a058e6ab61969f3538

--- cmake/qibuild/modules/libxslt-config.cmake
+++ cmake/qibuild/modules/libxslt-config.cmake
@@ -1,5 +1,5 @@
 clean(LIBXSLT)

 fpath(LIBXSLT libxslt/xslt.h)
-flib(LIBEVENT NAMES xslt)
+flib(LIBXSLT NAMES xslt)
 export_lib(LIBXSLT)


attempt to fix buildbot

attempt to fix buildbot

--- cmake/FindMetaExamples.cmake
+++ cmake/FindMetaExamples.cmake
@@ -3,7 +3,9 @@
 	SET(META_EXAMPLES ${META_EXAMPLE_LISTINGS} PARENT_SCOPE)

 	# temporary hack to exclude certain meta examples that have dependencies
-	IF(NOT HAVE_NLOPT)
-		LIST(REMOVE_ITEM META_EXAMPLES ${CMAKE_SOURCE_DIR}/examples/meta/src/gaussian_processes/gaussian_process_regression.sg)
+	IF(DEFINED META_EXAMPLES)
+		IF(NOT HAVE_NLOPT)
+			LIST(REMOVE_ITEM META_EXAMPLES ${CMAKE_SOURCE_DIR}/examples/meta/src/gaussian_processes/gaussian_process_regression.sg)
+		ENDIF()
 	ENDIF()
 endfunction()


update findcuda

update findcuda

--- cmake/Modules/FindCUDA.cmake
+++ cmake/Modules/FindCUDA.cmake
@@ -2,37 +2,52 @@
 # FindCUDA
 # --------
 #
+# .. note::
+#
+#   The FindCUDA module has been superseded by first-class support
+#   for the CUDA language in CMake.  It is no longer necessary to
+#   use this module or call ``find_package(CUDA)``.  This module
+#   now exists only for compatibility with projects that have not
+#   been ported.
+#
+#   Instead, list ``CUDA`` among the languages named in the top-level
+#   call to the :command:`project` command, or call the
+#   :command:`enable_language` command with ``CUDA``.
+#   Then one can add CUDA (``.cu``) sources to programs directly
+#   in calls to :command:`add_library` and :command:`add_executable`.
+#
 # Tools for building CUDA C files: libraries and build dependencies.
 #
-# This script locates the NVIDIA CUDA C tools.  It should work on linux,
-# windows, and mac and should be reasonably up to date with CUDA C
+# This script locates the NVIDIA CUDA C tools.  It should work on Linux,
+# Windows, and macOS and should be reasonably up to date with CUDA C
 # releases.
 #
-# This script makes use of the standard find_package arguments of
-# <VERSION>, REQUIRED and QUIET.  CUDA_FOUND will report if an
+# This script makes use of the standard :command:`find_package` arguments of
+# ``<VERSION>``, ``REQUIRED`` and ``QUIET``.  ``CUDA_FOUND`` will report if an
 # acceptable version of CUDA was found.
 #
-# The script will prompt the user to specify CUDA_TOOLKIT_ROOT_DIR if
+# The script will prompt the user to specify ``CUDA_TOOLKIT_ROOT_DIR`` if
 # the prefix cannot be determined by the location of nvcc in the system
-# path and REQUIRED is specified to find_package().  To use a different
-# installed version of the toolkit set the environment variable
-# CUDA_BIN_PATH before running cmake (e.g.
-# CUDA_BIN_PATH=/usr/local/cuda1.0 instead of the default
-# /usr/local/cuda) or set CUDA_TOOLKIT_ROOT_DIR after configuring.  If
-# you change the value of CUDA_TOOLKIT_ROOT_DIR, various components that
+# path and ``REQUIRED`` is specified to :command:`find_package`.  To use
+# a different installed version of the toolkit set the environment variable
+# ``CUDA_BIN_PATH`` before running cmake (e.g.
+# ``CUDA_BIN_PATH=/usr/local/cuda1.0`` instead of the default
+# ``/usr/local/cuda``) or set ``CUDA_TOOLKIT_ROOT_DIR`` after configuring.  If
+# you change the value of ``CUDA_TOOLKIT_ROOT_DIR``, various components that
 # depend on the path will be relocated.
 #
-# It might be necessary to set CUDA_TOOLKIT_ROOT_DIR manually on certain
-# platforms, or to use a cuda runtime not installed in the default
-# location.  In newer versions of the toolkit the cuda library is
-# included with the graphics driver- be sure that the driver version
-# matches what is needed by the cuda runtime version.
+# It might be necessary to set ``CUDA_TOOLKIT_ROOT_DIR`` manually on certain
+# platforms, or to use a CUDA runtime not installed in the default
+# location.  In newer versions of the toolkit the CUDA library is
+# included with the graphics driver -- be sure that the driver version
+# matches what is needed by the CUDA runtime version.
 #
 # The following variables affect the behavior of the macros in the
-# script (in alphebetical order).  Note that any of these flags can be
+# script (in alphabetical order).  Note that any of these flags can be
 # changed multiple times in the same directory before calling
-# CUDA_ADD_EXECUTABLE, CUDA_ADD_LIBRARY, CUDA_COMPILE, CUDA_COMPILE_PTX,
-# CUDA_COMPILE_FATBIN, CUDA_COMPILE_CUBIN or CUDA_WRAP_SRCS::
+# ``CUDA_ADD_EXECUTABLE``, ``CUDA_ADD_LIBRARY``, ``CUDA_COMPILE``,
+# ``CUDA_COMPILE_PTX``, ``CUDA_COMPILE_FATBIN``, ``CUDA_COMPILE_CUBIN``
+# or ``CUDA_WRAP_SRCS``::
 #
 #   CUDA_64_BIT_DEVICE_CODE (Default matches host bit size)
 #   -- Set to ON to compile for 64 bit device code, OFF for 32 bit device code.
@@ -67,6 +82,13 @@
 #   -- Set to ON for Emulation mode. -D_DEVICEEMU is defined for CUDA C files
 #      when CUDA_BUILD_EMULATION is TRUE.
 #
+#   CUDA_LINK_LIBRARIES_KEYWORD (Default "")
+#    -- The <PRIVATE|PUBLIC|INTERFACE> keyword to use for internal
+#       target_link_libraries calls. The default is to use no keyword which
+#       uses the old "plain" form of target_link_libraries. Note that is matters
+#       because whatever is used inside the FindCUDA module must also be used
+#       outside - the two forms of target_link_libraries cannot be mixed.
+#
 #   CUDA_GENERATED_OUTPUT_DIR (Default CMAKE_CURRENT_BINARY_DIR)
 #   -- Set to the path you wish to have the generated files placed.  If it is
 #      blank output files will be placed in CMAKE_CURRENT_BINARY_DIR.
@@ -76,12 +98,15 @@
 #   CUDA_HOST_COMPILATION_CPP (Default ON)
 #   -- Set to OFF for C compilation of host code.
 #
-#   CUDA_HOST_COMPILER (Default CMAKE_C_COMPILER, $(VCInstallDir)/bin for VS)
+#   CUDA_HOST_COMPILER (Default CMAKE_C_COMPILER)
 #   -- Set the host compiler to be used by nvcc.  Ignored if -ccbin or
 #      --compiler-bindir is already present in the CUDA_NVCC_FLAGS or
-#      CUDA_NVCC_FLAGS_<CONFIG> variables.  For Visual Studio targets
-#      $(VCInstallDir)/bin is a special value that expands out to the path when
+#      CUDA_NVCC_FLAGS_<CONFIG> variables.  For Visual Studio targets,
+#      the host compiler is constructed with one or more visual studio macros
+#      such as $(VCInstallDir), that expands out to the path when
 #      the command is run from within VS.
+#      If the CUDAHOSTCXX environment variable is set it will
+#      be used as the default.
 #
 #   CUDA_NVCC_FLAGS
 #   CUDA_NVCC_FLAGS_<CONFIG>
@@ -124,7 +149,7 @@
 #      VERBOSE=1 to see output), although setting CUDA_VERBOSE_BUILD to ON will
 #      always print the output.
 #
-# The script creates the following macros (in alphebetical order)::
+# The script creates the following macros (in alphabetical order)::
 #
 #   CUDA_ADD_CUFFT_TO_TARGET( cuda_target )
 #   -- Adds the cufft library to the target (can be any target).  Handles whether
@@ -152,7 +177,7 @@
 #   -- Same as CUDA_ADD_EXECUTABLE except that a library is created.
 #
 #   CUDA_BUILD_CLEAN_TARGET()
-#   -- Creates a convience target that deletes all the dependency files
+#   -- Creates a convenience target that deletes all the dependency files
 #      generated.  You should make clean after running this target to ensure the
 #      dependency files get regenerated.
 #
@@ -318,7 +343,27 @@
 #   CUDA_nppc_LIBRARY     -- NVIDIA Performance Primitives lib (core).
 #                            Only available for CUDA version 5.5+.
 #   CUDA_nppi_LIBRARY     -- NVIDIA Performance Primitives lib (image processing).
-#                            Only available for CUDA version 5.5+.
+#                            Only available for CUDA version 5.5 - 8.0.
+#   CUDA_nppial_LIBRARY   -- NVIDIA Performance Primitives lib (image processing).
+#                            Only available for CUDA version 9.0.
+#   CUDA_nppicc_LIBRARY   -- NVIDIA Performance Primitives lib (image processing).
+#                            Only available for CUDA version 9.0.
+#   CUDA_nppicom_LIBRARY  -- NVIDIA Performance Primitives lib (image processing).
+#                            Only available for CUDA version 9.0.
+#   CUDA_nppidei_LIBRARY  -- NVIDIA Performance Primitives lib (image processing).
+#                            Only available for CUDA version 9.0.
+#   CUDA_nppif_LIBRARY    -- NVIDIA Performance Primitives lib (image processing).
+#                            Only available for CUDA version 9.0.
+#   CUDA_nppig_LIBRARY    -- NVIDIA Performance Primitives lib (image processing).
+#                            Only available for CUDA version 9.0.
+#   CUDA_nppim_LIBRARY    -- NVIDIA Performance Primitives lib (image processing).
+#                            Only available for CUDA version 9.0.
+#   CUDA_nppist_LIBRARY   -- NVIDIA Performance Primitives lib (image processing).
+#                            Only available for CUDA version 9.0.
+#   CUDA_nppisu_LIBRARY   -- NVIDIA Performance Primitives lib (image processing).
+#                            Only available for CUDA version 9.0.
+#   CUDA_nppitc_LIBRARY   -- NVIDIA Performance Primitives lib (image processing).
+#                            Only available for CUDA version 9.0.
 #   CUDA_npps_LIBRARY     -- NVIDIA Performance Primitives lib (signal processing).
 #                            Only available for CUDA version 5.5+.
 #   CUDA_nvcuvenc_LIBRARY -- CUDA Video Encoder library.
@@ -482,10 +527,18 @@
 option(CUDA_HOST_COMPILATION_CPP "Generated file extension" ON)

 # Extra user settable flags
-set(CUDA_NVCC_FLAGS "" CACHE STRING "Semi-colon delimit multiple arguments.")
-
-if(CMAKE_GENERATOR MATCHES "Visual Studio")
-  set(CUDA_HOST_COMPILER "$(VCInstallDir)bin" CACHE FILEPATH "Host side compiler used by NVCC")
+cmake_initialize_per_config_variable(CUDA_NVCC_FLAGS "Semi-colon delimit multiple arguments.")
+
+if(DEFINED ENV{CUDAHOSTCXX})
+  set(CUDA_HOST_COMPILER "$ENV{CUDAHOSTCXX}" CACHE FILEPATH "Host side compiler used by NVCC")
+elseif(CMAKE_GENERATOR MATCHES "Visual Studio")
+  set(_CUDA_MSVC_HOST_COMPILER "$(VCInstallDir)Tools/MSVC/$(VCToolsVersion)/bin/Host$(Platform)/$(PlatformTarget)")
+  if(MSVC_VERSION LESS 1910)
+   set(_CUDA_MSVC_HOST_COMPILER "$(VCInstallDir)bin")
+  endif()
+
+  set(CUDA_HOST_COMPILER "${_CUDA_MSVC_HOST_COMPILER}" CACHE FILEPATH "Host side compiler used by NVCC")
+
 else()
   if(APPLE
       AND "${CMAKE_C_COMPILER_ID}" MATCHES "Clang"
@@ -508,6 +561,11 @@
       set(c_compiler_realpath "")
     endif()
     set(CUDA_HOST_COMPILER "${c_compiler_realpath}" CACHE FILEPATH "Host side compiler used by NVCC")
+  elseif(MSVC AND "${CMAKE_C_COMPILER}" MATCHES "clcache|sccache")
+    # NVCC does not think it will work if it is passed clcache.exe or sccache.exe
+    # as the host compiler, which means that builds with CC=cl.exe won't work.
+    # Best to just feed it whatever the actual cl.exe is as the host compiler.
+    set(CUDA_HOST_COMPILER "cl.exe" CACHE FILEPATH "Host side compiler used by NVCC")
   else()
     set(CUDA_HOST_COMPILER "${CMAKE_C_COMPILER}"
       CACHE FILEPATH "Host side compiler used by NVCC")
@@ -515,7 +573,7 @@
 endif()

 # Propagate the host flags to the host compiler via -Xcompiler
-option(CUDA_PROPAGATE_HOST_FLAGS "Propage C/CXX_FLAGS and friends to the host compiler via -Xcompile" ON)
+option(CUDA_PROPAGATE_HOST_FLAGS "Propagate C/CXX_FLAGS and friends to the host compiler via -Xcompile" ON)

 # Enable CUDA_SEPARABLE_COMPILATION
 option(CUDA_SEPARABLE_COMPILATION "Compile CUDA objects with separable compilation enabled.  Requires CUDA 5.0+" OFF)
@@ -536,19 +594,17 @@
   CUDA_SEPARABLE_COMPILATION
   )

-# Makefile and similar generators don't define CMAKE_CONFIGURATION_TYPES, so we
-# need to add another entry for the CMAKE_BUILD_TYPE.  We also need to add the
-# standerd set of 4 build types (Debug, MinSizeRel, Release, and RelWithDebInfo)
-# for completeness.  We need run this loop in order to accomodate the addition
-# of extra configuration types.  Duplicate entries will be removed by
-# REMOVE_DUPLICATES.
+# Single config generators like Makefiles or Ninja don't usually have
+# CMAKE_CONFIGURATION_TYPES defined (but note that it can be defined if set by
+# projects or developers). Even CMAKE_BUILD_TYPE might not be defined for
+# single config generators (and should not be defined for multi-config
+# generators). To ensure we get a complete superset of all possible
+# configurations, we combine CMAKE_CONFIGURATION_TYPES, CMAKE_BUILD_TYPE and
+# all of the standard configurations, then weed out duplicates with
+# list(REMOVE_DUPLICATES). Looping over the unique set then ensures we have
+# each configuration-specific set of nvcc flags defined and marked as advanced.
 set(CUDA_configuration_types ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE} Debug MinSizeRel Release RelWithDebInfo)
 list(REMOVE_DUPLICATES CUDA_configuration_types)
-foreach(config ${CUDA_configuration_types})
-    string(TOUPPER ${config} config_upper)
-    set(CUDA_NVCC_FLAGS_${config_upper} "" CACHE STRING "Semi-colon delimit multiple arguments.")
-    mark_as_advanced(CUDA_NVCC_FLAGS_${config_upper})
-endforeach()

 ###############################################################################
 ###############################################################################
@@ -582,7 +638,6 @@
   unset(CUDA_npps_LIBRARY CACHE)
   unset(CUDA_nvcuvenc_LIBRARY CACHE)
   unset(CUDA_nvcuvid_LIBRARY CACHE)
-  unset(CUDA_USE_STATIC_CUDA_RUNTIME CACHE)
   unset(CUDA_GPU_DETECT_OUTPUT CACHE)
 endmacro()

@@ -625,8 +680,7 @@
   find_path(CUDA_TOOLKIT_ROOT_DIR
     NAMES nvcc nvcc.exe
     PATHS /opt/cuda/bin
-          /usr/local/bin
-          /usr/local/cuda/bin
+    PATH_SUFFIXES cuda/bin
     DOC "Toolkit location."
     )

@@ -672,7 +726,11 @@
   # add known CUDA targetr root path to the set of directories we search for programs, libraries and headers
   set( CMAKE_FIND_ROOT_PATH "${CUDA_TOOLKIT_TARGET_DIR};${CMAKE_FIND_ROOT_PATH}")
   macro( cuda_find_host_program )
-    find_host_program( ${ARGN} )
+    if (COMMAND find_host_program)
+      find_host_program( ${ARGN} )
+    else()
+      find_program( ${ARGN} )
+    endif()
   endmacro()
 else()
   # for non-cross-compile, find_host_program == find_program and CUDA_TOOLKIT_TARGET_DIR == CUDA_TOOLKIT_ROOT_DIR
@@ -684,16 +742,20 @@

 # CUDA_NVCC_EXECUTABLE
-cuda_find_host_program(CUDA_NVCC_EXECUTABLE
-  NAMES nvcc
-  PATHS "${CUDA_TOOLKIT_ROOT_DIR}"
-  ENV CUDA_PATH
-  ENV CUDA_BIN_PATH
-  PATH_SUFFIXES bin bin64
-  NO_DEFAULT_PATH
-  )
-# Search default search paths, after we search our own set of paths.
-cuda_find_host_program(CUDA_NVCC_EXECUTABLE nvcc)
+if(DEFINED ENV{CUDA_NVCC_EXECUTABLE})
+  set(CUDA_NVCC_EXECUTABLE "$ENV{CUDA_NVCC_EXECUTABLE}" CACHE FILEPATH "The CUDA compiler")
+else()
+  cuda_find_host_program(CUDA_NVCC_EXECUTABLE
+    NAMES nvcc
+    PATHS "${CUDA_TOOLKIT_ROOT_DIR}"
+    ENV CUDA_PATH
+    ENV CUDA_BIN_PATH
+    PATH_SUFFIXES bin bin64
+    NO_DEFAULT_PATH
+    )
+  # Search default search paths, after we search our own set of paths.
+  cuda_find_host_program(CUDA_NVCC_EXECUTABLE nvcc)
+endif()
 mark_as_advanced(CUDA_NVCC_EXECUTABLE)

 if(CUDA_NVCC_EXECUTABLE AND NOT CUDA_VERSION)
@@ -791,12 +853,17 @@
 if(CUDA_cudart_static_LIBRARY)
   # If static cudart available, use it by default, but provide a user-visible option to disable it.
   option(CUDA_USE_STATIC_CUDA_RUNTIME "Use the static version of the CUDA runtime library if available" ON)
-  set(CUDA_CUDART_LIBRARY_VAR CUDA_cudart_static_LIBRARY)
 else()
   # If not available, silently disable the option.
   set(CUDA_USE_STATIC_CUDA_RUNTIME OFF CACHE INTERNAL "")
+endif()
+
+if(CUDA_USE_STATIC_CUDA_RUNTIME)
+  set(CUDA_CUDART_LIBRARY_VAR CUDA_cudart_static_LIBRARY)
+else()
   set(CUDA_CUDART_LIBRARY_VAR CUDA_CUDART_LIBRARY)
 endif()
+
 if(NOT CUDA_VERSION VERSION_LESS "5.0")
   cuda_find_library_local_first(CUDA_cudadevrt_LIBRARY cudadevrt "\"cudadevrt\" library")
   mark_as_advanced(CUDA_cudadevrt_LIBRARY)
@@ -908,9 +975,28 @@
     find_cuda_helper_libs(nvcuvid)
   endif()
 endif()
-if(CUDA_VERSION VERSION_GREATER "5.0")
+if(CUDA_VERSION VERSION_GREATER "5.0" AND CUDA_VERSION VERSION_LESS "9.2")
+  # In CUDA 9.2 cublas_device was deprecated
   find_cuda_helper_libs(cublas_device)
-  # In CUDA 5.5 NPP was splitted onto 3 separate libraries.
+endif()
+
+if(NOT CUDA_VERSION VERSION_LESS "9.0")
+  # In CUDA 9.0 NPP was nppi was removed
+  find_cuda_helper_libs(nppc)
+  find_cuda_helper_libs(nppial)
+  find_cuda_helper_libs(nppicc)
+  find_cuda_helper_libs(nppicom)
+  find_cuda_helper_libs(nppidei)
+  find_cuda_helper_libs(nppif)
+  find_cuda_helper_libs(nppig)
+  find_cuda_helper_libs(nppim)
+  find_cuda_helper_libs(nppist)
+  find_cuda_helper_libs(nppisu)
+  find_cuda_helper_libs(nppitc)
+  find_cuda_helper_libs(npps)
+  set(CUDA_npp_LIBRARY "${CUDA_nppc_LIBRARY};${CUDA_nppial_LIBRARY};${CUDA_nppicc_LIBRARY};${CUDA_nppicom_LIBRARY};${CUDA_nppidei_LIBRARY};${CUDA_nppif_LIBRARY};${CUDA_nppig_LIBRARY};${CUDA_nppim_LIBRARY};${CUDA_nppist_LIBRARY};${CUDA_nppisu_LIBRARY};${CUDA_nppitc_LIBRARY};${CUDA_npps_LIBRARY}")
+elseif(CUDA_VERSION VERSION_GREATER "5.0")
+  # In CUDA 5.5 NPP was split into 3 separate libraries.
   find_cuda_helper_libs(nppc)
   find_cuda_helper_libs(nppi)
   find_cuda_helper_libs(npps)
@@ -1248,11 +1334,11 @@
   endif()

   # This needs to be passed in at this stage, because VS needs to fill out the
-  # value of VCInstallDir from within VS.  Note that CCBIN is only used if
+  # various macros from within VS.  Note that CCBIN is only used if
   # -ccbin or --compiler-bindir isn't used and CUDA_HOST_COMPILER matches
-  # $(VCInstallDir)/bin.
+  # _CUDA_MSVC_HOST_COMPILER
   if(CMAKE_GENERATOR MATCHES "Visual Studio")
-    set(ccbin_flags -D "\"CCBIN:PATH=$(VCInstallDir)bin\"" )
+    set(ccbin_flags -D "\"CCBIN:PATH=${_CUDA_MSVC_HOST_COMPILER}\"" )
   else()
     set(ccbin_flags)
   endif()
@@ -1371,7 +1457,7 @@
   if( "${_cuda_host_flags}" MATCHES "-std=c\\+\\+11")
     # Add the c++11 flag to nvcc if it isn't already present.  Note that we only look at
     # the main flag instead of the configuration specific flags.
-    if( NOT "${CUDA_NVCC_FLAGS}" MATCHES "-std;c\\+\\+11" )
+    if( NOT "${CUDA_NVCC_FLAGS}" MATCHES "-std=c\\+\\+11" )
       list(APPEND nvcc_flags --std c++11)
     endif()
     string(REGEX REPLACE "[-]+std=c\\+\\+11" "" _cuda_host_flags "${_cuda_host_flags}")
@@ -1492,7 +1578,7 @@
       # Bring in the dependencies.  Creates a variable CUDA_NVCC_DEPEND #######
       cuda_include_nvcc_dependencies(${cmake_dependency_file})

-      # Convience string for output ###########################################
+      # Convenience string for output #########################################
       if(CUDA_BUILD_EMULATION)
         set(cuda_build_type "Emulation")
       else()
@@ -1691,6 +1777,7 @@
         COMMAND ${CUDA_NVCC_EXECUTABLE} ${nvcc_flags} -dlink ${object_files} -o ${output_file}
         ${flags}
         COMMENT "Building NVCC intermediate link file ${output_file_relative_path}"
+        COMMAND_EXPAND_LISTS
         ${_verbatim}
         )
     else()
@@ -1701,6 +1788,7 @@
         COMMAND ${CMAKE_COMMAND} -E echo "Building NVCC intermediate link file ${output_file_relative_path}"
         COMMAND ${CMAKE_COMMAND} -E make_directory "${output_file_dir}"
         COMMAND ${CUDA_NVCC_EXECUTABLE} ${nvcc_flags} ${flags} -dlink ${object_files} -o "${output_file}"
+        COMMAND_EXPAND_LISTS
         ${_verbatim}
         )
     endif()
@@ -1740,12 +1828,12 @@
   # variable will have been defined.
   CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS("${link_file}" ${cuda_target} "${_options}" "${${cuda_target}_SEPARABLE_COMPILATION_OBJECTS}")

-  target_link_libraries(${cuda_target}
+  target_link_libraries(${cuda_target} ${CUDA_LINK_LIBRARIES_KEYWORD}
     ${CUDA_LIBRARIES}
     )

   if(CUDA_SEPARABLE_COMPILATION)
-    target_link_libraries(${cuda_target}
+    target_link_libraries(${cuda_target} ${CUDA_LINK_LIBRARIES_KEYWORD}
       ${CUDA_cudadevrt_LIBRARY}
       )
   endif()
@@ -1790,7 +1878,7 @@
   # variable will have been defined.
   CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS("${link_file}" ${cuda_target} "${_options}" "${${cuda_target}_SEPARABLE_COMPILATION_OBJECTS}")

-  target_link_libraries(${cuda_target}
+  target_link_libraries(${cuda_target} ${CUDA_LINK_LIBRARIES_KEYWORD}
     ${CUDA_LIBRARIES}
     )

@@ -1818,7 +1906,7 @@
   else()
     set(_counter 1)
   endif()
-  set(_cuda_target "${_cuda_target}_${_counter}")
+  string(APPEND _cuda_target "_${_counter}")
   set_property(DIRECTORY PROPERTY _cuda_internal_phony_counter ${_counter})

   # Separate the sources from the options
@@ -1876,9 +1964,9 @@
 ###############################################################################
 macro(CUDA_ADD_CUFFT_TO_TARGET target)
   if (CUDA_BUILD_EMULATION)
-    target_link_libraries(${target} ${CUDA_cufftemu_LIBRARY})
+    target_link_libraries(${target} ${CUDA_LINK_LIBRARIES_KEYWORD} ${CUDA_cufftemu_LIBRARY})
   else()
-    target_link_libraries(${target} ${CUDA_cufft_LIBRARY})
+    target_link_libraries(${target} ${CUDA_LINK_LIBRARIES_KEYWORD} ${CUDA_cufft_LIBRARY})
   endif()
 endmacro()

@@ -1889,9 +1977,9 @@
 ###############################################################################
 macro(CUDA_ADD_CUBLAS_TO_TARGET target)
   if (CUDA_BUILD_EMULATION)
-    target_link_libraries(${target} ${CUDA_cublasemu_LIBRARY})
+    target_link_libraries(${target} ${CUDA_LINK_LIBRARIES_KEYWORD} ${CUDA_cublasemu_LIBRARY})
   else()
-    target_link_libraries(${target} ${CUDA_cublas_LIBRARY} ${CUDA_cublas_device_LIBRARY})
+    target_link_libraries(${target} ${CUDA_LINK_LIBRARIES_KEYWORD} ${CUDA_cublas_LIBRARY} ${CUDA_cublas_device_LIBRARY})
   endif()
 endmacro()

@@ -1901,9 +1989,9 @@
 ###############################################################################
 ###############################################################################
 macro(CUDA_BUILD_CLEAN_TARGET)
-  # Call this after you add all your CUDA targets, and you will get a convience
-  # target.  You should also make clean after running this target to get the
-  # build system to generate all the code again.
+  # Call this after you add all your CUDA targets, and you will get a
+  # convenience target.  You should also make clean after running this target
+  # to get the build system to generate all the code again.

   set(cuda_clean_target_name clean_cuda_depends)
   if (CMAKE_GENERATOR MATCHES "Visual Studio")


more conservative findcuda change

more conservative findcuda change

--- cmake/Modules/FindCUDA.cmake
+++ cmake/Modules/FindCUDA.cmake
@@ -908,9 +908,28 @@
     find_cuda_helper_libs(nvcuvid)
   endif()
 endif()
-if(CUDA_VERSION VERSION_GREATER "5.0")
+if(CUDA_VERSION VERSION_GREATER "5.0" AND CUDA_VERSION VERSION_LESS "9.2")
+  # In CUDA 9.2 cublas_device was deprecated
   find_cuda_helper_libs(cublas_device)
-  # In CUDA 5.5 NPP was splitted onto 3 separate libraries.
+endif()
+
+if(NOT CUDA_VERSION VERSION_LESS "9.0")
+  # In CUDA 9.0 NPP was nppi was removed
+  find_cuda_helper_libs(nppc)
+  find_cuda_helper_libs(nppial)
+  find_cuda_helper_libs(nppicc)
+  find_cuda_helper_libs(nppicom)
+  find_cuda_helper_libs(nppidei)
+  find_cuda_helper_libs(nppif)
+  find_cuda_helper_libs(nppig)
+  find_cuda_helper_libs(nppim)
+  find_cuda_helper_libs(nppist)
+  find_cuda_helper_libs(nppisu)
+  find_cuda_helper_libs(nppitc)
+  find_cuda_helper_libs(npps)
+  set(CUDA_npp_LIBRARY "${CUDA_nppc_LIBRARY};${CUDA_nppial_LIBRARY};${CUDA_nppicc_LIBRARY};${CUDA_nppicom_LIBRARY};${CUDA_nppidei_LIBRARY};${CUDA_nppif_LIBRARY};${CUDA_nppig_LIBRARY};${CUDA_nppim_LIBRARY};${CUDA_nppist_LIBRARY};${CUDA_nppisu_LIBRARY};${CUDA_nppitc_LIBRARY};${CUDA_npps_LIBRARY}")
+elseif(CUDA_VERSION VERSION_GREATER "5.0")
+  # In CUDA 5.5 NPP was split into 3 separate libraries.
   find_cuda_helper_libs(nppc)
   find_cuda_helper_libs(nppi)
   find_cuda_helper_libs(npps)
@@ -930,6 +949,7 @@
   set(CUDA_CUFFT_LIBRARIES ${CUDA_cufft_LIBRARY})
   set(CUDA_CUBLAS_LIBRARIES ${CUDA_cublas_LIBRARY} ${CUDA_cublas_device_LIBRARY})
 endif()
+

 ########################
 # Look for the SDK stuff.  As of CUDA 3.0 NVSDKCUDA_ROOT has been replaced with


Typo in FindQVTK.cmake

Typo in FindQVTK.cmake

--- cmake/Modules/FindQVTK.cmake
+++ cmake/Modules/FindQVTK.cmake
@@ -21,12 +21,12 @@
     set (VTK_USE_QVTK ON)
   endif(NOT QVTK_FOUND)
 else (${VTK_MAJOR_VERSION} VERSION_LESS "6.0")
-  list (FIND VTK_MODULES_ENABLED vtkGUISupportQt GUI_SUUPORT_QT_FOUND)
+  list (FIND VTK_MODULES_ENABLED vtkGUISupportQt GUI_SUPPORT_QT_FOUND)
   list (FIND VTK_MODULES_ENABLED vtkRenderingQt RENDERING_QT_FOUND)
-  if (GUI_SUUPORT_QT_FOUND AND RENDERING_QT_FOUND)
+  if (GUI_SUPPORT_QT_FOUND AND RENDERING_QT_FOUND)
     set (VTK_USE_QVTK ON)
     set (QVTK_LIBRARY vtkRenderingQt vtkGUISupportQt)
-  else (GUI_SUUPORT_QT_FOUND AND RENDERING_QT_FOUND)
+  else (GUI_SUPPORT_QT_FOUND AND RENDERING_QT_FOUND)
     unset(QVTK_FOUND)
-  endif (GUI_SUUPORT_QT_FOUND AND RENDERING_QT_FOUND)
+  endif (GUI_SUPPORT_QT_FOUND AND RENDERING_QT_FOUND)
 endif (${VTK_MAJOR_VERSION} VERSION_LESS "6.0")


- Fix GLFW_LIBRARY variable set by FindGLFW which only contained the folder - Add support for MSVC 11 by adding its registry path

--- cmake_modules/FindGLFW.cmake
+++ cmake_modules/FindGLFW.cmake
@@ -24,7 +24,9 @@
 ENDMACRO(DBG_MSG)

 IF(WIN32)
-    IF(MSVC10)
+    IF(MSVC11)
+        GET_FILENAME_COMPONENT(VS_DIR [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Setup\\VS;ProductDir] REALPATH CACHE)
+    ELSEIF(MSVC10)
         GET_FILENAME_COMPONENT(VS_DIR [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup\\VS;ProductDir] REALPATH CACHE)
     ELSEIF(MSVC90)
         GET_FILENAME_COMPONENT(VS_DIR [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VS;ProductDir] REALPATH CACHE)
@@ -100,7 +102,7 @@
 #     endif()
 endif()

-FIND_LIBRARY(GLFW_LIBRARY   NAMES glfw
+FIND_LIBRARY(GLFW_LIBRARY   glfw
                             PATHS
                             ~/Library/Frameworks
                             /Library/Frameworks


Fix copyright path for mitkDiffusion

Fix copyright path for mitkDiffusion

--- Applications/mitkDiffusion/CPackOptions.cmake
+++ Applications/mitkDiffusion/CPackOptions.cmake
@@ -14,8 +14,8 @@
 # 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}")

-set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR }/Copyright.txt")
-set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR }/Copyright.txt")
+set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/Applications/${target_dir}/Copyright.txt")
+set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Applications/${target_dir}/Copyright.txt")

 if(CMAKE_CL_64)
   set(CPACK_PACKAGE_FILE_NAME "MITK-Diffusion-${CPACK_PACKAGE_VERSION}-win64")


Fix linux build

Fix linux build

--- modules/zlib.cmake
+++ modules/zlib.cmake
@@ -14,6 +14,9 @@

   # Set module options
   option(AMD64 "Enable building amd64 assembly implementation" ON)
+
+  # Set install flag
+  set(SKIP_INSTALL_ALL Y)

   # Includes
   include_directories("zlib")


Added custom targets for building and running all benchmarks

--- configure.cmake
+++ configure.cmake
@@ -8,8 +8,23 @@
 vpm_include_directories(${CMAKE_CURRENT_LIST_DIR}/include)

 macro(crunch_add_benchmark _name)
+  # Shared build target for all benchmarks
+  if(NOT TARGET build-benchmarks)
+    add_custom_target(build-benchmarks)
+  endif()
+
+  # Shared run target for all benchmarks
+  if(NOT TARGET run-benchmarks)
+    add_custom_target(run-benchmarks)
+  endif()
+
+  # Run target for this benchmark
   add_custom_target("run-${_name}"
     ${_name}
     WORKING_DIRECTORY ${CMAKE_CURRENTY_BINARY_DIR}
     VERBATIM)
+
+  # Add dependencies on shared build and run targets
+  add_dependencies(build-benchmarks ${_name})
+  add_dependencies(run-benchmarks "run-${_name}")
 endmacro()


remove logg library

remove logg library

--- cmake/FileList.cmake
+++ cmake/FileList.cmake
@@ -21,9 +21,6 @@
 set(SCRIPT_SRC
 src/paintown-engine/script/script.cpp
 src/paintown-engine/script/modules/python.cpp)
-
-set(OGG_SRC
-src/util/ogg/logg.c)

 set(LEVEL_SRC
 src/paintown-engine/level/block.cpp


Fix FindCuda cmake file.

Fix FindCuda cmake file.

--- cmake/FindCUDA.cmake
+++ cmake/FindCUDA.cmake
@@ -84,29 +84,29 @@

 ENDMACRO(GET_CUDA_INC_DIRS)

-
+
 # Get file dependencies.
 MACRO (GET_CUFILE_DEPENDENCIES dependencies file)
 	GET_FILENAME_COMPONENT(filepath ${file} PATH)

 	#  parse file for dependencies
-	FILE(READ "${file}" CONTENTS)
+	FILE(READ "${file}" CONTENTS)
+	#STRING(REGEX MATCHALL "#[ \t]*include[ \t]+[<\"][^>\"]*" DEPS "${CONTENTS}")
+	STRING(REGEX MATCHALL "#[ \t]*include[ \t]+\"[^\"]*" DEPS "${CONTENTS}")

 	SET(${dependencies})

 	FOREACH(DEP ${DEPS})
 		STRING(REGEX REPLACE "#[ \t]*include[ \t]+\"" "" DEP "${DEP}")
-
+
 		FIND_PATH(PATH_OF_${DEP} ${DEP}
 			${filepath})
-
+
 		IF(NOT ${PATH_OF_${DEP}} STREQUAL PATH_OF_${DEP}-NOTFOUND)
-			MESSAGE("${filepath} ${PATH_OF_${DEP}}/${DEP}")
+			#MESSAGE("${file} : ${PATH_OF_${DEP}}/${DEP}")
 			SET(${dependencies} ${${dependencies}} ${PATH_OF_${DEP}}/${DEP})
 		ENDIF(NOT ${PATH_OF_${DEP}} STREQUAL PATH_OF_${DEP}-NOTFOUND)

-		# reset path.
-		#SET(PATH_OF_${DEP})
 	ENDFOREACH(DEP)

 ENDMACRO (GET_CUFILE_DEPENDENCIES)


VC) TUNDRA_NO_BOOST: enforce inclusion of (${OGRE_DIR}/include/OGRE/RenderSystems/Direct3D9

--- cmake/FindOgre.cmake
+++ cmake/FindOgre.cmake
@@ -41,9 +41,12 @@
         message(STATUS "DirectX disabled from the build\n")
     endif()

-    if ("${TBB_HOME}" STREQUAL "")
-        file(TO_CMAKE_PATH "$ENV{TBB_HOME}" TBB_HOME)
-        set(TBB_HOME ${TBB_HOME} CACHE PATH "TBB_HOME dependency path" FORCE)
+    # If doing TUNDRA_NO_BOOST build, TBB is used for Ogre's threading.
+    if (MSVC90 AND TUNDRA_NO_BOOST) # TODO VC10 doesn't need this, investigate why
+        if ("${TBB_HOME}" STREQUAL "")
+            file(TO_CMAKE_PATH "$ENV{TBB_HOME}" TBB_HOME)
+            set(5TBB_HOME ${TBB_HOME} CACHE PATH "TBB_HOME dependency path" FORCE)
+        endif()
     endif()

     # Ogre lookup rules:
@@ -107,6 +110,7 @@
         include_directories(${OGRE_DIR}/include/OGRE)
         link_directories(${OGRE_DIR}/lib)
         if (WIN32)
+            include_directories(${OGRE_DIR}/include/OGRE/RenderSystems/Direct3D9)
             # Note: VC9 uses $(ConfigurationName), but #VC10 and onwards uses $(Configuration).
             # However VC10 seems to be able to understand $(ConfigurationName) also, so use that.
             link_directories(${OGRE_DIR}/lib/$(ConfigurationName))


Ogre header PATH_SUFFIXES ammended in FindOgre.cmake as Timotei suggested (thanks!)

--HG--
branch : v0-8

--- cmake/FindOgre.cmake
+++ cmake/FindOgre.cmake
@@ -58,20 +58,20 @@
 )

 set(OGRE_PATH_SUFFIXES
-    ${OGRE_PATH_SUFFIXES} include OgreMain/include
+    ${OGRE_PATH_SUFFIXES} include include/OGRE OGRE OgreMain/include OgreMain/include/OGRE
 )

 # Find the Ogre include headers.
 find_path(OGRE_H_PATH
           NAMES Ogre.h
           PATHS ${OGRE_PREFIX_PATH}
-          PATH_SUFFIXES ${OGRE_PATH_SUFFIXES} OGRE)
+          PATH_SUFFIXES ${OGRE_PATH_SUFFIXES})

 # Also find the build settings Ogre header.
 find_path(OGRE_H_BUILD_SETTINGS_PATH
           NAMES OgreBuildSettings.h
           PATHS ${OGRE_PREFIX_PATH}
-          PATH_SUFFIXES ${OGRE_PATH_SUFFIXES} OGRE)
+          PATH_SUFFIXES ${OGRE_PATH_SUFFIXES})

 # Find the release and debug libraries.
 find_library(OGRE_LIB NAMES OgreMain


Cmake: Fix capitalization of the Vc_NO_XGETBV macro

* While at it, streamline the method of addition the macro definition to
use Vc_DEFINITIONS instead of add_definitions.

Fixes: gh-85
Signed-off-by: Matthias Kretz <372ea4eca737a13cd010ee806d4ce7b98ee71550@kde.org>

--- cmake/VcMacros.cmake
+++ cmake/VcMacros.cmake
@@ -143,7 +143,7 @@
    if(APPLE)
       if(NOT Vc_COMPILER_IS_CLANG)
          message(WARNING "Apple does not provide an assembler with AVX support. AVX will not be available. Please use Clang if you want to use AVX.")
-         set(Vc_DEFINITIONS "${Vc_DEFINITIONS} -DVC_NO_XGETBV")
+         set(Vc_DEFINITIONS "${Vc_DEFINITIONS} -DVc_NO_XGETBV") # old assembler doesn't know the xgetbv instruction
          set(Vc_AVX_INTRINSICS_BROKEN true)
          set(Vc_AVX2_INTRINSICS_BROKEN true)
       endif()
@@ -162,7 +162,7 @@
          string(REGEX MATCH "[1-9]\\.[0-9]+(\\.[0-9]+)?" _as_version "${_as_version}")
          if(_as_version VERSION_LESS "2.18.93")
             UserWarning("Your binutils is too old (${_as_version}). Some optimizations of Vc will be disabled.")
-            add_definitions(-DVC_NO_XGETBV) # old assembler doesn't know the xgetbv instruction
+            set(Vc_DEFINITIONS "${Vc_DEFINITIONS} -DVc_NO_XGETBV") # old assembler doesn't know the xgetbv instruction
             set(Vc_AVX_INTRINSICS_BROKEN true)
             set(Vc_XOP_INTRINSICS_BROKEN true)
             set(Vc_FMA4_INTRINSICS_BROKEN true)
@@ -303,7 +303,7 @@
       # MSVC does not support inline assembly on 64 bit! :(
       # searching the help for xgetbv doesn't turn up anything. So just fall back to not supporting AVX on Windows :(
       # TODO: apparently MSVC 2010 SP1 added _xgetbv
-      set(Vc_DEFINITIONS "${Vc_DEFINITIONS} -DVC_NO_XGETBV")
+      set(Vc_DEFINITIONS "${Vc_DEFINITIONS} -DVc_NO_XGETBV")

       # get rid of the min/max macros
       set(Vc_DEFINITIONS "${Vc_DEFINITIONS} -DNOMINMAX")


[FIX] TravisCI stuff.

[FIX] TravisCI stuff.

--- cmake/cppcheck.cmake
+++ cmake/cppcheck.cmake
@@ -7,7 +7,7 @@

 add_custom_target(
         cppcheck
-        COMMAND ${CPPCHECK_EXECUTABLE} --xml --xml-version=2 --enable=warning,performance,style --error-exitcode=1 --suppressions-list=${PROJECT_SOURCE_DIR}/test/cppcheck/suppressions-list.txt -UNN_EXPORT ${PROJECT_SOURCE_DIR}/src/ ${PROJECT_SOURCE_DIR}/include/ -i${PROJECT_BINARY_DIR} -i${PROJECT_SOURCE_DIR}/src/ -i${PROJECT_SOURCE_DIR}/demo/ -i${PROJECT_SOURCE_DIR}/cmake/ external -itest 2> cppcheck-report.xml || (cat cppcheck-report.xml && exit 2)
+        COMMAND ${CPPCHECK_EXECUTABLE} --xml --xml-version=2 --enable=warning,performance,style --error-exitcode=1 --suppressions-list=${PROJECT_SOURCE_DIR}/test/cppcheck/suppressions-list.txt -UNN_EXPORT ${PROJECT_SOURCE_DIR}/src/ ${PROJECT_SOURCE_DIR}/include/ -i${PROJECT_BINARY_DIR} -i${PROJECT_SOURCE_DIR}/demo/ -i${PROJECT_SOURCE_DIR}/microbench/ -i${PROJECT_SOURCE_DIR}/cmake/ external -itest 2> cppcheck-report.xml || (cat cppcheck-report.xml && exit 2)
 )


Improve cmake build behaviour with non-host cpu targets (#2246)

1. Supply appropriate values for C/Z GEMM unroll when cross-compiling for CORE2 or ARMV7
2. Add the required xLOCAL_BUFFER_SIZE parameters for cross-compiling CORE2
3. Add -DFORCE_<target> option to getarch when building with -DTARGET=target
for #2245

--- cmake/prebuild.cmake
+++ cmake/prebuild.cmake
@@ -105,6 +105,7 @@
   # Perhaps this should be inside a different file as it grows larger
   file(APPEND ${TARGET_CONF_TEMP}
     "#define ${TCORE}\n"
+    "#define CORE_${TCORE}\n"
     "#define CHAR_CORENAME \"${TCORE}\"\n")
   if ("${TCORE}" STREQUAL "CORE2")
     file(APPEND ${TARGET_CONF_TEMP}
@@ -119,15 +120,19 @@
       "#define HAVE_SSE\n"
       "#define HAVE_SSE2\n"
       "#define HAVE_SSE3\n"
-      "#define HAVE_SSSE3\n")
+      "#define HAVE_SSSE3\n"
+      "#define SLOCAL_BUFFER_SIZE\t16384\n"
+      "#define DLOCAL_BUFFER_SIZE\t16384\n"
+      "#define CLOCAL_BUFFER_SIZE\t16384\n"
+      "#define ZLOCAL_BUFFER_SIZE\t16384\n")
       set(SGEMM_UNROLL_M 8)
       set(SGEMM_UNROLL_N 4)
       set(DGEMM_UNROLL_M 4)
       set(DGEMM_UNROLL_N 4)
-      set(CGEMM_DEFAULT_UNROLL_M 4)
-      set(CGEMM_DEFAULT_UNROLL_N 2)
-      set(ZGEMM_DEFAULT_UNROLL_M 2)
-      set(ZGEMM_DEFAULT_UNROLL_N 2)
+      set(CGEMM_UNROLL_M 4)
+      set(CGEMM_UNROLL_N 2)
+      set(ZGEMM_UNROLL_M 2)
+      set(ZGEMM_UNROLL_N 2)
   elseif ("${TCORE}" STREQUAL "ARMV7")
     file(APPEND ${TARGET_CONF_TEMP}
       "#define L1_DATA_SIZE\t65536\n"
@@ -143,6 +148,10 @@
     set(SGEMM_UNROLL_N 4)
     set(DGEMM_UNROLL_M 4)
     set(DGEMM_UNROLL_N 4)
+    set(CGEMM_UNROLL_M 2)
+    set(CGEMM_UNROLL_N 2)
+    set(ZGEMM_UNROLL_M 2)
+    set(ZGEMM_UNROLL_N 2)
   elseif ("${TCORE}" STREQUAL "ARMV8")
     file(APPEND ${TARGET_CONF_TEMP}
       "#define L1_DATA_SIZE\t32768\n"
@@ -331,6 +340,9 @@
     set(GETARCH_FLAGS ${GETARCH_FLAGS} -DFORCE_GENERIC)
   else()
     list(APPEND GETARCH_SRC ${PROJECT_SOURCE_DIR}/cpuid.S)
+    if (DEFINED TARGET_CORE)
+    set(GETARCH_FLAGS ${GETARCH_FLAGS} -DFORCE_${TARGET_CORE})
+  endif ()
   endif ()

   if ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore")


Fix regression.

Fix regression.

--- config/Hiredis.cmake
+++ config/Hiredis.cmake
@@ -1,5 +1,5 @@
 set (DOWNLOAD_DIR ${DOWNLOAD_DIR}/hiredis)
-if (NOT HIREDIS_INCLUDED AND DOWNLOAD_EXTERNALS)
+set (HIREDIS_INCLUDED ON CACHE INTERNAL "" FORCE)

 if (NOT HIREDIS_INCLUDED AND DOWNLOAD_EXTERNALS)


Add style testing to Python test directory

--- plugin.cmake
+++ plugin.cmake
@@ -18,6 +18,10 @@
   python_static_analysis_large_image
   "${CMAKE_CURRENT_LIST_DIR}/server"
 )
+add_python_style_test(
+  python_static_analysis_large_image_tests
+  "${CMAKE_CURRENT_LIST_DIR}/plugin_tests"
+)

 add_eslint_test(
   js_static_analysis_large_image_gruntfile


Update CMake/Android toolchain file to support NDK r11c. [ci only: Android] [skip appveyor]

--- CMake/Toolchains/android.toolchain.cmake
+++ CMake/Toolchains/android.toolchain.cmake
@@ -29,7 +29,7 @@
 # POSSIBILITY OF SUCH DAMAGE.

 # ------------------------------------------------------------------------------
-#  Android CMake toolchain file, for use with the Android NDK r5-r10e
+#  Android CMake toolchain file, for use with the Android NDK r5-r11c
 #  Requires cmake 2.6.3 or newer (2.8.9 or newer is recommended).
 #  See home page: https://github.com/taka-no-me/android-cmake
 #
@@ -224,7 +224,7 @@
 set( CMAKE_SKIP_RPATH TRUE CACHE BOOL "If set, runtime paths are not added when using shared libraries." )

 # NDK search paths
-set( ANDROID_SUPPORTED_NDK_VERSIONS ${ANDROID_EXTRA_NDK_VERSIONS} -r10e -r10d -r10c -r10b -r10 -r9d -r9c -r9b -r9 -r8e -r8d -r8c -r8b -r8 -r7c -r7b -r7 -r6b -r6 -r5c -r5b -r5 "" )
+set( ANDROID_SUPPORTED_NDK_VERSIONS ${ANDROID_EXTRA_NDK_VERSIONS} -r11c -r11b -r11 -r10e -r10d -r10c -r10b -r10 -r9d -r9c -r9b -r9 -r8e -r8d -r8c -r8b -r8 -r7c -r7b -r7 -r6b -r6 -r5c -r5b -r5 "" )
 if( NOT DEFINED ANDROID_NDK_SEARCH_PATHS )
  if( CMAKE_HOST_WIN32 )
   file( TO_CMAKE_PATH "$ENV{PROGRAMFILES}" ANDROID_NDK_SEARCH_PATHS )
@@ -1743,7 +1743,7 @@
 #   BUILD_WITH_STANDALONE_TOOLCHAIN : TRUE if standalone toolchain is used
 #   ANDROID_NDK_HOST_SYSTEM_NAME : "windows", "linux-x86" or "darwin-x86" depending on host platform
 #   ANDROID_NDK_ABI_NAME : "armeabi", "armeabi-v7a", "x86", "mips", "arm64-v8a", "x86_64", "mips64" depending on ANDROID_ABI
-#   ANDROID_NDK_RELEASE : from r5 to r10e; set only for NDK
+#   ANDROID_NDK_RELEASE : from r5 to r11c; set only for NDK
 #   ANDROID_NDK_RELEASE_NUM : numeric ANDROID_NDK_RELEASE version (1000*major+minor)
 #   ANDROID_ARCH_NAME : "arm", "x86", "mips", "arm64", "x86_64", "mips64" depending on ANDROID_ABI
 #   ANDROID_SYSROOT : path to the compiler sysroot


BUG: fix findNumpy.cmake by taking into account the name change of the Python executable cmake variable in cmake 3.12