begin using autoconf features in cmake

This commit is contained in:
Enno Rehling 2013-05-12 14:51:54 -07:00
parent 8e289968d0
commit 0317a2b61d
4 changed files with 16 additions and 1 deletions

View File

@ -3,6 +3,17 @@ project (arda-server C)
enable_testing() 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 (Lua 5 REQUIRED)
find_package (ToLua REQUIRED) find_package (ToLua REQUIRED)
find_package (LibXml2 REQUIRED) find_package (LibXml2 REQUIRED)

3
config.h.in Normal file
View File

@ -0,0 +1,3 @@
#cmakedefine HAVE_STDBOOL_H 1
#cmakedefine HAVE__BOOL 1
#cmakedefine HAVE_STRINGS_H 1

View File

@ -3,7 +3,7 @@ project (eressea C)
IF(CMAKE_COMPILER_IS_GNUCC) 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} -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) ENDIF(CMAKE_COMPILER_IS_GNUCC)
set (ERESSEA_LIBRARY ${PROJECT_NAME} CACHE INTERNAL "Eressea Core Library") set (ERESSEA_LIBRARY ${PROJECT_NAME} CACHE INTERNAL "Eressea Core Library")

View File

@ -1,3 +1,4 @@
#include <config.h>
#if HAVE_STDBOOL_H #if HAVE_STDBOOL_H
# include <stdbool.h> # include <stdbool.h>
#else #else