From 78f6a02a39423e7022a49bb211ddb0febe2a82e3 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Thu, 30 Nov 2023 07:26:59 +0700 Subject: [PATCH] cmake: Add missing check for `__builtin_popcountll()`. The autoconf build system has this already. --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2043d035d6..8980604d52 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -243,6 +243,13 @@ if (HAVE_BUILTIN_FFSL) set(GECODE_HAS_BUILTIN_FFSL "/**/") endif () +# Check for popcount +check_c_source_compiles(" + int main() { return __builtin_popcountll(0); }" HAVE_BUILTIN_POPCOUNTLL) +if (HAVE_BUILTIN_POPCOUNTLL) + set(GECODE_HAS_BUILTIN_POPCOUNTLL "/**/") +endif () + # Process config.hpp using autoconf rules. list(LENGTH CONFIG length) math(EXPR length "${length} - 1")