Skip to content

Commit 49c5d83

Browse files
committed
Replace CMake threads variable with modern target
1 parent 8a5fd0c commit 49c5d83

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

CMakeLists.txt

+2-3
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ if (_GLFW_X11)
199199

200200
# Set up library and include paths
201201
list(APPEND glfw_INCLUDE_DIRS "${X11_X11_INCLUDE_PATH}")
202-
list(APPEND glfw_LIBRARIES "${X11_X11_LIB}" "${CMAKE_THREAD_LIBS_INIT}")
202+
list(APPEND glfw_LIBRARIES "${X11_X11_LIB}")
203203

204204
# Check for XRandR (modern resolution switching and gamma control)
205205
if (NOT X11_Xrandr_INCLUDE_PATH)
@@ -241,7 +241,7 @@ if (_GLFW_WAYLAND)
241241
list(APPEND glfw_PKG_DEPS "wayland-egl")
242242

243243
list(APPEND glfw_INCLUDE_DIRS "${Wayland_INCLUDE_DIRS}")
244-
list(APPEND glfw_LIBRARIES "${Wayland_LIBRARIES}" "${CMAKE_THREAD_LIBS_INIT}")
244+
list(APPEND glfw_LIBRARIES "${Wayland_LIBRARIES}")
245245

246246
find_package(XKBCommon REQUIRED)
247247
list(APPEND glfw_INCLUDE_DIRS "${XKBCOMMON_INCLUDE_DIRS}")
@@ -265,7 +265,6 @@ endif()
265265
#--------------------------------------------------------------------
266266
if (_GLFW_OSMESA)
267267
find_package(OSMesa REQUIRED)
268-
list(APPEND glfw_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}")
269268
endif()
270269

271270
#--------------------------------------------------------------------

examples/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ add_executable(splitview WIN32 MACOSX_BUNDLE splitview.c ${ICON} ${GLAD_GL})
3434
add_executable(triangle-opengl WIN32 MACOSX_BUNDLE triangle-opengl.c ${ICON} ${GLAD_GL})
3535
add_executable(wave WIN32 MACOSX_BUNDLE wave.c ${ICON} ${GLAD_GL})
3636

37-
target_link_libraries(particles "${CMAKE_THREAD_LIBS_INIT}")
37+
target_link_libraries(particles Threads::Threads)
3838
if (RT_LIBRARY)
3939
target_link_libraries(particles "${RT_LIBRARY}")
4040
endif()

src/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ target_include_directories(glfw PRIVATE
9595
"${GLFW_SOURCE_DIR}/src"
9696
"${GLFW_BINARY_DIR}/src"
9797
${glfw_INCLUDE_DIRS})
98-
target_link_libraries(glfw PRIVATE ${glfw_LIBRARIES})
98+
target_link_libraries(glfw PRIVATE Threads::Threads ${glfw_LIBRARIES})
9999

100100
if (APPLE)
101101
# For some reason CMake didn't know about .m until version 3.16

tests/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ add_executable(title WIN32 MACOSX_BUNDLE title.c ${GLAD_GL})
4242
add_executable(triangle-vulkan WIN32 triangle-vulkan.c ${GLAD_VULKAN})
4343
add_executable(windows WIN32 MACOSX_BUNDLE windows.c ${GLAD_GL})
4444

45-
target_link_libraries(empty "${CMAKE_THREAD_LIBS_INIT}")
46-
target_link_libraries(threads "${CMAKE_THREAD_LIBS_INIT}")
45+
target_link_libraries(empty Threads::Threads)
46+
target_link_libraries(threads Threads::Threads)
4747
if (RT_LIBRARY)
4848
target_link_libraries(empty "${RT_LIBRARY}")
4949
target_link_libraries(threads "${RT_LIBRARY}")

0 commit comments

Comments
 (0)