Remove FindExtProject.cmake

Remove FindExtProject.cmake

--- cmake/FindExtProject.cmake
+++ cmake/FindExtProject.cmake
@@ -1,377 +0,0 @@
-################################################################################
-# Project:  external projects
-# Purpose:  CMake build scripts
-# Author:   Dmitry Baryshnikov, polimax@mail.ru
-################################################################################
-# Copyright (C) 2015-2016, NextGIS <info@nextgis.com>
-# Copyright (C) 2015 Dmitry Baryshnikov
-#
-# This script is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 2 of the License, or
-# (at your option) any later version.
-#
-# This script is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this script.  If not, see <http://www.gnu.org/licenses/>.
-################################################################################
-
-function(get_imported_targets file_to_search targets)
-    file(STRINGS ${file_to_search} targets_str
-         REGEX "^foreach+([()_a-zA-Z0-9 ]+)")
-    string(SUBSTRING ${targets_str} 24 -1 targets_local)
-    string(LENGTH ${targets_local} STR_LEN)
-    math(EXPR LAST_INDEX "${STR_LEN} - 1")
-    string(SUBSTRING ${targets_local} 0 ${LAST_INDEX} targets_local)
-    string(REPLACE " " ";" targets_local ${targets_local})
-    set(${targets} ${targets_local} PARENT_SCOPE)
-endfunction()
-
-function(get_target_name target_lib target_name)
-    string(LENGTH ${target_lib} STR_LEN)
-    if(STR_LEN LESS 21)
-        return()
-    endif()
-    string(SUBSTRING ${target_lib} 21 -1 targets_local)
-    string(LENGTH ${targets_local} STR_LEN)
-    math(EXPR LAST_INDEX "${STR_LEN} - 1")
-    string(SUBSTRING ${targets_local} 0 ${LAST_INDEX} targets_local)
-    set(${target_name} ${targets_local} PARENT_SCOPE)
-endfunction()
-
-function(check_updates file_path update_period check)
-    file(TIMESTAMP ${file_path} LAST_PULL "%y%j%H%M" UTC)
-    if(NOT LAST_PULL)
-        set(LAST_PULL 0)
-    endif()
-    string(TIMESTAMP CURRENT_TIME "%y%j%H%M" UTC)
-    math(EXPR DIFF_TIME "${CURRENT_TIME} - ${LAST_PULL}")
-    #message(STATUS "period ${update_period} diff ${DIFF_TIME} current ${CURRENT_TIME} last ${LAST_PULL}")
-    if(DIFF_TIME GREATER ${update_period})
-        set(${check} TRUE PARENT_SCOPE)
-    else()
-        set(${check} FALSE PARENT_SCOPE)
-    endif()
-endfunction()
-
-function(color_message text)
-
-    string(ASCII 27 Esc)
-    set(BoldGreen   "${Esc}[1;32m")
-    set(ColourReset "${Esc}[m")
-
-    message(STATUS "${BoldGreen}${text}${ColourReset}")
-
-endfunction()
-
-function(include_exports_path include_path)
-    #add to list imported
-    list(FIND EXPORTS_PATHS ${include_path} PATH_INDEX)
-    if(PATH_INDEX EQUAL -1)
-        list(APPEND EXPORTS_PATHS "${include_path}")
-        set(EXPORTS_PATHS "${EXPORTS_PATHS}" PARENT_SCOPE)
-        # Add imported library have limit scope
-        # During the export cmake add library without GLOBAL parameter and no
-        # way to change this bihaviour. Let's fix it.
-        file (READ ${include_path} _file_content)
-        string (REPLACE "IMPORTED)" "IMPORTED GLOBAL)" _file_content "${_file_content}")
-        file(WRITE ${include_path} "${_file_content}")
-
-        include(${include_path})
-    endif()
-endfunction()
-
-function(find_extproject name)
-    set(options OPTIONAL)
-    set(oneValueArgs SHARED)
-    set(multiValueArgs CMAKE_ARGS)
-    cmake_parse_arguments(find_extproject "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
-
-    # set default third party lib path
-    if(NOT DEFINED EP_PREFIX)
-        set(EP_PREFIX "${CMAKE_BINARY_DIR}/third-party")
-    endif()
-
-    # set default url
-    if(NOT DEFINED EP_URL)
-        set(EP_URL "https://github.com/nextgis-borsch")
-    endif()
-
-    if(NOT DEFINED PULL_UPDATE_PERIOD)
-        set(PULL_UPDATE_PERIOD 25) # 25 min
-    endif()
-
-    if(NOT DEFINED PULL_TIMEOUT)
-        set(PULL_TIMEOUT 100) # 100 ms
-    endif()
-
-    if(NOT DEFINED SUPRESS_VERBOSE_OUTPUT)
-        set(SUPRESS_VERBOSE_OUTPUT TRUE)
-    endif()
-
-    list(APPEND find_extproject_CMAKE_ARGS -DEP_PREFIX=${EP_PREFIX})
-    list(APPEND find_extproject_CMAKE_ARGS -DEP_URL=${EP_URL})
-    list(APPEND find_extproject_CMAKE_ARGS -DPULL_UPDATE_PERIOD=${PULL_UPDATE_PERIOD})
-    list(APPEND find_extproject_CMAKE_ARGS -DPULL_TIMEOUT=${PULL_TIMEOUT})
-    list(APPEND find_extproject_CMAKE_ARGS -DSUPRESS_VERBOSE_OUTPUT=${SUPRESS_VERBOSE_OUTPUT})
-    if(CMAKE_TOOLCHAIN_FILE)
-        list(APPEND find_extproject_CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE})
-    endif()
-    if(ANDROID)
-        # TODO: do we need more keys?
-        list(APPEND find_extproject_CMAKE_ARGS -DANDROID_NDK=${ANDROID_NDK})
-        list(APPEND find_extproject_CMAKE_ARGS -DANDROID_NATIVE_API_LEVEL=${ANDROID_NATIVE_API_LEVEL})
-        list(APPEND find_extproject_CMAKE_ARGS -DANDROID_ABI=${ANDROID_ABI})
-        list(APPEND find_extproject_CMAKE_ARGS -DANDROID=ON)
-    endif()
-
-    set_property(DIRECTORY PROPERTY "EP_PREFIX" ${EP_PREFIX})
-
-    set(EXT_INSTALL_DIR ${EP_PREFIX})
-    set(EXT_STAMP_DIR ${EP_PREFIX}/src/${name}_EP-stamp)
-    set(EXT_BUILD_DIR ${EP_PREFIX}/src/${name}_EP-build)
-
-    # search CMAKE_INSTALL_PREFIX
-    string (REGEX MATCHALL "(^|;)-DCMAKE_INSTALL_PREFIX=[A-Za-z0-9_]*" _matchedVars "${find_extproject_CMAKE_ARGS}")
-    list(LENGTH _matchedVars _list_size)
-    if(_list_size EQUAL 0)
-        list(APPEND find_extproject_CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXT_INSTALL_DIR})
-    endif()
-    unset(_matchedVars)
-
-    # search BUILD_SHARED_LIBS
-    if(NOT DEFINED find_extproject_SHARED)
-        list(APPEND find_extproject_CMAKE_ARGS -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS})
-        set(find_extproject_SHARED ${BUILD_SHARED_LIBS})
-    elseif(find_extproject_SHARED)
-        list(APPEND find_extproject_CMAKE_ARGS -DBUILD_SHARED_LIBS=ON)
-    else()
-        list(APPEND find_extproject_CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF)
-    endif()
-
-    # set some arguments
-    if(CMAKE_GENERATOR)
-        list(APPEND find_extproject_CMAKE_ARGS -DCMAKE_GENERATOR=${CMAKE_GENERATOR})
-    endif()
-    if(CMAKE_MAKE_PROGRAM)
-        list(APPEND find_extproject_CMAKE_ARGS -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM})
-    endif()
-    if(CMAKE_BUILD_TYPE)
-        list(APPEND find_extproject_CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
-    endif()
-    # list(APPEND find_extproject_CMAKE_ARGS -DCMAKE_CONFIGURATION_TYPES=${CMAKE_CONFIGURATION_TYPES})
-    if(CMAKE_GENERATOR_TOOLSET)
-        list(APPEND find_extproject_CMAKE_ARGS -DCMAKE_GENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET})
-    endif()
-    if(SKIP_GIT_PULL)
-        list(APPEND find_extproject_CMAKE_ARGS -DSKIP_GIT_PULL=${SKIP_GIT_PULL})
-    endif()
-
-    get_cmake_property(_variableNames VARIABLES)
-    string (REGEX MATCHALL "(^|;)WITH_[A-Za-z0-9_]*" _matchedVars "${_variableNames}")
-    foreach(_variableName ${_matchedVars})
-        if(NOT SUPRESS_VERBOSE_OUTPUT)
-            message(STATUS "${_variableName}=${${_variableName}}")
-        endif()
-        list(APPEND find_extproject_CMAKE_ARGS -D${_variableName}=${${_variableName}})
-    endforeach()
-
-
-    # get some properties from <cmakemodules>/findext${name}.cmake file
-    include(FindExt${name})
-
-    find_exthost_package(Git)
-    if(NOT GIT_FOUND)
-      message(FATAL_ERROR "git is required")
-      return()
-    endif()
-
-    include(ExternalProject)
-
-    # create delete build file script and custom command to periodically execute it
-    file(WRITE ${EP_PREFIX}/tmp/${name}_EP-checkupdate.cmake
-        "file(TIMESTAMP ${EXT_STAMP_DIR}/${name}_EP-gitpull.txt LAST_PULL \"%y%j%H%M\" UTC)
-         if(NOT LAST_PULL)
-            set(LAST_PULL 0)
-         endif()
-         string(TIMESTAMP CURRENT_TIME \"%y%j%H%M\" UTC)
-         math(EXPR DIFF_TIME \"\${CURRENT_TIME} - \${LAST_PULL}\")
-         if(DIFF_TIME GREATER ${PULL_UPDATE_PERIOD})
-            message(STATUS \"Git pull ${repo_name} ...\")
-            execute_process(COMMAND ${GIT_EXECUTABLE} pull
-               WORKING_DIRECTORY  ${EP_PREFIX}/src/${name}_EP
-               TIMEOUT ${PULL_TIMEOUT} OUTPUT_VARIABLE OUT_STR)
-
-            if(OUT_STR)
-                string(FIND \${OUT_STR} \"Already up-to-date\" STR_POS)
-                if(STR_POS LESS 0)
-                    message(STATUS \"Remove ${name}_EP-build\")
-                    file(REMOVE ${EXT_STAMP_DIR}/${name}_EP-build)
-                endif()
-                file(WRITE ${EXT_STAMP_DIR}/${name}_EP-gitpull.txt \"\")
-            endif()
-         endif()")
-
-    ExternalProject_Add(${name}_EP
-        GIT_REPOSITORY ${EP_URL}/${repo_name}
-        CMAKE_ARGS ${find_extproject_CMAKE_ARGS}
-        UPDATE_DISCONNECTED 1
-    )
-
-    if(NOT SKIP_GIT_PULL)
-    add_custom_command(TARGET ${name}_EP PRE_BUILD
-               COMMAND ${CMAKE_COMMAND} -P ${EP_PREFIX}/tmp/${name}_EP-checkupdate.cmake
-               COMMENT "Check if update needed ..."
-               VERBATIM)
-    endif()
-
-    set(RECONFIGURE OFF)
-    set(INCLUDE_EXPORT_PATH "${EXT_BUILD_DIR}/${repo_project}-exports.cmake")
-
-    if(NOT EXISTS "${EP_PREFIX}/src/${name}_EP/.git")
-        color_message("Git clone ${repo_name} ...")
-
-        set(error_code 1)
-        set(number_of_tries 0)
-        while(error_code AND number_of_tries LESS 3)
-          execute_process(
-            COMMAND ${GIT_EXECUTABLE} clone ${EP_URL}/${repo_name} ${name}_EP
-            WORKING_DIRECTORY  ${EP_PREFIX}/src
-            RESULT_VARIABLE error_code
-            )
-          math(EXPR number_of_tries "${number_of_tries} + 1")
-        endwhile()
-
-        if(error_code)
-            message(FATAL_ERROR "Failed to clone repository: ${EP_URL}/${repo_name}")
-            return()
-        else()
-            #execute_process(COMMAND ${GIT_EXECUTABLE} checkout master
-            #    WORKING_DIRECTORY  ${EP_PREFIX}/src/${name}_EP)
-            file(WRITE ${EXT_STAMP_DIR}/${name}_EP-gitclone-lastrun.txt "")
-            #execute_process(COMMAND ${CMAKE_COMMAND} ${EP_PREFIX}/src/${name}_EP
-            #    ${find_extproject_CMAKE_ARGS}
-            #    WORKING_DIRECTORY ${EXT_BUILD_DIR})
-            set(RECONFIGURE ON)
-        endif()
-    else()
-        if(EXISTS ${INCLUDE_EXPORT_PATH})
-            check_updates(${EXT_STAMP_DIR}/${name}_EP-gitpull.txt ${PULL_UPDATE_PERIOD} CHECK_UPDATES)
-        else()
-            set(RECONFIGURE ON)
-        endif()
-        if(CHECK_UPDATES)
-            color_message("Git pull ${repo_name} ...")
-            execute_process(COMMAND ${GIT_EXECUTABLE} pull
-               WORKING_DIRECTORY  ${EP_PREFIX}/src/${name}_EP
-               TIMEOUT ${PULL_TIMEOUT} OUTPUT_VARIABLE OUT_STR)
-           if(OUT_STR)
-                string(FIND ${OUT_STR} "Already up-to-date" STR_POS)
-                if(STR_POS LESS 0)
-                    file(REMOVE ${EXT_STAMP_DIR}/${name}_EP-build)
-                    set(RECONFIGURE ON)
-                endif()
-                file(WRITE ${EXT_STAMP_DIR}/${name}_EP-gitpull.txt "")
-            endif()
-        endif()
-    endif()
-
-    if(RECONFIGURE)
-        color_message("Configure ${repo_name} ...")
-        execute_process(COMMAND ${CMAKE_COMMAND} ${EP_PREFIX}/src/${name}_EP
-            ${find_extproject_CMAKE_ARGS}
-            WORKING_DIRECTORY ${EXT_BUILD_DIR})
-    endif()
-
-    if(EXISTS ${INCLUDE_EXPORT_PATH})
-        get_imported_targets(${INCLUDE_EXPORT_PATH} IMPORTED_TARGETS)
-        string(TOUPPER ${name}_FOUND IS_FOUND)
-        set(${IS_FOUND} TRUE PARENT_SCOPE)
-
-        #add to list imported
-        include_exports_path(${INCLUDE_EXPORT_PATH})
-    else()
-        message(WARNING "The path ${INCLUDE_EXPORT_PATH} not exist")
-        return()
-    endif()
-
-    if(EXISTS ${EXT_BUILD_DIR}/ext_options.cmake)
-        include(${EXT_BUILD_DIR}/ext_options.cmake)
-
-        # add include into  ext_options.cmake
-        set(WITHOPT "${WITHOPT}include(${EXT_BUILD_DIR}/ext_options.cmake)\n" PARENT_SCOPE)
-
-        foreach(INCLUDE_EXPORT_PATH ${INCLUDE_EXPORTS_PATHS})
-            include_exports_path(${INCLUDE_EXPORT_PATH})
-        endforeach()
-        unset(INCLUDE_EXPORT_PATH)
-    endif()
-
-    add_dependencies(${IMPORTED_TARGETS} ${name}_EP)
-
-    set(DEPENDENCY_LIB ${DEPENDENCY_LIB} ${IMPORTED_TARGETS} PARENT_SCOPE)
-
-    set(IMPORTED_TARGET_PATH)
-    foreach(IMPORTED_TARGET ${IMPORTED_TARGETS})
-        set(IMPORTED_TARGET_PATH ${IMPORTED_TARGET_PATH} $<TARGET_LINKER_FILE:${IMPORTED_TARGET}>) #${IMPORTED_TARGET}
-        if(NOT find_extproject_SHARED)
-            get_target_property(LINK_INTERFACE_LIBS "${IMPORTED_TARGET}" INTERFACE_LINK_LIBRARIES)
-            foreach(LINK_INTERFACE_LIB ${LINK_INTERFACE_LIBS})
-                if(LINK_INTERFACE_LIB)
-                    string(FIND ${LINK_INTERFACE_LIB} "$<TARGET_LINKER_FILE:" POS)
-                    if(POS EQUAL -1)
-                        set(IMPORTED_TARGET_PATH ${IMPORTED_TARGET_PATH} ${LINK_INTERFACE_LIB})
-                    else()
-                        get_target_name(${LINK_INTERFACE_LIB} INTERFACE_TARGET)
-                        if(TARGET ${INTERFACE_TARGET})
-                            set(IMPORTED_TARGET_PATH ${IMPORTED_TARGET_PATH} ${LINK_INTERFACE_LIB})
-                        else()
-                            message(STATUS "NO TARGET ${LINK_INTERFACE_LIB} -> INTERFACE_TARGET ${INTERFACE_TARGET}")
-                        endif()
-                    endif()
-                endif()
-            endforeach()
-        endif()
-    endforeach()
-    set(TARGET_LINK_LIB ${TARGET_LINK_LIB} ${IMPORTED_TARGET_PATH} PARENT_SCOPE)
-
-    include_directories(${EXT_INSTALL_DIR}/include)
-    foreach (inc ${repo_include})
-        include_directories(${EXT_INSTALL_DIR}/include/${inc})
-    endforeach ()
-
-    if(WIN32)
-        set(_INST_ROOT_PATH /)
-    else()
-        set(_INST_ROOT_PATH ${CMAKE_INSTALL_PREFIX})
-    endif()
-
-    # create directories
-    file(MAKE_DIRECTORY "${EXT_INSTALL_DIR}/bin")
-    file(MAKE_DIRECTORY "${EXT_INSTALL_DIR}/lib")
-    file(MAKE_DIRECTORY "${EXT_INSTALL_DIR}/include")
-    file(MAKE_DIRECTORY "${EXT_INSTALL_DIR}/share")
-
-    install( DIRECTORY ${EXT_INSTALL_DIR}/bin
-             DESTINATION ${_INST_ROOT_PATH}
-             COMPONENT applications)
-
-    install( DIRECTORY ${EXT_INSTALL_DIR}/lib
-             DESTINATION ${_INST_ROOT_PATH}
-             COMPONENT libraries)
-
-    install( DIRECTORY ${EXT_INSTALL_DIR}/include
-             DESTINATION ${_INST_ROOT_PATH}
-             COMPONENT headers)
-
-    install( DIRECTORY ${EXT_INSTALL_DIR}/share
-             DESTINATION ${_INST_ROOT_PATH}
-             COMPONENT libraries)
-
-    set(EXPORTS_PATHS ${EXPORTS_PATHS} PARENT_SCOPE)
-    set(LINK_SEARCH_PATHS ${LINK_SEARCH_PATHS} ${INCLUDE_LINK_SEARCH_PATHS} ${EP_PREFIX}/lib PARENT_SCOPE)
-endfunction()


small cleanup

small cleanup

--- cmake/FindOpenALSoft.cmake
+++ cmake/FindOpenALSoft.cmake
@@ -22,7 +22,7 @@

 find_library(OPENALSOFT_LIBRARY
   NAMES libopenal openal libOpenAL32 OpenAL32 OpenAL32.dll soft_oal.dll
-  PATH_SUFFIXES lib64 lib libs64 libs ${_OpenAL_ARCH_DIR}
+  PATH_SUFFIXES lib64 lib libs64 libs
   PATHS
     ${OPENALSOFT_INCLUDE_DIR}/../lib
     lib


fix cmake macros to use _target parameter

--- cmake/LighttpdMacros.cmake
+++ cmake/LighttpdMacros.cmake
@@ -15,7 +15,7 @@

 MACRO(TARGET_USE_PACKAGE _target _ldirs _libs _lflags _cflags)
 	LINK_DIRECTORIES(${_ldirs})
-	TARGET_LINK_LIBRARIES(fcgi-debug ${_libs})
-	ADD_TARGET_PROPERTIES(fcgi-debug LINK_FLAGS "${_lflags}")
-	ADD_TARGET_PROPERTIES(fcgi-debug COMPILE_FLAGS ${_cflags})
+	TARGET_LINK_LIBRARIES(${_target} ${_libs})
+	ADD_TARGET_PROPERTIES(${_target} LINK_FLAGS "${_lflags}")
+	ADD_TARGET_PROPERTIES(${_target} COMPILE_FLAGS ${_cflags})
 ENDMACRO(TARGET_USE_PACKAGE)


cmake: Detect x64 CPU architecture separately

--- cmake/PlatformDetect.cmake
+++ cmake/PlatformDetect.cmake
@@ -31,8 +31,10 @@
 endfunction (plib_detect_os_bits)

 function (plib_detect_cpu_arch result)
-	if (CMAKE_SYSTEM_PROCESSOR MATCHES "[i*86, x86_64]")
+	if (CMAKE_SYSTEM_PROCESSOR MATCHES "i*86")
 		set (PLIB_PROCESSOR_ARCH x86)
+	elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
+		set (PLIB_PROCESSOR_ARCH x64)
 	else()
 		set (PLIB_PROCESSOR_ARCH ${CMAKE_SYSTEM_PROCESSOR MATCHES})
 	endif()


cmake: XercesIntTypes: Quote unsigned long correctly

git-svn-id: 3ec853389310512053d525963cab269c063bb453@1840375 13f79535-47bb-0310-9956-ffa450edef68

--- cmake/XercesIntTypes.cmake
+++ cmake/XercesIntTypes.cmake
@@ -62,7 +62,7 @@
   set(XERCES_SIZE_T size_t)
   set(XERCES_SIZE_MAX SIZE_MAX)
 else()
-  set(XERCES_SIZE_T unsigned long)
+  set(XERCES_SIZE_T "unsigned long")
   set(XERCES_SIZE_MAX ULONG_MAX)
 endif()
 if(SIZEOF_SSIZE_T)


update catkin_package to support multiple DEPENDS and dependencies with components

--- cmake/catkin_package.cmake
+++ cmake/catkin_package.cmake
@@ -109,12 +109,9 @@
 endmacro()

 function(_catkin_package)
-  parse_arguments(PROJECT
-    "INCLUDE_DIRS;LIBRARIES;CFG_EXTRAS;DEPENDS"
-    ""
-    ${ARGN})
-  if(PROJECT_DEFAULT_ARGS)
-    message(FATAL_ERROR "catkin_package() called with unused arguments: ${PROJECT_DEFAULT_ARGS}")
+  _parse_arguments_with_repeated_keywords(PROJECT "" "" "INCLUDE_DIRS;LIBRARIES;CFG_EXTRAS" "DEPENDS" ${ARGN})
+  if(PROJECT_UNPARSED_ARGUMENTS)
+    message(FATAL_ERROR "catkin_package() called with unused arguments: ${PROJECT_UNPARSED_ARGUMENTS}")
   endif()

   # unset previously found directory of this package, so that this package overlays the other cleanly
@@ -122,27 +119,53 @@
     set(${PROJECT_NAME}_DIR "" CACHE PATH "" FORCE)
   endif()

-  # filter out DEPENDS which have not been find_package()-ed before
+  # split DEPENDS with multiple packages into separate items
+  set(PROJECT_DEPENDENCIES "")
   foreach(depend ${PROJECT_DEPENDS})
-    if(NOT ${depend}_FOUND)
-      message(WARNING "catkin_package(${PROJECT_NAME}) depends on '${depend}' which has not been find_package()-ed before")
-      list(REMOVE_ITEM PROJECT_DEPENDS ${depend})
-    endif()
-  endforeach()
-
-  # find catkin-only packages in DEPENDS list for use in .pc files
+    string(REPLACE " " ";" depend_list ${depend})
+    # check if the second argument is the COMPONENTS keyword
+    list(LENGTH depend_list count)
+    set(second_item "")
+    if(${count} GREATER 1)
+      list(GET depend_list 1 second_item)
+    endif()
+    if("${second_item}" STREQUAL "COMPONENTS")
+      # pass dependencies with components as is
+      list(APPEND PROJECT_DEPENDENCIES ${depend})
+    else()
+      # split multiple names (without components) into separate dependencies
+      foreach(dep ${depend_list})
+        list(APPEND PROJECT_DEPENDENCIES ${dep})
+      endforeach()
+    endif()
+  endforeach()
+
+  # filter out dependencies which have not been find_package()-ed before
+  foreach(depend ${PROJECT_DEPENDENCIES})
+    string(REPLACE " " ";" depend_list ${depend})
+    list(GET depend_list 0 depend_name)
+    if(NOT ${depend_name}_FOUND)
+      message(WARNING "catkin_package(${PROJECT_NAME}) depends on '${depend_name}' which has not been find_package()-ed before")
+      list(REMOVE_ITEM PROJECT_DEPENDENCIES ${depend})
+    endif()
+  endforeach()
+
+  # extract all catkin packages from dependencies
   set(PROJECT_CATKIN_DEPENDS "")
-  foreach(depend ${PROJECT_DEPENDS})
-    if(${${depend}_FOUND_CATKIN_PROJECT})
-      list(APPEND PROJECT_CATKIN_DEPENDS ${depend})
-      # verify that all catkin depends are listed as build- and runtime dependencies
-      list(FIND ${PROJECT_NAME}_BUILD_DEPENDS ${depend} _index)
+  foreach(depend ${PROJECT_DEPENDENCIES})
+    string(REPLACE " " ";" depend_list ${depend})
+    # check if dependency is a catkin package
+    list(GET depend_list 0 depend_name)
+    if(${${depend_name}_FOUND_CATKIN_PROJECT})
+      list(APPEND PROJECT_CATKIN_DEPENDS ${depend_name})
+      # verify that all catkin dependencies are listed as build- and runtime dependencies
+      list(FIND ${PROJECT_NAME}_BUILD_DEPENDS ${depend_name} _index)
       if(_index EQUAL -1)
-        message(FATAL_ERROR "catkin_package(${PROJECT_NAME}) depends on catkin package '${depend}' which must therefore be listed as a build dependency in the package.xml")
+        message(FATAL_ERROR "catkin_package(${PROJECT_NAME}) depends on catkin package '${depend_name}' which must therefore be listed as a build dependency in the package.xml")
       endif()
-      list(FIND ${PROJECT_NAME}_RUN_DEPENDS ${depend} _index)
+      list(FIND ${PROJECT_NAME}_RUN_DEPENDS ${depend_name} _index)
       if(_index EQUAL -1)
-        message(FATAL_ERROR "catkin_package(${PROJECT_NAME}) depends on catkin package '${depend}' which must therefore be listed as a run dependency in the package.xml")
+        message(FATAL_ERROR "catkin_package(${PROJECT_NAME}) depends on catkin package '${depend_name}' which must therefore be listed as a run dependency in the package.xml")
       endif()
     endif()
   endforeach()
@@ -236,7 +259,7 @@

   # absolute path to include dir under install prefix if any include dir is set
   set(PROJECT_ABSOLUTE_INCLUDE_DIRS "")
-  if(${PROJECT_INCLUDE_DIRS})
+  if(NOT "X${PROJECT_INCLUDE_DIRS}" STREQUAL "X")
     set(PROJECT_ABSOLUTE_INCLUDE_DIRS ${PKG_INCLUDE_PREFIX}/include)
   endif()

@@ -301,3 +324,131 @@
     DESTINATION share/${PROJECT_NAME}
   )
 endfunction()
+
+
+# The following function is derived from CMake's cmake_parse_arguments function.
+# The support of repeated keywords has been added for catkin_package().
+# For each keyword a list variable is returned where each item contains all arguments separated by a whitespace.
+# The original license of the file is:
+#=============================================================================
+# Copyright 2010 Alexander Neundorf <neundorf@kde.org>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# Full CMake Copyright notice
+#
+# Copyright 2000-2009 Kitware, Inc., Insight Software Consortium. All rights
+# reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# Neither the names of Kitware, Inc., the Insight Software Consortium, nor
+# the names of their contributors may be used to endorse or promote products
+# derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+function(_parse_arguments_with_repeated_keywords prefix _optionNames _singleArgNames _multiArgNames _repeatMultiArgNames)
+  # first set all result variables to empty/FALSE
+  foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_repeatSingleArgNames} ${_repeatMultiArgNames})
+    set(${prefix}_${arg_name})
+  endforeach(arg_name)
+
+  foreach(option ${_optionNames})
+    set(${prefix}_${option} FALSE)
+  endforeach(option)
+
+  set(${prefix}_UNPARSED_ARGUMENTS)
+
+  set(insideValues FALSE)
+  set(currentArgName)
+
+  # now iterate over all arguments and fill the result variables
+  foreach(currentArg ${ARGN})
+    list(FIND _optionNames "${currentArg}" optionIndex)  # ... then this marks the end of the arguments belonging to this keyword
+    list(FIND _singleArgNames "${currentArg}" singleArgIndex)  # ... then this marks the end of the arguments belonging to this keyword
+    list(FIND _multiArgNames "${currentArg}" multiArgIndex)  # ... then this marks the end of the arguments belonging to this keyword
+    list(FIND _repeatMultiArgNames "${currentArg}" repeatMultiArgIndex)  # ... then this marks the end of the arguments belonging to this keyword
+
+    if(${optionIndex} EQUAL -1  AND  ${singleArgIndex} EQUAL -1  AND  ${multiArgIndex} EQUAL -1  AND  ${repeatMultiArgIndex} EQUAL -1)
+      if(insideValues)
+        if("${insideValues}" STREQUAL "SINGLE")
+          set(${prefix}_${currentArgName} ${currentArg})
+          set(insideValues FALSE)
+        elseif("${insideValues}" STREQUAL "MULTI")
+          list(APPEND ${prefix}_${currentArgName} ${currentArg})
+        elseif("${insideValues}" STREQUAL "REPEAT")
+          # get and pop last element from list
+          list(REVERSE ${prefix}_${currentArgName})
+          list(GET ${prefix}_${currentArgName} 0 _items)
+          list(REMOVE_AT ${prefix}_${currentArgName} 0)
+          list(REVERSE ${prefix}_${currentArgName})
+          # append value to element
+          set(_items "${_items} ${currentArg}")
+          # append element as string to list
+          list(APPEND ${prefix}_${currentArgName} "${_items}")
+        endif()
+      else(insideValues)
+        list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg})
+      endif(insideValues)
+    else()
+      if(NOT ${optionIndex} EQUAL -1)
+        set(${prefix}_${currentArg} TRUE)
+        set(insideValues FALSE)
+      elseif(NOT ${singleArgIndex} EQUAL -1)
+        set(currentArgName ${currentArg})
+        set(${prefix}_${currentArgName})
+        set(insideValues "SINGLE")
+      elseif(NOT ${multiArgIndex} EQUAL -1)
+        set(currentArgName ${currentArg})
+        set(${prefix}_${currentArgName})
+        set(insideValues "MULTI")
+      elseif(NOT ${repeatMultiArgIndex} EQUAL -1)
+        set(currentArgName ${currentArg})
+        # use space since empty items are not supported
+        list(APPEND ${prefix}_${currentArgName} " ")
+        set(insideValues "REPEAT")
+      endif()
+    endif()
+
+  endforeach(currentArg)
+
+  # propagate the result variables to the caller:
+  foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames})
+    set(${prefix}_${arg_name}  ${${prefix}_${arg_name}} PARENT_SCOPE)
+  endforeach(arg_name)
+  # strip spaces from the items of all repeated arguments
+  foreach(arg_name ${_repeatMultiArgNames})
+    set(stripped "")
+    foreach(items ${${prefix}_${arg_name}})
+      string(STRIP "${items}" items)
+      list(APPEND stripped "${items}")
+    endforeach()
+    set(${prefix}_${arg_name}  ${stripped} PARENT_SCOPE)
+  endforeach(arg_name)
+  set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE)
+
+endfunction()


