avoid clashes between <libavutil/time.h> and <time.h>

--- cmake/FindFFMPEG.cmake
+++ cmake/FindFFMPEG.cmake
@@ -2,20 +2,22 @@
 # Once done this will define
 #
 #  FFMPEG_FOUND		 - system has FFMPEG
-#  FFMPEG_INCLUDE_DIR	 - the include directories
-#  FFMPEG_LIBRARY_DIR	 - the directory containing the libraries
+#  FFMPEG_SWSCALE_FOUND	 - FFMPEG also has SWSCALE
+#  FFMPEG_INCLUDE_DIRS	 - the include directories
 #  FFMPEG_LIBRARIES	 - link these to use FFMPEG
-#  FFMPEG_SWSCALE_FOUND	 - FFMPEG also has SWSCALE
 #

-SET( FFMPEG_HEADERS avformat.h avcodec.h avutil.h )
-SET( FFMPEG_PATH_SUFFIXES libavformat libavcodec libavutil )
-SET( FFMPEG_SWS_HEADERS swscale.h )
-SET( FFMPEG_SWS_PATH_SUFFIXES libswscale )
+SET( FFMPEG_HEADERS libavformat/avformat.h libavcodec/avcodec.h libavutil/avutil.h )
+SET( FFMPEG_SWSCALE_HEADERS libswscale/swscale.h )
+SET( FFMPEG_PATH_SUFFIX ffmpeg )
+SET( FFMPEG_AVFORMAT_INCLUDE_DIR_TEST TRUE)

+#MESSAGE('FFMPEGDIR')
+#MESSAGE(${FFMPEGDIR})
+#MESSAGE(${FFMPEG_INCLUDE_DIRS})
 if( WIN32 )
-   SET( FFMPEG_LIBRARY_DIR $ENV{FFMPEGDIR}\\lib $ENV{EXTERNLIBS}\\ffmpeg\\lib )
-   SET( FFMPEG_INCLUDE_PATHS $ENV{FFMPEGDIR}\\include $ENV{EXTERNLIBS}\\ffmpeg\\include)
+   SET( FFMPEG_LIBRARY_DIRS $ENV{FFMPEGDIR}\\lib $ENV{EXTERNLIBS}\\ffmpeg\\lib )
+   SET( FFMPEG_INCLUDE_DIRS $ENV{FFMPEGDIR}\\include $ENV{EXTERNLIBS}\\ffmpeg\\include)

   FIND_LIBRARY(FFMPEG_SWSCALE_LIBRARY NAMES swscale-0 swscale
   HINTS
@@ -58,7 +60,7 @@
     DOC "FFMPEG AVUTIL - Library"
   )

-  FIND_LIBRARY(FFMPEG_CODEC_LIBRARY NAMES avcodec-52 avcodec-51 avcodec
+  FIND_LIBRARY(FFMPEG_AVCODEC_LIBRARY NAMES avcodec-52 avcodec-51 avcodec
   HINTS
      $ENV{FFMPEGDIR}
   PATH_SUFFIXES lib64 lib
@@ -71,91 +73,90 @@
     /usr/freeware
     DOC "FFMPEG AVCODEC - Library"
   )
-   SET( FFMPEG_SWS_LIBRARIES ${FFMPEG_SWSCALE_LIBRARY} )
-   SET( FFMPEG_LIBRARIES ${FFMPEG_AVFORMAT_LIBRARY} ${FFMPEG_CODEC_LIBRARY} ${FFMPEG_AVUTIL_LIBRARY} )
-   # check to see if we can find swscale

-   IF ( FFMPEG_SWSCALE_LIBRARY )
-      SET( SWSCALE_FOUND TRUE )
-   ENDIF( FFMPEG_SWSCALE_LIBRARY )
+   FIND_PATH(FFMPEG_AVFORMAT_INCLUDE_DIR
+      NAMES libavformat/avformat.h
+      HINTS $ENV{FFMPEGDIR}\\include $ENV{EXTERNLIBS}\\ffmpeg\\include
+      PATH_SUFFIXES ${FFMPEG_PATH_SUFFIX})
+   IF (FFMPEG_AVFORMAT_INCLUDE_DIR_TEST)
+		ADD_DEFINITIONS("-DHAVE_FFMPEG_SEPARATE_INCLUDES")
+   ENDIF (FFMPEG_AVFORMAT_INCLUDE_DIR_TEST)
+
+   FIND_PATH(FFMPEG_AVCODEC_INCLUDE_DIR
+      NAMES libavcodec/avcodec.h
+      HINTS $ENV{FFMPEGDIR}\\include $ENV{EXTERNLIBS}\\ffmpeg\\include
+      PATH_SUFFIXES ${FFMPEG_PATH_SUFFIX})
+
+   FIND_PATH(FFMPEG_AVUTIL_INCLUDE_DIR
+      NAMES libavutil/avutil.h
+      HINTS $ENV{FFMPEGDIR}\\include $ENV{EXTERNLIBS}\\ffmpeg\\include
+      PATH_SUFFIXES ${FFMPEG_PATH_SUFFIX})
+
+   FIND_PATH(FFMPEG_SWSCALE_INCLUDE_DIR
+      NAMES libswscale/swscale.h
+      HINTS $ENV{FFMPEGDIR}\\include $ENV{EXTERNLIBS}\\ffmpeg\\include
+      PATH_SUFFIXES ${FFMPEG_PATH_SUFFIX})
 else( WIN32 )
    SET(ENV{PKG_CONFIG_PATH} "$ENV{EXTERNLIBS}/ffmpeg/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}")
-   SET( FFMPEG_LIBRARIES avformat avcodec avutil )
-   SET( FFMPEG_SWS_LIBRARIES swscale )
    INCLUDE(FindPkgConfig)
    if ( PKG_CONFIG_FOUND )
-      pkg_check_modules( AVFORMAT libavformat>=52 )
-      pkg_check_modules( AVCODEC libavcodec )
-      pkg_check_modules( AVUTIL libavutil )
-      pkg_check_modules( SWSCALE libswscale )
-      IF ( NOT (AVFORMAT_FOUND AND AVCODEC_FOUND AND AVUTIL_FOUND))
-        RETURN()
-      ENDIF ( NOT (AVFORMAT_FOUND AND AVCODEC_FOUND AND AVUTIL_FOUND))
+      pkg_check_modules( PC_FFMPEG_AVFORMAT libavformat>=52 )
+      pkg_check_modules( PC_FFMPEG_AVCODEC libavcodec )
+      pkg_check_modules( PC_FFMPEG_AVUTIL libavutil )
+      pkg_check_modules( PC_FFMPEG_SWSCALE libswscale )
    endif ( PKG_CONFIG_FOUND )
-   SET( FFMPEG_LIBRARY_DIR   ${AVFORMAT_LIBRARY_DIRS}
-			     ${AVCODEC_LIBRARY_DIRS}
-			     ${AVUTIL_LIBRARY_DIRS} )
-   SET( FFMPEG_INCLUDE_PATHS ${AVFORMAT_INCLUDE_DIRS}
-			     ${AVCODEC_INCLUDE_DIRS}
-			     ${AVUTIL_INCLUDE_DIRS} )

-   FIND_PATH(AVF
-        NAMES avformat.h
-        PATHS ${AVFORMAT_INCLUDE_DIRS}/libavformat /usr/include/libavformat)
+   FIND_PATH(FFMPEG_AVFORMAT_INCLUDE_DIR
+      NAMES libavformat/avformat.h
+      HINTS ${PC_FFMPEG_AVFORMAT_INCLUDE_DIRS} /usr/include
+      PATH_SUFFIXES ${FFMPEG_PATH_SUFFIX})
+   FIND_LIBRARY(FFMPEG_AVFORMAT_LIBRARY
+      NAMES avformat
+      HINTS ${PC_FFMPEG_AVFORMAT_LIBRARY_DIRS})
+   IF (FFMPEG_AVFORMAT_INCLUDE_DIR)
+      ADD_DEFINITIONS("-DHAVE_FFMPEG_SEPARATE_INCLUDES")
+   ENDIF (FFMPEG_AVFORMAT_INCLUDE_DIR)

-   IF (AVF)
-        ADD_DEFINITIONS("-DHAVE_FFMPEG_SEPARATE_INCLUDES")
-   ENDIF (AVF)
+   FIND_PATH(FFMPEG_AVCODEC_INCLUDE_DIR
+      NAMES libavcodec/avcodec.h
+      HINTS ${PC_FFMPEG_AVCODEC_INCLUDE_DIRS} /usr/include
+      PATH_SUFFIXES ${FFMPEG_PATH_SUFFIX})
+   FIND_LIBRARY(FFMPEG_AVCODEC_LIBRARY
+      NAMES avcodec
+      HINTS ${PC_FFMPEG_AVCODEC_LIBRARY_DIRS})
+
+   FIND_PATH(FFMPEG_AVUTIL_INCLUDE_DIR
+      NAMES libavutil/avutil.h
+      HINTS ${PC_FFMPEG_AVUTIL_INCLUDE_DIRS} /usr/include
+      PATH_SUFFIXES ${FFMPEG_PATH_SUFFIX})
+   FIND_LIBRARY(FFMPEG_AVUTIL_LIBRARY
+      NAMES avutil
+      HINTS ${PC_FFMPEG_AVUTIL_LIBRARY_DIRS})
+
+   FIND_PATH(FFMPEG_SWSCALE_INCLUDE_DIR
+      NAMES libswscale/swscale.h
+      HINTS ${PC_FFMPEG_SWSCALE_INCLUDE_DIRS} /usr/include
+      PATH_SUFFIXES ${FFMPEG_PATH_SUFFIX})
+   FIND_LIBRARY(FFMPEG_SWSCALE_LIBRARY
+      NAMES swscale
+      HINTS ${PC_FFMPEG_SWSCALE_LIBRARY_DIRS})
 endif( WIN32 )

-# add in swscale if found
-IF ( SWSCALE_FOUND )
-   SET( FFMPEG_LIBRARY_DIR   ${FFMPEG_LIBRARY_DIR}
-     			     ${SWSCALE_LIBRARY_DIRS} )
-   SET( FFMPEG_INCLUDE_PATHS ${FFMPEG_INCLUDE_PATHS}
-     			     ${SWSCALE_INCLUDE_DIRS} )
-   SET( FFMPEG_HEADERS	     ${FFMPEG_HEADERS}
-     			     ${FFMPEG_SWS_HEADERS} )
-   SET( FFMPEG_PATH_SUFFIXES ${FFMPEG_PATH_SUFFIXES}
-     			     ${FFMPEG_SWS_PATH_SUFFIXES} )
-   SET( FFMPEG_LIBRARIES     ${FFMPEG_LIBRARIES}
-     			     ${FFMPEG_SWS_LIBRARIES} )
-ENDIF ( SWSCALE_FOUND )
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFMPEG_SWSCALE DEFAULT_MSG
+   FFMPEG_SWSCALE_LIBRARY FFMPEG_SWSCALE_INCLUDE_DIR
+   )
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFMPEG DEFAULT_MSG
+   FFMPEG_AVFORMAT_LIBRARY FFMPEG_AVFORMAT_INCLUDE_DIR
+   FFMPEG_AVCODEC_LIBRARY FFMPEG_AVCODEC_INCLUDE_DIR
+   FFMPEG_AVUTIL_LIBRARY FFMPEG_AVUTIL_INCLUDE_DIR
+   )

