CMakePCHCompiler icon indicating copy to clipboard operation
CMakePCHCompiler copied to clipboard

target_precompiled_header(Foo bar.h) creates both CMakeFiles/Foo.pch.dir/Bar.h.gch and CMakeFiles/Foo.dir/Bar.h.gch targets

Open ANogin opened this issue 7 years ago • 5 comments

I am trying to use this package under Ubuntu with gcc, and somehow I get the following:

  • The make rules for creating and using CMakeFiles/Foo.pch.dir/Bar.h.gch are done correctly - everything works
  • But there is also a make rule for creating CMakeFiles/Foo.dir/Bar.h.gch by compiling CMakeFiles/Foo.pch.dir/Bar.h (which fails as there is no such .h)... I could not figure out where it is coming from...

ANogin avatar Feb 20 '18 02:02 ANogin

Can you please provide me exact GCC and CMake version you are using. This issue may be specific to some recent CMake versions.

nanoant avatar Jul 26 '18 10:07 nanoant

Are you are including H files in your project? From my experience, this basically cannot work with this module (maybe a note should be added to the README file.) The purpose of including H is to make the headers visible in project trees like Visual Studio's, however in general, CMake doesn't do anything else with them.

CMake conflates the H files with a GCH/PCH's input. It's just a guess. (I really can't say what's happening here.) Unfortunately, you must choose between PCH benefits and seeing H files in your project editor.

m-7761 avatar Jul 27 '18 05:07 m-7761

I have seen this issue with cmake 2.8.12.2 and gcc 4.9.4 on Ubuntu 14.04.1, possibly in other configurations as well (this was obviuously a while ago).

ANogin avatar Aug 06 '18 02:08 ANogin

Please provide minimal CMakeLists.txt example with exact configuration, so I can try to replicate this in Docker for example.

nanoant avatar Apr 30 '19 21:04 nanoant

I no longer have access to that example, sorry.

ANogin avatar Apr 30 '19 21:04 ANogin