summaryrefslogtreecommitdiffstats
path: root/Help
diff options
context:
space:
mode:
authorMatt McCormick <matt.mccormick@kitware.com>2015-01-02 03:30:08 (GMT)
committerBrad King <brad.king@kitware.com>2015-01-26 15:05:26 (GMT)
commite2b1f0583f7293bce280dfab397e96acf8a5b26e (patch)
treed3bbabefbf6fb944f4f2ada8fd3a0765a7964879 /Help
parent07cbe3640e3afc879a07b6510de4c6e437f43f3e (diff)
downloadCMake-e2b1f0583f7293bce280dfab397e96acf8a5b26e.zip
CMake-e2b1f0583f7293bce280dfab397e96acf8a5b26e.tar.gz
CMake-e2b1f0583f7293bce280dfab397e96acf8a5b26e.tar.bz2
try_run: Add support for LINK_LIBRARIES option.
Most functionality is already implemented in Source/cmCoreTryCompile.{h,cxx}. Document and improve argument parsing. This functionality is already being used by a number of modules, like CheckCSourceCompiles.cmake, but it is not documented.
Diffstat (limited to 'Help')
-rw-r--r--Help/command/try_run.rst9
-rw-r--r--Help/release/dev/try-run-link-libraries.rst5
2 files changed, 13 insertions, 1 deletions
diff --git a/Help/command/try_run.rst b/Help/command/try_run.rst
index 9a17ad9..b8ea0fe 100644
--- a/Help/command/try_run.rst
+++ b/Help/command/try_run.rst
@@ -6,8 +6,9 @@ Try compiling and then running some code.
::
try_run(RUN_RESULT_VAR COMPILE_RESULT_VAR
- bindir srcfile [CMAKE_FLAGS <Flags>]
+ bindir srcfile [CMAKE_FLAGS <flags>]
[COMPILE_DEFINITIONS <flags>]
+ [LINK_LIBRARIES <libs>]
[COMPILE_OUTPUT_VARIABLE comp]
[RUN_OUTPUT_VARIABLE run]
[OUTPUT_VARIABLE var]
@@ -22,6 +23,12 @@ where the output from the compile step goes. RUN_OUTPUT_VARIABLE
specifies the variable where the output from the running executable
goes.
+The srcfile signature also accepts a LINK_LIBRARIES argument which may
+contain a list of libraries or IMPORTED targets which will be linked
+to in the generated project. If LINK_LIBRARIES is specified as a
+parameter to try_run, then any LINK_LIBRARIES passed as
+CMAKE_FLAGS will be ignored.
+
For compatibility reasons OUTPUT_VARIABLE is still supported, which
gives you the output from the compile and run step combined.
diff --git a/Help/release/dev/try-run-link-libraries.rst b/Help/release/dev/try-run-link-libraries.rst
new file mode 100644
index 0000000..4f20cbd
--- /dev/null
+++ b/Help/release/dev/try-run-link-libraries.rst
@@ -0,0 +1,5 @@
+try-run-link-libraries
+----------------------
+
+* The :command:`try_run` command learned to honor the ``LINK_LIBRARIES``
+ option just as :command:`try_compile` already does.