Bump version

Bump version

--- cmake/ospray_version.cmake
+++ cmake/ospray_version.cmake
@@ -2,7 +2,7 @@
 ## SPDX-License-Identifier: Apache-2.0

 set(OSPRAY_VERSION_MAJOR 2)
-set(OSPRAY_VERSION_MINOR 1)
+set(OSPRAY_VERSION_MINOR 2)
 set(OSPRAY_VERSION_PATCH 0)
 set(OSPRAY_SOVERSION 2)
 set(OSPRAY_VERSION_GITHASH 0)


Split off 8.8.28

Split off 8.8.28

Signed-off-by: Gavin Halliday <2edfa8aca9fb78974188e5b35be8b52d4e4967ae@lexisnexis.com>

--- version.cmake
+++ version.cmake
@@ -5,7 +5,7 @@
 set ( HPCC_PROJECT "nagios-monitoring" )
 set ( HPCC_MAJOR 8 )
 set ( HPCC_MINOR 8 )
-set ( HPCC_POINT 27 )
+set ( HPCC_POINT 29 )
 set ( HPCC_MATURITY "closedown" )
 set ( HPCC_SEQUENCE 0 )
 ###


Split off 8.8.16

Split off 8.8.16

Signed-off-by: Richard Chapman <5900d56196fe29dba8e3ae556d57eae28e9f0195@hpccsystems.com>

