浏览代码

cmake: Fix hardcoded SWIG_DIR path on macOS

PatTheMav 3 年之前
父节点
当前提交
04a06d10a6
共有 1 个文件被更改,包括 9 次插入0 次删除
  1. 9 0
      cmake/Modules/ObsDefaults_macOS.cmake

+ 9 - 0
cmake/Modules/ObsDefaults_macOS.cmake

@@ -46,6 +46,15 @@ if(NOT DEFINED CMAKE_PREFIX_PATH)
   )
   )
 endif()
 endif()
 
 
+# SWIG hard codes the directory to its library directory at compile time. As
+# obs-deps need to be relocatable, we need to force SWIG to look for its files
+# in a directory relative to the PREFIX_PATH. The best way to ensure this is to
+# set the SWIG_LIB environment variable.
+
+if(NOT DEFINED ENV{SWIG_LIB} AND EXISTS "${CMAKE_PREFIX_PATH}/bin/swig")
+  set(ENV{SWIG_LIB} "${CMAKE_PREFIX_PATH}/share/swig/CURRENT")
+endif()
+
 macro(setup_obs_project)
 macro(setup_obs_project)
   # Set code signing options
   # Set code signing options
   set(OBS_BUNDLE_CODESIGN_IDENTITY
   set(OBS_BUNDLE_CODESIGN_IDENTITY