From 7bf3f1411507859e51d62d285f777938780d42e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Draho=C5=A1?= Date: Sun, 20 Mar 2011 18:13:13 +0100 Subject: Updated install defaults. Now only LUA_ROOT needs to be changed LUA_CDIR and LUA_LDIR are now automated --- CMakeLists.txt | 19 +++++++++---------- src/luaconf.h.in | 6 ++++-- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 60fe588..6db4251 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,16 +23,21 @@ set ( LUA_MAXINPUT 512 CACHE NUMBER "Is the maximum length for an input line in #2DO: LUAI_* and LUAL_* settings, for now defaults are used. +set ( LUA_DIRSEP "/" ) +set ( LUA_MODULE_SUFFIX ${CMAKE_SHARED_MODULE_SUFFIX} ) +set ( LUA_ROOT ${CMAKE_INSTALL_PREFIX} CACHE STRING "Destination from which modules will be resolved. See INSTALL_LMOD and INSTALL_CMOD.") +set ( LUA_LDIR ${INSTALL_LMOD} ) +set ( LUA_CDIR ${INSTALL_CMOD} ) + if ( WIN32 AND NOT CYGWIN ) # Windows systems option ( LUA_WIN "Windows specific build." ON ) option ( LUA_BUILD_AS_DLL "Build Lua library as Dll." ON ) # Paths (Double escapes needed) set ( LUA_DIRSEP "\\\\" ) - set ( LUA_LDIR "!\\\\lua\\\\" CACHE STRING "Pure Lua module location." ) - set ( LUA_CDIR "!\\\\" CACHE STRING "Binary Lua module location." ) - set ( LUA_PATH_DEFAULT ".\\\\?.lua;${LUA_LDIR}?.lua;${LUA_LDIR}?\\\\init.lua;${LUA_CDIR}?.lua;${LUA_CDIR}?\\\\init.lua" ) - set ( LUA_CPATH_DEFAULT ".\\\\?${CMAKE_SHARED_MODULE_SUFFIX};${LUA_CDIR}?${CMAKE_SHARED_MODULE_SUFFIX};${LUA_CDIR}loadall${CMAKE_SHARED_MODULE_SUFFIX}" ) + string ( REPLACE "/" ${LUA_DIRSEP} LUA_ROOT ${LUA_ROOT} ) + string ( REPLACE "/" ${LUA_DIRSEP} LUA_LDIR ${LUA_LDIR} ) + string ( REPLACE "/" ${LUA_DIRSEP} LUA_CDIR ${LUA_CDIR} ) else () # Posix systems (incl. Cygwin) option ( LUA_USE_POSIX "Use POSIX functionality." ON ) @@ -41,12 +46,6 @@ else () option ( LUA_USE_ISATTY "Use tty." ON ) option ( LUA_USE_POPEN "Use popen." ON ) option ( LUA_USE_ULONGJMP "Use ulongjmp" ON) - # Paths - set ( LUA_DIRSEP "/" ) - set ( LUA_LDIR "${CMAKE_INSTALL_PREFIX}/share/lua/5.1/" CACHE STRING "Pure Lua module location." ) - set ( LUA_CDIR "${CMAKE_INSTALL_PREFIX}/lib/lua/5.1/" CACHE STRING "Binary Lua module location." ) - set ( LUA_PATH_DEFAULT "./?.lua;${LUA_LDIR}?.lua;${LUA_LDIR}?/init.lua;${LUA_CDIR}?.lua;${LUA_CDIR}?/init.lua" ) - set ( LUA_CPATH_DEFAULT "./?${CMAKE_SHARED_MODULE_SUFFIX};${LUA_CDIR}?${CMAKE_SHARED_MODULE_SUFFIX};${LUA_CDIR}loadall${CMAKE_SHARED_MODULE_SUFFIX}" ) endif () ## SETUP diff --git a/src/luaconf.h.in b/src/luaconf.h.in index 1e7c39a..027691d 100644 --- a/src/luaconf.h.in +++ b/src/luaconf.h.in @@ -63,11 +63,13 @@ ** Any exclamation mark ('!') in the path is replaced by the ** path of the directory of the executable file of the current process. */ +#cmakedefine LUA_MODULE_SUFFIX "@LUA_MODULE_SUFFIX@" #cmakedefine LUA_ROOT "@LUA_ROOT@" #cmakedefine LUA_LDIR "@LUA_LDIR@" #cmakedefine LUA_CDIR "@LUA_CDIR@" -#cmakedefine LUA_PATH_DEFAULT "@LUA_PATH_DEFAULT@" -#cmakedefine LUA_CPATH_DEFAULT "@LUA_CPATH_DEFAULT@" + +#define LUA_PATH_DEFAULT "./?.lua;" LUA_ROOT "/" LUA_LDIR "/?.lua;" LUA_ROOT "/" LUA_LDIR "/?/init.lua" +#define LUA_CPATH_DEFAULT "./?" LUA_MODULE_SUFFIX ";" LUA_ROOT "/" LUA_CDIR "/?" LUA_MODULE_SUFFIX ";" LUA_ROOT "/" LUA_CDIR "/loadall" LUA_MODULE_SUFFIX /* @@ LUA_DIRSEP is the directory separator (for submodules). -- cgit v1.2.1