[cmake] removes UseLATEX script that's shipped in dune-common

--- cmake/UseLATEX.cmake
+++ cmake/UseLATEX.cmake
@@ -1,1288 +0,0 @@
-# File: UseLATEX.cmake
-# CMAKE commands to actually use the LaTeX compiler
-# Version: 1.9.4
-# Author: Kenneth Moreland <kmorel@sandia.gov>
-#
-# Copyright 2004 Sandia Corporation.
-# Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
-# license for use of this work by or on behalf of the
-# U.S. Government. Redistribution and use in source and binary forms, with
-# or without modification, are permitted provided that this Notice and any
-# statement of authorship are reproduced on all copies.
-#
-# The following function is defined:
-#
-# ADD_LATEX_DOCUMENT(<tex_file>
-#                    [BIBFILES <bib_files>]
-#                    [INPUTS <input_tex_files>]
-#                    [IMAGE_DIRS] <image_directories>
-#                    [IMAGES] <image_files>
-#                    [CONFIGURE] <tex_files>
-#                    [DEPENDS] <tex_files>
-#                    [MULTIBIB_NEWCITES] <suffix_list>
-#                    [USE_INDEX] [USE_GLOSSARY] [USE_NOMENCL]
-#                    [DEFAULT_PDF] [DEFAULT_SAFEPDF]
-#                    [MANGLE_TARGET_NAMES])
-#       Adds targets that compile <tex_file>.  The latex output is placed
-#       in LATEX_OUTPUT_PATH or CMAKE_CURRENT_BINARY_DIR if the former is
-#       not set.  The latex program is picky about where files are located,
-#       so all input files are copied from the source directory to the
-#       output directory.  This includes the target tex file, any tex file
-#       listed with the INPUTS option, the bibliography files listed with
-#       the BIBFILES option, and any .cls, .bst, and .clo files found in
-#       the current source directory.  Images found in the IMAGE_DIRS
-#       directories or listed by IMAGES are also copied to the output
-#       directory and coverted to an appropriate format if necessary.  Any
-#       tex files also listed with the CONFIGURE option are also processed
-#       with the CMake CONFIGURE_FILE command (with the @ONLY flag).  Any
-#       file listed in CONFIGURE but not the target tex file or listed with
-#       INPUTS has no effect. DEPENDS can be used to specify generated files
-#       that are needed to compile the latex target.
-#
-#       The following targets are made:
-#               dvi: Makes <name>.dvi
-#               pdf: Makes <name>.pdf using pdflatex.
-#               safepdf: Makes <name>.pdf using ps2pdf.  If using the default
-#                       program arguments, this will ensure all fonts are
-#                       embedded and no lossy compression has been performed
-#                       on images.
-#               ps: Makes <name>.ps
-#               html: Makes <name>.html
-#               auxclean: Deletes <name>.aux and other auxiliary files.
-#                       This is sometimes necessary if a LaTeX error occurs
-#                       and writes a bad aux file.  Unlike the regular clean
-#                       target, it does not delete other input files, such as
-#                       converted images, to save time on the rebuild.
-#
-#       The dvi target is added to the ALL.  That is, it will be the target
-#       built by default.  If the DEFAULT_PDF argument is given, then the
-#       pdf target will be the default instead of dvi.
-#
-#       If the argument MANGLE_TARGET_NAMES is given, then each of the
-#       target names above will be mangled with the <tex_file> name.  This
-#       is to make the targets unique if ADD_LATEX_DOCUMENT is called for
-#       multiple documents.  If the argument USE_INDEX is given, then
-#       commands to build an index are made.  If the argument USE_GLOSSARY
-#       is given, then commands to build a glossary are made.  If the
-#       argument MULTIBIB_NEWCITES is given, then additional bibtex calls
-#       are added to the build to support the extra auxiliary files created
-#       with the \newcite command in the multibib package.
-#
-# History:
-#
-# 1.9.4 Fix issues with filenames containing multiple periods.
-#
-# 1.9.3 Hide some variables that are now cached but should not show up in
-#       the ccmake list of variables.
-#
-# 1.9.2 Changed MACRO declarations to FUNCTION declarations.  The better
-#       FUNCTION scoping will hopefully avoid some common but subtle bugs.
-#       This implicitly increases the minimum CMake version to 4.6 (although
-#       I honestly only test it with the latest 4.8 version).
-#
-#       Since we are updating the minimum CMake version, I'm going to start
-#       using the builtin LIST commands that are now available.
-#
-#       Favor using pdftops from the Poppler package to convert from pdf to
-#       eps.  It does a much better job than ImageMagick or ghostscript.
-#
-# 1.9.1 Fixed typo that caused the LATEX_SMALL_IMAGES option to fail to
-#       activate.
-#
-# 1.9.0 Add support for the multibib package (thanks to Antonio LaTorre).
-#
-# 1.8.2 Fix corner case when an argument name was also a variable containing
-#       the text of an argument.  In this case, the CMake IF was matching
-#       the argument text with the contents of the variable with the same
-#       argument name.
-#
-# 1.8.1 Fix problem where ps2pdf was not getting the appropriate arguments.
-#
-# 1.8.0 Add support for synctex.
-#
-# 1.7.7 Support calling xindy when making glossaries.
-#
-#       Improved make clean support.
-#
-# 1.7.6 Add support for the nomencl package (thanks to Myles English).
-#
-# 1.7.5 Fix issue with bibfiles being copied two different ways, which causes
-#       Problems with dependencies (thanks to Edwin van Leeuwen).
-#
-# 1.7.4 Added the DEFAULT_SAFEPDF option (thanks to Raymond Wan).
-#
-#       Added warnings when image directories are not found (and were
-#       probably not given relative to the source directory).
-#
-# 1.7.3 Fix some issues with interactions between makeglossaries and bibtex
-#       (thanks to Mark de Wever).
-#
-# 1.7.2 Use ps2pdf to convert eps to pdf to get around the problem with
-#       ImageMagick dropping the bounding box (thanks to Lukasz Lis).
-#
-# 1.7.1 Fixed some dependency issues.
-#
-# 1.7.0 Added DEPENDS options (thanks to Theodore Papadopoulo).
-#
-# 1.6.1 Ported the makeglossaries command to CMake and embedded the port
-#       into UseLATEX.cmake.
-#
-# 1.6.0 Allow the use of the makeglossaries command.  Thanks to Oystein
-#       S. Haaland for the patch.
-#
-# 1.5.0 Allow any type of file in the INPUTS lists, not just tex file
-#       (suggested by Eric Noulard).  As a consequence, the ability to
-#       specify tex files without the .tex extension is removed.  The removed
-#       function is of dubious value anyway.
-#
-#       When copying input files, skip over any file that exists in the
-#       binary directory but does not exist in the source directory with the
-#       assumption that these files were added by some other mechanism.  I
-#       find this useful when creating large documents with multiple
-#       chapters that I want to build separately (for speed) as I work on
-#       them.  I use the same boilerplate as the starting point for all
-#       and just copy it with different configurations.  This was what the
-#       separate ADD_LATEX_DOCUMENT method was supposed to originally be for.
-#       Since its external use is pretty much deprecated, I removed that
-#       documentation.
-#
-# 1.4.1 Copy .sty files along with the other class and package files.
-#
-# 1.4.0 Added a MANGLE_TARGET_NAMES option that will mangle the target names.
-#
-#       Fixed problem with copying bib files that became apparent with
-#       CMake 2.4.
-#
-# 1.3.0 Added a LATEX_OUTPUT_PATH variable that allows you or the user to
-#       specify where the built latex documents to go.  This is especially
-#       handy if you want to do in-source builds.
-#
-#       Removed the ADD_LATEX_IMAGES macro and absorbed the functionality
-#       into ADD_LATEX_DOCUMENT.  The old interface was always kind of
-#       clunky anyway since you had to specify the image directory in both
-#       places.  It also made supporting LATEX_OUTPUT_PATH problematic.
-#
-#       Added support for jpeg files.
-#
-# 1.2.0 Changed the configuration options yet again.  Removed the NO_CONFIGURE
-#       Replaced it with a CONFIGURE option that lists input files for which
-#       configure should be run.
-#
-#       The pdf target no longer depends on the dvi target.  This allows you
-#       to build latex documents that require pdflatex.  Also added an option
-#       to make the pdf target the default one.
-#
-# 1.1.1 Added the NO_CONFIGURE option.  The @ character can be used when
-#       specifying table column separators.  If two or more are used, then
-#       will incorrectly substitute them.
-#
-# 1.1.0 Added ability include multiple bib files.  Added ability to do copy
-#       sub-tex files for multipart tex files.
-#
-# 1.0.0 If both ps and pdf type images exist, just copy the one that
-#       matches the current render mode.  Replaced a bunch of STRING
-#       commands with GET_FILENAME_COMPONENT commands that were made to do
-#       the desired function.
-#
-# 0.4.0 First version posted to CMake Wiki.
-#
-
-#############################################################################
-# Find the location of myself while originally executing.  If you do this
-# inside of a macro, it will recode where the macro was invoked.
-#############################################################################
-SET(LATEX_USE_LATEX_LOCATION ${CMAKE_CURRENT_LIST_FILE}
-  CACHE INTERNAL "Location of UseLATEX.cmake file." FORCE
-  )
-
-#############################################################################
-# Generic helper functions
-#############################################################################
-
-FUNCTION(LATEX_LIST_CONTAINS var value)
-  SET(input_list ${ARGN})
-  LIST(FIND input_list "${value}" index)
-  IF (index GREATER -1)
-    SET(${var} TRUE PARENT_SCOPE)
-  ELSE (index GREATER -1)
-    SET(${var} PARENT_SCOPE)
-  ENDIF (index GREATER -1)
-ENDFUNCTION(LATEX_LIST_CONTAINS)
-
-# Parse function arguments.  Variables containing the results are placed
-# in the global scope for historical reasons.
-FUNCTION(LATEX_PARSE_ARGUMENTS prefix arg_names option_names)
-  SET(DEFAULT_ARGS)
-  FOREACH(arg_name ${arg_names})
-    SET(${prefix}_${arg_name} CACHE INTERNAL "${prefix} argument" FORCE)
-  ENDFOREACH(arg_name)
-  FOREACH(option ${option_names})
-    SET(${prefix}_${option} CACHE INTERNAL "${prefix} option" FORCE)
-  ENDFOREACH(option)
-
-  SET(current_arg_name DEFAULT_ARGS)
-  SET(current_arg_list)
-  FOREACH(arg ${ARGN})
-    LATEX_LIST_CONTAINS(is_arg_name ${arg} ${arg_names})
-    LATEX_LIST_CONTAINS(is_option ${arg} ${option_names})
-    IF (is_arg_name)
-      SET(${prefix}_${current_arg_name} ${current_arg_list}
-        CACHE INTERNAL "${prefix} argument" FORCE)
-      SET(current_arg_name ${arg})
-      SET(current_arg_list)
-    ELSEIF (is_option)
-      SET(${prefix}_${arg} TRUE CACHE INTERNAL "${prefix} option" FORCE)
-    ELSE (is_arg_name)
-      SET(current_arg_list ${current_arg_list} ${arg})
-    ENDIF (is_arg_name)
-  ENDFOREACH(arg)
-  SET(${prefix}_${current_arg_name} ${current_arg_list}
-    CACHE INTERNAL "${prefix} argument" FORCE)
-ENDFUNCTION(LATEX_PARSE_ARGUMENTS)
-
-# Match the contents of a file to a regular expression.
-FUNCTION(LATEX_FILE_MATCH variable filename regexp default)
-  # The FILE STRINGS command would be a bit better, but I'm not totally sure
-  # the match will always be to a whole line, and I don't want to break things.
-  FILE(READ ${filename} file_contents)
-  STRING(REGEX MATCHALL "${regexp}"
-    match_result ${file_contents}
-    )
-  IF (match_result)
-    SET(${variable} "${match_result}" PARENT_SCOPE)
-  ELSE (match_result)
-    SET(${variable} "${default}" PARENT_SCOPE)
-  ENDIF (match_result)
-ENDFUNCTION(LATEX_FILE_MATCH)
-
-# A version of GET_FILENAME_COMPONENT that treats extensions after the last
-# period rather than the first.  To the best of my knowledge, all filenames
-# typically used by LaTeX, including image files, have small extensions
-# after the last dot.
-FUNCTION(LATEX_GET_FILENAME_COMPONENT varname filename type)
-  SET(result)
-  IF ("${type}" STREQUAL "NAME_WE")
-    GET_FILENAME_COMPONENT(name ${filename} NAME)
-    STRING(REGEX REPLACE "\\.[^.]*\$" "" result "${name}")
-  ELSEIF ("${type}" STREQUAL "EXT")
-    GET_FILENAME_COMPONENT(name ${filename} NAME)
-    STRING(REGEX MATCH "\\.[^.]*\$" result "${name}")
-  ELSE ("${type}" STREQUAL "NAME_WE")
-    GET_FILENAME_COMPONENT(result ${filename} ${type})
-  ENDIF ("${type}" STREQUAL "NAME_WE")
-  SET(${varname} "${result}" PARENT_SCOPE)
-ENDFUNCTION(LATEX_GET_FILENAME_COMPONENT)
-
-#############################################################################
-# Functions that perform processing during a LaTeX build.
-#############################################################################
-FUNCTION(LATEX_MAKEGLOSSARIES)
-  # This is really a bare bones port of the makeglossaries perl script into
-  # CMake scripting.
-  MESSAGE("**************************** In makeglossaries")
-  IF (NOT LATEX_TARGET)
-    MESSAGE(SEND_ERROR "Need to define LATEX_TARGET")
-  ENDIF (NOT LATEX_TARGET)
-
-  SET(aux_file ${LATEX_TARGET}.aux)
-
-  IF (NOT EXISTS ${aux_file})
-    MESSAGE(SEND_ERROR "${aux_file} does not exist.  Run latex on your target file.")
-  ENDIF (NOT EXISTS ${aux_file})
-
-  LATEX_FILE_MATCH(newglossary_lines ${aux_file}
-    "@newglossary[ \t]*{([^}]*)}{([^}]*)}{([^}]*)}{([^}]*)}"
-    "@newglossary{main}{glg}{gls}{glo}"
-    )
-
-  LATEX_FILE_MATCH(istfile_line ${aux_file}
-    "@istfilename[ \t]*{([^}]*)}"
-    "@istfilename{${LATEX_TARGET}.ist}"
-    )
-  STRING(REGEX REPLACE "@istfilename[ \t]*{([^}]*)}" "\\1"
-    istfile ${istfile_line}
-    )
-
-  STRING(REGEX MATCH ".*\\.xdy" use_xindy "${istfile}")
-  IF (use_xindy)
-    MESSAGE("*************** Using xindy")
-    IF (NOT XINDY_COMPILER)
-      MESSAGE(SEND_ERROR "Need to define XINDY_COMPILER")
-    ENDIF (NOT XINDY_COMPILER)
-  ELSE (use_xindy)
-    MESSAGE("*************** Using makeindex")
-    IF (NOT MAKEINDEX_COMPILER)
-      MESSAGE(SEND_ERROR "Need to define MAKEINDEX_COMPILER")
-    ENDIF (NOT MAKEINDEX_COMPILER)
-  ENDIF (use_xindy)
-
-  FOREACH(newglossary ${newglossary_lines})
-    STRING(REGEX REPLACE
-      "@newglossary[ \t]*{([^}]*)}{([^}]*)}{([^}]*)}{([^}]*)}"
-      "\\1" glossary_name ${newglossary}
-      )
-    STRING(REGEX REPLACE
-      "@newglossary[ \t]*{([^}]*)}{([^}]*)}{([^}]*)}{([^}]*)}"
-      "${LATEX_TARGET}.\\2" glossary_log ${newglossary}
-      )
-    STRING(REGEX REPLACE
-      "@newglossary[ \t]*{([^}]*)}{([^}]*)}{([^}]*)}{([^}]*)}"
-      "${LATEX_TARGET}.\\3" glossary_out ${newglossary}
-      )
-    STRING(REGEX REPLACE
-      "@newglossary[ \t]*{([^}]*)}{([^}]*)}{([^}]*)}{([^}]*)}"
-      "${LATEX_TARGET}.\\4" glossary_in ${newglossary}
-      )
-
-    IF (use_xindy)
-      LATEX_FILE_MATCH(xdylanguage_line ${aux_file}
-        "@xdylanguage[ \t]*{${glossary_name}}{([^}]*)}"
-        "@xdylanguage{${glossary_name}}{english}"
-        )
-      STRING(REGEX REPLACE
-        "@xdylanguage[ \t]*{${glossary_name}}{([^}]*)}"
-        "\\1"
-        language
-        ${xdylanguage_line}
-        )
-      # What crazy person makes a LaTeX index generater that uses different
-      # identifiers for language than babel (or at least does not support
-      # the old ones)?
-      IF (${language} STREQUAL "frenchb")
-        SET(language "french")
-      ELSEIF (${language} MATCHES "^n?germanb?$")
-        SET(language "german")
-      ELSEIF (${language} STREQUAL "magyar")
-        SET(language "hungarian")
-      ELSEIF (${language} STREQUAL "lsorbian")
-        SET(language "lower-sorbian")
-      ELSEIF (${language} STREQUAL "norsk")
-        SET(language "norwegian")
-      ELSEIF (${language} STREQUAL "portuges")
-        SET(language "portuguese")
-      ELSEIF (${language} STREQUAL "russianb")
-        SET(language "russian")
-      ELSEIF (${language} STREQUAL "slovene")
-        SET(language "slovenian")
-      ELSEIF (${language} STREQUAL "ukraineb")
-        SET(language "ukrainian")
-      ELSEIF (${language} STREQUAL "usorbian")
-        SET(language "upper-sorbian")
-      ENDIF (${language} STREQUAL "frenchb")
-      IF (language)
-        SET(language_flags "-L ${language}")
-      ELSE (language)
-        SET(language_flags "")
-      ENDIF (language)
-
-      LATEX_FILE_MATCH(codepage_line ${aux_file}
-        "@gls@codepage[ \t]*{${glossary_name}}{([^}]*)}"
-        "@gls@codepage{${glossary_name}}{utf}"
-        )
-      STRING(REGEX REPLACE
-        "@gls@codepage[ \t]*{${glossary_name}}{([^}]*)}"
-        "\\1"
-        codepage
-        ${codepage_line}
-        )
-      IF (codepage)
-        SET(codepage_flags "-C ${codepage}")
-      ELSE (codepage)
-        # Ideally, we would check that the language is compatible with the
-        # default codepage, but I'm hoping that distributions will be smart
-        # enough to specify their own codepage.  I know, it's asking a lot.
-        SET(codepage_flags "")
-      ENDIF (codepage)
-
-      MESSAGE("${XINDY_COMPILER} ${MAKEGLOSSARIES_COMPILER_FLAGS} ${language_flags} ${codepage_flags} -I xindy -M ${glossary_name} -t ${glossary_log} -o ${glossary_out} ${glossary_in}"
-        )
-      EXEC_PROGRAM(${XINDY_COMPILER}
-        ARGS ${MAKEGLOSSARIES_COMPILER_FLAGS}
-          ${language_flags}
-          ${codepage_flags}
-          -I xindy
-          -M ${glossary_name}
-          -t ${glossary_log}
-          -o ${glossary_out}
-          ${glossary_in}
-        OUTPUT_VARIABLE xindy_output
-        )
-      MESSAGE("${xindy_output}")
-
-      # So, it is possible (perhaps common?) for aux files to specify a
-      # language and codepage that are incompatible with each other.  Check
-      # for that condition, and if it happens run again with the default
-      # codepage.
-      IF ("${xindy_output}" MATCHES "^Cannot locate xindy module for language (.+) in codepage (.+)\\.$")
-        MESSAGE("*************** Retrying xindy with default codepage.")
-        EXEC_PROGRAM(${XINDY_COMPILER}
-          ARGS ${MAKEGLOSSARIES_COMPILER_FLAGS}
-            ${language_flags}
-            -I xindy
-            -M ${glossary_name}
-            -t ${glossary_log}
-            -o ${glossary_out}
-            ${glossary_in}
-          )
-      ENDIF ("${xindy_output}" MATCHES "^Cannot locate xindy module for language (.+) in codepage (.+)\\.$")
-      #ENDIF ("${xindy_output}" MATCHES "Cannot locate xindy module for language (.+) in codepage (.+)\\.")
-
-    ELSE (use_xindy)
-      MESSAGE("${MAKEINDEX_COMPILER} ${MAKEGLOSSARIES_COMPILER_FLAGS} -s ${istfile} -t ${glossary_log} -o ${glossary_out} ${glossary_in}")
-      EXEC_PROGRAM(${MAKEINDEX_COMPILER} ARGS ${MAKEGLOSSARIES_COMPILER_FLAGS}
-        -s ${istfile} -t ${glossary_log} -o ${glossary_out} ${glossary_in}
-        )
-    ENDIF (use_xindy)
-
-  ENDFOREACH(newglossary)
-ENDFUNCTION(LATEX_MAKEGLOSSARIES)
-
-FUNCTION(LATEX_MAKENOMENCLATURE)
-  MESSAGE("**************************** In makenomenclature")
-  IF (NOT LATEX_TARGET)
-    MESSAGE(SEND_ERROR "Need to define LATEX_TARGET")
-  ENDIF (NOT LATEX_TARGET)
-
-  IF (NOT MAKEINDEX_COMPILER)
-    MESSAGE(SEND_ERROR "Need to define MAKEINDEX_COMPILER")
-  ENDIF (NOT MAKEINDEX_COMPILER)
-
-  SET(nomencl_out ${LATEX_TARGET}.nls)
-  SET(nomencl_in ${LATEX_TARGET}.nlo)
-
-  EXEC_PROGRAM(${MAKEINDEX_COMPILER} ARGS ${MAKENOMENCLATURE_COMPILER_FLAGS}
-    ${nomencl_in} -s "nomencl.ist" -o ${nomencl_out}
-    )
-ENDFUNCTION(LATEX_MAKENOMENCLATURE)
-
-FUNCTION(LATEX_CORRECT_SYNCTEX)
-  MESSAGE("**************************** In correct SyncTeX")
-  IF (NOT LATEX_TARGET)
-    MESSAGE(SEND_ERROR "Need to define LATEX_TARGET")
-  ENDIF (NOT LATEX_TARGET)
-
-  IF (NOT GZIP)
-    MESSAGE(SEND_ERROR "Need to define GZIP")
-  ENDIF (NOT GZIP)
-
-  IF (NOT LATEX_SOURCE_DIRECTORY)
-    MESSAGE(SEND_ERROR "Need to define LATEX_SOURCE_DIRECTORY")
-  ENDIF (NOT LATEX_SOURCE_DIRECTORY)
-
-  IF (NOT LATEX_BINARY_DIRECTORY)
-    MESSAGE(SEND_ERROR "Need to define LATEX_BINARY_DIRECTORY")
-  ENDIF (NOT LATEX_BINARY_DIRECTORY)
-
-  SET(synctex_file ${LATEX_BINARY_DIRECTORY}/${LATEX_TARGET}.synctex)
-  SET(synctex_file_gz ${synctex_file}.gz)
-
-  IF (EXISTS ${synctex_file_gz})
-
-    MESSAGE("Making backup of synctex file.")
-    CONFIGURE_FILE(${synctex_file_gz} ${synctex_file}.bak.gz COPYONLY)
-
-    MESSAGE("Uncompressing synctex file.")
-    EXEC_PROGRAM(${GZIP}
-      ARGS --decompress ${synctex_file_gz}
-      )
-
-    MESSAGE("Reading synctex file.")
-    FILE(READ ${synctex_file} synctex_data)
-
-    MESSAGE("Replacing relative with absolute paths.")
-    STRING(REGEX REPLACE
-      "(Input:[0-9]+:)([^/\n][^\n]*)"
-      "\\1${LATEX_SOURCE_DIRECTORY}/\\2"
-      synctex_data
-      "${synctex_data}"
-      )
-
-    MESSAGE("Writing synctex file.")
-    FILE(WRITE ${synctex_file} "${synctex_data}")
-
-    MESSAGE("Compressing synctex file.")
-    EXEC_PROGRAM(${GZIP}
-      ARGS ${synctex_file}
-      )
-
-  ELSE (EXISTS ${synctex_file_gz})
-
-    MESSAGE(SEND_ERROR "File ${synctex_file_gz} not found.  Perhaps synctex is not supported by your LaTeX compiler.")
-
-  ENDIF (EXISTS ${synctex_file_gz})
-
-ENDFUNCTION(LATEX_CORRECT_SYNCTEX)
-
-#############################################################################
-# Helper functions for establishing LaTeX build.
-#############################################################################
-
-FUNCTION(LATEX_NEEDIT VAR NAME)
-  IF (NOT ${VAR})
-    MESSAGE(SEND_ERROR "I need the ${NAME} command.")
-  ENDIF(NOT ${VAR})
-ENDFUNCTION(LATEX_NEEDIT)
-
-FUNCTION(LATEX_WANTIT VAR NAME)
-  IF (NOT ${VAR})
-    MESSAGE(STATUS "I could not find the ${NAME} command.")
-  ENDIF(NOT ${VAR})
-ENDFUNCTION(LATEX_WANTIT)
-
-FUNCTION(LATEX_SETUP_VARIABLES)
-  SET(LATEX_OUTPUT_PATH "${LATEX_OUTPUT_PATH}"
-    CACHE PATH "If non empty, specifies the location to place LaTeX output."
-    )
-
-  FIND_PACKAGE(LATEX)
-
-  FIND_PROGRAM(XINDY_COMPILER
-    NAME xindy
-    PATHS ${MIKTEX_BINARY_PATH} /usr/bin
-    )
-
-  FIND_PACKAGE(UnixCommands)
-
-  FIND_PROGRAM(PDFTOPS_CONVERTER
-    NAMES pdftops
-    DOC "The pdf to ps converter program from the Poppler package."
-    )
-
-  MARK_AS_ADVANCED(CLEAR
-    LATEX_COMPILER
-    PDFLATEX_COMPILER
-    BIBTEX_COMPILER
-    MAKEINDEX_COMPILER
-    XINDY_COMPILER
-    DVIPS_CONVERTER
-    PS2PDF_CONVERTER
-    PDFTOPS_CONVERTER
-    LATEX2HTML_CONVERTER
-    )
-
-  LATEX_NEEDIT(LATEX_COMPILER latex)
-  LATEX_WANTIT(PDFLATEX_COMPILER pdflatex)
-  LATEX_NEEDIT(BIBTEX_COMPILER bibtex)
-  LATEX_NEEDIT(MAKEINDEX_COMPILER makeindex)
-  LATEX_WANTIT(DVIPS_CONVERTER dvips)
-  LATEX_WANTIT(PS2PDF_CONVERTER ps2pdf)
-  LATEX_WANTIT(PDFTOPS_CONVERTER pdftops)
-  LATEX_WANTIT(LATEX2HTML_CONVERTER latex2html)
-
-  SET(LATEX_COMPILER_FLAGS "-interaction=nonstopmode"
-    CACHE STRING "Flags passed to latex.")
-  SET(PDFLATEX_COMPILER_FLAGS ${LATEX_COMPILER_FLAGS}
-    CACHE STRING "Flags passed to pdflatex.")
-  SET(LATEX_SYNCTEX_FLAGS "-synctex=1"
-    CACHE STRING "latex/pdflatex flags used to create synctex file.")
-  SET(BIBTEX_COMPILER_FLAGS ""
-    CACHE STRING "Flags passed to bibtex.")
-  SET(MAKEINDEX_COMPILER_FLAGS ""
-    CACHE STRING "Flags passed to makeindex.")
-  SET(MAKEGLOSSARIES_COMPILER_FLAGS ""
-    CACHE STRING "Flags passed to makeglossaries.")
-  SET(MAKENOMENCLATURE_COMPILER_FLAGS ""
-    CACHE STRING "Flags passed to makenomenclature.")
-  SET(DVIPS_CONVERTER_FLAGS "-Ppdf -G0 -t letter"
-    CACHE STRING "Flags passed to dvips.")
-  SET(PS2PDF_CONVERTER_FLAGS "-dMaxSubsetPct=100 -dCompatibilityLevel=1.3 -dSubsetFonts=true -dEmbedAllFonts=true -dAutoFilterColorImages=false -dAutoFilterGrayImages=false -dColorImageFilter=/FlateEncode -dGrayImageFilter=/FlateEncode -dMonoImageFilter=/FlateEncode"
-    CACHE STRING "Flags passed to ps2pdf.")
-  SET(PDFTOPS_CONVERTER_FLAGS -r 600
-    CACHE STRING "Flags passed to pdftops.")
-  SET(LATEX2HTML_CONVERTER_FLAGS ""
-    CACHE STRING "Flags passed to latex2html.")
-  MARK_AS_ADVANCED(
-    LATEX_COMPILER_FLAGS
-    PDFLATEX_COMPILER_FLAGS
-    LATEX_SYNCTEX_FLAGS
-    BIBTEX_COMPILER_FLAGS
-    MAKEINDEX_COMPILER_FLAGS
-    MAKEGLOSSARIES_COMPILER_FLAGS
-    MAKENOMENCLATURE_COMPILER_FLAGS
-    DVIPS_CONVERTER_FLAGS
-    PS2PDF_CONVERTER_FLAGS
-    PDFTOPS_CONVERTER_FLAGS
-    LATEX2HTML_CONVERTER_FLAGS
-    )
-  SEPARATE_ARGUMENTS(LATEX_COMPILER_FLAGS)
-  SEPARATE_ARGUMENTS(PDFLATEX_COMPILER_FLAGS)
-  SEPARATE_ARGUMENTS(LATEX_SYNCTEX_FLAGS)
-  SEPARATE_ARGUMENTS(BIBTEX_COMPILER_FLAGS)
-  SEPARATE_ARGUMENTS(MAKEINDEX_COMPILER_FLAGS)
-  SEPARATE_ARGUMENTS(MAKEGLOSSARIES_COMPILER_FLAGS)
-  SEPARATE_ARGUMENTS(MAKENOMENCLATURE_COMPILER_FLAGS)
-  SEPARATE_ARGUMENTS(DVIPS_CONVERTER_FLAGS)
-  SEPARATE_ARGUMENTS(PS2PDF_CONVERTER_FLAGS)
-  SEPARATE_ARGUMENTS(PDFTOPS_CONVERTER_FLAGS)
-  SEPARATE_ARGUMENTS(LATEX2HTML_CONVERTER_FLAGS)
-
-  FIND_PROGRAM(IMAGEMAGICK_CONVERT convert
-    DOC "The convert program that comes with ImageMagick (available at http://www.imagemagick.org)."
-    )
-  IF (NOT IMAGEMAGICK_CONVERT)
-    MESSAGE(SEND_ERROR "Could not find convert program.  Please download ImageMagick from http://www.imagemagick.org and install.")
-  ENDIF (NOT IMAGEMAGICK_CONVERT)
-
-  OPTION(LATEX_USE_SYNCTEX
-    "If on, have LaTeX generate a synctex file, which WYSIWYG editors can use to correlate output files like dvi and pdf with the lines of LaTeX source that generates them.  In addition to adding the LATEX_SYNCTEX_FLAGS to the command line, this option also adds build commands that \"corrects\" the resulting synctex file to point to the original LaTeX files rather than those generated by UseLATEX.cmake."
-    OFF
-    )
-
-  OPTION(LATEX_SMALL_IMAGES
-    "If on, the raster images will be converted to 1/6 the original size.  This is because papers usually require 600 dpi images whereas most monitors only require at most 96 dpi.  Thus, smaller images make smaller files for web distributation and can make it faster to read dvi files."
-    OFF)
-  IF (LATEX_SMALL_IMAGES)
-    SET(LATEX_RASTER_SCALE 16)
-    SET(LATEX_OPPOSITE_RASTER_SCALE 100)
-  ELSE (LATEX_SMALL_IMAGES)
-    SET(LATEX_RASTER_SCALE 100)
-    SET(LATEX_OPPOSITE_RASTER_SCALE 16)
-  ENDIF (LATEX_SMALL_IMAGES)
-
-  # Just holds extensions for known image types.  They should all be lower case.
-  # For historical reasons, these are all declared in the global scope.
-  SET(LATEX_DVI_VECTOR_IMAGE_EXTENSIONS .eps CACHE INTERNAL "")
-  SET(LATEX_DVI_RASTER_IMAGE_EXTENSIONS CACHE INTERNAL "")
-  SET(LATEX_DVI_IMAGE_EXTENSIONS
-    ${LATEX_DVI_VECTOR_IMAGE_EXTENSIONS} ${LATEX_DVI_RASTER_IMAGE_EXTENSIONS}
-    CACHE INTERNAL "")
-  SET(LATEX_PDF_VECTOR_IMAGE_EXTENSIONS .pdf CACHE INTERNAL "")
-  SET(LATEX_PDF_RASTER_IMAGE_EXTENSIONS .png .jpeg .jpg CACHE INTERNAL "")
-  SET(LATEX_PDF_IMAGE_EXTENSIONS
-    ${LATEX_PDF_VECTOR_IMAGE_EXTENSIONS} ${LATEX_PDF_RASTER_IMAGE_EXTENSIONS}
-    CACHE INTERNAL "")
-  SET(LATEX_IMAGE_EXTENSIONS
-    ${LATEX_DVI_IMAGE_EXTENSIONS} ${LATEX_PDF_IMAGE_EXTENSIONS}
-    CACHE INTERNAL "")
-ENDFUNCTION(LATEX_SETUP_VARIABLES)
-
-FUNCTION(LATEX_GET_OUTPUT_PATH var)
-  SET(latex_output_path)
-  IF (LATEX_OUTPUT_PATH)
-    IF ("${LATEX_OUTPUT_PATH}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
-      MESSAGE(SEND_ERROR "You cannot set LATEX_OUTPUT_PATH to the same directory that contains LaTeX input files.")
-    ELSE ("${LATEX_OUTPUT_PATH}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
-      SET(latex_output_path "${LATEX_OUTPUT_PATH}")
-    ENDIF ("${LATEX_OUTPUT_PATH}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
-  ELSE (LATEX_OUTPUT_PATH)
-    IF ("${CMAKE_CURRENT_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
-      MESSAGE(SEND_ERROR "LaTeX files must be built out of source or you must set LATEX_OUTPUT_PATH.")
-    ELSE ("${CMAKE_CURRENT_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
-      SET(latex_output_path "${CMAKE_CURRENT_BINARY_DIR}")
-    ENDIF ("${CMAKE_CURRENT_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
-  ENDIF (LATEX_OUTPUT_PATH)
-  SET(${var} ${latex_output_path} PARENT_SCOPE)
-ENDFUNCTION(LATEX_GET_OUTPUT_PATH)
-
-FUNCTION(LATEX_ADD_CONVERT_COMMAND
-    output_path
-    input_path
-    output_extension
-    input_extension
-    flags
-    )
-  SET (converter ${IMAGEMAGICK_CONVERT})
-  SET (convert_flags "")
-  IF (${input_extension} STREQUAL ".eps" AND ${output_extension} STREQUAL ".pdf")
-    # ImageMagick has broken eps to pdf conversion
-    # use ps2pdf instead
-    IF (PS2PDF_CONVERTER)
-      SET (converter ${PS2PDF_CONVERTER})
-      SET (convert_flags -dEPSCrop ${PS2PDF_CONVERTER_FLAGS})
-    ELSE (PS2PDF_CONVERTER)
-      MESSAGE(SEND_ERROR "Using postscript files with pdflatex requires ps2pdf for conversion.")
-    ENDIF (PS2PDF_CONVERTER)
-  ELSEIF (${input_extension} STREQUAL ".pdf" AND ${output_extension} STREQUAL ".eps")
-    # ImageMagick can also be sketchy on pdf to eps conversion.  Not good with
-    # color spaces and tends to unnecessarily rasterize.
-    # use pdftops instead
-    IF (PDFTOPS_CONVERTER)
-      SET(converter ${PDFTOPS_CONVERTER})
-      SET(convert_flags -eps ${PDFTOPS_CONVERTER_FLAGS})
-    ELSE (PDFTOPS_CONVERTER)
-      MESSAGE(STATUS "Consider getting pdftops from Poppler to convert PDF images to EPS images.")
-      SET (convert_flags ${flags})
-    ENDIF (PDFTOPS_CONVERTER)
-  ELSE (${input_extension} STREQUAL ".eps" AND ${output_extension} STREQUAL ".pdf")
-    SET (convert_flags ${flags})
-  ENDIF (${input_extension} STREQUAL ".eps" AND ${output_extension} STREQUAL ".pdf")
-
-  ADD_CUSTOM_COMMAND(OUTPUT ${output_path}
-    COMMAND ${converter}
-      ARGS ${convert_flags} ${input_path} ${output_path}
-    DEPENDS ${input_path}
-    )
-ENDFUNCTION(LATEX_ADD_CONVERT_COMMAND)
-
-# Makes custom commands to convert a file to a particular type.
-FUNCTION(LATEX_CONVERT_IMAGE
-    output_files_var
-    input_file
-    output_extension
-    convert_flags
-    output_extensions
-    other_files
-    )
-  SET(output_file_list)
-  SET(input_dir ${CMAKE_CURRENT_SOURCE_DIR})
-  LATEX_GET_OUTPUT_PATH(output_dir)
-
-  LATEX_GET_FILENAME_COMPONENT(extension "${input_file}" EXT)
-
-  # Check input filename for potential problems with LaTeX.
-  LATEX_GET_FILENAME_COMPONENT(name "${input_file}" NAME_WE)
-  IF (name MATCHES ".*\\..*")
-    STRING(REPLACE "." "-" suggested_name "${name}")
-    SET(suggested_name "${suggested_name}${extension}")
-    MESSAGE(WARNING "Some LaTeX distributions have problems with image file names with multiple extensions.  Consider changing ${name}${extension} to something like ${suggested_name}.")
-  ENDIF (name MATCHES ".*\\..*")
-
-  STRING(REGEX REPLACE "\\.[^.]*\$" ${output_extension} output_file
-    "${input_file}")
-
-  LATEX_LIST_CONTAINS(is_type ${extension} ${output_extensions})
-  IF (is_type)
-    IF (convert_flags)
-      LATEX_ADD_CONVERT_COMMAND(${output_dir}/${output_file}
-        ${input_dir}/${input_file} ${output_extension} ${extension}
-        "${convert_flags}")
-      SET(output_file_list ${output_file_list} ${output_dir}/${output_file})
-    ELSE (convert_flags)
-      # As a shortcut, we can just copy the file.
-      ADD_CUSTOM_COMMAND(OUTPUT ${output_dir}/${input_file}
-        COMMAND ${CMAKE_COMMAND}
-        ARGS -E copy ${input_dir}/${input_file} ${output_dir}/${input_file}
-        DEPENDS ${input_dir}/${input_file}
-        )
-      SET(output_file_list ${output_file_list} ${output_dir}/${input_file})
-    ENDIF (convert_flags)
-  ELSE (is_type)
-    SET(do_convert TRUE)
-    # Check to see if there is another input file of the appropriate type.
-    FOREACH(valid_extension ${output_extensions})
-      STRING(REGEX REPLACE "\\.[^.]*\$" ${output_extension} try_file
-        "${input_file}")
-      LATEX_LIST_CONTAINS(has_native_file "${try_file}" ${other_files})
-      IF (has_native_file)
-        SET(do_convert FALSE)
-      ENDIF (has_native_file)
-    ENDFOREACH(valid_extension)
-
-    # If we still need to convert, do it.
-    IF (do_convert)
-      LATEX_ADD_CONVERT_COMMAND(${output_dir}/${output_file}
-        ${input_dir}/${input_file} ${output_extension} ${extension}
-        "${convert_flags}")
-      SET(output_file_list ${output_file_list} ${output_dir}/${output_file})
-    ENDIF (do_convert)
-  ENDIF (is_type)
-
-  SET(${output_files_var} ${output_file_list} PARENT_SCOPE)
-ENDFUNCTION(LATEX_CONVERT_IMAGE)
-
-# Adds custom commands to process the given files for dvi and pdf builds.
-# Adds the output files to the given variables (does not replace).
-FUNCTION(LATEX_PROCESS_IMAGES dvi_outputs_var pdf_outputs_var)
-  LATEX_GET_OUTPUT_PATH(output_dir)
-  SET(dvi_outputs)
-  SET(pdf_outputs)
-  FOREACH(file ${ARGN})
-    IF (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${file}")
-      LATEX_GET_FILENAME_COMPONENT(extension "${file}" EXT)
-      SET(convert_flags)
-
-      # Check to see if we need to downsample the image.
-      LATEX_LIST_CONTAINS(is_raster "${extension}"
-        ${LATEX_DVI_RASTER_IMAGE_EXTENSIONS}
-        ${LATEX_PDF_RASTER_IMAGE_EXTENSIONS})
-      IF (LATEX_SMALL_IMAGES)
-        IF (is_raster)
-          SET(convert_flags -resize ${LATEX_RASTER_SCALE}%)
-        ENDIF (is_raster)
-      ENDIF (LATEX_SMALL_IMAGES)
-
-      # Make sure the output directory exists.
-      LATEX_GET_FILENAME_COMPONENT(path "${output_dir}/${file}" PATH)
-      MAKE_DIRECTORY("${path}")
-
-      # Do conversions for dvi.
-      LATEX_CONVERT_IMAGE(output_files "${file}" .eps "${convert_flags}"
-        "${LATEX_DVI_IMAGE_EXTENSIONS}" "${ARGN}")
-      SET(dvi_outputs ${dvi_outputs} ${output_files})
-
-      # Do conversions for pdf.
-      IF (is_raster)
-        LATEX_CONVERT_IMAGE(output_files "${file}" .png "${convert_flags}"
-          "${LATEX_PDF_IMAGE_EXTENSIONS}" "${ARGN}")
-        SET(pdf_outputs ${pdf_outputs} ${output_files})
-      ELSE (is_raster)
-        LATEX_CONVERT_IMAGE(output_files "${file}" .pdf "${convert_flags}"
-          "${LATEX_PDF_IMAGE_EXTENSIONS}" "${ARGN}")
-        SET(pdf_outputs ${pdf_outputs} ${output_files})
-      ENDIF (is_raster)
-    ELSE (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${file}")
-      MESSAGE(WARNING "Could not find file ${CMAKE_CURRENT_SOURCE_DIR}/${file}.  Are you sure you gave relative paths to IMAGES?")
-    ENDIF (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${file}")
-  ENDFOREACH(file)
-
-  SET(${dvi_outputs_var} ${dvi_outputs} PARENT_SCOPE)
-  SET(${pdf_outputs_var} ${pdf_outputs} PARENT_SCOPE)
-ENDFUNCTION(LATEX_PROCESS_IMAGES)
-
-FUNCTION(ADD_LATEX_IMAGES)
-  MESSAGE(SEND_ERROR "The ADD_LATEX_IMAGES function is deprecated.  Image directories are specified with LATEX_ADD_DOCUMENT.")
-ENDFUNCTION(ADD_LATEX_IMAGES)
-
-FUNCTION(LATEX_COPY_GLOBBED_FILES pattern dest)
-  FILE(GLOB file_list ${pattern})
-  FOREACH(in_file ${file_list})
-    LATEX_GET_FILENAME_COMPONENT(out_file ${in_file} NAME)
-    CONFIGURE_FILE(${in_file} ${dest}/${out_file} COPYONLY)
-  ENDFOREACH(in_file)
-ENDFUNCTION(LATEX_COPY_GLOBBED_FILES)
-
-FUNCTION(LATEX_COPY_INPUT_FILE file)
-  LATEX_GET_OUTPUT_PATH(output_dir)
-
-  IF (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file})
-    LATEX_GET_FILENAME_COMPONENT(path ${file} PATH)
-    FILE(MAKE_DIRECTORY ${output_dir}/${path})
-
-    LATEX_LIST_CONTAINS(use_config ${file} ${LATEX_CONFIGURE})
-    IF (use_config)
-      CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file}
-        ${output_dir}/${file}
-        @ONLY
-        )
-      ADD_CUSTOM_COMMAND(OUTPUT ${output_dir}/${file}
-        COMMAND ${CMAKE_COMMAND}
-        ARGS ${CMAKE_BINARY_DIR}
-        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file}
-        )
-    ELSE (use_config)
-      ADD_CUSTOM_COMMAND(OUTPUT ${output_dir}/${file}
-        COMMAND ${CMAKE_COMMAND}
-        ARGS -E copy ${CMAKE_CURRENT_SOURCE_DIR}/${file} ${output_dir}/${file}
-        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file}
-        )
-    ENDIF (use_config)
-  ELSE (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file})
-    IF (EXISTS ${output_dir}/${file})
-      # Special case: output exists but input does not.  Assume that it was
-      # created elsewhere and skip the input file copy.
-    ELSE (EXISTS ${output_dir}/${file})
-      MESSAGE("Could not find input file ${CMAKE_CURRENT_SOURCE_DIR}/${file}")
-    ENDIF (EXISTS ${output_dir}/${file})
-  ENDIF (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file})
-ENDFUNCTION(LATEX_COPY_INPUT_FILE)
-
-#############################################################################
-# Commands provided by the UseLATEX.cmake "package"
-#############################################################################
-
-FUNCTION(LATEX_USAGE command message)
-  MESSAGE(SEND_ERROR
-    "${message}\nUsage: ${command}(<tex_file>\n           [BIBFILES <bib_file> <bib_file> ...]\n           [INPUTS <tex_file> <tex_file> ...]\n           [IMAGE_DIRS <directory1> <directory2> ...]\n           [IMAGES <image_file1> <image_file2>\n           [CONFIGURE <tex_file> <tex_file> ...]\n           [DEPENDS <tex_file> <tex_file> ...]\n           [MULTIBIB_NEWCITES] <suffix_list>\n           [USE_INDEX] [USE_GLOSSARY] [USE_NOMENCL]\n           [DEFAULT_PDF] [DEFAULT_SAFEPDF]\n           [MANGLE_TARGET_NAMES])"
-    )
-ENDFUNCTION(LATEX_USAGE command message)
-
-# Parses arguments to ADD_LATEX_DOCUMENT and ADD_LATEX_TARGETS and sets the
-# variables LATEX_TARGET, LATEX_IMAGE_DIR, LATEX_BIBFILES, LATEX_DEPENDS, and
-# LATEX_INPUTS.
-FUNCTION(PARSE_ADD_LATEX_ARGUMENTS command)
-  LATEX_PARSE_ARGUMENTS(
-    LATEX
-    "BIBFILES;MULTIBIB_NEWCITES;INPUTS;IMAGE_DIRS;IMAGES;CONFIGURE;DEPENDS"
-    "USE_INDEX;USE_GLOSSARY;USE_GLOSSARIES;USE_NOMENCL;DEFAULT_PDF;DEFAULT_SAFEPDF;MANGLE_TARGET_NAMES"
-    ${ARGN}
-    )
-
-  # The first argument is the target latex file.
-  IF (LATEX_DEFAULT_ARGS)
-    LIST(GET LATEX_DEFAULT_ARGS 0 latex_main_input)
-    LIST(REMOVE_AT LATEX_DEFAULT_ARGS 0)
-    LATEX_GET_FILENAME_COMPONENT(latex_target ${latex_main_input} NAME_WE)
-    SET(LATEX_MAIN_INPUT ${latex_main_input} CACHE INTERNAL "" FORCE)
-    SET(LATEX_TARGET ${latex_target} CACHE INTERNAL "" FORCE)
-  ELSE (LATEX_DEFAULT_ARGS)
-    LATEX_USAGE(${command} "No tex file target given to ${command}.")
-  ENDIF (LATEX_DEFAULT_ARGS)
-
-  IF (LATEX_DEFAULT_ARGS)
-    LATEX_USAGE(${command} "Invalid or depricated arguments: ${LATEX_DEFAULT_ARGS}")
-  ENDIF (LATEX_DEFAULT_ARGS)
-
-  # Backward compatibility between 1.6.0 and 1.6.1.
-  IF (LATEX_USE_GLOSSARIES)
-    SET(LATEX_USE_GLOSSARY TRUE CACHE INTERNAL "" FORCE)
-  ENDIF (LATEX_USE_GLOSSARIES)
-ENDFUNCTION(PARSE_ADD_LATEX_ARGUMENTS)
-
-FUNCTION(ADD_LATEX_TARGETS_INTERNAL)
-  IF (LATEX_USE_SYNCTEX)
-    SET(synctex_flags ${LATEX_SYNCTEX_FLAGS})
-  ELSE (LATEX_USE_SYNCTEX)
-    SET(synctex_flags)
-  ENDIF (LATEX_USE_SYNCTEX)
-
-  # The commands to run LaTeX.  They are repeated multiple times.
-  SET(latex_build_command
-    ${LATEX_COMPILER} ${LATEX_COMPILER_FLAGS} ${synctex_flags} ${LATEX_MAIN_INPUT}
-    )
-  SET(pdflatex_build_command
-    ${PDFLATEX_COMPILER} ${PDFLATEX_COMPILER_FLAGS} ${synctex_flags} ${LATEX_MAIN_INPUT}
-    )
-
-  # Set up target names.
-  IF (LATEX_MANGLE_TARGET_NAMES)
-    SET(dvi_target      ${LATEX_TARGET}_dvi)
-    SET(pdf_target      ${LATEX_TARGET}_pdf)
-    SET(ps_target       ${LATEX_TARGET}_ps)
-    SET(safepdf_target  ${LATEX_TARGET}_safepdf)
-    SET(html_target     ${LATEX_TARGET}_html)
-    SET(auxclean_target ${LATEX_TARGET}_auxclean)
-  ELSE (LATEX_MANGLE_TARGET_NAMES)
-    SET(dvi_target      dvi)
-    SET(pdf_target      pdf)
-    SET(ps_target       ps)
-    SET(safepdf_target  safepdf)
-    SET(html_target     html)
-    SET(auxclean_target auxclean)
-  ENDIF (LATEX_MANGLE_TARGET_NAMES)
-
-  # Probably not all of these will be generated, but they could be.
-  # Note that the aux file is added later.
-  SET(auxiliary_clean_files
-    ${output_dir}/${LATEX_TARGET}.bbl
-    ${output_dir}/${LATEX_TARGET}.blg
-    ${output_dir}/${LATEX_TARGET}-blx.bib
-    ${output_dir}/${LATEX_TARGET}.glg
-    ${output_dir}/${LATEX_TARGET}.glo
-    ${output_dir}/${LATEX_TARGET}.gls
-    ${output_dir}/${LATEX_TARGET}.idx
-    ${output_dir}/${LATEX_TARGET}.ilg
-    ${output_dir}/${LATEX_TARGET}.ind
-    ${output_dir}/${LATEX_TARGET}.ist
-    ${output_dir}/${LATEX_TARGET}.log
-    ${output_dir}/${LATEX_TARGET}.out
-    ${output_dir}/${LATEX_TARGET}.toc
-    ${output_dir}/${LATEX_TARGET}.lof
-    ${output_dir}/${LATEX_TARGET}.xdy
-    ${output_dir}/${LATEX_TARGET}.synctex.gz
-    ${output_dir}/${LATEX_TARGET}.synctex.bak.gz
-    ${output_dir}/${LATEX_TARGET}.dvi
-    ${output_dir}/${LATEX_TARGET}.ps
-    ${output_dir}/${LATEX_TARGET}.pdf
-    )
-
-  SET(image_list ${LATEX_IMAGES})
-
-  # For each directory in LATEX_IMAGE_DIRS, glob all the image files and
-  # place them in LATEX_IMAGES.
-  FOREACH(dir ${LATEX_IMAGE_DIRS})
-    IF (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${dir})
-      MESSAGE(WARNING "Image directory ${CMAKE_CURRENT_SOURCE_DIR}/${dir} does not exist.  Are you sure you gave relative directories to IMAGE_DIRS?")
-    ENDIF (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${dir})
-    FOREACH(extension ${LATEX_IMAGE_EXTENSIONS})
-      FILE(GLOB files ${CMAKE_CURRENT_SOURCE_DIR}/${dir}/*${extension})
-      FOREACH(file ${files})
-        LATEX_GET_FILENAME_COMPONENT(filename ${file} NAME)
-        SET(image_list ${image_list} ${dir}/${filename})
-      ENDFOREACH(file)
-    ENDFOREACH(extension)
-  ENDFOREACH(dir)
-
-  LATEX_PROCESS_IMAGES(dvi_images pdf_images ${image_list})
-
-  SET(make_dvi_command
-    ${CMAKE_COMMAND} -E chdir ${output_dir}
-    ${latex_build_command})
-  SET(make_pdf_command
-    ${CMAKE_COMMAND} -E chdir ${output_dir}
-    ${pdflatex_build_command}
-    )
-
-  SET(make_dvi_depends ${LATEX_DEPENDS} ${dvi_images})
-  SET(make_pdf_depends ${LATEX_DEPENDS} ${pdf_images})
-  FOREACH(input ${LATEX_MAIN_INPUT} ${LATEX_INPUTS})
-    SET(make_dvi_depends ${make_dvi_depends} ${output_dir}/${input})
-    SET(make_pdf_depends ${make_pdf_depends} ${output_dir}/${input})
-    IF (${input} MATCHES "\\.tex$")
-      STRING(REGEX REPLACE "\\.tex$" "" input_we ${input})
-      SET(auxiliary_clean_files ${auxiliary_clean_files}
-        ${output_dir}/${input_we}.aux
-        ${output_dir}/${input}.aux
-        )
-    ENDIF (${input} MATCHES "\\.tex$")
-  ENDFOREACH(input)
-
-  IF (LATEX_USE_GLOSSARY)
-    FOREACH(dummy 0 1)   # Repeat these commands twice.
-      SET(make_dvi_command ${make_dvi_command}
-        COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
-        ${CMAKE_COMMAND}
-        -D LATEX_BUILD_COMMAND=makeglossaries
-        -D LATEX_TARGET=${LATEX_TARGET}
-        -D MAKEINDEX_COMPILER=${MAKEINDEX_COMPILER}
-        -D XINDY_COMPILER=${XINDY_COMPILER}
-        -D MAKEGLOSSARIES_COMPILER_FLAGS=${MAKEGLOSSARIES_COMPILER_FLAGS}
-        -P ${LATEX_USE_LATEX_LOCATION}
-        COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
-        ${latex_build_command}
-        )
-      SET(make_pdf_command ${make_pdf_command}
-        COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
-        ${CMAKE_COMMAND}
-        -D LATEX_BUILD_COMMAND=makeglossaries
-        -D LATEX_TARGET=${LATEX_TARGET}
-        -D MAKEINDEX_COMPILER=${MAKEINDEX_COMPILER}
-        -D XINDY_COMPILER=${XINDY_COMPILER}
-        -D MAKEGLOSSARIES_COMPILER_FLAGS=${MAKEGLOSSARIES_COMPILER_FLAGS}
-        -P ${LATEX_USE_LATEX_LOCATION}
-        COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
-        ${pdflatex_build_command}
-        )
-    ENDFOREACH(dummy)
-  ENDIF (LATEX_USE_GLOSSARY)
-
-  IF (LATEX_USE_NOMENCL)
-    FOREACH(dummy 0 1)   # Repeat these commands twice.
-      SET(make_dvi_command ${make_dvi_command}
-        COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
-        ${CMAKE_COMMAND}
-        -D LATEX_BUILD_COMMAND=makenomenclature
-        -D LATEX_TARGET=${LATEX_TARGET}
-        -D MAKEINDEX_COMPILER=${MAKEINDEX_COMPILER}
-        -D MAKENOMENCLATURE_COMPILER_FLAGS=${MAKENOMENCLATURE_COMPILER_FLAGS}
-        -P ${LATEX_USE_LATEX_LOCATION}
-        COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
-        ${latex_build_command}
-        )
-      SET(make_pdf_command ${make_pdf_command}
-        COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
-        ${CMAKE_COMMAND}
-        -D LATEX_BUILD_COMMAND=makenomenclature
-        -D LATEX_TARGET=${LATEX_TARGET}
-        -D MAKEINDEX_COMPILER=${MAKEINDEX_COMPILER}
-        -D MAKENOMENCLATURE_COMPILER_FLAGS=${MAKENOMENCLATURE_COMPILER_FLAGS}
-        -P ${LATEX_USE_LATEX_LOCATION}
-        COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
-        ${pdflatex_build_command}
-        )
-    ENDFOREACH(dummy)
-  ENDIF (LATEX_USE_NOMENCL)
-
-  IF (LATEX_BIBFILES)
-    IF (LATEX_MULTIBIB_NEWCITES)
-      FOREACH (multibib_auxfile ${LATEX_MULTIBIB_NEWCITES})
-        LATEX_GET_FILENAME_COMPONENT(multibib_target ${multibib_auxfile} NAME_WE)
-        SET(make_dvi_command ${make_dvi_command}
-          COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
-          ${BIBTEX_COMPILER} ${BIBTEX_COMPILER_FLAGS} ${multibib_target})
-        SET(make_pdf_command ${make_pdf_command}
-          COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
-          ${BIBTEX_COMPILER} ${BIBTEX_COMPILER_FLAGS} ${multibib_target})
-        SET(auxiliary_clean_files ${auxiliary_clean_files}
-          ${output_dir}/${multibib_target}.aux)
-      ENDFOREACH (multibib_auxfile ${LATEX_MULTIBIB_NEWCITES})
-    ELSE (LATEX_MULTIBIB_NEWCITES)
-      SET(make_dvi_command ${make_dvi_command}
-        COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
-        ${BIBTEX_COMPILER} ${BIBTEX_COMPILER_FLAGS} ${LATEX_TARGET})
-      SET(make_pdf_command ${make_pdf_command}
-        COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
-        ${BIBTEX_COMPILER} ${BIBTEX_COMPILER_FLAGS} ${LATEX_TARGET})
-    ENDIF (LATEX_MULTIBIB_NEWCITES)
-
-    FOREACH (bibfile ${LATEX_BIBFILES})
-      SET(make_dvi_depends ${make_dvi_depends} ${output_dir}/${bibfile})
-      SET(make_pdf_depends ${make_pdf_depends} ${output_dir}/${bibfile})
-    ENDFOREACH (bibfile ${LATEX_BIBFILES})
-  ELSE (LATEX_BIBFILES)
-    IF (LATEX_MULTIBIB_NEWCITES)
-      MESSAGE(WARNING "MULTIBIB_NEWCITES has no effect without BIBFILES option.")
-    ENDIF (LATEX_MULTIBIB_NEWCITES)
-  ENDIF (LATEX_BIBFILES)
-
-  IF (LATEX_USE_INDEX)
-    SET(make_dvi_command ${make_dvi_command}
-      COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
-      ${latex_build_command}
-      COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
-      ${MAKEINDEX_COMPILER} ${MAKEINDEX_COMPILER_FLAGS} ${LATEX_TARGET}.idx)
-    SET(make_pdf_command ${make_pdf_command}
-      COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
-      ${pdflatex_build_command}
-      COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
-      ${MAKEINDEX_COMPILER} ${MAKEINDEX_COMPILER_FLAGS} ${LATEX_TARGET}.idx)
-  ENDIF (LATEX_USE_INDEX)
-
-  SET(make_dvi_command ${make_dvi_command}
-    COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
-    ${latex_build_command}
-    COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
-    ${latex_build_command})
-  SET(make_pdf_command ${make_pdf_command}
-    COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
-    ${pdflatex_build_command}
-    COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
-    ${pdflatex_build_command})
-
-  IF (LATEX_USE_SYNCTEX)
-    IF (NOT GZIP)
-      MESSAGE(SEND_ERROR "UseLATEX.cmake: USE_SYNTEX option requires gzip program.  Set GZIP variable.")
-    ENDIF (NOT GZIP)
-    SET(make_dvi_command ${make_dvi_command}
-      COMMAND ${CMAKE_COMMAND}
-      -D LATEX_BUILD_COMMAND=correct_synctex
-      -D LATEX_TARGET=${LATEX_TARGET}
-      -D GZIP=${GZIP}
-      -D "LATEX_SOURCE_DIRECTORY=${CMAKE_CURRENT_SOURCE_DIR}"
-      -D "LATEX_BINARY_DIRECTORY=${output_dir}"
-      -P ${LATEX_USE_LATEX_LOCATION}
-      )
-    SET(make_pdf_command ${make_pdf_command}
-      COMMAND ${CMAKE_COMMAND}
-      -D LATEX_BUILD_COMMAND=correct_synctex
-      -D LATEX_TARGET=${LATEX_TARGET}
-      -D GZIP=${GZIP}
-      -D "LATEX_SOURCE_DIRECTORY=${CMAKE_CURRENT_SOURCE_DIR}"
-      -D "LATEX_BINARY_DIRECTORY=${output_dir}"
-      -P ${LATEX_USE_LATEX_LOCATION}
-      )
-  ENDIF (LATEX_USE_SYNCTEX)
-
-  # Add commands and targets for building dvi outputs.
-  ADD_CUSTOM_COMMAND(OUTPUT ${output_dir}/${LATEX_TARGET}.dvi
-    COMMAND ${make_dvi_command}
-    DEPENDS ${make_dvi_depends}
-    )
-  IF (LATEX_DEFAULT_PDF OR LATEX_DEFAULT_SAFEPDF)
-    ADD_CUSTOM_TARGET(${dvi_target}
-      DEPENDS ${output_dir}/${LATEX_TARGET}.dvi)
-  ELSE (LATEX_DEFAULT_PDF OR LATEX_DEFAULT_SAFEPDF)
-    ADD_CUSTOM_TARGET(${dvi_target} ALL
-      DEPENDS ${output_dir}/${LATEX_TARGET}.dvi)
-  ENDIF (LATEX_DEFAULT_PDF OR LATEX_DEFAULT_SAFEPDF)
-
-  # Add commands and targets for building pdf outputs (with pdflatex).
-  IF (PDFLATEX_COMPILER)
-    ADD_CUSTOM_COMMAND(OUTPUT ${output_dir}/${LATEX_TARGET}.pdf
-      COMMAND ${make_pdf_command}
-      DEPENDS ${make_pdf_depends}
-      )
-    IF (LATEX_DEFAULT_PDF)
-      ADD_CUSTOM_TARGET(${pdf_target} ALL
-        DEPENDS ${output_dir}/${LATEX_TARGET}.pdf)
-    ELSE (LATEX_DEFAULT_PDF)
-      ADD_CUSTOM_TARGET(${pdf_target}
-        DEPENDS ${output_dir}/${LATEX_TARGET}.pdf)
-    ENDIF (LATEX_DEFAULT_PDF)
-  ENDIF (PDFLATEX_COMPILER)
-
-  IF (DVIPS_CONVERTER)
-    ADD_CUSTOM_COMMAND(OUTPUT ${output_dir}/${LATEX_TARGET}.ps
-      COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
-        ${DVIPS_CONVERTER} ${DVIPS_CONVERTER_FLAGS} -o ${LATEX_TARGET}.ps ${LATEX_TARGET}.dvi
-      DEPENDS ${output_dir}/${LATEX_TARGET}.dvi)
-    ADD_CUSTOM_TARGET(${ps_target}
-      DEPENDS ${output_dir}/${LATEX_TARGET}.ps)
-    IF (PS2PDF_CONVERTER)
-      # Since both the pdf and safepdf targets have the same output, we
-      # cannot properly do the dependencies for both.  When selecting safepdf,
-      # simply force a recompile every time.
-      IF (LATEX_DEFAULT_SAFEPDF)
-        ADD_CUSTOM_TARGET(${safepdf_target} ALL
-          ${CMAKE_COMMAND} -E chdir ${output_dir}
-          ${PS2PDF_CONVERTER} ${PS2PDF_CONVERTER_FLAGS} ${LATEX_TARGET}.ps ${LATEX_TARGET}.pdf
-          )
-      ELSE (LATEX_DEFAULT_SAFEPDF)
-        ADD_CUSTOM_TARGET(${safepdf_target}
-          ${CMAKE_COMMAND} -E chdir ${output_dir}
-          ${PS2PDF_CONVERTER} ${PS2PDF_CONVERTER_FLAGS} ${LATEX_TARGET}.ps ${LATEX_TARGET}.pdf
-          )
-      ENDIF (LATEX_DEFAULT_SAFEPDF)
-      ADD_DEPENDENCIES(${safepdf_target} ${ps_target})
-    ENDIF (PS2PDF_CONVERTER)
-  ENDIF (DVIPS_CONVERTER)
-
-  IF (LATEX2HTML_CONVERTER)
-    ADD_CUSTOM_TARGET(${html_target}
-      ${CMAKE_COMMAND} -E chdir ${output_dir}
-      ${LATEX2HTML_CONVERTER} ${LATEX2HTML_CONVERTER_FLAGS} ${LATEX_MAIN_INPUT}
-      )
-    ADD_DEPENDENCIES(${html_target} ${LATEX_MAIN_INPUT} ${LATEX_INPUTS})
-  ENDIF (LATEX2HTML_CONVERTER)
-
-  SET_DIRECTORY_PROPERTIES(.
-    ADDITIONAL_MAKE_CLEAN_FILES "${auxiliary_clean_files}"
-    )
-
-  ADD_CUSTOM_TARGET(${auxclean_target}
-    COMMENT "Cleaning auxiliary LaTeX files."
-    COMMAND ${CMAKE_COMMAND} -E remove ${auxiliary_clean_files}
-    )
-ENDFUNCTION(ADD_LATEX_TARGETS_INTERNAL)
-
-FUNCTION(ADD_LATEX_TARGETS)
-  LATEX_GET_OUTPUT_PATH(output_dir)
-  PARSE_ADD_LATEX_ARGUMENTS(ADD_LATEX_TARGETS ${ARGV})
-
-  ADD_LATEX_TARGETS_INTERNAL()
-ENDFUNCTION(ADD_LATEX_TARGETS)
-
-FUNCTION(ADD_LATEX_DOCUMENT)
-  LATEX_GET_OUTPUT_PATH(output_dir)
-  IF (output_dir)
-    PARSE_ADD_LATEX_ARGUMENTS(ADD_LATEX_DOCUMENT ${ARGV})
-
-    LATEX_COPY_INPUT_FILE(${LATEX_MAIN_INPUT})
-
-    FOREACH (bib_file ${LATEX_BIBFILES})
-      LATEX_COPY_INPUT_FILE(${bib_file})
-    ENDFOREACH (bib_file)
-
-    FOREACH (input ${LATEX_INPUTS})
-      LATEX_COPY_INPUT_FILE(${input})
-    ENDFOREACH(input)
-
-    LATEX_COPY_GLOBBED_FILES(${CMAKE_CURRENT_SOURCE_DIR}/*.cls ${output_dir})
-    LATEX_COPY_GLOBBED_FILES(${CMAKE_CURRENT_SOURCE_DIR}/*.bst ${output_dir})
-    LATEX_COPY_GLOBBED_FILES(${CMAKE_CURRENT_SOURCE_DIR}/*.clo ${output_dir})
-    LATEX_COPY_GLOBBED_FILES(${CMAKE_CURRENT_SOURCE_DIR}/*.sty ${output_dir})
-    LATEX_COPY_GLOBBED_FILES(${CMAKE_CURRENT_SOURCE_DIR}/*.ist ${output_dir})
-
-    ADD_LATEX_TARGETS_INTERNAL()
-  ENDIF (output_dir)
-ENDFUNCTION(ADD_LATEX_DOCUMENT)
-
-#############################################################################
-# Actually do stuff
-#############################################################################
-
-IF (LATEX_BUILD_COMMAND)
-  SET(command_handled)
-
-  IF ("${LATEX_BUILD_COMMAND}" STREQUAL makeglossaries)
-    LATEX_MAKEGLOSSARIES()
-    SET(command_handled TRUE)
-  ENDIF ("${LATEX_BUILD_COMMAND}" STREQUAL makeglossaries)
-
-  IF ("${LATEX_BUILD_COMMAND}" STREQUAL makenomenclature)
-    LATEX_MAKENOMENCLATURE()
-    SET(command_handled TRUE)
-  ENDIF ("${LATEX_BUILD_COMMAND}" STREQUAL makenomenclature)
-
-  IF ("${LATEX_BUILD_COMMAND}" STREQUAL correct_synctex)
-    LATEX_CORRECT_SYNCTEX()
-    SET(command_handled TRUE)
-  ENDIF ("${LATEX_BUILD_COMMAND}" STREQUAL correct_synctex)
-
-  IF (NOT command_handled)
-    MESSAGE(SEND_ERROR "Unknown command: ${LATEX_BUILD_COMMAND}")
-  ENDIF (NOT command_handled)
-
-ELSE (LATEX_BUILD_COMMAND)
-  # Must be part of the actual configure (included from CMakeLists.txt).
-  LATEX_SETUP_VARIABLES()
-ENDIF (LATEX_BUILD_COMMAND)


Fixing typo in CMake configuration template which would prevent usage of MPI_Allreduce + memcpy for implementing MPI_Reduce_scatter_block

--- cmake/config.h.cmake
+++ cmake/config.h.cmake
@@ -49,7 +49,7 @@
 #cmakedefine HAVE_MPI_IN_PLACE
 #cmakedefine HAVE_MPI3_NONBLOCKING_COLLECTIVES
 #cmakedefine HAVE_MPIX_NONBLOCKING_COLLECTIVES
-#cmakedefine REDUCE_SCATTER_BLOCK_VIA_ALL_REDUCE
+#cmakedefine REDUCE_SCATTER_BLOCK_VIA_ALLREDUCE
 #cmakedefine USE_BYTE_ALLGATHERS

 /* Advanced configuration options */


add brackets

add brackets

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

--- cmake/gsConfig.cmake
+++ cmake/gsConfig.cmake
@@ -15,9 +15,9 @@
 #find_package(Metis REQUIRED)

 #Remove NDEBUG from RelWithDebInfo builds
-string(REPLACE "-DNDEBUG" "" replacementFlags ${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
+string(REPLACE "-DNDEBUG" "" replacementFlags "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
 set(CMAKE_CXX_FLAGS_RELWITHDEBINFO ${replacementFlags} CACHE INTERNAL "" FORCE)
-string(REPLACE "-DNDEBUG" "" replacementFlags ${CMAKE_C_FLAGS_RELWITHDEBINFO})
+string(REPLACE "-DNDEBUG" "" replacementFlags "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
 set(CMAKE_C_FLAGS_RELWITHDEBINFO ${replacementFlags} CACHE INTERNAL "" FORCE)

 if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")


CMake 2.6.2 fix

CMake 2.6.2 fix

--- cmake/readline.cmake
+++ cmake/readline.cmake
@@ -197,12 +197,16 @@
     # Handle mutual exclusion of WITH_READLINE/WITH_LIBEDIT variables
     # We save current setting to recognize when user switched between
     # WITH_READLINE and WITH_LIBEDIT
-    IF(WITH_READLINE AND (SAVE_READLINE_SETTING MATCHES "WITH_LIBEDIT"
-      OR NOT SAVE_READLINE_SETTING))
-      SET(WITH_LIBEDIT OFF CACHE BOOL "Use bundled libedit" FORCE)
-    ELSEIF(WITH_LIBEDIT AND (SAVE_READLINE_SETTING MATCHES "WITH_READLINE"
-      OR NOT SAVE_READLINE_SETTING))
-      SET(WITH_READLINE OFF CACHE BOOL "Use bundled readline" FORCE)
+    IF(WITH_READLINE)
+      IF(NOT SAVE_READLINE_SETTING OR SAVE_READLINE_SETTING MATCHES
+         "WITH_LIBEDIT")
+        SET(WITH_LIBEDIT OFF CACHE BOOL "Use bundled libedit" FORCE)
+      ENDIF()
+    ELSEIF(WITH_LIBEDIT)
+      IF(NOT SAVE_READLINE_SETTING OR SAVE_READLINE_SETTING MATCHES
+         "WITH_READLINE")
+        SET(WITH_READLINE OFF CACHE BOOL "Use bundled readline" FORCE)
+      ENDIF()
     ENDIF()

     IF(WITH_READLINE)


REFACT: Correct GIT_TAG for DiapOTB

REFACT: Correct GIT_TAG for DiapOTB

--- Modules/Remote/diapotb.remote.cmake
+++ Modules/Remote/diapotb.remote.cmake
@@ -22,5 +22,5 @@
 otb_fetch_module(DiapOTBModule
   "OTB module for SAR processing in Diapason."
   GIT_REPOSITORY https://gitlab.orfeo-toolbox.org/remote_modules/diapotb.git
-  GIT_TAG 8f6b3a9d1efc1ee99e619d5c408f72a2dfe31753
+  GIT_TAG 69bc3588a51b9a52291e415f0822dadd8a8951fc
 )


cmake: Using PROJECT_SOURCE_DIR instead of AliRoot_SOURCE_DIR

The 2 variables are equivalent but AliRoot_SOURCE_DIR is not portable

--- cmake/GetGitRevisionDescription.cmake
+++ cmake/GetGitRevisionDescription.cmake
@@ -110,7 +110,7 @@
 		${hash}
 		${ARGN}
 		WORKING_DIRECTORY
-		"${AliRoot_SOURCE_DIR}"
+		"${PROJECT_SOURCE_DIR}"
 		RESULT_VARIABLE
 		res
 		OUTPUT_VARIABLE


[CMake] [OS X] Don't require command line tools installations for running compiler-rt tests.

If you're on an Apple platform and /usr/include doesn't exist, we should set a sysroot flag when calling clang.

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

--- cmake/Modules/CompilerRTCompile.cmake
+++ cmake/Modules/CompilerRTCompile.cmake
@@ -24,6 +24,19 @@
   set(${out_flags} "${clang_flags}" PARENT_SCOPE)
 endfunction()

+if (APPLE)
+  # On Darwin if /usr/include doesn't exist, the user probably has Xcode but not
+  # the command line tools. If this is the case, we need to find the OS X
+  # sysroot to pass to clang.
+  if(NOT EXISTS /usr/include)
+    execute_process(COMMAND xcodebuild -version -sdk macosx Path
+       OUTPUT_VARIABLE OSX_SYSROOT
+       ERROR_QUIET
+       OUTPUT_STRIP_TRAILING_WHITESPACE)
+    set(OSX_SYSROOT_FLAG "-isysroot ${OSX_SYSROOT}")
+  endif()
+endif()
+
 # Compile a source into an object file with COMPILER_RT_TEST_COMPILER using
 # a provided compile flags and dependenices.
 # clang_compile(<object> <source>
@@ -49,6 +62,10 @@
     translate_msvc_cflags(global_flags "${global_flags}")
   endif()

+  if (APPLE)
+    set(global_flags ${OSX_SYSROOT_FLAG} ${global_flags})
+  endif()
+
   # Ignore unknown warnings. CMAKE_CXX_FLAGS may contain GCC-specific options
   # which are not supported by Clang.
   list(APPEND global_flags -Wno-unknown-warning-option)
@@ -72,7 +89,7 @@
 macro(clang_compiler_add_cxx_check)
   if (APPLE)
     set(CMD
-      "echo '#include <iostream>' | ${COMPILER_RT_TEST_COMPILER} -E -x c++ - > /dev/null"
+      "echo '#include <iostream>' | ${COMPILER_RT_TEST_COMPILER} ${OSX_SYSROOT_FLAG} -E -x c++ - > /dev/null"
       "if [ $? != 0 ] "
       "  then echo"
       "  echo 'Your just-built clang cannot find C++ headers, which are needed to build and run compiler-rt tests.'"


Reverting r256836; it causes a build bot failure: http://lab.llvm.org:8011/builders/lldb-x86-win7-msvc/builds/14050/steps/build/logs/stdio

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

--- cmake/modules/HandleLLVMOptions.cmake
+++ cmake/modules/HandleLLVMOptions.cmake
@@ -363,17 +363,6 @@

   append("/Zc:inline" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)

-  # Disable string literal const->non-const type conversion
-  # "When specified, the compiler requires strict const-qualification
-  # conformance for pointers initialized by using string literals."
-  append("/Zc:strictStrings" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
-
-  # Generate Intrinsic Functions
-  append("/Oi" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
-
-  # Enforce type conversion rules
-  append("/Zc:rvalueCast" CMAKE_CXX_FLAGS)
-
   # Disable sized deallocation if the flag is supported. MSVC fails to compile
   # the operator new overload in User otherwise.
   check_c_compiler_flag("/WX /Zc:sizedDealloc-" SUPPORTS_SIZED_DEALLOC)


reorder cmake commands: make `hunter_download(PACK_NAME nanoflann)` last

--- cmake/projects/nanoflann/hunter.cmake
+++ cmake/projects/nanoflann/hunter.cmake
@@ -21,13 +21,13 @@
     72a42a31056aab380eac09b9f00dab18e91235b8
     )

-hunter_pick_scheme(DEFAULT url_sha1_cmake)
-hunter_cacheable(nanoflann)
-hunter_download(PACKAGE_NAME nanoflann)
-
 hunter_cmake_args(
   nanoflann
   CMAKE_ARGS
   NANOFLANN_BUILD_EXAMPLES=OFF
   NANOFLANN_BUILD_TESTS=OFF
-  )
+  )
+
+hunter_pick_scheme(DEFAULT url_sha1_cmake)
+hunter_cacheable(nanoflann)
+hunter_download(PACKAGE_NAME nanoflann)


[t:4871] fixing warning options

[t:4871] fixing warning options

git-svn-id: b5c078ec0b4d3a50497e9dd3081db18a5b4f16e5@43489 c7de825b-a66e-492c-adef-691d508d4ae1

--- cmake_modules/TokuSetupCompiler.cmake
+++ cmake_modules/TokuSetupCompiler.cmake
@@ -58,7 +58,6 @@

 include(CheckCCompilerFlag)

-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror")
 ## adds a compiler flag if the compiler supports it
 macro(set_cflags_if_supported)
   foreach(flag ${ARGN})
@@ -115,13 +114,11 @@
   set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -debug all")

   ## set icc warnings
-  set(WARN_CFLAGS
-    -Wcheck  ## icc version of -Wextra
-    )
+  set(CMAKE_C_FLAGS "-Wcheck ${CMAKE_C_FLAGS}")
 else()
   ## set gcc warnings
+  set(CMAKE_C_FLAGS "-Wextra ${CMAKE_C_FLAGS}")
   set(WARN_CFLAGS
-    -Wextra
     -Wcast-align
     -Wbad-function-cast
     -Wno-missing-noreturn
@@ -135,6 +132,8 @@
 endif()

 set_cflags_if_supported(${WARN_CFLAGS})
+## always want these
+set(CMAKE_C_FLAGS "-Wall -Werror ${CMAKE_C_FLAGS}")

 ## function for adding -fvisibility=hidden to targets
 function(set_targets_visibility_hidden)


ManageDependency: Fix the comments

ManageDependency: Fix the comments

--- Modules/ManageDependency.cmake
+++ Modules/ManageDependency.cmake
@@ -51,7 +51,7 @@
 IF(DEFINED _MANAGE_DEPENDENCY_CMAKE_)
     RETURN()
 ENDIF(DEFINED _MANAGE_DEPENDENCY_CMAKE_)
-SET (_MANAGE_DEPENDENCY_CMAKE_ "DEFINED")
+SET(_MANAGE_DEPENDENCY_CMAKE_ "DEFINED")
 INCLUDE(ManageFile)
 INCLUDE(ManageVariable)


CMake: Engine has no business being a module, remove that.

--- CMake/Modules/UrhoOptions.cmake
+++ CMake/Modules/UrhoOptions.cmake
@@ -59,11 +59,7 @@
 option(URHO3D_ENABLE_ALL "Enables all optional subsystems by default" OFF)

 # Determine library type
-string(TOUPPER "${BUILD_SHARED_LIBS}" BUILD_SHARED_LIBS)
-if ("${BUILD_SHARED_LIBS}" STREQUAL "MODULE")
-    set (BUILD_SHARED_LIBS OFF)
-    set (URHO3D_LIBRARY_TYPE MODULE)
-elseif (BUILD_SHARED_LIBS)
+if (BUILD_SHARED_LIBS)
     set (URHO3D_LIBRARY_TYPE SHARED)
 else ()
     set (URHO3D_LIBRARY_TYPE STATIC)


added python 3.8 to python.cmake

added python 3.8 to python.cmake

--- indra/cmake/Python.cmake
+++ indra/cmake/Python.cmake
@@ -9,11 +9,13 @@
     NAMES python25.exe python23.exe python.exe
     NO_DEFAULT_PATH # added so that cmake does not find cygwin python
     PATHS
+    [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.8\\InstallPath]
     [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.7\\InstallPath]
     [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.6\\InstallPath]
     [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath]
     [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]
     [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]
+    [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\2.8\\InstallPath]
     [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\2.7\\InstallPath]
     [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\2.6\\InstallPath]
     [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath]


fixup disable backward-cpp for emscripten


Not using extended initializer list, so don't check for it.

--- cmake/Modules/FindCXX11.cmake
+++ cmake/Modules/FindCXX11.cmake
@@ -26,7 +26,6 @@
 {
 public:
     Matrix(int a, int b, int c, int d)
-        : data {a, b, c, d}
     {}

 private:
@@ -35,7 +34,7 @@

 int main()
 {
-    int n[] {4,7,6,1,2};
+    int n[] = [4,7,6,1,2];
     for (auto i : n)
         Matrix mat (3,5,1,2);
     return 0;


Update FindMySQL.cmake

Update FindMySQL.cmake

--- cmake/Modules/FindMySQL.cmake
+++ cmake/Modules/FindMySQL.cmake
@@ -19,15 +19,10 @@
     PATHS "$ENV{ProgramFiles}/MySQL/*/lib"
             "$ENV{ProgramW6432}/MySQL/*/lib"
             "$ENV{SystemDrive}/MySQL/*/lib"
-            "/lib/mysql"
-            "/lib64/mysql"
+            "/usr/lib"
             "/usr/lib/mysql"
-            "/usr/lib64/mysql"
-            "/usr/local/lib/mysql"
-            "/usr/local/lib64/mysql"
-            "/usr/mysql/lib/mysql"
-            "/usr/mysql/lib64/mysql")
-
+            "/usr/local/lib"
+            "/usr/mysql/lib/mysql")

 if (MYSQL_LIBRARY)
     if (MYSQL_INCLUDE_DIR)


[cmake] Fix the list of arm32 architectures

This was accidentally changed in SVN r311924, which was only
supposed to change the behaviour for x86.

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

--- cmake/builtin-config-ix.cmake
+++ cmake/builtin-config-ix.cmake
@@ -25,7 +25,6 @@

 set(ARM64 aarch64)
 set(ARM32 arm armhf armv6m armv7m armv7em armv7 armv7s armv7k)
-set(ARM32 arm armhf)
 set(X86 i386)
 set(X86_64 x86_64)
 set(MIPS32 mips mipsel)


[cmake] if no docstrings files, skip docstring generation.

Condition triggered when headers are removed from externals
installation.  When DOCSTRINGS_FILES is empty, it issues an
argument-less cat command which hangs waiting for input.

--- cmake/swig_python_tools.cmake
+++ cmake/swig_python_tools.cmake
@@ -38,25 +38,26 @@
       endforeach()
     endforeach()

-    # If this variable is empty, cat will hang, so error out instead.
-    if (NOT DOCSTRINGS_FILES)
-      message(FATAL_ERROR "DOCSTRINGS_FILES=${DOCSTRINGS_FILES}")
+    if (DOCSTRINGS_FILES)
+      add_custom_command(OUTPUT ${SICONOS_SWIG_ROOT_DIR}/${COMP}-docstrings.i
+        DEPENDS ${DOCSTRINGS_FILES}
+        COMMAND cat
+        ARGS ${DOCSTRINGS_FILES} > ${SICONOS_SWIG_ROOT_DIR}/${COMP}-docstrings.i
+        COMMENT "${COMP} docstrings concatenation")
+    else()
+      add_custom_command(OUTPUT ${SICONOS_SWIG_ROOT_DIR}/${COMP}-docstrings.i
+        DEPENDS ${DOCSTRINGS_FILES}
+        COMMAND touch
+        ARGS ${SICONOS_SWIG_ROOT_DIR}/${COMP}-docstrings.i)
     endif()
-
-    add_custom_command(OUTPUT ${SICONOS_SWIG_ROOT_DIR}/${COMP}-docstrings.i
-      DEPENDS ${DOCSTRINGS_FILES}
-      COMMAND cat
-      ARGS ${DOCSTRINGS_FILES} > ${SICONOS_SWIG_ROOT_DIR}/${COMP}-docstrings.i
-      COMMENT "${COMP} docstrings concatenation")
-    add_custom_target(${COMP}_docstrings DEPENDS ${SICONOS_SWIG_ROOT_DIR}/${COMP}-docstrings.i)
   else()
     add_custom_command(OUTPUT ${SICONOS_SWIG_ROOT_DIR}/${COMP}-docstrings.i
       DEPENDS ${DOCSTRINGS_FILES}
-      COMMAND printf \"\" > ${COMP}-docstrings.i
+      COMMAND touch
+      ARGS ${SICONOS_SWIG_ROOT_DIR}/${COMP}-docstrings.i
       )
-
-    add_custom_target(${COMP}_docstrings DEPENDS ${SICONOS_SWIG_ROOT_DIR}/${COMP}-docstrings.i)
   endif()
+  add_custom_target(${COMP}_docstrings DEPENDS ${SICONOS_SWIG_ROOT_DIR}/${COMP}-docstrings.i)
 endmacro()

 # ----------------------------------------------------------------------


started itk python installer

started itk python installer

--- CMake/mitkMacroInstallPython.cmake
+++ CMake/mitkMacroInstallPython.cmake
@@ -89,6 +89,30 @@

 endfunction()

+function(MITK_INSTALL_ITK_PYTHON )
+  find_package(ITK REQUIRED)
+
+  set(_build_type "Release")
+
+  if(CMAKE_BUILD_TYPE STREQUAL "Debug")
+    set(_build_type "Debug")
+  endif()
+
+  file(GLOB _libs RELATIVE "${ITK_DIR}/lib" "${ITK_DIR}/lib/_ITK*" )
+  file(GLOB _py_files RELATIVE "${ITK_DIR}/lib" "${ITK_DIR}/lib/*.py" )
+
+  install(FILES ${_py_files} DESTINATION bin)
+
+  #set(_libs "blabla")
+
+  foreach(_l ${_libs})
+
+    MESSAGE("${ITK_DIR}/lib/${_l}")
+    MITK_FUNCTION_INSTALL_PYTHON_MODULE("${ITK_DIR}/lib/${_l}" "${_build_type}")
+
+  endforeach()
+endfunction()
+
 function(MITK_INSTALL_CV_PYTHON)
   find_package(OpenCV REQUIRED)

@@ -102,10 +126,12 @@
 endfunction()

 macro(MITK_INSTALL_PYTHON)
-  MITK_INSTALL_VTK_PYTHON()

-  if(MITK_USE_OpenCV)
-    MITK_INSTALL_CV_PYTHON()
-  endif()
+  MITK_INSTALL_ITK_PYTHON()
+  #MITK_INSTALL_VTK_PYTHON()
+
+  #if(MITK_USE_OpenCV)
+  #  MITK_INSTALL_CV_PYTHON()
+  #endif()
 endmacro(MITK_INSTALL_PYTHON)


agents now build if cycpp changes

agents now build if cycpp changes

--- CMake/UseCyclus.cmake
+++ CMake/UseCyclus.cmake
@@ -102,6 +102,7 @@
       COMMAND ${CYCPP} ${CCIN} ${PREPROCESSOR} ${CCFLAG} ${ORIG} ${INCL_ARGS}
       DEPENDS ${HIN}
       DEPENDS ${CCIN}
+      DEPENDS ${CYCPP}
       COMMENT "Executing ${CYCPP} ${HIN} ${PREPROCESSOR} ${HFLAG} ${ORIG} ${INCL_ARGS}"
       COMMENT "Executing ${CYCPP} ${CCIN} ${PREPROCESSOR} ${CCFLAG} ${ORIG} ${INCL_ARGS}"
       )
@@ -110,6 +111,7 @@
       OUTPUT ${CCOUT}
       COMMAND ${CYCPP} ${CCIN} ${PREPROCESSOR} ${CCFLAG} ${ORIG} ${INCL_ARGS}
       DEPENDS ${CCIN}
+      DEPENDS ${CYCPP}
       COMMENT "Executing ${CYCPP} ${CCIN} ${PREPROCESSOR} ${CCFLAG} ${ORIG} ${INCL_ARGS}"
       )
   ENDIF(EXISTS "${HIN}")


fix clang-tidy search

fix clang-tidy search

--- cmake/utils.cmake
+++ cmake/utils.cmake
@@ -129,6 +129,9 @@
 # create clang-tidy-based target for static analysis
 function(setup_clang_tidy)
         set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
+
+        find_program(CLANG_TIDY_BIN clang-tidy-5.0)
+        find_program(RUN_CLANG_TIDY_BIN run-clang-tidy-5.0.py)

         list(APPEND RUN_CLANG_TIDY_BIN_ARGS
             -clang-tidy-binary ${CLANG_TIDY_BIN}


iox-#1345 Set default minimal log level to TRACE

--- iceoryx_hoofs/cmake/IceoryxHoofsDeployment.cmake
+++ iceoryx_hoofs/cmake/IceoryxHoofsDeployment.cmake
@@ -17,7 +17,7 @@
 message(STATUS "[i] <<<<<<<<<<<<< Start iceoryx_hoofs configuration: >>>>>>>>>>>>>")

 if(NOT IOX_MINIMAL_LOG_LEVEL)
-    set(IOX_MINIMAL_LOG_LEVEL "FATAL")
+    set(IOX_MINIMAL_LOG_LEVEL "TRACE")
 endif()
 message(STATUS "[i] IOX_MINIMAL_LOG_LEVEL: " ${IOX_MINIMAL_LOG_LEVEL})


cmake: Fixed a typo.

cmake: Fixed a typo.

--- ConfigureChecks.cmake
+++ ConfigureChecks.cmake
@@ -43,7 +43,8 @@
 # HEADER FILES
 check_include_file(argp.h HAVE_ARGP_H)
 check_include_file(pty.h HAVE_PTY_H)
-check_include_file(terminos.h HAVE_TERMIOS_H)
+check_include_file(termios.h HAVE_TERMIOS_H)
+
 if (WIN32)
   check_include_file(wspiapi.h HAVE_WSPIAPI_H)
   if (NOT HAVE_WSPIAPI_H)


Fix execution of cppcheck as test

Fix execution of cppcheck as test

--- CppcheckTargets.cmake
+++ CppcheckTargets.cmake
@@ -40,101 +40,6 @@
 if(NOT TARGET cppcheck)
   add_custom_target(cppcheck)
 endif()
-
-function(add_cppcheck_sources _targetname)
-  if(CPPCHECK_FOUND)
-    set(_cppcheck_args -I ${CMAKE_SOURCE_DIR}
-      --error-exitcode=2 --inline-suppr
-      --suppress=unmatchedSuppression --suppress=preprocessorErrorDirective
-      ${CPPCHECK_EXTRA_ARGS})
-    set(_input ${ARGN})
-    list(FIND _input UNUSED_FUNCTIONS _unused_func)
-    if("${_unused_func}" GREATER "-1")
-      list(APPEND _cppcheck_args ${CPPCHECK_UNUSEDFUNC_ARG})
-      list(REMOVE_AT _input ${_unused_func})
-    endif()
-
-    list(FIND _input STYLE _style)
-    if("${_style}" GREATER "-1")
-      list(APPEND _cppcheck_args ${CPPCHECK_STYLE_ARG})
-      list(REMOVE_AT _input ${_style})
-    endif()
-
-    list(FIND _input POSSIBLE_ERROR _poss_err)
-    if("${_poss_err}" GREATER "-1")
-      list(APPEND _cppcheck_args ${CPPCHECK_POSSIBLEERROR_ARG})
-      list(REMOVE_AT _input ${_poss_err})
-    endif()
-
-    list(FIND _input FAIL_ON_WARNINGS _fail_on_warn)
-    if("${_fail_on_warn}" GREATER "-1")
-      list(APPEND
-        CPPCHECK_FAIL_REGULAR_EXPRESSION
-        ${CPPCHECK_WARN_REGULAR_EXPRESSION})
-      list(REMOVE_AT _input ${_fail_on_warn})
-    endif()
-
-    set(_files)
-    foreach(_source ${_input})
-      get_source_file_property(_cppcheck_loc "${_source}" LOCATION)
-      if(_cppcheck_loc)
-        # This file has a source file property, carry on.
-        get_source_file_property(_cppcheck_lang "${_source}" LANGUAGE)
-        if("${_cppcheck_lang}" MATCHES "CXX")
-          list(APPEND _files "${_cppcheck_loc}")
-        endif()
-      else()
-        # This file doesn't have source file properties - figure it out.
-        get_filename_component(_cppcheck_loc "${_source}" ABSOLUTE)
-        if(EXISTS "${_cppcheck_loc}")
-          list(APPEND _files "${_cppcheck_loc}")
-        else()
-          message(FATAL_ERROR
-            "Adding CPPCHECK for file target ${_targetname}: "
-            "File ${_source} does not exist or needs a corrected path location "
-            "since we think its absolute path is ${_cppcheck_loc}")
-        endif()
-      endif()
-    endforeach()
-
-    if("1.${CMAKE_VERSION}" VERSION_LESS "1.2.8.0")
-      # Older than CMake 2.8.0
-      add_test(${_targetname}_cppcheck_test
-        "${CPPCHECK_EXECUTABLE}"
-        ${CPPCHECK_TEMPLATE_ARG}
-        ${_cppcheck_args}
-        ${_files})
-    else()
-      # CMake 2.8.0 and newer
-      add_test(NAME
-        ${_targetname}_cppcheck_test
-        COMMAND
-        "${CPPCHECK_EXECUTABLE}"
-        ${CPPCHECK_TEMPLATE_ARG}
-        ${_cppcheck_args}
-        ${_files})
-    endif()
-
-    set_tests_properties(${_targetname}_cppcheck_test
-      PROPERTIES
-      FAIL_REGULAR_EXPRESSION
-      "${CPPCHECK_FAIL_REGULAR_EXPRESSION}")
-
-    add_custom_target(${_targetname}_cppcheck
-      COMMAND
-      ${CPPCHECK_EXECUTABLE}
-      ${CPPCHECK_QUIET_ARG}
-      ${CPPCHECK_TEMPLATE_ARG}
-      ${_cppcheck_args}
-      ${_files}
-      WORKING_DIRECTORY
-      "${CMAKE_CURRENT_SOURCE_DIR}"
-      COMMENT
-      "${_targetname}_cppcheck: Running cppcheck on target ${_targetname}..."
-      VERBATIM)
-    add_dependencies(cppcheck ${_targetname}_cppcheck)
-  endif()
-endfunction()

 function(add_cppcheck _name)
   if(NOT TARGET ${_name})
@@ -189,7 +94,8 @@

     add_test(NAME ${_name}_cppcheck_test
       COMMAND "${CPPCHECK_EXECUTABLE}" ${CPPCHECK_TEMPLATE_ARG}
-      ${_cppcheck_args} ${_files})
+      ${_cppcheck_args} ${_files}
+      WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")

     set_tests_properties(${_name}_cppcheck_test
       PROPERTIES
@@ -203,10 +109,8 @@
       ${CPPCHECK_TEMPLATE_ARG}
       ${_cppcheck_args}
       ${_files}
-      WORKING_DIRECTORY
-      "${CMAKE_CURRENT_SOURCE_DIR}"
-      COMMENT
-      "${_name}_cppcheck: Running cppcheck on target ${_name}..."
+      WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+      COMMENT "${_name}_cppcheck: Running cppcheck on target ${_name}..."
       VERBATIM)
     add_dependencies(cppcheck ${_name}_cppcheck)
   endif()


Revert accidental checkin

Revert accidental checkin

--- build_settings.cmake
+++ build_settings.cmake
@@ -53,14 +53,11 @@
 endif()

 # Find ccache and use it if it is found
-find_program(CCACHE_EXECUTABLE time)
+find_program(CCACHE_EXECUTABLE ccache)
 if(CCACHE_EXECUTABLE)
     set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE_EXECUTABLE})
     set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE_EXECUTABLE})
 endif()
-
-set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE /usr/bin/time)
-set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK /usr/bin/time)

 # Check for valgrind and set flags
 find_program(VALGRIND_EXECUTABLE valgrind)


fix the new OSX stack check option

fix the new OSX stack check option

--- cmake-toolchains/osx.cmake
+++ cmake-toolchains/osx.cmake
@@ -40,11 +40,11 @@
 # that are not backward compatible to older macOS versions
 option(FIPS_OSX_USE_STACK_CHECKING "Enable/disable stack checking" OFF)
 if (FIPS_OSX_USE_STACK_CHECKING)
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-check")
+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-check")
+else()
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-stack-check")
     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-stack-check")
-else()
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-check")
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-check")
 endif()

 # ARC on/off?


Fix typo: 'DOWNLAOD' to 'DOWNLOAD'

Fix typo: 'DOWNLAOD' to 'DOWNLOAD'

--- cmake/OpenCVDownload.cmake
+++ cmake/OpenCVDownload.cmake
@@ -23,7 +23,7 @@
 set(OPENCV_DOWNLOAD_WITH_CURL "${OpenCV_BINARY_DIR}/download_with_curl.sh")
 set(OPENCV_DOWNLOAD_WITH_WGET "${OpenCV_BINARY_DIR}/download_with_wget.sh")
 set(OPENCV_DOWNLOAD_TRIES_LIST 1 CACHE STRING "List of download tries") # a list
-set(OPENCV_DOWNLOAD_PARAMS INACTIVITY_TIMEOUT 60 TIMEOUT 600 CACHE STRING "Download parameters to be passed to file(DOWNLAOD ...)")
+set(OPENCV_DOWNLOAD_PARAMS INACTIVITY_TIMEOUT 60 TIMEOUT 600 CACHE STRING "Download parameters to be passed to file(DOWNLOAD ...)")
 mark_as_advanced(OPENCV_DOWNLOAD_TRIES_LIST OPENCV_DOWNLOAD_PARAMS)

 # Init download cache directory and log file and helper scripts


Host zlib-1.2.11 in our own S3 bucket (for Android builds)

Hosting zlib ourselves to pro-actively avoid build failures due to
potential unavailability of zlib's hosting/website.

--- cmake/build_external.cmake
+++ cmake/build_external.cmake
@@ -25,7 +25,7 @@
         #likely, some of the things here are unnecessary
         ExternalProject_Add(ZLIB
             SOURCE_DIR ${ZLIB_SOURCE_DIR}
-            URL http://zlib.net/zlib-1.2.11.tar.gz
+            URL https://s3.amazonaws.com/aws-sdk-cpp-builds-sdks-team/zlib/zlib-1.2.11.tar.gz
             URL_HASH "SHA256=c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1"
             PATCH_COMMAND ""
             CMAKE_ARGS


changes needed when Ogre debug (OgreMain{Static}_d is only available) v0-8

--- cmake/FindOgre.cmake
+++ cmake/FindOgre.cmake
@@ -147,6 +147,10 @@
 find_library(OGRE_LIB_DBG NAMES ${OGRE_LIBRARY_NAMES}_d
              PATHS ${OGRE_PREFIX_PATH}
              PATH_SUFFIXES Debug lib/Debug)
+
+if (NOT OGRE_LIB AND OGRE_LIB_DBG)
+    set(OGRE_LIB OGRE_LIB_DBG)
+endif()

 mark_as_advanced(OGRE_H_PATH OGRE_H_BUILD_SETTINGS_PATH OGRE_LIB OGRE_LIB_DBG)

@@ -212,8 +216,14 @@
             endif ()
         endif ()
         set(OGRE_LIBRARIES ${OGRE_LIBRARIES} ${ZZIP_LIBRARIES} ${ZLIB_LIBRARIES} ${FREEIMAGE_LIBRARIES} ${FREETYPE_LIBRARIES})
+        if (OGRE_LIBRARIES_DBG)
+            set(OGRE_LIBRARIES_DBG ${OGRE_LIBRARIES_DBG} ${ZZIP_LIBRARIES} ${ZLIB_LIBRARIES} ${FREEIMAGE_LIBRARIES} ${FREETYPE_LIBRARIES})
+        endif()
         if (APPLE)
             set(OGRE_LIBRARIES ${OGRE_LIBRARIES} ${X11_LIBRARIES} ${X11_Xt_LIBRARIES} ${XAW_LIBRARY} ${X11_Xrandr_LIB} ${Carbon_LIBRARIES} ${Cocoa_LIBRARIES})
+            if (OGRE_LIBRARIES_DBG)
+                set(OGRE_LIBRARIES_DBG ${OGRE_LIBRARIES_DBG} ${X11_LIBRARIES} ${X11_Xt_LIBRARIES} ${XAW_LIBRARY} ${X11_Xrandr_LIB} ${Carbon_LIBRARIES} ${Cocoa_LIBRARIES})
+            endif()
         endif()
         if (NOT ZLIB_FOUND OR NOT ZZIP_FOUND)
             set(OGRE_DEPS_FOUND FALSE)
@@ -229,6 +239,9 @@
                 set(OGRE_DEPS_FOUND FALSE)
             endif ()
             set(OGRE_LIBRARIES ${OGRE_LIBRARIES} ${X11_LIBRARIES} ${X11_Xt_LIB} ${XAW_LIBRARY} ${X11_Xrandr_LIB} pthread dl)
+            if (OGRE_LIBRARIES_DBG)
+                set(OGRE_LIBRARIES_DBG ${OGRE_LIBRARIES_DBG} ${X11_LIBRARIES} ${X11_Xt_LIB} ${XAW_LIBRARY} ${X11_Xrandr_LIB} pthread dl)
+            endif()
         endif ()
         if (NOT OGRE_DEPS_FOUND)
             message(status "Could not find all required dependencies for the Ogre package.")


CMake: Do not include "${PROJECT_BINARY_DIR}/include" with SYSTEM option

This is important for the include order. Without this patch, a
previously installed caffe.pb.h might be included instead of the one
that is generated during the build.

--- cmake/ProtoBuf.cmake
+++ cmake/ProtoBuf.cmake
@@ -23,7 +23,7 @@

 # place where to generate protobuf sources
 set(proto_gen_folder "${PROJECT_BINARY_DIR}/include/caffe/proto")
-include_directories(SYSTEM "${PROJECT_BINARY_DIR}/include")
+include_directories("${PROJECT_BINARY_DIR}/include")

 set(PROTOBUF_GENERATE_CPP_APPEND_PATH TRUE)


use custom_command to copy files - for automatic updates at make

--- cmake/VcMacros.cmake
+++ cmake/VcMacros.cmake
@@ -447,7 +447,12 @@
          get_filename_component(_out "${_vc_compile_src}" NAME_WE)
          get_filename_component(_ext "${_vc_compile_src}" EXT)
          set(_out "${CMAKE_CURRENT_BINARY_DIR}/${_out}_${_impl}${_ext}")
-         configure_file( ${_vc_compile_src} "${_out}" COPYONLY )
+         add_custom_command(OUTPUT "${_out}"
+            COMMAND ${CMAKE_COMMAND} -E copy "${_vc_compile_src}" "${_out}"
+            MAIN_DEPENDENCY "${_vc_compile_src}"
+            COMMENT "Copy to ${_out}"
+            WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+            VERBATIM)
          set_source_files_properties( "${_out}" PROPERTIES
             COMPILE_DEFINITIONS "VC_IMPL=${_impl}"
             COMPILE_FLAGS "${_flags} ${_extra_flags}"


Bug#17632386: WITH_ASAN CONFLICTS WITH -WL,--NO-UNDEFINED

-Wl,--no-undefined (=-z defs) gives linking errors when used with WITH_ASAN.
According to the documentation:
"When linking shared libraries, the AddressSanitizer run-time is not linked,
so -Wl,-z,defs may cause link errors (don’t use it with AddressSanitizer)."

This patch turns off -Wl,--no-undefined if WITH_ASAN is used.

--- cmake/os/Linux.cmake
+++ cmake/os/Linux.cmake
@@ -1,5 +1,5 @@

-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -33,7 +33,10 @@

 # Ensure we have clean build for shared libraries
 # without unresolved symbols
-SET(LINK_FLAG_NO_UNDEFINED "-Wl,--no-undefined")
+# Not supported with AddressSanitizer
+IF(NOT WITH_ASAN)
+  SET(LINK_FLAG_NO_UNDEFINED "-Wl,--no-undefined")
+ENDIF()

 # 64 bit file offset support flag
 SET(_FILE_OFFSET_BITS 64)


Fixed typo

Fixed typo

--- cmake/packages.cmake
+++ cmake/packages.cmake
@@ -47,7 +47,7 @@
 SET ( CPACK_DEBIAN_PACKAGE_SECTION "Miscellaneous" )

 # .rpm for rpm
-https://cmake.org/cmake/help/v3.5/module/CPackRPM.html
+# https://cmake.org/cmake/help/v3.5/module/CPackRPM.html
 SET ( CPACK_RPM_PACKAGE_RELEASE 1)
 SET ( CPACK_RPM_PACKAGE_LICENSE "MIT")
 SET ( CPACK_RPM_PACKAGE_GROUP "Applications")


Copy built breakpad libs into 3rdparty directory

--- cmake/modules/BuildGoogleBreakpad.cmake
+++ cmake/modules/BuildGoogleBreakpad.cmake
@@ -13,7 +13,7 @@
     GIT_TAG origin/chrome_64
     GIT_SHALLOW true
     INSTALL_DIR ${BREAKPAD_EXCEPTION_HANDLER_INSTALL_DIR}
-    STEP_TARGETS   build
+    STEP_TARGETS build install

     UPDATE_COMMAND ""
     CONFIGURE_COMMAND <SOURCE_DIR>/src/tools/gyp/gyp.bat --no-circular-check <SOURCE_DIR>/src/client/windows/breakpad_client.gyp
@@ -62,6 +62,15 @@
     COMMAND ${CMAKE_SCRIPT_PATH}/robocopy.bat "<SOURCE_DIR>/src/" "<INSTALL_DIR>/include/breakpad" "*.h"
     COMMAND ${CMAKE_SCRIPT_PATH}/robocopy.bat "<SOURCE_DIR>/src/" "<INSTALL_DIR>/include/breakpad" "*.hpp"
   )
+
+  ExternalProject_Add_Step(
+    breakpad
+    install-breakpad
+    DEPENDEES build
+    DEPENDERS install
+    COMMAND ${CMAKE_SCRIPT_PATH}/robocopy.bat "<SOURCE_DIR>/src/" "<INSTALL_DIR>/lib" "*.lib"
+    COMMAND ${CMAKE_SCRIPT_PATH}/robocopy.bat "<SOURCE_DIR>/src/" "<INSTALL_DIR>/bin" "*.dll"
+  )
 else()

   # This is a workaround for Ninja not allowing us to build if these libs weren't built before
@@ -76,7 +85,7 @@
     GIT_TAG origin/chrome_64
     GIT_SHALLOW true
     INSTALL_DIR ${BREAKPAD_EXCEPTION_HANDLER_INSTALL_DIR}
-    STEP_TARGETS   build
+    STEP_TARGETS build install

     UPDATE_COMMAND ""
     CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=${BREAKPAD_EXCEPTION_HANDLER_INSTALL_DIR} --quiet --config-cache
@@ -101,9 +110,9 @@
 if(WIN32 AND NOT MINGW)
   set(BREAKPAD_EXCEPTION_HANDLER_INCLUDE_DIR ${BREAKPAD_EXCEPTION_HANDLER_INSTALL_DIR}/include/breakpad)

-  set(BREAKPAD_COMMON_LIBRARY_DIR "${source_dir}/src/client/windows/$<CONFIG>/lib")
-  set(BREAKPAD_CRASH_CLIENT_LIBRARY_DIR "${source_dir}/src/client/windows/crash_generation/$<CONFIG>/lib")
-  set(BREAKPAD_EXCEPTION_HANDLER_LIBRARY_DIR "${source_dir}/src/client/windows/handler/$<CONFIG>/lib")
+  set(BREAKPAD_COMMON_LIBRARY_DIR "${BREAKPAD_EXCEPTION_HANDLER_LIBRARY_DIR}/breakpad/client/windows/$<CONFIG>/lib")
+  set(BREAKPAD_CRASH_CLIENT_LIBRARY_DIR "${BREAKPAD_EXCEPTION_HANDLER_LIBRARY_DIR}/breakpad/client/windows/crash_generation/$<CONFIG>/lib")
+  set(BREAKPAD_EXCEPTION_HANDLER_LIBRARY_DIR "${BREAKPAD_EXCEPTION_HANDLER_LIBRARY_DIR}/breakpad/client/windows/handler/$<CONFIG>/lib")
   set(BREAKPAD_EXCEPTION_HANDLER_LIBRARIES
     "${BREAKPAD_COMMON_LIBRARY_DIR}/common.lib"
     "${BREAKPAD_EXCEPTION_HANDLER_LIBRARY_DIR}/exception_handler.lib"


Attempt at fixing a cmake issue with cmake <= 3.4

--- cmake/modules/CMakeParseArguments.cmake
+++ cmake/modules/CMakeParseArguments.cmake
@@ -2,44 +2,160 @@
 # CMakeParseArguments
 # -------------------
 #
-# This module once implemented the :command:`cmake_parse_arguments` command
-# that is now implemented natively by CMake.  It is now an empty placeholder
-# for compatibility with projects that include it to get the command from
-# CMake 3.4 and lower.
+#
+#
+# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords>
+# <multi_value_keywords> args...)
+#
+# CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions
+# for parsing the arguments given to that macro or function.  It
+# processes the arguments and defines a set of variables which hold the
+# values of the respective options.
+#
+# The <options> argument contains all options for the respective macro,
+# i.e.  keywords which can be used when calling the macro without any
+# value following, like e.g.  the OPTIONAL keyword of the install()
+# command.
+#
+# The <one_value_keywords> argument contains all keywords for this macro
+# which are followed by one value, like e.g.  DESTINATION keyword of the
+# install() command.
+#
+# The <multi_value_keywords> argument contains all keywords for this
+# macro which can be followed by more than one value, like e.g.  the
+# TARGETS or FILES keywords of the install() command.
+#
+# When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the
+# keywords listed in <options>, <one_value_keywords> and
+# <multi_value_keywords> a variable composed of the given <prefix>
+# followed by "_" and the name of the respective keyword.  These
+# variables will then hold the respective value from the argument list.
+# For the <options> keywords this will be TRUE or FALSE.
+#
+# All remaining arguments are collected in a variable
+# <prefix>_UNPARSED_ARGUMENTS, this can be checked afterwards to see
+# whether your macro was called with unrecognized parameters.
+#
+# As an example here a my_install() macro, which takes similar arguments
+# as the real install() command:
+#
+# ::
+#
+#    function(MY_INSTALL)
+#      set(options OPTIONAL FAST)
+#      set(oneValueArgs DESTINATION RENAME)
+#      set(multiValueArgs TARGETS CONFIGURATIONS)
+#      cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}"
+#                            "${multiValueArgs}" ${ARGN} )
+#      ...
+#
+#
+#
+# Assume my_install() has been called like this:
+#
+# ::
+#
+#    my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub)
+#
+#
+#
+# After the cmake_parse_arguments() call the macro will have set the
+# following variables:
+#
+# ::
+#
+#    MY_INSTALL_OPTIONAL = TRUE
+#    MY_INSTALL_FAST = FALSE (this option was not used when calling my_install()
+#    MY_INSTALL_DESTINATION = "bin"
+#    MY_INSTALL_RENAME = "" (was not used)
+#    MY_INSTALL_TARGETS = "foo;bar"
+#    MY_INSTALL_CONFIGURATIONS = "" (was not used)
+#    MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL"
+#
+#
+#
+# You can then continue and process these variables.
+#
+# Keywords terminate lists of values, e.g.  if directly after a
+# one_value_keyword another recognized keyword follows, this is
+# interpreted as the beginning of the new option.  E.g.
+# my_install(TARGETS foo DESTINATION OPTIONAL) would result in
+# MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION
+# would be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefor.

 #=============================================================================
 # Copyright 2010 Alexander Neundorf <neundorf@kde.org>
 #
-# CMake - Cross Platform Makefile Generator
-# Copyright 2000-2016 Kitware, Inc.
-# Copyright 2000-2011 Insight Software Consortium
-# All rights reserved.
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
 #
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# * Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-#
-# * Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-#
-# * Neither the names of Kitware, Inc., the Insight Software Consortium,
-#   nor the names of their contributors may be used to endorse or promote
-#   products derived from this software without specific prior written
-#   permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
 #=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+#  License text for the above reference.)
+
+
+if(__CMAKE_PARSE_ARGUMENTS_INCLUDED)
+  return()
+endif()
+set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE)
+
+
+function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames)
+  # first set all result variables to empty/FALSE
+  foreach(arg_name ${_singleArgNames} ${_multiArgNames})
+    set(${prefix}_${arg_name})
+  endforeach()
+
+  foreach(option ${_optionNames})
+    set(${prefix}_${option} FALSE)
+  endforeach()
+
+  set(${prefix}_UNPARSED_ARGUMENTS)
+
+  set(insideValues FALSE)
+  set(currentArgName)
+
+  # now iterate over all arguments and fill the result variables
+  foreach(currentArg ${ARGN})
+    list(FIND _optionNames "${currentArg}" optionIndex)  # ... then this marks the end of the arguments belonging to this keyword
+    list(FIND _singleArgNames "${currentArg}" singleArgIndex)  # ... then this marks the end of the arguments belonging to this keyword
+    list(FIND _multiArgNames "${currentArg}" multiArgIndex)  # ... then this marks the end of the arguments belonging to this keyword
+
+    if(${optionIndex} EQUAL -1  AND  ${singleArgIndex} EQUAL -1  AND  ${multiArgIndex} EQUAL -1)
+      if(insideValues)
+        if("${insideValues}" STREQUAL "SINGLE")
+          set(${prefix}_${currentArgName} ${currentArg})
+          set(insideValues FALSE)
+        elseif("${insideValues}" STREQUAL "MULTI")
+          list(APPEND ${prefix}_${currentArgName} ${currentArg})
+        endif()
+      else()
+        list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg})
+      endif()
+    else()
+      if(NOT ${optionIndex} EQUAL -1)
+        set(${prefix}_${currentArg} TRUE)
+        set(insideValues FALSE)
+      elseif(NOT ${singleArgIndex} EQUAL -1)
+        set(currentArgName ${currentArg})
+        set(${prefix}_${currentArgName})
+        set(insideValues "SINGLE")
+      elseif(NOT ${multiArgIndex} EQUAL -1)
+        set(currentArgName ${currentArg})
+        set(${prefix}_${currentArgName})
+        set(insideValues "MULTI")
+      endif()
+    endif()
+
+  endforeach()
+
+  # propagate the result variables to the caller:
+  foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames})
+    set(${prefix}_${arg_name}  ${${prefix}_${arg_name}} PARENT_SCOPE)
+  endforeach()
+  set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE)
+
+endfunction()


