|
@@ -3,31 +3,32 @@ if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/compile_commands.json")
|
|
return()
|
|
return()
|
|
endif()
|
|
endif()
|
|
|
|
|
|
|
|
+set(ESCAPED_BINARY_DIR [==[[^
|
|
|
|
+]*/Tests/RunCMake/Swift/CompileCommands-build]==])
|
|
|
|
+set(E_SOURCE_PATH [==[(\\")?[^
|
|
|
|
+]*(/Tests/RunCMake/Swift/E.swift|\\\\Tests\\\\RunCMake\\\\Swift\\\\E.swift)(\\")?]==])
|
|
|
|
+set(L_SOURCE_PATH [==[(\\")?[^
|
|
|
|
+]*(/Tests/RunCMake/Swift/L.swift|\\\\Tests\\\\RunCMake\\\\Swift\\\\L.swift)(\\")?]==])
|
|
|
|
+
|
|
# The compile command for both files should contain all Swift source files in
|
|
# The compile command for both files should contain all Swift source files in
|
|
# the module
|
|
# the module
|
|
set(expected_compile_commands
|
|
set(expected_compile_commands
|
|
[==[^\[
|
|
[==[^\[
|
|
{
|
|
{
|
|
- "directory": "[^
|
|
|
|
-]*/Tests/RunCMake/Swift/CompileCommands-build",
|
|
|
|
|
|
+ "directory": "${BINARY_DIR}",
|
|
"command": "[^
|
|
"command": "[^
|
|
]*swiftc[^
|
|
]*swiftc[^
|
|
-]* (\\")?[^
|
|
|
|
-]*(/Tests/RunCMake/Swift/E.swift|\\\\Tests\\\\RunCMake\\\\Swift\\\\E.swift)(\\")? (\\")?[^
|
|
|
|
-]*(/Tests/RunCMake/Swift/L.swift|\\\\Tests\\\\RunCMake\\\\Swift\\\\L.swift)(\\")?",
|
|
|
|
|
|
+]* ${E_SOURCE_PATH} ${L_SOURCE_PATH}",
|
|
"file": "[^
|
|
"file": "[^
|
|
]*/Tests/RunCMake/Swift/E.swift",
|
|
]*/Tests/RunCMake/Swift/E.swift",
|
|
"output": "[^
|
|
"output": "[^
|
|
]*/CMakeFiles/CompileCommandLib.dir/(Debug/)?E.swift.(o|obj)"
|
|
]*/CMakeFiles/CompileCommandLib.dir/(Debug/)?E.swift.(o|obj)"
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- "directory": "[^
|
|
|
|
-]*/Tests/RunCMake/Swift/CompileCommands-build",
|
|
|
|
|
|
+ "directory": "${BINARY_DIR}",
|
|
"command": "[^
|
|
"command": "[^
|
|
]*swiftc[^
|
|
]*swiftc[^
|
|
-]* (\\")?[^
|
|
|
|
-]*(/Tests/RunCMake/Swift/E.swift|\\\\Tests\\\\RunCMake\\\\Swift\\\\E.swift)(\\")? (\\")?[^
|
|
|
|
-]*(/Tests/RunCMake/Swift/L.swift|\\\\Tests\\\\RunCMake\\\\Swift\\\\L.swift)(\\")?",
|
|
|
|
|
|
+]* ${E_SOURCE_PATH} ${L_SOURCE_PATH}",
|
|
"file": "[^
|
|
"file": "[^
|
|
]*/Tests/RunCMake/Swift/L.swift",
|
|
]*/Tests/RunCMake/Swift/L.swift",
|
|
"output": "[^
|
|
"output": "[^
|
|
@@ -35,6 +36,10 @@ set(expected_compile_commands
|
|
}]==]
|
|
}]==]
|
|
)
|
|
)
|
|
|
|
|
|
|
|
+string(REPLACE [=[${BINARY_DIR}]=] "${ESCAPED_BINARY_DIR}" expected_compile_commands "${expected_compile_commands}")
|
|
|
|
+string(REPLACE [=[${E_SOURCE_PATH}]=] "${E_SOURCE_PATH}" expected_compile_commands "${expected_compile_commands}")
|
|
|
|
+string(REPLACE [=[${L_SOURCE_PATH}]=] "${L_SOURCE_PATH}" expected_compile_commands "${expected_compile_commands}")
|
|
|
|
+
|
|
file(READ "${RunCMake_TEST_BINARY_DIR}/compile_commands.json" compile_commands)
|
|
file(READ "${RunCMake_TEST_BINARY_DIR}/compile_commands.json" compile_commands)
|
|
if(NOT compile_commands MATCHES "${expected_compile_commands}")
|
|
if(NOT compile_commands MATCHES "${expected_compile_commands}")
|
|
string(REPLACE "\n" "\n " expected_compile_commands_formatted "${expected_compile_commands}")
|
|
string(REPLACE "\n" "\n " expected_compile_commands_formatted "${expected_compile_commands}")
|