-
Notifications
You must be signed in to change notification settings - Fork 750
fix: Wrong compiler parameter on MSVC #4778
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Wrong compiler parameter on MSVC #4778
Conversation
lum1n0us
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The -mndirect-branch-register is a Clang-specific option. I would suggest a shorter form like the one below.
if (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register")
endif ()
It seems we should reduce the repetition of this code segment. I suggest moving this piece of code(the optimized version) to config_common.cmake. I haven't tested this idea before, so please let me know if it doesn't work if you decide to give it a try.
I moved these codes to config_common, and i found clang doesn't support |
You are right. My mistaken. |
|
Hi @lum1n0us , Thanks for your review. and I resolved all issues. please have a look |
Co-authored-by: liang.he <[email protected]>
lum1n0us
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
fix wrong compiler param
-mindirect-branch-registeron MSVC