Skip to content

Commit a281a33

Browse files
committed
Fix compatibility with newer versions of CMake
1 parent 9e8a698 commit a281a33

2 files changed

Lines changed: 16 additions & 8 deletions

File tree

CMakeLists.txt

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,16 @@ if(POLICY CMP0022)
1717
cmake_policy(SET CMP0022 NEW) # automatic when 2.8.12 is required
1818
endif()
1919

20-
if (POLICY CMP0051)
21-
# CMake 3.1 and higher include generator expressions of the form
22-
# $<TARGETLIB:obj> in the SOURCES property. These need to be
23-
# stripped everywhere that access the SOURCES property, so we just
24-
# defer to the OLD behavior of not including generator expressions
25-
# in the output for now.
26-
cmake_policy(SET CMP0051 OLD)
20+
# CMake version 3.1.0 removed support for setting Policy CMP0051 to OLD
21+
if(CMAKE_VERSION VERSION_LESS "3.1.0")
22+
if (POLICY CMP0051)
23+
# CMake 3.1 and higher include generator expressions of the form
24+
# $<TARGETLIB:obj> in the SOURCES property. These need to be
25+
# stripped everywhere that access the SOURCES property, so we just
26+
# defer to the OLD behavior of not including generator expressions
27+
# in the output for now.
28+
cmake_policy(SET CMP0051 OLD)
29+
endif()
2730
endif()
2831

2932
if(CMAKE_VERSION VERSION_LESS 3.1.20141117)

tools/clang/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
cmake_minimum_required(VERSION 2.8.8)
1+
# Support for CMake versions <3.5 is removed in versions >3.20
2+
if(${CMAKE_VERSION} VERSION_LESS "3.20")
3+
cmake_minimum_required(VERSION 2.8.8)
4+
else()
5+
cmake_minimum_required(VERSION 3.5)
6+
endif()
27

38
# FIXME: It may be removed when we use 2.8.12.
49
if(CMAKE_VERSION VERSION_LESS 2.8.12)

0 commit comments

Comments
 (0)