Have TestCMake use cmake argument parser

--- scripts/TestCMake.cmake
+++ scripts/TestCMake.cmake
@@ -1,24 +1,8 @@
-function(_args_have_option outvar optionname arglist)
-  list(FIND ${arglist} "${optionname}" HASOPTION)
-  if(HASOPTION EQUAL -1)
-    set(${outvar} False PARENT_SCOPE)
-  else()
-    set(${outvar} True PARENT_SCOPE)
-    list(REMOVE_ITEM ${arglist} ${optionname})
-    set(${arglist} ${${arglist}} PARENT_SCOPE)
-  endif()
-endfunction(_args_have_option)
+include(CMakeParseArguments)

 function(cmake_test testname)

-  # Parse further arguments
-  # Let caller create a source file
-  set(ALL_OPTIONS ${ARGN})
-  _args_have_option(SOURCE "SOURCE" ALL_OPTIONS)
-  # Let caller create executable to run
-  # Should be used with test-command
-  _args_have_option(NOEXEC "NOEXEC" ALL_OPTIONS)
-
+  cmake_parse_arguments(CMAKETEST "SOURCE;NOEXEC" "" "" ${ARGN} )
   # set source and build dir.
   set(FAKE_PROJECT_DIR ${CMAKE_CURRENT_BINARY_DIR}/${testname})
   set(BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/fake_project_builds/${testname})
@@ -27,15 +11,15 @@
                  ${FAKE_PROJECT_DIR}/CMakeData.cmake @ONLY)
   message(STATUS "[${testname}] project in ${FAKE_PROJECT_DIR}")

-  if(NOT SOURCE)
+  if(NOT CMAKETEST_SOURCE)
     file(WRITE ${FAKE_PROJECT_DIR}/main.c "int main() { return 0; }" )
-  endif(NOT SOURCE)
+  endif()
   file(WRITE ${FAKE_PROJECT_DIR}/CMakeLists.txt
        "cmake_minimum_required(VERSION 2.8.3 FATAL_ERROR)\n"
        "project(allfeatures)\n"
        "include(\"${FAKE_PROJECT_DIR}/CMakeData.cmake\")\n"
        "enable_language(C)\n"
-       "if(NOT ${NOEXEC})\n"
+       "if(NOT ${CMAKETEST_NOEXEC})\n"
        "  file(GLOB ALLFILES \${PROJECT_SOURCE_DIR}/*.c \${PROJECT_SOURCE_DIR}/*.cc)\n"
        "  add_executable(${testname} \${ALLFILES})\n"
        "endif(NOT ${NOEXEC})\n")
@@ -53,6 +37,6 @@
                                     --build-makeprogram ${CMAKE_MAKE_PROGRAM}
                                     --build-project ${testname}
                                     --build-options -Dcookoff_path=${CMAKE_SOURCE_DIR}
-                                    ${ALL_OPTIONS})
+                                    ${CMAKETEST_UNPARSED_ARGUMENTS})

 endfunction(cmake_test)


fix required vars of PythonExtra on Windows

--- python_cmake_module/cmake/Modules/FindPythonExtra.cmake
+++ python_cmake_module/cmake/Modules/FindPythonExtra.cmake
@@ -221,11 +221,14 @@
 endif()

 include(FindPackageHandleStandardArgs)
+set(_required_vars
+  PythonExtra_EXTENSION_EXTENSION
+  PythonExtra_INCLUDE_DIRS
+  PythonExtra_LIBRARIES)
+if(NOT WIN32)
+  list(APPEND _required_vars PythonExtra_EXTENSION_SUFFIX)
+endif()
 find_package_handle_standard_args(PythonExtra
   FOUND_VAR PythonExtra_FOUND
-  REQUIRED_VARS
-    PythonExtra_EXTENSION_EXTENSION
-    PythonExtra_EXTENSION_SUFFIX
-    PythonExtra_INCLUDE_DIRS
-    PythonExtra_LIBRARIES
+  REQUIRED_VARS ${_required_vars}
 )


ARROW-1169: [C++] jemalloc externalproject doesn't build with CMake's ninja generator

Closes #796

Change-Id: I3cbd06d774feca254183e0ed1b0e75111f7cb389

--- cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -407,16 +407,16 @@
         URL https://github.com/jemalloc/jemalloc/releases/download/${JEMALLOC_VERSION}/jemalloc-${JEMALLOC_VERSION}.tar.bz2
         CONFIGURE_COMMAND ./configure "--prefix=${JEMALLOC_PREFIX}" "--with-jemalloc-prefix="
         BUILD_IN_SOURCE 1
-        BUILD_COMMAND ${CMAKE_MAKE_PROGRAM}
+        BUILD_COMMAND ${MAKE}
         BUILD_BYPRODUCTS "${JEMALLOC_STATIC_LIB}" "${JEMALLOC_SHARED_LIB}"
-        INSTALL_COMMAND ${CMAKE_MAKE_PROGRAM} -j1 install)
+        INSTALL_COMMAND ${MAKE} -j1 install)
     else()
       ExternalProject_Add(jemalloc_ep
         URL https://github.com/jemalloc/jemalloc/releases/download/${JEMALLOC_VERSION}/jemalloc-${JEMALLOC_VERSION}.tar.bz2
         CONFIGURE_COMMAND ./configure "--prefix=${JEMALLOC_PREFIX}" "--with-jemalloc-prefix="
         BUILD_IN_SOURCE 1
-        BUILD_COMMAND ${CMAKE_MAKE_PROGRAM}
-        INSTALL_COMMAND ${CMAKE_MAKE_PROGRAM} -j1 install)
+        BUILD_COMMAND ${MAKE}
+        INSTALL_COMMAND ${MAKE} -j1 install)
     endif()
   else()
     set(JEMALLOC_VENDORED 0)


Fix JSONCPP_LIBRARY name

Fix JSONCPP_LIBRARY name

Nowadays it seem to be "jsoncpp"

--- src/cmake/Modules/FindJsonCpp.cmake
+++ src/cmake/Modules/FindJsonCpp.cmake
@@ -11,7 +11,7 @@

 # Find the library
 find_library(JSONCPP_LIBRARY
-    NAMES json libjson
+    NAMES jsoncpp json libjson
     HINTS ${PC_JSONCPP_LIBDIR} ${PC_JSONCPP_LIBRARY_DIRS} )
 set(JSONCPP_LIBRARIES ${JSONCPP_LIBRARY} )


Remove LLVMFuzzer from list of bundled libraries for Fuchsia

As of now, libFuzzer is located in compiler-rt and is bundled with
Clang's toolchain by default.

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

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

--- cmake/caches/Fuchsia-stage2.cmake
+++ cmake/caches/Fuchsia-stage2.cmake
@@ -87,7 +87,6 @@
   lld
   lldb
   liblldb
-  LLVMFuzzer
   LTO
   clang-format
   clang-headers


compiler: clang: Add setting of ARM related flags

Mimic what we have in cmake/compiler/gcc/target.cmake for clang
targetting ARM.  Match gcc behavior by setting -fshort-enums

Signed-off-by: Kumar Gala <a5e5248af4cd4f0ed8c515f61d40a6e2db46a66e@linaro.org>

--- cmake/compiler/clang/target.cmake
+++ cmake/compiler/clang/target.cmake
@@ -19,6 +19,18 @@
 find_program(CMAKE_CXX_COMPILER clang++ ${find_program_clang_args})

 if(NOT "${ARCH}" STREQUAL "posix")
