Updated find-qt script for MacOS

Updated find-qt script for MacOS

Former-commit-id: 22e85365ff01081ca1e8e0740650a14c51186ecc

--- cmake/qt4/FindQt4.cmake
+++ cmake/qt4/FindQt4.cmake
@@ -348,17 +348,17 @@
 # Use find_package( Qt4 COMPONENTS ... ) to enable modules
 if( Qt4_FIND_COMPONENTS )
   foreach( component ${Qt4_FIND_COMPONENTS} )
-    string( TOUPPER ${component} _COMPONENT )
-    set( QT_USE_${_COMPONENT} 1 )
+	string( TOUPPER ${component} _COMPONENT )
+	set( QT_USE_${_COMPONENT} 1 )
   endforeach()

   # To make sure we don't use QtCore or QtGui when not in COMPONENTS
   if(NOT QT_USE_QTCORE)
-    set( QT_DONT_USE_QTCORE 1 )
+	set( QT_DONT_USE_QTCORE 1 )
   endif()

   if(NOT QT_USE_QTGUI)
-    set( QT_DONT_USE_QTGUI 1 )
+	set( QT_DONT_USE_QTGUI 1 )
   endif()

 endif()
@@ -366,12 +366,12 @@
 # If Qt3 has already been found, fail.
 if(QT_QT_LIBRARY)
   if(Qt4_FIND_REQUIRED)
-    message( FATAL_ERROR "Qt3 and Qt4 cannot be used together in one project.  If switching to Qt4, the CMakeCache.txt needs to be cleaned.")
+	message( FATAL_ERROR "Qt3 and Qt4 cannot be used together in one project.  If switching to Qt4, the CMakeCache.txt needs to be cleaned.")
   else()
-    if(NOT Qt4_FIND_QUIETLY)
-      message( STATUS    "Qt3 and Qt4 cannot be used together in one project.  If switching to Qt4, the CMakeCache.txt needs to be cleaned.")
-    endif()
-    return()
+	if(NOT Qt4_FIND_QUIETLY)
+	  message( STATUS    "Qt3 and Qt4 cannot be used together in one project.  If switching to Qt4, the CMakeCache.txt needs to be cleaned.")
+	endif()
+	return()
   endif()
 endif()

@@ -394,85 +394,85 @@
   # here, this would lead to the imported Qt4-library targets not being resolved by cmake anymore.
   if (QT_${basename}_LIBRARY_RELEASE OR QT_${basename}_LIBRARY_DEBUG)

-    if(NOT TARGET Qt4::${_camelCaseBasename})
-      add_library(Qt4::${_camelCaseBasename} UNKNOWN IMPORTED )
-
-      if (QT_${basename}_LIBRARY_RELEASE)
-        set_property(TARGET Qt4::${_camelCaseBasename} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
-        if(QT_USE_FRAMEWORKS)
-          set_property(TARGET Qt4::${_camelCaseBasename}        PROPERTY IMPORTED_LOCATION_RELEASE "${QT_${basename}_LIBRARY_RELEASE}/${_camelCaseBasename}" )
-        else()
-          set_property(TARGET Qt4::${_camelCaseBasename}        PROPERTY IMPORTED_LOCATION_RELEASE "${QT_${basename}_LIBRARY_RELEASE}" )
-        endif()
-      endif ()
-
-      if (QT_${basename}_LIBRARY_DEBUG)
-        set_property(TARGET Qt4::${_camelCaseBasename} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
-        if(QT_USE_FRAMEWORKS)
-          set_property(TARGET Qt4::${_camelCaseBasename}        PROPERTY IMPORTED_LOCATION_DEBUG "${QT_${basename}_LIBRARY_DEBUG}/${_camelCaseBasename}" )
-        else()
-          set_property(TARGET Qt4::${_camelCaseBasename}        PROPERTY IMPORTED_LOCATION_DEBUG "${QT_${basename}_LIBRARY_DEBUG}" )
-        endif()
-      endif ()
-    endif()
-
-    # If QT_USE_IMPORTED_TARGETS is enabled, the QT_QTFOO_LIBRARY variables are set to point at these
-    # imported targets. This works better in general, and is also in almost all cases fully
-    # backward compatible. The only issue is when a project A which had this enabled then exports its
-    # libraries via export or export_library_dependencies(). In this case the libraries from project
-    # A will depend on the imported Qt targets, and the names of these imported targets will be stored
-    # in the dependency files on disk. This means when a project B then uses project A, these imported
-    # targets must be created again, otherwise e.g. "Qt4__QtCore" will be interpreted as name of a
-    # library file on disk, and not as a target, and linking will fail:
-    if(QT_USE_IMPORTED_TARGETS)
-        set(QT_${basename}_LIBRARY       Qt4::${_camelCaseBasename} )
-        set(QT_${basename}_LIBRARIES     Qt4::${_camelCaseBasename} )
-    else()
-
-      # if the release- as well as the debug-version of the library have been found:
-      if (QT_${basename}_LIBRARY_DEBUG AND QT_${basename}_LIBRARY_RELEASE)
-        # if the generator supports configuration types then set
-        # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value
-        if (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
-          set(QT_${basename}_LIBRARY       optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG})
-        else()
-          # if there are no configuration types and CMAKE_BUILD_TYPE has no value
-          # then just use the release libraries
-          set(QT_${basename}_LIBRARY       ${QT_${basename}_LIBRARY_RELEASE} )
-        endif()
-        set(QT_${basename}_LIBRARIES       optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG})
-      endif ()
-
-      # if only the release version was found, set the debug variable also to the release version
-      if (QT_${basename}_LIBRARY_RELEASE AND NOT QT_${basename}_LIBRARY_DEBUG)
-        set(QT_${basename}_LIBRARY_DEBUG ${QT_${basename}_LIBRARY_RELEASE})
-        set(QT_${basename}_LIBRARY       ${QT_${basename}_LIBRARY_RELEASE})
-        set(QT_${basename}_LIBRARIES     ${QT_${basename}_LIBRARY_RELEASE})
-      endif ()
-
-      # if only the debug version was found, set the release variable also to the debug version
-      if (QT_${basename}_LIBRARY_DEBUG AND NOT QT_${basename}_LIBRARY_RELEASE)
-        set(QT_${basename}_LIBRARY_RELEASE ${QT_${basename}_LIBRARY_DEBUG})
-        set(QT_${basename}_LIBRARY         ${QT_${basename}_LIBRARY_DEBUG})
-        set(QT_${basename}_LIBRARIES       ${QT_${basename}_LIBRARY_DEBUG})
-      endif ()
-
-      # put the value in the cache:
-      set(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY} CACHE STRING "The Qt ${basename} library" FORCE)
-
-    endif()
-
-    set(QT_${basename}_FOUND 1)
+	if(NOT TARGET Qt4::${_camelCaseBasename})
+	  add_library(Qt4::${_camelCaseBasename} UNKNOWN IMPORTED )
+
+	  if (QT_${basename}_LIBRARY_RELEASE)
+		set_property(TARGET Qt4::${_camelCaseBasename} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
+		if(QT_USE_FRAMEWORKS)
+		  set_property(TARGET Qt4::${_camelCaseBasename}        PROPERTY IMPORTED_LOCATION_RELEASE "${QT_${basename}_LIBRARY_RELEASE}/${_camelCaseBasename}" )
+		else()
+		  set_property(TARGET Qt4::${_camelCaseBasename}        PROPERTY IMPORTED_LOCATION_RELEASE "${QT_${basename}_LIBRARY_RELEASE}" )
+		endif()
+	  endif ()
+
+	  if (QT_${basename}_LIBRARY_DEBUG)
+		set_property(TARGET Qt4::${_camelCaseBasename} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
+		if(QT_USE_FRAMEWORKS)
+		  set_property(TARGET Qt4::${_camelCaseBasename}        PROPERTY IMPORTED_LOCATION_DEBUG "${QT_${basename}_LIBRARY_DEBUG}/${_camelCaseBasename}" )
+		else()
+		  set_property(TARGET Qt4::${_camelCaseBasename}        PROPERTY IMPORTED_LOCATION_DEBUG "${QT_${basename}_LIBRARY_DEBUG}" )
+		endif()
+	  endif ()
+	endif()
+
+	# If QT_USE_IMPORTED_TARGETS is enabled, the QT_QTFOO_LIBRARY variables are set to point at these
+	# imported targets. This works better in general, and is also in almost all cases fully
+	# backward compatible. The only issue is when a project A which had this enabled then exports its
+	# libraries via export or export_library_dependencies(). In this case the libraries from project
+	# A will depend on the imported Qt targets, and the names of these imported targets will be stored
+	# in the dependency files on disk. This means when a project B then uses project A, these imported
+	# targets must be created again, otherwise e.g. "Qt4__QtCore" will be interpreted as name of a
+	# library file on disk, and not as a target, and linking will fail:
+	if(QT_USE_IMPORTED_TARGETS)
+		set(QT_${basename}_LIBRARY       Qt4::${_camelCaseBasename} )
+		set(QT_${basename}_LIBRARIES     Qt4::${_camelCaseBasename} )
+	else()
+
+	  # if the release- as well as the debug-version of the library have been found:
+	  if (QT_${basename}_LIBRARY_DEBUG AND QT_${basename}_LIBRARY_RELEASE)
+		# if the generator supports configuration types then set
+		# optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value
+		if (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
+		  set(QT_${basename}_LIBRARY       optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG})
+		else()
+		  # if there are no configuration types and CMAKE_BUILD_TYPE has no value
+		  # then just use the release libraries
+		  set(QT_${basename}_LIBRARY       ${QT_${basename}_LIBRARY_RELEASE} )
+		endif()
+		set(QT_${basename}_LIBRARIES       optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG})
+	  endif ()
+
+	  # if only the release version was found, set the debug variable also to the release version
+	  if (QT_${basename}_LIBRARY_RELEASE AND NOT QT_${basename}_LIBRARY_DEBUG)
+		set(QT_${basename}_LIBRARY_DEBUG ${QT_${basename}_LIBRARY_RELEASE})
+		set(QT_${basename}_LIBRARY       ${QT_${basename}_LIBRARY_RELEASE})
+		set(QT_${basename}_LIBRARIES     ${QT_${basename}_LIBRARY_RELEASE})
+	  endif ()
+
+	  # if only the debug version was found, set the release variable also to the debug version
+	  if (QT_${basename}_LIBRARY_DEBUG AND NOT QT_${basename}_LIBRARY_RELEASE)
+		set(QT_${basename}_LIBRARY_RELEASE ${QT_${basename}_LIBRARY_DEBUG})
+		set(QT_${basename}_LIBRARY         ${QT_${basename}_LIBRARY_DEBUG})
+		set(QT_${basename}_LIBRARIES       ${QT_${basename}_LIBRARY_DEBUG})
+	  endif ()
+
+	  # put the value in the cache:
+	  set(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY} CACHE STRING "The Qt ${basename} library" FORCE)
+
+	endif()
+
+	set(QT_${basename}_FOUND 1)

   else ()

-    set(QT_${basename}_LIBRARY "" CACHE STRING "The Qt ${basename} library" FORCE)
+	set(QT_${basename}_LIBRARY "" CACHE STRING "The Qt ${basename} library" FORCE)

   endif ()

   if (QT_${basename}_INCLUDE_DIR)
-    #add the include directory to QT_INCLUDES
-    set(QT_INCLUDES "${QT_${basename}_INCLUDE_DIR}" ${QT_INCLUDES})
+	#add the include directory to QT_INCLUDES
+	set(QT_INCLUDES "${QT_${basename}_INCLUDE_DIR}" ${QT_INCLUDES})
   endif ()

   # Make variables changeble to the advanced user
@@ -481,12 +481,12 @@

 function(_QT4_QUERY_QMAKE VAR RESULT)
   execute_process(COMMAND "${QT_QMAKE_EXECUTABLE}" -query ${VAR}
-    RESULT_VARIABLE return_code
-    OUTPUT_VARIABLE output
-    OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE)
+	RESULT_VARIABLE return_code
+	OUTPUT_VARIABLE output
+	OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE)
   if(NOT return_code)
-    file(TO_CMAKE_PATH "${output}" output)
-    set(${RESULT} ${output} PARENT_SCOPE)
+	file(TO_CMAKE_PATH "${output}" output)
+	set(${RESULT} ${output} PARENT_SCOPE)
   endif()
 endfunction()

@@ -497,10 +497,10 @@
 # check for qmake
 # Debian uses qmake-qt4
 # macports' Qt uses qmake-mac
