Skip to content

Commit

Permalink
CMake: Make usage of LUA_PATH in LuaJITAddExecutable depend on it bei…
Browse files Browse the repository at this point in the history
…ng set (#258)

Should fix #242
  • Loading branch information
squeek502 authored Jan 11, 2022
1 parent f70dd85 commit 06a5c66
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions cmake/Modules/LuaJITAddExecutable.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,28 @@ MACRO(LUAJIT_add_custom_commands luajit_target)

set(generated_file "${CMAKE_BINARY_DIR}/jitted_tmp/${stripped_file}_${luajit_target}_generated${CMAKE_C_OUTPUT_EXTENSION}")

add_custom_command(
OUTPUT ${generated_file}
MAIN_DEPENDENCY ${source_file}
COMMAND "LUA_PATH=${LUA_PATH}" luajit
ARGS -b ${LJ_BYTECODE_OPTS}
${source_file}
${generated_file}
COMMENT "Building Luajitted ${source_file}: ${generated_file}"
)
# Only use LUA_PATH if it's set
IF(LUA_PATH)
add_custom_command(
OUTPUT ${generated_file}
MAIN_DEPENDENCY ${source_file}
COMMAND "LUA_PATH=${LUA_PATH}" luajit
ARGS -b ${LJ_BYTECODE_OPTS}
${source_file}
${generated_file}
COMMENT "Building Luajitted ${source_file}: ${generated_file}"
)
ELSE()
add_custom_command(
OUTPUT ${generated_file}
MAIN_DEPENDENCY ${source_file}
COMMAND luajit
ARGS -b ${LJ_BYTECODE_OPTS}
${source_file}
${generated_file}
COMMENT "Building Luajitted ${source_file}: ${generated_file}"
)
ENDIF()

get_filename_component(basedir ${generated_file} PATH)
file(MAKE_DIRECTORY ${basedir})
Expand Down

0 comments on commit 06a5c66

Please sign in to comment.