severity 895713 normal
tags 895713 + patch
thanks

On Saturday, April 14, 2018 7:10:33 PM CDT you wrote:

> Debian's googletest package used to ship only sources, not a compiled
> libgtest.  The ros-catkin package has a build-dep on libgtest-dev.

I was mistaken on the second point; ros-catkin does NOT build-depend on 
libgtest-dev.  I got confused while rebuilding it on my development system 
with gtest installed.  This configuration does provoke the errors described.  
At present, however, ros-catkin rebuilds fine on a clean (pbuilder) 
environment.  So I'm downgrading this bug.

If, in future, you decide to enable tests, you will run into this bug.  It 
looks to me like the gtest and gtest_main libraries are already set by
"find_package(GTest QUIET)".  Removing the lines in catkin's gtest.cmake (see 
patch) fixes the build for me.


> Additionally, the flaw in gtest.cmake appears to be the cause of
> ros-rospack build failure tracked in Bug #895708 -- contrary to what
> was previously written in that bug -- as the ros-rospack build fails
> at the same lines in the installed version of gtest.cmake:
> 
>     -- Found gtest: gtests will be built
>     CMake Error at /usr/share/catkin/cmake/test/gtest.cmake:369
> (add_library): add_library cannot create imported target "gtest" because
> another target with the same name already exists.
>     Call Stack (most recent call first):
>       /usr/share/catkin/cmake/all.cmake:147 (include)
>       /usr/share/catkin/cmake/catkinConfig.cmake:20 (include)
>       CMakeLists.txt:4 (find_package)

This is again what I observed on my development system.  When built in a clean 
environment -- e.g. see [1] -- this error does not occur, although #895708 
does.  I'm not sure why.

[1] 
https://tests.reproducible-builds.org/debian/rb-pkg/unstable/amd64/ros-rospack.html

-Steve
diff --git a/cmake/test/gtest.cmake b/cmake/test/gtest.cmake
index c12f67f..ace642a 100755
--- a/cmake/test/gtest.cmake
+++ b/cmake/test/gtest.cmake
@@ -366,10 +366,6 @@ if(NOT GMOCK_FOUND)
     endif()
   else()
     message(STATUS "Found gtest: gtests will be built")
-    add_library(gtest SHARED IMPORTED)
-    set_target_properties(gtest PROPERTIES IMPORTED_LOCATION "${GTEST_LIBRARIES}")
-    add_library(gtest_main SHARED IMPORTED)
-    set_target_properties(gtest_main PROPERTIES IMPORTED_LOCATION "${GTEST_MAIN_LIBRARIES}")
     set(GTEST_FOUND ${GTEST_FOUND} CACHE INTERNAL "")
     set(GTEST_INCLUDE_DIRS ${GTEST_INCLUDE_DIRS} CACHE INTERNAL "")
     set(GTEST_LIBRARIES ${GTEST_LIBRARIES} CACHE INTERNAL "")

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to