From c4d9956c0c10a4742840a5e7d93efa2e0015c865 Mon Sep 17 00:00:00 2001 From: toge Date: Sat, 8 Aug 2026 07:15:10 +0900 Subject: [PATCH] [enchantum] fix cmake config path (#53257) Co-authored-by: Billy Robert O'Neal III Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- ports/enchantum/portfile.cmake | 9 ++++++++- ports/enchantum/vcpkg.json | 3 ++- .../test_ports/vcpkg-ci-enchantum/portfile.cmake | 4 ++++ .../vcpkg-ci-enchantum/project/CMakeLists.txt | 7 +++++++ .../vcpkg-ci-enchantum/project/main.cpp | 15 +++++++++++++++ scripts/test_ports/vcpkg-ci-enchantum/vcpkg.json | 12 ++++++++++++ versions/baseline.json | 2 +- versions/e-/enchantum.json | 5 +++++ 8 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 scripts/test_ports/vcpkg-ci-enchantum/portfile.cmake create mode 100644 scripts/test_ports/vcpkg-ci-enchantum/project/CMakeLists.txt create mode 100644 scripts/test_ports/vcpkg-ci-enchantum/project/main.cpp create mode 100644 scripts/test_ports/vcpkg-ci-enchantum/vcpkg.json diff --git a/ports/enchantum/portfile.cmake b/ports/enchantum/portfile.cmake index 20bf18cab3..180cc39400 100644 --- a/ports/enchantum/portfile.cmake +++ b/ports/enchantum/portfile.cmake @@ -13,5 +13,12 @@ vcpkg_cmake_configure( ) vcpkg_cmake_install() -vcpkg_cmake_config_fixup(CONFIG_PATH "cmake") + +# upstream installs enchantumConfig.cmake into /cmake but enchantumTargets.cmake +# into /share/enchantum/cmake; merge them so the config's include() resolves +file(RENAME "${CURRENT_PACKAGES_DIR}/cmake/enchantumConfig.cmake" "${CURRENT_PACKAGES_DIR}/share/${PORT}/cmake/enchantumConfig.cmake") +file(RENAME "${CURRENT_PACKAGES_DIR}/cmake/enchantumConfigVersion.cmake" "${CURRENT_PACKAGES_DIR}/share/${PORT}/cmake/enchantumConfigVersion.cmake") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/cmake") + +vcpkg_cmake_config_fixup(CONFIG_PATH "share/${PORT}/cmake") vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/ports/enchantum/vcpkg.json b/ports/enchantum/vcpkg.json index 4b07409605..0ea81168bb 100644 --- a/ports/enchantum/vcpkg.json +++ b/ports/enchantum/vcpkg.json @@ -1,7 +1,8 @@ { "name": "enchantum", "version": "0.4.0", - "description": "Header-only C++20 fast compile time enum reflection library.", + "port-version": 1, + "description": "Header-only C++17 fast compile time enum reflection library.", "homepage": "https://github.com/ZXShady/enchantum", "license": "MIT", "dependencies": [ diff --git a/scripts/test_ports/vcpkg-ci-enchantum/portfile.cmake b/scripts/test_ports/vcpkg-ci-enchantum/portfile.cmake new file mode 100644 index 0000000000..bc785962c8 --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-enchantum/portfile.cmake @@ -0,0 +1,4 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_cmake_configure(SOURCE_PATH "${CURRENT_PORT_DIR}/project") +vcpkg_cmake_build() diff --git a/scripts/test_ports/vcpkg-ci-enchantum/project/CMakeLists.txt b/scripts/test_ports/vcpkg-ci-enchantum/project/CMakeLists.txt new file mode 100644 index 0000000000..a54ce0b5f7 --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-enchantum/project/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.20) +project(vcpkg_ci_enchantum LANGUAGES CXX) + +find_package(enchantum CONFIG REQUIRED) + +add_executable(vcpkg_ci_enchantum main.cpp) +target_link_libraries(vcpkg_ci_enchantum PRIVATE enchantum::enchantum) diff --git a/scripts/test_ports/vcpkg-ci-enchantum/project/main.cpp b/scripts/test_ports/vcpkg-ci-enchantum/project/main.cpp new file mode 100644 index 0000000000..c0585e24d9 --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-enchantum/project/main.cpp @@ -0,0 +1,15 @@ +#include + +#include + +enum class color +{ + red, + green, + blue +}; + +int main() +{ + return enchantum::to_string(color::green) == std::string_view{"green"} ? 0 : 1; +} diff --git a/scripts/test_ports/vcpkg-ci-enchantum/vcpkg.json b/scripts/test_ports/vcpkg-ci-enchantum/vcpkg.json new file mode 100644 index 0000000000..7c1d3940dc --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-enchantum/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "vcpkg-ci-enchantum", + "version-string": "ci", + "description": "Validates enchantum CMake integration", + "dependencies": [ + "enchantum", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/versions/baseline.json b/versions/baseline.json index 499e78c30c..2bdce4afec 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -2842,7 +2842,7 @@ }, "enchantum": { "baseline": "0.4.0", - "port-version": 0 + "port-version": 1 }, "enet": { "baseline": "1.3.18", diff --git a/versions/e-/enchantum.json b/versions/e-/enchantum.json index 4debed9c25..6388f527b4 100644 --- a/versions/e-/enchantum.json +++ b/versions/e-/enchantum.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "af0dbe6760759ad1a3a04b1f6f90657c0cb70ea5", + "version": "0.4.0", + "port-version": 1 + }, { "git-tree": "9e632360b3bc5934e84c78c8382c9645af4a089a", "version": "0.4.0",