Qt +CMake+ gmock build issue“gmock.h no such file or diretory” while building in Qt
I have incorporated GTest in my already existing CMake project by following this google doc( https://github.com/google/googletest...-cmake-project)
If I build my project through the command line there is no error, I am able to run UnitTest Exe. But as I need to debug the unit test, when I run the test in Qt Creator it builds it first but the build failed, throwing the error "gmock/h: no such file or directory". I am not able to understand why this error on Qt Creator only. As few stackoverflow post suggests only gmock.h should get included, that is already there.
Re: Qt +CMake+ gmock build issue“gmock.h no such file or diretory” while building in
Did you tell Qt Creator where to find your missing header file? Your CMakelists.txt file probably has a target_include_directories() entry that tells CMake where to find it. You need to do the equivalent thing in your Qt project .pro file.
Re: Qt +CMake+ gmock build issue“gmock.h no such file or diretory” while building in
Quote:
Originally Posted by
piyush bisen
If I build my project through the command line there is no error, I am able to run UnitTest Exe. But as I need to debug the unit test, when I run the test in Qt Creator it builds it first but the build failed, throwing the error "gmock/h: no such file or directory". I am not able to understand why this error on Qt Creator only. As few stackoverflow post suggests only gmock.h should get included, that is already there.
It seems to me that the error message is self-explanatory "gmock/h" is not "gmock.h" and is very unlikely to be a file. Find where your code references "gmock/h" and fix the typo.
Whether this message occurs in any given build/build environment will depend on whether the offending statement is ever parsed, it may be conditionally compiled (inside #ifdef for example.)
Re: Qt +CMake+ gmock build issue“gmock.h no such file or diretory” while building in
Quote:
It seems to me that the error message is self-explanatory "gmock/h" is not "gmock.h" and is very unlikely to be a file. Find where your code references "gmock/h" and fix the typo.
I assumed that the "gmock/h" was a typo in the post, not a typo in the code, since the OP said the code builds under the CMake toolchain. If it was a code typo, it wouldn't build in either place.