Skip to content

Commit d0cf509

Browse files
committed
Post-merge fixes
1 parent fb125e0 commit d0cf509

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

flang-rt/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,12 @@ endif ()
205205
check_cxx_compiler_flag("-UTESTFLAG" FLANG_RT_SUPPORTS_UNDEFINE_FLAG)
206206

207207

208+
# function checks
209+
find_package(Backtrace)
210+
set(HAVE_BACKTRACE ${Backtrace_FOUND})
211+
set(BACKTRACE_HEADER ${Backtrace_HEADER})
212+
213+
208214
#####################
209215
# Build Preparation #
210216
#####################

flang-rt/cmake/config.h.cmake.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,9 @@
1616
don't. */
1717
#cmakedefine01 HAVE_DECL_STRERROR_S
1818

19+
/* Define to 1 if you have the `backtrace' function. */
20+
#cmakedefine HAVE_BACKTRACE ${HAVE_BACKTRACE}
21+
22+
#define BACKTRACE_HEADER <${BACKTRACE_HEADER}>
23+
1924
#endif

flang-rt/cmake/modules/AddFlangRT.cmake

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,15 @@
2828
# ADDITIONAL_HEADERS
2929
# May specify header files for IDE generators.
3030
# INCLUDE_DIRECTORIES
31-
# Additional include_directories for all added targets
31+
# Additional target_include_directories for all added targets
32+
# LINK_LIBRARIES
33+
# Additional target_link_libraries for all added targets
3234
# TARGET_PROPERTIES
3335
# Set target properties of all added targets
3436
# )
3537
function (add_flangrt_library name)
3638
set(options STATIC SHARED OBJECT INSTALL_WITH_TOOLCHAIN EXCLUDE_FROM_ALL LINK_TO_LLVM)
37-
set(multiValueArgs ADDITIONAL_HEADERS INCLUDE_DIRECTORIES TARGET_PROPERTIES)
39+
set(multiValueArgs ADDITIONAL_HEADERS INCLUDE_DIRECTORIES LINK_LIBRARIES TARGET_PROPERTIES)
3840
cmake_parse_arguments(ARG
3941
"${options}"
4042
""
@@ -160,6 +162,10 @@ function (add_flangrt_library name)
160162
target_include_directories(${name} ${ARG_INCLUDE_DIRECTORIES})
161163
endif ()
162164

165+
if (ARG_LINK_LIBRARIES)
166+
target_link_libraries(${name} PUBLIC ${ARG_LINK_LIBRARIES})
167+
endif ()
168+
163169
# If this is part of the toolchain, put it into the compiler's resource
164170
# directory. Otherwise it is part of testing and is not installed at all.
165171
# TODO: Consider multi-configuration builds (MSVC_IDE, "Ninja Multi-Config")

flang-rt/lib/runtime/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,13 @@ else ()
124124
set(f128_sources "")
125125
endif ()
126126

127-
128127
set(sources ${supported_sources} ${host_sources} ${f128_sources})
129128

129+
130130
if (NOT WIN32)
131131
add_flangrt_library(flang_rt.runtime STATIC
132132
${sources}
133+
LINK_LIBRARIES ${Backtrace_LIBRARY}
133134
INSTALL_WITH_TOOLCHAIN
134135
ADDITIONAL_HEADERS ${public_headers} ${private_headers}
135136
)
@@ -151,6 +152,7 @@ else()
151152
add_flangrt_library(${name} ${libtype}
152153
${sources}
153154
${ARGN}
155+
LINK_LIBRARIES ${Backtrace_LIBRARY}
154156
ADDITIONAL_HEADERS ${public_headers} ${private_headers}
155157
)
156158

0 commit comments

Comments
 (0)