Updates of the Matlab package

Updates of the Matlab package

git-svn-id: ffa0477179a225c7c90b98ebb17cced7db4a2d00@352 3149698f-976c-419d-aa71-eec1decff2c2

--- extensions/FindMatlab.cmake
+++ extensions/FindMatlab.cmake
@@ -1,63 +1,69 @@
 #.rst:
 # FindMatlab
-# ----------------
+# ----------
 #
 # Finds Matlab installations and provides Matlab tools and libraries to cmake.
 #
-# This package first intention is finding the libraries associated with Matlab in order
-# to be able to compile Matlab extensions (mex files). It can also be used to run unit test on these mex extensions,
-# and run Matlab.
-#
-# The variable ``MATLAB_USER_ROOT`` may be specified in order to give the path of the desired Matlab version.
-# Otherwise, the behaviour is platform dependant:
-#
-# - on Windows, the installed versions of Matlab are retrieved from the Windows registry
-# - on Mac, the installed versions of Matlab are given by the MATLAB pathes in /Application
-# - on Unix, the desired Matlab should be accessible from the PATH.
-#
-# Additional information is provided when ``MATLAB_FIND_DEBUG`` is set.
-# When a Matlab binary is found automatically and the ``MATLAB_VERSION`` is not given, then the
-# version is queried from Matlab directly. On Windows, it can make a window running Matlab appear.
-#
-# The mapping of the release names and the version of Matlab is performed by defining pairs (name, version).
-# The variable ``MATLAB_ADDITIONAL_VERSIONS`` may be provided in order to handle additional versions, in the following form:
+# This package first intention is to find the libraries associated with Matlab
+# in order to be able to build Matlab extensions (mex files). It can also be
+# used to run unit test on these mex extensions, and run specific commands on Matlab.
 #
 # ::
 #
-#    set(MATLAB_ADDITIONAL_VERSIONS
-#       "release_name1" "corresponding_version1"
-#       "release_name2" "corresponding_version2"
-#       ...
-#       )
+#    find_package(Matlab
+#                 [VERSION]
+#                 [REQUIRED]
+#                 [COMPONENTS component1 [component2]])
 #
-# such as
-# ::
+# The supported components are:
 #
-#    set(MATLAB_ADDITIONAL_VERSIONS
-#        "R2013b" "8.2"
-#        "R2013a" "8.1"
-#        "R2012b" "8.0")
-#
-# Starting Matlab R2013b+, it is possible to use Matlab unit test framework. The syntax is the following
-# ::
+# * ``MX_LIBRARY``
+# * ``ENG_LIBRARY``
+# * ``MAIN_PROGRAM``
+#
+# .. note:
 #
-#    add_matlab_unit_test(
-#       NAME <name>
-#       UNITTEST_FILE matlab_file_containing_unittest.m
-#       [TIMEOUT timeout]
-#       [ADDITIONAL_PATH path1 path2 ...]
-#       [TEST_ARGS additionnal_arguments1 ...]
-#    )
+# The version above is the Matlab version, which should not be confused with the Matlab release name (eg. `R2014`).
+# The :command:`matlab_get_version_from_release_name` and :command:`matlab_get_release_name_from_version` allow a mapping
+# from the release name to the version.
 #
-# in particular, the arguments accepted by add_test can be passed through TEST_ARGS (eg. CONFIGURATION <config> ...).
-#
-# Defined variables
-# -----------------
-# * ``Matlab_FOUND`` true if the Matlab installation is found.
-# * ``MATLAB_USER_ROOT`` the root of the Matlab installation. This is given by the user.
+# The variable :variable:`MATLAB_USER_ROOT` may be specified in order to give the path
+# of the desired Matlab version.  Otherwise, the behaviour is platform
+# dependent:
+#
+# * Windows: The installed versions of Matlab are retrieved from the
+#   Windows registry
+# * OS X: The installed versions of Matlab are given by the MATLAB
+#   paths in /Application
+# * Unix: The desired Matlab should be accessible from the PATH.
+#
+# Additional information is provided when :variable:`MATLAB_FIND_DEBUG` is set.
+# When a Matlab binary is found automatically and the ``MATLAB_VERSION``
+# is not given, then the version is queried from Matlab directly.
+# On Windows, it can make a window running Matlab appear.
+#
+# The mapping of the release names and the version of Matlab is performed by
+# defining pairs (name, version).  The variable :variable:`MATLAB_ADDITIONAL_VERSIONS`
+# may be provided before the call to the findMatlab in order to handle additional versions.
+#
+# Matlab scripts can be added to cmake test using :command:`matlab_add_unit_test`.
+# framework. By default, the Matlab unit test framework will be used (>= 2013a), but
+# regular ``.m`` files returning an exit code can be used as well.
+#
+# User defined variables
+# ----------------------
+#
+# * :variable:`MATLAB_USER_ROOT` the root of the Matlab installation. This is given by the user.
+# * :variable:`MATLAB_FIND_DEBUG` outputs debug information
+# * :variable:`MATLAB_ADDITIONAL_VERSIONS` additional versions of Matlab to look for.
+#
+# Variables defined by the module
+# -------------------------------
+#
+# * ``Matlab_FOUND`` ``TRUE`` if the Matlab installation is found, ``FALSE`` otherwise. All variable below are defined if Matlab is found.
 # * ``Matlab_ROOT_DIR`` the root of the Matlab installation determined by the FindMatlab module.
 # * ``Matlab_VERSION_STRING`` the version of the Matlab installation
-# * ``Matlab_PROGRAM`` the Matlab binary program. Available only if the component ``MAIN_PROGRAM`` is asked
+# * ``Matlab_MAIN_PROGRAM`` the Matlab binary program. Available only if the component ``MAIN_PROGRAM`` is given in the :command:`find_package` directive.
 # * ``Matlab_INCLUDE_DIRS`` the path of the Matlab libraries headers
 # * ``Matlab_MEX_LIBRARY`` library for mex
 # * ``Matlab_MX_LIBRARY`` mx library of Matlab (arrays). Available only if the component ``MX_LIBRARY`` is asked
@@ -66,26 +72,52 @@
 # * ``Matlab_MEX_COMPILER`` the mex compiler of Matlab. Currently not used internally. Available only if the component ``MEX_COMPILER`` is asked
 # * ``Matlab_MEX_EXTENSION`` the extension of the mex files for the current platform (given by Matlab).
 #
-#
-# Defined macros
+# Provided macros
+# ---------------
+#
+# * :command:`matlab_get_version_from_release_name` returns the version from the release name
+# * :command:`matlab_get_release_name_from_version` returns the release name from the Matlab version
+#
+# Provided functions
+# ------------------
+#
+# * :command:`matlab_add_mex` adds a target compiling a MEX file.
+# * :command:`matlab_add_unit_test` adds a Matlab unit test file as a test to the project.
+# * :command:`matlab_extract_all_installed_versions_from_registry` parses the registry for all Matlab versions. Available on Windows only.
+#   The part of the registry parsed is dependent on the host processor
+# * :command:`matlab_get_all_valid_matlab_roots_from_registry` returns all the possible Matlab paths, according to a previously given list. Only the
+#   existing/accessible paths are kept. This is mainly useful for the "brute force" search of Matlab installation.
+# * :command:`matlab_get_mex_suffix` returns the suffix to be used for the mex files (platform/architecture dependant)
+# * :command:`matlab_get_version_from_matlab_run` returns the version of Matlab, given the full directory of the Matlab program.
+#
+#
+# Reference
 # --------------
-# * ``matlab_get_version_from_release_name`` returns the version from the release name
-# * ``matlab_get_release_name_from_version`` returns the release name from the Matlab version
-#
-# Defined functions
-# --------------
-# * ``add_matlab_mex`` adds a target compiling a MEX file.
-# * ``add_matlab_unit_test`` adds a Matlab unit test file as a test to the project.
-# * ``matlab_extract_all_installed_versions_from_registry`` parses the registry for all Matlab versions. Available on Windows only.
-#   The part of the registry parsed is dependent on the host processor
-# * ``matlab_get_all_valid_matlab_roots_from_registry`` returns all the possible Matlab paths, according to a previously given list. Only the
-#   existing/accessible paths are kept. This is mainly useful for the "brute force" search of Matlab installation.
-# * ``matlab_get_mex_suffix`` returns the suffix to be used for the mex files (platform/architecture dependant)
-# * ``matlab_get_version_from_matlab_run`` returns the version of Matlab, given the full directory of the Matlab program.
+#
+# .. variable:: MATLAB_USER_ROOT
+#
+# The root folder of the Matlab installation. This is given by the user and is optional in some cirucmstances.
+#
+# .. variable:: MATLAB_FIND_DEBUG
 #
-# Future work
-# -----------
-# - win32:an additional variable telling that the registry is x86 or x64, maybe depending on the target build.
+# If set, the lookup of Matlab and the intermediate configuration steps are outputed to the console.
+#
+# .. variable:: MATLAB_ADDITIONAL_VERSIONS
+#
+# The form of the variable is to associate the name of the Matlab versions with their version::
+#
+#    set(MATLAB_ADDITIONAL_VERSIONS
+#       "release_name1" "corresponding_version1"
+#       "release_name2" "corresponding_version2"
+#       ...
+#       )
+#
+# Example::
+#
+#    set(MATLAB_ADDITIONAL_VERSIONS
+#        "R2013b" "8.2"
+#        "R2013a" "8.1"
+#        "R2012b" "8.0")

 #=============================================================================
 # Copyright 2009-2014 Raffi Enficiaud
@@ -100,6 +132,8 @@
 # (To distribute this file outside of CMake, substitute the full
 #  License text for the above reference.)

+set(_FindMatlab_SELF_DIR "${CMAKE_CURRENT_LIST_DIR}")
+
 include(FindPackageHandleStandardArgs)

@@ -129,7 +163,10 @@
   file(MAKE_DIRECTORY ${_matlab_temporary_folder})
 endif()

-# get the version of Matlab (17.58) from a release name (R2017k)
+#.rst:
+# .. command:: matlab_get_version_from_release_name
+#
+# Returns the version of Matlab (17.58) from a release name (R2017k)
 macro (matlab_get_version_from_release_name release_name version_name)
   list(FIND MATLAB_VERSIONS_MAPPING ${release_name} _index)
   if(${_index} EQUAL -1)
@@ -143,7 +180,10 @@
 endmacro(matlab_get_version_from_release_name)

-# get the release name (R2017k) from the version of Matlab (17.58)
+#.rst:
+# .. command:: matlab_get_release_name_from_version
+#
+# Returns the release name (R2017k) from the version of Matlab (17.58)
 macro (matlab_get_release_name_from_version version release_name)
   list(FIND MATLAB_VERSIONS_MAPPING ${version} _index)
   if(${_index} EQUAL -1)
@@ -179,13 +219,18 @@
 endmacro(matlab_get_supported_versions)

-
-# This function parses the registry and founds the Matlab versions that are "really" installed
-# the other approach is to use a brute force search
-# set win64 to TRUE if the 64 bit version of Matlab should be looked for
-# the returned list contains all versions under HKLM\\SOFTWARE\\Mathworks\\MATLAB or an empty list in case an error occurred (or nothing found)
-#
-# Only the version is provided: no path, no test for existence
+#.rst:
+# .. command:: matlab_extract_all_installed_versions_from_registry
+#
+# This function parses the registry and founds the Matlab versions that are installed. The found versions
+# are returned in `matlab_versions`.
+# Set `win64` to `TRUE` if the 64 bit version of Matlab should be looked for
+# The returned list contains all versions under `HKLM\\SOFTWARE\\Mathworks\\MATLAB` or an empty list in case an error occurred (or nothing found)
+#
+# .. note:
+#
+# Only the versions are provided. No check is made over the existance of the installation referenced in the registry,
+#
 function(matlab_extract_all_installed_versions_from_registry win64 matlab_versions)

   if(NOT CMAKE_HOST_WIN32)
@@ -200,7 +245,6 @@
   # from cmake, curiously, as is. The command provides the desired result under the command line though.
   # Fix: this is because "/reg:64" should appended to the command, otherwise it gets on the 32 bits software key (curiously again)
   find_program(MATLAB_REG_EXE_LOCATION "reg")
-  file(TO_NATIVE_PATH ${MATLAB_REG_EXE_LOCATION} MATLAB_REG_EXE_LOCATION)

   # if reg.exe is not found, then it is impossible to use this method.
   if(NOT MATLAB_REG_EXE_LOCATION)
@@ -260,6 +304,7 @@

 endfunction(matlab_extract_all_installed_versions_from_registry)

+# (internal)
 macro(extract_matlab_versions_from_registry_brute_force matlab_versions)
   # get the supported versions
   set(matlab_supported_versions)
@@ -302,11 +347,25 @@

 endmacro(extract_matlab_versions_from_registry_brute_force)

-
-# populates the Matlab root with valid versions of Matlab. The matlab_versions comes either from
-# extract_matlab_versions_from_registry_brute_force or matlab_extract_all_installed_versions_from_registry.
-# The returned matlab_roots is organized in pairs version_number,matlab_root_path.
+#.rst:
+# .. command:: matlab_get_all_valid_matlab_roots_from_registry
+#
+# Populates the Matlab root with valid versions of Matlab.
+# The returned matlab_roots is organized in pairs ``(version_number,matlab_root_path)``.
+#
+# ::
+#
+#    matlab_get_all_valid_matlab_roots_from_registry(
+#      matlab_versions
+#      matlab_roots)
+#
+# * ``matlab_versions`` the versions of each of the Matlab installations
+# * ``matlab_roots`` the location of each of the Matlab installations
 function(matlab_get_all_valid_matlab_roots_from_registry matlab_versions matlab_roots)
+
+  # The matlab_versions comes either from
+  # extract_matlab_versions_from_registry_brute_force or matlab_extract_all_installed_versions_from_registry.
+

   set(_matlab_roots_list )
   foreach(_matlab_current_version ${matlab_versions})
@@ -325,9 +384,20 @@
   unset(_matlab_roots_list)
 endfunction(matlab_get_all_valid_matlab_roots_from_registry)

-
-# returns the extension of the mex files (the suffixes).
+#.rst:
+# .. command:: matlab_get_mex_suffix
+#
+#    Returns the extension of the mex files (the suffixes).
 # This function should not be called before the appropriate Matlab root has been found.
+#
+# ::
+#
+#   matlab_get_mex_suffix(
+#     matlab_root
+#     mex_suffix)
+#
+# * ``matlab_root`` the root of the Matlab installation
+# * ``mex_suffix`` the variable name in which the suffix will be returned.
 function(matlab_get_mex_suffix matlab_root mex_suffix)

   # todo setup the extension properly. Currently I do not know if this is sufficient for all win32 distributions.
@@ -380,12 +450,19 @@
 endfunction(matlab_get_mex_suffix)

-
+#.rst:
 # .. command:: matlab_get_version_from_matlab_run
 #
-#   This function runs Matlab specified on arguments and extracts its version.
+# This function runs Matlab program specified on arguments and extracts its version.
+#
+# ::
+#
+#    matlab_get_version_from_matlab_run(
+#      matlab_binary_path
+#      matlab_list_versions)
 #
-#   matlab_get_version_from_matlab_run(matlab_binary_path matlab_version)
+# * ``matlab_binary_path`` the location of the matlab program
+# * ``matlab_list_versions`` the version extracted from Matlab
 function(matlab_get_version_from_matlab_run matlab_binary_program matlab_list_versions)

   set(${matlab_list_versions} "" PARENT_SCOPE)
@@ -468,23 +545,43 @@
 endfunction(matlab_get_version_from_matlab_run)

