mirror of
https://github.com/SFML/SFML.git
synced 2024-11-24 20:31:05 +08:00
Use cross-platform threading library target
This commit is contained in:
parent
3acb69e347
commit
d6c18af926
@ -24,6 +24,9 @@ if(SFML_STATIC_LIBRARIES)
|
||||
# start with an empty list
|
||||
set(FIND_SFML_DEPENDENCIES_NOTFOUND)
|
||||
|
||||
# SFML::System
|
||||
find_dependency(Threads)
|
||||
|
||||
# SFML::Window
|
||||
list(FIND SFML_FIND_COMPONENTS "Window" FIND_SFML_WINDOW_COMPONENT_INDEX)
|
||||
if(FIND_SFML_WINDOW_COMPONENT_INDEX GREATER -1)
|
||||
|
@ -1,3 +1,5 @@
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
# all source files
|
||||
set(SRC Island.cpp)
|
||||
|
||||
@ -10,7 +12,4 @@ sfml_add_example(island GUI_APP
|
||||
# external dependency headers
|
||||
target_include_directories(island SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/examples/island)
|
||||
|
||||
# link against pthread
|
||||
if(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_MACOS)
|
||||
target_link_libraries(island PRIVATE pthread)
|
||||
endif()
|
||||
target_link_libraries(island PRIVATE Threads::Threads)
|
||||
|
@ -65,6 +65,8 @@ else()
|
||||
source_group("unix" FILES ${PLATFORM_SRC})
|
||||
endif()
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
# define the sfml-system target
|
||||
sfml_add_library(System
|
||||
SOURCES ${SRC} ${PLATFORM_SRC})
|
||||
@ -80,10 +82,7 @@ if(SFML_OS_ANDROID)
|
||||
target_include_directories(sfml-system SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/extlibs/headers/glad/include")
|
||||
endif()
|
||||
|
||||
# setup dependencies
|
||||
if(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_MACOS)
|
||||
target_link_libraries(sfml-system PRIVATE pthread)
|
||||
endif()
|
||||
target_link_libraries(sfml-system PRIVATE Threads::Threads)
|
||||
|
||||
if(SFML_OS_LINUX)
|
||||
target_link_libraries(sfml-system PRIVATE rt)
|
||||
|
Loading…
Reference in New Issue
Block a user