Reputation: 117
I am trying to make the boost library work with CMake but I get some weird error messages. I am using Stephan T. Lavavej`s mingw version which comes with boost-library.
My CMake file looks like the following :
cmake_minimum_required(VERSION 3.6)
project(untitled)
set(Boost_INCLUDE_DIR C:/MinGW/include)
set(Boost_LIBRARY_DIR C:/MinGW/lib)
find_package(Boost COMPONENTS system filesystem REQUIRED)
include_directories(${Boost_INCLUDE_DIR})
set(CMAKE_CXX_FLAGS "-Ofast -msse -msse2 -msse3 -march=znver1 -fno-use-linker-plugin -flto")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -static-libstdc++ ")
set(SOURCE_FILES main.cpp HexBoard.cpp HexBoard.h TreeNode.cpp TreeNode.h)
add_executable(untitled ${SOURCE_FILES})
and I get the following error messages:
> CMake Warning at C:/Program Files (x86)/JetBrains/CLion
> 2016.3.5/bin/cmake/share/cmake-3.6/Modules/FindBoost.cmake:743 (message): Imported targets not available for Boost version 106300
> Call Stack (most recent call first): C:/Program Files
> (x86)/JetBrains/CLion
> 2016.3.5/bin/cmake/share/cmake-3.6/Modules/FindBoost.cmake:842 (_Boost_COMPONENT_DEPENDENCIES) C:/Program Files
> (x86)/JetBrains/CLion
> 2016.3.5/bin/cmake/share/cmake-3.6/Modules/FindBoost.cmake:1395 (_Boost_MISSING_DEPENDENCIES) CMakeLists.txt:6 (find_package)
>
>
> CMake Warning at C:/Program Files (x86)/JetBrains/CLion
> 2016.3.5/bin/cmake/share/cmake-3.6/Modules/FindBoost.cmake:743 (message): Imported targets not available for Boost version 106300
> Call Stack (most recent call first): C:/Program Files
> (x86)/JetBrains/CLion
> 2016.3.5/bin/cmake/share/cmake-3.6/Modules/FindBoost.cmake:842 (_Boost_COMPONENT_DEPENDENCIES) C:/Program Files
> (x86)/JetBrains/CLion
> 2016.3.5/bin/cmake/share/cmake-3.6/Modules/FindBoost.cmake:1395 (_Boost_MISSING_DEPENDENCIES) CMakeLists.txt:6 (find_package)
How can I make the boost library work under mingw64 ?
Would appreciate any help
Upvotes: 1
Views: 581
Reputation: 1762
I am using the same setup, my make file looks like yours.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
set(Boost_INCLUDE_DIR c:/mingw/include/)
set(Boost_LIBRARY_DIR c:/mingw/lib/)
find_package(Boost COMPONENTS system filesystem REQUIRED)
include_directories(${Boost_INCLUDE_DIR})
I have also added the MINGW paths to my systems environment user variables.
Upvotes: 1