Project

General

Profile

Bug #19987

-DWITH_TESTS=OFF build fails on master

Added by Nathan Cutler over 1 year ago. Updated over 1 year ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
05/19/2017
Due date:
% Done:

0%

Source:
Tags:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:

Description

tl;dr

src/dmclock/CMakeLists.txt introduced by https://github.com/ceph/ceph/pull/14330 does not contain WITH_TESTS guards, causing cmake (configure) to fail.

Full(er) analysis

By default, WITH_TESTS is set to ON:

option(WITH_TESTS "enable the build of ceph-test package scripts/binaries" ON)

And the gtest and gtest_main targets only get built when WITH_TESTS is ON:

# Support/Tools
if(WITH_TESTS)
add_subdirectory(googletest/googlemock)
add_subdirectory(test)
endif(WITH_TESTS)

As a result, the following conditional block in src/dmclock/CMakeLists.txt does not get triggered in the default case:

if (NOT(TARGET gtest AND TARGET gtest_main))
  set(GTEST_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../googletest)
  find_package(GTest REQUIRED)
  include_directories(${GTEST_INCLUDE_DIRS})
endif()

(That is why we haven't seen builds failing.)

However, if cmake is run with -DWITH_TESTS=OFF, that conditional block does get triggered, and it fails:

[  158s] CMake Error at src/dmclock/CMakeLists.txt:20 (find_package):
[  158s]   By not providing "Findgtest.cmake" in CMAKE_MODULE_PATH this project has
[  158s]   asked CMake to find a package configuration file provided by "gtest", but
[  158s]   CMake did not find one.
[  158s] 
[  158s]   Could not find a package configuration file provided by "gtest" with any of
[  158s]   the following names:
[  158s] 
[  158s]     gtestConfig.cmake
[  158s]     gtest-config.cmake
[  158s] 
[  158s]   Add the installation prefix of "gtest" to CMAKE_PREFIX_PATH or set
[  158s]   "gtest_DIR" to a directory containing one of the above files.  If "gtest" 
[  158s]   provides a separate development package or SDK, be sure it has been
[  158s]   installed.
[  158s] 
[  158s] 
[  158s] -- Configuring incomplete, errors occurred!

Solution is to add the missing WITH_TESTS guards.

History

#2 Updated by Nathan Cutler over 1 year ago

  • Tracker changed from Fix to Bug
  • Subject changed from dmclock cmake fixes for SUSE to -DWITH_TESTS=OFF build fails on master
  • Description updated (diff)
  • Regression set to No
  • Severity set to 3 - minor

#3 Updated by Nathan Cutler over 1 year ago

  • Status changed from In Progress to Resolved
  • Assignee changed from Nathan Cutler to Eric Ivancich

Also available in: Atom PDF