qt-build-tools/6.5.1/_tools/cmake/share/cmake-3.16/Help/policy/CMP0008.rst

36 lines
1.5 KiB
ReStructuredText
Raw Normal View History

2023-11-01 06:11:15 +08:00
CMP0008
-------
Libraries linked by full-path must have a valid library file name.
In CMake 2.4 and below it is possible to write code like
::
target_link_libraries(myexe /full/path/to/somelib)
2023-11-01 06:20:22 +08:00
where ``somelib`` is supposed to be a valid library file name such as
``libsomelib.a`` or ``somelib.lib``. For Makefile generators this
2023-11-01 06:11:15 +08:00
produces an error at build time because the dependency on the full
2023-11-01 06:20:22 +08:00
path cannot be found. For :ref:`Visual Studio Generators` IDE
and :generator:`Xcode` generators this used to
2023-11-01 06:11:15 +08:00
work by accident because CMake would always split off the library
directory and ask the linker to search for the library by name
2023-11-01 06:20:22 +08:00
(``-lsomelib`` or ``somelib.lib``). Despite the failure with Makefiles, some
projects have code like this and build only with Visual Studio and/or Xcode.
2023-11-01 06:11:15 +08:00
This version of CMake prefers to pass the full path directly to the
native build tool, which will fail in this case because it does not
name a valid library file.
This policy determines what to do with full paths that do not appear
2023-11-01 06:20:22 +08:00
to name a valid library file. The ``OLD`` behavior for this policy is to
2023-11-01 06:11:15 +08:00
split the library name from the path and ask the linker to search for
2023-11-01 06:20:22 +08:00
it. The ``NEW`` behavior for this policy is to trust the given path and
2023-11-01 06:11:15 +08:00
pass it directly to the native build tool unchanged.
This policy was introduced in CMake version 2.6.1. CMake version
2023-11-01 06:20:22 +08:00
|release| warns when the policy is not set and uses ``OLD`` behavior. Use
the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly.
2023-11-01 06:11:15 +08:00
.. include:: DEPRECATED.txt