+  include(${ZEPHYR_BASE}/cmake/gcc-m-cpu.cmake)
+
+  if("${ARCH}" STREQUAL "arm")
+    list(APPEND TOOLCHAIN_C_FLAGS
+      -fshort-enums
+      )
+    list(APPEND TOOLCHAIN_LD_FLAGS
+      -fshort-enums
+      )
+
+    include(${ZEPHYR_BASE}/cmake/compiler/gcc/target_arm.cmake)
+  endif()

   foreach(file_name include/stddef.h include-fixed/limits.h)
     execute_process(


Add path for llvm-3.6-tools

Add path for llvm-3.6-tools

This is the version that is installable on Ubuntu 14.04

--- cmake/modules/FindFileCheck.cmake
+++ cmake/modules/FindFileCheck.cmake
@@ -6,7 +6,7 @@

 find_program(FILECHECK_EXECUTABLE
              NAMES FileCheck
-             PATHS /usr/local/opt/llvm/bin /usr/lib/llvm-3.7/bin
+             PATHS /usr/local/opt/llvm/bin /usr/lib/llvm-3.6/bin /usr/lib/llvm-3.7/bin
              DOC "Path to 'FileCheck' executable")

 # Handle REQUIRED and QUIET arguments, this will also set FILECHECK_FOUND to true


[lldb][CMake] Build LLDB.framework with -Wdocumentation in Xcode

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

--- cmake/modules/LLDBFramework.cmake
+++ cmake/modules/LLDBFramework.cmake
@@ -43,6 +43,9 @@
   set_target_properties(liblldb PROPERTIES
     XCODE_ATTRIBUTE_MACOSX_DEPLOYMENT_TARGET "${MACOSX_DEPLOYMENT_TARGET}")
 endif()
+
+# Add -Wdocumentation parameter
+set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_DOCUMENTATION_COMMENTS "YES")

 # Apart from this one, CMake creates all required symlinks in the framework bundle.
 add_custom_command(TARGET liblldb POST_BUILD


Parcial fix for ROOT-8764 - Missing implicit header dependencies in ROOT dictionaries

--- cmake/modules/RootNewMacros.cmake
+++ cmake/modules/RootNewMacros.cmake
@@ -375,11 +375,16 @@
     set(excludepathsargs ${excludepathsargs} -excludePath ${excludepath})
   endforeach()

+  #---build the implicit dependencies arguments
+  foreach(_dep ${_linkdef} ${_list_of_header_dependencies})
+    list(APPEND _implicitdeps CXX ${_dep})
+  endforeach()
+
   #---call rootcint------------------------------------------
   add_custom_command(OUTPUT ${dictionary}.cxx ${pcm_name} ${rootmap_name}
                      COMMAND ${command} -f  ${dictionary}.cxx ${newargs} ${excludepathsargs} ${rootmapargs}
                                         ${ARG_OPTIONS} ${definitions} ${includedirs} ${headerfiles} ${_linkdef}
-                     IMPLICIT_DEPENDS CXX ${_linkdef} ${_list_of_header_dependencies}
+                     IMPLICIT_DEPENDS ${_implicitdeps}
                      DEPENDS ${_list_of_header_dependencies} ${_linkdef} ${ROOTCINTDEP})
   get_filename_component(dictname ${dictionary} NAME)


Fixes RelWithDebInfo build issue on windows for OV-EP (#7471)

Signed-off-by: MaajidKhan <c6b54bb1da2ed38335accd20ff17d695144938c9@gmail.com>


qibuild/compat : going the easy way

qibuild/compat : going the easy way

--- cmake/qibuild/compat/compat.cmake
+++ cmake/qibuild/compat/compat.cmake
@@ -440,7 +440,10 @@
 endfunction()

 function(add_python_test _name _pythonFile)
- add_test(${_name}  ${PYTHON_EXCUTABLE} ${_pythonFile} ${ARGN})
+  qi_deprecated("add_python_test is deprecated.
+  High-level tests now are to be found in the
+  qi/qitest repository
+  ")
 endfunction()

 #copy file with dependency (if the file change in source => update the output)


build: fix a condition inversion in git-based versioning

--- firmware/cmake/detect_version.cmake
+++ firmware/cmake/detect_version.cmake
@@ -18,13 +18,16 @@
 	execute_process(
 		COMMAND git describe --dirty
 		WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
-		RESULT_VARIABLE GIT_VERSION_FOUND
+		RESULT_VARIABLE GIT_VERSION_NOT_FOUND
 		ERROR_QUIET
 		OUTPUT_VARIABLE GIT_VERSION
 		OUTPUT_STRIP_TRAILING_WHITESPACE
 	)

-	if(GIT_VERSION_FOUND)
+	if(GIT_VERSION_NOT_FOUND)
+		message(WARNING "couldn't determine version (${GIT_VERSION_FOUND})")
+		set(VERSION_STRING "unknown-version")
+	else()
 		set(VERSION "${GIT_VERSION}")
 		set(VERSION_STRING "git-${GIT_VERSION}")
 	endif()


Sort build options in alphabetical order

--- cmake/modules/RootBuildOptions.cmake
+++ cmake/modules/RootBuildOptions.cmake
@@ -73,12 +73,13 @@

 ROOT_BUILD_OPTION(afdsmgrd OFF "Dataset manager for PROOF-based analysis facilities")
 ROOT_BUILD_OPTION(alien OFF "AliEn support, requires libgapiUI from ALICE")
+ROOT_BUILD_OPTION(arrow OFF "Apache Arrow in memory columnar storage support")
 ROOT_BUILD_OPTION(asimage ON "Image processing support, requires libAfterImage")
-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")
 ROOT_BUILD_OPTION(builtin_cfitsio OFF "Build the FITSIO library internally (downloading tarfile from the Web)")
+ROOT_BUILD_OPTION(builtin_clang ON "Build clang internally")
 ROOT_BUILD_OPTION(builtin_davix OFF "Build the Davix library internally (downloading tarfile from the Web)")
 ROOT_BUILD_OPTION(builtin_fftw3 OFF "Build the FFTW3 library internally (downloading tarfile from the Web)")
 ROOT_BUILD_OPTION(builtin_freetype OFF "Build included libfreetype, or use system libfreetype")
@@ -87,9 +88,8 @@
 ROOT_BUILD_OPTION(builtin_glew ON "Build included libGLEW, or use system libGLEW")
 ROOT_BUILD_OPTION(builtin_gsl OFF "Build the GSL library internally (downloading tarfile from the Web)")
 ROOT_BUILD_OPTION(builtin_llvm ON "Build llvm internally")
-ROOT_BUILD_OPTION(builtin_clang ON "Build clang internally")
+ROOT_BUILD_OPTION(builtin_lz4 OFF "Built included liblz4, or use system liblz4")
 ROOT_BUILD_OPTION(builtin_lzma OFF "Build included liblzma, or use system liblzma")
-ROOT_BUILD_OPTION(builtin_lz4 OFF "Built included liblz4, or use system liblz4")
 ROOT_BUILD_OPTION(builtin_openssl OFF "Build OpenSSL internally, or use system OpenSSL")
 ROOT_BUILD_OPTION(builtin_pcre OFF "Build included libpcre, or use system libpcre")
 ROOT_BUILD_OPTION(builtin_tbb OFF "Build the TBB internally")
@@ -106,6 +106,7 @@
 ROOT_BUILD_OPTION(clad ON "Enable clad, the cling automatic differentiation plugin.")
 ROOT_BUILD_OPTION(cling ON "Enable new CLING C++ interpreter")
 ROOT_BUILD_OPTION(cocoa OFF "Use native Cocoa/Quartz graphics backend (MacOS X only)")
+ROOT_BUILD_OPTION(coverage OFF "Test coverage")
 ROOT_BUILD_OPTION(cuda OFF "Use CUDA if it is found in the system")
 ROOT_BUILD_OPTION(cxx11 ON "Build using C++11 compatible mode, requires gcc > 4.7.x or clang")
 ROOT_BUILD_OPTION(cxx14 OFF "Build using C++14 compatible mode, requires gcc > 4.9.x or clang")
@@ -144,11 +145,11 @@
 ROOT_BUILD_OPTION(oracle ON "Oracle support, requires libocci")
 ROOT_BUILD_OPTION(pch ON)
 ROOT_BUILD_OPTION(pgsql ON "PostgreSQL support, requires libpq")
+ROOT_BUILD_OPTION(pyroot_experimental OFF "Use experimental Python bindings for ROOT")
+ROOT_BUILD_OPTION(pythia6_nolink OFF "Delayed linking of Pythia6 library")
 ROOT_BUILD_OPTION(pythia6 ON "Pythia6 EG support, requires libPythia6")
-ROOT_BUILD_OPTION(pythia6_nolink OFF "Delayed linking of Pythia6 library")
 ROOT_BUILD_OPTION(pythia8 ON "Pythia8 EG support, requires libPythia8")
 ROOT_BUILD_OPTION(python ON "Python ROOT bindings, requires python >= 2.2")
-ROOT_BUILD_OPTION(pyroot_experimental OFF "Use experimental Python bindings for ROOT")
 ROOT_BUILD_OPTION(qt OFF "Qt4 graphics backend, requires Qt4 >= 4.8")
 ROOT_BUILD_OPTION(qtgsi OFF "GSI's Qt4 integration, requires Qt4 >= 4.8")
 ROOT_BUILD_OPTION(qt5web OFF "Qt5 web-based display, requires Qt5")
@@ -181,16 +182,15 @@
 ROOT_BUILD_OPTION(xft ON "Xft support (X11 antialiased fonts)")
 ROOT_BUILD_OPTION(xml ON "XML parser interface")
 ROOT_BUILD_OPTION(xrootd ON "Build xrootd file server and its client (if supported)")
-ROOT_BUILD_OPTION(coverage OFF "Test coverage")
-
+
+option(all "Enable all optional components" OFF)
+option(clingtest "Include cling tests. NOTE that this makes llvm/clang symbols visible in libCling." OFF)
 option(fail-on-missing "Fail the configure step if a required external package is missing" OFF)
+option(gminimal "Do not automatically search for support libraries, but include X11" OFF)
 option(minimal "Do not automatically search for support libraries" OFF)
-option(gminimal "Do not automatically search for support libraries, but include X11" OFF)
-option(all "Enable all optional components" OFF)
+option(rootbench "Include rootbench, if rootbench exists in root or if it is a sibling directory." OFF)
+option(roottest "Include roottest, if roottest exists in root or if it is a sibling directory." OFF)
 option(testing "Enable testing with CTest" OFF)
-option(roottest "Include roottest, if roottest exists in root or if it is a sibling directory." OFF)
-option(rootbench "Include rootbench, if rootbench exists in root or if it is a sibling directory." OFF)
-option(clingtest "Include cling tests. NOTE that this makes llvm/clang symbols visible in libCling." OFF)

 set(gcctoolchain "" CACHE PATH "Path for the gcctoolchain in case not the system gcc is used to build clang/LLVM")


disable root7 on Windows for the time being (it compiles but gives errors when running)

--- cmake/modules/RootBuildOptions.cmake
+++ cmake/modules/RootBuildOptions.cmake
@@ -189,7 +189,7 @@
   set(davix_defvalue OFF)
   set(cxx11_defvalue OFF)
   set(cxx14_defvalue ON)
-  set(root7_defvalue ON)
+  set(root7_defvalue OFF)
   set(imt_defvalue OFF)
   set(builtin_tbb_defvalue OFF)
   set(tmva_defvalue OFF)


Declare AMENT_TEST_RESULTS_DIR as a PATH (#221)

Signed-off-by: Dan Rose <2591e5f46f28d303f9dc027d475a5c60d8dea17a@digilabs.io>

--- ament_cmake_test/ament_cmake_test-extras.cmake
+++ ament_cmake_test/ament_cmake_test-extras.cmake
@@ -21,7 +21,7 @@
 # option()
 set(
   AMENT_TEST_RESULTS_DIR "${CMAKE_BINARY_DIR}/test_results"
-  CACHE STRING "The path where test results are generated"
+  CACHE PATH "The path where test results are generated"
 )

 if(BUILD_TESTING)


Use full path to the OS X SDK

Use full path to the OS X SDK

--- standard/StandardProject.cmake
+++ standard/StandardProject.cmake
@@ -114,7 +114,7 @@
         set(_developer_sdk_version 10.12)
       endif()
       if(_developer_sdk_version)
-        set(CMAKE_OSX_SYSROOT "macosx${_developer_sdk_version}" CACHE STRING "Mac OS X build environment" FORCE)
+        set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_developer_sdk_version}.sdk" CACHE STRING "Mac OS X build environment" FORCE)
         if(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
           set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "Mac OS X deployment target" FORCE)
         endif()


Use wx-config for non-mingw.

Use wx-config for non-mingw.

--- cmake-scripts/Findwxwidgets3.cmake
+++ cmake-scripts/Findwxwidgets3.cmake
@@ -1,43 +1,59 @@
-
-SET(WXWIDGETS_SEARCH_PATHS
-    /usr/local/
-    /usr
-    /opt
-)
-
-FIND_PATH(WXWIDGETS_INCLUDE_DIR wx/wx.h
-    HINTS ${WXWIDGETS_ROOT}
-    PATH_SUFFIXES include include/wx-3.0
-    PATHS ${WXWIDGETS_SEARCH_PATHS}
-)
-
-FIND_PATH(WXWIDGETS_SETUP_PATH wx/setup.h
-    HINTS ${WXWIDGETS_ROOT}
-    PATH_SUFFIXES
-        lib/wx/include/msw-unicode-static-3.0/
-        lib/wx/include/msw-unicode-dynamic-3.0/
-    PATHS ${WXWIDGETS_SEARCH_PATHS}
-)

 IF(MINGW)
+    SET(WXWIDGETS_SEARCH_PATHS
+        /usr/local/
+        /usr
+        /opt
+    )
+
+    FIND_PATH(WXWIDGETS_INCLUDE_DIR wx/wx.h
+        HINTS ${WXWIDGETS_ROOT}
+        PATH_SUFFIXES include include/wx-3.0
+        PATHS ${WXWIDGETS_SEARCH_PATHS}
+    )
+
+    FIND_PATH(WXWIDGETS_SETUP_PATH wx/setup.h
+        HINTS ${WXWIDGETS_ROOT}
+        PATH_SUFFIXES
+            lib/wx/include/msw-unicode-static-3.0/
+            lib/wx/include/msw-unicode-dynamic-3.0/
+        PATHS ${WXWIDGETS_SEARCH_PATHS}
+    )
+
     SET(SEARCH_LIBS wx_mswu_html-3.0 wx_mswu_adv-3.0 wx_mswu_aui-3.0 wx_mswu_core-3.0 wx_baseu-3.0 wxjpeg-3.0 wxpng-3.0 wxzlib-3.0 )
+
+    FOREACH(SLIB ${SEARCH_LIBS})
+    FIND_LIBRARY(FOUND_${SLIB}_LIB ${SLIB} HINTS ${WXWIDGETS_ROOT} PATH_SUFFIXES lib64 lib bin PATHS ${WXWIDGETS_SEARCH_PATHS} )
+    SET(WXWIDGETS_LIBRARY ${WXWIDGETS_LIBRARY} ${FOUND_${SLIB}_LIB})
+    ENDFOREACH(SLIB)
+
+    SET(WXWIDGETS_INCLUDE_DIR ${WXWIDGETS_INCLUDE_DIR} ${WXWIDGETS_SETUP_PATH})
 ELSE(MINGW)
-    SET(SEARCH_LIBS wx_baseu-3.0)
+    FIND_PROGRAM(WX_CONFIG
+        wx-config3.0 | wx-config2.9
+        PATHS
+            /usr/bin
+            /usr/local/bin
+    )
+
+    EXECUTE_PROCESS(
+        COMMAND WX_CONFIG "--cflags"
+        OUTPUT_VARIABLE WXWIDGETS_INCLUDE_DIR
+    )
+
+    EXECUTE_PROCESS(
+        COMMAND WX_CONFIG "--libs"
+        OUTPUT_VARIABLE WXWIDGETS_LIBRARY
+    )
 ENDIF(MINGW)

-FOREACH(SLIB ${SEARCH_LIBS})
-    FIND_LIBRARY(FOUND_${SLIB}_LIB ${SLIB} HINTS ${WXWIDGETS_ROOT} PATH_SUFFIXES lib64 lib bin PATHS ${WXWIDGETS_SEARCH_PATHS} )
-    SET(WXWIDGETS_LIBRARY ${WXWIDGETS_LIBRARY} ${FOUND_${SLIB}_LIB})
-ENDFOREACH(SLIB)

 IF(WXWIDGETS_INCLUDE_DIR AND WXWIDGETS_LIBRARY)
     SET(WXWIDGETS_FOUND TRUE)
 ENDIF (WXWIDGETS_INCLUDE_DIR AND WXWIDGETS_LIBRARY)

-SET(WXWIDGETS_INCLUDE_DIR ${WXWIDGETS_INCLUDE_DIR} ${WXWIDGETS_SETUP_PATH})
-
 IF(WXWIDGETS_FOUND)
-    MESSAGE(STATUS "Found wxWidgets 3.0: ${WXWIDGETS_LIBRARY} with setup.h at ${WXWIDGETS_SETUP_PATH}")
+    MESSAGE(STATUS "Found wxWidgets: ${WXWIDGETS_LIBRARY}")
 ELSE(WXWIDGETS_FOUND)
-    MESSAGE(WARNING "Could not find wxWidgets 3.0")
+    MESSAGE(WARNING "Could not find wxWidgets")
 ENDIF(WXWIDGETS_FOUND)


Find LibOpenSSL: Disable CMake policy warning

--- cmake/Modules/FindLibOpenSSL.cmake
+++ cmake/Modules/FindLibOpenSSL.cmake
@@ -29,7 +29,19 @@
 		endif (NOT FAILURE)
 	endif (APPLE AND NOT DEFINED OPENSSL_ROOT_DIR)

-	find_package (OpenSSL QUIET)
+	# ~~~
+	# Disable warnings about unset CMake policy in `FindOpenSSL.cmake`.
+	# TODO: Remove the calls to `cmake_policy` after the CMake developers update `FindOpenSSL.cmake`.
+	# ~~~
+	if (CMAKE_VERSION VERSION_LESS 3.1)
+		# Policy CMP0054 is not known to CMake 3.0
+		find_package (OpenSSL QUIET)
+	else (CMAKE_VERSION VERSION_LESS 3.1)
+		cmake_policy (PUSH)
+		cmake_policy (SET CMP0054 NEW)
+		find_package (OpenSSL QUIET)
+		cmake_policy (POP)
+	endif (CMAKE_VERSION VERSION_LESS 3.1)
 endif ()

 if (OPENSSL_FOUND)


Fixed error in cmake script

Fixed error in cmake script

--- cmake/dev/eprosima_libraries.cmake
+++ cmake/dev/eprosima_libraries.cmake
@@ -48,7 +48,7 @@
                 "CONFIGURE_COMMAND \"${CMAKE_COMMAND}\"\n"
                 "${${package}_CMAKE_ARGS}\n"
                 "DOWNLOAD_COMMAND echo\n"
-                "UPDATE_COMMAND cd ${PROJECT_SOURCE_DIR} && git submodule update --recursive --init \"thirdparty/${package}\"\n"
+                "UPDATE_COMMAND cd \"${PROJECT_SOURCE_DIR}\" && git submodule update --recursive --init \"thirdparty/${package}\"\n"
                 "SOURCE_DIR \${SOURCE_DIR_}\n"
                 "BINARY_DIR \"${${package}ExternalDir}/build\"\n"
                 ")\n")


eigen version

eigen version

--- tutorial/cmake/FindEIGEN.cmake
+++ tutorial/cmake/FindEIGEN.cmake
@@ -17,10 +17,10 @@

 if(NOT Eigen_FIND_VERSION)
   if(NOT Eigen_FIND_VERSION_MAJOR)
-    set(Eigen_FIND_VERSION_MAJOR 2)
+    set(Eigen_FIND_VERSION_MAJOR 3)
   endif(NOT Eigen_FIND_VERSION_MAJOR)
   if(NOT Eigen_FIND_VERSION_MINOR)
-    set(Eigen_FIND_VERSION_MINOR 91)
+    set(Eigen_FIND_VERSION_MINOR 2)
   endif(NOT Eigen_FIND_VERSION_MINOR)
   if(NOT Eigen_FIND_VERSION_PATCH)
     set(Eigen_FIND_VERSION_PATCH 0)


Comment on the hackish nature of this.

Comment on the hackish nature of this.

--- kitchen/kitchen.cmake
+++ kitchen/kitchen.cmake
@@ -13,7 +13,7 @@
   endif()
   set(KITCHEN_PROJECTS "ecto;${ARGN}")

-  # presumbably a hack for kitchens that aren't called ecto_kitchen
+  # a hack for kitchens that aren't called ecto_kitchen
   if(NOT ecto_kitchen_SOURCE_DIR)
     set(ecto_kitchen_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
     set(ecto_kitchen_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})


Update googletest to 1.11.0 (#71)

Update googletest to 1.11.0 (#71)

Update googletest to 1.11.0

Signed-off-by: Bensuperpc <8bf6bde1cad22015eaebd5dce4f156081841c2bf@gmail.com>

--- cmake/DownloadGoogleTest.cmake
+++ cmake/DownloadGoogleTest.cmake
@@ -4,8 +4,8 @@

 INCLUDE(ExternalProject)
 ExternalProject_Add(googletest
-	URL https://github.com/google/googletest/archive/release-1.10.0.zip
-	URL_HASH SHA256=94c634d499558a76fa649edb13721dce6e98fb1e7018dfaeba3cd7a083945e91
+	URL https://github.com/google/googletest/archive/release-1.11.0.zip
+	URL_HASH SHA256=353571c2440176ded91c2de6d6cd88ddd41401d14692ec1f99e35d013feda55a
 	SOURCE_DIR "${CONFU_DEPENDENCIES_SOURCE_DIR}/googletest"
 	BINARY_DIR "${CONFU_DEPENDENCIES_BINARY_DIR}/googletest"
 	CONFIGURE_COMMAND ""


cmake: fix Sphinx version detection

cmake: fix Sphinx version detection

Signed-off-by: Artur Wojcik <ea75e86c6673ace627dcd6a91fbef5d4fea719d0@intel.com>

--- cmake/Modules/FindSphinx.cmake
+++ cmake/Modules/FindSphinx.cmake
@@ -23,11 +23,14 @@
     execute_process(COMMAND ${SPHINX_EXECUTABLE} --version
                     RESULT_VARIABLE __sphinx_result OUTPUT_VARIABLE __sphinx_output ERROR_VARIABLE __sphinx_error
                     OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE)
+    if ("${__sphinx_output}" STREQUAL "")
+        set(__sphinx_output "${__sphinx_error}")
+    endif()
     if (__sphinx_result MATCHES 0)
-        string(REGEX MATCH ".* ([0-9]+)\\.([0-9]+)\\.([0-9]+)" __sphinx_version_check "${__sphinx_error}")
+        string(REGEX MATCH " ([0-9]+)\\.([0-9]+)\\.([0-9]+)$" __sphinx_version_check "${__sphinx_output}")
         set(SPHINX_VERSION ${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3})
     else()
-        set(__sphinx_output "${__sphinx_error}")
+        unset(SPHINX_VERSION "?unknown?")
         message(WARNING "Sphinx: problem extracting version!")
     endif()
 endif()


Set gtest commit tag so cmake doesn't get confused when running the update command

--- cmake/modules/BuildGTest.cmake
+++ cmake/modules/BuildGTest.cmake
@@ -18,7 +18,7 @@
   ExternalProject_Add(
     gtest
     GIT_REPOSITORY https://github.com/google/googletest.git
-    #GIT_TAG 045e7f9ee4f969ac1a3fe428f79c4b880f0aff43
+    GIT_TAG 4e4df226fc197c0dda6e37f5c8c3845ca1e73a49
     GIT_SHALLOW true

     CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${GTEST_INSTALL_DIR} -DCMAKE_CXX_FLAGS=${GTEST_ADD_CXX_FLAGS} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DBUILD_GMOCK=${BUILD_GMOCK} -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} -Dgmock_build_tests=OFF -Dgtest_force_shared_crt=ON


add options to skip generation of cmake config and pkg-config files (fix #360)

--- cmake/catkin_package.cmake
+++ cmake/catkin_package.cmake
@@ -46,6 +46,12 @@
 #   ``.cmake.installspace.em`` to generate the files only for a specific
 #   case.
 # :type CFG_EXTRAS: string
+# :param SKIP_CMAKE_CONFIG_GENERATION: the option to skip the generation
+#   of the CMake config files for the package
+# :type SKIP_CMAKE_CONFIG_GENERATION: bool
+# :param SKIP_PKG_CONFIG_GENERATION: the option to skip the generation of
+#   the pkg-config file for the package
+# :type SKIP_PKG_CONFIG_GENERATION: bool
 #
 # Example:
 # ::
@@ -83,7 +89,7 @@
 endmacro()

 function(_catkin_package)
-  cmake_parse_arguments(PROJECT "" "" "INCLUDE_DIRS;LIBRARIES;CATKIN_DEPENDS;DEPENDS;CFG_EXTRAS" ${ARGN})
+  cmake_parse_arguments(PROJECT "SKIP_CMAKE_CONFIG_GENERATION;SKIP_PKG_CONFIG_GENERATION" "" "INCLUDE_DIRS;LIBRARIES;CATKIN_DEPENDS;DEPENDS;CFG_EXTRAS" ${ARGN})
   if(PROJECT_UNPARSED_ARGUMENTS)
     message(FATAL_ERROR "catkin_package() called with unused arguments: ${PROJECT_UNPARSED_ARGUMENTS}")
   endif()
@@ -283,13 +289,15 @@
     set(PKG_CMAKE_DIR "${catkin_EXTRAS_DIR}")
   endif()

-  # ensure that output folder exists
-  file(MAKE_DIRECTORY ${CATKIN_DEVEL_PREFIX}/lib/pkgconfig)
-  # generate devel space pc for project
-  em_expand(${catkin_EXTRAS_DIR}/templates/pkg.context.pc.in
-    ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/pkg.develspace.context.pc.py
-    ${catkin_EXTRAS_DIR}/em/pkg.pc.em
-    ${CATKIN_DEVEL_PREFIX}/lib/pkgconfig/${PROJECT_NAME}.pc)
+  if(NOT PROJECT_SKIP_PKG_CONFIG_GENERATION)
+    # ensure that output folder exists
+    file(MAKE_DIRECTORY ${CATKIN_DEVEL_PREFIX}/lib/pkgconfig)
+    # generate devel space pc for project
+    em_expand(${catkin_EXTRAS_DIR}/templates/pkg.context.pc.in
+      ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/pkg.develspace.context.pc.py
+      ${catkin_EXTRAS_DIR}/em/pkg.pc.em
+      ${CATKIN_DEVEL_PREFIX}/lib/pkgconfig/${PROJECT_NAME}.pc)
+  )

   # generate devel space cfg-extras for project
   set(PKG_CFG_EXTRAS "")
@@ -319,20 +327,21 @@
     endif()
   endforeach()

-  # generate devel space config for project
-  set(infile ${${PROJECT_NAME}_EXTRAS_DIR}/${PROJECT_NAME}Config.cmake.in)
-  if(NOT EXISTS ${infile})
-    set(infile ${catkin_EXTRAS_DIR}/templates/pkgConfig.cmake.in)
-  endif()
-  configure_file(${infile}
-    ${CATKIN_DEVEL_PREFIX}/share/${PROJECT_NAME}/cmake/${PROJECT_NAME}Config.cmake
-    @ONLY
-  )
-
-  # generate devel space config-version for project
-  configure_file(${catkin_EXTRAS_DIR}/templates/pkgConfig-version.cmake.in
-    ${CATKIN_DEVEL_PREFIX}/share/${PROJECT_NAME}/cmake/${PROJECT_NAME}Config-version.cmake
-    @ONLY
+  if(NOT PROJECT_SKIP_CMAKE_CONFIG_GENERATION)
+    # generate devel space config for project
+    set(infile ${${PROJECT_NAME}_EXTRAS_DIR}/${PROJECT_NAME}Config.cmake.in)
+    if(NOT EXISTS ${infile})
+      set(infile ${catkin_EXTRAS_DIR}/templates/pkgConfig.cmake.in)
+    endif()
+    configure_file(${infile}
+      ${CATKIN_DEVEL_PREFIX}/share/${PROJECT_NAME}/cmake/${PROJECT_NAME}Config.cmake
+      @ONLY
+    )
+    # generate devel space config-version for project
+    configure_file(${catkin_EXTRAS_DIR}/templates/pkgConfig-version.cmake.in
+      ${CATKIN_DEVEL_PREFIX}/share/${PROJECT_NAME}/cmake/${PROJECT_NAME}Config-version.cmake
+      @ONLY
+    )
   )

   #
@@ -360,15 +369,17 @@
   list(INSERT PKG_CONFIG_LIB_PATHS 0 ${PROJECT_SPACE_DIR}/lib)
   set(PKG_CMAKE_DIR ${PROJECT_SPACE_DIR}/share/${PROJECT_NAME}/cmake)

-  # ensure that output folder exists
-  file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace)
-  # generate and install pc for project
-  em_expand(${catkin_EXTRAS_DIR}/templates/pkg.context.pc.in
-    ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/pkg.installspace.context.pc.py
-    ${catkin_EXTRAS_DIR}/em/pkg.pc.em
-    ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace/${PROJECT_NAME}.pc)
-  install(FILES ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace/${PROJECT_NAME}.pc
-    DESTINATION lib/pkgconfig
+  if(NOT PROJECT_SKIP_PKG_CONFIG_GENERATION)
+    # ensure that output folder exists
+    file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace)
+    # generate and install pc for project
+    em_expand(${catkin_EXTRAS_DIR}/templates/pkg.context.pc.in
+      ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/pkg.installspace.context.pc.py
+      ${catkin_EXTRAS_DIR}/em/pkg.pc.em
+      ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace/${PROJECT_NAME}.pc)
+    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace/${PROJECT_NAME}.pc
+      DESTINATION lib/pkgconfig
+    )
   )

   # generate and install cfg-extras for project
@@ -405,31 +416,31 @@
     DESTINATION share/${PROJECT_NAME}/cmake
   )

-  # generate config for project
-  set(infile ${${PROJECT_NAME}_EXTRAS_DIR}/${PROJECT_NAME}Config.cmake.in)
-  if(NOT EXISTS ${infile})
-    set(infile ${catkin_EXTRAS_DIR}/templates/pkgConfig.cmake.in)
-  endif()
-  configure_file(${infile}
-    ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace/${PROJECT_NAME}Config.cmake
-    @ONLY
-  )
-
-  # generate config-version for project
-  set(infile ${${PROJECT_NAME}_EXTRAS_DIR}/${PROJECT_NAME}Config-version.cmake.in)
-  if(NOT EXISTS ${infile})
-    set(infile ${catkin_EXTRAS_DIR}/templates/pkgConfig-version.cmake.in)
-  endif()
-  configure_file(${infile}
-    ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace/${PROJECT_NAME}Config-version.cmake
-    @ONLY
-  )
-
-  # install config, config-version and cfg-extras for project
-  install(FILES
-    ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace/${PROJECT_NAME}Config.cmake
-    ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace/${PROJECT_NAME}Config-version.cmake
-    DESTINATION share/${PROJECT_NAME}/cmake
+  if(NOT PROJECT_SKIP_CMAKE_CONFIG_GENERATION)
+    # generate config for project
+    set(infile ${${PROJECT_NAME}_EXTRAS_DIR}/${PROJECT_NAME}Config.cmake.in)
+    if(NOT EXISTS ${infile})
+      set(infile ${catkin_EXTRAS_DIR}/templates/pkgConfig.cmake.in)
+    endif()
+    configure_file(${infile}
+      ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace/${PROJECT_NAME}Config.cmake
+      @ONLY
+    )
+    # generate config-version for project
+    set(infile ${${PROJECT_NAME}_EXTRAS_DIR}/${PROJECT_NAME}Config-version.cmake.in)
+    if(NOT EXISTS ${infile})
+      set(infile ${catkin_EXTRAS_DIR}/templates/pkgConfig-version.cmake.in)
+    endif()
+    configure_file(${infile}
+      ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace/${PROJECT_NAME}Config-version.cmake
+      @ONLY
+    )
+    # install config, config-version and cfg-extras for project
+    install(FILES
+      ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace/${PROJECT_NAME}Config.cmake
+      ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/installspace/${PROJECT_NAME}Config-version.cmake
+      DESTINATION share/${PROJECT_NAME}/cmake
+    )
   )

   # install package.xml


Don't install things that you don't generate

--- cmake/catkin_project.cmake
+++ cmake/catkin_project.cmake
@@ -111,15 +111,6 @@

   string(TOLOWER ${PROJECT_NAME} project_lower)

-  if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/manifest.xml.in)
-    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/manifest.xml.in
-      ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/manifest.xml
-      @ONLY)
-    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/manifest.xml
-      DESTINATION share/${project_lower}
-      )
-  endif()
-
   #
   #  Versions to be installed
   #


