Update Y3 dependencies

Update Y3 dependencies

--- bootstrap/get.cmake
+++ bootstrap/get.cmake
@@ -188,11 +188,11 @@
 y3_package(zlib)

 if("catch2" IN_LIST _y3_packages)
-  set(_version "2.3.0")
+  set(_version "2.4.0")
   set(_package "Catch2-${_version}")
   y3_download("https://github.com/catchorg/Catch2/archive/v${_version}.tar.gz"
     NAME "${_package}.tar.gz"
-    SHA1 "e913061207ca04dcd3d29e49a226f8caa26304fa")
+    SHA1 "f486921476d2fde3f24f980b5577b442510301b8")
   y3_extract("${_package}.tar.gz" DIR ${_package})
   y3_cmake(${_package} HEADER_ONLY
     OPTIONS -DCATCH_BUILD_TESTING=OFF -DCATCH_INSTALL_DOCS=OFF -DCATCH_INSTALL_HELPERS=OFF -DPKGCONFIG_INSTALL_DIR=${CMAKE_BINARY_DIR}/.trash)
@@ -231,9 +231,10 @@
 endif()

 if("openal" IN_LIST _y3_packages)
-  set(_version "1.18.2")
+  set(_version "1.19.0")
   set(_package "openal-soft-${_version}-bin")
-  y3_download("http://openal-soft.org/openal-binaries/${_package}.zip" SHA1 "0d2edd1b77cbb998f12e064d0eefea3508446776")
+  y3_download("http://openal-soft.org/openal-binaries/${_package}.zip"
+    SHA1 "1b4b321166a4d62588efb52d9d0da17db724eac6")
   y3_extract("${_package}.zip" DIR ${_package})
   file(INSTALL
     ${BUILD_DIR}/${_package}/include
@@ -315,13 +316,13 @@
 endif()

 if("jpeg" IN_LIST _y3_packages)
-  set(_version "1.5.3")
+  set(_version "2.0.0")
   set(_package "libjpeg-turbo-${_version}")
   y3_download("https://downloads.sourceforge.net/project/libjpeg-turbo/${_version}/${_package}.tar.gz"
-    SHA1 "87ebf4cab2bb27fcb8e7ccb18ec4eb680e1f2c2d")
+    SHA1 "fe49aea935617748c21ecbe46c986d6c1b98f39b")
   y3_extract("${_package}.tar.gz" DIR ${_package})
   y3_cmake(${_package} TARGET "jpeg-static" BUILD_TO_PREFIX
-    OPTIONS -DNASM=${NASM_EXECUTABLE} -DWITH_CRT_DLL=ON -DWITH_TURBOJPEG=OFF)
+    OPTIONS -DCMAKE_ASM_NASM_COMPILER=${NASM_EXECUTABLE} -DENABLE_SHARED=OFF -DREQUIRE_SIMD=ON -DWITH_TURBOJPEG=OFF)
   file(INSTALL
     ${BUILD_DIR}/${_package}/jconfig.h
     ${BUILD_DIR}/${_package}/jerror.h


Include CMake legacy module when used

Include CMake legacy module when used

When building the Wrapping directories as standalone modules, this
required include was not available.

--- CMake/sitkForbidDownloadsOption.cmake
+++ CMake/sitkForbidDownloadsOption.cmake
@@ -1,3 +1,5 @@
+
+include(sitkSITKLegacyNaming)

 #-----------------------------------------------------------------------------
 # Forbid downloading resources from the network during a build. This helps


Force LF: config.cmake

Force LF: config.cmake

--- cmake/modules/hunter_calculate_config_sha1.cmake
+++ cmake/modules/hunter_calculate_config_sha1.cmake
@@ -83,8 +83,10 @@
   file(REMOVE_RECURSE "${work_dir}")
   file(MAKE_DIRECTORY "${work_dir}")

-  set(input_file "${work_dir}/config.cmake")
-  file(WRITE "${input_file}" "include(hunter_final_config)\n")
+  set(config_cmake_nolf "${work_dir}/config.cmake.NOLF")
+  set(config_cmake_local "${work_dir}/config.cmake")
+
+  file(WRITE "${config_cmake_nolf}" "include(hunter_final_config)\n")
   foreach(x ${projects})
     set(version "${HUNTER_${x}_VERSION}")
     if("${version}" STREQUAL "")
@@ -94,7 +96,7 @@

     file(
         APPEND
-        "${input_file}"
+        "${config_cmake_nolf}"
         "hunter_final_config(\n"
         "    PACKAGE \"${x}\"\n"
         "    VERSION \"${version}\"\n"
@@ -107,37 +109,47 @@
     set(keep_package_sources "${__HUNTER_USER_KEEP_PACKAGE_SOURCES_${x}}")

     if(NOT sha1 STREQUAL "")
-      file(APPEND "${input_file}" "    SHA1 \"${sha1}\"\n")
+      file(APPEND "${config_cmake_nolf}" "    SHA1 \"${sha1}\"\n")
     endif()

     if(NOT cmake_args STREQUAL "")
-      file(APPEND "${input_file}" "    CMAKE_ARGS \"${cmake_args}\"\n")
+      file(APPEND "${config_cmake_nolf}" "    CMAKE_ARGS \"${cmake_args}\"\n")
     endif()

     if(NOT configuration_types STREQUAL "")
       file(
           APPEND
-          "${input_file}"
+          "${config_cmake_nolf}"
           "    CONFIGURATION_TYPES \"${configuration_types}\"\n"
       )
     endif()

     if(NOT url STREQUAL "")
-      file(APPEND "${input_file}" "    URL \"${url}\"\n")
+      file(APPEND "${config_cmake_nolf}" "    URL \"${url}\"\n")
     endif()

     if(NOT keep_package_sources STREQUAL "")
       if(keep_package_sources STREQUAL "TRUE")
-        file(APPEND "${input_file}" "    KEEP_PACKAGE_SOURCES\n")
+        file(APPEND "${config_cmake_nolf}" "    KEEP_PACKAGE_SOURCES\n")
       else()
         hunter_internal_error("Unexpected value: '${keep_package_sources}'")
       endif()
     endif()

-    file(APPEND "${input_file}" ")\n")
+    file(APPEND "${config_cmake_nolf}" ")\n")
   endforeach()

-  file(SHA1 "${work_dir}/config.cmake" HUNTER_GATE_CONFIG_SHA1)
+  # About '@ONLY': no substitutions expected but COPYONLY can't be
+  # used with NEWLINE_STYLE
+  configure_file(
+      "${config_cmake_nolf}"
+      "${config_cmake_local}"
+      @ONLY
+      NEWLINE_STYLE LF
+  )
+
+  file(SHA1 "${config_cmake_local}" HUNTER_GATE_CONFIG_SHA1)
+
   set(HUNTER_GATE_CONFIG_SHA1 "${HUNTER_GATE_CONFIG_SHA1}" PARENT_SCOPE)
   hunter_make_directory("${hunter_base}" "${HUNTER_GATE_SHA1}" hunter_id_path)

@@ -153,21 +165,21 @@
       hunter_config_id_path
   )

-  set(dst "${hunter_config_id_path}/config.cmake")
+  set(config_cmake_global "${hunter_config_id_path}/config.cmake")

-  if(EXISTS "${dst}")
+  if(EXISTS "${config_cmake_global}")
     return()
   endif()

   hunter_lock_directory("${hunter_config_id_path}" "")
-  if(EXISTS "${dst}")
+  if(EXISTS "${config_cmake_global}")
     return()
   endif()

-  set(temp "${hunter_config_id_path}/config.cmake.TEMP")
-  configure_file("${work_dir}/config.cmake" "${temp}" COPYONLY)
+  set(config_cmake_torename "${hunter_config_id_path}/config.cmake.TORENAME")
+  configure_file("${config_cmake_local}" "${config_cmake_torename}" COPYONLY)

-  file(RENAME "${temp}" "${dst}")
-  hunter_status_debug("Config: ${dst}")
+  file(RENAME "${config_cmake_torename}" "${config_cmake_global}")
+  hunter_status_debug("Config: ${config_cmake_global}")
   hunter_status_debug("Config sha1: ${HUNTER_GATE_CONFIG_SHA1}")
 endfunction()


Update FindNumPy.cmake script.

Update FindNumPy.cmake script.

--- cmake/TbagFindPackage/FindNumPy.cmake
+++ cmake/TbagFindPackage/FindNumPy.cmake
@@ -9,11 +9,18 @@
     return ()
 endif ()

-if (NOT PYTHONINTERP_FOUND)
+if (Python3_Interpreter_FOUND)
+    set (__python_executable ${Python3_EXECUTABLE})
+elseif (Python_Interpreter_FOUND)
+    set (__python_executable ${Python_EXECUTABLE})
+elseif (PYTHONINTERP_FOUND)
+    set (__python_executable ${PYTHON_EXECUTABLE})  ## Legacy
+else ()
+    set (__python_executable python)
     message (WARNING "FindNumpy: Not found Python interpreter.")
 endif ()

-execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" "import numpy as n; print(n.__version__); print(n.get_include());"
+execute_process(COMMAND "${__python_executable}" "-c" "import numpy as n; print(n.__version__); print(n.get_include());"
                 RESULT_VARIABLE __result
                 OUTPUT_VARIABLE __output
                 OUTPUT_STRIP_TRAILING_WHITESPACE)


Restore pkgconfig on windows to avoid configure error. (#100)

--- cmake/bde_external_dependencies.cmake
+++ cmake/bde_external_dependencies.cmake
@@ -5,15 +5,13 @@
 include(bde_utils)
 include(bde_pkgconfig_utils)

-if (NOT WIN32)
-    find_program(PKG_CONFIG_EXECUTABLE pkg-config PATHS
-        ${CMAKE_PREFIX_PATH}/${CMAKE_INSTALL_LIBDIR}/bin
-        /opt/bb/${CMAKE_INSTALL_LIBDIR}/bin
-        NO_DEFAULT_PATH)
-
-    # Initialize pkg config module
-    find_package(PkgConfig)
-endif()
+find_program(PKG_CONFIG_EXECUTABLE pkg-config PATHS
+    ${CMAKE_PREFIX_PATH}/${CMAKE_INSTALL_LIBDIR}/bin
+    /opt/bb/${CMAKE_INSTALL_LIBDIR}/bin
+    NO_DEFAULT_PATH)
+
+# Initialize pkg config module
+find_package(PkgConfig)

 # :: bde_import_target_raw_library ::
 # -----------------------------------------------------------------------------


Compile for 64 bit

Compile for 64 bit

--- build/XMP_Ios.cmake
+++ build/XMP_Ios.cmake
@@ -18,7 +18,7 @@

 set(XMP_PLATFORM_SHORT "ios")

-set(CMAKE_OSX_ARCHITECTURES "$(ARCHS_STANDARD_32_BIT)")
+#set(CMAKE_OSX_ARCHITECTURES "$(ARCHS_STANDARD_32_BIT)")

 add_definitions(-DIOS_ENV=1)

@@ -106,4 +106,4 @@
 	set(XMPPLUGIN_OUTPUT_DIR ${PROJECT_SOURCE_DIR}/${XMP_THIS_PROJECT_RELATIVEPATH}/XMPFilesPlugins/public/${XMP_PLATFORM_FOLDER}/${XMP_BUILDMODE_DIR} PARENT_SCOPE)

 	# each plugin project should implement function named SetupProjectSpecifiedDirectories to specify the directories used by project itself
-endfunction(SetupGeneralDirectories)+endfunction(SetupGeneralDirectories)


disable RTTI by default

disable RTTI by default

--- build_options.cmake
+++ build_options.cmake
@@ -65,7 +65,7 @@
 endif()

 option( TNUN_ALLOW_EXCEPTIONS "Allow exception support in C++ code" true )
-option( TNUN_ALLOW_RTTI "Allow Runtime Type Information in C++ code" true )
+option( TNUN_ALLOW_RTTI "Allow Runtime Type Information in C++ code" false )

 if( ${CMAKE_GENERATOR} MATCHES "Visual Studio" )
     if( ${TNUN_ALLOW_EXCEPTIONS} )


BUG: MIDAS+CTest macro: paths with directories were broken on linux

SVN-Revision: 3385

--- Application/CMakeScript/MIDAS.cmake
+++ Application/CMakeScript/MIDAS.cmake
@@ -136,7 +136,7 @@
 file(MAKE_DIRECTORY \"${MIDAS_DATA_DIR}/${base_filepath}\")
 file(MAKE_DIRECTORY \"${MIDAS_DATA_DIR}/${testName}_${base_filepath}\")
 file(REMOVE \"${MIDAS_DATA_DIR}/${testName}_${base_file}\")
-execute_process(COMMAND \"${CMAKE_COMMAND}\" -E ${cmake_symlink} \"MIDAS_Hashes/${checksum}\" \"${MIDAS_DATA_DIR}/${testName}_${base_file}\" WORKING_DIRECTORY \"${MIDAS_DATA_DIR}\")
+execute_process(COMMAND \"${CMAKE_COMMAND}\" -E ${cmake_symlink} \"MIDAS_Hashes/${checksum}\" \"${testName}_${base_file}\" WORKING_DIRECTORY \"${MIDAS_DATA_DIR}\")
 file(RENAME \"${MIDAS_DATA_DIR}/${testName}_${base_file}\" \"${MIDAS_DATA_DIR}/${base_file}\")
 ")


LuxMark: changed version to beta2

LuxMark: changed version to beta2

--- cmake/AssembleBinDirs.cmake
+++ cmake/AssembleBinDirs.cmake
@@ -123,8 +123,8 @@

 ELSE (WIN32)

-	set(LUXMARK_LINUX64_BIN_DIR "luxmark-linux64-v2.1beta1")
-	set(LUXMARK_WIN32_BIN_DIR "luxmark-win32-v2.1beta1")
+	set(LUXMARK_LINUX64_BIN_DIR "luxmark-linux64-v2.1beta2")
+	set(LUXMARK_WIN32_BIN_DIR "luxmark-win32-v2.1beta2")

 	# Win32
 	add_custom_command(
@@ -155,7 +155,7 @@
 	    COMMAND cp AUTHORS.txt COPYING.txt README.txt ${LUXMARK_LINUX64_BIN_DIR}
 		COMMAND cp samples/luxmark/linux-64bit/* ${LUXMARK_LINUX64_BIN_DIR}
 	    COMMENT "Building ${LUXMARK_LINUX64_BIN_DIR}")
-
+
 	add_custom_command(
 	    OUTPUT "${LUXMARK_LINUX64_BIN_DIR}.zip"
 	    COMMAND zip -r ${LUXMARK_LINUX64_BIN_DIR}.zip ${LUXMARK_LINUX64_BIN_DIR}


Add logic to find intel OpenMP on oneMKL.

--- cmake/Modules/FindMKL.cmake
+++ cmake/Modules/FindMKL.cmake
@@ -25,6 +25,8 @@
 set(MKL_HINTS
   ${MKL_ROOT}
   $ENV{MKL_ROOT}
+  $ENV{MKLROOT}
+  $ENV{CMPLR_ROOT}
 )
 set(MKL_PATHS
   /usr
@@ -47,11 +49,14 @@
 mark_as_advanced(MKL_INCLUDE_DIRS)

 # Finds the libraries
-set(MKL_LIB_SUFFIXES lib lib64 lib/x86_64 lib/x64 lib/x86 lib/Win32 lib/import lib64/import lib/intel64)
+set(MKL_LIB_SUFFIXES
+  lib lib64 lib/x86_64 lib/x64 lib/x86 lib/Win32 lib/import lib64/import lib/intel64
+  linux/compiler/lib/intel64
+  windows/compiler/lib/intel64)
 find_library(MKL_LIBRARIES_LP64 NAMES mkl_intel_lp64 HINTS ${MKL_HINTS} PATH_SUFFIXES ${MKL_LIB_SUFFIXES} PATHS ${MKL_PATHS} DOC "Intel MKL lp64 library")
 find_library(MKL_LIBRARIES_THREAD NAMES mkl_intel_thread HINTS ${MKL_HINTS} PATH_SUFFIXES ${MKL_LIB_SUFFIXES} PATHS ${MKL_PATHS} DOC "Intel MKL thread library")
 find_library(MKL_LIBRARIES_CORE NAMES mkl_core HINTS ${MKL_HINTS} PATH_SUFFIXES ${MKL_LIB_SUFFIXES} PATHS ${MKL_PATHS} DOC "Intel MKL core library")
-find_library(MKL_LIBRARIES_OMP NAMES iomp5 HINTS ${MKL_HINTS} PATH_SUFFIXES ${MKL_LIB_SUFFIXES} PATHS ${MKL_PATHS} DOC "Intel OpenMP library")
+find_library(MKL_LIBRARIES_OMP NAMES iomp5 libiomp5md HINTS ${MKL_HINTS} PATH_SUFFIXES ${MKL_LIB_SUFFIXES} PATHS ${MKL_PATHS} DOC "Intel OpenMP library")
 set(MKL_LIBRARIES ${MKL_LIBRARIES_LP64} ${MKL_LIBRARIES_THREAD} ${MKL_LIBRARIES_CORE} ${MKL_LIBRARIES_OMP})
 mark_as_advanced(MKL_LIBRARIES)

@@ -59,14 +64,14 @@

 # Notification messages
 if(NOT MKL_INCLUDE_DIRS)
-    message(STATUS "Could NOT find 'mkl_cblas.h', install MKL or set MKL_ROOT")
+    message(STATUS "Could NOT find 'mkl_cblas.h', install it or set MKLROOT and CMPLR_ROOT or source setvars.sh or setvars.bat")
 endif()
 if(NOT MKL_LIBRARIES)
-    message(STATUS "Could NOT find the Intel MKL BLAS library, install it or set MKL_ROOT")
+    message(STATUS "Could NOT find the Intel MKL BLAS library, install it or set MKLROOT and CMPLR_ROOT or source setvars.sh or setvars.bat")
 endif()

 # Determines whether or not MKL was found
 include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(MKL DEFAULT_MSG MKL_INCLUDE_DIRS MKL_LIBRARIES)
+find_package_handle_standard_args(MKL DEFAULT_MSG MKL_INCLUDE_DIRS MKL_LIBRARIES_LP64 MKL_LIBRARIES_THREAD MKL_LIBRARIES_CORE MKL_LIBRARIES_OMP)

 # ==================================================================================================


inttypes.h repair +

inttypes.h repair +

--- cmake/MyPackageRepair.cmake
+++ cmake/MyPackageRepair.cmake
@@ -2,30 +2,31 @@
   #
   # We optionaly create a __fixme__.cmake
   #
+  SET (FIXME_CMAKE_SINGLETON FALSE)
+  SET (HAVE_STDINT_H FALSE)
+  SET (HAVE_INTTYPES_H FALSE)
   IF (NOT FIXME_CMAKE_SINGLETON)
-    GET_PROPERTY(source_dir GLOBAL PROPERTY MYPACKAGE_SOURCE_DIR)
-    MESSAGE(STATUS "Generating a __fixme__.cmake")
-    SET (FIXME_CMAKE "__fixme__.cmake")
-    GET_FILENAME_COMPONENT(FIXME_CMAKE_ABSOLUTE ${FIXME_CMAKE} ABSOLUTE)
-    FILE(WRITE ${FIXME_CMAKE_ABSOLUTE} "# CMake settings to be propagated whenever you want - typically used for ExternalProject_Add\n")
-    MARK_AS_ADVANCED (FIXME_CMAKE_ABSOLUTE)
-    SET (FIXME_CMAKE_SINGLETON TRUE CACHE BOOL "__fixme__.cmake singleton")
-    MARK_AS_ADVANCED (FIXME_CMAKE_SINGLETON)
-  ENDIF ()
-  IF ((NOT HAVE_STDINT_H) OR (NOT HAVE_INTTYPES_H))
-    GET_PROPERTY(source_dir_set GLOBAL PROPERTY MYPACKAGE_SOURCE_DIR SET)
-    IF (NOT ${source_dir_set})
-      MESSAGE (WARNING "Cannot repair anything if any, property MYPACKAGE_SOURCE_DIR is not set")
-    ELSE ()
+    IF ((NOT HAVE_STDINT_H) OR (NOT HAVE_INTTYPES_H))
       GET_PROPERTY(source_dir GLOBAL PROPERTY MYPACKAGE_SOURCE_DIR)
-      SET(MYPACKAGE_GENERATED_INCLUDE_DIR "__generated_include_dir__")
-      FILE(MAKE_DIRECTORY ${MYPACKAGE_GENERATED_INCLUDE_DIR})
-      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_ABSOLUTE} "MESSAGE(STATUS \"Append to INCLUDE_DIRECTORIES: ${_MYPACKAGE_GENERATED_INCLUDE_DIR_ABSOLUTE}\")\n")
-      FILE(APPEND ${FIXME_CMAKE_ABSOLUTE} "INCLUDE_DIRECTORIES(${_MYPACKAGE_GENERATED_INCLUDE_DIR_ABSOLUTE})\n")
-      IF (NOT STDINT_H_SINGLETON)
+      MESSAGE(STATUS "Generating a __fixme__.cmake")
+      SET (FIXME_CMAKE "__fixme__.cmake")
+      GET_FILENAME_COMPONENT(FIXME_CMAKE_ABSOLUTE ${FIXME_CMAKE} ABSOLUTE)
+      FILE(WRITE ${FIXME_CMAKE_ABSOLUTE} "# CMake settings to be propagated whenever you want - typically used for ExternalProject_Add\n")
+      MARK_AS_ADVANCED (FIXME_CMAKE_ABSOLUTE)
+
+      GET_PROPERTY(source_dir_set GLOBAL PROPERTY MYPACKAGE_SOURCE_DIR SET)
+      IF (NOT ${source_dir_set})
+        MESSAGE (WARNING "Cannot repair anything if any, property MYPACKAGE_SOURCE_DIR is not set")
+      ELSE ()
+        GET_PROPERTY(source_dir GLOBAL PROPERTY MYPACKAGE_SOURCE_DIR)
+        SET(MYPACKAGE_GENERATED_INCLUDE_DIR "__generated_include_dir__")
+        FILE(MAKE_DIRECTORY ${MYPACKAGE_GENERATED_INCLUDE_DIR})
+        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_ABSOLUTE} "MESSAGE(STATUS \"Append to INCLUDE_DIRECTORIES: ${_MYPACKAGE_GENERATED_INCLUDE_DIR_ABSOLUTE}\")\n")
+        FILE(APPEND ${FIXME_CMAKE_ABSOLUTE} "INCLUDE_DIRECTORIES(${_MYPACKAGE_GENERATED_INCLUDE_DIR_ABSOLUTE})\n")
+
         IF (NOT HAVE_STDINT_H)
           SET (STDINT_REPAIR_H ${MYPACKAGE_GENERATED_INCLUDE_DIR}/stdint.h)
           MESSAGE(STATUS "Generating a minimal stdint.h in ${STDINT_REPAIR_H}")
@@ -33,10 +34,7 @@
           SET (HAVE_STDINT_H TRUE CACHE BOOL "C stdint.h generated file")
           MARK_AS_ADVANCED (HAVE_STDINT_H)
         ENDIF ()
-        SET (STDINT_H_SINGLETON TRUE CACHE BOOL "C stdint.h repair singleton")
-        MARK_AS_ADVANCED (STDINT_H_SINGLETON)
-      ENDIF ()
-      IF (NOT INTTYPES_H_SINGLETON)
+
         IF (NOT HAVE_INTTYPES_H)
           SET (INTTYPES_REPAIR_H ${MYPACKAGE_GENERATED_INCLUDE_DIR}/inttypes.h)
           MESSAGE(STATUS "Generating a minimal inttypes.h in ${INTTYPES_REPAIR_H}")
@@ -44,9 +42,11 @@
           SET (HAVE_INTTYPES_H TRUE CACHE BOOL "C inttypes.h generated file")
           MARK_AS_ADVANCED (HAVE_INTTYPES_H)
         ENDIF ()
-        SET (INTTYPES_H_SINGLETON TRUE CACHE BOOL "C inttypes.h repair singleton")
-        MARK_AS_ADVANCED (INTTYPES_H_SINGLETON)
+
       ENDIF ()
     ENDIF ()
+
+    SET (FIXME_CMAKE_SINGLETON TRUE CACHE BOOL "__fixme__.cmake singleton")
+    MARK_AS_ADVANCED (FIXME_CMAKE_SINGLETON)
   ENDIF ()
 ENDMACRO()


Update to ensure Metis compiles correctly on this branch with Max OSX

--- cmake/ThirdPartyMetis.cmake
+++ cmake/ThirdPartyMetis.cmake
@@ -6,8 +6,8 @@
     EXTERNALPROJECT_ADD(
         modmetis-5.1.0
         PREFIX ${TPSRC}
-        URL ${TPURL}/modmetis-5.1.0.tar.bz2
-        URL_MD5 "8f8313a768e4611d1748d10f88f3d702"
+        URL ${TPURL}/modmetis-5.1.0_1.tar.bz2
+        URL_MD5 "6c6816aea0f53db6c71b1d98ed4ad42b"
         DOWNLOAD_DIR ${TPSRC}
         CONFIGURE_COMMAND ${CMAKE_COMMAND}
             -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER}


quiet git header output

quiet git header output

--- cmake/common/px4_base.cmake
+++ cmake/common/px4_base.cmake
@@ -931,7 +931,7 @@
 	file(WRITE ${OUT} "")
 	add_custom_command(
 		OUTPUT __fake
-		COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/px_update_git_header.py ${OUT}
+		COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/px_update_git_header.py ${OUT} > ${PX4_BINARY_DIR}/git_header.log
 		WORKING_DIRECTORY ${PX4_SOURCE_DIR}
 		COMMENT "Generating git hash header"
 		)


[cmake] Create exports for umbrella library targets

When using the umbrella llvm-libraries and clang-libraries targets, we
should export all library targets, otherwise they'll be part of our
distribution but not usable from the CMake package.

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

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

--- cmake/modules/AddLLVM.cmake
+++ cmake/modules/AddLLVM.cmake
@@ -633,6 +633,7 @@
   # config file.
   if (NOT ARG_BUILDTREE_ONLY AND NOT ARG_MODULE)
     set_property( GLOBAL APPEND PROPERTY LLVM_LIBS ${name} )
+    set(in_llvm_libs YES)
   endif()

   if (ARG_MODULE AND NOT TARGET ${name})
@@ -663,6 +664,7 @@
       endif()

       if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
+          (in_llvm_libs AND "llvm-libraries" IN_LIST LLVM_DISTRIBUTION_COMPONENTS) OR
           NOT LLVM_DISTRIBUTION_COMPONENTS)
         set(export_to_llvmexports EXPORT LLVMExports)
         set_property(GLOBAL PROPERTY LLVM_HAS_EXPORTS True)


build: fix FindICU's search for components

--- cmake/modules/FindICU.cmake
+++ cmake/modules/FindICU.cmake
@@ -76,6 +76,8 @@
     set(component_cache_debug "${component_cache}_DEBUG")
     set(component_found "${component_cache}_FOUND")

+    unset(component_libnames)
+    unset(component_debug_libnames)
     list(APPEND component_libnames "icu${component}")
     list(APPEND component_debug_libnames "icu${component}d")
     if(component STREQUAL data)


- Fix libidn tests

- Fix libidn tests

svn path=/trunk/KDE/kdenetwork/cmake/modules/FindIDN.cmake; revision=883294

--- cmake/modules/FindIDN.cmake
+++ cmake/modules/FindIDN.cmake
@@ -9,31 +9,37 @@
 #
 # Redistribution and use is allowed according to the terms of the BSD license.
 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-IF (NOT WIN32)
-  find_package(PkgConfig)
-  pkg_check_modules(LIBIDN libidn)

-  FIND_PATH(IDN_INCLUDE_DIR idna.h
-    PATHS
-    ${LIBIDN_INCLUDE_DIRS}
-    NO_DEFAULT_PATH
-  )
+if (IDN_INCLUDEDIR AND IDN_LIBRARIES)
+    # cached
+    SET(IDN_FOUND TRUE)
+else (IDN_INCLUDEDIR AND IDN_LIBRARIES)
+    if (NOT WIN32)
+        find_package(PkgConfig)
+        if(PKG_CONFIG_EXECUTABLE)
+            pkg_check_modules(IDN libidn)
+        endif(PKG_CONFIG_EXECUTABLE)
+    endif (NOT WIN32)
+
+    if(NOT IDN_FOUND)
+        find_path(IDN_INCLUDEDIR idna.h)
+        find_library(IDN_LIBRARIES NAMES idn)
+        if (IDN_INCLUDEDIR AND IDN_LIBRARIES)
+            SET(IDN_FOUND TRUE)
+        endif (IDN_INCLUDEDIR AND IDN_LIBRARIES)
+    endif(NOT IDN_FOUND)

-  set(IDN_DEFINITIONS ${LIBIDN_CFLAGS})
+    if(IDN_FOUND)
+        set(IDN_DEFINITIONS ${IDN_CFLAGS})
+        if(NOT IDN_FIND_QUIETLY)
+            message(STATUS "Found libidn: ${IDN_LIBRARIES}")
+        endif(NOT IDN_FIND_QUIETLY)
+        set(IDN_INCLUDE_DIR ${IDN_INCLUDEDIR})
+        mark_as_advanced( IDN_INCLUDE_DIR )
+    else(IDN_FOUND)
+        if (IDN_FIND_REQUIRED)
+            message(FATAL_ERROR "Not found required libidn")
+        endif (IDN_FIND_REQUIRED)
+    endif(IDN_FOUND)
+endif (IDN_INCLUDEDIR AND IDN_LIBRARIES)

-  FIND_LIBRARY(IDN_LIBRARY NAMES idn
-    PATHS
-    ${LIBIDN_LIBRARY_DIRS}
-    NO_DEFAULT_PATH
-  )
-ELSE (NOT WIN32)
-  FIND_PATH(IDN_INCLUDE_DIR idna.h)
-  FIND_LIBRARY(IDN_LIBRARY NAMES idn idn-11 libidn-11)
-ENDIF (NOT WIN32)
-set(IDN_INCLUDES ${IDN_INCLUDE_DIR} )
-
-include(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(IDN DEFAULT_MSG IDN_INCLUDES IDN_LIBRARY )
-
-MARK_AS_ADVANCED(IDN_INCLUDE_DIR IDN_LIBRARY)
-


qi_install_program: Look in src dir, not build dir.

Since the doc tells us not to use this for generated stuff,
it does not make sense to look in build dir.

Change-Id: I6325aac8db5cf13a58126736de76d93d50ba62d6
Reviewed-on: http://gerrit.aldebaran.lan:8080/10752
Reviewed-by: dmerejkowsky <1e4b13000fa8777df4cefd2fd8215187e3deb062@aldebaran-robotics.com>
Tested-by: mnottale <e3ccf1b6558404e921a21fa09cebb1153b50ec36@aldebaran-robotics.com>

--- cmake/qibuild/install.cmake
+++ cmake/qibuild/install.cmake
@@ -183,7 +183,7 @@

   foreach(name ${ARG_UNPARSED_ARGUMENTS})
     #TODO: what should be the real source here?
-    install(PROGRAMS    "${QI_SDK_DIR}/${QI_SDK_BIN}/${ARG_SUBFOLDER}/${name}"
+    install(PROGRAMS    "${name}"
             COMPONENT   binary
             DESTINATION "${QI_SDK_BIN}/${ARG_SUBFOLDER}")
   endforeach()


Read either uvernum.h or uversion.h.

Read either uvernum.h or uversion.h.

--- cmake_modules/FindICU.cmake
+++ cmake_modules/FindICU.cmake
@@ -53,15 +53,26 @@

 # Discover the version.
 IF (NOT ICU_INCLUDE STREQUAL "")
-  FIND_PATH(ICUVERHPPPATH NAMES unicode/fuvernum.h PATHS ${ICU_INCLUDE}
-    NO_DEFAULT_PATH)
+  # ICU 3.x has the relevant #defines in uversion.h; 4.x uses uvernum.h.
+  FIND_PATH(ICUVERHPPPATH NAMES unicode/uvernum.h unicode/uversion.h
+    PATHS ${ICU_INCLUDE} NO_DEFAULT_PATH)

   IF ( ${ICUVERHPPPATH} STREQUAL ICUVERHPPPATH-NOTFOUND )
     SET(ICU_VERSION "0")
     MESSAGE(STATUS "Found ICU but unable to determine version - assuming version 0")
   ELSE( ${ICUVERHPPPATH} STREQUAL ICUVERHPPPATH-NOTFOUND )
-    FILE(READ ${ICUVERHPPPATH}/unicode/uvernum.h ICUVERHPP)
-
+    SET (ICUVERHPP)
+    # One of these files has to exist, or else ICUVERHPPPATH wouldn't be set.
+    # If uvernum.h exists, it has the data we want; otherwise, that data is
+    # in uversion.h.
+    FOREACH (header uvernum.h uversion.h)
+      SET (headerfile "${ICUVERHPPPATH}/unicode/${header}")
+      IF (EXISTS "${headerfile}")
+	FILE(READ "${headerfile}" ICUVERHPP)
+	BREAK()
+      ENDIF (EXISTS "${headerfile}")
+    ENDFOREACH (header)
+
     STRING(REGEX MATCH "\n *#define U_ICU_VERSION_MAJOR_NUM +[0-9]+" ICUVERMAJ
       ${ICUVERHPP})
     STRING(REGEX MATCH "\n *#define U_ICU_VERSION_MINOR_NUM +[0-9]+" ICUVERMIN


Set ARCH to x64 against x86_64

Set ARCH to x64 against x86_64

--- tools/cmake/helpers/platform.cmake
+++ tools/cmake/helpers/platform.cmake
@@ -76,7 +76,7 @@
 function(get_arch ARCH)
   if( CMAKE_SIZEOF_VOID_P MATCHES 8 )
     # void ptr = 8 byte --> x86_64
-    set(${ARCH} "x86_64" PARENT_SCOPE)
+    set(${ARCH} "x86" PARENT_SCOPE)
   elseif( CMAKE_SIZEOF_VOID_P MATCHES 4 )
     # void ptr = 4 byte --> x86
     set(${ARCH} "x86" PARENT_SCOPE)


installing XeonPhi tutorials also in TUTORIALS_INSTALL_DIR

--- common/cmake/tutorial.cmake
+++ common/cmake/tutorial.cmake
@@ -40,7 +40,7 @@
     ADD_EXECUTABLE(${TUTORIAL_NAME}_xeonphi ${TUTORIAL_NAME}.cpp)
     TARGET_LINK_LIBRARIES(${TUTORIAL_NAME}_xeonphi tutorial image transport_host)
     SET_PROPERTY(TARGET ${TUTORIAL_NAME}_xeonphi PROPERTY FOLDER tutorials/xeonphi)
-    INSTALL(TARGETS ${TUTORIAL_NAME}_xeonphi DESTINATION bin COMPONENT tutorials_xeonphi)
+    INSTALL(TARGETS ${TUTORIAL_NAME}_xeonphi DESTINATION ${TUTORIALS_INSTALL_DIR} COMPONENT tutorials_xeonphi)
   ELSE()
     INCLUDE (icc_xeonphi)
     ADD_ISPC_EXECUTABLE(${TUTORIAL_NAME}_xeonphi_device ${TUTORIAL_NAME}_device.ispc)


BUG: Fix ctkMacroGetAllNonCTKTargetLibraries

Do not attempt to remove all_ctk_libraries from _tmp_list when
all_ctk_libraries is empty.

--- CMake/ctkMacroTargetLibraries.cmake
+++ CMake/ctkMacroTargetLibraries.cmake
@@ -125,7 +125,9 @@
 MACRO(ctkMacroGetAllNonCTKTargetLibraries all_target_libraries varname)
   ctkMacroGetAllCTKTargetLibraries("${all_target_libraries}" all_ctk_libraries)
   SET(_tmp_list ${all_target_libraries})
-  LIST(REMOVE_ITEM _tmp_list ${all_ctk_libraries})
+  IF("${all_ctk_libraries}")
+    LIST(REMOVE_ITEM _tmp_list ${all_ctk_libraries})
+  ENDIF()
   SET(${varname} ${_tmp_list})
   #MESSAGE(STATUS varname:${varname}:${${varname}})
 ENDMACRO()


Working on detecting hdf5 from modules

Working on detecting hdf5 from modules

Former-commit-id: 5d67f0397f4bcdd4beb45d4845e15f0278e3e6db

--- cmake-modules/FindPackageHDF5.cmake
+++ cmake-modules/FindPackageHDF5.cmake
@@ -53,51 +53,77 @@
     # Add convenience libraries to collect all the hdf5 libraries
     add_library(hdf5    INTERFACE)
     add_library(hdf5::hdf5 ALIAS hdf5)
-    if(TARGET hdf5::hdf5-${HDF5_TARGET_SUFFIX})
-        set(HDF5_DIR              ${HDF5_BUILD_DIR}/share/cmake/hdf5)
-        set(HDF5_ROOT             ${HDF5_BUILD_DIR})
+    target_link_libraries(hdf5
+            INTERFACE
+            ${HDF5_hdf5_hl_LIBRARY}
+            ${HDF5_C_LIBRARY_hdf5_hl}
+            ${HDF5_C_HL_LIBRARY}
+            ${HDF5_hdf5_LIBRARY}
+            ${HDF5_C_LIBRARY}
+            ${HDF5_C_LIBRARY_hdf5}
+            $<LINK_ONLY:-ldl -lm -lz>
+            ${PTHREAD_LIBRARY}
+            )
+    target_include_directories(hdf5 INTERFACE  ${HDF5_INCLUDE_DIR})
+    if(HDF5_ENABLE_Z_LIB_SUPPORT)
+        target_link_libraries(hdf5 INTERFACE $<LINK_ONLY:-lz>  )
+    endif()
+    if (_HDF5_LPATH)
+        set(HDF5_ROOT ${_HDF5_LPATH})
+    endif()
+    if(HDF5_C_LIBRARY_sz)
+        target_link_libraries(hdf5 INTERFACE $<LINK_ONLY:-lsz>  )
+    endif()
+    if(HDF5_C_LIBRARY_z)
+        target_link_libraries(hdf5 INTERFACE $<LINK_ONLY:-lz>  )
+    endif()

-        target_link_libraries(hdf5
-                INTERFACE
-                ${HDF5_C_HL_LIBRARY}
-                ${HDF5_C_LIBRARY}
-                $<LINK_ONLY:-ldl -lm>
-                ${PTHREAD_LIBRARY}
-                )
-        if(HDF5_ENABLE_Z_LIB_SUPPORT)
-            target_link_libraries(hdf5 INTERFACE $<LINK_ONLY:-lz>  )
-        endif()
-        target_include_directories(hdf5 INTERFACE  ${HDF5_INCLUDE_DIR})
-    elseif(HDF5_INCLUDE_DIR MATCHES "conda3")
-
-        target_link_libraries(hdf5
-                INTERFACE
-                ${HDF5_hdf5_hl_LIBRARY}
-                ${HDF5_hdf5_LIBRARY}
-                $<LINK_ONLY:-ldl -lm -lz>
-                ${PTHREAD_LIBRARY}
-                )
-        target_include_directories(hdf5 INTERFACE  ${HDF5_INCLUDE_DIR})
-
-    else()
-        #        add_dependencies(hdf5  SZIP)
-        if (_HDF5_LPATH)
-            set(HDF5_ROOT ${_HDF5_LPATH})
-        endif()
-
-        target_link_libraries(hdf5
-                INTERFACE
-                ${HDF5_C_LIBRARY_hdf5_hl}
-                ${HDF5_C_LIBRARY_hdf5}
-                $<LINK_ONLY:-ldl -lm>
-                ${PTHREAD_LIBRARY}
-                )
-        if(HDF5_C_LIBRARY_sz)
-            target_link_libraries(hdf5 INTERFACE $<LINK_ONLY:-lsz>  )
-        endif()
-        if(HDF5_C_LIBRARY_z)
-            target_link_libraries(hdf5 INTERFACE $<LINK_ONLY:-lz>  )
-        endif()
-        target_include_directories(hdf5 INTERFACE ${HDF5_INCLUDE_DIR})
-    endif()
+#
+#    if(TARGET hdf5::hdf5-${HDF5_TARGET_SUFFIX} AND DEFINED HDF5_C_HL_LIBRARY AND DEFINED HDF5_C_LIBRARY)
+#        set(HDF5_DIR              ${HDF5_BUILD_DIR}/share/cmake/hdf5)
+#        set(HDF5_ROOT             ${HDF5_BUILD_DIR})
+#
+#        target_link_libraries(hdf5
+#                INTERFACE
+#                ${HDF5_C_HL_LIBRARY}
+#                ${HDF5_C_LIBRARY}
+#                $<LINK_ONLY:-ldl -lm>
+#                ${PTHREAD_LIBRARY}
+#                )
+#        if(HDF5_ENABLE_Z_LIB_SUPPORT)
+#            target_link_libraries(hdf5 INTERFACE $<LINK_ONLY:-lz>  )
+#        endif()
+#        target_include_directories(hdf5 INTERFACE  ${HDF5_INCLUDE_DIR})
+#    elseif(DEFINED HDF5_hdf5_hl_LIBRARY AND DEFINED HDF5_hdf5_LIBRARY)
+#
+#        target_link_libraries(hdf5
+#                INTERFACE
+#                ${HDF5_hdf5_hl_LIBRARY}
+#                ${HDF5_hdf5_LIBRARY}
+#                $<LINK_ONLY:-ldl -lm -lz>
+#                ${PTHREAD_LIBRARY}
+#                )
+#        target_include_directories(hdf5 INTERFACE  ${HDF5_INCLUDE_DIR})
+#
+#    elseif(DEFINED HDF5_C_LIBRARY_hdf5 AND DEFINED HDF5_C_LIBRARY_hdf5_hl)
+#        #        add_dependencies(hdf5  SZIP)
+#        if (_HDF5_LPATH)
+#            set(HDF5_ROOT ${_HDF5_LPATH})
+#        endif()
+#
+#        target_link_libraries(hdf5
+#                INTERFACE
+#                ${HDF5_C_LIBRARY_hdf5_hl}
+#                ${HDF5_C_LIBRARY_hdf5}
+#                $<LINK_ONLY:-ldl -lm>
+#                ${PTHREAD_LIBRARY}
+#                )
+#        if(HDF5_C_LIBRARY_sz)
+#            target_link_libraries(hdf5 INTERFACE $<LINK_ONLY:-lsz>  )
+#        endif()
+#        if(HDF5_C_LIBRARY_z)
+#            target_link_libraries(hdf5 INTERFACE $<LINK_ONLY:-lz>  )
+#        endif()
+#        target_include_directories(hdf5 INTERFACE ${HDF5_INCLUDE_DIR})
+#    endif()
 endif()


Add __cxxabi_config.h to libcxxabi headers.

git-svn-id: 756ef344af921d95d562d9e9f9389127a89a6314@228364 91177308-0d34-0410-b5e6-96231b3b80d8

--- cmake/Modules/HandleLibCXXABI.cmake
+++ cmake/Modules/HandleLibCXXABI.cmake
@@ -84,7 +84,7 @@
     set(CXXABI_LIBNAME "c++abi")
   endif()
   setup_abi_lib("LIBCXX_LIBCXXABI_INCLUDE_PATHS" ""
-    ${CXXABI_LIBNAME} "cxxabi.h" ""
+    ${CXXABI_LIBNAME} "cxxabi.h;__cxxabi_config.h" ""
     )
 elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxrt")
   setup_abi_lib("LIBCXX_LIBCXXRT_INCLUDE_PATHS" "-DLIBCXXRT"
@@ -95,4 +95,4 @@
     "Currently libstdc++, libsupc++, libcxxabi, libcxxrt and none are "
     "supported for c++ abi."
     )
-endif ()+endif ()


Fixed building directories for AlloProject

--- cmake_modules/CMakeRunTargets.cmake
+++ cmake_modules/CMakeRunTargets.cmake
@@ -12,7 +12,8 @@

 if(BUILD_DIR)
   string(REGEX REPLACE "/+$" "" ALLOSYSTEM_BUILD_APP_DIR "${ALLOSYSTEM_BUILD_APP_DIR}") # remove trailing slash
-  file(GLOB ALLOSYSTEM_APP_SRC RELATIVE ${CMAKE_SOURCE_DIR} ${ALLOSYSTEM_BUILD_APP_DIR}/*.cpp)
+  file(GLOB ALLOSYSTEM_APP_SRC "${CMAKE_SOURCE_DIR}/${ALLOSYSTEM_BUILD_APP_DIR}/*.cpp")
+#  file(GLOB ALLOSYSTEM_APP_SRC RELATIVE "${CMAKE_SOURCE_DIR}" "${ALLOSYSTEM_BUILD_APP_DIR}/*.cpp")
   string(REPLACE "/" "_" APP_NAME "${ALLOSYSTEM_BUILD_APP_DIR}")
   string(REGEX REPLACE "_+$" "" APP_NAME "${APP_NAME}")
   set(SOURCE_DIR "${CMAKE_SOURCE_DIR}/${ALLOSYSTEM_BUILD_APP_DIR}")
@@ -24,7 +25,6 @@
   set(ALLOSYSTEM_APP_SRC "${CMAKE_SOURCE_DIR}/${BUILD_APP_FILE}")
   get_filename_component(SOURCE_DIR "${BUILD_APP_FILE}" PATH)
   set(SOURCE_DIR "${CMAKE_SOURCE_DIR}/${SOURCE_DIR}")
-  message(" ----------------- ${SOURCE_DIR}")
 endif(BUILD_DIR)

 set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/build/bin)


Googletest export

Googletest export

Remove -Werror from the CMake compiler flags

We should not force warnings as errors on users.
Sometimes compilers introduce new warnings which
will break builds.

Instead, we manually turn this flag on in our continuous integration
scripts so we can catch these errors, but not force them on our users.

Fixes #3447

PiperOrigin-RevId: 380241852

--- googletest/cmake/internal_utils.cmake
+++ googletest/cmake/internal_utils.cmake
@@ -84,13 +84,13 @@
     # Ensure MSVC treats source files as UTF-8 encoded.
     set(cxx_base_flags "${cxx_base_flags} -utf-8")
   elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
-    set(cxx_base_flags "-Wall -Wshadow -Werror -Wconversion")
+    set(cxx_base_flags "-Wall -Wshadow -Wconversion")
     set(cxx_exception_flags "-fexceptions")
     set(cxx_no_exception_flags "-fno-exceptions")
     set(cxx_strict_flags "-W -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wredundant-decls")
     set(cxx_no_rtti_flags "-fno-rtti")
   elseif (CMAKE_COMPILER_IS_GNUCXX)
-    set(cxx_base_flags "-Wall -Wshadow -Werror")
+    set(cxx_base_flags "-Wall -Wshadow")
     if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0.0)
       set(cxx_base_flags "${cxx_base_flags} -Wno-error=dangling-else")
     endif()


Fix FindEqualizer

Fix FindEqualizer

--- FindEqualizer.cmake
+++ FindEqualizer.cmake
@@ -153,8 +153,9 @@
 else()
   set(_eq_EPIC_FAIL TRUE)
   if(_eq_output)
-  message(${_eq_version_output_type}
-    "Can't find Equalizer header file version.h.")
+    message(${_eq_version_output_type}
+      "Can't find Equalizer header file version.h.")
+  endif()
 endif()

 # Version checking


BUG: method name contains the name of the class so the comparaison can't be strict

--- Wrapping/WrapITK/Python/CreateLanguageSupport.cmake
+++ Wrapping/WrapITK/Python/CreateLanguageSupport.cmake
@@ -306,7 +306,7 @@
   SET(text "${text} // Python typemaps for Smart Pointers to ${template_params} class. \n\n")
   SET(text "${text}%typemap(out) ${template_params} * {\n")
   SET(text "${text}  std::string methodName = \"\$symname\";\n")
-  SET(text "${text}  if(methodName == \"GetPointer\") {\n")
+  SET(text "${text}  if(methodName.find(\"GetPointer\") != std::string::npos) {\n")
   SET(text "${text}    // really return a pointer in that case\n")
   SET(text "${text}    \$result = SWIG_NewPointerObj((void *)(\$1), \$1_descriptor, 1);\n")
   SET(text "${text}  } else {\n")


look for the package.xml in the project's source dir

--- ament_cmake_core/cmake/core/ament_package_xml.cmake
+++ ament_cmake_core/cmake/core/ament_package_xml.cmake
@@ -66,7 +66,7 @@

   # set default directory
   if(NOT PACKAGE_XML_DIRECTORY)
-    set(PACKAGE_XML_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+    set(PACKAGE_XML_DIRECTORY ${PROJECT_SOURCE_DIR})
   endif()

   # stamp package.xml as well as script to generate CMake code from it


fix cc_test on windows

fix cc_test on windows

--- cmake/generic.cmake
+++ cmake/generic.cmake
@@ -351,6 +351,9 @@
     cmake_parse_arguments(cc_test "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
     add_executable(${TARGET_NAME} ${cc_test_SRCS})
     target_link_libraries(${TARGET_NAME} ${cc_test_DEPS} paddle_gtest_main lod_tensor memory gtest gflags glog)
+    if(WIN32)
+      target_link_libraries(${TARGET_NAME} shlwapi)
+    endif(WIN32)
     add_dependencies(${TARGET_NAME} ${cc_test_DEPS} paddle_gtest_main lod_tensor memory gtest gflags glog)
     add_test(NAME ${TARGET_NAME}
              COMMAND ${TARGET_NAME} ${cc_test_ARGS}


Fix bug in CMake script to find CAF

Fix bug in CMake script to find CAF

--- cmake/FindCAF.cmake
+++ cmake/FindCAF.cmake
@@ -76,7 +76,8 @@
                      /sw/lib
                      ${CMAKE_INSTALL_PREFIX}/lib)
       mark_as_advanced(CAF_LIBRARY_${UPPERCOMP})
-      if ("${CAF_LIBRARY_${UPPERCOMP}}" STREQUAL "CAF_LIBRARY-NOTFOUND")
+      if ("${CAF_LIBRARY_${UPPERCOMP}}"
+          STREQUAL "CAF_LIBRARY_${UPPERCOMP}-NOTFOUND")
         set(CAF_${comp}_FOUND false)
       else ()
         set(CAF_LIBRARIES ${CAF_LIBRARIES} ${CAF_LIBRARY_${UPPERCOMP}})


improved cmake for zeroc Ice

improved cmake for zeroc Ice

--- cmake/FindIce.cmake
+++ cmake/FindIce.cmake
@@ -1,13 +1,16 @@
+#------------------------------------------------------------------------
 #
-# Safety Framework for Component-based Robotics
+# CASROS: Component-based Architecture for Safe Robotic Systems
 #
-# Copyright (C) 2012 Min Yang Jung, Peter Kazanzides
+# Copyright (C) 2012-2014 Min Yang Jung
 #
-# Distributed under the Boost Software License, Version 1.0.
-# (See accompanying file LICENSE_1_0.txt or copy at
-# http://www.boost.org/LICENSE_1_0.txt)
+#------------------------------------------------------------------------
 #
-
+# Created on   : July 31, 2012
+# Last revision: March 19, 2014
+# Author       : Min Yang Jung (myj@jhu.edu)
+# Github       : https://github.com/minyang/casros
+#
 #
 # FindIce.cmake
 #
@@ -26,29 +29,58 @@
 #   - ZeroC ICE: http://www.zeroc.com
 #

-find_path (ZEROC_ICE_INCLUDE_DIR NAMES Ice/Ice.h DOC "Directory containing Ice/Ice.h")
-find_library (ZEROC_ICE_LIBRARY_ICE NAMES Ice DOC "Path to Ice libraries")
-find_library (ZEROC_ICE_LIBRARY_ICEUTIL NAMES IceUtil DOC "Path to IceUtil libraries")
-find_library (ZEROC_ICE_LIBRARY_ICESTORM NAMES IceStorm DOC "Path to IceStorm libraries")
+# define ice versions
+set (ICE_VERSIONS 3.3.0 3.3.1
+                  3.4.0 3.4.1
+                  3.5.0 3.5.1)
+
+# set default search paths
+# TODO: expand default search paths
+set (ICE_DEFAULT_PATH)
+if (SF_ON_MAC)
+  set (ICE_INCLUDE_DEFAULT_PATH "/opt/local/include") # mac port
+  set (ICE_LIB_DEFAULT_PATH "/opt/local/lib/") # mac port
+elseif (SF_ON_WINDOWS)
+  # TODO
+elseif (SF_ON_LINUX)
+  # TODO
+endif ()
+
+find_path (ZEROC_ICE_INCLUDE_DIR NAMES Ice/Ice.h
+                                 DOC "Directory containing Ice/Ice.h"
+                                 PATHS ${ICE_INCLUDE_DEFAULT_PATH})
+find_library (ZEROC_ICE_LIBRARY_ICE NAMES Ice ZerocIce
+                                    DOC "Path to Ice libraries"
+                                    HINTS ${ICE_LIB_DEFAULT_PATH})
+find_library (ZEROC_ICE_LIBRARY_ICEUTIL NAMES IceUtil ZerocIceUtil
+                                        DOC "Path to IceUtil libraries"
+                                        HINTS ${ICE_LIB_DEFAULT_PATH})
+find_library (ZEROC_ICE_LIBRARY_ICESTORM NAMES IceStorm ZerocIceStorm
+                                         DOC "Path to IceStorm libraries"
+                                         HINTS ${ICE_LIB_DEFAULT_PATH})

 include (FindPackageHandleStandardArgs)
-find_package_handle_standard_args(ZEROC_ICE DEFAULT_MSG
-    ZEROC_ICE_INCLUDE_DIR ZEROC_ICE_LIBRARY_ICE ZEROC_ICE_LIBRARY_ICEUTIL ZEROC_ICE_LIBRARY_ICESTORM)
+find_package_handle_standard_args(ZEROC_ICE
+  DEFAULT_MSG
+  ZEROC_ICE_INCLUDE_DIR
+  ZEROC_ICE_LIBRARY_ICE
+  ZEROC_ICE_LIBRARY_ICEUTIL
+  ZEROC_ICE_LIBRARY_ICESTORM)

 if (ZEROC_ICE_FOUND)
-    set (ZEROC_ICE_HOME "${ZEROC_ICE_INCLUDE_DIR}/..")
-    set (ZEROC_ICE_LIBRARIES ${ZEROC_ICE_LIBRARY_ICE} ${ZEROC_ICE_LIBRARY_ICEUTIL}
-                             ${ZEROC_ICE_LIBRARY_ICESTORM})
-    set (ZEROC_ICE_INCLUDE_DIR ${ZEROC_ICE_INCLUDE_DIR})
-    set (ZEROC_SLICE2CPP "${ZEROC_ICE_HOME}/bin/slice2cpp")
-    set (ZEROC_SLICE_INCLUDE_DIR "${ZEROC_ICE_HOME}/../slice")
-    #message(">>>>> ZEROC_ICE_FOUND: ${ZEROC_ICE_FOUND}")
-    #message(">>>>> ZEROC_ICE_HOME: ${ZEROC_ICE_HOME}")
-    #message(">>>>> ZEROC_ICE_INCLUDE_DIR: ${ZEROC_ICE_INCLUDE_DIR}")
-    #message(">>>>> ZEROC_ICE_LIBRARIES: ${ZEROC_ICE_LIBRARIES}")
-    #message(">>>>> ZEROC_SLICE2CPP: ${ZEROC_SLICE2CPP}")
-    #message(">>>>> ZEROC_SLICE_INCLUDE_DIR: ${ZEROC_SLICE_INCLUDE_DIR}")
-    message("ZeroC ICE found")
+  set (ZEROC_ICE_HOME "${ZEROC_ICE_INCLUDE_DIR}/..")
+  set (ZEROC_ICE_LIBRARIES ${ZEROC_ICE_LIBRARY_ICE} ${ZEROC_ICE_LIBRARY_ICEUTIL}
+                            ${ZEROC_ICE_LIBRARY_ICESTORM})
+  set (ZEROC_ICE_INCLUDE_DIR ${ZEROC_ICE_INCLUDE_DIR})
+  set (ZEROC_SLICE2CPP "${ZEROC_ICE_HOME}/bin/slice2cpp")
+  set (ZEROC_SLICE_INCLUDE_DIR "${ZEROC_ICE_HOME}/../slice")
+  message(STATUS "ZEROC_ICE_FOUND: ${ZEROC_ICE_FOUND}")
+  message(STATUS "ZEROC_ICE_HOME: ${ZEROC_ICE_HOME}")
+  message(STATUS "ZEROC_ICE_INCLUDE_DIR: ${ZEROC_ICE_INCLUDE_DIR}")
+  message(STATUS "ZEROC_ICE_LIBRARIES: ${ZEROC_ICE_LIBRARIES}")
+  message(STATUS "ZEROC_SLICE2CPP: ${ZEROC_SLICE2CPP}")
+  message(STATUS "ZEROC_SLICE_INCLUDE_DIR: ${ZEROC_SLICE_INCLUDE_DIR}")
+  message("ZeroC ICE found")
 else (ZEROC_ICE_FOUND)
-    message(FATAL_ERROR "Failed to find ZeroC Ice")
+  message(FATAL_ERROR "Failed to find ZeroC Ice")
 endif(ZEROC_ICE_FOUND)


Update cmake summary

Update cmake summary

--- cmake/Summary.cmake
+++ cmake/Summary.cmake
@@ -11,4 +11,6 @@
     message(STATUS "  Compile definitions   : ${tmp}")
     message(STATUS "")
     message(STATUS "  BUILD_SHARED_LIBS     : ${BUILD_SHARED_LIBS}")
+    message(STATUS "  BUILD_TEST            : ${BUILD_TEST}")
+    message(STATUS "  BUILD_BENCHMARK       : ${BUILD_BENCHMARK}")
 endfunction()


Add entries for the new Householder Reconstruction functions from 3.9.1

--- cmake/lapacke.cmake
+++ cmake/lapacke.cmake
@@ -114,6 +114,8 @@
   lapacke_cgetrs_work.c
   lapacke_cgetsls.c
   lapacke_cgetsls_work.c
+  lapacke_cgetsqrhrt.c
+  lapacke_cgetsqrhrt_work.c
   lapacke_cggbak.c
   lapacke_cggbak_work.c
   lapacke_cggbal.c
@@ -590,6 +592,8 @@
   lapacke_cungrq_work.c
   lapacke_cungtr.c
   lapacke_cungtr_work.c
+  lapacke_cungtsqr_row.c
+  lapacke_cungtsqr_row_work.c
   lapacke_cunmbr.c
   lapacke_cunmbr_work.c
   lapacke_cunmhr.c
@@ -735,6 +739,8 @@
   lapacke_dgetrs_work.c
   lapacke_dgetsls.c
   lapacke_dgetsls_work.c
+  lapacke_dgetsqrhrt.c
+  lapacke_dgetsqrhrt_work.c
   lapacke_dggbak.c
   lapacke_dggbak_work.c
   lapacke_dggbal.c
@@ -862,6 +868,8 @@
   lapacke_dorgrq_work.c
   lapacke_dorgtr.c
   lapacke_dorgtr_work.c
+  lapacke_dorgtsqr_row.c
+  lapacke_dorgtsqr_row_work.c
   lapacke_dormbr.c
   lapacke_dormbr_work.c
   lapacke_dormhr.c
@@ -1309,6 +1317,8 @@
   lapacke_sgetrs_work.c
   lapacke_sgetsls.c
   lapacke_sgetsls_work.c
+  lapacke_sgetsqrhrt.c
+  lapacke_sgetsqrhrt_work.c
   lapacke_sggbak.c
   lapacke_sggbak_work.c
   lapacke_sggbal.c
@@ -1435,6 +1445,8 @@
   lapacke_sorgrq_work.c
   lapacke_sorgtr.c
   lapacke_sorgtr_work.c
+  lapacke_sorgtsqr_row.c
+  lapacke_sorgtsqr_row_work.c
   lapacke_sormbr.c
   lapacke_sormbr_work.c
   lapacke_sormhr.c
@@ -1877,6 +1889,8 @@
   lapacke_zgetrs_work.c
   lapacke_zgetsls.c
   lapacke_zgetsls_work.c
+  lapacke_zgetsqrhrt.c
+  lapacke_zgetsqrhrt_work.c
   lapacke_zggbak.c
   lapacke_zggbak_work.c
   lapacke_zggbal.c
@@ -2351,6 +2365,8 @@
   lapacke_zungrq_work.c
   lapacke_zungtr.c
   lapacke_zungtr_work.c
+  lapacke_zungtsqr_row.c
+  lapacke_zungtsqr_row_work.c
   lapacke_zunmbr.c
   lapacke_zunmbr_work.c
   lapacke_zunmhr.c


Fix if/endif arguments in CMake options

Fix if/endif arguments in CMake options

--- cmake/options.cmake
+++ cmake/options.cmake
@@ -26,7 +26,7 @@
   set(clawpack5 ON)
   set(clawpatch ON)
   set(clawpack3_46 ON)
-endif(clawpack3)
+endif(clawpack)

 if(geoclaw)
   set(clawpatch ON)


Fix #2550 When the build directory is outside of the source directory and building from a clone git repository then version.cmake will fail as the git commands were not running within the cloned repository's directory thnx for CaBa for helping in debugging the problem

--- cmake/version.cmake
+++ cmake/version.cmake
@@ -16,12 +16,14 @@
 		COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
 		OUTPUT_VARIABLE BRANCH
 		OUTPUT_STRIP_TRAILING_WHITESPACE
+		WORKING_DIRECTORY ${ROOT_DIR}
 	)

 	EXECUTE_PROCESS(
 		COMMAND ${GIT_EXECUTABLE} log -1 --pretty=%h
 		OUTPUT_VARIABLE REVISION
 		OUTPUT_STRIP_TRAILING_WHITESPACE
+		WORKING_DIRECTORY ${ROOT_DIR}
 	)

@@ -29,12 +31,14 @@
 		COMMAND ${GIT_EXECUTABLE} merge-base ${BRANCH} HEAD
 		OUTPUT_VARIABLE BRANCH_POINT
 		OUTPUT_STRIP_TRAILING_WHITESPACE
+		WORKING_DIRECTORY ${ROOT_DIR}
 	)

 	EXECUTE_PROCESS(
 		COMMAND ${GIT_EXECUTABLE} log -1 --pretty=%ai ${BRANCH_POINT}
 		OUTPUT_VARIABLE DATEINFO
 		OUTPUT_STRIP_TRAILING_WHITESPACE
+		WORKING_DIRECTORY ${ROOT_DIR}
 	)

 	STRING(REGEX REPLACE "([0-9]+)-.*" "\\1" VERSION_YEAR "${DATEINFO}")


Further fixes to XDR detection

Further fixes to XDR detection

--- cmake/FindXDR.cmake
+++ cmake/FindXDR.cmake
@@ -79,21 +79,18 @@
 				SET(POSSIBLE_64BIT_TYPES u_quad_t u_longlong_t "unsigned long long" __uint64_t)

 				#iterate over the list and try out the types
-				FOREACH(BALL_XDR_UINT64_TYPE ${POSSIBLE_64BIT_TYPES})
-						CHECK_CXX_SOURCE_COMPILES( "${XDR_TEST_HEADER}${BALL_XDR_UINT64_TYPE} q;${XDR_TEST_FOOTER}" XDR_64Bit_Type )
+				FOREACH(XDR_UINT64_TYPE ${POSSIBLE_64BIT_TYPES})
+						CHECK_CXX_SOURCE_COMPILES( "${XDR_TEST_HEADER}${XDR_UINT64_TYPE} q;${XDR_TEST_FOOTER}" XDR_64Bit_Type )
 						IF (XDR_64Bit_Type)
+							SET(BALL_XDR_UINT64_TYPE ${XDR_UINT64_TYPE} CACHE STRING "Unsigned 64bit type for xdr_u_hyper" FORCE)
 							BREAK()
 						ENDIF()
 				ENDFOREACH()

-				IF(XDR_64Bit_Type)
-						#This puts the value of BALL_HAS_XDR_U_HYPER into the cache
-						#Necessary, because cmake would skip the assignement on a second run because XDR_64Bit_Type is true
-						SET(BALL_XDR_UINT64_TYPE ${BALL_XDR_UINT64_TYPE} CACHE STRING "Unsigned 64bit type for xdr_u_hyper")
-				ELSE(XDR_64Bit_Type)
+				IF (NOT XDR_64Bit_Type)
 						SET(BALL_XDR_UINT64_TYPE OFF)
 						MESSAGE(SEND_ERROR "Could not identify an appropriate type for XDR_64Bit_Type.")
-				ENDIF(XDR_64Bit_Type)
+				ENDIF()

 			ELSE(BALL_HAS_XDR_U_HYPER)
 					CHECK_TYPE_SIZE("unsigned long long int" SUPPORTS_64_BIT)


Remove CMake find module for stb

Remove CMake find module for stb

stb is handled by Conan

--- cmake/Findstb.cmake
+++ cmake/Findstb.cmake
@@ -1,75 +0,0 @@
-##  Finds the Stb utility library on your computer.
-#
-#   If Stb is not found on your computer, this script also gives the option to
-#   download the library and build it from source.
-#
-#   This script exports the following parameters for use if you find the Stb
-#   package:
-#   - Stb_FOUND: Whether Stb has been found on your computer (or built from
-#     source).
-#   - Stb_INCLUDE_DIRS: The directory where the header files of Stb are located.
-
-#First try to find a PackageConfig for this library.
-find_package(PkgConfig QUIET)
-pkg_check_modules(PC_Stb QUIET Stb)
-
-find_path(Stb_INCLUDE_DIRS stb/stb_image_resize.h #Search for something that is a little less prone to false positives than just stb.h.
-    HINTS ${PC_Stb_INCLUDEDIR} ${PC_Stb_INCLUDE_DIRS}
-    PATHS "$ENV{PROGRAMFILES}" "$ENV{PROGRAMW6432}" "/usr/include"
-    PATH_SUFFIXES include/stb stb include
-)
-
-include(FindPackageHandleStandardArgs)
-set(_stb_find_required ${Stb_FIND_REQUIRED}) #Temporarily set to optional so that we don't get a message when it's not found but you want to build from source.
-set(_stb_find_quietly ${Stb_FIND_QUIETLY})
-set(Stb_FIND_REQUIRED FALSE)
-set(Stb_FIND_QUIETLY TRUE)
-find_package_handle_standard_args(Stb DEFAULT_MSG Stb_INCLUDE_DIRS)
-set(Stb_FIND_REQUIRED ${_stb_find_required})
-set(Stb_FIND_QUIETLY ${_stb_find_quietly})
-
-set(CuraEngine_Download_Stb FALSE)
-if(Stb_FOUND) #Found an existing installation.
-    if(NOT Stb_FIND_QUIETLY)
-        message(STATUS "Found Stb installation at: ${Stb_INCLUDE_DIRS}")
-    endif()
-else()
-    #Then optionally clone Stb ourselves.
-    option(BUILD_Stb "Build Stb from source." ON) #This is a lie actually, since Stb is header-only and doesn't need any building. We don't build the docs or tests.
-    if(BUILD_Stb)
-        if(NOT Stb_FIND_QUIETLY)
-            message(STATUS "Building Stb from source.")
-        endif()
-
-        include(ExternalProject)
-        # Stb's commits in early February seems to cause the engine to fail compilation on Mac.
-        ExternalProject_Add(stb
-            GIT_REPOSITORY "https://github.com/nothings/stb.git"
-            GIT_TAG d5d052c806eee2ca1f858cb58b2f062d9fa25b90
-            UPDATE_DISCONNECTED TRUE
-            CONFIGURE_COMMAND "" #We don't want to actually go and build/test/generate it. Just need to download the headers.
-            BUILD_COMMAND ""
-            INSTALL_COMMAND "" #Assume that the user doesn't want to install all dependencies on his system. We just need to get them for building the application.
-        )
-        set(CuraEngine_Download_Stb TRUE)
-        set(Stb_INCLUDE_DIRS "${CMAKE_CURRENT_BINARY_DIR}/stb-prefix/src/stb")
-        set(Stb_FOUND TRUE)
-        if(NOT Stb_FIND_QUIETLY)
-            message(STATUS "Created Stb installation at: ${Stb_INCLUDE_DIRS}")
-        endif()
-    elseif(NOT Stb_FIND_QUIETLY) #Don't have an installation but don't want us to build it either? Screw you, then.
-        if(Stb_FIND_REQUIRED)
-            message(FATAL_ERROR "Could NOT find Stb.")
-        else()
-            message(WARNING "Could NOT find Stb.")
-        endif()
-    endif()
-endif()
-
-mark_as_advanced(Stb_INCLUDE_DIRS)
-add_library(stb::stb INTERFACE)
-target_include_directories(stb::stb
-        PUBLIC
-        $<BUILD_INTERFACE:${Stb_INCLUDE_DIRS}>
-        $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
-        )


Update android.cmake

Update android.cmake

--- cmake/android.cmake
+++ cmake/android.cmake
@@ -156,7 +156,7 @@
 set( CMAKE_EXE_LINKER_FLAGS    "${ANDROID_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}")

 # Find Qt5 android_armv7
-set(ANDROID_QT $ENV{ANDROID_QT})
+set(ANDROID_QT $ENV{ANDROID_QT_HOME})
 if(NOT ANDROID_QT)
 	message(FATAL_ERROR "The ANDROID_QT environment variable is not set. Please set it.")
 endif()


cmake: fixing cuda options

cmake: fixing cuda options

Former-commit-id: 0f046b6d66062b4e4a60006b2d26d8247e91c2f0

--- cmake/options.cmake
+++ cmake/options.cmake
@@ -470,10 +470,10 @@
     set(CUDA_HOST_COMPILER "gcc" CACHE STRING "Host side compiler used by NVCC" FORCE)
 endif()

-# in debug mode, enforce cuda to compile host code in debug (the same could be done for device code with -G)
-set(CUDA_NVCC_FLAGS_DEBUG ${CUDA_NVCC_FLAGS_DEBUG} -g)
-# in release mode, enforce optimizations for host code
-set(CUDA_NVCC_FLAGS_RELEASE ${CUDA_NVCC_FLAGS_RELEASE} -O2 -DNDEBUG)
+## in debug mode, enforce cuda to compile host code in debug (the same could be done for device code with -G)
+set(CUDA_NVCC_FLAGS_DEBUG "-g" CACHE STRING "Semi-colon delimit multiple arguments" FORCE)
+## in release mode, enforce optimizations for host code
+set(CUDA_NVCC_FLAGS_RELEASE "-DNDEBUG" CACHE STRING "Semi-colon delimit multiple arguments" FORCE)

 # plugins (auto-search)


Commented NO_DEFAULT_PATH in cmake search [ci skip]

--- cmake/FindgenericLogger.cmake
+++ cmake/FindgenericLogger.cmake
@@ -71,7 +71,8 @@
     PATHS ${GENERICLOGGER_ROOT_DIR}
     PATH_SUFFIXES ${_GENERICLOGGER_POSSIBLE_INCLUDE_SUFFIXES}
     DOC "genericLogger include directory"
-    NO_DEFAULT_PATH)
+    # NO_DEFAULT_PATH
+    )
 ELSE (GENERICLOGGER_ROOT_DIR)
   # Use default path search
   FIND_PATH (GENERICLOGGER_INCLUDE_DIR
@@ -103,11 +104,13 @@
       FIND_LIBRARY (${_GENERICLOGGER_LIBRARY_BASE}_DEBUG
 	NAMES ${_GENERICLOGGER_COMPONENT_POSSIBLE_DEBUG_NAMES}
 	PATHS ${GENERICLOGGER_ROOT_DIR} PATH_SUFFIXES ${_GENERICLOGGER_POSSIBLE_LIB_SUFFIXES}
-	NO_DEFAULT_PATH)
+	# NO_DEFAULT_PATH
+	)
       FIND_LIBRARY (${_GENERICLOGGER_STATIC_LIBRARY_BASE}_DEBUG
 	NAMES ${_GENERICLOGGER_STATIC_COMPONENT_POSSIBLE_DEBUG_NAMES}
 	PATHS ${GENERICLOGGER_ROOT_DIR} PATH_SUFFIXES ${_GENERICLOGGER_POSSIBLE_LIB_SUFFIXES}
-	NO_DEFAULT_PATH)
+	# NO_DEFAULT_PATH
+	)
     ELSE (GENERICLOGGER_ROOT_DIR)
       FIND_LIBRARY (${_GENERICLOGGER_LIBRARY_BASE}_DEBUG
 	NAMES ${_GENERICLOGGER_COMPONENT_POSSIBLE_DEBUG_NAMES}
@@ -123,11 +126,13 @@
       FIND_LIBRARY (${_GENERICLOGGER_LIBRARY_BASE}_RELEASE
 	NAMES ${_GENERICLOGGER_COMPONENT_POSSIBLE_RELEASE_NAMES}
 	PATHS ${GENERICLOGGER_ROOT_DIR} PATH_SUFFIXES ${_GENERICLOGGER_POSSIBLE_LIB_SUFFIXES}
-	NO_DEFAULT_PATH)
+	# NO_DEFAULT_PATH
+	)
       FIND_LIBRARY (${_GENERICLOGGER_STATIC_LIBRARY_BASE}_RELEASE
 	NAMES ${_GENERICLOGGER_STATIC_COMPONENT_POSSIBLE_RELEASE_NAMES}
 	PATHS ${GENERICLOGGER_ROOT_DIR} PATH_SUFFIXES ${_GENERICLOGGER_POSSIBLE_LIB_SUFFIXES}
-	NO_DEFAULT_PATH)
+	# NO_DEFAULT_PATH
+	)
     ELSE (ICU_ROOT_DIR)
       FIND_LIBRARY (${_GENERICLOGGER_LIBRARY_BASE}_RELEASE
 	NAMES ${_GENERICLOGGER_COMPONENT_POSSIBLE_RELEASE_NAMES}


Eliminate pkgconfig dependency.

Eliminate pkgconfig dependency.

--- cmake/Modules/FindArrow.cmake
+++ cmake/Modules/FindArrow.cmake
@@ -70,18 +70,19 @@
     add_library(arrow STATIC IMPORTED)
     set_target_properties(arrow PROPERTIES IMPORTED_LOCATION "${ARROW_STATIC_LIB}")

-    # Using pkgconfig to determine arrow version information for CPP macros
-    set( ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${ARROW_ROOT}/lib/pkgconfig" )
-    find_package(PkgConfig)
-    pkg_search_module(_ARROW REQUIRED arrow) # using only version information
-    STRING(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" ARROW_VERSION_MAJOR "${_ARROW_VERSION}")
-    STRING(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" ARROW_VERSION_MINOR "${_ARROW_VERSION}")
-    STRING(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" ARROW_VERSION_PATCH "${_ARROW_VERSION}")
-    math(EXPR ARROW_NUMERIC_VERSION "${ARROW_VERSION_MAJOR} * 10000 + ${ARROW_VERSION_MINOR} * 100 + ${ARROW_VERSION_PATCH}")
+    # Determine arrow version information for CPP macros
+    file(STRINGS ${ARROW_ROOT}/lib/pkgconfig/arrow.pc _ARROW_VERSION REGEX "^Version: ([0-9]+\\.[0-9]+\\.[0-9]+)")
+    STRING(REGEX REPLACE "^Version: ([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" ARROW_VERSION_MAJOR "${_ARROW_VERSION}")
+    STRING(REGEX REPLACE "^Version: [0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" ARROW_VERSION_MINOR "${_ARROW_VERSION}")
+    STRING(REGEX REPLACE "^Version: [0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" ARROW_VERSION_PATCH "${_ARROW_VERSION}")
+    math(EXPR ARROW_NUMERIC_VERSION "(${ARROW_VERSION_MAJOR}+0) * 10000 + (${ARROW_VERSION_MINOR}+0) * 100 + (${ARROW_VERSION_PATCH}+0)")
     message(STATUS "ARROW_NUMERIC_VERSION=${ARROW_NUMERIC_VERSION}")
     ADD_DEFINITIONS(-DARROW_VERSION=${ARROW_NUMERIC_VERSION})
+
     # see arrow/ipc/message.h
-    if (ARROW_NUMERIC_VERSION LESS 200)
+    if (ARROW_NUMERIC_VERSION EQUAL 0)
+      message(FATAL_ERROR "Apache Arrow version indetermined. Check for any error messages above.")
+    elseif (ARROW_NUMERIC_VERSION LESS 200)
       ADD_DEFINITIONS(-DARROW_METADATA_V1)
     elseif (ARROW_NUMERIC_VERSION LESS 300)
       ADD_DEFINITIONS(-DARROW_METADATA_V2)


Update protobuf.cmake (#1)

Update protobuf.cmake (#1)

--- cmake/external/protobuf.cmake
+++ cmake/external/protobuf.cmake
@@ -184,7 +184,7 @@
         UPDATE_COMMAND  ""
         DEPENDS         zlib
         GIT_REPOSITORY  "https://github.com/google/protobuf.git"
-        GIT_TAG         "9f75c5aa851cd877fb0d93ccc31b8567a6706546"
+        GIT_TAG         "106ffc04be1abf3ff3399f54ccf149815b287dd9"
         CONFIGURE_COMMAND
         ${CMAKE_COMMAND} ${PROTOBUF_SOURCES_DIR}/src/${TARGET_NAME}/cmake
             ${OPTIONAL_ARGS}
@@ -202,7 +202,7 @@
     )
 ENDFUNCTION()

-SET(PROTOBUF_VERSION 3.1)
+SET(PROTOBUF_VERSION 3.5)
 IF(CMAKE_CROSSCOMPILING)
     build_protobuf(protobuf_host TRUE)
     LIST(APPEND external_project_dependencies protobuf_host)


Fix build with LIB_PROTO_MUTATOR_DOWNLOAD_PROTOBUF=ON

Fix build with cmake 3.10. Not it uses protobuf::protoc instead of protoc.
Fix build when protoc is already installed but we still want to download own copy.

--- cmake/external/protobuf.cmake
+++ cmake/external/protobuf.cmake
@@ -12,6 +12,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.

+# We only need protobuf_generate_cpp from FindProtobuf, and we are going to
+# override the rest with ExternalProject version.
 include (FindProtobuf)

 set(PROTOBUF_TARGET external.protobuf)
@@ -38,10 +40,19 @@

 set(PROTOBUF_PROTOC_EXECUTABLE ${PROTOBUF_INSTALL_DIR}/bin/protoc)
 list(APPEND PROTOBUF_BUILD_BYPRODUCTS ${PROTOBUF_PROTOC_EXECUTABLE})
-add_executable(protoc IMPORTED)
-set_property(TARGET protoc PROPERTY IMPORTED_LOCATION
+
+if(${CMAKE_VERSION} VERSION_LESS "3.10.0")
+  set(PROTOBUF_PROTOC_TARGET protoc)
+else()
+  set(PROTOBUF_PROTOC_TARGET protobuf::protoc)
+endif()
+
+if(NOT TARGET ${PROTOBUF_PROTOC_TARGET})
+  add_executable(${PROTOBUF_PROTOC_TARGET} IMPORTED)
+endif()
+set_property(TARGET ${PROTOBUF_PROTOC_TARGET} PROPERTY IMPORTED_LOCATION
              ${PROTOBUF_PROTOC_EXECUTABLE})
-add_dependencies(protoc ${PROTOBUF_TARGET})
+add_dependencies(${PROTOBUF_PROTOC_TARGET} ${PROTOBUF_TARGET})

 include (ExternalProject)
 ExternalProject_Add(${PROTOBUF_TARGET}


Add support for VS 2019 in CPack

Add support for VS 2019 in CPack

(cherry picked from commit b641485c23ac514de3dde2d62d25b7dc95370462)

--- cmake/modules/RootCPack.cmake
+++ cmake/modules/RootCPack.cmake
@@ -56,6 +56,8 @@
     math(EXPR VS_VERSION "${VC_MAJOR} - 5")
   elseif(MSVC_VERSION LESS 1919)
     math(EXPR VS_VERSION "${VC_MAJOR} - 4")
+  elseif(MSVC_VERSION LESS 1925)
+    math(EXPR VS_VERSION "${VC_MAJOR} - 3")
   endif()
   set(COMPILER_NAME_VERSION ".vc${VS_VERSION}")
 else()


Fix whitespace in Android.cmake.

Fix whitespace in Android.cmake.

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

--- cmake/platforms/Android.cmake
+++ cmake/platforms/Android.cmake
@@ -43,7 +43,7 @@
 # a non-pie shim on API 16-, but that requires lldb-server to dynamically export
 # its symbols, which significantly increases the binary size. Static linking, on
 # the other hand, has little to no effect on the binary size.
-#if ( NOT DEFINED LLVM_BUILD_STATIC )
+#if( NOT DEFINED LLVM_BUILD_STATIC )
 # set( LLVM_BUILD_STATIC True )
 #endif()

@@ -102,13 +102,13 @@
  # 64 bit atomic operations used in c++ libraries require armv7-a instructions
  # armv5te and armv6 were tried but do not work.
  set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -march=armv7-a" )
- if ( LLVM_BUILD_STATIC )
+ if( LLVM_BUILD_STATIC )
   # Temporary workaround for static linking with the latest API.
   set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -DANDROID_ARM_BUILD_STATIC" )
  endif()
 endif()

-if ( NOT LLVM_BUILD_STATIC )
+if( NOT LLVM_BUILD_STATIC )
  # PIE is required for API 21+ so we enable it if we're not statically linking
  # unfortunately, it is not supported before API 16 so we need to do something
  # else there see http://llvm.org/pr23457


cmake: remove obsolete FindPhp.cmake

cmake: remove obsolete FindPhp.cmake

--- cmake/FindPhp.cmake
+++ cmake/FindPhp.cmake
@@ -1,18 +0,0 @@
-# Find PHP using php-config.
-# Sets PHP_INCLUDE_DIRS if successful.
-
-INCLUDE(CMakeFindFrameworks)
-INCLUDE(FindPackageHandleStandardArgs)
-
-FIND_PROGRAM(PHP_CONFIG NAMES "php-config" "php-config5")
-
-IF(PHP_CONFIG)
-  EXECUTE_PROCESS(
-    COMMAND ${PHP_CONFIG} "--includes"
-    OUTPUT_VARIABLE PHP_INCLUDE_DIRS)
-  STRING(REPLACE "\n" "" PHP_INCLUDE_DIRS "${PHP_INCLUDE_DIRS}")
-  STRING(REPLACE "-I" ";" PHP_INCLUDE_DIRS "${PHP_INCLUDE_DIRS}")
-ENDIF(PHP_CONFIG)
-
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Php DEFAULT_MSG PHP_INCLUDE_DIRS)
-


also looks for SSE2 now

also looks for SSE2 now

--- cmake/FindSSE.cmake
+++ cmake/FindSSE.cmake
@@ -3,6 +3,14 @@

 IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
    EXEC_PROGRAM(cat ARGS "/proc/cpuinfo" OUTPUT_VARIABLE CPUINFO)
+
+   STRING(REGEX REPLACE "^.*(sse2).*$" "\\1" SSE_THERE ${CPUINFO})
+   STRING(COMPARE EQUAL "sse2" "${SSE_THERE}" SSE2_TRUE)
+   IF (SSE2_TRUE)
+      set(SSE2_FOUND true CACHE BOOL "SSE2 available on host")
+   ELSE (SSE2_TRUE)
+      set(SSE2_FOUND false CACHE BOOL "SSE2 available on host")
+   ENDIF (SSE2_TRUE)

    # /proc/cpuinfo apparently omits sse3 :(
    STRING(REGEX REPLACE "^.*[^s](sse3).*$" "\\1" SSE_THERE ${CPUINFO})
@@ -36,6 +44,14 @@
    EXEC_PROGRAM("/usr/sbin/sysctl -n machdep.cpu.features" OUTPUT_VARIABLE
       CPUINFO)

+   STRING(REGEX REPLACE "^.*[^S](SSE2).*$" "\\1" SSE_THERE ${CPUINFO})
+   STRING(COMPARE EQUAL "SSE2" "${SSE_THERE}" SSE2_TRUE)
+   IF (SSE2_TRUE)
+      set(SSE2_FOUND true CACHE BOOL "SSE2 available on host")
+   ELSE (SSE2_TRUE)
+      set(SSE2_FOUND false CACHE BOOL "SSE2 available on host")
+   ENDIF (SSE2_TRUE)
+
    STRING(REGEX REPLACE "^.*[^S](SSE3).*$" "\\1" SSE_THERE ${CPUINFO})
    STRING(COMPARE EQUAL "SSE3" "${SSE_THERE}" SSE3_TRUE)
    IF (SSE3_TRUE)
@@ -61,15 +77,20 @@
    ENDIF (SSE41_TRUE)
 ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Windows")
    # TODO
+   set(SSE2_FOUND   true  CACHE BOOL "SSE2 available on host")
    set(SSE3_FOUND   false CACHE BOOL "SSE3 available on host")
    set(SSSE3_FOUND  false CACHE BOOL "SSSE3 available on host")
    set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host")
 ELSE(CMAKE_SYSTEM_NAME MATCHES "Linux")
+   set(SSE2_FOUND   true  CACHE BOOL "SSE2 available on host")
    set(SSE3_FOUND   false CACHE BOOL "SSE3 available on host")
    set(SSSE3_FOUND  false CACHE BOOL "SSSE3 available on host")
    set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host")
 ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")

+if(NOT SSE2_FOUND)
+      MESSAGE(STATUS "Could not find hardware support for SSE2 on this machine.")
+endif(NOT SSE2_FOUND)
 if(NOT SSE3_FOUND)
       MESSAGE(STATUS "Could not find hardware support for SSE3 on this machine.")
 endif(NOT SSE3_FOUND)
@@ -80,4 +101,4 @@
       MESSAGE(STATUS "Could not find hardware support for SSE4.1 on this machine.")
 endif(NOT SSE4_1_FOUND)

-mark_as_advanced(SSE3_FOUND SSSE3_FOUND SSE4_1_FOUND)
+mark_as_advanced(SSE2_FOUND SSE3_FOUND SSSE3_FOUND SSE4_1_FOUND)


doxygen.cmake: create a doc target for every plugin

This commit changes the cmake script to generate a documentation target
for every plugin in plugins/, instead of only the enabled ones.

Also, minor adjustments.

Former-commit-id: 0d5a967c67738a6a03af87dce2d23c0570445797

--- cmake/doxygen.cmake
+++ cmake/doxygen.cmake
@@ -1,18 +1,28 @@

-# In this file, we create targets to generate doxygen documentation on
-# a per-project basis.
-
-# The idea is to have one documentation for each part of the framework
-# (core, helper...), each module, each plugin. etc.
-# Then, you can:
-# - use the 'doc-Foo' target to build the documentation for Foo
-#   (e.g doc-SofaCore, doc-SofaEngine, or doc-SofaPython)
-# - use the 'doc' target to build all the documentations, as well as a
-#   main documentation page that links to the others. (doc/SOFA/index.html)
+# In this file, if the option SOFA-MISC_DOXYGEN in enabled, we create
+# targets to generate doxygen documentation for each module and
+# plugin, namely:
+#
+# - the 'doc-Foo' target generates the doxygen for the Foo module or
+#   plugin (e.g, doc-SofaEngine, or doc-SofaPython).  Also, doc-Foo
+#   depends on doc-Bar if Foo depends on the Bar module/plugin.
+#
+# - the 'doc-SOFA' target generates the documentation for framework/,
+#   and inserts in its main page a list of links to the others
+#   documentations.
+#
+# - the 'doc' target depends on all the doc-* targets.

-# How it's done:
+# Furthermore, if the SOFA-MISC_DOXYGEN_COMPONENT_LIST option is
+# enabled, building 'doc' will compile Sofa and generate an extra page
+# in the main documentation that list all the components available in
+# modules and links to their documentation page, so that one can
+# easily find the doxygen of a component.

+
+# Details:
+#
 # Doxygen has mechanisms that allow to link documentations together.
 # Here is the outline: when generating the documentation for projectA,
 # you can export the list of documented entities in a tag file. Then,
@@ -20,11 +30,13 @@
 # projectA, you can feed this tag file to doxygen. As a result,
 # symbols from projectA present in your documentation are linked to
 # their documentation in projectA.
+#
 # (see http://www.stack.nl/~dimitri/doxygen/manual/external.html)
-
+#
 # Here, we use this 'tag file' mechanism of doxygen and the dependency
 # tree of the projects to generate the documentation of the different
 # projects in a correct order, and link them together.
+

 if (SOFA-MISC_DOXYGEN)
     find_package(Doxygen REQUIRED)
@@ -39,9 +51,10 @@
     set(SOFA_DOCUMENTABLE_PROJECTS)
     set(SOFA_DOC_TARGETS)
     foreach(project ${GLOBAL_DEPENDENCIES})
-        if(TARGET ${project})
-            if((${GLOBAL_PROJECT_PATH_${project}} MATCHES ".*/plugins/.*") OR
-                    (${GLOBAL_PROJECT_PATH_${project}} MATCHES ".*/modules/.*"))
+        if((${GLOBAL_PROJECT_PATH_${project}} MATCHES ".*/plugins/${project}") OR
+                (${GLOBAL_PROJECT_PATH_${project}} MATCHES ".*/modules/${project}"))
+            # Ignore SofaComponent* meta-modules
+            if(NOT ${project} MATCHES "SofaComponent.*")
                 list(APPEND SOFA_DOCUMENTABLE_PROJECTS ${project})
                 list(APPEND SOFA_DOC_TARGETS doc-${project})
             endif()
@@ -102,6 +115,7 @@
         add_doc_target("${project}" "${input}" "${documentable_dependencies};SOFA")
     endforeach()

+
     # Use configure_file() to generate the source for the main page of
     # the documentation, which lists all the other documentations.

@@ -140,15 +154,16 @@

     set(LINK_TO_COMPONENT_LIST_PAGE "")
     if(SOFA-MISC_DOXYGEN_COMPONENT_LIST)
-        set(LINK_TO_COMPONENT_LIST_PAGE "If you are looking for the documentation of a specific component, check out this page, which lists all the components available in modules.")
+        set(LINK_TO_COMPONENT_LIST_PAGE "If you are looking for the documentation of a specific component, check out the Component List (modules only).")
     endif()
     configure_file("${SOFA_FRAMEWORK_DIR}/doc.h" "${SOFA_BUILD_DIR}/misc/doc.h")
+

     if(SOFA-MISC_DOXYGEN_COMPONENT_LIST)
         add_subdirectory(cmake/doxygen)
     endif()

-    # Create the target for the main page
+    # Create the 'doc-SOFA' target for the documentation of framework/
     if(SOFA-MISC_DOXYGEN_COMPONENT_LIST)
         add_doc_target("SOFA" "${SOFA_FRAMEWORK_DIR}/sofa ${SOFA_BUILD_DIR}/misc/doc.h ${SOFA_BUILD_DIR}/misc/component_list.h" "")
         add_dependencies("doc-SOFA" generateComponentList)


add protobuf:: namespace to installed targets

--- cmake/install.cmake
+++ cmake/install.cmake
@@ -92,6 +92,7 @@

 install(EXPORT protobuf-targets
   DESTINATION "${CMAKE_INSTALL_CMAKEDIR}"
+  NAMESPACE protobuf::
   COMPONENT protobuf-export)

 configure_file(protobuf-config.cmake.in


CMake: Profile comments update

CMake: Profile comments update

Co-authored-by: Hugues Kamba <402748a27f75fbc914c63b0503c6fbcb2aac22b4@users.noreply.github.com>

--- cmake/profile.cmake
+++ cmake/profile.cmake
@@ -4,10 +4,10 @@
 # Set the default build type if none is specified
 if(NOT CMAKE_BUILD_TYPE)
     set(CMAKE_BUILD_TYPE "Develop" CACHE
-        STRING "The type of build" FORCE)
+        STRING "The build type" FORCE
+   )
 endif()

-# Mapping CMAKE_BUILD_TYPE into MBED_BUILD_TYPES, as we understand only 3 profiles
 set(MBED_BUILD_TYPES Debug Release Develop)

 # Force the build types to be case-insensitive for checking
@@ -15,6 +15,7 @@
 list(TRANSFORM LOWERCASE_MBED_BUILD_TYPES TOLOWER)
 string(TOLOWER ${CMAKE_BUILD_TYPE} LOWERCASE_CMAKE_BUILD_TYPE)

+# Mapping CMAKE_BUILD_TYPE into MBED_BUILD_TYPES, as we understand only 3 profiles
 get_property(multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
 if(multi_config)
     # Provide only a list as multi configuration generators do not support build type


cmake: improve warning handling.

cmake: improve warning handling.

Add support for warning as errors. Not used yet.

--- cmake/Reaper.cmake
+++ cmake/Reaper.cmake
@@ -8,25 +8,6 @@
 include(${CMAKE_SOURCE_DIR}/cmake/Compiler.cmake)
 include(${CMAKE_SOURCE_DIR}/cmake/clang-tidy.cmake)
 include(${CMAKE_SOURCE_DIR}/cmake/external.cmake)
-
-# Ignore level-4 warning C4201: nonstandard extension used : nameless struct/union
-# Ignore level-1 warning C4251: 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
-# Ignore level-3 warning C4996: Various members of std::allocator are deprecated in C++17.
-
-set(REAPER_MSVC_DISABLE_WARNINGS "/W0")
-set(REAPER_MSVC_DEBUG_FLAGS "/W4" "/wd4201" "/wd4251" "/wd4996")
-set(REAPER_MSVC_RELEASE_FLAGS ${REAPER_MSVC_DISABLE_WARNINGS})
-set(REAPER_GCC_DEBUG_FLAGS
-    "-Wall" "-Wextra" "-Wundef" "-Wshadow" "-funsigned-char"
-    "-Wchar-subscripts" "-Wcast-align" "-Wwrite-strings" "-Wunused" "-Wuninitialized"
-    "-Wpointer-arith" "-Wredundant-decls" "-Winline" "-Wformat"
-    "-Wformat-security" "-Winit-self" "-Wdeprecated-declarations"
-    "-Wmissing-include-dirs" "-Wmissing-declarations")
-set(REAPER_GCC_RELEASE_FLAGS "")
-
-# Use the same flags as GCC
-set(REAPER_CLANG_DEBUG_FLAGS ${REAPER_GCC_DEBUG_FLAGS})
-set(REAPER_CLANG_RELEASE_FLAGS ${REAPER_GCC_RELEASE_FLAGS})

 # Useful for CMake-generated files
 set(REAPER_GENERATED_BY_CMAKE_MSG "Generated by CMake")
@@ -68,25 +49,40 @@

 # Helper function that add default compilation flags for reaper targets
 function(reaper_configure_warnings target enabled)
+    set(REAPER_WARNING_AS_ERRORS OFF)
+    set(REAPER_DEBUG_FLAGS)
+    set(REAPER_RELEASE_FLAGS)
     if(${enabled})
         if(MSVC)
-            target_compile_options(${target} PRIVATE "$<$<CONFIG:DEBUG>:${REAPER_MSVC_DEBUG_FLAGS}>")
-            target_compile_options(${target} PRIVATE "$<$<CONFIG:RELEASE>:${REAPER_MSVC_RELEASE_FLAGS}>")
-        elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
-            target_compile_options(${target} PRIVATE "$<$<CONFIG:DEBUG>:${REAPER_GCC_DEBUG_FLAGS}>")
-            target_compile_options(${target} PRIVATE "$<$<CONFIG:RELEASE>:${REAPER_GCC_RELEASE_FLAGS}>")
-        elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
-            target_compile_options(${target} PRIVATE "$<$<CONFIG:DEBUG>:${REAPER_CLANG_DEBUG_FLAGS}>")
-            target_compile_options(${target} PRIVATE "$<$<CONFIG:RELEASE>:${REAPER_CLANG_RELEASE_FLAGS}>")
+            # Ignore level-4 warning C4201: nonstandard extension used : nameless struct/union
+            # Ignore level-1 warning C4251: 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
+            # Ignore level-3 warning C4996: Various members of std::allocator are deprecated in C++17.
+            list(APPEND REAPER_DEBUG_FLAGS "/W4" "/wd4201" "/wd4251" "/wd4996")
+            list(APPEND REAPER_RELEASE_FLAGS "/W0")
+            if(REAPER_WARNING_AS_ERRORS)
+                list(APPEND REAPER_DEBUG_FLAGS "/WX")
+            endif()
+        elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+            list(APPEND REAPER_DEBUG_FLAGS
+                "-Wall" "-Wextra" "-Wundef" "-Wshadow" "-funsigned-char"
+                "-Wchar-subscripts" "-Wcast-align" "-Wwrite-strings" "-Wunused" "-Wuninitialized"
+                "-Wpointer-arith" "-Wredundant-decls" "-Winline" "-Wformat"
+                "-Wformat-security" "-Winit-self" "-Wdeprecated-declarations"
+                "-Wmissing-include-dirs" "-Wmissing-declarations")
+            if(REAPER_WARNING_AS_ERRORS)
+                list(APPEND REAPER_DEBUG_FLAGS "-Werror")
+            endif()
         else()
             message(FATAL_ERROR "Could not detect compiler")
         endif()
     else()
         if(MSVC)
-            target_compile_options(${target} PRIVATE "$<$<CONFIG:DEBUG>:${REAPER_MSVC_DISABLE_WARNINGS}>")
-            target_compile_options(${target} PRIVATE "$<$<CONFIG:RELEASE>:${REAPER_MSVC_DISABLE_WARNINGS}>")
-        endif()
-    endif()
+            list(APPEND REAPER_DEBUG_FLAGS "/W0")
+            list(APPEND REAPER_RELEASE_FLAGS "/W0")
+        endif()
+    endif()
+    target_compile_options(${target} PRIVATE "$<$<CONFIG:DEBUG>:${REAPER_DEBUG_FLAGS}>")
+    target_compile_options(${target} PRIVATE "$<$<CONFIG:RELEASE>:${REAPER_RELEASE_FLAGS}>")
 endfunction()

 # Common helper that sets relevant C++ warnings and compilation flags


BUG: Fix CircleCI detection in itksoftwareguide-dashboard

--- Docker/itksoftwareguide-dashboard/dashboard.cmake
+++ Docker/itksoftwareguide-dashboard/dashboard.cmake
@@ -8,7 +8,12 @@

 # Build identification.
 set(CTEST_SITE "$ENV{HOSTNAME}.docker")
-if("$ENV{CIRCLE_PROJECT_REPONAME}")
+if(NOT "$ENV{CIRCLE_PROJECT_REPONAME}" STREQUAL "")
+  set(in_circleci 1)
+else()
+  set(in_circleci 0)
+endif()
+if(in_circleci)
   set(sha "$ENV{CIRCLE_SHA1}")
   string(SUBSTRING "${sha}" 0 7 short_sha)
   set(CTEST_BUILD_NAME "Software Guide CircleCI build $ENV{CIRCLE_BUILD_NUM} for ${short_sha}")
@@ -50,7 +55,7 @@
 CMAKE_JOB_POOL_LINK:STRING=link
 ")

-if("$ENV{CIRCLE_PROJECT_REPONAME}")
+if(in_circleci)
   ctest_start(Experimental)
 else()
   ctest_start(Nightly)


[cmake] Unmark LLVM_BUILD_INSTRUMENTED_COVERAGE as experimental

The coverage bot has been stable for a while:

  http://lab.llvm.org:8080/coverage/coverage-reports/index.html

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@313769 91177308-0d34-0410-b5e6-96231b3b80d8
(cherry picked from commit 580fbe1a5e29e08c16ebd9c6243a51ec48c32a5f)

--- cmake/modules/HandleLLVMOptions.cmake
+++ cmake/modules/HandleLLVMOptions.cmake
@@ -725,7 +725,7 @@
   message(FATAL_ERROR "Exception handling requires RTTI. You must set LLVM_ENABLE_RTTI to ON")
 endif()

-option(LLVM_BUILD_INSTRUMENTED "Build LLVM and tools with PGO instrumentation (experimental)" Off)
+option(LLVM_BUILD_INSTRUMENTED "Build LLVM and tools with PGO instrumentation" Off)
 mark_as_advanced(LLVM_BUILD_INSTRUMENTED)
 append_if(LLVM_BUILD_INSTRUMENTED "-fprofile-instr-generate='${LLVM_PROFILE_FILE_PATTERN}'"
   CMAKE_CXX_FLAGS
@@ -733,7 +733,7 @@
   CMAKE_EXE_LINKER_FLAGS
   CMAKE_SHARED_LINKER_FLAGS)

-option(LLVM_BUILD_INSTRUMENTED_COVERAGE "Build LLVM and tools with Code Coverage instrumentation (experimental)" Off)
+option(LLVM_BUILD_INSTRUMENTED_COVERAGE "Build LLVM and tools with Code Coverage instrumentation" Off)
 mark_as_advanced(LLVM_BUILD_INSTRUMENTED_COVERAGE)
 append_if(LLVM_BUILD_INSTRUMENTED_COVERAGE "-fprofile-instr-generate='${LLVM_PROFILE_FILE_PATTERN}' -fcoverage-mapping"
   CMAKE_CXX_FLAGS


[cmake] Allow LLVM_BUILD_INSTRUMENTED to be set to IR or Frontend

- This deprecates LLVM_ENABLE_IR_PGO but keeps it around for now.
- Errors out when LLVM_BUILD_INSTRUMENTED and LLVM_BUILD_INSTRUMENTED_COVERAGE
  are both set.

Motivated by bogner's post-commit review of r313770.

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

--- cmake/modules/HandleLLVMOptions.cmake
+++ cmake/modules/HandleLLVMOptions.cmake
@@ -738,14 +738,15 @@
   message(FATAL_ERROR "Exception handling requires RTTI. You must set LLVM_ENABLE_RTTI to ON")
 endif()

-option(LLVM_ENABLE_IR_PGO "Build LLVM and tools with IR PGO instrumentation (experimental)" Off)
+option(LLVM_ENABLE_IR_PGO "Build LLVM and tools with IR PGO instrumentation (deprecated)" Off)
 mark_as_advanced(LLVM_ENABLE_IR_PGO)

-option(LLVM_BUILD_INSTRUMENTED "Build LLVM and tools with PGO instrumentation" Off)
+set(LLVM_BUILD_INSTRUMENTED OFF CACHE STRING "Build LLVM and tools with PGO instrumentation. May be specified as IR or Frontend")
 mark_as_advanced(LLVM_BUILD_INSTRUMENTED)
+string(TOUPPER "${LLVM_BUILD_INSTRUMENTED}" uppercase_LLVM_BUILD_INSTRUMENTED)

 if (LLVM_BUILD_INSTRUMENTED)
-  if (LLVM_ENABLE_IR_PGO)
+  if (LLVM_ENABLE_IR_PGO OR uppercase_LLVM_BUILD_INSTRUMENTED STREQUAL "IR")
     append("-fprofile-generate='${LLVM_PROFILE_DATA_DIR}'"
       CMAKE_CXX_FLAGS
       CMAKE_C_FLAGS
@@ -767,6 +768,10 @@
   CMAKE_C_FLAGS
   CMAKE_EXE_LINKER_FLAGS
   CMAKE_SHARED_LINKER_FLAGS)
+
+if (LLVM_BUILD_INSTRUMENTED AND LLVM_BUILD_INSTRUMENTED_COVERAGE)
+  message(FATAL_ERROR "LLVM_BUILD_INSTRUMENTED and LLVM_BUILD_INSTRUMENTED_COVERAGE cannot both be specified")
+endif()

 if(LLVM_ENABLE_LTO AND LLVM_ON_WIN32 AND NOT LINKER_IS_LLD_LINK)
   message(FATAL_ERROR "When compiling for Windows, LLVM_ENABLE_LTO requires using lld as the linker (point CMAKE_LINKER at lld-link.exe)")


Tell NiftyReg to throw error instead of exiting (required for matlab/python)

--- SuperBuild/External_NiftyReg.cmake
+++ SuperBuild/External_NiftyReg.cmake
@@ -64,6 +64,7 @@
         -DCMAKE_LIBRARY_PATH=${SUPERBUILD_INSTALL_DIR}/lib
         -DCMAKE_INCLUDE_PATH=${SUPERBUILD_INSTALL_DIR}
         -DCMAKE_INSTALL_PREFIX=${${proj}_Install_Dir}
+        -DUSE_THROW_EXCEP=ON
 	    INSTALL_DIR ${${proj}_Install_Dir}
     DEPENDS
         ${${proj}_DEPENDENCIES}


COMP: Set README.md as the package README

--- ANTS.cmake
+++ ANTS.cmake
@@ -30,10 +30,10 @@
 set(CPACK_PACKAGE_VERSION ${${PROJECT_NAME}_VERSION})
 set(CPACK_PACKAGE_INSTALL_DIRECTORY "ANTS_Install")
 set(CPACK_BINARY_GENERATORS "DragNDrop TGZ TZ")
-set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.txt")
+set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "ANTs - robust image registration, segmentation and more")
 set(CPACK_RESOURCE_FILE_LICENSE  "${CMAKE_CURRENT_SOURCE_DIR}/ANTSCopyright.txt")
-set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.txt")
+set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")

 message(STATUS "Building ${PROJECT_NAME} version \"${${PROJECT_NAME}_VERSION}\"")


adding ispc opt flags

adding ispc opt flags

--- components/ospcommon/cmake/ispc.cmake
+++ components/ospcommon/cmake/ispc.cmake
@@ -109,10 +109,19 @@
     SET(ISPC_INCLUDE_DIR_PARMS "-I" ${ISPC_INCLUDE_DIR_PARMS})
   ENDIF()

+  #CAUTION: -O0/1 -g with ispc seg faults
+  SET(ISPC_FLAGS_DEBUG -O2 -g CACHE STRING "ISPC Debug flags")
+  MARK_AS_ADVANCED(ISPC_FLAGS_DEBUG)
+  SET(ISPC_FLAGS_RELEASE -O3 CACHE STRING "ISPC Release flags")
+  MARK_AS_ADVANCED(ISPC_FLAGS_RELEASE)
+  SET(ISPC_FLAGS_RELWITHDEBINFO -O2 -g CACHE STRING "ISPC Release with Debug symbols flags")
+  MARK_AS_ADVANCED(ISPC_FLAGS_RELWITHDEBINFO)
   IF (WIN32 OR "${CMAKE_BUILD_TYPE}" STREQUAL "Release")
-    SET(ISPC_OPT_FLAGS -O3)
+    SET(ISPC_OPT_FLAGS ${ISPC_FLAGS_RELEASE})
+  ELSEIF ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
+    SET(ISPC_OPT_FLAGS ${ISPC_FLAGS_DEBUG})
   ELSE()
-    SET(ISPC_OPT_FLAGS -O2 -g)
+    SET(ISPC_OPT_FLAGS ${ISPC_FLAGS_RELWITHDEBINFO})
   ENDIF()

   IF (NOT WIN32)


fbcode_builder: support installing thrift generated header files

Summary:
Update add_thrift_cpp2_library() to add a PUBLIC_HEADER property to the
generated library target, so that the generated headers can be installed using
an `install()` call.  Also add a `HEADER_INSTALL_DIR` property which indicates
the directory they should be installed into.  A `INCLUDE_DIR` argument was
added to customize the include installation path, should anyone care to do so.

This also removes code that was previously incorrectly installing the
generated headers into the source tree.

Reviewed By: wez

Differential Revision: D16853404

fbshipit-source-id: 6f640b2bd347c99804e074fca0209dda37c8a9cf

--- build/fbcode_builder/CMake/ThriftCppLibrary.cmake
+++ build/fbcode_builder/CMake/ThriftCppLibrary.cmake
@@ -4,10 +4,26 @@

 include(FBCMakeParseArgs)

+# Generate a C++ library from a thrift file
+#
+# Parameters:
+# - SERVICES <svc1> [<svc2> ...]
+#   The names of the services defined in the thrift file.
+# - DEPENDS <dep1> [<dep2> ...]
+#   A list of other thrift C++ libraries that this library depends on.
+# - OPTIONS <opt1> [<opt2> ...]
+#   A list of options to pass to the thrift compiler.
+# - INCLUDE_DIR <path>
+#   The sub-directory where generated headers will be installed.
+#   Defaults to "include" if not specified.  The caller must still call
+#   install() to install the thrift library if desired.
 function(add_thrift_cpp2_library LIB_NAME THRIFT_FILE)
   # Parse the arguments
+  set(one_value_args INCLUDE_DIR)
   set(multi_value_args SERVICES DEPENDS OPTIONS)
-  fb_cmake_parse_args(ARG "" "" "${multi_value_args}" "${ARGN}")
+  fb_cmake_parse_args(
+    ARG "" "${one_value_args}" "${multi_value_args}" "${ARGN}"
+  )

   get_filename_component(base ${THRIFT_FILE} NAME_WE)
   get_filename_component(
@@ -23,6 +39,9 @@
     "${CMAKE_CURRENT_SOURCE_DIR}/${THRIFT_FILE}"
   )
   get_filename_component(include_prefix ${include_prefix} DIRECTORY)
+  if(NOT DEFINED ARG_INCLUDE_DIR)
+    set(ARG_INCLUDE_DIR "include")
+  endif()

   if (NOT "${include_prefix}" STREQUAL "")
     list(APPEND ARG_OPTIONS "include_prefix=${include_prefix}")
@@ -110,19 +129,11 @@
     ${generated_sources}
   )

-  install(
-    FILES ${generated_headers}
-    DESTINATION $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>/gen-cpp2
-  )
-
   target_include_directories(
     "${LIB_NAME}"
-    PRIVATE
-      ${CMAKE_SOURCE_DIR}
-      ${CMAKE_BINARY_DIR}
     PUBLIC
-      ${FOLLY_INCLUDE_DIR}
-      ${FBTHRIFT_INCLUDE_DIR}
+      "$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>"
+      "$<INSTALL_INTERFACE:${ARG_INCLUDE_DIR}>"
   )
   target_link_libraries(
     "${LIB_NAME}"
@@ -132,14 +143,27 @@
       Folly::folly
   )

+  # Add ${generated_headers} to the PUBLIC_HEADER property for ${LIB_NAME}
+  #
+  # This allows callers to install it using
+  # "install(TARGETS ${LIB_NAME} PUBLIC_HEADER)"
+  # However, note that CMake's PUBLIC_HEADER behavior is rather inflexible,
+  # and does have any way to preserve header directory structure.  Callers
+  # must be careful to use the correct PUBLIC_HEADER DESTINATION parameter
+  # when doing this, to put the files the correct directory themselves.
+  # We define a HEADER_INSTALL_DIR property with the include directory prefix,
+  # so typically callers should specify the PUBLIC_HEADER DESTINATION as
+  # "$<TARGET_PROPERTY:${LIB_NAME},HEADER_INSTALL_DIR>"
+  set_property(
+    TARGET "${LIB_NAME}"
+    PROPERTY PUBLIC_HEADER ${generated_headers}
+  )
+
   set_target_properties(
     "${LIB_NAME}"
     PROPERTIES
       EXPORT_PROPERTIES "THRIFT_INCLUDE_DIRECTORY"
       THRIFT_INCLUDE_DIRECTORY "${CMAKE_SOURCE_DIR}"
+      HEADER_INSTALL_DIR "${ARG_INCLUDE_DIR}/${include_prefix}/gen-cpp2"
   )
-
-  get_property(thrift_include_directory
-    TARGET "${LIB_NAME}"
-    PROPERTY THRIFT_INCLUDE_DIRECTORY)
 endfunction()


Updated cmake file to list all import/export options


enh: Add FindFLANN module which can look for the different libraries [BASIS]

--- CMake/Basis/FindFLANN.cmake
+++ CMake/Basis/FindFLANN.cmake
@@ -1,40 +1,347 @@
-###############################################################################
-# Find FLANN -- http://www.cs.ubc.ca/research/flann
-#
-# This sets the following variables:
-# FLANN_FOUND        - True if FLANN was found.
-# FLANN_INCLUDE_DIRS - Directories containing the FLANN include files.
-# FLANN_LIBRARIES    - Libraries needed to use FLANN.
-# FLANN_DEFINITIONS  - Compiler flags for FLANN.
+#.rst:
+# FindFLANN
+# ---------
+#
+# Find Fast Library for Approximate Nearest Neighbors (FLANN).
+# See http://www.cs.ubc.ca/research/flann for details.
+#
+# This module considers the following CMake variables set by find_package:
+#
+# ::
+#
+#    FLANN_FIND_COMPONENTS   - Names of requested components:
+#                                cpp        - shared or static C++ library
+#                                cpp_shared - shared C++ library
+#                                cpp_static - static C++ library
+#                                c          - shared or static C bindings library
+#                                c_shared   - shared C bindings library
+#                                c_static   - static C bindings library
+#                                matlab     - MATLAB bindings
+#                                python     - Python bindings
+#    FLANN_FIND_REQUIRED_<C> - Whether FLANN component <C> is required.
+#                              FLANN is considered to be not found when at least
+#                              one required library or its include path is missing.
+#                              When no FLANN_FIND_COMPONENTS are specified,
+#                              the static and shared C++ libraries are looked for.
+#    FLANN_FIND_REQUIRED     - Raise FATAL_ERROR when required components not found.
+#    FLANN_FIND_QUIETLY      - Suppress all other (status) messages.
+#
+# .. note::
+#
+#    The "matlab" and "python" components are currently not supported yet.
+#
+# This module caches the following variables:
+#
+# ::
+#
+#    FLANN_INCLUDE_DIR        - Include path of C/C++ header files.
+#    FLANN_C_LIBRARY_SHARED   - Path of shared C bindings link library.
+#    FLANN_C_LIBRARY_STATIC   - Path of static C bindings link library.
+#    FLANN_CPP_LIBRARY_SHARED - Path of shared C++ link library.
+#    FLANN_CPP_LIBRARY_STATIC - Path of static c++ link library.
+#
+# It further defines the following uncached variables:
+#
+# ::
+#
+#    FLANN_FOUND          - Whether all required FLANN components were found.
+#    FLANN_<C>_FOUND      - Whether library component <C> was found.
+#    FLANN_C_LIBRARY      - Path of C bindings link library (shared preferred).
+#    FLANN_CPP_LIBRARY    - Path of C++ link library (shared preferred).
+#    FLANN_LIBRARIES      - Paths of all found libraries (shared preferred).
+#    FLANN_VERSION        - Version for use in VERSION_LESS et al. comparisons.
+#    FLANN_VERSION_MAJOR  - Major library version number.
+#    FLANN_VERSION_MINOR  - Minor library version number.
+#    FLANN_VERSION_PATCH  - Patch library version number.
+#    FLANN_VERSION_STRING - Version string for output messages.
+
+#=============================================================================
+# Copyright 2016 Andreas Schuh <andreas.schuh.84@gmail.com>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+#  License text for the above reference.)
+
+if (NOT FLANN_FIND_QUIETLY)
+  set(_FLANN_FIND_STATUS "Looking for FLANN")
+  if (FLANN_FIND_COMPONENTS)
+    set(_FLANN_FIND_STATUS "${_FLANN_FIND_STATUS} [${FLANN_FIND_COMPONENTS}]")
+  endif ()
+  if (NOT FLANN_FIND_REQUIRED)
+    set(_FLANN_FIND_STATUS "${_FLANN_FIND_STATUS} (optional)")
+  endif ()
+  message(STATUS "${_FLANN_FIND_STATUS}...")
+endif ()
+
+# ------------------------------------------------------------------------------
+# Components
+set(_FLANN_COMPONENTS c c_shared c_static cpp cpp_shared cpp_static matlab python)
+foreach (_FLANN_COMPONENT IN LISTS _FLANN_COMPONENTS)
+  set(_FLANN_FIND_${_FLANN_COMPONENT} FALSE)
+endforeach ()
+
+if (NOT FLANN_FIND_COMPONENTS)
+  set(FLANN_FIND_COMPONENTS cpp)
+  set(FLANN_FIND_REQUIRED_cpp ${FLANN_FIND_REQUIRED})
+endif ()
+
+foreach (_FLANN_COMPONENT IN LISTS FLANN_FIND_COMPONENTS)
+  if     (_FLANN_COMPONENT MATCHES "^c$")
+    set(_FLANN_FIND_c TRUE)
+  elseif (_FLANN_COMPONENT MATCHES "^(c_shared|flann)$")
+    set(_FLANN_FIND_c_shared TRUE)
+  elseif (_FLANN_COMPONENT MATCHES "^(c_static|flann_s)$")
+    set(_FLANN_FIND_c_static TRUE)
+  elseif (_FLANN_COMPONENT MATCHES "^cpp$")
+    set(_FLANN_FIND_cpp TRUE)
+  elseif (_FLANN_COMPONENT MATCHES "^(cpp_shared|flann_cpp)$")
+    set(_FLANN_FIND_cpp_shared TRUE)
+  elseif (_FLANN_COMPONENT MATCHES "^(cpp_static|cpp_s|flann_cpp_s)$")
+    set(_FLANN_FIND_cpp_static TRUE)
+  elseif (_FLANN_COMPONENT MATCHES "^(matlab|mex)$")
+    message(FATAL_ERROR "FLANN library component \"${_FLANN_COMPONENT}\" not supported yet")
+  elseif (_FLANN_COMPONENT MATCHES "^python$")
+    message(FATAL_ERROR "FLANN library component \"python\" not supported yet")
+  else ()
+    message(FATAL_ERROR "Unknown FLANN library component: ${_FLANN_COMPONENT}\n"
+                        "Valid component names are: c, c_shared|flann, c_static|flann_s, cpp_shared|flann_cpp, cpp_static|cpp_s|flann_cpp_s, matlab|mex, python")
+  endif ()
+endforeach ()
+
+if (FLANN_DEBUG)
+  message("** FindFLANN: Components = [${FLANN_FIND_COMPONENTS}]")
+  foreach (_FLANN_COMPONENT IN LISTS _FLANN_COMPONENTS)
+    message("** FindFLANN: - Find component ${_FLANN_COMPONENT} = ${_FLANN_FIND_${_FLANN_COMPONENT}}")
+  endforeach ()
+endif ()
+
+# ------------------------------------------------------------------------------
+# Construct a set of search paths
+set(_FLANN_INC_DIR_HINTS)
+set(_FLANN_LIB_DIR_HINTS)
+
+if (NOT FLANN_ROOT)
+  file(TO_CMAKE_PATH "$ENV{FLANN_ROOT}" FLANN_ROOT)
+endif ()

 find_package(PkgConfig QUIET)
 if (PkgConfig_FOUND)
-  pkg_check_modules(PC_FLANN flann)
+  pkg_check_modules(_FLANN flann QUIET)
+  if (_FLANN_INCLUDEDIR)
+    list(APPEND _FLANN_INC_DIR_HINTS ${_FLANN_INCLUDEDIR})
+  endif ()
+  if (_FLANN_INCLUDE_DIRS)
+    list(APPEND _FLANN_INC_DIR_HINTS ${_FLANN_INCLUDE_DIRS})
+  endif ()
+  if (_FLANN_LIBDIR)
+    list(APPEND _FLANN_LIB_DIR_HINTS ${_FLANN_LIBDIR})
+  endif ()
+  if (_FLANN_LIBRARY_DIRS)
+    list(APPEND _FLANN_LIB_DIR_HINTS ${_FLANN_LIBRARY_DIRS})
+  endif ()
+  unset(_FLANN_INCLUDEDIR)
+  unset(_FLANN_INCLUDE_DIRS)
+  unset(_FLANN_LIBDIR)
+  unset(_FLANN_LIBRARY_DIRS)
+  unset(_FLANN_CFLAGS_OTHER)
+endif ()
+
+if (FLANN_DEBUG)
+  message("** FindFLANN: Initial search paths:")
+  message("** FindFLANN: - Root directory hints   = [${FLANN_ROOT}]")
+  message("** FindFLANN: - PkgConfig include path = [${_FLANN_INC_DIR_HINTS}]")
+  message("** FindFLANN: - PkgConfig library path = [${_FLANN_LIB_DIR_HINTS}]")
+endif ()
+
+# ------------------------------------------------------------------------------
+# Find common include directory
+#
+# Looking for flann/config.h because we use this path later to read this file
+# in order to extract the version information.
+find_path(FLANN_INCLUDE_DIR
+  NAMES flann/config.h
+  HINTS ${FLANN_ROOT} ${_FLANN_INC_DIR_HINTS}
+)
+
+mark_as_advanced(FLANN_INCLUDE_DIR)
+
+# ------------------------------------------------------------------------------
+# Derive FLANN_ROOT from FLANN_INCLUDE_DIR if unset
+if (FLANN_INCLUDE_DIR AND NOT FLANN_ROOT)
+  get_filename_component(FLANN_ROOT "${FLANN_INCLUDE_DIR}" DIRECTORY)
+endif ()
+
+if (FLANN_DEBUG)
+  message("** FindFLANN: After initial search of FLANN include path")
+  message("** FindFLANN: - FLANN_INCLUDE_DIR = ${FLANN_INCLUDE_DIR}")
+  message("** FindFLANN: - FLANN_ROOT        = [${FLANN_ROOT}]")
+endif ()
+
+# ------------------------------------------------------------------------------
+# Find libraries
+unset(FLANN_C_LIBRARY)
+unset(FLANN_CPP_LIBRARY)
+
+set(FLANN_INCLUDE_DIRS ${FLANN_INCLUDE_DIR})
+set(FLANN_LIBRARIES)
+
+foreach (_FLANN_COMPONENT IN LISTS FLANN_FIND_COMPONENTS)
+  set(FLANN_${_FLANN_COMPONENT}_FOUND FALSE)
+endforeach ()
+
+if (FLANN_INCLUDE_DIR)
+
+  # Shared C library
+  if (_FLANN_FIND_c OR _FLANN_FIND_c_shared)
+    find_library(FLANN_C_LIBRARY_SHARED
+      NAMES flann
+      HINTS ${FLANN_ROOT} ${_FLANN_LIB_DIR_HINTS}
+    )
+    if (FLANN_C_LIBRARY_SHARED)
+      set(FLANN_c_FOUND        TRUE)
+      set(FLANN_c_shared_FOUND TRUE)
+    endif ()
+    mark_as_advanced(FLANN_C_LIBRARY_SHARED)
+  endif ()
+
+  # Static C library
+  if (_FLANN_FIND_c OR _FLANN_FIND_c_static)
+    find_library(FLANN_C_LIBRARY_STATIC
+      NAMES flann_s
+      HINTS ${FLANN_ROOT} ${_FLANN_LIB_DIR_HINTS}
+    )
+    if (FLANN_C_LIBRARY_STATIC)
+      set(FLANN_c_FOUND        TRUE)
+      set(FLANN_c_static_FOUND TRUE)
+    endif ()
+    mark_as_advanced(FLANN_C_LIBRARY_STATIC)
+  endif ()
+
+  # Set FLANN_C_LIBRARY and add it to FLANN_LIBRARIES
+  if (FLANN_C_LIBRARY_SHARED)
+    set(FLANN_C_LIBRARY ${FLANN_C_LIBRARY_SHARED})
+  elseif (FLANN_C_LIBRARY_STATIC)
+    set(FLANN_C_LIBRARY ${FLANN_C_LIBRARY_STATIC})
+  endif ()
+  if (FLANN_C_LIBRARY)
+    list(APPEND FLANN_LIBRARIES ${FLANN_C_LIBRARY})
+  endif ()
+
+  # Shared C++ library
+  if (_FLANN_FIND_cpp OR _FLANN_FIND_cpp_shared)
+    find_library(FLANN_CPP_LIBRARY_SHARED
+      NAMES flann_cpp
+      HINTS ${FLANN_ROOT} ${_FLANN_LIB_DIR_HINTS}
+    )
+    if (FLANN_CPP_LIBRARY_SHARED)
+      set(FLANN_cpp_FOUND        TRUE)
+      set(FLANN_cpp_shared_FOUND TRUE)
+    endif ()
+    mark_as_advanced(FLANN_CPP_LIBRARY_SHARED)
+  endif ()
+
+  # Static C++ library
+  if (_FLANN_FIND_cpp OR _FLANN_FIND_cpp_static)
+    find_library(FLANN_CPP_LIBRARY_STATIC
+      NAMES flann_cpp_s
+      HINTS ${FLANN_ROOT} ${_FLANN_LIB_DIR_HINTS}
+    )
+    if (FLANN_CPP_LIBRARY_STATIC)
+      set(FLANN_cpp_FOUND        TRUE)
+      set(FLANN_cpp_static_FOUND TRUE)
+    endif ()
+    mark_as_advanced(FLANN_CPP_LIBRARY_STATIC)
+  endif ()
+
+  # Set FLANN_CPP_LIBRARY and add it to FLANN_LIBRARIES
+  if (FLANN_CPP_LIBRARY_SHARED)
+    set(FLANN_CPP_LIBRARY ${FLANN_CPP_LIBRARY_SHARED})
+  elseif (FLANN_CPP_LIBRARY_STATIC)
+    set(FLANN_CPP_LIBRARY ${FLANN_CPP_LIBRARY_STATIC})
+  endif ()
+  if (FLANN_CPP_LIBRARY)
+    list(APPEND FLANN_LIBRARIES ${FLANN_CPP_LIBRARY})
+  endif ()
+
+  if (FLANN_DEBUG)
+    message("** FindFLANN: C/C++ library paths:")
+    message("** FindFLANN: - FLANN_C_LIBRARY          = ${FLANN_C_LIBRARY}")
+    message("** FindFLANN: - FLANN_C_LIBRARY_SHARED   = ${FLANN_C_LIBRARY_SHARED}")
+    message("** FindFLANN: - FLANN_C_LIBRARY_STATIC   = ${FLANN_C_LIBRARY_STATIC}")
+    message("** FindFLANN: - FLANN_CPP_LIBRARY        = ${FLANN_CPP_LIBRARY}")
+    message("** FindFLANN: - FLANN_CPP_LIBRARY_SHARED = ${FLANN_CPP_LIBRARY_SHARED}")
+    message("** FindFLANN: - FLANN_CPP_LIBRARY_STATIC = ${FLANN_CPP_LIBRARY_STATIC}")
+    message("** FindFLANN: - FLANN_LIBRARIES          = [${FLANN_LIBRARIES}]")
+  endif ()
+endif ()
+
+# ------------------------------------------------------------------------------
+# Extract library version from flann/config.h
+if (FLANN_INCLUDE_DIR)
+  if (NOT DEFINED FLANN_VERSION_MAJOR OR
+      NOT DEFINED FLANN_VERSION_MINOR OR
+      NOT DEFINED FLANN_VERSION_PATCH)
+    file(READ "${FLANN_INCLUDE_DIR}/flann/config.h" _FLANN_CONFIG_CONTENTS LIMIT 2048)
+    if (_FLANN_CONFIG_CONTENTS MATCHES "#define FLANN_VERSION_? \"([0-9]+)\\.([0-9]+)\\.([0-9]+)\"")
+      set(FLANN_VERSION_MAJOR ${CMAKE_MATCH_1})
+      set(FLANN_VERSION_MINOR ${CMAKE_MATCH_2})
+      set(FLANN_VERSION_PATCH ${CMAKE_MATCH_3})
+    else ()
+      if (NOT FLANN_FIND_QUIETLY)
+        message(WARNING "Could not extract FLANN version numbers from: ${FLANN_INCLUDE_DIR}/flann/config.h")
+      endif ()
+      set(FLANN_VERSION_MAJOR 0)
+      set(FLANN_VERSION_MINOR 0)
+      set(FLANN_VERSION_PATCH 0)
+    endif ()
+    unset(_FLANN_CONFIG_CONTENTS)
+  endif ()
+  set(FLANN_VERSION "${FLANN_VERSION_MAJOR}.${FLANN_VERSION_MINOR}.${FLANN_VERSION_PATCH}")
+  set(FLANN_VERSION_STRING "${FLANN_VERSION}")
 else ()
-  set(PC_FLANN_INCLUDEDIR)
-  set(PC_FLANN_INCLUDE_DIRS)
-  set(PC_FLANN_LIBDIR)
-  set(PC_FLANN_LIBRARY_DIRS)
-  set(PC_FLANN_CFLAGS_OTHER)
-endif ()
-
-find_path(FLANN_INCLUDE_DIR flann/flann.hpp
-  HINTS ${PC_FLANN_INCLUDEDIR} ${PC_FLANN_INCLUDE_DIRS}
-  PATHS $ENV{FLANN_DIR} ${FLANN_DIR}
-  PATH_SUFFIXES include
+  unset(FLANN_VERSION)
+  unset(FLANN_VERSION_MAJOR)
+  unset(FLANN_VERSION_MINOR)
+  unset(FLANN_VERSION_PATCH)
+  unset(FLANN_VERSION_STRING)
+endif ()
+
+if (FLANN_DEBUG)
+  message("** FindFLANN: Version information from ${FLANN_INCLUDE_DIR}/flann/config.h")
+  message("** FindFLANN: - FLANN_VERSION_STRING = ${FLANN_VERSION_STRING}")
+  message("** FindFLANN: - FLANN_VERSION_MAJOR  = ${FLANN_VERSION_MAJOR}")
+  message("** FindFLANN: - FLANN_VERSION_MINOR  = ${FLANN_VERSION_MINOR}")
+  message("** FindFLANN: - FLANN_VERSION_PATCH  = ${FLANN_VERSION_PATCH}")
+endif ()
+
+# ------------------------------------------------------------------------------
+# Handle QUIET, REQUIRED, and [EXACT] VERSION arguments and set FLANN_FOUND
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(FLANN
+  REQUIRED_VARS FLANN_INCLUDE_DIR
+  VERSION_VAR   FLANN_VERSION
+  HANDLE_COMPONENTS
 )

-find_library(FLANN_LIBRARY flann
-  HINTS ${PC_FLANN_LIBDIR} ${PC_FLANN_LIBRARY_DIRS}
-  PATHS $ENV{FLANN_DIR} ${FLANN_DIR}
-  PATH_SUFFIXES lib
-)
-
-set(FLANN_INCLUDE_DIRS ${FLANN_INCLUDE_DIR})
-set(FLANN_LIBRARIES    ${FLANN_LIBRARY})
-set(FLANN_DEFINITIONS  ${PC_FLANN_CFLAGS_OTHER})
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(FLANN DEFAULT_MSG FLANN_LIBRARY FLANN_INCLUDE_DIR)
-
-mark_as_advanced(FLANN_LIBRARY FLANN_INCLUDE_DIR)
+if (NOT FLANN_FIND_QUIETLY)
+  if (FLANN_FOUND)
+    message(STATUS "${_FLANN_FIND_STATUS}... - found v${FLANN_VERSION_STRING}")
+  else ()
+    message(STATUS "${_FLANN_FIND_STATUS}... - not found")
+  endif ()
+endif ()
+
+# ------------------------------------------------------------------------------
+# Unset local auxiliary variables
+foreach (_FLANN_COMPONENT IN LISTS _FLANN_COMPONENTS)
+  unset(_FLANN_FIND_${_FLANN_COMPONENT})
+endforeach ()
+unset(_FLANN_COMPONENT)
+unset(_FLANN_COMPONENTS)
+unset(_FLANN_FIND_STATUS)


From Peter Bear, "Attached is a fix for the detection of GDAL 1.7.0. The previous CMake file only supported up to 1.6, this fix supports 1.7."

--- CMakeModules/FindGDAL.cmake
+++ CMakeModules/FindGDAL.cmake
@@ -57,20 +57,20 @@
 )

 FIND_LIBRARY(GDAL_LIBRARY
-  NAMES gdal gdal_i gdal1.6.0 gdal1.5.0 gdal1.4.0 gdal1.3.2 GDAL
+  NAMES gdal gdal_i gdal1.7.0 gdal1.6.0 gdal1.5.0 gdal1.4.0 gdal1.3.2 GDAL
   PATHS
   $ENV{GDAL_DIR}
   NO_DEFAULT_PATH
   PATH_SUFFIXES lib64 lib
 )
 FIND_LIBRARY(GDAL_LIBRARY
-  NAMES gdal gdal_i gdal1.6.0 gdal1.5.0 gdal1.4.0 gdal1.3.2 GDAL
+  NAMES gdal gdal_i gdal1.7.0 gdal1.6.0 gdal1.5.0 gdal1.4.0 gdal1.3.2 GDAL
   PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this.
     NO_DEFAULT_PATH
     PATH_SUFFIXES lib64 lib
 )
 FIND_LIBRARY(GDAL_LIBRARY
-  NAMES gdal gdal_i gdal1.6.0 gdal1.5.0 gdal1.4.0 gdal1.3.2 GDAL
+  NAMES gdal gdal_i gdal1.7.0 gdal1.6.0 gdal1.5.0 gdal1.4.0 gdal1.3.2 GDAL
   PATHS
     ~/Library/Frameworks
     /Library/Frameworks