[CMake] SET_SOURCE_FILES_PROPERTIES for extra include directories

Brandon J. Van Every bvanevery at gmail.com
Thu Mar 15 15:23:56 EST 2007


James Bigler wrote:
> Is is possible to add include directories for a particular source file?
>
> Right now I do:
>
> INCLUDE_DIRECTORIES(${Extra_Include_Dir})
>
> But this puts the extra includes on all the files for the libraries in 
> the CMakeLists.txt file.

Where is the harm in doing so?  Are you having some kind of collision 
between *.h filenames in your include directories?  Judicious use of the 
BEFORE and AFTER options can prevent such collisions.


> What I want is to do something like:
>
>   SET_SOURCE_FILES_PROPERTIES(MyFile.cc
>                               PROPERTIES INCLUDE_DIRECTORIES 
> ${Extra_Include_Dir})
>
> This doesn't work, but perhaps I could add something to COMPILE_FLAGS, 
> but how do I do this in a build system portable way?

I understand what you want, but not why.


Cheers,
Brandon Van Every



More information about the CMake mailing list