xctest find lib

xctest find lib

--- platform/build/macos-xcode.cmake
+++ platform/build/macos-xcode.cmake
@@ -32,6 +32,10 @@

     # core foundation
     target_link_libraries(platform "-framework CoreFoundation")
+
+    # XCTest
+	find_library(XCTEST XCTest)
+    target_link_libraries(platform ${XCTEST})

 endfunction(platform_link_libraries)


[UPD] CMake variable MATLAB_EXECUTABLE added in FindMatlab.cmake

--- CMake/FindMatlab.cmake
+++ CMake/FindMatlab.cmake
@@ -7,6 +7,7 @@
 #
 # This module defines:
 #  MATLAB_ROOT:               Matlab installation path
+#  MATLAB_EXECUTABLE:         Path to the Matlab executable
 #  MATLAB_INCLUDE_DIR:        Include path for mex.h, engine.h
 #  MATLAB_MEX_LIBRARY:        Path to libmex.lib
 #  MATLAB_MX_LIBRARY:         Path to libmx.lib
@@ -25,10 +26,10 @@
 # Redistribution and use is allowed according to the terms of the BSD license.
 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.

-IF(MATLAB_ROOT AND MATLAB_INCLUDE_DIR AND MATLAB_LIBRARIES)
+IF(MATLAB_ROOT AND MATLAB_EXECUTABLE AND MATLAB_INCLUDE_DIR AND MATLAB_LIBRARIES)
    # in cache already
    SET(Matlab_FIND_QUIETLY TRUE)
-ENDIF(MATLAB_ROOT AND MATLAB_INCLUDE_DIR AND MATLAB_LIBRARIES)
+ENDIF(MATLAB_ROOT AND MATLAB_EXECUTABLE AND MATLAB_INCLUDE_DIR AND MATLAB_LIBRARIES)

 IF(WIN32)
   # Default paths
@@ -187,6 +188,11 @@
   SET(MATLAB_INCLUDE_PATHS "${MATLAB_ROOT}/extern/include")
 ENDIF(WIN32)

+FIND_PROGRAM(MATLAB_EXECUTABLE
+    "matlab"
+    PATHS ${MATLAB_ROOT}
+    PATH_SUFFIXES "bin" NO_DEFAULT_PATH
+    )
 FIND_LIBRARY(MATLAB_MEX_LIBRARY
     ${LIBMEX}
     ${MATLAB_LIBRARIES_PATHS} NO_DEFAULT_PATH
@@ -249,10 +255,11 @@

 IF(MATLAB_ROOT)
   INCLUDE(FindPackageHandleStandardArgs)
-  FIND_PACKAGE_HANDLE_STANDARD_ARGS(Matlab DEFAULT_MSG MATLAB_ROOT MATLAB_INCLUDE_DIR MATLAB_MEX_LIBRARY MATLAB_MX_LIBRARY MATLAB_ENG_LIBRARY)
+  FIND_PACKAGE_HANDLE_STANDARD_ARGS(Matlab DEFAULT_MSG MATLAB_ROOT MATLAB_EXECUTABLE MATLAB_INCLUDE_DIR MATLAB_MEX_LIBRARY MATLAB_MX_LIBRARY MATLAB_ENG_LIBRARY)
 ENDIF(MATLAB_ROOT)

 MARK_AS_ADVANCED(
+  MATLAB_EXECUTABLE
   MATLAB_MEX_LIBRARY
   MATLAB_MX_LIBRARY
   MATLAB_ENG_LIBRARY


Add new free type version.

Add new free type version.

--- CMake/Packages/FindFreetype.cmake
+++ CMake/Packages/FindFreetype.cmake
@@ -31,7 +31,7 @@
   FREETYPE_INCLUDE_DIR
 )

-set(FREETYPE_LIBRARY_NAMES freetype248 freetype246 freetype2311 freetype239 freetype238 freetype235 freetype219 freetype)
+set(FREETYPE_LIBRARY_NAMES freetype249 freetype248 freetype246 freetype2311 freetype239 freetype238 freetype235 freetype219 freetype)
 get_debug_names(FREETYPE_LIBRARY_NAMES)

 use_pkgconfig(FREETYPE_PKGC freetype2)


ENH: factor pqxx includes

ENH: factor pqxx includes

--- CMake/otbIncludeDirectories.cmake
+++ CMake/otbIncludeDirectories.cmake
@@ -90,7 +90,7 @@

 IF(OTB_USE_PQXX)
   SET(OTB_INCLUDE_DIRS_BUILD_TREE ${OTB_INCLUDE_DIRS_BUILD_TREE}
-    ${OTB_SOURCE_DIR}/Code/GeospatialAnalysis)
+    ${OTB_SOURCE_DIR}/Code/GeospatialAnalysis ${PQXX_INCLUDE_DIR})
 ENDIF(OTB_USE_PQXX)

 IF(OTB_USE_SIFTFAST)
@@ -128,12 +128,6 @@
   SET(OTB_INCLUDE_DIRS_BUILD_TREE ${OTB_INCLUDE_DIRS_BUILD_TREE}
   	${GETTEXT_INCLUDE_DIR})
 ENDIF(OTB_USE_GETTEXT)
-
-IF(OTB_USE_PQXX)
-  SET(OTB_INCLUDE_DIRS_BUILD_TREE ${OTB_INCLUDE_DIRS_BUILD_TREE}
-  	${PQXX_INCLUDE_DIR})
-ENDIF(OTB_USE_PQXX)
-

 #-----------------------------------------------------------------------------
 # Include directories from the ITK build tree.


:white_check_mark: update test suite

:white_check_mark: update test suite

--- cmake/download_test_data.cmake
+++ cmake/download_test_data.cmake
@@ -1,7 +1,7 @@
 find_package(Git)

 set(JSON_TEST_DATA_URL     https://github.com/nlohmann/json_test_data)
-set(JSON_TEST_DATA_VERSION 2.0.0)
+set(JSON_TEST_DATA_VERSION 3.0.0)

 # target to download test data
 add_custom_target(download_test_data


Disable Boost.Python build

Disable Boost.Python build

--- blocks/boost/install/install.cmake
+++ blocks/boost/install/install.cmake
@@ -79,9 +79,7 @@
         set(BII_BOOST_BUILD_J 1 CACHE INTERNAL "Biicode boost ${BII_BOOST_VERSION} build threads count")
     endif()

-    set(__BII_BOOST_BOOTSTRAP_CALL ${__BII_BOOST_BOOSTRAPER} $<MINGW:"mingw">
-                                                             --prefix=${BII_BOOST_DIR}
-                                                             --without-libraries=python #Boost.Python currently not supported by biicode. Oh the irony...
+    set(__BII_BOOST_BOOTSTRAP_CALL ${__BII_BOOST_BOOSTRAPER} --prefix=${BII_BOOST_DIR}
                                    CACHE INTERNAL "Biicode boost ${BII_BOOST_VERSION} boostrap call")

     set(__BII_BOOST_B2_CALL        ${__BII_BOOST_B2} --includedir=${BII_BOOST_DIR}
@@ -89,6 +87,7 @@
                                                      -j${BII_BOOST_BUILD_J}
                                                      --layout=versioned
                                                      --build-type=complete
+                                                     --without-python
                                    CACHE INTERNAL "Biicode boost ${BII_BOOST_VERSION} b2 call")
 endfunction()


boards: px4_fmu-v5_stackcheck add gyro_fft

--- boards/px4/fmu-v5/stackcheck.cmake
+++ boards/px4/fmu-v5/stackcheck.cmake
@@ -72,7 +72,7 @@
 		fw_att_control
 		fw_pos_control_l1
 		gyro_calibration
-		#gyro_fft
+		gyro_fft
 		land_detector
 		#landing_target_estimator
 		load_mon


cmake: Fix LAPACK macOS build resetting CMAKE_OSX_* variables

--- SuperBuild/External_LAPACK.cmake
+++ SuperBuild/External_LAPACK.cmake
@@ -156,6 +156,19 @@
     mark_as_superbuild(Fortran_COMPILER_ID:STRING)
     mark_as_superbuild(Fortran_${Fortran_COMPILER_ID}_EXECUTABLE)

+    set(EXTERNAL_PROJECT_OPTIONAL_CMAKE_CACHE_ARGS)
+    if(APPLE)
+      # Since Detect/Verify tests associated with FortranCInterface CMake module
+      # fails when at least the CMAKE_OSX_ARCHITECTURES option is set to x86_64,
+      # we explicitly disable the CMAKE_OSX_* options here.
+      # Failure was observed when using gfortran_osx-64 from conda.
+      list(APPEND EXTERNAL_PROJECT_OPTIONAL_CMAKE_CACHE_ARGS
+        -DCMAKE_OSX_ARCHITECTURES:STRING=
+        -DCMAKE_OSX_SYSROOT:PATH=
+        -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=
+        )
+    endif()
+
     ExternalProject_Add(${proj}
       ${${proj}_EP_ARGS}
       GIT_REPOSITORY "${Slicer_${proj}_GIT_REPOSITORY}"
@@ -163,6 +176,7 @@
       SOURCE_DIR ${EP_SOURCE_DIR}
       BINARY_DIR ${EP_BINARY_DIR}
       CMAKE_CACHE_ARGS
+        ${EXTERNAL_PROJECT_OPTIONAL_CMAKE_CACHE_ARGS}
         # Compiler settings
         -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER}
         -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}


pw_protobuf_compiler/cmake: Refactor _pw_generate_protos API

Refactors the internal _pw_generator_protos API to not just use
positional arguments to make it easier to pass additional DEPS
in the future.

Change-Id: Ia230332f9f9a6182553541738b96e1facddeee86
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/117831
Pigweed-Auto-Submit: Ewout van Bekkum <638f134dbc68778d6b859fb04a64baea2b00b021@google.com>
Reviewed-by: Wyatt Hepler <cca3bedb37979eacd157a9bceb473582df8aea1e@google.com>
Commit-Queue: Ewout van Bekkum <638f134dbc68778d6b859fb04a64baea2b00b021@google.com>

--- pw_protobuf_compiler/proto.cmake
+++ pw_protobuf_compiler/proto.cmake
@@ -194,11 +194,19 @@
 endfunction(_pw_rebase_paths)

 # Internal function that invokes protoc through generate_protos.py.
-function(_pw_generate_protos
-    TARGET LANGUAGE PLUGIN OUTPUT_EXTS INCLUDE_FILE OUT_DIR SOURCES INPUTS DEPS)
+function(_pw_generate_protos TARGET LANGUAGE)
+  set(num_positional_args 2)
+  set(option_args)
+  set(one_value_args PLUGIN INCLUDE_FILE OUT_DIR)
+  set(multi_value_args OUTPUT_EXTS SOURCES INPUTS DEPENDS)
+  pw_parse_arguments_strict(
+      _pw_generate_protos "${num_positional_args}" "${option_args}"
+      "${one_value_args}" "${multi_value_args}")
+
   # Determine the names of the compiled output files.
   _pw_rebase_paths(outputs
-      "${OUT_DIR}/${LANGUAGE}" "${OUT_DIR}/sources" "${SOURCES}" "${OUTPUT_EXTS}")
+      "${arg_OUT_DIR}/${LANGUAGE}" "${arg_OUT_DIR}/sources" "${arg_SOURCES}"
+      "${arg_OUTPUT_EXTS}")

   # Export the output files to the caller's scope so it can use them if needed.
   set(generated_outputs "${outputs}" PARENT_SCOPE)
@@ -206,7 +214,7 @@
   if("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows")
       get_filename_component(dir "${source_file}" DIRECTORY)
       get_filename_component(name "${source_file}" NAME_WE)
-      set(PLUGIN "${dir}/${name}.bat")
+      set(arg_PLUGIN "${dir}/${name}.bat")
   endif()

   set(script "$ENV{PW_ROOT}/pw_protobuf_compiler/py/pw_protobuf_compiler/generate_protos.py")
@@ -215,16 +223,16 @@
       python3
       "${script}"
       --language "${LANGUAGE}"
-      --plugin-path "${PLUGIN}"
-      --include-file "${INCLUDE_FILE}"
-      --compile-dir "${OUT_DIR}/sources"
-      --out-dir "${OUT_DIR}/${LANGUAGE}"
-      --sources ${SOURCES}
+      --plugin-path "${arg_PLUGIN}"
+      --include-file "${arg_INCLUDE_FILE}"
+      --compile-dir "${arg_OUT_DIR}/sources"
+      --out-dir "${arg_OUT_DIR}/${LANGUAGE}"
+      --sources ${arg_SOURCES}
     DEPENDS
       ${script}
-      ${SOURCES}
-      ${INPUTS}
-      ${DEPS}
+      ${arg_SOURCES}
+      ${arg_INPUTS}
+      ${arg_DEPENDS}
     OUTPUT
       ${outputs}
   )
@@ -244,15 +252,21 @@

   list(TRANSFORM arg_DEPS APPEND .pwpb)