--- version.cmake
+++ version.cmake
@@ -5,7 +5,7 @@
 set ( HPCC_PROJECT "nagios-monitoring" )
 set ( HPCC_MAJOR 8 )
 set ( HPCC_MINOR 8 )
-set ( HPCC_POINT 15 )
+set ( HPCC_POINT 17 )
 set ( HPCC_MATURITY "closedown" )
 set ( HPCC_SEQUENCE 0 )
 ###


Split off 7.12.20

Split off 7.12.20

Signed-off-by: Richard Chapman <5900d56196fe29dba8e3ae556d57eae28e9f0195@hpccsystems.com>

--- version.cmake
+++ version.cmake
@@ -5,7 +5,7 @@
 set ( HPCC_PROJECT "nagios-monitoring" )
 set ( HPCC_MAJOR 7 )
 set ( HPCC_MINOR 12 )
-set ( HPCC_POINT 19 )
+set ( HPCC_POINT 21 )
 set ( HPCC_MATURITY "closedown" )
 set ( HPCC_SEQUENCE 0 )
 ###


Bump patch version

Bump patch version

--- version.cmake
+++ version.cmake
@@ -4,4 +4,4 @@

 set(HAKA_VERSION_MAJOR 0)
 set(HAKA_VERSION_MINOR 2)
-set(HAKA_VERSION_PATCH 1)
+set(HAKA_VERSION_PATCH 2)


Mac: detect x64 macs

Mac: detect x64 macs

This is needed so WITH_SSE2 is turned on automatically.

--- cmake/ConfigOptions.cmake
+++ cmake/ConfigOptions.cmake
@@ -2,6 +2,9 @@
 if((CMAKE_SYSTEM_PROCESSOR MATCHES "i386|i686|x86") AND (CMAKE_SIZEOF_VOID_P EQUAL 4))
 	set(TARGET_ARCH "x86")
 elseif((CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64") AND (CMAKE_SIZEOF_VOID_P EQUAL 8))
+	set(TARGET_ARCH "x64")
+elseif((CMAKE_SYSTEM_PROCESSOR MATCHES "i386") AND (CMAKE_SIZEOF_VOID_P EQUAL 8) AND (APPLE))
+	# Mac is weird like that.
 	set(TARGET_ARCH "x64")
 elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm*")
 	set(TARGET_ARCH "ARM")


Fix for deprecated CUDA compute capability based on http://stackoverflow.com/questions/28932864/cuda-compute-capability-requirements

--- cmake/FindCUDA_wrap.cmake
+++ cmake/FindCUDA_wrap.cmake
@@ -67,9 +67,15 @@
      -gencode arch=compute_20,code=sm_20
      -gencode arch=compute_20,code=compute_20
     )
+elseif("${CUDA_VERSION}" LESS 8.0)
+ set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}
+     -gencode arch=compute_20,code=sm_20
+     -gencode arch=compute_30,code=sm_30
+     -gencode arch=compute_35,code=sm_35
+     -gencode arch=compute_35,code=compute_35
+     )
 else()
  set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}
-     -gencode arch=compute_20,code=sm_20
      -gencode arch=compute_30,code=sm_30
      -gencode arch=compute_35,code=sm_35
      -gencode arch=compute_35,code=compute_35


FEAT: Update iOS cmake toolchain

FEAT: Update iOS cmake toolchain

--- cmake/toolchain/ios.cmake
+++ cmake/toolchain/ios.cmake
@@ -1,156 +1,333 @@
-# Copyright (c) 2015, Tomas Zemaitis
-# All rights reserved.
+# This file is part of the ios-cmake project. It was retrieved from
+# https://github.com/cristeab/ios-cmake.git, which is a fork of
+# https://code.google.com/p/ios-cmake/. Which in turn is based off of
+# the Platform/Darwin.cmake and Platform/UnixPaths.cmake files which
+# are included with CMake 2.8.4
+#
+# The ios-cmake project is licensed under the new BSD license.
+#
+# Copyright (c) 2014, Bogdan Cristea and LTE Engineering Software,
+# Kitware, Inc., Insight Software Consortium.  All rights reserved.
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# This file is based off of the Platform/Darwin.cmake and
+# Platform/UnixPaths.cmake files which are included with CMake 2.8.4
+# It has been altered for iOS development.
+#
+# Updated by Alex Stewart (alexs.mac@gmail.com).
+# The following variables control the behaviour of this toolchain:
+#
+# IOS_PLATFORM: OS (default) or SIMULATOR or SIMULATOR64
+#    OS = Build for iPhoneOS.
+#    SIMULATOR = Build for x86 i386 iPhone Simulator.
+#    SIMULATOR64 = Build for x86 x86_64 iPhone Simulator.
+# CMAKE_OSX_SYSROOT: Path to the iOS SDK to use.  By default this is
+#    automatically determined from IOS_PLATFORM and xcodebuild, but
+#    can also be manually specified (although this should not be required).
+# CMAKE_IOS_DEVELOPER_ROOT: Path to the Developer directory for the iOS platform
+#    being compiled for.  By default this is automatically determined from
+#    CMAKE_OSX_SYSROOT, but can also be manually specified (although this should
+#    not be required).
+# ENABLE_BITCODE: (true|false) Enables or disables bitcode support. Default true
+#
+# This toolchain defines the following variables for use externally:
+#
+# XCODE_VERSION: Version number (not including Build version) of Xcode detected.
+# IOS_SDK_VERSION: Version of iOS SDK being used.
+# CMAKE_OSX_ARCHITECTURES: Architectures being compiled for (generated from
+#    IOS_PLATFORM).
+#
+# This toolchain defines the following macros for use externally:
+#
+# set_xcode_property (TARGET XCODE_PROPERTY XCODE_VALUE XCODE_VARIANT)
+#   A convenience macro for setting xcode specific properties on targets.
+#   Available variants are: All, Release, RelWithDebInfo, Debug, MinSizeRel
+#   example: set_xcode_property (myioslib IPHONEOS_DEPLOYMENT_TARGET "3.1" "all").
+#
+# find_host_package (PROGRAM ARGS)
+#   A macro used to find executable programs on the host system, not within the
+#   iOS environment.  Thanks to the android-cmake project for providing the
+#   command.

