I haven't tested this myself, but instead of using a glob, you could have a build step that generates a CMake script file with the list of generated files in it (e.g. via execute_process to run another CMake script whose only job is to generate the CMake script inception-style) and just include the generated file - CMake will see that the CMake file has been modified during every build but will still handle source file changes correctly. Worth a shot.
On Mon, Apr 4, 2016 at 6:36 PM, Eric Wing <ewmail...@gmail.com> wrote: > Hi, this is kind of a side problem that was asked of me. I'm not sure > how many hoops I actually want to jump through to solve this. But, > here's the situation. > > I have a really nice, traditional C based project in CMake. All my > dependency tracking works really well for cross-platform and IDE > integration and even have resources/bundling/codesigning working > nicely in the single build step. > > Now somebody throws me a curve ball and wants to use the Nim language. > The specifics of the Nim language itself is not that important to this > topic, but the key piece of information is that the Nim compiler can > generate C files as output. > > So the question is, how can I invoke Nim to compile a list of > pre-known Nim source files, and then slurp in the generated output C > files and build them as part of my normal CMake build process. > > The curve ball is this: I don't know all the names or how many files > the Nim compiler generates. If I know all the names beforehand, I > think I know how to deal with this situation. But instead, I get a > directory of C files. The names seem to be dependent on which library > features were used and also what the user's source files were named. I > suspect the standard library could theoretically change too so future > versions of Nim may have different files. > > I know file globs with CMake don't auto-track changes and I think the > problem gets more trickier because of the indirection to invoke Nim. > (i.e. When I first glob the files, the directory is empty, then the > Nim compiler is invoked later and the files appear, but it is too late > for CMake to see without a regeneration). > > Anyway, I was wondering what the best approach is. > > Thanks, > Eric > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake