diff --git a/ports/vcpkg-cmake-get-vars/cmake_get_vars/CMakeLists.txt b/ports/vcpkg-cmake-get-vars/cmake_get_vars/CMakeLists.txt index 7de32bbe63..7e4c45a34d 100644 --- a/ports/vcpkg-cmake-get-vars/cmake_get_vars/CMakeLists.txt +++ b/ports/vcpkg-cmake-get-vars/cmake_get_vars/CMakeLists.txt @@ -25,6 +25,7 @@ set(COMPILERS ${VCPKG_LANGUAGES} RC) foreach(prog IN LISTS COMPILERS) list(APPEND VCPKG_DEFAULT_VARS_TO_CHECK CMAKE_${prog}_COMPILER) list(APPEND VCPKG_DEFAULT_VARS_TO_CHECK CMAKE_${prog}_COMPILER_ID) + list(APPEND VCPKG_DEFAULT_VARS_TO_CHECK CMAKE_${prog}_COMPILER_FRONTEND_VARIANT) endforeach() # Variables to check foreach(_lang IN LISTS VCPKG_LANGUAGES) diff --git a/ports/vcpkg-cmake-get-vars/vcpkg.json b/ports/vcpkg-cmake-get-vars/vcpkg.json index 9638bae51b..61b2fc7ba0 100644 --- a/ports/vcpkg-cmake-get-vars/vcpkg.json +++ b/ports/vcpkg-cmake-get-vars/vcpkg.json @@ -1,6 +1,6 @@ { "name": "vcpkg-cmake-get-vars", - "version-date": "2022-09-04", + "version-date": "2022-12-16", "documentation": "https://vcpkg.io/en/docs/README.html", "license": "MIT", "dependencies": [ diff --git a/scripts/cmake/vcpkg_configure_make.cmake b/scripts/cmake/vcpkg_configure_make.cmake index f7ada3f093..84a45d8592 100644 --- a/scripts/cmake/vcpkg_configure_make.cmake +++ b/scripts/cmake/vcpkg_configure_make.cmake @@ -79,14 +79,25 @@ macro(z_vcpkg_extract_cpp_flags_and_set_cflags_and_cxxflags flag_suffix) string(REGEX REPLACE " +" " " CPPFLAGS_${flag_suffix} "${CPPFLAGS_${flag_suffix}}") string(REGEX REPLACE " +" " " CFLAGS_${flag_suffix} "${CFLAGS_${flag_suffix}}") string(REGEX REPLACE " +" " " CXXFLAGS_${flag_suffix} "${CXXFLAGS_${flag_suffix}}") - # libtool has and -R option so we need to guard against -RTC by using -Xcompiler - # while configuring there might be a lot of unknown compiler option warnings due to that - # just ignore them. - string(REGEX REPLACE "((-|/)RTC[^ ]+)" "-Xcompiler \\1" CFLAGS_${flag_suffix} "${CFLAGS_${flag_suffix}}") - string(REGEX REPLACE "((-|/)RTC[^ ]+)" "-Xcompiler \\1" CXXFLAGS_${flag_suffix} "${CXXFLAGS_${flag_suffix}}") string(STRIP "${CPPFLAGS_${flag_suffix}}" CPPFLAGS_${flag_suffix}) string(STRIP "${CFLAGS_${flag_suffix}}" CFLAGS_${flag_suffix}) string(STRIP "${CXXFLAGS_${flag_suffix}}" CXXFLAGS_${flag_suffix}) + # libtool tries to filter CFLAGS passed to the link stage via a whitelist. + # that approach is flawed since it fails to pass flags unknown to libtool + # but required for linking to the link stage (e.g. -fsanitize=). + # libtool has an -R option so we need to guard against -RTC by using -Xcompiler + # while configuring there might be a lot of unknown compiler option warnings due to that + # just ignore them. + if(VCPKG_DETECTED_CMAKE_C_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC" OR VCPKG_DETECTED_CMAKE_C_COMPILER_ID STREQUAL "MSVC") + separate_arguments(CFLAGS_LIST NATIVE_COMMAND "${CFLAGS_${flag_suffix}}") + list(JOIN CFLAGS_LIST " -Xcompiler " CFLAGS_${var_suffix}) + string(PREPEND CFLAGS_${var_suffix} "-Xcompiler ") + endif() + if(VCPKG_DETECTED_CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC" OR VCPKG_DETECTED_CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + separate_arguments(CXXFLAGS_LIST NATIVE_COMMAND "${CXXFLAGS_${flag_suffix}}") + list(JOIN CXXFLAGS_LIST " -Xcompiler " CXXFLAGS_${var_suffix}) + string(PREPEND CXXFLAGS_${var_suffix} "-Xcompiler ") + endif() debug_message("CPPFLAGS_${flag_suffix}: ${CPPFLAGS_${flag_suffix}}") debug_message("CFLAGS_${flag_suffix}: ${CFLAGS_${flag_suffix}}") debug_message("CXXFLAGS_${flag_suffix}: ${CXXFLAGS_${flag_suffix}}") diff --git a/scripts/get_cmake_vars/CMakeLists.txt b/scripts/get_cmake_vars/CMakeLists.txt index ee43ddb3d4..1f97de305d 100644 --- a/scripts/get_cmake_vars/CMakeLists.txt +++ b/scripts/get_cmake_vars/CMakeLists.txt @@ -20,7 +20,7 @@ foreach(prog IN LISTS PROGLIST) endforeach() set(COMPILERS ${VCPKG_LANGUAGES} RC) foreach(prog IN LISTS COMPILERS) - list(APPEND VCPKG_DEFAULT_VARS_TO_CHECK CMAKE_${prog}_COMPILER CMAKE_${prog}_COMPILER_ID) + list(APPEND VCPKG_DEFAULT_VARS_TO_CHECK CMAKE_${prog}_COMPILER CMAKE_${prog}_COMPILER_ID CMAKE_${prog}_COMPILER_FRONTEND_VARIANT) endforeach() # Variables to check foreach(_lang IN LISTS VCPKG_LANGUAGES) diff --git a/versions/baseline.json b/versions/baseline.json index 0f96ad99fd..7b07442375 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -7889,7 +7889,7 @@ "port-version": 1 }, "vcpkg-cmake-get-vars": { - "baseline": "2022-09-04", + "baseline": "2022-12-16", "port-version": 0 }, "vcpkg-get-python-packages": { diff --git a/versions/v-/vcpkg-cmake-get-vars.json b/versions/v-/vcpkg-cmake-get-vars.json index 17841423d3..47e032be3c 100644 --- a/versions/v-/vcpkg-cmake-get-vars.json +++ b/versions/v-/vcpkg-cmake-get-vars.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "bad453fe7f58edb2e8d0093692dcaa52347e446c", + "version-date": "2022-12-16", + "port-version": 0 + }, { "git-tree": "898079c6021ced406d7c75f852e67a5e8861db9b", "version-date": "2022-09-04",