diff --git a/README.md b/README.md index a9d62bda..de97bdf8 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ include(${_project_options_SOURCE_DIR}/Index.cmake) # install vcpkg dependencies: - should be called before defining project() run_vcpkg( VCPKG_URL "https://github.com/microsoft/vcpkg.git" - VCPKG_REV "10e052511428d6b0c7fcc63a139e8024bb146032" + VCPKG_REV "86a181505ac6460f98496a79abdee6a0f49905ec" ) # Install conan dependencies: - should be called before defining project() run_conan() diff --git a/docs/src/project_options_example.md b/docs/src/project_options_example.md index 72483b99..1788d440 100644 --- a/docs/src/project_options_example.md +++ b/docs/src/project_options_example.md @@ -30,7 +30,7 @@ include(${_project_options_SOURCE_DIR}/Index.cmake) # install vcpkg dependencies: - should be called before defining project() run_vcpkg( VCPKG_URL "https://github.com/microsoft/vcpkg.git" - VCPKG_REV "10e052511428d6b0c7fcc63a139e8024bb146032" + VCPKG_REV "86a181505ac6460f98496a79abdee6a0f49905ec" ) # Install conan dependencies: - should be called before defining project() run_conan() diff --git a/src/Git.cmake b/src/Git.cmake index a73e12ad..e3a19f7f 100644 --- a/src/Git.cmake +++ b/src/Git.cmake @@ -319,13 +319,16 @@ function(git_add_remote) find_program(GIT_EXECUTABLE "git" REQUIRED) - # ensure that the given repository's remote is the current remote + # Get the list of the remotes execute_process( COMMAND "${GIT_EXECUTABLE}" "remote" "-v" WORKING_DIRECTORY "${_fun_REPOSITORY_PATH}" COMMAND_ERROR_IS_FATAL LAST OUTPUT_VARIABLE _remote_output ) - string(FIND "${_remote_output}" "${_fun_REMOTE_URL}" _find_index) + # Remove .git from the URL + string(REGEX REPLACE "^(.*)\.git$" "\\1" _fun_REMOTE_URL_no_git "${_fun_REMOTE_URL}") + # Check if the given remote already exists in the remote list + string(FIND "${_remote_output}" "${_fun_REMOTE_URL_no_git}" _find_index) # Add the given remote if it doesn't exist if(${_find_index} EQUAL -1) @@ -343,12 +346,8 @@ function(git_add_remote) endif() execute_process( - COMMAND "${GIT_EXECUTABLE}" "remote" "add" "${_fun_REMOTE_NAME}" "${_fun_REMOTE_URL}" - WORKING_DIRECTORY "${_fun_REPOSITORY_PATH}" COMMAND_ERROR_IS_FATAL LAST - ) - execute_process( - COMMAND "${GIT_EXECUTABLE}" "fetch" "${_fun_REMOTE_NAME}" WORKING_DIRECTORY "${_fun_REPOSITORY_PATH}" - COMMAND_ERROR_IS_FATAL LAST + COMMAND "${GIT_EXECUTABLE}" "remote" "add" "--fetch" "${_fun_REMOTE_NAME}" "${_fun_REMOTE_URL}" + WORKING_DIRECTORY "${_fun_REPOSITORY_PATH}" ) endif() endfunction() diff --git a/src/Vcpkg.cmake b/src/Vcpkg.cmake index 750f97b2..2cbb8984 100644 --- a/src/Vcpkg.cmake +++ b/src/Vcpkg.cmake @@ -170,7 +170,7 @@ Or by specifying the options run_vcpkg( VCPKG_URL "https://github.com/microsoft/vcpkg.git" - VCPKG_REV "10e052511428d6b0c7fcc63a139e8024bb146032" + VCPKG_REV "86a181505ac6460f98496a79abdee6a0f49905ec" ENABLE_VCPKG_UPDATE ) diff --git a/tests/install/vcpkg.json b/tests/install/vcpkg.json index c682f737..a38c3b13 100644 --- a/tests/install/vcpkg.json +++ b/tests/install/vcpkg.json @@ -2,7 +2,7 @@ "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", "name": "another-project", "version-string": "0.1.0", - "builtin-baseline": "10e052511428d6b0c7fcc63a139e8024bb146032", + "builtin-baseline": "86a181505ac6460f98496a79abdee6a0f49905ec", "dependencies": [ { "name": "eigen3", diff --git a/tests/myproj/CMakeLists.txt b/tests/myproj/CMakeLists.txt index 5fb5a780..041c5456 100644 --- a/tests/myproj/CMakeLists.txt +++ b/tests/myproj/CMakeLists.txt @@ -18,7 +18,7 @@ if(ENABLE_CROSS_COMPILING) endif() run_vcpkg(VCPKG_URL "https://github.com/microsoft/vcpkg.git" VCPKG_REV - "10e052511428d6b0c7fcc63a139e8024bb146032" ENABLE_VCPKG_UPDATE + "86a181505ac6460f98496a79abdee6a0f49905ec" ENABLE_VCPKG_UPDATE ) run_conan() diff --git a/tests/myproj/vcpkg.json b/tests/myproj/vcpkg.json index c4cbbf8c..cb7a84b8 100644 --- a/tests/myproj/vcpkg.json +++ b/tests/myproj/vcpkg.json @@ -2,7 +2,7 @@ "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", "name": "myproject", "version-string": "0.1.0", - "builtin-baseline": "10e052511428d6b0c7fcc63a139e8024bb146032", + "builtin-baseline": "86a181505ac6460f98496a79abdee6a0f49905ec", "dependencies": [ { "name": "eigen3",