title: How to include external library (boost) into CLion C++ project with CMake?
body: <p>I have the following setup for C++ development:</p>
  
  <ul>
  <li><code>OS X Yosemite</code></li>
  <li><code>CLion 140.2310.6</code> (a cross-plattform C/C++-IDE by JetBrains using <code>CMake</code> as build system)</li>
  <li>installed <code>boost</code> via <code>brew install boost</code> into <code>/usr/local/Cellar/boost/</code></li>
  </ul>
  
  <p>Now, my goal is to setup a simple project and include the <code>boost</code> library. I defined just one <strong>test.cpp</strong> file that looks like this:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;boost&gt;
  
  using namespace std;
  
  int test() {
      cout &lt;&lt; "Hello, World!" &lt;&lt; endl;
      return 0; 
  }
  </code></pre>
  
  <p>My <strong>CMakeLists.txt</strong> file looks like this:</p>
  
  <pre><code>cmake_minimum_required(VERSION 2.8.4) 
  project(MyProject)
  
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") 
  
  include_directories("/usr/local/Cellar/boost/1.57.0/include/boost")
  
  set(SOURCE_FILES main.cpp ./test.cpp)
  add_executable(MyProject ${SOURCE_FILES}) 
  </code></pre>
  
  <p>When I build the project, I get the following error:</p>
  
  <blockquote>
    <p>/Users/nburk/Documents/uni/master/master_thesis/MyProject/test.cpp:2:10:
    fatal error: 'boost' file not found</p>
    
    <p>make[3]: *** [CMakeFiles/MyProject.dir/test.cpp.o] Error 1 
    make[2]: *** [CMakeFiles/MyProject.dir/all] Error 2 
    make[1]: *** [CMakeFiles/MyProject.dir/rule] Error 2 
    make: *** [MyProject] Error 2</p>
  </blockquote>
  
  <p>I played around with adjusting paths here and there and also using <code>add_library</code> and <code>target_link_libraries</code>, none of which made the project build successfully. </p>
  
  <p><strong>Can someone point into the right direction how to make sure I can include <code>boost</code>s functionality into my CLion C++ project?</strong></p>
  
  <p><strong>Update:</strong>
  Thanks to @Waxo's answer I used the following code in my <strong>CMakeLists.txt</strong> file which:</p>
  
  <pre><code>set(Boost_INCLUDE_DIR /usr/local/Cellar/boost/1.57.0)
  set(Boost_LIBRARY_DIR /usr/local/Cellar/boost/1.57.0/lib)
  find_package(Boost COMPONENTS system filesystem REQUIRED)
  include_directories(${Boost_INCLUDE_DIR})
  </code></pre>
  
  <p>I now got past the <strong>file not found</strong>-error, but instead I get the following:</p>
  
  <blockquote>
    <p>CMake Error at /Applications/CLion
    EAP.app/Contents/bin/cmake/share/cmake-3.1/Modules/FindBoost.cmake:685
    (file):   </p>
    
    <p>file STRINGS file "/usr/local/Cellar/boost/1.57.0/boost/version.hpp" cannot   be read.</p>
    
    <p>Call Stack (most recent call first):   CMakeLists.txt:11
    (find_package)</p>
  </blockquote>
  
  <p>Any ideas what I am still missing? The referred line (685) in <strong>FindBoost.cmake</strong> is:
  <code>file(STRINGS "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS REGEX "#define BOOST_(LIB_)?VERSION ")</code></p>