1- # Copyright (C) 2007-2011 LuaDist.
1+ # Copyright (C) 2007-2012 LuaDist.
22# Created by Peter Drahoš, Peter Kapec
33# Redistribution and use of this file is allowed according to the terms of the MIT license.
44# For details see the COPYRIGHT file distributed with LuaDist.
55# Please note that the package source code is licensed under its own license.
66
77project ( lua C )
8- cmake_minimum_required ( VERSION 2.6 )
8+ cmake_minimum_required ( VERSION 2.8 )
99include ( cmake/dist.cmake )
1010
1111## CONFIGURATION
@@ -20,7 +20,6 @@ option ( LUA_COMPAT_ALL "Enable backwards compatibility options." ON )
2020set ( LUA_IDSIZE 60 CACHE NUMBER "gives the maximum size for the description of the source." )
2121
2222#2DO: LUAI_* and LUAL_* settings, for now defaults are used.
23-
2423set ( LUA_DIRSEP "/" )
2524set ( LUA_MODULE_SUFFIX ${CMAKE_SHARED_MODULE_SUFFIX} )
2625set ( LUA_LDIR ${INSTALL_LMOD} )
@@ -29,10 +28,10 @@ set ( LUA_CDIR ${INSTALL_CMOD} )
2928if ( LUA_USE_RELATIVE_LOADLIB )
3029 # This will set up relative paths to lib
3130 string ( REGEX REPLACE "[^!/]+" ".." LUA_DIR "!/${INSTALL_BIN} /" )
32- else ()
31+ else ( )
3332 # Direct path to installation
34- set ( LUA_DIR ${CMAKE_INSTALL_PREFIX} CACHE STRING "Destination from which modules will be resolved. See INSTALL_LMOD and INSTALL_CMOD." )
35- endif ()
33+ set ( LUA_DIR ${CMAKE_INSTALL_PREFIX} CACHE STRING "Destination from which modules will be resolved. See INSTALL_LMOD and INSTALL_CMOD." )
34+ endif ( )
3635
3736set ( LUA_PATH_DEFAULT "./?.lua;${LUA_DIR}${LUA_LDIR} /?.lua;${LUA_DIR}${LUA_LDIR} /?/init.lua" )
3837set ( LUA_CPATH_DEFAULT "./?${LUA_MODULE_SUFFIX} ;${LUA_DIR}${LUA_CDIR} /?${LUA_MODULE_SUFFIX} ;${LUA_DIR}${LUA_CDIR} /loadall${LUA_MODULE_SUFFIX} " )
@@ -42,108 +41,79 @@ if ( WIN32 AND NOT CYGWIN )
4241 option ( LUA_WIN "Windows specific build." ON )
4342 option ( LUA_BUILD_AS_DLL "Build Lua library as Dll." ON )
4443 # Paths (Double escapes needed)
45- set ( LUA_DIRSEP "\\\\ " )
46- string ( REPLACE "/" ${LUA_DIRSEP} LUA_DIR "${LUA_DIR} " )
44+ set ( LUA_DIRSEP "\\\\ " ) string ( REPLACE " /" ${LUA_DIRSEP} LUA_DIR "${LUA_DIR} " )
4745 string ( REPLACE "/" ${LUA_DIRSEP} LUA_LDIR "${LUA_LDIR} " )
4846 string ( REPLACE "/" ${LUA_DIRSEP} LUA_CDIR "${LUA_CDIR} " )
4947 string ( REPLACE "/" ${LUA_DIRSEP} LUA_PATH_DEFAULT "${LUA_PATH_DEFAULT} " )
5048 string ( REPLACE "/" ${LUA_DIRSEP} LUA_CPATH_DEFAULT "${LUA_CPATH_DEFAULT} " )
51- else ()
49+ else ( )
5250 # Posix systems (incl. Cygwin)
5351 option ( LUA_USE_POSIX "Use POSIX functionality." ON )
5452 option ( LUA_USE_DLOPEN "Use dynamic linker to load modules." ON )
5553 option ( LUA_USE_MKSTEMP "Use mkstep." ON )
5654 option ( LUA_USE_ISATTY "Use tty." ON )
5755 option ( LUA_USE_POPEN "Use popen." ON )
58- option ( LUA_USE_ULONGJMP "Use ulongjmp" ON )
56+ option ( LUA_USE_ULONGJMP "Use ulongjmp" ON )
5957 option ( LUA_USE_STRTODHEX "assume 'strtod' handles hexa formats" ON )
6058 option ( LUA_USE_AFORMAT "assume 'printf' handles 'aA' specifiers" ON )
61- option ( LUA_USE_LONGLONG "assume support for long long" ON )
62- endif ()
59+ option ( LUA_USE_LONGLONG "assume support for long long" ON )
60+ endif ( )
6361
6462## SETUP
6563# Optional libraries
6664find_package ( Readline )
6765if ( READLINE_FOUND )
6866 option ( LUA_USE_READLINE "Use readline in the Lua CLI." ON )
69- endif ()
67+ endif ( )
7068
7169find_package ( Curses )
7270if ( CURSES_FOUND )
7371 option ( LUA_USE_CURSES "Use curses in the Lua CLI." ON )
74- endif ()
72+ endif ( )
7573
7674# Setup needed variables and libraries
7775if ( LUA_USE_POSIX )
7876 # On POSIX Lua links to standard math library "m"
7977 list ( APPEND LIBS m )
80- endif ()
78+ endif ( )
8179
8280if ( LUA_USE_DLOPEN )
8381 # Link to dynamic linker library "dl"
8482 list ( APPEND LIBS dl )
85- endif ()
83+ endif ( )
8684
8785if ( LUA_USE_READLINE )
8886 # Add readline
8987 include_directories ( ${READLINE_INCLUDE_DIR} )
9088 list ( APPEND LIBS ${READLINE_LIBRARY} )
91- endif ()
89+ endif ( )
9290
9391if ( LUA_USE_CURSES )
9492 # Add curses
9593 include_directories ( ${CURSES_INCLUDE_DIR} )
9694 list ( APPEND LIBS ${CURSES_LIBRARY} )
97- endif ()
95+ endif ( )
9896
9997## SOURCES
10098# Generate luaconf.h
10199configure_file ( src/luaconf.h.in ${CMAKE_CURRENT_BINARY_DIR} /luaconf.h )
102100
103101# Sources and headers
104102include_directories ( src ${CMAKE_CURRENT_BINARY_DIR} )
105- set ( SRC_CORE
106- src/lapi.c
107- src/lcode.c
108- src/lctype.c
109- src/ldebug.c
110- src/ldo.c
111- src/ldump.c
112- src/lfunc.c
113- src/lgc.c
114- src/llex.c
115- src/lmem.c
116- src/lobject.c
117- src/lopcodes.c
118- src/lparser.c
119- src/lstate.c
120- src/lstring.c
121- src/ltable.c
122- src/ltm.c
123- src/lundump.c
124- src/lvm.c
125- src/lzio.c)
126- set ( SRC_LIB
127- src/lauxlib.c
128- src/lbaselib.c
129- src/lbitlib.c
130- src/lcorolib.c
131- src/ldblib.c
132- src/liolib.c
133- src/lmathlib.c
134- src/loslib.c
135- src/lstrlib.c
136- src/ltablib.c
137- src/linit.c)
103+ set ( SRC_CORE src/lapi.c src/lcode.c src/lctype.c src/ldebug.c src/ldo.c src/ldump.c
104+ src/lfunc.c src/lgc.c src/llex.c src/lmem.c src/lobject.c src/lopcodes.c src/lparser.c
105+ src/lstate.c src/lstring.c src/ltable.c src/ltm.c src/lundump.c src/lvm.c src/lzio.c )
106+ set ( SRC_LIB src/lauxlib.c src/lbaselib.c src/lbitlib.c src/lcorolib.c src/ldblib.c
107+ src/liolib.c src/lmathlib.c src/loslib.c src/lstrlib.c src/ltablib.c src/linit.c )
138108set ( SRC_LUA src/lua.c )
139109set ( SRC_LUAC src/luac.c )
140110
141111if ( LUA_USE_RELATIVE_LOADLIB )
142112 # Use modified loadlib
143113 list ( APPEND SRC_LIB src/loadlib_rel.c )
144- else ()
114+ else ( )
145115 list ( APPEND SRC_LIB src/loadlib.c )
146- endif ()
116+ endif ( )
147117
148118## BUILD
149119# Create lua library
@@ -161,7 +131,7 @@ install_executable ( lua luac )
161131install_library ( liblua )
162132install_data ( README.md )
163133#install_lua_module ( strict etc/strict.lua )
164- install_header (src/lua.h src/lualib.h src/lauxlib.h ${CMAKE_CURRENT_BINARY_DIR} /luaconf.h )
134+ install_header ( src/lua.h src/lualib.h src/lauxlib.h ${CMAKE_CURRENT_BINARY_DIR} /luaconf.h )
165135install_doc ( doc / )
166136install_foo ( etc/ )
167137#install_test ( test/ )
0 commit comments