PARQUET-821: Fix zlib download

PARQUET-821: Fix zlib download

Author: Uwe L. Korn <uwelk@xhochy.com>

Closes #212 from xhochy/PARQUET-821 and squashes the following commits:

549461f [Uwe L. Korn] PARQUET-821: Fix zlib download

--- cmake_modules/ThirdpartyToolchain.cmake
+++ cmake_modules/ThirdpartyToolchain.cmake
@@ -190,12 +190,12 @@
   if (CMAKE_VERSION VERSION_GREATER "3.2")
     # BUILD_BYPRODUCTS is a 3.2+ feature
     ExternalProject_Add(zlib_ep
-      URL "http://zlib.net/zlib-1.2.8.tar.gz"
+      URL "http://zlib.net/fossils/zlib-1.2.8.tar.gz"
       BUILD_BYPRODUCTS "${ZLIB_STATIC_LIB}"
       CMAKE_ARGS ${ZLIB_CMAKE_ARGS})
   else()
     ExternalProject_Add(zlib_ep
-      URL "http://zlib.net/zlib-1.2.8.tar.gz"
+      URL "http://zlib.net/fossils/zlib-1.2.8.tar.gz"
       CMAKE_ARGS ${ZLIB_CMAKE_ARGS})
   endif()
 else()


