Skip to content

Commit 7ad7929

Browse files
committed
Work around Arduino's ctags having problems with tempfiles
1 parent 603460c commit 7ad7929

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

toolchain/Scripts/Preprocess.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ function(__arduino_preprocess_sketches SOURCE_DIRPATH MAIN_FILENAME OTHER_FILENA
5858

5959
file(WRITE "${OUTPUT_FILEPATH}" "${_combined_text}")
6060

61+
set(ENV{TMP} "${OUTPUT_DIRPATH}/ctags/first-run") # work around Arduino's ctags having problems with tempfiles
62+
file(MAKE_DIRECTORY "$ENV{TMP}")
63+
6164
__arduino_ctags(_symbols "${OUTPUT_FILEPATH}" --line-directives=no) # <-------- find first declaration in merged C++
6265

6366
list(GET _symbols 0 _first_symbol)
@@ -69,6 +72,9 @@ function(__arduino_preprocess_sketches SOURCE_DIRPATH MAIN_FILENAME OTHER_FILENA
6972
math(EXPR _line_before_first_symbol "${CMAKE_MATCH_1} - 2")
7073
endif()
7174

75+
set(ENV{TMP} "${OUTPUT_DIRPATH}/ctags/second-run") # work around Arduino's ctags having problems with tempfiles
76+
file(MAKE_DIRECTORY "$ENV{TMP}")
77+
7278
__arduino_ctags(_symbols "${OUTPUT_FILEPATH}" --line-directives=yes) # <------- extract declarations from merged C++
7379

7480
unset(_prototypes)

0 commit comments

Comments
 (0)