diff --git a/Rakefile b/Rakefile index 55f09585..00292744 100644 --- a/Rakefile +++ b/Rakefile @@ -258,8 +258,8 @@ task :cache_cxx_dependencies do cmake_flags << "-DCPM_DOWNLOAD_ALL=OFF" cmake_flags << "-DCPM_USE_NAMED_CACHE_DIRECTORIES=ON" cmake_flags << "-DCPM_USE_LOCAL_PACKAGES=OFF" - cmake_flags << "-DCPM_SOURCE_CACHE=\#{File.expand_path('cache', __dir__)}" - cmake_flags << "-DCOUCHBASE_CXX_CLIENT_EMBED_MOZILLA_CA_BUNDLE_ROOT=\#{File.expand_path('cache', __dir__)}" + cmake_flags << "-DCPM_SOURCE_CACHE=\#{__dir__}" + cmake_flags << "-DCOUCHBASE_CXX_CLIENT_EMBED_MOZILLA_CA_BUNDLE_ROOT=\#{__dir__}" CACHE_FLAGS end end diff --git a/ext/extconf.rb b/ext/extconf.rb index c57089ed..46d6b345 100644 --- a/ext/extconf.rb +++ b/ext/extconf.rb @@ -108,7 +108,9 @@ def sys(*cmd) extconf_include = File.expand_path("cache/extconf_include.rb", __dir__) if File.exist?(extconf_include) puts "-- include extra cmake options from #{extconf_include}" - eval(File.read(extconf_include)) # rubocop:disable Security/Eval + # Evaluated with the file name so that __dir__ inside the snippet resolves to the + # cache directory on the installing machine rather than nil. + eval(File.read(extconf_include), binding, extconf_include) # rubocop:disable Security/Eval end if ENV["CB_STATIC"] || ENV["CB_STATIC_BORINGSSL"]