From c5178c901601270892a236e4836c02f85f2a8589 Mon Sep 17 00:00:00 2001 From: msclock Date: Thu, 26 Sep 2024 11:03:43 +0800 Subject: [PATCH] perf: add print print_target_properties (#126) Signed-off-by: msclock --- cmake/configure/Common.cmake | 131 +++++++++++++++++++++++++++++++++++ 1 file changed, 131 insertions(+) diff --git a/cmake/configure/Common.cmake b/cmake/configure/Common.cmake index e57393d..0b86d1d 100644 --- a/cmake/configure/Common.cmake +++ b/cmake/configure/Common.cmake @@ -65,3 +65,134 @@ function(target_include_interface_directories target) target_include_directories(${target} PUBLIC ${_includes}) endif() endfunction() + +#[[ +A function to print a target's properties. + +Example: + + print_target_properties(my_target) + +]] +function(print_target_properties target) + include(CMakePrintHelpers) + # cmake-format: off + cmake_print_properties( + TARGETS ${target} + PROPERTIES IMPORTED + IMPORTED_COMMON_LANGUAGE_RUNTIME + IMPORTED_CONFIGURATIONS + IMPORTED_GLOBAL + IMPORTED_IMPLIB + IMPORTED_IMPLIB_Debug + IMPORTED_IMPLIB_Release + IMPORTED_LIBNAME + IMPORTED_LIBNAME_Debug + IMPORTED_LIBNAME_Release + IMPORTED_LINK_DEPENDENT_LIBRARIES + IMPORTED_LINK_DEPENDENT_LIBRARIES_Debug + IMPORTED_LINK_DEPENDENT_LIBRARIES_Release + IMPORTED_LINK_INTERFACE_LANGUAGES + IMPORTED_LINK_INTERFACE_LANGUAGES_Debug + IMPORTED_LINK_INTERFACE_LANGUAGES_Release + IMPORTED_LINK_INTERFACE_LIBRARIES + IMPORTED_LINK_INTERFACE_LIBRARIES_Debug + IMPORTED_LINK_INTERFACE_LIBRARIES_Release + IMPORTED_LINK_INTERFACE_MULTIPLICITY + IMPORTED_LINK_INTERFACE_MULTIPLICITY_Debug + IMPORTED_LINK_INTERFACE_MULTIPLICITY_Release + IMPORTED_LOCATION + IMPORTED_LOCATION_Debug + IMPORTED_LOCATION_Release + IMPORTED_NO_SONAME + IMPORTED_NO_SONAME_Debug + IMPORTED_NO_SONAME_Release + IMPORTED_OBJECTS + IMPORTED_OBJECTS_Debug + IMPORTED_OBJECTS_Release + IMPORTED_SONAME + IMPORTED_SONAME_Debug + IMPORTED_SONAME_Release + IMPORT_PREFIX + IMPORT_SUFFIX + INCLUDE_DIRECTORIES + INSTALL_NAME_DIR + INSTALL_REMOVE_ENVIRONMENT_RPATH + INSTALL_RPATH + INSTALL_RPATH_USE_LINK_PATH + INTERFACE_AUTOUIC_OPTIONS + INTERFACE_COMPILE_DEFINITIONS + INTERFACE_COMPILE_FEATURES + INTERFACE_COMPILE_OPTIONS + INTERFACE_INCLUDE_DIRECTORIES + INTERFACE_LINK_DEPENDS + INTERFACE_LINK_DIRECTORIES + INTERFACE_LINK_LIBRARIES + INTERFACE_LINK_OPTIONS + INTERFACE_POSITION_INDEPENDENT_CODE + INTERFACE_PRECOMPILE_HEADERS + INTERFACE_SOURCES + INTERFACE_SYSTEM_INCLUDE_DIRECTORIES + LIBRARY_OUTPUT_DIRECTORY + LIBRARY_OUTPUT_DIRECTORY_Debug + LIBRARY_OUTPUT_DIRECTORY_Release + LIBRARY_OUTPUT_NAME + LIBRARY_OUTPUT_NAME_Debug + LIBRARY_OUTPUT_NAME_Release + LINK_DEPENDS + LINK_DEPENDS_NO_SHARED + LINK_DIRECTORIES + LINK_FLAGS + LINK_FLAGS_Debug + LINK_FLAGS_Release + LINK_INTERFACE_LIBRARIES + LINK_INTERFACE_LIBRARIES_Debug + LINK_INTERFACE_LIBRARIES_Release + LINK_INTERFACE_MULTIPLICITY + LINK_INTERFACE_MULTIPLICITY_Debug + LINK_INTERFACE_MULTIPLICITY_Release + LINK_LIBRARIES + LINK_OPTIONS + LOCATION + LOCATION_Debug + LOCATION_Release + MANUALLY_ADDED_DEPENDENCIES + MSVC_RUNTIME_LIBRARY + NAME + NO_SONAME + NO_SYSTEM_FROM_IMPORTED + OUTPUT_NAME + OUTPUT_NAME_Debug + OUTPUT_NAME_Release + PCH_WARN_INVALID + PCH_INSTANTIATE_TEMPLATES + PDB_NAME + PDB_NAME_Debug + PDB_NAME_Release + PDB_OUTPUT_DIRECTORY + PDB_OUTPUT_DIRECTORY_Debug + PDB_OUTPUT_DIRECTORY_Release + PRECOMPILE_HEADERS + PRECOMPILE_HEADERS_REUSE_FROM + PREFIX + PRIVATE_HEADER + PUBLIC_HEADER + RESOURCE + RUNTIME_OUTPUT_DIRECTORY + RUNTIME_OUTPUT_DIRECTORY_Debug + RUNTIME_OUTPUT_DIRECTORY_Release + RUNTIME_OUTPUT_NAME + RUNTIME_OUTPUT_NAME_Debug + RUNTIME_OUTPUT_NAME_Release + SOURCE_DIR + SOURCES + STATIC_LIBRARY_FLAGS + STATIC_LIBRARY_FLAGS_Debug + STATIC_LIBRARY_FLAGS_Release + STATIC_LIBRARY_OPTIONS + SUFFIX + TYPE + VERSION + ) + # cmake-format: on +endfunction()