52 lines
1.9 KiB
CMake
52 lines
1.9 KiB
CMake
|
||
####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
|
||
####### Any changes to this file will be overwritten by the next CMake run ####
|
||
####### The input file was DataRouterConfig.cmake.in ########
|
||
|
||
get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)
|
||
|
||
macro(set_and_check _var _file)
|
||
set(${_var} "${_file}")
|
||
if(NOT EXISTS "${_file}")
|
||
message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
|
||
endif()
|
||
endmacro()
|
||
|
||
macro(check_required_components _NAME)
|
||
foreach(comp ${${_NAME}_FIND_COMPONENTS})
|
||
if(NOT ${_NAME}_${comp}_FOUND)
|
||
if(${_NAME}_FIND_REQUIRED_${comp})
|
||
set(${_NAME}_FOUND FALSE)
|
||
endif()
|
||
endif()
|
||
endforeach()
|
||
endmacro()
|
||
|
||
####################################################################################
|
||
|
||
get_filename_component(DataRouter_INCLUDE_DIR
|
||
"${CMAKE_CURRENT_LIST_DIR}/../../../include" ABSOLUTE)
|
||
get_filename_component(DataRouter_LIBRARY_DIR
|
||
"${CMAKE_CURRENT_LIST_DIR}/../../../lib" ABSOLUTE)
|
||
|
||
include("${CMAKE_CURRENT_LIST_DIR}/DataRouterTargets.cmake" OPTIONAL)
|
||
|
||
# 无论 targets 文件是否加载,都覆盖 include 路径为正确值
|
||
# (targets 文件中的 _IMPORT_PREFIX 在某些平台/工具链下可能计算异常)
|
||
if(TARGET DataRouter)
|
||
set_target_properties(DataRouter PROPERTIES
|
||
INTERFACE_INCLUDE_DIRECTORIES "${DataRouter_INCLUDE_DIR}"
|
||
)
|
||
if(NOT TARGET DataRouter::DataRouter)
|
||
add_library(DataRouter::DataRouter ALIAS DataRouter)
|
||
endif()
|
||
else()
|
||
add_library(DataRouter::DataRouter STATIC IMPORTED)
|
||
set_target_properties(DataRouter::DataRouter PROPERTIES
|
||
IMPORTED_LOCATION "${DataRouter_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}DataRouter${CMAKE_STATIC_LIBRARY_SUFFIX}"
|
||
INTERFACE_INCLUDE_DIRECTORIES "${DataRouter_INCLUDE_DIR}"
|
||
)
|
||
endif()
|
||
|
||
check_required_components(DataRouter)
|