Copy scheme files to build directory when

Why? For running unit tests without installing

--- cmake/OpenCogFunctions.cmake
+++ cmake/OpenCogFunctions.cmake
@@ -25,19 +25,19 @@
 # This configures the install and binary paths for each file, passed to it,
 # based on the value of the variables MODULE_NAME, MODULE_FILE_DIR_PATH and
 # MODULE_DIR_PATH in the PARENT_SCOPE.
-FUNCTION(PROCESS_MODULE_STRUCTURE FILE_NAME)
+FUNCTION(PROCESS_MODULE_STRUCTURE FILE_PATH)
+    GET_FILENAME_COMPONENT(FILE_NAME ${FILE_PATH} NAME)
     SET(GUILE_BIN_DIR "${CMAKE_BINARY_DIR}/opencog/scm")

     # Copy files into build directory mirroring the install path structure.
-    # Also configure for install.
+    # Also, set install path.
     IF ("${MODULE_NAME}.scm" STREQUAL "${FILE_NAME}")
         EXECUTE_PROCESS(
             COMMAND ${CMAKE_COMMAND} -E make_directory ${GUILE_BIN_DIR}/${MODULE_FILE_DIR_PATH}
         )
-        ADD_CUSTOM_COMMAND(
-            OUTPUT "${GUILE_BIN_DIR}/${MODULE_FILE_DIR_PATH}/${FILE_NAME}"
-            COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/${FILE_NAME}" "${GUILE_BIN_DIR}/${MODULE_FILE_DIR_PATH}/${FILE_NAME}"
-            DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${FILE_NAME}"
+        ADD_CUSTOM_COMMAND(TARGET ${TARGET_NAME} PRE_BUILD
+            COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/${FILE_PATH}" "${GUILE_BIN_DIR}/${MODULE_FILE_DIR_PATH}/${FILE_NAME}"
+            DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${FILE_PATH}"
         )
         SET(MODULE_FILE_DEPEND "${GUILE_BIN_DIR}/${MODULE_FILE_DIR_PATH}/${FILE_NAME}"
             PARENT_SCOPE)
@@ -48,10 +48,9 @@
         EXECUTE_PROCESS(
             COMMAND ${CMAKE_COMMAND} -E make_directory ${GUILE_BIN_DIR}/${MODULE_DIR_PATH}
         )
-        ADD_CUSTOM_COMMAND(
-            OUTPUT "${GUILE_BIN_DIR}/${MODULE_DIR_PATH}/${FILE_NAME}"
-            COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/${FILE_NAME}" "${GUILE_BIN_DIR}/${MODULE_DIR_PATH}/${FILE_NAME}"
-            DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${FILE_NAME}"
+        ADD_CUSTOM_COMMAND(TARGET ${TARGET_NAME} PRE_BUILD
+            COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/${FILE_PATH}" "${GUILE_BIN_DIR}/${MODULE_DIR_PATH}/${FILE_NAME}"
+            DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${FILE_PATH}"
         )
         SET(MODULE_FILE_DEPEND "${GUILE_BIN_DIR}/${MODULE_DIR_PATH}/${FILE_NAME}"
             PARENT_SCOPE)
@@ -74,6 +73,15 @@
 #   MODULE_FILE, is inferred from this argument, even if it is the only file to
 #   be installed.
 FUNCTION(ADD_GUILE_MODULE)
+  # Define the target that will be used to copy scheme files in the current
+  # source directory to the build directory. This is done so as to be able to
+  # run scheme unit-tests without having to run 'make install'.
+  STRING(REPLACE "/" "_" _TARGET_NAME_SUFFIX ${CMAKE_CURRENT_SOURCE_DIR})
+  SET(TARGET_NAME "COPY_TO_LOAD_PATH_IN_BUILD_DIR_FROM_${_TARGET_NAME_SUFFIX}")
+  IF (NOT (TARGET ${TARGET_NAME}))
+    ADD_CUSTOM_TARGET(${TARGET_NAME} ALL)
+  ENDIF()
+
   IF(HAVE_GUILE)
     SET(PREFIX_DIR_PATH "${GUILE_SITE_DIR}")
     SET(options "")  # This is used only as a place-holder
@@ -86,9 +94,11 @@
     # required.
     IF((DEFINED SCM_FILES) AND (DEFINED SCM_MODULE_DESTINATION))
         SET(GUILE_MODULE_DEPENDS "")
-        FOREACH(FILE_NAME ${SCM_FILES})
+        # FILE_PATH is used for variable name because files in
+        # sub-directories may be passed.
+        FOREACH(FILE_PATH ${SCM_FILES})
             # Check if the file exists in the current source directory.
-            IF(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE_NAME})
+            IF(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE_PATH})
                 MESSAGE(FATAL_ERROR "${FILE_NAME} file does not exist in "
                 ${CMAKE_CURRENT_SOURCE_DIR})
             ENDIF()
@@ -107,22 +117,18 @@
             SET(MODULE_NAME ${CMAKE_MATCH_3})
             SET(MODULE_FILE_DIR_PATH ${CMAKE_MATCH_2})
             SET(MODULE_DIR_PATH ${CMAKE_MATCH_2}/${CMAKE_MATCH_3})
+            PROCESS_MODULE_STRUCTURE(${FILE_PATH})

-            PROCESS_MODULE_STRUCTURE(${FILE_NAME})
             # NOTE: The install configuration isn't part of
             # PROCESS_MODULE_STRUCTURE function so as to avoid "Command
             # INSTALL() is not scriptable" error, when using it in copying
             # scheme files during code-generation by the OPENCOG_ADD_ATOM_TYPES
             # macro.
             INSTALL (FILES
-                ${FILE_NAME}
+                ${FILE_PATH}
                 DESTINATION ${FILE_INSTALL_PATH}
             )
-            LIST(APPEND GUILE_MODULE_DEPENDS ${MODULE_FILE_DEPEND})
         ENDFOREACH()
-        IF( NOT ( TARGET "${MODULE_NAME}_GUILE_INSTALL"))
-            ADD_CUSTOM_TARGET("${MODULE_NAME}_GUILE_INSTALL" ALL DEPENDS "${GUILE_MODULE_DEPENDS}")
-        ENDIF()
     ELSE()
         IF(NOT DEFINED SCM_FILES)
             MESSAGE(FATAL_ERROR "The keyword argument 'FILES' is not set in "


CMake: add cppcheck targets for occational checks

--- cmake/clang-cpp-checks.cmake
+++ cmake/clang-cpp-checks.cmake
@@ -1,4 +1,4 @@
-# Additional targets to perform clang-format/clang-tidy
+# Additional targets to perform clang-format/clang-tidy/cppcheck

 # Get all project files - FIXME: this should also use the list of generated targets
 IF(NOT CHECK_CXX_SOURCE_FILES)
@@ -81,3 +81,39 @@
         )
     ENDIF()
 ENDIF()
+
+FIND_PROGRAM(CPPCHECK "cppcheck")
+IF(CPPCHECK)
+    # Set export commands on
+    SET (CMAKE_EXPORT_COMPILE_COMMANDS ON)
+
+    ADD_CUSTOM_TARGET(
+        cppcheck
+        COMMAND ${CPPCHECK}
+        --enable=all
+        --project=${CMAKE_BINARY_DIR}/compile_commands.json
+        --std=c++11
+        --verbose
+        --quiet
+        --xml-version=2
+        --language=c++
+        --suppress=missingIncludeSystem
+        --output-file=${CMAKE_BINARY_DIR}/cppcheck_results.xml
+        ${CHECK_CXX_SOURCE_FILES}
+        COMMENT "Generate cppcheck report for the project"
+    )
+
+    FIND_PROGRAM(CPPCHECK_HTML "cppcheck-htmlreport")
+    IF(CPPCHECK_HTML)
+        ADD_CUSTOM_TARGET(
+            cppcheck-html
+            DEPENDS cppcheck
+            COMMAND ${CPPCHECK_HTML}
+            --title=${CMAKE_PROJECT_NAME}
+            --file=${CMAKE_BINARY_DIR}/cppcheck_results.xml
+            --report-dir=${CMAKE_BINARY_DIR}/cppcheck_results
+            --source-dir=${CMAKE_SOURCE_DIR}
+            COMMENT "Convert cppcheck report to HTML output"
+        )
+    ENDIF()
+ENDIF()


[CMake] Make .def files show up in Xcode even if they're in lib/.

...instead of include/. LLVM already takes care of .h files, but not .def.

Swift SVN r31632

--- cmake/modules/AddSwift.cmake
+++ cmake/modules/AddSwift.cmake
@@ -766,7 +766,8 @@
     list(GET split_path -1 dir)
     file(GLOB_RECURSE SWIFTLIB_SINGLE_HEADERS
       ${SWIFT_SOURCE_DIR}/include/swift${dir}/*.h
-      ${SWIFT_SOURCE_DIR}/include/swift${dir}/*.def)
+      ${SWIFT_SOURCE_DIR}/include/swift${dir}/*.def
+      ${CMAKE_CURRENT_SOURCE_DIR}/*.def)

     file(GLOB_RECURSE SWIFTLIB_SINGLE_TDS
       ${SWIFT_SOURCE_DIR}/include/swift${dir}/*.td)


updated BuildLua.cmake, forgot to copy *.hpp files on windows

--- cmake/modules/BuildLua.cmake
+++ cmake/modules/BuildLua.cmake
@@ -21,6 +21,7 @@
     lua
     copy-lua
     COMMAND ${CMAKE_SCRIPT_PATH}/robocopy.bat "<SOURCE_DIR>/src/" "<INSTALL_DIR>/include/" "*.h"
+    COMMAND ${CMAKE_SCRIPT_PATH}/robocopy.bat "<SOURCE_DIR>/src/" "<INSTALL_DIR>/include/" "*.hpp"
   )
 else()
   find_library(LUA_DL_LIBRARY dl)


Check both stderr and stdout for swig version number. Older versions
of swig used stderr.

svn path=/trunk/; revision=7340

--- cmake/modules/FindSWIG.cmake
+++ cmake/modules/FindSWIG.cmake
@@ -37,8 +37,13 @@
       IF(SWIG_version_result)
         MESSAGE(SEND_ERROR "Command \"${SWIG_EXECUTABLE} -version\" failed with output:\n${SWIG_version_error}")
       ELSE(SWIG_version_result)
+        IF(SWIG_version_output STREQUAL "")
+        STRING(REGEX REPLACE ".*SWIG Version[^0-9.]*\([0-9.]+\).*" "\\1"
+	  SWIG_version_output "${SWIG_version_error}")
+        ELSE(SWIG_version_output STREQUAL "")
         STRING(REGEX REPLACE ".*SWIG Version[^0-9.]*\([0-9.]+\).*" "\\1"
 	  SWIG_version_output "${SWIG_version_output}")
+        ENDIF(SWIG_version_output STREQUAL "")
         SET(SWIG_VERSION ${SWIG_version_output} CACHE STRING "Swig version" FORCE)
       ENDIF(SWIG_swiglib_result)
     ENDIF(SWIG_DIR)


Switched to building with native file client library


Minor improvements

Minor improvements

- removed -fPIC

--- cmake_modules/compiler.cmake
+++ cmake_modules/compiler.cmake
@@ -140,6 +140,4 @@
  endif ()

  set(CMAKE_POSITION_INDEPENDENT_CODE ON)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
-
  message(STATUS "Building with flags: ${CMAKE_CXX_FLAGS}.")


Update diagnostics-color to auto

Update diagnostics-color to auto

--- cmake/ilcsoft_default_cxx_flags.cmake
+++ cmake/ilcsoft_default_cxx_flags.cmake
@@ -41,7 +41,7 @@
 ENDIF()

-CHECK_CXX_COMPILER_FLAG("-fdiagnostics-color=always" CXX_FLAG_WORKS_-fdiagnostics-color)
+CHECK_CXX_COMPILER_FLAG("-fdiagnostics-color=auto" CXX_FLAG_WORKS_-fdiagnostics-color)
 IF(CXX_FLAG_WORKS_-fdiagnostics-color)
-    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always")
+    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=auto")
 ENDIF()


[CMake] LLVM_PLUGIN_EXT: Use CMAKE_SHARED_LIBRARY_SUFFIX rather than CMAKE_SHARED_MODULE_SUFFIX in llvm tree.

FIXME: llvm/test may be aware of LLVM_PLUGIN_EXT, like as clang/test does.
FIXME: CMAKE_*_SUFFIX may be set in HandleLLVMOptions if those variables could be writable, rather than to set one as target properties.

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

--- cmake/modules/HandleLLVMOptions.cmake
+++ cmake/modules/HandleLLVMOptions.cmake
@@ -101,7 +101,9 @@

 set(EXEEXT ${CMAKE_EXECUTABLE_SUFFIX})
 set(LTDL_SHLIB_EXT ${CMAKE_SHARED_LIBRARY_SUFFIX})
-set(LLVM_PLUGIN_EXT ${CMAKE_SHARED_MODULE_SUFFIX})
+
+# We use *.dylib rather than *.so on darwin.
+set(LLVM_PLUGIN_EXT ${CMAKE_SHARED_LIBRARY_SUFFIX})

 function(add_flag_or_print_warning flag)
   check_c_compiler_flag(${flag} C_SUPPORTS_FLAG)


cmake: Allow version numbers to be cache variables.

This change allows them to be overridden from the command line yet still
keep default values.

--- cmake/modules/StandaloneOverlay.cmake
+++ cmake/modules/StandaloneOverlay.cmake
@@ -15,10 +15,10 @@
 set(SWIFT_STDLIB_BUILD_TYPE "Release")
 set(SWIFT_SDK_OVERLAY_LIBRARY_BUILD_TYPES "SHARED")
 set(SWIFT_INSTALL_COMPONENTS "sdk-overlay" CACHE STRING "")
-set(SWIFT_DARWIN_DEPLOYMENT_VERSION_OSX "10.9")
-set(SWIFT_DARWIN_DEPLOYMENT_VERSION_IOS "7.0")
-set(SWIFT_DARWIN_DEPLOYMENT_VERSION_TVOS "9.0")
-set(SWIFT_DARWIN_DEPLOYMENT_VERSION_WATCHOS "2.0")
+set(SWIFT_DARWIN_DEPLOYMENT_VERSION_OSX "10.9" CACHE STRING "")
+set(SWIFT_DARWIN_DEPLOYMENT_VERSION_IOS "7.0" CACHE STRING "")
+set(SWIFT_DARWIN_DEPLOYMENT_VERSION_TVOS "9.0" CACHE STRING "")
+set(SWIFT_DARWIN_DEPLOYMENT_VERSION_WATCHOS "2.0" CACHE STRING "")

 set(SWIFT_SOURCE_DIR "${SWIFT_SOURCE_ROOT}/src/swift" CACHE PATH "")
 set(SWIFT_PATH_TO_LLVM_SOURCE "${SWIFT_SOURCE_ROOT}/src/llvm" CACHE PATH "")


Use further PATH_SUFFIX to clean module

Use further PATH_SUFFIX to clean module

--- cmake/modules/FindPostgreSQL.cmake
+++ cmake/modules/FindPostgreSQL.cmake
@@ -12,37 +12,13 @@

 find_path(POSTGRESQL_INCLUDE_DIR libpq-fe.h
-   PATHS ${POSTGRESQL_DIR}/include $ENV{POSTGRESQL_DIR}/include
-   "/usr/include/pgsql/"
-   "/usr/local/include/pgsql/"
-   "/usr/include/postgresql/"
-   "/usr/local/include/pgsql/server"
-   "/usr/local/include/postgresql/server"
-   "/usr/local/include/postgresql/*/server"
-   "/usr/local/pgsql/postgresql/server"
-   "/usr/local/pgsql/postgresql/*/server"
-   "/usr/local/*/include/"
-   "/usr/local/*/include/postgresql/"
-   "/usr/local/*/include/postgresql/server"
-   "/usr/include/server"
-   "/usr/include/pgsql/server"
-   "/usr/include/postgresql/server"
-   "/usr/include/postgresql/*/server"
-  PATH_SUFFIXES
-    postgresql
-    include
+   HINTS ${POSTGRESQL_DIR}/include $ENV{POSTGRESQL_DIR}/include
+   PATH_SUFFIXES pgsql pgsql/server postgresql postgresql/server
 )

 find_library(POSTGRESQL_LIBRARY NAMES pq
-    PATHS ${POSTGRESQL_DIR}/lib $ENV{POSTGRESQL_DIR}/lib
-    "/usr/lib/"
-    "/usr/lib64/"
-    "/usr/local/lib/"
-    "/usr/local/lib64/"
-    "/usr/lib/*/"
-    "/usr/local/*/"
-    "/usr/lib/posgresql/"
-    "/usr/lib64/posgresql/"
+    HINTS ${POSTGRESQL_DIR}/lib $ENV{POSTGRESQL_DIR}/lib
+    PATH_SUFFIXES pgsql posgresql
 )

 if(POSTGRESQL_LIBRARY)
