cmake: remove unused macros

cmake: remove unused macros

--- bootstrap/cmake/utils.cmake
+++ bootstrap/cmake/utils.cmake
@@ -1,190 +1,3 @@
-
-macro(string_trim var str)
-	set(${var} "")
-	if (NOT "${ARGN}" STREQUAL "NOUNQUOTE")
-		# Need not trim a quoted string.
-		string_unquote(_var "${str}")
-		if (NOT _var STREQUAL "")
-			# String is quoted
-			set(${var} "${_var}")
-		endif()
-	endif()
-
-	if (${var} STREQUAL "")
-		set(_var_1 "${str}")
-		string(REGEX REPLACE  "^[ \t\r\n]+" "" _var_2 "${str}" )
-		string(REGEX REPLACE  "[ \t\r\n]+$" "" _var_3 "${_var_2}" )
-		set(${var} "${_var_3}")
-	endif()
-endmacro()
-
-
-# Internal macro
-# Variable cannot be escaped here, as variable is already substituted
-# at the time it passes to this macro.
-macro(string_escape var str)
-	# ';' and '\' are tricky, need to be encoded.
-	# '#' => '#H'
-	# '\' => '#B'
-	# ';' => '#S'
-	set(_NOESCAPE_SEMICOLON "")
-	set(_NOESCAPE_HASH "")
-
-	foreach(_arg ${ARGN})
-		if (${_arg} STREQUAL "NOESCAPE_SEMICOLON")
-			set(_NOESCAPE_SEMICOLON "NOESCAPE_SEMICOLON")
-		elseif (${_arg} STREQUAL "NOESCAPE_HASH")
-			set(_NOESCAPE_HASH "NOESCAPE_HASH")
-		endif()
-	endforeach()
-
-	if (_NOESCAPE_HASH STREQUAL "")
-		string(REGEX REPLACE "#" "#H" _ret "${str}")
-	else(_NOESCAPE_HASH STREQUAL "")
-		set(_ret "${str}")
-	endif()
-
-	string(REGEX REPLACE "\\\\" "#B" _ret "${_ret}")
-	if (_NOESCAPE_SEMICOLON STREQUAL "")
-		string(REGEX REPLACE ";" "#S" _ret "${_ret}")
-	endif()
-
-	set(${var} "${_ret}")
-endmacro()
-
-
-
-macro(string_unescape var str)
-	# '#B' => '\'
-	# '#H' => '#'
-	# '#D' => '$'
-	# '#S' => ';'
-	set(_ESCAPE_VARIABLE "")
-	set(_NOESCAPE_SEMICOLON "")
-	set(_ret "${str}")
-	foreach(_arg ${ARGN})
-		if (${_arg} STREQUAL "NOESCAPE_SEMICOLON")
-			set(_NOESCAPE_SEMICOLON "NOESCAPE_SEMICOLON")
-		elseif (${_arg} STREQUAL "ESCAPE_VARIABLE")
-			set(_ESCAPE_VARIABLE "ESCAPE_VARIABLE")
-			string(REGEX REPLACE "#D" "$" _ret "${_ret}")
-		endif()
-	endforeach()
-
-	string(REGEX REPLACE "#B" "\\\\" _ret "${_ret}")
-	if (_NOESCAPE_SEMICOLON STREQUAL "")
-		# ';' => '#S'
-		string(REGEX REPLACE "#S" "\\\\;" _ret "${_ret}")
-	else(_NOESCAPE_SEMICOLON STREQUAL "")
-		string(REGEX REPLACE "#S" ";" _ret "${_ret}")
-	endif()
-
-	if (NOT _ESCAPE_VARIABLE STREQUAL "")
-		# '#D' => '$'
-		string(REGEX REPLACE "#D" "$" _ret "${_ret}")
-	endif()
-	string(REGEX REPLACE "#H" "#" _ret "${_ret}")
-	set(${var} "${_ret}")
-endmacro()
-
-
-
-
-macro(string_unquote var str)
-	string_escape(_ret "${str}" ${ARGN})
-	if (_ret MATCHES "^[ \t\r\n]+")
-		string(REGEX REPLACE "^[ \t\r\n]+" "" _ret "${_ret}")
-	endif()
-	if (_ret MATCHES "^\"")
-		# Double quote
-		string(REGEX REPLACE "\"\(.*\)\"[ \t\r\n]*$" "\\1" _ret "${_ret}")
-	elseif (_ret MATCHES "^'")
-		# Single quote
-		string(REGEX REPLACE "'\(.*\)'[ \t\r\n]*$" "\\1" _ret "${_ret}")
-	else(_ret MATCHES "^\"")
-		set(_ret "")
-	endif()
-
-	# Unencoding
-	string_unescape(${var} "${_ret}" ${ARGN})
-
-	#	string(REGEX REPLACE "#B" "\\\\" _ret "${_ret}")
-	#string(REGEX REPLACE "#S" "\\\\;" ${var} "${_ret}")
-	#string(REGEX REPLACE "#H" "#" _ret "${_ret}")
-endmacro()
-
-
-
-
-macro(string_split var delimiter str)
-	set(_max_tokens "")
-	set(_NOESCAPE_SEMICOLON "")
-	set(_ESCAPE_VARIABLE "")
-	foreach(_arg ${ARGN})
-		if (${_arg} STREQUAL "NOESCAPE_SEMICOLON")
-			set(_NOESCAPE_SEMICOLON "NOESCAPE_SEMICOLON")
-		elseif (${_arg} STREQUAL "ESCAPE_VARIABLE")
-			set(_ESCAPE_VARIABLE "ESCAPE_VARIABLE")
-		else(${_arg} STREQUAL "NOESCAPE_SEMICOLON")
-			set(_max_tokens ${_arg})
-		endif()
-	endforeach()
-
-	if (NOT _max_tokens)
-		set(_max_tokens -1)
-	endif()
-
-	string_escape(_str "${str}" ${_NOESCAPE_SEMICOLON} ${_ESCAPE_VARIABLE})
-	string_escape(_delimiter "${delimiter}" ${_NOESCAPE_SEMICOLON} ${_ESCAPE_VARIABLE})
-
-	set(_str_list "")
-	set(_token_count 0)
-	string(LENGTH "${_delimiter}" _de_len)
-
-	while (NOT _token_count EQUAL _max_tokens)
-		math(EXPR _token_count ${_token_count}+1)
-		if (_token_count EQUAL _max_tokens)
-			# Last token, no need splitting
-			set(_str_list ${_str_list} "${_str}")
-		else(_token_count EQUAL _max_tokens)
-			# in case encoded characters are delimiters
-			string(LENGTH "${_str}" _str_len)
-			set(_index 0)
-			set(_token "")
-			set(_str_remain "")
-			math(EXPR _str_end ${_str_len}-${_de_len}+1)
-			set(_bound "k")
-			while (_index LESS _str_end)
-				string(SUBSTRING "${_str}" ${_index} ${_de_len} _str_cursor)
-				if (_str_cursor STREQUAL _delimiter)
-					# Get the token
-					string(SUBSTRING "${_str}" 0 ${_index} _token)
-					# Get the rest
-					math(EXPR _rest_index ${_index}+${_de_len})
-					math(EXPR _rest_len ${_str_len}-${_index}-${_de_len})
-					string(SUBSTRING "${_str}" ${_rest_index} ${_rest_len} _str_remain)
-					set(_index ${_str_end})
-				else(_str_cursor STREQUAL _delimiter)
-					math(EXPR _index ${_index}+1)
-				endif()
-			endwhile(_index LESS _str_end)
-
-			if (_str_remain STREQUAL "")
-				# Meaning: end of string
-				list(APPEND _str_list "${_str}")
-				set(_max_tokens ${_token_count})
-			else(_str_remain STREQUAL "")
-				list(APPEND _str_list "${_token}")
-				set(_str "${_str_remain}")
-			endif()
-		endif()
-	endwhile()
-
-	# Unencoding
-	string_unescape(${var} "${_str_list}" ${_NOESCAPE_SEMICOLON} ${_ESCAPE_VARIABLE})
-endmacro()
-
-
 macro(system varname)
 	execute_process(COMMAND ${ARGN} OUTPUT_VARIABLE ${varname}
 		OUTPUT_STRIP_TRAILING_WHITESPACE)


ADD QmitkApplicationBase/QmitkRawImageFileOpener.ui

--- Qmitk/files.cmake
+++ Qmitk/files.cmake
@@ -58,6 +58,7 @@
   QmitkApplicationBase/QmitkControlsLeftFctLayoutTemplate.ui
   QmitkApplicationBase/QmitkControlsRightFctLayoutTemplate.ui
   QmitkApplicationBase/QmitkMainTemplate.ui
+  QmitkApplicationBase/QmitkRawImageFileOpener.ui
   QmitkApplicationBase/QmitkNablaBase.ui
   QmitkApplicationBase/QmitkOptionDialog.ui
   QmitkApplicationBase/QmitkRenderWindowSelector.ui


- Fix Android toolchain, exports CXX_STL which may be exported safely  - Remove support for system and stlport STL libraries, they are trash  - Remove support for shared library versions of libc++ and gnustl, static is good

--- cmake/Toolchains/all-android.toolchain.cmake
+++ cmake/Toolchains/all-android.toolchain.cmake
@@ -260,34 +260,22 @@
 # STL.
 set(ANDROID_STL_STATIC_LIBRARIES)
 set(ANDROID_STL_SHARED_LIBRARIES)
-if(ANDROID_STL STREQUAL system)
-        set(ANDROID_STL_STATIC_LIBRARIES
-                supc++)
-elseif(ANDROID_STL STREQUAL stlport_static)
-        set(ANDROID_STL_STATIC_LIBRARIES
-                stlport_static)
-elseif(ANDROID_STL STREQUAL stlport_shared)
-        set(ANDROID_STL_SHARED_LIBRARIES
-                stlport_shared)
-elseif(ANDROID_STL STREQUAL gnustl_static)
+set(ANDROID_CXX_LINK_MODE)
+set(ANDROID_CXX_STL_LIB)
+
+if(ANDROID_STL STREQUAL gnustl_static)
         set(ANDROID_STL_STATIC_LIBRARIES
                 gnustl_static)
-elseif(ANDROID_STL STREQUAL gnustl_shared)
-        set(ANDROID_STL_STATIC_LIBRARIES
-                supc++)
-        set(ANDROID_STL_SHARED_LIBRARIES
-                gnustl_shared)
+        set(ANDROID_CXX_STL_LIB gnustl_static)
+        set(ANDROID_CXX_LINK_MODE STATIC)
 elseif(ANDROID_STL STREQUAL c++_static)
         set(ANDROID_STL_STATIC_LIBRARIES
                 c++_static
                 c++abi
                 unwind
                 android_support)
-elseif(ANDROID_STL STREQUAL c++_shared)
-        set(ANDROID_STL_STATIC_LIBRARIES
-                unwind)
-        set(ANDROID_STL_SHARED_LIBRARIES
-                c++_shared)
+        set(ANDROID_CXX_STL_LIB c++_static)
+        set(ANDROID_CXX_LINK_MODE STATIC)
 elseif(ANDROID_STL STREQUAL none)
 else()
         message(FATAL_ERROR "Invalid Android STL: ${ANDROID_STL}.")
@@ -409,21 +397,12 @@
 endif()

 # STL specific flags.
-if(ANDROID_STL STREQUAL system)
+if(ANDROID_STL MATCHES "^gnustl_")
         set(ANDROID_STL_PREFIX gnu-libstdc++/4.9)
         set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES_TMP
-                $<BUILD_INTERFACE:${ANDROID_NDK}/sources/cxx-stl/system/include>)
-elseif(ANDROID_STL MATCHES "^stlport_")
-        set(ANDROID_STL_PREFIX stlport)
-        set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES_TMP
-                $<BUILD_INTERFACE:${ANDROID_NDK}/sources/cxx-stl/${ANDROID_STL_PREFIX}/stlport>
-                $<BUILD_INTERFACE:${ANDROID_NDK}/sources/cxx-stl/gabi++/include>)
-elseif(ANDROID_STL MATCHES "^gnustl_")
-        set(ANDROID_STL_PREFIX gnu-libstdc++/4.9)
-        set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES_TMP
-                $<BUILD_INTERFACE:${ANDROID_NDK}/sources/cxx-stl/${ANDROID_STL_PREFIX}/include>
-                $<BUILD_INTERFACE:${ANDROID_NDK}/sources/cxx-stl/${ANDROID_STL_PREFIX}/libs/${ANDROID_ABI}/include>
-                $<BUILD_INTERFACE:${ANDROID_NDK}/sources/cxx-stl/${ANDROID_STL_PREFIX}/include/backward>)
+                ${ANDROID_NDK}/sources/cxx-stl/${ANDROID_STL_PREFIX}/include
+                ${ANDROID_NDK}/sources/cxx-stl/${ANDROID_STL_PREFIX}/libs/${ANDROID_ABI}/include
+                ${ANDROID_NDK}/sources/cxx-stl/${ANDROID_STL_PREFIX}/include/backward)
 elseif(ANDROID_STL MATCHES "^c\\+\\+_")
         set(ANDROID_STL_PREFIX llvm-libc++)
         if(ANDROID_ABI MATCHES "^armeabi")
@@ -440,18 +419,18 @@
                         -fno-strict-aliasing)
         endif()
         set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES_TMP