Fix cmake.

Fix cmake.

--- cmake/external_rules.cmake
+++ cmake/external_rules.cmake
@@ -164,7 +164,7 @@
     # Propagate Linux build flags.
     if("${CMAKE_CXX_FLAGS}" MATCHES "-D_GLIBCXX_USE_CXX11_ABI=0")
       set(SUBBUILD_USE_CXX11_ABI 0)
-    else
+    else()
       set(SUBBUILD_USE_CXX11_ABI 1)
     endif()
     # TODO: Set the above variable


per bug 14586 fix external vtkLocal

per bug 14586 fix external vtkLocal

With external vtklocal we ended up trying to link againt "TCL".

Change-Id: If154b92a164e6a6a21274614fbc4c652023fec2d

--- CMake/vtkTclWrapping.cmake
+++ CMake/vtkTclWrapping.cmake
@@ -45,7 +45,7 @@
   # Figure out the dependent Tcl libraries for the module
   foreach(dep ${${vtk-module}_LINK_DEPENDS})
     if(NOT "${vtk-module}" STREQUAL "${dep}")
-      if(NOT ${dep}_EXCLUDE_FROM_WRAPPING)
+      if(NOT ${dep}_EXCLUDE_FROM_WRAPPING AND NOT "${${dep}_TCL_NAME}" STREQUAL "")
         list(APPEND extra_links ${${dep}_TCL_NAME}TCL)
       endif()
     endif()


Try to fix the debug permissions stuff.

Try to fix the debug permissions stuff.

--- cmake/install_macros.cmake
+++ cmake/install_macros.cmake
@@ -174,7 +174,8 @@
   ""
   ${ARGN}
   )
-  GET_TARGET_PROPERTY(target_type  ${target} TYPE)
+  GET_TARGET_PROPERTY(target_type ${target} TYPE)
+  GET_TARGET_PROPERTY(target_permissions ${target} PERMISSIONS)
   IF(ARG_RENAME)
     SET(RENAME_PARAM RENAME ${ARG_RENAME}${CMAKE_${target_type}_SUFFIX})
   ELSE()
@@ -193,6 +194,7 @@
   INSTALL(FILES ${debug_target_location}
     DESTINATION ${ARG_DESTINATION}
     ${RENAME_PARAM}
+    PERMISSIONS ${target_permissions}
     CONFIGURATIONS Release RelWithDebInfo
     OPTIONAL)


From Wang Rui, "This fixes a small problem in the FindFBX file.  In CMake scripts, VS2010 is not marked as MSVC100 but MSVC10. And CMake defines MSVC_VERSION instead of MSVC_VER to indicate the version number. The modification can find fbx sdk for VS2010 automatically now. "

--- CMakeModules/FindFBX.cmake
+++ CMakeModules/FindFBX.cmake
@@ -16,7 +16,7 @@
     SET(FBX_LIBDIR "vs2005")
 ELSEIF(MSVC90)
     SET(FBX_LIBDIR "vs2008")
-ELSEIF(MSVC100 OR MSVC_VER>1600)
+ELSEIF(MSVC10 OR MSVC_VERSION>1600)
     SET(FBX_LIBDIR "vs2010")
 ENDIF()


Add check to disable java bindings if swig is not found.

svn path=/trunk/; revision=6777

--- cmake/modules/plplot.cmake
+++ cmake/modules/plplot.cmake
@@ -49,7 +49,11 @@

 # Find swig - no version checking at present
 FIND_PACKAGE(SWIG)
-include(${SWIG_USE_FILE})
+IF (SWIG_FOUND)
+  include(${SWIG_USE_FILE})
+ELSE (SWIG_FOUND)
+  SET(ENABLE_java OFF CACHE BOOL "Enable Java bindings" FORCE)
+ENDIF (SWIG_FOUND)

 # Load language specific files
 include(c++)


cmake: improve gsl check

cmake: improve gsl check

--- CMakeModules/FindGSL.cmake
+++ CMakeModules/FindGSL.cmake
@@ -26,6 +26,10 @@
 find_path(GSL_INCLUDE_DIR gsl/gsl_linalg.h HINTS ${PC_GSL_INCLUDE_DIRS})

 if (NOT GSL_LIBRARY)
