From ac7d8a79c1666b764b0d5a7d35d9485884cb9adc Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Sat, 3 Aug 2019 14:41:49 -0700 Subject: [PATCH] build: sink sched_getaffinity check into CoreFoundation --- CMakeLists.txt | 8 -------- CoreFoundation/CMakeLists.txt | 11 +++++++++++ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bf434b691d..54cc320b3e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,14 +34,6 @@ find_package(LibXml2 REQUIRED) include(SwiftSupport) include(GNUInstallDirs) -if(CMAKE_SYSTEM_NAME STREQUAL Linux) - include(CheckSymbolExists) - include(CheckIncludeFile) - list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE) - check_include_file("sched.h" HAVE_SCHED_H) - check_symbol_exists(sched_getaffinity "sched.h" HAVE_SCHED_GETAFFINITY) -endif() - string(TOLOWER ${CMAKE_SYSTEM_NAME} swift_os) get_swift_host_arch(swift_arch) diff --git a/CoreFoundation/CMakeLists.txt b/CoreFoundation/CMakeLists.txt index fc1b5f9f71..e2fb89a10a 100644 --- a/CoreFoundation/CMakeLists.txt +++ b/CoreFoundation/CMakeLists.txt @@ -368,6 +368,17 @@ if(CMAKE_SYSTEM_NAME STREQUAL Linux OR CMAKE_SYSTEM_NAME STREQUAL Android) target_compile_definitions(CFXMLInterface PRIVATE -D_GNU_SOURCE) + + if(CMAKE_SYSTEM_NAME STREQUAL Linux) + include(CheckSymbolExists) + include(CheckIncludeFile) + list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE) + check_include_file("sched.h" HAVE_SCHED_H) + if(HAVE_SCHED_H) + check_symbol_exists(sched_getaffinity "sched.h" HAVE_SCHED_GETAFFINITY) + endif() + endif() + if(HAVE_SCHED_GETAFFINITY) target_compile_definitions(CoreFoundation PRIVATE