CMP0008.rst 1.5 KB

123456789101112131415161718192021222324252627282930313233343536
  1. CMP0008
  2. -------
  3. .. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
  4. .. include:: include/REMOVED_PROLOGUE.rst
  5. Libraries linked by full-path must have a valid library file name.
  6. In CMake 2.4 and below it is possible to write code like
  7. .. code-block:: cmake
  8. target_link_libraries(myexe /full/path/to/somelib)
  9. where ``somelib`` is supposed to be a valid library file name such as
  10. ``libsomelib.a`` or ``somelib.lib``. For Makefile generators this
  11. produces an error at build time because the dependency on the full
  12. path cannot be found. For :ref:`Visual Studio Generators` IDE
  13. and :generator:`Xcode` generators this used to
  14. work by accident because CMake would always split off the library
  15. directory and ask the linker to search for the library by name
  16. (``-lsomelib`` or ``somelib.lib``). Despite the failure with Makefiles, some
  17. projects have code like this and build only with Visual Studio and/or Xcode.
  18. This version of CMake prefers to pass the full path directly to the
  19. native build tool, which will fail in this case because it does not
  20. name a valid library file.
  21. This policy determines what to do with full paths that do not appear
  22. to name a valid library file. The ``OLD`` behavior for this policy is to
  23. split the library name from the path and ask the linker to search for
  24. it. The ``NEW`` behavior for this policy is to trust the given path and
  25. pass it directly to the native build tool unchanged.
  26. .. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.6.1
  27. .. |WARNED_OR_DID_NOT_WARN| replace:: warned
  28. .. include:: include/REMOVED_EPILOGUE.rst