[CMake] CXX_COMPILE_FEATURES entry for thread safety of static local variable initialization

Daniel Schepler dschepler at scalable-networks.com
Thu May 5 17:00:09 EDT 2016


I don't see this in a quick scan through CMAKE_DIR/share/cmake-3.5/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst.  This would be the C++11 addition under http://en.cppreference.com/w/cpp/language/storage_duration#Static_local_variables - or, the feature matrix at https://msdn.microsoft.com/en-us/library/hh567368.aspx refers to this as "Magic statics" and refers to http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2660.htm .

Before I file a bug requesting an addition for this, I thought I'd check to see if there's something relevant in the C++ feature list that I missed in my quick scan.

For now, I'm using a custom definition of
#define CXX_STATIC_LOCAL_VAR_THREAD_SAFE_INIT \
    (defined(__GNUC__) || defined(__clang__) || \
     (defined(_MSC_VER) && _MSC_VER >= 1900))  // VS 2015 / vc14
(given that the rest of our program has a strong requirement on other C++11 features anyway).
--
Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160505/16909d5e/attachment.html>


More information about the CMake mailing list