Skip to content

Commit 39b1133

Browse files
committed
split Rust toolchain data to cmake/rust-toolchain.cmake file
1 parent 02d26b8 commit 39b1133

2 files changed

Lines changed: 13 additions & 12 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,7 @@ if (NOT RUSTC_LLVM_VERSION STREQUAL LLVM_PACKAGE_VERSION)
6363
message(WARNING "The LLVM versions used by rustc and clang are different!")
6464
endif()
6565

66-
set(RUST_STABLE_VERSION "1.95.0")
67-
68-
function(write_rust_toolchain DIR)
69-
set(_content "[toolchain]\nchannel = \"${RUST_STABLE_VERSION}\"\n")
70-
set(_file ${DIR}/rust-toolchain.toml)
71-
if (EXISTS ${_file})
72-
file(READ ${_file} _existing)
73-
endif()
74-
if (NOT "${_existing}" STREQUAL "${_content}")
75-
file(WRITE ${_file} ${_content})
76-
endif()
77-
endfunction()
66+
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/rust-toolchain.cmake)
7867

7968
# rule-preprocessor uses nightly
8069
foreach(_dir libcc2rs rules)

cmake/rust-toolchain.cmake

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
set(RUST_STABLE_VERSION "1.95.0")
2+
3+
function(write_rust_toolchain DIR)
4+
set(_content "[toolchain]\nchannel = \"${RUST_STABLE_VERSION}\"\n")
5+
set(_file ${DIR}/rust-toolchain.toml)
6+
if (EXISTS ${_file})
7+
file(READ ${_file} _existing)
8+
endif()
9+
if (NOT "${_existing}" STREQUAL "${_content}")
10+
file(WRITE ${_file} ${_content})
11+
endif()
12+
endfunction()

0 commit comments

Comments
 (0)