Browse Source

Fix PCRE2 static runtime link (#624)

Jérôme Leclercq 4 years ago
parent
commit
8393ebaaa9
1 changed files with 6 additions and 0 deletions
  1. 6 0
      packages/p/pcre2/xmake.lua

+ 6 - 0
packages/p/pcre2/xmake.lua

@@ -27,6 +27,9 @@ package("pcre2")
     end)
 
     on_install("windows", function (package)
+        if package:version():lt("10.21") then
+            io.replace("CMakeLists.txt", [[SET(CMAKE_C_FLAGS -I${PROJECT_SOURCE_DIR}/src)]], [[SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${PROJECT_SOURCE_DIR}/src")]], {plain = true})
+        end
         local configs = {"-DPCRE2_BUILD_TESTS=OFF", "-DPCRE2_BUILD_PCRE2GREP=OFF"}
         table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
         table.insert(configs, "-DPCRE2_SUPPORT_JIT=" .. (package:config("jit") and "ON" or "OFF"))
@@ -38,6 +41,9 @@ package("pcre2")
         if package:debug() then
             table.insert(configs, "-DPCRE2_DEBUG=ON")
         end
+        if package:is_plat("windows") then
+            table.insert(configs, "-DPCRE2_STATIC_RUNTIME=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
+        end
         import("package.tools.cmake").install(package, configs)
     end)