# ``TRUE`` if the ``tracef()`` API is available in the system's LTTng-UST
# ``LTTNGUST_HAS_TRACELOG``
# ``TRUE`` if the ``tracelog()`` API is available in the system's LTTng-UST
-
-#=============================================================================
-# Copyright 2016 Kitware, Inc.
-# Copyright 2016 Philippe Proulx <pproulx@efficios.com>
#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
+# SPDX-FileCopyrightText: 2016 Kitware, Inc.
+# SPDX-FileCopyrightText: 2016 Philippe Proulx <pproulx@efficios.com>
#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distribute this file outside of CMake, substitute the full
-# License text for the above reference.)
+# SPDX-License-Identifier: BSD-3-Clause
find_path(LTTNGUST_INCLUDE_DIRS NAMES lttng/tracepoint.h)
+# Must also check for the path of generated header files since out-of-tree
+# build is a possibility (Yocto).
+find_path(LTTNGUST_INCLUDE_DIRS_GENERATED NAMES lttng/ust-config.h)
find_library(LTTNGUST_LIBRARIES NAMES lttng-ust)
-if(LTTNGUST_INCLUDE_DIRS AND LTTNGUST_LIBRARIES)
+if(LTTNGUST_INCLUDE_DIRS AND LTTNGUST_INCLUDE_DIRS_GENERATED AND LTTNGUST_LIBRARIES)
# find tracef() and tracelog() support
set(LTTNGUST_HAS_TRACEF 0)
set(LTTNGUST_HAS_TRACELOG 0)
endif()
# get version
- set(lttngust_version_file "${LTTNGUST_INCLUDE_DIRS}/lttng/ust-version.h")
+ set(lttngust_version_file "${LTTNGUST_INCLUDE_DIRS_GENERATED}/lttng/ust-version.h")
if(EXISTS "${lttngust_version_file}")
file(STRINGS "${lttngust_version_file}" lttngust_version_major_string
unset(lttngust_v_major)
unset(lttngust_v_minor)
unset(lttngust_v_patch)
+ else()
+ message(FATAL_ERROR "Missing version header")
endif()
unset(lttngust_version_file)
if(NOT TARGET LTTng::UST)
add_library(LTTng::UST UNKNOWN IMPORTED)
set_target_properties(LTTng::UST PROPERTIES
- INTERFACE_INCLUDE_DIRECTORIES "${LTTNGUST_INCLUDE_DIRS}"
+ INTERFACE_INCLUDE_DIRECTORIES "${LTTNGUST_INCLUDE_DIRS};${LTTNGUST_INCLUDE_DIRS_GENERATED}"
INTERFACE_LINK_LIBRARIES ${CMAKE_DL_LIBS}
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${LTTNGUST_LIBRARIES}")