Skip to content

Commit

Permalink
Find LibXML2 using find_package
Browse files Browse the repository at this point in the history
Also removes variable HAVE_XMLTEXTREADERREAD because it is never used.
  • Loading branch information
jan-cerny committed Nov 14, 2017
1 parent f56e727 commit 1fef167
Show file tree
Hide file tree
Showing 22 changed files with 27 additions and 31 deletions.
7 changes: 2 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,7 @@ find_package(SELinux)
find_package(SWIG)

# XML2
pkg_check_modules(XML2 REQUIRED libxml-2.0>=2.0)
if (XML2_FOUND)
CHECK_LIBRARY_EXISTS(xml2 xmlTextReaderRead "" HAVE_XMLTEXTREADERREAD)
endif()
find_package(LibXml2 REQUIRED)

# XSTL
pkg_check_modules(XSLT REQUIRED libxslt>=1.1)
Expand Down Expand Up @@ -282,7 +279,7 @@ include_directories(
"src/XCCDF_POLICY/"
"src/XCCDF_POLICY/public/"
${CMAKE_BINARY_DIR}
${XML2_INCLUDE_DIRS}
${LIBXML2_INCLUDE_DIR}
)

add_subdirectory("src")
Expand Down
1 change: 0 additions & 1 deletion config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
#cmakedefine HAVE_HEADERSPRINTF
#cmakedefine HAVE_RPMFREECRYPTO
#cmakedefine HAVE_RPMFREEFILESYSTEMS
#cmakedefine HAVE_XMLTEXTREADERREAD
#cmakedefine HAVE_XSLTDOCUMENTFUNCTION

#cmakedefine HAVE_RPMVERCMP
Expand Down
2 changes: 1 addition & 1 deletion src/OVAL/probes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ add_library(probe
"probe/option.h"
)

