mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-11 08:34:52 -07:00
Cmake reorganization
* Move all cmake-related files in a new “cmake” folder * move nsis files in there, too, since they are templates parsed by cake * retrieve git version once when cmake is run, and use it for both creating version_string.h/cpp and for package naming
This commit is contained in:
parent
e997b1d2bc
commit
fc24ffdec2
11 changed files with 40 additions and 48 deletions
|
|
@ -1,29 +0,0 @@
|
|||
find_package(Git)
|
||||
if(GIT_FOUND)
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} describe --long --always
|
||||
RESULT_VARIABLE res_var
|
||||
OUTPUT_VARIABLE GIT_COM_ID
|
||||
)
|
||||
if( NOT ${res_var} EQUAL 0 )
|
||||
set( GIT_COMMIT_ID "git commit id unknown")
|
||||
message( WARNING "Git failed (not a repo, or no tags). Build will not contain git revision info." )
|
||||
endif()
|
||||
string( REPLACE "\n" "" GIT_COMMIT_ID "${GIT_COM_ID}" )
|
||||
else()
|
||||
set( GIT_COMMIT_ID "unknown (git not found!)")
|
||||
message( WARNING "Git not found. Build will not contain git revision info." )
|
||||
endif()
|
||||
|
||||
set( hstring "extern const char *VERSION_STRING\;\n" )
|
||||
set( cppstring "const char * VERSION_STRING = \"${GIT_COMMIT_ID}\"\;\n")
|
||||
|
||||
file(WRITE version_string.cpp.txt ${cppstring} )
|
||||
file(WRITE version_string.h.txt ${hstring} )
|
||||
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different version_string.h.txt ${CMAKE_CURRENT_BINARY_DIR}/version_string.h
|
||||
)
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different version_string.cpp.txt ${CMAKE_CURRENT_BINARY_DIR}/version_string.cpp
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue