From 9fe15509808b71f618e559dc04bce68ad21bdba0 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Mon, 19 Apr 2021 06:40:01 +0100 Subject: [PATCH] Make cmake.h available everywhere. The definition of HAVE_CMAKE_H is now at the very top of the main CMakeLists.txt, so that it applies to all objects. And the consequent include of cmake.h is at the very top of defs.h, so that it should be included first by everything. This way, I don't have to worry any more that the HAVE_FOO definitions in cmake.h might accidentally have failed to reach some part of the code. --- CMakeLists.txt | 4 ++-- defs.h | 4 ++++ unix/platform.h | 4 ---- windows/platform.h | 4 ---- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d617e387..b4c457b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,8 @@ project(putty LANGUAGES C) include(cmake/setup.cmake) +add_compile_definitions(HAVE_CMAKE_H) + add_library(utils STATIC utils/base64_decode_atom.c utils/base64_encode_atom.c @@ -161,8 +163,6 @@ add_executable(test_wildcard target_compile_definitions(test_wildcard PRIVATE TEST) target_link_libraries(test_wildcard utils ${platform_libraries}) -add_compile_definitions(HAVE_CMAKE_H) - foreach(subdir ${PLATFORM_SUBDIRS}) add_subdirectory(${subdir}) endforeach() diff --git a/defs.h b/defs.h index f175d257..b8205c10 100644 --- a/defs.h +++ b/defs.h @@ -22,6 +22,10 @@ #error Do not compile this code base with NDEBUG defined! #endif +#if HAVE_CMAKE_H +#include "cmake.h" +#endif + #include #include #include /* for __MINGW_PRINTF_FORMAT */ diff --git a/unix/platform.h b/unix/platform.h index 8f24b893..62f86a74 100644 --- a/unix/platform.h +++ b/unix/platform.h @@ -5,10 +5,6 @@ #ifndef PUTTY_UNIX_PLATFORM_H #define PUTTY_UNIX_PLATFORM_H -#if HAVE_CMAKE_H -#include "cmake.h" -#endif - #include /* for FILENAME_MAX */ #include /* C99 int types */ #ifndef NO_LIBDL diff --git a/windows/platform.h b/windows/platform.h index 8fadf803..cd89d411 100644 --- a/windows/platform.h +++ b/windows/platform.h @@ -5,10 +5,6 @@ #ifndef PUTTY_WINDOWS_PLATFORM_H #define PUTTY_WINDOWS_PLATFORM_H -#if HAVE_CMAKE_H -#include "cmake.h" -#endif - #include #include #include /* for FILENAME_MAX */