Files
build_infra/0_cmake_library/Config.cmake.in
T
2026-06-16 10:23:51 +08:00

75 lines
2.4 KiB
CMake

@PACKAGE_INIT@
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
set(library_name @PROJECT_NAME@)
get_filename_component(compilerName ${CMAKE_CXX_COMPILER} NAME)
string(REPLACE ".exe" "" compilerName ${compilerName})
string(REPLACE "." "_" compilerName ${compilerName})
string(REPLACE "+" "x" compilerName ${compilerName})
set(G_Architecture_Name ${compilerName}_${CMAKE_SYSTEM_NAME}_${CMAKE_BUILD_TYPE})
file(GLOB configs ${PACKAGE_PREFIX_DIR}/${G_Architecture_Name}/${library_name}/config/*)
foreach(config ${configs})
file(COPY ${config} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
endforeach()
message("[@PROJECT_NAME@]--- @PROJECT_NAME@'s architecture name is ${G_Architecture_Name}")
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
file(GLOB sos ${PACKAGE_PREFIX_DIR}/${G_Architecture_Name}/${library_name}/lib/*.so)
message("[@PROJECT_NAME@]--- copy sos to ${CMAKE_CURRENT_BINARY_DIR}")
foreach(so ${sos})
file(COPY ${so} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
message("[@PROJECT_NAME@]--- ${so}")
endforeach()
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
file(GLOB dlls ${PACKAGE_PREFIX_DIR}/${G_Architecture_Name}/${library_name}/bin/*.dll)
message("[@PROJECT_NAME@]--- copy dlls to ${CMAKE_CURRENT_BINARY_DIR}")
foreach(dll ${dlls})
file(COPY ${dll} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
message("[@PROJECT_NAME@]--- ${dll}")
endforeach()
endif()
set(common_properties
LOCATION
INTERFACE_INCLUDE_DIRECTORIES
INTERFACE_LINK_LIBRARIES
INTERFACE_COMPILE_DEFINITIONS
INTERFACE_COMPILE_OPTIONS
COMPILE_DEFINITIONS
COMPILE_OPTIONS
LINK_LIBRARIES
LINK_FLAGS
INCLUDE_DIRECTORIES
SOURCES
)
set(libraries @install_targets@)
foreach(library ${libraries})
message("[@PROJECT_NAME@_${library}] --- properties start")
foreach(property ${common_properties})
get_target_property(value ${library} ${property})
if(NOT value STREQUAL "NOTFOUND")
message(STATUS " ${property} = ${value}")
endif()
endforeach()
message("[@PROJECT_NAME@_${library}] --- properties end")
endforeach()
unset(G_Architecture_Name)
unset(common_properties)
unset(library)
unset(libraries)
unset(property)
unset(dll)
unset(dlls)
unset(config)
unset(configs)
unset(library_name)
unset(compilerName)
unset(libraries)