Remove FindSFML.cmake, as we no longer need it

--- cmake/FindSFML.cmake
+++ cmake/FindSFML.cmake
@@ -1,368 +0,0 @@
-#Copied from https://raw.githubusercontent.com/SFML/SFML/master/cmake/Modules/FindSFML.cmake
-
-# This script locates the SFML library
-# ------------------------------------
-#
-# Usage
-# -----
-#
-# When you try to locate the SFML libraries, you must specify which modules you want to use (system, window, graphics, network, audio, main).
-# If none is given, the SFML_LIBRARIES variable will be empty and you'll end up linking to nothing.
-# example:
-#   find_package(SFML COMPONENTS graphics window system) # find the graphics, window and system modules
-#
-# You can enforce a specific version, either MAJOR.MINOR or only MAJOR.
-# If nothing is specified, the version won't be checked (i.e. any version will be accepted).
-# example:
-#   find_package(SFML COMPONENTS ...)     # no specific version required
-#   find_package(SFML 2 COMPONENTS ...)   # any 2.x version
-#   find_package(SFML 2.4 COMPONENTS ...) # version 2.4 or greater
-#
-# By default, the dynamic libraries of SFML will be found. To find the static ones instead,
-# you must set the SFML_STATIC_LIBRARIES variable to TRUE before calling find_package(SFML ...).
-# Since you have to link yourself all the SFML dependencies when you link it statically, the following
-# additional variables are defined: SFML_XXX_DEPENDENCIES and SFML_DEPENDENCIES (see their detailed
-# description below).
-# In case of static linking, the SFML_STATIC macro will also be defined by this script.
-# example:
-#   set(SFML_STATIC_LIBRARIES TRUE)
-#   find_package(SFML 2 COMPONENTS network system)
-#
-# On Mac OS X if SFML_STATIC_LIBRARIES is not set to TRUE then by default CMake will search for frameworks unless
-# CMAKE_FIND_FRAMEWORK is set to "NEVER" for example. Please refer to CMake documentation for more details.
-# Moreover, keep in mind that SFML frameworks are only available as release libraries unlike dylibs which
-# are available for both release and debug modes.
-#
-# If SFML is not installed in a standard path, you can use the SFML_ROOT CMake (or environment) variable
-# to tell CMake where SFML is.
-#
-# Output
-# ------
-#
-# This script defines the following variables:
-# - For each specified module XXX (system, window, graphics, network, audio, main):
-#   - SFML_XXX_LIBRARY_DEBUG:   the name of the debug library of the xxx module (set to SFML_XXX_LIBRARY_RELEASE is no debug version is found)
-#   - SFML_XXX_LIBRARY_RELEASE: the name of the release library of the xxx module (set to SFML_XXX_LIBRARY_DEBUG is no release version is found)
-#   - SFML_XXX_LIBRARY:         the name of the library to link to for the xxx module (includes both debug and optimized names if necessary)
-#   - SFML_XXX_FOUND:           true if either the debug or release library of the xxx module is found
-#   - SFML_XXX_DEPENDENCIES:    the list of libraries the module depends on, in case of static linking
-# - SFML_LIBRARIES:    the list of all libraries corresponding to the required modules
-# - SFML_FOUND:        true if all the required modules are found
-# - SFML_INCLUDE_DIR:  the path where SFML headers are located (the directory containing the SFML/Config.hpp file)
-# - SFML_DEPENDENCIES: the list of libraries SFML depends on, in case of static linking
-#
-# example:
-#   find_package(SFML 2 COMPONENTS system window graphics audio REQUIRED)
-#   include_directories(${SFML_INCLUDE_DIR})
-#   add_executable(myapp ...)
-#   target_link_libraries(myapp ${SFML_LIBRARIES})
-
-# define the SFML_STATIC macro if static build was chosen
-if(SFML_STATIC_LIBRARIES)
-    add_definitions(-DSFML_STATIC)
-endif()
-
-# define the list of search paths for headers and libraries
-set(FIND_SFML_PATHS
-    ${SFML_ROOT}
-    $ENV{SFML_ROOT}
-    ~/Library/Frameworks
-    /Library/Frameworks
-    /usr/local
-    /usr
-    /sw
-    /opt/local
-    /opt/csw
-    /opt)
-
-# find the SFML include directory
-find_path(SFML_INCLUDE_DIR SFML/Config.hpp
-          PATH_SUFFIXES include
-          PATHS ${FIND_SFML_PATHS})
-
-# check the version number
-set(SFML_VERSION_OK TRUE)
-if(SFML_FIND_VERSION AND SFML_INCLUDE_DIR)
-    # extract the major and minor version numbers from SFML/Config.hpp
-    # we have to handle framework a little bit differently:
-    if("${SFML_INCLUDE_DIR}" MATCHES "SFML.framework")
-        set(SFML_CONFIG_HPP_INPUT "${SFML_INCLUDE_DIR}/Headers/Config.hpp")
-    else()
-        set(SFML_CONFIG_HPP_INPUT "${SFML_INCLUDE_DIR}/SFML/Config.hpp")
-    endif()
-    FILE(READ "${SFML_CONFIG_HPP_INPUT}" SFML_CONFIG_HPP_CONTENTS)
-    STRING(REGEX REPLACE ".*#define SFML_VERSION_MAJOR ([0-9]+).*" "\\1" SFML_VERSION_MAJOR "${SFML_CONFIG_HPP_CONTENTS}")
-    STRING(REGEX REPLACE ".*#define SFML_VERSION_MINOR ([0-9]+).*" "\\1" SFML_VERSION_MINOR "${SFML_CONFIG_HPP_CONTENTS}")
-    STRING(REGEX REPLACE ".*#define SFML_VERSION_PATCH ([0-9]+).*" "\\1" SFML_VERSION_PATCH "${SFML_CONFIG_HPP_CONTENTS}")
-    if (NOT "${SFML_VERSION_PATCH}" MATCHES "^[0-9]+$")
-        set(SFML_VERSION_PATCH 0)
-    endif()
-    math(EXPR SFML_REQUESTED_VERSION "${SFML_FIND_VERSION_MAJOR} * 10000 + ${SFML_FIND_VERSION_MINOR} * 100 + ${SFML_FIND_VERSION_PATCH}")
-
-    # if we could extract them, compare with the requested version number
-    if (SFML_VERSION_MAJOR)
-        # transform version numbers to an integer
-        math(EXPR SFML_VERSION "${SFML_VERSION_MAJOR} * 10000 + ${SFML_VERSION_MINOR} * 100 + ${SFML_VERSION_PATCH}")
-
-        # compare them
-        if(SFML_VERSION LESS SFML_REQUESTED_VERSION)
-            set(SFML_VERSION_OK FALSE)
-        endif()
-    else()
-        # SFML version is < 2.0
-        if (SFML_REQUESTED_VERSION GREATER 10900)
-            set(SFML_VERSION_OK FALSE)
-            set(SFML_VERSION_MAJOR 1)
-            set(SFML_VERSION_MINOR x)
-            set(SFML_VERSION_PATCH x)
-        endif()
-    endif()
-endif()
-
-# find the requested modules
-set(SFML_FOUND TRUE) # will be set to false if one of the required modules is not found
-foreach(FIND_SFML_COMPONENT ${SFML_FIND_COMPONENTS})
-    string(TOLOWER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_LOWER)
-    string(TOUPPER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_UPPER)
-    set(FIND_SFML_COMPONENT_NAME sfml-${FIND_SFML_COMPONENT_LOWER})
-
-    # no suffix for sfml-main, it is always a static library
-    if(FIND_SFML_COMPONENT_LOWER STREQUAL "main")
-        # release library
-        find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE
-                     NAMES ${FIND_SFML_COMPONENT_NAME}
-                     PATH_SUFFIXES lib64 lib
-                     PATHS ${FIND_SFML_PATHS})
-
-        # debug library
-        find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG
-                     NAMES ${FIND_SFML_COMPONENT_NAME}-d
-                     PATH_SUFFIXES lib64 lib
-                     PATHS ${FIND_SFML_PATHS})
-    else()
-        # static release library
-        find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_RELEASE
-                     NAMES ${FIND_SFML_COMPONENT_NAME}-s
-                     PATH_SUFFIXES lib64 lib
-                     PATHS ${FIND_SFML_PATHS})
-
-        # static debug library
-        find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_DEBUG
-                     NAMES ${FIND_SFML_COMPONENT_NAME}-s-d
-                     PATH_SUFFIXES lib64 lib
-                     PATHS ${FIND_SFML_PATHS})
-
-        # dynamic release library
-        find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_RELEASE
-                     NAMES ${FIND_SFML_COMPONENT_NAME}
-                     PATH_SUFFIXES lib64 lib
-                     PATHS ${FIND_SFML_PATHS})
-
-        # dynamic debug library
-        find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_DEBUG
-                     NAMES ${FIND_SFML_COMPONENT_NAME}-d
-                     PATH_SUFFIXES lib64 lib
-                     PATHS ${FIND_SFML_PATHS})
-
-        # choose the entries that fit the requested link type
-        if(SFML_STATIC_LIBRARIES)
-            if(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_RELEASE)
-                set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_RELEASE})
-            endif()
-            if(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_DEBUG)
-                set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_DEBUG})
-            endif()
-        else()
-            if(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_RELEASE)
-                set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_RELEASE})
-            endif()
-            if(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_DEBUG)
-                set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_DEBUG})
-            endif()
-        endif()
-    endif()
-
-    if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG OR SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE)
-        # library found
-        set(SFML_${FIND_SFML_COMPONENT_UPPER}_FOUND TRUE)
-
-        # if both are found, set SFML_XXX_LIBRARY to contain both
-        if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG AND SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE)
-            set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY debug     ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG}
-                                                          optimized ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE})
-        endif()
-
-        # if only one debug/release variant is found, set the other to be equal to the found one
-        if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG AND NOT SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE)
-            # debug and not release
-            set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG})
-            set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY         ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG})
-        endif()
-        if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE AND NOT SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG)
-            # release and not debug
-            set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE})
-            set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY       ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE})
-        endif()
-    else()
-        # library not found
-        set(SFML_FOUND FALSE)
-        set(SFML_${FIND_SFML_COMPONENT_UPPER}_FOUND FALSE)
-        set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY "")
-        set(FIND_SFML_MISSING "${FIND_SFML_MISSING} SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY")
-    endif()
-
-    # mark as advanced
-    MARK_AS_ADVANCED(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY
-                     SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE
-                     SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG
-                     SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_RELEASE
-                     SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_DEBUG
-                     SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_RELEASE
-                     SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_DEBUG)
-
-    # add to the global list of libraries
-    set(SFML_LIBRARIES ${SFML_LIBRARIES} "${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY}")
-endforeach()
-
-# in case of static linking, we must also define the list of all the dependencies of SFML libraries
-if(SFML_STATIC_LIBRARIES)
-
-    # detect the OS
-    if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
-        set(FIND_SFML_OS_WINDOWS 1)
-    elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
-        set(FIND_SFML_OS_LINUX 1)
-    elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
-        set(FIND_SFML_OS_FREEBSD 1)
-    elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
-        set(FIND_SFML_OS_MACOSX 1)
-    endif()
-
-    # start with an empty list
-    set(SFML_DEPENDENCIES)
-    set(FIND_SFML_DEPENDENCIES_NOTFOUND)
-
-    # macro that searches for a 3rd-party library
-    macro(find_sfml_dependency output friendlyname)
-        # No lookup in environment variables (PATH on Windows), as they may contain wrong library versions
-        find_library(${output} NAMES ${ARGN} PATHS ${FIND_SFML_PATHS} PATH_SUFFIXES lib NO_SYSTEM_ENVIRONMENT_PATH)
-        if(${${output}} STREQUAL "${output}-NOTFOUND")
-            unset(output)
-            set(FIND_SFML_DEPENDENCIES_NOTFOUND "${FIND_SFML_DEPENDENCIES_NOTFOUND} ${friendlyname}")
-        endif()
-    endmacro()
-
-    # sfml-system
-    list(FIND SFML_FIND_COMPONENTS "system" FIND_SFML_SYSTEM_COMPONENT)
-    if(NOT ${FIND_SFML_SYSTEM_COMPONENT} EQUAL -1)
-
-        # update the list -- these are only system libraries, no need to find them
-        if(FIND_SFML_OS_LINUX OR FIND_SFML_OS_FREEBSD OR FIND_SFML_OS_MACOSX)
-            set(SFML_SYSTEM_DEPENDENCIES "pthread")
-        endif()
-        if(FIND_SFML_OS_LINUX)
-            set(SFML_SYSTEM_DEPENDENCIES ${SFML_SYSTEM_DEPENDENCIES} "rt")
-        endif()
-        if(FIND_SFML_OS_WINDOWS)
-            set(SFML_SYSTEM_DEPENDENCIES "winmm")
-        endif()
-        set(SFML_DEPENDENCIES ${SFML_SYSTEM_DEPENDENCIES} ${SFML_DEPENDENCIES})
-    endif()
-
-    # sfml-network
-    list(FIND SFML_FIND_COMPONENTS "network" FIND_SFML_NETWORK_COMPONENT)
-    if(NOT ${FIND_SFML_NETWORK_COMPONENT} EQUAL -1)
-
-        # update the list -- these are only system libraries, no need to find them
-        if(FIND_SFML_OS_WINDOWS)
-            set(SFML_NETWORK_DEPENDENCIES "ws2_32")
-        endif()
-        set(SFML_DEPENDENCIES ${SFML_NETWORK_DEPENDENCIES} ${SFML_DEPENDENCIES})
-    endif()
-
-    # sfml-window
-    list(FIND SFML_FIND_COMPONENTS "window" FIND_SFML_WINDOW_COMPONENT)
-    if(NOT ${FIND_SFML_WINDOW_COMPONENT} EQUAL -1)
-
-        # find libraries
-        if(FIND_SFML_OS_LINUX OR FIND_SFML_OS_FREEBSD)
-            find_sfml_dependency(X11_LIBRARY "X11" X11)
-            find_sfml_dependency(XRANDR_LIBRARY "Xrandr" Xrandr)
-        endif()
-
-        if(FIND_SFML_OS_LINUX)
-            find_sfml_dependency(UDEV_LIBRARIES "UDev" udev libudev)
-        endif()
-
-        # update the list
-        if(FIND_SFML_OS_WINDOWS)
-            set(SFML_WINDOW_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} "opengl32" "winmm" "gdi32")
-        elseif(FIND_SFML_OS_LINUX)
-            set(SFML_WINDOW_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} "GL" ${X11_LIBRARY} ${XRANDR_LIBRARY} ${UDEV_LIBRARIES})
-        elseif(FIND_SFML_OS_FREEBSD)
-            set(SFML_WINDOW_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} "GL" ${X11_LIBRARY} ${XRANDR_LIBRARY} "usbhid")
-        elseif(FIND_SFML_OS_MACOSX)
-            set(SFML_WINDOW_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} "-framework OpenGL -framework Foundation -framework AppKit -framework IOKit -framework Carbon")
-        endif()
-        set(SFML_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} ${SFML_DEPENDENCIES})
-    endif()
-
-    # sfml-graphics
-    list(FIND SFML_FIND_COMPONENTS "graphics" FIND_SFML_GRAPHICS_COMPONENT)
-    if(NOT ${FIND_SFML_GRAPHICS_COMPONENT} EQUAL -1)
-
-        # find libraries
-        find_sfml_dependency(FREETYPE_LIBRARY "FreeType" freetype)
-        find_sfml_dependency(JPEG_LIBRARY "libjpeg" jpeg)
-
-        # update the list
-        set(SFML_GRAPHICS_DEPENDENCIES ${FREETYPE_LIBRARY} ${JPEG_LIBRARY})
-        set(SFML_DEPENDENCIES ${SFML_GRAPHICS_DEPENDENCIES} ${SFML_DEPENDENCIES})
-    endif()
-
-    # sfml-audio
-    list(FIND SFML_FIND_COMPONENTS "audio" FIND_SFML_AUDIO_COMPONENT)
-    if(NOT ${FIND_SFML_AUDIO_COMPONENT} EQUAL -1)
-
-        # find libraries
-        find_sfml_dependency(OPENAL_LIBRARY "OpenAL" openal openal32)
-        find_sfml_dependency(OGG_LIBRARY "Ogg" ogg)
-        find_sfml_dependency(VORBIS_LIBRARY "Vorbis" vorbis)
-        find_sfml_dependency(VORBISFILE_LIBRARY "VorbisFile" vorbisfile)
-        find_sfml_dependency(VORBISENC_LIBRARY "VorbisEnc" vorbisenc)
-        find_sfml_dependency(FLAC_LIBRARY "FLAC" FLAC)
-
-        # update the list
-        set(SFML_AUDIO_DEPENDENCIES ${OPENAL_LIBRARY} ${FLAC_LIBRARY} ${VORBISENC_LIBRARY} ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY} ${OGG_LIBRARY})
-        set(SFML_DEPENDENCIES ${SFML_DEPENDENCIES} ${SFML_AUDIO_DEPENDENCIES})
-    endif()
-
-endif()
-
-# handle errors
-if(NOT SFML_VERSION_OK)
-    # SFML version not ok
-    set(FIND_SFML_ERROR "SFML found but version too low (requested: ${SFML_FIND_VERSION}, found: ${SFML_VERSION_MAJOR}.${SFML_VERSION_MINOR}.${SFML_VERSION_PATCH})")
-    set(SFML_FOUND FALSE)
-elseif(SFML_STATIC_LIBRARIES AND FIND_SFML_DEPENDENCIES_NOTFOUND)
-    set(FIND_SFML_ERROR "SFML found but some of its dependencies are missing (${FIND_SFML_DEPENDENCIES_NOTFOUND})")
-    set(SFML_FOUND FALSE)
-elseif(NOT SFML_FOUND)
-    # include directory or library not found
-    set(FIND_SFML_ERROR "Could NOT find SFML (missing: ${FIND_SFML_MISSING})")
-endif()
-if (NOT SFML_FOUND)
-    if(SFML_FIND_REQUIRED)
-        # fatal error
-        message(FATAL_ERROR ${FIND_SFML_ERROR})
-    elseif(NOT SFML_FIND_QUIETLY)
-        # error but continue
-        message("${FIND_SFML_ERROR}")
-    endif()
-endif()
-
-# handle success
-if(SFML_FOUND AND NOT SFML_FIND_QUIETLY)
-    message(STATUS "Found SFML ${SFML_VERSION_MAJOR}.${SFML_VERSION_MINOR}.${SFML_VERSION_PATCH} in ${SFML_INCLUDE_DIR}")
-endif()
-


