Commit 4fa9e2bb authored by Wouter Van Meir's avatar Wouter Van Meir Committed by Johannes Schindelin

fix CMakeLists.txt: other way to find pthread library

... and fixed linking of the tests in the examples directory.
Signed-off-by: 's avatarWouter Van Meir <wouter.vanmeir@pandora.be>
Signed-off-by: 's avatarJohannes Schindelin <johannes.schindelin@gmx.de>
parent 21fd3a45
......@@ -17,6 +17,7 @@ find_package(ZLIB)
find_package(JPEG)
find_package(SDL)
find_package(GnuTLS)
find_package(Threads)
if(SDL_FOUND) # == pthread.h available
option(TIGHTVNC_FILETRANSFER "Enable filetransfer" ON)
......@@ -34,7 +35,6 @@ endif(GNUTLS_FOUND)
check_include_file("fcntl.h" LIBVNCSERVER_HAVE_FCNTL_H)
check_include_file("netinet/in.h" LIBVNCSERVER_HAVE_NETINET_IN_H)
check_include_file("pthread.h" LIBVNCSERVER_HAVE_LIBPTHREAD)
check_include_file("sys/socket.h" LIBVNCSERVER_HAVE_SYS_SOCKET_H)
check_include_file("sys/stat.h" LIBVNCSERVER_HAVE_SYS_STAT_H)
check_include_file("sys/time.h" LIBVNCSERVER_HAVE_SYS_TIME_H)
......@@ -50,6 +50,9 @@ check_include_file("sys/types.h" HAVE_SYS_TYPES_H)
check_function_exists(gettimeofday LIBVNCSERVER_HAVE_GETTIMEOFDAY)
if(CMAKE_USE_PTHREADS_INIT)
set(LIBVNCSERVER_HAVE_LIBPTHREAD 1)
endif(CMAKE_USE_PTHREADS_INIT)
if(LIBVNCSERVER_HAVE_SYS_SOCKET_H)
# socklen_t
list(APPEND CMAKE_EXTRA_INCLUDE_FILES "sys/socket.h")
......@@ -228,13 +231,13 @@ endif(HAVE_FFMPEG)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/examples)
foreach(test ${LIBVNCSERVER_TESTS})
add_executable(examples/${test} ${LIBVNCSRVTEST_DIR}/${test}.c)
target_link_libraries(examples/${test} vncserver)
target_link_libraries(examples/${test} vncserver ${CMAKE_THREAD_LIBS_INIT})
endforeach(test ${LIBVNCSERVER_TESTS})
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/client_examples)
foreach(test ${LIBVNCCLIENT_TESTS})
add_executable(client_examples/${test} ${LIBVNCCLITEST_DIR}/${test}.c)
target_link_libraries(client_examples/${test} vncclient ${GNUTLS_LIBRARIES} ${SDL_LIBRARY} ${FFMPEG_LIBRARIES})
target_link_libraries(client_examples/${test} vncclient ${CMAKE_THREAD_LIBS_INIT} ${GNUTLS_LIBRARIES} ${SDL_LIBRARY} ${FFMPEG_LIBRARIES})
endforeach(test ${LIBVNCCLIENT_TESTS})
install_targets(/lib vncserver)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment