Skip to content

Commit

Permalink
fix(cmake): fix set_if_higher (deepmodeling#3977)
Browse files Browse the repository at this point in the history
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
- Improved the `set_if_higher` macro to correctly interpret
`${VARIABLE}` as a variable name rather than a string, enhancing
variable comparison accuracy.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
  • Loading branch information
njzjz authored and Mathieu Taillefumier committed Sep 18, 2024
1 parent 26d05f0 commit ee7842d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ set(DEEPMD_C_ROOT

set(CMAKE_CXX_STANDARD 11)
macro(set_if_higher VARIABLE VALUE)
if("${VARIABLE}" LESS "${VALUE}")
# ${VARIABLE} is a variable name, not a string
if(${VARIABLE} LESS "${VALUE}")
set(${VARIABLE} ${VALUE})
endif()
endmacro()
Expand Down

0 comments on commit ee7842d

Please sign in to comment.