- execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
- message(STATUS "Using GCC version ${GCC_VERSION}")
- if(NOT GCC_VERSION VERSION_LESS 4.4)
- set(LYX_USE_TR1 1)
- # GCC <= 4.5 does not support regex: there are linker errors
- # http://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.tr1
- set(LYX_USE_TR1_REGEX 0)
- endif()
- if (LYX_ENABLE_CXX11)
- find_package(CXX11Compiler)
- if(NOT CXX11COMPILER_FOUND)
- message(FATAL_ERROR "A C++11 compatible compiler is required.")
- endif()
- set(LYX_GCC11_MODE "${CXX11_FLAG}")
- endif()
- set(STD_STRING_USES_COW 1)
-else()
- if(MSVC10)
- set(LYX_USE_TR1 1)
- #set(LYX_USE_TR1_REGEX 1) #TODO should we use it in ECMAScript mode?
+ if (CMAKE_CXX_COMPILER_ID MATCHES "^[cC]lang$")
+ # ignore the GCC_VERSION for clang
+ # and use the resulting CXX11_STD_REGEX found in FindCXX11Compiler.cmake
+ message(STATUS "Using clang")
+ if(CXX11_STD_REGEX)
+ set(LYX_USE_STD_REGEX 1)
+ else()
+ set(LYX_USE_STD_REGEX 0)
+ endif()