Only use cmake_link_flags macro for X link flags since pkg_check_pkgconfig
now calls this macro automatically for link_flags delivered by pkg-config.

svn path=/trunk/; revision=8178

--- cmake/modules/cairo.cmake
+++ cmake/modules/cairo.cmake
@@ -83,42 +83,52 @@
 OR PLD_xcairo
 )
   pkg_check_pkgconfig(
-  "pangocairo"
+  pangocairo
   includedir
-  cairo_RPATH
+  linkdir
   linkflags
   cflags
   _CAIRO
   )
   if(linkflags)
-    # Blank-delimited required.
+    set(cairo_RPATH ${linkdir})
     if(PLD_xcairo AND X11_COMPILE_FLAGS)
+      # Blank-delimited required.
       string(REGEX REPLACE ";" " "
       cairo_COMPILE_FLAGS "${cflags} ${X11_COMPILE_FLAGS}"
       )
-      cmake_link_flags(cairo_LINK_FLAGS "${linkflags} -L${X11_LIBRARY_DIR} ${X11_LIBRARIES}")
+      # Convert X linker information to preferred CMake form before appending
+      # it to already converted ${linkflags}
+      cmake_link_flags(
+      cairo_X_LINK_FLAGS
+      "-L${X11_LIBRARY_DIR};${X11_LIBRARIES}"
+      )
+      set(cairo_LINK_FLAGS ${linkflags} ${cairo_X_LINK_FLAGS})
     else(PLD_xcairo AND X11_COMPILE_FLAGS)
       message(STATUS
        "WARNING: X windows not found. Setting xcairo driver to OFF."
       )
+      # Blank-delimited required.
       set(PLD_xcairo OFF CACHE BOOL "Enable xcairo device" FORCE)
       # now deal with remaining cairo devices.
       string(REGEX REPLACE ";" " " cairo_COMPILE_FLAGS "${cflags}")
-      cmake_link_flags(cairo_LINK_FLAGS "${linkflags}")
+      set(cairo_LINK_FLAGS ${linkflags})
     endif(PLD_xcairo AND X11_COMPILE_FLAGS)

-    # message("cairo_COMPILE_FLAGS = ${cairo_COMPILE_FLAGS}")
+    #message("cairo_COMPILE_FLAGS = ${cairo_COMPILE_FLAGS}")
+    #message("cairo_LINK_FLAGS = ${cairo_LINK_FLAGS}")

     list(APPEND DRIVERS_LINK_FLAGS ${cairo_LINK_FLAGS})
   else(linkflags)
-    #message("includedir = ${includedir}")
-    #message("libdir = ${libdir}")
-    #message("linkflags = ${linkflags}")
-    #message("cflags = ${cflags}")
+    message("includedir = ${includedir}")
+    message("libdir = ${libdir}")
+    message("linkflags = ${linkflags}")
+    message("cflags = ${cflags}")
     message(STATUS
-       "WARNING: pango or cairo not found with pkg-config.\n"
-    "   Setting cairo drivers to OFF.  Please install all of these packages\n"
-    "   and/or set the environment variable PKG_CONFIG_PATH appropriately."
+       "WARNING: pango and/or cairo not found with pkg-config.\n"
+    "   Disabling cairo drivers.  To enable these drivers you must install\n"
+    "   development versions of pango and cairo and/or set\n"
+    "   the environment variable PKG_CONFIG_PATH appropriately."
     )
     set(PLD_memcairo OFF CACHE BOOL "Enable memcairo device" FORCE)
     set(PLD_pdfcairo OFF CACHE BOOL "Enable pdfcairo device" FORCE)


Forward the GENERATING_FILE option in create_simple_library too

--- CMakeUnit.cmake
+++ CMakeUnit.cmake
@@ -651,6 +651,7 @@
     set (CREATE_SIMPLE_LIBRARY_OPTION_ARGS
          ${_CMAKE_UNIT_SOURCE_FILE_OPTION_ARGS})
     set (CREATE_SIMPLE_LIBRARY_SINGLEVAR_ARGS
+         GENERATING_FILE
          ${_CMAKE_UNIT_SOURCE_FILE_SINGLEVAR_ARGS})
     set (CREATE_SIMPLE_LIBRARY_MULTIVAR_ARGS
          ${_CMAKE_UNIT_SOURCE_FILE_MULTIVAR_ARGS})


fptu-cmake: fix testing dll-crutch for Windows.

--- cmake.fptu/testing.cmake
+++ cmake.fptu/testing.cmake
@@ -183,7 +183,7 @@
       string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UPPERCASE)
       foreach(dep IN LISTS params_LIBRARY GTEST_BOTH_LIBRARIES)
         get_target_property(type ${dep} TYPE)
-        if(NOT ${type} STREQUAL "STATIC_LIBRARY")
+        if(${type} STREQUAL "SHARED_LIBRARY")
           # Windows don't have RPATH feature,
           # therefore we should prepare PATH or copy DLL(s)...
           if(CMAKE_CONFIGURATION_TYPES)


Fix boost being overriden

Fix boost being overriden

--- cmake/Dependencies.cmake
+++ cmake/Dependencies.cmake
@@ -65,12 +65,14 @@

 find_package(Boost
   COMPONENTS python${PYTHON_VERSION_MAJOR})
-find_package(Boost
-  COMPONENTS python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR})
-find_package(Boost
-  COMPONENTS python-py${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR})
-find_package(Boost
-  COMPONENTS python36)
+if (NOT Boost_FOUND)
+  find_package(Boost
+    COMPONENTS python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR})
+endif()
+if (NOT Boost_FOUND)
+  find_package(Boost
+    COMPONENTS python-py${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR})
+endif()

 if(NOT APPLE AND UNIX)
   find_package(OpenMP REQUIRED)


Adding tpetra as a required dependency as I am using the distributor for communication operations.

--- cmake/Dependencies.cmake
+++ cmake/Dependencies.cmake
@@ -1,5 +1,5 @@
-SET(LIB_REQUIRED_DEP_PACKAGES Teuchos)
-SET(LIB_OPTIONAL_DEP_PACKAGES Epetra Tpetra)
+SET(LIB_REQUIRED_DEP_PACKAGES Teuchos Tpetra)
+SET(LIB_OPTIONAL_DEP_PACKAGES Epetra)
 SET(TEST_REQUIRED_DEP_PACKAGES)
 SET(TEST_OPTIONAL_DEP_PACKAGES)
 SET(LIB_REQUIRED_DEP_TPLS SPRNG Boost)


improve compiler and architecture detection

--- cmake/EigenTesting.cmake
+++ cmake/EigenTesting.cmake
@@ -298,23 +298,31 @@

     if( my_service_pack )
       set(${VAR} ${my_service_pack})
-	else()
-	  set(${VAR} "na")
-    endif()
-  else()
-    # on all other system we rely on ${CMAKE_CXX_COMPILER}
-	# supporting a "--version" flag
-	exec_program(${CMAKE_CXX_COMPILER}
-	  ARGS --version
-	  OUTPUT_VARIABLE eigen_cxx_compiler_version
-	)
-	# here I try to extract the version string
-	# - TODO: this can most likely be improved and fixed
-    string(REGEX REPLACE ".* ([0-9])\\.([0-9])\\.([0-9]).*" "\\1.\\2.\\3"
-      eigen_cxx_compiler_version ${eigen_cxx_compiler_version})
-	# again, here is room for improvement
-	# what if the compiler is not "g++" !?
-    set(${VAR} "g++${eigen_cxx_compiler_version}")
+    else()
+      set(${VAR} "na")
+    endif()
+  else()
+    # on all other system we rely on ${CMAKE_CXX_COMPILER}
+    # supporting a "--version" flag
+    exec_program( ${CMAKE_CXX_COMPILER}
+                  ARGS --version
+                  OUTPUT_VARIABLE eigen_cxx_compiler_version_raw
+                )
+    # first extract the compiler name which is the first word
+    string( REGEX REPLACE ".*(llvm\\-g\\+\\+|g\\+\\+|icpc|clang).*" "\\1"
+            eigen_cxx_compiler_name ${eigen_cxx_compiler_version_raw})
+
+    if(eigen_cxx_compiler_name MATCHES ".*g\\+\\+.*")
+      string( REGEX REPLACE ".* ([0-9])\\.([0-9])\\.([0-9]).*" "\\1.\\2.\\3"
+              eigen_cxx_compiler_version ${eigen_cxx_compiler_version_raw})
+    elseif(eigen_cxx_compiler_name MATCHES "icpc|clang")
+      string( REGEX REPLACE ".* ([0-9]*)\\.([0-9]*) .*" "\\1.\\2"
+              eigen_cxx_compiler_version ${eigen_cxx_compiler_version_raw})
+    else()
+      set(eigen_cxx_compiler_version "_")
+    endif()
+
+    set(${VAR} "${eigen_cxx_compiler_name}-${eigen_cxx_compiler_version}")
   endif()
 endmacro(ei_get_compilerver)

@@ -378,7 +386,17 @@
 endmacro(ei_set_build_string)

 macro(ei_is_64bit_env VAR)
-  if(CMAKE_CL_64)
+
+  file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/is64.cpp"
+      "int main() { return (sizeof(int*) == 8 ? 1 : 0); }
+      ")
+  try_run(run_res compile_res
+         ${CMAKE_CURRENT_BINARY_DIR} "${CMAKE_CURRENT_BINARY_DIR}/is64.cpp"
+          RUN_OUTPUT_VARIABLE run_output)
+
+  if(compile_res AND run_res)
+    set(${VAR} ${run_res})
+  elseif(CMAKE_CL_64)
     set(${VAR} 1)
   elseif("$ENV{Platform}" STREQUAL "X64") # nmake 64 bit
     set(${VAR} 1)


fix detection of ICC version

fix detection of ICC version

--- cmake/EigenTesting.cmake
+++ cmake/EigenTesting.cmake
@@ -316,7 +316,7 @@
       string( REGEX REPLACE ".* ([0-9])\\.([0-9])\\.([0-9]).*" "\\1.\\2.\\3"
               eigen_cxx_compiler_version ${eigen_cxx_compiler_version_raw})
     elseif(eigen_cxx_compiler_name MATCHES "icpc|clang")
