transitively carry thrift dependencies forward

Summary: eden.thrift includes fb303_core.thrift, so any cmake target that depends on eden.thrift should pull in fb303_core.thrift's include directories and libraries. Implement that machinery in CppThriftLibrary.cmake.

Reviewed By: wez

Differential Revision: D16062657

fbshipit-source-id: d5d962960e767a138a9b634a12aebccf72d6ef43

--- build/fbcode_builder/CMake/ThriftCppLibrary.cmake
+++ build/fbcode_builder/CMake/ThriftCppLibrary.cmake
@@ -37,7 +37,13 @@
     DIRECTORY
   )

-  list(APPEND GEN_ARGS "include_prefix=${output_dir}")
+  # Generate relative paths in #includes
+  file(RELATIVE_PATH include_prefix ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${THRIFT_FILE})
+  get_filename_component(include_prefix ${include_prefix} DIRECTORY)
+
+  if (NOT "${include_prefix}" STREQUAL "")
+    list(APPEND GEN_ARGS "include_prefix=${include_prefix}")
+  endif()
   # CMake 3.12 is finally getting a list(JOIN) function, but until then
   # treating the list as a string and replacing the semicolons is good enough.
   string(REPLACE ";" "," GEN_ARG_STR "${GEN_ARGS}")
@@ -70,6 +76,24 @@
     )
   endforeach()

