From e2103d0beaf5ed5e4de1ef219b3de9792b819090 Mon Sep 17 00:00:00 2001 From: Kyle Cooley Date: Thu, 4 Jan 2018 21:40:17 -0500 Subject: [PATCH] Clean up find file for LuaJit, add one for Sol2 --- apps/openmw-mp/CMakeLists.txt | 7 +++---- cmake/FindLuaJit.cmake | 26 +++++++++----------------- cmake/FindSol2.cmake | 11 +++++++++++ 3 files changed, 23 insertions(+), 21 deletions(-) create mode 100644 cmake/FindSol2.cmake diff --git a/apps/openmw-mp/CMakeLists.txt b/apps/openmw-mp/CMakeLists.txt index 520d38c01..ec0280b0e 100644 --- a/apps/openmw-mp/CMakeLists.txt +++ b/apps/openmw-mp/CMakeLists.txt @@ -17,11 +17,11 @@ endif(ENABLE_BREAKPAD) find_package(LuaJit REQUIRED) +find_package(Sol2 REQUIRED) -set(LuaScript_Headers ${LUA_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/extern/sol/sol.hpp) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_LUA") -include_directories(${LUA_INCLUDE_DIR} ${LUAJIT_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/extern/sol) +include_directories(${LuaJit_INCLUDE_DIR} ${Sol2_INCLUDE_DIR}) # local files @@ -145,8 +145,7 @@ target_link_libraries(tes3mp-server #${Boost_PROGRAM_OPTIONS_LIBRARY} ${RakNet_LIBRARY} components - ${LUA_LIBRARIES} - ${LUAJIT_LIBRARY} + ${LuaJit_LIBRARIES} ${Breakpad_Library} ) diff --git a/cmake/FindLuaJit.cmake b/cmake/FindLuaJit.cmake index de3fb8ab6..c05c3a809 100644 --- a/cmake/FindLuaJit.cmake +++ b/cmake/FindLuaJit.cmake @@ -1,22 +1,14 @@ -include(LibFindMacros) - -# Use pkg-config to get hints about paths -libfind_pkg_check_modules(LUAJIT_PKGCONF luajit) +# Once found, defines: +# LuaJit_FOUND +# LuaJit_INCLUDE_DIRS +# LuaJit_LIBRARIES -find_path(LUAJIT_INCLUDE_DIR - NAMES luajit.h - PATHS ${LUAJIT_PKGCONF_INCLUDE_DIRS} - ) - -find_library(LUAJIT_LIBRARY - NAMES luajit-5.1 luajit - PATHS ${LUAJIT_PKGCONF_LIBRARY_DIRS} - ) +include(LibFindMacros) -set(LUAJIT_PROCESS_INCLUDES LUAJIT_INCLUDE_DIR) -set(LUAJIT_PROCESS_LIBS LUAJIT_LIBRARY) +libfind_pkg_detect(LuaJit luajit + FIND_PATH luajit.h + FIND_LIBRARY NAMES luajit-5.1 luajit +) libfind_process(LuaJit) -set(LUA_LIBRARY LUAJIT_LIBRARY) -set(LUA_INCLUDE_DIR LUAJIT_INCLUDE_DIR) \ No newline at end of file diff --git a/cmake/FindSol2.cmake b/cmake/FindSol2.cmake new file mode 100644 index 000000000..68a6a3447 --- /dev/null +++ b/cmake/FindSol2.cmake @@ -0,0 +1,11 @@ +# Once found, defines: +# Sol2_FOUND +# Sol2_INCLUDE_DIRS + +include(LibFindMacros) + +libfind_pkg_detect(Sol2 sol2 + FIND_PATH sol.hpp +) +libfind_process(Sol2) +