+  #avoid PC_GSL_LIBRARIES being empty
+  list(INSERT PC_GSL_LIBRARIES 0 gsl)
+  list(REMOVE_DUPLICATES PC_GSL_LIBRARIES)
+  #added gls depends
   foreach (LIB ${PC_GSL_LIBRARIES})
     find_library(GSL_${LIB} NAMES ${LIB} HINTS ${PC_GSL_LIBRARY_DIRS} )
     list(APPEND GSL_LIBRARY ${GSL_${LIB}})


Update: enable finding recent versions of boost
Note that this doesn't change the requested version of boost it just
allows finding boost with version higher than 1.42

git-svn-id: 5398946ba177a3e438c2dae55e2cdfc2fb96c905@1834 a9d63959-f2ad-4865-b262-bf0e56cfafb6

--- cmake/pcl_find_boost.cmake
+++ cmake/pcl_find_boost.cmake
@@ -3,6 +3,12 @@
 if(NOT PCL_SHARED_LIBS OR WIN32)
   set(Boost_USE_STATIC_LIBS ON)
 endif(NOT PCL_SHARED_LIBS OR WIN32)
+
+if(${CMAKE_VERSION} VERSION_LESS 2.8.5)
+  SET(Boost_ADDITIONAL_VERSIONS "1.43" "1.43.0" "1.44" "1.44.0" "1.45" "1.45.0" "1.46.1" "1.46.0" "1.46" "1.47" "1.47.0")
+else(${CMAKE_VERSION} VERSION_LESS 2.8.5)
+  SET(Boost_ADDITIONAL_VERSIONS "1.47" "1.47.0")
+endif(${CMAKE_VERSION} VERSION_LESS 2.8.5)

 find_package(Boost 1.40.0 REQUIRED COMPONENTS system filesystem thread date_time)


Increment version to 3.5.0

Increment version to 3.5.0

--- CMakeModules/Version.cmake
+++ CMakeModules/Version.cmake
@@ -9,8 +9,8 @@
 ENDIF()

 SET(AF_VERSION_MAJOR "3")
-SET(AF_VERSION_MINOR "4")
-SET(AF_VERSION_PATCH "1")
+SET(AF_VERSION_MINOR "5")
+SET(AF_VERSION_PATCH "0")

 SET(AF_VERSION "${AF_VERSION_MAJOR}.${AF_VERSION_MINOR}.${AF_VERSION_PATCH}")
 SET(AF_API_VERSION_CURRENT ${AF_VERSION_MAJOR}${AF_VERSION_MINOR})


uselib: link_lib(XXX_LIBRARIES) fallback on link_lib(XXX_LIBRARY)

--- cmake/qibuild/uselib.cmake
+++ cmake/qibuild/uselib.cmake
@@ -2,7 +2,7 @@
 ## Author(s):
 ##  - Cedric GESTES <gestes@aldebaran-robotics.com>
 ##
-## Copyright (C) 2009, 2010 Aldebaran Robotics
+## Copyright (C) 2009, 2010, 2011 Aldebaran Robotics
 ##

 #! QiBuild UseLib
@@ -54,6 +54,8 @@

 #!
 # Find dependencies and add them to the target <name>.
+# This will call include_directories with XXX_INCLUDE_DIRS or fallback to XXX_INCLUDE_DIR
+# This will call target_link_libraries with XXX_LIBRARIES or fallback to XXX_LIBRARY
 #
 # \arg:name the target to add dependencies to
 # \flag:OPTIONAL do not stop on error
@@ -73,14 +75,18 @@
   foreach(_pkg ${_DEPS})
     string(TOUPPER ${_pkg} _U_PKG)

-    #TODO: search for INCLUDE_DIRS, fallback on INCLUDE_DIR
     if (DEFINED ${_U_PKG}_INCLUDE_DIRS)
       include_directories(${${_U_PKG}_INCLUDE_DIRS})
     elseif(DEFINED ${_U_PKG}_INCLUDE_DIR)
       include_directories(${${_U_PKG}_INCLUDE_DIR})
     endif()

-    target_link_libraries("${name}" ${${_U_PKG}_LIBRARIES})
+    if (DEFINED ${_U_PKG}_LIBRARIES)
+      target_link_libraries("${name}" ${${_U_PKG}_LIBRARIES})
+    elseif (DEFINED ${_U_PKG}_LIBRARY)
+      target_link_libraries("${name}" ${${_U_PKG}_LIBRARY})
+    endif()
+
     if ( (DEFINED "${_U_PKG}_TARGET") AND (TARGET "${${_U_PKG}_TARGET}") )
       add_dependencies(${name} "${${_U_PKG}_TARGET}")
     endif()


vita.cmake: Giva the same name as custom_command

this patch would recover the broken name since #120

this patch will print the warning about `circular dependency dropped`
but would work properly.

actually, we should give the right name to target (#129 still has wrong name)

follow the 2011 cmake newgroup thread & cmake issue
- https://cmake.org/pipermail/cmake/2011-March/043375.html
- https://gitlab.kitware.com/cmake/cmake/issues/18627

--- cmake_toolchain/vita.cmake
+++ cmake_toolchain/vita.cmake
@@ -64,12 +64,12 @@
     COMMENT "Converting to Sony ELF ${source}.velf" VERBATIM
   )
   separate_arguments(VITA_MAKE_FSELF_FLAGS)
-  add_custom_command(OUTPUT ${target}
+  add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${target}
     COMMAND ${VITA_MAKE_FSELF} ${VITA_MAKE_FSELF_FLAGS} ${source}.velf ${target}
     DEPENDS ${source}.velf
     COMMENT "Creating SELF ${target}"
   )
-  add_custom_target(${target}_ ALL DEPENDS ${target})
+  add_custom_target(${target} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${target})
 endmacro(vita_create_self)
 ##################################################

@@ -179,11 +179,11 @@
     COMMENT "Generating param.sfo for ${target}"
   )
   separate_arguments(VITA_PACK_VPK_FLAGS)
-  add_custom_command(OUTPUT ${target}
+  add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${target}
     COMMAND ${VITA_PACK_VPK} ${VITA_PACK_VPK_FLAGS} -s ${target}_param.sfo -b ${eboot} ${target}
     DEPENDS ${target}_param.sfo ${eboot} ${resources}
     COMMENT "Building vpk ${target}"
   )
-  add_custom_target(${target}_ ALL DEPENDS ${target})
+  add_custom_target(${target} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${target})
 endmacro(vita_create_vpk)
 ##################################################


px4_fmu-v5_stackcheck disable roboclaw and pca9685 to reduce flash

--- boards/px4/fmu-v5/stackcheck.cmake
+++ boards/px4/fmu-v5/stackcheck.cmake
@@ -43,14 +43,14 @@
 		#md25
 		mkblctrl
 		optical_flow # all available optical flow drivers
-		pca9685
+		#pca9685
 		#protocol_splitter
 		pwm_input
 		pwm_out_sim
 		px4fmu
 		px4io
 		rc_input
-		roboclaw
+		#roboclaw
 		safety_button
 		tap_esc
 		telemetry # all available telemetry drivers


Investigating eigenvalue bug on cluster

Investigating eigenvalue bug on cluster

Former-commit-id: 07b0694eeea84875ca3c97db2fad406752f59605

--- cmake-modules/Fetch_OpenBLAS.cmake
+++ cmake-modules/Fetch_OpenBLAS.cmake
@@ -114,28 +114,44 @@
             GIT_TAG             v0.3.5
             PREFIX      ${BUILD_DIRECTORY}/OpenBLAS
             INSTALL_DIR ${INSTALL_DIRECTORY}/OpenBLAS
-            UPDATE_COMMAND ""
-            TEST_COMMAND ""
-            CONFIGURE_COMMAND ""
-
-            BUILD_IN_SOURCE 1
-            BUILD_COMMAND export LD_LIBRARY_PATH=${GFORTRAN_PATH}:$LD_LIBRARY_PATH &&
-                          export LDFLAGS="-L${GFORTRAN_PATH} $LDFLAGS" &&
-                          $(MAKE) TARGET=SKYLAKE
-                          USE_THREAD=${OpenBLAS_MULTITHREADED}
-                          USE_OPENMP=${OpenBLAS_USE_OPENMP}
-                          NO_AFFINITY=1
-                          NO_WARMUP=1
-                          QUIET_MAKE=0
-                          NUM_THREADS=128
-                          DEBUG=1
-#                          FFLAGS=-frecursive
-                          DYNAMIC_ARCH=1
-                          BINARY64=64
-                          GEMM_MULTITHREAD_THRESHOLD=4
-                          LDFLAGS=-L${GFORTRAN_PATH}
-                          FFLAGS=-O2 -Wno-maybe-uninitialized -Wno-conversion -Wno-unused-but-set-variable -Wno-unused-variable
-            INSTALL_COMMAND $(MAKE) PREFIX=<INSTALL_DIR> install
+#            UPDATE_COMMAND ""
+#            TEST_COMMAND ""
+#            CONFIGURE_COMMAND ""
+
+            CMAKE_ARGS
+#            -j8
+            -DDYNAMIC_ARCH:BOOL=ON
+            -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
+            -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
+            -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
+
+            #            -DCMAKE_INSTALL_MESSAGE=NEVER #Avoid unnecessary output to console
+#            -DCMAKE_C_FLAGS=-w
+#            -DCMAKE_CXX_FLAGS=-w
+#            -DCMAKE_FORTRAN_FLAGS=-w
+
+
+
+
+
+            #            BUILD_IN_SOURCE 1
+#            BUILD_COMMAND export LD_LIBRARY_PATH=${GFORTRAN_PATH}:$LD_LIBRARY_PATH &&
+#                          export LDFLAGS="-L${GFORTRAN_PATH} $LDFLAGS" &&
+#                          $(MAKE) TARGET=SKYLAKE
+#                          USE_THREAD=${OpenBLAS_MULTITHREADED}
+#                          USE_OPENMP=${OpenBLAS_USE_OPENMP}
+#                          NO_AFFINITY=1
+#                          NO_WARMUP=1
+#                          QUIET_MAKE=0
+#                          NUM_THREADS=128
+#                          DEBUG=1
+##                          FFLAGS=-frecursive
+#                          DYNAMIC_ARCH=1
+#                          BINARY64=64
+#                          GEMM_MULTITHREAD_THRESHOLD=4
+#                          LDFLAGS=-L${GFORTRAN_PATH}
+#                          FFLAGS=-O2 -Wno-maybe-uninitialized -Wno-conversion -Wno-unused-but-set-variable -Wno-unused-variable
+#            INSTALL_COMMAND $(MAKE) PREFIX=<INSTALL_DIR> install
             DEPENDS gfortran
             )


Refine cmake file

Refine cmake file

--- cmake/Modules/Findlibmolgrid.cmake
+++ cmake/Modules/Findlibmolgrid.cmake
@@ -20,11 +20,12 @@
     find_path(LIBMOLGRID_INCLUDE_DIR libmolgrid/libmolgrid.h
     PATHS
       $ENV{LIBMOLGRID_INCLUDE_DIR}
+      ${CMAKE_INSTALL_PREFIX}/include
       /usr/include/
       /usr/local/include
       )
     if(LIBMOLGRID_INCLUDE_DIR)
-       message(STATUS "Found RDKit include files at ${LIBMOLGRID_INCLUDE_DIR}")
+       message(STATUS "Found libmolgrid include files at ${LIBMOLGRID_INCLUDE_DIR}")
     endif()
   endif()

@@ -32,6 +33,7 @@
       find_library(LIBMOLGRID_LIBRARY NAMES molgrid
       PATHS
         $ENV{LIBMOLGRID_LIBRARY_DIR}
+        ${CMAKE_INSTALL_PREFIX}/lib
         /usr/lib
         /usr/local/lib
         $ENV{LD_LIBRARY_PATH}


Print test output when CTest is run in verbose mode.

--- cmake/modules/RootTestDriver.cmake
+++ cmake/modules/RootTestDriver.cmake
@@ -97,6 +97,7 @@
     endif()

     execute_process(COMMAND ${_cmd} ${_chkout} ${_chkerr} WORKING_DIRECTORY ${CWD} RESULT_VARIABLE _rc)
+    message("${_outvar}")
     file(WRITE ${OUT} "${_outvar}")

     if(DEFINED RC AND (NOT _rc EQUAL RC))


OpenCV: bumped PACKAGE_INTERNAL_DEPS_ID

OpenCV: bumped PACKAGE_INTERNAL_DEPS_ID

--- cmake/projects/OpenCV/hunter.cmake
+++ cmake/projects/OpenCV/hunter.cmake
@@ -330,4 +330,7 @@
 #     * libexample_Ad.a

 hunter_cacheable(OpenCV)
-hunter_download(PACKAGE_NAME OpenCV)
+hunter_download(
+    PACKAGE_NAME OpenCV
+    PACKAGE_INTERNAL_DEPS_ID "1"
+)


Fix PC_REQUIRES_PRIV related overlinking in fluidsynth.pc

--- cmake_admin/PkgConfigHelpers.cmake
+++ cmake_admin/PkgConfigHelpers.cmake
@@ -30,13 +30,8 @@
         set(_cleanlibs)
         foreach(_lib IN LISTS _libs)
             if (TARGET ${_lib})
-                get_target_property(_tlibs ${_lib} INTERFACE_LINK_LIBRARIES)
-                foreach(_clib IN LISTS _tlibs)
-                    get_filename_component(_name "${_clib}" NAME)
-                    string(REGEX REPLACE "^lib" "" _clib ${_name})
-                    string(REGEX REPLACE ".so$" "" _clib ${_clib})
-                    list(APPEND _cleanlibs ${_clib})
-                endforeach()
+                # All the imported PkgConfig target are explicitly added to PC_REQUIRES_PRIV.
+                # Do not duplicate them into the Libs.private section, as they will be already part of Requires.private
             else()
                 list(APPEND _cleanlibs ${_lib})
             endif()


refs #5940 update to jemalloc-3.3.0 in the fractal tree

git-svn-id: b5c078ec0b4d3a50497e9dd3081db18a5b4f16e5@52623 c7de825b-a66e-492c-adef-691d508d4ae1

--- cmake_modules/TokuThirdParty.cmake
+++ cmake_modules/TokuThirdParty.cmake
@@ -4,7 +4,7 @@
 include(ExternalProject)

 ## add jemalloc with an external project
-set(JEMALLOC_SOURCE_DIR "${TOKU_SVNROOT}/jemalloc-3.2.0" CACHE FILEPATH "Where to find jemalloc sources.")
+set(JEMALLOC_SOURCE_DIR "${TOKU_SVNROOT}/jemalloc-3.3.0" CACHE FILEPATH "Where to find jemalloc sources.")
 if (NOT EXISTS "${JEMALLOC_SOURCE_DIR}/configure")
   message(FATAL_ERROR "Can't find jemalloc sources.  Please check them out to ${JEMALLOC_SOURCE_DIR} or modify TOKU_SVNROOT (${TOKU_SVNROOT}) or JEMALLOC_SOURCE_DIR.")
 endif ()


IMPALA-3534: allow overriding of CMAKE_CXX_COMPILER for ASAN

This makes it consistent with the regular toolchain and makes it easier
to use wrapper scripts like distcc.

Change-Id: I3ab488182c46f9ccb1850a0a2b064653e7e3da26
Reviewed-on: http://gerrit.cloudera.org:8080/3050
Reviewed-by: Jim Apple <9e3620e7251463d214b5f536438d2c9ea899162d@cloudera.com>
Reviewed-by: Casey Ching <77bc9a9984e6786c5799d7a71768cf023120ef76@cloudera.com>
Tested-by: Internal Jenkins

--- cmake_modules/asan_toolchain.cmake
+++ cmake_modules/asan_toolchain.cmake
@@ -24,7 +24,13 @@
 set(LLVM_ASAN_ROOT $ENV{IMPALA_TOOLCHAIN}/llvm-$ENV{IMPALA_LLVM_ASAN_VERSION})

 set(CMAKE_C_COMPILER ${LLVM_ASAN_ROOT}/bin/clang)
-set(CMAKE_CXX_COMPILER ${LLVM_ASAN_ROOT}/bin/clang++)
+
+# Use clang to build unless overridden by environment.
+if($ENV{IMPALA_CXX_COMPILER} STREQUAL "default")
+  set(CMAKE_CXX_COMPILER ${LLVM_ASAN_ROOT}/bin/clang++)
+else()
+  set(CMAKE_CXX_COMPILER $ENV{IMPALA_CXX_COMPILER})
+endif()

 # Add the GCC root location to the compiler flags
 set(CXX_COMMON_FLAGS "--gcc-toolchain=${GCC_ROOT}")


Fixed module finder for windows for octave

Signed-off-by: Ian Bell <6f1c5b737f3c5cff42a9b8f8dcfce305d97fd07b@gmail.com>

--- dev/cmake/Modules/FindOctave.cmake
+++ dev/cmake/Modules/FindOctave.cmake
@@ -12,15 +12,24 @@

 cmake_minimum_required(VERSION 2.8)

+IF (WIN32)
+  IF( "$ENV{OCTAVE_ROOT}" STREQUAL "" )
+    message(FATAL_ERROR "On windows, environmental variable OCTAVE_ROOT must be set to folder containing folders bin, include, etc. for octave")
+  ENDIF()
+ENDIF()
+
+set(OCTAVE_BIN)
+IF( "$ENV{OCTAVE_ROOT}" STREQUAL "" )
+ELSE()
+    set(OCTAVE_BIN $ENV{OCTAVE_ROOT}/bin)
+ENDIF()
+
 # use mkoctfile
 set(MKOCTFILE_EXECUTABLE MKOCTFILE_EXECUTABLE-NOTFOUND)
-find_program(MKOCTFILE_EXECUTABLE NAME mkoctfile PATHS)
+find_program(MKOCTFILE_EXECUTABLE
+             NAME mkoctfile
+             PATHS ${OCTAVE_BIN})
 mark_as_advanced(MKOCTFILE_EXECUTABLE)
-
-# use octave_config
-set(OCTAVE_CONFIG_EXECUTABLE OCTAVE_CONFIG_EXECUTABLE-NOTFOUND)
-find_program(OCTAVE_CONFIG_EXECUTABLE NAME octave-config PATHS)
-mark_as_advanced(OCTAVE_CONFIG_EXECUTABLE)

 if(MKOCTFILE_EXECUTABLE)
   set(OCTAVE_FOUND 1)
@@ -120,6 +129,14 @@

 	message(FATAL_ERROR "Unable to find mkoctfile executable")
 endif()
+
+# use octave_config
+set(OCTAVE_CONFIG_EXECUTABLE OCTAVE_CONFIG_EXECUTABLE-NOTFOUND)
+find_program(OCTAVE_CONFIG_EXECUTABLE
+             NAME octave-config
+             PATHS ${OCTAVE_BIN})
+mark_as_advanced(OCTAVE_CONFIG_EXECUTABLE)
+
 if(OCTAVE_CONFIG_EXECUTABLE)
   message(STATUS "Found octave-config executable")
   execute_process(
@@ -150,6 +167,15 @@
 else()
   message(FATAL_ERROR "Did not find octave-config executable")
 endif()
+
+IF (WIN32)
+  list(APPEND OCTAVE_LINK_DIRS "$ENV{OCTAVE_ROOT}/lib/octave/${OCTAVE_VERSION}")
+  message(STATUS "OCTAVE_LINK_DIRS :: ${OCTAVE_LINK_DIRS}")
+  list(APPEND OCTAVE_INCLUDE_DIRS "$ENV{OCTAVE_ROOT}/include")
+  list(APPEND OCTAVE_INCLUDE_DIRS "$ENV{OCTAVE_ROOT}/include/octave-${OCTAVE_VERSION}")
+  list(APPEND OCTAVE_INCLUDE_DIRS "$ENV{OCTAVE_ROOT}/include/octave-${OCTAVE_VERSION}/octave")
+  message(STATUS "OCTAVE_INCLUDE_DIRS :: ${OCTAVE_INCLUDE_DIRS}")
+ENDIF()

 FIND_LIBRARY( OCTAVE_OCTAVE_LIBRARY
 			  NAMES octave liboctave


move dg folder into phasta

move dg folder into phasta

--- test/testing.cmake
+++ test/testing.cmake
@@ -29,7 +29,7 @@
   set(GXT dmg)
 endif()

-set(MDIR ${MESHES}/dg)
+set(MDIR ${MESHES}/phasta/dg)
 if(ENABLE_SIMMETRIX)
   mpi_test(migrate_interface 4
     ./migrate_interface


update libs needed by communication module, setting up the appropriate gstreamer libs

git-svn-id: 65dd0ccd495961f396d5302e5521154b071f0302@1915 5b2332b8-efa3-11de-8684-7d64432d61a3

--- CMakeModules/ConfigurePackages.cmake
+++ CMakeModules/ConfigurePackages.cmake
@@ -206,7 +206,7 @@
 macro (configure_telepathy_qt4)
     sagase_configure_package (TELEPATHY_QT4
         NAMES QtTelepathy Telepathy-QT4 telepathy-qt4 TelepathyQt4
-        COMPONENTS QtTelepathyCore QtTelepathyCommon QtTelepathyClient telepathy-qt4 connection # connection added here to help sagase to find include folder with connection.h file
+        COMPONENTS QtTelepathyCore QtTelepathyCommon QtTelepathyClient telepathy-qt4 telepathy-qt4-farsight connection # connection added here to help sagase to find include folder with connection.h file
         PREFIXES ${ENV_NAALI_DEP_PATH} )
     sagase_configure_report (TELEPATHY_QT4)
 endmacro (configure_telepathy_qt4)
@@ -214,7 +214,7 @@
 macro (configure_gstreamer)
     sagase_configure_package (GSTREAMER
         NAMES gstreamer gst gstreamer-0.10
-        COMPONENTS libavcodec libavformat libavutil libgstapp-0.10 libgstaudio-0.10 libgstbase-0.10 libgstcontroller-0.10 ibgstdataprotocol-0.10 libgstdshow-0.10 libgstinterfaces-0.10 libgstnet-0.10 libgstnetbuffer-0.10 libgstpbutils-0.10 libgstriff-0.10 libgstreamer-0.10 libgstrtp-0.10 libgstrtsp-0.10 libgstsdp-0.10 libgsttag-0.10 libgstvideo-0.10 libjpeg-static libjpeg gst # gst added to help sagese to find include folder with gst.h file
+        COMPONENTS gstreamer gstfarsight gstinterfaces gst # gst added to help sagese to find include folder with gst.h file
         PREFIXES ${ENV_NAALI_DEP_PATH})
     sagase_configure_report (GSTREAMER)
 endmacro (configure_gstreamer)


Use new CMake macros for resource embedding.

--- CMake/mitkFunctionCreateModule.cmake
+++ CMake/mitkFunctionCreateModule.cmake
@@ -400,12 +400,7 @@
             endforeach()

             # Add a source level dependencies on resource files
-            if(source_res_files)
-              list(APPEND CPP_FILES ${MODULE_TARGET}_resources.cpp)
-            endif()
-            if(binary_res_files)
-              list(APPEND CPP_FILES ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_TARGET}_binary_resources.cpp)
-            endif()
+            usFunctionGetResourceSource(TARGET ${MODULE_TARGET} OUT CPP_FILES)
           endif()
         endif()

@@ -572,7 +567,6 @@

           if(binary_res_files)
             usFunctionAddResources(TARGET ${MODULE_TARGET}
-                                   SOURCE_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_TARGET}_binary_resources.cpp
                                    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${res_dir}
                                    FILES ${binary_res_files})
           endif()
@@ -580,6 +574,9 @@
             usFunctionAddResources(TARGET ${MODULE_TARGET}
                                    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${res_dir}
                                    FILES ${source_res_files})
+          endif()
+          if(binary_res_files OR source_res_files)
+            usFunctionEmbedResources(TARGET ${MODULE_TARGET})
           endif()

         endif()


Update python virtualenv to 15.1.0

Update python virtualenv to 15.1.0

This may address python 3.5.2 compatibility issues.

Change-Id: Ie2f80a8fc71afb3db07abfe237d9aeb74e296f7e

--- SuperBuild/External_virtualenv.cmake
+++ SuperBuild/External_virtualenv.cmake
@@ -7,8 +7,8 @@

 set(proj virtualenv)

-set(${proj}_TARGET_VERSION 15.0.2)
-set(${proj}_DOWNLOAD_SOURCE_HASH "0ed59863994daf1292827ffdbba80a63")
+set(${proj}_TARGET_VERSION 15.1.5)
+set(${proj}_DOWNLOAD_SOURCE_HASH "44e19f4134906fe2d75124427dc9b716")

 # based on the standard EP_PREFIX locations, but since we don't build
 # or install, then standards install directory is also the source


remove useless variable expension

remove useless variable expension

--- gtest.cmake
+++ gtest.cmake
@@ -3,7 +3,7 @@
 if(USE_SYSTEM_GTEST)
   find_package(GTest)
 else()
-  if(${CMAKE_VERSION} VERSION_LESS 3.2 AND CMAKE_GENERATOR MATCHES "Ninja")
+  if(CMAKE_VERSION VERSION_LESS 3.2 AND CMAKE_GENERATOR MATCHES "Ninja")
     message(WARNING "Building GTest with Ninja has known issues with CMake older than 3.2")
   endif()


Ability to override MKL_INTERFACE on command line

--- modules/FindMKL.cmake
+++ modules/FindMKL.cmake
@@ -64,6 +64,11 @@
 #   MKL_XEON_PHI_USAGE_MODEL - Set to "none", "native", "automatic" or
 #                              "compiler" to select how the MKL is to use any
 #                              Xeon Phi coprocessors found.  Default is "none".
+#   MKL_INTERFACE            - Set to "lp64" or "ilp64" (case-insensitive) to
+#                              select 32-bit or 64-bit integer interface.
+#                              Default is blank on 32-bit platforms (where no
+#                              interface library is needed) and to guess based
+#                              on sizeof(int) on 64-bit platforms.
 #   MKL_THREADING            - Set to "Sequential", "OpenMP" or "TBB"  to select
 #                              threading library.  Default is "OpenMP".
 #   MKL_OPENMP               - Set to "Intel", "GNU" or "PGI" to use vendor
@@ -293,6 +298,7 @@
   endif()

   set(MKL_LIBRARIES "")
+  set(MKL_DEFINITIONS "")

   # Find the core library
   find_library(MKL_CORE_LIB
@@ -305,21 +311,24 @@
   endif()

   # Work out interface layer
-  if (_MKL_IS_64BIT)
-    include(CheckTypeSize)
-    CHECK_TYPE_SIZE("int" _MKL_SIZEOF_INT)
-    if (${_MKL_SIZEOF_INT} EQUAL 4)
-      set(_MKL_INTERFACE "lp64")
-    elseif(${_MKL_SIZEOF_INT} EQUAL 8)
-      set(_MKL_INTERFACE "ilp64")
-      set(MKL_DEFINITIONS "-DMKL_ILP64")
-    endif()
-  endif()
-  if (DEFINED _MKL_INTERFACE)
+  if (NOT DEFINED MKL_INTERFACE)
+    if (_MKL_IS_64BIT)
+      include(CheckTypeSize)
+      CHECK_TYPE_SIZE("int" _MKL_SIZEOF_INT)
+      if (${_MKL_SIZEOF_INT} EQUAL 4)
+        set(MKL_INTERFACE "lp64")
+      elseif(${_MKL_SIZEOF_INT} EQUAL 8)
+        set(MKL_INTERFACE "ilp64")
+      endif()
+      unset(_MKL_SIZEOF_INT)
+    endif()
+  endif()
+  if (DEFINED MKL_INTERFACE)
+    string(TOLOWER ${MKL_INTERFACE} _MKL_INTERFACE_LC)
     if (${CMAKE_COMPILER_IS_GNUG77})
-      set(_MKL_INTERFACE_LIBRARY "mkl_gf_${_MKL_INTERFACE}")
+      set(_MKL_INTERFACE_LIBRARY "mkl_gf_${_MKL_INTERFACE_LC}")
     else()
-      set(_MKL_INTERFACE_LIBRARY "mkl_intel_${_MKL_INTERFACE}")
+      set(_MKL_INTERFACE_LIBRARY "mkl_intel_${_MKL_INTERFACE_LC}")
     endif()
     find_library(MKL_INTERFACE_LIB
                  "${_MKL_INTERFACE_LIBRARY}"
@@ -327,12 +336,17 @@
     if("${MKL_INTERFACE_LIB}" STREQUAL "MKL_INTERFACE_LIB-NOTFOUND")
       set(MKL_FOUND 0)
     else()
+      if("${_MKL_INTERFACE_LC}" STREQUAL "ilp64")
+        list(APPEND MKL_DEFINITIONS "-DMKL_ILP64")
+      endif()
       list(APPEND MKL_LIBRARIES ${MKL_INTERFACE_LIB})
     endif()
+    unset(_MKL_INTERFACE_LC)
+    unset(_MKL_INTERFACE_LIBRARY)
     unset(_MKL_IS_64BIT)
-    unset(_MKL_INTERFACE)
-  endif()
-
-  # Construct MKL_LIBRARIES
+  endif()
+
+  # Construct MKL_LIBRARIES and MKL_DEFINITIONS
+  list(REMOVE_DUPLICATES MKL_DEFINITIONS)
   list(REMOVE_DUPLICATES MKL_LIBRARIES)
 endif()


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   10)
+SET(KWSYS_DATE_STAMP_DAY   11)


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -15,7 +15,7 @@
 SET(KWSYS_DATE_STAMP_YEAR  2010)

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

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


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

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


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

--- Utilities/kwsys/kwsysDateStamp.cmake
+++ Utilities/kwsys/kwsysDateStamp.cmake
@@ -12,10 +12,10 @@
 #=============================================================================

 # KWSys version date year component.  Format is CCYY.
-SET(KWSYS_DATE_STAMP_YEAR  2009)
+SET(KWSYS_DATE_STAMP_YEAR  2010)

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

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


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

 # 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 04)

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


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

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


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

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


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

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


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

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


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

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


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

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


Issue #37: Try to cope if PythonLibs not found.

--- CMake/mpAddPythonBindings.cmake
+++ CMake/mpAddPythonBindings.cmake
@@ -20,15 +20,23 @@
 endif()

 if(BUILD_Python_Boost OR BUILD_Python_PyBind)
+  find_package(PythonInterp)
+  message("Found python interpreter: ${PYTHON_EXECUTABLE}")
+  find_package(PythonLibs)
+  message("Found python library version: ${PYTHONLIBS_VERSION_STRING}")
+endif()

-  find_package(PythonInterp REQUIRED)
-  message("Found python interpreter: ${PYTHON_EXECUTABLE}")
-  find_package(PythonLibs REQUIRED)
-  message("Found python library version: ${PYTHONLIBS_VERSION_STRING}")
+if (NOT PythonLibs_FOUND)
+  set(BUILD_Python_Boost OFF CACHE BOOL "Build boost::python bindings." FORCE)
+  set(BUILD_Python_PyBind OFF CACHE BOOL "Build PyBind11 bindings." FORCE)
+  message("Forcing BUILD_Python_Boost and BUILD_Python_PyBind to OFF as no Python libs were found.")
+endif()

-  set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build Shared Libraries" FORCE)
-  message("Forcing BUILD_SHARED_LIBS to OFF as you want a python module.")
-
+if (PythonLibs_FOUND)
+  if(BUILD_Python_Boost OR BUILD_Python_PyBind)
+    set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build Shared Libraries" FORCE)
+    message("Forcing BUILD_SHARED_LIBS to OFF as you want a python module.")
+  endif()
 endif()

 if(BUILD_Python_Boost)


Minor correction in the FindSquirrel file.

--- CMakeModules/FindSquirrel.cmake
+++ CMakeModules/FindSquirrel.cmake
@@ -1,25 +0,0 @@
-FIND_PATH(SQUIRREL_INCLUDE_DIR squirrel.h)
-
-FIND_LIBRARY(SQUIRREL_LIBRARY NAMES squirrel squirrel/libsquirrel.a)
-IF(NOT SQUIRREL_LIBRARY)
-    MESSAGE(SEND_ERROR "Squirrel not found")
-ENDIF(NOT SQUIRREL_LIBRARY)
-
-FIND_LIBRARY(SQUIRREL_STD_LIBRARY NAMES sqstdlib squirrel/libsqstdlib.a)
-IF(NOT SQUIRREL_STD_LIBRARY)
-    MESSAGE(SEND_ERROR "Squirrel not found")
-ENDIF(NOT SQUIRREL_STD_LIBRARY)
-
-IF(SQUIRREL_INCLUDE_DIR AND SQUIRREL_STD_LIBRARY)
-   SET(SQUIRREL_FOUND TRUE)
-ENDIF(SQUIRREL_INCLUDE_DIR AND SQUIRREL_STD_LIBRARY)
-
-IF(SQUIRREL_FOUND)
-   IF (NOT Squirrel_FIND_QUIETLY)
-	   MESSAGE(STATUS "Found Squirrel: ${SQUIRREL_LIBRARY}, ${SQUIRREL_STD_LIBRARY}")
-   ENDIF (NOT Squirrel_FIND_QUIETLY)
-ELSE(SQUIRREL_FOUND)
-   IF (Squirrel_FIND_REQUIRED)
-      MESSAGE(FATAL_ERROR "Could not find Squirrel")
-   ENDIF (Squirrel_FIND_REQUIRED)
-ENDIF(SQUIRREL_FOUND)


use ThriftCppLibrary.cmake from fbcode_builder

Summary:
Update fboss to use `ThriftCppLibrary.cmake` directly from fbcode_builder
rather than maintaining its own copy of this file.

Reviewed By: chadaustin

Differential Revision: D17005421

fbshipit-source-id: a64df426118df6088b47f09410dad7b8b7e79a43

--- build/fbcode_builder/CMake/ThriftCppLibrary.cmake
+++ build/fbcode_builder/CMake/ThriftCppLibrary.cmake
@@ -1,6 +1,4 @@
 # Copyright (c) Facebook, Inc. and its affiliates.
-# NOTE: If you change this file, fbcode/fboss/github/ThriftCppLibrary.cmake also
-# needs to be changed.  TODO: this should be handled via shipit.

 include(FBCMakeParseArgs)


Fixed regular expression (dash character position), added docu.

--- Core/Code/CppMicroServices/CMake/usFunctionGenerateModuleInit.cmake
+++ Core/Code/CppMicroServices/CMake/usFunctionGenerateModuleInit.cmake
@@ -24,6 +24,8 @@
 #!        auto-loading will be disabled for this module.
 #! \param DEPENDS (optional) A string containing module dependencies.
 #! \param VERSION (optional) A version string for the module.
+#! \param EXECUTABLE (flag) A flag indicating that the initialization code is intended for
+#! an executable.
 #!
 function(usFunctionGenerateModuleInit src_var)

@@ -43,7 +45,7 @@
   set(US_MODULE_LIBRARY_NAME ${US_MODULE_NAME})
 endif()

-set(_regex_validation "[a-zA-Z-_][a-zA-Z-_0-9]*")
+set(_regex_validation "[a-zA-Z_-][a-zA-Z_0-9-]*")
 if(US_MODULE_EXECUTABLE)
   string(REGEX MATCH ${_regex_validation} _valid_chars ${US_MODULE_NAME})
   if(NOT _valid_chars STREQUAL US_MODULE_NAME)


suppress unused parameter warning for connext code on os x

--- rosidl_typesupport_connext_cpp/cmake/rosidl_typesupport_connext_cpp_generate_interfaces.cmake
+++ rosidl_typesupport_connext_cpp/cmake/rosidl_typesupport_connext_cpp_generate_interfaces.cmake
@@ -77,6 +77,7 @@
       "-Wno-return-type-c-linkage"
       "-Wno-sometimes-uninitialized"
       "-Wno-tautological-compare"
+      "-Wno-unused-parameter"
       "-Wno-unused-variable"
     )
   elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")


Fix missing GLEW link to OpenCSG

Fix missing GLEW link to OpenCSG

--- deps/OpenCSG/OpenCSG.cmake
+++ deps/OpenCSG/OpenCSG.cmake
@@ -3,4 +3,5 @@
     GIT_REPOSITORY https://github.com/floriankirsch/OpenCSG.git
     GIT_TAG 83e274457b46c9ad11a4ee599203250b1618f3b9 #v1.4.2
     PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt.in ./CMakeLists.txt
+    DEPENDS dep_GLEW
 )


LTO support for clang

LTO support for clang

--- cmake/LTO.cmake
+++ cmake/LTO.cmake
@@ -55,9 +55,8 @@

       message(STATUS "Checking for LTO Compatibility")
       # Since GCC 4.9 we need to use gcc-ar / gcc-ranlib / gcc-nm
-      if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9.0))
-          # LTO/IPO
-          if(NOT CMAKE_GCC_AR OR NOT CMAKE_GCC_RANLIB OR NOT CMAKE_GCC_NM)
+      if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
+          if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_GCC_AR OR NOT CMAKE_GCC_RANLIB OR NOT CMAKE_GCC_NM)
               find_program(CMAKE_GCC_AR NAMES
                 "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar"
                 "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar-${_version}"
@@ -75,9 +74,17 @@
                 DOC "gcc provided wrapper for nm which adds the --plugin option"
               )
               mark_as_advanced(CMAKE_GCC_AR CMAKE_GCC_RANLIB CMAKE_GCC_NM)