-list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
+# Fix for PThread library not in path
+set(CMAKE_THREAD_LIBS_INIT "-lpthread")
+set(CMAKE_HAVE_THREADS_LIBRARY 1)
+set(CMAKE_USE_WIN32_THREADS_INIT 0)
+set(CMAKE_USE_PTHREADS_INIT 1)

-include(clear_env)
-include(fatal_error)
+# Get the Xcode version being used.
+execute_process(COMMAND xcodebuild -version
+  OUTPUT_VARIABLE XCODE_VERSION
+  ERROR_QUIET
+  OUTPUT_STRIP_TRAILING_WHITESPACE)
+string(REGEX MATCH "Xcode [0-9\\.]+" XCODE_VERSION "${XCODE_VERSION}")
+string(REGEX REPLACE "Xcode ([0-9\\.]+)" "\\1" XCODE_VERSION "${XCODE_VERSION}")
+message(STATUS "Building with Xcode version: ${XCODE_VERSION}")
+# Default to building for iPhoneOS if not specified otherwise, and we cannot
+# determine the platform from the CMAKE_OSX_ARCHITECTURES variable.  The use
+# of CMAKE_OSX_ARCHITECTURES is such that try_compile() projects can correctly
+# determine the value of IOS_PLATFORM from the root project, as
+# CMAKE_OSX_ARCHITECTURES is propagated to them by CMake.
+if (NOT DEFINED IOS_PLATFORM)
+  if (CMAKE_OSX_ARCHITECTURES)
+    if (CMAKE_OSX_ARCHITECTURES MATCHES ".*arm.*")
+      set(IOS_PLATFORM "OS")
+    elseif (CMAKE_OSX_ARCHITECTURES MATCHES "i386")
+      set(IOS_PLATFORM "SIMULATOR")
+    elseif (CMAKE_OSX_ARCHITECTURES MATCHES "x86_64")
+      set(IOS_PLATFORM "SIMULATOR64")
+    endif()
+  endif()
+  if (NOT IOS_PLATFORM)
+    set(IOS_PLATFORM "OS")
+  endif()
+endif()
+set(IOS_PLATFORM ${IOS_PLATFORM} CACHE STRING
+  "Type of iOS platform for which to build.")
+# Determine the platform name and architectures for use in xcodebuild commands
+# from the specified IOS_PLATFORM name.
+if (IOS_PLATFORM STREQUAL "OS")
+  set(XCODE_IOS_PLATFORM iphoneos)
+  set(IOS_ARCH armv7 armv7s arm64)
+elseif (IOS_PLATFORM STREQUAL "SIMULATOR")
+  set(XCODE_IOS_PLATFORM iphonesimulator)
+  set(IOS_ARCH i386)
+elseif(IOS_PLATFORM STREQUAL "SIMULATOR64")
+  set(XCODE_IOS_PLATFORM iphonesimulator)
+  set(IOS_ARCH x86_64)
+else()
+  message(FATAL_ERROR "Invalid IOS_PLATFORM: ${IOS_PLATFORM}")
+endif()
+message(STATUS "Configuring iOS build for platform: ${IOS_PLATFORM}, "
+  "architecture(s): ${IOS_ARCH}")
+# If user did not specify the SDK root to use, then query xcodebuild for it.
+if (NOT CMAKE_OSX_SYSROOT)
+  execute_process(COMMAND xcodebuild -version -sdk ${XCODE_IOS_PLATFORM} Path
+    OUTPUT_VARIABLE CMAKE_OSX_SYSROOT
+    ERROR_QUIET
+    OUTPUT_STRIP_TRAILING_WHITESPACE)
+  message(STATUS "Using SDK: ${CMAKE_OSX_SYSROOT} for platform: ${IOS_PLATFORM}")
+endif()
+if (NOT EXISTS ${CMAKE_OSX_SYSROOT})
+  message(FATAL_ERROR "Invalid CMAKE_OSX_SYSROOT: ${CMAKE_OSX_SYSROOT} "
+    "does not exist.")
+endif()
+# Specify minimum version of deployment target.
+if (NOT DEFINED IOS_DEPLOYMENT_TARGET)
+  # Unless specified, SDK version 9.0 is used by default as minimum target version.
+  set(IOS_DEPLOYMENT_TARGET "9.0"
+      CACHE STRING "Minimum iOS version to build for." )
+  message(STATUS "Using the default min-version since IOS_DEPLOYMENT_TARGET not provided!")
+endif()
+# Use bitcode or not
+if (NOT DEFINED ENABLE_BITCODE)
+  # Unless specified, enable bitcode support by default
+  set(ENABLE_BITCODE TRUE CACHE BOOL "Wheter or not to enable bitcode")
+  message(STATUS "Enabling bitcode support by default. ENABLE_BITCODE not provided!")
+endif()
+# Get the SDK version information.
+execute_process(COMMAND xcodebuild -sdk ${CMAKE_OSX_SYSROOT} -version SDKVersion
+  OUTPUT_VARIABLE IOS_SDK_VERSION
+  ERROR_QUIET
+  OUTPUT_STRIP_TRAILING_WHITESPACE)
+# Find the Developer root for the specific iOS platform being compiled for
+# from CMAKE_OSX_SYSROOT.  Should be ../../ from SDK specified in
+# CMAKE_OSX_SYSROOT.  There does not appear to be a direct way to obtain
+# this information from xcrun or xcodebuild.
+if (NOT CMAKE_IOS_DEVELOPER_ROOT)
+  get_filename_component(IOS_PLATFORM_SDK_DIR ${CMAKE_OSX_SYSROOT} PATH)
+  get_filename_component(CMAKE_IOS_DEVELOPER_ROOT ${IOS_PLATFORM_SDK_DIR} PATH)
+endif()
+if (NOT EXISTS ${CMAKE_IOS_DEVELOPER_ROOT})
+  message(FATAL_ERROR "Invalid CMAKE_IOS_DEVELOPER_ROOT: "
+    "${CMAKE_IOS_DEVELOPER_ROOT} does not exist.")
+endif()
+# Find the C & C++ compilers for the specified SDK.
+if (NOT CMAKE_C_COMPILER)
+  execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find clang
+    OUTPUT_VARIABLE CMAKE_C_COMPILER
+    ERROR_QUIET
+    OUTPUT_STRIP_TRAILING_WHITESPACE)
+  message(STATUS "Using C compiler: ${CMAKE_C_COMPILER}")
+endif()
+if (NOT CMAKE_CXX_COMPILER)
+  execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find clang++
+    OUTPUT_VARIABLE CMAKE_CXX_COMPILER
+    ERROR_QUIET
+    OUTPUT_STRIP_TRAILING_WHITESPACE)
+  message(STATUS "Using CXX compiler: ${CMAKE_CXX_COMPILER}")
+endif()
+# Find (Apple's) libtool.
+execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find libtool
+  OUTPUT_VARIABLE IOS_LIBTOOL
+  ERROR_QUIET
+  OUTPUT_STRIP_TRAILING_WHITESPACE)
+message(STATUS "Using libtool: ${IOS_LIBTOOL}")
+# Configure libtool to be used instead of ar + ranlib to build static libraries.
+# This is required on Xcode 7+, but should also work on previous versions of
+# Xcode.
+set(CMAKE_C_CREATE_STATIC_LIBRARY
+  "${IOS_LIBTOOL} -static -o <TARGET> <LINK_FLAGS> <OBJECTS> ")
+set(CMAKE_CXX_CREATE_STATIC_LIBRARY
+  "${IOS_LIBTOOL} -static -o <TARGET> <LINK_FLAGS> <OBJECTS> ")
+# Get the version of Darwin (OS X) of the host.
+execute_process(COMMAND uname -r
+  OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION
+  ERROR_QUIET
+  OUTPUT_STRIP_TRAILING_WHITESPACE)
+# Standard settings.
+set(CMAKE_SYSTEM_NAME Darwin CACHE INTERNAL "")
+set(CMAKE_SYSTEM_VERSION ${IOS_SDK_VERSION} CACHE INTERNAL "")
+set(UNIX TRUE CACHE BOOL "")
+set(APPLE TRUE CACHE BOOL "")
+set(IOS TRUE CACHE BOOL "")
+set(CMAKE_AR ar CACHE FILEPATH "" FORCE)
+set(CMAKE_RANLIB ranlib CACHE FILEPATH "" FORCE)
+# Force unset of OS X-specific deployment target (otherwise autopopulated),
+# required as of cmake 2.8.10.
+set(CMAKE_OSX_DEPLOYMENT_TARGET "" CACHE STRING
+  "Must be empty for iOS builds." FORCE)
+# Set the architectures for which to build.
+set(CMAKE_OSX_ARCHITECTURES ${IOS_ARCH} CACHE STRING "Build architecture for iOS")
+# Skip the platform compiler checks for cross compiling.
+set(CMAKE_CXX_COMPILER_FORCED TRUE)
+set(CMAKE_CXX_COMPILER_WORKS TRUE)
+set(CMAKE_C_COMPILER_FORCED TRUE)
+set(CMAKE_C_COMPILER_WORKS TRUE)
+# All iOS/Darwin specific settings - some may be redundant.
+set(CMAKE_SHARED_LIBRARY_PREFIX "lib")
+set(CMAKE_SHARED_LIBRARY_SUFFIX ".dylib")
+set(CMAKE_SHARED_MODULE_PREFIX "lib")
+set(CMAKE_SHARED_MODULE_SUFFIX ".so")
+set(CMAKE_MODULE_EXISTS 1)
+set(CMAKE_DL_LIBS "")
+set(CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG "-compatibility_version ")
+set(CMAKE_C_OSX_CURRENT_VERSION_FLAG "-current_version ")
+set(CMAKE_CXX_OSX_COMPATIBILITY_VERSION_FLAG "${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}")
+set(CMAKE_CXX_OSX_CURRENT_VERSION_FLAG "${CMAKE_C_OSX_CURRENT_VERSION_FLAG}")
+message(STATUS "Building for minimum iOS version: ${IOS_DEPLOYMENT_TARGET}"
+               " (SDK version: ${IOS_SDK_VERSION})")
+# Note that only Xcode 7+ supports the newer more specific:
+# -m${XCODE_IOS_PLATFORM}-version-min flags, older versions of Xcode use:
+# -m(ios/ios-simulator)-version-min instead.
+if (IOS_PLATFORM STREQUAL "OS")
+  if (XCODE_VERSION VERSION_LESS 7.0)
+    set(XCODE_IOS_PLATFORM_VERSION_FLAGS
+      "-mios-version-min=${IOS_DEPLOYMENT_TARGET}")
+  else()
+    # Xcode 7.0+ uses flags we can build directly from XCODE_IOS_PLATFORM.
+    set(XCODE_IOS_PLATFORM_VERSION_FLAGS
+      "-m${XCODE_IOS_PLATFORM}-version-min=${IOS_DEPLOYMENT_TARGET}")
+  endif()
+else()
+  # SIMULATOR or SIMULATOR64 both use -mios-simulator-version-min.
+  set(XCODE_IOS_PLATFORM_VERSION_FLAGS
+    "-mios-simulator-version-min=${IOS_DEPLOYMENT_TARGET}")
+endif()
+message(STATUS "Version flags set to: ${XCODE_IOS_PLATFORM_VERSION_FLAGS}")

-# Fix try_compile
-set(MACOSX_BUNDLE_GUI_IDENTIFIER com.example)
-set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED NO)
-set(CMAKE_MACOSX_BUNDLE YES)
+if (ENABLE_BITCODE)
+  set(BITCODE "-fembed-bitcode")
+  message(STATUS "Enabling bitcode support.")
+else()
+  set(BITCODE "")
+  message(STATUS "Disabling bitcode support.")
+endif()

