1From 6a704ab7bf69cd5d6970b3a7d3ae7798b26027c1 Mon Sep 17 00:00:00 2001
2From: Paulo Neves <ptsneves@gmail.com>
3Date: Thu, 28 Jul 2022 11:28:41 +0200
4Subject: [PATCH] CMakeLists.txt Do not use private makefile $< target
5
6$< is a private detail from the Makefile generated by CMakefile and
7are not under control or to be used at the CMakeLists level. In 3.20
8that private generation changed pre-requisite targets[1] and now logs
9contain the path compiler_depend.ts instead of the actual file.
10
11Upstream-Status: Pending [https://github.com/fluent/fluent-bit/issues/5492]
12---
13 CMakeLists.txt              | 6 +-----
14 lib/chunkio/CMakeLists.txt  | 7 +------
15 lib/cmetrics/CMakeLists.txt | 7 +------
16 3 files changed, 3 insertions(+), 17 deletions(-)
17
18--- a/CMakeLists.txt
19+++ b/CMakeLists.txt
20@@ -46,11 +46,7 @@ else()
21   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
22 endif()
23
24-if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows")
25-  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILENAME__='\"$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<))\"'")
26-else()
27-  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILENAME__=__FILE__")
28-endif()
29+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILENAME__=__FILE__")
30
31 if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "armv7l")
32   set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -latomic")
33--- a/lib/chunkio/CMakeLists.txt
34+++ b/lib/chunkio/CMakeLists.txt
35@@ -14,12 +14,7 @@ else()
36   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall ")
37 endif()
38
39-# Set __FILENAME__
40-if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows")
41-  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILENAME__='\"$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<))\"'")
42-else()
43-  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILENAME__=__FILE__")
44-endif()
45+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILENAME__=__FILE__")
46
47 include(cmake/macros.cmake)
48
49--- a/lib/cmetrics/CMakeLists.txt
50+++ b/lib/cmetrics/CMakeLists.txt
51@@ -34,12 +34,7 @@ set(CMT_VERSION_MINOR  3)
52 set(CMT_VERSION_PATCH  7)
53 set(CMT_VERSION_STR "${CMT_VERSION_MAJOR}.${CMT_VERSION_MINOR}.${CMT_VERSION_PATCH}")
54
55-# Define __CMT_FILENAME__ consistently across Operating Systems
56-if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows")
57-  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__CMT_FILENAME__='\"$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<))\"'")
58-else()
59-  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__CMT_FILENAME__=__FILE__")
60-endif()
61+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__CMT_FILENAME__=__FILE__")
62
63 # Configuration options
64 option(CMT_DEV                       "Enable development mode"                   No)
65