noloader / cryptopp-cmake

CMake files for Crypto++ project
BSD 3-Clause "New" or "Revised" License
92 stars 68 forks source link

Let cmake download the source #67

Closed Vollstrecker closed 2 years ago

Vollstrecker commented 3 years ago

I added support for cmake's FetchContent to just get the source when it's needed.

This has the same effect as #54 without the need of keeping the versions in sync.

2 options are added: DOWNLOAD_SOURCE for getting the current release based on the version the project set before and DOWNLOAD_SOURCE_LATEST for usage of current master.

As the version we set is used, #53 can't work anymore, as we can't read values after we used them.

noloader commented 3 years ago

Thanks @Vollstrecker,

We need to support back to Cmake 2.8.6. That's the version of CMake that is in the field due to LTS and ETS releases.

Vollstrecker commented 3 years ago

I know, for this version nothing changes. The "old" workflow still is unchanged, users of versions prior to 3.14 have in addition 2 more places where they can clone the cryptopp-source to, nothing else changes for them. They even don't get the options shown.

Vollstrecker commented 3 years ago

Sorry, thought it was a release notice and I could just update the version on-the-fly with it.

Vollstrecker commented 3 years ago

And yes, it shouldn't default to a download.

Did you (beside the version confusion) see anything that makes problems for legacy users?

Vollstrecker commented 3 years ago

k, I reworked this a bit. This is tested with cmake 2.8.6 on debian stable and 3.18.4 on debian testing, all fine.

Maybe you are confused with the 3.14 release I mentioned.It's just because the functionality is not there prior to that version, so all users with an older version will just have to clone the repo as always. This changes is just for user with newer versions visible.

I included (a slighty modified version) of #53 here, because I think this is a great idea. Cryptopp knows best which version it has, so we can trust this information. The only change for you is, that you will have to set the latest released version to the new release. If the original repo would have a tag for this that is updated, you wouldn't have to touch it at all.

As I added an option to choose the version that will be downloaded, I needed to add handling for the cxx/cpp change also.

Please let me know if you see other problem with this stuff.

abdes commented 2 years ago

This feature has been added. When FetchContent is available, it is used, otherwise if git is available a git clone is used, otherwise, the user can provide a local copy of the source.