-                $<BUILD_INTERFACE:${ANDROID_NDK}/sources/cxx-stl/${ANDROID_STL_PREFIX}/include>
-                $<BUILD_INTERFACE:${ANDROID_NDK}/sources/android/support/include>
-                $<BUILD_INTERFACE:${ANDROID_NDK}/sources/cxx-stl/${ANDROID_STL_PREFIX}abi/include>)
+                ${ANDROID_NDK}/sources/cxx-stl/${ANDROID_STL_PREFIX}/include
+                ${ANDROID_NDK}/sources/android/support/include
+                ${ANDROID_NDK}/sources/cxx-stl/${ANDROID_STL_PREFIX}abi/include)
 endif()
 set(ANDROID_CXX_STANDARD_LIBRARIES)
 foreach(library ${ANDROID_STL_STATIC_LIBRARIES})
         list(APPEND ANDROID_CXX_STANDARD_LIBRARIES
-                $<BUILD_INTERFACE:${ANDROID_NDK}/sources/cxx-stl/${ANDROID_STL_PREFIX}/libs/${ANDROID_ABI}/lib${library}.a>)
+                ${ANDROID_NDK}/sources/cxx-stl/${ANDROID_STL_PREFIX}/libs/${ANDROID_ABI}/lib${library}.a)
 endforeach()
 foreach(library ${ANDROID_STL_SHARED_LIBRARIES})
         list(APPEND ANDROID_CXX_STANDARD_LIBRARIES
-                $<BUILD_INTERFACE:${ANDROID_NDK}/sources/cxx-stl/${ANDROID_STL_PREFIX}/libs/${ANDROID_ABI}/lib${library}.so>)
+                ${ANDROID_NDK}/sources/cxx-stl/${ANDROID_STL_PREFIX}/libs/${ANDROID_ABI}/lib${library}.so)
 endforeach()
 if(ANDROID_ABI STREQUAL armeabi AND NOT ANDROID_STL MATCHES "^(none|system)$")
         list(APPEND ANDROID_CXX_STANDARD_LIBRARIES
@@ -462,6 +441,13 @@
 if(ANDROID_CXX_STANDARD_LIBRARIES)
         string(REPLACE ";" "\" \"" ANDROID_CXX_STANDARD_LIBRARIES "\"${ANDROID_CXX_STANDARD_LIBRARIES}\"")
         set(CMAKE_CXX_STANDARD_LIBRARIES_INIT_TMP "${CMAKE_CXX_STANDARD_LIBRARIES_INIT_TMP} ${ANDROID_CXX_STANDARD_LIBRARIES}")
+endif()
+
+set ( ANDROID_CXX_STL_LIB "${ANDROID_NDK}/sources/cxx-stl/${ANDROID_STL_PREFIX}/libs/${ANDROID_ABI}/lib${ANDROID_CXX_STL_LIB}" )
+if("${ANDROID_CXX_LINK_MODE}" STREQUAL "STATIC")
+    set ( ANDROID_CXX_STL_LIB ${ANDROID_CXX_STL_LIB}.a )
+else()
+    set ( ANDROID_CXX_STL_LIB ${ANDROID_CXX_STL_LIB}.so )
 endif()

 # Configuration specific flags.
@@ -653,8 +639,18 @@
     set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
 endif()

-include_directories ( SYSTEM "${CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES_TMP}" )
-LINK_LIBRARIES( "${CMAKE_CXX_STANDARD_LIBRARIES_INIT_TMP};${CMAKE_C_STANDARD_LIBRARIES_INIT}" )
+if(NOT TARGET CXX_STL)
+    add_library ( CXX_STL ${ANDROID_CXX_LINK_MODE} IMPORTED )
+
+    set_target_properties ( CXX_STL
+        PROPERTIES
+        INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES_TMP}"
+        INTERFACE_LINK_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES_INIT_TMP}"
+        IMPORTED_LOCATION "${ANDROID_CXX_STL_LIB}"
+        )
+endif()
+
+LINK_LIBRARIES( CXX_STL )

 set ( CMAKE_FIND_ROOT_PATH
     "${CMAKE_FIND_ROOT_PATH};${COFFEE_ROOT_DIR};${NATIVE_LIBRARY_DIR};${CMAKE_SOURCE_DIR}/libs"


resolve conflict

resolve conflict

--- SuperBuild.cmake
+++ SuperBuild.cmake
@@ -64,7 +64,7 @@
   message(STATUS "Found PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}")
   message(STATUS "Python version ${PYTHON_VERSION_STRING}")
 endif()
-find_package(PythonLibs)
+FIND_PACKAGE(PythonLibs)
 if (PYTHONLIBS_FOUND)
   message(STATUS "Found PYTHON_INCLUDE_DIRS=${PYTHON_INCLUDE_DIRS}")
   message(STATUS "Found PYTHON_LIBRARIES=${PYTHON_LIBRARIES}")


BUG: Find Slicer when building as an extension and unset variables for ITK and SlicerExecutionModel

If the variables for ITK and SlicerExecutionModel are not unset, the package will use Slicer versions and will cause a conflict when building DTI-Reg as it needs specific options

--- SuperBuild.cmake
+++ SuperBuild.cmake
@@ -11,6 +11,45 @@
 if(WIN32)
   set(fileextension .exe)
 endif()
+
+if( DTI-Reg_BUILD_SLICER_EXTENSION )
+  #-----------------------------------------------------------------------------
+  # Extension meta-information
+  set(EXTENSION_HOMEPAGE "http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Extensions/DTI-Reg")
+  set(EXTENSION_CATEGORY "Diffusion")
+  set(EXTENSION_CONTRIBUTORS "Francois Budin (UNC), Clement Vachet (SCI), Martin Styner (UNC)")
+  set(EXTENSION_DESCRIPTION "DTI-Reg is an application that performs pair-wise DTI registration, using scalar FA (or MD) map to drive the registration. Individual steps of the pair-wise registration pipeline are performed via external applications - some of them being 3D Slicer modules. Starting with two input DTI images, scalar FA maps are generated via dtiprocess. Registration is then performed between these FA maps, via BRAINSFit/BRAINSDemonWarp or ANTS -Advanced Normalization Tools-, which provide different registration schemes: rigid, affine, BSpline, diffeomorphic, logDemons. The final deformation is then applied to the source DTI image via ResampleDTIlogEuclidean.")
+  set(EXTENSION_ICONURL "https://raw.githubusercontent.com/NIRALUser/DTI-Reg/master/DTI-Reg-icon.png")
+  set(EXTENSION_SCREENSHOTURLS "http://www.slicer.org/slicerWiki/images/c/c5/DTI-Reg_-_Misaligned_DTIs.png http://www.slicer.org/slicerWiki/images/1/12/DTI-Reg_-_Aligned_DTIs_-_Coronal.png")
+  set(EXTENSION_DEPENDS "DTIProcess ResampleDTIlogEuclidean") # Specified as a space separated list or 'NA' if any
+#  set(EXTENSION_BUILD_SUBDIRECTORY DTI-Reg-build)
+  set(EXTENSION_BUILD_SUBDIRECTORY . )
+  set(SUPERBUILD_TOPLEVEL_PROJECT DTI-Reg)
+
+  # Slicer
+  find_package(Slicer REQUIRED)
+  include(${Slicer_USE_FILE})
+  include(SlicerExtensionsConfigureMacros)
+  mark_as_superbuild(Slicer_DIR)
+
+  #------------------------------------------------------------------------------
+  # Configure extension
+  #------------------------------------------------------------------------------
+
+  # We need to recompile ITK because we need BatchMake to be compiled statically.
+  # Therefore we recompile all the libraries even though Slicer has already built the libraries we need.
+  set( COMPILE_EXTERNAL_DTIProcess OFF CACHE BOOL "Compile External DTIProcess" FORCE )
+  set( COMPILE_EXTERNAL_BRAINSTools OFF CACHE BOOL "Compile External BRAINSTools" FORCE )
+  set( COMPILE_EXTERNAL_ResampleDTIlogEuclidean OFF CACHE BOOL "Compile External ResampleDTIlogEuclidean" FORCE )
+  set( COMPILE_EXTERNAL_ITKTransformTools ON CACHE BOOL "Compile External ITKTransformTools" FORCE )
+  set( COMPILE_EXTERNAL_ANTs ON CACHE BOOL "Compile External ANTs" FORCE )
+  set( EXTENSION_NO_CLI ITKTransformTools ANTS )
+  set( CONFIGURE_TOOLS_PATHS OFF CACHE BOOL "Use CMake to find where the tools are and hard-code their path in the executable" FORCE )
+
+  unsetForSlicer(NAMES ITK_DIR SlicerExecutionModel_DIR BUILD_SHARED_LIBS RapidJSON_DIR RapidJSON_INCLUDE_DIR JsonCpp_INCLUDE_DIR JsonCpp_LIBRARY)
+
+endif()
+
 #-----------------------------------------------------------------------------
 include(${CMAKE_CURRENT_SOURCE_DIR}/Common.cmake)
 #-----------------------------------------------------------------------------
@@ -140,25 +179,6 @@

 set(${LOCAL_PROJECT_NAME}_DEPENDENCIES "")
 set(LIST_TOOLS "")
-#------------------------------------------------------------------------------
-# Configure extension
-#------------------------------------------------------------------------------
-
-if( DTI-Reg_BUILD_SLICER_EXTENSION )
-  # We need to recompile ITK because we need BatchMake to be compiled statically.
-  # Therefore we recompile all the libraries even though Slicer has already built the libraries we need.
-  set( COMPILE_EXTERNAL_DTIProcess OFF CACHE BOOL "Compile External DTIProcess" FORCE )
-  set( COMPILE_EXTERNAL_BRAINSTools OFF CACHE BOOL "Compile External BRAINSTools" FORCE )
-  set( COMPILE_EXTERNAL_ResampleDTIlogEuclidean OFF CACHE BOOL "Compile External ResampleDTIlogEuclidean" FORCE )
-  set( COMPILE_EXTERNAL_ITKTransformTools ON CACHE BOOL "Compile External ITKTransformTools" FORCE )
-  set( COMPILE_EXTERNAL_ANTs ON CACHE BOOL "Compile External ANTs" FORCE )
-  set( EXTENSION_NO_CLI ITKTransformTools ANTS )
-  set( CONFIGURE_TOOLS_PATHS OFF CACHE BOOL "Use CMake to find where the tools are and hard-code their path in the executable" FORCE )
-  # Import DTIProcess targets for the tests
-  # DTIProcess_DIR is set because DTI-Reg is defined as dependent of the extension DTIProcess
-  include( ${DTIProcess_DIR}/ImportDTIProcessExtensionExecutables.cmake )
-  include( ${ResampleDTIlogEuclidean_DIR}/ResampleDTIlogEuclidean-exports.cmake )
-endif()

 #------------------------------------------------------------------------------
 # Configure tools paths
@@ -189,12 +209,14 @@
 option(USE_SYSTEM_ITK "Build using an externally defined version of ITK" OFF)
 option(USE_SYSTEM_SlicerExecutionModel "Build using an externally defined version of SlicerExecutionModel"  OFF)
 option(USE_SYSTEM_BatchMake "Build using an externally defined version of BatchMake" OFF)
+option(USE_SYSTEM_ANTs "Build using an externally defined version of ANTs" OFF)

 #------------------------------------------------------------------------------
 # ${LOCAL_PROJECT_NAME} dependency list
 #------------------------------------------------------------------------------

 list( APPEND ${LOCAL_PROJECT_NAME}_DEPENDENCIES ITKv4 SlicerExecutionModel BatchMake )
+
 set(USE_ITK_Module_MGHIO TRUE)
 #set(${PROJECT_NAME}_BUILD_DICOM_SUPPORT TRUE )
 set(${PROJECT_NAME}_BUILD_ZLIB_SUPPORT TRUE )
@@ -357,15 +379,15 @@
 set(proj_build ${proj}-build)

 if( DTI-Reg_BUILD_SLICER_EXTENSION )
-  unsetForSlicer( NAMES SlicerExecutionModel_DIR DCMTK_DIR ITK_DIR CMAKE_C_COMPILER CMAKE_CXX_COMPILER CMAKE_CXX_FLAGS CMAKE_C_FLAGS zlib_DIR ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
-  # Create fake imported target to avoid importing Slicer target: See SlicerConfig.cmake:line 820
-  add_library(SlicerBaseLogic SHARED IMPORTED)
-  find_package(Slicer REQUIRED)
-  include(${Slicer_USE_FILE})
-  if(BUILD_TESTING)
-    add_subdirectory(Testing)
-  endif()
-  resetForSlicer( NAMES ITK_DIR SlicerExecutionModel_DIR CMAKE_C_COMPILER CMAKE_CXX_COMPILER CMAKE_CXX_FLAGS CMAKE_C_FLAGS zlib_DIR ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
+  # unsetForSlicer( NAMES SlicerExecutionModel_DIR DCMTK_DIR ITK_DIR CMAKE_C_COMPILER CMAKE_CXX_COMPILER CMAKE_CXX_FLAGS CMAKE_C_FLAGS zlib_DIR ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
+  # # Create fake imported target to avoid importing Slicer target: See SlicerConfig.cmake:line 820
+  # add_library(SlicerBaseLogic SHARED IMPORTED)
+  # find_package(Slicer REQUIRED)
+  # include(${Slicer_USE_FILE})
+  # if(BUILD_TESTING)
+  #   add_subdirectory(Testing)
+  # endif()
+  # resetForSlicer( NAMES ITK_DIR SlicerExecutionModel_DIR CMAKE_C_COMPILER CMAKE_CXX_COMPILER CMAKE_CXX_FLAGS CMAKE_C_FLAGS zlib_DIR ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
   set( NOCLI_INSTALL_DIR ${SlicerExecutionModel_DEFAULT_CLI_INSTALL_RUNTIME_DESTINATION}/../ExternalBin)
   foreach( VAR ${EXTENSION_NO_CLI})
     install( PROGRAMS ${${VAR}TOOL} DESTINATION ${NOCLI_INSTALL_DIR} )
@@ -380,6 +402,12 @@
             DESTINATION ${INSTALL_RUNTIME_DESTINATION}
          )
   endforeach()
+
+  # Import DTIProcess targets for the tests
+  # DTIProcess_DIR is set because DTI-Reg is defined as dependent of the extension DTIProcess
+  include( ${DTIProcess_DIR}/ImportDTIProcessExtensionExecutables.cmake )
+  include( ${ResampleDTIlogEuclidean_DIR}/ResampleDTIlogEuclidean-exports.cmake )
+
 endif()

 ExternalProject_Add(${proj}


STYLE: Missing header for SuperBuild.cmake

--- SuperBuild.cmake
+++ SuperBuild.cmake
@@ -1,3 +1,25 @@
+##############################################################################
+#
+# Library:   TubeTK
+#
+# Copyright 2010 Kitware Inc. 28 Corporate Drive,
+# Clifton Park, NY, 12065, USA.
+#
+# All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+##############################################################################
 include(ExternalProject)

 set(base "${CMAKE_BINARY_DIR}")


Pass an initial cache file through the super build.

--- SuperBuild.cmake
+++ SuperBuild.cmake
@@ -174,6 +174,10 @@
 # MITK Configure
 #-----------------------------------------------------------------------------

+IF(MITK_INITIAL_CACHE_FILE)
+  SET(mitk_initial_cache_arg -C "${MITK_INITIAL_CACHE_FILE}")
+ENDIF()
+
 SET(proj MITK-Configure)

 ExternalProject_Add(${proj}
@@ -195,6 +199,7 @@
     -DGDCM_DIR:PATH=${GDCM_DIR}
     -DBOOST_ROOT:PATH=${BOOST_ROOT}
     -DMITK_DATA_DIR:PATH=${MITK_DATA_DIR}
+    ${mitk_initial_cache_arg}

   SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}
   BINARY_DIR ${CMAKE_BINARY_DIR}/MITK-build


Make LLVM_ROOT_DIR a cached CMake variable

--- atdna/FindLLVM.cmake
+++ atdna/FindLLVM.cmake
@@ -27,6 +27,7 @@
 # We also want an user-specified LLVM_ROOT_DIR to take precedence over the
 # system default locations such as /usr/local/bin. Executing find_program()
 # multiples times is the approach recommended in the docs.
+set(LLVM_ROOT_DIR "" CACHE PATH "Location of LLVM development root")
 set(LLVM_FIND_COMPONENTS "")
 if(WIN32)
 get_filename_component(LLVM_ROOT_DIR [HKEY_LOCAL_MACHINE\\Software\\LLVM\\LLVM] ABSOLUTE)


Resolve GoogleTest link issues on Windows

--- NonServerBuild.cmake
+++ NonServerBuild.cmake
@@ -2,6 +2,9 @@

 # If GoogleTest is checked out then include it and we can run some tests
 IF(EXISTS "${PROJECT_SOURCE_DIR}/thirdparty/googletest/CMakeLists.txt")
+    SET(gtest_force_shared_crt ON CACHE BOOL
+        "Use shared (DLL) run-time lib even when Google Test
+        is built as static lib.")
     ADD_SUBDIRECTORY(thirdparty/googletest EXCLUDE_FROM_ALL)
 ENDIF ()


Fix path to BOOST_DIR

Fix path to BOOST_DIR

--- appveyor.cmake
+++ appveyor.cmake
@@ -1,2 +1,2 @@
 set(BUILD_DIR C:/projects/morebin CACHE PATH "")
-set(BOOST_DIR C:\Libraries\boost_1_60_0 "")
+set(BOOST_DIR C:/Libraries/boost_1_60_0 "")


fix erroneous clipout

fix erroneous clipout

--- Tools/CMake/basics.cmake
+++ Tools/CMake/basics.cmake
@@ -496,3 +496,26 @@
         SET("CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CONF}" "${projectOutDir}")
     ENDFOREACH()
 endif()
+
+###############################################################################
+# Properties folder
+###############################################################################
+# we only need to add libs that we add via add_subdirectory command, basics.cmake
+# will take care of the other source libs added via addLib
+
+if(TORQUE_SFX_OPENAL AND WIN32)
+    set_target_properties(OpenAL PROPERTIES FOLDER ${TORQUE_LIBS_FOLDER_NAME})
+     #why is openal adding these two?
+    set_target_properties(common PROPERTIES FOLDER ${TORQUE_LIBS_FOLDER_NAME})
+    set_target_properties(ex-common PROPERTIES FOLDER ${TORQUE_LIBS_FOLDER_NAME})
+endif()
+
+if(TORQUE_SDL)
+    # Apple config has slightly different target names
+    if (APPLE)
+        set_target_properties(SDL2main PROPERTIES FOLDER ${TORQUE_LIBS_FOLDER_NAME})
+        set_target_properties(SDL2-static PROPERTIES FOLDER ${TORQUE_LIBS_FOLDER_NAME})
+    else()
+        set_target_properties(SDL2 PROPERTIES FOLDER ${TORQUE_LIBS_FOLDER_NAME})
+    endif()
+endif()


ENH:  Updated FindFFTW.cmake to be more robust and to do a better job of respecting the CMAKE_LIB_PATH environmental variable.

--- CMake/FindFFTW.cmake
+++ CMake/FindFFTW.cmake
@@ -1,8 +1,28 @@
 IF (USE_FFTW)
+
+SET(FFTW_INC_SEARCHPATH
+  /sw/include
+  /usr/include
+  /usr/local/include
+  /usr/include/fftw
+  /usr/local/include/fftw
+)
+
+FIND_PATH(FFTW_INCLUDE_PATH fftw3.h ${FFTW_INC_SEARCHPATH})
+
+IF(FFTW_INCLUDE_PATH)
+  SET(FFTW_INCLUDE ${FFTW_INCLUDE_PATH})
+ENDIF (FFTW_INCLUDE_PATH)
+
+IF(FFTW_INCLUDE)
+  INCLUDE_DIRECTORIES( ${FFTW_INCLUDE})
+ENDIF(FFTW_INCLUDE)
+
+GET_FILENAME_COMPONENT(FFTW_INSTALL_BASE_PATH ${FFTW_INCLUDE_PATH} PATH)
+
 SET(FFTW_LIB_SEARCHPATH
-  /usr/lib
+  ${FFTW_INSTALL_BASE_PATH}/lib
   /usr/lib/fftw
-  /usr/local/lib
   /usr/local/lib/fftw
 )

@@ -26,23 +46,6 @@
   SET(FFTW_LIB ${FFTWD_LIB} ${FFTWF_LIB}) #For backwards compatibility
 ENDIF(FFTWD_LIB AND FFTWF_LIB)

-SET(FFTW_INC_SEARCHPATH
-  /sw/include
-  /usr/include
-  /usr/include/fftw
-  /usr/local/include
-  /usr/local/include/fftw
-)
-
-FIND_PATH(FFTW_INCLUDE_PATH fftw3.h ${FFTW_INC_SEARCHPATH})
-
-IF(FFTW_INCLUDE_PATH)
-  SET(FFTW_INCLUDE ${FFTW_INCLUDE_PATH})
-ENDIF (FFTW_INCLUDE_PATH)
-
-IF(FFTW_INCLUDE)
-  INCLUDE_DIRECTORIES( ${FFTW_INCLUDE})
-ENDIF(FFTW_INCLUDE)

 MARK_AS_ADVANCED(FFTW_INCLUDE_PATH FFTWD_LIB FFTWF_LIB)
 OPTION(FFTW_INCLUDE_PATH "The base path of the directory that includes fftw3.h" )


Support debug/release distinction in FindZstd

Summary: This gets Folly working with the zstd package provided by vcpkg.

Reviewed By: yfeldblum

Differential Revision: D8176531

fbshipit-source-id: 05fdd5915a677a862791cfcc5587f7a396fb4c51

--- CMake/FindZstd.cmake
+++ CMake/FindZstd.cmake
@@ -7,7 +7,12 @@
 #

 find_path(ZSTD_INCLUDE_DIR NAMES zstd.h)
-find_library(ZSTD_LIBRARY NAMES zstd)
+
+find_library(ZSTD_LIBRARY_DEBUG NAMES zstdd)
+find_library(ZSTD_LIBRARY_RELEASE NAMES zstd)
+
+include(SelectLibraryConfigurations)
+SELECT_LIBRARY_CONFIGURATIONS(ZSTD)

 include(FindPackageHandleStandardArgs)
 FIND_PACKAGE_HANDLE_STANDARD_ARGS(


ENH: increasing frequency of continuous check

--- DashboardScripts/tubetk_run_continuous.cmake
+++ DashboardScripts/tubetk_run_continuous.cmake
@@ -60,7 +60,7 @@
     endif()

     # loop no faster than once every 2 minutes
-    ctest_sleep( 120 )
+    ctest_sleep( 60 )

   endwhile()


updated TEST_MODELS_HASH

updated TEST_MODELS_HASH

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

 set(CTEST_PROJECT_NAME "Embree")
 set(CTEST_NIGHTLY_START_TIME "22:00:00 UTC")
-set(TEST_MODELS_HASH a8b0b625666892409c64ac01ee46add212551f33)
+set(TEST_MODELS_HASH d8e7eaa8092c8f5ef00a835d1d34862b4e029155)

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


ENH: Move back to main VTK project for CTest submission

Change-Id: If8ae82e20adcc3c7329e1b3f82694ba1130ea392

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

 set(CTEST_DROP_METHOD "http")
 set(CTEST_DROP_SITE "www.cdash.org")
-set(CTEST_DROP_LOCATION "/CDash/submit.php?project=VTKModular")
+set(CTEST_DROP_LOCATION "/CDash/submit.php?project=VTK")
 set(CTEST_DROP_SITE_CDASH TRUE)


From Michael Platings, "Autodesk have re-released 2011.3 of the FBX SDK with Visual Studio 2010 support ( http://images.autodesk.com/adsk/files/fbx20113_fbxsdk_win_static.exe ). I've attached an updated FindFBX.cmake that supports this latest version but also retains support for FBX 2011.2 for those who don't want to update."

--- CMakeModules/FindFBX.cmake
+++ CMakeModules/FindFBX.cmake
@@ -18,8 +18,10 @@
     SET(FBX_LIBNAME "fbxsdk_md2003")
 ELSEIF(MSVC80)
     SET(FBX_LIBNAME "fbxsdk_md2005")
-ELSEIF(MSVC90 OR MSVC_VER>1500)
+ELSEIF(MSVC90)
     SET(FBX_LIBNAME "fbxsdk_md2008")
+ELSEIF(MSVC100 OR MSVC_VER>1600)
+    SET(FBX_LIBNAME "fbxsdk_md2010")
 ENDIF()

 IF(CMAKE_CL_64)
@@ -33,8 +35,11 @@
 ENDIF()

 # SET final path
+#osg_fbx code is compatible with 2011.2 and 2011.3 so find either directory
 SET( FBX_SEARCH_PATHS
     $ENV{FBX_DIR}
+    $ENV{PROGRAMFILES}/Autodesk/FBX/FbxSdk/2011.3
+    /Applications/Autodesk/FBXSDK20113
     $ENV{PROGRAMFILES}/Autodesk/FBX/FbxSdk/2011.2
     /Applications/Autodesk/FBXSDK20112
 )


proCustomBuild support for BUILD_FUNC_ARG

* pass a specified argument to the BUILD_FUNC

for example, to have pro/build.cmake call
  build_glew_bldver(${PRO_GLEW_1.13.0})

one would add to the PRO_GLEW_${VER} variable
  BUILD_FUNC build_glew_bldver
  BUILD_FUNC_ARG \${PRO_GLEW_${VER}}

escaping the first $ so cmake doesn't expand the variable

this should be very useful for webpro
* remove all the build functions that call wpYarnPack()
* set BUILD_FUNC to wpYarnPack
* set BUILD_FUNC_ARG to an escaped PRO_<PROJECT>

set(PRO_AG-GRID_${VER_}
  ...
  BUILD_FUNC wpYarnPack
  BUILD_FUNC_ARG \${PRO_AG-GRID_${VER_}
  )

issue https://github.com/smanders/externpro/issues/244

--- modules/macpro.cmake
+++ modules/macpro.cmake
@@ -167,10 +167,14 @@
 endmacro()

 function(proCustomBuild)
-  set(oneValueArgs BUILD_FUNC)
+  set(oneValueArgs BUILD_FUNC BUILD_FUNC_ARG)
   cmake_parse_arguments(X "" "${oneValueArgs}" "" ${ARGN})
   if(DEFINED X_BUILD_FUNC AND COMMAND ${X_BUILD_FUNC})
-    file(APPEND ${stepBuild} "${X_BUILD_FUNC}()\n")
+    if(DEFINED X_BUILD_FUNC_ARG)
+      file(APPEND ${stepBuild} "${X_BUILD_FUNC}(${X_BUILD_FUNC_ARG})\n")
+    else()
+      file(APPEND ${stepBuild} "${X_BUILD_FUNC}()\n")
+    endif()
   endif()
 endfunction()


corrected armadillo patch command

corrected armadillo patch command

--- armadillo.cmake
+++ armadillo.cmake
@@ -30,7 +30,8 @@
     URL_MD5             ${armadillo_MD5}
     UPDATE_COMMAND      ""
     PATCH_COMMAND       ${BUILDEM_ENV_STRING} ${PATCH_EXE}
-    	${armadillo}/include/armadillo_bits/config.hpp ${PATCH_DIR}/armadillo.patch
+    	${armadillo_SRC_DIR}/include/armadillo_bits/config.hpp
+        ${PATCH_DIR}/armadillo.patch

     CONFIGURE_COMMAND   ${BUILDEM_ENV_STRING} ${CMAKE_COMMAND} ${armadillo_SRC_DIR}


Fix GITHUB_USER fork using ENV variable

Fix GITHUB_USER fork using ENV variable

--- GitExternal.cmake
+++ GitExternal.cmake
@@ -37,7 +37,7 @@
 include(CMakeParseArguments)
 option(GIT_EXTERNAL_VERBOSE "Print git commands as they are executed" OFF)

-if(NOT GITHUB_USER AND "$ENV{GITHUB_USER}")
+if(NOT GITHUB_USER AND DEFINED ENV{GITHUB_USER})
   set(GITHUB_USER $ENV{GITHUB_USER} CACHE STRING
     "Github user name used to setup remote for 'user' forks")
 endif()


Only build CSE executable in build scripts.

--- cmake/build.cmake
+++ cmake/build.cmake
@@ -2,6 +2,7 @@
 execute_process(COMMAND ${CMAKE_COMMAND}
   --build ${CMAKE_CURRENT_SOURCE_DIR}/msvc/build
   --config Release
+  --target CSE
   -- -m
   WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/msvc/build
   RESULT_VARIABLE success


Have CMAKE parse conditional lines in KERNEL files

Supports ifeq and ifneq, but requires both to have an else branch

--- cmake/utils.cmake
+++ cmake/utils.cmake
@@ -15,10 +15,33 @@
 # Reads a Makefile into CMake vars.
 macro(ParseMakefileVars MAKEFILE_IN)
   message(STATUS "Reading vars from ${MAKEFILE_IN}...")
+        set (IfElse 0)
+        set (ElseSeen 0)
   file(STRINGS ${MAKEFILE_IN} makefile_contents)
   foreach (makefile_line ${makefile_contents})
+#message(STATUS "parsing ${makefile_line}")
+    if (${IfElse} GREATER 0)
+      string(REGEX MATCH "endif[ \t]*" line_match "${makefile_line}")
+      if (NOT "${line_match}" STREQUAL "")
+#           message(STATUS "ENDIF ${makefile_line}")
+        set (IfElse 0)
+        set (ElseSeen 0)
+        continue ()
+      endif ()
+      string(REGEX MATCH "else[ \t]*" line_match "${makefile_line}")
+        if (NOT "${line_match}" STREQUAL "")
+#           message(STATUS "ELSE ${makefile_line}")
+           set (ElseSeen 1)
+           continue ()
+        endif()
+      if ( (${IfElse} EQUAL 2 AND ${ElseSeen} EQUAL 0) OR ( ${IfElse} EQUAL 1 AND ${ElseSeen} EQUAL 1))
+#           message(STATUS "skipping ${makefile_line}")
+         continue ()
+      endif ()
+    endif ()
     string(REGEX MATCH "([0-9_a-zA-Z]+)[ \t]*=[ \t]*(.+)$" line_match "${makefile_line}")
     if (NOT "${line_match}" STREQUAL "")
+#message(STATUS "match on ${line_match}")
       set(var_name ${CMAKE_MATCH_1})
       set(var_value ${CMAKE_MATCH_2})
       # check for Makefile variables in the string, e.g. $(TSUFFIX)
@@ -33,7 +56,31 @@
     else ()
       string(REGEX MATCH "include \\$\\(KERNELDIR\\)/(.+)$" line_match "${makefile_line}")
       if (NOT "${line_match}" STREQUAL "")
+#message(STATUS "match on include ${line_match}")
         ParseMakefileVars(${KERNELDIR}/${CMAKE_MATCH_1})
+      else ()
+#        message(STATUS "unmatched line ${line_match}")
+        string(REGEX MATCH "ifeq \\(\\$\\(([_A-Z]+)\\),[ \t]*([0-9_A-Z]+)\\)" line_match "${makefile_line}")
+        if (NOT "${line_match}" STREQUAL "")
+#          message(STATUS "IFEQ: ${line_match} first: ${CMAKE_MATCH_1} second: ${CMAKE_MATCH_2}")
+          if (${${CMAKE_MATCH_1}} STREQUAL ${CMAKE_MATCH_2})
+#            message (STATUS "condition is true")
+            set (IfElse 1)
+          else ()
+            set (IfElse 2)
+          endif ()
+        else ()
+          string(REGEX MATCH "ifneq \\(\\$\\(([_A-Z]+)\\),[ \t]*([0-9_A-Z]+)\\)" line_match "${makefile_line}")
+          if (NOT "${line_match}" STREQUAL "")
+#            message(STATUS "IFNEQ: ${line_match} first: ${CMAKE_MATCH_1} second: ${CMAKE_MATCH_2}")
+            if (NOT ( ${${CMAKE_MATCH_1}} STREQUAL ${CMAKE_MATCH_2}))
+              message (STATUS "condition is true")
+              set (IfElse 1)
+            else ()
+              set (IfElse 2)
+            endif ()
+          endif ()
+        endif ()
       endif ()
     endif ()
   endforeach ()


Search for gcov in the compiler path.

Search for gcov in the compiler path.

On OSX the wrong gcov binary may be found, if e.g. gfortran is installed by
homebrew. Then the system gcov binary will be used, but this one may be
incompatible to the gfortran version.

--- cmake/FindGcov.cmake
+++ cmake/FindGcov.cmake
@@ -37,8 +37,17 @@
 	# each compiler that is used. If gcov binary was already found for this
 	# compiler, do not try to find it again.
 	if (NOT GCOV_${CMAKE_${LANG}_COMPILER_ID}_BIN)
+		get_filename_component(COMPILER_PATH "${CMAKE_${LANG}_COMPILER}" PATH)
+
 		if ("${CMAKE_${LANG}_COMPILER_ID}" STREQUAL "GNU")
-			find_program(GCOV_BIN gcov)
+			# Some distributions like OSX (homebrew) ship gcov with the compiler
+			# version appended as gcov-x. To find this binary we'll build the
+			# suggested binary name with the compiler version.
+			string(REGEX MATCH "^[0-9]+" GCC_VERSION
+				"${CMAKE_${LANG}_COMPILER_VERSION}")
+
+			find_program(GCOV_BIN NAMES gcov-${GCC_VERSION} gcov
+				HINTS ${COMPILER_PATH})

 		elseif ("${CMAKE_${LANG}_COMPILER_ID}" STREQUAL "Clang")
 			# Some distributions like Debian ship llvm-cov with the compiler
@@ -52,7 +61,7 @@
 			# gcov tool.
 			if(LLVM_VERSION VERSION_GREATER 3.4)
 				find_program(LLVM_COV_BIN NAMES "llvm-cov-${LLVM_VERSION}"
-					"llvm-cov")
+					"llvm-cov" HINTS ${COMPILER_PATH})
 				mark_as_advanced(LLVM_COV_BIN)

 				if (LLVM_COV_BIN)
@@ -74,7 +83,7 @@
 				# Fall back to gcov binary if llvm-cov was not found or is
 				# incompatible. This is the default on OSX, but may crash on
 				# recent Linux versions.
-				find_program(GCOV_BIN gcov)
+				find_program(GCOV_BIN gcov HINTS ${COMPILER_PATH})
 			endif ()
 		endif ()


let's have a quiet FindSDL2 [skip ci]

let's have a quiet FindSDL2 [skip ci]

--- cmake/FindSDL2.cmake
+++ cmake/FindSDL2.cmake
@@ -65,7 +65,7 @@
 # (To distribute this file outside of CMake, substitute the full
 #  License text for the above reference.)

-message("<FindSDL2.cmake>")
+#message("<FindSDL2.cmake>")

 SET(SDL2_SEARCH_PATHS
 	~/Library/Frameworks
@@ -161,7 +161,7 @@
 	SET(SDL2_LIBRARY_TEMP "${SDL2_LIBRARY_TEMP}" CACHE INTERNAL "")
 ENDIF(SDL2_LIBRARY_TEMP)

-message("</FindSDL2.cmake>")
+#message("</FindSDL2.cmake>")

 INCLUDE(FindPackageHandleStandardArgs)


Fix finding of SDL main

Fix finding of SDL main

--- cmake/FindSDL2.cmake
+++ cmake/FindSDL2.cmake
@@ -165,6 +165,7 @@
 				NAMES SDL2main
 				HINTS
 				$ENV{SDL2}
+				${SDL2}
 				PATH_SUFFIXES lib64 lib
 				lib/x64
 				x86_64-w64-mingw32/lib


Add skia include directories to skia target

This is required when we link our executable with laf-gfx, and skia
dependency is imported too, so we can include SkRegion.h from
gfx/region_skia.h without a compiler error.

--- cmake/FindSkia.cmake
+++ cmake/FindSkia.cmake
@@ -54,7 +54,13 @@
   "${SKIA_DIR}/third_party/skcms"
   "${SKIA_DIR}/include/third_party/skcms")

-include_directories(
+set(SKIA_LIBRARIES
+  ${SKIA_LIBRARY}
+  ${SKIA_OPENGL_LIBRARY}
+  CACHE INTERNAL "Skia libraries")
+
+add_library(skia INTERFACE)
+target_include_directories(skia INTERFACE
   ${SKIA_DIR}
   ${SKIA_CONFIG_INCLUDE_DIR}
   ${SKIA_CORE_INCLUDE_DIR}
@@ -67,15 +73,9 @@
   ${FREETYPE_INCLUDE_DIRS}
   ${HARFBUZZ_INCLUDE_DIRS})
 if(WIN32)
-  include_directories(${SKIA_ANGLE_INCLUDE_DIR})
+  target_include_directories(skia INTERFACE
+    ${SKIA_ANGLE_INCLUDE_DIR})
 endif()
-
-set(SKIA_LIBRARIES
-  ${SKIA_LIBRARY}
-  ${SKIA_OPENGL_LIBRARY}
-  CACHE INTERNAL "Skia libraries")
-
-add_library(skia INTERFACE)
 target_link_libraries(skia INTERFACE ${SKIA_LIBRARIES})
 target_compile_definitions(skia INTERFACE
   SK_INTERNAL


mingw fix

mingw fix

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

--- cmake/gsConfig.cmake
+++ cmake/gsConfig.cmake
@@ -147,8 +147,8 @@
 endif()

 if (MINGW)
-  # export explicit template instantiations
-  #set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--export-all-symbols")
+  # export explicit template instantiations (to be fixed)
+  set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--export-all-symbols")

   # large files can overflow pe/coff sections, so use the pe+ format
   include(CheckCXXCompilerFlag)


Remove cache entries, if found OTF2 version doesn't match

--- cmake/FindOTF2.cmake
+++ cmake/FindOTF2.cmake
@@ -22,7 +22,7 @@
     MESSAGE(STATUS "no otf2-config found")
     SET(OTF2_VERSION ${OTF2_REQUIRED_VERSION})
 ELSE()
-    message(STATUS "OTF2 library found. (using ${OTF2_CONFIG})")
+    message(STATUS "OTF2 installation found. (using ${OTF2_CONFIG})")

     execute_process(COMMAND ${OTF2_CONFIG} "--interface-version" OUTPUT_VARIABLE OTF2_VERSION)
     STRING(REPLACE ":" "." OTF2_VERSION ${OTF2_VERSION})
@@ -103,7 +103,10 @@
     # make sure, if anyone uses the old interface, they still link libm
     LIST(APPEND OTF2_LIBRARIES "m" "${OTF2_LIBRARY}")
 else()
+    unset(OTF2_CONFIG)
+    unset(OTF2_CONFIG CACHE)
     unset(OTF2_PRINT)
+    unset(OTF2_PRINT CACHE)
     unset(OTF2_LINK_DIRS)
     unset(OTF2_LIBRARIES)
 endif()


get rid of the overlaborated and useless output-processing

--- cmake/checkgdb.cmake
+++ cmake/checkgdb.cmake
@@ -1,5 +1,4 @@
-execute_process(COMMAND ${EXECUTABLE} ${FILE} ${ARGS} RESULT_VARIABLE RESULT OUTPUT_VARIABLE OUTPUT)
-string(TOUPPER "${OUTPUT}" OUTPUT)
+execute_process(COMMAND ${EXECUTABLE} ${FILE} ${ARGS} RESULT_VARIABLE RESULT)
 if (RESULT)
 	#if (GDB_COMMAND AND GDB_SCRIPT)
 	#	execute_process(COMMAND ${GDB_COMMAND}
@@ -7,8 +6,5 @@
 	#		--args ${EXECUTABLE} ${FILE} ${ARGS}
 	#			RESULT_VARIABLE GDB_RESULT)
 	#endif()
-	if (OUTPUT MATCHES "THE FOLLOWING TESTS FAILED.*")
-		MESSAGE( STATUS "FAIL:  ${OUTPUT}")
-		MESSAGE( FATAL_ERROR "FAIL:  ${ARGS}, EXITCODE:  ${RESULT}" )
-	endif (OUTPUT MATCHES "THE FOLLOWING TESTS FAILED.*")
+	MESSAGE( FATAL_ERROR "FAIL:  ${ARGS}, EXITCODE:  ${RESULT}" )
 endif (RESULT)


Fix build without OpenMP

Fix build without OpenMP

--- cmake/compiler.cmake
+++ cmake/compiler.cmake
@@ -77,6 +77,10 @@
 }" HAVE_OPENMP)
 set(CMAKE_REQUIRED_FLAGS "")

+if (NOT HAVE_OPENMP)
+    add_compile_flags("C;CXX" -Wno-unknown-pragmas)
+endif()
+
 #
 # Perform build type specific configuration.
 #


cmake: qemu: Don't use the '\$' hack with Ninja

Using the '\$' technique to accept make variables corrupts Ninja build
systems, so avoid using it when generating Ninja files. Not using it
with Ninja means we need to come up with some other mechanism to
support build-time configuration of the QEMU CLI with Ninja.

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

--- cmake/emu/qemu.cmake
+++ cmake/emu/qemu.cmake
@@ -12,6 +12,13 @@
   run
   debugserver
   )
+
+set(QEMU_FLAGS -pidfile)
+if(${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
+  list(APPEND QEMU_FLAGS qemu\${QEMU_INSTANCE}.pid)
+else()
+  list(APPEND QEMU_FLAGS qemu${QEMU_INSTANCE}.pid)
+endif()

 # We can set "default" value for QEMU_PTY & QEMU_PIPE on cmake invocation.
 if(QEMU_PTY)
@@ -28,7 +35,18 @@

 # But also can set QEMU_PTY & QEMU_PIPE on *make* (not cmake) invocation,
 # like it was before cmake.
-set(QEMU_FLAGS -serial \${if \${QEMU_PTY}, pty, \${if \${QEMU_PIPE}, pipe:\${QEMU_PIPE}, ${CMAKE_QEMU_SERIAL0}}})
+if(${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
+  list(APPEND QEMU_FLAGS
+    -serial
+    \${if \${QEMU_PTY}, pty, \${if \${QEMU_PIPE}, pipe:\${QEMU_PIPE}, ${CMAKE_QEMU_SERIAL0}}}
+    # NB: \$ is not supported by Ninja
+    )
+else()
+  list(APPEND QEMU_FLAGS
+    -serial
+    ${CMAKE_QEMU_SERIAL0}
+    )
+endif()

 # Add a BT serial device when building for bluetooth, unless the
 # application explicitly opts out with NO_QEMU_SERIAL_BT_SERVER.
@@ -68,8 +86,15 @@
       # QEMU_INSTANCE is a command line argument to *make* (not cmake). By
       # appending the instance name to the pid file we can easily run more
       # instances of the same sample.
+
+      if(${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
+        set(tmp_file unix:/tmp/slip.sock\${QEMU_INSTANCE})
+      else()
+        set(tmp_file unix:/tmp/slip.sock${QEMU_INSTANCE})
+      endif()
+
       list(APPEND MORE_FLAGS_FOR_${target}
-        -serial unix:/tmp/slip.sock\${QEMU_INSTANCE}
+        -serial ${tmp_file}
         )
     endif()
   endforeach()
@@ -165,7 +190,6 @@
     COMMAND
     ${QEMU}
     ${QEMU_FLAGS_${ARCH}}
-    -pidfile qemu\${QEMU_INSTANCE}.pid
     ${QEMU_FLAGS}
     ${QEMU_EXTRA_FLAGS}
     ${MORE_FLAGS_FOR_${target}}


cmake: don't check for the compiler on every invocation of RESTRICT_SYMBOL_EXPORTS(), do it only once

--- cmake/libutils.cmake
+++ cmake/libutils.cmake
@@ -304,23 +304,22 @@
   SET(${result} ${ret} PARENT_SCOPE)
 ENDFUNCTION()

+SET(VISIBILITY_HIDDEN_FLAG)
+
+IF(CMAKE_COMPILER_IS_GNUCXX AND UNIX)
+  CHECK_C_COMPILER_FLAG("-fvisibility=hidden" HAVE_VISIBILITY_HIDDEN)
+  IF(HAVE_VISIBILITY_HIDDEN)
+    SET(VISIBILITY_HIDDEN_FLAG "-fvisibility=hidden")
+  ENDIF()
+ENDIF()
+
+IF(CMAKE_C_COMPILER_ID MATCHES "SunPro")
+  SET(VISIBILITY_HIDDEN_FLAG "-xldscope=hidden")
+ENDIF()
+
 # We try to hide the symbols in yassl/zlib to avoid name clashes with
 # other libraries like openssl.
 FUNCTION(RESTRICT_SYMBOL_EXPORTS target)
-  SET(VISIBILITY_HIDDEN_FLAG)
-
-  IF(CMAKE_COMPILER_IS_GNUCXX AND UNIX)
-    CHECK_C_COMPILER_FLAG("-fvisibility=hidden" HAVE_VISIBILITY_HIDDEN)
-    IF(HAVE_VISIBILITY_HIDDEN)
-      MESSAGE(STATUS "HAVE_VISIBILITY_HIDDEN")
-      SET(VISIBILITY_HIDDEN_FLAG "-fvisibility=hidden")
-    ENDIF()
-  ENDIF()
-
-  IF(CMAKE_C_COMPILER_ID MATCHES "SunPro")
-    SET(VISIBILITY_HIDDEN_FLAG "-xldscope=hidden")
-  ENDIF()
-
   IF(VISIBILITY_HIDDEN_FLAG)
     GET_TARGET_PROPERTY(COMPILE_FLAGS ${target} COMPILE_FLAGS)
     IF(NOT COMPILE_FLAGS)


Fix inhrit vars

Fix inhrit vars

--- project/cmake/modules/ProjectBuildTools.cmake
+++ project/cmake/modules/ProjectBuildTools.cmake
@@ -53,7 +53,7 @@
     set(project_build_tools_append_cmake_inherit_options_DISABLE_C_FLAGS FALSE)
     set(project_build_tools_append_cmake_inherit_options_DISABLE_CXX_FLAGS FALSE)
     set(project_build_tools_append_cmake_inherit_options_DISABLE_ASM_FLAGS FALSE)
-    set(project_build_tools_append_cmake_inherit_options_VARS PROJECT_BUILD_TOOLS_CMAKE_INHERIT_VARS_COMMON)
+    set(project_build_tools_append_cmake_inherit_options_VARS ${PROJECT_BUILD_TOOLS_CMAKE_INHERIT_VARS_COMMON})
     foreach(ARG ${ARGN})
         if(NOT project_build_tools_append_cmake_inherit_options_OUTVAR)
             set(project_build_tools_append_cmake_inherit_options_OUTVAR ${ARG})
@@ -70,13 +70,13 @@
     endforeach()

     if (NOT project_build_tools_append_cmake_inherit_options_DISABLE_C_FLAGS)
-        list (APPEND ${project_build_tools_append_cmake_inherit_options_VARS} PROJECT_BUILD_TOOLS_CMAKE_INHERIT_VARS_C)
+        list (APPEND ${project_build_tools_append_cmake_inherit_options_VARS} ${PROJECT_BUILD_TOOLS_CMAKE_INHERIT_VARS_C})
     endif ()
     if (NOT project_build_tools_append_cmake_inherit_options_DISABLE_CXX_FLAGS)
-        list (APPEND ${project_build_tools_append_cmake_inherit_options_VARS} PROJECT_BUILD_TOOLS_CMAKE_INHERIT_VARS_CXX)
+        list (APPEND ${project_build_tools_append_cmake_inherit_options_VARS} ${PROJECT_BUILD_TOOLS_CMAKE_INHERIT_VARS_CXX})
     endif ()
     if (NOT project_build_tools_append_cmake_inherit_options_DISABLE_ASM_FLAGS)
-        list (APPEND ${project_build_tools_append_cmake_inherit_options_VARS} PROJECT_BUILD_TOOLS_CMAKE_INHERIT_VARS_ASM)
+        list (APPEND ${project_build_tools_append_cmake_inherit_options_VARS} ${PROJECT_BUILD_TOOLS_CMAKE_INHERIT_VARS_ASM})
     endif ()


fixed typo

fixed typo

--- msvc/Custom-vs.cmake
+++ msvc/Custom-vs.cmake
@@ -89,5 +89,6 @@
 # - C4047 levels of indirection difference (int and void*)
 # - C4090 different const qualifiers
 # - C4477 format string type differences
-set(CMAKE_C_FLAGS "${CMAKE_CX_FLAGS} /wd4244 /wd4267 /wd4005 /wd4996 /wd4047 /wd4090 /wd4477")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4244 /wd4267 /wd4005 /wd4996 /wd4047 /wd4090 /wd4477")
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244 /wd4267 /wd4005 /wd4996 /wd4047 /wd4090 /wd4477")
+


Remove unused cmake files.

Remove unused cmake files.

--- dep/icu.cmake
+++ dep/icu.cmake
@@ -1,46 +0,0 @@
-#/// @file   icu.cmake
-#/// @brief  libtbag-icu library build project.
-#/// @author zer0
-#/// @date   2016-07-05
-#///
-#/// @remarks
-#///  The following are set after configuration is done:
-#///   - ${TBAG_DEP_ICU_NAME}
-#///   - ${TBAG_DEP_ICU_LOG_PREFIX}
-#///   - ${TBAG_DEP_ICU_INCLUDE_DIRS}
-#///   - ${TBAG_DEP_ICU_ARCHIVES}
-#///   - ${TBAG_DEP_ICU_DEPENDENCIES}
-#///   - ${TBAG_DEP_ICU_LIBRARIES}: Archives + Dependencies
-
-if (DEFINED TBAG_DEP_ICU_NAME)
-    return ()
-endif ()
-
-set (TBAG_DEP_ICU_NAME          "libtbag-icu")
-set (TBAG_DEP_ICU_LOG_PREFIX    "${PROJECT_BINARY_DIR}/CMakeFiles/${TBAG_DEP_ICU_NAME}.dir/build.log")
-set (TBAG_DEP_ICU_INCLUDE_DIRS  "${PROJECT_SOURCE_DIR}/dep/icu/common"
-                                "${PROJECT_SOURCE_DIR}/dep/icu/i18n")
-set (TBAG_DEP_ICU_ARCHIVES      "${PROJECT_SOURCE_DIR}/dep/icu/lib/libicudata.a"
-                                "${PROJECT_SOURCE_DIR}/dep/icu/lib/libicui18n.a"
-                                "${PROJECT_SOURCE_DIR}/dep/icu/lib/libicuuc.a")
-set (TBAG_DEP_ICU_DEPENDENCIES  "")
-set (TBAG_DEP_ICU_LIBRARIES     ${TBAG_DEP_ICU_ARCHIVES}
-                                ${TBAG_DEP_ICU_DEPENDENCIES})
-
-## icu4c custom target.
-add_custom_target (${TBAG_DEP_ICU_NAME} ALL DEPENDS ${TBAG_DEP_ICU_ARCHIVES})
-
-add_custom_command (
-        OUTPUT "${PROJECT_SOURCE_DIR}/dep/icu/Makefile"
-        COMMAND ./configure CFLAGS=-fPIC CXXFLAGS=-fPIC
-                --enable-release --enable-static
-                --disable-shared --disable-tests --disable-samples > "${TBAG_DEP_ICU_LOG_PREFIX}.1" 2>&1
-        DEPENDS "${PROJECT_SOURCE_DIR}/dep/icu/configure"
-        WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/dep/icu/")
-
-add_custom_command (
-        OUTPUT ${TBAG_DEP_ICU_ARCHIVES}
-        COMMAND make VERBOSE=1 > "${TBAG_DEP_ICU_LOG_PREFIX}.2" 2>&1
-        DEPENDS "${PROJECT_SOURCE_DIR}/dep/icu/Makefile"
-        WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/dep/icu/")
-


cmake: check for python3 instead of python2

--- cmake/os.cmake
+++ cmake/os.cmake
@@ -1,4 +1,3 @@
-
 if (NOT CMAKE_BUILD_TYPE)
   set(CMAKE_BUILD_TYPE "Release")
 endif()
@@ -6,16 +5,9 @@
 set (CMAKE_CXX_STANDARD 17)
 set (CMAKE_CXX_STANDARD_REQUIRED ON)

-if (${CMAKE_VERSION} VERSION_LESS "3.12")
-  find_program(Python2 python2.7)
-  if (NOT Python2)
-    #brutal fallback
-    set(Python2_EXECUTABLE python)
-  else()
-    set(Python2_EXECUTABLE ${Python2})
-  endif()
-else()
-  find_package(Python2 COMPONENTS Interpreter)
+find_program(PYTHON3_EXECUTABLE python3)
+if (PYTHON3_EXECUTABLE-NOTFOUND)
+  message(FATAL_ERROR "python3 not found")
 endif()

 if (NOT DEFINED PLATFORM)
@@ -297,7 +289,7 @@
     REALPATH BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
   add_custom_command(
     OUTPUT  memdisk.o
-    COMMAND ${Python2_EXECUTABLE} ${CONAN_RES_DIRS_INCLUDEOS}/tools/memdisk/memdisk.py --file memdisk.asm ${DISK_RELPATH}
+    COMMAND ${PYTHON3_EXECUTABLE} ${CONAN_RES_DIRS_INCLUDEOS}/tools/memdisk/memdisk.py --file memdisk.asm ${DISK_RELPATH}
     COMMAND nasm -f ${CMAKE_ASM_NASM_OBJECT_FORMAT} memdisk.asm -o memdisk.o
     DEPENDS ${DISK}
   )
@@ -367,7 +359,7 @@
   set(NACL_PATH ${CONAN_RES_DIRS_INCLUDEOS}/tools/NaCl)
   add_custom_command(
      OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/nacl_content.cpp
-     COMMAND cat ${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME} | ${Python2_EXECUTABLE} ${NACL_PATH}/NaCl.py ${CMAKE_CURRENT_BINARY_DIR}/nacl_content.cpp
+     COMMAND cat ${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME} | ${PYTHON3_EXECUTABLE} ${NACL_PATH}/NaCl.py ${CMAKE_CURRENT_BINARY_DIR}/nacl_content.cpp
      DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}
    )
    add_library(nacl_content STATIC ${CMAKE_CURRENT_BINARY_DIR}/nacl_content.cpp)


Minor clean up to avoid code duplication.

--- CMake/Modules/UrhoCommon.cmake
+++ CMake/Modules/UrhoCommon.cmake
@@ -1781,32 +1781,25 @@
         add_dependencies (${TARGET_NAME} ${RESOURCE_CHECK_${MD5ALL}})
     endif ()
     # Create symbolic links in the build tree
+    if (ANDROID)
+        foreach (I AndroidManifest.xml build.xml custom_rules.xml project.properties src res assets jni)
+            if (EXISTS ${CMAKE_SOURCE_DIR}/Android/${I} AND NOT EXISTS ${CMAKE_BINARY_DIR}/${I})    # No-ops when 'Android' is used as build tree
+                create_symlink (${CMAKE_SOURCE_DIR}/Android/${I} ${CMAKE_BINARY_DIR}/${I} FALLBACK_TO_COPY)
+            endif ()
+        endforeach ()
+        set (ASSET_ROOT assets)
+    else ()
+        set (ASSET_ROOT bin)
+    endif ()
     if (NOT URHO3D_PACKAGING)
-        if (ANDROID)
-            file (MAKE_DIRECTORY ${CMAKE_SOURCE_DIR}/Android/assets)
-            if (NOT URHO3D_PACKAGING)
-                foreach (I ${RESOURCE_DIRS})
-                    get_filename_component (NAME ${I} NAME)
-                    if (NOT EXISTS ${CMAKE_SOURCE_DIR}/Android/assets/${NAME})
-                        create_symlink (${I} ${CMAKE_SOURCE_DIR}/Android/assets/${NAME} FALLBACK_TO_COPY)
-                    endif ()
-                endforeach ()
-            endif ()
-            foreach (I AndroidManifest.xml build.xml custom_rules.xml project.properties src res assets jni)
-                if (EXISTS ${CMAKE_SOURCE_DIR}/Android/${I} AND NOT EXISTS ${CMAKE_BINARY_DIR}/${I})    # No-ops when 'Android' is used as build tree
-                    create_symlink (${CMAKE_SOURCE_DIR}/Android/${I} ${CMAKE_BINARY_DIR}/${I} FALLBACK_TO_COPY)
-                endif ()
-            endforeach ()
-        else ()
-            foreach (I ${RESOURCE_DIRS})
-                get_filename_component (NAME ${I} NAME)
-                if (NOT EXISTS ${CMAKE_BINARY_DIR}/bin/${NAME} AND EXISTS ${I})
-                    # Ensure the output directory exist before creating the symlinks
-                    file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
-                    create_symlink (${I} ${CMAKE_BINARY_DIR}/bin/${NAME} FALLBACK_TO_COPY)
-                endif ()
-            endforeach ()
-        endif ()
+        # Ensure the asset root directory exist before creating the symlinks
+        file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${ASSET_ROOT})
+        foreach (I ${RESOURCE_DIRS})
+            get_filename_component (NAME ${I} NAME)
+            if (NOT EXISTS ${CMAKE_BINARY_DIR}/${ASSET_ROOT}/${NAME} AND EXISTS ${I})
+                create_symlink (${I} ${CMAKE_BINARY_DIR}/${ASSET_ROOT}/${NAME} FALLBACK_TO_COPY)
+            endif ()
+        endforeach ()
     endif ()
     # Workaround CMake/Xcode generator bug where it always appends '/build' path element to SYMROOT attribute and as such the items in Products are always rendered as red in the Xcode as if they are not yet built
     if (NOT DEFINED ENV{TRAVIS})


Fixed COPASI_DEPENDENCY_DIR.

Fixed COPASI_DEPENDENCY_DIR.

--- CMakeModules/FindLIBSBML.cmake
+++ CMakeModules/FindLIBSBML.cmake
@@ -42,8 +42,8 @@
           /opt/lib/cmake
           /opt/local/lib/cmake
           /sw/lib/cmake
-          ${COMBINE_DEPENDENCY_DIR}/lib/cmake
-          ${COMBINE_DEPENDENCY_DIR}/lib64/cmake
+          ${COPASI_DEPENDENCY_DIR}/lib/cmake
+          ${COPASI_DEPENDENCY_DIR}/lib64/cmake
           ${CONAN_LIB_DIRS_LIBSBML}/cmake
   )
 endif()
@@ -99,8 +99,8 @@
 find_path(LIBSBML_INCLUDE_DIR sbml/SBase.h
     PATHS $ENV{LIBSBML_DIR}/include
           $ENV{LIBSBML_DIR}
-          ${COMBINE_DEPENDENCY_DIR}
-          ${COMBINE_DEPENDENCY_DIR}/include
+          ${COPASI_DEPENDENCY_DIR}
+          ${COPASI_DEPENDENCY_DIR}/include
           ~/Library/Frameworks
           /Library/Frameworks
           /sw/include        # Fink
@@ -127,9 +127,8 @@
           libsbml
     PATHS $ENV{LIBSBML_DIR}/lib
           $ENV{LIBSBML_DIR}
-          ${COMBINE_DEPENDENCY_DIR}
-          ${COMBINE_DEPENDENCY_DIR}/lib
-          ${COMBINE_DEPENDENCY_DIR}/lib64
+          ${COPASI_DEPENDENCY_DIR}
+          ${COPASI_DEPENDENCY_DIR}/${CMAKE_INSTALL_LIBDIR}
           ${CONAN_LIB_DIRS_LIBSBML}
           ~/Library/Frameworks
           /Library/Frameworks


FindSQLITE3.cmake: fixed a typo

FindSQLITE3.cmake: fixed a typo

--- CMakeModules/FindSQLITE3.cmake
+++ CMakeModules/FindSQLITE3.cmake
@@ -1,5 +1,5 @@
-# - Find libgmx
-# Find the native libgmx headers and libraries.
+# - Find libsqlite3
+# Find the native libsqlite3 headers and libraries.
 #
 #  SQLITE3_INCLUDE_DIRS - where to find sqlite3.h, etc
 #  SQLITE3_LIBRARIES    - List of libraries when using sqlite3.


Print OK to stdout if check_format_py test passes

--- cmake/CodeFormat.cmake
+++ cmake/CodeFormat.cmake
@@ -76,6 +76,7 @@
     "diff=`cat diff`\n"
     "rm diff\n"
     "if [ -z \"$diff\" ]; then\n"
+    "    echo OK\n"
     "    exit 0\n"
     "else\n"
     "    exit 1\n"


Complete to __aarch64__ achritectur

Complete to __aarch64__ achritectur

Recognition of architecture by compiler (preprocessor) error
Runs as on ODROID C2, Pine A64

Similar change:
https://github.com/anqixu/ueye_cam/blob/master/cmake_modules/TargetArch.cmake

--- cmake/TargetArch.cmake
+++ cmake/TargetArch.cmake
@@ -28,6 +28,8 @@
     #else
         #error cmake_ARCH arm
     #endif
+#elif defined(__aarch64__)
+    #error cmake_ARCH aarch64
 #elif defined(__i386) || defined(__i386__) || defined(_M_IX86)
     #error cmake_ARCH i386
 #elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64)


cmake: remove spurious IS_ABSOLUTE logic in zephyr_sources()

target_sources() documentation states:

  Relative source file paths are interpreted as being relative to the
  current source directory (i.e. CMAKE_CURRENT_SOURCE_DIR).

Remove spurious code duplicating cmake's behaviour. It proved to be a
time-consuming red herring while debugging some path-related issue and
"less is more".

Signed-off-by: Marc Herbert <77e7c7d746b52c6eb01119b65a031ae1f650246d@intel.com>

--- cmake/extensions.cmake
+++ cmake/extensions.cmake
@@ -65,17 +65,10 @@
 # https://cmake.org/cmake/help/latest/command/target_sources.html
 function(zephyr_sources)
   foreach(arg ${ARGV})
-    if(IS_ABSOLUTE ${arg})
-      set(path ${arg})
-    else()
-      set(path ${CMAKE_CURRENT_SOURCE_DIR}/${arg})
-    endif()
-
-    if(IS_DIRECTORY ${path})
+    if(IS_DIRECTORY ${arg})
       message(FATAL_ERROR "zephyr_sources() was called on a directory")
     endif()
-
-    target_sources(zephyr PRIVATE ${path})
+    target_sources(zephyr PRIVATE ${arg})
   endforeach()
 endfunction()


cmake: extensions: Move ifndef functions to correct location

This commit moves the '_ifndef' functions that are implemented in the
"3.1. *_ifdef" section to the "3.2. *_ifndef" section.

Signed-off-by: Stephanos Ioannidis <dc76e9f0c0006e8f919e0c515c66dbba3982f785@stephanos.io>

--- cmake/extensions.cmake
+++ cmake/extensions.cmake
@@ -1393,20 +1393,8 @@
   endif()
 endfunction()

-function(zephyr_library_sources_ifndef feature_toggle source)
-  if(NOT ${feature_toggle})
-    zephyr_library_sources(${source} ${ARGN})
-  endif()
-endfunction()
-
 function(zephyr_sources_ifdef feature_toggle)
   if(${${feature_toggle}})
-    zephyr_sources(${ARGN})
-  endif()
-endfunction()
-
-function(zephyr_sources_ifndef feature_toggle)
-   if(NOT ${feature_toggle})
     zephyr_sources(${ARGN})
   endif()
 endfunction()
@@ -1500,6 +1488,18 @@
 function(target_cc_option_ifndef feature_toggle target scope option)
   if(NOT ${feature_toggle})
     target_cc_option(${target} ${scope} ${option})
+  endif()
+endfunction()
+
+function(zephyr_library_sources_ifndef feature_toggle source)
+  if(NOT ${feature_toggle})
+    zephyr_library_sources(${source} ${ARGN})
+  endif()
+endfunction()
+
+function(zephyr_sources_ifndef feature_toggle)
+   if(NOT ${feature_toggle})
+    zephyr_sources(${ARGN})
   endif()
 endfunction()


adjusting path to zlib

adjusting path to zlib

--- cmake/get-libpng.cmake
+++ cmake/get-libpng.cmake
@@ -20,8 +20,8 @@
       -DPNG_SHARED=on
       -DPNG_STATIC=on
       -DPNG_TESTS=off
-      -DZLIB_LIBRARY:FILEPATH=${DEPENDENCY_INSTALL_DIR}/lib/zlib.lib
-      -DZLIB_INCLUDE_DIR:PATH=${DEPENDENCY_INSTALL_DIR}/include
+      -DZLIB_LIBRARY:FILEPATH=${DEPENDENCY_INSTALL_DIR}/zlib/lib/zlib.lib
+      -DZLIB_INCLUDE_DIR:PATH=${DEPENDENCY_INSTALL_DIR}/zlib/include
 )

 #BUILD_COMMAND   "msbuild ${DEPENDENCY_EXTRACT_DIR}/src/libpng/projects/vstudio/vstudio.sln /t:libpng /p:Configuration=Release /p:Platform=Win32 /v:minimal"


Added support for other GCCs

Added support for other GCCs

--- cmake/nvcc-check.cmake
+++ cmake/nvcc-check.cmake
@@ -46,7 +46,13 @@
   IF((CMAKE_SYSTEM_NAME MATCHES "Linux" AND CMAKE_COMPILER_IS_GNUCC) OR APPLE)
     # Compatible gcc can be checked in host_config.h
     SET(GCC_PATH "")
-    IF(${CUDA_VERSION} VERSION_GREATER "4.1.99")
+    IF(${CUDA_VERSION} VERSION_GREATER "5.4.99")
+      FIND_GCC(GCC_PATH "4" "8")
+    ENDIF()
+    IF(NOT GCC_PATH AND ${CUDA_VERSION} VERSION_GREATER "5.4.99")
+      FIND_GCC(GCC_PATH "4" "7")
+    ENDIF()
+    IF(NOT GCC_PATH AND ${CUDA_VERSION} VERSION_GREATER "4.1.99")
       FIND_GCC(GCC_PATH "4" "6")
     ENDIF()
     IF(NOT GCC_PATH AND ${CUDA_VERSION} VERSION_GREATER "4.0.99")


set ssl.cmake to use CMakeLists.txt from boringssl-with-bazel

--- cmake/ssl.cmake
+++ cmake/ssl.cmake
@@ -18,7 +18,7 @@

 if(gRPC_SSL_PROVIDER STREQUAL "module")
   if(NOT BORINGSSL_ROOT_DIR)
-    set(BORINGSSL_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/boringssl)
+    set(BORINGSSL_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/boringssl-with-bazel)
   endif()

   if(EXISTS "${BORINGSSL_ROOT_DIR}/CMakeLists.txt")
@@ -40,10 +40,10 @@
       endif()
     endif()

-    add_subdirectory(${BORINGSSL_ROOT_DIR} third_party/boringssl)
+    add_subdirectory(${BORINGSSL_ROOT_DIR} third_party/boringssl-with-bazel)
     if(TARGET ssl)
-      set(_gRPC_SSL_LIBRARIES ssl)
-      set(_gRPC_SSL_INCLUDE_DIR ${BORINGSSL_ROOT_DIR}/include)
+      set(_gRPC_SSL_LIBRARIES ssl crypto)
+      set(_gRPC_SSL_INCLUDE_DIR ${BORINGSSL_ROOT_DIR}/src/include)
       if(gRPC_INSTALL AND _gRPC_INSTALL_SUPPORTED_FROM_MODULE)
         install(TARGETS ssl crypto EXPORT gRPCTargets
           RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR}


Deb package build fix for CUDA 6.5 and newer.

--- cmake/OpenCVPackaging.cmake
+++ cmake/OpenCVPackaging.cmake
@@ -68,9 +68,23 @@

 if(HAVE_CUDA)
   string(REPLACE "." "-" cuda_version_suffix ${CUDA_VERSION})
-  set(CPACK_DEB_libs_PACKAGE_DEPENDS "cuda-core-libs-${cuda_version_suffix}, cuda-extra-libs-${cuda_version_suffix}")
+  if(${CUDA_VERSION} VERSION_LESS "6.5")
+    set(CPACK_DEB_libs_PACKAGE_DEPENDS "cuda-core-libs-${cuda_version_suffix}, cuda-extra-libs-${cuda_version_suffix}")
+    set(CPACK_DEB_dev_PACKAGE_DEPENDS "cuda-headers-${cuda_version_suffix}")
+  else()
+    set(CPACK_DEB_libs_PACKAGE_DEPENDS "cuda-cudart-${cuda_version_suffix}, cuda-npp-${cuda_version_suffix}")
+    set(CPACK_DEB_dev_PACKAGE_DEPENDS "cuda-cudart-dev-${cuda_version_suffix}, cuda-npp-dev-${cuda_version_suffix}")
+    if(HAVE_CUFFT)
+      set(CPACK_DEB_libs_PACKAGE_DEPENDS "${CPACK_DEB_libs_PACKAGE_DEPENDS}, cuda-cufft-${cuda_version_suffix}")
+      set(CPACK_DEB_dev_PACKAGE_DEPENDS "${CPACK_DEB_dev_PACKAGE_DEPENDS}, cuda-cufft-dev-${cuda_version_suffix}")
+    endif()
+    if(HAVE_HAVE_CUBLAS)
+      set(CPACK_DEB_libs_PACKAGE_DEPENDS "${CPACK_DEB_libs_PACKAGE_DEPENDS}, cuda-cublas-${cuda_version_suffix}")
+      set(CPACK_DEB_dev_PACKAGE_DEPENDS "${CPACK_DEB_dev_PACKAGE_DEPENDS}, cuda-cublas-dev-${cuda_version_suffix}")
+    endif()
+  endif()
   set(CPACK_COMPONENT_dev_DEPENDS libs)
-  set(CPACK_DEB_dev_PACKAGE_DEPENDS "cuda-headers-${cuda_version_suffix}")
+
 endif()

 if(NOT OPENCV_CUSTOM_PACKAGE_INFO)


build: fix git describe call on older Git versions

Older Git versions do not support the -C argument for specifying the
working directory. Switch to using --work-tree instead.

This fixes #7287.

Signed-off-by: Henrik Brix Andersen <a076b11c2cc63ccdc903dbe182e1eecc3cbbc094@brixandersen.dk>

--- cmake/app/boilerplate.cmake
+++ cmake/app/boilerplate.cmake
@@ -243,7 +243,7 @@

 find_package(Git QUIET)
 if(GIT_FOUND)
-  execute_process(COMMAND ${GIT_EXECUTABLE} -C ${ZEPHYR_BASE} describe
+  execute_process(COMMAND ${GIT_EXECUTABLE} --work-tree=${ZEPHYR_BASE} describe
     WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
     OUTPUT_VARIABLE BUILD_VERSION
     OUTPUT_STRIP_TRAILING_WHITESPACE)


cmake fix .git path

cmake fix .git path

--- cmake/common/px4_base.cmake
+++ cmake/common/px4_base.cmake
@@ -698,6 +698,7 @@
 		COMMAND git log -n 1 --pretty=format:"%H"
 		OUTPUT_VARIABLE git_desc
 		OUTPUT_STRIP_TRAILING_WHITESPACE
+		WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
 		)
 	message(STATUS "GIT_DESC = ${git_desc}")
 	set(git_desc_short)


cmake fix windows upload

cmake fix windows upload

--- cmake/common/px4_base.cmake
+++ cmake/common/px4_base.cmake
@@ -421,7 +421,8 @@
 			)
 	elseif(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
 		foreach(port RANGE 32 0)
-			list(APPEND "COM${port}")
+			list(APPEND serial_ports
+				"COM${port}")
 		endforeach()
 	endif()
 	px4_join(OUT serial_ports LIST "${serial_ports}" GLUE ",")


Solve conflict.

Solve conflict.

--- cmake/externals/DCMTK.cmake
+++ cmake/externals/DCMTK.cmake
@@ -26,18 +26,17 @@
         endif()
     endif()

+    set(shared_libs_option "-DBUILD_SHARED_LIBS:BOOL=ON")
     if (WIN32)
         set(shared_libs_option "-DBUILD_SHARED_LIBS:BOOL=OFF")
-    else()
-        set(shared_libs_option "-DBUILD_SHARED_LIBS:BOOL=ON")
     endif()

+    SetExternalProjectsDirs(dcmtk ep_build_dirs)
     ExternalProject_Add(DCMTK
-        PREFIX dcmtk
+        ${ep_build_dirs}
         ${location}
         CMAKE_GENERATOR ${gen}
         UPDATE_COMMAND ""
-        INSTALL_DIR dcmtk/install
         CMAKE_ARGS
             -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
         CMAKE_CACHE_ARGS


[CMake] Do not use --gc-sections on OpenBSD

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

--- cmake/modules/AddLLVM.cmake
+++ cmake/modules/AddLLVM.cmake
@@ -221,7 +221,7 @@
       elseif(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
         set_property(TARGET ${target_name} APPEND_STRING PROPERTY
                      LINK_FLAGS " -Wl,-z -Wl,discard-unused=sections")
-      elseif(NOT WIN32 AND NOT LLVM_LINKER_IS_GOLD)
+      elseif(NOT WIN32 AND NOT LLVM_LINKER_IS_GOLD AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
         # Object files are compiled with -ffunction-data-sections.
         # Versions of bfd ld < 2.23.1 have a bug in --gc-sections that breaks
         # tools that use plugins. Always pass --gc-sections once we require


libname is libidn-11 on windows

libname is libidn-11 on windows

svn path=/trunk/KDE/kdenetwork/cmake/modules/FindIDN.cmake; revision=888979

--- cmake/modules/FindIDN.cmake
+++ cmake/modules/FindIDN.cmake
@@ -23,7 +23,7 @@

     if(NOT IDN_FOUND)
         find_path(IDN_INCLUDEDIR idna.h)
-        find_library(IDN_LIBRARIES NAMES idn)
+        find_library(IDN_LIBRARIES NAMES idn libidn idn-11 libidn-11)
         if (IDN_INCLUDEDIR AND IDN_LIBRARIES)
             SET(IDN_FOUND TRUE)
         endif (IDN_INCLUDEDIR AND IDN_LIBRARIES)


[CMake] Add header files to Xcode project.

--- cmake/modules/Utility.cmake
+++ cmake/modules/Utility.cmake
@@ -47,7 +47,29 @@
 endmacro()

 macro(add_llbuild_library name)
-  add_library(${name} ${ARGN})
+  set(ALL_FILES ${ARGN})
+
+  # Add headers to generated project files.
+  if(MSVC_IDE OR XCODE)
+    # Add public headers.
+
+    # Find the library name by finding its relative path.
+    file(RELATIVE_PATH lib_path
+      ${LLBUILD_SRC_DIR}/lib/
+      ${CMAKE_CURRENT_SOURCE_DIR}
+    )
+
+    if(NOT lib_path MATCHES "^[.][.]")
+      file( GLOB_RECURSE headers
+        ${LLBUILD_SRC_DIR}/include/llbuild/${lib_path}/*.h
+      )
+      set_source_files_properties(${headers} PROPERTIES HEADER_FILE_ONLY ON)
+
+      list(APPEND ALL_FILES ${headers})
+    endif()
+  endif(MSVC_IDE OR XCODE)
+
+  add_library(${name} ${ALL_FILES})

   set_output_directory(${name} ${LLBUILD_EXECUTABLE_OUTPUT_INTDIR} ${LLBUILD_LIBRARY_OUTPUT_INTDIR})
 endmacro()


Another potential fix for github actions not finding MYSQL_LIBRARY_PATH

--- cmake/modules/mysqldb.cmake
+++ cmake/modules/mysqldb.cmake
@@ -8,17 +8,16 @@
       "$ENV{PROGRAMFILES}/MySQL/*/include"
       "$ENV{SYSTEMDRIVE}/MySQL/*/include"
       "C:/Program Files/MySQL/*/include"
-      "$ENV{SYSTEMDRIVE}/mysql*/include"
       )

   find_path(MYSQL_LIBRARY_PATH
       NAMES "libmysql.lib" "mysqlclient_r.lib" "libmariadb.lib" "mariadbclient.lib"
       PATHS "${CMAKE_THIRD_PARTY_LIBRARY_DIR}"
+      "${MYSQL_INCLUDE_DIR}/../lib"
       "$ENV{SYSTEMDRIVE}/MySQL/MySQL Connector.C */lib"
       "$ENV{PROGRAMFILES}/MySQL/*/lib"
       "$ENV{SYSTEMDRIVE}/MySQL/*/lib"
       "C:/Program Files/MySQL/*/lib"
-      "$ENV{SYSTEMDRIVE}/mysql*/lib"
       )

   find_library(MYSQL_LIBRARY


utilities.cmake update default build flags (#229)

utilities.cmake stop enforcing compiler flags and optimization levels

--- cmake/stm32/utilities.cmake
+++ cmake/stm32/utilities.cmake
@@ -13,17 +13,19 @@

     if(NOT (TARGET STM32::${FAMILY}${CORE_C}))
         add_library(STM32::${FAMILY}${CORE_C} INTERFACE IMPORTED)
+        # Set compiler flags for target
+        # -Wall: all warnings activated
+        # -ffunction-sections -fdata-sections: remove unused code
         target_compile_options(STM32::${FAMILY}${CORE_C} INTERFACE
             --sysroot="${TOOLCHAIN_SYSROOT}"
-            -mthumb -mabi=aapcs -Wall -ffunction-sections -fdata-sections -fno-strict-aliasing -fno-builtin -ffast-math
-            $<$<CONFIG:Debug>:-Og>
-            $<$<CONFIG:Release>:-Os>
+            -mthumb -Wall -ffunction-sections -fdata-sections
         )
+        # Set linker flags
+        # -mthumb: Generate thumb code
+        # -Wl,--gc-sections: Remove unused code
         target_link_options(STM32::${FAMILY}${CORE_C} INTERFACE
             --sysroot="${TOOLCHAIN_SYSROOT}"
-            -mthumb -mabi=aapcs -Wl,--gc-sections
-            $<$<CONFIG:Debug>:-Og>
-            $<$<CONFIG:Release>:-Os -s>
+            -mthumb -Wl,--gc-sections
         )
         target_compile_definitions(STM32::${FAMILY}${CORE_C} INTERFACE
             STM32${FAMILY}
@@ -151,4 +153,3 @@
         set(STM32_HAL_${FAMILY}_PATH ${${HAL_NAME_L}_SOURCE_DIR} PARENT_SCOPE)
     endforeach()
 endfunction()
-


Restore cmake incantation to fix NaCl build

--- cmake/toolchain-pnacl.cmake
+++ cmake/toolchain-pnacl.cmake
@@ -37,7 +37,7 @@

 set(CMAKE_C_COMPILER      "${PLATFORM_PREFIX}/${PLATFORM_TRIPLET}-clang${PNACL_BIN_EXT}")
 set(CMAKE_CXX_COMPILER    "${PLATFORM_PREFIX}/${PLATFORM_TRIPLET}-clang++${PNACL_BIN_EXT}")
-set(CMAKE_AR              "${PLATFORM_PREFIX}/${PLATFORM_TRIPLET}-ar${PNACL_BIN_EXT}")
+set(CMAKE_AR              "${PLATFORM_PREFIX}/${PLATFORM_TRIPLET}-ar${PNACL_BIN_EXT}" CACHE FILEPATH "Archiver" FORCE)
 set(CMAKE_RANLIB          "${PLATFORM_PREFIX}/${PLATFORM_TRIPLET}-ranlib${PNACL_BIN_EXT}")
 set(CMAKE_FIND_ROOT_PATH  "${PLATFORM_PREFIX}/../le32-nacl")


Fix Winml test build error

Fix Winml test build error

--- cmake/winml_unittests.cmake
+++ cmake/winml_unittests.cmake
@@ -47,7 +47,7 @@
   if (_UT_DEPENDS)
     add_dependencies(${_UT_TARGET} ${_UT_DEPENDS})
   endif()
-  target_link_libraries(${_UT_TARGET} PRIVATE ${_UT_LIBS} gtest winml_google_test_lib ${onnxruntime_EXTERNAL_LIBRARIES} winml_lib_common onnxruntime)
+  target_link_libraries(${_UT_TARGET} PRIVATE ${_UT_LIBS} gtest winml_google_test_lib ${onnxruntime_EXTERNAL_LIBRARIES} winml_lib_common onnxruntime windowsapp.lib)

   add_test(NAME ${_UT_TARGET}
     COMMAND ${_UT_TARGET}


CMake: prefer to search for config.cmake before looking for modules

--- cmake/cpp.cmake
+++ cmake/cpp.cmake
@@ -6,6 +6,11 @@
 set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
 set(THREAD_PREFER_PTHREAD_FLAG TRUE)
 find_package(Threads REQUIRED)
+
+# Tell find_package() to try “Config” mode before “Module” mode if no mode was specified.
+# This should avoid find_package() to first find our FindXXX.cmake modules if
+# distro package already provide a CMake config file...
+set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE)

 # libprotobuf force us to depends on ZLIB::ZLIB target
 if(BUILD_ZLIB)


fix easylogging build

fix easylogging build

--- cmake/nya.cmake
+++ cmake/nya.cmake
@@ -11,7 +11,7 @@
 add_definitions(-DWIN32_LEAN_AND_MEAN)                  # for boost::asio - reduces windows.h

 # easylogging
-set(build_static_lib ON cache)
+set(build_static_lib ON CACHE BOOL "Build easyloggingpp as a static library" FORCE)
 add_definitions(-DELPP_NO_DEFAULT_LOG_FILE)             # custom log file
 add_definitions(-DELPP_WINSOCK2)                        # for boost::asio
 add_definitions(-DELPP_STL_LOGGING)                     # stl


Crash during configure without development SSL libraries installed

Incorrect usage of OPENSSL_INCLUDE_DIR variable within cmake caused the
configure step to fail. The variable was used before being checked if
the include directory actually existed.

--- cmake/ssl.cmake
+++ cmake/ssl.cmake
@@ -156,37 +156,37 @@
       LIST(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES)
     ENDIF()

-    # Verify version number. Version information looks like:
-    #   #define OPENSSL_VERSION_NUMBER 0x1000103fL
-    # Encoded as MNNFFPPS: major minor fix patch status
-    FILE(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h"
-      OPENSSL_VERSION_NUMBER
-      REGEX "^#define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x[0-9].*"
-    )
-    STRING(REGEX REPLACE
-      "^.*OPENSSL_VERSION_NUMBER[\t ]+0x([0-9]).*$" "\\1"
-      OPENSSL_MAJOR_VERSION "${OPENSSL_VERSION_NUMBER}"
-    )
-
     IF(OPENSSL_INCLUDE_DIR AND
        OPENSSL_LIBRARIES   AND
        CRYPTO_LIBRARY
       )
+      # Verify version number. Version information looks like:
+      #   #define OPENSSL_VERSION_NUMBER 0x1000103fL
+      # Encoded as MNNFFPPS: major minor fix patch status
+      FILE(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h"
+        OPENSSL_VERSION_NUMBER
+        REGEX "^#define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x[0-9].*"
+      )
+      STRING(REGEX REPLACE
+        "^.*OPENSSL_VERSION_NUMBER[\t ]+0x([0-9]).*$" "\\1"
+        OPENSSL_MAJOR_VERSION "${OPENSSL_VERSION_NUMBER}"
+      )
+      INCLUDE(CheckSymbolExists)
+      SET(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
+      CHECK_SYMBOL_EXISTS(SHA512_DIGEST_LENGTH "openssl/sha.h"
+                          HAVE_SHA512_DIGEST_LENGTH)
       SET(OPENSSL_FOUND TRUE)
     ELSE()
       SET(OPENSSL_FOUND FALSE)
     ENDIF()

-    MESSAGE(STATUS "OPENSSL_INCLUDE_DIR = ${OPENSSL_INCLUDE_DIR}")
-    MESSAGE(STATUS "OPENSSL_LIBRARIES = ${OPENSSL_LIBRARIES}")
-    MESSAGE(STATUS "CRYPTO_LIBRARY = ${CRYPTO_LIBRARY}")
-    MESSAGE(STATUS "OPENSSL_MAJOR_VERSION = ${OPENSSL_MAJOR_VERSION}")
-
-    INCLUDE(CheckSymbolExists)
-    SET(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
-    CHECK_SYMBOL_EXISTS(SHA512_DIGEST_LENGTH "openssl/sha.h"
-                        HAVE_SHA512_DIGEST_LENGTH)
     IF(OPENSSL_FOUND AND HAVE_SHA512_DIGEST_LENGTH)
+      MESSAGE(STATUS "OPENSSL_INCLUDE_DIR = ${OPENSSL_INCLUDE_DIR}")
+      MESSAGE(STATUS "OPENSSL_LIBRARIES = ${OPENSSL_LIBRARIES}")
+      MESSAGE(STATUS "CRYPTO_LIBRARY = ${CRYPTO_LIBRARY}")
+      MESSAGE(STATUS "OPENSSL_MAJOR_VERSION = ${OPENSSL_MAJOR_VERSION}")
+
+
       SET(SSL_SOURCES "")
       SET(SSL_LIBRARIES ${OPENSSL_LIBRARIES} ${CRYPTO_LIBRARY})
       IF(CMAKE_SYSTEM_NAME MATCHES "SunOS")


add check for unrecognized arguments (#10)

--- cmake/ucm.cmake
+++ cmake/ucm.cmake
@@ -32,7 +32,7 @@
 # Adds compiler flags to CMAKE_<LANG>_FLAGS or to a specific config
 macro(ucm_add_flags)
     cmake_parse_arguments(ARG "C;CXX;CLEAR_OLD" "CONFIG" "" ${ARGN})
-
+
     # determine to which flags to add
     set(CXX_FLAGS CMAKE_CXX_FLAGS)
     set(C_FLAGS CMAKE_C_FLAGS)
@@ -73,7 +73,7 @@
 # Adds linker flags to CMAKE_<TYPE>_LINKER_FLAGS or to a specific config
 macro(ucm_add_linker_flags)
     cmake_parse_arguments(ARG "CLEAR_OLD;EXE;MODULE;SHARED;STATIC" "CONFIG" "" ${ARGN})
-
+
     string(TOUPPER "${ARG_CONFIG}" ARG_CONFIG)

     if(NOT ${ARG_EXE} AND NOT ${ARG_MODULE} AND NOT ${ARG_SHARED} AND NOT ${ARG_STATIC})
@@ -179,6 +179,10 @@
 # Sets the runtime (static/dynamic) for msvc/gcc
 macro(ucm_set_runtime)
     cmake_parse_arguments(ARG "STATIC;DYNAMIC" "" "" ${ARGN})
+
+    if(ARG_UNPARSED_ARGUMENTS)
+        message(FATAL_ERROR "unrecognized arguments: ${ARG_UNPARSED_ARGUMENTS}")
+    endif()

     if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" STREQUAL "")
         message(AUTHOR_WARNING "ucm_set_runtime() does not support clang yet!")


Update CodeCoverage.cmake

Update CodeCoverage.cmake

--- cmake/CodeCoverage.cmake
+++ cmake/CodeCoverage.cmake
@@ -55,7 +55,7 @@

         # Capture coverage data.
         COMMAND ${LCOV_PATH} --gcov-tool ${GCOV_PATH} --compat-libtool --directory . --capture --output-file ${_outputname}.info
-        COMMAND ${LCOV_PATH} --gcov-tool ${GCOV_PATH} --remove ${_outputname}.info 'tests/*' '/usr/*' 'tools/*' '3rdParty/*' 'protobuf/*' '*.pb.*' 'rapidjson/*' 'pbjson.*' 'bin2ascii.h' --output-file ${_outputname}.info.cleaned
+        COMMAND ${LCOV_PATH} --gcov-tool ${GCOV_PATH} --remove ${_outputname}.info 'tests/*' '/usr/*' 'tools/*' '3rdparty/*' 'protobuf/*' '*.pb.*' 'rapidjson/*' 'pbjson.*' 'bin2ascii.h' --output-file ${_outputname}.info.cleaned

         # Generating the report.
         COMMAND ${GENHTML_PATH} -o ${_outputname} ${_outputname}.info.cleaned


Added the /bigobj flag in order to enable compilation with MSVC when EIGEN_SPLIT_LARGE_TESTS is not set.

--- cmake/EigenTesting.cmake
+++ cmake/EigenTesting.cmake
@@ -27,6 +27,10 @@
   endif(EIGEN_NO_ASSERTION_CHECKING)

   ei_add_target_property(${targetname} COMPILE_FLAGS "-DEIGEN_TEST_FUNC=${testname}")
+
+  if(MSVC AND NOT EIGEN_SPLIT_LARGE_TESTS)
+    ei_add_target_property(${targetname} COMPILE_FLAGS "/bigobj")
+  endif()

   # let the user pass flags.
   if(${ARGC} GREATER 2)
@@ -51,7 +55,7 @@
       # notice: no double quotes around ${libs_to_link} here. It may be a list.
       target_link_libraries(${targetname} ${libs_to_link})
     endif()
-  endif()
+  endif()

   if(WIN32)
     if(CYGWIN)


cmake: compatibility for 0.8.18 intercept

--- cmake/ElektraCache.cmake
+++ cmake/ElektraCache.cmake
@@ -82,6 +82,15 @@
 		)
 	set (BINDINGS_FORCE FORCE)
 endif ()
+
+#compatibility for 0.8.18
+list (FIND BINDINGS "intercept" FINDEX)
+if (FINDEX GREATER -1 OR BINDINGS MATCHES "ALL")
+	set(BINDINGS_LIST_INTERCEPT
+		intercept_fs
+		intercept_env
+		)
+endif()

 list (FIND BINDINGS "INTERCEPT" FINDEX)
 if (FINDEX GREATER -1 OR BINDINGS MATCHES "ALL")


Check architecture for STEAMVR_DRIVER_DIR.

--- cmake/SteamVRPaths.cmake
+++ cmake/SteamVRPaths.cmake
@@ -22,9 +22,17 @@
 if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
 	set(STEAMVR_PLATFORM "osx32")
 elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
-	set(STEAMVR_PLATFORM "win32")
+	if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
+		set(STEAMVR_PLATFORM "win64")
+	else()
+		set(STEAMVR_PLATFORM "win32")
+	endif()
 elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
-	set(STEAMVR_PLATFORM "linux32")
+	if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
+		set(STEAMVR_PLATFORM "linux64")
+	else()
+		set(STEAMVR_PLATFORM "linux32")
+	endif()
 else()
 	message(WARNING "Unknown system type (not Windows, Linux, or OS X). Please file an issue at <https://github.com/OSVR/SteamVR-OSVR/issues> and report the operating system you're using.")
 endif()


Boost fixup

Boost fixup

--- cmake/V4RFindBoost.cmake
+++ cmake/V4RFindBoost.cmake
@@ -1,6 +1,8 @@
 if(WITH_BOOST)
   find_package(Boost "${MIN_VER_BOOST}" COMPONENTS system filesystem regex)
   if(Boost_FOUND)
+    set(BOOST_LIBRARIES "${Boost_LIBRARIES}")
+    set(BOOST_INCLUDE_DIRS "${Boost_INCLUDE_DIRS}")
     set(HAVE_BOOST TRUE)
   endif()
 endif()


Cosmetic changes.

Cosmetic changes.

--- cmake/dtkReporting.cmake
+++ cmake/dtkReporting.cmake
@@ -4,9 +4,9 @@
 ## Copyright (C) 2008-2011 - Julien Wintz, Inria.
 ## Created: Mon Jun  6 14:49:42 2011 (+0200)
 ## Version: $Id$
-## Last-Updated: Mon Jun  6 14:52:41 2011 (+0200)
+## Last-Updated: Mon Jun 20 10:37:10 2011 (+0200)
 ##           By: Julien Wintz
-##     Update #: 7
+##     Update #: 8
 ######################################################################
 ##
 ### Commentary:
@@ -16,8 +16,9 @@
 ### Change log:
 ##
 ######################################################################
+
 if (EXISTS ${CMAKE_SOURCE_DIR}/cmake/${PROJECT_NAME}Dart.cmake.in)
-#only create test variables if the project contains a proj_nameDart.cmake.in template file.
+
   set(DTK_CTEST_PROJECT_NAME ${PROJECT_NAME} CACHE STRING "Reporting project name.")
   set(DTK_CTEST_UPDATE_TYPE "git" CACHE STRING "Reporting update type.")
   set(DTK_CTEST_UPDATE_COMMAND "git" CACHE STRING "Reporting update command.")


remove debug message

remove debug message

--- cmake/packages/rpm.cmake
+++ cmake/packages/rpm.cmake
@@ -2,7 +2,6 @@

 set(CPACK_GENERATOR "RPM")
 if (CMAKE_DEBUG_FILENAMES_SHA_SUM)
-  message("IFFF!")
   set(CPACK_DEBUG_DIRECTORY_PATTERN "/usr/lib*/debug/.build-id/*")
 else()
   set(CPACK_DEBUG_DIRECTORY_PATTERN "/usr/lib*/debug/*")


Server texts location is file now

Server texts location is file now

--- cmake/scripts/l10n.cmake
+++ cmake/scripts/l10n.cmake
@@ -220,6 +220,7 @@
         message(STATUS "Interpreter mode - extract strings, generate po files")
         set(XGETTEXT_OPTIONS ${OPTIONS})

+        list(APPEND     XGETTEXT_OPTIONS --add-location=file)
         if (PACKAGE)
             list(APPEND XGETTEXT_OPTIONS --package-name=${PACKAGE})
         endif()


BUG: add libOpenGL to the list of possible system dependencies in packaging

--- Packaging/PackageGlobals.cmake
+++ Packaging/PackageGlobals.cmake
@@ -107,6 +107,7 @@
   libdrm.so.2
   libGL.so*
   libGLX.so*
+  libOpenGL.so*
   libGLU.so*
   libXrender.so*
   libSM.so*


Fix warning in FIND_PACKAGE_HANDLE_STANDARD_ARGS call

--- cmake/FindSDL2.cmake
+++ cmake/FindSDL2.cmake
@@ -195,6 +195,6 @@

 include(FindPackageHandleStandardArgs)

-FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2
                                   REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR
                                   VERSION_VAR SDL2_VERSION_STRING)


skip broken LLVM assembler

skip broken LLVM assembler

--- cmake/VcMacros.cmake
+++ cmake/VcMacros.cmake
@@ -337,6 +337,9 @@
       # for now I don't know of any arguments I want to pass. -march and stuff is tried by OptimizeForArchitecture...
       if(Vc_CLANG_VERSION VERSION_EQUAL "3.0")
          UserWarning("Clang 3.0 has serious issues to compile Vc code and will most likely crash when trying to do so.\nPlease update to a recent clang version.")
+      elseif(Vc_CLANG_VERSION VERSION_LESS "3.3")
+         # the LLVM assembler gets FMAs wrong (bug 15040)
+         vc_add_compiler_flag(Vc_DEFINITIONS "-no-integrated-as")
       endif()

       # disable these warnings because clang shows them for function overloads that were discarded via SFINAE


Fixed link flags.

Fixed link flags.

--- cmake/easytest.cmake
+++ cmake/easytest.cmake
@@ -176,6 +176,7 @@
 	# COMPILE_INCLUDES may be a space delimited string.
 	string(REPLACE " " ";" EASYTEST_COMPILE_INCLUDES
 	               "${EASYTEST_COMPILE_INCLUDES}")
+	string(REPLACE " " ";" EASYTEST_LINK "${EASYTEST_LINK}")
 endmacro ()


OPEN-182: correct tip rev number use in local build version generation

--- indra/cmake/BuildVersion.cmake
+++ indra/cmake/BuildVersion.cmake
@@ -18,7 +18,7 @@
            find_program(MERCURIAL hg)
            if (DEFINED MERCURIAL)
               execute_process(
-                 COMMAND ${MERCURIAL} log -r tip --template "{p1rev}"
+                 COMMAND ${MERCURIAL} log -r tip --template "{rev}"
                  OUTPUT_VARIABLE VIEWER_VERSION_REVISION
                  OUTPUT_STRIP_TRAILING_WHITESPACE
                  )


Let STIR depend on nlohmann_json by default and fix

STIR v4.* has extra functionality for CTAC->mu if this library is available.
We enable this now by default.

Also fix use of a related CMake variable (we were using `STIR_USE_JSON` while
the option is `STIR_DISABLE_JSON`)

--- SuperBuild/External_STIR.cmake
+++ SuperBuild/External_STIR.cmake
@@ -71,8 +71,8 @@
   if (USE_NiftyPET)
     list(APPEND ${proj}_DEPENDENCIES "NiftyPET")
   endif()
-  option(STIR_DISABLE_JSON "Disable JSON support in ${proj}" ON)
-  if (STIR_USE_JSON)
+  option(STIR_DISABLE_JSON "Disable JSON support in ${proj}" OFF)
+  if (NOT STIR_DISABLE_JSON)
     list(APPEND ${proj}_DEPENDENCIES "JSON")
   endif()


finding the amd sdk on linux

finding the amd sdk on linux

--- cmake/FindOpenCLCustom.cmake
+++ cmake/FindOpenCLCustom.cmake
@@ -76,6 +76,7 @@
   CMAKE_POP_CHECK_STATE()
 endfunction()

+
 find_path(OpenCL_INCLUDE_DIR
   NAMES
     CL/cl.h OpenCL/cl.h
@@ -93,6 +94,19 @@
     OpenCL/common/inc
     "AMD APP/include"
 	)
+
+find_path(AMD_OpenCL_INCLUDE_DIR
+  NAMES
+    CL/cl.h OpenCL/cl.h
+  PATHS
+    ENV AMDAPPSDKROOT
+    ENV INTELOCLSDKROOT
+    ENV ATISTREAMSDKROOT
+  PATH_SUFFIXES
+    include
+  NO_DEFAULT_PATH
+ )
+MESSAGE("amd cl include dir: ${AMD_OpenCL_INCLUDE_DIR}")

 _FIND_OPENCL_VERSION()

@@ -135,10 +149,27 @@
 		PATHS
 			ENV LD_LIBRARY_PATH
 			ENV OpenCL_LIBPATH
+                        ENV AMDAPPSDKROOT
+			ENV AMDAPPSDKROOT/lib/x86_64
 			/usr
 		PATH_SUFFIXES
 			nvidia
+                        lib
+                        lib/x86_64
 	)
+ find_library(AMD_OpenCL_LIBRARY
+                NAMES
+                        OpenCL
+                PATHS
+                        ENV AMDAPPSDKROOT
+                PATH_SUFFIXES
+                        lib
+                        lib/x86_64
+                NO_DEFAULT_PATH
+        )
+MESSAGE("amd cl link dir: ${AMD_OpenCL_LIBRARY}")
+
+
 endif()

 set(OpenCL_LIBRARIES ${OpenCL_LIBRARY})


ENH: avoid to use fixed paths in find library

--- CMake/FindQwt.cmake
+++ CMake/FindQwt.cmake
@@ -99,10 +99,6 @@

 find_library ( QWT_LIBRARY
   NAMES qwt-qt5 qwt6-qt5 qwt qwt6
-  PATHS
-    /usr/lib
-    /usr/local/lib
-    /usr/local/lib/qt5
 )

 set ( QWT_LIBRARIES ${QWT_LIBRARY} )


Add attribution and license back to CMakeWin32

They were stripped during the addition of Unix support.

--- CMakeWin32.cmake
+++ CMakeWin32.cmake
@@ -1,3 +1,20 @@
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# This file is a modified version of the CMakeLists.txt provided by
+# Apache httpd.
+#
+
 #
 # Library Configuration
 #


Find the right gfortran libs

Find the right gfortran libs

--- cmake/CMakemacosx64.cmake
+++ cmake/CMakemacosx64.cmake
@@ -104,11 +104,11 @@
   set(DYLIB ${SYSLIBS})

 else()
-
-  execute_process(COMMAND ${CMAKE_Fortran_COMPILER} -print-file-name=libgfortran.dylib
+
+  execute_process(COMMAND ${CMAKE_Fortran_COMPILER} -m64 -print-file-name=libgfortran.dylib
                   OUTPUT_VARIABLE _shlib
                   OUTPUT_STRIP_TRAILING_WHITESPACE)
-  execute_process(COMMAND ${CMAKE_Fortran_COMPILER} -print-file-name=libgfortranbegin.a
+  execute_process(COMMAND ${CMAKE_Fortran_COMPILER} -m64 -print-file-name=libgfortranbegin.a
                   OUTPUT_VARIABLE _alib
                   OUTPUT_STRIP_TRAILING_WHITESPACE)
   set( SYSLIBS "${SYSLIBS} -ldl ${_shlib} ${_alib}")


hack for newer versions of cmake

hack for newer versions of cmake

--- cmake/Depdendencies.cmake
+++ cmake/Depdendencies.cmake
@@ -32,9 +32,17 @@
                 PROPERTY Qt5Core_VERSION_MINOR "14")
         add_executable(Qt5::moc IMPORTED)
         add_dependencies(Qt5::moc qt5)
-        set_target_properties(Qt5::moc PROPERTIES IMPORTED_LOCATION "${PROJECT_BINARY_DIR}/bin/moc${CMAKE_EXECUTABLE_SUFFIX}")
+        set(MOC_FILENAME "${PROJECT_BINARY_DIR}/bin/moc${CMAKE_EXECUTABLE_SUFFIX}" )
+        set_target_properties(Qt5::moc PROPERTIES IMPORTED_LOCATION ${MOC_FILENAME})
+        # Create fake moc file to avoid errors on newer cmake
+        if(NOT EXISTS ${MOC_FILENAME})
+            file(WRITE "${PROJECT_BINARY_DIR}/moc${CMAKE_EXECUTABLE_SUFFIX}" "")
+            file(COPY "${PROJECT_BINARY_DIR}/moc${CMAKE_EXECUTABLE_SUFFIX}"
+                DESTINATION "${PROJECT_BINARY_DIR}/bin/"
+                FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_WRITE WORLD_EXECUTE)
+        endif()
         #set(Qt5Core_DIR ${PROJECT_BINARY_DIR}/lib/cmake/Qt5Core/)
-        find_package(Qt5 REQUIRED COMPONENTS Core Gui Widgets OpenGL Multimedia MultimediaWidgets PATHS ${PROJECT_SOURCE_DIR}/cmake/) # Need Qt5Core for
+        find_package(Qt5 REQUIRED COMPONENTS Core Gui Widgets OpenGL Multimedia MultimediaWidgets PATHS ${PROJECT_SOURCE_DIR}/cmake/)
         list(APPEND LIBRARIES ${Qt5Core_LIBRARY})
         list(APPEND LIBRARIES ${Qt5Gui_LIBRARY})
         list(APPEND LIBRARIES ${Qt5Widgets_LIBRARY})


- Fix import of SDL2 on OSX, it's really painful, but simple solution

--- cmake/Find/FindSDL2.cmake
+++ cmake/Find/FindSDL2.cmake
@@ -238,7 +238,7 @@
 set_target_properties ( SDL2 PROPERTIES
     INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIR}"
     INTERFACE_LINK_LIBRARIES "${SDL2_LIBRARIES}"
-    IMPORTED_LOCATION "${SDL2_LIBRARY}"
+    IMPORTED_LOCATION "${SDL2_LIBRARY_PATH}"
 )

 #if(NOT EMSCRIPTEN)


fix variable to substitute into config files

--- cmake/InstallMacros.cmake
+++ cmake/InstallMacros.cmake
@@ -20,7 +20,7 @@
     STRING(REPLACE "@LOCALSTATEDIR@/" "@HOME@${INC_CPACK_ARANGO_STATE_DIR}/"
       FileContent "${FileContent}")
   else ()
-    STRING(REPLACE "@LOCALSTATEDIR@/" "@ROOTDIR@${CPACK_LOCALSTATEDIR}/"
+    STRING(REPLACE "@LOCALSTATEDIR@/" "@ROOTDIR@${CMAKE_INSTALL_LOCALSTATEDIR}/"
       FileContent "${FileContent}")
   endif ()


Trying to fix again

Trying to fix again

--- cmake/ThirdPartyMPI.cmake
+++ cmake/ThirdPartyMPI.cmake
@@ -11,16 +11,17 @@
     CHECK_INCLUDE_FILES  (mpi.h    HAVE_MPI_H)
     CHECK_FUNCTION_EXISTS(MPI_Send HAVE_MPI_SEND)

+    SET(MPI_BUILTIN OFF CACHE INTERNAL
+        "Determines whether MPI is built in")
     IF (NOT "${HAVE_MPI_H}" OR NOT "${HAVE_MPI_SEND}")
         INCLUDE (FindMPI)
         MARK_AS_ADVANCED(MPI_LIBRARY)
         MARK_AS_ADVANCED(MPI_EXTRA_LIBRARY)
         MARK_AS_ADVANCED(file_cmd)
         INCLUDE_DIRECTORIES( ${MPI_INCLUDE_PATH} )
-        SET(MPI_BUILTIN OFF BOOL INTERNAL)
         MESSAGE(STATUS "Found MPI: ${MPI_LIBRARY}")
     ELSE()
-        SET(MPI_BUILTIN ON BOOL INTERNAL)
+        SET(MPI_BUILTIN ON)
         MESSAGE(STATUS "Found MPI: built in")
     ENDIF()


CMake: Add hash verification for fetched LLVM tarballs

--- cmake/external_llvm.cmake
+++ cmake/external_llvm.cmake
@@ -17,10 +17,15 @@
     (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows"))
     message(STATUS "Fetching LLVM from llvm.org")
     set(LLVM_RELEASE_URL http://releases.llvm.org/5.0.0/clang+llvm-5.0.0-linux-x86_64-ubuntu16.04.tar.xz)
+    set(LLVM_SHA1_HASH 9cb81c92aa4d3f9707a9b8413c4d24b8dee90c59)

     # Override default LLVM binaries
     if(PREBUILT_LLVM)
+        if(NOT DEFINED PREBUILT_LLVM_HASH)
+            message(FATAL_ERROR "SHA1 hash of prebuilt llvm tarball not provided in PREBUILT_LLVM_HASH.")
+        endif()
         set(LLVM_RELEASE_URL ${PREBUILT_LLVM})
+        set(LLVM_SHA1_HASH ${PREBUILT_LLVM_HASH})
     endif()

     # The 'BUILD_BYPRODUCTS' argument was introduced in CMake 3.2.
@@ -28,6 +33,7 @@
         ExternalProject_Add(
             ext_llvm
             URL ${LLVM_RELEASE_URL}
+            URL_HASH SHA1=${LLVM_SHA1_HASH}
             CONFIGURE_COMMAND ""
             BUILD_COMMAND ""
             INSTALL_COMMAND ""
@@ -37,6 +43,7 @@
         ExternalProject_Add(
             ext_llvm
             URL ${LLVM_RELEASE_URL}
+            URL_HASH SHA1=${LLVM_SHA1_HASH}
             CONFIGURE_COMMAND ""
             BUILD_COMMAND ""
             INSTALL_COMMAND ""


refine inference_lib.cmake

refine inference_lib.cmake

--- cmake/inference_lib.cmake
+++ cmake/inference_lib.cmake
@@ -1,72 +1,88 @@
 # make package for paddle fluid shared and static library
+function(copy TARGET)
+    set(options "")
+    set(oneValueArgs "")
+    set(multiValueArgs SRCS DSTS DEPS)
+    cmake_parse_arguments(copy_lib "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+
+    list(LENGTH copy_lib_SRCS copy_lib_SRCS_len)
+    list(LENGTH copy_lib_DSTS copy_lib_DSTS_len)
+    if(NOT ${copy_lib_SRCS_len} EQUAL ${copy_lib_DSTS_len})
+        message(FATAL_ERROR "${TARGET} source numbers are not equal to destination numbers")
+    endif()
+    math(EXPR len "${copy_lib_SRCS_len} - 1")
+
+    add_custom_target(${TARGET} DEPENDS ${copy_lib_DEPS})
+    foreach(index RANGE ${len})
+        list(GET copy_lib_SRCS ${index} src)
+        list(GET copy_lib_DSTS ${index} dst)
+        add_custom_command(TARGET ${TARGET} PRE_BUILD COMMAND mkdir -p "${dst}")
+        if(IS_DIRECTORY ${src})
+            add_custom_command(TARGET ${TARGET} PRE_BUILD COMMAND cp -r "${src}" "${dst}")
+        else()
+            add_custom_command(TARGET ${TARGET} PRE_BUILD COMMAND cp "${src}" "${dst}")
+        endif()
+    endforeach()
+endfunction()
+
 # third party
-set(lib_dir "${CMAKE_INSTALL_PREFIX}/third_party/eigen3")
-add_custom_target(eigen3_lib
-    COMMAND mkdir -p "${lib_dir}/Eigen" "${lib_dir}/unsupported"
-    COMMAND cp "${EIGEN_INCLUDE_DIR}/Eigen/Core" "${lib_dir}/Eigen"
-    COMMAND cp -r "${EIGEN_INCLUDE_DIR}/Eigen/src" "${lib_dir}/Eigen"
-    COMMAND cp -r "${EIGEN_INCLUDE_DIR}/unsupported/Eigen" "${lib_dir}/unsupported"
+set(dst_dir "${CMAKE_INSTALL_PREFIX}/third_party/eigen3")
+copy(eigen3_lib
+  SRCS ${EIGEN_INCLUDE_DIR}/Eigen/Core ${EIGEN_INCLUDE_DIR}/Eigen/src ${EIGEN_INCLUDE_DIR}/unsupported/Eigen
+  DSTS ${dst_dir}/Eigen ${dst_dir}/Eigen ${dst_dir}/unsupported
 )

-set(lib_dir "${CMAKE_INSTALL_PREFIX}/third_party/install/gflags")
-add_custom_target(gflags_lib
-    COMMAND mkdir -p "${lib_dir}/lib"
-    COMMAND cp -r "${GFLAGS_INCLUDE_DIR}" "${lib_dir}"
-    COMMAND cp "${GFLAGS_LIBRARIES}" "${lib_dir}/lib"
+set(dst_dir "${CMAKE_INSTALL_PREFIX}/third_party/install/gflags")
+copy(gflags_lib
+  SRCS ${GFLAGS_INCLUDE_DIR} ${GFLAGS_LIBRARIES}
+  DSTS ${dst_dir} ${dst_dir}/lib
 )

-set(lib_dir "${CMAKE_INSTALL_PREFIX}/third_party/install/glog")
-add_custom_target(glog_lib
-    COMMAND mkdir -p "${lib_dir}/lib"
-    COMMAND cp -r "${GLOG_INCLUDE_DIR}" "${lib_dir}"
-    COMMAND cp "${GLOG_LIBRARIES}" "${lib_dir}/lib"
+set(dst_dir "${CMAKE_INSTALL_PREFIX}/third_party/install/glog")
+copy(glog_lib
+  SRCS ${GLOG_INCLUDE_DIR} ${GLOG_LIBRARIES}
+  DSTS ${dst_dir} ${dst_dir}/lib
 )

 IF(NOT PROTOBUF_FOUND)
-    set(lib_dir "${CMAKE_INSTALL_PREFIX}/third_party/install/protobuf")
-    add_custom_target(protobuf_lib
-        COMMAND mkdir -p "${lib_dir}/lib"
-        COMMAND cp -r "${PROTOBUF_INCLUDE_DIR}" "${lib_dir}"
-        COMMAND cp "${PROTOBUF_LITE_LIBRARY}" "${lib_dir}/lib"
+    set(dst_dir "${CMAKE_INSTALL_PREFIX}/third_party/install/protobuf")
+    copy(protobuf_lib
+      SRCS ${PROTOBUF_INCLUDE_DIR} ${PROTOBUF_LITE_LIBRARY}
+      DSTS ${dst_dir} ${dst_dir}/lib
     )
 ENDIF(NOT PROTOBUF_FOUND)

 # paddle fluid module
-set(lib_dir "${CMAKE_INSTALL_PREFIX}/paddle/framework")
-add_custom_target(framework_lib DEPENDS framework_py_proto
-    COMMAND mkdir -p "${lib_dir}/details"
-    COMMAND cp "${PADDLE_SOURCE_DIR}/paddle/framework/*.h" "${lib_dir}"
-    COMMAND cp "${PADDLE_SOURCE_DIR}/paddle/framework/details/*.h" "${lib_dir}/details"
-    COMMAND cp "${PADDLE_BINARY_DIR}/paddle/framework/framework.pb.h" "${lib_dir}"
+set(src_dir "${PADDLE_SOURCE_DIR}/paddle")
+set(dst_dir "${CMAKE_INSTALL_PREFIX}/paddle")
+set(module "framework")
+copy(framework_lib DEPS framework_py_proto
+  SRCS ${src_dir}/${module}/*.h ${src_dir}/${module}/details/*.h ${PADDLE_BINARY_DIR}/paddle/framework/framework.pb.h
+  DSTS ${dst_dir}/${module} ${dst_dir}/${module}/details ${dst_dir}/${module}
 )

-set(lib_dir "${CMAKE_INSTALL_PREFIX}/paddle/memory")
-add_custom_target(memory_lib
-    COMMAND mkdir -p "${lib_dir}/detail"
-    COMMAND cp "${PADDLE_SOURCE_DIR}/paddle/memory/*.h" "${lib_dir}"
-    COMMAND cp "${PADDLE_SOURCE_DIR}/paddle/memory/detail/*.h" "${lib_dir}/detail"
+set(module "memory")
+copy(memory_lib
+  SRCS ${src_dir}/${module}/*.h ${src_dir}/${module}/detail/*.h
+  DSTS ${dst_dir}/${module} ${dst_dir}/${module}/detail
 )

-set(lib_dir "${CMAKE_INSTALL_PREFIX}/paddle/inference")
-add_custom_target(inference_lib DEPENDS paddle_fluid_shared
-    COMMAND mkdir -p "${lib_dir}"
-    COMMAND cp "${PADDLE_SOURCE_DIR}/paddle/inference/*.h" "${lib_dir}"
-    COMMAND cp "${PADDLE_BINARY_DIR}/paddle/inference/libpaddle_fluid.so" "${lib_dir}"
+set(module "inference")
+copy(inference_lib DEPENDS paddle_fluid_shared
+  SRCS ${src_dir}/${module}/*.h ${PADDLE_BINARY_DIR}/paddle/inference/libpaddle_fluid.so
+  DSTS ${dst_dir}/${module} ${dst_dir}/${module}
 )

-set(lib_dir "${CMAKE_INSTALL_PREFIX}/paddle/platform")
-add_custom_target(platform_lib
-    COMMAND mkdir -p "${lib_dir}/dynload" "${lib_dir}/details"
-    COMMAND cp "${PADDLE_SOURCE_DIR}/paddle/platform/*.h" "${lib_dir}"
-    COMMAND cp "${PADDLE_SOURCE_DIR}/paddle/platform/dynload/*.h" "${lib_dir}/dynload"
-    COMMAND cp "${PADDLE_SOURCE_DIR}/paddle/platform/details/*.h" "${lib_dir}/details"
-)
+set(module "platform")
+copy(platform_lib
+  SRCS ${src_dir}/${module}/*.h ${src_dir}/${module}/dynload/*.h ${src_dir}/${module}/details/*.h
+  DSTS ${dst_dir}/${module} ${dst_dir}/${module}/dynload ${dst_dir}/${module}/details
+)

-set(lib_dir "${CMAKE_INSTALL_PREFIX}/paddle/string")
-add_custom_target(string_lib
-    COMMAND mkdir -p "${lib_dir}/tinyformat"
-    COMMAND cp "${PADDLE_SOURCE_DIR}/paddle/string/*.h" "${lib_dir}"
-    COMMAND cp "${PADDLE_SOURCE_DIR}/paddle/string/tinyformat/*.h" "${lib_dir}/tinyformat"
+set(module "string")
+copy(string_lib
+  SRCS ${src_dir}/${module}/*.h ${src_dir}/${module}/tinyformat/*.h
+  DSTS ${dst_dir}/${module} ${dst_dir}/${module}/tinyformat
 )

 add_custom_target(inference_lib_dist DEPENDS


ignore proctor and gpu_kinfo when configuring PCLConfig.cmake

git-svn-id: 5398946ba177a3e438c2dae55e2cdfc2fb96c905@2901 a9d63959-f2ad-4865-b262-bf0e56cfafb6

--- cmake/pcl_pclconfig.cmake
+++ cmake/pcl_pclconfig.cmake
@@ -1,6 +1,6 @@

 set(PCL_SUBSYSTEMS_MODULES ${PCL_SUBSYSTEMS})
-list(REMOVE_ITEM PCL_SUBSYSTEMS_MODULES tools cuda_apps global_tests)
+list(REMOVE_ITEM PCL_SUBSYSTEMS_MODULES tools cuda_apps global_tests proctor gpu_kinfu)

 set(PCLCONFIG_AVAILABLE_COMPONENTS)
 set(PCLCONFIG_AVAILABLE_COMPONENTS_LIST)


COMP: ITK_USE_REVIEW -> Module_ITKReview.

ITK_USE_REVIEW has been deprecated.

Change-Id: I34f1b29273a5cb8c5be14b9a119a4cca36b4cc15

--- Superbuild/External-ITK.cmake
+++ Superbuild/External-ITK.cmake
@@ -37,7 +37,7 @@
     -DBUILD_EXAMPLES:BOOL=OFF
     -DBUILD_TESTING:BOOL=OFF
     -DITK_BUILD_ALL_MODULES:BOOL=ON
-    -DITK_USE_REVIEW:BOOL=ON
+    -DModule_ITKReview:BOOL=ON
     ${_vtk_args}
     ${_opencv_args}
   INSTALL_COMMAND ""


[compiler-rt] Use CMAKE_LINKER instead of hardcoding ld

Respect a custom linker path provided by the user if one is present
(otherwise CMAKE_LINKER will have been set to the right value by CMake).

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

--- cmake/Modules/CompilerRTDarwinUtils.cmake
+++ cmake/Modules/CompilerRTDarwinUtils.cmake
@@ -43,7 +43,7 @@
 # link for.
 function(darwin_get_toolchain_supported_archs output_var)
   execute_process(
-    COMMAND ld -v
+    COMMAND "${CMAKE_LINKER}" -v
     ERROR_VARIABLE LINKER_VERSION)

   string(REGEX MATCH "configured to support archs: ([^\n]+)"


blacklist intel 16.0.1

blacklist intel 16.0.1

--- cmake/checks/check_03_compiler_bugs.cmake
+++ cmake/checks/check_03_compiler_bugs.cmake
@@ -434,3 +434,11 @@
   RESET_CMAKE_REQUIRED()
 ENDIF()

+#
+# Intel 16.0.1 produces wrong code that creates a race condition in
+# tests/fe/curl_curl_01.debug but 16.0.2 is known to work. Blacklist this
+# version. Also see github.com/dealii/dealii/issues/2203
+#
+IF(CMAKE_CXX_COMPILER_ID MATCHES "Intel" AND CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL "16.0.1" )
+  MESSAGE(FATAL_ERROR "Intel compiler version 16.0.1 is not supported, please update to 16.0.2 or newer!")
+ENDIF()