Update shared_git_project

This commit is contained in:
King_DuckZ 2016-07-14 17:00:32 +01:00
parent 0da25f9094
commit f59d37913a

View file

@ -26,7 +26,7 @@ function (add_shared_git_project SUBMODULE_PATH)
message(FATAL_ERROR "Couldn't make up a name for given project in \"${submod_path}\"")
endif()
string(MAKE_C_IDENTIFIER "${submod_path}" proj_name_c_id)
string(MAKE_C_IDENTIFIER "${proj_name_orig}" proj_name_c_id)
string(TOUPPER ${proj_name_c_id} proj_name)
get_property(shared_projects_list GLOBAL PROPERTY SHARED_PROJECTS_LIST)
@ -58,9 +58,8 @@ function (add_shared_git_project SUBMODULE_PATH)
#Check if submodule is a subdirectory of the current source dir
file(RELATIVE_PATH reported_submodule_rel_path "${CMAKE_CURRENT_SOURCE_DIR}" "${reported_submodule_dir}")
string(LENGTH "${reported_submodule_rel_path}" rel_path_len)
message(STATUS "\"${reported_submodule_rel_path}\" - ${rel_path_len}")
if (${rel_path_len} GREATER 2)
string(SUBSTRING reported_submodule_rel_path 0 3 first_bit)
string(SUBSTRING "${reported_submodule_rel_path}" 0 3 first_bit)
if ("../" STREQUAL "${first_bit}")
set(is_out_of_dirtree ON)
else()
@ -77,10 +76,10 @@ function (add_shared_git_project SUBMODULE_PATH)
set(shared_project_binary "${CMAKE_CURRENT_BINARY_DIR}/shared_projects/${proj_name_orig}")
if (is_out_of_dirtree)
#message("Would call add_subdirectory(\"${reported_submodule_dir}\" \"${shared_project_binary}\")")
add_subdirectory("${reported_submodule_dir}" "${shared_project_binary}")
#message(FATAL_ERROR "Would call add_subdirectory(\"${reported_submodule_dir}\" \"${shared_project_binary}\")")
add_subdirectory("${reported_submodule_dir}" "${shared_project_binary}" ${ARGN})
else()
#message("Would call add_subdirectory(\"${reported_submodule_rel_path}\")")
add_subdirectory("${reported_submodule_rel_path}")
#message(FATAL_ERROR "Would call add_subdirectory(\"${reported_submodule_rel_path}\")")
add_subdirectory("${reported_submodule_rel_path}" ${ARGN})
endif()
endfunction()