kreuzerkrieg
kreuzerkrieg

Reputation: 3219

CMake find_package for FindLibXml2

I'm trying to create a CMake file that will detect the location of libxml2. From what see in examples and CMake documentation the find_package simply works. I'm running CLion on Ubuntu, the libxml2 is installed using apt-get, the FindLibXml2.cmake is located under CMake's modules. However CMake returns cryptic message:

Could not find a package configuration file provided by "FindLibXml2" with any of the following names:

FindLibXml2Config.cmake
findlibxml2-config.cmake

Add the installation prefix of "FindLibXml2" to CMAKE_PREFIX_PATH or set "FindLibXml2_DIR" to a directory containing one of the above files. If "FindLibXml2" provides a separate development package or SDK, be sure it has been installed.

Why it is trying to find this -config file? what I'm doing wrong?

CMake snippet

find_package(FindLibXml2 CONFIG REQUIRED)

I've also tried

find_package(FindLibXml2 REQUIRED)

Not sure which one to use

Upvotes: 3

Views: 1987

Answers (1)

piwi
piwi

Reputation: 5336

You should not have the Find in FindLibXml2; do:

find_package(LibXml2 REQUIRED)

As explained in the documentation:

CMake searches for a file called Find<package>.cmake

Upvotes: 5

Related Questions