|
|
@ -26,27 +26,25 @@
|
|
|
|
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
|
|
|
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
|
|
|
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
|
|
|
|
function (write_static_version_header hash)
|
|
|
|
function (write_version tag)
|
|
|
|
set(VERSIONTAG "${hash}")
|
|
|
|
set(VERSIONTAG "${tag}" CACHE STRING "The tag portion of the Monero software version" FORCE)
|
|
|
|
configure_file("${CMAKE_SOURCE_DIR}/src/version.cpp.in" "${CMAKE_BINARY_DIR}/version.cpp")
|
|
|
|
configure_file("${CMAKE_SOURCE_DIR}/src/version.cpp.in" "${CMAKE_BINARY_DIR}/version.cpp")
|
|
|
|
endfunction ()
|
|
|
|
endfunction ()
|
|
|
|
|
|
|
|
|
|
|
|
find_package(Git QUIET)
|
|
|
|
find_package(Git QUIET)
|
|
|
|
if ("$Format:$" STREQUAL "")
|
|
|
|
if ("$Format:$" STREQUAL "")
|
|
|
|
# We're in a tarball; use hard-coded variables.
|
|
|
|
# We're in a tarball; use hard-coded variables.
|
|
|
|
write_static_version_header("release")
|
|
|
|
set(VERSION_IS_RELEASE "true")
|
|
|
|
|
|
|
|
write_version("release")
|
|
|
|
elseif (GIT_FOUND OR Git_FOUND)
|
|
|
|
elseif (GIT_FOUND OR Git_FOUND)
|
|
|
|
message(STATUS "Found Git: ${GIT_EXECUTABLE}")
|
|
|
|
message(STATUS "Found Git: ${GIT_EXECUTABLE}")
|
|
|
|
add_custom_command(
|
|
|
|
include(GitVersion)
|
|
|
|
OUTPUT "${CMAKE_BINARY_DIR}/version.cpp"
|
|
|
|
get_version_tag_from_git("${GIT_EXECUTABLE}")
|
|
|
|
COMMAND "${CMAKE_COMMAND}"
|
|
|
|
write_version("${VERSIONTAG}")
|
|
|
|
"-D" "GIT=${GIT_EXECUTABLE}"
|
|
|
|
|
|
|
|
"-D" "TO=${CMAKE_BINARY_DIR}/version.cpp"
|
|
|
|
|
|
|
|
"-P" "cmake/GenVersion.cmake"
|
|
|
|
|
|
|
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
|
|
|
|
|
|
|
|
else()
|
|
|
|
else()
|
|
|
|
message(STATUS "WARNING: Git was not found!")
|
|
|
|
message(STATUS "WARNING: Git was not found!")
|
|
|
|
write_static_version_header("unknown")
|
|
|
|
set(VERSION_IS_RELEASE "false")
|
|
|
|
|
|
|
|
write_version("unknown")
|
|
|
|
endif ()
|
|
|
|
endif ()
|
|
|
|
add_custom_target(genversion ALL
|
|
|
|
add_custom_target(genversion ALL
|
|
|
|
DEPENDS "${CMAKE_BINARY_DIR}/version.cpp")
|
|
|
|
DEPENDS "${CMAKE_BINARY_DIR}/version.cpp")
|
|
|
|