vyasr commented on issue #36411:
URL: https://github.com/apache/arrow/issues/36411#issuecomment-2738427917

   > 👀 you saw nothing
   
   🙈 
   
   > > Typically you will also want to specify whether the target is a 
shared/static library
   > 
   > I guess that could be done with find_library + hints too, right?
   
   Most easily, in the example I gave above you just specify it in the 
`add_library` call e.g. `add_library(pkg SHARED IMPORTED)`. I typically 
wouldn't use `find_library` in the targets file since ideally the targets file 
should be installed in a predictable location relative to the library such that 
you know exactly where the library is. `find_library` is more suitable for a 
`Find*.cmake` module where you are trying to guess where it is but have no 
guarantees since you didn't control the build/installation process.
   
   > > The main trick is ensuring that the file is relocatable, so ideally at 
the top you'll have paths set based on the `CMAKE_CURRENT_LIST_DIR` or a 
template variable that's filled in by a CMake `configure_file` call.
   > 
   > Yup, same way that meson sets a template variable `prefix=/usr` or for 
relocatable files, `prefix=${pcfiledir}/../../`.
   > 
   > IIRC `${CMAKE_CURRENT_LIST_DIR}` is, like `${pcfiledir}`, defined as "the 
directory in which the currently processing file is located". The only slightly 
complicated part there is building `../../` correctly (you want meson's 
[`fs.relative_to()`](https://mesonbuild.com/Fs-module.html#relative_to) or 
cmake's [`cmake_path(RELATIVE_PATH 
)`](https://cmake.org/cmake/help/latest/command/cmake_path.html#relative-path) 
to compute the path back from the file's install directory to the relocatable 
install prefix).
   
   Yup exactly, all of that sounds right to me.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to