[cmake-developers] ALIAS target scope regression

Nils Gladitz nilsgladitz at gmail.com
Mon Nov 2 04:09:54 EST 2015


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"

Nils


More information about the cmake-developers mailing list