mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 04:41: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
|
# start with an empty list
|
||||||
set(FIND_SFML_DEPENDENCIES_NOTFOUND)
|
set(FIND_SFML_DEPENDENCIES_NOTFOUND)
|
||||||
|
|
||||||
|
# SFML::System
|
||||||
|
find_dependency(Threads)
|
||||||
|
|
||||||
# SFML::Window
|
# SFML::Window
|
||||||
list(FIND SFML_FIND_COMPONENTS "Window" FIND_SFML_WINDOW_COMPONENT_INDEX)
|
list(FIND SFML_FIND_COMPONENTS "Window" FIND_SFML_WINDOW_COMPONENT_INDEX)
|
||||||
if(FIND_SFML_WINDOW_COMPONENT_INDEX GREATER -1)
|
if(FIND_SFML_WINDOW_COMPONENT_INDEX GREATER -1)
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
# all source files
|
# all source files
|
||||||
set(SRC Island.cpp)
|
set(SRC Island.cpp)
|
||||||
|
|
||||||
@ -10,7 +12,4 @@ sfml_add_example(island GUI_APP
|
|||||||
# external dependency headers
|
# external dependency headers
|
||||||
target_include_directories(island SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/examples/island)
|
target_include_directories(island SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/examples/island)
|
||||||
|
|
||||||
# link against pthread
|
target_link_libraries(island PRIVATE Threads::Threads)
|
||||||
if(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_MACOS)
|
|
||||||
target_link_libraries(island PRIVATE pthread)
|
|
||||||
endif()
|
|
||||||
|
@ -65,6 +65,8 @@ else()
|
|||||||
source_group("unix" FILES ${PLATFORM_SRC})
|
source_group("unix" FILES ${PLATFORM_SRC})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
# define the sfml-system target
|
# define the sfml-system target
|
||||||
sfml_add_library(System
|
sfml_add_library(System
|
||||||
SOURCES ${SRC} ${PLATFORM_SRC})
|
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")
|
target_include_directories(sfml-system SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/extlibs/headers/glad/include")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# setup dependencies
|
target_link_libraries(sfml-system PRIVATE Threads::Threads)
|
||||||
if(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_MACOS)
|
|
||||||
target_link_libraries(sfml-system PRIVATE pthread)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(SFML_OS_LINUX)
|
if(SFML_OS_LINUX)
|
||||||
target_link_libraries(sfml-system PRIVATE rt)
|
target_link_libraries(sfml-system PRIVATE rt)
|
||||||
|
Loading…
Reference in New Issue
Block a user