CpackNuget.cmake doesn't always notify of failed nuget pack
If you are trying to create multiple nuget packages (using the COMPONENT base approach for example) then cmake will not notify you if some of the packages failed to be created. Here is output from such a scenario,
Attempting to build package from 'CPack.NuGet.nuspec'.
** A stable release of a package should not have a prerelease dependency. Either modify the version spec of dependency "atffortk-a-lib_win_release_shared_intel64_v140 [9.0.0-alpha1183, 9.0.0-alpha1183]" or update the version field in the nuspec.**
CPack: - package: C:/j/workspace/wr64a/asm-a-headers.226.1.0.nupkg generated.
CPack: - package: C:/j/workspace/wr64a/asm-a-lib_win_release_intel64_v140.226.1.0.nupkg generated.
CPack: - package: C:/j/workspace/wr64a/asm-a-sym_win_release_intel64_v140.226.1.0.nupkg generated.
CPack: - package: C:/j/workspace/wr64a/asm-a_win_release_intel64_v140.226.1.0.nupkg generated.
You can see there is an error message about one of the packages failing to get created because a stable release cannot depend on a pre-release package, which is correct and as a user i want to be notified of such errors in order to prevent accidental shipping of partial builds.
However because the RESULT_VARIABLE of the execute_process function wasn't previously being observed cmake didn't know something had failed. There was some attempt to detect failed package creation towards the end of CpackNuget.cmake -> file(GLOB_RECURSE GEN_CPACK_OUTPUT_FILES "${CPACK_TEMPORARY_DIRECTORY}/*.nupkg") ... but that won't detect an error so long as there is one package that has been created, so isn't a sufficient check.