MantisBT - CMake
View Issue Details
0015783CMakeCMakepublic2015-10-12 10:322016-06-10 14:31
Daniele E. Domenichelli 
Kitware Robot 
normalminoralways
closedmoved 
CMake 3.4 
 
0015783: ALIASED_TARGET property is always set
The ALIASED_TARGET property is always set even if no alias is associated to a target.
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"

No tags attached.
Issue History
2015-10-12 10:32Daniele E. DomenichelliNew Issue
2015-10-12 10:36Brad KingNote Added: 0039573
2015-10-12 12:58Daniele E. DomenichelliNote Added: 0039577
2016-06-10 14:29Kitware RobotNote Added: 0042854
2016-06-10 14:29Kitware RobotStatusnew => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:29Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0039573)
Brad King   
2015-10-12 10:36   
Is this new to 3.4? Would you please bisect?
(0039577)
Daniele E. Domenichelli   
2015-10-12 12:58   
Bisected up to v2.8.12, apparently the problem has always been there, but before the commit cd3d0b613e887eb64a7e5cb043f047ba02bdc58a get_property(... ALIASED_TARGET ... SET) was failing printing "get_property unknown error". After that commit the property is always set, even when it should not be.
(0042854)
Kitware Robot   
2016-06-10 14:29   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.