@ -297,7 +297,14 @@ ELSE(WIN32)
SET ( PROJECT_LIBS psapi dfhack-md5 ${ DFHACK_TINYXML } dfhack-tinythread )
ENDIF ( )
ADD_LIBRARY ( dfhack-version STATIC DFHackVersion.cpp )
set ( VERSION_SRCS DFHackVersion.cpp )
set ( VERSION_HDRS git-describe.h )
SET_SOURCE_FILES_PROPERTIES ( ${ VERSION_HDRS } PROPERTIES HEADER_FILE_ONLY TRUE )
LIST ( APPEND VERSION_SRCS ${ VERSION_HDRS } )
ADD_LIBRARY ( dfhack-version STATIC ${ VERSION_SRCS } )
SET_PROPERTY ( TARGET dfhack-version APPEND PROPERTY COMPILE_DEFINITIONS
D F H A C K _ V E R S I O N = " $ { D F H A C K _ V E R S I O N } "
D F _ V E R S I O N = " $ { D F _ V E R S I O N } "
@ -312,15 +319,19 @@ ENDIF()
# a l w a y s r e - r u n g i t - d e s c r i b e i f c m a k e i s r e - run ( e.g. if build ID or version changes )
EXECUTE_PROCESS ( COMMAND ${ CMAKE_COMMAND } -E touch ${ CMAKE_CURRENT_SOURCE_DIR } /git-describe.cmake )
ADD_CUSTOM_TARGET ( git-describe
target_include_directories ( dfhack-version PRIVATE ${ CMAKE_CURRENT_BINARY_DIR } )
ADD_CUSTOM_COMMAND ( OUTPUT ${ CMAKE_CURRENT_BINARY_DIR } /git-describe.h always_rebuild
C O M M A N D $ { C M A K E _ C O M M A N D }
- D d f h a c k _ S O U R C E _ D I R : S T R I N G = $ { d f h a c k _ S O U R C E _ D I R }
- D g i t _ d e s c r i b e _ h : S T R I N G = $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / g i t - d e s c r i b e . h
- D G I T _ E X E C U T A B L E : S T R I N G = $ { G I T _ E X E C U T A B L E }
- D D F H A C K _ B U I L D _ I D : S T R I N G = $ { D F H A C K _ B U I L D _ I D }
- P $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / g i t - d e s c r i b e . c m a k e
C O M M E N T " O b t a i n i n g g i t c o m m i t i n f o r m a t i o n "
D E P E N D S $ { G I T _ E X E C U T A B L E }
V E R B A T I M
)
ADD_DEPENDENCIES ( dfhack-version git-describe )
ADD_LIBRARY ( dfhack SHARED ${ PROJECT_SOURCES } )
ADD_DEPENDENCIES ( dfhack generate_headers generate_proto_core )