summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2023-05-09 10:10:17 +0300
committerPanu Matilainen <pmatilai@redhat.com>2023-05-09 15:45:29 +0300
commitae1b8c8c4eb26dd677e39a91f65f8a17f6bdbbf2 (patch)
tree761c1ac3fc407ecfabd88233965b724b999684d4
parentd18d6ce41df4a5887df47a69052a401808aef19f (diff)
downloadrpm-ae1b8c8c4eb26dd677e39a91f65f8a17f6bdbbf2.tar.gz
Test for the variable rather than it's expansion in cmake files
Testing for the expansion was a cmake newbie mistake that can go wrong in weird ways, test for the variable instead, consistently. Don't try to be clever with for-loops, just test for each case separately. This makes it greppable as well.
-rw-r--r--CMakeLists.txt23
-rw-r--r--docs/CMakeLists.txt2
2 files changed, 16 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4a5332f4b..b006ed34e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -272,20 +272,27 @@ id0name(UID_0_USER /etc/passwd)
id0name(GID_0_GROUP /etc/group)
# map module/package findings to config.h
-if (${BZIP2_FOUND})
+if (BZIP2_FOUND)
set(HAVE_BZLIB_H 1)
endif()
-if (${LIBLZMA_FOUND})
+if (LIBLZMA_FOUND)
set(HAVE_LZMA_H 1)
endif()
-if (${Iconv_FOUND})
+if (Iconv_FOUND)
set(HAVE_ICONV 1)
endif()
-foreach(found ZSTD READLINE LIBELF LIBDW)
- if (${${found}_FOUND})
- set(HAVE_${found} 1)
- endif()
-endforeach()
+if (ZSTD_FOUND)
+ set(HAVE_ZSTD 1)
+endif()
+if (READLINE_FOUND)
+ set(HAVE_READLINE 1)
+endif()
+if (LIBELF_FOUND)
+ set(HAVE_LIBELF 1)
+endif()
+if (LIBDW_FOUND)
+ set(HAVE_LIBDW 1)
+endif()
check_symbol_exists(major "sys/sysmacros.h" MAJOR_IN_SYSMACROS)
if (NOT MAJOR_IN_SYSMACROS)
diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt
index cebf51ee6..1d216a089 100644
--- a/docs/CMakeLists.txt
+++ b/docs/CMakeLists.txt
@@ -3,7 +3,7 @@ find_program(PANDOC NAMES pandoc)
add_subdirectory(man)
find_package(Doxygen)
-if (${DOXYGEN_FOUND})
+if (DOXYGEN_FOUND)
# XXX API docs should be pre-built in tarballs
file(GLOB headers ${CMAKE_SOURCE_DIR}/include/rpm/*.h)
doxygen_add_docs(apidoc librpm/Doxyheader.h ${headers}