summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/try_compile
diff options
context:
space:
mode:
authorRobert Maynard <rmaynard@nvidia.com>2022-08-31 14:14:29 (GMT)
committerRobert Maynard <rmaynard@nvidia.com>2022-09-07 19:08:41 (GMT)
commit0c141b0393de6fccbef5ab54e93c70720345ed92 (patch)
treecd9e71e56595f115868155c366e9aae0f517d73b /Tests/RunCMake/try_compile
parentecfc63a9b0e73b2c9525a4ba65ceb22759ab00fd (diff)
downloadCMake-0c141b0393de6fccbef5ab54e93c70720345ed92.zip
CMake-0c141b0393de6fccbef5ab54e93c70720345ed92.tar.gz
CMake-0c141b0393de6fccbef5ab54e93c70720345ed92.tar.bz2
try_compile: Record output location instead of reverse computing it
Fixes #23887, #23942, #20163, #18288
Diffstat (limited to 'Tests/RunCMake/try_compile')
-rw-r--r--Tests/RunCMake/try_compile/BuildType.cmake6
-rw-r--r--Tests/RunCMake/try_compile/BuildTypeAsFlag.cmake7
-rw-r--r--Tests/RunCMake/try_compile/OutputDirAsFlag.cmake7
-rw-r--r--Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake3
4 files changed, 23 insertions, 0 deletions
diff --git a/Tests/RunCMake/try_compile/BuildType.cmake b/Tests/RunCMake/try_compile/BuildType.cmake
new file mode 100644
index 0000000..f2709f8
--- /dev/null
+++ b/Tests/RunCMake/try_compile/BuildType.cmake
@@ -0,0 +1,6 @@
+enable_language(C)
+set(CMAKE_BUILD_TYPE RelWithDebInfo)
+
+try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+ COPY_FILE "${CMAKE_CURRENT_BINARY_DIR}/out.bin"
+ )
diff --git a/Tests/RunCMake/try_compile/BuildTypeAsFlag.cmake b/Tests/RunCMake/try_compile/BuildTypeAsFlag.cmake
new file mode 100644
index 0000000..e9384c7
--- /dev/null
+++ b/Tests/RunCMake/try_compile/BuildTypeAsFlag.cmake
@@ -0,0 +1,7 @@
+enable_language(C)
+set(CMAKE_BUILD_TYPE RelWithDebInfo)
+
+try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+ COPY_FILE "${CMAKE_CURRENT_BINARY_DIR}/out.bin"
+ CMAKE_FLAGS "-DCMAKE_BUILD_TYPE=Release"
+ )
diff --git a/Tests/RunCMake/try_compile/OutputDirAsFlag.cmake b/Tests/RunCMake/try_compile/OutputDirAsFlag.cmake
new file mode 100644
index 0000000..5c4dca5
--- /dev/null
+++ b/Tests/RunCMake/try_compile/OutputDirAsFlag.cmake
@@ -0,0 +1,7 @@
+enable_language(C)
+set(CMAKE_BUILD_TYPE RelWithDebInfo)
+
+try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+ COPY_FILE "${CMAKE_CURRENT_BINARY_DIR}/out.bin"
+ CMAKE_FLAGS "-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=bin"
+ )
diff --git a/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake b/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake
index e156e12..f80d445 100644
--- a/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake
+++ b/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake
@@ -11,6 +11,9 @@ run_cmake(BadSources2)
run_cmake(EmptyValueArgs)
run_cmake(EmptyListArgs)
run_cmake(TryRunArgs)
+run_cmake(BuildType)
+run_cmake(BuildTypeAsFlag)
+run_cmake(OutputDirAsFlag)
run_cmake(EnvConfig)