Skip to content

Commit

Permalink
[json-c] clang-cl fix. (#26254)
Browse files Browse the repository at this point in the history
* [json-c] fix clang-cl builds

* v db
  • Loading branch information
Neumann-A authored Aug 10, 2022
1 parent 63449f5 commit c9bbaff
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 1 deletion.
22 changes: 22 additions & 0 deletions ports/json-c/fix-clang-cl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9741b45f9..11b397024 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -281,7 +281,7 @@ message(STATUS "Wrote ${PROJECT_BINARY_DIR}/config.h")
configure_file(${PROJECT_SOURCE_DIR}/cmake/json_config.h.in ${PROJECT_BINARY_DIR}/json_config.h)
message(STATUS "Wrote ${PROJECT_BINARY_DIR}/json_config.h")

-if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
+if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" AND NOT MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffunction-sections -fdata-sections")
if ("${DISABLE_WERROR}" STREQUAL "OFF")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
@@ -297,7 +297,7 @@ if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL
endif()

add_definitions(-D_GNU_SOURCE)
-elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
+elseif (MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /DEBUG")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4100")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996")
1 change: 1 addition & 0 deletions ports/json-c/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ vcpkg_from_github(
SHA512 30063c8e32eb82e170647363055119f2f7eab19e1c3152673b966f41ed07e0349c3d6141b215b9912f9e84c2e06677b3d7ac949f720c7ebc2c95d692dc3881fe
HEAD_REF master
PATCHES pkgconfig.patch
fix-clang-cl.patch
)

vcpkg_cmake_configure(
Expand Down
1 change: 1 addition & 0 deletions ports/json-c/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "json-c",
"version-date": "2022-06-26",
"port-version": 1,
"description": "A JSON implementation in C",
"homepage": "https://github.com/json-c/json-c",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -3118,7 +3118,7 @@
},
"json-c": {
"baseline": "2022-06-26",
"port-version": 0
"port-version": 1
},
"json-dto": {
"baseline": "0.3.1",
Expand Down
5 changes: 5 additions & 0 deletions versions/j-/json-c.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "c24e9a9cbc53b10a7235087cc58e89924415b281",
"version-date": "2022-06-26",
"port-version": 1
},
{
"git-tree": "84aaadc268ad278e102cdd7e9526e5c5929c1cd6",
"version-date": "2022-06-26",
Expand Down

0 comments on commit c9bbaff

Please sign in to comment.