libubox: lua: use pkg-config built in module to search for alternatives
authorKarl Palsson <karlp@remake.is>
Thu, 24 Sep 2015 15:14:04 +0000 (15:14 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 22 Nov 2015 12:17:07 +0000 (13:17 +0100)
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@remake.is>
lua/CMakeLists.txt

index 10c6dc15dd64c2506ce10c0cc610c59acfcb5bd1..34c9ab187ff3bacc0cc528ac5e1e9612cd3eaec2 100644 (file)
@@ -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})