This repository has been archived by the owner on Nov 20, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
Example: Lua module
drahosp edited this page Aug 25, 2012
·
5 revisions
The CMake script for installing pure modules is easy.
All you have to do is:
- define project information editing the
dist.info
file. - copy the cmake macro folder directory from our utilities
- write commands for installing module's files in the
CMakeLists.txt
file.
Here is an commented example fo the Abelhas module:
# Define projects name
# The NONE tells CMake to not check for compilers as they are not needed
project ( abelhas NONE )
# Define minimun version of CMake for compatibility
cmake_minimum_required ( VERSION 2.8 )
# Include our macros.
# Notice that once dist.cmake is loaded there is no need to directly point to files.
# Every cmake file and find package script can be used directly if placed in cmake/ folder.
include ( cmake/dist.cmake )
include ( lua )
# All is set up, so install:
# First argument is the require name. Second argument is the source of the module.
install_lua_module ( pso pso.lua )
# or: install_lua_module ( pso.submodule src/pso_submodule.lua )
# LuaDist will take care of the installation and renaming automatically
# Install files README COPYING to data directory (share/abelhas)
install_data ( README COPYING )
# Install all files from examples directory into the default destination folder (share/abelhas/example)
install_example ( examples/ )
# Install the content of the doc directory into the default documentation folder (share/abelhas/doc)
install_doc ( doc/ )
That's all. Alternatively you can use CMake INSTALL command and install using INSTALL_* variables, but the included macro simplifies things considerably.
If you want to install a lua based application simply call:
install_lua_executable ( app_name src/app.lua )
LuaDist will automatically generate a binary executable for your application.