origin/main does not compile anymore for Debug
ingo-h opened this issue · comments
Describe the bug
Since months in my cmake project I successful downloaded and configured Googletest with:
include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG origin/main
GIT_SHALLOW ON
}
FetchContent_MakeAvailable(googletest)
Then I configure it with:
~$ cmake -S . -B build -D BUILD_SHARED_LIBS=ON -D CMAKE_BUILD_TYPE=Debug
~$ cmake --build build --config Debug
Now I get the error message:
Scanning dependencies of target gtest
[ 34%] Building CXX object _deps/googletest-build/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o
[ 35%] Linking CXX shared library ../../../lib/libgtest.so
[ 35%] Built target gtest
Scanning dependencies of target gmock
[ 35%] Building CXX object _deps/googletest-build/googlemock/CMakeFiles/gmock.dir/src/gmock-all.cc.o
[ 36%] Linking CXX shared library ../../../lib/libgmock.so
[ 36%] Built target gmock
Scanning dependencies of target gmock_main
[ 36%] Building CXX object _deps/googletest-build/googlemock/CMakeFiles/gmock_main.dir/src/gmock_main.cc.o
[ 37%] Linking CXX shared library ../../../lib/libgmock_main.so
[ 37%] Built target gmock_main
Scanning dependencies of target gtest_main
[ 37%] Building CXX object _deps/googletest-build/googletest/CMakeFiles/gtest_main.dir/src/gtest_main.cc.o
[ 38%] Linking CXX shared library ../../../lib/libgtest_main.so
[ 38%] Built target gtest_main
Scanning dependencies of target test_template
[ 38%] Building CXX object ../gtests/build/CMakeFiles/test_template.dir/test_template.cpp.o
gmake[2]: *** No rule to make target 'lib/libgmockd.so', needed by '../gtests/build/test_template'. Stop.
gmake[1]: *** [CMakeFiles/Makefile2:471: ../gtests/build/CMakeFiles/test_template.dir/all] Error 2
gmake: *** [Makefile:149: all] Error 2
If I use in FetchContent_Declare()
:
GIT_TAG release-1.11.0
then everything is successful working as before.
Can you please tell me the GIT_TAG of the previous origin/main
release?
Steps to reproduce the bug
Just follow the steps above.
Does the bug persist in the most recent commit?
Yes.
What operating system and version are you using?
I use Debian 11 resp. Bullseye.
What compiler and version are you using?
~$ g++ --version
g++ (Debian 10.2.1-6) 10.2.1 20210110
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
What build system are you using?
~$ cmake --version
cmake version 3.18.4
CMake suite maintained and supported by Kitware (kitware.com/cmake).
It looks like you are adding a debug suffix to the names of libraries, for example https://github.com/upnplib/upnplib/blob/57af560f5c4c0e71ef8655117a7e8e47c71dab37/CMakeLists.txt#L337. We recently removed the debug suffix.
Instead of hardcoding the file names, I think CMake lets you refer to them by something like GTest::gmock
.