gemini-code-assist[bot] commented on code in PR #19665:
URL: https://github.com/apache/tvm/pull/19665#discussion_r3351470404


##########
CMakeLists.txt:
##########
@@ -1,6 +1,19 @@
 cmake_minimum_required(VERSION 3.18)
 project(tvm C CXX)
 
+# --- TVM version (no dependency on version.py) ---
+# When built via scikit-build-core the version is resolved by setuptools_scm 
and
+# passed in as SKBUILD_PROJECT_VERSION_FULL; bake it into the C++ TVM_VERSION 
macro.
+# A bare `cmake` build (no scikit-build-core) leaves the checked-in default in
+# include/tvm/runtime/base.h untouched. An explicit -DTVM_VERSION always wins.
+if(NOT DEFINED TVM_VERSION AND DEFINED SKBUILD_PROJECT_VERSION_FULL)
+  set(TVM_VERSION "${SKBUILD_PROJECT_VERSION_FULL}")
+endif()
+if(DEFINED TVM_VERSION)
+  message(STATUS "TVM_VERSION=${TVM_VERSION}")
+  add_compile_definitions(TVM_VERSION="${TVM_VERSION}")

Review Comment:
   ![high](https://www.gstatic.com/codereviewagent/high-priority.svg)
   
   Passing a string macro definition to the compiler via 
`add_compile_definitions` without escaping the quotes will cause the 
preprocessor to receive the value as a bare token (e.g., `0.25.dev0`) instead 
of a C++ string literal. This will result in compilation errors wherever 
`TVM_VERSION` is used in C++ code. Please escape the quotes so that the 
compiler receives a valid string literal.
   
   ```
     add_compile_definitions(TVM_VERSION="\\\"${TVM_VERSION}\\\"")
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to