-find_program(QT_QMAKE_EXECUTABLE NAMES qmake4 qmake-qt4 qmake-mac
+find_program(QT_QMAKE_EXECUTABLE NAMES qmake4 qmake-qt4 qmake-mac qmake
   PATHS
-    ENV QTDIR
-    "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\${qt_install_version};InstallDir]"
+	ENV QTDIR
+	"[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\${qt_install_version};InstallDir]"
   PATH_SUFFIXES bin
   DOC "The qmake executable for the Qt installation to use"
 )
@@ -509,7 +509,7 @@
 if (QT_QMAKE_EXECUTABLE)

   if(QT_QMAKE_EXECUTABLE_LAST)
-    string(COMPARE NOTEQUAL "${QT_QMAKE_EXECUTABLE_LAST}" "${QT_QMAKE_EXECUTABLE}" QT_QMAKE_CHANGED)
+	string(COMPARE NOTEQUAL "${QT_QMAKE_EXECUTABLE_LAST}" "${QT_QMAKE_EXECUTABLE}" QT_QMAKE_CHANGED)
   endif()

   set(QT_QMAKE_EXECUTABLE_LAST "${QT_QMAKE_EXECUTABLE}" CACHE INTERNAL "" FORCE)
@@ -518,16 +518,16 @@

   # check for qt3 qmake and then try and find qmake4 or qmake-qt4 in the path
   if(NOT QTVERSION)
-    set(QT_QMAKE_EXECUTABLE NOTFOUND CACHE FILEPATH "" FORCE)
-    find_program(QT_QMAKE_EXECUTABLE NAMES qmake4 qmake-qt4 PATHS
-      "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/bin"
-      "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/bin"
-      $ENV{QTDIR}/bin
-      DOC "The qmake executable for the Qt installation to use"
-      )
-    if(QT_QMAKE_EXECUTABLE)
-      _qt4_query_qmake(QT_VERSION QTVERSION)
-    endif()
+	set(QT_QMAKE_EXECUTABLE NOTFOUND CACHE FILEPATH "" FORCE)
+	find_program(QT_QMAKE_EXECUTABLE NAMES qmake4 qmake-qt4 PATHS
+	  "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/bin"
+	  "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/bin"
+	  $ENV{QTDIR}/bin
+	  DOC "The qmake executable for the Qt installation to use"
+	  )
+	if(QT_QMAKE_EXECUTABLE)
+	  _qt4_query_qmake(QT_VERSION QTVERSION)
+	endif()
   endif()

 endif ()
@@ -537,143 +537,143 @@
   # ask qmake for the mkspecs directory
   # we do this first because QT_LIBINFIX might be set
   if (NOT QT_MKSPECS_DIR  OR  QT_QMAKE_CHANGED)
-    _qt4_query_qmake(QMAKE_MKSPECS qt_mkspecs_dirs)
-    # do not replace : on windows as it might be a drive letter
-    # and windows should already use ; as a separator
-    if(NOT WIN32)
-      string(REPLACE ":" ";" qt_mkspecs_dirs "${qt_mkspecs_dirs}")
-    endif()
-    set(qt_cross_paths)
-    foreach(qt_cross_path ${CMAKE_FIND_ROOT_PATH})
-      set(qt_cross_paths ${qt_cross_paths} "${qt_cross_path}/mkspecs")
-    endforeach()
-    set(QT_MKSPECS_DIR NOTFOUND)
-    find_path(QT_MKSPECS_DIR NAMES qconfig.pri
-      HINTS ${qt_cross_paths} ${qt_mkspecs_dirs}
-      DOC "The location of the Qt mkspecs containing qconfig.pri")
+	_qt4_query_qmake(QMAKE_MKSPECS qt_mkspecs_dirs)
+	# do not replace : on windows as it might be a drive letter
+	# and windows should already use ; as a separator
+	if(NOT WIN32)
+	  string(REPLACE ":" ";" qt_mkspecs_dirs "${qt_mkspecs_dirs}")
+	endif()
+	set(qt_cross_paths)
+	foreach(qt_cross_path ${CMAKE_FIND_ROOT_PATH})
+	  set(qt_cross_paths ${qt_cross_paths} "${qt_cross_path}/mkspecs")
+	endforeach()
+	set(QT_MKSPECS_DIR NOTFOUND)
+	find_path(QT_MKSPECS_DIR NAMES qconfig.pri
+	  HINTS ${qt_cross_paths} ${qt_mkspecs_dirs}
+	  DOC "The location of the Qt mkspecs containing qconfig.pri")
   endif()

   if(EXISTS "${QT_MKSPECS_DIR}/qconfig.pri")
-    file(READ ${QT_MKSPECS_DIR}/qconfig.pri _qconfig_FILE_contents)
-    string(REGEX MATCH "QT_CONFIG[^\n]+" QT_QCONFIG "${_qconfig_FILE_contents}")
-    string(REGEX MATCH "CONFIG[^\n]+" QT_CONFIG "${_qconfig_FILE_contents}")
-    string(REGEX MATCH "EDITION[^\n]+" QT_EDITION "${_qconfig_FILE_contents}")
-    string(REGEX MATCH "QT_LIBINFIX[^\n]+" _qconfig_qt_libinfix "${_qconfig_FILE_contents}")
-    string(REGEX REPLACE "QT_LIBINFIX *= *([^\n]*)" "\\1" QT_LIBINFIX "${_qconfig_qt_libinfix}")
+	file(READ ${QT_MKSPECS_DIR}/qconfig.pri _qconfig_FILE_contents)
+	string(REGEX MATCH "QT_CONFIG[^\n]+" QT_QCONFIG "${_qconfig_FILE_contents}")
+	string(REGEX MATCH "CONFIG[^\n]+" QT_CONFIG "${_qconfig_FILE_contents}")
+	string(REGEX MATCH "EDITION[^\n]+" QT_EDITION "${_qconfig_FILE_contents}")
+	string(REGEX MATCH "QT_LIBINFIX[^\n]+" _qconfig_qt_libinfix "${_qconfig_FILE_contents}")
+	string(REGEX REPLACE "QT_LIBINFIX *= *([^\n]*)" "\\1" QT_LIBINFIX "${_qconfig_qt_libinfix}")
   endif()
   if("${QT_EDITION}" MATCHES "DesktopLight")
-    set(QT_EDITION_DESKTOPLIGHT 1)
+	set(QT_EDITION_DESKTOPLIGHT 1)
   endif()

   # ask qmake for the library dir as a hint, then search for QtCore library and use that as a reference for finding the
   # others and for setting QT_LIBRARY_DIR
   if (NOT (QT_QTCORE_LIBRARY_RELEASE OR QT_QTCORE_LIBRARY_DEBUG)  OR QT_QMAKE_CHANGED)
-    _qt4_query_qmake(QT_INSTALL_LIBS QT_LIBRARY_DIR_TMP)
-    set(QT_QTCORE_LIBRARY_RELEASE NOTFOUND)
-    set(QT_QTCORE_LIBRARY_DEBUG NOTFOUND)
-    find_library(QT_QTCORE_LIBRARY_RELEASE
-                 NAMES QtCore${QT_LIBINFIX} QtCore${QT_LIBINFIX}4
-                 HINTS ${QT_LIBRARY_DIR_TMP}
-                 NO_DEFAULT_PATH
-        )
-    find_library(QT_QTCORE_LIBRARY_DEBUG
-                 NAMES QtCore${QT_LIBINFIX}_debug QtCore${QT_LIBINFIX}d QtCore${QT_LIBINFIX}d4
-                 HINTS ${QT_LIBRARY_DIR_TMP}
-                 NO_DEFAULT_PATH
-        )
-
-    if(NOT QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTCORE_LIBRARY_DEBUG)
-      find_library(QT_QTCORE_LIBRARY_RELEASE
-                   NAMES QtCore${QT_LIBINFIX} QtCore${QT_LIBINFIX}4
-                   HINTS ${QT_LIBRARY_DIR_TMP}
-          )
-      find_library(QT_QTCORE_LIBRARY_DEBUG
-                   NAMES QtCore${QT_LIBINFIX}_debug QtCore${QT_LIBINFIX}d QtCore${QT_LIBINFIX}d4
-                   HINTS ${QT_LIBRARY_DIR_TMP}
-          )
-    endif()
-
-    # try dropping a hint if trying to use Visual Studio with Qt built by mingw
-    if(NOT QT_QTCORE_LIBRARY_RELEASE AND MSVC)
-      if(EXISTS ${QT_LIBRARY_DIR_TMP}/libqtmain.a)
-        message( FATAL_ERROR "It appears you're trying to use Visual Studio with Qt built by mingw.  Those compilers do not produce code compatible with each other.")
-      endif()
-    endif()
+	_qt4_query_qmake(QT_INSTALL_LIBS QT_LIBRARY_DIR_TMP)
+	set(QT_QTCORE_LIBRARY_RELEASE NOTFOUND)
+	set(QT_QTCORE_LIBRARY_DEBUG NOTFOUND)
+	find_library(QT_QTCORE_LIBRARY_RELEASE
+				 NAMES QtCore${QT_LIBINFIX} QtCore${QT_LIBINFIX}4
+				 HINTS ${QT_LIBRARY_DIR_TMP}
+				 NO_DEFAULT_PATH
+		)
+	find_library(QT_QTCORE_LIBRARY_DEBUG
+				 NAMES QtCore${QT_LIBINFIX}_debug QtCore${QT_LIBINFIX}d QtCore${QT_LIBINFIX}d4
+				 HINTS ${QT_LIBRARY_DIR_TMP}
+				 NO_DEFAULT_PATH
+		)
+
+	if(NOT QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTCORE_LIBRARY_DEBUG)
+	  find_library(QT_QTCORE_LIBRARY_RELEASE
+				   NAMES QtCore${QT_LIBINFIX} QtCore${QT_LIBINFIX}4
+				   HINTS ${QT_LIBRARY_DIR_TMP}
+		  )
+	  find_library(QT_QTCORE_LIBRARY_DEBUG
+				   NAMES QtCore${QT_LIBINFIX}_debug QtCore${QT_LIBINFIX}d QtCore${QT_LIBINFIX}d4
+				   HINTS ${QT_LIBRARY_DIR_TMP}
+		  )
+	endif()
+
+	# try dropping a hint if trying to use Visual Studio with Qt built by mingw
+	if(NOT QT_QTCORE_LIBRARY_RELEASE AND MSVC)
+	  if(EXISTS ${QT_LIBRARY_DIR_TMP}/libqtmain.a)
+		message( FATAL_ERROR "It appears you're trying to use Visual Studio with Qt built by mingw.  Those compilers do not produce code compatible with each other.")
+	  endif()
+	endif()

   endif ()

   # set QT_LIBRARY_DIR based on location of QtCore found.
   if(QT_QTCORE_LIBRARY_RELEASE)
-    get_filename_component(QT_LIBRARY_DIR_TMP "${QT_QTCORE_LIBRARY_RELEASE}" PATH)
-    set(QT_LIBRARY_DIR ${QT_LIBRARY_DIR_TMP} CACHE INTERNAL "Qt library dir" FORCE)
-    set(QT_QTCORE_FOUND 1)
+	get_filename_component(QT_LIBRARY_DIR_TMP "${QT_QTCORE_LIBRARY_RELEASE}" PATH)
+	set(QT_LIBRARY_DIR ${QT_LIBRARY_DIR_TMP} CACHE INTERNAL "Qt library dir" FORCE)
+	set(QT_QTCORE_FOUND 1)
   elseif(QT_QTCORE_LIBRARY_DEBUG)
-    get_filename_component(QT_LIBRARY_DIR_TMP "${QT_QTCORE_LIBRARY_DEBUG}" PATH)
-    set(QT_LIBRARY_DIR ${QT_LIBRARY_DIR_TMP} CACHE INTERNAL "Qt library dir" FORCE)
-    set(QT_QTCORE_FOUND 1)
+	get_filename_component(QT_LIBRARY_DIR_TMP "${QT_QTCORE_LIBRARY_DEBUG}" PATH)
+	set(QT_LIBRARY_DIR ${QT_LIBRARY_DIR_TMP} CACHE INTERNAL "Qt library dir" FORCE)
+	set(QT_QTCORE_FOUND 1)
   else()
-    message(WARNING "${QT_QMAKE_EXECUTABLE} reported QT_INSTALL_LIBS as \"${QT_LIBRARY_DIR_TMP}\" "
-                    "but QtCore could not be found there.  "
-                    "Qt is NOT installed correctly for the target build environment.")
-    if(Qt4_FIND_REQUIRED)
-      message( FATAL_ERROR "Could NOT find QtCore. Check ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log for more details.")
-    endif()
+	message(WARNING "${QT_QMAKE_EXECUTABLE} reported QT_INSTALL_LIBS as \"${QT_LIBRARY_DIR_TMP}\" "
+					"but QtCore could not be found there.  "
+					"Qt is NOT installed correctly for the target build environment.")
+	if(Qt4_FIND_REQUIRED)
+	  message( FATAL_ERROR "Could NOT find QtCore. Check ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log for more details.")
+	endif()
   endif()

   # ask qmake for the binary dir
   if (NOT QT_BINARY_DIR  OR  QT_QMAKE_CHANGED)
-    _qt4_query_qmake(QT_INSTALL_BINS qt_bins)
-    set(QT_BINARY_DIR ${qt_bins} CACHE INTERNAL "" FORCE)
+	_qt4_query_qmake(QT_INSTALL_BINS qt_bins)
+	set(QT_BINARY_DIR ${qt_bins} CACHE INTERNAL "" FORCE)
   endif ()

   if (APPLE)
-    set(CMAKE_FIND_FRAMEWORK_OLD ${CMAKE_FIND_FRAMEWORK})
-    if (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework)
-      set(QT_USE_FRAMEWORKS ON CACHE INTERNAL "" FORCE)
-      set(CMAKE_FIND_FRAMEWORK FIRST)
-    else ()
-      set(QT_USE_FRAMEWORKS OFF CACHE INTERNAL "" FORCE)
-      set(CMAKE_FIND_FRAMEWORK LAST)
-    endif ()
+	set(CMAKE_FIND_FRAMEWORK_OLD ${CMAKE_FIND_FRAMEWORK})
+	if (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework)
+	  set(QT_USE_FRAMEWORKS ON CACHE INTERNAL "" FORCE)
+	  set(CMAKE_FIND_FRAMEWORK FIRST)
+	else ()
+	  set(QT_USE_FRAMEWORKS OFF CACHE INTERNAL "" FORCE)
+	  set(CMAKE_FIND_FRAMEWORK LAST)
+	endif ()
   endif ()

   # ask qmake for the include dir
   if (QT_LIBRARY_DIR AND (NOT QT_QTCORE_INCLUDE_DIR OR NOT QT_HEADERS_DIR OR  QT_QMAKE_CHANGED))
-      _qt4_query_qmake(QT_INSTALL_HEADERS qt_headers)
-      set(QT_QTCORE_INCLUDE_DIR NOTFOUND)
-      find_path(QT_QTCORE_INCLUDE_DIR QtCore
-                HINTS ${qt_headers} ${QT_LIBRARY_DIR}
-                PATH_SUFFIXES QtCore qt4/QtCore
-        )
-
-      # Set QT_HEADERS_DIR based on finding QtCore header
-      if(QT_QTCORE_INCLUDE_DIR)
-        if(QT_USE_FRAMEWORKS)
-          set(QT_HEADERS_DIR "${qt_headers}" CACHE INTERNAL "" FORCE)
-        else()
-          get_filename_component(qt_headers "${QT_QTCORE_INCLUDE_DIR}/../" ABSOLUTE)
-          set(QT_HEADERS_DIR "${qt_headers}" CACHE INTERNAL "" FORCE)
-        endif()
-      elseif()
-        message("Warning: QT_QMAKE_EXECUTABLE reported QT_INSTALL_HEADERS as ${qt_headers}")
-        message("Warning: But QtCore couldn't be found.  Qt must NOT be installed correctly.")
-      endif()
+	  _qt4_query_qmake(QT_INSTALL_HEADERS qt_headers)
+	  set(QT_QTCORE_INCLUDE_DIR NOTFOUND)
+	  find_path(QT_QTCORE_INCLUDE_DIR QtCore
+				HINTS ${qt_headers} ${QT_LIBRARY_DIR}
+				PATH_SUFFIXES QtCore qt4/QtCore
+		)
+
+	  # Set QT_HEADERS_DIR based on finding QtCore header
+	  if(QT_QTCORE_INCLUDE_DIR)
+		if(QT_USE_FRAMEWORKS)
+		  set(QT_HEADERS_DIR "${qt_headers}" CACHE INTERNAL "" FORCE)
+		else()
+		  get_filename_component(qt_headers "${QT_QTCORE_INCLUDE_DIR}/../" ABSOLUTE)
+		  set(QT_HEADERS_DIR "${qt_headers}" CACHE INTERNAL "" FORCE)
+		endif()
+	  elseif()
+		message("Warning: QT_QMAKE_EXECUTABLE reported QT_INSTALL_HEADERS as ${qt_headers}")
+		message("Warning: But QtCore couldn't be found.  Qt must NOT be installed correctly.")
+	  endif()
   endif()

   if(APPLE)
-    set(CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_OLD})
+	set(CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_OLD})
   endif()

   # Set QT_INCLUDE_DIR based on QT_HEADERS_DIR
   if(QT_HEADERS_DIR)
-    if(QT_USE_FRAMEWORKS)
-      # Qt/Mac frameworks has two include dirs.
-      # One is the framework include for which CMake will add a -F flag
-      # and the other is an include dir for non-framework Qt modules
-      set(QT_INCLUDE_DIR ${QT_HEADERS_DIR} ${QT_QTCORE_LIBRARY_RELEASE} )
-    else()
-      set(QT_INCLUDE_DIR ${QT_HEADERS_DIR})
-    endif()
+	if(QT_USE_FRAMEWORKS)
+	  # Qt/Mac frameworks has two include dirs.
+	  # One is the framework include for which CMake will add a -F flag
+	  # and the other is an include dir for non-framework Qt modules
+	  set(QT_INCLUDE_DIR ${QT_HEADERS_DIR} ${QT_QTCORE_LIBRARY_RELEASE} )
+	else()
+	  set(QT_INCLUDE_DIR ${QT_HEADERS_DIR})
+	endif()
   endif()

   # Set QT_INCLUDES
@@ -682,49 +682,49 @@

   # ask qmake for the documentation directory
   if (QT_LIBRARY_DIR AND NOT QT_DOC_DIR  OR  QT_QMAKE_CHANGED)
-    _qt4_query_qmake(QT_INSTALL_DOCS qt_doc_dir)
-    set(QT_DOC_DIR ${qt_doc_dir} CACHE PATH "The location of the Qt docs" FORCE)
+	_qt4_query_qmake(QT_INSTALL_DOCS qt_doc_dir)
+	set(QT_DOC_DIR ${qt_doc_dir} CACHE PATH "The location of the Qt docs" FORCE)
   endif ()

   # ask qmake for the plugins directory
   if (QT_LIBRARY_DIR AND NOT QT_PLUGINS_DIR  OR  QT_QMAKE_CHANGED)
-    _qt4_query_qmake(QT_INSTALL_PLUGINS qt_plugins_dir)
-    set(QT_PLUGINS_DIR NOTFOUND)
-    foreach(qt_cross_path ${CMAKE_FIND_ROOT_PATH})
-      set(qt_cross_paths ${qt_cross_paths} "${qt_cross_path}/plugins")
-    endforeach()
-    find_path(QT_PLUGINS_DIR NAMES accessible imageformats sqldrivers codecs designer
-      HINTS ${qt_cross_paths} ${qt_plugins_dir}
-      DOC "The location of the Qt plugins")
+	_qt4_query_qmake(QT_INSTALL_PLUGINS qt_plugins_dir)
+	set(QT_PLUGINS_DIR NOTFOUND)
+	foreach(qt_cross_path ${CMAKE_FIND_ROOT_PATH})
+	  set(qt_cross_paths ${qt_cross_paths} "${qt_cross_path}/plugins")
+	endforeach()
+	find_path(QT_PLUGINS_DIR NAMES accessible imageformats sqldrivers codecs designer
+	  HINTS ${qt_cross_paths} ${qt_plugins_dir}
+	  DOC "The location of the Qt plugins")
   endif ()

   # ask qmake for the translations directory
   if (QT_LIBRARY_DIR AND NOT QT_TRANSLATIONS_DIR  OR  QT_QMAKE_CHANGED)
-    _qt4_query_qmake(QT_INSTALL_TRANSLATIONS qt_translations_dir)
-    set(QT_TRANSLATIONS_DIR ${qt_translations_dir} CACHE PATH "The location of the Qt translations" FORCE)
+	_qt4_query_qmake(QT_INSTALL_TRANSLATIONS qt_translations_dir)
+	set(QT_TRANSLATIONS_DIR ${qt_translations_dir} CACHE PATH "The location of the Qt translations" FORCE)
   endif ()

   # ask qmake for the imports directory
   if (QT_LIBRARY_DIR AND NOT QT_IMPORTS_DIR OR QT_QMAKE_CHANGED)
