Skip to content

Commit

Permalink
Test for the variable rather than it's expansion in cmake files
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pmatilai committed May 9, 2023
1 parent d18d6ce commit ae1b8c8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
23 changes: 15 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion docs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit ae1b8c8

Please sign in to comment.