[CMake] template files (.t) in Windows VCproj builds
Philip Lowman
philip at yhbt.com
Wed Sep 20 18:09:51 EDT 2006
Brad King wrote:
> The SOURCE_GROUP command just maps source files to folders for projects
> in which they are already used. You have to list all the sources
> (headers, template files, etc.) in the target. Then use SOURCE_GROUP to
> map specific file patterns to specific groups. The generated project
> for each target using a source file will put the source file under the
> group specified by SOURCE_GROUP.
>> 3.) [minor] I tried to use the SOURCE_GROUP() command to try to force
>> the header and template files into the "Header Files" group although I
>> discovered from a previous post on this list that this nifty looking
>> command only seems to work if you're making an executable (after trying
>> to get it to work but not having any luck). It would be nice for this
>> command to support ADD_LIBRARY() as well although I don't know the
>> details of how feasible this is.
>
> I'm not familiar with this constraint. Please post a small example
> CMakeLists.txt file that reproduces the problem. The following works
> for me:
Well it's working now for me. All I can figure is I was doing it wrong
by trying to use it on files that weren't part of the target. Then when
I couldn't figure out why it wasn't working I read this thread and
mistakenly thought that it might only be implemented for ADD_EXECUTABLE.
http://public.kitware.com/pipermail/cmake/2006-September/010952.html
Sorry for the confusion.
>> 2.) [major] It seems that Visual Studio is trying to compile about half
>> of the template files that I add to my ADD_LIBRARY() directive (it's
>> treating them as source files). Is there any reason why anyone would
>> ever want to compile a ".t" file (C++ template)? Also I'm curious why
>> there is a difference in behavior with half of the template files
>> treated as headers and the other half treated as sources.
>
> If they have the same name as a .h or .cc file there is a bug in CMake
> 2.4.3 that causes this. The work around is to add the HEADER_FILE_ONLY
> property with SET_SOURCE_FILES_PROPERTIES. It is fixed in CVS CMake and
> will be fixed in 2.4.4.
So in future releases of CMake is there a list of file extensions that
CMake will attempt to compile (.c, .cc, .C, etc.) and it treats
everything else as a header file if you add it to the sources list?
I was under the impression that our ".t" convention for C++ templates
included from within header files was some standard convention and that
CMake should automatically treat ".t" files as "header" files. Sorry
for any confusion on this point as well. :)
Good job on CMake by the way. We love it so far.
--
Philip Lowman
Simulation Development Engineer, Modeling and Simulation Technology
General Dynamics Land Systems
http://www.gdls.com
More information about the CMake
mailing list