Improved FindGFlags for passing Travis unit test

Change-Id: I745d95e276614ec5520e137575dece83c9106936

--- cmake/FindGflags.cmake
+++ cmake/FindGflags.cmake
@@ -31,6 +31,13 @@

 # FindGflags.cmake - Find Google gflags logging library.
 #
+# This module will first attempt to find an exported CMake configuration for
+# gflags, which should be present for gflags versions >= 2.1 which are built
+# with CMake, in which case the exported configuration is used (albeit with
+# the values replicated to those below to ensure compatibility).  If no
+# exported CMake configuration for gflags is found, then a standard search is
+# performed for the gflags components.
+#
 # This module defines the following variables:
 #
 # GFLAGS_FOUND: TRUE iff gflags is found.
@@ -42,7 +49,8 @@
 #                   gflags to be something else (i.e. google for legacy
 #                   compatibility).
 #
-# The following variables control the behaviour of this module:
+# The following variables control the behaviour of this module when an exported
+# gflags CMake configuration is not found.
 #
 # GFLAGS_INCLUDE_DIR_HINTS: List of additional directories in which to
 #                           search for gflags includes, e.g: /timbuktu/include.
@@ -65,8 +73,8 @@
 # GFLAGS_LIBRARY: gflags library, not including the libraries of any
 #                 dependencies.

-# Reset CALLERS_CMAKE_FIND_LIBRARY_PREFIXES to its value when
-# FindGflags was invoked.
+# Reset CALLERS_CMAKE_FIND_LIBRARY_PREFIXES to its value when FindGflags was
+# invoked, necessary for MSVC.
 MACRO(GFLAGS_RESET_FIND_LIBRARY_PREFIX)
   IF (MSVC)
     SET(CMAKE_FIND_LIBRARY_PREFIXES "${CALLERS_CMAKE_FIND_LIBRARY_PREFIXES}")
@@ -106,311 +114,322 @@
   ENDIF ()
 ENDMACRO(GFLAGS_REPORT_NOT_FOUND)

-# A cut down version of CMake's check_cxx_source_compiles() macro, which
-# supports specification of the CMAKE_BUILD_TYPE with which the test should
-# be compiled (but not REGEX matching of the output).  This is important
-# on Windows, for at least the NMake generator, which otherwise chooses
-# Debug, when the gflags library will typically be compiled in Release, and
-# MSVC will then fail to build, thus making all check_cxx_source_compiles()
-# tests fail.
-#
-# As per the CMake check_cxx_source_compiles() macro, we assume the following
-# variables can be set before this is invoked:
-#
-#    CMAKE_REQUIRED_FLAGS - String of compile command line flags.
-#    CMAKE_REQUIRED_DEFINITIONS - List of macros to define (-DFOO=bar).
-#    CMAKE_REQUIRED_INCLUDES - List of include directories.
-#    CMAKE_REQUIRED_LIBRARIES - List of libraries to link.
-#
-# This macro is a derivative of the CMake check_cxx_source_compiles() macro
-# distributed under the BSD License, Copyright 2005-2009 Kitware, Inc.
-MACRO(CHECK_CXX_SOURCE_COMPILES_WITH_BUILD_TYPE
-    SOURCE BUILD_TYPE VAR)
-  # Do not rerun test if output variable has an assigned value, ie is not
-  # an empty string.
-  IF ("${VAR}" MATCHES "^${VAR}$")
-    # Verify that the BUILD_TYPE is sane.
-    IF (NOT "${BUILD_TYPE}" STREQUAL "Release" AND
-        NOT "${BUILD_TYPE}" STREQUAL "Debug" AND
-        NOT "${BUILD_TYPE}" STREQUAL "RelWithDebInfo" AND
-        NOT "${BUILD_TYPE}" STREQUAL "MinSizeRel" AND
-        NOT "${BUILD_TYPE}" STREQUAL "")
-      MESSAGE(FATAL_ERROR "Invalid BUILD_TYPE: ${BUILD_TYPE}, is not a "
-        "valid CMAKE_BUILD_TYPE option.")
+# Verify that all variable names passed as arguments are defined (can be empty
+# but must be defined) or raise a fatal error.
+MACRO(GFLAGS_CHECK_VARS_DEFINED)
+  FOREACH(CHECK_VAR ${ARGN})
+    IF (NOT DEFINED ${CHECK_VAR})
+      MESSAGE(FATAL_ERROR "Ceres Bug: ${VAR} is not defined.")
     ENDIF()
-
-    SET(MACRO_CHECK_FUNCTION_DEFINITIONS
-      "-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
-
-    SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES)
-    IF (CMAKE_REQUIRED_LIBRARIES)
-      SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES
-        LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
-    ENDIF()
-
-    SET(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES)
-    IF (CMAKE_REQUIRED_INCLUDES)
-      SET(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES
-        "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
-    ENDIF()
-
-    FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx"
-      "${SOURCE}\n")
-
-    MESSAGE(STATUS "Performing Test ${VAR}")
-    # Pass the CMAKE_BUILD_TYPE to the CMake test project created to execute
-    # the test (main difference over CMake's check_cxx_source_compiles() macro).
-    TRY_COMPILE(${VAR}
-      ${CMAKE_BINARY_DIR}
-      ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx
-      COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
-      ${CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES}
-      CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
-      "-DCMAKE_BUILD_TYPE:STRING=${BUILD_TYPE}"
-      "${CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES}"
-      OUTPUT_VARIABLE OUTPUT)
-
-    IF (${VAR})
-      MESSAGE(STATUS "Performing Test ${VAR} - Success")
-      SET(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
-      FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
-        "Performing C++ SOURCE FILE Test ${VAR} succeded with the following output:\n"
-        "${OUTPUT}\n"
-        "Source file was:\n${SOURCE}\n")
-    ELSE()
-      MESSAGE(STATUS "Performing Test ${VAR} - Failed")
-      SET(${VAR} "" CACHE INTERNAL "Test ${VAR}")
-      FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
-        "Performing C++ SOURCE FILE Test ${VAR} failed with the following output:\n"
-        "${OUTPUT}\n"
-        "Source file was:\n${SOURCE}\n")
-    ENDIF()
-  ENDIF()
-ENDMACRO()
-
-# Handle possible presence of lib prefix for libraries on MSVC, see
-# also GFLAGS_RESET_FIND_LIBRARY_PREFIX().
-IF (MSVC)
-  # Preserve the caller's original values for CMAKE_FIND_LIBRARY_PREFIXES
-  # s/t we can set it back before returning.
-  SET(CALLERS_CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}")
-  # The empty string in this list is important, it represents the case when
-  # the libraries have no prefix (shared libraries / DLLs).
-  SET(CMAKE_FIND_LIBRARY_PREFIXES "lib" "" "${CMAKE_FIND_LIBRARY_PREFIXES}")
-ENDIF (MSVC)
-
-# Search user-installed locations first, so that we prefer user installs
-# to system installs where both exist.
-#
-# TODO: Add standard Windows search locations for gflags.
-LIST(APPEND GFLAGS_CHECK_INCLUDE_DIRS
-  /usr/local/include
-  /usr/local/homebrew/include # Mac OS X
-  /opt/local/var/macports/software # Mac OS X.
-  /opt/local/include
-  /usr/include)
-LIST(APPEND GFLAGS_CHECK_LIBRARY_DIRS
-  /usr/local/lib
-  /usr/local/homebrew/lib # Mac OS X.
-  /opt/local/lib
-  /usr/lib)
-
-# Search supplied hint directories first if supplied.
-FIND_PATH(GFLAGS_INCLUDE_DIR
-  NAMES gflags/gflags.h
-  PATHS ${GFLAGS_INCLUDE_DIR_HINTS}
-  ${GFLAGS_CHECK_INCLUDE_DIRS})
-IF (NOT GFLAGS_INCLUDE_DIR OR
-    NOT EXISTS ${GFLAGS_INCLUDE_DIR})
-  GFLAGS_REPORT_NOT_FOUND(
-    "Could not find gflags include directory, set GFLAGS_INCLUDE_DIR "
-    "to directory containing gflags/gflags.h")
-ENDIF (NOT GFLAGS_INCLUDE_DIR OR
-       NOT EXISTS ${GFLAGS_INCLUDE_DIR})
-
-FIND_LIBRARY(GFLAGS_LIBRARY NAMES gflags
-  PATHS ${GFLAGS_LIBRARY_DIR_HINTS}
-  ${GFLAGS_CHECK_LIBRARY_DIRS})
-IF (NOT GFLAGS_LIBRARY OR
-    NOT EXISTS ${GFLAGS_LIBRARY})
-  GFLAGS_REPORT_NOT_FOUND(
-    "Could not find gflags library, set GFLAGS_LIBRARY "
-    "to full path to libgflags.")
-ENDIF (NOT GFLAGS_LIBRARY OR
-       NOT EXISTS ${GFLAGS_LIBRARY})
-
-# gflags typically requires a threading library (which is OS dependent), note
-# that this defines the CMAKE_THREAD_LIBS_INIT variable.  If we are able to
-# detect threads, we assume that gflags requires it.
-FIND_PACKAGE(Threads QUIET)
-SET(GFLAGS_LINK_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
-# On Windows (including MinGW), the Shlwapi library is used by gflags if
-# available.
-IF (WIN32)
-  INCLUDE(CheckIncludeFileCXX)
-  CHECK_INCLUDE_FILE_CXX("shlwapi.h" HAVE_SHLWAPI)
-  IF (HAVE_SHLWAPI)
-    LIST(APPEND GFLAGS_LINK_LIBRARIES shlwapi.lib)
-  ENDIF(HAVE_SHLWAPI)
-ENDIF (WIN32)
-
-# Mark internally as found, then verify. GFLAGS_REPORT_NOT_FOUND() unsets
-# if called.
-SET(GFLAGS_FOUND TRUE)
-
-# Identify what namespace gflags was built with.
-IF (GFLAGS_INCLUDE_DIR AND NOT GFLAGS_NAMESPACE)
-  # To handle Windows peculiarities / CMake bugs on MSVC we try two approaches
-  # to detect the gflags namespace:
-  #
-  # 1) Try to use a custom version of check_cxx_source_compiles():
-  #    check_cxx_source_compiles_with_build_type(),
-  #    to compile a trivial program with the two choices for the gflags
-  #    namespace.
-  #
-  #    This works on all OSs except Windows.  On Windows, if using NMake
-  #    generator the previous method also works, if using Visual Studio, it does
-  #    not, because our explicit instruction regarding the CMAKE_BUILD_TYPE is
-  #    ignored by msbuild.  This breaks detection because MSVC requires that the
-  #    build type of the test project used by check_cxx_source_compiles() match
-  #    that of gflags.  However, msbuild forces the test project to use Debug,
-  #    but gflags will be built in Release.
-  #
-  # 2) [In the event 1) fails] Use regex on the gflags.h header file to try to
-  #    determine the gflags namespace.  Whilst this is less robust than 1),
-  #    it does avoid any interaction with msbuild.
-
-  # On Windows, it is required that the build type of the test app match that
-  # of gflags, as CMAKE_BUILD_TYPE may not be defined when this is called, we
-  # try each in turn.
-  LIST(APPEND TEST_BUILD_TYPES Release Debug)
-  FOREACH(BUILD_TYPE ${TEST_BUILD_TYPES})
-    STRING(TOUPPER "${BUILD_TYPE}" BUILD_TYPE_UPPERCASE)
-    # Setup include path & link library for gflags for CHECK_CXX_SOURCE_COMPILES.
-    SET(CMAKE_REQUIRED_INCLUDES ${GFLAGS_INCLUDE_DIR})
-    SET(CMAKE_REQUIRED_LIBRARIES ${GFLAGS_LIBRARY} ${GFLAGS_LINK_LIBRARIES})
-    # First try the (older) google namespace.  Note that the output variable
-    # MUST be unique to the build type as otherwise the test is not repeated as
-    # it is assumed to have already been performed.
-    CHECK_CXX_SOURCE_COMPILES_WITH_BUILD_TYPE(
-      "#include <gflags/gflags.h>
+  ENDFOREACH()
+ENDMACRO(GFLAGS_CHECK_VARS_DEFINED)
+
+# Use check_cxx_source_compiles() to compile trivial test programs to determine
+# the gflags namespace.  This works on all OSs except Windows.  If using Visual
+# Studio, it fails because msbuild forces check_cxx_source_compiles() to use
+# CMAKE_BUILD_TYPE=Debug for the test project, which usually breaks detection
+# because MSVC requires that the test project use the same build type as gflags,
+# which would normally be built in Release.
+#
+# Defines: GFLAGS_NAMESPACE in the caller's scope with the detected namespace,
+#          which is blank (empty string, will test FALSE is CMake conditionals)
+#          if detection failed.
+FUNCTION(GFLAGS_CHECK_GFLAGS_NAMESPACE_USING_TRY_COMPILE)
+  # Verify that all required variables are defined.
+  GFLAGS_CHECK_VARS_DEFINED(
+    GFLAGS_INCLUDE_DIR GFLAGS_LIBRARY GFLAGS_LINK_LIBRARIES)
+  # Ensure that GFLAGS_NAMESPACE is always unset on completion unless
+  # we explicitly set if after having the correct namespace.
+  SET(GFLAGS_NAMESPACE "" PARENT_SCOPE)
+
+  INCLUDE(CheckCXXSourceCompiles)
+  # Setup include path & link library for gflags for CHECK_CXX_SOURCE_COMPILES.
+  SET(CMAKE_REQUIRED_INCLUDES ${GFLAGS_INCLUDE_DIR})
+  SET(CMAKE_REQUIRED_LIBRARIES ${GFLAGS_LIBRARY} ${GFLAGS_LINK_LIBRARIES})
+  # First try the (older) google namespace.  Note that the output variable
+  # MUST be unique to the build type as otherwise the test is not repeated as
+  # it is assumed to have already been performed.
+  CHECK_CXX_SOURCE_COMPILES(
+    "#include <gflags/gflags.h>
      int main(int argc, char * argv[]) {
        google::ParseCommandLineFlags(&argc, &argv, true);
        return 0;
      }"
-     ${BUILD_TYPE}
-     GFLAGS_IN_GOOGLE_NAMESPACE_${BUILD_TYPE_UPPERCASE})
-   IF (GFLAGS_IN_GOOGLE_NAMESPACE_${BUILD_TYPE_UPPERCASE})
-     SET(GFLAGS_NAMESPACE google)
-     BREAK()
-   ELSE (GFLAGS_IN_GOOGLE_NAMESPACE_${BUILD_TYPE_UPPERCASE})
-     # Try (newer) gflags namespace instead.  Note that the output variable
-     # MUST be unique to the build type as otherwise the test is not repeated as
-     # it is assumed to have already been performed.
-     SET(CMAKE_REQUIRED_INCLUDES ${GFLAGS_INCLUDE_DIR})
-     SET(CMAKE_REQUIRED_LIBRARIES ${GFLAGS_LIBRARY} ${GFLAGS_LINK_LIBRARIES})
-     CHECK_CXX_SOURCE_COMPILES_WITH_BUILD_TYPE(
-       "#include <gflags/gflags.h>
-       int main(int argc, char * argv[]) {
-         gflags::ParseCommandLineFlags(&argc, &argv, true);
-         return 0;
-       }"
-       ${BUILD_TYPE}
-       GFLAGS_IN_GFLAGS_NAMESPACE_${BUILD_TYPE_UPPERCASE})
-     IF (GFLAGS_IN_GFLAGS_NAMESPACE_${BUILD_TYPE_UPPERCASE})
-       SET(GFLAGS_NAMESPACE gflags)
-       BREAK()
-     ENDIF (GFLAGS_IN_GFLAGS_NAMESPACE_${BUILD_TYPE_UPPERCASE})
-   ENDIF (GFLAGS_IN_GOOGLE_NAMESPACE_${BUILD_TYPE_UPPERCASE})
- ENDFOREACH()
-
- IF (NOT GFLAGS_NAMESPACE)
-   # Failed to determine gflags namespace using
-   # check_cxx_source_compiles_with_build_type() method, try and obtain it
-   # using regex on the gflags header instead.
-   MESSAGE(STATUS "Failed to find gflags namespace using using "
-     "check_cxx_source_compiles(), trying namespace regex instead, "
-     "this is expected on Windows.")
-   # Scan gflags.h to identify what namespace gflags was built with.
-   SET(GFLAGS_HEADER_FILE ${GFLAGS_INCLUDE_DIR}/gflags/gflags.h)
-   IF (NOT EXISTS ${GFLAGS_HEADER_FILE})
-     GFLAGS_REPORT_NOT_FOUND(
-       "Could not find file: ${GFLAGS_HEADER_FILE} "
-       "containing namespace information in gflags install located at: "
-       "${GFLAGS_INCLUDE_DIR}.")
-   ELSE (NOT EXISTS ${GFLAGS_HEADER_FILE})
-     FILE(READ ${GFLAGS_HEADER_FILE} GFLAGS_HEADER_FILE_CONTENTS)
-
-     STRING(REGEX MATCH "namespace [A-Za-z]+"
-       GFLAGS_NAMESPACE "${GFLAGS_HEADER_FILE_CONTENTS}")
-     STRING(REGEX REPLACE "namespace ([A-Za-z]+)" "\\1"
-       GFLAGS_NAMESPACE "${GFLAGS_NAMESPACE}")
-
-     IF (NOT GFLAGS_NAMESPACE)
-      GFLAGS_REPORT_NOT_FOUND(
-        "Failed to extract gflags namespace from header file: "
-        "${GFLAGS_HEADER_FILE}.")
-     ENDIF (NOT GFLAGS_NAMESPACE)
-
-     # Verify that the namespace is either google or gflags.  Strictly
-     # speaking the users can specify something else when building gflags,
-     # but doing so would cause so many compatibility issues, that they should
-     # not have done, so any mismatch is almost certainly a regex failure.
-     IF (NOT GFLAGS_NAMESPACE STREQUAL "google" AND
-         NOT GFLAGS_NAMESPACE STREQUAL "gflags")
-       GFLAGS_REPORT_NOT_FOUND(
-         "Failed to extract valid gflags namespace from header file: "
-         "${GFLAGS_HEADER_FILE}, result: ${GFLAGS_NAMESPACE} is not "
-         "google or gflags.")
-     ENDIF()
-   ENDIF (NOT EXISTS ${GFLAGS_HEADER_FILE})
- ENDIF (NOT GFLAGS_NAMESPACE)
-
- IF (NOT GFLAGS_NAMESPACE)
-   GFLAGS_REPORT_NOT_FOUND(
-     "Failed to determine gflags namespace either by "
-     "check_cxx_source_compiles(), or namespace regex.")
- ENDIF (NOT GFLAGS_NAMESPACE)
-ENDIF (GFLAGS_INCLUDE_DIR AND NOT GFLAGS_NAMESPACE)
-
-# Make the GFLAGS_NAMESPACE a cache variable s/t the user can view it, and could
-# overwrite it in the CMake GUI.
-SET(GFLAGS_NAMESPACE "${GFLAGS_NAMESPACE}" CACHE STRING
-  "gflags namespace (google or gflags)" FORCE)
-
-# gflags does not seem to provide any record of the version in its
-# source tree, thus cannot extract version.
-
-# Catch case when caller has set GFLAGS_NAMESPACE in the cache / GUI
-# with an invalid value.
-IF (GFLAGS_NAMESPACE AND
-    NOT GFLAGS_NAMESPACE STREQUAL "google" AND
-    NOT GFLAGS_NAMESPACE STREQUAL "gflags")
-  GFLAGS_REPORT_NOT_FOUND(
-    "Caller defined GFLAGS_NAMESPACE:"
-    " ${GFLAGS_NAMESPACE} is not valid, not google or gflags.")
-ENDIF ()
-# Catch case when caller has set GFLAGS_INCLUDE_DIR in the cache / GUI and
-# thus FIND_[PATH/LIBRARY] are not called, but specified locations are
-# invalid, otherwise we would report the library as found.
-IF (GFLAGS_INCLUDE_DIR AND
+     GFLAGS_IN_GOOGLE_NAMESPACE)
+  IF (GFLAGS_IN_GOOGLE_NAMESPACE)
+    SET(GFLAGS_NAMESPACE google PARENT_SCOPE)
+    RETURN()
+  ENDIF()
+
+  # Try (newer) gflags namespace instead.  Note that the output variable
+  # MUST be unique to the build type as otherwise the test is not repeated as
+  # it is assumed to have already been performed.
+  SET(CMAKE_REQUIRED_INCLUDES ${GFLAGS_INCLUDE_DIR})
+  SET(CMAKE_REQUIRED_LIBRARIES ${GFLAGS_LIBRARY} ${GFLAGS_LINK_LIBRARIES})
+  CHECK_CXX_SOURCE_COMPILES(
+    "#include <gflags/gflags.h>
+     int main(int argc, char * argv[]) {
+        gflags::ParseCommandLineFlags(&argc, &argv, true);
+        return 0;
+     }"
+     GFLAGS_IN_GFLAGS_NAMESPACE)
+  IF (GFLAGS_IN_GFLAGS_NAMESPACE)
+    SET(GFLAGS_NAMESPACE gflags PARENT_SCOPE)
+    RETURN()
+  ENDIF (GFLAGS_IN_GFLAGS_NAMESPACE)
+ENDFUNCTION(GFLAGS_CHECK_GFLAGS_NAMESPACE_USING_TRY_COMPILE)
+
+# Use regex on the gflags headers to attempt to determine the gflags namespace.
+# Checks both gflags.h (contained namespace on versions < 2.1.2) and
+# gflags_declare.h, which contains the namespace on versions >= 2.1.2.
+# In general, this method should only be used when
+# GFLAGS_CHECK_GFLAGS_NAMESPACE_USING_TRY_COMPILE() cannot be used, or has
+# failed.
+#
+# Defines: GFLAGS_NAMESPACE in the caller's scope with the detected namespace,
+#          which is blank (empty string, will test FALSE is CMake conditionals)
+#          if detection failed.
+FUNCTION(GFLAGS_CHECK_GFLAGS_NAMESPACE_USING_REGEX)
+  # Verify that all required variables are defined.
+  GFLAGS_CHECK_VARS_DEFINED(GFLAGS_INCLUDE_DIR)
+  # Ensure that GFLAGS_NAMESPACE is always undefined on completion unless
+  # we explicitly set if after having the correct namespace.
+  SET(GFLAGS_NAMESPACE "" PARENT_SCOPE)
+
+  # Scan gflags.h to identify what namespace gflags was built with.  On
+  # versions of gflags < 2.1.2, gflags.h was configured with the namespace
+  # directly, on >= 2.1.2, gflags.h uses the GFLAGS_NAMESPACE #define which
+  # is defined in gflags_declare.h, we try each location in turn.
+  SET(GFLAGS_HEADER_FILE ${GFLAGS_INCLUDE_DIR}/gflags/gflags.h)
+  IF (NOT EXISTS ${GFLAGS_HEADER_FILE})
+    GFLAGS_REPORT_NOT_FOUND(
+      "Could not find file: ${GFLAGS_HEADER_FILE} "
+      "containing namespace information in gflags install located at: "
+      "${GFLAGS_INCLUDE_DIR}.")
+  ENDIF()
+  FILE(READ ${GFLAGS_HEADER_FILE} GFLAGS_HEADER_FILE_CONTENTS)
+
+  STRING(REGEX MATCH "namespace [A-Za-z]+"
+    GFLAGS_NAMESPACE "${GFLAGS_HEADER_FILE_CONTENTS}")
+  STRING(REGEX REPLACE "namespace ([A-Za-z]+)" "\\1"
+    GFLAGS_NAMESPACE "${GFLAGS_NAMESPACE}")
+
+  IF (NOT GFLAGS_NAMESPACE)
+    GFLAGS_REPORT_NOT_FOUND(
+      "Failed to extract gflags namespace from header file: "
+      "${GFLAGS_HEADER_FILE}.")
+  ENDIF (NOT GFLAGS_NAMESPACE)
+
+  IF (GFLAGS_NAMESPACE STREQUAL "google" OR
+      GFLAGS_NAMESPACE STREQUAL "gflags")
+    # Found valid gflags namespace from gflags.h.
+    SET(GFLAGS_NAMESPACE "${GFLAGS_NAMESPACE}" PARENT_SCOPE)
+    RETURN()
+  ENDIF()
+
+  # Failed to find gflags namespace from gflags.h, gflags is likely a new
+  # version, check gflags_declare.h, which in newer versions (>= 2.1.2) contains
+  # the GFLAGS_NAMESPACE #define, which is then referenced in gflags.h.
+  SET(GFLAGS_DECLARE_FILE ${GFLAGS_INCLUDE_DIR}/gflags/gflags_declare.h)
+  IF (NOT EXISTS ${GFLAGS_DECLARE_FILE})
+    GFLAGS_REPORT_NOT_FOUND(
+      "Could not find file: ${GFLAGS_DECLARE_FILE} "
+      "containing namespace information in gflags install located at: "
+      "${GFLAGS_INCLUDE_DIR}.")
+  ENDIF()
+  FILE(READ ${GFLAGS_DECLARE_FILE} GFLAGS_DECLARE_FILE_CONTENTS)
+
+  STRING(REGEX MATCH "#define GFLAGS_NAMESPACE [A-Za-z]+"
+    GFLAGS_NAMESPACE "${GFLAGS_DECLARE_FILE_CONTENTS}")
+  STRING(REGEX REPLACE "#define GFLAGS_NAMESPACE ([A-Za-z]+)" "\\1"
+    GFLAGS_NAMESPACE "${GFLAGS_NAMESPACE}")
+
+  IF (NOT GFLAGS_NAMESPACE)
+    GFLAGS_REPORT_NOT_FOUND(
+      "Failed to extract gflags namespace from declare file: "
+      "${GFLAGS_DECLARE_FILE}.")
+  ENDIF (NOT GFLAGS_NAMESPACE)
+
+  IF (GFLAGS_NAMESPACE STREQUAL "google" OR
+      GFLAGS_NAMESPACE STREQUAL "gflags")
+    # Found valid gflags namespace from gflags.h.
+    SET(GFLAGS_NAMESPACE "${GFLAGS_NAMESPACE}" PARENT_SCOPE)
+    RETURN()
+  ENDIF()
+ENDFUNCTION(GFLAGS_CHECK_GFLAGS_NAMESPACE_USING_REGEX)
+
+# -----------------------------------------------------------------
+
+# Newer versions of gflags (2.1+) use CMake to build, and thus provide an
+# exported CMake configuration.  We use this in preference to perform our own
+# manual search for the installed components if it exists.
+FIND_PACKAGE(gflags QUIET NO_MODULE)
+SET(FOUND_INSTALLED_GFLAGS_CMAKE_CONFIGURATION ${gflags_FOUND})
+IF (FOUND_INSTALLED_GFLAGS_CMAKE_CONFIGURATION)
+  MESSAGE(STATUS "Detected gflags CMake install version: ${gflags_VERSION}")
+  SET(GFLAGS_FOUND ${gflags_FOUND})
+  SET(GFLAGS_INCLUDE_DIR ${gflags_INCLUDE_DIR})
+  SET(GFLAGS_LIBRARY ${gflags_LIBRARIES})
+
+  # gflags does not export the namespace in their CMake configuration, so
+  # use our function to determine what it should be, as it can be either
+  # gflags or google dependent upon version & configuration.
+  #
+  # NOTE: We use the regex method to determine the namespace here, as
+  #       check_cxx_source_compiles() will not use imported targets, which
+  #       is what gflags will be in this case.
+  GFLAGS_CHECK_GFLAGS_NAMESPACE_USING_REGEX()
+
+  IF (NOT GFLAGS_NAMESPACE)
+    GFLAGS_REPORT_NOT_FOUND(
+      "Failed to determine gflags namespace using regex for gflags "
+      "version: ${gflags_VERSION} exported here: ${gflags_DIR} using CMake.")
+  ENDIF (NOT GFLAGS_NAMESPACE)
+ELSE (FOUND_INSTALLED_GFLAGS_CMAKE_CONFIGURATION)
+  # Failed to detect a gflags 2.1+ install exported using CMake, perform
+  # a manual search for all components.
+
+  # Handle possible presence of lib prefix for libraries on MSVC, see
+  # also GFLAGS_RESET_FIND_LIBRARY_PREFIX().
+  IF (MSVC)
+    # Preserve the caller's original values for CMAKE_FIND_LIBRARY_PREFIXES
+    # s/t we can set it back before returning.
+    SET(CALLERS_CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}")
+    # The empty string in this list is important, it represents the case when
+    # the libraries have no prefix (shared libraries / DLLs).
+    SET(CMAKE_FIND_LIBRARY_PREFIXES "lib" "" "${CMAKE_FIND_LIBRARY_PREFIXES}")
+  ENDIF (MSVC)
+
+  # Search user-installed locations first, so that we prefer user installs
+  # to system installs where both exist.
+  #
+  # TODO: Add standard Windows search locations for gflags.
+  LIST(APPEND GFLAGS_CHECK_INCLUDE_DIRS
+    /usr/local/include
+    /usr/local/homebrew/include # Mac OS X
+    /opt/local/var/macports/software # Mac OS X.
+    /opt/local/include
+    /usr/include)
+  LIST(APPEND GFLAGS_CHECK_LIBRARY_DIRS
+    /usr/local/lib
+    /usr/local/homebrew/lib # Mac OS X.
+    /opt/local/lib
+    /usr/lib)
+
+  # Search supplied hint directories first if supplied.
+  FIND_PATH(GFLAGS_INCLUDE_DIR
+    NAMES gflags/gflags.h
+    PATHS ${GFLAGS_INCLUDE_DIR_HINTS}
+    ${GFLAGS_CHECK_INCLUDE_DIRS})
+  IF (NOT GFLAGS_INCLUDE_DIR OR
+      NOT EXISTS ${GFLAGS_INCLUDE_DIR})
+    GFLAGS_REPORT_NOT_FOUND(
+      "Could not find gflags include directory, set GFLAGS_INCLUDE_DIR "
+      "to directory containing gflags/gflags.h")
+  ENDIF (NOT GFLAGS_INCLUDE_DIR OR
+    NOT EXISTS ${GFLAGS_INCLUDE_DIR})
+
+  FIND_LIBRARY(GFLAGS_LIBRARY NAMES gflags
+    PATHS ${GFLAGS_LIBRARY_DIR_HINTS}
+    ${GFLAGS_CHECK_LIBRARY_DIRS})
+  IF (NOT GFLAGS_LIBRARY OR
+      NOT EXISTS ${GFLAGS_LIBRARY})
+    GFLAGS_REPORT_NOT_FOUND(
+      "Could not find gflags library, set GFLAGS_LIBRARY "
+      "to full path to libgflags.")
+  ENDIF (NOT GFLAGS_LIBRARY OR
+    NOT EXISTS ${GFLAGS_LIBRARY})
+
+  # gflags typically requires a threading library (which is OS dependent), note
+  # that this defines the CMAKE_THREAD_LIBS_INIT variable.  If we are able to
+  # detect threads, we assume that gflags requires it.
+  FIND_PACKAGE(Threads QUIET)
+  SET(GFLAGS_LINK_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
+  # On Windows (including MinGW), the Shlwapi library is used by gflags if
+  # available.
+  IF (WIN32)
+    INCLUDE(CheckIncludeFileCXX)
+    CHECK_INCLUDE_FILE_CXX("shlwapi.h" HAVE_SHLWAPI)
+    IF (HAVE_SHLWAPI)
+      LIST(APPEND GFLAGS_LINK_LIBRARIES shlwapi.lib)
+    ENDIF(HAVE_SHLWAPI)
+  ENDIF (WIN32)
+
+  # Mark internally as found, then verify. GFLAGS_REPORT_NOT_FOUND() unsets
+  # if called.
+  SET(GFLAGS_FOUND TRUE)
+
+  # Identify what namespace gflags was built with.
+  IF (GFLAGS_INCLUDE_DIR AND NOT GFLAGS_NAMESPACE)
+    # To handle Windows peculiarities / CMake bugs on MSVC we try two approaches
+    # to detect the gflags namespace:
+    #
+    # 1) Try to use check_cxx_source_compiles() to compile a trivial program
+    #    with the two choices for the gflags namespace.
+    #
+    # 2) [In the event 1) fails] Use regex on the gflags headers to try to
+    #    determine the gflags namespace.  Whilst this is less robust than 1),
+    #    it does avoid any interaction with msbuild.
+    GFLAGS_CHECK_GFLAGS_NAMESPACE_USING_TRY_COMPILE()
+
+    IF (NOT GFLAGS_NAMESPACE)
+      # Failed to determine gflags namespace using check_cxx_source_compiles()
+      # method, try and obtain it using regex on the gflags headers instead.
+      MESSAGE(STATUS "Failed to find gflags namespace using using "
+        "check_cxx_source_compiles(), trying namespace regex instead, "
+        "this is expected on Windows.")
+      GFLAGS_CHECK_GFLAGS_NAMESPACE_USING_REGEX()
+
+      IF (NOT GFLAGS_NAMESPACE)
+        GFLAGS_REPORT_NOT_FOUND(
+          "Failed to determine gflags namespace either by "
+          "check_cxx_source_compiles(), or namespace regex.")
+      ENDIF (NOT GFLAGS_NAMESPACE)
+    ENDIF (NOT GFLAGS_NAMESPACE)
+  ENDIF (GFLAGS_INCLUDE_DIR AND NOT GFLAGS_NAMESPACE)
+
+  # Make the GFLAGS_NAMESPACE a cache variable s/t the user can view it, and could
+  # overwrite it in the CMake GUI.
+  SET(GFLAGS_NAMESPACE "${GFLAGS_NAMESPACE}" CACHE STRING
+    "gflags namespace (google or gflags)" FORCE)
+
+  # gflags does not seem to provide any record of the version in its
+  # source tree, thus cannot extract version.
+
+  # Catch case when caller has set GFLAGS_NAMESPACE in the cache / GUI
+  # with an invalid value.
+  IF (GFLAGS_NAMESPACE AND
+      NOT GFLAGS_NAMESPACE STREQUAL "google" AND
+      NOT GFLAGS_NAMESPACE STREQUAL "gflags")
+    GFLAGS_REPORT_NOT_FOUND(
+      "Caller defined GFLAGS_NAMESPACE:"
+      " ${GFLAGS_NAMESPACE} is not valid, not google or gflags.")
+  ENDIF ()
+  # Catch case when caller has set GFLAGS_INCLUDE_DIR in the cache / GUI and
+  # thus FIND_[PATH/LIBRARY] are not called, but specified locations are
+  # invalid, otherwise we would report the library as found.
+  IF (GFLAGS_INCLUDE_DIR AND
+      NOT EXISTS ${GFLAGS_INCLUDE_DIR}/gflags/gflags.h)
+    GFLAGS_REPORT_NOT_FOUND(
+      "Caller defined GFLAGS_INCLUDE_DIR:"
+      " ${GFLAGS_INCLUDE_DIR} does not contain gflags/gflags.h header.")
+  ENDIF (GFLAGS_INCLUDE_DIR AND
     NOT EXISTS ${GFLAGS_INCLUDE_DIR}/gflags/gflags.h)
-  GFLAGS_REPORT_NOT_FOUND(
-    "Caller defined GFLAGS_INCLUDE_DIR:"
-    " ${GFLAGS_INCLUDE_DIR} does not contain gflags/gflags.h header.")
-ENDIF (GFLAGS_INCLUDE_DIR AND
-       NOT EXISTS ${GFLAGS_INCLUDE_DIR}/gflags/gflags.h)
-# TODO: This regex for gflags library is pretty primitive, we use lowercase
-#       for comparison to handle Windows using CamelCase library names, could
-#       this check be better?
-STRING(TOLOWER "${GFLAGS_LIBRARY}" LOWERCASE_GFLAGS_LIBRARY)
-IF (GFLAGS_LIBRARY AND
+  # TODO: This regex for gflags library is pretty primitive, we use lowercase
+  #       for comparison to handle Windows using CamelCase library names, could
+  #       this check be better?
+  STRING(TOLOWER "${GFLAGS_LIBRARY}" LOWERCASE_GFLAGS_LIBRARY)
+  IF (GFLAGS_LIBRARY AND
+      NOT "${LOWERCASE_GFLAGS_LIBRARY}" MATCHES ".*gflags[^/]*")
+    GFLAGS_REPORT_NOT_FOUND(
+      "Caller defined GFLAGS_LIBRARY: "
+      "${GFLAGS_LIBRARY} does not match gflags.")
+  ENDIF (GFLAGS_LIBRARY AND
     NOT "${LOWERCASE_GFLAGS_LIBRARY}" MATCHES ".*gflags[^/]*")
-  GFLAGS_REPORT_NOT_FOUND(
-    "Caller defined GFLAGS_LIBRARY: "
-    "${GFLAGS_LIBRARY} does not match gflags.")
-ENDIF (GFLAGS_LIBRARY AND
-       NOT "${LOWERCASE_GFLAGS_LIBRARY}" MATCHES ".*gflags[^/]*")
+
+  GFLAGS_RESET_FIND_LIBRARY_PREFIX()
+
+ENDIF(FOUND_INSTALLED_GFLAGS_CMAKE_CONFIGURATION)

 # Set standard CMake FindPackage variables if found.
 IF (GFLAGS_FOUND)
@@ -418,8 +437,6 @@
   SET(GFLAGS_LIBRARIES ${GFLAGS_LIBRARY} ${GFLAGS_LINK_LIBRARIES})
 ENDIF (GFLAGS_FOUND)

-GFLAGS_RESET_FIND_LIBRARY_PREFIX()
-
 # Handle REQUIRED / QUIET optional arguments.
 INCLUDE(FindPackageHandleStandardArgs)
 FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gflags DEFAULT_MSG
@@ -429,6 +446,6 @@
 # leave them visible in the standard GUI for the user to set manually.
 IF (GFLAGS_FOUND)
   MARK_AS_ADVANCED(FORCE GFLAGS_INCLUDE_DIR
-                         GFLAGS_LIBRARY
-                         GFLAGS_NAMESPACE)
-ENDIF (GFLAGS_FOUND)
+    GFLAGS_LIBRARY
+    GFLAGS_NAMESPACE)
+ENDIF (GFLAGS_FOUND)


[FindMatlab.cmake] add the Matlab editions up to 2016a

--- cmake/FindMATLAB.cmake
+++ cmake/FindMATLAB.cmake
@@ -126,7 +126,7 @@
     IF((NOT DEFINED MATLAB_ROOT) OR ("${MATLAB_ROOT}" STREQUAL ""))

     # Search for a version of Matlab available, starting from the most modern one to older versions
-      FOREACH(MATVER "R2014b" "R2014a" "R2013b" "R2013a" "R2012b" "R2012a" "R2011b" "R2011a" "R2010b" "R2010a" "R2009b" "R2009a" "R2008b")
+      FOREACH(MATVER "R2016a" "R2015b" "R2015a" "R2014b" "R2014a" "R2013b" "R2013a" "R2012b" "R2012a" "R2011b" "R2011a" "R2010b" "R2010a" "R2009b" "R2009a" "R2008b")
         SET(MATLAB_VERSION ${MATVER})
         IF((NOT DEFINED MATLAB_ROOT) OR ("${MATLAB_ROOT}" STREQUAL ""))
           IF(EXISTS /Applications/MATLAB_${MATVER}.app)


extensions.cmake: add two cc/compile_options callgraph comments

This would have saved me about an hour exploring the code and piecing it
together.

Signed-off-by: Marc Herbert <77e7c7d746b52c6eb01119b65a031ae1f650246d@intel.com>

--- cmake/extensions.cmake
+++ cmake/extensions.cmake
@@ -42,6 +42,25 @@
 #   ${CMAKE_CURRENT_SOURCE_DIR}/random_esp32.c
 #   ${CMAKE_CURRENT_SOURCE_DIR}/utils.c
 # )
+#
+# As a very high-level introduction here are two call graphs that are
+# purposely minimalistic and incomplete.
+#
+#  zephyr_library_cc_option()
+#           |
+#           v
+#  zephyr_library_compile_options()  -->  target_compile_options()
+#
+#
+#  zephyr_cc_option()           --->  target_cc_option()
+#                                          |
+#                                          v
+#  zephyr_cc_option_fallback()  --->  target_cc_option_fallback()
+#                                          |
+#                                          v
+#  zephyr_compile_options()     --->  target_compile_options()
+#
+

 # https://cmake.org/cmake/help/latest/command/target_sources.html
 function(zephyr_sources)


cmake: extensions: Add corresponding ifndef for all ifdef functions

This commit adds the corresponding '_ifndef' functions for all the
existing '_ifdef' functions.

Signed-off-by: Stephanos Ioannidis <dc76e9f0c0006e8f919e0c515c66dbba3982f785@stephanos.io>

--- cmake/extensions.cmake
+++ cmake/extensions.cmake
@@ -1485,6 +1485,48 @@
   endif()
 endfunction()

+function(add_subdirectory_ifndef feature_toggle source_dir)
+  if(NOT ${feature_toggle})
+    add_subdirectory(${source_dir} ${ARGN})
+  endif()
+endfunction()
+
+function(target_sources_ifndef feature_toggle target scope item)
+  if(NOT ${feature_toggle})
+    target_sources(${target} ${scope} ${item} ${ARGN})
+  endif()
+endfunction()
+
+function(target_compile_definitions_ifndef feature_toggle target scope item)
+  if(NOT ${feature_toggle})
+    target_compile_definitions(${target} ${scope} ${item} ${ARGN})
+  endif()
+endfunction()
+
+function(target_include_directories_ifndef feature_toggle target scope item)
+  if(NOT ${feature_toggle})
+    target_include_directories(${target} ${scope} ${item} ${ARGN})
+  endif()
+endfunction()
+
+function(target_link_libraries_ifndef feature_toggle target item)
+  if(NOT ${feature_toggle})
+    target_link_libraries(${target} ${item} ${ARGN})
+  endif()
+endfunction()
+
+function(add_compile_option_ifndef feature_toggle option)
+  if(NOT ${feature_toggle})
+    add_compile_options(${option})
+  endif()
+endfunction()
+
+function(target_compile_option_ifndef feature_toggle target scope option)
+  if(NOT ${feature_toggle})
+    target_compile_options(${target} ${scope} ${option})
+  endif()
+endfunction()
+
 function(target_cc_option_ifndef feature_toggle target scope option)
   if(NOT ${feature_toggle})
     target_cc_option(${target} ${scope} ${option})
@@ -1509,11 +1551,77 @@
   endif()
 endfunction()

+function(zephyr_ld_option_ifndef feature_toggle)
+  if(NOT ${feature_toggle})
+    zephyr_ld_options(${ARGN})
+  endif()
+endfunction()
+
+function(zephyr_link_libraries_ifndef feature_toggle)
+  if(NOT ${feature_toggle})
+    zephyr_link_libraries(${ARGN})
+  endif()
+endfunction()
+
 function(zephyr_compile_options_ifndef feature_toggle)
   if(NOT ${feature_toggle})
     zephyr_compile_options(${ARGN})
   endif()
 endfunction()
+
+function(zephyr_compile_definitions_ifndef feature_toggle)
+  if(NOT ${feature_toggle})
+    zephyr_compile_definitions(${ARGN})
+  endif()
+endfunction()
+
+function(zephyr_include_directories_ifndef feature_toggle)
+  if(NOT ${feature_toggle})
+    zephyr_include_directories(${ARGN})
+  endif()
+endfunction()
+
+function(zephyr_library_compile_definitions_ifndef feature_toggle item)
+  if(NOT ${feature_toggle})
+    zephyr_library_compile_definitions(${item} ${ARGN})
+  endif()
+endfunction()
+
+function(zephyr_library_include_directories_ifndef feature_toggle)
+  if(NOT ${feature_toggle})
+    zephyr_library_include_directories(${ARGN})
+  endif()
+endfunction()
+
+function(zephyr_library_compile_options_ifndef feature_toggle item)
+  if(NOT ${feature_toggle})
+    zephyr_library_compile_options(${item} ${ARGN})
+  endif()
+endfunction()
+
+function(zephyr_link_interface_ifndef feature_toggle interface)
+  if(NOT ${feature_toggle})
+    target_link_libraries(${interface} INTERFACE zephyr_interface)
+  endif()
+endfunction()
+
+function(zephyr_library_link_libraries_ifndef feature_toggle item)
+  if(NOT ${feature_toggle})
+     zephyr_library_link_libraries(${item})
+  endif()
+endfunction()
+
+function(zephyr_linker_sources_ifndef feature_toggle)
+  if(NOT ${feature_toggle})
+    zephyr_linker_sources(${ARGN})
+  endif()
+endfunction()
+
+macro(list_append_ifndef feature_toggle list)
+  if(NOT ${feature_toggle})
+    list(APPEND ${list} ${ARGN})
+  endif()
+endmacro()

 # 3.3. *_option Compiler-compatibility checks
 #


update safeguards.cmake, by default use release mode

--- cmake/safeguards.cmake
+++ cmake/safeguards.cmake
@@ -1,5 +1,13 @@
+# Provides safeguards against in-source builds and bad build types.
+#
+# Variables used::
+#
+#   PROJECT_SOURCE_DIR
+#   PROJECT_BINARY_DIR
+#   CMAKE_BUILD_TYPE
+
 if(NOT CMAKE_BUILD_TYPE)
-    set(CMAKE_BUILD_TYPE "Debug")
+    set(CMAKE_BUILD_TYPE "Release")
 endif()

 if(${PROJECT_SOURCE_DIR} STREQUAL ${PROJECT_BINARY_DIR})
@@ -11,6 +19,7 @@

 if(NOT cmake_build_type_tolower STREQUAL "debug" AND
    NOT cmake_build_type_tolower STREQUAL "release" AND
+   NOT cmake_build_type_tolower STREQUAL "minsizerel" AND
    NOT cmake_build_type_tolower STREQUAL "relwithdebinfo")
-    message(FATAL_ERROR "Unknown build type \"${CMAKE_BUILD_TYPE}\". Allowed values are Debug, Release, RelWithDebInfo (case-insensitive).")
+    message(FATAL_ERROR "Unknown build type \"${CMAKE_BUILD_TYPE}\". Allowed values are Debug, Release, RelWithDebInfo, and MinSizeRel (case-insensitive).")
 endif()


Add mobile service to service list

Add mobile service to service list

--- cmake/sdksCommon.cmake
+++ cmake/sdksCommon.cmake
@@ -110,6 +110,7 @@
 list(APPEND C2J_LIST "mediastore:2017-09-01")
 list(APPEND C2J_LIST "mediastore-data:2017-09-01")
 list(APPEND C2J_LIST "meteringmarketplace:2016-01-14")
+list(APPEND C2J_LIST "mobile:2017-07-01")
 list(APPEND C2J_LIST "mobileanalytics:2014-06-05")
 list(APPEND C2J_LIST "monitoring:2010-08-01")
 list(APPEND C2J_LIST "mq:2017-11-27")


Moved output value for EXPECT_DEATH to define so can be set to different values on different platforms. Fixes a bunch of unit tests.

PiperOrigin-RevId: 263259596

--- cmake/test_rules.cmake
+++ cmake/test_rules.cmake
@@ -53,6 +53,7 @@
     PRIVATE
       -DINTERNAL_EXPERIMENTAL=1
       ${cc_test_DEFINES}
+      -DDEATHTEST_SIGABRT=""
   )
 endfunction()

@@ -94,5 +95,6 @@
     PRIVATE
       -DINTERNAL_EXPERIMENTAL=1
       ${cc_test_DEFINES}
+      -DDEATHTEST_SIGABRT="SIGABRT"
   )
 endfunction()


Fix problem with detection python libraries.

--- salome_adm/cmake_files/FindSalomePythonLibs.cmake
+++ salome_adm/cmake_files/FindSalomePythonLibs.cmake
@@ -34,6 +34,7 @@
 IF (SALOMEPYTHONINTERP_FOUND AND NOT "${PYTHON_VERSION_STRING}" STREQUAL "")
    # Trying to search libraries with same version as an interpreter version
    SET(PythonLibs_FIND_VERSION ${PYTHON_VERSION_STRING})
+   SET(PythonLibs_FIND_VERSION_MAJOR ${PYTHON_VERSION_MAJOR})
 ENDIF()
 SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(PythonLibs PYTHON_INCLUDE_DIR 2)


FIX: Remove temporary workaround attempt to build SlicerCIP

The problem was solved in previous commit

--- SuperBuild/External_CIP.cmake
+++ SuperBuild/External_CIP.cmake
@@ -73,9 +73,6 @@
       -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
       -DBUILD_TESTING:BOOL=OFF
       -DCMAKE_CXX_FLAGS:STRING=${CIP_CMAKE_CXX_FLAGS}
-      # Temporary workaround
-      -DBUILD_ConvertDicom:BOOL=OFF
-

     #CONFIGURE_COMMAND ${CMAKE_COMMAND}
     #-E echo


Only remove ITK Legacy code with default known version of ITK

This enables SimpleITK to build against ITKv5 by
default. Particularly, ITK 5.1 uses new enums which are not
backwards compatible by default.

--- SuperBuild/External_ITK.cmake
+++ SuperBuild/External_ITK.cmake
@@ -52,8 +52,8 @@
 mark_as_advanced(ITK_GIT_REPOSITORY)
 sitk_legacy_naming(ITK_GIT_REPOSITORY ITK_REPOSITORY)

-set(ITK_GIT_TAG "3213404416666c17dbabc8fb0a07f1d27362f32c" CACHE
-  STRING "Tag in ITK git repo") # after 4.13.2 along release-4.13
+set(_DEFAULT_ITK_GIT_TAG "3213404416666c17dbabc8fb0a07f1d27362f32c") # after 4.13.2 along release-4.13
+set(ITK_GIT_TAG "${_DEFAULT_ITK_GIT_TAG}" CACHE STRING "Tag in ITK git repo")
 mark_as_advanced(ITK_GIT_TAG)
 set(ITK_TAG_COMMAND GIT_TAG "${ITK_GIT_TAG}")

@@ -73,6 +73,14 @@
     "-DITK_TEMPLATE_VISIBILITY_DEFAULT:BOOL=OFF" )
 endif()