Update VTK tag to v.5.10.0 in external project definition

See #189

--- CMakeExternals/VTK.cmake
+++ CMakeExternals/VTK.cmake
@@ -37,7 +37,7 @@

     if(NOT DEFINED VTK_DIR)

-      set(revision_tag f0766a470edcc6b84a779b45ba11feee40ac3bdb)
+      set(revision_tag v5.10.0)
       if(${proj}_REVISION_TAG)
         set(revision_tag ${${proj}_REVISION_TAG})
       endif()


fix copy_bin() for win32 builds

fix copy_bin() for win32 builds

--- CMakeModules/utils.cmake
+++ CMakeModules/utils.cmake
@@ -1,4 +1,4 @@
 macro( copy_bin file )
    add_custom_command( TARGET ${file} POST_BUILD COMMAND mkdir -p ${CMAKE_BINARY_DIR}/bin )
-   add_custom_command( TARGET ${file} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${file} ${CMAKE_BINARY_DIR}/bin/ )
+   add_custom_command( TARGET ${file} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${file}${CMAKE_EXECUTABLE_SUFFIX} ${CMAKE_BINARY_DIR}/bin/ )
 endmacro( copy_bin )


build: Update gamgee version

build: Update gamgee version

--- contrib/gamgee.cmake
+++ contrib/gamgee.cmake
@@ -15,7 +15,7 @@
     PREFIX ${gamgee_PREFIX}
     DEPENDS boost htslib
     GIT_REPOSITORY "https://github.com/broadinstitute/gamgee.git"
-    GIT_TAG "37213c0dd9c43476a0e29b0e688c6cb9d7738a8d"
+    GIT_TAG "a2a79b6688cb64a4b848bf767db22b7b1a217ee6"
     BUILD_IN_SOURCE 1
     CONFIGURE_COMMAND ""
     BUILD_COMMAND ${Boost_B2} -s BOOST_ROOT=${Boost_INSTALL_PREFIX} -s BOOST_BUILD_PATH=${Boost_PREFIX} ${GAMGEE_TOOLCHAIN_FLAGS} variant=${GAMGEE_BUILD_TYPE}