implemented a new localPassc pragma (#12706)

This commit is contained in:
Andreas Rumpf 2019-11-22 14:20:15 +01:00 • committed by GitHub
commit 64e8f050e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 48 additions and 12 deletions

View file

@ -6560,18 +6560,31 @@ The ``link`` pragma can be used to link an additional file with the project:
PassC pragma
------------
The ``passC`` pragma can be used to pass additional parameters to the C
compiler like you would using the commandline switch ``--passC``:
The ``passc`` pragma can be used to pass additional parameters to the C
compiler like you would using the commandline switch ``--passc``:
.. code-block:: Nim
{.passC: "-Wall -Werror".}
{.passc: "-Wall -Werror".}
Note that you can use ``gorge`` from the `system module <system.html>`_ to
embed parameters from an external command that will be executed
during semantic analysis:
.. code-block:: Nim
{.passC: gorge("pkg-config --cflags sdl").}
{.passc: gorge("pkg-config --cflags sdl").}
LocalPassc pragma
-----------------
The ``localPassc`` pragma can be used to pass additional parameters to the C
compiler, but only for the C/C++ file that is produced from the Nim module
the pragma resides in:
.. code-block:: Nim
# Module A.nim
# Produces: A.nim.cpp
{.localPassc: "-Wall -Werror".} # Passed when compiling A.nim.cpp
PassL pragma
------------