google / google/googletest

Distribution agnostic CMakeLists.txt?

Open
#2,525 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
39.5k
Forks
10.9k
Avg merge
6d 13h
Merged PRs (30d)
1

Description

Greetings,

Arch linux ships without a `/usr/src/gmock/CMakeLists.txt`. I downloaded the one here, but had to change the directory in [L17](https://github.com/google/googletest/blob/master/googlemock/CMakeLists.txt#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?

Contributor guide

Open the contributing guide

Research direction

Start with googlemock/CMakeLists.txt around line 17 and compare the gtest_dir paths mentioned in the issue. Reproduce the CMake configure step using the /usr/src/gtest and /usr/src/gmock locations, then inspect the warnings at lines 37 and 47. Done means the supported directory layout and expected warning behavior are documented or corrected.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.