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

Commit c3cca4a

Browse files
committed
Path generation cleanup
1 parent 8c98898 commit c3cca4a

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,25 @@ set ( LUA_CDIR ${INSTALL_CMOD} )
3030

3131
if ( LUA_USE_RELATIVE_LOADLIB )
3232
# This will set up relative paths to lib
33-
string ( REGEX REPLACE "[^!/]+" ".." LUA_ROOT "!/${INSTALL_BIN}/" )
33+
string ( REGEX REPLACE "[^!/]+" ".." LUA_DIR "!/${INSTALL_BIN}/" )
3434
else ()
3535
# Direct path to installation
36-
set ( LUA_ROOT ${CMAKE_INSTALL_PREFIX} CACHE STRING "Destination from which modules will be resolved. See INSTALL_LMOD and INSTALL_CMOD.")
36+
set ( LUA_DIR ${CMAKE_INSTALL_PREFIX} CACHE STRING "Destination from which modules will be resolved. See INSTALL_LMOD and INSTALL_CMOD.")
3737
endif ()
3838

39+
set ( LUA_PATH_DEFAULT "./?.lua;${LUA_DIR}${LUA_LDIR}/?.lua;${LUA_DIR}${LUA_LDIR}/?/init.lua" )
40+
set ( LUA_CPATH_DEFAULT "./?${LUA_MODULE_SUFFIX};${LUA_DIR}${LUA_CDIR}/?${LUA_MODULE_SUFFIX};${LUA_DIR}${LUA_CDIR}/loadall${LUA_MODULE_SUFFIX}" )
41+
3942
if ( WIN32 AND NOT CYGWIN )
4043
# Windows systems
4144
option ( LUA_WIN "Windows specific build." ON )
4245
option ( LUA_BUILD_AS_DLL "Build Lua library as Dll." ON )
4346
# Paths (Double escapes needed)
4447
set ( LUA_DIRSEP "\\\\" )
45-
string ( REPLACE "/" ${LUA_DIRSEP} LUA_ROOT ${LUA_ROOT} )
48+
string ( REPLACE "/" ${LUA_DIRSEP} LUA_DIR ${LUA_DIR} )
4649
string ( REPLACE "/" ${LUA_DIRSEP} LUA_LDIR ${LUA_LDIR} )
4750
string ( REPLACE "/" ${LUA_DIRSEP} LUA_CDIR ${LUA_CDIR} )
51+
4852
else ()
4953
# Posix systems (incl. Cygwin)
5054
option ( LUA_USE_POSIX "Use POSIX functionality." ON )

src/luaconf.h.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@
6464
** path of the directory of the executable file of the current process.
6565
*/
6666
#cmakedefine LUA_MODULE_SUFFIX "@LUA_MODULE_SUFFIX@"
67-
#cmakedefine LUA_ROOT "@LUA_ROOT@"
67+
#cmakedefine LUA_DIR "@LUA_DIR@"
6868
#cmakedefine LUA_LDIR "@LUA_LDIR@"
6969
#cmakedefine LUA_CDIR "@LUA_CDIR@"
7070

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
71+
#define LUA_PATH_DEFAULT "@LUA_PATH_DEFAULT@"
72+
#define LUA_CPATH_DEFAULT "@LUA_CPATH_DEFAULT@"
7373

7474
/*
7575
@@ LUA_DIRSEP is the directory separator (for submodules).

0 commit comments

Comments
 (0)