[CMake] Compiling header files

David Doria daviddoria at gmail.com
Tue Nov 16 19:19:41 EST 2010


Hm, it works correctly in Linux, but I still get a bunch of

error LNK2019: unresolved external symbol

errors in Windows.

The only difference I see is that the .lib file gets created in a
subdirectory of bin/

bin/Debug/OSC.lib (or bin/Release/OSC.lib)

vs the .a file which gets created in bin directly:

bin/OSC.a

Does something have to be done differently because of this? I guessed
no, because I thought it would have complained that it couldn't find
the OSC library rather than just produce linker errors.

Here is the CMakeLists.txt file:

cmake_minimum_required(VERSION 2.6)
PROJECT(TestOSC)

INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})

IF(WIN32)
 set(SystemTypePath ip/win32)
ELSE(WIN32)
 set(SystemTypePath ip/posix)
ENDIF(WIN32)

ADD_LIBRARY(OSC

ip/IpEndpointName.cpp
${SystemTypePath}/NetworkingUtils.cpp
${SystemTypePath}/UdpSocket.cpp

osc/OscPrintReceivedElements.cpp
osc/OscReceivedElements.cpp
osc/OscTypes.cpp
osc/OscOutboundPacketStream.cpp

)

ADD_EXECUTABLE(SimpleReceive examples/SimpleReceive.cpp)
TARGET_LINK_LIBRARIES(SimpleReceive OSC)

Everything look ok? Any thoughts?

Thanks,

David


More information about the CMake mailing list