This is my first post on StackOverflow, so apologies if there\'s something wrong with my question.
I\'m new at CMake, and I\'m running into a problem trying to import gt
This is just double including 3d-party project (gtest in your case) using add_subdirectory. The first include point is
add_subdirectory(gmock-1.7.0)
inside yaml-cpp subproject and the second include point is
add_subdirectory(thirdparty/googletest)
in your CMakeLists.txt.
Such double including doesn't work in CMake, so you need to eliminate one of add_subdirectory call.
In your code, you may replace add_subdirectory approach by combination of ExternalProject_Add and execute_process. That approach will build googletest on configuration stage (so, find_package(GTest) will work), but doesn't pollute namespace of your project with targets from googletest.
In other project (yaml-cpp), you may eliminate including googletest by disable testing. Just disable appropriate option
option(YAML_CPP_BUILD_TOOLS "Enable testing and parse tools" OFF)
before
add_subdirectory(thirdparty/yaml-cpp-yaml-cpp-0.5.3)
(For disabling option from CMakeLists.txt you need to reconfigure the whole project cleanly, that is with empty CMake cache).
Note, that this option also disables some utilities under util/ subdirectory of yaml-cpp project.
Similarly to the first approach, you may change inclusion of yaml-cpp subproject to ExternalProject_Add + execute_process. Such a way all its targets and targets of its subprojects will not pollute namespace of your project.