-# find includes
-SET( INC_SUCCESS 0 )
-SET( TMP_ TMP-NOTFOUND )
-SET( FFMPEG_INCLUDE_DIR ${FFMPEG_INCLUDE_PATHS} )
-FOREACH( INC_ ${FFMPEG_HEADERS} )
-
-   FIND_PATH( TMP_ ${INC_}
-	      PATHS ${FFMPEG_INCLUDE_PATHS}
-	      PATH_SUFFIXES ${FFMPEG_PATH_SUFFIXES} )
-   IF ( TMP_ )
-      MATH( EXPR INC_SUCCESS ${INC_SUCCESS}+1 )
-      SET( FFMPEG_INCLUDE_DIR ${FFMPEG_INCLUDE_DIR} ${TMP_} )
-   ENDIF ( TMP_ )
-   SET( TMP_ TMP-NOTFOUND )
-ENDFOREACH( INC_ )
-
-# find the full paths of the libraries
-SET( TMP_ TMP-NOTFOUND )
-IF ( NOT WIN32 )
-   FOREACH( LIB_ ${FFMPEG_LIBRARIES} )
-      FIND_LIBRARY( TMP_ NAMES ${LIB_} PATHS ${FFMPEG_LIBRARY_DIR} )
-      IF ( TMP_ )
-	 SET( FFMPEG_LIBRARIES_FULL ${FFMPEG_LIBRARIES_FULL} ${TMP_} )
-      ENDIF ( TMP_ )
-      SET( TMP_ TMP-NOTFOUND )
-   ENDFOREACH( LIB_ )
-   SET ( FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES_FULL} )
-ENDIF( NOT WIN32 )
-
-LIST( LENGTH FFMPEG_HEADERS LIST_SIZE_ )
-
-SET( FFMPEG_FOUND FALSE )
-SET( FFMPEG_SWSCALE_FOUND FALSE )
-IF ( ${INC_SUCCESS} EQUAL ${LIST_SIZE_} )
-   SET( FFMPEG_FOUND TRUE )
-   SET( FFMPEG_SWSCALE_FOUND ${SWSCALE_FOUND} )
-ENDIF ( ${INC_SUCCESS} EQUAL ${LIST_SIZE_} )
+IF(FFMPEG_FOUND)
+   SET(FFMPEG_INCLUDE_DIRS ${FFMPEG_AVFORMAT_INCLUDE_DIR} ${FFMPEG_AVCODEC_INCLUDE_DIR} ${FFMPEG_AVUTIL_INCLUDE_DIR})
+   SET(FFMPEG_LIBRARIES ${FFMPEG_AVFORMAT_LIBRARY} ${FFMPEG_AVCODEC_LIBRARY} ${FFMPEG_AVUTIL_LIBRARY})
+   IF(FFMPEG_SWSCALE_FOUND)
+      SET(FFMPEG_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIRS} ${FFMPEG_SWSCALE_INCLUDE_DIR})
+      SET(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${FFMPEG_SWSCALE_LIBRARY})
+   ENDIF(FFMPEG_SWSCALE_FOUND)
+ENDIF(FFMPEG_FOUND)


Update opencl cmake

Update opencl cmake

