From b3a4e889dc3f06e83a299096710406920f18cd51 Mon Sep 17 00:00:00 2001 From: Ignacio Burgue o Date: Wed, 17 Jun 2015 09:54:07 -0300 Subject: CMake needs a hint to use 64 bit target with msvc. Only when using Windows 64 bits and the msvc compiler. CMake uses the x86 generator by default. We need to tell it explicitly that we wan't to use the x64 generator. refs #382 --- src/luarocks/build/cmake.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/luarocks/build/cmake.lua b/src/luarocks/build/cmake.lua index a1c08dfa..3d0f22a2 100644 --- a/src/luarocks/build/cmake.lua +++ b/src/luarocks/build/cmake.lua @@ -37,16 +37,16 @@ function cmake.run(rockspec) -- Execute cmake with variables. local args = "" - if cfg.cmake_generator then + + -- Try to pick the best generator. With msvc and x64, CMake does not select it by default so we need to be explicit. + if cfg.is_platform("mingw32") and cfg.cmake_generator then args = args .. ' -G"'..cfg.cmake_generator.. '"' - end - for k,v in pairs(variables) do - args = args .. ' -D' ..k.. '="' ..v.. '"' + elseif cfg.is_platform("windows") and cfg.arch:match("%-x86_64$") then + args = args .. " -DCMAKE_GENERATOR_PLATFORM=x64" end - -- Generate 64 bit build if appropiate. - if not not cfg.arch:match("%-x86_64$") then - args = args .. " -DCMAKE_GENERATOR_PLATFORM=x64" + for k,v in pairs(variables) do + args = args .. ' -D' ..k.. '="' ..tostring(v).. '"' end if not fs.execute_string(rockspec.variables.CMAKE.." -H. -Bbuild.luarocks "..args) then -- cgit v1.2.3-55-g6feb