[PATCH] [CMake] Set CMake policy CMP0051 to OLD

Zachary Turner zturner at google.com
Tue Feb 24 14:32:30 PST 2015


Hi mcrosier, chandlerc,

When you use generator expressions in a library sources list,
and then later access the SOURCES property, the OLD behavior
(CMake 3.0 and earlier) would not include these expressions in
the SOURCES property.  The NEW behavior (starting in CMake 3.1)
is that they do include the generator expressions in the SOURCES
property.

You can see an example of this warning occurring in practice on the
lldb bots currently.

http://lab.llvm.org:8011/builders/lldb-x86-windows-msvc/builds/2382/steps/cmake/logs/stdio

http://reviews.llvm.org/D7870

Files:
  CMakeLists.txt

Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -7,6 +7,15 @@
   set(CMAKE_BUILD_TYPE "Debug")
 endif()
 
+if (POLICY CMP0051)
+  # CMake 3.1 and higher include generator expressions of the form
+  # $<TARGETLIB:obj> in the SOURCES property.  These need to be
+  # stripped everywhere that access the SOURCES property, so we just
+  # defer to the OLD behavior of not including generator expressions
+  # in the output for now.
+  cmake_policy(SET CMP0051 OLD)
+endif()
+
 if(POLICY CMP0022)
   cmake_policy(SET CMP0022 NEW) # automatic when 2.8.12 is required
 endif()

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7870.20628.patch
Type: text/x-patch
Size: 653 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150224/443f7a9e/attachment.bin>


More information about the llvm-commits mailing list