Skip to content

Commit

Permalink
cmake: use the same name for macros and cmake variables
Browse files Browse the repository at this point in the history
for two reasons,

* consolidate the namings
* pave the road to yamlize options where we will use cmake variables
  to substitude the @<variable-name>@ in .in files instead of relying
  on C/C++ macros

Signed-off-by: Kefu Chai <kchai@redhat.com>
  • Loading branch information
tchaikov committed Apr 13, 2021
1 parent bed1b32 commit 3bee4b0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,9 @@ add_library(common-common-objs OBJECT
target_include_directories(common-common-objs PRIVATE ${OPENSSL_INCLUDE_DIR})
# for options.cc
target_compile_definitions(common-common-objs PRIVATE
"CEPH_LIBDIR=\"${CMAKE_INSTALL_FULL_LIBDIR}\""
"CEPH_PKGLIBDIR=\"${CEPH_INSTALL_FULL_PKGLIBDIR}\""
"CEPH_DATADIR=\"${CEPH_INSTALL_DATADIR}\"")
"CMAKE_INSTALL_LIBDIR=\"${CMAKE_INSTALL_LIBDIR}\""
"CEPH_INSTALL_FULL_PKGLIBDIR=\"${CEPH_INSTALL_FULL_PKGLIBDIR}\""
"CEPH_INSTALL_DATADIR=\"${CEPH_INSTALL_DATADIR}\"")

set(common_mountcephfs_srcs
armor.c
Expand Down
8 changes: 4 additions & 4 deletions src/common/options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ std::vector<Option> get_global_options() {
.set_description("default set by python code"),

Option("erasure_code_dir", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default(CEPH_PKGLIBDIR"/erasure-code")
.set_default(CEPH_INSTALL_FULL_PKGLIBDIR"/erasure-code")
.set_flag(Option::FLAG_STARTUP)
.set_description("directory where erasure-code plugins can be found")
.add_service({"mon", "osd"}),
Expand Down Expand Up @@ -805,7 +805,7 @@ std::vector<Option> get_global_options() {
.set_description("Enable named (or all with '*') experimental features that may be untested, dangerous, and/or cause permanent data loss"),

Option("plugin_dir", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default(CEPH_PKGLIBDIR)
.set_default(CEPH_INSTALL_FULL_PKGLIBDIR)
.set_flag(Option::FLAG_STARTUP)
.add_service({"mon", "osd"})
.set_description("Base directory for dynamically loaded plugins"),
Expand Down Expand Up @@ -3480,7 +3480,7 @@ std::vector<Option> get_global_options() {
.add_see_also("osd_deep_scrub_large_omap_object_key_threshold"),

Option("osd_class_dir", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default(CEPH_LIBDIR "/rados-classes")
.set_default(CMAKE_INSTALL_LIBDIR "/rados-classes")
.set_description(""),

Option("osd_open_classes_on_start", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
Expand Down Expand Up @@ -5426,7 +5426,7 @@ std::vector<Option> get_global_options() {
.set_description("Path to cephadm utility"),

Option("mgr_module_path", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default(CEPH_DATADIR "/mgr")
.set_default(CEPH_INSTALL_DATADIR "/mgr")
.add_service("mgr")
.set_description("Filesystem path to manager modules."),

Expand Down
6 changes: 3 additions & 3 deletions src/crimson/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ add_library(crimson-common STATIC
$<TARGET_OBJECTS:common_mountcephfs_objs>)

target_compile_definitions(crimson-common PRIVATE
"CEPH_LIBDIR=\"${CMAKE_INSTALL_FULL_LIBDIR}\""
"CEPH_PKGLIBDIR=\"${CEPH_INSTALL_FULL_PKGLIBDIR}\""
"CEPH_DATADIR=\"${CEPH_INSTALL_DATADIR}\"")
"CMAKE_INSTALL_LIBDIR=\"${CMAKE_INSTALL_LIBDIR}\""
"CEPH_INSTALL_FULL_PKGLIBDIR=\"${CEPH_INSTALL_FULL_PKGLIBDIR}\""
"CEPH_INSTALL_DATADIR=\"${CEPH_INSTALL_DATADIR}\"")

set(crimson_common_deps
Boost::iostreams
Expand Down
2 changes: 1 addition & 1 deletion src/pybind/mgr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if(WITH_TESTS)
endif()

# Location needs to match default setting for mgr_module_path, currently:
# OPTION(mgr_module_path, OPT_STR, CEPH_PKGLIBDIR "/mgr")
# OPTION(mgr_module_path, OPT_STR, CEPH_INSTALL_DATADIR "/mgr")
install(DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}
DESTINATION ${CEPH_INSTALL_DATADIR}
Expand Down

0 comments on commit 3bee4b0

Please sign in to comment.