title: gtest/gtest.h: No such file or directory #include "gtest/gtest.h"
body: <p>I have never encountered a problem with testing my code using gtest a few months ago until recently I encountered a problem where all of a sudden the <code>"gtest/gtest.h"</code> header file can no longer be found. I am using putty to hold all my files and directories and the googletest directory is located in the same filepath as the unit test I am compiling to generate the executable. The gtest GitHub was recently updated so I'm not sure if that might have caused it. I have used <code>git submodule add &lt;gtest URL&gt;</code> and the it says that googletest already exists. I have always built my files using <code>cmake3 .</code>, but now I keep getting errors regarding the <code>TEST()</code> functions within the unit test file. I assume this is because the gtest directory cannot be found. I also tried using <code>cmake .</code> to build but that results in a ton of untrackable errors with the gtest.h header file itself. Apparently it seems that building with <code>cmake .</code> can track the gtest.h header file while building with <code>cmake3 .</code> cannot. I still have no clue on how to solve this error.</p>
  
  <p>Here is my CMakeLists.txt file:</p>
  
  <pre><code>CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
  
  ADD_SUBDIRECTORY(googletest)
  
  SET(CMAKE_CXX_STANDARD 11)
  
  ADD_EXECUTABLE(test
         unit_test.cpp
  )
  
  TARGET_LINK_LIBRARIES(test gtest)
  TARGET_COMPILE_DEFINITIONS(test PRIVATE gtest_disable_pthreads=ON)
  </code></pre>
  
  <p>EDIT:: I forgot to include that the initial error in the title post occurs after compiling the unit test file separate to using <code>cmake</code> or <code>make</code>. I use the following command <code>g++ -std=c++11 unit_test.cpp</code> in order to compile and the resulting error is <code>gtest/gtest.h: No such file or directory #include "gtest/gtest.h"</code>. </p>