[Openvpn-devel,XS] Change in openvpn[master]: CMakeLists.txt: Don't fail on missing compile_commands.json

Message ID 155c753fa722f116571290a8b0d7ca056d4da4e7-HTML@gerrit.openvpn.net
State Not Applicable
Headers show
Series [Openvpn-devel,XS] Change in openvpn[master]: CMakeLists.txt: Don't fail on missing compile_commands.json | expand

Commit Message

flichtenheld (Code Review) Jan. 11, 2024, 1:32 p.m. UTC
Attention is currently required from: flichtenheld, plaisthos.

Hello plaisthos, flichtenheld,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/495?usp=email

to review the following change.


Change subject: CMakeLists.txt: Don't fail on missing compile_commands.json
......................................................................

CMakeLists.txt: Don't fail on missing compile_commands.json

CMAKE_EXPORT_COMPILE_COMMANDS works only on Ninja and Makefile
generators and doesn't produce anything on MSVC.

Due to that, creating symlink for it fails for me.

Fix by make symlink creation non-fatal by providing variable
to store result.

Change-Id: Ic19f859c3aca8b30aa51b12dcb906a6e7e735019
Signed-off-by: Lev Stipakov <lev@openvpn.net>
---
M CMakeLists.txt
1 file changed, 1 insertion(+), 1 deletion(-)



  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/95/495/1

Patch

diff --git a/CMakeLists.txt b/CMakeLists.txt
index bc46c27..5c6fff0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -45,7 +45,7 @@ 
 # Create machine readable compile commands
 set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
 file(CREATE_LINK ${CMAKE_CURRENT_BINARY_DIR}/compile_commands.json
-                 ${CMAKE_CURRENT_SOURCE_DIR}/compile_commands.json SYMBOLIC)
+                 ${CMAKE_CURRENT_SOURCE_DIR}/compile_commands.json RESULT COMPILE_COMMANDS_CREATED SYMBOLIC)
 
 # AddressSanitize - use CXX=clang++ CC=clang cmake -DCMAKE_BUILD_TYPE=asan to build with ASAN
 set(CMAKE_C_FLAGS_ASAN