[cmake-developers] [CMake 0015832]: ALIAS target scope regression

Mantis Bug Tracker mantis at public.kitware.com
Thu Nov 5 03:08:50 EST 2015


The following issue has been SUBMITTED. 
====================================================================== 
https://cmake.org/Bug/view.php?id=15832 
====================================================================== 
Reported By:                Nils Gladitz
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15832
Category:                   (No Category)
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2015-11-05 03:08 EST
Last Modified:              2015-11-05 03:08 EST
====================================================================== 
Summary:                    ALIAS target scope regression
Description: 
The commit
    c389f8bb07e900d805ca3163f47b06e3dbe4303b cmLocalGenerator: Port Find method
away from GetGeneratorTarget

seems to have broken the following reduced test case:
  cmake_minimum_required(VERSION 3.3)

  project(Foo CXX)

  file(WRITE sub/CMakeLists.txt [[
      file(WRITE foo.cpp "")

      add_library(foo STATIC foo.cpp)
      add_library(Foo::foo ALIAS foo)
  ]])

  add_subdirectory(sub)

  add_custom_target(bar ALL ${CMAKE_COMMAND} -E echo $<TARGET_FILE:Foo::foo>)

At generation time this now produces the diagnostic:

  CMake Error at CMakeLists.txt:14 (add_custom_target):
    Error evaluating generator expression:

      $<TARGET_FILE:Foo::foo>

    No target "Foo::foo"

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2015-11-05 03:08 Nils Gladitz   New Issue                                    
======================================================================



More information about the cmake-developers mailing list