Skip to content

Commit e335e52

Browse files
authored
Merge pull request swiftlang#2455 from compnerd/nor-here-nor-there
build: sink sched_getaffinity check into CoreFoundation
2 parents a3b72ff + ac7d8a7 commit e335e52

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

CMakeLists.txt

-8
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,6 @@ find_package(LibXml2 REQUIRED)
3434
include(SwiftSupport)
3535
include(GNUInstallDirs)
3636

37-
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
38-
include(CheckSymbolExists)
39-
include(CheckIncludeFile)
40-
list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
41-
check_include_file("sched.h" HAVE_SCHED_H)
42-
check_symbol_exists(sched_getaffinity "sched.h" HAVE_SCHED_GETAFFINITY)
43-
endif()
44-
4537
string(TOLOWER ${CMAKE_SYSTEM_NAME} swift_os)
4638
get_swift_host_arch(swift_arch)
4739

CoreFoundation/CMakeLists.txt

+11
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,17 @@ if(CMAKE_SYSTEM_NAME STREQUAL Linux OR CMAKE_SYSTEM_NAME STREQUAL Android)
368368
target_compile_definitions(CFXMLInterface
369369
PRIVATE
370370
-D_GNU_SOURCE)
371+
372+
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
373+
include(CheckSymbolExists)
374+
include(CheckIncludeFile)
375+
list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
376+
check_include_file("sched.h" HAVE_SCHED_H)
377+
if(HAVE_SCHED_H)
378+
check_symbol_exists(sched_getaffinity "sched.h" HAVE_SCHED_GETAFFINITY)
379+
endif()
380+
endif()
381+
371382
if(HAVE_SCHED_GETAFFINITY)
372383
target_compile_definitions(CoreFoundation
373384
PRIVATE

0 commit comments

Comments
 (0)