Skip to content

Commit 683d65a

Browse files
committed
Fix option support
1 parent 701e311 commit 683d65a

File tree

4 files changed

+76
-6
lines changed

4 files changed

+76
-6
lines changed

CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,10 @@ endif()
1717
# - Load Custom Modules
1818
list(INSERT CMAKE_MODULE_PATH 0 ${PROJECT_SOURCE_DIR}/cmake)
1919

20+
include(BxVersionManager)
21+
2022
# - Versioning
21-
set(BxRabbitMQ_VERSION_MAJOR 0)
22-
set(BxRabbitMQ_VERSION_MINOR 3)
23-
set(BxRabbitMQ_VERSION_PATCH 0)
24-
set(BxRabbitMQ_VERSION
25-
"${BxRabbitMQ_VERSION_MAJOR}.${BxRabbitMQ_VERSION_MINOR}.${BxRabbitMQ_VERSION_PATCH}")
23+
bx_version_set(BxRabbitMQ 0 3)
2624

2725
#-----------------------------------------------------------------------
2826
# - Standard UNIX Tool install paths, including relative paths for use

cmake/BxPackageVersions.db

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# List of released versions MAJOR.MINOR.PATCH
2+
0.3.4
3+
1.0.0
4+
1.1.0
5+
1.2.0
6+
# end

cmake/BxVersionManager.cmake

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# CMake tools for version management
2+
3+
function(bx_version_build_version_number prefix_)
4+
set(${prefix_}_VERSION
5+
"${${prefix_}_VERSION_MAJOR}.${${prefix_}_VERSION_MINOR}.${${prefix_}_VERSION_PATCH}"
6+
PARENT_SCOPE)
7+
endfunction()
8+
9+
function(bx_version_extract_patch_from_db major_ minor_ patch_)
10+
# message(STATUS "[info] bx_version_extract_patch_from_db: Entering...")
11+
# message(STATUS "[info] - Major = ${major_}")
12+
# message(STATUS "[info] - Minor = ${minor_}")
13+
file(STRINGS
14+
${PROJECT_SOURCE_DIR}/cmake/BxPackageVersions.db
15+
_bx_package_versions_lines
16+
REGEX "^([0-9]+)\\.([0-9]+)\\.([0-9+])"
17+
)
18+
# message(STATUS "[info] Lines = ${_bx_package_versions_lines}")
19+
foreach(line ${_bx_package_versions_lines})
20+
string(REPLACE "." ";" _version_list ${line})
21+
# message(STATUS "[info] Version list = ${_version_list}")
22+
list(GET _version_list 0 _version_major)
23+
list(GET _version_list 1 _version_minor)
24+
list(GET _version_list 2 _version_patch)
25+
if(${_version_major} EQUAL ${major_})
26+
if(${_version_minor} EQUAL ${minor_})
27+
set(${patch_} ${_version_patch} PARENT_SCOPE)
28+
# message(STATUS "[info] Resolved patch = ${_version_patch}")
29+
endif()
30+
endif()
31+
endforeach()
32+
# message(STATUS "[info] - New patch is set to : $ {${patch_}}")
33+
# message(STATUS "[info] bx_version_extract_patch_from_db: Exiting.")
34+
endfunction()
35+
36+
macro(bx_version_set prefix_ major_ minor_)
37+
#message(STATUS "[info] bx_version_set: prefix_ = ${prefix_}")
38+
#message(STATUS "[info] bx_version_set: major_ = ${major_}")
39+
#message(STATUS "[info] bx_version_set: minor_ = ${minor_}")
40+
#message(STATUS "[info] bx_version_set: key = ${prefix_}_VERSION_MAJOR")
41+
set(_version_major ${major_})
42+
set(_version_minor ${minor_})
43+
set(_version_patch 0)
44+
set(${prefix_}_VERSION_MAJOR ${_version_major})
45+
set(${prefix_}_VERSION_MINOR ${_version_minor})
46+
set(${prefix_}_VERSION_PATCH ${_version_patch})
47+
# message(STATUS "[info] bx_version_set: Major = ${${prefix_}_VERSION_MAJOR}")
48+
# message(STATUS "[info] bx_version_set: Minor = ${${prefix_}_VERSION_MINOR}")
49+
# message(STATUS "[info] bx_version_set: Patch = ${${prefix_}_VERSION_PATCH}")
50+
bx_version_extract_patch_from_db(
51+
${${prefix_}_VERSION_MAJOR}
52+
${${prefix_}_VERSION_MINOR}
53+
${prefix_}_VERSION_PATCH
54+
)
55+
bx_version_build_version_number(${prefix_})
56+
message(STATUS "[info] bx_version_set: Major = ${${prefix_}_VERSION_MAJOR}")
57+
message(STATUS "[info] bx_version_set: Minor = ${${prefix_}_VERSION_MINOR}")
58+
message(STATUS "[info] bx_version_set: Patch = ${${prefix_}_VERSION_PATCH}")
59+
message(STATUS "[info] bx_version_set: Version = ${${prefix_}_VERSION}")
60+
endmacro()

tools/build.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ install_dir=$(pwd)/_install.d
3434
build_dir=$(pwd)/_build.d
3535

3636
devel=false
37-
bxjsontools_prefix=$(bxjsontools-query --cmakedir)
37+
bxjsontools_prefix=
3838
with_management=false
3939

4040
while [ -n "$1" ]; do
@@ -51,6 +51,12 @@ while [ -n "$1" ]; do
5151
shift 1
5252
done
5353

54+
if [ ${with_management} = true ]; then
55+
if [ "x${bxjsontools_prefix}" = "x" ]; then
56+
bxjsontools_prefix=$(bxjsontools-query --cmakedir)
57+
fi
58+
fi
59+
5460
# brewsh
5561
# curlpp_setup
5662
# rabbitmqc_setup

0 commit comments

Comments
 (0)