Created
October 5, 2021 20:46
-
-
Save mikedld/a687baabc952a7f061b6a2fd3069f91c to your computer and use it in GitHub Desktop.
Find all CMake targets declared in a directory (recursively)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function(print_all_targets DIR) | |
get_property(TGTS DIRECTORY "${DIR}" PROPERTY BUILDSYSTEM_TARGETS) | |
foreach(TGT IN LISTS TGTS) | |
message(STATUS "Target: ${TGT}") | |
# TODO: Do something about it | |
endforeach() | |
get_property(SUBDIRS DIRECTORY "${DIR}" PROPERTY SUBDIRECTORIES) | |
foreach(SUBDIR IN LISTS SUBDIRS) | |
print_all_targets("${SUBDIR}") | |
endforeach() | |
endfunction() | |
print_all_targets(.) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment