I thought about this for a while, and I will not pretend that I can simulate make dist without having this directly supported by CMake itself.
The problem is that you can add a lot of file dependencies with CMake on the one hand (for example, to pre-build libraries), and on the other hand CMake is not aware of the dependencies directly checked by the generated build environment itself (for example, any header dependencies).
So, here is the code that just collects all the CMakeList.txt and source files given for any build purpose:
function(make_dist_creator _variable _access _value _current_list_file _stack) if (_access STREQUAL "MODIFIED_ACCESS")
Note The BUILDSYSTEM_TARGETS property BUILDSYSTEM_TARGETS requires at least CMake version 3.7.
I see the code above as a starting point and prove the concept. You can add libraries, headers, etc. Of necessity, but you probably should just configure cpack to complete your bets.
As a starting point, see, for example, the link @ usr1234567 in the comments.
References
- Get all source files the target depends on in CMake
Florian
source share