summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2023-01-01 18:03:59 +0100
committerMitya Selivanov <automainint@guattari.tech>2023-01-01 18:03:59 +0100
commitd73b3ebf3b914fc1ebc32025626a50786e99438b (patch)
tree5e5bd9267695d8915a27edf48e46cc9d19a16eed /CMakeLists.txt
parent804c7139c2bb2cbc3053008703c86f9bf9f01aa6 (diff)
downloadkit-d73b3ebf3b914fc1ebc32025626a50786e99438b.zip
Fix mutexattr checks
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt15
1 files changed, 15 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6dacbc3..302b692 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -36,6 +36,16 @@ include(CheckCSourceRuns)
check_c_source_runs(
"
+ __attribute__((weak)) int foo();
+ int main() { return 0; }
+ "
+ KIT_HAVE_FUNC_ATTRIBUTE_WEAK
+)
+
+set(CMAKE_REQUIRED_LIBRARIES "pthread")
+check_c_source_runs(
+ "
+ #define _GNU_SOURCE
#include <pthread.h>
int main() {
pthread_mutexattr_t attr;
@@ -46,6 +56,7 @@ check_c_source_runs(
"
KIT_HAVE_PTHREAD_MUTEXATTR_SETTYPE
)
+set(CMAKE_REQUIRED_LIBRARIES "")
check_c_source_runs(
"
@@ -87,6 +98,10 @@ if(NOT KIT_HAVE_MALLOC)
set(KIT_DISABLE_SYSTEM_MALLOC ON)
endif()
+if(KIT_HAVE_FUNC_ATTRIBUTE_WEAK)
+ target_compile_definitions(kit PUBLIC KIT_HAVE_FUNC_ATTRIBUTE_WEAK)
+endif()
+
if(KIT_HAVE_PTHREAD_MUTEXATTR_SETTYPE)
target_compile_definitions(kit PUBLIC KIT_HAVE_PTHREAD_MUTEXATTR_SETTYPE)
endif()