summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-11-23 16:19:47 +0000
committerKitware Robot <kwrobot@kitware.com>2020-11-23 11:19:58 -0500
commited049d167868e20769088d4460fe3724518fbe7d (patch)
tree1ed4139e52cca410f636336a996ed978238843d5 /Tests
parent4549027a09756d7421651bc8312e4619707f076d (diff)
parent67e2130c963bb3d9d437f00f5d6b8e95d2f5fb18 (diff)
downloadcmake-ed049d167868e20769088d4460fe3724518fbe7d.tar.gz
Merge topic 'fix-compile-db-crash' into release-3.19
67e2130c96 Makefiles: Fix CMAKE_EXPORT_COMPILE_COMMANDS crash with custom compile rule Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5521
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/ExportCompileCommands/CustomCompileRule.cmake5
-rw-r--r--Tests/RunCMake/ExportCompileCommands/RunCMakeTest.cmake1
2 files changed, 6 insertions, 0 deletions
diff --git a/Tests/RunCMake/ExportCompileCommands/CustomCompileRule.cmake b/Tests/RunCMake/ExportCompileCommands/CustomCompileRule.cmake
new file mode 100644
index 0000000000..12368a29bd
--- /dev/null
+++ b/Tests/RunCMake/ExportCompileCommands/CustomCompileRule.cmake
@@ -0,0 +1,5 @@
+enable_language(C)
+add_library(empty STATIC empty.c)
+string(REPLACE "<DEFINES>" "" CMAKE_C_COMPILE_OBJECT "${CMAKE_C_COMPILE_OBJECT}")
+string(REPLACE "<INCLUDES>" "" CMAKE_C_COMPILE_OBJECT "${CMAKE_C_COMPILE_OBJECT}")
+set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
diff --git a/Tests/RunCMake/ExportCompileCommands/RunCMakeTest.cmake b/Tests/RunCMake/ExportCompileCommands/RunCMakeTest.cmake
index b540a04505..9e7e732190 100644
--- a/Tests/RunCMake/ExportCompileCommands/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ExportCompileCommands/RunCMakeTest.cmake
@@ -1,3 +1,4 @@
include(RunCMake)
run_cmake_with_options(BeforeProject -DCMAKE_PROJECT_INCLUDE_BEFORE=BeforeProjectBEFORE.cmake)
+run_cmake(CustomCompileRule)