On 02/13/2011 01:27 AM, Andreas Pakulat wrote: > Hi, > > I've got a somewhat tricky problem here with include directories. I'm > building a couple of source files and for some of them I need to add an > include-directory to the front of the list that cmake passes to the > compiler. At the same time other source files in that directory need to > not have that include-dir in front of the list. > > I can't see a way to do this, except by using COMPILE_FLAGS source file > properties for each and every file to specify include-dirs and not use > include_directories at all, as COMPILE_FLAGS always end up behind the > includes. > > So, am I missing something here? If not I guess I'll have to find that > bugreport about making include-dirs a source-file property and vote for > it so it gets included into 2.8.5...
Currently, AFAIK, it's not possible to set source-file-specific include directories unless one (mis)uses COMPILE_FLAGS which is accompanied by the shortcoming you've mentioned. Probably, the really clean solution ATM would be a reorganisation of the sources, but I doubt if the need for different include directories is an appropriate criterion for a project's directory layout. If there're only a few affected files, another possible workaround consists of file-specific configured headers, i.e. find the special include directories and inject them into config'd headers that are included by the concerned source files, or even modify the latters themselves in this manner. Of course, the sources must be touched to do that. IMO, from a conceptual point of view, INCLUDE_DIRECTORIES should be also available as target and source file property, so I would vote for 1968 and 8189 - seem to be relatives - and possibly 8874, too. However, if this undertaking is addressed, one should think about how the include directories are ordered on the compiler's command line. Perhaps, there might be a convention that they appear from most to least specific, i.e. in source-target-directory order. Regards, Michael _______________________________________________ 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