cmake: fix add_apple_compiler_options() calls and OBJCXX handling

pull/19519/head
Alexander Alekhin 4 years ago
parent fba70f7991
commit d2d6eba16a
  1. 10
      cmake/OpenCVUtils.cmake
  2. 2
      modules/highgui/CMakeLists.txt
  3. 2
      modules/imgcodecs/CMakeLists.txt
  4. 2
      modules/videoio/CMakeLists.txt

@ -564,7 +564,11 @@ macro(ocv_check_flag_support lang flag varname base_options)
elseif("_${lang}_" MATCHES "_C_")
set(_lang C)
elseif("_${lang}_" MATCHES "_OBJCXX_")
set(_lang OBJCXX)
if(DEFINED CMAKE_OBJCXX_COMPILER) # CMake 3.16+ and enable_language(OBJCXX) call are required
set(_lang OBJCXX)
else()
set(_lang CXX)
endif()
else()
set(_lang ${lang})
endif()
@ -573,7 +577,9 @@ macro(ocv_check_flag_support lang flag varname base_options)
string(REGEX REPLACE "^(/|-)" "HAVE_${_lang}_" ${varname} "${${varname}}")
string(REGEX REPLACE " -|-|=| |\\.|," "_" ${varname} "${${varname}}")
ocv_check_compiler_flag("${_lang}" "${base_options} ${flag}" ${${varname}} ${ARGN})
if(DEFINED CMAKE_${_lang}_COMPILER)
ocv_check_compiler_flag("${_lang}" "${base_options} ${flag}" ${${varname}} ${ARGN})
endif()
endmacro()
macro(ocv_check_runtime_flag flag result)

@ -151,7 +151,7 @@ ocv_create_module(${HIGHGUI_LIBRARIES})
macro(ocv_highgui_configure_target)
if(APPLE)
add_apple_compiler_options(the_module)
add_apple_compiler_options(${the_module})
endif()
if(MSVC)

@ -131,7 +131,7 @@ ocv_create_module(${GRFMT_LIBS} ${IMGCODECS_LIBRARIES})
macro(ocv_imgcodecs_configure_target)
if(APPLE)
add_apple_compiler_options(the_module)
add_apple_compiler_options(${the_module})
endif()
if(MSVC)

@ -253,7 +253,7 @@ ocv_create_module(${VIDEOIO_LIBRARIES})
macro(ocv_videoio_configure_target)
if(APPLE)
add_apple_compiler_options(the_module)
add_apple_compiler_options(${the_module})
endif()
if(MSVC)

Loading…
Cancel
Save