-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[cmake] Hardcode some check_include_file
checks
#104706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a92b98b
0d468fd
31f51e4
25c080a
d226369
82bcfdb
608037b
b25fbf6
4ebf4ac
dc4c5d0
d5478cf
51278c1
75759a6
bc5391e
43dfb84
2294e6a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,86 @@ include(CheckCompilerVersion) | |
include(CheckProblematicConfigurations) | ||
include(HandleLLVMStdlib) | ||
|
||
if (ANDROID OR CYGWIN OR CMAKE_SYSTEM_NAME MATCHES "AIX|DragonFly|FreeBSD|Haiku|Linux|NetBSD|OpenBSD|SunOS") | ||
set(HAVE_DLFCN_H 1) | ||
set(HAVE_MACH_MACH_H 0) | ||
set(HAVE_MALLOC_MALLOC_H 0) | ||
set(HAVE_PTHREAD_H 1) | ||
set(HAVE_SIGNAL_H 1) | ||
set(HAVE_SYS_IOCTL_H 1) | ||
set(HAVE_SYS_MMAN_H 1) | ||
set(HAVE_SYS_PARAM_H 1) | ||
set(HAVE_SYS_RESOURCE_H 1) | ||
set(HAVE_SYS_STAT_H 1) | ||
set(HAVE_SYS_TIME_H 1) | ||
set(HAVE_SYSEXITS_H 1) | ||
set(HAVE_TERMIOS_H 1) | ||
set(HAVE_UNISTD_H 1) | ||
elseif (APPLE) | ||
set(HAVE_DLFCN_H 1) | ||
set(HAVE_MACH_MACH_H 1) | ||
set(HAVE_MALLOC_MALLOC_H 1) | ||
set(HAVE_PTHREAD_H 1) | ||
set(HAVE_SIGNAL_H 1) | ||
set(HAVE_SYS_IOCTL_H 1) | ||
set(HAVE_SYS_MMAN_H 1) | ||
set(HAVE_SYS_PARAM_H 1) | ||
set(HAVE_SYS_RESOURCE_H 1) | ||
set(HAVE_SYS_STAT_H 1) | ||
set(HAVE_SYS_TIME_H 1) | ||
set(HAVE_SYSEXITS_H 1) | ||
set(HAVE_TERMIOS_H 1) | ||
set(HAVE_UNISTD_H 1) | ||
elseif (PURE_WINDOWS) | ||
set(HAVE_DLFCN_H 0) | ||
set(HAVE_MACH_MACH_H 0) | ||
set(HAVE_MALLOC_MALLOC_H 0) | ||
set(HAVE_PTHREAD_H 0) | ||
set(HAVE_SIGNAL_H 1) | ||
set(HAVE_SYS_IOCTL_H 0) | ||
set(HAVE_SYS_MMAN_H 0) | ||
set(HAVE_SYS_PARAM_H 0) | ||
set(HAVE_SYS_RESOURCE_H 0) | ||
set(HAVE_SYS_STAT_H 1) | ||
set(HAVE_SYS_TIME_H 0) | ||
set(HAVE_SYSEXITS_H 0) | ||
set(HAVE_TERMIOS_H 0) | ||
set(HAVE_UNISTD_H 0) | ||
elseif (ZOS) | ||
# Confirmed in | ||
# https://github.com/llvm/llvm-project/pull/104706#issuecomment-2297109613 | ||
set(HAVE_DLFCN_H 1) | ||
set(HAVE_MACH_MACH_H 0) | ||
set(HAVE_MALLOC_MALLOC_H 0) | ||
set(HAVE_PTHREAD_H 1) | ||
set(HAVE_SIGNAL_H 1) | ||
set(HAVE_SYS_IOCTL_H 1) | ||
set(HAVE_SYS_MMAN_H 1) | ||
set(HAVE_SYS_PARAM_H 0) | ||
set(HAVE_SYS_RESOURCE_H 1) | ||
set(HAVE_SYS_STAT_H 1) | ||
set(HAVE_SYS_TIME_H 1) | ||
set(HAVE_SYSEXITS_H 0) | ||
set(HAVE_TERMIOS_H 1) | ||
set(HAVE_UNISTD_H 1) | ||
else() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In theory, once you set the values, the check queries will early-out because they detect the cached value. Having it always call the check functions (even if the value is set) may make it easy to add platforms where some of these are known to exist, but others may not be. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was referring to the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I've never felt I understood cache variables enough to feel comfortable relying on them. But I agree, this should be the case.
Are you sure this would serve a practical purpose? If one cares enough to set some of them beforehand to improve configuration times, I don't see how they would not check the rest. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I agree that this is the behavior (https://gitlab.kitware.com/cmake/cmake/-/blob/master/Modules/CheckIncludeFile.cmake?ref_type=heads#L46), but I don't see it documented at https://cmake.org/cmake/help/latest/module/CheckIncludeFile.html. So I'm reluctant to rely on this. |
||
# Other platforms that we don't promise support for. | ||
check_include_file(dlfcn.h HAVE_DLFCN_H) | ||
check_include_file(mach/mach.h HAVE_MACH_MACH_H) | ||
check_include_file(malloc/malloc.h HAVE_MALLOC_MALLOC_H) | ||
check_include_file(pthread.h HAVE_PTHREAD_H) | ||
check_include_file(signal.h HAVE_SIGNAL_H) | ||
check_include_file(sys/ioctl.h HAVE_SYS_IOCTL_H) | ||
check_include_file(sys/mman.h HAVE_SYS_MMAN_H) | ||
check_include_file(sys/param.h HAVE_SYS_PARAM_H) | ||
check_include_file(sys/resource.h HAVE_SYS_RESOURCE_H) | ||
check_include_file(sys/stat.h HAVE_SYS_STAT_H) | ||
check_include_file(sys/time.h HAVE_SYS_TIME_H) | ||
check_include_file(sysexits.h HAVE_SYSEXITS_H) | ||
check_include_file(termios.h HAVE_TERMIOS_H) | ||
check_include_file(unistd.h HAVE_UNISTD_H) | ||
endif() | ||
|
||
if( UNIX AND NOT (APPLE OR BEOS OR HAIKU) ) | ||
# Used by check_symbol_exists: | ||
list(APPEND CMAKE_REQUIRED_LIBRARIES "m") | ||
|
@@ -58,19 +138,6 @@ if(LLVM_USING_GLIBC) | |
endif() | ||
|
||
# include checks | ||
check_include_file(dlfcn.h HAVE_DLFCN_H) | ||
check_include_file(malloc/malloc.h HAVE_MALLOC_MALLOC_H) | ||
if( NOT PURE_WINDOWS ) | ||
check_include_file(pthread.h HAVE_PTHREAD_H) | ||
endif() | ||
check_include_file(signal.h HAVE_SIGNAL_H) | ||
check_include_file(sys/ioctl.h HAVE_SYS_IOCTL_H) | ||
check_include_file(sys/mman.h HAVE_SYS_MMAN_H) | ||
check_include_file(sys/resource.h HAVE_SYS_RESOURCE_H) | ||
check_include_file(sys/time.h HAVE_SYS_TIME_H) | ||
check_include_file(sysexits.h HAVE_SYSEXITS_H) | ||
check_include_file(termios.h HAVE_TERMIOS_H) | ||
check_include_file(unistd.h HAVE_UNISTD_H) | ||
check_include_file(valgrind/valgrind.h HAVE_VALGRIND_VALGRIND_H) | ||
check_symbol_exists(FE_ALL_EXCEPT "fenv.h" HAVE_DECL_FE_ALL_EXCEPT) | ||
check_symbol_exists(FE_INEXACT "fenv.h" HAVE_DECL_FE_INEXACT) | ||
|
@@ -86,7 +153,6 @@ check_c_source_compiles(" | |
int main(void) { return 0; }" | ||
HAVE_BUILTIN_THREAD_POINTER) | ||
|
||
check_include_file(mach/mach.h HAVE_MACH_MACH_H) | ||
check_include_file(CrashReporterClient.h HAVE_CRASHREPORTERCLIENT_H) | ||
if(APPLE) | ||
check_c_source_compiles(" | ||
|
Uh oh!
There was an error while loading. Please reload this page.