MantisBT - CMake
View Issue Details
0013829CMakeCMakepublic2013-01-03 13:262013-06-03 09:05
Alessio M. 
Stephen Kelly 
urgentblockalways
closedfixed 
win32Windows 7 64 bit
CMake 2.8.10.2 
CMake 2.8.11 
0013829: Internal error in add_custom_target crashes with $<TARGET_PROPERTY:tgt,prop>
The following CMakeLists.txt crashes CMake during generation

cmake_minimum_required(VERSION 2.8.10)
project(TestBug)
add_executable(test test.cpp)
add_custom_target(test2
    "some_bogus_custom_tool"
    $<TARGET_PROPERTY:test,INCLUDE_DIRECTORIES>
    $<TARGET_PROPERTY:test,COMPILE_DEFINITIONS>
    WORKING_DIRECTORY
    "${CMAKE_CURRENT_SOURCE_DIR}")

====== CMake output follows =======
Configuring done
CMake Internal Error (please report a bug):
  Missing cmGeneratorTarget instance!
CMake Internal Error (please report a bug):
  Missing cmGeneratorTarget instance!
Generating done
No tags attached.
7z cmake-generator-expression-bug.7z (26,695) 2013-01-03 13:26
https://public.kitware.com/Bug/file/4610/cmake-generator-expression-bug.7z
Issue History
2013-01-03 13:26Alessio M.New Issue
2013-01-03 13:26Alessio M.File Added: cmake-generator-expression-bug.7z
2013-01-03 13:59Brad KingAssigned To => Stephen Kelly
2013-01-03 13:59Brad KingStatusnew => assigned
2013-01-03 14:08Alessio M.Note Added: 0031966
2013-01-03 15:07Stephen KellyNote Added: 0031968
2013-01-09 12:53Stephen KellyStatusassigned => resolved
2013-01-09 12:53Stephen KellyFixed in Version => CMake 2.8.11
2013-01-09 12:53Stephen KellyResolutionopen => fixed
2013-06-03 09:05Robert MaynardNote Added: 0033184
2013-06-03 09:05Robert MaynardStatusresolved => closed

Notes
(0031966)
Alessio M.   
2013-01-03 14:08   
Probably related:
I also found the following sequence completely crashes cmake-gui.exe.

add_custom_target(${_name}_cppcheck)
    
set_target_properties(${_name}_cppcheck PROPERTIES
    COMPILE_DEFINITIONS $<TARGET_PROPERTY:${_name},COMPILE_DEFINITIONS>)

add_custom_command(TARGET ${_name}_cppcheck PRE_BUILD
    COMMAND "${CPPCHECK_EXECUTABLE}"
    $<TARGET_PROPERTY:COMPILE_DEFINITIONS>
    ${CPPCHECK_TEMPLATE_ARG}
    ${_cppcheck_args}
    ${_files}
    WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")

Basically I'm trying to create cppcheck targets for my cxx targets.
This requires using the COMPILE_DEFINITIONS and INCLUDE_DIRECTORIES properties of the original CXX target in the construction of cppcheck command lines.
(0031968)
Stephen Kelly   
2013-01-03 15:07   
Thanks for reporting. The first issue you raised was fixed as a side-effect of another commit. I added a test for the issue:

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=08bd86b85fb657a7e70b4147ebe0e14d9d825c22 [^]

The second issue you raise is separate, and a bug in the code. I've fixed it here:

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e767ffcda58ab73cf2c4394202eec7ae1f6035b5 [^]

Unfortunately, the error message does not appear to the user. The error reporting code is correct, but cmTargetTraceDependencies::CheckCustomCommand calls cmCompiledGeneratorExpression::Evaluate with quiet=true. Brad, any idea why it does that?

Thanks,

Steve.
(0033184)
Robert Maynard   
2013-06-03 09:05   
Closing resolved issues that have not been updated in more than 4 months.