--- cmake/FindOpenCL.cmake
+++ cmake/FindOpenCL.cmake
@@ -1,7 +1,7 @@
-find_path(OpenCL_INCLUDE_DIRS
+find_path(OPENCL_INCLUDE_DIRS
 	NAMES OpenCL/cl.h CL/cl.h
 	HINTS
-	${OpenCL_ROOT}/include
+	${OPENCL_ROOT}/include
 	$ENV{AMDAPPSDKROOT}/include
 	$ENV{CUDA_PATH}/include
 	PATHS
@@ -11,16 +11,16 @@
 	/opt/cuda/include
 	DOC "OpenCL header file path"
 	)
-mark_as_advanced( OpenCL_INCLUDE_DIRS )
+mark_as_advanced( OPENCL_INCLUDE_DIRS )

 # Search for 64bit libs if FIND_LIBRARY_USE_LIB64_PATHS is set to true in the global environment, 32bit libs else
 get_property( LIB64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS )

 if( LIB64 )
-	find_library( OpenCL_LIBRARIES
+	find_library( OPENCL_LIBRARIES
 		NAMES OpenCL
 		HINTS
-		${OpenCL_ROOT}/lib
+		${OPENCL_ROOT}/lib
 		$ENV{AMDAPPSDKROOT}/lib
 		$ENV{CUDA_PATH}/lib
 		DOC "OpenCL dynamic library path"
@@ -31,7 +31,7 @@
 		/opt/cuda/lib
 		)
 else( )
-	find_library( OpenCL_LIBRARIES
+	find_library( OPENCL_LIBRARIES
 		NAMES OpenCL
 		HINTS
 		${OPENCL_ROOT}/lib
@@ -46,15 +46,15 @@
 		/opt/cuda/lib
 		)
 endif( )
-mark_as_advanced( OpenCL_LIBRARIES )
+mark_as_advanced( OPENCL_LIBRARIES )

 include( FindPackageHandleStandardArgs )
-find_package_handle_standard_args( OpenCL DEFAULT_MSG OpenCL_LIBRARIES OpenCL_INCLUDE_DIRS )
+find_package_handle_standard_args( OPENCL DEFAULT_MSG OPENCL_LIBRARIES OPENCL_INCLUDE_DIRS )

-set(OPENCL_FOUND ${OpenCL_FOUND} CACHE INTERNAL "")
-set(OPENCL_LIBRARIES ${OpenCL_LIBRARIES} CACHE INTERNAL "")
-set(OPENCL_INCLUDE_DIRS ${OpenCL_INCLUDE_DIRS} CACHE INTERNAL "")
+set(OpenCL_FOUND ${OPENCL_FOUND} CACHE INTERNAL "")
+set(OpenCL_LIBRARIES ${OPENCL_LIBRARIES} CACHE INTERNAL "")
+set(OpenCL_INCLUDE_DIRS ${OPENCL_INCLUDE_DIRS} CACHE INTERNAL "")

-if( NOT OpenCL_FOUND )
+if( NOT OPENCL_FOUND )
 	message( STATUS "FindOpenCL looked for libraries named: OpenCL" )
 endif()


leave only options part of Psi4Macros

leave only options part of Psi4Macros

--- cmake/Psi4Macros.cmake
+++ cmake/Psi4Macros.cmake
@@ -38,56 +38,6 @@
    set(${variable} ${default} CACHE STRING ${msge} FORCE)
 endif()
 endmacro(option_with_default)
-
-#Common guts to adding a Psi4 library irrespective of bin vs. lib home
-#NOTE: list of sources is a CMake list
-#
-#Syntax general_add_library(<library name>, <list of sources>, <lib or bin>,
-#                           <dependencies>)
-#
-macro(general_add_library libname sources dir)
-   #TODO: Switch to OBJECT library?  Simplifies this macro...
-   if(${dir} MATCHES lib)
-      set(prefix lib)
-   endif()
-   add_library(${libname} ${${sources}})
-   set_target_properties(${libname} PROPERTIES
-       POSITION_INDEPENDENT_CODE ${BUILD_FPIC}
-   )
-   install(TARGETS ${libname} DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
-   install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-      DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/psi4/src/${dir}/${prefix}${libname}
-      FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp")
-   set_property(GLOBAL APPEND PROPERTY LIBLIST ${libname})
-   set(depend_name "${ARGN}")
-   foreach(name_i IN LISTS depend_name)
-      target_link_libraries(${libname} INTERFACE ${name_i})
-   endforeach()
-   target_include_directories(${libname} PUBLIC ${Boost_INCLUDE_DIRS}
-                                                ${LIBDERIV_INCLUDE_DIRS})
-endmacro(general_add_library libname sources prefix dir)
-
-#Adds a psi4 library that lives in lib
-#
-#Syntax: psi4_add_library(<library name> <list of sources> <dependencies>)
-#
-macro(psi4_add_library libname sources)
-   general_add_library(${libname} ${sources} lib ${ARGN})
-endmacro(psi4_add_library libname sources)
-
-#Adds a psi4 library that lives in bin
-#
-#Syntax: psi4_add_binary(<library name> <list of sources> <dependencies>
-#
-macro(psi4_add_binary libname sources)
-   general_add_library(${libname} ${sources} bin ${ARGN})
-endmacro(psi4_add_binary libname sources)
-
-include(CheckCCompilerFlag)
-include(CheckCXXCompilerFlag)
-if(CMAKE_Fortran_COMPILER)
-    include(CheckFortranCompilerFlag)  # CMake >= 3.3, so local copy in cmake/
-endif()

 #The guts of the next two functions, use the wrappers please
 #
@@ -194,18 +144,3 @@
        add_flags("${ARGN}")
     endif()
 endmacro()
-
-#Macro so I don't have to look at a ton of if statements for adding each plugin
-#
-#Syntax: optional_plugin(<plugin name>)
-#
-macro(optional_plugin plugin_name)
-string(TOUPPER ${plugin_name} PLUGIN_NAME)
-if(${ENABLE_${PLUGIN_NAME}})
-   find_package(${plugin_name} REQUIRED)
-   set_property(GLOBAL APPEND PROPERTY PSI4_MODULES ${${PLUGIN_NAME}_LIBRARIES})
-   add_definitions(-DENABLE_${PLUGIN_NAME})
-else()
-   add_library(${plugin_name} INTERFACE)
-endif()
-endmacro(optional_plugin plugin_name)


Modified Sanitizers cmake with extra options

--- cmake/Sanitizers.cmake
+++ cmake/Sanitizers.cmake
@@ -16,9 +16,9 @@
       list(APPEND SANITIZERS "address")
     endif()

-    option(ENABLE_SANITIZER_MEMORY "Enable memory sanitizer" FALSE)
-    if(ENABLE_SANITIZER_MEMORY)
-      list(APPEND SANITIZERS "memory")
+    option(ENABLE_SANITIZER_LEAK "Enable leak sanitizer" FALSE)
+    if(ENABLE_SANITIZER_LEAK)
+      list(APPEND SANITIZERS "leak")
     endif()

     option(ENABLE_SANITIZER_UNDEFINED_BEHAVIOR
@@ -29,7 +29,20 @@

     option(ENABLE_SANITIZER_THREAD "Enable thread sanitizer" FALSE)
     if(ENABLE_SANITIZER_THREAD)
-      list(APPEND SANITIZERS "thread")
+        if ("address" IN_LIST SANITIZERS OR "leak" IN_LIST SANITIZERS)
+            message(WARNING "Thread sanitizer does not work with Address and Leak sanitizer enabled")
+        else()
+            list(APPEND SANITIZERS "thread")
+        endif()
+    endif()
+
+    option(ENABLE_SANITIZER_MEMORY "Enable memory sanitizer" FALSE)
+    if(ENABLE_SANITIZER_MEMORY AND CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
+        if ("address" IN_LIST SANITIZERS OR "thread" IN_LIST SANITIZERS OR "leak" IN_LIST SANITIZERS)
+            message(WARNING "Memory sanitizer does not work with Address, Thread and Leak sanitizer enabled")
+        else()
+             list(APPEND SANITIZERS "memory")
+        endif()
     endif()

     list(JOIN SANITIZERS "," LIST_OF_SANITIZERS)


cmake: Suppress messages about compiler checks

Messages about compiler checks are very verbose so we disable them by
default. They have always been undesirably verbose, but introducing
CMAKE_REQUIRED_FLAGS into the 'check' string made them unacceptably
so.

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

--- cmake/extensions.cmake
+++ cmake/extensions.cmake
@@ -943,6 +943,9 @@
 # check_compiler_flag(C "-Wall" my_check)
 # print(my_check) # my_check is now 1
 function(check_compiler_flag lang option ok)
+  if(NOT DEFINED CMAKE_REQUIRED_QUIET)
+    set(CMAKE_REQUIRED_QUIET 1)
+  endif()

   string(MAKE_C_IDENTIFIER
     check${option}_${lang}_${CMAKE_REQUIRED_FLAGS}


sanitizers enabling implementation simplified

--- cmake/sanitizers.cmake
+++ cmake/sanitizers.cmake
@@ -1,17 +1,9 @@
-if("${SANITIZE}" STREQUAL "address")
-  message(STATUS "enabling address sanitizer")
-  add_compile_options(-fsanitize=address)
-  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address -lasan")
+if(SANITIZE)
+  message(STATUS "enabling ${SANITIZE} sanitizer")
+  add_compile_options(-fsanitize=${SANITIZE})
+  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=${SANITIZE}")
 endif()

-if("${SANITIZE}" STREQUAL "memory")
-  message(STATUS "enabling memory sanitizer")
-  add_compile_options(-fsanitize=memory)
-  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=memory")
+if("${SANITIZE}" STREQUAL "address")
+  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lasan")
 endif()
-
-if("${SANITIZE}" STREQUAL "thread")
-  message(STATUS "enabling thread sanitizer")
-  add_compile_options(-fsanitize=thread)
-  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=thread")
-endif()


BUG: Add missing ITKOpenJPEG dependency for ITKReview Module.

Required by JPEG2000ImageIO.

Change-Id: If0a922c258e26a4728935e107efe1781588cc191

--- Modules/Nonunit/Review/itk-module.cmake
+++ Modules/Nonunit/Review/itk-module.cmake
@@ -64,6 +64,7 @@
     ITKMesh
     ITKNarrowBand
     ITKNeuralNetworks
+    ITKOpenJPEG
     ITKOptimizers
     ITKPath
     ITKPDEDeformableRegistration


Update regexes to correctly parse version information for older versions of Armadillo.

--- fastlib/branches/fastlib-stl/CMake/FindArmadillo.cmake
+++ fastlib/branches/fastlib-stl/CMake/FindArmadillo.cmake
@@ -105,9 +105,15 @@
 if(ARMA_VERSION_FILE)
     file(READ ${ARMA_VERSION_FILE} _contents)
     if(_contents)
-        string(REGEX REPLACE ".*#define ARMA_VERSION_MAJOR \([0-9]+\).*" "\\1" ARMA_MAJOR_VERSION "${_contents}")
-        string(REGEX REPLACE ".*#define ARMA_VERSION_MINOR \([0-9]+\).*" "\\1" ARMA_MINOR_VERSION "${_contents}")
-        string(REGEX REPLACE ".*#define ARMA_VERSION_PATCH \([0-9]+\).*" "\\1" ARMA_PATCH_VERSION "${_contents}")
+        if (EXISTS "${ARMADILLO_INCLUDES}/arma_version.hpp")
+          string(REGEX REPLACE ".*#define ARMA_VERSION_MAJOR \([0-9]+\).*" "\\1" ARMA_MAJOR_VERSION "${_contents}")
+          string(REGEX REPLACE ".*#define ARMA_VERSION_MINOR \([0-9]+\).*" "\\1" ARMA_MINOR_VERSION "${_contents}")
+          string(REGEX REPLACE ".*#define ARMA_VERSION_PATCH \([0-9]+\).*" "\\1" ARMA_PATCH_VERSION "${_contents}")
+        else()
+          string(REGEX REPLACE ".*static const unsigned int major = \([0-9]+\).*" "\\1" ARMA_MAJOR_VERSION "${_contents}")
+          string(REGEX REPLACE ".*static const unsigned int minor = \([0-9]+\).*" "\\1" ARMA_MINOR_VERSION "${_contents}")
+          string(REGEX REPLACE ".*static const unsigned int patch = \([0-9]+\).*" "\\1" ARMA_PATCH_VERSION "${_contents}")
+        endif()

         if(NOT ${ARMA_MAJOR_VERSION} MATCHES "[0-9]+")
             message(FATAL_ERROR "Version parsing failed for ARMA_VERSION_MAJOR!")


fix CMakeMacro.cmake to support bits directory

--- modules/CMakeMacro.cmake
+++ modules/CMakeMacro.cmake
@@ -21,9 +21,10 @@
 macro (matcha_header_install_definition name)
 	file(GLOB headers "include/matcha/${name}/*.hpp")
 	install(FILES ${headers} DESTINATION "include/matcha/${name}")
-	if(EXISTS "include/matcha/${name}/bits")
+	if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/include/matcha/${name}/bits/")
 		file(GLOB bits_headers "include/matcha/${name}/bits/*.hpp")
 		install(FILES ${bits_headers} DESTINATION "include/matcha/${name}/bits")
+		message("bits")
 	endif()
 endmacro()


- Removed reflection module references

- Removed reflection module references

--- modules.cmake
+++ modules.cmake
@@ -19,7 +19,6 @@
 clever_add_simple_module(std_io         ON  "enable the io module"         "")
 clever_add_simple_module(std_math       ON  "enable the math module"       "")
 clever_add_simple_module(std_sys        ON  "enable the sys module"        "")
-clever_add_simple_module(std_reflection ON  "enable the reflection module" "")

 # std.regex
 if (MOD_STD_REGEX)


:bug: Arguments passed correctly from lookup to find_python_package

--- scripts/PythonPackageLookup.cmake
+++ scripts/PythonPackageLookup.cmake
@@ -37,11 +37,11 @@
     set(arguments "")
     set(package_install_name "${package}")
     if(lpp_VERSION)
-        set(arguments "${arguments} VERSION ${lpp_VERSION}")
+        list(APPEND arguments VERSION ${lpp_VERSION})
         set(package_install_name "${package}==${lpp_VERSION}")
     endif()
     if(lpp_QUIET)
-        set(arguments "${arguments} QUIET")
+        list(APPEND arguments QUIET)
     endif()
     find_python_package(${package} ${arguments})
     if(${package}_FOUND)
@@ -89,7 +89,7 @@
     )
     if(result EQUAL 0)
         if(lpp_REQUIRED)
-            set(arguments "${arguments} REQUIRED")
+            list(APPEND arguments REQUIRED)
         endif()
         find_python_package(${package} ${arguments} ${lpp_UNPARSED_ARGUMENTS})
     elseif(lpp_REQUIRED)


fix typo

fix typo

--- etc/owsmangencert.sh.cmake
+++ etc/owsmangencert.sh.cmake
@@ -16,7 +16,7 @@
 fi

 echo
-echo creating selfsingned certificate
+echo creating selfsigned certificate
 echo "replace it with one signed by a certification authority (CA)"
 echo
 echo enter your ServerName at the Common Name prompt


updates models hash

updates models hash

--- CTestConfig.cmake
+++ CTestConfig.cmake
@@ -16,7 +16,7 @@

 set(CTEST_PROJECT_NAME "Embree")
 set(CTEST_NIGHTLY_START_TIME "22:00:00 UTC")
-set(TEST_MODELS_HASH 0c44fa50128378866f7b9f2980dd5a7103f8e754)
+set(TEST_MODELS_HASH 40c7a7c53cf287d9e0e49981a5d883f2461649e3)

 IF (NOT CTEST_DROP_SITE)
   set(CTEST_DROP_METHOD "http")


Add optional DEBIAN_PACKAGE_VERSION_EXTRA

--- CommonCPack.cmake
+++ CommonCPack.cmake
@@ -108,6 +108,15 @@
   if(CPACK_GENERATOR STREQUAL "DEB")
     # dpkg requires lowercase package names
     string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_DEBIAN_PACKAGE_NAME)
+
+    if(DEBIAN_PACKAGE_VERSION_EXTRA)
+      set(CPACK_DEBIAN_PACKAGE_VERSION
+        "${CPACK_PACKAGE_VERSION}~${DEBIAN_PACKAGE_VERSION_EXTRA}${LSB_RELEASE}")
+
+      set(CPACK_PACKAGE_FILE_NAME
+        "${CPACK_PACKAGE_NAME}-${CPACK_DEBIAN_PACKAGE_VERSION}.${CMAKE_SYSTEM_PROCESSOR}")
+    endif()
+
     if(NOT CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA)
       set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "/sbin/ldconfig")
     endif()


Simplify and fix setting of CPACK_PACKAGE_FILE_NAME

--- CommonCPack.cmake
+++ CommonCPack.cmake
@@ -112,9 +112,7 @@
   set(CPACK_RPM_PACKAGE_LICENSE ${CPACK_PACKAGE_LICENSE})
   set(CPACK_RPM_PACKAGE_RELEASE ${CMAKE_PACKAGE_VERSION})
   set(CPACK_RPM_PACKAGE_VERSION ${VERSION})
-  if(CPACK_PACKAGE_NAME_EXTRA)
-    set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}.${CMAKE_SYSTEM_PROCESSOR}")
-  endif()
+  set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}.${CMAKE_SYSTEM_PROCESSOR}")
   if(NOT CPACK_RPM_POST_INSTALL_SCRIPT_FILE)
     set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${CMAKE_CURRENT_LIST_DIR}/rpmPostInstall.sh")
   endif()
@@ -129,17 +127,8 @@
     # dpkg requires lowercase package names
     string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_DEBIAN_PACKAGE_NAME)

-    if(CPACK_PACKAGE_NAME_EXTRA)
-      set(CPACK_DEBIAN_PACKAGE_VERSION
-        "${CPACK_PACKAGE_VERSION}~${CPACK_PACKAGE_NAME_EXTRA}${LSB_RELEASE}")
-      set(CPACK_PACKAGE_FILE_NAME
-        "${CPACK_PACKAGE_NAME}-${CPACK_DEBIAN_PACKAGE_VERSION}.${CMAKE_SYSTEM_PROCESSOR}")
-    else()
-      set(CPACK_DEBIAN_PACKAGE_VERSION
-        "${CPACK_PACKAGE_VERSION}~${LSB_RELEASE}")
-      set(CPACK_PACKAGE_FILE_NAME
-        "${CPACK_PACKAGE_NAME}-${CPACK_DEBIAN_PACKAGE_VERSION}.${CMAKE_SYSTEM_PROCESSOR}")
-    endif()
+    set(CPACK_PACKAGE_FILE_NAME
+      "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}~${CPACK_PACKAGE_NAME_EXTRA}${LSB_RELEASE}.${CMAKE_SYSTEM_PROCESSOR}")

     if(NOT CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA)
       set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "/sbin/ldconfig")


Addressed an issue with building tests on Windows (after having fixed something on Mac OS X!).

--- cmake/common.cmake
+++ cmake/common.cmake
@@ -540,11 +540,21 @@
                AND EXISTS ${PROJECT_SOURCE_DIR}/${TEST_HEADER_MOC_FILE})
                 # The test exists, so build it

+                # Definition to make sure that the test can properly use bits
+                # which come from the Core plugin
+
+                IF(WIN32)
+                    ADD_DEFINITIONS(-DCore_PLUGIN)
+                ENDIF()
+
+                # Rules to build the test
+
                 QT4_WRAP_CPP(TEST_SOURCES_MOC
                     ../../plugin.h
                     ../../pluginmanager.h

                     ../../misc/Core/src/dockwidget.h
+                    ../../misc/Core/src/widget.h

                     ${HEADERS_MOC}
                     ${TEST_HEADER_MOC_FILE}
@@ -561,6 +571,7 @@

                     ../../misc/Core/src/commonwidget.cpp
                     ../../misc/Core/src/dockwidget.cpp
+                    ../../misc/Core/src/widget.cpp

                     ${TEST_SOURCE_FILE}
                     ${TEST_SOURCES_MOC}


build fix for single-target AVX2 builds.

--- cmake/ospray.cmake
+++ cmake/ospray.cmake
@@ -112,7 +112,7 @@
       SET(OSPRAY_ISPC_TARGET_LIST avx2)
       SET(OSPRAY_EMBREE_ENABLE_SSE  true)
       SET(OSPRAY_EMBREE_ENABLE_AVX  true)
-      SET(OSPRAY_EMBREE_ENABLE_AVX2 false)
+      SET(OSPRAY_EMBREE_ENABLE_AVX2 true)

     ELSEIF (OSPRAY_BUILD_ISA STREQUAL "AVX")
       # ------------------------------------------------------------------


redirect windows python scripts -> bin.

redirect windows python scripts -> bin.

--- cmake/python.cmake
+++ cmake/python.cmake
@@ -17,7 +17,8 @@
   set(SETUPTOOLS_ARG_EXTRA "--install-layout=deb" CACHE STRING "extra arguments to setuptools")
 else()
   set(PYTHON_PACKAGES_DIR site-packages CACHE STRING "dist-packages or site-packages")
-  set(SETUPTOOLS_ARG_EXTRA "" CACHE STRING "extra arguments to setuptools")
+  file(TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX}/bin PYTHON_INSTALL_PREFIX) # setuptools is fussy about windows paths
+  set(SETUPTOOLS_ARG_EXTRA "--install-scripts=${PYTHON_INSTALL_PREFIX}" CACHE STRING "extra arguments to setuptools")
 endif()

 # Windows setuptools installs to Lib/site-packages not Lib/python2.7/site-packages


