From: Kefu Chai Date: Wed, 21 Apr 2021 05:28:52 +0000 (+0800) Subject: cmake: use file(GLOB ..) to find .yaml.in files X-Git-Tag: v17.1.0~2191^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4e58b5899e98397ea928cbde1451b0734fa0892b;p=ceph-ci.git 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 --- 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})