+			  set(CMAKE_LTO_AR ${CMAKE_GCC_AR})
+			  set(CMAKE_LTO_RANLIB ${CMAKE_GCC_RANLIB})
+			  set(CMAKE_LTO_NM ${CMAKE_GCC_NM})
           endif()
+		  if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
+			  set(CMAKE_LTO_AR ${CMAKE_AR})
+			  set(CMAKE_LTO_RANLIB ${CMAKE_RANLIB})
+			  set(CMAKE_LTO_NM ${CMAKE_NM})
+		  endif()

-          if(CMAKE_GCC_AR AND CMAKE_GCC_RANLIB)
+          if(CMAKE_LTO_AR AND CMAKE_LTO_RANLIB)
             set(__lto_flags -flto)

             if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4.7)
@@ -100,7 +107,7 @@

               if("${__result}" STREQUAL "0")
                 execute_process(
-                  COMMAND ${CMAKE_GCC_AR} cr "${__output_base}.a" "${__output_base}.o"
+                  COMMAND ${CMAKE_LTO_AR} cr "${__output_base}.a" "${__output_base}.o"
                   RESULT_VARIABLE __result
                   ERROR_QUIET
                   OUTPUT_QUIET
@@ -109,7 +116,7 @@

               if("${__result}" STREQUAL "0")
                 execute_process(
-                  COMMAND ${CMAKE_GCC_RANLIB} "${__output_base}.a"
+                  COMMAND ${CMAKE_LTO_RANLIB} "${__output_base}.a"
                   RESULT_VARIABLE __result
                   ERROR_QUIET
                   OUTPUT_QUIET
@@ -136,11 +143,6 @@
                 "If the compiler passed a simple LTO test compile")
             endif()
             if(CMAKE_${lang}_PASSED_LTO_TEST)
-              # THIS IS HACKY BUT THERE IS NO OTHER SOLUTION ATM
-              set(CMAKE_AR ${CMAKE_GCC_AR} CACHE FILEPATH "Forcing gcc-ar instead of ar" FORCE)
-              set(CMAKE_NM ${CMAKE_GCC_NM} CACHE FILEPATH "Forcing gcc-nm instead of nm" FORCE)
-              set(CMAKE_RANLIB ${CMAKE_GCC_RANLIB} CACHE FILEPATH "Forcing gcc-ranlib instead of ranlib" FORCE)
-
               message(STATUS "Checking for LTO Compatibility - works")
               set(LTO_${lang}_SUPPORT TRUE CACHE BOOL "Do we have LTO support ?")
               set(LTO_COMPILE_FLAGS -flto CACHE STRING "Link Time Optimization compile flags")
@@ -150,6 +152,11 @@
             endif()

           endif()
+		elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
+			message(STATUS "Checking for LTO Compatibility - works (assumed for clang)")
+			set(LTO_${lang}_SUPPORT TRUE CACHE BOOL "Do we have LTO support ?")
+			set(LTO_COMPILE_FLAGS -flto CACHE STRING "Link Time Optimization compile flags")
+			set(LTO_LINK_FLAGS -flto CACHE STRING "Link Time Optimization link flags")
         elseif(MSVC)
             message(STATUS "Checking for LTO Compatibility - works")
             set(LTO_${lang}_SUPPORT TRUE CACHE BOOL "Do we have LTO support ?")
@@ -163,7 +170,12 @@

         set(LTO_${lang}_CHECKED TRUE CACHE INTERNAL "" )
     endif(ENABLE_LTO AND NOT LTO_${lang}_CHECKED)
-
+	if(CMAKE_GCC_AR AND CMAKE_GCC_RANLIB AND CMAKE_GCC_NM)
+		# THIS IS HACKY BUT THERE IS NO OTHER SOLUTION ATM
+		set(CMAKE_AR ${CMAKE_GCC_AR} CACHE FILEPATH "Forcing gcc-ar instead of ar" FORCE)
+		set(CMAKE_NM ${CMAKE_GCC_NM} CACHE FILEPATH "Forcing gcc-nm instead of nm" FORCE)
+		set(CMAKE_RANLIB ${CMAKE_GCC_RANLIB} CACHE FILEPATH "Forcing gcc-ranlib instead of ranlib" FORCE)
+	endif()
     if(NOT TARGET enable_lto)
         add_library(enable_lto INTERFACE)
         if(ENABLE_LTO AND LTO_${lang}_SUPPORT)


cmake: more deterministic git describe --abbrev=12

Hardcode --abbrev=12 not to depend on personal git config preference.
12 is deemed large enough for the Linux kernel which should leave some
room:
https://public-inbox.org/git/xmqq37knwcf4.fsf@gitster.mtv.corp.google.com/

Signed-off-by: Marc Herbert <77e7c7d746b52c6eb01119b65a031ae1f650246d@intel.com>

--- cmake/git.cmake
+++ cmake/git.cmake
@@ -3,7 +3,8 @@
 # https://cmake.org/cmake/help/latest/module/FindGit.html
 find_package(Git QUIET)
 if(GIT_FOUND)
-  execute_process(COMMAND ${GIT_EXECUTABLE} describe
+  execute_process(
+    COMMAND ${GIT_EXECUTABLE} describe --abbrev=12
     WORKING_DIRECTORY                ${ZEPHYR_BASE}
     OUTPUT_VARIABLE                  BUILD_VERSION
     OUTPUT_STRIP_TRAILING_WHITESPACE


COMP: Remove override warnings

COMP: Remove override warnings

Several overridden functions were not marked with
ITK_OVERRIDE.

Change-Id: I7a51c42191522a2ef17d11154cbbefa72a1a18ca

--- Modules/Remote/ParabolicMorphology.remote.cmake
+++ Modules/Remote/ParabolicMorphology.remote.cmake
@@ -5,5 +5,5 @@
   http://www.insight-journal.org/browse/publication/228
   https://hdl.handle.net/1926/1370"
   GIT_REPOSITORY ${git_protocol}://github.com/InsightSoftwareConsortium/parabolicMorphology.git
-  GIT_TAG 8615dfe9781b6b78ea4d172123f8b94416258b67
+  GIT_TAG 3c5fd312a642f7d26663e58d0c7132d50a14eff4
   )


COMP:  opengl: does not check for include dir on win32

--- Modules/ThirdParty/OpenGL/otb-module-init.cmake
+++ Modules/ThirdParty/OpenGL/otb-module-init.cmake
@@ -46,16 +46,18 @@
   mark_as_advanced(OPENGL_LIBRARIES)
 endif(APPLE)

-if(NOT WIN32)
-  if(NOT OPENGL_INCLUDE_DIR)
+
+if(NOT OPENGL_INCLUDE_DIR)
+  if(NOT WIN32)
     message(FATAL_ERROR "Could not find OpenGL (missing: OPENGL_INCLUDE_DIR")
   endif()
-
-  if(NOT OPENGL_gl_LIBRARY)
-    message(FATAL_ERROR "Could not find OpenGL (missing: OPENGL_gl_LIBRARY")
-  endif()
-
-  if(NOT OPENGL_glu_LIBRARY)
-    message(FATAL_ERROR "Could not find OpenGL (missing: OPENGL_glu_LIBRARY")
-  endif()
 endif()
+
+if(NOT OPENGL_gl_LIBRARY)
+  message(FATAL_ERROR "Could not find OpenGL (missing: OPENGL_gl_LIBRARY")
+endif()
+
+if(NOT OPENGL_glu_LIBRARY)
+  message(FATAL_ERROR "Could not find OpenGL (missing: OPENGL_glu_LIBRARY")
+endif()
+


Still dealing with old cmake version incompatibilities

--- scripts/PythonModule.cmake
+++ scripts/PythonModule.cmake
@@ -281,11 +281,17 @@
         "${source}"
         -o "${CMAKE_CURRENT_BINARY_DIR}/${c_source}" ${inclusion}
     )
-    set(cygdb_line "--gdb --gdb-outdir ${PROJECT_BINARY_DIR}/cython_debug_files")
+    if(NOT CMAKE_VERSION VERSION_LESS "2.8.10")
+        set(cygdb_line
+            "--gdb --gdb-outdir ${PROJECT_BINARY_DIR}/cython_debug_files")
+        set(cmdline
+            "$<$<OR:$<CONFIG:RelWithDebInfo>,$<CONFIG:Debug>>:${cygdb_line}>")
+        set(arguments "${arguments} ${cmdline}")
+    endif()
+
     add_custom_command(
         OUTPUT "${c_source}"
         COMMAND ${arguments}
-        $<$<OR:$<CONFIG:RelWithDebInfo>,$<CONFIG:Debug>>:${cygdb_line}>
         WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
         DEPENDS ${DEPENDENCIES}
         COMMENT "Generating c/c++ source ${source} with cython (${directory})"


older cmake versions cannot handle -1 as 'rest of string' in string(SUBSTRING ...) command. Work around that by calculating the string length ourselves.

--- indra/cmake/ConfigurePkgConfig.cmake
+++ indra/cmake/ConfigurePkgConfig.cmake
@@ -61,8 +61,15 @@
   # Also add some non-architecture specific package locations.
   SET(VALID_PKG_LIBDIRS "${VALID_PKG_LIBDIRS}:/usr/share/pkgconfig:/usr/local/share/pkgconfig")

-  # Remove first unwanted ':'
-  string(SUBSTRING ${VALID_PKG_LIBDIRS} 1 -1 VALID_PKG_LIBDIRS)
+  # Remove first unwanted ':'
+# <FS:ND> using -1 for remaining lengh is only valid since cmake 2.8,5
+#  string(SUBSTRING ${VALID_PKG_LIBDIRS} 1 -1 VALID_PKG_LIBDIRS)
+
+  string( LENGTH ${VALID_PKG_LIBDIRS} VALID_PKG_LIBDIRS_LENGTH )
+  math( EXPR VALID_PKG_LIBDIRS_LENGTH ${VALID_PKG_LIBDIRS_LENGTH}-1 )
+  string( SUBSTRING ${VALID_PKG_LIBDIRS} 1 ${VALID_PKG_LIBDIRS_LENGTH} VALID_PKG_LIBDIRS )
+
+# </FS:ND>

   # Set PKG_CONFIG_LIBDIR environment.
   SET(ENV{PKG_CONFIG_LIBDIR} ${VALID_PKG_LIBDIRS})


Remove comments

Remove comments

--- Modules/ManageTranslation.cmake
+++ Modules/ManageTranslation.cmake
@@ -320,7 +320,6 @@

     MANAGE_POT_FILE_OBTAIN_TARGET_NAME(targetName "${potFile}")

-    MESSAGE("## targetName=${targetName}")
     ADD_CUSTOM_TARGET_COMMAND(${targetName}
 	OUTPUT ${potFile}
 	NO_FORCE
@@ -428,7 +427,6 @@
 	MANAGE_POT_FILE("${_o_POT_FILE}" ${_addPotFileOptList})
     ENDIF()

-    MESSAGE("## MANAGE_TRANSLATION_GETTEXT_POT_FILES=${MANAGE_TRANSLATION_GETTEXT_POT_FILES}")
     ## Do we need to create the pot file?
     IF("${MANAGE_TRANSLATION_GETTEXT_POT_FILES}" STREQUAL "")
 	## Yes, use the default pot file, and create it


Electron variant fix

Electron variant fix

Electron variant condition was incorrect for COMPONENTS usage.

--- variants/Electron.cmake
+++ variants/Electron.cmake
@@ -2,7 +2,7 @@
 set(ELECTRON_WIN32_BINARY_NAME "${ELECTRON_VARIANT_BASE}.exe")
 list(APPEND NodeJS_WIN32_DELAYLOAD ${ELECTRON_WIN32_BINARY_NAME})

-if(NodeJS_FIND_REQUIRED_IOJS OR
+if(NodeJS_FIND_REQUIRED_ELECTRON OR
    NodeJS_VARIANT STREQUAL ${ELECTRON_VARIANT_BASE})
     if(NodeJS_VERSION STREQUAL "latest")
         include(Github)


BUG: multiple call to install_rule?

BUG: multiple call to install_rule?

--- Packaging/process_file_recurse.cmake
+++ Packaging/process_file_recurse.cmake
@@ -21,7 +21,7 @@
     message("Processing ${input_file_full_path}")
   endif()

-  install_rule(${input_file_full_path})
+  #install_rule(${input_file_full_path})

   set(raw_items)


zstd fails to compile with gcc 7.2.0 due to unannotated switch case fall through statements.  the code can be annotated or the fall through warnings can be ignored.  this patch ignores the fall through warnings in the zstd module since later versions of zstd (1.3.2) have the annotations but we dont want to switch to that version yet.

--- third_party/zstd-1.1.0/CMakeModules/AddExtraCompilationFlags.cmake
+++ third_party/zstd-1.1.0/CMakeModules/AddExtraCompilationFlags.cmake
@@ -93,6 +93,15 @@
             MESSAGE("Compiler flag ${WARNING_SIGN_CONVERSION} not allowed")
         endif (WARNING_SIGN_CONVERSION_ALLOWED)

+        set(WARNING_FALLTHROUGH "-Wimplicit-fallthrough=0")
+        CHECK_C_COMPILER_FLAG(${WARNING_FALLTHROUGH} WARNING_FALLTHROUGH_ALLOWED)
+        if (WARNING_FALLTHROUGH_ALLOWED)
+            MESSAGE("Compiler flag ${WARNING_FALLTHROUGH} allowed")
+            set(ACTIVATE_WARNING_FALLTHROUGH "ON" CACHE BOOL "activate -Wimplicit-fallthrough=0 flag")
+        else ()
+            MESSAGE("Compiler flag ${WARNING_FALLTHROUGH} not allowed")
+        endif (WARNING_FALLTHROUGH_ALLOWED)
+
         if (ACTIVATE_POSITION_INDEPENDENT_CODE_FLAG)
             list(APPEND CMAKE_C_FLAGS ${POSITION_INDEPENDENT_CODE_FLAG})
         else ()
@@ -170,6 +179,14 @@
             string(REPLACE ${WARNING_SIGN_CONVERSION} "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
             string(REPLACE ${WARNING_SIGN_CONVERSION} "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
         endif (ACTIVATE_WARNING_SIGN_CONVERSION)
+
+        if (ACTIVATE_WARNING_FALLTHROUGH)
+            list(APPEND CMAKE_CXX_FLAGS ${WARNING_FALLTHROUGH})
+            list(APPEND CMAKE_C_FLAGS ${WARNING_FALLTHROUGH})
+        else ()
+            string(REPLACE ${WARNING_FALLTHROUGH} "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+            string(REPLACE ${WARNING_FALLTHROUGH} "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
+        endif (ACTIVATE_WARNING_FALLTHROUGH)

         #Set c++11 by default
         list(APPEND CMAKE_CXX_FLAGS "-std=c++11")


Use CMake list instead of hand-crafting strings

--- cmake/FindCAF.cmake
+++ cmake/FindCAF.cmake
@@ -21,18 +21,6 @@
 if(CAF_FIND_COMPONENTS STREQUAL "")
   message(FATAL_ERROR "FindCAF requires at least one COMPONENT.")
 endif()
-
-macro(add_include_dir new_dir)
-  set(duplicate false)
-  foreach (p ${CAF_INCLUDE_DIRS})
-    if (${p} STREQUAL ${new_dir})
-      set(duplicate true)
-    endif ()
-  endforeach ()
-  if (NOT duplicate)
-    set(CAF_INCLUDE_DIRS ${CAF_INCLUDE_DIRS} ${new_dir})
-  endif()
-endmacro()

 # iterate over user-defined components
 foreach (comp ${CAF_FIND_COMPONENTS})
@@ -83,10 +71,10 @@
         message(WARNING "Found all.hpp for CAF core, but not build_config.hpp")
         set(CAF_${comp}_FOUND false)
       else()
-        add_include_dir("${caf_build_header_path}")
+        list(APPEND CAF_INCLUDE_DIRS "${caf_build_header_path}")
       endif()
     endif()
-    add_include_dir("${CAF_INCLUDE_DIR_${UPPERCOMP}}")
+    list(APPEND CAF_INCLUDE_DIRS "${CAF_INCLUDE_DIR_${UPPERCOMP}}")
     # look for (.dll|.so|.dylib) file, again giving hints for non-installed CAFs
     # skip probe_event as it is header only
     if (NOT ${comp} STREQUAL "probe_event" AND NOT ${comp} STREQUAL "test")
@@ -114,6 +102,8 @@
   endif ()
 endforeach ()

+list(REMOVE_DUPLICATES CAF_INCLUDE_DIRS)
+
 # let CMake check whether all requested components have been found
 include(FindPackageHandleStandardArgs)
 find_package_handle_standard_args(CAF


Update FindHIP.cmake

Update FindHIP.cmake

Using Bool expression to handle empty case.

--- cmake/FindHIP.cmake
+++ cmake/FindHIP.cmake
@@ -36,7 +36,7 @@
 set(CMAKE_SHARED_LIBRARY_LINK_HIP_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS})
 set(CMAKE_SHARED_LIBRARY_RUNTIME_HIP_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG})
 set(CMAKE_SHARED_LIBRARY_RUNTIME_HIP_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP})
-set(CMAKE_SHARED_LIBRARY_LINK_STATIC_HIP_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_STATIC_CXX_FLAGS})
+set(CMAKE_SHARED_LIBRARY_LINK_STATIC_HIP_FLAGS ${CMAKE_SHARED_LIBRARY_LIN$K_STATIC_CXX_FLAGS})
 set(CMAKE_SHARED_LIBRARY_LINK_DYNAMIC_HIP_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_DYNAMIC_CXX_FLAGS})

 # Set the CMake Flags to use the HCC Compilier.
@@ -393,7 +393,8 @@
     set(HIP_HIPCC_INCLUDE_ARGS ${HIP_HIPCC_INCLUDE_ARGS_USER})

     # Add the include directories
-    list(APPEND HIP_HIPCC_INCLUDE_ARGS "-I$<JOIN:$<TARGET_PROPERTY:${_target},INCLUDE_DIRECTORIES>, -I>")
+    set(include_directories_generator "$<TARGET_PROPERTY:${_target},INCLUDE_DIRECTORIES>")
+    list(APPEND HIP_HIPCC_INCLUDE_ARGS "$<$<BOOL:${include_directories_generator}>:-I$<JOIN:${include_directories_generator}, -I>>")

     get_directory_property(_hip_include_directories INCLUDE_DIRECTORIES)
     list(REMOVE_DUPLICATES _hip_include_directories)
@@ -409,7 +410,8 @@
     HIP_PARSE_HIPCC_OPTIONS(HIP_NVCC_FLAGS ${_nvcc_options})

     # Add the compile definitions
-    list(APPEND HIP_HIPCC_FLAGS "-D$<JOIN:$<TARGET_PROPERTY:${_target},COMPILE_DEFINITIONS>, -D>")
+    set(compile_definition_generator "$<TARGET_PROPERTY:${_target},COMPILE_DEFINITIONS>")
+    list(APPEND HIP_HIPCC_FLAGS "$<$<BOOL:${compile_definition_generator}>:-D$<JOIN:${compile_definition_generator}, -D>>")

     # Check if we are building shared library.
     set(_hip_build_shared_libs FALSE)


Update the vendored FindLua.cmake

Update the vendored FindLua.cmake

The existing version of the find module could not handle Lua 5.4 for
MSVC. This version comes from CMake 3.19.

I had to patch one line:

-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)

--- cmake/FindLua.cmake
+++ cmake/FindLua.cmake
@@ -1,170 +1,238 @@
-#.rst:
-# FindLua
-# -------
-#
-#
-#
-# Locate Lua library This module defines
-#
-# ::
-#
-#   LUA_FOUND          - if false, do not try to link to Lua
-#   LUA_LIBRARIES      - both lua and lualib
-#   LUA_INCLUDE_DIR    - where to find lua.h
-#   LUA_VERSION_STRING - the version of Lua found
-#   LUA_VERSION_MAJOR  - the major version of Lua
-#   LUA_VERSION_MINOR  - the minor version of Lua
-#   LUA_VERSION_PATCH  - the patch version of Lua
-#
-#
-#
-# Note that the expected include convention is
-#
-# ::
-#
-#   #include "lua.h"
-#
-# and not
-#
-# ::
-#
-#   #include <lua/lua.h>
-#
-# This is because, the lua location is not standardized and may exist in
-# locations other than lua/
-
-#=============================================================================
-# Copyright 2007-2009 Kitware, Inc.
-# Copyright 2013 Rolf Eike Beer <eike@sf-mail.de>
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distribute this file outside of CMake, substitute the full
-#  License text for the above reference.)
+# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+#[=======================================================================[.rst:
+FindLua
+-------
+
+
+
+Locate Lua library.
+
+This module defines::
+
+::
+
+  LUA_FOUND          - if false, do not try to link to Lua
+  LUA_LIBRARIES      - both lua and lualib
+  LUA_INCLUDE_DIR    - where to find lua.h
+  LUA_VERSION_STRING - the version of Lua found
+  LUA_VERSION_MAJOR  - the major version of Lua
+  LUA_VERSION_MINOR  - the minor version of Lua
+  LUA_VERSION_PATCH  - the patch version of Lua
+
+
+
+Note that the expected include convention is
+
+::
+
+  #include "lua.h"
+
+and not
+
+::
+
+  #include <lua/lua.h>
+
+This is because, the lua location is not standardized and may exist in
+locations other than lua/
+#]=======================================================================]
+
+cmake_policy(PUSH)  # Policies apply to functions at definition-time
+cmake_policy(SET CMP0012 NEW)  # For while(TRUE)

 unset(_lua_include_subdirs)
 unset(_lua_library_names)
+unset(_lua_append_versions)

 # this is a function only to have all the variables inside go away automatically
-function(set_lua_version_vars)
-    set(LUA_VERSIONS5 5.3 5.2 5.1 5.0)
+function(_lua_get_versions)
+    set(LUA_VERSIONS5 5.4 5.3 5.2 5.1 5.0)

     if (Lua_FIND_VERSION_EXACT)
         if (Lua_FIND_VERSION_COUNT GREATER 1)
-            set(lua_append_versions ${Lua_FIND_VERSION_MAJOR}.${Lua_FIND_VERSION_MINOR})
+            set(_lua_append_versions ${Lua_FIND_VERSION_MAJOR}.${Lua_FIND_VERSION_MINOR})
         endif ()
     elseif (Lua_FIND_VERSION)
         # once there is a different major version supported this should become a loop
         if (NOT Lua_FIND_VERSION_MAJOR GREATER 5)
             if (Lua_FIND_VERSION_COUNT EQUAL 1)
-                set(lua_append_versions ${LUA_VERSIONS5})
+                set(_lua_append_versions ${LUA_VERSIONS5})
             else ()
                 foreach (subver IN LISTS LUA_VERSIONS5)
                     if (NOT subver VERSION_LESS ${Lua_FIND_VERSION})
-                        list(APPEND lua_append_versions ${subver})
+                        list(APPEND _lua_append_versions ${subver})
                     endif ()
                 endforeach ()
+                # New version -> Search for it (heuristic only! Defines in include might have changed)
+                if (NOT _lua_append_versions)
+                    set(_lua_append_versions ${Lua_FIND_VERSION_MAJOR}.${Lua_FIND_VERSION_MINOR})
+                endif()
             endif ()
         endif ()
     else ()
         # once there is a different major version supported this should become a loop
-        set(lua_append_versions ${LUA_VERSIONS5})
+        set(_lua_append_versions ${LUA_VERSIONS5})
     endif ()

-    foreach (ver IN LISTS lua_append_versions)
-        string(REGEX MATCH "^([0-9]+)\\.([0-9]+)$" _ver "${ver}")
-        list(APPEND _lua_include_subdirs
-             include/lua${CMAKE_MATCH_1}${CMAKE_MATCH_2}
-             include/lua${CMAKE_MATCH_1}.${CMAKE_MATCH_2}
-             include/lua-${CMAKE_MATCH_1}.${CMAKE_MATCH_2}
+    if (LUA_Debug)
+        message(STATUS "Considering following Lua versions: ${_lua_append_versions}")
+    endif()
+
+    set(_lua_append_versions "${_lua_append_versions}" PARENT_SCOPE)
+endfunction()
+
+function(_lua_set_version_vars)
+  set(_lua_include_subdirs_raw "lua")
+
+  foreach (ver IN LISTS _lua_append_versions)
+    string(REGEX MATCH "^([0-9]+)\\.([0-9]+)$" _ver "${ver}")
+    list(APPEND _lua_include_subdirs_raw
+        lua${CMAKE_MATCH_1}${CMAKE_MATCH_2}
+        lua${CMAKE_MATCH_1}.${CMAKE_MATCH_2}
+        lua-${CMAKE_MATCH_1}.${CMAKE_MATCH_2}
         )
-        list(APPEND _lua_library_names
-             lua${CMAKE_MATCH_1}${CMAKE_MATCH_2}
-             lua${CMAKE_MATCH_1}.${CMAKE_MATCH_2}
-             lua-${CMAKE_MATCH_1}.${CMAKE_MATCH_2}
+  endforeach ()
+
+  # Prepend "include/" to each path directly after the path
+  set(_lua_include_subdirs "include")
+  foreach (dir IN LISTS _lua_include_subdirs_raw)
+    list(APPEND _lua_include_subdirs "${dir}" "include/${dir}")
+  endforeach ()
+
+  set(_lua_include_subdirs "${_lua_include_subdirs}" PARENT_SCOPE)
+endfunction(_lua_set_version_vars)
+
+function(_lua_get_header_version)
+  unset(LUA_VERSION_STRING PARENT_SCOPE)
+  set(_hdr_file "${LUA_INCLUDE_DIR}/lua.h")
+
+  if (NOT EXISTS "${_hdr_file}")
+    return()
+  endif ()
+
+  # At least 5.[012] have different ways to express the version
+  # so all of them need to be tested. Lua 5.2 defines LUA_VERSION
+  # and LUA_RELEASE as joined by the C preprocessor, so avoid those.
+  file(STRINGS "${_hdr_file}" lua_version_strings
+       REGEX "^#define[ \t]+LUA_(RELEASE[ \t]+\"Lua [0-9]|VERSION([ \t]+\"Lua [0-9]|_[MR])).*")
+
+  string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MAJOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MAJOR ";${lua_version_strings};")
+  if (LUA_VERSION_MAJOR MATCHES "^[0-9]+$")
+    string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MINOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MINOR ";${lua_version_strings};")
+    string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_RELEASE[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_PATCH ";${lua_version_strings};")
+    set(LUA_VERSION_STRING "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}.${LUA_VERSION_PATCH}")
+  else ()
+    string(REGEX REPLACE ".*;#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};")
+    if (NOT LUA_VERSION_STRING MATCHES "^[0-9.]+$")
+      string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};")
+    endif ()
+    string(REGEX REPLACE "^([0-9]+)\\.[0-9.]*$" "\\1" LUA_VERSION_MAJOR "${LUA_VERSION_STRING}")
+    string(REGEX REPLACE "^[0-9]+\\.([0-9]+)[0-9.]*$" "\\1" LUA_VERSION_MINOR "${LUA_VERSION_STRING}")
+    string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]).*" "\\1" LUA_VERSION_PATCH "${LUA_VERSION_STRING}")
+  endif ()
+  foreach (ver IN LISTS _lua_append_versions)
+    if (ver STREQUAL "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}")
+      set(LUA_VERSION_MAJOR ${LUA_VERSION_MAJOR} PARENT_SCOPE)
+      set(LUA_VERSION_MINOR ${LUA_VERSION_MINOR} PARENT_SCOPE)
+      set(LUA_VERSION_PATCH ${LUA_VERSION_PATCH} PARENT_SCOPE)
+      set(LUA_VERSION_STRING ${LUA_VERSION_STRING} PARENT_SCOPE)
+      return()
+    endif ()
+  endforeach ()
+endfunction(_lua_get_header_version)
+
+function(_lua_find_header)
+  _lua_set_version_vars()
+
+  # Initialize as local variable
+  set(CMAKE_IGNORE_PATH ${CMAKE_IGNORE_PATH})
+  while (TRUE)
+    # Find the next header to test. Check each possible subdir in order
+    # This prefers e.g. higher versions as they are earlier in the list
+    # It is also consistent with previous versions of FindLua
+    foreach (subdir IN LISTS _lua_include_subdirs)
+      find_path(LUA_INCLUDE_DIR lua.h
+        HINTS ENV LUA_DIR
+        PATH_SUFFIXES ${subdir}
         )
