Skip to content

Commit

Permalink
fix CMakeLists.txt: other way to find pthread library
Browse files Browse the repository at this point in the history
... and fixed linking of the tests in the examples directory.

Signed-off-by: Wouter Van Meir <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
  • Loading branch information
oamrjj authored and dscho committed May 7, 2010
1 parent 21fd3a4 commit 4fa9e2b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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")
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 4fa9e2b

Please sign in to comment.