dmonopoly / gtest-cmake-example Goto Github PK
View Code? Open in Web Editor NEWHelpful example of a gtest and cmake set up for C++.
Helpful example of a gtest and cmake set up for C++.
I was trying to extend this, by adding a directory and a cpp file in that directory and a test_*.cpp file in that directory and add it.
I used the add_subdirectory(another_dir) directive, and inside that, I added lines
1 include_directories(${CMAKE_SOURCE_DIR})
2 include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
3 add_library(another_dir test_project2.cpp)
It compiles fine.
On the toplevel CMakeLists.txt I added, target_link_library(.... , another_dir).
This was not linking the library from the subdirectory.
Can you update this git-repo on how to handle subdirectories.
I was trying to run this sample. But after cmake .. command, no makefile is created thus unable to run make command. Please help?
I am new to this.
hi,
following the steps you outline i end up with
โ build git:(master) make test
Running tests...
Test project /Users/florian.oswald/git/gtest-cmake-example/build
Start 1: that-test-I-made
Could not find executable /Users/florian.oswald/git/gtest-cmake-example/build/runUnitTests
Looked in the following places:
/Users/florian.oswald/git/gtest-cmake-example/build/runUnitTests
/Users/florian.oswald/git/gtest-cmake-example/build/runUnitTests
/Users/florian.oswald/git/gtest-cmake-example/build/Release/runUnitTests
/Users/florian.oswald/git/gtest-cmake-example/build/Release/runUnitTests
/Users/florian.oswald/git/gtest-cmake-example/build/Debug/runUnitTests
/Users/florian.oswald/git/gtest-cmake-example/build/Debug/runUnitTests
/Users/florian.oswald/git/gtest-cmake-example/build/MinSizeRel/runUnitTests
/Users/florian.oswald/git/gtest-cmake-example/build/MinSizeRel/runUnitTests
/Users/florian.oswald/git/gtest-cmake-example/build/RelWithDebInfo/runUnitTests
/Users/florian.oswald/git/gtest-cmake-example/build/RelWithDebInfo/runUnitTests
/Users/florian.oswald/git/gtest-cmake-example/build/Deployment/runUnitTests
/Users/florian.oswald/git/gtest-cmake-example/build/Deployment/runUnitTests
/Users/florian.oswald/git/gtest-cmake-example/build/Development/runUnitTests
/Users/florian.oswald/git/gtest-cmake-example/build/Development/runUnitTests
Users/florian.oswald/git/gtest-cmake-example/build/runUnitTests
Users/florian.oswald/git/gtest-cmake-example/build/runUnitTests
Users/florian.oswald/git/gtest-cmake-example/build/Release/runUnitTests
Users/florian.oswald/git/gtest-cmake-example/build/Release/runUnitTests
Users/florian.oswald/git/gtest-cmake-example/build/Debug/runUnitTests
Users/florian.oswald/git/gtest-cmake-example/build/Debug/runUnitTests
Users/florian.oswald/git/gtest-cmake-example/build/MinSizeRel/runUnitTests
Users/florian.oswald/git/gtest-cmake-example/build/MinSizeRel/runUnitTests
Users/florian.oswald/git/gtest-cmake-example/build/RelWithDebInfo/runUnitTests
Users/florian.oswald/git/gtest-cmake-example/build/RelWithDebInfo/runUnitTests
Users/florian.oswald/git/gtest-cmake-example/build/Deployment/runUnitTests
Users/florian.oswald/git/gtest-cmake-example/build/Deployment/runUnitTests
Users/florian.oswald/git/gtest-cmake-example/build/Development/runUnitTests
Users/florian.oswald/git/gtest-cmake-example/build/Development/runUnitTests
Unable to find executable: /Users/florian.oswald/git/gtest-cmake-example/build/runUnitTests
1/2 Test #1: that-test-I-made .................***Not Run 0.00 sec
Start 2: that-other-test-I-made
Could not find executable runUnitTests
Looked in the following places:
runUnitTests
runUnitTests
Release/runUnitTests
Release/runUnitTests
Debug/runUnitTests
Debug/runUnitTests
MinSizeRel/runUnitTests
MinSizeRel/runUnitTests
RelWithDebInfo/runUnitTests
RelWithDebInfo/runUnitTests
Deployment/runUnitTests
Deployment/runUnitTests
Development/runUnitTests
Development/runUnitTests
Unable to find executable: runUnitTests
2/2 Test #2: that-other-test-I-made ...........***Not Run 0.00 sec
0% tests passed, 2 tests failed out of 2
Total Test time (real) = 0.00 sec
The following tests FAILED:
1 - that-test-I-made (Not Run)
2 - that-other-test-I-made (Not Run)
Errors while running CTest
make: *** [test] Error 8
any ideas?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.