CMake: Enable debug line tables if BFD found

This commit is contained in:
Jonathan G Rennison
2020-06-30 22:30:29 +01:00
parent 22c3a01069
commit fa42151290

View File

@@ -65,6 +65,16 @@ macro(test_compile_libbfd var libs)
link_libraries(${libs})
endif ()
if (BFD_FOUND)
if (NOT (CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO"))
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
add_compile_options(-gline-tables-only)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options(-g1)
endif ()
endif ()
endif ()
set(CMAKE_REQUIRED_LIBRARIES "")
endmacro()