CMake: Sync tuklib_cpucores.cmake with tuklib_cpucores.m4.

This was forgotten from commit 2611c4d905.
This commit is contained in:
Lasse Collin 2022-10-31 11:49:47 +02:00
parent fa9efb729b
commit 1c8cbb5be3
1 changed files with 5 additions and 0 deletions

View File

@ -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);