From e6451dae35a962fba59a450b2a22d80e64399fe4 Mon Sep 17 00:00:00 2001 From: Mitya Selivanov Date: Sun, 1 Jan 2023 18:15:55 +0100 Subject: Fix includes order --- CMakeLists.txt | 6 ++++-- source/kit/thread.posix.c | 10 +++++----- 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 # include # include @@ -9,11 +14,6 @@ # include # include -# include "allocator.h" -# include "condition_variable.h" -# include "mutex.h" -# include "thread.h" - # ifndef PTHREAD_STACK_MIN # define PTHREAD_STACK_MIN 16384 # endif -- cgit v1.2.3