chore(cmake/Modules/FindLua): disable TRY_RUN in cross-compilation.

This commit is contained in:
Soonho Kong 2013-11-08 18:04:55 -05:00
parent bbab454b6c
commit d4dbc18404

View file

@ -118,30 +118,33 @@ MARK_AS_ADVANCED(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY LUA_
# Print out version number
if (LUA_FOUND)
try_run(LUA_CHECK LUA_CHECK_BUILD
${LEAN_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
${LEAN_SOURCE_DIR}/cmake/Modules/CheckLuaNewstate.cc
CMAKE_FLAGS -DINCLUDE_DIRECTORIES=${LUA_INCLUDE_DIR}
-DLINK_LIBRARIES=${LUA_LIBRARIES}
RUN_OUTPUT_VARIABLE LUA_TRY_OUT)
if ("${LUA_CHECK}" MATCHES "0" AND "${LUA_CHECK_BUILD}$" MATCHES "TRUE")
message(STATUS "lua_newstate works")
set(HAS_LUA_NEWSTATE TRUE)
if (CMAKE_CROSSCOMPILING)
message(STATUS "Cross-compiling: can't find whether lua_objlen or lua_newstate is available.")
else()
message(STATUS "lua_newstate is not supported by your Lua engine, Lean will not be able to track memory consumed by the Lua engine")
endif()
try_run(LUA_CHECK LUA_CHECK_BUILD
${LEAN_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
${LEAN_SOURCE_DIR}/cmake/Modules/CheckLuaNewstate.cc
CMAKE_FLAGS -DINCLUDE_DIRECTORIES=${LUA_INCLUDE_DIR}
-DLINK_LIBRARIES=${LUA_LIBRARIES}
RUN_OUTPUT_VARIABLE LUA_TRY_OUT)
if ("${LUA_CHECK}" MATCHES "0" AND "${LUA_CHECK_BUILD}$" MATCHES "TRUE")
message(STATUS "lua_newstate works")
set(HAS_LUA_NEWSTATE TRUE)
else()
message(STATUS "lua_newstate is not supported by your Lua engine, Lean will not be able to track memory consumed by the Lua engine")
endif()
try_run(LUA_CHECK2 LUA_CHECK_BUILD2
${LEAN_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
${LEAN_SOURCE_DIR}/cmake/Modules/CheckLuaObjlen.cc
CMAKE_FLAGS -DINCLUDE_DIRECTORIES=${LUA_INCLUDE_DIR}
-DLINK_LIBRARIES=${LUA_LIBRARIES}
RUN_OUTPUT_VARIABLE LUA_TRY_OUT)
if ("${LUA_CHECK2}" MATCHES "0" AND "${LUA_CHECK_BUILD2}$" MATCHES "TRUE")
message(STATUS "lua_objlen found")
set(HAS_LUA_OBJLEN TRUE)
else()
message(STATUS "lua_objlen is not available, using lua_rawlen instead")
try_run(LUA_CHECK2 LUA_CHECK_BUILD2
${LEAN_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
${LEAN_SOURCE_DIR}/cmake/Modules/CheckLuaObjlen.cc
CMAKE_FLAGS -DINCLUDE_DIRECTORIES=${LUA_INCLUDE_DIR}
-DLINK_LIBRARIES=${LUA_LIBRARIES}
RUN_OUTPUT_VARIABLE LUA_TRY_OUT)
if ("${LUA_CHECK2}" MATCHES "0" AND "${LUA_CHECK_BUILD2}$" MATCHES "TRUE")
message(STATUS "lua_objlen found")
set(HAS_LUA_OBJLEN TRUE)
else()
message(STATUS "lua_objlen is not available, using lua_rawlen instead")
endif()
endif()
endif ()