@@ -54,4 +30,3 @@
                                   POSTGRESQL_INCLUDE_DIR POSTGRESQL_LIBRARY)

 mark_as_advanced(POSTGRESQL_INCLUDE_DIR POSTGRESQL_LIBRARY)
-


Fix error message

Fix error message


New version: 0.4.15

New version: 0.4.15

--- hawkey/VERSION.cmake
+++ hawkey/VERSION.cmake
@@ -1,3 +1,3 @@
 SET(HAWKEY_MAJOR "0")
 SET(HAWKEY_MINOR "4")
-SET(HAWKEY_PATCH "14")
+SET(HAWKEY_PATCH "15")


debug messages off by default

debug messages off by default

--- refcnt.cmake
+++ refcnt.cmake
@@ -1,6 +1,6 @@

 # enable/disable cmake debug messages related to this pile
-set (REFCNT_DEBUG_MSG ON)
+set (REFCNT_DEBUG_MSG OFF)

 # make sure support code is present; no harm
 # in including it twice; the user, however, should have used


Revise comment

Revise comment

--- Modules/ManageVersion.cmake
+++ Modules/ManageVersion.cmake
@@ -22,12 +22,15 @@
 #     + PRJ_INFO_CMAKE: ${CMAKE_FEDORA_TMP_DIR}/prj_info.cmake
 #       Project information files to be included by scripts.
 #
-#     This macro sets following variables:
+#     This function defines following variables:
 #     + PRJ_VER: Release version.
 #     + CHANGE_SUMMARY: Summary of changes.
 #     + RELEASE_NOTES_FILE: The loaded release file.
 #     + PRJ_DOC_DIR: Documentation for the project.
 #       Default: ${DOC_DIR}/${PROJECT_NAME}-${PRJ_VER}
+#
+#     This function defines following compile flags:
+#     + PRJ_VER
 #
 #   PRJ_INFO_CMAKE_APPEND(<prjInfoFile> <var>)
 #   - Append  var to prj_info.cmake.


update CMake seek script: mysqlclient:20 doesn't use mysqlclient_r anymore.

--- cmake/FindMySQL.cmake
+++ cmake/FindMySQL.cmake
@@ -3,7 +3,7 @@
     PATH_SUFFIXES mysql
 )
 find_library(MYSQL_LIBRARIES
-    NAMES mysqlclient_r
+    NAMES mysqlclient
     PATH_SUFFIXES mysql
 )


Fixed debug static binding to use debug build

--HG--
branch : v0-8

--- cmake/FindSILLY.cmake
+++ cmake/FindSILLY.cmake
@@ -13,7 +13,7 @@
     find_library(SILLY_LIB_STATIC_DBG NAMES SILLY_d libSILLY_d PATH_SUFFIXES static)

     cegui_find_libraries(SILLY_LIB_STATIC "libpng;jpeg;zlib" static)
-    cegui_find_libraries(SILLY_LIB_STATIC_DBG "libpng_d;jpeg_d;zlib" static)
+    cegui_find_libraries(SILLY_LIB_STATIC_DBG "libpng_d;jpeg_d;zlib_d" static)

     set( SILLY_DEFINITIONS_STATIC "SILLY_STATIC" CACHE STRING "preprocessor definitions" )
     mark_as_advanced(SILLY_DEFINITIONS_STATIC SILLY_LIB_STATIC SILLY_LIB_STATIC_DBG)


cmake: UsePython now accepts package dirs as py_compile input.

--- cmake/UsePython.cmake
+++ cmake/UsePython.cmake
@@ -34,15 +34,33 @@
         set(_py_compile_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
     endif()

+    # expand all directory paths to their contained *.py files
     foreach(_src ${_srcs})
         if(NOT IS_ABSOLUTE ${_src})
-            set(_rel ${_src})
-            get_filename_component(
-                _src "${CMAKE_CURRENT_SOURCE_DIR}/${_src}" ABSOLUTE)
-            set(_target "${_rel}${_PYSUFFIX}")
+            set(_abs "${CMAKE_CURRENT_SOURCE_DIR}/${_src}")
+        else()
+            set(_abs ${_src})
+        endif()
+
+        if(IS_DIRECTORY ${_abs})
+            file(GLOB_RECURSE _pysrcs RELATIVE ${_abs} "${_abs}/*.py")
+            foreach(_pysrc ${_pysrcs})
+                list(APPEND _exp "${_src}/${_pysrc}")
+            endforeach()
+        else()
+            list(APPEND _exp ${_src})
+        endif()
+    endforeach()
+
+    set(_srcs ${_exp})
+
+    # create compile command for each *.py file into *.pyc
+    foreach(_src ${_srcs})
+        if(NOT IS_ABSOLUTE ${_src})
+            set(_target "${_src}${_PYSUFFIX}")
+            set(_src "${CMAKE_CURRENT_SOURCE_DIR}/${_src}")
             set(_out "${_py_compile_OUTPUT_DIR}/${_target}")
         else()
-            set(_rel "")
             set(_target "${_src}${_PYSUFFIX}")
             set(_out "${_target}")
         endif()
@@ -53,6 +71,7 @@
         list(APPEND _outs ${_out})
     endforeach()

+    # create output directories
     list(REMOVE_DUPLICATES _dirs)
     foreach(_dir ${_dirs})
         file(MAKE_DIRECTORY ${_dir})


[CMake] Only build the simulator builtins if you're also building the device builtins.

This matters because simulator builtins get lipo'd together with the device builtins into a single static archive per-platform.

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

--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -376,7 +376,6 @@
       message(STATUS "iOS Simulator supported arches: ${DARWIN_iossim_ARCHS}")
       if(DARWIN_iossim_ARCHS)
         list(APPEND SANITIZER_COMMON_SUPPORTED_OS iossim)
-        list(APPEND BUILTIN_SUPPORTED_OS iossim)
       endif()
       foreach(arch ${DARWIN_iossim_ARCHS})
         list(APPEND COMPILER_RT_SUPPORTED_ARCH ${arch})
@@ -405,6 +404,7 @@
         list(APPEND SANITIZER_COMMON_SUPPORTED_OS ios)
         list(APPEND BUILTIN_SUPPORTED_OS ios)
         list(APPEND PROFILE_SUPPORTED_OS ios)
+        list(APPEND BUILTIN_SUPPORTED_OS iossim)
       endif()
       foreach(arch ${DARWIN_ios_ARCHS})
         list(APPEND COMPILER_RT_SUPPORTED_ARCH ${arch})


[runtimes] Use -Wunknown-pragmas for the pragma check

This is a follow up to r362055, we need -Wunknown-pragmas otherwise
the check is going to succeed it the pragma isn't supported.

git-svn-id: 6a9f6578bdee8d959f0ed58970538b4ab6004734@362057 91177308-0d34-0410-b5e6-96231b3b80d8

--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -1,3 +1,4 @@
+include(CMakePushCheckState)
 include(CheckLibraryExists)
 include(CheckCCompilerFlag)
 include(CheckCXXCompilerFlag)
@@ -51,10 +52,13 @@

 # Check compiler pragmas
 if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+  cmake_push_check_state()
+  set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror=unknown-pragmas")
   check_c_source_compiles("
 #pragma comment(lib, \"c\")
 int main() { return 0; }
 " LIBCXXABI_HAS_COMMENT_LIB_PRAGMA)
+  cmake_pop_check_state()
 endif()

 # Check compiler flags


rm cruft

rm cruft

--- cmake/packaging.cmake
+++ cmake/packaging.cmake
@@ -1,9 +1,5 @@
 include(InstallRequiredSystemLibraries)

-set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
-set(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}")
-set(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}")
-set(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}")
 set(CPACK_PACKAGE_CONTACT "Kilgore Trout")

 include(CPack)


Partially revert 3d951fd to fix OSX bundle generation

--- Common.cmake
+++ Common.cmake
@@ -84,6 +84,9 @@
   endif()
   set(CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem ")
   set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ")
+  if(NOT CMAKE_INSTALL_NAME_DIR)
+    set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
+  endif()
 endif()
 if(MSVC)
   # http://www.cmake.org/cmake/help/v3.0/policy/CMP0020.html


Apply changes for new clang version (disable warning -Wunused-funciton for Vc )

--- math/vc/cmake/VcMacros.cmake
+++ math/vc/cmake/VcMacros.cmake
@@ -375,6 +375,10 @@
       # disable these warnings because clang shows them for function overloads that were discarded via SFINAE
       vc_add_compiler_flag(Vc_DEFINITIONS "-Wno-local-type-template-args")
       vc_add_compiler_flag(Vc_DEFINITIONS "-Wno-unnamed-type-template-args")
+      # disable this warning appearing from version 3.4 (5.1)
+      vc_add_compiler_flag(Vc_DEFINITIONS "-Wno-unused-function")
+
+

 #not needed in ROOT
 #      AddCompilerFlag(-stdlib=libc++)


Updated the android build scripts for linux.

Change-Id: I589dcf7179d843329f65bde177960d545b3f5657
Reviewed-on: https://wnproject.org/gerrit/120
Reviewed-by: devpow112 <bef84a74f4a3947934cc58306a6aae518eaf1936@gmail.com>
Try: devpow112 <bef84a74f4a3947934cc58306a6aae518eaf1936@gmail.com>
Tested-by: WNBot <efa0942020584fb66fb8bea377b59e48fa0f85ef@gmail.com>

--- Overlays/Posix/Overlays/Android/cmake/gradle_build.cmake
+++ Overlays/Posix/Overlays/Android/cmake/gradle_build.cmake
@@ -55,8 +55,6 @@
   )
   set(FILES_TO_COPY
     gradlew.bat
-    gradlew
-    gradle/wrapper/gradle-wrapper.jar
     gradle/wrapper/gradle-wrapper.properties
   )
   set(ANDROID_RUNNER ${WNFramework_SOURCE_DIR}/Overlays/Posix/Overlays/Android/cmake/android_helpers/android_runner.py)
@@ -75,6 +73,33 @@
       ${WNFramework_BINARY_DIR}/apps/${name}/${copy}
       COPYONLY)
   endforeach()
+  file(COPY
+    ${WNFramework_SOURCE_DIR}/Overlays/Posix/Overlays/Android/cmake/android_helpers/gradle/gradlew.in
+    DESTINATION
+    ${WNFramework_BINARY_DIR}/apps/${name}/
+    FILE_PERMISSIONS
+        OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ
+        GROUP_EXECUTE
+  )
+  file(RENAME
+    ${WNFramework_BINARY_DIR}/apps/${name}/gradlew.in
+    ${WNFramework_BINARY_DIR}/apps/${name}/gradlew
+  )
+  file(MAKE_DIRECTORY
+    ${WNFramework_BINARY_DIR}/apps/${name}/gradle/wrapper/
+  )
+  file(COPY
+    ${WNFramework_SOURCE_DIR}/Overlays/Posix/Overlays/Android/cmake/android_helpers/gradle/gradle/wrapper/gradle-wrapper.jar.in
+    DESTINATION
+    ${WNFramework_BINARY_DIR}/apps/${name}/gradle/wrapper/
+    FILE_PERMISSIONS
+        OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ
+        GROUP_EXECUTE
+  )
+  file(RENAME
+    ${WNFramework_BINARY_DIR}/apps/${name}/gradle/wrapper/gradle-wrapper.jar.in
+    ${WNFramework_BINARY_DIR}/apps/${name}/gradle/wrapper/gradle-wrapper.jar
+  )

   configure_file(${WNFramework_SOURCE_DIR}/Overlays/Posix/Overlays/Android/cmake/android_helpers/quick_run.py.in
                  ${WNFramework_BINARY_DIR}/apps/${name}.py)
@@ -103,12 +128,19 @@
           ${WNFramework_BINARY_DIR}/apps/${name}/app/src/main/jniLibs/${ABI}/lib${name}.so)
   endforeach()

+  set(GRADLE_COMMAND_PREFIX "./")
+  set(GRADLE_COMAND_POSTFIX "")
+  if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
+    set(GRADLE_COMMAND_PREFIX "")
+    set(GRADLE_COMMAND_POSTFIX ".bat")
+  endif()
+
   add_custom_command(
     OUTPUT ${WNFramework_BINARY_DIR}/apps/${name}-debug.apk
              ${WNFramework_BINARY_DIR}/apps/${name}-unsigned.apk
       ${ALL_LIBS}
     COMMAND
-      gradlew -g ${WNFramework_BINARY_DIR}/apps/${name}/.gradle_home build
+      ${GRADLE_COMMAND_PREFIX}gradlew${GRADLE_COMMAND_POSTFIX} -g ${WNFramework_BINARY_DIR}/apps/${name}/.gradle_home build
     COMMAND
       ${CMAKE_COMMAND} -E copy
         ${WNFramework_BINARY_DIR}/apps/${name}/app/build/outputs/apk/app-debug.apk


Don't build gcc w/ Wshadow as it's far too verbose.

--- src/build_options.cmake
+++ src/build_options.cmake
@@ -65,7 +65,6 @@
 set(CLANG_EVERYTHING 0)
 if (NOT VOGL_BUILDING_SAMPLES)
     # Samples have tons of shadowing issues. Only add this flag for regular vogl projects.
-    set(CMAKE_CXX_FLAGS_LIST ${CMAKE_CXX_FLAGS_LIST} "-Wshadow")
     set(CLANG_EVERYTHING 1)
 endif()


Enhance FindPHP module

Enhance FindPHP module

--- src/cmake/FindPHP.cmake
+++ src/cmake/FindPHP.cmake
@@ -48,11 +48,13 @@
 #  PHP_EXTENSIONS_INCLUDE_DIR - Directory containing PHP extension headers.
 #  PHP_INCLUDE_DIRS           - Include directives for PHP development.
 #  PHP_VERSION_STRING         - PHP version string.
-#  PHP_VERSION_NUMBER         - PHP version number in PHP's "vernum" format.
+#  PHP_VERSION_MAJOR          - PHP major version.
+#  PHP_VERSION_MINOR          - PHP minor version.
 #  PHP_FOUND                  - Set to TRUE if all of the above has been found.
 #
 # This file has been modified to include the option to specify a "Zend" component
-# and find Zend headers.  © Nightwave Studios, 2017.
+# which, if set, forces this module to search for the Zend headers and to fail if
+# the headers could not be found.  © Nightwave Studios, 2017.
 # ~~~

 find_program(PHP_CONFIG_EXECUTABLE NAMES php-config)
@@ -88,11 +90,11 @@
     OUTPUT_STRIP_TRAILING_WHITESPACE
   )

