mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 04:43:10 +00:00
cmake: use C++ rather than C checks for all checks
Disables C language for fish project to catch errors.
This commit is contained in:
parent
8f7d68ee3e
commit
68da7ab822
2 changed files with 38 additions and 34 deletions
|
@ -1,5 +1,5 @@
|
|||
CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
|
||||
PROJECT(fish-shell)
|
||||
PROJECT(fish-shell CXX)
|
||||
|
||||
# We are C++11.
|
||||
SET(CMAKE_CXX_STANDARD 11)
|
||||
|
|
|
@ -3,6 +3,10 @@ INCLUDE(FindCurses)
|
|||
|
||||
# Get threads.
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
# FindThreads < 3.4.0 doesn't work for C++-only projects
|
||||
IF(CMAKE_VERSION VERSION_LESS 3.4.0)
|
||||
ENABLE_LANGUAGE(C)
|
||||
ENDIF()
|
||||
FIND_PACKAGE(Threads REQUIRED)
|
||||
|
||||
IF(APPLE)
|
||||
|
@ -14,79 +18,79 @@ ENDIF()
|
|||
SET(PACKAGE_NAME "fish")
|
||||
SET(PACKAGE_TARNAME "fish")
|
||||
INCLUDE(CheckFunctionExists)
|
||||
INCLUDE(CheckSymbolExists)
|
||||
INCLUDE(CheckIncludeFiles)
|
||||
INCLUDE(CheckCXXSymbolExists)
|
||||
INCLUDE(CheckIncludeFileCXX)
|
||||
INCLUDE(CheckStructHasMember)
|
||||
INCLUDE(CheckCXXSourceCompiles)
|
||||
INCLUDE(CheckTypeSize)
|
||||
CHECK_FUNCTION_EXISTS(backtrace_symbols HAVE_BACKTRACE_SYMBOLS)
|
||||
CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME)
|
||||
CHECK_FUNCTION_EXISTS(ctermid_r HAVE_CTERMID_R)
|
||||
CHECK_INCLUDE_FILES(curses.h HAVE_CURSES_H)
|
||||
CHECK_STRUCT_HAS_MEMBER("struct dirent" d_type dirent.h HAVE_STRUCT_DIRENT_D_TYPE)
|
||||
CHECK_INCLUDE_FILE_CXX(curses.h HAVE_CURSES_H)
|
||||
CHECK_STRUCT_HAS_MEMBER("struct dirent" d_type dirent.h HAVE_STRUCT_DIRENT_D_TYPE LANGUAGE CXX)
|
||||
CHECK_FUNCTION_EXISTS(dirfd HAVE_DIRFD)
|
||||
CHECK_INCLUDE_FILES(execinfo.h HAVE_EXECINFO_H)
|
||||
CHECK_INCLUDE_FILE_CXX(execinfo.h HAVE_EXECINFO_H)
|
||||
CHECK_FUNCTION_EXISTS(flock HAVE_FLOCK)
|
||||
# futimens is new in OS X 10.13 but is a weak symbol.
|
||||
# Don't assume it exists just because we can link - it may be null.
|
||||
CHECK_SYMBOL_EXISTS(futimens sys/stat.h HAVE_FUTIMENS)
|
||||
CHECK_CXX_SYMBOL_EXISTS(futimens sys/stat.h HAVE_FUTIMENS)
|
||||
CHECK_FUNCTION_EXISTS(futimes HAVE_FUTIMES)
|
||||
CHECK_FUNCTION_EXISTS(getifaddrs HAVE_GETIFADDRS)
|
||||
CHECK_INCLUDE_FILES(getopt.h HAVE_GETOPT_H)
|
||||
CHECK_INCLUDE_FILE_CXX(getopt.h HAVE_GETOPT_H)
|
||||
CHECK_FUNCTION_EXISTS(getpwent HAVE_GETPWENT)
|
||||
CHECK_FUNCTION_EXISTS(gettext HAVE_GETTEXT)
|
||||
CHECK_INCLUDE_FILES(inttypes.h HAVE_INTTYPES_H)
|
||||
CHECK_INCLUDE_FILE_CXX(inttypes.h HAVE_INTTYPES_H)
|
||||
CHECK_FUNCTION_EXISTS(killpg HAVE_KILLPG)
|
||||
CHECK_INCLUDE_FILES(libintl.h HAVE_LIBINTL_H)
|
||||
CHECK_INCLUDE_FILE_CXX(libintl.h HAVE_LIBINTL_H)
|
||||
CHECK_FUNCTION_EXISTS(lrand48_r HAVE_LRAND48_R)
|
||||
CHECK_INCLUDE_FILES(memory.h HAVE_MEMORY_H)
|
||||
CHECK_INCLUDE_FILE_CXX(memory.h HAVE_MEMORY_H)
|
||||
CHECK_FUNCTION_EXISTS(mkostemp HAVE_MKOSTEMP)
|
||||
SET(HAVE_CURSES_H ${CURSES_HAVE_CURSES_H})
|
||||
SET(HAVE_NCURSES_CURSES_H ${CURSES_HAVE_NCURSES_CURSES_H})
|
||||
SET(HAVE_CURSES_H ${CURSES_HAVE_CURSES_H})
|
||||
SET(HAVE_NCURSES_H ${CURSES_HAVE_NCURSES_H})
|
||||
CHECK_INCLUDE_FILES("ncurses/term.h" HAVE_NCURSES_TERM_H)
|
||||
CHECK_INCLUDE_FILE_CXX("ncurses/term.h" HAVE_NCURSES_TERM_H)
|
||||
CHECK_FUNCTION_EXISTS(DIR HAVE_NDIR_H)
|
||||
CHECK_FUNCTION_EXISTS(shm_open HAVE_SHM_OPEN)
|
||||
CHECK_INCLUDE_FILES(siginfo.h HAVE_SIGINFO_H)
|
||||
CHECK_INCLUDE_FILES(spawn.h HAVE_SPAWN_H)
|
||||
CHECK_INCLUDE_FILES(stdint.h HAVE_STDINT_H)
|
||||
CHECK_INCLUDE_FILES(stdlib.h HAVE_STDLIB_H)
|
||||
CHECK_INCLUDE_FILE_CXX(siginfo.h HAVE_SIGINFO_H)
|
||||
CHECK_INCLUDE_FILE_CXX(spawn.h HAVE_SPAWN_H)
|
||||
CHECK_INCLUDE_FILE_CXX(stdint.h HAVE_STDINT_H)
|
||||
CHECK_INCLUDE_FILE_CXX(stdlib.h HAVE_STDLIB_H)
|
||||
CHECK_FUNCTION_EXISTS(std::wcscasecmp HAVE_STD__WCSCASECMP)
|
||||
CHECK_FUNCTION_EXISTS(std::wcsdup HAVE_STD__WCSDUP)
|
||||
CHECK_FUNCTION_EXISTS(std::wcsncasecmp HAVE_STD__WCSNCASECMP)
|
||||
CHECK_INCLUDE_FILES(strings.h HAVE_STRINGS_H)
|
||||
CHECK_INCLUDE_FILES(string.h HAVE_STRING_H)
|
||||
CHECK_INCLUDE_FILES(stropts.h HAVE_STROPTS_H)
|
||||
CHECK_INCLUDE_FILE_CXX(strings.h HAVE_STRINGS_H)
|
||||
CHECK_INCLUDE_FILE_CXX(string.h HAVE_STRING_H)
|
||||
CHECK_INCLUDE_FILE_CXX(stropts.h HAVE_STROPTS_H)
|
||||
CHECK_FUNCTION_EXISTS(struct dirent HAVE_STRUCT_DIRENT_D_TYPE)
|
||||
CHECK_FUNCTION_EXISTS(struct stat HAVE_STRUCT_STAT_ST_CTIME_NSEC)
|
||||
CHECK_FUNCTION_EXISTS(struct stat HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC)
|
||||
CHECK_FUNCTION_EXISTS(struct stat HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC)
|
||||
CHECK_SYMBOL_EXISTS(sys_errlist stdio.h HAVE_SYS_ERRLIST)
|
||||
CHECK_INCLUDE_FILES(sys/ioctl.h HAVE_SYS_IOCTL_H)
|
||||
CHECK_INCLUDE_FILES(sys/resource.h HAVE_SYS_RESOURCE_H)
|
||||
CHECK_INCLUDE_FILES(sys/select.h HAVE_SYS_SELECT_H)
|
||||
CHECK_INCLUDE_FILES(sys/stat.h HAVE_SYS_STAT_H)
|
||||
CHECK_INCLUDE_FILES(sys/sysctl.h HAVE_SYS_SYSCTL_H)
|
||||
CHECK_INCLUDE_FILES(sys/types.h HAVE_SYS_TYPES_H)
|
||||
CHECK_INCLUDE_FILES(termios.h HAVE_TERMIOS_H)
|
||||
CHECK_INCLUDE_FILES(term.h HAVE_TERM_H)
|
||||
CHECK_INCLUDE_FILES(unistd.h HAVE_UNISTD_H)
|
||||
CHECK_CXX_SYMBOL_EXISTS(sys_errlist stdio.h HAVE_SYS_ERRLIST)
|
||||
CHECK_INCLUDE_FILE_CXX(sys/ioctl.h HAVE_SYS_IOCTL_H)
|
||||
CHECK_INCLUDE_FILE_CXX(sys/resource.h HAVE_SYS_RESOURCE_H)
|
||||
CHECK_INCLUDE_FILE_CXX(sys/select.h HAVE_SYS_SELECT_H)
|
||||
CHECK_INCLUDE_FILE_CXX(sys/stat.h HAVE_SYS_STAT_H)
|
||||
CHECK_INCLUDE_FILE_CXX(sys/sysctl.h HAVE_SYS_SYSCTL_H)
|
||||
CHECK_INCLUDE_FILE_CXX(sys/types.h HAVE_SYS_TYPES_H)
|
||||
CHECK_INCLUDE_FILE_CXX(termios.h HAVE_TERMIOS_H)
|
||||
CHECK_INCLUDE_FILE_CXX(term.h HAVE_TERM_H)
|
||||
CHECK_INCLUDE_FILE_CXX(unistd.h HAVE_UNISTD_H)
|
||||
CHECK_FUNCTION_EXISTS(wcscasecmp HAVE_WCSCASECMP)
|
||||
CHECK_FUNCTION_EXISTS(wcsdup HAVE_WCSDUP)
|
||||
CHECK_FUNCTION_EXISTS(wcslcpy HAVE_WCSLCPY)
|
||||
CHECK_FUNCTION_EXISTS(wcsncasecmp HAVE_WCSNCASECMP)
|
||||
CHECK_FUNCTION_EXISTS(wcsndup HAVE_WCSNDUP)
|
||||
CHECK_SYMBOL_EXISTS(_nl_msg_cat_cntr stdlib.h HAVE__NL_MSG_CAT_CNTR)
|
||||
CHECK_SYMBOL_EXISTS(_sys_errs stdlib.h HAVE__SYS__ERRS)
|
||||
CHECK_CXX_SYMBOL_EXISTS(_nl_msg_cat_cntr stdlib.h HAVE__NL_MSG_CAT_CNTR)
|
||||
CHECK_CXX_SYMBOL_EXISTS(_sys_errs stdlib.h HAVE__SYS__ERRS)
|
||||
|
||||
SET(CMAKE_EXTRA_INCLUDE_FILES termios.h sys/ioctl.h)
|
||||
CHECK_TYPE_SIZE("struct winsize" STRUCT_WINSIZE)
|
||||
CHECK_SYMBOL_EXISTS("TIOCGWINSZ" "termios.h sys/ioctl.h" HAVE_TIOCGWINSZ)
|
||||
CHECK_TYPE_SIZE("struct winsize" STRUCT_WINSIZE LANGUAGE CXX)
|
||||
CHECK_CXX_SYMBOL_EXISTS("TIOCGWINSZ" "termios.h sys/ioctl.h" HAVE_TIOCGWINSZ)
|
||||
IF(${STRUCT_WINSIZE} AND (DEFINED HAVE_TIOCGWINSZ))
|
||||
SET(HAVE_WINSIZE 1)
|
||||
ENDIF()
|
||||
SET(CMAKE_EXTRA_INCLUDE_FILES)
|
||||
|
||||
SET(HAVE__PROC_SELF_STAT (EXISTS "/proc/self/stat"))
|
||||
CHECK_TYPE_SIZE("wchar_t[8]" WCHAR_T_BITS)
|
||||
CHECK_TYPE_SIZE("wchar_t[8]" WCHAR_T_BITS LANGUAGE CXX)
|
||||
|
|
Loading…
Reference in a new issue