summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/ExportCompileCommands/BeforeProject-check.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-05-12 11:48:17 (GMT)
committerBrad King <brad.king@kitware.com>2020-05-12 12:08:20 (GMT)
commitfe19df49d48680cbfd8e1023d4a93b39f12d4b64 (patch)
treef976accb2ab186b588431acf93c93c0c0626d642 /Tests/RunCMake/ExportCompileCommands/BeforeProject-check.cmake
parent4dc95526868d903c7f9e9505001cb5dbeec259c0 (diff)
downloadCMake-fe19df49d48680cbfd8e1023d4a93b39f12d4b64.zip
CMake-fe19df49d48680cbfd8e1023d4a93b39f12d4b64.tar.gz
CMake-fe19df49d48680cbfd8e1023d4a93b39f12d4b64.tar.bz2
Initialize CMAKE_EXPORT_COMPILE_COMMANDS only if not set already
Also de-duplicate its initialization code. Fixes: #16588
Diffstat (limited to 'Tests/RunCMake/ExportCompileCommands/BeforeProject-check.cmake')
-rw-r--r--Tests/RunCMake/ExportCompileCommands/BeforeProject-check.cmake4
1 files changed, 4 insertions, 0 deletions
diff --git a/Tests/RunCMake/ExportCompileCommands/BeforeProject-check.cmake b/Tests/RunCMake/ExportCompileCommands/BeforeProject-check.cmake
new file mode 100644
index 0000000..87058e2
--- /dev/null
+++ b/Tests/RunCMake/ExportCompileCommands/BeforeProject-check.cmake
@@ -0,0 +1,4 @@
+if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/compile_commands.json")
+ set(RunCMake_TEST_FAILED "compile_commands.json not generated")
+ return()
+endif()