[CMake] Including .h files in Visual Studio projects
Iain Hull
Iain.Hull at cr2.com
Mon Jul 2 12:53:54 EDT 2007
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.
Kind regards,
Iain.
-----Original Message-----
From: cmake-bounces+iain.hull=cr2.com at cmake.org
[mailto:cmake-bounces+iain.hull=cr2.com at cmake.org] On Behalf Of Michael
Hammer
Sent: 02 July 2007 15:36
To: cmake at cmake.org
Subject: Re: [CMake] Including .h files in Visual Studio projects
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
----------------------------------------------------------------------
_______________________________________________
CMake mailing list
CMake at cmake.org
http://www.cmake.org/mailman/listinfo/cmake
More information about the CMake
mailing list