Thomas Veith wrote:
Hi *,

when using a simple CMakeLists.txt like the following:

cmake_minimum_required(VERSION 2.6)
PROJECT(socket)

add_definitions( -D_CRT_SECURE_NO_WARNINGS )

add_library(socket STATIC  ../../src/base64.cpp ../../src/http.cpp
../../src/PoolThread.cpp ../../src/ResourceHandler.cpp
../../src/socket.cpp ../../src/sslsocket.cpp )

target_link_libraries(socket  ws2_32.lib )
<<<


CMake does not link anything to static libraries. However, if you later do something like this:


add_executable(foo foo.cpp)
target_link_libraries(foo socket)

Then foo will link to socket and ws2_32. You should not get undefined symbols from the creation of a static library. Linking static libraries to static libraries is not portable (can't even do it on other platforms). You might want to try some windows pragma magic in your code if you want to do something like this.

-Bill
_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to