diff --git a/conanfile.py b/conanfile.py index 0040cae..760dfdf 100644 --- a/conanfile.py +++ b/conanfile.py @@ -23,6 +23,7 @@ def config_options(self): def build(self): cmake = CMake(self) + cmake.definitions["CMAKE_HELLO_SDK_VERSION"] = self.version cmake.configure(source_folder="src") cmake.build() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 44fe005..85e420c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -4,4 +4,6 @@ project(hello CXX) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup() +add_definitions(-DHELLO_SDK_VERSION="${CMAKE_HELLO_SDK_VERSION}") + add_library(hello hello.cpp) diff --git a/src/hello.cpp b/src/hello.cpp index fe762a5..bb991b6 100644 --- a/src/hello.cpp +++ b/src/hello.cpp @@ -1,10 +1,16 @@ #include #include "hello.h" +#ifndef HELLO_SDK_VERSION +#define HELLO_SDK_VERSION "unknown" +#endif + void hello(){ + std::cout << "hello sdk version: " << HELLO_SDK_VERSION << std::endl; + #ifdef NDEBUG - std::cout << "hello/0.1: Hello World Release!" <