Commit 1a52d3d4 authored by Michael Liao's avatar Michael Liao
Browse files

[cmake] Fix LLVM_USE_SPLIT_DWARF

Summary:
- Add `-gsplit-dwarf` as an option instead of a definition.
- Only add that option on compilers supporting dwarf splitting, such as clang
  and gcc.

Reviewers: echristo, pcc

Subscribers: mgorny, aprantl, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D75328
parent a1f3eb20
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -746,9 +746,15 @@ if(LLVM_USE_SANITIZER)
  endif()
endif()

# Turn on -gsplit-dwarf if requested
if(LLVM_USE_SPLIT_DWARF)
  add_definitions("-gsplit-dwarf")
# Turn on -gsplit-dwarf if requested in debug builds.
if (LLVM_USE_SPLIT_DWARF AND
    ((uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG") OR
     (uppercase_CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO")))
  # Limit to clang and gcc so far. Add compilers supporting this option.
  if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR
      CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
    add_compile_options(-gsplit-dwarf)
  endif()
endif()

add_definitions( -D__STDC_CONSTANT_MACROS )