[LLVMbugs] [Bug 23595] New: CMake 3.3 warns when multiple custom commands use the same MAIN_DEPENDENCY source file

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed May 20 09:41:53 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=23595

            Bug ID: 23595
           Summary: CMake 3.3 warns when multiple custom commands use the
                    same MAIN_DEPENDENCY source file
           Product: compiler-rt
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: compiler-rt
          Assignee: unassignedbugs at nondot.org
          Reporter: rnk at google.com
                CC: brad.king at kitware.com, kcc at google.com,
                    kuba.brecka at gmail.com, llvmbugs at cs.uiuc.edu,
                    samsonov at google.com
    Classification: Unclassified

This is the text of the warning:

CMake Warning (dev) at
projects/compiler-rt/cmake/Modules/CompilerRTCompile.cmake:58
(add_custom_command):
  Policy CMP0057 is not set: Disallow multiple MAIN_DEPENDENCY specifications
  for the same file.  Run "cmake --help-policy CMP0057" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  "D:/src/llvm/utils/unittest/googletest/src/gtest-all.cc" can only be
  specified as a custom command MAIN_DEPENDENCY once.
Call Stack (most recent call first):
  projects/compiler-rt/lib/asan/tests/CMakeLists.txt:122 (clang_compile)
  projects/compiler-rt/lib/asan/tests/CMakeLists.txt:253 (asan_compile)
  projects/compiler-rt/lib/asan/tests/CMakeLists.txt:265
(add_asan_tests_for_arch_and_kind)
This warning is for project developers.  Use -Wno-dev to suppress it.

I ran `cmake --help-policy CMP0057` as suggested and got this:
  $ cmake --help-policy CMP0057
  CMP0057
  -------

  Disallow multiple ``MAIN_DEPENDENCY`` specifications for the same file.

  CMake 3.3 and above no longer allow the same input file to be used
  as a ``MAIN_DEPENDENCY`` in more than one custom command.

  Listing the same input file more than once in this context has not been
  supported by earlier versions either and would lead to build time issues
  but was not diagnosed.

  The ``OLD`` behavior for this policy is to allow using the same input file
  in a ``MAIN_DEPENDENCY`` specfication more than once.
  The ``NEW`` behavior is to disallow using the same input file in a
  ``MAIN_DEPENDENCY`` specification more than once.

  This policy was introduced in CMake version 3.3.
  CMake version 3.2.20150318 warns when the policy is not set and uses
  ``OLD`` behavior.  Use the ``cmake_policy()`` command to set
  it to ``OLD`` or ``NEW`` explicitly.

The problem is that we actually do want to compile the same source file
multiple times in different configurations. Using cmake_policy(CMP0057 OLD)
would work, but I assume it would leave some IDE project generators (VS and
XCode) in a broken state. Maybe we don't care about VS, but Apple might want to
be able to test ASan from XCode.

I'm going to commit the policy and leave this bug open for people to decide
what to do.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150520/b0f18c6d/attachment.html>


More information about the llvm-bugs mailing list