[CMake] problem porting to VC++: LINK : fatal error LNK1104: cannot open file 'Exc.lib'

Wojciech Jarosz wjarosz at ucsd.edu
Thu Sep 14 00:07:36 EDT 2006


Hi,
I have been using CMake on Linux and Mac OS X for a couple months now and am 
very happy with it. Now I am having a bit of trouble getting my project to 
work on windows using VC++ Express Edition.

Among other things, my project has two (shared) libraries: Exc and Thread. 
Thread depends on Exc. When I build Exc and then Thread in VC++ I get the 
following error:

------ Build started: Project: Thread, Configuration: Debug Win32 ------
Linking...
LINK : fatal error LNK1104: cannot open file 'Exc.lib'


I'm not quite sure why I'm getting this error or why Thread is even trying to 
link against a static .lib file instead of a shared library.

Thanks for the help,
-w


I've included the two CMakeList.txt files below for reference:


Exc\CMakeList.txt:

INCLUDE_DIRECTORIES(
${gfx_SOURCE_DIR}
${gfx_BINARY_DIR})

SET(Exc_LIB_SRCS
BaseExc.cpp
BaseExc.h
ErrnoExc.h
Exception.h
Macros.h
MathExc.h
ThrowErrnoExc.cpp
ThrowErrnoExc.h
)

ADD_LIBRARY(Exc SHARED ${Exc_LIB_SRCS})
INSTALL(TARGETS  Exc  DESTINATION  ${LIB_INSTALL_DIR})


Thread\CMakeList.txt:

INCLUDE_DIRECTORIES(
${gfx_SOURCE_DIR}
${gfx_BINARY_DIR})

SET(Thread_LIB_SRCS
ThreadPool.h
Thread.h
Semaphore.h
Mutex.h
ThreadPool.cpp
Thread.cpp
Semaphore.cpp
Mutex.cpp
ThreadPosix.cpp
SemaphorePosix.cpp
SemaphorePosixCompat.cpp
MutexPosix.cpp
)

ADD_LIBRARY(Thread SHARED ${Thread_LIB_SRCS})
TARGET_LINK_LIBRARIES(Thread Exc ${CMAKE_THREAD_LIBS_INIT})
INSTALL(TARGETS  Thread  DESTINATION  ${LIB_INSTALL_DIR})


More information about the CMake mailing list