diff --git a/ext/re2/extconf.rb b/ext/re2/extconf.rb index a88222c..3fac599 100644 --- a/ext/re2/extconf.rb +++ b/ext/re2/extconf.rb @@ -135,6 +135,14 @@ def cmake_compile_flags(host) ] end +def with_temp_dir + Dir.mktmpdir do |temp_dir| + Dir.chdir(temp_dir) do + yield + end + end +end + # # main # @@ -283,7 +291,9 @@ def process_recipe(name, version) end end - recipe.cook + # Use a temporary base directory to reduce filename lengths since + # Windows can hit a limit of 250 characters (CMAKE_OBJECT_PATH_MAX). + with_temp_dir { recipe.cook } FileUtils.touch(checkpoint) end