aboutsummaryrefslogtreecommitdiff
path: root/cmake/tuklib_cpucores.cmake
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2022-10-31 11:49:47 +0200
committerLasse Collin <lasse.collin@tukaani.org>2022-10-31 11:49:47 +0200
commita243c617ff249d915ac123de4f536b80322c1fdb (patch)
tree104cc921e6fb3bb0123fd2073b91b48fe5255e90 /cmake/tuklib_cpucores.cmake
parentTests: test_files.sh: Make it not fail if features were disabled at build. (diff)
downloadxz-a243c617ff249d915ac123de4f536b80322c1fdb.tar.xz
CMake: Sync tuklib_cpucores.cmake with tuklib_cpucores.m4.
This was forgotten from commit 2611c4d90535652d3eb7ef4a026a6691276fab43.
Diffstat (limited to 'cmake/tuklib_cpucores.cmake')
-rw-r--r--cmake/tuklib_cpucores.cmake5
1 files changed, 5 insertions, 0 deletions
diff --git a/cmake/tuklib_cpucores.cmake b/cmake/tuklib_cpucores.cmake
index 743d56b3..ea16e427 100644
--- a/cmake/tuklib_cpucores.cmake
+++ b/cmake/tuklib_cpucores.cmake
@@ -89,7 +89,12 @@ function(tuklib_cpucores_internal_check)
#include <sys/sysctl.h>
int main(void)
{
+ #ifdef HW_NCPUONLINE
+ /* This is preferred on OpenBSD, see tuklib_cpucores.c. */
+ int name[2] = { CTL_HW, HW_NCPUONLINE };
+ #else
int name[2] = { CTL_HW, HW_NCPU };
+ #endif
int cpus;
size_t cpus_size = sizeof(cpus);
sysctl(name, 2, &cpus, &cpus_size, NULL, 0);