Generate fIle-api query files from CMake

Hello,

Is it possible to generate a file-api query file during a CMake configure? I tried to generate the query file from within my toolchain file or even in the CMakeLists.txt file before the project statement. However the reply is only generated once I re-run the configure step one more time.

Our use case: We are using a custom toolchain file and do some postprocessing on the generated cache output which relies on the file-api reply.

best regards,
Wolfgang

1 Like

The File API is meant for IDEs and other tools outside of CMake to get information about the targets and their build commands. It’s not meant to be used inside CMake. If you want to do some postprocessing, it may be better to write a shell script which calls CMake and does the postprocessing afterward.

Cc: @brad.king

1 Like

I had to look into the same question not that long ago. The file API queries are read it very early, before any configure processing starts. That essentially means they have to exist before you run CMake.

@Wolfgang Issovits If you want to do some postprocessing, it may be better to write a shell script which calls CMake and does the postprocessing afterward. I think you should focus on this. It will make your mind clear for this work. :slightly_smiling_face: