Find `librt`: Reformat CMake code

Find `librt`: Reformat CMake code

--- cmake/Modules/FindLibRt.cmake
+++ cmake/Modules/FindLibRt.cmake
@@ -1,26 +1,24 @@
+# ~~~
 # Finds librt
 # Sets the variables LIBRT_FOUND and LIBRT_LIBRARIES
 #
 # Distributed under the BSD license. See COPYING-CMAKE-SCRIPTS for details.
+# ~~~

 find_library (LIBRT_LIBRARIES "rt")

 include (FindPackageHandleStandardArgs)

-# handles the REQUIRED, QUIET and version-related arguments to find_package().
-# It also sets the LIBRT_FOUND variable.
+# handles the REQUIRED, QUIET and version-related arguments to find_package(). It also sets the LIBRT_FOUND variable.
 find_package_handle_standard_args (LibRt DEFAULT_MSG LIBRT_LIBRARIES)

 # hide variables from the CMake GUI
 mark_as_advanced (LIBRT_LIBRARIES)

-# Most systems (except Linux) have librt features built into their libc.
-# If no librt has been found, there is still a chance that the system supports our desired features.
+# Most systems (except Linux) have librt features built into their libc. If no librt has been found, there is still a chance that the system
+# supports our desired features.
 if (NOT LIBRT_FOUND)
-	try_compile (HAS_LIBRT_4SURE
-		"${CMAKE_BINARY_DIR}"
-		"${PROJECT_SOURCE_DIR}/tests/librt_test.c"
-	)
+	try_compile (HAS_LIBRT_4SURE "${CMAKE_BINARY_DIR}" "${PROJECT_SOURCE_DIR}/tests/librt_test.c")

 	if (HAS_LIBRT_4SURE)
 		set (LIBRT_FOUND on)
@@ -28,4 +26,4 @@
 		message (STATUS "using system's built-in librt functions")
 	endif ()
 	unset (HAS_LIBRT_4SURE)
-endif ()+endif ()


Remove cross-compiling fallback of -j1 for builds

Hopefully this makes builds on bigmac much faster

--- cmake/PVExternalProject.cmake
+++ cmake/PVExternalProject.cmake
@@ -111,13 +111,7 @@
     if("${build_cmd}" MATCHES "^\\$\\(MAKE\\)")
       # GNU make recognizes the string "$(MAKE)" as recursive make, so
       # ensure that it appears directly in the makefile.
-      if (CROSS_BUILD_STAGE STREQUAL "HOST")
-        string(REGEX REPLACE "^\\$\\(MAKE\\)" "${CMAKE_MAKE_PROGRAM} -j${PV_MAKE_NCPUS}" build_cmd "${build_cmd}")
-      else()
-        # Don't do parallel 'make' when cross compiling or building tools for
-        # cross compiling.
-        string(REGEX REPLACE "^\\$\\(MAKE\\)" "${CMAKE_MAKE_PROGRAM} -j1" build_cmd "${build_cmd}")
-      endif()
+      string(REGEX REPLACE "^\\$\\(MAKE\\)" "${CMAKE_MAKE_PROGRAM} -j${PV_MAKE_NCPUS}" build_cmd "${build_cmd}")
       set_property(TARGET pv-${name} PROPERTY _EP_BUILD_COMMAND "${build_cmd}")

     endif()


[cmake] Update FindArrow.cmake

[cmake] Update FindArrow.cmake

This is the version shipped with apache arrow v0.16.

--- cmake/modules/FindArrow.cmake
+++ cmake/modules/FindArrow.cmake
@@ -15,142 +15,417 @@
 # specific language governing permissions and limitations
 # under the License.

-# - Find ARROW (arrow/api.h, libarrow.a, libarrow.so)
+# - Find Arrow (arrow/api.h, libarrow.a, libarrow.so)
 # This module defines
+#  ARROW_FOUND, whether Arrow has been found
+#  ARROW_FULL_SO_VERSION, full shared object version of found Arrow "100.0.0"
+#  ARROW_IMPORT_LIB, path to libarrow's import library (Windows only)
 #  ARROW_INCLUDE_DIR, directory containing headers
-#  ARROW_LIBS, directory containing arrow libraries
+#  ARROW_LIBS, deprecated. Use ARROW_LIB_DIR instead
+#  ARROW_LIB_DIR, directory containing Arrow libraries
+#  ARROW_SHARED_IMP_LIB, deprecated. Use ARROW_IMPORT_LIB instead
+#  ARROW_SHARED_LIB, path to libarrow's shared library
+#  ARROW_SO_VERSION, shared object version of found Arrow such as "100"
 #  ARROW_STATIC_LIB, path to libarrow.a
-#  ARROW_SHARED_LIB, path to libarrow's shared library
-#  ARROW_SHARED_IMP_LIB, path to libarrow's import library (MSVC only)
-#  ARROW_FOUND, whether arrow has been found
+#  ARROW_VERSION, version of found Arrow
+#  ARROW_VERSION_MAJOR, major version of found Arrow
+#  ARROW_VERSION_MINOR, minor version of found Arrow
+#  ARROW_VERSION_PATCH, patch version of found Arrow
+
+if(DEFINED ARROW_FOUND)
+  return()
+endif()

 include(FindPkgConfig)
