fix-cmake-mingw.patch 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. From 9556761f0479786a1223c78ee4d7bd22a040bbd1 Mon Sep 17 00:00:00 2001
  2. From: Ivan Kozlovic <[email protected]>
  3. Date: Thu, 19 Dec 2024 12:49:08 -0700
  4. Subject: [PATCH] [FIXED] Build: failure with mingw
  5. Credit goes to @mtmk with the proposed fix and verification that it
  6. works on mingw.
  7. I have verified that the change still works when building on my Windows
  8. VM, so I don't expect windows users to have any issue with that.
  9. Resolves #827
  10. Signed-off-by: Ivan Kozlovic <[email protected]>
  11. ---
  12. CMakeLists.txt | 15 ++++++++++-----
  13. 1 file changed, 10 insertions(+), 5 deletions(-)
  14. diff --git a/CMakeLists.txt b/CMakeLists.txt
  15. index 413e0523..ee12730f 100644
  16. --- a/CMakeLists.txt
  17. +++ b/CMakeLists.txt
  18. @@ -208,11 +208,16 @@ elseif(WIN32)
  19. set(NATS_PLATFORM_INCLUDE "win")
  20. # Warning control.
  21. - add_compile_options(/W4) # Set warning level to maximum, then disable:
  22. - add_compile_options(/wd4100) # unreferenced formal parameter
  23. - add_compile_options(/wd4200) # nonstandard extension used: zero-sized array in struct/union
  24. - add_compile_options(/wd4130) # logical operation on address of string constant
  25. - add_compile_options(/wd4127) # conditional expression is constant
  26. + if(MSVC)
  27. + # Set warning level to maximum, then disable:
  28. + # /wd4100 unreferenced formal parameter
  29. + # /wd4200 nonstandard extension used: zero-sized array in struct/union
  30. + # /wd4130 logical operation on address of string constant
  31. + # /wd4127 conditional expression is constant
  32. + add_compile_options(/W4 /wd4100 /wd4200 /wd4130 /wd4127)
  33. + else()
  34. + add_compile_options(-Wall -Wextra -Wno-unused-parameter -Wno-pedantic -Wno-address -Wno-constant-conditional)
  35. + endif()
  36. if(sodium_USE_STATIC_LIBS)
  37. add_definitions(