[CMake] Including .h files in Visual Studio projects

Michael Hammer michael.hammer at tugraz.at
Mon Jul 2 10:36:10 EDT 2007


Jesper Eskilson schrieb:
> 2007/7/2, Michael Hammer <michael.hammer at tugraz.at>:
>> Jesper Eskilson schrieb:
>> > Hi all,
>> >
>> > I'm trying to get our header files to show up in Visual Studio. I
>> > though I could just do
>> >
>> > add_library(foo foo.cpp foo.h)
>> But as far as I understand - that's what you have told cmake by that
>> add_library statement. I am not really sure what you mean by getting
>> "header files to show up in Visual Studio" (But I am not VS user). In
>> which way does it depend on Cmake? Adding the headers as source to the
>> the compile list is definitely not the solution for your problem to get
>> the headers shown in the IDE - IMHO that has nothing to do with the
>> compile process ...
>
> The problem is that the VS tries to *compile* my header file. I just
> want it to appear in the solution explorer.
>
Yeah I see - but you told CMake with

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

That's all I can say about it. I just meant it's perhaps a better idea 
to search for the problem inside of the IDE.

g, Michael

p.S.: Nobody here using VS who can help? I am really not a specialist on 
Visual Studio.

-- 
----------------------------------------------------------------------
                                                                 __
Dipl.-Ing. (MSc) Michael Hammer (Scientific Assistant)     __  _|  |_
Institute for Strength of Materials /                     |  ||      |
           Graz University of Technology                  |_    _||__|
phone: +43 (0) 316 873 / 7667                               |__|
fax:   +43 (0) 316 873 / 7169
http://www.fest.TUGraz.at/                    michael.hammer at tugraz.at
----------------------------------------------------------------------



More information about the CMake mailing list