From d4dbc18404de3c30e78560f27c92984d8c1d9725 Mon Sep 17 00:00:00 2001 From: Soonho Kong Date: Fri, 8 Nov 2013 18:04:55 -0500 Subject: [PATCH] chore(cmake/Modules/FindLua): disable TRY_RUN in cross-compilation. --- src/cmake/Modules/FindLua.cmake | 49 +++++++++++++++++---------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/src/cmake/Modules/FindLua.cmake b/src/cmake/Modules/FindLua.cmake index 681f9fb72..93f4a1af0 100644 --- a/src/cmake/Modules/FindLua.cmake +++ b/src/cmake/Modules/FindLua.cmake @@ -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 ()