diff options
4 files changed, 10 insertions, 5 deletions
diff --git a/xmake/modules/package/manager/cmake/find_package.lua b/xmake/modules/package/manager/cmake/find_package.lua index ac944462c..ffc81429f 100644 --- a/xmake/modules/package/manager/cmake/find_package.lua +++ b/xmake/modules/package/manager/cmake/find_package.lua @@ -36,8 +36,13 @@ function _find_package(cmake, name, opt) if cmake.version then cmakefile:print("cmake_minimum_required(VERSION %s)", cmake.version) end + -- e.g. OpenCV 4.1.1, Boost COMPONENTS regex system + local requirestr = name + if opt.required_version then + requirestr = requirestr .. " " .. opt.required_version + end cmakefile:print("project(find_package)") - cmakefile:print("find_package(%s REQUIRED)", name) + cmakefile:print("find_package(%s REQUIRED)", requirestr) cmakefile:print("if(%s_FOUND)", name) cmakefile:print(" message(STATUS \"%s_INCLUDE_DIR=\" ${%s_INCLUDE_DIR})", name:upper(), name:upper()) cmakefile:print(" message(STATUS \"%s_LIBRARY=\" ${%s_LIBRARY})", name:upper(), name:upper()) @@ -104,7 +109,7 @@ end -- find package using the cmake package manager -- -- @param name the package name --- @param opt the options, e.g. {verbose = true) +-- @param opt the options, e.g. {verbose = true, required_version = "1.0") -- function main(name, opt) opt = opt or {} diff --git a/xmake/modules/package/manager/conan/find_package.lua b/xmake/modules/package/manager/conan/find_package.lua index d372e2a75..fca3d3891 100644 --- a/xmake/modules/package/manager/conan/find_package.lua +++ b/xmake/modules/package/manager/conan/find_package.lua @@ -59,7 +59,7 @@ end -- find package using the conan package manager -- -- @param name the package name --- @param opt the options, e.g. {verbose = true, version = "1.12.x") +-- @param opt the options, e.g. {verbose = true) -- function main(name, opt) diff --git a/xmake/modules/package/manager/conda/find_package.lua b/xmake/modules/package/manager/conda/find_package.lua index 747e1bc9b..1e09072d4 100644 --- a/xmake/modules/package/manager/conda/find_package.lua +++ b/xmake/modules/package/manager/conda/find_package.lua @@ -52,7 +52,7 @@ end -- find package using the conda package manager -- -- @param name the package name --- @param opt the options, e.g. {verbose = true, version = "1.12.0") +-- @param opt the options, e.g. {verbose = true, require_version = "1.12.0") -- function main(name, opt) diff --git a/xmake/modules/package/manager/vcpkg/find_package.lua b/xmake/modules/package/manager/vcpkg/find_package.lua index 8bb4de8e8..36df275ba 100644 --- a/xmake/modules/package/manager/vcpkg/find_package.lua +++ b/xmake/modules/package/manager/vcpkg/find_package.lua @@ -29,7 +29,7 @@ import("detect.sdks.find_vcpkgdir") -- find package from the vcpkg package manager -- -- @param name the package name, e.g. zlib, pcre --- @param opt the options, e.g. {verbose = true, version = "1.12.x") +-- @param opt the options, e.g. {verbose = true) -- function main(name, opt) |
