SuperBuild: FFTW: use combined threads for windows

--- SuperBuild/CMake/External_fftw.cmake
+++ SuperBuild/CMake/External_fftw.cmake
@@ -27,6 +27,12 @@
 set(FFTWF_SB_BUILD ${CMAKE_BINARY_DIR}/FFTW/build/FFTWF)
 set(FFTWD_SB_BUILD ${CMAKE_BINARY_DIR}/FFTW/build/FFTWD)

+if(WIN32)
+  set(FFTW_SB_CONFIG -DWITH_COMBINED_THREADS:BOOL=ON)
+else()
+  set(FFTW_SB_CONFIG -DWITH_COMBINED_THREADS:BOOL=OFF)
+endif()
+
 # Compile the float version of FFTW
 ExternalProject_Add(FFTWF
   PREFIX FFTW/FFTWF
@@ -44,14 +50,13 @@
     -DENABLE_THREADS:BOOL=ON
     -DENABLE_SSE2:BOOL=ON
     -DENABLE_FLOAT:BOOL=ON
+    ${FFTW_SB_CONFIG}
   DEPENDS ${FFTW_DEPENDENCIES}
   LOG_DOWNLOAD 1
   LOG_CONFIGURE 1
   LOG_BUILD 1
   LOG_INSTALL 1
   )
-
-# SUPERBUILD_PATCH_SOURCE(FFTWF)

 # Compile the double version of FFTW
 ExternalProject_Add(FFTWD
@@ -70,14 +75,13 @@
     -DENABLE_THREADS:BOOL=ON
     -DENABLE_SSE2:BOOL=ON
     -DENABLE_FLOAT:BOOL=OFF
+    ${FFTW_SB_CONFIG}
   DEPENDS FFTWF
   LOG_DOWNLOAD 1
   LOG_CONFIGURE 1
   LOG_BUILD 1
   LOG_INSTALL 1
   )