+  list(APPEND thrift_include_options -I ${CMAKE_SOURCE_DIR})
+  foreach(depends IN LISTS DEPENDS)
+    get_property(thrift_include_directory
+      TARGET ${depends}
+      PROPERTY THRIFT_INCLUDE_DIRECTORY)
+
+    if (thrift_include_directory STREQUAL "")
+      message(STATUS "No thrift dependency found for ${depends}")
+    else()
+      list(APPEND thrift_include_options -I
+        ${thrift_include_directory})
+    endif()
+  endforeach()
+
+  file(
+    GLOB_RECURSE THRIFT_TEMPLATE_FILES
+    FOLLOW_SYMLINKS ${FBTHRIFT_TEMPLATES_DIR}/*.mustache)
+
   # Emit the rule to run the thrift compiler
   add_custom_command(
     OUTPUT
@@ -82,7 +106,7 @@
       --strict
       --templates ${FBTHRIFT_TEMPLATES_DIR}
       --gen "mstch_cpp2:${GEN_ARG_STR}"
-      -I ${CMAKE_SOURCE_DIR}
+      ${thrift_include_options}
       -o ${output_dir}
       ${CMAKE_CURRENT_SOURCE_DIR}/${THRIFT_FILE}
     WORKING_DIRECTORY
@@ -97,16 +121,18 @@
   add_library(${LIB_NAME} STATIC
     ${generated_sources}
   )
-  set_property(
-    TARGET ${LIB_NAME}
-    PROPERTY PUBLIC_HEADER
-      ${generated_headers}
+
+  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
-      $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}>
-      $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
       ${FOLLY_INCLUDE_DIR}
       ${FBTHRIFT_INCLUDE_DIR}
   )
@@ -117,4 +143,15 @@
       FBThrift::thriftcpp2
       Folly::folly
   )
+
+  set_target_properties(
+    ${LIB_NAME}
+    PROPERTIES
+      EXPORT_PROPERTIES "THRIFT_INCLUDE_DIRECTORY"
+      THRIFT_INCLUDE_DIRECTORY ${CMAKE_SOURCE_DIR}
+  )
+
+  get_property(thrift_include_directory
+    TARGET ${LIB_NAME}
+    PROPERTY THRIFT_INCLUDE_DIRECTORY)
 endfunction()


COMP: the variable to be used for gdal includes is GDAL_INCLUDE_DIRS not GDAL_INCLUDE_DIR

--- CMake/otbIncludeDirectories.cmake
+++ CMake/otbIncludeDirectories.cmake
@@ -68,7 +68,7 @@
 ENDIF(OTB_USE_EXTERNAL_BOOST)

 SET(OTB_INCLUDE_DIRS_BUILD_TREE ${OTB_INCLUDE_DIRS_BUILD_TREE}
-    ${GDAL_INCLUDE_DIR} )
+    ${GDAL_INCLUDE_DIRS} )

 IF(WIN32)
   SET(OTB_INCLUDE_DIRS_BUILD_TREE ${OTB_INCLUDE_DIRS_BUILD_TREE}


rewrite openbabel cmake files to not (partially) ignore desired openbabel location can provide -DOPENBABEL_DIR to set

--- cmake/Modules/FindOpenBabel2.cmake
+++ cmake/Modules/FindOpenBabel2.cmake
@@ -1,97 +0,0 @@
-# - Try to find OpenBabel2
-# Once done this will define
-#
-#  OPENBABEL2_FOUND - system has OpenBabel2
-#  OPENBABEL2_INCLUDE_DIR - the OpenBabel2 include directory
-#  OPENBABEL2_LIBRARIES - Link these to use OpenBabel2
-#
-# Copyright (c) 2006, 2007 Carsten Niehaus, <cniehaus@gmx.de>
-# Copyright (C) 2008 Marcus D. Hanwell <marcus@cryos.org>
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-
-if (OPENBABEL2_INCLUDE_DIR AND OPENBABEL2_LIBRARIES AND OPENBABEL2_VERSION_MET)
-  # in cache already
-  set(OPENBABEL2_FOUND TRUE)
-
-else (OPENBABEL2_INCLUDE_DIR AND OPENBABEL2_LIBRARIES AND OPENBABEL2_VERSION_MET)
-  if(NOT WIN32)
-
-    # Use the newer PkgConfig stuff
-    find_package(PkgConfig REQUIRED)
-    pkg_check_modules(OPENBABEL2 openbabel-2.0>=2.2.0)
-
-    # Maintain backwards compatibility with previous version of module
-    if(OPENBABEL2_FOUND STREQUAL "1")
-      set(OPENBABEL2_VERSION_MET TRUE)
-      set(OPENBABEL2_INCLUDE_DIR ${OPENBABEL2_INCLUDE_DIRS})
-    endif(OPENBABEL2_FOUND STREQUAL "1")
-
-  else(NOT WIN32)
-    set(OPENBABEL2_VERSION_MET TRUE)
-  endif(NOT WIN32)
-
-  if(OPENBABEL2_VERSION_MET)
-
-    if(WIN32)
-      if(NOT OPENBABEL2_INCLUDE_DIR)
-        find_path(OPENBABEL2_INCLUDE_DIR openbabel-2.0/openbabel/obconversion.h
-          PATHS
-          ${_obIncDir}
-          ${GNUWIN32_DIR}/include
-          $ENV{OPENBABEL2_INCLUDE_DIR}
-        )
-        if(OPENBABEL2_INCLUDE_DIR)
-          set(OPENBABEL2_INCLUDE_DIR ${OPENBABEL2_INCLUDE_DIR}/openbabel-2.0)
-        endif(OPENBABEL2_INCLUDE_DIR)
-      endif(NOT OPENBABEL2_INCLUDE_DIR)
-    endif(WIN32)
-
-    find_library(OPENBABEL2_LIBRARIES NAMES openbabel openbabel-2
-      PATHS
-      ${_obLinkDir}
-      ${GNUWIN32_DIR}/lib
-      $ENV{OPENBABEL2_LIBRARIES}
-    )
-  endif(OPENBABEL2_VERSION_MET)
-
-  if(OPENBABEL2_INCLUDE_DIR AND OPENBABEL2_LIBRARIES AND OPENBABEL2_VERSION_MET)
-    set(OPENBABEL2_FOUND TRUE)
-  endif(OPENBABEL2_INCLUDE_DIR AND OPENBABEL2_LIBRARIES AND OPENBABEL2_VERSION_MET)
-
-  if (OPENBABEL2_FOUND)
-    if (NOT OpenBabel2_FIND_QUIETLY)
-      message(STATUS "Found OpenBabel 2.2 or later: ${OPENBABEL2_LIBRARIES}")
-    endif (NOT OpenBabel2_FIND_QUIETLY)
-  else (OPENBABEL2_FOUND)
-    if (OpenBabel2_FIND_REQUIRED)
-      message(FATAL_ERROR "Could NOT find OpenBabel 2.2 or later ")
-    endif (OpenBabel2_FIND_REQUIRED)
-  endif (OPENBABEL2_FOUND)
-
-  mark_as_advanced(OPENBABEL2_INCLUDE_DIR OPENBABEL2_LIBRARIES)
-
-endif (OPENBABEL2_INCLUDE_DIR AND OPENBABEL2_LIBRARIES AND OPENBABEL2_VERSION_MET)
-
-# Search for Open Babel2 executable
-if(OPENBABEL2_EXECUTABLE)
-
-  # in cache already
-  set(OPENBABEL2_EXECUTABLE_FOUND TRUE)
-
-else(OPENBABEL2_EXECUTABLE)
-  find_program(OPENBABEL2_EXECUTABLE NAMES babel
-    PATHS
-    [HKEY_CURRENT_USER\\SOFTWARE\\OpenBabel\ 2.2.0]
-    $ENV{OPENBABEL2_EXECUTABLE}
-  )
-
-  if(OPENBABEL2_EXECUTABLE)
-    set(OPENBABEL2_EXECUTABLE_FOUND TRUE)
-  endif(OPENBABEL2_EXECUTABLE)
-
-  if(OPENBABEL2_EXECUTABLE_FOUND)
-    message(STATUS "Found OpenBabel2 executable: ${OPENBABEL2_EXECUTABLE}")
-  endif(OPENBABEL2_EXECUTABLE_FOUND)
-
-endif(OPENBABEL2_EXECUTABLE)


Fix OpenCV v3.2.0-p2 archive hash

Fix OpenCV v3.2.0-p2 archive hash

See issue 'v3.2.0-p2 hash mismatch':
https://github.com/hunter-packages/opencv/issues/23

--- cmake/projects/OpenCV/hunter.cmake
+++ cmake/projects/OpenCV/hunter.cmake
@@ -97,7 +97,7 @@
     URL
     "https://github.com/hunter-packages/opencv/archive/v3.2.0-p2.tar.gz"
     SHA1
-    99219206c4fb9b5b6f60e03112746461baf6c9ab
+    ea8f612eea55dfa6d2f3669d5e9eb4240417444b
 )

 hunter_add_version(


[cmake] remove radium resources from applications cmd line install.

--- cmake/radium_setup_functions.cmake
+++ cmake/radium_setup_functions.cmake
@@ -73,15 +73,7 @@
             "
             )
     endif ()
-    # install Radium Resources if there is a dependency on Engine or Guibase
-    get_target_property(deps ${ARGS_NAME} INTERFACE_LINK_LIBRARIES)
-    list(FIND deps "Radium::Engine" depEngine)
-    list(FIND deps "Radium::GuiBase" depGuibase)
-    if (depEngine GREATER_EQUAL "0" OR depGuibase GREATER_EQUAL "0")
-        install(DIRECTORY ${RADIUM_RESOURCES_DIR} DESTINATION ${CMAKE_INSTALL_PREFIX})
-    else ()
-        message(STATUS " No Radium resource needed for ${ARGS_NAME}")
-    endif ()
+
     # Configure the application own resources installation
     if (ARGS_RESOURCES)
         foreach (resLocation ${ARGS_RESOURCES})


COMP: Remove un-necessary wrapping to remove Windows warnings

--- Wrapping/WrapITKTypes.cmake
+++ Wrapping/WrapITKTypes.cmake
@@ -70,7 +70,7 @@
 WRAP_TYPE("itk::Vector" "V" "itkVector.h")
   # dim 6 is used by ScaleSkewVersor3DTransform
   UNIQUE(vector_dims "1;${ITK_WRAP_VECTOR_COMPONENTS_INCREMENTED};6")
-  UNIQUE(vector_types "UC;F;D;UL;ULL;${WRAP_ITK_SCALAR}")
+  UNIQUE(vector_types "UC;F;D;${WRAP_ITK_SCALAR}")
   foreach(vector_dim ${vector_dims})
     foreach(t ${vector_types})
       ADD_TEMPLATE(


cmake on Debian needs a few extra hints not needed elsewhere.

--- _cmake/FindUnitTest++.cmake
+++ _cmake/FindUnitTest++.cmake
@@ -17,7 +17,7 @@
 endif()

 find_path(UNITTEST++_INCLUDE_DIR UnitTest++/UnitTest++.h
-    HINTS ${PC_UNITTEST++_INCLUDEDIR} ${PC_UNITTEST++_INCLUDE_DIRS} ${PC_HOMEBREW_INCLUDE_DIRS}
+    HINTS ${PC_UNITTEST++_INCLUDEDIR} ${PC_UNITTEST++_INCLUDE_DIRS} ${PC_HOMEBREW_INCLUDE_DIRS} /usr/include /usr/local/include
     PATH_SUFFIXES UnitTest++ )

 find_library(UNITTEST++_LIBRARY NAMES UnitTest++ libUnitTest++


support older cmake versions upto 2.8.12

--- be.iminds.iot.dianne.tensor.native/jni/cmake/FindTorch.cmake
+++ be.iminds.iot.dianne.tensor.native/jni/cmake/FindTorch.cmake
@@ -2,14 +2,14 @@
 #
 # Torch_FOUND -- set to 1 if found
 SET(Torch_FOUND 1)
-get_filename_component(TH_DIRECTORY "torch/torch7/lib/TH" REALPATH BASE_DIR ${CMAKE_CURRENT_LIST_DIR}/../)
+get_filename_component(TH_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/../torch/torch7/lib/TH" REALPATH)
 MESSAGE(STATUS "TH directory: ${TH_DIRECTORY}")
 set(THNN_INSTALL_LIB_SUBDIR ${CMAKE_CURRENT_SOURCE_DIR}/install)
 set(Torch_INSTALL_LIB ${TH_DIRECTORY}/build)
 INCLUDE_DIRECTORIES(${TH_DIRECTORY} ${TH_DIRECTORY}/build)

 IF(CUDA)
-    get_filename_component(THC_DIRECTORY "cutorch/cutorch/lib/THC" REALPATH BASE_DIR ${CMAKE_CURRENT_LIST_DIR}/../)
+    get_filename_component(THC_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/../cutorch/cutorch/lib/THC" REALPATH)
     MESSAGE(STATUS "THC directory: ${THC_DIRECTORY}")
     INCLUDE_DIRECTORIES(${THC_DIRECTORY}/.. ${THC_DIRECTORY} ${THC_DIRECTORY}/build)
 ENDIF(CUDA)


[CI] do not create another tag before submitting

The submission is now empty because there is a new tag

--- CI/machinery/CTestDriver.cmake
+++ CI/machinery/CTestDriver.cmake
@@ -169,7 +169,6 @@
 else()
   # note: if the submission process experiences some slow-down, then we
   # may get a return-code error, so we do it in a second phase.
-  ctest_start("${MODE}")
   ctest_submit(RETURN_VALUE SUBMIT_RETURN_VAL)

   if(NOT SUBMIT_RETURN_VAL EQUAL 0)


Oops forgot to commit it :(

Oops forgot to commit it :(

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


ENH: Deprecate Neuralnetwork module

ENH: Deprecate Neuralnetwork module

Explicitly specify that these methods are outdated.

Provide an explicit disclaimer that this historical set of features
is likely not appropriate for modern neural network implementations
due to performance issues.  The note is intended to assist with avoiding
confusion by users looking for modern machine learning approaches with
ITK.

--- Modules/Remote/NeuralNetworks.remote.cmake
+++ Modules/Remote/NeuralNetworks.remote.cmake
@@ -1,7 +1,21 @@
+if(NOT ITK_LEGACY_REMOVE)
+
 itk_fetch_module(NeuralNetworks
-"This remote module contains classes and support classes
+"This deprecated remote module contains classes and support classes
 for the calculation of artificial neural networks.
-This can be used, for instance, for image classification."
+
+This can be used, for instance, for image classification.
+
+This historical set of features is likely not appropriate for modern neural
+network implementations due to performance issues."
+
   GIT_REPOSITORY ${git_protocol}://github.com/InsightSoftwareConsortium/ITKNeuralNetworks.git
-  GIT_TAG 602d7d09a9234d6d90dff4052a83a0143043008b
+  GIT_TAG c293e56699d6d102dcde567baf1cf5b704819c17
   )
+
+  if(NOT ITK_LEGACY_SILENT)
+    message(WARNING "NeuralNetworks remote module is deprecated.
+    Development of this module has ended, and it will be removed
+    in future ITK versions.")
+  endif()
+endif()


rename Mathematica_JLink_LIBRARY to Mathematica_JLink_RUNTIME_LIBRARY

--- CMake/Mathematica/FindMathematica.cmake
+++ CMake/Mathematica/FindMathematica.cmake
@@ -1804,7 +1804,7 @@
 		set (CMAKE_FIND_LIBRARY_PREFIXES "")
 		set (CMAKE_FIND_LIBRARY_SUFFIXES ".dll")
 	endif()
-	find_library (Mathematica_JLink_LIBRARY
+	find_library (Mathematica_JLink_RUNTIME_LIBRARY
 		NAMES "JLinkNativeLibrary"
 		HINTS "${Mathematica_JLink_PACKAGE_DIR}/SystemFiles/Libraries"
 		PATHS ENV JLINK_LIB_DIR
@@ -2301,7 +2301,7 @@
 			message (STATUS "J/Link ${Mathematica_JLink_VERSION} found")
 			message (STATUS "J/Link package dir ${Mathematica_JLink_PACKAGE_DIR}")
 			message (STATUS "J/Link JAR file ${Mathematica_JLink_JAR_FILE}")
-			message (STATUS "J/Link native library ${Mathematica_JLink_LIBRARY}")
+			message (STATUS "J/Link native library ${Mathematica_JLink_RUNTIME_LIBRARY}")
 			message (STATUS "J/Link java launcher ${Mathematica_JLink_JAVA_EXECUTABLE}")
 		else()
 			message (STATUS "J/Link not found")
@@ -2459,7 +2459,7 @@
 			Mathematica_WSTP_LIBRARY)
 	elseif ("_${_var}" STREQUAL "_Mathematica_JLink_PACKAGE_DIR")
 		list (APPEND ${_outDependentVars}
-			Mathematica_JLink_VERSION Mathematica_JLink_LIBRARY)
+			Mathematica_JLink_VERSION Mathematica_JLink_RUNTIME_LIBRARY)
 	elseif ("_${_var}" STREQUAL "_Mathematica_MUnit_PACKAGE_FILE")
 		list (APPEND ${_outDependentVars}
 			Mathematica_MUnit_VERSION)
@@ -2539,7 +2539,7 @@
 		Mathematica_KERNEL_USERBASE_DIR
 		Mathematica_MUnit_PACKAGE_FILE
 		Mathematica_LibraryLink_PACKAGE_FILE
-		Mathematica_JLink_LIBRARY
+		Mathematica_JLink_RUNTIME_LIBRARY
 		Mathematica_JLink_JAVA_EXECUTABLE
 	)
 	_get_cache_variables(_CacheVariables)
@@ -4399,8 +4399,8 @@
 				list (APPEND _cmd "java")
 			endif()
 		endif()
-		if (Mathematica_JLink_LIBRARY)
-			get_filename_component(_jlinkLibraryDir ${Mathematica_JLink_LIBRARY} DIRECTORY)
+		if (Mathematica_JLink_RUNTIME_LIBRARY)
+			get_filename_component(_jlinkLibraryDir ${Mathematica_JLink_RUNTIME_LIBRARY} DIRECTORY)
 			_to_native_path ("${_jlinkLibraryDir}" _jlinkLibraryDirNative)
 			list (APPEND _cmd "-Dcom.wolfram.jlink.libdir=${_jlinkLibraryDirNative}")
 		endif()


Removed CMake script to find CppUnit

Removed CMake script to find CppUnit

It is now dead code since we moved to GTest.

--- cmake/Modules/FindCppUnit.cmake
+++ cmake/Modules/FindCppUnit.cmake
@@ -1,75 +0,0 @@
-# - try to find cppunit library
-#
-# Cache Variables: (probably not for direct use in your scripts)
-#  CPPUNIT_INCLUDE_DIR
-#  CPPUNIT_LIBRARY
-#
-# Non-cache variables you might use in your CMakeLists.txt:
-#  CPPUNIT_FOUND
-#  CPPUNIT_INCLUDE_DIRS
-#  CPPUNIT_LIBRARIES
-#
-# Requires these CMake modules:
-#  SelectLibraryConfigurations (included with CMake >= 2.8.0)
-#  FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
-#
-# Original Author:
-# 2009-2011 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
-# http://academic.cleardefinition.com
-# Iowa State University HCI Graduate Program/VRAC
-#
-# Copyright Iowa State University 2009-2011.
-# 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)
-
-set(CPPUNIT_ROOT_DIR
-    "${CPPUNIT_ROOT_DIR}"
-    CACHE
-    PATH
-    "Directory to search")
-
-find_library(CPPUNIT_LIBRARY_RELEASE
-    NAMES
-    cppunit
-    HINTS
-    "${CPPUNIT_ROOT_DIR}")
-
-find_library(CPPUNIT_LIBRARY_DEBUG
-    NAMES
-    cppunitd
-    HINTS
-    "${CPPUNIT_ROOT_DIR}")
-
-include(SelectLibraryConfigurations)
-select_library_configurations(CPPUNIT)
-
-# Might want to look close to the library first for the includes.
-get_filename_component(_libdir "${CPPUNIT_LIBRARY_RELEASE}" PATH)
-
-find_path(CPPUNIT_INCLUDE_DIR
-    NAMES
-    cppunit/TestCase.h
-    HINTS
-    "${_libdir}/.."
-    PATHS
-    "${CPPUNIT_ROOT_DIR}"
-    PATH_SUFFIXES
-    include/)
-
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(cppunit
-    DEFAULT_MSG
-    CPPUNIT_LIBRARY
-    CPPUNIT_INCLUDE_DIR)
-
-if(CPPUNIT_FOUND)
-    set(CPPUNIT_LIBRARIES ${CPPUNIT_LIBRARY} ${CMAKE_DL_LIBS})
-    set(CPPUNIT_INCLUDE_DIRS "${CPPUNIT_INCLUDE_DIR}")
-    mark_as_advanced(CPPUNIT_ROOT_DIR)
-endif()
-
-mark_as_advanced(CPPUNIT_INCLUDE_DIR
-    CPPUNIT_LIBRARY_RELEASE
-    CPPUNIT_LIBRARY_DEBUG)


RUNTIME_OUTPUT_DIRECTORY

--- cmake/MyPackageExecutable.cmake
+++ cmake/MyPackageExecutable.cmake
@@ -27,6 +27,8 @@
     IF (MYPACKAGE_DEBUG)
       MESSAGE (STATUS "[${PROJECT_NAME}-EXECUTABLE-DEBUG] Set runtime output directory of ${_name} to ${LIBRARY_OUTPUT_PATH}")
     ENDIF ()
+    SET_TARGET_PROPERTIES (${_name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH})
+
     IF (${_name} STREQUAL ${name})
       IF (TARGET ${PROJECT_NAME})
         IF (MYPACKAGE_DEBUG)


cmake armhf: set CPack architecture

cmake armhf: set CPack architecture

--- cmake/arm_linux_gnueabihf.cmake
+++ cmake/arm_linux_gnueabihf.cmake
@@ -1,5 +1,6 @@
 # this one is important
 SET(CMAKE_SYSTEM_NAME Linux)
+SET(CMAKE_SYSTEM_PROCESSOR armhf)

 # specify the cross compiler
 SET(CMAKE_C_COMPILER   /usr/bin/arm-linux-gnueabihf-gcc)
@@ -9,4 +10,7 @@
 set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
 set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
 set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
-set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)+set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
+
+# set the architecture for CPack (i.e packageing)
+set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE armhf)


[cmake] Enable zlib support for Apple stage2 builds

This allows llvm-profdata to interact with profiles containing
compressed name data.

rdar://problem/26122944

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@268947 91177308-0d34-0410-b5e6-96231b3b80d8
(cherry picked from commit 46a87674a95cad6a600ef896e9b929deb520873e)

--- cmake/caches/Apple-stage2.cmake
+++ cmake/caches/Apple-stage2.cmake
@@ -10,7 +10,7 @@
 set(CLANG_TOOL_SCAN_VIEW_BUILD OFF CACHE BOOL "")
 set(CLANG_LINKS_TO_CREATE clang++ cc c++ CACHE STRING "")
 set(CMAKE_MACOSX_RPATH ON CACHE BOOL "")
-set(LLVM_ENABLE_ZLIB OFF CACHE BOOL "")
+set(LLVM_ENABLE_ZLIB ON CACHE BOOL "")
 set(LLVM_ENABLE_BACKTRACES OFF CACHE BOOL "")
 set(LLVM_EXTERNALIZE_DEBUGINFO ON CACHE BOOL "")
 set(CLANG_PLUGIN_SUPPORT OFF CACHE BOOL "")


Enable looking glass and specify path to plugin

Tomviz will use the path specified in order to find the plugin
at runtime.

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

--- projects/tomviz.cmake
+++ projects/tomviz.cmake
@@ -23,6 +23,15 @@
     -DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=ON)
 endif()

+# Set the looking glass plugin path relative to the executable directory
+if (APPLE)
+  set(_tomviz_looking_glass_plugin_path "../Plugins/LookingGlass.so")
+elseif (UNIX)
+  set(_tomviz_looking_glass_plugin_path "../lib/paraview-5.9/plugins/LookingGlass/LookingGlass.so")
+else ()
+  set(_tomviz_looking_glass_plugin_path "paraview-5.9/plugins/LookingGlass/LookingGlass.dll")
+endif()
+
 add_external_project(tomviz
   DEPENDS paraview qt

@@ -34,6 +43,8 @@
     -DSKIP_PARAVIEW_ITK_PYTHON_CHECKS:BOOL=ON
     -DHoloPlayCore_INCLUDE_DIR:PATH=${HoloPlayCore_INCLUDE_DIR}
     -DHoloPlayCore_LIBRARY:PATH=${HoloPlayCore_LIBRARY}
+    -Dtomviz_ENABLE_LOOKING_GLASS:BOOL=ON
+    -Dtomviz_LOOKING_GLASS_PLUGIN_PATH:PATH=${_tomviz_looking_glass_plugin_path}

     ${tomviz_extra_cmake_args}


Adding linuxx8664 specific options

Adding linuxx8664 specific options

--- cmake/modules/ALICEMacros.cmake
+++ cmake/modules/ALICEMacros.cmake
@@ -212,6 +212,49 @@

 Endif(ALICE_TARGET STREQUAL macosx64)

+If(ALICE_TARGET STREQUAL linuxx8664gcc)
+
+
+  Set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -shared -Wl")
+
+  Set(CMAKE_Fortran_FLAGS "-fno-second-underscore -m64")
+
+  Set(CLIBDEFS "-DCERNLIB_LXIA64 -DCERNLIB_BLDLIB -DCERNLIB_CZ")
+
+  Set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -pipe -W -Wall -Weffc++ -Woverloaded-virtual -fmessage-length=0 -Wno-long-long -Dlinux -I/usr/X11R6/include")
+  Set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} -m64 -Wall -W -pipe")
+
+  If(CMAKE_Fortran_COMPILER MATCHES g95)
+    Set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fbounds-check -ftrace=full -DFORTRAN_G95")
+    Execute_process(COMMAND svn info $ENV{ALICE_ROOT}
+      COMMAND g95 --print-search-dirs
+      OUTPUT_VARIABLE _out)
+    String(REGEX REPLACE "^.*install: *([^\n]*)/\n.*$" "\\1" _libdir ${_out})
+    Set(ROOT_LIBRARIES "${ROOT_LIBRARIES} -L${_libdir} -lf95")
+  Else(CMAKE_Fortran_COMPILER MATCHES g95)
+    Set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -DFORTRAN_GFORTRAN")
+    Execute_process(
+      COMMAND gfortran -m64 -print-file-name=libgfortran.so
+      OUTPUT_VARIABLE FLIB
+      OUTPUT_STRIP_TRAILING_WHITESPACE)
+    Set(ROOT_LIBRARIES "${ROOT_LIBRARIES} ${FLIB}")
+    Execute_process(
+      COMMAND gfortran -m64 -print-file-name=libgfortranbegin.a
+      OUTPUT_VARIABLE FLIB
+      OUTPUT_STRIP_TRAILING_WHITESPACE)
+    Set(ROOT_LIBRARIES "${ROOT_LIBRARIES} ${FLIB}")
+  Endif(CMAKE_Fortran_COMPILER MATCHES g95)
+
+  Set(LINK_FLAGS "${LINK_FLAGS} -m64")
+
+  Set(ALIROOT_LIBRARIES "${ROOT_LIBRARIES}")
+
+  Set(ALIROOT_INCLUDE_DIR ${ROOT_INCLUDE_DIR} /usr/X11/include)
+
+  Set(LINK_FLAGS "${LINK_FLAGS}")
+
+Endif(ALICE_TARGET STREQUAL linuxx8664gcc)
+
 EndMacro (SetupSystem)

 # ../build/Makefile.alphacxx6


fixed compile errors when using old version of jsonrpcstub, fixed #1003

--- cmake/scripts/jsonrpcstub.cmake
+++ cmake/scripts/jsonrpcstub.cmake
@@ -27,10 +27,19 @@
 execute_process(
 	COMMAND ${ETH_JSON_RPC_STUB} ${ETH_SPEC_PATH}
 		--cpp-server=${ETH_SERVER_NAME} --cpp-server-file=${SERVER_TMPFILE}
-		--cpp-client=${ETH_CLIENT_NAME} --cpp-client-file=${CLIENT_TMPFILE}
+		--cpp-client=${ETH_CLIENT_NAME} --cpp-client-file=${CLIENT_TMPFILE}
+		OUTPUT_VARIABLE ERR ERROR_QUIET
 )

-include("${ETH_SOURCE_DIR}/cmake/EthUtils.cmake")
-replace_if_different("${SERVER_TMPFILE}" "${SERVER_OUTFILE}")
-replace_if_different("${CLIENT_TMPFILE}" "${CLIENT_OUTFILE}")
+# don't throw fatal error on jsonrpcstub error, someone might have old version of jsonrpcstub,
+# he does not need to upgrade it if he is not working on JSON RPC
+# show him warning instead
+if (ERR)
+	message(WARNING "Your version of jsonrcpstub tool is not supported. Please upgrade it.")
+	message(WARNING "${ERR}")
+else()
+	include("${ETH_SOURCE_DIR}/cmake/EthUtils.cmake")
+	replace_if_different("${SERVER_TMPFILE}" "${SERVER_OUTFILE}")
+	replace_if_different("${CLIENT_TMPFILE}" "${CLIENT_OUTFILE}")
+endif()


Update error message.

Update error message.

--- cmake_modules/FindXercesC.cmake
+++ cmake_modules/FindXercesC.cmake
@@ -4,7 +4,7 @@
 #  XERCESC_FOUND - system has Xerces-C
 #  XERCESC_INCLUDE - the Xerces-C include directory
 #  XERCESC_LIBRARY - Link these to use Xerces-C
-#
+#  XERCESC_VERSION - Xerces-C found version

 IF (XERCESC_INCLUDE AND XERCESC_LIBRARY)
    # in cache already
@@ -62,12 +62,11 @@
     MESSAGE(STATUS "       Version: ${XERCESC_VERSION}")
   ENDIF(NOT XERCESC_FIND_QUIETLY)
 ELSE(XERCESC_FOUND)
-  MESSAGE(FATAL_ERROR "Could not find Xerces-C !"
-	"   \nOnly 2.8.0, 3.0.1 and newer versions are supported"
-	"   \nor"
-	"   \nUse -DZORBA_NO_XMLSCHEMA for building without schema support.")
+  MESSAGE(FATAL_ERROR "Could not find Xerces-C !
+     Only 2.8.0, 3.0.1 and newer versions are supported
+     or
+     Use -D ZORBA_NO_XMLSCHEMA=ON option for building without XMLSchema
+       support.")
 ENDIF(XERCESC_FOUND)

-
-
 MARK_AS_ADVANCED(XERCESC_INCLUDE XERCESC_LIBRARY)


Only create check_core_uris and associated dependencies if there are any core URIs (to prevent creating this target in standalone module projects).  Approved: Juan Zacarias, Chris Hillery

--- cmake_modules/ZorbaModule.cmake
+++ cmake_modules/ZorbaModule.cmake
@@ -524,14 +524,20 @@
     # Targets and dependencies:
     #   ALL depends on check_uris; check_uris depends on check_core_uris;
     #   zorbacmd depends on check_core_uris.
-    ADD_CUSTOM_TARGET (check_core_uris
-      DEPENDS ${_core_output_files} VERBATIM)
     ADD_CUSTOM_TARGET (check_uris ALL
       DEPENDS ${_noncore_output_files} VERBATIM)
-    ADD_DEPENDENCIES(check_uris check_core_uris)
-    ADD_DEPENDENCIES(zorbacmd check_core_uris)
-    SET_TARGET_PROPERTIES(check_core_uris PROPERTIES FOLDER "Modules")
     SET_TARGET_PROPERTIES(check_uris PROPERTIES FOLDER "Modules")
+    # Only create check_core_uris target and associated dependencies if
+    # there are any core URIs; there should never be any when building a
+    # standalone module project.
+    LIST (LENGTH _core_output_files _num_core)
+    IF (_num_core GREATER 0)
+      ADD_CUSTOM_TARGET (check_core_uris
+        DEPENDS ${_core_output_files} VERBATIM)
+      ADD_DEPENDENCIES(check_uris check_core_uris)
+      ADD_DEPENDENCIES(zorbacmd check_core_uris)
+      SET_TARGET_PROPERTIES(check_core_uris PROPERTIES FOLDER "Modules")
+    ENDIF (_num_core GREATER 0)
     SET_PROPERTY (GLOBAL PROPERTY ZORBA_URI_FILES)

     #add 'xqdoc' and 'xqdoc-xml' targets


fficonfig: Add HAVE_AS_ASCII_PSEUDO_OP test

--- cmake/ConfigureChecks.cmake
+++ cmake/ConfigureChecks.cmake
@@ -1035,8 +1035,19 @@
 #     is VMS, where text files have record structure.

 # libffi specific: Check whether assembler supports .ascii.
-# TODO
-set(HAVE_AS_ASCII_PSEUDO_OP 1)
+set(check_src ${PROJECT_BINARY_DIR}/CMakeFiles/have_as_ascii_pseudo_op.c)
+file(WRITE ${check_src} "
+int main () {
+asm (\".ascii \\\"string\\\"\");
+return 0;
+}
+")
+python_platform_test(
+  HAVE_AS_ASCII_PSEUDO_OP
+  "Checking whether assembler supports .ascii"
+  ${check_src}
+  DIRECT
+  )

 # libffi specific: Check whether assembler supports .cfi_* directives
 set(check_src ${PROJECT_BINARY_DIR}/CMakeFiles/have_as_cfi_pseudo_op.c)


cmake/IPP: use absolute path

cmake/IPP: use absolute path

--- cmake/OpenCVFindIPPIW.cmake
+++ cmake/OpenCVFindIPPIW.cmake
@@ -136,7 +136,8 @@
   ippiw_setup("${OpenCV_SOURCE_DIR}/3rdparty/ippiw" 1)

   # Package sources
-  ippiw_setup("${IPPROOT}/../${IW_PACKAGE_SUBDIR}/" 1)
+  get_filename_component(__PATH "${IPPROOT}/../${IW_PACKAGE_SUBDIR}/" ABSOLUTE)
+  ippiw_setup("${_PATH}" 1)
 endif()


Added lintian overrides for package signature entry.

--- cmake/OpenCVPackaging.cmake
+++ cmake/OpenCVPackaging.cmake
@@ -289,6 +289,13 @@
     set(TESTS_LINTIAN_OVERRIDES "empty-binary-package") # there is no tests
 endif()

+set(ALL_COMPONENTS "libs" "dev" "docs" "python" "java" "samples" "tests")
+
+foreach (comp ${ALL_COMPONENTS})
+    string(TOUPPER ${comp} comp_upcase)
+    list(APPEND ${comp_upcase}_LINTIAN_OVERRIDES "misplaced-extra-member-in-deb") # for signed packages
+endforeach()
+
 if(CPACK_GENERATOR STREQUAL "DEB")
   find_program(GZIP_TOOL NAMES "gzip" PATHS "/bin" "/usr/bin" "/usr/local/bin")
   if(NOT GZIP_TOOL)
@@ -300,7 +307,6 @@
                   OUTPUT_STRIP_TRAILING_WHITESPACE)

   set(CHANGELOG_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}")
-  set(ALL_COMPONENTS "libs" "dev" "docs" "python" "java" "samples" "tests")
   foreach (comp ${ALL_COMPONENTS})
     string(TOUPPER "${comp}" comp_upcase)


More accurate deb package build fix for CUDA 6.5 and newer.

(cherry picked from commit b2790973a32eb662c165a921afe03dbfd2c65269)
(cherry picked from commit f8758da289c092fcce10baa4723d6388c4e41cb3)

--- cmake/OpenCVPackaging.cmake
+++ cmake/OpenCVPackaging.cmake
@@ -68,7 +68,7 @@

 if(HAVE_CUDA)
   string(REPLACE "." "-" cuda_version_suffix ${CUDA_VERSION})
-  if(${CUDA_VERSION} VERSION_LESS "6.5")
+  if(CUDA_VERSION VERSION_LESS "6.5")
     set(CPACK_DEB_libs_PACKAGE_DEPENDS "cuda-core-libs-${cuda_version_suffix}, cuda-extra-libs-${cuda_version_suffix}")
     set(CPACK_DEB_dev_PACKAGE_DEPENDS "cuda-headers-${cuda_version_suffix}")
   else()
@@ -83,8 +83,8 @@
       set(CPACK_DEB_dev_PACKAGE_DEPENDS "${CPACK_DEB_dev_PACKAGE_DEPENDS}, cuda-cublas-dev-${cuda_version_suffix}")
     endif()
   endif()
+
   set(CPACK_COMPONENT_dev_DEPENDS libs)
-
 endif()

 if(NOT OPENCV_CUSTOM_PACKAGE_INFO)


PVConfigProject.cmake adds /usr/local/cudnn to APPLE_CUDNN_PATH_HINT

--- cmake/PVConfigProject.cmake
+++ cmake/PVConfigProject.cmake
@@ -39,7 +39,7 @@
   set(CUDA_DEBUG_FLAGS "${CUDA_BASE_FLAGS};-Xptxas;-v;-keep;-lineinfo;-g;-G")

   # CUDNN path hints
-  set(APPLE_CUDNN_PATH_HINT "/usr/local/cudnn-7.0")
+  set(APPLE_CUDNN_PATH_HINT "/usr/local/cudnn-7.0" "/usr/local/cudnn")
   set(LINUX_CUDNN_PATH_HINT "/nh/compneuro/Data/cuDNN/cudnn-7.0-linux-x64-v4/" "/cuDNN/cudnn-7.0-linux-x64-v4" "/usr/local/cudnn")

   # Help strings


Revert MKLDNN ver to 0.14 (#1477)

Revert MKLDNN ver to 0.14 (#1477)

* revert MKLDNN ver to 0.14

* reinstate dep

--- cmake/external_mkldnn.cmake
+++ cmake/external_mkldnn.cmake
@@ -43,19 +43,19 @@

 # This section sets up MKL as an external project to be used later by MKLDNN

-set(MKLURLROOT "https://github.com/intel/mkl-dnn/releases/download/v0.16/")
-set(MKLVERSION "2019.0.20180710")
+set(MKLURLROOT "https://github.com/intel/mkl-dnn/releases/download/v0.14/")
+set(MKLVERSION "2018.0.3.20180406")
 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
     set(MKLPACKAGE "mklml_lnx_${MKLVERSION}.tgz")
-    set(MKL_SHA1_HASH e7c34105d486908b87b4b8c667c3a089f079ca51)
+    set(MKL_SHA1_HASH aea0d9ce65773cfcf5d8292b8db553bde965fc8f)
     set(MKL_LIBS libiomp5.so libmklml_intel.so)
 elseif (APPLE)
     set(MKLPACKAGE "mklml_mac_${MKLVERSION}.tgz")
-    set(MKL_SHA1_HASH c873d2bd36a0100344d1aac1b1e56c8c3a43a845)
+    set(MKL_SHA1_HASH d76083fd5a79767a96572ad0e23e7f4c892818f2)
     set(MKL_LIBS libmklml.dylib libiomp5.dylib)
 elseif (WIN32)
     set(MKLPACKAGE "mklml_win_${MKLVERSION}.zip")
-    set(MKL_SHA1_HASH 3767d9a1ad679d647b8c6edf1f97c767881d0c5c)
+    set(MKL_SHA1_HASH d607ca92d7bfc101f0828c0b005098b75531669b)
     set(MKL_LIBS mklml.dll libiomp5md.dll)
 endif()
 set(MKLURL ${MKLURLROOT}${MKLPACKAGE})
@@ -82,7 +82,7 @@
 endforeach()

 set(MKLDNN_GIT_REPO_URL https://github.com/intel/mkl-dnn)
-set(MKLDNN_GIT_TAG "4e33378")
+set(MKLDNN_GIT_TAG "0e7ca73")

 # The 'BUILD_BYPRODUCTS' argument was introduced in CMake 3.2.
 if(${CMAKE_VERSION} VERSION_LESS 3.2)
@@ -135,7 +135,6 @@
         CMAKE_ARGS
             -DWITH_TEST=FALSE
             -DWITH_EXAMPLE=FALSE
-            -DMKLDNN_ENABLE_CONCURRENT_EXEC=TRUE
             -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
             -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
             -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}


[cmake] Fix incorrect default for LIT_COMMAND, from r283029

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

--- cmake/modules/AddLLVM.cmake
+++ cmake/modules/AddLLVM.cmake
@@ -1084,7 +1084,7 @@
     list(APPEND LIT_ARGS --param build_mode=${CMAKE_CFG_INTDIR})
   endif ()
   if (EXISTS ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py)
-    set (LIT_COMMAND "${PYTHON_EXECUTABLE} ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py"
+    set (LIT_COMMAND "${PYTHON_EXECUTABLE};${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py"
          CACHE STRING "Command used to spawn llvm-lit")
   else()
     find_program(LIT_COMMAND NAMES llvm-lit lit.py lit)


[CMake] llvm_update_compile_flags: Honor LLVM_COMPILE_FLAGS.

I accidentally mis-dropped LLVM_COMPILE_FLAGS in r200301. Sorry for that.

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

--- cmake/modules/AddLLVM.cmake
+++ cmake/modules/AddLLVM.cmake
@@ -12,21 +12,26 @@
     set(LLVM_REQUIRES_RTTI ON)
   else()
     if(LLVM_COMPILER_IS_GCC_COMPATIBLE)
-      set(target_compile_flags "${target_compile_flags} -fno-exceptions")
+      list(APPEND LLVM_COMPILE_FLAGS "-fno-exceptions")
     elseif(MSVC)
       list(APPEND LLVM_COMPILE_DEFINITIONS _HAS_EXCEPTIONS=0)
-      set(target_compile_flags "${target_compile_flags} /EHs-c-")
+      list(APPEND LLVM_COMPILE_FLAGS "/EHs-c-")
     endif()
   endif()

   if(NOT LLVM_REQUIRES_RTTI)
     list(APPEND LLVM_COMPILE_DEFINITIONS GTEST_HAS_RTTI=0)
     if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
-      set(target_compile_flags "${target_compile_flags} -fno-rtti")
+      list(APPEND LLVM_COMPILE_FLAGS "-fno-rtti")
     elseif (MSVC)
-      set(target_compile_flags "${target_compile_flags} /GR-")
+      list(APPEND LLVM_COMPILE_FLAGS "/GR-")
     endif ()
   endif()
+
+  # Assume that;
+  #   - LLVM_COMPILE_FLAGS is list.
+  #   - PROPERTY COMPILE_FLAGS is string.
+  string(REPLACE ";" " " target_compile_flags "${LLVM_COMPILE_FLAGS}")

   if(update_src_props)
     foreach(fn ${sources})
@@ -399,7 +404,7 @@
   endif ()

   if (SUPPORTS_NO_VARIADIC_MACROS_FLAG)
-    set(LLVM_COMPILE_FLAGS "-Wno-variadic-macros")
+    list(APPEND LLVM_COMPILE_FLAGS "-Wno-variadic-macros")
   endif ()

   set(LLVM_REQUIRES_RTTI OFF)


* On linux where filesystem is case sensitive vulkan sdk installations seem to use 'bin' instead of 'Bin' now. windows should make no difference

--- cmake/shader_compiler.cmake
+++ cmake/shader_compiler.cmake
@@ -2,7 +2,7 @@

 macro(add_shader_vulkan)
 	# example: C:\VulkanSDK\1.2.170.0\Bin\glslc.exe
-	set(VK_BIN_DIR $ENV{VULKAN_SDK}/Bin)
+	set(VK_BIN_DIR $ENV{VULKAN_SDK}/bin)
 	set(VK_GLSLC_EXECUTABLE_PATH ${VK_BIN_DIR}/glslc)

 	set(shader_path ${PROJECT_SOURCE_DIR}/${SHADER})


Upgraded FindJNI.cmake to detect broken Java header symlinks on Apple.

--- cmake_modules/FindJNI.cmake
+++ cmake_modules/FindJNI.cmake
@@ -233,6 +233,20 @@
   ${JAVA_INCLUDE_PATH}
 )

+IF (APPLE)
+  # On Mac, the java headers files are broken symlinks if the Apple Developer Tools for Java are not installed
+  EXECUTE_PROCESS(COMMAND cat ${JAVA_INCLUDE_PATH}/jni.h
+                  OUTPUT_QUIET
+                  ERROR_QUIET
+                  RESULT_VARIABLE SYMLINK_CHECK_RESULT_VARIABLE)
+  IF (SYMLINK_CHECK_RESULT_VARIABLE GREATER 0)
+    SET (JAVA_INCLUDE_PATH "JAVA_INCLUDE_PATH-NOTFOUND")
+    SET (JAVA_INCLUDE_PATH2 "JAVA_INCLUDE_PATH2-NOTFOUND")
+    SET (JAVA_AWT_INCLUDE_PATH "JAVA_AWT_INCLUDE_PATH-NOTFOUND")
+  ENDIF()
+ENDIF (APPLE)
+
+
 #INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake")
 #FIND_PACKAGE_HANDLE_STANDARD_ARGS(JNI  DEFAULT_MSG  JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY
 #                                                    JAVA_INCLUDE_PATH  JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)


Enable Cpp11 Compiler flag

Enable Cpp11 Compiler flag

--- cmake/CompileOptions.cmake
+++ cmake/CompileOptions.cmake
@@ -72,6 +72,8 @@
 #

 set(DEFAULT_COMPILE_OPTIONS)
+set(CMAKE_CXX_STANDARD 11) # C++11...
+set(CMAKE_CXX_STANDARD_REQUIRED ON)

 # MSVC compiler options
 if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")


Test release flags.

Test release flags.

--- cmake/CompilerConfig.cmake
+++ cmake/CompilerConfig.cmake
@@ -9,7 +9,7 @@

 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
 set(EXTRA_CXX_FLAGS "-Werror -Wall -Wpedantic -Wextra")
-set(CMAKE_CXX_FLAGS_RELEASE "-Ofast -flto -O3 -DRELEASE -DNDEBUG")
+# set(CMAKE_CXX_FLAGS_RELEASE "-Ofast -flto -O3 -DRELEASE -DNDEBUG")
 #set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE} "-ggdb -fno-omit-frame-pointer")

 add_definitions("-D__FAVOR_BSD") #Not working correctly?


cmake/LinuxPackaging.cmake: use non-dev packages to .deb dep list

When `libiio` is to be installed it doesn't necessarily need the
development versions of these libs.
These libs are statically defined though.

Signed-off-by: Alexandru Ardelean <685557f6b7c225d86b536740313ed51b24843a58@analog.com>

--- cmake/LinuxPackaging.cmake
+++ cmake/LinuxPackaging.cmake
@@ -100,7 +100,7 @@
 		${CPACK_DEBIAN_PACKAGE_DEPENDS})
 else()
 	# assume everything is turned on, and running on a modern OS
-	set(CPACK_DEBIAN_PACKAGE_DEPENDS "libaio-dev (>= 0.3.109), libavahi-client-dev (>= 0.6.31), libavahi-common-dev (>= 0.6.31), libc6-dev (>= 2.19), libusb-1.0-0-dev (>= 2:1.0.17), libxml2-dev (>= 2.9.1)")
+	set(CPACK_DEBIAN_PACKAGE_DEPENDS "libaio (>= 0.3.109), libavahi-client (>= 0.6.31), libavahi-common (>= 0.6.31), libc6 (>= 2.19), libusb-1.0-0 (>= 2:1.0.17), libxml2 (>= 2.9.1)")
 	message(STATUS "Using default dependencies for packaging")
 endif()


Do add a compile definition if already present

--- cmake/MyPackageStart.cmake
+++ cmake/MyPackageStart.cmake
@@ -88,9 +88,19 @@
   SET (CMAKE_POSITION_INDEPENDENT_CODE ON)
   if (("${CMAKE_C_COMPILER_ID} x" MATCHES "MSVC") OR MSVC)
     # Loosely based on http://www.hdfgroup.org/ftp/HDF/HDF_Current/src/unpacked/config/cmake/ConfigureChecks.cmake
-    ADD_DEFINITIONS(-DWIN32_LEAN_AND_MEAN)
-    ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
-    ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_DEPRECATE)
+    FOREACH (_definition "WIN32_LEAN_AND_MEAN" "_CRT_SECURE_NO_WARNINGS" "_CRT_NONSTDC_NO_DEPRECATE")
+      LIST (FIND COMPILE_DEFINITIONS ${_definition} _index)
+      IF (${_index} GREATER -1)
+        IF (MYPACKAGE_DEBUG)
+          MESSAGE (STATUS "[${PROJECT_NAME}-START-STATUS] Compile definition ${_definition} already set")
+        ENDIF ()
+      ELSE ()
+        IF (MYPACKAGE_DEBUG)
+          MESSAGE (STATUS "[${PROJECT_NAME}-START-STATUS] Adding compile definition ${_definition}")
+        ENDIF ()
+      ENDIF ()
+      ADD_DEFINITIONS("-D${_definition}")
+    ENDIF ()
   ENDIF ()
   #
   # Prepare output directories


Enable using hipcc as the CXX compiler

Enable using hipcc as the CXX compiler

If we're using HIP-Clang to compile, we can allow the hipcc as CXX compiler.

--- cmake/VerifyCompiler.cmake
+++ cmake/VerifyCompiler.cmake
@@ -30,8 +30,8 @@
         message(WARNING "On CUDA platform 'g++' is recommended C++ compiler.")
     endif()
 elseif(HIP_PLATFORM STREQUAL "hcc")
-    if(NOT (CMAKE_CXX_COMPILER MATCHES ".*/hcc$"))
-        message(FATAL_ERROR "On ROCm platform 'hcc' must be used as C++ compiler.")
+    if(NOT (CMAKE_CXX_COMPILER MATCHES ".*/hcc$" OR CMAKE_CXX_COMPILER MATCHES ".*/hipcc$"))
+        message(FATAL_ERROR "On ROCm platform 'hcc' or 'clang' must be used as C++ compiler.")
     else()
         # Workaround until hcc & hip cmake modules fixes symlink logic in their config files.
         # (Thanks to rocBLAS devs for finding workaround for this problem.)
@@ -42,5 +42,5 @@
         find_package(hip REQUIRED CONFIG PATHS /opt/rocm)
     endif()
 else()
-    message(FATAL_ERROR "HIP_PLATFORM must be 'hcc' (AMD ROCm platform) or `nvcc` (NVIDIA CUDA platform).")
+    message(FATAL_ERROR "HIP_PLATFORM must be 'hcc' or 'clang' (AMD ROCm platform) or `nvcc` (NVIDIA CUDA platform).")
 endif()


[CMake] Fix configuration on PowerPC with sanitizers

TEST_BIG_ENDIAN() performs compile tests that will fail with
-nodefaultlibs when building under LLVM_USE_SANITIZER.

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

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

--- cmake/base-config-ix.cmake
+++ cmake/base-config-ix.cmake
@@ -148,7 +148,13 @@
         endif()
       endif()
     elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "powerpc")
+      # Strip out -nodefaultlibs when calling TEST_BIG_ENDIAN. Configuration
+      # will fail with this option when building with a sanitizer.
+      cmake_push_check_state()
+      string(REPLACE "-nodefaultlibs" "" CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
       TEST_BIG_ENDIAN(HOST_IS_BIG_ENDIAN)
+      cmake_pop_check_state()
+
       if(HOST_IS_BIG_ENDIAN)
         test_target_arch(powerpc64 "" "-m64")
       else()


"fix build cares" (#6097)

"fix build cares" (#6097)

--- cmake/external/cares.cmake
+++ cmake/external/cares.cmake
@@ -33,7 +33,7 @@
     UPDATE_COMMAND  ""
     CONFIGURE_COMMAND ./buildconf && ./configure --disable-shared --prefix=${CARES_INSTALL_DIR}
     BUILD_IN_SOURCE 1
-    BUILD_COMMAND   make
+    BUILD_COMMAND   make -j8
     INSTALL_COMMAND make install
 )


update: bump sysdig to 0.27.0

update: bump sysdig to 0.27.0

Signed-off-by: Lorenzo Fontana <0189fb5ac8a393aa741cf57f29cfe3228fcad081@gmail.com>

--- cmake/modules/sysdig.cmake
+++ cmake/modules/sysdig.cmake
@@ -26,8 +26,8 @@
 # To update sysdig version for the next release, change the default below
 # In case you want to test against another sysdig version just pass the variable - ie., `cmake -DSYSDIG_VERSION=dev ..`
 if(NOT SYSDIG_VERSION)
-  set(SYSDIG_VERSION "85c88952b018fdbce2464222c3303229f5bfcfad")
-  set(SYSDIG_CHECKSUM "SHA256=6c3f5f2d699c9540e281f50cbc5cb6b580f0fc689798bc65d4a77f57f932a71c")
+  set(SYSDIG_VERSION "113c22c4693fac5cc2db1b115c2f1ee0b6b701b7")
+  set(SYSDIG_CHECKSUM "SHA256=48fb9ec586ec217d8509e4d20a94e911a9679c78ddc23877d07c6dda26ff34db")
 endif()
 set(PROBE_VERSION "${SYSDIG_VERSION}")


[C++] Fix code coverage targets

[C++] Fix code coverage targets

--- cpp/CMake/code-coverage/CodeCoverage.cmake
+++ cpp/CMake/code-coverage/CodeCoverage.cmake
@@ -14,6 +14,7 @@
 # Copyright (C) 2017 BMW Car IT GmbH

 # Check prereqs
+FIND_PACKAGE( PythonInterp )
 FIND_PROGRAM( GCOV_PATH gcov )
 FIND_PROGRAM( LCOV_PATH lcov )
 FIND_PROGRAM( GENHTML_PATH genhtml )
@@ -62,11 +63,11 @@
 		COMMAND ${_testrunner}

 		# Capturing lcov counters and generating report
-		COMMAND ${LCOV_PATH} --directory . --capture --output-file ${_outputname}.info
+		COMMAND ${LCOV_PATH} --directory ${CMAKE_BINARY_DIR} --capture --output-file ${_outputname}.info
 		COMMAND ${LCOV_PATH} --remove ${_outputname}.info 'libs/*' '${CMAKE_SOURCE_DIR}/tests/*' '/usr/*' 'ThirdParty/*' --output-file ${_outputname}.info.cleaned
 		COMMAND ${GENHTML_PATH} -o ${_outputname} ${_outputname}.info.cleaned
 		COMMAND ${CMAKE_COMMAND} -E remove ${_outputname}.info ${_outputname}.info.cleaned
-                COMMAND ${TAR_PATH} -cjf joynr-cpp-coverage.bz2 ${CMAKE_BINARY_DIR}/coverage
+		COMMAND ${TAR_PATH} -cjf joynr-cpp-coverage.bz2 ${CMAKE_BINARY_DIR}/coverage

 		DEPENDS ${_testrunner}
 		WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
@@ -101,8 +102,7 @@
 		${_testrunner} ${_arguments}

 		# Running gcovr
-		#COMMAND ${GCOVR_PATH} -x -r ${CMAKE_SOURCE_DIR} -o ${_outputname}.xml
-		COMMAND ${GCOVR_PATH} -x -r ${CMAKE_SOURCE_DIR} -o ${_outputname}.xml -e ${_gcovrExclude}
+		COMMAND ${GCOVR_PATH} -x -j 4 -r ${CMAKE_SOURCE_DIR} -o ${_outputname}.xml -e ${_gcovrExclude} ${CMAKE_BINARY_DIR}
 		WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
 		COMMENT "Running gcovr to produce Cobertura code coverage report."
 	)


[C++] Adapted cmake configuration for leak check

* Disabled inlining of code because of conflicts with
  multiple definitions of pthread functions
* Added special setting for boost to avoid conflicts

Change-Id: I66a5d005da9985f25d443f51c41a243c55076d78

--- cpp/CMake/Sanitizers.cmake
+++ cpp/CMake/Sanitizers.cmake
@@ -4,7 +4,7 @@
     if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND ${ARGC} GREATER 3)
         SET(BLACKLIST_FLAG " -fsanitize-blacklist=${CMAKE_CURRENT_LIST_DIR}/sanitizer-blacklist/${ARGV3}")
     endif()
