Having Problem building and adding Cryto++ library in Windows

99 Views Asked by At

I want a integrate crypto++ library of c++ in a small size project. I am currently using Windows and mingw64 (native) as my compiler and cmake to build.

My Project Directory looks like this:

Project Root
|-sources
|-lib
   |-crytopp-880 (Contains the CrytoPP library)
   |-cryptopp-cmake (Contains the cmake files for it to work)
|-build
|-CMakeLists.txt

I used the guide to build and add crypto++ with cmake from Crypto++ CMake. My root CMakeLists.txt looks like this.


project(project_cipher)


add_subdirectory(sources build)
add_subdirectory(${PROJECT_SOURCE_DIR}/lib/cryptopp-880)


add_subdirectory(${PROJECT_SOURCE_DIR}/lib/cryptopp-cmake)
set(CRYPTOPP_SOURCES ${PROJECT_SOURCE_DIR}/lib/cryptopp-880)

include_directories(${PROJECT_SOURCE_DIR}/lib/cryptopp-880)
target_link_libraries(cipher cryptopp)

I ran this as Powershell command:

cmake -G "MinGW Makefiles" .

And the output was:

-- The C compiler identification is GNU 12.3.0
-- The CXX compiler identification is GNU 12.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/mingw64/bin/gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/mingw64/bin/c++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The ASM compiler identification is GNU
-- Found assembler: C:/mingw64/bin/gcc.exe
=> Project : cryptopp-cmake v8.8.0
-- Setting build type to 'Release' as none was specified.
-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.41.0.windows.1") 
-- Crypto++ auto fetched at: E:/Programms/CODING PROJECTS/C++ Cypher Project/lib/cryptopp-cmake/cryptopp
fatal: not a git repository (or any of the parent directories): .git
CMake Error at lib/cryptopp-cmake/CMakeLists.txt:221 (string):
  string sub-command STRIP requires two arguments.


-- Using branch  for tests
-- Adding unit test: CMakeFiles
-- Adding unit test: disable-feature
-- Adding unit test: include-prefix
-- Adding unit test: no-install
-- Adding unit test: standard-cpm
-- Adding install integration test: int-install-default
-- Adding install integration test: int-install-prefix
=> Module : cryptopp
CMake Error at lib/cryptopp-cmake/CMakeLists.txt:241 (add_subdirectory):
  The source directory

    E:/Programms/CODING PROJECTS/C++ Cypher Project/lib/cryptopp-cmake/cryptopp

  does not contain a CMakeLists.txt file.


-- Configuring incomplete, errors occurred!

As it said, the folder was missing CMakeLists.txt. So, I added a blank one. and then while running the same command, it showed this:

=> Project : cryptopp-cmake v8.8.0
-- Crypto++ auto fetched at: E:/Programms/CODING PROJECTS/C++ Cypher Project/lib/cryptopp-cmake/cryptopp
fatal: not a git repository (or any of the parent directories): .git
CMake Error at lib/cryptopp-cmake/CMakeLists.txt:221 (string):
  string sub-command STRIP requires two arguments.


-- Using branch  for tests
-- Adding unit test: CMakeFiles
-- Adding unit test: disable-feature
-- Adding unit test: include-prefix
-- Adding unit test: no-install
-- Adding unit test: standard-cpm
-- Adding install integration test: int-install-default
-- Adding install integration test: int-install-prefix
=> Module : cryptopp
-- Configuring incomplete, errors occurred!

I wanted to add the library statically and fully offline and used the guide given in the readme.md. However, it is still using the online git repo to download the library.

How to set it up in a way that uses, the downloaded version, and link it after building it as it was supposed to? (The repo says that)

0

There are 0 best solutions below