Skip to content

Commit 0036aaf

Browse files
authored
Merge pull request #22 from sourcehold/cmake-generate-lf-list-files
[PROJECT] Made file lists script always emit LF line endings
2 parents d41783d + a097892 commit 0036aaf

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

create-include-lists.cmake

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Usage: cmake -P generate_file_list.cmake
66
# ======================================================================
77

8-
cmake_minimum_required(VERSION 3.10)
8+
cmake_minimum_required(VERSION 3.20)
99

1010
function(generate_file_list SOURCE_ROOT PATTERNS_LIST OUTPUT_FILE)
1111
set(ALL_ENTRIES "")
@@ -32,7 +32,13 @@ function(generate_file_list SOURCE_ROOT PATTERNS_LIST OUTPUT_FILE)
3232

3333
# 5. Generate output file
3434
string(JOIN "\n" FILES_ONLY_STRING ${FILES_ONLY})
35-
file(WRITE "${OUTPUT_FILE}" "${FILES_ONLY_STRING}\n")
35+
file(WRITE "${OUTPUT_FILE}.temp" "${FILES_ONLY_STRING}\n")
36+
37+
# 6. Convert line endings
38+
configure_file("${OUTPUT_FILE}.temp" "${OUTPUT_FILE}" @ONLY NEWLINE_STYLE LF)
39+
40+
# 7. Remove temp file
41+
file(REMOVE "${OUTPUT_FILE}.temp")
3642

3743
message(STATUS "Generated file list in: ${OUTPUT_FILE}")
3844
endfunction()

0 commit comments

Comments
 (0)