[CMake] CMake adds "lib" prefix to library. Bug?
Adam J Richardson
fatman at crackmonkey.us
Tue Nov 23 07:55:48 EST 2010
Hi list.
Not sure if this is a bug or something stupid I've done. On several
Windows build environments (two XP, two 7, this happens with 2.8.2 and
2.8.3), I'm getting the error:
c:/compilers/mingw/bin/../lib/gcc/mingw32/4.4.1/../../../../mingw32/bin/ld.exe: cannot find -llibodbc32
That's clear enough. It's also clear what the problem is: there is no
liblibodbc32.a in my environment. There is however a libodbc32.a, which
I would expect it to pick up.
With VERBOSE=1, make gives me a long g++ command ending with:
... -Wl,-Bstatic -llibodbc32 -Wl,-Bdynamic -lkernel32 -luser32 -lgdi32
-lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32
Which is correct apart from the -llibodbc32 part. (I'm not entirely
clear on why CMake felt it necessary to specify that it's a static lib
when it didn't with the previous ones.)
I've debugged my FindODBC.cmake with "message(STATUS ${blah})"
instructions and it returns "odbc32", which is correct.
So my question is: why is CMake adding an extra "lib"? I can work
around it for now, but I'd like to solve this one properly.
Thanks,
Adam J Richardson
====================
CMakeLists.txt snippet:
if (ODBC_FOUND)
set(T_LIBS ${T_LIBS} ${ODBC_LIBRARIES})
# message(STATUS "ODBC: ${ODBC_LIBRARIES}")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNO_ODBC=1")
message(STATUS "ODBC not found, omitting from build.")
endif()
FindODBC.cmake sans comments:
SET( ODBC_FOUND 0 )
FIND_PATH(ODBC_INCLUDE_DIRECTORIES sql.h
DOC "Specify the directory containing sql.h."
)
FIND_LIBRARY( ODBC_LIBRARIES
NAMES iodbc odbc odbcinst odbc32
DOC "Specify the ODBC driver manager library here."
)
IF (ODBC_LIBRARIES)
IF (ODBC_INCLUDE_DIRECTORIES)
SET( ODBC_FOUND 1 )
ENDIF (ODBC_INCLUDE_DIRECTORIES)
ENDIF (ODBC_LIBRARIES)
MARK_AS_ADVANCED( ODBC_FOUND ODBC_LIBRARY ODBC_LIBRARIES ODBC_EXTRA_LIBRARIES ODBC_INCLUDE_DIRECTORIES )
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20101123/b053354b/attachment.pgp>
More information about the CMake
mailing list