[metal] Add a TI_WITH_METAL option (#3510)

* TI_WITH_METAL

* [skip ci] add comment

* seems like skip ci isn't working lol

--- cmake/TaichiCore.cmake
+++ cmake/TaichiCore.cmake
@@ -1,10 +1,12 @@
 option(USE_STDCPP "Use -stdlib=libc++" OFF)
 option(TI_WITH_LLVM "Build with LLVM backends" ON)
+option(TI_WITH_METAL "Build with the Metal backend" ON)
 option(TI_WITH_CUDA "Build with the CUDA backend" ON)
 option(TI_WITH_CUDA_TOOLKIT "Build with the CUDA toolkit" OFF)
 option(TI_WITH_OPENGL "Build with the OpenGL backend" ON)
 option(TI_WITH_CC "Build with the C backend" ON)
 option(TI_WITH_VULKAN "Build with the Vulkan backend" OFF)
+

 if(UNIX AND NOT APPLE)
     # Handy helper for Linux
@@ -125,8 +127,15 @@
     set(CUDA_VERSION 10.0)
 endif()

-# TODO(#529) include Metal source only on Apple MacOS, and OpenGL only when TI_WITH_OPENGL is ON
-list(APPEND TAICHI_CORE_SOURCE ${TAICHI_METAL_SOURCE})
+
+# By default, TI_WITH_METAL is ON for all platforms.
+# As of right now, on non-macOS platforms, the metal backend won't work at all.
+# We have future plans to allow metal AOT to run on non-macOS devices.
+if (TI_WITH_METAL)
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTI_WITH_METAL")
+    list(APPEND TAICHI_CORE_SOURCE ${TAICHI_METAL_SOURCE})
+endif()
+

 if (TI_WITH_OPENGL)
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTI_WITH_OPENGL")


cmake: Fail when zephyr_sources() is called on a directory

https://github.com/zephyrproject-rtos/zephyr/issues/4864 revealed that
calling zephyr_sources() on a directory will silently omit the
directory. This is a clear user error and should be immediately
flagged as such.

Signed-off-by: Sebastian Boe <edee888afd63e94916688495334700803eba20a0@nordicsemi.no>

--- cmake/extensions.cmake
+++ cmake/extensions.cmake
@@ -47,6 +47,11 @@
     else()
       set(path ${CMAKE_CURRENT_SOURCE_DIR}/${arg})
     endif()
+
+    if(IS_DIRECTORY ${path})
+      message(FATAL_ERROR "zephyr_sources() was called on a directory")
+    endif()
+
     target_sources(zephyr PRIVATE ${path})
   endforeach()
 endfunction()


Revert debug build option.

Revert debug build option.

--- build_settings.cmake
+++ build_settings.cmake
@@ -73,7 +73,7 @@
 endif()

 # C and C++ compiler flags
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fno-omit-frame-pointer ${C_WARN_OPTS} -fPIC ${VESPA_CXX_ABI_FLAGS} ${VESPA_XXHASH_DEFINE} -DBOOST_DISABLE_ASSERTS ${VESPA_CPU_ARCH_FLAGS} ${EXTRA_C_FLAGS}")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O3 -fno-omit-frame-pointer ${C_WARN_OPTS} -fPIC ${VESPA_CXX_ABI_FLAGS} ${VESPA_XXHASH_DEFINE} -DBOOST_DISABLE_ASSERTS ${VESPA_CPU_ARCH_FLAGS} ${EXTRA_C_FLAGS}")
 # AddressSanitizer/ThreadSanitizer work for both GCC and Clang
 if (VESPA_USE_SANITIZER)
     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=${VESPA_USE_SANITIZER}")


ENH: Support using HTTP or GIT as the git protocol

--- SuperBuild.cmake
+++ SuperBuild.cmake
@@ -44,6 +44,15 @@
   if( NOT GIT_EXECUTABLE )
     find_package( Git REQUIRED )
   endif( NOT GIT_EXECUTABLE )
+
+  option( GIT_PROTOCOL_HTTP
+    "Use HTTP for git access (useful if behind a firewall)" OFF )
+  if( GIT_PROTOCOL_HTTP )
+    set( GIT_PROTOCOL "http" CACHE STRING "Git protocol for file transfer" )
+  else( GIT_PROTOCOL_HTTP )
+    set( GIT_PROTOCOL "git" CACHE STRING "Git protocol for file transfer" )
+  endif( GIT_PROTOCOL_HTTP )
+  mark_as_advanced( GIT_PROTOCOL )

   ##
   ## Insight
@@ -88,6 +97,15 @@
     if( NOT GIT_EXECUTABLE )
       find_package( Git REQUIRED )
     endif( NOT GIT_EXECUTABLE )
+
+    option( GIT_PROTOCOL_HTTP
+      "Use HTTP for git access (useful if behind a firewall)" OFF )
+    if( GIT_PROTOCOL_HTTP )
+      set( GIT_PROTOCOL "http" CACHE STRING "Git protocol for file transfer" )
+    else( GIT_PROTOCOL_HTTP )
+      set( GIT_PROTOCOL "git" CACHE STRING "Git protocol for file transfer" )
+    endif( GIT_PROTOCOL_HTTP )
+    mark_as_advanced( GIT_PROTOCOL )

     if( TubeTK_USE_QT )

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

     if( TubeTK_USE_VTK )
       if( NOT USE_SYSTEM_VTK )


testing: build qs extension

testing: build qs extension


MAINT: simplified unit-test-program-names.

--- cmake/DOMacros.cmake
+++ cmake/DOMacros.cmake
@@ -149,8 +149,10 @@
     #   Specify the source files.
     add_library(DO_${_library_name} ${library_type} ${_hdr_files} ${_src_files})
     # Link with external libraries
-    message(STATUS
-      "[DO] Linking project 'DO_${_library_name}' with '${_lib_dependencies}'")
+    message(
+      STATUS "[DO] Linking project 'DO_${_library_name}' with "
+             "'${_lib_dependencies}'"
+    )
     target_link_libraries(DO_${_library_name} ${_lib_dependencies})
     if (DEFINED ENABLE_CXX11)
       set_target_properties(DO_${_library_name} PROPERTIES
@@ -249,45 +251,48 @@
   if (POLICY CMP0020)
     cmake_policy(SET CMP0020 OLD)
   endif (POLICY CMP0020)
-
+
   # Create a variable containing the list of source files
   set(_srcs_var ${_srcs})
-
+
   # Get extra arguments.
   set(extra_macro_args ${ARGN})
   list(LENGTH extra_macro_args num_extra_args)
-
+
   # Check if a name is defined for a group of unit tests.
   if (${num_extra_args} GREATER 0)
     list(GET extra_macro_args 0 test_group_name)
   endif ()
-
+
   # Check if we want to use precompiled header.
   if (${num_extra_args} GREATER 1)
     list(GET extra_macro_args -1 pch)
   endif ()
-
+
   if (DEFINED pch)
     do_substep_message(
-    "Activating precompiled header: '${pch}' for unit test: 'DO_${_unit_test_name}_test'")
+      "Activating precompiled header: '${pch}' for unit test: "
+      "'DO_${_unit_test_name}_test'"
+    )
     list(APPEND _srcs_var ${pch})
     do_add_msvc_precompiled_header(${pch} _srcs_var ${_unit_test_name}_test_PCH)
   endif ()
-
+
   # Create the unit test project
   include_directories(${gtest_DIR}/include)