change lowercase .s to .S

change lowercase .s to .S

--- deps/luajit.cmake
+++ deps/luajit.cmake
@@ -272,6 +272,7 @@
   ${LUAJIT_DIR}/src/lj_cparse.c
   ${LUAJIT_DIR}/src/lj_lib.c
   ${LUAJIT_DIR}/src/lj_alloc.c
+  ${LUAJIT_DIR}/src/lj_vmmath.c
   ${LUAJIT_DIR}/src/lib_aux.c
   ${LUAJIT_DIR}/src/lib_init.c
   ${SRC_LJLIB})
@@ -300,8 +301,8 @@
   add_buildvm_target ( lj_vm.obj peobj )
   set (LJ_VM_SRC ${CMAKE_CURRENT_BINARY_DIR}/lj_vm.obj)
 else ()
-  add_buildvm_target ( lj_vm.s ${LJVM_MODE} )
-  set (LJ_VM_SRC ${CMAKE_CURRENT_BINARY_DIR}/lj_vm.s)
+  add_buildvm_target ( lj_vm.S ${LJVM_MODE} )
+  set (LJ_VM_SRC ${CMAKE_CURRENT_BINARY_DIR}/lj_vm.S)
 endif ()
 add_buildvm_target ( lj_ffdef.h   ffdef   ${SRC_LJLIB} )
 add_buildvm_target ( lj_bcdef.h  bcdef  ${SRC_LJLIB} )


modified add_target_unittests

modified add_target_unittests

--- cmake-d/UseDUnittest.cmake
+++ cmake-d/UseDUnittest.cmake
@@ -29,7 +29,7 @@
     separate_arguments(CMAKE_D_FLAGS)

     add_test(NAME ${_testname}
-        COMMAND ${CMAKE_D_COMPILER} ${CMAKE_D_FLAGS} ${INCLUDES} -unittest -main ${SOURCEFILES})
+        COMMAND ${CMAKE_D_COMPILER} ${CMAKE_D_FLAGS} ${INCLUDES} -of${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${_testname} -unittest -main ${SOURCEFILES})
 endmacro()

 macro(add_unittests _sourcefile)


Enable to detect Windows SDK v1903

Enable to detect Windows SDK v1903

--- cmake/FindWindowsSDK.cmake
+++ cmake/FindWindowsSDK.cmake
@@ -73,10 +73,11 @@
 endmacro()

 set(_winsdk_win10vers
-      10.0.17763.0 # Windows 10 Version 1809
-      10.0.17134.0 # Windows 10 Version 1803 (April 2018 Update)
-      10.0.16299.0 # Windows 10 Version 1709 (Fall Creators Update)
-      10.0.15063.0 # Windows 10 Version 1703 (Creators Update)
+	10.0.18362.0 # Windows 10 Version 1903
+	10.0.17763.0 # Windows 10 Version 1809
+	10.0.17134.0 # Windows 10 Version 1803 (April 2018 Update)
+	10.0.16299.0 # Windows 10 Version 1709 (Fall Creators Update)
+	10.0.15063.0 # Windows 10 Version 1703 (Creators Update)
 	10.0.14393.0 # Redstone aka Win10 1607 "Anniversary Update"
 	10.0.10586.0 # TH2 aka Win10 1511
 	10.0.10240.0 # Win10 RTM
@@ -531,11 +532,11 @@
 			winv6.3 # Win 8.1 min requirement
 		)

-			list(APPEND _suffixes
-				"lib/${_ver}/${_winsdk_arch}"
-				"lib/${_ver}/um/${_winsdk_arch8}"
-				"lib/${_ver}/km/${_winsdk_arch8}"
-			)
+		list(APPEND _suffixes
+			"lib/${_ver}/${_winsdk_arch}"
+			"lib/${_ver}/um/${_winsdk_arch8}"
+			"lib/${_ver}/km/${_winsdk_arch8}"
+		)
 		endforeach()

 		# Look for WDF libraries in Win10+ SDK


Build system: Use more refined procedure for dealing with Octave-4 (Try 2)

Fix a bug in the previous commit on the Octave version to check against
(I used "3." rather than the correct "4.".)

--- cmake/modules/octave.cmake
+++ cmake/modules/octave.cmake
@@ -106,7 +106,7 @@
     message(STATUS "WARNING: "
     "plplot require octave version 3.2 or greater. Disabling octave bindings")
     set(ENABLE_octave OFF CACHE BOOL "Enable Octave bindings" FORCE)
-  elseif(NOT ${OCTAVE_VERSION} VERSION_LESS "3")
+  elseif(NOT ${OCTAVE_VERSION} VERSION_LESS "4")
     message(STATUS "WARNING: Octave-4 has been found which is likely to lead to build errors for PLplot.")
     option(TRY_OCTAVE4 "Experimentally try Octave-4 if it is found" OFF)
     if(TRY_OCTAVE4)


CMake also looks for win-bash.exe now (Windows case).

svn path=/trunk/; revision=7245

--- cmake/modules/plplot.cmake
+++ cmake/modules/plplot.cmake
@@ -56,6 +56,7 @@
 option(BUILD_TEST "Compile examples in the build tree and enable ctest" OFF)
 # Use bash when available for ctest and install tree test support
 find_program(SH_EXECUTABLE bash)
+find_program(SH_EXECUTABLE win-bash)
 if(SH_EXECUTABLE)
   set(HAVE_BASH ON)
 else(SH_EXECUTABLE)


moved to UseVTK.cmake.in

moved to UseVTK.cmake.in

--- UseVTK.cmake
+++ UseVTK.cmake
@@ -1,79 +0,0 @@
-#
-# This module add the VTK include paths to a project
-# It should be included after the FindVTK module
-#
-IF (USE_INSTALLED_VTK)
-  IF (VTK_INSTALL_PATH)
-    LOAD_CACHE(${VTK_INSTALL_PATH}/include/vtk
-      EXCLUDE
-        BUILD_DOCUMENTATION
-        BUILD_SHARED_LIBS
-        BUILD_TESTING
-        BUILD_EXAMPLES
-	DOCUMENTATION_HTML_HELP
-	DOCUMENTATION_HTML_TARZ
-        LIBRARY_OUTPUT_PATH
-        EXECUTABLE_OUTPUT_PATH
-        MAKECOMMAND
-        SITE
-        BUILDNAME
-      INCLUDE_INTERNALS
-        VTK_BINARY_DIR
-        VTK_LIBRARY_PATH
-        VTK_BUILD_SHARED_LIBS
-      )
-    INCLUDE_DIRECTORIES ( ${VTK_INSTALL_PATH}/include/vtk )
-    LINK_DIRECTORIES(${VTK_INSTALL_PATH}/lib/vtk)
-  ENDIF (VTK_INSTALL_PATH)
-ELSE (USE_INSTALLED_VTK)
-  IF (VTK_BINARY_PATH)
-    LOAD_CACHE(${VTK_BINARY_PATH}
-      EXCLUDE
-        BUILD_DOCUMENTATION
-        BUILD_SHARED_LIBS
-        BUILD_TESTING
-        BUILD_EXAMPLES
-	DOCUMENTATION_HTML_HELP
-	DOCUMENTATION_HTML_TARZ
-        LIBRARY_OUTPUT_PATH
-        EXECUTABLE_OUTPUT_PATH
-        MAKECOMMAND
-        SITE
-        BUILDNAME
-      INCLUDE_INTERNALS
-        VTK_BINARY_DIR
-        VTK_LIBRARY_PATH
-        VTK_BUILD_SHARED_LIBS
-      )
-    INCLUDE (${VTK_SOURCE_DIR}/vtkCMakeOptions.cmake)
-    LINK_DIRECTORIES(${VTK_LIBRARY_PATH})
-  ENDIF (VTK_BINARY_PATH)
-ENDIF (USE_INSTALLED_VTK)
-
-IF (VTK_USE_RENDERING)
-  # add in opengl
-  IF (WIN32)
-    LINK_LIBRARIES ( ${OPENGL_LIBRARY} )
-  ELSE (WIN32)
-    IF (OPENGL_LIBRARY)
-      LINK_LIBRARIES (${OPENGL_LIBRARY})
-    ENDIF (OPENGL_LIBRARY)
-  ENDIF (WIN32)
-  IF (VTK_MANGLE_MESA)
-    LINK_LIBRARIES( ${MESA_LIBRARY})
-    IF ( MESA_OS_LIBRARY )
-      LINK_LIBRARIES(${MESA_OS_LIBRARY})
-    ENDIF ( MESA_OS_LIBRARY )
-  ENDIF (VTK_MANGLE_MESA)
-
-  # add in xwindows stuff
-  IF (CMAKE_HAS_X)
-    LINK_LIBRARIES(-lXt)
-    LINK_LIBRARIES(${CMAKE_X_LIBS})
-    ADD_DEFINITIONS(${CMAKE_X_CFLAGS})
-  ENDIF (CMAKE_HAS_X)
-ENDIF (VTK_USE_RENDERING)
-
-IF (UNIX)
-  LINK_LIBRARIES(${THREAD_LIBS} ${DL_LIBS} -lm)
-ENDIF (UNIX)


Show information about REASON_EXCLUDE_LINK_DEPENDENCY

--- reason.util.cmake
+++ reason.util.cmake
@@ -108,6 +108,7 @@

   list(FIND REASON_EXCLUDE_LINK_DEPENDENCY "${DEP}" DEP_IN_EXCLUDE)
   if("${DEP_IN_EXCLUDE}" STREQUAL "-1")
+    reason_verbose("exclude dependency: [dep=${DEP}"]")
     return()
   endif()


Fix dependency type when extract include dirs

--- reason.util.cmake
+++ reason.util.cmake
@@ -77,13 +77,13 @@
     endforeach()
   endfunction()

-  get_target_property(TARGET_TYPE "${TARGET_NAME}" "TYPE")
-  reason_verbose("${TARGET_NAME} properties: [type=${TARGET_TYPE}]")
+  get_target_property(DEP_TYPE "${DEP}" "TYPE")
+  reason_verbose("  dependency type: [type=${DEP_TYPE}]")

   reason_verbose("  add dep interface include directories: [dep=${DEP}]")
   reason_extract_dep_inc_dirs_to_target_one("${TARGET_NAME}" "${DEP}" "INTERFACE_INCLUDE_DIRECTORIES")

-  if(NOT "${TARGET_TYPE}" STREQUAL "INTERFACE_LIBRARY")
+  if(NOT "${DEP_TYPE}" STREQUAL "INTERFACE_LIBRARY")
     reason_verbose("  add dep include directories: [dep=${DEP}]")
     reason_extract_dep_inc_dirs_to_target_one("${TARGET_NAME}" "${DEP}" "INCLUDE_DIRECTORIES")
   endif()


[cmake] allow configuration of NCP defines (#4633)

Signed-off-by: Markus Becker <41b3d55dd769bc12df1d891e8cfd1d03607af5b4@tridonic.com>

--- etc/cmake/options.cmake
+++ etc/cmake/options.cmake
@@ -134,6 +134,16 @@
 option(OT_MTD_NETDIAG "enable TMF network diagnostics on MTDs")
 if(OT_MTD_NETDIAG)
     list(APPEND OT_PRIVATE_DEFINES "OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE=1")
+endif()
+
+option(OT_NCP "enable network co-processor NCP")
+if(OT_NCP)
+    list(APPEND OT_PRIVATE_DEFINES "OPENTHREAD_ENABLE_NCP=1")
+endif()
+
+option(OT_NCP_RADIO_ONLY "run NCP in radio only mode")
+if(OT_NCP_RADIO_ONLY)
+    list(APPEND OT_PRIVATE_DEFINES "OPENTHREAD_ENABLE_RADIO_ONLY=1")
 endif()

 option(OT_PLATFORM_UDP "enable platform UDP support")


change symbol visibility when using cppunit backend

--- cmake/FindCUTI.cmake
+++ cmake/FindCUTI.cmake
@@ -123,7 +123,7 @@
   else()
     get_filename_component(CUTI_PLUGIN_SRC ${CUTI_ROOT_DIR}/src/UnitTestPlugin.cpp ABSOLUTE)
     add_library(${target} SHARED ${ARGN} ${CUTI_INCLUDE} ${CUTI_PLUGIN_SRC})
-    #target_compile_definitions(${target} PUBLIC "-DCPPUNIT_PLUGIN_EXPORT=__attribute__ ((visibility (\"default\")))" )
+    target_compile_definitions(${target} PUBLIC "-DCPPUNIT_PLUGIN_EXPORT=__attribute__ ((visibility (\"default\")))" )
     cuti_init_cppunit_libraries(${target})
   endif()


fixed error where WEBP_LIBRARY was used to check if GLEW was found

--- cmake/FindGLEW.cmake
+++ cmake/FindGLEW.cmake
@@ -47,7 +47,7 @@
 # handle the QUIETLY and REQUIRED arguments and set GLEW_FOUND to TRUE if
 # all listed variables are TRUE
 INCLUDE(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLEW DEFAULT_MSG WEBP_LIBRARY WEBP_INCLUDE_DIR)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLEW DEFAULT_MSG GLEW_LIBRARY GLEW_INCLUDE_DIR)

 SET(GLEW_LIBRARIES ${GLEW_LIBRARY})
 SET(GLEW_INCLUDE_DIRS ${GLEW_INCLUDE_DIR})


CMake GLFW project decency fix, closes issue inviwo/inviwo-dev#791

--- cmake/FindGLFW.cmake
+++ cmake/FindGLFW.cmake
@@ -7,6 +7,7 @@
     set(BUILD_GLFW 1)
 	set(GLFW_INCLUDE_DIR  ${IVW_MODULE_DIR}/glfw/ext/glfw/include)
 	set(GLFW_LIBRARY glfw)
+	set(GLFW_PROJECT glfw)
 	set(GLFW_LIBRARY_DIR ${LIBRARY_OUTPUT_PATH})
 	mark_as_advanced(FORCE  GLFW_INCLUDE_DIR )
 	mark_as_advanced(FORCE  GLFW_LIBRARY )


FindOgre.cmake: Proper fix for linking to optional libs.