-    _qt4_query_qmake(QT_INSTALL_IMPORTS qt_imports_dir)
-    if(qt_imports_dir)
-      set(QT_IMPORTS_DIR "${qt_imports_dir}")
-      foreach(qt_cross_path ${CMAKE_FIND_ROOT_PATH})
-        set(qt_cross_paths ${qt_cross_paths} "${qt_cross_path}/imports")
-      endforeach()
-      find_path(QT_IMPORTS_DIR NAMES Qt
-        HINTS ${qt_cross_paths} ${qt_imports_dir}
-        DOC "The location of the Qt imports"
-        NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH
-        NO_CMAKE_SYSTEM_PATH)
-      mark_as_advanced(QT_IMPORTS_DIR)
-    endif()
+	_qt4_query_qmake(QT_INSTALL_IMPORTS qt_imports_dir)
+	if(qt_imports_dir)
+	  set(QT_IMPORTS_DIR "${qt_imports_dir}")
+	  foreach(qt_cross_path ${CMAKE_FIND_ROOT_PATH})
+		set(qt_cross_paths ${qt_cross_paths} "${qt_cross_path}/imports")
+	  endforeach()
+	  find_path(QT_IMPORTS_DIR NAMES Qt
+		HINTS ${qt_cross_paths} ${qt_imports_dir}
+		DOC "The location of the Qt imports"
+		NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH
+		NO_CMAKE_SYSTEM_PATH)
+	  mark_as_advanced(QT_IMPORTS_DIR)
+	endif()
   endif ()

   # Make variables changeble to the advanced user
   mark_as_advanced( QT_LIBRARY_DIR QT_DOC_DIR QT_MKSPECS_DIR
-                    QT_PLUGINS_DIR QT_TRANSLATIONS_DIR)
+					QT_PLUGINS_DIR QT_TRANSLATIONS_DIR)

@@ -745,17 +745,17 @@
   CHECK_CXX_SYMBOL_EXISTS(Q_WS_QWS "QtCore/qglobal.h" Q_WS_QWS)
   CHECK_CXX_SYMBOL_EXISTS(Q_WS_MAC "QtCore/qglobal.h" Q_WS_MAC)
   if(Q_WS_MAC)
-    if(QT_QMAKE_CHANGED)
-      unset(QT_MAC_USE_COCOA CACHE)
-    endif()
-    CHECK_CXX_SYMBOL_EXISTS(QT_MAC_USE_COCOA "QtCore/qconfig.h" QT_MAC_USE_COCOA)
+	if(QT_QMAKE_CHANGED)
+	  unset(QT_MAC_USE_COCOA CACHE)
+	endif()
+	CHECK_CXX_SYMBOL_EXISTS(QT_MAC_USE_COCOA "QtCore/qconfig.h" QT_MAC_USE_COCOA)
   endif()

   if (QT_QTCOPY_REQUIRED)
-     CHECK_CXX_SYMBOL_EXISTS(QT_IS_QTCOPY "QtCore/qglobal.h" QT_KDE_QT_COPY)
-     if (NOT QT_IS_QTCOPY)
-        message(FATAL_ERROR "qt-copy is required, but hasn't been found")
-     endif ()
+	 CHECK_CXX_SYMBOL_EXISTS(QT_IS_QTCOPY "QtCore/qglobal.h" QT_KDE_QT_COPY)
+	 if (NOT QT_IS_QTCOPY)
+		message(FATAL_ERROR "qt-copy is required, but hasn't been found")
+	 endif ()
   endif ()

   # Restore CMAKE_REQUIRED_INCLUDES and CMAKE_REQUIRED_FLAGS variables
@@ -773,100 +773,100 @@
   ########################################

   set(QT_MODULES QtGui Qt3Support QtSvg QtScript QtTest QtUiTools
-                 QtHelp QtWebKit QtXmlPatterns phonon QtNetwork QtMultimedia
-                 QtNsPlugin QtOpenGL QtSql QtXml QtDesigner QtDBus QtScriptTools
-                 QtDeclarative)
+				 QtHelp QtWebKit QtXmlPatterns phonon QtNetwork QtMultimedia
+				 QtNsPlugin QtOpenGL QtSql QtXml QtDesigner QtDBus QtScriptTools
+				 QtDeclarative)

   if(Q_WS_X11)
-    set(QT_MODULES ${QT_MODULES} QtMotif)
+	set(QT_MODULES ${QT_MODULES} QtMotif)
   endif()

   if(QT_QMAKE_CHANGED)
-    foreach(QT_MODULE ${QT_MODULES})
-      string(TOUPPER ${QT_MODULE} _upper_qt_module)
-      set(QT_${_upper_qt_module}_INCLUDE_DIR NOTFOUND)
-      set(QT_${_upper_qt_module}_LIBRARY_RELEASE NOTFOUND)
-      set(QT_${_upper_qt_module}_LIBRARY_DEBUG NOTFOUND)
-    endforeach()
-    set(QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR NOTFOUND)
-    set(QT_QTDESIGNERCOMPONENTS_LIBRARY_RELEASE NOTFOUND)
-    set(QT_QTDESIGNERCOMPONENTS_LIBRARY_DEBUG NOTFOUND)
-    set(QT_QTASSISTANTCLIENT_INCLUDE_DIR NOTFOUND)
-    set(QT_QTASSISTANTCLIENT_LIBRARY_RELEASE NOTFOUND)
-    set(QT_QTASSISTANTCLIENT_LIBRARY_DEBUG NOTFOUND)
-    set(QT_QTASSISTANT_INCLUDE_DIR NOTFOUND)
-    set(QT_QTASSISTANT_LIBRARY_RELEASE NOTFOUND)
-    set(QT_QTASSISTANT_LIBRARY_DEBUG NOTFOUND)
-    set(QT_QTCLUCENE_LIBRARY_RELEASE NOTFOUND)
-    set(QT_QTCLUCENE_LIBRARY_DEBUG NOTFOUND)
-    set(QT_QAXCONTAINER_INCLUDE_DIR NOTFOUND)
-    set(QT_QAXCONTAINER_LIBRARY_RELEASE NOTFOUND)
-    set(QT_QAXCONTAINER_LIBRARY_DEBUG NOTFOUND)
-    set(QT_QAXSERVER_INCLUDE_DIR NOTFOUND)
-    set(QT_QAXSERVER_LIBRARY_RELEASE NOTFOUND)
-    set(QT_QAXSERVER_LIBRARY_DEBUG NOTFOUND)
-    if(Q_WS_WIN)
-      set(QT_QTMAIN_LIBRARY_DEBUG NOTFOUND)
-      set(QT_QTMAIN_LIBRARY_RELEASE NOTFOUND)
-    endif()
+	foreach(QT_MODULE ${QT_MODULES})
+	  string(TOUPPER ${QT_MODULE} _upper_qt_module)
+	  set(QT_${_upper_qt_module}_INCLUDE_DIR NOTFOUND)
+	  set(QT_${_upper_qt_module}_LIBRARY_RELEASE NOTFOUND)
+	  set(QT_${_upper_qt_module}_LIBRARY_DEBUG NOTFOUND)
+	endforeach()
+	set(QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR NOTFOUND)
+	set(QT_QTDESIGNERCOMPONENTS_LIBRARY_RELEASE NOTFOUND)
+	set(QT_QTDESIGNERCOMPONENTS_LIBRARY_DEBUG NOTFOUND)
+	set(QT_QTASSISTANTCLIENT_INCLUDE_DIR NOTFOUND)
+	set(QT_QTASSISTANTCLIENT_LIBRARY_RELEASE NOTFOUND)
+	set(QT_QTASSISTANTCLIENT_LIBRARY_DEBUG NOTFOUND)
+	set(QT_QTASSISTANT_INCLUDE_DIR NOTFOUND)
+	set(QT_QTASSISTANT_LIBRARY_RELEASE NOTFOUND)
+	set(QT_QTASSISTANT_LIBRARY_DEBUG NOTFOUND)
+	set(QT_QTCLUCENE_LIBRARY_RELEASE NOTFOUND)
+	set(QT_QTCLUCENE_LIBRARY_DEBUG NOTFOUND)
+	set(QT_QAXCONTAINER_INCLUDE_DIR NOTFOUND)
+	set(QT_QAXCONTAINER_LIBRARY_RELEASE NOTFOUND)
+	set(QT_QAXCONTAINER_LIBRARY_DEBUG NOTFOUND)
+	set(QT_QAXSERVER_INCLUDE_DIR NOTFOUND)
+	set(QT_QAXSERVER_LIBRARY_RELEASE NOTFOUND)
+	set(QT_QAXSERVER_LIBRARY_DEBUG NOTFOUND)
+	if(Q_WS_WIN)
+	  set(QT_QTMAIN_LIBRARY_DEBUG NOTFOUND)
+	  set(QT_QTMAIN_LIBRARY_RELEASE NOTFOUND)
+	endif()
   endif()

   foreach(QT_MODULE ${QT_MODULES})
-    string(TOUPPER ${QT_MODULE} _upper_qt_module)
-    find_path(QT_${_upper_qt_module}_INCLUDE_DIR ${QT_MODULE}
-              PATHS
-              ${QT_HEADERS_DIR}/${QT_MODULE}
-              ${QT_LIBRARY_DIR}/${QT_MODULE}.framework/Headers
-              NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
-      )
-    # phonon doesn't seem consistent, let's try phonondefs.h for some
-    # installations
-    if(${QT_MODULE} STREQUAL "phonon")
-      find_path(QT_${_upper_qt_module}_INCLUDE_DIR phonondefs.h
-                PATHS
-                ${QT_HEADERS_DIR}/${QT_MODULE}
-                ${QT_LIBRARY_DIR}/${QT_MODULE}.framework/Headers
-                NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
-        )
-    endif()
+	string(TOUPPER ${QT_MODULE} _upper_qt_module)
+	find_path(QT_${_upper_qt_module}_INCLUDE_DIR ${QT_MODULE}
+			  PATHS
+			  ${QT_HEADERS_DIR}/${QT_MODULE}
+			  ${QT_LIBRARY_DIR}/${QT_MODULE}.framework/Headers
+			  NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+	  )
+	# phonon doesn't seem consistent, let's try phonondefs.h for some
+	# installations
+	if(${QT_MODULE} STREQUAL "phonon")
+	  find_path(QT_${_upper_qt_module}_INCLUDE_DIR phonondefs.h
+				PATHS
+				${QT_HEADERS_DIR}/${QT_MODULE}
+				${QT_LIBRARY_DIR}/${QT_MODULE}.framework/Headers
+				NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+		)
+	endif()
   endforeach()

   if(Q_WS_WIN)
-    set(QT_MODULES ${QT_MODULES} QAxContainer QAxServer)
-    # Set QT_AXCONTAINER_INCLUDE_DIR and QT_AXSERVER_INCLUDE_DIR
-    find_path(QT_QAXCONTAINER_INCLUDE_DIR ActiveQt
-      PATHS ${QT_HEADERS_DIR}/ActiveQt
-      NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
-      )
-    find_path(QT_QAXSERVER_INCLUDE_DIR ActiveQt
-      PATHS ${QT_HEADERS_DIR}/ActiveQt
-      NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
-      )
+	set(QT_MODULES ${QT_MODULES} QAxContainer QAxServer)
+	# Set QT_AXCONTAINER_INCLUDE_DIR and QT_AXSERVER_INCLUDE_DIR
+	find_path(QT_QAXCONTAINER_INCLUDE_DIR ActiveQt
+	  PATHS ${QT_HEADERS_DIR}/ActiveQt
+	  NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+	  )
+	find_path(QT_QAXSERVER_INCLUDE_DIR ActiveQt
+	  PATHS ${QT_HEADERS_DIR}/ActiveQt
+	  NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+	  )
   endif()

   # Set QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR
   find_path(QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR QDesignerComponents
-    PATHS
-    ${QT_HEADERS_DIR}/QtDesigner
-    ${QT_LIBRARY_DIR}/QtDesigner.framework/Headers
-    NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
-    )
+	PATHS
+	${QT_HEADERS_DIR}/QtDesigner
+	${QT_LIBRARY_DIR}/QtDesigner.framework/Headers
+	NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+	)

   # Set QT_QTASSISTANT_INCLUDE_DIR
   find_path(QT_QTASSISTANT_INCLUDE_DIR QtAssistant
-    PATHS
-    ${QT_HEADERS_DIR}/QtAssistant
-    ${QT_LIBRARY_DIR}/QtAssistant.framework/Headers
-    NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
-    )
+	PATHS
+	${QT_HEADERS_DIR}/QtAssistant
+	${QT_LIBRARY_DIR}/QtAssistant.framework/Headers
+	NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+	)

   # Set QT_QTASSISTANTCLIENT_INCLUDE_DIR
   find_path(QT_QTASSISTANTCLIENT_INCLUDE_DIR QAssistantClient
-    PATHS
-    ${QT_HEADERS_DIR}/QtAssistant
-    ${QT_LIBRARY_DIR}/QtAssistant.framework/Headers
-    NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
-    )
+	PATHS
+	${QT_HEADERS_DIR}/QtAssistant
+	${QT_LIBRARY_DIR}/QtAssistant.framework/Headers
+	NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+	)

   ########################################
   #
@@ -876,33 +876,33 @@

   # find the libraries
   foreach(QT_MODULE ${QT_MODULES})
-    string(TOUPPER ${QT_MODULE} _upper_qt_module)
-    find_library(QT_${_upper_qt_module}_LIBRARY_RELEASE
-                 NAMES ${QT_MODULE}${QT_LIBINFIX} ${QT_MODULE}${QT_LIBINFIX}4
-                 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
-        )
-    find_library(QT_${_upper_qt_module}_LIBRARY_DEBUG
-                 NAMES ${QT_MODULE}${QT_LIBINFIX}_debug ${QT_MODULE}${QT_LIBINFIX}d ${QT_MODULE}${QT_LIBINFIX}d4
-                 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
-        )
-    if(QT_${_upper_qt_module}_LIBRARY_RELEASE MATCHES "/${QT_MODULE}\\.framework$")
-      if(NOT EXISTS "${QT_${_upper_qt_module}_LIBRARY_RELEASE}/${QT_MODULE}")
-        # Release framework library file does not exist... Force to NOTFOUND:
-        set(QT_${_upper_qt_module}_LIBRARY_RELEASE "QT_${_upper_qt_module}_LIBRARY_RELEASE-NOTFOUND" CACHE FILEPATH "Path to a library." FORCE)
-      endif()
-    endif()
-    if(QT_${_upper_qt_module}_LIBRARY_DEBUG MATCHES "/${QT_MODULE}\\.framework$")
-      if(NOT EXISTS "${QT_${_upper_qt_module}_LIBRARY_DEBUG}/${QT_MODULE}")
-        # Debug framework library file does not exist... Force to NOTFOUND:
-        set(QT_${_upper_qt_module}_LIBRARY_DEBUG "QT_${_upper_qt_module}_LIBRARY_DEBUG-NOTFOUND" CACHE FILEPATH "Path to a library." FORCE)
-      endif()
-    endif()
+	string(TOUPPER ${QT_MODULE} _upper_qt_module)
+	find_library(QT_${_upper_qt_module}_LIBRARY_RELEASE
+				 NAMES ${QT_MODULE}${QT_LIBINFIX} ${QT_MODULE}${QT_LIBINFIX}4
+				 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+		)
+	find_library(QT_${_upper_qt_module}_LIBRARY_DEBUG
+				 NAMES ${QT_MODULE}${QT_LIBINFIX}_debug ${QT_MODULE}${QT_LIBINFIX}d ${QT_MODULE}${QT_LIBINFIX}d4
+				 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+		)
+	if(QT_${_upper_qt_module}_LIBRARY_RELEASE MATCHES "/${QT_MODULE}\\.framework$")
+	  if(NOT EXISTS "${QT_${_upper_qt_module}_LIBRARY_RELEASE}/${QT_MODULE}")
+		# Release framework library file does not exist... Force to NOTFOUND:
+		set(QT_${_upper_qt_module}_LIBRARY_RELEASE "QT_${_upper_qt_module}_LIBRARY_RELEASE-NOTFOUND" CACHE FILEPATH "Path to a library." FORCE)
+	  endif()
+	endif()
+	if(QT_${_upper_qt_module}_LIBRARY_DEBUG MATCHES "/${QT_MODULE}\\.framework$")
+	  if(NOT EXISTS "${QT_${_upper_qt_module}_LIBRARY_DEBUG}/${QT_MODULE}")
+		# Debug framework library file does not exist... Force to NOTFOUND:
+		set(QT_${_upper_qt_module}_LIBRARY_DEBUG "QT_${_upper_qt_module}_LIBRARY_DEBUG-NOTFOUND" CACHE FILEPATH "Path to a library." FORCE)
+	  endif()
+	endif()
   endforeach()

   # QtUiTools is sometimes not in the same directory as the other found libraries
   # e.g. on Mac, its never a framework like the others are
   if(QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTUITOOLS_LIBRARY_RELEASE)
-    find_library(QT_QTUITOOLS_LIBRARY_RELEASE NAMES QtUiTools${QT_LIBINFIX} PATHS ${QT_LIBRARY_DIR})
+	find_library(QT_QTUITOOLS_LIBRARY_RELEASE NAMES QtUiTools${QT_LIBINFIX} PATHS ${QT_LIBRARY_DIR})
   endif()

   # Set QT_QTDESIGNERCOMPONENTS_LIBRARY
@@ -911,8 +911,8 @@

   # Set QT_QTMAIN_LIBRARY
   if(Q_WS_WIN)
