diff --git a/CMakeLists.txt b/CMakeLists.txt index 4bc6072..930bd22 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,15 +32,15 @@ set(CMAKE_INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_INCLUDE_PATH} include(SetBuildParallelLevel) include(SetHardwareArch) -if (ENABLE_LUAJIT_RANDOM_RA AND NOT USE_LUAJIT) +if (ENABLE_LUAJIT_RANDOM_RA AND NOT IS_LUAJIT) message(FATAL_ERROR "Option ENABLE_LUAJIT_RANDOM_RA is LuaJIT-specific.") -endif (ENABLE_LUAJIT_RANDOM_RA AND NOT USE_LUAJIT) +endif (ENABLE_LUAJIT_RANDOM_RA AND NOT IS_LUAJIT) if (USE_LUA AND NOT LUA_VERSION) set(LUA_VERSION "master") endif() -if (USE_LUAJIT AND NOT LUA_VERSION) +if (IS_LUAJIT AND NOT LUA_VERSION) set(LUA_VERSION "v2.1") endif() @@ -50,6 +50,7 @@ if (USE_LUA) elseif (USE_LUAJIT) include(BuildLuaJIT) build_luajit(${LUA_VERSION}) + set(IS_LUAJIT TRUE) elseif (LUA_INCLUDE_DIR AND LUA_LIBRARIES AND LUA_EXECUTABLE AND LUA_VERSION_STRING) message(STATUS "Lua library passed outside:") message(STATUS "LUA_INCLUDE_DIR: ${LUA_INCLUDE_DIR}") diff --git a/tests/capi/CMakeLists.txt b/tests/capi/CMakeLists.txt index 8dcfd4d..00724bd 100644 --- a/tests/capi/CMakeLists.txt +++ b/tests/capi/CMakeLists.txt @@ -74,10 +74,10 @@ function(create_test) # add_dependencies(${test_name} ${LUA_TARGET}) string(REPLACE "_test" "" test_prefix ${test_name}) set(LIBFUZZER_OPTS "${LIBFUZZER_OPTS} -artifact_prefix=${test_name}_") - if (USE_LUAJIT AND (${test_name} STREQUAL "lua_dump_test")) + if (IS_LUAJIT AND (${test_name} STREQUAL "lua_dump_test")) set(LIBFUZZER_OPTS "${LIBFUZZER_OPTS} -only_ascii=1") endif () - if (USE_LUAJIT AND (${test_name} STREQUAL "lua_load_test")) + if (IS_LUAJIT AND (${test_name} STREQUAL "lua_load_test")) set(LIBFUZZER_OPTS "${LIBFUZZER_OPTS} -only_ascii=1") endif () set(dict_path ${PROJECT_SOURCE_DIR}/corpus/${test_name}.dict) @@ -101,9 +101,9 @@ function(create_test) LABELS capi ) - if (USE_LUAJIT) + if (IS_LUAJIT) target_compile_definitions(${test_name} PUBLIC LUAJIT) - endif (USE_LUAJIT) + endif (IS_LUAJIT) endfunction() # These Lua C functions are unsupported by LuaJIT. @@ -121,7 +121,7 @@ list(APPEND LUAJIT_BLACKLIST_TESTS "luaL_loadstring_test") file(GLOB tests LIST_DIRECTORIES false ${CMAKE_CURRENT_SOURCE_DIR} *.c *.cc) foreach(filename ${tests}) get_filename_component(test_name ${filename} NAME_WE) - if (USE_LUAJIT AND (${test_name} IN_LIST LUAJIT_BLACKLIST_TESTS)) + if (IS_LUAJIT AND (${test_name} IN_LIST LUAJIT_BLACKLIST_TESTS)) continue() endif () if ((${test_name} IN_LIST BLACKLIST_TESTS)) @@ -134,6 +134,6 @@ endforeach() include(ProtobufMutator) add_subdirectory(luaL_loadbuffer_proto) -if(USE_LUAJIT) +if(IS_LUAJIT) add_subdirectory(ffi_cdef_proto) endif ()