-
-# SUPERBUILD_PATCH_SOURCE(FFTWD)

 ExternalProject_Add(FFTW
   PREFIX FFTW


BUG: cmake variable CROSS_COMPILING -> CMAKE_CROSSCOMPILING

--- SuperBuild/CMake/PackageHelper.cmake
+++ SuperBuild/CMake/PackageHelper.cmake
@@ -123,7 +123,7 @@
   # install(CODE "message(\"CMake/PackageHelper.cmake:install_common(${outdir})\n${vars}\n\")")

   ##################### install environment source ##########################
-  if(WIN32 OR CROSS_COMPILING)
+  if(WIN32 OR CMAKE_CROSSCOMPILING)
     set(ENV_SOURCE_FILES
       "${PACKAGE_SUPPORT_FILES_DIR}/otbenv.cmd"
       "${PACKAGE_SUPPORT_FILES_DIR}/otbenv.profile"


STYLE: Nightly Date Stamp

STYLE: Nightly Date Stamp

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

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


STYLE: Nightly Date Stamp

STYLE: Nightly Date Stamp

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

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


STYLE: Nightly Date Stamp

STYLE: Nightly Date Stamp

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

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


STYLE: Nightly Date Stamp

STYLE: Nightly Date Stamp

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

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


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

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

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


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

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

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


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

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

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


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

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

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


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

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

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


STYLE: Nightly Date Stamp

STYLE: Nightly Date Stamp

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

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


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

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

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


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

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

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

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


STYLE: Nightly Date Stamp

STYLE: Nightly Date Stamp

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

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


STYLE: Nightly Date Stamp

STYLE: Nightly Date Stamp

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

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


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

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

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


STYLE: Nightly Date Stamp

STYLE: Nightly Date Stamp

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

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


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

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

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


Corrected PATH -> FILEPATH

Corrected PATH -> FILEPATH

--- Testing/jenkins_mercury.cmake
+++ Testing/jenkins_mercury.cmake
@@ -71,7 +71,7 @@
 MERCURY_USE_XDR:BOOL=OFF
 NA_USE_BMI:BOOL=ON
 BMI_INCLUDE_DIR:PATH=$ENV{WORKSPACE}/.install/include
-BMI_LIBRARY:PATH=$ENV{WORKSPACE}/.install/lib/libbmi.a
+BMI_LIBRARY:FILEPATH=$ENV{WORKSPACE}/.install/lib/libbmi.a
 NA_USE_MPI:BOOL=ON
 MPIEXEC_MAX_NUMPROCS:STRING=4
 ")


adds library to boost

adds library to boost

--- boost.cmake
+++ boost.cmake
@@ -22,7 +22,7 @@
     6a1f32d902203ac70fbec78af95b3cf8
     http://downloads.sourceforge.net/project/boost/boost/1.51.0)

-set (boost_LIBS     ${BUILDEM_LIB_DIR}/libboost_thread.so  ${BUILDEM_LIB_DIR}/libboost_system.so ${BUILDEM_LIB_DIR}/libboost_program_options.so ${BUILDEM_LIB_DIR}/libboost_python.so ${BUILDEM_LIB_DIR}/libboost_unit_test_framework.so)
+set (boost_LIBS     ${BUILDEM_LIB_DIR}/libboost_thread.so  ${BUILDEM_LIB_DIR}/libboost_system.so ${BUILDEM_LIB_DIR}/libboost_program_options.so ${BUILDEM_LIB_DIR}/libboost_python.so ${BUILDEM_LIB_DIR}/libboost_unit_test_framework.so ${BUILDEM_LIB_DIR}/libboost_filesystem.so)

 # Add layout=tagged param to first boost install to explicitly create -mt libraries
 # some libraries require.  TODO: Possibly shore up all library find paths to only


Add support for building tgz packages

Add support for building tgz packages

--- build.cmake
+++ build.cmake
@@ -21,7 +21,6 @@
 #-------------------------------------------------------------------------------

 # Construct a target platform specific build environment
-# TODO this cmake support is under construction

 project(${app})

@@ -36,12 +35,20 @@
 endif()
 include(Platform/Source/PLT/${target}/config.cmake)

+execute_process(COMMAND uname -m
+                OUTPUT_VARIABLE machine)
+string(STRIP ${machine} machine)
+
 execute_process(COMMAND git log --pretty=format:%H -n 1
                 OUTPUT_VARIABLE commit)

+#-------------------------------------------------------------------------------
+# Build support
+
 add_compile_options(-DPROJ_COMMIT=\"${commit}\")
 add_compile_options(-DPROJ_VERSION=\"${version}\")
-add_compile_options(-DPROJ_MACHINE=\"?\")
+add_compile_options(-DPROJ_MACHINE=\"${machine}\")
+
 add_compile_options(-Wall)
 add_compile_options(-Werror)

@@ -66,3 +73,16 @@
             ${platform_source})

 set(platform_libs PLT ${platform_libs})
+
+#-------------------------------------------------------------------------------
+# Package support
+
+if(DEFINED pkg_source)
+   set(pkg_name ${app}_${target}_${machine}_${version}.tgz)
+
+   add_custom_command(OUTPUT  ${pkg_name}
+                      COMMAND tar cvfz ${pkg_name} ${pkg_source}
+                      DEPENDS ${pkg_source})
+
+   add_custom_target(package ALL DEPENDS ${pkg_name})
+endif()


DOC: warn user that qwt depends on qt in superbuild

--- SuperBuild/CMake/External_qwt.cmake
+++ SuperBuild/CMake/External_qwt.cmake
@@ -23,6 +23,12 @@
 SETUP_SUPERBUILD(QWT)

 # declare dependencies
+if ( NOT OTB_USE_QT )
+  message( "As Qt is a dependency of Qwt, it will be activate in the "
+    "project that will behave as if OTB_USE_QT is set to ON.\n"
+    "To disable Qt and Qwt use OTB_USE_QWT=OFF and OTB_USE_QT=OFF.")
+endif()
+
 ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(QWT QT5)

 set(QWT_SB_MAKE_PROGRAM ${CMAKE_MAKE_PROGRAM})


fixing MinGW on Travis

fixing MinGW on Travis

--- Toolchain-cross-mingw-linux.cmake
+++ Toolchain-cross-mingw-linux.cmake
@@ -8,8 +8,8 @@

 # which compilers to use for C and C++
 set(CMAKE_RC_COMPILER ${COMPILER_PREFIX}-windres)
-set(CMAKE_C_COMPILER ${COMPILER_PREFIX}-gcc-posix)
-set(CMAKE_CXX_COMPILER ${COMPILER_PREFIX}-g++-posix)
+set(CMAKE_C_COMPILER ${COMPILER_PREFIX}-gcc)
+set(CMAKE_CXX_COMPILER ${COMPILER_PREFIX}-g++)

 # the target environment is located here
 set(CMAKE_FIND_ROOT_PATH  /usr/${COMPILER_PREFIX} ) #${USER_ROOT_PATH})


Synchronize adm files

Synchronize adm files

--- adm_local_without_kernel/cmake_files/SalomeMacros.cmake
+++ adm_local_without_kernel/cmake_files/SalomeMacros.cmake
@@ -111,14 +111,12 @@
   ENDIF(NOT SALOME_INSTALL_SCRIPTS_DEF_PERMS)
   FOREACH(file ${file_list})
     SET(PREFIX "")
-    IF(IS_ABSOLUTE ${file})
-      GET_FILENAME_COMPONENT(file_name ${file} NAME)
-    ELSE()
-      SET(file_name ${file})
+    GET_FILENAME_COMPONENT(file_name ${file} NAME)
+    IF(NOT IS_ABSOLUTE ${file})
       IF(SALOME_INSTALL_SCRIPTS_WORKING_DIRECTORY)
-	SET(PREFIX "${SALOME_INSTALL_SCRIPTS_WORKING_DIRECTORY}/")
+	    SET(PREFIX "${SALOME_INSTALL_SCRIPTS_WORKING_DIRECTORY}/")
       ENDIF(SALOME_INSTALL_SCRIPTS_WORKING_DIRECTORY)
-    ENDIF(IS_ABSOLUTE ${file})
+    ENDIF(NOT IS_ABSOLUTE ${file})
     INSTALL(FILES ${PREFIX}${file} DESTINATION ${path} PERMISSIONS ${PERMS})
     GET_FILENAME_COMPONENT(ext ${file} EXT)
     IF(ext STREQUAL .py)


Make optional depedencies in graph optional

--- CommonGraph.cmake
+++ CommonGraph.cmake
@@ -12,6 +12,7 @@
 find_program(DOT_EXECUTABLE dot)
 find_program(TRED_EXECUTABLE tred)
 common_target(graphs doxygen)
+option(COMMON_GRAPH_SHOW_OPTIONAL "Include optional dependencies in graphs" OFF)

 function(common_graph_dep From To Required Source)
   string(REPLACE "-" "_" Title ${From})
@@ -21,6 +22,8 @@
     set(style "style=bold")
   elseif(Required)
     set(style "style=solid")
+  elseif(NOT COMMON_GRAPH_SHOW_OPTIONAL)
+    return()
   else()
     set(style "style=dashed")
   endif()


Add explicit license to FindLibuv.cmake

Add explicit license to FindLibuv.cmake

Was written by @joerg-krause who said it can be licensed the same as the rest.
https://github.com/luvit/luv/commit/b9012465944178a58fd32d8a90630c0fa97ca54e#commitcomment-18390894

--- cmake/Modules/FindLibuv.cmake
+++ cmake/Modules/FindLibuv.cmake
@@ -1,3 +1,18 @@
+#=============================================================================
+#  Copyright 2016 The Luvit Authors. All Rights Reserved.
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#=============================================================================
 # Locate libuv library
 # This module defines
 #  LIBUV_FOUND, if false, do not try to link to libuv


Add the arm64 Homebrew path to MySQL library detection (#102)

--- cmake/Modules/FindMySQL.cmake
+++ cmake/Modules/FindMySQL.cmake
@@ -11,10 +11,8 @@
 #  MySQL_FOUND       - True if MySQL found.

 FIND_PATH(MySQL_INCLUDE_DIR mysql.h
-  /usr/local/include/mysql
-  /usr/include/mysql
-  /usr/include/mariadb
-  /usr/local/include/mariadb
+  PATHS /opt/homebrew/include /usr/local/include /usr/include
+  PATH_SUFFIXES mysql mariadb
 )

 SET(MySQL_NAMES mysqlclient mysqlclient_r mariadbclient mariadbclient_r)
@@ -27,8 +25,8 @@
 ELSE()
   FIND_LIBRARY(MySQL_LIBRARY
     NAMES ${MySQL_NAMES}
-    PATHS /usr/lib /usr/local/lib
-    PATH_SUFFIXES mysql
+    PATHS /opt/homebrew/lib /usr/local/lib /usr/lib
+    PATH_SUFFIXES mysql mariadb
   )
   get_filename_component(MySQL_LIBRARY_DIR ${MySQL_LIBRARY} PATH)
 ENDIF()


Improve the CMake macro "cegui_find_package_handle_standard_args" so that on Windows and OS X, if only release libraries are available we'll always use them (regardless of "CMAKE_CONFIGURATION_TYPES" and "CMAKE_BUILD_TYPE"), and if only debug libraries are available we'll always use them.

--HG--
branch : mingw

--- cmake/CEGUIMacros.cmake
+++ cmake/CEGUIMacros.cmake
@@ -589,7 +589,10 @@
 #
 # NOTE: On platforms where the dependency pack is not intended to be used, the
 # extra library configurations are NOT checked, on those platforms we will use
-# the base library only.
+# the base library only. Also note that on those platforms, if only release
+# libraries are available we'll always use them (regardless of
+# "CMAKE_CONFIGURATION_TYPES" and "CMAKE_BUILD_TYPE"), and if only debug
+# libraries are available we'll always use them.
 #
 # _PKGNAME: The name of package we're checking for.
 # _LIBBASENAMEVAR: name of the library base name variable.  This name will be
@@ -622,27 +625,20 @@
             unset (_WANT_REL_LIBS)
         endif()

-        if (CEGUI_BUILD_SHARED_LIBS_WITH_STATIC_DEPENDENCIES)
-            if (_WANT_REL_LIBS)
+        if (CEGUI_BUILD_SHARED_LIBS_WITH_STATIC_DEPENDENCIES OR CEGUI_BUILD_STATIC_CONFIGURATION)
+            if ((_WANT_REL_LIBS AND ${_LIBBASENAMEVAR}_STATIC) OR NOT ${_LIBBASENAMEVAR}_STATIC_DBG)
                 list(APPEND _FPHSA_LIBS ${_LIBBASENAMEVAR}_STATIC)
             endif()
-            if (_WANT_DBG_LIBS)
+            if ((_WANT_DBG_LIBS AND ${_LIBBASENAMEVAR}_STATIC_DBG) OR NOT ${_LIBBASENAMEVAR}_STATIC)
                 list(APPEND _FPHSA_LIBS ${_LIBBASENAMEVAR}_STATIC_DBG)
             endif()
-        else()
-            if (_WANT_REL_LIBS)
+        endif ()
+        if (NOT CEGUI_BUILD_SHARED_LIBS_WITH_STATIC_DEPENDENCIES)
+            if ((_WANT_REL_LIBS AND ${_LIBBASENAMEVAR}) OR NOT ${_LIBBASENAMEVAR}_DBG)
                 list(APPEND _FPHSA_LIBS ${_LIBBASENAMEVAR})
             endif()
-            if (_WANT_DBG_LIBS)
+            if ((_WANT_DBG_LIBS AND ${_LIBBASENAMEVAR}_DBG) OR NOT ${_LIBBASENAMEVAR})
                 list(APPEND _FPHSA_LIBS ${_LIBBASENAMEVAR}_DBG)
-            endif()
-            if (CEGUI_BUILD_STATIC_CONFIGURATION)
-                if (_WANT_REL_LIBS)
-                    list(APPEND _FPHSA_LIBS ${_LIBBASENAMEVAR}_STATIC)
-                endif()
-                if (_WANT_DBG_LIBS)
-                    list(APPEND _FPHSA_LIBS ${_LIBBASENAMEVAR}_STATIC_DBG)
-                endif()
             endif()
         endif()
     else()


DOC: Add some documentation for common failure case

This commit attempts to provide better hints related to
issue #59 comments regarding compiler requirements
for compiling and linking bart

The following commands fail under mac:

export FC=/usr/bin/
CC=gcc CXX=g++ cmake -DCMAKE_Fortran_COMPILER:FILEPATH=${FC} -DLINALG_VENDOR=LAPACKE -DLAPACKE_DIR=/usr/lib/ ..
make

with linkage failure: undefined reference to symbol 'sincosf@@GLIBC_2.2.5'

--- cmake/FindLAPACKE.cmake
+++ cmake/FindLAPACKE.cmake
@@ -135,7 +135,39 @@
       ) #NOT MSVC
     set(MATH_LIB m)
   endif()
-  list(APPEND LAPACKE_LIBRARIES ${LAPACKE_LIB} ${LAPACK_LIB} ${CBLAS_LIB} ${BLAS_LIB} ${MATH_LIB})
+  list(APPEND LAPACKE_LIBRARIES ${LAPACKE_LIB} ${LAPACK_LIB} ${CBLAS_LIB} ${BLAS_LIB})
+  # Check for a common combination, and find required gfortran support libraries
+
+  if(1)
+    if("${CMAKE_C_COMPILER_ID}" MATCHES ".*Clang.*" AND "${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU")
+          message(STATUS "\n\n WARNING: ${CMAKE_C_COMPILER} identified as ${CMAKE_C_COMPILER_ID}\n"
+                                   "AND: ${CMAKE_Fortran_COMPILER} identified as ${CMAKE_Fortran_COMPILER_ID}\n"
+                               "\n"
+                               "may be require special configurations.  The most common is the need to"
+                               "explicitly link C programs against the gfortran support library.")
+
+    endif()
+  else()
+    ## This code automated code is hard to determine if it is robust in many different environments.
+    # Check for a common combination, and find required gfortran support libraries
+    if("${CMAKE_C_COMPILER_ID}" MATCHES ".*Clang.*" AND "${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU")
+       include(FortranCInterface)
+       FortranCInterface_VERIFY()
+       if(NOT FortranCInterface_VERIFIED_C)
+          message(FATAL_ERROR "C and fortran compilers are not compatible:\n${CMAKE_Fortran_COMPILER}:${CMAKE_C_COMPILER}")
+       endif()
+
+       execute_process(COMMAND ${CMAKE_Fortran_COMPILER} -print-file-name=libgfortran.a OUTPUT_VARIABLE FORTRANSUPPORTLIB ERROR_QUIET)
+       string(STRIP ${FORTRANSUPPORTLIB} FORTRANSUPPORTLIB)
+       if(EXISTS "${FORTRANSUPPORTLIB}")
+         list(APPEND LAPACKE_LIBRARIES ${FORTRANSUPPORTLIB})
+         message(STATUS "Appending fortran support lib: ${FORTRANSUPPORTLIB}")
+       else()
+         message(FATAL_ERROR "COULD NOT FIND libgfortran.a support library:${FORTRANSUPPORTLIB}:")
+       endif()
+    endif()
+  endif()
+  list(APPEND LAPACKE_LIBRARIES ${MATH_LIB})
 endif()

 mark_as_advanced(


Minor fix.

Minor fix.

--HG--
branch : v0-8

--- cmake/FindLibXml2.cmake
+++ cmake/FindLibXml2.cmake
@@ -65,7 +65,7 @@

 # handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if
 # all listed variables are TRUE
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(FindPackageHandleStandardArgs)
 FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2
                                   REQUIRED_VARS LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR
                                   VERSION_VAR LIBXML2_VERSION_STRING)


Fix: oups missed with the last commit

Fix: oups missed with the last commit

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

--- cmake/pcl_options.cmake
+++ cmake/pcl_options.cmake
@@ -1,5 +1,9 @@
 # Options for building PCL.

 # Build shared libraries by default.
-option(PCL_SHARED_LIBS "Build shared libraries." ON)
+if(WIN32)
+	option(PCL_SHARED_LIBS "Build shared libraries." OFF)
+else(WIN32)
+	option(PCL_SHARED_LIBS "Build shared libraries." ON)
+endif(WIN32)
 mark_as_advanced(PCL_SHARED_LIBS)


Set additional CPACK variables for RPM generator

Sets the following when querying the generated RPM's info:

Group       : System Environment/Libraries
License     : MIT
URL         : https://github.com/gabime/spdlog
Summary     : Fast C++ logging library
Description :
Very fast, header-only/compiled, C++ logging library.

--- cmake/spdlogCPack.cmake
+++ cmake/spdlogCPack.cmake
@@ -14,6 +14,7 @@
 set(CPACK_PROJECT_URL "https://github.com/gabime/spdlog")
 set(CPACK_PACKAGE_VENDOR "Gabi Melman")
 set(CPACK_PACKAGE_CONTACT "Gabi Melman <gmelman1@gmail.com>")
+set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Fast C++ logging library")
 set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
 set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
 set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
@@ -23,4 +24,9 @@
 endif ()
 set(CPACK_PACKAGE_RELOCATABLE ON)

+set(CPACK_RPM_PACKAGE_LICENSE "MIT")
+set(CPACK_RPM_PACKAGE_GROUP "System Environment/Libraries")
+set(CPACK_RPM_PACKAGE_URL ${CPACK_PROJECT_URL})
+set(CPACK_RPM_PACKAGE_DESCRIPTION "Very fast, header-only/compiled, C++ logging library.")
+
 include(CPack)


update basholeveldb hash - snappy static lib fix

--- basholeveldb.cmake
+++ basholeveldb.cmake
@@ -13,7 +13,7 @@
 external_source (basholeveldb
     2.0.29
     basholeveldb-2.0.29.tar.gz
-    e627778ef3a90b9906a560a81d4c9fbd)
+    50f75a652337111a9cd67e6f4d95f9e1)

 message ("Installing ${basholeveldb_NAME} into FlyEM build area: ${BUILDEM_DIR} ...")
 if (${APPLE})


Update psutil to fix https://github.com/ilastik/ilastik/issues/891

--- psutil.cmake
+++ psutil.cmake
@@ -13,10 +13,12 @@
 include (python)

 external_source (psutil
-    0.6.1
-    psutil-0.6.1.tar.gz
-    3cfcbfb8525f6e4c70110e44a85e907e
-    http://psutil.googlecode.com/files)
+	2.1.1
+	psutil-2.1.1.tar.gz
+	72a6b15d589fab11f6ca245b775bc3c6
+	https://pypi.python.org/packages/source/p/psutil
+	FORCE
+)

 message ("Installing ${psutil_NAME} into FlyEM build area: ${BUILDEM_DIR} ...")
 ExternalProject_Add(${psutil_NAME}


Fixed Poco CMAKE_DEBUG_POSTFIX handling.

This enables correct Visual Studio built type handling and batch builds.

--- CMakeExternals/PatchPoco-1.5.2-rc3.cmake
+++ CMakeExternals/PatchPoco-1.5.2-rc3.cmake
@@ -1,7 +1,29 @@
 # Called by Poco.cmake (ExternalProject_Add) as a patch for Poco.
-# Adds #define TIXML_USE_STL to enable STL string support
+# Fixes the CMake build system

-# read whole file
+# read CMakeLists.txt
+file(STRINGS CMakeLists.txt sourceCode NEWLINE_CONSUME)
+
+# Fix CMAKE_DEBUG_POSTFIX, see see https://github.com/pocoproject/poco/issues/279
+string(REPLACE
+"if (CMAKE_BUILD_TYPE STREQUAL \"Debug\")
+  message(STATUS \"Debug output enabled\")
+  set(CMAKE_DEBUG_POSTFIX \"d\" CACHE STRING \"Set debug library postfix\" FORCE)
+else ()
+  message(STATUS \"Optimized output enabled\")
+  set(CMAKE_DEBUG_POSTFIX \"\" CACHE STRING \"Set debug library postfix\" FORCE)
+endif ()"
+       "set(CMAKE_DEBUG_POSTFIX \"d\")"
+       sourceCode ${sourceCode}
+      )
+
+# set variable CONTENTS, which is substituted in TEMPLATE_FILE
+set(CONTENTS ${sourceCode})
+configure_file(${CMAKE_CURRENT_LIST_DIR}/EmptyFileForPatching.dummy CMakeLists.txt @ONLY)
+
+# For the next fixes, see https://github.com/pocoproject/poco/issues/274
+
+# read whole Foundation/CMakeLists.txt
 file(STRINGS Foundation/CMakeLists.txt sourceCode NEWLINE_CONSUME)

 # Remove files


* changed installation directory for headers to subdirectory citygml in install/include directory

--- CMakeModules/ModuleInstall.cmake
+++ CMakeModules/ModuleInstall.cmake
@@ -31,5 +31,5 @@
 # FIXME: Do not run for OS X framework
 INSTALL(
     FILES        ${LIB_PUBLIC_HEADERS}
-    DESTINATION ${INSTALL_INCDIR}
+    DESTINATION ${INSTALL_INCDIR}/${LIB_NAME}
 )


[cmake] tentative fix for timeout setting

--- numerics/numerics_tests.cmake
+++ numerics/numerics_tests.cmake
@@ -220,8 +220,7 @@

   # Oliverie
   IF(NOT DEV_MODE)
-   SET(NCP_NEWTON_FBLSA-NCP_ZI1_PROPERTIES WILL_FAIL TRUE)
-   set_tests_properties(NCP_NEWTON_FBLSA-NCP_ZI1 PROPERTIES TIMEOUT 60)
+   SET(NCP_NEWTON_FBLSA-NCP_ZI1_PROPERTIES WILL_FAIL TRUE TIMEOUT 60)
   ENDIF(NOT DEV_MODE)

   END_TEST() # NCP


[numerics] modify tolerances to avoid timeout in debug mode

--- numerics/numerics_tests.cmake
+++ numerics/numerics_tests.cmake
@@ -568,9 +568,9 @@
     INTERNAL_IPARAM SICONOS_FRICTION_3D_NSN_HYBRID_STRATEGY SICONOS_FRICTION_3D_NSN_HYBRID_STRATEGY_PLI_NSN_LOOP
     WILL_FAIL)

-  NEW_FC_3D_TEST(KaplasTower-i1061-4.hdf5.dat SICONOS_FRICTION_3D_NSN_AC 1e-2 1000)
-  NEW_FC_3D_TEST(KaplasTower-i1061-4.hdf5.dat SICONOS_FRICTION_3D_NSN_FB 1e-3 1000)
-  NEW_FC_3D_TEST(KaplasTower-i1061-4.hdf5.dat SICONOS_FRICTION_3D_NSN_NM 1e-3 1000)
+  NEW_FC_3D_TEST(KaplasTower-i1061-4.hdf5.dat SICONOS_FRICTION_3D_NSN_AC 5e-2 1000)
+  NEW_FC_3D_TEST(KaplasTower-i1061-4.hdf5.dat SICONOS_FRICTION_3D_NSN_FB 5e-2 1000)
+  NEW_FC_3D_TEST(KaplasTower-i1061-4.hdf5.dat SICONOS_FRICTION_3D_NSN_NM 5e-2 1000)

   NEW_FC_3D_TEST(KaplasTower-i1061-4.hdf5.dat
     SICONOS_FRICTION_3D_PROX  1e-3 10
@@ -732,7 +732,7 @@
   NEW_GFC_3D_TEST(problem-checkTwoRods1.dat SICONOS_GLOBAL_FRICTION_3D_NSN_AC_WR 0 0
     0 0 0
     INTERNAL_IPARAM 0 1000
-    INTERNAL_DPARAM 0 1e-5)
+    INTERNAL_DPARAM 0 1e-10)
   NEW_GFC_3D_TEST(problem-checkTwoRods1.dat SICONOS_GLOBAL_FRICTION_3D_NSGS)
   NEW_TEST(gfc3d_NSGS_WR_ONECONTACT_NSN_AC_GP_problem-checkTwoRods1 gfc3d_test15.c)
   NEW_GFC_3D_TEST(problem-check.dat SICONOS_GLOBAL_FRICTION_3D_NSN_AC)


ask cmake for per-configuration output subdir

On single-configuration build systems as Makefile Generators, there is
no subdirectory for the configuration in the build tree - therefore ask
cmake for the subdir by using CMAKE_CFG_INTDIR, which is just '.' on
single-configuration build systems (Linux et al.).

--- googletest/cmake/internal_utils.cmake
+++ googletest/cmake/internal_utils.cmake
@@ -245,7 +245,7 @@
       add_test(
         NAME ${name}
         COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py
-            --build_dir=${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>)
+            --build_dir=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR})
     else (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.1)
       add_test(
         ${name}


[INTERNAL] scan for dependencies only once iff DEVELOP

--- util/cmake/SeqAnBuildSystem.cmake
+++ util/cmake/SeqAnBuildSystem.cmake
@@ -253,6 +253,13 @@
         set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
     endif ()

+    if (SEQAN_BUILD_SYSTEM STREQUAL "DEVELOP")
+        message (STATUS "Scanning dependencies once in DEVELOP mode...")
+        find_package(OpenMP)
+        find_package(ZLIB)
+        find_package(BZip2)
+        find_package(SeqAn REQUIRED)
+    endif ()
 endmacro (seqan_build_system_init)

 # ---------------------------------------------------------------------------
@@ -649,11 +656,8 @@
           ${CMAKE_CURRENT_SOURCE_DIR}/[!.]*.cpp
           ${CMAKE_CURRENT_SOURCE_DIR}/[!.]*.cu)

-    # Find SeqAn with all dependencies.
-    find_package (OpenMP)
-    find_package (ZLIB)
-    find_package (BZip2)
-    find_package (SeqAn REQUIRED)
+    # NOTE(h-2): we do not need to search for dependencies, because this is
+    # done globally for DEVELOP (and demos are only built with DEVELOP)

     if (OPENMP_FOUND AND CMAKE_COMPILER_IS_GNUCXX)
         set(SEQAN_LIBRARIES ${SEQAN_LIBRARIES} -lgomp)


dsdsd

dsdsd

--- cmake/modules/BuildFlatbuffers.cmake
+++ cmake/modules/BuildFlatbuffers.cmake
@@ -24,7 +24,6 @@
     GIT_TAG 3c54fd964b6beae9a92955415568a001c9cea23d
     CMAKE_ARGS -G ${CMAKE_GENERATOR} -DCMAKE_BUILD_TYPE=Release -DFLATBUFFERS_BUILD_TESTS=OFF -DFLATBUFFERS_BUILD_FLATHASH=OFF -DFLATBUFFERS_BUILD_FLATLIB=OFF -DFLATBUFFERS_BUILD_FLATHASH=OFF -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
     INSTALL_DIR ${FLATBUFFERS_INSTALL_DIR}
-    BUILD_IN_SOURCE TRUE
   )
 endif()

@@ -36,4 +35,9 @@
 set(FLATBUFFERS_INCLUDE_DIR "${install_dir}/include")
 set(FLATBUFFERS_EXEC "${install_dir}/bin/flatc")

-mark_as_advanced(FLATBUFFERS_INCLUDE_DIR)
+if(NOT TARGET FLATBUFFERS::FLATBUFFERS)
+    add_library(FLATBUFFERS::FLATBUFFERS INTERFACE IMPORTED)
+    add_dependencies(FLATBUFFERS::FLATBUFFERS flatbuffers)
+    set_target_properties(FLATBUFFERS::FLATBUFFERS PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${FLATBUFFERSL_INCLUDE_DIRS}")
+    set_target_properties(FLATBUFFERS::FLATBUFFERS PROPERTIES INTERFACE_LINK_LIBRARIES "${FLATBUFFERS_EXEC}")
+endif()


use dmpriso2

use dmpriso2

--- cmake/projects/Libevent/hunter.cmake
+++ cmake/projects/Libevent/hunter.cmake
@@ -9,8 +9,8 @@
 hunter_add_version(
     PACKAGE_NAME Libevent
     VERSION "2.1.9"
-    URL "https://github.com/dmpriso/libevent/archive/dmpriso1.tar.gz"
-    SHA1 "F5462FD61FC9F31D3BBBD29392CE137E2839711B")
+    URL "https://github.com/dmpriso/libevent/archive/dmpriso2.tar.gz"
+    SHA1 "4D8B47B8AE2F754D47FBA43AFC1BC048D1673CF3")
 hunter_cmake_args(Libevent CMAKE_ARGS
                   EVENT__DISABLE_TESTS=ON
                   EVENT__DISABLE_SAMPLES=ON


Applied global replace to floating point macro

--- build/macros.cmake
+++ build/macros.cmake
@@ -290,17 +290,9 @@
 macro(enable_fast_floating_point _enable)
 	get_compiler_name(COMPILER)
 	if(${_enable})
-		if(COMPILER MATCHES "vc")
-			set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:fast")
-		elseif(COMPILER MATCHES "gcc")
-			set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffast-math")
-		else()
-			message(FATAL_ERROR "Error: Only MSVC and GCC supported")
-		endif()
-	else()
-		if(COMPILER MATCHES "vc")
-			set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:precise")
-		endif()
+		replace_or_append_all_flag_compilers("/fp:[fast|precise]" "-ffast-math" "/fp:fast" "-ffast-math")
+	else()
+		replace_or_append_all_flag_compilers("/fp:[fast|precise]" "-ffast-math" "/fp:precise" "")
 	endif()
 endmacro()


Fix path for Xv.h in cmake.

Fix path for Xv.h in cmake.


Fixed relative path for po includes

Fixed relative path for po includes

--- cmake/Macros.cmake
+++ cmake/Macros.cmake
@@ -119,7 +119,7 @@

 ### Macro for add process objects
 macro(fast_add_process_object NAME HEADERFILE)
-    file (RELATIVE_PATH _relPath "${PROJECT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
+    file (RELATIVE_PATH _relPath "${PROJECT_SOURCE_DIR}/source/" "${CMAKE_CURRENT_SOURCE_DIR}")
     list(APPEND FAST_PROCESS_OBJECT_NAMES ${NAME})
     if(_relPath)
         list(APPEND FAST_PROCESS_OBJECT_HEADER_FILES ${_relPath}/${HEADERFILE})


Some minor comments.

Some minor comments.

--- cmake/common.cmake
+++ cmake/common.cmake
@@ -428,7 +428,7 @@
                                                             ${CMAKE_BINARY_DIR}/${PLUGIN_FILENAME})
     ENDIF()

-    # A few OS X specific things
+    # A few things specific to OS X

     IF(APPLE)
         # Clean up our plugin's id
@@ -471,8 +471,8 @@
                                                                  ${MAC_OS_X_PROJECT_BINARY_DIR}/Contents/PlugIns/${MAIN_PROJECT_NAME}/${PLUGIN_FILENAME})
         ENDFOREACH()

-        # Make sure that the plugin refers to our embedded version of the
-        # external dependencies on which it depends
+        # Make sure that the plugin refers to our embedded version of its
+        # external dependencies
         # Note #1: we do it in two different ways, since some external libraries
         #          we use refer to the library itself (e.g. CellML) while others
         #          refer to some @executable_path information (e.g. LLVM), so...
@@ -702,7 +702,7 @@
                       COMMAND ${CMAKE_COMMAND} -E copy ${PLUGIN_BINARY_DIR}/${PLUGIN_FILENAME}
                                                        ${CMAKE_BINARY_DIR}/${PLUGIN_FILENAME})

-    # A few OS X specific things
+    # A few things specific to OS X

     IF(APPLE)
         # Make sure that the copy of our plugin in our main build directory


these messages should be FATAL

these messages should be FATAL

--- FindICU.cmake
+++ FindICU.cmake
@@ -139,7 +139,7 @@
     elseif(EXISTS "${${ICU_PUBLIC_VAR_NS}_INCLUDE_DIRS}/utypes.h") # ICU 1.3
         file(READ "${${ICU_PUBLIC_VAR_NS}_INCLUDE_DIRS}/utypes.h" ${ICU_PRIVATE_VAR_NS}_VERSION_HEADER_CONTENTS)
     else()
-        message("ICU version header not found")
+        message(FATAL_ERROR "ICU version header not found")
     endif()

     if(${ICU_PRIVATE_VAR_NS}_VERSION_HEADER_CONTENTS MATCHES ".*# *define *ICU_VERSION *\"([0-9]+)\".*") # ICU 1.3
@@ -175,7 +175,7 @@
             set(${ICU_PUBLIC_VAR_NS}_PATCH_VERSION "${CMAKE_MATCH_3}")
         endif()
     else()
-        message("failed to detect ICU version")
+        message(FATAL_ERROR "failed to detect ICU version")
     endif()
     set(${ICU_PUBLIC_VAR_NS}_VERSION "${${ICU_PUBLIC_VAR_NS}_MAJOR_VERSION}.${${ICU_PUBLIC_VAR_NS}_MINOR_VERSION}.${${ICU_PUBLIC_VAR_NS}_PATCH_VERSION}")
     ########## </part to keep synced with tests/version/CMakeLists.txt> ##########


ENH: Remove unnecessary CMake code

ENH: Remove unnecessary CMake code


WIP:  Ubuntu Build

WIP:  Ubuntu Build

--- cmake/Modules/FindEXPAT.cmake
+++ cmake/Modules/FindEXPAT.cmake
@@ -1,19 +0,0 @@
-# - Try to find EXPAT
-# Once done this will define
-#  EXPAT_FOUND - System has EXPAT
-#  EXPAT_INCLUDE_DIRS - The EXPAT include directories
-#  EXPAT_LIBRARIES - The libraries needed to use EXPAT
-#  EXPAT_DEFINITIONS - Compiler switches required for using EXPAT
-
-find_path(EXPAT_INCLUDE_DIR lib/expat.h
-          HINTS ${EXPAT_ROOT} )
-
-set(EXPAT_INCLUDE_DIRS ${EXPAT_INCLUDE_DIR} )
-
-include(FindPackageHandleStandardArgs)
-# handle the QUIETLY and REQUIRED arguments and set EXPAT_FOUND to TRUE
-# if all listed variables are TRUE
-find_package_handle_standard_args(EXPAT DEFAULT_MSG
-                                  EXPAT_INCLUDE_DIR)
-
-mark_as_advanced( EXPAT_INCLUDE_DIR )


Find Iconv: Reformat CMake code

Find Iconv: Reformat CMake code

--- cmake/Modules/FindIconv.cmake
+++ cmake/Modules/FindIconv.cmake
@@ -1,18 +1,18 @@
-#
+# ~~~
 #  Copyright (c) 2006, Peter Kümmel, <syntheticpp@gmx.net>
 #
 #  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 copyright
 #     notice, this list of conditions and the following disclaimer.
 #  2. Redistributions in binary form must reproduce the copyright
 #     notice, this list of conditions and the following disclaimer in the
 #     documentation and/or other materials provided with the distribution.
-#  3. The name of the author may not be used to endorse or promote products
+#  3. The name of the author may not be used to endorse or promote products
 #     derived from this software without specific prior written permission.
-#
+#
 #  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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.
@@ -23,78 +23,65 @@
 #  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.
-#
+# ~~~

-include(CheckFunctionExists)
+include (CheckFunctionExists)

 if (ICONV_INCLUDE_DIR)
-	set(ICONV_FIND_QUIETLY TRUE)
-endif()
+	set (ICONV_FIND_QUIETLY TRUE)
+endif ()

-find_path(ICONV_INCLUDE_DIR iconv.h
-	PATHS /usr/include /usr/local/include /opt/local/include /sw/include
-)
+find_path (ICONV_INCLUDE_DIR iconv.h PATHS /usr/include /usr/local/include /opt/local/include /sw/include)

-set(POTENTIAL_ICONV_LIBS iconv libiconv libiconv2)
+set (POTENTIAL_ICONV_LIBS iconv libiconv libiconv2)

-find_library(ICONV_LIBRARY
-	NAMES ${POTENTIAL_ICONV_LIBS}
-	PATHS /usr/lib /usr/local/lib /opt/local/lib /sw/lib
-)
+find_library (ICONV_LIBRARY NAMES ${POTENTIAL_ICONV_LIBS} PATHS /usr/lib /usr/local/lib /opt/local/lib /sw/lib)

-if(WIN32)
-	set(ICONV_DLL_NAMES iconv.dll  libiconv.dll libiconv2.dll)
-	find_file(ICONV_DLL
-					NAMES ${ICONV_DLL_NAMES}
-					PATHS ENV PATH
-					NO_DEFAULT_PATH)
-	find_file(ICONV_DLL_HELP
-					NAMES ${ICONV_DLL_NAMES}
-					PATHS ENV PATH
-					${ICONV_INCLUDE_DIR}/../bin)
-	if(ICONV_FIND_REQUIRED)
-		if(NOT ICONV_DLL AND NOT ICONV_DLL_HELP)
-			message(FATAL_ERROR "Could not find iconv.dll, please add correct your PATH environment variable")
-		endif()
-		if(NOT ICONV_DLL AND ICONV_DLL_HELP)
-			get_filename_component(ICONV_DLL_HELP ${ICONV_DLL_HELP} PATH)
-			message(STATUS)
-			message(STATUS "Could not find iconv.dll in standard search path, please add ")
-			message(STATUS "${ICONV_DLL_HELP}")
-			message(STATUS "to your PATH environment variable.")
-			message(STATUS)
-			message(FATAL_ERROR "exit cmake")
-		endif()
-	endif()
-	if(ICONV_INCLUDE_DIR AND ICONV_LIBRARY AND ICONV_DLL)
-   		set(ICONV_FOUND TRUE)
-	endif()
-else()
-	check_function_exists(iconv HAVE_ICONV_IN_LIBC)
-	if(ICONV_INCLUDE_DIR AND HAVE_ICONV_IN_LIBC)
-   		set(ICONV_FOUND TRUE)
-		set(ICONV_LIBRARY  CACHE TYPE STRING FORCE)
-	endif()
-	if(ICONV_INCLUDE_DIR AND ICONV_LIBRARY)
-   		set(ICONV_FOUND TRUE)
-   		set(ICONV_LIBRARIES ${ICONV_LIBRARY})
-	endif()
-endif()
+if (WIN32)
+	set (ICONV_DLL_NAMES iconv.dll libiconv.dll libiconv2.dll)
+	find_file (ICONV_DLL NAMES ${ICONV_DLL_NAMES} PATHS ENV PATH NO_DEFAULT_PATH)
+	find_file (ICONV_DLL_HELP NAMES ${ICONV_DLL_NAMES} PATHS ENV PATH ${ICONV_INCLUDE_DIR}/../bin)
+	if (ICONV_FIND_REQUIRED)
+		if (NOT ICONV_DLL AND NOT ICONV_DLL_HELP)
+			message (FATAL_ERROR "Could not find iconv.dll, please add correct your PATH environment variable")
+		endif ()
+		if (NOT ICONV_DLL AND ICONV_DLL_HELP)
+			get_filename_component (ICONV_DLL_HELP ${ICONV_DLL_HELP} PATH)
+			message (STATUS)
+			message (STATUS "Could not find iconv.dll in standard search path, please add ")
+			message (STATUS "${ICONV_DLL_HELP}")
+			message (STATUS "to your PATH environment variable.")
+			message (STATUS)
+			message (FATAL_ERROR "exit cmake")
+		endif ()
+	endif ()
+	if (ICONV_INCLUDE_DIR AND ICONV_LIBRARY AND ICONV_DLL)
+		set (ICONV_FOUND TRUE)
+	endif ()
+else ()
+	check_function_exists (iconv HAVE_ICONV_IN_LIBC)
+	if (ICONV_INCLUDE_DIR AND HAVE_ICONV_IN_LIBC)
+		set (ICONV_FOUND TRUE)
+		set (ICONV_LIBRARY CACHE TYPE STRING FORCE)
+	endif ()
+	if (ICONV_INCLUDE_DIR AND ICONV_LIBRARY)
+		set (ICONV_FOUND TRUE)
+		set (ICONV_LIBRARIES ${ICONV_LIBRARY})
+	endif ()
+endif ()

+if (ICONV_FOUND)
+	if (NOT ICONV_FIND_QUIETLY)
+		message (STATUS "Found iconv library: ${ICONV_LIBRARY}") # message(STATUS "Found iconv   dll  : ${ICONV_DLL}")
+	endif ()
+else ()
+	if (ICONV_FIND_REQUIRED)
+		message (STATUS "Looked for iconv library named ${POTENTIAL_ICONV_LIBS}.")
+		message (STATUS "Found no acceptable iconv library. This is fatal.")
+		message (STATUS "iconv header: ${ICONV_INCLUDE_DIR}")
+		message (STATUS "iconv lib   : ${ICONV_LIBRARY}")
+		message (FATAL_ERROR "Could NOT find iconv library")
+	endif ()
+endif ()

-if(ICONV_FOUND)
-   if(NOT ICONV_FIND_QUIETLY)
-      message(STATUS "Found iconv library: ${ICONV_LIBRARY}")
-      #message(STATUS "Found iconv   dll  : ${ICONV_DLL}")
-   endif()
-else()
-   if(ICONV_FIND_REQUIRED)
-      message(STATUS "Looked for iconv library named ${POTENTIAL_ICONV_LIBS}.")
-      message(STATUS "Found no acceptable iconv library. This is fatal.")
-      message(STATUS "iconv header: ${ICONV_INCLUDE_DIR}")
-      message(STATUS "iconv lib   : ${ICONV_LIBRARY}")
-      message(FATAL_ERROR "Could NOT find iconv library")
-   endif()
-endif()
-
-mark_as_advanced(ICONV_LIBRARY ICONV_INCLUDE_DIR)
+mark_as_advanced (ICONV_LIBRARY ICONV_INCLUDE_DIR)


Checking user input in case qhull is not found by cmake

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

--- cmake/Modules/FindQhull.cmake
+++ cmake/Modules/FindQhull.cmake
@@ -9,25 +9,29 @@

 set(QHULL_MAJOR_VERSION 6)

-find_path(QHULL_INCLUDE_DIR_PRE2011
-          NAMES qhull.h
-          HINTS "${QHULL_ROOT}" "$ENV{QHULL_ROOT}"
+find_file(QHULL_HEADER
+          NAMES libqhull/libqhull.h qhull.h
+          HINTS "${QHULL_ROOT}" "$ENV{QHULL_ROOT}" "${QHULL_INCLUDE_DIR}"
           PATHS "$ENV{PROGRAMFILES}/qhull 6.2.0.1373" "$ENV{PROGRAMW6432}/qhull 6.2.0.1373"
           PATH_SUFFIXES qhull src/libqhull libqhull include)

-find_path(QHULL_INCLUDE_DIR_2011
-          NAMES libqhull/libqhull.h
-          HINTS "${QHULL_ROOT}" "$ENV{QHULL_ROOT}"
-          PATHS "$ENV{PROGRAMFILES}/qhull 6.2.0.1373" "$ENV{PROGRAMW6432}/qhull 6.2.0.1373"
-          PATH_SUFFIXES qhull src/libqhull libqhull include)
+set(QHULL_HEADER "${QHULL_HEADER}" CACHE INTERNAL "QHull header" FORCE )

-if(QHULL_INCLUDE_DIR_PRE2011)
-   set(HAVE_QHULL_2011 OFF)
-   set(QHULL_INCLUDE_DIR "${QHULL_INCLUDE_DIR_PRE2011}")
-elseif(QHULL_INCLUDE_DIR_2011)
-   set(HAVE_QHULL_2011 ON)
-   set(QHULL_INCLUDE_DIR "${QHULL_INCLUDE_DIR_2011}")
-endif()
+if(QHULL_HEADER)
+    get_filename_component(qhull_header ${QHULL_HEADER} NAME_WE)
+    if("${qhull_header}" STREQUAL "qhull")
+        set(HAVE_QHULL_2011 OFF)
+        get_filename_component(QHULL_INCLUDE_DIR ${QHULL_HEADER} PATH)
+    elseif("${qhull_header}" STREQUAL "libqhull")
+        set(HAVE_QHULL_2011 ON)
+        get_filename_component(QHULL_INCLUDE_DIR ${QHULL_HEADER} PATH)
+        get_filename_component(QHULL_INCLUDE_DIR ${QHULL_INCLUDE_DIR} PATH)
+    endif()
+else(QHULL_HEADER)
+    set(QHULL_INCLUDE_DIR "QHULL_INCLUDE_DIR-NOTFOUND")
+endif(QHULL_HEADER)
+
+set(QHULL_INCLUDE_DIR "${QHULL_INCLUDE_DIR}" CACHE PATH "QHull include dir." FORCE)

 # Prefer static libraries in Windows over shared ones
 if(WIN32)


Backup.

Backup.

--- cmake_modules/LPSCommon.cmake
+++ cmake_modules/LPSCommon.cmake
@@ -650,6 +650,12 @@
             "set(HDF_INCLUDE_DIR ${HDF5_INCLUDE_DIRS} CACHE STRING \"HDF5 Include Path \")\n")
         file(APPEND ${CMAKE_BINARY_DIR}/${EXPORTS_FILE} "\n")
     endif()
+
+    if("${COMPONENT}" MATCHES "GEOMETRY")
+        file(APPEND ${CMAKE_BINARY_DIR}/${EXPORTS_FILE}
+            "set(TETGEN_INCLUDE_DIR ${TETGEN_INC_DIR} CACHE STRING \"Tetgen Include Path \")\n")
+    endif()
+
     if("${COMPONENT}" MATCHES "TOOLS")
         file(APPEND ${CMAKE_BINARY_DIR}/${EXPORTS_FILE} "\n")
         file(APPEND ${CMAKE_BINARY_DIR}/${EXPORTS_FILE}
@@ -666,6 +672,7 @@
         file(APPEND ${CMAKE_BINARY_DIR}/${EXPORTS_FILE} "\n")
         file(APPEND ${CMAKE_BINARY_DIR}/${EXPORTS_FILE}
             "set(VTK_LIBS ${VTK_LIBS} CACHE STRING \"VTK Libraries\")\n")
+        file(APPEND ${CMAKE_BINARY_DIR}/${EXPORTS_FILE} "\n")
         file(APPEND ${CMAKE_BINARY_DIR}/${EXPORTS_FILE} "\n")
         file(APPEND ${CMAKE_BINARY_DIR}/${EXPORTS_FILE} "\n")
         file(APPEND ${CMAKE_BINARY_DIR}/${INSTALL_CONFIG_FILE}


detect and support AMD Piledriver CPUs

detect and support AMD Piledriver CPUs

--- cmake/OptimizeForArchitecture.cmake
+++ cmake/OptimizeForArchitecture.cmake
@@ -116,7 +116,11 @@
       endif(_cpu_family EQUAL 6)
    elseif(_vendor_id STREQUAL "AuthenticAMD")
       if(_cpu_family EQUAL 21) # 15h
-         set(TARGET_ARCHITECTURE "bulldozer")
+         if(_cpu_model LESS 2)
+            set(TARGET_ARCHITECTURE "bulldozer")
+         else()
+            set(TARGET_ARCHITECTURE "piledriver")
+         endif()
       elseif(_cpu_family EQUAL 20) # 14h
       elseif(_cpu_family EQUAL 18) # 12h
       elseif(_cpu_family EQUAL 16) # 10h
@@ -131,7 +135,7 @@
 endmacro()

 macro(OptimizeForArchitecture)
-   set(TARGET_ARCHITECTURE "auto" CACHE STRING "CPU architecture to optimize for. Using an incorrect setting here can result in crashes of the resulting binary because of invalid instructions used.\nSetting the value to \"auto\" will try to optimize for the architecture where cmake is called.\nOther supported values are: \"none\", \"generic\", \"core\", \"merom\" (65nm Core2), \"penryn\" (45nm Core2), \"nehalem\", \"westmere\", \"sandy-bridge\", \"ivy-bridge\", \"atom\", \"k8\", \"k8-sse3\", \"barcelona\", \"istanbul\", \"magny-cours\", \"bulldozer\", \"interlagos\".")
+   set(TARGET_ARCHITECTURE "auto" CACHE STRING "CPU architecture to optimize for. Using an incorrect setting here can result in crashes of the resulting binary because of invalid instructions used.\nSetting the value to \"auto\" will try to optimize for the architecture where cmake is called.\nOther supported values are: \"none\", \"generic\", \"core\", \"merom\" (65nm Core2), \"penryn\" (45nm Core2), \"nehalem\", \"westmere\", \"sandy-bridge\", \"ivy-bridge\", \"atom\", \"k8\", \"k8-sse3\", \"barcelona\", \"istanbul\", \"magny-cours\", \"bulldozer\", \"interlagos\", \"piledriver\".")
    set(_force)
    if(NOT _last_target_arch STREQUAL "${TARGET_ARCHITECTURE}")
       message(STATUS "target changed from \"${_last_target_arch}\" to \"${TARGET_ARCHITECTURE}\"")
@@ -198,6 +202,13 @@
       list(APPEND _march_flag_list "k8-sse3")
       list(APPEND _march_flag_list "k8")
       list(APPEND _available_vector_units_list "sse" "sse2" "sse3")
+   elseif(TARGET_ARCHITECTURE STREQUAL "piledriver")
+      list(APPEND _march_flag_list "bdver2")
+      list(APPEND _march_flag_list "bdver1")
+      list(APPEND _march_flag_list "bulldozer")
+      list(APPEND _march_flag_list "barcelona")
+      list(APPEND _march_flag_list "core2")
+      list(APPEND _available_vector_units_list "sse" "sse2" "sse3" "ssse3" "sse4a" "sse4.1" "sse4.2" "avx" "xop" "fma4" "fma" "f16c")
    elseif(TARGET_ARCHITECTURE STREQUAL "interlagos")
       list(APPEND _march_flag_list "bdver1")
       list(APPEND _march_flag_list "bulldozer")


Little change in checking c++11

Little change in checking c++11

--- cmake/dev/check_configuration.cmake
+++ cmake/dev/check_configuration.cmake
@@ -2,8 +2,7 @@
     # Check C++11
     include(CheckCXXCompilerFlag)
     if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANG OR
-        (APPLE AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")
-        )
+        CMAKE_CXX_COMPILER_ID MATCHES "Clang")
         check_cxx_compiler_flag(--std=c++11 SUPPORTS_CXX11)
         if(SUPPORTS_CXX11)
             add_compile_options(--std=c++11)


let the library VERSION = the project's one (issue #490)

This is a cross-platform usability improvement.
On Unix platforms it is customary for library to have VERSION
and SOVERSION, where SOVERSION changes on major API changes
and VERSION is the same as project's version, so library users
always know what vesion this library belongs to just by name.
With this patch we have a proper libmimalloc.so.VERSION on Unix.

--- cmake/mimalloc-config-version.cmake
+++ cmake/mimalloc-config-version.cmake
@@ -1,6 +1,7 @@
 set(mi_version_major 1)
 set(mi_version_minor 7)
-set(mi_version ${mi_version_major}.${mi_version_minor})
+set(mi_version_patch 3)
+set(mi_version ${mi_version_major}.${mi_version_minor}.${mi_version_patch})

 set(PACKAGE_VERSION ${mi_version})
 if(PACKAGE_FIND_VERSION_MAJOR)


Remove obsolete file WriteConfigCint.cmake

--- cmake/modules/WriteConfigCint.cmake
+++ cmake/modules/WriteConfigCint.cmake
@@ -1,105 +0,0 @@
-# Creates the file configcint.h and write configuration
-# Don't know why this is needed
-# TODO: Change file that it works with WINDOWS
-function(WRITE_CONFIG_CINT file)
-  write_file(${file} "/* Generated by WriteConfigCint.cmake*/")
-  if(UNIX)
-    write_file(${file} "#define G__CFG_ARCH \"${ROOT_ARCHITECTURE}\"" APPEND)
-    if(ROOT_PLATFORM MATCHES macosx)
-       write_file(${file} "#define G__CFG_IMPLIBEXT \".dylib\"" APPEND)
-    else()
-       write_file(${file} "#define G__CFG_IMPLIBEXT \".a\"" APPEND)
-    endif()
-    write_file(${file} "#define G__CFG_LDOUT \"-o \"" APPEND)
-    write_file(${file} "#define G__CFG_LIBL \"-l@imp@\"" APPEND)
-    write_file(${file} "#define G__CFG_LIBEXT \".a\"" APPEND)
-    write_file(${file} "#define G__CFG_MANGLEPATHS \"echo \"" APPEND)
-    write_file(${file} "#define G__CFG_PLATFORMO \"\"" APPEND)
-    write_file(${file} "#define G__CFG_AR \"ar qcs\"" APPEND)
-    write_file(${file} "#define G__CFG_COREVERSION \"${ROOT_DICTTYPE}\" " APPEND)
-    write_file(${file} "#define G__CFG_CC \"${CMAKE_C_COMPILER}\"" APPEND)
-    write_file(${file} "#define G__CFG_CFLAGS \"${CMAKE_C_FLAGS} ${CINT_C_DEFINITIONS} -I${CMAKE_BINARY_DIR}/include\" " APPEND)
-    write_file(${file} "#define G__CFG_CMACROS \"${CINT_C_DEFINITIONS}\" " APPEND)
-    write_file(${file} "#define G__CFG_COMP \"-c \"" APPEND)
-    write_file(${file} "#define G__CFG_CPP \"${CPPPREP}\"" APPEND)
-    write_file(${file} "#define G__CFG_COUT \"${CXXOUT}\"" APPEND)
-    write_file(${file} "#define G__CFG_COUTEXE \"${CXXOUT}\"" APPEND)
-    write_file(${file} "#define G__CFG_INCP \"-I\"" APPEND)
-    write_file(${file} "#define G__CFG_CXX \"${CXX}\"" APPEND)
-    write_file(${file} "#define G__CFG_CXXFLAGS \" ${CMAKE_CXX_FLAGS} ${CINT_CXX_DEFINITIONS} -I${CMAKE_BINARY_DIR}/include\"" APPEND)
-    write_file(${file} "#define G__CFG_CXXMACROS \"${CINT_CXX_DEFINITIONS}\"" APPEND)
-    write_file(${file} "#define G__CFG_LD \"${CXX}\"" APPEND)
-    write_file(${file} "#define G__CFG_LDFLAGS \"${CMAKE_CXX_LINK_FLAGS}\"" APPEND)
-    write_file(${file} "#define G__CFG_LIBP \"-L\"" APPEND)
-    write_file(${file} "#define G__CFG_SOFLAGS \"${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}\"" APPEND)
-    write_file(${file} "#define G__CFG_SOOUT G__CFG_LDOUT" APPEND)
-    write_file(${file} "#define G__CFG_OBJEXT \".o\"" APPEND)
-    write_file(${file} "#define G__CFG_EXEEXT \"${EXEEXT}\"" APPEND)
-    write_file(${file} "#define G__CFG_SOEXT \".${SOEXT}\"" APPEND)
-    write_file(${file} "#define G__CFG_DEBUG \"\"" APPEND) #TODO
-    write_file(${file} "#define G__CFG_DEFAULTLIBS \"${SYSLIBS}\"" APPEND)
-    write_file(${file} "#define G__CFG_STREAMDIR \"\" " APPEND) #TODO
-    write_file(${file} "#define G__CFG_EXPLLINK \"${EXPLICITLINK}\"" APPEND)
-    write_file(${file} "#define G__CFG_BUILDREADLINE \"\"" APPEND)
-    write_file(${file} "#define G__CFG_READLINELIBDIR \"\"" APPEND)
-    write_file(${file} "#define G__CFG_READLINEINCDIR \"\"" APPEND)
-    write_file(${file} "#define G__CFG_NEEDCURSES \"\"" APPEND)
-    write_file(${file} "#define G__CFG_RM \"rm -f\"" APPEND)
-    write_file(${file} "#define G__CFG_MV \"mv -f\"" APPEND)
-    write_file(${file} "#define G__CFG_INPUTMODE \"root\"" APPEND)
-    write_file(${file} "#define G__CFG_INPUTMODELOCK \"off\"" APPEND)
-    write_file(${file} "#define G__CFG_MAKEIMPLIB \"\"" APPEND)
-    write_file(${file} "#define G__CFG_CINTSYSDIR \"${CMAKE_SOURCE_DIR}\"" APPEND)
-    write_file(${file} "#define G__CFG_HAVE_CONFIG \"1\"" APPEND)
-    write_file(${file} "#define CINTSYSDIR \"${CMAKE_SOURCE_DIR}\"" APPEND)
-    write_file(${file} "#define G__CFG_MAKEIMPLIB \"\"" APPEND)
-    write_file(${file} "#define G__CFG_HAVE_CONFIG \"1\"" APPEND)
-  elseif(WIN32)
-    write_file(${file} "#define G__CFG_ARCH \"${ROOT_ARCHITECTURE}\"" APPEND)
-    write_file(${file} "#define G__CFG_LDOUT \"-out:\"" APPEND)
-    write_file(${file} "#define G__CFG_LIBL \"lib@imp@\"" APPEND)
-    write_file(${file} "#define G__CFG_LIBEXT \".lib\"" APPEND)
-    write_file(${file} "#define G__CFG_IMPLIBEXT \".lib\"" APPEND)
-    write_file(${file} "#define G__CFG_MANGLEPATHS \"echo \"" APPEND)
-    write_file(${file} "#define G__CFG_PLATFORMO \"vc_${MSVC_VERSION}\"" APPEND)
-    write_file(${file} "#define G__CFG_AR \"lib /OUT:\"" APPEND)
-    write_file(${file} "#define G__CFG_COREVERSION \"${ROOT_DICTTYPE}\" " APPEND)
-    write_file(${file} "#define G__CFG_CC \"${CMAKE_C_COMPILER}\"" APPEND)
-    write_file(${file} "#define G__CFG_CFLAGS \"${CMAKE_C_FLAGS} ${CINT_C_DEFINITIONS} -I${CMAKE_BINARY_DIR}/include\" " APPEND)
-    write_file(${file} "#define G__CFG_CMACROS \"${CINT_C_DEFINITIONS}\" " APPEND)
-    write_file(${file} "#define G__CFG_COMP \"-c \"" APPEND)
-    write_file(${file} "#define G__CFG_CPP \"cl.exe -E -C -nologo\"" APPEND)
-    write_file(${file} "#define G__CFG_COUT \"-Fo\"" APPEND)
-    write_file(${file} "#define G__CFG_COUTEXE \"-Fo\"" APPEND)
-    write_file(${file} "#define G__CFG_INCP \"-I\"" APPEND)
-    write_file(${file} "#define G__CFG_CXX \"${CXX}\"" APPEND)
-    write_file(${file} "#define G__CFG_CXXFLAGS \" ${CMAKE_CXX_FLAGS} ${CINT_CXX_DEFINITIONS} -I${CMAKE_BINARY_DIR}/include\"" APPEND)
-    write_file(${file} "#define G__CFG_CXXMACROS \"${CINT_CXX_DEFINITIONS}\"" APPEND)
-    write_file(${file} "#define G__CFG_LD \"${CXX}\"" APPEND)
-    write_file(${file} "#define G__CFG_LDFLAGS \"${CMAKE_SHARED_LINKER_FLAGS}\"" APPEND)
-    write_file(${file} "#define G__CFG_LIBP \"-L\"" APPEND)
-    write_file(${file} "#define G__CFG_SOFLAGS \"-DLL\"" APPEND)
-    write_file(${file} "#define G__CFG_SOOUT G__CFG_LDOUT" APPEND)
-    write_file(${file} "#define G__CFG_OBJEXT \".obj\"" APPEND)
-    write_file(${file} "#define G__CFG_EXEEXT \"${EXEEXT}\"" APPEND)
-    write_file(${file} "#define G__CFG_SOEXT \".${SOEXT}\"" APPEND)
-    write_file(${file} "#define G__CFG_DEBUG \"\"" APPEND) #TODO
-    write_file(${file} "#define G__CFG_DEFAULTLIBS \"${SYSLIBS}\"" APPEND)
-    write_file(${file} "#define G__CFG_STREAMDIR \"\" " APPEND) #TODO
-    write_file(${file} "#define G__CFG_EXPLLINK \"${EXPLICITLINK}\"" APPEND)
-    write_file(${file} "#define G__CFG_BUILDREADLINE \"\"" APPEND)
-    write_file(${file} "#define G__CFG_READLINELIBDIR \"\"" APPEND)
-    write_file(${file} "#define G__CFG_READLINEINCDIR \"\"" APPEND)
-    write_file(${file} "#define G__CFG_NEEDCURSES \"\"" APPEND)
-    write_file(${file} "#define G__CFG_RM \"rm -f\"" APPEND)
-    write_file(${file} "#define G__CFG_MV \"mv -f\"" APPEND)
-    write_file(${file} "#define G__CFG_INPUTMODE \"root\"" APPEND)
-    write_file(${file} "#define G__CFG_INPUTMODELOCK \"off\"" APPEND)
-    write_file(${file} "#define G__CFG_MAKEIMPLIB \"\"" APPEND)
-    write_file(${file} "#define G__CFG_CINTSYSDIR \"${CMAKE_SOURCE_DIR}\"" APPEND)
-    write_file(${file} "#define G__CFG_HAVE_CONFIG \"1\"" APPEND)
-    write_file(${file} "#define CINTSYSDIR \"${CMAKE_SOURCE_DIR}\"" APPEND)
-    write_file(${file} "#define G__CFG_MAKEIMPLIB \"\"" APPEND)
-    write_file(${file} "#define G__CFG_HAVE_CONFIG \"1\"" APPEND)
-  endif()
-endfunction()


Forward MSVC generator to all sub-projects [skip ci]

--- cmake/modules/hunter_download.cmake
+++ cmake/modules/hunter_download.cmake
@@ -196,8 +196,14 @@
   if(HUNTER_CMAKE_GENERATOR)
     set(h_generator "-G${HUNTER_CMAKE_GENERATOR}")
   else()
-    # use default
-    set(h_generator)
+    if(MSVC)
+      # forward same generator for all project
+      # because one generator = one compiler
+      set(h_generator "-G${CMAKE_GENERATOR}")
+    else()
+      # use default
+      set(h_generator)
+    endif()
   endif()

   hunter_status_debug("Run generate")


Fixed build error due to recent file renaming.

--- cmake/configure/framework.cmake
+++ cmake/configure/framework.cmake
@@ -46,7 +46,7 @@

 	IF(BUILD_FOR_ROS)
 		ADD_DEFINITIONS( -D_BUILD_FOR_ROS_ )
-		include(cmake/configure_catkin.cmake)
+		include(cmake/configure/catkin.cmake)

                 SET(BUILD_APPS FALSE CACHE BOOL "Build demo apps.")
 	ELSE()


Pass all additional arguments of distortosHex() to ${CMAKE_OBJCOPY}

--- cmake/distortos-utilities.cmake
+++ cmake/distortos-utilities.cmake
@@ -69,10 +69,12 @@
 #
 # Converts output file of `target` to Intel HEX file named `hexFilename`.
 #
+# All additional arguments are passed to ${CMAKE_OBJCOPY}.
+#

 function(distortosHex target hexFilename)
 	add_custom_command(TARGET ${target} POST_BUILD
-			COMMAND ${CMAKE_OBJCOPY} -O ihex $<TARGET_FILE:${target}> ${hexFilename}
+			COMMAND ${CMAKE_OBJCOPY} ${ARGN} -O ihex $<TARGET_FILE:${target}> ${hexFilename}
 			BYPRODUCTS ${hexFilename}
 			VERBATIM)
 endfunction()


Fix failures in CDash due to 'remarks'

Fix failures in CDash due to 'remarks'

--- cmake/modules/CTestCustom.cmake
+++ cmake/modules/CTestCustom.cmake
@@ -21,7 +21,8 @@
         "function is dangerous and should not be used"           # deprecated use of std functions cint/ROOT
     )
 set(CTEST_CUSTOM_ERROR_EXCEPTION ${CTEST_CUSTOM_ERROR_EXCEPTION}
-        "fatal error: cannot open file")
+        "fatal error: cannot open file"
+        "remark: ")

 #---Include other CTest Custom files----------------------------------------
 if(DEFINED CTEST_BINARY_DIRECTORY)


- Refractored sketch generator - Added support for library examples

--- cmake/modules/FindArduino.cmake
+++ cmake/modules/FindArduino.cmake
@@ -45,6 +45,17 @@
 #       set(test_BOARD uno)
 #
 #       generate_arduino_library(test)
+#
+#
+#
+# generate_arduino_example(LIBRARY_NAME EXAMPLE_NAME BOARD_ID [PORT] [SERIAL])
+#
+#        BOARD_ID     - Board ID
+#        LIBRARY_NAME - Library name
+#        EXAMPLE_NAME - Example name
+#        PORT         - Serial port [optional]
+#        SERIAL       - Serial command [optional]
+# Creates a example from the specified library.

 file(GLOB SDK_PATHS /usr/share/arduino*)

@@ -170,10 +181,12 @@
     setup_arduino_core(CORE_LIB ${INPUT_BOARD})

     if(INPUT_SKETCH)
-        convert_pde_to_cpp(${INPUT_SKETCH} SKETCH_CPP)
-        list(APPEND ALL_SRCS ${SKETCH_CPP})
-    endif()
-    #setup_arduino_sketch(SKETCH_SRCS ${INPUT_SKETCHES})
+        setup_arduino_sketch(${INPUT_SKETCH} ALL_SRCS)
+    endif()
+
+    if(NOT ALL_SRCS)
+        message(FATAL_ERROR "Missing sources (${TARGET_NAME}_SRCS or ${TARGET_NAME}_SKETCH), aborting!")
+    endif()

     if(INPUT_AUTOLIBS)
         setup_arduino_libraries(ALL_LIBS ${INPUT_BOARD} "${ALL_SRCS}")
@@ -186,6 +199,45 @@

     if(INPUT_PORT)
         setup_arduino_upload(${INPUT_BOARD} ${TARGET_NAME} ${INPUT_PORT})
+    endif()
+
+    if(INPUT_SERIAL)
+        setup_serial_target(${TARGET_NAME} "${INPUT_SERIAL}")
+    endif()
+endfunction()
+
+# generate_arduino_example(LIBRARY_NAME EXAMPLE_NAME BOARD_ID [PORT] [SERIAL])
+#
+# see documentation at top
+function(GENERATE_ARDUINO_EXAMPLE LIBRARY_NAME EXAMPLE_NAME BOARD_ID)
+
+    set(TARGET_NAME "example-${LIBRARY_NAME}-${EXAMPLE_NAME}")
+
+    message(STATUS "Generating example ${LIBRARY_NAME}-${EXAMPLE_NAME}")
+
+    set(ALL_LIBS)
+    set(ALL_SRCS)
+
+    set(INPUT_PORT  ${ARGV3})
+    set(INPUT_SERIAL ${ARGV4})
+
+    setup_arduino_compiler(${BOARD_ID})
+    setup_arduino_core(CORE_LIB ${BOARD_ID})
+
+    setup_arduino_example("${LIBRARY_NAME}" "${EXAMPLE_NAME}" ALL_SRCS)
+
+    if(NOT ALL_SRCS)
+        message(FATAL_ERROR "Missing sources for example, aborting!")
+    endif()
+
+    setup_arduino_libraries(ALL_LIBS ${BOARD_ID} "${ALL_SRCS}")
+
+    list(APPEND ALL_LIBS ${CORE_LIB} ${INPUT_LIBS})
+
+    setup_arduino_target(${TARGET_NAME} "${ALL_SRCS}" "${ALL_LIBS}")
+
+    if(INPUT_PORT)
+        setup_arduino_upload(${BOARD_ID} ${TARGET_NAME} ${INPUT_PORT})
     endif()

     if(INPUT_SERIAL)
@@ -887,67 +939,124 @@
     endif()
 endfunction()

-
-function(CONVERT_PDE_TO_CPP SKETCH_NAME SKETCH_CPP_PATH)
-	set(SKETCH_CPP ${CMAKE_CURRENT_BINARY_DIR}/${SKETCH_NAME}/${SKETCH_NAME}.cpp)
-	set(SKETCH_PDE ${CMAKE_CURRENT_SOURCE_DIR}/${SKETCH_NAME}/${SKETCH_NAME}.pde)
-
-	file(GLOB PDE_SOURCES ${SKETCH_NAME}/*.pde)
-
-	# find the head of the main pde
+function(SETUP_ARDUINO_EXAMPLE LIBRARY_NAME EXAMPLE_NAME OUTPUT_VAR)
+    set(EXAMPLE_SKETCH_PATH )
+
+    get_property(LIBRARY_SEARCH_PATH
+                 DIRECTORY     # Property Scope
+                 PROPERTY LINK_DIRECTORIES)
+    foreach(LIB_SEARCH_PATH ${LIBRARY_SEARCH_PATH} ${ARDUINO_LIBRARIES_PATH} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/libraries)
+        if(EXISTS "${LIB_SEARCH_PATH}/${LIBRARY_NAME}/examples/${EXAMPLE_NAME}")
+            set(EXAMPLE_SKETCH_PATH "${LIB_SEARCH_PATH}/${LIBRARY_NAME}/examples/${EXAMPLE_NAME}")
+            break()
+        endif()
+    endforeach()
+
+    if(EXAMPLE_SKETCH_PATH)
+        setup_arduino_sketch(${EXAMPLE_SKETCH_PATH} SKETCH_CPP)
+        set("${OUTPUT_VAR}" ${${OUTPUT_VAR}} ${SKETCH_CPP} PARENT_SCOPE)
+    else()
+        message(FATAL_ERROR "Could not find example ${EXAMPLE_NAME} from library ${LIBRARY_NAME}")
+    endif()
+endfunction()
+
+# setup_arduino_sketch(SKETCH_PATH OUTPUT_VAR)
+#
+#      SKETCH_PATH - Path to sketch directory
+#      OUTPUT_VAR  - Variable name where to save generated sketch source
+#
+# Generates C++ sources from Arduino Sketch.
+function(SETUP_ARDUINO_SKETCH SKETCH_PATH OUTPUT_VAR)
+    if(EXISTS "${SKETCH_PATH}")
+        get_filename_component(SKETCH_NAME "${SKETCH_PATH}" NAME)
+        get_filename_component(SKETCH_PATH "${SKETCH_PATH}" ABSOLUTE)
+
+        set(SKETCH_CPP  ${CMAKE_CURRENT_BINARY_DIR}/${SKETCH_NAME}.cpp)
+        set(MAIN_SKETCH ${SKETCH_PATH}/${SKETCH_NAME})
+
+        if(EXISTS "${MAIN_SKETCH}.pde")
+            set(MAIN_SKETCH "${MAIN_SKETCH}.pde")
+        elseif(EXISTS "${MAIN_SKETCH}.ino")
+            set(MAIN_SKETCH "${MAIN_SKETCH}.ino")
+        else()
+            message(FATAL_ERROR "Could not find main sketch (${SKETCH_NAME}.pde or ${SKETCH_NAME}.ino) at ${SKETCH_PATH}!")
+        endif()
+        #message("${MAIN_SKETCH}")
+
+        # Find all sketch files
+        file(GLOB SKETCH_SOURCES ${SKETCH_PATH}/*.pde ${SKETCH_PATH}/*.ino)
+        list(REMOVE_ITEM SKETCH_SOURCES ${MAIN_SKETCH})
+        list(SORT SKETCH_SOURCES)
+
+        generate_cpp_from_sketch("${MAIN_SKETCH}" "${SKETCH_SOURCES}" "${SKETCH_CPP}")
+
+        # Regenerate build system if sketch changes
+        add_custom_command(OUTPUT ${SKETCH_CPP}
+                           COMMAND ${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR}
+                           WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+                           DEPENDS ${MAIN_SKETCH} ${SKETCH_SOURCES}
+                           COMMENT "Regnerating ${SKETCH_NAME} Sketch")
+        set_source_files_properties(${SKETCH_CPP} PROPERTIES GENERATED TRUE)
+
+        set("${OUTPUT_VAR}" ${${OUTPUT_VAR}} ${SKETCH_CPP} PARENT_SCOPE)
+    else()
+        message(FATAL_ERROR "Sketch does not exist: ${SKETCH_PDE}")
+    endif()
+endfunction()
+
+# generate_cpp_from_sketch(MAIN_SKETCH_PATH SKETCH_SOURCES SKETCH_CPP)
+#
+#         MAIN_SKETCH_PATH - Main sketch file path
+#         SKETCH_SOURCES   - Setch source paths
+#         SKETCH_CPP       - Name of file to generate
+#
+# Generate C++ source file from Arduino sketch files.
+function(GENERATE_CPP_FROM_SKETCH MAIN_SKETCH_PATH SKETCH_SOURCES SKETCH_CPP)
 	file(WRITE ${SKETCH_CPP} "// automatically generated by arduino-cmake\n")
-	file(READ ${SKETCH_PDE} FILE)
-
-	string(FIND "${FILE}" "#include" POS1 REVERSE)
-	string(LENGTH "${FILE}" FILE_LENGTH)
-	math(EXPR LENGTH_STR1 "${FILE_LENGTH}-${POS1}")
-	string(SUBSTRING "${FILE}" ${POS1} ${LENGTH_STR1} STR1)
+    file(READ  ${MAIN_SKETCH_PATH} MAIN_SKETCH)
+
+    string(FIND "${MAIN_SKETCH}" "#include" FIRST_INCLUDE_OFFSET REVERSE)
+    string(LENGTH "${MAIN_SKETCH}" MAIN_SKETCH_LENGTH)
+    math(EXPR LENGTH_STR1 "${MAIN_SKETCH_LENGTH}-${FIRST_INCLUDE_OFFSET}")
+    string(SUBSTRING "${MAIN_SKETCH}" ${FIRST_INCLUDE_OFFSET} ${LENGTH_STR1} STR1)
+    #message("STR1:\n${STR1}")
+
 	string(FIND "${STR1}" "\n" POS2)
-	math(EXPR POS3 "${POS1}+${POS2}")
-	string(SUBSTRING "${FILE}" 0 ${POS3} FILE_HEAD)
-    #message(STATUS "FILE_HEAD:\n${FILE_HEAD}")
+    math(EXPR POS3 "${FIRST_INCLUDE_OFFSET}+${POS2}")
+    string(SUBSTRING "${MAIN_SKETCH}" 0 ${POS3} SKETCH_HEAD)
+    #message(STATUS "SKETCH_HEAD:\n${SKETCH_HEAD}")

 	# find the body of the main pde
-	math(EXPR BODY_LENGTH "${FILE_LENGTH}-${POS3}-1")
-	string(SUBSTRING "${FILE}" "${POS3}+1" "${BODY_LENGTH}" FILE_BODY)
-    #message(STATUS "BODY:\n${FILE_BODY}")
+    math(EXPR BODY_LENGTH "${MAIN_SKETCH_LENGTH}-${POS3}-1")
+    string(SUBSTRING "${MAIN_SKETCH}" "${POS3}+1" "${BODY_LENGTH}" SKETCH_BODY)
+    #message(STATUS "BODY:\n${SKETCH_BODY}")

 	# write the file head
-    #file(APPEND ${SKETCH_CPP} "\n#include \"WProgram.h\"\n")
-    file(APPEND ${SKETCH_CPP} "\n#include \"Arduino.h\"\n")
-	file(APPEND ${SKETCH_CPP} "${FILE_HEAD}")
-
-	# write prototypes
-	foreach(PDE ${PDE_SOURCES})
-        #message(STATUS "pde: ${PDE}")
-		file(READ ${PDE} FILE)
-        string(REGEX MATCHALL "[\n]([a-zA-Z]+[ ])*[_a-zA-Z0-9]+([ ]*[\n][\t]*|[ ])[_a-zA-Z0-9]+[ ]?[\n]?[\t]*[ ]*[(]([\t]*[ ]*[*]?[ ]?[a-zA-Z0-9_](\\[([0-9]+)?\\])*[,]?[ ]*[\n]?)*[)]" PROTOTYPES ${FILE})
-		foreach(PROTOTYPE ${PROTOTYPES})
+    file(APPEND ${SKETCH_CPP} "\n")
+    file(APPEND ${SKETCH_CPP} "#include \"Arduino.h\"\n")
+    file(APPEND ${SKETCH_CPP} "\n")
+    file(APPEND ${SKETCH_CPP} "${SKETCH_HEAD}")
+
+    # Find function prototypes
+    foreach(SKETCH_SOURCE_PATH ${SKETCH_SOURCES} ${MAIN_SKETCH_PATH})
+        #message(STATUS "Sketch: ${SKETCH_SOURCE_PATH}")
+        file(READ ${SKETCH_SOURCE_PATH} SKETCH_SOURCE)
+        string(REGEX MATCHALL "[\n]([a-zA-Z]+[ ])*[_a-zA-Z0-9]+([ ]*[\n][\t]*|[ ])[_a-zA-Z0-9]+[ ]?[\n]?[\t]*[ ]*[(]([\t]*[ ]*[*]?[ ]?[a-zA-Z0-9_](\\[([0-9]+)?\\])*[,]?[ ]*[\n]?)*[)]" SKETCH_PROTOTYPES ${SKETCH_SOURCE})
+
+        # Write function prototypes
+        foreach(SKETCH_PROTOTYPE ${SKETCH_PROTOTYPES})
             #message(STATUS "\tprototype: ${PROTOTYPE};")
-			file(APPEND ${SKETCH_CPP} "${PROTOTYPE};")
+            file(APPEND ${SKETCH_CPP} "${SKETCH_PROTOTYPE};")
 		endforeach()
 	endforeach()

-	# write source
-	file(APPEND ${SKETCH_CPP} "\n${FILE_BODY}")
-	list(REMOVE_ITEM PDE_SOURCES ${SKETCH_PDE})
-	list(SORT PDE_SOURCES)
-	foreach (PDE ${PDE_SOURCES})
-		file(READ ${PDE} FILE)
-		file(APPEND ${SKETCH_CPP} "${FILE}")
+    # Write Sketch CPP source
+    file(APPEND ${SKETCH_CPP} "\n${SKETCH_BODY}")
+    foreach (SKETCH_SOURCE_PATH ${SKETCH_SOURCES})
+        file(READ ${SKETCH_SOURCE_PATH} SKETCH_SOURCE)
+        file(APPEND ${SKETCH_CPP} "${SKETCH_SOURCE}")
 	endforeach()
-
-    # Regenerate build system if sketche changes
-    add_custom_command(OUTPUT ${SKETCH_CPP}
-                        COMMAND ${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR}
-                       WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
-                       DEPENDS ${PDE_SOURCES} ${SKETCH_PDE}
-                       COMMENT "Regnerating ${SKETCH_NAME} Sketch")
-
-    set_source_files_properties(${SKETCH_CPP} PROPERTIES GENERATED TRUE)
-
-    set("${SKETCH_CPP_PATH}" ${SKETCH_CPP} PARENT_SCOPE)
 endfunction()


Sync FindGObject.cmake with the one in kdelibs.

Import kdelibs' FindGObject.cmake at commit
e02cae5112ef7ec37d6af3553399a136726b5288.

Highlights:
 * Remove unnecessary WIN32 check.
 * Use the pkg-config paths as HINTS, not PATHS.
 * Use FindPackageHandleStandardArgs instead of duplicating its
   functionality.

As a consequence, GOBJECT_LIBRARIES uses full library paths on all
platforms, which should fix linking when gobject is in a non-standard
path.

Reviewed-by: Dario Freddi

--- cmake/modules/FindGObject.cmake
+++ cmake/modules/FindGObject.cmake
@@ -6,70 +6,47 @@
 #  GOBJECT_LIBRARIES - the libraries needed to use GObject
 #  GOBJECT_DEFINITIONS - Compiler switches required for using GObject

-# Copyright (c) 2008 Helio Chissini de Castro, <helio@kde.org>
-#  (c)2006, Tim Beaulen <tbscope@gmail.com>
+# Copyright (c) 2011, Raphael Kubo da Costa <kubito@gmail.com>
+# Copyright (c) 2006, Tim Beaulen <tbscope@gmail.com>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.

+FIND_PACKAGE(PkgConfig)
+PKG_CHECK_MODULES(PC_GOBJECT gobject-2.0)
+SET(GOBJECT_DEFINITIONS ${PC_GOBJECT_CFLAGS_OTHER})

-IF (GOBJECT_INCLUDE_DIR AND GOBJECT_LIBRARIES)
-   # in cache already
-   SET(GObject_FIND_QUIETLY TRUE)
-ELSE (GOBJECT_INCLUDE_DIR AND GOBJECT_LIBRARIES)
-   SET(GObject_FIND_QUIETLY FALSE)
-ENDIF (GOBJECT_INCLUDE_DIR AND GOBJECT_LIBRARIES)
-
-IF (NOT WIN32)
-   FIND_PACKAGE(PkgConfig)
-   # use pkg-config to get the directories and then use these values
-   # in the FIND_PATH() and FIND_LIBRARY() calls
-   PKG_CHECK_MODULES(PKG_GOBJECT2 gobject-2.0)
-   SET(GOBJECT_DEFINITIONS ${PKG_GOBJECT2_CFLAGS})
-ENDIF (NOT WIN32)
-
-FIND_PATH(GOBJECT_INCLUDE_DIR gobject/gobject.h
-   PATHS
-   ${PKG_GOBJECT2_INCLUDE_DIRS}
-   /usr/include/glib-2.0/
-   PATH_SUFFIXES glib-2.0
+FIND_PATH(GOBJECT_INCLUDE_DIR gobject.h
+   HINTS
+   ${PC_GOBJECT_INCLUDEDIR}
+   ${PC_GOBJECT_INCLUDE_DIRS}
+   PATH_SUFFIXES glib-2.0/gobject/
    )

 FIND_LIBRARY(_GObjectLibs NAMES gobject-2.0
-   PATHS
-   ${PKG_GOBJECT2_LIBRARY_DIRS}
+   HINTS
+   ${PC_GOBJECT_LIBDIR}
+   ${PC_GOBJECT_LIBRARY_DIRS}
    )
 FIND_LIBRARY(_GModuleLibs NAMES gmodule-2.0
-   PATHS
-   ${PKG_GOBJECT2_LIBRARY_DIRS}
+   HINTS
+   ${PC_GOBJECT_LIBDIR}
+   ${PC_GOBJECT_LIBRARY_DIRS}
    )
 FIND_LIBRARY(_GThreadLibs NAMES gthread-2.0
-   PATHS
-   ${PKG_GOBJECT2_LIBRARY_DIRS}
+   HINTS
+   ${PC_GOBJECT_LIBDIR}
+   ${PC_GOBJECT_LIBRARY_DIRS}
    )
 FIND_LIBRARY(_GLibs NAMES glib-2.0
-   PATHS
-   ${PKG_GOBJECT2_LIBRARY_DIRS}
+   HINTS
+   ${PC_GOBJECT_LIBDIR}
+   ${PC_GOBJECT_LIBRARY_DIRS}
    )

-IF (WIN32)
-SET (GOBJECT_LIBRARIES ${_GObjectLibs} ${_GModuleLibs} ${_GThreadLibs} ${_GLibs})
-ELSE (WIN32)
-SET (GOBJECT_LIBRARIES ${PKG_GOBJECT2_LIBRARIES})
-ENDIF (WIN32)
+SET( GOBJECT_LIBRARIES ${_GObjectLibs} ${_GModuleLibs} ${_GThreadLibs} ${_GLibs} )

-IF (GOBJECT_INCLUDE_DIR AND GOBJECT_LIBRARIES)
-   SET(GOBJECT_FOUND TRUE)
-ELSE (GOBJECT_INCLUDE_DIR AND GOBJECT_LIBRARIES)
-   SET(GOBJECT_FOUND FALSE)
-ENDIF (GOBJECT_INCLUDE_DIR AND GOBJECT_LIBRARIES)
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GOBJECT DEFAULT_MSG GOBJECT_LIBRARIES GOBJECT_INCLUDE_DIR)

-IF (GOBJECT_FOUND)
-   IF (NOT GObject_FIND_QUIETLY)
-      MESSAGE(STATUS "Found GObject libraries: ${GOBJECT_LIBRARIES}")
-      MESSAGE(STATUS "Found GObject includes : ${GOBJECT_INCLUDE_DIR}")
-   ENDIF (NOT GObject_FIND_QUIETLY)
-ELSE (GOBJECT_FOUND)
-    IF (GObject_FIND_REQUIRED)
-      MESSAGE(STATUS "Could NOT find GObject")
-    ENDIF(GObject_FIND_REQUIRED)
-ENDIF (GOBJECT_FOUND)
-
-MARK_AS_ADVANCED(GOBJECT_INCLUDE_DIR GOBJECT_LIBRARIES)
+MARK_AS_ADVANCED(GOBJECT_INCLUDE_DIR _GObjectLibs _GModuleLibs _GThreadLibs _GLibs)


[cmake] Unbreak LLVM-Config.cmake / llvm_expand_dependencies.

The algorithm for sorting libraries in topological order, as
previously implemented, had a few issues:
  * It didn't make any sense.
  * It didn't actually sort libraries in topological order.
  * It hung on some inputs, e.g. "LLVMipo".

This commit replaces the old algorithm with a straightforward port
from llvm-config.cpp.

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

--- cmake/modules/LLVM-Config.cmake
+++ cmake/modules/LLVM-Config.cmake
@@ -152,29 +152,39 @@
   set(${out_libs} ${expanded_components} PARENT_SCOPE)
 endfunction()

+# Perform a post-order traversal of the dependency graph.
+# This duplicates the algorithm used by llvm-config, originally
+# in tools/llvm-config/llvm-config.cpp, function ComputeLibsForComponents.
+function(expand_topologically name required_libs visited_libs)
+  list(FIND visited_libs ${name} found)
+  if( found LESS 0 )
+    list(APPEND visited_libs ${name})
+    set(visited_libs ${visited_libs} PARENT_SCOPE)
+
+    get_property(lib_deps GLOBAL PROPERTY LLVMBUILD_LIB_DEPS_${name})
+    foreach( lib_dep ${lib_deps} )
+      expand_topologically(${lib_dep} "${required_libs}" "${visited_libs}")
+      set(required_libs ${required_libs} PARENT_SCOPE)
+      set(visited_libs ${visited_libs} PARENT_SCOPE)
+    endforeach()
+
+    list(APPEND required_libs ${name})
+    set(required_libs ${required_libs} PARENT_SCOPE)
+  endif()
+endfunction()
+
 # Expand dependencies while topologically sorting the list of libraries:
 function(llvm_expand_dependencies out_libs)
   set(expanded_components ${ARGN})
-  list(LENGTH expanded_components lst_size)
-  set(cursor 0)
-  set(processed)
-  while( cursor LESS lst_size )
-    list(GET expanded_components ${cursor} lib)
-    get_property(lib_deps GLOBAL PROPERTY LLVMBUILD_LIB_DEPS_${lib})
-    list(APPEND expanded_components ${lib_deps})
-    # Remove duplicates at the front:
-    list(REVERSE expanded_components)
-    list(REMOVE_DUPLICATES expanded_components)
-    list(REVERSE expanded_components)
-    list(APPEND processed ${lib})
-    # Find the maximum index that doesn't have to be re-processed:
-    while(NOT "${expanded_components}" MATCHES "^${processed}.*" )
-      list(REMOVE_AT processed -1)
-    endwhile()
-    list(LENGTH processed cursor)
-    list(LENGTH expanded_components lst_size)
-  endwhile( cursor LESS lst_size )
-  set(${out_libs} ${expanded_components} PARENT_SCOPE)
+
+  set(required_libs)
+  set(visited_libs)
+  foreach( lib ${expanded_components} )
+    expand_topologically(${lib} "${required_libs}" "${visited_libs}")
+  endforeach()
+
+  list(REVERSE required_libs)
+  set(${out_libs} ${required_libs} PARENT_SCOPE)
 endfunction()

 function(explicit_map_components_to_libraries out_libs)


Bump to 1.7.6

Bump to 1.7.6

--- VERSION.cmake
+++ VERSION.cmake
@@ -1,3 +1,3 @@
 SET(LIBREPO_MAJOR "1")
 SET(LIBREPO_MINOR "7")
-SET(LIBREPO_PATCH "5")
+SET(LIBREPO_PATCH "6")


[CMake] Workaround for PR24144: avoid installing libcxx_tsan and libcxx_msan by default "ninja install" command.

Summary:
Exclude external libc++ builds from "all" target, so that they are only
build on demand, and are not installed together with LLVM/Clang.

Reviewers: hans

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D11252

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

--- cmake/Modules/AddCompilerRT.cmake
+++ cmake/Modules/AddCompilerRT.cmake
@@ -245,6 +245,7 @@
     list(APPEND LIBCXX_DEPS clang)
   endif()

+  set(EXCLUDE_FROM_ALL TRUE)
   ExternalProject_Add(${name}
     PREFIX ${prefix}
     SOURCE_DIR ${COMPILER_RT_LIBCXX_PATH}
@@ -271,4 +272,5 @@
     DEPENDERS configure
     DEPENDS ${LIBCXX_DEPS}
     )
-endmacro()
+  set(EXCLUDE_FROM_ALL FALSE)
+endmacro()


Clean make up for correct variable names

--- cmake/check-supported-flags.cmake
+++ cmake/check-supported-flags.cmake
@@ -1,15 +1,16 @@
 include(CheckCXXSourceCompiles)
 include(CMakeCheckCompilerFlagCommonPatterns)

-include(compiler-flags.cmake)
+include(cmake/compiler-flags.cmake)

 macro(check_supported_flags OUTPUT_VAR)
   CHECK_COMPILER_FLAG_COMMON_PATTERNS(_CheckCXXCompilerFlag_COMMON_PATTERNS)
   foreach(flag ${GCC_EXTRA_WARNINGS} ${CLANG_EXTRA_WARNINGS})
     set(CMAKE_REQUIRED_DEFINITIONS "-W${flag}")
-    CHECK_CXX_SOURCE_COMPILES("int main() { return 0; }" flag-${flag}-result
+    string(REPLACE "=" "-" result_var "flag-${flag}-result" )
+    CHECK_CXX_SOURCE_COMPILES("int main() { return 0; }" ${result_var}
       FAIL_REGEX ${_CheckCXXCompilerFlag_COMMON_PATTERNS})
-    if(${flag-${flag}-result})
+    if(${result_var})
       list(APPEND CXX_ALL_WARNINGS "${flag}")
     endif()
   endforeach()


Protection for ROOT-6454 (copied from 5.34 patches)

--- cmake/modules/RootNewMacros.cmake
+++ cmake/modules/RootNewMacros.cmake
@@ -678,11 +678,13 @@
 #---ROOT_CHECK_OUT_OF_SOURCE_BUILD( )
 #---------------------------------------------------------------------------------------------------
 macro(ROOT_CHECK_OUT_OF_SOURCE_BUILD)
- string(COMPARE EQUAL ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} insource)
-  if(insource)
+  get_filename_component(bindir_parent ${CMAKE_BINARY_DIR} PATH)
+  if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
      file(REMOVE_RECURSE ${CMAKE_SOURCE_DIR}/Testing)
      file(REMOVE ${CMAKE_SOURCE_DIR}/DartConfiguration.tcl)
-     message(FATAL_ERROR "ROOT should be installed as an out of source build, to keep the source directory clean. Please create a extra build directory and run the command 'cmake <path_to_source_dir>' in this newly created directory. You have also to delete the directory CMakeFiles and the file CMakeCache.txt in the source directory. Otherwise cmake will complain even if you run it from an out-of-source directory.")
+     message(FATAL_ERROR "ROOT should be built as an out of source build, to keep the source directory clean. Please create a extra build directory and run the command 'cmake <path_to_source_dir>' in this newly created directory. You have also to delete the directory CMakeFiles and the file CMakeCache.txt in the source directory. Otherwise cmake will complain even if you run it from an out-of-source directory.")
+  elseif(IS_SYMLINK ${CMAKE_BINARY_DIR} AND CMAKE_SOURCE_DIR STREQUAL bindir_parent)
+     message(FATAL_ERROR "ROOT cannot be built from a sub-directory of the source tree that is a symlink. This is a current limitation of CMake. Please create a real build directory and run the command 'cmake <path_to_source_dir>' in this newly created directory.")
   endif()
 endmacro()


Allow to change compilation flags for single executables in CMake

--- cmake/modules/RootNewMacros.cmake
+++ cmake/modules/RootNewMacros.cmake
@@ -522,7 +522,7 @@
 #---ROOT_EXECUTABLE( <name> source1 source2 ... LIBRARIES library1 library2 ...)
 #---------------------------------------------------------------------------------------------------
 function(ROOT_EXECUTABLE executable)
-  CMAKE_PARSE_ARGUMENTS(ARG "CMAKENOEXPORT;NOINSTALL" "" "LIBRARIES"  ${ARGN})
+  CMAKE_PARSE_ARGUMENTS(ARG "CMAKENOEXPORT;NOINSTALL" "" "LIBRARIES;ADDITIONAL_COMPILE_FLAGS"  ${ARGN})
   ROOT_GET_SOURCES(exe_srcs src ${ARG_UNPARSED_ARGUMENTS})
   set(executable_name ${executable})
   if(TARGET ${executable})
@@ -537,6 +537,9 @@
   endif()
   set_property(GLOBAL APPEND PROPERTY ROOT_EXPORTED_TARGETS ${executable})
   set_target_properties(${executable} PROPERTIES OUTPUT_NAME ${executable_name})
+  if (ARG_ADDITIONAL_COMPILE_FLAGS)
+    set_target_properties(${executable} PROPERTIES COMPILE_FLAGS ${ARG_ADDITIONAL_COMPILE_FLAGS})
+  endif()
   #----Installation details------------------------------------------------------
   if(NOT ARG_NOINSTALL)
     if(ARG_CMAKENOEXPORT)


Remove indi-bin depend and add Debian Buster libwx*v5 package names

Building DEB package with command: "make package" sets indi-bin (>= 0.9.7)
as dependency in built DEB package. However, this is not needed as INDI source is
shipped within PHD2 and compiled as lib/bin when building and
packaging PHD2. In addition, the current stable Debian version is
Buster which has WX library names: libwxbase3.0-0v5 and libwxgtk3.0-0v5.
Thus the package names libwxbase3.0-0v5 and libwxgtk3.0-0v5 are added
for making sure, the built package phd*.deb can be installed on Debian Buster.

--- cmake_modules/PHD2Packaging.cmake
+++ cmake_modules/PHD2Packaging.cmake
@@ -52,7 +52,7 @@
   install (FILES ${phd_src_dir}/README-PHD2.txt DESTINATION . )
   install (FILES ${phd_src_dir}/PHD2GuideHelp.zip DESTINATION . )
   install (DIRECTORY ${phd_src_dir}/locale DESTINATION . )
-
+
   # Make NSIS package
   set(CPACK_GENERATOR "NSIS")
   set(CPACK_PACKAGE_FILE_NAME "phd2-${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${cdate}.${HOST_NAME}-win32")
@@ -74,11 +74,11 @@
   install(FILES ${PHD_INSTALL_LIBS}
           DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/phd2/)
   install(FILES ${phd_src_dir}/icons/phd2_48.png
-          DESTINATION ${CMAKE_INSTALL_PREFIX}/share/pixmaps/
+          DESTINATION ${CMAKE_INSTALL_PREFIX}/share/pixmaps/
           RENAME "phd2.png")
-  install(FILES ${phd_src_dir}/phd2.desktop
+  install(FILES ${phd_src_dir}/phd2.desktop
           DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications/ )
-  install(FILES ${phd_src_dir}/phd2.appdata.xml
+  install(FILES ${phd_src_dir}/phd2.appdata.xml
           DESTINATION ${CMAKE_INSTALL_PREFIX}/share/metainfo/ )

   # Make Debian package
@@ -103,7 +103,7 @@
   # set version and arch compatible file name
   set(CPACK_PACKAGE_FILE_NAME "phd2_${CPACK_DEBIAN_PACKAGE_VERSION}_${debarch}")
   # Ubuntu 14.04 compatible minimal dependency
-  set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.17), libgcc1 (>= 1:4.1.1), indi-bin (>= 0.9.7), libnova-0.14-0 | libnova-0.16-0, libstdc++6 (>= 4.2.1), libusb-1.0-0 (>= 2:1.0.8), libwxbase3.0-0 (>= 3.0.0), libwxgtk3.0-0 (>=3.0.0), libx11-6, zlib1g (>= 1:1.1.4)")
+  set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.17), libgcc1 (>= 1:4.1.1), libnova-0.14-0 | libnova-0.16-0, libstdc++6 (>= 4.2.1), libusb-1.0-0 (>= 2:1.0.8), libwxbase3.0-0 | libwxbase3.0-0v5 (>= 3.0.0), libwxgtk3.0-0 | libwxgtk3.0-0v5 (>=3.0.0), libx11-6, zlib1g (>= 1:1.1.4)")
   set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "PHD2 auto-guiding software")
   # same section as many astronomy packages
   set(CPACK_DEBIAN_PACKAGE_SECTION "education")


use relative install path for Debian pkg

--- cmakemodules/DeclareMRPTLib.cmake
+++ cmakemodules/DeclareMRPTLib.cmake
@@ -345,7 +345,7 @@

 		# Special directories when building a .deb package:
 		if(CMAKE_MRPT_USE_DEB_POSTFIXS)
-			set(MRPT_PREFIX_INSTALL "${CMAKE_INSTALL_PREFIX}/libmrpt-${name}${CMAKE_MRPT_VERSION_NUMBER_MAJOR}.${CMAKE_MRPT_VERSION_NUMBER_MINOR}/usr/")
+			set(MRPT_PREFIX_INSTALL "libmrpt-${name}${CMAKE_MRPT_VERSION_NUMBER_MAJOR}.${CMAKE_MRPT_VERSION_NUMBER_MINOR}/usr/")
 		else()
 			set(MRPT_PREFIX_INSTALL "")
 		endif()


mac: Put warning when using old PGI compiler on 64-bit macOS

--- platforms/darwin-pgi/platform.cmake
+++ platforms/darwin-pgi/platform.cmake
@@ -1,9 +1,19 @@
 if (NOT PLIBSYS_SIZEOF_VOID_P EQUAL 4)
-        message (FATAL_ERROR
-                 "
-                 PGI compiler doesn't support 64-bit shared libraries on
-                 macOS. Use 32-bit version of the compiler instead.
-                 ")
+        if (CMAKE_VERSION VERSION_LESS 2.8.10)
+                message (WARNING
+                         "
+                         Unable to detect PGI compiler version. Beware that old
+                         PGI versions doesn't support shared libraries on 64-bit
+                         macOS.
+                         ")
+        elseif (CMAKE_C_COMPILER_VERSION VERSION_LESS 18.4)
+                message (FATAL_ERROR
+                         "
+                         PGI compiler before verison 18.4 doesn't support 64-bit
+                         shared libraries on macOS. Use older 32-bit version of
+                         the compiler instead.
+                         ")
+        endif()
 endif()

 set (PLIBSYS_THREAD_MODEL posix)


try to detect hdf5 64bit mode

try to detect hdf5 64bit mode

git-svn-id: 31d9d2f6432a47c86a3640814024c107794ea77c@31594 0785d39b-7218-0410-832d-ea1e28bc413d

--- deal.II/cmake/modules/FindHDF5.cmake
+++ deal.II/cmake/modules/FindHDF5.cmake
@@ -49,7 +49,7 @@
     lib${LIB_SUFFIX} lib64 lib
   )

-FIND_FILE(HDF5_PUBCONF H5pubconf.h
+FIND_FILE(HDF5_PUBCONF NAMES H5pubconf.h H5pubconf-64.h
   HINTS
     ${HDF5_INCLUDE_DIR}
     ${HDF5_DIR}


Clang-Tidy: have issues with headers reported when using either Make or Ninja as a CMake generator.

--- cmake/common.cmake
+++ cmake/common.cmake
@@ -167,7 +167,13 @@
       set(_CLANG_TIDY_WARNINGS_AS_ERRORS ";-warnings-as-errors=${_CLANG_TIDY_CHECKS}")
     endif()

-    set(_HEADER_FILTER_DIR "${CMAKE_SOURCE_DIR}/src/")
+    if("${CMAKE_GENERATOR}" STREQUAL "Ninja")
+      file(RELATIVE_PATH _HEADER_FILTER_DIR ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR})
+      set(_HEADER_FILTER_DIR "${CMAKE_BINARY_DIR}/${_HEADER_FILTER_DIR}src/")
+    else()
+      set(_HEADER_FILTER_DIR "${CMAKE_SOURCE_DIR}/src/")
+    endif()
+
     string(REPLACE "." "\\\."
            _HEADER_FILTER_DIR "${_HEADER_FILTER_DIR}")
     string(REPLACE "/" "\\\/"