-    find_library(QT_QTMAIN_LIBRARY_RELEASE NAMES qtmain${QT_LIBINFIX} PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
-    find_library(QT_QTMAIN_LIBRARY_DEBUG NAMES qtmain${QT_LIBINFIX}d PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+	find_library(QT_QTMAIN_LIBRARY_RELEASE NAMES qtmain${QT_LIBINFIX} PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+	find_library(QT_QTMAIN_LIBRARY_DEBUG NAMES qtmain${QT_LIBINFIX}d PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
   endif()

   # Set QT_QTASSISTANTCLIENT_LIBRARY
@@ -927,7 +927,7 @@
   find_library(QT_QTCLUCENE_LIBRARY_RELEASE NAMES QtCLucene${QT_LIBINFIX} QtCLucene${QT_LIBINFIX}4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
   find_library(QT_QTCLUCENE_LIBRARY_DEBUG   NAMES QtCLucene${QT_LIBINFIX}_debug QtCLucene${QT_LIBINFIX}d QtCLucene${QT_LIBINFIX}d4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
   if(Q_WS_MAC AND QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTCLUCENE_LIBRARY_RELEASE)
-    find_library(QT_QTCLUCENE_LIBRARY_RELEASE NAMES QtCLucene${QT_LIBINFIX} PATHS ${QT_LIBRARY_DIR})
+	find_library(QT_QTCLUCENE_LIBRARY_RELEASE NAMES QtCLucene${QT_LIBINFIX} PATHS ${QT_LIBRARY_DIR})
   endif()

@@ -943,7 +943,7 @@
   _QT4_ADJUST_LIB_VARS(QtCore)

   foreach(QT_MODULE ${QT_MODULES})
-    _QT4_ADJUST_LIB_VARS(${QT_MODULE})
+	_QT4_ADJUST_LIB_VARS(${QT_MODULE})
   endforeach()

   _QT4_ADJUST_LIB_VARS(QtAssistant)
@@ -953,9 +953,9 @@

   # platform dependent libraries
   if(Q_WS_WIN)
-    _QT4_ADJUST_LIB_VARS(qtmain)
-    _QT4_ADJUST_LIB_VARS(QAxServer)
-    _QT4_ADJUST_LIB_VARS(QAxContainer)
+	_QT4_ADJUST_LIB_VARS(qtmain)
+	_QT4_ADJUST_LIB_VARS(QAxServer)
+	_QT4_ADJUST_LIB_VARS(QAxContainer)
   endif()

@@ -968,99 +968,99 @@

   if(QT_QMAKE_CHANGED)
-    set(QT_UIC_EXECUTABLE NOTFOUND)
-    set(QT_MOC_EXECUTABLE NOTFOUND)
-    set(QT_UIC3_EXECUTABLE NOTFOUND)
-    set(QT_RCC_EXECUTABLE NOTFOUND)
-    set(QT_DBUSCPP2XML_EXECUTABLE NOTFOUND)
-    set(QT_DBUSXML2CPP_EXECUTABLE NOTFOUND)
-    set(QT_LUPDATE_EXECUTABLE NOTFOUND)
-    set(QT_LRELEASE_EXECUTABLE NOTFOUND)
-    set(QT_QCOLLECTIONGENERATOR_EXECUTABLE NOTFOUND)
-    set(QT_DESIGNER_EXECUTABLE NOTFOUND)
-    set(QT_LINGUIST_EXECUTABLE NOTFOUND)
+	set(QT_UIC_EXECUTABLE NOTFOUND)
+	set(QT_MOC_EXECUTABLE NOTFOUND)
+	set(QT_UIC3_EXECUTABLE NOTFOUND)
+	set(QT_RCC_EXECUTABLE NOTFOUND)
+	set(QT_DBUSCPP2XML_EXECUTABLE NOTFOUND)
+	set(QT_DBUSXML2CPP_EXECUTABLE NOTFOUND)
+	set(QT_LUPDATE_EXECUTABLE NOTFOUND)
+	set(QT_LRELEASE_EXECUTABLE NOTFOUND)
+	set(QT_QCOLLECTIONGENERATOR_EXECUTABLE NOTFOUND)
+	set(QT_DESIGNER_EXECUTABLE NOTFOUND)
+	set(QT_LINGUIST_EXECUTABLE NOTFOUND)
   endif()

   find_program(QT_MOC_EXECUTABLE
-    NAMES moc-qt4 moc
-    PATHS ${QT_BINARY_DIR}
-    NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
-    )
+	NAMES moc-qt4 moc
+	PATHS ${QT_BINARY_DIR}
+	NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+	)

   find_program(QT_UIC_EXECUTABLE
-    NAMES uic-qt4 uic
-    PATHS ${QT_BINARY_DIR}
-    NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
-    )
+	NAMES uic-qt4 uic
+	PATHS ${QT_BINARY_DIR}
+	NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+	)

   find_program(QT_UIC3_EXECUTABLE
-    NAMES uic3
-    PATHS ${QT_BINARY_DIR}
-    NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
-    )
+	NAMES uic3
+	PATHS ${QT_BINARY_DIR}
+	NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+	)

   find_program(QT_RCC_EXECUTABLE
-    NAMES rcc
-    PATHS ${QT_BINARY_DIR}
-    NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
-    )
+	NAMES rcc
+	PATHS ${QT_BINARY_DIR}
+	NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+	)

   find_program(QT_DBUSCPP2XML_EXECUTABLE
-    NAMES qdbuscpp2xml
-    PATHS ${QT_BINARY_DIR}
-    NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
-    )
+	NAMES qdbuscpp2xml
+	PATHS ${QT_BINARY_DIR}
+	NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+	)

   find_program(QT_DBUSXML2CPP_EXECUTABLE
-    NAMES qdbusxml2cpp
-    PATHS ${QT_BINARY_DIR}
-    NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
-    )
+	NAMES qdbusxml2cpp
+	PATHS ${QT_BINARY_DIR}
+	NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+	)

   find_program(QT_LUPDATE_EXECUTABLE
-    NAMES lupdate-qt4 lupdate
-    PATHS ${QT_BINARY_DIR}
-    NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
-    )
+	NAMES lupdate-qt4 lupdate
+	PATHS ${QT_BINARY_DIR}
+	NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+	)

   find_program(QT_LRELEASE_EXECUTABLE
-    NAMES lrelease-qt4 lrelease
-    PATHS ${QT_BINARY_DIR}
-    NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
-    )
+	NAMES lrelease-qt4 lrelease
+	PATHS ${QT_BINARY_DIR}
+	NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+	)

   find_program(QT_QCOLLECTIONGENERATOR_EXECUTABLE
-    NAMES qcollectiongenerator-qt4 qcollectiongenerator
-    PATHS ${QT_BINARY_DIR}
-    NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
-    )
+	NAMES qcollectiongenerator-qt4 qcollectiongenerator
+	PATHS ${QT_BINARY_DIR}
+	NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+	)

   find_program(QT_DESIGNER_EXECUTABLE
-    NAMES designer-qt4 designer
-    PATHS ${QT_BINARY_DIR}
-    NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
-    )
+	NAMES designer-qt4 designer
+	PATHS ${QT_BINARY_DIR}
+	NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+	)

   find_program(QT_LINGUIST_EXECUTABLE
-    NAMES linguist-qt4 linguist
-    PATHS ${QT_BINARY_DIR}
-    NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
-    )
+	NAMES linguist-qt4 linguist
+	PATHS ${QT_BINARY_DIR}
+	NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+	)

   if (QT_MOC_EXECUTABLE)
-     set(QT_WRAP_CPP "YES")
+	 set(QT_WRAP_CPP "YES")
   endif ()

   if (QT_UIC_EXECUTABLE)
-     set(QT_WRAP_UI "YES")
+	 set(QT_WRAP_UI "YES")
   endif ()

   mark_as_advanced( QT_UIC_EXECUTABLE QT_UIC3_EXECUTABLE QT_MOC_EXECUTABLE
-    QT_RCC_EXECUTABLE QT_DBUSXML2CPP_EXECUTABLE QT_DBUSCPP2XML_EXECUTABLE
-    QT_LUPDATE_EXECUTABLE QT_LRELEASE_EXECUTABLE QT_QCOLLECTIONGENERATOR_EXECUTABLE
-    QT_DESIGNER_EXECUTABLE QT_LINGUIST_EXECUTABLE)
+	QT_RCC_EXECUTABLE QT_DBUSXML2CPP_EXECUTABLE QT_DBUSCPP2XML_EXECUTABLE
+	QT_LUPDATE_EXECUTABLE QT_LRELEASE_EXECUTABLE QT_QCOLLECTIONGENERATOR_EXECUTABLE
+	QT_DESIGNER_EXECUTABLE QT_LINGUIST_EXECUTABLE)

   # get the directory of the current file, used later on in the file
@@ -1096,9 +1096,9 @@
   set( QT_INPUTMETHODS_PLUGINS qimsw_multi )
   set( QT_MOUSEDRIVERS_PLUGINS qwstslibmousehandler )
   if(APPLE)
-    set( QT_PHONON_BACKEND_PLUGINS phonon_qt7 )
+	set( QT_PHONON_BACKEND_PLUGINS phonon_qt7 )
   elseif(WIN32)
-    set( QT_PHONON_BACKEND_PLUGINS phonon_ds9 )
+	set( QT_PHONON_BACKEND_PLUGINS phonon_ds9 )
   endif()
   set( QT_SCRIPT_PLUGINS qtscriptdbus )
   set( QT_SQLDRIVERS_PLUGINS qsqldb2 qsqlibase qsqlite qsqlite2 qsqlmysql qsqloci qsqlodbc qsqlpsql qsqltds )
@@ -1112,53 +1112,53 @@
   set( QT_QTSVG_PLUGINS qsvg qsvgicon )

   if(QT_QMAKE_CHANGED)
-    foreach(QT_PLUGIN_TYPE ${QT_PLUGIN_TYPES})
-      string(TOUPPER ${QT_PLUGIN_TYPE} _upper_qt_plugin_type)
-      set(QT_${_upper_qt_plugin_type}_PLUGINS_DIR ${QT_PLUGINS_DIR}/${QT_PLUGIN_TYPE})
-      foreach(QT_PLUGIN ${QT_${_upper_qt_plugin_type}_PLUGINS})
-        string(TOUPPER ${QT_PLUGIN} _upper_qt_plugin)
-        unset(QT_${_upper_qt_plugin}_LIBRARY_RELEASE CACHE)
-        unset(QT_${_upper_qt_plugin}_LIBRARY_DEBUG CACHE)
-        unset(QT_${_upper_qt_plugin}_LIBRARY CACHE)
-        unset(QT_${_upper_qt_plugin}_PLUGIN_RELEASE CACHE)
-        unset(QT_${_upper_qt_plugin}_PLUGIN_DEBUG CACHE)
-        unset(QT_${_upper_qt_plugin}_PLUGIN CACHE)
-      endforeach()
-    endforeach()
+	foreach(QT_PLUGIN_TYPE ${QT_PLUGIN_TYPES})
+	  string(TOUPPER ${QT_PLUGIN_TYPE} _upper_qt_plugin_type)
+	  set(QT_${_upper_qt_plugin_type}_PLUGINS_DIR ${QT_PLUGINS_DIR}/${QT_PLUGIN_TYPE})
+	  foreach(QT_PLUGIN ${QT_${_upper_qt_plugin_type}_PLUGINS})
+		string(TOUPPER ${QT_PLUGIN} _upper_qt_plugin)
+		unset(QT_${_upper_qt_plugin}_LIBRARY_RELEASE CACHE)
+		unset(QT_${_upper_qt_plugin}_LIBRARY_DEBUG CACHE)
+		unset(QT_${_upper_qt_plugin}_LIBRARY CACHE)
+		unset(QT_${_upper_qt_plugin}_PLUGIN_RELEASE CACHE)
+		unset(QT_${_upper_qt_plugin}_PLUGIN_DEBUG CACHE)
+		unset(QT_${_upper_qt_plugin}_PLUGIN CACHE)
+	  endforeach()
+	endforeach()
   endif()

   # find_library works better than find_file but we need to set prefixes to only match plugins
   foreach(QT_PLUGIN_TYPE ${QT_PLUGIN_TYPES})
-    string(TOUPPER ${QT_PLUGIN_TYPE} _upper_qt_plugin_type)
-    set(QT_${_upper_qt_plugin_type}_PLUGINS_DIR ${QT_PLUGINS_DIR}/${QT_PLUGIN_TYPE})
-    foreach(QT_PLUGIN ${QT_${_upper_qt_plugin_type}_PLUGINS})
-      string(TOUPPER ${QT_PLUGIN} _upper_qt_plugin)
-      if(QT_IS_STATIC)
-        find_library(QT_${_upper_qt_plugin}_LIBRARY_RELEASE
-                     NAMES ${QT_PLUGIN}${QT_LIBINFIX} ${QT_PLUGIN}${QT_LIBINFIX}4
-                     PATHS ${QT_${_upper_qt_plugin_type}_PLUGINS_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
-            )
-        find_library(QT_${_upper_qt_plugin}_LIBRARY_DEBUG
-                     NAMES ${QT_PLUGIN}${QT_LIBINFIX}_debug ${QT_PLUGIN}${QT_LIBINFIX}d ${QT_PLUGIN}${QT_LIBINFIX}d4
-                     PATHS ${QT_${_upper_qt_plugin_type}_PLUGINS_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
-            )
-        _QT4_ADJUST_LIB_VARS(${QT_PLUGIN})
-      else()
-        # find_library works easier/better than find_file but we need to set suffixes to only match plugins
-        set(CMAKE_FIND_LIBRARY_SUFFIXES_DEFAULT ${CMAKE_FIND_LIBRARY_SUFFIXES})
-        set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_MODULE_SUFFIX} ${CMAKE_SHARED_LIBRARY_SUFFIX})
-        find_library(QT_${_upper_qt_plugin}_PLUGIN_RELEASE
-                     NAMES ${QT_PLUGIN}${QT_LIBINFIX} ${QT_PLUGIN}${QT_LIBINFIX}4
-                     PATHS ${QT_${_upper_qt_plugin_type}_PLUGINS_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
-            )
-        find_library(QT_${_upper_qt_plugin}_PLUGIN_DEBUG
-                     NAMES ${QT_PLUGIN}${QT_LIBINFIX}_debug ${QT_PLUGIN}${QT_LIBINFIX}d ${QT_PLUGIN}${QT_LIBINFIX}d4
-                     PATHS ${QT_${_upper_qt_plugin_type}_PLUGINS_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
-            )
-        mark_as_advanced(QT_${_upper_qt_plugin}_PLUGIN_RELEASE QT_${_upper_qt_plugin}_PLUGIN_DEBUG)
-        set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_DEFAULT})
-      endif()
-    endforeach()
+	string(TOUPPER ${QT_PLUGIN_TYPE} _upper_qt_plugin_type)
+	set(QT_${_upper_qt_plugin_type}_PLUGINS_DIR ${QT_PLUGINS_DIR}/${QT_PLUGIN_TYPE})
+	foreach(QT_PLUGIN ${QT_${_upper_qt_plugin_type}_PLUGINS})
+	  string(TOUPPER ${QT_PLUGIN} _upper_qt_plugin)
+	  if(QT_IS_STATIC)
+		find_library(QT_${_upper_qt_plugin}_LIBRARY_RELEASE
+					 NAMES ${QT_PLUGIN}${QT_LIBINFIX} ${QT_PLUGIN}${QT_LIBINFIX}4
+					 PATHS ${QT_${_upper_qt_plugin_type}_PLUGINS_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+			)
+		find_library(QT_${_upper_qt_plugin}_LIBRARY_DEBUG
+					 NAMES ${QT_PLUGIN}${QT_LIBINFIX}_debug ${QT_PLUGIN}${QT_LIBINFIX}d ${QT_PLUGIN}${QT_LIBINFIX}d4
+					 PATHS ${QT_${_upper_qt_plugin_type}_PLUGINS_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+			)
+		_QT4_ADJUST_LIB_VARS(${QT_PLUGIN})
+	  else()
+		# find_library works easier/better than find_file but we need to set suffixes to only match plugins
+		set(CMAKE_FIND_LIBRARY_SUFFIXES_DEFAULT ${CMAKE_FIND_LIBRARY_SUFFIXES})
+		set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_MODULE_SUFFIX} ${CMAKE_SHARED_LIBRARY_SUFFIX})
+		find_library(QT_${_upper_qt_plugin}_PLUGIN_RELEASE
+					 NAMES ${QT_PLUGIN}${QT_LIBINFIX} ${QT_PLUGIN}${QT_LIBINFIX}4
+					 PATHS ${QT_${_upper_qt_plugin_type}_PLUGINS_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+			)
+		find_library(QT_${_upper_qt_plugin}_PLUGIN_DEBUG
+					 NAMES ${QT_PLUGIN}${QT_LIBINFIX}_debug ${QT_PLUGIN}${QT_LIBINFIX}d ${QT_PLUGIN}${QT_LIBINFIX}d4
+					 PATHS ${QT_${_upper_qt_plugin_type}_PLUGINS_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
+			)
+		mark_as_advanced(QT_${_upper_qt_plugin}_PLUGIN_RELEASE QT_${_upper_qt_plugin}_PLUGIN_DEBUG)
+		set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_DEFAULT})
+	  endif()
+	endforeach()
   endforeach()

