Re: [cmake-developers] Appending to LINK_FLAGS property of a target doesn't seem to work correctly
On 03/04/2016 12:42 PM, Dan Liew wrote: Thanks for this. Shouldn't the fact that ``LINK_FLAGS`` is a string property and not a list property be in the ``cmake-properties`` documentation? The version of the documentation for my version of CMake (3.4.3) doesn't say what the property type is. Perhaps though the plain string properties predate the list properties which is probably why the documentation does it the other way around e.g. https://cmake.org/cmake/help/v3.4/prop_dir/COMPILE_OPTIONS.html is documented explicitly as a list property. COMPILE_OPTIONS deprecated the old COMPILE_FLAGS property (which was plain string based). For LINK_FLAGS the same thing was supposed to happen at some point but the topic working on this seems to have stalled. 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] Appending to LINK_FLAGS property of a target doesn't seem to work correctly
On 3 March 2016 at 22:02, Nils Gladitz wrote: > On 03.03.2016 22:57, Dan Liew wrote: >> >> Hi, >> >> I noticed recently is you do something like this >> >> add_executable(foo a.cpp b.cpp) >> set_property(TARGET shell APPEND PROPERTY LINK_FLAGS "-fopenmp") >> set_property(TARGET shell APPEND PROPERTY LINK_FLAGS "-static") >> >> then the flags that end up being passed to the compiler during linking >> are like this. >> >> gcc -g -O0 -fopenmp;-static >> >> It looks like when using the property with APPEND it becomes a list >> but when emitted the list isn't expanded properly. I noticed this >> using CMake 3.4.3 using the "Unix Makefile" generator. >> >> Is this intentional or is this a bug? > > > LINK_FLAGS is not a list property; flags have to be whitespace separated. > You can use APPEND_STRING instead of APPEND for this. Thanks for this. Shouldn't the fact that ``LINK_FLAGS`` is a string property and not a list property be in the ``cmake-properties`` documentation? The version of the documentation for my version of CMake (3.4.3) doesn't say what the property type is. Thanks, Dan. -- 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] Appending to LINK_FLAGS property of a target doesn't seem to work correctly
On 03.03.2016 22:57, Dan Liew wrote: Hi, I noticed recently is you do something like this add_executable(foo a.cpp b.cpp) set_property(TARGET shell APPEND PROPERTY LINK_FLAGS "-fopenmp") set_property(TARGET shell APPEND PROPERTY LINK_FLAGS "-static") then the flags that end up being passed to the compiler during linking are like this. gcc -g -O0 -fopenmp;-static It looks like when using the property with APPEND it becomes a list but when emitted the list isn't expanded properly. I noticed this using CMake 3.4.3 using the "Unix Makefile" generator. Is this intentional or is this a bug? LINK_FLAGS is not a list property; flags have to be whitespace separated. You can use APPEND_STRING instead of APPEND for this. 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