summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/try_compile
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-09-07 14:42:52 (GMT)
committerKitware Robot <kwrobot@kitware.com>2022-09-07 14:43:14 (GMT)
commitecfc63a9b0e73b2c9525a4ba65ceb22759ab00fd (patch)
tree52b87b02b7b422227ad07148857ad8dedab46636 /Tests/RunCMake/try_compile
parenta64aa9bd300b2df2441d8e07ec3e2afe3069b04e (diff)
parentaa9220d3a0c4a5b15a9a590ed75afedff38764fe (diff)
downloadCMake-ecfc63a9b0e73b2c9525a4ba65ceb22759ab00fd.zip
CMake-ecfc63a9b0e73b2c9525a4ba65ceb22759ab00fd.tar.gz
CMake-ecfc63a9b0e73b2c9525a4ba65ceb22759ab00fd.tar.bz2
Merge topic 'try_compile-unique-bindir'
aa9220d3a0 try_compile: Add keyword-dispatched signature d1befe5515 cmSystemTools: Add MakeTempDirectory Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Acked-by: Matthew Woehlke <matthew.woehlke@kitware.com> Merge-request: !7579
Diffstat (limited to 'Tests/RunCMake/try_compile')
-rw-r--r--Tests/RunCMake/try_compile/BadLinkLibraries-stderr.txt2
-rw-r--r--Tests/RunCMake/try_compile/BadLinkLibraries.cmake6
-rw-r--r--Tests/RunCMake/try_compile/BadSources1-stderr.txt2
-rw-r--r--Tests/RunCMake/try_compile/BadSources1.cmake4
-rw-r--r--Tests/RunCMake/try_compile/BadSources2-stderr.txt2
-rw-r--r--Tests/RunCMake/try_compile/BadSources2.cmake7
-rw-r--r--Tests/RunCMake/try_compile/CStandard-stderr.txt2
-rw-r--r--Tests/RunCMake/try_compile/CStandard.cmake8
-rw-r--r--Tests/RunCMake/try_compile/CStandardGNU.cmake15
-rw-r--r--Tests/RunCMake/try_compile/CStandardNoDefault.cmake8
-rw-r--r--Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile-stderr.txt2
-rw-r--r--Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile.cmake4
-rw-r--r--Tests/RunCMake/try_compile/CudaStandard-stderr.txt2
-rw-r--r--Tests/RunCMake/try_compile/CudaStandard.cmake8
-rw-r--r--Tests/RunCMake/try_compile/CxxStandard-stderr.txt6
-rw-r--r--Tests/RunCMake/try_compile/CxxStandard.cmake8
-rw-r--r--Tests/RunCMake/try_compile/CxxStandardGNU.cmake15
-rw-r--r--Tests/RunCMake/try_compile/CxxStandardNoDefault.cmake8
-rw-r--r--Tests/RunCMake/try_compile/EmptyListArgs.cmake5
-rw-r--r--Tests/RunCMake/try_compile/EmptyValueArgs.cmake7
-rw-r--r--Tests/RunCMake/try_compile/EnvConfig.cmake6
-rw-r--r--Tests/RunCMake/try_compile/ISPCDuplicateTarget.cmake12
-rw-r--r--Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja.cmake13
-rw-r--r--Tests/RunCMake/try_compile/ISPCInvalidTarget.cmake9
-rw-r--r--Tests/RunCMake/try_compile/ISPCTargets.cmake9
-rw-r--r--Tests/RunCMake/try_compile/NoArgs-stderr.txt2
-rw-r--r--Tests/RunCMake/try_compile/NoCStandard-stderr.txt2
-rw-r--r--Tests/RunCMake/try_compile/NoCStandard.cmake4
-rw-r--r--Tests/RunCMake/try_compile/NoCopyFile-stderr.txt2
-rw-r--r--Tests/RunCMake/try_compile/NoCopyFile.cmake4
-rw-r--r--Tests/RunCMake/try_compile/NoCopyFile2-stderr.txt2
-rw-r--r--Tests/RunCMake/try_compile/NoCopyFile2.cmake4
-rw-r--r--Tests/RunCMake/try_compile/NoCopyFileError-stderr.txt2
-rw-r--r--Tests/RunCMake/try_compile/NoCopyFileError.cmake4
-rw-r--r--Tests/RunCMake/try_compile/NoOutputVariable-stderr.txt2
-rw-r--r--Tests/RunCMake/try_compile/NoOutputVariable.cmake4
-rw-r--r--Tests/RunCMake/try_compile/NoOutputVariable2-stderr.txt2
-rw-r--r--Tests/RunCMake/try_compile/NoOutputVariable2.cmake4
-rw-r--r--Tests/RunCMake/try_compile/NoSources-stderr.txt2
-rw-r--r--Tests/RunCMake/try_compile/NonSourceCompileDefinitions-stderr.txt2
-rw-r--r--Tests/RunCMake/try_compile/NonSourceCopyFile-stderr.txt2
-rw-r--r--Tests/RunCMake/try_compile/ObjCStandard-stderr.txt2
-rw-r--r--Tests/RunCMake/try_compile/ObjCStandard.cmake8
-rw-r--r--Tests/RunCMake/try_compile/ObjCxxStandard-stderr.txt2
-rw-r--r--Tests/RunCMake/try_compile/ObjCxxStandard.cmake8
-rw-r--r--Tests/RunCMake/try_compile/OneArg-stderr.txt2
-rw-r--r--Tests/RunCMake/try_compile/RunCMakeTest.cmake65
-rw-r--r--Tests/RunCMake/try_compile/TargetTypeExe.cmake10
-rw-r--r--Tests/RunCMake/try_compile/TargetTypeInvalid-stderr.txt2
-rw-r--r--Tests/RunCMake/try_compile/TargetTypeInvalid.cmake6
-rw-r--r--Tests/RunCMake/try_compile/TargetTypeStatic.cmake10
-rw-r--r--Tests/RunCMake/try_compile/TryRunArgs.cmake5
-rw-r--r--Tests/RunCMake/try_compile/TwoArgs-stderr.txt2
-rw-r--r--Tests/RunCMake/try_compile/new_signature.cmake2
-rw-r--r--Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake54
-rw-r--r--Tests/RunCMake/try_compile/old_signature.cmake2
56 files changed, 258 insertions, 136 deletions
diff --git a/Tests/RunCMake/try_compile/BadLinkLibraries-stderr.txt b/Tests/RunCMake/try_compile/BadLinkLibraries-stderr.txt
index 652bcfc..4e41a19 100644
--- a/Tests/RunCMake/try_compile/BadLinkLibraries-stderr.txt
+++ b/Tests/RunCMake/try_compile/BadLinkLibraries-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at BadLinkLibraries.cmake:2 \(try_compile\):
+CMake Error at BadLinkLibraries.cmake:[0-9]+ \(try_compile\):
Only libraries may be used as try_compile or try_run IMPORTED
LINK_LIBRARIES. Got not_a_library of type UTILITY.
Call Stack \(most recent call first\):
diff --git a/Tests/RunCMake/try_compile/BadLinkLibraries.cmake b/Tests/RunCMake/try_compile/BadLinkLibraries.cmake
index e8b5add..b758e23 100644
--- a/Tests/RunCMake/try_compile/BadLinkLibraries.cmake
+++ b/Tests/RunCMake/try_compile/BadLinkLibraries.cmake
@@ -1,3 +1,7 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
add_custom_target(not_a_library)
-try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+
+try_compile(RESULT ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.c
LINK_LIBRARIES not_a_library)
diff --git a/Tests/RunCMake/try_compile/BadSources1-stderr.txt b/Tests/RunCMake/try_compile/BadSources1-stderr.txt
index 864a294..ddcba4f 100644
--- a/Tests/RunCMake/try_compile/BadSources1-stderr.txt
+++ b/Tests/RunCMake/try_compile/BadSources1-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at BadSources1.cmake:1 \(try_compile\):
+CMake Error at BadSources1.cmake:[0-9]+ \(try_compile\):
Unknown extension ".c" for file
.*/Tests/RunCMake/try_compile/src.c
diff --git a/Tests/RunCMake/try_compile/BadSources1.cmake b/Tests/RunCMake/try_compile/BadSources1.cmake
index aa4dc5e..c95935d 100644
--- a/Tests/RunCMake/try_compile/BadSources1.cmake
+++ b/Tests/RunCMake/try_compile/BadSources1.cmake
@@ -1 +1,3 @@
-try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.c)
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+try_compile(RESULT ${try_compile_bindir_or_SOURCES}
+ ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.c)
diff --git a/Tests/RunCMake/try_compile/BadSources2-stderr.txt b/Tests/RunCMake/try_compile/BadSources2-stderr.txt
index 3313f99..953dd9c 100644
--- a/Tests/RunCMake/try_compile/BadSources2-stderr.txt
+++ b/Tests/RunCMake/try_compile/BadSources2-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at BadSources2.cmake:2 \(try_compile\):
+CMake Error at BadSources2.cmake:[0-9]+ \(try_compile\):
Unknown extension ".cxx" for file
.*/Tests/RunCMake/try_compile/src.cxx
diff --git a/Tests/RunCMake/try_compile/BadSources2.cmake b/Tests/RunCMake/try_compile/BadSources2.cmake
index ed2b036..3f22bb6 100644
--- a/Tests/RunCMake/try_compile/BadSources2.cmake
+++ b/Tests/RunCMake/try_compile/BadSources2.cmake
@@ -1,5 +1,6 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
enable_language(C)
-try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR}
- SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.c
- ${CMAKE_CURRENT_SOURCE_DIR}/src.cxx
+try_compile(RESULT ${try_compile_bindir_or_SOURCES}
+ ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.cxx
)
diff --git a/Tests/RunCMake/try_compile/CStandard-stderr.txt b/Tests/RunCMake/try_compile/CStandard-stderr.txt
index 209afcc..c3c48a1 100644
--- a/Tests/RunCMake/try_compile/CStandard-stderr.txt
+++ b/Tests/RunCMake/try_compile/CStandard-stderr.txt
@@ -1,4 +1,4 @@
-^CMake Error at .*/Tests/RunCMake/try_compile/CStandard-build/CMakeFiles/CMakeTmp/CMakeLists.txt:[0-9]+ \(add_executable\):
+^CMake Error at .*/Tests/RunCMake/try_compile/CStandard-build/CMakeFiles/CMake(Tmp|Scratch/TryCompile-[^/]+)/CMakeLists.txt:[0-9]+ \(add_executable\):
C_STANDARD is set to invalid value '3'
+
CMake Error at CStandard.cmake:[0-9]+ \(try_compile\):
diff --git a/Tests/RunCMake/try_compile/CStandard.cmake b/Tests/RunCMake/try_compile/CStandard.cmake
index 2849ed4..6ac04db 100644
--- a/Tests/RunCMake/try_compile/CStandard.cmake
+++ b/Tests/RunCMake/try_compile/CStandard.cmake
@@ -1,7 +1,11 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
enable_language(C)
-try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
- SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
C_STANDARD 3
OUTPUT_VARIABLE out
)
+
message("try_compile output:\n${out}")
diff --git a/Tests/RunCMake/try_compile/CStandardGNU.cmake b/Tests/RunCMake/try_compile/CStandardGNU.cmake
index 79ae874..10a4384 100644
--- a/Tests/RunCMake/try_compile/CStandardGNU.cmake
+++ b/Tests/RunCMake/try_compile/CStandardGNU.cmake
@@ -1,23 +1,30 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
enable_language(C)
-try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
- SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CStandardGNU.c
+
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/CStandardGNU.c
C_STANDARD 99
C_STANDARD_REQUIRED 1
C_EXTENSIONS 0
OUTPUT_VARIABLE out
)
+
if(NOT result)
message(FATAL_ERROR "try_compile failed:\n${out}")
endif()
cmake_policy(SET CMP0067 NEW)
+
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED 1)
set(CMAKE_C_EXTENSIONS 0)
-try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
- SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CStandardGNU.c
+
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/CStandardGNU.c
OUTPUT_VARIABLE out
)
+
if(NOT result)
message(FATAL_ERROR "try_compile failed:\n${out}")
endif()
diff --git a/Tests/RunCMake/try_compile/CStandardNoDefault.cmake b/Tests/RunCMake/try_compile/CStandardNoDefault.cmake
index 97e72ea..f4dd5ae 100644
--- a/Tests/RunCMake/try_compile/CStandardNoDefault.cmake
+++ b/Tests/RunCMake/try_compile/CStandardNoDefault.cmake
@@ -1,9 +1,13 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
enable_language(C)
-try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
- SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
C_STANDARD 3 # bogus, but not used
OUTPUT_VARIABLE out
)
+
if(NOT result)
message(FATAL_ERROR "try_compile failed:\n${out}")
endif()
diff --git a/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile-stderr.txt b/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile-stderr.txt
index 5d09c0c..8c49302 100644
--- a/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile-stderr.txt
+++ b/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at CopyFileErrorNoCopyFile.cmake:1 \(try_compile\):
+CMake Error at CopyFileErrorNoCopyFile.cmake:[0-9]+ \(try_compile\):
COPY_FILE_ERROR may be used only with COPY_FILE
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile.cmake b/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile.cmake
index 8d7cb0e..8d15b3d 100644
--- a/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile.cmake
+++ b/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile.cmake
@@ -1,2 +1,4 @@
-try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+try_compile(RESULT ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.c
COPY_FILE_ERROR _copied)
diff --git a/Tests/RunCMake/try_compile/CudaStandard-stderr.txt b/Tests/RunCMake/try_compile/CudaStandard-stderr.txt
index bcf95d5..52dff8f 100644
--- a/Tests/RunCMake/try_compile/CudaStandard-stderr.txt
+++ b/Tests/RunCMake/try_compile/CudaStandard-stderr.txt
@@ -1,4 +1,4 @@
-^CMake Error at .*/Tests/RunCMake/try_compile/CudaStandard-build/CMakeFiles/CMakeTmp/CMakeLists.txt:[0-9]+ \(add_executable\):
+^CMake Error at .*/Tests/RunCMake/try_compile/CudaStandard-build/CMakeFiles/CMake(Tmp|Scratch/TryCompile-[^/]+)/CMakeLists.txt:[0-9]+ \(add_executable\):
CUDA_STANDARD is set to invalid value '4'
+
CMake Error at CudaStandard.cmake:[0-9]+ \(try_compile\):
diff --git a/Tests/RunCMake/try_compile/CudaStandard.cmake b/Tests/RunCMake/try_compile/CudaStandard.cmake
index a230424..0be89be 100644
--- a/Tests/RunCMake/try_compile/CudaStandard.cmake
+++ b/Tests/RunCMake/try_compile/CudaStandard.cmake
@@ -1,7 +1,11 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
enable_language(CUDA)
-try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
- SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.cu
+
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.cu
CUDA_STANDARD 4
OUTPUT_VARIABLE out
)
+
message("try_compile output:\n${out}")
diff --git a/Tests/RunCMake/try_compile/CxxStandard-stderr.txt b/Tests/RunCMake/try_compile/CxxStandard-stderr.txt
index cee1b44..55a06e2 100644
--- a/Tests/RunCMake/try_compile/CxxStandard-stderr.txt
+++ b/Tests/RunCMake/try_compile/CxxStandard-stderr.txt
@@ -1,13 +1,13 @@
-^(CMake Error in .*/Tests/RunCMake/try_compile/CxxStandard-build/CMakeFiles/CMakeTmp/CMakeLists.txt:
+^(CMake Error in .*/Tests/RunCMake/try_compile/CxxStandard-build/CMakeFiles/CMake(Tmp|Scratch/TryCompile-[^/]+)/CMakeLists.txt:
The CXX_STANDARD property on target "cmTC_[0-9a-f]*" contained an invalid
value: "3".
-)?CMake Error at .*/Tests/RunCMake/try_compile/CxxStandard-build/CMakeFiles/CMakeTmp/CMakeLists.txt:[0-9]+ \(add_executable\):
+)?CMake Error at .*/Tests/RunCMake/try_compile/CxxStandard-build/CMakeFiles/CMake(Tmp|Scratch/TryCompile-[^/]+)/CMakeLists.txt:[0-9]+ \(add_executable\):
CXX_STANDARD is set to invalid value '3'
(
-CMake Error in .*/Tests/RunCMake/try_compile/CxxStandard-build/CMakeFiles/CMakeTmp/CMakeLists.txt:
+CMake Error in .*/Tests/RunCMake/try_compile/CxxStandard-build/CMakeFiles/CMake(Tmp|Scratch/TryCompile-[^/]+)/CMakeLists.txt:
The CXX_STANDARD property on target "cmTC_[0-9a-f]*" contained an invalid
value: "3".
diff --git a/Tests/RunCMake/try_compile/CxxStandard.cmake b/Tests/RunCMake/try_compile/CxxStandard.cmake
index bcb49b9..e5b4e78 100644
--- a/Tests/RunCMake/try_compile/CxxStandard.cmake
+++ b/Tests/RunCMake/try_compile/CxxStandard.cmake
@@ -1,7 +1,11 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
enable_language(CXX)
-try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
- SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.cxx
+
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.cxx
CXX_STANDARD 3
OUTPUT_VARIABLE out
)
+
message("try_compile output:\n${out}")
diff --git a/Tests/RunCMake/try_compile/CxxStandardGNU.cmake b/Tests/RunCMake/try_compile/CxxStandardGNU.cmake
index e714fe4..552d99d 100644
--- a/Tests/RunCMake/try_compile/CxxStandardGNU.cmake
+++ b/Tests/RunCMake/try_compile/CxxStandardGNU.cmake
@@ -1,23 +1,30 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
enable_language(CXX)
-try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
- SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CxxStandardGNU.cxx
+
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/CxxStandardGNU.cxx
CXX_STANDARD 11
CXX_STANDARD_REQUIRED 1
CXX_EXTENSIONS 0
OUTPUT_VARIABLE out
)
+
if(NOT result)
message(FATAL_ERROR "try_compile failed:\n${out}")
endif()
cmake_policy(SET CMP0067 NEW)
+
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED 1)
set(CMAKE_CXX_EXTENSIONS 0)
-try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
- SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CxxStandardGNU.cxx
+
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/CxxStandardGNU.cxx
OUTPUT_VARIABLE out
)
+
if(NOT result)
message(FATAL_ERROR "try_compile failed:\n${out}")
endif()
diff --git a/Tests/RunCMake/try_compile/CxxStandardNoDefault.cmake b/Tests/RunCMake/try_compile/CxxStandardNoDefault.cmake
index 35caa9d..e0ebfee 100644
--- a/Tests/RunCMake/try_compile/CxxStandardNoDefault.cmake
+++ b/Tests/RunCMake/try_compile/CxxStandardNoDefault.cmake
@@ -1,9 +1,13 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
enable_language(CXX)
-try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
- SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.cxx
+
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.cxx
CXX_STANDARD 3 # bogus, but not used
OUTPUT_VARIABLE out
)
+
if(NOT result)
message(FATAL_ERROR "try_compile failed:\n${out}")
endif()
diff --git a/Tests/RunCMake/try_compile/EmptyListArgs.cmake b/Tests/RunCMake/try_compile/EmptyListArgs.cmake
index eed7ee4..5cd7465 100644
--- a/Tests/RunCMake/try_compile/EmptyListArgs.cmake
+++ b/Tests/RunCMake/try_compile/EmptyListArgs.cmake
@@ -1,6 +1,9 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
enable_language(C)
-try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+try_compile(RESULT ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.c
CMAKE_FLAGS # no values
COMPILE_DEFINITIONS # no values
LINK_LIBRARIES # no values
diff --git a/Tests/RunCMake/try_compile/EmptyValueArgs.cmake b/Tests/RunCMake/try_compile/EmptyValueArgs.cmake
index f564abc..fda4f10 100644
--- a/Tests/RunCMake/try_compile/EmptyValueArgs.cmake
+++ b/Tests/RunCMake/try_compile/EmptyValueArgs.cmake
@@ -1,4 +1,7 @@
-try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+try_compile(RESULT ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.c
COPY_FILE "")
-try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+try_compile(RESULT ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.c
COPY_FILE "x" COPY_FILE_ERROR "")
diff --git a/Tests/RunCMake/try_compile/EnvConfig.cmake b/Tests/RunCMake/try_compile/EnvConfig.cmake
index 4040c59..6e66825 100644
--- a/Tests/RunCMake/try_compile/EnvConfig.cmake
+++ b/Tests/RunCMake/try_compile/EnvConfig.cmake
@@ -1,3 +1,5 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
enable_language(C)
set(ENV{CMAKE_BUILD_TYPE} "Bad")
@@ -6,8 +8,8 @@ set(ENV{CMAKE_CONFIGURATION_TYPES} "Bad;Debug")
add_library(tc_defs INTERFACE IMPORTED)
target_compile_definitions(tc_defs INTERFACE "TC_CONFIG_$<UPPER_CASE:$<CONFIG>>")
-try_compile(ENV_CONFIG_RESULT "${CMAKE_BINARY_DIR}"
- SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/EnvConfig.c"
+try_compile(ENV_CONFIG_RESULT "${try_compile_bindir_or_SOURCES}"
+ ${try_compile_redundant_SOURCES} "${CMAKE_CURRENT_SOURCE_DIR}/EnvConfig.c"
COPY_FILE "${CMAKE_CURRENT_BINARY_DIR}/EnvConfig.bin"
OUTPUT_VARIABLE tc_output
LINK_LIBRARIES tc_defs
diff --git a/Tests/RunCMake/try_compile/ISPCDuplicateTarget.cmake b/Tests/RunCMake/try_compile/ISPCDuplicateTarget.cmake
index 6d29069..1ead4c2 100644
--- a/Tests/RunCMake/try_compile/ISPCDuplicateTarget.cmake
+++ b/Tests/RunCMake/try_compile/ISPCDuplicateTarget.cmake
@@ -1,8 +1,12 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
enable_language(ISPC)
-set(CMAKE_ISPC_INSTRUCTION_SETS avx512skx-i32x16
- avx512skx-i32x16)
-try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
- SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc
+
+set(CMAKE_ISPC_INSTRUCTION_SETS avx512skx-i32x16 avx512skx-i32x16)
+
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc
OUTPUT_VARIABLE out
)
+
message("try_compile output:\n${out}")
diff --git a/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja.cmake b/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja.cmake
index 7f59c14..e08e25f 100644
--- a/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja.cmake
+++ b/Tests/RunCMake/try_compile/ISPCDuplicateTargetNinja.cmake
@@ -1,11 +1,16 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
enable_language(ISPC)
-set(CMAKE_ISPC_INSTRUCTION_SETS avx512skx-i32x16
- avx512skx-i32x16)
-try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
- SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc
+
+set(CMAKE_ISPC_INSTRUCTION_SETS avx512skx-i32x16 avx512skx-i32x16)
+
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc
OUTPUT_VARIABLE out
)
+
message("try_compile output:\n${out}")
+
if(NOT result)
message(FATAL_ERROR "making Ninja and Ninja Multi-Config behave the same")
endif()
diff --git a/Tests/RunCMake/try_compile/ISPCInvalidTarget.cmake b/Tests/RunCMake/try_compile/ISPCInvalidTarget.cmake
index c1ab6f2..2276bd3 100644
--- a/Tests/RunCMake/try_compile/ISPCInvalidTarget.cmake
+++ b/Tests/RunCMake/try_compile/ISPCInvalidTarget.cmake
@@ -1,7 +1,12 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
enable_language(ISPC)
+
set(CMAKE_ISPC_INSTRUCTION_SETS "avxknl-i32x16")
-try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
- SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc
+
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc
OUTPUT_VARIABLE out
)
+
message("try_compile output:\n${out}")
diff --git a/Tests/RunCMake/try_compile/ISPCTargets.cmake b/Tests/RunCMake/try_compile/ISPCTargets.cmake
index 0d3bd43..bd45569 100644
--- a/Tests/RunCMake/try_compile/ISPCTargets.cmake
+++ b/Tests/RunCMake/try_compile/ISPCTargets.cmake
@@ -1,7 +1,12 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
enable_language(ISPC)
+
set(CMAKE_ISPC_INSTRUCTION_SETS avx512knl-i32x16 avx512skx-i32x16)
-try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
- SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc
+
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.ispc
OUTPUT_VARIABLE out
)
+
message("try_compile output:\n${out}")
diff --git a/Tests/RunCMake/try_compile/NoArgs-stderr.txt b/Tests/RunCMake/try_compile/NoArgs-stderr.txt
index 8808fd1..72a697e 100644
--- a/Tests/RunCMake/try_compile/NoArgs-stderr.txt
+++ b/Tests/RunCMake/try_compile/NoArgs-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at NoArgs.cmake:1 \(try_compile\):
+CMake Error at NoArgs.cmake:[0-9]+ \(try_compile\):
try_compile unknown error.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/NoCStandard-stderr.txt b/Tests/RunCMake/try_compile/NoCStandard-stderr.txt
index 8d2b3f1..e0bb9ed 100644
--- a/Tests/RunCMake/try_compile/NoCStandard-stderr.txt
+++ b/Tests/RunCMake/try_compile/NoCStandard-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at NoCStandard.cmake:1 \(try_compile\):
+CMake Error at NoCStandard.cmake:[0-9]+ \(try_compile\):
Error after keyword "C_STANDARD":
missing required value
diff --git a/Tests/RunCMake/try_compile/NoCStandard.cmake b/Tests/RunCMake/try_compile/NoCStandard.cmake
index b2c9ce6..e0d0478 100644
--- a/Tests/RunCMake/try_compile/NoCStandard.cmake
+++ b/Tests/RunCMake/try_compile/NoCStandard.cmake
@@ -1,2 +1,4 @@
-try_compile(result ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.c
C_STANDARD)
diff --git a/Tests/RunCMake/try_compile/NoCopyFile-stderr.txt b/Tests/RunCMake/try_compile/NoCopyFile-stderr.txt
index 36d889f..55ba687 100644
--- a/Tests/RunCMake/try_compile/NoCopyFile-stderr.txt
+++ b/Tests/RunCMake/try_compile/NoCopyFile-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at NoCopyFile.cmake:1 \(try_compile\):
+CMake Error at NoCopyFile.cmake:[0-9]+ \(try_compile\):
Error after keyword "COPY_FILE":
missing required value
diff --git a/Tests/RunCMake/try_compile/NoCopyFile.cmake b/Tests/RunCMake/try_compile/NoCopyFile.cmake
index 8c648ff..270dff9 100644
--- a/Tests/RunCMake/try_compile/NoCopyFile.cmake
+++ b/Tests/RunCMake/try_compile/NoCopyFile.cmake
@@ -1,2 +1,4 @@
-try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+try_compile(RESULT ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.c
COPY_FILE)
diff --git a/Tests/RunCMake/try_compile/NoCopyFile2-stderr.txt b/Tests/RunCMake/try_compile/NoCopyFile2-stderr.txt
index 7f60e77..008d4e9 100644
--- a/Tests/RunCMake/try_compile/NoCopyFile2-stderr.txt
+++ b/Tests/RunCMake/try_compile/NoCopyFile2-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at NoCopyFile2.cmake:1 \(try_compile\):
+CMake Error at NoCopyFile2.cmake:[0-9]+ \(try_compile\):
Error after keyword "COPY_FILE":
missing required value
diff --git a/Tests/RunCMake/try_compile/NoCopyFile2.cmake b/Tests/RunCMake/try_compile/NoCopyFile2.cmake
index 04b7f68..2ea8182 100644
--- a/Tests/RunCMake/try_compile/NoCopyFile2.cmake
+++ b/Tests/RunCMake/try_compile/NoCopyFile2.cmake
@@ -1,2 +1,4 @@
-try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+try_compile(RESULT ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.c
COPY_FILE CMAKE_FLAGS -DA=B)
diff --git a/Tests/RunCMake/try_compile/NoCopyFileError-stderr.txt b/Tests/RunCMake/try_compile/NoCopyFileError-stderr.txt
index dc242c3..7ca185d 100644
--- a/Tests/RunCMake/try_compile/NoCopyFileError-stderr.txt
+++ b/Tests/RunCMake/try_compile/NoCopyFileError-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at NoCopyFileError.cmake:1 \(try_compile\):
+CMake Error at NoCopyFileError.cmake:[0-9]+ \(try_compile\):
Error after keyword "COPY_FILE_ERROR":
missing required value
diff --git a/Tests/RunCMake/try_compile/NoCopyFileError.cmake b/Tests/RunCMake/try_compile/NoCopyFileError.cmake
index d4d69ee..1a56e86 100644
--- a/Tests/RunCMake/try_compile/NoCopyFileError.cmake
+++ b/Tests/RunCMake/try_compile/NoCopyFileError.cmake
@@ -1,2 +1,4 @@
-try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+try_compile(RESULT ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.c
COPY_FILE ${CMAKE_CURRENT_BINARY_DIR}/copied.bin COPY_FILE_ERROR)
diff --git a/Tests/RunCMake/try_compile/NoOutputVariable-stderr.txt b/Tests/RunCMake/try_compile/NoOutputVariable-stderr.txt
index b26be1d..ec29f0b 100644
--- a/Tests/RunCMake/try_compile/NoOutputVariable-stderr.txt
+++ b/Tests/RunCMake/try_compile/NoOutputVariable-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at NoOutputVariable.cmake:1 \(try_compile\):
+CMake Error at NoOutputVariable.cmake:[0-9]+ \(try_compile\):
Error after keyword "OUTPUT_VARIABLE":
missing required value
diff --git a/Tests/RunCMake/try_compile/NoOutputVariable.cmake b/Tests/RunCMake/try_compile/NoOutputVariable.cmake
index 3b9cb34..13dc4b4 100644
--- a/Tests/RunCMake/try_compile/NoOutputVariable.cmake
+++ b/Tests/RunCMake/try_compile/NoOutputVariable.cmake
@@ -1,2 +1,4 @@
-try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+try_compile(RESULT ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.c
OUTPUT_VARIABLE)
diff --git a/Tests/RunCMake/try_compile/NoOutputVariable2-stderr.txt b/Tests/RunCMake/try_compile/NoOutputVariable2-stderr.txt
index 02d226b..dd34559 100644
--- a/Tests/RunCMake/try_compile/NoOutputVariable2-stderr.txt
+++ b/Tests/RunCMake/try_compile/NoOutputVariable2-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at NoOutputVariable2.cmake:1 \(try_compile\):
+CMake Error at NoOutputVariable2.cmake:[0-9]+ \(try_compile\):
Error after keyword "OUTPUT_VARIABLE":
missing required value
diff --git a/Tests/RunCMake/try_compile/NoOutputVariable2.cmake b/Tests/RunCMake/try_compile/NoOutputVariable2.cmake
index ad9ac9a..4d5dda3 100644
--- a/Tests/RunCMake/try_compile/NoOutputVariable2.cmake
+++ b/Tests/RunCMake/try_compile/NoOutputVariable2.cmake
@@ -1,2 +1,4 @@
-try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+try_compile(RESULT ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.c
OUTPUT_VARIABLE CMAKE_FLAGS -DA=B)
diff --git a/Tests/RunCMake/try_compile/NoSources-stderr.txt b/Tests/RunCMake/try_compile/NoSources-stderr.txt
index a8410d2..55603dc 100644
--- a/Tests/RunCMake/try_compile/NoSources-stderr.txt
+++ b/Tests/RunCMake/try_compile/NoSources-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at NoSources.cmake:1 \(try_compile\):
+CMake Error at NoSources.cmake:[0-9]+ \(try_compile\):
Error after keyword "SOURCES":
missing required value
diff --git a/Tests/RunCMake/try_compile/NonSourceCompileDefinitions-stderr.txt b/Tests/RunCMake/try_compile/NonSourceCompileDefinitions-stderr.txt
index 025e658..3e48411 100644
--- a/Tests/RunCMake/try_compile/NonSourceCompileDefinitions-stderr.txt
+++ b/Tests/RunCMake/try_compile/NonSourceCompileDefinitions-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at NonSourceCompileDefinitions.cmake:1 \(try_compile\):
+CMake Error at NonSourceCompileDefinitions.cmake:[0-9]+ \(try_compile\):
COMPILE_DEFINITIONS specified on a srcdir type TRY_COMPILE
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/NonSourceCopyFile-stderr.txt b/Tests/RunCMake/try_compile/NonSourceCopyFile-stderr.txt
index f5893e1..7de8c92 100644
--- a/Tests/RunCMake/try_compile/NonSourceCopyFile-stderr.txt
+++ b/Tests/RunCMake/try_compile/NonSourceCopyFile-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at NonSourceCopyFile.cmake:1 \(try_compile\):
+CMake Error at NonSourceCopyFile.cmake:[0-9]+ \(try_compile\):
COPY_FILE specified on a srcdir type TRY_COMPILE
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/ObjCStandard-stderr.txt b/Tests/RunCMake/try_compile/ObjCStandard-stderr.txt
index f1b4df9..59f1d73 100644
--- a/Tests/RunCMake/try_compile/ObjCStandard-stderr.txt
+++ b/Tests/RunCMake/try_compile/ObjCStandard-stderr.txt
@@ -1,4 +1,4 @@
-^CMake Error at .*/Tests/RunCMake/try_compile/ObjCStandard-build/CMakeFiles/CMakeTmp/CMakeLists.txt:[0-9]+ \(add_executable\):
+^CMake Error at .*/Tests/RunCMake/try_compile/ObjCStandard-build/CMakeFiles/CMake(Tmp|Scratch/TryCompile-[^/]+)/CMakeLists.txt:[0-9]+ \(add_executable\):
OBJC_STANDARD is set to invalid value '3'
+
CMake Error at ObjCStandard.cmake:[0-9]+ \(try_compile\):
diff --git a/Tests/RunCMake/try_compile/ObjCStandard.cmake b/Tests/RunCMake/try_compile/ObjCStandard.cmake
index b2066f9..a691ddd 100644
--- a/Tests/RunCMake/try_compile/ObjCStandard.cmake
+++ b/Tests/RunCMake/try_compile/ObjCStandard.cmake
@@ -1,7 +1,11 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
enable_language(OBJC)
-try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
- SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.m
+
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.m
OBJC_STANDARD 3
OUTPUT_VARIABLE out
)
+
message("try_compile output:\n${out}")
diff --git a/Tests/RunCMake/try_compile/ObjCxxStandard-stderr.txt b/Tests/RunCMake/try_compile/ObjCxxStandard-stderr.txt
index a2f91b4..21fa20f 100644
--- a/Tests/RunCMake/try_compile/ObjCxxStandard-stderr.txt
+++ b/Tests/RunCMake/try_compile/ObjCxxStandard-stderr.txt
@@ -1,4 +1,4 @@
-^CMake Error at .*/Tests/RunCMake/try_compile/ObjCxxStandard-build/CMakeFiles/CMakeTmp/CMakeLists.txt:[0-9]+ \(add_executable\):
+^CMake Error at .*/Tests/RunCMake/try_compile/ObjCxxStandard-build/CMakeFiles/CMake(Tmp|Scratch/TryCompile-[^/]+)/CMakeLists.txt:[0-9]+ \(add_executable\):
OBJCXX_STANDARD is set to invalid value '3'
+
CMake Error at ObjCxxStandard.cmake:[0-9]+ \(try_compile\):
diff --git a/Tests/RunCMake/try_compile/ObjCxxStandard.cmake b/Tests/RunCMake/try_compile/ObjCxxStandard.cmake
index 1221805..b03f560 100644
--- a/Tests/RunCMake/try_compile/ObjCxxStandard.cmake
+++ b/Tests/RunCMake/try_compile/ObjCxxStandard.cmake
@@ -1,7 +1,11 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
enable_language(OBJCXX)
-try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
- SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.mm
+
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.mm
OBJCXX_STANDARD 3
OUTPUT_VARIABLE out
)
+
message("try_compile output:\n${out}")
diff --git a/Tests/RunCMake/try_compile/OneArg-stderr.txt b/Tests/RunCMake/try_compile/OneArg-stderr.txt
index 12835be..bb0239e 100644
--- a/Tests/RunCMake/try_compile/OneArg-stderr.txt
+++ b/Tests/RunCMake/try_compile/OneArg-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at OneArg.cmake:1 \(try_compile\):
+CMake Error at OneArg.cmake:[0-9]+ \(try_compile\):
try_compile unknown error.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
index 2fe3001..c0fdd9f 100644
--- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake
+++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
@@ -1,38 +1,28 @@
include(RunCMake)
-run_cmake(CopyFileErrorNoCopyFile)
run_cmake(NoArgs)
run_cmake(OneArg)
run_cmake(TwoArgs)
-run_cmake(NoCopyFile)
-run_cmake(NoCopyFile2)
-run_cmake(NoCopyFileError)
-run_cmake(NoCStandard)
-run_cmake(NoOutputVariable)
-run_cmake(NoOutputVariable2)
run_cmake(NoSources)
-run_cmake(BadLinkLibraries)
-run_cmake(BadSources1)
-run_cmake(BadSources2)
-run_cmake(NonSourceCopyFile)
-run_cmake(NonSourceCompileDefinitions)
run_cmake(BinDirEmpty)
run_cmake(BinDirRelative)
-run_cmake(EmptyValueArgs)
-run_cmake(EmptyListArgs)
-run_cmake(TryRunArgs)
-run_cmake(EnvConfig)
+set(RunCMake_TEST_OPTIONS -Dtry_compile_DEFS=old_signature.cmake)
+include(${RunCMake_SOURCE_DIR}/old_and_new_signature_tests.cmake)
+unset(RunCMake_TEST_OPTIONS)
+
+set(RunCMake_TEST_OPTIONS -Dtry_compile_DEFS=new_signature.cmake)
+include(${RunCMake_SOURCE_DIR}/old_and_new_signature_tests.cmake)
+unset(RunCMake_TEST_OPTIONS)
+
+run_cmake(NonSourceCopyFile)
+run_cmake(NonSourceCompileDefinitions)
set(RunCMake_TEST_OPTIONS --debug-trycompile)
run_cmake(PlatformVariables)
run_cmake(WarnDeprecated)
unset(RunCMake_TEST_OPTIONS)
-run_cmake(TargetTypeExe)
-run_cmake(TargetTypeInvalid)
-run_cmake(TargetTypeStatic)
-
if (CMAKE_SYSTEM_NAME MATCHES "^(Linux|Darwin|Windows)$" AND
CMAKE_C_COMPILER_ID MATCHES "^(MSVC|GNU|LCC|Clang|AppleClang)$")
set (RunCMake_TEST_OPTIONS -DRunCMake_C_COMPILER_ID=${CMAKE_C_COMPILER_ID})
@@ -40,41 +30,6 @@ if (CMAKE_SYSTEM_NAME MATCHES "^(Linux|Darwin|Windows)$" AND
unset (RunCMake_TEST_OPTIONS)
endif()
-if(CMAKE_C_STANDARD_DEFAULT)
- run_cmake(CStandard)
-elseif(DEFINED CMAKE_C_STANDARD_DEFAULT)
- run_cmake(CStandardNoDefault)
-endif()
-if(CMAKE_OBJC_STANDARD_DEFAULT)
- run_cmake(ObjCStandard)
-endif()
-if(CMAKE_CXX_STANDARD_DEFAULT)
- run_cmake(CxxStandard)
-elseif(DEFINED CMAKE_CXX_STANDARD_DEFAULT)
- run_cmake(CxxStandardNoDefault)
-endif()
-if(CMAKE_OBJCXX_STANDARD_DEFAULT)
- run_cmake(ObjCxxStandard)
-endif()
-if(CMake_TEST_CUDA)
- run_cmake(CudaStandard)
-endif()
-if(CMake_TEST_ISPC)
- run_cmake(ISPCTargets)
- run_cmake(ISPCInvalidTarget)
- set(ninja "")
- if(RunCMake_GENERATOR MATCHES "Ninja")
- set(ninja "Ninja")
- endif()
- run_cmake(ISPCDuplicateTarget${ninja})
-endif()
-if((CMAKE_C_COMPILER_ID MATCHES "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4) OR CMAKE_C_COMPILER_ID MATCHES "LCC")
- run_cmake(CStandardGNU)
-endif()
-if((CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) OR CMAKE_C_COMPILER_ID MATCHES "LCC")
- run_cmake(CxxStandardGNU)
-endif()
-
run_cmake(CMP0056)
run_cmake(CMP0066)
run_cmake(CMP0067)
diff --git a/Tests/RunCMake/try_compile/TargetTypeExe.cmake b/Tests/RunCMake/try_compile/TargetTypeExe.cmake
index 9b6e727..330f5f5 100644
--- a/Tests/RunCMake/try_compile/TargetTypeExe.cmake
+++ b/Tests/RunCMake/try_compile/TargetTypeExe.cmake
@@ -1,14 +1,20 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
enable_language(C)
+
set(CMAKE_TRY_COMPILE_TARGET_TYPE EXECUTABLE)
-try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
- SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
OUTPUT_VARIABLE out
COPY_FILE ${CMAKE_CURRENT_BINARY_DIR}/copy
COPY_FILE_ERROR copy_err
)
+
if(NOT result)
message(FATAL_ERROR "try_compile failed:\n${out}")
endif()
+
if(copy_err)
message(FATAL_ERROR "try_compile COPY_FILE failed:\n${copy_err}")
endif()
diff --git a/Tests/RunCMake/try_compile/TargetTypeInvalid-stderr.txt b/Tests/RunCMake/try_compile/TargetTypeInvalid-stderr.txt
index 08b281a..e9123e3 100644
--- a/Tests/RunCMake/try_compile/TargetTypeInvalid-stderr.txt
+++ b/Tests/RunCMake/try_compile/TargetTypeInvalid-stderr.txt
@@ -1,4 +1,4 @@
-^CMake Error at TargetTypeInvalid.cmake:2 \(try_compile\):
+^CMake Error at TargetTypeInvalid.cmake:[0-9]+ \(try_compile\):
Invalid value 'INVALID' for CMAKE_TRY_COMPILE_TARGET_TYPE. Only
'EXECUTABLE' and 'STATIC_LIBRARY' are allowed.
Call Stack \(most recent call first\):
diff --git a/Tests/RunCMake/try_compile/TargetTypeInvalid.cmake b/Tests/RunCMake/try_compile/TargetTypeInvalid.cmake
index 0bbc4ac..15a20bb 100644
--- a/Tests/RunCMake/try_compile/TargetTypeInvalid.cmake
+++ b/Tests/RunCMake/try_compile/TargetTypeInvalid.cmake
@@ -1,2 +1,6 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
set(CMAKE_TRY_COMPILE_TARGET_TYPE INVALID)
-try_compile(result ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c)
+
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.c)
diff --git a/Tests/RunCMake/try_compile/TargetTypeStatic.cmake b/Tests/RunCMake/try_compile/TargetTypeStatic.cmake
index 006b8b8..98dea41 100644
--- a/Tests/RunCMake/try_compile/TargetTypeStatic.cmake
+++ b/Tests/RunCMake/try_compile/TargetTypeStatic.cmake
@@ -1,14 +1,20 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
enable_language(C)
+
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
-try_compile(result ${CMAKE_CURRENT_BINARY_DIR}
- SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/other.c
+
+try_compile(result ${try_compile_bindir_or_SOURCES}
+ ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/other.c
OUTPUT_VARIABLE out
COPY_FILE ${CMAKE_CURRENT_BINARY_DIR}/copy
COPY_FILE_ERROR copy_err
)
+
if(NOT result)
message(FATAL_ERROR "try_compile failed:\n${out}")
endif()
+
if(copy_err)
message(FATAL_ERROR "try_compile COPY_FILE failed:\n${copy_err}")
endif()
diff --git a/Tests/RunCMake/try_compile/TryRunArgs.cmake b/Tests/RunCMake/try_compile/TryRunArgs.cmake
index 1a60270..e4cb1fe 100644
--- a/Tests/RunCMake/try_compile/TryRunArgs.cmake
+++ b/Tests/RunCMake/try_compile/TryRunArgs.cmake
@@ -1,6 +1,9 @@
+include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
+
enable_language(C)
-try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+try_compile(RESULT ${try_compile_bindir_or_SOURCES}
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.c
COPY_FILE "${CMAKE_CURRENT_BINARY_DIR}/out.bin"
COMPILE_OUTPUT_VARIABLE compOutputVar
RUN_OUTPUT_VARIABLE runOutputVar
diff --git a/Tests/RunCMake/try_compile/TwoArgs-stderr.txt b/Tests/RunCMake/try_compile/TwoArgs-stderr.txt
index b9c08fc..38f1d75 100644
--- a/Tests/RunCMake/try_compile/TwoArgs-stderr.txt
+++ b/Tests/RunCMake/try_compile/TwoArgs-stderr.txt
@@ -1,4 +1,4 @@
-CMake Error at TwoArgs.cmake:1 \(try_compile\):
+CMake Error at TwoArgs.cmake:[0-9]+ \(try_compile\):
try_compile unknown error.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/new_signature.cmake b/Tests/RunCMake/try_compile/new_signature.cmake
new file mode 100644
index 0000000..cbcb261
--- /dev/null
+++ b/Tests/RunCMake/try_compile/new_signature.cmake
@@ -0,0 +1,2 @@
+set(try_compile_bindir_or_SOURCES SOURCES)
+set(try_compile_redundant_SOURCES "")
diff --git a/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake b/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake
new file mode 100644
index 0000000..e156e12
--- /dev/null
+++ b/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake
@@ -0,0 +1,54 @@
+run_cmake(CopyFileErrorNoCopyFile)
+run_cmake(NoCopyFile)
+run_cmake(NoCopyFile2)
+run_cmake(NoCopyFileError)
+run_cmake(NoCStandard)
+run_cmake(NoOutputVariable)
+run_cmake(NoOutputVariable2)
+run_cmake(BadLinkLibraries)
+run_cmake(BadSources1)
+run_cmake(BadSources2)
+run_cmake(EmptyValueArgs)
+run_cmake(EmptyListArgs)
+run_cmake(TryRunArgs)
+
+run_cmake(EnvConfig)
+
+run_cmake(TargetTypeExe)
+run_cmake(TargetTypeInvalid)
+run_cmake(TargetTypeStatic)
+
+if(CMAKE_C_STANDARD_DEFAULT)
+ run_cmake(CStandard)
+elseif(DEFINED CMAKE_C_STANDARD_DEFAULT)
+ run_cmake(CStandardNoDefault)
+endif()
+if(CMAKE_OBJC_STANDARD_DEFAULT)
+ run_cmake(ObjCStandard)
+endif()
+if(CMAKE_CXX_STANDARD_DEFAULT)
+ run_cmake(CxxStandard)
+elseif(DEFINED CMAKE_CXX_STANDARD_DEFAULT)
+ run_cmake(CxxStandardNoDefault)
+endif()
+if(CMAKE_OBJCXX_STANDARD_DEFAULT)
+ run_cmake(ObjCxxStandard)
+endif()
+if(CMake_TEST_CUDA)
+ run_cmake(CudaStandard)
+endif()
+if(CMake_TEST_ISPC)
+ run_cmake(ISPCTargets)
+ run_cmake(ISPCInvalidTarget)
+ set(ninja "")
+ if(RunCMake_GENERATOR MATCHES "Ninja")
+ set(ninja "Ninja")
+ endif()
+ run_cmake(ISPCDuplicateTarget${ninja})
+endif()
+if((CMAKE_C_COMPILER_ID MATCHES "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4) OR CMAKE_C_COMPILER_ID MATCHES "LCC")
+ run_cmake(CStandardGNU)
+endif()
+if((CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) OR CMAKE_C_COMPILER_ID MATCHES "LCC")
+ run_cmake(CxxStandardGNU)
+endif()
diff --git a/Tests/RunCMake/try_compile/old_signature.cmake b/Tests/RunCMake/try_compile/old_signature.cmake
new file mode 100644
index 0000000..94b12de
--- /dev/null
+++ b/Tests/RunCMake/try_compile/old_signature.cmake
@@ -0,0 +1,2 @@
+set(try_compile_bindir_or_SOURCES ${CMAKE_CURRENT_BINARY_DIR})
+set(try_compile_redundant_SOURCES SOURCES)