Use proper cmake detection of features.

This attempts to organize all needed items and places appropriate defines
in a single location. Redundant comparisons/defines were removed when noticed.

A few caveats, however:

* This may be better targeted towards the 5_1_0 branch instead of master right now.
* Cmake will run a little slower on configuration/generation now. That's due to the sanity checks it runs.
* There are some more checks to be added later, but this should be a solid start.

Thanks to the [libical](https://github.com/libical/libical) project for inspiration.
This commit is contained in:
Jason Felds
2015-09-05 10:51:17 -04:00
parent 92f449c8bf
commit e093d204c8
42 changed files with 438 additions and 159 deletions
+2
View File
@@ -2,7 +2,9 @@
#include "RageUtil.h"
#include "RageException.h"
#include "archutils/Unix/EmergencyShutdown.h"
#if defined(HAVE_UNISTD_H)
#include <unistd.h>
#endif
#include <assert.h>
/* We can define this symbol to catch failed assert() calls. This is only used
+4
View File
@@ -2,13 +2,17 @@
#include "Backtrace.h"
#include "RageUtil.h"
#if defined(HAVE_UNISTD_H)
#include <unistd.h>
#endif
#include <cstdlib>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <cerrno>
#if defined(HAVE_FCNTL_H)
#include <fcntl.h>
#endif
#if defined(BACKTRACE_METHOD_X86_LINUX)
#include "archutils/Common/PthreadHelpers.h"
+2
View File
@@ -6,7 +6,9 @@
#include <cstdio>
#include <cstdlib>
#include <cstdarg>
#if defined(HAVE_UNISTD_H)
#include <unistd.h>
#endif
#include <cstring>
#include <cerrno>
+4
View File
@@ -3,10 +3,14 @@
#include <cstdio>
#include <cstdlib>
#include <cstdarg>
#if defined(HAVE_UNISTD_H)
#include <unistd.h>
#endif
#include <cerrno>
#include <limits.h>
#if defined(HAVE_FCNTL_H)
#include <fcntl.h>
#endif
#include <csignal>
#include "RageLog.h" /* for RageLog::GetAdditionalLog, etc, only */
+2
View File
@@ -1,7 +1,9 @@
#include "global.h"
#include "GetSysInfo.h"
#if defined(HAVE_SYS_UTSNAME_H)
#include <sys/utsname.h>
#endif
void GetKernel( RString &sys, int &iVersion )
{
+2
View File
@@ -8,7 +8,9 @@
#include "archutils/Common/PthreadHelpers.h"
#endif
#if defined(HAVE_UNISTD_H)
#include <unistd.h>
#endif
#include <sys/mman.h>
#include <cerrno>
+1 -7
View File
@@ -9,7 +9,7 @@
#include <alloca.h>
#endif
#if !defined(MISSING_STDINT_H) /* need to define int64_t if so */
#if defined(HAVE_STDINT_H) /* need to define int64_t if so */
#include <stdint.h>
#endif
@@ -19,13 +19,7 @@
#ifdef BSD
#undef ALIGN
#undef MACHINE
#if defined(__NetBSD_Version__) && __NetBSD_Version__ < 299000900
#define lrintf(x) ((int)rint(x))
#endif
#endif
/* For RageLog */
#define HAVE_VERSION_INFO
#include "archutils/Common/gcc_byte_swaps.h"