+
+if( ITK_GIT_TAG STREQUAL _DEFAULT_ITK_GIT_TAG )
+  # only remove legacy with the tested, and predefined version of ITK
+  list( APPEND ep_itk_args
+    "-DITK_LEGACY_REMOVE:BOOL=ON"
+    )
+endif()
+
 file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${proj}-build/CMakeCacheInit.txt" "${ep_itk_cache}\n${ep_common_cache}" )

 ExternalProject_Add(${proj}
@@ -85,7 +93,6 @@
   CMAKE_ARGS
   --no-warn-unused-cli
   -C "${CMAKE_CURRENT_BINARY_DIR}/${proj}-build/CMakeCacheInit.txt"
-  -DITK_LEGACY_REMOVE:BOOL=ON
   ${ep_itk_args}
   ${ep_common_args}
   -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

--- Modules/ThirdParty/KWSys/src/KWSys/kwsysDateStamp.cmake
+++ Modules/ThirdParty/KWSys/src/KWSys/kwsysDateStamp.cmake
@@ -18,4 +18,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 03)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   01)
+SET(KWSYS_DATE_STAMP_DAY   02)


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

--- Modules/ThirdParty/KWSys/src/KWSys/kwsysDateStamp.cmake
+++ Modules/ThirdParty/KWSys/src/KWSys/kwsysDateStamp.cmake
@@ -18,4 +18,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 12)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   07)
+SET(KWSYS_DATE_STAMP_DAY   08)


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

--- Modules/ThirdParty/KWSys/src/KWSys/kwsysDateStamp.cmake
+++ Modules/ThirdParty/KWSys/src/KWSys/kwsysDateStamp.cmake
@@ -18,4 +18,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 06)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   25)
+SET(KWSYS_DATE_STAMP_DAY   26)


Fixed PackageConfig.cmake. Dependencies are searched by components and context is always restored to its previous state.

--- PackageConfig.cmake
+++ PackageConfig.cmake
@@ -209,12 +209,14 @@
   "  set(${UPPER_PROJECT_NAME}_FOUND TRUE)\n"
   "  set(${PROJECT_NAME}_FOUND TRUE)\n"
   "  set(${UPPER_PROJECT_NAME}_MODULE_FILENAME ${MODULE_FILENAME})\n"
-  "  set(${UPPER_PROJECT_NAME}_LIBRARY \${${UPPER_PROJECT_NAME}_LIBRARIES})\n"
   "  list(SORT ${UPPER_PROJECT_NAME}_INCLUDE_DIRS)\n"
   "  list(REMOVE_DUPLICATES ${UPPER_PROJECT_NAME}_INCLUDE_DIRS)\n"
+  "  if(${UPPER_PROJECT_NAME}_LIBRARIES)\n"
+  "    list(REMOVE_DUPLICATES ${UPPER_PROJECT_NAME}_LIBRARIES)\n"
+  "  endif()\n"
   "  if(_out AND ${UPPER_PROJECT_NAME}_STATUS)\n"
   "    message(STATUS \"Found ${PROJECT_NAME} ${VERSION} [\${${UPPER_PROJECT_NAME}_COMPONENTS}] in \"\n"
-  "      \"\${${UPPER_PROJECT_NAME}_INCLUDE_DIRS}:\${${UPPER_PROJECT_NAME}_LIBRARY}:\${${UPPER_PROJECT_NAME}_LIBRARIES}\")\n"
+  "      \"\${${UPPER_PROJECT_NAME}_INCLUDE_DIRS}:\${${UPPER_PROJECT_NAME}_LIBRARY}\")\n"
   "  endif()\n"
   "endif()\n"
 )
@@ -297,15 +299,18 @@
     set(${${_dependent}_name}_findmode REQUIRED)
     set(_FIND_VERSION)
   endif()
+
+  # Use the components specified by FindPackages.cmake
+  set(${_dependent}_components "${${UPPER_PROJECT_NAME}_${_DEPENDENT}_COMPONENTS}")
+  if(${_dependent}_components)
+     set(_components "COMPONENTS ${${_dependent}_components}" )
+  endif()
   list(APPEND DEPENDENTS
-    "set(_library_backups \${${${_dependent}_name}_LIBRARIES})\n"
-    "find_package(${_dependent} ${_FIND_VERSION} \${_req} \${_quiet})\n"
-    "if(${${_dependent}_name}_FOUND)\n"
-    "  list(APPEND ${${_dependent}_name}_LIBRARIES \${_library_backups})\n"
-    "  if(${${_dependent}_name}_LIBRARIES)\n"
-    "    list(REMOVE_DUPLICATES ${${_dependent}_name}_LIBRARIES)\n"
-    "  endif()\n"
-    )
+    "set(_${${_dependent}_name}_libraries_backup \${${${_dependent}_name}_LIBRARIES})\n"
+    # Reset previously found dependent libraries
+    "set(${${_dependent}_name}_LIBRARIES)\n"
+    "find_package(${_dependent} ${_FIND_VERSION} QUIET \${_req} ${_components})\n"
+    "if(${${_dependent}_name}_FOUND)\n" )
   if(_FIND_VERSION)
     list(APPEND DEPENDENTS
       "  if(\"\${${${_dependent}_name}_VERSION}\" MATCHES \"^([0-9]+\\\\.[0-9]+)\")\n"
@@ -319,7 +324,9 @@
     "  list(APPEND ${UPPER_PROJECT_NAME}_INCLUDE_DIRS \${${${_dependent}_name}_INCLUDE_DIRS})\n"
     "else()\n"
     "  set(_fail \"${_dependent} not found\")\n"
-    "endif()\n\n")
+    "endif()\n"
+    # Restore the situation of the dependent library without accumulating the dependent libraries
+    "set(${${_dependent}_name}_LIBRARIES \${_${${_dependent}_name}_libraries_backup})\n\n")
 endforeach()
 string(REGEX REPLACE ";" " " DEPENDENTS ${DEPENDENTS})


MAINT: fix typo.

MAINT: fix typo.

--- cmake/FindDO_Sara.cmake
+++ cmake/FindDO_Sara.cmake
@@ -37,7 +37,7 @@

   # Image and Video I/O.
   sara_append_components(DO_Sara_COMPONENTS ImageIO)
-  if (DO_SARA_BUILD_VIDEOIO)
+  if (SARA_BUILD_VIDEOIO)
     sara_append_components(DO_Sara_COMPONENTS VideoIO)
   endif ()


cmake: fix Xrender detection

cmake: fix Xrender detection

--- cmake/FindXrender.cmake
+++ cmake/FindXrender.cmake
@@ -26,18 +26,18 @@
 # limitations under the License.
 #=============================================================================

-find_path(Xrender_INCLUDE_DIR NAMES X11/extensions/Xrender.h
+find_path(XRENDER_INCLUDE_DIR NAMES X11/extensions/Xrender.h
           DOC "The Xrender include directory")

-find_library(Xrender_LIBRARY NAMES Xrender
+find_library(XRENDER_LIBRARY NAMES Xrender
           DOC "The Xrender library")

 include(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Xrender DEFAULT_MSG Xrender_LIBRARY Xrender_INCLUDE_DIR)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Xrender DEFAULT_MSG XRENDER_LIBRARY XRENDER_INCLUDE_DIR)

-if(Xrender_FOUND)
-	set(XRENDER_LIBRARIES ${Xrender_LIBRARY})
-	set(XRENDER_INCLUDE_DIRS ${Xrender_INCLUDE_DIR})
+if(XRENDER_FOUND)
+	set(XRENDER_LIBRARIES ${XRENDER_LIBRARY})
+	set(XRENDER_INCLUDE_DIRS ${XRENDER_INCLUDE_DIR})
 endif()

 mark_as_advanced(XRENDER_INCLUDE_DIRS XRENDER_LIBRARIES)


Add compile feature to Findpanda3d

Add compile feature to Findpanda3d

--- cmake/Findpanda3d.cmake
+++ cmake/Findpanda3d.cmake
@@ -163,6 +163,7 @@
         endif()

         if(${component_name} STREQUAL "p3dtool")
+            set_target_properties(panda3d::${component_name} PROPERTIES INTERFACE_COMPILE_FEATURES "cxx_std_11")
             if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
                 include(CMakeFindDependencyMacro)
                 find_dependency(Threads REQUIRED)


CMake: Removed debug output

CMake: Removed debug output

--- cmake/globalutils.cmake
+++ cmake/globalutils.cmake
@@ -954,17 +954,13 @@
 endfunction()

 function(ivw_deploy_qt target)
-if(WIN32)
-find_program(WINDEPLOYQT_EXECUTABLE NAMES windeployqt HINTS ${QTDIR} ENV QTDIR PATH_SUFFIXES bin)
-
-get_filename_component(qt_bin_dir ${WINDEPLOYQT_EXECUTABLE} DIRECTORY  )
-add_custom_command(TARGET ${target} POST_BUILD
-    COMMAND echo %PATH%
-    COMMAND qmake --version
-    COMMAND ${qt_bin_dir}/qtenv2.bat
-    COMMAND echo %PATH%
-    COMMAND qmake --version
-    COMMAND ${WINDEPLOYQT_EXECUTABLE} --no-compiler-runtime --verbose 2 $<TARGET_FILE:${target}>
-    )
-endif()
+    if(WIN32)
+        find_program(WINDEPLOYQT_EXECUTABLE NAMES windeployqt HINTS ${QTDIR} ENV QTDIR PATH_SUFFIXES bin)
+
+        get_filename_component(qt_bin_dir ${WINDEPLOYQT_EXECUTABLE} DIRECTORY  )
+        add_custom_command(TARGET ${target} POST_BUILD
+                            COMMAND ${qt_bin_dir}/qtenv2.bat
+                            COMMAND ${WINDEPLOYQT_EXECUTABLE} --no-compiler-runtime --verbose 1 $<TARGET_FILE:${target}>
+            )
+    endif()
 endfunction()


Removed debug messages.

Removed debug messages.

svn path=/trunk/; revision=7293

--- cmake/modules/pdf.cmake
+++ cmake/modules/pdf.cmake
@@ -34,9 +34,6 @@
     set(pdf_COMPILE_FLAGS "-I${hpdf_INCLUDE_DIRS} -DHPDF_DLL")
     set(pdf_LINK_FLAGS "${hpdf_LIBRARIES}")
     set(DRIVERS_LINK_FLAGS ${DRIVERS_LINK_FLAGS} ${pdf_LINK_FLAGS})
-    message(STATUS "pdf_COMPILE_FLAGS  " ${pdf_COMPILE_FLAGS})
-    message(STATUS "pdf_LINK_FLAGS  " ${pdf_LINK_FLAGS})
-    message(STATUS "DRIVERS_LINK_FLAGS  " ${DRIVERS_LINK_FLAGS})
   else(hpdf_FOUND)
     message(STATUS "Looking for haru pdf header and library - not found")
     message(STATUS "WARNING: Setting PLD_pdf to OFF.")


Fixed a problem that prevented trunk from configuring with the XCode generator.

git-svn-id: 4ba210d0a933e3fb1aa9ab096f190cd38965d92a@1793 fa922fa7-2fde-0310-acd8-f43f465a7996

--- src/CMake/cuda/FindCuda.cmake
+++ src/CMake/cuda/FindCuda.cmake
@@ -269,21 +269,18 @@
   # commands for all the .cu files.
   FOREACH(file ${ARGN})
     IF(${file} MATCHES ".*\\.cu$")
-
-    # strip CMAKE_SOURCE_DIR from the head of ${file}
-    if(file MATCHES ${CMAKE_SOURCE_DIR})
-	string(LENGTH ${CMAKE_SOURCE_DIR} _cuda_source_dir_length)
-    string(LENGTH ${file} _cuda_file_length)
-    math(EXPR _begin "${_cuda_source_dir_length} + 1")
-    math(EXPR _stripped_file_length "${_cuda_file_length} - ${_cuda_source_dir_length} - 1")
-	STRING(SUBSTRING ${file} ${_begin} ${_stripped_file_length} stripped_file )
-    SET(source_file ${file})
-
+
+	if(file MATCHES ${CMAKE_SOURCE_DIR})
+    	# strip CMAKE_SOURCE_DIR from the head of ${file}
+    	string(LENGTH ${CMAKE_SOURCE_DIR} _cuda_source_dir_length)
+		string(LENGTH ${file} _cuda_file_length)
+		math(EXPR _begin "${_cuda_source_dir_length} + 1")
+		math(EXPR _stripped_file_length "${_cuda_file_length} - ${_cuda_source_dir_length} - 1")
+		STRING(SUBSTRING ${file} ${_begin} ${_stripped_file_length} stripped_file )
+    	SET(source_file ${file})
 	else(file MATCHES ${CMAKE_SOURCE_DIR})
-
-	set(stripped_file ${file})
-    SET(source_file "${CMAKE_CURRENT_SOURCE_DIR}/${file}")
-
+		set(stripped_file ${file})
+		SET(source_file "${CMAKE_CURRENT_SOURCE_DIR}/${file}")
 	endif(file MATCHES ${CMAKE_SOURCE_DIR})

     # Add a custom target to generate a cpp file
@@ -292,7 +289,6 @@
     SET(generated_target "${stripped_file}_target")

     FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/src/cuda)
