Added export of `CPM_LAST_PACKAGE_NAME`
- Updated docs respectively
#400
@iboB @TheLartians Any idea on this one as the style conformance issue is not clear here!?
Confirmed as working:

Note that you can run the unit tests locally using the following commands.
cmake -Stest -Bbuild/test
cmake --build build/test --target test-verbose
Or, to run a single test, e.g. package_name_from_git_uri.cmake:
cmake -DCPM_PATH=$(pwd)/cmake -P test/unit/package_name_from_git_uri.cmake
And also auto-format the code style style using cmake-format as below.
cmake -Stest/style -Bbuild/style
cmake --build build/style --target fix-format
(this should be added to a contributors readme eventually)
Note that you can run the unit tests locally using the following commands.
@TheLartians Thanks for this info, invaluable :) UPDATE: Now I built the target Visual-Studio test-Explorer integration is working for this.... I will need to investigate how the Cmake unit-tests work as it looks like you've done some nice work here!
EDIT: I would also consider looking at creating a CmakePresets.json to this affect but should save this for a future Pull to keep this one clean.
EDIT2: It would also be useful if the UNit-test used a separate or temporary CPM_Cache location as it will currently be affected if/as there may already be an existing cache for packages of the name used in the test under some circumstances 🐞
I have updated and fixed the additional tests. However, I get failure on this test prior & post my additional changes. HOpefully it is a local issue only TBC

EDIT2: It would also be useful if the UNit-test used a separate or temporary CPM_Cache location as it will currently be affected if/as there may already be an existing cache for packages of the name used in the test under some circumstances
Sounds like a good idea, though it may be even better to move all "unit-tests" that build a full project into the more extensive integration test suite at this point.
Looks good, could you run
cmake-formator thefix-formattarget to update the code style?
Not made much progress here yet, getting an error and not sure how to proceed 'yet': RuntimeError: Failed to parse C:\development\CPM.cmake\.cmake-format as any of yaml, json, or python
UPDATE: This is not a CPM issue but a cmake-format issue in that errors are not reported when the .cmake-format file does not include the .yaml extension. I went and reported this over at https://github.com/cheshirekow/cmake_format/issues/299
It seems that the style checks are still failing, though to be honest, I don't see why
Tried it on my machine and it removed a trailing whitespace. @CraigHutchinson did you install the required dependencies? That should be easy using pip:
pip3 install clang-format==14.0.6 cmake_format==0.6.11 pyyaml
UPDATE: This is not a CPM issue but a cmake-format issue in that errors are not reported when the .cmake-format file does not include the .yaml extension. I went and reported this over at https://github.com/cheshirekow/cmake_format/issues/299
Just saw this, that is indeed a weird error message. Anyways just pushed my change and am happy with the PR now. Thanks!
@TheLartians thanks for sorting the extra space, I shall try harder next time! As it stands I had issues with the fix-cmake in that it was changing line-endings in ALL the source files, I would gather in omitting this the space fix was also lost. I haven't investigated yet, but my expectation is the issue should be git config related as the message is "LF will be replaced by CRLF the next time Git touches it"