-  execute_process(
-    COMMAND ${PHP_CONFIG_EXECUTABLE} --vernum
-    OUTPUT_VARIABLE PHP_VERSION_NUMBER
-    OUTPUT_STRIP_TRAILING_WHITESPACE
-  )
+  string(REPLACE "." ";" PHP_VERSION_MAJOR ${PHP_VERSION_STRING})
+  list(GET PHP_VERSION_MAJOR 0 PHP_VERSION_MAJOR)
+
+  string(REPLACE "." ";" PHP_VERSION_MINOR ${PHP_VERSION_STRING})
+  list(GET PHP_VERSION_MINOR 1 PHP_VERSION_MINOR)
 endif()

 mark_as_advanced(
@@ -101,8 +103,9 @@
   PHP_EXTENSIONS_DIR
   PHP_EXTENSIONS_INCLUDE_DIR
   PHP_INCLUDE_DIRS
-  PHP_VERSION_NUMBER
   PHP_VERSION_STRING
+  PHP_VERSION_MAJOR
+  PHP_VERSION_MINOR
 )

 if(PHP_FIND_COMPONENTS)
@@ -126,13 +129,14 @@
   PHP
   FOUND_VAR PHP_FOUND
   REQUIRED_VARS
+    PHP_CONFIG_EXECUTABLE
     PHP_EXECUTABLE
-    PHP_CONFIG_EXECUTABLE
     PHP_EXTENSIONS_DIR
     PHP_EXTENSIONS_INCLUDE_DIR
     PHP_INCLUDE_DIRS
-    PHP_VERSION_NUMBER
     PHP_VERSION_STRING
+    PHP_VERSION_MAJOR
+    PHP_VERSION_MINOR
   VERSION_VAR PHP_VERSION_STRING
   HANDLE_COMPONENTS
 )


Potential Win32 compile fix

Potential Win32 compile fix

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

--- PurpleAddAmalgamation.cmake
+++ PurpleAddAmalgamation.cmake
@@ -38,7 +38,7 @@

   add_library(${NAME} SHARED ${THIS_SOURCES})
   set_target_properties(${NAME} PROPERTIES
-    COMPILE_DEFINITIONS ${THIS_DEFINITIONS}
+    COMPILE_DEFINITIONS "${THIS_DEFINITIONS}"
     VERSION ${VERSION} SOVERSION ${API_VERSION}
     )


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 07)

 # 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

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

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


[added] project level assert for missing package

--- cmake/BOTG.cmake
+++ cmake/BOTG.cmake
@@ -470,6 +470,9 @@
     # Just good practice.
     botgPreventInSourceBuilds()

+    # Assert when packages are missing by default!
+    GLOBAL_SET( ${PROJECT_NAME}_ASSERT_MISSING_PACKAGES ON CACHE BOOL "Assert missing packages by default." )
+
     # Turn on tests by default.
     GLOBAL_SET( ${PROJECT_NAME}_ENABLE_TESTS ON CACHE BOOL "Enable all tests by default.")


Added llvm-config --bindir to hints where to find clang etc.

--- cmake/LLVM.cmake
+++ cmake/LLVM.cmake
@@ -89,6 +89,7 @@
 run_llvm_config(LLVM_CXXFLAGS --cxxflags)
 run_llvm_config(LLVM_CPPFLAGS --cppflags)
 run_llvm_config(LLVM_LDFLAGS --ldflags)
+run_llvm_config(LLVM_BINDIR --bindir)
 run_llvm_config(LLVM_LIBDIR --libdir)
 run_llvm_config(LLVM_INCLUDEDIR --includedir)
 run_llvm_config(LLVM_LIBS --libs)
@@ -165,7 +166,7 @@
 ####################################################################

 macro(find_program_or_die OUTPUT_VAR PROG_NAME DOCSTRING)
-  find_program(${OUTPUT_VAR} NAMES "${PROG_NAME}${LLVM_BINARY_SUFFIX}${CMAKE_EXECUTABLE_SUFFIX}" "${PROG_NAME}${CMAKE_EXECUTABLE_SUFFIX}" HINTS "${LLVM_CONFIG_LOCATION}" "${LLVM_PREFIX}" "${LLVM_PREFIX_BIN}" DOC "${DOCSTRING}")
+  find_program(${OUTPUT_VAR} NAMES "${PROG_NAME}${LLVM_BINARY_SUFFIX}${CMAKE_EXECUTABLE_SUFFIX}" "${PROG_NAME}${CMAKE_EXECUTABLE_SUFFIX}" HINTS "${LLVM_BINDIR}" "${LLVM_CONFIG_LOCATION}" "${LLVM_PREFIX}" "${LLVM_PREFIX_BIN}" DOC "${DOCSTRING}")
   if(${OUTPUT_VAR})
     message(STATUS "Found ${PROG_NAME}: ${${OUTPUT_VAR}}")
   else()


added flags for enhancing portability, changed some warnings in errors

--- cmake_compiler_settings/cmake/gcc_flags.cmake
+++ cmake_compiler_settings/cmake/gcc_flags.cmake
@@ -9,14 +9,23 @@
 # compiler warnings, should be enabled on every project
 # unlike msvc, -Wall does not enable all warnings

-# generic warnings
-add_compile_options(-Wall -Wextra -pedantic-errors -Wmain -Wunreachable-code -Wunused -Wunknown-pragmas -Werror=return-type)
+# generic warnings/errors
+add_compile_options(-Wall -Wextra)
+add_compile_options(-pedantic-errors -Werror=pedantic -Werror=main -Wunreachable-code -Wunused -Wunknown-pragmas -Werror=return-type)
+
+# portability
+add_compile_options(-Werror=multichar -Werror=address -Werror=sequence-point -Werror=cpp -Werror=strict-aliasing -Werror=strict-null-sentinel)
+
+# extensions
+add_compile_options(-Werror=pointer-arith -fno-nonansi-builtins -fstrict-enums -fvisibility-inlines-hidden)

 # multiple declaration, shadowing, eval undefined identifier
 add_compile_options(-Wshadow -Wundef -Wredundant-decls)

+add_compile_options(-Werror=ignored-qualifiers)
+
 # class/structs and init
-add_compile_options(-Wnon-virtual-dtor -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder -Wuninitialized)
+add_compile_options(-Wnon-virtual-dtor -Wctor-dtor-privacy -Werror=non-virtual-dtor -Werror=reorder -Werror=uninitialized -Werror=maybe-uninitialized -Werror=delete-non-virtual-dtor)
 if(CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 6)
 	add_compile_options(-Werror=init-self -Werror=memset-transposed-args)
 elseif(CMAKE_CXX_COMPILER_VERSION LESSER_EQUAL 4)
@@ -35,10 +44,10 @@

 # nullptr and casts warnings (may generate a lot of warnings when interacting with old code or C code)
 add_compile_options(-Wzero-as-null-pointer-constant -Wold-style-cast -Wuseless-cast)
-add_compile_options(-Wnonnull -Wcast-qual -Wcast-align -Wformat=2)
+add_compile_options(-Wnonnull -Wcast-qual -Wcast-align -Werror=null-dereference)

 # arithmetic/numeric warnings
-add_compile_options(-Wfloat-equal -Wsign-compare -Wconversion -Wsign-promo)
+add_compile_options(-Wfloat-equal -Wsign-compare -Wconversion -Wsign-promo -Werror=shift-overflow)

 # logical operations
 add_compile_options(-Wlogical-op)
@@ -46,8 +55,11 @@
 # possible code structure problem
 add_compile_options(-Wdisabled-optimization)

-# printf
-add_compile_options(-Werror=format -Werror=format-security)
+# formatting
+add_compile_options(-Wformat=2 -Werror=format -Werror=format-security -Werror=format-extra-args)
+
+#exception safety
+add_compile_options(-Werror=terminate)

 # operations on booleans
 if(CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 6)
@@ -56,15 +68,17 @@
 		add_compile_options(-Werror=bool-operation -Wint-in-bool-context)
 	endif()
 endif()
-
-# inheritance
+# suggestions for improving code
+#  inheritance
 add_compile_options(-Wsuggest-final-types -Wsuggest-final-methods -Wsuggest-override)
+# formatting
+add_compile_options(-Wsuggest-attribute=format -Wmissing-format-attribute)

 # memory
 # write-strings seems to get overritten by pedantic
-add_compile_options(-Werror=vla -Werror=array-bounds -Werror=write-strings)
+add_compile_options(-Werror=vla -Werror=array-bounds -Werror=write-strings -Werror=overflow)
 if(CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 7)
-	add_compile_options(-Walloc-zero -Walloca)
+	add_compile_options(-Werror=alloc-zero -Werror=alloca -Werror=stringop-overflow)
 endif()

 option(EFFCXX "Enable Effective C++ Warnings (very noisy on correct c++11 code)"  OFF)
@@ -72,6 +86,7 @@
 	message(" ===== Adding Effective C++ Warnings")
 	add_compile_options(-Weffc++)
 endif()
+

 ##################################################################
 # project structure


We require a recent version of Swig 3

We require a recent version of Swig 3

Change-Id: If8f85c16455fe38fc3b99d5ad7ef6112f3f11294

--- SuperBuild/SuperBuild.cmake
+++ SuperBuild/SuperBuild.cmake
@@ -309,10 +309,10 @@
 #------------------------------------------------------------------------------
 # Swig
 #------------------------------------------------------------------------------
-option ( USE_SYSTEM_SWIG "Use a pre-compiled version of SWIG 2.0 previously configured for your system" OFF )
+option ( USE_SYSTEM_SWIG "Use a pre-compiled version of SWIG 3.0 previously configured for your system" OFF )
 mark_as_advanced(USE_SYSTEM_SWIG)
 if(USE_SYSTEM_SWIG)
-  find_package ( SWIG 2 REQUIRED )
+  find_package ( SWIG 3 REQUIRED )
 else()
   include(External_Swig)
   list(APPEND ${CMAKE_PROJECT_NAME}_DEPENDENCIES Swig)


New version: 0.3.13

New version: 0.3.13

--- hawkey/VERSION.cmake
+++ hawkey/VERSION.cmake
@@ -1,3 +1,3 @@
 SET(HAWKEY_MAJOR "0")
 SET(HAWKEY_MINOR "3")
-SET(HAWKEY_PATCH "12")
+SET(HAWKEY_PATCH "13")


CMake: Fix a typo

CMake: Fix a typo

--- cmake/macros/macro_deal_ii_add_library.cmake
+++ cmake/macros/macro_deal_ii_add_library.cmake
@@ -52,7 +52,7 @@
     # Cuda specific target setup:
     #
     IF(DEAL_II_WITH_CUDA)
