[PATCH 2/2] CMakeLists.txt: use CMAKE_CURRENT_LIST_DIR

Sergey Ponomarev stokito at gmail.com
Tue Jan 19 02:14:17 EST 2021


When building with debuild/fakeroot the build folder is different from sources

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

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"
 )
 
-- 
2.27.0




More information about the openwrt-devel mailing list