From 7b7324bdb979d0cdd4010d81f694164229ae0aa1 Mon Sep 17 00:00:00 2001 From: Aki Date: Sun, 8 Sep 2024 14:27:05 +0200 Subject: CMOD and LMOD paths for CMake with GNUInstallDirs --- LuaInstallDirs.cmake | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 LuaInstallDirs.cmake (limited to 'LuaInstallDirs.cmake') diff --git a/LuaInstallDirs.cmake b/LuaInstallDirs.cmake new file mode 100644 index 0000000..86dec32 --- /dev/null +++ b/LuaInstallDirs.cmake @@ -0,0 +1,34 @@ +#[=======================================================================[.rst: +LuaInstallDirs +-------------- + +Define Lua modules installation directories based on GNU standard installation +directories. + +Result variables +^^^^^^^^^^^^^^^^ + +Similarly to GNUInstallDirs this modules defines ``CMAKE_INSTALL_`` and ``CMAKE_INSTALL_FULL_``. Refer to +GNUInstallDirs for detailed explanation. Here, ```` is one of: + +``LUA_CMOD`` + C-modules for use in Lua +``LUA_LMOD`` + Pure Lua modules +#]=======================================================================] +cmake_policy(PUSH) +cmake_policy(VERSION 3.20) # 3rd argument in GNUInstallDirs_get_absolute_install_dir +set(LUA_VERSION "5.4" CACHE STRING "Lua version in major.minor format") # MAYBE: Cooperate with FindLua +include(GNUInstallDirs) # MAYBE: Consider GNUInstallDirs as optional +set( + CMAKE_INSTALL_LUA_CMOD "${CMAKE_INSTALL_LIBDIR}/lua/${LUA_VERSION}" CACHE FILEPATH + "Path to install Lua C-modules to") +set( + CMAKE_INSTALL_LUA_LMOD "${CMAKE_INSTALL_DATADIR}/lua/${LUA_VERSION}" CACHE FILEPATH + "Path to install pure Lua modules to") +mark_as_advanced( + CMAKE_INSTALL_LUA_CMOD + CMAKE_INSTALL_LUA_LMOD) +GNUInstallDirs_get_absolute_install_dir(CMAKE_INSTALL_FULL_LUA_CMOD CMAKE_INSTALL_LUA_CMOD LIBDIR) +GNUInstallDirs_get_absolute_install_dir(CMAKE_INSTALL_FULL_LUA_LMOD CMAKE_INSTALL_LUA_LMOD DATADIR) +cmake_policy(POP) -- cgit v1.1