[Cmake] CMake confusing library and target name (bug?)

Eric Wing ewing2121 at yahoo.com
Wed, 17 Mar 2004 13:41:31 -0800 (PST)


I think I'm having problem with CMake being confused
between the library name and target target name.

I'm trying to build the lua executable which is where
things break.

The Lua source follows this directory structure:
src/  <-- Where the core library code exists
  lib/ <-- Auxilary (utililty) library for Lua
  lua/  <-- Code for the runtime exe, depends on lua
and lib

I place a CMakeLists.txt in each of these directories.
In src, I create a library called "lua" using:
ADD_LIBRARY(lua <all_library_source_files_here>)

Similarly in lib, I create a library called "lualib".

In the lua executable directory, I do:
LINK_DIRECTORIES( 
	${lua_BINARY_DIR}/src/lib
	${lua_BINARY_DIR}/src
)
ADD_EXECUTABLE(lua lua.c)  # lua is the name of the
exe
TARGET_LINK_LIBRARIES(
	lua  # the name of the executable
	lualib  # the name of the lualib library
	lua  # the name of the lua library
)


But when I do as above, I get a long list of ld:
undefined symbols which should be in the lua library
during the build.

If I rename the lua executable to "Lua" (with a
capital L" i.e. 
ADD_EXECUTABLE(Lua lua.c)
TARGET_LINK_LIBRARIES(Lua lualib lua)

then everything compiles.

I would like to stay within the standard lua naming
convention though. This means everything is lowercase
and follows the above names. Is there a way I can
prevent CMake from getting confused here?

Thanks,
Eric