From 50433c5c8f0e78438f7ad4bb4fecc35461076daf Mon Sep 17 00:00:00 2001 From: Aaron Jheng Date: Tue, 14 Oct 2025 14:39:42 +0800 Subject: [PATCH] antlr4_9.runtime.cpp: fix build --- .../parsing/antlr/4.9.runtime.cpp.cmake.patch | 20 +++++++++++++++++++ pkgs/development/tools/parsing/antlr/4.nix | 2 ++ 2 files changed, 22 insertions(+) create mode 100644 pkgs/development/tools/parsing/antlr/4.9.runtime.cpp.cmake.patch diff --git a/pkgs/development/tools/parsing/antlr/4.9.runtime.cpp.cmake.patch b/pkgs/development/tools/parsing/antlr/4.9.runtime.cpp.cmake.patch new file mode 100644 index 000000000000..979e224756e6 --- /dev/null +++ b/pkgs/development/tools/parsing/antlr/4.9.runtime.cpp.cmake.patch @@ -0,0 +1,20 @@ +diff --git a/runtime/Cpp/CMakeLists.txt b/runtime/Cpp/CMakeLists.txt +index e549f113f..c84f591c2 100644 +--- a/runtime/Cpp/CMakeLists.txt ++++ b/runtime/Cpp/CMakeLists.txt +@@ -28,15 +28,10 @@ project(LIBANTLR4) + if(CMAKE_VERSION VERSION_EQUAL "3.0.0" OR + CMAKE_VERSION VERSION_GREATER "3.0.0") + CMAKE_POLICY(SET CMP0026 NEW) +- CMAKE_POLICY(SET CMP0054 OLD) +- CMAKE_POLICY(SET CMP0045 OLD) +- CMAKE_POLICY(SET CMP0042 OLD) + endif() + + if(CMAKE_VERSION VERSION_EQUAL "3.3.0" OR + CMAKE_VERSION VERSION_GREATER "3.3.0") +- CMAKE_POLICY(SET CMP0059 OLD) +- CMAKE_POLICY(SET CMP0054 OLD) + endif() + + if(CMAKE_SYSTEM_NAME MATCHES "Linux") diff --git a/pkgs/development/tools/parsing/antlr/4.nix b/pkgs/development/tools/parsing/antlr/4.nix index c30d235c4f8e..02fd86abde21 100644 --- a/pkgs/development/tools/parsing/antlr/4.nix +++ b/pkgs/development/tools/parsing/antlr/4.nix @@ -194,9 +194,11 @@ in extraCppBuildInputs = [ utf8cpp ] ++ lib.optional stdenv.hostPlatform.isLinux libuuid; extraCppCmakeFlags = [ (lib.cmakeFeature "CMAKE_CXX_FLAGS" "-I${lib.getDev utf8cpp}/include/utf8cpp") + (lib.cmakeFeature "CMAKE_POLICY_VERSION_MINIMUM" "3.5") ]; extraPatches = [ ./utf8cpp.patch + ./4.9.runtime.cpp.cmake.patch ]; }).antlr;