From 7d889277b4b0ea154f48a6dea9b261db2e163098 Mon Sep 17 00:00:00 2001 From: Vicent Marti Date: Thu, 31 Mar 2016 02:58:49 +0200 Subject: [PATCH] cmake: Build bcc-lua conditionally --- src/lua/CMakeLists.txt | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/src/lua/CMakeLists.txt b/src/lua/CMakeLists.txt index 599c954..9c31a25 100644 --- a/src/lua/CMakeLists.txt +++ b/src/lua/CMakeLists.txt @@ -1,22 +1,24 @@ include(cmake/FindLuaJIT.cmake) -find_program(LUAJIT luajit) -FILE(GLOB_RECURSE SRC_LUA ${CMAKE_CURRENT_SOURCE_DIR}/bcc/*/*.lua) +if (LUAJIT_LIBRARIES) + find_program(LUAJIT luajit) + FILE(GLOB_RECURSE SRC_LUA ${CMAKE_CURRENT_SOURCE_DIR}/bcc/*/*.lua) -ADD_CUSTOM_COMMAND( - OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/src/bcc.lua - COMMAND ${LUAJIT} src/squish.lua - DEPENDS ${SRC_LUA} ${CMAKE_CURRENT_SOURCE_DIR}/squishy - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} -) + ADD_CUSTOM_COMMAND( + OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/src/bcc.lua + COMMAND ${LUAJIT} src/squish.lua + DEPENDS ${SRC_LUA} ${CMAKE_CURRENT_SOURCE_DIR}/squishy + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + ) -ADD_CUSTOM_COMMAND( - OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/src/bcc.o - COMMAND ${LUAJIT} -bg src/bcc.lua src/bcc.o - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/bcc.lua - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} -) + ADD_CUSTOM_COMMAND( + OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/src/bcc.o + COMMAND ${LUAJIT} -bg src/bcc.lua src/bcc.o + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/bcc.lua + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + ) -include_directories(${LUAJIT_INCLUDE_DIR}) -add_executable(bcc-lua src/main.c src/bcc.o) -target_link_libraries(bcc-lua ${LUAJIT_LIBRARIES}) + include_directories(${LUAJIT_INCLUDE_DIR}) + add_executable(bcc-lua src/main.c src/bcc.o) + target_link_libraries(bcc-lua ${LUAJIT_LIBRARIES}) +endif() -- 2.7.4