You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

FindThirdPartyLua.cmake 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # ---------------------------------
  2. # Finds LUA
  3. # Adds library to target
  4. # Adds include path
  5. # ---------------------------------
  6. GET_PROPERTY(OV_PRINTED GLOBAL PROPERTY OV_TRIED_ThirdPartyLua)
  7. IF(WIN32)
  8. FIND_PATH(LUA_INCLUDE_DIR lua.h PATHS ${LIST_DEPENDENCIES_PATH} PATH_SUFFIXES lua/include NO_DEFAULT_PATH)
  9. ELSEIF(UNIX)
  10. if(${CMAKE_SYSTEM} MATCHES fc21)
  11. FIND_PACKAGE(Lua REQUIRED)
  12. else ()
  13. FIND_PACKAGE(Lua51 REQUIRED)
  14. endif()
  15. ENDIF()
  16. IF(LUA_INCLUDE_DIR)
  17. OV_PRINT(OV_PRINTED " Found Lua... in '${LUA_INCLUDE_DIR}'")
  18. IF(WIN32)
  19. FIND_LIBRARY(LUA_LIBRARIES lua5.1 PATHS ${LUA_INCLUDE_DIR}/../lib NO_DEFAULT_PATH)
  20. FIND_LIBRARY(LUA_LIBRARIES lua5.1 PATHS ${LUA_INCLUDE_DIR}/../lib)
  21. ENDIF()
  22. IF(LUA_LIBRARIES)
  23. OV_PRINT(OV_PRINTED " [ OK ] lib ${LUA_LIBRARIES}")
  24. INCLUDE_DIRECTORIES(${LUA_INCLUDE_DIR})
  25. TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LUA_LIBRARIES})
  26. ADD_DEFINITIONS(-DTARGET_HAS_ThirdPartyLua)
  27. IF(WIN32)
  28. INSTALL(FILES "${LUA_INCLUDE_DIR}/../bin/lua5.1.dll" DESTINATION "${DIST_BINDIR}")
  29. ENDIF()
  30. ELSE()
  31. OV_PRINT(OV_PRINTED " [FAILED] lib lua5.1")
  32. ENDIF()
  33. ELSE()
  34. OV_PRINT(OV_PRINTED " FAILED to find Lua")
  35. ENDIF()
  36. SET_PROPERTY(GLOBAL PROPERTY OV_TRIED_ThirdPartyLua "Yes")