Re: [cmake-developers] [CMake] [BUG] add_custom_command(TARGET ...) can't see in scope target
>> I haven't seen that documented anywhere. IMHO this >> behavior is counter-intuitive, in general I expect the scope of a >> target to not depend on the cmake command I am trying to use. > > > I think it is sensible that the definition of a target is scoped to one > single directory. > Where the definition of a target consists of e.g. sources, properties, > dependencies and custom commands related to the target. > > You can reference/query global targets in other directories but you can not > change them. It seems sensible from a safety standpoint (preventing targets from accidentally being modified from other directories) but it also limiting in that it prevents certain directory layouts (like the one I tried in my example). -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
Re: [cmake-developers] [CMake] [BUG] add_custom_command(TARGET ...) can't see in scope target
On 04.08.2015 23:15, Dan Liew wrote: foolib is defined in this CMakeLists.txt: https://github.com/delcypher/cmake_add_custom_command_bug/blob/master/lib/CMakeLists.txt That is the (only) context in which you can extend the definition of the target with custom commands. Since when? As far as I know it has always been this way. I haven't seen that documented anywhere. IMHO this behavior is counter-intuitive, in general I expect the scope of a target to not depend on the cmake command I am trying to use. I think it is sensible that the definition of a target is scoped to one single directory. Where the definition of a target consists of e.g. sources, properties, dependencies and custom commands related to the target. You can reference/query global targets in other directories but you can not change them. Nils -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
Re: [cmake-developers] [CMake] [BUG] add_custom_command(TARGET ...) can't see in scope target
For reference I've opened up a bug report http://www.cmake.org/Bug/view.php?id=15681 -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
Re: [cmake-developers] [CMake] [BUG] add_custom_command(TARGET ...) can't see in scope target
> foolib is defined in this CMakeLists.txt: > https://github.com/delcypher/cmake_add_custom_command_bug/blob/master/lib/CMakeLists.txt > > That is the (only) context in which you can extend the definition of the > target with custom commands. Since when? I haven't seen that documented anywhere. IMHO this behavior is counter-intuitive, in general I expect the scope of a target to not depend on the cmake command I am trying to use. Seeing as targets seem to be visible globally to all the commands (that I've used so far) it seems to reasonable to me to expect add_custom_command() to be able to see these targets too. -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
Re: [cmake-developers] [CMake] [BUG] add_custom_command(TARGET ...) can't see in scope target
On 04.08.2015 22:46, Dan Liew wrote: The target name "foolib" is unknown in this context. This warning is for project developers. Use -Wno-dev to suppress it ``` This doesn't make sense the target **clearly exists and is in scope** because the ``simple_test`` executable links against it and also it is possible to read properties of the target. Seems like there's some sort of weird scope issue going on here. foolib is defined in this CMakeLists.txt: https://github.com/delcypher/cmake_add_custom_command_bug/blob/master/lib/CMakeLists.txt That is the (only) context in which you can extend the definition of the target with custom commands. Nils -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers