[openmp] On Windows, fix standalone cmake build#80174
Conversation
|
@llvm/pr-subscribers-openmp Author: Alexandre Ganea (aganea) ChangesThis fixes: #80117 Full diff: https://github.com/llvm/llvm-project/pull/80174.diff 1 Files Affected:
diff --git a/openmp/cmake/HandleOpenMPOptions.cmake b/openmp/cmake/HandleOpenMPOptions.cmake
index 201aeabbd3df9..79dfa334d749e 100644
--- a/openmp/cmake/HandleOpenMPOptions.cmake
+++ b/openmp/cmake/HandleOpenMPOptions.cmake
@@ -44,9 +44,9 @@ append_if(OPENMP_HAVE_DATA_SECTIONS "-fdata-sections" CMAKE_C_FLAGS CMAKE_CXX_FL
if (MSVC)
# Disable "warning C4201: nonstandard extension used: nameless struct/union"
- append("-wd4201" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+ append_if(TRUE "-wd4201" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
# Disable "warning C4190: '__kmpc_atomic_cmplx8_rd' has C-linkage specified, but returns
# UDT '__kmp_cmplx64_t' which is incompatible with C"
- append("-wd4190" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+ append_if(TRUE "-wd4190" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
endif()
|
| if (MSVC) | ||
| # Disable "warning C4201: nonstandard extension used: nameless struct/union" | ||
| append("-wd4201" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) | ||
| append_if(TRUE "-wd4201" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) |
There was a problem hiding this comment.
Using append_if(TRUE ...) because on MSVC silencing unknown warnings is a silent action.
There was a problem hiding this comment.
Can we just use list(APPEND ...) here?
There was a problem hiding this comment.
string(APPEND ...) perhaps but it needs two lines so it's just shorter to write append_if(TRUE ..)
|
|
|
As suggested. |
| @@ -9,6 +9,14 @@ if (NOT COMMAND append_if) | |||
| endfunction() | |||
There was a problem hiding this comment.
Then here we can just call append
Tested with the status of this PR (4654c3d), and can confirm that windows build succeeds now. Thanks a lot! |
This fixes: llvm#80117 (cherry picked from commit d2565bb)
This fixes: llvm#80117 (cherry picked from commit d2565bb)
This fixes: llvm#80117 (cherry picked from commit d2565bb)
This fixes: llvm#80117 (cherry picked from commit d2565bb)
This fixes: llvm#80117 (cherry picked from commit d2565bb)
This fixes: llvm#80117 (cherry picked from commit d2565bb)
This fixes: #80117