[CMake] Creating a visual studio project with non .cpp or .h files in it.

Josef Karthauser joe.karthauser at geomerics.com
Wed Dec 5 09:12:05 EST 2007


Does anyone know the answer to this?  I'd love you forever.... :)

Joe

> -----Original Message-----
> From: Josef Karthauser
> Sent: 04 December 2007 14:23
> To: Josef Karthauser; Joshua Jensen; Philip Lowman
> Cc: CMake ML
> Subject: RE: [CMake] Creating a visual studio project with non .cpp or
> .h files in it.
> 
> Hi folks, I'm still trying to solve this one - alas it's alluding me.
> 
> I want to create a visual studio project file which only has non-
> compiling files in it, for instance CMake macro files or documentation.
> This I want so that people can easily edit them from within visual
> studio.  I can't work out how to do it.
> 
> So, imagine that I have the files 'foo.txt' and 'bar.txt' which I want
> to add to a project.  If they were part of a library project I would
> add them to the project file by doing:
> 
> 	ADD_LIBRARY(Library_Name lib.cpp foo.txt bar.txt)
> 
> and that would be enough for cmake to include the .txt files in the
> vcproj file along with the C++ source code.
> 
> However what if I want to have a visual studio which has C++ files what
> do I do to get the visual studio file to be brought into existence?
> 
> Does anyone know?  I could do with being put out of my misery! :)
> 
> Joe
> 
> 
> > -----Original Message-----
> > From: Josef Karthauser
> > Sent: 02 November 2007 15:23
> > To: 'Joshua Jensen'; Philip Lowman
> > Cc: CMake ML
> > Subject: RE: [CMake] Adding non .cpp or .h file to a visual studio
> > project.
> >
> > > From: Joshua Jensen [mailto:jjensen at workspacewhiz.com]
> > > Sent: 02 November 2007 15:09
> > > To: Philip Lowman
> > > Cc: Josef Karthauser; CMake ML
> > > Subject: Re: [CMake] Adding non .cpp or .h file to a visual studio
> > project.
> > >
> > > Philip Lowman wrote:
> > > Josef Karthauser wrote:
> > >
> > > Hi there again,
> > > I’m using cmake to create some visual studio projects, and want to
> > > include some non-C files (config.txt for instance) into the vcproj
> > file
> > > so that my Visual Studio users can edit the file from within the
> IDE.
> > >   I can’t add them using ADD_LIBRARY or ADD_EXECUTABLE, so how do I
> > > register them?
> > > >
> > >
> > > This works for me on CMake 2.4.6 and Visual Studio 8:
> > >
> > > SET_SOURCE_FILES_PROPERTIES(readme.txt PROPERTIES HEADER_FILE_ONLY
> > true)
> > > ADD_LIBRARY(foo foo.cc readme.txt)
> > >
> > > I tried it this morning, and I didn't even need the
> > SET_SOURCE_FILES_PROPERTIES.
> >
> > Sure, but if you do
> >
> > 	ADD_LIBRARY(foo readme.txt)
> >
> > you get an error.
> >
> > So how do you create a project which only has non-C objects?
> >
> > Joe


More information about the CMake mailing list