-set (CMAKE_CXX_COMPILER_WORKS TRUE)
-set (CMAKE_C_COMPILER_WORKS TRUE)
-set (CMAKE_C_FLAGS_INIT "")
-set (CMAKE_CXX_FLAGS_INIT "-fvisibility=hidden -fvisibility-inlines-hidden")
-
-set(IPHONEOS_ARCHS armv7;arm64)
-set(IPHONESIMULATOR_ARCHS i386;x86_64)
-
-set(CMAKE_OSX_SYSROOT "iphoneos" CACHE STRING "System root for iOS" FORCE)
-set(CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos;-iphonesimulator")
-
-# find 'iphoneos' and 'iphonesimulator' roots and version
-find_program(XCODE_SELECT_EXECUTABLE xcode-select)
-if(NOT XCODE_SELECT_EXECUTABLE)
-  fatal_error("xcode-select not found")
-endif()
-
-if(CMAKE_VERSION VERSION_LESS "3.5")
-  fatal_error(
-      "CMake minimum required version for iOS is 3.5 (current ver: ${CMAKE_VERSION})"
-  )
-endif()
-
-execute_process(
-    COMMAND
-    ${XCODE_SELECT_EXECUTABLE}
-    "-print-path"
-    OUTPUT_VARIABLE
-    XCODE_DEVELOPER_ROOT # /.../Xcode.app/Contents/Developer
-    OUTPUT_STRIP_TRAILING_WHITESPACE
-)
-
-find_program(XCODEBUILD_EXECUTABLE xcodebuild)
-if(NOT XCODEBUILD_EXECUTABLE)
-  fatal_error("xcodebuild not found")
-endif()
-
-# Check version exists
-execute_process(
-    COMMAND
-    "${XCODEBUILD_EXECUTABLE}" "-showsdks"
-    COMMAND
-    "grep" "iphoneos"
-    COMMAND
-    "egrep" "[[:digit:]]+\\.[[:digit:]]+" "-o"
-    COMMAND
-    "tail" "-1"
-    OUTPUT_VARIABLE IOS_SDK_VERSION
-    RESULT_VARIABLE IOS_SDK_VERSION_RESULT
-    OUTPUT_STRIP_TRAILING_WHITESPACE
-)
-
-# iPhone simulator root
-set(
-    IPHONESIMULATOR_ROOT
-    "${XCODE_DEVELOPER_ROOT}/Platforms/iPhoneSimulator.platform/Developer"
-)
-if(NOT EXISTS "${IPHONESIMULATOR_ROOT}")
-  fatal_error(
-      "IPHONESIMULATOR_ROOT not found (${IPHONESIMULATOR_ROOT})\n"
-      "XCODE_DEVELOPER_ROOT: ${XCODE_DEVELOPER_ROOT}\n"
-  )
-endif()
-
-# iPhone simulator SDK root
-set(
-    IPHONESIMULATOR_SDK_ROOT
-    "${IPHONESIMULATOR_ROOT}/SDKs/iPhoneSimulator${IOS_SDK_VERSION}.sdk"
-)
-
-if(NOT EXISTS ${IPHONESIMULATOR_SDK_ROOT})
-  polly_fatal_error(
-      "IPHONESIMULATOR_SDK_ROOT not found (${IPHONESIMULATOR_SDK_ROOT})\n"
-      "IPHONESIMULATOR_ROOT: ${IPHONESIMULATOR_ROOT}\n"
-      "IOS_SDK_VERSION: ${IOS_SDK_VERSION}\n"
-  )
-endif()
-
-# iPhone root
-set(
-    IPHONEOS_ROOT
-    "${XCODE_DEVELOPER_ROOT}/Platforms/iPhoneOS.platform/Developer"
-)
-if(NOT EXISTS "${IPHONEOS_ROOT}")
-  fatal_error(
-      "IPHONEOS_ROOT not found (${IPHONEOS_ROOT})\n"
-      "XCODE_DEVELOPER_ROOT: ${XCODE_DEVELOPER_ROOT}\n"
-  )
-endif()
-
-# iPhone SDK root
-set(IPHONEOS_SDK_ROOT "${IPHONEOS_ROOT}/SDKs/iPhoneOS${IOS_SDK_VERSION}.sdk")
-
-if(NOT EXISTS ${IPHONEOS_SDK_ROOT})
-  fatal_error(
-      "IPHONEOS_SDK_ROOT not found (${IPHONEOS_SDK_ROOT})\n"
-      "IPHONEOS_ROOT: ${IPHONEOS_ROOT}\n"
-      "IOS_SDK_VERSION: ${IOS_SDK_VERSION}\n"
-  )
-endif()
-
-string(COMPARE EQUAL "${IOS_DEPLOYMENT_SDK_VERSION}" "" _is_empty)
-if(_is_empty)
-  set(
-      CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET
-      "${IOS_SDK_VERSION}"
-  )
-else()
-  set(
-      CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET
-      "${IOS_DEPLOYMENT_SDK_VERSION}"
-  )
-endif()
-
-# Emulate OpenCV toolchain --
-set(IOS YES)
-# -- end
-
-# Set iPhoneOS architectures
-set(archs "")
-foreach(arch ${IPHONEOS_ARCHS})
-  set(archs "${archs} ${arch}")
+set(CMAKE_C_FLAGS
+"${XCODE_IOS_PLATFORM_VERSION_FLAGS} ${BITCODE} -fobjc-abi-version=2 -fobjc-arc ${CMAKE_C_FLAGS}")
+# Hidden visibilty is required for C++ on iOS.
+set(CMAKE_CXX_FLAGS
+  "${XCODE_IOS_PLATFORM_VERSION_FLAGS} ${BITCODE} -fvisibility=hidden -fvisibility-inlines-hidden -fobjc-abi-version=2 -fobjc-arc ${CMAKE_CXX_FLAGS}")
+set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O3 -fomit-frame-pointer -ffast-math ${BITCODE} ${CMAKE_CXX_FLAGS_RELEASE}")
+set(CMAKE_C_LINK_FLAGS "${XCODE_IOS_PLATFORM_VERSION_FLAGS} -Wl,-search_paths_first ${CMAKE_C_LINK_FLAGS}")
+set(CMAKE_CXX_LINK_FLAGS "${XCODE_IOS_PLATFORM_VERSION_FLAGS}  -Wl,-search_paths_first ${CMAKE_CXX_LINK_FLAGS}")
+# In order to ensure that the updated compiler flags are used in try_compile()
+# tests, we have to forcibly set them in the CMake cache, not merely set them
+# in the local scope.
+list(APPEND VARS_TO_FORCE_IN_CACHE
+  CMAKE_C_FLAGS
+  CMAKE_CXX_FLAGS
+  CMAKE_CXX_RELEASE
+  CMAKE_C_LINK_FLAGS
+  CMAKE_CXX_LINK_FLAGS)
+foreach(VAR_TO_FORCE ${VARS_TO_FORCE_IN_CACHE})
+  set(${VAR_TO_FORCE} "${${VAR_TO_FORCE}}" CACHE STRING "" FORCE)
 endforeach()
-set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=iphoneos*] "${archs}")
-set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphoneos*] "${archs}")
-
-# Set iPhoneSimulator architectures
-set(archs "")
-foreach(arch ${IPHONESIMULATOR_ARCHS})
-  set(archs "${archs} ${arch}")
-endforeach()
-set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=iphonesimulator*] "${archs}")
-set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphonesimulator*] "${archs}")
-
-# Introduced in iOS 9.0
-set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE YES)
-
-# This will set CMAKE_CROSSCOMPILING to TRUE.
-# CMAKE_CROSSCOMPILING needed for try_run:
-# * https://cmake.org/cmake/help/latest/command/try_run.html#behavior-when-cross-compiling
-# (used in CURL)
-set(CMAKE_SYSTEM_NAME "Darwin")
-
+set(CMAKE_PLATFORM_HAS_INSTALLNAME 1)
+set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -headerpad_max_install_names")
+set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -headerpad_max_install_names")
+set(CMAKE_SHARED_MODULE_LOADER_C_FLAG "-Wl,-bundle_loader,")
+set(CMAKE_SHARED_MODULE_LOADER_CXX_FLAG "-Wl,-bundle_loader,")
+set(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".so" ".a")
+# Hack: if a new cmake (which uses CMAKE_INSTALL_NAME_TOOL) runs on an old
+# build tree (where install_name_tool was hardcoded) and where
+# CMAKE_INSTALL_NAME_TOOL isn't in the cache and still cmake didn't fail in
+# CMakeFindBinUtils.cmake (because it isn't rerun) hardcode
+# CMAKE_INSTALL_NAME_TOOL here to install_name_tool, so it behaves as it did
+# before, Alex.
+if (NOT DEFINED CMAKE_INSTALL_NAME_TOOL)
+  find_program(CMAKE_INSTALL_NAME_TOOL install_name_tool)
+endif (NOT DEFINED CMAKE_INSTALL_NAME_TOOL)
+# Set the find root to the iOS developer roots and to user defined paths.
+set(CMAKE_FIND_ROOT_PATH ${CMAKE_IOS_DEVELOPER_ROOT} ${CMAKE_OSX_SYSROOT}
+  ${CMAKE_PREFIX_PATH} CACHE string  "iOS find search path root" FORCE)
+# Default to searching for frameworks first.
+set(CMAKE_FIND_FRAMEWORK FIRST)
+# Set up the default search directories for frameworks.
+set(CMAKE_SYSTEM_FRAMEWORK_PATH
+  ${CMAKE_OSX_SYSROOT}/System/Library/Frameworks
+  ${CMAKE_OSX_SYSROOT}/System/Library/PrivateFrameworks
+  ${CMAKE_OSX_SYSROOT}/Developer/Library/Frameworks)
+# Only search the specified iOS SDK, not the remainder of the host filesystem.
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+# This little macro lets you set any XCode specific property.
+macro(set_xcode_property TARGET XCODE_PROPERTY XCODE_VALUE XCODE_RELVERSION)
+  set(XCODE_RELVERSION_I "${XCODE_RELVERSION}")
+  if (XCODE_RELVERSION_I STREQUAL "All")
+    set_property(TARGET ${TARGET} PROPERTY
+    XCODE_ATTRIBUTE_${XCODE_PROPERTY} "${XCODE_VALUE}")
+  else()
+    set_property(TARGET ${TARGET} PROPERTY
+    XCODE_ATTRIBUTE_${XCODE_PROPERTY}[variant=${XCODE_RELVERSION_I}] "${XCODE_VALUE}")
+  endif()
+endmacro(set_xcode_property)
+# This macro lets you find executable programs on the host system.
+macro(find_host_package)
+  set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+  set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER)
+  set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER)
+  set(IOS FALSE)
+  find_package(${ARGN})
+  set(IOS TRUE)
+  set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
+  set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+  set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+endmacro(find_host_package)


Change rpath configuration for OpenMesh

Change rpath configuration for OpenMesh

git-svn-id: b66b41e514ff40863ef1aa95df2dbf63dd8d6be1@298 fdac6126-5c0c-442c-9429-916003d36597

--- cmake/ACGCommon.cmake
+++ cmake/ACGCommon.cmake
@@ -102,8 +102,9 @@
   elseif (APPLE AND NOT ACG_PROJECT_MACOS_BUNDLE)
     set_target_properties (
       ${target} PROPERTIES
-      INSTALL_NAME_DIR "@executable_path/../lib/${CMAKE_PROJECT_NAME}"
-      BUILD_WITH_INSTALL_RPATH 1
+      #INSTALL_NAME_DIR "@executable_path/../lib/${CMAKE_PROJECT_NAME}"
+      INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib/${CMAKE_PROJECT_NAME}"
+#      BUILD_WITH_INSTALL_RPATH 1
       SKIP_BUILD_RPATH 0
     )
   elseif (NOT APPLE)


FindFFTW3.cmake: fix missing fftw3 check

--- cmake/FindFFTW3.cmake
+++ cmake/FindFFTW3.cmake
@@ -74,7 +74,7 @@
         set(_fstem "fftw3${_SUFFIXF}")

         if(PkgConfig_FOUND)
