From 0317a2b61df03bcf8e3e72af1c0aa960c6bbf4d1 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 12 May 2013 14:51:54 -0700 Subject: [PATCH] begin using autoconf features in cmake --- CMakeLists.txt | 11 +++++++++++ config.h.in | 3 +++ core/src/CMakeLists.txt | 2 +- core/src/util/bool.h | 1 + 4 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 config.h.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 40a939452..55808a6a2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,17 @@ project (arda-server C) enable_testing() +INCLUDE (CheckIncludeFiles) +INCLUDE (CheckSymbolExists) +CHECK_INCLUDE_FILES (stdbool.h HAVE_STDBOOL_H) +CHECK_SYMBOL_EXISTS (_Bool "stdbool.h" HAVE__BOOL) +CHECK_INCLUDE_FILES (strings.h HAVE_STRINGS_H) + +CONFIGURE_FILE ( + ${CMAKE_CURRENT_SOURCE_DIR}/config.h.in + ${CMAKE_BINARY_DIR}/include/config.h) +INCLUDE_DIRECTORIES (${CMAKE_BINARY_DIR}/include) + find_package (Lua 5 REQUIRED) find_package (ToLua REQUIRED) find_package (LibXml2 REQUIRED) diff --git a/config.h.in b/config.h.in new file mode 100644 index 000000000..e9eb4afb9 --- /dev/null +++ b/config.h.in @@ -0,0 +1,3 @@ +#cmakedefine HAVE_STDBOOL_H 1 +#cmakedefine HAVE__BOOL 1 +#cmakedefine HAVE_STRINGS_H 1 diff --git a/core/src/CMakeLists.txt b/core/src/CMakeLists.txt index ff81026a1..98373e8f1 100755 --- a/core/src/CMakeLists.txt +++ b/core/src/CMakeLists.txt @@ -3,7 +3,7 @@ project (eressea C) IF(CMAKE_COMPILER_IS_GNUCC) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Werror -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wno-char-subscripts -Wno-long-long") - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -DHAVE__BOOL") + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") ENDIF(CMAKE_COMPILER_IS_GNUCC) set (ERESSEA_LIBRARY ${PROJECT_NAME} CACHE INTERNAL "Eressea Core Library") diff --git a/core/src/util/bool.h b/core/src/util/bool.h index 0bdebc9ec..6da28be80 100644 --- a/core/src/util/bool.h +++ b/core/src/util/bool.h @@ -1,3 +1,4 @@ +#include #if HAVE_STDBOOL_H # include #else