-  _pw_generate_protos("${NAME}"
-      pwpb
+  _pw_generate_protos("${NAME}" pwpb
+    PLUGIN
       "$ENV{PW_ROOT}/pw_protobuf/py/pw_protobuf/plugin.py"
+    OUTPUT_EXTS
       ".pwpb.h"
+    INCLUDE_FILE
       "${arg_INCLUDE_FILE}"
+    OUT_DIR
       "${arg_OUT_DIR}"
-      "${arg_SOURCES}"
-      "${arg_INPUTS}"
-      "${arg_DEPS}"
+    SOURCES
+      ${arg_SOURCES}
+    INPUTS
+      ${arg_INPUTS}
+    DEPENDS
+      ${arg_DEPS}
   )

   # Create the library with the generated source files.
@@ -282,15 +296,21 @@
   # Determine the names of the output files.
   list(TRANSFORM arg_DEPS APPEND .pwpb_rpc)

-  _pw_generate_protos("${NAME}"
-      pwpb_rpc
+  _pw_generate_protos("${NAME}" pwpb_rpc
+    PLUGIN
       "$ENV{PW_ROOT}/pw_rpc/py/pw_rpc/plugin_pwpb.py"
+    OUTPUT_EXTS
       ".rpc.pwpb.h"
+    INCLUDE_FILE
       "${arg_INCLUDE_FILE}"
+    OUT_DIR
       "${arg_OUT_DIR}"
-      "${arg_SOURCES}"
-      "${arg_INPUTS}"
-      "${arg_DEPS}"
+    SOURCES
+      ${arg_SOURCES}
+    INPUTS
+      ${arg_INPUTS}
+    DEPENDS
+      ${arg_DEPS}
   )

   # Create the library with the generated source files.
@@ -323,15 +343,21 @@

   list(TRANSFORM arg_DEPS APPEND .raw_rpc)

-  _pw_generate_protos("${NAME}"
-      raw_rpc
+  _pw_generate_protos("${NAME}" raw_rpc
+    PLUGIN
       "$ENV{PW_ROOT}/pw_rpc/py/pw_rpc/plugin_raw.py"
+    OUTPUT_EXTS
       ".raw_rpc.pb.h"
+    INCLUDE_FILE
       "${arg_INCLUDE_FILE}"
+    OUT_DIR
       "${arg_OUT_DIR}"
-      "${arg_SOURCES}"
-      "${arg_INPUTS}"
-      "${arg_DEPS}"
+    SOURCES
+      ${arg_SOURCES}
+    INPUTS
+      ${arg_INPUTS}
+    DEPENDS
+      ${arg_DEPS}
   )

   # Create the library with the generated source files.
@@ -387,15 +413,22 @@
           ${arg_DEPS}
       )
     else()
-      _pw_generate_protos("${NAME}"
-          nanopb
+      _pw_generate_protos("${NAME}" nanopb
+        PLUGIN
           "${dir_pw_third_party_nanopb}/generator/protoc-gen-nanopb"
-          ".pb.h;.pb.c"
+        OUTPUT_EXTS
+          ".pb.h"
+          ".pb.c"
+        INCLUDE_FILE
           "${arg_INCLUDE_FILE}"
+        OUT_DIR
           "${arg_OUT_DIR}"
-          "${arg_SOURCES}"
-          "${arg_INPUTS}"
-          "${arg_DEPS}"
+        SOURCES
+          ${arg_SOURCES}
+        INPUTS
+          ${arg_INPUTS}
+        DEPENDS
+          ${arg_DEPS}
       )

       # Create the library with the generated source files.
@@ -428,15 +461,21 @@
   # Determine the names of the output files.
   list(TRANSFORM arg_DEPS APPEND .nanopb_rpc)

-  _pw_generate_protos("${NAME}"
-      nanopb_rpc
+  _pw_generate_protos("${NAME}" nanopb_rpc
+    PLUGIN
       "$ENV{PW_ROOT}/pw_rpc/py/pw_rpc/plugin_nanopb.py"
+    OUTPUT_EXTS
       ".rpc.pb.h"
+    INCLUDE_FILE
       "${arg_INCLUDE_FILE}"
+    OUT_DIR
       "${arg_OUT_DIR}"
-      "${arg_SOURCES}"
-      "${arg_INPUTS}"
-      "${arg_DEPS}"
+    SOURCES
+      ${arg_SOURCES}
+    INPUTS
+      ${arg_INPUTS}
+    DEPENDS
+      ${arg_DEPS}
   )

   # Create the library with the generated source files.


Fix wrong variables marked as advanced

Fix wrong variables marked as advanced

Should mark LIBRARIES and DIRS rather than LIBRARY and DIR

--- cmake/Modules/FindSampgdk3.cmake
+++ cmake/Modules/FindSampgdk3.cmake
@@ -14,4 +14,4 @@
 include(FindPackageHandleStandardArgs)
 find_package_handle_standard_args(Sampgdk3 DEFAULT_MSG Sampgdk3_LIBRARY Sampgdk3_INCLUDE_DIR)

-mark_as_advanced(Sampgdk3_LIBRARY Sampgdk3_INCLUDE_DIR)
+mark_as_advanced(Sampgdk3_LIBRARIES Sampgdk3_INCLUDE_DIRS)


fix compile flags for windows-clang

fix compile flags for windows-clang

--- cmake/Saiga_compiler_flags.cmake
+++ cmake/Saiga_compiler_flags.cmake
@@ -1,5 +1,6 @@
 ############# Check which compiler is used ############

+set(SAIGA_CXX_WCLANG 0)
 set(SAIGA_CXX_CLANG 0)
 set(SAIGA_CXX_GNU 0)
 set(SAIGA_CXX_INTEL 0)
@@ -7,8 +8,13 @@

 if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+	if(WIN32)
+    set(SAIGA_CXX_WCLANG 1)
+    message(STATUS "Detected Compiler:   Windows Clang")
+	else()
     set(SAIGA_CXX_CLANG 1)
     message(STATUS "Detected Compiler:   Clang")
+	endif()
 elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
     set(SAIGA_CXX_GNU 1)
     message(STATUS "Detected Compiler:   GNU")
@@ -57,7 +63,7 @@
     SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
 endif()

-if(SAIGA_CXX_MSVC)
+if(SAIGA_CXX_MSVC OR SAIGA_CXX_WCLANG)
     #multiprocessor compilation for visual studio
     SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
     add_definitions(-D_ENABLE_EXTENDED_ALIGNED_STORAGE)


Activate branch coverage collection in lcov

In newer versions of lcov branch coverage is disabled by default
and must be explicitly activated.

--- cmake/modules/CodeCoverage.cmake
+++ cmake/modules/CodeCoverage.cmake
@@ -53,14 +53,15 @@
   mark_as_advanced(CodeCov_GNU_LCOV CodeCov_GNU_GENHTML)

   add_custom_target(codecov_prerun
-    ${CodeCov_GNU_LCOV} --directory . --zerocounters
+    ${CodeCov_GNU_LCOV} --quiet --rc lcov_branch_coverage=1 --directory . --zerocounters
     WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
   COMMENT "Cleaning up coverage statistics")

   add_custom_target(codecov_postrun
-    ${CodeCov_GNU_LCOV} --directory . --capture --output-file coverage.info
-    COMMAND ${CodeCov_GNU_LCOV} --remove coverage.info '/usr/*' --output-file coverage.info.cleaned
-    COMMAND ${CodeCov_GNU_GENHTML} -o coverage coverage.info.cleaned
+    ${CodeCov_GNU_LCOV} --quiet --rc lcov_branch_coverage=1 --directory . --capture --output-file coverage.info
+    COMMAND ${CodeCov_GNU_LCOV} --quiet --rc lcov_branch_coverage=1 --remove coverage.info '/usr/*' --output-file coverage.info.cleaned
+    COMMAND ${CodeCov_GNU_LCOV} --rc lcov_branch_coverage=1 --summary coverage.info.cleaned
+    COMMAND ${CodeCov_GNU_GENHTML} --quiet --rc lcov_branch_coverage=1 -o coverage coverage.info.cleaned
     COMMAND ${CMAKE_COMMAND} -E remove ${_outputname}.info ${_outputname}.info.cleaned

     WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
@@ -156,7 +157,7 @@
     message(
       WARNING "Unknown host system \"${CMAKE_HOST_SYSTEM_NAME}\",
         coverage runs that fail may break whole coverage record.")
-    set(failsafe_command ${command} ${ARGV2})
+    set(failsafe_command ${command} ${ARGVN})
   endif()

   add_custom_target(${name} COMMAND ${failsafe_command})


Adding the extraction of the strings from the sources and the merge with the .pot file All additional translation targets are creating a new, merged .po (with the previous .pot), prior to compiling to .mo

--- cmake_modules/PHD2BuildDoc.cmake
+++ cmake_modules/PHD2BuildDoc.cmake
@@ -228,9 +228,10 @@
   endif()

   set(input_folder "${_local_vars_INPUT_FOLDER}")
+  set(default_locale "en_EN")

   if("${_local_vars_LOCALE}" STREQUAL "")
-    set(locale "en_EN")
+    set(locale ${default_locale})
   else()
     set(locale "${_local_vars_LOCALE}")
   endif()
@@ -285,29 +286,73 @@

   endif()

+
   # about translation in the GUI
-  if(EXISTS "${input_folder}/messages.po")
+  set(translation_input_files)
+  set(translation_target_files)
+
+  set(current_translation_output_folder ${CMAKE_BINARY_DIR}/translation/${locale})
+  if(NOT EXISTS "${current_translation_output_folder}")
+    file(MAKE_DIRECTORY "${current_translation_output_folder}")
+  endif()
+
+  if("${locale}" STREQUAL "${default_locale}")
+    # for the default language, we generate the .po file from the sources
+    # we generate the global .po file from the sources
+
+    # the command that generates a global .po file
+    if(NOT "${XGETTEXT}" STREQUAL "")
+      # TODO globing the sources to make the target dependent
+
+      # extracts the messages from the sources and merges those messages with the locale/messages.pot
+      add_custom_command(
+          OUTPUT
+            "${current_translation_output_folder}/messages.po"
+            "${current_translation_output_folder}/messages.pot"
+          # DEPENDS "${input_folder}/messages.po" depends on all files
+          COMMAND ${XGETTEXT} *.cpp *.h -C --from-code=CP1252 --keyword="_" --keyword="wxPLURAL:1,2" --keyword="wxTRANSLATE" --output="${current_translation_output_folder}/messages.po"
+          COMMAND ${MSGMERGE} -N
+            -o "${current_translation_output_folder}/messages.pot"
+            "${PHD_PROJECT_ROOT_DIR}/locale/messages.pot" "${current_translation_output_folder}/messages.po"
+          COMMENT "Generating ${current_translation_output_folder}/messages.po"
+          WORKING_DIRECTORY ${PHD_PROJECT_ROOT_DIR}
+          )
+
+      # compiles the merged messages to a .mo file
+      add_custom_command(
+          OUTPUT
+            "${current_translation_output_folder}/messages.mo"
+          DEPENDS "${current_translation_output_folder}/messages.po"
+          COMMAND ${MSGFMT} "${current_translation_output_folder}/messages.po"
+          COMMENT "Generating ${current_translation_output_folder}/messages.mo"
+          WORKING_DIRECTORY ${current_translation_output_folder}
+          )
+      list(APPEND translation_target_files
+           "${current_translation_output_folder}/messages.po"
+           "${current_translation_output_folder}/messages.pot"
+           "${current_translation_output_folder}/messages.mo")
+      list(APPEND translation_input_files "${PHD_PROJECT_ROOT_DIR}/locale/messages.pot")
+    endif()
+  elseif(EXISTS "${input_folder}/messages.po")
     message(STATUS "[DOC] Creating translation target for locale ${locale}")
-
-    set(translation_input_files)
-    set(translation_target_files)

     if(NOT (EXISTS "${input_folder}/messages.po"))
       message(FATAL_ERROR "'${input_folder}/messages.po' file is missing")
     endif()
-
-    set(current_translation_output_folder ${CMAKE_BINARY_DIR}/translation/${locale})
     list(APPEND translation_input_files ${input_folder}/messages.po)
-
-    if(NOT EXISTS "${current_translation_output_folder}")
-      file(MAKE_DIRECTORY "${current_translation_output_folder}")
-    endif()

     if(NOT "${MSGFMT}" STREQUAL "")
       add_custom_command(
-          OUTPUT "${current_translation_output_folder}/messages.mo"
-          DEPENDS "${input_folder}/messages.po"
-          COMMAND ${MSGFMT} ${input_folder}/messages.po
+          OUTPUT
+            "${current_translation_output_folder}/messages.po"
+            "${current_translation_output_folder}/messages.mo"
+          DEPENDS
+            "${input_folder}/messages.po"
+            "${CMAKE_BINARY_DIR}/translation/${default_locale}/messages.pot"
+          COMMAND ${MSGMERGE} -N
+            -o "${current_translation_output_folder}/messages.po"
+            "${CMAKE_BINARY_DIR}/translation/${default_locale}/messages.pot" "${input_folder}/messages.po"
+          COMMAND ${MSGFMT} "${current_translation_output_folder}/messages.po"
           COMMENT "Generating ${current_translation_output_folder}/messages.mo"
           WORKING_DIRECTORY ${current_translation_output_folder}
           )
@@ -351,17 +396,15 @@
       endif()

     endif()
-
-    add_custom_target(${locale}_translation
-      SOURCES
-      ${translation_input_files}
-      ${translation_target_files})
-    source_group(input/ FILES ${translation_input_files})
-    source_group(generated/ FILES ${translation_target_files})
-    set_target_properties(${locale}_translation PROPERTIES FOLDER "Documentation/")
-
-
-  endif()
+  endif()
+
+  add_custom_target(${locale}_translation
+    SOURCES
+    ${translation_input_files}
+    ${translation_target_files})
+  source_group(input/ FILES ${translation_input_files})
+  source_group(generated/ FILES ${translation_target_files})
+  set_target_properties(${locale}_translation PROPERTIES FOLDER "Documentation/")

 endfunction()


make linux viewer build use the new boost lib names. :/

--- indra/cmake/Boost.cmake
+++ indra/cmake/Boost.cmake
@@ -42,8 +42,8 @@
     set(BOOST_REGEX_LIBRARY boost_regex-mt)
     set(BOOST_SIGNALS_LIBRARY boost_signals-mt)
   elseif (LINUX)
-    set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options-mt)
-    set(BOOST_REGEX_LIBRARY boost_regex-mt)
-    set(BOOST_SIGNALS_LIBRARY boost_signals-mt)
+    set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options-gcc41-mt)
+    set(BOOST_REGEX_LIBRARY boost_regex-gcc41-mt)
+    set(BOOST_SIGNALS_LIBRARY boost_signals-gcc41-mt)
   endif (WINDOWS)
 endif (STANDALONE)


Update: rely on find_package_handle_standard_args for message printing
NM: renice a bit

git-svn-id: e7ea667a1d39a4453c4efcc4ba7bca3d620c3f19@5219 a9d63959-f2ad-4865-b262-bf0e56cfafb6

--- cmake/Modules/Findlibusb-1.0.cmake
+++ cmake/Modules/Findlibusb-1.0.cmake
@@ -11,6 +11,9 @@
 #  Copyright (c) 2006 Andreas Schneider <mail@cynapses.org>
 #
 #  (Changes for libusb) Copyright (c) 2008 Kyle Machulis <kyle@nonpolynomial.com>
+#
+#  Point Cloud Library (PCL) - www.pointclouds.org
+#  Copyright (c) 2012, Willow Garage, Inc. (use of FindPackageHandleStandardArgs)
 #
 # Redistribution and use is allowed according to the terms of the New BSD license.
 #
@@ -42,57 +45,26 @@
 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #

-
 if (LIBUSB_1_LIBRARIES AND LIBUSB_1_INCLUDE_DIRS)
   # in cache already
   set(LIBUSB_FOUND TRUE)
+  set(LIBUSB_1_FOUND TRUE)
 else (LIBUSB_1_LIBRARIES AND LIBUSB_1_INCLUDE_DIRS)
   find_path(LIBUSB_1_INCLUDE_DIR
-    NAMES
-	libusb-1.0/libusb.h
-    PATHS
-      /usr/include
-      /usr/local/include
-      /opt/local/include
-      /sw/include
-	PATH_SUFFIXES
-	  libusb-1.0
-  )
+            NAMES libusb-1.0/libusb.h
+	    PATHS /usr/include /usr/local/include /opt/local/include /sw/include
+	    PATH_SUFFIXES libusb-1.0)

   find_library(LIBUSB_1_LIBRARY
-    NAMES
-      usb-1.0
-    PATHS
-      /usr/lib
-      /usr/local/lib
-      /opt/local/lib
-      /sw/lib
-  )
+               NAMES usb-1.0
+	       PATHS /usr/lib /usr/local/lib /opt/local/lib /sw/lib)

-  set(LIBUSB_1_INCLUDE_DIRS
-    ${LIBUSB_1_INCLUDE_DIR}
-  )
-  set(LIBUSB_1_LIBRARIES
-    ${LIBUSB_1_LIBRARY}
-)
+  set(LIBUSB_1_INCLUDE_DIRS ${LIBUSB_1_INCLUDE_DIR})
+  set(LIBUSB_1_LIBRARIES ${LIBUSB_1_LIBRARY})

-  if (LIBUSB_1_INCLUDE_DIRS AND LIBUSB_1_LIBRARIES)
-     set(LIBUSB_1_FOUND TRUE)
-  endif (LIBUSB_1_INCLUDE_DIRS AND LIBUSB_1_LIBRARIES)
-
-  if (LIBUSB_1_FOUND)
-    if (NOT libusb_1_FIND_QUIETLY)
-      message(STATUS "Found libusb-1.0:")
-	  message(STATUS " - Includes: ${LIBUSB_1_INCLUDE_DIRS}")
-	  message(STATUS " - Libraries: ${LIBUSB_1_LIBRARIES}")
-    endif (NOT libusb_1_FIND_QUIETLY)
-  else (LIBUSB_1_FOUND)
-    if (libusb_1_FIND_REQUIRED)
-      message(FATAL_ERROR "Could not find libusb")
-    endif (libusb_1_FIND_REQUIRED)
-  endif (LIBUSB_1_FOUND)
+  include(FindPackageHandleStandardArgs)
+  find_package_handle_standard_args(LIBUSB_1 DEFAULT_MSG LIBUSB_1_LIBRARY LIBUSB_1_INCLUDE_DIR)

   # show the LIBUSB_1_INCLUDE_DIRS and LIBUSB_1_LIBRARIES variables only in the advanced view
   mark_as_advanced(LIBUSB_1_INCLUDE_DIRS LIBUSB_1_LIBRARIES)
-
-endif (LIBUSB_1_LIBRARIES AND LIBUSB_1_INCLUDE_DIRS)+endif (LIBUSB_1_LIBRARIES AND LIBUSB_1_INCLUDE_DIRS)


The Matlab binding can be built only when OpenMA is compiled as shared libraries.

--- cmake/OpenMALanguageBindings.cmake
+++ cmake/OpenMALanguageBindings.cmake
@@ -4,6 +4,10 @@
 SET(CMAKE_SWIG_FLAGS "")

 IF(BUILD_MATLAB_BINDINGS)
+  IF(NOT OPENMA_BUILD_SHARED_LIBS)
+    MESSAGE(FATAL_ERROR "OpenMA must be compiled as shared libraries to build the Matlab binding")
+  ENDIF()
+
   FIND_PACKAGE(Matlab REQUIRED)
   IF(BUILD_UNIT_TESTS)
     FUNCTION(ADD_MATLAB_TESTDRIVER)


Fixed error in cmake script

Fixed error in cmake script

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


Added debugging code....

Added debugging code....

--- cmake/modules/RootTestDriver.cmake
+++ cmake/modules/RootTestDriver.cmake
@@ -191,8 +191,13 @@
     execute_process(COMMAND ${_cmd} ${_out} ${_err} ${_cwd} RESULT_VARIABLE _rc)

     if(_rc STREQUAL "Segmentation fault" OR _rc EQUAL 11)
-       message(STATUS "Got ${_rc}, retrying again once more...")
-       execute_process(COMMAND ${_cmd} ${_out} ${_err} ${_cwd} RESULT_VARIABLE _rc)
+       message(STATUS "Got ${_rc}, retrying again once more... with coredump enabled")
+       file(WRITE run_with_coredump.sh "
+pwd
+ulimit -c unlimited
+${_cmd}
+")
+       execute_process(COMMAND bash run_with_coredump.sh ${_out} ${_err} ${_cwd} RESULT_VARIABLE _rc)
     endif()

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


remove win32 boost stuff now that boost is gone

--- cmake/win32_compiler_options.cmake
+++ cmake/win32_compiler_options.cmake
@@ -19,8 +19,6 @@
         add_definitions(-D_CRT_NONSTDC_NO_WARNING)
         add_definitions(-D_SCL_SECURE_NO_WARNINGS)
         add_definitions(-DNOMINMAX)
-        add_definitions(-DBOOST_LIB_TOOLSET="vc110")
-        add_definitions(-DBOOST_ALL_DYN_LINK)

         # Nitro makes use of Exception Specifications, which results in
         # numerous warnings when compiling in MSVC. We will ignore them for


SuperBuild: jpeg use cmake options via SB_CMAKE_COMMAND

--- SuperBuild/CMake/External_jpeg.cmake
+++ SuperBuild/CMake/External_jpeg.cmake
@@ -31,14 +31,12 @@
   INSTALL_DIR ${SB_INSTALL_PREFIX}
   DOWNLOAD_DIR ${DOWNLOAD_LOCATION}
   CONFIGURE_COMMAND ${SB_CMAKE_COMMAND}
-    -DCMAKE_BUILD_TYPE=Release
     -DENABLE_SHARED=TRUE
     -DENABLE_STATIC=FALSE
     -DWITH_SIMD=FALSE
     -DWITH_TURBOJPEG=FALSE
     -DWITH_ARITH_DEC=TRUE
     -DWITH_JAVA=FALSE
-    -DCMAKE_INSTALL_PREFIX=${SB_INSTALL_PREFIX}
     ${JPEG_SB_SRC}
     PATCH_COMMAND ${JPEG_PATCH_COMMAND}
   )


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

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

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


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

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

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


STYLE: Nightly Date Stamp

STYLE: Nightly Date Stamp

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

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


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

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

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


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

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

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


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

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

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


STYLE: Nightly Date Stamp

STYLE: Nightly Date Stamp

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

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


STYLE: Nightly Date Stamp

STYLE: Nightly Date Stamp

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

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


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

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

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


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

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

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


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

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

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


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

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

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


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

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

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


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

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

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


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

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

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


Split off 8.2.36

Split off 8.2.36

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


Bump GAPID version to v0.5.1

Bump GAPID version to v0.5.1

--- version.cmake
+++ version.cmake
@@ -16,7 +16,7 @@
 # Increment these numbers before releasing a new version.
 set(GAPID_VERSION_MAJOR 0)
 set(GAPID_VERSION_MINOR 5)
-set(GAPID_VERSION_POINT 0)
+set(GAPID_VERSION_POINT 1)

 if (NOT DEFINED GAPID_BUILD_NUMBER)
     set(GAPID_BUILD_NUMBER 0)


Split off 7.12.54

Split off 7.12.54

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


Improve detection of linux system name.

Improve detection of linux system name.

--- cmake/FunctionDefinitions.cmake
+++ cmake/FunctionDefinitions.cmake
@@ -6,111 +6,128 @@

 FUNCTION( WXWIDGETS_HDRS XRC_SRCS _OUTFILES )

-	FOREACH( XRC_SRC ${XRC_SRCS} )
-		STRING( REGEX MATCH "(.*)/([a-z_A-Z]*)\\.xrc$" DUMMY "${XRC_SRC}" )
-		IF( NOT EXISTS ${PROJECT_BINARY_DIR}/${CMAKE_MATCH_1} )
-			FILE( MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/${CMAKE_MATCH_1} )
-		ENDIF( NOT EXISTS ${PROJECT_BINARY_DIR}/${CMAKE_MATCH_1} )
-		SET( XRC_FCN ${CMAKE_MATCH_2} )
-		WXWIDGETS_ADD_RESOURCES( XRC_OUTPUT ${XRC_SRC} OPTIONS --cpp-code
-			--function=wxXmlInit_${XRC_FCN} --output=${PROJECT_BINARY_DIR}/${XRC_SRC}h )
-	ENDFOREACH( XRC_SRC ${XRC_SRCS} )
+    FOREACH( XRC_SRC ${XRC_SRCS} )
+        STRING( REGEX MATCH "(.*)/([a-z_A-Z]*)\\.xrc$" DUMMY "${XRC_SRC}" )
+        IF( NOT EXISTS ${PROJECT_BINARY_DIR}/${CMAKE_MATCH_1} )
+            FILE( MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/${CMAKE_MATCH_1} )
+        ENDIF( NOT EXISTS ${PROJECT_BINARY_DIR}/${CMAKE_MATCH_1} )
+        SET( XRC_FCN ${CMAKE_MATCH_2} )
+        WXWIDGETS_ADD_RESOURCES( XRC_OUTPUT ${XRC_SRC} OPTIONS --cpp-code
+            --function=wxXmlInit_${XRC_FCN} --output=${PROJECT_BINARY_DIR}/${XRC_SRC}h )
+    ENDFOREACH( XRC_SRC ${XRC_SRCS} )

-	SET( ${_OUTFILES} ${XRC_OUTPUT} PARENT_SCOPE )
+    SET( ${_OUTFILES} ${XRC_OUTPUT} PARENT_SCOPE )
 ENDFUNCTION( WXWIDGETS_HDRS _OUTFILES )

 FUNCTION( TEST_FOR_VFSCANF HAVE_VFSCANF )

-	INCLUDE( CheckCSourceCompiles )
-	CHECK_C_SOURCE_COMPILES(
-		"#include <stdio.h>
-		#include <stdarg.h>
+    INCLUDE( CheckCSourceCompiles )
+    CHECK_C_SOURCE_COMPILES(
+        "#include <stdio.h>
+        #include <stdarg.h>

-		int vread(FILE *stream, char *fmt, ...)
-		{
-			int rc;
-			va_list arg_ptr;
-			va_start(arg_ptr, fmt);
-			rc = vfscanf(stream, fmt, arg_ptr);
-			va_end(arg_ptr);
-			return(rc);
-		}
+        int vread(FILE *stream, char *fmt, ...)
+        {
+            int rc;
+            va_list arg_ptr;
+            va_start(arg_ptr, fmt);
+            rc = vfscanf(stream, fmt, arg_ptr);
+            va_end(arg_ptr);
+            return(rc);
+        }

-		#define MAX_LEN 80
-		int main(void)
-		{
-			FILE *stream;
-			char s[MAX_LEN + 1];
-			/* Put in various data. */
-			stream = fopen( \"CMakeCache.txt\", \"r\" );
-			return vread(stream, \"%s\", &s[0]);
-		}" VFSCANF )
-			SET( ${HAVE_VFSCANF} ${VFSCANF} PARENT_SCOPE )
+        #define MAX_LEN 80
+        int main(void)
+        {
+            FILE *stream;
+            char s[MAX_LEN + 1];
+            /* Put in various data. */
+            stream = fopen( \"CMakeCache.txt\", \"r\" );
+            return vread(stream, \"%s\", &s[0]);
+        }" VFSCANF )
+            SET( ${HAVE_VFSCANF} ${VFSCANF} PARENT_SCOPE )
 ENDFUNCTION( TEST_FOR_VFSCANF HAVE_VFSCANF )

 FUNCTION(GROUP_SOURCE_FILES)
-	FOREACH(F ${ARGV})
-		STRING(REGEX REPLACE ".*source/" "" SRC_RELATIVE_F ${F})
-		STRING(REGEX MATCHALL "([^/]+/)" RESULT ${SRC_RELATIVE_F})
-		SET(FOLDER "${RESULT}")
-		LIST(LENGTH RESULT RESULT_LEN)
-		IF(${RESULT_LEN} GREATER 0)
-			STRING(REGEX REPLACE "/;|/" "\\\\" FOLDER_MSVC ${FOLDER})
-			# If the file doesn't end in a 'c' or 'cpp' then it's a header file
-			STRING(REGEX MATCH "c[p]*$" SOURCE_FILE ${F})
-			IF(SOURCE_FILE)
-				SET(F_LOCATION "Source Files\\${FOLDER_MSVC}")
-			ELSE()
-				SET(F_LOCATION "Header Files\\${FOLDER_MSVC}")
-			ENDIF()
-		ELSE()
-			STRING(REGEX MATCH "c[p]*$" SOURCE_FILE ${F})
-			IF(SOURCE_FILE)
-				SET(F_LOCATION "Source Files")
-			ELSE()
-				SET(F_LOCATION "Header Files")
-			ENDIF()
-		ENDIF()
-		SOURCE_GROUP(${F_LOCATION} FILES ${F})
-	ENDFOREACH()
+    FOREACH(F ${ARGV})
+        STRING(REGEX REPLACE ".*source/" "" SRC_RELATIVE_F ${F})
+        STRING(REGEX MATCHALL "([^/]+/)" RESULT ${SRC_RELATIVE_F})
+        SET(FOLDER "${RESULT}")
+        LIST(LENGTH RESULT RESULT_LEN)
+        IF(${RESULT_LEN} GREATER 0)
+            STRING(REGEX REPLACE "/;|/" "\\\\" FOLDER_MSVC ${FOLDER})
+            # If the file doesn't end in a 'c' or 'cpp' then it's a header file
+            STRING(REGEX MATCH "c[p]*$" SOURCE_FILE ${F})
+            IF(SOURCE_FILE)
+                SET(F_LOCATION "Source Files\\${FOLDER_MSVC}")
+            ELSE()
+                SET(F_LOCATION "Header Files\\${FOLDER_MSVC}")
+            ENDIF()
+        ELSE()
+            STRING(REGEX MATCH "c[p]*$" SOURCE_FILE ${F})
+            IF(SOURCE_FILE)
+                SET(F_LOCATION "Source Files")
+            ELSE()
+                SET(F_LOCATION "Header Files")
+            ENDIF()
+        ENDIF()
+        SOURCE_GROUP(${F_LOCATION} FILES ${F})
+    ENDFOREACH()
 ENDFUNCTION()

 FUNCTION( PRN_MSG )
-	IF( DEFINED ZINC_DEBUG_PRINT )
-		MESSAGE( STATUS "${ARGN}" )
-	ENDIF( DEFINED ZINC_DEBUG_PRINT )
+    IF( DEFINED ZINC_DEBUG_PRINT )
+        MESSAGE( STATUS "${ARGN}" )
+    ENDIF( DEFINED ZINC_DEBUG_PRINT )
 ENDFUNCTION( PRN_MSG )

 FUNCTION( PRN_MSG_V )
-	IF( DEFINED ZINC_DEBUG_PRINT_VERBOSE )
-		MESSAGE( STATUS "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): ${ARGN}")
-	ENDIF( DEFINED ZINC_DEBUG_PRINT_VERBOSE )
+    IF( DEFINED ZINC_DEBUG_PRINT_VERBOSE )
+        MESSAGE( STATUS "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): ${ARGN}")
+    ENDIF( DEFINED ZINC_DEBUG_PRINT_VERBOSE )
 ENDFUNCTION( PRN_MSG_V )

 FUNCTION( GET_SYSTEM_NAME RETURN_SYSTEM_NAME )
-	IF( WIN32 )
-		SET( SYSTEM_NAME "Windows" )
-	ELSEIF( APPLE )
-		EXECUTE_PROCESS(COMMAND sw_vers -productName RESULT_VARIABLE COMMAND_RESULT OUTPUT_VARIABLE PRODUCT_NAME )
-		STRING( STRIP ${PRODUCT_NAME} PRODUCT_NAME )
-		EXECUTE_PROCESS(COMMAND sw_vers -productVersion RESULT_VARIABLE COMMAND_RESULT OUTPUT_VARIABLE PRODUCT_VERSION )
-		STRING( STRIP ${PRODUCT_VERSION} PRODUCT_VERSION )
-		STRING( REPLACE " " "-" SYSTEM_NAME "${PRODUCT_NAME} ${PRODUCT_VERSION}" )
-	ELSEIF( UNIX )
-		SET( SYSTEM_NAME "Linux" )
-		EXECUTE_PROCESS(COMMAND cat /etc/issue RESULT_VARIABLE COMMAND_RESULT OUTPUT_VARIABLE COMMAND_OUTPUT ERROR_VARIABLE ERROR_OUTPUT)
-		IF( COMMAND_RESULT EQUAL 0 )
-			STRING( REGEX MATCH "^[^\\]*" COMMAND_OUTPUT ${COMMAND_OUTPUT} )
-			STRING( STRIP ${COMMAND_OUTPUT} COMMAND_OUTPUT )
-			message(STATUS "comm out: ${COMMAND_OUTPUT}" )
-			STRING( REPLACE " " "-" SYSTEM_NAME ${COMMAND_OUTPUT} )
-		ENDIF()
-	ELSE()
-		MESSAGE( FATAL_ERROR "Don't yet know this system." )
-	ENDIF()
-
-        STRING(REPLACE "\n" "_" SYSTEM_NAME ${SYSTEM_NAME})
+    IF( WIN32 )
+        SET( SYSTEM_NAME "Windows" )
+    ELSEIF( APPLE )
+        EXECUTE_PROCESS(COMMAND sw_vers -productName RESULT_VARIABLE COMMAND_RESULT OUTPUT_VARIABLE PRODUCT_NAME )
+        STRING( STRIP ${PRODUCT_NAME} PRODUCT_NAME )
+        EXECUTE_PROCESS(COMMAND sw_vers -productVersion RESULT_VARIABLE COMMAND_RESULT OUTPUT_VARIABLE PRODUCT_VERSION )
+        STRING( STRIP ${PRODUCT_VERSION} PRODUCT_VERSION )
+        STRING( REPLACE " " "-" SYSTEM_NAME "${PRODUCT_NAME} ${PRODUCT_VERSION}" )
+    ELSEIF( UNIX )
+        #SET( SYSTEM_NAME "Unix-Based" )
+        find_program(LSB lsb_release
+            DOC "Distribution information tool")
+        if (LSB)
+            execute_process(COMMAND ${LSB} -i
+                RESULT_VARIABLE RETFLAG
+                OUTPUT_VARIABLE DISTINFO
+                ERROR_VARIABLE ERRDISTINFO
+                OUTPUT_STRIP_TRAILING_WHITESPACE
+            )
+            if (NOT RETFLAG)
+                string(SUBSTRING ${DISTINFO} 16 -1 SYSTEM_NAME)
+            endif()
+        endif()
+        if (NOT SYSTEM_NAME)
+            EXECUTE_PROCESS(COMMAND cat /etc/issue RESULT_VARIABLE COMMAND_RESULT OUTPUT_VARIABLE COMMAND_OUTPUT ERROR_VARIABLE ERROR_OUTPUT)
+            if (COMMAND_RESULT EQUAL 0)
+                STRING( REGEX MATCH "^[^\\]*" COMMAND_OUTPUT ${COMMAND_OUTPUT} )
+                STRING( STRIP ${COMMAND_OUTPUT} COMMAND_OUTPUT )
+                STRING( REPLACE " " "-" SYSTEM_NAME ${COMMAND_OUTPUT} )
+            endif ()
+        endif ()
+        if (NOT SYSTEM_NAME)
+            set(SYSTEM_NAME Unix-Based)
+        endif ()
+    ELSE()
+        MESSAGE( FATAL_ERROR "Don't yet know this system." )
+    ENDIF()

-	SET( ${RETURN_SYSTEM_NAME} ${SYSTEM_NAME} PARENT_SCOPE)
+    STRING(REPLACE "\n" "_" SYSTEM_NAME ${SYSTEM_NAME})
+
+    SET( ${RETURN_SYSTEM_NAME} ${SYSTEM_NAME} PARENT_SCOPE)
 ENDFUNCTION()


Fix checksummed manifest when DESTDIR is set

 - Fixes #665

--- cmake/InstallFileManifest.cmake
+++ cmake/InstallFileManifest.cmake
@@ -1,3 +1,4 @@
+
 # This script will create and install an install manifest, including SHA256 hashes of each installed file
 # Variables passed from CMake must be set with `install(CODE "set(...)")`

@@ -6,7 +7,7 @@
 # Set receipt install destination
 set(RECEIPT_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}")

-# Mimic cmake_install.cmake's handlin of components
+# Mimic cmake_install.cmake's handling of components
 if(CMAKE_INSTALL_COMPONENT)
   set(HASHED_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.SHA256.txt")
 else()
@@ -16,10 +17,15 @@
 # Clean out any old install manifest on re-installation, if it exists
 file(REMOVE "${CMAKE_BINARY_DIR}/${HASHED_INSTALL_MANIFEST}")

+if(DEFINED ENV{DESTDIR})
+  get_filename_component(ABS_DESTDIR "$ENV{DESTDIR}" ABSOLUTE)
+else()
+  set(ABS_DESTDIR "")
+endif()
 # Loop over files computing hashes
 foreach(file IN LISTS CMAKE_INSTALL_MANIFEST_FILES)
-  file(SHA256 "${file}" _file_sha256)
-  file(RELATIVE_PATH FILE_REL_PATH "${RECEIPT_INSTALL_DIR}" "${file}")
+  file(SHA256 "$ENV{DESTDIR}${file}" _file_sha256)
+  file(RELATIVE_PATH FILE_REL_PATH "${ABS_DESTDIR}${RECEIPT_INSTALL_DIR}" "${ABS_DESTDIR}${file}")
   file(APPEND "${CMAKE_BINARY_DIR}/${HASHED_INSTALL_MANIFEST}" "${_file_sha256}  ${FILE_REL_PATH}\n")
 endforeach()
 file(APPEND "${CMAKE_BINARY_DIR}/${HASHED_INSTALL_MANIFEST}"


changed: defaults

changed: defaults

--- cmake/SetupProjectOptions.cmake
+++ cmake/SetupProjectOptions.cmake
@@ -8,7 +8,7 @@

 # testing
 OPTION(DCSC08961_BLD_UTEST "Enable unit-test building by default"                          ON)
-OPTION(DCSC08961_RUN_CTEST "Enable unit-test execution using CTest by default"            OFF)
+OPTION(DCSC08961_RUN_CTEST "Enable unit-test execution using CTest by default"             ON)
 OPTION(DCSC08961_RUN_UTEST "Enable unit-test execution using the build system by default" OFF)

 # coverage testing


[cmake] Add libRemarks to LLVM_DISTRIBUTION_COMPONENTS

Add this in the Apple-stage2.cmake to ship the remark tooling library
with the compiler.

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

--- cmake/caches/Apple-stage2.cmake
+++ cmake/caches/Apple-stage2.cmake
@@ -62,6 +62,7 @@
   clang-format
   clang-resource-headers
   cxx-headers
+  Remarks
   ${LLVM_TOOLCHAIN_TOOLS}
   CACHE STRING "")


Check Tcl/Tk version consistency by implementing the following:

* Determine Tcl version from tclsh

* Determine Tcl version from library name (if that is possible) and
WARN if it is not consistent with Tcl version from tclsh.

* Determine Tk version from wish and confirm it is the same
as the Tcl version from tclsh or else disable Tk.

* Determine Tcl version from wish and confirm it is the
same as the Tcl version from tclsh or else disable Tk.

* Determine Tk version from tclsh and confirm it is the
same as the Tk version from wish or else disable Tk.

* Determine Tk version from library name (if that is possible) and
confirm consistent with Tcl version from tclsh or else disable Tk.

Tested by: Alan W. Irwin <airwin@users.sourceforge.net> using various
runs of cmake with wrong results locally imposed to test all the WARNING
logic.

svn path=/trunk/; revision=12913

--- cmake/modules/tcl-related.cmake
+++ cmake/modules/tcl-related.cmake
@@ -71,7 +71,7 @@
   message(STATUS "Start determining consistent system data for Tcl and friends")
   find_package(TclStub QUIET)
   if(TCL_FOUND)
-    message(STATUS "Looking for include paths and libraries for Tcl - found")
+    message(STATUS "Looking for Tcl - found")
     message(STATUS "TCL_INCLUDE_PATH = ${TCL_INCLUDE_PATH}")
     message(STATUS "TCL_LIBRARY = ${TCL_LIBRARY}")
     message(STATUS "TCL_STUB_LIBRARY = ${TCL_STUB_LIBRARY}")
@@ -85,66 +85,117 @@
     if(TCL_TCLSH)
       message(STATUS "Looking for tclsh - found")
       message(STATUS "TCL_TCLSH = ${TCL_TCLSH}")
-    else(TCL_TCLSH)
-      message(STATUS "Looking for tclsh - not found")
-    endif(TCL_TCLSH)
-  else(TCL_FOUND)
-    message(STATUS "Looking for include paths and libraries for Tcl - not found")
-  endif(TCL_FOUND)
-
-  # Initially mark various quantities as as unfound in case that turns out to be the case.
-  set(HAVE_ITCL OFF)
-  set(HAVE_ITK OFF)
-
-  if(TCL_FOUND AND TCL_TCLSH)
-    if(ENABLE_itcl)
-      if(USE_INCRTCL_VERSION_4)
-	set(SUGGESTED_ITCL_VERSION 4)
-      else(USE_INCRTCL_VERSION_4)
-	set(SUGGESTED_ITCL_VERSION 3)
-      endif(USE_INCRTCL_VERSION_4)
-      if(NOT PLPLOT_ITCL_VERSION)
-	file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/CheckITCL_Available.tcl "puts -nonewline [package require Itcl ${SUGGESTED_ITCL_VERSION}]; exit")
-	# Refine SUGGESTED_ITCL_VERSION to exact value or fail.
+      if(NOT PLPLOT_TCL_VERSION)
+	file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/CheckTCL_VERSION.tcl "puts -nonewline [package require Tcl]; exit")
+	# Find Tcl version via tclsh or fail.
 	execute_process(
-	  COMMAND ${TCL_TCLSH} ${CMAKE_CURRENT_BINARY_DIR}/CheckITCL_Available.tcl
-	  RESULT_VARIABLE ITCL_RC
-	  OUTPUT_VARIABLE _plplot_itcl_version
-	  )
-	if(NOT ITCL_RC)
+	  COMMAND ${TCL_TCLSH} ${CMAKE_CURRENT_BINARY_DIR}/CheckTCL_VERSION.tcl
+	  RESULT_VARIABLE TCL_RC
+	  OUTPUT_VARIABLE _plplot_tcl_version
+	  )
+	if(NOT TCL_RC)
+	  message(STATUS "Looking for Tcl version with tclsh - found")
 	  # Store result in cached variable so it will be remembered
           # when cmake is re-run, but use type of STRING rather than
           # INTERNAL to allow users to specify the value with a
-          # -DPLPLOT_ITCL_VERSION:STRING=<whatever> on the command
-          # line for those rare cases when "package require Itcl"
+          # -DPLPLOT_TCL_VERSION:STRING=<whatever> on the command
+          # line for those rare cases when "package require Tcl"
           # would error out due to some tclsh issue.
-	  set(PLPLOT_ITCL_VERSION ${_plplot_itcl_version}
-	    CACHE STRING "Itcl version that will be used"
+	  set(PLPLOT_TCL_VERSION ${_plplot_tcl_version}
+	    CACHE STRING "Tcl version that is available"
 	    )
-	endif(NOT ITCL_RC)
-      else(NOT PLPLOT_ITCL_VERSION)
-	set(ITCL_RC 0)
-      endif(NOT PLPLOT_ITCL_VERSION)
+	else(NOT TCL_RC)
+	  message(STATUS "Looking for Tcl version with tclsh - not found")
+	  message(STATUS "WARNING: setting ENABLE_tcl to OFF")
+	  set(ENABLE_tcl OFF CACHE BOOL "Enable Tcl bindings" FORCE)
+	endif(NOT TCL_RC)
+      endif(NOT PLPLOT_TCL_VERSION)
+    else(TCL_TCLSH)
+      message(STATUS "Looking for tclsh - not found")
+      message(STATUS "WARNING: setting ENABLE_tcl to OFF")
+      set(ENABLE_tcl OFF CACHE BOOL "Enable Tcl bindings" FORCE)
+    endif(TCL_TCLSH)
+  else(TCL_FOUND)
+    message(STATUS "Looking for Tcl - not found")
+    message(STATUS "WARNING: setting ENABLE_tcl to OFF")
+    set(ENABLE_tcl OFF CACHE BOOL "Enable Tcl bindings" FORCE)
+  endif(TCL_FOUND)
+endif(ENABLE_tcl)
+
+if(ENABLE_tcl)
+  message(STATUS "PLPLOT_TCL_VERSION = ${PLPLOT_TCL_VERSION}")
+
+  # Sanity checking of Tcl version consistency _if_ a Tcl version string
+  # can be extracted from the Tcl library name.
+  string(REGEX MATCH "[0-9]+[.]?[0-9]+" library_version ${TCL_LIBRARY})
+  if(library_version)
+    # If no decimal point in version insert as the second character.
+    if(NOT library_version MATCHES "[.]")
+      string(REGEX REPLACE "^([0-9])([0-9]+)$" "\\1.\\2" library_version ${library_version})
+    endif(NOT library_version MATCHES "[.]")
+    #message(STATUS "library_version = ${library_version}")
+    string(LENGTH ${library_version} length_library_version)
+    string(SUBSTRING ${PLPLOT_TCL_VERSION} 0 ${length_library_version} truncated_version)
+    #message(STATUS "truncated_version = ${truncated_version}")
+    if(NOT truncated_version STREQUAL library_version)
+      message(STATUS "WARNING: Tcl library version = ${library_version} that is extracted from the
+   library name is not consistent with PLPLOT_TCL_VERSION = ${PLPLOT_TCL_VERSION}")
+    endif(NOT truncated_version STREQUAL library_version)
+  endif(library_version)
+
+  # Initially mark various quantities as unfound in case that turns out to be true.
+  set(HAVE_ITCL OFF)
+  set(HAVE_ITK OFF)
+
+  if(ENABLE_itcl)
+    if(USE_INCRTCL_VERSION_4)
+      set(SUGGESTED_ITCL_VERSION 4)
+    else(USE_INCRTCL_VERSION_4)
+      set(SUGGESTED_ITCL_VERSION 3)
+    endif(USE_INCRTCL_VERSION_4)
+    if(NOT PLPLOT_ITCL_VERSION)
+      file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/CheckITCL_Available.tcl "puts -nonewline [package require Itcl ${SUGGESTED_ITCL_VERSION}]; exit")
+      # Refine SUGGESTED_ITCL_VERSION to exact value or fail.
+      execute_process(
+	COMMAND ${TCL_TCLSH} ${CMAKE_CURRENT_BINARY_DIR}/CheckITCL_Available.tcl
+	RESULT_VARIABLE ITCL_RC
+	OUTPUT_VARIABLE _plplot_itcl_version
+	)
       if(NOT ITCL_RC)
-        message(STATUS "Looking for itcl.h")
-	if(NOT USE_INCRTCL_VERSION_4)
-	  # Search first for epa_build install location.
-          find_path(ITCL_INCLUDE_PATH itcl.h HINTS ${TCL_INCLUDE_PATH}/itcl${PLPLOT_ITCL_VERSION})
-	endif(NOT USE_INCRTCL_VERSION_4)
-        find_path(ITCL_INCLUDE_PATH itcl.h HINTS ${TCL_INCLUDE_PATH})
-
-        if(ITCL_INCLUDE_PATH)
-          message(STATUS "Looking for itcl.h - found")
-	  message(STATUS "ITCL_INCLUDE_PATH = ${ITCL_INCLUDE_PATH}")
-	  message(STATUS "PLPLOT_ITCL_VERSION = ${PLPLOT_ITCL_VERSION}")
-
-	  message(STATUS "Checking for Itcl header version consistency")
-	  string(REGEX REPLACE "^([0-9]*)\\.[0-9]*.*$" "\\1" ITCL_MAJOR_VERSION  "${PLPLOT_ITCL_VERSION}")
-	  string(REGEX REPLACE "^[0-9]*\\.([0-9]*).*$" "\\1" ITCL_MINOR_VERSION  "${PLPLOT_ITCL_VERSION}")
-	  message(STATUS "ITCL_MAJOR_VERSION = ${ITCL_MAJOR_VERSION}")
-	  message(STATUS "ITCL_MINOR_VERSION = ${ITCL_MINOR_VERSION}")
-	  file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/CheckITCL_VERSION.c
-	    "// #define RC_INVOKED to avoid sucking in lots of additional includes for
+	# Store result in cached variable so it will be remembered
+        # when cmake is re-run, but use type of STRING rather than
+        # INTERNAL to allow users to specify the value with a
+        # -DPLPLOT_ITCL_VERSION:STRING=<whatever> on the command
+        # line for those rare cases when "package require Itcl"
+        # would error out due to some tclsh issue.
+	set(PLPLOT_ITCL_VERSION ${_plplot_itcl_version}
+	  CACHE STRING "Itcl version that will be used"
+	  )
+      endif(NOT ITCL_RC)
+    else(NOT PLPLOT_ITCL_VERSION)
+      set(ITCL_RC 0)
+    endif(NOT PLPLOT_ITCL_VERSION)
+
+    if(NOT ITCL_RC)
+      message(STATUS "Looking for itcl.h")
+      if(NOT USE_INCRTCL_VERSION_4)
+	# Search first for epa_build install location.
+        find_path(ITCL_INCLUDE_PATH itcl.h HINTS ${TCL_INCLUDE_PATH}/itcl${PLPLOT_ITCL_VERSION})
+      endif(NOT USE_INCRTCL_VERSION_4)
+      find_path(ITCL_INCLUDE_PATH itcl.h HINTS ${TCL_INCLUDE_PATH})
+
+      if(ITCL_INCLUDE_PATH)
+        message(STATUS "Looking for itcl.h - found")
+	message(STATUS "ITCL_INCLUDE_PATH = ${ITCL_INCLUDE_PATH}")
+	message(STATUS "PLPLOT_ITCL_VERSION = ${PLPLOT_ITCL_VERSION}")
+
+	message(STATUS "Checking for Itcl header version consistency")
+	string(REGEX REPLACE "^([0-9]*)\\.[0-9]*.*$" "\\1" ITCL_MAJOR_VERSION  "${PLPLOT_ITCL_VERSION}")
+	string(REGEX REPLACE "^[0-9]*\\.([0-9]*).*$" "\\1" ITCL_MINOR_VERSION  "${PLPLOT_ITCL_VERSION}")
+	message(STATUS "ITCL_MAJOR_VERSION = ${ITCL_MAJOR_VERSION}")
+	message(STATUS "ITCL_MINOR_VERSION = ${ITCL_MINOR_VERSION}")
+	file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/CheckITCL_VERSION.c
+	  "// #define RC_INVOKED to avoid sucking in lots of additional includes for
 // efficiency and simplicity.
 #define RC_INVOKED 1
 #include <itcl.h>
@@ -153,133 +204,238 @@
 #endif
 void main(void){}
 "
-	    )
-	  try_compile(CONSISTENT_HEADER_ITCL_VERSION ${CMAKE_BINARY_DIR}
-	    ${CMAKE_CURRENT_BINARY_DIR}/CheckITCL_VERSION.c
-	    CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${ITCL_INCLUDE_PATH};${TCL_INCLUDE_PATH}"
-	    )
-	  if(CONSISTENT_HEADER_ITCL_VERSION)
-	    message(STATUS "Checking for Itcl header version consistency - true")
-	  else(CONSISTENT_HEADER_ITCL_VERSION)
-	    message(STATUS "Checking for Itcl header version consistency - false")
-            message(STATUS "WARNING: Disabling Itcl interface code")
-	    set(ENABLE_itcl OFF CACHE BOOL "Enable Itcl interface code" FORCE)
-	  endif(CONSISTENT_HEADER_ITCL_VERSION)
-        else(ITCL_INCLUDE_PATH)
-          message(STATUS "Looking for itcl.h - not found")
+	  )
+	try_compile(CONSISTENT_HEADER_ITCL_VERSION ${CMAKE_BINARY_DIR}
+	  ${CMAKE_CURRENT_BINARY_DIR}/CheckITCL_VERSION.c
+	  CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${ITCL_INCLUDE_PATH};${TCL_INCLUDE_PATH}"
+	  )
+	if(CONSISTENT_HEADER_ITCL_VERSION)
+	  message(STATUS "Checking for Itcl header version consistency - true")
+	else(CONSISTENT_HEADER_ITCL_VERSION)
+	  message(STATUS "Checking for Itcl header version consistency - false")
+          message(STATUS "WARNING: Disabling Itcl interface code")
+	  set(ENABLE_itcl OFF CACHE BOOL "Enable Itcl interface code" FORCE)
+	endif(CONSISTENT_HEADER_ITCL_VERSION)
+      else(ITCL_INCLUDE_PATH)
+        message(STATUS "Looking for itcl.h - not found")
+        message(STATUS "WARNING: Disabling Itcl interface code")
+        set(ENABLE_itcl OFF CACHE BOOL "Enable Itcl interface code" FORCE)
+      endif(ITCL_INCLUDE_PATH)
+
+      if(ENABLE_itcl)
+        message(STATUS "Looking for itcl library")
+	# Search first for epa_build install location.
+        find_library(ITCL_LIBRARY itcl${PLPLOT_ITCL_VERSION} HINTS ${TCL_LIBRARY_PATH}/itcl${PLPLOT_ITCL_VERSION})
+        find_library(ITCL_LIBRARY itcl${PLPLOT_ITCL_VERSION} HINTS ${TCL_LIBRARY_PATH})
+        if(ITCL_LIBRARY)
+          message(STATUS "Looking for itcl library - found")
+	  message(STATUS "ITCL_LIBRARY = ${ITCL_LIBRARY}")
+	  get_filename_component(ITCL_LIBRARY_PATH ${ITCL_LIBRARY} PATH)
+	  list(APPEND TCL_TK_ITCL_ITK_RPATH ${ITCL_LIBRARY_PATH})
+          set(HAVE_ITCL ON)
+          find_path(HAVE_ITCLDECLS_H itclDecls.h HINTS ${ITCL_INCLUDE_PATH})
+        else(ITCL_LIBRARY)
+          message(STATUS "Looking for itcl library - not found")
           message(STATUS "WARNING: Disabling Itcl interface code")
           set(ENABLE_itcl OFF CACHE BOOL "Enable Itcl interface code" FORCE)
-        endif(ITCL_INCLUDE_PATH)
-
-        if(ENABLE_itcl)
-          message(STATUS "Looking for itcl library")
-	  # Search first for epa_build install location.
-          find_library(ITCL_LIBRARY itcl${PLPLOT_ITCL_VERSION} HINTS ${TCL_LIBRARY_PATH}/itcl${PLPLOT_ITCL_VERSION})
-          find_library(ITCL_LIBRARY itcl${PLPLOT_ITCL_VERSION} HINTS ${TCL_LIBRARY_PATH})
-          if(ITCL_LIBRARY)
-            message(STATUS "Looking for itcl library - found")
-	    message(STATUS "ITCL_LIBRARY = ${ITCL_LIBRARY}")
-	    get_filename_component(ITCL_LIBRARY_PATH ${ITCL_LIBRARY} PATH)
-	    list(APPEND TCL_TK_ITCL_ITK_RPATH ${ITCL_LIBRARY_PATH})
-            set(HAVE_ITCL ON)
-            find_path(HAVE_ITCLDECLS_H itclDecls.h HINTS ${ITCL_INCLUDE_PATH})
-          else(ITCL_LIBRARY)
-            message(STATUS "Looking for itcl library - not found")
-            message(STATUS "WARNING: Disabling Itcl interface code")
-            set(ENABLE_itcl OFF CACHE BOOL "Enable Itcl interface code" FORCE)
-          endif(ITCL_LIBRARY)
-        endif(ENABLE_itcl)
-      else(NOT ITCL_RC)
-        message(STATUS "Itcl not available or not compatible with current Tcl shell")
-        message(STATUS "WARNING: Disabling Itcl interface code")
-        set(ENABLE_itcl OFF CACHE BOOL "Enable Itcl interface code" FORCE)
-      endif(NOT ITCL_RC)
-    endif(ENABLE_itcl)
-
-    if(ENABLE_tk AND NOT TK_FOUND)
-      message(STATUS "WARNING: Tk not found so disabling Tk interface code")
-      set(ENABLE_tk OFF CACHE BOOL "Enable Tk interface code" FORCE)
-    endif(ENABLE_tk AND NOT TK_FOUND)
-
-    if(ENABLE_tk AND NOT X11_FOUND)
-      if(WIN32 AND NOT CYGWIN)
-        message(STATUS "WARNING: X11 not found, turning off Tk devices that depend on it")
-        set(PLD_tk OFF CACHE BOOL "Enable Tk device" FORCE)
-        set(PLD_tkwin OFF CACHE BOOL "Enable Tk device" FORCE)
-      else(WIN32 AND NOT CYGWIN)
-        message(STATUS "WARNING: X11 not found so disabling Tk interface code")
-        set(ENABLE_tk OFF CACHE BOOL "Enable Tk interface code" FORCE)
-      endif(WIN32 AND NOT CYGWIN)
-    endif(ENABLE_tk AND NOT X11_FOUND)
-
-    if(ENABLE_tk)
-      message(STATUS "Looking for include paths and libraries for Tk - found")
-      set(TK_INCLUDE_PATH ${TK_INCLUDE_PATH} ${X11_INCLUDE_DIR})
-      message(STATUS "TK_INCLUDE_PATH = ${TK_INCLUDE_PATH}")
-      message(STATUS "TK_LIBRARY = ${TK_LIBRARY}")
-      message(STATUS "TK_STUB_LIBRARY = ${TK_STUB_LIBRARY}")
-
-      get_filename_component(TK_LIBRARY_PATH ${TK_LIBRARY} PATH)
-      message(STATUS "TK_LIBRARY_PATH = ${TK_LIBRARY_PATH}")
-      if(NOT ${TK_LIBRARY_PATH} STREQUAL ${TCL_LIBRARY_PATH})
-	message(STATUS "WARNING: the Tcl and Tk library locations are inconsistent so those libraries are likely not compatible")
-      endif(NOT ${TK_LIBRARY_PATH} STREQUAL ${TCL_LIBRARY_PATH})
-      list(APPEND TCL_TK_RPATH  ${TK_LIBRARY_PATH})
-      list(APPEND TCL_TK_ITCL_ITK_RPATH  ${TK_LIBRARY_PATH})
-    else(ENABLE_tk)
-      message(STATUS "WARNING: Because Tk is disabled must disable Itk as well")
-      set(ENABLE_itk OFF CACHE BOOL "Enable Itk interface code" FORCE)
-    endif(ENABLE_tk)
-
-    if(ENABLE_itk)
-      if(USE_INCRTCL_VERSION_4)
-	set(SUGGESTED_ITK_VERSION 4)
-      else(USE_INCRTCL_VERSION_4)
-	set(SUGGESTED_ITK_VERSION 3)
-      endif(USE_INCRTCL_VERSION_4)
-      if(NOT PLPLOT_ITK_VERSION)
-	file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/CheckITK_Available.tcl "puts -nonewline [package require Itk ${SUGGESTED_ITK_VERSION}]; exit")
-	# Refine SUGGESTED_ITK_VERSION to exact value or fail.
+        endif(ITCL_LIBRARY)
+      endif(ENABLE_itcl)
+    else(NOT ITCL_RC)
+      message(STATUS "Itcl not available or not compatible with current Tcl shell")
+      message(STATUS "WARNING: Disabling Itcl interface code")
+      set(ENABLE_itcl OFF CACHE BOOL "Enable Itcl interface code" FORCE)
+    endif(NOT ITCL_RC)
+  endif(ENABLE_itcl)
+
+  if(ENABLE_tk AND TK_FOUND)
+    message(STATUS "Looking for Tk - found")
+    if(X11_FOUND)
+      list(APPEND TK_INCLUDE_PATH ${X11_INCLUDE_DIR})
+    endif(X11_FOUND)
+    message(STATUS "TK_INCLUDE_PATH = ${TK_INCLUDE_PATH}")
+    message(STATUS "TK_LIBRARY = ${TK_LIBRARY}")
+    message(STATUS "TK_STUB_LIBRARY = ${TK_STUB_LIBRARY}")
+
+    get_filename_component(TK_LIBRARY_PATH ${TK_LIBRARY} PATH)
+    list(APPEND TCL_TK_RPATH ${TK_LIBRARY_PATH})
+    list(APPEND TCL_TK_ITCL_ITK_RPATH ${TK_LIBRARY_PATH})
+
+    message(STATUS "TK_LIBRARY_PATH = ${TK_LIBRARY_PATH}")
+    if(NOT ${TK_LIBRARY_PATH} STREQUAL ${TCL_LIBRARY_PATH})
+      message(STATUS "WARNING: the Tcl and Tk library locations are inconsistent so those libraries are likely not compatible")
+    endif(NOT ${TK_LIBRARY_PATH} STREQUAL ${TCL_LIBRARY_PATH})
+
+    if(TK_WISH)
+      message(STATUS "Looking for wish - found")
+      message(STATUS "TK_WISH = ${TK_WISH}")
+      if(NOT PLPLOT_TK_VERSION)
+	file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/CheckTK_VERSION.tcl "puts -nonewline [package require Tk]; exit")
+	# Find Tk version via wish or fail.
 	execute_process(
-	  COMMAND ${TCL_TCLSH} ${CMAKE_CURRENT_BINARY_DIR}/CheckITK_Available.tcl
-	  RESULT_VARIABLE ITK_RC
-	  OUTPUT_VARIABLE _plplot_itk_version
-	  )
-	if(NOT ITK_RC)
+	  COMMAND ${TK_WISH} ${CMAKE_CURRENT_BINARY_DIR}/CheckTK_VERSION.tcl
+	  RESULT_VARIABLE TK_RC
+	  OUTPUT_VARIABLE _plplot_tk_version
+	  )
+	if(NOT TK_RC)
+	  message(STATUS "Looking for Tk version with wish - found")
 	  # Store result in cached variable so it will be remembered
           # when cmake is re-run, but use type of STRING rather than
           # INTERNAL to allow users to specify the value with a
-          # -DPLPLOT_ITK_VERSION:STRING=<whatever> on the command line
-          # for those rare cases (e.g., autobuild environment without X)
-          # when "package require Itk" would error out due to the lack
-          # of X or some tclsh issue.
-	  set(PLPLOT_ITK_VERSION ${_plplot_itk_version}
-	    CACHE STRING "Itk version that will be used"
+          # -DPLPLOT_TK_VERSION:STRING=<whatever> on the command
+          # line for those rare cases when "package require Tk"
+          # would error out due to some wish issue.
+	  set(PLPLOT_TK_VERSION ${_plplot_tk_version}
+	    CACHE STRING "Tk version found by wish"
 	    )
-	endif(NOT ITK_RC)
-      else(NOT PLPLOT_ITK_VERSION)
-	set(ITCL_RC 0)
-      endif(NOT PLPLOT_ITK_VERSION)
+
+	  if(PLPLOT_TCL_VERSION STREQUAL PLPLOT_TK_VERSION)
+	    # Cross check that wish finds the same Tcl version as tclsh.
+	    execute_process(
+	      COMMAND ${TK_WISH} ${CMAKE_CURRENT_BINARY_DIR}/CheckTCL_VERSION.tcl
+	      RESULT_VARIABLE TCL_RC
+	      OUTPUT_VARIABLE _plplot_tcl_version
+	      )
+
+	    if(NOT TCL_RC AND _plplot_tcl_version STREQUAL PLPLOT_TCL_VERSION)
+	      # Cross check that tclsh finds the same Tk version as wish.
+	      execute_process(
+		COMMAND ${TCL_TCLSH} ${CMAKE_CURRENT_BINARY_DIR}/CheckTK_VERSION.tcl
+		RESULT_VARIABLE TK_RC
+		OUTPUT_VARIABLE _plplot_tk_version
+		)
+	      if(NOT TK_RC AND _plplot_tk_version STREQUAL PLPLOT_TK_VERSION)
+		message(STATUS "Tcl and Tk versions found by both tclsh and wish are identical")
+		# Sanity checking of Tk version consistency _if_ a Tk
+		# version string can be extracted from the Tk library
+		# name.
+		string(REGEX MATCH "[0-9]+[.]?[0-9]+" library_version ${TK_LIBRARY})
+		if(library_version)
+		  # If no decimal point in version insert as the second character.
+		  if(NOT library_version MATCHES "[.]")
+		    string(REGEX REPLACE "^([0-9])([0-9]+)$" "\\1.\\2" library_version ${library_version})
+		  endif(NOT library_version MATCHES "[.]")
+		  #message(STATUS "library_version = ${library_version}")
+		  string(LENGTH ${library_version} length_library_version)
+		  string(SUBSTRING ${PLPLOT_TK_VERSION} 0 ${length_library_version} truncated_version)
+		  #message(STATUS "truncated_version = ${truncated_version}")
+		  if(NOT truncated_version STREQUAL library_version)
+		    message(STATUS "WARNING: Tk library version = ${library_version} that is extracted from the
+   library name is not consistent with PLPLOT_TK_VERSION = ${PLPLOT_TK_VERSION}")
+		  endif(NOT truncated_version STREQUAL library_version)
+		endif(library_version)
+	      elseif(TK_RC)
+		message(STATUS "Looking for Tk version with tclsh - not found")
+		message(STATUS "WARNING: setting ENABLE_tk to OFF")
+		set(ENABLE_tk OFF CACHE BOOL "Enable Tk bindings" FORCE)
+	      else(NOT TK_RC AND _plplot_tk_version STREQUAL PLPLOT_TK_VERSION)
+		message(STATUS "Tk version = ${_plplot_tk_version} found by tclsh is not consistent with
+   Tk version = ${PLPLOT_TK_VERSION} found by wish"
+		  )
+		message(STATUS "WARNING: setting ENABLE_tk to OFF")
+		set(ENABLE_tk OFF CACHE BOOL "Enable Tk bindings" FORCE)
+	      endif(NOT TK_RC AND _plplot_tk_version STREQUAL PLPLOT_TK_VERSION)
+	    elseif(TCL_RC)
+	      message(STATUS "Looking for Tcl version with wish - not found")
+	      message(STATUS "WARNING: setting ENABLE_tk to OFF")
+	      set(ENABLE_tk OFF CACHE BOOL "Enable Tk bindings" FORCE)
+	    else(NOT TCL_RC AND _plplot_tcl_version STREQUAL PLPLOT_TCL_VERSION)
+	      message(STATUS "Tcl version = ${_plplot_tcl_version} found by wish is not consistent with
+   Tcl version = ${PLPLOT_TCL_VERSION} found by tclsh"
+		)
+	      message(STATUS "WARNING: setting ENABLE_tk to OFF")
+	      set(ENABLE_tk OFF CACHE BOOL "Enable Tk bindings" FORCE)
+	    endif(NOT TCL_RC AND _plplot_tcl_version STREQUAL PLPLOT_TCL_VERSION)
+	  else(PLPLOT_TCL_VERSION STREQUAL PLPLOT_TK_VERSION)
+	    message(STATUS "Tk version = ${PLPLOT_TK_VERSION} found by wish is not consistent with
+   Tcl version = ${PLPLOT_TCL_VERSION} found by tclsh"
+	      )
+	    message(STATUS "WARNING: setting ENABLE_tk to OFF")
+	    set(ENABLE_tk OFF CACHE BOOL "Enable Tk bindings" FORCE)
+	  endif(PLPLOT_TCL_VERSION STREQUAL PLPLOT_TK_VERSION)
+	else(NOT TK_RC)
+	  message(STATUS "Looking for Tk version with wish - not found")
+	  message(STATUS "WARNING: setting ENABLE_tk to OFF")
+	  set(ENABLE_tk OFF CACHE BOOL "Enable Tk bindings" FORCE)
+	endif(NOT TK_RC)
+      else(NOT PLPLOT_TK_VERSION)
+	set(TK_RC 0)
+      endif(NOT PLPLOT_TK_VERSION)
+    else(TK_WISH)
+      message(STATUS "Looking for wish - not found")
+      message(STATUS "WARNING: setting ENABLE_tk to OFF")
+      set(ENABLE_tk OFF CACHE BOOL "Enable Tk bindings" FORCE)
+    endif(TK_WISH)
+  elseif(ENABLE_tk AND NOT TK_FOUND)
+    message(STATUS "Looking for Tk - not found")
+    message(STATUS "WARNING: setting ENABLE_tk to OFF")
+    set(ENABLE_tk OFF CACHE BOOL "Enable Tk bindings" FORCE)
+  endif(ENABLE_tk AND TK_FOUND)
+
+  if(ENABLE_tk AND NOT X11_FOUND)
+    if(WIN32 AND NOT CYGWIN)
+      message(STATUS "WARNING: X11 not found, turning off Tk devices that depend on it")
+      set(PLD_tk OFF CACHE BOOL "Enable Tk device" FORCE)
+      set(PLD_tkwin OFF CACHE BOOL "Enable Tk device" FORCE)
+    else(WIN32 AND NOT CYGWIN)
+      message(STATUS "WARNING: X11 not found so disabling Tk interface code")
+      set(ENABLE_tk OFF CACHE BOOL "Enable Tk interface code" FORCE)
+    endif(WIN32 AND NOT CYGWIN)
+  endif(ENABLE_tk AND NOT X11_FOUND)
+
+  if(NOT ENABLE_tk)
+    message(STATUS "WARNING: Because Tk is disabled must disable Itk as well")
+    set(ENABLE_itk OFF CACHE BOOL "Enable Itk interface code" FORCE)
+  endif(NOT ENABLE_tk)
+
+  if(ENABLE_itk)
+    if(USE_INCRTCL_VERSION_4)
+      set(SUGGESTED_ITK_VERSION 4)
+    else(USE_INCRTCL_VERSION_4)
+      set(SUGGESTED_ITK_VERSION 3)
+    endif(USE_INCRTCL_VERSION_4)
+    if(NOT PLPLOT_ITK_VERSION)
+      file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/CheckITK_Available.tcl "puts -nonewline [package require Itk ${SUGGESTED_ITK_VERSION}]; exit")
+      # Refine SUGGESTED_ITK_VERSION to exact value or fail.
+      execute_process(
+	COMMAND ${TCL_TCLSH} ${CMAKE_CURRENT_BINARY_DIR}/CheckITK_Available.tcl
+	RESULT_VARIABLE ITK_RC
+	OUTPUT_VARIABLE _plplot_itk_version
+	)
       if(NOT ITK_RC)
-	message(STATUS "Looking for itk.h")
-	if(NOT USE_INCRTCL_VERSION_4)
-	  # Search first for epa_build install location.
-          find_path(ITK_INCLUDE_PATH itk.h HINTS ${TCL_INCLUDE_PATH}/itcl${PLPLOT_ITCL_VERSION})
-	endif(NOT USE_INCRTCL_VERSION_4)
-	find_path(ITK_INCLUDE_PATH itk.h HINTS ${TCL_INCLUDE_PATH})
-
-	if(ITK_INCLUDE_PATH)
-          message(STATUS "Looking for itk.h - found")
-	  message(STATUS "ITK_INCLUDE_PATH = ${ITK_INCLUDE_PATH}")
-	  message(STATUS "PLPLOT_ITK_VERSION = ${PLPLOT_ITK_VERSION}")
-
-	  message(STATUS "Checking for Itk header version consistency")
-	  string(REGEX REPLACE "^([0-9]*)\\.[0-9]*.*$" "\\1" ITK_MAJOR_VERSION  "${PLPLOT_ITK_VERSION}")
-	  string(REGEX REPLACE "^[0-9]*\\.([0-9]*).*$" "\\1" ITK_MINOR_VERSION  "${PLPLOT_ITK_VERSION}")
-	  message(STATUS "ITK_MAJOR_VERSION = ${ITK_MAJOR_VERSION}")
-	  message(STATUS "ITK_MINOR_VERSION = ${ITK_MINOR_VERSION}")
-	  file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/CheckITK_VERSION.c
-	    "// #define RC_INVOKED to avoid sucking in lots of additional includes for
+	# Store result in cached variable so it will be remembered
+        # when cmake is re-run, but use type of STRING rather than
+        # INTERNAL to allow users to specify the value with a
+        # -DPLPLOT_ITK_VERSION:STRING=<whatever> on the command line
+        # for those rare cases (e.g., autobuild environment without X)
+        # when "package require Itk" would error out due to the lack
+        # of X or some tclsh issue.
+	set(PLPLOT_ITK_VERSION ${_plplot_itk_version}
+	  CACHE STRING "Itk version that will be used"
+	  )
+      endif(NOT ITK_RC)
+    else(NOT PLPLOT_ITK_VERSION)
+      set(ITCL_RC 0)
+    endif(NOT PLPLOT_ITK_VERSION)
+    if(NOT ITK_RC)
+      message(STATUS "Looking for itk.h")
+      if(NOT USE_INCRTCL_VERSION_4)
+	# Search first for epa_build install location.
+        find_path(ITK_INCLUDE_PATH itk.h HINTS ${TCL_INCLUDE_PATH}/itcl${PLPLOT_ITCL_VERSION})
+      endif(NOT USE_INCRTCL_VERSION_4)
+      find_path(ITK_INCLUDE_PATH itk.h HINTS ${TCL_INCLUDE_PATH})
+
+      if(ITK_INCLUDE_PATH)
+        message(STATUS "Looking for itk.h - found")
+	message(STATUS "ITK_INCLUDE_PATH = ${ITK_INCLUDE_PATH}")
+	message(STATUS "PLPLOT_ITK_VERSION = ${PLPLOT_ITK_VERSION}")
+
+	message(STATUS "Checking for Itk header version consistency")
+	string(REGEX REPLACE "^([0-9]*)\\.[0-9]*.*$" "\\1" ITK_MAJOR_VERSION  "${PLPLOT_ITK_VERSION}")
+	string(REGEX REPLACE "^[0-9]*\\.([0-9]*).*$" "\\1" ITK_MINOR_VERSION  "${PLPLOT_ITK_VERSION}")
+	message(STATUS "ITK_MAJOR_VERSION = ${ITK_MAJOR_VERSION}")
+	message(STATUS "ITK_MINOR_VERSION = ${ITK_MINOR_VERSION}")
+	file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/CheckITK_VERSION.c
+	  "// #define RC_INVOKED to avoid sucking in lots of additional includes for
 // efficiency and simplicity and also to avoid the header file disaster that has long
 // been a problem for version 3.3 of itk.h
 #define RC_INVOKED 1
@@ -289,142 +445,133 @@
 #endif
 void main(void){}
 "
-	    )
-	  try_compile(CONSISTENT_HEADER_ITK_VERSION ${CMAKE_BINARY_DIR}
-	    ${CMAKE_CURRENT_BINARY_DIR}/CheckITK_VERSION.c
-	    CMAKE_FLAGS -DINCLUDE_DIRECTORIES:PATH=${ITK_INCLUDE_PATH}
-	    )
-	  if(CONSISTENT_HEADER_ITK_VERSION)
-	    message(STATUS "Checking for Itk header version consistency - true")
-	  else(CONSISTENT_HEADER_ITK_VERSION)
-	    message(STATUS "Checking for Itk header version consistency - false")
-            message(STATUS "WARNING: Disabling Itk interface code")
-	    set(ENABLE_itk OFF CACHE BOOL "Enable Itk interface code" FORCE)
-	  endif(CONSISTENT_HEADER_ITK_VERSION)
-	else(ITK_INCLUDE_PATH)
-          message(STATUS "Looking for itk.h - not found")
+	  )
+	try_compile(CONSISTENT_HEADER_ITK_VERSION ${CMAKE_BINARY_DIR}
+	  ${CMAKE_CURRENT_BINARY_DIR}/CheckITK_VERSION.c
+	  CMAKE_FLAGS -DINCLUDE_DIRECTORIES:PATH=${ITK_INCLUDE_PATH}
+	  )
+	if(CONSISTENT_HEADER_ITK_VERSION)
+	  message(STATUS "Checking for Itk header version consistency - true")
+	else(CONSISTENT_HEADER_ITK_VERSION)
+	  message(STATUS "Checking for Itk header version consistency - false")
           message(STATUS "WARNING: Disabling Itk interface code")
-          set(ENABLE_itk OFF CACHE BOOL "Enable Itk interface code" FORCE)
-	endif(ITK_INCLUDE_PATH)
-
-	if(ENABLE_itk)
-          message(STATUS "Looking for itk library")
-	  # Search first for epa_build install location.
-          find_library(ITK_LIBRARY itk${PLPLOT_ITK_VERSION} HINTS ${TCL_LIBRARY_PATH}/itk${PLPLOT_ITK_VERSION})
-          find_library(ITK_LIBRARY itk${PLPLOT_ITK_VERSION} HINTS ${TCL_LIBRARY_PATH})
-          if(ITK_LIBRARY)
-            message(STATUS "Looking for itk library - found")
-	    message(STATUS "ITK_LIBRARY = ${ITK_LIBRARY}")
-	    set(HAVE_ITK ON)
-	    get_filename_component(ITK_LIBRARY_PATH ${ITK_LIBRARY} PATH)
-	    list(APPEND TCL_TK_ITCL_ITK_RPATH ${ITK_LIBRARY_PATH})
-
-	    # Test version consistency between iwidgets, itk, and itcl.
-	    if(NOT IWIDGETS_VERSIONS_LIST)
-	      if(USE_INCRTCL_VERSION_4)
-		set(SUGGESTED_IWIDGETS_VERSION 4.1)
-		file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/determine_versions.tcl "puts -nonewline \"[package require Iwidgets ${SUGGESTED_IWIDGETS_VERSION}];[package require Itk];[package require Itcl]\";exit")
+	  set(ENABLE_itk OFF CACHE BOOL "Enable Itk interface code" FORCE)
+	endif(CONSISTENT_HEADER_ITK_VERSION)
+      else(ITK_INCLUDE_PATH)
+        message(STATUS "Looking for itk.h - not found")
+        message(STATUS "WARNING: Disabling Itk interface code")
+        set(ENABLE_itk OFF CACHE BOOL "Enable Itk interface code" FORCE)
+      endif(ITK_INCLUDE_PATH)
+
+      if(ENABLE_itk)
+        message(STATUS "Looking for itk library")
+	# Search first for epa_build install location.
+        find_library(ITK_LIBRARY itk${PLPLOT_ITK_VERSION} HINTS ${TCL_LIBRARY_PATH}/itk${PLPLOT_ITK_VERSION})
+        find_library(ITK_LIBRARY itk${PLPLOT_ITK_VERSION} HINTS ${TCL_LIBRARY_PATH})
+        if(ITK_LIBRARY)
+          message(STATUS "Looking for itk library - found")
+	  message(STATUS "ITK_LIBRARY = ${ITK_LIBRARY}")
+	  set(HAVE_ITK ON)
+	  get_filename_component(ITK_LIBRARY_PATH ${ITK_LIBRARY} PATH)
+	  list(APPEND TCL_TK_ITCL_ITK_RPATH ${ITK_LIBRARY_PATH})
+
+	  # Test version consistency between iwidgets, itk, and itcl.
+	  if(NOT IWIDGETS_VERSIONS_LIST)
+	    if(USE_INCRTCL_VERSION_4)
+	      set(SUGGESTED_IWIDGETS_VERSION 4.1)
+	      file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/determine_versions.tcl "puts -nonewline \"[package require Iwidgets ${SUGGESTED_IWIDGETS_VERSION}];[package require Itk];[package require Itcl]\";exit")
+	      execute_process(
+		COMMAND ${TCL_TCLSH} ${CMAKE_CURRENT_BINARY_DIR}/determine_versions.tcl
+		RESULT_VARIABLE IWIDGETS_RC
+		OUTPUT_VARIABLE _iwidgets_versions_list
+		)
+	    else(USE_INCRTCL_VERSION_4)
+	      # Find maximum 4.0 version of iwidgets that is
+	      # available.  4.0.1 (released in 2002) is the largest
+	      # version of iwidgets4.0 (as opposed to the recently
+	      # developed iwidgets4.1) I have found on the web in
+	      # tarball form, but I have seen one reference to 4.0.2
+	      # which may have been publicly released somewhere
+	      # inaccessible to my google searches or privately made
+	      # available before all development of iwidgets4.0
+	      # stopped. So add 4.0.2 to the list just in case.
+	      foreach(SUGGESTED_IWIDGETS_VERSION 4.0.2 4.0.1 4.0.0)
+		file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/determine_versions.tcl "puts -nonewline \"[package require -exact Iwidgets ${SUGGESTED_IWIDGETS_VERSION}];[package require Itk];[package require Itcl]\";exit")
 		execute_process(
 		  COMMAND ${TCL_TCLSH} ${CMAKE_CURRENT_BINARY_DIR}/determine_versions.tcl
 		  RESULT_VARIABLE IWIDGETS_RC
 		  OUTPUT_VARIABLE _iwidgets_versions_list
+		  ERROR_QUIET
 		  )
