shithub: puzzles

Download patch

ref: 1235f05af70c3acea7eedb0cbfd726ab4ec357c4
parent: 1880feb442c4b2d73137b02c8dc58f8d38f4e16a
author: Ben Harris <bjh21@bjh21.me.uk>
date: Sun Feb 19 19:33:42 EST 2023

Make the HAVE_HF_ITER define target-specific

Leaking HAVE_HF_ITER into the entire build just because fuzzpuzz
wanted it was ugly, and also this needs fewer lines of CMake code.

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -279,11 +279,8 @@
   write_generated_games_header()
   include(CheckFunctionExists)
   check_function_exists(HF_ITER HAVE_HF_ITER)
-  if(HAVE_HF_ITER)
-    add_definitions(-DHAVE_HF_ITER)
-  endif()
   cliprogram(fuzzpuzz fuzzpuzz.c list.c ${puzzle_sources}
-    COMPILE_DEFINITIONS COMBINED)
+    COMPILE_DEFINITIONS COMBINED $<$<BOOL:${HAVE_HF_ITER}>:HAVE_HF_ITER>)
   target_include_directories(fuzzpuzz PRIVATE ${generated_include_dir})
 endif()