summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorbandoti <141645996+bandoti@users.noreply.github.com>2023-10-02 06:51:49 -0300
committerGitHub <noreply@github.com>2023-10-02 12:51:49 +0300
commit095231dfd32679e32300f8ffaf1770b693ea64b0 (patch)
tree054087719cfb0d762757fd6ffaf5b78e0c75dfcb /examples
parentea55295a745c084f588be20710f5a1a12abb1109 (diff)
cmake : fix transient definitions in find pkg (#3411)
Diffstat (limited to 'examples')
-rw-r--r--examples/main-cmake-pkg/CMakeLists.txt10
1 files changed, 10 insertions, 0 deletions
diff --git a/examples/main-cmake-pkg/CMakeLists.txt b/examples/main-cmake-pkg/CMakeLists.txt
index 47373871..90813188 100644
--- a/examples/main-cmake-pkg/CMakeLists.txt
+++ b/examples/main-cmake-pkg/CMakeLists.txt
@@ -28,6 +28,16 @@ configure_file(${_common_path}/../build-info.h
target_include_directories(common PUBLIC ${LLAMA_INCLUDE_DIR}
${CMAKE_CURRENT_BINARY_DIR})
+# If the common project was part of "main-cmake-pkg" the transient
+# defines would automatically be attached. Because the common func-
+# tionality is separate, but dependent upon the defines, it must be
+# explicitly extracted from the "llama" target.
+#
+get_target_property(_llama_transient_defines llama
+ INTERFACE_COMPILE_DEFINITIONS)
+
+target_compile_definitions(common PRIVATE "${_llama_transient_defines}")
+
add_executable(${TARGET} ${CMAKE_CURRENT_LIST_DIR}/../main/main.cpp)
target_include_directories(${TARGET} PRIVATE ${_common_path})
install(TARGETS ${TARGET} RUNTIME)