google / googletest

GoogleTest - Google Testing and Mocking Framework
https://google.github.io/googletest/
BSD 3-Clause "New" or "Revised" License
33.71k stars 9.98k forks source link

Distribution agnostic CMakeLists.txt? #2525

Open jwhendy opened 4 years ago

jwhendy commented 4 years ago

Greetings,

Arch linux ships without a /usr/src/gmock/CMakeLists.txt. I downloaded the one here, but had to change the directory in L17.

As is:

# A directory to find Google Test sources.
  if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/gtest/CMakeLists.txt")
  set(gtest_dir gtest)
  else()
  set(gtest_dir ../googletest)
  endif()

I had success with ../gtest, but also get a warning when building a Robot Operating System package depending on it, so I'm not sure I did the RightThing(TM):

CMake Warning at /usr/src/gmock/CMakeLists.txt:37 (project):
  VERSION keyword not followed by a value or was followed by a value that
  expanded to nothing.

CMake Warning (dev) at /usr/src/gmock/CMakeLists.txt:47 (add_subdirectory):
  Policy CMP0013 is not set: Duplicate binary directories are not allowed.
  Run "cmake --help-policy CMP0013" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  The binary directory

    /home/jwhendy/catkin_ws/build/realtime_tools/gtest

  is already used to build a source directory.  This command uses it to build
  source directory

    /usr/src/gtest

  which can generate conflicting build files.  CMake does not support this
  use case but it used to work accidentally and is being allowed for
  compatibility.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning at /usr/src/gtest/CMakeLists.txt:47 (project):
  VERSION keyword not followed by a value or was followed by a value that
  expanded to nothing.

So, 1) is ../googletest a universal standard that all distros should adhere to (if so, I can ask arch linux to standardize) and 2) any cause for concern on the build warning, or is that expected?

tobbi commented 1 month ago

I tried to fix the second warning in #4539.