target_precompile_headers, generate an .h precompiled header file instead of .hxx ?

Hello,

The documentation says

The list of header files is used to generate a header file named cmake_pch.h|xx which is used to generate the precompiled header file

What 's the proper way of telling CMake how to generate exactly cmake_pch.h instead of .hxx ? Is that only controlled by CMake’s project command ?

I don’t think there’s a way to control it, and I’d ask why you’d even need or want to. That file is an internal implementation detail of CMake and arguably shouldn’t even be mentioned in the documentation. The project should not be relying on that file having any particular name, nor try to reference or use it directly.

I need it for the reason that my framework can’t compile with a .hxx one, as far as I can understand due to c sources.

What do you mean reference or use ‘directly’, isn’t that the prefix header project uses?

The project doesn’t need to explicitly include the cmake_pch.hxx file. CMake injects it on the compiler command line for you where needed. If it is creating a cmake_pch.hxx file, my recollection is that it means CMake thinks the source to use it with is a C++ file, not a C file. I think there are separate cmake_pch.h and cmake_pch.hxx files for C and C++ sources, but it’s been a while since I looked at that. @cristianadam would know the details and could comment further.

Thanks for that, that’s what I assumed.