Skip to content

Commit

Permalink
change target names of subdirs
Browse files Browse the repository at this point in the history
  • Loading branch information
agl-alexglopez committed Jul 15, 2024
1 parent 58a1f53 commit f02aa4c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions samples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ include_directories("../str_view")
add_executable(mini_grep mini_grep.c)
target_link_libraries(mini_grep str_view)

add_custom_target(all_samples)
add_custom_target(samples)
# Function to add dependencies on all targets from the subdirectory
function(add_all_subdirectory_targets)
function(add_subdirectory_targets)
# Get the list of all targets
get_property(sample_targets DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY BUILDSYSTEM_TARGETS)
foreach(target IN LISTS sample_targets)
add_dependencies(all_samples ${target})
add_dependencies(samples ${target})
endforeach()
endfunction()
# Call the function to populate the custom target with dependencies
Expand Down
4 changes: 2 additions & 2 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ add_test(test_string_searching)
add_test(test_view_editing)

# Create a custom target that will depend on all targets in the subdirectory
add_custom_target(all_tests)
add_custom_target(tests)
# Function to add dependencies on all targets from the subdirectory
function(add_all_subdirectory_targets)
# Get the list of all targets
get_property(test_targets DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY BUILDSYSTEM_TARGETS)
foreach(target IN LISTS test_targets)
add_dependencies(all_tests ${target})
add_dependencies(tests ${target})
endforeach()
endfunction()
# Call the function to populate the custom target with dependencies
Expand Down

0 comments on commit f02aa4c

Please sign in to comment.