1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
From: Gianfranco Costamagna <locutusofborg@debian.org>
Date: Mon, 15 Apr 2024 08:50:00 +0200
Subject: Fix regex on find clang without stripping defines content
With this regex the example test code of clang fails in cmake, causing an error.
this is due to -I/usr/lib/llvm-18/include -std=c++17 -fno-exceptions -funwind-tables -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
becoming:
-I/usr/lib/llvm-18/include;-D_GNU_SOURCE;-D_FILE_OFFSET_BITS;-D_LARGEFILE_SOURCE;-D_FILE_OFFSET_BITS;-D__STDC_CONSTANT_MACROS;-D__STDC_FORMAT_MACROS;-D__STDC_LIMIT_MACROS
If you undefine _FILE_OFFSET_BITS and you enable _TIME_BITS=64 you get a FTBFS
/usr/include/features-time64.h:26:5: error: #error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64"
26 | # error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64"
Forwarded: https://github.com/Andersbakken/rtags/pull/1439
---
cmake/FindLibClang.cmake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cmake/FindLibClang.cmake b/cmake/FindLibClang.cmake
index debd12a..7bd1324 100644
--- a/cmake/FindLibClang.cmake
+++ b/cmake/FindLibClang.cmake
@@ -88,7 +88,7 @@ if (NOT LIBCLANG_CXXFLAGS)
endif ()
set(LIBCLANG_CXXFLAGS "-I${LIBCLANG_CXXFLAGS}")
endif ()
- string(REGEX MATCHALL "-(D__?[a-zA-Z_]*|I([^\" ]+|\"[^\"]+\"))" LIBCLANG_CXXFLAGS "${LIBCLANG_CXXFLAGS}")
+ string(REGEX MATCHALL "-(D__?[a-zA-Z_=0-9]*|I([^\" ]+|\"[^\"]+\"))" LIBCLANG_CXXFLAGS "${LIBCLANG_CXXFLAGS}")
string(REGEX REPLACE ";" " " LIBCLANG_CXXFLAGS "${LIBCLANG_CXXFLAGS}")
set(LIBCLANG_CXXFLAGS ${LIBCLANG_CXXFLAGS} CACHE STRING "The LLVM C++ compiler flags needed to compile LLVM based applications.")
unset(LIBCLANG_CXXFLAGS_HACK_CMAKECACHE_DOT_TEXT_BULLSHIT CACHE)
|