Print

Print


  Branch: refs/heads/devel
  Home:   https://github.com/xrootd/xrootd
  Commit: e53d4c8dd48b497d1f2fcba7238077bde41331b2
      https://github.com/xrootd/xrootd/commit/e53d4c8dd48b497d1f2fcba7238077bde41331b2
  Author: Guilherme Amadio <[log in to unmask]>
  Date:   2023-08-24 (Thu, 24 Aug 2023)

  Changed paths:
    M cmake/Findlibuuid.cmake

  Log Message:
  -----------
  [CMake] Update Findlibuuid.cmake to use correct include paths

We need to use target_include_directories() instead of set_property() on
the uuid::uuid target, since setting the property directly does not make
those directories used during compilation. This is needed for CMS-SW, as it
uses a specific version of libuuid installed in a non-standard location.
However, on macOS, using target_include_directories() causes kernel header
paths to be added in the compilation ahead of the C++ compiler's own paths,
which causes compilation failures with clang from Xcode. This is why we
were using set_property() up to now. For target_include_directories() to
work in both cases (macOS and Linux with non-standard install path), we
need to set CMAKE_FIND_FRAMEWORKS to LAST before looking for the uuid.h
header. This way the kernel framework header paths are skipped, and uuid.h
is found in one of the regular macOS SDK header paths instead.

We now also perform a search for the uuid library using find_library, to
avoid unnecessary calls to pkg-config. We keep it only as a last resort to
find the library, as in some cases pkg-config works where we'd have to set
CMAKE_PREFIX_PATH for find_library to work. Nevertheless, when we do need
to fallback to pkg-config, the include directory set by the uuid.pc file is
"wrong", i.e. it reports <prefix>/include/uuid, not just <prefix>/include
as we expect, so we need to fix it by stripping the last component of the
include directory in that case.

Finally, in order to let pkg-config work, we were clearing CMake cache
variables in the beginning of the Findlibuuid module, which had the
unfortunate side effect of preventing users from setting UUID_INCLUDE_DIR
and UUID_LIBRARY in the CMake command line to pick up a specific version of
libuuid. We moved this section within the block where pkg-config is used to
correct this problem.

########################################################################
Use REPLY-ALL to reply to list

To unsubscribe from the XROOTD-DEV list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=XROOTD-DEV&A=1