-	      else(USE_INCRTCL_VERSION_4)
-		# Find maximum 4.0 version of iwidgets that is
-		# available.  4.0.1 (released in 2002) is the largest
-		# version of iwidgets4.0 (as opposed to the recently
-		# developed iwidgets4.1) I have found on the web in
-		# tarball form, but I have seen one reference to 4.0.2
-		# which may have been publicly released somewhere
-		# inaccessible to my google searches or privately made
-		# available before all development of iwidgets4.0
-		# stopped. So add 4.0.2 to the list just in case.
-		foreach(SUGGESTED_IWIDGETS_VERSION 4.0.2 4.0.1 4.0.0)
-		  file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/determine_versions.tcl "puts -nonewline \"[package require -exact Iwidgets ${SUGGESTED_IWIDGETS_VERSION}];[package require Itk];[package require Itcl]\";exit")
-		  execute_process(
-		    COMMAND ${TCL_TCLSH} ${CMAKE_CURRENT_BINARY_DIR}/determine_versions.tcl
-		    RESULT_VARIABLE IWIDGETS_RC
-		    OUTPUT_VARIABLE _iwidgets_versions_list
-		    ERROR_QUIET
-		    )
-		  if(NOT IWIDGETS_RC)
-		    break()
-		  endif(NOT IWIDGETS_RC)
-		endforeach(SUGGESTED_IWIDGETS_VERSION 4.0.2 4.0.1 4.0.0)
-	      endif(USE_INCRTCL_VERSION_4)
-	      if(NOT IWIDGETS_RC)
-		# Store result in cached variable so it will be
-		# remembered when cmake is re-run, but use type of
-		# STRING rather than INTERNAL to allow users to
-		# specify the value with a
-		# -DIWIDGETS_VERSIONS_LIST:STRING=<whatever> on the
-		# command line for those rare cases (e.g., autobuild
-		# environment without X) when "package require Itk (or
-		# Itcl or IWidgets)" would error out due to the lack of
-		# X or some tclsh issue
-		set(IWIDGETS_VERSIONS_LIST ${_iwidgets_versions_list}
-		  CACHE STRING "list of Iwidgets; Itk, and Itcl versions (in that order) that will be used"
-		  )
-	      endif(NOT IWIDGETS_RC)
-	    else(NOT IWIDGETS_VERSIONS_LIST)
-	      set(IWIDGETS_RC 0)
-	    endif(NOT IWIDGETS_VERSIONS_LIST)
+		if(NOT IWIDGETS_RC)
+		  break()
+		endif(NOT IWIDGETS_RC)
+	      endforeach(SUGGESTED_IWIDGETS_VERSION 4.0.2 4.0.1 4.0.0)
+	    endif(USE_INCRTCL_VERSION_4)
 	    if(NOT IWIDGETS_RC)
-	      message(STATUS "IWIDGETS_VERSIONS_LIST = ${IWIDGETS_VERSIONS_LIST}")
-	      list(GET IWIDGETS_VERSIONS_LIST 0 PLPLOT_IWIDGETS_VERSION)
-	      list(GET IWIDGETS_VERSIONS_LIST 1 CONSISTENT_ITK_VERSION)
-	      list(GET IWIDGETS_VERSIONS_LIST 2 CONSISTENT_ITCL_VERSION)
-
-	      message(STATUS "PLPLOT_IWIDGETS_VERSION = ${PLPLOT_IWIDGETS_VERSION}")
-	      message(STATUS "Checking that the Iwidgets, Itk, and Itcl packages are consistent")
-	      if(CONSISTENT_ITCL_VERSION STREQUAL PLPLOT_ITCL_VERSION AND CONSISTENT_ITK_VERSION STREQUAL PLPLOT_ITK_VERSION)
-		message(STATUS "Checking that the Iwidgets, Itk, and Itcl packages are consistent - true")
-	      else(CONSISTENT_ITCL_VERSION STREQUAL PLPLOT_ITCL_VERSION AND CONSISTENT_ITK_VERSION STREQUAL PLPLOT_ITK_VERSION)
-		message(STATUS "PLPLOT_ITK_VERSION = ${PLPLOT_ITK_VERSION}")
-		message(STATUS "CONSISTENT_ITK_VERSION = ${CONSISTENT_ITK_VERSION}")
-		message(STATUS "PLPLOT_ITCL_VERSION = ${PLPLOT_ITCL_VERSION}")
-		message(STATUS "CONSISTENT_ITCL_VERSION = ${CONSISTENT_ITCL_VERSION}")
-		message(STATUS "Checking that the Iwidgets, Itk, and Itcl packages are consistent - false")
-		message(STATUS "WARNING: Consistent combination of Iwidgets, Itk, and Itcl not found so disabling Itcl and Itk")
-		set(ENABLE_itcl OFF CACHE BOOL "Enable Itcl interface code" FORCE)
-		set(ENABLE_itk OFF CACHE BOOL "Enable Itk interface code" FORCE)
-	      endif(CONSISTENT_ITCL_VERSION STREQUAL PLPLOT_ITCL_VERSION AND CONSISTENT_ITK_VERSION STREQUAL PLPLOT_ITK_VERSION)
-	    else(NOT IWIDGETS_RC)
-	      message(STATUS "WARNING: Iwidgets could not be found so disabling Itcl and Itk")
+	      # Store result in cached variable so it will be
+	      # remembered when cmake is re-run, but use type of
+	      # STRING rather than INTERNAL to allow users to
+	      # specify the value with a
+	      # -DIWIDGETS_VERSIONS_LIST:STRING=<whatever> on the
+	      # command line for those rare cases (e.g., autobuild
+	      # environment without X) when "package require Itk (or
+	      # Itcl or IWidgets)" would error out due to the lack of
+	      # X or some tclsh issue
+	      set(IWIDGETS_VERSIONS_LIST ${_iwidgets_versions_list}
+		CACHE STRING "list of Iwidgets; Itk, and Itcl versions (in that order) that will be used"
+		)
+	    endif(NOT IWIDGETS_RC)
+	  else(NOT IWIDGETS_VERSIONS_LIST)
+	    set(IWIDGETS_RC 0)
+	  endif(NOT IWIDGETS_VERSIONS_LIST)
+	  if(NOT IWIDGETS_RC)
+	    message(STATUS "IWIDGETS_VERSIONS_LIST = ${IWIDGETS_VERSIONS_LIST}")
+	    list(GET IWIDGETS_VERSIONS_LIST 0 PLPLOT_IWIDGETS_VERSION)
+	    list(GET IWIDGETS_VERSIONS_LIST 1 CONSISTENT_ITK_VERSION)
+	    list(GET IWIDGETS_VERSIONS_LIST 2 CONSISTENT_ITCL_VERSION)
+
+	    message(STATUS "PLPLOT_IWIDGETS_VERSION = ${PLPLOT_IWIDGETS_VERSION}")
+	    message(STATUS "Checking that the Iwidgets, Itk, and Itcl packages are consistent")
+	    if(CONSISTENT_ITCL_VERSION STREQUAL PLPLOT_ITCL_VERSION AND CONSISTENT_ITK_VERSION STREQUAL PLPLOT_ITK_VERSION)
+	      message(STATUS "Checking that the Iwidgets, Itk, and Itcl packages are consistent - true")
+	    else(CONSISTENT_ITCL_VERSION STREQUAL PLPLOT_ITCL_VERSION AND CONSISTENT_ITK_VERSION STREQUAL PLPLOT_ITK_VERSION)
+	      message(STATUS "PLPLOT_ITK_VERSION = ${PLPLOT_ITK_VERSION}")
+	      message(STATUS "CONSISTENT_ITK_VERSION = ${CONSISTENT_ITK_VERSION}")
+	      message(STATUS "PLPLOT_ITCL_VERSION = ${PLPLOT_ITCL_VERSION}")
+	      message(STATUS "CONSISTENT_ITCL_VERSION = ${CONSISTENT_ITCL_VERSION}")
+	      message(STATUS "Checking that the Iwidgets, Itk, and Itcl packages are consistent - false")
+	      message(STATUS "WARNING: Consistent combination of Iwidgets, Itk, and Itcl not found so disabling Itcl and Itk")
 	      set(ENABLE_itcl OFF CACHE BOOL "Enable Itcl interface code" FORCE)
 	      set(ENABLE_itk OFF CACHE BOOL "Enable Itk interface code" FORCE)