-      string( REGEX REPLACE ".* ([0-9]*)\\.([0-9]*) .*" "\\1.\\2"
+      string( REGEX REPLACE ".* ([0-9]+\\.[0-9]+\\.[0-9]+|[0-9]+\\.[0-9]+).*" "\\1"
               eigen_cxx_compiler_version ${eigen_cxx_compiler_version_raw})
     else()
       set(eigen_cxx_compiler_version "_")


check for metis.h

check for metis.h

metis.h is not always installed in the same dir as parmetis.h

--- cmake/FindParmetis.cmake
+++ cmake/FindParmetis.cmake
@@ -12,6 +12,11 @@
   message(FATAL_ERROR "parmetis include dir not found")
 endif()

+find_path(METIS_INCLUDE_DIR metis.h PATHS "${PARMETIS_PREFIX}/include")
+if(NOT EXISTS "${METIS_INCLUDE_DIR}")
+  message(FATAL_ERROR "metis include dir not found")
+endif()
+
 find_library(PARMETIS_LIBRARY parmetis PATHS "${PARMETIS_PREFIX}/lib")
 if(NOT EXISTS "${PARMETIS_LIBRARY}")
   message(FATAL_ERROR "parmetis library not found")
@@ -23,7 +28,7 @@
 endif()

 set(PARMETIS_LIBRARIES ${PARMETIS_LIBRARY} ${METIS_LIBRARY})
-set(PARMETIS_INCLUDE_DIRS ${PARMETIS_INCLUDE_DIR} )
+set(PARMETIS_INCLUDE_DIRS ${PARMETIS_INCLUDE_DIR} ${METIS_INCLUDE_DIR})

 include(FindPackageHandleStandardArgs)
 # handle the QUIETLY and REQUIRED arguments and set PARMETIS_FOUND to TRUE


fix installation layout for debian packages:

Install symlinks to shared libraries as a part of development package,
not runtime package.

It is default behavior for debian packages.

--- cmake/OpenCVModule.cmake
+++ cmake/OpenCVModule.cmake
@@ -617,9 +617,14 @@

   ocv_install_target(${the_module} EXPORT OpenCVModules
     RUNTIME DESTINATION ${OPENCV_BIN_INSTALL_PATH} COMPONENT libs
-    LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT libs
+    LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT libs NAMELINK_SKIP
     ARCHIVE DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT dev
     )
+  get_target_property(_target_type ${the_module} TYPE)
+  if("${_target_type}" STREQUAL "SHARED_LIBRARY")
+    install(TARGETS ${the_module}
+      LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT dev NAMELINK_ONLY)
+  endif()

   # only "public" headers need to be installed
   if(OPENCV_MODULE_${the_module}_HEADERS AND ";${OPENCV_MODULES_PUBLIC};" MATCHES ";${the_module};")


fix a bug in cmake/layers/gtest.cmake. (#206)

Signed-off-by: Xudong Xiao <43a0e4c34105e087bca00d690749600a96d3aa5a@gmail.com>

Co-authored-by: Xudong Xiao <43a0e4c34105e087bca00d690749600a96d3aa5a@gmail.com>

--- cmake/layers/gtest.cmake
+++ cmake/layers/gtest.cmake
@@ -2,7 +2,7 @@

 bde_prefixed_override(gtest component_find_tests)
 function(gtest_component_find_tests component rootDir)
-    component_find_test_base(gtest_component_find_test ${ARGV})
+    component_find_tests_base(gtest_component_find_tests ${ARGV})

     bde_struct_get_field(componentName ${component} NAME)
     bde_utils_find_file_extension(test "${rootDir}/${componentName}" ".g.cpp")


cmake: Update package-name.cmake

cmake: Update package-name.cmake

Determine package arch only if CPACK_DEBIAN_PACKAGE_ARCHITECTURE is not set
Append postfix if Raspberry Pi 3 or 4 are used.
This can be overwritten by setting PACKAGE_NAME_ONLY_ARCH to ON.

--- cmake/package-name.cmake
+++ cmake/package-name.cmake
@@ -31,16 +31,57 @@
 # this will always be lower case
 #     tiscamera_MAJ.MIN.PAT_arch_buildtype.deb
 #
+# Manually setting CPACK_DEBIAN_PACKAGE_ARCHITECTURE will overwrite auto detection
+# CPACK_DEBIAN_PACKAGE_ARCHITECTURE is set to `dpkg --print-architecture`.
+# For Raspberry Pis the arch is appended with piX i.e. armhf_piX
+# where X is the pi version that is detected
+# To overwrite this set `PACKAGE_NAME_ONLY_ARCH` to ON

 function (create_package_name return_value name version)

-  find_program(DPKG_PROGRAM dpkg DOC "dpkg program of Debian-based systems")
-  if(DPKG_PROGRAM)
-    execute_process(
-      COMMAND ${DPKG_PROGRAM} --print-architecture
-      OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
-      OUTPUT_STRIP_TRAILING_WHITESPACE
-      )
+  if(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
+    find_program(DPKG_PROGRAM dpkg DOC "dpkg program of Debian-based systems")
+    if(DPKG_PROGRAM)
+      execute_process(
+        COMMAND ${DPKG_PROGRAM} --print-architecture
+        OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
+        OUTPUT_STRIP_TRAILING_WHITESPACE
+        )
+    endif(DPKG_PROGRAM)
+
+    string(COMPARE EQUAL "${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}" "armhf" IS_ARMHF)
+
+    # this check is to identify raspberry pi
+    # these systems receive special optimizations that are not always
+    # compatible to other armhf systems, thus needs special identification
+    if(IS_ARMHF AND NOT PACKAGE_NAME_ONLY_ARCH)
+
+      file(READ "/proc/cpuinfo" CPUINFO)
+
+      # cpuinfo should contain a model description
+      # if the OS does not offer that line use
+      # Hardware	: BCM2835 for PI4
+      # Hardware    : BCM2708 for PI1
+      # Hardware    : BCM2709 for PI2 and PI3
+      string(FIND "${CPUINFO}" "Raspberry Pi 3" IS_PI3)
+
+      # find returns -1 if not found
+      # -1 is not considered false
+      if(IS_PI3 GREATER 0)
+        string(APPEND CPACK_DEBIAN_PACKAGE_ARCHITECTURE "_pi3")
+      endif(IS_PI3 GREATER 0)
+
+      string(FIND "${CPUINFO}" "Raspberry Pi 4" IS_PI4)
+
+      if(IS_PI4 GREATER 0)
+        string(APPEND CPACK_DEBIAN_PACKAGE_ARCHITECTURE "_pi4")
+      endif(IS_PI4 GREATER 0)
+
+    endif(IS_ARMHF)
+
+  endif(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
+
+  if(CPACK_DEBIAN_PACKAGE_ARCHITECTURE)

     git_commit_tag(GIT_TAG)

@@ -97,11 +138,11 @@

     endif(GIT_TAG)

-  else(DPKG_PROGRAM)
+  else(CPACK_DEBIAN_PACKAGE_ARCHITECTURE)

     set(${return_value}
       "${name}_${version}_${CMAKE_SYSTEM_NAME}${build_type}" PARENT_SCOPE)

-  endif(DPKG_PROGRAM)
+  endif(CPACK_DEBIAN_PACKAGE_ARCHITECTURE)

 endfunction ()


enhance xpSetFlagsGccDebug macro

enhance xpSetFlagsGccDebug macro

* allow XP_USE_ASAN XP_COVERAGE cmake options to be set before macro called, modifying default
* correctly find asan (check compiler flag requires asan library)
* coverage target and search for lcov/genhtml only if XP_COVERAGE and build type is Debug

issue https://github.com/smanders/externpro/issues/180

--- modules/xpfunmac.cmake
+++ modules/xpfunmac.cmake
@@ -1933,8 +1933,16 @@
 endmacro()

 macro(xpSetFlagsGccDebug)
-  option(XP_USE_ASAN "use address sanitizer (Debug only)" OFF)
-  option(XP_COVERAGE "generate coverage information (Debug only)" OFF)
+  if(NOT DEFINED XP_USE_ASAN)
+    option(XP_USE_ASAN "use address sanitizer (Debug only)" OFF)
+  else()
+    option(XP_USE_ASAN "use address sanitizer (Debug only)" ${XP_USE_ASAN})
+  endif()
+  if(NOT DEFINED XP_COVERAGE)
+    option(XP_COVERAGE "generate coverage information (Debug only)" OFF)
+  else()
+    option(XP_COVERAGE "generate coverage information (Debug only)" ${XP_COVERAGE})
+  endif()
   if(CMAKE_BUILD_TYPE STREQUAL Debug)
     set_property(CACHE XP_USE_ASAN PROPERTY TYPE BOOL)
     set_property(CACHE XP_COVERAGE PROPERTY TYPE BOOL)
@@ -1943,12 +1951,16 @@
     set_property(CACHE XP_COVERAGE PROPERTY TYPE INTERNAL)
   endif()
   if(XP_USE_ASAN)
+    include(CMakePushCheckState)
+    cmake_push_check_state(RESET)
+    set(CMAKE_REQUIRED_LIBRARIES asan)
     check_cxx_compiler_flag("-fsanitize=address" has_asan)
     if(has_asan)
       xpStringAppendIfDne(CMAKE_CXX_FLAGS_DEBUG "-fsanitize=address")
     endif()
-  endif()
-  if(XP_COVERAGE)
+    cmake_pop_check_state()
+  endif()
+  if(XP_COVERAGE AND CMAKE_BUILD_TYPE STREQUAL Debug)
     find_program(XP_PATH_LCOV lcov)
     find_program(XP_PATH_GENHTML genhtml)
     if(XP_PATH_LCOV AND XP_PATH_GENHTML)


build: Include CMAKE_CXX_COMPILER in -vv

--- include/config.hpp.cmake
+++ include/config.hpp.cmake
@@ -87,6 +87,7 @@
     return;
   std::cout << "\n"
             << "Build type: @CMAKE_BUILD_TYPE@" << "\n"
+            << "Compiler: @CMAKE_CXX_COMPILER@" << "\n"
             << "Compiler flags: @CMAKE_CXX_FLAGS@" << "\n"
             << "Linker flags: @CMAKE_EXE_LINKER_FLAGS@" << "\n"
             << "\n"


SK:

SK:

-ENH: found a better way to enforce updating of the dox dir.
-BUG: the fresh build was never done in continuous builds

--- src/Testing/Dashboard/elxDashboardCommon.cmake
+++ src/Testing/Dashboard/elxDashboardCommon.cmake
@@ -86,9 +86,6 @@
   set( CTEST_CHECKOUT_COMMAND "\"${CTEST_UPDATE_COMMAND}\" co --username elastixguest --password elastixguest \"${dashboard_url}\" ." )
 endif()

-# Also check the dox directory for updates, not only the src directory.
-SET( CTEST_EXTRA_UPDATES_1 "${CTEST_DASHBOARD_ROOT}/dox" )
-
 # Send the main script as a note, and this script
 list( APPEND CTEST_NOTES_FILES
   "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}"
@@ -150,15 +147,16 @@
     ctest_start( Continuous )

     # always build if the tree is missing
+    set( FRESH_BUILD OFF )
     if( NOT EXISTS "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" )
       message( "Starting fresh build..." )
       write_cache()
-      set( res 1 )
+      set( FRESH_BUILD ON )
     endif()

-    ctest_update( RETURN_VALUE res )
+    ctest_update( SOURCE ${CTEST_DASHBOARD_ROOT} RETURN_VALUE res )
     message( "Found ${res} changed files" )
-    if( res GREATER 0 )
+    if( (res GREATER 0) OR (FRESH_BUILD) )
       # run cmake twice; this seems to be necessary, otherwise the
       # KNN lib is not built
       ctest_configure()
@@ -175,7 +173,7 @@
 else()
   write_cache()
   ctest_start( ${dashboard_model} )
-  ctest_update()
+  ctest_update( SOURCE ${CTEST_DASHBOARD_ROOT} )
   # run cmake twice; this seems to be necessary, otherwise the
   # KNN lib is not built
   ctest_configure()


Updating to SWIG 3.0.9 release

Updating to SWIG 3.0.9 release

Change-Id: I829882b1331d24bfb01a8da26de287afac6a2492

--- SuperBuild/External_Swig.cmake
+++ SuperBuild/External_Swig.cmake
@@ -20,14 +20,14 @@

   if( USE_SWIG_FROM_GIT )
     set(SWIG_GIT_REPOSITORY "${git_protocol}://github.com/swig/swig.git" CACHE STRING "URL of swig git repo")
-    set(SWIG_GIT_TAG "8890a675f7783436d0c7b61fdb318f30ffb92cde" CACHE STRING "Tag in swig git repo")
+    set(SWIG_GIT_TAG "rel-3.0.9" CACHE STRING "Tag in swig git repo")
     mark_as_advanced(SWIG_GIT_REPO)
     mark_as_advanced(SWIG_GIT_TAG)
   endif()

-  set(SWIG_TARGET_VERSION 3.0.8)
-  set(SWIG_DOWNLOAD_SOURCE_HASH "c96a1d5ecb13d38604d7e92148c73c97")
-  set(SWIG_DOWNLOAD_WIN_HASH "07bc00f7511b7d57516c50f59d705efa")
+  set(SWIG_TARGET_VERSION "3.0.9" )
+  set(SWIG_DOWNLOAD_SOURCE_HASH "4bc5f46a6cdedbd8f579b25fafc96fd6")
+  set(SWIG_DOWNLOAD_WIN_HASH "811adf794d26a0cf54da578c2b9a14a3")

   if(WIN32)
     # binary SWIG for windows


Updated icc options

Updated icc options

--- cmake/CMakelinuxx8664icc.cmake
+++ cmake/CMakelinuxx8664icc.cmake
@@ -18,7 +18,7 @@
 # ------- Setting optimization flags for default configuration -------

 if((NOT CMAKE_BUILD_TYPE) OR (CMAKE_BUILD_TYPE STREQUAL "None"))
-    set(DEFAULT_CXX_FLAGS "-O1 -g")
+    set(DEFAULT_CXX_FLAGS "-O1 -ip -finline -unroll -foptimize-sibling-calls -g")
     set(OPT "${DEFAULT_CXX_FLAGS}")
     message("-- Setting compiler flags for default configuration: ${DEFAULT_CXX_FLAGS}")
 endif((NOT CMAKE_BUILD_TYPE) OR (CMAKE_BUILD_TYPE STREQUAL "None"))


Maybe this will work with vs?

Maybe this will work with vs?

--- cmake/modules/BuildGTest.cmake
+++ cmake/modules/BuildGTest.cmake
@@ -59,8 +59,12 @@
 )

 if(WIN32)
-  set(GTEST_LIBRARIES "${install_dir}/${CMAKE_BUILD_TYPE}/gtest.lib")
-  set(GTEST_INSTALL_LIBS "${install_dir}/${CMAKE_BUILD_TYPE}/gtest.dll")
+  set(GTEST_LIBRARIES "$<$<CONFIG:Release>:${install_dir}/lib/gtest.lib>$<$<CONFIG:Debug>:${install_dir}/lib/gtestd.lib>")
+  set(GTEST_INSTALL_LIBS "${install_dir}/lib/gtest.dll")
+  if(BUILD_GMOCK)
+    set(GTEST_LIBRARIES "$<$<CONFIG:Release>:${install_dir}/lib/gmock.lib>$<$<CONFIG:Debug>:${install_dir}/lib/gmockd.lib>;${GTEST_LIBRARIES}")
+    set(GTEST_INSTALL_LIBS "${install_dir}/lib/gmock.dll;${GTEST_INSTALL_LIBS}")
+  endif()
 else()
   if(${BUILD_SHARED_LIBS})
     set(GTEST_LIBRARIES "${install_dir}/lib/libgtest.so")


Added atlas subfolder to FindLAPACK.cmake.

--- cmake/modules/FindLAPACK.cmake
+++ cmake/modules/FindLAPACK.cmake
@@ -13,6 +13,8 @@
     PATHS
     /usr/lib64
     /usr/lib
+    /usr/lib64/atlas
+    /usr/lib/atlas
     /usr/local/lib64
     /usr/local/lib)


Improve detection whether SQLite is built with unlock_notify API

--- cmake/modules/FindSqlite.cmake
+++ cmake/modules/FindSqlite.cmake
@@ -84,25 +84,20 @@

   endif(SQLITE_VERSION_MATCH)

-endif()
-
-if (DEFINED SQLITE_INCLUDE_DIR AND DEFINED SQLITE_LIBRARIES AND "${SQLITE_VERSION_OK}")
-  file(WRITE ${CMAKE_BINARY_DIR}/sqlite_unlock_notify.cpp
-       "#include <sqlite3.h>
-        int main(int argc, char **argv) {
-          return sqlite3_unlock_notify(0, 0, 0);
-        }")
-  try_compile(SQLITE_HAS_UNLOCK_NOTIFY
-              ${CMAKE_BINARY_DIR}/sqlite_unlock_notify
-              ${CMAKE_BINARY_DIR}/sqlite_unlock_notify.cpp
-              LINK_LIBRARIES ${SQLITE_LIBRARIES}
-              CMAKE_FLAGS INCLUDE_DIRECTORIES ${SQLITE_INCLUDE_DIR}
-              OUTPUT_VARIABLE var)
-  if (NOT ${SQLITE_HAS_UNLOCK_NOTIFY})
-    message("WARNING: Sqlite3 is built without SQLITE_ENABLE_UNLOCK_NOTIFY")
-    unset(SQLITE_LIBRARIES)
-    unset(SQLITE_INCLUDE_DIR)
-    unset(SQLITE_VERSION_OK)
+  if (SQLITE_VERSION_OK)
+    file(WRITE ${CMAKE_BINARY_DIR}/sqlite_check_unlock_notify.cpp
+         "#include <sqlite3.h>
+          int main(int argc, char **argv) {
+            return sqlite3_unlock_notify(0, 0, 0);
+          }")
+    try_compile(SQLITE_HAS_UNLOCK_NOTIFY
+                ${CMAKE_BINARY_DIR}/sqlite_check_unlock_notify
+                ${CMAKE_BINARY_DIR}/sqlite_check_unlock_notify.cpp
+                LINK_LIBRARIES ${SQLITE_LIBRARIES}
+                CMAKE_FLAGS INCLUDE_DIRECTORIES ${SQLITE_INCLUDE_DIR})
+    if (NOT SQLITE_HAS_UNLOCK_NOTIFY)
+        message(STATUS "Sqlite ${SQLITE_VERSION} was found, but it is not compiled with -DSQLITE_ENABLE_UNLOCK_NOTIFY")
+    endif()
   endif()
 endif()

@@ -110,7 +105,8 @@
 find_package_handle_standard_args( Sqlite DEFAULT_MSG
                                    SQLITE_INCLUDE_DIR
                                    SQLITE_LIBRARIES
-                                   SQLITE_VERSION_OK )
+                                   SQLITE_VERSION_OK
+                                   SQLITE_HAS_UNLOCK_NOTIFY)

 # show the SQLITE_INCLUDE_DIR and SQLITE_LIBRARIES variables only in the advanced view
 mark_as_advanced( SQLITE_INCLUDE_DIR SQLITE_LIBRARIES )


[CMake] Cleanup unnecessary definition

[CMake] Cleanup unnecessary definition

This is only used in one file, and we already set it correctly on that file, so we don't need to set this everywhere.

git-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@309021 91177308-0d34-0410-b5e6-96231b3b80d8

--- cmake/modules/LLDBConfig.cmake
+++ cmake/modules/LLDBConfig.cmake
@@ -20,10 +20,6 @@
   set(LLDB_DEFAULT_DISABLE_CURSES 1)
 elseif(IOS)
   set(LLDB_DEFAULT_DISABLE_PYTHON 1)
-endif()
-
-if(IOS)
-  add_definitions(-DNO_XPC_SERVICES)
 endif()

 set(LLDB_DISABLE_PYTHON ${LLDB_DEFAULT_DISABLE_PYTHON} CACHE BOOL
@@ -282,6 +278,8 @@
     PATTERN ".svn" EXCLUDE
     PATTERN ".cmake" EXCLUDE
     PATTERN "Config.h" EXCLUDE
+    PATTERN "lldb-*.h" EXCLUDE
+    PATTERN "API/*.h" EXCLUDE
     )

   install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/
@@ -291,6 +289,8 @@
     PATTERN "*.h"
     PATTERN ".svn" EXCLUDE
     PATTERN ".cmake" EXCLUDE
+    PATTERN "lldb-*.h" EXCLUDE
+    PATTERN "API/*.h" EXCLUDE
     )
 endif()


[cmake] Remove the test for libstdc++<4.9

It is no longer relevant now that llvm requires >=5.1.

git-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@369371 91177308-0d34-0410-b5e6-96231b3b80d8

--- cmake/modules/LLDBConfig.cmake
+++ cmake/modules/LLDBConfig.cmake
@@ -437,28 +437,6 @@
     include_directories(${CURSES_INCLUDE_DIR})
 endif ()

-check_cxx_symbol_exists("__GLIBCXX__" "string" LLDB_USING_LIBSTDCXX)
-if(LLDB_USING_LIBSTDCXX)
-    # There doesn't seem to be an easy way to check the library version. Instead, we rely on the
-    # fact that std::set did not have the allocator constructor available until version 4.9
-    check_cxx_source_compiles("
-            #include <set>
-            std::set<int> s = std::set<int>(std::allocator<int>());
-            int main() { return 0; }"
-            LLDB_USING_LIBSTDCXX_4_9)
-    if (NOT LLDB_USING_LIBSTDCXX_4_9 AND NOT LLVM_ENABLE_EH)
-        message(WARNING
-            "You appear to be linking to libstdc++ version lesser than 4.9 without exceptions "
-            "enabled. These versions of the library have an issue, which causes occasional "
-            "lldb crashes. See <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59656> for "
-            "details. Possible courses of action are:\n"
-            "- use libstdc++ version 4.9 or newer\n"
-            "- use libc++ (via LLVM_ENABLE_LIBCXX)\n"
-            "- enable exceptions (via LLVM_ENABLE_EH)\n"
-            "- ignore this warning and accept occasional instability")
-    endif()
-endif()
-
 if ((CMAKE_SYSTEM_NAME MATCHES "Android") AND LLVM_BUILD_STATIC AND
     ((ANDROID_ABI MATCHES "armeabi") OR (ANDROID_ABI MATCHES "mips")))
   add_definitions(-DANDROID_USE_ACCEPT_WORKAROUND)


Cleanup of compilation flags for gcc and clang

o no-schedule-insns, no-inline  is not needed at O0
o remove O2 optimisation for debug builds

--- cmake/modules/SetUpMacOS.cmake
+++ cmake/modules/SetUpMacOS.cmake
@@ -78,14 +78,14 @@
      # Select flags.
      set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG")
      set(CMAKE_CXX_FLAGS_RELEASE        "-O2 -DNDEBUG")
-     set(CMAKE_CXX_FLAGS_DEBUG          "-g -O2 -fno-reorder-blocks -fno-schedule-insns -fno-inline")
-     set(CMAKE_CXX_FLAGS_DEBUGFULL      "-g3 -fno-inline")
-     set(CMAKE_CXX_FLAGS_PROFILE        "-g3 -fno-inline -ftest-coverage -fprofile-arcs")
+     set(CMAKE_CXX_FLAGS_DEBUG          "-g")
+     set(CMAKE_CXX_FLAGS_DEBUGFULL      "-g3")
+     set(CMAKE_CXX_FLAGS_PROFILE        "-g3 -ftest-coverage -fprofile-arcs")
      set(CMAKE_C_FLAGS_RELWITHDEBINFO   "-O2 -g -DNDEBUG")
      set(CMAKE_C_FLAGS_RELEASE          "-O2 -DNDEBUG")
-     set(CMAKE_C_FLAGS_DEBUG            "-g -O2 -fno-reorder-blocks -fno-schedule-insns -fno-inline")
-     set(CMAKE_C_FLAGS_DEBUGFULL        "-g3 -fno-inline")
-     set(CMAKE_C_FLAGS_PROFILE          "-g3 -fno-inline -ftest-coverage -fprofile-arcs")
+     set(CMAKE_C_FLAGS_DEBUG            "-g")
+     set(CMAKE_C_FLAGS_DEBUGFULL        "-g3")
+     set(CMAKE_C_FLAGS_PROFILE          "-g3 -ftest-coverage -fprofile-arcs")

      #settings for cint
      set(CPPPREP "${CXX} -E -C")
@@ -112,14 +112,14 @@
      # Select flags.
      set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG")
      set(CMAKE_CXX_FLAGS_RELEASE        "-O2 -DNDEBUG")
-     set(CMAKE_CXX_FLAGS_DEBUG          "-g  -fno-inline")
-     set(CMAKE_CXX_FLAGS_DEBUGFULL      "-g3 -fno-inline")
-     set(CMAKE_CXX_FLAGS_PROFILE        "-g3 -fno-inline -ftest-coverage -fprofile-arcs")
+     set(CMAKE_CXX_FLAGS_DEBUG          "-g")
+     set(CMAKE_CXX_FLAGS_DEBUGFULL      "-g3")
+     set(CMAKE_CXX_FLAGS_PROFILE        "-g3 -ftest-coverage -fprofile-arcs")
      set(CMAKE_C_FLAGS_RELWITHDEBINFO   "-O2 -g -DNDEBUG")
      set(CMAKE_C_FLAGS_RELEASE          "-O2 -DNDEBUG")
-     set(CMAKE_C_FLAGS_DEBUG            "-g  -fno-inline")
-     set(CMAKE_C_FLAGS_DEBUGFULL        "-g3 -fno-inline")
-     set(CMAKE_C_FLAGS_PROFILE          "-g3 -fno-inline -ftest-coverage -fprofile-arcs")
+     set(CMAKE_C_FLAGS_DEBUG            "-g")
+     set(CMAKE_C_FLAGS_DEBUGFULL        "-g3")
+     set(CMAKE_C_FLAGS_PROFILE          "-g3 -ftest-coverage -fprofile-arcs")

      #settings for cint
      set(CPPPREP "${CXX} -E -C")


fixed FindOpenEXR.cmake on Windows (patch by Lukas Jirkovsky)

--- config/FindOpenEXR.cmake
+++ config/FindOpenEXR.cmake
@@ -23,7 +23,7 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-FIND_PATH(OPENEXR_INCLUDE_DIR OpenEXRConfig.h PATH_SUFFIXES OpenEXR)
+FIND_PATH(OPENEXR_INCLUDE_DIR ImfRgbaFile.h PATH_SUFFIXES OpenEXR)

 FIND_LIBRARY(OPENEXR_HALF_LIBRARY NAMES Half)
 FIND_LIBRARY(OPENEXR_IEX_LIBRARY NAMES Iex)


Fix luajit install path

Fix luajit install path

--- external/luajit/luajit.cmake
+++ external/luajit/luajit.cmake
@@ -71,7 +71,7 @@
 set(LUA_FLAGS_MINSIZEREL "-s")

 install(DIRECTORY ${CMAKE_BINARY_DIR}/${LUAJIT_DIR}/${INSTALL_FULLDIR}/share/lua DESTINATION share/haka/lua/share)
-install(DIRECTORY ${CMAKE_BINARY_DIR}/${LUAJIT_DIR}/${INSTALL_FULLDIR}/share/luajit-2.0.3 DESTINATION /share/haka/lua/share)
+install(DIRECTORY ${CMAKE_BINARY_DIR}/${LUAJIT_DIR}/${INSTALL_FULLDIR}/share/luajit-2.0.3 DESTINATION share/haka/lua/share)
 install(DIRECTORY ${LUA_INCLUDE_DIR}/ DESTINATION include/haka/lua)

 set(HAKA_LUAJIT 1)


Raspberry Pi 1: Add missing "CMAKE_SYSTEM_NAME"

[skip ci]

--- os/raspberry-pi1.cmake
+++ os/raspberry-pi1.cmake
@@ -17,4 +17,4 @@

 set(CMAKE_SYSTEM_PROCESSOR "armv6" CACHE INTERNAL "")
 set(RASPBERRY_PI 1 CACHE INTERNAL "")
-
+set(CMAKE_SYSTEM_NAME "Linux" CACHE INTERNAL "")


Update FW/mdk - Optimizing the confidence map alignment(CleanUp logs)

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

 # "full commit hash of device side binary"
-set(DEPTHAI_DEVICE_SIDE_COMMIT "cab716a0c2de42fb3df1dc7298e65995af1367e4")
+set(DEPTHAI_DEVICE_SIDE_COMMIT "e21bfb96a88d244757aa113ebaf039fa28f3eec5")

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


Updating firmware (Fixing datetime on ImgFrame::getTimestamp)

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

 # "full commit hash of device side binary"
-set(DEPTHAI_DEVICE_SIDE_COMMIT "819c1c01771e2cfe36cfef4ee79d32d6f602c3b2")
+set(DEPTHAI_DEVICE_SIDE_COMMIT "a45d74937ea0e20230e36144fe123fa7e5aefce9")

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


added motor_ramp to fmu v4

added motor_ramp to fmu v4

--- cmake/configs/nuttx_px4fmu-v4_default.cmake
+++ cmake/configs/nuttx_px4fmu-v4_default.cmake
@@ -68,6 +68,7 @@
 	systemcmds/ver
 	systemcmds/sd_bench
 	systemcmds/tests
+	systemcmds/motor_ramp

 	#
 	# General system control


Enable IO image buildig for FMUv5

Enable IO image buildig for FMUv5

--- cmake/configs/nuttx_px4fmu-v5_default.cmake
+++ cmake/configs/nuttx_px4fmu-v5_default.cmake
@@ -1,5 +1,5 @@

-px4_nuttx_configure(HWCLASS m7 CONFIG nsh ROMFS y ROMFSROOT px4fmu_common)
+px4_nuttx_configure(HWCLASS m7 CONFIG nsh ROMFS y ROMFSROOT px4fmu_common IO px4io-v2)

 set(config_uavcan_num_ifaces 2)


Add VDT to list of builtin targets so it builds before ROOT

The dependency of Vdt::Vdt imported target should have been
automatically added by CMake due to it being listed in the
BUILD_BYPRODUCTS of the ExternalProject_Add() command, but
not all versions of CMake work, so it is necessary to build
it early by force. Targets listed in ROOT_BUILTIN_TARGETS
get added as a dependency of the move_headers target, which
is reasonable since they often provide headers without which
ROOT cannot be built in any case (e.g. vdt/vdtMath.h).

--- cmake/modules/SearchInstalledSoftware.cmake
+++ cmake/modules/SearchInstalledSoftware.cmake
@@ -1471,7 +1471,8 @@
             DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries)
     install(DIRECTORY ${CMAKE_BINARY_DIR}/include/vdt
             DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT extra-headers)
-          set(vdt ON CACHE BOOL "Enabled because builtin_vdt enabled (${vdt_description})" FORCE)
+    set(vdt ON CACHE BOOL "Enabled because builtin_vdt enabled (${vdt_description})" FORCE)
+    set_property(GLOBAL APPEND PROPERTY ROOT_BUILTIN_TARGETS VDT)
   endif()
 endif()


hunter_dump_cmake_flags: Support LTO

hunter_dump_cmake_flags: Support LTO

--- cmake/modules/hunter_dump_cmake_flags.cmake
+++ cmake/modules/hunter_dump_cmake_flags.cmake
@@ -102,6 +102,7 @@
     )
   endif()

+  # PIC {
   string(COMPARE NOTEQUAL "${CMAKE_CXX_COMPILE_OPTIONS_PIC}" "" has_pic)
   if(CMAKE_POSITION_INDEPENDENT_CODE AND has_pic)
     set(
@@ -115,6 +116,28 @@
         CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_COMPILE_OPTIONS_PIC}"
     )
   endif()
+  # }
+
+  # IPO {
+  string(COMPARE NOTEQUAL "${CMAKE_CXX_COMPILE_OPTIONS_IPO}" "" has_ipo)
+  if(CMAKE_INTERPROCEDURAL_OPTIMIZATION AND has_ipo)
+    foreach(x ${CMAKE_CXX_COMPILE_OPTIONS_IPO})
+      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${x}")
+    endforeach()
+  endif()
+
+  string(COMPARE NOTEQUAL "${CMAKE_C_COMPILE_OPTIONS_IPO}" "" has_ipo)
+  if(CMAKE_INTERPROCEDURAL_OPTIMIZATION AND has_ipo)
+    foreach(x ${CMAKE_C_COMPILE_OPTIONS_IPO})
+      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${x}")
+    endforeach()
+  endif()
+
+  string(COMPARE NOTEQUAL "${CMAKE_CXX_LINK_OPTIONS_IPO}" "" has_ipo)
+  if(CMAKE_INTERPROCEDURAL_OPTIMIZATION AND has_ipo)
+    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_CXX_LINK_OPTIONS_IPO}")
+  endif()
+  # }

   string(COMPARE EQUAL "${x_CPPFLAGS}" "" is_empty)
   if(NOT is_empty)


Update FW: fix image size when decimation filter is enabled

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

 # "full commit hash of device side binary"
-set(DEPTHAI_DEVICE_SIDE_COMMIT "29ed0ecddecc052d23200a56b0a717eacf5e18cc")
+set(DEPTHAI_DEVICE_SIDE_COMMIT "b3aeaf23ff5857fc8f79d412ceefc08da23e7aad")

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


cmake: Try to fix problems with installation on other platforms.

--- cmake/Modules/DefineInstallationPaths.cmake
+++ cmake/Modules/DefineInstallationPaths.cmake
@@ -90,18 +90,14 @@
     "${SHARE_INSTALL_PREFIX}/info"
     CACHE PATH "The ${APPLICATION_NAME} info install dir (default prefix/info)"
   )
-endif (UNIX)
-
-if (WIN32)
-  # Same same
+else()
   set(BIN_INSTALL_DIR "bin" CACHE PATH "-")
   set(SBIN_INSTALL_DIR "." CACHE PATH "-")
-  set(LIB_INSTALL_DIR "lib" CACHE PATH "-")
+  set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}" CACHE PATH "-")
   set(INCLUDE_INSTALL_DIR "include" CACHE PATH "-")
   set(PLUGIN_INSTALL_DIR "plugins" CACHE PATH "-")
   set(HTML_INSTALL_DIR "doc/HTML" CACHE PATH "-")
   set(ICON_INSTALL_DIR "." CACHE PATH "-")
   set(SOUND_INSTALL_DIR "." CACHE PATH "-")
   set(LOCALE_INSTALL_DIR "lang" CACHE PATH "-")
-endif (WIN32)
-
+endif ()


Revert "Log build steps of Vc external project"

This reverts commit 7c0997c758f5b6ee5117752755e0f351a1f5baa2.

--- cmake/modules/SearchInstalledSoftware.cmake
+++ cmake/modules/SearchInstalledSoftware.cmake
@@ -1283,7 +1283,6 @@
     URL_MD5 ${Vc_SRC_MD5}
     BUILD_IN_SOURCE 0
     BUILD_BYPRODUCTS ${Vc_LIBRARY}
-    LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1
     CMAKE_ARGS -G ${CMAKE_GENERATOR}
                -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
                -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}


Use GLOBAL property

Use GLOBAL property

--- cmake/modules/hunter_apply_copy_rules.cmake
+++ cmake/modules/hunter_apply_copy_rules.cmake
@@ -9,13 +9,14 @@
   hunter_test_string_not_empty("${HUNTER_INSTALL_PREFIX}")

   get_property(copy_list GLOBAL PROPERTY HUNTER_COPY_FILES)
+
   foreach(x ${copy_list})
     if(NOT EXISTS "${x}")
       hunter_internal_error("File not found: ${x}")
     endif()
-    get_property(dst_relative_dir SOURCE "${x}" PROPERTY HUNTER_DST_RELATIVE_DIR)
+    get_property(dst_relative_dir GLOBAL PROPERTY "HUNTER_DST_RELATIVE_DIR_${x}")
     if(NOT dst_relative_dir)
-      hunter_internal_error("HUNTER_DST_RELATIVE_DIR property not found")
+      hunter_internal_error("HUNTER_DST_RELATIVE_DIR property not found for file '${x}'")
     endif()
     set(dst "${HUNTER_INSTALL_PREFIX}/${dst_relative_dir}")
     hunter_status_debug("Copying file:")


libevent: depends on rt only on linux

libevent: depends on rt only on linux

Change-Id: I004076dc52294af5b980ed944738fef794da03bf
Reviewed-on: http://gerrit.aldebaran.lan:8080/713
Reviewed-by: dmerejkowsky <1e4b13000fa8777df4cefd2fd8215187e3deb062@aldebaran-robotics.com>
Tested-by: dmerejkowsky <1e4b13000fa8777df4cefd2fd8215187e3deb062@aldebaran-robotics.com>

--- cmake/qibuild/modules/libevent-config.cmake
+++ cmake/qibuild/modules/libevent-config.cmake
@@ -14,6 +14,8 @@
   flib(LIBEVENT NAMES event)
   flib(LIBEVENT NAMES event_core)
   flib(LIBEVENT NAMES event_pthreads)
-  qi_set_global(LIBEVENT_DEPENDS PTHREAD RT)
+  if(NOT APPLE)
+    qi_set_global(LIBEVENT_DEPENDS PTHREAD RT)
+  endif()
 endif()
 export_lib(LIBEVENT)


Only search for dynamic libs, don't search for qtdbus

--- cmake/FishDetFindLibs.cmake
+++ cmake/FishDetFindLibs.cmake
@@ -15,9 +15,11 @@
 if( NOT Qt5PrintSupport_FOUND )
   message( FATAL_ERROR "Could not find Qt5PrintSupport.  Build cannot continue." )
 endif()
