[CMake] cmake finds libxml2 but still says its missing
Florian Lindner
mailinglists at xgm.de
Tue May 8 08:51:39 EDT 2018
Hello,
I try to compile my software like
cmake -DCMAKE_TOOLCHAIN_FILE=../../toolchain.cmake -DBUILD_SHARED_LIBS=off ../..
> cat ../../toolchain.cmake
SET(CMAKE_SYSTEM_NAME Hazelhen)
SET(CMAKE_C_COMPILER cc)
SET(CMAKE_CXX_COMPILER CC)
SET(CMAKE_Fortran_COMPILER ftn)
which gives me the error:
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
Could NOT find LibXml2 (missing: LIBXML2_LIBRARIES) (found version "2.9.4")
Call Stack (most recent call first):
/usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake/Modules/FindLibXml2.cmake:69 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:73 (find_package)
I am a bit puzzled, because it says it found libxml 2.9.4, but then again does not set the $LIBXML2_LIBRARIES.
Usage is
find_package(LibXml2 REQlesUIRED)
include_directories(${LIBXML2_INCLUDE_DIR})
and later
target_link_libraries(foobar PUBLIC ${LIBXML2_LIBRARIES})
cmake version 3.5.2
Thanks!
Florian
More information about the CMake
mailing list