target_link_libraries(probe seap oval ${CMAKE_THREAD_LIBS_INIT} ${PCRE_LIBRARIES} ${XML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${RPM_LIBRARIES})
target_link_libraries(probe seap oval ${CMAKE_THREAD_LIBS_INIT} ${PCRE_LIBRARIES} ${LIBXML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${RPM_LIBRARIES})
target_include_directories(probe PUBLIC "." "public")

include_directories("public")
Expand Down
2 changes: 1 addition & 1 deletion tests/API/CPE/dict/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_executable(test_api_cpe_dict "test_api_cpe_dict.c")
target_link_libraries(test_api_cpe_dict openscap ${XML2_LIBRARIES} ${XSLT_LIBRARIES}
target_link_libraries(test_api_cpe_dict openscap ${LIBXML2_LIBRARIES} ${XSLT_LIBRARIES}
${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES})
add_oscap_test("test_api_cpe_dict.sh")
2 changes: 1 addition & 1 deletion tests/API/CPE/lang/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
add_executable(test_api_cpe_lang "test_api_cpe_lang.c")
target_link_libraries(test_api_cpe_lang openscap ${XML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES})
target_link_libraries(test_api_cpe_lang openscap ${LIBXML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES})
add_oscap_test("test_api_cpe_lang.sh")
2 changes: 1 addition & 1 deletion tests/API/CPE/name/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
add_executable(test_api_cpe_uri "test_api_cpe_uri.c")
target_link_libraries(test_api_cpe_uri openscap ${XML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES})
target_link_libraries(test_api_cpe_uri openscap ${LIBXML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES})
add_oscap_test("test_api_cpe_uri.sh")
2 changes: 1 addition & 1 deletion tests/API/CVE/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
add_executable(test_api_cve "test_api_cve.c")
target_link_libraries(test_api_cve openscap ${XML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES})
target_link_libraries(test_api_cve openscap ${LIBXML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES})
add_oscap_test("test_api_cve.sh")
2 changes: 1 addition & 1 deletion tests/API/CVSS/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
add_executable(test_api_cvss "test_api_cvss.c")
target_link_libraries(test_api_cvss openscap ${XML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES})
target_link_libraries(test_api_cvss openscap ${LIBXML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES})
add_oscap_test("test_api_cvss.sh")
2 changes: 1 addition & 1 deletion tests/API/OVAL/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ add_executable(test_api_oval test_api_oval.c)
add_executable(test_api_syschar test_api_syschar.c)
add_executable(test_api_results test_api_results.c)
add_executable(test_api_directives test_api_directives.c)
set(TEST_API_OVAL_LIBRARIES openscap ${XML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES})
set(TEST_API_OVAL_LIBRARIES openscap ${LIBXML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES})
target_link_libraries(test_api_oval ${TEST_API_OVAL_LIBRARIES})
target_link_libraries(test_api_syschar ${TEST_API_OVAL_LIBRARIES})
target_link_libraries(test_api_results ${TEST_API_OVAL_LIBRARIES})
Expand Down
2 changes: 1 addition & 1 deletion tests/API/OVAL/glob_to_regex/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_executable(test_glob_to_regex test_glob_to_regex.c)
set(TEST_API_OVAL_LIBRARIES openscap ${XML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES})
set(TEST_API_OVAL_LIBRARIES openscap ${LIBXML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES})
target_link_libraries(test_glob_to_regex ${TEST_API_OVAL_LIBRARIES})
add_oscap_test("test_glob_to_regex.sh")
2 changes: 1 addition & 1 deletion tests/API/OVAL/schema_version/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_executable(test_schema_version test_schema_version.c)
set(TEST_API_OVAL_LIBRARIES openscap ${XML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES})
set(TEST_API_OVAL_LIBRARIES openscap ${LIBXML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES})
target_link_libraries(test_schema_version ${TEST_API_OVAL_LIBRARIES})
add_oscap_test("test_schema_version.sh")
2 changes: 1 addition & 1 deletion tests/API/SEAP/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set(LIBRARIES openscap ${XML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES})
set(LIBRARIES openscap ${LIBXML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES})
add_executable(test_api_seap_concurency test_api_seap_concurency.c)
target_link_libraries(test_api_seap_concurency ${LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
add_executable(test_api_seap_list test_api_seap_list.c)
Expand Down
2 changes: 1 addition & 1 deletion tests/API/XCCDF/parser/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
add_executable(test_api_xccdf test_api_xccdf.c)
target_link_libraries(test_api_xccdf openscap ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${XML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${RPM_LIBRARIES})
target_link_libraries(test_api_xccdf openscap ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${LIBXML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${RPM_LIBRARIES})
add_oscap_test("test_api_xccdf.sh")
6 changes: 3 additions & 3 deletions tests/API/XCCDF/unittests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ add_executable(test_oscap_common
${CMAKE_SOURCE_DIR}/src/common/list.c
${CMAKE_SOURCE_DIR}/src/common/alloc.c
)
target_link_libraries(test_oscap_common openscap ${XML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES})
target_link_libraries(test_oscap_common openscap ${LIBXML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES})

add_executable(test_xccdf_overrides
test_xccdf_overrides.c
)
target_link_libraries(test_xccdf_overrides openscap ${XML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES})
target_link_libraries(test_xccdf_overrides openscap ${LIBXML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES})

add_executable(test_xccdf_shall_pass
test_xccdf_shall_pass.c
unit_helper.c
)
target_link_libraries(test_xccdf_shall_pass openscap ${XML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES})
target_link_libraries(test_xccdf_shall_pass openscap ${LIBXML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES})

add_oscap_test("all.sh")
4 changes: 2 additions & 2 deletions tests/API/probes/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
add_executable(test_api_probes_smoke "test_api_probes_smoke.c")
add_executable(oval_fts_list "oval_fts_list.c")
target_link_libraries(test_api_probes_smoke openscap ${XML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES})
target_link_libraries(oval_fts_list openscap ${XML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES})
target_link_libraries(test_api_probes_smoke openscap ${LIBXML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES})
target_link_libraries(oval_fts_list openscap ${LIBXML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES})
target_include_directories(test_api_probes_smoke PUBLIC ${CMAKE_SOURCE_DIR}/src/OVAL/probes ${CMAKE_SOURCE_DIR}/src/OVAL/probes/public)
target_include_directories(oval_fts_list PUBLIC ${CMAKE_SOURCE_DIR}/src/OVAL/probes ${CMAKE_SOURCE_DIR}/src/OVAL/probes/public)
add_oscap_test("all.sh")
6 changes: 3 additions & 3 deletions tests/DS/ds_sds_index/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
add_executable(test_ds_sds_index "test_ds_sds_index.c")
add_executable(test_ds_sds_index_multiple "test_ds_sds_index_multiple.c")
add_executable(test_ds_sds_index_invalid "test_ds_sds_index_invalid.c")
target_link_libraries(test_ds_sds_index openscap ${XML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES} ${BZIP2_LIBRARIES})
target_link_libraries(test_ds_sds_index_multiple openscap ${XML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES} ${BZIP2_LIBRARIES})
target_link_libraries(test_ds_sds_index_invalid openscap ${XML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES} ${BZIP2_LIBRARIES})
target_link_libraries(test_ds_sds_index openscap ${LIBXML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES} ${BZIP2_LIBRARIES})
target_link_libraries(test_ds_sds_index_multiple openscap ${LIBXML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES} ${BZIP2_LIBRARIES})
target_link_libraries(test_ds_sds_index_invalid openscap ${LIBXML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES} ${BZIP2_LIBRARIES})

add_oscap_test("all.sh")
2 changes: 1 addition & 1 deletion tests/bz2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
if(BZIP2_FOUND)
add_executable(test_bz2_memory_source "test_bz2_memory_source.c")
target_link_libraries(test_bz2_memory_source openscap ${XML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES} ${BZIP2_LIBRARIES})
target_link_libraries(test_bz2_memory_source openscap ${LIBXML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES} ${BZIP2_LIBRARIES})

add_oscap_test("all.sh")
endif()
2 changes: 1 addition & 1 deletion tests/oscap_string/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ add_executable(test_oscap_string
${CMAKE_SOURCE_DIR}/src/common/oscap_buffer.c
${CMAKE_SOURCE_DIR}/src/common/alloc.c
)
target_link_libraries(test_oscap_string openscap ${XML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES} ${BZIP2_LIBRARIES})
target_link_libraries(test_oscap_string openscap ${LIBXML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES} ${BZIP2_LIBRARIES})

add_oscap_test("test_oscap_string.sh")
2 changes: 1 addition & 1 deletion tests/probes/interface/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
if(ENABLE_PROBES_UNIX)
add_executable(test_probes_interface "test_probes_interface.c")
target_link_libraries(test_probes_interface openscap ${XML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES})
target_link_libraries(test_probes_interface openscap ${LIBXML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES})
add_oscap_test("test_probes_interface.sh")
endif()
2 changes: 1 addition & 1 deletion tests/probes/sysinfo/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
if(ENABLE_PROBES_INDEPENDENT)
add_executable(test_probes_sysinfo "test_probes_sysinfo.c")
target_link_libraries(test_probes_sysinfo openscap ${XML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES})
target_link_libraries(test_probes_sysinfo openscap ${LIBXML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES})
add_oscap_test("test_probes_sysinfo.sh")
endif()
2 changes: 1 addition & 1 deletion tests/probes/xinetd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
if(ENABLE_PROBES_UNIX)
add_executable(test_probe_xinetd "test_probe_xinetd.c")
target_link_libraries(test_probe_xinetd openscap probe ${XML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES})
target_link_libraries(test_probe_xinetd openscap probe ${LIBXML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES})
add_oscap_test("test_xinetd_probe.sh")
endif()
2 changes: 1 addition & 1 deletion utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)


add_executable(oscap ${UTILS_SOURCES})
target_link_libraries(oscap openscap ${XML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES})
target_link_libraries(oscap openscap ${LIBXML2_LIBRARIES} ${XSLT_LIBRARIES} ${EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${CURL_LIBRARIES} ${RPM_LIBRARIES})

install(TARGETS "oscap"
DESTINATION ${CMAKE_INSTALL_BINDIR}
Expand Down

0 comments on commit 1fef167

Please sign in to comment.