diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e110288..eded1072 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -199,7 +199,7 @@ if (_GLFW_X11) # Set up library and include paths list(APPEND glfw_INCLUDE_DIRS "${X11_X11_INCLUDE_PATH}") - list(APPEND glfw_LIBRARIES "${X11_X11_LIB}" "${CMAKE_THREAD_LIBS_INIT}") + list(APPEND glfw_LIBRARIES "${X11_X11_LIB}") # Check for XRandR (modern resolution switching and gamma control) if (NOT X11_Xrandr_INCLUDE_PATH) @@ -241,7 +241,7 @@ if (_GLFW_WAYLAND) list(APPEND glfw_PKG_DEPS "wayland-egl") list(APPEND glfw_INCLUDE_DIRS "${Wayland_INCLUDE_DIRS}") - list(APPEND glfw_LIBRARIES "${Wayland_LIBRARIES}" "${CMAKE_THREAD_LIBS_INIT}") + list(APPEND glfw_LIBRARIES "${Wayland_LIBRARIES}") find_package(XKBCommon REQUIRED) list(APPEND glfw_INCLUDE_DIRS "${XKBCOMMON_INCLUDE_DIRS}") @@ -265,7 +265,6 @@ endif() #-------------------------------------------------------------------- if (_GLFW_OSMESA) find_package(OSMesa REQUIRED) - list(APPEND glfw_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}") endif() #-------------------------------------------------------------------- diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 050dff02..867f5bcf 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -34,7 +34,7 @@ add_executable(splitview WIN32 MACOSX_BUNDLE splitview.c ${ICON} ${GLAD_GL}) add_executable(triangle-opengl WIN32 MACOSX_BUNDLE triangle-opengl.c ${ICON} ${GLAD_GL}) add_executable(wave WIN32 MACOSX_BUNDLE wave.c ${ICON} ${GLAD_GL}) -target_link_libraries(particles "${CMAKE_THREAD_LIBS_INIT}") +target_link_libraries(particles Threads::Threads) if (RT_LIBRARY) target_link_libraries(particles "${RT_LIBRARY}") endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 70978159..5e2ad87b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -95,7 +95,7 @@ target_include_directories(glfw PRIVATE "${GLFW_SOURCE_DIR}/src" "${GLFW_BINARY_DIR}/src" ${glfw_INCLUDE_DIRS}) -target_link_libraries(glfw PRIVATE ${glfw_LIBRARIES}) +target_link_libraries(glfw PRIVATE Threads::Threads ${glfw_LIBRARIES}) if (APPLE) # For some reason CMake didn't know about .m until version 3.16 diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 275f20c1..e36ed56c 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -42,8 +42,8 @@ add_executable(title WIN32 MACOSX_BUNDLE title.c ${GLAD_GL}) add_executable(triangle-vulkan WIN32 triangle-vulkan.c ${GLAD_VULKAN}) add_executable(windows WIN32 MACOSX_BUNDLE windows.c ${GLAD_GL}) -target_link_libraries(empty "${CMAKE_THREAD_LIBS_INIT}") -target_link_libraries(threads "${CMAKE_THREAD_LIBS_INIT}") +target_link_libraries(empty Threads::Threads) +target_link_libraries(threads Threads::Threads) if (RT_LIBRARY) target_link_libraries(empty "${RT_LIBRARY}") target_link_libraries(threads "${RT_LIBRARY}")