diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:01:22 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:01:22 +0000 |
commit | 71d5a2540a98c81f5bcaeb48805e0e2881f530ef (patch) | |
tree | 5343938942df402b49ec7300a1c25a2d4ccd5821 /cmake/modules/AddLLVM.cmake | |
parent | 31bbf64f3a4974a2d6c8b3b27ad2f519caf74057 (diff) |
Diffstat (limited to 'cmake/modules/AddLLVM.cmake')
-rwxr-xr-x | cmake/modules/AddLLVM.cmake | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake index b3c7746c480a..7f7608cff33d 100755 --- a/cmake/modules/AddLLVM.cmake +++ b/cmake/modules/AddLLVM.cmake @@ -718,11 +718,11 @@ macro(add_llvm_executable name) if(NOT ARG_IGNORE_EXTERNALIZE_DEBUGINFO) llvm_externalize_debuginfo(${name}) endif() - if (PTHREAD_LIB) + if (LLVM_PTHREAD_LIB) # libpthreads overrides some standard library symbols, so main # executable must be linked with it in order to provide consistent # API for all shared libaries loaded by this executable. - target_link_libraries(${name} ${PTHREAD_LIB}) + target_link_libraries(${name} ${LLVM_PTHREAD_LIB}) endif() endmacro(add_llvm_executable name) @@ -1027,7 +1027,7 @@ function(add_unittest test_suite test_name) # libpthreads overrides some standard library symbols, so main # executable must be linked with it in order to provide consistent # API for all shared libaries loaded by this executable. - target_link_libraries(${test_name} gtest_main gtest ${PTHREAD_LIB}) + target_link_libraries(${test_name} gtest_main gtest ${LLVM_PTHREAD_LIB}) add_dependencies(${test_suite} ${test_name}) get_target_property(test_suite_folder ${test_suite} FOLDER) @@ -1387,7 +1387,11 @@ function(llvm_externalize_debuginfo name) endif() if(NOT LLVM_EXTERNALIZE_DEBUGINFO_SKIP_STRIP) - set(strip_command COMMAND xcrun strip -Sxl $<TARGET_FILE:${name}>) + if(APPLE) + set(strip_command COMMAND xcrun strip -Sxl $<TARGET_FILE:${name}>) + else() + set(strip_command COMMAND strip -gx $<TARGET_FILE:${name}>) + endif() endif() if(APPLE) @@ -1403,7 +1407,11 @@ function(llvm_externalize_debuginfo name) ${strip_command} ) else() - message(FATAL_ERROR "LLVM_EXTERNALIZE_DEBUGINFO isn't implemented for non-darwin platforms!") + add_custom_command(TARGET ${name} POST_BUILD + COMMAND objcopy --only-keep-debug $<TARGET_FILE:${name}> $<TARGET_FILE:${name}>.debug + ${strip_command} -R .gnu_debuglink + COMMAND objcopy --add-gnu-debuglink=$<TARGET_FILE:${name}>.debug $<TARGET_FILE:${name}> + ) endif() endfunction() |