Skip to content

Commit 76cc034

Browse files
committed
Merge pull request opencv#19519 from alalek:issue_19485
2 parents a5a421a + d2d6eba commit 76cc034

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

cmake/OpenCVUtils.cmake

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,11 @@ macro(ocv_check_flag_support lang flag varname base_options)
564564
elseif("_${lang}_" MATCHES "_C_")
565565
set(_lang C)
566566
elseif("_${lang}_" MATCHES "_OBJCXX_")
567-
set(_lang OBJCXX)
567+
if(DEFINED CMAKE_OBJCXX_COMPILER) # CMake 3.16+ and enable_language(OBJCXX) call are required
568+
set(_lang OBJCXX)
569+
else()
570+
set(_lang CXX)
571+
endif()
568572
else()
569573
set(_lang ${lang})
570574
endif()
@@ -573,7 +577,9 @@ macro(ocv_check_flag_support lang flag varname base_options)
573577
string(REGEX REPLACE "^(/|-)" "HAVE_${_lang}_" ${varname} "${${varname}}")
574578
string(REGEX REPLACE " -|-|=| |\\.|," "_" ${varname} "${${varname}}")
575579

576-
ocv_check_compiler_flag("${_lang}" "${base_options} ${flag}" ${${varname}} ${ARGN})
580+
if(DEFINED CMAKE_${_lang}_COMPILER)
581+
ocv_check_compiler_flag("${_lang}" "${base_options} ${flag}" ${${varname}} ${ARGN})
582+
endif()
577583
endmacro()
578584

579585
macro(ocv_check_runtime_flag flag result)

modules/highgui/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ ocv_create_module(${HIGHGUI_LIBRARIES})
151151

152152
macro(ocv_highgui_configure_target)
153153
if(APPLE)
154-
add_apple_compiler_options(the_module)
154+
add_apple_compiler_options(${the_module})
155155
endif()
156156

157157
if(MSVC)

modules/imgcodecs/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ ocv_create_module(${GRFMT_LIBS} ${IMGCODECS_LIBRARIES})
131131

132132
macro(ocv_imgcodecs_configure_target)
133133
if(APPLE)
134-
add_apple_compiler_options(the_module)
134+
add_apple_compiler_options(${the_module})
135135
endif()
136136

137137
if(MSVC)

modules/videoio/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ ocv_create_module(${VIDEOIO_LIBRARIES})
253253

254254
macro(ocv_videoio_configure_target)
255255
if(APPLE)
256-
add_apple_compiler_options(the_module)
256+
add_apple_compiler_options(${the_module})
257257
endif()
258258

259259
if(MSVC)

0 commit comments

Comments
 (0)