diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt index 2e152f955..6c1a41520 100644 --- a/src/server/CMakeLists.txt +++ b/src/server/CMakeLists.txt @@ -4,10 +4,11 @@ cxx_link(dragonfly base dragonfly_lib) if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND CMAKE_BUILD_TYPE STREQUAL "Release") # Add core2 only to this file, thus avoiding instructions in this object file that # can cause SIGILL. - set_source_files_properties(dfly_main.cc PROPERTIES COMPILE_FLAGS -march=core2 COMPILE_DEFINITIONS - SOURCE_PATH_FROM_BUILD_ENV=${CMAKE_SOURCE_DIR}) + set_source_files_properties(dfly_main.cc PROPERTIES COMPILE_FLAGS -march=core2) endif() +set_property(SOURCE dfly_main.cc APPEND PROPERTY COMPILE_DEFINITIONS + SOURCE_PATH_FROM_BUILD_ENV=${CMAKE_SOURCE_DIR}) if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") SET(TX_LINUX_SRCS io_mgr.cc tiered_storage.cc) diff --git a/src/server/dfly_main.cc b/src/server/dfly_main.cc index 0a72ef4a3..87296bf2b 100644 --- a/src/server/dfly_main.cc +++ b/src/server/dfly_main.cc @@ -46,13 +46,6 @@ #include "util/http/http_client.h" #include "util/varz.h" -#define STRING_PP_NX(A) #A -#define STRING_MAKE_PP(A) STRING_PP_NX(A) - -// This would create a string value from a "defined" location of the source code -// Note that SOURCE_PATH_FROM_BUILD_ENV is taken from the build system -#define BUILD_LOCATION_PATH STRING_MAKE_PP(SOURCE_PATH_FROM_BUILD_ENV) - #ifdef __APPLE__ #include #define environ (*_NSGetEnviron()) @@ -313,6 +306,13 @@ bool HelpFlags(std::string_view f) { return absl::StartsWith(f, "\033[0;3"); } +#define STRING_PP_NX(A) #A +#define STRING_MAKE_PP(A) STRING_PP_NX(A) + +// This would create a string value from a "defined" location of the source code +// Note that SOURCE_PATH_FROM_BUILD_ENV is taken from the build system +#define BUILD_LOCATION_PATH STRING_MAKE_PP(SOURCE_PATH_FROM_BUILD_ENV) + string NormalizePaths(std::string_view path) { const std::string FULL_PATH = BUILD_LOCATION_PATH; const std::string FULL_PATH_SRC = FULL_PATH + "/src";