1*da0073e9SAndroid Build Coastguard Workerfunction(print_target_properties tgt) 2*da0073e9SAndroid Build Coastguard Worker # Get all propreties that cmake supports 3*da0073e9SAndroid Build Coastguard Worker execute_process(COMMAND cmake --help-property-list OUTPUT_VARIABLE CMAKE_PROPERTY_LIST) 4*da0073e9SAndroid Build Coastguard Worker 5*da0073e9SAndroid Build Coastguard Worker # Convert command output into a CMake list 6*da0073e9SAndroid Build Coastguard Worker STRING(REGEX REPLACE ";" "\\\\;" CMAKE_PROPERTY_LIST "${CMAKE_PROPERTY_LIST}") 7*da0073e9SAndroid Build Coastguard Worker STRING(REGEX REPLACE "\n" ";" CMAKE_PROPERTY_LIST "${CMAKE_PROPERTY_LIST}") 8*da0073e9SAndroid Build Coastguard Worker if(NOT TARGET ${tgt}) 9*da0073e9SAndroid Build Coastguard Worker message("There is no target named '${tgt}'") 10*da0073e9SAndroid Build Coastguard Worker return() 11*da0073e9SAndroid Build Coastguard Worker endif() 12*da0073e9SAndroid Build Coastguard Worker 13*da0073e9SAndroid Build Coastguard Worker foreach(prop ${CMAKE_PROPERTY_LIST}) 14*da0073e9SAndroid Build Coastguard Worker string(REPLACE "<CONFIG>" "${CMAKE_BUILD_TYPE}" prop ${prop}) 15*da0073e9SAndroid Build Coastguard Worker # Fix https://stackoverflow.com/questions/32197663/how-can-i-remove-the-the-location-property-may-not-be-read-from-target-error-i 16*da0073e9SAndroid Build Coastguard Worker if(prop STREQUAL "LOCATION" OR prop MATCHES "^LOCATION_" OR prop MATCHES "_LOCATION$") 17*da0073e9SAndroid Build Coastguard Worker continue() 18*da0073e9SAndroid Build Coastguard Worker endif() 19*da0073e9SAndroid Build Coastguard Worker # message ("Checking ${prop}") 20*da0073e9SAndroid Build Coastguard Worker get_property(propval TARGET ${tgt} PROPERTY ${prop} SET) 21*da0073e9SAndroid Build Coastguard Worker if(propval) 22*da0073e9SAndroid Build Coastguard Worker get_target_property(propval ${tgt} ${prop}) 23*da0073e9SAndroid Build Coastguard Worker message("${tgt} ${prop} = ${propval}") 24*da0073e9SAndroid Build Coastguard Worker endif() 25*da0073e9SAndroid Build Coastguard Worker endforeach(prop) 26*da0073e9SAndroid Build Coastguard Workerendfunction(print_target_properties) 27