Skip to content

Commit

Permalink
[CMake] Drop the HAVE_CONFIG_H define
Browse files Browse the repository at this point in the history
This was an autotools leftover - CMake is always guaranteed to write the config file.
Also, rename the WZ-specific generated "config.h" to "wz2100-generated-config.h".
  • Loading branch information
past-due committed Oct 13, 2023
1 parent b13021a commit d6c57d6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 17 deletions.
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -686,8 +686,6 @@ macro(CONFIGURE_WZ_COMPILER_WARNINGS)
endif()
endmacro(CONFIGURE_WZ_COMPILER_WARNINGS)

add_definitions("-DHAVE_CONFIG_H")

# CMAKE_CURRENT_BINARY_DIR should come before the current source directory
# so that any build products are preferentially included over in-source build
# products that might have been generated by a different compilation method / run
Expand Down Expand Up @@ -794,7 +792,7 @@ function(CHECK_IS_ABSOLUTE_PATH _var _output)
endfunction()
CHECK_IS_ABSOLUTE_PATH(WZ_DATADIR WZ_DATADIR_ISABSOLUTE)
CHECK_IS_ABSOLUTE_PATH(WZ_LOCALEDIR WZ_LOCALEDIR_ISABSOLUTE)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/wz2100-generated-config.h)

# Attempt to find Miniupnpc (minimum supported API version = 9)
# NOTE: This is not available on every platform / distro
Expand Down
7 changes: 3 additions & 4 deletions lib/framework/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@
#define __STDC_LIMIT_MACROS
#endif

#if defined(HAVE_CONFIG_H)
# undef _XOPEN_SOURCE
# include "config.h"
#endif
// Always include generated config.h
#undef _XOPEN_SOURCE
#include "wz2100-generated-config.h"

#include <stddef.h> // for size_t

Expand Down
12 changes: 3 additions & 9 deletions lib/framework/wzglobal.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,9 @@
#define __STDC_LIMIT_MACROS
#endif

#if defined(HAVE_CONFIG_H)
# undef _XOPEN_SOURCE
# include "config.h"
#elif !defined(HAVE_CONFIG_H)
# define PACKAGE "warzone2100"
# define PACKAGE_BUGREPORT "http://wz2100.net/"
# define PACKAGE_NAME "Warzone 2100"
# define PACKAGE_TARNAME "warzone2100"
#endif
// Always include generated config.h
#undef _XOPEN_SOURCE
#include "wz2100-generated-config.h"


/* ---- Platform detection ---- */
Expand Down
1 change: 0 additions & 1 deletion src/input/manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

#include "manager.h"
#include "context.h"
#include "config.h"
#include "mapping.h"

#include "../keybind.h"
Expand Down

0 comments on commit d6c57d6

Please sign in to comment.