-# .. command:: add_matlab_unit_test
-#
-#   Adds a Matlab unit test.
-#   The unit test uses the Matlab unittest framework, which is available starting Matlab 2013b+. The function expects
-#   one Matlab unit test file to be given.
+#.rst:
+# .. command:: matlab_add_unit_test
+#
+#   Adds a Matlab unit test to the test set of cmake/ctest.
+# The unit test uses the Matlab unittest framework (default, available starting Matlab 2013b+) except if the option ``NO_UNITTEST_FRAMEWORK`` is given.
+#   The function expects one Matlab test script file to be given.
+# In the case ``NO_UNITTEST_FRAMEWORK`` is given, the unittest script file should contain the script to be run, plus an exit command with the exit value.
+#   This exit value will be passed to the ctest framework (0 success, non 0 failure).
+# Additional arguments accepted by :command:`add_test` can be passed through ``TEST_ARGS`` (eg. ``CONFIGURATION <config> ...``).
+#
+# ::
+#
+#    matlab_add_unit_test(
+#      NAME <name>
+#      UNITTEST_FILE matlab_file_containing_unittest.m
+#      [UNITTEST_PRECOMMAND matlab_command_to_run]
+#      [TIMEOUT timeout]
+#      [ADDITIONAL_PATH path1 [path2 ...]]
+#      [MATLAB_ADDITIONAL_STARTUP_OPTIONS option1 [option2 ...]]
+#      [TEST_ARGS arg1 [arg2 ...]]
+#      [NO_UNITTEST_FRAMEWORK]
+#      )
+#
 #   The function arguments are:
-#   * `NAME` name of the unittest in ctest.
-#   * `UNITTEST_FILE` the matlab unittest file. Its path will be automatically added to the Matlab path.
-#   * `TIMEOUT` the test timeout in seconds (optional, defaults to 180 seconds).
-#   * `ADDITIONAL_PATH` a list of paths to add to the Matlab path prior to running the unit test.
-#   * `MATLAB_ADDITIONAL_STARTUP_OPTIONS` a list of additional option in order to run Matlab from the command line.
-#   * `TEST_ARGS` Additional options provided to the add_test command. These options are added to the default
-#      options (eg. "CONFIGURATIONS Release")
-#
-function(add_matlab_unit_test)
-  set(options )
-  set(oneValueArgs NAME UNITTEST_FILE TIMEOUT)
+#
+# * ``NAME`` name of the unittest in ctest.
+# * ``UNITTEST_FILE`` the matlab unittest file. Its path will be automatically added to the Matlab path.
+# * ``UNITTEST_PRECOMMAND``: Matlab script command to be ran before the file containing the test (eg. GPU device initialisation based on CMake variables)
+# * ``TIMEOUT`` the test timeout in seconds. Defaults to 180 seconds as the Matlab unit test may hang.
+# * ``ADDITIONAL_PATH`` a list of paths to add to the Matlab path prior to running the unit test.
+# * ``MATLAB_ADDITIONAL_STARTUP_OPTIONS`` a list of additional option in order to run Matlab from the command line.
+# * ``TEST_ARGS`` Additional options provided to the add_test command. These options are added to the default options (eg. "CONFIGURATIONS Release")
+# * ``NO_UNITTEST_FRAMEWORK``: an option indicating that the test should not use the unittest framework from Matlab (>= R2013a).
+#
+function(matlab_add_unit_test)
+  set(options NO_UNITTEST_FRAMEWORK)
+  set(oneValueArgs NAME UNITTEST_PRECOMMAND UNITTEST_FILE TIMEOUT)
   set(multiValueArgs ADDITIONAL_PATH MATLAB_ADDITIONAL_STARTUP_OPTIONS TEST_ARGS)

   set(prefix _matlab_unittest_prefix)
@@ -500,21 +597,26 @@
             -Dadditional_paths=${${prefix}_ADDITIONAL_PATH}
             -Dtest_timeout=${${prefix}_TIMEOUT}
             -Doutput_directory=${_matlab_temporary_folder}
-            -DMatlab_PROGRAM=${Matlab_PROGRAM}
+            -DMatlab_PROGRAM=${Matlab_MAIN_PROGRAM}
+            -Dno_unittest_framework=${${prefix}_NO_UNITTEST_FRAMEWORK}
             -DMatlab_ADDITIONNAL_STARTUP_OPTIONS=${${prefix}_MATLAB_ADDITIONAL_STARTUP_OPTIONS}
             -Dunittest_file_to_run=${${prefix}_UNITTEST_FILE}
-            -P ${CMAKE_SOURCE_DIR}/extensions/FindMatlab_TestsRedirect.cmake
+            -Dcmd_to_run_before_test=${${prefix}_UNITTEST_PRECOMMAND}
+            -P ${_FindMatlab_SELF_DIR}/MatlabTestsRedirect.cmake
            ${${prefix}_TEST_ARGS}
            ${${prefix}_UNPARSED_ARGUMENTS}
            )
-endfunction(add_matlab_unit_test)
-
-
-# .. command:: add_matlab_mex
-#
-#   Adds a Matlab MEX file.
+endfunction(matlab_add_unit_test)
+
+
+#.rst:
+# .. command:: matlab_add_mex
+#
+#   Adds a Matlab MEX target
+#
 #   ::
-#       add_matlab_mex(
+#
+#       matlab_add_mex(
 #          NAME <name>
 #          SRC src1 [src2 ...]
 #          [REDUCE_VISIBILITY]
@@ -523,24 +625,31 @@
 #          [LINK_TO target1 target2 ...]
 #       )
 #
-#   `NAME` name of the target. `SRC` is a list of source files. `LINK_TO` is a list of additional link dependencies.
-#   The target already links to libmex and libmx.
-#   If `OUTPUT_NAME` is given, it overrides the default name defined as being the name of the target without any prefix and
-#   with `${Matlab_MEX_EXTENSION}` suffix.
-#   Use the option `REDUCE_VISIBILITY` to hide every symbols inside the compiled MEX file. This is useful in case their is a
-#   symbol collision between the libraries shipped with Matlab, and the libraries to which the target is linking with. This
-#   option is ignored on DLL platforms.
-#   If `DOCUMENTATION` is given, the file documentation.m is considered as being the documentation file for the MEX file. This
-#   file is copied into the same folder with the same name as the final mex file, and with extension .m. In that case, typing
-#   `help <name>` should print the documentation contained in this file.
-#
-function(add_matlab_mex )
-
+# * ``NAME`` name of the target.
+# * ``SRC`` is a list of source files.
+# * ``LINK_TO`` a list of additional link dependencies.  The target already links to libmex and libmx.
+# * ``OUTPUT_NAME`` if given, overrides the default name (defined as being the name of the target without any prefix and
+#   with ``Matlab_MEX_EXTENSION`` suffix.
+# * ``REDUCE_VISIBILITY`` Use the option to hide every symbols inside the compiled MEX file. This is useful in case their is a
+#   symbol collision between the libraries shipped with Matlab, and the libraries to which the target is linking with. This option is ignored
+#   on DLL platforms.
+# * ``DOCUMENTATION`` if given, the file ``documentation.m`` is considered as being the documentation file for the MEX file. This
+#   file is copied into the same folder with the same name as the final mex file, and with extension `.m`. In that case, typing
+#   ``help <name>`` within Matla prints the documentation contained in this file .
+#
+function(matlab_add_mex )
+
+  if(NOT WIN32)
+    # we do not need all this on Windows
   # pthread options
   check_cxx_compiler_flag(-pthread                    HAS_MINUS_PTHREAD)
   # visbility options
   check_cxx_compiler_flag(-fvisibility=hidden         HAS_VISIBILITY_HIDDEN)
   check_cxx_compiler_flag(-fvisibility-inlines-hidden HAS_VISIBILITY_INLINE_HIDDEN)
+    # we should use try_compile instead, the link flags are discarded from this compiler_flag function.
+    #check_cxx_compiler_flag(-Wl,--exclude-libs,ALL HAS_SYMBOL_HIDING_CAPABILITY)
+
+  endif()

   set(options REDUCE_VISIBILITY)
   set(oneValueArgs NAME DOCUMENTATION OUTPUT_NAME)
@@ -599,12 +708,40 @@
       # defined in the matlab process. So by default the symbols are hidden.
       # this also means that for shared libraries (like MEX), the entry point should be explicitely
       # declared with default visibility, otherwise Matlab cannot find the entry point.i
+      # Note that this is particularly meaningful if the MEX wrapper itself contains symbols that are clashing with Matlab
+      # (that are compiled in the MEX file). In order to propagate the visibility options to the libraries to which
+      # the MEX file is linked against, the -Wl,--exclude-libs,ALL option should also be specified.
       if(HAS_VISIBILITY_INLINE_HIDDEN)
         target_compile_options(${${prefix}_NAME} PRIVATE "-fvisibility-inlines-hidden")
       endif()
       if(HAS_VISIBILITY_HIDDEN)
         target_compile_options(${${prefix}_NAME} PRIVATE "-fvisibility=hidden")
       endif()
+
+
+      get_target_property(
+        _previous_link_flags
+        ${${prefix}_NAME}
+        LINK_FLAGS)
+      if(NOT _previous_link_flags)
+        set(_previous_link_flags)
+      endif()
+
+      if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
+        set_target_properties(${${prefix}_NAME}
+          PROPERTIES
+            LINK_FLAGS "${_previous_link_flags} -Wl,--exclude-libs,ALL"
+            # -Wl,--version-script=${_FindMatlab_SELF_DIR}/MatlabLinuxVisibility.map"
+        )
+      elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+        # in this case, all other symbols become hidden.
+        set_target_properties(${${prefix}_NAME}
+          PROPERTIES
+            LINK_FLAGS "${_previous_link_flags} -Wl,-exported_symbol,_mexFunction"
+            #-Wl,-exported_symbols_list,${_FindMatlab_SELF_DIR}/MatlabOSXVisilibity.map"
+        )
+      endif()
+
     endif()

     set_target_properties(${${prefix}_NAME}
@@ -613,7 +750,14 @@
     )
   endif()

-endfunction(add_matlab_mex)
+endfunction(matlab_add_mex)
+
+
+
+
+
+
+

 # this variable will get all Matlab installations found in the current system.
 set(_matlab_possible_roots)
@@ -625,7 +769,7 @@
   # for windows

-  if((NOT DEFINED MATLAB_USER_ROOT) OR (NOT MATLAB_USER_ROOT))
+  if(NOT MATLAB_USER_ROOT)
     # if MATLAB_USER_ROOT not specified, we look for Matlab installation in the registry
     # if unsuccessful, we look for all known revision and filter the existing ones.

@@ -654,49 +798,64 @@
     if(MATLAB_FIND_DEBUG)
       message(WARNING "[MATLAB] the specified path for MATLAB_USER_ROOT does not exist (${MATLAB_USER_ROOT})")
     endif()
+  else()
+    list(APPEND _matlab_possible_roots "NOTFOUND" ${MATLAB_USER_ROOT}) # empty version
   endif()

 else()
   # for linux/osx

-  if((NOT DEFINED MATLAB_USER_ROOT) OR (NOT MATLAB_USER_ROOT))
+  if(NOT MATLAB_USER_ROOT)

     # if MATLAB_USER_ROOT not specified, we look for Matlab from the command line PATH
     # maybe using CMAKE_PROGRAM_PATH to add some more hints
+    if(NOT Matlab_MAIN_PROGRAM)
+      # if we get there a second time and the folder matlab is created here, then the find_program does
+      # does not find it, and the get_filename_component (... PROGRAM) finds this directory instead.
     find_program(
-      Matlab_PROGRAM
+        Matlab_MAIN_PROGRAM
       "matlab")
-
-    if(NOT ${Matlab_PROGRAM})
+    endif()
+
+    if(NOT Matlab_MAIN_PROGRAM)
       #execute_process(COMMAND which matlab OUTPUT_VARIABLE _which_matlab RESULT_VARIABLE _which_matlab_result)
-      get_filename_component(Matlab_PROGRAM "matlab" PROGRAM)
-      get_filename_component(Matlab_PROGRAM ${Matlab_PROGRAM} ABSOLUTE)
-      if(EXISTS ${Matlab_PROGRAM})
+      get_filename_component(Matlab_MAIN_PROGRAM "matlab" PROGRAM)
+
+      # "bug" of cmake: if we call get_filename_component with PROGRAM, it can return us a directory
+      if((NOT EXISTS ${Matlab_MAIN_PROGRAM}) OR (IS_DIRECTORY ${Matlab_MAIN_PROGRAM}))
+        execute_process(
+          COMMAND "which matlab"
+          OUTPUT_VARIABLE Matlab_MAIN_PROGRAM)
+      endif()
+
+      if(EXISTS ${Matlab_MAIN_PROGRAM})
+        get_filename_component(Matlab_MAIN_PROGRAM "${Matlab_MAIN_PROGRAM}" REALPATH)
+        get_filename_component(Matlab_MAIN_PROGRAM "${Matlab_MAIN_PROGRAM}" ABSOLUTE)
         if(MATLAB_FIND_DEBUG)
-          message(STATUS "[MATLAB] matlab program result from the command line ${Matlab_PROGRAM}")
+          message(STATUS "[MATLAB] matlab program result from the command line ${Matlab_MAIN_PROGRAM}")
         endif()
       else()
-        unset(Matlab_PROGRAM)
+        unset(Matlab_MAIN_PROGRAM)
       endif()

     endif()

-    if(Matlab_PROGRAM AND EXISTS ${Matlab_PROGRAM})
+    if(Matlab_MAIN_PROGRAM AND EXISTS ${Matlab_MAIN_PROGRAM})
       if(MATLAB_FIND_DEBUG)
-        message(STATUS "[MATLAB] found from the command line at ${Matlab_PROGRAM}")
+        message(STATUS "[MATLAB] found from the command line at ${Matlab_MAIN_PROGRAM}")
       endif()

       # resolve symlinks
-      get_filename_component(_matlab_current_location ${Matlab_PROGRAM} REALPATH)
+      get_filename_component(_matlab_current_location "${Matlab_MAIN_PROGRAM}" REALPATH)
       if(${CMAKE_VERSION} VERSION_LESS "2.8.12")
         set(_directory_alias PATH)
       else()
         set(_directory_alias DIRECTORY)
       endif()
       # get the directory (the command below has to be run twice)
-      get_filename_component(_matlab_current_location ${_matlab_current_location} ${_directory_alias})
-      get_filename_component(_matlab_current_location ${_matlab_current_location} ${_directory_alias}) # Matlab should be in bin
+      get_filename_component(_matlab_current_location "${_matlab_current_location}" ${_directory_alias})
+      get_filename_component(_matlab_current_location "${_matlab_current_location}" ${_directory_alias}) # Matlab should be in bin
       list(APPEND _matlab_possible_roots "NOTFOUND" ${_matlab_current_location}) # empty version
     endif()

@@ -729,9 +888,9 @@
       unset(_matlab_releases)
     endif()

-    # we need to clear Matlab_PROGRAM here
-    unset(Matlab_PROGRAM CACHE)
-    unset(Matlab_PROGRAM)
+    # we need to clear Matlab_MAIN_PROGRAM here
+    unset(Matlab_MAIN_PROGRAM CACHE)
+    unset(Matlab_MAIN_PROGRAM)

   elseif(NOT EXISTS ${MATLAB_USER_ROOT})
     # if MATLAB_USER_ROOT specified but erroneous
@@ -747,7 +906,6 @@
 if(MATLAB_FIND_DEBUG)
   message(STATUS "[MATLAB] Matlab root folders are ${_matlab_possible_roots}")
 endif()
-

@@ -770,12 +928,12 @@
 endif()

 if(${Matlab_VERSION_STRING} STREQUAL "NOTFOUND")
