This commit is contained in:
Kae 2024-10-25 11:59:42 +11:00
commit aeb3644d9b
2 changed files with 10 additions and 0 deletions

View File

@ -80,6 +80,8 @@ if(NOT DEFINED STAR_SYSTEM)
set(STAR_SYSTEM "linux") set(STAR_SYSTEM "linux")
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") elseif(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
set(STAR_SYSTEM "freebsd") set(STAR_SYSTEM "freebsd")
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "NetBSD")
set(STAR_SYSTEM "netbsd")
elseif(UNIX) elseif(UNIX)
set(STAR_SYSTEM "unix") set(STAR_SYSTEM "unix")
else() else()
@ -208,6 +210,8 @@ elseif(STAR_SYSTEM STREQUAL "linux")
set_flag(STAR_SYSTEM_LINUX) set_flag(STAR_SYSTEM_LINUX)
elseif(STAR_SYSTEM STREQUAL "freebsd") elseif(STAR_SYSTEM STREQUAL "freebsd")
set_flag(STAR_SYSTEM_FREEBSD) set_flag(STAR_SYSTEM_FREEBSD)
elseif(STAR_SYSTEM STREQUAL "netbsd")
set_flag(STAR_SYSTEM_NETBSD)
endif() endif()
if(STAR_SYSTEM_FAMILY STREQUAL "windows") if(STAR_SYSTEM_FAMILY STREQUAL "windows")
@ -445,6 +449,10 @@ elseif(STAR_SYSTEM_FREEBSD)
set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lpthread -lrt") set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lpthread -lrt")
set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lpthread -lrt") set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lpthread -lrt")
elseif(STAR_SYSTEM_NETBSD)
set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lpthread -lrt -lexecinfo")
set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lpthread -lrt -lexecinfo")
endif() endif()
# Find all required external libraries, based on build settings... # Find all required external libraries, based on build settings...

View File

@ -78,6 +78,8 @@ struct ThreadImpl {
#ifdef STAR_SYSTEM_FREEBSD #ifdef STAR_SYSTEM_FREEBSD
pthread_set_name_np(pthread, tname); pthread_set_name_np(pthread, tname);
#elif defined(STAR_SYSTEM_NETBSD)
pthread_setname_np(pthread, "%s", tname);
#elif not defined STAR_SYSTEM_MACOS #elif not defined STAR_SYSTEM_MACOS
pthread_setname_np(pthread, tname); pthread_setname_np(pthread, tname);
#endif #endif