mirror of
https://github.com/ggerganov/llama.cpp.git
synced 2024-12-25 02:44:36 +00:00
cmake : fix transient definitions in find pkg (#3411)
This commit is contained in:
parent
ea55295a74
commit
095231dfd3
@ -705,6 +705,7 @@ set(LLAMA_BIN_INSTALL_DIR ${CMAKE_INSTALL_BINDIR}
|
|||||||
set(LLAMA_BUILD_NUMBER ${BUILD_NUMBER})
|
set(LLAMA_BUILD_NUMBER ${BUILD_NUMBER})
|
||||||
set(LLAMA_BUILD_COMMIT ${BUILD_COMMIT})
|
set(LLAMA_BUILD_COMMIT ${BUILD_COMMIT})
|
||||||
set(LLAMA_INSTALL_VERSION 0.0.${BUILD_NUMBER})
|
set(LLAMA_INSTALL_VERSION 0.0.${BUILD_NUMBER})
|
||||||
|
get_directory_property(LLAMA_TRANSIENT_DEFINES COMPILE_DEFINITIONS)
|
||||||
|
|
||||||
configure_package_config_file(
|
configure_package_config_file(
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/scripts/LlamaConfig.cmake.in
|
${CMAKE_CURRENT_SOURCE_DIR}/scripts/LlamaConfig.cmake.in
|
||||||
|
@ -28,6 +28,16 @@ configure_file(${_common_path}/../build-info.h
|
|||||||
target_include_directories(common PUBLIC ${LLAMA_INCLUDE_DIR}
|
target_include_directories(common PUBLIC ${LLAMA_INCLUDE_DIR}
|
||||||
${CMAKE_CURRENT_BINARY_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)
|
add_executable(${TARGET} ${CMAKE_CURRENT_LIST_DIR}/../main/main.cpp)
|
||||||
target_include_directories(${TARGET} PRIVATE ${_common_path})
|
target_include_directories(${TARGET} PRIVATE ${_common_path})
|
||||||
install(TARGETS ${TARGET} RUNTIME)
|
install(TARGETS ${TARGET} RUNTIME)
|
||||||
|
@ -56,11 +56,13 @@ find_library(llama_LIBRARY llama
|
|||||||
HINTS ${LLAMA_LIB_DIR})
|
HINTS ${LLAMA_LIB_DIR})
|
||||||
|
|
||||||
set(_llama_link_deps "Threads::Threads" "@LLAMA_EXTRA_LIBS@")
|
set(_llama_link_deps "Threads::Threads" "@LLAMA_EXTRA_LIBS@")
|
||||||
|
set(_llama_transient_defines "@LLAMA_TRANSIENT_DEFINES@")
|
||||||
add_library(llama UNKNOWN IMPORTED)
|
add_library(llama UNKNOWN IMPORTED)
|
||||||
set_target_properties(llama
|
set_target_properties(llama
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
INTERFACE_INCLUDE_DIRECTORIES "${LLAMA_INCLUDE_DIR}"
|
INTERFACE_INCLUDE_DIRECTORIES "${LLAMA_INCLUDE_DIR}"
|
||||||
INTERFACE_LINK_LIBRARIES "${_llama_link_deps}"
|
INTERFACE_LINK_LIBRARIES "${_llama_link_deps}"
|
||||||
|
INTERFACE_COMPILE_DEFINITIONS "${_llama_transient_defines}"
|
||||||
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
|
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
|
||||||
IMPORTED_LOCATION "${llama_LIBRARY}"
|
IMPORTED_LOCATION "${llama_LIBRARY}"
|
||||||
INTERFACE_COMPILE_FEATURES cxx_std_11
|
INTERFACE_COMPILE_FEATURES cxx_std_11
|
||||||
|
Loading…
Reference in New Issue
Block a user