Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ignoring a single file when using include_directories with CMake

Tags:

cmake

is there anyway to tell CMake to ignore one specific header file when using include_directories ?

Since the directories are not expanded into single files I can't just list(REMOVE_ITEM ..) the file out.

cheers Daniel

like image 910
luuke Avatar asked Oct 28 '25 09:10

luuke


1 Answers

An include_directories call in CMakeLists does not result in a list of all available header-files. It simply passes those directories directly to the compiler as a search-dir for your "#include <...>" E.g. look at the documentation for the "-I" option of GCC 4.6.

In addition: I am not sure why you would want to exclude a single file. Very often you can work around a problematic header file, by creating your own header-file in your own project which includes everything except that single-file...

If you really, really want something like this and you insist on solving it with CMake, you will probably end up with file-globing all header-files, copying (without that one file of course) them manually to a new include-dir and then include that new dir.

like image 101
André Avatar answered Oct 30 '25 01:10

André



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!