Skip to content
This repository was archived by the owner on Nov 20, 2020. It is now read-only.

Commit 7bf3f14

Browse files
committed
Updated install defaults. Now only LUA_ROOT needs to be changed LUA_CDIR and LUA_LDIR are now automated
1 parent 6ea5c6d commit 7bf3f14

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

CMakeLists.txt

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,21 @@ set ( LUA_MAXINPUT 512 CACHE NUMBER "Is the maximum length for an input line in
2323

2424
#2DO: LUAI_* and LUAL_* settings, for now defaults are used.
2525

26+
set ( LUA_DIRSEP "/" )
27+
set ( LUA_MODULE_SUFFIX ${CMAKE_SHARED_MODULE_SUFFIX} )
28+
set ( LUA_ROOT ${CMAKE_INSTALL_PREFIX} CACHE STRING "Destination from which modules will be resolved. See INSTALL_LMOD and INSTALL_CMOD.")
29+
set ( LUA_LDIR ${INSTALL_LMOD} )
30+
set ( LUA_CDIR ${INSTALL_CMOD} )
31+
2632
if ( WIN32 AND NOT CYGWIN )
2733
# Windows systems
2834
option ( LUA_WIN "Windows specific build." ON )
2935
option ( LUA_BUILD_AS_DLL "Build Lua library as Dll." ON )
3036
# Paths (Double escapes needed)
3137
set ( LUA_DIRSEP "\\\\" )
32-
set ( LUA_LDIR "!\\\\lua\\\\" CACHE STRING "Pure Lua module location." )
33-
set ( LUA_CDIR "!\\\\" CACHE STRING "Binary Lua module location." )
34-
set ( LUA_PATH_DEFAULT ".\\\\?.lua;${LUA_LDIR}?.lua;${LUA_LDIR}?\\\\init.lua;${LUA_CDIR}?.lua;${LUA_CDIR}?\\\\init.lua" )
35-
set ( LUA_CPATH_DEFAULT ".\\\\?${CMAKE_SHARED_MODULE_SUFFIX};${LUA_CDIR}?${CMAKE_SHARED_MODULE_SUFFIX};${LUA_CDIR}loadall${CMAKE_SHARED_MODULE_SUFFIX}" )
38+
string ( REPLACE "/" ${LUA_DIRSEP} LUA_ROOT ${LUA_ROOT} )
39+
string ( REPLACE "/" ${LUA_DIRSEP} LUA_LDIR ${LUA_LDIR} )
40+
string ( REPLACE "/" ${LUA_DIRSEP} LUA_CDIR ${LUA_CDIR} )
3641
else ()
3742
# Posix systems (incl. Cygwin)
3843
option ( LUA_USE_POSIX "Use POSIX functionality." ON )
@@ -41,12 +46,6 @@ else ()
4146
option ( LUA_USE_ISATTY "Use tty." ON )
4247
option ( LUA_USE_POPEN "Use popen." ON )
4348
option ( LUA_USE_ULONGJMP "Use ulongjmp" ON)
44-
# Paths
45-
set ( LUA_DIRSEP "/" )
46-
set ( LUA_LDIR "${CMAKE_INSTALL_PREFIX}/share/lua/5.1/" CACHE STRING "Pure Lua module location." )
47-
set ( LUA_CDIR "${CMAKE_INSTALL_PREFIX}/lib/lua/5.1/" CACHE STRING "Binary Lua module location." )
48-
set ( LUA_PATH_DEFAULT "./?.lua;${LUA_LDIR}?.lua;${LUA_LDIR}?/init.lua;${LUA_CDIR}?.lua;${LUA_CDIR}?/init.lua" )
49-
set ( LUA_CPATH_DEFAULT "./?${CMAKE_SHARED_MODULE_SUFFIX};${LUA_CDIR}?${CMAKE_SHARED_MODULE_SUFFIX};${LUA_CDIR}loadall${CMAKE_SHARED_MODULE_SUFFIX}" )
5049
endif ()
5150

5251
## SETUP

src/luaconf.h.in

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,13 @@
6363
** Any exclamation mark ('!') in the path is replaced by the
6464
** path of the directory of the executable file of the current process.
6565
*/
66+
#cmakedefine LUA_MODULE_SUFFIX "@LUA_MODULE_SUFFIX@"
6667
#cmakedefine LUA_ROOT "@LUA_ROOT@"
6768
#cmakedefine LUA_LDIR "@LUA_LDIR@"
6869
#cmakedefine LUA_CDIR "@LUA_CDIR@"
69-
#cmakedefine LUA_PATH_DEFAULT "@LUA_PATH_DEFAULT@"
70-
#cmakedefine LUA_CPATH_DEFAULT "@LUA_CPATH_DEFAULT@"
70+
71+
#define LUA_PATH_DEFAULT "./?.lua;" LUA_ROOT "/" LUA_LDIR "/?.lua;" LUA_ROOT "/" LUA_LDIR "/?/init.lua"
72+
#define LUA_CPATH_DEFAULT "./?" LUA_MODULE_SUFFIX ";" LUA_ROOT "/" LUA_CDIR "/?" LUA_MODULE_SUFFIX ";" LUA_ROOT "/" LUA_CDIR "/loadall" LUA_MODULE_SUFFIX
7173

7274
/*
7375
@@ LUA_DIRSEP is the directory separator (for submodules).

0 commit comments

Comments
 (0)