From 4e58b5899e98397ea928cbde1451b0734fa0892b Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 21 Apr 2021 13:28:52 +0800 Subject: [PATCH] cmake: use file(GLOB ..) to find .yaml.in files instead of hardcode the option file names, use file(GLOB ..) to find and collect them instead, for better maintainability. Signed-off-by: Kefu Chai --- src/common/options/CMakeLists.txt | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/common/options/CMakeLists.txt b/src/common/options/CMakeLists.txt index 6424271e381..8b934a6df2d 100644 --- a/src/common/options/CMakeLists.txt +++ b/src/common/options/CMakeLists.txt @@ -21,8 +21,7 @@ function(file_configure input_file output_file) VERBATIM) endfunction() -function(add_options name) - set(yaml_in_file ${CMAKE_CURRENT_SOURCE_DIR}/${name}.yaml.in) +function(add_options name yaml_in_file) set(yaml_file ${CMAKE_CURRENT_BINARY_DIR}/${name}.yaml) file_configure("${yaml_in_file}" "${yaml_file}" @ONLY) @@ -79,21 +78,17 @@ if(WITH_MGR) endif() endif() -add_options(global) -add_options(cephfs-mirror) -add_options(crimson) -add_options(mds) -add_options(mds-client) -add_options(rbd) -add_options(rbd-mirror) -add_options(immutable-object-cache) - # if set to empty string, system default luarocks package location (if exist) will be used set(rgw_luarocks_location "") if(WITH_RADOSGW_LUA_PACKAGES) set(rgw_luarocks_location "/tmp/luarocks") endif() -add_options(rgw) + +file(GLOB yaml_in_srcs "*.yaml.in") +foreach(fn ${yaml_in_srcs}) + get_filename_component(name ${fn} NAME_WE) + add_options(${name} ${fn}) +endforeach() add_library(common-options-objs OBJECT ${common_options_srcs}) -- 2.39.5