blob: 3d28d2466fbec31f297ba4472495179e1b8af940 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
This file is part of MXE. See LICENSE.md for licensing information.
Contains ad hoc patches for cross building.
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Boris Nagaev <bnagaev@gmail.com>
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}")
|