Skip to content
Snippets Groups Projects
Unverified Commit af22355b authored by John Kessenich's avatar John Kessenich Committed by GitHub
Browse files

Merge pull request #1633 from akien-mga/cmake-2.8-pthread

CMake: Fix linking pthread of CMake < 3.1
parents 1a19598e f0e911c8
No related branches found
No related tags found
No related merge requests found
......@@ -2,10 +2,20 @@ add_library(OSDependent STATIC ossource.cpp ../osinclude.h)
set_property(TARGET OSDependent PROPERTY FOLDER glslang)
set_property(TARGET OSDependent PROPERTY POSITION_INDEPENDENT_CODE ON)
# Link pthread
set(CMAKE_THREAD_PREFER_PTHREAD ON)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads)
target_link_libraries(OSDependent Threads::Threads)
if(${CMAKE_VERSION} VERSION_LESS "3.1.0")
# Needed as long as we support CMake 2.8 for Ubuntu 14.04,
# which does not support the recommended Threads::Threads target.
# https://cmake.org/cmake/help/v2.8.12/cmake.html#module:FindThreads
find_package(Threads)
target_link_libraries(OSDependent ${CMAKE_THREAD_LIBS_INIT})
else()
# This is the recommended way, so we use it for 3.1+.
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads)
target_link_libraries(OSDependent Threads::Threads)
endif()
if(ENABLE_GLSLANG_INSTALL)
install(TARGETS OSDependent
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment