Browse Source

version lib find correct directory when used as a submodule

sbg
Daniel Agar 7 years ago
parent
commit
7a5a497725
  1. 5
      src/lib/version/CMakeLists.txt

5
src/lib/version/CMakeLists.txt

@ -41,11 +41,12 @@ if (EXISTS ${PX4_SOURCE_DIR}/.git)
file(READ ${PX4_SOURCE_DIR}/.git git_dir_path) file(READ ${PX4_SOURCE_DIR}/.git git_dir_path)
string(STRIP ${git_dir_path} git_dir_path) string(STRIP ${git_dir_path} git_dir_path)
string(REPLACE "gitdir: " "" git_dir_path ${git_dir_path}) string(REPLACE "gitdir: " "" git_dir_path ${git_dir_path})
get_filename_component(git_dir_path ${git_dir_path} ABSOLUTE) get_filename_component(git_dir_path "${git_dir_path}" REALPATH BASE_DIR ${PX4_SOURCE_DIR})
endif() endif()
else() else()
message(FATAL_ERROR "is not a git repository") message(FATAL_ERROR "is not a git repository")
endif() endif()
if(NOT IS_DIRECTORY "${git_dir_path}") if(NOT IS_DIRECTORY "${git_dir_path}")
message(FATAL_ERROR "${git_dir_path} is not a directory") message(FATAL_ERROR "${git_dir_path} is not a directory")
endif() endif()
@ -72,4 +73,4 @@ px4_add_module(
ver_gen ver_gen
platforms__common platforms__common
) )
# vim: set noet ft=cmake fenc=utf-8 ff=unix :

Loading…
Cancel
Save