diff --git a/ports/luafilesystem/CMakeLists.txt b/ports/luafilesystem/CMakeLists.txt index 79dd424f42..2637172faa 100644 --- a/ports/luafilesystem/CMakeLists.txt +++ b/ports/luafilesystem/CMakeLists.txt @@ -1,17 +1,43 @@ -cmake_minimum_required(VERSION 3.0) -project(luafilesystem) - -find_path(LUA_INCLUDE_DIR lua.h PATH_SUFFIXES lua) -find_library(LUA_LIBRARY lua) -set(LFS_INCLUDES ${LUA_INCLUDE_DIR}) -set(LFS_LIBRARIES ${LUA_LIBRARY}) - -add_library( lfs src/lfs.h src/lfs.c src/lfs.def) - -target_include_directories(lfs PRIVATE ${LFS_INCLUDES}) -target_link_libraries(lfs PRIVATE ${LFS_LIBRARIES}) - -install(TARGETS lfs - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib) +cmake_minimum_required(VERSION 3.11) +project(luafilesystem) + +find_path(LUA_INCLUDE_DIR lua.h PATH_SUFFIXES lua) +find_library(LUA_LIBRARY lua) +set(LFS_INCLUDES ${LUA_INCLUDE_DIR}) +set(LFS_LIBRARIES ${LUA_LIBRARY}) + +add_library(lfs src/lfs.h src/lfs.c src/lfs.def) + +target_include_directories(lfs PRIVATE ${LFS_INCLUDES}) +target_link_libraries(lfs PRIVATE ${LFS_LIBRARIES}) + +install(TARGETS lfs + EXPORT "unofficial-${PROJECT_NAME}-targets" + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) + +include(CMakePackageConfigHelpers) + +configure_package_config_file( + "${CMAKE_CURRENT_SOURCE_DIR}/unofficial-${PROJECT_NAME}-config.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/unofficial-${PROJECT_NAME}-config.cmake" + INSTALL_DESTINATION "share/unofficial-${PROJECT_NAME}" +) + +set(VERSION_FILE_PATH "${CMAKE_CURRENT_BINARY_DIR}/unofficial-${PROJECT_NAME}-config-version.cmake") +write_basic_package_version_file( + "${VERSION_FILE_PATH}" + VERSION "${LFS_VERSION}" + COMPATIBILITY SameMajorVersion +) + +install( + FILES "${CMAKE_CURRENT_BINARY_DIR}/unofficial-${PROJECT_NAME}-config.cmake" + DESTINATION "share/unofficial-${PROJECT_NAME}" +) + +install( + EXPORT "unofficial-${PROJECT_NAME}-targets" + NAMESPACE "unofficial::${PROJECT_NAME}::" + DESTINATION "share/unofficial-${PROJECT_NAME}") diff --git a/ports/luafilesystem/portfile.cmake b/ports/luafilesystem/portfile.cmake index 9fde932cab..d0fe0cb51d 100644 --- a/ports/luafilesystem/portfile.cmake +++ b/ports/luafilesystem/portfile.cmake @@ -11,16 +11,26 @@ vcpkg_from_github( ) file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}") +file(COPY "${CMAKE_CURRENT_LIST_DIR}/unofficial-luafilesystem-config.cmake.in" DESTINATION "${SOURCE_PATH}") vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DLFS_VERSION="${VERSION}" ) vcpkg_cmake_install() vcpkg_copy_pdbs() +vcpkg_cmake_config_fixup(PACKAGE_NAME "unofficial-luafilesystem") + +file(REMOVE_RECURSE + "${CURRENT_PACKAGES_DIR}/debug/include" + "${CURRENT_PACKAGES_DIR}/debug/share" +) # Handle copyright file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") # Allow empty include directory set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled) diff --git a/ports/luafilesystem/unofficial-luafilesystem-config.cmake.in b/ports/luafilesystem/unofficial-luafilesystem-config.cmake.in new file mode 100644 index 0000000000..c03cd5eee4 --- /dev/null +++ b/ports/luafilesystem/unofficial-luafilesystem-config.cmake.in @@ -0,0 +1,6 @@ +@PACKAGE_INIT@ + +include("${CMAKE_CURRENT_LIST_DIR}/unofficial-luafilesystem-targets.cmake") + + +check_required_components(luafilesystem) diff --git a/ports/luafilesystem/usage b/ports/luafilesystem/usage new file mode 100644 index 0000000000..2029ca3321 --- /dev/null +++ b/ports/luafilesystem/usage @@ -0,0 +1,4 @@ +luafilesystem provides CMake targets: + + find_package(unofficial-luafilesystem CONFIG REQUIRED) + target_link_libraries(main PRIVATE unofficial::luafilesystem::lfs) diff --git a/ports/luafilesystem/vcpkg.json b/ports/luafilesystem/vcpkg.json index b5d82852a0..f741726f42 100644 --- a/ports/luafilesystem/vcpkg.json +++ b/ports/luafilesystem/vcpkg.json @@ -1,7 +1,7 @@ { "name": "luafilesystem", "version": "1.8.0", - "port-version": 5, + "port-version": 6, "description": "LuaFileSystem is a Lua library developed to complement the set of functions related to file systems offered by the standard Lua distribution.", "homepage": "https://github.com/keplerproject/luafilesystem", "supports": "!uwp", @@ -10,6 +10,10 @@ { "name": "vcpkg-cmake", "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true } ] } diff --git a/versions/baseline.json b/versions/baseline.json index 1dd7526d01..f0d413eb0a 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -5482,7 +5482,7 @@ }, "luafilesystem": { "baseline": "1.8.0", - "port-version": 5 + "port-version": 6 }, "luajit": { "baseline": "2023-01-04", diff --git a/versions/l-/luafilesystem.json b/versions/l-/luafilesystem.json index b7d9d3d6e9..d2eb13406e 100644 --- a/versions/l-/luafilesystem.json +++ b/versions/l-/luafilesystem.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "4b474bdcc3f49eef949ba79ad3294556e39af778", + "version": "1.8.0", + "port-version": 6 + }, { "git-tree": "7a2e981db39265f79730f1c73502dfa362db30b5", "version": "1.8.0",