Notes |
|
(0041123)
|
Brad King
|
2016-06-02 09:37
|
|
|
|
(0041125)
|
Daniel Levin
|
2016-06-02 10:15
|
|
Unfortunately the code is a part of a big private project, I cannot share it, creating minimal example is not trivial.
Just checked the master branch (f1ff6301eafe61), crash is still there.
Please see the attached screen shot of debugger with call stack. It shows how exactly generator targets recreated from inside the TraceDependencies loop.
The patch gives overall idea how this issue can be fixed (in earlier version). |
|
|
(0041126)
|
Brad King
|
2016-06-02 10:36
|
|
Thanks. From the call stack I was able to construct a simple CMakeLists.txt file to reproduce the crash:
cmake_minimum_required(VERSION 2.8.12)
project(Issue16134 C)
add_executable(foo foo.c)
add_custom_target(drive COMMAND echo $<TARGET_PROPERTY:foo,LOCATION>)
I don't think this can happen without using the $<TARGET_PROPERTY> generator expression to read the LOCATION property. The LOCATION property should not be used anymore:
https://cmake.org/cmake/help/v3.6/policy/CMP0026.html [^]
You should be able to replace the genex with $<TARGET_FILE:foo> to avoid this in your project.
Meanwhile I will see about fixing the crash anyway. |
|
|
(0041127)
|
Brad King
|
2016-06-02 11:09
|
|
|
|
(0041129)
|
Daniel Levin
|
2016-06-02 11:58
|
|
Thanks Brad, you fix works for me. Do you plan to patch 3.4 and 3.5 as well? |
|
|
(0041130)
|
Brad King
|
2016-06-02 12:04
|
|
Re 0016134:0041129: Thanks for testing.
There will be no more 3.4 or 3.5 patch releases now that 3.6 is entering its release cycle.
Please change your project to avoid using the LOCATION property. We deprecated it long ago specifically because it needs generate-time information at configure time, leading to hacks like the one that caused this crash. We provide good alternatives for all known use cases. If you at least stop using $<TARGET_PROPERTY:...,LOCATION> and use $<TARGET_FILE:...> instead then your configuration will not crash with 3.4 or 3.5 either. |
|
|
(0041132)
|
Daniel Levin
|
2016-06-02 15:54
|
|
Yes, this was very old code in project, replaced LOCATION to TARGET_FILE in generator expressions as you suggested, now generation stage works correctly on the older CMake versions. Thanks for the quick fix Brad. |
|
|
(0041158)
|
Kitware Robot
|
2016-06-10 14:21
|
|
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. |
|