[CMake] Best way to show/include CMake files in IDE

David Doria daviddoria at gmail.com
Tue Mar 8 14:25:21 EST 2016


On Mon, Mar 7, 2016 at 9:19 PM, Eric Wing <ewmailing at gmail.com> wrote:

> On 3/7/16, Eric Wing <ewmailing at gmail.com> wrote:
> > On 3/7/16, David Cole <DLRdave at aol.com> wrote:
> >> If you include those files in the source list for a library, executable,
> >> or
> >> custom target, they should show up in IDE projects, and they should be
> >> ignored by Makefile type projects. Have you tried that?
> >>
> >>
> >> David
> >>
> >
> > I haven't tried it yet since I was wondering what the best approach was
> :)
> > Since some of my files are somewhat project oriented instead of target
> > oriented, I wasn't sure if putting them the library/executable targets
> > was best. But if it is, I'll try that.
> >
> > Thanks,
> > Eric
> >
>
> Well, I gave it a try. So far, it looks good.
>
> Thanks,
> Eric
>

I usually do this to make my IDE aware of files:

add_custom_target(MyProject_HDRS SOURCES MyHeader.h MyImplementation.hpp)

It sounds like David says you can do the same for your .cmake files. This
is pretty awkward though - it seems like there should be more of an
explicit function for this, something like:

add_files_to_IDE(MyHeader.h MyImplementation.hpp)

This would make it much more clear what this line is for and would prevent
forcing this "abuse" of the concept of a target for a very common use case.

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160308/fd4f0fbf/attachment.html>


More information about the CMake mailing list