Skip to content

Commit

Permalink
[vcpkg] Fix '/' incorrectly replaced by '-' on Linux. (#24098)
Browse files Browse the repository at this point in the history
* Fix '/' incorrectly replaced by '-' on Linux.

* Update baseline.

* Use MATCHES instead of STREQUAL.

* Update version hash.

* Add comment for future modifications.

* Update version hash.

* Update version-date.

* Update baseline.

* Update ports/vcpkg-cmake/cmake_get_vars/CMakeLists.txt

Co-authored-by: Billy O'Neal <bion@microsoft.com>

* Update version.

* Run vcpkg format-manifest ports/vcpkg-cmake/vcpkg.json

* Run vcpkg x-add-version vcpkg-cmake

Co-authored-by: Nemirtingas <Nemirtingas@noreply.com>
Co-authored-by: Billy O'Neal <bion@microsoft.com>
  • Loading branch information
3 people committed May 7, 2022
1 parent 3b8363d commit d5ea966
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
9 changes: 6 additions & 3 deletions ports/vcpkg-cmake/cmake_get_vars/CMakeLists.txt
Expand Up @@ -143,9 +143,12 @@ foreach(incdir IN LISTS CMAKE_C_STANDARD_INCLUDE_DIRECTORIES)
endforeach()

foreach(flag CXX C SHARED_LINKER EXE_LINKER STATIC_LINKER RC)
if(MSVC)
# Transform MSVC /flags to -flags due to bash scripts intepreting /flag as a path.
# This is imperfect because it fails on directories with trailing spaces, but those are exceedingly rare
# When using MSVC, maybe transform /flags to -flags.
# When cross compiling, "/flags" may be an absolute path starting with /, so don't transform.
# Otherwise, transform to improve compatibility with scripts interpreting "/flags" as a path.
if(MSVC AND "${CMAKE_HOST_SYSTEM_NAME}" MATCHES "Windows")
# This implementation is imperfect because it fails on directories with trailing spaces,
# but those are rare.
string(REGEX REPLACE "(^| )/" "\\1-" ${flag}_FLAGS "${${flag}_FLAGS}")
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
if("${flag}" STREQUAL "CXX")
Expand Down
2 changes: 1 addition & 1 deletion ports/vcpkg-cmake/vcpkg.json
@@ -1,5 +1,5 @@
{
"name": "vcpkg-cmake",
"version-date": "2022-05-05",
"version-date": "2022-05-06",
"license": "MIT"
}
2 changes: 1 addition & 1 deletion versions/baseline.json
Expand Up @@ -7317,7 +7317,7 @@
"port-version": 1
},
"vcpkg-cmake": {
"baseline": "2022-05-05",
"baseline": "2022-05-06",
"port-version": 0
},
"vcpkg-cmake-config": {
Expand Down
5 changes: 5 additions & 0 deletions versions/v-/vcpkg-cmake.json
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "46a5686341cf9136053ff01b9f213dbd2dbea8a6",
"version-date": "2022-05-06",
"port-version": 0
},
{
"git-tree": "ecfb2282f599a9c1f3a9ad98eac9d2b35690850f",
"version-date": "2022-05-05",
Expand Down

0 comments on commit d5ea966

Please sign in to comment.