Better check for compiler flags.

Better check for compiler flags.

Compiler flags will now be searched language independend.
A build type named "coverage" is now available.

--- cmake/Findgcov.cmake
+++ cmake/Findgcov.cmake
@@ -6,33 +6,81 @@
 include(FindPackageHandleStandardArgs)

-# search for gcov
-find_program(GCOV_BIN gcov)
+#
+# check for coverage compiler flags
+#
+set(CMAKE_REQUIRED_FLAGS "--coverage")

-# check if compiler accepts
-set(CMAKE_REQUIRED_FLAGS "-fprofile-arcs -ftest-coverage")
+# check for compile flags
+foreach (LANG C CXX)
+	if (CMAKE_${LANG}_COMPILER_LOADED)
+		if (${LANG} STREQUAL C)
+			check_c_compiler_flag("-g -O0 --coverage" HAVE_COVERAGE_C)
+		elseif (${LANG} STREQUAL CXX)
+			check_cxx_compiler_flag("-g -O0 --coverage" HAVE_COVERAGE_CXX)
+		endif()

-# check for C
-check_c_compiler_flag("-fprofile-arcs -ftest-coverage" C_COMPILER_HAVE_GCOV)
-if (C_COMPILER_HAVE_GCOV)
-	set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} "-fprofile-arcs -ftest-coverage")
+		if (HAVE_COVERAGE_${LANG})
+			set(CMAKE_${LANG}_FLAGS_COVERAGE
+				"-g -O0 --coverage"
+				CACHE
+				STRING "Flags used by the ${LANG} compiler during coverage builds."
+			)
+			mark_as_advanced(CMAKE_${LANG}_FLAGS_COVERAGE)
+		endif (HAVE_COVERAGE_${LANG})
+	endif (CMAKE_${LANG}_COMPILER_LOADED)
+endforeach()
+
+# set linker flags
+if (HAVE_COVERAGE_C OR HAVE_COVERAGE_CXX)
+	set(CMAKE_EXE_LINKER_FLAGS_COVERAGE
+		"--coverage"
+		CACHE
+		STRING "Flags used for linking binaries during coverage builds."
+	)
+
+	set(CMAKE_MODULE_LINKER_FLAGS_COVERAGE
+		"--coverage"
+		CACHE
+		STRING "Flags used for linking modules during coverage builds."
+	)
+
+	set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE
+		"--coverage"
+		CACHE
+		STRING "Flags used for linking shared libraries during coverage builds."
+	)
+
+	set(CMAKE_STATIC_LINKER_FLAGS_COVERAGE
+		"--coverage"
+		CACHE
+		STRING "Flags used for linking static libraries during coverage builds."
+	)
+
+	mark_as_advanced(
+		CMAKE_EXE_LINKER_FLAGS_COVERAGE
+		CMAKE_MODULE_LINKER_FLAGS_COVERAGE
+		CMAKE_SHARED_LINKER_FLAGS_COVERAGE
+		CMAKE_STATIC_LINKER_FLAGS_COVERAGE
+	)
 endif ()
-
-# check for CXX
-check_cxx_compiler_flag("-fprofile-arcs -ftest-coverage" CXX_COMPILER_HAVE_GCOV)
-if (CXX_COMPILER_HAVE_GCOV)
-	set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-fprofile-arcs -ftest-coverage")
-endif ()
-
-find_package_handle_standard_args(gcov REQUIRED_VARS GCOV_BIN CMAKE_C_FLAGS)
-

 #
 # collect gcov information for target
 #
+
+# search for gcov
+find_program(GCOV_BIN gcov)
+
 function(add_coverage TARGET)
+	# enable coverage for target
+	set_target_properties(${TARGET} PROPERTIES
+		COMPILE_FLAGS "-g -O0 --coverage"
+		LINK_FLAGS "--coverage"
+	)
+
 	set(TARGET_DIR ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TARGET}.dir)

 	get_target_property(TARGET_SOURCES ${TARGET} SOURCES)


Binutils before 2.21 does not support AVX2

Thanks to Pere Mato Vila <Pere.Mato@cern.ch> for the patch.

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

--- cmake/VcMacros.cmake
+++ cmake/VcMacros.cmake
@@ -162,8 +162,9 @@
          set(Vc_XOP_INTRINSICS_BROKEN true)
          set(Vc_FMA4_INTRINSICS_BROKEN true)
       elseif(_as_version VERSION_LESS "2.21.0")
-         UserWarning("Your binutils is too old (${_as_version}) for XOP instructions. They will therefore not be provided in libVc.")
+         UserWarning("Your binutils is too old (${_as_version}) for XOP and AVX2 instructions. They will therefore not be provided in libVc.")
          set(Vc_XOP_INTRINSICS_BROKEN true)
+         set(Vc_AVX2_INTRINSICS_BROKEN true)
       endif()
    endif()
 endmacro()


cmake: Fix unexpected token after &

cmake: Fix unexpected token after &

In bash a '&&' cannot follow directly after a '&'. So a task that is
run in the background should be enclosed in (curly) braces.

This:
```
west build -b qemu_x86 -d build/server samples/net/sockets/echo_server\
 -- -DOVERLAY_CONFIG=overlay-qemu_802154.conf -DPCAP=capture.pcap
west build -t server -d build/server
```
works correctly after this fix.

Fixes #29793

Signed-off-by: Daniel Noom <5934dbcaa6dbb04268ae8f31aa3b027545deac57@outlook.com>

--- cmake/emu/qemu.cmake
+++ cmake/emu/qemu.cmake
@@ -226,11 +226,17 @@
     set_ifndef(NET_TOOLS ${ZEPHYR_BASE}/../net-tools) # Default if not set

     list(APPEND PRE_QEMU_COMMANDS_FOR_server
-      COMMAND ${NET_TOOLS}/monitor_15_4
-  ${PCAP}
-  /tmp/ip-stack-server
+      COMMAND
+      #This command is run in the background using '&'. This prevents
+      #chaining other commands with '&&'. The command is enclosed in '{}'
+      #to fix this.
+      {
+      ${NET_TOOLS}/monitor_15_4
+      ${PCAP}
+      /tmp/ip-stack-server
       /tmp/ip-stack-client
       > /dev/null &
+      }
       # TODO: Support cleanup of the monitor_15_4 process
       )
   endif()


Add more x86_64 target definitions for cross-compiling

--- cmake/prebuild.cmake
+++ cmake/prebuild.cmake
@@ -131,6 +131,8 @@
       set(HAVE_SSE2 1)
       set(HAVE_SSE3 1)
       set(HAVE_SSSE3 1)
+      set(SBGEMM_UNROLL_M 8)
+      set(SBGEMM_UNROLL_N 4)
       set(SGEMM_UNROLL_M 8)
       set(SGEMM_UNROLL_N 4)
       set(DGEMM_UNROLL_M 4)
@@ -138,6 +140,684 @@
       set(CGEMM_UNROLL_M 4)
       set(CGEMM_UNROLL_N 2)
       set(ZGEMM_UNROLL_M 2)