-	    endif(NOT IWIDGETS_RC)
-          else(ITK_LIBRARY)
-            message(STATUS "Looking for itk library - not found")
-            message(STATUS "WARNING: Disabling Itk interface code")
-            set(ENABLE_itk OFF CACHE BOOL "Enable Itk interface code" FORCE)
-          endif(ITK_LIBRARY)
-	endif(ENABLE_itk)
-      else(NOT ITK_RC)
-        message(STATUS "Itk not available or not compatible with current Tcl shell")
-        message(STATUS "WARNING: Disabling Itk interface code")
-        set(ENABLE_itk OFF CACHE BOOL "Enable Itk interface code" FORCE)
-      endif(NOT ITK_RC)
-    endif(ENABLE_itk)
-
-    # ------------------------------------------------------------------------
-    # figure out how to build tclIndex
-    # ------------------------------------------------------------------------
-    set(MKTCLINDEX ${CMAKE_SOURCE_DIR}/scripts/mktclIndex)
-    if(ENABLE_itcl)
-      set(MKTCLINDEX_ARGS "-itcl")
-    else(ENABLE_itcl)
-      set(MKTCLINDEX_ARGS "-tcl")
-    endif(ENABLE_itcl)
-
-  else(TCL_FOUND AND TCL_TCLSH)
-    message(STATUS "Tcl not found OR tclsh not found")
-    message(STATUS "WARNING: Disabling everything that is Tcl/Tk related")
-    set(ENABLE_tcl OFF CACHE BOOL "Enable Tcl bindings" FORCE)
-    set(ENABLE_itcl OFF CACHE BOOL "Enable Itcl interface code" FORCE)
-    set(ENABLE_tk OFF CACHE BOOL "Enable Tk interface code" FORCE)
-    set(ENABLE_itk OFF CACHE BOOL "Enable Itk interface code" FORCE)
-  endif(TCL_FOUND AND TCL_TCLSH)
+	    endif(CONSISTENT_ITCL_VERSION STREQUAL PLPLOT_ITCL_VERSION AND CONSISTENT_ITK_VERSION STREQUAL PLPLOT_ITK_VERSION)
+	  else(NOT IWIDGETS_RC)
+	    message(STATUS "WARNING: Iwidgets could not be found so disabling Itcl and Itk")
+	    set(ENABLE_itcl OFF CACHE BOOL "Enable Itcl interface code" FORCE)
+	    set(ENABLE_itk OFF CACHE BOOL "Enable Itk interface code" FORCE)
+	  endif(NOT IWIDGETS_RC)
+        else(ITK_LIBRARY)
+          message(STATUS "Looking for itk library - not found")
+          message(STATUS "WARNING: Disabling Itk interface code")
+          set(ENABLE_itk OFF CACHE BOOL "Enable Itk interface code" FORCE)
+        endif(ITK_LIBRARY)
+      endif(ENABLE_itk)
+    else(NOT ITK_RC)
+      message(STATUS "Itk not available or not compatible with current Tcl shell")
+      message(STATUS "WARNING: Disabling Itk interface code")
+      set(ENABLE_itk OFF CACHE BOOL "Enable Itk interface code" FORCE)
+    endif(NOT ITK_RC)
+  endif(ENABLE_itk)
+
+  # ------------------------------------------------------------------------
+  # figure out how to build tclIndex
+  # ------------------------------------------------------------------------
+  set(MKTCLINDEX ${CMAKE_SOURCE_DIR}/scripts/mktclIndex)
+  if(ENABLE_itcl)
+    set(MKTCLINDEX_ARGS "-itcl")
+  else(ENABLE_itcl)
+    set(MKTCLINDEX_ARGS "-tcl")
+  endif(ENABLE_itcl)

   filter_rpath(TCL_RPATH)
   if(TCL_RPATH)