-    set(COMPILER_FLAGS "-O${OPTIMIZER_LEVEL} -g -fsanitize=${SANITIZER} -fno-omit-frame-pointer -fno-optimize-sibling-calls${BLACKLIST_FLAG}")
+    set(COMPILER_FLAGS "-O${OPTIMIZER_LEVEL} -g -fsanitize=${SANITIZER} -DBOOST_ASIO_HAS_STD_CHRONO -fno-inline -fno-omit-frame-pointer -fno-optimize-sibling-calls${BLACKLIST_FLAG}")
     set(CMAKE_C_FLAGS_${CONFIG_NAME} ${COMPILER_FLAGS}
         CACHE STRING "C compiler flags when building for ${CONFIG_NAME}"
     )
@@ -32,6 +32,10 @@
 # see https://github.com/google/sanitizers/wiki/AddressSanitizer for more information.
 AddSanitizerConfig(ASAN address 1)

+# LeakSanitizer (LSan) is a memory leak detector for C/C++.
+# see https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer for more information.
+AddSanitizerConfig(LSAN leak 1)
+
 # ThreadSanitizer (TSan) is a data race detector for C/C++.
 # see https://github.com/google/sanitizers/wiki/ThreadSanitizerCppManual for more information.
 AddSanitizerConfig(TSAN thread 1 tsan.txt)


