[CMake] Win32: DLL fails to find Qt symbols but .so builds in
Linux
Stephen Collyer
scollyer at netspinner.co.uk
Fri Nov 23 09:21:03 EST 2007
Stephen Collyer wrote:
> I'm building some simple shared libraries and an executable
> that links against them under both Win32 and Linux. All of
> the libraries and exe build and link correctly under Linux,
> but when building the DLLs under Win32 I get link errors.
>
> e.g. I have a class that looks like this:
>
> #include <QMutex>
> #include <QQueue>
> #include <QString>
> #include <QWaitCondition>
>
> ...
>
> class COMMS_EXP Comms
> {
> public:
> ...
>
> private:
> QQueue<QString> messageq;
> QMutex qmutex;
> QWaitCondition message_available;
> };
>
> with a cmake command like this:
>
> ADD_LIBRARY(Comms Comms.cpp)
OK, I'll do a bit of thinking out loud. I'm guessing that
when I try to build the code above into a DLL, Comms.dll,
VS tries to find the export lists containing the various
symbols for QQueue, QMutex, etc and patches the DLL with
some information in some way. Now, I've taken a look at the
various .vcproj files created by cmake, and I've noticed
that the project for the executable (called server) that links
against the Comms.dll has a line like this:
AdditionalLibraryDirectories="..\lib\MDP\$(OutDir),..\lib\MDP,E:\qt\qt-win-opensource-src-4.3.2\lib\
...
which directly refers to the appropriate Qt lib directory. I assume
that this eventually derives from the lines:
ADD_EXECUTABLE(server ${MOC_SRCS})
TARGET_LINK_LIBRARIES(server Parent Child Comms ${QT_LIBRARIES})
in the cmakelist file for the server executable.
However, the Comms.vcproj has no equivalent AdditionalLibraryDirectories
line.
Should it have one ? And if so, how can I convince cmake to put
one in there ?
--
Regards
Steve Collyer
Netspinner Ltd
More information about the CMake
mailing list