mirror of
https://github.com/opencv/opencv.git
synced 2024-11-24 19:20:28 +08:00
Merge pull request #358 from taka-no-me:objc_exceptions
This commit is contained in:
commit
86b4b30a6d
@ -64,6 +64,13 @@ MACRO(ocv_check_compiler_flag LANG FLAG RESULT)
|
|||||||
else()
|
else()
|
||||||
FILE(WRITE "${_fname}" "#pragma\nint main(void) { return 0; }\n")
|
FILE(WRITE "${_fname}" "#pragma\nint main(void) { return 0; }\n")
|
||||||
endif()
|
endif()
|
||||||
|
elseif("_${LANG}_" MATCHES "_OBJCXX_")
|
||||||
|
set(_fname "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.mm")
|
||||||
|
if("${CMAKE_CXX_FLAGS} ${FLAG} " MATCHES "-Werror " OR "${CMAKE_CXX_FLAGS} ${FLAG} " MATCHES "-Werror=unknown-pragmas ")
|
||||||
|
FILE(WRITE "${_fname}" "int main() { return 0; }\n")
|
||||||
|
else()
|
||||||
|
FILE(WRITE "${_fname}" "#pragma\nint main() { return 0; }\n")
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
unset(_fname)
|
unset(_fname)
|
||||||
endif()
|
endif()
|
||||||
@ -100,6 +107,8 @@ macro(ocv_check_flag_support lang flag varname)
|
|||||||
set(_lang CXX)
|
set(_lang CXX)
|
||||||
elseif("_${lang}_" MATCHES "_C_")
|
elseif("_${lang}_" MATCHES "_C_")
|
||||||
set(_lang C)
|
set(_lang C)
|
||||||
|
elseif("_${lang}_" MATCHES "_OBJCXX_")
|
||||||
|
set(_lang OBJCXX)
|
||||||
else()
|
else()
|
||||||
set(_lang ${lang})
|
set(_lang ${lang})
|
||||||
endif()
|
endif()
|
||||||
|
@ -230,6 +230,24 @@ ocv_module_include_directories()
|
|||||||
|
|
||||||
ocv_create_module(${GRFMT_LIBS} ${HIGHGUI_LIBRARIES})
|
ocv_create_module(${GRFMT_LIBS} ${HIGHGUI_LIBRARIES})
|
||||||
|
|
||||||
|
if(APPLE)
|
||||||
|
ocv_check_flag_support(OBJCXX "-fobjc-exceptions" HAVE_OBJC_EXCEPTIONS)
|
||||||
|
if(HAVE_OBJC_EXCEPTIONS)
|
||||||
|
foreach(source ${OPENCV_MODULE_${the_module}_SOURCES})
|
||||||
|
if("${source}" MATCHES "\\.mm$")
|
||||||
|
get_source_file_property(flags "${source}" COMPILE_FLAGS)
|
||||||
|
if(flags)
|
||||||
|
set(flags "${_flags} -fobjc-exceptions")
|
||||||
|
else()
|
||||||
|
set(flags "-fobjc-exceptions")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set_source_files_properties("${source}" PROPERTIES COMPILE_FLAGS "${flags}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
if(BUILD_SHARED_LIBS)
|
if(BUILD_SHARED_LIBS)
|
||||||
add_definitions(-DHIGHGUI_EXPORTS)
|
add_definitions(-DHIGHGUI_EXPORTS)
|
||||||
endif()
|
endif()
|
||||||
|
Loading…
Reference in New Issue
Block a user