File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,19 @@ set (CMAKE_CXX_STANDARD 11)
44set (CMAKE_CXX_STANDARD_REQUIRED true )
55
66
7+ if (NOT DEFINED PACKAGE_VERSION )
8+ message ("-- WARNING: Package version is not defined, set as 0.0.0" )
9+ set (PACKAGE_VERSION "0.0.0" )
10+ endif ()
11+
12+ message ("-- Package version: ${PACKAGE_VERSION} " )
13+
14+ project ("CMake Project"
15+ VERSION ${PACKAGE_VERSION}
16+ DESCRIPTION "C/C++ 项目的 CMake 模板。"
17+ )
18+
19+
720# configure unit test
821option (WITH_GTEST "Enable unit tests by GoogleTest" OFF )
922
Original file line number Diff line number Diff line change 44
55class ExampleRecipe (ConanFile ):
66 name = "cmake-project"
7+ version = "1.1.1"
78 description = "C/C++ 项目的 CMake 模板。"
89 languages = "C++"
910 author = "DavidingPlus"
@@ -29,5 +30,6 @@ def layout(self):
2930 def generate (self ):
3031 tc = CMakeToolchain (self )
3132 tc .presets_prefix = "cmake-project"
33+ tc .cache_variables ["PACKAGE_VERSION" ] = self .version
3234 tc .cache_variables ["with_gtest" ] = self .options .with_gtest
3335 tc .generate ()
You can’t perform that action at this time.
0 commit comments