Skip to content

Commit

Permalink
cmake: accept VERSION_STRING unqouted
Browse files Browse the repository at this point in the history
The VERSION_STRING given to cmake to override the version
had to be quoted itself.

Now the VERSION_STRING is expected without quotes.
  • Loading branch information
pstorz committed Jan 21, 2019
1 parent 7a28d02 commit e907879
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion core/CMakeLists.txt
Expand Up @@ -70,7 +70,7 @@ execute_process(
)

INCLUDE(BareosExtractVersionInfo)
add_definitions(-DVERSION=${BAREOS_FULL_VERSION})
add_definitions(-DVERSION="${BAREOS_FULL_VERSION}")


INCLUDE(BareosFindAllLibraries)
Expand Down
6 changes: 4 additions & 2 deletions core/cmake/BareosExtractVersionInfo.cmake
Expand Up @@ -22,12 +22,14 @@ IF (NOT DEFINED VERSION_STRING)
MESSAGE("VERSION_STRING is not defined, extracting version from version.h")
# extract version number from version.h
file(STRINGS ${PROJECT_SOURCE_DIR}/src/include/version.h VERSION_STRING REGEX define.*VERSION.*)
string(REGEX MATCH \".*\" BAREOS_FULL_VERSION ${VERSION_STRING})
string(REPLACE "\"" "" BAREOS_FULL_VERSION ${BAREOS_FULL_VERSION})
ELSE()
set(BAREOS_FULL_VERSION ${VERSION_STRING})
ENDIF()

string(REGEX MATCH [0-9.]+ BAREOS_NUMERIC_VERSION ${VERSION_STRING})
string(REGEX MATCH [0-9]+ SOVERSION ${VERSION_STRING})
string(REGEX MATCH \".*\" BAREOS_FULL_VERSION ${VERSION_STRING})


MESSAGE("BAREOS_NUMERIC_VERSION is ${BAREOS_NUMERIC_VERSION}")
MESSAGE("BAREOS_FULL_VERSION is ${BAREOS_FULL_VERSION}")
Expand Down
2 changes: 1 addition & 1 deletion core/debian/rules
Expand Up @@ -77,7 +77,7 @@ define CONFIGURE_COMMON
-Dhostname="XXX_REPLACE_WITH_LOCAL_HOSTNAME_XXX" \
-Dincludes=yes \
-Drpath=no \
-DVERSION_STRING=\"$(BAREOS_VERSION)\"
-DVERSION_STRING=$(BAREOS_VERSION)
endef

# --docdir="\$(_docdir)/bareos" \
Expand Down
Expand Up @@ -132,7 +132,7 @@ CMAKE_ARGS+= -DCMAKE_VERBOSE_MAKEFILE=ON \
-Dsd-group=$(STORAGE_DAEMON_GROUP) \
-Dfd-user=$(FILE_DAEMON_USER) \
-Dfd-group=$(DAEMON_GROUP) \
-DVERSION_STRING=\"$(DISTVERSION)\"
-DVERSION_STRING=$(DISTVERSION)

post-install:
find ${STAGEDIR} -name '*.conf' -exec mv -v {} {}.sample \;
Expand Down
2 changes: 1 addition & 1 deletion core/platforms/packaging/bareos.spec
Expand Up @@ -815,7 +815,7 @@ cmake .. \
-Dsystemd=yes \
%endif
-Dincludes=yes \
-DVERSION_STRING=\"%version\"
-DVERSION_STRING=%version

#Add flags
%__make CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" %{?_smp_mflags};
Expand Down
2 changes: 1 addition & 1 deletion core/platforms/win32/winbareos32.spec
Expand Up @@ -129,7 +129,7 @@ for flavor in %flavors; do
-Dmon_fd_password=@mon_fd_password@ \
-Dmon_sd_password=@mon_sd_password@ \
-Dsd_password=@sd_password@ \
-DVERSION_STRING=\"%version\" \
-DVERSION_STRING=%version \
..

make %{?jobs:-j%jobs} DESTDIR=%{buildroot}/${flavor}-%WINDOWS_BITS install
Expand Down
2 changes: 1 addition & 1 deletion core/platforms/win32/winbareos64.spec
Expand Up @@ -129,7 +129,7 @@ for flavor in %flavors; do
-Dmon_fd_password=@mon_fd_password@ \
-Dmon_sd_password=@mon_sd_password@ \
-Dsd_password=@sd_password@ \
-DVERSION_STRING=\"%version\" \
-DVERSION_STRING=%version \
..

make %{?jobs:-j%jobs} DESTDIR=%{buildroot}/${flavor}-%WINDOWS_BITS install
Expand Down
2 changes: 1 addition & 1 deletion regress/prototype.conf
Expand Up @@ -104,4 +104,4 @@ TESTPLUGIN=-Dtest-plugin=yes
# TRAYMON=-Dtraymonitor=yes
#
# override version information
# VERSION_STRING="-DVERSION_STRING=\"18.2.4.12345\""
# VERSION_STRING="-DVERSION_STRING=18.2.4.12345"
1 change: 1 addition & 0 deletions webui/cmake/BareosExtractVersionInfo.cmake
Expand Up @@ -27,5 +27,6 @@ ENDIF()
string(REGEX MATCH [0-9.]+ BAREOS_NUMERIC_VERSION ${VERSION_STRING})
string(REGEX MATCH [0-9]+ SOVERSION ${VERSION_STRING})
string(REGEX MATCH \".*\" BAREOS_FULL_VERSION ${VERSION_STRING})
string(REPLACE "\"" "" BAREOS_FULL_VERSION ${BAREOS_FULL_VERSION})

MESSAGE("BareosExtractVersionInfo: BAREOS_FULL_VERSION is " ${BAREOS_FULL_VERSION})
2 changes: 1 addition & 1 deletion webui/debian/rules
Expand Up @@ -19,7 +19,7 @@ export DH_VERBOSE = 1
export DH_OPTIONS = -v

override_dh_auto_configure:
dh_auto_configure -- -DSHARE_INSTALL_PREFIX:PATH=/usr/share -Dsysconfdir=/etc -Dconfdir=/etc/bareos -Dwebuiconfdir=/etc/bareos-webui -DVERSION_STRING=\"$(BAREOS_VERSION)\"
dh_auto_configure -- -DSHARE_INSTALL_PREFIX:PATH=/usr/share -Dsysconfdir=/etc -Dconfdir=/etc/bareos -Dwebuiconfdir=/etc/bareos-webui -DVERSION_STRING=$(BAREOS_VERSION)

override_dh_install:
dh_install
Expand Down
2 changes: 1 addition & 1 deletion webui/packaging/obs/bareos-webui.spec
Expand Up @@ -109,7 +109,7 @@ cmake . \
-Dsysconfdir=%{_sysconfdir} \
-Dconfdir=%{_sysconfdir}/bareos \
-Dwebuiconfdir=%{_sysconfdir}/bareos-webui \
-DVERSION_STRING=\"%version\"
-DVERSION_STRING=%version

make

Expand Down
2 changes: 1 addition & 1 deletion webui/version.php.in
@@ -1,3 +1,3 @@
<?php
$bareos_full_version = @BAREOS_FULL_VERSION@;
$bareos_full_version = "@BAREOS_FULL_VERSION@";
?>

0 comments on commit e907879

Please sign in to comment.