[OpenWrt-Devel] [PATCH] libubox: lua: use pkg-config built in module to search for alternatives

Karl Palsson karlp at tweak.net.au
Thu Sep 24 11:14:04 EDT 2015


From: Karl Palsson <karlp at remake.is>

Different distributions have different names for the lua 5.1 package.
Use cmake's built in pkg-config support to search for the first one,
rather than running it explicitly and searching for a single version.

Signed-off-by: Karl Palsson <karlp at remake.is>
---

Resending after running into this again on a fresh Fedora 22 install.

There's a line further down that attempts to invoke "lua" that also
fails if you have multiple versions of lua installed.  I'm not sure
how best to fix that though, other than to just remove it as a check.

Perhaps if you you want to enable/disable the lua building, use cmake
features for that, rather than testing for an executable lua?

 lua/CMakeLists.txt | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/lua/CMakeLists.txt b/lua/CMakeLists.txt
index 10c6dc1..34c9ab1 100644
--- a/lua/CMakeLists.txt
+++ b/lua/CMakeLists.txt
@@ -5,14 +5,7 @@ PROJECT(uloop C)
 SET(CMAKE_INSTALL_PREFIX /)
 
 IF(NOT LUA_CFLAGS)
-	FIND_PROGRAM(PKG_CONFIG pkg-config)
-	IF(PKG_CONFIG)
-		EXECUTE_PROCESS(
-			COMMAND pkg-config --silence-errors --cflags lua5.1
-			OUTPUT_VARIABLE LUA_CFLAGS
-			OUTPUT_STRIP_TRAILING_WHITESPACE
-		)
-	ENDIF()
+	pkg_search_module(LUA lua5.1 lua-5.1)
 ENDIF()
 
 ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -I.. ${LUA_CFLAGS})
-- 
2.1.0
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list