From 45aa03b97aeeb512264ac2bfbb2028330be254d1 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 1 Dec 2016 14:24:02 -0500 Subject: try_compile: Add options to specify language standards Give `try_compile` callers a way to control the `CXX_STANDARD`, `CXX_STANDARD_REQUIRED`, and `CXX_EXTENSIONS` properties of the generated test target (or the `C` equivalents) in order to compile a test source for a particular language standard. Issue: #16456 --- Help/command/try_compile.rst | 18 +++++++++++++++++- Help/release/dev/try_compile-lang-std.rst | 5 +++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 Help/release/dev/try_compile-lang-std.rst (limited to 'Help') diff --git a/Help/command/try_compile.rst b/Help/command/try_compile.rst index 7830deb910..3f16b638d6 100644 --- a/Help/command/try_compile.rst +++ b/Help/command/try_compile.rst @@ -35,7 +35,11 @@ Try Compiling Source Files [COMPILE_DEFINITIONS ...] [LINK_LIBRARIES ...] [OUTPUT_VARIABLE ] - [COPY_FILE [COPY_FILE_ERROR ]]) + [COPY_FILE [COPY_FILE_ERROR ]] + [_STANDARD ] + [_STANDARD_REQUIRED ] + [_EXTENSIONS ] + ) Try building an executable from one or more source files. The success or failure of the ``try_compile``, i.e. ``TRUE`` or ``FALSE`` respectively, is @@ -82,6 +86,18 @@ The options are: ``OUTPUT_VARIABLE `` Store the output from the build process the given variable. +``_STANDARD `` + Specify the :prop_tgt:`C_STANDARD` or :prop_tgt:`CXX_STANDARD` + target property of the generated project. + +``_STANDARD_REQUIRED `` + Specify the :prop_tgt:`C_STANDARD_REQUIRED` or + :prop_tgt:`CXX_STANDARD_REQUIRED` target property of the generated project. + +``_EXTENSIONS `` + Specify the :prop_tgt:`C_EXTENSIONS` or :prop_tgt:`CXX_EXTENSIONS` + target property of the generated project. + In this version all files in ``/CMakeFiles/CMakeTmp`` will be cleaned automatically. For debugging, ``--debug-trycompile`` can be passed to ``cmake`` to avoid this clean. However, multiple sequential diff --git a/Help/release/dev/try_compile-lang-std.rst b/Help/release/dev/try_compile-lang-std.rst new file mode 100644 index 0000000000..64d082b293 --- /dev/null +++ b/Help/release/dev/try_compile-lang-std.rst @@ -0,0 +1,5 @@ +try_compile-lang-std +-------------------- + +* The :command:`try_compile` command source file signature gained new options + to specify the language standard to use in the generated test project. -- cgit v1.2.1