add_custom_command: Add tests for rejecting literal quotes in commands

This commit is contained in:
Daniel Eiband
2019-09-14 21:44:42 +02:00
parent e893ab94ba
commit 3061dc6ac9
14 changed files with 42 additions and 0 deletions

View File

@@ -0,0 +1 @@
1

View File

@@ -0,0 +1,7 @@
CMake Error at AppendLiteralQuotes.cmake:2 \(add_custom_command\):
COMMAND may not contain literal quotes:
"c"
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

View File

@@ -0,0 +1,2 @@
add_custom_command(OUTPUT a COMMAND b)
add_custom_command(OUTPUT a COMMAND "\"c\"" APPEND)

View File

@@ -0,0 +1 @@
1

View File

@@ -0,0 +1,7 @@
CMake Error at LiteralQuotes.cmake:1 \(add_custom_command\):
COMMAND may not contain literal quotes:
"b"
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

View File

@@ -0,0 +1 @@
add_custom_command(OUTPUT a COMMAND "\"b\"")

View File

@@ -1,15 +1,18 @@
include(RunCMake)
run_cmake(AppendLiteralQuotes)
run_cmake(AppendNoOutput)
run_cmake(AppendNotOutput)
run_cmake(BadArgument)
run_cmake(GeneratedProperty)
run_cmake(LiteralQuotes)
run_cmake(NoArguments)
run_cmake(NoOutputOrTarget)
run_cmake(OutputAndTarget)
run_cmake(SourceByproducts)
run_cmake(SourceUsesTerminal)
run_cmake(TargetImported)
run_cmake(TargetLiteralQuotes)
run_cmake(TargetNotInDir)
if(${RunCMake_GENERATOR} MATCHES "Visual Studio ([^89]|[89][0-9])")

View File

@@ -0,0 +1 @@
1

View File

@@ -0,0 +1,7 @@
CMake Error at TargetLiteralQuotes.cmake:2 \(add_custom_command\):
COMMAND may not contain literal quotes:
"b"
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

View File

@@ -0,0 +1,2 @@
add_library(a)
add_custom_command(TARGET a POST_BUILD COMMAND "\"b\"")

View File

@@ -0,0 +1 @@
1

View File

@@ -0,0 +1,7 @@
CMake Error at LiteralQuotes.cmake:1 \(add_custom_target\):
COMMAND may not contain literal quotes:
"b"
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

View File

@@ -0,0 +1 @@
add_custom_target(a COMMAND "\"b\"")

View File

@@ -5,6 +5,7 @@ run_cmake(GeneratedProperty)
run_cmake(NoArguments)
run_cmake(BadTargetName)
run_cmake(ByproductsNoCommand)
run_cmake(LiteralQuotes)
run_cmake(UsesTerminalNoCommand)
function(run_TargetOrder)