mirror of
https://git.wownero.com/wownero/onion-wownero-blockchain-explorer.git
synced 2024-08-15 00:33:12 +00:00
52 lines
No EOL
1.7 KiB
CMake
52 lines
No EOL
1.7 KiB
CMake
|
|
macro(configure_files srcDir destDir)
|
|
message(STATUS "Configuring directory ${destDir}")
|
|
make_directory(${destDir})
|
|
|
|
file(GLOB templateFiles RELATIVE ${srcDir} ${srcDir}/*)
|
|
foreach(templateFile ${templateFiles})
|
|
set(srcTemplatePath ${srcDir}/${templateFile})
|
|
if(NOT IS_DIRECTORY ${srcTemplatePath})
|
|
message(STATUS "Configuring file ${templateFile}")
|
|
configure_file(
|
|
${srcTemplatePath}
|
|
${destDir}/${templateFile}
|
|
@ONLY)
|
|
endif(NOT IS_DIRECTORY ${srcTemplatePath})
|
|
endforeach(templateFile)
|
|
endmacro(configure_files)
|
|
|
|
macro(create_git_version)
|
|
# Get the current working branch
|
|
execute_process(
|
|
COMMAND git rev-parse --abbrev-ref HEAD
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
OUTPUT_VARIABLE GIT_BRANCH
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
)
|
|
|
|
# http://xit0.org/2013/04/cmake-use-git-branch-and-commit-details-in-project/
|
|
# Get the latest abbreviated commit hash of the working branch
|
|
execute_process(
|
|
COMMAND git log -1 --format=%h
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
OUTPUT_VARIABLE GIT_COMMIT_HASH
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
)
|
|
|
|
# Get the date and time of last commit
|
|
execute_process(
|
|
COMMAND git log -1 --format=%cd --date=short
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
OUTPUT_VARIABLE GIT_COMMIT_DATETIME
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
)
|
|
|
|
configure_file(
|
|
${CMAKE_SOURCE_DIR}/src/version.h.in
|
|
${CMAKE_BINARY_DIR}/gen/version.h
|
|
)
|
|
|
|
include_directories(${CMAKE_BINARY_DIR}/gen)
|
|
|
|
endmacro(create_git_version) |