[Qt-creator] CMake and include paths
Peter Kümmel
syntheticpp at gmx.net
Wed Mar 10 07:26:55 CET 2010
Am Mittwoch, den 10.03.2010, 03:27 +0100 schrieb Tamás Kiss:
> Hi!
>
> I tried to create a CMake project to experiment with libxml2 on Linux,
> and I ran into the following problem:
>
> The libxml2 header files are in the /usr/include/libxml2/ directory
> which is not among the default system include paths, so I had to feed
> the CMAKE_CXX_FLAGS variable with the output of the "xml2-config
> --cflags" command (this generates "-I/usr/include/libxml2"). The
> problem is that the IDE is unaware of this new include path, so it
> doesn't find the libxml2 header files. Because of this, the editor
> underlines everything as undeclared identifier, code completion
> doesn't work, so it's actually much harder to work in Creator than in
> a plain text editor. (Compilation works fine).
>
> My question: is there a way to tell the IDE where to look for the
> header files? Or in CMake projects this is not implemented yet?
>
> Thanks,
Add 'include_directories(usr/include/libxml2)' to you CMakeLists.txt.
When you use the 'find_package' command to find libxml2 then there is
a variable which points to the headers.
Peter
More information about the Qt-creator-old
mailing list