title: How to link Google Test library to CLion project (Mac OS X El Capitan)
body: <p>I'm trying to link my project with google C++ testing framework. I use Mac OS X El Capitan and I have installed test library in the default path.</p>
  
  <p><code>lib</code>:</p>
  
  <pre><code>/usr/local/lib/libgtest_main.a
  /usr/local/lib/libgtest.a
  </code></pre>
  
  <p><code>include</code> (for headers):</p>
  
  <pre><code>/usr/local/include/gtest
  </code></pre>
  
  <p>I created a new CLion (2016.1.1) project a this is the <code>CMakeList.txt</code> which should include the lib.</p>
  
  <pre><code>cmake_minimum_required(VERSION 3.5)
  project(GoogleTest)
  
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
  
  set(SOURCE_FILES main.cpp)
  add_executable(GoogleTest ${SOURCE_FILES})
  target_link_libraries(GoogleTest gtest gtest_main)
  </code></pre>
  
  <p>This is the result:</p>
  
  <pre><code>Scanning dependencies of target GoogleTest
  [ 50%] Building CXX object CMakeFiles/GoogleTest.dir/main.cpp.o
  [100%] Linking CXX executable GoogleTest
  ld: library not found for -lgtest
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  make[2]: *** [GoogleTest] Error 1
  make[1]: *** [CMakeFiles/GoogleTest.dir/all] Error 2
  make: *** [all] Error 2
  </code></pre>
  
  <p>How can I fix this? Thanks in advance</p>