Reputation: 2508
CLion 1.2, with bundled CMake 3.3.2 and MinGW-w64 4.8.4 I'm trying to reference boost in CMakeLists.txt
set(BOOST_ROOT "O:/Project/lib/windows/boost_1_59_0")
set(BOOST_LIBRARYDIR ${BOOST_ROOT}/stage/lib)
set(BOOST_COMPONENTS_NEEDED filesystem )
find_package(Boost 1.59.0 REQUIRED COMPONENTS ${BOOST_COMPONENTS_NEEDED})
if(NOT Boost_FOUND)
message(FATAL_ERROR "Could not find boost!")
endif()
If there is no libraries needed, so I use
find_package(Boost 1.59.0)
boost is found and all works well.
But when I'm trying to reference libraries "Boost_FOUND" is not set
Boost libraries is built and there are following files in the O:/Project/lib/windows/boost_1_59_0/stage/lib folder
boost_filesystem-vc120-mt-1_59.dll
boost_filesystem-vc120-mt-1_59.lib
boost_filesystem-vc120-mt-gd-1_59.dll
boost_filesystem-vc120-mt-gd-1_59.lib
boost_system-vc120-mt-1_59.dll
boost_system-vc120-mt-1_59.lib
boost_system-vc120-mt-gd-1_59.dll
boost_system-vc120-mt-gd-1_59.lib
libboost_filesystem-vc120-mt-1_59.lib
libboost_filesystem-vc120-mt-gd-1_59.lib
libboost_filesystem-vc120-mt-s-1_59.lib
libboost_filesystem-vc120-mt-sgd-1_59.lib
libboost_filesystem-vc120-s-1_59.lib
libboost_filesystem-vc120-sgd-1_59.lib
libboost_system-vc120-mt-1_59.lib
libboost_system-vc120-mt-gd-1_59.lib
libboost_system-vc120-mt-s-1_59.lib
libboost_system-vc120-mt-sgd-1_59.lib
libboost_system-vc120-s-1_59.lib
libboost_system-vc120-sgd-1_59.lib
What I missed?
Upvotes: 1
Views: 370
Reputation: 12435
Probably because you want to build it your project with MinGW, but your libraries are compiled for Visual studio (you can see it from vc120
in libraries name).
You must build boost with MinGW-64 (you can use the same stage/lib folder because names are different).
Open the MinGW console and follow the same compilation step that you use for Visual Studio, but change toolset from msvc
to gcc
.
Upvotes: 2