try_compile: Add option to control type of target

Create a `CMAKE_TRY_COMPILE_TARGET_TYPE` option to specify use
of `add_library(... STATIC ...)` for the generated test project.
This will be useful for cross-compiling toolchains that cannot
link a binary without custom flags or scripts.
This commit is contained in:
Brad King
2016-02-19 13:23:48 -05:00
parent 509b1f08ea
commit 7f1bd9fe69
15 changed files with 136 additions and 15 deletions

View File

@@ -0,0 +1,15 @@
CMAKE_TRY_COMPILE_TARGET_TYPE
-----------------------------
Type of target generated for :command:`try_compile` calls using the
source file signature. Valid values are:
``EXECUTABLE``
Use :command:`add_executable` to name the source file in the
generated project. This is the default if no value is given.
``STATIC_LIBRARY``
Use :command:`add_library` with the ``STATIC`` option to name the
source file in the generated project. This avoids running the
linker and is intended for use with cross-compiling toolchains
that cannot link without custom flags or linker scripts.