diff options
author | Aki <please@ignore.pl> | 2024-09-08 14:27:05 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2024-09-08 14:27:05 +0200 |
commit | 7b7324bdb979d0cdd4010d81f694164229ae0aa1 (patch) | |
tree | 56093776633f9d1c191e606b603dbfd7bed236e8 | |
download | cmake-lua-install-dirs-7b7324bdb979d0cdd4010d81f694164229ae0aa1.zip cmake-lua-install-dirs-7b7324bdb979d0cdd4010d81f694164229ae0aa1.tar.gz cmake-lua-install-dirs-7b7324bdb979d0cdd4010d81f694164229ae0aa1.tar.bz2 |
-rw-r--r-- | LuaInstallDirs.cmake | 34 | ||||
-rw-r--r-- | Makefile | 14 |
2 files changed, 48 insertions, 0 deletions
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_<dir>`` and ``CMAKE_INSTALL_FULL_<dir>``. Refer to +GNUInstallDirs for detailed explanation. Here, ``<dir>`` 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) diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9006bee --- /dev/null +++ b/Makefile @@ -0,0 +1,14 @@ +PREFIX=/usr/local +DATADIR=$(PREFIX)/share +MODULESDIR=$(DATADIR)/cmake/Modules + +all: + @echo Nothing to do + +install: + install -m644 -Dt $(DESTDIR)$(MODULESDIR) LuaInstallDirs.cmake + +uninstall: + rm -f $(DESTDIR)$(MODULESDIR)/LuaInstallDirs.cmake + +.PHONY: all install uninstall |