diff options
author | Matthew Woehlke <matthew.woehlke@kitware.com> | 2022-09-22 17:43:14 (GMT) |
---|---|---|
committer | Matthew Woehlke <matthew.woehlke@kitware.com> | 2022-09-22 18:56:50 (GMT) |
commit | 611d80179006ba6670273fcfcad46b0bb64a36c2 (patch) | |
tree | 1975420c55f72ce6e9beb22c80aeae18398ded6b /Tests/TryCompile/CMakeLists.txt | |
parent | a04eaf6742d98dd415ee939eae8c955c8afd1ce6 (diff) | |
download | CMake-611d80179006ba6670273fcfcad46b0bb64a36c2.zip CMake-611d80179006ba6670273fcfcad46b0bb64a36c2.tar.gz CMake-611d80179006ba6670273fcfcad46b0bb64a36c2.tar.bz2 |
try_compile: Add SOURCE_FROM_FILE
Add ability to copy try_compile (and try_run) source files from
arbitrary locations into the operation directory. This is included for
the sake of completion and consolidation, although use cases which
actually require this may be rare.
Diffstat (limited to 'Tests/TryCompile/CMakeLists.txt')
-rw-r--r-- | Tests/TryCompile/CMakeLists.txt | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt index cca19bc..9396cfa 100644 --- a/Tests/TryCompile/CMakeLists.txt +++ b/Tests/TryCompile/CMakeLists.txt @@ -89,6 +89,12 @@ if(SHOULD_FAIL_DUE_TO_EMPTY_SOURCE) message(SEND_ERROR "Trying to compile an empty source succeeded?") endif() +# try to compile a copied source +try_compile(SHOULD_PASS + SOURCE_FROM_FILE pass.c ${TryCompile_SOURCE_DIR}/pass.c + OUTPUT_VARIABLE TRY_OUT) +EXPECT_COMPILED("SOURCE_FROM_FILE" SHOULD_PASS "${TRY_OUT}") + # try to run a source specified directly set(TRY_RUN_MAIN_CODE "extern int answer(); \n" |