+      set(ZGEMM_UNROLL_N 2)
+      set(CGEMM3M_UNROLL_M 8)
+      set(CGEMM3M_UNROLL_N 4)
+      set(ZGEMM3M_UNROLL_M 4)
+      set(ZGEMM3M_UNROLL_N 4)
+  elseif ("${TCORE}" STREQUAL "ATOM")
+    file(APPEND ${TARGET_CONF_TEMP}
+      "#define L1_DATA_SIZE\t24576\n"
+      "#define L1_DATA_LINESIZE\t64\n"
+      "#define L2_SIZE\t524288\n"
+      "#define L2_LINESIZE\t64\n"
+      "#define DTB_DEFAULT_ENTRIES\t64\n"
+      "#define DTB_SIZE\t4096\n"
+      "#define HAVE_CMOV\n"
+      "#define HAVE_MMX\n"
+      "#define HAVE_SSE\n"
+      "#define HAVE_SSE2\n"
+      "#define HAVE_SSE3\n"
+      "#define HAVE_SSSE3\n"
+      "#define SLOCAL_BUFFER_SIZE\t16384\n"
+      "#define DLOCAL_BUFFER_SIZE\t8192\n"
+      "#define CLOCAL_BUFFER_SIZE\t16384\n"
+      "#define ZLOCAL_BUFFER_SIZE\t8192\n")
+      set(HAVE_SSE 1)
+      set(HAVE_SSE2 1)
+      set(HAVE_SSE3 1)
+      set(HAVE_SSSE3 1)
+      set(SBGEMM_UNROLL_M 8)
+      set(SBGEMM_UNROLL_N 4)
+      set(SGEMM_UNROLL_M 8)
+      set(SGEMM_UNROLL_N 4)
+      set(DGEMM_UNROLL_M 4)
+      set(DGEMM_UNROLL_N 2)
+      set(CGEMM_UNROLL_M 4)
+      set(CGEMM_UNROLL_N 2)
+      set(ZGEMM_UNROLL_M 2)
+      set(ZGEMM_UNROLL_N 1)
+      set(CGEMM3M_UNROLL_M 8)
+      set(CGEMM3M_UNROLL_N 4)
+      set(ZGEMM3M_UNROLL_M 4)
+      set(ZGEMM3M_UNROLL_N 4)
+  elseif ("${TCORE}" STREQUAL "PRESCOTT")
+    file(APPEND ${TARGET_CONF_TEMP}
+      "#define L1_DATA_SIZE\t16384\n"
+      "#define L1_DATA_LINESIZE\t64\n"
+      "#define L2_SIZE\t1048576\n"
+      "#define L2_LINESIZE\t64\n"
+      "#define DTB_DEFAULT_ENTRIES\t64\n"
+      "#define DTB_SIZE\t4096\n"
+      "#define HAVE_CMOV\n"
+      "#define HAVE_MMX\n"
+      "#define HAVE_SSE\n"
+      "#define HAVE_SSE2\n"
+      "#define HAVE_SSE3\n"
+      "#define SLOCAL_BUFFER_SIZE\t8192\n"
+      "#define DLOCAL_BUFFER_SIZE\t8192\n"
+      "#define CLOCAL_BUFFER_SIZE\t8192\n"
+      "#define ZLOCAL_BUFFER_SIZE\t8192\n")
+      set(HAVE_SSE 1)
+      set(HAVE_SSE2 1)
+      set(HAVE_SSE3 1)
+      set(SBGEMM_UNROLL_M 8)
+      set(SBGEMM_UNROLL_N 4)
+      set(SGEMM_UNROLL_M 8)
+      set(SGEMM_UNROLL_N 4)
+      set(DGEMM_UNROLL_M 4)
+      set(DGEMM_UNROLL_N 4)
+      set(CGEMM_UNROLL_M 4)
+      set(CGEMM_UNROLL_N 2)
+      set(ZGEMM_UNROLL_M 2)
+      set(ZGEMM_UNROLL_N 2)
+      set(CGEMM3M_UNROLL_M 8)
+      set(CGEMM3M_UNROLL_N 4)
+      set(ZGEMM3M_UNROLL_M 4)
+      set(ZGEMM3M_UNROLL_N 4)
+  elseif ("${TCORE}" STREQUAL "NEHALEM")
+    file(APPEND ${TARGET_CONF_TEMP}
+      "#define L1_DATA_SIZE\t32768\n"
+      "#define L1_DATA_LINESIZE\t64\n"
+      "#define L2_SIZE\t262144\n"
+      "#define L2_LINESIZE\t64\n"
+      "#define DTB_DEFAULT_ENTRIES\t64\n"
+      "#define DTB_SIZE\t4096\n"
+      "#define HAVE_CMOV\n"
+      "#define HAVE_MMX\n"
+      "#define HAVE_SSE\n"
+      "#define HAVE_SSE2\n"
+      "#define HAVE_SSE3\n"
+      "#define HAVE_SSSE3\n"
+      "#define HAVE_SSE4_1\n"
+      "#define HAVE_SSE4_2\n"
+      "#define SLOCAL_BUFFER_SIZE\t65535\n"
+      "#define DLOCAL_BUFFER_SIZE\t32768\n"
+      "#define CLOCAL_BUFFER_SIZE\t65536\n"
+      "#define ZLOCAL_BUFFER_SIZE\t32768\n")
+      set(HAVE_SSE 1)
+      set(HAVE_SSE2 1)
+      set(HAVE_SSE3 1)
+      set(HAVE_SSSE3 1)
+      set(HAVE_SSE4_1 1)
+      set(HAVE_SSE4_2 1)
+      set(SBGEMM_UNROLL_M 8)
+      set(SBGEMM_UNROLL_N 4)
+      set(SGEMM_UNROLL_M 4)
+      set(SGEMM_UNROLL_N 8)
+      set(DGEMM_UNROLL_M 2)
+      set(DGEMM_UNROLL_N 8)
+      set(CGEMM_UNROLL_M 2)
+      set(CGEMM_UNROLL_N 4)
+      set(ZGEMM_UNROLL_M 1)
+      set(ZGEMM_UNROLL_N 4)
+      set(CGEMM3M_UNROLL_M 4)
+      set(CGEMM3M_UNROLL_N 8)
+      set(ZGEMM3M_UNROLL_M 2)
+      set(ZGEMM3M_UNROLL_N 8)
+  elseif ("${TCORE}" STREQUAL "SANDYBRIDGE")
+    file(APPEND ${TARGET_CONF_TEMP}
+      "#define L1_DATA_SIZE\t32768\n"
+      "#define L1_DATA_LINESIZE\t64\n"
+      "#define L2_SIZE\t262144\n"
+      "#define L2_LINESIZE\t64\n"
+      "#define DTB_DEFAULT_ENTRIES\t64\n"
+      "#define DTB_SIZE\t4096\n"
+      "#define HAVE_CMOV\n"
+      "#define HAVE_MMX\n"
+      "#define HAVE_SSE\n"
+      "#define HAVE_SSE2\n"
+      "#define HAVE_SSE3\n"
+      "#define HAVE_SSSE3\n"
+      "#define HAVE_SSE4_1\n"
+      "#define HAVE_SSE4_2\n"
+      "#define HAVE_AVX\n"
+      "#define SLOCAL_BUFFER_SIZE\t24576\n"
+      "#define DLOCAL_BUFFER_SIZE\t16384\n"
+      "#define CLOCAL_BUFFER_SIZE\t32768\n"
+      "#define ZLOCAL_BUFFER_SIZE\t24576\n")
+      set(HAVE_SSE 1)
+      set(HAVE_SSE2 1)
+      set(HAVE_SSE3 1)
+      set(HAVE_SSSE3 1)
+      set(HAVE_SSE4_1 1)
+      set(HAVE_SSE4_2 1)
+      set(HAVE_AVX 1)
+      set(SBGEMM_UNROLL_M 8)
+      set(SBGEMM_UNROLL_N 4)
+      set(SGEMM_UNROLL_M 16)
+      set(SGEMM_UNROLL_N 4)
+      set(DGEMM_UNROLL_M 8)
+      set(DGEMM_UNROLL_N 4)
+      set(CGEMM_UNROLL_M 8)
+      set(CGEMM_UNROLL_N 2)
+      set(ZGEMM_UNROLL_M 1)
+      set(ZGEMM_UNROLL_N 4)
+      set(CGEMM3M_UNROLL_M 4)
+      set(CGEMM3M_UNROLL_N 8)
+      set(ZGEMM3M_UNROLL_M 2)
+      set(ZGEMM3M_UNROLL_N 8)
+  elseif ("${TCORE}" STREQUAL "HASWELL")
+    file(APPEND ${TARGET_CONF_TEMP}
+      "#define L1_DATA_SIZE\t32768\n"
+      "#define L1_DATA_LINESIZE\t64\n"
+      "#define L2_SIZE\t262144\n"
+      "#define L2_LINESIZE\t64\n"
+      "#define DTB_DEFAULT_ENTRIES\t64\n"
+      "#define DTB_SIZE\t4096\n"
+      "#define HAVE_CMOV\n"
+      "#define HAVE_MMX\n"
+      "#define HAVE_SSE\n"
+      "#define HAVE_SSE2\n"
+      "#define HAVE_SSE3\n"
+      "#define HAVE_SSSE3\n"
+      "#define HAVE_SSE4_1\n"
+      "#define HAVE_SSE4_2\n"
+      "#define HAVE_AVX\n"
+      "#define HAVE_AVX2\n"
+      "#define HAVE_FMA3\n"
+      "#define SLOCAL_BUFFER_SIZE\t20480\n"
+      "#define DLOCAL_BUFFER_SIZE\t32768\n"
+      "#define CLOCAL_BUFFER_SIZE\t16384\n"
+      "#define ZLOCAL_BUFFER_SIZE\t12288\n")
+      set(HAVE_SSE 1)
+      set(HAVE_SSE2 1)
+      set(HAVE_SSE3 1)
+      set(HAVE_SSSE3 1)
+      set(HAVE_SSE4_1 1)
+      set(HAVE_SSE4_2 1)
+      set(HAVE_AVX 1)
+      set(HAVE_AVX2 1)
+      set(HAVE_FMA3 1)
+      set(SBGEMM_UNROLL_M 8)
+      set(SBGEMM_UNROLL_N 4)
+      set(SGEMM_UNROLL_M 8)
+      set(SGEMM_UNROLL_N 4)
+      set(DGEMM_UNROLL_M 4)
+      set(DGEMM_UNROLL_N 8)
+      set(CGEMM_UNROLL_M 8)
+      set(CGEMM_UNROLL_N 2)
+      set(ZGEMM_UNROLL_M 4)
+      set(ZGEMM_UNROLL_N 2)
+      set(CGEMM3M_UNROLL_M 8)
+      set(CGEMM3M_UNROLL_N 4)
+      set(ZGEMM3M_UNROLL_M 4)
+      set(ZGEMM3M_UNROLL_N 4)
+  elseif ("${TCORE}" STREQUAL "SKYLAKEX")
+    file(APPEND ${TARGET_CONF_TEMP}
+      "#define L1_DATA_SIZE\t32768\n"
+      "#define L1_DATA_LINESIZE\t64\n"
+      "#define L2_SIZE\t262144\n"
+      "#define L2_LINESIZE\t64\n"
+      "#define DTB_DEFAULT_ENTRIES\t64\n"
+      "#define DTB_SIZE\t4096\n"
+      "#define HAVE_CMOV\n"
+      "#define HAVE_MMX\n"
+      "#define HAVE_SSE\n"
+      "#define HAVE_SSE2\n"
+      "#define HAVE_SSE3\n"
+      "#define HAVE_SSSE3\n"
+      "#define HAVE_SSE4_1\n"
+      "#define HAVE_SSE4_2\n"
+      "#define HAVE_AVX\n"
+      "#define HAVE_AVX2\n"
+      "#define HAVE_FMA3\n"
+      "#define HAVE_AVX512VL\n"
+      "#define SLOCAL_BUFFER_SIZE\t28672\n"
+      "#define DLOCAL_BUFFER_SIZE\t12288\n"
+      "#define CLOCAL_BUFFER_SIZE\t12288\n"
+      "#define ZLOCAL_BUFFER_SIZE\t8192\n")
+      set(HAVE_CMOV 1)
+      set(HAVE_MMX 1)
+      set(HAVE_SSE 1)
+      set(HAVE_SSE2 1)
+      set(HAVE_SSE3 1)
+      set(HAVE_SSSE3 1)
+      set(HAVE_SSE4_1 1)
+      set(HAVE_SSE4_2 1)
+      set(HAVE_AVX 1)
+      set(HAVE_AVX2 1)
+      set(HAVE_FMA3 1)
+      set(HAVE_AVX512VL 1)
+      set(SBGEMM_UNROLL_M 8)
+      set(SBGEMM_UNROLL_N 4)
+      set(SGEMM_UNROLL_M 16)
+      set(SGEMM_UNROLL_N 4)
+      set(DGEMM_UNROLL_M 16)
+      set(DGEMM_UNROLL_N 2)
+      set(CGEMM_UNROLL_M 8)
+      set(CGEMM_UNROLL_N 2)
+      set(ZGEMM_UNROLL_M 4)
+      set(ZGEMM_UNROLL_N 2)
+      set(CGEMM3M_UNROLL_M 8)
+      set(CGEMM3M_UNROLL_N 4)
+      set(ZGEMM3M_UNROLL_M 4)
+      set(ZGEMM3M_UNROLL_N 4)
+  elseif ("${TCORE}" STREQUAL "COOPERLAKE")
+    file(APPEND ${TARGET_CONF_TEMP}
+      "#define L1_DATA_SIZE\t32768\n"
+      "#define L1_DATA_LINESIZE\t64\n"
+      "#define L2_SIZE\t262144\n"
+      "#define L2_LINESIZE\t64\n"
+      "#define DTB_DEFAULT_ENTRIES\t64\n"
+      "#define DTB_SIZE\t4096\n"
+      "#define HAVE_CMOV\n"
+      "#define HAVE_MMX\n"
+      "#define HAVE_SSE\n"
+      "#define HAVE_SSE2\n"
+      "#define HAVE_SSE3\n"
+      "#define HAVE_SSSE3\n"
+      "#define HAVE_SSE4_1\n"
+      "#define HAVE_SSE4_2\n"
+      "#define HAVE_AVX\n"
+      "#define HAVE_AVX2\n"
+      "#define HAVE_FMA3\n"
+      "#define HAVE_AVX512VL\n"
+      "#define HAVE_AVX512BF16\n"
+      "#define SLOCAL_BUFFER_SIZE\t20480\n"
+      "#define DLOCAL_BUFFER_SIZE\t12288\n"
+      "#define CLOCAL_BUFFER_SIZE\t12288\n"
+      "#define ZLOCAL_BUFFER_SIZE\t8192\n")
+      set(HAVE_CMOV 1)
+      set(HAVE_MMX 1)
+      set(HAVE_SSE 1)
+      set(HAVE_SSE2 1)
+      set(HAVE_SSE3 1)
+      set(HAVE_SSSE3 1)
+      set(HAVE_SSE4_1 1)
+      set(HAVE_SSE4_2 1)
+      set(HAVE_AVX 1)
+      set(HAVE_AVX2 1)
+      set(HAVE_FMA3 1)
+      set(HAVE_AVX512VL 1)
+      set(HAVE_AVX512BF16 1)
+      set(SBGEMM_UNROLL_M 16)
+      set(SBGEMM_UNROLL_N 4)
+      set(SGEMM_UNROLL_M 16)
+      set(SGEMM_UNROLL_N 4)
+      set(DGEMM_UNROLL_M 16)
+      set(DGEMM_UNROLL_N 2)
+      set(CGEMM_UNROLL_M 8)
+      set(CGEMM_UNROLL_N 2)
+      set(ZGEMM_UNROLL_M 4)
+      set(ZGEMM_UNROLL_N 2)
+      set(CGEMM3M_UNROLL_M 8)
+      set(CGEMM3M_UNROLL_N 4)
+      set(ZGEMM3M_UNROLL_M 4)
+      set(ZGEMM3M_UNROLL_N 4)
+  elseif ("${TCORE}" STREQUAL "SAPPHIRERAPIDS")
+    file(APPEND ${TARGET_CONF_TEMP}
+      "#define L1_DATA_SIZE\t32768\n"
+      "#define L1_DATA_LINESIZE\t64\n"
+      "#define L2_SIZE\t262144\n"
+      "#define L2_LINESIZE\t64\n"
+      "#define DTB_DEFAULT_ENTRIES\t64\n"
+      "#define DTB_SIZE\t4096\n"
+      "#define HAVE_CMOV\n"
+      "#define HAVE_MMX\n"
+      "#define HAVE_SSE\n"
+      "#define HAVE_SSE2\n"
+      "#define HAVE_SSE3\n"
+      "#define HAVE_SSSE3\n"
+      "#define HAVE_SSE4_1\n"
+      "#define HAVE_SSE4_2\n"
+      "#define HAVE_AVX\n"
+      "#define HAVE_AVX2\n"
+      "#define HAVE_FMA3\n"
+      "#define HAVE_AVX512VL\n"
+      "#define HAVE_AVX512BF16\n"
+      "#define SLOCAL_BUFFER_SIZE\t20480\n"
+      "#define DLOCAL_BUFFER_SIZE\t12288\n"
+      "#define CLOCAL_BUFFER_SIZE\t12288\n"
+      "#define ZLOCAL_BUFFER_SIZE\t8192\n")
+      set(HAVE_CMOV 1)
+      set(HAVE_MMX 1)
+      set(HAVE_SSE 1)
+      set(HAVE_SSE2 1)
+      set(HAVE_SSE3 1)
+      set(HAVE_SSSE3 1)
+      set(HAVE_SSE4_1 1)
+      set(HAVE_SSE4_2 1)
+      set(HAVE_AVX 1)
+      set(HAVE_AVX2 1)
+      set(HAVE_FMA3 1)
+      set(HAVE_AVX512VL 1)
+      set(HAVE_AVX512BF16 1)
+      set(SBGEMM_UNROLL_M 32)
+      set(SBGEMM_UNROLL_N 16)
+      set(SGEMM_UNROLL_M 16)
+      set(SGEMM_UNROLL_N 4)
+      set(DGEMM_UNROLL_M 16)
+      set(DGEMM_UNROLL_N 2)
+      set(CGEMM_UNROLL_M 8)
+      set(CGEMM_UNROLL_N 2)
+      set(ZGEMM_UNROLL_M 4)
+      set(ZGEMM_UNROLL_N 2)
+      set(CGEMM3M_UNROLL_M 8)
+      set(CGEMM3M_UNROLL_N 4)
+      set(ZGEMM3M_UNROLL_M 4)
+      set(ZGEMM3M_UNROLL_N 4)
+  elseif ("${TCORE}" STREQUAL "OPTERON")
+    file(APPEND ${TARGET_CONF_TEMP}
+      "#define L1_DATA_SIZE\t65536\n"
+      "#define L1_DATA_LINESIZE\t64\n"
+      "#define L2_SIZE\t1048576\n"
+      "#define L2_LINESIZE\t64\n"
+      "#define DTB_DEFAULT_ENTRIES\t32\n"
+      "#define DTB_SIZE\t4096\n"
+      "#define HAVE_3DNOW\n"
+      "#define HAVE_3DNOWEX\n"
+      "#define HAVE_MMX\n"
+      "#define HAVE_SSE\n"
+      "#define HAVE_SSE2\n"
+      "#define SLOCAL_BUFFER_SIZE\t15360\n"
+      "#define DLOCAL_BUFFER_SIZE\t15360\n"
+      "#define CLOCAL_BUFFER_SIZE\t15360\n"
+      "#define ZLOCAL_BUFFER_SIZE\t15360\n")
+      set(HAVE_3DNOW 1)
+      set(HAVE_3DNOWEX 1)
+      set(HAVE_MMX 1)
+      set(HAVE_SSE 1)
+      set(HAVE_SSE2 1)
+      set(SBGEMM_UNROLL_M 8)
+      set(SBGEMM_UNROLL_N 4)
+      set(SGEMM_UNROLL_M 8)
+      set(SGEMM_UNROLL_N 4)
+      set(DGEMM_UNROLL_M 4)
+      set(DGEMM_UNROLL_N 4)
+      set(CGEMM_UNROLL_M 4)
+      set(CGEMM_UNROLL_N 2)
+      set(ZGEMM_UNROLL_M 2)
+      set(ZGEMM_UNROLL_N 2)
+      set(CGEMM3M_UNROLL_M 8)
+      set(CGEMM3M_UNROLL_N 4)
+      set(ZGEMM3M_UNROLL_M 4)
+      set(ZGEMM3M_UNROLL_N 4)
+  elseif ("${TCORE}" STREQUAL "BARCELONA")
+    file(APPEND ${TARGET_CONF_TEMP}
+      "#define L1_DATA_SIZE\t32768\n"
+      "#define L1_DATA_LINESIZE\t64\n"
+      "#define L2_SIZE\t524288\n"
+      "#define L2_LINESIZE\t64\n"
+      "#define DTB_DEFAULT_ENTRIES\t64\n"
+      "#define DTB_SIZE\t4096\n"
+      "#define HAVE_MMX\n"
+      "#define HAVE_SSE\n"
+      "#define HAVE_SSE2\n"
+      "#define HAVE_SSE3\n"
+      "#define HAVE_SSE4A\n"
+      "#define HAVE_MISALIGNSSE\n"
+      "#define HAVE_128BITFPU\n"
+      "#define HAVE_FASTMOVU\n"
+      "#define SLOCAL_BUFFER_SIZE\t14336\n"
+      "#define DLOCAL_BUFFER_SIZE\t14336\n"
+      "#define CLOCAL_BUFFER_SIZE\t14336\n"
+      "#define ZLOCAL_BUFFER_SIZE\t14336\n")
+      set(HAVE_SSE 1)
+      set(HAVE_SSE2 1)
+      set(HAVE_SSE3 1)
+      set(HAVE_SSE4A 1)
+      set(HAVE_MISALIGNSSE 1)
+      set(HAVE_128BITFPU 1)
+      set(HAVE_FASTMOVU 1)
+      set(SBGEMM_UNROLL_M 8)
+      set(SBGEMM_UNROLL_N 4)
+      set(SGEMM_UNROLL_M 8)
+      set(SGEMM_UNROLL_N 4)
+      set(DGEMM_UNROLL_M 4)
+      set(DGEMM_UNROLL_N 4)
+      set(CGEMM_UNROLL_M 4)
+      set(CGEMM_UNROLL_N 2)
+      set(ZGEMM_UNROLL_M 2)
+      set(ZGEMM_UNROLL_N 2)
+      set(CGEMM3M_UNROLL_M 8)
+      set(CGEMM3M_UNROLL_N 4)
+      set(ZGEMM3M_UNROLL_M 4)
+      set(ZGEMM3M_UNROLL_N 4)
+  elseif ("${TCORE}" STREQUAL "BULLDOZER")
+    file(APPEND ${TARGET_CONF_TEMP}
+      "#define L1_DATA_SIZE\t49152\n"
+      "#define L1_DATA_LINESIZE\t64\n"
+      "#define L2_SIZE\t1024000\n"
+      "#define L2_LINESIZE\t64\n"
+      "#define DTB_DEFAULT_ENTRIES\t32\n"
+      "#define DTB_SIZE\t4096\n"
+      "#define HAVE_MMX\n"
+      "#define HAVE_SSE\n"
+      "#define HAVE_SSE2\n"
+      "#define HAVE_SSE3\n"
+      "#define HAVE_SSE4A\n"
+      "#define HAVE_AVX\n"
+      "#define HAVE_MISALIGNSSE\n"
+      "#define HAVE_128BITFPU\n"
+      "#define HAVE_FASTMOVU\n"
+      "#define SLOCAL_BUFFER_SIZE\t5376\n"
+      "#define DLOCAL_BUFFER_SIZE\t5376\n"
+      "#define CLOCAL_BUFFER_SIZE\t14336\n"
+      "#define ZLOCAL_BUFFER_SIZE\t14336\n")
+      set(HAVE_SSE 1)
+      set(HAVE_SSE2 1)
+      set(HAVE_SSE3 1)
+      set(HAVE_SSE4A 1)
+      set(HAVE_AVX 1)
+      set(HAVE_MISALIGNSSE 1)
+      set(HAVE_128BITFPU 1)
+      set(HAVE_FASTMOVU 1)
+      set(SBGEMM_UNROLL_M 8)
+      set(SBGEMM_UNROLL_N 4)
+      set(SGEMM_UNROLL_M 16)
+      set(SGEMM_UNROLL_N 2)
+      set(DGEMM_UNROLL_M 8)
+      set(DGEMM_UNROLL_N 2)
+      set(CGEMM_UNROLL_M 2)
+      set(CGEMM_UNROLL_N 2)
+      set(ZGEMM_UNROLL_M 2)
+      set(ZGEMM_UNROLL_N 2)
+      set(CGEMM3M_UNROLL_M 8)
+      set(CGEMM3M_UNROLL_N 4)
+      set(ZGEMM3M_UNROLL_M 4)
+      set(ZGEMM3M_UNROLL_N 4)
+  elseif ("${TCORE}" STREQUAL "PILEDRIVER")
+    file(APPEND ${TARGET_CONF_TEMP}
+      "#define L1_DATA_SIZE\t16384\n"
+      "#define L1_DATA_LINESIZE\t64\n"
+      "#define L2_SIZE\t2097152\n"
+      "#define L2_LINESIZE\t64\n"
+      "#define DTB_DEFAULT_ENTRIES\t64\n"
+      "#define DTB_SIZE\t4096\n"
+      "#define HAVE_MMX\n"
+      "#define HAVE_SSE\n"
+      "#define HAVE_SSE2\n"
+      "#define HAVE_SSE3\n"
+      "#define HAVE_SSE4_1\n"
+      "#define HAVE_SSE4_2\n"
+      "#define HAVE_SSE4A\n"
+      "#define HAVE_AVX\n"
+      "#define HAVE_MISALIGNSSE\n"
+      "#define HAVE_128BITFPU\n"
+      "#define HAVE_FASTMOVU\n"
+      "#define HAVE_CFLUSH\n"
+      "#define HAVE_FMA3\n"
+      "#define SLOCAL_BUFFER_SIZE\t6144\n"
+      "#define DLOCAL_BUFFER_SIZE\t5376\n"
+      "#define CLOCAL_BUFFER_SIZE\t10752\n"
+      "#define ZLOCAL_BUFFER_SIZE\t10752\n")
+      set(HAVE_SSE 1)
+      set(HAVE_SSE2 1)
+      set(HAVE_SSE3 1)
+      set(HAVE_SSE4_1 1)
+      set(HAVE_SSE4_2 1)
+      set(HAVE_SSE4A 1)
+      set(HAVE_AVX 1)
+      set(HAVE_FMA3 1)
+      set(HAVE_MISALIGNSSE 1)
+      set(HAVE_128BITFPU 1)
+      set(HAVE_FASTMOVU 1)
+      set(HAVE_CFLUSH 1)
+      set(SBGEMM_UNROLL_M 8)
+      set(SBGEMM_UNROLL_N 4)
+      set(SGEMM_UNROLL_M 16)
+      set(SGEMM_UNROLL_N 2)
+      set(DGEMM_UNROLL_M 8)
+      set(DGEMM_UNROLL_N 2)
+      set(CGEMM_UNROLL_M 4)
+      set(CGEMM_UNROLL_N 2)
+      set(ZGEMM_UNROLL_M 2)
+      set(ZGEMM_UNROLL_N 2)
+      set(CGEMM3M_UNROLL_M 8)
+      set(CGEMM3M_UNROLL_N 4)
+      set(ZGEMM3M_UNROLL_M 4)
+      set(ZGEMM3M_UNROLL_N 4)
+  elseif ("${TCORE}" STREQUAL "STEAMROLLER")
+    file(APPEND ${TARGET_CONF_TEMP}
+      "#define L1_DATA_SIZE\t16384\n"
+      "#define L1_DATA_LINESIZE\t64\n"
+      "#define L2_SIZE\t2097152\n"
+      "#define L2_LINESIZE\t64\n"
+      "#define DTB_DEFAULT_ENTRIES\t64\n"
+      "#define DTB_SIZE\t4096\n"
+      "#define HAVE_MMX\n"
+      "#define HAVE_SSE\n"
+      "#define HAVE_SSE2\n"
+      "#define HAVE_SSE3\n"
+      "#define HAVE_SSE4_1\n"
+      "#define HAVE_SSE4_2\n"
+      "#define HAVE_SSE4A\n"
+      "#define HAVE_AVX\n"
+      "#define HAVE_MISALIGNSSE\n"
+      "#define HAVE_128BITFPU\n"
+      "#define HAVE_FASTMOVU\n"
+      "#define HAVE_CFLUSH\n"
+      "#define HAVE_FMA3\n"
+      "#define SLOCAL_BUFFER_SIZE\t6144\n"
+      "#define DLOCAL_BUFFER_SIZE\t5120\n"
+      "#define CLOCAL_BUFFER_SIZE\t10240\n"
+      "#define ZLOCAL_BUFFER_SIZE\t10240\n")
+      set(HAVE_SSE 1)
+      set(HAVE_SSE2 1)
+      set(HAVE_SSE3 1)
+      set(HAVE_SSE4_1 1)
+      set(HAVE_SSE4_2 1)
+      set(HAVE_SSE4A 1)
+      set(HAVE_AVX 1)
+      set(HAVE_FMA3 1)
+      set(HAVE_MISALIGNSSE 1)
+      set(HAVE_128BITFPU 1)
+      set(HAVE_FASTMOVU 1)
+      set(HAVE_CFLUSH 1)
+      set(SBGEMM_UNROLL_M 8)
+      set(SBGEMM_UNROLL_N 4)
+      set(SGEMM_UNROLL_M 16)
+      set(SGEMM_UNROLL_N 2)
+      set(DGEMM_UNROLL_M 8)
+      set(DGEMM_UNROLL_N 2)
+      set(CGEMM_UNROLL_M 4)
+      set(CGEMM_UNROLL_N 2)
+      set(ZGEMM_UNROLL_M 2)
+      set(ZGEMM_UNROLL_N 2)
+      set(CGEMM3M_UNROLL_M 8)
+      set(CGEMM3M_UNROLL_N 4)
+      set(ZGEMM3M_UNROLL_M 4)
+      set(ZGEMM3M_UNROLL_N 4)
+  elseif ("${TCORE}" STREQUAL "EXCAVATOR")
+    file(APPEND ${TARGET_CONF_TEMP}
+      "#define L1_DATA_SIZE\t16384\n"
+      "#define L1_DATA_LINESIZE\t64\n"
+      "#define L2_SIZE\t2097152\n"
+      "#define L2_LINESIZE\t64\n"
+      "#define DTB_DEFAULT_ENTRIES\t64\n"
+      "#define DTB_SIZE\t4096\n"
+      "#define HAVE_MMX\n"
+      "#define HAVE_SSE\n"
+      "#define HAVE_SSE2\n"
+      "#define HAVE_SSE3\n"
+      "#define HAVE_SSE4_1\n"
+      "#define HAVE_SSE4_2\n"
+      "#define HAVE_SSE4A\n"
+      "#define HAVE_AVX\n"
+      "#define HAVE_MISALIGNSSE\n"
+      "#define HAVE_128BITFPU\n"
+      "#define HAVE_FASTMOVU\n"
+      "#define HAVE_CFLUSH\n"
+      "#define HAVE_FMA3\n"
+      "#define SLOCAL_BUFFER_SIZE\t6144\n"
+      "#define DLOCAL_BUFFER_SIZE\t5120\n"
+      "#define CLOCAL_BUFFER_SIZE\t10240\n"
+      "#define ZLOCAL_BUFFER_SIZE\t10240\n")
+      set(HAVE_SSE 1)
+      set(HAVE_SSE2 1)
+      set(HAVE_SSE3 1)
+      set(HAVE_SSE4_1 1)
+      set(HAVE_SSE4_2 1)
+      set(HAVE_SSE4A 1)
+      set(HAVE_AVX 1)
+      set(HAVE_FMA3 1)
+      set(HAVE_MISALIGNSSE 1)
+      set(HAVE_128BITFPU 1)
+      set(HAVE_FASTMOVU 1)
+      set(HAVE_CFLUSH 1)
+      set(SBGEMM_UNROLL_M 8)
+      set(SBGEMM_UNROLL_N 4)
+      set(SGEMM_UNROLL_M 16)
+      set(SGEMM_UNROLL_N 2)
+      set(DGEMM_UNROLL_M 8)
+      set(DGEMM_UNROLL_N 2)
+      set(CGEMM_UNROLL_M 4)
+      set(CGEMM_UNROLL_N 2)
+      set(ZGEMM_UNROLL_M 2)
+      set(ZGEMM_UNROLL_N 2)
+      set(CGEMM3M_UNROLL_M 8)
+      set(CGEMM3M_UNROLL_N 4)
+      set(ZGEMM3M_UNROLL_M 4)
+      set(ZGEMM3M_UNROLL_N 4)
+  elseif ("${TCORE}" STREQUAL "ZEN")
+    file(APPEND ${TARGET_CONF_TEMP}
+      "#define L1_DATA_SIZE\t32768\n"
+      "#define L1_DATA_LINESIZE\t64\n"
+      "#define L2_SIZE\t524288\n"
+      "#define L2_LINESIZE\t64\n"
+      "#define DTB_DEFAULT_ENTRIES\t64\n"
+      "#define DTB_SIZE\t4096\n"
+      "#define HAVE_MMX\n"
+      "#define HAVE_SSE\n"
+      "#define HAVE_SSE2\n"
+      "#define HAVE_SSE3\n"
+      "#define HAVE_SSE4_1\n"
+      "#define HAVE_SSE4_2\n"
+      "#define HAVE_SSE4A\n"
+      "#define HAVE_MISALIGNSSE\n"
+      "#define HAVE_128BITFPU\n"
+      "#define HAVE_FASTMOVU\n"
+      "#define HAVE_CFLUSH\n"
+      "#define HAVE_AVX\n"
+      "#define HAVE_AVX2\n"
+      "#define HAVE_FMA3\n"
+      "#define SLOCAL_BUFFER_SIZE\t20480\n"
+      "#define DLOCAL_BUFFER_SIZE\t32768\n"
+      "#define CLOCAL_BUFFER_SIZE\t16384\n"
+      "#define ZLOCAL_BUFFER_SIZE\t12288\n")
+      set(HAVE_SSE 1)
+      set(HAVE_SSE2 1)
+      set(HAVE_SSE3 1)
+      set(HAVE_SSE4_1 1)
+      set(HAVE_SSE4_2 1)
+      set(HAVE_AVX 1)
+      set(HAVE_AVX2 1)
+      set(HAVE_FMA3 1)
+      set(HAVE_SSE4A 1)
+      set(HAVE_MISALIGNSSE 1)
+      set(HAVE_128BITFPU 1)
+      set(HAVE_FASTMOVU 1)
+      set(HAVE_CFLUSH 1)
+      set(SBGEMM_UNROLL_M 8)
+      set(SBGEMM_UNROLL_N 4)
+      set(SGEMM_UNROLL_M 8)
+      set(SGEMM_UNROLL_N 4)
+      set(DGEMM_UNROLL_M 4)
+      set(DGEMM_UNROLL_N 8)
+      set(CGEMM_UNROLL_M 8)
+      set(CGEMM_UNROLL_N 2)
+      set(ZGEMM_UNROLL_M 4)
       set(ZGEMM_UNROLL_N 2)
       set(CGEMM3M_UNROLL_M 8)
       set(CGEMM3M_UNROLL_N 4)


