Skip to content

Commit 8955716

Browse files
mszabo-wikiaGitHub Enterprise
authored andcommitted
Automatically symlink compile_commands.json (facebook#110)
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.
1 parent f1dfdf5 commit 8955716

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

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)