only build unit test if explicitly requested

via make check

--- cmake_admin/FluidUnitTest.cmake
+++ cmake_admin/FluidUnitTest.cmake
@@ -1,6 +1,10 @@
 macro ( ADD_FLUID_TEST _test )
     ADD_EXECUTABLE(${_test} ${_test}.c $<TARGET_OBJECTS:libfluidsynth-OBJ> )
-    TARGET_LINK_LIBRARIES(${_test} libfluidsynth)
+
+    # only build this unit test when explicitly requested by "make check"
+    set_target_properties(${_test} PROPERTIES EXCLUDE_FROM_ALL TRUE)
+
+    TARGET_LINK_LIBRARIES(${_test} $<TARGET_PROPERTY:libfluidsynth,INTERFACE_LINK_LIBRARIES>)

     # use the local include path to look for fluidsynth.h, as we cannot be sure fluidsynth is already installed
     target_include_directories(${_test}


Update FindTBB.cmake to create proper targets (#3060)

--- src/cmake/modules/FindTBB.cmake
+++ src/cmake/modules/FindTBB.cmake
@@ -208,7 +208,25 @@
       REQUIRED_VARS TBB_INCLUDE_DIRS TBB_LIBRARIES
       HANDLE_COMPONENTS
       VERSION_VAR TBB_VERSION)
-
+
   mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARIES)
