From 47d0e1e16d4cd7a4cc3211a5b39a125b602c299b Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Thu, 19 Dec 2019 10:56:16 +0800 Subject: [PATCH] cmake: CMAKE_ROLE defaults to "PROJECT" so we can use exported targets like "Python3::Python", which is defined only if CMAKE_ROLE is "PROJECT". but this global property was introduced by CMake 3.14, but the minimum required version of CMake is 3.10.2 in Ceph project at this moment. let's set it if it's not defined. Signed-off-by: Kefu Chai --- cmake/modules/FindPython/Support.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmake/modules/FindPython/Support.cmake b/cmake/modules/FindPython/Support.cmake index b2bdc00250bcb..6584699b7976d 100644 --- a/cmake/modules/FindPython/Support.cmake +++ b/cmake/modules/FindPython/Support.cmake @@ -25,6 +25,10 @@ else() endif() get_property(_${_PYTHON_PREFIX}_CMAKE_ROLE GLOBAL PROPERTY CMAKE_ROLE) +if (NOT DEFINED _${_PYTHON_PREFIX}_CMAKE_ROLE) + # CMake 3.14 introduced CMAKE_ROLE + set(_${_PYTHON_PREFIX}_CMAKE_ROLE "PROJECT") +endif() # -- 2.39.5