简体   繁体   中英

adding boost library to clion on MacOsX

Hello i installed boost using comand brew install boost it installed 1.66.0 version I edited CMakeLists in this way

 cmake_minimum_required(VERSION 3.8)
project(fraction)
set(CMAKE_CXX_STANDARD 11)


set(SOURCE_FILES main.cpp source/Fraction.cpp headers/Fraction.h headers/MyStack.h unitTest.cpp)
add_executable(fraction ${SOURCE_FILES})


set(BOOST_ROOT "/usr/local/Cellar/boost/1.66.0")
find_package(Boost 1.66.0)

if(NOT Boost_FOUND)
    message(FATAL_ERROR "Could not find boost!")
endif()

I don't have any error, in file unitTest.cpp I want to write test and I'm trying to include this

#include <boost/test/unit_test.hpp>

but I got error "Cannot find 'boost'" What I do wrong ?

Ok I find why it doesn't work, brew didn't link boost on high sierra it should be in this way if usr/local/include and usr/local/Frameworks don't exist it must be created by

sudo mkdir usr/local/include
sudo mkdir usr/local/Frameworks

after that we can chown usr/local/include by

sudo chown -R $(whoami) $(brew --prefix)/*

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM