From: Kefu Chai Date: Thu, 26 Apr 2018 08:46:57 +0000 (+0800) Subject: cmake: enable CMP0051 X-Git-Tag: v13.1.0~73^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F21662%2Fhead;p=ceph.git cmake: enable CMP0051 the new behavior of get_target_property( SOURCES) will be enforced in future versions of cmake, so let ready for this change now by removing the generator expressions from the returned source file list. Signed-off-by: Kefu Chai --- diff --git a/CMakeLists.txt b/CMakeLists.txt index a037c5102684..0edada58891d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,13 +19,7 @@ if(POLICY CMP0065) cmake_policy(SET CMP0065 NEW) endif() if(POLICY CMP0051) - # cmake 3.1 and higher include generator expressions in SOURCES property. - # in BuildBoost.cmake, get_target_property( SOURCES) is used - # to retrieve the source files of a target. in that case, we are only - # interested in the *source* files. and i don't want to bother stripping off - # the TARGET_OBJECTS elements from the returned SOURCES. so let's stick with - # the old behavior now. - cmake_policy(SET CMP0051 OLD) + cmake_policy(SET CMP0051 NEW) endif() list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/") diff --git a/cmake/modules/BuildBoost.cmake b/cmake/modules/BuildBoost.cmake index 819a9b744713..d6572115a47a 100644 --- a/cmake/modules/BuildBoost.cmake +++ b/cmake/modules/BuildBoost.cmake @@ -254,6 +254,9 @@ function(maybe_add_boost_dep target) return() endif() get_target_property(sources ${target} SOURCES) + if(NOT CMAKE_VERSION VERSION_LESS 3.1) + string(GENEX_STRIP "${sources}" sources) + endif() foreach(src ${sources}) get_filename_component(ext ${src} EXT) # assuming all cxx source files include boost header(s)