forked from OSchip/llvm-project
[flang] More Clang work.
Original-commit: flang-compiler/f18@7ff98ad778 Reviewed-on: https://github.com/flang-compiler/f18/pull/73 Tree-same-pre-rewrite: false
This commit is contained in:
parent
3fd2c17cf2
commit
9702fcaf97
|
@ -10,27 +10,24 @@ cmake_minimum_required(VERSION 3.9.0)
|
|||
#
|
||||
|
||||
# Pass '-DPGI=1' to cmake to use the latest gcc installation at PGI.
|
||||
# Add '-DCLANG=1' to use clang and libc++.
|
||||
if( PGI )
|
||||
set(GCC /home/sw/thirdparty/gcc/gcc-7.3.0/linux86-64/redhat)
|
||||
if(CLANG)
|
||||
set(CLANG /home/sw/thirdparty/llvm/linux86-64/6.0-pgi2)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Pass -DGCC=... to cmake to use a specific gcc installation
|
||||
if( GCC )
|
||||
if (CLANG)
|
||||
set(CMAKE_CXX_COMPILER "${CLANG}/bin/clang++")
|
||||
set(CMAKE_CC_COMPILER "${CLANG}/bin/clang")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
||||
else()
|
||||
set(CMAKE_CXX_COMPILER "${GCC}/bin/g++")
|
||||
set(CMAKE_CC_COMPILER "${GCC}/bin/gcc")
|
||||
endif()
|
||||
set(CMAKE_CXX_COMPILER "${GCC}/bin/g++")
|
||||
set(CMAKE_CC_COMPILER "${GCC}/bin/gcc")
|
||||
set(CMAKE_INSTALL_RPATH "${GCC}/lib64")
|
||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH true)
|
||||
endif()
|
||||
if(CLANG)
|
||||
set(CMAKE_CXX_COMPILER "${CLANG}/bin/clang")
|
||||
set(CMAKE_CC_COMPILER "${CLANG}/bin/clang")
|
||||
if(GCC)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --gcc-toolchain=${GCC}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Reminder: Setting CMAKE_CXX_COMPILER must be done before calling project()
|
||||
|
||||
|
@ -42,8 +39,11 @@ endif()
|
|||
message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}")
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
|
||||
if(CLANG)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lstdc++")
|
||||
if(GCC)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --gcc-toolchain=${GCC}")
|
||||
endif()
|
||||
endif()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic")
|
||||
|
|
Loading…
Reference in New Issue