I'm trying to build Bytecoin source on Windows and I'm running into issues with CMake and Boost libraries. First I tried grabbing the Boost 1.55 and compiling it myself. One or two of the libs near the end did not compile for some reason but I thought that CMake would at least identify the compiled libraries. Instead, I get this error when trying to load the CMake project:
Error:Unable to find the requested Boost libraries. Boost version: 1.55.0 Boost include path: C:/Program Files/boost/boost_1_55_0 Could not find the following Boost libraries: boost_system boost_filesystem boost_thread boost_date_time boost_chrono boost_regex
boost_serialization boost_program_options No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.
Then I tried adding a HINT to the find_package(). It tried to parse a weird path, not sure where it's doing this:
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.4/Modules/FindBoost.cmake:273 (if): Syntax error in cmake code at
C:/Program Files (x86)/CMake/share/cmake-3.4/Modules/FindBoost.cmake:273
when parsing string
${Boost_C:/PROGRAM FILES/BOOST/BOOST_1_55_0_LIBRARY_RELEASE}
Reading some of the SO answers on the matter I added environment variables:
C:\Users\Misha>set
BOOST_INCLUDEDIR=C:\local\boost_1_55_0 BOOST_LIBRARYDIR=C:\local\boost_1_55_0\lib32-msvc-12.0 BOOST_ROOT=C:\local\boost_1_55_0\boost
At this point I tried using the precompiled libs, nothing.
CMkeLists.txt
find_package(Boost 1.55 REQUIRED COMPONENTS system filesystem thread date_time chrono regex serialization program_options)
#find_package(Boost 1.55 REQUIRED COMPONENTS system filesystem thread date_time chrono regex serialization program_options HINT "C:/Program Files/boost/boost_1_55_0")
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
if (MINGW)
set(Boost_LIBRARIES "${Boost_LIBRARIES};ws2_32;mswsock")
elseif (APPLE)
set(Boost_LIBRARIES "${Boost_LIBRARIES}")
elseif (NOT MSVC)
set(Boost_LIBRARIES "${Boost_LIBRARIES};rt")
endif ()
I'm not familiar with CMake, so it is likely a simple fix. I just can't see it.
set(Boost_DEBUG on)
beforefind_package()
and rerun cmake. In debug mode all searched libraries will be shown. Check that all these libraries exist under the directory you assign to variableBOOST_LIBRARYDIR
.HINT
option is unrelated to your problem, as it is used forConfig
mode of find_package, but you useModule
mode (FindBoost.cmake
). – TsyvarevCould not find the following static Boost libraries: boost_serialization
– Misha PrasolovSearching for <component>_LIBRARY_RELEASE:
, where precise filenames are given (component is one which you specify infind_package()
). – TsyvarevBOOST_1_55_0_LIBRARY_RELEASE
makes me think that cmake is somehow treating1.55
as a boost library, as if it were part of theCOMPONENTS
list. I don't think you're doing anything wrong, but maybe try removing the1.55
argument fromfind_package()
– Stuart Berg