Identifying the CMakeConfig.h File

I am trying to identify the CMakeConfig.h.in file in every GitHub project dynamically. This file is sometimes also named something like projectName-config.h.cmake.

The only method I know so far to identify such a file is searching for the command “configure-file” in the CMakeLists.txt file and then look for a file name containing “config.h”, “projectName”, or “cmake”, but this is not effective in every project.

Does anyone know a trick how I can identify the right config.h file without failure and without having to look for it manually?

That file is often generated dynamically when running the CMake configure step. I don’t know what you’re trying to achieve, but if you’re assuming these files are checked into source code for most projects in GitHub, that’s not going to be a valid assumption in many cases.

I see that my original post is a little misleading.

I am trying to port the cmake functionality to a different operating system. For a given project, I want to use the config.h file to help port it to the new OS. To do so, I need to dynamically identify the template file for config.h in any given project. I was hoping someone might have insights on how to identify it. Any suggestions?

Same response really. Projects could prepare their <packageName>-config.cmake files any way they like. They might have a template file, they might not.