Hi, a port i'm working on (pgpointcloud) uses cmake to detect libxml2:
https://github.com/pgpointcloud/pointcloud/blob/master/CMakeLists.txt#L91 with this CMakeLists the build fails because -I/usr/local/include is not on the CFLAGS: /usr/obj/ports/pgpointcloud-1.1.0pre0/bin/cc -I/usr/local/include/libxml2 -Ilib -O2 -pipe -DNDEBUG -fPIC -MD -MT lib/CMakeFiles/libpc-static.dir/pc_schema.c.o -MF lib/CMakeFiles/libpc-static.dir/pc_schema.c.o.d -o lib/CMakeFiles/libpc-static.dir/pc_schema.c.o -c /usr/obj/ports/pgpointcloud-1.1.0pre0/pointcloud-0130a1c49dc3f8c3beaa5f033c66691bdc422987/lib/pc_schema.c In file included from /usr/obj/ports/pgpointcloud-1.1.0pre0/pointcloud-0130a1c49dc3f8c3beaa5f033c66691bdc422987/lib/pc_schema.c:13 In file included from /usr/local/include/libxml2/libxml/parser.h:810: /usr/local/include/libxml2/libxml/encoding.h:28:10: fatal error: 'iconv.h' file not found #include <iconv.h> What i dont understand is that libxml-2.0.pc sets it: $pkg-config --cflags libxml-2.0 -I/usr/local/include/libxml2 -I/usr/local/include And afaik our FindLibxml2.cmake module in /usr/local/share/cmake/Modules/FindLibXml2.cmake uses that: =========== find_package(PkgConfig QUIET) PKG_CHECK_MODULES(PC_LIBXML QUIET libxml-2.0) set(LIBXML2_DEFINITIONS ${PC_LIBXML_CFLAGS_OTHER}) find_path(LIBXML2_INCLUDE_DIR NAMES libxml/xpath.h HINTS ${PC_LIBXML_INCLUDEDIR} ${PC_LIBXML_INCLUDE_DIRS} PATH_SUFFIXES libxml2 ) find_library(LIBXML2_LIBRARIES NAMES xml2 libxml2 HINTS ${PC_LIBXML_LIBDIR} ${PC_LIBXML_LIBRARY_DIRS} ) =========== So with my limited cmake-fu, i'm puzzled as to why usr/local/include isnt part of the include paths. It 'works' if i patch the CmakeLists.txt this way: find_package (LibXml2 REQUIRED) mark_as_advanced (CLEAR LIBXML2_INCLUDE_DIR) mark_as_advanced (CLEAR LIBXML2_LIBRARIES) include_directories (${LIBXML2_INCLUDE_DIR}) +include_directories (/usr/local/include) But that's of course ugly, so i'm looking for help to figure out if this is a problem in FindLibxml2.cmake or in pgpointcloud's CMakeLists.txt.. Landry