aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt9
-rw-r--r--src/CMakeLists.txt2
2 files changed, 10 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 340bbad979..f0a04efe23 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,6 +15,15 @@ else()
set(DEBUG 0)
endif()
+# Determine platform's threading library. Set CMAKE_THREAD_PREFER_PTHREAD
+# explicitly to indicate a strong preference for pthread. It is an error to not
+# have pthread installed even if, for example, the Win32 threading API is found.
+set(CMAKE_THREAD_PREFER_PTHREAD ON)
+find_package(Threads REQUIRED)
+if(NOT CMAKE_USE_PTHREADS_INIT)
+ message(SEND_ERROR "The pthread library must be installed on your system.")
+endif(NOT CMAKE_USE_PTHREADS_INIT)
+
# add dependencies to include/lib directories
link_directories ("${PROJECT_SOURCE_DIR}/.deps/usr/lib")
include_directories ("${PROJECT_SOURCE_DIR}/.deps/usr/include")
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 1c7829e7d6..5ae5662a88 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -14,7 +14,7 @@ file( GLOB IO_SOURCES io/*.c )
add_executable (vim ${NEOVIM_SOURCES} ${IO_SOURCES})
-target_link_libraries (vim m uv pthread)
+target_link_libraries (vim m uv ${CMAKE_THREAD_LIBS_INIT})
include(CheckLibraryExists)
check_library_exists(termcap tgetent "" HAVE_LIBTERMCAP)