-            pkg_check_modules("PC_FFTW3${_SUFFIXV}" QUIET "fftw3${_SUFFIXF}")
+			pkg_check_modules("PC_FFTW3${_SUFFIXV}" QUIET ${_fstem})
         endif()

         find_library(${_library}
@@ -108,18 +108,19 @@
 #            if(_comp STREQUAL "fftw3")
 #                _fftw3_lib(D "")

+    _fftw3_lib(D "")
     _fftw3_lib(F f)
     _fftw3_lib(L l)
     _fftw3_lib(Q q)

     find_path(FFTW3_INCLUDE_DIR fftw3.h
-		HINTS
+        HINTS
             ${PC_FFTW3F_INCLUDE_DIRS}
             ${PC_FFTW3D_INCLUDE_DIRS}
             ${PC_FFTW3L_INCLUDE_DIRS}
             ${PC_FFTW3Q_INCLUDE_DIRS})

-	set(FFTW3_VERSION ${PC_FFTW3D_VERSION})
+    set(FFTW3_VERSION ${PC_FFTW3D_VERSION})
 endif()

 if(NOT FFTW3_LIBRARIES)
@@ -132,8 +133,8 @@
 # handle the QUIETLY and REQUIRED arguments and set FFTW3_FOUND to TRUE
 # if all listed variables are TRUE
 find_package_handle_standard_args(FFTW3
-	REQUIRED_VARS FFTW3_LIBRARIES FFTW3_INCLUDE_DIRS
-	VERSION_VAR FFTW3_VERSION)
+    REQUIRED_VARS FFTW3_LIBRARIES FFTW3_INCLUDE_DIRS
+    VERSION_VAR FFTW3_VERSION)

 mark_as_advanced(FFTW3_INCLUDE_DIRS FFTW3_LIBRARIES
         FFTW3F_LIBRARY FFTW3F_THREADS_LIBRARY
@@ -175,4 +176,4 @@
     _fftw3_component_target(F f)
     _fftw3_component_target(L l)
     _fftw3_component_target(Q q)
-endif()+endif()


add error catching to use_pkg macro

add error catching to use_pkg macro

--- cmake/dd-macros.cmake
+++ cmake/dd-macros.cmake
@@ -32,6 +32,10 @@
     set(cachevar ${pkgname}_pkgconfig)
     pkg_check_modules(${cachevar} ${pkgname})

+    if (NOT ${cachevar}_FOUND)
+      message(SEND_ERROR "required package ${pkgname} not found. PKG_CONFIG_PATH=$ENV{PKG_CONFIG_PATH}")
+    endif()
+
     string(REPLACE ";" " " _cflags_str "${${cachevar}_CFLAGS}")
     string(REPLACE ";" " " _ldflags_str "${${cachevar}_LDFLAGS}")
     set_property(TARGET ${target} APPEND_STRING PROPERTY COMPILE_FLAGS "${_cflags_str} ")


Removing false warning about early versions of OpenMPI (which were due to it being less robust to freeing and immediately recreating MPI_Comm's potentially changing the communicator handle)

--- cmake/tests/MPI.cmake
+++ cmake/tests/MPI.cmake
@@ -7,43 +7,6 @@
 endif()
 include_directories(${MPI_C_INCLUDE_PATH})
 set(EXTRA_FLAGS "${EXTRA_FLAGS} ${MPI_C_COMPILE_FLAGS}")
-
-# Issue an error if a buggy version of OpenMPI is detected
-# ========================================================
-include(LibFindMacros)
-set(MPI_INCLUDE_DIR ${MPI_C_INCLUDE_PATH}) # forces this dir to be checked 1st?
-libfind_header(MPI MPI_HEADER_DIR "mpi.h")
-if(NOT MPI_HEADER_DIR)
-  message(FATAL_ERROR
-    "Could not find mpi.h using MPI_C_INCLUDE_PATH=${MPI_C_INCLUDE_PATH}")
-endif()
-if(NOT EXISTS "${MPI_HEADER_DIR}/mpi.h")
-  message(FATAL_ERROR "mpi.h was not located within ${MPI_HEADER_DIR}")
-endif()
-# There does not seem to be a way to capture just the version number itself,
-# and so the following capture the entire line and then search and replace to
-# get the version number capture
-file(STRINGS "${MPI_HEADER_DIR}/mpi.h" MPI_HEADER)
-string(REGEX MATCH "#define[\r\n\t ]+OMPI_MAJOR_VERSION[\r\n\t ]+[0-9]+"
-  OMPI_MAJOR_VERSION "${MPI_HEADER}")
-string(REGEX MATCH "#define[\r\n\t ]+OMPI_MINOR_VERSION[\r\n\t ]+[0-9]+"
-  OMPI_MINOR_VERSION "${MPI_HEADER}")
-string(REGEX MATCH "#define[\r\n\t ]+OMPI_RELEASE_VERSION[\r\n\t ]+[0-9]+"
-  OMPI_RELEASE_VERSION "${MPI_HEADER}")
-if(OMPI_MAJOR_VERSION AND OMPI_MINOR_VERSION AND OMPI_RELEASE_VERSION)
-  string(REGEX REPLACE "#define[\r\n\t ]+OMPI_MAJOR_VERSION[\t\n\t ]+([0-9]+)" "\\1" OMPI_MAJOR_VERSION "${OMPI_MAJOR_VERSION}")
-  string(REGEX REPLACE "#define[\r\n\t ]+OMPI_MINOR_VERSION[\t\n\t ]+([0-9]+)" "\\1" OMPI_MINOR_VERSION "${OMPI_MINOR_VERSION}")
-  string(REGEX REPLACE "#define[\r\n\t ]+OMPI_RELEASE_VERSION[\t\n\t ]+([0-9]+)" "\\1" OMPI_RELEASE_VERSION "${OMPI_RELEASE_VERSION}")
-  message("Detected OpenMPI ${OMPI_MAJOR_VERSION}.${OMPI_MINOR_VERSION}.${OMPI_RELEASE_VERSION}")
-  # Die if OpenMPI version is 1.8.x with x <= 3
-  if(OMPI_MAJOR_VERSION STREQUAL "1" AND OMPI_MINOR_VERSION STREQUAL "8")
-    if(OMPI_RELEASE_VERSION STREQUAL "1" OR
-       OMPI_RELEASE_VERSION STREQUAL "2" OR
-       OMPI_RELEASE_VERSION STREQUAL "3")
-      message(FATAL_ERROR "OpenMPI versions 1.8.${OMPI_RELEASE_VERSION} contains insurmountable bugs in MPI_Comm_dup and MPI_Comm_free (please upgrade to 1.8.4)")
-    endif()
-  endif()
-endif()

 # Ensure that we have MPI1 by looking for MPI_Reduce_scatter
 # ==========================================================


fixed fix to get MSI package build properly

--- common/cmake/package.cmake
+++ common/cmake/package.cmake
@@ -40,7 +40,7 @@
 # Install Headers
 ##############################################################
 INSTALL(DIRECTORY include/embree3 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT devel)
-IF (WIN32)
+IF (NOT WIN32)
   INSTALL(DIRECTORY man/man3 DESTINATION ${CMAKE_INSTALL_MANDIR} COMPONENT devel)
 ENDIF()


COMP: redirect to bug fixed personal repo #184

--- SuperBuild/ExternalElastix.cmake
+++ SuperBuild/ExternalElastix.cmake
@@ -19,8 +19,8 @@

 set( proj Elastix )

-set( ELASTIX_GIT_REPOSITORY https://github.com/SuperElastix/elastix )
-set( ELASTIX_GIT_TAG 058253a1e7804e2e0d704dae372b97d853defbe5 )
+set( ELASTIX_GIT_REPOSITORY https://github.com/FBerendsen/elastix )
+set( ELASTIX_GIT_TAG 8b347998d62c400bf6a8e20e2fb33032f1abfbaf )

 UPDATE_SELX_SUPERBUILD_COMMAND(${proj})


fftw has different target name on windows since it is one blob

--- projects/itk.cmake
+++ projects/itk.cmake
@@ -1,5 +1,9 @@
+set(fftw_targets fftw3double fftw3float fftw3long)
+if (WIN32)
+  set(fftw_targets fftw)
+endif()
 add_external_project(itk
-  DEPENDS fftw
+  DEPENDS ${fftw_targets}
   BUILD_IN_SOURCE 1
   CONFIGURE_COMMAND ""
   BUILD_COMMAND ""


Cleanup and path management

Cleanup and path management

- added quadrature nodes and weights to data/quadrature
- improved paths.hpp
- separated tests

--- cmake_modules/yolo/YOLOProjectAddTestCase.cmake
+++ cmake_modules/yolo/YOLOProjectAddTestCase.cmake
@@ -1,45 +1,45 @@
 include(CMakeParseArguments)
-#
-#set(TESTS_REQUIRING_TEST_DATA
-#        # Fails remotely
-#        test_aerodynamics_AerodynamicMomentAndAerodynamicForce
-#        test_aerodynamics_TabulatedAtmosphere
-#        test_aerodynamics_ControlSurfaceIncrements
-#        test_aerodynamics_WindModel
-#        test_ephemerides_ApproximatePlanetPositions
-#        test_ephemerides_TabulatedEphemeris
-#        test_spice_SpiceInterface
-#        test_simulation_EnvironmentModelSetup
-#        test_simulation_AccelerationModelSetup
-#        test_io_BasicInputOutput
-#        # Fails locally
-#        test_aerodynamics_AerodynamicCoefficientsFromFile
-#        test_basic_astro_EmpiricalAcceleration
-#        test_earth_orientation_EarthOrientationCalculator
-#        test_earth_orientation_EopReader
-#        test_earth_orientation_PolarMotionCalculator
-#        test_earth_orientation_TimeScaleConverter
-#        test_earth_orientation_ShortPeriodEopCorrections
-#        test_electromagnetism_PanelledRadiationPressure
-#        test_interpolators_CubicSplineInterpolator
-#        test_interpolators_LinearInterpolator
-#        test_interpolators_MultiLinearInterpolator
-#        test_integrators_EulerIntegrator
-#        test_integrators_RungeKutta4Integrator
-#        test_integrators_RungeKuttaFehlberg45Integrator
-#        test_integrators_RungeKuttaFehlberg78Integrator
-#        test_integrators_RungeKutta87DormandPrinceIntegrator
-#        test_quadrature_GaussianQuadrature
-#        test_io_MapTextFileReader
-#        test_io_MatrixTextFileReader
-#        test_io_TwoLineElementsTextFileReader
-#        test_io_MissileDatcomReader
-#        test_io_MissileDatcomData
-#        test_io_DictionaryInputSystem
-#        test_io_MultiArrayReader
-#        test_io_MultiArrayWriter
-#        test_io_AerodynamicCoefficientReader
-#        )
+
+set(TESTS_REQUIRING_TEST_DATA
+        # Fails remotely
+        test_aerodynamics_AerodynamicMomentAndAerodynamicForce
+        test_aerodynamics_TabulatedAtmosphere
+        test_aerodynamics_ControlSurfaceIncrements
+        test_aerodynamics_WindModel
+        test_ephemerides_ApproximatePlanetPositions
+        test_ephemerides_TabulatedEphemeris
+        test_spice_SpiceInterface
+        test_simulation_EnvironmentModelSetup
+        test_simulation_AccelerationModelSetup
+        test_io_BasicInputOutput
+        # Fails locally
+        test_aerodynamics_AerodynamicCoefficientsFromFile
+        test_basic_astro_EmpiricalAcceleration
+        test_earth_orientation_EarthOrientationCalculator
+        test_earth_orientation_EopReader
+        test_earth_orientation_PolarMotionCalculator
+        test_earth_orientation_TimeScaleConverter
+        test_earth_orientation_ShortPeriodEopCorrections
+        test_electromagnetism_PanelledRadiationPressure
+        test_interpolators_CubicSplineInterpolator
+        test_interpolators_LinearInterpolator
+        test_interpolators_MultiLinearInterpolator
+        test_integrators_EulerIntegrator
+        test_integrators_RungeKutta4Integrator
+        test_integrators_RungeKuttaFehlberg45Integrator
+        test_integrators_RungeKuttaFehlberg78Integrator
+        test_integrators_RungeKutta87DormandPrinceIntegrator
+        test_quadrature_GaussianQuadrature
+        test_io_MapTextFileReader
+        test_io_MatrixTextFileReader
+        test_io_TwoLineElementsTextFileReader
+        test_io_MissileDatcomReader
+        test_io_MissileDatcomData
+        test_io_DictionaryInputSystem
+        test_io_MultiArrayReader
+        test_io_MultiArrayWriter
+        test_io_AerodynamicCoefficientReader
+        )

 function("TUDAT_ADD_TEST_CASE" arg1)
     # arg1 : Test name. Will add source file ${CMAKE_CURRENT_SOURCE_DIR}/tests/unitTest${arg1}.cpp


Windows: Added `/EHsc` to `CMAKE_CXX_FLAGS`.

After upgrading Visual Studio to 15.5.2, warning C4530 started being
emitted for practically every file. Since we use the STL (which uses
exceptions), apparently we need to compile with `/EHsc`. This sets the
exception-handling model to catch C++ exceptions, and to assume that
functions declared as `extern "C"` never throw a C++ exception.

Review: https://reviews.apache.org/r/64701

--- cmake/CompilationConfigure.cmake
+++ cmake/CompilationConfigure.cmake
@@ -266,7 +266,14 @@
 if (WIN32)
   # COFF/PE and friends are somewhat limited in the number of sections they
   # allow for an object file. We use this to avoid those problems.
-  string(APPEND CMAKE_CXX_FLAGS " /bigobj /vd2 /permissive-")
+  string(APPEND CMAKE_CXX_FLAGS " /bigobj /vd2")
+
+  # Disable permissiveness.
+  string(APPEND CMAKE_CXX_FLAGS " /permissive-")
+
+  # Fix Warning C4530: C++ exception handler used, but unwind semantics are not
+  # enabled.
+  string(APPEND CMAKE_CXX_FLAGS " /EHsc")

   # Build against the multi-threaded version of the C runtime library (CRT).
   if (BUILD_SHARED_LIBS)


cmake/FindGccFuncAttribute.cmake: fix typo

--- cmake/FindGccFuncAttribute.cmake
+++ cmake/FindGccFuncAttribute.cmake
@@ -2,7 +2,7 @@
 MACRO (FINDGCCFUNCATTRIBUTE attribute)
   GET_PROPERTY(source_dir_set GLOBAL PROPERTY MYPACKAGE_SOURCE_DIR SET)
   IF (NOT ${source_dir_set})
-    MESSAGE (WARNING "Cannot check inline, property MYPACKAGE_SOURCE_DIR is not set")
+    MESSAGE (WARNING "Cannot check ${attribute}, property MYPACKAGE_SOURCE_DIR is not set")
   ELSE ()
     STRING (TOUPPER ${attribute} ATTRIBUTE)
     IF (NOT C_GCC_FUNC_ATTRIBUTE_${ATTRIBUTE}_SINGLETON)


Add brew/osx search path for openblas (#5821)

--- cmake/Modules/FindOpenBLAS.cmake
+++ cmake/Modules/FindOpenBLAS.cmake
@@ -12,6 +12,7 @@
   /usr/local/include/openblas
   /usr/local/include/openblas-base
   /opt/OpenBLAS/include
+  /usr/local/opt/openblas/include
   ${PROJECT_SOURCE_DIR}/3rdparty/OpenBLAS/include
   ${PROJECT_SOURCE_DIR}/thirdparty/OpenBLAS/include
   ${OpenBLAS_HOME}
@@ -28,6 +29,7 @@
         /usr/local/lib
         /usr/local/lib64
         /opt/OpenBLAS/lib
+        /usr/local/opt/openblas/lib
         ${PROJECT_SOURCE_DIR}/3rdparty/OpenBLAS/lib
         ${PROJECT_SOURCE_DIR}/thirdparty/OpenBLAS/lib
 	${OpenBLAS_DIR}


Find lemon on Windows

Find lemon on Windows

--- cmake_extensions/FindLemon.cmake
+++ cmake_extensions/FindLemon.cmake
@@ -5,7 +5,10 @@
 #  LEMON_INCLUDE_DIR        - Lemon include directory.
 #  LEMON_LIBRARIES          - Lemon library files
 FIND_PATH(LEMON_INCLUDE_DIR lemon/config.h PATHS /usr/include /usr/local/include ${CMAKE_INCLUDE_PATH} ${CMAKE_PREFIX_PATH}/include $ENV{LEMON_ROOT}/include ENV CPLUS_INCLUDE_PATH)
-FIND_LIBRARY(LEMON_LIBRARIES emon PATHS $ENV{LEMON_ROOT}/src/impex $ENV{LEMON_ROOT}/lib ENV LD_LIBRARY_PATH ENV LIBRARY_PATH)
+FIND_LIBRARY(LEMON_LIBRARIES
+  NAMES emon lemon
+  PATHS $ENV{LEMON_ROOT}/src/impex $ENV{LEMON_ROOT}/lib ENV LD_LIBRARY_PATH ENV LIBRARY_PATH
+)

 GET_FILENAME_COMPONENT(LEMON_LIBRARY_PATH ${LEMON_LIBRARIES} PATH)
 SET( LEMON_LIBRARY_DIR ${LEMON_LIBRARY_PATH} CACHE PATH "Path to lemon library.")


Added an option to run tests directly instead of through shell wrapper. This allows CTest to correctly run them through valgrind.

--- config/VigraAddTest.cmake
+++ config/VigraAddTest.cmake
@@ -89,11 +89,15 @@
                        ${VIGRA_RUN_TEST}
                        @ONLY)
     ELSE()
-        SET(VIGRA_RUN_TEST "${CMAKE_CURRENT_BINARY_DIR}/run_${target}.sh")
-        CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/config/run_test.sh.in
-                       ${VIGRA_RUN_TEST}
-                       @ONLY)
-        EXECUTE_PROCESS(COMMAND chmod u+x ${VIGRA_RUN_TEST} OUTPUT_QUIET ERROR_QUIET)
+        IF(VIGRA_RUN_TESTS_DIRECTLY)
+          SET(VIGRA_RUN_TEST "${CMAKE_CURRENT_BINARY_DIR}/${target}")
+        ELSE()
+          SET(VIGRA_RUN_TEST "${CMAKE_CURRENT_BINARY_DIR}/run_${target}.sh")
+          CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/config/run_test.sh.in
+                         ${VIGRA_RUN_TEST}
+                         @ONLY)
+          EXECUTE_PROCESS(COMMAND chmod u+x ${VIGRA_RUN_TEST} OUTPUT_QUIET ERROR_QUIET)
+        ENDIF()
     ENDIF()

     # register the test execution command


Fix Output path for GTEST library with Ninja

Corrected the output path to include the config directory only with
Visual Studio.

Change-Id: Icdc7650d1dc80bf63c7377054c5e802c440ef98f

--- SuperBuild/External_GTest.cmake
+++ SuperBuild/External_GTest.cmake
@@ -23,8 +23,8 @@
 )

 set(${proj}_ARCHIVE_OUTPUT_DIRECTORY "<BINARY_DIR>/lib")
-if (MSVC)
-  set(${proj}_ARCHIVE_OUTPUT_DIRECTORY "<BINARY_DIR>/lib/$<CONFIGURATION>")
+if (CMAKE_GENERATOR MATCHES "Visual Studio")
+  set(${proj}_ARCHIVE_OUTPUT_DIRECTORY "<BINARY_DIR>/lib/$<CONFIG>")
 endif()

 set(ep_extra_args)


Fix cmake warning.

Fix cmake warning.

--- build/cmake/CondorPackageConfig.cmake
+++ build/cmake/CondorPackageConfig.cmake
@@ -217,7 +217,7 @@
 		set (VC_CRT_MSM Microsoft_VC90_CRT_x86.msm)
 		find_file( CPACK_VC_POLICY_MODULE
 			policy_9_0_Microsoft_VC90_CRT_x86.msm
-               		"C:/Program Files/Common Files/Merge Modules";"C:/Program Files (x86)/Common Files/Merge Modules" )
+               		"C:/Program Files/Common Files/Merge Modules" "C:/Program Files (x86)/Common Files/Merge Modules" )
 		set (WIX_MERGE_MODLES "<Merge Id=\"VCPolicy\" Language=\"1033\" DiskId=\"1\" SourceFile=\"${CPACK_VC_POLICY_MODULE}\"/>")
 		set (WIX_MERGE_REFS "<MergeRef Id=\"VCPolicy\"/>")
 		set (MSVCVER vc90)
@@ -237,7 +237,7 @@
 	# look for the all important C-runtime
 	find_file( CPACK_VC_MERGE_MODULE
 		${VC_CRT_MSM}
-		"C:/Program Files/Common Files/Merge Modules";"C:/Program Files (x86)/Common Files/Merge Modules" )
+		"C:/Program Files/Common Files/Merge Modules" "C:/Program Files (x86)/Common Files/Merge Modules" )

 	set (WIX_MERGE_MODLES "<Merge Id=\"VCCRT\" Language=\"1033\" DiskId=\"1\" SourceFile=\"${CPACK_VC_MERGE_MODULE}\"/>\n${WIX_MERGE_MODLES}")
 	set (WIX_MERGE_REFS "<MergeRef Id=\"VCCRT\"/>\n${WIX_MERGE_REFS}")


minor change to AZMQ find script

minor change to AZMQ find script

--- config/FindAZMQ.cmake
+++ config/FindAZMQ.cmake
@@ -3,9 +3,8 @@
 # Variables
 # AZMQROOT - set this to a location where ZeroMQ may be found
 #
-# AZMQ_FOUND - True of ZeroMQ found
+# AZMQ_FOUND - True if ZeroMQ found
 # AZMQ_INCLUDE_DIRS - Location of ZeroMQ includes
-# AZMQ_LIBRARIS - ZeroMQ libraries

 include(FindPackageHandleStandardArgs)

@@ -18,8 +17,7 @@
 find_path(AZMQ_INCLUDE_DIRS NAMES azmq/actor.hpp HINTS ${_AZMQ_ROOT}/include)

-find_package_handle_standard_args(AZMQ FOUND_VAR AZMQ_FOUND
-                                      REQUIRED_VARS AZMQ_INCLUDE_DIRS)
+find_package_handle_standard_args(AZMQ FOUND_VAR AZMQ_FOUND REQUIRED_VARS AZMQ_INCLUDE_DIRS)

 if (AZMQ_FOUND)
     mark_as_advanced(AZMQ_FIND_VERSION_EXACT AZMQ_INCLUDE_DIRS )


cmake: attempt fix for bug #4 cxxtest

cmake: attempt fix for bug #4 cxxtest

--- lib/FindCxxtest.cmake
+++ lib/FindCxxtest.cmake
@@ -11,20 +11,41 @@
 # Find path to the cxxtestgen.py script (NB: this stuff should move to FindCXXTEST.cmake)
 # CXXTEST_BIN_DIR enviroment variable must have been defined already

+SET(CXXTEST_FOUND 0)
+
 # cxxtest has a Python version and a Perl version. First, look
 # for the Python version.
 FIND_PACKAGE(PythonInterp)
-FIND_PATH(CXXTEST_PYTHON_BIN_DIR cxxtestgen.py
-	$ENV{CXXTEST_BIN_DIR}
-	/usr/bin
-	/usr/local/bin
-	DOC "Where is cxxtest located?"
-)
-IF (PYTHONINTERP_FOUND AND CXXTEST_PYTHON_BIN_DIR)
-	SET(CXXTEST_FOUND 1)
-	SET(CXXTEST_GEN "${CXXTEST_PYTHON_BIN_DIR}/cxxtestgen.py")
-ELSE (PYTHONINTERP_FOUND AND CXXTEST_PYTHON_BIN_DIR)
+IF (PYTHONINTERP_FOUND)
+	FIND_PATH(CXXTEST_PYTHON_BIN_DIR cxxtestgen.py
+		$ENV{CXXTEST_BIN_DIR}
+		/usr/bin
+		/usr/local/bin
+		DOC "Where is cxxtest located?"
+	)
+	IF (CXXTEST_PYTHON_BIN_DIR)
+		SET(CXXTEST_FOUND 1)
+		SET(CXXTEST_GEN "${CXXTEST_PYTHON_BIN_DIR}/cxxtestgen.py")
+	ENDIF (CXXTEST_PYTHON_BIN_DIR)

+	# Sometimes, the python version doesn't have a .py extension.
+	# repeat the above search, without the extension.
+	IF (NOT CXXTEST_FOUND)
+		FIND_PATH(CXXTEST_PYTHON_BIN_DIR cxxtestgen
+			$ENV{CXXTEST_BIN_DIR}
+			/usr/bin
+			/usr/local/bin
+			DOC "Where is cxxtest located?"
+		)
+		IF (CXXTEST_PYTHON_BIN_DIR)
+			SET(CXXTEST_FOUND 1)
+			SET(CXXTEST_GEN "${CXXTEST_PYTHON_BIN_DIR}/cxxtestgen")
+		ENDIF (CXXTEST_PYTHON_BIN_DIR)
+	ENDIF (NOT CXXTEST_FOUND)
+ENDIF (PYTHONINTERP_FOUND)
+
+# If we still haven't found it, try the perl version.
+IF (NOT CXXTEST_FOUND)
 	# The python version wasn't found--search for the perl version.
 	FIND_PATH(CXXTEST_PERL_BIN_DIR cxxtestgen.pl
 		$ENV{CXXTEST_BIN_DIR}
@@ -35,12 +56,9 @@
 	IF (CXXTEST_PERL_BIN_DIR)
 		SET(CXXTEST_FOUND 1)
 		SET(CXXTEST_GEN "${CXXTEST_PERL_BIN_DIR}/cxxtestgen.pl")
-	ELSE (CXXTEST_PERL_BIN_DIR)
-		# There is no cxxtest, either in Perl or Python
-		SET(CXXTEST_FOUND 0)
 	ENDIF (CXXTEST_PERL_BIN_DIR)
+ENDIF (NOT CXXTEST_FOUND)

-ENDIF (PYTHONINTERP_FOUND AND CXXTEST_PYTHON_BIN_DIR)

 IF (WIN32)
 	FIND_PATH(CXXTEST_INCLUDE_DIR "TestSuite.h"


Fix CMake warning CMP0054: don't quote a variable name that is intended to be
expanded; future versions of cmake may not expand the variable in this case.

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

--- cmake/modules/HandleLLVMOptions.cmake
+++ cmake/modules/HandleLLVMOptions.cmake
@@ -128,7 +128,7 @@
 function(add_flag_or_print_warning flag name)
   check_c_compiler_flag("-Werror ${flag}" "C_SUPPORTS_${name}")
   check_cxx_compiler_flag("-Werror ${flag}" "CXX_SUPPORTS_${name}")
-  if ("C_SUPPORTS_${name}" AND "CXX_SUPPORTS_${name}")
+  if (C_SUPPORTS_${name} AND CXX_SUPPORTS_${name})
     message(STATUS "Building with ${flag}")
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}" PARENT_SCOPE)
     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}" PARENT_SCOPE)


Fix libstdc++4.7 test on Android.

Fix libstdc++4.7 test on Android.

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

--- cmake/modules/HandleLLVMOptions.cmake
+++ cmake/modules/HandleLLVMOptions.cmake
@@ -30,6 +30,9 @@
     # libstdc++4.6 that is fixed in libstdc++4.7.
     if(NOT LLVM_ENABLE_LIBCXX)
       set(CMAKE_REQUIRED_FLAGS "-std=c++0x")
