Skip to content

Commit

Permalink
Add tools.build:linker_scripts conf variable (#2887)
Browse files Browse the repository at this point in the history
* Add tools.build:linker_scripts conf variable

* Add caveat for linker support
  • Loading branch information
jwillikers authored Jan 11, 2023
1 parent 04d0b1a commit 02f5949
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions reference/conanfile/tools/cmake/cmaketoolchain.rst
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,9 @@ conf
- ``tools.build:sharedlinkflags`` list of extra linker flags that will be appended to ``CMAKE_SHARED_LINKER_FLAGS_INIT``.
- ``tools.build:exelinkflags`` list of extra linker flags that will be appended to ``CMAKE_EXE_LINKER_FLAGS_INIT``.
- ``tools.build:defines`` list of preprocessor definitions that will be used by ``add_definitions()``.
- ``tools.build:linker_scripts`` list of linker scripts, each of which will be prepended with ``-T`` and appended to
``CMAKE_EXE_LINKER_FLAGS_INIT``. Only use this flag with linkers that supports specifying linker scripts with the ``-T`` flag, such as
``ld``, ``gold``, and ``lld``.
- ``tools.build:tools.apple:enable_bitcode`` boolean value to enable/disable Bitcode Apple Clang flags, e.g., ``CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE``.
- ``tools.build:tools.apple:enable_arc`` boolean value to enable/disable ARC Apple Clang flags, e.g., ``CMAKE_XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC``.
- ``tools.build:tools.apple:enable_visibility`` boolean value to enable/disable Visibility Apple Clang flags, e.g., ``CMAKE_XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN``.
Expand Down Expand Up @@ -410,6 +413,7 @@ The following predefined blocks are available, and added in this order:
- ``apple_system``: Defines ``CMAKE_OSX_ARCHITECTURES``, ``CMAKE_OSX_SYSROOT`` for Apple systems.
- ``fpic``: Defines the ``CMAKE_POSITION_INDEPENDENT_CODE`` when there is a ``options.fPIC``
- ``arch_flags``: Defines C/C++ flags like ``-m32, -m64`` when necessary.
- ``linker_scripts``: Defines the flags for any provided linker scripts.
- ``libcxx``: Defines ``-stdlib=libc++`` flag when necessary as well as ``_GLIBCXX_USE_CXX11_ABI``.
- ``vs_runtime``: Defines the ``CMAKE_MSVC_RUNTIME_LIBRARY`` variable, as a generator expression for multiple configurations.
- ``cppstd``: defines ``CMAKE_CXX_STANDARD``, ``CMAKE_CXX_EXTENSIONS``
Expand Down
4 changes: 3 additions & 1 deletion reference/conanfile/tools/gnu/autotoolstoolchain.rst
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,9 @@ conf
- ``tools.build:cxxflags`` list of extra C++ flags that will be used by ``CXXFLAGS``.
- ``tools.build:cflags`` list of extra of pure C flags that will be used by ``CFLAGS``.
- ``tools.build:sharedlinkflags`` list of extra linker flags that will be used by ``LDFLAGS``.
- ``tools.build:exelinkflags`` list of extra linker flags that will be used by by ``LDFLAGS``.
- ``tools.build:exelinkflags`` list of extra linker flags that will be used by ``LDFLAGS``.
- ``tools.build:linker_scripts`` list of linker scripts, each of which will be prefixed with ``-T`` and added to ``LDFLAGS``.
Only use this flag with linkers that supports specifying linker scripts with the ``-T`` flag, such as ``ld``, ``gold``, and ``lld``.
- ``tools.build:defines`` list of preprocessor definitions that will be used by ``CPPFLAGS``.
- ``tools.build:sysroot`` defines the ``--sysroot`` flag to the compiler.
- ``tools.build:compiler_executables`` (new in version 1.55) dict-like Python object which specifies the compiler as key
Expand Down
3 changes: 3 additions & 0 deletions reference/conanfile/tools/meson/mesontoolchain.rst
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ Apart from that, since Conan 1.47, you can inject extra flags thanks to these on
- ``tools.build:cflags`` list of extra of pure C flags that will be used by ``c_args``.
- ``tools.build:sharedlinkflags`` list of extra linker flags that will be used by ``c_link_args`` and ``cpp_link_args``.
- ``tools.build:exelinkflags`` list of extra linker flags that will be used by ``c_link_args`` and ``cpp_link_args``.
- ``tools.build:linker_scripts`` list of linker scripts, each of which will be prefixed with ``-T`` and passed to ``c_link_args`` and
``cpp_link_args``. Only use this flag with linkers that supports specifying linker scripts with the ``-T`` flag, such as ``ld``, ``gold``,
and ``lld``.
- ``tools.build:compiler_executables`` (new in version 1.55) dict-like Python object which specifies the compiler as key
and the compiler executable path as value. Those keys will be mapped as follows:

Expand Down
1 change: 1 addition & 0 deletions reference/config_files/global_conf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ To list all possible configurations available, run :command:`conan config list`.
tools.build:defines: List of extra definition flags used by different toolchains like CMakeToolchain and AutotoolsToolchain
tools.build:exelinkflags: List of extra flags used by CMakeToolchain for CMAKE_EXE_LINKER_FLAGS_INIT variable
tools.build:jobs: Default compile jobs number -jX Ninja, Make, /MP VS (default: max CPUs)
tools.build:linker_scripts: List of linker scripts used by different toolchains like CMakeToolchain, AutotoolsToolchain and MesonToolchain
tools.build:sharedlinkflags: List of extra flags used by CMakeToolchain for CMAKE_SHARED_LINKER_FLAGS_INIT variable
tools.build:skip_test: Do not execute CMake.test() and Meson.test() when enabled
tools.build:sysroot: Pass the --sysroot=<tools.build:sysroot> flag if available. (None by default)
Expand Down

0 comments on commit 02f5949

Please sign in to comment.