summaryrefslogtreecommitdiff
path: root/CMake
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2024-05-05 19:40:27 +0200
committerAlbrecht Schlosser <albrechts.fltk@online.de>2024-05-05 19:41:50 +0200
commit53543acb2e668c9efeab8305ba1bb69a9c661787 (patch)
treedb62f260599c53c49e585f8a72ede2aab873f55e /CMake
parent38e1d6b099e8a19271f023ec31f98bb9c7a39e40 (diff)
CMake: improve output of fl_debug_target()
Todo: check "*LOCATION" properties ...
Diffstat (limited to 'CMake')
-rw-r--r--CMake/fl_debug_var.cmake56
1 files changed, 32 insertions, 24 deletions
diff --git a/CMake/fl_debug_var.cmake b/CMake/fl_debug_var.cmake
index 6b52e4db2..1c33a9313 100644
--- a/CMake/fl_debug_var.cmake
+++ b/CMake/fl_debug_var.cmake
@@ -97,35 +97,43 @@ function(fl_debug_target name)
set(var "${name}")
fl_expand_name(var "${name}" 40)
- # these properties are always supported:
- set(_props ALIASED_TARGET TYPE)
-
- # these properties are not supported before 3.20 for *some* target types
- if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.20)
- list(APPEND _props
- LOCATION
- IMPORTED_LOCATION
- INTERFACE_LOCATION)
+ if(NOT TARGET ${name})
+ message(STATUS "${var} = <not a target>")
+ message(STATUS "")
+ return()
endif()
+ get_target_property(_type ${name} TYPE)
+ # message(STATUS "${var} = target, type = ${_type}")
+
# these properties are always supported:
+ set(_props NAME TYPE ALIASED_TARGET)
+
+ # these properties can't be read from executable target types
+ ### if(NOT _type STREQUAL "EXECUTABLE")
+ ### list(APPEND _props
+ ### LOCATION
+ ### IMPORTED_LOCATION
+ ### INTERFACE_LOCATION)
+ ### endif()
+
list(APPEND _props
- INTERFACE_INCLUDE_DIRECTORIES
- INTERFACE_LINK_DIRECTORIES
- INTERFACE_LINK_LIBRARIES)
+ INCLUDE_DIRECTORIES
+ LINK_DIRECTORIES
+ LINK_LIBRARIES
+ COMPILE_DEFINITIONS
+ INTERFACE_COMPILE_DEFINITIONS
+ INTERFACE_INCLUDE_DIRECTORIES
+ INTERFACE_LINK_DIRECTORIES
+ INTERFACE_LINK_LIBRARIES)
- if(TARGET ${name})
- message(STATUS "${var} = <target>")
- foreach(prop ${_props})
- get_target_property(${prop} ${name} ${prop})
- if(NOT ${prop})
- set(${prop} "")
- endif()
- fl_debug_var(${prop})
- endforeach()
- else()
- message(STATUS "${var} = <not a target>")
- endif()
+ foreach(prop ${_props})
+ get_target_property(${prop} ${name} ${prop})
+ if(NOT ${prop})
+ set(${prop} "")
+ endif()
+ fl_debug_var(${prop})
+ endforeach()
message(STATUS "")
endfunction(fl_debug_target)