diff options
-rw-r--r-- | CMakeLists.txt | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 30dab04..4e0337b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) |