@@ -1187,43 +1187,43 @@
   # if components specified in find_package(), make sure each of those pieces were found
   set(_QT4_FOUND_REQUIRED_VARS QT_QMAKE_EXECUTABLE QT_MOC_EXECUTABLE QT_RCC_EXECUTABLE QT_INCLUDE_DIR QT_LIBRARY_DIR)
   foreach( component ${Qt4_FIND_COMPONENTS} )
-    string( TOUPPER ${component} _COMPONENT )
-    if(${_COMPONENT} STREQUAL "QTMAIN")
-      if(Q_WS_WIN)
-        set(_QT4_FOUND_REQUIRED_VARS ${_QT4_FOUND_REQUIRED_VARS} QT_${_COMPONENT}_LIBRARY)
-      endif()
-    else()
-      set(_QT4_FOUND_REQUIRED_VARS ${_QT4_FOUND_REQUIRED_VARS} QT_${_COMPONENT}_INCLUDE_DIR QT_${_COMPONENT}_LIBRARY)
-    endif()
+	string( TOUPPER ${component} _COMPONENT )
+	if(${_COMPONENT} STREQUAL "QTMAIN")
+	  if(Q_WS_WIN)
+		set(_QT4_FOUND_REQUIRED_VARS ${_QT4_FOUND_REQUIRED_VARS} QT_${_COMPONENT}_LIBRARY)
+	  endif()
+	else()
+	  set(_QT4_FOUND_REQUIRED_VARS ${_QT4_FOUND_REQUIRED_VARS} QT_${_COMPONENT}_INCLUDE_DIR QT_${_COMPONENT}_LIBRARY)
+	endif()
   endforeach()

   if(Qt4_FIND_COMPONENTS MATCHES QtGui)
-    set(_QT4_FOUND_REQUIRED_VARS ${_QT4_FOUND_REQUIRED_VARS} QT_UIC_EXECUTABLE)
+	set(_QT4_FOUND_REQUIRED_VARS ${_QT4_FOUND_REQUIRED_VARS} QT_UIC_EXECUTABLE)
   endif()

 else()

   # if no components specified, we'll make a default set of required variables to say Qt is found
   set(_QT4_FOUND_REQUIRED_VARS QT_QMAKE_EXECUTABLE QT_MOC_EXECUTABLE QT_RCC_EXECUTABLE QT_UIC_EXECUTABLE QT_INCLUDE_DIR
-    QT_LIBRARY_DIR QT_QTCORE_LIBRARY)
+	QT_LIBRARY_DIR QT_QTCORE_LIBRARY)

 endif()

 if (QT_VERSION_MAJOR GREATER 4)
-    set(VERSION_MSG "Found unsuitable Qt version \"${QTVERSION}\" from ${QT_QMAKE_EXECUTABLE}")
-    set(QT4_FOUND FALSE)
-    if(Qt4_FIND_REQUIRED)
-       message( FATAL_ERROR "${VERSION_MSG}, this code requires Qt 4.x")
-    else()
-      if(NOT Qt4_FIND_QUIETLY)
-         message( STATUS    "${VERSION_MSG}")
-      endif()
-    endif()
+	set(VERSION_MSG "Found unsuitable Qt version \"${QTVERSION}\" from ${QT_QMAKE_EXECUTABLE}")
+	set(QT4_FOUND FALSE)
+	if(Qt4_FIND_REQUIRED)
+	   message( FATAL_ERROR "${VERSION_MSG}, this code requires Qt 4.x")
+	else()
+	  if(NOT Qt4_FIND_QUIETLY)
+		 message( STATUS    "${VERSION_MSG}")
+	  endif()
+	endif()
 else()
   FIND_PACKAGE_HANDLE_STANDARD_ARGS(Qt4
-    REQUIRED_VARS ${_QT4_FOUND_REQUIRED_VARS}
-    VERSION_VAR QTVERSION
-    )
+	REQUIRED_VARS ${_QT4_FOUND_REQUIRED_VARS}
+	VERSION_VAR QTVERSION
+	)
 endif()

 #######################################


fix missing space in message

fix missing space in message

--- rosidl_cmake/cmake/rosidl_target_interfaces.cmake
+++ rosidl_cmake/cmake/rosidl_target_interfaces.cmake
@@ -41,8 +41,8 @@
   endif()
   set(typesupport_target "${interface_target}__${typesupport_name}")
   if(NOT TARGET ${typesupport_target})
-    message(FATAL_ERROR "rosidl_target_interfaces() the second argument concattenated with the third argument using"
-      "double underscores must be a valid target name")
+    message(FATAL_ERROR "rosidl_target_interfaces() the second argument concattenated "
+      "with the third argument using double underscores must be a valid target name")
   endif()

   add_dependencies(${target} ${interface_target})


Make Boost a test required TPL in the Search subpackage rather than a lib required package

--- packages/Search/cmake/Dependencies.cmake
+++ packages/Search/cmake/Dependencies.cmake
@@ -6,6 +6,6 @@
   Shards
   Teuchos
   Tpetra
-  LIB_REQUIRED_TPLS
+  TEST_REQUIRED_TPLS
   Boost
   )


fixed compile warning for windows

fixed compile warning for windows

--- common/cmake/msvc.cmake
+++ common/cmake/msvc.cmake
@@ -42,6 +42,7 @@

 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /Qdiag-disable:11082 ")  # warning #11082: locally defined symbol XXX imported
 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /IGNORE:4217")  # locally defined symbol XXX imported in function YYY (happens as the ISPC API layer uses exported library functions)
+SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /IGNORE:4049")  # warning LNK4049: locally defined symbol _rtcOccluded1M imported
 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /IGNORE:4044")  # warning LNK4044: unrecognized option '/Qdiag-disable:11082'; ignored
 SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /DEBUG")


CMake: simplify build rules for compiler-rt unit tests. This fixes warnings in Ninja build tree.

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

--- cmake/Modules/AddCompilerRT.cmake
+++ cmake/Modules/AddCompilerRT.cmake
@@ -114,12 +114,10 @@
 macro(add_compiler_rt_test test_suite test_name)
   parse_arguments(TEST "OBJECTS;DEPS;LINK_FLAGS" "" ${ARGN})
   set(output_bin "${CMAKE_CURRENT_BINARY_DIR}/${test_name}")
-  add_custom_command(
-    OUTPUT ${output_bin}
+  add_custom_target(${test_name}
     COMMAND clang ${TEST_OBJECTS} -o "${output_bin}"
             ${TEST_LINK_FLAGS}
     DEPENDS clang ${TEST_DEPS})
-  add_custom_target(${test_name} DEPENDS ${output_bin})
   # Make the test suite depend on the binary.
   add_dependencies(${test_suite} ${test_name})
 endmacro()


[CMake][compiler-rt] Mark libcxx build  for tsan as standalone

This is to ensure that the libcxx build is properly configured.

Differential Revision: https://reviews.llvm.org/D28579

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

--- cmake/Modules/AddCompilerRT.cmake
+++ cmake/Modules/AddCompilerRT.cmake
@@ -380,6 +380,7 @@
                -DCMAKE_BUILD_TYPE=Release
                -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
                -DLLVM_PATH=${LLVM_MAIN_SRC_DIR}
+               -DLIBCXX_STANDALONE_BUILD=On
     LOG_BUILD 1
     LOG_CONFIGURE 1
     LOG_INSTALL 1


Escape special characters before using source/build dirs in regex

If "^${CMAKE_SOURCE_DIR}" contains special characters, the regular
expression will break with an error like this for Garfield++:

RegularExpression::compile(): Nested *?+.
RegularExpression::compile(): Error in compile.
CMake Error at .../RootNewMacros.cmake:288 (if):
  if given arguments:

    "NOT" "IS_ABSOLUTE" "incdir"
    "OR" "incdir" "MATCHES" "^/<...>/src/Garfield++/HEAD"
    "OR" "incdir" "MATCHES" "^"
    "OR" "incdir" "MATCHES" "^"

  Regular expression
  "^/<...>/src/Garfield++/HEAD"
  cannot compile
Call Stack (most recent call first):
  CMakeLists.txt:118 (ROOT_GENERATE_DICTIONARY)

Also, the (current) build directory is CMAKE_(CURRENT_)BINARY_DIR.
Related Jira issue: ROOT-10210.

--- cmake/modules/RootNewMacros.cmake
+++ cmake/modules/RootNewMacros.cmake
@@ -290,11 +290,14 @@
       else()
         set(incdirs_in_build)
         set(incdirs_in_prefix)
+        string(REGEX REPLACE "([][+.*()^])" "\\\\\\1" _source_dir "${CMAKE_SOURCE_DIR}")
+        string(REGEX REPLACE "([][+.*()^])" "\\\\\\1" _binary_dir "${CMAKE_BINARY_DIR}")
+        string(REGEX REPLACE "([][+.*()^])" "\\\\\\1" _curr_binary_dir "${CMAKE_CURRENT_BINARY_DIR}")
         foreach(incdir ${incdirs})
-          if(NOT IS_ABSOLUTE incdir
-             OR incdir MATCHES "^${CMAKE_SOURCE_DIR}"
-             OR incdir MATCHES "^${CMAKE_CURRENT_BUILD_DIR}"
-             OR incdir MATCHES "^${CMAKE_BUILD_DIR}")
+          if(NOT IS_ABSOLUTE ${incdir}
+             OR ${incdir} MATCHES "^${_source_dir}"
+             OR ${incdir} MATCHES "^${_binary_dir}"
+             OR ${incdir} MATCHES "^${_curr_binary_dir}")
             list(APPEND incdirs_in_build
                  ${incdir})
           else()


ZMQPP becomes cachable

ZMQPP becomes cachable

--- cmake/projects/ZMQPP/hunter.cmake
+++ cmake/projects/ZMQPP/hunter.cmake
@@ -5,6 +5,7 @@
 endif()

 include(hunter_add_version)
+include(hunter_cacheable)
 include(hunter_download)
 include(hunter_pick_scheme)

@@ -20,5 +21,5 @@
   )

 hunter_pick_scheme(DEFAULT url_sha1_cmake)
-
+hunter_cacheable(ZMQPP)
 hunter_download(PACKAGE_NAME ZMQPP)


update nanogui git commit

update nanogui git commit

