Commit fc7c3963 authored by Ghislain MARY's avatar Ghislain MARY

Fix git revision when compiling with CMake.

parent 581c9b29
......@@ -24,6 +24,7 @@
#define LINPHONE_MINOR_VERSION ${LINPHONE_MINOR_VERSION}
#define LINPHONE_MICRO_VERSION ${LINPHONE_MICRO_VERSION}
#define LINPHONE_VERSION "${LINPHONE_VERSION}"
#define LIBLINPHONE_VERSION "${LINPHONE_VERSION}"
#define LINPHONE_PLUGINS_DIR "${LINPHONE_PLUGINS_DIR}"
#define PACKAGE_LOCALE_DIR "${PACKAGE_LOCALE_DIR}"
......
......@@ -94,7 +94,7 @@ set(GENERATED_SOURCE_FILES
set_source_files_properties(${GENERATED_SOURCE_FILES} PROPERTIES GENERATED TRUE)
find_package(Git)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/liblinphone_gitversion.h
COMMAND ${CMAKE_COMMAND} -DGIT_EXECUTABLE=${GIT_EXECUTABLE} -DOUTPUT_DIR=${CMAKE_CURRENT_BINARY_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/gitversion.cmake)
COMMAND ${CMAKE_COMMAND} -DGIT_EXECUTABLE=${GIT_EXECUTABLE} -DWORK_DIR=${CMAKE_CURRENT_SOURCE_DIR} -DOUTPUT_DIR=${CMAKE_CURRENT_BINARY_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/gitversion.cmake)
add_definitions(
-DIN_LINPHONE
......
......@@ -23,16 +23,17 @@
if(GIT_EXECUTABLE)
execute_process(
COMMAND ${GIT_EXECUTABLE} describe --always
WORKING_DIRECTORY ${WORK_DIR}
OUTPUT_VARIABLE GIT_REVISION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND ${CMAKE_COMMAND} -E echo "#define GIT_VERSION \"${GIT_REVISION}\""
COMMAND ${CMAKE_COMMAND} -E echo "#define LIBLINPHONE_GIT_VERSION \"${GIT_REVISION}\""
OUTPUT_FILE ${OUTPUT_DIR}/liblinphone_gitversion.h
)
else()
execute_process(
COMMAND ${CMAKE_COMMAND} -E echo "#define GIT_VERSION \"unknown\""
COMMAND ${CMAKE_COMMAND} -E echo "#define LIBLINPHONE_GIT_VERSION \"unknown\""
OUTPUT_FILE ${OUTPUT_DIR}/liblinphone_gitversion.h
)
endif()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment