1From e4e88c2f55286cf24af230b265d0e059363baa6c Mon Sep 17 00:00:00 2001
2From: Oleksiy Obitotskyy <oobitots@cisco.com>
3Date: Thu, 26 Nov 2020 12:00:43 -0800
4Subject: [PATCH] flex: Remove #line directives
5
6Append --noline option to flex to not
7generate #line directives with absolute file patch.
8
9Upstream-Status: Pending
10Signed-off-by: Oleksiy Obitotskyy <oobitots@cisco.com>
11
12---
13 cmake/modules/FindLEX.cmake | 18 +++++++++++++-----
14 1 file changed, 13 insertions(+), 5 deletions(-)
15
16diff --git a/cmake/modules/FindLEX.cmake b/cmake/modules/FindLEX.cmake
17index 20caa09..174f452 100644
18--- a/cmake/modules/FindLEX.cmake
19+++ b/cmake/modules/FindLEX.cmake
20@@ -32,11 +32,19 @@ MACRO(ADD_LEX_FILES _source _generated)
21       SET(_outc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.c)
22       SET(_outh ${CMAKE_CURRENT_BINARY_DIR}/${_basename}_lex.h)
23
24-      ADD_CUSTOM_COMMAND(
25-        OUTPUT ${_outc} ${_outh}
26-        COMMAND ${LEX_EXECUTABLE} $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:--debug> -o${_outc} --header-file=${_outh} ${_in}
27-        DEPENDS ${_in}
28-      )
29+      IF (DEFINED ENV{SOURCE_DATE_EPOCH})
30+        ADD_CUSTOM_COMMAND(
31+          OUTPUT ${_outc} ${_outh}
32+          COMMAND ${LEX_EXECUTABLE} $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:--debug> --noline -o${_outc} --header-file=${_outh} ${_in}
33+          DEPENDS ${_in}
34+        )
35+      ELSE ()
36+        ADD_CUSTOM_COMMAND(
37+          OUTPUT ${_outc} ${_outh}
38+          COMMAND ${LEX_EXECUTABLE} $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:--debug> -o${_outc} --header-file=${_outh} ${_in}
39+          DEPENDS ${_in}
40+        )
41+      ENDIF ()
42       LIST(APPEND ${_source} ${_in})
43       LIST(APPEND ${_generated} ${_outc})
44       INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
45