-

     # MESSAGE("${CUDA_NVCC} ${source_file} ${CUDA_NVCC_FLAGS} ${nvcc_flags} -cuda -o ${generated_file} ${CUDA_NVCC_INCLUDE_ARGS}")


Minor stylistic change.

Minor stylistic change.

--- toolchains/android/x86_64.abi.cmake
+++ toolchains/android/x86_64.abi.cmake
@@ -14,4 +14,4 @@
 set( ANDROID_GCC_MACHINE_NAME "x86_64-linux-android" )
 set( TNUN_cpu_archs           "x86_64"               )

-add_compile_options( -m64 -march=atom -msse4.2 -mpopcnt ) # assume Silvermont arch
+add_compile_options( -m64 -march=atom -msse4.2 -mpopcnt ) # assume Silvermont arch


Disable completly CTEST_USE_LAUNCHERS

Disable completly CTEST_USE_LAUNCHERS

Since not all errors are correctly reported. Let's disable that ctest feature.

See see http://www.kitware.com/blog/home/post/11

--- CMake/ctkDashboardDriverScript.cmake
+++ CMake/ctkDashboardDriverScript.cmake
@@ -95,9 +95,9 @@

 # For more details, see http://www.kitware.com/blog/home/post/11
 set(CTEST_USE_LAUNCHERS 0)
-if (NOT ${CMAKE_GENERATOR} MATCHES "Visual Studio")
-  set(CTEST_USE_LAUNCHERS 1)
-endif()
+#if (NOT ${CTEST_CMAKE_GENERATOR} MATCHES "Visual Studio")
+#  set(CTEST_USE_LAUNCHERS 1)
+#endif()

 if(empty_binary_directory)
   message("Directory ${CTEST_BINARY_DIRECTORY} cleaned !")
@@ -199,14 +199,12 @@

     if (WITH_DOCUMENTATION)
       message("----------- [ Build Documentation ] -----------")
-      set(CTEST_USE_LAUNCHERS 0)
       # Build Documentation target
       set_property(GLOBAL PROPERTY SubProject Documentation)
       set_property(GLOBAL PROPERTY Label Documentation)
       set(CTEST_BUILD_TARGET "doc")
       ctest_build(BUILD "${ctk_build_dir}" APPEND)
       ctest_submit(PARTS Build)
-      set(CTEST_USE_LAUNCHERS 1)
     endif()

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


fix(zlib): fix include paths for zlib

fix(zlib): fix include paths for zlib

* On Fedora21 I saw a failure when zlib-devel not installed

--- deps/zlib.cmake
+++ deps/zlib.cmake
@@ -9,10 +9,8 @@
 else (WithSharedZLIB)
   message("Enabling Static ZLIB")
   add_subdirectory(deps/zlib)
-  if (MSVC)
-    include_directories(deps/zlib)
-    include_directories(build/deps/zlib)
-  endif (MSVC)
+  include_directories(deps/zlib)
+  include_directories(build/deps/zlib)
 endif (WithSharedZLIB)

 add_definitions(-DWITH_ZLIB)


CMake: force CXX standard to C++11

CMake: force CXX standard to C++11

--- cmake/cpp.cmake
+++ cmake/cpp.cmake
@@ -174,15 +174,12 @@
   )

 # Compile options
-if(CMAKE_VERSION VERSION_LESS "3.8.2")
-  set_target_properties(${PROJECT_NAME} PROPERTIES
-    CXX_STANDARD 11
-    CXX_STANDARD_REQUIRED ON
-    CXX_EXTENSIONS OFF
-  )
-else()
-  target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_11)
-endif()
+set_target_properties(${PROJECT_NAME} PROPERTIES
+  CXX_STANDARD 11
+  CXX_STANDARD_REQUIRED ON
+  CXX_EXTENSIONS OFF
+  )
+target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_11)
 target_compile_definitions(${PROJECT_NAME} PUBLIC ${OR_TOOLS_COMPILE_DEFINITIONS})
 target_compile_options(${PROJECT_NAME} PUBLIC ${OR_TOOLS_COMPILE_OPTIONS})


ENH: switching off OpenCL on windows pc

ENH: switching off OpenCL on windows pc

Nightly tests were failing, due to the GPU not being found. The tests run without problems during the day though. Probably the GPU is in sleeping mode at night. Not sure how to wake it, so just disable GPU tests for now.

--- src/Testing/Dashboard/elxDashboard_LKEB_win7-64_VS2010.cmake
+++ src/Testing/Dashboard/elxDashboard_LKEB_win7-64_VS2010.cmake
@@ -47,7 +47,7 @@
 ELASTIX_ENABLE_PACKAGER:BOOL=ON
 ELASTIX_USE_CUDA:BOOL=OFF
 ELASTIX_USE_EIGEN:BOOL=OFF
-ELASTIX_USE_OPENCL:BOOL=ON
+ELASTIX_USE_OPENCL:BOOL=OFF
 ELASTIX_USE_MEVISDICOMTIFF:BOOL=OFF
 ELASTIX_IMAGE_DIMENSIONS:STRING=2;3;4
 ELASTIX_IMAGE_2D_PIXELTYPES:STRING=float


Refactor some device properties onto device_type.

Signed-off-by: Keith Rothman <1bc19627a439baf17510dc2d0b2d250c96d445a5@users.noreply.github.com>

--- xc7/make/device_define.cmake
+++ xc7/make/device_define.cmake
@@ -61,7 +61,7 @@
     --part_name ${PART} \
     --part_file ${PRJXRAY_DB_DIR}/${ARCH}/${PART}.yaml \
   ")