Disable CPACK_INCLUDE_TOPLEVEL_DIRECTORY

--- cmake/CPackConfig.cmake
+++ cmake/CPackConfig.cmake
@@ -64,6 +64,7 @@
 set(CPACK_DEBIAN_RUNTIME_PACKAGE_RECOMMENDS "librl-examples (= ${PROJECT_VERSION})")
 set(CPACK_DEBIAN_RUNTIME_PACKAGE_SECTION "libs")
 set(CPACK_DEBIAN_RUNTIME_PACKAGE_SHLIBDEPS ON)
+set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
 set(CPACK_NSIS_DISPLAY_NAME ${CPACK_PACKAGE_NAME})
 set(CPACK_NSIS_EXECUTABLES_DIRECTORY ${CMAKE_INSTALL_BINDIR})
 set(CPACK_NSIS_HELP_LINK "https://www.roboticslibrary.org/contact")


FindFASTJET with ROOT 6+ specific options

--- cmake/FindFASTJET.cmake
+++ cmake/FindFASTJET.cmake
@@ -29,6 +29,7 @@
 # - FASTJET_DEFINITIONS - fastjet definition flags
 # - FASTJET_CXXFLAGS - fastjet compilation flags
 # - FASTJET_LIBS - fastjet libraries (list)
+# - FASTJET_ROOTDICT_OPTS - fastjet options to generate ROOT 6+ dictionaries

 set(FASTJET_FOUND FALSE)

