summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorRaul Tambre <raul@tambre.ee>2022-01-22 15:45:14 (GMT)
committerRaul Tambre <raul@tambre.ee>2022-01-23 21:10:28 (GMT)
commitb2c25de8e0e2d53d3ff2ad37ed33d4b8a9bf8b1a (patch)
tree156435c62df230140764a663bccec89929750511 /Tests
parent3a089cd2560db80f9534b9c86a0a7af495533466 (diff)
downloadCMake-b2c25de8e0e2d53d3ff2ad37ed33d4b8a9bf8b1a.zip
CMake-b2c25de8e0e2d53d3ff2ad37ed33d4b8a9bf8b1a.tar.gz
CMake-b2c25de8e0e2d53d3ff2ad37ed33d4b8a9bf8b1a.tar.bz2
CMP0128: Avoid test code duplication
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CompileFeatures/CMP0128Common.cmake7
-rw-r--r--Tests/RunCMake/CompileFeatures/CMP0128NewExtensionsStandardDefault.cmake7
-rw-r--r--Tests/RunCMake/CompileFeatures/CMP0128NewExtensionsStandardUnset.cmake7
-rw-r--r--Tests/RunCMake/CompileFeatures/CMP0128NewNoUnnecessaryFlag.cmake7
-rw-r--r--Tests/RunCMake/CompileFeatures/CMP0128WarnMatch.cmake2
-rw-r--r--Tests/RunCMake/CompileFeatures/CMP0128WarnUnset.cmake2
-rw-r--r--Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake4
7 files changed, 10 insertions, 26 deletions
diff --git a/Tests/RunCMake/CompileFeatures/CMP0128Common.cmake b/Tests/RunCMake/CompileFeatures/CMP0128Common.cmake
new file mode 100644
index 0000000..b309d74
--- /dev/null
+++ b/Tests/RunCMake/CompileFeatures/CMP0128Common.cmake
@@ -0,0 +1,7 @@
+enable_language(@lang@)
+
+# Make sure the compile command is not hidden.
+string(REPLACE "${CMAKE_START_TEMP_FILE}" "" CMAKE_@lang@_COMPILE_OBJECT "${CMAKE_@lang@_COMPILE_OBJECT}")
+string(REPLACE "${CMAKE_END_TEMP_FILE}" "" CMAKE_@lang@_COMPILE_OBJECT "${CMAKE_@lang@_COMPILE_OBJECT}")
+
+add_library(foo "@RunCMake_SOURCE_DIR@/empty.@ext@")
diff --git a/Tests/RunCMake/CompileFeatures/CMP0128NewExtensionsStandardDefault.cmake b/Tests/RunCMake/CompileFeatures/CMP0128NewExtensionsStandardDefault.cmake
index 32578d1..5b7358a 100644
--- a/Tests/RunCMake/CompileFeatures/CMP0128NewExtensionsStandardDefault.cmake
+++ b/Tests/RunCMake/CompileFeatures/CMP0128NewExtensionsStandardDefault.cmake
@@ -1,9 +1,2 @@
-enable_language(@lang@)
-
-# Make sure the compile command is not hidden.
-string(REPLACE "${CMAKE_START_TEMP_FILE}" "" CMAKE_@lang@_COMPILE_OBJECT "${CMAKE_@lang@_COMPILE_OBJECT}")
-string(REPLACE "${CMAKE_END_TEMP_FILE}" "" CMAKE_@lang@_COMPILE_OBJECT "${CMAKE_@lang@_COMPILE_OBJECT}")
-
set(CMAKE_@lang@_EXTENSIONS @extensions_opposite@)
set(CMAKE_@lang@_STANDARD @standard_default@)
-add_library(foo "@RunCMake_SOURCE_DIR@/empty.@ext@")
diff --git a/Tests/RunCMake/CompileFeatures/CMP0128NewExtensionsStandardUnset.cmake b/Tests/RunCMake/CompileFeatures/CMP0128NewExtensionsStandardUnset.cmake
index 99bb3f0..6923c11 100644
--- a/Tests/RunCMake/CompileFeatures/CMP0128NewExtensionsStandardUnset.cmake
+++ b/Tests/RunCMake/CompileFeatures/CMP0128NewExtensionsStandardUnset.cmake
@@ -1,8 +1 @@
-enable_language(@lang@)
-
-# Make sure the compile command is not hidden.
-string(REPLACE "${CMAKE_START_TEMP_FILE}" "" CMAKE_@lang@_COMPILE_OBJECT "${CMAKE_@lang@_COMPILE_OBJECT}")
-string(REPLACE "${CMAKE_END_TEMP_FILE}" "" CMAKE_@lang@_COMPILE_OBJECT "${CMAKE_@lang@_COMPILE_OBJECT}")
-
set(CMAKE_@lang@_EXTENSIONS @extensions_opposite@)
-add_library(foo "@RunCMake_SOURCE_DIR@/empty.@ext@")
diff --git a/Tests/RunCMake/CompileFeatures/CMP0128NewNoUnnecessaryFlag.cmake b/Tests/RunCMake/CompileFeatures/CMP0128NewNoUnnecessaryFlag.cmake
index 8ef3a72..73c0641 100644
--- a/Tests/RunCMake/CompileFeatures/CMP0128NewNoUnnecessaryFlag.cmake
+++ b/Tests/RunCMake/CompileFeatures/CMP0128NewNoUnnecessaryFlag.cmake
@@ -1,9 +1,2 @@
-enable_language(@lang@)
-
-# Make sure the compile command is not hidden.
-string(REPLACE "${CMAKE_START_TEMP_FILE}" "" CMAKE_@lang@_COMPILE_OBJECT "${CMAKE_@lang@_COMPILE_OBJECT}")
-string(REPLACE "${CMAKE_END_TEMP_FILE}" "" CMAKE_@lang@_COMPILE_OBJECT "${CMAKE_@lang@_COMPILE_OBJECT}")
-
set(CMAKE_@lang@_EXTENSIONS @extensions_default@)
set(CMAKE_@lang@_STANDARD @standard_default@)
-add_library(foo "@RunCMake_SOURCE_DIR@/empty.@ext@")
diff --git a/Tests/RunCMake/CompileFeatures/CMP0128WarnMatch.cmake b/Tests/RunCMake/CompileFeatures/CMP0128WarnMatch.cmake
index 0a5606a..7974093 100644
--- a/Tests/RunCMake/CompileFeatures/CMP0128WarnMatch.cmake
+++ b/Tests/RunCMake/CompileFeatures/CMP0128WarnMatch.cmake
@@ -1,7 +1,5 @@
-enable_language(@lang@)
cmake_policy(SET CMP0128 OLD)
set(CMAKE_POLICY_WARNING_CMP0128 ON)
set(CMAKE_@lang@_EXTENSIONS @extensions_default@)
set(CMAKE_@lang@_STANDARD @standard_default@)
-add_library(foo "@RunCMake_SOURCE_DIR@/empty.@ext@")
diff --git a/Tests/RunCMake/CompileFeatures/CMP0128WarnUnset.cmake b/Tests/RunCMake/CompileFeatures/CMP0128WarnUnset.cmake
index cd7af2c..33425a1 100644
--- a/Tests/RunCMake/CompileFeatures/CMP0128WarnUnset.cmake
+++ b/Tests/RunCMake/CompileFeatures/CMP0128WarnUnset.cmake
@@ -1,6 +1,4 @@
-enable_language(@lang@)
cmake_policy(SET CMP0128 OLD)
set(CMAKE_POLICY_WARNING_CMP0128 ON)
set(CMAKE_@lang@_EXTENSIONS @extensions_opposite@)
-add_library(foo "@RunCMake_SOURCE_DIR@/empty.@ext@")
diff --git a/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake
index fc2fa06..35b01e3 100644
--- a/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CompileFeatures/RunCMakeTest.cmake
@@ -35,11 +35,13 @@ elseif (cxx_std_98 IN_LIST CXX_FEATURES AND cxx_std_11 IN_LIST CXX_FEATURES)
endif()
configure_file("${RunCMake_SOURCE_DIR}/CMakeLists.txt" "${RunCMake_BINARY_DIR}/CMakeLists.txt" COPYONLY)
+file(READ "${RunCMake_SOURCE_DIR}/CMP0128Common.cmake" cmp0128_common)
function(test_build)
set(test ${name}-${lang})
- configure_file("${RunCMake_SOURCE_DIR}/${name}.cmake" "${RunCMake_BINARY_DIR}/${test}.cmake" @ONLY)
+ file(READ "${RunCMake_SOURCE_DIR}/${name}.cmake" cmake)
+ file(CONFIGURE OUTPUT "${RunCMake_BINARY_DIR}/${test}.cmake" CONTENT "${cmake}${cmp0128_common}" @ONLY)
if(EXISTS "${RunCMake_SOURCE_DIR}/${name}-build-check.cmake")
configure_file("${RunCMake_SOURCE_DIR}/${name}-build-check.cmake" "${RunCMake_BINARY_DIR}/${test}-build-check.cmake" @ONLY)
endif()