summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2023-01-01 18:15:55 +0100
committerMitya Selivanov <automainint@guattari.tech>2023-01-01 18:15:55 +0100
commite6451dae35a962fba59a450b2a22d80e64399fe4 (patch)
tree3c09237b475a1fc026ce16806cd49b3454ab14cf
parentd73b3ebf3b914fc1ebc32025626a50786e99438b (diff)
downloadkit-e6451dae35a962fba59a450b2a22d80e64399fe4.zip
Fix includes order
-rw-r--r--CMakeLists.txt6
-rw-r--r--source/kit/thread.posix.c10
2 files changed, 9 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 302b692..33b42fe 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,6 +42,7 @@ check_c_source_runs(
KIT_HAVE_FUNC_ATTRIBUTE_WEAK
)
+set(CMAKE_REQUIRED_LIBRARIES_BACK_ ${CMAKE_REQUIRED_LIBRARIES})
set(CMAKE_REQUIRED_LIBRARIES "pthread")
check_c_source_runs(
"
@@ -56,7 +57,8 @@ check_c_source_runs(
"
KIT_HAVE_PTHREAD_MUTEXATTR_SETTYPE
)
-set(CMAKE_REQUIRED_LIBRARIES "")
+set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_BACK_})
+unset(CMAKE_REQUIRED_LIBRARIES_BACK_)
check_c_source_runs(
"
@@ -130,7 +132,7 @@ enable_testing()
if(KIT_ENABLE_TESTING)
add_executable(kit_test_suite)
add_executable(kit::kit_test_suite ALIAS kit_test_suite)
- target_link_libraries(kit_test_suite PRIVATE kit kit_test Threads::Threads)
+ target_link_libraries(kit_test_suite PRIVATE kit kit_test)
if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
target_compile_options(
diff --git a/source/kit/thread.posix.c b/source/kit/thread.posix.c
index 52f52ad..12bdd05 100644
--- a/source/kit/thread.posix.c
+++ b/source/kit/thread.posix.c
@@ -1,6 +1,11 @@
#ifndef KIT_DISABLE_SYSTEM_THREADS
# if !defined(_WIN32) || defined(__CYGWIN__)
+# include "allocator.h"
+# include "condition_variable.h"
+# include "mutex.h"
+# include "thread.h"
+
# include <assert.h>
# include <errno.h>
# include <limits.h>
@@ -9,11 +14,6 @@
# include <stdlib.h>
# include <unistd.h>
-# include "allocator.h"
-# include "condition_variable.h"
-# include "mutex.h"
-# include "thread.h"
-
# ifndef PTHREAD_STACK_MIN
# define PTHREAD_STACK_MIN 16384
# endif