-
+  set(_tbb_version_file)
+
+  # Add targets
+  if (TBB_FOUND)
+    if (NOT TARGET TBB::tbb)
+        add_library(TBB::tbb UNKNOWN IMPORTED)
+        set_target_properties(TBB::tbb PROPERTIES
+            INTERFACE_INCLUDE_DIRECTORIES ${TBB_INCLUDE_DIRS})
+        set_property(TARGET TBB::tbb APPEND PROPERTY
+            IMPORTED_LOCATION ${TBB_tbb_LIBRARY})
+    endif ()
+    if (NOT TARGET TBB::tbbmalloc)
+        add_library(TBB::tbbmalloc UNKNOWN IMPORTED)
+        set_target_properties(TBB::tbbmalloc PROPERTIES
+            INTERFACE_INCLUDE_DIRECTORIES ${TBB_INCLUDE_DIRS})
+        set_property(TARGET TBB::tbbmalloc APPEND PROPERTY
+            IMPORTED_LOCATION ${TBB_tbbmalloc_LIBRARY})
+    endif ()
+  endif()
 endif()


transfered the find_package()+pkg_check_modules() helpers from CMakeLists to the FindOgg.cmake [skip ci]

--- cmake/FindOgg.cmake
+++ cmake/FindOgg.cmake
@@ -1,21 +1,28 @@
-cmake_minimum_required(VERSION 2.8)
+# - Try to find OGG
+# and define
+#
+#  OGG_FOUND        - System has OGG
+#  OGG_INCLUDE_DIRS - The include directories
+#  OGG_LIBRARY      - The libraries

