use add_definitions instead of CMAKE_C_FLAGS, define ERESSEA_VERSION only on version.c

This commit is contained in:
Enno Rehling 2016-09-15 20:14:17 +02:00
parent 318cf68e1b
commit 10916bb0a1
3 changed files with 9 additions and 6 deletions

View File

@ -60,7 +60,7 @@ CONFIGURE_FILE (
${CMAKE_CURRENT_SOURCE_DIR}/autoconf.h.in
${CMAKE_BINARY_DIR}/include/autoconf.h)
INCLUDE_DIRECTORIES (${CMAKE_BINARY_DIR}/include)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_AUTOCONF")
add_definitions(-DUSE_AUTOCONF)
add_subdirectory (cutest)
add_subdirectory (cJSON)

View File

@ -13,14 +13,16 @@ include_directories (${BSON_INCLUDE_DIR})
include_directories (${INIPARSER_INCLUDE_DIR})
IF(DEFINED ERESSEA_VERSION)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DERESSEA_VERSION=\\\"${ERESSEA_VERSION}\\\"")
set_source_files_properties(kernel/version.c PROPERTIES
COMPILE_DEFINITIONS ERESSEA_VERSION="${ERESSEA_VERSION}")
ENDIF()
IF(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
# SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion -Wno-sign-conversion")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wsign-compare -Wall -Werror -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wno-char-subscripts -Wno-long-long")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=unused-but-set-variable")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -DHAVE__BOOL")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
add_definitions(-DHAVE__BOOL)
ELSEIF(MSVC)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Wall /WX /MP")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG
@ -251,18 +253,18 @@ install(TARGETS eressea DESTINATION "bin")
if (SQLITE3_FOUND)
target_link_libraries(eressea ${SQLITE3_LIBRARIES})
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_SQLITE")
add_definitions(-DUSE_SQLITE)
endif(SQLITE3_FOUND)
if (CURSES_FOUND)
include_directories (${CURSES_INCLUDE_DIR})
target_link_libraries(eressea ${CURSES_LIBRARIES})
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_CURSES")
add_definitions(-DUSE_CURSES)
endif(CURSES_FOUND)
if (LIBXML2_FOUND)
include_directories (${LIBXML2_INCLUDE_DIR})
target_link_libraries(eressea ${LIBXML2_LIBRARIES})
target_link_libraries(test_eressea ${LIBXML2_LIBRARIES})
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_LIBXML2")
add_definitions(-DUSE_LIBXML2)
endif (LIBXML2_FOUND)

View File

@ -33,6 +33,7 @@ jsonconf.test.c
)
SET(_FILES
version.c
alliance.c
ally.c
build.c