File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -61,9 +61,27 @@ add_executable(obudump
6161 tools/obudump.c
6262 tools/json.c
6363)
64- # Always link the tool statically. This is now guaranteed to exist on all platforms.
65- target_link_libraries (obudump PRIVATE OBUParse::static )
6664target_include_directories (obudump PRIVATE ${CMAKE_CURRENT_SOURCE_DIR } )
65+ if (TARGET OBUParse::shared)
66+ target_link_libraries (obudump PRIVATE OBUParse::shared )
67+ else ()
68+ target_link_libraries (obudump PRIVATE OBUParse::static )
69+ endif ()
70+
71+ # --- RPATH Handling for obudump tool ---
72+ if (UNIX AND TARGET obudump AND TARGET OBUParse::shared)
73+ # This handles the build tree. The executable is in build/bin, the library is in build/lib.
74+ # The RPATH needs to point to the library directory.
75+ set_property (TARGET obudump PROPERTY
76+ BUILD_RPATH "${CMAKE_BINARY_DIR } /lib"
77+ )
78+
79+ # This handles the install tree. The path is relative from the installed bin/ directory
80+ # to the lib/ directory.
81+ set_property (TARGET obudump PROPERTY
82+ INSTALL_RPATH "\$ ORIGIN/../lib"
83+ )
84+ endif ()
6785
6886# --- Installation ---
6987include (GNUInstallDirs )
You can’t perform that action at this time.
0 commit comments