From 04a06d10a6d0b21ce395e91412cf45965fba158d Mon Sep 17 00:00:00 2001 From: PatTheMav Date: Sat, 2 Jul 2022 16:49:28 +0200 Subject: [PATCH] cmake: Fix hardcoded SWIG_DIR path on macOS --- cmake/Modules/ObsDefaults_macOS.cmake | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cmake/Modules/ObsDefaults_macOS.cmake b/cmake/Modules/ObsDefaults_macOS.cmake index 7eb397afe..da6ee9ac9 100644 --- a/cmake/Modules/ObsDefaults_macOS.cmake +++ b/cmake/Modules/ObsDefaults_macOS.cmake @@ -46,6 +46,15 @@ if(NOT DEFINED CMAKE_PREFIX_PATH) ) 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) # Set code signing options set(OBS_BUNDLE_CODESIGN_IDENTITY