Skip to content

Commit bc5e05f

Browse files
committed
cmake: introduce IS_LUAJIT
1 parent 0fb1e8f commit bc5e05f

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ set(CMAKE_INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_INCLUDE_PATH}
3232
include(SetBuildParallelLevel)
3333
include(SetHardwareArch)
3434

35-
if (ENABLE_LUAJIT_RANDOM_RA AND NOT USE_LUAJIT)
35+
if (ENABLE_LUAJIT_RANDOM_RA AND NOT IS_LUAJIT)
3636
message(FATAL_ERROR "Option ENABLE_LUAJIT_RANDOM_RA is LuaJIT-specific.")
37-
endif (ENABLE_LUAJIT_RANDOM_RA AND NOT USE_LUAJIT)
37+
endif (ENABLE_LUAJIT_RANDOM_RA AND NOT IS_LUAJIT)
3838

3939
if (USE_LUA AND NOT LUA_VERSION)
4040
set(LUA_VERSION "master")
@@ -50,6 +50,7 @@ if (USE_LUA)
5050
elseif (USE_LUAJIT)
5151
include(BuildLuaJIT)
5252
build_luajit(${LUA_VERSION})
53+
set(IS_LUAJIT TRUE)
5354
else ()
5455
message(FATAL_ERROR "No Lua is specified.")
5556
endif ()

tests/capi/CMakeLists.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ function(create_test)
7474
add_dependencies(${test_name} ${LUA_LIBRARIES})
7575
string(REPLACE "_test" "" test_prefix ${test_name})
7676
set(LIBFUZZER_OPTS "${LIBFUZZER_OPTS} -artifact_prefix=${test_name}_")
77-
if (USE_LUAJIT AND (${test_name} STREQUAL "lua_dump_test"))
77+
if (IS_LUAJIT AND (${test_name} STREQUAL "lua_dump_test"))
7878
set(LIBFUZZER_OPTS "${LIBFUZZER_OPTS} -only_ascii=1")
7979
endif ()
80-
if (USE_LUAJIT AND (${test_name} STREQUAL "lua_load_test"))
80+
if (IS_LUAJIT AND (${test_name} STREQUAL "lua_load_test"))
8181
set(LIBFUZZER_OPTS "${LIBFUZZER_OPTS} -only_ascii=1")
8282
endif ()
8383
set(dict_path ${PROJECT_SOURCE_DIR}/corpus/${test_name}.dict)
@@ -101,9 +101,9 @@ function(create_test)
101101
LABELS capi
102102
)
103103

104-
if (USE_LUAJIT)
104+
if (IS_LUAJIT)
105105
target_compile_definitions(${test_name} PUBLIC LUAJIT)
106-
endif (USE_LUAJIT)
106+
endif (IS_LUAJIT)
107107
endfunction()
108108

109109
# These Lua C functions are unsupported by LuaJIT.
@@ -121,7 +121,7 @@ list(APPEND LUAJIT_BLACKLIST_TESTS "luaL_loadstring_test")
121121
file(GLOB tests LIST_DIRECTORIES false ${CMAKE_CURRENT_SOURCE_DIR} *.c *.cc)
122122
foreach(filename ${tests})
123123
get_filename_component(test_name ${filename} NAME_WE)
124-
if (USE_LUAJIT AND (${test_name} IN_LIST LUAJIT_BLACKLIST_TESTS))
124+
if (IS_LUAJIT AND (${test_name} IN_LIST LUAJIT_BLACKLIST_TESTS))
125125
continue()
126126
endif ()
127127
if ((${test_name} IN_LIST BLACKLIST_TESTS))
@@ -134,6 +134,6 @@ endforeach()
134134

135135
include(ProtobufMutator)
136136
add_subdirectory(luaL_loadbuffer_proto)
137-
if(USE_LUAJIT)
137+
if(IS_LUAJIT)
138138
add_subdirectory(ffi_cdef_proto)
139139
endif ()

0 commit comments

Comments
 (0)