Skip to content

Commit 22c0f5f

Browse files
mszabo-wikiameta-codesync[bot]
authored andcommitted
Automatically symlink compile_commands.json (facebook#9667)
Summary: compile_commands.json allows IDEs to provide go-to definition etc. support, but it gets generated in CMAKE_BINARY_DIR, which may be out of tree when doing an out-of-source build. So, symlink it automatically to allow IDEs to pick it up. Pull Request resolved: facebook#9667 Reviewed By: Wilfred Differential Revision: D86967061 fbshipit-source-id: 9e6501d93ef3623b600a080180566019da11a5b9
1 parent 9aeb4e3 commit 22c0f5f

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
55

66
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
77

8+
# Create symlink to compile_commands.json for IDE to pick it up
9+
execute_process(
10+
COMMAND
11+
${CMAKE_COMMAND} -E create_symlink
12+
${CMAKE_BINARY_DIR}/compile_commands.json
13+
${CMAKE_CURRENT_SOURCE_DIR}/compile_commands.json)
14+
815
# includes
916
SET(
1017
CMAKE_MODULE_PATH

0 commit comments

Comments
 (0)