@@ -55,7 +56,7 @@
         message(FATAL_ERROR "Error retrieving FastJet version: ${error}")
     endif(error)

-    # Extract major, minor, and patch versions from
+    # Extract major, minor, and patch versions
     string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" FASTJET_VERSION_MAJOR "${FASTJET_VERSION}")
     string(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+.*" "\\1" FASTJET_VERSION_MINOR "${FASTJET_VERSION}")
     string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" FASTJET_VERSION_PATCH "${FASTJET_VERSION}")
@@ -63,7 +64,7 @@
     if(FASTJET_VERSION_MAJOR LESS 3)
         message(FATAL_ERROR "FastJet ${FASTJET_VERSION_MAJOR}.${FASTJET_VERSION_MINOR}.${FASTJET_VERSION_PATCH} not suported: install at least >= 3.0.*")
     endif()
-
+
     # Extracting compilation flags
     execute_process(COMMAND ${FASTJET_CONFIG} --cxxflags OUTPUT_VARIABLE FASTJET_CXXFLAGS ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE)
     if(error)
@@ -82,7 +83,10 @@
     endif(FASTJET_CXXFLAGS)

     # Extracting libraries and linking options
-    execute_process(COMMAND ${FASTJET_CONFIG} --libs OUTPUT_VARIABLE FASTJET_CONFIGLIBS ERROR_VARIABLE error OUTPUT_STRIP_TRAILING_WHITESPACE)
+    execute_process(COMMAND ${FASTJET_CONFIG} --libs
+                    OUTPUT_VARIABLE FASTJET_CONFIGLIBS
+                    ERROR_VARIABLE error
+                    OUTPUT_STRIP_TRAILING_WHITESPACE)
     if(error)
         message(FATAL_ERROR "Error retrieving FastJet libs: ${error}")
     endif(error)
@@ -119,8 +123,9 @@
                     message(FATAL_ERROR "CGAL not installed: install it or specify a custom one with -DCGAL")
                 endif()
             endif(CGAL)
+            list(APPEND fjextralibs "CGAL")
         else()
-            message(WARNING "FastJet was compiled witouth CGAL")
+            message(STATUS "FastJet was compiled witouth CGAL")
         endif(fastjetcgal GREATER -1)

         # GMP for FastJet
@@ -142,8 +147,9 @@
                     message(FATAL_ERROR "GMP not installed: install it or specify a custom one with -DGMP")
                 endif()
             endif(GMP)
+            list(APPEND fjextralibs "GMP")
         else()
-            message(WARNING "FastJet was compiled witouth GMP")
+            message(STATUS "FastJet was compiled witouth GMP")
         endif(fastjetgmp GREATER -1)

         # MPFR for FastJet
@@ -165,8 +171,9 @@
                     message(FATAL_ERROR "MPFR not installed: install it or specify a custom one with -DMPFR")
                 endif()
             endif(MPFR)
+            list(APPEND fjextralibs "MPFR")
         else()
-            message(WARNING "FastJet was compiled witouth MPFR")
+            message(STATUS "FastJet was compiled witouth MPFR")
         endif(fastjetmpfr GREATER -1)

         # Extract library paths used by FastJet to find needed libs: (LIST)
@@ -177,10 +184,31 @@
             list(APPEND FASTJET_LIBS_DIR ${fjlibdir})
         endforeach()

+        # Check if required FJ and FJContrib libs can be found
+        set(fjlibs "fastjetcontribfragile;fastjetplugins;siscone_spherical;siscone;fastjettools;fastjet")
+        foreach(fjlib ${fjlibs})
+            set(fjl fjl-NOTFOUND)
+            find_library(fjl NAMES ${fjlib}
+                             PATHS ${FASTJET_LIBS_DIR} NO_DEFAULT_PATH)
+            if(NOT fjl)
+                message(FATAL_ERROR "Required FastJet library ${fjlib} not found!")
+            endif()
+        endforeach()
+
     endif(FASTJET_CONFIGLIBS)

     set(FASTJET_FOUND TRUE)
     set(FASTJET_DEFINITIONS "-DHAVE_FASTJET")
+
+    # ROOT 6+: additional options required for dictionary generation.
+    if(ROOT_VERSION_MAJOR GREATER 5)
+        set(FASTJET_ROOTDICT_OPTS "-I${FASTJET_INCLUDE_DIR}")
+        foreach(fjl ${fjlibs};${fjextralibs})
+            set(FASTJET_ROOTDICT_OPTS "${FASTJET_ROOTDICT_OPTS} -rml ${fjl}")
+        endforeach()
+    endif(ROOT_VERSION_MAJOR GREATER 5)
+
+    message(STATUS "FastJet options for ROOT dictionary generation: ${FASTJET_ROOTDICT_OPTS}")
     message(STATUS "FastJet ${FASTJET_VERSION_MAJOR}.${FASTJET_VERSION_MINOR}.${FASTJET_VERSION_PATCH} installation found: ${FASTJET}")
 else()
     message(STATUS "FastJet not found: disabling dependencies")


install lib files as well on windows

install lib files as well on windows

--- cmake/InstallFAST.cmake
+++ cmake/InstallFAST.cmake
@@ -22,6 +22,10 @@
 	file(GLOB DLLs ${PROJECT_BINARY_DIR}/bin/*.dll)
 	install(FILES ${DLLs}
 		DESTINATION fast/bin
+	)
+	file(GLOB DLLs ${PROJECT_BINARY_DIR}/lib/*.lib)
+	install(FILES ${DLLs}
+		DESTINATION fast/lib
 	)
 elseif(APPLE)
 	file(GLOB SOs ${PROJECT_BINARY_DIR}/lib/*.dylib)


Fixed problem with incorrect detection of some compiler flags

--- cmake/OpenCVUtils.cmake
+++ cmake/OpenCVUtils.cmake
@@ -50,10 +50,10 @@
 MACRO(ocv_check_compiler_flag LANG FLAG RESULT)
   if("_${LANG}_" MATCHES "_CXX_")
     set(_fname "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx")
-    FILE(WRITE "${_fname}" "int main() { return 0;}\n")
+    FILE(WRITE "${_fname}" "#pragma\nint main() { return 0; }\n")
   elseif("_${LANG}_" MATCHES "_C_")
     set(_fname "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c")
-    FILE(WRITE "${_fname}" "int main(void) { return 0;}\n")
+    FILE(WRITE "${_fname}" "#pragma\nint main(void) { return 0; }\n")
   else()
     unset(_fname)
   endif()
@@ -64,7 +64,7 @@
       "${_fname}"
       COMPILE_DEFINITIONS "${FLAG}"
       OUTPUT_VARIABLE OUTPUT)
-
+
     FOREACH(_regex ${OCV_COMPILER_FAIL_REGEX})
       IF("${OUTPUT}" MATCHES "${_regex}")
         SET(${RESULT} 0)


Update cmake get version extraction module to x.x.x format

Taken from the extopts library.

--- cmake/git-version.cmake
+++ cmake/git-version.cmake
@@ -1,53 +1,76 @@
 ### Version control policy
 ###
-### Extract current version from version control if present.  If
-### source is not under source control - take from .version
-### file. Otherwise current version is 0.0
+### Extract current version from version control if present. If source
+### tree is not under source control - take version string from
+### .version file. Otherwise current version is v0.0.0. Both vX.X.X
+### and v.X.X formats are supported.

-function (git_version_extract)
-  ### Extract version string
+macro (git_version_extract NAME)
+  ### Extract current version from version control if present.
+  ### If not - take from .version file
   if (EXISTS "${CMAKE_SOURCE_DIR}/.git")
     execute_process (COMMAND git describe
+      WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
       OUTPUT_VARIABLE GIT_TAG_VERSION)
-    if (GIT_TAG_VERSION)
-      file (WRITE .version "${GIT_TAG_VERSION}")
-    endif ()
+    file (WRITE .version "${GIT_TAG_VERSION}")
   else ()
     if (EXISTS "${CMAKE_SOURCE_DIR}/.version")
       execute_process (COMMAND cat .version
+	WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
 	OUTPUT_VARIABLE GIT_TAG_VERSION)
     endif ()
   endif ()

   ### Parse version
-  if (NOT GIT_TAG_VERSION)
+  execute_process (COMMAND echo "${GIT_TAG_VERSION}"
+    COMMAND grep -E "^v[0-9][0-9]*\\.[0-9][0-9]*(-.*)?$"
+    OUTPUT_STRIP_TRAILING_WHITESPACE
+    OUTPUT_VARIABLE VERSION_TYPE_2)
+  execute_process (COMMAND echo "${GIT_TAG_VERSION}"
+    COMMAND grep -E "^v[0-9][0-9]*\\.[0-9][0-9]*\\.[0-9][0-9]*(-.*)?$"
+    OUTPUT_STRIP_TRAILING_WHITESPACE
+    OUTPUT_VARIABLE VERSION_TYPE_3)
+
+  if ("${GIT_TAG_VERSION}" STREQUAL "")
     message (WARNING "No version information was found! "
       "Package should be built from correct source tree.")
-    set (EMBOX_VERSION_MAJOR 0)
-    set (EMBOX_VERSION_MINOR 0)
-    set (EMBOX_VERSION "0.0")
-    set (EMBOX_VERSION_FULL "unknown")
+    set (${NAME}_VERSION_MAJOR 0)
+    set (${NAME}_VERSION_MINOR 0)
+    set (${NAME}_VERSION_PATCH 0)
+    set (${NAME}_VERSION "0.0.0")
+    set (${NAME}_VERSION_FULL "unknown")
   else ()
     execute_process (COMMAND echo "${GIT_TAG_VERSION}"
       COMMAND sed -ne "s/^v\\([[:digit:]]*\\)\\..*/\\1/p"
-      OUTPUT_VARIABLE EMBOX_VERSION_MAJOR
+      OUTPUT_VARIABLE ${NAME}_VERSION_MAJOR
       OUTPUT_STRIP_TRAILING_WHITESPACE)
     execute_process (COMMAND echo "${GIT_TAG_VERSION}"
       COMMAND sed -ne "s/^v[[:digit:]]*\\.\\([[:digit:]]*\\).*/\\1/p"
-      OUTPUT_VARIABLE EMBOX_VERSION_MINOR
+      OUTPUT_VARIABLE ${NAME}_VERSION_MINOR
       OUTPUT_STRIP_TRAILING_WHITESPACE)
+    if (VERSION_TYPE_3)
+      execute_process (COMMAND echo "${GIT_TAG_VERSION}"
+	COMMAND sed -ne "s/^v[[:digit:]]*\\.[[:digit:]]*\\.\\([[:digit:]]*\\).*/\\1/p"
+	OUTPUT_VARIABLE ${NAME}_VERSION_PATCH
+	OUTPUT_STRIP_TRAILING_WHITESPACE)
+    endif ()
     execute_process (COMMAND echo "${GIT_TAG_VERSION}"
-      COMMAND sed -ne "s/.*-\\(.*\\)/\\1/p"
-      OUTPUT_VARIABLE EMBOX_VERSION_DIRT
+      COMMAND sed -ne "s/[^-]*-\\(.*\\)/\\1/p"
+      OUTPUT_VARIABLE ${NAME}_VERSION_DIRT
       OUTPUT_STRIP_TRAILING_WHITESPACE)
-
-    set (EMBOX_VERSION "${EMBOX_VERSION_MAJOR}.${EMBOX_VERSION_MINOR}")
-    if (EMBOX_VERSION_DIRT)
-      set (EMBOX_VERSION_FULL "${EMBOX_VERSION}-${EMBOX_VERSION_DIRT}")
+
+    if (VERSION_TYPE_3)
+      set (${NAME}_VERSION "${${NAME}_VERSION_MAJOR}.${${NAME}_VERSION_MINOR}.${${NAME}_VERSION_PATCH}")
     else ()
-      set (EMBOX_VERSION_FULL "${EMBOX_VERSION}")
+      set (${NAME}_VERSION "${${NAME}_VERSION_MAJOR}.${${NAME}_VERSION_MINOR}")
     endif ()
-
-    message (STATUS "Building version: ${EMBOX_VERSION_FULL}")
+
+    if (${NAME}_VERSION_DIRT STREQUAL "")
+      set (${NAME}_VERSION_FULL "${${NAME}_VERSION}")
+    else ()
+      set (${NAME}_VERSION_FULL "${${NAME}_VERSION}-${${NAME}_VERSION_DIRT}")
+    endif ()
   endif ()
-endfunction (git_version_extract)
+
+  message (STATUS "Building version: ${EMBOX_VERSION_FULL}")
+endmacro (git_version_extract)


Fix: PCL_MAKE_PKGCONFIG used PARSE_ARGV, which requires at minimum CMake 3.7

--- cmake/pcl_targets.cmake
+++ cmake/pcl_targets.cmake
@@ -436,7 +436,7 @@
   set(options HEADER_ONLY)
   set(oneValueArgs COMPONENT DESC CFLAGS LIB_FLAGS)
   set(multiValueArgs PCL_DEPS INT_DEPS EXT_DEPS)
-  cmake_parse_arguments(PARSE_ARGV 1 PKGCONFIG "${options}" "${oneValueArgs}" "${multiValueArgs}")
+  cmake_parse_arguments(PKGCONFIG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

   set(PKG_NAME ${_name})
   set(PKG_DESC ${PKGCONFIG_DESC})