FINALLY! I managed to fix the problem. It seems that CMake wanted absolute path to the builded library. Also it is important to set /MT and /MTd flags for Release and Debug mode respectively.
Here is my fixed CMakeLists.txt: cmake_minimum_required(VERSION 3.10.0) project(cryptopp-test) add_executable(cryptopp-test cryptopp-test.cpp) set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}") #search for CryptoPP and include it set(CRYPTOPP_ROOT_DIR "C:\\libs\\cryptopp700\\cryptopp\\Win32\\Output\\Debug\\cryptlib.lib") set(CRYPTOPP_LIBRARY "C:\\libs\\cryptopp700\\cryptopp\\Win32\\Output\\Debug\\cryptlib.lib") set(CRYPTOPP_INCLUDE_DIR "C:\\libs\\cryptopp700") find_package(CryptoPP REQUIRED) if(CRYPTOPP_FOUND) target_link_libraries(cryptopp-test ${CRYPTOPP_LIBRARIES}) include_directories(${CRYPTOPP_INCLUDE_DIRS}) endif() #-- On Tuesday, May 1, 2018 at 2:19:46 PM UTC+2, zavodny...@gmail.com wrote: > > Firstly asked at: https://github.com/weidai11/cryptopp/issues/651 > > > As the title says, everything failing to build. I have this code (below), > and I'm not able to build it (logs below the code). I use CMake to create > the Visual Studio solution file. I also tried version 6.1.0 and 6.0.0, same > problem occurs. > > > Steps to build CryptoPP: download CryptoPP source code (from website) -> > open cryptest.sln -> Retarget solution (to use my version of Windows SDK - > 10.0.16299.0) -> Ok -> Batch Build -> tick cryptlib - Release|Win32 -> Build > > > cryptopp-test.cpp: > > > https://gist.github.com/zavodnyrichard/f51ec376cda91c9732ac822bab26189b#file-cryptopp-test-cpp > > > CMakeLists.txt: > > > https://gist.github.com/zavodnyrichard/f51ec376cda91c9732ac822bab26189b#file-cmakelists-txt > > > $cmake .. > > > https://gist.github.com/zavodnyrichard/f51ec376cda91c9732ac822bab26189b#file-cmake > > > $msbuild cryptopp-test.sln > > > https://gist.github.com/zavodnyrichard/f51ec376cda91c9732ac822bab26189b#file-msbuild-cryptopp-test-sln > > > However if I'll try to build this code (below) using the same steps (and > CMakeList.txt) as above, everything is fine. > > > https://gist.github.com/zavodnyrichard/f51ec376cda91c9732ac822bab26189b#file-cryptopp-test-cpp-works-well > -- You received this message because you are subscribed to "Crypto++ Users". More information about Crypto++ and this group is available at http://www.cryptopp.com and http://groups.google.com/forum/#!forum/cryptopp-users. --- You received this message because you are subscribed to the Google Groups "Crypto++ Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to cryptopp-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.