-find_path(OGG_INCLUDE_DIR ogg/ogg.h)
+# try to find package and provide a hint
+find_package(PkgConfig QUIET)
+pkg_check_modules(PC_OGG QUIET ogg)

-set(OGG_NAMES ${OGG_NAMES} ogg libogg)
+find_path(OGG_INCLUDE_DIR
+    NAMES ogg/ogg.h
+    HINTS ${PC_OGG_INCLUDE_DIRS}
+    PATH_SUFFIXES ogg
+)

-find_library(OGG_LIBRARY NAMES ${OGG_NAMES} PATH)
+find_library(OGG_LIBRARY
+    NAMES ogg libogg
+    HINTS ${PC_OGG_LIBRARY_DIRS}
+    PATH ${OGG_INCLUDE_DIR}/../lib lib
+)

-if(OGG_INCLUDE_DIR AND OGG_LIBRARY)
-    set(OGG_FOUND TRUE)
-endif()
+include(FindPackageHandleStandardArgs)

-if(OGG_FOUND)
-    if(NOT OGG_FIND_QUIETLY)
-        message(STATUS "Found Ogg: ${OGG_LIBRARY}")
-    endif()
-else(OGG_FOUND)
-    if(OGG_FIND_REQUIRED)
-        message(FATAL_ERROR "Could not find ogg")
-    endif()
-endif()+find_package_handle_standard_args(OGG DEFAULT_MSG OGG_LIBRARY OGG_INCLUDE_DIR)
+
+mark_as_advanced(OGG_LIBRARY OGG_INCLUDE_DIR)


icc 16 installs in IntelSWTools per default on Windows

--- cmake/FindTBB.cmake
+++ cmake/FindTBB.cmake
@@ -50,6 +50,7 @@
     HINTS ${TBB_ROOT}
     PATHS
       ${PROJECT_SOURCE_DIR}/tbb
+      "${PROGRAMFILES32}/IntelSWTools/compilers_and_libraries/windows/tbb"
       "${PROGRAMFILES32}/Intel/Composer XE/tbb"
       "${PROGRAMFILES32}/Intel/compilers_and_libraries/windows/tbb"
   )


Improved FindZMQ.cmake

Improved FindZMQ.cmake

--- cmake/FindZMQ.cmake
+++ cmake/FindZMQ.cmake
@@ -1,22 +1,58 @@
-# Finds ZeroMQ, sets ZMQ_LIBRARIES and ZMQ_INCLUDE_DIRS
+# - Finds ZeroMQ 3.x or 4.x
+#
+# The following variables are set if ZeroMQ is found:
+#
+#   ZMQ_FOUND           - Set to TRUE
+#   ZMQ_LIBRARIES       - The name of an imported target that refers to the
+#                         ZeroMQ libraries.
+#   ZMQ_INCLUDE_DIRS    - The ZeroMQ include directory (which contains zmq.h).
+#                         This is also added as a dependency to the imported
+#                         target.
+#   ZMQ_VERSION_STRING  - The version of ZeroMQ which was found
+#
+# If ZeroMQ was not found, ZMQ_FOUND is set to false.
+#
 cmake_minimum_required (VERSION 2.8.11)

-unset (ZMQ_LIBRARIES)
-unset (ZMQ_INCLUDE_DIRS)
-unset (ZMQ_VERSION_STRING)

+# The following function generates a list of version names on the form
+# [3,4]_[0,9]_[0,9], excluding versions lower than verMajor_verMinor_verPatch.
+function (_generateVersionNames targetVarName verMajor verMinor verPatch)
+    set (${targetVarName} "" PARENT_SCOPE)
+    foreach (i RANGE ${verMajor} 4)
+        if (j EQUAL verMajor)
+            set (jMin ${verMinor})
+        else ()
+            set (jMin 0)
+        endif ()
+        foreach (j RANGE ${jMin} 9)
+            if ((i EQUAL verMajor) AND (j EQUAL verMinor))
+                set (kMin ${verPatch})
+            else ()
+                set (kMin 0)
+            endif ()
+            foreach (k RANGE ${kMin} 9)
+                list (APPEND ${targetVarName} "${i}_${j}_${k}")
+            endforeach()
+        endforeach ()
+    endforeach ()
+endfunction ()
+
+# This function prefixes all strings in a list with a string.
+function (_prefixStrings targetVarName prefix)
+    set (${targetVarName} "" PARENT_SCOPE)
+    foreach (s ${ARGN})
+        list (APPEND ${targetVarName} "${prefix}${s}")
+    endforeach ()
+endfunction ()
+
+# On Windows, ZMQ uses a library file naming scheme that includes
+# compiler versions, release/debug mode, etc.  In addition, libraries
+# are typically installed in subfolders of the standard prefix path(s).
 set (_canFind TRUE)
 set (_extraPrefixPaths)
 if (WIN32)
-    # ZMQ may be, and usually is, installed in a folder below the standard prefix.
-    foreach (_prefix ${CMAKE_SYSTEM_PREFIX_PATH})
-        file (GLOB _dirs "${_prefix}/zeromq*" "${_prefix}/zmq*")
-        list (APPEND _extraPrefixPaths ${_dirs})
-        unset (_dirs)
-    endforeach ()
-
-    # On Windows, ZMQ uses a library file naming scheme that includes
-    # compiler versions, release/debug mode, etc.
+    # Compiler versions
     if (MSVC90)
         set (_compiler "v90")
     elseif (MSVC10)
@@ -30,54 +66,55 @@
         message (WARNING "Compiler version not supported by the FindZMQ module; ZMQ not found.")
     endif ()

-    # If version is not requested, assume lowest supported version
+    # Extra search paths
+    foreach (_prefix ${CMAKE_SYSTEM_PREFIX_PATH})
+        file (GLOB _dirs "${_prefix}/zeromq*" "${_prefix}/zmq*")
+        list (APPEND _extraPrefixPaths ${_dirs})
+        unset (_dirs)
+    endforeach ()
+
+    # Version names
     if (NOT ZMQ_FIND_VERSION)
         set (ZMQ_FIND_VERSION_MAJOR 3)
         set (ZMQ_FIND_VERSION_MINOR 0)
         set (ZMQ_FIND_VERSION_PATCH 0)
     endif ()
-
-    # Generate a list of all possible library file names.
-
     if ((ZMQ_FIND_VERSION_MAJOR GREATER 2) AND (ZMQ_FIND_VERSION_MAJOR LESS 5))
-        if ("${ZMQ_FIND_MAX_VERSION_MINOR}" STREQUAL "")
-            set (ZMQ_FIND_MAX_VERSION_MINOR 5)
-        endif ()
-        if ("${ZMQ_FIND_MAX_VERSION_PATCH}" STREQUAL "")
-            set (ZMQ_FIND_MAX_VERSION_PATCH 9)
-        endif ()
-        set (_releaseLibs)
-        set (_debugLibs)
-        foreach (_majorVer RANGE ${ZMQ_FIND_VERSION_MAJOR} 4)
-            foreach (_minorVer RANGE ${ZMQ_FIND_VERSION_MINOR} ${ZMQ_FIND_MAX_VERSION_MINOR})
-                foreach (_patchVer RANGE ${ZMQ_FIND_VERSION_PATCH} ${ZMQ_FIND_MAX_VERSION_PATCH})
-                    set (_version "${_majorVer}_${_minorVer}_${_patchVer}")
-                    list (APPEND _releaseLibs "libzmq-${_compiler}-mt-${_version}")
-                    list (APPEND _debugLibs   "libzmq-${_compiler}-mt-gd-${_version}")
-                    unset (_version)
-                endforeach ()
-            endforeach ()
-        endforeach ()
+        _generateVersionNames(_versionNames
+            ${ZMQ_FIND_VERSION_MAJOR} ${ZMQ_FIND_VERSION_MINOR} ${ZMQ_FIND_VERSION_PATCH})
+        _prefixStrings(_releaseLibs "libzmq-${_compiler}-mt-"    ${_versionNames})
+        _prefixStrings(_debugLibs   "libzmq-${_compiler}-mt-gd-" ${_versionNames})
         message (STATUS "Searching for ZMQ. This may take a while...")
     else ()
         set (_canFind FALSE)
         message (WARNING "ZMQ version not supported by the FindZMQ module: ${ZMQ_FIND_VERSION}")
     endif ()
 else ()
-    # On *NIX, it's just "libzmq" as usual.
+    # We don't need any special adaptations on *NIX.
     set (_releaseLibs "zmq")
-    set (_debugLibs ${_releaseLibs})
+    unset (_debugLibs)
 endif ()

+unset (ZMQ_LIBRARIES)
+unset (ZMQ_INCLUDE_DIRS)
+unset (ZMQ_VERSION_STRING)
 if (_canFind)
+    # Find "normal" library
     find_library (_libzmq_release
         NAMES ${_releaseLibs}
         PATHS $ENV{ZMQ_DIR} ${_extraPrefixPaths}
         PATH_SUFFIXES "lib")
-    find_library (_libzmq_debug
-        NAMES ${_debugLibs}
-        PATHS $ENV{ZMQ_DIR} ${_extraPrefixPaths}
-        PATH_SUFFIXES "lib")
+
+    # Find "debug" library (Windows only)
+    unset (_libzmq_debug)
+    if (_debugLibs)
+        find_library (_libzmq_debug
+            NAMES ${_debugLibs}
+            PATHS $ENV{ZMQ_DIR} ${_extraPrefixPaths}
+            PATH_SUFFIXES "lib")
+    endif ()
+
+    # Find include directory
     find_path (ZMQ_INCLUDE_DIRS "zmq.h"
         PATHS $ENV{ZMQ_DIR} ${_extraPrefixPaths}
         PATH_SUFFIXES "include")


Macro renamed.

Macro renamed.

--- cmake/Options.cmake
+++ cmake/Options.cmake
@@ -6,16 +6,16 @@
 endif()

-macro(_print_option _option _name _value _docstring)
+macro(_add_option _option _name _value _docstring)
     option(${_option} "${_docstring}" ${${_value}})
     message(STATUS "${_name} : ${${_option}}")
 endmacro()

-_print_option(UNIT_TESTS "Unit Tests" ON "Build Unit Tests")
-_print_option(COVERAGE "Coverage" OFF "Enable Coverage")
-_print_option(BUILD_TOOLS "Build Tools" ON "Build the tools")
-_print_option(BUILD_SCHEMA_TESTS "Build Schema Tests" OFF "Build the Schema Tests")
-_print_option(BUILD_DEMOS "Build Demos" OFF "Build the Demos")
-_print_option(BUILD_SHARED_LIBS "Build shared library" OFF "Build Shared Library")
+_add_option(UNIT_TESTS "Unit Tests" ON "Build Unit Tests")
+_add_option(COVERAGE "Coverage" OFF "Enable Coverage")
+_add_option(BUILD_TOOLS "Build Tools" ON "Build the tools")
+_add_option(BUILD_SCHEMA_TESTS "Build Schema Tests" OFF "Build the Schema Tests")
+_add_option(BUILD_DEMOS "Build Demos" OFF "Build the Demos")
+_add_option(BUILD_SHARED_LIBS "Build shared library" OFF "Build Shared Library")


Remove NeuriteElementTest.RetractAllDendrites from valgrind tests

This test runs for too long on Travis

--- cmake/Testing.cmake
+++ cmake/Testing.cmake
@@ -83,7 +83,7 @@
       AND NOT ${TEST_TARGET} STREQUAL "runBiodynamoTests_resource_manager_aos_test"
       AND NOT ${TEST_TARGET} STREQUAL "runBiodynamoTests_so_pointer_aos_test")
     # filter out SchedulerTest.Backup because of timing issue
-    add_test(NAME "valgrind_${TEST_TARGET}" COMMAND ${CMAKE_SOURCE_DIR}/util/valgrind.sh ./${TEST_TARGET} -- --gtest_filter=-*DeathTest.*:IOTest.InvalidRead:SchedulerTest.Backup:ResourceManagerTest.SortAndApplyOnAllElementsParallel*:InlineVector*)
+    add_test(NAME "valgrind_${TEST_TARGET}" COMMAND ${CMAKE_SOURCE_DIR}/util/valgrind.sh ./${TEST_TARGET} -- --gtest_filter=-*DeathTest.*:IOTest.InvalidRead:SchedulerTest.Backup:ResourceManagerTest.SortAndApplyOnAllElementsParallel*:InlineVector*:NeuriteElementTest.RetractAllDendrites)
   endif()

   add_dependencies(check ${TEST_TARGET})


Correct flag for obsolete cxx features

Correct flag for obsolete cxx features

--- scripts/CheckCXX11Features.cmake
+++ scripts/CheckCXX11Features.cmake
@@ -163,7 +163,7 @@
   endif()
   # Then call macro
   string(TOUPPER ${current_feature} UPPER_OPTIONAL)
-  set(VARNAME HAS_CXX11_${UPPER_OPTIONAL})
+  string(REGEX REPLACE "/" "_" VARNAME "HAS_CXX11_${UPPER_OPTIONAL}")
   cxx11_check_single_feature(${current_feature} "${number}" ${VARNAME})
 endmacro(_figure_out_cxx11_feature)


cmake module fix

cmake module fix

git-svn-id: e7ea667a1d39a4453c4efcc4ba7bca3d620c3f19@898 a9d63959-f2ad-4865-b262-bf0e56cfafb6

--- cmake/Modules/FindCMinpack.cmake
+++ cmake/Modules/FindCMinpack.cmake
@@ -19,12 +19,12 @@

 find_library(CMINPACK_LIBRARY cminpack
     HINTS ${PC_CMINPACK_LIBDIR} ${PC_CMINPACK_LIBRARY_DIRS} "${CMINPACK_ROOT}" "$ENV{CMINPACK_ROOT}"
-    PATHS "$ENV{PROGRAMFILES}/CMINPACK 1.1.13" "$ENV{PROGRAMW6432}/CMINPACK 1.1.13"
+    PATHS "$ENV{PROGRAMFILES}/CMINPACK 1.1.3" "$ENV{PROGRAMW6432}/CMINPACK 1.1.3"
     PATH_SUFFIXES lib)

 find_library(CMINPACK_LIBRARY_DEBUG cminpack-gd cminpack
     HINTS ${PC_CMINPACK_LIBDIR} ${PC_CMINPACK_LIBRARY_DIRS} "${CMINPACK_ROOT}" "$ENV{CMINPACK_ROOT}"
-    PATHS "$ENV{PROGRAMFILES}/CMINPACK 1.1.13" "$ENV{PROGRAMW6432}/CMINPACK 1.1.13"
+    PATHS "$ENV{PROGRAMFILES}/CMINPACK 1.1.3" "$ENV{PROGRAMW6432}/CMINPACK 1.1.3"
     PATH_SUFFIXES lib)

 if(NOT CMINPACK_LIBRARY_DEBUG)


Fix building of certain plugins on OS X

Fix building of certain plugins on OS X

Before this change, building of plugins that used `ARG_LINK_ELEKTRA` –
such as `csvstorage`, `hosts` or `spec` – would fail on OS X.

--- cmake/Modules/LibAddPlugin.cmake
+++ cmake/Modules/LibAddPlugin.cmake
@@ -80,7 +80,7 @@
 		add_library (${PLUGIN_NAME} MODULE ${ARG_SOURCES}
 			${PLUGIN_SHARED_SOURCES})
 		if (ARG_LINK_ELEKTRA)
-			target_link_libraries (${PLUGIN_NAME} ${ARG_LINK_ELEKTRA})
+			target_link_libraries (${PLUGIN_NAME} elektra-plugin ${ARG_LINK_ELEKTRA})
 		else()
 			target_link_libraries (${PLUGIN_NAME} elektra-plugin)
 		endif ()