| 1 |
# |
| 2 |
#//===----------------------------------------------------------------------===// |
| 3 |
#// |
| 4 |
#// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 5 |
#// See https://llvm.org/LICENSE.txt for license information. |
| 6 |
#// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 |
#// |
| 8 |
#//===----------------------------------------------------------------------===// |
| 9 |
# |
| 10 |
|
| 11 |
function(libomp_get_definitions_flags cppflags) |
| 12 |
set(cppflags_local) |
| 13 |
|
| 14 |
if(WIN32) |
| 15 |
libomp_append(cppflags_local "-D _CRT_SECURE_NO_WARNINGS") |
| 16 |
libomp_append(cppflags_local "-D _CRT_SECURE_NO_DEPRECATE") |
| 17 |
libomp_append(cppflags_local "-D _WINDOWS") |
| 18 |
libomp_append(cppflags_local "-D _WINNT") |
| 19 |
if (MSVC) |
| 20 |
# Force a default target OS version with MSVC based toolchains. |
| 21 |
# (For MinGW based ones, use the toolchain's default target or what |
| 22 |
# the user set in CMake flags.) |
| 23 |
libomp_append(cppflags_local "-D _WIN32_WINNT=0x0501") |
| 24 |
endif() |
| 25 |
libomp_append(cppflags_local "-D _USRDLL") |
| 26 |
libomp_append(cppflags_local "-D _ITERATOR_DEBUG_LEVEL=0" IF_TRUE DEBUG_BUILD) |
| 27 |
libomp_append(cppflags_local "-D _DEBUG" IF_TRUE DEBUG_BUILD) |
| 28 |
else() |
| 29 |
libomp_append(cppflags_local "-D _GNU_SOURCE") |
| 30 |
libomp_append(cppflags_local "-D _REENTRANT") |
| 31 |
libomp_append(cppflags_local "-D LIBOMP_HAVE_PTHREAD_SETNAME_NP" LIBOMP_HAVE_PTHREAD_SETNAME_NP) |
| 32 |
libomp_append(cppflags_local "-D LIBOMP_HAVE_PTHREAD_SET_NAME_NP" LIBOMP_HAVE_PTHREAD_SET_NAME_NP) |
| 33 |
endif() |
| 34 |
|
| 35 |
# CMake doesn't include CPPFLAGS from environment, but we will. |
| 36 |
set(${cppflags} ${cppflags_local} ${LIBOMP_CPPFLAGS} $ENV{CPPFLAGS} PARENT_SCOPE) |
| 37 |
endfunction() |