Skip to content

Commit d19147b

Browse files
authored
Merge pull request opencv#9218 from alalek:backport_2.4
(2.4) Backport changes from master
2 parents 8736ece + fc2a71d commit d19147b

File tree

4 files changed

+18
-14
lines changed

4 files changed

+18
-14
lines changed

CMakeLists.txt

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,16 @@
44
# From the off-tree build directory, invoke:
55
# $ cmake <PATH_TO_OPENCV_ROOT>
66
#
7-
#
8-
# - OCT-2008: Initial version <joseluisblancoc@gmail.com>
9-
#
107
# ----------------------------------------------------------------------------
118

9+
# Disable in-source builds to prevent source tree corruption.
10+
if(" ${CMAKE_SOURCE_DIR}" STREQUAL " ${CMAKE_BINARY_DIR}")
11+
message(FATAL_ERROR "
12+
FATAL: In-source builds are not allowed.
13+
You should create separate directory for build files.
14+
")
15+
endif()
16+
1217
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
1318

1419
# Following block can broke build in case of cross-compilng
@@ -1094,13 +1099,6 @@ status("")
10941099

10951100
ocv_finalize_status()
10961101

1097-
# ----------------------------------------------------------------------------
1098-
# Warn in the case of in-source build
1099-
# ----------------------------------------------------------------------------
1100-
if("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
1101-
message(WARNING "The source directory is the same as binary directory. \"make clean\" may damage the source tree")
1102-
endif()
1103-
11041102
# ----------------------------------------------------------------------------
11051103
# CPack stuff
11061104
# ----------------------------------------------------------------------------

cmake/OpenCVModule.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ macro(ocv_add_module _name)
172172
project(${the_module})
173173
add_definitions(
174174
-D_USE_MATH_DEFINES # M_PI constant in MSVS
175-
-D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS # to use C libraries from C++ code (ffmpeg)
175+
-D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS # to use C libraries from C++ code (ffmpeg)
176176
)
177177
endif(OPENCV_INITIAL_PASS)
178178
endmacro()

cmake/OpenCVPCHSupport.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags)
6969
FOREACH(item ${DIRINC})
7070
if(item MATCHES "^${OpenCV_SOURCE_DIR}/modules/")
7171
LIST(APPEND ${_out_compile_flags} "${_PCH_include_prefix}\"${item}\"")
72+
elseif(CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0" AND
73+
item MATCHES "/usr/include$")
74+
# workaround for GCC 6.x bug
7275
else()
7376
LIST(APPEND ${_out_compile_flags} "${_PCH_isystem_prefix}\"${item}\"")
7477
endif()
@@ -78,6 +81,9 @@ MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags)
7881
FOREACH(item ${DIRINC})
7982
if(item MATCHES "^${OpenCV_SOURCE_DIR}/modules/")
8083
LIST(APPEND ${_out_compile_flags} "${_PCH_include_prefix}\"${item}\"")
84+
elseif(CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0" AND
85+
item MATCHES "/usr/include$")
86+
# workaround for GCC 6.x bug
8187
else()
8288
LIST(APPEND ${_out_compile_flags} "${_PCH_isystem_prefix}\"${item}\"")
8389
endif()

modules/highgui/src/cap_v4l.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,12 +1164,12 @@ static int read_frame_v4l2(CvCaptureCAM_V4L* capture) {
11641164
//printf("got data in buff %d, len=%d, flags=0x%X, seq=%d, used=%d)\n",
11651165
// buf.index, buf.length, buf.flags, buf.sequence, buf.bytesused);
11661166

1167-
if (-1 == ioctl (capture->deviceHandle, VIDIOC_QBUF, &buf))
1168-
perror ("VIDIOC_QBUF");
1169-
11701167
//set timestamp in capture struct to be timestamp of most recent frame
11711168
capture->timestamp = buf.timestamp;
11721169

1170+
if (-1 == ioctl (capture->deviceHandle, VIDIOC_QBUF, &buf))
1171+
perror ("VIDIOC_QBUF");
1172+
11731173
return 1;
11741174
}
11751175

0 commit comments

Comments
 (0)