]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
qa: use FOUND_VAR to be backward compatible with cmake 2.8.12
authorKefu Chai <kchai@redhat.com>
Thu, 15 Nov 2018 01:47:27 +0000 (09:47 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 15 Nov 2018 03:57:52 +0000 (11:57 +0800)
before this change, we assume that the variable set if rados::radospp is
found will be radospp_FOUND, but this is a feature cmake 3, see
https://cmake.org/cmake/help/v3.3/module/FindPackageHandleStandardArgs.html

while the cmake shipped by centos is cmake 2.8.12, where the variable
name will be <UPPERCASED_NAME>_FOUND, see
https://cmake.org/cmake/help/v2.8.12/cmake.html#module:FindPackageHandleStandardArgs

in the test of test_envlibrados_for_rocksdb.sh, we are using cmake not
the cmake3 offered by EPEL7, so RADOSPP_FOUND will be set instead. that's why
executable env_librados_test will fail to link against rados::radospp.
as rados::radospp won't be defined if radospp_FOUND is not defined/set.

after this change, the 2nd mode of FIND_PACKAGE_HANDLE_STANDARD_ARGS()
is used instead to ensure that radospp_FOUND is defined even if cmake
2.8.12 is used.

also, the message() commands for debugging purpose are removed.

Signed-off-by: Kefu Chai <kchai@redhat.com>
qa/workunits/rados/0001-cmake-add-Findrados.cmake-and-use-it.patch

index 4ab359d317b04db55f3e1f0750af15b0a2450a8b..60feef9de9b79df5199b1456de10f4bd907bc000 100644 (file)
@@ -9,12 +9,12 @@ C++ API, while the latter offers the C API.
 Signed-off-by: Kefu Chai <tchaikov@gmail.com>
 ---
  CMakeLists.txt                  |  3 ++-
- cmake/modules/Findradospp.cmake | 33 +++++++++++++++++++++++++++++++++
- 2 files changed, 35 insertions(+), 1 deletion(-)
+ cmake/modules/Findradospp.cmake | 3+++++++++++++++++++++++++++++++
+ 2 files changed, 33 insertions(+), 1 deletion(-)
  create mode 100644 cmake/modules/Findradospp.cmake
 
 diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 6cb80cd10..48c61f928 100644
+index 2a4bdb6..96972a2 100644
 --- a/CMakeLists.txt
 +++ b/CMakeLists.txt
 @@ -731,7 +731,8 @@ option(WITH_LIBRADOS "Build with librados" OFF)
@@ -29,10 +29,10 @@ index 6cb80cd10..48c61f928 100644
  if(WIN32)
 diff --git a/cmake/modules/Findradospp.cmake b/cmake/modules/Findradospp.cmake
 new file mode 100644
-index 000000000..18822adb9
+index 0000000..4f1672a
 --- /dev/null
 +++ b/cmake/modules/Findradospp.cmake
-@@ -0,0 +1,33 @@
+@@ -0,0 +1,31 @@
 +# - Find RADOS
 +# Find librados library and includes
 +#
@@ -50,15 +50,13 @@ index 000000000..18822adb9
 +
 +include(FindPackageHandleStandardArgs)
 +find_package_handle_standard_args(radospp
-+  DEFAULT_MSG RADOSPP_LIBRARIES RADOSPP_INCLUDE_DIR)
++  FOUND_VAR radospp_FOUND
++  REQUIRED_VARS RADOSPP_LIBRARIES RADOSPP_INCLUDE_DIR)
 +
 +mark_as_advanced(
 +  RADOSPP_INCLUDE_DIR
 +  RADOSPP_LIBRARIES)
 +
-+message(STATUS "${RADOSPP_INCLUDE_DIR}")
-+message(STATUS "${RADOSPP_LIBRARIES}")
-+message(STATUS "${radospp_FOUND}")
 +if(radospp_FOUND AND NOT (TARGET rados::radospp))
 +  add_library(rados::radospp UNKNOWN IMPORTED)
 +  set_target_properties(rados::radospp PROPERTIES