--- cmakemodules/script_nanogui.cmake
+++ cmakemodules/script_nanogui.cmake
@@ -34,7 +34,7 @@
 ExternalProject_Add(EP_nanogui
 	PREFIX ${nanogui_PREFIX}
 	GIT_REPOSITORY https://github.com/MRPT/nanogui.git
-	GIT_TAG 9cca0fc3045fc80a489e07bca96bacec8bfbbeb7
+	GIT_TAG 811b8884e08b0192f96fb7ff248077b89dc1c9fe
 	GIT_SUBMODULES ext/eigen ext/glfw ext/nanovg # ext/pybind
 	UPDATE_DISCONNECTED 1
 	CMAKE_ARGS ${nanogui_CMAKE_ARGS}


config.h.cmake: Reorder along config.h.in.

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

--- include/llvm/Config/config.h.cmake
+++ include/llvm/Config/config.h.cmake
@@ -196,9 +196,6 @@
 /* Define to 1 if you have the `udis86' library (-ludis86). */
 #undef HAVE_LIBUDIS86

-/* Type of 1st arg on ELM Callback */
-#cmakedefine WIN32_ELMCB_PCSTR ${WIN32_ELMCB_PCSTR}
-
 /* Define to 1 if you have the <limits.h> header file. */
 #cmakedefine HAVE_LIMITS_H ${HAVE_LIMITS_H}

@@ -437,6 +434,12 @@
 /* Define to 1 if you have the <termios.h> header file. */
 #cmakedefine HAVE_TERMIOS_H ${HAVE_TERMIOS_H}

+/* Define if the neat program is available */
+#cmakedefine HAVE_TWOPI ${HAVE_TWOPI}
+
+/* Define to 1 if the system has the type `uint64_t'. */
+#cmakedefine HAVE_UINT64_T ${HAVE_UINT64_T}
+
 /* Define to 1 if you have the <unistd.h> header file. */
 #cmakedefine HAVE_UNISTD_H ${HAVE_UNISTD_H}

@@ -551,14 +554,14 @@
 /* LLVM name for the native AsmPrinter init function, if available */
 #cmakedefine LLVM_NATIVE_ASMPRINTER LLVMInitialize${LLVM_NATIVE_ARCH}AsmPrinter

+/* LLVM name for the native TargetMC init function, if available */
+#cmakedefine LLVM_NATIVE_TARGETMC LLVMInitialize${LLVM_NATIVE_ARCH}TargetInfo
+
 /* LLVM name for the native Target init function, if available */
 #cmakedefine LLVM_NATIVE_TARGET LLVMInitialize${LLVM_NATIVE_ARCH}Target

 /* LLVM name for the native TargetInfo init function, if available */
 #cmakedefine LLVM_NATIVE_TARGETINFO LLVMInitialize${LLVM_NATIVE_ARCH}TargetInfo
-
-/* LLVM name for the native TargetMC init function, if available */
-#cmakedefine LLVM_NATIVE_TARGETMC LLVMInitialize${LLVM_NATIVE_ARCH}TargetInfo

 /* Define if this is Unixish platform */
 #cmakedefine LLVM_ON_UNIX ${LLVM_ON_UNIX}
@@ -637,6 +640,39 @@

 /* Define as the return type of signal handlers (`int' or `void'). */
 #cmakedefine RETSIGTYPE ${RETSIGTYPE}
+
+/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
+#undef STAT_MACROS_BROKEN
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#undef TIME_WITH_SYS_TIME
+
+/* Define to 1 if your <sys/time.h> declares `struct tm'. */
+#undef TM_IN_SYS_TIME
+
+/* Define if we have the oprofile JIT-support library */
+#undef USE_OPROFILE
+
+/* Define if use udis86 library */
+#undef USE_UDIS86
+
+/* Type of 1st arg on ELM Callback */
+#cmakedefine WIN32_ELMCB_PCSTR ${WIN32_ELMCB_PCSTR}
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Define to a type to use for `error_t' if it is not otherwise available. */
+#cmakedefine error_t ${error_t}
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef pid_t
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+#undef size_t

 /* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
 #undef STAT_MACROS_BROKEN
@@ -649,42 +685,6 @@
 	STACK_DIRECTION = 0 => direction of growth unknown */
 #undef STACK_DIRECTION

-/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
-#undef STAT_MACROS_BROKEN
-
-/* Define to 1 if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
-/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
-#undef TIME_WITH_SYS_TIME
-
-/* Define to 1 if your <sys/time.h> declares `struct tm'. */
-#undef TM_IN_SYS_TIME
-
-/* Define if we have the oprofile JIT-support library */
-#undef USE_OPROFILE
-
-/* Define if use udis86 library */
-#undef USE_UDIS86
-
-/* Define to empty if `const' does not conform to ANSI C. */
-#undef const
-
-/* Define to a type to use for `error_t' if it is not otherwise available. */
-#cmakedefine error_t ${error_t}
-
-/* Define to `int' if <sys/types.h> does not define. */
-#undef pid_t
-
-/* Define to `unsigned int' if <sys/types.h> does not define. */
-#undef size_t
-
-/* Define if the neat program is available */
-#cmakedefine HAVE_TWOPI ${HAVE_TWOPI}
-
-/* Define to 1 if the system has the type `uint64_t'. */
-#cmakedefine HAVE_UINT64_T ${HAVE_UINT64_T}
-
 /* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
    `char[]'. */
 #undef YYTEXT_POINTER


Merging r213966:
------------------------------------------------------------------------
r213966 | brad | 2014-07-25 12:28:44 -0700 (Fri, 25 Jul 2014) | 4 lines

Fix arc4random detection.

Patch by Pascal Stumpf.

------------------------------------------------------------------------

git-svn-id: 1a981f132218c5d985e5b5a896e7a8b8201781d6@214749 91177308-0d34-0410-b5e6-96231b3b80d8

--- include/llvm/Config/config.h.cmake
+++ include/llvm/Config/config.h.cmake
@@ -25,7 +25,7 @@
 #cmakedefine ENABLE_TIMESTAMPS ${ENABLE_TIMESTAMPS}

 /* Define to 1 if you have the `arc4random' function. */
-#cmakedefine HAVE_ARC4RANDOM
+#cmakedefine HAVE_DECL_ARC4RANDOM ${HAVE_DECL_ARC4RANDOM}

 /* Define to 1 if you have the `backtrace' function. */
 #cmakedefine HAVE_BACKTRACE ${HAVE_BACKTRACE}


improved FindHDF5 (patch by M-P Sonnemann, resolves #262)

--- config/FindHDF5.cmake
+++ config/FindHDF5.cmake
@@ -33,33 +33,39 @@
     else()
         MESSAGE( STATUS "HDF5: need at least version ${HDF5_VERSION_MAJOR}.${HDF5_VERSION_MINOR}" )
     endif()
+
+    if(HDF5_SUFFICIENT_VERSION)
+        # Only test for HDF5 features if a suitable version of the library was
+        # found previously.

-    set(HDF5_USES_ZLIB FALSE)
-    TRY_COMPILE(HDF5_USES_ZLIB
-               ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/config/checkHDF5usesCompression.c
-               COMPILE_DEFINITIONS "-DH5_SOMETHING=H5_HAVE_FILTER_DEFLATE"
-               CMAKE_FLAGS "${HDF5_TRY_COMPILE_INCLUDE_DIR}")
+        set(HDF5_USES_ZLIB FALSE)
+        TRY_COMPILE(HDF5_USES_ZLIB
+                   ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/config/checkHDF5usesCompression.c
+                   COMPILE_DEFINITIONS "-DH5_SOMETHING=H5_HAVE_FILTER_DEFLATE"
+                   CMAKE_FLAGS "${HDF5_TRY_COMPILE_INCLUDE_DIR}")

-    if(HDF5_USES_ZLIB)
-        FIND_LIBRARY(HDF5_Z_LIBRARY NAMES zlib1 zlib z )
-        set(HDF5_ZLIB_OK ${HDF5_Z_LIBRARY})
-    else()
-        set(HDF5_ZLIB_OK TRUE)
-        set(HDF5_Z_LIBRARY "")
-    endif()
+        if(HDF5_USES_ZLIB)
+            FIND_LIBRARY(HDF5_Z_LIBRARY NAMES zlib1 zlib z )
+            set(HDF5_ZLIB_OK ${HDF5_Z_LIBRARY})
+        else()
+            set(HDF5_ZLIB_OK TRUE)
+            set(HDF5_Z_LIBRARY "")
+        endif()

-    set(HDF5_USES_SZLIB FALSE)
-    TRY_COMPILE(HDF5_USES_SZLIB
-                ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/config/checkHDF5usesCompression.c
-                COMPILE_DEFINITIONS "-DH5_SOMETHING=H5_HAVE_FILTER_SZIP"
-                CMAKE_FLAGS "${HDF5_TRY_COMPILE_INCLUDE_DIR}")
-
-    if(HDF5_USES_SZLIB)
-        FIND_LIBRARY(HDF5_SZ_LIBRARY NAMES szlibdll sz szip)
-        set(HDF5_SZLIB_OK ${HDF5_SZ_LIBRARY})
-    else()
-        set(HDF5_SZLIB_OK TRUE)
-        set(HDF5_SZ_LIBRARY "")
+        set(HDF5_USES_SZLIB FALSE)
+        TRY_COMPILE(HDF5_USES_SZLIB
+                    ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/config/checkHDF5usesCompression.c
+                    COMPILE_DEFINITIONS "-DH5_SOMETHING=H5_HAVE_FILTER_SZIP"
+                    CMAKE_FLAGS "${HDF5_TRY_COMPILE_INCLUDE_DIR}")
+
+        if(HDF5_USES_SZLIB)
+            FIND_LIBRARY(HDF5_SZ_LIBRARY NAMES szlibdll sz szip)
+            set(HDF5_SZLIB_OK ${HDF5_SZ_LIBRARY})
+        else()
+            set(HDF5_SZLIB_OK TRUE)
+            set(HDF5_SZ_LIBRARY "")
+        endif()
+
     endif()
 endif()


minor formatting and cmake cleaning

minor formatting and cmake cleaning

--- firmware/mbed/arm_mbed.cmake
+++ firmware/mbed/arm_mbed.cmake
@@ -11,26 +11,6 @@
 # git checkout and build location of mbed libraries
 # ExternalProject_Get_Property(PY_TOOLS_DIR )
 set(PY_TOOLS_DIR ${CMAKE_CURRENT_BINARY_DIR}/mbed/mbed_libraries-prefix/src/mbed_libraries)
-
-# Main mbed library
-set(MBED_PATH          ${PY_TOOLS_DIR}/build/mbed)
-
-# Networking paths
-set(MBED_CELLULAR_PATH  ${PY_TOOLS_DIR}/build/net/cellular)
-set(MBED_ETH_PATH       ${PY_TOOLS_DIR}/build/net/eth)
-set(MBED_HTTPS_PATH     ${PY_TOOLS_DIR}/build/net/https)
-set(MBED_LWIP_PATH      ${PY_TOOLS_DIR}/build/net/lwip)
-
-# RPC path
-set(MBED_RPC_PATH      ${PY_TOOLS_DIR}/libraries/rpc)
-
-# RTOS path
-set(MBED_RTOS_PATH     ${PY_TOOLS_DIR}/build/rtos)
-
-set(MBED_USB_PATH      ${PY_TOOLS_DIR}/build/usb)
-set(MBED_USB_HOST_PATH ${PY_TOOLS_DIR}/build/usb_host)
-set(MBED_DSP_PATH      ${PY_TOOLS_DIR}/build/dsp)
-

 # ------------------------------------------------------------------------------
 # setup processor settings add aditional boards here
@@ -43,37 +23,37 @@
 # message(STATUS "MBED target set to ${MBED_TARGET}")
 # the settings for mbed is really messed up ;)
 if(MBED_TARGET MATCHES "LPC1768")
-  set(MBED_VENDOR "NXP")
-  set(MBED_FAMILY "LPC176X")
-  set(MBED_CPU "MBED_LPC1768")
-  set(MBED_CORE "cortex-m3")
-  set(MBED_CORE_GENERIC "CORTEX_M")
-  set(MBED_INSTRUCTIONSET "M3")
-  set(MBED_STARTUP "startup_LPC17xx.o")
-  set(MBED_SYSTEM "system_LPC17xx.o")
-  set(MBED_LINK_TARGET ${MBED_TARGET})
+    set(MBED_VENDOR "NXP")
+    set(MBED_FAMILY "LPC176X")
+    set(MBED_CPU "MBED_LPC1768")
+    set(MBED_CORE "cortex-m3")
+    set(MBED_CORE_GENERIC "CORTEX_M")
+    set(MBED_INSTRUCTIONSET "M3")
+    set(MBED_STARTUP "startup_LPC17xx.o")
+    set(MBED_SYSTEM "system_LPC17xx.o")
+    set(MBED_LINK_TARGET ${MBED_TARGET})

 elseif(MBED_TARGET MATCHES "LPC11U24")
-  set(MBED_VENDOR "NXP")
-  set(MBED_FAMILY "LPC11UXX")
-  set(MBED_CPU "LPC11U24_401")
-  set(MBED_CORE_GENERIC "CORTEX_M")
-  set(MBED_CORE "cortex-m0")
-  set(MBED_INSTRUCTIONSET "M0")
-  set(MBED_STARTUP "startup_LPC11xx.o")
-  set(MBED_SYSTEM "system_LPC11Uxx.o")
-  set(MBED_LINK_TARGET ${MBED_TARGET})
+    set(MBED_VENDOR "NXP")
+    set(MBED_FAMILY "LPC11UXX")
+    set(MBED_CPU "LPC11U24_401")
+    set(MBED_CORE_GENERIC "CORTEX_M")
+    set(MBED_CORE "cortex-m0")
+    set(MBED_INSTRUCTIONSET "M0")
+    set(MBED_STARTUP "startup_LPC11xx.o")
+    set(MBED_SYSTEM "system_LPC11Uxx.o")
+    set(MBED_LINK_TARGET ${MBED_TARGET})

 elseif(MBED_TARGET MATCHES "RBLAB_NRF51822")
-  set(MBED_VENDOR "NORDIC")
-  set(MBED_FAMILY "MCU_NRF51822")
-  set(MBED_CPU "RBLAB_NRF51822")
-  set(MBED_CORE_GENERIC "CORTEX_M")
-  set(MBED_CORE "cortex-m0")
-  set(MBED_INSTRUCTIONSET "M0")
-  set(MBED_STARTUP "startup_NRF51822.o")
-  set(MBED_SYSTEM "system_nrf51822.o")
-  set(MBED_LINK_TARGET "NRF51822")
+    set(MBED_VENDOR "NORDIC")
+    set(MBED_FAMILY "MCU_NRF51822")
+    set(MBED_CPU "RBLAB_NRF51822")
+    set(MBED_CORE_GENERIC "CORTEX_M")
+    set(MBED_CORE "cortex-m0")
+    set(MBED_INSTRUCTIONSET "M0")
+    set(MBED_STARTUP "startup_NRF51822.o")
+    set(MBED_SYSTEM "system_nrf51822.o")
+    set(MBED_LINK_TARGET "NRF51822")

 else()
    message(FATAL_ERROR "No MBED_TARGET specified or available. Full stop :(")
@@ -95,15 +75,17 @@
 SET(MBED_CMAKE_C_FLAGS "${COMMON_FLAGS} ${MBED_DEFINES} -std=gnu99")

+# Main mbed library
+set(MBED_PATH          ${PY_TOOLS_DIR}/build/mbed)
+
 # ------------------------------------------------------------------------------
 # setup precompiled mbed files which will be needed for all projects
-# MESSAGE(STATUS "mbed path: ${MBED_PATH}")
 set(MBED_OBJECTS
-  ${MBED_PATH}/TARGET_${MBED_TARGET}/${MBED_TOOLCHAIN}/${MBED_STARTUP}
-  ${MBED_PATH}/TARGET_${MBED_TARGET}/${MBED_TOOLCHAIN}/${MBED_SYSTEM}
-  ${MBED_PATH}/TARGET_${MBED_TARGET}/${MBED_TOOLCHAIN}/cmsis_nvic.o
-  ${MBED_PATH}/TARGET_${MBED_TARGET}/${MBED_TOOLCHAIN}/retarget.o
-  ${MBED_PATH}/TARGET_${MBED_TARGET}/${MBED_TOOLCHAIN}/board.o
+    ${MBED_PATH}/TARGET_${MBED_TARGET}/${MBED_TOOLCHAIN}/${MBED_STARTUP}
+    ${MBED_PATH}/TARGET_${MBED_TARGET}/${MBED_TOOLCHAIN}/${MBED_SYSTEM}
+    ${MBED_PATH}/TARGET_${MBED_TARGET}/${MBED_TOOLCHAIN}/cmsis_nvic.o
+    ${MBED_PATH}/TARGET_${MBED_TARGET}/${MBED_TOOLCHAIN}/retarget.o
+    ${MBED_PATH}/TARGET_${MBED_TARGET}/${MBED_TOOLCHAIN}/board.o
 )

 # ------------------------------------------------------------------------------
@@ -113,7 +95,6 @@
 # ------------------------------------------------------------------------------
 # linker settings
 set(MBED_CMAKE_EXE_LINKER_FLAGS "-Wl,--gc-sections -Wl,--wrap,main --specs=nano.specs  -u _printf_float -u _scanf_float")
-set(MBED_CMAKE_EXE_LINKER_FLAGS "${MBED_CMAKE_EXE_LINKER_FLAGS} \"-T${MBED_PATH}/TARGET_${MBED_TARGET}/${MBED_TOOLCHAIN}/${MBED_LINK_TARGET}.ld\" -static")

 # ------------------------------------------------------------------------------
 # mbed
@@ -125,87 +106,94 @@

 # add networking
-if(${MBED_USE_ETH} STREQUAL "true")
-  #net
-  include_directories("${MBED_ETH_PATH}")
-  include_directories("${MBED_ETH_PATH}/EthernetInterface")
-  include_directories("${MBED_ETH_PATH}/Socket")
-  include_directories("${MBED_ETH_PATH}/lwip")
-  include_directories("${MBED_ETH_PATH}/lwip/include")
-  include_directories("${MBED_ETH_PATH}/lwip/include/ipv4")
-  include_directories("${MBED_ETH_PATH}/lwip/include/lwip")
-  include_directories("${MBED_ETH_PATH}/lwip/include/netif")
-  include_directories("${MBED_ETH_PATH}/lwip-sys")
-  include_directories("${MBED_ETH_PATH}/lwip-sys/arch")
-  include_directories("${MBED_ETH_PATH}/lwip-eth/arch/TARGET_${MBED_VENDOR}")
-
-  #library dir
-  set(PY_NET_LIB_DIR ${MBED_ETH_PATH}/TARGET_${MBED_TARGET}/TOOLCHAIN_${PY_TOOLCHAIN_OPT})
-  #add static
-  set(MBED_LIBS ${MBED_LIBS} libeth.a)
-  #add build arg to py script command
-  set(PY_LIBS ${PY_LIBS} --eth)
-
-  # supress lwip warnings with 0x11
-  set(MBED_CMAKE_CXX_FLAGS "${MBED_CMAKE_CXX_FLAGS} -Wno-literal-suffix")
-
-  #force rtos
-  set(MBED_USE_RTOS true)
+if(${MBED_USE_ETH})
+    set(MBED_ETH_PATH ${PY_TOOLS_DIR}/build/net/eth)
+
+    #net
+    include_directories("${MBED_ETH_PATH}")
+    include_directories("${MBED_ETH_PATH}/EthernetInterface")
+    include_directories("${MBED_ETH_PATH}/Socket")
+    include_directories("${MBED_ETH_PATH}/lwip")
+    include_directories("${MBED_ETH_PATH}/lwip/include")
+    include_directories("${MBED_ETH_PATH}/lwip/include/ipv4")
+    include_directories("${MBED_ETH_PATH}/lwip/include/lwip")
+    include_directories("${MBED_ETH_PATH}/lwip/include/netif")
+    include_directories("${MBED_ETH_PATH}/lwip-sys")
+    include_directories("${MBED_ETH_PATH}/lwip-sys/arch")
+    include_directories("${MBED_ETH_PATH}/lwip-eth/arch/TARGET_${MBED_VENDOR}")
+
+    #library dir
+    set(PY_NET_LIB_DIR ${MBED_ETH_PATH}/TARGET_${MBED_TARGET}/TOOLCHAIN_${PY_TOOLCHAIN_OPT})
+    set(MBED_LIBS ${MBED_LIBS} ${PY_NET_LIB_DIR}/libeth.a)
+
+    #add build arg to py script command
+    set(PY_LIBS ${PY_LIBS} --eth)
+
+    # supress lwip warnings with 0x11
+    set(MBED_CMAKE_CXX_FLAGS "${MBED_CMAKE_CXX_FLAGS} -Wno-literal-suffix")
+
+    #force rtos
+    set(MBED_USE_RTOS true)
 endif()

 # add rtos
-if(${MBED_USE_RTOS} STREQUAL "true")
-  include_directories("${MBED_RTOS_PATH}")
-  include_directories("${MBED_RTOS_PATH}/TARGET_${MBED_CORE_GENERIC}")
-
-  set(PY_RTOS_LIB_DIR ${MBED_RTOS_PATH}/TARGET_${MBED_TARGET}/TOOLCHAIN_${PY_TOOLCHAIN_OPT})
-  set(MBED_LIBS ${MBED_LIBS} ${PY_RTOS_LIB_DIR}/librtos.a ${PY_RTOS_LIB_DIR}/librtx.a)
-  set(PY_LIBS ${PY_LIBS} --rtos)
+if(${MBED_USE_RTOS})
+    set(MBED_RTOS_PATH     ${PY_TOOLS_DIR}/build/rtos)
+    include_directories("${MBED_RTOS_PATH}")
+    include_directories("${MBED_RTOS_PATH}/TARGET_${MBED_CORE_GENERIC}")
+
+    set(PY_RTOS_LIB_DIR ${MBED_RTOS_PATH}/TARGET_${MBED_TARGET}/TOOLCHAIN_${PY_TOOLCHAIN_OPT})
+    set(MBED_LIBS ${MBED_LIBS} ${PY_RTOS_LIB_DIR}/librtos.a ${PY_RTOS_LIB_DIR}/librtx.a)
+    set(PY_LIBS ${PY_LIBS} --rtos)
 endif()

 # add usb
-if(${MBED_USE_USB} STREQUAL "true")
-  #usb
-  include_directories("${MBED_USB_PATH}/USBAudio")
-  include_directories("${MBED_USB_PATH}/USBDevice")
-  include_directories("${MBED_USB_PATH}/USBHID")
-  include_directories("${MBED_USB_PATH}/USBMIDI")
-  include_directories("${MBED_USB_PATH}/USBMSD")
-  include_directories("${MBED_USB_PATH}/USBSerial")
-
-  #usb host
-  include_directories("${MBED_USB_HOST_PATH}/USBHost")
-  include_directories("${MBED_USB_HOST_PATH}/USBHost3GModule")
-  include_directories("${MBED_USB_HOST_PATH}/USBHostHID")
-  include_directories("${MBED_USB_HOST_PATH}/USBHostHub")
-  include_directories("${MBED_USB_HOST_PATH}/USBHostMIDI")
-  include_directories("${MBED_USB_HOST_PATH}/USBHostMSD")
-  include_directories("${MBED_USB_HOST_PATH}/USBHostSerial")
-
-  #library dirs
-  set(PY_USB_LIB_DIR      ${MBED_USB_PATH}/TARGET_${MBED_TARGET}/TOOLCHAIN_${PY_TOOLCHAIN_OPT})
-  set(PY_USB_HOST_LIB_DIR ${MBED_USB_HOST_PATH}/TARGET_${MBED_TARGET}/TOOLCHAIN_${PY_TOOLCHAIN_OPT})
-  #add statics
-  set(MBED_LIBS ${MBED_LIBS} libUSBDevice.a libUSBHost.a)
-  #add build arg to py script command
-  set(PY_LIBS ${PY_LIBS} --usb --usb_host)
+if(${MBED_USE_USB})
+    set(MBED_USB_PATH      ${PY_TOOLS_DIR}/build/usb)
+    set(MBED_USB_HOST_PATH ${PY_TOOLS_DIR}/build/usb_host)
+    #usb
+    include_directories("${MBED_USB_PATH}/USBAudio")
+    include_directories("${MBED_USB_PATH}/USBDevice")
+    include_directories("${MBED_USB_PATH}/USBHID")
+    include_directories("${MBED_USB_PATH}/USBMIDI")
+    include_directories("${MBED_USB_PATH}/USBMSD")
+    include_directories("${MBED_USB_PATH}/USBSerial")
+
+    #usb host
+    include_directories("${MBED_USB_HOST_PATH}/USBHost")
+    include_directories("${MBED_USB_HOST_PATH}/USBHost3GModule")
+    include_directories("${MBED_USB_HOST_PATH}/USBHostHID")
+    include_directories("${MBED_USB_HOST_PATH}/USBHostHub")
+    include_directories("${MBED_USB_HOST_PATH}/USBHostMIDI")
+    include_directories("${MBED_USB_HOST_PATH}/USBHostMSD")
+    include_directories("${MBED_USB_HOST_PATH}/USBHostSerial")
+
+    #library dirs
+    set(PY_USB_LIB_DIR      ${MBED_USB_PATH}/TARGET_${MBED_TARGET}/TOOLCHAIN_${PY_TOOLCHAIN_OPT})
+    set(PY_USB_HOST_LIB_DIR ${MBED_USB_HOST_PATH}/TARGET_${MBED_TARGET}/TOOLCHAIN_${PY_TOOLCHAIN_OPT})
+    #add statics
+    set(MBED_LIBS ${MBED_LIBS} libUSBDevice.a libUSBHost.a)
+    #add build arg to py script command
+    set(PY_LIBS ${PY_LIBS} --usb --usb_host)
 endif()

 # add dsp
-if(${MBED_USE_DSP} STREQUAL "true")
-  #dsp
-  include_directories("${MBED_DSP_PATH}")
-
-  #library dir
-  set(PY_DSP_LIB_DIR ${MBED_DSP_PATH}/TARGET_${MBED_TARGET}/TOOLCHAIN_${PY_TOOLCHAIN_OPT})
-  #add static
-  set(MBED_LIBS ${MBED_LIBS} libcmsis_dsp.a libdsp.a)
-  #add build arg to py script command
-  set(PY_LIBS ${PY_LIBS} --dsp)
+if(${MBED_USE_DSP})
+    set(MBED_DSP_PATH      ${PY_TOOLS_DIR}/build/dsp)
+
+    #dsp
+    include_directories("${MBED_DSP_PATH}")
+
+    #library dir
+    set(PY_DSP_LIB_DIR ${MBED_DSP_PATH}/TARGET_${MBED_TARGET}/TOOLCHAIN_${PY_TOOLCHAIN_OPT})
+    #add static
+    set(MBED_LIBS ${MBED_LIBS} libcmsis_dsp.a libdsp.a)
+    #add build arg to py script command
+    set(PY_LIBS ${PY_LIBS} --dsp)
 endif()

 # rpc
-if(${MBED_USE_RPC} STREQUAL "true")
+if(${MBED_USE_RPC})
     include_directories(${PY_TOOLS_DIR}/build/rpc)

     set(MBED_LIBS ${MBED_LIBS} ${PY_TOOLS_DIR}/build/rpc/TARGET_${MBED_TARGET}/TOOLCHAIN_${PY_TOOLCHAIN_OPT}/librpc.a)
@@ -230,11 +218,11 @@

 # create a list of which accessory libraries we want to download and add to the common2015 library
 set(MBED_ASSEC_LIBS
-  # ${MCP23017_MBED_LIB}
-  ${BURSTSPI_MBED_LIB}
-  # ${SWSPI_MBED_LIB}
-  ${SWI2C_MBED_LIB}
-  ${MODSER_MBED_LIB}
-  ${MODDMA_MBED_LIB}
-  ${PIXARRY_MBED_LIB}
+    # ${MCP23017_MBED_LIB}
+    ${BURSTSPI_MBED_LIB}
+    # ${SWSPI_MBED_LIB}
+    ${SWI2C_MBED_LIB}
+    ${MODSER_MBED_LIB}
+    ${MODDMA_MBED_LIB}
+    ${PIXARRY_MBED_LIB}
 )


Use MAKE_BUILD_RPATH feature

Use MAKE_BUILD_RPATH feature

--- flags/sanitize_address.cmake
+++ flags/sanitize_address.cmake
@@ -67,10 +67,11 @@
   polly_add_cache_flag(CMAKE_EXE_LINKER_FLAGS "${_xcode_asan_lib}")
   polly_add_cache_flag(CMAKE_SHARED_LINKER_FLAGS "${_xcode_asan_lib}")

-  # FIXME: http://www.mail-archive.com/cmake-developers@cmake.org/msg17290.html {
-  polly_add_cache_flag(CMAKE_EXE_LINKER_FLAGS "-Wl,-rpath,${_xcode_asan_lib_dir}")
-  polly_add_cache_flag(CMAKE_SHARED_LINKER_FLAGS "-Wl,-rpath,${_xcode_asan_lib_dir}")
-  # }
+  if(CMAKE_VERSION VERSION_LESS 3.8.0)
+    polly_fatal_error("At least CMake 3.8.0 required (BUILD_RPATH feature)")
+  endif()
+
+  set(CMAKE_BUILD_RPATH "${_xcode_asan_lib_dir}")

   # Hunter copying rules {
   set_property(GLOBAL APPEND PROPERTY HUNTER_COPY_FILES "${_xcode_asan_lib}")


Try to fix space in external build dir

Try to fix space in external build dir

--- cmake/ExternalQt5.cmake
+++ cmake/ExternalQt5.cmake
@@ -32,7 +32,7 @@
             -confirm-license;
             -release;
             -no-compile-examples;
-		-no-openssl;
+            -no-openssl;
             -no-libproxy;
             -no-qml-debug;
             -no-pulseaudio;
@@ -58,9 +58,9 @@
         URL ${URL}
 	URL_HASH ${URL_HASH}
         CONFIGURE_COMMAND
-            ${FAST_EXTERNAL_BUILD_DIR}/qt5/src/qt5/configure
-            -prefix ${FAST_EXTERNAL_INSTALL_DIR};
- 		${OPTIONS}
+            "${FAST_EXTERNAL_BUILD_DIR}/qt5/src/qt5/configure"
+            -prefix "${FAST_EXTERNAL_INSTALL_DIR}";
+            ${OPTIONS}
         BUILD_COMMAND
             ${BUILD_COMMAND}
         INSTALL_COMMAND


Require CLucene 0.9.16

Require CLucene 0.9.16

svn path=/trunk/playground/base/strigi/; revision=586299

--- cmake/FindCLucene.cmake
+++ cmake/FindCLucene.cmake
@@ -38,19 +38,6 @@
       NAMES CLucene.h
       PATHS ${TRIAL_INCLUDE_PATHS})

-  # check if version 0.9.15 is patched
-  IF (EXISTS ${CLUCENE_INCLUDE_DIR}/CLucene/util/streambase.h)
-    FILE(READ ${CLUCENE_INCLUDE_DIR}/CLucene/util/streambase.h CLCONTENT)
-    STRING(REGEX MATCH "virtual int64_t mark" CLMATCH ${CLCONTENT})
-    IF (CLMATCH)
-      MESSAGE(FATAL_ERROR " CLucene 0.9.15 was not patched. Please read replace the files\n     streambase.h, bufferedstream.h, and inputstreambuffer.h\n in CLucene with those from Strigi. (See README)")
-    ENDIF (CLMATCH)
-  ELSE (EXISTS ${CLUCENE_INCLUDE_DIR}/CLucene/util/streambase.h)
-      MESSAGE(FATAL_ERROR " CLucene 0.9.15 was not patched. Please read replace the files\n     streambase.h, bufferedstream.h, and inputstreambuffer.h\n in CLucene with those from Strigi. (See README)")
-  ENDIF (EXISTS ${CLUCENE_INCLUDE_DIR}/CLucene/util/streambase.h)
-
-  # end check
-
   IF (CLUCENE_INCLUDE_DIR)
     MESSAGE(STATUS "Found CLucene include dir: ${CLUCENE_INCLUDE_DIR}")
   ENDIF (CLUCENE_INCLUDE_DIR)
@@ -65,9 +52,9 @@
       IF (CLMATCH)
         STRING(REGEX REPLACE "_CL_VERSION +\"(.*)\"" "\\1" CLVERSION ${CLMATCH})
       ENDIF (CLMATCH)
-      IF (CLVERSION STRLESS "0.9.15")
-        MESSAGE(FATAL_ERROR "CLucene version is less than 0.9.15")
-      ENDIF (CLVERSION STRLESS "0.9.15")
+      IF (CLVERSION STRLESS "0.9.16")
+        MESSAGE(FATAL_ERROR "CLucene version is less than 0.9.16")
+      ENDIF (CLVERSION STRLESS "0.9.16")
     ENDIF (CLUCENE_LIBRARY_DIR)
   ELSE(NOT MSVC)
     #msvc doesnt use a config file
@@ -83,7 +70,7 @@
 ELSE(CLUCENE_INCLUDE_DIR AND CLUCENE_LIBRARY AND CLUCENE_LIBRARY_DIR)
   SET(CLucene_FOUND 0)
   IF(CLucene_FIND_REQUIRED)
-    MESSAGE(FATAL_ERROR "Could not find CLucene. Please download CLucene from http://clucene.sf.net")
+    MESSAGE(FATAL_ERROR "Could not find CLucene. Please install CLucene >= 0.9.16 (http://clucene.sf.net)")
   ENDIF(CLucene_FIND_REQUIRED)
 ENDIF(CLUCENE_INCLUDE_DIR AND CLUCENE_LIBRARY AND CLUCENE_LIBRARY_DIR)


cmake: fix PDB handling

cmake: fix PDB handling

--- cmake/OpenCVUtils.cmake
+++ cmake/OpenCVUtils.cmake
@@ -1,3 +1,7 @@
+if(COMMAND ocv_cmake_dump_vars)  # include guard
+  return()
+endif()
+
 include(CMakeParseArguments)

 # Debugging function
@@ -1111,15 +1115,6 @@
   set(${var} ${tmp} PARENT_SCOPE)
 endfunction()

-if(MSVC AND BUILD_SHARED_LIBS)  # no defaults for static libs (modern CMake is required)
-  if(NOT CMAKE_VERSION VERSION_LESS 3.6.0)
-    option(INSTALL_PDB_COMPONENT_EXCLUDE_FROM_ALL "Don't install PDB files by default" ON)
-    option(INSTALL_PDB "Add install PDB rules" ON)
-  elseif(NOT CMAKE_VERSION VERSION_LESS 3.1.0)
-    option(INSTALL_PDB_COMPONENT_EXCLUDE_FROM_ALL "Don't install PDB files by default (not supported)" OFF)
-    option(INSTALL_PDB "Add install PDB rules" OFF)
-  endif()
-endif()

 # add install command
 function(ocv_install_target)
@@ -1152,6 +1147,18 @@

   if(MSVC)
     set(__target "${ARGV0}")
+
+    # don't move this into global scope of this file: compiler settings (like MSVC variable) are not available during processing
+    if(BUILD_SHARED_LIBS)  # no defaults for static libs (modern CMake is required)
+      if(NOT CMAKE_VERSION VERSION_LESS 3.6.0)
+        option(INSTALL_PDB_COMPONENT_EXCLUDE_FROM_ALL "Don't install PDB files by default" ON)
+        option(INSTALL_PDB "Add install PDB rules" ON)
+      elseif(NOT CMAKE_VERSION VERSION_LESS 3.1.0)
+        option(INSTALL_PDB_COMPONENT_EXCLUDE_FROM_ALL "Don't install PDB files by default (not supported)" OFF)
+        option(INSTALL_PDB "Add install PDB rules" OFF)
+      endif()
+    endif()
+
     if(INSTALL_PDB AND NOT INSTALL_IGNORE_PDB
         AND NOT OPENCV_${__target}_PDB_SKIP
     )
@@ -1196,7 +1203,7 @@
           endif()

 #          message(STATUS "Adding PDB file installation rule: target=${__target} dst=${__dst} component=${__pdb_install_component}")
-          if("${__target_type}" STREQUAL "SHARED_LIBRARY")
+          if("${__target_type}" STREQUAL "SHARED_LIBRARY" OR "${__target_type}" STREQUAL "MODULE_LIBRARY")
             install(FILES "$<TARGET_PDB_FILE:${__target}>" DESTINATION "${__dst}"
                 COMPONENT ${__pdb_install_component} OPTIONAL ${__pdb_exclude_from_all})
           else()


Windows compatibility

Windows compatibility

--- salome_adm/cmake_files/FindSalomePythonLibs.cmake
+++ salome_adm/cmake_files/FindSalomePythonLibs.cmake
@@ -36,6 +36,9 @@
    SET(PythonLibs_FIND_VERSION ${PYTHON_VERSION_STRING})
    SET(PythonLibs_FIND_VERSION_MAJOR ${PYTHON_VERSION_MAJOR})
 ENDIF()
+IF(WIN32)
+  set(CMAKE_LIBRARY_PATH "${PYTHON_ROOT_DIR}/libs")
+ENDIF()
 SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(PythonLibs PYTHON_INCLUDE_DIR 2)

 IF(SALOMEPYTHONLIBS_FOUND)


Use mainline octomap instead of pod, upgrade to v1.7.0

--- software/externals/cmake/externals.cmake
+++ software/externals/cmake/externals.cmake
@@ -45,9 +45,15 @@
     -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
   )

