From 988e748c78faf5bcdf7a24f1e63b9d153848ba99 Mon Sep 17 00:00:00 2001 From: Jonathan Rajotte Date: Tue, 4 Oct 2016 15:17:05 -0400 Subject: [PATCH] Fix: cmake example with configure based oot build Signed-off-by: Jonathan Rajotte Signed-off-by: Mathieu Desnoyers --- .../cmake/FindLTTngUST.cmake | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/doc/examples/cmake-multiple-shared-libraries/cmake/FindLTTngUST.cmake b/doc/examples/cmake-multiple-shared-libraries/cmake/FindLTTngUST.cmake index 18d28bde..a98970c5 100644 --- a/doc/examples/cmake-multiple-shared-libraries/cmake/FindLTTngUST.cmake +++ b/doc/examples/cmake-multiple-shared-libraries/cmake/FindLTTngUST.cmake @@ -45,9 +45,12 @@ # License text for the above reference.) 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 +64,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 +87,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 +96,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}") -- 2.34.1