-  get_target_property_required(CHANNELS_DB ${DEVICE} CHANNELS_DB)
+  get_target_property_required(CHANNELS_DB ${DEVICE_TYPE} CHANNELS_DB)
   get_file_location(CHANNELS_LOCATION ${CHANNELS_DB})
   set_target_properties(${BOARD}
     PROPERTIES BIT_TO_V_EXTRA_ARGS " \
@@ -80,7 +80,7 @@
       --roi ${ROI_DIR}/design.json \
     ")

-    get_target_property_required(SYNTH_TILES ${DEVICE} SYNTH_TILES)
+    get_target_property_required(SYNTH_TILES ${DEVICE_TYPE} SYNTH_TILES)
     get_file_location(SYNTH_TILES_LOCATION ${SYNTH_TILES})
     set(SYNTH_TILES_TO_PINMAP_CSV ${symbiflow-arch-defs_SOURCE_DIR}/xc7/utils/prjxray_synth_tiles_to_pinmap_csv.py)
     set(PINMAP_CSV ${BOARD}_synth_tiles_pinmap.csv)
@@ -145,9 +145,12 @@

   if(NOT "${ROI_DIR}" STREQUAL "")
     set(ROI_ARGS USE_ROI ${ROI_DIR}/design.json)
+    set(DEVICE_TYPE ${DEVICE}-roi-virt)
   elseif(NOT "${ADD_XC7_DEVICE_DEFINE_TYPE_GRAPH_LIMIT}" STREQUAL "")
+    set(DEVICE_TYPE ${DEVICE}-virt)
     set(ROI_ARGS GRAPH_LIMIT ${ADD_XC7_DEVICE_DEFINE_TYPE_GRAPH_LIMIT})
   else()
+    set(DEVICE_TYPE ${DEVICE}-virt)
     set(ROI_ARGS "")
   endif()

@@ -173,36 +176,54 @@
   set(TIMING_DEPS "")

   define_device_type(
-    DEVICE_TYPE ${DEVICE}-roi-virt
+    DEVICE_TYPE ${DEVICE_TYPE}
     ARCH ${ARCH}
     ARCH_XML arch.xml
     SCRIPT_OUTPUT_NAME timing
     SCRIPTS ${TIMING_IMPORT}
     SCRIPT_DEPS TIMING_DEPS
     )
-  add_dependencies(${ARCH}_${DEVICE}-roi-virt_arch arch_import_timing_deps)
-  get_target_property_required(VIRT_DEVICE_MERGED_FILE ${DEVICE}-roi-virt DEVICE_MERGED_FILE)
+  add_dependencies(${ARCH}_${DEVICE_TYPE}_arch arch_import_timing_deps)
+  get_target_property_required(VIRT_DEVICE_MERGED_FILE ${DEVICE_TYPE} DEVICE_MERGED_FILE)
   get_file_target(DEVICE_MERGED_FILE_TARGET ${VIRT_DEVICE_MERGED_FILE})
   add_dependencies(${DEVICE_MERGED_FILE_TARGET} arch_import_timing_deps)
   if(NOT "${ROI_DIR}" STREQUAL "")
     set_target_properties(
-      ${DEVICE}-roi-virt
+      ${DEVICE_TYPE}
       PROPERTIES
       USE_ROI TRUE
       ROI_DIR ${ROI_DIR}
-      )
-  else()
-    set_target_properties(
-      ${DEVICE}-roi-virt
+      CHANNELS_DB ${CMAKE_CURRENT_SOURCE_DIR}/channels.db
+      SYNTH_TILES ${CMAKE_CURRENT_SOURCE_DIR}/synth_tiles.json
+      )
+  else()
+    set_target_properties(
+      ${DEVICE_TYPE}
       PROPERTIES
       USE_ROI FALSE
+      CHANNELS_DB ${CMAKE_CURRENT_SOURCE_DIR}/channels.db
+      )
+  endif()
+
+  if(NOT "${ADD_XC7_DEVICE_DEFINE_TYPE_GRAPH_LIMIT}" STREQUAL "")
+    set_target_properties(
+      ${DEVICE_TYPE}
+      PROPERTIES
+      USE_GRAPH_LIMIT TRUE
+      GRAPH_LIMIT "${ADD_XC7_DEVICE_DEFINE_TYPE_GRAPH_LIMIT}"
+      )
+  else()
+    set_target_properties(
+      ${DEVICE_TYPE}
+      PROPERTIES
+      USE_GRAPH_LIMIT FALSE
       )
   endif()
 endfunction()

 function(ADD_XC7_DEVICE_DEFINE)
   set(options USE_ROI)
-  set(oneValueArgs ARCH GRAPH_LIMIT)
+  set(oneValueArgs ARCH)
   set(multiValueArgs DEVICES)
   cmake_parse_arguments(
     ADD_XC7_DEVICE_DEFINE
@@ -222,37 +243,41 @@
     list(GET DEVICES ${INDEX} DEVICE)

     if(${USE_ROI})
-        add_subdirectory(${DEVICE}-roi-virt)
-        set(CHANNELS ${CMAKE_CURRENT_SOURCE_DIR}/${DEVICE}-roi-virt/channels.db)
+        set(DEVICE_TYPE ${DEVICE}-roi-virt)
     else()
-        add_subdirectory(${DEVICE}-virt)
-        set(CHANNELS ${CMAKE_CURRENT_SOURCE_DIR}/${DEVICE}-virt/channels.db)
+        set(DEVICE_TYPE ${DEVICE}-virt)
     endif()

-    get_file_location(CHANNELS_LOCATION ${CHANNELS})
+    add_subdirectory(${DEVICE_TYPE})
+
+    get_target_property_required(CHANNELS_DB ${DEVICE_TYPE} CHANNELS_DB)
+    get_file_location(CHANNELS_LOCATION ${CHANNELS_DB})
     set(RR_PATCH_EXTRA_ARGS  --connection_database ${CHANNELS_LOCATION})

     # Clear variable before adding deps for next device
     set(DEVICE_RR_PATCH_DEPS "")
     list(APPEND DEVICE_RR_PATCH_DEPS intervaltree textx)
-    append_file_dependency(DEVICE_RR_PATCH_DEPS ${CHANNELS})
+    append_file_dependency(DEVICE_RR_PATCH_DEPS ${CHANNELS_DB})

     if(${USE_ROI})
         # SYNTH_TILES used in ROI.
-        set(SYNTH_TILES ${CMAKE_CURRENT_SOURCE_DIR}/${DEVICE}-roi-virt/synth_tiles.json)
+        get_target_property_required(SYNTH_TILES ${DEVICE_TYPE} SYNTH_TILES)
         get_file_location(SYNTH_TILES_LOCATION ${SYNTH_TILES})
         append_file_dependency(DEVICE_RR_PATCH_DEPS ${SYNTH_TILES})
         set(RR_PATCH_EXTRA_ARGS --synth_tiles ${SYNTH_TILES_LOCATION} ${RR_PATCH_EXTRA_ARGS})
     endif()

-    if(NOT "${ADD_XC7_DEVICE_DEFINE_GRAPH_LIMIT}" STREQUAL "")
-        set(RR_PATCH_EXTRA_ARGS --graph_limit ${ADD_XC7_DEVICE_DEFINE_GRAPH_LIMIT} ${RR_PATCH_EXTRA_ARGS})
+    get_target_property_required(USE_GRAPH_LIMIT ${DEVICE_TYPE} USE_GRAPH_LIMIT)
+
+    if(${USE_GRAPH_LIMIT})
+        get_target_property_required(GRAPH_LIMIT ${DEVICE_TYPE} GRAPH_LIMIT)
+        set(RR_PATCH_EXTRA_ARGS --graph_limit ${GRAPH_LIMIT} ${RR_PATCH_EXTRA_ARGS})
     endif()

     define_device(
       DEVICE ${DEVICE}
       ARCH ${ARCH}
-      DEVICE_TYPE ${DEVICE}-roi-virt
+      DEVICE_TYPE ${DEVICE_TYPE}
       PACKAGES test
       RR_PATCH_EXTRA_ARGS ${RR_PATCH_EXTRA_ARGS}
       RR_PATCH_DEPS ${DEVICE_RR_PATCH_DEPS}
@@ -268,15 +293,5 @@
         --route_chan_width 500
         --allowed_tiles_for_delay_model BLK-TL-SLICEL,BLK-TL-SLICEM
       )
-    set_target_properties(
-      ${DEVICE}
-      PROPERTIES
-      CHANNELS_DB ${CHANNELS})
-    if(${USE_ROI})
-      set_target_properties(
-        ${DEVICE}
-        PROPERTIES
-        SYNTH_TILES ${CMAKE_CURRENT_SOURCE_DIR}/${DEVICE}-roi-virt/synth_tiles.json)
-    endif()
   endforeach()
 endfunction()


ENH: CI: PKG: Fixed CMAKE_PREFIX_PATH in Packaging/Files/build_examples.cmake.

--- Packaging/Files/build_examples.cmake
+++ Packaging/Files/build_examples.cmake
@@ -46,6 +46,7 @@
   COMMAND ${CMAKE_COMMAND}
   -DCMAKE_INSTALL_PREFIX=${PKG_DIR}
   -DCMAKE_BUILD_TYPE=RelWithDebInfo
+  -DCMAKE_PREFIX_PATH=${PKG_DIR}
   ${cmake_gen}
   ${SRC_DIR}
   WORKING_DIRECTORY ${TEST_DIR}


Untested X11 GPU discovery code: - refactor static GLXPipe::getGPUInfo - Try and query X Servers 0..n with screen 0..m - Fix CMake/GLX/CUDA on Mac

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

--- configure.cmake
+++ configure.cmake
@@ -16,7 +16,6 @@
 if(CUDA_FOUND)
   include_directories(SYSTEM ${CUDA_INCLUDE_DIRS})
   set(CUDA_PROPAGATE_HOST_FLAGS OFF)
-  set(EQ_FEATURES "${EQ_FEATURES} CUDA")
 endif(CUDA_FOUND)

 # OpenSceneGraph


Fix one typo.

Fix one typo.

Also improve readability slightly by aligning commands.

--- tests/macro_add_test.cmake
+++ tests/macro_add_test.cmake
@@ -1,6 +1,6 @@
 ## ---------------------------------------------------------------------
 ##
-## Copyright (C) 2013, 2014 by the deal.II authors
+## Copyright (C) 2013, 2014, 2015 by the deal.II authors
 ##
 ## This file is part of the deal.II library.
 ##
@@ -109,12 +109,12 @@
     IF(_match OR "${_configuration}" STREQUAL "")

       #
-      # Setup a bunch of variables describing the test:
+      # Set up a bunch of variables describing this particular test:
       #
       STRING(TOLOWER ${_build} _build_lowercase)
       SET(_target ${_test_name}.${_build_lowercase}) # target name

-      # If _n_cpu is equal to "0", a normal, sequental test will be run,
+      # If _n_cpu is equal to "0", a normal, sequential test will be run,
       # otherwise run the test with mpirun:
       IF("${_n_cpu}" STREQUAL "0")

@@ -178,8 +178,10 @@
       #

       ADD_CUSTOM_COMMAND(OUTPUT ${_test_directory}/output
-        COMMAND rm -f ${_test_directory}/failing_output
-        COMMAND touch ${_test_directory}/output
+        COMMAND
+          rm -f ${_test_directory}/failing_output
+        COMMAND
+          touch ${_test_directory}/output
         COMMAND
           ${_run_command}
           || (mv ${_test_directory}/output
@@ -199,8 +201,10 @@
           ${DEAL_II_SOURCE_DIR}/tests/normalize.pl
         )
       ADD_CUSTOM_COMMAND(OUTPUT ${_test_directory}/diff
-        COMMAND rm -f ${_test_directory}/failing_diff
-        COMMAND touch ${_test_directory}/diff
+        COMMAND
+          rm -f ${_test_directory}/failing_diff
+        COMMAND
+          touch ${_test_directory}/diff
         COMMAND
 	  # run diff or numdiff (if available) to determine
 	  # whether files are the same. if they are not, output
@@ -231,13 +235,15 @@
           ${_comparison_file}
         )

-      ADD_CUSTOM_TARGET(${_diff_target} DEPENDS ${_test_directory}/diff
+      ADD_CUSTOM_TARGET(${_diff_target}
         COMMAND
              echo "${_test_full}: BUILD successful."
           && echo "${_test_full}: RUN successful."
           && echo "${_test_full}: DIFF successful."
           && echo "${_test_full}: PASSED."
-        )
+        DEPENDS
+          ${_test_directory}/diff
+      )

       #
       # And finally add the test:


Fix static site build in non-development environments.

Node needed to be on the PATH for asset precompiling in execjs to work.

--- build/cmake/static-site.cmake
+++ build/cmake/static-site.cmake
@@ -6,7 +6,7 @@
   URL_HASH MD5=${API_UMBRELLA_STATIC_SITE_HASH}
   BUILD_IN_SOURCE 1
   CONFIGURE_COMMAND env PATH=${STAGE_EMBEDDED_DIR}/bin:$ENV{PATH} bundle install --path=<SOURCE_DIR>/vendor/bundle
-  BUILD_COMMAND env PATH=${STAGE_EMBEDDED_DIR}/bin:$ENV{PATH} bundle exec middleman build
+  BUILD_COMMAND env PATH=${DEV_INSTALL_PREFIX}/bin:${STAGE_EMBEDDED_DIR}/bin:$ENV{PATH} bundle exec middleman build
   INSTALL_COMMAND rm -rf ${STAGE_EMBEDDED_DIR}/apps/static-site/releases
     COMMAND mkdir -p ${STAGE_EMBEDDED_DIR}/apps/static-site/releases/0/build
     COMMAND rsync -a <SOURCE_DIR>/build/ ${STAGE_EMBEDDED_DIR}/apps/static-site/releases/0/build/


rpmbuild: make libflexisip.so to be striped on Debian

--- build/rpm/flexisip.spec.cmake
+++ build/rpm/flexisip.spec.cmake
@@ -106,10 +106,6 @@
 %endif

-# This is for debian builds where debug_package has to be manually specified, whereas in centos it does not
-%define custom_debug_package %{!?_enable_debug_packages:%debug_package}%{?_enable_debug_package:%{nil}}
-%custom_debug_package
-
 %prep
 %setup -n %{package_name}

@@ -122,6 +118,10 @@
 %install
 make install DESTDIR=%{buildroot}

+# Mark all libraries as executable because CMake doesn't on
+# Debian to be complient with Debian policy. But rpmbuild
+# won't strip libraries that aren't marked as executable.
+chmod +x `find %{buildroot} *.so.*`

 #
 # Shouldn't be the role of cmake to install all the following stuff ?
@@ -206,6 +206,9 @@
 %{_libdir}/flexisip/plugins/libexternal-auth.so.*
 %endif

+# This is for Debian build where debug_package has to be manually specified whereas it mustn't on Centos
+%define custom_debug_package %{!?_enable_debug_packages:%debug_package}%{?_enable_debug_package:%{nil}}
+%custom_debug_package

 %changelog


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -18,4 +18,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 11)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   15)
+SET(KWSYS_DATE_STAMP_DAY   16)


STYLE: Nightly Date Stamp

STYLE: Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -4,7 +4,7 @@
 SET(KWSYS_DATE_STAMP_YEAR  2008)

 # KWSys version date month component.  Format is MM.
-SET(KWSYS_DATE_STAMP_MONTH 10)
+SET(KWSYS_DATE_STAMP_MONTH 11)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   31)
+SET(KWSYS_DATE_STAMP_DAY   01)


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -18,4 +18,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 08)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   18)
+SET(KWSYS_DATE_STAMP_DAY   19)


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -18,4 +18,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 02)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   25)
+SET(KWSYS_DATE_STAMP_DAY   26)


STYLE: Nightly Date Stamp

STYLE: Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -7,4 +7,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 08)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   08)
+SET(KWSYS_DATE_STAMP_DAY   09)


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -18,4 +18,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 11)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   13)
+SET(KWSYS_DATE_STAMP_DAY   14)


STYLE: Nightly Date Stamp

STYLE: Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -7,4 +7,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 06)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   16)
+SET(KWSYS_DATE_STAMP_DAY   17)


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -18,4 +18,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 03)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   30)
+SET(KWSYS_DATE_STAMP_DAY   31)


STYLE: Nightly Date Stamp

STYLE: Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -7,4 +7,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 07)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   09)
+SET(KWSYS_DATE_STAMP_DAY   10)


STYLE: Nightly Date Stamp

STYLE: Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -7,4 +7,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 07)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   03)
+SET(KWSYS_DATE_STAMP_DAY   04)


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -18,4 +18,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 11)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   19)
+SET(KWSYS_DATE_STAMP_DAY   20)


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -18,4 +18,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 02)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   12)
+SET(KWSYS_DATE_STAMP_DAY   13)


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -18,4 +18,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 01)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   25)
+SET(KWSYS_DATE_STAMP_DAY   26)


[CMake] Fix to cmake to make directories if necessary when copying header files.

--- cmake/MT_BuildFunctions.cmake
+++ cmake/MT_BuildFunctions.cmake
@@ -74,6 +74,7 @@
   # using a custom command here makes sure the headers get copied whenever they change
   add_custom_command(TARGET "${module_name}"
     POST_BUILD
+    COMMAND ${CMAKE_COMMAND} -E make_directory "${dest_path}/${tree_part}"
     COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/${filename}" "${dest_path}/${tree_part}/"
     )
 endfunction(MT_TRANSPOSE_FILE_IN_TREE)


Update protobuf lib

Update protobuf lib