+      if (ANDROID)
+        set(CMAKE_REQUIRED_LIBRARIES "atomic")
+      endif()
       check_cxx_source_compiles("
 #include <atomic>
 std::atomic<float> x(0.0f);


[cmake] Remove Python 2 from build requirement (#42434)

In theory, this requirement is no longer necenssary. Let's see if CI
agrees.

--- cmake/modules/StandaloneOverlay.cmake
+++ cmake/modules/StandaloneOverlay.cmake
@@ -132,7 +132,6 @@
 include(SwiftComponents)
 include(DarwinSDKs)

-find_package(Python2 COMPONENTS Interpreter REQUIRED)
 find_package(Python3 COMPONENTS Interpreter REQUIRED)

 # Without this line, installing components is broken. This needs refactoring.


suppress clang warnings about __toku_db_lsn's size

--- cmake_modules/TokuSetupCompiler.cmake
+++ cmake_modules/TokuSetupCompiler.cmake
@@ -96,6 +96,7 @@
   -Wno-error=address-of-array-temporary
   -Wno-error=tautological-constant-out-of-range-compare
   -Wno-ignored-attributes
+  -Wno-error=extern-c-compat
   -fno-rtti
   -fno-exceptions
   )


Spdlog installing from incorrect path

Spdlog installing from incorrect path

Because of changes made in 82b7b247.
Closes astro-informatics:sopt#74

--- modules/LookUpspdlog.cmake
+++ modules/LookUpspdlog.cmake
@@ -8,7 +8,9 @@
     CONFIGURE_COMMAND ""
     BUILD_COMMAND ""
     INSTALL_COMMAND
-      ${CMAKE_COMMAND} -E copy_directory ${EXTERNAL_ROOT}/src/spdlog/include ${EXTERNAL_ROOT}/include
+      ${CMAKE_COMMAND} -E copy_directory
+          ${EXTERNAL_ROOT}/src/Lookup-spdlog/include
+          ${EXTERNAL_ROOT}/include

     # Wrap download, configure and build steps in a script to log output
     UPDATE_COMMAND ""


Cleanup

Cleanup

--- cmake/PlatformMacOS.cmake
+++ cmake/PlatformMacOS.cmake
@@ -19,13 +19,8 @@
     # type (cf. http://www.cmake.org/pipermail/cmake/2006-December/012288.html)
     # Therefore, we re-define the CMAKE_CONFIGURATION_TYPES here according to the value
     # in CMAKE_BUILD_TYPES.
-    if (${CMAKE_BUILD_TYPE} STREQUAL "Release")
-	set(CMAKE_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE})
-	message(STATUS ">> Re-defining as follows: CMAKE_CONFIGURATION_TYPES = ${CMAKE_CONFIGURATION_TYPES}")
-    else ()
-	set(CMAKE_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE})
-	message(STATUS ">> Re-defining as follows: CMAKE_CONFIGURATION_TYPES = ${CMAKE_CONFIGURATION_TYPES}")
-    endif()
+    set(CMAKE_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE})
+    message(STATUS ">> Re-defining variable CMAKE_CONFIGURATION_TYPES := ${CMAKE_CONFIGURATION_TYPES}")

 endif()


update

update

--- modules/cpp-optparse.cmake
+++ modules/cpp-optparse.cmake
@@ -2,7 +2,12 @@

   # Module library
   file(GLOB SOURCE_FILES "cpp-optparse/OptionParser.cpp")
-  set_source_files_properties(${SOURCE_FILES} PROPERTIES COMPILE_FLAGS "${PEDANTIC_COMPILE_FLAGS}")
+  if(NOT MSVC)
+    set_source_files_properties(${SOURCE_FILES} PROPERTIES COMPILE_FLAGS "${PEDANTIC_COMPILE_FLAGS}")
+  else()
+    # C4244: 'conversion' conversion from 'type1' to 'type2', possible loss of data
+    set_source_files_properties(${SOURCE_FILES} PROPERTIES COMPILE_FLAGS "${PEDANTIC_COMPILE_FLAGS} /wd4244")
+  endif()
   add_library(cpp-optparse ${SOURCE_FILES})

   # Module folder


Add support for linking to static LLVM libraries, and for specifying a specific LLVM version to be used.

--- src/cmake/externalpackages.cmake
+++ src/cmake/externalpackages.cmake
@@ -177,23 +177,34 @@
 ###########################################################################
 # LLVM library setup

-if (LLVM_DIRECTORY)
-    set (LLVM_CONFIG "${LLVM_DIRECTORY}/bin/llvm-config")
-else ()
-    set (LLVM_CONFIG llvm-config)
-endif ()
-execute_process (COMMAND ${LLVM_CONFIG} --version
-                 OUTPUT_VARIABLE LLVM_VERSION
-	         OUTPUT_STRIP_TRAILING_WHITESPACE)
-execute_process (COMMAND ${LLVM_CONFIG} --prefix
-                 OUTPUT_VARIABLE LLVM_DIRECTORY
-	         OUTPUT_STRIP_TRAILING_WHITESPACE)
-execute_process (COMMAND ${LLVM_CONFIG} --libdir
-                 OUTPUT_VARIABLE LLVM_LIB_DIR
-  	         OUTPUT_STRIP_TRAILING_WHITESPACE)
-execute_process (COMMAND ${LLVM_CONFIG} --includedir
-                 OUTPUT_VARIABLE LLVM_INCLUDES
-  	         OUTPUT_STRIP_TRAILING_WHITESPACE)
+# try to find llvm-config, with a specific version if specified
+if(LLVM_DIRECTORY)
+  FIND_PROGRAM(LLVM_CONFIG llvm-config-${LLVM_VERSION} HINTS ${LLVM_DIRECTORY}/bin NO_CMAKE_PATH)
+  if(NOT LLVM_CONFIG)
+    FIND_PROGRAM(LLVM_CONFIG llvm-config HINTS ${LLVM_DIRECTORY}/bin NO_CMAKE_PATH)
+  endif()
+else()
+  FIND_PROGRAM(LLVM_CONFIG llvm-config-${LLVM_VERSION})
+  if(NOT LLVM_CONFIG)
+    FIND_PROGRAM(LLVM_CONFIG llvm-config)
+  endif()
+endif()
+
+if(NOT LLVM_DIRECTORY OR EXISTS ${LLVM_CONFIG})
+  execute_process (COMMAND ${LLVM_CONFIG} --version
+       OUTPUT_VARIABLE LLVM_VERSION
+       OUTPUT_STRIP_TRAILING_WHITESPACE)
+  execute_process (COMMAND ${LLVM_CONFIG} --prefix
+       OUTPUT_VARIABLE LLVM_DIRECTORY
+       OUTPUT_STRIP_TRAILING_WHITESPACE)
+  execute_process (COMMAND ${LLVM_CONFIG} --libdir
+       OUTPUT_VARIABLE LLVM_LIB_DIR
+       OUTPUT_STRIP_TRAILING_WHITESPACE)
+  execute_process (COMMAND ${LLVM_CONFIG} --includedir
+       OUTPUT_VARIABLE LLVM_INCLUDES
+       OUTPUT_STRIP_TRAILING_WHITESPACE)
+endif()
+
 find_library ( LLVM_LIBRARY
                NAMES LLVM-${LLVM_VERSION}
                PATHS ${LLVM_LIB_DIR})
@@ -203,7 +214,8 @@
 message (STATUS "LLVM library  = ${LLVM_LIBRARY}")
 message (STATUS "LLVM lib dir  = ${LLVM_LIB_DIR}")

-if (LLVM_LIBRARY AND LLVM_INCLUDES AND LLVM_DIRECTORY AND LLVM_LIB_DIR)
+# shared llvm library may not be available, this is not an error if we use LLVM_STATIC.
+if ((LLVM_LIBRARY OR LLVM_STATIC) AND LLVM_INCLUDES AND LLVM_DIRECTORY AND LLVM_LIB_DIR)
   # ensure include directory is added (in case of non-standard locations
   include_directories (BEFORE "${LLVM_INCLUDES}")
   # Extract any wayward dots or "svn" suffixes from the version to yield
@@ -216,17 +228,17 @@
     # if static LLVM libraries were requested, use llvm-config to generate
     # the list of what libraries we need, and substitute that in the right
     # way for LLVM_LIBRARY.
-    set (LLVM_LIBRARY "")
-    execute_process (COMMAND ${LLVM_CONFIG} --libs
-                 OUTPUT_VARIABLE llvm_library_list
-	         OUTPUT_STRIP_TRAILING_WHITESPACE)
-    string (REPLACE "-l" "" llvm_library_list ${llvm_library_list})
-    string (REPLACE " " ";" llvm_library_list ${llvm_library_list})
-    foreach (f ${llvm_library_list})
-      list (APPEND LLVM_LIBRARY "${LLVM_LIB_DIR}/lib${f}.a")
-    endforeach ()
+    execute_process (COMMAND ${LLVM_CONFIG} --libfiles
+                     OUTPUT_VARIABLE LLVM_LIBRARY
+                     OUTPUT_STRIP_TRAILING_WHITESPACE)
+    string (REPLACE " " ";" LLVM_LIBRARY ${LLVM_LIBRARY})
   endif ()
   message (STATUS "LLVM library  = ${LLVM_LIBRARY}")
+
+
+  if (NOT LLVM_LIBRARY)
+    message (FATAL_ERROR "LLVM library not found.")
+  endif()
 else ()
   message (FATAL_ERROR "LLVM not found.")
 endif ()


More robust OSL_LLVM_VERSION regex to work with 3-part version numbers

--- src/cmake/externalpackages.cmake
+++ src/cmake/externalpackages.cmake
@@ -186,10 +186,11 @@
 if ((LLVM_LIBRARY OR LLVM_STATIC) AND LLVM_INCLUDES AND LLVM_DIRECTORY AND LLVM_LIB_DIR)
   # ensure include directory is added (in case of non-standard locations
   include_directories (BEFORE "${LLVM_INCLUDES}")
-  # Extract any wayward dots or "svn" suffixes from the version to yield
-  # an integer version number we can use to make compilation decisions.
-  string (REGEX REPLACE "\\." "" OSL_LLVM_VERSION ${LLVM_VERSION})
-  string (REGEX REPLACE "svn" "" OSL_LLVM_VERSION ${OSL_LLVM_VERSION})
+  if (NOT OSL_LLVM_VERSION)
+      # Extract and concatenate major & minor, remove wayward patches,
+      # dots, and "svn" or other suffixes.
+      string (REGEX REPLACE "([0-9]+)\\.([0-9]+).*" "\\1\\2" OSL_LLVM_VERSION ${LLVM_VERSION})
+  endif ()
   add_definitions ("-DOSL_LLVM_VERSION=${OSL_LLVM_VERSION}")
   if (LLVM_STATIC)
     # if static LLVM libraries were requested, use llvm-config to generate


build: help pave the road for a mixed Python build

LLDB requires python3, however, gyb is a python2 tool.  Use the fact
that we have a newer CMake at our disposal and use the `Python2` package
in CMake to locate a viable python interpreter.  This allows us to have
references to both versions of python simultaneously.

--- cmake/modules/SwiftHandleGybSources.cmake
+++ cmake/modules/SwiftHandleGybSources.cmake
@@ -1,5 +1,7 @@
 include(SwiftAddCustomCommandTarget)
 include(SwiftSetIfArchBitness)
+
+find_package(Python2 COMPONENTS Interpreter REQUIRED)

 # Create a target to process single gyb source with the 'gyb' tool.
 #
@@ -58,7 +60,7 @@
       COMMAND
           "${CMAKE_COMMAND}" -E make_directory "${dir}"
       COMMAND
-          "${PYTHON_EXECUTABLE}" "${gyb_tool}" ${SWIFT_GYB_FLAGS} ${GYB_SINGLE_FLAGS} -o "${GYB_SINGLE_OUTPUT}.tmp" "${GYB_SINGLE_SOURCE}"
+          "$<TARGET_FILE:Python2::Interpreter>" "${gyb_tool}" ${SWIFT_GYB_FLAGS} ${GYB_SINGLE_FLAGS} -o "${GYB_SINGLE_OUTPUT}.tmp" "${GYB_SINGLE_SOURCE}"
       COMMAND
           "${CMAKE_COMMAND}" -E copy_if_different "${GYB_SINGLE_OUTPUT}.tmp" "${GYB_SINGLE_OUTPUT}"
       COMMAND


Bugfix: Correct pickup regex for coverage files

git-svn-id: 59f82343654cec32357d3b049d399063e4e4cfc7@31280 0785d39b-7218-0410-832d-ea1e28bc413d

--- deal.II/CTestConfig.cmake
+++ deal.II/CTestConfig.cmake
@@ -38,9 +38,9 @@
 #

 SET(CTEST_EXTRA_COVERAGE_GLOB
-  \${CTEST_SOURCE_DIRECTORY}/include/**/*.h
-  \${CTEST_SOURCE_DIRECTORY}/source/**/*.cc
-  \${CTEST_SOURCE_DIRECTORY}/source/**/*.inst.in
+  # already relative to source dir:
+  include/**/*.h
+  source/**/*.cc
   )

 SET(CTEST_CUSTOM_COVERAGE_EXCLUDE


Roll back r26203.

Roll back r26203.

Swift SVN r26207

--- cmake/modules/SwiftSetIfArchBitness.cmake
+++ cmake/modules/SwiftSetIfArchBitness.cmake
@@ -7,9 +7,7 @@
       ${ARGN})

   if("${SIA_ARCH}" STREQUAL "i386" OR
-     "${SIA_ARCH}" STREQUAL "armv7" OR
-     "${SIA_ARCH}" STREQUAL "armv7s" OR
-     "${SIA_ARCH}" STREQUAL "armv7k")
+     "${SIA_ARCH}" STREQUAL "armv7")
     set("${var_name}" "${SIA_CASE_32_BIT}" PARENT_SCOPE)
   elseif("${SIA_ARCH}" STREQUAL "x86_64" OR
          "${SIA_ARCH}" STREQUAL "arm64")