-include(GNUInstallDirs)
-
-if ("$ENV{ARROW_HOME}" STREQUAL "")
-  pkg_check_modules(ARROW arrow)
-  if (ARROW_FOUND)
-    pkg_get_variable(ARROW_ABI_VERSION arrow abi_version)
-    message(STATUS "Arrow ABI version: ${ARROW_ABI_VERSION}")
+include(FindPackageHandleStandardArgs)
+
+set(ARROW_SEARCH_LIB_PATH_SUFFIXES)
+if(CMAKE_LIBRARY_ARCHITECTURE)
+  list(APPEND ARROW_SEARCH_LIB_PATH_SUFFIXES "lib/${CMAKE_LIBRARY_ARCHITECTURE}")
+endif()
+list(APPEND ARROW_SEARCH_LIB_PATH_SUFFIXES
+            "lib64"
+            "lib32"
+            "lib"
+            "bin")
+set(ARROW_CONFIG_SUFFIXES
+    "_RELEASE"
+    "_RELWITHDEBINFO"
+    "_MINSIZEREL"
+    "_DEBUG"
+    "")
+if(CMAKE_BUILD_TYPE)
+  string(TOUPPER ${CMAKE_BUILD_TYPE} ARROW_CONFIG_SUFFIX_PREFERRED)
+  set(ARROW_CONFIG_SUFFIX_PREFERRED "_${ARROW_CONFIG_SUFFIX_PREFERRED}")
+  list(INSERT ARROW_CONFIG_SUFFIXES 0 "${ARROW_CONFIG_SUFFIX_PREFERRED}")
+endif()
+
+if(NOT DEFINED ARROW_MSVC_STATIC_LIB_SUFFIX)
+  if(MSVC)
+    set(ARROW_MSVC_STATIC_LIB_SUFFIX "_static")
+  else()
+    set(ARROW_MSVC_STATIC_LIB_SUFFIX "")
+  endif()
+endif()
+
+# Internal function.
+#
+# Set shared library name for ${base_name} to ${output_variable}.
+#
+# Example:
+#   arrow_build_shared_library_name(ARROW_SHARED_LIBRARY_NAME arrow)
+#   # -> ARROW_SHARED_LIBRARY_NAME=libarrow.so on Linux
+#   # -> ARROW_SHARED_LIBRARY_NAME=libarrow.dylib on macOS
+#   # -> ARROW_SHARED_LIBRARY_NAME=arrow.dll with MSVC on Windows
+#   # -> ARROW_SHARED_LIBRARY_NAME=libarrow.dll with MinGW on Windows
+function(arrow_build_shared_library_name output_variable base_name)
+  set(${output_variable}
+      "${CMAKE_SHARED_LIBRARY_PREFIX}${base_name}${CMAKE_SHARED_LIBRARY_SUFFIX}"
+      PARENT_SCOPE)
+endfunction()
+
+# Internal function.
+#
+# Set import library name for ${base_name} to ${output_variable}.
+# This is useful only for MSVC build. Import library is used only
+# with MSVC build.
+#
+# Example:
+#   arrow_build_import_library_name(ARROW_IMPORT_LIBRARY_NAME arrow)
+#   # -> ARROW_IMPORT_LIBRARY_NAME=arrow on Linux (meaningless)
+#   # -> ARROW_IMPORT_LIBRARY_NAME=arrow on macOS (meaningless)
+#   # -> ARROW_IMPORT_LIBRARY_NAME=arrow.lib with MSVC on Windows
+#   # -> ARROW_IMPORT_LIBRARY_NAME=libarrow.dll.a with MinGW on Windows
+function(arrow_build_import_library_name output_variable base_name)
+  set(${output_variable}
+      "${CMAKE_IMPORT_LIBRARY_PREFIX}${base_name}${CMAKE_IMPORT_LIBRARY_SUFFIX}"
+      PARENT_SCOPE)
+endfunction()
+
+# Internal function.
+#
+# Set static library name for ${base_name} to ${output_variable}.
+#
+# Example:
+#   arrow_build_static_library_name(ARROW_STATIC_LIBRARY_NAME arrow)
+#   # -> ARROW_STATIC_LIBRARY_NAME=libarrow.a on Linux
+#   # -> ARROW_STATIC_LIBRARY_NAME=libarrow.a on macOS
+#   # -> ARROW_STATIC_LIBRARY_NAME=arrow.lib with MSVC on Windows
+#   # -> ARROW_STATIC_LIBRARY_NAME=libarrow.dll.a with MinGW on Windows
+function(arrow_build_static_library_name output_variable base_name)
+  set(
+    ${output_variable}
+    "${CMAKE_STATIC_LIBRARY_PREFIX}${base_name}${ARROW_MSVC_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}"
+    PARENT_SCOPE)
+endfunction()
+
+# Internal function.
+#
+# Set macro value for ${macro_name} in ${header_content} to ${output_variable}.
+#
+# Example:
+#   arrow_extract_macro_value(version_major
+#                             "ARROW_VERSION_MAJOR"
+#                             "#define ARROW_VERSION_MAJOR 1.0.0")
+#   # -> version_major=1.0.0
+function(arrow_extract_macro_value output_variable macro_name header_content)
+  string(REGEX MATCH "#define +${macro_name} +[^\r\n]+" macro_definition
+               "${header_content}")
+  string(REGEX
+         REPLACE "^#define +${macro_name} +(.+)$" "\\1" macro_value "${macro_definition}")
+  set(${output_variable} "${macro_value}" PARENT_SCOPE)
+endfunction()
+
+# Internal macro only for arrow_find_package.
+#
+# Find package in HOME.
+macro(arrow_find_package_home)
+  find_path(${prefix}_include_dir "${header_path}"
+            PATHS "${home}"
+            PATH_SUFFIXES "include"
+            NO_DEFAULT_PATH)
+  set(include_dir "${${prefix}_include_dir}")
+  set(${prefix}_INCLUDE_DIR "${include_dir}" PARENT_SCOPE)
+
+  if(MSVC)
+    set(CMAKE_SHARED_LIBRARY_SUFFIXES_ORIGINAL ${CMAKE_FIND_LIBRARY_SUFFIXES})
+    # .dll isn't found by find_library with MSVC because .dll isn't included in
+    # CMAKE_FIND_LIBRARY_SUFFIXES.
+    list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_SHARED_LIBRARY_SUFFIX}")
+  endif()
+  find_library(${prefix}_shared_lib
+               NAMES "${shared_lib_name}"
+               PATHS "${home}"
+               PATH_SUFFIXES ${ARROW_SEARCH_LIB_PATH_SUFFIXES}
+               NO_DEFAULT_PATH)
+  if(MSVC)
+    set(CMAKE_SHARED_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_ORIGINAL})
+  endif()
+  set(shared_lib "${${prefix}_shared_lib}")
+  set(${prefix}_SHARED_LIB "${shared_lib}" PARENT_SCOPE)
+  if(shared_lib)
+    add_library(${target_shared} SHARED IMPORTED)
+    set_target_properties(${target_shared} PROPERTIES IMPORTED_LOCATION "${shared_lib}")
+    if(include_dir)
+      set_target_properties(${target_shared}
+                            PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${include_dir}")
+    endif()
+    find_library(${prefix}_import_lib
+                 NAMES "${import_lib_name}"
+                 PATHS "${home}"
+                 PATH_SUFFIXES ${ARROW_SEARCH_LIB_PATH_SUFFIXES}
+                 NO_DEFAULT_PATH)
+    set(import_lib "${${prefix}_import_lib}")
+    set(${prefix}_IMPORT_LIB "${import_lib}" PARENT_SCOPE)
+    if(import_lib)
+      set_target_properties(${target_shared} PROPERTIES IMPORTED_IMPLIB "${import_lib}")
+    endif()
+  endif()
+
+  find_library(${prefix}_static_lib
+               NAMES "${static_lib_name}"
+               PATHS "${home}"
+               PATH_SUFFIXES ${ARROW_SEARCH_LIB_PATH_SUFFIXES}
+               NO_DEFAULT_PATH)
+  set(static_lib "${${prefix}_static_lib}")
+  set(${prefix}_STATIC_LIB "${static_lib}" PARENT_SCOPE)
+  if(static_lib)
+    add_library(${target_static} STATIC IMPORTED)
+    set_target_properties(${target_static} PROPERTIES IMPORTED_LOCATION "${static_lib}")
+    if(include_dir)
+      set_target_properties(${target_static}
+                            PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${include_dir}")
+    endif()
+  endif()
+endmacro()
+
+# Internal macro only for arrow_find_package.
+#
+# Find package by CMake package configuration.
+macro(arrow_find_package_cmake_package_configuration)
+  find_package(${cmake_package_name} CONFIG)
+  if(${cmake_package_name}_FOUND)
+    set(${prefix}_USE_CMAKE_PACKAGE_CONFIG TRUE PARENT_SCOPE)
+    if(TARGET ${target_shared})
+      foreach(suffix ${ARROW_CONFIG_SUFFIXES})
+        get_target_property(shared_lib ${target_shared} IMPORTED_LOCATION${suffix})
+        if(shared_lib)
+          # Remove shared library version:
+          #   libarrow.so.100.0.0 -> libarrow.so
+          # Because ARROW_HOME and pkg-config approaches don't add
+          # shared library version.
+          string(REGEX
+                 REPLACE "(${CMAKE_SHARED_LIBRARY_SUFFIX})[.0-9]+$" "\\1" shared_lib
+                         "${shared_lib}")
+          set(${prefix}_SHARED_LIB "${shared_lib}" PARENT_SCOPE)
+          break()
+        endif()
+      endforeach()
+    endif()
+    if(TARGET ${target_static})
+      foreach(suffix ${ARROW_CONFIG_SUFFIXES})
+        get_target_property(static_lib ${target_static} IMPORTED_LOCATION${suffix})
+        if(static_lib)
+          set(${prefix}_STATIC_LIB "${static_lib}" PARENT_SCOPE)
+          break()
+        endif()
+      endforeach()
+    endif()
+  endif()
+endmacro()
+
+# Internal macro only for arrow_find_package.
+#
+# Find package by pkg-config.
+macro(arrow_find_package_pkg_config)
+  pkg_check_modules(${prefix}_PC ${pkg_config_name})
+  if(${prefix}_PC_FOUND)
+    set(${prefix}_USE_PKG_CONFIG TRUE PARENT_SCOPE)
+
+    set(include_dir "${${prefix}_PC_INCLUDEDIR}")
+    set(lib_dir "${${prefix}_PC_LIBDIR}")
+    set(shared_lib_paths "${${prefix}_PC_LINK_LIBRARIES}")
+    # Use the first shared library path as the IMPORTED_LOCATION
+    # for ${target_shared}. This assumes that the first shared library
+    # path is the shared library path for this module.
+    list(GET shared_lib_paths 0 first_shared_lib_path)
+    # Use the rest shared library paths as the INTERFACE_LINK_LIBRARIES
+    # for ${target_shared}. This assumes that the rest shared library
+    # paths are dependency library paths for this module.
+    list(LENGTH shared_lib_paths n_shared_lib_paths)
+    if(n_shared_lib_paths LESS_EQUAL 1)
+      set(rest_shared_lib_paths)
+    else()
+      list(SUBLIST
+           shared_lib_paths
+           1
+           -1
+           rest_shared_lib_paths)
+    endif()
+
+    set(${prefix}_VERSION "${${prefix}_PC_VERSION}" PARENT_SCOPE)
+    set(${prefix}_INCLUDE_DIR "${include_dir}" PARENT_SCOPE)
+    set(${prefix}_SHARED_LIB "${first_shared_lib_path}" PARENT_SCOPE)
+
+    add_library(${target_shared} SHARED IMPORTED)
+    set_target_properties(${target_shared}
+                          PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
+                                     "${include_dir}"
+                                     INTERFACE_LINK_LIBRARIES
+                                     "${rest_shared_lib_paths}"
+                                     IMPORTED_LOCATION
+                                     "${first_shared_lib_path}")
+    get_target_property(shared_lib ${target_shared} IMPORTED_LOCATION)
+
+    find_library(${prefix}_static_lib
+                 NAMES "${static_lib_name}"
+                 PATHS "${lib_dir}"
+                 NO_DEFAULT_PATH)
+    set(static_lib "${${prefix}_static_lib}")
+    set(${prefix}_STATIC_LIB "${static_lib}" PARENT_SCOPE)
+    if(static_lib)
+      add_library(${target_static} STATIC IMPORTED)
+      set_target_properties(${target_static}
+                            PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${include_dir}"
+                                       IMPORTED_LOCATION "${static_lib}")
+    endif()
+  endif()
+endmacro()
+
+function(arrow_find_package
+         prefix
+         home
+         base_name
+         header_path
+         cmake_package_name
+         pkg_config_name)
+  arrow_build_shared_library_name(shared_lib_name ${base_name})
+  arrow_build_import_library_name(import_lib_name ${base_name})
+  arrow_build_static_library_name(static_lib_name ${base_name})
+
+  set(target_shared ${base_name}_shared)
+  set(target_static ${base_name}_static)
+
+  if(home)
+    arrow_find_package_home()
+    set(${prefix}_FIND_APPROACH "HOME: ${home}" PARENT_SCOPE)
+  else()
+    arrow_find_package_cmake_package_configuration()
+    if(${cmake_package_name}_FOUND)
+      set(${prefix}_FIND_APPROACH
+          "CMake package configuration: ${cmake_package_name}"
+          PARENT_SCOPE)
+    else()
+      arrow_find_package_pkg_config()
+      set(${prefix}_FIND_APPROACH "pkg-config: ${pkg_config_name}" PARENT_SCOPE)
+    endif()
+  endif()
+
+  if(NOT include_dir)
+    if(TARGET ${target_shared})
+      get_target_property(include_dir ${target_shared} INTERFACE_INCLUDE_DIRECTORIES)
+    elseif(TARGET ${target_static})
+      get_target_property(include_dir ${target_static} INTERFACE_INCLUDE_DIRECTORIES)
+    endif()
+  endif()
+  if(include_dir)
+    set(${prefix}_INCLUDE_DIR "${include_dir}" PARENT_SCOPE)
+  endif()
+
+  if(shared_lib)
+    get_filename_component(lib_dir "${shared_lib}" DIRECTORY)
+  elseif(static_lib)
+    get_filename_component(lib_dir "${static_lib}" DIRECTORY)
+  else()
+    set(lib_dir NOTFOUND)
+  endif()
+  set(${prefix}_LIB_DIR "${lib_dir}" PARENT_SCOPE)
+  # For backward compatibility
+  set(${prefix}_LIBS "${lib_dir}" PARENT_SCOPE)
+endfunction()
+
+if(NOT "$ENV{ARROW_HOME}" STREQUAL "")
+  file(TO_CMAKE_PATH "$ENV{ARROW_HOME}" ARROW_HOME)
+endif()
+arrow_find_package(ARROW
+                   "${ARROW_HOME}"
+                   arrow
+                   arrow/api.h
+                   Arrow
+                   arrow)
+
+if(ARROW_HOME)
+  if(ARROW_INCLUDE_DIR)
+    file(READ "${ARROW_INCLUDE_DIR}/arrow/util/config.h" ARROW_CONFIG_H_CONTENT)
+    arrow_extract_macro_value(ARROW_VERSION_MAJOR "ARROW_VERSION_MAJOR"
+                              "${ARROW_CONFIG_H_CONTENT}")
+    arrow_extract_macro_value(ARROW_VERSION_MINOR "ARROW_VERSION_MINOR"
+                              "${ARROW_CONFIG_H_CONTENT}")
+    arrow_extract_macro_value(ARROW_VERSION_PATCH "ARROW_VERSION_PATCH"
+                              "${ARROW_CONFIG_H_CONTENT}")
+    if("${ARROW_VERSION_MAJOR}" STREQUAL ""
+       OR "${ARROW_VERSION_MINOR}" STREQUAL ""
+       OR "${ARROW_VERSION_PATCH}" STREQUAL "")
+      set(ARROW_VERSION "0.0.0")
+    else()
+      set(ARROW_VERSION
+          "${ARROW_VERSION_MAJOR}.${ARROW_VERSION_MINOR}.${ARROW_VERSION_PATCH}")
+    endif()
+
+    arrow_extract_macro_value(ARROW_SO_VERSION_QUOTED "ARROW_SO_VERSION"
+                              "${ARROW_CONFIG_H_CONTENT}")
+    string(REGEX REPLACE "^\"(.+)\"$" "\\1" ARROW_SO_VERSION "${ARROW_SO_VERSION_QUOTED}")
+    arrow_extract_macro_value(ARROW_FULL_SO_VERSION_QUOTED "ARROW_FULL_SO_VERSION"
+                              "${ARROW_CONFIG_H_CONTENT}")
+    string(REGEX
+           REPLACE "^\"(.+)\"$" "\\1" ARROW_FULL_SO_VERSION
+                   "${ARROW_FULL_SO_VERSION_QUOTED}")
+  endif()
+else()
+  if(ARROW_USE_CMAKE_PACKAGE_CONFIG)
+    find_package(Arrow CONFIG)
+  elseif(ARROW_USE_PKG_CONFIG)
     pkg_get_variable(ARROW_SO_VERSION arrow so_version)
-    message(STATUS "Arrow SO version: ${ARROW_SO_VERSION}")
-    if ("${ARROW_INCLUDE_DIRS}" STREQUAL "")
-      set(ARROW_INCLUDE_DIRS "/usr/${CMAKE_INSTALL_INCLUDEDIR}")
-    endif()
-    if ("${ARROW_LIBRARY_DIRS}" STREQUAL "")
-      set(ARROW_LIBRARY_DIRS "/usr/${CMAKE_INSTALL_LIBDIR}")
-      if (EXISTS "/etc/debian_version" AND CMAKE_LIBRARY_ARCHITECTURE)
-        set(ARROW_LIBRARY_DIRS
-          "${ARROW_LIBRARY_DIRS}/${CMAKE_LIBRARY_ARCHITECTURE}")
-      endif()
-    endif()
-    set(ARROW_INCLUDE_DIR ${ARROW_INCLUDE_DIRS})
-    set(ARROW_LIBS ${ARROW_LIBRARY_DIRS})
-    set(ARROW_SEARCH_LIB_PATH ${ARROW_LIBRARY_DIRS})
-  endif()
-else()
-  set(ARROW_HOME "$ENV{ARROW_HOME}")
-
-  set(ARROW_SEARCH_HEADER_PATHS
-    ${ARROW_HOME}/include
-    )
-
-  set(ARROW_SEARCH_LIB_PATH
-    ${ARROW_HOME}/lib
-    )
-
-  find_path(ARROW_INCLUDE_DIR arrow/array.h PATHS
-    ${ARROW_SEARCH_HEADER_PATHS}
-    # make sure we don't accidentally pick up a different version
-    NO_DEFAULT_PATH
-    )
-endif()
-
-find_library(ARROW_LIB_PATH NAMES arrow
-  PATHS
-  ${ARROW_SEARCH_LIB_PATH}
-  NO_DEFAULT_PATH)
-get_filename_component(ARROW_LIBS ${ARROW_LIB_PATH} DIRECTORY)
-
-find_library(ARROW_PYTHON_LIB_PATH NAMES arrow_python
-  PATHS
-  ${ARROW_SEARCH_LIB_PATH}
-  NO_DEFAULT_PATH)
-get_filename_component(ARROW_PYTHON_LIBS ${ARROW_PYTHON_LIB_PATH} DIRECTORY)
-
-if (MSVC)
-  SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
-
-  if (MSVC AND NOT DEFINED ARROW_MSVC_STATIC_LIB_SUFFIX)
-    set(ARROW_MSVC_STATIC_LIB_SUFFIX "_static")
-  endif()
-
-  find_library(ARROW_SHARED_LIBRARIES NAMES arrow
-    PATHS ${ARROW_HOME} NO_DEFAULT_PATH
-    PATH_SUFFIXES "bin" )
-
-  find_library(ARROW_PYTHON_SHARED_LIBRARIES NAMES arrow_python
-    PATHS ${ARROW_HOME} NO_DEFAULT_PATH
-    PATH_SUFFIXES "bin" )
-  get_filename_component(ARROW_SHARED_LIBS ${ARROW_SHARED_LIBRARIES} PATH )
-  get_filename_component(ARROW_PYTHON_SHARED_LIBS ${ARROW_PYTHON_SHARED_LIBRARIES} PATH )
-endif ()
-
-if (ARROW_INCLUDE_DIR AND ARROW_LIBS)
-  set(ARROW_FOUND TRUE)
-  set(ARROW_LIB_NAME arrow)
-  set(ARROW_PYTHON_LIB_NAME arrow_python)
-  if (MSVC)
-    set(ARROW_STATIC_LIB ${ARROW_LIBS}/${ARROW_LIB_NAME}${ARROW_MSVC_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX})
-    set(ARROW_PYTHON_STATIC_LIB ${ARROW_PYTHON_LIBS}/${ARROW_PYTHON_LIB_NAME}${ARROW_MSVC_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX})
-    set(ARROW_SHARED_LIB ${ARROW_SHARED_LIBS}/${ARROW_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
-    set(ARROW_PYTHON_SHARED_LIB ${ARROW_PYTHON_SHARED_LIBS}/${ARROW_PYTHON_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
-    set(ARROW_SHARED_IMP_LIB ${ARROW_LIBS}/${ARROW_LIB_NAME}.lib)
-    set(ARROW_PYTHON_SHARED_IMP_LIB ${ARROW_PYTHON_LIBS}/${ARROW_PYTHON_LIB_NAME}.lib)
-  else()
-    set(ARROW_STATIC_LIB ${ARROW_LIBS}/lib${ARROW_LIB_NAME}.a)
-    set(ARROW_PYTHON_STATIC_LIB ${ARROW_LIBS}/lib${ARROW_PYTHON_LIB_NAME}.a)
-
-    set(ARROW_SHARED_LIB ${ARROW_LIBS}/lib${ARROW_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
-    set(ARROW_PYTHON_SHARED_LIB ${ARROW_LIBS}/lib${ARROW_PYTHON_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
-  endif()
-endif()
-
-if (ARROW_FOUND)
-  if (NOT Arrow_FIND_QUIETLY)
-    message(STATUS "Found the Arrow core library: ${ARROW_LIB_PATH}")
-    message(STATUS "Found the Arrow Python library: ${ARROW_PYTHON_LIB_PATH}")
-  endif ()
-else ()
-  if (NOT Arrow_FIND_QUIETLY)
-    set(ARROW_ERR_MSG "Could not find the Arrow library. Looked for headers")
-    set(ARROW_ERR_MSG "${ARROW_ERR_MSG} in ${ARROW_SEARCH_HEADER_PATHS}, and for libs")
-    set(ARROW_ERR_MSG "${ARROW_ERR_MSG} in ${ARROW_SEARCH_LIB_PATH}")
-    if (Arrow_FIND_REQUIRED)
-      message(FATAL_ERROR "${ARROW_ERR_MSG}")
-    else (Arrow_FIND_REQUIRED)
-      message(STATUS "${ARROW_ERR_MSG}")
-    endif (Arrow_FIND_REQUIRED)
-  endif ()
-  set(ARROW_FOUND FALSE)
-endif ()
-
-if (MSVC)
-  mark_as_advanced(
-    ARROW_INCLUDE_DIR
-    ARROW_STATIC_LIB
-    ARROW_SHARED_LIB
-    ARROW_SHARED_IMP_LIB
-    ARROW_PYTHON_STATIC_LIB
-    ARROW_PYTHON_SHARED_LIB
-    ARROW_PYTHON_SHARED_IMP_LIB
-  )
-else()
-  mark_as_advanced(
-    ARROW_INCLUDE_DIR
-    ARROW_STATIC_LIB
-    ARROW_SHARED_LIB
-    ARROW_PYTHON_STATIC_LIB
-    ARROW_PYTHON_SHARED_LIB
-  )
-endif()
+    pkg_get_variable(ARROW_FULL_SO_VERSION arrow full_so_version)
+  endif()
+endif()
+
+set(ARROW_ABI_VERSION ${ARROW_SO_VERSION})
+
+mark_as_advanced(ARROW_ABI_VERSION
+                 ARROW_CONFIG_SUFFIXES
+                 ARROW_FULL_SO_VERSION
+                 ARROW_IMPORT_LIB
+                 ARROW_INCLUDE_DIR
+                 ARROW_LIBS
+                 ARROW_LIB_DIR
+                 ARROW_SEARCH_LIB_PATH_SUFFIXES
+                 ARROW_SHARED_IMP_LIB
+                 ARROW_SHARED_LIB
+                 ARROW_SO_VERSION
+                 ARROW_STATIC_LIB
+                 ARROW_VERSION
+                 ARROW_VERSION_MAJOR
+                 ARROW_VERSION_MINOR
+                 ARROW_VERSION_PATCH)
+
+find_package_handle_standard_args(Arrow REQUIRED_VARS
+                                  # The first required variable is shown
+                                  # in the found message. So this list is
+                                  # not sorted alphabetically.
+                                  ARROW_INCLUDE_DIR
+                                  ARROW_LIB_DIR
+                                  ARROW_FULL_SO_VERSION
+                                  ARROW_SO_VERSION
+                                  VERSION_VAR
+                                  ARROW_VERSION)
+set(ARROW_FOUND ${Arrow_FOUND})
+
+if(Arrow_FOUND AND NOT Arrow_FIND_QUIETLY)
+  message(STATUS "Arrow version: ${ARROW_VERSION} (${ARROW_FIND_APPROACH})")
+  message(STATUS "Arrow SO and ABI version: ${ARROW_SO_VERSION}")
+  message(STATUS "Arrow full SO version: ${ARROW_FULL_SO_VERSION}")
+  message(STATUS "Found the Arrow core shared library: ${ARROW_SHARED_LIB}")
+  message(STATUS "Found the Arrow core import library: ${ARROW_IMPORT_LIB}")
+  message(STATUS "Found the Arrow core static library: ${ARROW_STATIC_LIB}")
+endif()


Disallow enabling both all and minimal at the same time

--- cmake/modules/RootBuildOptions.cmake
+++ cmake/modules/RootBuildOptions.cmake
@@ -179,6 +179,10 @@

 set(gcctoolchain "" CACHE PATH "Set path to GCC toolchain used to build llvm/clang")

+if(all AND minimal)
+  message(FATAL_ERROR "The 'all' and 'minimal' options are mutually exclusive")
+endif()
+
 #--- Compression algorithms in ROOT-------------------------------------------------------------
 set(compression_default "zlib" CACHE STRING "Default compression algorithm (zlib (default), lz4, or lzma)")
 string(TOLOWER "${compression_default}" compression_default)


cmake: fix inkscape detection for beta versions

--- manual/CMakeModules/FindINKSCAPE.cmake
+++ manual/CMakeModules/FindINKSCAPE.cmake
@@ -9,7 +9,7 @@
 #  INKSCAPE_FOUND - system has inkscape
 #  INKSCAPE_EXECUTABLE - the inkscape executable
 #
-# Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org)
+# Copyright 2009-2019 The VOTCA Development Team (http://www.votca.org)
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -55,8 +55,8 @@
   if(_inkscape_version_result)
     message(WARNING "Unable to determine inkscape version: ${_inkscape_version_result}")
   endif()
-  string(REGEX REPLACE "^Inkscape ([0-9.]+) \\(.*$" "\\1" INKSCAPE_VERSION "${_INKSCAPE_VERSION}")
-  if(NOT INKSCAPE_VERSION MATCHES "[0-9.]+")
+  string(REGEX REPLACE "^Inkscape ([0-9.]+(beta[0-9])?) \\(.*$" "\\1" INKSCAPE_VERSION "${_INKSCAPE_VERSION}")
+  if(INKSCAPE_VERSION STREQUAL _INKSCAPE_VERSION)
     message(WARNING "Unable to parse inkscape version: ${_INKSCAPE_VERSION}")
   endif()
   if(INKSCAPE_VERSION VERSION_LESS "1.0")


Update python, numpy, and scipy hashsums

These are the latest hashsums for python 3.7 and the
updated numpy and scipy.

Signed-off-by: Patrick Avery <743342299f279e7a8c3ff5eb40671fce3e95f13a@kitware.com>


modules: updated FindMagnum.cmake.

modules: updated FindMagnum.cmake.

--- modules/FindMagnum.cmake
+++ modules/FindMagnum.cmake
@@ -378,10 +378,9 @@
     set(_MAGNUM_DebugTools_GL_DEPENDENCY_IS_OPTIONAL ON)
 endif()

-set(_MAGNUM_MeshTools_DEPENDENCIES )
+set(_MAGNUM_MeshTools_DEPENDENCIES Trade)
 if(MAGNUM_TARGET_GL)
-    # Trade is used only in compile(), which needs GL as well
-    list(APPEND _MAGNUM_MeshTools_DEPENDENCIES Trade GL)
+    list(APPEND _MAGNUM_MeshTools_DEPENDENCIES GL)
 endif()

 set(_MAGNUM_OpenGLTester_DEPENDENCIES GL)


Updated FindMagnum.cmake from Magnum repository.

--- modules/FindMagnum.cmake
+++ modules/FindMagnum.cmake
@@ -5,6 +5,7 @@
 # MAGNUM_FOUND                      - True if Magnum library is found
 # MAGNUM_INCLUDE_DIR                - Include dir for Magnum
 # MAGNUM_LIBRARY                    - Magnum library
+# MAGNUM_PHYSICS_LIBRARY            - Magnum physics library
 # MAGNUM_PRIMITIVES_LIBRARY         - Library with primitives
 #
 # MAGNUM_LIBRARY_INSTALL_DIR        - Library installation directory
@@ -16,7 +17,7 @@
 find_package(OpenGL REQUIRED)
 find_package(GLEW REQUIRED)

-if (MAGNUM_INCLUDE_DIR AND MAGNUM_LIBRARY AND MAGNUM_PRIMITIVES_LIBRARY AND MAGNUM_MESHTOOLS_LIBRARY AND MAGNUM_SHADERS_LIBRARY)
+if (MAGNUM_INCLUDE_DIR AND MAGNUM_LIBRARY AND MAGNUM_PHYSICS_LIBRARY AND MAGNUM_PRIMITIVES_LIBRARY AND MAGNUM_MESHTOOLS_LIBRARY AND MAGNUM_SHADERS_LIBRARY)

     # Already in cache
     set(MAGNUM_FOUND TRUE)
@@ -24,6 +25,7 @@
 else()
     # Libraries
     find_library(MAGNUM_LIBRARY Magnum)
+    find_library(MAGNUM_PHYSICS_LIBRARY MagnumPhysics)
     find_library(MAGNUM_PRIMITIVES_LIBRARY MagnumPrimitives)
     find_library(MAGNUM_MESHTOOLS_LIBRARY MagnumMeshTools)
     find_library(MAGNUM_SHADERS_LIBRARY MagnumShaders)
@@ -38,6 +40,7 @@
     find_package_handle_standard_args("Magnum" DEFAULT_MSG
         MAGNUM_INCLUDE_DIR
         MAGNUM_LIBRARY
+        MAGNUM_PHYSICS_LIBRARY
         MAGNUM_PRIMITIVES_LIBRARY
         MAGNUM_MESHTOOLS_LIBRARY
         MAGNUM_SHADERS_LIBRARY


--- modules/FindMagnum.cmake
+++ modules/FindMagnum.cmake
@@ -7,6 +7,8 @@
 #  MAGNUM_LIBRARIES             - Magnum library and dependent libraries
 #  MAGNUM_INCLUDE_DIRS          - Root include dir and include dirs of
 #   dependencies
+#  MAGNUM_PLUGINS_FONT_DIR      - Directory with font plugins
+#  MAGNUM_PLUGINS_IMAGECONVERTER_DIR - Directory with image converter plugins
 #  MAGNUM_PLUGINS_IMPORTER_DIR  - Directory with importer plugins
 # This command will try to find only the base library, not the optional
 # components. The base library depends on Corrade, OpenGL and GLEW
@@ -19,9 +21,7 @@
 #  Primitives       - Primitives library
 #  SceneGraph       - SceneGraph library
 #  Shaders          - Shaders library
-#  Text             - Text library (depends on TextureTools component,
-#                     FreeType library and possibly HarfBuzz library,
-#                     see below)
+#  Text             - Text library (depends on TextureTools component)
 #  TextureTools     - TextureTools library
 #  GlutApplication  - GLUT application (depends on GLUT library)
 #  GlxApplication   - GLX application (depends on GLX and X11 libraries)
@@ -47,12 +47,11 @@
 # Features of found Magnum library are exposed in these variables:
 #  MAGNUM_TARGET_GLES   - Defined if compiled for OpenGL ES
 #  MAGNUM_TARGET_GLES2  - Defined if compiled for OpenGL ES 2.0
+#  MAGNUM_TARGET_GLES3  - Defined if compiled for OpenGL ES 3.0
 #  MAGNUM_TARGET_DESKTOP_GLES - Defined if compiled with OpenGL ES
 #   emulation on desktop OpenGL
 #  MAGNUM_TARGET_NACL   - Defined if compiled for Google Chrome Native
 #   Client
-#  MAGNUM_USE_HARFBUZZ  - Defined if HarfBuzz library is used for text
-#   rendering
 #
 # Additionally these variables are defined for internal usage:
 #  MAGNUM_INCLUDE_DIR                   - Root include dir (w/o
@@ -63,6 +62,10 @@
 #   dependencies)
 #  MAGNUM_LIBRARY_INSTALL_DIR           - Library installation directory
 #  MAGNUM_PLUGINS_INSTALL_DIR           - Plugin installation directory
+#  MAGNUM_PLUGINS_FONT_INSTALL_DIR      - Font plugin installation
+#   directory
+#  MAGNUM_PLUGINS_IMAGECONVERTER_INSTALL_DIR - Image converter plugin
+#   installation directory
 #  MAGNUM_PLUGINS_IMPORTER_INSTALL_DIR  - Importer plugin installation
 #   directory
 #  MAGNUM_CMAKE_MODULE_INSTALL_DIR      - Installation dir for CMake
@@ -119,6 +122,10 @@
 if(NOT _TARGET_GLES2 EQUAL -1)
     set(MAGNUM_TARGET_GLES2 1)
 endif()
+string(FIND "${_magnumConfigure}" "#define MAGNUM_TARGET_GLES3" _TARGET_GLES3)
+if(NOT _TARGET_GLES3 EQUAL -1)
+    set(MAGNUM_TARGET_GLES3 1)
+endif()
 string(FIND "${_magnumConfigure}" "#define MAGNUM_TARGET_NACL" _TARGET_NACL)
 if(NOT _TARGET_NACL EQUAL -1)
     set(MAGNUM_TARGET_NACL 1)
@@ -126,10 +133,6 @@
 string(FIND "${_magnumConfigure}" "#define MAGNUM_TARGET_DESKTOP_GLES" _TARGET_DESKTOP_GLES)
 if(NOT _TARGET_DESKTOP_GLES EQUAL -1)
     set(MAGNUM_TARGET_DESKTOP_GLES 1)
-endif()
-string(FIND "${_magnumConfigure}" "#define MAGNUM_USE_HARFBUZZ" _USE_HARFBUZZ)
-if(NOT _USE_HARFBUZZ EQUAL -1)
-    set(MAGNUM_USE_HARFBUZZ 1)
 endif()

 if(NOT MAGNUM_TARGET_GLES OR MAGNUM_TARGET_DESKTOP_GLES)
@@ -249,19 +252,7 @@

     # Text library
     if(${component} STREQUAL Text)
-        set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES Font.h)
-
-        # Dependencies
-        find_package(Freetype)
-        if(NOT FREETYPE_FOUND)
-            unset(MAGNUM_${_COMPONENT}_LIBRARY)
-        endif()
-        if(MAGNUM_USE_HARFBUZZ)
-            find_package(HarfBuzz)
-            if(NOT HARFBUZZ_FOUND)
-                unset(MAGNUM_${_COMPONENT}_LIBRARY)
-            endif()
-        endif()
+        set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES AbstractFont.h)
     endif()

     # TextureTools library
@@ -334,6 +325,8 @@
 # Installation dirs
 set(MAGNUM_LIBRARY_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX})
 set(MAGNUM_PLUGINS_INSTALL_DIR ${MAGNUM_LIBRARY_INSTALL_DIR}/magnum)
+set(MAGNUM_PLUGINS_FONT_INSTALL_DIR ${MAGNUM_PLUGINS_INSTALL_DIR}/fonts)
+set(MAGNUM_PLUGINS_IMAGECONVERTER_INSTALL_DIR ${MAGNUM_PLUGINS_INSTALL_DIR}/imageconverters)
 set(MAGNUM_PLUGINS_IMPORTER_INSTALL_DIR ${MAGNUM_PLUGINS_INSTALL_DIR}/importers)
 set(MAGNUM_CMAKE_MODULE_INSTALL_DIR ${CMAKE_ROOT}/Modules)
 set(MAGNUM_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/Magnum)
@@ -343,14 +336,20 @@
     MAGNUM_INCLUDE_DIR
     MAGNUM_LIBRARY_INSTALL_DIR
     MAGNUM_PLUGINS_INSTALL_DIR
+    MAGNUM_PLUGINS_FONT_INSTALL_DIR
+    MAGNUM_PLUGINS_IMAGECONVERTER_INSTALL_DIR
     MAGNUM_PLUGINS_IMPORTER_INSTALL_DIR
     MAGNUM_CMAKE_MODULE_INSTALL_DIR
     MAGNUM_INCLUDE_INSTALL_DIR
     MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR)

-# Importer plugins dir
+# Plugin directories
 if(NOT WIN32)
+    set(MAGNUM_PLUGINS_FONT_DIR ${MAGNUM_PLUGINS_INSTALL_DIR}/fonts)
+    set(MAGNUM_PLUGINS_IMAGECONVERTER_DIR ${MAGNUM_PLUGINS_INSTALL_DIR}/imageconverters)
     set(MAGNUM_PLUGINS_IMPORTER_DIR ${MAGNUM_PLUGINS_INSTALL_DIR}/importers)
 else()
+    set(MAGNUM_PLUGINS_FONT_DIR fonts)
+    set(MAGNUM_PLUGINS_IMAGECONVERTER_DIR imageconverters)
     set(MAGNUM_PLUGINS_IMPORTER_DIR importers)
 endif()


Build: Fix broken full build on Linux/ASAN

Before this commit building only the full version of Elektra
(`BUILD_FULL`) with `clang` would not work if we enabled ASAN.

--- cmake/ElektraCompiling.cmake
+++ cmake/ElektraCompiling.cmake
@@ -97,7 +97,7 @@

 if (ENABLE_ASAN)
 	set (EXTRA_FLAGS "${EXTRA_FLAGS} -fsanitize=undefined -fsanitize=address -fno-omit-frame-pointer")
-	if (NOT APPLE AND CMAKE_COMPILER_IS_GNUCXX)
+	if (NOT (APPLE OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" AND "${CMAKE_C_COMPILER_VERSION}" VERSION_GREATER "4.0")))
 		set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lubsan")
 	endif ()
 	set (ASAN_LIBRARY "-lasan") #this is needed for GIR to put asan in front


* Check if `IOWOW_URL` is set in AddIOWOW

--- cmake/Modules/AddIOWOW.cmake
+++ cmake/Modules/AddIOWOW.cmake
@@ -2,10 +2,12 @@

 set(IOWOW_INCLUDE_DIR "${CMAKE_BINARY_DIR}/include")

-if(EXISTS ${CMAKE_SOURCE_DIR}/iowow.zip)
-  set(IOWOW_URL ${CMAKE_SOURCE_DIR}/iowow.zip)
-else()
-  set(IOWOW_URL https://github.com/Softmotions/iowow/archive/master.zip)
+if(NOT DEFINED IOWOW_URL)
+  if(EXISTS ${CMAKE_SOURCE_DIR}/iowow.zip)
+    set(IOWOW_URL ${CMAKE_SOURCE_DIR}/iowow.zip)
+  else()
+    set(IOWOW_URL https://github.com/Softmotions/iowow/archive/master.zip)
+  endif()
 endif()

 set(CMAKE_ARGS  -DOWNER_PROJECT_NAME=${PROJECT_NAME}


remove -Werror from default build options

--- cmake/Modules/Compiler.cmake
+++ cmake/Modules/Compiler.cmake
@@ -28,12 +28,6 @@

 	add_definitions( -Wall -pedantic )

-	check_c_compiler_flag( -Wno-pointer-sign HAVE_WNO_POINTER_SIGN )
-	if( HAVE_WNO_POINTER_SIGN )
-		add_definitions( -Wno-pointer-sign )
-		add_definitions( -Werror )
-	endif( HAVE_WNO_POINTER_SIGN )
-
 	check_c_compiler_flag( -fPIC HAVE_FPIC )
 	if( HAVE_FPIC )
 		set( WSH_LIB_COMPILER_FLAGS "${WSH_LIB_COMPILER_FLAGS} -fPIC" )


Fixed misspelled words.

Fixed misspelled words.

--- cmake/OpenCVDetectCUDA.cmake
+++ cmake/OpenCVDetectCUDA.cmake
@@ -4,12 +4,12 @@
 endif()

 if(WIN32 AND NOT MSVC)
-  message(STATUS "CUDA compilation is disabled (due to only Visual Studio compiler suppoted on your platform).")
+  message(STATUS "CUDA compilation is disabled (due to only Visual Studio compiler supported on your platform).")
   return()
 endif()

 if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
-  message(STATUS "CUDA compilation is disabled (due to Clang unsuppoted on your platform).")
+  message(STATUS "CUDA compilation is disabled (due to Clang unsupported on your platform).")
   return()
 endif()


Minor fix in sketch processing (added newline before Arduino header include)

--- cmake/Platform/Arduino.cmake
+++ cmake/Platform/Arduino.cmake
@@ -1160,8 +1160,7 @@
     #message(STATUS "BODY:\n${SKETCH_BODY}")

 	# write the file head
-    file(APPEND ${SKETCH_CPP} "\n")
-    file(APPEND ${SKETCH_CPP} "${SKETCH_HEAD}")
+    file(APPEND ${SKETCH_CPP} "\n${SKETCH_HEAD}\n")
     if(ARDUINO_SDK_VERSION VERSION_LESS 1.0)
         file(APPEND ${SKETCH_CPP} "#include \"WProgram.h\"\n")
     else()


fix bad usage of IMPORTED_IMPLIB by IMPORTED_LOCATION

--- cmake/catkin_libraries.cmake
+++ cmake/catkin_libraries.cmake
@@ -130,15 +130,15 @@
       get_target_property(${lib}_imported ${lib} IMPORTED)
       if(${${lib}_imported})
         set(imported_libraries)  # empty list
-        get_target_property(${lib}_imported_implib ${lib} IMPORTED_IMPLIB)
-        if(${lib}_imported_implib)
-          list(APPEND imported_libraries ${${lib}_imported_implib})
+        get_target_property(${lib}_imported_location ${lib} IMPORTED_LOCATION)
+        if(${lib}_imported_location)
+          list(APPEND imported_libraries ${${lib}_imported_location})
         else()
           get_target_property(${lib}_imported_configurations ${lib} IMPORTED_CONFIGURATIONS)
           foreach(cfg ${${lib}_imported_configurations})
-            get_target_property(${lib}_imported_implib_${cfg} ${lib} IMPORTED_IMPLIB_${cfg})
-            if(${${lib}_imported_implib_${cfg}})
-              list(APPEND imported_libraries ${${lib}_imported_implib_${cfg}})
+            get_target_property(${lib}_imported_location_${cfg} ${lib} IMPORTED_LOCATION_${cfg})
+            if(${lib}_imported_location_${cfg})
+              list(APPEND imported_libraries ${${lib}_imported_location_${cfg}})
             endif()
           endforeach()
         endif()


Get files for XNNPACK wasm build from BUILD.bazel. (#12892)

Get files for wasm build from BUILD.bazel.

--- cmake/external/xnnpack.cmake
+++ cmake/external/xnnpack.cmake
@@ -8,8 +8,8 @@
 set(CLOG_SOURCE_DIR "${PYTORCH_CPUINFO_DIR}/deps/clog")
 set(CPUINFO_SOURCE_DIR ${PYTORCH_CPUINFO_DIR})

-if (onnxruntime_BUILD_WEBASSEMBLY)
-  execute_process(COMMAND  git apply --ignore-space-change --ignore-whitespace ${PROJECT_SOURCE_DIR}/patches/xnnpack/AddEmscriptenSupport.patch WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/${XNNPACK_DIR})
+if(onnxruntime_BUILD_WEBASSEMBLY)
+  execute_process(COMMAND git apply --ignore-space-change --ignore-whitespace ${PROJECT_SOURCE_DIR}/patches/xnnpack/AddEmscriptenSupport.patch WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/${XNNPACK_DIR})
 endif()

 add_subdirectory(external/FP16)
@@ -24,43 +24,67 @@
 list(APPEND onnxruntime_EXTERNAL_LIBRARIES ${onnxruntime_EXTERNAL_LIBRARIES_XNNPACK})

 # the XNNPACK CMake setup doesn't include the WASM kernels so we have to manually set those up
-if (onnxruntime_BUILD_WEBASSEMBLY)
-  if (onnxruntime_ENABLE_WEBASSEMBLY_THREADS)
+if(onnxruntime_BUILD_WEBASSEMBLY)
+  file(READ "${XNNPACK_DIR}/BUILD.bazel" xnnpack_bazel_config)
+
+  # Replace newlines with semicolon so that it is treated as a list by CMake
+  # Also replace '[' and ']' so the bazel source lists don't get parsed as a nested list by cmake
+  string(REPLACE "\n" ";" xnnpack_bazel_config "${xnnpack_bazel_config}")
+  string(REPLACE "[" "{" xnnpack_bazel_config "${xnnpack_bazel_config}")
+  string(REPLACE "]" "}" xnnpack_bazel_config "${xnnpack_bazel_config}")
+
+  function(GetSrcListFromBazel src_list_name target_srcs)
+    set(_InSection FALSE)
+    set(bazel_srcs "")
+
+    foreach(_line ${xnnpack_bazel_config})
+      if(NOT _InSection)
+        if(_line MATCHES "^${src_list_name} = \\{")
+          set(_InSection TRUE)
+        endif()
+      else()
+        if(_line MATCHES "^\\}")
+          set(_InSection FALSE)
+        else()
+          # parse filename from quoted string with trailing comma
+          string(REPLACE "\"" "" _line "${_line}")
+          string(REPLACE "," "" _line "${_line}")
+          string(STRIP "${_line}" _line)
+
+          list(APPEND bazel_srcs "${XNNPACK_DIR}/${_line}")
+        endif()
+      endif()
+    endforeach()
+
+    set(${target_srcs} ${bazel_srcs} PARENT_SCOPE)
+  endfunction()
+
+  if(onnxruntime_ENABLE_WEBASSEMBLY_THREADS)
     target_compile_options(XNNPACK PRIVATE "-pthread")
   endif()

+  GetSrcListFromBazel("PROD_SCALAR_WASM_MICROKERNEL_SRCS" prod_scalar_wasm_srcs)
+  GetSrcListFromBazel("ALL_WASM_MICROKERNEL_SRCS" all_wasm_srcs)
+  GetSrcListFromBazel("WASM32_ASM_MICROKERNEL_SRCS" wasm32_asm_srcs)
+
+  message(DEBUG "prod_scalar_wasm_srcs: ${prod_scalar_wasm_srcs}\n")
+  message(DEBUG "all_wasm_srcs: ${all_wasm_srcs}\n")
+  message(DEBUG "wasm32_asm_srcs: ${wasm32_asm_srcs}\n")
+
   message("Adding WebAssembly Source Files to XNNPACK")
-  set(wasm_src_patterns "${XNNPACK_DIR}/src/init.c"
-                        "${XNNPACK_DIR}/src/params-init.c"
-                        "${XNNPACK_DIR}/src/qu8-avgpool/9*-minmax-scalar-c1.c"
-                        "${XNNPACK_DIR}/src/u8-rmax/scalar.c"
-                        "${XNNPACK_DIR}/src/x8-zip/x*-scalar.c"
-                        "${XNNPACK_DIR}/src/x*-transposec/gen/2x4-scalar-int.c"
-                        "${XNNPACK_DIR}/src/wasm-*.c"
-                        "${XNNPACK_DIR}/src/*-wasm-*.c"
-                        "${XNNPACK_DIR}/src/*-wasm.c")
-  set(wasm32_asm_src_patterns "${XNNPACK_DIR}/src/wasm_shr_*.S")
+  set(wasm_srcs "")
+  list(APPEND wasm_srcs ${prod_scalar_wasm_srcs})
+  list(APPEND wasm_srcs ${all_wasm_srcs})
+  list(APPEND wasm_srcs ${wasm32_asm_srcs})

-  file(GLOB_RECURSE XNNPACK_WASM_MICROKERNEL_SRCS CONFIGURE_DEPENDS ${wasm_src_patterns})
-  file(GLOB_RECURSE XNNPACK_WASM32_ASM_MICROKERNEL_SRCS CONFIGURE_DEPENDS ${wasm32_asm_src_patterns})
+  target_sources(XNNPACK PRIVATE ${wasm_srcs})

-  message(DEBUG "XNNPACK_WASM_MICROKERNEL_SRCS:${XNNPACK_WASM_MICROKERNEL_SRCS}")
-  message(DEBUG "XNNPACK_WASM32_ASM_MICROKERNEL_SRCS:${XNNPACK_WASM32_ASM_MICROKERNEL_SRCS}")
+  if(onnxruntime_ENABLE_WEBASSEMBLY_SIMD)
+    GetSrcListFromBazel("ALL_WASMSIMD_MICROKERNEL_SRCS" all_wasmsimd_srcs)
+    message(DEBUG "all_wasmsimd_srcs: ${all_wasmsimd_srcs}")

-  target_sources(XNNPACK PRIVATE ${XNNPACK_WASM_MICROKERNEL_SRCS}
-                                 ${XNNPACK_WASM32_ASM_MICROKERNEL_SRCS})
-
-  if (onnxruntime_ENABLE_WEBASSEMBLY_SIMD)
+    target_compile_options(params_init PRIVATE "-msimd128")
     target_compile_options(XNNPACK PRIVATE "-msimd128")
-
-    set(wasmsimd_src_patterns "${XNNPACK_DIR}/src/wasmsimd-*.c"
-                              "${XNNPACK_DIR}/src/*-wasmsimd-*.c"
-                              "${XNNPACK_DIR}/src/*-wasmsimd.c"
-                              "${XNNPACK_DIR}/src/*/wasmsimd.c")
-
-    file(GLOB_RECURSE XNNPACK_WASMSIMD_MICROKERNEL_SRCS CONFIGURE_DEPENDS ${wasmsimd_src_patterns})
-    message(DEBUG "XNNPACK_WASMSIMD_MICROKERNEL_SRCS:${XNNPACK_WASMSIMD_MICROKERNEL_SRCS}")
-
-    target_sources(XNNPACK PRIVATE ${XNNPACK_WASMSIMD_MICROKERNEL_SRCS})
+    target_sources(XNNPACK PRIVATE ${all_wasmsimd_srcs})
   endif()
 endif()


Propagating prior merge from 'llvm.org/master'.

--- cmake/modules/AddClang.cmake
+++ cmake/modules/AddClang.cmake
@@ -139,6 +139,7 @@
         -DCMAKE_INSTALL_COMPONENT=${name}
         -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
     endif()
+    set_property(GLOBAL APPEND PROPERTY CLANG_EXPORTS ${name})
   endif()
 endmacro()


Always build the "non-overlay" apinotes when building Platform. (#16851)

--- cmake/modules/AddSwift.cmake
+++ cmake/modules/AddSwift.cmake
@@ -780,9 +780,9 @@
           ${SWIFTLIB_SINGLE_SDK} STREQUAL "OSX")
         # HACK: don't build WatchKit API notes for OS X.
       else()
-        if (NOT IS_DIRECTORY "${SWIFT_SOURCE_DIR}/stdlib/public/SDK/${framework_name}")
-          list(APPEND SWIFTLIB_SINGLE_API_NOTES "${framework_name}")
-        endif()
+        # Always build the "non-overlay" apinotes to keep them in sync
+        # rdar://40496966
+        list(APPEND SWIFTLIB_SINGLE_API_NOTES "${framework_name}")
       endif()
     endforeach()
   endif()
@@ -792,9 +792,6 @@
     set(module_name "Swift")
   else()
     string(REPLACE swift "" module_name "${name}")
-  endif()
-  if("${module_name}" IN_LIST SWIFT_API_NOTES_INPUTS)
-    set(SWIFTLIB_SINGLE_API_NOTES "${module_name}")
   endif()

   if("${SWIFTLIB_SINGLE_SDK}" STREQUAL "WINDOWS")


Add -m32 to compile flags for GCC-compatible compilers

--- cmake/GlobalBuildConfig.cmake
+++ cmake/GlobalBuildConfig.cmake
@@ -12,3 +12,10 @@
 if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel")
 	set(CMAKE_COMPILER_IS_GNUCXX TRUE)
 endif()
+
+if(CMAKE_COMPILER_IS_GNUCC)
+	set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
+endif()
+if(CMAKE_COMPILER_IS_GNUCXX)
+	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
+endif()


pch config changed

pch config changed

--- cmake/PrecompiledHeader.cmake
+++ cmake/PrecompiledHeader.cmake
@@ -68,32 +68,32 @@
     ENDIF(NOT _sourceFound)
   ENDIF(MSVC)

-  IF(CMAKE_COMPILER_IS_GNUCXX)
-    GET_FILENAME_COMPONENT(_name ${_input} NAME)
-    SET(_source "${CMAKE_CURRENT_SOURCE_DIR}/${_input}")
-    SET(_outdir "${CMAKE_CURRENT_BINARY_DIR}/${_name}.gch")
-    MAKE_DIRECTORY(${_outdir})
-    SET(_output "${_outdir}/.c++")
-
-    STRING(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" _flags_var_name)
-    SET(_compiler_FLAGS ${${_flags_var_name}})
-
-    GET_DIRECTORY_PROPERTY(_directory_flags INCLUDE_DIRECTORIES)
-    FOREACH(item ${_directory_flags})
-      LIST(APPEND _compiler_FLAGS "-I${item}")
-    ENDFOREACH(item)
-
-    GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS)
-    LIST(APPEND _compiler_FLAGS ${_directory_flags})
-
-    SEPARATE_ARGUMENTS(_compiler_FLAGS)
-    MESSAGE("${CMAKE_CXX_COMPILER} -DPCHCOMPILE ${_compiler_FLAGS} -x c++-header -o {_output} ${_source}")
-    ADD_CUSTOM_COMMAND(
-      OUTPUT ${_output}
-      COMMAND ${CMAKE_CXX_COMPILER} ${_compiler_FLAGS} -x c++-header -o ${_output} ${_source}
-      DEPENDS ${_source} )
-    ADD_CUSTOM_TARGET(${_targetName}_gch DEPENDS ${_output})
-    ADD_DEPENDENCIES(${_targetName} ${_targetName}_gch)
-    SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS "-include ${_name} -Winvalid-pch")
-  ENDIF(CMAKE_COMPILER_IS_GNUCXX)
+  #IF(CMAKE_COMPILER_IS_GNUCXX)
+  #  GET_FILENAME_COMPONENT(_name ${_input} NAME)
+  #  SET(_source "${CMAKE_CURRENT_SOURCE_DIR}/${_input}")
+  #  SET(_outdir "${CMAKE_CURRENT_BINARY_DIR}/${_name}.gch")
+  #  MAKE_DIRECTORY(${_outdir})
+  #  SET(_output "${_outdir}/.c++")
+  #
+  #  STRING(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" _flags_var_name)
+  #  SET(_compiler_FLAGS ${${_flags_var_name}})
+  #
+  #  GET_DIRECTORY_PROPERTY(_directory_flags INCLUDE_DIRECTORIES)
+  #  FOREACH(item ${_directory_flags})
+  #    LIST(APPEND _compiler_FLAGS "-I${item}")
+  #  ENDFOREACH(item)
+  #
+  #  GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS)
+  #  LIST(APPEND _compiler_FLAGS ${_directory_flags})
+  #
+  #  SEPARATE_ARGUMENTS(_compiler_FLAGS)
+  #  MESSAGE("${CMAKE_CXX_COMPILER} -DPCHCOMPILE ${_compiler_FLAGS} -x c++-header -o {_output} ${_source}")
+  #  ADD_CUSTOM_COMMAND(
+  #    OUTPUT ${_output}
+  #    COMMAND ${CMAKE_CXX_COMPILER} ${_compiler_FLAGS} -x c++-header -o ${_output} ${_source}
+  #    DEPENDS ${_source} )
+  #  ADD_CUSTOM_TARGET(${_targetName}_gch DEPENDS ${_output})
+  #  ADD_DEPENDENCIES(${_targetName} ${_targetName}_gch)
+  #  SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS "-include ${_name} -Winvalid-pch")
+  #ENDIF(CMAKE_COMPILER_IS_GNUCXX)
 ENDMACRO(use_precompiled_header)


Use the same number of spaces as in our other CMake files.

--- cmake/environmentchecks.cmake
+++ cmake/environmentchecks.cmake
@@ -40,9 +40,9 @@
 endif()

 mark_as_advanced(
-    CLANG_TIDY_EXE CLANG_TIDY_AVAILABLE
-    FIND_EXE GCOV_EXE COVERAGE_TESTING_AVAILABLE
-    SWIG_EXECUTABLE BINDINGS_AVAILABLE
-    VALGRIND_EXE VALGRIND_TESTING_AVAILABLE
+  CLANG_TIDY_EXE CLANG_TIDY_AVAILABLE
+  FIND_EXE GCOV_EXE COVERAGE_TESTING_AVAILABLE
+  SWIG_EXECUTABLE BINDINGS_AVAILABLE
+  VALGRIND_EXE VALGRIND_TESTING_AVAILABLE
 )


Update MS Dirent implementation

Update MS Dirent implementation

--- cmake/external/MSDirent.cmake
+++ cmake/external/MSDirent.cmake
@@ -4,8 +4,8 @@
 	MSDirent
 	PREFIX ${CMAKE_BINARY_DIR}/MSDirent
 	DOWNLOAD_DIR ${THIRD_PARTY_DIR}/MSDirent
-	URL http://www.softagalleria.net/download/dirent/dirent-1.13.zip
-	URL_MD5 4a4fdd27848dde028bd5e9712e2636bc
+	GIT_REPOSITORY https://github.com/tronkko/dirent.git
+	GIT_TAG 8b1db5092479a73d47eafd3de739b27e876e6bf3
 	INSTALL_COMMAND ""
 	BUILD_COMMAND ""
 	CONFIGURE_COMMAND ""


chore: remove find catch from cmake files

Signed-off-by: Lorenzo Fontana <lo@linux.com>

Co-authored-by: Leonardo Di Donato <2012e0ca99d70aa6c893822ff73002216e5dba72@gmail.com>

--- cmake/modules/FindCatch.cmake
+++ cmake/modules/FindCatch.cmake
@@ -1,34 +0,0 @@
-#
-# Copyright (C) 2016-2019 Draios Inc dba Sysdig.
-#
-# This file is part of falco .
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-include(ExternalProject)
-
-set(CATCH_EXTERNAL_URL
-    URL https://github.com/catchorg/Catch2/archive/v2.9.1.tar.gz
-    URL_HASH MD5=4980778888fed635bf191d8a86f9f89c)
-ExternalProject_Add(catch2
-    PREFIX ${CMAKE_BINARY_DIR}/catch2-prefix
-    ${CATCH_EXTERNAL_URL}
-    CONFIGURE_COMMAND ""
-    BUILD_COMMAND ""
-    INSTALL_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/catch2-prefix/src/catch2/single_include/catch2/catch.hpp
-                                            ${CMAKE_BINARY_DIR}/catch2-prefix/include/catch.hpp
-)
-add_library(catch INTERFACE)
-add_dependencies(catch catch2)
-target_include_directories(catch INTERFACE ${CMAKE_BINARY_DIR}/catch2-prefix/include)
-


To comply other submodule syntax.

To comply other submodule syntax.

--- cmake/submoduleOpenMesh.cmake
+++ cmake/submoduleOpenMesh.cmake
@@ -20,23 +20,11 @@
     set(OPENMESH_LIBRARIES "${RADIUM_SUBMODULES_INSTALL_DIRECTORY}/lib/${OPENMESHLIBNAME}.lib")
 endif()

+
 if(MSVC OR MINGW)
-  set(COMPILE_DEFS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
-    -DBUILD_APPS=OFF
-    -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-    -DOPENMESH_BUILD_SHARED=TRUE
-    -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-    -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-    -DCMAKE_BUILD_TYPE=${RADIUM_SUBMODULES_BUILD_TYPE}
-    )
+  set( PLATFORM_ARGS "-DOPENMESH_BUILD_SHARED=TRUE" )
 else()
-  set(COMPILE_DEFS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
-    -DBUILD_APPS=OFF
-    -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-    -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-    -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-    -DCMAKE_BUILD_TYPE=${RADIUM_SUBMODULES_BUILD_TYPE}
-    )
+  set( PLATFORM_ARGS "" )
 endif()

@@ -56,7 +44,13 @@
         BUILD_BYPRODUCTS "${OPENMESH_LIBRARIES}"
         CMAKE_GENERATOR ${CMAKE_GENERATOR}
         CMAKE_GENERATOR_TOOLSET ${CMAKE_GENERATOR_TOOLSET}
-        CMAKE_ARGS ${COMPILE_DEFS}
+        CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
+	-DBUILD_APPS=OFF
+	-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
+	-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
+	-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
+	-DCMAKE_BUILD_TYPE=${RADIUM_SUBMODULES_BUILD_TYPE}
+	${PLATFORM_ARGS}
         EXCLUDE_FROM_ALL TRUE
 )


[cmake] printf -> CMAKE_COMMAND -E echo

[cmake] printf -> CMAKE_COMMAND -E echo

--- cmake/swig_python_tools.cmake
+++ cmake/swig_python_tools.cmake
@@ -47,7 +47,7 @@
   else()
     add_custom_command(OUTPUT ${SICONOS_SWIG_ROOT_DIR}/${COMP}-docstrings.i
       DEPENDS ${DOCSTRINGS_FILES}
-      COMMAND printf "" > ${COMP}-docstrings.i
+      COMMAND ${CMAKE_COMMAND} -E echo "" > ${COMP}-docstrings.i
       )

     add_custom_target(${COMP}_docstrings DEPENDS ${SICONOS_SWIG_ROOT_DIR}/${COMP}-docstrings.i)


Cmake fix for problematic with leading whitespace.

--- cmake/modules/FindLLVM.cmake
+++ cmake/modules/FindLLVM.cmake
@@ -17,8 +17,8 @@
   set(LLVM_FOUND TRUE)
 else()
 	find_program(LLVM_CONFIG_EXECUTABLE
-	  NAMES llvm-config llvm-config-3.5
-	  PATHS /opt/local/bin /usr/local/bin
+	  NAMES llvm-config-3.5 llvm-config
+	  PATHS /usr/local/bin /opt/local/bin
 	)

 	if(NOT LLVM_CONFIG_EXECUTABLE)
@@ -40,8 +40,8 @@
 	execute_process(COMMAND ${LLVM_CONFIG_EXECUTABLE} --ldflags  OUTPUT_VARIABLE LLVM_LDFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
 	#--system-libs is new in llvm 3.5
 	execute_process(COMMAND ${LLVM_CONFIG_EXECUTABLE} --system-libs  OUTPUT_VARIABLE LLVM_LDFLAGS2 OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
-	string(REPLACE "\n" "" LLVM_LDFLAGS2 ${LLVM_LDFLAGS2})
 	string(REPLACE "\n" " " LLVM_LDFLAGS ${LLVM_LDFLAGS} " " ${LLVM_LDFLAGS2})
+	string(REGEX REPLACE "(\n|\r\n)$" "" LLVM_LDFLAGS "${LLVM_LDFLAGS}")
 	exec_program(${LLVM_CONFIG_EXECUTABLE} ARGS --libs      OUTPUT_VARIABLE LLVM_LIBS_CORE )
 	find_llvm_libs(${LLVM_CONFIG_EXECUTABLE} "jit native" LLVM_LIBS_JIT LLVM_LIBS_JIT_OBJECTS )
 	#STRING(REPLACE " -lLLVMCore -lLLVMSupport -lLLVMSystem" "" LLVM_LIBS_JIT ${LLVM_LIBS_JIT_RAW})


cmake build reworked: qore creates cmake support files during configuration; modules using cmake just do not use FindQore.cmake in internal trees but use system-wide QoreConfig.cmake

git-svn-id: 7dcbe3a2cfbab14f53e32d77b78d91a4bd2a180d@6201 1b0b35fe-f740-4c1b-b404-a338b32e513b

--- cmake/modules/FindQore.cmake
+++ cmake/modules/FindQore.cmake
@@ -1,150 +0,0 @@
-#
-# Cmake module for Qore programming language
-#
-# (c) 2009 Qore Technologies, http://qoretechnologies.com
-#
-# QORE_FOUND - system has it
-# QORE_INCLUDE_DIR
-# QORE_LIBRARY
-# QORE_MODULES_DIR
-#
-# QORE_EXECUTABLE
-# QORE_QPP_EXECUTABLE
-#
-
-SET(QORE_FOUND FALSE)
-
-
-MACRO (QORE_WRAP_QPP _cpp_files _inputs )
-  message(STATUS "QPP: ${QORE_QPP_EXECUTABLE}")
-  message(STATUS "QPP2: ${_inputs}")
-
-  FOREACH (it ${_inputs})
-    message(STATUS "QPP1: ${it}")
-    GET_FILENAME_COMPONENT(_outfile ${it} NAME_WE)
-    GET_FILENAME_COMPONENT(_infile ${it} ABSOLUTE)
-    SET(_cppfile ${CMAKE_CURRENT_BINARY_DIR}/${_outfile}.cpp)
-    SET(_doxfile ${CMAKE_CURRENT_BINARY_DIR}/${_outfile}.dox.h)
-    message(STATUS "QPP processing: ${_infile} -> ${_cppfile} ${_doxfile}")
-    ADD_CUSTOM_COMMAND(OUTPUT ${_cppfile} ${_doxfile}
-      COMMAND ${QORE_QPP_EXECUTABLE}
-      ARGS --output=${_cppfile} --dox-output=${_doxfile} ${_infile}
-      MAIN_DEPENDENCY ${_infile}
-      WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
-      )
-    SET(${_cpp_files} ${${_cpp_files}} ${_cppfile})
-  ENDFOREACH (it)
-
-  message(STATUS "QPP files: ${${_cpp_files}}")
-
-ENDMACRO (QORE_WRAP_QPP)
-
-
-
-FIND_PATH (QORE_INCLUDE_DIR qore/Qore.h
-    /usr/include
-    /usr/include/qore
-    /usr/local/include
-    /usr/local/include/qore
-    /opt/qore/include/qore
-    /opt/qore/include
-    ${QORE_INCLUDE_PATH}
-)
-
-FIND_LIBRARY (QORE_LIBRARY
-    NAMES libqore libqore.so libqore.dylib
-    PATHS
-      /usr/lib
-      /usr/local/lib
-	  /opt/qore/lib
-	  ${QORE_LIBRARY_PATH}
-    )
-
-IF (QORE_LIBRARY AND QORE_INCLUDE_DIR)
-    SET(QORE_LIBRARIES ${QORE_LIBRARY})
-    SET(QORE_FOUND TRUE)
-ENDIF (QORE_LIBRARY AND QORE_INCLUDE_DIR)
-
-
-# get Qore version form 'qore --short-version' command etc
-FIND_PROGRAM(QORE_EXECUTABLE NAMES qore DOC "Searching for qore executable")
-IF (NOT QORE_EXECUTABLE)
-    MESSAGE( FATAL_ERROR "Cannot find 'qore' executable. Check if it's in your PATH" )
-ENDIF (NOT QORE_EXECUTABLE)
-
-FIND_PROGRAM(QORE_QPP_EXECUTABLE NAMES qpp DOC "Searching for qore qpp preprocessor")
-IF (NOT QORE_QPP_EXECUTABLE)
-    MESSAGE( FATAL_ERROR "Cannot find 'qpp' executable. Check if it's in your PATH" )
-ENDIF (NOT QORE_QPP_EXECUTABLE)
-
-
-IF (QORE_MIN_VERSION)
-    #now parse the parts of the user given version string into variables
-    # qore version is taken from qore executable - format major.minor.patch-build
-    STRING(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+" req_qore_version "${QORE_MIN_VERSION}")
-    IF (NOT req_qore_version)
-        MESSAGE( FATAL_ERROR "Invalid Qore version string given: \"${QORE_MIN_VERSION}\", expected e.g. \"0.7.3\"")
-    ENDIF (NOT req_qore_version)
-
-    # now parse the parts of the user given version string into variables
-    STRING(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" req_qore_major_v "${QORE_MIN_VERSION}")
-    STRING(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" req_qore_minor_v "${QORE_MIN_VERSION}")
-    STRING(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" req_qore_patch_v "${QORE_MIN_VERSION}")
-
-    EXEC_PROGRAM(${QORE_EXECUTABLE} ARGS "--short-version" OUTPUT_VARIABLE QORE_VERSION)
-    IF (NOT QORE_VERSION)
-        MESSAGE( FATAL_ERROR "Unknown Qore version. No data taken from 'qore --short-version'" )
-    ELSE (NOT QORE_VERSION)
-        MESSAGE( STATUS "Qore version: ${QORE_VERSION}" )
-    ENDIF (NOT QORE_VERSION)
-
-    # compare requested version with the one found
-    STRING(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+\\-[0-9]+" "\\1" qore_major_v "${QORE_VERSION}")
-    STRING(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+\\-[0-9]+" "\\1" qore_minor_v "${QORE_VERSION}")
-    STRING(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+)\\-[0-9]+" "\\1" qore_patch_v "${QORE_VERSION}")
-    # compute an overall version number which can be compared at once
-    MATH(EXPR req_v "${req_qore_major_v}*10000 + ${req_qore_minor_v}*100 + ${req_qore_patch_v}")
-    MATH(EXPR found_v "${qore_major_v}*10000 + ${qore_minor_v}*100 + ${qore_patch_v}")
-    #MESSAGE (STATUS "${req_qore_major_v} ${req_qore_minor_v} ${req_qore_patch_v}")
-    #MESSAGE (STATUS "${qore_major_v} ${qore_minor_v} ${qore_patch_v}")
-    # and decide finally
-    IF (found_v LESS req_v)
-        SET (QORE_FOUND FALSE)
-        MESSAGE (STATUS "Requested Qore version is bigger than found. ${QORE_MIN_VERSION} vs ${QORE_VERSION}" )
-    ENDIF (found_v LESS req_v)
-
-ENDIF (QORE_MIN_VERSION)
-
-# module install dir
-EXEC_PROGRAM(${QORE_EXECUTABLE} ARGS "--module-dir" OUTPUT_VARIABLE QORE_MODULES_DIR)
-IF (NOT QORE_MODULES_DIR)
-    MESSAGE( FATAL_ERROR "Unknown Qore modules location. No data taken from 'qore --module-dir'" )
-ELSE (NOT QORE_MODULES_DIR)
-    MESSAGE( STATUS "Qore modules dir: ${QORE_MODULES_DIR}" )
-ENDIF (NOT QORE_MODULES_DIR)
-
-# module API version
-IF (NOT QORE_API_VERSION)
-    EXEC_PROGRAM(${QORE_EXECUTABLE} ARGS "--latest-module-api" OUTPUT_VARIABLE QORE_API_VERSION)
-ENDIF (NOT QORE_API_VERSION)
-IF (NOT QORE_API_VERSION)
-    MESSAGE( FATAL_ERROR "Unknown Qore module API version. No data taken from 'qore --latest-module-api'. It can be specified manually with -DQORE_API_VERSION")
-ELSE (NOT QORE_API_VERSION)
-    MESSAGE( STATUS "Qore module API version: ${QORE_API_VERSION}")
-ENDIF (NOT QORE_API_VERSION)
-
-
-IF (QORE_FOUND)
-    MESSAGE(STATUS "Found Qore lib: ${QORE_LIBRARY}")
-    MESSAGE(STATUS "      includes: ${QORE_INCLUDE_DIR}")
-ELSE (QORE_FOUND)
-    MESSAGE(STATUS "E! Found Qore lib: ${QORE_LIBRARY}")
-    MESSAGE(STATUS "E!      includes: ${QORE_INCLUDE_DIR}")
-
-  IF (Qore_FIND_REQUIRED)
-    MESSAGE(FATAL_ERROR "Could not find Qore library")
-  ENDIF (Qore_FIND_REQUIRED)
-ENDIF (QORE_FOUND)
-
-MARK_AS_ADVANCED(QORE_INCLUDE_DIR QORE_LIBRARY)
-


Fix improper nesting of if statements.

Fix improper nesting of if statements.

Apply a simpler fix for stderr versus stdout question.

svn path=/trunk/; revision=7342

--- cmake/modules/FindSWIG.cmake
+++ cmake/modules/FindSWIG.cmake
@@ -32,22 +32,17 @@
       SET(SWIG_USE_FILE ${CMAKE_ROOT}/Modules/UseSWIG.cmake)
       EXECUTE_PROCESS(COMMAND ${SWIG_EXECUTABLE} -version
 	OUTPUT_VARIABLE SWIG_version_output
-	ERROR_VARIABLE SWIG_version_error
+	ERROR_VARIABLE SWIG_version_output
 	RESULT_VARIABLE SWIG_version_result)
       IF(SWIG_version_result)
         MESSAGE(SEND_ERROR "Command \"${SWIG_EXECUTABLE} -version\" failed with output:\n${SWIG_version_error}")
       ELSE(SWIG_version_result)
-        IF(SWIG_version_output STREQUAL "")
-        STRING(REGEX REPLACE ".*SWIG Version[^0-9.]*\([0-9.]+\).*" "\\1"
-	  SWIG_version_output "${SWIG_version_error}")
-        ELSE(SWIG_version_output STREQUAL "")
         STRING(REGEX REPLACE ".*SWIG Version[^0-9.]*\([0-9.]+\).*" "\\1"
 	  SWIG_version_output "${SWIG_version_output}")
-        ENDIF(SWIG_version_output STREQUAL "")
         SET(SWIG_VERSION ${SWIG_version_output} CACHE STRING "Swig version" FORCE)
-      ENDIF(SWIG_swiglib_result)
+      ENDIF(SWIG_version_result)
     ENDIF(SWIG_DIR)
-  ENDIF(SWIG_version_result)
+  ENDIF(SWIG_swiglib_result)
 ENDIF(SWIG_EXECUTABLE)

 IF(NOT SWIG_FOUND)


Revert r349541 (Fix MSVC dependency issue between Clang-tablegen and LLVM-tablegen)

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

--- cmake/modules/TableGen.cmake
+++ cmake/modules/TableGen.cmake
@@ -158,12 +158,6 @@
       llvm_ExternalProject_BuildCmd(tblgen_build_cmd ${target}
                                     ${LLVM_NATIVE_BUILD}
                                     CONFIGURATION Release)
-      # Create an artificial dependency between tablegen projects, because they
-      # compile the same dependencies, thus using the same build folders.
-      # FIXME: A proper fix requires sequentially chaining tablegens.
-      if (NOT ${project} STREQUAL LLVM)
-        add_dependencies(${project}-tablegen-host LLVM-tablegen-host)
-      endif()
       add_custom_command(OUTPUT ${${project}_TABLEGEN_EXE}
         COMMAND ${tblgen_build_cmd}
         DEPENDS CONFIGURE_LLVM_NATIVE ${target}


bug#58955: Must -DBUILD_CONFIG=mysql_release require libaio on Linux

Allow users to build without aio if they really want to, by passing
-DIGNORE_AIO_CHECK to cmake.

--- cmake/build_configurations/mysql_release.cmake
+++ cmake/build_configurations/mysql_release.cmake
@@ -118,17 +118,21 @@
   OPTION(WITH_PIC "" ON) # Why?

   IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
-    # Ensure aio is available on Linux (required by InnoDB)
-    CHECK_INCLUDE_FILES(libaio.h HAVE_LIBAIO_H)
-    CHECK_LIBRARY_EXISTS(aio io_queue_init "" HAVE_LIBAIO)
-    IF(NOT HAVE_LIBAIO_H OR NOT HAVE_LIBAIO)
-      MESSAGE(FATAL_ERROR "
-      aio is required on Linux, you need to install the required library:
-
-        Debian/Ubuntu:              apt-get install libaio-dev
-        RedHat/Fedora/Oracle Linux: yum install libaio-devel
-        SuSE:                       zypper install libaio-devel
-       ")
+    IF(NOT IGNORE_AIO_CHECK)
+      # Ensure aio is available on Linux (required by InnoDB)
+      CHECK_INCLUDE_FILES(libaio.h HAVE_LIBAIO_H)
+      CHECK_LIBRARY_EXISTS(aio io_queue_init "" HAVE_LIBAIO)
+      IF(NOT HAVE_LIBAIO_H OR NOT HAVE_LIBAIO)
+        MESSAGE(FATAL_ERROR "
+        aio is required on Linux, you need to install the required library:
+
+          Debian/Ubuntu:              apt-get install libaio-dev
+          RedHat/Fedora/Oracle Linux: yum install libaio-devel
+          SuSE:                       zypper install libaio-devel
+
+        If you really do not want it, pass -DIGNORE_AIO_CHECK to cmake.
+        ")
+      ENDIF()
     ENDIF()

     # Enable fast mutexes on Linux


ENH: clean zlib superbuild

ENH: clean zlib superbuild

--- Superbuild/CMake/External_zlib.cmake
+++ Superbuild/CMake/External_zlib.cmake
@@ -10,8 +10,7 @@
 if(USE_SYSTEM_ZLIB)
   find_package(ZLIB REQUIRED)
   add_custom_target(${proj})
-  set(ZLIB_ROOT ${ZLIB_INCLUDE_DIR}/..)
-  message(STATUS "  Using Zlib system version : ${ZLIB_ROOT}")
+  message(STATUS "  Using Zlib system version")
 else()
   SETUP_SUPERBUILD(PROJECT ${proj})
   message(STATUS "  Using zlib SuperBuild version")


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

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

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


STYLE: Nightly Date Stamp

STYLE: Nightly Date Stamp

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

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


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

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

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


STYLE: Nightly Date Stamp

STYLE: Nightly Date Stamp

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

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

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


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

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

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


STYLE: Nightly Date Stamp

STYLE: Nightly Date Stamp

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

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


- OST_MACOSX supported

 - OST_MACOSX supported

git-svn-id: 41bd7e47c31e4d43f97241d7529f6785d233c6d8@13289 23f926e6-80f1-49ca-85a0-60d4a27bb3ac

--- rdo/packages/cmake/trunk/build.version.cmake
+++ rdo/packages/cmake/trunk/build.version.cmake
@@ -32,6 +32,8 @@

 #ifdef OST_WINDOWS
 		static const std::string g_systemOS("win");
+#elif defined(OST_MACOSX)
+                static const std::string g_systemOS("mac");
 #elif defined(OST_LINUX)
 		static const std::string g_systemOS("linux");
 #endif


python.cmake: Added an optional cmake cache variable to enable building a debug version of Python.

--- python.cmake
+++ python.cmake
@@ -28,12 +28,23 @@
     # On Mac, we build a "Framework" build which has all the power of a "normal" build,
     #  plus it can be used from a native GUI.
     # See http://svn.python.org/projects/python/trunk/Mac/README
-    set (PYTHON_BUILD_TYPE_ARG "--enable-framework=${BUILDEM_DIR}/Frameworks")
+    set (PYTHON_BINARY_TYPE_ARG "--enable-framework=${BUILDEM_DIR}/Frameworks")
     set (PYTHON_PREFIX ${BUILDEM_DIR}/Frameworks/Python.framework/Versions/2.7)
 else()
     # On linux, PYTHON_PREFIX is the same as the general prefix.
-    set (PYTHON_BUILD_TYPE_ARG "--enable-shared")
+    set (PYTHON_BINARY_TYPE_ARG "--enable-shared")
     set (PYTHON_PREFIX ${BUILDEM_DIR})
+endif()
+
+set (PYTHON_BUILD_DEBUG "FALSE" CACHE BOOL "Configure Python --with-pydebug and --without-pymalloc for debugging extensions with gdb.")
+
+if (${PYTHON_BUILD_DEBUG})
+    # If you want to debug python with gdb, you need --with-pydebug.
+    # Also, --without-pymalloc is useful if you want to avoid assertions in PyMalloc
+    #  that can be caused by some python extensions (e.g. the python vtk bindings hit those assertions)
+    # Of course, if those assertions are hit by code that YOU wrote, then you might
+    #  want to change this build command so you can debug WITH pymalloc.
+    set(PYTHON_DEBUG_CONFIG_ARGS "--with-pydebug --without-pymalloc")
 endif()

 ExternalProject_Add(${python_NAME}
@@ -45,7 +56,8 @@
     PATCH_COMMAND       ""
     CONFIGURE_COMMAND   ${BUILDEM_ENV_STRING} ${python_SRC_DIR}/configure
         --prefix=${BUILDEM_DIR}
-        ${PYTHON_BUILD_TYPE_ARG}
+        ${PYTHON_BINARY_TYPE_ARG}
+        ${PYTHON_DEBUG_CONFIG_ARGS}
         LDFLAGS=${BUILDEM_LDFLAGS}
         CPPFLAGS=-I${BUILDEM_DIR}/include
         BUILD_COMMAND       ${BUILDEM_ENV_STRING} $(MAKE)


FindTBB: remove variable deref in if() commands

--- CMake/FindTBB.cmake
+++ CMake/FindTBB.cmake
@@ -193,22 +193,22 @@

 # For OS X binary distribution, choose libc++ based libraries for Mavericks (10.9)
 # and above and AppleClang
-if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" AND
-    NOT ${CMAKE_SYSTEM_VERSION} LESS 13.0)
+if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND
+    NOT CMAKE_SYSTEM_VERSION VERSION_LESS 13.0)
   set (USE_LIBCXX OFF)
   cmake_policy(GET CMP0025 POLICY_VAR)

-  if ("${POLICY_VAR}" STREQUAL "NEW")
-    if (${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang")
+  if (POLICY_VAR STREQUAL "NEW")
+    if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
       set (USE_LIBCXX ON)
     endif ()
   else ()
-    if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
+    if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
       set (USE_LIBCXX ON)
     endif ()
   endif ()

-  if (${USE_LIBCXX})
+  if (USE_LIBCXX)
     foreach (dir IN LISTS TBB_PREFIX_PATH)
       list (APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/libc++ ${dir}/libc++/lib)
     endforeach ()


bump version number

bump version number

--- CMake/version.cmake
+++ CMake/version.cmake
@@ -1,3 +1,3 @@
 set (VV_VERSION_MAJOR 1)
 set (VV_VERSION_MINOR 1)
-set (VV_VERSION_PATCH 3)
+set (VV_VERSION_PATCH 4)


build: Tag work-in-progress as 1.1 versions

--- CMake/version.cmake
+++ CMake/version.cmake
@@ -1,3 +1,3 @@
 set (VV_VERSION_MAJOR 1)
-set (VV_VERSION_MINOR 0)
-set (VV_VERSION_PATCH 8)
+set (VV_VERSION_MINOR 1)
+set (VV_VERSION_PATCH 0)


rewording and moving of some options

rewording and moving of some options

--- CMake/lrs_options.cmake
+++ CMake/lrs_options.cmake
@@ -1,6 +1,5 @@
 option(ENABLE_CCACHE "Build with ccache." ON)
 option(BUILD_WITH_CUDA "Enable CUDA" OFF)
-option(BUILD_GRAPHICAL_EXAMPLES "Build graphical examples and tools. Implies BUILD_GLSL_EXTENSIONS" ON)
 option(BUILD_GLSL_EXTENSIONS "Build GLSL extensions API" ON)
 option(BUILD_WITH_OPENMP "Use OpenMP" OFF)
 option(ENABLE_ZERO_COPY "Enable zero copy functionality" OFF)
@@ -12,18 +11,19 @@
 option(BUILD_SHARED_LIBS "Build shared library" ON)
 option(BUILD_UNIT_TESTS "Build realsense unit tests. Note that when enabled, additional tests data set will be downloaded from a web server and stored in a temp directory" OFF)
 option(BUILD_INTERNAL_UNIT_TESTS "Test package for components under librealsense namespace, requires BUILD_SHARED_LIBS=OFF and BUILD_UNIT_TESTS=ON" OFF)
-option(BUILD_EXAMPLES "Build realsense examples and tools." ON)
-option(BUILD_TOOLS "Build realsense tools." ON)
+option(BUILD_EXAMPLES "Build examples (not including graphical examples -- see BUILD_GRAPHICAL_EXAMPLES)" ON)
+option(BUILD_GRAPHICAL_EXAMPLES "Build graphical examples (Viewer & DQT) -- Implies BUILD_GLSL_EXTENSIONS" ON)
+option(BUILD_CV_EXAMPLES "Build OpenCV examples" OFF)
+option(BUILD_DLIB_EXAMPLES "Build DLIB examples - requires DLIB_DIR" OFF)
+option(BUILD_PCL_EXAMPLES "Build PCL examples" OFF)
+option(BUILD_TOOLS "Build tools (fw-updater, etc.) that are not examples" ON)
 option(ENFORCE_METADATA "Require WinSDK with Metadata support during compilation. Windows OS Only" OFF)
 option(BUILD_PYTHON_BINDINGS "Build Python bindings" OFF)
 option(BUILD_PYTHON_DOCS "Build Documentation for Python bindings" OFF)
 option(BUILD_CSHARP_BINDINGS "Build C# bindings" OFF)
 option(BUILD_MATLAB_BINDINGS "Build Matlab bindings" OFF)
 option(BUILD_UNITY_BINDINGS "Copy the unity project to the build folder with the required dependencies" OFF)
-option(BUILD_CV_EXAMPLES "Build OpenCV examples" OFF)
-option(BUILD_DLIB_EXAMPLES "Build DLIB examples - requires DLIB_DIR" OFF)
 option(BUILD_OPENVINO_EXAMPLES "Build Intel OpenVINO Toolkit examples - requires INTEL_OPENVINO_DIR" OFF)
-option(BUILD_PCL_EXAMPLES "Build PCL examples" OFF)
 option(BUILD_OPEN3D_EXAMPLES "Build Open3D examples" OFF)
 option(BUILD_NODEJS_BINDINGS "Build Node.js bindings" OFF)
 option(BUILD_OPENNI2_BINDINGS "Build OpenNI bindings" OFF)


Fix name of easylogging library

Fix name of easylogging library

--- lib/easyloggingpp.cmake
+++ lib/easyloggingpp.cmake
@@ -4,7 +4,7 @@

 set(EASYLOGGINGPP_VERSION "9.95.3")
-set(EASYLOGGINGPP_LIBRARY "easyloggingcpp")
+set(EASYLOGGINGPP_LIBRARY "easyloggingpp")
 set(EASYLOGGINGPP_INCLUDE_DIRS "${EASYLOGGINGPP_PATH}/src")
 set(EASYLOGGINGPP_CPP_SOURCES "${EASYLOGGINGPP_PATH}/src/easylogging++.cc")


Corrected FindPoppler documentation

Corrected FindPoppler documentation

--- FindPoppler.cmake
+++ FindPoppler.cmake
@@ -5,8 +5,8 @@
 #  POPPLER_HAS_XPDF - A boolean indicating if Poppler XPDF headers are available
 #  POPPLER_NEEDS_FONTCONFIG - A boolean indicating if libpoppler depends on libfontconfig
 #  POPPLER_XPDF_INCLUDE_DIR - the include directory for Poppler XPDF headers
-#  POPPLER_QT4_INCLUDE_DIR - the include directory for Poppler-Qt4 headers
-#  POPPLER_QT4_LIBRARIES  - Link this to use only libpoppler-Qt4
+#  POPPLER_QT_INCLUDE_DIR - the include directory for Poppler-Qt4 headers
+#  POPPLER_QT_LIBRARIES  - Link this to use only libpoppler-Qt4
 #  POPPLER_LIBRARIES - Link these to use Poppler and Poppler-Qt4
 #
 # Note: the Poppler-cpp include directory is currently not needed by TeXworks


ENH: Disable reliance on Slicer on Abydos

--- Abydos_Kitware_TubeTK.cmake
+++ Abydos_Kitware_TubeTK.cmake
@@ -45,17 +45,17 @@
 #

 # Boost
-set( TubeTK_USE_BOOST ON )
+set( TubeTK_USE_BOOST OFF )
 #if TubeTK_USE_BOOST is ON, you need to fix the following line
 set( BOOST_ROOT "/usr/local" )

 # Slicer
-set( TubeTK_BUILD_USING_SLICER ON )
+set( TubeTK_BUILD_USING_SLICER OFF )
 #if TubeTK_BUILD_USING_SLICER is ON, you need to fix the following line
-set( Slicer_DIR "/Users/aylward/src/Slicer-Release/Slicer-build" )
+#set( Slicer_DIR "/Users/aylward/src/Slicer-Release/Slicer-build" )

 # ArrayFire
-set( TubeTK_USE_GPU_ARRAYFIRE ON )
+set( TubeTK_USE_GPU_ARRAYFIRE OFF )
 #if TubeTK_USE_GPU_ARRAYFIRE is ON, you need to fix the following line
 set( ArrayFire_DIR "/usr/local" )


common_gui_application() links to Qt5::WinMain for Qt apps on windows

--- CommonApplication.cmake
+++ CommonApplication.cmake
@@ -40,9 +40,9 @@
 endfunction()

 function(COMMON_GUI_APPLICATION Name)
+string(TOUPPER ${Name} NAME)
+
 if(APPLE)
-  string(TOUPPER ${Name} NAME)
-
   if(${NAME}_ICON)
     set_source_files_properties(${${NAME}_ICON}
       PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
@@ -68,8 +68,13 @@
     WORKING_DIRECTORY ${_INSTALLDIR})" COMPONENT apps)
   install(CODE "execute_process(COMMAND mv ${Name}.dmg ${Name}-${VERSION}.dmg
     WORKING_DIRECTORY ${_INSTALLDIR})" COMPONENT apps)
-elseif(WIN32)
+elseif(MSVC)
   common_application(${Name} WIN32 ${ARGN})
+  # Qt5 gui applications need to link to WinMain on Windows
+  list(FIND ${NAME}_LINK_LIBRARIES Qt5::Core _USING_QT)
+  if(NOT _USING_QT EQUAL -1)
+    target_link_libraries(${Name} Qt5::WinMain)
+  endif()
 else()
   common_application(${Name} ${ARGN})
 endif()


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

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

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


posix_ocpoc_cross.cmake: fix ulanding module

module list is now the same as posix_ocpoc_ubuntu.cmake

--- cmake/configs/posix_ocpoc_cross.cmake
+++ cmake/configs/posix_ocpoc_cross.cmake
@@ -18,6 +18,7 @@
 	#
 	# Board support modules
 	#
+	drivers/distance_sensor
 	modules/sensors
 	platforms/posix/drivers/df_mpu9250_wrapper
 	platforms/posix/drivers/df_ms5611_wrapper
@@ -70,7 +71,6 @@
 	drivers/linux_sbus
 	drivers/linux_pwm_out
 	drivers/rgbled
-	drivers/ulanding

 	examples/px4_simple_app
 )


wrong link rule

wrong link rule

--- cmake/modules/FindLibKVkontakte.cmake
+++ cmake/modules/FindLibKVkontakte.cmake
@@ -50,7 +50,7 @@
     # TODO VKONTAKTE_INCLUDE_DIR sounds like it should contain only one directory...
     SET(VKONTAKTE_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/${VKONTAKTE_LOCAL_DIR} ${CMAKE_BINARY_DIR}/${VKONTAKTE_LOCAL_DIR})
     SET(VKONTAKTE_DEFINITIONS "-I${CMAKE_SOURCE_DIR}/${VKONTAKTE_LOCAL_DIR}" "-I${CMAKE_BINARY_DIR}/${VKONTAKTE_LOCAL_DIR}")
-    SET(VKONTAKTE_LIBRARIES kface)
+    SET(VKONTAKTE_LIBRARIES kvkontakte)
     MESSAGE(STATUS "Found Vkontakte library in local sub-folder: ${CMAKE_SOURCE_DIR}/${VKONTAKTE_LOCAL_DIR}")
     SET(VKONTAKTE_FOUND TRUE)
     MARK_AS_ADVANCED(VKONTAKTE_INCLUDE_DIR VKONTAKTE_LIBRARIES VKONTAKTE_DEFINITIONS)
@@ -91,7 +91,7 @@
         ${_VKONTAKTEIncDir}
         )

-        FIND_LIBRARY(VKONTAKTE_LIBRARIES NAMES kface
+        FIND_LIBRARY(VKONTAKTE_LIBRARIES NAMES kvkontakte
         PATHS
         ${_VKONTAKTELinkDir}
         )


[CMake] Change `LLVM_DISABLE_INDEX_STORE` to be an option and remove 'FORCE' from `INDEX_DATA_STORE_PATH`

--- cmake/modules/HandleLLVMOptions.cmake
+++ cmake/modules/HandleLLVMOptions.cmake
@@ -670,9 +670,9 @@
 endif()

 # Enable '-index-store-path' on a Debug build, if the compiler supports it and for non-IDE generators.
-set(LLVM_DISABLE_INDEX_STORE OFF CACHE BOOL "Disable '-index-store-path' flag" FORCE)
+option(LLVM_DISABLE_INDEX_STORE "Disable '-index-store-path' flag" Off)
 if (NOT LLVM_DISABLE_INDEX_STORE AND NOT XCODE AND NOT MSVC_IDE AND uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
-  set(INDEX_DATA_STORE_PATH "${PROJECT_BINARY_DIR}/IndexStore" CACHE STRING "Index store path" FORCE)
+  set(INDEX_DATA_STORE_PATH "${PROJECT_BINARY_DIR}/IndexStore" CACHE STRING "Index store path")

   check_c_compiler_flag("-Werror -index-store-path \"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/IndexStore\"" "C_SUPPORTS_INDEX_STORE")
   append_if("C_SUPPORTS_INDEX_STORE" "-index-store-path \"${INDEX_DATA_STORE_PATH}\"" CMAKE_C_FLAGS)


Check for  `std::string_view::to_string` instead of  `std::string_view`.

--- cmake/modules/RootConfiguration.cmake
+++ cmake/modules/RootConfiguration.cmake
@@ -467,8 +467,7 @@
 endif()

 CHECK_CXX_SOURCE_COMPILES("#include <string_view>
-int main() { return 0; }
-" found_stdstringview)
+  int main() { std::string_view().to_string(); return 0;}" found_stdstringview)
 if(found_stdstringview)
   set(hasstdstringview define)
 else()
@@ -476,8 +475,7 @@
 endif()

 CHECK_CXX_SOURCE_COMPILES("#include <experimental/string_view>
-int main() { return 0; }
-" found_stdexpstringview)
+   int main() { std::experimental::string_view().to_string(); return 0;}" found_stdexpstringview)
 if(found_stdexpstringview)
   set(hasstdexpstringview define)
 else()


Rename variable

Rename variable

--- cmake/modules/hunter_setup_msvc.cmake
+++ cmake/modules/hunter_setup_msvc.cmake
@@ -49,20 +49,20 @@

       hunter_status_print("HUNTER_MSVC_ARCH: ${HUNTER_MSVC_ARCH}")

-      set(_hunter_result "${HUNTER_MSVC_VERSION}0")
-      set(_hunter_result "VS${_hunter_result}COMNTOOLS")
+      set(_hunter_vcvarsall_path "${HUNTER_MSVC_VERSION}0")
+      set(_hunter_vcvarsall_path "VS${_hunter_vcvarsall_path}COMNTOOLS")

-      set(_hunter_result "$ENV{${_hunter_result}}/../../VC")
-      get_filename_component(_hunter_result "${_hunter_result}" ABSOLUTE)
+      set(_hunter_vcvarsall_path "$ENV{${_hunter_vcvarsall_path}}/../../VC")
+      get_filename_component(_hunter_vcvarsall_path "${_hunter_vcvarsall_path}" ABSOLUTE)
       find_file(
         HUNTER_MSVC_VCVARSALL
         "vcvarsall.bat"
         PATHS
-        "${_hunter_result}"
+        "${_hunter_vcvarsall_path}"
         NO_DEFAULT_PATH
       )
       if(NOT HUNTER_MSVC_VCVARSALL)
-        hunter_internal_error("vcvarsall.bat not found in `${_hunter_result}`")
+        hunter_internal_error("vcvarsall.bat not found in `${_hunter_vcvarsall_path}`")
       endif()

       hunter_status_print("vcvarsall.bat file location: ${HUNTER_MSVC_VCVARSALL}")
@@ -74,7 +74,7 @@
       unset(_hunter_msvc_check_string)
       unset(_hunter_msvc_check_string_bool)
       unset(_hunter_msvc_version_list)
-      unset(_hunter_result)
+      unset(_hunter_vcvarsall_path)
     endif()
   endif()
 endmacro()


cmake: Conditionally add debug libraries.

--- cmake/Modules/WintermuteMacros.cmake
+++ cmake/Modules/WintermuteMacros.cmake
@@ -58,7 +58,7 @@
 #== Links TARGET with the libraries Wintermute would need in order to operate.
 #==============================================================================
 MACRO(wintermute_link_libraries _target)
-  IF (CMAKE_BUILD_TYPE STREQUAL "Debug")
+  IF (CMAKE_BUILD_TYPE STREQUAL "Debug" AND WINTERMUTE_TEST_LIBRARIES)
     TARGET_LINK_LIBRARIES(${_target}
       debug ${WINTERMUTE_TEST_LIBRARIES})
   ENDIF()


Revert "Look for Apache Arrow by default at configuration time"

This reverts commit e1ad789204a7476ed6645f2c53b98395bcc99f8b since
there are still conflicts with the name arrow in the tutorials.

--- cmake/modules/RootBuildOptions.cmake
+++ cmake/modules/RootBuildOptions.cmake
@@ -64,7 +64,7 @@
 ROOT_BUILD_OPTION(afs OFF "AFS support, requires AFS libs and objects")
 ROOT_BUILD_OPTION(alien OFF "AliEn support, requires libgapiUI from ALICE")
 ROOT_BUILD_OPTION(asimage ON "Image processing support, requires libAfterImage")
-ROOT_BUILD_OPTION(arrow ON "Apache Arrow in memory columnar storage support")
+ROOT_BUILD_OPTION(arrow OFF "Apache Arrow in memory columnar storage support")
 ROOT_BUILD_OPTION(astiff ON "Include tiff support in image processing")
 ROOT_BUILD_OPTION(bonjour OFF "Bonjour support, requires libdns_sd and/or Avahi")
 ROOT_BUILD_OPTION(builtin_afterimage ON "Build included libAfterImage, or use system libAfterImage")


Install MSVC runtime

Install MSVC runtime

--- cmake/ospray_redistribute_deps.cmake
+++ cmake/ospray_redistribute_deps.cmake
@@ -108,3 +108,13 @@
     ospray_install_namelink(embree ${EMBREE_LIBNAME})
   endif()
 endif()
+
+# Install MSVC runtime
+if (WIN32)
+  set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)
+  include(InstallRequiredSystemLibraries)
+  list(FILTER CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS INCLUDE REGEX
+      ".*msvcp[0-9]+\.dll|.*vcruntime[0-9]+\.dll|.*vcruntime[0-9]+_[0-9]+\.dll")
+  install(FILES ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
+      DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT redist)
+endif()


install: fix typo

install: fix typo

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

--- cmake/qibuild/internal/install.cmake
+++ cmake/qibuild/internal/install.cmake
@@ -42,7 +42,7 @@
       if(NOT _file_to_install)
         qi_error(
           "Error when parsing qi_install arguments:
-          '${f}'glob does not match any files")
+          '${f}' glob does not match any file")
       endif()
       list(APPEND _files_to_install ${_file_to_install})
     else()


Updated LLVM dependency.

Updated LLVM dependency.

--- cmake/third_party/llvm-project.cmake
+++ cmake/third_party/llvm-project.cmake
@@ -37,8 +37,8 @@
   message(STATUS "Fetching LLVM")
   FetchContent_Declare(
     llvm-project
-    URL https://github.com/plaidml/llvm-project/archive/c64378c1ec6c0325ee1fc1abac89884657738657.tar.gz
-    URL_HASH SHA256=583f481050872e1ce8f90b101f3e10ec0fdc6b16dbb9d9ede8b68aaa891c4c83
+    URL https://github.com/plaidml/llvm-project/archive/14732dd95a9eff28d4afbbb2a52083c9773fa350.tar.gz
+    URL_HASH SHA256=6caf34fbb54d77b21706fa5ccfac6bf4d27be6bc5208aba6f896bb69b7f5aa42
   )
   # Check if population has already been performed
   FetchContent_GetProperties(llvm-project)


fix output directory and output format

fix output directory and output format

--- tools/cmake/ANHLibrary.cmake
+++ tools/cmake/ANHLibrary.cmake
@@ -192,7 +192,7 @@
                     add_test(
                         NAME all_${name}_tests_${configuration}
                         CONFIGURATIONS ${configuration}
-                        COMMAND ${name}_test "--catch_system_error=yes  --log_level=test_suite output_format=XML:${PROJECT_BINARY_DIR}/reports/$<CONFIGURATION>/"
+                        COMMAND ${name}_test "--catch_system_error=yes  --log_level=test_suite --output_format=XML>${PROJECT_BINARY_DIR}/reports/$<CONFIGURATION>/"
                         WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${configuration}
                     )
                 endforeach()


ENH: Update Slicer extension information

--- Common.cmake
+++ Common.cmake
@@ -41,11 +41,11 @@
 endif()
 #-----------------------------------------------------------------------------
 set(EXTENSION_NAME FiberViewerLight)
-set(EXTENSION_HOMEPAGE "http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Extensions/FiberViewerLight")
+set(EXTENSION_HOMEPAGE "http://www.nitrc.org/projects/fvlight/")
 set(EXTENSION_CATEGORY "Diffusion")
 set(EXTENSION_CONTRIBUTORS "Francois Budin (UNC)")
-set(EXTENSION_DESCRIPTION "This extension provides the tool FiberViewerLight integrated in Slicer")
-set(EXTENSION_ICONURL "http://www.nitrc.org/project/list_screenshots.php?group_id=534&screenshot_id=598")
+set(EXTENSION_DESCRIPTION "FiberViewerLight is an open-source software to visualize and edit fibers")
+set(EXTENSION_ICONURL "http://www.nitrc.org/project/screenshot.php?group_id=534&screenshot_id=598")
 set(EXTENSION_SCREENSHOTURLS "http://www.nitrc.org/project/list_screenshots.php?group_id=534&screenshot_id=599 http://www.nitrc.org/project/list_screenshots.php?group_id=534&screenshot_id=597")
 set(EXTENSION_STATUS "Beta")
 set(EXTENSION_DEPENDS "NA") # Specified as a space separated list or 'NA' if any


Add .spec file generation to Common.cmake

--- Common.cmake
+++ Common.cmake
@@ -85,7 +85,10 @@
   else()
     set(CMAKE_CXX_FLAGS "/DWIN32 /D_WINDOWS /W3 /Zm500 /EHsc /GR /WX")
   endif()
-endif(MSVC)
+elseif(EXISTS ${CMAKE_SOURCE_DIR}/CMake/${CMAKE_PROJECT_NAME}.in.spec)
+  configure_file(${CMAKE_SOURCE_DIR}/CMake/${CMAKE_PROJECT_NAME}.in.spec
+    ${CMAKE_SOURCE_DIR}/CMake/${CMAKE_PROJECT_NAME}.spec @ONLY)
+endif()

 if(CMAKE_SYSTEM_NAME MATCHES "Linux")
   set(LINUX TRUE)
@@ -112,14 +115,3 @@
   message(STATUS
     "Building ${CMAKE_PROJECT_NAME} for ${CMAKE_OSX_ARCHITECTURES}")
 endif(APPLE)
-
-# hooks to gather all targets (libaries & executables)
-set(ALL_DEP_TARGETS "")
-macro(add_executable _target)
-  _add_executable(${_target} ${ARGN})
-  set_property(GLOBAL APPEND PROPERTY ALL_DEP_TARGETS ${_target})
-endmacro()
-macro(add_library _target)
-  _add_library(${_target} ${ARGN})
-  set_property(GLOBAL APPEND PROPERTY ALL_DEP_TARGETS ${_target})
-endmacro()


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

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

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


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

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

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


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

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

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


Use uppercase variable names for all generated libraries

--- PackageConfig.cmake
+++ PackageConfig.cmake
@@ -43,16 +43,6 @@
   "  set_and_check(${UPPER_PROJECT_NAME}_INCLUDE_DIRS "@PACKAGE_INCLUDE_INSTALL_DIR@")\n"
   "  set(${UPPER_PROJECT_NAME}_DEB_DEPENDENCIES \"${LOWER_PROJECT_NAME}${VERSION_ABI} (>= ${VERSION_MAJOR}.${VERSION_MINOR})\")\n"
   "\n"
-# find the core library
-  "  find_library(${UPPER_PROJECT_NAME}_LIBRARY ${CMAKE_PROJECT_NAME} NO_DEFAULT_PATH\n"
-  "        PATHS \${PACKAGE_PREFIX_DIR} PATH_SUFFIXES lib ${PYTHON_LIBRARY_PREFIX})\n"
-  "  if(${UPPER_PROJECT_NAME}_LIBRARY MATCHES "${UPPER_PROJECT_NAME}_LIBRARY-NOTFOUND")\n"
-  "    set(_fail TRUE)\n"
-  "    if(_out)\n"
-  "      message(\${_output_type} \"   Missing the ${CMAKE_PROJECT_NAME} \"\n"
-  "        \"library in \${PACKAGE_PREFIX_DIR}/lib.\")\n"
-  "    endif()\n"
-  "  endif()\n"
 # find components if specified
   "  if(${CMAKE_PROJECT_NAME}_FIND_COMPONENTS)\n"
   "    list(APPEND ${UPPER_PROJECT_NAME}_LIBRARIES \${${UPPER_PROJECT_NAME}_LIBRARY})\n"
@@ -79,9 +69,18 @@
 # if no component was specified, find all produced libraries
   "    set(${UPPER_PROJECT_NAME}_LIBRARY_NAMES "@LIBRARY_NAMES@")\n"
   "    foreach(_libraryname \${${UPPER_PROJECT_NAME}_LIBRARY_NAMES})\n"
-  "      find_library(\${_libraryname}_LIBRARY \${_libraryname} NO_DEFAULT_PATH\n"
+  "      string(TOUPPER \${_libraryname} _librarynameUC)\n"
+  "      find_library(\${_librarynameUC}_LIBRARY \${_libraryname} NO_DEFAULT_PATH\n"
   "                   PATHS \${PACKAGE_PREFIX_DIR} PATH_SUFFIXES lib ${PYTHON_LIBRARY_PREFIX})\n"
-  "      list(APPEND ${UPPER_PROJECT_NAME}_LIBRARIES \${\${_libraryname}_LIBRARY})\n"
+  "      if(${UPPER_PROJECT_NAME}_LIBRARY MATCHES "${UPPER_PROJECT_NAME}_LIBRARY-NOTFOUND")\n"
+  "        set(_fail TRUE)\n"
+  "        if(_out)\n"
+  "          message(\${_output_type} \"   Missing the ${CMAKE_PROJECT_NAME} \"\n"
+  "            \"library in \${PACKAGE_PREFIX_DIR}/lib.\")\n"
+  "        endif()\n"
+  "      else()\n"
+  "        list(APPEND ${UPPER_PROJECT_NAME}_LIBRARIES \${\${_librarynameUC}_LIBRARY})\n"
+  "      endif()\n"
   "    endforeach()\n"
   "  endif()\n"
   "\n"