Remember though, the real power and utility in ExternalProject is when you want to build an external project as part of the build process for your project. (Remember to escape those *'s!) You can build up your CMakeLists.txt to include those ExternalProject bits that you took out. You can build up a tighter filter for -gtest_filter. If you get to this point, great! You're well on your way. (Also, remember to escape those *'s!) ~/foo Building CXX object CMakeFiles/expirement.dir/ Scanning dependencies of target expirement Build files have been written to: /Users/nega/foo The CXX compiler identification is AppleClang 8.038 The C compiler identification is AppleClang 8.038 Now, since we don't have your source I had to mock a couple of stubs. You'll notice I dropped the ExternalProject bits, and you can figure out where I put googletest. Target_link_libraries(expirement Threads::Threads) Include_directories($ENV/googletest/googlemock/gtest/libgtest_main.a Set(SOURCE_FILES main.cpp getstring.cpp tests.cpp) I assume you have googletest built successfully, and you know how to use it (If not, that's a separate question.) Reduce your CMakeLists.txt.ĬMakeLists.txt cmake_minimum_required(VERSION 3.7) Let's dig into your problem.įirst, simplify. Any executable can be a test if you want it to be. You only need to use enable_testing() and add_test() if you want to use convenience of CMake's CTest framework. Other comments and answers suggest that you need to use add_test().
0 Comments
Leave a Reply. |