Skip to content

Commit 91c76e5

Browse files
committed
conditionally add dependencies include dirs
1 parent 04a1de1 commit 91c76e5

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

CMakeLists.txt

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ endif()
9292
find_package(Blkid)
9393
if(BLKID_FOUND)
9494
check_library_exists("${BLKID_LIBRARY}" blkid_get_tag_value "" HAVE_BLKID_GET_TAG_VALUE)
95+
include_directories("${BLKID_INCLUDE_DIRS}")
9596
endif()
9697

9798
find_package(Cap)
@@ -138,6 +139,7 @@ if(RPM_FOUND)
138139
check_library_exists("${RPM_LIBRARY}" rpmFreeFilesystems "" HAVE_RPMFREEFILESYSTEMS)
139140
check_library_exists("${RPM_LIBRARY}" rpmVerifyFile "" HAVE_RPMVERIFYFILE)
140141
set(HAVE_RPMVERCMP 1)
142+
include_directories("${RPM_INCLUDE_DIRS}")
141143
endif()
142144

143145
find_package(SELinux)
@@ -568,18 +570,26 @@ include_directories(
568570
"src/XCCDF_POLICY/public/"
569571
"yaml-filter/src/"
570572
${CMAKE_BINARY_DIR} # config.h is generated to build directory
573+
# Required dependencies include dirs can be added inconditionally
571574
${LIBXML2_INCLUDE_DIR}
572575
${XMLSEC_INCLUDE_DIRS}
576+
${LIBXSLT_INCLUDE_DIR}
573577
${OPENSSL_INCLUDE_DIR}
574578
${PCRE2_INCLUDE_DIRS}
575-
${LIBXSLT_INCLUDE_DIR}
576-
${RPM_INCLUDE_DIRS}
577-
${GCRYPT_INCLUDE_DIRS}
578-
${BLKID_INCLUDE_DIRS}
579-
${POPT_INCLUDE_DIRS}
580-
${SELINUX_INCLUDE_DIRS}
581579
)
582580

581+
if (GCRYPT_FOUND)
582+
include_directories("${GCRYPT_INCLUDE_DIRS}")
583+
endif()
584+
585+
if (POPT_FOUND)
586+
include_directories("${POPT_INCLUDE_DIRS}")
587+
endif()
588+
589+
if (SELINUX_FOUND)
590+
include_directories("${SELINUX_INCLUDE_DIRS}")
591+
endif()
592+
583593
# Honor visibility properties for all target types
584594
# Run "cmake --help-policy CMP0063" for policy details
585595
if (POLICY CMP0063)

0 commit comments

Comments
 (0)