lua: use pkg-config to find the correct lua cflags
authorFelix Fietkau <nbd@openwrt.org>
Thu, 15 Sep 2011 14:39:05 +0000 (16:39 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Thu, 15 Sep 2011 14:39:05 +0000 (16:39 +0200)
lua/CMakeLists.txt

index a532fc1e546a9b7bd3a03225420338297f7be9a1..7edfd0a00133a0d8b34b8ced55e768a3bb77d30f 100644 (file)
@@ -4,7 +4,16 @@ PROJECT(uci C)
 
 SET(CMAKE_INSTALL_PREFIX /)
 
-ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -I..)
+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()
+
+ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -I.. ${LUA_CFLAGS})
 LINK_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/..)
 
 IF(APPLE)