Search code examples
windowsboostcygwinclion

Setup Clion with boost on windows 7


i need some simple example how to include boost libraries/headers with CMake in Clion IDE under windows 7.
need it for C++ 11.
Boost libs and headers are installed in custom directories.
I have installed cygwin x64 for compiler.

some solution:
i just made include of boost headers with cygdrive format

include_directories("/cygdrive/e/Libs/BoostLibs/include/boost-1_57")

But still dont understand where Clion gets the libs from.

better solution
need to set var BOOST_ROOT
so i did (and used more variables):

set(BOOST_ROOT "/cygdrive/e/Libs/BoostLibs/include/boost-1_57")

then it can be found and included

FIND_PACKAGE(Boost REQUIRED)
IF (Boost_FOUND)
    INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR})
    ADD_DEFINITIONS( "-DHAS_BOOST" )
ENDIF()

Solution

  • I'm trying out JetBrains CLion EAP (build 140.1740.3) with Boost framework v1.57.0. I got it to work by adding the below lines to the file "CMakeLists.txt" (which comes by default with a new CLion project).

    set(BOOST_ROOT "C:\boost_1_57_0")
    set(BOOSTROOT "C:\boost_1_57_0")
    
    find_package(Boost 1.57.0)
    
    if(NOT Boost_FOUND)
        message(FATAL_ERROR "Could not find boost!")
    endif()