Skip to content

Commit f1d86bb

Browse files
geofftjcwchen
andauthored
CMakeLists: Do not write generated files to the source dir (onnx#3667)
This makes sure that out-of-source builds can be performed cleanly, and in particular that multiple out-of-source builds can be performed from the same directory. After this commit, you can run cmake with a read-only source directory. Signed-off-by: Geoffrey Thomas <[email protected]> Co-authored-by: Chun-Wei Chen <[email protected]>
1 parent f4687ed commit f1d86bb

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,10 +277,14 @@ function(RELATIVE_PROTOBUF_GENERATE_CPP NAME SRCS HDRS ROOT_DIR DEPEND)
277277
# use PYTHON_EXECUTABLE to python protoc-gen-mypy.py
278278
configure_file(
279279
${ROOT_DIR}/tools/protoc-gen-mypy.sh.in
280-
${ROOT_DIR}/tools/protoc-gen-mypy.sh
280+
${PROJECT_BINARY_DIR}/tools/protoc-gen-mypy.sh
281281
@ONLY)
282-
execute_process(COMMAND chmod +x ${ROOT_DIR}/tools/protoc-gen-mypy.sh)
283-
set(PROTOC_MYPY_PLUGIN_FILE ${ROOT_DIR}/tools/protoc-gen-mypy.sh)
282+
execute_process(COMMAND chmod +x ${PROJECT_BINARY_DIR}/tools/protoc-gen-mypy.sh)
283+
configure_file(
284+
${ROOT_DIR}/tools/protoc-gen-mypy.py
285+
${PROJECT_BINARY_DIR}/tools/protoc-gen-mypy.py
286+
COPYONLY)
287+
set(PROTOC_MYPY_PLUGIN_FILE ${PROJECT_BINARY_DIR}/tools/protoc-gen-mypy.sh)
284288
else()
285289
set(PROTOC_MYPY_PLUGIN_FILE ${ROOT_DIR}/tools/protoc-gen-mypy.bat)
286290
endif()

0 commit comments

Comments
 (0)