googletest icon indicating copy to clipboard operation
googletest copied to clipboard

FetchContent + VisualStudio miss google test header files in the generated project files

Open andreygorbachev opened this issue 3 months ago • 0 comments
trafficstars

Describe the issue

I use googletest with FetchContent and my main development environment is VisualStudio IDE - in the generated solution I can see gtest (and gtest_main) generated projects and I can see googletest source files (*.cc in Source Files) in these projects. Should I also see the header files like gtest.h in these projects (in Header Files)?

Should there be an entry in the googletest CMakeLists.txt for target_sources (of these header files) - I think that would instruct cmake to generate the Header Files entry in the generated project files.

Steps to reproduce the problem

in the consuming CMakeLists.txt ... include(FetchContent)

set(BUILD_GMOCK Off) # I am not sure if this meant to be used outside of googletest

FetchContent_Declare( googletest GIT_REPOSITORY https://github.com/google/googletest.git GIT_TAG v1.17.0 )

FetchContent_MakeAvailable(googletest) ...

... target_link_libraries(${PROJECT_NAME} PRIVATE xyz GTest::gtest_main ) ...

What version of GoogleTest are you using?

1.17 (latest)

What operating system and version are you using?

Windows 11 (latest)

What compiler and version are you using?

VisualStudio (latest)

What build system are you using?

What ever is bundled with the VisualStudio

Additional context

No response

andreygorbachev avatar Aug 14 '25 08:08 andreygorbachev