-set(octomap-pod_url https://github.com/openhumanoids/octomap-pod.git)
-set(octomap-pod_revision 590b430dfe9f949118fdd618b620d82d84eb0162)
-set(octomap-pod_depends)
+set(octomap_url https://github.com/OctoMap/octomap.git)
+set(octomap_revision 5ba840e58a35e2d14c40d0af807da879a1a2fd83)
+set(octomap_depends)
+set(octomap_external_args
+  CMAKE_CACHE_ARGS
+    -DCMAKE_PREFIX_PATH:PATH=${CMAKE_INSTALL_PREFIX}
+    -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
+    -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
+  )

 set(occ-map_url https://github.com/openhumanoids/occ-map.git)
 set(occ-map_revision 34ab71fa693216d2c0508f0f2680b9a68994f473)
@@ -55,7 +61,7 @@

 set(common_utils_url https://github.com/openhumanoids/common_utils.git)
 set(common_utils_revision 7fc252e3b1baf8ec6a19ee812ae114e8ee460dbd)
-set(common_utils_depends Eigen_pod libbot occ-map octomap-pod)
+set(common_utils_depends Eigen_pod libbot occ-map octomap)

 set(frsm_url ssh://git@github.com/openhumanoids/frsm.git)
 set(frsm_revision bbf1d83023ae35ecf595c93e46b8601206be9e9b)
@@ -170,7 +176,7 @@
   opencv
   flann
   pcl
-  octomap-pod
+  octomap
   libmultisense
   multisense-lcm
   occ-map


Fix duplicated parameters when using FindConfigurePackage


Add -lmtmalloc to server linker flags on Solaris 10 and later

--- cmake/build_configurations/mysql_release.cmake
+++ cmake/build_configurations/mysql_release.cmake
@@ -70,6 +70,10 @@

   # Solaris flags
   IF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
+    IF(CMAKE_SYSTEM_VERSION VERSION_GREATER "5.9")
+      # Link mysqld with mtmalloc on Solaris 10 and later
+      SET(WITH_MYSQLD_LDFLAGS "-lmtmalloc" CACHE STRING "")
+    ENDIF()
     IF(CMAKE_C_COMPILER_ID MATCHES "SunPro")
       IF(CMAKE_SYSTEM_PROCESSOR MATCHES "i386")
         IF(CMAKE_SIZEOF_VOIDP EQUAL 4)


FMUv4PRO: Enable DDS

FMUv4PRO: Enable DDS

--- cmake/configs/nuttx_px4fmu-v4pro_default.cmake
+++ cmake/configs/nuttx_px4fmu-v4pro_default.cmake
@@ -142,6 +142,9 @@
 	modules/systemlib/mixer
 	modules/uORB

+	# micro RTPS
+	modules/micrortps_bridge/micrortps_client
+
 	#
 	# Libraries
 	#
@@ -211,6 +214,14 @@
 	#examples/ekf_att_pos_estimator
 )

+set(config_rtps_send_topics
+   sensor_combined
+   )
+
+set(config_rtps_receive_topics
+   sensor_baro
+   )
+
 set(config_extra_builtin_cmds
 	serdis
 	sercon


Fix a typo for building linAfterImage (CMake)

--- graf2d/asimage/BuildAfterImage.cmake
+++ graf2d/asimage/BuildAfterImage.cmake
@@ -68,7 +68,7 @@
     set(JPEGINCLUDE "--with-jpeg-includes=${JPEG_INCLUDE_DIR}")
   endif()
   if(PNG_FOUND)
-    set(PNGINCLUDE  "--with-png-includes=${PNG_INCLUDE_DIR}")
+    set(PNGINCLUDE  "--with-png-includes=${PNG_PNG_INCLUDE_DIR}")
   endif()
   if(cocoa)
     set(JPEGINCLUDE --without-x --with-builtin-jpeg)


Fix x64 package name.

Fix x64 package name.

--- packaging/WiX/CPackWixConfig.cmake
+++ packaging/WiX/CPackWixConfig.cmake
@@ -4,7 +4,11 @@
  SET(CPACK_COMPONENTS_USED "Server;Client;DataFiles")
  SET(CPACK_WIX_UI "WixUI_InstallDir")
  MATH(EXPR bits ${CMAKE_SIZEOF_VOID_P}*8)
- SET(CPACK_PACKAGE_FILE_NAME  "mysql-essential-${VERSION}-win${bits}")
+ IF(64BIT)
+  SET(CPACK_PACKAGE_FILE_NAME  "mysql-essential-${VERSION}-winx64")
+ ELSE()
+  SET(CPACK_PACKAGE_FILE_NAME  "mysql-essential-${VERSION}-win32")
+ ENDIF()
 ELSE()
   SET(CPACK_COMPONENTS_USED
     "Server;Client;DataFiles;Development;SharedLibraries;Embedded;Debuginfo;Documentation;IniFiles;Readme;Server_Scripts")


Fix the wrong passing of GFORTRAN_LIB to Scalapack

--- cmake/external_projects/ElMath/ScaLAPACK.cmake
+++ cmake/external_projects/ElMath/ScaLAPACK.cmake
@@ -260,7 +260,7 @@
   string(REPLACE ";" "^^" MPI_C_LIBSTRING "${MPI_C_LIBRARIES}")
   string(REPLACE ";" "^^" MPI_Fortran_LIBSTRING "${MPI_Fortran_LIBRARIES}")
   if(GFORTRAN_LIB)
-    set(GFORTRAN_COMMAND GFORTRAN_LIB=${GFORTRAN_LIB})
+    set(GFORTRAN_COMMAND -D GFORTRAN_LIB=${GFORTRAN_LIB})
   else()
     set(GFORTRAN_COMMAND)
   endif()


Omit blosc packing in deps build

Omit blosc packing in deps build

--- deps/deps-windows.cmake
+++ deps/deps-windows.cmake
@@ -318,6 +318,7 @@
         -DBUILD_TESTS=OFF
         -DBUILD_BENCHMARKS=OFF
         -DPREFER_EXTERNAL_ZLIB=ON
+        -DBLOSC_IS_SUBPROJECT=OFF
     PATCH_COMMAND ${GIT_EXECUTABLE} apply --whitespace=fix ${CMAKE_CURRENT_SOURCE_DIR}/blosc-mods.patch
     BUILD_COMMAND msbuild /m /P:Configuration=Release INSTALL.vcxproj
     INSTALL_COMMAND ""


Issue #16: Fix passing BUILD_PCL_VIS from SuperBuild to sub-build.

--- CMake/SuperBuild.cmake
+++ CMake/SuperBuild.cmake
@@ -222,6 +222,7 @@
       -DBUILD_OpenCV:BOOL=${BUILD_OpenCV}
       -DBUILD_VTK:BOOL=${BUILD_VTK}
       -DBUILD_PCL:BOOL=${BUILD_PCL}
+      -DBUILD_PCL_VIS:BOOL=${BUILD_PCL_VIS}
       -DBUILD_PYTHON_BINDINGS:BOOL=${BUILD_PYTHON_BINDINGS}
       -Dgflags_DIRECTORY:PATH=${gflags_DIR}
       -Dglog_DIRECTORY:PATH=${glog_DIR}


Add support for LLVM_USE_SANITIZER=Thread

Summary: This will help in testing libc++ and libc++abi with tsan.

Reviewers: samsonov

Reviewed By: samsonov

Subscribers: samsonov, llvm-commits

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

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

--- cmake/modules/HandleLLVMOptions.cmake
+++ cmake/modules/HandleLLVMOptions.cmake
@@ -396,6 +396,9 @@
       append_common_sanitizer_flags()
       append("-fsanitize=undefined -fno-sanitize=vptr,function -fno-sanitize-recover"
               CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+    elseif (LLVM_USE_SANITIZER STREQUAL "Thread")
+      append_common_sanitizer_flags()
+      append("-fsanitize=thread" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
     else()
       message(WARNING "Unsupported value of LLVM_USE_SANITIZER: ${LLVM_USE_SANITIZER}")
     endif()


cmake: Use "set" instead of "option" for LLVM_ENABLE_LTO

Apparently option is for bools and cmake-gui will display this
strangely with option.

Pointed out by edward-san - thanks!

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

--- cmake/modules/HandleLLVMOptions.cmake
+++ cmake/modules/HandleLLVMOptions.cmake
@@ -656,7 +656,7 @@
   CMAKE_EXE_LINKER_FLAGS
   CMAKE_SHARED_LINKER_FLAGS)

-option(LLVM_ENABLE_LTO "Build LLVM with LTO. May be specified as Thin or Full to use a particular kind of LTO" OFF)
+set(LLVM_ENABLE_LTO OFF CACHE STRING "Build LLVM with LTO. May be specified as Thin or Full to use a particular kind of LTO")
 string(TOUPPER "${LLVM_ENABLE_LTO}" uppercase_LLVM_ENABLE_LTO)
 if(uppercase_LLVM_ENABLE_LTO STREQUAL "THIN")
   append("-flto=thin" CMAKE_CXX_FLAGS CMAKE_C_FLAGS


Since we don't use boost::context for anything anyway, don't try to link it when building standalone.

--- indra/cmake/Boost.cmake
+++ indra/cmake/Boost.cmake
@@ -7,7 +7,8 @@
 if (STANDALONE)
   include(FindBoost)

-  set(BOOST_CONTEXT_LIBRARY boost_context-mt)
+# <FS:TS> boost::context isn't used, so don't try to include it
+# set(BOOST_CONTEXT_LIBRARY boost_context-mt)
   set(BOOST_FILESYSTEM_LIBRARY boost_filesystem-mt)
   set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options-mt)
   set(BOOST_REGEX_LIBRARY boost_regex-mt)


Removing the change to LLPhysicsExtensions.cmake that was accidentally committed in changes set cf029fb1d6ee.

--- indra/cmake/LLPhysicsExtensions.cmake
+++ indra/cmake/LLPhysicsExtensions.cmake
@@ -22,7 +22,7 @@
 set(LLPHYSICS_LIBRARIES

     debug     ${LL_PHYSICS_DEBUG_LIB}
-    optimized ${LL_PHYSICS_RELWITHDEBINFO_LIB}
+    optimized ${LL_PHYSICS_RELEASE_LIB}
 )

 if (LINUX)


Adds LOCAL as a standard arg

Adds LOCAL as a standard arg

--- scripts/AddHunter.cmake
+++ scripts/AddHunter.cmake
@@ -6,7 +6,7 @@
 include(CMakeParseArguments)

 macro(initialize_hunter)
-  cmake_parse_arguments(ih "NO_COOKOFF_RECIPES" "URL;SHA1;HUNTER_ROOT" "" ${ARGN})
+  cmake_parse_arguments(ih "NO_COOKOFF_RECIPES;LOCAL" "URL;SHA1;HUNTER_ROOT" "" ${ARGN})
   if(NOT ih_URL)
     if(ih_SHA1)
       message(FATAL_ERROR "URL AND SHA1 should be given together")
@@ -23,7 +23,11 @@
   if(NOT HUNTER_ROOT AND "$ENV{HUNTER_ROOT}" STREQUAL "")
     set(HUNTER_ROOT "${ih_HUNTER_ROOT}" CACHE PATH "Hunter root dir")
   endif()
-  HunterGate(URL ${ih_URL} SHA1 ${ih_SHA1} ${ih_UNPARSED_ARGUMENTS})
+  unset(local)
+  if(ih_LOCAL)
+    set(local LOCAL)
+  endif()
+  HunterGate(URL ${ih_URL} SHA1 ${ih_SHA1} ${local})
   if(NOT ih_NO_COOKOFF_RECIPES)
     set(HUNTER_REPOSITORY_cookoff_DIRECTORY ${GREAT_CMAKE_COOKOFF_HUNTER_RECIPES_DIR})
     set(HUNTER_REPOSITORY_cookoff_URL "local")


update path in OpenCogMacros.cmake

update path in OpenCogMacros.cmake

--- lib/OpenCogMacros.cmake
+++ lib/OpenCogMacros.cmake
@@ -1,12 +1,12 @@
 MACRO(OPENCOG_ADD_ATOM_TYPES SCRIPT_FILE HEADER_FILE DEFINITIONS_FILE INHERITANCE_FILE SCM_FILE PYTHON_FILE)
     ADD_CUSTOM_COMMAND (
-        COMMAND "${CMAKE_COMMAND}" -DSCRIPT_FILE=\"${CMAKE_CURRENT_SOURCE_DIR}/${SCRIPT_FILE}\" -DHEADER_FILE=\"${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILE}\" -DDEFINITIONS_FILE=\"${CMAKE_CURRENT_BINARY_DIR}/${DEFINITIONS_FILE}\" -DINHERITANCE_FILE=\"${CMAKE_CURRENT_BINARY_DIR}/${INHERITANCE_FILE}\" -DSCM_FILE=\"${CMAKE_CURRENT_BINARY_DIR}/${SCM_FILE}\" -DPYTHON_FILE=\"${CMAKE_CURRENT_BINARY_DIR}/${PYTHON_FILE}\" -P "${CMAKE_SOURCE_DIR}/lib/OpenCogAtomTypes.cmake"
+        COMMAND "${CMAKE_COMMAND}" -DSCRIPT_FILE=\"${CMAKE_CURRENT_SOURCE_DIR}/${SCRIPT_FILE}\" -DHEADER_FILE=\"${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILE}\" -DDEFINITIONS_FILE=\"${CMAKE_CURRENT_BINARY_DIR}/${DEFINITIONS_FILE}\" -DINHERITANCE_FILE=\"${CMAKE_CURRENT_BINARY_DIR}/${INHERITANCE_FILE}\" -DSCM_FILE=\"${CMAKE_CURRENT_BINARY_DIR}/${SCM_FILE}\" -DPYTHON_FILE=\"${CMAKE_CURRENT_BINARY_DIR}/${PYTHON_FILE}\" -P "${COGUTIL_DATA_DIR}/cmake/OpenCogAtomTypes.cmake"
         OUTPUT  "${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILE}"
                 "${CMAKE_CURRENT_BINARY_DIR}/${DEFINITIONS_FILE}"
                 "${CMAKE_CURRENT_BINARY_DIR}/${INHERITANCE_FILE}"
                 "${CMAKE_CURRENT_BINARY_DIR}/${SCM_FILE}"
                 "${CMAKE_CURRENT_BINARY_DIR}/${PYTHON_FILE}"
-        DEPENDS "${SCRIPT_FILE}" "${CMAKE_SOURCE_DIR}/lib/OpenCogAtomTypes.cmake"
+        DEPENDS "${SCRIPT_FILE}" "${COGUTIL_DATA_DIR}/cmake/OpenCogAtomTypes.cmake"
         WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
         COMMENT "Generating opencog types"
     )


ARROW-17348: [C++] Add support for building bundled LZ4 with Visual C++ 2019 or later (#13817)

LZ4 provides CMake configuration. We can add support for building
bundled LZ4 with Visual C++ 2019 or later by using it.

But this needs CMake 3.7 or later because
ExternaProject_Add(SOURCE_SUBDIR) is supported since CMake 3.7.

Authored-by: Sutou Kouhei <73218711cdd5d5c30ac66da3cc4d9d9204caf34b@clear-code.com>
Signed-off-by: Sutou Kouhei <73218711cdd5d5c30ac66da3cc4d9d9204caf34b@clear-code.com>

--- cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -2306,43 +2306,34 @@
 endif()

 macro(build_lz4)
-  message(STATUS "Building lz4 from source")
-  set(LZ4_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/lz4_ep-prefix/src/lz4_ep")
-  set(LZ4_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/lz4_ep-prefix")
-
-  if(MSVC)
-    if(ARROW_USE_STATIC_CRT)
-      if(${UPPERCASE_BUILD_TYPE} STREQUAL "DEBUG")
-        set(LZ4_RUNTIME_LIBRARY_LINKAGE "/p:RuntimeLibrary=MultiThreadedDebug")
-      else()
-        set(LZ4_RUNTIME_LIBRARY_LINKAGE "/p:RuntimeLibrary=MultiThreaded")
-      endif()
-    endif()
-    set(LZ4_STATIC_LIB
-        "${LZ4_BUILD_DIR}/build/VS2010/bin/x64_${CMAKE_BUILD_TYPE}/liblz4_static.lib")
-    set(LZ4_BUILD_COMMAND
-        BUILD_COMMAND msbuild.exe /m /p:Configuration=${CMAKE_BUILD_TYPE} /p:Platform=x64
-        /p:PlatformToolset=v140 ${LZ4_RUNTIME_LIBRARY_LINKAGE} /t:Build
-        ${LZ4_BUILD_DIR}/build/VS2010/lz4.sln)
-  else()
-    set(LZ4_STATIC_LIB "${LZ4_BUILD_DIR}/lib/liblz4.a")
-    # Must explicitly invoke sh on MinGW
-    set(LZ4_BUILD_COMMAND
-        BUILD_COMMAND sh "${CMAKE_CURRENT_SOURCE_DIR}/build-support/build-lz4-lib.sh"
-        "AR=${CMAKE_AR}" "OS=${CMAKE_SYSTEM_NAME}")
-  endif()
+  message(STATUS "Building LZ4 from source")
+  if(CMAKE_VERSION VERSION_LESS 3.7)
+    message(FATAL_ERROR "Building LZ4 using ExternalProject requires at least CMake 3.7")
+  endif()
+
+  set(LZ4_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/lz4_ep-install")
+
+  set(LZ4_STATIC_LIB
+      "${LZ4_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}lz4${CMAKE_STATIC_LIBRARY_SUFFIX}")
+
+  set(LZ4_CMAKE_ARGS
+      ${EP_COMMON_CMAKE_ARGS}
+      -DBUILD_SHARED_LIBS=OFF
+      -DBUILD_STATIC_LIBS=ON
+      -DCMAKE_INSTALL_LIBDIR=lib
+      -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
+      -DLZ4_BUILD_CLI=OFF
+      -DLZ4_BUILD_LEGACY_LZ4C=OFF)

   # We need to copy the header in lib to directory outside of the build
   externalproject_add(lz4_ep
-                      URL ${LZ4_SOURCE_URL} ${EP_LOG_OPTIONS}
+                      ${EP_LOG_OPTIONS}
+                      CMAKE_ARGS ${LZ4_CMAKE_ARGS}
+                      SOURCE_SUBDIR "build/cmake"
+                      INSTALL_DIR ${LZ4_PREFIX}
+                      URL ${LZ4_SOURCE_URL}
                       URL_HASH "SHA256=${ARROW_LZ4_BUILD_SHA256_CHECKSUM}"
-                      UPDATE_COMMAND ${CMAKE_COMMAND} -E copy_directory
-                                     "${LZ4_BUILD_DIR}/lib" "${LZ4_PREFIX}/include"
-                                     ${LZ4_PATCH_COMMAND}
-                      CONFIGURE_COMMAND ""
-                      INSTALL_COMMAND ""
-                      BINARY_DIR ${LZ4_BUILD_DIR}
-                      BUILD_BYPRODUCTS ${LZ4_STATIC_LIB} ${LZ4_BUILD_COMMAND})
+                      BUILD_BYPRODUCTS ${LZ4_STATIC_LIB})

   file(MAKE_DIRECTORY "${LZ4_PREFIX}/include")
   add_library(lz4::lz4 STATIC IMPORTED)
@@ -2364,7 +2355,12 @@
 endif()

 macro(build_zstd)
-  message(STATUS "Building zstd from source")
+  message(STATUS "Building Zstandard from source")
+  if(CMAKE_VERSION VERSION_LESS 3.7)
+    message(FATAL_ERROR "Building Zstandard using ExternalProject requires at least CMake 3.7"
+    )
+  endif()
+
   set(ZSTD_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/zstd_ep-install")

   set(ZSTD_CMAKE_ARGS
@@ -2392,10 +2388,6 @@
         -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
         -DCMAKE_C_FLAGS=${EP_C_FLAGS}
         -DCMAKE_CXX_FLAGS=${EP_CXX_FLAGS})
-  endif()
-
-  if(CMAKE_VERSION VERSION_LESS 3.7)
-    message(FATAL_ERROR "Building zstd using ExternalProject requires at least CMake 3.7")
   endif()

   externalproject_add(zstd_ep


Add missing CLANG_ANALYZE check back.

Add missing CLANG_ANALYZE check back.

--- src/build_options.cmake
+++ src/build_options.cmake
@@ -94,7 +94,7 @@
           "-Wno-padded"
           "-Wno-variadic-macros"
           )
-  elseif ()
+  elseif (CLANG_ANALYZE)
       set(CMAKE_CXX_FLAGS_LIST ${CMAKE_CXX_FLAGS_LIST}
           "--analyze"
           "-ferror-limit=0"         # Don't ever stop emitting diagnostics