Pybind: Avoid setting the LTCG flag on MSVC

--- cmake/pybind11.cmake
+++ cmake/pybind11.cmake
@@ -32,6 +32,13 @@
 # Needed for the function pybind11_add_module and dependency pybind11::module
 add_subdirectory(${IVW_ROOT_DIR}/ext/pybind11)

+if(MSVC)
+    # Prevent setting the /GL and -LTCG flag
+    set(PYBIND11_LTO_CXX_FLAGS "" CACHE INTERNAL "")
+    set(PYBIND11_LTO_LINKER_FLAGS "" CACHE INTERNAL "")
+endif(MSVC)
+
+
 function (ivw_add_py_wrapper name)
     if(IVW_MODULE_PYTHON3)
         pybind11_add_module(${name} ${ARGN})


update: coverage processing

update: coverage processing

--- cmake/HUGH_PLATFORM_SetupVariables.cmake
+++ cmake/HUGH_PLATFORM_SetupVariables.cmake
@@ -11,3 +11,5 @@
 endif()

 include(CMakeAddons_SetupVariables)
+
+set(${PROJECT_NAME}_COVERAGE_EXCLUDE "${${PROJECT_NAME}_COVERAGE_EXCLUDE} 'install/*'")


Fixed CMake for Win32, fixed affinityCheck build for Win32

