[cmake-developers] [CMake 0015783]: ALIASED_TARGET property is always set

Mantis Bug Tracker mantis at public.kitware.com
Mon Oct 12 10:32:03 EDT 2015


The following issue has been SUBMITTED. 
====================================================================== 
https://cmake.org/Bug/view.php?id=15783 
====================================================================== 
Reported By:                Daniele E. Domenichelli
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15783
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2015-10-12 16:32 CEST
Last Modified:              2015-10-12 16:32 CEST
====================================================================== 
Summary:                    ALIASED_TARGET property is always set
Description: 
The ALIASED_TARGET property is always set even if no alias is associated to a
target. 

Steps to Reproduce: 
Using this CMakeLists.txt

---
cmake_minimum_required(VERSION 3.2)
project(test C)

file(WRITE ${CMAKE_BINARY_DIR}/test.c "int main(int argc, char *argv[]) { return
0; }\n")
add_executable(test_exe ${CMAKE_BINARY_DIR}/test.c)

get_property(_aliased_target_set TARGET test_exe PROPERTY ALIASED_TARGET SET)
if(_aliased_target_set)
  message(STATUS "ALIASED_TARGET is set for target test_exe")
  get_property(_aliased_target_value TARGET test_exe PROPERTY ALIASED_TARGET)
  message(STATUS "    ALIASED_TARGET = \"${_aliased_target_value}\"")
else()
  message(STATUS "ALIASED_TARGET is NOT set for target test_exe")
endif()

include (CMakePrintHelpers)
cmake_print_properties(TARGETS test_exe PROPERTIES ALIASED_TARGET)


add_executable(Test::test_exe ALIAS test_exe)

get_property(_aliased_target_set TARGET Test::test_exe PROPERTY ALIASED_TARGET
SET)
if(_aliased_target_set)
  message(STATUS "ALIASED_TARGET is set for target Test::test_exe")
  get_property(_aliased_target_value TARGET Test::test_exe PROPERTY
ALIASED_TARGET)
  message(STATUS "    ALIASED_TARGET = \"${_aliased_target_value}\"")
else()
  message(STATUS "ALIASED_TARGET is NOT set for target Test::test_exe")
endif()

include (CMakePrintHelpers)
cmake_print_properties(TARGETS Test::test_exe PROPERTIES ALIASED_TARGET CICCIO)
---




The actual output is

-- ALIASED_TARGET is set for target test_exe
--     ALIASED_TARGET = "_aliased_target_value-NOTFOUND"
--
 Properties for TARGET test_exe:
   test_exe.ALIASED_TARGET = "property-NOTFOUND"

-- ALIASED_TARGET is set for target Test::test_exe
--     ALIASED_TARGET = "test_exe"
--
 Properties for TARGET Test::test_exe:
   Test::test_exe.ALIASED_TARGET = "test_exe"



The expected output is

-- ALIASED_TARGET is NOT set for target test_exe
--
 Properties for TARGET test_exe:
   test_exe.ALIASED_TARGET = <NOTFOUND>

-- ALIASED_TARGET is set for target Test::test_exe
--     ALIASED_TARGET = "test_exe"
--
 Properties for TARGET Test::test_exe:
   Test::test_exe.ALIASED_TARGET = "test_exe"


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

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2015-10-12 16:32 Daniele E. DomenichelliNew Issue                               
    
======================================================================



More information about the cmake-developers mailing list