[CMake] Including .h files in Visual Studio projects

Eric Noulard eric.noulard at gmail.com
Mon Jul 2 13:12:29 EDT 2007


2007/7/2, Iain Hull <Iain.Hull at cr2.com>:
> Michael Hammer <michael.hammer at tugraz.at>:
> > add_library(foo foo.cpp foo.h)
> >
> > that it should create something like the following
> >
> > c++ -c foo.cpp
> > c++ -c foo.h     ---------->>>>  (that won't work) ;)
> > c++ foo.cpp foo.h foo
>
> I regularly include my header files in the source list for add_library
> to get them to appear in my vs projects.  This works correctly for me on
> windows (Cmake 2.4.5 and VC60) and on Solaris (Cmake 2.4.5, make and sun
> studio 10).  One difference is that I always use the DYNAMIC key word.
>
> As far as I know the Cmake make file generator filters out header files
> in the source list.  The VC60 generator adds them as source files to the
> project, then it is up to VS how to handle them from there (which
> usually means as header files - based on there extension).
>
> This sounds like a problem in your Visual Studio settings, does a hand
> made project behave the same?
>
> I will try this on VC80 this evening, to make sure it is not just a VC60
> thing.

We do use VC80 (Visual Studio Express 8) on Vista with no problem
for including our header files (.h or .hh)

We use SOURCE_GROUP in order to setup source folders
but I don't if it can make any difference.


-- 
Erk


More information about the CMake mailing list