Skip to content

Commit 196f133

Browse files
committed
[openmp][cmake] Add 'append' cmake command if it's not already there
1 parent 5d67ce4 commit 196f133

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

openmp/cmake/HandleOpenMPOptions.cmake

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ if (NOT COMMAND append_if)
99
endfunction()
1010
endif()
1111

12+
if (NOT COMMAND append)
13+
function(append value)
14+
foreach(variable ${ARGN})
15+
set(${variable} "${${variable}} ${value}" PARENT_SCOPE)
16+
endforeach(variable)
17+
endfunction()
18+
endif()
19+
1220
# MSVC and clang-cl in compatibility mode map -Wall to -Weverything.
1321
# TODO: LLVM adds /W4 instead, check if that works for the OpenMP runtimes.
1422
if (NOT MSVC)
@@ -44,9 +52,9 @@ append_if(OPENMP_HAVE_DATA_SECTIONS "-fdata-sections" CMAKE_C_FLAGS CMAKE_CXX_FL
4452

4553
if (MSVC)
4654
# Disable "warning C4201: nonstandard extension used: nameless struct/union"
47-
append_if(TRUE "-wd4201" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
55+
append("-wd4201" CMAKE_C_FLAGS CMAKE_CXX_FLAGS )
4856

4957
# Disable "warning C4190: '__kmpc_atomic_cmplx8_rd' has C-linkage specified, but returns
5058
# UDT '__kmp_cmplx64_t' which is incompatible with C"
51-
append_if(TRUE "-wd4190" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
59+
append("-wd4190" CMAKE_C_FLAGS CMAKE_CXX_FLAGS )
5260
endif()

0 commit comments

Comments
 (0)