diff options
author | Petr Hosek <phosek@chromium.org> | 2019-05-30 04:40:21 +0000 |
---|---|---|
committer | Petr Hosek <phosek@chromium.org> | 2019-05-30 04:40:21 +0000 |
commit | 789b7f0828b08f5c4bf9ff1ff7ef733c73ecdc0a (patch) | |
tree | 529f48a2d6693be385cf978860ec04995e6dfe86 /libcxx/cmake | |
parent | 2c91c3b7af7cd4da64f1babde3798d65522a21e4 (diff) | |
download | bcm5719-llvm-789b7f0828b08f5c4bf9ff1ff7ef733c73ecdc0a.tar.gz bcm5719-llvm-789b7f0828b08f5c4bf9ff1ff7ef733c73ecdc0a.zip |
[runtimes] Check if pragma comment(lib, ...) is supported first
This fixes the issue introduced by r362048 where we always use
pragma comment(lib, ...) for dependent libraries when the compiler
is Clang, but older Clang versions don't support this pragma so
we need to check first if it's supported before using it.
llvm-svn: 362055
Diffstat (limited to 'libcxx/cmake')
-rw-r--r-- | libcxx/cmake/config-ix.cmake | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libcxx/cmake/config-ix.cmake b/libcxx/cmake/config-ix.cmake index 23ae71025e5..b2d275bbb25 100644 --- a/libcxx/cmake/config-ix.cmake +++ b/libcxx/cmake/config-ix.cmake @@ -1,6 +1,7 @@ include(CheckLibraryExists) include(CheckCCompilerFlag) include(CheckCXXCompilerFlag) +include(CheckCSourceCompiles) if(WIN32 AND NOT MINGW) # NOTE(compnerd) this is technically a lie, there is msvcrt, but for now, lets @@ -59,6 +60,14 @@ if (LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG) endif () endif () +# Check compiler pragmas +if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + check_c_source_compiles(" +#pragma comment(lib, \"c\") +int main() { return 0; } +" LIBCXX_HAS_COMMENT_LIB_PRAGMA) +endif() + if(NOT WIN32 OR MINGW) include(CheckLibcxxAtomic) endif() @@ -72,7 +81,6 @@ check_cxx_compiler_flag(/EHs- LIBCXX_HAS_NO_EHS_FLAG) check_cxx_compiler_flag(/EHa- LIBCXX_HAS_NO_EHA_FLAG) check_cxx_compiler_flag(/GR- LIBCXX_HAS_NO_GR_FLAG) - # Check libraries if(WIN32 AND NOT MINGW) # TODO(compnerd) do we want to support an emulation layer that allows for the |