--- cmake/external/protobuf.cmake
+++ cmake/external/protobuf.cmake
@@ -63,7 +63,7 @@
 ExternalProject_Add(${PROTOBUF_TARGET}
     PREFIX ${PROTOBUF_TARGET}
     GIT_REPOSITORY https://github.com/google/protobuf.git
-    GIT_TAG v3.17.3
+    GIT_TAG v3.20.1
     UPDATE_COMMAND ""
     CONFIGURE_COMMAND ${CMAKE_COMMAND} ${PROTOBUF_INSTALL_DIR}/src/${PROTOBUF_TARGET}/cmake
         -G${CMAKE_GENERATOR}


Do not require Libxml2 and OpenSSL when looking for Davix

When Davix is not builtin to ROOT, it's not necessary to propagate
link dependencies on Libxml2 and OpenSSL.

--- cmake/modules/FindDavix.cmake
+++ cmake/modules/FindDavix.cmake
@@ -36,31 +36,24 @@
 # ``DAVIX_INCLUDE_DIR``
 #   where to find the DAVIX headers (same as DAVIX_INCLUDE_DIRS)
 #
-# Since Davix depends on OpenSSL and LibXml2, none of the above will be defined
-# unless both packages can be found.

 foreach(var FOUND INCLUDE_DIR INCLUDE_DIRS LIBRARY LIBRARIES)
   unset(DAVIX_${var} CACHE)
 endforeach()

-find_package(LibXml2 QUIET)
-find_package(OpenSSL QUIET)
+find_package(PkgConfig)

-if(LIBXML2_FOUND AND OPENSSL_FOUND)
-  find_package(PkgConfig)
+if(PKG_CONFIG_FOUND)
+  if(${Davix_FIND_REQUIRED})
+    set(Davix_REQUIRED REQUIRED)
+  endif()

-  if(PKG_CONFIG_FOUND)
-    if(${Davix_FIND_REQUIRED})
-      set(Davix_REQUIRED REQUIRED)
-    endif()
+  pkg_check_modules(DAVIX ${Davix_REQUIRED} davix>=${Davix_FIND_VERSION})

-    pkg_check_modules(DAVIX ${Davix_REQUIRED} davix>=${Davix_FIND_VERSION})
-
-    set(DAVIX_LIBRARIES ${DAVIX_LDFLAGS} ${LIBXML2_LIBRARIES} ${OPENSSL_LIBRARIES})
-    set(DAVIX_LIBRARY ${DAVIX_LIBRARIES})
-    set(DAVIX_INCLUDE_DIRS ${DAVIX_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIRS})
-    set(DAVIX_INCLUDE_DIR ${DAVIX_INCLUDE_DIRS})
-  endif()
+  set(DAVIX_LIBRARIES ${DAVIX_LDFLAGS})
+  set(DAVIX_LIBRARY ${DAVIX_LIBRARIES})
+  set(DAVIX_INCLUDE_DIRS ${DAVIX_INCLUDE_DIRS})
+  set(DAVIX_INCLUDE_DIR ${DAVIX_INCLUDE_DIRS})
 endif()

 if(DAVIX_FOUND AND NOT TARGET Davix::Davix)


fixes gh-2459 Fixing formating issue.

fixes gh-2459 Fixing formating issue.

Signed-off-by: Philip Schwartz <90179e62a462019a8b170b5c04a4f0541ad92702@lexisnexis.com>

--- cmake_modules/docMacros.cmake
+++ cmake_modules/docMacros.cmake
@@ -8,12 +8,12 @@
 		LIST(REMOVE_AT DIRS 0)
 		LIST(LENGTH DIRS length)
 		set(FILES "")
-        	if ( length )
-	                foreach( D ${DIRS} )
-        	                file(GLOB_RECURSE _DB_INCLUDES ${D}/*.xml)
-            	        	set(FILES ${FILES} ${_DB_INCLUDES})
-	                endforeach()
-        	endif()
+		if ( length )
+			foreach( D ${DIRS} )
+				file(GLOB_RECURSE _DB_INCLUDES ${D}/*.xml)
+				set(FILES ${FILES} ${_DB_INCLUDES})
+			endforeach()
+		endif()
 	endif()
 	STRING(REGEX REPLACE "([0-9a-z_-]*).xml" "\\1" _file_base "${_file}")
 	SET(_xsl ${_xsl})


Empty libraries list is allowed to be used in sugar_target_link_libraries

--- cmake/core/sugar_target_link_libraries.cmake
+++ cmake/core/sugar_target_link_libraries.cmake
@@ -11,11 +11,15 @@

 function(sugar_target_link_libraries target)
   sugar_improper_number_of_arguments(${ARGC} 0)
-  sugar_improper_number_of_arguments(${ARGC} 1)

   set(libraries ${ARGV})
   list(REMOVE_AT libraries 0) # remove `target`
   sugar_test_target_exists(${target})
+
+  if(NOT libraries)
+    # list is empty, nothing to link
+    return()
+  endif()

   sugar_status_debug("link libraries: ${libraries}")
   sugar_status_debug("to target: ${target}")


[CMake] Removing fallback code for CMake versions before 3.1

This code is dead code now. Out with the old, in with the new!

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

--- cmake/modules/LLVMExternalProjectUtils.cmake
+++ cmake/modules/LLVMExternalProjectUtils.cmake
@@ -127,20 +127,6 @@
     USES_TERMINAL_INSTALL 1
     )

-  if(CMAKE_VERSION VERSION_LESS 3.1.0)
-    set(ALWAYS_REBUILD ${CMAKE_CURRENT_BINARY_DIR}/${name}-always-rebuild)
-    add_custom_target(${name}-always-rebuild
-      COMMAND ${CMAKE_COMMAND} -E touch ${STAMP_DIR}/${name}-clobber-stamp)
-
-    llvm_ExternalProject_BuildCmd(run_build all ${BINARY_DIR})
-    ExternalProject_Add_Step(${name} force-rebuild
-      COMMAND ${run_build}
-      COMMENT "Forcing rebuild of ${name}"
-      DEPENDEES configure clean
-      DEPENDS ${ALWAYS_REBUILD} ${ARG_DEPENDS} ${TOOLCHAIN_BINS}
-      USES_TERMINAL 1 )
-  endif()
-
   if(ARG_USE_TOOLCHAIN)
     set(force_deps DEPENDS ${TOOLCHAIN_BINS})
   endif()


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

--- ITK/Utilities/KWSys/src/KWSys/kwsysDateStamp.cmake
+++ ITK/Utilities/KWSys/src/KWSys/kwsysDateStamp.cmake
@@ -18,4 +18,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 03)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   14)
+SET(KWSYS_DATE_STAMP_DAY   15)


[CMake] Fix libomp_check_linker_flag function

libomp_check_linker_flag rewrites src_to_link.c and CMakeLists.txt in build
directory for test project, but cmake does not rebuild the project. The root
cause is that on some filesystems (ext3, reiserfs) timestamp resoultion is 1
second. So cmake does not rebuild test project if check takes less than 1 second.
This patch puts each test in its own directory to avoid the timestamp problem.

Patch by Chris Bergstrom

http://lists.cs.uiuc.edu/pipermail/openmp-dev/2015-July/000817.html

git-svn-id: f99161ee8ccfe2101cbe1bdda2220bce2ed25485@243017 91177308-0d34-0410-b5e6-96231b3b80d8

--- runtime/cmake/LibompCheckLinkerFlag.cmake
+++ runtime/cmake/LibompCheckLinkerFlag.cmake
@@ -23,7 +23,7 @@
      set(CMAKE_SHARED_LINKER_FLAGS \"${flag}\")
      add_library(foo SHARED src_to_link.c)")
   set(failed_regexes "[Ee]rror;[Uu]nknown;[Ss]kipping;LINK : warning")
-  set(base_dir ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/link_flag_check)
+  set(base_dir ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/link_flag_check_${boolean})
   file(MAKE_DIRECTORY ${base_dir})
   file(MAKE_DIRECTORY ${base_dir}/build)
   file(WRITE ${base_dir}/src_to_link.c "${library_source}")


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -18,4 +18,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 03)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   21)
+SET(KWSYS_DATE_STAMP_DAY   22)


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -18,4 +18,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 02)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   27)
+SET(KWSYS_DATE_STAMP_DAY   28)


STYLE: Nightly Date Stamp

STYLE: Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -7,4 +7,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 10)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   02)
+SET(KWSYS_DATE_STAMP_DAY   03)


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -18,4 +18,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 09)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   20)
+SET(KWSYS_DATE_STAMP_DAY   21)


STYLE: Nightly Date Stamp

STYLE: Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -7,4 +7,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 06)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   15)
+SET(KWSYS_DATE_STAMP_DAY   16)


STYLE: Nightly Date Stamp

STYLE: Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -7,4 +7,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 01)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   15)
+SET(KWSYS_DATE_STAMP_DAY   16)


STYLE: Nightly Date Stamp

STYLE: Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -7,4 +7,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 12)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   22)
+SET(KWSYS_DATE_STAMP_DAY   23)


STYLE: Nightly Date Stamp

STYLE: Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -7,4 +7,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 11)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   24)
+SET(KWSYS_DATE_STAMP_DAY   25)


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -18,4 +18,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 09)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   05)
+SET(KWSYS_DATE_STAMP_DAY   06)


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -18,4 +18,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 12)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   17)
+SET(KWSYS_DATE_STAMP_DAY   18)


STYLE: Nightly Date Stamp

STYLE: Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -7,4 +7,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 11)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   13)
+SET(KWSYS_DATE_STAMP_DAY   14)


STYLE: Nightly Date Stamp

STYLE: Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -7,4 +7,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 11)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   16)
+SET(KWSYS_DATE_STAMP_DAY   17)


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -18,4 +18,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 02)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   15)
+SET(KWSYS_DATE_STAMP_DAY   16)


Updated FW

Updated FW

--- cmake/Depthai/DepthaiDeviceSideConfig.cmake
+++ cmake/Depthai/DepthaiDeviceSideConfig.cmake
@@ -2,7 +2,7 @@
 set(DEPTHAI_DEVICE_SIDE_MATURITY "snapshot")

 # "full commit hash of device side binary"
-set(DEPTHAI_DEVICE_SIDE_COMMIT "3db258a19abb8d47b2e29a71fbc140156058559b")
+set(DEPTHAI_DEVICE_SIDE_COMMIT "a112effa00f9870fc54bf98253af9037b25ae66c")

 # "version if applicable"
 set(DEPTHAI_DEVICE_SIDE_VERSION "")


remove INAV and switch to new logger for fmu-v2 builds

roughly 10K bytes below the 1MiB limit

--- cmake/configs/nuttx_px4fmu-v2_default.cmake
+++ cmake/configs/nuttx_px4fmu-v2_default.cmake
@@ -113,8 +113,8 @@
 	#
 	# Logging
 	#
-	#modules/logger
-	modules/sdlog2
+	modules/logger
+	#modules/sdlog2

 	#
 	# Library modules


Made it explicit that the builtin GSL build should use -fPIC.

Without it the build, at least on SLC6 with GCC 6.2 would fail to link against
the generated GSL library.

--- cmake/modules/SearchInstalledSoftware.cmake
+++ cmake/modules/SearchInstalledSoftware.cmake
@@ -430,7 +430,7 @@
       INSTALL_DIR ${CMAKE_BINARY_DIR}
       CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix <INSTALL_DIR>
                         --libdir=<INSTALL_DIR>/lib
-                        --enable-shared=no
+                        --enable-shared=no --with-pic
                         CC=${CMAKE_C_COMPILER} CFLAGS=${CMAKE_C_FLAGS}
       LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1
       BUILD_BYPRODUCTS ${GSL_LIBRARIES}


Use upstream jsonpatch

Use upstream jsonpatch

--- versions.cmake
+++ versions.cmake
@@ -172,7 +172,6 @@
   URL "https://github.com/stefankoegl/python-json-pointer/archive/v2.0.tar.gz"
   URL_MD5 95f8263020e8262adf5c627a29561466)

-# Note this is a patched version of python-json-patch
 add_revision(jsonpatch
-  URL "https://github.com/cjh1/python-json-patch/archive/tomviz.zip"
-  URL_MD5 699ac8f584b6f01479de5eb7d1d19f30)
+  URL "https://github.com/stefankoegl/python-json-patch/archive/v1.21.zip"
+  URL_MD5 27073971f1fd0b78d63bdd29e1cdb703)


Update ITK version for linux

Update ITK version for linux

--- versions.cmake
+++ versions.cmake
@@ -143,9 +143,11 @@
     URL "https://data.kitware.com/api/v1/file/hashsum/sha512/${_itk_sha512}/download"
     URL_HASH SHA512=${_itk_sha512})
 elseif(UNIX)
+  set(_itk_sha512 "2d1aa00026a51bcd9072e45ffbcd4469799d2147147ce03c6d6fe1594edf982855309b63f1805d2a2eda96ca7b51e227d57da1ee3f1663701117f968c65b4a81")
   add_revision(itk
-    URL "http://www.tomviz.org/files/itk-v4.9.0-linux-64bit.tar.gz"
-    URL_MD5 "d1c2da71474ae49a3980d20e7784f401")
+    DOWNLOAD_NAME itk-v4.11.0-linux-64bit.tar.gz
+    URL "https://data.kitware.com/api/v1/file/hashsum/sha512/${_itk_sha512}/download"
+    URL_HASH SHA512=${_itk_sha512})
 endif()

 set(tbb_ver "2017_20160916oss")


[NOP] nailpolish

[NOP] nailpolish


buildsystem: flash binary to a named partition

Add support for CMake version less than 3.8. These versions don't
provide a way to have ternary expressions in expressions generator.

--- components/esptool_py/project_include.cmake
+++ components/esptool_py/project_include.cmake
@@ -278,8 +278,44 @@
         set_property(TARGET encrypted-${target_name} APPEND PROPERTY NON_ENCRYPTED_IMAGES "${offset} ${image}")
       endif()
     endif()
-
-endfunction()
+endfunction()
+
+# Use this function to generate a ternary expression that will be evaluated.
+# - retexpr is the expression returned by the function
+# - condition is the expression evaluated to a boolean
+# - condtrue is the expression to evaluate if condition is true
+# - condfalse is the expression to evaluate if condition is false
+# This function can be summarized as:
+#   retexpr = condition ? condtrue : condfalse
+function(if_expr_generator retexpr condition condtrue condfalse)
+  # CMake version 3.8 and above provide a ternary operator for expression
+  # generator. For version under, we must simulate this behaviour
+  if(${CMAKE_VERSION} VERSION_LESS "3.8.0")
+
+    # If condtrue is not empty, then we have to do something in case the
+    # condition is true. Generate the expression that will be used in that
+    # case
+    if(condtrue)
+      set(iftrue "$<${condition}:${condtrue}>")
+    endif()
+
+    # Same for condfalse. If it is empty, it is useless to create an expression
+    # that will be evaluated later
+    if(condfalse)
+      set(iffalse "$<$<NOT:${condition}>:${condfalse}>")
+    endif()
+
+    # Concatenate the previously generated expressions. If one of them was not
+    # initialized (because of empty condtrue/condfalse) it will be replace by
+    # an empty string
+    set(${retexpr} "${iftrue}${iffalse}" PARENT_SCOPE)
+
+  else()
+    # CMake 3.8 and above implement what we want, making the expression simpler
+    set(${retexpr} "$<IF:${condition},${condtrue},${condfalse}>" PARENT_SCOPE)
+  endif()
+endfunction()
+

 function(esptool_py_flash_target target_name main_args sub_args)
     set(single_value OFFSET IMAGE) # template file to use to be able to
@@ -356,21 +392,30 @@
         # The variable has_non_encrypted_image will be evaluated to "1" if some
         # images must not be encrypted. This variable will be used in the next
         # expression
-        set(has_non_encrypted_images "$<BOOL:$<TARGET_PROPERTY:encrypted-${target_name},NON_ENCRYPTED_IMAGES>>")
+        set(has_non_encrypted_images "$<BOOL:$<TARGET_PROPERTY:\
+encrypted-${target_name},NON_ENCRYPTED_IMAGES>>")

         # Prepare esptool arguments (--encrypt or --encrypt-files)
-        set_target_properties(encrypted-${target_name} PROPERTIES SUB_ARGS "${sub_args};\
-$<IF:${has_non_encrypted_images},,--encrypt >")
+        if_expr_generator(if_non_enc_expr ${has_non_encrypted_images}
+                          "" "--encrypt")
+        set_target_properties(encrypted-${target_name} PROPERTIES SUB_ARGS
+                             "${sub_args}; ${if_non_enc_expr}")

         # Generate the list of files to pass to esptool
-        set(encrypted_files "$<JOIN:$<TARGET_PROPERTY:encrypted-${target_name},ENCRYPTED_IMAGES>,\n>")
-        set(non_encrypted_files "$<JOIN:$<TARGET_PROPERTY:encrypted-${target_name},NON_ENCRYPTED_IMAGES>,\n>")
+        set(encrypted_files "$<JOIN:$<TARGET_PROPERTY\
+:encrypted-${target_name},ENCRYPTED_IMAGES>,\n>")
+        set(non_encrypted_files "$<JOIN:$<TARGET_PROPERTY:\
+encrypted-${target_name},NON_ENCRYPTED_IMAGES>,\n>")

         # Put both lists together, use --encrypted-files if we do also have
         # plain images to flash
-        set(flash_args_content "$<JOIN:$<TARGET_PROPERTY:encrypted-${target_name},SUB_ARGS>, >\
+
+        if_expr_generator(if_enc_expr ${has_non_encrypted_images}
+                          "--encrypt-files\n" "")
+        set(flash_args_content "$<JOIN:$<TARGET_PROPERTY:\
+encrypted-${target_name},SUB_ARGS>, >\
 ${non_encrypted_files}\n\
-$<IF:${has_non_encrypted_images},--encrypt-files\n,>\
+${if_enc_expr}\
 ${encrypted_files}")

         # The expression is ready to be geenrated, write it to the file which


FindPythonModules: search if not found

FindPythonModules: search if not found

It might have been installed to satisfy the module requirement since the
first check.

Change-Id: I1775c3d060cbf75bec383309fd026a4cf7b348a3

--- CMake/FindPythonModules.cmake
+++ CMake/FindPythonModules.cmake
@@ -18,7 +18,7 @@

 # Function to simplify checking if a Python module is available
 function(find_python_module module_name result)
-  if(NOT DEFINED PYTHON_MODULE_${module_name}_FOUND)
+  if(NOT PYTHON_MODULE_${module_name}_FOUND)
     _find_python_module_internal(${module_name})
   endif()
   set(${result} ${PYTHON_MODULE_${module_name}_FOUND} PARENT_SCOPE)


Enable ProjectTemplate build test on Windows again.

--- CMake/mitkTestProjectTemplate.cmake
+++ CMake/mitkTestProjectTemplate.cmake
@@ -23,12 +23,12 @@
   )

   if(CMAKE_CONFIGURATION_TYPES)
-#    foreach(config ${CMAKE_CONFIGURATION_TYPES})
-#      add_test(NAME mitkProjectTemplateBuildTest-${config} CONFIGURATIONS ${config}
-#               COMMAND ${CMAKE_COMMAND} --build ${MITK-ProjectTemplate_BINARY_DIR} --config ${config})
-#      set_tests_properties(mitkProjectTemplateBuildTest-${config} PROPERTIES
-#                           LABELS "MITK;BlueBerry")
-#    endforeach()
+    foreach(config ${CMAKE_CONFIGURATION_TYPES})
+      add_test(NAME mitkProjectTemplateBuildTest-${config} CONFIGURATIONS ${config}
+               COMMAND ${CMAKE_COMMAND} --build ${MITK-ProjectTemplate_BINARY_DIR} --config ${config})
+      set_tests_properties(mitkProjectTemplateBuildTest-${config} PROPERTIES
+                           LABELS "MITK;BlueBerry")
+    endforeach()
   else()
     add_test(mitkProjectTemplateBuildTest-${CMAKE_BUILD_TYPE}
              ${CMAKE_COMMAND} --build ${MITK-ProjectTemplate_BINARY_DIR} --config ${CMAKE_BUILD_TYPE})


Revert "Update VisomicsData external project so that branch xcorrel-flip is used"

This reverts commit 2f241ccefce6364bce31f935175b15f83f64532a.

We will have a unique branch in 'next' to change GIT_TAG in
CMakeExternals/VisomicsData.cmake, rather than introducing a seperate
commit to every topic branch.

--- CMakeExternals/VisomicsData.cmake
+++ CMakeExternals/VisomicsData.cmake
@@ -19,7 +19,7 @@
     MESSAGE(STATUS "Adding external project: ${proj}")
     ExternalProject_Add(${proj}
       GIT_REPOSITORY ${git_protocol}://kwsource.kitwarein.com/bioinformatics/visomicsdata.git
-      GIT_TAG "447afc6"
+      GIT_TAG "origin/master"
       SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}
       BINARY_DIR ${proj}-build
       PREFIX ${proj}${ep_suffix}


ctest: build in extra subdirectory

ctest: build in extra subdirectory

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

--- test.cmake
+++ test.cmake
@@ -237,7 +237,7 @@
 # Determine build directory
 ################################################################################
 string(REGEX REPLACE "[][ ():, ]" "" CTEST_BINARY_DIRECTORY "${CTEST_BUILD_NAME}")
-set(CTEST_BINARY_DIRECTORY "${CTEST_SOURCE_DIRECTORY}/build-${dashboard_model}-${CTEST_BINARY_DIRECTORY}")
+set(CTEST_BINARY_DIRECTORY "${CTEST_SOURCE_DIRECTORY}/build-${dashboard_model}/${CTEST_BINARY_DIRECTORY}")

 # Give user feedback
 ################################################################################


ignore unavailable rmw implementations

ignore unavailable rmw implementations

--- rmw_implementation_cmake/cmake/call_for_each_rmw_implementation.cmake
+++ rmw_implementation_cmake/cmake/call_for_each_rmw_implementation.cmake
@@ -58,8 +58,10 @@
   endif()
   # call macro for each RMW implementation with a target suffix
   foreach(rmw_implementation ${_rmw_implementations})
-    find_package("${rmw_implementation}" REQUIRED)
-    set(target_suffix "__${rmw_implementation}")
-    include("${_filename}")
+    find_package("${rmw_implementation}" QUIET)
+    if(${rmw_implementation}_FOUND)
+      set(target_suffix "__${rmw_implementation}")
+      include("${_filename}")
+    endif()
   endforeach()
 endmacro()


Trivial commit.

Trivial commit.

--- external/External.cmake
+++ external/External.cmake
@@ -647,7 +647,8 @@
             SOURCE_DIR "${civetweb_EXT_SOURCE_DIR}"
             CMAKE_ARGS "-DCMAKE_MACOSX_RPATH=${CMAKE_MACOSX_RPATH}"
                        "-DBUILD_SHARED_LIBS=OFF"
-                       "-DCMAKE_C_FLAGS=${EXT_C_FLAGS} -I${ressl_EXT_INCLUDE_DIR} -D'DEBUG_TRACE(...)='"
+                       "-DCMAKE_C_FLAGS=${EXT_C_FLAGS} -I${ressl_EXT_INCLUDE_DIR}"
+                       #"-DCMAKE_C_FLAGS=${EXT_C_FLAGS} -I${ressl_EXT_INCLUDE_DIR} -D'DEBUG_TRACE(...)='"
                        "-DCMAKE_CXX_FLAGS=${EXT_CXX_FLAGS}"
                        "-DCMAKE_BUILD_TYPE=${EXT_BUILD_TYPE}"
                        "-DCMAKE_INSTALL_PREFIX=${EXT_INSTALL_DIR}"


suppress warning for generated Connext code

--- rosidl_typesupport_connext_c/cmake/rosidl_typesupport_connext_c_generate_interfaces.cmake
+++ rosidl_typesupport_connext_c/cmake/rosidl_typesupport_connext_c_generate_interfaces.cmake
@@ -77,6 +77,7 @@
     )
   elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
     set(_connext_compile_flags
+      "-Wno-strict-aliasing"
       "-Wno-unused-but-set-variable"
       "-Wno-unused-parameter"
       "-Wno-unused-variable")


Specify floating point unit type.

Specify floating point unit type.

--- toolchain-arm-none-eabi.cmake
+++ toolchain-arm-none-eabi.cmake
@@ -13,7 +13,7 @@

 find_program(ARM_SIZE_EXECUTABLE arm-none-eabi-size)

-set(shared_options "-mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork -mfloat-abi=hard -ffreestanding -ffunction-sections -fdata-sections -nostdlib")
+set(shared_options "-mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork -mfloat-abi=hard -mfpu=fpv4-sp-d16 -ffreestanding -ffunction-sections -fdata-sections")
 set(CMAKE_C_FLAGS_INIT "${shared_options}" CACHE INTERNAL "Initial options for C compiler.")
 set(CMAKE_CXX_FLAGS_INIT "${shared_options}" CACHE INTERNAL "Initial options for C++ compiler.")
 set(CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,--gc-sections" CACHE INTERNAL "Initial options for executable linker.")


fix configure checks (CID 2062)

fix configure checks (CID 2062)

svn path=/trunk/KDE/kdepim/; revision=541277

--- gpgmepp/ConfigureChecks.cmake
+++ gpgmepp/ConfigureChecks.cmake
@@ -1,4 +1,6 @@
 # gpgme configure checks
+
+include (FindGpgme)

 set(CMAKE_REQUIRED_INCLUDES ${GPGME_INCLUDES})
 set(CMAKE_REQUIRED_LIBRARIES ${GPGME_LIBRARIES})
@@ -15,20 +17,20 @@
 # check if gpgme has gpgme_cancel
 check_cxx_source_compiles ("
   #include <gpgme.h>
-  int main() {
-    gpgme_ctx_t ctx = 0;
+  int test(gpgme_ctx_t& ctx) {
     gpgme_error_t e = gpgme_cancel( ctx );
   }
+  int main() { return 0; }
 " HAVE_GPGME_CANCEL
 )

 # check if gpgme has gpgme_key_t->keylist_mode
 check_cxx_source_compiles ("
   #include <gpgme.h>
-  int main() {
-    gpgme_key_t key = 0;
+  int test(gpgme_key_t& key) {
     key->keylist_mode = 0;
   }
+  int main() { return 0; }
 " HAVE_GPGME_KEY_T_KEYLIST_MODE
 )

@@ -36,8 +38,9 @@
 check_cxx_source_compiles ("
   #include <gpgme.h>
   int test(gpgme_decrypt_result_t& res) {
-    return res.wrong_key_usage;
+    return res->wrong_key_usage;
   }
+  int main() { return 0; }
 " HAVE_GPGME_WRONG_KEY_USAGE
 )

@@ -53,22 +56,22 @@
 # check if gpgme has gpgme_key_t->is_qualified
 check_cxx_source_compiles ("
   #include <gpgme.h>
-  int main() {
-    gpgme_key_t key;
+  int test(gpgme_key_t& key) {
     unsigned int iq;
     iq = key->is_qualified;
   }
+  int main() { return 0; }
 " HAVE_GPGME_KEY_T_IS_QUALIFIED
 )

 # check if gpgme has gpgme_subkey_t->is_qualified
 check_cxx_source_compiles ("
   #include <gpgme.h>
-  int main() {
-    gpgme_subkey_t subkey;
+  int test(gpgme_subkey_t& subkey) {
     unsigned int iq;
     iq = subkey->is_qualified;
   }
+  int main() { return 0; }
 " HAVE_GPGME_SUBKEY_T_IS_QUALIFIED
 )


build: remove `SWIFT_BUILD_STDLIB` check (NFC)

The `add_swift_target_executable` is used in a single case, where it is
already being built in a standard library only build.  This removes the
unnecessary condition in the build path.

--- stdlib/cmake/modules/AddSwiftStdlib.cmake
+++ stdlib/cmake/modules/AddSwiftStdlib.cmake
@@ -23,11 +23,6 @@
   list(APPEND SWIFTEXE_TARGET_LINK_LIBRARIES swiftCore)
   # All Swift executables depend on the swiftSwiftOnoneSupport library.
   list(APPEND SWIFTEXE_TARGET_DEPENDS swiftSwiftOnoneSupport)
-
-  if(NOT "${SWIFT_BUILD_STDLIB}")
-    list(REMOVE_ITEM SWIFTEXE_TARGET_LINK_LIBRARIES
-        swiftCore)
-  endif()

   foreach(sdk ${SWIFT_SDKS})
     foreach(arch ${SWIFT_SDK_${sdk}_ARCHITECTURES})


Update abseil to new release

Update abseil to new release

--- chainerx_cc/third_party/abseil.cmake
+++ chainerx_cc/third_party/abseil.cmake
@@ -6,7 +6,7 @@
     GIT_REPOSITORY    https://github.com/abseil/abseil-cpp.git
     # TODO(take-cheeze): Use tag instead as soon as 201906 is out
     # https://github.com/abseil/abseil-cpp/releases
-    GIT_TAG           72e09a54d993b192db32be14c65adf7e9bd08c31
+    GIT_TAG           20190808
     SOURCE_DIR        "${CMAKE_CURRENT_BINARY_DIR}/abseil"
     BINARY_DIR        ""
     CONFIGURE_COMMAND ""


Tweak message

Tweak message

--- Buildyard.cmake
+++ Buildyard.cmake
@@ -32,7 +32,7 @@
 add_subdirectory("${CMAKE_BINARY_DIR}/Buildyard" # source
   "${CMAKE_BINARY_DIR}/Buildyard.bin" )          # binary
 if(MSVC)
-  message(STATUS "Build 00_Main->${CMAKE_PROJECT_NAME} to bootstrap and TBD after bootstrap\n")
+  message(STATUS "Build 00_Main->AllProjects to bootstrap and 00_Main->AllBuild after bootstrap\n")
 else()
-  message(STATUS "Use 'make -jN' to bootstrap and 'make -jN buildall' after bootstrap\n")
+  message(STATUS "Use 'make -jN' to bootstrap and 'make -jN AllBuild' after bootstrap\n")
 endif()


Use linker variable for each build type to add linker flags

--- CMake/cpp.cmake
+++ CMake/cpp.cmake
@@ -365,15 +365,13 @@
   set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -g3 -Og")
   set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -Os -mtune=native -march=native")

+  set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -s")
+  set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} -s")
+
+
   if(CMAKE_BUILD_TYPE MATCHES Debug)
     add_definitions(-D_FORTIFY_SOURCE=2 -D_GLIBCXX_DEBUG)
   endif()
-
-  if(CMAKE_BUILD_TYPE STREQUAL Release OR CMAKE_BUILD_TYPE STREQUAL MinSizeRel)
-    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s")
-  endif()
-
-  set(CMAKE_INSTALL_PREFIX "/usr/local/")

   install(TARGETS main
     RUNTIME DESTINATION bin
@@ -404,24 +402,28 @@

 message(STATUS "Variables")

-message(STATUS "CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}")
-message(STATUS "CMAKE_SOURCE_DIR: ${CMAKE_SOURCE_DIR}")
-message(STATUS "CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}")
-message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
-message(STATUS "CMAKE_CONFIGURATION_TYPES: ${CMAKE_CONFIGURATION_TYPES}")
-message(STATUS "CMAKE_COMPILER_IS_GNUCC: ${CMAKE_COMPILER_IS_GNUCC}")
-message(STATUS "CMAKE_COMPILER_IS_GNUCXX: ${CMAKE_COMPILER_IS_GNUCXX}")
-
-message(STATUS "CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}")
-message(STATUS "CMAKE_C_FLAGS_DEBUG: ${CMAKE_C_FLAGS_DEBUG}")
-message(STATUS "CMAKE_C_FLAGS_RELEASE: ${CMAKE_C_FLAGS_RELEASE}")
-message(STATUS "CMAKE_C_FLAGS_RELWITHDEBINFO: ${CMAKE_C_FLAGS_RELWITHDEBINFO}")
-message(STATUS "CMAKE_C_FLAGS_MINSIZEREL: ${CMAKE_C_FLAGS_MINSIZEREL}")
-
-message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
-message(STATUS "CMAKE_CXX_FLAGS_DEBUG: ${CMAKE_CXX_FLAGS_DEBUG}")
-message(STATUS "CMAKE_CXX_FLAGS_RELEASE: ${CMAKE_CXX_FLAGS_RELEASE}")
-message(STATUS "CMAKE_CXX_FLAGS_RELWITHDEBINFO: ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
-message(STATUS "CMAKE_CXX_FLAGS_MINSIZEREL: ${CMAKE_CXX_FLAGS_MINSIZEREL}")
-
-message(STATUS "CMAKE_EXE_LINKER_FLAGS: ${CMAKE_EXE_LINKER_FLAGS}")
+foreach(VARNAME
+    CMAKE_SYSTEM_NAME
+    CMAKE_SOURCE_DIR
+    CMAKE_BINARY_DIR
+    CMAKE_BUILD_TYPE
+    CMAKE_CONFIGURATION_TYPES
+    CMAKE_COMPILER_IS_GNUCC
+    CMAKE_COMPILER_IS_GNUCXX
+    CMAKE_C_FLAGS
+    CMAKE_C_FLAGS_DEBUG
+    CMAKE_C_FLAGS_RELEASE
+    CMAKE_C_FLAGS_RELWITHDEBINFO
+    CMAKE_C_FLAGS_MINSIZEREL
+    CMAKE_CXX_FLAGS
+    CMAKE_CXX_FLAGS_DEBUG
+    CMAKE_CXX_FLAGS_RELEASE
+    CMAKE_CXX_FLAGS_RELWITHDEBINFO
+    CMAKE_CXX_FLAGS_MINSIZEREL
+    CMAKE_EXE_LINKER_FLAGS
+    CMAKE_EXE_LINKER_FLAGS_DEBUG
+    CMAKE_EXE_LINKER_FLAGS_RELEASE
+    CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO
+    CMAKE_EXE_LINKER_FLAGS_MINSIZEREL)
+  message(STATUS "${VARNAME}: ${${VARNAME}}")
+endforeach(VARNAME)