mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
Improve llvm libc++ detection
The old detection did only work if CFLAGS contained -std=c++11, since ciso646 was only included for __cplusplus > 199711. Thanks to Koernel for the cmake part.
This commit is contained in:
parent
57941c83ea
commit
7796ad3a36
@ -185,6 +185,10 @@ AC_LANG_POP(C++)
|
|||||||
|
|
||||||
if test $lyx_cv_lib_stdcxx = "yes" ; then
|
if test $lyx_cv_lib_stdcxx = "yes" ; then
|
||||||
AC_DEFINE(STD_STRING_USES_COW, 1, [std::string uses copy-on-write])
|
AC_DEFINE(STD_STRING_USES_COW, 1, [std::string uses copy-on-write])
|
||||||
|
else
|
||||||
|
if test $lyx_cv_prog_clang = "yes" ; then
|
||||||
|
AC_DEFINE(USE_LLVM_LIBCPP, 1, [use libc++ provided by llvm instead of GNU libstdc++])
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### We might want to get or shut warnings.
|
### We might want to get or shut warnings.
|
||||||
|
@ -139,16 +139,24 @@ check_cxx_source_compiles(
|
|||||||
"
|
"
|
||||||
STD_STRING_USES_COW)
|
STD_STRING_USES_COW)
|
||||||
|
|
||||||
#get_filename_component(cxx_base "${CMAKE_CXX_COMPILER}" NAME_WE)
|
check_cxx_source_compiles(
|
||||||
#if(cxx_base MATCHES "^clang(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\+\\+)?$")
|
"
|
||||||
# set(STD_STRING_USES_COW)
|
#ifndef __clang__
|
||||||
#else()
|
this is not clang
|
||||||
# if("${MINGW}")
|
#endif
|
||||||
# set(STD_STRING_USES_COW)
|
int main() {
|
||||||
# else()
|
return(0);
|
||||||
# set(STD_STRING_USES_COW 1)
|
}
|
||||||
# endif()
|
"
|
||||||
#endif()
|
lyx_cv_prog_clang)
|
||||||
|
|
||||||
|
set(USE_LLVM_LIBCPP)
|
||||||
|
if(NOT STD_STRING_USES_COW)
|
||||||
|
if(lyx_cv_prog_clang)
|
||||||
|
# use libc++ provided by llvm instead of GNU libstdc++
|
||||||
|
set(USE_LLVM_LIBCPP 1)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
if(LYX_USE_QT MATCHES "QT5")
|
if(LYX_USE_QT MATCHES "QT5")
|
||||||
if (Qt5X11Extras_FOUND)
|
if (Qt5X11Extras_FOUND)
|
||||||
|
@ -63,6 +63,9 @@
|
|||||||
// Define if std::string uses copy-on-write
|
// Define if std::string uses copy-on-write
|
||||||
#cmakedefine STD_STRING_USES_COW 1
|
#cmakedefine STD_STRING_USES_COW 1
|
||||||
|
|
||||||
|
// use libc++ provided by llvm instead of GNU libstdc++
|
||||||
|
#cmakedefine USE_LLVM_LIBCPP 1
|
||||||
|
|
||||||
#cmakedefine Z_PREFIX 1
|
#cmakedefine Z_PREFIX 1
|
||||||
|
|
||||||
${Include_used_spellchecker}
|
${Include_used_spellchecker}
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
// Forward definitions do not work with libc++
|
// Forward definitions do not work with libc++
|
||||||
// but ios_base has already been defined in strfwd
|
// but ios_base has already been defined in strfwd
|
||||||
// if compiling with it
|
// if compiling with it
|
||||||
#ifndef _LIBCPP_VERSION
|
#ifndef USE_LLVM_LIBCPP
|
||||||
namespace std {
|
namespace std {
|
||||||
|
|
||||||
class ios_base;
|
class ios_base;
|
||||||
|
@ -13,14 +13,6 @@
|
|||||||
#ifndef STRFWD_H
|
#ifndef STRFWD_H
|
||||||
#define STRFWD_H
|
#define STRFWD_H
|
||||||
|
|
||||||
// This includes does nothing but defining _LIBCPP_VERSION
|
|
||||||
// if libc++ is used (rather than libstdc++) - we first
|
|
||||||
// check if we have at least a c++03 standard before
|
|
||||||
// including the file
|
|
||||||
#if (__cplusplus > 199711L)
|
|
||||||
#include <ciso646>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_WCHAR_T
|
#ifdef USE_WCHAR_T
|
||||||
|
|
||||||
// Prefer this if possible because GNU libstdc++ has usable
|
// Prefer this if possible because GNU libstdc++ has usable
|
||||||
@ -37,7 +29,7 @@ namespace lyx { typedef boost::uint32_t char_type; }
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Forward definitions do not work with libc++
|
// Forward definitions do not work with libc++
|
||||||
#ifdef _LIBCPP_VERSION
|
#ifdef USE_LLVM_LIBCPP
|
||||||
#include <string>
|
#include <string>
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user