diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c40e3c6f7d1170443abe2a93c07f75527b18b49..0a44e56719baa433a5c45df2082fa86296b3da1c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,7 +69,7 @@ include(coveralls) find_package(Git REQUIRED) # version.cmake will get the current PADDLE_VERSION include(version) -add_definitions(-DPADDLE_VERSION=\"${PADDLE_VERSION}\") +add_definitions(-DPADDLE_VERSION=${PADDLE_VERSION}) if(NOT WITH_GPU) add_definitions(-DPADDLE_ONLY_CPU) diff --git a/paddle/utils/Version.cpp b/paddle/utils/Version.cpp index e706983918b4a865f6674a34083ef0143bd6e185..ed4ae6115f9775416161d48ad2f9e98d598f3cde 100644 --- a/paddle/utils/Version.cpp +++ b/paddle/utils/Version.cpp @@ -33,7 +33,11 @@ void printVersion(std::ostream& os) { #ifndef PADDLE_VERSION #define PADDLE_VERSION "unknown" #endif - os << "paddle version: " << PADDLE_VERSION << std::endl +// converts macro to string https://gcc.gnu.org/onlinedocs/cpp/Stringification.html +#define xstr(s) str(s) +#define str(s) #s + + os << "paddle version: " << str(PADDLE_VERSION) << std::endl << std::boolalpha << "\t" << "withGpu: " << version::isWithGpu() << std::endl << "\t"