This file is part of MXE.
See index.html for further information.
Contains ad hoc patches for cross building.
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Boris Nagaev
Date: Sun, 20 Dec 2015 18:14:56 +0300
Subject: [PATCH] fix CMake error if a directory contains ++
See https://github.com/mxe/mxe/issues/1091
diff --git a/cmake/OpenCVModule.cmake b/cmake/OpenCVModule.cmake
index 1111111..2222222 100644
--- a/cmake/OpenCVModule.cmake
+++ b/cmake/OpenCVModule.cmake
@@ -364,12 +364,16 @@ function(__ocv_resolve_dependencies)
# process private deps
foreach(m ${OPENCV_MODULES_BUILD})
foreach(d ${OPENCV_MODULE_${m}_PRIVATE_REQ_DEPS})
- if(NOT (";${deps_${m}};" MATCHES ";${d};"))
+ # can't use MATCH because file paths can include regexp special chars
+ string(FIND ";${deps_${m}};" ";${d};" d_offset)
+ if(${d_offset} EQUAL -1)
list(APPEND deps_${m} ${d})
endif()
endforeach()
foreach(d ${OPENCV_MODULE_${m}_PRIVATE_OPT_DEPS})
- if(NOT (";${deps_${m}};" MATCHES ";${d};"))
+ # can't use MATCH because file paths can include regexp special chars
+ string(FIND ";${deps_${m}};" ";${d};" d_offset)
+ if(${d_offset} EQUAL -1)
if(HAVE_${d} OR TARGET ${d})
list(APPEND deps_${m} ${d})
endif()
diff --git a/cmake/OpenCVPCHSupport.cmake b/cmake/OpenCVPCHSupport.cmake
index 1111111..2222222 100644
--- a/cmake/OpenCVPCHSupport.cmake
+++ b/cmake/OpenCVPCHSupport.cmake
@@ -54,7 +54,9 @@ MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags)
GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES )
FOREACH(item ${DIRINC})
- if(item MATCHES "^${OpenCV_SOURCE_DIR}/modules/")
+ # can't use MATCH because file paths can include regexp special chars
+ string(FIND "${item}" "${OpenCV_SOURCE_DIR}/modules/" modules_offset)
+ if(${modules_offset} EQUAL 0)
LIST(APPEND ${_out_compile_flags} "${_PCH_include_prefix}\"${item}\"")
else()
LIST(APPEND ${_out_compile_flags} "${_PCH_isystem_prefix}\"${item}\"")
diff --git a/cmake/OpenCVUtils.cmake b/cmake/OpenCVUtils.cmake
index 1111111..2222222 100644
--- a/cmake/OpenCVUtils.cmake
+++ b/cmake/OpenCVUtils.cmake
@@ -39,7 +39,10 @@ function(ocv_include_directories)
set(__add_before "")
foreach(dir ${ARGN})
get_filename_component(__abs_dir "${dir}" ABSOLUTE)
- if("${__abs_dir}" MATCHES "^${OpenCV_SOURCE_DIR}" OR "${__abs_dir}" MATCHES "^${OpenCV_BINARY_DIR}")
+ # can't use MATCH because file paths can include regexp special chars
+ string(FIND "${__abs_dir}" "${OpenCV_SOURCE_DIR}" OpenCV_SOURCE_DIR_offset)
+ string(FIND "${__abs_dir}" "${OpenCV_BINARY_DIR}" OpenCV_BINARY_DIR_offset)
+ if($OpenCV_BINARY_DIR_offset} EQUAL 0 OR ${OpenCV_BINARY_DIR_offset} EQUAL 0)
list(APPEND __add_before "${dir}")
else()
include_directories(AFTER SYSTEM "${dir}")