From 2d49342ce39a2f6177ce8f460d454932f4c90bc2 Mon Sep 17 00:00:00 2001 From: Kornel Benko Date: Sun, 7 Aug 2016 11:32:53 +0200 Subject: [PATCH] Cmake build: Amend 41e409f8: Use std::call_once only if it is actually available --- development/cmake/ConfigureChecks.cmake | 11 +++++++++++ development/cmake/config.h.cmake | 3 +++ 2 files changed, 14 insertions(+) diff --git a/development/cmake/ConfigureChecks.cmake b/development/cmake/ConfigureChecks.cmake index 146330a56a..61190c8655 100644 --- a/development/cmake/ConfigureChecks.cmake +++ b/development/cmake/ConfigureChecks.cmake @@ -184,6 +184,17 @@ check_cxx_source_compiles( " HAVE_DEF_MAKE_UNIQUE) +check_cxx_source_compiles( + " + #include + static std::once_flag flag; + int main() { + std::call_once(flag, [](){ return; }); + return(0); + } + " +LYX_USE_STD_CALL_ONCE) + set(USE_LLVM_LIBCPP) set(STD_STRING_USES_COW) set(USE_GLIBCXX_CXX11_ABI) diff --git a/development/cmake/config.h.cmake b/development/cmake/config.h.cmake index 95148b61e7..dbd2c83bc7 100644 --- a/development/cmake/config.h.cmake +++ b/development/cmake/config.h.cmake @@ -91,6 +91,9 @@ ${Include_used_spellchecker} #cmakedefine HAVE_DEF_MAKE_UNIQUE 1 +// Define to 1 if std::call_once is supported by the compiler +#cmakedefine LYX_USE_STD_CALL_ONCE 1 + #endif // config.h guard