[CMake] INCLUDE_DIRECTORIES per project

Adrian Boeing aboeing at gmail.com
Sat Apr 11 00:17:11 EDT 2009


Great, thanks Philip! It would be fantastic if CMake included this
feature in future.

Just for clarification to make sure I haven't misunderstood, the
solution Alex proposed would not do what I wanted (separate includes)
because both files are in the same directory? What Alex is suggesting
would work if I moved the files into separate directories?

Thanks.


On Sat, Apr 11, 2009 at 6:22 AM, Philip Lowman <philip at yhbt.com> wrote:
> On Fri, Apr 10, 2009 at 5:03 PM, Alexander Neundorf
> <a.neundorf-work at gmx.net> wrote:
>>
>> On Friday 10 April 2009, Adrian Boeing wrote:
>> > Hi,
>> >
>> > I would like to have a portable way of having separate include
>> > directories for each 'project' in my visual studio 'solution'.
>> > ie:
>> > common/
>> > dir/file1
>> > dir/file2
>> >
>> > share the include directory 'common' , and have seperate 'include1'
>> > and 'include2' directories.
>> > This would correspond to two 'projects' in my 'solution'
>> > one with files1 and common,include1 directories
>> > the other with files2 and common,include2 directories
>> >
>> > It is my understanding that INCLUDE_DIRECTORIES is a global setting?
>>
>> It's a per-directory setting, i.e. if a call to include_directories()
>> applies
>> to that directory and all sub directories of it, but not to sibling or
>> parent
>> directories.
>> So you could do
>>
>> include_directories(common)
>> in the toplevel CMakeLists.txt
>> and additionally
>> include_directories(include1)
>> and
>> include_directories(include2)
>> in the dir/file1 and dir/file2 subdirectories.
>
> I've filed a feature request to allow write-access to the
> INCLUDE_DIRECTORIES directory property.  This would allow people to remove
> include paths if they had a need to.
>
> http://public.kitware.com/Bug/view.php?id=8874
>
> --
> Philip Lowman
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>


More information about the CMake mailing list