cmake - Add target to all subfolders -
i'm working on library project built follows
base/ cmakelists.txt src/ tools/ cmakelists.txt tests/ cmakelists.txt debug/ release/
the main cmakelists.txt
, in base/
contains target build library source in src/
, have configure create debug/
, release/
, phone call cmake -dcmake_release_type=<debug|release> ..
build structures.
this results in next structure
debug/ makefile tests/ makefile tools/ makefile
the programs built in tools/
, tests/
create output files , i'm trying create clean_output
target every makefile in created build structure.
i've used add_custom_target(clean_output rm -rf *.ext)
doesn't carry makefile files in tests/
, tools/
. i've tried add together same command in cmakelists.txt
files in directories, error message can't define target defined within same project.
i have tried utilize working_drectory
in combination cmake_current_list_dir
, cmake_current_binary_dir
no avail.
does know how define custom target in directories of project?
edit: not trying add together files standard clean
target. i'm trying create additional clean_output
target remove files while keeping executables in place.
you can specify working directory , several commands execute in 1 target. btw can utilize cmake -e remove_directory
:
add_custom_target( clean_output command "${cmake_command}" -e remove_directory "${cmake_current_list_dir}/directory/with/exts" command "${cmake_command}" -e remove_directory "${cmake_current_list_dir}/other-dir/with/exts" working_directory "${cmake_current_list_dir}" )
cmake
No comments:
Post a Comment