lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]




On Mon, Mar 21, 2011 at 8:38 PM, Gaspard Bucher <gaspard@teti.ch> wrote:
Am I really the only one who has encountered this issue when creating Lua modules ?
Hello, 
I have looked at your build, I find the organization rather chaotic (macros calling macros in subdirs) etc. The only issue that cough my eye was that you seem to be using LIBRARY_OUTPUT_DIRECTORY[1] in the build_sub_module[2] macro to deploy the modules. This directory should be inside the CMAKE_CURRENT_BINARY_DIR as it stores the objects used to create the module. The CMake manual recommends using INSTALL commands to deploy modules to destination instead. I encountered similar issue when building luasocket in LuaDist[3] that has two 'core' objects, one for mime the other for socket. The same name caused the build to misbehave in similar way you are experiencing. The solution was to use per target LIBRARY_OUTPUT_DIRECTORY[4], note this is relative path in CMAKE_CURRENT_BINARY_DIR.

Sorry for rather boring CMake related stuff on the list.

pd

PS: You seem to be abusing CMake to a degree that its not portable. Why use CMake then?
PSS: Check out our install_lua_module macro in dist.cmake for inspiration.

[1] http://www.cmake.org/cmake/help/cmake-2-8-docs.html#prop_tgt:LIBRARY_OUTPUT_DIRECTORY
[2] https://github.com/lubyk/lubyk/blob/master/modules/CMakeLists.txt#L61
[3] https://github.com/LuaDist/luasocket
[4] https://github.com/LuaDist/luasocket/blob/3e6bbfa108822019d21ad862a2106b817eb78e43/CMakeLists.txt#L37