diff options
author | Brad King <brad.king@kitware.com> | 2021-10-26 19:22:41 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-10-29 15:52:58 (GMT) |
commit | ec8d37b3b1ca10535e219b37cf4889d59b1dfedb (patch) | |
tree | 34b6c70c6de5805b9d0ae51d3966e7d1195799f1 /Tests/RunCMake/GeneratorInstance | |
parent | 8e6d930e8c3fb951e3c4388cc6a9a96dedcb412b (diff) | |
download | CMake-ec8d37b3b1ca10535e219b37cf4889d59b1dfedb.zip CMake-ec8d37b3b1ca10535e219b37cf4889d59b1dfedb.tar.gz CMake-ec8d37b3b1ca10535e219b37cf4889d59b1dfedb.tar.bz2 |
VS: Support version specification in CMAKE_GENERATOR_INSTANCE
Diffstat (limited to 'Tests/RunCMake/GeneratorInstance')
17 files changed, 82 insertions, 1 deletions
diff --git a/Tests/RunCMake/GeneratorInstance/BadFieldDuplicate-result.txt b/Tests/RunCMake/GeneratorInstance/BadFieldDuplicate-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/BadFieldDuplicate-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorInstance/BadFieldDuplicate-stderr.txt b/Tests/RunCMake/GeneratorInstance/BadFieldDuplicate-stderr.txt new file mode 100644 index 0000000..ef71404 --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/BadFieldDuplicate-stderr.txt @@ -0,0 +1,11 @@ +^CMake Error at CMakeLists.txt:[0-9]+ \(project\): + Generator + + Visual Studio [^ +]+ + + given instance specification + + Test Instance,version=1\.2\.3\.4,version=1\.2\.3\.4 + + that contains duplicate field key 'version'\.$ diff --git a/Tests/RunCMake/GeneratorInstance/BadFieldDuplicate.cmake b/Tests/RunCMake/GeneratorInstance/BadFieldDuplicate.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/BadFieldDuplicate.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/GeneratorInstance/BadVersionFormat1-result.txt b/Tests/RunCMake/GeneratorInstance/BadVersionFormat1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/BadVersionFormat1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorInstance/BadVersionFormat1-stderr.txt b/Tests/RunCMake/GeneratorInstance/BadVersionFormat1-stderr.txt new file mode 100644 index 0000000..a0894b6 --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/BadVersionFormat1-stderr.txt @@ -0,0 +1,11 @@ +^CMake Error at CMakeLists.txt:[0-9]+ \(project\): + Generator + + Visual Studio [^ +]+ + + given instance specification + + version=1\.2\.3 + + but the version field is not 4 integer components starting in [0-9]+\.$ diff --git a/Tests/RunCMake/GeneratorInstance/BadVersionFormat1.cmake b/Tests/RunCMake/GeneratorInstance/BadVersionFormat1.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/BadVersionFormat1.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/GeneratorInstance/BadVersionFormat2-result.txt b/Tests/RunCMake/GeneratorInstance/BadVersionFormat2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/BadVersionFormat2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorInstance/BadVersionFormat2-stderr.txt b/Tests/RunCMake/GeneratorInstance/BadVersionFormat2-stderr.txt new file mode 100644 index 0000000..2b3a23b --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/BadVersionFormat2-stderr.txt @@ -0,0 +1,11 @@ +^CMake Error at CMakeLists.txt:[0-9]+ \(project\): + Generator + + Visual Studio [^ +]+ + + given instance specification + + version=1\.2\.3\.x + + but the version field is not 4 integer components starting in [0-9]+\.$ diff --git a/Tests/RunCMake/GeneratorInstance/BadVersionFormat2.cmake b/Tests/RunCMake/GeneratorInstance/BadVersionFormat2.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/BadVersionFormat2.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/GeneratorInstance/BadVersionNumber-result.txt b/Tests/RunCMake/GeneratorInstance/BadVersionNumber-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/BadVersionNumber-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorInstance/BadVersionNumber-stderr.txt b/Tests/RunCMake/GeneratorInstance/BadVersionNumber-stderr.txt new file mode 100644 index 0000000..3a27341 --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/BadVersionNumber-stderr.txt @@ -0,0 +1,9 @@ +^CMake Error at CMakeLists.txt:[0-9] \(project\): + Generator + + Visual Studio [^ +]+ + + could not find specified instance of Visual Studio: + + version=[0-9]+\.999\.99999\.999$ diff --git a/Tests/RunCMake/GeneratorInstance/BadVersionNumber.cmake b/Tests/RunCMake/GeneratorInstance/BadVersionNumber.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/BadVersionNumber.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") diff --git a/Tests/RunCMake/GeneratorInstance/DefaultInstance.cmake b/Tests/RunCMake/GeneratorInstance/DefaultInstance.cmake index 7750c2e..9761f0c 100644 --- a/Tests/RunCMake/GeneratorInstance/DefaultInstance.cmake +++ b/Tests/RunCMake/GeneratorInstance/DefaultInstance.cmake @@ -11,3 +11,4 @@ elseif(NOT IS_DIRECTORY "${CMAKE_GENERATOR_INSTANCE}") " ${CMAKE_GENERATOR_INSTANCE}\n" "which is not an existing directory.") endif() +file(WRITE "${CMAKE_BINARY_DIR}/instance.txt" "${CMAKE_GENERATOR_INSTANCE}") diff --git a/Tests/RunCMake/GeneratorInstance/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorInstance/RunCMakeTest.cmake index 5eeac8e..cdcaac8 100644 --- a/Tests/RunCMake/GeneratorInstance/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorInstance/RunCMakeTest.cmake @@ -1,8 +1,14 @@ include(RunCMake) -if("${RunCMake_GENERATOR}" MATCHES "^Visual Studio 1[56789]") +if("${RunCMake_GENERATOR}" MATCHES "^Visual Studio (1[56789])") + set(vs_major "${CMAKE_MATCH_1}") + set(RunCMake_GENERATOR_INSTANCE "") run_cmake(DefaultInstance) + set(instance_txt "${RunCMake_BINARY_DIR}/DefaultInstance-build/instance.txt") + if(EXISTS "${instance_txt}") + file(READ "${instance_txt}" default_instance) + endif() set(RunCMake_GENERATOR_INSTANCE "${RunCMake_SOURCE_DIR}/instance_does_not_exist") run_cmake(MissingInstance) @@ -14,6 +20,18 @@ if("${RunCMake_GENERATOR}" MATCHES "^Visual Studio 1[56789]") run_cmake(BadFieldNoComma) set(RunCMake_GENERATOR_INSTANCE "Test Instance,unknown=") run_cmake(BadFieldUnknown) + set(RunCMake_GENERATOR_INSTANCE "Test Instance,version=1.2.3.4,version=1.2.3.4") + run_cmake(BadFieldDuplicate) + set(RunCMake_GENERATOR_INSTANCE "version=1.2.3") + run_cmake(BadVersionFormat1) + set(RunCMake_GENERATOR_INSTANCE "version=1.2.3.x") + run_cmake(BadVersionFormat2) + set(RunCMake_GENERATOR_INSTANCE "version=${vs_major}.999.99999.999") + run_cmake(BadVersionNumber) + if(IS_DIRECTORY "${default_instance}") + set(RunCMake_GENERATOR_INSTANCE "${default_instance},version=${vs_major}.999.99999.999") + run_cmake(WrongVersion) + endif() else() set(RunCMake_GENERATOR_INSTANCE "") run_cmake(NoInstance) diff --git a/Tests/RunCMake/GeneratorInstance/WrongVersion-result.txt b/Tests/RunCMake/GeneratorInstance/WrongVersion-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/WrongVersion-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorInstance/WrongVersion-stderr.txt b/Tests/RunCMake/GeneratorInstance/WrongVersion-stderr.txt new file mode 100644 index 0000000..156a9ee --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/WrongVersion-stderr.txt @@ -0,0 +1,10 @@ +^CMake Error at CMakeLists.txt:[0-9] \(project\): + Generator + + Visual Studio [^ +]+ + + could not find specified instance of Visual Studio: + + [^, +]+,version=[0-9]+\.999\.99999\.999$ diff --git a/Tests/RunCMake/GeneratorInstance/WrongVersion.cmake b/Tests/RunCMake/GeneratorInstance/WrongVersion.cmake new file mode 100644 index 0000000..2fc38e5 --- /dev/null +++ b/Tests/RunCMake/GeneratorInstance/WrongVersion.cmake @@ -0,0 +1 @@ +message(FATAL_ERROR "This should not be reached!") |