File tree Expand file tree Collapse file tree 3 files changed +11
-15
lines changed Expand file tree Collapse file tree 3 files changed +11
-15
lines changed Original file line number Diff line number Diff line change 1- function (link_compile_commands)
1+ function (link_compile_commands name )
22 if (MSVC OR NOT CMAKE_EXPORT_COMPILE_COMMANDS)
33 return ()
44 endif ()
5- set (_current_list_path ${CMAKE_CURRENT_LIST_DIR} )
65
7- string (
8- REGEX
9- REPLACE "\/ |\\ |\ "
10- "_"
11- _dir
12- ${_current_list_path}
13- )
6+ string (REGEX REPLACE "\/ |\\ |\ |\. " "_" _dir ${CMAKE_CURRENT_LIST_DIR} )
7+ string (REGEX REPLACE "\/ |\\ |\ |\. " "_" _name ${name} )
148
15- add_custom_target (
16- ${_dir} _compile_commands ALL
17- COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR} /compile_commands.json
18- ${_current_list_path} /compile_commands.json
9+ set (cmd_target "${CMAKE_CURRENT_LIST_DIR} /${name} " )
10+ add_custom_command (
11+ OUTPUT ${cmd_target}
12+ COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_BINARY_DIR} /${name} "
13+ "${CMAKE_CURRENT_LIST_DIR} /${name} "
1914 )
2015
16+ add_custom_target (${_dir} _${name} ALL DEPENDS ${cmd_target} )
2117endfunction ()
Original file line number Diff line number Diff line change 1- link_compile_commands()
1+ link_compile_commands(compile_commands.json )
22
33file (GLOB_RECURSE SOURCE_FILES "${CMAKE_SOURCE_DIR} /src/*.cpp" )
44list (REMOVE_ITEM SOURCE_FILES ${MAIN} )
Original file line number Diff line number Diff line change 1- link_compile_commands()
1+ link_compile_commands(compile_commands.json )
22
33file (GLOB_RECURSE TEST_FILES "${CMAKE_SOURCE_DIR} /tests/*.cpp" )
44add_executable (${TEST_NAME} ${TEST_FILES} )
You can’t perform that action at this time.
0 commit comments