-      CUDA_WRAP_SRCS(${_library}_${_build_lowercase}
+      CUDA_WRAP_SRCS(${_library}.${_build_lowercase}
         OBJ _generated_cuda_files ${ARGN} SHARED
         )


ENH: change default configuration to Release

--- SuperBuild/SuperBuild.cmake
+++ SuperBuild/SuperBuild.cmake
@@ -63,6 +63,18 @@
 # SimpleITK options
 #------------------------------------------------------------------------------
 option( ${CMAKE_PROJECT_NAME}_BUILD_TESTING "Turn on Testing for SimpleITK" ON )
+
+
+#-----------------------------------------------------------------------------
+# Set a default build type if none was specified
+if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
+  message(STATUS "Setting build type to 'Release' as none was specified.")
+  set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
+  # Set the possible values of build type for cmake-gui
+  set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
+endif()
+
+

 #-----------------------------------------------------------------------------


Add option allowing to reduce number of python copy/compilation targets

By globally defining the variable CTK_COMPILE_PYTHON_SCRIPTS_GLOBAL_TARGET_NAME to a
non-empty string or by specifying the macro option 'GLOBAL_TARGET',
the following targets will be defined for the whole build system:
 - Copy<GLOBAL_TARGET_NAME>PythonResourceFiles
 - Copy<GLOBAL_TARGET_NAME>PythonScriptFiles
 - Compile<GLOBAL_TARGET_NAME>PythonFiles

For complex projects, this can help reducing the number of targets and
simplify the manual rebuild of copy and compile targets.

Also make the custom command in charge of compiling the script dependent
of Copy${target}PythonScriptFiles target. That building a compile target
implies the associated copy target will be executed.

--- CMake/ctkMacroCompilePythonScript.cmake
+++ CMake/ctkMacroCompilePythonScript.cmake
@@ -3,6 +3,18 @@
 #
 # Based on ParaView/VTK/Utilities/vtkTclTest2Py/CMakeLists.txt and
 #          ParaView/VTK/Wrapping/Python/CMakeLists.txt
+#
+
+#
+# By globally defining the variable CTK_COMPILE_PYTHON_SCRIPTS_GLOBAL_TARGET_NAME to a
+# non-empty string or by specifying the macro option 'GLOBAL_TARGET',
+# the following targets will be defined for the whole build system:
+#  - Copy<GLOBAL_TARGET_NAME>PythonResourceFiles
+#  - Copy<GLOBAL_TARGET_NAME>PythonScriptFiles
+#  - Compile<GLOBAL_TARGET_NAME>PythonFiles
+#
+# For complex projects, this can help reducing the number of targets and
+# simplify the manual rebuild of copy and compile targets.
 #

 include(${CTK_CMAKE_DIR}/ctkMacroParseArguments.cmake)
@@ -11,15 +23,9 @@
 macro(ctkMacroCompilePythonScript)
   ctkMacroParseArguments(MY
     "TARGET_NAME;SCRIPTS;RESOURCES;SOURCE_DIR;DESTINATION_DIR;INSTALL_DIR"
-    "NO_INSTALL_SUBDIR"
+    "NO_INSTALL_SUBDIR;GLOBAL_TARGET"
     ${ARGN}
     )
-
-  find_package(PythonInterp REQUIRED)
-  find_package(PythonLibs REQUIRED)
-
-  # Extract python lib path
-  get_filename_component(PYTHON_LIBRARY_PATH ${PYTHON_LIBRARY} PATH)

   # Sanity checks
   foreach(varname TARGET_NAME SCRIPTS DESTINATION_DIR INSTALL_DIR)
@@ -31,6 +37,13 @@
   if(NOT DEFINED MY_SOURCE_DIR)
     set(MY_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
   endif()
+
+  if("${CTK_COMPILE_PYTHON_SCRIPTS_GLOBAL_TARGET_NAME}" STREQUAL "")
+    set(target ${MY_TARGET_NAME})
+  else()
+    set(MY_GLOBAL_TARGET TRUE)
+    set(target ${CTK_COMPILE_PYTHON_SCRIPTS_GLOBAL_TARGET_NAME})
+  endif()

   # Since 'add_custom_command' doesn't play nicely with path having multiple
   # consecutive slashes. Let's make sure there are no trailing slashes.
@@ -38,7 +51,6 @@
   get_filename_component(MY_DESTINATION_DIR ${MY_DESTINATION_DIR} REALPATH)

   set(input_python_files)
-  set(copied_python_files)
   foreach(file ${MY_SCRIPTS})
     # Append "py" extension if needed
     get_filename_component(file_ext ${file} EXT)
@@ -53,22 +65,88 @@
       file(RELATIVE_PATH tgt_file ${CMAKE_CURRENT_BINARY_DIR} ${file})
       set(tgt "${MY_DESTINATION_DIR}/${tgt_file}")
     endif()
-
-    list(APPEND input_python_files ${src})
-    add_custom_command(DEPENDS ${src}
-                        COMMAND ${CMAKE_COMMAND} -E copy ${src} ${tgt}
-                        OUTPUT ${tgt}
-                        COMMENT "Copying python script: ${file}")
-    list(APPEND copied_python_files ${tgt})
+
+    set_property(GLOBAL APPEND PROPERTY
+      _CTK_${target}_PYTHON_SCRIPTS "${src}|${tgt}")
   endforeach()

-  add_custom_target(Copy${MY_TARGET_NAME}PythonFiles DEPENDS ${input_python_files} ${copied_python_files})
-
-  # Byte compile the Python files.
-  set(compile_all_script "${CMAKE_CURRENT_BINARY_DIR}/compile_${MY_TARGET_NAME}_python_scripts.py")
-
-  # Generate compile_${MY_TARGET_NAME}_python_scripts.py
-  file(WRITE ${compile_all_script} "
+
+  set_property(GLOBAL APPEND PROPERTY
+      _CTK_${target}_PYTHON_DESTINATION_DIRS "${MY_DESTINATION_DIR}")
+
+  if(DEFINED MY_RESOURCES)
+    set(resource_input_files)
+    foreach(file ${MY_RESOURCES})
+      set(src "${CMAKE_CURRENT_SOURCE_DIR}/${file}")
+      set(tgt "${MY_DESTINATION_DIR}/${file}")
+      set_property(GLOBAL APPEND PROPERTY
+      _CTK_${target}_PYTHON_RESOURCES "${src}|${tgt}")
+    endforeach()
+  endif()
+
+  set(MY_DIRECTORY_TO_INSTALL ${MY_DESTINATION_DIR})
+  if(MY_NO_INSTALL_SUBDIR)
+    set(MY_DIRECTORY_TO_INSTALL ${MY_DESTINATION_DIR}/)
+  endif()
+
+  # Install python module / resources directory
+  install(DIRECTORY "${MY_DIRECTORY_TO_INSTALL}"
+    DESTINATION "${MY_INSTALL_DIR}" COMPONENT RuntimeLibraries
+    USE_SOURCE_PERMISSIONS)
+
+  if(NOT MY_GLOBAL_TARGET)
+    ctkFunctionAddCompilePythonScriptTargets(${target})
+  endif()
+endmacro()
+
+
+function(_ctk_add_copy_python_files_target target type)
+  # 'type' is expected to be either "Resource" or "Script"
+  set(target_name Copy${target}Python${type}Files)
+  if(NOT TARGET ${target_name})
+    string(TOUPPER ${type} type_upper)
+    get_property(entries GLOBAL PROPERTY _CTK_${target}_PYTHON_${type_upper}S)
+    set(input_files)
+    set(copied_files)
+    foreach(entry IN LISTS entries)
+      string(REPLACE "|" ";" tuple "${entry}")
+      list(GET tuple 0 src)
+      list(GET tuple 1 tgt)
+      get_filename_component(file ${src} NAME)
+      add_custom_command(DEPENDS ${src}
+                         COMMAND ${CMAKE_COMMAND} -E copy ${src} ${tgt}
+                         OUTPUT ${tgt}
+                         COMMENT "Copying python ${type}: ${file}")
+      list(APPEND input_files ${src})
+      list(APPEND copied_files ${tgt})
+    endforeach()
+    if(entries)
+      add_custom_target(${target_name} ALL
+        DEPENDS
+          ${input_files}
+          ${copied_files}
+          )
+    endif()
+  endif()
+endfunction()
+
+
+function(_ctk_add_compile_python_directories_target target)
+  set(target_name Compile${target}PythonFiles)
+  if(NOT TARGET ${target_name})
+    # Byte compile the Python files.
+    set(compile_all_script "${CMAKE_CURRENT_BINARY_DIR}/compile_${target}_python_scripts.py")
+
+    set(_compileall_code )
+    get_property(destination_dirs GLOBAL PROPERTY _CTK_${target}_PYTHON_DESTINATION_DIRS)
+    list(REMOVE_DUPLICATES destination_dirs)
+    foreach(destination_dir IN LISTS destination_dirs)
+      set(_compileall_code "${_compileall_code}\ncompileall.compile_dir('${destination_dir}')")
+    endforeach()
+
+    message(STATUS "Generate [${target_name}] compileall script: ${compile_all_script}")
+    # Generate compile_${target}_python_scripts.py
+    file(WRITE ${compile_all_script} "
 #
 # Generated by ctkMacroCompilePythonScript CMAKE macro
 #
@@ -76,15 +154,21 @@
 # Based on paraview/VTK/Wrapping/Python/compile_all_vtk.py.in

 import compileall
-compileall.compile_dir('@MY_DESTINATION_DIR@')
-file = open('@CMAKE_CURRENT_BINARY_DIR@/python_compile_@MY_TARGET_NAME@_complete', 'w')
+@_compileall_code@
+file = open('@CMAKE_CURRENT_BINARY_DIR@/python_compile_@target@_complete', 'w')
 file.write('Done')
 ")

-  # Configure cmake script associated with the custom command
-  # required to properly update the library path with PYTHON_LIBRARY_PATH
-  set(compile_all_cmake_script "${CMAKE_CURRENT_BINARY_DIR}/compile_${MY_TARGET_NAME}_python_scripts.cmake")
-  file(WRITE ${compile_all_cmake_script} "
+    find_package(PythonInterp REQUIRED)
+    find_package(PythonLibs REQUIRED)
+
+    # Extract python lib path
+    get_filename_component(PYTHON_LIBRARY_PATH ${PYTHON_LIBRARY} PATH)
+
+    # Configure cmake script associated with the custom command
+    # required to properly update the library path with PYTHON_LIBRARY_PATH
+    set(compile_all_cmake_script "${CMAKE_CURRENT_BINARY_DIR}/compile_${target}_python_scripts.cmake")
+    file(WRITE ${compile_all_cmake_script} "
 #
 # Generated by ctkMacroCompilePythonScript CMAKE macro
 #
@@ -102,49 +186,24 @@
   )
 ")

-  add_custom_command(
-    COMMAND ${CMAKE_COMMAND} -P ${compile_all_cmake_script}
-    DEPENDS ${copied_python_files}  ${compile_all_script}
-    OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/python_compile_${MY_TARGET_NAME}_complete"
-    COMMENT "Compiling python scripts: ${MY_TARGET_NAME}"
-    )
-
-  add_custom_target(Compile${MY_TARGET_NAME}PythonFiles ALL
-    DEPENDS
-      ${CMAKE_CURRENT_BINARY_DIR}/python_compile_${MY_TARGET_NAME}_complete
-      ${compile_all_script}
+    add_custom_command(
+      COMMAND ${CMAKE_COMMAND} -P ${compile_all_cmake_script}
+      DEPENDS Copy${target}PythonScriptFiles  ${compile_all_script}
+      OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/python_compile_${target}_complete"
+      COMMENT "Compiling python scripts: ${target}"
       )
-
-  if(DEFINED MY_RESOURCES)
-    set(resource_input_files)
-    set(copied_resource_files)
-    foreach(file ${MY_RESOURCES})
-      set(src "${CMAKE_CURRENT_SOURCE_DIR}/${file}")
-      set(tgt "${MY_DESTINATION_DIR}/${file}")
-
-      list(APPEND resource_input_files ${src})
-      add_custom_command(DEPENDS ${src}
-                          COMMAND ${CMAKE_COMMAND} -E copy ${src} ${tgt}
-                          OUTPUT ${tgt}
-                          COMMENT "Copying python resource: ${file}")
-      list(APPEND copied_resource_files ${tgt})
-    endforeach()
-    add_custom_target(Copy${MY_TARGET_NAME}PythonResourceFiles ALL
-      DEPENDS
-        ${resource_input_files}
-        ${copied_resource_files}
+
+    add_custom_target(${target_name} ALL
+      DEPENDS
+        ${CMAKE_CURRENT_BINARY_DIR}/python_compile_${target}_complete
+        ${compile_all_script}
         )
   endif()
-
-  set(MY_DIRECTORY_TO_INSTALL ${MY_DESTINATION_DIR})
-  if(MY_NO_INSTALL_SUBDIR)
-    set(MY_DIRECTORY_TO_INSTALL ${MY_DESTINATION_DIR}/)
-  endif()
-
-  # Install python module / resources directory
-  install(DIRECTORY "${MY_DIRECTORY_TO_INSTALL}"
-    DESTINATION "${MY_INSTALL_DIR}" COMPONENT RuntimeLibraries
-    USE_SOURCE_PERMISSIONS)
-
-endmacro()
-
+endfunction()
+
+function(ctkFunctionAddCompilePythonScriptTargets target)
+  _ctk_add_copy_python_files_target(${target} Script)
+  _ctk_add_copy_python_files_target(${target} Resource)
+  _ctk_add_compile_python_directories_target(${target})
+endfunction()
+


Fix hardcoded path in FindLZ4F.

Fix hardcoded path in FindLZ4F.

--- cmake/FindLZ4F.cmake
+++ cmake/FindLZ4F.cmake
@@ -1,6 +1,5 @@
-
-
-# Copyright 2017 Niclas Rosenvik
+#
+# Copyright 2017 Niclas Rosenvik <youremailsarecrap@gmail.com>
 #
 # Permission to use, copy, modify, and/or distribute this file for
 # any purpose with or without fee is hereby granted, provided that the
@@ -24,7 +23,7 @@
 find_library(LZ4_LIB NAMES lz4 liblz4)

 if (LZ4F_INCLUDE_DIR)
-    file(READ /usr/pkg/include/lz4frame.h LZ4FRAME_H_CONTENTS)
+    file(READ ${LZ4F_INCLUDE_DIR}/lz4frame.h LZ4FRAME_H_CONTENTS)
     string(REGEX MATCH "#define LZ4F_VERSION [0-9]+" LZ4F_VERSION "${LZ4FRAME_H_CONTENTS}")
     string(REGEX REPLACE "#define LZ4F_VERSION ([0-9]+)" "\\1" LZ4F_VERSION "${LZ4F_VERSION}")
 endif (LZ4F_INCLUDE_DIR)


Add missing BDE_BUILD_TARGET_DBG flag for opt_dbg ufids.

--- cmake/bde_ufid.cmake
+++ cmake/bde_ufid.cmake
@@ -287,6 +287,7 @@
             >
             $<$<CONFIG:RelWithDebInfo>:
                 BDE_BUILD_TARGET_OPT
+                BDE_BUILD_TARGET_DBG
             >
             $<$<CONFIG:Debug>:
                 BDE_BUILD_TARGET_DBG


updated compiler requirements

updated compiler requirements

--- cmake/compiler.cmake
+++ cmake/compiler.cmake
@@ -8,7 +8,7 @@
     if(${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang")
         check_cxx_version("6.1")
     elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
-        check_cxx_version("3.4")
+        check_cxx_version("3.6")
     else()
         message(FATAL_ERROR "unknown version of Clang: ${COMPILER_WITH_VERSION}")
     endif()


Fix cmake crosscompilation for core2 target

Missing HAVE_SSE* cmake variables cause cc.cmake to forget about `-msse*` flags

--- cmake/prebuild.cmake
+++ cmake/prebuild.cmake
@@ -127,6 +127,10 @@
       "#define DLOCAL_BUFFER_SIZE\t16384\n"
       "#define CLOCAL_BUFFER_SIZE\t16384\n"
       "#define ZLOCAL_BUFFER_SIZE\t16384\n")
+      set(HAVE_SSE 1)
+      set(HAVE_SSE2 1)
+      set(HAVE_SSE3 1)
+      set(HAVE_SSSE3 1)
       set(SGEMM_UNROLL_M 8)
       set(SGEMM_UNROLL_N 4)
       set(DGEMM_UNROLL_M 4)


Fix environment string format

Fix environment string format

--- BuildSupport.cmake
+++ BuildSupport.cmake
@@ -35,7 +35,7 @@
 # Initialize environment variables string to use for commands.
 set (FLYEM_BIN_PATH     ${FLYEM_BUILD_DIR}/bin:$ENV{PATH})
 set (FLYEM_LIB_PATH     ${FLYEM_BUILD_DIR}/lib:$ENV{LD_LIBRARY_PATH})
-set (FLYEM_ENV_STRING   "PATH=${FLYEM_BIN_PATH}  LD_LIBRARY_PATH=${FLYEM_LIB_PATH} ")
+set (FLYEM_ENV_STRING   "env PATH=${FLYEM_BIN_PATH}  LD_LIBRARY_PATH=${FLYEM_LIB_PATH} ")

 endif (NOT FLYEM_ENV_STRING)


cmake: run tests even without built-in gtest support

Summary:
When `gtest_add_tests()` is not available (CMake versions before 3.9) just use
`add_test()` to add each test executable as a single test.

Reviewed By: yfeldblum

Differential Revision: D6805681

fbshipit-source-id: a5fa95600dc29659498725cdc3cb1ae00188e1a3

--- CMake/FollyFunctions.cmake
+++ CMake/FollyFunctions.cmake
@@ -259,10 +259,19 @@
         ${test_${cur_test}_sources}
       )
       if (HAVE_CMAKE_GTEST)
+        # If we have CMake's built-in gtest support use it to add each test
+        # function as a separate test.
         gtest_add_tests(TARGET ${cur_test_name}
                         TEST_PREFIX "${cur_test_name}."
                         TEST_LIST test_cases)
         set_tests_properties(${test_cases} PROPERTIES TIMEOUT 120)
+      else()
+        # Otherwise add each test executable as a single test.
+        add_test(
+          NAME ${cur_test_name}
+          COMMAND ${cur_test_name}
+        )
+        set_tests_properties(${cur_test_name} PROPERTIES TIMEOUT 120)
       endif()
       if (NOT "x${test_${cur_test}_content_dir}" STREQUAL "x")
         # Copy the content directory to the output directory tree so that


factor out automatic host arch detection

--- cmake/OptimizeForArchitecture.cmake
+++ cmake/OptimizeForArchitecture.cmake
@@ -11,6 +11,91 @@
    endif(_found EQUAL -1)
 endmacro(_my_find)

+macro(AutodetectHostArchitecture)
+   set(TARGET_ARCHITECTURE "generic")
+   set(_vendor_id)
+   set(_cpu_family)
+   set(_cpu_model)
+   if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+      file(READ "/proc/cpuinfo" _cpuinfo)
+      string(REGEX REPLACE ".*vendor_id[ \t]*:[ \t]+([a-zA-Z0-9_-]+).*" "\\1" _vendor_id "${_cpuinfo}")
+      string(REGEX REPLACE ".*cpu family[ \t]*:[ \t]+([a-zA-Z0-9_-]+).*" "\\1" _cpu_family "${_cpuinfo}")
+      string(REGEX REPLACE ".*model[ \t]*:[ \t]+([a-zA-Z0-9_-]+).*" "\\1" _cpu_model "${_cpuinfo}")
+      string(REGEX REPLACE ".*flags[ \t]*:[ \t]+([a-zA-Z0-9_-]+).*" "\\1" _cpu_flags "${_cpuinfo}")
+   elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+      exec_program("/usr/sbin/sysctl -n machdep.cpu.vendor" OUTPUT_VARIABLE _vendor_id)
+      exec_program("/usr/sbin/sysctl -n machdep.cpu.model"  OUTPUT_VARIABLE _cpu_model)
+      exec_program("/usr/sbin/sysctl -n machdep.cpu.family" OUTPUT_VARIABLE _cpu_family)
+      exec_program("/usr/sbin/sysctl -n machdep.cpu.features" OUTPUT_VARIABLE _cpu_flags)
+      string(TOLOWER "${_cpu_flags}" _cpu_flags)
+      string(REPLACE "." "_" _cpu_flags "${_cpu_flags}")
+   elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
+      get_filename_component(_vendor_id "[HKEY_LOCAL_MACHINE\\Hardware\\Description\\System\\CentralProcessor\\0;VendorIdentifier]" NAME CACHE)
+      get_filename_component(_cpu_id "[HKEY_LOCAL_MACHINE\\Hardware\\Description\\System\\CentralProcessor\\0;Identifier]" NAME CACHE)
+      mark_as_advanced(_vendor_id _cpu_id)
+      string(REGEX REPLACE ".* Family ([0-9]+) .*" "\\1" _cpu_family "${_cpu_id}")
+      string(REGEX REPLACE ".* Model ([0-9]+) .*" "\\1" _cpu_model "${_cpu_id}")
+   endif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+   if(_vendor_id STREQUAL "GenuineIntel")
+      if(_cpu_family EQUAL 6)
+         # Any recent Intel CPU except NetBurst
+         if(_cpu_model EQUAL 46)     # Xeon 7500 series
+            set(TARGET_ARCHITECTURE "westmere")
+         elseif(_cpu_model EQUAL 45) # Xeon TNG
+            set(TARGET_ARCHITECTURE "sandy-bridge")
+         elseif(_cpu_model EQUAL 44) # Xeon 5600 series
+            set(TARGET_ARCHITECTURE "westmere")
+         elseif(_cpu_model EQUAL 42) # Core TNG
+            set(TARGET_ARCHITECTURE "sandy-bridge")
+         elseif(_cpu_model EQUAL 37) # Core i7/i5/i3
+            set(TARGET_ARCHITECTURE "westmere")
+         elseif(_cpu_model EQUAL 31) # Core i7/i5
+            set(TARGET_ARCHITECTURE "westmere")
+         elseif(_cpu_model EQUAL 30) # Core i7/i5
+            set(TARGET_ARCHITECTURE "westmere")
+         elseif(_cpu_model EQUAL 29)
+            set(TARGET_ARCHITECTURE "penryn")
+         elseif(_cpu_model EQUAL 28)
+            set(TARGET_ARCHITECTURE "atom")
+         elseif(_cpu_model EQUAL 26)
+            set(TARGET_ARCHITECTURE "nehalem")
+         elseif(_cpu_model EQUAL 23)
+            set(TARGET_ARCHITECTURE "penryn")
+         elseif(_cpu_model EQUAL 15)
+            set(TARGET_ARCHITECTURE "merom")
+         elseif(_cpu_model EQUAL 14)
+            set(TARGET_ARCHITECTURE "core")
+         elseif(_cpu_model LESS 14)
+            message(WARNING "Your CPU (family ${_cpu_family}, model ${_cpu_model}) is not known. Auto-detection of optimization flags failed and will use the generic CPU settings with SSE2.")
+            set(TARGET_ARCHITECTURE "generic")
+         else()
+            message(WARNING "Your CPU (family ${_cpu_family}, model ${_cpu_model}) is not known. Auto-detection of optimization flags failed and will use the 65nm Core 2 CPU settings.")
+            set(TARGET_ARCHITECTURE "merom")
+         endif()
+      elseif(_cpu_family EQUAL 7) # Itanium (not supported)
+         message(WARNING "Your CPU (Itanium: family ${_cpu_family}, model ${_cpu_model}) is not supported by OptimizeForArchitecture.cmake.")
+      elseif(_cpu_family EQUAL 15) # NetBurst
+         list(APPEND _available_vector_units_list "sse" "sse2")
+         if(_cpu_model GREATER 2) # Not sure whether this must be 3 or even 4 instead
+            list(APPEND _available_vector_units_list "sse" "sse2" "sse3")
+         endif(_cpu_model GREATER 2)
+      endif(_cpu_family EQUAL 6)
+   elseif(_vendor_id STREQUAL "AuthenticAMD")
+      if(_cpu_family EQUAL 21) # 15h
+         set(TARGET_ARCHITECTURE "bulldozer")
+      elseif(_cpu_family EQUAL 20) # 14h
+      elseif(_cpu_family EQUAL 18) # 12h
+      elseif(_cpu_family EQUAL 16) # 10h
+         set(TARGET_ARCHITECTURE "barcelona")
+      elseif(_cpu_family EQUAL 15)
+         set(TARGET_ARCHITECTURE "k8")
+         if(_cpu_model GREATER 64) # I don't know the right number to put here. This is just a guess from the hardware I have access to
+            set(TARGET_ARCHITECTURE "k8-sse3")
+         endif(_cpu_model GREATER 64)
+      endif()
+   endif(_vendor_id STREQUAL "GenuineIntel")
+endmacro()
+
 macro(OptimizeForArchitecture)
    set(TARGET_ARCHITECTURE "auto" CACHE STRING "CPU architecture to optimize for. Using an incorrect setting here can result in crashes of the resulting binary because of invalid instructions used.\nSetting the value to \"auto\" will try to optimize for the architecture where cmake is called.\nOther supported values are: \"generic\", \"core\", \"merom\" (65nm Core2), \"penryn\" (45nm Core2), \"nehalem\", \"westmere\", \"sandy-bridge\", \"atom\", \"k8\", \"k8-sse3\", \"barcelona\", \"istanbul\", \"magny-cours\", \"bulldozer\", \"interlagos\".")
    set(_force)
@@ -26,88 +111,7 @@
    set(_available_vector_units_list)

    if(TARGET_ARCHITECTURE STREQUAL "auto")
-      set(TARGET_ARCHITECTURE "generic")
-      set(_vendor_id)
-      set(_cpu_family)
-      set(_cpu_model)
-      if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
-         file(READ "/proc/cpuinfo" _cpuinfo)
-         string(REGEX REPLACE ".*vendor_id[ \t]*:[ \t]+([a-zA-Z0-9_-]+).*" "\\1" _vendor_id "${_cpuinfo}")
-         string(REGEX REPLACE ".*cpu family[ \t]*:[ \t]+([a-zA-Z0-9_-]+).*" "\\1" _cpu_family "${_cpuinfo}")
-         string(REGEX REPLACE ".*model[ \t]*:[ \t]+([a-zA-Z0-9_-]+).*" "\\1" _cpu_model "${_cpuinfo}")
-         string(REGEX REPLACE ".*flags[ \t]*:[ \t]+([a-zA-Z0-9_-]+).*" "\\1" _cpu_flags "${_cpuinfo}")
-      elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
-         exec_program("/usr/sbin/sysctl -n machdep.cpu.vendor" OUTPUT_VARIABLE _vendor_id)
-         exec_program("/usr/sbin/sysctl -n machdep.cpu.model"  OUTPUT_VARIABLE _cpu_model)
-         exec_program("/usr/sbin/sysctl -n machdep.cpu.family" OUTPUT_VARIABLE _cpu_family)
-         exec_program("/usr/sbin/sysctl -n machdep.cpu.features" OUTPUT_VARIABLE _cpu_flags)
-         string(TOLOWER "${_cpu_flags}" _cpu_flags)
-         string(REPLACE "." "_" _cpu_flags "${_cpu_flags}")
-      elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
-         get_filename_component(_vendor_id "[HKEY_LOCAL_MACHINE\\Hardware\\Description\\System\\CentralProcessor\\0;VendorIdentifier]" NAME CACHE)
-         get_filename_component(_cpu_id "[HKEY_LOCAL_MACHINE\\Hardware\\Description\\System\\CentralProcessor\\0;Identifier]" NAME CACHE)
-         mark_as_advanced(_vendor_id _cpu_id)
-         string(REGEX REPLACE ".* Family ([0-9]+) .*" "\\1" _cpu_family "${_cpu_id}")
-         string(REGEX REPLACE ".* Model ([0-9]+) .*" "\\1" _cpu_model "${_cpu_id}")
-      endif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
-      if(_vendor_id STREQUAL "GenuineIntel")
-         if(_cpu_family EQUAL 6)
-            # Any recent Intel CPU except NetBurst
-            if(_cpu_model EQUAL 46)     # Xeon 7500 series
-               set(TARGET_ARCHITECTURE "westmere")
-            elseif(_cpu_model EQUAL 45) # Xeon TNG
-               set(TARGET_ARCHITECTURE "sandy-bridge")
-            elseif(_cpu_model EQUAL 44) # Xeon 5600 series
-               set(TARGET_ARCHITECTURE "westmere")
-            elseif(_cpu_model EQUAL 42) # Core TNG
-               set(TARGET_ARCHITECTURE "sandy-bridge")
-            elseif(_cpu_model EQUAL 37) # Core i7/i5/i3
-               set(TARGET_ARCHITECTURE "westmere")
-            elseif(_cpu_model EQUAL 31) # Core i7/i5
-               set(TARGET_ARCHITECTURE "westmere")
-            elseif(_cpu_model EQUAL 30) # Core i7/i5
-               set(TARGET_ARCHITECTURE "westmere")
-            elseif(_cpu_model EQUAL 29)
-               set(TARGET_ARCHITECTURE "penryn")
-            elseif(_cpu_model EQUAL 28)
-               set(TARGET_ARCHITECTURE "atom")
-            elseif(_cpu_model EQUAL 26)
-               set(TARGET_ARCHITECTURE "nehalem")
-            elseif(_cpu_model EQUAL 23)
-               set(TARGET_ARCHITECTURE "penryn")
-            elseif(_cpu_model EQUAL 15)
-               set(TARGET_ARCHITECTURE "merom")
-            elseif(_cpu_model EQUAL 14)
-               set(TARGET_ARCHITECTURE "core")
-            elseif(_cpu_model LESS 14)
-               message(WARNING "Your CPU (family ${_cpu_family}, model ${_cpu_model}) is not known. Auto-detection of optimization flags failed and will use the generic CPU settings with SSE2.")
-               set(TARGET_ARCHITECTURE "generic")
-            else()
-               message(WARNING "Your CPU (family ${_cpu_family}, model ${_cpu_model}) is not known. Auto-detection of optimization flags failed and will use the 65nm Core 2 CPU settings.")
-               set(TARGET_ARCHITECTURE "merom")
-            endif()
-         elseif(_cpu_family EQUAL 7) # Itanium (not supported)
-            message(WARNING "Your CPU (Itanium: family ${_cpu_family}, model ${_cpu_model}) is not supported by OptimizeForArchitecture.cmake.")
-         elseif(_cpu_family EQUAL 15) # NetBurst
-            list(APPEND _available_vector_units_list "sse" "sse2")
-            if(_cpu_model GREATER 2) # Not sure whether this must be 3 or even 4 instead
-               list(APPEND _available_vector_units_list "sse" "sse2" "sse3")
-            endif(_cpu_model GREATER 2)
-         endif(_cpu_family EQUAL 6)
-      elseif(_vendor_id STREQUAL "AuthenticAMD")
-         if(_cpu_family EQUAL 21) # 15h
-            set(TARGET_ARCHITECTURE "bulldozer")
-         elseif(_cpu_family EQUAL 20) # 14h
-         elseif(_cpu_family EQUAL 18) # 12h
-         elseif(_cpu_family EQUAL 16) # 10h
-            set(TARGET_ARCHITECTURE "barcelona")
-         elseif(_cpu_family EQUAL 15)
-            set(TARGET_ARCHITECTURE "k8")
-            if(_cpu_model GREATER 64) # I don't know the right number to put here. This is just a guess from the hardware I have access to
-               set(TARGET_ARCHITECTURE "k8-sse3")
-            endif(_cpu_model GREATER 64)
-         endif()
-      endif(_vendor_id STREQUAL "GenuineIntel")
+      AutodetectHostArchitecture()
       message(STATUS "Detected CPU: ${TARGET_ARCHITECTURE}")
    endif(TARGET_ARCHITECTURE STREQUAL "auto")


Allow ctest to log more than 4kb

Allow ctest to log more than 4kb

--- Packaging/CTestConfig.cmake
+++ Packaging/CTestConfig.cmake
@@ -24,5 +24,3 @@
 set(CTEST_DROP_SITE "dash.orfeo-toolbox.org")
 set(CTEST_DROP_LOCATION "/submit.php?project=OTB")
 set(CTEST_DROP_SITE_CDASH TRUE)
-set(CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE 4096)
-set(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 4096)


Version: Drop git describe commit count from version number

Revise the logic from commit 60dc8284 (Version: Update version scheme to
distinguish release and dev versions, 2019-04-11, v0.2.0~2) to drop the
`-<count>` portion of the version number.  This makes the version string
the same for versions built from a Git source tree and from a tarball.

--- src/Version.cmake
+++ src/Version.cmake
@@ -46,15 +46,7 @@

   # If this is not the exact commit of a release, add dev info.
   if(NOT "${git_subject}" MATCHES "^[Cc]ast[Xx][Mm][Ll] ${CastXML_VERSION}$")
-    set(git_suffix "-g${git_hash}")
-    if(COMMAND _git)
-      # Use version suffix computed by 'git describe' if this version has been tagged.
-      _git(describe --tags --match "v${CastXML_VERSION}" HEAD)
-      if(_git_out MATCHES "^v${CastXML_VERSION}(-[0-9]+-g[0-9a-f]+)?$")
-        set(git_suffix "${CMAKE_MATCH_1}")
-      endif()
-    endif()
-    set(CastXML_VERSION "${CastXML_VERSION}${git_suffix}")
+    set(CastXML_VERSION "${CastXML_VERSION}-g${git_hash}")
   endif()

   # If this is a work tree, check whether it is dirty.


Random whitespace changes to trigger CI for modified external dependency :P

--- CMakeExternals.cmake
+++ CMakeExternals.cmake
@@ -10,7 +10,7 @@
     if(TARGET libzmq OR TARGET libcppzmq)
       return()
     endif()
-
+
     set(ZMQ_VER "4_2_3")
     string(REPLACE "_" "." ZMQ_TAG "v${ZMQ_VER}")
     if(MSVC_IDE)
@@ -85,7 +85,7 @@
     if(TARGET libpng)
       return()
     endif()
-
+
     require_external(zlib)

     if(MSVC)
@@ -117,7 +117,7 @@
     if(TARGET zfp)
       return()
     endif()
-
+
     if(WIN32)
       set(ZFP_LIB "lib/zfp.lib")
     else()
@@ -143,7 +143,7 @@
     if(TARGET glm)
       return()
     endif()
-
+
     add_external_project(glm_ext
       GIT_REPOSITORY https://github.com/g-truc/glm.git
       GIT_TAG "0.9.8"
@@ -160,7 +160,7 @@
     if(TARGET glowl)
       return()
     endif()
-
+
     add_external_project(glowl_ext
       GIT_REPOSITORY https://github.com/invor/glowl.git
       GIT_TAG "v0.1"
@@ -176,7 +176,7 @@
     if(TARGET json)
       return()
     endif()
-
+
     add_external_project(json_ext
       GIT_REPOSITORY https://github.com/azadkuh/nlohmann_json_release.git
       GIT_TAG "v3.5.0"
@@ -193,7 +193,7 @@
     if(TARGET Eigen)
       return()
     endif()
-
+
     add_external_project(Eigen_ext
       GIT_REPOSITORY https://github.com/eigenteam/eigen-git-mirror.git
       GIT_TAG "3.3.4"
@@ -204,12 +204,12 @@
     add_external_library(Eigen INTERFACE
       DEPENDS Eigen_ext
       INCLUDE_DIR "src/Eigen_ext")
-
+
   elseif(NAME STREQUAL "nanoflann")
     if(TARGET nanoflann)
       return()
     endif()
-
+
     add_external_project(nanoflann_ext
       GIT_REPOSITORY https://github.com/jlblancoc/nanoflann.git
       GIT_TAG "v1.3.0"
@@ -220,12 +220,12 @@
     add_external_library(nanoflann INTERFACE
       DEPENDS nanoflann_ext
       INCLUDE_DIR "src/nanoflann_ext/include")
-
+
   elseif(NAME STREQUAL "Delaunator")
     if(TARGET Delaunator)
       return()
     endif()
-
+
     add_external_project(Delaunator_ext
       GIT_REPOSITORY https://github.com/delfrrr/delaunator-cpp.git
       GIT_TAG "v0.4.0"
@@ -274,7 +274,7 @@
     if(TARGET sim_sort)
       return()
     endif()
-
+
     add_external_project(sim_sort_ext
       GIT_REPOSITORY https://github.com/alexstraub1990/simultaneous-sort.git
       CONFIGURE_COMMAND ""
@@ -286,7 +286,7 @@
       DEPENDS sim_sort_ext
       INCLUDE_DIR "src/sim_sort_ext/include"
     )
-
+
   else()
     message(FATAL_ERROR "Unknown external required \"${NAME}\"")
   endif()


FIX: updated BUG URL

FIX: updated BUG URL

--- DartConfig.cmake
+++ DartConfig.cmake
@@ -25,7 +25,7 @@
 SET (DOXYGEN_URL "http://${DROP_SITE}/Insight/Doxygen/html/" )

 SET (USE_GNATS "On")
-SET (GNATS_WEB_URL "http://${DROP_SITE}/Bug/index.php/")
+SET (GNATS_WEB_URL "http://${DROP_SITE}/Bug/index.php")

 # Continuous email delivery variables
 SET (CONTINUOUS_FROM "lorensen@crd.ge.com")


ENH: Adding support for continuous build email nagging

--- DartConfig.cmake
+++ DartConfig.cmake
@@ -21,3 +21,10 @@

 SET (USE_GNATS "On")
 SET (GNATS_WEB_URL "http://${DROP_SITE}/cgi-bin/gnatsweb.pl/Insight/")
+
+# Continuous email delivery variables
+SET (DELIVER_CONTINUOUS_EMAIL "Off")
+SET (CONTINUOUS_FROM "lorensen@crd.ge.com")
+SET (SMTP_MAILHOST "public.kitware.com")
+SET (CONTINUOUS_MONITOR_LIST "lorensen@crd.ge.com millerjv@crd.ge.com")
+SET (CONTINUOUS_BASE_URL "http://www.itk.org/")


FindPStream fixed path

FindPStream fixed path

--- Server/cmake/modules/FindPStreams.cmake
+++ Server/cmake/modules/FindPStreams.cmake
@@ -6,11 +6,12 @@
     find_path(
         PSTREAMS_INCLUDE_DIR
         NAMES pstreams/pstream.h
-        HINTS   /usr/include
-                /usr/local/include
+        HINTS
+              /usr/include
+              /usr/local/include
     )
     find_package_handle_standard_args(PStreams DEFAULT_MSG
         "" ${PSTREAMS_INCLUDE_DIR})

     mark_as_advanced(PSTREAMS_INCLUDE_DIR)
-endif()+endif()


x11_egl: use quotes to include glesv1_cm directories am: f5e7ab6b79 am: 8f736c4099 am: 4894b68cb9
am: ac59716be6

Change-Id: Ibae70eb9a114a2ca90bf0657f1de23712412ec91

--- targets/x11_egl/x11_egl.cmake
+++ targets/x11_egl/x11_egl.cmake
@@ -38,7 +38,7 @@
 if (GLES1_LIBRARIES)
 	set(DEQP_SUPPORT_GLES1	ON)
 	set(DEQP_GLES1_LIBRARIES ${GLES1_LIBRARIES})
-	set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} -L${GLES1_LIBRARY_DIRS})
+	set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L${GLES1_LIBRARY_DIRS}")
 	if ("${PKG_GLES1_INCLUDE_DIRS}" STREQUAL "")
 		# PKG_GLES1_INCLUDE_DIRS empty, see if matching include
 		# path (GLES/gl.h) exists beside library directory


Thanks to Dan

Thanks to Dan

--- Superbuild/Superbuild.cmake
+++ Superbuild/Superbuild.cmake
@@ -104,6 +104,7 @@
     SET(BUILD_WITH_PYTHON OFF)
     SET(BUILD_WITH_SCIRUN_DATA OFF)
   ELSE()
+    SET(BUILD_WITH_SCIRUN_DATA OFF)
     # try building everything with clang!
   ENDIF()
   ADD_DEFINITIONS(-DTRAVIS_BUILD)


Remove unused file

Remove unused file

--- BuildLibrary.cmake
+++ BuildLibrary.cmake
@@ -1,36 +0,0 @@
-# Copyright (c) 2014 Stefan.Eilemann@epfl.ch
-
-# Configures the build for a simple library:
-#   build_library(<Name>)
-#
-# Uses:
-# * NAME_SOURCES for all compilation units
-# * NAME_HEADERS for all internal header files
-# * NAME_PUBLIC_HEADERS for public, installed header files
-# * NAME_LINK_LIBRARIES for dependencies of name
-# * VERSION for the API version
-# * VERSION_ABI for the ABI version
-#
-# Builds libName and installs it. Installs the public headers to include/name.
-
-function(BUILD_LIBRARY Name)
-  string(TOUPPER ${Name} NAME)
-  string(TOLOWER ${Name} name)
-  set(SOURCES ${${NAME}_SOURCES})
-  set(HEADERS ${${NAME}_HEADERS})
-  set(PUBLIC_HEADERS ${${NAME}_PUBLIC_HEADERS})
-  set(LINK_LIBRARIES ${${NAME}_LINK_LIBRARIES})
-
-  source_group(${name} FILES ${SOURCES} ${HEADERS} ${PUBLIC_HEADERS})
-  add_library(${Name} SHARED ${SOURCES} ${HEADERS} ${PUBLIC_HEADERS})
-  target_link_libraries(${Name} ${LINK_LIBRARIES})
-  set_target_properties(${Name}
-    PROPERTIES VERSION ${VERSION} SOVERSION ${VERSION_ABI}
-    PUBLIC_HEADER "${PUBLIC_HEADERS}")
-
-  install(TARGETS ${Name}
-    PUBLIC_HEADER DESTINATION include/${name} COMPONENT dev
-    ARCHIVE DESTINATION lib COMPONENT dev
-    RUNTIME DESTINATION bin COMPONENT lib
-    LIBRARY DESTINATION lib COMPONENT lib)
-endfunction()


cmake: Change project version to 1.0.0rc1

--- BasisProject.cmake
+++ BasisProject.cmake
@@ -44,8 +44,8 @@
   # meta-data
   NAME        "Deformable"
   PACKAGE     "MIRTK"
-  VERSION     "1.0.0" # External module version
-  SOVERSION   "0"     # API yet unstable
+  VERSION     "1.0.0rc1" # External module version
+  SOVERSION   "0"        # API yet unstable
   AUTHORS     "Andreas Schuh"
   DESCRIPTION "Deformable library of the Medical Image Registration ToolKit."
   COPYRIGHT   "2013-2015 Imperial College London, Andreas Schuh"


fixed copyright notice

fixed copyright notice

--- BasisProject.cmake
+++ BasisProject.cmake
@@ -1,5 +1,5 @@
 # ===============================================================================
-# Copyright (c) 2015 <provider-name>
+# Copyright (c) 2015-2016 Andrew Hundt
 # All rights reserved.
 #
 # See COPYING file for license information.


修复IMPORTED_CONFIGURATIONS可能多个的问题

--- project/cmake/modules/ProjectBuildTools.cmake
+++ project/cmake/modules/ProjectBuildTools.cmake
@@ -513,9 +513,13 @@
     if (NOT ${OUTPUT_VAR_NAME})
         unset(project_build_tools_get_imported_location_IMPORTED_CONFIGURATIONS)
         get_target_property(project_build_tools_get_imported_location_IMPORTED_CONFIGURATIONS ${TARGET_NAME} IMPORTED_CONFIGURATIONS)
-        if (project_build_tools_get_imported_location_IMPORTED_CONFIGURATIONS)
-            get_target_property(${OUTPUT_VAR_NAME} ${TARGET_NAME} "IMPORTED_LOCATION_${project_build_tools_get_imported_location_IMPORTED_CONFIGURATIONS}")
-            unset(project_build_tools_get_imported_location_IMPORTED_CONFIGURATIONS)
-        endif ()
+        foreach(project_build_tools_get_imported_location_IMPORTED_CONFIGURATION IN LISTS project_build_tools_get_imported_location_IMPORTED_CONFIGURATIONS)
+            get_target_property(${OUTPUT_VAR_NAME} ${TARGET_NAME} "IMPORTED_LOCATION_${project_build_tools_get_imported_location_IMPORTED_CONFIGURATION}")
+            if (${OUTPUT_VAR_NAME})
+                break()
+            endif()
+        endforeach()
+        unset(project_build_tools_get_imported_location_IMPORTED_CONFIGURATIONS)
+        unset(project_build_tools_get_imported_location_IMPORTED_CONFIGURATION)
     endif()
 endmacro()


added include directory of test dependencies...

--- CMake/WkTest.cmake
+++ CMake/WkTest.cmake
@@ -32,24 +32,16 @@

 			#if test arguments
 			IF ( ${ARGC} GREATER 2 )
+				#Forcing static libraries. test are always executables, and shared libraries or modules should be built and installed separately, if they ever have to come into a test...
 				SET(${project_name}_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
 				SET(BUILD_SHARED_LIBS OFF)
 				FOREACH ( looparg ${ARGN} )
 					MESSAGE ( STATUS "==" )
 					MESSAGE ( STATUS "Cmake'ing ${test_name} Dependency : ${looparg}" )
-					#
-					# CMake doesnt support convenience lib right now
 					ADD_SUBDIRECTORY(test/ext/${looparg} test/ext/${looparg}_build EXCLUDE_FROM_ALL)
 					TARGET_LINK_LIBRARIES(${test_name} ${looparg})
 					ADD_DEPENDENCIES(${test_name} ${looparg})
-					# CMake prefer the manual method
-					#
-					#FILE(GLOB_RECURSE ${looparg}_SRCS RELATIVE ${PROJECT_SOURCE_DIR} ext/${looparg}/src/*.c ext/${looparg}/src/*.cpp ext/${looparg}/src/*.cc)
-					#FILE(GLOB_RECURSE ${looparg}_HEADERS RELATIVE ${PROJECT_SOURCE_DIR} ext/${looparg}/include/*.h ext/${looparg}/include/*.hh ext/${looparg}/include/*.hpp)
-					#MERGE("${DEPENDS_SRCS}" "${${looparg}_HEADERS};${${looparg}_SRCS}" DEPENDS_SRCS)
-					#
-					# Thats it !
-					#
+					INCLUDE_DIRECTORIES(test/ext/${looparg}/include)
 					MESSAGE ( STATUS "Cmake'ing ${looparg} : Done." )
 					MESSAGE ( STATUS "==" )
 				ENDFOREACH ( looparg )


Updated jenkins cmake script

Updated jenkins cmake script

--- CTestJenkins.cmake
+++ CTestJenkins.cmake
@@ -1,6 +1,6 @@
 set(CTEST_SOURCE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
 set(CTEST_BINARY_DIRECTORY "${CTEST_SOURCE_DIRECTORY}/build")
-set(CTEST_TEST_TIMEOUT 60)
+set(CTEST_TEST_TIMEOUT 300)

 site_name(CTEST_SITE)
 set(CTEST_BUILD_NAME "${JENKINS_BUILD_NAME}")


Updated jenkins cmake script

Updated jenkins cmake script

--- CTestJenkins.cmake
+++ CTestJenkins.cmake
@@ -8,7 +8,7 @@
 set(CTEST_BUILD_OPTIONS "${JENKINS_BUILD_OPTIONS}")
 set(CTEST_BUILD_CONFIGURATION "${JENKINS_BUILD_CONFIGURATION}")

-set(CTEST_MEMORYCHECK_COMMAND_OPTIONS "${CTEST_MEMORYCHECK_COMMAND_OPTIONS} --xml=yes --xml-file=test_%p_memcheck.xml")
+set(CTEST_MEMORYCHECK_COMMAND_OPTIONS "${CTEST_MEMORYCHECK_COMMAND_OPTIONS} -g --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=50 --xml=yes --xml-file=test_%p_memcheck.xml")

 set(CTEST_COVERAGE_CXX_FLAGS "-DCMAKE_CXX_FLAGS:STRING=-fprofile-arcs -ftest-coverage")
 set(CTEST_COVERAGE_EXE_LD_FLAGS "-DCMAKE_EXE_LINKER_FLAGS:STRING=-fprofile-arcs -ftest-coverage")


Delete message on Windows

Delete message on Windows

--- salome_adm/cmake_files/FindSalomeSphinx.cmake
+++ salome_adm/cmake_files/FindSalomeSphinx.cmake
@@ -30,7 +30,6 @@

 # Ensure the command is run with the given PYTHONPATH
 IF(WIN32 AND NOT CYGWIN)
-   MESSAGE(WARNING "Sphinx windows command not re-tested.")
    SET(SPHINX_EXECUTABLE ${SPHINX_EXECUTABLE})
 ELSE()
    SET(SPHINX_EXECUTABLE /usr/bin/env PYTHONPATH="${SPHINX_PYTHONPATH}:$$PYTHONPATH" ${SPHINX_EXECUTABLE})


Pass standard CMake variable to initial GTest CMake cache


cmake-modules
 * FindThirdPartyMatlab.cmake added mclmcrrt.lib in the link dependencies, for the matlabdll box.

git-svn-id: ed1ce8e5c168003d808aec37bc6fda77b178f7bb@3118 c330d7e9-fc0c-0410-a5b3-fd85c6f5aa8f

--- trunk/cmake-modules/FindThirdPartyMatlab.cmake
+++ trunk/cmake-modules/FindThirdPartyMatlab.cmake
@@ -22,11 +22,12 @@
 				ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 4)
 			ENDIF(UNIX)
 			IF(WIN32)
-				SET(Matlab_LIBRARIES libmex libmx libeng)
+				SET(Matlab_LIBRARIES libmex libmx libeng mclmcrrt)
 				SET(Matlab_LIB_DIRECTORIES ${Matlab_ROOT}/extern/lib/win32/microsoft)
 				# for delayed importation on windows
 				TARGET_LINK_LIBRARIES(${PROJECT_NAME}-dynamic Delayimp )
-				SET_TARGET_PROPERTIES(${PROJECT_NAME}-dynamic PROPERTIES LINK_FLAGS "/DELAYLOAD:libeng.dll /DELAYLOAD:libmx.dll /DELAYLOAD:libmex.dll")
+				SET_TARGET_PROPERTIES(${PROJECT_NAME}-dynamic PROPERTIES LINK_FLAGS "/DELAYLOAD:libeng.dll /DELAYLOAD:libmx.dll")
+				# /DELAYLOAD:libmex.dll /DELAYLOAD:mclmcrrt.dll --> useless, no import
 			ENDIF(WIN32)
 			SET(Matlab_FOUND TRUE)
 		ELSE(Matlab_INCLUDE)


Add proper binary deps to tests

Add proper binary deps to tests

--- test/test_driver.cmake
+++ test/test_driver.cmake
@@ -42,10 +42,12 @@
         COMMENT "Running ${test_target} ..." VERBATIM
     )
     foreach(bin_dep ${TEST_TARGET_BIN_DEPS})
-        # TODO: Maybe replace by a custom command that
-        # invokes make directly, to ensure all dependcies
-        # are actually build
-        add_dependencies(${test_target} ${bin_dep})
+        add_custom_command(
+            TARGET ${test_target}
+            PRE_BUILD
+            COMMAND cmake --build . --target ${bin_dep}
+            WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
+        )
     endforeach(bin_dep)
 endmacro()


fix missing OpenMP link flag

fix missing OpenMP link flag

--- alpakaConfig.cmake
+++ alpakaConfig.cmake
@@ -190,13 +190,12 @@

     ELSE()
         SET(_ALPAKA_COMPILE_OPTIONS_PUBLIC ${OpenMP_CXX_FLAGS})
+        IF(NOT MSVC)
+            SET(_ALPAKA_LINK_FLAGS_PUBLIC ${OpenMP_CXX_FLAGS})
+        ENDIF()
         # CUDA requires some special handling
         IF(ALPAKA_ACC_GPU_CUDA_ENABLE)
             SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
-        ELSE()
-            IF(NOT MSVC)
-                SET(_ALPAKA_LINK_FLAGS_PUBLIC ${OpenMP_CXX_FLAGS})
-            ENDIF()
         ENDIF()
     ENDIF()
 ENDIF()
@@ -458,8 +457,8 @@
 SET(alpaka_INCLUDE_DIR ${_ALPAKA_INCLUDE_DIRECTORY})
 SET(alpaka_INCLUDE_DIRS ${_ALPAKA_INCLUDE_DIRECTORIES_PUBLIC})
 SET(alpaka_LIBRARY ${_ALPAKA_LINK_LIBRARY})
-SET(alpaka_LIBRARIES ${_ALPAKA_LINK_LIBRARIES_PUBLIC})
-LIST(APPEND alpaka_LIBRARIES ${_ALPAKA_LINK_FLAGS_PUBLIC})
+SET(alpaka_LIBRARIES ${_ALPAKA_LINK_FLAGS_PUBLIC})
+LIST(APPEND alpaka_LIBRARIES ${_ALPAKA_LINK_LIBRARIES_PUBLIC})

 #-------------------------------------------------------------------------------
 # Print the return values.


Goodbye NSIS, onwards to MSI/WIX

Goodbye NSIS, onwards to MSI/WIX

--- projects/win32/tomviz.bundle.cmake
+++ projects/win32/tomviz.bundle.cmake
@@ -56,11 +56,6 @@
         ${CMAKE_CPACK_COMMAND} -G WIX
         WORKING_DIRECTORY ${Superbuild_BINARY_DIR})

-# Build NSIS package
-add_test(GenerateTomvizPackage-NSIS
-        ${CMAKE_CPACK_COMMAND} -G NSIS
-        WORKING_DIRECTORY ${Superbuild_BINARY_DIR})
-
 # Build zip
 add_test(GenerateTomvizPackage-ZIP
         ${CMAKE_CPACK_COMMAND} -G ZIP


Subproject message cosmetics

Subproject message cosmetics

--- SubProject.cmake
+++ SubProject.cmake
@@ -64,10 +64,11 @@

     # add the source sub directory to our build and set the binary dir
     # to the build tree
-    message("========== ${path} ==========")
+    set(ADD_SUBPROJECT_INDENT "${ADD_SUBPROJECT_INDENT}   ")
+    message("${ADD_SUBPROJECT_INDENT}========== ${path} ==========")
     add_subdirectory("${CMAKE_SOURCE_DIR}/${path}"
       "${CMAKE_BINARY_DIR}/${name}")
-    message("----------------------------")
+    message("${ADD_SUBPROJECT_INDENT}---------- ${path} ----------")
     set(${name}_IS_SUBPROJECT ON PARENT_SCOPE)
   endif()
 endfunction()


Use add_custom_target() instead of ExternalProject_Add() for CTK.

This reduces complexity while having the same effect.

--- SuperBuild.cmake
+++ SuperBuild.cmake
@@ -263,32 +263,16 @@
 #
 #MESSAGE(STATUS SUPERBUILD_EXCLUDE_CTKBUILD_TARGET:${SUPERBUILD_EXCLUDE_CTKBUILD_TARGET})
 IF(NOT DEFINED SUPERBUILD_EXCLUDE_CTKBUILD_TARGET OR NOT SUPERBUILD_EXCLUDE_CTKBUILD_TARGET)
-  SET(proj CTK-build)
-  # Note: Setting CONFIGURE_COMMAND to an empty command is not enough to skip configuration step,
-  #       the BUILD_COMMAND should also be specified explicitly otherwise it will in-conditionally
-  #       default to 'make' on all platform.
-  #       See _ep_get_configure_command_id and _ep_get_build_command in ExternalProject.cmake
-  ExternalProject_Add(${proj}
-    DOWNLOAD_COMMAND ""
-    CONFIGURE_COMMAND ""
-    CMAKE_GENERATOR ${gen}
-    BUILD_COMMAND ${CMAKE_COMMAND} --build ${CTK_BINARY_DIR}/CTK-build --config ${CMAKE_CFG_INTDIR}
-    SOURCE_DIR ${CTK_SOURCE_DIR}
-    BINARY_DIR CTK-build
-    INSTALL_COMMAND ""
-    DEPENDS
-      "CTK-Configure"
-    )
-  # This custom external project step forces the build and later
-  # steps to run whenever a top level build is done...
-  ExternalProject_Add_Step(${proj} forcebuild
-    COMMAND ${CMAKE_COMMAND} -E echo_append ""
-    COMMENT "Forcing build step for '${proj}'"
-    DEPENDEES configure
-    DEPENDERS build
-    ALWAYS 1
-    )
+  SET(CTKBUILD_TARGET_ALL_OPTION "ALL")
+ELSE()
+  SET(CTKBUILD_TARGET_ALL_OPTION "")
 ENDIF()
+
+ADD_CUSTOM_TARGET(CTK-build ${CTKBUILD_TARGET_ALL_OPTION}
+  COMMAND ${CMAKE_COMMAND} --build ${CTK_BINARY_DIR}/CTK-build --config ${CMAKE_CFG_INTDIR}
+  WORKING_DIRECTORY ${CTK_BINARY_DIR}/CTK-build
+  DEPENDS CTK-Configure
+  )

 #-----------------------------------------------------------------------------
 # Custom target allowing to drive the build of CTK project itself


Run tests from SIRF

Run tests from SIRF

Calls ctest from the SIRF directory, therefore it executes SIRF's tests as
if it were SIRF. Duplicate tests are removed.

--- SuperBuild.cmake
+++ SuperBuild.cmake
@@ -97,13 +97,6 @@

 # add tests
 enable_testing()
-include(FindPythonInterp)
-add_test(NAME MR_FULLY_SAMPLED
-         COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/SIRF/src/xGadgetron/pGadgetron/tests/fully_sampled.py)
+add_test(NAME SIRF_TESTS
+	 COMMAND ${CMAKE_CTEST_COMMAND} test WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/SIRF)

-add_test(NAME MR_UNDER_SAMPLED
-         COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/SIRF/src/xGadgetron/pGadgetron/tests/undersampled.py)
-
-add_test(NAME PET_TEST1
-         COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/SIRF/src/xSTIR/pSTIR/tests/test1.py )
-


VFS-8828 Updated boost python cmake script

--- cmake/FindPython3.cmake
+++ cmake/FindPython3.cmake
@@ -68,7 +68,7 @@
     message(STATUS "Python3 libboost-python: ${LIBBOOST_PYTHON3}")
     message(STATUS "Python3 site directory: ${PYTHON3_SITE_DIR}")
 else(PYTHON3_CONFIG)
-    set(_PYTHON3_VERSIONS 3.7 3.6 3.5)
+    set(_PYTHON3_VERSIONS 3.9 3.8 3.7 3.6 3.5)
     foreach(_PYTHON3_VERSION ${_PYTHON3_VERSIONS})
         execute_process(COMMAND pkg-config --cflags "python-${_PYTHON3_VERSION}" RESULT_VARIABLE RETCODE)
         if("${RETCODE}" STREQUAL "0")


Fix SOURCE_DIR in HandleGTest.cmake (#703)

* Fix SOURCE_DIR in HandleGTest.cmake

If benchmark added as cmake subproject, HandleGTest throws an error as  does return absolute source dir.
Change it to , so it will be refering to it's own source dir.

--- cmake/HandleGTest.cmake
+++ cmake/HandleGTest.cmake
@@ -75,27 +75,34 @@
   endforeach()
 endmacro(build_external_gtest)

+macro(build_gtest_from_dir)
+  set(INSTALL_GTEST OFF CACHE INTERNAL "")
+  set(INSTALL_GMOCK OFF CACHE INTERNAL "")
+  add_subdirectory(${GTEST_ROOT} build)
+  set(GTEST_BOTH_LIBRARIES gtest gmock gmock_main)
+  foreach(HEADER test mock)
+    # CMake 2.8 and older don't respect INTERFACE_INCLUDE_DIRECTORIES, so we
+    # have to add the paths ourselves.
+    set(HFILE g${HEADER}/g${HEADER}.h)
+    set(HPATH ${GTEST_ROOT}/google${HEADER}/include)
+    find_path(HEADER_PATH_${HEADER} ${HFILE}
+            NO_DEFAULT_PATHS
+            HINTS ${HPATH}
+            )
+    if (NOT HEADER_PATH_${HEADER})
+      message(FATAL_ERROR "Failed to find header ${HFILE} in ${HPATH}")
+    endif()
+    list(APPEND GTEST_INCLUDE_DIRS ${HEADER_PATH_${HEADER}})
+  endforeach()
+endmacro()
+
 if (BENCHMARK_ENABLE_GTEST_TESTS)
   if (IS_DIRECTORY ${CMAKE_SOURCE_DIR}/googletest)
     set(GTEST_ROOT "${CMAKE_SOURCE_DIR}/googletest")
-    set(INSTALL_GTEST OFF CACHE INTERNAL "")
-    set(INSTALL_GMOCK OFF CACHE INTERNAL "")
-    add_subdirectory(${CMAKE_SOURCE_DIR}/googletest)
-    set(GTEST_BOTH_LIBRARIES gtest gmock gmock_main)
-    foreach(HEADER test mock)
-      # CMake 2.8 and older don't respect INTERFACE_INCLUDE_DIRECTORIES, so we
-      # have to add the paths ourselves.
-      set(HFILE g${HEADER}/g${HEADER}.h)
-      set(HPATH ${GTEST_ROOT}/google${HEADER}/include)
-      find_path(HEADER_PATH_${HEADER} ${HFILE}
-          NO_DEFAULT_PATHS
-          HINTS ${HPATH}
-      )
-      if (NOT HEADER_PATH_${HEADER})
-        message(FATAL_ERROR "Failed to find header ${HFILE} in ${HPATH}")
-      endif()
-      list(APPEND GTEST_INCLUDE_DIRS ${HEADER_PATH_${HEADER}})
-    endforeach()
+    build_gtest_from_dir()
+  elseif (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/googletest)
+    set(GTEST_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/googletest")
+    build_gtest_from_dir()
   elseif(BENCHMARK_DOWNLOAD_DEPENDENCIES)
     build_external_gtest()
   else()


pkg-config: modules list contains only OpenCV modules (fixes #5852)

--- cmake/OpenCVUtils.cmake
+++ cmake/OpenCVUtils.cmake
@@ -806,7 +806,13 @@
     else()
       set(deps "")
     endif()
-    list(INSERT ${_modules} 0 ${deps} ${m})
+    set(_rev_deps "${deps};${m}")
+    ocv_list_reverse(_rev_deps)
+    foreach (dep ${_rev_deps})
+      if(DEFINED OPENCV_MODULE_${dep}_LOCATION)
+        list(INSERT ${_modules} 0 ${dep})
+      endif()
+    endforeach()
     foreach (dep ${deps} ${OPENCV_LINKER_LIBS})
       if (NOT DEFINED OPENCV_MODULE_${dep}_LOCATION)
         if (TARGET ${dep})
@@ -832,9 +838,6 @@
     endif()
   endif()

-  # split 3rdparty libs and modules
-  list(REMOVE_ITEM ${_modules} ${${_3rdparty}} ${${_extra}} non_empty_list)
-
   ocv_list_filterout(${_modules} "^[\$]<")
   ocv_list_filterout(${_3rdparty} "^[\$]<")
   ocv_list_filterout(${_extra} "^[\$]<")


Fix: cmake-2.8.4 doesn't like add_test without explicit arguments names

git-svn-id: e7ea667a1d39a4453c4efcc4ba7bca3d620c3f19@700 a9d63959-f2ad-4865-b262-bf0e56cfafb6

--- cmake/pcl_targets.cmake
+++ cmake/pcl_targets.cmake
@@ -90,7 +90,7 @@
     set_target_properties(${_name} PROPERTIES
         VERSION ${PCL_VERSION}
         SOVERSION ${PCL_MAJOR_VERSION}
-				DEFINE_SYMBOL "PCLAPI_EXPORTS")
+        DEFINE_SYMBOL "PCLAPI_EXPORTS")
     install(TARGETS ${_name} LIBRARY DESTINATION ${LIB_INSTALL_DIR}
         ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
         COMPONENT ${_component})
@@ -146,7 +146,12 @@
     #
     target_link_libraries(${_exename} ${GTEST_BOTH_LIBRARIES} ${PCL_ADD_TEST_LINK_WITH})
     PCL_LINK_OPENMP(${_exename})
-  	add_test(${_name} ${_exename} ${PCL_ADD_TEST_ARGUMENTS})
+
+    if(${CMAKE_VERSION} VERSION_LESS 2.8.4)
+      add_test(${_name} ${_exename} ${PCL_ADD_TEST_ARGUMENTS})
+    else(${CMAKE_VERSION} VERSION_LESS 2.8.4)
+      add_test(NAME ${_name} COMMAND ${_exename} ${PCL_ADD_TEST_ARGUMENTS})
+    endif(${CMAKE_VERSION} VERSION_LESS 2.8.4)
 endmacro(PCL_ADD_TEST)


[cmake] Remove old unused version of FindZ3.cmake from clang [NFC]

Summary: This file was moved to llvm in D54978, r356929, but the old
file was never removed.

Reviewed By: beanz

Tags: #clang

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

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


always build float-version of FFTW

always build float-version of FFTW

--- libfftw.cmake
+++ libfftw.cmake
@@ -26,7 +26,7 @@
     CONFIGURE_COMMAND   ${BUILDEM_ENV_STRING} ${libfftw_SRC_DIR}/configure
         --prefix=${BUILDEM_DIR}
         --enable-shared
-#        --enable-float  # This creates libfftw3f single-precision libraries
+        --enable-float  # This creates libfftw3f single-precision libraries
         LDFLAGS=${BUILDEM_LDFLAGS}
         CPPFLAGS=-I${BUILDEM_DIR}/include
     BUILD_COMMAND       ${BUILDEM_ENV_STRING} make
@@ -35,4 +35,4 @@

 set_target_properties(${libfftw_NAME} PROPERTIES EXCLUDE_FROM_ALL ON)

-endif (NOT libfftw_NAME)+endif (NOT libfftw_NAME)


Fix tsan and asan under clang too

Fix tsan and asan under clang too

--- tools/cmake/SpecialtyBuilds.cmake
+++ tools/cmake/SpecialtyBuilds.cmake
@@ -43,7 +43,7 @@
         message(FATAL_ERROR
                 "The Address Sanitizer is not yet supported on Visual Studio builds")
     else()
-        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointern -O1 -g")
+        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -O1 -g")
         set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
     endif()
 endif()
@@ -57,8 +57,13 @@
         message(FATAL_ERROR
                 "The Thread Sanitizer is not yet supported on Visual Studio builds")
     else()
-        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread -fno-omit-frame-pointer -O2 -g -fPIE -pie")
+        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread -fno-omit-frame-pointer -O2 -g -fPIE")
         set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=thread")
+        # According to the clang docs, if -fsanitize=thread is specified then compiling
+        # and linking with PIE is turned on automatically.
+        if (CMAKE_COMPILER_IS_GNUXX)
+            set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
+        endif()
     endif()
 endif()


Fix backward compatibility issue finding the clockwork library

--- cmake/Modules/FindClockworkClient.cmake
+++ cmake/Modules/FindClockworkClient.cmake
@@ -3,7 +3,7 @@
 find_library(
 	ClockworkClient_LIBRARY
 	PATHS /opt/latproc/iod/stage/lib /opt/latproc/iod/build
-	NAMES cw_client
+	NAMES cw_client Clockwork
 )

 find_path(


One other fixup for the http://macada.org/ version of the GNAT compiler.

svn path=/trunk/; revision=7425

--- cmake/modules/CMakeAdaInformation.cmake
+++ cmake/modules/CMakeAdaInformation.cmake
@@ -120,8 +120,17 @@

 # create an Ada shared library
 IF(NOT CMAKE_Ada_CREATE_SHARED_LIBRARY)
-  SET(CMAKE_Ada_CREATE_SHARED_LIBRARY
-      "${GNAT_SHARED_LINKER} <CMAKE_SHARED_LIBRARY_Ada_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_Ada_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_Ada_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
+  IF(APPLE)
+    # Temporary fixup for one user's Ada/Mac OS X problems when using the
+    # the 4.2 version of the http://macada.org/ version of the GNAT compiler.
+    SET(CMAKE_Ada_CREATE_SHARED_LIBRARY
+    "${GNAT_SHARED_LINKER} <CMAKE_SHARED_LIBRARY_Ada_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_Ada_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_Ada_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES> -lgcc_s.1"
+    )
+  ELSE(APPLE)
+    SET(CMAKE_Ada_CREATE_SHARED_LIBRARY
+    "${GNAT_SHARED_LINKER} <CMAKE_SHARED_LIBRARY_Ada_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_Ada_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_Ada_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>"
+    )
+  ENDIF(APPLE)
 ENDIF(NOT CMAKE_Ada_CREATE_SHARED_LIBRARY)

 # create an Ada shared module just copy the shared library rule


Update lib-cpp-pre SHA1sum as we updated it to fix windows compile issues.

--- cmake/projects/lib-cpp-pre/hunter.cmake
+++ cmake/projects/lib-cpp-pre/hunter.cmake
@@ -19,7 +19,7 @@
     PACKAGE_NAME lib-cpp-pre
     VERSION "1.3.2"
     URL "https://github.com/daminetreg/lib-cpp-pre/archive/v1.3.2.tar.gz"
-    SHA1 9f7e2e388cfb2ff2aaccd9c1f4c10ba53ffbbf49
+    SHA1 fef5d597594a62f25bc4ae71608d1f0d70f24a56
 )

 hunter_pick_scheme(DEFAULT url_sha1_cmake)


boards: arc: hsdk: Convert to CONFIG_MP_MAX_NUM_CPUS

Convert CONFIG_MP_NUM_CPUS to CONFIG_MP_MAX_NUM_CPUS as we work on
phasing out CONFIG_MP_NUM_CPUS.

Signed-off-by: Kumar Gala <a5e5248af4cd4f0ed8c515f61d40a6e2db46a66e@intel.com>

--- boards/arc/hsdk/board.cmake
+++ boards/arc/hsdk/board.cmake
@@ -1,10 +1,10 @@
 # SPDX-License-Identifier: Apache-2.0
 board_runner_args(openocd "--use-elf")

-if(${CONFIG_MP_NUM_CPUS} EQUAL 2)
+if(${CONFIG_MP_MAX_NUM_CPUS} EQUAL 2)
 board_runner_args(openocd "--config=${CMAKE_CURRENT_LIST_DIR}/support/openocd-2-cores.cfg")
 endif()

-board_runner_args(mdb-hw "--jtag=digilent" "--cores=${CONFIG_MP_NUM_CPUS}")
+board_runner_args(mdb-hw "--jtag=digilent" "--cores=${CONFIG_MP_MAX_NUM_CPUS}")
 include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
 include(${ZEPHYR_BASE}/boards/common/mdb-hw.board.cmake)


Update Hunter

Update Hunter

--- common.cmake
+++ common.cmake
@@ -6,6 +6,6 @@
 include("${CMAKE_CURRENT_LIST_DIR}/cmake/HunterGate.cmake")

 HunterGate(
-    URL "https://github.com/ruslo/hunter/archive/v0.17.7.tar.gz"
-    SHA1 "78219f42c3737adcc161c52b9f71ce65a3d775c2"
+    URL "https://github.com/ruslo/hunter/archive/v0.17.9.tar.gz"
+    SHA1 "83aedab25adebc6c5ee9f8fa4618403d41fef275"
 )


ARROW-2745: [C++] ORC ExternalProject needs to declare dependency on vendored protobuf

We need these dependencies as we otherwise get race conditions in the build.

cc @msarahan @kszucs

Author: Korn, Uwe <Uwe.Korn@blue-yonder.com>

Closes #2169 from xhochy/ARROW-2745 and squashes the following commits:

eec45ace <Korn, Uwe> ARROW-2745:  ORC ExternalProject needs to declare dependency on vendored protobuf

--- cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -1056,12 +1056,22 @@
       CMAKE_ARGS ${ORC_CMAKE_ARGS}
       ${EP_LOG_OPTIONS})

-    set (ORC_VENDORED 1)
-  else ()
+    set(ORC_VENDORED 1)
+    add_dependencies(orc_ep zlib)
+    if (LZ4_VENDORED)
+      add_dependencies(orc_ep lz4_static)
+    endif()
+    if (SNAPPY_VENDORED)
+      add_dependencies(orc_ep snappy)
+    endif()
+    if (PROTOBUF_VENDORED)
+      add_dependencies(orc_ep protobuf_ep)
+    endif()
+  else()
      set(ORC_INCLUDE_DIR "${ORC_HOME}/include")
      set(ORC_STATIC_LIB "${ORC_HOME}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}orc${CMAKE_STATIC_LIBRARY_SUFFIX}")
-     set (ORC_VENDORED 0)
-  endif ()
+     set(ORC_VENDORED 0)
+  endif()

   include_directories(SYSTEM ${ORC_INCLUDE_DIR})
   ADD_THIRDPARTY_LIB(orc
@@ -1069,7 +1079,6 @@

   if (ORC_VENDORED)
     add_dependencies(orc orc_ep)
-  endif ()
-
-  add_dependencies(orc lz4_static snappy zlib)
-endif()
+  endif()
+
+endif()


ARROW-15851: [C++] Enable RE2 when building with gRPC

This fixes a build issue with some CMake presets.

Closes #12637 from lidavidm/arrow-15851

Authored-by: David Li <dc24f9cfc84fb1675ce65c8444a2c3e2f0e5f297@gmail.com>
Signed-off-by: David Li <dc24f9cfc84fb1675ce65c8444a2c3e2f0e5f297@gmail.com>

--- cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -303,6 +303,7 @@
 endif()

 if(ARROW_WITH_GRPC)
+  set(ARROW_WITH_RE2 ON)
   set(ARROW_WITH_ZLIB ON)
 endif()


ENH: specify binary dtesting dir

ENH: specify binary dtesting dir

--- Testing/Dashboard/pxDashboard_LKEB_win7-64_VS2010.cmake
+++ Testing/Dashboard/pxDashboard_LKEB_win7-64_VS2010.cmake
@@ -21,6 +21,7 @@
 set( CTEST_BUILD_CONFIGURATION Release )
 set( CTEST_CMAKE_GENERATOR "Visual Studio 10 2010 Win64" )
 set( CTEST_DASHBOARD_ROOT "D:/toolkits/ITKTools/nightly" )
+set( CTEST_BINARY_DIRECTORY "D:/toolkits/ITKTools/nightly/bin_VS2010" )

 # Specify the kind of dashboard to submit
 # default: Nightly


Recognize caching when searching for python packages

--- scripts/PythonPackage.cmake
+++ scripts/PythonPackage.cmake
@@ -28,6 +28,10 @@

 function(find_python_package PACKAGE)
     string(TOUPPER "${PACKAGE}" PACKAGE_UPPER)
+    if(${PACKAGE_UPPER}_FOUND)
+      set(${PACKAGE}_FOUND ${${PACKAGE_UPPER}_FOUND} PARENT_SCOPE)
+      return()
+    endif()
     cmake_parse_arguments(${PACKAGE}_FIND
         "REQUIRED;EXACT" "VERSION" "" ${ARGN})
     cmake_parse_arguments(PYPACK
@@ -77,10 +81,14 @@
     if(NOT "${PACKAGE}" STREQUAL "${PACKAGE_UPPER}")
         set(${PACKAGE}_FOUND ${${PACKAGE_UPPER}_FOUND} PARENT_SCOPE)
     endif()
+    set(${PACKAGE_UPPER}_FOUND "${${PACKAGE_UPPER}_FOUND}" CACHE INTERNAL "")
     if(${PACKAGE_UPPER}_FOUND)
-        set(${PACKAGE}_LOCATION "${${PACKAGE}_LOCATION}" PARENT_SCOPE)
-        set(${PACKAGE}_VERSION_STRING "${string_version}" PARENT_SCOPE)
+        set(${PACKAGE}_LOCATION "${${PACKAGE}_LOCATION}"
+            CACHE PATH "Location of ${PACKAGE}")
+        set(${PACKAGE}_VERSION_STRING "${string_version}"
+            CACHE STRING "Version of ${PACKAGE}")
     else()
-        set(${PACKAGE}_LOCATION "${PACKAGE}_LOCATION-NOTFOUND" PARENT_SCOPE)
+        set(${PACKAGE}_LOCATION "${${PACKAGE}_LOCATION}"
+            CACHE PATH "Location of ${PACKAGE}")
     endif()
 endfunction()


fixed: hunter-archive url; curl in travis-ci container has https support disabled

--- share/hugh/cmake/SetupHunter.cmake
+++ share/hugh/cmake/SetupHunter.cmake
@@ -18,6 +18,6 @@
   set(HUNTER_STATUS_DEBUG)
 endif()

-HunterGate(URL  "https://github.com/ruslo/hunter/archive/v0.14.1.tar.gz"
+HunterGate(URL  "http://github.com/ruslo/hunter/archive/v0.14.1.tar.gz"
            SHA1 "d073cc04d59a01782385799568afce78066a8cec")


reversed m_curl

reversed m_curl

--- cmake/EthDependencies.cmake
+++ cmake/EthDependencies.cmake
@@ -109,11 +109,11 @@
 	message(" - gmp lib   : ${GMP_LIBRARIES}")
 endif()

-# m_curl is only requried for tests
-# TODO specify min m_curl version, on windows we are currently using 7.29
+# curl is only requried for tests
+# TODO specify min curl version, on windows we are currently using 7.29
 find_package (CURL)
-message(" - m_curl header: ${CURL_INCLUDE_DIRS}")
-message(" - m_curl lib   : ${CURL_LIBRARIES}")
+message(" - curl header: ${CURL_INCLUDE_DIRS}")
+message(" - curl lib   : ${CURL_LIBRARIES}")

 # cpuid required for eth
 find_package (Cpuid)


Do not set SystemC_INCLUDE_DIR if already defined by conan

--- cmake/FindOSCISystemC.cmake
+++ cmake/FindOSCISystemC.cmake
@@ -85,7 +85,6 @@
   ${CONAN_INCLUDE_DIRS_SYSTEMC}
   ${CONAN_LIB_DIRS_SYSTEMC}
   ${SystemC_LIB_DIRS}
-  ${SystemC_INCLUDE_DIR}
   ${_COMMON_HINTS}
   )

@@ -142,11 +141,13 @@
   /usr/local/lib-macos
   )

-FIND_PATH(SystemC_INCLUDE_DIR
-  NAMES systemc
-  HINTS ${_SYSTEMC_HINTS}
-  PATHS ${_COMMON_PATHS}
-)
+if (NOT SystemC_INCLUDE_DIR)
+  FIND_PATH(SystemC_INCLUDE_DIR
+    NAMES systemc
+    HINTS ${_SYSTEMC_HINTS}
+    PATHS ${_COMMON_PATHS}
+  )
+endif()

 FIND_LIBRARY(SystemC_LIBRARY
   NAMES systemc


fix out-of-date FindTAO to print status, not error out, when TAO is not found. Relates to commit r305 in irg_cmake repo

--- cmake/Modules/FindTAO.cmake
+++ cmake/Modules/FindTAO.cmake
@@ -158,7 +158,7 @@

 else( TAO_INCLUDE_DIR AND TAO_LIBRARY_DIR AND TAO_IDL_COMMAND )

-  message( SEND_ERROR  "  TAO root and/or TAO IDL compiler were not found.")
+  message( STATUS  "  TAO root and/or TAO IDL compiler were not found.")

 endif( TAO_INCLUDE_DIR AND TAO_LIBRARY_DIR AND TAO_IDL_COMMAND )


KNL Fixes to CDash

KNL Fixes to CDash

- IMF searching
- CMAKE_PREFIX_PATH usage

--- cmake/Modules/Testing.cmake
+++ cmake/Modules/Testing.cmake
@@ -36,7 +36,7 @@
 ## -- USE_<PROJECT> and <PROJECT>_ROOT
 set(CMAKE_CONFIGURE_OPTIONS )
 foreach(_OPTION ARCH BLAS ELEMENTAL LAPACK OPENMP
-    PYTHON_INCLUDE_DIR SSE TBB TIMERS WCSLIB FFTW MATH MKL)
+    PYTHON_INCLUDE_DIR SSE TBB TIMERS WCSLIB FFTW MATH MKL IMF)
     add(CMAKE_CONFIGURE_OPTIONS "-DUSE_${_OPTION}=${USE_${_OPTION}}")
     if(NOT "${${_OPTION}_ROOT}" STREQUAL "")
         add(CMAKE_CONFIGURE_OPTIONS "-D${_OPTION}_ROOT=${${_OPTION}_ROOT}")
@@ -47,6 +47,10 @@
         add(CMAKE_CONFIGURE_OPTIONS "-D${C_OPTION}_ROOT=${${C_OPTION}_ROOT}")
     endif(NOT "${${C_OPTION}_ROOT}" STREQUAL "")
 endforeach()
+# add CMAKE_PREFIX_PATH
+if(NOT "${CMAKE_PREFIX_PATH}" STREQUAL "")
+    add(CMAKE_CONFIGURE_OPTIONS "-DCMAKE_PREFIX_PATH=\"${CMAKE_PREFIX_PATH}\"")
+endif(NOT "${CMAKE_PREFIX_PATH}" STREQUAL "")

 execute_process(COMMAND git branch --contains
     OUTPUT_VARIABLE CMAKE_SOURCE_BRANCH


Debian packages header update to fix conflict with OpenCV from deb repo.

--- cmake/OpenCVPackaging.cmake
+++ cmake/OpenCVPackaging.cmake
@@ -112,6 +112,35 @@
   endif()
 endif()

+set(STD_OPENCV_LIBS opencv-data libopencv-calib3d2.4 libopencv-contrib2.4 libopencv-core2.4
+    libopencv-features2d2.4 libopencv-flann2.4 libopencv-gpu2.4 libopencv-imgproc2.4
+    libopencv-ml2.4 libopencv-ocl2.4 libopencv-stitching2.4 libopencv-ts2.4 libopencv-videostab2.4)
+
+set(STD_OPENCV_DEV libopencv-calib3d-dev libopencv-contrib-dev libopencv-core-dev
+    libopencv-dev libopencv-features2d-dev libopencv-flann-dev libopencv-gpu-dev
+    libopencv-highgui-dev libopencv-imgproc-dev libopencv-legacy-dev libopencv-ml-dev
+    libopencv-objdetect-dev libopencv-ocl-dev libopencv-photo-dev libopencv-stitching-dev
+    libopencv-superres-dev libopencv-ts-dev libopencv-video-dev libopencv-videostab-dev)
+
+string(REPLACE ";" ", " CPACK_COMPONENT_LIBS_CONFLICTS "${STD_OPENCV_LIBS}")
+string(REPLACE ";" ", " CPACK_COMPONENT_LIBS_PROVIDES "${STD_OPENCV_LIBS}")
+string(REPLACE ";" ", " CPACK_COMPONENT_LIBS_REPLACES "${STD_OPENCV_LIBS}")
+
+string(REPLACE ";" ", " CPACK_COMPONENT_DEV_CONFLICTS "${STD_OPENCV_DEV}")
+string(REPLACE ";" ", " CPACK_COMPONENT_DEV_PROVIDES "${STD_OPENCV_DEV}")
+string(REPLACE ";" ", " CPACK_COMPONENT_DEV_REPLACES "${STD_OPENCV_DEV}")
+
+set(CPACK_COMPONENT_PYTHON_CONFLICTS python-opencv)
+set(CPACK_COMPONENT_PYTHON_PROVIDES python-opencv)
+set(CPACK_COMPONENT_PYTHON_REPLACES python-opencv)
+
+set(CPACK_COMPONENT_JAVA_CONFLICTS "libopencv2.4-java, libopencv2.4-jni")
+set(CPACK_COMPONENT_JAVA_PROVIDES "libopencv2.4-java, libopencv2.4-jni")
+set(CPACK_COMPONENT_JAVA_REPLACES "libopencv2.4-java, libopencv2.4-jni")
+
+set(CPACK_COMPONENT_DOCS_CONFLICTS opencv-doc)
+set(CPACK_COMPONENT_SAMPLES_CONFLICTS opencv-doc)
+
 if(NOT OPENCV_CUSTOM_PACKAGE_INFO)
   set(CPACK_COMPONENT_LIBS_DESCRIPTION "Open Computer Vision Library")
   set(CPACK_DEBIAN_COMPONENT_LIBS_NAME "libopencv")