doc: implement REUSE with SPDX identifiers
[lttng-ust.git] / doc / examples / cmake-multiple-shared-libraries / cmake / FindLTTngUST.cmake
index 18d28bdebc6652074e6a5518e248b6f908a581b4..859de6a306b4005aa7768f674270ed6ee718018e 100644 (file)
 #   ``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)
@@ -61,7 +55,7 @@ if(LTTNGUST_INCLUDE_DIRS AND LTTNGUST_LIBRARIES)
   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
@@ -84,6 +78,8 @@ if(LTTNGUST_INCLUDE_DIRS AND LTTNGUST_LIBRARIES)
     unset(lttngust_v_major)
     unset(lttngust_v_minor)
     unset(lttngust_v_patch)
+  else()
+    message(FATAL_ERROR "Missing version header")
   endif()
 
   unset(lttngust_version_file)
@@ -91,7 +87,7 @@ if(LTTNGUST_INCLUDE_DIRS AND LTTNGUST_LIBRARIES)
   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}")
This page took 0.025793 seconds and 4 git commands to generate.