[ ] May break build
[ ] May break existing applications (see CHANGES.txt)
[x] Bugfix
[ ] New Feature
[ ] Cleanup
[ ] Optimization
[ ] Documentation

--- UseGnuWin32.cmake
+++ UseGnuWin32.cmake
@@ -1,11 +1,11 @@
 # Copyright (c) 2010 Daniel Pfeifer <daniel@pfeifer-mail.de>

 set(GNUWIN32_NAME GnuWin32)
-set(GNUWIN32_TGZ ${CMAKE_SOURCE_DIR}/externals/${GNUWIN32_NAME}.tar.gz)
+set(GNUWIN32_TGZ ${CMAKE_SOURCE_DIR}/CMake/${GNUWIN32_NAME}.tar.gz)
 set(GNUWIN32_DIR ${CMAKE_BINARY_DIR}/${GNUWIN32_NAME})

 if(NOT EXISTS ${GNUWIN32_DIR})
-  file(MAKE_DIRECTORY ${GNUWIN32_DIR})
+  message(STATUS "  Extracting GnuWin32 to ${GNUWIN32_DIR}")
   execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf
     ${GNUWIN32_TGZ} WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
 endif(NOT EXISTS ${GNUWIN32_DIR})


elderly cmake compatibility

elderly cmake compatibility

--- cmake/ArangoDBInstall.cmake
+++ cmake/ArangoDBInstall.cmake
@@ -91,7 +91,10 @@
   find_package(PkgConfig QUIET)
   pkg_check_modules(SYSTEMD systemd)
   if (SYSTEMD_FOUND)
-    pkg_get_variable(SYSTEMD_UNIT_DIR systemd systemdsystemunitdir)
+    # cmake to old: pkg_get_variable(SYSTEMD_UNIT_DIR systemd systemdsystemunitdir)
+    execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} systemd --variable=systemdsystemunitdir
+      OUTPUT_VARIABLE SYSTEMD_UNIT_DIR
+      OUTPUT_STRIP_TRAILING_WHITESPACE)
     set(IS_SYSTEMD_INSTALL 1)
     configure_file (
         ${ARANGODB_SOURCE_DIR}/Installation/systemd/arangodb3.service.in


Handle absolute OPENCV_INCLUDE_INSTALL_PATH correctly

In case OPENCV_INCLUDE_INSTALL_PATH is absolute (i.e. starts with a "/"),
the path ends up with a double "/".

While this is mostly equivalent to a single slash, it may have a nasty
side effect when:
- OpenCV_INSTALL_PATH is empty
- OPENCV_INCLUDE_INSTALL_PATH is "/usr/include"
- the calling build script uses "-isystem" to specify the path to the
  headers of dependencies (to avoid warnings)

Specifying "-isystem /usr/include" breaks the path ordering, and GCC can
no longer find its "stdlib.h", thus CMake filters such statements.
Unfortunately it fails to do so when using "//usr/include".

--- cmake/OpenCVGenConfig.cmake
+++ cmake/OpenCVGenConfig.cmake
@@ -68,7 +68,11 @@
 #  Part 2/3: ${BIN_DIR}/unix-install/OpenCVConfig.cmake -> For use *with* "make install"
 # -------------------------------------------------------------------------------------------
 file(RELATIVE_PATH OpenCV_INSTALL_PATH_RELATIVE_CONFIGCMAKE "${CMAKE_INSTALL_PREFIX}/${OPENCV_CONFIG_INSTALL_PATH}/" ${CMAKE_INSTALL_PREFIX})
-set(OpenCV_INCLUDE_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/${OPENCV_INCLUDE_INSTALL_PATH}\" \"\${OpenCV_INSTALL_PATH}/${OPENCV_INCLUDE_INSTALL_PATH}/opencv\"")
+if (IS_ABSOLUTE ${OPENCV_INCLUDE_INSTALL_PATH})
+  set(OpenCV_INCLUDE_DIRS_CONFIGCMAKE "\"${OPENCV_INCLUDE_INSTALL_PATH}\" \"${OPENCV_INCLUDE_INSTALL_PATH}/opencv\"")
+else()
+  set(OpenCV_INCLUDE_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/${OPENCV_INCLUDE_INSTALL_PATH}\" \"\${OpenCV_INSTALL_PATH}/${OPENCV_INCLUDE_INSTALL_PATH}/opencv\"")
+endif()

 if(USE_IPPICV)
   file(RELATIVE_PATH IPPICV_INSTALL_PATH_RELATIVE_CONFIGCMAKE "${CMAKE_INSTALL_PREFIX}" "${IPPICV_INSTALL_PATH}")


[CMake] Fix symlink refactor for multi-configuration generators

This fix, while a bit complicated, preserves the reusability while fixing the issues reported on llvm-commits with visual studio generators.

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

--- cmake/modules/AddLLVM.cmake
+++ cmake/modules/AddLLVM.cmake
@@ -1290,14 +1290,34 @@

 function(add_llvm_tool_symlink link_name target)
   cmake_parse_arguments(ARG "ALWAYS_GENERATE" "OUTPUT_DIR" "" ${ARGN})
+  # This got a bit gross... For multi-configuration generators the target
+  # properties return the resolved value of the string, not the build system
+  # expression. To reconstruct the platform-agnostic path we have to do some
+  # magic. First we grab one of the types, and a type-specific path. Then from
+  # the type-specific path we find the last occurrence of the type in the path,
+  # and replace it with CMAKE_CFG_INTDIR. This allows the build step to be type
+  # agnostic again.
   if(NOT ARG_OUTPUT_DIR)
+    if(CMAKE_CONFIGURATION_TYPES)
+      list(GET CMAKE_CONFIGURATION_TYPES 0 first_type)
+      string(TOUPPER ${first_type} first_type_upper)
+      set(first_type_suffix _${first_type_upper})
+    endif()
     get_target_property(target_type ${target} TYPE)
     if(${target_type} STREQUAL "STATIC_LIBRARY")
-      get_target_property(ARG_OUTPUT_DIR ${target} ARCHIVE_OUTPUT_DIRECTORY)
+      get_target_property(ARG_OUTPUT_DIR ${target} ARCHIVE_OUTPUT_DIRECTORY${first_type_suffix})
     elseif(UNIX AND ${target_type} STREQUAL "SHARED_LIBRARY")
-      get_target_property(ARG_OUTPUT_DIR ${target} LIBRARY_OUTPUT_DIRECTORY)
+      get_target_property(ARG_OUTPUT_DIR ${target} LIBRARY_OUTPUT_DIRECTORY${first_type_suffix})
     else()
-      get_target_property(ARG_OUTPUT_DIR ${target} RUNTIME_OUTPUT_DIRECTORY)
+      get_target_property(ARG_OUTPUT_DIR ${target} RUNTIME_OUTPUT_DIRECTORY${first_type_suffix})
+    endif()
+    if(CMAKE_CONFIGURATION_TYPES)
+      string(FIND "${ARG_OUTPUT_DIR}" "/${first_type}/" type_start REVERSE)
+      string(SUBSTRING "${ARG_OUTPUT_DIR}" 0 ${type_start} path_prefix)
+      string(SUBSTRING "${ARG_OUTPUT_DIR}" ${type_start} -1 path_suffix)
+      string(REPLACE "/${first_type}/" "/${CMAKE_CFG_INTDIR}/"
+             path_suffix ${path_suffix})
+      set(ARG_OUTPUT_DIR ${path_prefix}${path_suffix})
     endif()
   endif()


Remove uncorrect DOC type from FindTBB module

CMake Warning (dev) at cmake/modules/FindTBB.cmake:111 (SET):
  implicitly converting 'DOC' to 'STRING' type.
Call Stack (most recent call first):
  cmake/modules/SearchInstalledSoftware.cmake:15 (_find_package)
  cmake/modules/SearchInstalledSoftware.cmake:1095 (find_package)
  CMakeLists.txt:167 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

--- cmake/modules/FindTBB.cmake
+++ cmake/modules/FindTBB.cmake
@@ -109,11 +109,11 @@
 IF (TBB_LIBRARY_RELEASE AND TBB_LIBRARY_DEBUG)
   IF (NOT TBB_LIBRARY)
     SET (TBB_LIBRARY optimized ${TBB_LIBRARY_RELEASE} debug ${TBB_LIBRARY_DEBUG}
-      CACHE DOC "TBB library" FORCE)
+      CACHE STRING "TBB library" FORCE)
   ENDIF (NOT TBB_LIBRARY)
 ELSEIF (TBB_LIBRARY_RELEASE)
   IF (NOT TBB_LIBRARY)
-    SET (TBB_LIBRARY ${TBB_LIBRARY_RELEASE} CACHE DOC "TBB library" FORCE)
+    SET (TBB_LIBRARY ${TBB_LIBRARY_RELEASE} CACHE STRING "TBB library" FORCE)
   ENDIF (NOT TBB_LIBRARY)
 ENDIF (TBB_LIBRARY_RELEASE AND TBB_LIBRARY_DEBUG)

@@ -154,13 +154,13 @@
   IF (${_TBB_LIBRARY_BASE}_DEBUG AND ${_TBB_LIBRARY_BASE}_RELEASE)
     SET (${_TBB_LIBRARY_BASE}
       debug ${${_TBB_LIBRARY_BASE}_DEBUG}
-      optimized ${${_TBB_LIBRARY_BASE}_RELEASE} CACHE DOC
+      optimized ${${_TBB_LIBRARY_BASE}_RELEASE} CACHE STRING
       "TBB ${_TBB_COMPONENT} library")
   ELSEIF (${_TBB_LIBRARY_BASE}_DEBUG)
     SET (${_TBB_LIBRARY_BASE} ${${_TBB_LIBRARY_BASE}_DEBUG})
   ELSEIF (${_TBB_LIBRARY_BASE}_RELEASE)
     SET (${_TBB_LIBRARY_BASE} ${${_TBB_LIBRARY_BASE}_RELEASE}
-      CACHE DOC "TBB ${_TBB_COMPONENT} library")
+      CACHE STRING "TBB ${_TBB_COMPONENT} library")
   ELSE (${_TBB_LIBRARY_BASE}_DEBUG AND ${_TBB_LIBRARY_BASE}_RELEASE)
     # Component missing: record it for a later report
     LIST (APPEND _TBB_MISSING_COMPONENTS ${_TBB_COMPONENT})


RPM fix: install Flexisip headers when yum/rpm is set to skip documentation installation

--- build/rpm/flexisip.spec.cmake
+++ build/rpm/flexisip.spec.cmake
@@ -10,6 +10,11 @@
 %define _datadir           %{_datarootdir}
 %define _docdir            %{_datadir}/doc
 %define flexisip_logdir    %{_localstatedir}/log/flexisip
+
+# Hack: force _mandir to its default value because cmake-builder re-define it
+# on rpmbuild invokation with a bad value.
+# Remove this hack once Flexisip is based on Linphone SDK >= 4.4
+%define _mandir            %{_datarootdir}/man

 # to be compliant with RedHat which changed epoch to 1 for an unknown reason
 %define epoch     1
@@ -214,11 +219,9 @@

 %files
 %defattr(-,root,root,-)
