Просмотр исходного кода

cmake: Add helper to include -isystem directories

This is mostly just a helper to prevent warnings with system includes in
XCode.
jp9000 10 лет назад
Родитель
Сommit
6ab8d75da0
1 измененных файлов с 15 добавлено и 0 удалено
  1. 15 0
      cmake/external/ObsPluginHelpers.cmake

+ 15 - 0
cmake/external/ObsPluginHelpers.cmake

@@ -2,6 +2,21 @@
 
 set(EXTERNAL_PLUGIN_OUTPUT_DIR "${CMAKE_BINARY_DIR}/rundir")
 
+# Fix XCode includes to ignore warnings on system includes
+function(target_include_directories_system _target)
+  if(XCODE)
+    foreach(_arg ${ARGN})
+      if("${_arg}" STREQUAL "PRIVATE" OR "${_arg}" STREQUAL "PUBLIC" OR "${_arg}" STREQUAL "INTERFACE")
+        set(_scope ${_arg})
+      else()
+        target_compile_options(${_target} ${_scope} -isystem${_arg})
+      endif()
+    endforeach()
+  else()
+    target_include_directories(${_target} SYSTEM ${_scope} ${ARGN})
+  endif()
+endfunction()
+
 function(install_external_plugin_data_internal target source_dir target_dir)
 	install(DIRECTORY ${source_dir}/
 		DESTINATION "${target}/${target_dir}"