-    endforeach ()
-
-    set(_lua_include_subdirs "${_lua_include_subdirs}" PARENT_SCOPE)
-    set(_lua_library_names "${_lua_library_names}" PARENT_SCOPE)
-endfunction(set_lua_version_vars)
-
-set_lua_version_vars()
-
-find_path(LUA_INCLUDE_DIR lua.h
-  HINTS
-    ENV LUA_DIR
-  PATH_SUFFIXES include/lua ${_lua_include_subdirs} include
-  PATHS
-  ~/Library/Frameworks
-  /Library/Frameworks
-  /sw # Fink
-  /opt/local # DarwinPorts
-  /opt/csw # Blastwave
-  /opt
-)
-unset(_lua_include_subdirs)
+      if (LUA_INCLUDE_DIR)
+        break()
+      endif()
+    endforeach()
+    # Did not found header -> Fail
+    if (NOT LUA_INCLUDE_DIR)
+      return()
+    endif()
+    _lua_get_header_version()
+    # Found accepted version -> Ok
+    if (LUA_VERSION_STRING)
+      if (LUA_Debug)
+        message(STATUS "Found suitable version ${LUA_VERSION_STRING} in ${LUA_INCLUDE_DIR}/lua.h")
+      endif()
+      return()
+    endif()
+    # Found wrong version -> Ignore this path and retry
+    if (LUA_Debug)
+      message(STATUS "Ignoring unsuitable version in ${LUA_INCLUDE_DIR}")
+    endif()
+    list(APPEND CMAKE_IGNORE_PATH "${LUA_INCLUDE_DIR}")
+    unset(LUA_INCLUDE_DIR CACHE)
+    unset(LUA_INCLUDE_DIR)
+    unset(LUA_INCLUDE_DIR PARENT_SCOPE)
+  endwhile ()
+endfunction()
+
+_lua_get_versions()
+_lua_find_header()
+_lua_get_header_version()
+unset(_lua_append_versions)
+
+if (LUA_VERSION_STRING)
+  set(_lua_library_names
+    lua${LUA_VERSION_MAJOR}${LUA_VERSION_MINOR}
+    lua${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}
+    lua-${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}
+    lua.${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}
+    )
+endif ()

 find_library(LUA_LIBRARY
-  NAMES lua ${_lua_library_names}
+  NAMES ${_lua_library_names} lua
+  NAMES_PER_DIR
   HINTS
     ENV LUA_DIR
   PATH_SUFFIXES lib
-  PATHS
-  ~/Library/Frameworks
-  /Library/Frameworks
-  /sw
-  /opt/local
-  /opt/csw
-  /opt
 )
 unset(_lua_library_names)

 if (LUA_LIBRARY)
