mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-25 04:51:38 +00:00
[CMake] Don't add flags this late and don't force libc++. Error if we know the compiler doesn't support c++11.
llvm-svn: 171596
This commit is contained in:
parent
4a7c311008
commit
c4048062e5
@ -68,29 +68,26 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
|
|||||||
"`CMakeFiles'. Please delete them.")
|
"`CMakeFiles'. Please delete them.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#
|
# lld requires c++11 to build. Make sure that we have a compiler and standard
|
||||||
# lld now requires C++11 to build
|
# library combination that can do that.
|
||||||
#
|
if (MSVC11)
|
||||||
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
# Do nothing, we're good.
|
||||||
if (NOT MSVC)
|
elseif (NOT MSVC)
|
||||||
include(CheckCXXCompilerFlag)
|
# gcc and clang require the -std=c++0x or -std=c++11 flag.
|
||||||
check_cxx_compiler_flag("-std=c++0x" SUPPORTS_CXX11_FLAG)
|
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR
|
||||||
if( SUPPORTS_CXX11_FLAG )
|
"${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||||
message(STATUS "Building with -std=c++0x")
|
if (NOT ("${CMAKE_CXX_FLAGS}" MATCHES "-std=c\\+\\+0x" OR
|
||||||
set(CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")
|
"${CMAKE_CXX_FLAGS}" MATCHES "-std=c\\+\\+11"))
|
||||||
else( SUPPORTS_CXX11_FLAG )
|
message(FATAL_ERROR
|
||||||
message(WARNING "-std=c++0x not supported.")
|
"lld requires c++11. Clang and gcc require -std=c++0x or -std=c++11 to "
|
||||||
endif()
|
"enter this mode. Please set CMAKE_CXX_FLAGS accordingly.")
|
||||||
check_cxx_compiler_flag("-stdlib=libc++" SUPPORTS_LIBCXX_FLAG)
|
endif()
|
||||||
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.")
|
|
||||||
endif()
|
endif()
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "The selected compiler does not support c++11 which is "
|
||||||
|
"required to build lld.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
macro(add_lld_library name)
|
macro(add_lld_library name)
|
||||||
llvm_process_sources(srcs ${ARGN})
|
llvm_process_sources(srcs ${ARGN})
|
||||||
if (MSVC_IDE OR XCODE)
|
if (MSVC_IDE OR XCODE)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user