[llvm-commits] [lld] r171596 - /lld/trunk/CMakeLists.txt

Michael Spencer bigcheesegs at gmail.com
Sat Jan 5 19:31:31 PST 2013


On Sat, Jan 5, 2013 at 6:05 PM, Dmitri Gribenko <gribozavr at gmail.com> wrote:
> On Saturday, January 5, 2013, Michael J. Spencer wrote:
>>
>> Author: mspencer
>> Date: Fri Jan  4 22:16:52 2013
>> New Revision: 171596
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=171596&view=rev
>> Log:
>> [CMake] Don't add flags this late and don't force libc++. Error if we know
>> the compiler doesn't support c++11.
>>
>> Modified:
>>     lld/trunk/CMakeLists.txt
>>
>> Modified: lld/trunk/CMakeLists.txt
>> URL:
>> http://llvm.org/viewvc/llvm-project/lld/trunk/CMakeLists.txt?rev=171596&r1=171595&r2=171596&view=diff
>>
>> ==============================================================================
>> --- lld/trunk/CMakeLists.txt (original)
>> +++ lld/trunk/CMakeLists.txt Fri Jan  4 22:16:52 2013
>> @@ -68,29 +68,26 @@
>>  "`CMakeFiles'. Please delete them.")
>>  endif()
>>
>> -#
>> -# lld now requires C++11 to build
>> -#
>> -# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
>> -if (NOT MSVC)
>> -  include(CheckCXXCompilerFlag)
>> -  check_cxx_compiler_flag("-std=c++0x" SUPPORTS_CXX11_FLAG)
>> -  if( SUPPORTS_CXX11_FLAG )
>> -    message(STATUS "Building with -std=c++0x")
>> -    set(CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")
>> -  else( SUPPORTS_CXX11_FLAG )
>> -    message(WARNING "-std=c++0x not supported.")
>> -  endif()
>> -  check_cxx_compiler_flag("-stdlib=libc++" SUPPORTS_LIBCXX_FLAG)
>> -  if( SUPPORTS_LIBCXX_FLAG )
>> -    message(STATUS "Building with -stdlib=libc++")
>> -    set(CMAKE_CXX_FLAGS "-stdlib=libc++ ${CMAKE_CXX_FLAGS}")
>> -  else( SUPPORTS_LIBCXX_FLAG )
>> -    message(WARNING "-stdlib=libc++ not supported.")
>> +# lld requires c++11 to build. Make sure that we have a compiler and
>> standard
>> +# library combination that can do that.
>> +if (MSVC11)
>> +  # Do nothing, we're good.
>> +elseif (NOT MSVC)
>> +  # gcc and clang require the -std=c++0x or -std=c++11 flag.
>> +  if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR
>> +      "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
>> +    if (NOT ("${CMAKE_CXX_FLAGS}" MATCHES "-std=c\\+\\+0x" OR
>> +             "${CMAKE_CXX_FLAGS}" MATCHES "-std=c\\+\\+11"))
>> +      message(FATAL_ERROR
>> +        "lld requires c++11. Clang and gcc require -std=c++0x or
>> -std=c++11 to "
>> +        "enter this mode. Please set CMAKE_CXX_FLAGS accordingly.")
>> +    endif()
>>    endif()
>
>
> Else (not gcc or clang) error?

Otherwise we assume it's a c++11 compiler.

- Michael Spencer

>
>>
>> +else()
>> +  message(FATAL_ERROR "The selected compiler does not support c++11 which
>> is "
>> +          "required to build lld.")
>>  endif()
>>
>> -
>>  macro(add_lld_library name)
>>    llvm_process_sources(srcs ${ARGN})
>>    if (MSVC_IDE OR XCODE)
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
>
> --
> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/



More information about the llvm-commits mailing list