Supporting MSVC2010 in ktexteditor framework

Allen Winter winter at kde.org
Wed Nov 5 13:23:48 UTC 2014


On Wednesday, November 05, 2014 12:33:58 AM Nicolás Alvarez wrote:
> Hi all,
> 
> According to https://community.kde.org/Frameworks/C++11, KDE
> Frameworks support MSVC2010 and later versions. Since ktexteditor is
> part of KF5, it is supposed to work on MSVC2010. It currently doesn't;
> several unsupported C++11 features were introduced to the library in
> the past few months.
> 
> We really really need a Windows CI so that this is noticed early :(
> 
> The unsupported C++ features include:
> - brace initialization: Cursor x = {0,0}; or return {};
> - delegating constructors
> - range-based for loops
> - initializing class members inside the class declaration instead of
> doing it in the constructor: class Foo { int x=42; }; (N2756)
> - not specifying the return type of lambdas: auto f = []() { return 42; }
> 
> I attached the patch that makes ktexteditor build with MSVC2010,
> except for a unit test where there's WAY too many brace-init. In my
> opinion, the code looks cleaner with these C++11 features, ie. before
> the patch.
> 
> So, I hereby propose making an exception and bumping the minimum
> compiler version *for ktexteditor only* to MSVC2012. Opinions?
> 
> 
Let's put something like this in our top-level CMake stuff (copy+pasted from GammaRay):

# Exit for blacklisted compilers (those that don't support C++11 very well)
#  MSVC++ 8.0  _MSC_VER == 1400 (Visual Studio 2005)
#  Clang 3.0
set(BAD_CXX_MESSAGE "")
if(MSVC)
  if(MSVC_VERSION LESS 1500)
    set(BAD_CXX_MESSAGE "MSVC 2008 or higher")
  endif()
endif()
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
  if(${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 3.1.0)
    set(BAD_CXX_MESSAGE "Clang v3.1.0 or higher")
  endif()
endif()
if(BAD_CXX_MESSAGE)
  message(FATAL_ERROR "\nSorry, ${BAD_CXX_MESSAGE} is required to build this software. Please retry using a modern compiler that supports C++11 lambdas.")
endif()



More information about the Kde-frameworks-devel mailing list