From 3adfdf0c583772f5655c31843b802d31b4328c83 Mon Sep 17 00:00:00 2001 From: FoREacH Date: Thu, 8 Dec 2016 13:43:37 +0200 Subject: [PATCH] Fix nvcc stray character Issue #760 --- CMakeLists.txt | 2 +- paddle/utils/Version.cpp | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c40e3c6f..0a44e5671 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 e70698391..ed4ae6115 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" -- GitLab