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 a6433e8e86..71aa1384e7 100644 --- a/ports/vcpkg-cmake-get-vars/cmake_get_vars/CMakeLists.txt +++ b/ports/vcpkg-cmake-get-vars/cmake_get_vars/CMakeLists.txt @@ -159,12 +159,37 @@ if(CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN) string(APPEND EXTRA_FLAGS " ${CMAKE_CXX_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN} \"${CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN}\"") endif() endif() -if(CMAKE_SYSROOT AND CMAKE_CXX_COMPILE_OPTIONS_SYSROOT) - string(APPEND EXTRA_FLAGS " \"${CMAKE_CXX_COMPILE_OPTIONS_SYSROOT}${CMAKE_SYSROOT}\"") + +set(extra_flags_compile "") +set(extra_flags_link "") +if(CMAKE_CXX_COMPILE_OPTIONS_SYSROOT) + if(CMAKE_SYSROOT_COMPILE) + string(APPEND extra_flags_compile " \"${CMAKE_CXX_COMPILE_OPTIONS_SYSROOT}${CMAKE_SYSROOT_COMPILE}\"") + elseif(CMAKE_SYSROOT) + string(APPEND extra_flags_compile " \"${CMAKE_CXX_COMPILE_OPTIONS_SYSROOT}${CMAKE_SYSROOT}\"") + endif() + + if(CMAKE_SYSROOT_LINK) + string(APPEND extra_flags_link " \"${CMAKE_CXX_COMPILE_OPTIONS_SYSROOT}${CMAKE_SYSROOT_LINK}\"") + elseif(CMAKE_SYSROOT) + string(APPEND extra_flags_link " \"${CMAKE_CXX_COMPILE_OPTIONS_SYSROOT}${CMAKE_SYSROOT}\"") + endif() endif() -foreach(flags ${VCPKG_LANGUAGES} SHARED_LINKER EXE_LINKER STATIC_LINKER MODULE_LINKER) +set(flags_to_add_target_compile "${VCPKG_LANGUAGES}") +set(flags_to_add_target_link SHARED_LINKER EXE_LINKER STATIC_LINKER MODULE_LINKER) + +foreach(flags IN LISTS flags_to_add_target_compile flags_to_add_target_link) set(${flags}_FLAGS "${target_param} ${CMAKE_${flags}_FLAGS} ${CMAKE_${flags}_FLAGS_${VCPKG_CONFIGS}} ${EXTRA_FLAGS}") +endforeach() + +foreach(flags IN LISTS flags_to_add_target_compile) + string(APPEND ${flags}_FLAGS " ${extra_flags_compile}") + string(STRIP ${flags}_FLAGS "${${flags}_FLAGS}") +endforeach() + +foreach(flags IN LISTS flags_to_add_target_link) + string(APPEND ${flags}_FLAGS " ${extra_flags_link}") string(STRIP ${flags}_FLAGS "${${flags}_FLAGS}") endforeach() diff --git a/ports/vcpkg-cmake-get-vars/vcpkg.json b/ports/vcpkg-cmake-get-vars/vcpkg.json index f6ed57a494..5396be4f4d 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": "2023-12-31", + "version-date": "2024-09-22", "documentation": "https://vcpkg.io/en/docs/README.html", "license": "MIT", "dependencies": [ diff --git a/scripts/get_cmake_vars/CMakeLists.txt b/scripts/get_cmake_vars/CMakeLists.txt index 934515dd18..bf1679d3da 100644 --- a/scripts/get_cmake_vars/CMakeLists.txt +++ b/scripts/get_cmake_vars/CMakeLists.txt @@ -111,8 +111,21 @@ if(CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN) string(APPEND extra_flags " ${CMAKE_CXX_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN} \"${CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN}\"") endif() endif() -if(CMAKE_SYSROOT AND CMAKE_CXX_COMPILE_OPTIONS_SYSROOT) - string(APPEND extra_flags " \"${CMAKE_CXX_COMPILE_OPTIONS_SYSROOT}${CMAKE_SYSROOT}\"") + +set(extra_flags_compile "") +set(extra_flags_link "") +if(CMAKE_CXX_COMPILE_OPTIONS_SYSROOT) + if(CMAKE_SYSROOT_COMPILE) + string(APPEND extra_flags_compile " \"${CMAKE_CXX_COMPILE_OPTIONS_SYSROOT}${CMAKE_SYSROOT_COMPILE}\"") + elseif(CMAKE_SYSROOT) + string(APPEND extra_flags_compile " \"${CMAKE_CXX_COMPILE_OPTIONS_SYSROOT}${CMAKE_SYSROOT}\"") + endif() + + if(CMAKE_SYSROOT_LINK) + string(APPEND extra_flags_link " \"${CMAKE_CXX_COMPILE_OPTIONS_SYSROOT}${CMAKE_SYSROOT_LINK}\"") + elseif(CMAKE_SYSROOT) + string(APPEND extra_flags_link " \"${CMAKE_CXX_COMPILE_OPTIONS_SYSROOT}${CMAKE_SYSROOT}\"") + endif() endif() macro(_vcpkg_adjust_flags flag_var) @@ -142,7 +155,9 @@ macro(_vcpkg_adjust_flags flag_var) endif() unset(flags_to_add_osx_arch_sysroot) endif() - set(flags_to_add_target "${VCPKG_LANG_FLAGS}" CMAKE_SHARED_LINKER_FLAGS CMAKE_MODULE_LINKER_FLAGS CMAKE_EXE_LINKER_FLAGS) + set(flags_to_add_target_compile "${VCPKG_LANG_FLAGS}") + set(flags_to_add_target_link CMAKE_SHARED_LINKER_FLAGS CMAKE_MODULE_LINKER_FLAGS CMAKE_EXE_LINKER_FLAGS) + set(flags_to_add_target "${flags_to_add_target_compile}" "${flags_to_add_target_link}") list(GET VCPKG_LANGUAGES 0 lang) if(CMAKE_${lang}_COMPILER_TARGET AND "${flag_var}" IN_LIST flags_to_add_target) if (CMAKE_${lang}_COMPILER_ID STREQUAL Clang) @@ -154,6 +169,12 @@ macro(_vcpkg_adjust_flags flag_var) if("${flag_var}" IN_LIST flags_to_add_target) string(APPEND ${flag_var} " ${extra_flags}") endif() + if("${flag_var}" IN_LIST flags_to_add_target_compile) + string(APPEND ${flag_var} " ${extra_flags_compile}") + endif() + if("${flag_var}" IN_LIST flags_to_add_target_link) + string(APPEND ${flag_var} " ${extra_flags_link}") + endif() unset(lang) unset(flags_to_add_target) endmacro() diff --git a/versions/baseline.json b/versions/baseline.json index 5399b5782a..e2a31cd073 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -9285,7 +9285,7 @@ "port-version": 0 }, "vcpkg-cmake-get-vars": { - "baseline": "2023-12-31", + "baseline": "2024-09-22", "port-version": 0 }, "vcpkg-get-python": { diff --git a/versions/v-/vcpkg-cmake-get-vars.json b/versions/v-/vcpkg-cmake-get-vars.json index 32fcd9f044..c5d4cf2759 100644 --- a/versions/v-/vcpkg-cmake-get-vars.json +++ b/versions/v-/vcpkg-cmake-get-vars.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "f23148add155147f3d95ae622d3b0031beb25acf", + "version-date": "2024-09-22", + "port-version": 0 + }, { "git-tree": "725c841810ceb8de33da68ea879eb8f0b4d6c94c", "version-date": "2023-12-31",