From 545d98fc0859fc96988d7a663fb0f74fa2e60783 Mon Sep 17 00:00:00 2001 From: dhewg Date: Sat, 14 Jan 2012 13:56:19 +0100 Subject: [PATCH] CMake: Create config.h Use config.h for configure time settings. --- neo/CMakeLists.txt | 11 +++++++---- neo/config.h.in | 6 ++++++ neo/sys/platform.h | 1 + 3 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 neo/config.h.in diff --git a/neo/CMakeLists.txt b/neo/CMakeLists.txt index bf1b2cf8..97318601 100644 --- a/neo/CMakeLists.txt +++ b/neo/CMakeLists.txt @@ -88,10 +88,7 @@ include_directories(${JPEG_INCLUDE_DIR}) set(CMAKE_REQUIRED_INCLUDES ${JPEG_INCLUDE_DIR}) set(CMAKE_REQUIRED_LIBRARIES ${JPEG_LIBRARY}) -CHECK_FUNCTION_EXISTS("jpeg_mem_src" jpeg_has_mem_src) -if (jpeg_has_mem_src) - add_definitions(-DHAVE_JPEG_MEM_SRC) -endif () +CHECK_FUNCTION_EXISTS("jpeg_mem_src" HAVE_JPEG_MEM_SRC) find_package(OGG REQUIRED) include_directories(${OGG_INCLUDE_DIR}) @@ -231,6 +228,11 @@ if (WIN32) ) endif() +configure_file( + "${CMAKE_SOURCE_DIR}/config.h.in" + "${CMAKE_BINARY_DIR}/config.h" +) + message(STATUS "Building ${CMAKE_BUILD_TYPE} for ${os}.${cpu}") set(src_renderer @@ -695,6 +697,7 @@ else() ) endif() +include_directories(${CMAKE_BINARY_DIR}) include_directories(${CMAKE_SOURCE_DIR}) add_library(idlib STATIC ${src_idlib}) diff --git a/neo/config.h.in b/neo/config.h.in new file mode 100644 index 00000000..a6cc325e --- /dev/null +++ b/neo/config.h.in @@ -0,0 +1,6 @@ +#ifndef __DOOM3_CONFIG_H__ +#define __DOOM3_CONFIG_H__ + +#cmakedefine HAVE_JPEG_MEM_SRC + +#endif diff --git a/neo/sys/platform.h b/neo/sys/platform.h index 1faae4c3..bcc521fc 100644 --- a/neo/sys/platform.h +++ b/neo/sys/platform.h @@ -29,6 +29,7 @@ If you have questions concerning this license or the applicable additional terms #ifndef __PLATFORM__ #define __PLATFORM__ +#include "config.h" #include "framework/BuildDefines.h" /*