FindEigen3.cmake : search for package only if EIGEN3_INCLUDE_DIR is not already defined

--- cmake/FindEigen3.cmake
+++ cmake/FindEigen3.cmake
@@ -35,11 +35,6 @@
   set(Eigen3_FIND_VERSION "${Eigen3_FIND_VERSION_MAJOR}.${Eigen3_FIND_VERSION_MINOR}.${Eigen3_FIND_VERSION_PATCH}")
 endif(NOT Eigen3_FIND_VERSION)

-# search first if an Eigen3Config.cmake is available in the system,
-# if successful this would set EIGEN3_INCLUDE_DIR and the rest of
-# the script will work as usual
-find_package(Eigen3 ${Eigen3_FIND_VERSION} NO_MODULE QUIET)
-
 macro(_eigen3_check_version)
   file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen3_version_header)

@@ -71,16 +66,23 @@
   set(EIGEN3_FOUND ${EIGEN3_VERSION_OK})

 else (EIGEN3_INCLUDE_DIR)
+
+  # search first if an Eigen3Config.cmake is available in the system,
+  # if successful this would set EIGEN3_INCLUDE_DIR and the rest of
+  # the script will work as usual
+  find_package(Eigen3 ${Eigen3_FIND_VERSION} NO_MODULE QUIET)

-  find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library
-      HINTS
-      ENV EIGEN3_ROOT
-      ENV EIGEN3_ROOT_DIR
-      PATHS
-      ${CMAKE_INSTALL_PREFIX}/include
-      ${KDE4_INCLUDE_DIR}
-      PATH_SUFFIXES eigen3 eigen
-    )
+  if(NOT EIGEN3_INCLUDE_DIR)
+    find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library
+        HINTS
+        ENV EIGEN3_ROOT
+        ENV EIGEN3_ROOT_DIR
+        PATHS
+        ${CMAKE_INSTALL_PREFIX}/include
+        ${KDE4_INCLUDE_DIR}
+        PATH_SUFFIXES eigen3 eigen
+      )
+  endif(NOT EIGEN3_INCLUDE_DIR)

   if(EIGEN3_INCLUDE_DIR)
     _eigen3_check_version()


Add new Matlab versions to MATLAB_VERSIONS_MAPPING


Remove un-needed libraries from FindRadium.cmake

--- cmake/FindRadium.cmake
+++ cmake/FindRadium.cmake
@@ -132,10 +132,10 @@
   list(APPEND RADIUM_INCLUDE_DIRS "${RADIUM_SRC_DIR}" "${EIGEN3_INCLUDE_DIR}" "${ASSIMP_INCLUDE_DIR}" "${GLBINDING_INCLUDE_DIR}" "${GLOBJECTS_INCLUDE_DIR}")

   set( RADIUM_LIBRARIES )
-  if ( RA_CORE_LIB AND RA_ENGINE_LIB AND RA_IO_LIB AND RA_GUIBASE_LIB AND RA_PLUGINBASE_LIB AND ASSIMP_LIBRARIES AND GLBINDING_LIBRARIES AND GLOBJECTS_LIBRARIES)
+  if (RA_CORE_LIB AND RA_ENGINE_LIB AND RA_IO_LIB AND RA_GUIBASE_LIB AND RA_PLUGINBASE_LIB)
     list(APPEND RADIUM_LIBRARIES "${RA_CORE_LIB}" "${RA_ENGINE_LIB}" "${RA_IO_LIB}" "${RA_GUIBASE_LIB}" "${RA_PLUGINBASE_LIB}")
     set ( Radium_Libs_FOUND TRUE)
-  endif ( RA_CORE_LIB AND RA_ENGINE_LIB AND RA_IO_LIB AND RA_GUIBASE_LIB AND RA_PLUGINBASE_LIB AND ASSIMP_LIBRARIES AND GLBINDING_LIBRARIES AND GLOBJECTS_LIBRARIES)
+  endif (RA_CORE_LIB AND RA_ENGINE_LIB AND RA_IO_LIB AND RA_GUIBASE_LIB AND RA_PLUGINBASE_LIB)
 endif( RADIUM_ROOT_DIR )

 if ( Radium_FOUND )


Correctly rename the cmake testing function

A previous CL did most of the rename, but the function name was accidentally reverted before the change went in.

PiperOrigin-RevId: 298442235

--- cmake/test_rules.cmake
+++ cmake/test_rules.cmake
@@ -24,7 +24,7 @@
 #
 # Defines a new test executable target with the given target name, sources, and
 # dependencies.  Implicitly adds DEPENDS on gtest and gtest_main.
-function(cc_test name)
+function(firebase_cpp_cc_test name)
   if (ANDROID OR IOS)
     return()
   endif()


remove message

remove message

--- cmakefiles/cpp11.cmake
+++ cmakefiles/cpp11.cmake
@@ -30,7 +30,7 @@

    CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
    CHECK_CXX_COMPILER_FLAG("-std=c++1y" COMPILER_SUPPORTS_CXX1Y)
-   message("before")
+
    if(${COMPILER_VERSION_CHK})
       if(COMPILER_SUPPORTS_CXX1Y)
          list(INSERT CMAKE_CXX_FLAGS 0 "-std=c++1y")


Added definitions variables for release and debug builds.

--- FindTBB.cmake
+++ FindTBB.cmake
@@ -237,11 +237,10 @@
   ##################################
   # Set compile flags
   ##################################
-
-  if(TBB_tbb_LIBRARY MATCHES "debug")
-    set(TBB_DEFINITIONS "-DTBB_USE_DEBUG=1")
-  endif()
-
+
+  set(TBB_DEFINITIONS_RELEASE "")
+  set(TBB_DEFINITIONS_DEBUG "-DTBB_USE_DEBUG=1")
+  set(TBB_DEFINITIONS "${TBB_DEFINITIONS_${TBB_BUILD_TYPE}}")

   find_package_handle_standard_args(TBB
       REQUIRED_VARS TBB_INCLUDE_DIRS TBB_LIBRARIES


Turn off debug assertions in RelWithDebInfo builds.

--- cmake/DaemonFlags.cmake
+++ cmake/DaemonFlags.cmake
@@ -330,6 +330,6 @@
 endif()

 # Configuration specific definitions
-if (CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo)
+if (CMAKE_BUILD_TYPE STREQUAL Debug)
     add_definitions(-DDEBUG_BUILD)
 endif()


Check MSVC_RUNTIME only if MSVC is defined

On MinGW, WIN32 is set but not MSVC

--- cmake/FindOpenSSL.cmake
+++ cmake/FindOpenSSL.cmake
@@ -63,13 +63,13 @@
     include
 )

-IF(WIN32)
+IF(MSVC)
   if(${MSVC_RUNTIME} STREQUAL "static")
     set(MSVC_RUNTIME_SUFFIX "MT")
   else()
     set(MSVC_RUNTIME_SUFFIX "MD")
   endif()
