Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake: Make usage of LUA_PATH in LuaJITAddExecutable depend on it being set #258

Merged
merged 1 commit into from
Jan 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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