[CMake] How to include public-headers of dependent targets first, before arguments in target_include_directories()

quanzhao198757 at sina.com quanzhao198757 at sina.com
Fri Apr 15 02:08:11 EDT 2016


I want to cross-compile cairo in many systems, and cairo depend on zlib, libpng and pixman, optionally search for freetype and fontconfig. I got sources of zlib, libpng and pixman, and use cmake to compile and link them. But when compile cairo, I got following flags by cmake:

C_INCLUDES = -I/Users/quanzhao/git-space/tigerknows-mapcore/externals/cairo/src -I/Users/quanzhao/git-space/tigerknows-mapcore/x86_64-macosx-clang-debug.make.build/cairo/cairo -I/Users/quanzhao/git-space/homebrew/include/freetype2 -I/Users/quanzhao/git-space/homebrew/include -I/Users/quanzhao/git-space/tigerknows-mapcore/x86_64-macosx-clang-debug.make.build/zlib/zlib-interface -I/Users/quanzhao/git-space/tigerknows-mapcore/x86_64-macosx-clang-debug.make.build/png/png-interface -I/Users/quanzhao/git-space/tigerknows-mapcore/x86_64-macosx-clang-debug.make.build/pixman/pixman-interface

Header of library fontconfig is installed in '/Users/quanzhao/git-space/homebrew/include' where a libpng(version 16) is installed... My local sources of libpng is version 15 so I fail to ran my program right... 

How can I include interface-headers of dependent targets first? In this example it is the flag '-I/Users/quanzhao/git-space/tigerknows-mapcore/x86_64-macosx-clang-debug.make.build/png/png-interface' added by cmake automatically.


More information about the CMake mailing list