-  if((NOT DEFINED Matlab_PROGRAM) OR (NOT ${Matlab_PROGRAM}) OR (NOT EXISTS ${Matlab_PROGRAM}))
+  if((NOT Matlab_MAIN_PROGRAM) OR (NOT EXISTS ${Matlab_MAIN_PROGRAM}))
     if(MATLAB_FIND_DEBUG)
-      message(STATUS "[MATLAB] - Unknown version, looking for Matlab under ${Matlab_ROOT_DIR}")
+      message(STATUS "[MATLAB] Unknown version, looking for Matlab under ${Matlab_ROOT_DIR}")
     endif()
     find_program(
-      Matlab_PROGRAM
+      Matlab_MAIN_PROGRAM
       matlab
       PATHS ${Matlab_ROOT_DIR} ${Matlab_ROOT_DIR}/bin
       DOC "Matlab main program"
@@ -784,16 +942,16 @@

-    if(Matlab_PROGRAM)
+    if(Matlab_MAIN_PROGRAM)
       set(matlab_list_of_all_versions)
-      matlab_get_version_from_matlab_run(${Matlab_PROGRAM} matlab_list_of_all_versions)
+      matlab_get_version_from_matlab_run(${Matlab_MAIN_PROGRAM} matlab_list_of_all_versions)

       list(GET matlab_list_of_all_versions 0 MATLAB_VERSION_tmp)

       # set the version into the cache
-      set(Matlab_VERSION_STRING ${MATLAB_VERSION_tmp})# CACHE STRING "Matlab version (automatically determined)")
+      set(Matlab_VERSION_STRING ${MATLAB_VERSION_tmp} CACHE STRING "Matlab version (automatically determined)")
       list(LENGTH list_of_all_versions list_of_all_versions_length)
-      if(${list_of_all_versions_length} GREATER 1)
+      if((${list_of_all_versions_length} GREATER 1) AND MATLAB_FIND_DEBUG)
         message(WARNING "[MATLAB] Found several versions, taking the first one (versions found ${list_of_all_versions})")
       endif()
     endif()
@@ -807,8 +965,9 @@

-
-file(TO_CMAKE_PATH ${Matlab_ROOT_DIR} Matlab_ROOT_DIR)
+if(Matlab_ROOT_DIR)
+  file(TO_CMAKE_PATH ${Matlab_ROOT_DIR} Matlab_ROOT_DIR)
+endif()

 if(CMAKE_SIZEOF_VOID_P EQUAL 4)
   set(_matlab_64Build FALSE)
@@ -924,16 +1083,16 @@
 list(FIND Matlab_FIND_COMPONENTS MAIN_PROGRAM _matlab_find_matlab_program)
 if(_matlab_find_matlab_program GREATER -1)
   # todo cleanup with code above
-  if(NOT DEFINED Matlab_PROGRAM)
+  if(NOT DEFINED Matlab_MAIN_PROGRAM)
     find_program(
-      Matlab_PROGRAM
+      Matlab_MAIN_PROGRAM
       matlab
       PATHS ${Matlab_ROOT_DIR} ${Matlab_ROOT_DIR}/bin
       DOC "Matlab main program"
       NO_DEFAULT_PATH
     )
   endif()
-  if(Matlab_PROGRAM)
+  if(Matlab_MAIN_PROGRAM)
     set(Matlab_MAIN_PROGRAM_FOUND TRUE)
   endif()

@@ -1014,13 +1173,8 @@
     MATLAB_USER_ROOT
     Matlab_ROOT_DIR
     Matlab_VERSION_STRING
-    Matlab_PROGRAM
+    Matlab_MAIN_PROGRAM
     Matlab_MEX_EXTENSION
     Matlab_BINARIES_DIR
   )
 endif()
-
-
-
-
-


Fix FindCAF script

Fix FindCAF script

--- cmake/FindCAF.cmake
+++ cmake/FindCAF.cmake
@@ -2,7 +2,7 @@
 #
 # Use this module as follows:
 #
-#     find_package(CAF [COMPONENTS <core|io|opencl|...>*] [REQUIRED])
+#     find_package(CAF [COMPONENTS <core|io|openssl|...>*] [REQUIRED])
 #
 # Variables used by this module (they can change the default behaviour and need
 # to be set before calling find_package):
@@ -61,6 +61,7 @@
                 NAMES
                   caf/detail/build_config.hpp
                 HINTS
+                  ${CAF_ROOT_DIR}
                   ${header_hints}
                   /usr/include
                   /usr/local/include
@@ -71,7 +72,7 @@
         message(WARNING "Found all.hpp for CAF core, but not build_config.hpp")
         set(CAF_${comp}_FOUND false)
       else()
-        list(APPEND CAF_INCLUDE_DIR_${UPPERCOMP} "${caf_build_header_path}")
+        list(APPEND CAF_INCLUDE_DIRS "${caf_build_header_path}")
       endif()
     endif()
     list(APPEND CAF_INCLUDE_DIRS "${CAF_INCLUDE_DIR_${UPPERCOMP}}")
@@ -146,13 +147,6 @@
       INTERFACE_LINK_LIBRARIES "OpenSSL::SSL")
   endif ()
 endif ()
-if (CAF_opencl_FOUND AND NOT TARGET caf::opencl)
-  add_library(caf::opencl UNKNOWN IMPORTED)
-  set_target_properties(caf::opencl PROPERTIES
-    IMPORTED_LOCATION "${CAF_LIBRARY_OPENCL}"
-    INTERFACE_INCLUDE_DIRECTORIES "${CAF_INCLUDE_DIR_OPENCL}"
-    INTERFACE_LINK_LIBRARIES "caf::core")
-endif ()
 if (CAF_test_FOUND AND NOT TARGET caf::test)
   add_library(caf::test INTERFACE IMPORTED)
   set_target_properties(caf::test PROPERTIES


ENH: Change to CMAKE variable

ENH: Change to CMAKE variable

--- cmake/generic.cmake
+++ cmake/generic.cmake
@@ -264,10 +264,10 @@

   if (go_library_SHARED OR go_library_shared)
     set(BUILD_MODE "-buildmode=c-shared")
-    set(LIB_NAME "${LIBRARY_PREFIX}${TARGET_NAME}${SHARED_LIBRARY_SUFFIX}")
+    set(LIB_NAME "${CMAKE_SHARED_LIBRARY_PREFIX}${TARGET_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}")
   else()
     set(BUILD_MODE "-buildmode=c-archive")
-    set(LIB_NAME "${LIBRARY_PREFIX}${TARGET_NAME}${STATIC_LIBRARY_SUFFIX}")
+    set(LIB_NAME "${CMAKE_STATIC_LIBRARY_PREFIX}${TARGET_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}")
   endif()

   set(dummyfile ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}_dummy.c)


Windows installer: move from NSIS to WIX

--- cmake/package.cmake
+++ cmake/package.cmake
@@ -60,11 +60,6 @@
 INSTALL(FILES ${PROJECT_SOURCE_DIR}/README.md DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT lib)
 INSTALL(FILES ${CMAKE_BINARY_DIR}/readme.pdf DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT lib OPTIONAL)

-LIST(APPEND CPACK_NSIS_MENU_LINKS "${CMAKE_INSTALL_DOCDIR}/LICENSE.txt" "LICENSE")
-LIST(APPEND CPACK_NSIS_MENU_LINKS "${CMAKE_INSTALL_DOCDIR}/CHANGELOG.md" "CHANGELOG")
-LIST(APPEND CPACK_NSIS_MENU_LINKS "${CMAKE_INSTALL_DOCDIR}/README.md" "README.md")
-LIST(APPEND CPACK_NSIS_MENU_LINKS "${CMAKE_INSTALL_DOCDIR}/readme.pdf" "readme.pdf")
-
 ##############################################################
 # CPack specific stuff
 ##############################################################
@@ -122,23 +117,14 @@
   IF (OSPRAY_ZIP_MODE)
     SET(CPACK_GENERATOR ZIP)
     SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}.windows")
-  ELSE() # NSIS specific settings
-    SET(CPACK_GENERATOR NSIS)
-    SET(CPACK_COMPONENTS_ALL lib devel apps mpi)
-    SET(CPACK_NSIS_INSTALL_ROOT "\$PROGRAMFILES64\\\\Intel")
-    SET(CPACK_PACKAGE_INSTALL_DIRECTORY "OSPRay v${OSPRAY_VERSION}")
-    SET(CPACK_NSIS_DISPLAY_NAME "OSPRay v${OSPRAY_VERSION}")
-    SET(CPACK_NSIS_PACKAGE_NAME "OSPRay v${OSPRAY_VERSION}")
-    SET(CPACK_NSIS_URL_INFO_ABOUT http://www.ospray.org/)
-    #SET(CPACK_NSIS_HELP_LINK http://www.ospray.org/getting_ospray.html)
-    #SET(CPACK_NSIS_MUI_ICON ${PROJECT_SOURCE_DIR}/scripts/install_windows/icon32.ico)
-    SET(CPACK_NSIS_CONTACT ${CPACK_PACKAGE_CONTACT})
-    #SET(CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS ${CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS} "\n CreateDirectory \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\"")
-    #SET(CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS ${CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS} "\n CreateDirectory \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\documentation\\\"")
-    #SET(CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS ${CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS} "\n CreateDirectory \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\tutorials\\\" \n")
-    #SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS  ${CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS} "\n ${UNINSTALL_LIST}\n RMDir \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\documentation\\\"")
-    #SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS  ${CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS} "\n ${UNINSTALL_LIST}\n RMDir \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\tutorials\\\"")
-    #SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS  ${CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS} "\n ${UNINSTALL_LIST}\n RMDir \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\"\n")
+  ELSE()
+    SET(CPACK_GENERATOR WIX)
+    SET(CPACK_COMPONENTS_ALL lib devel apps mpi redist)
+    SET(CPACK_PACKAGE_INSTALL_DIRECTORY "Intel\\\\OSPRay v${OSPRAY_VERSION}")
+    MATH(EXPR OSPRAY_VERSION_NUMBER "10000*${OSPRAY_VERSION_MAJOR} + 100*${OSPRAY_VERSION_MINOR} + ${OSPRAY_VERSION_PATCH}")
+    SET(CPACK_WIX_PRODUCT_GUID "9D64D525-2603-4E8C-9108-845A146${OSPRAY_VERSION_NUMBER}")
+    SET(CPACK_WIX_UPGRADE_GUID "9D64D525-2603-4E8C-9108-845A146${OSPRAY_VERSION_MAJOR}0000") # upgrade as long as major version is the same
+    SET(CPACK_WIX_CMAKE_PACKAGE_REGISTRY TRUE)
   ENDIF()


Added a test for TraceBounds

Added a test for TraceBounds

--- plugin.cmake
+++ plugin.cmake
@@ -53,6 +53,11 @@
     PLUGIN HistomicsTK
 )

+add_python_test(segmentation_label
+    SUBMODULE TraceBoundsTest
+    PLUGIN HistomicsTK
+)
+
 # front-end tests
 add_web_client_test(
     HistomicsTK_schema "${PROJECT_SOURCE_DIR}/plugins/HistomicsTK/plugin_tests/client/parser.js"


build: default enable plugin

build: default enable plugin

--- plugin.cmake
+++ plugin.cmake
@@ -1,5 +1,5 @@
-message("PLUGIN CALLED")
-
 pv_plugin(vtkPCLFilters
   DESCRIPTION "PCL Filters"
-  AUTOLOAD)
+  AUTOLOAD
+  DEFAULT_ENABLED
+  )


ios.toolchain.xcode: use 64bit arch for simulator and add it to iOS build (#385)

as Apple mandates 64bit support for iOS

--- CMake/toolchain/ios.toolchain.xcode.cmake
+++ CMake/toolchain/ios.toolchain.xcode.cmake
@@ -151,9 +151,9 @@
 # set the architecture for iOS
 # NOTE: Currently both ARCHS_STANDARD_32_BIT and ARCHS_UNIVERSAL_IPHONE_OS set armv7 only, so set both manually
 if (${IOS_PLATFORM} STREQUAL "OS")
-  set (IOS_ARCH armv6 armv7)
+  set (IOS_ARCH armv7 arm64)
 else ()
-  set (IOS_ARCH i386)
+  set (IOS_ARCH x86_64)
 endif ()

 set (CMAKE_OSX_ARCHITECTURES ${IOS_ARCH} CACHE string  "Build architecture for iOS")


Fix typo that caused the system gmock sources not to be found.


added some comments and CUTI_USES_XCTEST_BACKEND flag when using xcode integration


renamed vars in add_gcov_target

renamed vars in add_gcov_target


Add _FILE_OFFSET_BITS to build stuff

Add _FILE_OFFSET_BITS to build stuff

--- src/toolbox/cmake/LStoreCommon.cmake
+++ src/toolbox/cmake/LStoreCommon.cmake
@@ -47,10 +47,12 @@
 # http://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html
 # _REENTRANT - tells the std library to enable reentrant functions
 # _GNU_SOURCE - uses GNU (not POSIX) functions
-# _LARGEFILE64_SOURCE - this should probably be changed to _FILE_OFFSET_BITS
+# _LARGEFILE64_SOURCE - Along with...
+# _FILE_OFFSET_BITS - Tell gcc that we want 64 bit offsets
 # TODO: Is this truely needed?
 # LINUX=2 - APR seems to want it
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE")
+
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64")
 set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0")

 # Find and link universal deps


Removed unused cmake module add_python_export_library.cmake (this is imported via   <build_depend>python_module</build_depend> in package.xml)


Release 1.9.1

Release 1.9.1

--- VERSION.cmake
+++ VERSION.cmake
@@ -1,3 +1,3 @@
 SET(LIBREPO_MAJOR "1")
 SET(LIBREPO_MINOR "9")
-SET(LIBREPO_PATCH "0")
+SET(LIBREPO_PATCH "1")


COMP: Restore use of Sun compiler flag -library=stlport4

This flag was originally added by commit f73456bf (Adding the -stlport4
compiler flag for the Sun CC compiler, 2009-04-05) but was removed
during modularization.  Restore it in the new modular build system.

--- CMake/ITKPlatformSpecificChecks.cmake
+++ CMake/ITKPlatformSpecificChecks.cmake
@@ -1,3 +1,5 @@
+include(itkCheckCXXAcceptsFlags)
+
 # On Visual Studio 8 MS deprecated C. This removes all 1.276E1265 security
 # warnings
 if(WIN32)
@@ -56,7 +58,6 @@
 if(CMAKE_COMPILER_IS_GNUCXX)
  set(ITK_REQUIRED_C_FLAGS "${ITK_REQUIRED_C_FLAGS} -Wall -Wno-uninitialized -Wno-unused-parameter")
  set(ITK_REQUIRED_CXX_FLAGS "${ITK_REQUIRED_CXX_FLAGS} -ftemplate-depth-50 -Wall")
- include(${ITK_SOURCE_DIR}/CMake/itkCheckCXXAcceptsFlags.cmake)
  itkCHECK_CXX_ACCEPTS_FLAGS("-Wno-deprecated" CXX_HAS_DEPRECATED_FLAG)
  if(CXX_HAS_DEPRECATED_FLAG)
    set(ITK_REQUIRED_CXX_FLAGS "${ITK_REQUIRED_CXX_FLAGS} -Wno-deprecated")
@@ -88,6 +89,15 @@
  endif(VNL_CONFIG_ENABLE_SSE2 OR VNL_CONFIG_ENABLE_SSE2_ROUNDING)
 endif(CMAKE_COMPILER_IS_GNUCXX)

+# Add flags for the SUN compiler to provide all the methods for std::allocator.
+#
+itkCHECK_CXX_ACCEPTS_FLAGS("-features=no%anachronisms" SUN_COMPILER)
+if(SUN_COMPILER)
+  itkCHECK_CXX_ACCEPTS_FLAGS("-library=stlport4" SUN_COMPILER_HAS_STL_PORT_4)
+  if(SUN_COMPILER_HAS_STL_PORT_4)
+    set(ITK_REQUIRED_CXX_FLAGS "${ITK_REQUIRED_CXX_FLAGS} -library=stlport4")
+  endif(SUN_COMPILER_HAS_STL_PORT_4)
+endif(SUN_COMPILER)

 #---------------------------------------------------------------
 # run try compiles and tests for ITK


MinGW: Default to using WIN32 threads.

MinGW: Default to using WIN32 threads.

CMake will find both Win32 threads and pthreads which will fail to compile. If both are enabled force pthreads off. Fixes bug 0011632.

--- CMake/vtkDetermineCompilerFlags.cmake
+++ CMake/vtkDetermineCompilerFlags.cmake
@@ -30,6 +30,12 @@
     LINK_LIBRARIES(-lgdi32)
   ENDIF(WIN32)
   IF(MINGW)
+    IF(CMAKE_USE_PTHREADS AND CMAKE_USE_WIN32_THREADS)
+      MESSAGE(STATUS
+        "Forcing CMAKE_USE_PTHREADS OFF as only one threading library should be used.")
+      SET(CMAKE_USE_PTHREADS OFF CACHE BOOL
+        "Force pthreads off if WIN32 threads are enabled" FORCE)
+    ENDIF()
     SET(VTK_REQUIRED_CXX_FLAGS "${VTK_REQUIRED_CXX_FLAGS} -mthreads")
     SET(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} -mthreads")
     SET(VTK_REQUIRED_EXE_LINKER_FLAGS "${VTK_REQUIRED_EXE_LINKER_FLAGS} -mthreads")


Add C++11 compiler flags

Add C++11 compiler flags

Required for Ifc library headers

--- biicode.cmake
+++ biicode.cmake
@@ -1,4 +1,8 @@
 find_package(OpenGL REQUIRED)
+
+IF(CMAKE_COMPILER_IS_GNUCXX)
+  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+ENDIF()

 ADD_BII_TARGETS()
 TARGET_LINK_LIBRARIES(${BII_BLOCK_TARGET} INTERFACE ${OPENGL_LIBRARIES})


ftgl: force the usage of the built freetype

--- superbuild/Projects/ftgl.cmake
+++ superbuild/Projects/ftgl.cmake
@@ -4,4 +4,6 @@
   DEPENDS freetype
   CMAKE_ARGS
     -DBUILD_SHARED_LIBS=ON
+    -DFREETYPE_INCLUDE_DIR_freetype2=<INSTALL_DIR>/include/freetype2
+    -DFREETYPE_INCLUDE_DIR_ft2build=<INSTALL_DIR>/include
   )


