projects/uci: lua: use built in pkg-config support for alternatives
authorKarl Palsson <karlp@remake.is>
Fri, 15 Apr 2016 15:12:18 +0000 (15:12 +0000)
committerJohn Crispin <blogic@openwrt.org>
Fri, 22 Apr 2016 20:08:31 +0000 (22:08 +0200)
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 4ba8e37c860cd6250f0b8fe82e4a1d27f11cfbb1..b9f513a9c044464b792f28471fd0d278f47d5d25 100644 (file)
@@ -5,14 +5,8 @@ PROJECT(uci 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()
+       INCLUDE(FindPkgConfig)
+       pkg_search_module(LUA lua5.1 lua-5.1)
 ENDIF()
 
 ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -I.. ${LUA_CFLAGS})