Delete facts.cmake

Delete facts.cmake

--- facts/facts.cmake
+++ facts/facts.cmake
@@ -1,607 +0,0 @@
-cmake_minimum_required(VERSION 2.8)
-cmake_policy(SET CMP0011 NEW)
-cmake_policy(SET CMP0045 OLD)
-
-IF(NOT DEFINED CMAKI_PATH)
-	set(CMAKI_PATH ${CMAKE_MODULE_PATH})
-ENDIF()
-
-IF(NOT DEFINED DEPENDS_PATH)
-	set(DEPENDS_PATH ${CMAKI_PATH}/../depends)
-ENDIF()
-
-IF(NOT DEFINED CMAKE_PREFIX_PATH)
-	set(CMAKE_PREFIX_PATH ${DEPENDS_PATH}/cmakefiles)
-ENDIF()
-
-IF(NOT DEFINED ARTIFACTS_PATH)
-	set(ARTIFACTS_PATH ${CMAKI_PATH}/../cmaki_generator)
-ENDIF()
-
-IF(NOT DEFINED DEPENDS_PATHFILE)
-	# rename to ".cmaki.yml" ?
-	set(DEPENDS_PATHFILE ${CMAKI_PATH}/../depends.json)
-ENDIF()
-
-if(DEFINED CMAKI_DEBUG)
-	MESSAGE("CMAKI_PATH = ${CMAKI_PATH}")
-	MESSAGE("DEPENDS_PATH = ${DEPENDS_PATH}")
-	MESSAGE("CMAKE_PREFIX_PATH = ${CMAKE_PREFIX_PATH}")
-	MESSAGE("ARTIFACTS_PATH = ${ARTIFACTS_PATH}")
-	MESSAGE("DEPENDS_PATHFILE = ${DEPENDS_PATHFILE}")
-	MESSAGE(FATAL_ERROR)
-endif()
-
-IF(WIN32)
-	if(MSVC14)
-		set(MSVC_NAME_LOWER "vc140")
-		set(MSVC_NAME_UPPER "VC140")
-	elseif(MSVC13)
-		set(MSVC_NAME_LOWER "vc130")
-		set(MSVC_NAME_UPPER "VC130")
-	elseif(MSVC12)
-		set(MSVC_NAME_LOWER "vc120")
-		set(MSVC_NAME_UPPER "VC120")
-	elseif(MSVC11)
-		set(MSVC_NAME_LOWER "vc110")
-		set(MSVC_NAME_UPPER "VC110")
-	elseif(MSVC10)
-		set(MSVC_NAME_LOWER "vc100")
-		set(MSVC_NAME_UPPER "VC100")
-	elseif(MSVC9)
-		set(MSVC_NAME_LOWER "vc90")
-		set(MSVC_NAME_UPPER "VC90")
-	else(MSVC8)
-		set(MSVC_NAME_LOWER "vc80")
-		set(MSVC_NAME_UPPER "VC80")
-	endif()
-	SET(CMAKI_COMPILER "${MSVC_NAME_UPPER}")
-ELSE()
-	SET(compiler "")
-	get_filename_component(compiler ${CMAKE_CXX_COMPILER} NAME)
-	SET(CMAKI_COMPILER "${compiler}")
-ENDIF()
-
-IF(WIN32)
-	if(CMAKE_CL_64)
-		set(CMAKI_PLATFORM "win64")
-	else(CMAKE_CL_64)
-		set(CMAKI_PLATFORM "win32")
-	endif(CMAKE_CL_64)
-ELSE()
-	execute_process(
-		COMMAND sh detect_operative_system.sh
-		WORKING_DIRECTORY "${CMAKI_PATH}/ci"
-		OUTPUT_VARIABLE RESULT_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
-	set(CMAKI_PLATFORM "${RESULT_VERSION}")
-ENDIF()
-
-function(cmaki_find_package PACKAGE)
-
-	IF(NOT DEFINED CMAKI_REPOSITORY)
-		MESSAGE(FATAL_ERROR "CMAKI_REPOSITORY: is not defined")
-	ENDIF()
-
-	# 1. obtener la version actual (o ninguno en caso de no tener el artefacto)
-	execute_process(
-		COMMAND python ${ARTIFACTS_PATH}/get_package.py --name=${PACKAGE} --depends=${DEPENDS_PATHFILE}
-		WORKING_DIRECTORY "${ARTIFACTS_PATH}"
-		OUTPUT_VARIABLE RESULT_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
-	if(RESULT_VERSION)
-		set(VERSION_REQUEST "${RESULT_VERSION}")
-		set(EXTRA_VERSION "--version=${VERSION_REQUEST}")
-	else()
-		set(VERSION_REQUEST "")
-		set(EXTRA_VERSION "")
-	endif()
-
-	# 2.5. define flags
-	if(NOT DEFINED NOCACHE_LOCAL)
-		set(NO_USE_CACHE_LOCAL "FALSE")
-	else()
-		set(NO_USE_CACHE_LOCAL "${NOCACHE_LOCAL}")
-	endif()
-	if(NOT DEFINED NOCACHE_REMOTE)
-		set(NO_USE_CACHE_REMOTE "FALSE")
-	else()
-		set(NO_USE_CACHE_REMOTE "${NOCACHE_REMOTE}")
-	endif()
-
-	#######################################################
-	# 2. obtener la mejor version buscando en la cache local y remota
-	execute_process(
-		COMMAND python ${ARTIFACTS_PATH}/check_remote_version.py --server=${CMAKI_REPOSITORY} --artifacts=${CMAKE_PREFIX_PATH} --platform=${CMAKI_PLATFORM} --name=${PACKAGE} ${EXTRA_VERSION}
-		WORKING_DIRECTORY "${ARTIFACTS_PATH}"
-		OUTPUT_VARIABLE RESULT_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
-	if(RESULT_VERSION)
-		list(GET RESULT_VERSION 0 PACKAGE_MODE)
-		list(GET RESULT_VERSION 1 PACKAGE_NAME)
-		list(GET RESULT_VERSION 2 VERSION)
-	else()
-		set(PACKAGE_MODE "EXACT")
-		set(VERSION ${VERSION_REQUEST})
-		message("-- need build package ${PACKAGE} can't get version: ${VERSION_REQUEST}, will be generated.")
-		# avoid remote cache, need build
-		set(NO_USE_CACHE_REMOTE "TRUE")
-	endif()
-	#######################################################
-
-	# 3. si no tengo los ficheros de cmake, los intento descargar
-	set(depends_dir "${DEPENDS_PATH}")
-	set(depends_bin_package "${depends_dir}/${PACKAGE}-${VERSION}")
-	set(depends_package "${CMAKE_PREFIX_PATH}/${PACKAGE}-${VERSION}")
-	set(package_marker "${depends_bin_package}/${CMAKI_PLATFORM}.cache")
-	if(NOT EXISTS "${package_marker}" OR "${NO_USE_CACHE_LOCAL}")
-		# pido un paquete, en funcion de:
-		#		- paquete
-		#		- version
-		#		- plataforma
-		#		- modo (COMPATIBLE / EXACT)
-		# Recibo el que mejor se adapta a mis especificaciones
-		# Otra opcion es enviar todos los ficheros de cmake de todas las versiones
-		set(package_uncompressed_file "${CMAKE_PREFIX_PATH}/${PACKAGE}.tmp")
-		set(package_cmake_filename "${PACKAGE}-${VERSION}-${CMAKI_PLATFORM}-cmake.tar.gz")
-		set(http_package_cmake_filename "${CMAKI_REPOSITORY}/download.php?file=${package_cmake_filename}")
-		# 4. descargo el fichero que se supone tienes los ficheros cmake
-		if(NOT "${NO_USE_CACHE_REMOTE}")
-			cmaki_download_file("${http_package_cmake_filename}" "${package_uncompressed_file}")
-		endif()
-		# Si no puede descargar el artefacto ya hecho (es que necesito compilarlo y subirlo)
-		if(NOT "${COPY_SUCCESFUL}" OR "${NO_USE_CACHE_REMOTE}")
-
-			file(REMOVE_RECURSE "${depends_bin_package}")
-			file(REMOVE_RECURSE "${depends_package}")
-			file(REMOVE "${package_uncompressed_file}")
-
-			# 5. compilo y genera el paquete en local
-			message("Generating artifact ${PACKAGE} ...")
-			#
-			# ojo: estoy hay que mejorarlo
-			# no queremos usar "-o", queremos que trate de compilar las dependencias (sin -o)
-			# pero queremos que evite compilar cosas que estan en cache remota
-			#
-			execute_process(
-				COMMAND python ${ARTIFACTS_PATH}/build.py ${PACKAGE} --depends=${DEPENDS_PATHFILE} --cmakefiles=${CMAKI_PATH} --prefix=${CMAKE_PREFIX_PATH} --third-party-dir=${CMAKE_PREFIX_PATH} --server=${CMAKI_REPOSITORY}
-				WORKING_DIRECTORY "${ARTIFACTS_PATH}"
-				RESULT_VARIABLE artifacts_result
-				)
-			if(artifacts_result)
-				message(FATAL_ERROR "can't create artifact ${PACKAGE}: error ${artifacts_result}")
-				file(REMOVE_RECURSE "${depends_bin_package}")
-				file(REMOVE_RECURSE "${depends_package}")
-				file(REMOVE "${package_uncompressed_file}")
-			endif()
-
-			#######################################################
-			# 6: obtengo la version del paquete creado
-			execute_process(
-				COMMAND python ${ARTIFACTS_PATH}/check_remote_version.py --server=${CMAKI_REPOSITORY} --artifacts=${CMAKE_PREFIX_PATH} --platform=${CMAKI_PLATFORM} --name=${PACKAGE} ${EXTRA_VERSION}
-				WORKING_DIRECTORY "${ARTIFACTS_PATH}"
-				OUTPUT_VARIABLE RESULT_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
-			if(RESULT_VERSION)
-				list(GET RESULT_VERSION 0 PACKAGE_MODE)
-				list(GET RESULT_VERSION 1 PACKAGE_NAME)
-				list(GET RESULT_VERSION 2 VERSION)
-			else()
-				message(FATAL_ERROR "-- not found ${PACKAGE}.")
-			endif()
-			#######################################################
-
-			set(package_filename ${PACKAGE}-${VERSION}-${CMAKI_PLATFORM}.tar.gz)
-			set(package_cmake_filename ${PACKAGE}-${VERSION}-${CMAKI_PLATFORM}-cmake.tar.gz)
-			set(package_generated_file ${CMAKE_PREFIX_PATH}/${package_filename})
-			set(package_cmake_generated_file ${CMAKE_PREFIX_PATH}/${package_cmake_filename})
-
-			# 7. descomprimo el artefacto
-			execute_process(
-				COMMAND "${CMAKE_COMMAND}" -E tar zxf "${package_cmake_generated_file}"
-				WORKING_DIRECTORY "${CMAKE_PREFIX_PATH}/"
-				RESULT_VARIABLE uncompress_result
-				)
-			if(uncompress_result)
-				message(FATAL_ERROR "Extracting ${package_cmake_generated_file} failed! Error ${uncompress_result}")
-				file(REMOVE_RECURSE "${depends_bin_package}")
-				file(REMOVE_RECURSE "${depends_package}")
-				file(REMOVE "${package_uncompressed_file}")
-				file(REMOVE "${package_generated_file}")
-			endif()
-
-			# y tambien descomprimo el propio tar gz
-			execute_process(
-				COMMAND "${CMAKE_COMMAND}" -E tar zxf "${package_generated_file}"
-				WORKING_DIRECTORY "${depends_dir}/"
-				RESULT_VARIABLE uncompress_result2
-				)
-			if(uncompress_result2)
-				message(FATAL_ERROR "Extracting ${package_generated_file} failed! Error ${uncompress_result2}")
-				file(REMOVE_RECURSE "${depends_bin_package}")
-				file(REMOVE_RECURSE "${depends_package}")
-				file(REMOVE "${package_uncompressed_file}")
-				file(REMOVE "${package_generated_file}")
-			endif()
-
-			# 8. borro los 2 tar gz
-			file(REMOVE "${package_generated_file}")
-			file(REMOVE "${package_cmake_generated_file}")
-
-		# me lo he descargdo y solo es descomprimirlo
-		elseif(EXISTS "${package_uncompressed_file}")
-
-			# 10. lo descomprimo cacheado
-			execute_process(
-				COMMAND "${CMAKE_COMMAND}" -E tar zxf "${package_uncompressed_file}"
-				WORKING_DIRECTORY "${CMAKE_PREFIX_PATH}/"
-				RESULT_VARIABLE uncompress_result)
-			if(uncompress_result)
-				message(FATAL_ERROR "Extracting ${package_uncompressed_file} failed! Error ${uncompress_result}")
-			endif()
-			file(REMOVE "${package_uncompressed_file}")
-		endif()
-	endif()
-
-	# 12. hacer find_package tradicional, ahora que tenemos los ficheros de cmake
-	if(${PACKAGE_MODE} STREQUAL "EXACT")
-		# message("-- using ${PACKAGE} in EXACT")
-		find_package(${PACKAGE} ${VERSION} EXACT REQUIRED)
-	else()
-		# message("-- using ${PACKAGE} in COMPATIBLE")
-		find_package(${PACKAGE} ${VERSION} REQUIRED)
-	endif()
-
-	# 13 add includes
-	string(TOUPPER "${PACKAGE}" PACKAGE_UPPER)
-	foreach(INCLUDE_DIR ${${PACKAGE_UPPER}_INCLUDE_DIRS})
-		list(APPEND CMAKI_INCLUDE_DIRS "${INCLUDE_DIR}")
-	endforeach()
-
-	# 14. add libdirs
-	foreach(LIB_DIR ${${PACKAGE_UPPER}_LIBRARIES})
-		list(APPEND CMAKI_LIBRARIES "${LIB_DIR}")
-	endforeach()
-
-	# 15. add vers specific
-	set(${PACKAGE_UPPER}_INCLUDE_DIRS "${${PACKAGE_UPPER}_INCLUDE_DIRS}" PARENT_SCOPE)
-	set(${PACKAGE_UPPER}_LIBRARIES "${${PACKAGE_UPPER}_LIBRARIES}" PARENT_SCOPE)
-
-	# 16. add vars globals
-	set(CMAKI_INCLUDE_DIRS "${CMAKI_INCLUDE_DIRS}" PARENT_SCOPE)
-	set(CMAKI_LIBRARIES "${CMAKI_LIBRARIES}" PARENT_SCOPE)
-
-endfunction()
-
-macro(cmaki_package_version_check)
-	# llamar a check_remote_version
-	# dando el nombre recibo la version
-	execute_process(
-		COMMAND python ${ARTIFACTS_PATH}/check_remote_version.py --artifacts=${CMAKE_PREFIX_PATH} --platform=${CMAKI_PLATFORM} --name=${PACKAGE_FIND_NAME} --version=${PACKAGE_FIND_VERSION}
-		WORKING_DIRECTORY "${ARTIFACTS_PATH}"
-		OUTPUT_VARIABLE RESULT_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
-	list(GET RESULT_VERSION 0 RESULT)
-	list(GET RESULT_VERSION 1 NAME)
-	list(GET RESULT_VERSION 2 VERSION)
-	###################################
-	set(PACKAGE_VERSION_${RESULT} 1)
-	set(${NAME}_VERSION ${VERSION})
-endmacro()
-
-function(cmaki_install_3rdparty)
-	foreach(CMAKI_3RDPARTY_TARGET ${ARGV})
-		foreach(CMAKI_BUILD_TYPE ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE})
-			string(TOUPPER "${CMAKI_BUILD_TYPE}" CMAKI_BUILD_TYPE_UPPER)
-			get_target_property(CMAKI_3RDPARTY_TARGET_TYPE ${CMAKI_3RDPARTY_TARGET} TYPE)
-			if(${CMAKI_3RDPARTY_TARGET_TYPE} STREQUAL "SHARED_LIBRARY")
-				get_target_property(CMAKI_3RDPARTY_TARGET_LOCATION ${CMAKI_3RDPARTY_TARGET} IMPORTED_LOCATION_${CMAKI_BUILD_TYPE_UPPER})
-				get_target_property(CMAKI_3RDPARTY_TARGET_SONAME ${CMAKI_3RDPARTY_TARGET} IMPORTED_SONAME_${CMAKI_BUILD_TYPE_UPPER})
-				get_target_property(CMAKI_3RDPARTY_TARGET_PDB ${CMAKI_3RDPARTY_TARGET} IMPORTED_PDB_${CMAKI_BUILD_TYPE_UPPER})
-				if(CMAKI_3RDPARTY_TARGET_SONAME)
-					get_filename_component(CMAKI_3RDPARTY_TARGET_LOCATION_PATH "${CMAKI_3RDPARTY_TARGET_LOCATION}" PATH)
-					set(CMAKI_3RDPARTY_TARGET_LOCATION "${CMAKI_3RDPARTY_TARGET_LOCATION_PATH}/${CMAKI_3RDPARTY_TARGET_SONAME}")
-				endif()
-				get_filename_component(CMAKI_3RDPARTY_TARGET_INSTALLED_NAME "${CMAKI_3RDPARTY_TARGET_LOCATION}" NAME)
-				get_filename_component(CMAKI_3RDPARTY_TARGET_LOCATION "${CMAKI_3RDPARTY_TARGET_LOCATION}" REALPATH)
-				install(PROGRAMS ${CMAKI_3RDPARTY_TARGET_LOCATION}
-					DESTINATION ${CMAKI_BUILD_TYPE}
-					CONFIGURATIONS ${CMAKI_BUILD_TYPE}
-					RENAME ${CMAKI_3RDPARTY_TARGET_INSTALLED_NAME})
-				if((NOT UNIX) AND EXISTS ${CMAKI_3RDPARTY_TARGET_PDB})
-					get_filename_component(CMAKI_3RDPARTY_TARGET_PDB_NAME "${CMAKI_3RDPARTY_TARGET_PDB}" NAME)
-					install(PROGRAMS ${CMAKI_3RDPARTY_TARGET_PDB}
-						DESTINATION ${CMAKI_BUILD_TYPE}
-						CONFIGURATIONS ${CMAKI_BUILD_TYPE}
-						RENAME ${CMAKI_3RDPARTY_TARGET_PDB_NAME})
-				endif()
-			endif()
-		endforeach()
-	endforeach()
-endfunction()
-
-function(cmaki_download_file THE_URL INTO_FILE)
-	set(COPY_SUCCESFUL FALSE PARENT_SCOPE)
-	file(DOWNLOAD ${THE_URL} ${INTO_FILE} STATUS RET)
-	list(GET RET 0 RET_CODE)
-	if(RET_CODE EQUAL 0)
-		set(COPY_SUCCESFUL TRUE PARENT_SCOPE)
-	else()
-		set(COPY_SUCCESFUL FALSE PARENT_SCOPE)
-	endif()
-endfunction()
-
-macro(cmaki_download_package)
-	# Base URL for packages.
-	if(NOT DEFINED CMAKI_REPOSITORY)
-		MESSAGE(FATAL_ERROR "CMAKI_REPOSITORY: is not defined")
-	endif()
-	get_filename_component(package_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
-	# ${package_name} en realidad es paquete + version (asyncply-0.0.0.0)
-	get_filename_component(package_name "${package_dir}" NAME)
-	set(package_filename ${package_name}-${CMAKI_PLATFORM}.tar.gz)
-	set(http_package_filename ${CMAKI_REPOSITORY}/download.php?file=${package_filename})
-
-	# URL implicita
-	# strip implicito
-
-	set(depends_dir "${DEPENDS_PATH}")
-	get_filename_component(depends_dir "${depends_dir}" ABSOLUTE)
-	set(package_compessed "${depends_dir}/${package_name}.tar.gz")
-	set(package_uncompressed_dir "${depends_dir}/${package_name}.tmp")
-	set(package_marker "${depends_dir}/${package_name}/${CMAKI_PLATFORM}.cache")
-	set(package_compressed_md5 "${package_dir}/${package_name}-${CMAKI_PLATFORM}.md5")
-	set(strip_compressed "${package_name}")
-	set(_MY_DIR "${package_dir}")
-	set(_DIR "${depends_dir}/${strip_compressed}")
-
-	if(NOT EXISTS "${package_marker}")
-		# TODO: avoid doble download
-		file(REMOVE "${package_compessed}")
-		if(EXISTS "${package_compressed_md5}")
-			file(READ "${package_compressed_md5}" md5sum )
-			string(REGEX MATCH "[0-9a-fA-F]*" md5sum "${md5sum}")
-			# TODO: use md5sum
-			# cmaki_download_file("${http_package_filename}" "${package_compessed}" "${md5sum}" )
-			message("downloading ${http_package_filename}")
-			cmaki_download_file("${http_package_filename}" "${package_compessed}")
-			if(NOT "${COPY_SUCCESFUL}")
-				file(REMOVE "${package_compessed}")
-				message(FATAL_ERROR "Error downloading ${http_package_filename}")
-			endif()
-		else()
-			MESSAGE("Checksum for ${package_name}-${CMAKI_PLATFORM}.tar.gz not found. Rejecting to download an untrustworthy file.")
-			file(REMOVE_RECURSE "${package_dir}")
-			file(REMOVE_RECURSE "${_DIR}")
-		endif()
-	endif()
-
-	if(EXISTS "${package_compessed}")
-		file(MAKE_DIRECTORY "${package_uncompressed_dir}")
-		message("Extracting ${package_compessed} into ${package_uncompressed_dir}...")
-		execute_process(
-			COMMAND "${CMAKE_COMMAND}" -E tar zxf "${package_compessed}"
-			WORKING_DIRECTORY "${package_uncompressed_dir}"
-			RESULT_VARIABLE uncompress_result)
-		if(uncompress_result)
-			message(FATAL_ERROR "Extracting ${package_compessed} failed! Error ${uncompress_result}")
-		endif()
-		file(COPY "${package_uncompressed_dir}/${strip_compressed}" DESTINATION "${depends_dir}")
-		file(REMOVE "${package_compessed}")
-		file(REMOVE_RECURSE "${package_uncompressed_dir}")
-		file(WRITE "${package_marker}" "")
-	endif()
-
-endmacro()
-
-function(cmaki2_executable)
-	cmaki_parse_parameters(${ARGV})
-	set(_EXECUTABLE_NAME ${_MAIN_NAME})
-	source_group( "Source Files" FILES ${_SOURCES} )
-	common_flags()
-	common_linking(${_EXECUTABLE_NAME})
-	include_directories(${CMAKE_SOURCE_DIR})
-	include_directories(node_modules)
-	foreach(INCLUDE_DIR ${CMAKI_INCLUDE_DIRS})
-		include_directories(${INCLUDE_DIR})
-	endforeach()
-	if(HAVE_PTHREADS)
-		add_compile_options(-pthread)
-	endif()
-	if(WIN32)
-		ADD_EXECUTABLE(${_EXECUTABLE_NAME} WIN32 ${_SOURCES})
-	else()
-		ADD_EXECUTABLE(${_EXECUTABLE_NAME} ${_SOURCES})
-	endif()
-	target_link_libraries(${_EXECUTABLE_NAME} ${_DEPENDS})
-	# echo_targets(${_EXECUTABLE_NAME})
-	foreach(LIB_DIR ${CMAKI_LIBRARIES})
-		target_link_libraries(${_EXECUTABLE_NAME} ${LIB_DIR})
-		cmaki_install_3rdparty(${LIB_DIR})
-	endforeach()
-	if(HAVE_PTHREADS)
-		target_link_libraries(${_EXECUTABLE_NAME} -lpthread)
-	endif()
-	foreach(BUILD_TYPE ${CMAKE_BUILD_TYPE})
-		INSTALL(    TARGETS ${_EXECUTABLE_NAME}
-					DESTINATION ${BUILD_TYPE}/${_SUFFIX_DESTINATION}
-					CONFIGURATIONS ${BUILD_TYPE})
-	endforeach()
-	generate_vcxproj_user(${_EXECUTABLE_NAME})
-
-endfunction()
-
-function(cmaki2_library)
-	cmaki_parse_parameters(${ARGV})
-	set(_LIBRARY_NAME ${_MAIN_NAME})
-	source_group( "Source Files" FILES ${_SOURCES} )
-	common_flags()
-	common_linking(${_LIBRARY_NAME})
-	include_directories(${CMAKE_SOURCE_DIR})
-	include_directories(node_modules)
-	foreach(INCLUDE_DIR ${CMAKI_INCLUDE_DIRS})
-		include_directories(${INCLUDE_DIR})
-	endforeach()
-	if(HAVE_PTHREADS)
-		add_compile_options(-pthread)
-	endif()
-	add_library(${_LIBRARY_NAME} SHARED ${_SOURCES})
-	target_link_libraries(${_LIBRARY_NAME} ${_DEPENDS})
-	# echo_targets(${_LIBRARY_NAME})
-	foreach(LIB_DIR ${CMAKI_LIBRARIES})
-		target_link_libraries(${_LIBRARY_NAME} ${LIB_DIR})
-		cmaki_install_3rdparty(${LIB_DIR})
-	endforeach()
-	if(HAVE_PTHREADS)
-		target_link_libraries(${_LIBRARY_NAME} -lpthread)
-	endif()
-	foreach(BUILD_TYPE ${CMAKE_BUILD_TYPE})
-		INSTALL(	TARGETS ${_LIBRARY_NAME}
-					DESTINATION ${BUILD_TYPE}/${_SUFFIX_DESTINATION}
-					CONFIGURATIONS ${BUILD_TYPE})
-	endforeach()
-
-endfunction()
-
-function(cmaki2_static_library)
-	cmaki_parse_parameters(${ARGV})
-	set(_LIBRARY_NAME ${_MAIN_NAME})
-	source_group( "Source Files" FILES ${_SOURCES} )
-	common_flags()
-	common_linking(${_LIBRARY_NAME})
-	add_definitions(-D${_LIBRARY_NAME}_STATIC)
-	include_directories(${CMAKE_SOURCE_DIR})
-	include_directories(node_modules)
-	foreach(INCLUDE_DIR ${CMAKI_INCLUDE_DIRS})
-		include_directories(${INCLUDE_DIR})
-	endforeach()
-	if(HAVE_PTHREADS)
-		add_compile_options(-pthread)
-	endif()
-	add_library(${_LIBRARY_NAME} STATIC ${_SOURCES})
-	target_link_libraries(${_LIBRARY_NAME} ${_DEPENDS})
-	# echo_targets(${_LIBRARY_NAME})
-	foreach(LIB_DIR ${CMAKI_LIBRARIES})
-		target_link_libraries(${_LIBRARY_NAME} ${LIB_DIR})
-		cmaki_install_3rdparty(${LIB_DIR})
-	endforeach()
-	if(HAVE_PTHREADS)
-		target_link_libraries(${_LIBRARY_NAME} -lpthread)
-	endif()
-	foreach(BUILD_TYPE ${CMAKE_BUILD_TYPE})
-		INSTALL(	TARGETS ${_LIBRARY_NAME}
-					DESTINATION ${BUILD_TYPE}/${_SUFFIX_DESTINATION}
-					CONFIGURATIONS ${BUILD_TYPE})
-	endforeach()
-endfunction()
-
-function(cmaki2_test)
-	cmaki_parse_parameters(${ARGV})
-	set(_TEST_NAME ${_MAIN_NAME})
-	common_flags()
-	common_linking(${_TEST_NAME}_exe)
-	include_directories(node_modules)
-	foreach(INCLUDE_DIR ${CMAKI_INCLUDE_DIRS})
-		include_directories(${INCLUDE_DIR})
-	endforeach()
-	if(HAVE_PTHREADS)
-		add_compile_options(-pthread)
-	endif()
-	add_executable(${_TEST_NAME}_exe ${_SOURCES})
-	target_link_libraries(${_TEST_NAME}_exe ${_DEPENDS})
-	foreach(LIB_DIR ${CMAKI_LIBRARIES})
-		target_link_libraries(${_TEST_NAME}_exe ${LIB_DIR})
-		cmaki_install_3rdparty(${LIB_DIR})
-	endforeach()
-	if(HAVE_PTHREADS)
-		target_link_libraries(${_TEST_NAME}_exe -lpthread)
-	endif()
-	foreach(BUILD_TYPE ${CMAKE_BUILD_TYPE})
-		INSTALL(  	TARGETS ${_TEST_NAME}_exe
-				DESTINATION ${BUILD_TYPE}/${_SUFFIX_DESTINATION}
-				CONFIGURATIONS ${BUILD_TYPE})
-		if (DEFINED TESTS_VALGRIND AND (TESTS_VALGRIND STREQUAL "TRUE") AND (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (CMAKE_BUILD_TYPE STREQUAL "Release"))
-			find_program(VALGRIND "valgrind")
-			if(VALGRIND)
-				add_test(
-					NAME ${_TEST_NAME}_memcheck
-					COMMAND "${VALGRIND}" --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes $<TARGET_FILE:${_TEST_NAME}_exe> --gmock_verbose=error
-					WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${BUILD_TYPE}
-					CONFIGURATIONS ${BUILD_TYPE}
-					)
-				add_test(
-					NAME ${_TEST_NAME}_cachegrind
-					COMMAND "${VALGRIND}" --tool=cachegrind $<TARGET_FILE:${_TEST_NAME}_exe> --gmock_verbose=error
-					WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${BUILD_TYPE}
-					CONFIGURATIONS ${BUILD_TYPE}
-					)
-				add_test(
-					NAME ${_TEST_NAME}_helgrind
-					COMMAND "${VALGRIND}" --tool=helgrind $<TARGET_FILE:${_TEST_NAME}_exe> --gmock_verbose=error
-					WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${BUILD_TYPE}
-					CONFIGURATIONS ${BUILD_TYPE}
-					)
-				add_test(
-					NAME ${_TEST_NAME}_callgrind
-					COMMAND "${VALGRIND}" --tool=callgrind $<TARGET_FILE:${_TEST_NAME}_exe> --gmock_verbose=error
-					WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${BUILD_TYPE}
-					CONFIGURATIONS ${BUILD_TYPE}
-					)
-				add_test(
-					NAME ${_TEST_NAME}_drd
-					COMMAND "${VALGRIND}" --tool=drd --read-var-info=yes $<TARGET_FILE:${_TEST_NAME}_exe> --gmock_verbose=error
-					WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${BUILD_TYPE}
-					CONFIGURATIONS ${BUILD_TYPE}
-					)
-			else()
-				message(FATAL_ERROR "no valgrind detected")
-			endif()
-		endif()
-		add_test(
-			NAME ${_TEST_NAME}_test
-			COMMAND $<TARGET_FILE:${_TEST_NAME}_exe> --gmock_verbose=error
-			WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${BUILD_TYPE}
-			CONFIGURATIONS ${BUILD_TYPE}
-			)
-	endforeach()
-	generate_vcxproj_user(${_TEST_NAME})
-
-endfunction()
-
-macro(cmaki2_gtest)
-	cmaki_find_package(google-gmock)
-	cmaki2_test(${ARGV})
-endmacro()
-
-macro(cmaki_python_library)
-	cmaki_find_package(python)
-	cmaki_find_package(boost-python)
-	cmaki2_library(${ARGV} PTHREADS)
-	cmaki_parse_parameters(${ARGV})
-	set_target_properties(${_MAIN_NAME} PROPERTIES PREFIX "")
-	foreach(BUILD_TYPE ${CMAKE_BUILD_TYPE})
-		INSTALL(	TARGETS ${_MAIN_NAME}
-				DESTINATION ${BUILD_TYPE}/lib/python3.5/lib-dynload
-				CONFIGURATIONS ${BUILD_TYPE})
-	endforeach()
-endmacro()
-
-macro(cmaki_boost_python_test)
-	cmaki_find_package(python)
-	cmaki_find_package(boost-python)
-	cmaki2_gtest(${ARGV} PTHREADS)
-	cmaki_parse_parameters(${ARGV})
-	set_tests_properties(${_MAIN_NAME}_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_INSTALL_PREFIX}/${CMAKE_BUILD_TYPE}")
-endmacro()
-
-macro(cmaki_python_test)
-	cmaki_find_package(python)
-	cmaki_parse_parameters(${ARGV})
-	add_test(	NAME ${_MAIN_NAME}_test
-			COMMAND ./bin/python3 ${_SOURCES}
-			WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${CMAKE_BUILD_TYPE})
-	set_tests_properties(${_MAIN_NAME}_test PROPERTIES ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/${CMAKE_BUILD_TYPE}")
-endmacro()
-
-macro(cmaki_python_install)
-	cmaki_find_package(python)
-	cmaki_find_package(boost-python)
-	get_filename_component(PYTHON3_DIR ${PYTHON3_EXECUTABLE} DIRECTORY)
-	get_filename_component(PYTHON3_PARENT_DIR ${PYTHON3_DIR} DIRECTORY)
-	cmaki_install_inside_dir(${PYTHON3_PARENT_DIR})
-endmacro()


Backport from trunk: Bug #18593044 COMPILE FLAGS NOT PASSED TO DTRACE, BREAKS CROSS BUILD

--- cmake/dtrace.cmake
+++ cmake/dtrace.cmake
@@ -1,4 +1,4 @@
-# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -74,13 +74,6 @@
    ${CMAKE_BINARY_DIR}/include/probes_mysql_dtrace.h
    ${CMAKE_BINARY_DIR}/include/probes_mysql_nodtrace.h
   )
-  IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
-   # Systemtap object
-   EXECUTE_PROCESS(
-     COMMAND ${DTRACE} -G -s ${CMAKE_SOURCE_DIR}/include/probes_mysql.d.base
-     -o ${CMAKE_BINARY_DIR}/probes_mysql.o
-   )
-  ENDIF()
   ADD_CUSTOM_TARGET(gen_dtrace_header
   DEPENDS
   ${CMAKE_BINARY_DIR}/include/probes_mysql.d
@@ -99,12 +92,7 @@
   IF(ENABLE_DTRACE)
     ADD_DEPENDENCIES(${target} gen_dtrace_header)

-    IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
-      TARGET_LINK_LIBRARIES(${target}  ${CMAKE_BINARY_DIR}/probes_mysql.o)
-    ENDIF()
-
-    # On Solaris, invoke dtrace -G to generate object file and
-    # link it together with target.
+    # Invoke dtrace to generate object file and link it together with target.
     IF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
       SET(objdir ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${target}.dir)
       SET(outfile ${objdir}/${target}_dtrace.o)
@@ -121,6 +109,21 @@
           -P ${CMAKE_SOURCE_DIR}/cmake/dtrace_prelink.cmake
         WORKING_DIRECTORY ${objdir}
       )
+    ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
+      # dtrace on Linux runs gcc and uses flags from environment
+      SET(CFLAGS_SAVED $ENV{CFLAGS})
+      SET(ENV{CFLAGS} ${CMAKE_C_FLAGS})
+      SET(outfile "${CMAKE_BINARY_DIR}/probes_mysql.o")
+      # Systemtap object
+      EXECUTE_PROCESS(
+        COMMAND ${DTRACE} -G -s ${CMAKE_SOURCE_DIR}/include/probes_mysql.d.base
+        -o ${outfile}
+        )
+      SET(ENV{CFLAGS} ${CFLAGS_SAVED})
+    ENDIF()
+
+    # Do not try to extend the library if we have not built the .o file
+    IF(outfile)
       # Add full  object path to linker flags
       GET_TARGET_PROPERTY(target_type ${target} TYPE)
       IF(NOT target_type MATCHES "STATIC")
@@ -132,12 +135,12 @@
         # but maybe one day this will be fixed.
         GET_TARGET_PROPERTY(target_location ${target} LOCATION)
         ADD_CUSTOM_COMMAND(
-         TARGET ${target} POST_BUILD
-         COMMAND ${CMAKE_AR} r  ${target_location} ${outfile}
-	 COMMAND ${CMAKE_RANLIB} ${target_location}
-        )
-       # Used in DTRACE_INSTRUMENT_WITH_STATIC_LIBS
-       SET(TARGET_OBJECT_DIRECTORY_${target}  ${objdir} CACHE INTERNAL "")
+          TARGET ${target} POST_BUILD
+          COMMAND ${CMAKE_AR} r  ${target_location} ${outfile}
+	  COMMAND ${CMAKE_RANLIB} ${target_location}
+          )
+        # Used in DTRACE_INSTRUMENT_WITH_STATIC_LIBS
+        SET(TARGET_OBJECT_DIRECTORY_${target}  ${objdir} CACHE INTERNAL "")
       ENDIF()
     ENDIF()
   ENDIF()


updated cmake gflags target

updated cmake gflags target

--- cmake/gflags.cmake
+++ cmake/gflags.cmake
@@ -11,17 +11,15 @@
 # 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.
-set(gRPC_GFLAGS_PROVIDER "module" CACHE STRING "portability fix")
+
 if("${gRPC_GFLAGS_PROVIDER}" STREQUAL "module")
-  message("gRPC GFLAGS is MODULE")
   if(NOT GFLAGS_ROOT_DIR)
     set(GFLAGS_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gflags)
   endif()
   if(EXISTS "${GFLAGS_ROOT_DIR}/CMakeLists.txt")
-    message("gRPC GFLAGS adding subdirectory")
     add_subdirectory(${GFLAGS_ROOT_DIR} third_party/gflags)
     if(TARGET gflags_static)
-      set(_gRPC_GFLAGS_LIBRARIES gflags_static)
+      set(_gRPC_GFLAGS_LIBRARIES gflags::gflags)
       set(_gRPC_GFLAGS_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include")
     endif()
   else()
@@ -32,7 +30,7 @@
   # Use "CONFIG" as there is no built-in cmake module for gflags.
   find_package(gflags REQUIRED CONFIG)
   if(TARGET gflags)
-    set(_gRPC_GFLAGS_LIBRARIES gflags)
+    set(_gRPC_GFLAGS_LIBRARIES gflags::gflags)
     set(_gRPC_GFLAGS_INCLUDE_DIR ${GFLAGS_INCLUDE_DIR})
   endif()
   set(_gRPC_FIND_GFLAGS "if(NOT gflags_FOUND)\n  find_package(gflags CONFIG)\nendif()")


Revert "Merge pull request #278 from mattiasljungstrom/cmake_msvc_rt_fix"

This reverts commit 6f744ad2e97faaf44d5267a31e039601208297dd, reversing
changes made to c9fb4125621067347052dae44dc0fea9585ba3cf.

--- cmake-toolchains/windows.cmake
+++ cmake-toolchains/windows.cmake
@@ -48,20 +48,10 @@
     set(FIPS_VS_EXCEPTION_FLAGS "/EHsc")
 endif()

-# CMake 3.15 has a different way to setup MT / MD flags
-# see: https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html#variable:CMAKE_MSVC_RUNTIME_LIBRARY
-if (${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.15)
-    if (FIPS_DYNAMIC_CRT OR FIPS_UWP)
-        set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
-    else()
-        set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
-    endif()
+if (FIPS_DYNAMIC_CRT OR FIPS_UWP)
+    set(FIPS_VS_CRT_FLAGS "/MD")
 else()
-    if (FIPS_DYNAMIC_CRT OR FIPS_UWP)
-        set(FIPS_VS_CRT_FLAGS "/MD")
-    else()
-        set(FIPS_VS_CRT_FLAGS "/MT")
-    endif()
+    set(FIPS_VS_CRT_FLAGS "/MT")
 endif()

 set(CMAKE_CXX_FLAGS "${FIPS_VS_EXCEPTION_FLAGS} /MP /DWIN32")


patch from savannah 102896 (Christian), to mask the default -Wl,--as-needed with -Wl,--no-as-needed for the concerned gcc version (mainly Ubuntu 11.10 to 13.10 problem)

--- cmake/CMakelinuxx8664gcc.cmake
+++ cmake/CMakelinuxx8664gcc.cmake
@@ -68,6 +68,10 @@
   set(CXXFLAGS "${OPT} -fPIC -pipe -fmessage-length=0 -Dlinux")
   add_definitions(-Dlinux)
   set(CXXFLAGSNO "${NOOPT} -fPIC -pipe -fmessage-length=0")
+  if(CCMINORV STRGREATER 5 AND CCMINORV STRLESS 8)
+    message("-- 4.5 < GCC version < 4.8 - mask default -Wl,--as-needed")
+    set(XTRA_LDFLAGS "-Wl,--no-as-needed")
+  endif()

 else ()

@@ -119,8 +123,8 @@

 endif(${CMAKE_Fortran_COMPILER} MATCHES "g95")

-set(LDFLAGS "${OPT}")
-set(SOFLAGS "${OPT} -shared")
+set(LDFLAGS "${OPT} ${XTRA_LDFLAGS} ")
+set(SOFLAGS "${OPT}  ${XTRA_LDFLAGS} -shared")
 set(ALLIB)


Removes incorrect cmake mark_as_advanced usage.

--- cmake/Modules/FindLIBZIP.cmake
+++ cmake/Modules/FindLIBZIP.cmake
@@ -20,8 +20,6 @@
 # Once done this will define
 #  LIBZIP_FOUND - System has libffi
 #  libzip::libzip target (if found)
-
-mark_as_advanced(GNUTLS_INCLUDE_DIR GNUTLS_LIBRARY)

 find_library(LIBZIP_LIBRARY NAMES zip
         PATHS $ENV{LIBZIP_DIR} ${LIBZIP_DIR} /usr /usr/local /opt/local


Remove Sphinx CMake module

Remove Sphinx CMake module

--- cmake/Modules/FindSphinx.cmake
+++ cmake/Modules/FindSphinx.cmake
@@ -1,14 +0,0 @@
-find_program(SPHINX_EXECUTABLE NAMES sphinx-build
-    HINTS
-    $ENV{SPHINX_DIR}
-    PATH_SUFFIXES bin
-    DOC "Sphinx documentation generator"
-)
-
-include(FindPackageHandleStandardArgs)
-
-find_package_handle_standard_args(Sphinx DEFAULT_MSG
-    SPHINX_EXECUTABLE
-)
-
-mark_as_advanced(SPHINX_EXECUTABLE)


PythonApplyPatches: Ensure "git apply" works if source in already versioned tree

--- cmake/PythonApplyPatches.cmake
+++ cmake/PythonApplyPatches.cmake
@@ -8,6 +8,21 @@
   find_package(Git)
   if(Git_FOUND)
     set(PATCH_COMMAND ${GIT_EXECUTABLE} apply --whitespace=fix)
+    # Initialize Git repo to ensure "git apply" works when source tree
+    # is located within an already versioned tree.
+    if(NOT EXISTS "${SRC_DIR}/.git")
+      execute_process(
+        COMMAND git init
+        WORKING_DIRECTORY ${SRC_DIR}
+        RESULT_VARIABLE result
+        ERROR_VARIABLE error
+        ERROR_STRIP_TRAILING_WHITESPACE
+        OUTPUT_QUIET
+        )
+      if(NOT result EQUAL 0)
+        message(FATAL_ERROR "${output}\n${error}")
+      endif()
+    endif()
   else()
     find_package(Patch)
     if(Patch_FOUND)


Fix call to git apply

Fix call to git apply

It properly calls the apply command of Git now, instead of just starting Git with some parameters for applying. Still, it doesn't seem to be able to find the patch files.

--- cmake/modules/FindPython.cmake
+++ cmake/modules/FindPython.cmake
@@ -20,95 +20,95 @@
 			set(PATCH_SOURCE ${CMAKE_CURRENT_BINARY_DIR}/PythonMinGWPatches-prefix/src/PythonMinGWPatches)
 			set(PATCH_TARGET ${CMAKE_CURRENT_BINARY_DIR}/Python-prefix/src/Python)
 			set(PATCH_PYTHON_FOR_MINGW
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0000-make-_sysconfigdata.py-relocatable.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0001-fix-_nt_quote_args-using-subprocess-list2cmdline.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0100-MINGW-BASE-use-NT-thread-model.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0110-MINGW-translate-gcc-internal-defines-to-python-platf.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0130-MINGW-configure-MACHDEP-and-platform-for-build.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0140-MINGW-preset-configure-defaults.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0150-MINGW-configure-largefile-support-for-windows-builds.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0160-MINGW-add-wincrypt.h-in-Python-random.c.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0170-MINGW-add-srcdir-PC-to-CPPFLAGS.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0180-MINGW-init-system-calls.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0190-MINGW-detect-REPARSE_DATA_BUFFER.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0200-MINGW-build-in-windows-modules-winreg.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0210-MINGW-determine-if-pwdmodule-should-be-used.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0220-MINGW-default-sys.path-calculations-for-windows-plat.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0230-MINGW-AC_LIBOBJ-replacement-of-fileblocks.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0240-MINGW-use-main-to-start-execution.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0250-MINGW-compiler-customize-mingw-cygwin-compilers.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0260-MINGW-compiler-enable-new-dtags.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0270-CYGWIN-issue13756-Python-make-fail-on-cygwin.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0290-issue6672-v2-Add-Mingw-recognition-to-pyport.h-to-al.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0300-MINGW-configure-for-shared-build.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0310-MINGW-dynamic-loading-support.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0320-MINGW-implement-exec-prefix.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0330-MINGW-ignore-main-program-for-frozen-scripts.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0340-MINGW-setup-exclude-termios-module.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0350-MINGW-setup-_multiprocessing-module.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0360-MINGW-setup-select-module.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0370-MINGW-setup-_ctypes-module-with-system-libffi.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0380-MINGW-defect-winsock2-and-setup-_socket-module.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0390-MINGW-exclude-unix-only-modules.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0400-MINGW-setup-msvcrt-and-_winapi-modules.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0410-MINGW-build-extensions-with-GCC.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0420-MINGW-use-Mingw32CCompiler-as-default-compiler-for-m.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0430-MINGW-find-import-library.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0440-MINGW-setup-_ssl-module.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0460-MINGW-generalization-of-posix-build-in-sysconfig.py.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0462-MINGW-support-stdcall-without-underscore.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0464-use-replace-instead-rename-to-avoid-failure-on-windo.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0470-MINGW-avoid-circular-dependency-from-time-module-dur.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0480-MINGW-generalization-of-posix-build-in-distutils-sys.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0490-MINGW-customize-site.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0500-add-python-config-sh.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0510-cross-darwin-feature.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0520-py3k-mingw-ntthreads-vs-pthreads.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0530-mingw-system-libffi.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0540-mingw-semicolon-DELIM.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0550-mingw-regen-use-stddef_h.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0555-msys-mingw-prefer-unix-sep-if-MSYSTEM.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0560-mingw-use-posix-getpath.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0565-mingw-add-ModuleFileName-dir-to-PATH.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0570-mingw-add-BUILDIN_WIN32_MODULEs-time-msvcrt.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0590-mingw-INSTALL_SHARED-LDLIBRARY-LIBPL.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0610-msys-cygwin-semi-native-build-sysconfig.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0620-mingw-sysconfig-like-posix.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0630-mingw-_winapi_as_builtin_for_Popen_in_cygwinccompiler.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0640-mingw-x86_64-size_t-format-specifier-pid_t.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0650-cross-dont-add-multiarch-paths-if-cross-compiling.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0660-mingw-use-backslashes-in-compileall-py.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0670-msys-convert_path-fix-and-root-hack.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0690-allow-static-tcltk.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0700-CROSS-avoid-ncursesw-include-path-hack.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0710-CROSS-properly-detect-WINDOW-_flags-for-different-nc.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0720-mingw-pdcurses_ISPAD.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0730-mingw-fix-ncurses-module.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0740-grammar-fixes.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0750-builddir-fixes.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0760-msys-monkeypatch-os-system-via-sh-exe.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0770-msys-replace-slashes-used-in-io-redirection.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0790-mingw-add-_exec_prefix-for-tcltk-dlls.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0800-mingw-install-layout-as-posix.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0810-remove_path_max.default.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0820-dont-link-with-gettext.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0830-ctypes-python-dll.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0840-gdbm-module-includes.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0850-use-gnu_printf-in-format.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0860-fix-_Py_CheckPython3-prototype.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0870-mingw-fix-ssl-dont-use-enum_certificates.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0890-mingw-build-optimized-ext.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0900-cygwinccompiler-dont-strip-modules-if-pydebug.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0910-fix-using-dllhandle-and-winver-mingw.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0920-mingw-add-LIBPL-to-library-dirs.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0930-mingw-w64-build-overlapped-module.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0940-mingw-w64-Also-define-_Py_BEGIN_END_SUPPRESS_IPH-when-Py_BUILD_CORE_MODULE.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0950-mingw-w64-XP3-compat-GetProcAddress-GetTickCount64.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0960-mingw-w64-XP3-compat-GetProcAddress-GetFinalPathNameByHandleW.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0970-Add-AMD64-to-sys-config-so-msvccompiler-get_build_version-works.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0980-mingw-readline-features-skip.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/1010-install-msilib.patch.patch
-				COMMAND ${GIT_EXECUTABLE} --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/1500-mingw-w64-dont-look-in-DLLs-folder-for-python-dll.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0000-make-_sysconfigdata.py-relocatable.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0001-fix-_nt_quote_args-using-subprocess-list2cmdline.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0100-MINGW-BASE-use-NT-thread-model.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0110-MINGW-translate-gcc-internal-defines-to-python-platf.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0130-MINGW-configure-MACHDEP-and-platform-for-build.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0140-MINGW-preset-configure-defaults.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0150-MINGW-configure-largefile-support-for-windows-builds.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0160-MINGW-add-wincrypt.h-in-Python-random.c.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0170-MINGW-add-srcdir-PC-to-CPPFLAGS.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0180-MINGW-init-system-calls.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0190-MINGW-detect-REPARSE_DATA_BUFFER.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0200-MINGW-build-in-windows-modules-winreg.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0210-MINGW-determine-if-pwdmodule-should-be-used.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0220-MINGW-default-sys.path-calculations-for-windows-plat.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0230-MINGW-AC_LIBOBJ-replacement-of-fileblocks.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0240-MINGW-use-main-to-start-execution.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0250-MINGW-compiler-customize-mingw-cygwin-compilers.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0260-MINGW-compiler-enable-new-dtags.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0270-CYGWIN-issue13756-Python-make-fail-on-cygwin.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0290-issue6672-v2-Add-Mingw-recognition-to-pyport.h-to-al.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0300-MINGW-configure-for-shared-build.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0310-MINGW-dynamic-loading-support.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0320-MINGW-implement-exec-prefix.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0330-MINGW-ignore-main-program-for-frozen-scripts.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0340-MINGW-setup-exclude-termios-module.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0350-MINGW-setup-_multiprocessing-module.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0360-MINGW-setup-select-module.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0370-MINGW-setup-_ctypes-module-with-system-libffi.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0380-MINGW-defect-winsock2-and-setup-_socket-module.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0390-MINGW-exclude-unix-only-modules.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0400-MINGW-setup-msvcrt-and-_winapi-modules.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0410-MINGW-build-extensions-with-GCC.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0420-MINGW-use-Mingw32CCompiler-as-default-compiler-for-m.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0430-MINGW-find-import-library.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0440-MINGW-setup-_ssl-module.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0460-MINGW-generalization-of-posix-build-in-sysconfig.py.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0462-MINGW-support-stdcall-without-underscore.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0464-use-replace-instead-rename-to-avoid-failure-on-windo.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0470-MINGW-avoid-circular-dependency-from-time-module-dur.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0480-MINGW-generalization-of-posix-build-in-distutils-sys.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0490-MINGW-customize-site.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0500-add-python-config-sh.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0510-cross-darwin-feature.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0520-py3k-mingw-ntthreads-vs-pthreads.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0530-mingw-system-libffi.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0540-mingw-semicolon-DELIM.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0550-mingw-regen-use-stddef_h.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0555-msys-mingw-prefer-unix-sep-if-MSYSTEM.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0560-mingw-use-posix-getpath.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0565-mingw-add-ModuleFileName-dir-to-PATH.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0570-mingw-add-BUILDIN_WIN32_MODULEs-time-msvcrt.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0590-mingw-INSTALL_SHARED-LDLIBRARY-LIBPL.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0610-msys-cygwin-semi-native-build-sysconfig.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0620-mingw-sysconfig-like-posix.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0630-mingw-_winapi_as_builtin_for_Popen_in_cygwinccompiler.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0640-mingw-x86_64-size_t-format-specifier-pid_t.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0650-cross-dont-add-multiarch-paths-if-cross-compiling.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0660-mingw-use-backslashes-in-compileall-py.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0670-msys-convert_path-fix-and-root-hack.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0690-allow-static-tcltk.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0700-CROSS-avoid-ncursesw-include-path-hack.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0710-CROSS-properly-detect-WINDOW-_flags-for-different-nc.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0720-mingw-pdcurses_ISPAD.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0730-mingw-fix-ncurses-module.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0740-grammar-fixes.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0750-builddir-fixes.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0760-msys-monkeypatch-os-system-via-sh-exe.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0770-msys-replace-slashes-used-in-io-redirection.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0790-mingw-add-_exec_prefix-for-tcltk-dlls.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0800-mingw-install-layout-as-posix.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0810-remove_path_max.default.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0820-dont-link-with-gettext.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0830-ctypes-python-dll.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0840-gdbm-module-includes.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0850-use-gnu_printf-in-format.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0860-fix-_Py_CheckPython3-prototype.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0870-mingw-fix-ssl-dont-use-enum_certificates.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0890-mingw-build-optimized-ext.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0900-cygwinccompiler-dont-strip-modules-if-pydebug.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0910-fix-using-dllhandle-and-winver-mingw.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0920-mingw-add-LIBPL-to-library-dirs.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0930-mingw-w64-build-overlapped-module.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0940-mingw-w64-Also-define-_Py_BEGIN_END_SUPPRESS_IPH-when-Py_BUILD_CORE_MODULE.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0950-mingw-w64-XP3-compat-GetProcAddress-GetTickCount64.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0960-mingw-w64-XP3-compat-GetProcAddress-GetFinalPathNameByHandleW.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0970-Add-AMD64-to-sys-config-so-msvccompiler-get_build_version-works.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/0980-mingw-readline-features-skip.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/1010-install-msilib.patch.patch
+				COMMAND ${GIT_EXECUTABLE} apply --directory=${PATCH_TARGET} ${PATCH_SOURCE}/mingw-w64-python3/1500-mingw-w64-dont-look-in-DLLs-folder-for-python-dll.patch
 			)
 			ExternalProject_Add(Python
 				URL https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz


update

update

--- project/cmake/CompilerOption.cmake
+++ project/cmake/CompilerOption.cmake
@@ -23,6 +23,10 @@

     # 编译器选项 (仅做了GCC、VC和Clang兼容)
     if( ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
+            if(UNIX AND NOT CYGWIN)
+                add_definitions(-fPIC)
+            endif()
+
             add_definitions(-Wall -Werror -D_POSIX_MT_ -D_FILE_OFFSET_BITS=64)

         # gcc 4.9 编译输出颜色支持
@@ -44,6 +48,9 @@
             endif()

     elseif( ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
+            if(UNIX AND NOT CYGWIN)
+                add_definitions(-fPIC)
+            endif()
             add_definitions(-Wall -Werror -D_POSIX_MT_ -D_FILE_OFFSET_BITS=64)
             set(CXX_FLAGS_IN_ONE_COMMON "${C_FLAGS_IN_ONE_COMMON} -std=c++11")
             message(STATUS "CLang Version ${CMAKE_CXX_COMPILER_VERSION} , using -std=c++11.")


Mark more includes as system

Mark more includes as system

--- bpmodule/cmake/CoreModule.cmake
+++ bpmodule/cmake/CoreModule.cmake
@@ -73,7 +73,6 @@
       # Default flags for stuff
       list(APPEND ${MODULE_NAME}_CXX_FLAGS ${BPMODULE_CXX_STRICT_FLAGS})
       target_compile_options(${MODULE_NAME} PRIVATE ${${MODULE_NAME}_CXX_FLAGS})
-      #message(STATUS "${MODULE_NAME} cxx compile flags: ${${MODULE_NAME}_CXX_FLAGS}")

@@ -85,19 +84,18 @@
       # Passed in
       list(APPEND ${MODULE_NAME}_CXX_INCLUDES ${MODULE_CXX_INCLUDES})

-      # Main dependencies
-      list(APPEND ${MODULE_NAME}_CXX_INCLUDES ${Boost_INCLUDE_DIRS})
-      list(APPEND ${MODULE_NAME}_CXX_INCLUDES ${BPMODULE_CORE_PYTHON_INCLUDE_DIRS})
-      list(APPEND ${MODULE_NAME}_CXX_INCLUDES ${MPI_CXX_INCLUDE_PATH})
+      # Include them
       target_include_directories(${MODULE_NAME} PRIVATE ${${MODULE_NAME}_CXX_INCLUDES})

-      # External dependencies

-      target_include_directories(${MODULE_NAME} SYSTEM PRIVATE ${PYBIND11_INCLUDE_DIR})
-      target_include_directories(${MODULE_NAME} SYSTEM PRIVATE ${LIBELEMENTAL_INCLUDE_DIR})
-      target_include_directories(${MODULE_NAME} SYSTEM PRIVATE ${MADNESS_INCLUDE_DIRS})
-
-      #message(STATUS "${MODULE_NAME} cxx includes: ${${MODULE_NAME}_CXX_INCLUDES}")
+      # External dependencies (mark as system includes)
+      list(APPEND ${MODULE_NAME}_CXX_EXTERNAL_INCLUDES ${Boost_INCLUDE_DIRS})
+      list(APPEND ${MODULE_NAME}_CXX_EXTERNAL_INCLUDES ${BPMODULE_CORE_PYTHON_INCLUDE_DIRS})
+      list(APPEND ${MODULE_NAME}_CXX_EXTERNAL_INCLUDES ${MPI_CXX_INCLUDE_PATH})
+      list(APPEND ${MODULE_NAME}_CXX_EXTERNAL_INCLUDES ${PYBIND11_INCLUDE_DIR})
+      list(APPEND ${MODULE_NAME}_CXX_EXTERNAL_INCLUDES ${LIBELEMENTAL_INCLUDE_DIR})
+      list(APPEND ${MODULE_NAME}_CXX_EXTERNAL_INCLUDES ${MADNESS_INCLUDE_DIRS})
+      target_include_directories(${MODULE_NAME} SYSTEM PRIVATE ${${MODULE_NAME}_CXX_EXTERNAL_INCLUDES})

       #################
@@ -117,9 +115,6 @@

       target_link_libraries(${MODULE_NAME} ${${MODULE_NAME}_CXX_LINK_FLAGS})

-
-      #message(STATUS "${MODULE_NAME} cxx link flags: ${${MODULE_NAME}_CXX_LINK_FLAGS}")
-
   endif()

 endmacro()


Fixing configuration issues with the CMake files due to the reorganization of the ParaView plugins projects

--- Resources/CMake/ParaViewPluginIncludeMXADataModel.cmake
+++ Resources/CMake/ParaViewPluginIncludeMXADataModel.cmake
@@ -41,6 +41,7 @@

 #-- We need some more boost libraries?
 set (MXA_BOOST_HEADERS_ONLY 0)
+INCLUDE ("${MXADataModel_SOURCE_DIR}/Resources/CMake/LocateBoostSupportLibraries.cmake" )

 # --------------------------------------------------------------------
 #-- Build the MXADataModel library


Changed CMake for Clang

Changed CMake for Clang

from c++17 to c++14;
Added back (and changed) Ubuntu 14 compiler settings

--- tools/VoltDBCompilation.cmake
+++ tools/VoltDBCompilation.cmake
@@ -198,12 +198,19 @@
     MESSAGE("Using the Ubuntu 15.04 compiler settings for gcc ${CMAKE_CXX_COMPILER_VERSION}")
     VOLTDB_ADD_COMPILE_OPTIONS(-Wno-unused-but-set-variable -Wno-unused-local-typedefs -Wno-float-conversion -Wno-conversion)
     SET (CXX_VERSION_FLAG -std=c++11)
+  ELSEIF ( CMAKE_CXX_COMPILER_VERSION VERSION_GREATER VOLTDB_COMPILER_CXX0X)
+    # 4.6.0 < COMPILER_VERSION and COMPILER_VERSION <= 4.8.4
+    # Use -std=c++0x.  This is in GCC's experimental C++11 compiler
+    # support version, which is sufficient for our use.
+    MESSAGE("Using the Ubuntu 14.04 settings for ${CMAKE_CXX_COMPILER_VERSION}")
+    VOLTDB_ADD_COMPILE_OPTIONS(-Wno-unused-but-set-variable -Wno-unused-local-typedefs -Wno-float-conversion -Wno-conversion)
+    SET (CXX_VERSION_FLAG -std=c++11)
   ELSE()
     message(FATAL_ERROR "GNU Compiler version ${CMAKE_CXX_COMPILER_VERSION} is too old to build VoltdB.  Try at least ${VOLTDB_COMPILER_CXX0X}.")
   ENDIF()
 ELSEIF (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
   # All versions of clang use C++11.
-  SET (CXX_VERSION_FLAG -std=c++17)
+  SET (CXX_VERSION_FLAG -std=c++14)
   MESSAGE("CXX_VERSION_FLAG is ${CXX_VERSION_FLAG}")
   IF ( ( "3.4.0" VERSION_LESS CMAKE_CXX_COMPILER_VERSION )
        AND ( CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.0.0" ) )


fixed include search paths

fixed include search paths

--- tutorial/cmake/FindGLEW.cmake
+++ tutorial/cmake/FindGLEW.cmake
@@ -6,8 +6,10 @@
 #  GLEW_SOURCES - the GLEW source file list

 FIND_PATH(GLEW_INCLUDE_DIR GL/glew.h
-   ${PROJECT_SOURCE_DIR}/../../external/glew/include
-   ${PROJECT_SOURCE_DIR}/../external/glew/include
+   ${PROJECT_SOURCE_DIR}/../../../external/nanogui/ext/glew/include
+   ${PROJECT_SOURCE_DIR}/../../external/nanogui/ext/glew/include
+   ${PROJECT_SOURCE_DIR}/../external/nanogui/ext/glew/include
+   ${PROJECT_SOURCE_DIR}/external/nanogui/ext/glew/include
    ${PROJECT_SOURCE_DIR}/../../../libigl/external/nanogui/ext/glew/include
    ${PROJECT_SOURCE_DIR}/../../libigl/external/nanogui/ext/glew/include
    ${PROJECT_SOURCE_DIR}/../libigl/external/nanogui/ext/glew/include


Bring in the categorical data improvements

--- versions.cmake
+++ versions.cmake
@@ -92,7 +92,7 @@
   set(_paraview_revision "master")
 else()
   # Test the revision with OpenGL2 rendering before updating, update often!
-  set(_paraview_revision "1fd5d362094ec8a5ca6bbbff5508e9800bf2bb32")
+  set(_paraview_revision "77a1c7bc3a2619443c1fc947c8c89da189d05bf6")
 endif()
 add_revision(paraview
   GIT_REPOSITORY "https://gitlab.kitware.com/paraview/paraview.git"


Minor issue related to #100.

Minor issue related to #100.

--- cmake/common.cmake
+++ cmake/common.cmake
@@ -729,9 +729,12 @@
         ENDFOREACH()
     ENDIF()

-    # Package the plugin itself
-
-    INSTALL(FILES ${PLUGIN_BINARY_DIR}/${PLUGIN_FILENAME} DESTINATION plugins/${MAIN_PROJECT_NAME})
+    # Package the plugin itself, but only if we are not on Mac OS X since it
+    # will have already been copied
+
+    IF(NOT APPLE)
+        INSTALL(FILES ${PLUGIN_BINARY_DIR}/${PLUGIN_FILENAME} DESTINATION plugins/${MAIN_PROJECT_NAME})
+    ENDIF()
 ENDMACRO()

 MACRO(DEPLOY_MAC_OS_X_LIBRARY LIBRARY_NAME)


Minor cleaning up of our main CMake file.

--- cmake/common.cmake
+++ cmake/common.cmake
@@ -1,6 +1,16 @@
 MACRO(INITIALISE_PROJECT)
 #    SET(CMAKE_VERBOSE_MAKEFILE ON)
     SET(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+    # Check whether we are building in 32-bit or 64-bit
+
+    IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
+        SET(32BIT_MODE ON)
+    ELSEIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
+        SET(32BIT_MODE OFF)
+    ELSE()
+        MESSAGE(FATAL_ERROR "Sorry, but OpenCOR can only be built in 32-bit or 64-bit.")
+    ENDIF()

     # Some settings which depend on whether we want a debug or release version
     # of OpenCOR
@@ -82,14 +92,6 @@
     SET(QT_VERSION_MINOR 0)
     SET(QT_VERSION_PATCH 1)

-    # Whether we are building for 32-bit or 64-bit
-
-    IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
-        SET(64BIT_MODE ON)
-    ELSE()
-        SET(64BIT_MODE OFF)
-    ENDIF()
-
     # Default location of third-party libraries
     # Note: this is only required so that we can quickly test third-party
     #       libraries without first having to package everything...
@@ -115,10 +117,10 @@
     ELSEIF(APPLE)
         SET(DISTRIB_DIR osx)
     ELSE()
-        IF(64BIT_MODE)
+        IF(32BIT_MODE)
+            SET(DISTRIB_DIR linux/x86)
+        ELSE()
             SET(DISTRIB_DIR linux/x64)
-        ELSE()
-            SET(DISTRIB_DIR linux/x86)
         ENDIF()
     ENDIF()


Fix windows only define

Fix windows only define

--- ext/sodium.cmake
+++ ext/sodium.cmake
@@ -2,9 +2,12 @@

 add_definitions(
 	-DSODIUM_STATIC
-	-DSODIUM_EXPORT=
-	-D_CONSOLE
-	/wd4244)
+	-DSODIUM_EXPORT=)
+
+if (WIN32)
+	add_definitions(
+		/wd4244)
+endif(WIN32)

 include_directories(
 	libsodium_override/


[ci] non-parallel build: set NP as well

[ci] non-parallel build: set NP as well

--- ci_gitlab/ctest_common.cmake
+++ ci_gitlab/ctest_common.cmake
@@ -31,14 +31,13 @@
 #include(cmake_host_system_information)
 cmake_host_system_information(RESULT hostname QUERY HOSTNAME)
 cmake_host_system_information(RESULT fqdn QUERY FQDN)
+cmake_host_system_information(RESULT NP QUERY NUMBER_OF_LOGICAL_CORES)

 set(ALLOW_PARALLEL_BUILD 1 CACHE BOOL "Allow parallel build")
-if(ALLOW_PARALLEL_BUILD)
-  cmake_host_system_information(RESULT NP QUERY NUMBER_OF_LOGICAL_CORES)
-  set(CTEST_BUILD_FLAGS -j${NP})
-else()
-  set(CTEST_BUILD_FLAGS -j1)
+if(NOT ALLOW_PARALLEL_BUILD)
+  set(NP 1)
 endif()
+set(CTEST_BUILD_FLAGS -j${NP})

 if(${CMAKE_VERSION} VERSION_GREATER "3.10.3")
   cmake_host_system_information(RESULT osname QUERY OS_NAME)


Exclude .ilk files from install

Exclude .ilk files from install

.ilk files are temporary linking files used only when building. We don't
need to install those.

--- cmake/EthExecutableHelper.cmake
+++ cmake/EthExecutableHelper.cmake
@@ -129,18 +129,21 @@

 		install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Debug"
 			DESTINATION .
+			PATTERN "*.ilk" EXCLUDE
 			CONFIGURATIONS Debug
 			COMPONENT ${EXECUTABLE}
 		)

 		install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Release"
 			DESTINATION .
+			PATTERN "*.ilk" EXCLUDE
 			CONFIGURATIONS Release
 			COMPONENT ${EXECUTABLE}
 		)

 		install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/"
 			DESTINATION bin
+			PATTERN "*.ilk" EXCLUDE
 			CONFIGURATIONS RelWithDebInfo
 			COMPONENT ${EXECUTABLE}
 		)


Find Haskell: Do not use nested `if`-statements

--- cmake/Modules/FindHaskell.cmake
+++ cmake/Modules/FindHaskell.cmake
@@ -31,119 +31,6 @@
 find_program (GHC-PKG_EXECUTABLE ghc-pkg)

 set (HASKELL_FOUND 0)
-if (CABAL_EXECUTABLE)
-if (C2HS_EXECUTABLE)
-if (ALEX_EXECUTABLE)
-if (HAPPY_EXECUTABLE)
-if (GHC_EXECUTABLE)
-if (GHC-PKG_EXECUTABLE)
-
-	# check for hspec and QuickCheck
-	# ghc-pkg return code is 0 on success, 1 otherwise
-	execute_process (
-		COMMAND ${GHC-PKG_EXECUTABLE} latest hspec
-		RESULT_VARIABLE GHC_HSPEC_FOUND
-		OUTPUT_QUIET ERROR_QUIET
-	)
-
-	execute_process (
-		COMMAND ${GHC-PKG_EXECUTABLE} latest QuickCheck
-		RESULT_VARIABLE GHC_QUICKCHECK_FOUND
-		OUTPUT_QUIET ERROR_QUIET
-	)
-
-	execute_process (
-		COMMAND ${GHC_EXECUTABLE} --print-target-platform
-		OUTPUT_VARIABLE GHC_TARGET_PLATFORM OUTPUT_STRIP_TRAILING_WHITESPACE
-	)
-
-	# correct the mapping..
-	string (REPLACE "apple-darwin" "osx" GHC_TARGET_PLATFORM ${GHC_TARGET_PLATFORM})
-	string (REPLACE "unknown-linux" "linux" GHC_TARGET_PLATFORM ${GHC_TARGET_PLATFORM})
-
-	# normalize the result variables, 0 means success which corresponds to 1 in cmake booleans
-	if (GHC_HSPEC_FOUND EQUAL 0)
-		set (GHC_HSPEC_FOUND 1)
-	else (GHC_HSPEC_FOUND EQUAL 0)
-		set (GHC_HSPEC_FOUND 0)
-	endif (GHC_HSPEC_FOUND EQUAL 0)
-
-	if (GHC_QUICKCHECK_FOUND EQUAL 0)
-		set (GHC_QUICKCHECK_FOUND 1)
-	else (GHC_QUICKCHECK_FOUND EQUAL 0)
-		set (GHC_QUICKCHECK_FOUND 0)
-	endif (GHC_QUICKCHECK_FOUND EQUAL 0)
-
-	execute_process (
-		COMMAND ${GHC_EXECUTABLE} --numeric-version
-		OUTPUT_VARIABLE GHC_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE
-	)
-
-	# find the default cabal installation path
-	# sort of hacky but i haven't found a uniform way of doing this
-	# first find the global cabal directory
-	execute_process (
-		COMMAND ${CABAL_EXECUTABLE} --ignore-sandbox help
-		COMMAND tail -n1
-		COMMAND xargs dirname
-		OUTPUT_VARIABLE CABAL_LOCATION OUTPUT_STRIP_TRAILING_WHITESPACE
-	)
-	# filter the library path matching our ghc version, ignoring architectures for now
-	execute_process (
-		COMMAND ls -F "${CABAL_LOCATION}/lib"
-		COMMAND grep ghc-${GHC_VERSION}
-		OUTPUT_VARIABLE GHC_DYNAMIC_LIBRARY_DIR OUTPUT_STRIP_TRAILING_WHITESPACE
-	)
-	set (CABAL_DYNLIB_PATH "${CABAL_LOCATION}/lib/${GHC_DYNAMIC_LIBRARY_DIR}")
-
-	# dependencies for the default cmake Setup.hs
-	# For cabal the system version should be used
-	set (CABAL_CUSTOM_SETUP
-"custom-setup
-  setup-depends:
-    Cabal      >= 1.24.0 && < 2.4  ,
-    base       >= 4.9    && < 4.12 ,
-    containers >= 0.5    && < 0.6  ,
-    directory  >= 1.2    && < 1.4  ,
-    process    >= 1.4    && < 1.7  ,
-    binary     >= 0.8    && < 0.9" )
-
-	set (HASKELL_SHARED_SANDBOX "$ENV{HASKELL_SHARED_SANDBOX}/.cabal-sandbox")
-	get_filename_component (HASKELL_SHARED_SANDBOX "${HASKELL_SHARED_SANDBOX}" REALPATH)
-    if (HASKELL_SHARED_SANDBOX AND IS_DIRECTORY "${HASKELL_SHARED_SANDBOX}")
-		set (HASKELL_FOUND 1)
-    else (HASKELL_SHARED_SANDBOX AND IS_DIRECTORY "${HASKELL_SHARED_SANDBOX}")
-    	if (IS_DIRECTORY "${CMAKE_BINARY_DIR}/.cabal-sandbox")
-    		set (HASKELL_SHARED_SANDBOX "${CMAKE_BINARY_DIR}/.cabal-sandbox")
-			set (HASKELL_FOUND 1)
-    	else (IS_DIRECTORY "${CMAKE_BINARY_DIR}/.cabal-sandbox")
-    		set (HASKELL_NOTFOUND_INFO "cabal sandbox not found")
-    	endif (IS_DIRECTORY "${CMAKE_BINARY_DIR}/.cabal-sandbox")
-    endif (HASKELL_SHARED_SANDBOX AND IS_DIRECTORY "${HASKELL_SHARED_SANDBOX}")
-
-	# By using cabal sandboxes we can install hspec and QuickCheck to the sandbox without
-	# any concerns as they are independent from the global environment. So they are not required.
-	# All set, have fun with haskell!
-else (GHC-PKG_EXECUTABLE)
-	set (HASKELL_NOTFOUND_INFO "ghc-pkg not found")
-endif (GHC-PKG_EXECUTABLE)
-else (GHC_EXECUTABLE)
-	set (HASKELL_NOTFOUND_INFO "GHC not found")
-endif (GHC_EXECUTABLE)
-else (HAPPY_EXECUTABLE)
-	set (HASKELL_NOTFOUND_INFO "happy not found")
-endif (HAPPY_EXECUTABLE)
-else (ALEX_EXECUTABLE)
-	set (HASKELL_NOTFOUND_INFO "alex not found")
-endif (ALEX_EXECUTABLE)
-else (C2HS_EXECUTABLE)
-	set (HASKELL_NOTFOUND_INFO "c2hs not found")
-endif (C2HS_EXECUTABLE)
-else (CABAL_EXECUTABLE)
-	set (HASKELL_NOTFOUND_INFO "cabal not found")
-endif (CABAL_EXECUTABLE)
-
-set (HASKELL_NOTFOUND_INFO "${HASKELL_NOTFOUND_INFO}, please refer to the readme in src/bindings/haskell/README.md")

 mark_as_advanced (
 	GHC_EXECUTABLE
@@ -159,3 +46,119 @@
 	GHC_QUICKCHECK_FOUND
 	GHC_TARGET_PLATFORM
 )
+
+if (NOT GHC_EXECUTABLE)
+	set (HASKELL_NOTFOUND_INFO "GHC not found")
+endif (NOT GHC_EXECUTABLE)
+
+if (NOT CABAL_EXECUTABLE)
+	set (HASKELL_NOTFOUND_INFO "cabal not found")
+endif (NOT CABAL_EXECUTABLE)
+
+if (NOT ALEX_EXECUTABLE)
+	set (HASKELL_NOTFOUND_INFO "alex not found")
+endif (NOT ALEX_EXECUTABLE)
+
+if (NOT HAPPY_EXECUTABLE)
+	set (HASKELL_NOTFOUND_INFO "happy not found")
+endif (NOT HAPPY_EXECUTABLE)
+
+if (NOT C2HS_EXECUTABLE)
+	set (HASKELL_NOTFOUND_INFO "c2hs not found")
+endif (NOT C2HS_EXECUTABLE)
+
+if (NOT GHC-PKG_EXECUTABLE)
+	set (HASKELL_NOTFOUND_INFO "ghc-pkg not found")
+endif (NOT GHC-PKG_EXECUTABLE)
+
+if (HASKELL_NOTFOUND_INFO)
+	set (HASKELL_NOTFOUND_INFO "${HASKELL_NOTFOUND_INFO}, please refer to the readme in src/bindings/haskell/README.md")
+	return ()
+endif (HASKELL_NOTFOUND_INFO)
+
+# check for hspec and QuickCheck
+# ghc-pkg return code is 0 on success, 1 otherwise
+execute_process (
+	COMMAND ${GHC-PKG_EXECUTABLE} latest hspec
+	RESULT_VARIABLE GHC_HSPEC_FOUND
+	OUTPUT_QUIET ERROR_QUIET
+)
+
+execute_process (
+	COMMAND ${GHC-PKG_EXECUTABLE} latest QuickCheck
+	RESULT_VARIABLE GHC_QUICKCHECK_FOUND
+	OUTPUT_QUIET ERROR_QUIET
+)
+
+execute_process (
+	COMMAND ${GHC_EXECUTABLE} --print-target-platform
+	OUTPUT_VARIABLE GHC_TARGET_PLATFORM OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+
+# correct the mapping..
+string (REPLACE "apple-darwin" "osx" GHC_TARGET_PLATFORM ${GHC_TARGET_PLATFORM})
+string (REPLACE "unknown-linux" "linux" GHC_TARGET_PLATFORM ${GHC_TARGET_PLATFORM})
+
+# normalize the result variables, 0 means success which corresponds to 1 in cmake booleans
+if (GHC_HSPEC_FOUND EQUAL 0)
+	set (GHC_HSPEC_FOUND 1)
+else (GHC_HSPEC_FOUND EQUAL 0)
+	set (GHC_HSPEC_FOUND 0)
+endif (GHC_HSPEC_FOUND EQUAL 0)
+
+if (GHC_QUICKCHECK_FOUND EQUAL 0)
+	set (GHC_QUICKCHECK_FOUND 1)
+else (GHC_QUICKCHECK_FOUND EQUAL 0)
+	set (GHC_QUICKCHECK_FOUND 0)
+endif (GHC_QUICKCHECK_FOUND EQUAL 0)
+
+execute_process (
+	COMMAND ${GHC_EXECUTABLE} --numeric-version
+	OUTPUT_VARIABLE GHC_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+
+# find the default cabal installation path
+# sort of hacky but i haven't found a uniform way of doing this
+# first find the global cabal directory
+execute_process (
+	COMMAND ${CABAL_EXECUTABLE} --ignore-sandbox help
+	COMMAND tail -n1
+	COMMAND xargs dirname
+	OUTPUT_VARIABLE CABAL_LOCATION OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+# filter the library path matching our ghc version, ignoring architectures for now
+execute_process (
+	COMMAND ls -F "${CABAL_LOCATION}/lib"
+	COMMAND grep ghc-${GHC_VERSION}
+	OUTPUT_VARIABLE GHC_DYNAMIC_LIBRARY_DIR OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+set (CABAL_DYNLIB_PATH "${CABAL_LOCATION}/lib/${GHC_DYNAMIC_LIBRARY_DIR}")
+
+# dependencies for the default cmake Setup.hs
+# For cabal the system version should be used
+set (CABAL_CUSTOM_SETUP
+"custom-setup
+  setup-depends:
+    Cabal      >= 1.24.0 && < 2.4  ,
+    base       >= 4.9    && < 4.12 ,
+    containers >= 0.5    && < 0.6  ,
+    directory  >= 1.2    && < 1.4  ,
+    process    >= 1.4    && < 1.7  ,
+    binary     >= 0.8    && < 0.9" )
+
+set (HASKELL_SHARED_SANDBOX "$ENV{HASKELL_SHARED_SANDBOX}/.cabal-sandbox")
+get_filename_component (HASKELL_SHARED_SANDBOX "${HASKELL_SHARED_SANDBOX}" REALPATH)
+if (HASKELL_SHARED_SANDBOX AND IS_DIRECTORY "${HASKELL_SHARED_SANDBOX}")
+	set (HASKELL_FOUND 1)
+else (HASKELL_SHARED_SANDBOX AND IS_DIRECTORY "${HASKELL_SHARED_SANDBOX}")
+if (IS_DIRECTORY "${CMAKE_BINARY_DIR}/.cabal-sandbox")
+	set (HASKELL_SHARED_SANDBOX "${CMAKE_BINARY_DIR}/.cabal-sandbox")
+		set (HASKELL_FOUND 1)
+else (IS_DIRECTORY "${CMAKE_BINARY_DIR}/.cabal-sandbox")
+	set (HASKELL_NOTFOUND_INFO "cabal sandbox not found")
+endif (IS_DIRECTORY "${CMAKE_BINARY_DIR}/.cabal-sandbox")
+endif (HASKELL_SHARED_SANDBOX AND IS_DIRECTORY "${HASKELL_SHARED_SANDBOX}")
+
+# By using cabal sandboxes we can install hspec and QuickCheck to the sandbox without
+# any concerns as they are independent from the global environment. So they are not required.
+# All set, have fun with haskell!


Added STATIC keyword for package dependeny

--- cmake/MyPackageDependency.cmake
+++ cmake/MyPackageDependency.cmake
@@ -1,6 +1,6 @@
 MACRO (MYPACKAGEDEPENDENCY packageDepend packageDependSourceDir)
   #
-  # Optional argument: TESTS, LIBS, EXES, SYSTEM, LOCAL
+  # Optional argument: TESTS, LIBS, EXES, SYSTEM, LOCAL (forces ALL_IN_ONE for this dependency), STATIC
   #
   IF (ALL_IN_ONE)
     SET (_ALL_IN_ONE TRUE)
@@ -11,6 +11,7 @@
   SET (_TESTS FALSE)
   SET (_LIBS FALSE)
   SET (_EXES FALSE)
+  SET (_STATIC FALSE)
   FOREACH (_var ${ARGN})
     IF (${_var} STREQUAL TESTS)
       IF (MYPACKAGE_DEBUG)
@@ -45,6 +46,12 @@
         MESSAGE (STATUS "[${PROJECT_NAME}-DEPEND-DEBUG] ${packageDepend} local mode")
       ENDIF ()
       SET (_ALL_IN_ONE TRUE)
+    ENDIF ()
+    IF (${_var} STREQUAL STATIC)
+      IF (MYPACKAGE_DEBUG)
+        MESSAGE (STATUS "[${PROJECT_NAME}-DEPEND-DEBUG] ${packageDepend} static mode")
+      ENDIF ()
+      SET (_STATIC TRUE)
     ENDIF ()
   ENDFOREACH ()
   IF (_ALL)
@@ -148,15 +155,30 @@
       MESSAGE (STATUS "[${PROJECT_NAME}-DEPEND-DEBUG] Inspecting target candidate ${_target}")
     ENDIF ()
     IF (TARGET ${_target})
+      #
+      # Static mode ?
+      #
+      IF (_STATIC)
+        IF (MYPACKAGE_DEBUG)
+          MESSAGE (STATUS "[${PROJECT_NAME}-DEPEND-DEBUG] Adding -D${packageDepend}_static compile definition to target ${_target}")
+        ENDIF ()
+        TARGET_COMPILE_DEFINITIONS(${_target} PUBLIC -D${packageDepend}_static)
+        IF (MYPACKAGE_DEBUG)
+          MESSAGE (STATUS "[${PROJECT_NAME}-DEPEND-DEBUG] ${packageDepend} dependency becomes ${packageDepend}_static for target ${_target}")
+        ENDIF ()
+        SET (realPackageDepend ${packageDepend}_static)
+      ELSE ()
+        SET (realPackageDepend ${packageDepend})
+      ENDIF ()
       IF (_ALL_IN_ONE)
         #
         # Dependency by target
         #
-        IF (TARGET ${packageDepend})
-          IF (MYPACKAGE_DEBUG)
-            MESSAGE (STATUS "[${PROJECT_NAME}-DEPEND-DEBUG] Adding target ${packageDepend} dependency to target ${_target}")
-          ENDIF ()
-          TARGET_LINK_LIBRARIES(${_target} PUBLIC ${packageDepend})
+        IF (TARGET ${realPackageDepend})
+          IF (MYPACKAGE_DEBUG)
+            MESSAGE (STATUS "[${PROJECT_NAME}-DEPEND-DEBUG] Adding target ${realPackageDepend} dependency to target ${_target}")
+          ENDIF ()
+          TARGET_LINK_LIBRARIES(${_target} PUBLIC ${realPackageDepend})
           IF (_TESTS)
             #
             # A bit painful but the target locations are not known at this time.
@@ -164,17 +186,17 @@
             #
             GET_PROPERTY(_targets_for_test_set GLOBAL PROPERTY MYPACKAGE_DEPENDENCY_${PROJECT_NAME}_TARGETS_FOR_TEST)
             IF (NOT _targets_for_test_set)
-              SET (_targets_for_test ${packageDepend})
+              SET (_targets_for_test ${realPackageDepend})
               IF (MYPACKAGE_DEBUG)
-                MESSAGE (STATUS "[${PROJECT_NAME}-DEPEND-STATUS] Initialized MYPACKAGE_DEPENDENCY_${PROJECT_NAME}_TARGETS_FOR_TEST with ${packageDepend}")
+                MESSAGE (STATUS "[${PROJECT_NAME}-DEPEND-STATUS] Initialized MYPACKAGE_DEPENDENCY_${PROJECT_NAME}_TARGETS_FOR_TEST with ${realPackageDepend}")
               ENDIF ()
               SET_PROPERTY(GLOBAL PROPERTY MYPACKAGE_DEPENDENCY_${PROJECT_NAME}_TARGETS_FOR_TEST ${_targets_for_test})
             ELSE ()
-              LIST (FIND _targets_for_test ${packageDepend} _targets_for_test_found)
+              LIST (FIND _targets_for_test ${realPackageDepend} _targets_for_test_found)
               IF (${_targets_for_test_found} EQUAL -1)
-                LIST (APPEND _targets_for_test ${packageDepend})
+                LIST (APPEND _targets_for_test ${realPackageDepend})
                 IF (MYPACKAGE_DEBUG)
-                  MESSAGE (STATUS "[${PROJECT_NAME}-DEPEND-STATUS] Appended MYPACKAGE_DEPENDENCY_${PROJECT_NAME}_TARGETS_FOR_TEST with ${packageDepend}")
+                  MESSAGE (STATUS "[${PROJECT_NAME}-DEPEND-STATUS] Appended MYPACKAGE_DEPENDENCY_${PROJECT_NAME}_TARGETS_FOR_TEST with ${realPackageDepend}")
                 ENDIF ()
                 SET_PROPERTY(GLOBAL PROPERTY MYPACKAGE_DEPENDENCY_${PROJECT_NAME}_TARGETS_FOR_TEST ${_targets_for_test})
               ENDIF ()


Revert "Update Build-mysql.cmake"

Revert "Update Build-mysql.cmake"

This reverts commit c7e471b113cb340997a00943620d9188935c15f7.

--- cmake/modules/Build-mysql.cmake
+++ cmake/modules/Build-mysql.cmake
@@ -8,25 +8,14 @@
   ${MYSQL_INSTALL_DIR}/lib/libmysqlclient.a
 )

-if(WIN32)
-  ExternalProject_Add(
-    mysql
-    URL https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.17.zip
-    URL_HASH MD5=12ffebf5a1a2b2047c6044b9b0e5860b
-    CMAKE_ARGS -G${CMAKE_GENERATOR} -DCMAKE_INSTALL_PREFIX=${MYSQL_INSTALL_DIR} -DDOWNLOAD_BOOST=1 -DWITH_BOOST=<SOURCE_DIR>/boost -DWITHOUT_SERVER=ON -DWITH_UNIT_TESTS=OFF
-    BUILD_BYPRODUCTS ${_byproducts}
-    INSTALL_DIR ${MYSQL_INSTALL_DIR}
-  )
-else()
-  ExternalProject_Add(
-    mysql
-    URL https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-boost-8.0.17.tar.gz
-    URL_HASH MD5=82ba7cc22755f77635768c6e6d184161
-    CMAKE_ARGS -G${CMAKE_GENERATOR} -DCMAKE_INSTALL_PREFIX=${MYSQL_INSTALL_DIR} -DWITHOUT_SERVER=ON -DWITH_UNIT_TESTS=OFF -DWITH_BOOST=<SOURCE_DIR>/boost/boost_1_69_0
-    BUILD_BYPRODUCTS ${_byproducts}
-    INSTALL_DIR ${MYSQL_INSTALL_DIR}
-  )
-endif()
+ExternalProject_Add(
+  mysql
+  URL https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-boost-8.0.12.tar.gz
+  URL_HASH MD5=82ba7cc22755f77635768c6e6d184161
+  CMAKE_ARGS -G${CMAKE_GENERATOR} -DCMAKE_INSTALL_PREFIX=${MYSQL_INSTALL_DIR} -DWITHOUT_SERVER=ON -DWITH_UNIT_TESTS=OFF -DWITH_BOOST=<SOURCE_DIR>/boost/boost_1_67_0
+  BUILD_BYPRODUCTS ${_byproducts}
+  INSTALL_DIR ${MYSQL_INSTALL_DIR}
+)
 ExternalProject_Get_Property(
   mysql
   install_dir
@@ -35,8 +24,8 @@
 set(MYSQL_INCLUDE_DIR "${install_dir}/include")
 if(WIN32)
   set(MYSQL_LIBRARY_DIR "${install_dir}/lib")
-  set(MYSQL_LIBRARY "${install_dir}/lib/mysqlclient.lib")
-  set(MYSQL_LIBRARIES "${install_dir}/lib/mysqlclient.lib" "${MYSQL_LIBRARIES}")
+  set(MYSQL_LIBRARY "${install_dir}/lib/libmysqlclient.lib")
+  set(MYSQL_LIBRARIES "${install_dir}/lib/libmysqlclient.lib" "${MYSQL_LIBRARIES}")
 else()
   set(MYSQL_LIBRARY_DIR "${install_dir}/lib")
   set(MYSQL_LIBRARY "${install_dir}/lib/libmysqlclient.a")
@@ -49,4 +38,4 @@
   set_target_properties(mysql::mysql PROPERTIES INTERFACE_LINK_LIBRARIES "${MYSQL_LIBRARIES}")
 endif()

-mark_as_advanced( MYSQL_INCLUDE_DIR MYSQL_LIBRARIES MYSQL_LIBRARY )
+mark_as_advanced( MYSQL_INCLUDE_DIR MYSQL_LIBRARIES MYSQL_LIBRARY )


CMake: Fixed sed script for translating library dependencies from
LibDeps.txt format to LLVMLibDeps.cmake format.

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

--- cmake/modules/LLVMLibDeps.cmake
+++ cmake/modules/LLVMLibDeps.cmake
@@ -12,7 +12,7 @@
 # It is necessary to remove the `lib' prefix and the `.a'.

 # This 'sed' script should do the trick:
-# sed -e s'#\.a##g' -e 's#libLLVM#LLVM#g' -e 's#: ##' -e 's#\(.*\)#set(MSVC_LIB_DEPS_\1)#' ~/llvm/tools/llvm-config/LibDeps.txt
+# sed -e s'#\.a##g' -e 's#libLLVM#LLVM#g' -e 's#: # #' -e 's#\(.*\)#set(MSVC_LIB_DEPS_\1)#' ~/llvm/tools/llvm-config/LibDeps.txt
 #

 # TODO: do this transformations on cmake.


Add Itcl and Itk header consistency checks using the version numbers in the
itcl.h and itk.h headers that are found.

svn path=/trunk/; revision=12674

--- cmake/modules/tcl-related.cmake
+++ cmake/modules/tcl-related.cmake
@@ -22,17 +22,17 @@

 if(DEFAULT_NO_BINDINGS)
   option(ENABLE_tcl "Enable Tcl bindings" OFF)
-  option(ENABLE_itcl "Enable incr Tcl interface code" OFF)
+  option(ENABLE_itcl "Enable Itcl interface code" OFF)
   option(ENABLE_tk "Enable Tk interface code" OFF)
-  option(ENABLE_itk "Enable incr Tk interface code" OFF)
+  option(ENABLE_itk "Enable Itk interface code" OFF)
 else(DEFAULT_NO_BINDINGS)
   option(ENABLE_tcl "Enable Tcl bindings" ON)
-  option(ENABLE_itcl "Enable incr Tcl interface code" ON)
+  option(ENABLE_itcl "Enable Itcl interface code" ON)
   option(ENABLE_tk "Enable Tk interface code" ON)
-  option(ENABLE_itk "Enable incr Tk interface code" ON)
+  option(ENABLE_itk "Enable Itk interface code" ON)
 endif(DEFAULT_NO_BINDINGS)

-option(USE_INCRTCL_VERSION_4 "Use [incr Tcl] version 4" OFF)
+option(USE_INCRTCL_VERSION_4 "Use version 4 of Itcl and Itcl, version 4.1 of Iwidgets" OFF)

 # Depending on these above options and system resources may also determine
 # the following variables which are largely self-explanatory unless documented
@@ -57,7 +57,7 @@
 #			 Used for source file configuration.)

 if(ENABLE_tcl)
-  message(STATUS "Use system introspection to determine data for Tcl and friends")
+  message(STATUS "Start determining consistent system data for Tcl and friends")
   find_package(TCL QUIET)
   if(TCL_FOUND)
     message(STATUS "Looking for include paths and libraries for Tcl - found")
@@ -101,9 +101,45 @@
           find_path(ITCL_INCLUDE_PATH itcl.h HINTS ${TCL_INCLUDE_PATH}/itcl${ITCL_VERSION})
 	endif(NOT USE_INCRTCL_VERSION_4)
         find_path(ITCL_INCLUDE_PATH itcl.h HINTS ${TCL_INCLUDE_PATH})
+
         if(ITCL_INCLUDE_PATH)
           message(STATUS "Looking for itcl.h - found")
 	  message(STATUS "ITCL_INCLUDE_PATH = ${ITCL_INCLUDE_PATH}")
+
+	  message(STATUS "Checking for Itcl header version consistency")
+	  string(REGEX REPLACE "^([0-9]*)\\.[0-9]*.*$" "\\1" ITCL_MAJOR_VERSION  "${ITCL_VERSION}")
+	  string(REGEX REPLACE "^[0-9]*\\.([0-9]*).*$" "\\1" ITCL_MINOR_VERSION  "${ITCL_VERSION}")
+	  message(STATUS "ITCL_MAJOR_VERSION = ${ITCL_MAJOR_VERSION}")
+	  message(STATUS "ITCL_MINOR_VERSION = ${ITCL_MINOR_VERSION}")
+	  file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/CheckITCL_VERSION.c
+	    "// #define RC_INVOKED to avoid sucking in lots of additional includes for
+// efficiency and simplicity.
+#define RC_INVOKED 1
+#include <itcl.h>
+#if ITCL_MAJOR_VERSION != ${ITCL_MAJOR_VERSION} || ITCL_MINOR_VERSION != ${ITCL_MINOR_VERSION}
+  #error ITCL_VERSION mismatch
+#endif
+void main(void){}
+"
+	    )
+	  try_compile(CONSISTENT_HEADER_ITCL_VERSION ${CMAKE_BINARY_DIR}
+	    ${CMAKE_CURRENT_BINARY_DIR}/CheckITCL_VERSION.c
+	    CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${ITCL_INCLUDE_PATH};${TCL_INCLUDE_PATH}"
+	    )
+	  if(CONSISTENT_HEADER_ITCL_VERSION)
+	    message(STATUS "Checking for Itcl header version consistency - true")
+	  else(CONSISTENT_HEADER_ITCL_VERSION)
+	    message(STATUS "Checking for Itcl header version consistency - false")
+            message(STATUS "WARNING: Disabling Itcl interface code")
+	    set(ENABLE_itcl OFF CACHE BOOL "Enable Itcl interface code" FORCE)
+	  endif(CONSISTENT_HEADER_ITCL_VERSION)
+        else(ITCL_INCLUDE_PATH)
+          message(STATUS "Looking for itcl.h - not found")
+          message(STATUS "WARNING: Disabling Itcl interface code")
+          set(ENABLE_itcl OFF CACHE BOOL "Enable Itcl interface code" FORCE)
+        endif(ITCL_INCLUDE_PATH)
+
+        if(ENABLE_itcl)
           message(STATUS "Looking for itcl library")
 	  # Search first for epa_build install location.
           find_library(ITCL_LIBRARY itcl${ITCL_VERSION} HINTS ${TCL_LIBRARY_PATH}/itcl${ITCL_VERSION})
@@ -115,18 +151,14 @@
             find_path(HAVE_ITCLDECLS_H itclDecls.h HINTS ${ITCL_INCLUDE_PATH})
           else(ITCL_LIBRARY)
             message(STATUS "Looking for itcl library - not found")
-            message(STATUS "WARNING: Disabling incr Tcl interface code")
-            set(ENABLE_itcl OFF CACHE BOOL "Enable incr Tcl interface code" FORCE)
+            message(STATUS "WARNING: Disabling Itcl interface code")
+            set(ENABLE_itcl OFF CACHE BOOL "Enable Itcl interface code" FORCE)
           endif(ITCL_LIBRARY)
-        else(ITCL_INCLUDE_PATH)
-          message(STATUS "Looking for itcl.h - not found")
-          message(STATUS "WARNING: Disabling incr Tcl interface code")
-          set(ENABLE_itcl OFF CACHE BOOL "Enable incr Tcl interface code" FORCE)
-        endif(ITCL_INCLUDE_PATH)
+        endif(ENABLE_itcl)
       else(NOT ITCL_RC)
         message(STATUS "Itcl not available or not compatible with current Tcl shell")
-        message(STATUS "WARNING: Disabling incr Tcl interface code")
-        set(ENABLE_itcl OFF CACHE BOOL "Enable incr Tcl interface code" FORCE)
+        message(STATUS "WARNING: Disabling Itcl interface code")
+        set(ENABLE_itcl OFF CACHE BOOL "Enable Itcl interface code" FORCE)
       endif(NOT ITCL_RC)
     endif(ENABLE_itcl)

@@ -162,8 +194,8 @@
 	message(STATUS "WARNING: the Tcl and Tk library locations are inconsistent so those libraries are likely not compatible")
       endif(NOT ${TK_LIBRARY_PATH} STREQUAL ${TCL_LIBRARY_PATH})
     else(ENABLE_tk)
-      message(STATUS "WARNING: Because Tk is disabled must disable incr Tk as well")
-      set(ENABLE_itk OFF CACHE BOOL "Enable incr Tk interface code" FORCE)
+      message(STATUS "WARNING: Because Tk is disabled must disable Itk as well")
+      set(ENABLE_itk OFF CACHE BOOL "Enable Itk interface code" FORCE)
     endif(ENABLE_tk)

     if(ENABLE_itk)
@@ -190,10 +222,46 @@
           find_path(ITK_INCLUDE_PATH itk.h HINTS ${TCL_INCLUDE_PATH}/itcl${ITCL_VERSION})
 	endif(NOT USE_INCRTCL_VERSION_4)
 	find_path(ITK_INCLUDE_PATH itk.h HINTS ${TCL_INCLUDE_PATH})
+
 	if(ITK_INCLUDE_PATH)
           message(STATUS "Looking for itk.h - found")
 	  message(STATUS "ITK_INCLUDE_PATH = ${ITK_INCLUDE_PATH}")

+	  message(STATUS "Checking for Itk header version consistency")
+	  string(REGEX REPLACE "^([0-9]*)\\.[0-9]*.*$" "\\1" ITK_MAJOR_VERSION  "${ITK_VERSION}")
+	  string(REGEX REPLACE "^[0-9]*\\.([0-9]*).*$" "\\1" ITK_MINOR_VERSION  "${ITK_VERSION}")
+	  message(STATUS "ITK_MAJOR_VERSION = ${ITK_MAJOR_VERSION}")
+	  message(STATUS "ITK_MINOR_VERSION = ${ITK_MINOR_VERSION}")
+	  file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/CheckITK_VERSION.c
+	    "// #define RC_INVOKED to avoid sucking in lots of additional includes for
+// efficiency and simplicity and also to avoid the header file disaster that has long
+// been a problem for version 3.3 of itk.h
+#define RC_INVOKED 1
+#include <itk.h>
+#if ITK_MAJOR_VERSION != ${ITK_MAJOR_VERSION} || ITK_MINOR_VERSION != ${ITK_MINOR_VERSION}
+  #error ITK_VERSION mismatch
+#endif
+void main(void){}
+"
+	    )
+	  try_compile(CONSISTENT_HEADER_ITK_VERSION ${CMAKE_BINARY_DIR}
+	    ${CMAKE_CURRENT_BINARY_DIR}/CheckITK_VERSION.c
+	    CMAKE_FLAGS -DINCLUDE_DIRECTORIES:PATH=${ITK_INCLUDE_PATH}
+	    )
+	  if(CONSISTENT_HEADER_ITK_VERSION)
+	    message(STATUS "Checking for Itk header version consistency - true")
+	  else(CONSISTENT_HEADER_ITK_VERSION)
+	    message(STATUS "Checking for Itk header version consistency - false")
+            message(STATUS "WARNING: Disabling Itk interface code")
+	    set(ENABLE_itk OFF CACHE BOOL "Enable Itk interface code" FORCE)
+	  endif(CONSISTENT_HEADER_ITK_VERSION)
+	else(ITK_INCLUDE_PATH)
+          message(STATUS "Looking for itk.h - not found")
+          message(STATUS "WARNING: Disabling Itk interface code")
+          set(ENABLE_itk OFF CACHE BOOL "Enable Itk interface code" FORCE)
+	endif(ITK_INCLUDE_PATH)
+
+	if(ENABLE_itk)
           message(STATUS "Looking for itk library")
 	  # Search first for epa_build install location.
           find_library(ITK_LIBRARY itk${ITK_VERSION} HINTS ${TCL_LIBRARY_PATH}/itk${ITK_VERSION})
@@ -240,6 +308,7 @@
 	      list(GET IWIDGETS_VERSIONS_LIST 0 IWIDGETS_VERSION)
 	      list(GET IWIDGETS_VERSIONS_LIST 1 CONSISTENT_ITK_VERSION)
 	      list(GET IWIDGETS_VERSIONS_LIST 2 CONSISTENT_ITCL_VERSION)
+	      message(STATUS "Checking that the Iwidgets, Itk, and Itcl packages are consistent")
 	      if(CONSISTENT_ITCL_VERSION STREQUAL ITCL_VERSION AND CONSISTENT_ITK_VERSION STREQUAL ITK_VERSION)
 		if(USE_INCRTCL_VERSION_4)
 		  set(IWIDGETS_PACKAGE_NAME "Iwidgets ${IWIDGETS_VERSION}")
@@ -251,6 +320,7 @@
                   # iwidgets between the build and post-install eras.
 		  set(IWIDGETS_PACKAGE_NAME "-exact Iwidgets ${IWIDGETS_VERSION}")
 		endif(USE_INCRTCL_VERSION_4)
+		message(STATUS "Checking that the Iwidgets, Itk, and Itcl packages are consistent - true")
 		message(STATUS "IWIDGETS_PACKAGE_NAME = ${IWIDGETS_PACKAGE_NAME}")
 	      else(CONSISTENT_ITCL_VERSION STREQUAL ITCL_VERSION AND CONSISTENT_ITK_VERSION STREQUAL ITK_VERSION)
 		message(STATUS "IWIDGETS_VERSION = ${IWIDGETS_VERSION}")
@@ -258,29 +328,26 @@
 		message(STATUS "CONSISTENT_ITK_VERSION = ${CONSISTENT_ITK_VERSION}")
 		message(STATUS "ITCL_VERSION = ${ITCL_VERSION}")
 		message(STATUS "CONSISTENT_ITCL_VERSION = ${CONSISTENT_ITCL_VERSION}")
+		message(STATUS "Checking that the Iwidgets, Itk, and Itcl packages are consistent - false")
 		message(STATUS "WARNING: Consistent combination of Iwidgets, Itk, and Itcl not found so disabling Itcl and Itk")
-		set(ENABLE_itcl OFF CACHE BOOL "Enable incr Tcl interface code" FORCE)
-		set(ENABLE_itk OFF CACHE BOOL "Enable incr Tk interface code" FORCE)
+		set(ENABLE_itcl OFF CACHE BOOL "Enable Itcl interface code" FORCE)
+		set(ENABLE_itk OFF CACHE BOOL "Enable Itk interface code" FORCE)
 	      endif(CONSISTENT_ITCL_VERSION STREQUAL ITCL_VERSION AND CONSISTENT_ITK_VERSION STREQUAL ITK_VERSION)
 	    else(NOT IWIDGETS_RC)
 	      message(STATUS "WARNING: Iwidgets could not be found so disabling Itcl and Itk")
-	      set(ENABLE_itcl OFF CACHE BOOL "Enable incr Tcl interface code" FORCE)
-	      set(ENABLE_itk OFF CACHE BOOL "Enable incr Tk interface code" FORCE)
+	      set(ENABLE_itcl OFF CACHE BOOL "Enable Itcl interface code" FORCE)
+	      set(ENABLE_itk OFF CACHE BOOL "Enable Itk interface code" FORCE)
 	    endif(NOT IWIDGETS_RC)
           else(ITK_LIBRARY)
             message(STATUS "Looking for itk library - not found")
-            message(STATUS "WARNING: Disabling incr Tk interface code")
-            set(ENABLE_itk OFF CACHE BOOL "Enable incr Tk interface code" FORCE)
+            message(STATUS "WARNING: Disabling Itk interface code")
+            set(ENABLE_itk OFF CACHE BOOL "Enable Itk interface code" FORCE)
           endif(ITK_LIBRARY)
-	else(ITK_INCLUDE_PATH)
-          message(STATUS "Looking for itk.h - not found")
-          message(STATUS "WARNING: Disabling incr Tk interface code")
-          set(ENABLE_itk OFF CACHE BOOL "Enable incr Tk interface code" FORCE)
-	endif(ITK_INCLUDE_PATH)
+	endif(ENABLE_itk)
       else(NOT ITK_RC)
         message(STATUS "Itk not available or not compatible with current Tcl shell")
-        message(STATUS "WARNING: Disabling incr Tk interface code")
-        set(ENABLE_itk OFF CACHE BOOL "Enable incr Tk interface code" FORCE)
+        message(STATUS "WARNING: Disabling Itk interface code")
+        set(ENABLE_itk OFF CACHE BOOL "Enable Itk interface code" FORCE)
       endif(NOT ITK_RC)
     endif(ENABLE_itk)

@@ -288,16 +355,16 @@
     message(STATUS "Tcl not found OR tclsh not found")
     message(STATUS "WARNING: Disabling everything that is Tcl/Tk related")
     set(ENABLE_tcl OFF CACHE BOOL "Enable Tcl bindings" FORCE)
-    set(ENABLE_itcl OFF CACHE BOOL "Enable incr Tcl interface code" FORCE)
+    set(ENABLE_itcl OFF CACHE BOOL "Enable Itcl interface code" FORCE)
     set(ENABLE_tk OFF CACHE BOOL "Enable Tk interface code" FORCE)
-    set(ENABLE_itk OFF CACHE BOOL "Enable incr Tk interface code" FORCE)
+    set(ENABLE_itk OFF CACHE BOOL "Enable Itk interface code" FORCE)
   endif(TCL_FOUND AND TCL_TCLSH)
-  message(STATUS "Finished system introspection to determine data for Tcl and friends")
+  message(STATUS "Finished determining consistent system data for Tcl and friends")
 else(ENABLE_tcl)
   message(STATUS "WARNING: ENABLE_tcl is OFF so disabling everything else that is Tcl/Tk related")
-  set(ENABLE_itcl OFF CACHE BOOL "Enable incr Tcl interface code" FORCE)
+  set(ENABLE_itcl OFF CACHE BOOL "Enable Itcl interface code" FORCE)
   set(ENABLE_tk OFF CACHE BOOL "Enable Tk interface code" FORCE)
-  set(ENABLE_itk OFF CACHE BOOL "Enable incr Tk interface code" FORCE)
+  set(ENABLE_itk OFF CACHE BOOL "Enable Itk interface code" FORCE)
 endif(ENABLE_tcl)
 if(NOT ENABLE_itk)
   set(itk_true "#")


If the packaging tar fails, retry

If the packaging tar fails, retry

Hopefully, this will work around OSX tar gremlins

--- build/cmake/macros/TarGz.cmake
+++ build/cmake/macros/TarGz.cmake
@@ -18,9 +18,10 @@
     add_custom_command(
         OUTPUT ${CPACK_PACKAGE_FILE_NAME}.tar.gz
         COMMAND mv ARGS ${CMAKE_INSTALL_PREFIX} ${CPACK_PACKAGE_FILE_NAME}
-        COMMAND ls ARGS -lR ${CPACK_PACKAGE_FILE_NAME}
-        COMMAND ps ARGS auwx
-        COMMAND ${TAR_COMMAND} ARGS czf ${CPACK_PACKAGE_FILE_NAME}.tar.gz --owner=0 --group=0 --numeric-owner ${CPACK_PACKAGE_FILE_NAME}
+	# For reasons we just can't explain, occasionally, on macos only,
+	# tar fails with "file changed as we read it", because the mtime
+	# of a .a file moved.  Just retry the tar if it fails for any reason
+        COMMAND ${TAR_COMMAND} ARGS czf ${CPACK_PACKAGE_FILE_NAME}.tar.gz --owner=0 --group=0 --numeric-owner ${CPACK_PACKAGE_FILE_NAME} || ${TAR_COMMAND} ARGS czf ${CPACK_PACKAGE_FILE_NAME}.tar.gz --owner=0 --group=0 --numeric-owner ${CPACK_PACKAGE_FILE_NAME}
         COMMAND mv ARGS ${CPACK_PACKAGE_FILE_NAME} ${CMAKE_INSTALL_PREFIX}
     )
     add_custom_target(targz DEPENDS ${CPACK_PACKAGE_FILE_NAME}.tar.gz)


Fixing some build errors in Android CMake configuration; Android build is currently broken, maybe because compiler is not using the correct stdlib (should be libc++)

--- build/toolchains/android.cmake
+++ build/toolchains/android.cmake
@@ -26,6 +26,7 @@
 set(CXX_FLAGS_DEBUG "${CXX_FLAGS_DEBUG} -g -O0")
 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic -fPIC")
 set(LIBCURL_PRECOMPILED_LIB ${CMAKE_SOURCE_DIR}/android/jni/precompiled/${ANDROID_ABI}/libcurl.a)
+set(ANDROID_STL c++_shared)

 # include dependency headers
 include_directories(${PROJECT_SOURCE_DIR}/android/jni/include)


Removed unused deb dependencies and activated objective c support on deb builds

--- .cmake/Modules/DebConfig.cmake
+++ .cmake/Modules/DebConfig.cmake
@@ -8,10 +8,12 @@
   cmake
   gettext
   libpcre3-dev
-  gcc-4.9
-  g++-4.9
-  gobjc-4.9
+  gobjc
   gnustep-devel
+)
+
+set(CPACK_DEBIAN_CMAKE_OPTIONS
+  "-DLANG_OBJC=ON"
 )

 set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/description.txt")


update git repo and tag for OpenVINO on linux

--- cmake/ExternalOpenVINO.cmake
+++ cmake/ExternalOpenVINO.cmake
@@ -51,8 +51,8 @@
 else()
 ExternalProject_Add(OpenVINO
         PREFIX ${FAST_EXTERNAL_BUILD_DIR}/OpenVINO
-        GIT_REPOSITORY "https://github.com/opencv/dldt.git"
-        GIT_TAG "2020.1"
+        GIT_REPOSITORY "https://github.com/openvinotoolkit/openvino.git"
+        GIT_TAG "2020.3"
         UPDATE_COMMAND
             git submodule update --init --recursive
         CMAKE_ARGS


Update FindTargetLAPACK.cmake

Update FindTargetLAPACK.cmake

--- cmake/FindTargetLAPACK.cmake
+++ cmake/FindTargetLAPACK.cmake
@@ -33,7 +33,7 @@
     set_property (TARGET tgt::lapack PROPERTY INTERFACE_LINK_LIBRARIES ${LAPACK_LIBRARIES})
 else()
     # 2nd precedence - target already prepared and findable in TargetLAPACKConfig.cmake
-    if (NOT ${CMAKE_DISABLE_FIND_PACKAGE_${PN}})
+    if (NOT "${CMAKE_DISABLE_FIND_PACKAGE_${PN}}")
         find_package (TargetLAPACK QUIET CONFIG)
     endif()
     if (TARGET tgt::lapack)