summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2021-03-10 19:59:14 (GMT)
committerBrad King <brad.king@kitware.com>2021-03-22 19:04:54 (GMT)
commit8bc5c8961e552a15091b7f4d2c205ce90b8f764f (patch)
treeac9fe9a92c01accd1fee2c4914347369546f85ff /Tests
parentce6ea7c927b9f80f219a7783ce725bea4c24091f (diff)
downloadCMake-8bc5c8961e552a15091b7f4d2c205ce90b8f764f.zip
CMake-8bc5c8961e552a15091b7f4d2c205ce90b8f764f.tar.gz
CMake-8bc5c8961e552a15091b7f4d2c205ce90b8f764f.tar.bz2
CMakePresets.json: Add the ability to conditionally disable presets
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CMakePresets/ConditionFuture-result.txt1
-rw-r--r--Tests/RunCMake/CMakePresets/ConditionFuture-stderr.txt2
-rw-r--r--Tests/RunCMake/CMakePresets/ConditionFuture.json.in11
-rw-r--r--Tests/RunCMake/CMakePresets/Conditions.json.in349
-rw-r--r--Tests/RunCMake/CMakePresets/ListConditions-stdout.txt22
-rw-r--r--Tests/RunCMake/CMakePresets/RunCMakeTest.cmake8
-rw-r--r--Tests/RunCMake/CMakePresets/SimpleFalse-result.txt1
-rw-r--r--Tests/RunCMake/CMakePresets/SimpleFalse-stderr.txt1
-rw-r--r--Tests/RunCMake/CMakePresets/SimpleTrue.cmake0
-rw-r--r--Tests/RunCMake/CMakePresets/SubConditionNull-result.txt1
-rw-r--r--Tests/RunCMake/CMakePresets/SubConditionNull-stderr.txt2
-rw-r--r--Tests/RunCMake/CMakePresets/SubConditionNull.json.in14
-rw-r--r--Tests/RunCMake/CMakePresetsBuild/Condition-build-disabled-result.txt1
-rw-r--r--Tests/RunCMake/CMakePresetsBuild/Condition-build-disabled-stderr.txt2
-rw-r--r--Tests/RunCMake/CMakePresetsBuild/Condition.cmake0
-rw-r--r--Tests/RunCMake/CMakePresetsBuild/Condition.json.in22
-rw-r--r--Tests/RunCMake/CMakePresetsBuild/ConditionFuture-build-conditionFuture-result.txt1
-rw-r--r--Tests/RunCMake/CMakePresetsBuild/ConditionFuture-build-conditionFuture-stderr.txt2
-rw-r--r--Tests/RunCMake/CMakePresetsBuild/ConditionFuture.json.in17
-rw-r--r--Tests/RunCMake/CMakePresetsBuild/ListPresets-build-x-stdout.txt3
-rw-r--r--Tests/RunCMake/CMakePresetsBuild/ListPresets.json.in12
-rw-r--r--Tests/RunCMake/CMakePresetsBuild/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/CMakePresetsTest/Condition.json.in22
-rw-r--r--Tests/RunCMake/CMakePresetsTest/ConditionFuture-test-x-result.txt1
-rw-r--r--Tests/RunCMake/CMakePresetsTest/ConditionFuture-test-x-stderr.txt2
-rw-r--r--Tests/RunCMake/CMakePresetsTest/ConditionFuture.json.in17
-rw-r--r--Tests/RunCMake/CMakePresetsTest/ConditionListPresets-test-x-stdout.txt3
-rw-r--r--Tests/RunCMake/CMakePresetsTest/ConditionRunTests-test-disabled-result.txt1
-rw-r--r--Tests/RunCMake/CMakePresetsTest/ConditionRunTests-test-disabled-stderr.txt2
-rw-r--r--Tests/RunCMake/CMakePresetsTest/ConditionRunTests.cmake2
-rw-r--r--Tests/RunCMake/CMakePresetsTest/RunCMakeTest.cmake7
31 files changed, 529 insertions, 2 deletions
diff --git a/Tests/RunCMake/CMakePresets/ConditionFuture-result.txt b/Tests/RunCMake/CMakePresets/ConditionFuture-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/ConditionFuture-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMakePresets/ConditionFuture-stderr.txt b/Tests/RunCMake/CMakePresets/ConditionFuture-stderr.txt
new file mode 100644
index 0000000..ea5f47f
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/ConditionFuture-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: Could not read presets from [^
+]*/Tests/RunCMake/CMakePresets/ConditionFuture: File version must be 3 or higher for condition support$
diff --git a/Tests/RunCMake/CMakePresets/ConditionFuture.json.in b/Tests/RunCMake/CMakePresets/ConditionFuture.json.in
new file mode 100644
index 0000000..9d4798b
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/ConditionFuture.json.in
@@ -0,0 +1,11 @@
+{
+ "version": 2,
+ "configurePresets": [
+ {
+ "name": "ConditionFuture",
+ "generator": "@RunCMake_GENERATOR@",
+ "binaryDir": "${sourceDir}/build",
+ "condition": true
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresets/Conditions.json.in b/Tests/RunCMake/CMakePresets/Conditions.json.in
new file mode 100644
index 0000000..9a01e2f
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/Conditions.json.in
@@ -0,0 +1,349 @@
+{
+ "version": 3,
+ "configurePresets": [
+ {
+ "name": "Base",
+ "hidden": true,
+ "generator": "@RunCMake_GENERATOR@",
+ "binaryDir": "${sourceDir}/build"
+ },
+ {
+ "name": "SimpleTrue",
+ "inherits": "Base",
+ "condition": true
+ },
+ {
+ "name": "SimpleFalse",
+ "inherits": "Base",
+ "condition": false
+ },
+ {
+ "name": "Null",
+ "inherits": "Base",
+ "condition": null
+ },
+ {
+ "name": "ConstTrue",
+ "inherits": "Base",
+ "condition": {
+ "type": "const",
+ "value": true
+ }
+ },
+ {
+ "name": "ConstFalse",
+ "inherits": "Base",
+ "condition": {
+ "type": "const",
+ "value": false
+ }
+ },
+ {
+ "name": "EqualsTrue",
+ "inherits": "Base",
+ "condition": {
+ "type": "equals",
+ "lhs": "abc",
+ "rhs": "abc"
+ }
+ },
+ {
+ "name": "EqualsFalse",
+ "inherits": "Base",
+ "condition": {
+ "type": "equals",
+ "lhs": "abc",
+ "rhs": "abcd"
+ }
+ },
+ {
+ "name": "EqualsMacroLeft",
+ "inherits": "Base",
+ "condition": {
+ "type": "equals",
+ "lhs": "${presetName}",
+ "rhs": "EqualsMacroLeft"
+ }
+ },
+ {
+ "name": "EqualsMacroRight",
+ "inherits": "Base",
+ "condition": {
+ "type": "equals",
+ "lhs": "EqualsMacroRight",
+ "rhs": "${presetName}"
+ }
+ },
+ {
+ "name": "NotEqualsTrue",
+ "inherits": "Base",
+ "condition": {
+ "type": "notEquals",
+ "lhs": "abc",
+ "rhs": "abcd"
+ }
+ },
+ {
+ "name": "NotEqualsFalse",
+ "inherits": "Base",
+ "condition": {
+ "type": "notEquals",
+ "lhs": "abc",
+ "rhs": "abc"
+ }
+ },
+ {
+ "name": "InListTrue",
+ "inherits": "Base",
+ "condition": {
+ "type": "inList",
+ "string": "b",
+ "list": [
+ "a",
+ "b",
+ "c"
+ ]
+ }
+ },
+ {
+ "name": "InListFalse",
+ "inherits": "Base",
+ "condition": {
+ "type": "inList",
+ "string": "d",
+ "list": [
+ "a",
+ "b",
+ "c"
+ ]
+ }
+ },
+ {
+ "name": "InListMacroString",
+ "inherits": "Base",
+ "condition": {
+ "type": "inList",
+ "string": "${presetName}",
+ "list": [
+ "InListMacroString",
+ "AnotherString"
+ ]
+ }
+ },
+ {
+ "name": "InListMacroList",
+ "inherits": "Base",
+ "condition": {
+ "type": "inList",
+ "string": "InListMacroList",
+ "list": [
+ "${presetName}",
+ "AnotherString"
+ ]
+ }
+ },
+ {
+ "name": "InListShortCircuit",
+ "inherits": "Base",
+ "condition": {
+ "type": "inList",
+ "string": "a",
+ "list": [
+ "a",
+ "${invalidMacro}"
+ ]
+ }
+ },
+ {
+ "name": "NotInListTrue",
+ "inherits": "Base",
+ "condition": {
+ "type": "notInList",
+ "string": "d",
+ "list": [
+ "a",
+ "b",
+ "c"
+ ]
+ }
+ },
+ {
+ "name": "NotInListFalse",
+ "inherits": "Base",
+ "condition": {
+ "type": "notInList",
+ "string": "a",
+ "list": [
+ "a",
+ "b",
+ "c"
+ ]
+ }
+ },
+ {
+ "name": "AnyOfTrue1",
+ "inherits": "Base",
+ "condition": {
+ "type": "anyOf",
+ "conditions": [
+ true,
+ false
+ ]
+ }
+ },
+ {
+ "name": "AnyOfTrue2",
+ "inherits": "Base",
+ "condition": {
+ "type": "anyOf",
+ "conditions": [
+ false,
+ true
+ ]
+ }
+ },
+ {
+ "name": "AnyOfFalse",
+ "inherits": "Base",
+ "condition": {
+ "type": "anyOf",
+ "conditions": [
+ false,
+ {
+ "type": "equals",
+ "lhs": "abc",
+ "rhs": "abcd"
+ }
+ ]
+ }
+ },
+ {
+ "name": "AnyOfShortCircuit",
+ "inherits": "Base",
+ "condition": {
+ "type": "anyOf",
+ "conditions": [
+ true,
+ {
+ "type": "equals",
+ "lhs": "${invalidMacro}",
+ "rhs": ""
+ }
+ ]
+ }
+ },
+ {
+ "name": "AnyOfEmpty",
+ "inherits": "Base",
+ "condition": {
+ "type": "anyOf",
+ "conditions": []
+ }
+ },
+ {
+ "name": "AllOfTrue",
+ "inherits": "Base",
+ "condition": {
+ "type": "allOf",
+ "conditions": [
+ true,
+ {
+ "type": "equals",
+ "lhs": "abc",
+ "rhs": "abc"
+ }
+ ]
+ }
+ },
+ {
+ "name": "AllOfFalse1",
+ "inherits": "Base",
+ "condition": {
+ "type": "allOf",
+ "conditions": [
+ false,
+ true
+ ]
+ }
+ },
+ {
+ "name": "AllOfFalse2",
+ "inherits": "Base",
+ "condition": {
+ "type": "allOf",
+ "conditions": [
+ true,
+ false
+ ]
+ }
+ },
+ {
+ "name": "AllOfShortCircuit",
+ "inherits": "Base",
+ "condition": {
+ "type": "allOf",
+ "conditions": [
+ false,
+ {
+ "type": "equals",
+ "lhs": "${invalidMacro}",
+ "rhs": ""
+ }
+ ]
+ }
+ },
+ {
+ "name": "AllOfEmpty",
+ "inherits": "Base",
+ "condition": {
+ "type": "allOf",
+ "conditions": []
+ }
+ },
+ {
+ "name": "NotTrue",
+ "inherits": "Base",
+ "condition": {
+ "type": "not",
+ "condition": true
+ }
+ },
+ {
+ "name": "NotFalse",
+ "inherits": "Base",
+ "condition": {
+ "type": "not",
+ "condition": false
+ }
+ },
+ {
+ "name": "InheritanceBase",
+ "inherits": "Base",
+ "hidden": true,
+ "condition": {
+ "type": "equals",
+ "lhs": "${presetName}",
+ "rhs": "InheritanceChildTrue"
+ }
+ },
+ {
+ "name": "InheritanceChildTrue",
+ "inherits": "InheritanceBase"
+ },
+ {
+ "name": "InheritanceChildFalse",
+ "inherits": "InheritanceBase"
+ },
+ {
+ "name": "InheritanceNull",
+ "inherits": "Null"
+ },
+ {
+ "name": "InheritanceNullFalse",
+ "inherits": [
+ "Null",
+ "SimpleFalse"
+ ]
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresets/ListConditions-stdout.txt b/Tests/RunCMake/CMakePresets/ListConditions-stdout.txt
new file mode 100644
index 0000000..19f91d4
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/ListConditions-stdout.txt
@@ -0,0 +1,22 @@
+Available configure presets:
+
+ "SimpleTrue"
+ "Null"
+ "ConstTrue"
+ "EqualsTrue"
+ "EqualsMacroLeft"
+ "EqualsMacroRight"
+ "NotEqualsTrue"
+ "InListTrue"
+ "InListMacroString"
+ "InListMacroList"
+ "InListShortCircuit"
+ "NotInListTrue"
+ "AnyOfTrue1"
+ "AnyOfTrue2"
+ "AnyOfShortCircuit"
+ "AllOfTrue"
+ "AllOfEmpty"
+ "NotFalse"
+ "InheritanceChildTrue"
+ "InheritanceNull"$
diff --git a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
index 24ac0e9..22425b2 100644
--- a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
@@ -118,6 +118,8 @@ run_cmake_presets(EnvCycle)
run_cmake_presets(EmptyEnv)
run_cmake_presets(EmptyPenv)
set(CMakePresets_SCHEMA_EXPECTED_RESULT 1)
+run_cmake_presets(ConditionFuture)
+run_cmake_presets(SubConditionNull)
# Test cmakeMinimumRequired field
run_cmake_presets(MinimumRequiredInvalid)
@@ -267,6 +269,12 @@ run_cmake_presets(HostSystemName)
set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/HostSystemNameFuture.json.in")
run_cmake_presets(HostSystemNameFuture)
+# Test conditions
+set(CMakePresets_FILE "${RunCMake_SOURCE_DIR}/Conditions.json.in")
+run_cmake_presets(ListConditions --list-presets)
+run_cmake_presets(SimpleTrue)
+run_cmake_presets(SimpleFalse)
+
# Test the example from the documentation
file(READ "${RunCMake_SOURCE_DIR}/../../../Help/manual/presets/example.json" _example)
string(REPLACE "\"generator\": \"Ninja\"" "\"generator\": \"@RunCMake_GENERATOR@\"" _example "${_example}")
diff --git a/Tests/RunCMake/CMakePresets/SimpleFalse-result.txt b/Tests/RunCMake/CMakePresets/SimpleFalse-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/SimpleFalse-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMakePresets/SimpleFalse-stderr.txt b/Tests/RunCMake/CMakePresets/SimpleFalse-stderr.txt
new file mode 100644
index 0000000..6a9a7de
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/SimpleFalse-stderr.txt
@@ -0,0 +1 @@
+^CMake Error: Could not use disabled preset "SimpleFalse"$
diff --git a/Tests/RunCMake/CMakePresets/SimpleTrue.cmake b/Tests/RunCMake/CMakePresets/SimpleTrue.cmake
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/SimpleTrue.cmake
diff --git a/Tests/RunCMake/CMakePresets/SubConditionNull-result.txt b/Tests/RunCMake/CMakePresets/SubConditionNull-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/SubConditionNull-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMakePresets/SubConditionNull-stderr.txt b/Tests/RunCMake/CMakePresets/SubConditionNull-stderr.txt
new file mode 100644
index 0000000..42b74d6
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/SubConditionNull-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: Could not read presets from [^
+]*/Tests/RunCMake/CMakePresets/SubConditionNull: Invalid preset condition$
diff --git a/Tests/RunCMake/CMakePresets/SubConditionNull.json.in b/Tests/RunCMake/CMakePresets/SubConditionNull.json.in
new file mode 100644
index 0000000..eed3da6
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/SubConditionNull.json.in
@@ -0,0 +1,14 @@
+{
+ "version": 3,
+ "configurePresets": [
+ {
+ "name": "SubConditionNull",
+ "generator": "@RunCMake_GENERATOR@",
+ "binaryDir": "${sourceDir}/build",
+ "condition": {
+ "type": "not",
+ "condition": null
+ }
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresetsBuild/Condition-build-disabled-result.txt b/Tests/RunCMake/CMakePresetsBuild/Condition-build-disabled-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsBuild/Condition-build-disabled-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMakePresetsBuild/Condition-build-disabled-stderr.txt b/Tests/RunCMake/CMakePresetsBuild/Condition-build-disabled-stderr.txt
new file mode 100644
index 0000000..c35f5d7
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsBuild/Condition-build-disabled-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: Cannot use disabled build preset in [^
+]*/Tests/RunCMake/CMakePresetsBuild/Condition: "disabled"$
diff --git a/Tests/RunCMake/CMakePresetsBuild/Condition.cmake b/Tests/RunCMake/CMakePresetsBuild/Condition.cmake
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsBuild/Condition.cmake
diff --git a/Tests/RunCMake/CMakePresetsBuild/Condition.json.in b/Tests/RunCMake/CMakePresetsBuild/Condition.json.in
new file mode 100644
index 0000000..aaee96a
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsBuild/Condition.json.in
@@ -0,0 +1,22 @@
+{
+ "version": 3,
+ "configurePresets": [
+ {
+ "name": "default",
+ "generator": "@RunCMake_GENERATOR@",
+ "binaryDir": "${sourceDir}/build"
+ }
+ ],
+ "buildPresets": [
+ {
+ "name": "enabled",
+ "configurePreset": "default",
+ "condition": true
+ },
+ {
+ "name": "disabled",
+ "configurePreset": "default",
+ "condition": false
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresetsBuild/ConditionFuture-build-conditionFuture-result.txt b/Tests/RunCMake/CMakePresetsBuild/ConditionFuture-build-conditionFuture-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsBuild/ConditionFuture-build-conditionFuture-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMakePresetsBuild/ConditionFuture-build-conditionFuture-stderr.txt b/Tests/RunCMake/CMakePresetsBuild/ConditionFuture-build-conditionFuture-stderr.txt
new file mode 100644
index 0000000..f08f4c1
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsBuild/ConditionFuture-build-conditionFuture-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: Could not read presets from [^
+]*/Tests/RunCMake/CMakePresetsBuild/ConditionFuture: File version must be 3 or higher for condition support$
diff --git a/Tests/RunCMake/CMakePresetsBuild/ConditionFuture.json.in b/Tests/RunCMake/CMakePresetsBuild/ConditionFuture.json.in
new file mode 100644
index 0000000..2f3f7d8
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsBuild/ConditionFuture.json.in
@@ -0,0 +1,17 @@
+{
+ "version": 2,
+ "configurePresets": [
+ {
+ "name": "default",
+ "generator": "@RunCMake_GENERATOR@",
+ "binaryDir": "${sourceDir}/build"
+ }
+ ],
+ "buildPresets": [
+ {
+ "name": "conditionFuture",
+ "configurePreset": "default",
+ "condition": true
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresetsBuild/ListPresets-build-x-stdout.txt b/Tests/RunCMake/CMakePresetsBuild/ListPresets-build-x-stdout.txt
index 4d30707..2d362d4 100644
--- a/Tests/RunCMake/CMakePresetsBuild/ListPresets-build-x-stdout.txt
+++ b/Tests/RunCMake/CMakePresetsBuild/ListPresets-build-x-stdout.txt
@@ -1,5 +1,6 @@
-Available build presets:
+^Available build presets:
"build-default" - build-default displayName
"empty"
"display" - display displayName
+ "true"$
diff --git a/Tests/RunCMake/CMakePresetsBuild/ListPresets.json.in b/Tests/RunCMake/CMakePresetsBuild/ListPresets.json.in
index 3f5e02c..26504d3 100644
--- a/Tests/RunCMake/CMakePresetsBuild/ListPresets.json.in
+++ b/Tests/RunCMake/CMakePresetsBuild/ListPresets.json.in
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"configurePresets": [
{
"name": "default",
@@ -26,6 +26,16 @@
{
"name": "hidden",
"hidden": true
+ },
+ {
+ "name": "true",
+ "inherits": "build-default",
+ "condition": true
+ },
+ {
+ "name": "false",
+ "inherits": "build-default",
+ "condition": false
}
]
}
diff --git a/Tests/RunCMake/CMakePresetsBuild/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresetsBuild/RunCMakeTest.cmake
index 2559b12..afa22eb 100644
--- a/Tests/RunCMake/CMakePresetsBuild/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMakePresetsBuild/RunCMakeTest.cmake
@@ -64,6 +64,7 @@ set(CMakePresets_SCHEMA_EXPECTED_RESULT 0)
run_cmake_build_presets(Good "default;other" "build-other;withEnvironment;noEnvironment;macros;vendorObject")
run_cmake_build_presets(InvalidConfigurePreset "default" "badConfigurePreset")
+run_cmake_build_presets(Condition "default" "enabled;disabled")
set(CMakePresetsBuild_BUILD_ONLY 1)
run_cmake_build_presets(ListPresets "x" "x" "--list-presets")
@@ -72,5 +73,6 @@ run_cmake_build_presets(Invalid "x" "hidden;vendorMacro")
set(CMakePresets_SCHEMA_EXPECTED_RESULT 1)
run_cmake_build_presets(PresetsUnsupported "x" "x")
+run_cmake_build_presets(ConditionFuture "x" "conditionFuture")
set(CMakePresets_SCHEMA_EXPECTED_RESULT 0)
set(CMakePresetsBuild_BUILD_ONLY 0)
diff --git a/Tests/RunCMake/CMakePresetsTest/Condition.json.in b/Tests/RunCMake/CMakePresetsTest/Condition.json.in
new file mode 100644
index 0000000..0baf176
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsTest/Condition.json.in
@@ -0,0 +1,22 @@
+{
+ "version": 3,
+ "configurePresets": [
+ {
+ "name": "default",
+ "generator": "@RunCMake_GENERATOR@",
+ "binaryDir": "${sourceDir}/build"
+ }
+ ],
+ "testPresets": [
+ {
+ "name": "enabled",
+ "configurePreset": "default",
+ "condition": true
+ },
+ {
+ "name": "disabled",
+ "configurePreset": "default",
+ "condition": false
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresetsTest/ConditionFuture-test-x-result.txt b/Tests/RunCMake/CMakePresetsTest/ConditionFuture-test-x-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsTest/ConditionFuture-test-x-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMakePresetsTest/ConditionFuture-test-x-stderr.txt b/Tests/RunCMake/CMakePresetsTest/ConditionFuture-test-x-stderr.txt
new file mode 100644
index 0000000..b814bbb
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsTest/ConditionFuture-test-x-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: Could not read presets from [^
+]*/Tests/RunCMake/CMakePresetsTest/ConditionFuture: File version must be 3 or higher for condition support$
diff --git a/Tests/RunCMake/CMakePresetsTest/ConditionFuture.json.in b/Tests/RunCMake/CMakePresetsTest/ConditionFuture.json.in
new file mode 100644
index 0000000..4b9f33f
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsTest/ConditionFuture.json.in
@@ -0,0 +1,17 @@
+{
+ "version": 2,
+ "configurePresets": [
+ {
+ "name": "default",
+ "generator": "@RunCMake_GENERATOR@",
+ "binaryDir": "${sourceDir}/build"
+ }
+ ],
+ "testPresets": [
+ {
+ "name": "conditionFuture",
+ "configurePreset": "default",
+ "condition": true
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresetsTest/ConditionListPresets-test-x-stdout.txt b/Tests/RunCMake/CMakePresetsTest/ConditionListPresets-test-x-stdout.txt
new file mode 100644
index 0000000..11918e5
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsTest/ConditionListPresets-test-x-stdout.txt
@@ -0,0 +1,3 @@
+^Available test presets:
+
+ "enabled"$
diff --git a/Tests/RunCMake/CMakePresetsTest/ConditionRunTests-test-disabled-result.txt b/Tests/RunCMake/CMakePresetsTest/ConditionRunTests-test-disabled-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsTest/ConditionRunTests-test-disabled-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMakePresetsTest/ConditionRunTests-test-disabled-stderr.txt b/Tests/RunCMake/CMakePresetsTest/ConditionRunTests-test-disabled-stderr.txt
new file mode 100644
index 0000000..5db3b77
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsTest/ConditionRunTests-test-disabled-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: Cannot use disabled test preset in [^
+]*/Tests/RunCMake/CMakePresetsTest/ConditionRunTests: "disabled"$
diff --git a/Tests/RunCMake/CMakePresetsTest/ConditionRunTests.cmake b/Tests/RunCMake/CMakePresetsTest/ConditionRunTests.cmake
new file mode 100644
index 0000000..b29161e
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsTest/ConditionRunTests.cmake
@@ -0,0 +1,2 @@
+enable_testing()
+add_test(true ${CMAKE_COMMAND} -E true)
diff --git a/Tests/RunCMake/CMakePresetsTest/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresetsTest/RunCMakeTest.cmake
index c93dff3..70d25d4 100644
--- a/Tests/RunCMake/CMakePresetsTest/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMakePresetsTest/RunCMakeTest.cmake
@@ -90,6 +90,12 @@ run_cmake_test_presets(InvalidConfigurePreset "default" "" "badConfigurePreset")
set(CMakePresetsTest_NO_CONFIGURE 1)
set(CMakePresetsTest_FILE "${RunCMake_SOURCE_DIR}/Good.json.in")
run_cmake_test_presets(ListPresets "" "" "x" "--list-presets")
+
+set(CMakePresetsTest_FILE "${RunCMake_SOURCE_DIR}/Condition.json.in")
+run_cmake_test_presets(ConditionListPresets "" "" "x" "--list-presets")
+unset(CMakePresetsTest_NO_CONFIGURE)
+run_cmake_test_presets(ConditionRunTests "default" "" "enabled;disabled")
+set(CMakePresetsTest_NO_CONFIGURE 1)
unset(CMakePresetsTest_FILE)
run_cmake_test_presets(NoConfigurePreset "" "" "noConfigurePreset")
@@ -98,6 +104,7 @@ run_cmake_test_presets(Invalid "" "" "hidden;vendorMacro")
set(CMakePresets_SCHEMA_EXPECTED_RESULT 1)
run_cmake_test_presets(PresetsUnsupported "" "" "x")
+run_cmake_test_presets(ConditionFuture "" "" "x")
set(CMakePresets_SCHEMA_EXPECTED_RESULT 0)
set(CMakePresetsTest_NO_CONFIGURE 0)