[CMake] Visual Studio: Add file to project without compiling it

Eric Noulard eric.noulard at gmail.com
Mon Oct 20 16:18:11 EDT 2008


2008/10/20 Matthias Riechmann <riechmann at ira.uka.de>:
> Hello,
>
> I'd like to make CMake including a file in way so that it is visible in a
> generated visual studio project and can be edited in this way, but is not
> processed by the compiler.

Yes I think this issue is coming out more and more.
I've just filed a feature request for this:

http://public.kitware.com/Bug/view.php?id=7835

>
> The reason I need this is as followed: I have some CORBA IDL files that I'd
> like to process using a custom macro calling add_custom_command to run the
> idl compiler. So far it works quite well, the file is processed on build,
> but since I don't specify the IDL file as a source file in the
> add_executable command it doesn't appear in visual studio. When adding it to
> the source files Microsoft's MIDL compiler tries to work on this file as
> well, which is not what I intended to do.

Did you try to add it as a source and then specify that it is "HEADER_FILE_ONLY"
with

set_source_files_properties(<yourfile.idl> PROPERTIES HEADER_FILE_ONLY TRUE)

>
> So, is it in any way possible to just show a custom file in Visual Studio?

I don't think so, thus the feature request.
Do not hesitate to add comment to it if you find it useful.


-- 
Erk


More information about the CMake mailing list