diff --git a/CMakeLists.txt b/CMakeLists.txt index abfee8c9..71014439 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,15 +17,6 @@ option(BUILD_SHARED_LIBS "Build shared libraries" OFF) find_package(OpenGL REQUIRED) -if (NOT WIN32) - set(CMAKE_THREAD_PREFER_PTHREADS YES) -endif() - -find_package(Threads) -if (CMAKE_THREAD_LIBS_INIT) - list(APPEND glfw_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) -endif() - #-------------------------------------------------------------------- # Enable all warnings on GCC, regardless of OS #-------------------------------------------------------------------- @@ -94,6 +85,12 @@ if (_GLFW_X11_GLX) find_package(X11 REQUIRED) + set(CMAKE_THREAD_PREFER_PTHREADS YES) + find_package(Threads) + if (CMAKE_THREAD_LIBS_INIT) + list(APPEND glfw_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) + endif() + # Set up library and include paths list(APPEND glfw_INCLUDE_DIRS ${X11_X11_INCLUDE_PATH} ${OPENGL_INCLUDE_DIR}) list(APPEND glfw_LIBRARIES ${X11_X11_LIB} ${OPENGL_gl_LIBRARY})