-ENDIF(WIN32)
+ENDIF(MSVC)

 IF(ANDROID)
     FIND_LIBRARY(OPENSSL_LIBRARIES


add BLAS dependency in FindSuperLU.cmake

--HG--
extra : convert_revision : svn%3A283d02a7-25f6-0310-bc7c-ecb5cbfe19da/trunk/kdesupport/eigen2%40907535

--- cmake/FindSuperLU.cmake
+++ cmake/FindSuperLU.cmake
@@ -3,19 +3,29 @@
   set(SUPERLU_FIND_QUIETLY TRUE)
 endif (SUPERLU_INCLUDES AND SUPERLU_LIBRARIES)

-find_path(SUPERLU_INCLUDES
-  NAMES
-  superlu/supermatrix.h
-  PATHS
-  $ENV{SUPERLUDIR}
-  ${INCLUDE_INSTALL_DIR}
-)
+find_package(BLAS)

-find_library(SUPERLU_LIBRARIES superlu PATHS $ENV{SUPERLUDIR} ${LIB_INSTALL_DIR})
+if(BLAS_FOUND)
+
+  find_path(SUPERLU_INCLUDES
+    NAMES
+    superlu/supermatrix.h
+    PATHS
+    $ENV{SUPERLUDIR}
+    ${INCLUDE_INSTALL_DIR}
+  )

-if(SUPERLU_LIBRARIES AND CMAKE_COMPILER_IS_GNUCXX)
-  set(SUPERLU_LIBRARIES ${SUPERLU_LIBRARIES} -lgfortran)
-endif(SUPERLU_LIBRARIES AND CMAKE_COMPILER_IS_GNUCXX)
+  find_library(SUPERLU_LIBRARIES superlu PATHS $ENV{SUPERLUDIR} ${LIB_INSTALL_DIR})
+
+  if(SUPERLU_LIBRARIES AND CMAKE_COMPILER_IS_GNUCXX)
+    set(SUPERLU_LIBRARIES ${SUPERLU_LIBRARIES} -lgfortran)
+  endif(SUPERLU_LIBRARIES AND CMAKE_COMPILER_IS_GNUCXX)
+
+  if(SUPERLU_LIBRARIES)
+    set(SUPERLU_LIBRARIES ${SUPERLU_LIBRARIES} ${BLAS_LIBRARIES})
+  endif(SUPERLU_LIBRARIES)
+
+endif(BLAS_FOUND)

 include(FindPackageHandleStandardArgs)
 find_package_handle_standard_args(SUPERLU DEFAULT_MSG


fixed windows cmake install issues

fixed windows cmake install issues

--- cmake/InstallFAST.cmake
+++ cmake/InstallFAST.cmake
@@ -87,10 +87,7 @@
     QtEventDispatcherSupport
     QtFbSupport
     QtFontDatabaseSupport
-    QtGlxSupport
     QtGui
-    QtInputSupport
-    QtKmsSupport
     QtMultimedia
     QtMultimediaWidgets
     QtNetwork
@@ -100,13 +97,20 @@
     QtPlatformHeaders
     QtPrintSupport
     QtSerialPort
-    QtServiceSupport
     QtSql
     QtTest
     QtThemeSupport
     QtWidgets
     QtXml
     QtZlib)
+if(NOT WIN32)
+list(APPEND INCLUDE_FOLDERS
+    QtGlxSupport
+		QtServiceSupport
+		QtInputSupport
+		QtKmsSupport
+)
+endif()
 foreach(INCLUDE_FOLDER ${INCLUDE_FOLDERS})
     install(DIRECTORY ${PROJECT_BINARY_DIR}/include/${INCLUDE_FOLDER}/
         DESTINATION fast/include/${INCLUDE_FOLDER}/
@@ -245,14 +249,14 @@
         DESTINATION fast/licenses/tensorflow/
     )
 endif()
-if(FAST_MODULE_OpenVINO)
+if(FAST_MODULE_OpenVINO AND NOT WIN32)
 	install(FILES ${FAST_EXTERNAL_BUILD_DIR}/OpenVINO/src/OpenVINO/LICENSE
 		DESTINATION fast/licenses/openvino/
 	)
 endif()

 if(FAST_MODULE_RealSense)
-	install(FILES
+	install(FILES
         ${FAST_EXTERNAL_BUILD_DIR}/realsense/src/realsense/LICENSE
         ${FAST_EXTERNAL_BUILD_DIR}/realsense/src/realsense/NOTICE
         DESTINATION fast/licenses/realsense/


remove a redundant option.

remove a redundant option.

--- cmake/OpenCVUtils.cmake
+++ cmake/OpenCVUtils.cmake
@@ -1624,7 +1624,7 @@

 macro(ocv_git_describe var_name path)
   if(GIT_FOUND)
-    execute_process(COMMAND "${GIT_EXECUTABLE}" describe --tags --tags --exact-match --dirty
+    execute_process(COMMAND "${GIT_EXECUTABLE}" describe --tags --exact-match --dirty
       WORKING_DIRECTORY "${path}"
       OUTPUT_VARIABLE ${var_name}
       RESULT_VARIABLE GIT_RESULT


Fix missing pthread for c unit tests

Fix missing pthread for c unit tests

--- build/TestUnit.cmake
+++ build/TestUnit.cmake
@@ -14,6 +14,7 @@

 	add_executable(${TEST_UNIT_MODULE}-${TEST_UNIT_NAME} ${TEST_UNIT_FILES})
 	target_link_libraries(${TEST_UNIT_MODULE}-${TEST_UNIT_NAME} ${CHECK_LIBRARIES})
+	target_link_libraries(${TEST_UNIT_MODULE}-${TEST_UNIT_NAME} ${CMAKE_THREAD_LIBS_INIT})
 	set_property(TARGET ${TEST_UNIT_MODULE}-${TEST_UNIT_NAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${CHECK_INCLUDE_DIRS})
 	set_property(TARGET ${TEST_UNIT_MODULE}-${TEST_UNIT_NAME} APPEND PROPERTY LINK_FLAGS -Wl,--exclude-libs,ALL)
 	add_test(NAME ${TEST_UNIT_MODULE}-${TEST_UNIT_NAME}-unit


Update build settings with --no-undefined.

--- build_settings.cmake
+++ build_settings.cmake
@@ -77,3 +77,7 @@
 endif()
 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-rpath,${CMAKE_BUILD_RPATH}")
 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,${CMAKE_BUILD_RPATH}")
+
+# Don't allow unresolved symbols in executables or shared libraries
+set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined")
+set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-undefined")


Add extra debug information to CPM.

Add extra debug information to CPM.

--- CPM.cmake
+++ CPM.cmake
@@ -1377,6 +1377,8 @@
   _cpm_make_valid_unid_or_path(__CPM_PATH_UNID_VERSION)
   set(__CPM_FULL_UNID "${__CPM_PATH_UNID}_${__CPM_PATH_UNID_VERSION}")

+  _cpm_debug_log("Module full UNID: ${__CPM_PATH_UNID_VERSION}")
+
   # Construct paths from UNID
   set(__CPM_MODULE_BIN_DIR "${__CPM_BASE_MODULE_DIR}/${__CPM_FULL_UNID}/bin")


MOD: CMAKE - Added .inl files to the projects, formerly they werent added

--- cmake/CEGUIMacros.cmake
+++ cmake/CEGUIMacros.cmake
@@ -12,7 +12,7 @@
     set (_CURR_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/${_REL_INC_DIR}")

     file (GLOB CORE_SOURCE_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" *.cpp)
-    file (GLOB CORE_HEADER_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${_CURR_INCLUDE_DIR}/*.h")
+    file (GLOB CORE_HEADER_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${_CURR_INCLUDE_DIR}/*.h" "${CMAKE_CURRENT_SOURCE_DIR}" *.inl)
 endmacro()

 #


cmake: use MATCHES instead of EQUAL for string comparison

--- cmake/DetectGTest.cmake
+++ cmake/DetectGTest.cmake
@@ -16,7 +16,7 @@
         if(BUILD_SHARED_LIBS)
             get_filename_component(__GTEST_LIB_EXT ${GTEST_LIBRARIES} EXT)

-            if(NOT ${__GTEST_LIB_EXT} EQUAL ${CMAKE_SHARED_LIBRARY_SUFFIX})
+            if(NOT ${__GTEST_LIB_EXT} MATCHES ${CMAKE_SHARED_LIBRARY_SUFFIX})
                 message(WARNING "Linking shared build to static gtest may lead to testrunner crash due to memory leaks.")
             endif()


Fix cmake and pkgconfig packaging

Fix cmake and pkgconfig packaging

--- cmake/Findopentxs.cmake
+++ cmake/Findopentxs.cmake
@@ -1,23 +0,0 @@
-# Copyright (c) 2018 The Open-Transactions developers
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-include(FindPkgConfig)
-  PKG_CHECK_MODULES(PC_OPENTXS "libopentxs")
-
-  find_path(
-      OPENTXS_INCLUDE_DIRS
-      NAMES opentxs
-      HINTS ${PC_OPENTXS_INCLUDE_DIRS}
-  )
-
-  find_library(
-      OPENTXS_LIBRARIES
-      NAMES libopentxs.dylib libopentxs.so libopentxs.a
-      HINTS ${PC_OPENTXS_LIBRARY_DIRS}
-  )
-
-  include(FindPackageHandleStandardArgs)
-  FIND_PACKAGE_HANDLE_STANDARD_ARGS(OPENTXS DEFAULT_MSG OPENTXS_LIBRARIES OPENTXS_INCLUDE_DIRS)
-  mark_as_advanced(OPENTXS_LIBRARIES OPENTXS_INCLUDE_DIRS)


MDEV-9833 - fix mysql_config --libs for weird cases, where mysqlclient link dependencies contain  flags instead of libraries (like  -pthread rather than -lpthread)

--- cmake/for_clients.cmake
+++ cmake/for_clients.cmake
@@ -25,7 +25,7 @@
       # Filter out "general", it is not a library, just CMake hint
       # Also, remove duplicates
       IF(NOT lib STREQUAL "general" AND NOT ${var}  MATCHES "-l${lib} ")
-        IF (lib MATCHES "^\\-l")
+        IF (lib MATCHES "^\\-")
           SET(${var} "${${var}} ${lib} ")
         ELSEIF(lib MATCHES "^/")
           IF (lib MATCHES "\\.(a|so([0-9.]*)|lib|dll|dylib)$")


Add version information to pkgconfig files.

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

--- cmake/pcl_targets.cmake
+++ cmake/pcl_targets.cmake
@@ -303,7 +303,7 @@
         set(PKG_INTERNAL_DEPS "${PKG_INTERNAL_DEPS} -l${_dep}")
     endforeach(_dep)

-    set(_pc_file ${CMAKE_CURRENT_BINARY_DIR}/${_name}.pc)
+    set(_pc_file ${CMAKE_CURRENT_BINARY_DIR}/${_name}-${PCL_MAJOR_VERSION}.${PCL_MINOR_VERSION}.pc)
     configure_file(${PROJECT_SOURCE_DIR}/cmake/pkgconfig.cmake.in ${_pc_file}
         @ONLY)
     install(FILES ${_pc_file} DESTINATION ${PKGCFG_INSTALL_DIR}


Bug fixes.

Bug fixes.

--- bin/dsn.cmake
+++ bin/dsn.cmake
@@ -100,17 +100,21 @@
             set(MY_CSC "xbuild")
         endif()
         if(DSN_BUILD_RUNTIME)
-            set(DSN_CORE_DLL "${OUTPUT_DIRECTORY}/lib/dsn.core.*")
+            set(DSN_CORE_DLL_FILES "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/")
         else()
-            set(DSN_CORE_DLL "${DSN_ROOT}/lib/libdsn.core.*")
-        endif()
-        file(GLOB DSN_CORE_DLL "${DSN_CORE_DLL}")
+            set(DSN_CORE_DLL_FILES "${DSN_ROOT}/lib/")
+        endif()
+        if (NOT MSVC)
+            set(DSN_CORE_DLL_FILES "${DSN_CORE_DLL_FILES}lib")
+        endif()
+        set(DSN_CORE_DLL_FILES "${DSN_CORE_DLL_FILES}dsn.core.*")
+        file(GLOB DSN_CORE_DLL_FILES "${DSN_CORE_DLL_FILES}")
         execute_process(
             COMMAND ${MY_CSC} "${CMAKE_CURRENT_BINARY_DIR}/${PROJ_NAME}.csproj"
             )
-        execute_process(
-            COMMAND ${CMAKE_COMMAND} -E copy ${DSN_CORE_DLL} "${OUTPUT_DIRECTORY}/"
-            )
+        foreach(CORE_FILE ${DSN_CORE_DLL_FILES})
+            execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${CORE_FILE} "${OUTPUT_DIRECTORY}/")
+        endforeach()
     endif()

     if((PROJ_TYPE STREQUAL "EXECUTABLE") AND (NOT (PROJ_BINPLACES STREQUAL "")))


No Boost.Atomic

No Boost.Atomic

Required for Boost.Thread `call_once` on POSIX platforms but
generally works without.

--- alpakaConfig.cmake
+++ alpakaConfig.cmake
@@ -134,7 +134,7 @@
     SET(Boost_DETAILED_FAILURE_MSG ON)
 ENDIF()
 IF(ALPAKA_ACC_CPU_B_SEQ_T_FIBERS_ENABLE)
-    FIND_PACKAGE(Boost ${_ALPAKA_BOOST_MIN_VER} QUIET COMPONENTS fiber context system thread atomic chrono date_time)
+    FIND_PACKAGE(Boost ${_ALPAKA_BOOST_MIN_VER} QUIET COMPONENTS fiber context system thread chrono date_time)
     IF(NOT Boost_FIBER_FOUND)
         MESSAGE(STATUS "Optional alpaka dependency Boost fiber could not be found! Fibers back-end disabled!")
         SET(ALPAKA_ACC_CPU_B_SEQ_T_FIBERS_ENABLE OFF CACHE BOOL "Enable the Fibers CPU back-end" FORCE)
@@ -219,7 +219,7 @@
             LIST(APPEND _ALPAKA_LINK_LIBRARIES_PUBLIC
                  Boost::boost
                  Boost::fiber Boost::context Boost::system Boost::thread
-                 Boost::chrono Boost::date_time Boost::atomic
+                 Boost::chrono Boost::date_time
             )
         ELSE()
             # fallback: Boost version is too new for CMake


minor fixes

minor fixes

--- SM/SM.cmake
+++ SM/SM.cmake
@@ -25,12 +25,13 @@
 endif(WITH_GRID_TRACKERS)
 if(WITH_FEAT)
 	message(STATUS "OpenCV_VERSION: ${OpenCV_VERSION}")
-	# if(NOT "${OpenCV_VERSION}" STREQUAL "3")̀
-		# findSubPart("${OpenCV_LIBRARIES}" "opencv_nonfree" CV_NONFREE_FOUND)
-	# else()
-		# findSubPart("${OpenCV_LIBRARIES}" "opencv_xfeatures2d" CV_NONFREE_FOUND)
-	# endif()
-	findSubPart("${OpenCV_LIBRARIES}" "opencv_xfeatures2d" CV_NONFREE_FOUND)
+	if(OpenCV_VERSION MATCHES "^3")
+		message(STATUS "OpenCV 3 found")
+		findSubPart("${OpenCV_LIBRARIES}" "opencv_xfeatures2d" CV_NONFREE_FOUND)
+	else()
+		message(STATUS "OpenCV 2 found")
+		findSubPart("${OpenCV_LIBRARIES}" "opencv_nonfree" CV_NONFREE_FOUND)
+	endif()
 	if(CV_NONFREE_FOUND)
 		message(STATUS "Feature based grid tracker is enabled")
 		set(COMPOSITE_SEARCH_METHODS ${COMPOSITE_SEARCH_METHODS} FeatureTracker)


Update android.toolchain.cmake to upstream commit fd1f7055f8b7338644d58d9a2015a784dfa3a5ca

--- cmake/toolchain/android.toolchain.cmake
+++ cmake/toolchain/android.toolchain.cmake
@@ -289,6 +289,9 @@
 #   - March 2013
 #     [+] updated for NDK r8e (x86 version)
 #     [+] support x86_64 version of NDK
+#   - April 2013
+#     [+] support non-release NDK layouts (from Linaro git and Android git)
+#     [~] automatically detect if explicit link to crtbegin_*.o is needed
 # ------------------------------------------------------------------------------

 cmake_minimum_required( VERSION 2.6.3 )
@@ -520,17 +523,6 @@
 # remember found paths
 if( ANDROID_NDK )
  get_filename_component( ANDROID_NDK "${ANDROID_NDK}" ABSOLUTE )
- # try to detect change
- if( CMAKE_AR )
-  string( LENGTH "${ANDROID_NDK}" __length )
-  string( SUBSTRING "${CMAKE_AR}" 0 ${__length} __androidNdkPreviousPath )
-  if( NOT __androidNdkPreviousPath STREQUAL ANDROID_NDK )
-   message( FATAL_ERROR "It is not possible to change the path to the NDK on subsequent CMake run. You must remove all generated files from your build folder first.
-   " )
-  endif()
-  unset( __androidNdkPreviousPath )
-  unset( __length )
- endif()
  set( ANDROID_NDK "${ANDROID_NDK}" CACHE INTERNAL "Path of the Android NDK" FORCE )
  set( BUILD_WITH_ANDROID_NDK True )
  if( EXISTS "${ANDROID_NDK}/RELEASE.TXT" )
@@ -569,7 +561,14 @@
 # android NDK layout
 if( BUILD_WITH_ANDROID_NDK )
  if( NOT DEFINED ANDROID_NDK_LAYOUT )
-  set( ANDROID_NDK_LAYOUT "RELEASE" )
+  # try to automatically detect the layout
+  if( EXISTS "${ANDROID_NDK}/RELEASE.TXT")
+   set( ANDROID_NDK_LAYOUT "RELEASE" )
+  elseif( EXISTS "${ANDROID_NDK}/../../linux-x86/toolchain/" )
+   set( ANDROID_NDK_LAYOUT "LINARO" )
+  elseif( EXISTS "${ANDROID_NDK}/../../gcc/" )
+   set( ANDROID_NDK_LAYOUT "ANDROID" )
+  endif()
  endif()
  set( ANDROID_NDK_LAYOUT "${ANDROID_NDK_LAYOUT}" CACHE STRING "The inner layout of NDK" )
  mark_as_advanced( ANDROID_NDK_LAYOUT )
@@ -578,12 +577,31 @@
   set( ANDROID_NDK_TOOLCHAINS_PATH "${ANDROID_NDK}/../../${ANDROID_NDK_HOST_SYSTEM_NAME}/toolchain" )
   set( ANDROID_NDK_TOOLCHAINS_SUBPATH  "" )
   set( ANDROID_NDK_TOOLCHAINS_SUBPATH2 "" )
+ elseif( ANDROID_NDK_LAYOUT STREQUAL "ANDROID" )
+  set( ANDROID_NDK_HOST_SYSTEM_NAME ${ANDROID_NDK_HOST_SYSTEM_NAME2} ) # only 32-bit at the moment
+  set( ANDROID_NDK_TOOLCHAINS_PATH "${ANDROID_NDK}/../../gcc/${ANDROID_NDK_HOST_SYSTEM_NAME}/arm" )
+  set( ANDROID_NDK_TOOLCHAINS_SUBPATH  "" )
+  set( ANDROID_NDK_TOOLCHAINS_SUBPATH2 "" )
  else() # ANDROID_NDK_LAYOUT STREQUAL "RELEASE"
   set( ANDROID_NDK_TOOLCHAINS_PATH "${ANDROID_NDK}/toolchains" )
   set( ANDROID_NDK_TOOLCHAINS_SUBPATH  "/prebuilt/${ANDROID_NDK_HOST_SYSTEM_NAME}" )
   set( ANDROID_NDK_TOOLCHAINS_SUBPATH2 "/prebuilt/${ANDROID_NDK_HOST_SYSTEM_NAME2}" )
  endif()
-endif()
+ get_filename_component( ANDROID_NDK_TOOLCHAINS_PATH "${ANDROID_NDK_TOOLCHAINS_PATH}" ABSOLUTE )
+
+ # try to detect change of NDK
+ if( CMAKE_AR )
+  string( LENGTH "${ANDROID_NDK_TOOLCHAINS_PATH}" __length )
+  string( SUBSTRING "${CMAKE_AR}" 0 ${__length} __androidNdkPreviousPath )
+  if( NOT __androidNdkPreviousPath STREQUAL ANDROID_NDK_TOOLCHAINS_PATH )
+   message( FATAL_ERROR "It is not possible to change the path to the NDK on subsequent CMake run. You must remove all generated files from your build folder first.
+   " )
+  endif()
+  unset( __androidNdkPreviousPath )
+  unset( __length )
+ endif()
+endif()
+

 # get all the details about standalone toolchain
 if( BUILD_WITH_STANDALONE_TOOLCHAIN )
@@ -1134,7 +1152,7 @@

 # setup the cross-compiler
 if( NOT CMAKE_C_COMPILER )
- if( NDK_CCACHE )
+ if( NDK_CCACHE AND NOT ANDROID_SYSROOT MATCHES "[ ;\"]" )
   set( CMAKE_C_COMPILER   "${NDK_CCACHE}" CACHE PATH "ccache as C compiler" )
   set( CMAKE_CXX_COMPILER "${NDK_CCACHE}" CACHE PATH "ccache as C++ compiler" )
   if( ANDROID_COMPILER_IS_CLANG )
@@ -1206,11 +1224,25 @@
 remove_definitions( -DANDROID )
 add_definitions( -DANDROID )

-if(ANDROID_SYSROOT MATCHES "[ ;\"]")
- set( ANDROID_CXX_FLAGS "--sysroot=\"${ANDROID_SYSROOT}\"" )
+if( ANDROID_SYSROOT MATCHES "[ ;\"]" )
+ if( CMAKE_HOST_WIN32 )
+  # try to convert path to 8.3 form
+  file( WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/cvt83.cmd" "@echo %~s1" )
+  execute_process( COMMAND "$ENV{ComSpec}" /c "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/cvt83.cmd" "${ANDROID_SYSROOT}"
+                   OUTPUT_VARIABLE __path OUTPUT_STRIP_TRAILING_WHITESPACE
+                   RESULT_VARIABLE __result ERROR_QUIET )
+  if( __result EQUAL 0 )
+   file( TO_CMAKE_PATH "${__path}" ANDROID_SYSROOT )
+   set( ANDROID_CXX_FLAGS "--sysroot=${ANDROID_SYSROOT}" )
+  else()
+   set( ANDROID_CXX_FLAGS "--sysroot=\"${ANDROID_SYSROOT}\"" )
+  endif()
+ else()
+  set( ANDROID_CXX_FLAGS "'--sysroot=${ANDROID_SYSROOT}'" )
+ endif()
  if( NOT _CMAKE_IN_TRY_COMPILE )
-  # quotes will break try_compile and compiler identification
-  message(WARNING "Your Android system root has non-alphanumeric symbols. It can break compiler features detection and the whole build.")
+  # quotes can break try_compile and compiler identification
+  message(WARNING "Path to your Android NDK (or toolchain) has non-alphanumeric symbols.\nThe build might be broken.\n")
  endif()
 else()
  set( ANDROID_CXX_FLAGS "--sysroot=${ANDROID_SYSROOT}" )
@@ -1281,22 +1313,18 @@
  set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -march=armv5te -mtune=xscale -msoft-float" )
 endif()

+if( ANDROID_STL MATCHES "gnustl" AND (EXISTS "${__libstl}" OR EXISTS "${__libsupcxx}") )
+ set( CMAKE_CXX_CREATE_SHARED_LIBRARY "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>" )
+ set( CMAKE_CXX_CREATE_SHARED_MODULE  "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>" )
+ set( CMAKE_CXX_LINK_EXECUTABLE       "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>" )
+else()
+ set( CMAKE_CXX_CREATE_SHARED_LIBRARY "<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>" )
+ set( CMAKE_CXX_CREATE_SHARED_MODULE  "<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>" )
+ set( CMAKE_CXX_LINK_EXECUTABLE       "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>" )
+endif()
+
 # STL
 if( EXISTS "${__libstl}" OR EXISTS "${__libsupcxx}" )
- if( ANDROID_STL MATCHES "gnustl" )
-  set( CMAKE_CXX_CREATE_SHARED_LIBRARY "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>" )
-  set( CMAKE_CXX_CREATE_SHARED_MODULE  "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>" )
-  set( CMAKE_CXX_LINK_EXECUTABLE       "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>" )
- else()
-  set( CMAKE_CXX_CREATE_SHARED_LIBRARY "<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>" )
-  set( CMAKE_CXX_CREATE_SHARED_MODULE  "<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>" )
-  set( CMAKE_CXX_LINK_EXECUTABLE       "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>" )
- endif()
- if ( X86 AND ANDROID_STL MATCHES "gnustl" AND ANDROID_NDK_RELEASE STREQUAL "r6" )
-  # workaround "undefined reference to `__dso_handle'" problem
-  set( CMAKE_CXX_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY} \"${ANDROID_SYSROOT}/usr/lib/crtbegin_so.o\"" )
-  set( CMAKE_CXX_CREATE_SHARED_MODULE  "${CMAKE_CXX_CREATE_SHARED_MODULE} \"${ANDROID_SYSROOT}/usr/lib/crtbegin_so.o\"" )
- endif()
  if( EXISTS "${__libstl}" )
   set( CMAKE_CXX_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY} \"${__libstl}\"" )
   set( CMAKE_CXX_CREATE_SHARED_MODULE  "${CMAKE_CXX_CREATE_SHARED_MODULE} \"${__libstl}\"" )
@@ -1315,9 +1343,12 @@
   set( CMAKE_C_LINK_EXECUTABLE       "${CMAKE_C_LINK_EXECUTABLE} \"${__libsupcxx}\"" )
  endif()
  if( ANDROID_STL MATCHES "gnustl" )
-  set( CMAKE_CXX_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY} -lm" )
-  set( CMAKE_CXX_CREATE_SHARED_MODULE  "${CMAKE_CXX_CREATE_SHARED_MODULE} -lm" )
-  set( CMAKE_CXX_LINK_EXECUTABLE       "${CMAKE_CXX_LINK_EXECUTABLE} -lm" )
+  if( NOT EXISTS "${ANDROID_LIBM_PATH}" )
+   set( ANDROID_LIBM_PATH -lm )
+  endif()
+  set( CMAKE_CXX_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY} ${ANDROID_LIBM_PATH}" )
+  set( CMAKE_CXX_CREATE_SHARED_MODULE  "${CMAKE_CXX_CREATE_SHARED_MODULE} ${ANDROID_LIBM_PATH}" )
+  set( CMAKE_CXX_LINK_EXECUTABLE       "${CMAKE_CXX_LINK_EXECUTABLE} ${ANDROID_LIBM_PATH}" )
  endif()
 endif()

@@ -1353,7 +1384,14 @@
 endif()

 if( ANDROID_NO_UNDEFINED )
- set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -Wl,--no-undefined" )
+ if( MIPS )
+  # there is some sysroot-related problem in mips linker...
+  if( NOT ANDROID_SYSROOT MATCHES "[ ;\"]" )
+   set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -Wl,--no-undefined -Wl,-rpath-link,${ANDROID_SYSROOT}/usr/lib" )
+  endif()
+ else()
+  set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -Wl,--no-undefined" )
+ endif()
 endif()

 if( ANDROID_SO_UNDEFINED )
@@ -1461,6 +1499,43 @@
 # global includes and link directories
 include_directories( SYSTEM "${ANDROID_SYSROOT}/usr/include" ${ANDROID_STL_INCLUDE_DIRS} )
 link_directories( "${CMAKE_INSTALL_PREFIX}/libs/${ANDROID_NDK_ABI_NAME}" )
+
+# detect if need link crtbegin_so.o explicitly
+if( NOT DEFINED ANDROID_EXPLICIT_CRT_LINK )
+ set( __cmd "${CMAKE_CXX_CREATE_SHARED_LIBRARY}" )
+ string( REPLACE "<CMAKE_CXX_COMPILER>" "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1}" __cmd "${__cmd}" )
+ string( REPLACE "<CMAKE_C_COMPILER>"   "${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1}"   __cmd "${__cmd}" )
+ string( REPLACE "<CMAKE_SHARED_LIBRARY_CXX_FLAGS>" "${CMAKE_CXX_FLAGS}" __cmd "${__cmd}" )
+ string( REPLACE "<LANGUAGE_COMPILE_FLAGS>" "" __cmd "${__cmd}" )
+ string( REPLACE "<LINK_FLAGS>" "${CMAKE_SHARED_LINKER_FLAGS}" __cmd "${__cmd}" )
+ string( REPLACE "<CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS>" "-shared" __cmd "${__cmd}" )
+ string( REPLACE "<CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG>" "" __cmd "${__cmd}" )
+ string( REPLACE "<TARGET_SONAME>" "" __cmd "${__cmd}" )
+ string( REPLACE "<TARGET>" "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/toolchain_crtlink_test.so" __cmd "${__cmd}" )
+ string( REPLACE "<OBJECTS>" "\"${ANDROID_SYSROOT}/usr/lib/crtbegin_so.o\"" __cmd "${__cmd}" )
+ string( REPLACE "<LINK_LIBRARIES>" "" __cmd "${__cmd}" )
+ separate_arguments( __cmd )
+ foreach( __var ANDROID_NDK ANDROID_NDK_TOOLCHAINS_PATH ANDROID_STANDALONE_TOOLCHAIN )
+  if( ${__var} )
+   set( __tmp "${${__var}}" )
+   separate_arguments( __tmp )
+   string( REPLACE "${__tmp}" "${${__var}}" __cmd "${__cmd}")
+  endif()
+ endforeach()
+ string( REPLACE "'" "" __cmd "${__cmd}" )
+ string( REPLACE "\"" "" __cmd "${__cmd}" )
+ execute_process( COMMAND ${__cmd} RESULT_VARIABLE __cmd_result OUTPUT_QUIET ERROR_QUIET )
+ if( __cmd_result EQUAL 0 )
+  set( ANDROID_EXPLICIT_CRT_LINK ON )
+ else()
+  set( ANDROID_EXPLICIT_CRT_LINK OFF )
+ endif()
+endif()
+
+if( ANDROID_EXPLICIT_CRT_LINK )
+ set( CMAKE_CXX_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY} \"${ANDROID_SYSROOT}/usr/lib/crtbegin_so.o\"" )
+ set( CMAKE_CXX_CREATE_SHARED_MODULE  "${CMAKE_CXX_CREATE_SHARED_MODULE} \"${ANDROID_SYSROOT}/usr/lib/crtbegin_so.o\"" )
+endif()

 # setup output directories
 set( LIBRARY_OUTPUT_PATH_ROOT ${CMAKE_SOURCE_DIR} CACHE PATH "root for library output, set this to change where android libs are installed to" )
@@ -1567,6 +1642,8 @@
                 ANDROID_GOLD_LINKER
                 ANDROID_NOEXECSTACK
                 ANDROID_RELRO
+                ANDROID_LIBM_PATH
+                ANDROID_EXPLICIT_CRT_LINK
                 )
   if( DEFINED ${__var} )
    if( "${__var}" MATCHES " ")
@@ -1610,6 +1687,7 @@
 #   ANDROID_STANDALONE_TOOLCHAIN
 #   ANDROID_TOOLCHAIN_NAME : the NDK name of compiler toolchain
 #   ANDROID_NDK_HOST_X64 : try to use x86_64 toolchain (default for x64 host systems)
+#   ANDROID_NDK_LAYOUT : the inner NDK structure (RELEASE, LINARO, ANDROID)
 #   LIBRARY_OUTPUT_PATH_ROOT : <any valid path>
 #   NDK_CCACHE : <path to your ccache executable>
 # Obsolete:
@@ -1655,6 +1733,7 @@
 #   ANDROID_EXCEPTIONS : if exceptions are enabled by the runtime
 #   ANDROID_GCC_TOOLCHAIN_NAME : read-only, differs from ANDROID_TOOLCHAIN_NAME only if clang is used
 #   ANDROID_CLANG_VERSION : version of clang compiler if clang is used
+#   ANDROID_LIBM_PATH : path to libm.so (set to something like $(TOP)/out/target/product/<product_name>/obj/lib/libm.so) to workaround unresolved `sincos`
 #
 # Defaults:
 #   ANDROID_DEFAULT_NDK_API_LEVEL


Better windows search path.

Better windows search path.

--- FindFBX.cmake
+++ FindFBX.cmake
@@ -17,7 +17,7 @@
 )

 set(FBX_WIN_LOCATIONS
-    "C:/Program Files/Autodesk/FBX/FbxSdk/2013.1"
+    "$ENV{ProgramFiles}/Autodesk/FBX/FbxSdk/2013.1"
 )

 set(FBX_SEARCH_LOCATIONS


Fix cmake's find mumps rule. It may found system-installed mumps first. If $ENV{MUMPS_ROOT} is not defined, add hint directory /lib first. However include path do not cause same as, it may be cause inconsistency library version.

--- cmake/FindMumps.cmake
+++ cmake/FindMumps.cmake
@@ -18,18 +18,19 @@
   RETURN()
 endif()

-set(LIB_SEARCH_PATH
-  $ENV{MUMPS_ROOT}/lib
-  ${CMAKE_SOURCE_DIR}/../MUMPS_5.1.1/lib
-  ${CMAKE_SOURCE_DIR}/../MUMPS_5.1.0/lib
-  ${CMAKE_SOURCE_DIR}/../MUMPS_5.0.2/lib
-  ${CMAKE_SOURCE_DIR}/../MUMPS_5.0.1/lib
-  $ENV{HOME}/local/lib
-  $ENV{HOME}/.local/lib
-  ${CMAKE_LIBRARY_PATH}
-  /usr/local/lib
-  /usr/lib
-)
+set(LIB_SEARCH_PATH)
+if($ENV{MUMPS_ROOT})
+set(LIB_SEARCH_PATH ${LIB_SEARCH_PATH} $ENV{MUMPS_ROOT}/lib)
+endif()
+set(LIB_SEARCH_PATH ${LIB_SEARCH_PATH} ${CMAKE_SOURCE_DIR}/../MUMPS_5.1.1/lib)
+set(LIB_SEARCH_PATH ${LIB_SEARCH_PATH} ${CMAKE_SOURCE_DIR}/../MUMPS_5.1.0/lib)
+set(LIB_SEARCH_PATH ${LIB_SEARCH_PATH} ${CMAKE_SOURCE_DIR}/../MUMPS_5.0.2/lib)
+set(LIB_SEARCH_PATH ${LIB_SEARCH_PATH} ${CMAKE_SOURCE_DIR}/../MUMPS_5.0.1/lib)
+set(LIB_SEARCH_PATH ${LIB_SEARCH_PATH} $ENV{HOME}/local/lib)
+set(LIB_SEARCH_PATH ${LIB_SEARCH_PATH} $ENV{HOME}/.local/lib)
+set(LIB_SEARCH_PATH ${LIB_SEARCH_PATH} ${CMAKE_LIBRARY_PATH})
+set(LIB_SEARCH_PATH ${LIB_SEARCH_PATH} /usr/local/lib)
+set(LIB_SEARCH_PATH ${LIB_SEARCH_PATH} /usr/lib)

 find_library(MUMPS_D_LIB
   NAMES dmumps


Add msvc 2015 support in cmake compiler detection

--- cmake/Utilities.cmake
+++ cmake/Utilities.cmake
@@ -5,7 +5,7 @@
   if(${COMPILER} STREQUAL "GNU")
     set(COMPILER_STRING "GCC")
   endif()
-
+
   if(${COMPILER} STREQUAL "Clang")
     option(USE_LIBCXX OFF)
     if(USE_LIBCXX)
@@ -14,7 +14,9 @@
   endif()

   if(MSVC)
-    if(REQUIRED_VERSION EQUAL 2013)
+    if(REQUIRED_VERSION EQUAL 2015)
+      set(REQUIRED_VERSION 19)
+    elseif(REQUIRED_VERSION EQUAL 2013)
       set(REQUIRED_VERSION 18)
     elseif(REQUIRED_VERSION EQUAL 2012)
       set(REQUIRED_VERSION 17)


Support compiling with CMAKE_BUILD_TYPE set to None (#405)

Debian defaults to setting CMAKE_BUILD_TYPE to None and setting CFLAGS
and alike to Debian standards.

--- cmake/functions.cmake
+++ cmake/functions.cmake
@@ -104,6 +104,10 @@
         "call CMake with -DFORCE_DEBUG_BUILD=True"
       )
     endif()
+# Support for Debian packaging CMAKE_BUILD_TYPE
+  elseif(CMAKE_BUILD_TYPE STREQUAL "None")
+    message(WARNING "Building with CMAKE_BUILD_TYPE None, "
+        "please make sure you have set CFLAGS and CXXFLAGS according to your needs.")
   else()
     message(FATAL_ERROR "Unknown CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
   endif()


Fixed one more issue when linker script path contains spaces

--- cmake/gcc_stm32.cmake
+++ cmake/gcc_stm32.cmake
@@ -150,9 +150,9 @@

     GET_TARGET_PROPERTY(TARGET_LD_FLAGS ${TARGET} LINK_FLAGS)
     IF(TARGET_LD_FLAGS)
-        SET(TARGET_LD_FLAGS "-T${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_flash.ld ${TARGET_LD_FLAGS}")
-    ELSE()
-        SET(TARGET_LD_FLAGS "-T${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_flash.ld")
+        SET(TARGET_LD_FLAGS "\"-T${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_flash.ld\" ${TARGET_LD_FLAGS}")
+    ELSE()
+        SET(TARGET_LD_FLAGS "\"-T${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_flash.ld\"")
     ENDIF()
     SET_TARGET_PROPERTIES(${TARGET} PROPERTIES LINK_FLAGS ${TARGET_LD_FLAGS})
 ENDFUNCTION()


Fix: even if set to ON disable tests if GTest not found

git-svn-id: 1af002208e930b4d920e7c2b948d1e98a012c795@4286 a9d63959-f2ad-4865-b262-bf0e56cfafb6

--- cmake/pcl_tests.cmake
+++ cmake/pcl_tests.cmake
@@ -23,7 +23,11 @@
 elseif(NOT ${BUILD_TESTS})
     message(STATUS "Tests will not be built: Disabled manually")
 else(NOT ${DEFAULT} AND NOT ${BUILD_TESTS})
-    message(STATUS "Tests will be built")
+    if(GTEST_FOUND)
+        message(STATUS "Tests will be built")
+    else(GTEST_FOUND)
+        set (BUILD_TESTS OFF CACHE BOOL "Tests can not be built!" FORCE)
+    endif(GTEST_FOUND)
 endif(NOT ${DEFAULT} AND NOT ${BUILD_TESTS})

 # Set up for testing if tests are enabled


few modifications

few modifications

--- builder.cmake
+++ builder.cmake
@@ -24,6 +24,10 @@
     ${TARGET_INFO_${target}}")
     endforeach ()
     message (FATAL_ERROR ${MSG})
+endif ()
+
+if ("${TARGET_NAME_${T}}" STREQUAL "")
+    message (FATAL_ERROR "Target ${T} is not defined. Are you sure you spelled the name right?")
 endif ()

 set (CMAKE_GENERATED_COMMAND "\"${CMAKE_COMMAND}\" ${CUSTOM_ARGS_${T}} ")


Delete Tests.cmake

Delete Tests.cmake

--- cmake/Tests.cmake
+++ cmake/Tests.cmake
@@ -1,5 +0,0 @@
-# Test macros for Marlin, feel free to re-use them.
-
-macro(add_test_executable EXE_NAME)
-    add_test(${EXE_NAME} gtester ${CMAKE_CURRENT_BINARY_DIR}/${EXE_NAME})
-endmacro()


CppCheck option removed.

CppCheck option removed.

--- cmake/CppCheck.cmake
+++ cmake/CppCheck.cmake
@@ -10,7 +10,6 @@
     add_custom_command(TARGET cppcheck POST_BUILD
                         COMMAND ${CPPCHECK} --error-exitcode=1
                                             --enable=all
-                                            --check-library
                                             --project=${CMAKE_BINARY_DIR}/compile_commands.json
                                             --report-progress
                                             --suppress='*:*test/*'


one more attempt at windeployqt

one more attempt at windeployqt

related #261, #262, #263

--- cmake/DeployQt.cmake
+++ cmake/DeployQt.cmake
@@ -45,12 +45,16 @@
     add_custom_command(TARGET ${target} POST_BUILD
         COMMAND "${CMAKE_COMMAND}" -E
             env PATH="${_qt_bin_dir}" "${WINDEPLOYQT_EXECUTABLE}"
+                --dir \"$<TARGET_FILE_DIR:${target}}>/windeployqt\"
                 --no-compiler-runtime
                 --no-angle
                 --no-opengl-sw
                 \"$<TARGET_FILE:${target}>\"
         COMMENT "Deploying Qt..."
     )
+
+    install(DIRECTORY \"$<TARGET_FILE_DIR:${target}}>/windeployqt\"
+        DESTINATION ${CMAKE_INSTALL_BINDIR})

     # windeployqt doesn't work correctly with the system runtime libraries,
     # so we fall back to one of CMake's own modules for copying them over


Sweet, looks like gcov-8 broke ability to be run with multiple inputs at once

--- cmake/gcc-gcov.cmake
+++ cmake/gcc-gcov.cmake
@@ -23,7 +23,7 @@

 add_custom_target(
   gcov
-  COMMAND "${FIND_PATH}" "${CMAKE_BINARY_DIR}" -type f -name '*.gcno' -exec "${GCOV_PATH}" ${GCOV_OPTS} {} + &> /dev/null
+  COMMAND "${FIND_PATH}" "${CMAKE_BINARY_DIR}" -type f -name '*.gcno' -exec "${GCOV_PATH}" ${GCOV_OPTS} {} \\\\; > /dev/null
   WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
   COMMENT "Running gcov tool on all the *.gcno files to produce *.gcov files"
   USES_TERMINAL


Bump version patch

Bump version patch

--- conf/RTFVersion.cmake
+++ conf/RTFVersion.cmake
@@ -9,7 +9,7 @@
 # bumping VERSION_PATCH
 set(RTF_VERSION_MAJOR "1")
 set(RTF_VERSION_MINOR "3")
-set(RTF_VERSION_PATCH "3")
+set(RTF_VERSION_PATCH "4")
 set(RTF_VERSION_TWEAK "")
 set(RTF_VERSION_STRING "")


Add needed flag for OpenACC linking step

--- test/module_test.cmake
+++ test/module_test.cmake
@@ -186,6 +186,7 @@
 # Set target specific compilation options
 if(OPENACC_ENABLE)
   target_compile_options(${EXECUTABLE_TRANSFORMED_GPU} PUBLIC ${OPENACC_FLAGS})
+  target_link_libraries(${EXECUTABLE_TRANSFORMED_GPU} ${OPENACC_FLAGS})
 elseif(OPENMP_ENABLE)
   target_compile_options(${EXECUTABLE_TRANSFORMED_GPU} PUBLIC ${OPENMP_FLAGS})
 else()


Fix Jar name for XcodeML-Common

Fix Jar name for XcodeML-Common

--- properties.cmake
+++ properties.cmake
@@ -43,7 +43,7 @@
 set(OMNI_BIN_DIR "${OMNI_HOME}/bin")
 set(OMNI_F_FRONT "${OMNI_BIN_DIR}/F_Front")
 set(OMNI_C_FRONT "${OMNI_BIN_DIR}/C_Front")
-set(OMNI_JAR_TOOLS "${OMNI_CLASSPATH}/om-exc-tools.jar")
+set(OMNI_JAR_TOOLS "${OMNI_CLASSPATH}/om-common.jar")
 set(OMNI_JAR_F_BACKEND "${OMNI_CLASSPATH}/om-f-back.jar")
 set(OMNI_JAR_C_BACKEND "${OMNI_CLASSPATH}/om-c-back.jar")
 set(OMNI_F2X_FLAGS "")
@@ -54,7 +54,7 @@
 # Define OMNI Compiler jar archives build location.
 set(
   BUILD_OMNI_JAR_TOOLS
-  "${CMAKE_SOURCE_DIR}/omni-compiler/XcodeML-Exc-Tools/build/om-exc-tools.jar"
+  "${CMAKE_SOURCE_DIR}/omni-compiler/XcodeML-Common/build/om-common.jar"
 )
 set(
   BUILD_OMNI_JAR_F_BACKEND


COMP: Fix ITK-FEM module dependencies

COMP: Fix ITK-FEM module dependencies

--- Modularization/modularITKCMake/ITK/Numerics/FEM/itk-module.cmake
+++ Modularization/modularITKCMake/ITK/Numerics/FEM/itk-module.cmake
@@ -1 +1 @@
-itk_module(ITK-FEM DEPENDS ITK-Common TEST_DEPENDS ITK-TestKernel)
+itk_module(ITK-FEM DEPENDS ITK-ImageFunction ITK-RegistrationCommon TEST_DEPENDS ITK-TestKernel)


use lib folder for libraries

use lib folder for libraries

--- Modules/PackageConfiguration/default-package-configuration.cmake
+++ Modules/PackageConfiguration/default-package-configuration.cmake
@@ -10,14 +10,14 @@
   ENDIF()
   SET_TARGET_PROPERTIES(${PACKAGE_TARGET} PROPERTIES
     DEBUG_POSTFIX "_debug"
-    LIBRARY_OUTPUT_DIRECTORY ${PACKAGE_PATH}/tart/${PACKAGE_VERSION}bin/${TART_TARGET_OS}-${TART_TARGET_ARCH}/
-    LIBRARY_OUTPUT_DIRECTORY_DEBUG ${PACKAGE_PATH}/tart/${PACKAGE_VERSION}bin/${TART_TARGET_OS}-${TART_TARGET_ARCH}/
-    LIBRARY_OUTPUT_DIRECTORY_RELEASE ${PACKAGE_PATH}/tart/${PACKAGE_VERSION}bin/${TART_TARGET_OS}-${TART_TARGET_ARCH}/
-    LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO ${PACKAGE_PATH}/tart/${PACKAGE_VERSION}bin/${TART_TARGET_OS}-${TART_TARGET_ARCH}/
-    ARCHIVE_OUTPUT_DIRECTORY ${PACKAGE_PATH}/tart/${PACKAGE_VERSION}bin/${TART_TARGET_OS}-${TART_TARGET_ARCH}/
-    ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${PACKAGE_PATH}/tart/${PACKAGE_VERSION}bin/${TART_TARGET_OS}-${TART_TARGET_ARCH}/
-    ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO ${PACKAGE_PATH}/tart/${PACKAGE_VERSION}bin/${TART_TARGET_OS}-${TART_TARGET_ARCH}/
-    ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${PACKAGE_PATH}/tart/${PACKAGE_VERSION}bin/${TART_TARGET_OS}-${TART_TARGET_ARCH}/
+    LIBRARY_OUTPUT_DIRECTORY ${PACKAGE_PATH}/tart/${PACKAGE_VERSION}lib/${TART_TARGET_OS}-${TART_TARGET_ARCH}/
+    LIBRARY_OUTPUT_DIRECTORY_DEBUG ${PACKAGE_PATH}/tart/${PACKAGE_VERSION}lib/${TART_TARGET_OS}-${TART_TARGET_ARCH}/
+    LIBRARY_OUTPUT_DIRECTORY_RELEASE ${PACKAGE_PATH}/tart/${PACKAGE_VERSION}lib/${TART_TARGET_OS}-${TART_TARGET_ARCH}/
+    LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO ${PACKAGE_PATH}/tart/${PACKAGE_VERSION}lib/${TART_TARGET_OS}-${TART_TARGET_ARCH}/
+    ARCHIVE_OUTPUT_DIRECTORY ${PACKAGE_PATH}/tart/${PACKAGE_VERSION}lib/${TART_TARGET_OS}-${TART_TARGET_ARCH}/
+    ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${PACKAGE_PATH}/tart/${PACKAGE_VERSION}lib/${TART_TARGET_OS}-${TART_TARGET_ARCH}/
+    ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO ${PACKAGE_PATH}/tart/${PACKAGE_VERSION}lib/${TART_TARGET_OS}-${TART_TARGET_ARCH}/
+    ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${PACKAGE_PATH}/tart/${PACKAGE_VERSION}lib/${TART_TARGET_OS}-${TART_TARGET_ARCH}/
     RUNTIME_OUTPUT_DIRECTORY ${PACKAGE_PATH}/tart/${PACKAGE_VERSION}bin/${TART_TARGET_OS}-${TART_TARGET_ARCH}/
     RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PACKAGE_PATH}/tart/${PACKAGE_VERSION}bin/${TART_TARGET_OS}-${TART_TARGET_ARCH}/
     RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${PACKAGE_PATH}/tart/${PACKAGE_VERSION}bin/${TART_TARGET_OS}-${TART_TARGET_ARCH}/


WIP: try to compile only temporalgapfilling for now

--- SuperBuild/CMake/External_otb.cmake
+++ SuperBuild/CMake/External_otb.cmake
@@ -131,7 +131,7 @@

 set(OTB_MODULES_CONFIG)
 if(WITH_REMOTE_MODULES)
-  foreach(remote_module SertitObject Mosaic otbGRM OTBFFSforGMM OTBTemporalGapFilling OTBBioVars OTBPhenology)
+  foreach(remote_module SertitObject Mosaic otbGRM OTBFFSforGMM OTBTemporalGapFilling)
     list(APPEND OTB_MODULES_CONFIG -DModule_${remote_module}:BOOL=ON)
   endforeach()
 else()


Ooops!

Ooops!

--- lib/OpenCogAtomTypes.cmake
+++ lib/OpenCogAtomTypes.cmake
@@ -226,5 +226,5 @@
         ENDIF (NOT MATCHED)
     ENDIF (MATCHED AND CMAKE_MATCH_1)
 ENDFOREACH (LINE)
-FILE(WRITE "${INHERITANCE_FILE}"  "${CLASSSERVER_REFERENCE}endTypeDecls();\n")
+FILE(APPEND "${INHERITANCE_FILE}"  "${CLASSSERVER_REFERENCE}endTypeDecls();\n")
 FILE(APPEND "${HEADER_FILE}" "} // namespace opencog\n")


Fixing Python autodetection and adding a sanity check.

The script fails when Boost.Python3 is detected but Python 3 is not really
available.
The error is a regression from e93d8438.
PYTHON_EXECUTABLE mustn't be used because the PythonInterp script sets the
variable to any interpreter found even it has failed because the version
doesn't match the requested one.

--- ChoosePython.cmake
+++ ChoosePython.cmake
@@ -38,6 +38,11 @@

 set_property(CACHE USE_PYTHON_VERSION PROPERTY STRINGS 2 3 auto)

+if(PYTHONINTERP_FOUND)
+  message(WARNING "This script must be included before trying to find Python.")
+  return()
+endif()
+
 if(${USE_PYTHON_VERSION} STREQUAL auto)
   # Finding Boost first if needed because if the Python3 interpreter is found
   # first there's no way back.
@@ -48,7 +53,7 @@
     find_package(PythonInterp 3 QUIET)
   endif()

-  if(PYTHON_EXECUTABLE AND (NOT CHOOSE_PYTHON_REQUIRE_BOOST OR Boost_FOUND))
+  if(PYTHONINTERP_FOUND AND (NOT CHOOSE_PYTHON_REQUIRE_BOOST OR Boost_FOUND))
     set(USE_PYTHON_VERSION 3)
     message(STATUS "Python 3 chosen automatically")
   else()
@@ -83,8 +88,9 @@
 endif()

 if(NOT PYTHON_EXECUTABLE)
-  find_package(PythonInterp QUIET) # Regardless of auto-detection, now we need to
-                                   # find the interpreter to query the library suffix
+  # Regardless of auto-detection, now we need to find the interpreter to
+  # query the library suffix.
+  find_package(PythonInterp QUIET)
 endif()
 execute_process(COMMAND
   ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1,0,prefix=''))"


fixing output paths

fixing output paths

--- WkBuild.cmake
+++ WkBuild.cmake
@@ -379,9 +379,9 @@
 	add_library(${target_name} ${${PROJECT_NAME}_${target_name}_load_type} ${${PROJECT_NAME}_${target_name}_ALL_SOURCES})

 	#defining where to put what has been built
-	SET(${CMAKE_PROJECT_NAME}_LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/${${CMAKE_PROJECT_NAME}_LIB_DIR} CACHE PATH "Ouput directory for ${PROJECT_NAME} libraries." )
-	mark_as_advanced(FORCE ${CMAKE_PROJECT_NAME}_LIBRARY_OUTPUT_PATH)
-	SET(LIBRARY_OUTPUT_PATH "${${CMAKE_PROJECT_NAME}_LIBRARY_OUTPUT_PATH}" CACHE INTERNAL "Internal CMake libraries output directory. Do not edit." FORCE)
+	SET(${PROJECT_NAME}_LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/${${PROJECT_NAME}_LIB_DIR} CACHE PATH "Ouput directory for ${PROJECT_NAME} libraries." )
+	mark_as_advanced(FORCE ${PROJECT_NAME}_LIBRARY_OUTPUT_PATH)
+	SET(LIBRARY_OUTPUT_PATH "${${PROJECT_NAME}_LIBRARY_OUTPUT_PATH}" CACHE INTERNAL "Internal CMake libraries output directory. Do not edit." FORCE)

 	# adding dependencies for cppcheck ( and format ) targets
 	WkTargetCppCheck(${PROJECT_NAME})
@@ -498,9 +498,9 @@

 	add_executable(${target_name} ${${PROJECT_NAME}_${target_name}_ALL_SOURCES})

-	SET(${CMAKE_PROJECT_NAME}_RUNTIME_OUTPUT_PATH ${PROJECT_BINARY_DIR}/${${CMAKE_PROJECT_NAME}_BIN_DIR} CACHE PATH "Ouput directory for ${PROJECT_NAME} executables." )
-	mark_as_advanced(FORCE ${CMAKE_PROJECT_NAME}_RUNTIME_OUTPUT_PATH)
-	SET(RUNTIME_OUTPUT_PATH "${${CMAKE_PROJECT_NAME}_RUNTIME_OUTPUT_PATH}" CACHE INTERNAL "Internal CMake executables output directory. Do not edit." FORCE)
+	SET(${PROJECT_NAME}_RUNTIME_OUTPUT_PATH ${PROJECT_BINARY_DIR}/${${PROJECT_NAME}_BIN_DIR} CACHE PATH "Ouput directory for ${PROJECT_NAME} executables." )
+	mark_as_advanced(FORCE ${PROJECT_NAME}_RUNTIME_OUTPUT_PATH)
+	SET(RUNTIME_OUTPUT_PATH "${${PROJECT_NAME}_RUNTIME_OUTPUT_PATH}" CACHE INTERNAL "Internal CMake executables output directory. Do not edit." FORCE)

 	# adding dependencies for cppcheck ( and format ) targets
 	WkTargetCppCheck(${PROJECT_NAME})


add .dsv env hooks to the local_setup.dsv (#210)

Signed-off-by: Dirk Thomas <19795c8185177e940eedd30ceb2b716a54a3d5dc@users.noreply.github.com>

--- ament_cmake_core/cmake/environment_hooks/ament_generate_package_environment.cmake
+++ ament_cmake_core/cmake/environment_hooks/ament_generate_package_environment.cmake
@@ -95,6 +95,12 @@
   endforeach()

   # generate local_setup.dsv file
+  if(DEFINED _AMENT_CMAKE_ENVIRONMENT_HOOKS_dsv)
+    list(SORT _AMENT_CMAKE_ENVIRONMENT_HOOKS_dsv)
+    foreach(hook ${_AMENT_CMAKE_ENVIRONMENT_HOOKS_dsv})
+      set(all_hooks "${all_hooks}source;${hook}\n")
+    endforeach()
+  endif()
   list(APPEND all_package_level_extensions "dsv")
   set(dsv_file "${CMAKE_BINARY_DIR}/ament_cmake_environment_hooks/local_setup.dsv")
   file(WRITE "${dsv_file}" "${all_hooks}")


Fixed configure error in tools. Removed INTERFACE directive from component_definitions.cmake. Succesful configure, but bindings will not build due to swig errors.

--- tools/component_definitions.cmake
+++ tools/component_definitions.cmake
@@ -174,8 +174,6 @@
         add_library(${${COMPONENT}_SHARED_LIB} SHARED ${${COMPONENT}_SRCS})
         set_target_properties(${${COMPONENT}_SHARED_LIB} PROPERTIES
             OUTPUT_NAME ${PROJECT_NAME} LINKER_LANGUAGE CXX)
-        set_target_properties(${${COMPONENT}_SHARED_LIB}
-            PROPERTIES LINK_INTERFACE_LIBRARIES "")
         add_dependencies(${${COMPONENT}_SHARED_LIB} ${FIELDS_SHARED_LIBS})

         # Override cmake's placing of "${COMPONENT_LIB}_EXPORTS into the preproc symbol table.


Squashed '3rdparty/github/cmake-utils/' changes from e13b3c7a..7303dc1f

7303dc1f Add HAVE_LOCALE_H

git-subtree-dir: 3rdparty/github/cmake-utils
git-subtree-split: 7303dc1fb352bbd1da54fe0b70e8cfa44b0c65bf

--- cmake/MyPackageCheckCommonIncludeFiles.cmake
+++ cmake/MyPackageCheckCommonIncludeFiles.cmake
@@ -18,4 +18,5 @@
   CHECK_INCLUDE_FILE ("fcntl.h"        HAVE_FCNTL_H)
   CHECK_INCLUDE_FILE ("math.h"         HAVE_MATH_H)
   CHECK_INCLUDE_FILE ("float.h"        HAVE_FLOAT_H)
+  CHECK_INCLUDE_FILE ("locale.h"       HAVE_LOCALE_H)
 ENDMACRO()


fix print system info

fix print system info

--- cmakemodules/script_show_final_summary.cmake
+++ cmakemodules/script_show_final_summary.cmake
@@ -57,9 +57,9 @@
 message(STATUS "|         Resulting configuration for ${CMAKE_MRPT_COMPLETE_NAME}                            |")
 message(STATUS "+===========================================================================+")
 message(STATUS " _________________________ PLATFORM _____________________________")
-message(STATUS " Host                        : "             ${CMAKE_HOST_SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_VERSION} ${CMAKE_HOST_SYSTEM_PROCESSOR})
+message(STATUS " Host                        : ${CMAKE_HOST_SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_VERSION} ${CMAKE_HOST_SYSTEM_PROCESSOR}")
 if(CMAKE_CROSSCOMPILING)
-message(STATUS " Target                      : "         ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_VERSION} ${CMAKE_SYSTEM_PROCESSOR})
+message(STATUS " Target                      : ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_VERSION} ${CMAKE_SYSTEM_PROCESSOR}")
 endif(CMAKE_CROSSCOMPILING)
 message(STATUS " Architecture (uname -m)     : " ${CMAKE_MRPT_ARCH})
 message(STATUS " CMAKE_INSTALL_FULL_LIBDIR   : " ${CMAKE_INSTALL_FULL_LIBDIR})


updated cmake finder to fit for library name change

--- FindTREEJUCE.cmake
+++ FindTREEJUCE.cmake
@@ -1,21 +1,43 @@
 include(FindPackageMessage)
 include(FindPackageHandleStandardArgs)
+include(GNUInstallDirs)

 set(TREEJUCE_SEARCH_PREFIX "" CACHE PATH "additional path to search for treejuce")
 set(TREEJUCE_SEARCH_PREFIX_INC "" CACHE PATH "additional path to search for treejuce headers")
 set(TREEJUCE_SEARCH_PREFIX_LIB "" CACHE PATH "additional path to search for treejuce library")
+set(TREEJUCE_SEARCH_STATIC 0 CACHE BOOL "search static library instead of shared library")

+#
 # find header directory
+#
+
 find_path(TREEJUCE_INCLUDE_DIR treejuce/Config.h
-    HINTS ${TREEJUCE_SEARCH_PREFIX_INC} ${TREEJUCE_SEARCH_PREFIX}/include
+    HINTS
+        ${TREEJUCE_SEARCH_PREFIX_INC}
+        ${TREEJUCE_SEARCH_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}
+        ${TREEJUCE_SEARCH_PREFIX}/include
 )

+#
 # find library
-find_library(TREEJUCE_LIBRARIES treejuce
-    HINTS ${TREEJUCE_SEARCH_PREFIX_LIB} ${TREEJUCE_SEARCH_PREFIX}/lib
+#
+if(TREEJUCE_SEARCH_STATIC)
+    set(treejuce_lib_name "treejuce_s")
+    set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX})
+else()
+    set(treejuce_lib_name "treejuce")
+endif()
+
+find_library(TREEJUCE_LIBRARIES ${treejuce_lib_name}
+    HINTS
+        ${TREEJUCE_SEARCH_PREFIX_LIB}
+        ${TREEJUCE_SEARCH_PREFIX}/${CMAKE_INSTALL_LIBDIR}
+        ${TREEJUCE_SEARCH_PREFIX}/lib
 )

+#
 # finalize
+#
 FIND_PACKAGE_HANDLE_STANDARD_ARGS(TREEJUCE
     REQUIRED_VARS TREEJUCE_INCLUDE_DIR TREEJUCE_LIBRARIES
 )


Fix a couple of bugs in locating OpenCV.


fix required version

fix required version

--- cmake/LLVMIRUtil.cmake
+++ cmake/LLVMIRUtil.cmake
@@ -4,7 +4,7 @@
 #
 # LLVM IR utils for cmake

-cmake_minimum_required(VERSION 2.8.11)
+cmake_minimum_required(VERSION 3.0.0)

 include(CMakeParseArguments)


cmake: extensions: improve DT consistency with python APIs

In the python APIs we use for devicetree, you can generally use an
alias interchangeably with the full path to a node.

For example, dtlib.py says:

    [...] both dt.get_node("/foo/bar") and dt.get_node("bar-alias")
    will return the 'bar' node below:

      /dts-v1/;

      / {
              foo {
                      bar_label: bar {
                              baz {
                              };
                      };
              };

              aliases {
                      bar-alias = &bar-label;
              };
      };

    Fetching subnodes via aliases is supported:
    dt.get_node("bar-alias/baz") returns the 'baz' node.

Now that we have the necessary helper functions for resolving alias
names, make the CMake APIs to devicetree behave the same way. This
improves consistency between the two sets of devicetree helpers used
by the build system, making them both match the general devicetree
practice that an alias is as good as a path. This is good for
consistency.

Signed-off-by: Martí Bolívar <9d90ac4c7bf6a305f6bfd81a23c7859bc883380e@nordicsemi.no>

--- cmake/extensions.cmake
+++ cmake/extensions.cmake
@@ -2530,8 +2530,16 @@
 #
 # The following methods are for retrieving devicetree information in CMake.
 #
-# Note: In CMake we refer to the nodes using the node's path, therefore there
-# is no dt_path(...) function for obtaining a node identifier.
+# Notes:
+#
+# - In CMake, we refer to the nodes using the node's path, therefore
+#   there is no dt_path(...) function for obtaining a node identifier
+#   like there is in the C devicetree.h API.
+#
+# - As another difference from the C API, you can generally use an
+#   alias at the beginning of a path interchangeably with the full
+#   path to the aliased node in these functions. The usage comments
+#   will make this clear in each case.

 # Usage:
 #   dt_nodelabel(<var> NODELABEL <label>)
@@ -2629,6 +2637,12 @@
 #
 # Tests whether a node with path <path> exists in the devicetree.
 #
+# The <path> value may be any of these:
+#
+# - absolute path to a node, like '/foo/bar'
+# - a node alias, like 'my-alias'
+# - a node alias followed by a path to a child node, like 'my-alias/child-node'
+#
 # The result of the check, either TRUE or FALSE, will be returned in
 # the <var> parameter.
 #
@@ -2650,10 +2664,9 @@
     endif()
   endforeach()

-  get_target_property(${var} devicetree_target "DT_NODE|${DT_NODE_PATH}")
-
-  if(${var})
-    set(${var} ${${var}} PARENT_SCOPE)
+  dt_path_internal(canonical "${DT_NODE_PATH}")
+  if (DEFINED canonical)
+    set(${var} TRUE PARENT_SCOPE)
   else()
     set(${var} FALSE PARENT_SCOPE)
   endif()
@@ -2667,6 +2680,12 @@
 # - has a status property matching the <status> argument
 #   (a missing status or an “ok” status is treated as if it
 #    were “okay” instead)
+#
+# The <path> value may be any of these:
+#
+# - absolute path to a node, like '/foo/bar'
+# - a node alias, like 'my-alias'
+# - a node alias followed by a path to a child node, like 'my-alias/child-node'
 #
 # The result of the check, either TRUE or FALSE, will be returned in
 # the <var> parameter.
@@ -2690,13 +2709,13 @@
     endif()
   endforeach()

-  dt_node_exists(${var} PATH ${DT_NODE_PATH})
-  if(NOT ${${var}})
+  dt_path_internal(canonical ${DT_NODE_PATH})
+  if(NOT DEFINED canonical)
     set(${var} FALSE PARENT_SCOPE)
     return()
   endif()

-  dt_prop(${var} PATH ${DT_NODE_PATH} PROPERTY status)
+  dt_prop(${var} PATH ${canonical} PROPERTY status)

   if(NOT DEFINED ${var} OR "${${var}}" STREQUAL ok)
     set(${var} okay)
@@ -2715,6 +2734,12 @@
 #
 # Get a devicetree property value. The value will be returned in the
 # <var> parameter.
+#
+# The <path> value may be any of these:
+#
+# - absolute path to a node, like '/foo/bar'
+# - a node alias, like 'my-alias'
+# - a node alias followed by a path to a child node, like 'my-alias/child-node'
 #
 # This function currently only supports properties with the following
 # devicetree binding types: string, int, boolean, array, uint8-array,
@@ -2770,8 +2795,9 @@
     endif()
   endforeach()

+  dt_path_internal(canonical "${DT_PROP_PATH}")
   get_property(exists TARGET devicetree_target
-      PROPERTY "DT_PROP|${DT_PROP_PATH}|${DT_PROP_PROPERTY}"
+      PROPERTY "DT_PROP|${canonical}|${DT_PROP_PROPERTY}"
       SET
   )

@@ -2781,7 +2807,7 @@
   endif()

   get_target_property(val devicetree_target
-      "DT_PROP|${DT_PROP_PATH}|${DT_PROP_PROPERTY}"
+      "DT_PROP|${canonical}|${DT_PROP_PROPERTY}"
   )

   if(DEFINED DT_PROP_INDEX)
@@ -2801,6 +2827,12 @@
 #
 # The value will be returned in the <var> parameter.
 #
+# The <path> value may be any of these:
+#
+# - absolute path to a node, like '/foo/bar'
+# - a node alias, like 'my-alias'
+# - a node alias followed by a path to a child node, like 'my-alias/child-node'
+#
 # <var>          : Return variable where the property value will be stored
 # PATH <path>    : Node path
 function(dt_num_regs var)
@@ -2819,7 +2851,8 @@
     endif()
   endforeach()

-  get_target_property(${var} devicetree_target "DT_REG|${DT_REG_PATH}|NUM")
+  dt_path_internal(canonical "${DT_REG_PATH}")
+  get_target_property(${var} devicetree_target "DT_REG|${canonical}|NUM")

   set(${var} ${${var}} PARENT_SCOPE)
 endfunction()
@@ -2831,6 +2864,12 @@
 # If <idx> is omitted, then the value at index 0 will be returned.
 #
 # The value will be returned in the <var> parameter.
+#
+# The <path> value may be any of these:
+#
+# - absolute path to a node, like '/foo/bar'
+# - a node alias, like 'my-alias'
+# - a node alias followed by a path to a child node, like 'my-alias/child-node'
 #
 # Results can be:
 # - The base address of the register block
@@ -2861,7 +2900,8 @@
     set(DT_REG_INDEX 0)
   endif()

-  get_target_property(${var}_list devicetree_target "DT_REG|${DT_REG_PATH}|ADDR")
+  dt_path_internal(canonical "${DT_REG_PATH}")
+  get_target_property(${var}_list devicetree_target "DT_REG|${canonical}|ADDR")

   list(GET ${var}_list ${DT_REG_INDEX} ${var})

@@ -2879,6 +2919,12 @@
 # If INDEX is omitted, then the value at index 0 will be returned.
 #
 # The value will be returned in the <value> parameter.
+#
+# The <path> value may be any of these:
+#
+# - absolute path to a node, like '/foo/bar'
+# - a node alias, like 'my-alias'
+# - a node alias followed by a path to a child node, like 'my-alias/child-node'
 #
 # <var>          : Return variable where the size value will be stored
 # PATH <path>    : Node path
@@ -2904,7 +2950,8 @@
     set(DT_REG_INDEX 0)
   endif()

-  get_target_property(${var}_list devicetree_target "DT_REG|${DT_REG_PATH}|SIZE")
+  dt_path_internal(canonical "${DT_REG_PATH}")
+  get_target_property(${var}_list devicetree_target "DT_REG|${canonical}|SIZE")

   list(GET ${var}_list ${DT_REG_INDEX} ${var})


Corrected file mode

Corrected file mode


add a compilation test in FindGoogleHash.cmake to catch configuration
issues when multiple compilers are used on the same system.

--HG--
extra : convert_revision : svn%3A283d02a7-25f6-0310-bc7c-ecb5cbfe19da/trunk/kdesupport/eigen2%40913381

--- cmake/FindGoogleHash.cmake
+++ cmake/FindGoogleHash.cmake
@@ -10,7 +10,14 @@
   ${INCLUDE_INSTALL_DIR}
 )

+if(GOOGLEHASH_INCLUDES)
+  # let's make sure it compiles with the current compiler
+  file(WRITE ${CMAKE_BINARY_DIR}/googlehash_test.cpp
+  "#include <google/sparse_hash_map>\n#include <google/dense_hash_map>\nint main(int argc, char** argv) { google::dense_hash_map<int,float> a; google::sparse_hash_map<int,float> b; return 0;}\n")
+  try_compile(GOOGLEHASH_COMPILE ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/googlehash_test.cpp OUTPUT_VARIABLE GOOGLEHASH_COMPILE_RESULT)
+endif(GOOGLEHASH_INCLUDES)
+
 include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(GOOGLEHASH DEFAULT_MSG GOOGLEHASH_INCLUDES)
+find_package_handle_standard_args(GOOGLEHASH DEFAULT_MSG GOOGLEHASH_INCLUDES GOOGLEHASH_COMPILE)

 mark_as_advanced(GOOGLEHASH_INCLUDES)


Introduced OPENSYNC_EXTERNAL_PLUGIN_INSTALL CMake Macro to install
external (XML) plugin configuration

git-svn-id: e31799a7ad59d6ea355ca047c69e0aee8a59fcd3@5909 53f5c7ee-bee3-0310-bbc5-ea0e15fffd5e

--- cmake/OpenSyncPlugin.cmake
+++ cmake/OpenSyncPlugin.cmake
@@ -18,6 +18,13 @@
 MACRO( OPENSYNC_PLUGIN_INSTALL _pluginName )
   INSTALL( TARGETS ${_pluginName} DESTINATION ${OPENSYNC_PLUGINDIR} )
 ENDMACRO( OPENSYNC_PLUGIN_INSTALL )
+
+## Install external plugin
+### Got introduced to be able in future to move those plugins into
+### a seperated directory, without fixing all plugin build environments
+MACRO( OPENSYNC_EXTERNAL_PLUGIN_INSTALL _pluginName )
+  INSTALL( TARGETS ${_pluginName} DESTINATION ${OPENSYNC_PLUGINDIR} )
+ENDMACRO( OPENSYNC_EXTERNAL_PLUGIN_INSTALL )

 ## Install format plugin
 MACRO( OPENSYNC_FORMAT_INSTALL _pluginName  )


Correct typo

svn path=/trunk/; revision=6852

--- cmake/modules/FindGD.cmake
+++ cmake/modules/FindGD.cmake
@@ -1,7 +1,7 @@
 # - Find GD
 # Find the native GD includes and library
 # This module defines
-#  GD_INCLUDE_DIR, where to find jpeglib.h, etc.
+#  GD_INCLUDE_DIR, where to find gd.h, etc.
 #  GD_LIBRARIES, the libraries needed to use GD.
 #  GD_FOUND, If false, do not try to use GD.
 # also defined, but not for general use are


moved to 'latest' version of GCC in the system

--- cmake/toolchains/gcc.cmake
+++ cmake/toolchains/gcc.cmake
@@ -1,5 +1,5 @@
-set(CMAKE_C_COMPILER   gcc-4.9)
-set(CMAKE_CXX_COMPILER g++-4.9)
+set(CMAKE_C_COMPILER   gcc)
+set(CMAKE_CXX_COMPILER g++)
 add_compile_options(-Wall -Werror)
 add_compile_options(-std=c++1y)
 add_compile_options(-fstack-protector-all)


Modify htslib.cmake to inherit number of jobs

Calling make using the $(MAKE) built-in variable will inherit the
number of simultaneous jobs to run when the parent project is being
built with make.

If the parent uses a different build system, because of the lack of job
control, building htslib in parallel is likely to be counter-productive
as the parent build system is likely running in parallel already.

--- contrib/htslib.cmake
+++ contrib/htslib.cmake
@@ -1,5 +1,15 @@
+if (CMAKE_GENERATOR STREQUAL "Unix Makefiles")
+    # when using the makefile generator, use the special variable $(MAKE) to invoke make
+    # this enables the jobserver to work correctly
+    set(MAKE_COMMAND "$(MAKE)")
+else()
+    # invoke make explicitly
+    # in this case, we assume the parent build system is running in parallel already so no -j flag is added
+    find_program(MAKE_COMMAND NAMES make gmake)
+endif()
+
 if (INSTALL_DEPENDENCIES)
-    set(HTSLIB_INSTALL make install prefix=${CMAKE_INSTALL_PREFIX})
+    set(HTSLIB_INSTALL ${MAKE_COMMAND} install prefix=${CMAKE_INSTALL_PREFIX})
 else()
     set(HTSLIB_INSTALL "")
 endif()
@@ -12,7 +22,7 @@
     GIT_TAG broad
     BUILD_IN_SOURCE 1
     CONFIGURE_COMMAND ""
-    BUILD_COMMAND make lib-static -j 4
+    BUILD_COMMAND ${MAKE_COMMAND} lib-static
     INSTALL_COMMAND "${HTSLIB_INSTALL}"
     LOG_DOWNLOAD 0
     LOG_UPDATE 0


copy diff-clang-format.py if it has changed

--- cmake/CodeFormat.cmake
+++ cmake/CodeFormat.cmake
@@ -14,7 +14,7 @@
     COMMENT "Copying diff-clang-format.py"
 )
 add_custom_target(
-    diff-clang-format.py
+    diff-clang-format.py ALL
     DEPENDS ${CMAKE_BINARY_DIR}/diff-clang-format.py
 )
 add_custom_target(format-cpp


Fix issue #1926 CMake breaks while building static libs on Redhat/CentOS

--- cmake/Findcrypto.cmake
+++ cmake/Findcrypto.cmake
@@ -59,7 +59,7 @@
         if (BUILD_SHARED_LIBS)
             set(crypto_LIBRARY ${crypto_SHARED_LIBRARY})
         else()
-            set(crypto_LIBRARY ${crypto_STATIC_LIBRARY})
+            set(crypto_LIBRARY ${crypto_SHARED_LIBRARY})
         endif()
     endif()


adding Hunter debug output

adding Hunter debug output

--- cmake/HunterGate.cmake
+++ cmake/HunterGate.cmake
@@ -47,7 +47,7 @@

 option(HUNTER_ENABLED "Enable Hunter package manager support" ON)
 option(HUNTER_STATUS_PRINT "Print working status" ON)
-option(HUNTER_STATUS_DEBUG "Print a lot info" OFF)
+option(HUNTER_STATUS_DEBUG "Print a lot info" ON)

 set(HUNTER_WIKI "https://github.com/ruslo/hunter/wiki")


Fix the error in tbag_config__set_option()

--- cmake/TbagConfig.cmake
+++ cmake/TbagConfig.cmake
@@ -108,8 +108,14 @@
 #/// @remarks
 #///  If enabled, add a definitions.
 macro (tbag_config__set_option __value)
-    if (${ARGC} GREATER 0)
-        set (__default_option ${ARG0})
+    if (${ARGC} GREATER 1)
+        ## Error in CMake 2.8.12.2 (Ubuntu 14.04):
+        ## - list (GET ${ARGN} 0 __flag)
+        ## The 'foreach' statement of the following alternatives:
+        foreach (__flag ${ARGN})
+            set (__default_option ${__flag})
+            break ()
+        endforeach ()
     else ()
         set (__default_option ON)
     endif ()


cmake: check_compiler_flag: Fix bug where checks were aliased

Fix a bug where different compiler checks were aliased and therefore
the test results were incorrectly re-used.

The 'check' string is used by CMake internally to cache test results,
but when testing linker flags the check string has been aliased
between the different linker checks. To fix the aliasing issue we add
the CMAKE_REQUIRED_FLAGS variable to the 'check' string. The aliasing
issue disappears because the linker flag-under-test is in
'CMAKE_REQUIRED_FLAGS'.

Signed-off-by: Sebastian Bøe <edee888afd63e94916688495334700803eba20a0@nordicsemi.no>

--- cmake/extensions.cmake
+++ cmake/extensions.cmake
@@ -943,7 +943,11 @@
 # check_compiler_flag(C "-Wall" my_check)
 # print(my_check) # my_check is now 1
 function(check_compiler_flag lang option ok)
-  string(MAKE_C_IDENTIFIER check${option}_${lang} ${ok})
+
+  string(MAKE_C_IDENTIFIER
+    check${option}_${lang}_${CMAKE_REQUIRED_FLAGS}
+    ${ok}
+    )

   if(${lang} STREQUAL C)
     check_c_compiler_flag("${option}" ${${ok}})


cmake: add west version checking

cmake: add west version checking

Parse the west version output and make sure both bootstrapper and
installation wests are up to date. This will still work after the two
are combined into what gets installed via PyPI.

Fixes: #13209
Signed-off-by: Marti Bolivar <fd5da480b758a78208111e6ae5c6806e1f887137@foundries.io>

--- cmake/host-tools.cmake
+++ cmake/host-tools.cmake
@@ -7,6 +7,40 @@
   )
 if(${WEST} STREQUAL WEST-NOTFOUND)
   unset(WEST)
+else()
+  # If west is found, make sure its version matches the minimum
+  # required one.
+  set(MIN_WEST_VERSION 0.5.4)
+  execute_process(
+    COMMAND
+    ${WEST} --version
+    OUTPUT_VARIABLE west_version_output
+    )
+
+  # The west --version output is currently multiline: bootstrapper
+  # followed by installation version. Test both. This will still work
+  # when .west/west is eliminated from the installation and obtained
+  # via pypi, which will result in a single line of output.
+  string(REGEX REPLACE "\n" ";" west_version_output "${west_version_output}")
+  foreach(item ${west_version_output})
+    if("${item}" MATCHES ".*v([0-9]+[.][0-9]+[.][0-9]+)")
+      set(west_version "${CMAKE_MATCH_1}")
+      if(${west_version} VERSION_LESS ${MIN_WEST_VERSION})
+        message(FATAL_ERROR "The detected west version is unsupported.\n\
+  The version was found to be ${west_version}:\n\
+    ${item}\n\
+  But the minimum supported version is ${MIN_WEST_VERSION}\n\
+  Please upgrade, e.g. with:\n\
+      pip3 install --upgrade west\n\
+  if the version from pip is too old, or:\n\
+      west update\n\
+  if the version in the installation is too old.")
+      endif()
+    endif()
+  endforeach()
+  # Just output information for a single version. This will still work
+  # even after output is one line.
+  message(STATUS "Found west: ${WEST} (found suitable version \"${west_version}\", minimum required is \"${MIN_WEST_VERSION}\")")
 endif()

 # Search for the must-have program dtc on PATH and in


Add friendly error message for ros/catkin#961 (#964)

--- cmake/test/tests.cmake
+++ cmake/test/tests.cmake
@@ -97,6 +97,11 @@
     message(FATAL_ERROR "catkin_run_tests_target() called with unused arguments: ${_testing_UNPARSED_ARGUMENTS}")
   endif()

+  # Friendly error message for ros/catkin#961
+  if(TARGET run_tests_${PROJECT_NAME} AND NOT TARGET _run_tests_${PROJECT_NAME})
+    message(FATAL_ERROR "catkin_run_tests_target() needs to create a target called `run_tests_${PROJECT_NAME}`, but it already exists. Please rename the existing `run_tests_${PROJECT_NAME}` target/executable/library to something else.")
+  endif()
+
   # create meta target to trigger all tests of a project
   if(NOT TARGET run_tests_${PROJECT_NAME})
     add_custom_target(run_tests_${PROJECT_NAME})


stripping releases

stripping releases

--- common/cmake/package.cmake
+++ common/cmake/package.cmake
@@ -130,7 +130,7 @@
 SET(CPACK_PACKAGE_FILE_NAME "embree-${EMBREE_VERSION}")
 #SET(CPACK_PACKAGE_ICON ${PROJECT_SOURCE_DIR}/embree-doc/images/icon.png)
 #SET(CPACK_PACKAGE_RELOCATABLE TRUE)
-#SET(CPACK_STRIP_FILES TRUE) # keep symbols, useful for bug reports
+SET(CPACK_STRIP_FILES TRUE)

 SET(CPACK_PACKAGE_VERSION_MAJOR ${EMBREE_VERSION_MAJOR})
 SET(CPACK_PACKAGE_VERSION_MINOR ${EMBREE_VERSION_MINOR})


fixed compilation on Mingw64

fixed compilation on Mingw64

--- OpenCVModule.cmake
+++ OpenCVModule.cmake
@@ -28,8 +28,11 @@
     source_group("Include" FILES ${lib_hdrs})

     set(the_target "opencv_${name}")
-
-    add_library(${the_target} ${lib_srcs} ${lib_hdrs} ${lib_int_hdrs})
+    if (${name} MATCHES "ts" AND MINGW)
+        add_library(${the_target} STATIC ${lib_srcs} ${lib_hdrs} ${lib_int_hdrs})
+    else()
+        add_library(${the_target} ${lib_srcs} ${lib_hdrs} ${lib_int_hdrs})
+    endif()

     # For dynamic link numbering convenions
     if(NOT ANDROID)


Added catch semantics to ignored errors

Added catch semantics to ignored errors

--- build/macros.cmake
+++ build/macros.cmake
@@ -411,6 +411,7 @@
 		append_all_compiler_flag("/wd4201") #nameless struct/union (GLM)
 		append_all_compiler_flag("/wd4464") #relative include path contains '..' (GLM)
 		append_all_compiler_flag("/wd4514") #unreferenced inline function has been removed
+		append_all_compiler_flag("/wd4571") #catch(...) semantics changed
 		append_all_compiler_flag("/wd4710") #function not inlined (the entire std lib)
 		append_all_compiler_flag("/wd4820") #Padding added to type


update: version able to deal w/ components

--- cmake/FindXCB.cmake
+++ cmake/FindXCB.cmake
@@ -1,51 +1,54 @@
-# - FindXCB
+#.rst:
+# FindXCB
+# -------
 #
-# Copyright (C) 2015 Valve Corporation
+# Find XCB libraries
+#
+# Tries to find xcb libraries on unix systems.
+#
+# - Be sure to set the COMPONENTS to the components you want to link to
+# - COMPONENTS need to be specified by full name (e.g., xcb-util)
+# - The XCB_LIBRARIES variable is set ONLY to your COMPONENTS list
+# - To use only a specific component check the XCB_LIBRARIES_${COMPONENT} variable
+#
+# The following values are defined
+#
+# ::
+#
+#   XCB_FOUND         - True if xcb is available
+#   XCB_INCLUDE_DIRS  - Include directories for xcb
+#   XCB_LIBRARIES     - List of libraries for xcb
+#   XCB_DEFINITIONS   - List of definitions for xcb
+#
+#=============================================================================
+# Copyright (c) 2015 Jari Vetoniemi
+#
+# Distributed under the OSI-approved BSD License (the "License");
+#
+# 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.
+#=============================================================================
+
+include(FeatureSummary)
+set_package_properties(XCB PROPERTIES
+   URL "http://xcb.freedesktop.org/"
+   DESCRIPTION "X protocol C-language Binding")

 find_package(PkgConfig)
+pkg_check_modules(PC_XCB QUIET xcb ${XCB_FIND_COMPONENTS})

-if(NOT XCB_FIND_COMPONENTS)
-    set(XCB_FIND_COMPONENTS xcb)
-endif()
+find_library(XCB_LIBRARIES xcb HINTS ${PC_XCB_LIBRARY_DIRS})
+find_path(XCB_INCLUDE_DIRS xcb/xcb.h PATH_SUFFIXES xcb HINTS ${PC_XCB_INCLUDE_DIRS})
+
+foreach(COMPONENT ${XCB_FIND_COMPONENTS})
+	find_library(XCB_LIBRARIES_${COMPONENT} ${COMPONENT} HINTS ${PC_XCB_LIBRARY_DIRS})
+	list(APPEND XCB_LIBRARIES ${XCB_LIBRARIES_${COMPONENT}})
+	mark_as_advanced(XCB_LIBRARIES_${COMPONENT})
+endforeach(COMPONENT ${XCB_FIND_COMPONENTS})
+
+set(XCB_DEFINITIONS ${PC_XCB_CFLAGS_OTHER})

 include(FindPackageHandleStandardArgs)
-set(XCB_FOUND true)
-set(XCB_INCLUDE_DIRS "")
-set(XCB_LIBRARIES "")
-foreach(comp ${XCB_FIND_COMPONENTS})
-    # component name
-    string(TOUPPER ${comp} compname)
-    string(REPLACE "-" "_" compname ${compname})
-    # header name
-    string(REPLACE "xcb-" "" headername xcb/${comp}.h)
-    # library name
-    set(libname ${comp})
-
-    pkg_check_modules(PC_${comp} QUIET ${comp})
-
-    find_path(${compname}_INCLUDE_DIR NAMES ${headername}
-        HINTS
-        ${PC_${comp}_INCLUDEDIR}
-        ${PC_${comp}_INCLUDE_DIRS}
-        )
-
-    find_library(${compname}_LIBRARY NAMES ${libname}
-        HINTS
-        ${PC_${comp}_LIBDIR}
-        ${PC_${comp}_LIBRARY_DIRS}
-        )
-
-    find_package_handle_standard_args(${comp}
-        FOUND_VAR ${comp}_FOUND
-        REQUIRED_VARS ${compname}_INCLUDE_DIR ${compname}_LIBRARY)
-    mark_as_advanced(${compname}_INCLUDE_DIR ${compname}_LIBRARY)
-
-    list(APPEND XCB_INCLUDE_DIRS ${${compname}_INCLUDE_DIR})
-    list(APPEND XCB_LIBRARIES ${${compname}_LIBRARY})
-
-    if(NOT ${comp}_FOUND)
-        set(XCB_FOUND false)
-    endif()
-endforeach()
-
-list(REMOVE_DUPLICATES XCB_INCLUDE_DIRS)
+find_package_handle_standard_args(XCB DEFAULT_MSG XCB_LIBRARIES XCB_INCLUDE_DIRS)
+mark_as_advanced(XCB_INCLUDE_DIRS XCB_LIBRARIES XCB_DEFINITIONS)


CMake: Add registry query for modern QT

CMake: Add registry query for modern QT

--- cmake/QtUtils.cmake
+++ cmake/QtUtils.cmake
@@ -1,3 +1,52 @@
+macro(msvc_registry_search)
+    IF(MSVC)
+        # look for user-registry pointing to qtcreator
+        get_filename_component(QT_BIN [HKEY_CURRENT_USER\\Software\\Classes\\Applications\\QtProject.QtCreator.cpp\\shell\\Open\\Command] PATH)
+        # get root path so we can search for 5.3, 5.4, 5.5, etc
+        string(REPLACE "/Tools" ";" QT_BIN "${QT_BIN}")
+        list(GET QT_BIN 0 QT_BIN)
+        file(GLOB QT_VERSIONS "${QT_BIN}/5.*")
+        list(SORT QT_VERSIONS)
+        # assume the latest version will be last alphabetically
+        list(REVERSE QT_VERSIONS)
+        list(GET QT_VERSIONS 0 QT_VERSION)
+        # fix any double slashes which seem to be common
+        string(REPLACE "//" "/"  QT_VERSION "${QT_VERSION}")
+        if(MSVC_VERSION GREATER_EQUAL "1910")
+            set(QT_MSVC "2017")
+        elseif(MSVC_VERSION GREATER_EQUAL "1900")
+            set(QT_MSVC "2015")
+        else()
+            # Latest QT versions >5.10 provides only 2015 and 2017 prebuilt binaries
+            message(WARNING "Unsupported MSVC toolchain version")
+        endif()
+        if(QT_MSVC)
+            # check for 64-bit target
+            if(CMAKE_CL_64)
+                SET(QT_MSVC "${QT_MSVC}_64")
+            endif()
+            set(QT_TOLLCHAIN "${QT_VERSION}/msvc${QT_MSVC}")
+            if(EXISTS ${QT_TOLLCHAIN})
+                set(Qt5_DIR "${QT_TOLLCHAIN}/lib/cmake/Qt5")
+            elseif(QT_MSVC EQUAL "2017")
+                #2017 is ABI compatible with 2015
+                if(CMAKE_CL_64)
+                    set(QT_TOLLCHAIN "${QT_VERSION}/msvc2015_64")
+                else()
+                    set(QT_TOLLCHAIN "${QT_VERSION}/msvc2015")
+                endif()
+                if(EXISTS ${QT_TOLLCHAIN})
+                    set(Qt5_DIR "${QT_TOLLCHAIN}/lib/cmake/Qt5")
+                else()
+                    message(WARNING "Required QT5 toolchain is not installed")
+                endif()
+            else()
+                message(WARNING "Required QT5 toolchain is not installed")
+            endif()
+        endif()
+    ENDIF()
+endmacro()
+
 macro(find_qt5)
     set(CMAKE_INCLUDE_CURRENT_DIR ON)
     set(CMAKE_AUTOMOC ON)


cmake: export PROJECT_BINARY_DIR variable to kconfig

Expose PROJECT_BINARY_DIR to kconfig since we will we looking for
generated files from dts pass in the future and need to know the
location of those files.

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

--- cmake/kconfig.cmake
+++ cmake/kconfig.cmake
@@ -30,6 +30,7 @@
 set(ENV{ARCH}      ${ARCH})
 set(ENV{BOARD_DIR} ${BOARD_DIR})
 set(ENV{SOC_DIR}   ${SOC_DIR})
+set(ENV{PROJECT_BINARY_DIR} ${PROJECT_BINARY_DIR})

 add_custom_target(
   menuconfig
@@ -41,6 +42,7 @@
   ARCH=$ENV{ARCH}
   BOARD_DIR=$ENV{BOARD_DIR}
   SOC_DIR=$ENV{SOC_DIR}
+  PROJECT_BINARY_DIR=$ENV{PROJECT_BINARY_DIR}
   ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/scripts/kconfig/menuconfig.py ${KCONFIG_ROOT}
   WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/kconfig
   USES_TERMINAL


Explicitly add BUILD_TESTING CMake option (#5627)

This way is visible as a variable in the cache that can be set.

--- cmake/options.cmake
+++ cmake/options.cmake
@@ -19,6 +19,8 @@

 option(OSQUERY_NO_DEBUG_SYMBOLS "Whether to build without debug symbols or not, even if a build type that normally have them has been selected")

+option(BUILD_TESTING "Whether to enable and build tests or not")
+
 # This is the default S3 storage used by Facebook to store 3rd party dependencies; it
 # is provided here as a configuration option
 if("${THIRD_PARTY_REPOSITORY_URL}" STREQUAL "")


Remove dependency on the project main target to avoid race condition in parallel testing.

--- utilities/cmake/setup_test_case.macro.cmake
+++ utilities/cmake/setup_test_case.macro.cmake
@@ -38,7 +38,10 @@
     DEPENDS
       ${_input_file_list_full}
       ${_test_src_directory}/${_comparison_file}
-      ${PRJ_NAME}
+      # Remove dependency on the project main target to avoid race condition
+      # in parallel testing.
+      # Always build the excutable before run cTest.
+      # ${PRJ_NAME}
     VERBATIM
     )


COMP: Make Doxygen Modules group definition consistent.

Make ITK module group definition in CMake/ITKModuleDoxygen.cmake
consistent with CMake/ITKGroups.cmake.

Change-Id: Ib956a46e2f8cd33ac095608e8b2d8f1577d76355

--- CMake/ITKModuleDoxygen.cmake
+++ CMake/ITKModuleDoxygen.cmake
@@ -12,7 +12,7 @@

   # _content defines the content of the ${_name}.dox file
   set( _content "/**\n" )
-  set( _content "${_content} \\defgroup ${_name} ${_name} \n" )
+  set( _content "${_content} \\defgroup ${_name} Module ${_name} \n" )
   set( _content "${_content} ${ITK_MODULE_${_name}_DESCRIPTION} \n" )

   set( _content "${_content} \\par Dependencies:\n" )


Re-establish a dependency via the hierarchy file.

This dependency was only present for the Ninja generator in the
vtkWrapHierarchy.cmake script from VTK, but I'm adding it for all
generators here.

--- CMake/vtkWrapHierarchy.cmake
+++ CMake/vtkWrapHierarchy.cmake
@@ -137,18 +137,9 @@
     endif()
   endforeach()

-  # Ninja does not wait for order-only dependencies before enforcing the
-  # existence of explicit dependencies that those order-only dependencies
-  # might have produced.  Specify the real output to help it out.
-  if(CMAKE_GENERATOR MATCHES "Ninja")
-    set(help_ninja ${OUTPUT_DIR}/${module_name}Hierarchy.txt)
-  else()
-    set(help_ninja "")
-  endif()
-
   add_custom_command(
     OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${module_name}Hierarchy.stamp.txt
-           ${help_ninja}
+           ${OUTPUT_DIR}/${module_name}Hierarchy.txt
     COMMAND ${VTK_WRAP_HIERARCHY_EXE}
             @${_args_file} -o ${OUTPUT_DIR}/${module_name}Hierarchy.txt
             ${module_name}Hierarchy.data


remove library dependency of boost::memory

--- source/ConfigureChecks.cmake
+++ source/ConfigureChecks.cmake
@@ -36,7 +36,6 @@
   ticpp
   am
   lzo
-  boost_memory
   beansdb
   )


#111 use major for clang>=8

#111 use major for clang>=8

--- conan.cmake
+++ conan.cmake
@@ -154,7 +154,11 @@
             endif ()
         else()
             set(_CONAN_SETTING_COMPILER clang)
-            set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR}.${MINOR})
+            if(${MAJOR} GREATER 7)
+                set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR})
+            else()
+                set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR}.${MINOR})
+            endif()
             if (USING_CXX)
                 conan_cmake_detect_gnu_libcxx(_LIBCXX)
                 set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX})


use prefered CMake variable MSVC_VERSION for visual studio version check

--- conan.cmake
+++ conan.cmake
@@ -40,32 +40,39 @@
       list(GET VERSION_LIST 1 MINOR)
       set(_SETTINGS ${_SETTINGS} -s compiler=clang -s compiler.version=${MAJOR}.${MINOR} -s compiler.libcxx=libstdc++)
   elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC)
-    set(_VISUAL "Visual Studio")
-    # FIXME: Crappy, poor check
-    if (${CMAKE_GENERATOR} MATCHES "Visual Studio 14")
-      set(_SETTINGS ${_SETTINGS} -s compiler=${_VISUAL} -s compiler.version=14)
-    elseif (${CMAKE_GENERATOR} MATCHES "Visual Studio 12")
-      set(_SETTINGS ${_SETTINGS} -s compiler=${_VISUAL} -s compiler.version=12)
-    elseif (${CMAKE_GENERATOR} MATCHES "Visual Studio 11")
-      set(_SETTINGS ${_SETTINGS} -s compiler=${_VISUAL} -s compiler.version=11)
-    elseif (${CMAKE_GENERATOR} MATCHES "Visual Studio 10")
-      set(_SETTINGS ${_SETTINGS} -s compiler=${_VISUAL} -s compiler.version=10)
-    elseif (${CMAKE_GENERATOR} MATCHES "Visual Studio 9")
-      set(_SETTINGS ${_SETTINGS} -s compiler=${_VISUAL} -s compiler.version=9)
-    else ()
-      message(FATAL_ERROR "Visual Studio not recognized")
-    endif()
+      set(_VISUAL "Visual Studio")
+      if (MSVC_VERSION EQUAL 1200)
+          set(_SETTINGS ${_SETTINGS} -s compiler=${_VISUAL} -s compiler.version=6)
+      elseif (MSVC_VERSION EQUAL 1300)
+          set(_SETTINGS ${_SETTINGS} -s compiler=${_VISUAL} -s compiler.version=7)
+      elseif (MSVC_VERSION EQUAL 1310)
+          set(_SETTINGS ${_SETTINGS} -s compiler=${_VISUAL} -s compiler.version=7)
+      elseif (MSVC_VERSION EQUAL 1400)
+          set(_SETTINGS ${_SETTINGS} -s compiler=${_VISUAL} -s compiler.version=8)
+      elseif (MSVC_VERSION EQUAL 1500)
+          set(_SETTINGS ${_SETTINGS} -s compiler=${_VISUAL} -s compiler.version=9)
+      elseif (MSVC_VERSION EQUAL 1600)
+          set(_SETTINGS ${_SETTINGS} -s compiler=${_VISUAL} -s compiler.version=10)
+      elseif (MSVC_VERSION EQUAL 1700)
+          set(_SETTINGS ${_SETTINGS} -s compiler=${_VISUAL} -s compiler.version=11)
+      elseif (MSVC_VERSION EQUAL 1800)
+          set(_SETTINGS ${_SETTINGS} -s compiler=${_VISUAL} -s compiler.version=12)
+      elseif (MSVC_VERSION EQUAL 1900)
+          set(_SETTINGS ${_SETTINGS} -s compiler=${_VISUAL} -s compiler.version=14)
+      else ()
+          message(FATAL_ERROR "Visual Studio not recognized")
+      endif()

-    if(${CMAKE_GENERATOR} MATCHES "Win64")
-        set(_SETTINGS ${_SETTINGS} -s arch=x86_64)
-    elseif (${CMAKE_GENERATOR} MATCHES "ARM")
-        message(STATUS "Conan: Using default ARM architecture from MSVC")
-        set(_SETTINGS ${_SETTINGS} -s arch=armv6)
-    else()
-        set(_SETTINGS ${_SETTINGS} -s arch=x86)
-    endif()
+      if(${CMAKE_GENERATOR} MATCHES "Win64")
+          set(_SETTINGS ${_SETTINGS} -s arch=x86_64)
+      elseif (${CMAKE_GENERATOR} MATCHES "ARM")
+          message(STATUS "Conan: Using default ARM architecture from MSVC")
+          set(_SETTINGS ${_SETTINGS} -s arch=armv6)
+      else()
+          set(_SETTINGS ${_SETTINGS} -s arch=x86)
+      endif()

-    set(_SETTINGS ${_SETTINGS} -s compiler.runtime=MD)
+      set(_SETTINGS ${_SETTINGS} -s compiler.runtime=MD)
   else()
       message(FATAL_ERROR "Conan: compiler setup not recognized")
   endif()


add version

add version

--- conan.cmake
+++ conan.cmake
@@ -33,6 +33,7 @@
 # but it is only necessary on the end-user side. It is not necessary to create conan
 # packages, in fact it shouldn't be use for that. Check the project documentation.

+# version: 0.15.0-dev

 include(CMakeParseArguments)


ZLIB_LIBRARY can be named libz.so

ZLIB_LIBRARY can be named libz.so

--- cmake/FindSZ.cmake
+++ cmake/FindSZ.cmake
@@ -39,7 +39,7 @@

   find_path(SZ_INCLUDE_DIR sz.h ${SZ_INCLUDE_OPTS})
   find_library(SZ_LIBRARY NAMES SZ ${SZ_LIBRARY_OPTS})
-  find_library(ZLIB_LIBRARY NAMES zlib ${SZ_LIBRARY_OPTS})
+  find_library(ZLIB_LIBRARY NAMES z zlib ${SZ_LIBRARY_OPTS})
   find_library(ZSTD_LIBRARY NAMES zstd ${SZ_LIBRARY_OPTS})

   include(FindPackageHandleStandardArgs)


Switch linux toolchain to use energia installed in /opt

--- cmake/msp430.cmake
+++ cmake/msp430.cmake
@@ -30,19 +30,16 @@
 elseif(CMAKE_HOST_WIN32)
     set(MSP430_PATH C:/Users/miannucci/msp430)
 else()
-    set(MSP430_PATH /usr/msp430)
+    set(MSP430_PATH /opt/energia/hardware/tools/msp430)
 endif()

 # Specify the cross compiler
 if(CMAKE_HOST_WIN32)
     set(CMAKE_C_COMPILER ${MSP430_PATH}/bin/msp430-gcc.exe)
     set(CMAKE_CXX_COMPILER ${MSP430_PATH}/bin/msp430-g++.exe)
-elseif(CMAKE_HOST_APPLE)
+else()
     set(CMAKE_C_COMPILER ${MSP430_PATH}/bin/msp430-gcc)
     set(CMAKE_CXX_COMPILER ${MSP430_PATH}/bin/msp430-g++)
-else()
-    set(CMAKE_C_COMPILER msp430-gcc)
-    set(CMAKE_CXX_COMPILER msp430-g++)
 endif()

 # Where is the target environment located
@@ -56,19 +53,12 @@
 set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

 # Include The header directory
-if (CMAKE_HOST_APPLE OR CMAKE_HOST_WIN32)
-    include_directories(SYSTEM ${MSP430_PATH}/msp430/include)
-else()
-    include_directories(SYSTEM ${MSP430_PATH}/include)
-endif()
+include_directories(SYSTEM ${MSP430_PATH}/msp430/include)

 # Create a function that will instantiate a flash target command using mspdebug.
 # you may have to set the path to mspdebug if it is different
-if (CMAKE_HOST_APPLE)
-    set(MSPDEBUG_PATH ${MSP430_PATH}/bin/mspdebug)
-else()
-    set(MSPDEBUG_PATH mspdebug)
-endif()
+set(MSPDEBUG_PATH ${MSP430_PATH}/bin/mspdebug)
+
 function(setup_flash_target TARGET_NAME DRIVER)
     add_custom_target(flash
         COMMAND ${MSPDEBUG_PATH} ${DRIVER} 'prog ${TARGET_NAME}'


auto detect former SETUPTOOLS_DEB_LAYOUT (fix #418)

--- cmake/python.cmake
+++ cmake/python.cmake
@@ -5,14 +5,12 @@

 set(PYTHON_VERSION_XDOTY ${PYTHON_VERSION_XDOTY} CACHE STRING "Python version")

-#This should be resolved automatically one day...
-option(SETUPTOOLS_DEB_LAYOUT "ON for debian style python packages layout" ON)
-
-if(APPLE OR WIN32)
-  set(SETUPTOOLS_DEB_LAYOUT OFF)
+set(python_use_debian_layout FALSE)
+if(EXISTS "/etc/debian_version")
+  set(python_use_debian_layout TRUE)
 endif()

-if(SETUPTOOLS_DEB_LAYOUT)
+if(python_use_debian_layout)
   set(PYTHON_PACKAGES_DIR dist-packages)
   set(SETUPTOOLS_ARG_EXTRA "--install-layout=deb")
 else()
@@ -26,7 +24,6 @@
     CACHE INTERNAL "This needs to be in PYTHONPATH when 'setup.py install' is called.  And it needs to match.  But setuptools won't tell us where it will install things.")
 else()
   # Windows setuptools installs to lib/site-packages not lib/python2.7/site-packages
-  # Or is this SETUPTOOLS_DEB_LAYOUT dependent?
   set(PYTHON_INSTALL_DIR lib/${PYTHON_PACKAGES_DIR}
     CACHE INTERNAL "This needs to be in PYTHONPATH when 'setup.py install' is called.  And it needs to match.  But setuptools won't tell us where it will install things.")
 endif()


Add libcu++ dependency.

Add libcu++ dependency.

--- cub/cmake/cub-config.cmake
+++ cub/cmake/cub-config.cmake
@@ -7,6 +7,9 @@
 if (TARGET CUB::CUB)
   return()
 endif()
+
+# Minimum supported libcudacxx version:
+set(cub_libcudacxx_version 1.8.0)

 function(_cub_declare_interface_alias alias_name ugly_name)
   # 1) Only IMPORTED and ALIAS targets can be placed in a namespace.
@@ -27,16 +30,64 @@
 endfunction()

 #
+# Setup some internal cache variables
+#
+
+# Pull in the include dir detected by cub-config-version.cmake
+set(_CUB_INCLUDE_DIR "${_CUB_VERSION_INCLUDE_DIR}"
+  CACHE INTERNAL "Location of CUB headers."
+  FORCE
+)
+unset(_CUB_VERSION_INCLUDE_DIR CACHE) # Clear tmp variable from cache
+
+if (${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
+  set(_CUB_QUIET ON CACHE INTERNAL "Quiet mode enabled for CUB find_package calls." FORCE)
+  set(_CUB_QUIET_FLAG "QUIET" CACHE INTERNAL "" FORCE)
+else()
+  set(_CUB_QUIET OFF CACHE INTERNAL "Quiet mode enabled for CUB find_package calls." FORCE)
+  set(_CUB_QUIET_FLAG "" CACHE INTERNAL "" FORCE)
+endif()
+
+#
+# Setup dependencies
+#
+
+if (NOT TARGET CUB::libcudacxx)
+  if (TARGET Thrust::libcudacxx)
+    # Prefer the same libcudacxx as Thrust, if available:
+    _cub_declare_interface_alias(CUB::libcudacxx _CUB_libcudacxx)
+    target_link_libraries(_CUB_libcudacxx INTERFACE Thrust::libcudacxx)
+  else()
+    if (NOT TARGET libcudacxx::libcudacxx)
+      # First do a non-required search for any co-packaged versions.
+      # These are preferred.
+      find_package(libcudacxx ${cub_libcudacxx_version} CONFIG
+        ${_CUB_QUIET_FLAG}
+        NO_DEFAULT_PATH # Only check the explicit HINTS below:
+        HINTS
+          "${_CUB_INCLUDE_DIR}/../libcudacxx"           # Source layout
+          "${_CUB_CMAKE_DIR}/.."                        # Install layout
+      )
+
+      # A second required search allows externally packaged to be used and fails if
+      # no suitable package exists.
+      find_package(libcudacxx ${cub_libcudacxx_version} CONFIG
+        REQUIRED
+        ${_CUB_QUIET_FLAG}
+      )
+    endif()
+    _cub_declare_interface_alias(CUB::libcudacxx _CUB_libcudacxx)
+    target_link_libraries(_CUB_libcudacxx INTERFACE libcudacxx::libcudacxx)
+  endif()
+endif()
+
+#
 # Setup targets
 #

 _cub_declare_interface_alias(CUB::CUB _CUB_CUB)
-# Pull in the include dir detected by cub-config-version.cmake
-set(_CUB_INCLUDE_DIR "${_CUB_VERSION_INCLUDE_DIR}"
-  CACHE INTERNAL "Location of CUB headers."
-)
-unset(_CUB_VERSION_INCLUDE_DIR CACHE) # Clear tmp variable from cache
 target_include_directories(_CUB_CUB INTERFACE "${_CUB_INCLUDE_DIR}")
+target_link_libraries(_CUB_CUB INTERFACE CUB::libcudacxx)

 if (CUB_IGNORE_DEPRECATED_API OR THRUST_IGNORE_DEPRECATED_API)
   target_compile_definitions(_CUB_CUB INTERFACE "CUB_IGNORE_DEPRECATED_API")
@@ -61,12 +112,12 @@
 # Standardize version info
 #

-set(CUB_VERSION ${${CMAKE_FIND_PACKAGE_NAME}_VERSION} CACHE INTERNAL "")
-set(CUB_VERSION_MAJOR ${${CMAKE_FIND_PACKAGE_NAME}_VERSION_MAJOR} CACHE INTERNAL "")
-set(CUB_VERSION_MINOR ${${CMAKE_FIND_PACKAGE_NAME}_VERSION_MINOR} CACHE INTERNAL "")
-set(CUB_VERSION_PATCH ${${CMAKE_FIND_PACKAGE_NAME}_VERSION_PATCH} CACHE INTERNAL "")
-set(CUB_VERSION_TWEAK ${${CMAKE_FIND_PACKAGE_NAME}_VERSION_TWEAK} CACHE INTERNAL "")
-set(CUB_VERSION_COUNT ${${CMAKE_FIND_PACKAGE_NAME}_VERSION_COUNT} CACHE INTERNAL "")
+set(CUB_VERSION ${${CMAKE_FIND_PACKAGE_NAME}_VERSION} CACHE INTERNAL "" FORCE)
+set(CUB_VERSION_MAJOR ${${CMAKE_FIND_PACKAGE_NAME}_VERSION_MAJOR} CACHE INTERNAL "" FORCE)
+set(CUB_VERSION_MINOR ${${CMAKE_FIND_PACKAGE_NAME}_VERSION_MINOR} CACHE INTERNAL "" FORCE)
+set(CUB_VERSION_PATCH ${${CMAKE_FIND_PACKAGE_NAME}_VERSION_PATCH} CACHE INTERNAL "" FORCE)
+set(CUB_VERSION_TWEAK ${${CMAKE_FIND_PACKAGE_NAME}_VERSION_TWEAK} CACHE INTERNAL "" FORCE)
+set(CUB_VERSION_COUNT ${${CMAKE_FIND_PACKAGE_NAME}_VERSION_COUNT} CACHE INTERNAL "" FORCE)

 include(FindPackageHandleStandardArgs)
 if (NOT CUB_CONFIG)


STYLE: Changed URL

STYLE: Changed URL

--- utilities/SimpleRTK/CMake/srtkCheckCXX11.cmake
+++ utilities/SimpleRTK/CMake/srtkCheckCXX11.cmake
@@ -89,5 +89,5 @@
     "SimpleRTK requires usage of C++11 or C++ Technical Report 1 (TR1).\n"
     "It may be available as an optional download for your compiler or difference CXX_FLAGS."
     "Please see the FAQs for details."
-    "https://www.itk.org/Wiki/SimpleRTK/FAQ#Do_I_need_to_download_an_option_package_for_TR1_support.3F\n" )
+    "https://www.itk.org/Wiki/SimpleITK/FAQ#Do_I_need_to_download_an_option_package_for_TR1_support.3F\n" )
 endif ( )


fix typos: 4x "disbale" to "disable" (#2865)

--- cmake/config.cmake
+++ cmake/config.cmake
@@ -27,7 +27,7 @@
 #
 # Possible values:
 # - ON: enable CUDA with cmake's auto search
-# - OFF: disbale CUDA
+# - OFF: disable CUDA
 # - /path/to/cuda: use specific path to cuda toolkit
 set(USE_CUDA OFF)

@@ -35,7 +35,7 @@
 #
 # Possible values:
 # - ON: enable ROCM with cmake's auto search
-# - OFF: disbale ROCM
+# - OFF: disable ROCM
 # - /path/to/rocm: use specific path to rocm
 set(USE_ROCM OFF)

@@ -55,7 +55,7 @@
 #
 # Possible values:
 # - ON: enable Vulkan with cmake's auto search
-# - OFF: disbale vulkan
+# - OFF: disable vulkan
 # - /path/to/vulkan-sdk: use specific path to vulkan-sdk
 set(USE_VULKAN OFF)

@@ -90,7 +90,7 @@
 #
 # Possible values:
 # - ON: enable llvm with cmake's find search
-# - OFF: disbale llvm
+# - OFF: disable llvm
 # - /path/to/llvm-config: enable specific LLVM when multiple llvm-dev is available.
 set(USE_LLVM OFF)


Slight modification to plugin.cmake so that OpenCOR can build on Linux.

--- cmake/plugin.cmake
+++ cmake/plugin.cmake
@@ -79,15 +79,16 @@

     IF(NOT APPLE)
         SET(PLUGINS_DIR ${CMAKE_BINARY_DIR}/plugins)
-        SET(PLUGIN_FILENAME ${PLUGIN_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
-
+        SET(PLUGIN_FILENAME ${CMAKE_SHARED_LIBRARY_PREFIX}${PLUGIN_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
+
         IF(NOT EXISTS ${PLUGINS_DIR})
             ADD_CUSTOM_COMMAND(TARGET ${PROJECT_NAME} POST_BUILD
                                COMMAND ${CMAKE_COMMAND} -E make_directory ${PLUGINS_DIR})
         ENDIF()

         ADD_CUSTOM_COMMAND(TARGET ${PROJECT_NAME} POST_BUILD
-                           COMMAND ${CMAKE_COMMAND} -E rename ${CMAKE_BINARY_DIR}/${PLUGIN_FILENAME} ${PLUGINS_DIR}/${PLUGIN_FILENAME})
+                           COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/${PLUGIN_FILENAME} ${PLUGINS_DIR}/${PLUGIN_FILENAME})
+#---GRY--- NOTE THAT copy SHOULD PROBABLY REPLACED BY rename WHEN PLUGINS REALLY WORK
     ENDIF()
 ENDMACRO()


BUG: Bump to correct ITK version.

BUG: Bump to correct ITK version.

--- CMake/Superbuild/ExternalProjectsConfig.cmake
+++ CMake/Superbuild/ExternalProjectsConfig.cmake
@@ -39,7 +39,7 @@

 # Insight Segmentation and Registration Toolkit version 4.4.2
 set( ITK_URL ${github_protocol}://itk.org/ITK.git )
-set( ITK_HASH_OR_TAG ee6472628dcbb12d2723f04dbf3b14764de2b4ff )
+set( ITK_HASH_OR_TAG 4c1d191ceac136b920dbb13564c419fc821dd848 )

 # JsonCpp snapshot 2013-08-08 23:08:28
 set( JsonCpp_URL


Fix check for STM32_CUBE_PACKAGE_SOURCE (#2214)

***NO_CI***

--- CMake/Modules/STM32_CubePackage.cmake
+++ CMake/Modules/STM32_CubePackage.cmake
@@ -38,13 +38,12 @@
         # STM32 Cube package source was specified

         # sanity check is source path exists
-        if(EXISTS "${STM32_CUBE_PACKAGE_SOURCE}/")
-            message(STATUS "STM32 Cube package source from: ${STM32_CUBE_PACKAGE_SOURCE}")
+        if(IS_DIRECTORY ${STM32_CUBE_PACKAGE_SOURCE})
+            message(STATUS "STM32 Cube package (source from: ${STM32_CUBE_PACKAGE_SOURCE})")

             FetchContent_Declare(
                 stm32${TARGET_SERIES_SHORT}_cubepackage
-                GIT_REPOSITORY ${STM32_CUBE_PACKAGE_SOURCE}
-                GIT_TAG nf-build
+                SOURCE_DIR ${STM32_CUBE_PACKAGE_SOURCE}
             )

         else()


BUG: missing include in StandaloneMacros

--- CMake/OTBStandaloneModuleMacros.cmake
+++ CMake/OTBStandaloneModuleMacros.cmake
@@ -22,6 +22,8 @@
 # This file ensures the appropriate variables are set up for a project extending
 # OTB before including OTBModuleMacros. This is the preferred way to build an
 # OTB module outside of the OTB source tree.
+
+include(GenerateExportHeaderCustom)

 macro(otb_module_test)
   include(../otb-module.cmake) # Load module meta-data


Override default output paths for language wrapping

When building SimpleITK and all wrapped languages as one project, the
language libraries are built in the language specific sub
directory. This should prevent conflicts, preserve order, and clarify
the executable and the libraries with directories.

Change-Id: I8c39d15c56deb112eeaebe51144f9ab62bfecdda

--- CMake/sitkProjectLanguageCommon.cmake
+++ CMake/sitkProjectLanguageCommon.cmake
@@ -21,6 +21,18 @@
   set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${SimpleITK_REQUIRED_LINK_FLAGS}")
   set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${SimpleITK_REQUIRED_LINK_FLAGS}")

+endif()
+
+
+# Setup build locations to the wrapping language sub directories
+if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY OR CMAKE_PROJECT_NAME STREQUAL "SimpleITK" )
+  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
+endif()
+if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY OR CMAKE_PROJECT_NAME STREQUAL "SimpleITK" )
+  set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
+endif()
+if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY OR CMAKE_PROJECT_NAME STREQUAL "SimpleITK" )
+  set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
 endif()

 if(NOT TARGET dist)


Add -xHOST to the intel compiler command line

Should enable AVX builds on modern systems.

--- CMake/hoomd/HOOMDCFlagsSetup.cmake
+++ CMake/hoomd/HOOMDCFlagsSetup.cmake
@@ -56,10 +56,10 @@

     elseif(CMAKE_CXX_COMPILER MATCHES "icpc")
         # default flags for intel
-        set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g" CACHE STRING "Flags used by the compiler during debug builds." FORCE)
-        set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG" CACHE STRING "Flags used by the compiler during minimum size release builds." FORCE)
-        set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "Flags used by the compiler during release builds." FORCE)
-        set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -O3 -DNDEBUG" CACHE STRING "Flags used by the compiler during release builds with debug info." FORCE)
+        set(CMAKE_CXX_FLAGS_DEBUG "-xHOST -O0 -g" CACHE STRING "Flags used by the compiler during debug builds." FORCE)
+        set(CMAKE_CXX_FLAGS_MINSIZEREL "-xHOST -Os -DNDEBUG" CACHE STRING "Flags used by the compiler during minimum size release builds." FORCE)
+        set(CMAKE_CXX_FLAGS_RELEASE "-xHOST -O3 -DNDEBUG" CACHE STRING "Flags used by the compiler during release builds." FORCE)
+        set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-xHOST -g -O3 -DNDEBUG" CACHE STRING "Flags used by the compiler during release builds with debug info." FORCE)

     else(CMAKE_COMPILER_IS_GNUCXX)
         message(STATUS "No default CXXFLAGS for your compiler, set them manually")


interpret file lists as lists instead of strings

--- CMake/mitkFunctionWhitelists.cmake
+++ CMake/mitkFunctionWhitelists.cmake
@@ -83,14 +83,14 @@

   file(GLOB internalWhitelistFiles "${${ARGV0}_WHITELISTS_INTERNAL_PATH}/*.cmake")

-  foreach(whitelistFile "${internalWhitelistFiles}")
+  foreach(whitelistFile ${internalWhitelistFiles})
     get_filename_component(whitelistFile "${whitelistFile}" NAME_WE)
     list(APPEND whitelists "${whitelistFile}")
   endforeach()

   file(GLOB externalWhitelistFiles "${${ARGV0}_WHITELISTS_EXTERNAL_PATH}/*.cmake")

-  foreach(whitelistFile "${externalWhitelistFiles}")
+  foreach(whitelistFile ${externalWhitelistFiles})
     get_filename_component(whitelistFile "${whitelistFile}" NAME_WE)
     list(APPEND whitelists "${whitelistFile} (external)")
   endforeach()