-    # include the math library for Unix
-    if (UNIX AND NOT APPLE AND NOT BEOS)
-        find_library(LUA_MATH_LIBRARY m)
-        set(LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}")
-    # For Windows and Mac, don't need to explicitly include the math library
-    else ()
-        set(LUA_LIBRARIES "${LUA_LIBRARY}")
-    endif ()
+  # include the math library for Unix
+  if (UNIX AND NOT APPLE AND NOT BEOS)
+    find_library(LUA_MATH_LIBRARY m)
+    mark_as_advanced(LUA_MATH_LIBRARY)
+    set(LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}")
+
+    # include dl library for statically-linked Lua library
+    get_filename_component(LUA_LIB_EXT ${LUA_LIBRARY} EXT)
+    if(LUA_LIB_EXT STREQUAL CMAKE_STATIC_LIBRARY_SUFFIX)
+      list(APPEND LUA_LIBRARIES ${CMAKE_DL_LIBS})
+    endif()
+
+  # For Windows and Mac, don't need to explicitly include the math library
+  else ()
+    set(LUA_LIBRARIES "${LUA_LIBRARY}")
+  endif ()
 endif ()

-if (LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h")
-    # At least 5.[012] have different ways to express the version
-    # so all of them need to be tested. Lua 5.2 defines LUA_VERSION
-    # and LUA_RELEASE as joined by the C preprocessor, so avoid those.
-    file(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_strings
-         REGEX "^#define[ \t]+LUA_(RELEASE[ \t]+\"Lua [0-9]|VERSION([ \t]+\"Lua [0-9]|_[MR])).*")
-
-    string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MAJOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MAJOR ";${lua_version_strings};")
-    if (LUA_VERSION_MAJOR MATCHES "^[0-9]+$")
-        string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MINOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MINOR ";${lua_version_strings};")
-        string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_RELEASE[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_PATCH ";${lua_version_strings};")
-        set(LUA_VERSION_STRING "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}.${LUA_VERSION_PATCH}")
-    else ()
-        string(REGEX REPLACE ".*;#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};")
-        if (NOT LUA_VERSION_STRING MATCHES "^[0-9.]+$")
-            string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};")
-        endif ()
-        string(REGEX REPLACE "^([0-9]+)\\.[0-9.]*$" "\\1" LUA_VERSION_MAJOR "${LUA_VERSION_STRING}")
-        string(REGEX REPLACE "^[0-9]+\\.([0-9]+)[0-9.]*$" "\\1" LUA_VERSION_MINOR "${LUA_VERSION_STRING}")
-        string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]).*" "\\1" LUA_VERSION_PATCH "${LUA_VERSION_STRING}")
-    endif ()
-
-    unset(lua_version_strings)
-endif()
-
+include(FindPackageHandleStandardArgs)
 # handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if
 # all listed variables are TRUE
 FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua
                                   REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR
                                   VERSION_VAR LUA_VERSION_STRING)

-mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARY LUA_MATH_LIBRARY)
+mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARY)
+
+cmake_policy(POP)


Add support for ICC 16

Add support for ICC 16

Signed-off-by: Matthias Kretz <372ea4eca737a13cd010ee806d4ce7b98ee71550@kde.org>

--- cmake/FindMIC.cmake
+++ cmake/FindMIC.cmake
@@ -44,7 +44,11 @@
 set(MIC_FOUND false)
 set(MIC_NATIVE_FOUND false)

-file(GLOB _intel_dirs "/opt/intel/composer_xe_*")
+file(GLOB _intel_dirs "/opt/intel/compilers_and_libraries_*/linux")
+if ("${_intel_dirs}" STREQUAL "")
+  file(GLOB _intel_dirs "/opt/intel/composer_xe_*")
+endif()
+
 list(SORT _intel_dirs)
 list(REVERSE _intel_dirs)
 find_path(MIC_SDK_DIR bin/intel64_mic/icpc PATHS


Remove status message when copying files. Improve ability to copy files from a specific configuration.

--- cmake/Scripts.cmake
+++ cmake/Scripts.cmake
@@ -20,12 +20,13 @@
   # Loop through optional arguments
   foreach(src_file ${ARGN})
     file(APPEND ${script_filename} "
-if(EXISTS \"${src_file}\")
-  message(STATUS \"Copying '${src_file}' to '${destination}'\")
-  file(COPY \"${src_file}\" DESTINATION \"${destination}\")
-endif(EXISTS \"${src_file}\")
+string(REPLACE \"\$(Configuration)\" \"\${CONFIG}\" filename \"${src_file}\")
+if(EXISTS \${filename})
+  file(COPY \${filename} DESTINATION ${destination})
+endif(EXISTS \${filename})
 ")
   endforeach(src_file ${ARGN})
+
 endfunction(ScriptCopyBinaries)

 # Name: ScriptDownloadFile


remove libwarpctc.so in core.so and libpaddle_fluid.so

--- cmake/generic.cmake
+++ cmake/generic.cmake
@@ -186,6 +186,11 @@
       add_library(${TARGET_NAME} STATIC ${cc_library_SRCS})
     endif()
     if (cc_library_DEPS)
+      # Don't need link libwarpctc.so
+      if ("${cc_library_DEPS};" MATCHES "warpctc;")
+        list(REMOVE_ITEM cc_library_DEPS warpctc)
+        add_dependencies(${TARGET_NAME} warpctc)
+      endif()
       add_dependencies(${TARGET_NAME} ${cc_library_DEPS})
       target_link_libraries(${TARGET_NAME} ${cc_library_DEPS})
     endif()