minor fix in cmake

minor fix in cmake


Added windows CURL includes

Added windows CURL includes

--- CMakeModules/KrisLibraryDependencies.cmake
+++ CMakeModules/KrisLibraryDependencies.cmake
@@ -139,6 +139,10 @@
     SET(KRISLIBRARY_DEFINITIONS ${KRISLIBRARY_DEFINITIONS} -DHAVE_CURL=1)
     SET(KRISLIBRARY_INCLUDE_DIRS ${KRISLIBRARY_INCLUDE_DIRS} ${CURL_INCLUDE_DIR})
     SET(KRISLIBRARY_LIBRARIES ${KRISLIBRARY_LIBRARIES} ${CURL_LIBRARY})
+    IF(WIN32)
+      SET(KRISLIBRARY_DEFINITIONS ${KRISLIBRARY_DEFINITIONS} -DCURL_STATICLIB)
+      SET(KRISLIBRARY_LIBRARIES ${KRISLIBRARY_LIBRARIES} wldap32.lib)
+    ENDIF(WIN32)
   ELSE(CURL_FOUND)
     MESSAGE("GLPK library not found, setting DHAVE_CURL=0")
   ENDIF(CURL_FOUND)


Added optional GLUT/GLUI/ASSIMP/GLPK/OMPL dependencies using the USE_X cmake command line argument

--- CMakeModules/KrisLibraryDependencies.cmake
+++ CMakeModules/KrisLibraryDependencies.cmake
@@ -43,28 +43,34 @@

 # GLUI
-SET(GLUI_ROOT_DIR "${KRISLIBRARY_ROOT}/glui-2.36/src" CACHE PATH "Root of src directory in GLUI Package" FORCE)
-# GLUI
-FIND_PACKAGE(GLUI)
-IF(GLUI_FOUND)
-  MESSAGE("GLUI library found")
-  SET(KRISLIBRARY_DEFINITIONS ${KRISLIBRARY_DEFINITIONS} -DHAVE_GLUI=1)
-  SET(KRISLIBRARY_INCLUDE_DIRS ${KRISLIBRARY_INCLUDE_DIRS} ${GLUI_INCLUDE_DIR} )
-  SET(KRISLIBRARY_LIBRARIES ${KRISLIBRARY_LIBRARIES} ${GLUI_LIBRARY})
-ELSE(GLUI_FOUND)
-  MESSAGE("GLUI library not found, setting HAVE_GLUI=0")
-ENDIF(GLUI_FOUND)
+OPTION(USE_GLUI "Build with GLUI support" ON)
+IF(USE_GLUI)
+  SET(GLUI_ROOT_DIR "${KRISLIBRARY_ROOT}/glui-2.36/src" CACHE PATH "Root of src directory in GLUI Package" FORCE)
+  # GLUI
+  FIND_PACKAGE(GLUI)
+  IF(GLUI_FOUND)
+    MESSAGE("GLUI library found")
+    SET(KRISLIBRARY_DEFINITIONS ${KRISLIBRARY_DEFINITIONS} -DHAVE_GLUI=1)
+    SET(KRISLIBRARY_INCLUDE_DIRS ${KRISLIBRARY_INCLUDE_DIRS} ${GLUI_INCLUDE_DIR} )
+    SET(KRISLIBRARY_LIBRARIES ${KRISLIBRARY_LIBRARIES} ${GLUI_LIBRARY})
+  ELSE(GLUI_FOUND)
+    MESSAGE("GLUI library not found, setting HAVE_GLUI=0")
+  ENDIF(GLUI_FOUND)
+ENDIF(USE_GLUI)

 # GLUT
-FIND_PACKAGE(GLUT)
-IF(GLUT_FOUND)
-  MESSAGE("GLUT library found")
-  SET(KRISLIBRARY_DEFINITIONS ${KRISLIBRARY_DEFINITIONS} -DHAVE_GLUT=1)
-  SET(KRISLIBRARY_INCLUDE_DIRS ${KRISLIBRARY_INCLUDE_DIRS} ${GLUT_INCLUDE_DIR})
-  SET(KRISLIBRARY_LIBRARIES ${KRISLIBRARY_LIBRARIES} ${GLUT_LIBRARIES})
-ELSE(GLUT_FOUND)
-  MESSAGE("GLUT library not found, setting HAVE_GLUT=0")
-ENDIF(GLUT_FOUND)
+OPTION(USE_GLUT "Build with GLUT support" ON)
+IF(USE_GLUT)
+  FIND_PACKAGE(GLUT)
+  IF(GLUT_FOUND)
+    MESSAGE("GLUT library found")
+    SET(KRISLIBRARY_DEFINITIONS ${KRISLIBRARY_DEFINITIONS} -DHAVE_GLUT=1)
+    SET(KRISLIBRARY_INCLUDE_DIRS ${KRISLIBRARY_INCLUDE_DIRS} ${GLUT_INCLUDE_DIR})
+    SET(KRISLIBRARY_LIBRARIES ${KRISLIBRARY_LIBRARIES} ${GLUT_LIBRARIES})
+  ELSE(GLUT_FOUND)
+    MESSAGE("GLUT library not found, setting HAVE_GLUT=0")
+  ENDIF(GLUT_FOUND)
+ENDIF(USE_GLUT)

 # OpenGL
 FIND_PACKAGE(OpenGL REQUIRED)
@@ -72,16 +78,19 @@
 SET(KRISLIBRARY_LIBRARIES ${KRISLIBRARY_LIBRARIES} ${OPENGL_LIBRARIES})

 # GLPK
-SET(GLPK_ROOT "${KRISLIBRARY_ROOT}/glpk-4.52" CACHE PATH "Root of GLPK Package" FORCE)
-FIND_PACKAGE(GLPK)
-IF(GLPK_FOUND)
-  MESSAGE("GLPK library found")
-  SET(KRISLIBRARY_DEFINITIONS ${KRISLIBRARY_DEFINITIONS} -DHAVE_GLPK=1)
-  SET(KRISLIBRARY_INCLUDE_DIRS ${KRISLIBRARY_INCLUDE_DIRS} ${GLPK_INCLUDE_DIR})
-  SET(KRISLIBRARY_LIBRARIES ${KRISLIBRARY_LIBRARIES} ${GLPK_LIBRARY})
-ELSE(GLPK_FOUND)
-  MESSAGE("GLPK library not found, setting HAVE_GLPK=0")
-ENDIF(GLPK_FOUND)
+OPTION(USE_GLPK "Build with GLPK support" ON)
+IF(USE_GLPK)
+  SET(GLPK_ROOT "${KRISLIBRARY_ROOT}/glpk-4.52" CACHE PATH "Root of GLPK Package" FORCE)
+  FIND_PACKAGE(GLPK)
+  IF(GLPK_FOUND)
+    MESSAGE("GLPK library found")
+    SET(KRISLIBRARY_DEFINITIONS ${KRISLIBRARY_DEFINITIONS} -DHAVE_GLPK=1)
+    SET(KRISLIBRARY_INCLUDE_DIRS ${KRISLIBRARY_INCLUDE_DIRS} ${GLPK_INCLUDE_DIR})
+    SET(KRISLIBRARY_LIBRARIES ${KRISLIBRARY_LIBRARIES} ${GLPK_LIBRARY})
+  ELSE(GLPK_FOUND)
+    MESSAGE("GLPK library not found, setting HAVE_GLPK=0")
+  ENDIF(GLPK_FOUND)
+ENDIF(USE_GLPK)

 # TinyXML
 SET(TINYXML_ROOT "${KRISLIBRARY_ROOT}/tinyxml"
@@ -99,31 +108,38 @@
 ENDIF(TINYXML_FOUND)

 # Assimp
-SET(ASSIMP_ROOT "${KRISLIBRARY_ROOT}/assimp--3.0.1270-sdk"
-   CACHE PATH
-   "Root of Assimp package"
-   FORCE
-)
-FIND_PACKAGE(Assimp)
-IF(ASSIMP_FOUND)
-  MESSAGE("Assimp library found")
-  SET(KRISLIBRARY_DEFINITIONS ${KRISLIBRARY_DEFINITIONS} -DHAVE_ASSIMP=1 ${ASSIMP_DEFINITIONS})
-  SET(KRISLIBRARY_INCLUDE_DIRS ${KRISLIBRARY_INCLUDE_DIRS} ${ASSIMP_INCLUDE_DIR})
-  SET(KRISLIBRARY_LIBRARIES ${KRISLIBRARY_LIBRARIES} ${ASSIMP_LIBRARY})
-ELSE(ASSIMP_FOUND)
-  MESSAGE("Assimp library not found, setting HAVE_ASSIMP=0")
-ENDIF(ASSIMP_FOUND)
+OPTION(USE_ASSIMP "Build with ASSIMP support" ON)
+IF(USE_ASSIMP)
+  SET(ASSIMP_ROOT "${KRISLIBRARY_ROOT}/assimp--3.0.1270-sdk"
+     CACHE PATH
+     "Root of Assimp package"
+     FORCE
+  )
+  FIND_PACKAGE(Assimp)
+  IF(ASSIMP_FOUND)
+    MESSAGE("Assimp library found")
+    SET(KRISLIBRARY_DEFINITIONS ${KRISLIBRARY_DEFINITIONS} -DHAVE_ASSIMP=1 ${ASSIMP_DEFINITIONS})
+    SET(KRISLIBRARY_INCLUDE_DIRS ${KRISLIBRARY_INCLUDE_DIRS} ${ASSIMP_INCLUDE_DIR})
+    SET(KRISLIBRARY_LIBRARIES ${KRISLIBRARY_LIBRARIES} ${ASSIMP_LIBRARY})
+  ELSE(ASSIMP_FOUND)
+    MESSAGE("Assimp library not found, setting HAVE_ASSIMP=0")
+  ENDIF(ASSIMP_FOUND)
+ENDIF(USE_ASSIMP)

 # Open Motion Planning Library
-FIND_PACKAGE(OMPL)
-IF(OMPL_FOUND)
-  MESSAGE("OMPL library found")
-  SET(KRISLIBRARY_DEFINITIONS ${KRISLIBRARY_DEFINITIONS} -DHAVE_OMPL=1)
-  SET(KRISLIBRARY_INCLUDE_DIRS ${KRISLIBRARY_INCLUDE_DIRS} ${OMPL_INCLUDE_DIR})
-  SET(KRISLIBRARY_LIBRARIES ${KRISLIBRARY_LIBRARIES} ${OMPL_LIBRARIES})
-ELSE(OMPL_FOUND)
-  MESSAGE("OMPL library not found, setting HAVE_OMPL=0")
-ENDIF(OMPL_FOUND)
+
+OPTION(USE_OMPL "Build with OMPL support" OFF)
+IF(USE_OMPL)
+  FIND_PACKAGE(OMPL)
+  IF(OMPL_FOUND)
+    MESSAGE("OMPL library found")
+    SET(KRISLIBRARY_DEFINITIONS ${KRISLIBRARY_DEFINITIONS} -DHAVE_OMPL=1)
+    SET(KRISLIBRARY_INCLUDE_DIRS ${KRISLIBRARY_INCLUDE_DIRS} ${OMPL_INCLUDE_DIR})
+    SET(KRISLIBRARY_LIBRARIES ${KRISLIBRARY_LIBRARIES} ${OMPL_LIBRARIES})
+  ELSE(OMPL_FOUND)
+    MESSAGE("OMPL library not found, setting HAVE_OMPL=0")
+  ENDIF(OMPL_FOUND)
+ENDIF(USE_OMPL)

 IF(WIN32)
   SET(KRISLIBRARY_DEFINITIONS ${KRISLIBRARY_DEFINITIONS} -DNOMINMAX -DGLUI_NO_LIB_PRAGMA)


FIX: extension build. TG-55 #in-progress

--- SuperBuild/External_CIP.cmake
+++ SuperBuild/External_CIP.cmake
@@ -52,7 +52,7 @@
       -DBUILD_GENERATESIMPLELUNGMASK:BOOL=OFF # temporarily off due to lack of VtkGlue
       -DBUILD_ComputeAirwayWallFromParticles:BOOL=OFF # temporarily off due to lack of VtkGlue
       -DSLICER_PYTHON_CMD:FILEPATH=${PYTHON_EXECUTABLE}
-      -DCIP_PYTHON_DIR:PATH=${PYTHON_EXECUTABLE}    # To parse the convention files
+      -DCIP_PYTHON_EXECUTABLE:FILEPATH=${PYTHON_EXECUTABLE}    # To parse the convention files
       -DCIP_BUILD_TESTING_PYTHON:BOOL=OFF
       -DSlicerExecutionModel_DIR:STRING=${SlicerExecutionModel_DIR}
       -DSlicer_BUILD_CLI:BOOL=ON


Update Superbuild ITK version along ITKv5.1 development

This include the following ITK commit:
commit 764737d09eb107dc328e7d7bdc982c9f56e6c1f6 (HEAD -> master,
upstream/master)
Author: Hans Johnson <hans.j.johnson@gmail.com>
Date:   Tue Jan 7 13:30:21 2020 -0600

    COMP: Allow building basic ITK on computer without python3.5

    This patch consolidates the searching for python components
    into the main CMakeLists.txt file.

--- SuperBuild/External_ITK.cmake
+++ SuperBuild/External_ITK.cmake
@@ -53,7 +53,7 @@
 sitk_legacy_naming(ITK_GIT_REPOSITORY ITK_REPOSITORY)

 # post v5.1rco1
-set(_DEFAULT_ITK_GIT_TAG "f971477cdacff22a861dfcbaccd89c0cf2755af7")
+set(_DEFAULT_ITK_GIT_TAG "764737d09eb107dc328e7d7bdc982c9f56e6c1f6")
 set(ITK_GIT_TAG "${_DEFAULT_ITK_GIT_TAG}" CACHE STRING "Tag in ITK git repo")
 mark_as_advanced(ITK_GIT_TAG)
 set(ITK_TAG_COMMAND GIT_TAG "${ITK_GIT_TAG}")


Set ITK Superbuild version to v5.3rc04

Set ITK Superbuild version to v5.3rc04

--- SuperBuild/External_ITK.cmake
+++ SuperBuild/External_ITK.cmake
@@ -62,7 +62,7 @@
 mark_as_advanced(ITK_GIT_REPOSITORY)
 sitk_legacy_naming(ITK_GIT_REPOSITORY ITK_REPOSITORY)

-set(_DEFAULT_ITK_GIT_TAG "ee664da6bb1a83cdf82e2582126e65119a4de1a4")
+set(_DEFAULT_ITK_GIT_TAG "v5.3rc04")
 set(ITK_GIT_TAG "${_DEFAULT_ITK_GIT_TAG}" CACHE STRING "Tag in ITK git repo")
 mark_as_advanced(ITK_GIT_TAG)
 set(ITK_TAG_COMMAND GIT_TAG "${ITK_GIT_TAG}")
@@ -115,7 +115,7 @@
   -DITK_INSTALL_PACKAGE_DIR=lib/cmake/ITK
   BUILD_COMMAND ${BUILD_COMMAND_STRING}
   DEPENDS
-    ${ITK_DEPENDENCIES}
+    ${${proj}_DEPENDENCIES}
   ${External_Project_USES_TERMINAL}
   )


ENH: Use GitHub for faster ITK repository downloads

Change-Id: Ib0d54977382e8857c1137a24239b13c75df81f29

--- Superbuild/External-ITK.cmake
+++ Superbuild/External-ITK.cmake
@@ -63,7 +63,7 @@
 endif()

 ExternalProject_Add(ITK
-  GIT_REPOSITORY "${git_protocol}://itk.org/ITK.git"
+  GIT_REPOSITORY "${git_protocol}://github.com/InsightSoftwareConsortium/ITK.git"
   GIT_TAG "${ITK_TAG}"
   SOURCE_DIR ITK
   BINARY_DIR ITK-build


Make jenkins use newer version of valgrind

--- Testing/jenkins_mercury.cmake
+++ Testing/jenkins_mercury.cmake
@@ -69,8 +69,8 @@
 set(MERCURY_DO_MEMCHECK $ENV{MERCURY_DO_MEMCHECK})
 if(MERCURY_DO_MEMCHECK)
   message("Enabling Memcheck")
-  set(CTEST_MEMORYCHECK_COMMAND "/usr/bin/valgrind")
-  set(CTEST_MEMORYCHECK_COMMAND_OPTIONS "--gen-suppressions=all --trace-children=yes -q --leak-check=yes --show-reachable=yes --num-callers=50 -v")
+  set(CTEST_MEMORYCHECK_COMMAND "/home/soumagne/apps/valgrind/default/bin/valgrind")
+  set(CTEST_MEMORYCHECK_COMMAND_OPTIONS "--gen-suppressions=all --trace-children=yes --fair-sched=yes -q --leak-check=yes --show-reachable=yes --num-callers=50 -v")
   #set(CTEST_MEMORYCHECK_SUPPRESSIONS_FILE ${CTEST_SCRIPT_DIRECTORY}/MercuryValgrindSuppressions.supp)

   # needed by mercury_common.cmake


Upload the 3.2 testing result to its own CDash project

--- CTestConfig.cmake
+++ CTestConfig.cmake
@@ -4,14 +4,10 @@
 ## # The following are required to uses Dart and the Cdash dashboard
 ##   ENABLE_TESTING()
 ##   INCLUDE(CTest)
-set(CTEST_PROJECT_NAME "Eigen")
+set(CTEST_PROJECT_NAME "Eigen3.2")
 set(CTEST_NIGHTLY_START_TIME "00:00:00 UTC")

 set(CTEST_DROP_METHOD "http")
 set(CTEST_DROP_SITE "manao.inria.fr")
-set(CTEST_DROP_LOCATION "/CDash/submit.php?project=Eigen")
+set(CTEST_DROP_LOCATION "/CDash/submit.php?project=Eigen3.2")
 set(CTEST_DROP_SITE_CDASH TRUE)
-set(CTEST_PROJECT_SUBPROJECTS
-Official
-Unsupported
-)


[CMake] Fixing passthrough for variables starting with the sub-project name

This allows TEST_SUITE variables to be passed from the top-level CMake into the external project.

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

--- cmake/modules/LLVMExternalProjectUtils.cmake
+++ cmake/modules/LLVMExternalProjectUtils.cmake
@@ -92,7 +92,7 @@
   # them.
   get_cmake_property(variableNames VARIABLES)
   foreach(varaibleName ${variableNames})
-    if(${varaibleName} MATCHES "^${nameCanon}")
+    if(varaibleName MATCHES "^${nameCanon}")
       list(APPEND PASSTHROUGH_VARIABLES
         -D${varaibleName}=${${varaibleName}})
     endif()


Graph Control 4.2.0-1 Gold

Graph Control 4.2.0-1 Gold

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

--- version.cmake
+++ version.cmake
@@ -5,8 +5,8 @@
 set ( HPCC_MAJOR 4 )
 set ( HPCC_MINOR 2 )
 set ( HPCC_POINT 0 )
-set ( HPCC_MATURITY "rc" )
-set ( HPCC_SEQUENCE 3 )
+set ( HPCC_MATURITY "release" )
+set ( HPCC_SEQUENCE 1 )
 ###
 IF ( ${HPCC_POINT} GREATER 65 )
   error ( "HPCC_POINT must be less than 66." )


Graph Control 5.6.0-rc1 Release Candidate 1

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

--- version.cmake
+++ version.cmake
@@ -3,11 +3,10 @@
 ###
 set ( HPCC_PROJECT "community" )
 set ( HPCC_MAJOR 5 )
-
 set ( HPCC_MINOR 6 )
 set ( HPCC_POINT 0 )
-set ( HPCC_MATURITY "closedown" )
-set ( HPCC_SEQUENCE 0 )
+set ( HPCC_MATURITY "rc" )
+set ( HPCC_SEQUENCE 1 )
 ###
 IF ( ${HPCC_POINT} GREATER 65 )
   error ( "HPCC_POINT must be less than 66." )


Split off 8.2.4

Split off 8.2.4

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 2 )
-set ( HPCC_POINT 3 )
+set ( HPCC_POINT 5 )
 set ( HPCC_MATURITY "closedown" )
 set ( HPCC_SEQUENCE 0 )
 ###


[axl] release 6.1.0

[axl] release 6.1.0

--- version.cmake
+++ version.cmake
@@ -10,8 +10,8 @@
 #...............................................................................

 set (AXL_VERSION_MAJOR     6)
-set (AXL_VERSION_MINOR     0)
-set (AXL_VERSION_REVISION  2)
+set (AXL_VERSION_MINOR     1)
+set (AXL_VERSION_REVISION  0)
 set (AXL_VERSION_TAG)

 set (AXL_VERSION_FULL      "${AXL_VERSION_MAJOR}.${AXL_VERSION_MINOR}.${AXL_VERSION_REVISION}")


Split off 6.4.0

Split off 6.4.0

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

--- version.cmake
+++ version.cmake
@@ -3,7 +3,7 @@
 ###
 set ( HPCC_PROJECT "community" )
 set ( HPCC_MAJOR 6 )
-set ( HPCC_MINOR 3 )
+set ( HPCC_MINOR 5 )
 set ( HPCC_POINT 0 )
 set ( HPCC_MATURITY "trunk" )
 set ( HPCC_SEQUENCE 0 )


Split off 7.10.12

Split off 7.10.12

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 10 )
-set ( HPCC_POINT 11 )
+set ( HPCC_POINT 13 )
 set ( HPCC_MATURITY "closedown" )
 set ( HPCC_SEQUENCE 0 )
 ###


Split off 7.12.62

Split off 7.12.62

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 61 )
+set ( HPCC_POINT 63 )
 set ( HPCC_MATURITY "closedown" )
 set ( HPCC_SEQUENCE 0 )
 ###


Graph Control 4.0.0-rc12 Release Candidate 12

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

--- version.cmake
+++ version.cmake
@@ -6,7 +6,7 @@
 set ( HPCC_MINOR 0 )
 set ( HPCC_POINT 0 )
 set ( HPCC_MATURITY "rc" )
-set ( HPCC_SEQUENCE 11 )
+set ( HPCC_SEQUENCE 12 )
 ###
 IF ( ${HPCC_POINT} GREATER 65 )
   error ( "HPCC_POINT must be less than 66." )


Graph Control 5.4.0-rc5 Release Candidate 5

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

--- version.cmake
+++ version.cmake
@@ -6,7 +6,7 @@
 set ( HPCC_MINOR 4 )
 set ( HPCC_POINT 0 )
 set ( HPCC_MATURITY "rc" )
-set ( HPCC_SEQUENCE 4 )
+set ( HPCC_SEQUENCE 5 )
 ###
 IF ( ${HPCC_POINT} GREATER 65 )
   error ( "HPCC_POINT must be less than 66." )


[ioninja] release 3.3.1

[ioninja] release 3.3.1

[axl] release 5.3.4
[jancy] release 1.5.1

important bugfixes re automaton functions

--- version.cmake
+++ version.cmake
@@ -1,6 +1,6 @@
 set (VERSION_MAJOR     1)
 set (VERSION_MINOR     5)
-set (VERSION_REVISION  0)
+set (VERSION_REVISION  1)
 set (VERSION_TAG)

 set (VERSION_FILE_SUFFIX "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION}")


bump version number - major and breaking changes since last release

--- version.cmake
+++ version.cmake
@@ -1 +1 @@
-set(LeapSerial_VERSION 0.4.0)
+set(LeapSerial_VERSION 0.5.0)


Say which directory ls failed on.

Say which directory ls failed on.

--- VeraPPUtilities.cmake
+++ VeraPPUtilities.cmake
@@ -87,7 +87,7 @@
         # Set RETURN_FILES in PARENT_SCOPE
         set (${RETURN_FILES} ${_verapp_ls_return_list} PARENT_SCOPE)
     else (${_verapp_ls_result} EQUAL 0)
-        message (FATAL_ERROR "ls: " ${_verapp_ls_error})
+        message (FATAL_ERROR "ls ${DIRECTORY}:" ${_verapp_ls_error})
     endif (${_verapp_ls_result} EQUAL 0)
 endfunction (verapp_list_files_in_external_directory)


Disable test vc-swizzles_avx for Xcode 7.

--- test/CTestCustom.cmake
+++ test/CTestCustom.cmake
@@ -12,4 +12,7 @@
       vc-math_VC_LOG_ILP2_sse
       vc-math_VC_LOG_ILP_sse
       stressVdt)
+elseif(CTEST_BUILD_NAME MATCHES clang7)
+  set(CTEST_CUSTOM_TESTS_IGNORE ${CTEST_CUSTOM_TESTS_IGNORE}
+      vc-swizzles_avx)
 endif()


Remove try_run test for libXml2 again after finding bug in code.

--- cmake/environmentchecks.cmake
+++ cmake/environmentchecks.cmake
@@ -83,45 +83,6 @@
   find_package(LibXml2 REQUIRED)
 endif()

-# Try and determine what type of libxml2 we have found.  Required for knowing what answers
-# our tests need as the test answers differ on the version libXml2.
-set(CMAKE_TRY_COMPILE_TARGET_TYPE EXECUTABLE)
-set(_TEST_SRC "${libCellML_SOURCE_DIR}/cmake/test_libxml2.cpp")
-if(HAVE_LIBXML2_CONFIG)
-  set(_COMPILE_DEFINITIONS)
-  set(_LINK_DEFINITIONS LINK_LIBRARIES xml2)
-else()
-  set(_COMPILE_DEFINITIONS COMPILE_DEFINITIONS "-I${LIBXML2_INCLUDE_DIR}" "-I${PROJECT_BINARY_DIR}/src")
-  set(_LINK_DEFINITIONS LINK_LIBRARIES "${LIBXML2_LIBRARIES}")
-endif()
-try_run(RUN_TEST_LIBXML2_RESULT COMPILE_TEST_LIBXML2_RESULT
-        ${libCellML_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
-        ${_TEST_SRC}
-        ${_COMPILE_DEFINITIONS}
-        ${_LINK_DEFINITIONS}
-        LINK_OPTIONS "${LIBXML2_LIBRARIES}"
-        COMPILE_OUTPUT_VARIABLE _COMPILE
-        RUN_OUTPUT_VARIABLE _OUTPUT)
-
-message(STATUS "")
-message(STATUS "_COMPILE: ${_COMPILE}")
-message(STATUS "_OUTPUT: ${_OUTPUT}")
-
-if(COMPILE_TEST_LIBXML2_RESULT AND RUN_TEST_LIBXML2_RESULT STREQUAL "0")
-  string(FIND "${_OUTPUT}" "cellml:units" _NAMESPACE_INDEX)
-  if(_NAMESPACE_INDEX STREQUAL "-1")
-    # libXml2 is not namespace aware.
-    set(HAVE_LIBXML2_NAMESPACE_AWARE FALSE)
-  else()
-    # libXml2 is namespace aware.
-    set(HAVE_LIBXML2_NAMESPACE_AWARE TRUE)
-  endif()
-else()
-  # Couldn't determine libXml2's knowledge of namespaces.
-  message(STATUS "Undetermined libXml2 namespace understanding.")
-  set(HAVE_LIBXML2_NAMESPACE_UNKNOWN TRUE)
-endif()
-
 if(CLANG_FORMAT_EXE AND GIT_EXE)
   set(CLANG_FORMAT_TESTING_AVAILABLE TRUE INTERNAL BOOL "Executables required to run the ClangFormat test are available.")
 endif()


protobuf (#12935)

protobuf (#12935)

--- cmake/external/protobuf.cmake
+++ cmake/external/protobuf.cmake
@@ -14,11 +14,14 @@

 INCLUDE(ExternalProject)
 # Always invoke `FIND_PACKAGE(Protobuf)` for importing function protobuf_generate_cpp
+IF(NOT WIN32)
 FIND_PACKAGE(Protobuf QUIET)
+ENDIF(NOT WIN32)
 macro(UNSET_VAR VAR_NAME)
     UNSET(${VAR_NAME} CACHE)
     UNSET(${VAR_NAME})
 endmacro()
+
 UNSET_VAR(PROTOBUF_INCLUDE_DIR)
 UNSET_VAR(PROTOBUF_FOUND)
 UNSET_VAR(PROTOBUF_PROTOC_EXECUTABLE)
@@ -94,12 +97,14 @@
     SET(protobuf_DEPS ${ARGN})

     MESSAGE(STATUS "Protobuf protoc executable: ${PROTOBUF_PROTOC_EXECUTABLE}")
+    MESSAGE(STATUS "Protobuf-lite library: ${PROTOBUF_LITE_LIBRARY}")
     MESSAGE(STATUS "Protobuf library: ${PROTOBUF_LIBRARY}")
+    MESSAGE(STATUS "Protoc library: ${PROTOBUF_PROTOC_LIBRARY}")
     MESSAGE(STATUS "Protobuf version: ${PROTOBUF_VERSION}")
     INCLUDE_DIRECTORIES(${PROTOBUF_INCLUDE_DIR})

     # Assuming that all the protobuf libraries are of the same type.
-    IF(${PROTOBUF_LIBRARY} MATCHES "${CMAKE_STATIC_LIBRARY_SUFFIX}$")
+    IF(${PROTOBUF_LIBRARY} MATCHES ${CMAKE_STATIC_LIBRARY_SUFFIX})
         SET(protobuf_LIBTYPE STATIC)
     ELSEIF(${PROTOBUF_LIBRARY} MATCHES "${CMAKE_SHARED_LIBRARY_SUFFIX}$")
         SET(protobuf_LIBTYPE SHARED)
@@ -137,18 +142,25 @@
 endmacro()

 set(PROTOBUF_ROOT "" CACHE PATH "Folder contains protobuf")
+IF (WIN32)
+    SET(PROTOBUF_ROOT ${THIRD_PARTY_PATH}/install/protobuf)
+    MESSAGE(WARNING, "In windows, protobuf only support msvc build, please build it manually and put it at " ${PROTOBUF_ROOT})
+ENDIF(WIN32)
+
 if (NOT "${PROTOBUF_ROOT}" STREQUAL "")
+
     find_path(PROTOBUF_INCLUDE_DIR google/protobuf/message.h PATHS ${PROTOBUF_ROOT}/include NO_DEFAULT_PATH)
-    find_library(PROTOBUF_LIBRARY protobuf PATHS ${PROTOBUF_ROOT}/lib NO_DEFAULT_PATH)
-    find_library(PROTOBUF_LITE_LIBRARY protobuf-lite PATHS ${PROTOBUF_ROOT}/lib NO_DEFAULT_PATH)
-    find_library(PROTOBUF_PROTOC_LIBRARY protoc PATHS ${PROTOBUF_ROOT}/lib NO_DEFAULT_PATH)
+    find_library(PROTOBUF_LIBRARY protobuf libprotobuf.lib PATHS ${PROTOBUF_ROOT}/lib NO_DEFAULT_PATH)
+    find_library(PROTOBUF_LITE_LIBRARY protobuf-lite libprotobuf-lite.lib PATHS ${PROTOBUF_ROOT}/lib NO_DEFAULT_PATH)
+    find_library(PROTOBUF_PROTOC_LIBRARY protoc libprotoc.lib PATHS ${PROTOBUF_ROOT}/lib NO_DEFAULT_PATH)
     find_program(PROTOBUF_PROTOC_EXECUTABLE protoc PATHS ${PROTOBUF_ROOT}/bin NO_DEFAULT_PATH)
     if (PROTOBUF_INCLUDE_DIR AND PROTOBUF_LIBRARY AND PROTOBUF_LITE_LIBRARY AND PROTOBUF_PROTOC_LIBRARY AND PROTOBUF_PROTOC_EXECUTABLE)
         message(STATUS "Using custom protobuf library in ${PROTOBUF_ROOT}.")
+        SET(PROTOBUF_FOUND true)
         SET_PROTOBUF_VERSION()
         PROMPT_PROTOBUF_LIB()
     else()
-        message(WARNING "Cannot find protobuf library in ${PROTOBUF_ROOT}.")
+        message(WARNING "Cannot find protobuf library in ${PROTOBUF_ROOT}")
     endif()
 endif()

@@ -239,6 +251,7 @@
         CACHE FILEPATH "protobuf executable." FORCE)
 ENDIF()

+
 IF(NOT PROTOBUF_FOUND)
     build_protobuf(extern_protobuf FALSE)


Attempt to fix libRDAVIX with CMake (LCGCMake)

--- cmake/modules/FindDavix.cmake
+++ cmake/modules/FindDavix.cmake
@@ -7,13 +7,13 @@
 #  DAVIX_LIBRARIES

 find_path(DAVIX_INCLUDE_DIR NAMES davix.hpp PATH_SUFFIXES davix HINTS ${DAVIX_DIR}/include $ENV{DAVIX_DIR}/include)
-find_library(DAVIX_LIBRARY NAMES davix HINTS ${DAVIX_DIR}/lib $ENV{DAVIX_DIR}/lib)
+find_library(DAVIX_LIBRARY NAMES davix HINTS ${DAVIX_DIR}/lib $ENV{DAVIX_DIR}/lib64 ${DAVIX_DIR}/lib $ENV{DAVIX_DIR}/lib64)

 set(DAVIX_INCLUDE_DIRS ${DAVIX_INCLUDE_DIR})
 set(DAVIX_LIBRARIES ${DAVIX_LIBRARY})

 # Handle the QUIETLY and REQUIRED arguments and set DAVIX_FOUND to TRUE if all listed variables are TRUE
 include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(DAVIX DEFAULT_MSG DAVIX_INCLUDE_DIR DAVIX_LIBRARY)
+find_package_handle_standard_args(DAVIX DEFAULT_MSG DAVIX_INCLUDE_DIRS DAVIX_LIBRARIES)

-mark_as_advanced(DAVIX_FOUND DAVIX_INCLUDE_DIR DAVIX_LIBRARY)
+mark_as_advanced(DAVIX_FOUND DAVIX_INCLUDE_DIRS DAVIX_LIBRARIES)


Do not add DAVIX_DEFINITIONS to Davix::Davix imported target

pkg-config --cflags davix gives:
-D_FILE_OFFSET_BITS=64 -I/usr/include/davix

However, actually adding -D_FILE_OFFSET_BITS=64 to the compilation
breaks the 32bit build, due to mismatches between long and Long64_t:

TDavixFile.cxx:791: undefined reference to
  `Davix::DavPosix::pread(Davix_fd*, void*, unsigned int, long long, Davix::DavixError**)'

while nm libdavix.so shows:
   Davix::DavPosix::pread(Davix_fd*, void*, unsigned int, long, Davix::DavixError**)

which means that offsets are not 64 bits, but 32 bits.

--- cmake/modules/FindDavix.cmake
+++ cmake/modules/FindDavix.cmake
@@ -68,11 +68,8 @@

 if(DAVIX_FOUND AND NOT TARGET Davix::Davix)
   add_library(Davix::Davix INTERFACE IMPORTED)
-  string(REPLACE "-D" "" DAVIX_DEFINITIONS ${DAVIX_CFLAGS_OTHER})
-  set_target_properties(Davix::Davix PROPERTIES
-    INTERFACE_COMPILE_DEFINITIONS "${DAVIX_DEFINITIONS}"
-    INTERFACE_INCLUDE_DIRECTORIES "${DAVIX_INCLUDE_DIRS}"
-    INTERFACE_LINK_LIBRARIES "${DAVIX_LIBRARIES}")
+  set_property(TARGET Davix::Davix PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${DAVIX_INCLUDE_DIRS}")
+  set_property(TARGET Davix::Davix PROPERTY INTERFACE_LINK_LIBRARIES "${DAVIX_LIBRARIES}")
 endif()

 mark_as_advanced(DAVIX_INCLUDE_DIR DAVIX_LIBRARY)


[minor] delete irrelevant comments

[minor] delete irrelevant comments

--- cmake/modules/FindLibRt.cmake
+++ cmake/modules/FindLibRt.cmake
@@ -1,14 +1,7 @@
-#.rst:
 # FindLibRt
 # --------
 #
 # Find the native realtime includes and library.
-#
-# IMPORTED Targets
-# ^^^^^^^^^^^^^^^^
-#
-# This module defines :prop_tgt:`IMPORTED` target ``LIBRT::LIBRT``, if
-# LIBRT has been found.
 #
 # Result Variables
 # ^^^^^^^^^^^^^^^^


Remove unused FindPatch module

Remove unused FindPatch module

We use Git now instead of this patch program. One dependency less.

--- cmake/modules/FindPatch.cmake
+++ cmake/modules/FindPatch.cmake
@@ -1,25 +0,0 @@
-#This software is distributed under the Creative Commons license (CC0) version 1.0. A copy of this license should have been distributed with this software.
-#The license can also be read online: <https://creativecommons.org/publicdomain/zero/1.0/>. If this online license differs from the license provided with this software, the license provided with this software should be applied.
-
-option(BUILD_PATCH "Build the Patch dependency from source. If you build this, the newly-built version will get used by Luna. If not, it will search for a pre-installed version on your system." FALSE)
-
-if(BUILD_PATCH)
-	if(NOT PATCH_FOUND)
-		message(STATUS "Building Patch from source.")
-		include(ExternalProject)
-		ExternalProject_Add(Patch
-			URL http://downloads.sourceforge.net/project/unxutils/unxutils/current/UnxUtilsSrc.zip
-			URL_HASH SHA512=771910CE864BBDAA9351534DBF5F8CAE8B5CB9336704CF4948B2E5F9FF4614FD1DE68A313EBD8450D7973BFF1E62DE1CA16E96AC610E0679B5139B4C154E09C9
-			CONFIGURE_COMMAND ""
-			BUILD_COMMAND ${CMAKE_MAKE_PROGRAM} -C ./patch-2.5 #Call make from the patch-2.5 subdirectory.
-			INSTALL_COMMAND ""
-			BUILD_IN_SOURCE 1
-		)
-		set(PATCH_EXECUTABLE ${CMAKE_CURRENT_BINARY_DIR}/Patch-prefix/src/Patch/patch-2.5/patch)
-		set(PATCH_FOUND TRUE)
-	endif()
-else() #Just find it on the system.
-	include(FindPackageHandleStandardArgs)
-	find_program(PATCH_EXECUTABLE NAMES patch PATH_SUFFIXES bin DOC "Application to apply unified diff format patches.")
-	find_package_handle_standard_args(Patch DEFAULT_MSG PATCH_EXECUTABLE)
-endif()


cmake/modules/FindVIGRA.cmake: Fix setting VIGRA_ROOT.

--- cmake/modules/FindVIGRA.cmake
+++ cmake/modules/FindVIGRA.cmake
@@ -10,7 +10,7 @@

 # See if VIGRA_ROOT was set externally, if so use it.
 if (NOT "$ENV{VIGRA_ROOT}" STREQUAL "")
-    set(VIGRA_ROOT $ENV{BOOST_ROOT})
+    set(VIGRA_ROOT $ENV{VIGRA_ROOT})
 elseif (NOT "$ENV{VIGRAROOT}" STREQUAL "")
       set(VIGRA_ROOT $ENV{VIGRAROOT})
       set(ENV{VIGRA_ROOT} $ENV{VIGRA_ROOT})


[cmake] avoid empty string with extra . in produced by cpack archive

--- cmake/modules/RootCPack.cmake
+++ cmake/modules/RootCPack.cmake
@@ -117,9 +117,12 @@
     set(OS_NAME_VERSION Linux-${osid}${osvers}${arch})
   endif()
 endif()
+
 #---Build type---------------------------------------------------------------------------------------
 if(NOT CMAKE_BUILD_TYPE STREQUAL Release)
-  string(TOLOWER .${CMAKE_BUILD_TYPE} BUILD_TYPE_FOR_NAME)
+  if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "")
+    string(TOLOWER .${CMAKE_BUILD_TYPE} BUILD_TYPE_FOR_NAME)
+  endif()
 endif()

 set(CPACK_PACKAGE_RELOCATABLE True)


Add a comment.

Add a comment.

--- test/test_driver.cmake
+++ test/test_driver.cmake
@@ -39,7 +39,7 @@
         PRE_BUILD
         COMMAND cmake --build . --target ${test_target}
         WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
-        COMMENT "Running ${test_target} ..." VERBATIM
+        COMMENT "Test ${test_target}" VERBATIM
     )
     foreach(bin_dep ${TEST_TARGET_BIN_DEPS})
         add_custom_command(


Update create package function

Update create package function

--- CreatePackage.cmake
+++ CreatePackage.cmake
@@ -1,39 +1,39 @@

-if (NOT DEFINED PROJECT_NAME)
-	message(FATAL_ERROR "Must define a project name before using create_package")
-endif()
+function(create_package)
+  set(options)
+  set(singleValueOpts DESCRIPTION TARGET VERSION)
+  set(multiValueOpts VALGRIND_ARGS EXECUTABLE_ARGS)

-if (NOT DEFINED PROJECT_VERSION)
-	message(FATAL_ERROR "Must define a project version before using create_package")
-endif()
+  cmake_parse_arguments(CREATE_PACKAGE "${options}" "${singleValueOpts}" "${multiValueOpts}" ${ARGN})

-set(THIS_FILE_DIR ${CMAKE_CURRENT_LIST_DIR})
-set(THIS_OUTPUT_DIR "${PROJECT_BINARY_DIR}/gen")
+  if (NOT DEFINED CREATE_PACKAGE_TARGET)
+    if (NOT DEFINED PROJECT_NAME)
+      message(FATAL_ERROR "Must define a target name before using create_package")
+    endif()
+    set(CREATE_PACKAGE_TARGET ${PROJECT_NAME})
+  endif()

-macro(create_package _description)
+  if (NOT DEFINED CREATE_PACKAGE_VERSION)
+    if (NOT DEFINED PROJECT_VERSION)
+      message(FATAL_ERROR "Must define a project version before using create_package")
+    endif()
+    set(CREATE_PACKAGE_VERSION ${PROJECT_VERSION})
+  endif()

-  set(PKGCONF_NAME ${PROJECT_NAME})
-	set(PKGCONF_DESCRIPTION ${_description})
-    set(PKGCONF_VERSION ${PROJECT_VERSION})
+  if (NOT DEFINED CREATE_PACKAGE_DESCRIPTION)
+    message(FATAL_ERROR "Must define a description for the package")
+  endif()

-	message(STATUS "Creating package config file ${PROJECT_NAME}.pc")
+  set(PKGCONF_NAME ${CREATE_PACKAGE_TARGET})
+	set(PKGCONF_DESCRIPTION ${CREATE_PACKAGE_DESCRIPTION})
+  set(PKGCONF_VERSION ${CREATE_PACKAGE_VERSION})

-	configure_file("${THIS_FILE_DIR}/pkg-config.pc.in" "${THIS_OUTPUT_DIR}/${PROJECT_NAME}.pc" @ONLY)
+  set(CREATE_PACKAGE_OUTPUT_DIR "${PROJECT_BINARY_DIR}/gen")

-	install(FILES "${THIS_OUTPUT_DIR}/${PROJECT_NAME}.pc" DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig")
+	message(STATUS "Creating package config file ${CREATE_PACKAGE_TARGET}.pc")

-endmacro()
+	configure_file("${CMAKE_SOURCE_DIR}/cmake/pkg-config.pc.in" "${CREATE_PACKAGE_OUTPUT_DIR}/${CREATE_PACKAGE_TARGET}.pc" @ONLY)

-macro(create_package_named _name _version _description)
+	install(FILES "${CREATE_PACKAGE_OUTPUT_DIR}/${CREATE_PACKAGE_TARGET}.pc" DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig")

-  set(PKGCONF_NAME ${_name})
-  set(PKGCONF_DESCRIPTION ${_description})
-  set(PKGCONF_VERSION ${_version})
-
-  message(STATUS "Creating package config file ${_name}.pc")
-
-  configure_file("${THIS_FILE_DIR}/pkg-config.pc.in" "${THIS_OUTPUT_DIR}/${_name}.pc" @ONLY)
-
-  install(FILES "${THIS_OUTPUT_DIR}/${_name}.pc" DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig")
-
-endmacro()
+endfunction()


bump version to 0.4.1

bump version to 0.4.1


set main.f90 as a variable

set main.f90 as a variable

--- test/module_test.cmake
+++ test/module_test.cmake
@@ -2,6 +2,7 @@
 # Perform code transformation and compare the output with a reference

 # Define input and output file name
+set (MAIN_F90 ${CMAKE_CURRENT_SOURCE_DIR}/main.f90)
 set (ORIGINAL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/mo_column.f90)
 set (OUTPUT_FILE_CPU ${CMAKE_CURRENT_SOURCE_DIR}/transformed_code_cpu.f90)
 set (OUTPUT_FILE_GPU ${CMAKE_CURRENT_SOURCE_DIR}/transformed_code_gpu.f90)
@@ -67,10 +68,10 @@
 set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${CLAW_TEST_FFP_FLAGS}")

 # Build the original code and the transformed code
-add_executable (${EXECUTABLE_ORIGINAL} EXCLUDE_FROM_ALL "${ORIGINAL_FILE}" "main.f90")
-add_executable (${EXECUTABLE_TRANSFORMED_CPU} EXCLUDE_FROM_ALL "${OUTPUT_FILE_CPU}" "main.f90")
+add_executable (${EXECUTABLE_ORIGINAL} EXCLUDE_FROM_ALL "${ORIGINAL_FILE}" "${MAIN_F90}")
+add_executable (${EXECUTABLE_TRANSFORMED_CPU} EXCLUDE_FROM_ALL "${OUTPUT_FILE_CPU}" "${MAIN_F90}")
 target_compile_definitions(${EXECUTABLE_TRANSFORMED_CPU} PRIVATE -D_CLAW)
-add_executable (${EXECUTABLE_TRANSFORMED_GPU} EXCLUDE_FROM_ALL "${OUTPUT_FILE_GPU}" "main.f90")
+add_executable (${EXECUTABLE_TRANSFORMED_GPU} EXCLUDE_FROM_ALL "${OUTPUT_FILE_GPU}" "${MAIN_F90}")
 target_compile_definitions(${EXECUTABLE_TRANSFORMED_GPU} PRIVATE -D_CLAW)

 # Set target specific compilation options


ArmでのExceptionPtr無効化マクロ

ArmでのExceptionPtr無効化マクロ

--- AndroidArm.cmake
+++ AndroidArm.cmake
@@ -14,6 +14,8 @@
 endif()
 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --sysroot=${ANDROID_NDK_ROOT}/platforms/android-${ANDROID_VER}/arch-arm -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes")
 add_definitions(-D__arm__)
+# ARMではExceptionPtrをサポートしてないらしいので無効化するマクロを定義
+add_definitions(-DNO_EXCEPTION_PTR)
 # ARM or THUMB
 if(AS_ARM)
 	set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -marm")


Fix apple_check_opengl (for TUIO)

Fix apple_check_opengl (for TUIO)

--- AppleCheckOpenGL.cmake
+++ AppleCheckOpenGL.cmake
@@ -1,6 +1,8 @@

-# test that only one OpenGL (X11 lib or OpenGL framework) is linked to
-# a given target on OS X
+# Provides the following function:
+# * apple_check_opengl(<target>): Adds a test to ${PROJECT_NAME}-tests to check
+#   that only one OpenGL (X11 lib or OpenGL framework) is linked to the given
+#   <target> on OS X

 function(apple_check_opengl Target)
   if(NOT APPLE)
@@ -8,10 +10,18 @@
   endif()

   add_test(NAME ${Target}-AppleCheckOpenGL
-    COMMAND ${CMAKE_COMMAND} -DAPPLE_CHECK_OPENGL_FILE="$<TARGET_FILE:${Target}>" -P ${CMAKE_SOURCE_DIR}/CMake/common/AppleCheckOpenGL.cmake)
+    COMMAND ${CMAKE_COMMAND} -DAPPLE_CHECK_OPENGL_FILE="$<TARGET_FILE:${Target}>"
+            -P ${CMAKE_SOURCE_DIR}/CMake/common/AppleCheckOpenGL.cmake)
   add_custom_target(${Target}-AppleCheckOpenGL
-    COMMAND ${CMAKE_COMMAND} -DAPPLE_CHECK_OPENGL_FILE="$<TARGET_FILE:${Target}>" -P ${CMAKE_SOURCE_DIR}/CMake/common/AppleCheckOpenGL.cmake
+    COMMAND ${CMAKE_COMMAND} -DAPPLE_CHECK_OPENGL_FILE="$<TARGET_FILE:${Target}>"
+            -P ${CMAKE_SOURCE_DIR}/CMake/common/AppleCheckOpenGL.cmake
     COMMENT "Verifying OpenGL link libraries of ${Target}")
+
+  if(NOT TARGET ${PROJECT_NAME}-tests)
+    add_custom_target(${PROJECT_NAME}-tests)
+    set_target_properties(${PROJECT_NAME}-tests PROPERTIES
+      EXCLUDE_FROM_DEFAULT_BUILD ON FOLDER ${PROJECT_NAME}/tests)
+  endif()
   add_dependencies(${PROJECT_NAME}-tests ${Target}-AppleCheckOpenGL)
 endfunction()


fix problem with making tbb an imported target

use IMPORTED_LOCATION_<CONFIG> rather than INTERFACE_LINK_LIBRARIES

--- FindTBB.cmake
+++ FindTBB.cmake
@@ -267,14 +267,19 @@
     set_target_properties(tbb PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${TBB_INCLUDE_DIRS})
     if(TBB_LIBRARIES_RELEASE AND TBB_LIBRARIES_DEBUG)
       set_target_properties(tbb PROPERTIES
-          INTERFACE_COMPILE_DEFINITIONS "$<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:TBB_USE_DEBUG=1">
-          INTERFACE_LINK_LIBRARIES "$<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:${TBB_LIBRARIES_DEBUG}> $<$<OR:$<CONFIG:Release>,$<CONFIG:MinSizeRel>,$<CONFIG:>>:${TBB_LIBRARIES_RELEASE}>">
+          INTERFACE_COMPILE_DEFINITIONS "$<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:TBB_USE_DEBUG=1>"
+          IMPORTED_LOCATION_DEBUG          ${TBB_LIBRARIES_DEBUG}
+          IMPORTED_LOCATION_RELWITHDEBINFO ${TBB_LIBRARIES_DEBUG}
+          IMPORTED_LOCATION_RELEASE        ${TBB_LIBRARIES_RELEASE}
+          IMPORTED_LOCATION_MINSIZEREL     ${TBB_LIBRARIES_RELEASE}
           )
     elseif(TBB_LIBRARIES_RELEASE)
-      target_link_libraries(tbb INTERFACE ${TBB_LIBRARIES_RELEASE})
-    else()
-      target_compile_definitions(tbb INTERFACE ${TBB_DEFINITIONS_DEBUG})
-      target_link_libraries(tbb INTERFACE ${TBB_LIBRARIES_DEBUG})
+      set_target_properties(tbb PROPERTIES IMPORTED_LOCATION ${TBB_LIBRARIES_RELEASE})
+    else()
+      set_target_properties(tbb PROPERTIES
+          INTERFACE_COMPILE_DEFINITIONS "${TBB_DEFINITIONS_DEBUG}"
+          IMPORTED_LOCATION              ${TBB_LIBRARIES_DEBUG}
+          )
     endif()
   endif()


Fixing some cmake code to make sure certain variables are defined before using them

--- Resources/CMake/CMakeMacros.cmake
+++ Resources/CMake/CMakeMacros.cmake
@@ -20,11 +20,13 @@
 #-------------------------------------------------------------------------------

 MACRO (IDE_SOURCE_PROPERTIES SOURCE_PATH HEADERS SOURCES)
-    if ( ${MXA_INSTALL_FILES} EQUAL 1 )
+    if ( DEFINED MXA_INSTALL_FILES)
+    if( ${MXA_INSTALL_FILES} EQUAL 1 )
     INSTALL (FILES ${HEADERS}
              DESTINATION include/${SOURCE_PATH}
              COMPONENT Headers
     )
+    endif()
     endif()
     STRING(REPLACE "/" "\\\\" source_group_path ${SOURCE_PATH}  )
     source_group(${source_group_path} FILES ${HEADERS} ${SOURCES})
@@ -49,6 +51,7 @@
         RELEASE_OUTPUT_NAME ${EXE_NAME}
     )

+    if ( DEFINED MXA_INSTALL_FILES)
     if ( ${MXA_INSTALL_FILES} EQUAL 1 )
         INSTALL(TARGETS ${EXE_NAME}
             RUNTIME
@@ -59,6 +62,7 @@
             RUNTIME DESTINATION ./
             BUNDLE DESTINATION ${CMAKE_INSTALL_PREFIX}/.
         )
+    endif()
     endif()

     # --- If we are on OS X copy all the embedded libraries to the app bundle
@@ -229,7 +233,7 @@
           STRING(TOUPPER ${BTYPE} TYPE)
           get_filename_component(lib_path ${${upperlib}_LIBRARY_${TYPE}} PATH)
           get_filename_component(lib_name ${${upperlib}_LIBRARY_${TYPE}} NAME_WE)
-          #message(STATUS "Looking for DLL Version of ${lib_name}")
+          message(STATUS "Looking for DLL Version of ${lib_name}")
           find_path(${upperlib}_LIBRARY_DLL_${TYPE}
                 NAMES ${lib_name}.dll
                 PATHS ${lib_path}/ ${lib_path}/../bin ${lib_path}/..
@@ -284,13 +288,13 @@
                 NO_DEFAULT_PATH )

           if ( ${${upperlib}_LIBRARY_DLL_${TYPE}} STREQUAL  "${upperlib}_LIBRARY_DLL_${TYPE}-NOTFOUND")
-            message(STATUS "A Companion DLL for ${upperlib}_LIBRARY_${TYPE} was NOT found which usually means"
-                                " that the library was NOT built as a DLL. I looked in the "
-                                " following locations:  ${lib_path}\n  ${lib_path}/..\n  ${lib_path}/../bin")
+           # message(STATUS "A Companion DLL for ${upperlib}_LIBRARY_${TYPE} was NOT found which usually means"
+           #                     " that the library was NOT built as a DLL. I looked in the "
+           #                     " following locations:  ${lib_path}\n  ${lib_path}/..\n  ${lib_path}/../bin")
           else()
               set(${upperlib}_LIBRARY_DLL_${TYPE}  ${${upperlib}_LIBRARY_DLL_${TYPE}}/${lib_name}.dll)
-              message(STATUS "${upperlib}_LIBRARY_DLL_${TYPE}: ${${upperlib}_LIBRARY_DLL_${TYPE}}")
-              message(STATUS "Generating Install Rule for ${btype} Version of ${upperlib}_LIBRARY_${TYPE}")
+             # message(STATUS "${upperlib}_LIBRARY_DLL_${TYPE}: ${${upperlib}_LIBRARY_DLL_${TYPE}}")
+             # message(STATUS "Generating Install Rule for ${btype} Version of ${upperlib}_LIBRARY_${TYPE}")
               INSTALL(FILES ${${upperlib}_LIBRARY_DLL_${TYPE}}
                 DESTINATION ${destination}
                 CONFIGURATIONS ${BTYPE}


Update clFFT commit id

Update clFFT commit id

--- CMakeModules/build_clFFT.cmake
+++ CMakeModules/build_clFFT.cmake
@@ -12,7 +12,7 @@
 ExternalProject_Add(
   clFFT-external
   GIT_REPOSITORY https://github.com/arrayfire/clFFT.git
-  GIT_TAG 1c14c415d1dd8d9a73fa2546086508a34f2008af
+  GIT_TAG 1597f0f35a644789c7ad77efe79014236cca2fab
   PREFIX "${prefix}"
   INSTALL_DIR "${prefix}"
   UPDATE_COMMAND ""


add lib name suffix

add lib name suffix

--- neulib_min.cmake
+++ neulib_min.cmake
@@ -6,7 +6,7 @@

   include(${BUILDEM_REPO_DIR}/neulib_com.cmake)

-  SET(config_args --enable-shared --disable-fftw --disable-fftwf --disable-z --disable-xml --disable-png --disable-jansson)
+  SET(config_args --enable-shared --disable-fftw --disable-fftwf --disable-z --disable-xml --disable-png --disable-jansson LIB_SUFFIX=_min)
   INSTALL_NEULIB(libneurolabi_min "${config_args}")

 endif (NOT libneurolabi_NAME)


STYLE: Option to install or not ANTs tools

--- DTI-Reg.cmake
+++ DTI-Reg.cmake
@@ -154,7 +154,8 @@

 endif()

-if(ANTs_DIR)
+option(ANTs_INSTALL "Install ANTs executables" ON)
+if(ANTs_DIR AND ANTs_INSTALL)
   set(ants_tools
     ANTS
     WarpImageMultiTransform)


Xenial: use POSIX MinGW to enable threading

--- 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)
-set(CMAKE_CXX_COMPILER ${COMPILER_PREFIX}-g++)
+set(CMAKE_C_COMPILER ${COMPILER_PREFIX}-gcc-posix)
+set(CMAKE_CXX_COMPILER ${COMPILER_PREFIX}-g++-posix)

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


Fixed debug build of Inventor plugin

Fixed debug build of Inventor plugin

git-svn-id: 23b6355f2bb369032457de4eb5f713ee134f73a8@7830 16af8721-9629-0410-8352-f15c8da7e697

--- CMakeModules/FindInventor.cmake
+++ CMakeModules/FindInventor.cmake
@@ -53,7 +53,7 @@
 )
 IF(NOT INVENTOR_LIBRARY_DEBUG)
     IF(INVENTOR_LIBRARY)
-        SET(INVENTOR_LIBRARY_DEBUG INVENTOR_LIBRARY)
+        SET(INVENTOR_LIBRARY_DEBUG ${INVENTOR_LIBRARY})
     ENDIF(INVENTOR_LIBRARY)
 ENDIF(NOT INVENTOR_LIBRARY_DEBUG)


maybe fix implibrary for win32

maybe fix implibrary for win32

--- CMakeModules/build_EasyCL.cmake
+++ CMakeModules/build_EasyCL.cmake
@@ -19,7 +19,11 @@
 ADD_DEPENDENCIES(EasyCL EasyCL-external)
 SET(EASYCL_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/EasyCL/include)
 #message("lib path ${CMAKE_INSTALL_PREFIX}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}EasyCL${CMAKE_SHARED_LIBRARY_SUFFIX}")
-SET(EASYCL_LIBRARIES ${CMAKE_INSTALL_PREFIX}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}EasyCL${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_INSTALL_PREFIX}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}clew${CMAKE_SHARED_LIBRARY_SUFFIX})
+if(WIN32)
+	SET(EASYCL_LIBRARIES ${CMAKE_INSTALL_PREFIX}/lib/EasyCL.lib ${CMAKE_INSTALL_PREFIX}/lib/clew.lib)
+else()
+	SET(EASYCL_LIBRARIES ${CMAKE_INSTALL_PREFIX}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}EasyCL${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_INSTALL_PREFIX}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}clew${CMAKE_SHARED_LIBRARY_SUFFIX})
+endif()
 SET(EASYCL_FOUND ON)

 #add_custom_target(EasyCL_delete_stamp EasyCL-external clBLAS-external


Fix obvious cut&paste error on AArch64 Compiler-RT settings

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

--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -149,7 +149,7 @@
   elseif("${COMPILER_RT_TEST_TARGET_ARCH}" MATCHES "aarch32")
     test_target_arch(aarch32 "-march=armv8-a")
   elseif("${COMPILER_RT_TEST_TARGET_ARCH}" MATCHES "aarch64")
-    test_target_arch(aarch32 "-march=armv8-a")
+    test_target_arch(aarch64 "-march=armv8-a")
   endif()
   set(COMPILER_RT_OS_SUFFIX "")
 endif()


cmake install fix

cmake install fix

git-svn-id: 6b1c4fe79111c0bc0cce83313250759594f8984b@5112 e128ff1e-fa79-4151-a8cb-522299a2c450

--- cmake/gsInstall.cmake
+++ cmake/gsInstall.cmake
@@ -4,7 +4,7 @@

 message ("  CMAKE_INSTALL_PREFIX    ${CMAKE_INSTALL_PREFIX}")

-#set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY true)
+set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY true)

 # Offer the user the choice of overriding the installation directories
 set(INSTALL_LIB_DIR     lib     CACHE PATH "Installation directory for libraries")


cmake: toolchain: Checksum the toolchain to uniquely identify it

This commit introduces TOOLCHAIN_SIGNATURE. A CMake variable that is
defined like this:

Toolchains with the same signature will always support the same set of
flags.

Currently it is implemented by MD5summing the CC binary.

This is useful for instance if the build system needs to determine if
it has seen the toolchain before, e.g. in a caching use-case.

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

--- cmake/toolchain.cmake
+++ cmake/toolchain.cmake
@@ -36,3 +36,17 @@
 # Configure the toolchain based on what toolchain technology is used
 # (gcc, host-gcc etc.)
 include(${ZEPHYR_BASE}/cmake/compiler/${COMPILER}.cmake OPTIONAL)
+
+# Uniquely identify the toolchain wrt. it's capabilities.
+#
+# What we are looking for, is a signature definition that is defined
+# like this:
+
+# Toolchains with the same signature will always support the same set
+# of flags.
+
+# It is not clear how this signature should be constructed. The
+# strategy chosen is to md5sum the CC binary.
+
+file(MD5 ${CMAKE_C_COMPILER} CMAKE_C_COMPILER_MD5_SUM)
+set(TOOLCHAIN_SIGNATURE ${CMAKE_C_COMPILER_MD5_SUM})


Change to build on Mac OS X 10.10 (Yosemite).

--- build/cmake/CondorConfigure.cmake
+++ build/cmake/CondorConfigure.cmake
@@ -19,7 +19,7 @@
 # OS pre mods
 if(${OS_NAME} STREQUAL "DARWIN")
   exec_program (sw_vers ARGS -productVersion OUTPUT_VARIABLE TEST_VER)
-  if(${TEST_VER} MATCHES "10.[6789]" AND ${SYS_ARCH} MATCHES "I386")
+  if(${TEST_VER} MATCHES "10.([6789]|10)" AND ${SYS_ARCH} MATCHES "I386")
 	set (SYS_ARCH "X86_64")
   endif()
 elseif(${OS_NAME} MATCHES "WIN")


Synchronize adm files

Synchronize adm files

--- adm_local_without_kernel/cmake_files/SalomeSetupPlatform.cmake
+++ adm_local_without_kernel/cmake_files/SalomeSetupPlatform.cmake
@@ -94,26 +94,42 @@
   SET(PLATFORM_LIBS Ws2_32.lib)
   LIST(APPEND PLATFORM_LIBS Userenv.lib)      # At least for GEOM suit

-  # Disable iterator debugging on WINDOWS to avoid runtime error during checking iterators
-    # _SECURE_SCL
-    #             If defined as 1, unsafe iterator use causes a runtime error.
-    #             If defined as 0, checked iterators are disabled.
-    #             The default value for _SECURE_SCL is 1
-    # _SECURE_SCL_THROWS
-    #             If defined as 1, an out of range iterator use causes an exception at runtime.
-    #             If defined as 0, the program is terminated by calling invalid_parameter.
-    #             The default value for _SECURE_SCL_THROWS is 0
-
-  ADD_DEFINITIONS(-D_SECURE_SCL=0 -D_SECURE_SCL_THROWS=0)
-
-    # The symbol _HAS_ITERATOR_DEBUGGING can be used to turn off the iterator debugging feature in a debug build
-    #             If defined as 1, iterator debugging is enabled.
-    #             If defined as 0, iterator debugging is disabled.
-    #             The default value for _HAS_ITERATOR_DEBUGGING is 1
-
-  IF(NOT CMAKE_BUILD_TYPE STREQUAL "RELEASE" AND NOT CMAKE_BUILD_TYPE STREQUAL "Release")
-    ADD_DEFINITIONS(-D_HAS_ITERATOR_DEBUGGING=0)
-  ENDIF(NOT CMAKE_BUILD_TYPE STREQUAL "RELEASE" AND NOT CMAKE_BUILD_TYPE STREQUAL "Release")
+################################################################################################
+#
+# RNV: In the SALOME sometimes operating with STL collections is done in not fully valid way.
+#      To avoid run-time exception in Debug mode default values of the _SECURE_SCL,
+#      _SECURE_SCL_THROWS and _HAS_ITERATOR_DEBUGGING macros were redefined. It solved a problem
+#      then we used tne Microsoft Visual Studio 2008 to build SALOME on Windows platform.
+#      But in the Microsoft Visual Studio 2010 these macros affect on the size of STL collection
+#      classes(in difference from the Microsoft Visual Studio 2008: in this version of MSVS size
+#      of the STL collection  classes does not depend on these macros).
+#      All pre-requisite products are built by MSVS 2010 in Debug mode with the default
+#      values of the metioned above macros (namely _SECURE_SCL=1, _HAS_ITERATOR_DEBUGGING=1 and
+#      _SECURE_SCL_THROWS=1). So SALOME modules should be build in the same configuration.
+#
+################################################################################################
+#
+#  # Disable iterator debugging on WINDOWS to avoid runtime error during checking iterators
+#    # _SECURE_SCL
+#    #             If defined as 1, unsafe iterator use causes a runtime error.
+#    #             If defined as 0, checked iterators are disabled.
+#    #             The default value for _SECURE_SCL is 1
+#    # _SECURE_SCL_THROWS
+#    #             If defined as 1, an out of range iterator use causes an exception at runtime.
+#    #             If defined as 0, the program is terminated by calling invalid_parameter.
+#    #             The default value for _SECURE_SCL_THROWS is 0
+#
+#  ADD_DEFINITIONS(-D_SECURE_SCL=0 -D_SECURE_SCL_THROWS=0)
+#
+#    # The symbol _HAS_ITERATOR_DEBUGGING can be used to turn off the iterator debugging feature in a debug build
+#    #             If defined as 1, iterator debugging is enabled.
+#    #             If defined as 0, iterator debugging is disabled.
+#    #             The default value for _HAS_ITERATOR_DEBUGGING is 1
+#
+#  IF(NOT CMAKE_BUILD_TYPE STREQUAL "RELEASE" AND NOT CMAKE_BUILD_TYPE STREQUAL "Release")
+#    ADD_DEFINITIONS(-D_HAS_ITERATOR_DEBUGGING=0)
+#  ENDIF(NOT CMAKE_BUILD_TYPE STREQUAL "RELEASE" AND NOT CMAKE_BUILD_TYPE STREQUAL "Release")
+################################################################################################

   IF(MACHINE_IS_64)
     SET(SIZE_OF_LONG 4)                          # set sizeof(long) to 4 byte


Removed Apple-specific options from the generic Clang toolchain module. Added a documentation link.


Fix intelmpi oversubscription on circle

Fix intelmpi oversubscription on circle

--- scripts/circle/circle_el7-intel18-impi.cmake
+++ scripts/circle/circle_el7-intel18-impi.cmake
@@ -30,6 +30,9 @@
 find_program(MPI_CXX_COMPILER mpiicpc)
 find_program(MPI_Fortran_COMPILER mpiifort)

+# Allow oversubscription for IntelMPI to prevent timeouts on circleci
+set(ENV{I_MPI_WAIT_MODE} "enable")
+
 set(dashboard_cache "
 ADIOS2_USE_ADIOS1:STRING=ON
 ADIOS2_USE_BZip2:STRING=ON


BUG: Mantis-1428: undefined variables when building outside OTB

--- CMake/OTBApplicationMacros.cmake
+++ CMake/OTBApplicationMacros.cmake
@@ -67,7 +67,7 @@
      endif()
    else()
      install(TARGETS ${APPLICATION_TARGET_NAME}
-             LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
+             LIBRARY DESTINATION lib
              COMPONENT RuntimeLibraries)
    endif()

@@ -79,9 +79,19 @@
      set(APPLICATION_BINARY_PATH ${CMAKE_CURRENT_BINARY_DIR})
    endif()

+   if(CMAKE_RUNTIME_OUTPUT_DIRECTORY)
+     set(_script_output_dir ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
+   else()
+     set(_script_output_dir ${CMAKE_BINARY_DIR}/bin)
+   endif()
+   if(OTB_INSTALL_RUNTIME_DIR)
+     set(_script_install_dir ${OTB_INSTALL_RUNTIME_DIR})
+   else()
+     set(_script_install_dir bin)
+   endif()
    set(INTERMEDIATE_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY})
    set(SCRIPT_EXT "")
-   if (WIN32)
+   if(WIN32)
      set(SCRIPT_EXT ".bat")
    endif()

@@ -95,11 +105,11 @@
        TYPE ${type})
      # Copy it next to the application shared lib, and give executable rights
      file(COPY ${INTERMEDIATE_DIR}/${SCRIPT_NAME}
-          DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
+          DESTINATION ${_script_output_dir}
           FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
      # Install a version of this script if we are inside the OTB build
-     install(PROGRAMS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${SCRIPT_NAME}
-             DESTINATION ${OTB_INSTALL_RUNTIME_DIR}
+     install(PROGRAMS ${_script_output_dir}/${SCRIPT_NAME}
+             DESTINATION ${_script_install_dir}
              COMPONENT Runtime)
    endforeach()


tweak cmake module search path order

tweak cmake module search path order

--- CMakeModules/FindlibSquish.cmake
+++ CMakeModules/FindlibSquish.cmake
@@ -3,8 +3,8 @@
 #  LIBSQUISH_INCLUDE_DIR
 #  LIBSQUISH_LIBRARIES

-FIND_PATH(LIBSQUISH_INCLUDE_DIR squish.h PATHS . .. squish ../squish DOC "Directory containing libSquish headers")
-FIND_LIBRARY(LIBSQUISH_LIBRARY NAMES squish libsquish PATHS . .. squish ../squish DOC "Path to libSquish library")
+FIND_PATH(LIBSQUISH_INCLUDE_DIR squish.h PATHS . squish .. ../squish DOC "Directory containing libSquish headers")
+FIND_LIBRARY(LIBSQUISH_LIBRARY NAMES squish libsquish PATHS . squish .. ../squish DOC "Path to libSquish library")

 SET(LIBSQUISH_LIBRARIES ${LIBSQUISH_LIBRARY})


Implement QUIET for UDT finder

Implement QUIET for UDT finder

--- FindUDT.cmake
+++ FindUDT.cmake
@@ -1,3 +1,4 @@
+
 find_path(_udt_INCLUDE_DIR udt.h
   HINTS ${UDT_ROOT}/include
   PATHS /usr/include /usr/local/include /opt/local/include /usr/include/udt)
@@ -16,7 +17,7 @@
   file(STRINGS "${_udt_INCLUDE_DIR}/udt.h" UDT_HAS_RCVDATA REGEX UDT_RCVDATA)
 endif()

-if(UDT_FOUND)
+if(UDT_FOUND AND NOT UDT_FIND_QUIETLY)
   message(STATUS "Found UDT in ${UDT_INCLUDE_DIRS};${UDT_LIBRARIES}")
 endif()


Have SubProject return a list of directories

* SUBPROJECT_PATHS is a list of directories of the subprojects,
  it is percolated up such that it can be used for exclusion in
  coverage, for example

--- SubProject.cmake
+++ SubProject.cmake
@@ -49,6 +49,9 @@
 #  cmake --graphviz=graph.dot
 #  tred graph.dot > graph2.dot
 #  neato -Goverlap=prism -Goutputorder=edgesfirst graph2.dot -Tpdf -o graph.pdf
+#
+# Output Variables:
+# - SUBPROJECT_PATHS: list of paths to subprojects, useful for exclusion lists

 include(${CMAKE_CURRENT_LIST_DIR}/GitExternal.cmake)
 include(${CMAKE_CURRENT_LIST_DIR}/CommonGraph.cmake)
@@ -154,6 +157,7 @@
   add_subdirectory("${__common_source_dir}/${path}"
     "${CMAKE_BINARY_DIR}/${name}")
   set(${name}_IS_SUBPROJECT ON PARENT_SCOPE)
+
   # Mark globally that we've already used name as a sub project
   set_property(GLOBAL PROPERTY ${name}_IS_SUBPROJECT ON)
   # Create <project>-all target
@@ -225,7 +229,12 @@
         "else()\n"
         "  file(APPEND .gitsubprojects \"git_subproject(${__subproject})\n\")\n"
         "endif()\n")
+     set(SUBPROJECT_PATHS "${SUBPROJECT_PATHS} ${__subproject_dir}"
+       CACHE INTERNAL SUBPROJECT_PATHS)
     endforeach()
+
+    separate_arguments(SUBPROJECT_PATHS)
+    list(REMOVE_DUPLICATES SUBPROJECT_PATHS)

     add_custom_target(update_git_subprojects_${PROJECT_NAME}
       COMMAND ${CMAKE_COMMAND} -P ${GIT_SUBPROJECTS_SCRIPT}


Typos

Typos

--- cmake/modules/Findchirp.cmake
+++ cmake/modules/Findchirp.cmake
@@ -6,8 +6,8 @@
 #  CHIRP_INCLUDE_DIRS (not cached)
 #  CHIRP_LIBRARIES

-find_path(CHIRP_INCLUDE_DIR NAMES chirp.h  HINTS ${CCTOOLS_DIR}/include/cctools $ENV{CCTOOLS_DIR}/inlcude/cctools)
-find_library(CHIRP_LIBRARY NAMES chirp_client HINTS ${CCTOOLS_DIR}/lib $ENV{CCTOOLS_DIR}/lib)
+find_path(CHIRP_INCLUDE_DIR NAMES chirp.h  HINTS ${CHIRP_DIR}/include/cctools $ENV{CHIRP_DIR}/inlcude/cctools)
+find_library(CHIRP_LIBRARY NAMES chirp_client HINTS ${CHIRP_DIR}/lib $ENV{CHIRP_DIR}/lib)

 set(CHIRP_INCLUDE_DIRS ${CHIRP_INCLUDE_DIR})
 set(CHIRP_LIBRARIES ${CHIRP_LIBRARY})


Fix mrpt build in non-Intel archs (disable SSE2 in libcvd)

--- cmakemodules/script_cvd.cmake
+++ cmakemodules/script_cvd.cmake
@@ -4,7 +4,8 @@
 	SOURCE_DIR ${MRPT_SOURCE_DIR}/otherlibs/libcvd
 	CMAKE_ARGS
 		-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-		-DCVD_SSE2=${CMAKE_MRPT_HAS_SSE2}
+		# No SSE2: Gives problems in non Intel archs, and anyway we don't exploit libcvd CPU-intensive ops from mrpt
+		-DCVD_SSE2=OFF
 		-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
 		-DCVD_TESTS=OFF
 		-DCVD_PROGS=OFF
@@ -16,7 +17,7 @@
 set(CVD_BIN_DIR "${MRPT_BINARY_DIR}/libcvd-prefix/src/libcvd-build")

 set(CVD_INCLUDE_DIRS "${CVD_DIR}" "${CVD_BIN_DIR}/include")
-
+
 if(MSVC)
 	set(CVD_LIB "${CVD_BIN_DIR}/$<CONFIG>/CVD$<$<CONFIG:Debug>:_debug>.lib")
 else()