-%docdir %{_docdir}
 %{_bindir}/*
 %{_libdir}/*.so
 %{_datarootdir}/*
-#%dir %{_includedir}/flexisip
 %{_includedir}/flexisip/*.h
 %{_includedir}/flexisip/*.hh
 %{_includedir}/flexisip/auth/*.hh


Improve docs a bit

Improve docs a bit

--- build_tools/cmake/iree_cross_compile.cmake
+++ build_tools/cmake/iree_cross_compile.cmake
@@ -33,9 +33,9 @@
 #   set to a directory named as `config_name` under the current CMake binary
 #   directory.
 # - IREE_<config_name>_C_COMPILER: C compiler for the given `config_name`.
-#   This must be definedd by the caller.
+#   This must be defined by the caller.
 # - IREE_<config_name>_CXX_COMPILER: C++ compiler for the given `config_name`.
-#   This must be definedd by the caller.
+#   This must be defined by the caller.
 # - IREE_<config_name>_<option>: switch for the given `option` specifically for
 #   `config_name`. If missing, default to OFF for bool options; default to
 #   IREE_<option> for non-bool variables.
@@ -112,7 +112,7 @@
 # Gets the CMake build command for the given `target`.
 #
 # Parameters:
-# - target: the target to build on host.
+# - target: the target to build.
 # - bin_dir: root binary directory containing CMakeCache.txt.
 # - cmd_var: variable name for receiving the build command.
 function(iree_get_build_command target bin_dir cmd_var)
@@ -140,6 +140,15 @@
   set(${output_path_var} "${output_path}" PARENT_SCOPE)
 endfunction()

+# iree_host_install
+#
+# Defines custom commands and targets for installing the given `target`. The
+# custom target for install will be named as `iree_host_install_${target}`.
+#
+# Parameters:
+# - COMPONENT: installation component; used for filtering installation targets.
+# - PREFIX: the root installation path prefix.
+# - DEPENDS: addtional dependencies for the installation.
 function(iree_host_install target)
   cmake_parse_arguments(_RULE "" "COMPONENT;PREFIX" "DEPENDS" ${ARGN})
   if(_RULE_COMPONENT)
@@ -165,11 +174,12 @@

 # iree_build_host_executable
 #
-# Builds and installs a tool on host for cross-compilation.
+# Generates custom commands and targets for building and installing a tool on
+# host for cross-compilation.
 #
 # Parameters:
 # - target: the target to build on host.
-# - BUILDONLY: only build the target.
+# - BUILDONLY: only generates commands for building the target.
 # - DEPENDS: any additional dependencies for the target.
 function(iree_build_host_executable target)
   cmake_parse_arguments(_RULE "BUILDONLY" "" "DEPENDS" ${ARGN})


Use a less buggy cray compiler

Use a less buggy cray compiler

--- scripts/dashboard/nightly/cori-cray-mpich.cmake
+++ scripts/dashboard/nightly/cori-cray-mpich.cmake
@@ -15,6 +15,7 @@
 module(load modules)
 module(load craype)
 module(load PrgEnv-cray)
+module(swap cce cce/8.6.2)
 module(load craype-mic-knl)
 module(load cray-mpich)
 module(load cray-hdf5-parallel)


chore: Fix builds against vcpkg. (#3012)

The latest vcpkg does not define GTest::mock, but defines GMock::gmock
instead. That seems like a bug (filed), but we need to workaround it.

--- cmake/FindGMockWithTargets.cmake
+++ cmake/FindGMockWithTargets.cmake
@@ -62,6 +62,38 @@
     endif ()
 endfunction ()

+function (google_cloud_cpp_transfer_library_properties target source)
+
+    add_library(${target} UNKNOWN IMPORTED)
+    get_target_property(value ${source} IMPORTED_LOCATION)
+    if (NOT value)
+        get_target_property(value ${source} IMPORTED_LOCATION_DEBUG)
+        if (EXISTS "${value}")
+            set_target_properties(${target}
+                                  PROPERTIES IMPORTED_LOCATION ${value})
+        endif ()
+        get_target_property(value ${source} IMPORTED_LOCATION_RELEASE)
+        if (EXISTS "${value}")
+            set_target_properties(${target}
+                                  PROPERTIES IMPORTED_LOCATION ${value})
+        endif ()
+    endif ()
+    foreach (property
+             IMPORTED_LOCATION_DEBUG
+             IMPORTED_LOCATION_RELEASE
+             IMPORTED_CONFIGURATIONS
+             INTERFACE_INCLUDE_DIRECTORIES
+             IMPORTED_LINK_INTERFACE_LIBRARIES
+             IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG
+             IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE)
+        get_target_property(value ${source} ${property})
+        message("*** ${source} ${property} ${value}")
+        if (value)
+            set_target_properties(${target} PROPERTIES ${property} "${value}")
+        endif ()
+    endforeach ()
+endfunction ()
+
 include(CTest)
 if (TARGET GTest::gmock)
     # GTest::gmock is already defined, do not define it again.
@@ -71,8 +103,9 @@
 else()
     # Try to find the config package first. If that is not found
     find_package(GTest CONFIG QUIET)
+    find_package(GMock CONFIG QUIET)
     if (NOT GTest_FOUND)
-        find_package(GTest REQUIRED)
+        find_package(GTest MODULE REQUIRED)

         google_cloud_cpp_create_googletest_aliases()

@@ -105,4 +138,10 @@
                                          INTERFACE_INCLUDE_DIRECTORIES
                                          "${GMOCK_INCLUDE_DIRS}")
     endif ()
+
+    if (NOT TARGET GTest::gmock AND TARGET GMock::gmock)
+        google_cloud_cpp_transfer_library_properties(GTest::gmock GMock::gmock)
+        google_cloud_cpp_transfer_library_properties(GTest::gmock_main
+                                                     GMock::gmock_main)
+    endif ()
 endif ()


Set _XOPEN_SOURCE_EXTENDED flag on Apple systems

--- cmake/Modules/FindNcursesw.cmake
+++ cmake/Modules/FindNcursesw.cmake
@@ -122,6 +122,9 @@

   if(${OSX_BREW_NCURSES})
     set(CURSES_INCLUDE_PATH /usr/local/opt/ncurses/include)
+    if (APPLE)
+      add_definitions(-D_XOPEN_SOURCE_EXTENDED)
+    endif()
   else()
     find_path(CURSES_INCLUDE_PATH
       NAMES ncursesw/ncurses.h ncursesw/curses.h ncurses.h curses.h


Build: Reformat CMake code

Build: Reformat CMake code

--- cmake/Modules/LibAddPlugin.cmake
+++ cmake/Modules/LibAddPlugin.cmake
@@ -197,8 +197,7 @@
 					FATAL_ERROR
 						"Internally inconsistency, plugin ${PLUGIN_NAME} got different values for variable ${VARIABLE}: '${${VARIABLE}}' != '${VAR}'"
 						"Concatenate variables that contain the value of ${VARIABLE} in a single variable during the DEPENDENCY_PHASE."
-						"Make sure that only a single variable is passed to every argument of add_plugin."
-					)
+						"Make sure that only a single variable is passed to every argument of add_plugin.")
 			endif ()
 		else ()


Fix the cmake file for linking sfml

Fix the cmake file for linking sfml

--- SFML-2.3.2/share/SFML/cmake/Modules/FindSFML.cmake
+++ SFML-2.3.2/share/SFML/cmake/Modules/FindSFML.cmake
@@ -1,5 +1,60 @@
 # This script locates the SFML library
 # ------------------------------------
+#
+# Usage
+# -----
+#
+# When you try to locate the SFML libraries, you must specify which modules you want to use (system, window, graphics, network, audio, main).
+# If none is given, the SFML_LIBRARIES variable will be empty and you'll end up linking to nothing.
+# example:
+#   find_package(SFML COMPONENTS graphics window system) // find the graphics, window and system modules
+#
+# You can enforce a specific version, either MAJOR.MINOR or only MAJOR.
+# If nothing is specified, the version won't be checked (i.e. any version will be accepted).
+# example:
+#   find_package(SFML COMPONENTS ...)     // no specific version required
+#   find_package(SFML 2 COMPONENTS ...)   // any 2.x version
+#   find_package(SFML 2.4 COMPONENTS ...) // version 2.4 or greater
+#
+# By default, the dynamic libraries of SFML will be found. To find the static ones instead,
+# you must set the SFML_STATIC_LIBRARIES variable to TRUE before calling find_package(SFML ...).
+# Since you have to link yourself all the SFML dependencies when you link it statically, the following
+# additional variables are defined: SFML_XXX_DEPENDENCIES and SFML_DEPENDENCIES (see their detailed
+# description below).
+# In case of static linking, the SFML_STATIC macro will also be defined by this script.
+# example:
+#   set(SFML_STATIC_LIBRARIES TRUE)
+#   find_package(SFML 2 COMPONENTS network system)
+#
+# On Mac OS X if SFML_STATIC_LIBRARIES is not set to TRUE then by default CMake will search for frameworks unless
+# CMAKE_FIND_FRAMEWORK is set to "NEVER" for example. Please refer to CMake documentation for more details.
+# Moreover, keep in mind that SFML frameworks are only available as release libraries unlike dylibs which
+# are available for both release and debug modes.
+#
+# If SFML is not installed in a standard path, you can use the SFML_ROOT CMake (or environment) variable
+# to tell CMake where SFML is.
+#
+# Output
+# ------
+#
+# This script defines the following variables:
+# - For each specified module XXX (system, window, graphics, network, audio, main):
+#   - SFML_XXX_LIBRARY_DEBUG:   the name of the debug library of the xxx module (set to SFML_XXX_LIBRARY_RELEASE is no debug version is found)
+#   - SFML_XXX_LIBRARY_RELEASE: the name of the release library of the xxx module (set to SFML_XXX_LIBRARY_DEBUG is no release version is found)
+#   - SFML_XXX_LIBRARY:         the name of the library to link to for the xxx module (includes both debug and optimized names if necessary)
+#   - SFML_XXX_FOUND:           true if either the debug or release library of the xxx module is found
+#   - SFML_XXX_DEPENDENCIES:    the list of libraries the module depends on, in case of static linking
+# - SFML_LIBRARIES:    the list of all libraries corresponding to the required modules
+# - SFML_FOUND:        true if all the required modules are found
+# - SFML_INCLUDE_DIR:  the path where SFML headers are located (the directory containing the SFML/Config.hpp file)
+# - SFML_DEPENDENCIES: the list of libraries SFML depends on, in case of static linking
+#
+# example:
+#   find_package(SFML 2 COMPONENTS system window graphics audio REQUIRED)
+#   include_directories(${SFML_INCLUDE_DIR})
+#   add_executable(myapp ...)
+#   target_link_libraries(myapp ${SFML_LIBRARIES})
+
 # define the SFML_STATIC macro if static build was chosen
 if(SFML_STATIC_LIBRARIES)
     add_definitions(-DSFML_STATIC)
@@ -310,4 +365,4 @@
 # handle success
 if(SFML_FOUND AND NOT SFML_FIND_QUIETLY)
     message(STATUS "Found SFML ${SFML_VERSION_MAJOR}.${SFML_VERSION_MINOR}.${SFML_VERSION_PATCH} in ${SFML_INCLUDE_DIR}")
-endif()
+endif()


CMake: adapt to upstream CMake changes

CMake: adapt to upstream CMake changes

Swift SVN r26604

--- cmake/modules/SwiftSharedCMakeConfig.cmake
+++ cmake/modules/SwiftSharedCMakeConfig.cmake
@@ -198,6 +198,8 @@
   else( MSVC )
     set(LLVM_ENABLE_WARNINGS "Enable compiler warnings." ON)
   endif()
+
+  set(LLVM_ABI_BREAKING_CHECKS "WITH_ASSERTS")

   include(AddLLVM)
   include(TableGen)


Print information about cache entry

Print information about cache entry

--- cmake/modules/hunter_load_from_cache.cmake
+++ cmake/modules/hunter_load_from_cache.cmake
@@ -138,6 +138,7 @@
   if(NOT EXISTS "${cache_sha1_file}")
     hunter_internal_error("cache.sha1 not exists")
   endif()
+  hunter_status_print("Cache info: ${cache_sha1_file}")
   file(COPY "${cache_sha1_file}" DESTINATION "${HUNTER_PACKAGE_HOME_DIR}")

   if(HUNTER_CACHE_RUN)


Fix checker

Fix checker

--- cmake/modules/hunter_upload_password.cmake
+++ cmake/modules/hunter_upload_password.cmake
@@ -30,7 +30,6 @@
   string(COMPARE NOTEQUAL "${x_REPO_OWNER}" "" has_repo_owner)
   string(COMPARE NOTEQUAL "${x_REPO}" "" has_repo)
   string(COMPARE NOTEQUAL "${x_HTTPHEADER}" "" has_httpheader)
-  string(COMPARE NOTEQUAL "${x_SUB_SHA1_SUFFIX}" "" has_sub_sha1_suffix)

   if(has_server)
     # Not GitHub server
@@ -45,7 +44,7 @@
     if(has_httpheader)
       hunter_user_error("Unexpected HTTPHEADER")
     endif()
-    if(has_sub_sha1_suffix)
+    if(x_SUB_SHA1_SUFFIX)
       hunter_user_error("Unexpected SUB_SHA1_SUFFIX")
     endif()
   endif()


transitively carry thrift dependencies forward

Summary: eden.thrift includes fb303_core.thrift, so any cmake target that depends on eden.thrift should pull in fb303_core.thrift's include directories and libraries. Implement that machinery in CppThriftLibrary.cmake.

Reviewed By: wez

Differential Revision: D16062657

fbshipit-source-id: d5d962960e767a138a9b634a12aebccf72d6ef43

--- build/fbcode_builder/CMake/ThriftCppLibrary.cmake
+++ build/fbcode_builder/CMake/ThriftCppLibrary.cmake
@@ -37,7 +37,13 @@
     DIRECTORY
   )

-  list(APPEND GEN_ARGS "include_prefix=${output_dir}")
+  # Generate relative paths in #includes
+  file(RELATIVE_PATH include_prefix ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${THRIFT_FILE})
+  get_filename_component(include_prefix ${include_prefix} DIRECTORY)
+
+  if (NOT "${include_prefix}" STREQUAL "")
+    list(APPEND GEN_ARGS "include_prefix=${include_prefix}")
+  endif()
   # CMake 3.12 is finally getting a list(JOIN) function, but until then
   # treating the list as a string and replacing the semicolons is good enough.
   string(REPLACE ";" "," GEN_ARG_STR "${GEN_ARGS}")
@@ -70,6 +76,24 @@
     )
   endforeach()

+  list(APPEND thrift_include_options -I ${CMAKE_SOURCE_DIR})
+  foreach(depends IN LISTS DEPENDS)
+    get_property(thrift_include_directory
+      TARGET ${depends}
+      PROPERTY THRIFT_INCLUDE_DIRECTORY)
+
+    if (thrift_include_directory STREQUAL "")
+      message(STATUS "No thrift dependency found for ${depends}")
+    else()
+      list(APPEND thrift_include_options -I
+        ${thrift_include_directory})
+    endif()
+  endforeach()
+
+  file(
+    GLOB_RECURSE THRIFT_TEMPLATE_FILES
+    FOLLOW_SYMLINKS ${FBTHRIFT_TEMPLATES_DIR}/*.mustache)
+
   # Emit the rule to run the thrift compiler
   add_custom_command(
     OUTPUT
@@ -82,7 +106,7 @@
       --strict
       --templates ${FBTHRIFT_TEMPLATES_DIR}
       --gen "mstch_cpp2:${GEN_ARG_STR}"
-      -I ${CMAKE_SOURCE_DIR}
+      ${thrift_include_options}
       -o ${output_dir}
       ${CMAKE_CURRENT_SOURCE_DIR}/${THRIFT_FILE}
     WORKING_DIRECTORY
@@ -97,16 +121,18 @@
   add_library(${LIB_NAME} STATIC
     ${generated_sources}
   )
-  set_property(
-    TARGET ${LIB_NAME}
-    PROPERTY PUBLIC_HEADER
-      ${generated_headers}
+
+  install(
+    FILES ${generated_headers}
+    DESTINATION $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>/gen-cpp2
   )
+
   target_include_directories(
     ${LIB_NAME}
+    PRIVATE
+      ${CMAKE_SOURCE_DIR}
+      ${CMAKE_BINARY_DIR}
     PUBLIC
-      $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}>
-      $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
       ${FOLLY_INCLUDE_DIR}
       ${FBTHRIFT_INCLUDE_DIR}
   )
@@ -117,4 +143,15 @@
       FBThrift::thriftcpp2
       Folly::folly
   )
+
+  set_target_properties(
+    ${LIB_NAME}
+    PROPERTIES
+      EXPORT_PROPERTIES "THRIFT_INCLUDE_DIRECTORY"
+      THRIFT_INCLUDE_DIRECTORY ${CMAKE_SOURCE_DIR}
+  )
+
+  get_property(thrift_include_directory
+    TARGET ${LIB_NAME}
+    PROPERTY THRIFT_INCLUDE_DIRECTORY)
 endfunction()


Add more convenient function: `fatal' and `error'.

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

--- build-aux/cmake/modules/Tools.cmake
+++ build-aux/cmake/modules/Tools.cmake
@@ -22,6 +22,16 @@
   function(ECHO)
     message(STATUS ${ARGV})
   endfunction(ECHO)
+
+  # Shorthand for message(FATAL_ERROR "blabla")
+  function(fatal)
+    message(FATAL_ERROR ${ARGV})
+  endfunction(fatal)
+
+  # Shorthand for message(SEND_ERROR "blabla")
+  function(error)
+    message(SEND_ERROR ${ARGV})
+  endfunction(error)

   # Print the list named _l_ with one item per line.
   function(print_list l)


cmake(android): fix non-idempotent INSTALL scripts

--- cmake/OpenCVDetectAndroidSDK.cmake
+++ cmake/OpenCVDetectAndroidSDK.cmake
@@ -348,9 +348,18 @@
     # put the final .apk to the OpenCV's bin folder
     add_custom_command(TARGET ${target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${android_proj_bin_dir}/bin/${target}-debug.apk" "${OpenCV_BINARY_DIR}/bin/${target}.apk")
     if(INSTALL_ANDROID_EXAMPLES AND "${target}" MATCHES "^example-")
-      #apk
+      get_filename_component(sample_dir "${path}" NAME)
+      # apk
       install(FILES "${OpenCV_BINARY_DIR}/bin/${target}.apk" DESTINATION "samples" COMPONENT samples)
-      get_filename_component(sample_dir "${path}" NAME)
+      # clear "external" project files (need to remove files generated by 'android' tool)
+      set(external_target_files ${ANDROID_PROJECT_FILES})
+      ocv_list_add_prefix(external_target_files "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/samples/${sample_dir}/")
+      install(CODE "
+MESSAGE(STATUS \"Cleaning generated project files from Android sample install directory: ${sample_dir}\")
+FOREACH(f ${ANDROID_PROJECT_FILES})
+  FILE(REMOVE \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/samples/${sample_dir}/\${f}\")
+ENDFOREACH()
+" COMPONENT samples)
       #java part
       list(REMOVE_ITEM android_proj_files ${ANDROID_MANIFEST_FILE})
       foreach(f ${android_proj_files} ${ANDROID_MANIFEST_FILE})
@@ -368,11 +377,15 @@
       if(android_proj_lib_deps_commands)
         set(inst_lib_opt " --library ../../sdk/java")
       endif()
-      install(CODE "EXECUTE_PROCESS(COMMAND ${ANDROID_EXECUTABLE} --silent update project --path . --target \"${android_proj_sdk_target}\" --name \"${target}\" ${inst_lib_opt}
-                                    WORKING_DIRECTORY \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/samples/${sample_dir}\"
-                                   )"  COMPONENT samples)
-      #empty 'gen'
-      install(CODE "MAKE_DIRECTORY(\"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/samples/${sample_dir}/gen\")" COMPONENT samples)
+      install(CODE "
+MESSAGE(STATUS \"Fixing Android library reference for sample: ${sample_dir}\")
+EXECUTE_PROCESS(
+    COMMAND ${ANDROID_EXECUTABLE} --silent update project --path . --target \"${android_proj_sdk_target}\" --name \"${target}\" ${inst_lib_opt}
+    WORKING_DIRECTORY \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/samples/${sample_dir}\"
+)
+" COMPONENT samples)
+      # empty 'gen'
+      install(CODE "FILE(MAKE_DIRECTORY \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/samples/${sample_dir}/gen\")" COMPONENT samples)
     endif()
   endif()
 endmacro()


[test] Add clang profiling library.

[test] Add clang profiling library.

--- cmake/WintermuteDependencies.cmake
+++ cmake/WintermuteDependencies.cmake
@@ -62,6 +62,9 @@
 endif()

 if (CMAKE_BUILD_TYPE STREQUAL "Debug")
-  set(WINTERMUTE_LIBRARIES gcov ${WINTERMUTE_LIBRARIES})
-  message(STATUS "Added `-gcov` to the libraries to be used.")
+  if(CMAKE_COMPILER_IS_GNUCXX)
+    set(WINTERMUTE_LIBRARIES gcov ${WINTERMUTE_LIBRARIES})
+  elseif(CMAKE_CXX_COMPILER STREQUAL "Clang")
+    set(WINTERMUTE_LIBRARIES profile_rt ${WINTERMUTE_LIBRARIES})
+  endif()
 endif()


Thrift 0.9.2 (#1082)

Thrift 0.9.2 (#1082)

--- cmake/projects/thrift/hunter.cmake
+++ cmake/projects/thrift/hunter.cmake
@@ -1,7 +1,6 @@
 # !!! DO NOT PLACE HEADER GUARDS HERE !!!

 include(hunter_add_version)
-include(hunter_cacheable)
 include(hunter_cmake_args)
 include(hunter_download)
 include(hunter_pick_scheme)
@@ -11,6 +10,12 @@
     VERSION "0.10.0"
     URL "https://github.com/hunter-packages/thrift/archive/v0.10.0-p0.tar.gz"
     SHA1 "e346fd04d2228e4d08df363b4f260d92d12e7b67")
+
+hunter_add_version(
+    PACKAGE_NAME thrift
+    VERSION "0.9.2"
+    URL "https://github.com/hunter-packages/thrift/archive/v0.9.2-p0.tar.gz"
+    SHA1 "a53f54ca03e4535b45f74bb71b07f82e0dda6640")

 hunter_cmake_args(thrift CMAKE_ARGS
     BUILD_TESTING=OFF
@@ -24,5 +29,5 @@
     WITH_PLUGIN=OFF)

 hunter_pick_scheme(DEFAULT url_sha1_cmake)
-hunter_cacheable(thrift)
+# Not cachable due to dependency on bison
 hunter_download(PACKAGE_NAME thrift)


Revert "Cleanup"

Revert "Cleanup"

This reverts commit 7fa771e0f37d4a081888dbe7037a1466c8a24a01.

Should have been on a branch.

--- cmake_modules/TokuThirdParty.cmake
+++ cmake_modules/TokuThirdParty.cmake
@@ -118,8 +118,12 @@
           -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
           -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
    )
+#  ExternalProject_Add_Step(backup-enterprise
+#        COMMAND cp "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/libHotBackup.so"
   add_library(HotBackup SHARED IMPORTED GLOBAL)
   set_property(TARGET HotBackup PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/backup-enterprise/lib/libHotBackup.so)
+#  set_target_properties(HotBackup PROPERTIES IMPORTED_LOCATION
+#       "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib/libHotBackup.so")
   install(DIRECTORY "${install_dir}/lib" DESTINATION .
           COMPONENT tokukv_libs_extra)
 endif ()


fixed qhull cmake files (thanks Nizar!)

fixed qhull cmake files (thanks Nizar!)

git-svn-id: 5398946ba177a3e438c2dae55e2cdfc2fb96c905@597 a9d63959-f2ad-4865-b262-bf0e56cfafb6

--- cmake/Modules/FindQhull.cmake
+++ cmake/Modules/FindQhull.cmake
@@ -7,17 +7,15 @@
 # QHULL_LIBRARIES - Libraries needed to use QHULL.
 # QHULL_DEFINITIONS - Compiler flags for QHULL.

-#find_path(QHULL_INCLUDE_DIR qhull/qhull.h)
 find_path(QHULL_INCLUDE_DIR qhull.h
           HINTS ${QHULL_ROOT}
-          PATH_SUFFIXES qhull src)
+          PATH_SUFFIXES qhull src/libqhull libqhull)

-#find_library(QHULL_LIBRARY qhull)
 find_library(QHULL_LIBRARY qhull
              HINTS ${QHULL_ROOT}
              PATH_SUFFIXES project)

-set(QHULL_INCLUDE_DIRS ${QHULL_INCLUDE_DIR}/qhull ${QHULL_INCLUDE_DIR})
+set(QHULL_INCLUDE_DIRS ${QHULL_INCLUDE_DIR})
 set(QHULL_LIBRARIES ${QHULL_LIBRARY})

 include(FindPackageHandleStandardArgs)


Set protobuf CMAKE_INSTALL_LIBDIR to fixed value lib

--- cmake/external/protobuf.cmake
+++ cmake/external/protobuf.cmake
@@ -29,17 +29,12 @@
         "${PROTOBUF_INSTALL_DIR}/lib/libprotoc.lib" CACHE FILEPATH "protoc library." FORCE)
   SET(PROTOBUF_PROTOC_EXECUTABLE "${PROTOBUF_INSTALL_DIR}/bin/protoc.exe" CACHE FILEPATH "protobuf executable." FORCE)
 ELSE(WIN32)
-  IF(${HOST_SYSTEM} STREQUAL "centos")
-    SET(LIB "lib64")
-  ELSE()
-    SET(LIB "lib")
-  ENDIF()
   SET(PROTOBUF_LITE_LIBRARY
-        "${PROTOBUF_INSTALL_DIR}/${LIB}/libprotobuf-lite.a" CACHE FILEPATH "protobuf lite library." FORCE)
+        "${PROTOBUF_INSTALL_DIR}/lib/libprotobuf-lite.a" CACHE FILEPATH "protobuf lite library." FORCE)
   SET(PROTOBUF_LIBRARY
-        "${PROTOBUF_INSTALL_DIR}/${LIB}/libprotobuf.a" CACHE FILEPATH "protobuf library." FORCE)
+        "${PROTOBUF_INSTALL_DIR}/lib/libprotobuf.a" CACHE FILEPATH "protobuf library." FORCE)
   SET(PROTOBUF_PROTOC_LIBRARY
-        "${PROTOBUF_INSTALL_DIR}/${LIB}/libprotoc.a" CACHE FILEPATH "protoc library." FORCE)
+        "${PROTOBUF_INSTALL_DIR}/lib/libprotoc.a" CACHE FILEPATH "protoc library." FORCE)
   SET(PROTOBUF_PROTOC_EXECUTABLE "${PROTOBUF_INSTALL_DIR}/bin/protoc" CACHE FILEPATH "protobuf executable." FORCE)
 ENDIF(WIN32)

@@ -58,6 +53,7 @@
     -DCMAKE_POSITION_INDEPENDENT_CODE=ON
     -DCMAKE_BUILD_TYPE=Release
     -DCMAKE_INSTALL_PREFIX=${PROTOBUF_INSTALL_DIR}
+    -DCMAKE_INSTALL_LIBDIR=lib
 )

 LIST(APPEND external_project_dependencies protobuf)


little bug

little bug

--- adm_local_without_kernel/cmake_files/FindMEDFile.cmake
+++ adm_local_without_kernel/cmake_files/FindMEDFile.cmake
@@ -25,7 +25,7 @@

 SET(MEDFILE_ROOT_DIR $ENV{MEDFILE_ROOT_DIR} CACHE PATH "Path to the MEDFile.")
 IF(MEDFILE_ROOT_DIR)
-  LIST(APPEND CMAKE_PREFIX_PATH "${CPPUNIT_ROOT_DIR}")
+  LIST(APPEND CMAKE_PREFIX_PATH "${MEDFILE_ROOT_DIR}")
 ENDIF(MEDFILE_ROOT_DIR)

 FIND_PATH(MEDFILE_INCLUDE_DIRS med.h)


rpi: adjusting toolchain for rpi

rpi: adjusting toolchain for rpi

--- toolchains/pi-toolchain.cmake
+++ toolchains/pi-toolchain.cmake
@@ -1,7 +1,7 @@
 SET(CMAKE_SYSTEM_NAME Linux)
 SET(CMAKE_SYSTEM_VERSION 1.0.0)

-SET(TOOLCHAIN_ROOT /home/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf)
+SET(TOOLCHAIN_ROOT ${RPI_TOOLCHAIN}/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf)
 SET(TOOLCHAIN_SYSROOT ${TOOLCHAIN_ROOT}/arm-linux-gnueabihf/sysroot)

 # specify the cross compiler


ARROW-17494: [C++] Fix substrait tests linkage on static builds (#13939)

Authored-by: Raúl Cumplido <59d4da135a4a8d271cfab38e4b71ac8d4bb78fb2@gmail.com>
Signed-off-by: Sutou Kouhei <73218711cdd5d5c30ac66da3cc4d9d9204caf34b@clear-code.com>

--- cpp/cmake_modules/BuildUtils.cmake
+++ cpp/cmake_modules/BuildUtils.cmake
@@ -399,8 +399,8 @@
     endif()

     if(ARG_STATIC_LINK_LIBS)
-      target_link_libraries(${LIB_NAME}_static LINK_PRIVATE
-                            "$<BUILD_INTERFACE:${ARG_STATIC_LINK_LIBS}>")
+      target_link_libraries(${LIB_NAME}_static
+                            PUBLIC "$<BUILD_INTERFACE:${ARG_STATIC_LINK_LIBS}>")
       if(USE_OBJLIB)
         # Ensure that dependencies are built before compilation of objects in
         # object library, rather than only before the final link step


Boost 1.67: ZLIB detection is broken on Android

--- cmake/modules/hunter_boost_component_b2_args.cmake
+++ cmake/modules/hunter_boost_component_b2_args.cmake
@@ -10,17 +10,15 @@
 include("${CMAKE_CURRENT_LIST_DIR}/../Hunter")

 function(hunter_boost_component_b2_args compName boostCmakeArgs outList)
-  string(COMPARE EQUAL "${CMAKE_HOST_SYSTEM_NAME}" "Linux" host_is_linux)
-  if(ANDROID AND host_is_linux)
+  if(ANDROID)
     set(lib_detect_broken YES)
   else()
     set(lib_detect_broken NO)
   endif()
   set(
       lib_detect_broken_message
-      "ZLIB/BZip2 detection broken for Android if host is Linux."
-      " As a workaround you can build package on OSX host and upload binaries"
-      " to server. See details: https://github.com/ruslo/hunter/issues/417#issuecomment-220563231"
+      "ZLIB/BZip2 detection broken for Android."
+      "See issue: https://github.com/boostorg/build/issues/300"
   )

   string(TOUPPER ${compName} upperCompName)


fix oidn superbuild typo

fix oidn superbuild typo

--- scripts/superbuild/dependencies/dep_oidn.cmake
+++ scripts/superbuild/dependencies/dep_oidn.cmake
@@ -41,7 +41,7 @@
       -DCMAKE_INSTALL_DOCDIR=${CMAKE_INSTALL_DOCDIR}
       -DCMAKE_INSTALL_BINDIR=${CMAKE_INSTALL_BINDIR}
       -DCMAKE_BUILD_TYPE=Release
-      $<$<BOOL:${DOWNLOAD_TBB}>:-TBB_ROOT=${TBB_PATH}>
+      $<$<BOOL:${DOWNLOAD_TBB}>:-DTBB_ROOT=${TBB_PATH}>
     BUILD_COMMAND ${DEFAULT_BUILD_COMMAND}
     BUILD_ALWAYS ${ALWAYS_REBUILD}
   )


fix mapping zen3 march flags to icc

fix mapping zen3 march flags to icc

--- cmake/OptimizeForArchitecture.cmake
+++ cmake/OptimizeForArchitecture.cmake
@@ -521,8 +521,9 @@
          set(OFA_map_penryn "-xSSSE3")
          set(OFA_map_merom "-xSSSE3")
          set(OFA_map_core2 "-xSSE3")
-         set(OFA_map_zen3 "-xAVX2")
-         set(OFA_map_zen "-xAVX2")
+         set(OFA_map_znver3 "-mavx2") # -xAVX2 does not work and causes this runtime check to appear:
+         set(OFA_map_znver2 "-mavx2") # Please verify that both the operating system and the processor support Intel(R) X87, CMOV, MMX, FXSAVE, SSE, SSE2, SSE3, SSSE3, SSE4_1, SSE4_2, MOVBE, POPCNT, AVX, F16C, FMA, BMI, LZCNT and AVX2 instructions.
+         set(OFA_map_znver1 "-mavx2")
          set(_ok FALSE)
          foreach(arch ${_march_flag_list})
             if(DEFINED OFA_map_${arch})


EKF2 sitl target: start normal app selection

--- cmake/configs/posix_sitl_ekf2.cmake
+++ cmake/configs/posix_sitl_ekf2.cmake
@@ -32,18 +32,24 @@
 	modules/sensors
 	modules/simulator
 	modules/mavlink
-	modules/dataman
 	modules/attitude_estimator_ekf
-	#modules/attitude_estimator_q
+	modules/attitude_estimator_q
 	modules/ekf_att_pos_estimator
+	modules/ekf2
 	modules/position_estimator_inav
+	modules/navigator
+	modules/vtol_att_control
 	modules/mc_pos_control
 	modules/mc_att_control
-	modules/navigator
+	modules/mc_pos_control_multiplatform
+	modules/mc_att_control_multiplatform
+	modules/land_detector
+	modules/fw_att_control
+	modules/fw_pos_control_l1
+	modules/dataman
+	modules/sdlog2
 	modules/commander
-	modules/vtol_att_control
 	modules/controllib
-	modules/ekf2
 	lib/mathlib
 	lib/mathlib/math/filter
 	lib/conversion
@@ -54,6 +60,8 @@
 	lib/launchdetection
 	lib/terrain_estimation
 	lib/runway_takeoff
+	lib/tailsitter_recovery
+	examples/px4_simple_app
 	)

 set(config_extra_builtin_cmds


Renamed project from FILE_CONVERTER to CONVERTERS, so updated CXXTEST_INCLUDE_DIR.

--- converters/test/CxxTest.cmake
+++ converters/test/CxxTest.cmake
@@ -1,5 +1,5 @@
 # set root of cxxtest tree and add it to include directories
-SET(CXXTEST_INCLUDE_DIR "${FILE_CONVERTER_SOURCE_DIR}/../cxxtest")
+SET(CXXTEST_INCLUDE_DIR "${CONVERTERS_SOURCE_DIR}/../cxxtest")
 INCLUDE_DIRECTORIES(${CXXTEST_INCLUDE_DIR})

 # test generator
@@ -26,5 +26,4 @@
     # run compiled test
     ADD_TEST(${_cxxtest_testname} ${CMAKE_CURRENT_BINARY_DIR}/${_cxxtest_testname})

-    MESSAGE(STATUS "HEY THERE!")
 ENDMACRO(CXXTEST_ADD_TEST)


BUG: fix update directory

BUG: fix update directory

--- src/Testing/Dashboard/elxDashboardCommon.cmake
+++ src/Testing/Dashboard/elxDashboardCommon.cmake
@@ -228,7 +228,7 @@
 else()
   write_cache()
   ctest_start( ${dashboard_model} )
-  ctest_update( SOURCE ${CTEST_DASHBOARD_ROOT} )
+  ctest_update( SOURCE ${CTEST_DASHBOARD_ROOT}/elastix )
   # run cmake twice; this seems to be necessary, otherwise the
   # KNN lib is not built
   ctest_configure()


added main library to linking phase

added main library to linking phase

--- cmake/tests.cmake
+++ cmake/tests.cmake
@@ -4,6 +4,7 @@
 add_executable(mts ${SOURCES_MT})

 foreach(app mts uts)
+  target_link_libraries(${app} but)
   target_link_libraries(${app} gmock_main gmock gtest)
   set_target_properties(${app} PROPERTIES COMPILE_FLAGS --coverage)
   set_target_properties(${app} PROPERTIES LINK_FLAGS    --coverage)


Silence a debug message

Silence a debug message

--- cmake/utils.cmake
+++ cmake/utils.cmake
@@ -74,7 +74,7 @@
           if (NOT "${line_match}" STREQUAL "")
 #            message(STATUS "IFNEQ: ${line_match} first: ${CMAKE_MATCH_1} second: ${CMAKE_MATCH_2}")
             if (NOT ( ${${CMAKE_MATCH_1}} STREQUAL ${CMAKE_MATCH_2}))
-              message (STATUS "condition is true")
+#              message (STATUS "condition is true")
               set (IfElse 1)
             else ()
               set (IfElse 2)


OpenCV-extra: Disable 'hdf' component

OpenCV-extra: Disable 'hdf' component

--- examples/OpenCV-extra/config.cmake
+++ examples/OpenCV-extra/config.cmake
@@ -6,4 +6,5 @@
         BUILD_opencv_dnn=OFF
 		#disabled because of incorrect cmake install for osx/ios
         BUILD_opencv_xobjdetect=OFF
+        BUILD_opencv_hdf=OFF # not hunterized yet
 )


BUG: Update LabelErodeDilate

BUG: Update LabelErodeDilate

Change-Id: I640ec89f9a213073c11d7b70b74b30d44627567b

--- Modules/Remote/LabelErodeDilate.remote.cmake
+++ Modules/Remote/LabelErodeDilate.remote.cmake
@@ -7,8 +7,6 @@
   http://www.insight-journal.org/browse/publication/228
   https://hdl.handle.net/10380/3399"
   #UPSTREAM_GIT_REPOSITORY
-  #GIT_REPOSITORY ${git_protocol}://github.com/richardbeare/LabelErodeDilate.git
-  # Clone is not synchronized correctly with upstream.
-  GIT_REPOSITORY ${git_protocol}://github.com/InsightSoftwareConsortium/LabelErodeDilate.git
-  GIT_TAG 911949c765f5bfef1f428c07358d5667e226bdc4
+  GIT_REPOSITORY ${git_protocol}://github.com/richardbeare/LabelErodeDilate.git
+  GIT_TAG 5674eb1c6c0a8c7ec973af72c6b018f78891fa89
   )


Bring back missing symlink for yarn process.

This accidentally got removed during the last yarn upgrade.

--- build/cmake/dev/nodejs.cmake
+++ build/cmake/dev/nodejs.cmake
@@ -16,6 +16,7 @@
   CONFIGURE_COMMAND ""
   BUILD_COMMAND ""
   INSTALL_COMMAND rsync -a -v --delete <SOURCE_DIR>/ ${DEV_INSTALL_PREFIX}/yarn/
+    COMMAND cd ${DEV_INSTALL_PREFIX}/bin && ln -snf ../yarn/bin/yarn ./yarn
     # Remove the previous bin symlink that was necessary.
     COMMAND rm -f ${DEV_INSTALL_PREFIX}/bin/yarn.js
 )


Check return value in PostInstall (#325)

## Technical Description

`PostInstall.cmake` should also check the return value of the process that runs the python script.

Relates #324

--- dawn/bundle/PostInstall.cmake
+++ dawn/bundle/PostInstall.cmake
@@ -16,11 +16,15 @@

 set(ENV{PYTHONPATH} "$ENV{PYTHONPATH}:${CMAKE_INSTALL_PREFIX}/python")
 foreach(example ${examples})
-  execute_process(COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/examples/python/${example}.py)
+  execute_process(COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/examples/python/${example}.py RESULT_VARIABLE res)
+  if(NOT ${res} EQUAL 0)
+    message(FATAL_ERROR "SIR Python example did not run. TEST failed")
+  endif()
+
   if(${example} IN_LIST verified_examples)
     execute_process(COMMAND diff ${CMAKE_INSTALL_PREFIX}/examples/python/data/${example}.cpp ${CMAKE_INSTALL_PREFIX}/examples/python/data/${example}_ref.cpp RESULT_VARIABLE res)

-    if(NOT ${res} EQUAL 0)
+    if(NOT ${res} EQUAL 0)
       message(FATAL_ERROR "SIR Python example ${example} TEST failed")
     else()
       message("SIR Python example ${example} TEST succeded")


Remove obsolete file

Remove obsolete file

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

--- deal.II/contrib/cmake/macros/macro_list_contains.cmake
+++ deal.II/contrib/cmake/macros/macro_list_contains.cmake
@@ -1,9 +0,0 @@
-# grml...
-MACRO(LIST_CONTAINS var value)
-  SET(${var})
-  FOREACH (value2 ${ARGN})
-    IF (${value} STREQUAL ${value2})
-      SET(${var} TRUE)
-    ENDIF (${value} STREQUAL ${value2})
-  ENDFOREACH (value2)
-ENDMACRO(LIST_CONTAINS)


fix cmake lint failures

fix cmake lint failures

--- connext_cmake_module/cmake/Modules/FindConnext.cmake
+++ connext_cmake_module/cmake/Modules/FindConnext.cmake
@@ -40,6 +40,8 @@
 #   # use Connext_* variables
 #
 ###############################################################################
+
+# lint_cmake: -convention/filename, -package/stdargs

 set(Connext_FOUND FALSE)

@@ -238,3 +240,16 @@
 if(Connext_FOUND AND NOT WIN32)
   list(APPEND Connext_LIBRARIES "pthread" "dl")
 endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Connext
+  FOUND_VAR Connext_FOUND
+  REQUIRED_VARS
+    Connext_INCLUDE_DIRS
+    Connext_HOME
+    Connext_LIBRARIES
+    Connext_LIBRARY_DIRS
+    Connext_LIBRARY_DIR
+    Connext_DEFINITIONS
+    Connext_DDSGEN2
+)


Formatting

Formatting

--- cmake/MyPackageLibrary.cmake
+++ cmake/MyPackageLibrary.cmake
@@ -69,16 +69,15 @@
   SET (_project_include_directories "${PROJECT_SOURCE_DIR}/output/include" "${PROJECT_SOURCE_DIR}/include")
   FOREACH (_target ${PROJECT_NAME} ${PROJECT_NAME}_static)
     FOREACH (_include_directory ${_project_include_directories})
-	  #
-	  # The "internal" include directory is always internal, indeed
-	  #
-	  SET (_l_directory ${_include_directory})
+      #
+      # The "internal" include directory is always internal, indeed
+      #
       STRING (TOLOWER "${_include_directory}" _include_directory_lower )
       IF ( _include_directory_lower MATCHES "/internal/?$" )
-	    SET (_include_directory_scope "PRIVATE")
-	  ELSE ()
-	    SET (_include_directory_scope "PUBLIC")
-	  ENDIF ()
+	SET (_include_directory_scope "PRIVATE")
+      ELSE ()
+	SET (_include_directory_scope "PUBLIC")
+      ENDIF ()
       IF (MYPACKAGE_DEBUG)
         MESSAGE (STATUS "[${PROJECT_NAME}-LIBRARY-DEBUG] Adding ${_include_directory_scope} ${_include_directory} include dependency to ${_target}")
       ENDIF ()


fixed CC for CAMRA

fixed CC for CAMRA

--- cmake/OpenCVDetectCUDA.cmake
+++ cmake/OpenCVDetectCUDA.cmake
@@ -34,7 +34,7 @@
   message(STATUS "CUDA detected: " ${CUDA_VERSION})

   if (CARMA)
-    set(CUDA_ARCH_BIN "3.0" CACHE STRING "Specify 'real' GPU architectures to build binaries for, BIN(PTX) format is supported")
+    set(CUDA_ARCH_BIN "2.1(2.0) 3.0" CACHE STRING "Specify 'real' GPU architectures to build binaries for, BIN(PTX) format is supported")
     set(CUDA_ARCH_PTX "3.0" CACHE STRING "Specify 'virtual' PTX architectures to build PTX intermediate code for")
   else()
     set(CUDA_ARCH_BIN "1.1 1.2 1.3 2.0 2.1(2.0) 3.0" CACHE STRING "Specify 'real' GPU architectures to build binaries for, BIN(PTX) format is supported")


Streamlined mexext detection, with removal of trailing whitespace/newlines handled by execute_process

--- cmake/OpenCVFindMatlab.cmake
+++ cmake/OpenCVFindMatlab.cmake
@@ -125,15 +125,13 @@
 # sets the variable MATLAB_FOUND to TRUE
 function(locate_matlab_components MATLAB_ROOT_DIR)
   # get the mex extension
-  if (UNIX)
-    execute_process(COMMAND ${MATLAB_ROOT_DIR}/bin/mexext OUTPUT_VARIABLE MATLAB_MEXEXT_)
-  elseif (WIN32)
-    execute_process(COMMAND ${MATLAB_ROOT_DIR}/bin/mexext.bat OUTPUT_VARIABLE MATLAB_MEXEXT_)
-  endif()
+  find_file(MATLAB_MEXEXT_SCRIPT_ NAMES mexext mexext.bat PATHS ${MATLAB_ROOT_DIR}/bin NO_DEFAULT_PATH)
+  execute_process(COMMAND ${MATLAB_MEXEXT_SCRIPT_}
+                  OUTPUT_VARIABLE MATLAB_MEXEXT_
+                  OUTPUT_STRIP_TRAILING_WHITESPACE)
   if (NOT MATLAB_MEXEXT_)
     return()
   endif()
-  string(STRIP ${MATLAB_MEXEXT_} MATLAB_MEXEXT_)

   # map the mexext to an architecture extension
   set(ARCHITECTURES_ "maci64" "maci" "glnxa64" "glnx64" "sol64" "sola64" "win32" "win64" )