note-link-libraries-genex.rst 760 B

12345678910111213141516171819202122
  1. note-link-libraries-genex
  2. -------------------------
  3. * In CMake 3.0 the :command:`target_link_libraries` command
  4. accidentally began allowing unquoted arguments to use
  5. :manual:`generator expressions <cmake-generator-expressions(7)>`
  6. containing a (``;`` separated) list within them. For example::
  7. set(libs B C)
  8. target_link_libraries(A PUBLIC $<BUILD_INTERFACE:${libs}>)
  9. This is equivalent to writing::
  10. target_link_libraries(A PUBLIC $<BUILD_INTERFACE:B C>)
  11. and was never intended to work. It did not work in CMake 2.8.12.
  12. Such generator expressions should be in quoted arguments::
  13. set(libs B C)
  14. target_link_libraries(A PUBLIC "$<BUILD_INTERFACE:${libs}>")
  15. CMake 3.1 again requires the quotes for this to work correctly.