diff options
| author | ruki <[email protected]> | 2023-03-16 23:14:24 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-03-16 23:14:24 +0800 |
| commit | 879f532bca3c8b56c7a2979c0246ca9ae2a909c2 (patch) | |
| tree | 5dd57a22dccf32b0526211225312d2183587e95e | |
| parent | 472ec86bf11cbeca78b71d1bc2d8112b5da03e09 (diff) | |
improve debug info from cmake.find_package
| -rw-r--r-- | xmake/modules/package/manager/cmake/find_package.lua | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/xmake/modules/package/manager/cmake/find_package.lua b/xmake/modules/package/manager/cmake/find_package.lua index b548fc123..b9e4977ef 100644 --- a/xmake/modules/package/manager/cmake/find_package.lua +++ b/xmake/modules/package/manager/cmake/find_package.lua @@ -33,7 +33,8 @@ function _find_package(cmake, name, opt) io.writefile(path.join(workdir, "test.cpp"), "") -- generate CMakeLists.txt - local cmakefile = io.open(path.join(workdir, "CMakeLists.txt"), "w") + local filepath = path.join(workdir, "CMakeLists.txt") + local cmakefile = io.open(filepath, "w") if cmake.version then cmakefile:print("cmake_minimum_required(VERSION %s)", cmake.version) end @@ -104,6 +105,10 @@ function _find_package(cmake, name, opt) cmakefile:print(" target_link_libraries(%s PRIVATE %s)", testname, linklibs) cmakefile:print("endif(%s_FOUND)", name) cmakefile:close() + if option.get("diagnosis") then + local cmakedata = io.readfile(filepath) + cprint("finding it from the generated CMakeLists.txt:\n${dim}%s", cmakedata) + end -- run cmake local envs = configs.envs or opt.envs @@ -125,7 +130,7 @@ function _find_package(cmake, name, opt) local flagsdata = io.readfile(flagsfile) if flagsdata then if option.get("diagnosis") then - vprint(flagsdata) + cprint("finding includes from %s\n${dim}%s", flagsfile, flagsdata) end for _, line in ipairs(flagsdata:split("\n", {plain = true})) do if line:find("CXX_INCLUDES =", 1, true) then @@ -165,7 +170,7 @@ function _find_package(cmake, name, opt) local linkdata = io.readfile(linkfile) if linkdata then if option.get("diagnosis") then - vprint(linkdata) + cprint("finding links from %s\n${dim}%s", linkfile, linkdata) end for _, line in ipairs(os.argv(linkdata)) do local is_ldflags = false |