-  add_executable(DO_${_unit_test_name}_test ${_srcs_var})
-  target_link_libraries(DO_${_unit_test_name}_test
+  add_executable(${_unit_test_name} ${_srcs_var})
+  target_link_libraries(${_unit_test_name}
                         ${_additional_lib_deps}
                         gtest)
-  set_target_properties(DO_${_unit_test_name}_test PROPERTIES
+  set_target_properties(
+    ${_unit_test_name} PROPERTIES
     COMPILE_FLAGS "${ENABLE_CXX11} -DSRCDIR=${CMAKE_CURRENT_SOURCE_DIR}"
     COMPILE_DEFINITIONS DO_STATIC)
-  add_test(DO_${_unit_test_name}_test
+  add_test(${_unit_test_name}
            "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/DO_${_unit_test_name}_test")

   if (DEFINED test_group_name)
-    set_property(TARGET DO_${_unit_test_name}_test
+    set_property(TARGET ${_unit_test_name}
                  PROPERTY FOLDER "DO Unit Tests/${test_group_name}")
   endif ()
 endfunction (do_unit_test)


another typo

another typo

--- cmake/DeployQt.cmake
+++ cmake/DeployQt.cmake
@@ -53,7 +53,7 @@
         COMMENT "Deploying Qt..."
     )

-    install(DIRECTORY "$<TARGET_FILE_DIR:${target}>/windeployqt" DESTINATION bin)
+    install(DIRECTORY "$<TARGET_FILE_DIR:${target}>/windeployqt/" DESTINATION bin)

     # windeployqt doesn't work correctly with the system runtime libraries,
     # so we fall back to one of CMake's own modules for copying them over


added compiler flags to externals

added compiler flags to externals

--- cmake/External.cmake
+++ cmake/External.cmake
@@ -108,7 +108,9 @@
   set(ARGN_EXT "${ARGN}")
   list(APPEND ARGN_EXT CMAKE_ARGS
     ${BASE_ARGS}
-    "-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>")
+    "-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>"
+    "-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}"
+    "-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}")

   # Add external project.
   ExternalProject_Add(${TARGET} "${ARGN_EXT}")


hopefully reordering works

hopefully reordering works

--- cmake/FindCOIN.cmake
+++ cmake/FindCOIN.cmake
@@ -72,6 +72,13 @@
     )
 MESSAGE("\tCOIN CGL: ${COIN_CGL_LIBRARY}")

+FIND_LIBRARY(COIN_CLP_SOLVER_LIBRARY
+    NAMES ClpSolver libClpSolver libClpSolver.so.0
+    HINTS ${COIN_INCLUDE_DIR}/../../lib/
+    HINTS "${COIN_ROOT_DIR}/lib"
+    )
+MESSAGE("\tCOIN CLP SOLVER: ${COIN_CLP_SOLVER_LIBRARY}")
+
 FIND_LIBRARY(COIN_CLP_LIBRARY
     NAMES Clp libClp libClp.so.0
     HINTS ${COIN_INCLUDE_DIR}/../../lib/
@@ -142,7 +149,7 @@
 #
 IF(COIN_FOUND)
     SET(COIN_INCLUDE_DIRS ${COIN_INCLUDE_DIR})
-    SET(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARY};${COIN_COIN_UTILS_LIBRARY};${COIN_ZLIB_LIBRARY}")
+    SET(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARY};${COIN_COIN_UTILS_LIBRARY};${COIN_ZLIB_LIBRARY};${COIN_CLP_SOLVER_LIBRARY}")
     IF(COIN_ZLIB_LIBRARY)
         SET(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARIES};${COIN_ZLIB_LIBRARY}")
     ENDIF(COIN_ZLIB_LIBRARY)
@@ -152,9 +159,9 @@
     # Not required by cbc v2.5, but required by later versions in which case,
     # the lower line should be commented out and this line used
     #SET(COIN_CBC_LIBRARIES "${COIN_CBC_LIBRARY};${COIN_CBC_SOLVER_LIBRARY};${COIN_CGL_LIBRARY};${COIN_OSI_LIBRARY};${COIN_OSI_CBC_LIBRARY};${COIN_OSI_CLP_LIBRARY};${COIN_CLP_LIBRARIES}")
-    SET(COIN_CBC_LIBRARIES "${COIN_CBC_SOLVER_LIBRARY};${COIN_CBC_LIBRARY};${COIN_CGL_LIBRARY};${COIN_OSI_LIBRARY};${COIN_OSI_CBC_LIBRARY};${COIN_OSI_CLP_LIBRARY};${COIN_CLP_LIBRARIES}")
+    SET(COIN_CBC_LIBRARIES "${COIN_OSI_LIBRARY};${COIN_CLP_LIBRARIES};${COIN_OSI_CLP_LIBRARY};${COIN_CGL_LIBRARY};${COIN_CBC_SOLVER_LIBRARY};${COIN_CBC_LIBRARY};${COIN_OSI_CBC_LIBRARY}")
     #SET(COIN_CBC_LIBRARIES "${COIN_CBC_LIBRARY};${COIN_CBC_SOLVER_LIBRARY};${COIN_CGL_LIBRARY};${COIN_OSI_LIBRARY};${COIN_OSI_CLP_LIBRARY};${COIN_CLP_LIBRARIES}")
-    SET(COIN_LIBRARIES ${COIN_CBC_LIBRARIES})
+    SET(COIN_LIBRARIES "${COIN_CBC_LIBRARIES}")
 ENDIF(COIN_FOUND)

 #


Added check for supported languages

Added check for supported languages

Added a check to overload functions to enable code coverage only
for targets, which are supported by compiler coverage flags. This
prevents errors when there are e.g. fortran targets.

--- cmake/Findgcov.cmake
+++ cmake/Findgcov.cmake
@@ -126,12 +126,44 @@
 # the overloaded functions first and then add_coverage.
 if (ENABLE_COVERAGE_ALL)
 	function(add_executable ARGV)
+		# add executable
 		_add_executable(${ARGV})
+
+		# check if target is supported for code coverage
+		get_target_property(TSOURCES ${ARGV0} SOURCES)
+		foreach (FILE ${TSOURCES})
+			get_source_file_property(SLANG ${FILE} LANGUAGE)
+			if ((NOT ${SLANG} STREQUAL "C") AND (NOT ${SLANG} STREQUAL "CXX"))
+				# Target has source files that are not supported for code
+				# coverage. Do not add coverage for this target and print a
+				# warning.
+				message("-- Code coverage not supported for target ${ARGV0}")
+				return()
+			endif()
+		endforeach ()
+
+		# add coverage
 		add_coverage(${ARGV0})
 	endfunction(add_executable)

 	function(add_library ARGV)
+		# add library
 		_add_library(${ARGV})
+
+		# check if target is supported for code coverage
+		get_target_property(TSOURCES ${ARGV0} SOURCES)
+		foreach (FILE ${TSOURCES})
+			get_source_file_property(SLANG ${FILE} LANGUAGE)
+			if ((NOT ${SLANG} STREQUAL "C") AND (NOT ${SLANG} STREQUAL "CXX"))
+				# Target has source files that are not supported for code
+				# coverage. Do not add coverage for this target and print a
+				# warning.
+				message("-- Code coverage not supported for target ${ARGV0}")
+				return()
+			endif()
+		endforeach ()
+
+		# add coverage
 		add_coverage(${ARGV0})
 	endfunction(add_library)
 endif ()


correct flags

correct flags

--- cmake/compiler.cmake
+++ cmake/compiler.cmake
@@ -1,12 +1,12 @@
 if(CMAKE_Fortran_COMPILER_ID MATCHES "^Intel")
   add_compile_options(
-  "$<IF:$<BOOL:${WIN32}>,/QxHost,-xHost>"
-  "$<$<COMPILE_LANGUAGE:Fortran>:-warn;-heap-arrays>"
-  "$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug>>:-traceback;-debug extended;-check all;-fpe0>"
+  $<IF:$<BOOL:${WIN32}>,/QxHost,-xHost>
+  $<$<COMPILE_LANGUAGE:Fortran>:-warn;-heap-arrays>
+  $<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug>>:-traceback;-debug;-check;-fpe0>
   )
 elseif(CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
   add_compile_options(-march=native -Wall -Wextra
-  "$<$<COMPILE_LANGUAGE:Fortran>:-fimplicit-none>"
+  $<$<COMPILE_LANGUAGE:Fortran>:-fimplicit-none>
   "$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug>>:-ffpe-trap=zero,overflow,underflow>"
   )
 endif()


cmake: require gcc 4.5 at least

cmake: require gcc 4.5 at least

Fixes gh-849 'Compile error on CentOS'

Expliclitly prohibit Gcc versions which do not support lambdas.

--- cmake/compiler.cmake
+++ cmake/compiler.cmake
@@ -14,6 +14,18 @@
     set(CMAKE_COMPILER_IS_CLANG  ON)
     set(CMAKE_COMPILER_IS_GNUCC  OFF)
     set(CMAKE_COMPILER_IS_GNUCXX OFF)
+endif()
+
+#
+# Hard coding the compiler version is ugly from cmake POV, but
+# at least gives user a friendly error message. The most critical
+# demand for C++ compiler is support of C++11 lambdas, added
+# only in version 4.5 https://gcc.gnu.org/projects/cxx0x.html
+#
+if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.5)
+        message(FATAL_ERROR "
+        Your GCC version is ${CMAKE_CXX_COMPILER_VERSION}, please update to version 4.6 or later
+                ")
 endif()

 #


Improve coverage logic.

Improve coverage logic.

--- run_ctest.cmake
+++ run_ctest.cmake
@@ -316,12 +316,15 @@
     endif()
     ctest_coverage()
     find_program(CURL_COMMAND NAMES curl)
+    if(NOT CURL_COMMAND)
+        message(FATAL_ERROR "Curl not found!")
+    endif()
     if(UNIX)
         exec_program(${CURL_COMMAND} $ENV{HOME} ARGS -o $ENV{HOME}/codecov -s https://uploader.codecov.io/latest/linux/codecov)
         exec_program(chmod $ENV{HOME} ARGS +x codecov)
         exec_program($ENV{HOME}/codecov ${CTEST_SOURCE_DIRECTORY} ARGS -X gcov -s ${CTEST_BINARY_DIRECTORY})
     else()
-        exec_program(${CURL_COMMAND} $ENV{HOME} ARGS-o $ENV{HOME}/codecov.exe https://uploader.codecov.io/latest/windows/codecov.exe)
+        exec_program(${CURL_COMMAND} $ENV{HOME} ARGS -o $ENV{HOME}/codecov.exe -s https://uploader.codecov.io/latest/windows/codecov.exe)
         exec_program($ENV{HOME}/codecov.exe ${CTEST_SOURCE_DIRECTORY} ARGS -s ${CTEST_BINARY_DIRECTORY})
     endif()
     if(DEFINED ${CTEST_SUBMIT_URL})


[CMake] set OSX_ARCHITECTURES in `add_swift_target_library_single` (#59922)

This way we configure correctly `libBlocksRuntime`, which is not using
`add_swift_target_library` (where the code for setting `OSX_ARCHITECTURES`
currently lives, see #38415 and #38956)

Addresses rdar://96469791

--- stdlib/cmake/modules/AddSwiftStdlib.cmake
+++ stdlib/cmake/modules/AddSwiftStdlib.cmake
@@ -1371,6 +1371,20 @@
     # emitting warnings about global initializers when it compiles the code.
     list(APPEND swiftlib_link_flags_all "-Xlinker -no_warn_inits")
   endif()
+
+  if(${SWIFTLIB_SINGLE_SDK} IN_LIST SWIFT_APPLE_PLATFORMS)
+    # In the past, we relied on unsetting globally
+    # CMAKE_OSX_ARCHITECTURES to ensure that CMake
+    # would not add the -arch flag. This is no longer
+    # the case  when running on Apple Silicon, when
+    # CMake will enforce a default (see
+    # https://gitlab.kitware.com/cmake/cmake/-/merge_requests/5291)
+    set_property(TARGET ${target} PROPERTY OSX_ARCHITECTURES "${SWIFTLIB_SINGLE_ARCHITECTURE}")
+    if(TARGET "${target_static}")
+      set_property(TARGET ${target_static} PROPERTY OSX_ARCHITECTURES "${SWIFTLIB_SINGLE_ARCHITECTURE}")
+    endif()
+  endif()
+
   target_link_libraries(${target} PRIVATE
     ${link_libraries})
   target_link_directories(${target} PRIVATE
@@ -2188,19 +2202,6 @@
           list(APPEND THIN_INPUT_TARGETS ${VARIANT_NAME})
         endif()
       endif()
-
-      if(sdk IN_LIST SWIFT_APPLE_PLATFORMS)
-        # In the past, we relied on unsetting globally
-        # CMAKE_OSX_ARCHITECTURES to ensure that CMake would
-        # not add the -arch flag
-        # This is no longer the case when running on Apple Silicon,
-        # when CMake will enforce a default (see
-        # https://gitlab.kitware.com/cmake/cmake/-/merge_requests/5291)
-        set_property(TARGET ${VARIANT_NAME} PROPERTY OSX_ARCHITECTURES "${arch}")
-        if (SWIFTLIB_IS_STDLIB AND SWIFTLIB_STATIC)
-          set_property(TARGET ${VARIANT_NAME}-static PROPERTY OSX_ARCHITECTURES "${arch}")
-        endif()
-      endif()
     endforeach()

     # Configure module-only targets


build: cleanup some unnecessary settings for Windows

Windows had moved to C++14 much earlier than the rest of Swift.  This
was required in order to deal with the Windows SDK headers.  Now that
the project has fully moved to C++14, remove the unnecessary settings
for Windows.

--- stdlib/cmake/modules/AddSwiftStdlib.cmake
+++ stdlib/cmake/modules/AddSwiftStdlib.cmake
@@ -879,10 +879,8 @@

   if("${SWIFTLIB_SINGLE_SDK}" STREQUAL "WINDOWS")
     swift_windows_include_for_arch(${SWIFTLIB_SINGLE_ARCHITECTURE} SWIFTLIB_INCLUDE)
-    target_include_directories("${target}" SYSTEM PRIVATE ${SWIFTLIB_INCLUDE})
-    set_target_properties(${target}
-                          PROPERTIES
-                            CXX_STANDARD 14)
+    target_include_directories("${target}" SYSTEM PRIVATE
+      ${SWIFTLIB_INCLUDE})
   endif()

   if("${SWIFTLIB_SINGLE_SDK}" STREQUAL "WINDOWS" AND NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")


CMake: DirectX11 - fix discovery when using MINGW and having W10SDK

--- CMake/Packages/FindDirectX11.cmake
+++ CMake/Packages/FindDirectX11.cmake
@@ -18,7 +18,7 @@
 	include(FindPkgMacros)
 	findpkg_begin(DirectX11)

-	if( NOT MSVC90 )
+	if( MSVC AND NOT MSVC90 )
 		# Windows 10.x SDK
 		get_filename_component(kit10_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot10]" REALPATH)
 		file(GLOB W10SDK_VERSIONS RELATIVE ${kit10_dir}/Include ${kit10_dir}/Include/10.*) 			# enumerate pre-release and not yet known release versions


BUG: Remove library version information when building Qt Designer plugin

--- CMake/ctkMacroBuildQtDesignerPlugin.cmake
+++ CMake/ctkMacroBuildQtDesignerPlugin.cmake
@@ -75,7 +75,6 @@

   # Apply properties to the library target.
   SET_TARGET_PROPERTIES(${lib_name}  PROPERTIES
-    ${CTK_LIBRARY_PROPERTIES}
     COMPILE_FLAGS "-DQT_PLUGIN"
     LIBRARY_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/designer"
     )


ENH:  Update ITK git tag.

ENH:  Update ITK git tag.

--- SuperBuild/External_ITKv4.cmake
+++ SuperBuild/External_ITKv4.cmake
@@ -73,7 +73,7 @@
     )
   ### --- End Project specific additions
   set(${proj}_REPOSITORY ${git_protocol}://itk.org/ITK.git CACHE STRING "" FORCE)
-  set(${proj}_GIT_TAG e6eed7e4d4580d99dc4eaa8ee1522aa26c134861 CACHE STRING "" FORCE)
+  set(${proj}_GIT_TAG cf732425528cea8ad75bc49df5c1d7441b9fc2ad CACHE STRING "" FORCE)
   ExternalProject_Add(${proj}
     GIT_REPOSITORY ${${proj}_REPOSITORY}
     GIT_TAG ${${proj}_GIT_TAG}


Allow absolute paths for test scripts.

Allow absolute paths for test scripts.

--- TestScriptUtils.cmake
+++ TestScriptUtils.cmake
@@ -57,8 +57,13 @@
         set(RUN_ARGS ${${NAME}_TEST_ARGS})
     endif()

+    set(SCRIPT_PATH "${SCRIPT}")
+    if(NOT IS_ABSOLUTE "${SCRIPT_PATH}")
+	set(SCRIPT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/${SCRIPT_PATH}")
+    endif()
+
     add_test(NAME ${NAME}
-        COMMAND ${RUN_PREFIX} ${INTERP} "${CMAKE_CURRENT_SOURCE_DIR}/${SCRIPT}" ${RUN_ARGS}
+        COMMAND ${RUN_PREFIX} ${INTERP} "${SCRIPT_PATH}" ${RUN_ARGS}
         WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")

     # Add test labels


Explicitly list example targets in CMake

CMake documentation suggests that we not use GLOB to discover source
files, so that make re-runs correctly when new sources are added.

--- CMakeUnix.cmake
+++ CMakeUnix.cmake
@@ -28,22 +28,23 @@

 ### Build Examples
 IF (BUILD_EXAMPLES)
-  FILE(GLOB exfiles ${CMAKE_SOURCE_DIR}/examples/*.c)
+  SET(example_targets
+        mod_websocket_echo
+        mod_websocket_dumb_increment)

-  # Construct 1 Target per c files
-  FOREACH(it ${exfiles})
-    # Get module name
-    GET_FILENAME_COMPONENT(modname ${it} NAME_WE)
-
-    # lib
-    ADD_LIBRARY(${modname} MODULE ${it})
-    TARGET_LINK_LIBRARIES(${modname} ${APACHE_LIBRARY} ${APR_LIBRARY})
+  # Construct a target for each example
+  FOREACH(modname ${example_targets})
+    ADD_LIBRARY(${modname} MODULE examples/${modname}.c)

     # properties
     SET_TARGET_PROPERTIES(${modname} PROPERTIES PREFIX "")
     SET_PROPERTY(TARGET ${modname} PROPERTY C_STANDARD 11)
+  ENDFOREACH()

-    # Install
-    INSTALL(TARGETS ${modname} DESTINATION ${APACHE_MODULE_DIR})
-  ENDFOREACH(it)
-ENDIF(BUILD_EXAMPLES)+  # Only the dumb-increment example needs APR.
+  TARGET_LINK_LIBRARIES(mod_websocket_dumb_increment ${APR_LIBRARY})
+
+  # Install
+  INSTALL(TARGETS ${example_targets}
+          DESTINATION ${APACHE_MODULE_DIR})
+ENDIF(BUILD_EXAMPLES)


Unconditionally include snprintf file in libuv

--- deps/uv.cmake
+++ deps/uv.cmake
@@ -79,6 +79,7 @@
     ${LIBUVDIR}/src/win/req.c
     ${LIBUVDIR}/src/win/req-inl.h
     ${LIBUVDIR}/src/win/signal.c
+    ${LIBUVDIR}/src/win/snprintf.c
     ${LIBUVDIR}/src/win/stream.c
     ${LIBUVDIR}/src/win/stream-inl.h
     ${LIBUVDIR}/src/win/tcp.c
@@ -91,9 +92,6 @@
     ${LIBUVDIR}/src/win/winsock.c
     ${LIBUVDIR}/src/win/winsock.h
   )
-  if ("${MSVS_VERSION}" LESS "2015")
-    set(SOURCES ${SOURCES} ${LIBUVDIR}/src/win/snprintf.c)
-  endif()
 else()
   include_directories(${LIBUVDIR}/src/unix)
   set(SOURCES ${SOURCES}


COMP: fix missing itk::SimpleDataObjectDecorator< itk::Array< * > > wrappers

Change-Id: Idfc9b501e623b620eb47cf637c3bae5935f979dd

--- Wrapping/WrapITK/Libraries/Base/wrap_itkSimpleDataObjectDecorator.cmake
+++ Wrapping/WrapITK/Libraries/Base/wrap_itkSimpleDataObjectDecorator.cmake
@@ -8,4 +8,7 @@
   WRAP_TEMPLATE("${ITKM_SS}"  "${ITKT_SS}")
   WRAP_TEMPLATE("${ITKM_SC}"  "${ITKT_SC}")
   WRAP_TEMPLATE("${ITKM_B}"   "${ITKT_B}")
+  WRAP_TEMPLATE("${ITKM_AD}"  "${ITKT_AD}")
+  WRAP_TEMPLATE("${ITKM_AF}"  "${ITKT_AF}")
+  WRAP_TEMPLATE("${ITKM_AUL}" "${ITKT_AUL}")
 END_WRAP_CLASS()


APPEND_PRJ_INFO_CMAKE: Skip empty entry

APPEND_PRJ_INFO_CMAKE: Skip empty entry

--- Modules/ManageVersion.cmake
+++ Modules/ManageVersion.cmake
@@ -61,7 +61,9 @@
 ENDMACRO(READ_PRJ_INFO_CMAKE)

 MACRO(APPEND_PRJ_INFO_CMAKE prjInfoFile var)
-    FILE(APPEND ${prjInfoFile} "SET(${_v} \"${${_v}}\")\n")
+    IF(NOT "${${var}}" STREQUAL "")
+	FILE(APPEND ${prjInfoFile} "SET(${_v} \"${${_v}}\")\n")
+    ENDIF(NOT "${${var}}" STREQUAL "")
 ENDMACRO(APPEND_PRJ_INFO_CMAKE)

 # Write Project info to prj_info.cmake


Fix interactive paraview sessions on cross compiled crays.

If we run into systems again that lack sockets, we can revisit
this check and do it well.

Change-Id: Ifb1efe7f054cf7b677bf2a5095785919119874d5

--- CMake/VTKParallelCMakeTests.cmake
+++ CMake/VTKParallelCMakeTests.cmake
@@ -41,7 +41,7 @@
 # Cray Xt3/ Catamount doesn't have any socket support
 # this could also be determined by doing something like
 # check_symbol_exists(socket "sys/types.h;sys/socket.h" HAVE_SOCKETS)
-IF(CMAKE_SYSTEM MATCHES Catamount)
-  SET(HAVE_SOCKETS FALSE)
-ENDIF(CMAKE_SYSTEM MATCHES Catamount)
+#IF(CMAKE_SYSTEM MATCHES Catamount) #Xt6 and Xt7 at least have sockets, so disable this.
+#  SET(HAVE_SOCKETS FALSE)
+#ENDIF(CMAKE_SYSTEM MATCHES Catamount)


MISC: Update the tag from git

MISC: Update the tag from git

Update the tag hash to the latest version in the git repository

--- SuperBuild/External_niral_utilities.cmake
+++ SuperBuild/External_niral_utilities.cmake
@@ -73,7 +73,7 @@

   ### --- End Project specific additions
   set( ${proj}_REPOSITORY ${git_protocol}://github.com/NIRALUser/niral_utilities.git )
-  set( ${proj}_GIT_TAG 5867321c66e63e5a95cb22ec06b8c893fed7f7dc )
+  set( ${proj}_GIT_TAG 50711ce510bc03f3aa77e2730d48741f6a83732a )
   ExternalProject_Add(${proj}
     GIT_REPOSITORY ${${proj}_REPOSITORY}
     GIT_TAG ${${proj}_GIT_TAG}


Comment out line interrupting OS X compilation.

I suspect that this bit of code is involved in "listing the available Qt versions installed in a machine"
This was removed due to an invalid syntax detected in the OS X
However, removing it did not affect the build process.

--- KTAB/cmakemodules/Findqtlibs.cmake
+++ KTAB/cmakemodules/Findqtlibs.cmake
@@ -15,7 +15,7 @@
 MACRO(LIST_INDEX var index)
 SET(list . ${ARGN})
 FOREACH(i RANGE 1 ${index})
-CDR(list ${list})
+#CDR(list ${list})
 ENDFOREACH(i)
 CAR(${var} ${list})
 ENDMACRO(LIST_INDEX)


BUG: go back to patchelf 0.9 as patchelf > 0.10 corrupts ELFs with lot of XXXX (https://github.com/NixOS/patchelf/issues/45)

--- Packaging/External_patchelf.cmake
+++ Packaging/External_patchelf.cmake
@@ -41,8 +41,8 @@

 ExternalProject_Add(PATCHELF
   PREFIX "${PATCHELF_PREFIX_DIR}"
-  URL                 "https://github.com/NixOS/patchelf/archive/refs/tags/0.12.tar.gz"
-  URL_MD5             b9d1161e52e2f342598deabf7d85ed24
+  URL                 "http://nixos.org/releases/patchelf/patchelf-0.9/patchelf-0.9.tar.bz2"
+  URL_MD5             d02687629c7e1698a486a93a0d607947
   DOWNLOAD_DIR        "${DOWNLOAD_LOCATION}"
   SOURCE_DIR          "${PATCHELF_SOURCE_DIR}"
   BINARY_DIR          "${PATCHELF_SOURCE_DIR}"


ENH: Enable ITKExamples_USE_WRAP_PYTHON by default

Change-Id: Ib0c3a52d0f7f471d22f2bb8a7b4169726d450f2f

--- Superbuild/Superbuild.cmake
+++ Superbuild/Superbuild.cmake
@@ -43,7 +43,7 @@

 option(ITKExamples_USE_VTK "Add VTK to the superbuild." OFF)

-option(ITKExamples_USE_WRAP_PYTHON "Add ITK Python wrapping to the superbuild" OFF)
+option(ITKExamples_USE_WRAP_PYTHON "Enable downloads of the ITK Python wrapping to the superbuild" ON)
 if(NOT EXISTS PYTHON_EXECUTABLE AND ITKExamples_USE_WRAP_PYTHON OR ITKExamples_USE_VTK)
   include(${CMAKE_SOURCE_DIR}/External-Python.cmake)
   list(APPEND ITKExamples_DEPENDENCIES Python)


BUG: update Bbarolo tag

BUG: update Bbarolo tag

--- SuperBuild/External_bbarolo.cmake
+++ SuperBuild/External_bbarolo.cmake
@@ -33,7 +33,7 @@
   ExternalProject_Add(${proj}
     ${${proj}_EP_ARGS}
     GIT_REPOSITORY "${git_protocol}://github.com/Punzo/Bbarolo"
-    GIT_TAG "2ef5f7d547d5de690f24021b8a717d4d8ece56e4"
+    GIT_TAG "eec021140d892ba7881fee0e4c02f02c92eeba4f"
     SOURCE_DIR ${${proj}_SOURCE_DIR}
     BINARY_DIR ${${proj}_BINARY_DIR}
     CMAKE_CACHE_ARGS


Ensure that -fno-strict-aliasing is _appended_ after -O2

-O2 includes -fstrict-aliasing, so we need to ensure that these flags
are explicitly added after each invocation. Maybe we should just use
unions instead *sigh*.

Change-Id: I9321609a671339dfe13502fdd071ad1de823bf9f
Reviewed-on: http://review.couchbase.org/43720
Tested-by: Mark Nunberg <e7d42768707bf23038325b0b68d4b577e5f6064a@haskalah.org>
Reviewed-by: Sergey Avseyev <87f6d5e4fd3644c3c20800cde7fd3ad1569370b3@gmail.com>

--- cmake/Modules/GetLibcouchbaseFlags.cmake
+++ cmake/Modules/GetLibcouchbaseFlags.cmake
@@ -111,8 +111,14 @@
     ENDIF()
     SET(LCB_CORE_CFLAGS "${LCB_GNUC_C_WARNINGS} -DHAVE_VISIBILITY -fvisibility=hidden")
     SET(LCB_CORE_CXXFLAGS "${LCB_GNUC_CXX_WARNINGS} -DHAVE_VISIBILITY -fvisibility=hidden")
-    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing")
-    SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-strict-aliasing")
+    FOREACH(variant C CXX)
+        FOREACH(config RELEASE DEBUG RELWITHDEBINFO)
+            SET(varname "CMAKE_${variant}_FLAGS_${config}")
+            SET(existing ${${varname}})
+            SET(${varname} "${existing} -fno-strict-aliasing")
+        ENDFOREACH()
+        SET(CMAKE_${variant}_FLAGS "${CMAKE_${variant}_FLAGS} -fno-strict-aliasing")
+    ENDFOREACH()
 ENDIF()

 IF(LCB_UNIVERSAL_BINARY AND (${CMAKE_SYSTEM_NAME} MATCHES "Darwin"))


binding.gyp.cmake: Fix npm builds by stopping dependency on json-c

This disables JSONPLAT but means we can build on stuff without json-c

Signed-off-by: Brendan Le Foll <3e0e8c4069934e8b47d99704927a85c66c0ceb33@intel.com>

--- src/javascript/binding.gyp.cmake
+++ src/javascript/binding.gyp.cmake
@@ -33,6 +33,7 @@
         'SWIGJAVASCRIPT',
         'FIRMATA=ON',
         'ONEWIRE=ON',
+        'JSONPLAT=OFF',
         'BUILDING_NODE_EXTENSION=1',
         'SWIG_V8_VERSION=0x0<(v8_version)',
         'V8_VERSION=0x0<(v8_version)'


updated vc optimization cmake files

updated vc optimization cmake files

--- cmake/vc/OptimizeForArchitecture.cmake
+++ cmake/vc/OptimizeForArchitecture.cmake
@@ -111,7 +111,7 @@
             set(TARGET_ARCHITECTURE "knl")  # Knights Landing
          elseif(_cpu_model EQUAL 92)
             set(TARGET_ARCHITECTURE "goldmont")
-         elseif(_cpu_model EQUAL 90)
+         elseif(_cpu_model EQUAL 90 OR _cpu_model EQUAL 76)
             set(TARGET_ARCHITECTURE "silvermont")
          elseif(_cpu_model EQUAL 102)
             set(TARGET_ARCHITECTURE "cannonlake")
@@ -255,6 +255,15 @@
       _broadwell()
       list(APPEND _available_vector_units_list "avx512f" "avx512pf" "avx512er" "avx512cd")
    endmacro()
+   macro(_silvermont)
+      list(APPEND _march_flag_list "silvermont")
+      _westmere()
+      list(APPEND _available_vector_units_list "rdrnd")
+   endmacro()
+   macro(_goldmont)
+      list(APPEND _march_flag_list "goldmont")
+      _silvermont()
+   endmacro()

    if(TARGET_ARCHITECTURE STREQUAL "core")
       list(APPEND _march_flag_list "core2")
@@ -294,6 +303,10 @@
       _westmere()
    elseif(TARGET_ARCHITECTURE STREQUAL "nehalem")
       _nehalem()
+   elseif(TARGET_ARCHITECTURE STREQUAL "goldmont")
+      _goldmont()
+   elseif(TARGET_ARCHITECTURE STREQUAL "silvermont")
+      _silvermont()
    elseif(TARGET_ARCHITECTURE STREQUAL "atom")
       list(APPEND _march_flag_list "atom")
       list(APPEND _march_flag_list "core2")


v2x: fix techmap list handling

v2x: fix techmap list handling

Signed-off-by: Karol Gugala <38af71640571ee4b5093d4f69ffca1ac454f2948@antmicro.com>

--- v2x_tests.cmake
+++ v2x_tests.cmake
@@ -187,7 +187,7 @@
     append_file_dependency(TECHMAP_DEPS ${MAP})
   endforeach()

-  if(NOT ${TECHMAP_INPUT} STREQUAL "")
+  if(TECHMAP_INPUT)
     add_custom_command(
       OUTPUT "${MERGED_TECHMAP}"
       DEPENDS ${TECHMAP_DEPS}


fixed unit test output dir; updates #16'

--- Utilities.cmake
+++ Utilities.cmake
@@ -71,6 +71,9 @@
     add_linker_flags(${exec_name} "-Wl,--no-as-needed")
   endif()

+  set_target_properties(${exec_name} PROPERTIES
+    RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/unit_tests")
+
   add_test(NAME regular_${exec_name}
     COMMAND ${exec_name}
     "--gtest_output=xml:${CMAKE_BINARY_DIR}/test_results/${exec_name}test.xml")
@@ -81,7 +84,7 @@

   enable_coverage(${exec_name})
   if(NOT ${create_test_executable_SKIP_MEMGRIND})
-    memcheck_test(${exec_name} ${CMAKE_BINARY_DIR}/bin)
+    memcheck_test(${exec_name} ${CMAKE_BINARY_DIR}/unit_tests)
   endif()
 endfunction(create_test_executable)


px4fmu-v2 cmake: disable uavcan build to make space for tempcal module

--- cmake/configs/nuttx_px4fmu-v2_default.cmake
+++ cmake/configs/nuttx_px4fmu-v2_default.cmake
@@ -96,7 +96,7 @@
 	modules/navigator
 	modules/mavlink
 	modules/gpio_led
-	modules/uavcan
+	#modules/uavcan
 	modules/land_detector
 	modules/tempcal

@@ -198,10 +198,10 @@
 	px4io-v2
 	)

-set(config_extra_libs
-	uavcan
-	uavcan_stm32_driver
-	)
+#set(config_extra_libs
+#	uavcan
+#	uavcan_stm32_driver
+#	)

 set(config_io_extra_libs
 	)


esptool: fix elf2image conversion with "--dont-append-digest"

Append elf2image args so that "--dont-append-digest" do not override earlier
flash settings.

This was observed in case of ESP32-C2 image build where image build was failing
with `CONFIG_ESPTOOLPY_FLASHSIZE_DETECT`.

Related from earlier commit: 9c46c98b4c81699209fc9f44e3a3b1d94c5bf5b7

--- components/esptool_py/project_include.cmake
+++ components/esptool_py/project_include.cmake
@@ -66,7 +66,7 @@
     # Flash size detection updates the image header which would invalidate the appended
     # SHA256 digest. Therefore, a digest is not appended in that case.
     # This argument requires esptool>=4.1.
-    set(esptool_elf2image_args --dont-append-digest)
+    list(APPEND esptool_elf2image_args --dont-append-digest)
 endif()

 if(CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME)


cmake: show error message on encrypted flash targets without proper config

--- components/esptool_py/project_include.cmake
+++ components/esptool_py/project_include.cmake
@@ -226,7 +226,12 @@
                     CONTENT "${flash_args_content}")
         file(GENERATE OUTPUT "${build_dir}/encrypted_${target_name}_args"
                     INPUT "${CMAKE_CURRENT_BINARY_DIR}/encrypted_${target_name}_args.in")
-    endif()
+    else()
+        fail_target(encrypted-${target_name} "Error: The target encrypted-${target_name} requires"
+                    "CONFIG_SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT to be enabled.")
+
+    endif()
+
 endfunction()


ENH: MIDAS_HASH_ALGORITHM config option for MIDAS+CTest script

SVN-Revision: 3056

--- Application/CMakeScript/MIDAS.cmake
+++ Application/CMakeScript/MIDAS.cmake
@@ -17,6 +17,7 @@
 #   MIDAS_SUBSTITUTE_STR   - Which string in the arg list should be
 #                            replaced by the downloaded file.
 #                          - Defaults to "%"
+#   MIDAS_HASH_ALGORITHM   - What hash algorithm to use. Defaults to MD5
 #
 # Then call the following macro:
 #  add_midas_test(<testName> <keyFile> <program> [args...])
@@ -63,6 +64,10 @@
     set(MIDAS_DOWNLOAD_TIMEOUT_STR "TIMEOUT ${MIDAS_DOWNLOAD_TIMEOUT}")
   endif(NOT DEFINED MIDAS_DOWNLOAD_TIMEOUT)

+  if(NOT DEFINED MIDAS_HASH_ALGORITHM)
+    set(MIDAS_HASH_ALGORITHM "MD5")
+  endif(NOT DEFINED MIDAS_HASH_ALGORITHM)
+
   if(NOT DEFINED MIDAS_SUBSTITUTE_STR)
     set(MIDAS_SUBSTITUTE_STR %)
   endif(NOT DEFINED MIDAS_SUBSTITUTE_STR)
@@ -80,9 +85,9 @@

   # Write the test script file for downloading
   file(WRITE "${MIDAS_DATA_DIR}/FetchScripts/${testName}_fetchData.cmake"
-  "message(STATUS \"Data is here: ${MIDAS_REST_URL}/midas.bitstream.by.hash?hash=${checksum}\")
+  "message(STATUS \"Data is here: ${MIDAS_REST_URL}/midas.bitstream.by.hash?hash=${checksum}&algorithm=${MIDAS_HASH_ALGORITHM}\")
 if(NOT EXISTS \"${MIDAS_DATA_DIR}/${checksum}\")
-  file(DOWNLOAD ${MIDAS_REST_URL}/midas.bitstream.by.hash?hash=${checksum} \"${MIDAS_DATA_DIR}/${checksum}\" ${MIDAS_DOWNLOAD_TIMEOUT_STR} STATUS status)
+  file(DOWNLOAD ${MIDAS_REST_URL}/midas.bitstream.by.hash?hash=${checksum}&algorithm=${MIDAS_HASH_ALGORITHM} \"${MIDAS_DATA_DIR}/${checksum}\" ${MIDAS_DOWNLOAD_TIMEOUT_STR} STATUS status)
   list(GET status 0 exitCode)
   list(GET status 1 errMsg)
   if(NOT exitCode EQUAL 0)


removing run libraries code as it is not needed anymore. target properties now handles dependencies properly.

--- WkDepends.cmake
+++ WkDepends.cmake
@@ -208,7 +208,6 @@
 		if ( NOT ${package_var_name}_LIBRARIES )
 			set ( ${package_var_name}_LIBRARIES ${${package_var_name}_LIBRARY} CACHE FILEPATH "${package_name} Libraries ")
 		endif ( NOT ${package_var_name}_LIBRARIES )
-		#todo : maybe we need a complete layer over that, Wk Modules handling Wk fetures such as run_libraries and correct variable name...

 		target_link_libraries(${PROJECT_NAME} ${${package_var_name}_LIBRARIES})
 		message ( STATUS "== Binary Dependency ${package_name} libs : ${${package_var_name}_LIBRARIES} OK !")
@@ -217,20 +216,6 @@

 		mark_as_advanced ( CLEAR ${package_var_name}_LIBRARIES )
-
-		IF ( WIN32 )
-			message ( STATUS "== Binary Dependency ${package_name} runlibs : ${${package_var_name}_RUN_LIBRARIES} OK !")
-			#if the find module also defines the runtime libraries ( Wk find module standard  NOT CMAKE itself !)
-			# then we need to add the run libraries of the dependency to the current project myrun libraries
-			#set( ${PROJECT_NAME}_RUN_LIBRARIES "${${PROJECT_NAME}_RUN_LIBRARIES}" "${${package_var_name}_RUN_LIBRARIES}" CACHE FILEPATH "blabla")
-			#message( "Project run lib WkDepends : ${${PROJECT_NAME}_RUN_LIBRARIES} " )
-
-			#TODO : here is the default case. We can assume if the variable RUN_LIBRARIES does not exist that
-			# either there is no dll needed OR
-			# the dll needed is delivered with the .lib file ( usual with windows dev environments, same as with SDL_* libs )
-			# that could be implemented
-
-		ENDIF ( WIN32 )

 		# Once the project is built with it, the dependency becomes mandatory
 		# However we need to propagate the location of Custom Wk-dependencies, to make it easier for later
@@ -263,9 +248,6 @@
 # NB : It shouldnt hurt if the upper project also define it as its own dependency
 set(${PROJECT_NAME}_INCLUDE_DIRS \"${${package_var_name}_INCLUDE_DIRS}\" \${${PROJECT_NAME}_INCLUDE_DIRS} )
 set(${PROJECT_NAME}_LIBRARIES \${${PROJECT_NAME}_LIBRARIES} \"${${package_var_name}_LIBRARIES}\" )
-if ( WIN32 )
-	set(${PROJECT_NAME}_RUN_LIBRARIES \${${PROJECT_NAME}_RUN_LIBRARIES} \"${${package_var_name}_RUN_LIBRARIES}\" )
-endif ( WIN32 )

 		")

@@ -287,20 +269,6 @@

 		target_link_libraries(${PROJECT_NAME} ${${subprj_name}_LIBRARIES})
 		message ( STATUS "== Source Dependency ${subprj_name} libs : ${${subprj_name}_LIBRARIES} OK !")
-
-		IF ( WIN32 )
-			message ( STATUS "== Source Dependency ${subprj_name} runlibs : ${${subprj_name}_RUN_LIBRARIES} OK !")
-			#if the find module also defines the runtime libraries ( Wk find module standard  NOT CMAKE itself !)
-			# then we need to add the run libraries of the dependency to the current project myrun libraries
-			#set( ${PROJECT_NAME}_RUN_LIBRARIES "${${PROJECT_NAME}_RUN_LIBRARIES}" "${${package_var_name}_RUN_LIBRARIES}" CACHE FILEPATH "blabla")
-			#message( "Project run lib WkDepends : ${${PROJECT_NAME}_RUN_LIBRARIES} " )
-
-			#TODO : here is the default case. We can assume if the variable RUN_LIBRARIES does not exist that
-			# either there is no dll needed OR
-			# the dll needed is delivered with the .lib file ( usual with windows dev environments, same as with SDL_* libs )
-			# that could be implemented
-
-		ENDIF ( WIN32 )

 		# Once the project is built with it, the dependency becomes mandatory
 		if ( ${subprj_name}_DIR )
@@ -333,9 +301,6 @@
 # NB : It shouldnt hurt if the upper project also define it as its own dependency
 set(${PROJECT_NAME}_INCLUDE_DIRS \"${${subprj_name}_INCLUDE_DIRS}\" \${${PROJECT_NAME}_INCLUDE_DIRS} )
 set(${PROJECT_NAME}_LIBRARIES \${${PROJECT_NAME}_LIBRARIES} \"${${subprj_name}_LIBRARIES}\" )
-if ( WIN32 )
-	set(${PROJECT_NAME}_RUN_LIBRARIES \${${PROJECT_NAME}_RUN_LIBRARIES} \"${${subprj_name}_RUN_LIBRARIES}\" )
-endif ( WIN32 )

 		")


cmake: improved status output

cmake: improved status output

--- config/FindVIGRANUMPY_DEPENDENCIES.cmake
+++ config/FindVIGRANUMPY_DEPENDENCIES.cmake
@@ -22,7 +22,8 @@
     execute_process(COMMAND ${PYTHON_EXECUTABLE} -c
                      "import sys; print(sys.exec_prefix)"
                       OUTPUT_VARIABLE PYTHON_PREFIX OUTPUT_STRIP_TRAILING_WHITESPACE)
-
+    MESSAGE(STATUS "Using Python ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} at ${PYTHON_EXECUTABLE}")
+
     ######################################################################
     #
     #      find Python includes


don't build ffmpeg via cmake on Windows (yet)

* see issue https://github.com/smanders/externpro/issues/17

--- projects/ffmpeg.cmake
+++ projects/ffmpeg.cmake
@@ -17,8 +17,11 @@
     endif()
   else()
     if(XP_PRO_FFMPEG AND NOT (XP_PRO_FFMPEG_${mswVer} OR XP_PRO_FFMPEG_${cfgVer}))
-      set(XP_PRO_FFMPEG_${mswVer} ON CACHE BOOL "include ffmpeg_${mswVer}" FORCE)
-      set(XP_PRO_FFMPEG_${cfgVer} ON CACHE BOOL "include ffmpeg_${cfgVer}" FORCE)
+      if(WIN32)
+        set(XP_PRO_FFMPEG_${mswVer} ON CACHE BOOL "include ffmpeg_${mswVer}" FORCE)
+      else()
+        set(XP_PRO_FFMPEG_${cfgVer} ON CACHE BOOL "include ffmpeg_${cfgVer}" FORCE)
+      endif()
     endif()
     if(XP_PRO_FFMPEG_${mswVer})
       xpListAppendIfDne(FFMPEG_VERSIONS ${mswVer})


Guarding against empty list

Guarding against empty list

Former-commit-id: ee9724836d2bec9263006f39f96a4a670f570ced

--- cmake-modules/getExpandedTarget.cmake
+++ cmake-modules/getExpandedTarget.cmake
@@ -30,11 +30,17 @@
     #            message("Current ${expanded_list}: ${${expanded_list}}")
     #            message("Returning:  ${scoped_list};${${expanded_list}}")
     if(NOT ${expanded_list})
-        list(REMOVE_DUPLICATES "scoped_list")
+        if(scoped_list)
+            list(REMOVE_DUPLICATES "scoped_list")
+        endif()
         set(${expanded_list} "${scoped_list}" PARENT_SCOPE)
     else()
-        list(REMOVE_DUPLICATES "scoped_list")
-        list(REMOVE_DUPLICATES "expanded_list")
+        if(scoped_list)
+            list(REMOVE_DUPLICATES "scoped_list")
+        endif()
+        if(expanded_list)
+            list(REMOVE_DUPLICATES "expanded_list")
+        endif()
         if(${expanded_list})
             list(REMOVE_DUPLICATES "${expanded_list}")
         endif()


Use the current binary dir for shared function checks too

--- cmake/CheckSharedFunctionExists.cmake
+++ cmake/CheckSharedFunctionExists.cmake
@@ -58,12 +58,12 @@
       "${CMAKE_CONFIGURABLE_FILE_CONTENT}\nvoid cmakeRequireSymbol(int dummy,...){(void)dummy;}\nint main()\n{\n  cmakeRequireSymbol(0,&${SYMBOL});\n  return 0;\n}\n")

     CONFIGURE_FILE("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in"
-      "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.c" @ONLY)
+      "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.c" @ONLY)

     MESSAGE(STATUS "Looking for ${SYMBOL} in ${LIBRARY}")
     TRY_COMPILE(${VARIABLE}
-      ${CMAKE_BINARY_DIR}
-      ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.c
+      ${CMAKE_CURRENT_BINARY_DIR}
+      ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.c
       COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
       CMAKE_FLAGS
       -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_SYMBOL_EXISTS_FLAGS}
@@ -74,18 +74,18 @@
     IF(${VARIABLE})
       MESSAGE(STATUS "Looking for ${SYMBOL} in ${LIBRARY} - found")
       SET(${VARIABLE} 1 CACHE INTERNAL "Have symbol ${SYMBOL} in ${LIBRARY}")
-      FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+      FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
         "Determining if the ${SYMBOL} "
         "exist in ${LIBRARY} passed with the following output:\n"
-        "${OUTPUT}\nFile ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.c:\n"
+        "${OUTPUT}\nFile ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.c:\n"
         "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n")
     ELSE(${VARIABLE})
       MESSAGE(STATUS "Looking for ${SYMBOL} in ${LIBRARY} - not found.")
       SET(${VARIABLE} "" CACHE INTERNAL "Have symbol ${SYMBOL} in ${LIBRARY}")
-      FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+      FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
         "Determining if the ${SYMBOL} "
         "exist in ${LIBRARY} failed with the following output:\n"
-        "${OUTPUT}\nFile ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.c:\n"
+        "${OUTPUT}\nFile ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.c:\n"
         "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n")
     ENDIF(${VARIABLE})
   ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$")


Added '++' to package name if building for C++

--- cmake/Modules/DefineCPackConfig.cmake
+++ cmake/Modules/DefineCPackConfig.cmake
@@ -39,7 +39,13 @@
 endif(WIN32)

 set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1)
-set(CPACK_PACKAGE_FILE_NAME ${APPLICATION_NAME}-${CPACK_PACKAGE_VERSION}-${CMAKE_SYSTEM_NAME})
+
+if (WITH_CXX)
+   set(PACKAGE_NAME ${APPLICATION_NAME}++)
+else ()
+   set(PACKAGE_NAME ${APPLICATION_NAME})
+endif ()
+set(CPACK_PACKAGE_FILE_NAME ${PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CMAKE_SYSTEM_NAME})

 set(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Libraries")
 set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION


set -fno-omit-frame-pointer by default. by request from Vadim

--- cmake_modules/TokuSetupCompiler.cmake
+++ cmake_modules/TokuSetupCompiler.cmake
@@ -117,7 +117,7 @@
     )
 endif ()

-option (PROFILING "Allow profiling and debug" OFF)
+option (PROFILING "Allow profiling and debug" ON)
 if (PROFILING)
   set_cflags_if_supported(
     -fno-omit-frame-pointer


refs #5086 commenting out cmake line to fix linux build.  We have to find a permanent fix for clang later.

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

--- cmake_modules/TokuSetupCompiler.cmake
+++ cmake_modules/TokuSetupCompiler.cmake
@@ -147,7 +147,7 @@
 endif ()

 ## We need to explicitly set this standard library for Xcode builds.
-add_definitions(-stdlib=libc++)
+##add_definitions(-stdlib=libc++)

 if (CMAKE_CXX_COMPILER_ID MATCHES Intel)
   set(CMAKE_C_FLAGS "-std=c99 ${CMAKE_C_FLAGS}")


ARROW-5473: [C++] Fix googletest_ep build failure on windows+ninja

Fix proposed by @rip-nsk

Closes #6816 from bkietz/5473-Build-failure-on-googlete

Authored-by: Benjamin Kietzman <be26f8d5d161e4d7965ee00602589fb2b74149f2@gmail.com>
Signed-off-by: Wes McKinney <3be70eed0275ec2606f002bff3514252e145d204@apache.org>

--- cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -1399,7 +1399,7 @@
     set(GTEST_CMAKE_CXX_FLAGS "${GTEST_CMAKE_CXX_FLAGS} -DGTEST_CREATE_SHARED_LIBRARY=1")
   endif()

-  set(GTEST_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/googletest_ep-prefix/src/googletest_ep")
+  set(GTEST_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/googletest_ep-prefix")
   set(GTEST_INCLUDE_DIR "${GTEST_PREFIX}/include")

   set(_GTEST_RUNTIME_DIR ${BUILD_OUTPUT_ROOT_DIRECTORY})


Add support for watch os

Add support for watch os

--- toolchain/iOS.cmake
+++ toolchain/iOS.cmake
@@ -72,8 +72,15 @@

 	# This causes the installers to properly locate the output libraries
 	set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator")
+elseif (${IOS_PLATFORM} STREQUAL "WATCHOS")
+    set (IOS_PLATFORM_LOCATION "WatchOS.platform")
+	set (XCODE_IOS_PLATFORM watchos)
+
+	# This causes the installers to properly locate the output libraries
+	set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-watchos")
 else (${IOS_PLATFORM} STREQUAL "OS")
-	message (FATAL_ERROR "Unsupported IOS_PLATFORM value selected. Please choose OS or SIMULATOR")
+	message (FATAL_ERROR "Unsupported IOS_PLATFORM value selected. "
+             "Please choose OS, SIMULATOR, or WATCHOS.")
 endif ()

 # All iOS/Darwin specific settings - some may be redundant
@@ -154,6 +161,8 @@
 	set (IOS_ARCH "armv7;armv7s;arm64")
 elseif (IOS_PLATFORM STREQUAL "SIMULATOR")
 	set (IOS_ARCH "i386;x86_64")
+elseif (IOS_PLATFORM STREQUAL "WATCHOS")
+	set (IOS_ARCH "armv7k")
 endif ()

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


Use the CMake find_library command to find the FFmpeg libraries.

Conflicts:
	cmake/OpenCVFindLibsVideo.cmake

--- cmake/OpenCVFindLibsVideo.cmake
+++ cmake/OpenCVFindLibsVideo.cmake
@@ -216,49 +216,43 @@
         # Do an other trial
         FIND_FILE(BZIP2_LIBRARIES NAMES libbz2.so.1 PATHS /lib)
       endif()
-    endif(HAVE_FFMPEG)
-  endif()
-
-  if(APPLE)
-    find_path(FFMPEG_INCLUDE_DIR "libavformat/avformat.h"
-              PATHS /usr/local /usr /opt
-              PATH_SUFFIXES include
-              DOC "The path to FFMPEG headers")
-    if(FFMPEG_INCLUDE_DIR)
-      set(HAVE_GENTOO_FFMPEG TRUE)
-      set(FFMPEG_LIB_DIR "${FFMPEG_INCLUDE_DIR}/../lib" CACHE PATH "Full path of FFMPEG library directory")
-      if(EXISTS "${FFMPEG_LIB_DIR}/libavcodec.a")
-        set(HAVE_FFMPEG_CODEC 1)
-        set(ALIASOF_libavcodec_VERSION "Unknown")
-        if(EXISTS "${FFMPEG_LIB_DIR}/libavformat.a")
-          set(HAVE_FFMPEG_FORMAT 1)
+    else()
+      find_path(FFMPEG_INCLUDE_DIR "libavformat/avformat.h"
+                PATHS /usr/local /usr /opt
+                PATH_SUFFIXES include
+                DOC "The path to FFMPEG headers")
+      if(FFMPEG_INCLUDE_DIR)
+        set(HAVE_GENTOO_FFMPEG TRUE)
+        set(FFMPEG_LIB_DIR "${FFMPEG_INCLUDE_DIR}/../lib" CACHE PATH "Full path of FFMPEG library directory")
+        find_library(FFMPEG_CODEC_LIB "avcodec" HINTS "${FFMPEG_LIB_DIR}")
+        find_library(FFMPEG_FORMAT_LIB "avformat" HINTS "${FFMPEG_LIB_DIR}")
+        find_library(FFMPEG_UTIL_LIB "avutil" HINTS "${FFMPEG_LIB_DIR}")
+        find_library(FFMPEG_SWSCALE_LIB "swscale" HINTS "${FFMPEG_LIB_DIR}")
+        find_library(FFMPEG_RESAMPLE_LIB "avresample" HINTS "${FFMPEG_LIB_DIR}")
+        if(FFMPEG_CODEC_LIB AND FFMPEG_FORMAT_LIB AND
+           FFMPEG_UTIL_LIB AND FFMPEG_SWSCALE_LIB)
+          set(ALIASOF_libavcodec_VERSION "Unknown")
           set(ALIASOF_libavformat_VERSION "Unknown")
-          if(EXISTS "${FFMPEG_LIB_DIR}/libavutil.a")
-            set(HAVE_FFMPEG_UTIL 1)
-            set(ALIASOF_libavutil_VERSION "Unknown")
-            if(EXISTS "${FFMPEG_LIB_DIR}/libswscale.a")
-              set(HAVE_FFMPEG_SWSCALE 1)
-              set(ALIASOF_libswscale_VERSION "Unknown")
-              set(HAVE_FFMPEG 1)
-              if(EXISTS "${FFMPEG_LIB_DIR}/libavresample.a")
-                  set(HAVE_FFMPEG_RESAMPLE 1)
-                  set(ALIASOF_libavresample_VERSION "Unknown")
-              endif()
-            endif()
+          set(ALIASOF_libavutil_VERSION "Unknown")
+          set(ALIASOF_libswscale_VERSION "Unknown")
+          set(HAVE_FFMPEG 1)
+          if(FFMPEG_RESAMPLE_LIB)
+            set(HAVE_FFMPEG_RESAMPLE 1)
+            set(ALIASOF_libavresample_VERSION "Unknown")
           endif()
         endif()
-      endif()
-    endif(FFMPEG_INCLUDE_DIR)
-    if(HAVE_FFMPEG)
-      set(VIDEOIO_LIBRARIES ${VIDEOIO_LIBRARIES} "${FFMPEG_LIB_DIR}/libavcodec.a"
-          "${FFMPEG_LIB_DIR}/libavformat.a" "${FFMPEG_LIB_DIR}/libavutil.a"
-          "${FFMPEG_LIB_DIR}/libswscale.a")
-      if(HAVE_FFMPEG_RESAMPLE)
+      endif(FFMPEG_INCLUDE_DIR)
+      if(HAVE_FFMPEG)
+        set(VIDEOIO_LIBRARIES ${VIDEOIO_LIBRARIES} "${FFMPEG_LIB_DIR}/libavcodec.a"
+            "${FFMPEG_LIB_DIR}/libavformat.a" "${FFMPEG_LIB_DIR}/libavutil.a"
+            "${FFMPEG_LIB_DIR}/libswscale.a")
+        if(HAVE_FFMPEG_RESAMPLE)
           set(VIDEOIO_LIBRARIES ${VIDEOIO_LIBRARIES} "${FFMPEG_LIB_DIR}/libavresample.a")
-      endif()
-      ocv_include_directories(${FFMPEG_INCLUDE_DIR})
-    endif()
-  endif(APPLE)
+        endif()
+        ocv_include_directories(${FFMPEG_INCLUDE_DIR})
+      endif(HAVE_FFMPEG)
+    endif()
+  endif()
 endif(WITH_FFMPEG)

 # --- VideoInput/DirectShow ---


Remove branching for Houdini < 16.5

Remove branching for Houdini < 16.5

Signed-off-by: Nick Avramoussis <4c6772d20f21e1f087b814400acc0120202ec49e@dneg.com>

--- cmake/OpenVDBHoudiniSetup.cmake
+++ cmake/OpenVDBHoudiniSetup.cmake
@@ -289,24 +289,8 @@
   SET ( ILMBASE_LIBRARYDIR ${_HOUDINI_LIB_DIR} )
 ENDIF ()

-# Boost
-
-IF ( Houdini_VERSION VERSION_LESS 16.5 )
-  IF ( OPENVDB_BUILD_PYTHON_MODULE )
-    # Prior to the introduction of HBoost (Houdini's namespaced and shipped Boost version from 16.5),
-    # we built against Houdini's version of Boost which didn't include Boost.Python
-    SET ( OPENVDB_BUILD_PYTHON_MODULE OFF )
-    MESSAGE ( WARNING "Disabling compilation of the OpenVDB Python module. The python module requires "
-      "Boost.Python which cannot be linked in when building against Houdini Version 16.0 and earlier." )
-  ENDIF ()
-  # Reset boost hints if not set
-  IF ( NOT BOOST_INCLUDEDIR )
-    SET ( BOOST_INCLUDEDIR ${_HOUDINI_INCLUDE_DIR} )
-  ENDIF ()
-  IF ( NOT BOOST_LIBRARYDIR )
-    SET ( BOOST_LIBRARYDIR ${_HOUDINI_LIB_DIR} )
-  ENDIF ()
-ENDIF ()
+# Boost - currently must be provided as VDB is not fully configured to
+# use Houdini's namespaced hboost

 UNSET ( _HOUDINI_INCLUDE_DIR )
 UNSET ( _HOUDINI_LIB_DIR )
@@ -327,9 +311,7 @@
 # Explicitly configure the OpenVDB ABI version depending on the Houdini
 # version.

-IF ( Houdini_VERSION VERSION_LESS 16.5 )
-  SET ( OPENVDB_HOUDINI_ABI 3 )
-ELSEIF ( Houdini_VERSION VERSION_LESS 17 )
+IF ( Houdini_VERSION VERSION_LESS 17 )
   SET ( OPENVDB_HOUDINI_ABI 4 )
 ELSE ()
   SET ( OPENVDB_HOUDINI_ABI 5 )


[cmake] Remove unnecessary header include in atomics check

The header include was required to work around PR19898, as noted in that
comment. That PR has since been marked resolved fixed, and the
configuration check passes without the header inclusion both when
compiling on Windows with cl and when cross-compiling on Linux using
clang-cl.

I noticed this because the inclusion was cased incorrectly (Intrin.h
instead of intrin.h), which when cross-compiling on a case sensitive
file system would cause the intrin.h from the Windows SDK to be included
(which LLVM can't handle) instead of the one from clang's resource
directory, making the check fail. This is the same issue as r309980.
Correcting the case of the inclusion makes the check pass when cross
compiling, but it seems better to get rid of the inclusion entirely,
since it appears to be unnecessary now.

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

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

--- cmake/modules/CheckAtomic.cmake
+++ cmake/modules/CheckAtomic.cmake
@@ -81,7 +81,6 @@
 ## assumes C++11 <atomic> works.
 CHECK_CXX_SOURCE_COMPILES("
 #ifdef _MSC_VER
-#include <Intrin.h> /* Workaround for PR19898. */
 #include <windows.h>
 #endif
 int main() {


Swig CMake: find the whole SWIG package, not just the executable

The package includes other variables that are important for SWIG to work.
It prevented using SWIG on Fedora 29.

Change-Id: I6f5dd5703aebd9e072a31f8be5264d0f2bc29bc1

--- cmake/qibuild/swig/python.cmake
+++ cmake/qibuild/swig/python.cmake
@@ -36,12 +36,7 @@
   # we search for the SWIG_EXECUTABLE by yourself, because FindSWIG call find_file
   # but when we are cross-compiling and we want to use swig from the system
   # then CMAKE_FIND_ROOT_PATH prevent find_file from working.
-  find_program(SWIG_EXECUTABLE swig)
-  if(NOT SWIG_EXECUTABLE)
-    qi_error("Could not find swig executable in PATH, please install it")
-    return()
-  endif()
-
+  find_package(SWIG REQUIRED)
   include("UseSWIG")

   set_source_files_properties(${interface_file} PROPERTIES CPLUSPLUS ON)


Update common.cmake

Update common.cmake

--- common.cmake
+++ common.cmake
@@ -59,7 +59,7 @@
 endif()

-set(LIBS ${LIBS} ${CHECK_LIBRARIES} ${PROJECT})
+set(LIBS ${PROJECT} ${LIBS} ${CHECK_LIBRARIES} ${PROJECT})

 include_directories( include  )


ENH: use DOWNLOAD_NAME to rename gsl archive

--- SuperBuild/CMake/External_gsl.cmake
+++ SuperBuild/CMake/External_gsl.cmake
@@ -25,6 +25,7 @@
 ExternalProject_Add(GSL
   PREFIX GSL
   URL "https://github.com/ampl/gsl/archive/v2.3.0.tar.gz"
+  DOWNLOAD_NAME gsl_v2.3.0.tar.gz
   URL_MD5 7e0478f7c5e62696fef480b9a46f708c
   BINARY_DIR ${GSL_SB_BUILD_DIR}
   INSTALL_DIR ${SB_INSTALL_PREFIX}


Add ubsan build support to CMake rules HTCONDOR-409

--- build/cmake/CondorConfigure.cmake
+++ build/cmake/CondorConfigure.cmake
@@ -786,6 +786,7 @@
 option(ENABLE_JAVA_TESTS "Enable java tests" ON)
 option(WITH_PYTHON_BINDINGS "Support for HTCondor python bindings" ON)
 option(WITH_ADDRESS_SANITIZER "Build with address sanitizer" OFF)
+option(WITH_UB_SANITIZER "Build with undefined behavior sanitizer" OFF)
 option(DOCKER_ALLOW_RUN_AS_ROOT "Support for allow docker universe jobs to run as root inside their container" OFF)

 #####################################
@@ -820,6 +821,16 @@
 	set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
 	set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
 endif()
+
+if (WITH_UB_SANITIZER)
+	# Condor daemons dup stderr to /dev/null, so to see output need to run with
+	# UBSAN_OPTIONS="log_path=/tmp/asan print_stacktrace=true" condor_master
+	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined -fno-omit-frame-pointer")
+	set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined -fno-omit-frame-pointer")
+	set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined -fno-omit-frame-pointer")
+	set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined -fno-omit-frame-pointer")
+endif()
+

 #####################################
 # KBDD option


Fix openresty rebuilds due to openssl additions.

--- build/cmake/openresty.cmake
+++ build/cmake/openresty.cmake
@@ -78,7 +78,10 @@
   # Patch OpenResty 1.9.7.4 so OpenSSL 1.0.2g doesn't spew tons of SSL_shutdown
   # errors in the logs. Shouldn't be necessary once OpenResty 1.9.12+ comes out.
   # See: https://trac.nginx.org/nginx/ticket/901
-  BUILD_COMMAND patch -d build/nginx-1.9.7 -p1 < ${CMAKE_SOURCE_DIR}/build/patches/openresty/0001-SSL-avoid-calling-SSL_shutdown-during-handshake-tick.patch
+  BUILD_COMMAND grep -q "OpenSSL 1.0.2f complains" <SOURCE_DIR>/build/nginx-1.9.7/src/event/ngx_event_openssl.c || patch -d build/nginx-1.9.7 --forward -p1 < ${CMAKE_SOURCE_DIR}/build/patches/openresty/0001-SSL-avoid-calling-SSL_shutdown-during-handshake-tick.patch
+    # Wipe the .openssl directory inside the openssl dir, or else openresty
+    # will fail to build on rebuilds: https://trac.nginx.org/nginx/ticket/583
+    COMMAND cd ${OPENSSL_SOURCE_DIR} && rm -rf .openssl
     COMMAND make
   INSTALL_COMMAND make install DESTDIR=${STAGE_DIR}
     COMMAND cd ${STAGE_EMBEDDED_DIR}/bin && ln -snf ../openresty/bin/resty ./resty


reapply changes from 6f907c3b

reapply changes from 6f907c3b

avoiding to wrongly attribute the follwoing commit message to jobermayr

Thew previous commit detects the OCC/OCE version by parsing Standard_Version.hxx
using a REGEX. The result is saved as OCC_VERSION_STRING. The comparsion
VERSION_LESS requires cmake version >= 2.8.0

--- cMake/FindOpenCasCade.cmake
+++ cMake/FindOpenCasCade.cmake
@@ -18,7 +18,7 @@

 find_package(OCE QUIET)
 if(OCE_FOUND)
-  message("-- OpenCASCADE Community Edition has been found.")
+  message(STATUS "-- OpenCASCADE Community Edition has been found.")
   add_definitions (-DHAVE_CONFIG_H)
   set(OCC_INCLUDE_DIR ${OCE_INCLUDE_DIRS})
   #set(OCC_LIBRARY_DIR ${OCE_LIBRARY_DIR})
@@ -121,9 +121,9 @@
   if(OCC_VERSION_STRING VERSION_LESS 6.7.3)
     list(APPEND OCC_OCAF_LIBRARIES TKAdvTools)
   endif(OCC_VERSION_STRING VERSION_LESS 6.7.3)
-  message("-- Found OCE/OpenCASCADE version: ${OCC_VERSION_STRING}")
-  message("-- OCE/OpenCASCADE include directory: ${OCC_INCLUDE_DIR}")
-  message("-- OCE/OpenCASCADE shared libraries directory: ${OCC_LIBRARY_DIR}")
+  message(STATUS "-- Found OCE/OpenCASCADE version: ${OCC_VERSION_STRING}")
+  message(STATUS "-- OCE/OpenCASCADE include directory: ${OCC_INCLUDE_DIR}")
+  message(STATUS "-- OCE/OpenCASCADE shared libraries directory: ${OCC_LIBRARY_DIR}")
 else(OCC_FOUND)
   message("Neither OpenCASCADE Community Edition nor OpenCasCade were found: will not build CAD modules!")
 endif(OCC_FOUND)


added options for protecting stack

added options for protecting stack

--- cmake_compiler_settings/cmake/gcc_flags.cmake
+++ cmake_compiler_settings/cmake/gcc_flags.cmake
@@ -123,11 +123,6 @@
 	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread")
 endif()

-
-# Check if incompatible with the others
-# trap/sanitizer settings
-#set(SAN_FLAGS "${SAN_FLAGS}  -ftrapv -fstack-check -fstack-protector")
-
 option(PROFILE "Enable profiling" OFF)
 if(PROFILE)
 	message(" ===== Enable profiling ===== ")
@@ -145,6 +140,7 @@
 # add check if compiling with -O1, in that case we should use -D_FORTIFY_SOURCE=1...
 set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -D_FORTIFY_SOURCE=2") # =1 when using -O1..

+# not using add_compile_options since since needs flag also for linking
 option(RELRO "Enable full relro" OFF)
 if(RELRO)
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-z,relro,-z,now")
@@ -152,4 +148,16 @@
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-z,relro")
 endif()

+option(STACK_PROTECTOR "Enable stack protector on all functions")
+if(STACK_PROTECTOR)
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector-all")
+else()
+    if(CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 5)
+        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector-strong")
+    else()
+        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector")
+    endif()
+endif()
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-check")
+
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pie -fpie -fpic -fPIC")


Android fixes.

Android fixes.

--- scripts/android.cmake
+++ scripts/android.cmake
@@ -78,7 +78,13 @@
 macro(include_directories)
   #  set(${CURRENT_TARGET}_includes ${${CURRENT_TARGET}_includes} ${ARGN})
   #  set(${CURRENT_TARGET}_includes ${${CURRENT_TARGET}_includes} ${ARGN} PARENT_SCOPE)
-  append_target_property(includes ${ARGN})
+  set(args "${ARGN}")
+  foreach (arg IN LISTS args)
+    if (NOT ${arg} STREQUAL "BEFORE" AND NOT ${arg} STREQUAL "AFTER")
+      append_target_property(includes ${arg})
+    endif ()
+  endforeach ()
+
 endmacro()

 macro(android_add_project project_name)
@@ -229,7 +235,7 @@
   #  #  target_link_libraries(${CURRENT_TARGET} "${fullpath}/${libname}")
   #  android_add_library("${fullpath}/${libname}")
   #
-    include_directories(${MYTHIC_DEPENDENCIES}/${path}/include${include_suffix})
+  include_directories(${MYTHIC_DEPENDENCIES}/${path}/include${include_suffix})

 endmacro()


optimized for lower-upper-case differentiation

--- contrib/cmake/CPackUMundo.cmake
+++ contrib/cmake/CPackUMundo.cmake
@@ -92,8 +92,8 @@
 # CMake Modules for clients
 ########################################

-install(FILES ${PROJECT_SOURCE_DIR}/contrib/cmake/FindUMundo.cmake DESTINATION share/umundo/cmake COMPONENT library)
-install(FILES ${PROJECT_SOURCE_DIR}/contrib/cmake/UseUMundo.cmake DESTINATION share/umundo/cmake COMPONENT library)
+install(FILES ${PROJECT_SOURCE_DIR}/contrib/cmake/FindUMUNDO.cmake DESTINATION share/umundo/cmake COMPONENT library)
+install(FILES ${PROJECT_SOURCE_DIR}/contrib/cmake/UseUMUNDO.cmake DESTINATION share/umundo/cmake COMPONENT library)

 ########################################
 # Target languages


added r10e ndk support for android toolchain

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

 # ------------------------------------------------------------------------------
-#  Android CMake toolchain file, for use with the Android NDK r5-r10d
+#  Android CMake toolchain file, for use with the Android NDK r5-r10e
 #  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
 #
@@ -216,7 +216,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} -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} -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 )
@@ -1685,7 +1685,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 r10d; set only for NDK
+#   ANDROID_NDK_RELEASE : from r5 to r10e; 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


Add OS X xcrun fallback for finding SDK path (#299)

--- os/osx.cmake
+++ os/osx.cmake
@@ -74,7 +74,26 @@
 elseif(EXISTS "${__osx_sysroot_suggestion_2}")
   set(__osx_sysroot "${__osx_sysroot_suggestion_2}")
 else()
-  polly_fatal_error("OS X SDK does not exist at ${__osx_sysroot_suggestion_1} or ${__osx_sysroot_suggestion_2}")
+  # If OSX_SDK_VERSION is not set, the SDK version is computed using
+  # xcrun. However, it is possible for the version reported by xcrun to not
+  # be present in the SDKs folder. In that case, xcrun can also give the
+  # full path to a valid SDK.
+  execute_process(
+      COMMAND xcrun --show-sdk-path
+      RESULT_VARIABLE _result
+      OUTPUT_VARIABLE __osx_sysroot_suggestion_3
+      OUTPUT_STRIP_TRAILING_WHITESPACE
+  )
+
+  if(NOT _result EQUAL 0)
+    polly_fatal_error("'xcrun --show-sdk-path' failed")
+  endif()
+
+  if(EXISTS "${__osx_sysroot_suggestion_3}")
+    set(__osx_sysroot "${__osx_sysroot_suggestion_3}")
+  else()
+      polly_fatal_error("OS X SDK does not exist at ${__osx_sysroot_suggestion_1} or ${__osx_sysroot_suggestion_2} or ${__osx_sysroot_suggestion_3}")
+  endif()
 endif()

 set(


Changed so that EnableUpstreamTargets.cmake appends all targets, including aliases (ALIAS)

--- cmake/EnableUpstreamTargets.cmake
+++ cmake/EnableUpstreamTargets.cmake
@@ -6,10 +6,7 @@
 # Overload add_library to remember all targets manually (checking if target exists is not reliable enough)
 macro(add_library)
     _add_library(${ARGV})
-    # No need to store aliases
-    if(NOT "${ARGV1}" STREQUAL "ALIAS")
-        set_property(GLOBAL APPEND PROPERTY UPSTREAM_TARGETS "${ARGV0}")
-    endif()
+    set_property(GLOBAL APPEND PROPERTY UPSTREAM_TARGETS "${ARGV0}")
 endmacro()

 # Overload find_package to null-op if package is an upstream target (in same build)


[CMake] Fix Libc++ Modules build.

[CMake] Fix Libc++ Modules build.

When building the dylib, the C++ headers are fundamentally non-module.
They require special versions of the headers in order to provide C++03 and
legacy ABI definitions. This causes ODR issues when modules are enabled
during both the build and the usage of the libc++ headers.

This patch fixes the build error by disabling modules when building the
libc++ sources.

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

--- cmake/Modules/AddCompilerRT.cmake
+++ cmake/Modules/AddCompilerRT.cmake
@@ -536,6 +536,14 @@
   string(REPLACE "-Wl,-z,defs" "" LIBCXX_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
   string(REPLACE "-Wl,-z,defs" "" LIBCXX_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}")
   string(REPLACE "-Wl,-z,defs" "" LIBCXX_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
+
+  # The libc++ sources are fundamentally non-modular. They need special
+  # versions of the headers in order to provide C++03 and legacy ABI definitions.
+  # NOTE: The public headers can be used with modules in all other contexts
+  if (LLVM_ENABLE_MODULES)
+    set(LIBCXX_CXX_FLAGS "${LIBCXX_CXX_FLAGS} -Wno-unused-command-line-argument")
+    set(LIBCXX_CXX_FLAGS "${LIBCXX_CXX_FLAGS} -fno-modules")
+  endif()

   ExternalProject_Add(${name}
     DEPENDS ${name}-clobber ${LIBCXX_DEPS}


Simplify FindLibIniparser.cmake

Simplify FindLibIniparser.cmake

Signed-off-by: Andreas Schneider <5be00ddc76278cf6077f5047ca3384a88460c671@cryptomilk.org>

--- cmake/Modules/FindIniparser.cmake
+++ cmake/Modules/FindIniparser.cmake
@@ -7,68 +7,32 @@
 #  INIPARSER_DEFINITIONS - Compiler switches required for using Iniparser
 #
 #  Copyright (c) 2007 Andreas Schneider <mail@cynapses.org>
+#            (c) 2012 Dominik Schmidt <dev@dominik-schmidt.org>
 #
 #  Redistribution and use is allowed according to the terms of the New
 #  BSD license.
 #  For details see the accompanying COPYING-CMAKE-SCRIPTS file.
 #

+include(GNUInstallDirs)

-if (INIPARSER_LIBRARIES AND INIPARSER_INCLUDE_DIRS)
-  # in cache already
-  set(INIPARSER_FOUND TRUE)
-else (INIPARSER_LIBRARIES AND INIPARSER_INCLUDE_DIRS)
-  find_path(INIPARSER_INCLUDE_DIR
+find_path(INIPARSER_INCLUDE_DIRS
     NAMES
-      iniparser.h
+        iniparser.h
+    HINTS
+        ${CMAKE_INSTALL_INCLUDEDIR}
+)
+
+find_library(INIPARSER_LIBRARIES
+    NAMES
+        iniparser
     PATHS
-      /usr/include
-      /usr/local/include
-      /opt/local/include
-      /sw/include
-  )
+        ${CMAKE_INSTALL_LIBDIR}
+)

-  find_library(INIPARSER_LIBRARY
-    NAMES
-      iniparser
-    PATHS
-      /usr/lib
-      /usr/local/lib
-      /opt/local/lib
-      /sw/lib
-  )
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Iniparser
+    REQUIRED_VARS INIPARSER_LIBRARIES INIPARSER_INCLUDE_DIRS
+)

-  if (INIPARSER_LIBRARY)
-    set(INIPARSER_FOUND TRUE)
-  endif (INIPARSER_LIBRARY)

-  set(INIPARSER_INCLUDE_DIRS
-    ${INIPARSER_INCLUDE_DIR}
-  )
-
-  if (INIPARSER_FOUND)
-    set(INIPARSER_LIBRARIES
-      ${INIPARSER_LIBRARIES}
-      ${INIPARSER_LIBRARY}
-    )
-  endif (INIPARSER_FOUND)
-
-  if (INIPARSER_INCLUDE_DIRS AND INIPARSER_LIBRARIES)
-     set(INIPARSER_FOUND TRUE)
-  endif (INIPARSER_INCLUDE_DIRS AND INIPARSER_LIBRARIES)
-
-  if (INIPARSER_FOUND)
-    if (NOT Iniparser_FIND_QUIETLY)
-      message(STATUS "Found Iniparser: ${INIPARSER_LIBRARIES}")
-    endif (NOT Iniparser_FIND_QUIETLY)
-  else (INIPARSER_FOUND)
-    if (Iniparser_FIND_REQUIRED)
-      message(FATAL_ERROR "Could not find Iniparser")
-    endif (Iniparser_FIND_REQUIRED)
-  endif (INIPARSER_FOUND)
-
-  # show the INIPARSER_INCLUDE_DIRS and INIPARSER_LIBRARIES variables only in the advanced view
-  mark_as_advanced(INIPARSER_INCLUDE_DIRS INIPARSER_LIBRARIES)
-
-endif (INIPARSER_LIBRARIES AND INIPARSER_INCLUDE_DIRS)
-


Correct CPU pagesize

Correct CPU pagesize

Change default CPU pagesize to 4096 bytes.

--- cmake/Modules/cpu-page-size.cmake
+++ cmake/Modules/cpu-page-size.cmake
@@ -4,7 +4,7 @@

 if(BINARY_PACKAGE_BUILD)
   message(STATUS "Performing binary package build, using hardcoded value.")
-  set(RAWSPEED_PAGESIZE 64)
+  set(RAWSPEED_PAGESIZE 4096)
 else()
   try_run(RAWSPEED_PAGESIZE_EXITCODE RAWSPEED_PAGESIZE_COMPILED
     "${CMAKE_BINARY_DIR}"


missing newline in docsting

missing newline in docsting

--- cmake/catkin_package_export.cmake
+++ cmake/catkin_package_export.cmake
@@ -70,6 +70,7 @@
 #
 # Example:
 # ::
+#
 #   catkin_package_export(
 #     INCLUDE_DIRS include
 #     LIBRARIES proj-one proj-two


Fortran is not a prerequisite for building ROOT

git-svn-id: ecbadac9c76e8cf640a0bca86f6bd796c98521e3@41478 27541ba8-7e3a-0410-8455-c3a389f83636

--- cmake/modules/CheckCompiler.cmake
+++ cmake/modules/CheckCompiler.cmake
@@ -4,7 +4,7 @@

 #---Enable FORTRAN (unfortunatelly is not nowt possible in all cases)-------------------------------
 if(NOT WIN32 AND NOT CMAKE_GENERATOR STREQUAL Xcode)
-  enable_language(Fortran)
+  enable_language(Fortran OPTIONAL)
 endif()


Fix CRT selection logic when using CMake NMake generator.

CMAKE_CONFIGURATION_TYPES is only set on Visual Studio generators.  For NMake CMAKE_BUILD_TYPE is used instead.

Patch by EJose Fonseca!

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

--- cmake/modules/ChooseMSVCCRT.cmake
+++ cmake/modules/ChooseMSVCCRT.cmake
@@ -60,7 +60,7 @@

   make_crt_regex(MSVC_CRT_REGEX ${MSVC_CRT})

-  foreach(build_type ${CMAKE_CONFIGURATION_TYPES})
+  foreach(build_type ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE})
     string(TOUPPER "${build_type}" build)
     if (NOT LLVM_USE_CRT_${build})
       get_current_crt(LLVM_USE_CRT_${build}
@@ -75,7 +75,7 @@
     endif(NOT LLVM_USE_CRT_${build})
   endforeach(build_type)

-  foreach(build_type ${CMAKE_CONFIGURATION_TYPES})
+  foreach(build_type ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE})
     string(TOUPPER "${build_type}" build)
     if ("${LLVM_USE_CRT_${build}}" STREQUAL "")
       set(flag_string " ")


Update render_pipeline_find_plugins

Update render_pipeline_find_plugins

- Add REQUIRED option
- Remove status message about already found plugins

--- cmake/render_pipeline-macro.cmake
+++ cmake/render_pipeline-macro.cmake
@@ -1,5 +1,4 @@
 # Author: Younguk Kim (bluekyu)
-# Date  : 2017-07-28

 # render pipeline variable
 set(render_pipeline_DATA_DIR "share/render_pipeline" CACHE INTERNAL
@@ -16,8 +15,15 @@
 )

 # help function to find rpplugin
-function(render_pipeline_find_plugins plugin_id_list)
+function(render_pipeline_find_plugins)
+    cmake_parse_arguments(ARG "REQUIRED" "" "" ${ARGN})
+    set(plugin_id_list ${ARG_UNPARSED_ARGUMENTS})
+    if(${ARG_REQUIRED})
+        set(plugin_required REQUIRED)
+    endif()
+
     set(missed_plugin_id_list "")
+    set(found_plugin_id_list "")
     foreach(plugin_id ${plugin_id_list})
         if(NOT TARGET rpplugins::${plugin_id})
             list(APPEND missed_plugin_id_list ${plugin_id})
@@ -30,12 +36,19 @@
         endif()

         foreach(plugin_id ${missed_plugin_id_list})
-            find_package(rpplugin_${plugin_id} CONFIG REQUIRED HINTS "${PLUGIN_DIR_HINT}/${plugin_id}")
+            find_package(rpplugin_${plugin_id} CONFIG ${plugin_required} HINTS "${PLUGIN_DIR_HINT}/${plugin_id}")
+            if(TARGET rpplugins::${plugin_id})
+                list(APPEND found_plugin_id_list ${plugin_id})
+            else()
+                message(STATUS "  Failed to find '${plugin_id}' plugin.\n")
+            endif()
         endforeach()
     endif()

-    message(STATUS "Found the following Render Pipeline plugins:")
-    foreach(plugin_id ${plugin_id_list})
-        message(STATUS "  ${plugin_id}")
-    endforeach()
+    if(${found_plugin_id_list})
+        message(STATUS "Found the following Render Pipeline plugins:")
+        foreach(plugin_id ${found_plugin_id_list})
+            message(STATUS "  ${plugin_id}")
+        endforeach()
+    endif()
 endfunction()


Add check for VS10 so that the deprication warnings are disabled

Apparently CMake <= 2.8.3 doesnt define MSVC_VERSION for VS10.

--- CMake/vtkDetermineCompilerFlags.cmake
+++ CMake/vtkDetermineCompilerFlags.cmake
@@ -144,10 +144,10 @@

 # Disable deprecation warnings for standard C and STL functions in VS2005
 # and later
-IF(MSVC_VERSION EQUAL 1400 OR MSVC_VERSION GREATER 1400)
+IF(MSVC_VERSION EQUAL 1400 OR MSVC_VERSION GREATER 1400 OR MSVC10)
   ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS)
-  ADD_DEFINITIONS(-D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
-ENDIF(MSVC_VERSION EQUAL 1400 OR MSVC_VERSION GREATER 1400)
+  ADD_DEFINITIONS(-D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
+ENDIF(MSVC_VERSION EQUAL 1400 OR MSVC_VERSION GREATER 1400 OR MSVC10)

 # Enable /MP flag for Visual Studio 2008 and greator
 IF(MSVC_VERSION GREATER 1400)


remove debug message from macro

remove debug message from macro

--- cmake/FileSystemUtils.cmake
+++ cmake/FileSystemUtils.cmake
@@ -26,8 +26,7 @@
     else()
         get_filename_component(result_tmp ${curpath} DIRECTORY)
     endif()
-
+    # expose result to caller
     set(${result} ${result_tmp})
-    MESSAGE(STATUS "result=${result}")
 ENDMACRO()


Disable default path while search libtim-vx.so with TIMVX_INSTALL_DIR

Signed-off-by: xiang.zhang <b43c9577429590daf500bbbebd651f5babc13da5@verisilicon.com>

--- cmake/OpenCVFindTIMVX.cmake
+++ cmake/OpenCVFindTIMVX.cmake
@@ -30,7 +30,7 @@
     set(BUILD_TIMVX OFF)

     set(TIMVX_INC_DIR "${TIMVX_INSTALL_DIR}/include" CACHE INTERNAL "TIM-VX include directory")
-    find_library(TIMVX_LIB "tim-vx" PATHS "${TIMVX_INSTALL_DIR}/lib")
+    find_library(TIMVX_LIB "tim-vx" PATHS "${TIMVX_INSTALL_DIR}/lib" NO_DEFAULT_PATH)
     if(TIMVX_LIB)
         set(TIMVX_FOUND ON)
     else()


Test documentation shortcut from istaller

git-svn-id: b66b41e514ff40863ef1aa95df2dbf63dd8d6be1@439 fdac6126-5c0c-442c-9429-916003d36597

--- cmake/OpenMeshPackage.cmake
+++ cmake/OpenMeshPackage.cmake
@@ -22,8 +22,6 @@
 set (CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_PACKAGE_NAME}")
 set (CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
 set (CPACK_SOURCE_STRIP_FILES "")
-
-# set (CPACK_STRIP_FILES "bin/OpenFlipper")

 # source package generation
 set (CPACK_SOURCE_GENERATOR "TGZ;TBZ2;ZIP")
@@ -119,25 +117,22 @@
   endif()

   # copy the glut library if it exists on windows
-  IF ( WIN32)
-    if (EXISTS ${CMAKE_BINARY_DIR}/Build/glut32.dll)
-	    install(FILES ${CMAKE_BINARY_DIR}/Build/glut32.dll
-	    DESTINATION ./
-           COMPONENT Applications
+  if (EXISTS ${CMAKE_BINARY_DIR}/Build/glut32.dll)
+    install(FILES ${CMAKE_BINARY_DIR}/Build/glut32.dll
+            DESTINATION ./
+            COMPONENT Applications
            )
-    endif()
   endif()

-   # copy the documentation if it exists
-   IF ( WIN32 )
-     if (EXISTS ${CMAKE_BINARY_DIR}/Build/Doc)
-	     install(DIRECTORY ${CMAKE_BINARY_DIR}/Build/Doc
-	     DESTINATION ./
+  # copy the documentation if it exists
+  if (EXISTS ${CMAKE_BINARY_DIR}/Build/Doc)
+    install(DIRECTORY ${CMAKE_BINARY_DIR}/Build/Doc
+            DESTINATION ./
             COMPONENT Applications
-            )
-     endif()
-   endif()
+           )
+  endif()

+  set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "CreateShortcut \\\"$SMPROGRAMS\\\\${CPACK_NSIS_DISPLAY_NAME}\\\\Documentation.lnk\\\" \\\"$INSTDIR\\\\Doc\\\\html\\\\index.html \\\" "  )

   # append dll's to installed package
   #if (EXISTS ${CMAKE_SOURCE_DIR}/WIN)


Change python.cmake's version to 3.5

Change python.cmake's version to 3.5

--- cmake/external/python.cmake
+++ cmake/external/python.cmake
@@ -18,8 +18,8 @@

 INCLUDE(python_module)

-FIND_PACKAGE(PythonInterp 2.7)
-FIND_PACKAGE(PythonLibs 2.7)
+FIND_PACKAGE(PythonInterp 3.5)
+FIND_PACKAGE(PythonLibs 3.5)
 # Fixme: Maybe find a static library. Get SHARED/STATIC by FIND_PACKAGE.
 ADD_LIBRARY(python SHARED IMPORTED GLOBAL)
 SET_PROPERTY(TARGET python PROPERTY IMPORTED_LOCATION ${PYTHON_LIBRARIES})


[CMake] llvm_add_library(SHARED|STATIC): Fix broken OUTPUT_NAME for *_static.

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

--- cmake/modules/AddLLVM.cmake
+++ cmake/modules/AddLLVM.cmake
@@ -238,7 +238,7 @@
     # static
     set(name_static "${name}_static")
     if(ARG_OUTPUT_NAME)
-      set(output_name OUTPUT_NAME "${ARG_OUTPUT_NAME}_static")
+      set(output_name OUTPUT_NAME "${ARG_OUTPUT_NAME}")
     endif()
     # DEPENDS has been appended to LLVM_COMMON_LIBS.
     llvm_add_library(${name_static} STATIC


fpta-cmake: fix/workaround CMAKE 3.9 IPO warning for GoogleTest.

--- cmake.fpta/testing.cmake
+++ cmake.fpta/testing.cmake
@@ -77,8 +77,21 @@

     # Add googletest directly to our build. This defines
     # the gtest and gtest_main targets.
-    add_subdirectory(${gtest_root}
-      ${CMAKE_BINARY_DIR}/googletest-build)
+    add_subdirectory(${gtest_root} ${CMAKE_BINARY_DIR}/googletest-build EXCLUDE_FROM_ALL)
+    if(CMAKE_INTERPROCEDURAL_OPTIMIZATION AND NOT CMAKE_VERSION VERSION_LESS 3.9)
+      file(READ ${gtest_root}/CMakeLists.txt variable gtest_cmake_content)
+      string(TOLOWER "${gtest_cmake_content}" gtest_cmake_content)
+      string(FIND "${gtest_cmake_content}" "check_ipo_supported" gtest_ipo_supported)
+      if(NOT gtest_ipo_supported OR gtest_ipo_supported LESS 1)
+        message(STATUS "Disable INTERPROCEDURAL_OPTIMIZATION for GoogleTest (CMake-3.9's check_ipo_supported NOT FOUND inside)")
+        if(TARGET gtest)
+          set_property(TARGET gtest gtest_main PROPERTY INTERPROCEDURAL_OPTIMIZATION FALSE)
+        endif()
+        if(TARGET gmock)
+          set_property(TARGET gmock gmock_main PROPERTY INTERPROCEDURAL_OPTIMIZATION FALSE)
+        endif()
+      endif()
+    endif()

     if(CC_HAS_WERROR)
       if(MSVC)


add VSX identifier

add VSX identifier

--- cmake/EigenTesting.cmake
+++ cmake/EigenTesting.cmake
@@ -424,6 +424,8 @@
   ei_is_64bit_env(IS_64BIT_ENV)
   if(EIGEN_TEST_NEON)
     set(${VAR} NEON)
+  elseif(EIGEN_TEST_VSX)
+    set(${VAR} VSX)
   elseif(EIGEN_TEST_ALTIVEC)
     set(${VAR} ALVEC)
   elseif(EIGEN_TEST_FMA)


add spec to cache

add spec to cache

--- cmake/ElektraCache.cmake
+++ cmake/ElektraCache.cmake
@@ -286,6 +286,10 @@
 		"This path will be appended after the resolved home directory. It completes the path to the user key database."
 		)

+set (KDB_DB_SPEC "share/elektra/specification" CACHE PATH
+		"This path will be appended after the prefix. It completes the path to the specification key database."
+		)
+
 set (KDB_DB_FILE "default.ecf" CACHE PATH
 		"This configuration file will be used initially (for bootstrapping)."
 		)


inside kdesupport the location for Automoc4Config.cmake has changed

svn path=/trunk/kdesupport/phonon/; revision=834172

--- cmake/FindAutomoc4.cmake
+++ cmake/FindAutomoc4.cmake
@@ -20,7 +20,7 @@
 # check if we are inside KDESupport and automoc is enabled
 if("${KDESupport_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
    # when building this project as part of kdesupport
-   set(AUTOMOC4_CONFIG_FILE "${KDESupport_SOURCE_DIR}/automoc/Automoc4Config.cmake")
+   set(AUTOMOC4_CONFIG_FILE "${KDESupport_BINARY_DIR}/automoc/Automoc4Config.cmake")
 else("${KDESupport_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
    # when building this project outside kdesupport


enforce a minimum Eigen3 version

enforce a minimum Eigen3 version

--- cmake/dependencies.cmake
+++ cmake/dependencies.cmake
@@ -15,7 +15,7 @@
 include_directories(SYSTEM ${LibArchive_INCLUDE_DIRS})

 # Eigen
-find_package(Eigen3)
+find_package(Eigen3 3.2.93 REQUIRED)
 include_directories(${EIGEN3_INCLUDE_DIR})
 add_definitions(-DEIGEN_DONT_PARALLELIZE)


cmake: update CUTE module

cmake: update CUTE module

--- cmake/modules/CUTE.cmake
+++ cmake/modules/CUTE.cmake
@@ -1,73 +1,325 @@
+#[[.rst:
+CUTE
+----
+
+Normally, CUTE ships with the `Cevelop C++ IDE <https://www.cevelop.com>`_. This
+module enables you to easily use CUTE in CMake based projects, making it easy to
+use CUTE based tests in continuous integration environments like Jenkins, Travis
+CI, GitlabCI, and many others.  It will also make sure that *CTest*, CMakes test
+executor, is activated. It also enables you to run the unit tests of your
+project **during** the build process, making it possible to *fail fast* when one
+of your modules fails its tests.
+
+Installation
+^^^^^^^^^^^^
+
+CUTE for CMake can be downloaded via from `GitHub
+<https://github.com/fmorgner/cute-cmake>`_ or installed directly via the `conan
+<https://conan.io>`_ C++ package mangager. To do so, add the package to your
+``conanfile.txt`` like this
+
+.. code-block:: ini
+
+  [requires]
+  CUTE-cmake/[>=1.0]@fmorgner/stable
+
+Using the conan package also makes sure, that an appropriate version of CUTE
+will be installed as well. If you decide to install *CUTE for CMake* manually,
+make sure to put the *CUTE* headers somewhere where your compiler will find
+them.
+
+Adding tests
+^^^^^^^^^^^^
+
+*CUTE for CMake* provides a single function to register a unit test with CMake.
+In addition, a handful of per-project variables are provided, to customize the
+configuration of *CUTE for CMake* on the project level.
+
+Synopsis
+""""""""
+
+.. command:: cute_test
+
+  Add a CUTE test to the project
+
+  .. code-block:: cmake
+
+    cute_test(<TestName>
+              [GROUP <groupname>]
+              [DEPENDENCIES <compiliation_dependency>...]
+              [LIBRARIES <linking_dependency>...]
+              [UNIQUE (On|Off)]
+              [RUN_DURING_BUILD (On|Off)])
+
+Description
+"""""""""""
+
+This function will search for one of the following files:
+
+  - ``<TestName>_test.cpp``
+  - ``<TestName>_test.cxx``
+  - ``<TestName>_test.cc``
+
+If none OR multiple files are found, a fatal error will be raised.
+
+.. _section_arguments:
+
+Parameters
+""""""""""
+
+*CUTE for CMake* provides several parameters for the :command:`cute_test`
+function, that allow you to customize the behavior of the function, as well as
+specify build time and link time dependencies for a specific test.
+
+.. variable:: GROUP
+
+  Add the test to the test-group named ``<groupname>``. Grouping tests adds
+  another target to enable to run a specified test group only.
+
+  | **Type**: `STRING`
+  | **Parameter(s)**: <groupname>
+  | **Default vaue**: `UNSET`
+
+.. variable:: DEPENDENCIES
+
+  Add compile-time dependencies to the test. ``<compiliation_dependency>`` shall
+  be either a file name or a CMake *generator expression*. If one or more of the
+  file names provided can not be resolved to actual files, test registration
+  will fail.
+
+  | **Type**: `PATH` or `GENERATOR_EXPRESSION`
+  | **Parameter(s)**: <compiliation_dependency>...
+  | **Default vaue**: `UNSET`
+
+.. variable:: LIBRARIES
+
+  Add link-time dependencies to the test. Every expression that is valid for
+  use in ``target_link_libraries`` is also valid as an expression for
+  ``linking_dependency``.
+
+  | **Type**: `PATH` or `GENERATOR_EXPRESSION`
+  | **Parameter(s)**: <linking_dependency>...
+  | **Default vaue**: `UNSET`
+
+.. variable:: UNIQUE
+
+  If enabled (**ON**), ``cute_test`` will try to ensure the uniqueness of the test
+  name by appending part of the SHA256 hash of the test's **group name** (see
+  :variable:`GROUP`).  This feature helps to avoid collisions, when the same test
+  name is reused throughout a project.
+
+  | **Type**: `BOOL`
+  | **Default vaue**: `OFF`
+
+.. variable:: RUN_DURING_BUILD
+
+  If enabled (**ON**), the test will be run as part of the build process. If the
+  test fails, the build process will be aborted, similar to when a compilation
+  error happens. Note however, that all targets the test depends on, if any,
+  will be built/executed before the test is run.
+
+  | **Type**: `BOOL`
+  | **Default vaue**: `ON`
+
+Variables
+"""""""""
+
+In addition to the regular arguments to the :command:`cute_test` function,
+*CUTE for CMake* also provides a number of variables to override settings via
+the project global scope. It is strongly advised to not use these variables in
+libraries that are intended to be included as sub-projects in another CMake
+project.
+
+.. variable:: CUTE_REPORTS_DIRECTORY
+
+  This variable makes it possible to specify a directory in which **all** CUTE
+  tests, including the tests of sub-projects, will be executed. This can be used
+  to, for example, collect all *XML* CUTE test reports in a common directory. If
+  this variable is left empty, each project/sub-project receives its own working
+  directory. The path to the respective project CUTE working directory can be
+  found in ``<PROJECT_NAME>_CUTE_REPORTS_DIRECTORY``, where ``<PROJECT_NAME>``
+  is substituted for the upper-case name of the project.
+
+  | **Type**: `PATH`
+  | **Parameter(s)**: <directory>
+  | **Default vaue**: `UNSET`
+
+.. variable:: CUTE_GROUP
+
+  This variable makes it possible to group **all** unit tests into the same
+  group. By default, each project gets its own test group. Using this variable,
+  a master project can put all tests of all of its sub-projects into a common
+  group.
+
+  | **Type**: `STRING`
+  | **Parameter(s)**: <group_name>
+  | **Default vaue**: `UNSET`
+
+.. variable:: CUTE_UNIQUE
+
+  This variable can be used to globally force (**ON**) or prevent (**OFF**)
+  *CUTE for CMakes* from trying to generate unique test names.
+
+  | **Type**: `BOOL`
+  | **Default vaue**: `UNSET`
+
+.. variable:: CUTE_RUN_DURING_BUILD
+
+  This variables makes it possible to globally enable (**ON**) or disable
+  (**OFF**) test execution during the build process.
+
+  | **Type**: `BOOL`
+  | **Default vaue**: `UNSET`
+
+Running tests
+^^^^^^^^^^^^^
+
+*Cute for CMake* provides several ways to run a project's CUTE tests. This
+section gives an overview over the different ways to start a projects CUTE
+tests.
+
+As shown in section :ref:`section_arguments`, in the default configuration,
+*CUTE for CMake* will run the registered tests during compilation. This will
+make the build fail, if one of the tests of a project fails. Additionally,
+*CUTE for CMake* provides a run-target for each registered test. These targets
+all follow the same naming scheme: ``cute_test_<test_target_name>``.
+
+Groups
+^^^^^^
+
+Groups make it possible to run a specific set of tests while leaving out the
+others. For every project, *CUTE for CMake* provides a group target that makes
+it easy to manually run all unit tests, called ``cute_all``. This target also
+includes all CUTE tests of all sub-project. Another standard target provided
+by *CUTE for CMake* called ``cute_group_<project_name>``, where
+``<project_name>`` is the **lower case** name of the respective CMake project,
+allows for the execution of the tests of a specific to a single project.
+
+Examples
+^^^^^^^^
+
+
+#]]
+
 enable_testing()

-set(ENV{CTEST_OUTPUT_ON_FAILURE} "1")
-set(CUTE_TEST_REPORTS_DIRECTORY ${CMAKE_BINARY_DIR}/cute-reports)
-
-if(HAS_PARENT)
-  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${PROJECT_NAME}/test")
+string(TOUPPER ${PROJECT_NAME} CUTE_${PROJECT_NAME}_UPPER)
+if(NOT DEFINED CUTE_REPORTS_DIRECTORY AND NOT DEFINED ${CUTE_${PROJECT_NAME}_UPPER}_CUTE_REPORTS_DIRECTORY)
+  set(${CUTE_${PROJECT_NAME}_UPPER}_CUTE_REPORTS_DIRECTORY
+    ${PROJECT_BINARY_DIR}/cute-reports
+    CACHE
+    STRING
+    "Output directory for CUTE test reports of ${PROJECT_NAME}"
+    )
 else()
-  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test")
+  set(${CUTE_${PROJECT_NAME}_UPPER}_CUTE_REPORTS_DIRECTORY ${CUTE_REPORTS_DIRECTORY})
 endif()
-
-if(NOT WIN32)
-  string(ASCII 27 ESC)
-  set(RST "${ESC}[m")
-  set(BLD "${ESC}[1m")
-  set(RED "${ESC}[31m")
-  set(GRN "${ESC}[32m")
-  set(YEL "${ESC}[33m")
-  set(BLU "${ESC}[34m")
-  set(MAG "${ESC}[35m")
-  set(CYA "${ESC}[36m")
-  set(WHI "${ESC}[37m")
-  set(BRE "${ESC}[1;31m")
-  set(BGR "${ESC}[1;32m")
-  set(BYE "${ESC}[1;33m")
-  set(BBL "${ESC}[1;34m")
-  set(BMA "${ESC}[1;35m")
-  set(BCY "${ESC}[1;36m")
-  set(BWH "${ESC}[1;37m")
-endif()
-
-file(MAKE_DIRECTORY ${CUTE_TEST_REPORTS_DIRECTORY})
-
+file(MAKE_DIRECTORY ${${CUTE_${PROJECT_NAME}_UPPER}_CUTE_REPORTS_DIRECTORY})
+
+include(CMakeParseArguments)
 function(cute_test TEST_NAME)
-  set(TEST_SOURCE_FILE "${TEST_NAME}_test.cpp")
-  set(TEST_TARGET_NAME "${TEST_NAME}_test")
-
+  set(OPTIONS)
+  set(SV_ARGUMENTS GROUP UNIQUE RUN_DURING_BUILD)
+  set(MV_ARGUMENTS DEPENDENCIES LIBRARIES)
+  cmake_parse_arguments(CUTE_TEST "${OPTIONS}" "${SV_ARGUMENTS}" "${MV_ARGUMENTS}" ${ARGN})
+
+  if(NOT DEFINED CUTE_TEST_UNIQUE)
+    if(DEFINED CUTE_UNIQUE)
+      set(CUTE_TEST_UNIQUE ${CUTE_UNIQUE})
+    else()
+      set(CUTE_TEST_UNIQUE Off)
+    endif()
+  endif()
+
+  if(NOT DEFINED CUTE_TEST_GROUP)
+    if(DEFINED CUTE_GROUP)
+      set(CUTE_TEST_GROUP "${PROJECT_NAME}::${CUTE_GROUP}")
+    else()
+      set(CUTE_TEST_GROUP "${PROJECT_NAME}")
+    endif()
+  else()
+    set(CUTE_TEST_GROUP "${PROJECT_NAME}::${CUTE_TEST_GROUP}")
+  endif()
+  string(REGEX REPLACE "::" "_" TEST_TARGET_GROUP ${CUTE_TEST_GROUP})
+
+  if(NOT DEFINED CUTE_TEST_RUN_DURING_BUILD)
+    if(DEFINED CUTE_RUN_DURING_BUILD)
+      set(CUTE_TEST_RUN_DURING_BUILD ${CUTE_RUN_DURING_BUILD})
+    else()
+      set(CUTE_TEST_RUN_DURING_BUILD On)
+    endif()
+  endif()
+
+  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/cute-tests/${TEST_TARGET_GROUP}")
+
+  set(SOURCE_FILE_CANDIDATES ${TEST_NAME}_test.cpp ${TEST_NAME}_test.cxx ${TEST_NAME}_test.cc)
+  set(CANDIDATE_COUNT 0)
+  foreach(CANDIDATE IN LISTS SOURCE_FILE_CANDIDATES)
+    if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${CANDIDATE})
+      MATH(EXPR CANDIDATE_COUNT "${CANDIDATE_COUNT}+1")
+      set(TEST_SOURCE_FILE ${CANDIDATE})
+    endif()
+  endforeach()
+  if(CANDIDATE_COUNT GREATER 1)
+    message(FATAL_ERROR "More than one source candidate for ${TEST_NAME}")
+  elseif(CANDIDATE_COUNT LESS 1)
+    message(FATAL_ERROR "No source candidate for ${TEST_NAME}")
+  endif()
+
+  if(${CUTE_TEST_UNIQUE})
+    string(SHA256 GROUP_HASH ${CUTE_TEST_GROUP})
+    string(SUBSTRING ${GROUP_HASH} 0 8 GROUP_HASH)
+    set(TEST_NAME "${TEST_NAME}_${GROUP_HASH}")
+  endif()
+
+  set(TEST_TARGET_NAME "${TEST_TARGET_GROUP}_${TEST_NAME}_test")
   if(NOT TARGET ${TEST_TARGET_NAME})
-
-    file(STRINGS "${TEST_SOURCE_FILE}" LIBRARIES REGEX "//[ \t]*@CMAKE_CUTE_LIBRARY=.*")
-    file(STRINGS "${TEST_SOURCE_FILE}" DEPENDENCIES REGEX "//[ \t]*@CMAKE_CUTE_DEPENDENCY=.*")
-
-    set(LIBS "")
-    set(DEPS "")
-
-    foreach(LIBRARY IN LISTS LIBRARIES)
-      string(REGEX REPLACE "//[ \t]*@CMAKE_CUTE_LIBRARY=(.*)" "\\1" LIBRARY ${LIBRARY})
-      list(APPEND LIBS ${LIBRARY})
-    endforeach()
-
-    foreach(DEPENDENCY IN LISTS DEPENDENCIES)
-      string(REGEX REPLACE "//[ \t]*@CMAKE_CUTE_DEPENDENCY=(.*)" "\\1" DEPENDENCY ${DEPENDENCY})
-      list(APPEND DEPS "${PROJECT_SOURCE_DIR}/${DEPENDENCY}")
-    endforeach()
-
-    message(STATUS "${BYE}Adding test ${BBL}${TEST_NAME}${RST}")
-
-    add_executable(${TEST_TARGET_NAME} ${TEST_SOURCE_FILE} ${DEPS})
-
-    if(TARGET ${TEST_TARGET_NAME})
-      target_link_libraries(${TEST_TARGET_NAME} ${LIBS})
-      add_test(NAME ${TEST_TARGET_NAME} WORKING_DIRECTORY ${CUTE_TEST_REPORTS_DIRECTORY} COMMAND ${TEST_TARGET_NAME})
-      if(NOT CUTE_SKIP_RUN_UNIT_TESTS)
-        add_custom_target(cute_${TEST_TARGET_NAME} ALL
-                          COMMAND ctest -R ${TEST_TARGET_NAME} -Q --output-on-failure
-                          DEPENDS ${TEST_TARGET_NAME}
-                          WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
-                          COMMENT "Running CUTE test ${TEST_NAME} ..."
-                          VERBATIM)
-      endif(NOT CUTE_SKIP_RUN_UNIT_TESTS)
-    endif()
+    message(STATUS "Registering CUTE test '${CUTE_TEST_GROUP}::${TEST_NAME}'")
+    add_executable(${TEST_TARGET_NAME} ${TEST_SOURCE_FILE} ${CUTE_TEST_DEPENDENCIES})
+    target_link_libraries(${TEST_TARGET_NAME} ${CUTE_TEST_LIBRARIES})
+    add_test(NAME "${TEST_TARGET_NAME}"
+      WORKING_DIRECTORY "${${CUTE_${PROJECT_NAME}_UPPER}_CUTE_REPORTS_DIRECTORY}"
+      COMMAND ${TEST_TARGET_NAME}
+    )
+
+    if(${CUTE_TEST_RUN_DURING_BUILD})
+      set(CUTE_TEST_RUN_TARGET "ALL")
+    endif()
+    add_custom_target(cute_test_${TEST_TARGET_NAME} ${CUTE_TEST_RUN_TARGET}
+      COMMAND ctest -R ${TEST_TARGET_NAME} -Q --output-on-failure
+      DEPENDS ${TEST_TARGET_NAME}
+      COMMENT "Running CUTE test '${CUTE_TEST_GROUP}::${TEST_NAME}' ..."
+      VERBATIM)
+
+    set(GROUP_TARGET "cute_group_${TEST_TARGET_GROUP}")
+    if(NOT TARGET ${GROUP_TARGET})
+      add_custom_target(${GROUP_TARGET}
+        COMMAND ctest -R ${TEST_TARGET_GROUP}* -Q ---output-on-failure
+        DEPENDS ${TEST_TARGET_NAME}
+        COMMENT "Running tests in group '${CUTE_TEST_GROUP}' ..."
+        VERBATIM)
+    else()
+      add_dependencies(${GROUP_TARGET} ${TEST_TARGET_NAME})
+    endif()
+
+    string(TOLOWER ${PROJECT_NAME} CUTE_TEST_PROJECT_GROUP)
+    if(NOT TARGET "cute_all_${CUTE_TEST_PROJECT_GROUP}")
+      add_custom_target("cute_all_${CUTE_TEST_PROJECT_GROUP}"
+        COMMAND ctest -R ${CUTE_TEST_PROJECT_GROUP}* -Q --output-on-failure
+        DEPENDS ${TEST_TARGET_NAME}
+        COMMENT "Running CUTE tests of '${PROJECT_NAME}' ..."
+        VERBATIM)
+    else()
+      add_dependencies(cute_all_${CUTE_TEST_PROJECT_GROUP} ${TEST_TARGET_NAME})
+    endif()
+
+    if(NOT TARGET "cute_all")
+      add_custom_target("cute_all"
+        DEPENDS cute_all_${CUTE_TEST_PROJECT_GROUP}
+        VERBATIM)
+    else()
+      add_dependencies(cute_all cute_all_${CUTE_TEST_PROJECT_GROUP})
+    endif()
+
   endif()
 endfunction()


Fix clang/gcc detection since CMAKE_CXX_COMPILER_ID no longer works for cross-compiling

--- cmake/fips.cmake
+++ cmake/fips.cmake
@@ -106,17 +106,25 @@

     # detect compiler
     message("CMAKE_CXX_COMPILER_ID: ${CMAKE_CXX_COMPILER_ID}")
-    if (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
+    if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
         set(FIPS_CLANG 1)
         message("Detected C++ Compiler: Clang (FIPS_CLANG)")
-    elseif (${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
+    elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
         set(FIPS_GCC 1)
         message("Detected C++ Compiler: GCC (FIPS_GCC)")
     elseif (MSVC)
         set(FIPS_MSVC 1)
         message("Detected C++ Compiler: VStudio (FIPS_MSVC)")
     else()
-        message("Detected C++ Compiler: Unknown")
+        if (FIPS_EMSCRIPTEN OR FIPS_PNACL)
+            set(FIPS_CLANG 1)
+            message("Detect C++ Compiler by platform: Clang (FIPS_CLANG)")
+        elseif (FIPS_ANDROID)
+            set(FIPS_GCC 1)
+            message("Detect C++ Compiler by platform: GCC (FIPS_GCC)")
+        else()
+            message("Detected C++ Compiler: Unknown")
+        endif()
     endif()

     # set FIPS_CONFIG to default if not provided by command line


Use a glob for valgrind suppression files

--- cmake/test.cmake
+++ cmake/test.cmake
@@ -54,11 +54,15 @@
       "--verbose")
   endif ()
   if (VISTK_VALGRIND_USE_SUPPRESSIONS)
-    set(vistk_valgrind_arguments
-      ${vistk_valgrind_arguments}
-      "--suppressions=${vistk_source_dir}/tests/data/valgrind/boost.supp"
-      "--suppressions=${vistk_source_dir}/tests/data/valgrind/glibc.supp"
-      "--suppressions=${vistk_source_dir}/tests/data/valgrind/python2.7.supp")
+    file(GLOB
+      valgrind_suppressions
+      "${vistk_source_dir}/tests/data/valgrind/*.supp")
+
+    foreach (valgrind_suppression ${valgrind_suppressions})
+      set(vistk_valgrind_arguments
+        ${vistk_valgrind_arguments}
+        "--suppressions=${valgrind_suppression}")
+    endforeach ()
   endif ()

   add_custom_target(valgrind)


More robust finding of GLEW on Windows (issue #454), suggested by arekz.

--- src/cmake/externalpackages.cmake
+++ src/cmake/externalpackages.cmake
@@ -249,7 +249,7 @@
 if (USE_OPENGL)
     set (GLEW_VERSION 1.5.1)
     find_library (GLEW_LIBRARIES
-                  NAMES GLEW)
+                  NAMES GLEW glew32)
     find_path (GLEW_INCLUDES
                NAMES glew.h
                PATH_SUFFIXES GL)


Add NO_CLEAN to BUILD_OPTION_ARGS. This fixes NO_CLEAN behaviour.

Before the option was silently ignored.

--- CMakeUnitRunner.cmake
+++ CMakeUnitRunner.cmake
@@ -214,7 +214,7 @@
                              TEST_WORKING_DIRECTORY_NAME
                              TARGET)

-    set (BUILD_STEP_OPTION_ARGS ALLOW_FAIL)
+    set (BUILD_STEP_OPTION_ARGS ALLOW_FAIL NO_CLEAN)

     cmake_parse_arguments (BUILD_STEP
                            "${BUILD_STEP_OPTION_ARGS}"