summarylogtreecommitdiffstats
path: root/0002-cmake-install-tags.py-properly.patch
blob: a19cbafd4eb1039f95be3a59a04ec91c72cf4527 (plain)
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
33
34
35
36
37
38
39
40
41
From 9522bc49bedac337d79866bdf5dc0828da0d972c Mon Sep 17 00:00:00 2001
From: Xiretza <xiretza@xiretza.xyz>
Date: Sat, 4 Jun 2022 19:35:34 +0200
Subject: [PATCH 2/9] cmake: install tags.py properly

Signed-off-by: Xiretza <xiretza@xiretza.xyz>
---
 src/CMakeLists.txt | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2fdc164..596949d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -80,13 +80,15 @@ antlr_target(FasmParser antlr/FasmParser.g4 PARSER VISITOR
 # line 1: Skip lines starting in #define
 #      2: Extract TAGS(...) from dependencies
 #      3: Convert from TAGS('c', long_name) -> long_name = b'c, write to file
-add_custom_target(tags.py ALL
+add_custom_command(OUTPUT tags.py
   COMMAND grep -ve ^\#define ${CMAKE_CURRENT_SOURCE_DIR}/ParseFasm.cpp |
           grep -hoe TAG\([^\)]*\) |
-          sed -e s/TAG\(\\\(.*\\\),\ \\\(.*\\\)\)/\\2\ =\ b\\1/ > tags.py
+          sed -e s/TAG\(\\\(.*\\\),\ \\\(.*\\\)\)/\\2\ =\ b\\1/ > ${CMAKE_CURRENT_BINARY_DIR}/tags.py
   DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ParseFasm.cpp
   VERBATIM
   )
+add_custom_target(tags_py ALL DEPENDS tags.py)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tags.py TYPE LIB)
 
 # Include generated files in project environment
 include_directories(${ANTLR_FasmLexer_OUTPUT_DIR})
@@ -123,5 +125,3 @@ include(CTest)
 add_test(NAME parse_fasm_tests
          COMMAND parse_fasm_tests)
 enable_testing()
-
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tags.py DESTINATION .)
-- 
2.36.1