abdes / cryptopp-cmake

A modern CMake build project for Crypto++ (https://github.com/weidai11/cryptopp).
BSD 3-Clause "New" or "Revised" License
118 stars 43 forks source link

CMake configure step fails if cryptopp-cmake is not checked out with Git #94

Closed Oddegamra closed 1 year ago

Oddegamra commented 1 year ago

In the root CMakeLists.txt file, Git is used to determine the branch of the cryptopp-cmake sources when they are added in a parent CMake project with add_subdirectory. This call fails, however, if the release package of cryptopp-cmake is used, since no .git directory is found (and the parent project is not versioned with .git, either). In addition, the cryptopp_GIT_BRANCH variable will then be empty.

Thus, CMake will abort with the following subsequent error:

1>fatal: not a git repository (or any of the parent directories): .git
1>CMake Error at thirdparty/source/cryptopp-cmake/CMakeLists.txt:222 (string):
1>  string sub-command STRIP requires two arguments.

For reference, Windows 10/CMake 3.26.4 and cryptopp-cmake v8.8.0 were used for testing.

Vollstrecker commented 1 year ago

As this should be handled, could you provide a step-by-step to reproduce? Including what downloaded from where and extracted to where, set options etc.

Oddegamra commented 1 year ago

For me, these steps allow reproduction of the issue:

  1. Download and extract: https://github.com/abdes/cryptopp-cmake/archive/refs/tags/CRYPTOPP_8_8_0.zip
  2. As noted, all parent directories of the extracted archive must not be Git repositories (Git searches upward from the given working directory until a .git directory is found).
  3. Perform cmake -S <path to extracted archive> -B <build location of choice>
  4. The configure step fails around the following output:
=> Project : cryptopp-cmake v8.8.0
-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.39.2.windows.1")
-- Crypto++ auto fetched at: C:/Users/x/Downloads/cryptopp-cmake-CRYPTOPP_8_8_0/build/cryptopp
fatal: not a git repository (or any of the parent directories): .git
CMake Error at CMakeLists.txt:221 (string):
  string sub-command STRIP requires two arguments.