-find_package( Qt5DBus )
-if( NOT Qt5DBus_FOUND )
-  message( FATAL_ERROR "Could not find Qt5DBus.  Build cannot continue." )
+if( NOT APPLE )
+  find_package( Qt5DBus )
+  if( NOT Qt5DBus_FOUND )
+    message( FATAL_ERROR "Could not find Qt5DBus.  Build cannot continue." )
+  endif()
 endif()
 find_package( Qt5Test )
 if( NOT Qt5Test_FOUND )
@@ -46,16 +48,6 @@
     "${_qt5Widgets_install_prefix}/lib/Qt5Svg.lib"
     )
 elseif( APPLE )
-  set( QT_THIRD_PARTY_LIBS
-    "${_qt5Widgets_install_prefix}/lib/libqtpcre.a"
-    "${_qt5Widgets_install_prefix}/lib/libqtharfbuzzng.a"
-    "${_qt5Widgets_install_prefix}/lib/libqtfreetype.a"
-    "${_qt5Widgets_install_prefix}/plugins/platforms/libqcocoa.a"
-    "${_qt5Widgets_install_prefix}/plugins/platforms/libqminimal.a"
-    "${_qt5Widgets_install_prefix}/plugins/platforms/libqoffscreen.a"
-    "${_qt5Widgets_install_prefix}/plugins/printsupport/libcocoaprintersupport.a"
-    "${_qt5Widgets_install_prefix}/plugins/imageformats/libqico.a"
-    )
 elseif( UNIX )
 endif()


Fix cmake/MyPackageRepair.cmake generated call to MESSAGE

--- cmake/MyPackageRepair.cmake
+++ cmake/MyPackageRepair.cmake
@@ -26,7 +26,7 @@
         GET_FILENAME_COMPONENT(_MYPACKAGE_GENERATED_INCLUDE_DIR_ABSOLUTE ${MYPACKAGE_GENERATED_INCLUDE_DIR} ABSOLUTE)
         INCLUDE_DIRECTORIES(${_MYPACKAGE_GENERATED_INCLUDE_DIR_ABSOLUTE})
         MESSAGE(STATUS "Appending in ${FIXME_CMAKE}: INCLUDE_DIRECTORIES(${_MYPACKAGE_GENERATED_INCLUDE_DIR_ABSOLUTE})")
-        FILE(APPEND ${FIXME_CMAKE} "Append to INCLUDE_DIRECTORIES: ${_MYPACKAGE_GENERATED_INCLUDE_DIR_ABSOLUTE}\n")
+        FILE(APPEND ${FIXME_CMAKE} "MESSAGE(STATUS \"Append to INCLUDE_DIRECTORIES: ${_MYPACKAGE_GENERATED_INCLUDE_DIR_ABSOLUTE}\")\n")
         FILE(APPEND ${FIXME_CMAKE} "INCLUDE_DIRECTORIES(${_MYPACKAGE_GENERATED_INCLUDE_DIR_ABSOLUTE})\n")
       ENDIF ()
       SET (STDINT_H_SINGLETON TRUE CACHE BOOL "C stdint.h repair singleton")


ASan use normal optimization (MEMORY_DEBUG=1)

- see #4530

--- cmake/common/px4_base.cmake
+++ cmake/common/px4_base.cmake
@@ -638,7 +638,7 @@
 	endif()

 	if ($ENV{MEMORY_DEBUG} MATCHES "1")
-		set(max_optimization -O0)
+		set(max_optimization -Os)

 		set(optimization_flags
 			-fno-strict-aliasing
@@ -646,7 +646,7 @@
 			-funsafe-math-optimizations
 			-ffunction-sections
 			-fdata-sections
-			-g -fsanitize=address
+			-g3 -fsanitize=address
 			)
 	else()
 		set(max_optimization -Os)


Perform shallow clone for nGraph (#938)

Perform shallow clone for nGraph (#938)

--- cmake/external/ngraph.cmake
+++ cmake/external/ngraph.cmake
@@ -32,6 +32,7 @@
         PREFIX ngraph
         GIT_REPOSITORY ${ngraph_URL}
         GIT_TAG ${ngraph_TAG}
+        GIT_SHALLOW TRUE
         # Here we use onnx and protobuf built by onnxruntime to avoid linking with incompatible libraries. This might change in future.
         PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/patches/ngraph/ngraph_onnx.cmake ${ngraph_SRC}/cmake/external_onnx.cmake
         # TODO: Use cmake.file+copy as above.


Eliminate some unused code in CMa'e add_llvm_target. No functionality change.

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

--- cmake/modules/AddLLVM.cmake
+++ cmake/modules/AddLLVM.cmake
@@ -62,9 +62,4 @@
   endif( TABLEGEN_OUTPUT )
   include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
   add_llvm_library(LLVM${target_name} ${ARGN} ${TABLEGEN_OUTPUT})
-  if (FALSE)
-  if( TABLEGEN_OUTPUT )
-    add_dependencies(LLVM${target_name} ${target_name}Table_gen)
-  endif( TABLEGEN_OUTPUT )
-  endif ()
 endmacro(add_llvm_target)


Build doxygen documentation by default.

Build doxygen documentation by default.

svn path=/trunk/; revision=11436

--- cmake/modules/doxygen.cmake
+++ cmake/modules/doxygen.cmake
@@ -20,7 +20,7 @@
 # Module file to decide whether to build doxygen documentation and
 # and, if so, find the necessary doxygen command.

-option(BUILD_DOX_DOC "Build doxygen documentation" OFF)
+option(BUILD_DOX_DOC "Build doxygen documentation" ON)

 if(BUILD_DOX_DOC)
   find_package(Doxygen)


Output PYTHON_EXECUTABLE so the user will know which version of python is
being used.

svn path=/trunk/; revision=7696

--- cmake/modules/summary.cmake
+++ cmake/modules/summary.cmake
@@ -80,6 +80,13 @@
 Target Fortran:	${TARGET_FORTRAN}")
 endif(ENABLE_f77 OR ENABLE_f95)

+if(ENABLE_python)
+set(
+_output_results
+"${_output_results}
+PYTHON_EXECUTABLE:				${PYTHON_EXECUTABLE}")
+endif(ENABLE_python)
+
 set(
 _output_results
 "${_output_results}


fix app directory

fix app directory

--- cmake/packages/bundle.cmake
+++ cmake/packages/bundle.cmake
@@ -20,7 +20,7 @@
 set(CPACK_ARANGO_LOG_DIR "${INST_USR_LIBDIR}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LOCALSTATEDIR}/log/arangodb3")
 set(CPACK_ARANGO_STATE_DIR "${INST_USR_LIBDIR}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LOCALSTATEDIR}")

-set(CPACK_ARANGO_DATA_DIR "${INST_USR_LIBDIR}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LOCALSTATEDIR}/lib/arangodb3-apps")
+set(CPACK_ARANGODB_APPS_DIRECTORY "${INST_USR_LIBDIR}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LOCALSTATEDIR}/lib/arangodb3-apps")

 to_native_path("CPACK_ARANGODB_APPS_DIRECTORY")
 to_native_path("CMAKE_INSTALL_DATAROOTDIR_ARANGO")


When using clang to build on GNU/Linux still use the same flag as in

Summary:
The linker flag we add for clang assumes it's being built on Apple platform.
GNU LD does not recognize the -force_load flag.

Reviewed By: agampe

Differential Revision: D26116402

fbshipit-source-id: dee6f1f38b64c695d22c577a5a8a9c08856e58ac

--- cmake_modules/Commons.cmake
+++ cmake_modules/Commons.cmake
@@ -89,7 +89,12 @@
     message(STATUS "${target_name} will link ${libpath} wholly")
     string(TOLOWER ${CMAKE_CXX_COMPILER_ID} compiler_id)
     if (${compiler_id} MATCHES ".*clang")
-        set_property(TARGET ${target_name} APPEND_STRING PROPERTY LINK_FLAGS "-Wl,-force_load ${libpath} ")
+        if (APPLE)
+            set_property(TARGET ${target_name} APPEND_STRING PROPERTY LINK_FLAGS "-Wl,-force_load ${libpath} ")
+        else ()
+            # On non-Apple platforms, we always assume that the GNU Linker is used
+            set_property(TARGET ${target_name} APPEND_STRING PROPERTY LINK_FLAGS "-Wl,--whole-archive ${libpath} -Wl,--no-whole-archive")
+        endif ()
     elseif (${compiler_id} STREQUAL "gnu")
         set_property(TARGET ${target_name} APPEND_STRING PROPERTY LINK_FLAGS "-Wl,--whole-archive ${libpath} -Wl,--no-whole-archive")
     elseif (${compiler_id} STREQUAL "msvc")


fixed script name

fixed script name

--- tfd_modules/ros.cmake
+++ tfd_modules/ros.cmake
@@ -180,7 +180,7 @@
 install(PROGRAMS
   scripts/tfd_monitor
   scripts/tfd_plan
-  scripts/tfd_eval
+  scripts/tfd_plan_eval
   scripts/tfd_plan_log
   scripts/tfd_plan_params
   DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}


Moved #cmakedefine ZORBA_MINIMAL_STORE from config.h.cmake to zorba_test_setting.h.cmake .

--- include/zorba/config.h.cmake
+++ include/zorba/config.h.cmake
@@ -86,7 +86,6 @@
 /* Configure Zorba features*/
 #cmakedefine ZORBA_NO_UNICODE
 #cmakedefine ZORBA_NO_XMLSCHEMA
-//#cmakedefine ZORBA_MINIMAL_STORE
 #cmakedefine ZORBA_NO_BIGNUMBERS

 /* Windows MSVC DLL */


build: avoid generator expression usage for compiler swap

When using the monorepo, it seems that even if Swift is built
standalone, we would see the target as imported and attempt to use the
generator expression, which would not resolve.

--- cmake/modules/SwiftWindowsSupport.cmake
+++ cmake/modules/SwiftWindowsSupport.cmake
@@ -84,9 +84,9 @@
 macro(swift_swap_compiler_if_needed target)
   if(NOT CMAKE_C_COMPILER_ID MATCHES Clang)
     if(CMAKE_SYSTEM_NAME STREQUAL CMAKE_HOST_SYSTEM_NAME)
-      get_target_property(IMPORTED clang IMPORTED)
-      if(IMPORTED)
-        set(CLANG_LOCATION $<TARGET_FILE_DIR:clang>)
+      if(SWIFT_BUILT_STANDALONE)
+        get_target_property(CLANG_LOCATION clang LOCATION)
+        get_filename_component(CLANG_LOCATION ${CLANG_LOCATION} DIRECTORY)
       else()
         set(CLANG_LOCATION ${LLVM_RUNTIME_OUTPUT_INTDIR})
       endif()


SCALAR target breaks some builds, make it optional and default to 'OFF'

--- components/ospcommon/cmake/macros.cmake
+++ components/ospcommon/cmake/macros.cmake
@@ -62,10 +62,17 @@
 MACRO(OSPRAY_CONFIGURE_ISPC_ISA)

   SET(OSPRAY_BUILD_ISA "ALL" CACHE STRING
-      "Target ISA (SCALAR, SSE4, AVX, AVX2, AVX512KNL, AVX512SKX, or ALL)")
+      "Target ISA (SSE4, AVX, AVX2, AVX512KNL, AVX512SKX, or ALL)")
   STRING(TOUPPER ${OSPRAY_BUILD_ISA} OSPRAY_BUILD_ISA)

-  SET(OSPRAY_SUPPORTED_ISAS SCALAR)
+  OPTION(OSPRAY_BUILD_ISA_SCALAR
+         "Include 'SCALAR' target (WARNING: may not work!)" OFF)
+  MARK_AS_ADVANCED(OSPRAY_BUILD_ISA_SCALAR)
+
+  IF (OSPRAY_BUILD_ISA_SCALAR)
+    SET(OSPRAY_SUPPORTED_ISAS SCALAR)
+  ENDIF()
+
   IF(EMBREE_ISA_SUPPORTS_SSE4)
     SET(OSPRAY_SUPPORTED_ISAS ${OSPRAY_SUPPORTED_ISAS} SSE4)
   ENDIF()
@@ -332,7 +339,7 @@
   SET(OSPRAY_SIMD_LIBNAME_AVX512SKX skx)
   # end 'to be cleaned up'
   # ------------------------------------------------------------------
-
+
   # hack: prevent ispc from doing multi-target binaries in this module by
   # temporarily setting a single-target ispc target list
   SET(SAVED_OSPRAY_ISPC_TARGET_LIST ${OSPRAY_ISPC_TARGET_LIST})


CMake: fix -fPIC control. (#15381)

CMake: fix -fPIC control. (#15381)

if / endif cannot be stated inside.
Use tensorflow_ENABLE_POSITION_INDEPENDENT_CODE itself
to express ON or OFF; it is already set as ON or OFF by
tensorflow/contrib/cmake/CMakeLists.txt

Fixes #15380

Signed-off-by: MyungJoo Ham <84146178f7c201fa3079bfc93fccba71d81dffe3@samsung.com>

--- tensorflow/contrib/cmake/external/snappy.cmake
+++ tensorflow/contrib/cmake/external/snappy.cmake
@@ -47,4 +47,4 @@
 )

 # actually enables snappy in the source code
-add_definitions(-DTF_USE_SNAPPY)+add_definitions(-DTF_USE_SNAPPY)


Updated FindCorrade.cmake from Corrade repository.

--- modules/FindCorrade.cmake
+++ modules/FindCorrade.cmake
@@ -19,6 +19,8 @@
 # hidden visibility by default.
 #
 # Features of found Corrade library are exposed in these variables:
+#  CORRADE_GCC47_COMPATIBILITY  - Defined if compiled with compatibility
+#   mode for GCC 4.7
 #  CORRADE_GCC46_COMPATIBILITY  - Defined if compiled with compatibility
 #   mode for GCC 4.6
 #  CORRADE_GCC45_COMPATIBILITY  - Defined if compiled with compatibility
@@ -32,6 +34,7 @@
 #   Native Client with `newlib` toolchain
 #  CORRADE_TARGET_NACL_GLIBC    - Defined if compiled for Google Chrome
 #   Native Client with `glibc` toolchain
+#  CORRADE_TARGET_EMSCRIPTEN    - Defined if compiled for Emscripten
 #
 # Corrade provides these macros and functions:
 #
@@ -47,16 +50,14 @@
 #
 #
 # Compile data resources into application binary.
-#  corrade_add_resource(name group_name
-#                       file [ALIAS alias]
-#                       [file1 [ALIAS alias1]...])
+#  corrade_add_resource(name resources.conf)
 # Depends on corrade-rc, which is part of Corrade utilities. This command
-# generates resource file with group group_name from given files in current
-# build directory. Argument name is name under which the resources can be
-# explicitly loaded. Variable `name` contains compiled resource filename,
-# which is then used for compiling library / executable. Example usage:
-#  corrade_add_resource(name group_name file1 ALIAS alias1 file2 file3)
-#  add_executable(app source1 source2 ... ${name})
+# generates resource data using given configuration file in current build
+# directory. Argument name is name under which the resources can be explicitly
+# loaded. Variable `name` contains compiled resource filename, which is then
+# used for compiling library / executable. Example usage:
+#  corrade_add_resource(app_resources resources.conf)
+#  add_executable(app source1 source2 ... ${app_resources})
 #
 # Add dynamic plugin.
 #  corrade_add_plugin(plugin_name install_dir metadata_file
@@ -68,27 +69,12 @@
 #
 #
 # Add static plugin.
-#  corrade_add_static_plugin(static_plugins_variable
-#                            plugin_name metadata_file
+#  corrade_add_static_plugin(plugin_name install_dir metadata_file
 #                            sources...)
 # The macro adds preprocessor directive CORRADE_STATIC_PLUGIN. Additional
-# libraries can be linked in via target_link_libraries(plugin_name ...). Plugin
-# library name will be appended to static_plugins_variable and the variable is
-# meant to be used for linking plugins to main executable/library, e.g:
-#  target_link_libraries(app lib1 lib2 ... ${static_plugins_variable})
-# This variable is set with parent scope to be available in parent directory.
-# If there are more intermediate directories between plugin directory and main
-# executable directory, the variable can be propagated to parent scope like
-# this:
-#  set(static_plugins_variable ${static_plugins_variable} PARENT_SCOPE)
-#
-# Find and install DLLs for bundling with Windows build.
-#  corrade_bundle_dlls(library_install_dir
-#                      dlls...
-#                      [PATHS paths...])
-# It is possible to specify also additional paths for searching. DLL names can
-# also contain paths, they will be installed into exact specified path. If an
-# DLL is not found, fatal error message is printed.
+# libraries can be linked in via target_link_libraries(plugin_name ...). If
+# install_dir is set to CMAKE_CURRENT_BINARY_DIR (e.g. for testing purposes),
+# no installation is performed.
 #
 #
 # Additionally these variables are defined for internal usage:
@@ -168,6 +154,10 @@
 if(NOT _GCC46_COMPATIBILITY EQUAL -1)
     set(CORRADE_GCC46_COMPATIBILITY 1)
 endif()
+string(FIND "${_corradeConfigure}" "#define CORRADE_GCC47_COMPATIBILITY" _GCC47_COMPATIBILITY)
+if(NOT _GCC47_COMPATIBILITY EQUAL -1)
+    set(CORRADE_GCC47_COMPATIBILITY 1)
+endif()
 string(FIND "${_corradeConfigure}" "#define CORRADE_BUILD_STATIC" _BUILD_STATIC)
 if(NOT _BUILD_STATIC EQUAL -1)
     set(CORRADE_BUILD_STATIC 1)
@@ -183,6 +173,10 @@
 string(FIND "${_corradeConfigure}" "#define CORRADE_TARGET_NACL_GLIBC" _TARGET_NACL_GLIBC)
 if(NOT _TARGET_NACL_GLIBC EQUAL -1)
     set(CORRADE_TARGET_NACL_GLIBC 1)
+endif()
+string(FIND "${_corradeConfigure}" "#define CORRADE_TARGET_EMSCRIPTEN" _TARGET_EMSCRIPTEN)
+if(NOT _TARGET_EMSCRIPTEN EQUAL -1)
+    set(CORRADE_TARGET_EMSCRIPTEN 1)
 endif()

 set(CORRADE_UTILITY_LIBRARIES ${CORRADE_UTILITY_LIBRARY})


fix in surface_mesh configuration

fix in surface_mesh configuration

--- external/surface_mesh.cmake
+++ external/surface_mesh.cmake
@@ -1,4 +1,6 @@
 # Fetching surface_mesh external
+
+set(CMAKE_POSITION_INDEPENDENT_CODE ON)

 gismo_fetch_directory(surface_mesh
   GIT_REPOSITORY https://opensource.cit-ec.de/git/surface_mesh
@@ -16,9 +18,10 @@
 #.. target_include_directories
 add_library(surface_mesh OBJECT EXCLUDE_FROM_ALL ${SMSOURCES} ${SMHEADERS})

+set(gismo_EXTENSIONS ${gismo_EXTENSIONS} $<TARGET_OBJECTS:surface_mesh>
+    CACHE INTERNAL "Gismo extensions to be included")
+
 #install(TARGETS surface_mesh DESTINATION lib OPTIONAL)
 install( FILES ${HEADERS} DESTINATION include/surface_mesh/ OPTIONAL)

-
-
 # Case 3: use ExternalProject_Add (to do)


HPCC-11264 Register GraphControl Per Machine

This is a workaround for the following anomaly (either by installer or RegSvr32):
1.  Install 32bit graph control as Administrator
2.  Install 64bit graph control as Administrator
Control will not work in Chrome (32bit) when user is not Administrator.

Fixes HPCC-11264

Signed-off-by: Gordon Smith <13c8c321b71403ffa9e1e91d85b30cb848a7b170@lexisnexis.com>

--- HPCCSystemsGraphViewControl/PluginConfig.cmake
+++ HPCCSystemsGraphViewControl/PluginConfig.cmake
@@ -71,4 +71,4 @@
 set(FBMAC_USE_INVALIDATINGCOREANIMATION 0)

 # If you want to register per-machine on Windows, uncomment this line
-#set (FB_ATLREG_MACHINEWIDE 1)
+set (FB_ATLREG_MACHINEWIDE 1)


[numerics] continue to clean useless examles that terminated with timeout

--- numerics/numerics_tests.cmake
+++ numerics/numerics_tests.cmake
@@ -241,7 +241,7 @@
   NEW_TEST(FC3D_sparse_test fc3d_sparse_test.c)

   SET(FC3D_DATA_SET
-    "Capsules-i100-1090.dat;Capsules-i100-889.dat;Capsules-i101-404.dat;Capsules-i103-990.dat;Capsules-i122-1617.dat;Example1_Fc3D.dat;Example1_Fc3D_SBM.dat;FrictionContact3D_1c.dat;FrictionContact3D_RR_1c.dat;NESpheres_10_1.dat;NESpheres_30_1.dat;OneObject-i100000-499.hdf5.dat;Rover1039.dat;Rover1040.dat;Rover1041.dat;Rover11035.dat;Rover11211.dat;Rover3865.dat;Rover4144.dat;Rover4396.dat;Rover4493.dat;Rover4516.dat;Rover4609.dat;Rover4613.dat;Rover4622.dat;Rover9770.dat;KaplasTower-i1061-4.hdf5.dat;Confeti-ex13-Fc3D-SBM.dat;BoxesStack1-i100000-32.hdf5.dat")
+    "Capsules-i100-1090.dat;Capsules-i100-889.dat;Capsules-i101-404.dat;Capsules-i103-990.dat;Capsules-i122-1617.dat;Example1_Fc3D.dat;Example1_Fc3D_SBM.dat;FrictionContact3D_1c.dat;FrictionContact3D_RR_1c.dat;NESpheres_10_1.dat;NESpheres_30_1.dat;Rover1039.dat;Rover1040.dat;Rover1041.dat;Rover11035.dat;Rover11211.dat;Rover3865.dat;Rover4144.dat;Rover4396.dat;Rover4493.dat;Rover4516.dat;Rover4609.dat;Rover4613.dat;Rover4622.dat;Rover9770.dat;Confeti-ex13-Fc3D-SBM.dat;BoxesStack1-i100000-32.hdf5.dat")

   foreach(_DAT ${FC3D_DATA_SET})
     # --- GAMS Solvers ---
@@ -273,6 +273,8 @@
   endforeach()
   set(fc3d_NSGS_Tol_1e-5_Max_10000_inTol_0_inMax_0___Rover4396_PROPERTIES WILL_FAIL TRUE)

+
+
   # --- NSGS with different local solvers and parameters ---
   NEW_FC_3D_TEST(Example1_Fc3D_SBM.dat
     SICONOS_FRICTION_3D_NSGS 1e-16 ${NSGS_NB_IT}
@@ -460,11 +462,7 @@
   NEW_FC_3D_TEST(Example1_Fc3D_SBM.dat
     SICONOS_FRICTION_3D_TFP 1e-16 100)

-  NEW_FC_3D_TEST(OneObject-i100000-499.hdf5.dat
-    SICONOS_FRICTION_3D_TFP 1e-8 100
-    0 0 0
-    DPARAM 3 1e4
-    WILL_FAIL)
+

   NEW_FC_3D_TEST(Confeti-ex03-Fc3D-SBM.dat
     SICONOS_FRICTION_3D_TFP 10e-8 2000)
@@ -525,35 +523,87 @@

   # --- Test from rock pile simulations using "time of birth" feature ---
   # failure in local solver with line search
-  NEW_FC_3D_TEST(RockPile_tob1.dat SICONOS_FRICTION_3D_NSGS 1e-3 100000
+  NEW_FC_3D_TEST(RockPile_tob1.dat SICONOS_FRICTION_3D_NSGS 1e-3 10000
     SICONOS_FRICTION_3D_ONECONTACT_NSN_GP 1e-16 100)
-  NEW_FC_3D_TEST(RockPile_tob1.dat SICONOS_FRICTION_3D_NSGS 1e-3 100000
-    SICONOS_FRICTION_3D_ONECONTACT_NSN_GP 1e-16 1000)
-  NEW_FC_3D_TEST(RockPile_tob1.dat SICONOS_FRICTION_3D_NSGS 1e-3 100000
-    SICONOS_FRICTION_3D_ONECONTACT_NSN 1e-16 100)
+  #  an increasing number of newton iterations implies a failure
+  NEW_FC_3D_TEST(RockPile_tob1.dat SICONOS_FRICTION_3D_NSGS 1e-3 10000
+    SICONOS_FRICTION_3D_ONECONTACT_NSN_GP 1e-16 1000 WILL_FAIL )
+  # removinf the line --search is worth
+  NEW_FC_3D_TEST(RockPile_tob1.dat SICONOS_FRICTION_3D_NSGS 1e-3 2000
+    SICONOS_FRICTION_3D_ONECONTACT_NSN 1e-16 100 WILL_FAIL)

   # ---- PROX ---

   NEW_FC_3D_TEST(Example1_Fc3D_SBM.dat
     SICONOS_FRICTION_3D_PROX 1e-8 100)

+
+  NEW_FC_3D_TEST(OneObject-i1028-138.hdf5.dat
+    SICONOS_FRICTION_3D_PROX  1e-8 100000
+    0 0 0
+    DPARAM 3 1e4
+    IPARAM 1 1)
+
+  # --------------------------------------- #
+  ### problems known as difficult
+  # --------------------------------------- #
+  # KaplasTower-i1061-4.hdf5.dat
+
+  NEW_FC_3D_TEST(KaplasTower-i1061-4.hdf5.dat SICONOS_FRICTION_3D_NSGS 1e-5 2000
+    SICONOS_FRICTION_3D_ONECONTACT_NSN_GP 0 0 WILL_FAIL)
+  NEW_FC_3D_TEST(KaplasTower-i1061-4.hdf5.dat SICONOS_FRICTION_3D_NSGS 1e-5 1500
+    SICONOS_FRICTION_3D_ONECONTACT_NSN_GP 0 0
+    INTERNAL_IPARAM 10 1
+    WILL_FAIL)
+  NEW_FC_3D_TEST(KaplasTower-i1061-4.hdf5.dat SICONOS_FRICTION_3D_NSGS 1e-5 1500
+    SICONOS_FRICTION_3D_ONECONTACT_NSN_GP 0 0
+    INTERNAL_IPARAM SICONOS_FRICTION_3D_NSN_HYBRID_STRATEGY SICONOS_FRICTION_3D_NSN_HYBRID_STRATEGY_PLI_NSN_LOOP
+    WILL_FAIL)
+
+  NEW_FC_3D_TEST(KaplasTower-i1061-4.hdf5.dat SICONOS_FRICTION_3D_NSN_AC 1e-2 1000)
+  NEW_FC_3D_TEST(KaplasTower-i1061-4.hdf5.dat SICONOS_FRICTION_3D_NSN_FB 1e-3 1000)
+  NEW_FC_3D_TEST(KaplasTower-i1061-4.hdf5.dat SICONOS_FRICTION_3D_NSN_NM 1e-3 1000)
+
+  NEW_FC_3D_TEST(KaplasTower-i1061-4.hdf5.dat
+    SICONOS_FRICTION_3D_PROX  1e-3 10
+    0 0 0
+    DPARAM 3 1e4
+    IPARAM 1 1)
+
+  # OneObject-i100000-499.hdf5.dat
+  NEW_FC_3D_TEST(OneObject-i100000-499.hdf5.dat
+    SICONOS_FRICTION_3D_NSGS 1e-5 100000
+    SICONOS_FRICTION_3D_ONECONTACT_NSN_GP 0 0
+    WILL_FAIL)
+  NEW_FC_3D_TEST(OneObject-i100000-499.hdf5.dat SICONOS_FRICTION_3D_NSGS 1e-5 10000
+    SICONOS_FRICTION_3D_ONECONTACT_NSN_GP 0 0
+    INTERNAL_IPARAM 10 1
+    WILL_FAIL)
+  NEW_FC_3D_TEST(OneObject-i100000-499.hdf5.dat SICONOS_FRICTION_3D_NSGS 1e-5 10000
+    SICONOS_FRICTION_3D_ONECONTACT_NSN_GP 0 0
+    INTERNAL_IPARAM SICONOS_FRICTION_3D_NSN_HYBRID_STRATEGY SICONOS_FRICTION_3D_NSN_HYBRID_STRATEGY_PLI_NSN_LOOP
+    WILL_FAIL)
+  NEW_FC_3D_TEST(OneObject-i100000-499.hdf5.dat SICONOS_FRICTION_3D_NSN_AC 1e-5 100
+    0 0 0
+    IPARAM 1 1)
+  NEW_FC_3D_TEST(OneObject-i100000-499.hdf5.dat SICONOS_FRICTION_3D_NSN_AC 1e-3 1000)
+  NEW_FC_3D_TEST(OneObject-i100000-499.hdf5.dat SICONOS_FRICTION_3D_NSN_FB 1e-3 1000)
+  NEW_FC_3D_TEST(OneObject-i100000-499.hdf5.dat SICONOS_FRICTION_3D_NSN_NM 1e-3 1000)
+
   NEW_FC_3D_TEST(OneObject-i100000-499.hdf5.dat
     SICONOS_FRICTION_3D_PROX  1e-8 100000
     0 0 0
     DPARAM 3 1e4
     IPARAM 1 1)

-  NEW_FC_3D_TEST(OneObject-i1028-138.hdf5.dat
-    SICONOS_FRICTION_3D_PROX  1e-8 100000
+
+  NEW_FC_3D_TEST(OneObject-i100000-499.hdf5.dat
+    SICONOS_FRICTION_3D_TFP 1e-8 100
     0 0 0
     DPARAM 3 1e4
-    IPARAM 1 1)
-
-  NEW_FC_3D_TEST(KaplasTower-i1061-4.hdf5.dat
-    SICONOS_FRICTION_3D_PROX  1e-5 100000
-    0 0 0
-    DPARAM 3 1e4
-    IPARAM 1 1)
+    WILL_FAIL)
+
+

   # --- LMGC driver ---


Add distortos_FileSystems_00_Integration_with_standard_library option

--- source/FileSystem/distortos-sources.cmake
+++ source/FileSystem/distortos-sources.cmake
@@ -1,11 +1,30 @@
 #
 # file: distortos-sources.cmake
 #
-# author: Copyright (C) 2018-2019 Kamil Szczygiel http://www.distortec.com http://www.freddiechopin.info
+# author: Copyright (C) 2018-2020 Kamil Szczygiel http://www.distortec.com http://www.freddiechopin.info
 #
 # This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not
 # distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 #
+
+distortosSetConfiguration(BOOLEAN
+		distortos_FileSystems_00_Integration_with_standard_library
+		ON
+		HELP "Enable integration of file systems with standard library.
+
+		Enables functionality for accessing multiple distortos::FileSystem objects via functions from standard library
+		headers. When this option is enabled, following features are enabled:
+		- global functions distortos::mount() and distortos::unmount() (which supports deferred unmount of busy file
+		system);
+		- support for (most likely) all functions from <stdio.h> header, like fopen(), fclose(), fread(), fwrite(),
+		fprintf(), fscanf() and so on;
+		- support for selected I/O-related functions from <fcntl.h>, <unistd.h> and <sys/stat.h> headers: open(),
+		close(), read(), write(), isatty(), lseek(), fstat(), mkdir(), stat() and unlink() (which supports both files
+		and directories);
+		- support for selected functions from <dirent.h> header: opendir(), closedir(), readdir_r(), rewinddir(),
+		seekdir() and telldir();
+		- support for statvfs() function from <sys/statvfs.h> header;"
+		OUTPUT_NAME DISTORTOS_FILESYSTEMS_STANDARD_LIBRARY_INTEGRATION_ENABLE)

 target_sources(distortos PRIVATE
 		${CMAKE_CURRENT_LIST_DIR}/openFile.cpp)


add official cmake module

add official cmake module

--- FindMySQL.cmake
+++ FindMySQL.cmake
@@ -1,48 +1,813 @@
-# - Find mysqlclient
-# Find the native MySQL includes and library
-#
-#  MYSQL_INCLUDE_DIR - where to find mysql.h, etc.
-#  MYSQL_LIBRARIES   - List of libraries when using MySQL.
-#  MYSQL_FOUND       - True if MySQL found.
-
-IF (MYSQL_INCLUDE_DIR)
-	# Already in cache, be silent
-	SET(MYSQL_FIND_QUIETLY TRUE)
-ENDIF (MYSQL_INCLUDE_DIR)
-
-FIND_PATH(MYSQL_INCLUDE_DIR mysql.h
-	/usr/local/include/mysql
-	/usr/include/mysql
-	)
-
-SET(MYSQL_NAMES mysqlclient mysqlclient_r)
-FIND_LIBRARY(MYSQL_LIBRARY
-	NAMES ${MYSQL_NAMES}
-	PATHS /usr/lib /usr/local/lib
-	PATH_SUFFIXES mysql
-	)
-
-IF (MYSQL_INCLUDE_DIR AND MYSQL_LIBRARY)
-	SET(MYSQL_FOUND TRUE)
-	SET( MYSQL_LIBRARIES ${MYSQL_LIBRARY} )
-ELSE (MYSQL_INCLUDE_DIR AND MYSQL_LIBRARY)
-	SET(MYSQL_FOUND FALSE)
-	SET( MYSQL_LIBRARIES )
-ENDIF (MYSQL_INCLUDE_DIR AND MYSQL_LIBRARY)
-
-IF (MYSQL_FOUND)
-	IF (NOT MYSQL_FIND_QUIETLY)
-		MESSAGE(STATUS "Found MySQL: ${MYSQL_LIBRARY}")
-	ENDIF (NOT MYSQL_FIND_QUIETLY)
-ELSE (MYSQL_FOUND)
-	IF (MYSQL_FIND_REQUIRED)
-		MESSAGE(STATUS "Looked for MySQL libraries named ${MYSQL_NAMES}.")
-		MESSAGE(FATAL_ERROR "Could NOT find MySQL library")
-	ENDIF (MYSQL_FIND_REQUIRED)
-ENDIF (MYSQL_FOUND)
-
-MARK_AS_ADVANCED(
-	MYSQL_LIBRARY
-	MYSQL_INCLUDE_DIR
-
-	)
+# -*- indent-tabs-mode:nil; -*-
+# vim: set expandtab:
+#
+#   Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
+#
+#   The MySQL Connector/C++ is licensed under the terms of the GPLv2
+#   <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
+#   MySQL Connectors. There are special exceptions to the terms and
+#   conditions of the GPLv2 as it is applied to this software, see the
+#   FLOSS License Exception
+#   <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
+#
+#   This program is free software; you can redistribute it and/or modify
+#   it under the terms of the GNU General Public License as published
+#   by the Free Software Foundation; version 2 of the License.
+#
+#   This program is distributed in the hope that it will be useful, but
+#   WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+#   or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+#   for more details.
+#
+#   You should have received a copy of the GNU General Public License along
+#   with this program; if not, write to the Free Software Foundation, Inc.,
+#   51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
+
+##########################################################################
+
+##########################################################################
+#
+# Configuration variables, all optional, are
+#
+#   MYSQL_DIR         - Set in environment or as parameter to "cmake",
+#                       this is the top directory of the MySQL Server or
+#                       Connector/C install
+#   MYSQL_INCLUDE_DIR - Set in environment or as parameter to "cmake",
+#                       this is the include directory where to find
+#                       the client library
+#   MYSQL_LIB_DIR     - Set in environment or as parameter to "cmake",
+#                       this is the library directory where to find
+#                       the client library
+#   MYSQLCLIENT_STATIC_LINKING
+#                     - Specify that you want static linking, dynamic
+#                       linking is the default
+#   MYSQLCLIENT_NO_THREADS
+#                     - Specify to link against the single threaded
+#                       library, "libmysqlclient". Note that in 5.5
+#                       and up "libmysqlclient" is multithreaded and
+#                       "libmysqlclient_r" just a soft link to it
+#   MYSQL_CONFIG_EXECUTABLE
+#                     - "mysql_config" executable to use
+#   MYSQL_CXX_LINKAGE - Specify that client library needs C++ linking
+#   MYSQL_EXTRA_LIBRARIES
+#                     - Libraries to add to the linkage
+#   MYSQL_CFLAGS      - C compiler flags
+#   MYSQL_CXXFLAGS    - C++ compiler flags
+#   MYSQL_LINK_FLAGS  - User defined extra linkage flags
+#   FINDMYSQL_DEBUG   - Set if want debug output from this script
+#
+# Note that most variables above, if not set by the user they will be
+# set by this include file.
+#
+# In addition, the below CMake variables are set by this include file
+#
+#   MYSQL_VERSION     - Three position numeric version, like 5.6.41
+#   MYSQL_VERSION_ID  - Numeric padded version, 5.13.4 => 51304
+#   MYSQL_NUM_VERSION - Same as MYSQL_VERSION_ID, for compatibility
+#   MYSQL_LIB         - Path to the client library
+#   MYSQL_LIBRARIES   - Library name, might be "-lmysqlclient" while
+#                       MYSQL_LIB is the path to the library
+#   MYSQL_CLIENT_LIBS - Same as MYSQL_LIBRARIES, for compatibility
+#
+# (1) If MYSQL_INCLUDE_DIR or MYSQL_LIB_DIR are given, these are
+#     used and an error is reported if can't be used
+# (2) If MYSQL_CONFIG_EXECUTABLE is given, it is used to get
+#     headers and libraries
+# (3) If MYSQL_DIR is given and "${MYSQL_DIR}/bin/mysql_config" is
+#     found, then same as (2)
+# (4) If MYSQL_DIR is given and no "${MYSQL_DIR}/bin/mysql_config",
+#     search MYSQL_DIR
+#
+# FIXME if we get a "mysql_config" on Windows, things needs to change
+# FIXME rename the VERSION variables above
+# FIXME let MYSQL_VERSION include "-beta" etc?
+# FIXME can mysql_config --version be C/C verson?
+# FIXME if no mysql_config, find version from include/mysql_version.h?
+#       #define MYSQL_SERVER_VERSION       "5.7.5-m15"
+#       #define MYSQL_VERSION_ID            50705
+#       #define LIBMYSQL_VERSION           "6.1.5"
+#       #define LIBMYSQL_VERSION_ID         60105
+# FIXME can MYSQL_LIB_DIR be a list of paths?
+# FIXME is MYSQLCLIENT_LIBS a better name?
+# FIXME cache variables, makes them command line args?
+# FIXME really do include_directories() and link_directories()? Likely
+# FIXME add check that if not static, not picked up .a or mysqlclient.lib
+# FIXME MYSQL_VERSION_ID need to take into account Cluster versions
+#       and Connector/C versions
+# FIXME handle MYSQL_VERSION_ID, LIBMYSQL_VERSION and LIBMYSQL_VERSION_ID?
+#
+##########################################################################
+
+
+##########################################################################
+#
+# Check the input data
+#
+##########################################################################
+
+# If using both MYSQL_DIR as a cmake argument and set in environment,
+# and not empty strings, they better be the same. Else stop and complain
+
+set(ENV_OR_OPT_VARS
+  MYSQL_DIR
+  MYSQL_INCLUDE_DIR
+  MYSQL_LIB_DIR
+  MYSQL_CFLAGS
+  MYSQL_CXXFLAGS
+  MYSQL_CONFIG_EXECUTABLE
+  MYSQLCLIENT_STATIC_LINKING
+  MYSQLCLIENT_NO_THREADS
+  MYSQL_CXX_LINKAGE
+  MYSQL_EXTRA_LIBRARIES
+  MYSQL_LINK_FLAGS
+)
+
+# Mark the variable names that have values that are paths
+set(ENV_OR_OPT_PATH_VARS
+  MYSQL_DIR
+  MYSQL_INCLUDE_DIR
+  MYSQL_LIB_DIR
+)
+
+foreach(_xvar ${ENV_OR_OPT_VARS})
+
+  if((DEFINED ${_xvar}) AND
+     (DEFINED ENV{${_xvar}}) AND
+     (NOT "${${_xvar}}" STREQUAL "") AND
+     (NOT "$ENV{${_xvar}}" STREQUAL "") AND
+     (NOT "$ENV{${_xvar}}" STREQUAL "${${_xvar}}"))
+    message(FATAL_ERROR "Please pass -D${_xvar}=... as an argument or "
+                        "set ${_xvar} in the environment, but not both")
+  endif()
+
+  # Now we know both are not set, set the CMake variable if needed
+  if((DEFINED ENV{${_xvar}}) AND (NOT "$ENV{${_xvar}}" STREQUAL ""))
+    set(${_xvar} $ENV{${_xvar}})
+  endif()
+
+  # Notmalize the path if the variable is set and is a path
+  if(${_xvar})
+    list(FIND ENV_OR_OPT_PATH_VARS ${_xvar} _index)
+    if (${_index} GREATER -1)
+      file(TO_CMAKE_PATH "${${_xvar}}" ${_xvar})
+    endif()
+  endif()
+
+endforeach()
+
+
+if(MYSQL_CONFIG_EXECUTABLE)
+  set(_mysql_config_set_by_user 1)
+else()
+  # If MYSQL_DIR is set, set MYSQL_CONFIG_EXECUTABLE
+  if((NOT WIN32) AND
+     (DEFINED MYSQL_DIR) AND
+     (EXISTS "${MYSQL_DIR}/bin/mysql_config"))
+    set(MYSQL_CONFIG_EXECUTABLE "${MYSQL_DIR}/bin/mysql_config")
+    set(_mysql_config_in_mysql_dir 1)
+  endif()
+endif()
+
+##########################################################################
+#
+# Data and basic settings
+#
+##########################################################################
+
+# Set sub directory to search in
+# dist = for mysql binary distributions
+# build = for custom built tree
+
+if(CMAKE_BUILD_TYPE STREQUAL Debug)
+  set(_lib_suffix_dist debug)
+  set(_lib_suffix_build Debug)
+else()
+  set(_lib_suffix_dist opt)
+  set(_lib_suffix_build Release)
+  add_definitions(-DDBUG_OFF)   # FIXME what?!
+endif()
+
+set(_exe_fallback_path
+    /usr/bin
+    /usr/local/bin
+    /opt/mysql/mysql/bin
+    /usr/local/mysql/bin
+)
+
+set(_include_fallback_path
+    /usr/include/mysql
+    /usr/local/include/mysql
+    /opt/mysql/mysql/include
+    /opt/mysql/mysql/include/mysql
+    /usr/local/mysql/include
+    /usr/local/mysql/include/mysql
+    $ENV{ProgramFiles}/MySQL/*/include
+    $ENV{SystemDrive}/MySQL/*/include
+)
+
+set(_lib_fallback_path
+    /usr/lib/mysql
+    /usr/local/lib/mysql
+    /usr/local/mysql/lib
+    /usr/local/mysql/lib/mysql
+    /opt/mysql/mysql/lib
+    /opt/mysql/mysql/lib/mysql
+    $ENV{ProgramFiles}/MySQL/*/lib/${_lib_suffix_dist}
+    $ENV{ProgramFiles}/MySQL/*/lib
+    $ENV{SystemDrive}/MySQL/*/lib/${_lib_suffix_dist}
+    $ENV{SystemDrive}/MySQL/*/lib
+)
+
+set(_lib_subdirs
+    # Paths in build tree, really being too nice
+    libmysql/${_lib_suffix_build}
+    client/${_lib_suffix_build}
+    libmysql_r/.libs
+    libmysql/.libs
+    libmysql
+    # Install sub directories
+    lib/mysql
+    lib/${_lib_suffix_dist}   # Need to be before "lib"
+    lib
+)
+
+set(_static_subdirs
+    mysql
+    ${_lib_suffix_dist}
+)
+
+if(MSVC90)
+  set(_vs_subdir vs9)
+elseif(MSVC10)
+  set(_vs_subdir vs10)
+elseif(MSVC11)
+  set(_vs_subdir vs11)
+elseif(MSVC12)
+  set(_vs_subdir vs12)
+elseif(MSVC13)
+  set(_vs_subdir vs13)
+elseif(MSVC14)
+  set(_vs_subdir vs14)
+elseif(MSVC15)
+  set(_vs_subdir vs15)
+endif()
+
+if(_vs_subdir)
+  if("${_lib_suffix_dist}" STREQUAL "debug")
+    set(_vs_subdir "${_vs_subdir}/debug")
+  endif()
+  list(INSERT _lib_subdirs 0 "lib/${_vs_subdir}")
+endif()
+
+# For Windows, the client library name differs, so easy to
+# make sure find_library() picks the right one. For Unix, it
+# is the file extension that differs. In the static library
+# case we know it is ".a", so we add it to the library name
+# we search for to make sure it is picked in the static case.
+if(WIN32)
+  set(_dynamic_libs   "libmysql")
+  set(_static_libs    "mysqlclient")
+  set(_static_lib_ext ".lib")   # Careful, can be import library for DLL
+elseif(MYSQLCLIENT_NO_THREADS)
+  # In 5.1 and below there is a single threaded library
+  set(_dynamic_libs   "mysqlclient")
+  set(_static_libs    "libmysqlclient.a")
+  set(_static_lib_ext ".a")
+else()
+  # We try the multithreaded "libmysqlclient_r" first and if not
+  # there, pick "libmysqlclient" that in 5.5 and up is multithreaded
+  # anyway (soft link "libmysqlclient_r" is not installed MySQL Server
+  # 5.6 and Debian/Ubuntu and might go in 5.7 for all installs)
+  set(_dynamic_libs   "mysqlclient_r"      "mysqlclient")
+  set(_static_libs    "libmysqlclient_r.a" "libmysqlclient.a")
+  set(_static_lib_ext ".a")
+endif()
+
+if(MYSQLCLIENT_STATIC_LINKING)
+  set(_link_type   "static")
+  set(_search_libs ${_static_libs})
+else()
+  set(_link_type   "dynamic")
+  set(_search_libs ${_dynamic_libs})
+endif()
+
+# Just to pretty print in error messages
+string(REPLACE ";" " " _pp_search_libs           "${_search_libs}")
+string(REPLACE ";" " " _pp_lib_subdirs           "${_lib_subdirs}")
+string(REPLACE ";" " " _pp_lib_fallback_path     "${_lib_fallback_path}")
+string(REPLACE ";" " " _pp_include_fallback_path "${_include_fallback_path}")
+
+message(STATUS "You will link ${_link_type}ally to the MySQL client"
+               " library (set with -DMYSQLCLIENT_STATIC_LINKING=<bool>)")
+message(STATUS "Searching for ${_link_type} libraries with the base name(s) \"${_pp_search_libs}\"")
+
+##########################################################################
+#
+# Macros
+#
+##########################################################################
+
+# ----------------------------------------------------------------------
+#
+# Macro that runs "mysql_config ${_opt}" and return the line after
+# trimming away ending space/newline.
+#
+# _mysql_conf(
+#   _var    - output variable name, will contain a ';' separated list
+#   _opt    - the flag to give to mysql_config
+#
+# ----------------------------------------------------------------------
+
+macro(_mysql_conf _var _opt)
+  execute_process(
+    COMMAND ${MYSQL_CONFIG_EXECUTABLE} ${_opt}
+    OUTPUT_VARIABLE ${_var}
+    OUTPUT_STRIP_TRAILING_WHITESPACE
+  )
+endmacro()
+
+# ----------------------------------------------------------------------
+#
+# Macro that runs "mysql_config ${_opt}", selects output args using a
+# regex, and clean it up a bit removing space/tab/newline before
+# setting it to a variable.
+#
+# _mysql_config(
+#   _var    - output variable name, will contain a ';' separated list
+#   _regex  - regular expression matching the prefix of args to select
+#   _opt    - the flag to give to mysql_config
+#
+# ----------------------------------------------------------------------
+
+macro(_mysql_config _var _regex _opt)
+  _mysql_conf(_mysql_config_output ${_opt})
+  string(REGEX MATCHALL "${_regex}([^ ]+)" _mysql_config_output "${_mysql_config_output}")
+  string(REGEX REPLACE "^[ \t]+" "" _mysql_config_output "${_mysql_config_output}")
+  string(REGEX REPLACE "${_regex}" "" _mysql_config_output "${_mysql_config_output}")
+  separate_arguments(_mysql_config_output)
+  set(${_var} ${_mysql_config_output})
+endmacro()
+
+# ----------------------------------------------------------------------
+#
+# Macro that runs "mysql_config ${_opt}" and selects output using a
+# prefix regex. Cleans it up a bit removing space/tab/newline. Then
+# removes the prefix on all in the list, and finally replace what
+# matches another regular expression with a replacement string.
+#
+# _mysql_config_replace(
+#   _var     - output variable name, will contain a ';' separated list
+#   _regex1  - regular expression to match out arguments
+#   _replace - what to replace match _regex1 with
+#   _regex2  - regular expression matching the prefix of args to select
+#   _opt     - the flag to give to mysql_config
+#
+# ----------------------------------------------------------------------
+
+macro(_mysql_config_replace _var _regex1 _replace _regex2 _opt)
+  _mysql_conf(_mysql_config_output ${_opt})
+  string(REGEX MATCHALL "${_regex2}([^ ]+)" _mysql_config_output "${_mysql_config_output}")
+  string(REGEX REPLACE "^[ \t]+" "" _mysql_config_output "${_mysql_config_output}")
+  string(REGEX REPLACE "${_regex2}" "" _mysql_config_output "${_mysql_config_output}")
+  string(REGEX REPLACE "${_regex1}" "${_replace}" _mysql_config_output "${_mysql_config_output}")
+  separate_arguments(_mysql_config_output)
+  set(${_var} ${_mysql_config_output})
+endmacro()
+
+# ----------------------------------------------------------------------
+#
+# Macro to check that we found a library and that we got the right type
+#
+# ----------------------------------------------------------------------
+
+macro(_check_lib_search_error _lib_dir_var _lib_var _exta_err_string)
+
+  set(_lib     "${${_lib_var}}")
+  set(_lib_dir "${${_lib_dir_var}}")
+
+  if(FINDMYSQL_DEBUG)
+    message("_lib         \"${_lib}\"")
+    message("_lib_dir     \"${_lib_dir}\"")
+    message("_lib_var     \"${_lib_var}\"")
+    message("_lib_dir_var \"${_lib_dir_var}\"")
+  endif()
+
+  set(_err_string "Could not find ${_link_type} "
+                  "\"${_pp_search_libs}\" in ${_lib_dir_var} "
+                  "\"${_lib_dir}\" ${_exta_err_string}")
+
+  if(NOT ${_lib_var})
+    message(FATAL_ERROR ${_err_string})
+  endif()
+
+  # find_library() try find a shared library first, then a static
+  # one. For Windows the library has a different name, but for
+  # Unix only the extension differs. So we check here that we
+  # got the library kind we expected.
+  if(NOT WIN32)
+    if(NOT MYSQLCLIENT_STATIC_LINKING)
+      get_filename_component(_ext ${_lib} EXT)
+      if(${_ext} STREQUAL ${_static_lib_ext})
+        message(FATAL_ERROR ${_err_string})
+      endif()
+    endif()
+  endif()
+endmacro()
+
+
+##########################################################################
+#
+# Try find MYSQL_CONFIG_EXECUTABLE if not set, and find version
+#
+##########################################################################
+
+if(NOT WIN32)
+
+  if(NOT MYSQL_CONFIG_EXECUTABLE)
+    find_program(MYSQL_CONFIG_EXECUTABLE
+      NAMES
+        mysql_config
+      DOC
+        "full path of mysql_config"
+      PATHS
+        ${_exe_fallback_path}
+    )
+  endif()
+
+  if(MYSQL_CONFIG_EXECUTABLE)
+    message(STATUS "mysql_config was found ${MYSQL_CONFIG_EXECUTABLE}")
+
+    _mysql_conf(MYSQL_VERSION "--version")
+  endif()
+
+endif()
+
+##########################################################################
+#
+# Find MYSQL_INCLUDE_DIR
+#
+##########################################################################
+
+if(FINDMYSQL_DEBUG AND MYSQL_INCLUDE_DIR)
+  message("DBG: User gave MYSQL_INCLUDE_DIR = \"${MYSQL_INCLUDE_DIR}\"")
+endif()
+
+if(FINDMYSQL_DEBUG AND MYSQL_DIR)
+  message("DBG: User gave MYSQL_DIR = \"${MYSQL_DIR}\"")
+endif()
+
+if(MYSQL_INCLUDE_DIR)
+
+  if(FINDMYSQL_DEBUG)
+    message("DBG: Using MYSQL_INCLUDE_DIR to find \"mysql.h\"")
+  endif()
+
+  if(NOT EXISTS "${MYSQL_INCLUDE_DIR}/mysql.h")
+    message(FATAL_ERROR "MYSQL_INCLUDE_DIR given, but no \"mysql.h\" "
+                        "in \"${MYSQL_INCLUDE_DIR}\"")
+  endif()
+
+elseif(MYSQL_DIR AND
+       (NOT _mysql_config_in_mysql_dir) AND
+       (NOT _mysql_config_set_by_user))
+
+  if(FINDMYSQL_DEBUG)
+    message("DBG: Using MYSQL_DIR without \"mysql_config\" to find \"mysql.h\"")
+  endif()
+
+  set(MYSQL_INCLUDE_DIR "${MYSQL_DIR}/include")
+  if(NOT EXISTS "${MYSQL_INCLUDE_DIR}/mysql.h")
+    message(FATAL_ERROR "MYSQL_DIR given, but no \"mysql.h\" "
+                        "in \"${MYSQL_INCLUDE_DIR}\"")
+  endif()
+
+elseif(MYSQL_CONFIG_EXECUTABLE)
+
+  if(FINDMYSQL_DEBUG)
+    message("DBG: Using \"mysql_config\" to find \"mysql.h\"")
+  endif()
+
+  # This code assumes there is just one "-I...." and that
+  # no space between "-I" and the path
+  _mysql_config(MYSQL_INCLUDE_DIR "(^| )-I" "--include")
+  if(NOT MYSQL_INCLUDE_DIR)
+    message(FATAL_ERROR "Could not find the include dir from running "
+                        "\"${MYSQL_CONFIG_EXECUTABLE}\"")
+  endif()
+
+  if(NOT EXISTS "${MYSQL_INCLUDE_DIR}/mysql.h")
+    message(FATAL_ERROR "Could not find \"mysql.h\" in \"${MYSQL_INCLUDE_DIR}\" "
+                        "found from running \"${MYSQL_CONFIG_EXECUTABLE}\"")
+  endif()
+
+else()
+
+  if(FINDMYSQL_DEBUG)
+    message("DBG: Using find_path() searching "
+            "\"${_pp_include_fallback_path}\" to find \"mysql.h\"")
+  endif()
+
+  # No specific paths, try some common install paths
+  find_path(MYSQL_INCLUDE_DIR mysql.h ${_include_fallback_path})
+
+  if(NOT MYSQL_INCLUDE_DIR)
+    message(FATAL_ERROR "Could not find \"mysql.h\" from searching "
+                        "\"${_pp_include_fallback_path}\"")
+  endif()
+
+endif()
+
+if(FINDMYSQL_DEBUG)
+  message("DBG: MYSQL_INCLUDE_DIR = \"${MYSQL_INCLUDE_DIR}\"")
+endif()
+
+##########################################################################
+#
+# Find MYSQL_LIB_DIR, MYSQL_LIB and MYSQL_LIBRARIES
+#
+##########################################################################
+
+if(FINDMYSQL_DEBUG AND MYSQL_LIB_DIR)
+  message("DBG: User gave MYSQL_LIB_DIR = \"${MYSQL_LIB_DIR}\"")
+endif()
+
+if(MYSQL_LIB_DIR)
+
+  if(FINDMYSQL_DEBUG)
+    message("DBG: Using find_library() searching MYSQL_LIB_DIR")
+  endif()
+
+  find_library(MYSQL_LIB
+    NAMES
+      ${_search_libs}
+    PATHS
+      "${MYSQL_LIB_DIR}"
+    NO_DEFAULT_PATH
+  )
+  _check_lib_search_error(MYSQL_LIB_DIR MYSQL_LIB "")
+  set(MYSQL_LIBRARIES ${MYSQL_LIB})
+
+elseif(MYSQL_DIR AND
+       (NOT _mysql_config_in_mysql_dir) AND
+       (NOT _mysql_config_set_by_user))
+
+  if(FINDMYSQL_DEBUG)
+    message("DBG: Using find_library() searching "
+            "MYSQL_DIR and \"${_pp_lib_subdirs}\"")
+  endif()
+
+  find_library(MYSQL_LIB
+    NAMES
+      ${_search_libs}
+    PATHS
+      "${MYSQL_DIR}"
+    PATH_SUFFIXES
+      ${_lib_subdirs}
+    NO_DEFAULT_PATH
+  )
+  _check_lib_search_error(MYSQL_DIR MYSQL_LIB "in \"${_pp_lib_subdirs}\"")
+  get_filename_component(MYSQL_LIB_DIR "${MYSQL_LIB}" PATH)
+  set(MYSQL_LIBRARIES "${MYSQL_LIB}")
+
+elseif(MYSQL_CONFIG_EXECUTABLE)
+
+  if(FINDMYSQL_DEBUG)
+    message("DBG: Using \"mysql_config\" to find the libraries")
+  endif()
+
+  # This code assumes there is just one "-L...." and that
+  # no space between "-L" and the path
+  _mysql_config(MYSQL_LIB_DIR "(^| )-L" "--libs")
+  if(NOT MYSQL_LIB_DIR)
+    message(FATAL_ERROR "Could not find the library dir from running "
+                        "\"${MYSQL_CONFIG_EXECUTABLE}\"")
+  endif()
+
+  if(NOT EXISTS "${MYSQL_LIB_DIR}")
+    message(FATAL_ERROR "Could not find the directory \"${MYSQL_LIB_DIR}\" "
+                        "found from running \"${MYSQL_CONFIG_EXECUTABLE}\"")
+  endif()
+
+  # We have the assumed MYSQL_LIB_DIR. The output from "mysql_config"
+  # might not be correct for static libraries, so we might need to
+  # adjust MYSQL_LIB_DIR later on.
+
+  if(MYSQLCLIENT_STATIC_LINKING)
+
+    # Find the static library, might be one level down
+    find_library(MYSQL_LIB
+      NAMES
+        ${_search_libs}
+      PATHS
+        ${MYSQL_LIB_DIR}
+      PATH_SUFFIXES
+        ${_static_subdirs}
+      NO_DEFAULT_PATH
+    )
+    _check_lib_search_error(MYSQL_LIB_DIR MYSQL_LIB "in \"${_static_subdirs}\"")
+
+    # Adjust MYSQL_LIB_DIR in case it changes
+    get_filename_component(MYSQL_LIB_DIR "${MYSQL_LIB}" PATH)
+
+    # Replace the current library references with the full path
+    # to the library, i.e. the -L will be ignored
+    _mysql_config_replace(MYSQL_LIBRARIES
+           "(mysqlclient|mysqlclient_r)" "${MYSQL_LIB}" "(^| )-l" "--libs")
+
+  else()
+
+    _mysql_config(MYSQL_LIBRARIES "(^| )-l" "--libs")
+
+    # First library is assumed to be the client library
+    list(GET MYSQL_LIBRARIES 0 _search_libs)
+    find_library(MYSQL_LIB
+      NAMES
+        ${_search_libs}
+      PATHS
+        ${MYSQL_LIB_DIR}
+      NO_DEFAULT_PATH
+    )
+    _check_lib_search_error(MYSQL_LIB_DIR MYSQL_LIB "")
+
+  endif()
+
+else()
+
+  if(FINDMYSQL_DEBUG)
+    message("DBG: Using find_library() searching "
+            "\"${_pp_lib_fallback_path}\" to find the client library")
+  endif()
+
+  # Search standard places
+  find_library(MYSQL_LIB
+    NAMES
+      ${_search_libs}
+    PATHS
+      ${_lib_fallback_path}
+  )
+  if(NOT MYSQL_LIB)
+    message(FATAL_ERROR "Could not find \"${_pp_search_libs}\" from searching "
+                        "\"${_pp_lib_fallback_path}\"")
+  endif()
+
+  get_filename_component(MYSQL_LIB_DIR "${MYSQL_LIB}" PATH)
+
+endif()
+
+##########################################################################
+#
+# Add more libraries to MYSQL_LIBRARIES
+#
+##########################################################################
+
+# FIXME needed?!
+if(MYSQLCLIENT_STATIC_LINKING AND
+   NOT WIN32 AND
+   NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+  list(APPEND MYSQL_LIBRARIES "rt")
+endif()
+
+if(MYSQL_EXTRA_LIBRARIES)
+  separate_arguments(MYSQL_EXTRA_LIBRARIES)
+  list(APPEND MYSQL_LIBRARIES ${MYSQL_EXTRA_LIBRARIES})
+endif()
+
+# For compatibility
+SET(MYSQL_CLIENT_LIBS ${MYSQL_LIBRARIES})
+
+##########################################################################
+#
+# If not found MySQL Serverv version, compile a small client app
+# and let it write a small cmake file with the settings
+#
+##########################################################################
+
+if(MYSQL_INCLUDE_DIR AND NOT MYSQL_VERSION)
+
+  # Write the C source file that will include the MySQL headers
+  set(GETMYSQLVERSION_SOURCEFILE "${CMAKE_CURRENT_BINARY_DIR}/getmysqlversion.c")
+  file(WRITE "${GETMYSQLVERSION_SOURCEFILE}"
+       "#include <mysql.h>\n"
+       "#include <stdio.h>\n"
+       "int main() {\n"
+       "  printf(\"%s\", MYSQL_SERVER_VERSION);\n"
+       "}\n"
+  )
+
+  # Compile and run the created executable, store output in MYSQL_VERSION
+  try_run(_run_result _compile_result
+    "${CMAKE_BINARY_DIR}"
+    "${GETMYSQLVERSION_SOURCEFILE}"
+    CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${MYSQL_INCLUDE_DIR}"
+    RUN_OUTPUT_VARIABLE MYSQL_VERSION
+  )
+
+  if(FINDMYSQL_DEBUG)
+    if(NOT _compile_result)
+      message("DBG: Could not compile \"getmysqlversion.c\"")
+    endif()
+    if(_run_result)
+      message("DBG: Running \"getmysqlversion\" returned ${_run_result}")
+    endif()
+  endif()
+
+endif()
+
+##########################################################################
+#
+# Clean up MYSQL_VERSION and create MYSQL_VERSION_ID/MYSQL_NUM_VERSION
+#
+##########################################################################
+
+if(NOT MYSQL_VERSION)
+  message(FATAL_ERROR "Could not determine the MySQL Server version")
+endif()
+
+# Clean up so only numeric, in case of "-alpha" or similar
+string(REGEX MATCHALL "([0-9]+.[0-9]+.[0-9]+)" MYSQL_VERSION "${MYSQL_VERSION}")
+# To create a fully numeric version, first normalize so N.NN.NN
+string(REGEX REPLACE "[.]([0-9])[.]" ".0\\1." MYSQL_VERSION_ID "${MYSQL_VERSION}")
+string(REGEX REPLACE "[.]([0-9])$"   ".0\\1"  MYSQL_VERSION_ID "${MYSQL_VERSION_ID}")
+# Finally remove the dot
+string(REGEX REPLACE "[.]" "" MYSQL_VERSION_ID "${MYSQL_VERSION_ID}")
+set(MYSQL_NUM_VERSION ${MYSQL_VERSION_ID})
+
+##########################################################################
+#
+# Try determine if to use C++ linkage, and also find C++ flags
+#
+##########################################################################
+
+if(NOT WIN32)
+
+  if(MYSQL_CONFIG_EXECUTABLE)
+
+    if(NOT MYSQL_CFLAGS)
+      _mysql_conf(MYSQL_CFLAGS "--cflags")
+    endif()
+
+    if(NOT MYSQL_CXXFLAGS)
+      if(MYSQL_CXX_LINKAGE OR MYSQL_VERSION_ID GREATER 50603)
+        _mysql_conf(MYSQL_CXXFLAGS "--cxxflags")
+        set(MYSQL_CXX_LINKAGE 1)
+      else()
+        set(MYSQL_CXXFLAGS "${MYSQL_CFLAGS}")
+      endif()
+    endif()
+
+# FIXME this should not be needed, caller of this module should set
+#       it's own flags and just use the library on it's on terms
+#       (change the infe message if enabling this code)
+#   if(NOT MYSQL_LINK_FLAGS)
+#     # Find -mcpu -march -mt -m32 -m64 and other flags starting with "-m"
+#     string(REGEX MATCHALL "(^| )-m([^\r\n ]+)" MYSQL_LINK_FLAGS "${MYSQL_CXXFLAGS}")
+#     string(REGEX REPLACE "^ " ""  MYSQL_LINK_FLAGS "${MYSQL_LINK_FLAGS}")
+#     string(REGEX REPLACE "; " ";" MYSQL_LINK_FLAGS "${MYSQL_LINK_FLAGS}")
+#   endif()
+
+  endif()
+
+endif()
+
+##########################################################################
+#
+# Inform CMake where to look for headers and libraries
+#
+##########################################################################
+
+# string(TOUPPER "${CMAKE_BUILD_TYPE}" CMAKEBT)
+# set(CMAKE_CXX_FLAGS                "${CMAKE_CXX_FLAGS} ${MYSQL_CXXFLAGS}")
+# set(CMAKE_CXX_FLAGS_${CMAKEBT}     "${CMAKE_CXX_FLAGS_${CMAKEBT}} ${MYSQL_CXXFLAGS}")
+
+include_directories("${MYSQL_INCLUDE_DIR}")
+link_directories("${MYSQL_LIB_DIR}")
+
+##########################################################################
+#
+# Report
+#
+##########################################################################
+
+message(STATUS "MySQL client environment/cmake variables set that the user can override")
+
+message(STATUS "  MYSQL_DIR                   : ${MYSQL_DIR}")
+message(STATUS "  MYSQL_INCLUDE_DIR           : ${MYSQL_INCLUDE_DIR}")
+message(STATUS "  MYSQL_LIB_DIR               : ${MYSQL_LIB_DIR}")
+message(STATUS "  MYSQL_CONFIG_EXECUTABLE     : ${MYSQL_CONFIG_EXECUTABLE}")
+message(STATUS "  MYSQL_CXX_LINKAGE           : ${MYSQL_CXX_LINKAGE}")
+message(STATUS "  MYSQL_CFLAGS                : ${MYSQL_CFLAGS}")
+message(STATUS "  MYSQL_CXXFLAGS              : ${MYSQL_CXXFLAGS}")
+message(STATUS "  MYSQLCLIENT_STATIC_LINKING  : ${MYSQLCLIENT_STATIC_LINKING}")
+message(STATUS "  MYSQLCLIENT_NO_THREADS      : ${MYSQLCLIENT_NO_THREADS}")
+
+message(STATUS "MySQL client optional environment/cmake variables set by the user")
+
+message(STATUS "  MYSQL_EXTRA_LIBRARIES       : ${MYSQL_EXTRA_LIBRARIES}")
+message(STATUS "  MYSQL_LINK_FLAGS            : ${MYSQL_LINK_FLAGS}")
+
+message(STATUS "MySQL client settings that the user can't override")
+
+message(STATUS "  MYSQL_VERSION               : ${MYSQL_VERSION}")
+message(STATUS "  MYSQL_VERSION_ID            : ${MYSQL_VERSION_ID}")
+message(STATUS "  MYSQL_LIB                   : ${MYSQL_LIB}")
+message(STATUS "  MYSQL_LIBRARIES             : ${MYSQL_LIBRARIES}")


Update FindNumPy to work on RHEL

Update FindNumPy to work on RHEL

--- FindNumPy.cmake
+++ FindNumPy.cmake
@@ -1,88 +1,36 @@
-# - Find the NumPy libraries
-# This module finds if NumPy is installed, and sets the following variables
-# indicating where it is.
-#
-# TODO: Update to provide the libraries and paths for linking npymath lib.
-#
-#  NUMPY_FOUND               - was NumPy found
-#  NUMPY_VERSION             - the version of NumPy found as a string
-#  NUMPY_VERSION_MAJOR       - the major version number of NumPy
-#  NUMPY_VERSION_MINOR       - the minor version number of NumPy
-#  NUMPY_VERSION_PATCH       - the patch version number of NumPy
-#  NUMPY_VERSION_DECIMAL     - e.g. version 1.6.1 is 10601
-#  NUMPY_INCLUDE_DIRS        - path to the NumPy include files
+# Find the Python NumPy package
+# PYTHON_NUMPY_INCLUDE_DIR
+# NUMPY_FOUND
+# will be set by this script

-#============================================================================
-# Copyright 2012 Continuum Analytics, Inc.
-#
-# MIT License
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files
-# (the "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to permit
-# persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-# OTHER DEALINGS IN THE SOFTWARE.
-#
-#============================================================================
+cmake_minimum_required(VERSION 2.6)

-# Finding NumPy involves calling the Python interpreter
-if(NumPy_FIND_REQUIRED)
-    find_package(PythonInterp REQUIRED)
-else()
-    find_package(PythonInterp)
-endif()
+if (PYTHON_EXECUTABLE)
+  # write a python script that finds the numpy path
+  file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/FindNumpyPath.py
+      "try: import numpy; print numpy.get_include()\nexcept:pass\n")
+
+  # execute the find script
+  exec_program("${PYTHON_EXECUTABLE}" ${CMAKE_CURRENT_BINARY_DIR}
+    ARGS "FindNumpyPath.py"
+    OUTPUT_VARIABLE NUMPY_PATH)
+else(PYTHON_EXECUTABLE)
+  message("Python executable not found.")
+endif(PYTHON_EXECUTABLE)

-if(PYTHONINTERP_FOUND)
-    execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c"
-        "import numpy as n; print(n.__version__); print(n.get_include());"
-        RESULT_VARIABLE _NUMPY_SEARCH_SUCCESS
-        OUTPUT_VARIABLE _NUMPY_VALUES
-        ERROR_VARIABLE _NUMPY_ERROR_VALUE
-        OUTPUT_STRIP_TRAILING_WHITESPACE)
+find_path(PYTHON_NUMPY_INCLUDE_DIR numpy/arrayobject.h
+  "${NUMPY_PATH}"
+  "${PYTHON_INCLUDE_PATH}"
+  /usr/include/python2.7/
+  /usr/include/python2.6/
+  /usr/include/python2.5/
+  /usr/include/python2.4/)

-    if(_NUMPY_SEARCH_SUCCESS MATCHES 0)
-        set(NUMPY_FOUND TRUE)
+if(PYTHON_NUMPY_INCLUDE_DIR)
+  set(PYTHON_NUMPY_FOUND 1 CACHE INTERNAL "Python numpy found")
+endif(PYTHON_NUMPY_INCLUDE_DIR)

-        # Convert the process output into a list
-        string(REGEX REPLACE ";" "\\\\;" _NUMPY_VALUES ${_NUMPY_VALUES})
-        string(REGEX REPLACE "\n" ";" _NUMPY_VALUES ${_NUMPY_VALUES})
-        list(GET _NUMPY_VALUES 0 NUMPY_VERSION)
-        list(GET _NUMPY_VALUES 1 NUMPY_INCLUDE_DIRS)
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Numpy DEFAULT_MSG
+        PYTHON_NUMPY_INCLUDE_DIR)

-        # Make sure all directory separators are '/'
-        string(REGEX REPLACE "\\\\" "/" NUMPY_INCLUDE_DIRS ${NUMPY_INCLUDE_DIRS})
-
-        # Get the major and minor version numbers
-        string(REGEX REPLACE "\\." ";" _NUMPY_VERSION_LIST ${NUMPY_VERSION})
-        list(GET _NUMPY_VERSION_LIST 0 NUMPY_VERSION_MAJOR)
-        list(GET _NUMPY_VERSION_LIST 1 NUMPY_VERSION_MINOR)
-        list(GET _NUMPY_VERSION_LIST 2 NUMPY_VERSION_PATCH)
-        math(EXPR NUMPY_VERSION_DECIMAL
-            "(${NUMPY_VERSION_MAJOR} * 10000) + (${NUMPY_VERSION_MINOR} * 100) + ${NUMPY_VERSION_PATCH}")
-
-        find_package_message(NUMPY
-            "Found NumPy: version \"${NUMPY_VERSION}\" ${NUMPY_INCLUDE_DIRS}"
-            "${NUMPY_INCLUDE_DIRS}${NUMPY_VERSION}")
-    else()
-        if(NumPy_FIND_REQUIRED)
-            message(FATAL_ERROR
-                "NumPy import failure:\n${_NUMPY_ERROR_VALUE}")
-        endif()
-        set(NUMPY_FOUND FALSE)
-    endif()
-else()
-    set(NUMPY_FOUND FALSE)
-endif()


fix mingw build (#152)

fix mingw build (#152)

--- Build.cmake
+++ Build.cmake
@@ -54,11 +54,12 @@
        set(PLATFORM_LINK_LIBRIES rt)
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -rdynamic -Wunused -std=c++11 -pthread -lrt -D_GLIBCXX_USE_NANOSLEEP -D_GLIBCXX_USE_SCHED_YIELD")
    ENDIF()
+ELSEIF(MSVC)
+   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8") # source code already in utf-8, force it for compilers in non-utf8_windows_locale
 ENDIF()

 IF (MSVC OR MINGW)
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8") # source code already in utf-8, force it for compilers in non-utf8_windows_locale
   set(PLATFORM_LINK_LIBRIES dbghelp)
       # VC11 bug: http://code.google.com/p/googletest/issues/detail?id=408
       #          add_definition(-D_VARIADIC_MAX=10)


Fix cmake error when no icon is set and support spaces in icon path

--- packages/pack-template.cmake
+++ packages/pack-template.cmake
@@ -67,7 +67,7 @@

     # NSIS package information

-    if(WIN32)
+    if(WIN32 AND CPACK_PACKAGE_ICON)
         # NOTE: for using MUI (UN)WELCOME images we suggest to replace nsis defaults,
         # since there is currently no way to do so without manipulating the installer template (which we won't).
         # http://public.kitware.com/pipermail/cmake-developers/2013-January/006243.html
@@ -78,7 +78,7 @@
         # so just replacing / with \\ manually.

         #file(TO_NATIVE_PATH "${CPACK_PACKAGE_ICON}" CPACK_PACKAGE_ICON)
-        string(REGEX REPLACE "/" "\\\\\\\\" CPACK_PACKAGE_ICON ${CPACK_PACKAGE_ICON})
+        string(REGEX REPLACE "/" "\\\\\\\\" CPACK_PACKAGE_ICON "${CPACK_PACKAGE_ICON}")
     endif()

     if(X64)


WIP: Hopefully fixed CMake Error looking for build/src directory. w/ Floris.

--- CTest.cmake
+++ CTest.cmake
@@ -45,7 +45,7 @@
 set(CTEST_CONFIGURE_COMMAND "${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE:STRING=${CTEST_BUILD_CONFIGURATION} --build ${CTEST_BINARY_DIRECTORY}")
 set(CTEST_CONFIGURE_COMMAND "${CTEST_CONFIGURE_COMMAND} -DWITH_TESTING:BOOL=ON ${CTEST_BUILD_OPTIONS}")
 set(CTEST_CONFIGURE_COMMAND "${CTEST_CONFIGURE_COMMAND} \"-G${CTEST_CMAKE_GENERATOR}\"")
-set(CTEST_CONFIGURE_COMMAND "${CTEST_CONFIGURE_COMMAND} \"${CTEST_SOURCE_DIRECTORY}\"")
+set(CTEST_CONFIGURE_COMMAND "${CTEST_CONFIGURE_COMMAND} \"../${CTEST_SOURCE_DIRECTORY}\"")

 ctest_start("Nightly")
 ctest_configure()


flags/sanitize_leak: update C flags too

flags/sanitize_leak: update C flags too

--- flags/sanitize_leak.cmake
+++ flags/sanitize_leak.cmake
@@ -8,5 +8,9 @@
 endif()

 include(polly_add_cache_flag)
+
 polly_add_cache_flag(CMAKE_CXX_FLAGS "-fsanitize=leak")
 polly_add_cache_flag(CMAKE_CXX_FLAGS "-g")
+
+polly_add_cache_flag(CMAKE_C_FLAGS "-fsanitize=leak")
+polly_add_cache_flag(CMAKE_C_FLAGS "-g")


BRICS_3D is now compatible with OpenCV 2.2

--- external/cmake_modules/FindOpenCV.cmake
+++ external/cmake_modules/FindOpenCV.cmake
@@ -141,29 +141,29 @@
 # some are optionally, some may not exist on Linux
 #
 FIND_LIBRARY(OpenCV_CV_LIBRARY
-  NAMES cv opencv
+  NAMES cv opencv opencv_imgproc
   PATHS ${OpenCV_ROOT_DIR}
   PATH_SUFFIXES  ${OpenCV_LIBDIR_SUFFIXES} )
 FIND_LIBRARY(OpenCV_CVAUX_LIBRARY
-  NAMES cvaux
+  NAMES cvaux opencv_calib3d  opencv_contrib opencv_gpu #TODO just a guess
   PATHS ${OpenCV_ROOT_DIR}  PATH_SUFFIXES ${OpenCV_LIBDIR_SUFFIXES} )
 FIND_LIBRARY(OpenCV_CVCAM_LIBRARY
-  NAMES cvcam
+  NAMES cvcam opencv_video #TODO just a guess
   PATHS ${OpenCV_ROOT_DIR}  PATH_SUFFIXES ${OpenCV_LIBDIR_SUFFIXES} )
 FIND_LIBRARY(OpenCV_CVHAARTRAINING_LIBRARY
-  NAMES cvhaartraining
+  NAMES cvhaartraining opencv_objdetect
   PATHS ${OpenCV_ROOT_DIR}  PATH_SUFFIXES ${OpenCV_LIBDIR_SUFFIXES} )
 FIND_LIBRARY(OpenCV_CXCORE_LIBRARY
-  NAMES cxcore
+  NAMES cxcore opencv_core
   PATHS ${OpenCV_ROOT_DIR}  PATH_SUFFIXES ${OpenCV_LIBDIR_SUFFIXES} )
 FIND_LIBRARY(OpenCV_CXTS_LIBRARY
   NAMES cxts
   PATHS ${OpenCV_ROOT_DIR}  PATH_SUFFIXES ${OpenCV_LIBDIR_SUFFIXES} )
 FIND_LIBRARY(OpenCV_HIGHGUI_LIBRARY
-  NAMES highgui
+  NAMES highgui opencv_highgui
   PATHS ${OpenCV_ROOT_DIR}  PATH_SUFFIXES ${OpenCV_LIBDIR_SUFFIXES} )
 FIND_LIBRARY(OpenCV_ML_LIBRARY
-  NAMES ml
+  NAMES ml opencv_ml opencv_features2d opencv_flann
   PATHS ${OpenCV_ROOT_DIR}  PATH_SUFFIXES ${OpenCV_LIBDIR_SUFFIXES} )
 FIND_LIBRARY(OpenCV_TRS_LIBRARY
   NAMES trs


Fix #17 add realpath_error_injection to CTestCustom.cmake

--- backup/CTestCustom.cmake
+++ backup/CTestCustom.cmake
@@ -33,6 +33,7 @@
  null_dest_dir_6317
  nondir_dest_dir_6317
  readdirfails_dest_dir
+ realpath_error_injection
  rename_injection
  range_locks
  read_and_seek