3

conanfile.txt //i am using local repo

[requires]
libxml2/2.9.0@conan/stable

[generators]
cmake

CMakeLists.txt

 cmake_minimum_required(VERSION 3.4)
 project(testlibxml)

 include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
 conan_basic_setup()

 add_executable(test_xml_lib test_xml.cpp)

test_xml.cpp

 #include <libxml/xlink.h>

 int main(){

     return 0;
 }

I expect includes to be resolved properly, but i am getting below error

error: libxml/xlink.h: No such file or directory. 

It works if i add below line in CmakeLists.txt

include_directories(${CONAN_INCLUDE_DIRS}/libxml2)
0

1 Answer 1

1

I don't know where are you getting that version of the libxml2 package, because it is not in conan-center:

$ conan search libxml* -r=conan-center
Existing package recipes:

libxml2/2.9.3@bincrafters/stable
libxml2/2.9.8@bincrafters/stable

So what you are using might be an old, stale, or broken version from somewhere else. Changing your conanfile.txt:

[requires]
libxml2/2.9.8@bincrafters/stable

[generators]
cmake

And I have checked it works (at least in Windows)

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks @drodri I am using linux and its my local instance of artifactory. may i see your CMakeLists.txt
I am using your CMakeLists.txt, copied from above, exactly. Same with the .cpp file. I only changed the requires version in conanfile.txt. So the problem might not be in the consumption of the package, but in your libxml package itself. You might check the local cache, it is easy to navigate, you will learn how the package is stored, what is being copied and where. Also, using Github issues in the conan github repo is possible, and more suitable for discussion and help.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.