diff mbox series

[2/2] CMakeLists.txt: use CMAKE_CURRENT_LIST_DIR

Message ID 20210119071417.17038-2-stokito@gmail.com
State New
Headers show
Series [1/2] jsonfilter: drop legacy json-c support | expand

Commit Message

Sergey Ponomarev Jan. 19, 2021, 7:14 a.m. UTC
When building with debuild/fakeroot the build folder is different from sources

Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
---
 CMakeLists.txt | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/CMakeLists.txt b/CMakeLists.txt
index dbfbf5d..44ebe3e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,16 +19,16 @@  IF(JSONC_FOUND)
 ENDIF()
 
 ADD_CUSTOM_COMMAND(
-  OUTPUT contrib/lemon
-  DEPENDS contrib/lemon.c contrib/lempar.c
-  COMMAND gcc -o contrib/lemon contrib/lemon.c
+  OUTPUT ${CMAKE_CURRENT_LIST_DIR}/contrib/lemon
+  DEPENDS ${CMAKE_CURRENT_LIST_DIR}/contrib/lemon.c ${CMAKE_CURRENT_LIST_DIR}/contrib/lempar.c
+  COMMAND gcc -o ${CMAKE_CURRENT_LIST_DIR}/contrib/lemon ${CMAKE_CURRENT_LIST_DIR}/contrib/lemon.c
   COMMENT "Generating lemon parser generator"
 )
 
 ADD_CUSTOM_COMMAND(
-  OUTPUT parser.c
-  DEPENDS parser.y contrib/lemon
-  COMMAND ./contrib/lemon parser.y
+  OUTPUT ${CMAKE_CURRENT_LIST_DIR}/parser.c
+  DEPENDS ${CMAKE_CURRENT_LIST_DIR}/parser.y ${CMAKE_CURRENT_LIST_DIR}/contrib/lemon
+  COMMAND ${CMAKE_CURRENT_LIST_DIR}/contrib/lemon ${CMAKE_CURRENT_LIST_DIR}/parser.y
   COMMENT "Generating parser.c"
 )