mirror of
https://github.com/anrieff/libcpuid
synced 2025-10-03 11:01:30 +00:00
Fix build for NetBSD (and presumably DragonFly BSD)
These both use POSIX threads. I got a link error when cross-compiling using Nixpkgs (Linux -> NetBSD) that went away once I passed `-pthread`. The autoconf is crafted to have the same conditional as the C code itself.
This commit is contained in:
parent
f1c96e1372
commit
09071d20f3
3 changed files with 40 additions and 0 deletions
|
@ -21,6 +21,18 @@ option(LIBCPUID_TESTS "Enable building tests" OFF)
|
|||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
|
||||
# pthreads library
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "DragonFly" OR ${CMAKE_SYSTEM_NAME} STREQUAL "NetBSD")
|
||||
find_package(Threads REQUIRED)
|
||||
endif()
|
||||
|
||||
# check if popcount64 is available
|
||||
include(CheckSymbolExists)
|
||||
check_symbol_exists(popcount64 "string.h" HAVE_POPCOUNT64)
|
||||
if(HAVE_POPCOUNT64)
|
||||
add_definitions(-DHAVE_POPCOUNT64)
|
||||
endif(HAVE_POPCOUNT64)
|
||||
|
||||
# Global variables
|
||||
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue