[OpenWrt-Devel] [PATCH uci 06/18] cmake: build Lua module only if enabled
Petr Štetiar
ynezz at true.cz
Mon Nov 4 19:36:45 EST 2019
Makes the resulting lua/CMakeLists.txt file simpler.
Signed-off-by: Petr Štetiar <ynezz at true.cz>
---
CMakeLists.txt | 4 +++-
lua/CMakeLists.txt | 32 ++++++++++++--------------------
2 files changed, 15 insertions(+), 21 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2559b1ec1507..0bbd3b2046ec 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,7 +41,9 @@ ENDIF(BUILD_STATIC)
ADD_LIBRARY(ucimap STATIC ucimap.c)
-ADD_SUBDIRECTORY(lua)
+IF(BUILD_LUA)
+ ADD_SUBDIRECTORY(lua)
+ENDIF()
IF(UNIT_TESTING)
ENABLE_TESTING()
diff --git a/lua/CMakeLists.txt b/lua/CMakeLists.txt
index b9f513a9c044..96b122aa5029 100644
--- a/lua/CMakeLists.txt
+++ b/lua/CMakeLists.txt
@@ -15,12 +15,9 @@ LINK_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/..)
IF(APPLE)
INCLUDE_DIRECTORIES(/opt/local/include)
LINK_DIRECTORIES(/opt/local/lib)
+ SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -undefined dynamic_lookup")
ENDIF()
-IF(APPLE)
- SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -undefined dynamic_lookup")
-ENDIF(APPLE)
-
IF(NOT LUAPATH)
EXECUTE_PROCESS(
COMMAND lua -e "for k in string.gmatch(package.cpath .. \";\", \"([^;]+)/..so;\") do if k:sub(1,1) == \"/\" then print(k) break end end"
@@ -29,23 +26,18 @@ IF(NOT LUAPATH)
OUTPUT_STRIP_TRAILING_WHITESPACE
)
- IF(BUILD_LUA)
- IF(NOT ${LUA_CHECK_RES} EQUAL 0 OR "${LUAPATH}" EQUAL "")
- MESSAGE(SEND_ERROR "Lua was not found on your system")
- ENDIF()
+ IF(NOT ${LUA_CHECK_RES} EQUAL 0 OR "${LUAPATH}" EQUAL "")
+ MESSAGE(SEND_ERROR "Lua was not found on your system")
ENDIF()
ENDIF()
-IF(BUILD_LUA)
- ADD_LIBRARY(uci_lua MODULE uci.c)
- SET_TARGET_PROPERTIES(uci_lua PROPERTIES
- OUTPUT_NAME uci
- PREFIX ""
- )
- TARGET_LINK_LIBRARIES(uci_lua uci dl)
-
- INSTALL(TARGETS uci_lua
- LIBRARY DESTINATION ${LUAPATH}
- )
-ENDIF()
+ADD_LIBRARY(uci_lua MODULE uci.c)
+SET_TARGET_PROPERTIES(uci_lua PROPERTIES
+ OUTPUT_NAME uci
+ PREFIX ""
+)
+TARGET_LINK_LIBRARIES(uci_lua uci dl)
+INSTALL(TARGETS uci_lua
+ LIBRARY DESTINATION ${LUAPATH}
+)
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list