Skip to content

Commit fde662d

Browse files
tarun292facebook-github-bot
authored andcommitted
Check if dl library is available and only then link it in for executorch in CMake. (#579)
Summary: The dl library might not be available on embedded platforms. Before we link it in for executorch core lib we check if it exists for the toolchain we are using and then link it in if it does. Differential Revision: D50001473
1 parent 737186e commit fde662d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,14 @@ add_subdirectory(schema)
255255
# full operators. Does not contain any backends.
256256
#
257257

258+
# Check if dl exists for this toolchain and only then link it.
259+
find_library(DL_LIBRARY_EXISTS NAMES dl)
260+
261+
# Check if the library was found
262+
if(DL_LIBRARY_EXISTS)
263+
target_link_libraries(executorch PRIVATE dl) # For dladdr()
264+
endif()
265+
258266
add_library(executorch ${_executorch__srcs})
259267
target_link_libraries(executorch PRIVATE program_schema)
260268
target_link_libraries(executorch PRIVATE dl) # For dladdr()

0 commit comments

Comments
 (0)