--- cmake/FindOgre.cmake
+++ cmake/FindOgre.cmake
@@ -104,8 +104,8 @@
         link_directories(${OGRE_DIR}/lib)
         if (WIN32)
             include_directories(${OGRE_DIR}/include/OGRE/RenderSystems/Direct3D9)
-            link_directories(${OGRE_DIR}/lib/opt)
-            link_directories(${OGRE_DIR}/lib/opt/$(OutDir))
+            link_directories(${OGRE_DIR}/lib/$(Configuration))
+            link_directories(${OGRE_DIR}/lib/$(Configuration)/opt)
         endif()
         message(STATUS "Using Ogre from SDK directory " ${OGRE_DIR})
     else()


Changed genhtml behaviour

Changed genhtml behaviour

Genhtml quiet option is now enabled instead of piping it to /dev/null.

--- cmake/Findgcov.cmake
+++ cmake/Findgcov.cmake
@@ -268,10 +268,10 @@
 		add_custom_target(lcov-genhtml
 			WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
 			COMMAND ${GENHTML_BIN}
+				-q
 				-t ${CMAKE_PROJECT_NAME}
 				-o ${CMAKE_BINARY_DIR}/lcov/project
 				`find . -name \"*.tgt.info\"`
-				> /dev/null
 		)
 	endif (NOT TARGET lcov-genhtml)

@@ -284,10 +284,10 @@
 		add_custom_target(lcov
 			WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
 			COMMAND ${GENHTML_BIN}
+				-q
 				-t ${CMAKE_PROJECT_NAME}
 				-o ${CMAKE_BINARY_DIR}/lcov/project
 				`find . -name \"*.tgt.info\"`
-				> /dev/null
 			DEPENDS lcov-geninfo
 		)
 	endif ()


[cmake.UseLATEX] removed double license and copyright

--- cmake/UseLATEX.cmake
+++ cmake/UseLATEX.cmake
@@ -1,8 +1,3 @@
-# This file is part of the dune-stuff project:
-#   http://users.dune-project.org/projects/dune-stuff
-# Copyright holders: Rene Milk, Felix Schindler
-# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
-
 # File: UseLATEX.cmake
 # CMAKE commands to actually use the LaTeX compiler
 # Version: 1.9.4
@@ -431,7 +426,7 @@
           )
       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}


Remove unused UseLATEX CMake macros

Remove unused UseLATEX CMake macros

--- cmake/UseLATEX.cmake
+++ cmake/UseLATEX.cmake
@@ -1,1393 +0,0 @@
-# File: UseLATEX.cmake
-# CMAKE commands to actually use the LaTeX compiler
-# Version: 1.10.5
-# 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] [DEFAULT_PS] [NO_DEFAULT]
-#                    [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.  Likewise,
-#       DEFAULT_SAFEPDF sets the default target to safepdf.  If NO_DEFAULT
-#       is specified, then no target will be added to ALL, which is
-#       convenient when including LaTeX documentation with something else.
-#
-#       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.10.5 Fix for Window's convert check (thanks to Martin Baute).
-#
-# 1.10.4 Copy font files to binary directory for packages that come with
-#       their own fonts.
-#
-# 1.10.3 Check for Windows version of convert being used instead of
-#       ImageMagick's version (thanks to Martin Baute).
-#
-# 1.10.2 Use htlatex as a fallback when latex2html is not available (thanks
-#       to Tomasz Grzegurzko).
-#
-# 1.10.1 Make convert program mandatory only if actually used (thanks to
-#       Julien Schueller).
-#
-# 1.10.0 Added NO_DEFAULT and DEFAULT_PS options.
-#       Fixed issue with cleaning files for LaTeX documents originating in
-#       a subdirectory.
-#
-# 1.9.6 Fixed problem with LATEX_SMALL_IMAGES.
-#       Strengthened check to make sure the output directory does not contain
-#       the source files.
-#
-# 1.9.5 Add support for image types not directly supported by either latex
-#       or pdflatex.  (Thanks to Jorge Gerardo Pena Pastor for SVG support.)
-#
-# 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 (.+)\\.$")
-
-    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)
-  # MiKTeX calls latex2html htlatex
-  IF (NOT ${LATEX2HTML_CONVERTER})
-    FIND_PROGRAM(HTLATEX_CONVERTER
-      NAMES htlatex
-      PATHS ${MIKTEX_BINARY_PATH}
-            /usr/bin
-    )
-    IF (HTLATEX_CONVERTER)
-      SET(USING_HTLATEX TRUE CACHE INTERNAL "True when using MiKTeX htlatex instead of latex2html" FORCE)
-      SET(LATEX2HTML_CONVERTER ${HTLATEX_CONVERTER}
-        CACHE FILEPATH "htlatex taking the place of latex2html" FORCE)
-    ELSE (HTLATEX_CONVERTER)
-      SET(USING_HTLATEX FALSE CACHE INTERNAL "True when using MiKTeX htlatex instead of latex2html" FORCE)
-    ENDIF (HTLATEX_CONVERTER)
-  ENDIF (NOT ${LATEX2HTML_CONVERTER})
-  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)."
-    )
-
-  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 PARENT_SCOPE)
-    SET(LATEX_OPPOSITE_RASTER_SCALE 100 PARENT_SCOPE)
-  ELSE (LATEX_SMALL_IMAGES)
-    SET(LATEX_RASTER_SCALE 100 PARENT_SCOPE)
-    SET(LATEX_OPPOSITE_RASTER_SCALE 16 PARENT_SCOPE)
-  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_OTHER_VECTOR_IMAGE_EXTENSIONS .svg CACHE INTERNAL "")
-  SET(LATEX_OTHER_RASTER_IMAGE_EXTENSIONS .tif .tiff .gif CACHE INTERNAL "")
-  SET(LATEX_OTHER_IMAGE_EXTENSIONS
-    ${LATEX_OTHER_VECTOR_IMAGE_EXTENSIONS}
-    ${LATEX_OTHER_RASTER_IMAGE_EXTENSIONS}
-    CACHE INTERNAL ""
-    )
-
-  SET(LATEX_VECTOR_IMAGE_EXTENSIONS
-    ${LATEX_DVI_VECTOR_IMAGE_EXTENSIONS}
-    ${LATEX_PDF_VECTOR_IMAGE_EXTENSIONS}
-    ${LATEX_OTHER_VECTOR_IMAGE_EXTENSIONS}
-    CACHE INTERNAL ""
-    )
-  SET(LATEX_RASTER_IMAGE_EXTENSIONS
-    ${LATEX_DVI_RASTER_IMAGE_EXTENSIONS}
-    ${LATEX_PDF_RASTER_IMAGE_EXTENSIONS}
-    ${LATEX_OTHER_RASTER_IMAGE_EXTENSIONS}
-    CACHE INTERNAL ""
-    )
-  SET(LATEX_IMAGE_EXTENSIONS
-    ${LATEX_DVI_IMAGE_EXTENSIONS}
-    ${LATEX_PDF_IMAGE_EXTENSIONS}
-    ${LATEX_OTHER_IMAGE_EXTENSIONS}
-    CACHE INTERNAL ""
-    )
-ENDFUNCTION(LATEX_SETUP_VARIABLES)
-
-FUNCTION(LATEX_GET_OUTPUT_PATH var)
-  SET(latex_output_path)
-  IF (LATEX_OUTPUT_PATH)
-    GET_FILENAME_COMPONENT(
-      LATEX_OUTPUT_PATH_FULL "${LATEX_OUTPUT_PATH}" ABSOLUTE
-      )
-    IF ("${LATEX_OUTPUT_PATH_FULL}" 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_FULL}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
-      SET(latex_output_path "${LATEX_OUTPUT_PATH_FULL}")
-    ENDIF ("${LATEX_OUTPUT_PATH_FULL}" 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 (require_imagemagick_convert TRUE)
-  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 (require_imagemagick_convert FALSE)
-      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 (require_imagemagick_convert FALSE)
-      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")
-
-  IF (require_imagemagick_convert)
-    IF (IMAGEMAGICK_CONVERT)
-      STRING(TOLOWER ${IMAGEMAGICK_CONVERT} IMAGEMAGICK_CONVERT_LOWERCASE)
-      IF (${IMAGEMAGICK_CONVERT_LOWERCASE} MATCHES "system32[/\\\\]convert\\.exe")
-        MESSAGE(SEND_ERROR "IMAGEMAGICK_CONVERT set to Window's convert.exe for changing file systems rather than ImageMagick's convert for changing image formats.  Please make sure ImageMagick is installed (available at http://www.imagemagick.org) and its convert program is used for IMAGEMAGICK_CONVERT.  (It is helpful if ImageMagick's path is before the Windows system paths.)")
-      ELSE (${IMAGEMAGICK_CONVERT_LOWERCASE} MATCHES "system32[/\\\\]convert\\.exe")
-        SET (converter ${IMAGEMAGICK_CONVERT})
-      ENDIF (${IMAGEMAGICK_CONVERT_LOWERCASE} MATCHES "system32[/\\\\]convert\\.exe")
-    ELSE (IMAGEMAGICK_CONVERT)
-      MESSAGE(SEND_ERROR "Could not find convert program. Please download ImageMagick from http://www.imagemagick.org and install.")
-    ENDIF (IMAGEMAGICK_CONVERT)
-  ENDIF (require_imagemagick_convert)
-
-  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_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] [DEFAULT_PS] [NO_DEFAULT]\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;DEFAULT_PS;NO_DEFAULT;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}.aux
-    ${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$")
-      # Dependent .tex files might have their own .aux files created.  Make
-      # sure these get cleaned as well.  This might replicate the cleaning
-      # of the main .aux file, which is OK.
-      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_NO_DEFAULT OR LATEX_DEFAULT_PDF OR LATEX_DEFAULT_SAFEPDF OR DEFAULT_PS)
-    ADD_CUSTOM_TARGET(${dvi_target}
-      DEPENDS ${output_dir}/${LATEX_TARGET}.dvi)
-  ELSE (LATEX_NO_DEFAULT OR LATEX_DEFAULT_PDF OR LATEX_DEFAULT_SAFEPDF OR DEFAULT_PS)
-    ADD_CUSTOM_TARGET(${dvi_target} ALL
-      DEPENDS ${output_dir}/${LATEX_TARGET}.dvi)
-  ENDIF (LATEX_NO_DEFAULT OR LATEX_DEFAULT_PDF OR LATEX_DEFAULT_SAFEPDF OR DEFAULT_PS)
-
-  # 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)
-    IF (LATEX_DEFAULT_PS)
-      ADD_CUSTOM_TARGET(${ps_target} ALL
-        DEPENDS ${output_dir}/${LATEX_TARGET}.ps)
-    ELSE (LATEX_DEFAULT_PS)
-      ADD_CUSTOM_TARGET(${ps_target}
-        DEPENDS ${output_dir}/${LATEX_TARGET}.ps)
-    ENDIF (LATEX_DEFAULT_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)
-    IF (USING_HTLATEX)
-      # htlatex places the output in a different location
-      SET (HTML_OUTPUT "${output_dir}/${LATEX_TARGET}.html")
-    ELSE (USING_HTLATEX)
-      SET (HTML_OUTPUT "${output_dir}/${LATEX_TARGET}/${LATEX_TARGET}.html")
-    ENDIF (USING_HTLATEX)
-    ADD_CUSTOM_COMMAND(OUTPUT ${HTML_OUTPUT}
-      COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir}
-        ${LATEX2HTML_CONVERTER} ${LATEX2HTML_CONVERTER_FLAGS} ${LATEX_MAIN_INPUT}
-      DEPENDS ${output_dir}/${LATEX_TARGET}.tex
-      )
-    ADD_CUSTOM_TARGET(${html_target}
-      DEPENDS ${HTML_OUTPUT}
-      )
-    ADD_DEPENDENCIES(${html_target} ${dvi_target})
-  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})
-    LATEX_COPY_GLOBBED_FILES(${CMAKE_CURRENT_SOURCE_DIR}/*.fd  ${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)


-Wimplicit is part of -Wall and only makes noise with C++ and mingw

--- cmake/VcMacros.cmake
+++ cmake/VcMacros.cmake
@@ -204,7 +204,6 @@
       if(_add_warning_flags)
          set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -W -Wall -Wswitch -Wformat -Wchar-subscripts -Wparentheses -Wmultichar -Wtrigraphs -Wpointer-arith -Wcast-align -Wreturn-type -Wno-unused-function -ansi -pedantic -Wno-long-long -Wshadow")
          set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W -Wall -Wswitch -Wformat -Wchar-subscripts -Wparentheses -Wmultichar -Wtrigraphs -Wpointer-arith -Wcast-align -Wreturn-type -Wno-unused-function -ansi -pedantic -Wno-long-long -Wshadow")
-         AddCompilerFlag("-Wimplicit")
          AddCompilerFlag("-Wold-style-cast")
          AddCompilerFlag("-Wno-variadic-macros")
          if(Vc_GCC_VERSION VERSION_GREATER "4.5.2" AND Vc_GCC_VERSION VERSION_LESS "4.6.4")


fpta: temporary disable '-Wall' for MSVC.

--- cmake/compiler.cmake
+++ cmake/compiler.cmake
@@ -239,11 +239,13 @@
     add_definitions("-Doverride=")
   endif()

-  if (CC_HAS_WALL)
-    add_compile_flags("C;CXX" "-Wall")
-  endif()
-  if (CC_HAS_WEXTRA)
-    add_compile_flags("C;CXX" "-Wextra")
+  if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
+    if (CC_HAS_WALL)
+      add_compile_flags("C;CXX" "-Wall")
+    endif()
+    if (CC_HAS_WEXTRA)
+      add_compile_flags("C;CXX" "-Wextra")
+    endif()
   endif()

   if (CMAKE_COMPILER_IS_GNUCXX)


cmake: emu: Allow overriding the qemu binary

The xlnx-zcu102 qemu machine is the only one that supports a Cortex-R
processor.  However, its main CPUs are Cortex A53s which requires the
aarch64 qemu binary to run.

Signed-off-by: Bradley Bolen <a46f022a58b40f08f87b914d58da7dec46dba40c@lexmark.com>

--- cmake/emu/qemu.cmake
+++ cmake/emu/qemu.cmake
@@ -2,6 +2,8 @@

 if("${ARCH}" STREQUAL "x86")
   set_ifndef(QEMU_binary_suffix i386)
+elseif(DEFINED QEMU_ARCH)
+  set_ifndef(QEMU_binary_suffix ${QEMU_ARCH})
 else()
   set_ifndef(QEMU_binary_suffix ${ARCH})
 endif()


ENH: Update external module ITKIsotropicWavelets

```
git shortlog --no-merges  3f88e669..

Matt McCormick (3):
      BUG: Wrap VectorInverseFFTImageFilter with correct output type
      COMP: Wrap ImageToImageFilter base for VectorInverseFFTImageFilter
      STYLE: Use namespace itk in itkVectorInverseFFTImageFilter.hxx

Pablo Hernandez-Cerdan (1):
      COMP: Use macro ITKv5_CONST in VerifyInputInformation
```

--- Modules/Remote/IsotropicWavelets.remote.cmake
+++ Modules/Remote/IsotropicWavelets.remote.cmake
@@ -9,5 +9,5 @@
 "
   # Upstream repository was transfered from phcerdan to InsightSoftwareConsortium
   GIT_REPOSITORY ${git_protocol}://github.com/InsightSoftwareConsortium/ITKIsotropicWavelets.git
-  GIT_TAG 3f88e669f759cfb62d7ae6d5fc839974f24f480c
+  GIT_TAG 53aba7e7e44fa3acd5d456e7239035163c823ea8
 )


PROTON-1050: Bump .so version on master

PROTON-1050: Bump .so version on master

--- proton-c/soversion.cmake
+++ proton-c/soversion.cmake
@@ -1,2 +1,2 @@
-set (PN_LIB_SOMAJOR 5)
+set (PN_LIB_SOMAJOR 7)
 set (PN_LIB_SOMINOR "0.0")


Allow the passing of addational fmod lib names via FMOD_NAMES from the build envorment. This will allow one to pass via command line custom fmod lib names. ie: -DFMOD_NAMES:STRING:"fmod-4.44"

--- indra/cmake/FindFMOD.cmake
+++ indra/cmake/FindFMOD.cmake
@@ -11,8 +11,9 @@

 FIND_PATH(FMOD_INCLUDE_DIR fmod.h PATH_SUFFIXES fmod)

+SET(FMOD_NAMES ${FMOD_NAMES} fmod fmodvc fmod-3.75)
 FIND_LIBRARY(FMOD_LIBRARY
-  NAMES fmod fmodvc fmod-3.75
+  NAMES ${FMOD_NAMES}
   PATH_SUFFIXES fmod
   )