I am working on a CMake project that uses ExternalProject_Add to add an external dependency. The issue is, I need all of my command line arguments from my project to be propagated to the external project so it will build using the same build configuration and with the correct compiler settings.
Is there a simple way to extract all of the command line arguments into a variable so I can simply pass them to ExternalProject_Add with the "CMAKE_ARGS" parameter?
The only solution I have found so far is a function that parses the CMake Cache and extracts all of the variables with a help message that says "No help, variable specified on the command line." While this does work, it feels like a hacky workaround at best and seems like it may break in a future update of CMake if they decide to change the default cache help messages.
Is there any easy way to just get a list of all of the command line arguments without parsing the cache and filtering by help messages? This solution just really feels wrong... there must be a better way.