diff options
| author | star9029 <[email protected]> | 2024-11-26 21:07:47 +0800 |
|---|---|---|
| committer | star9029 <[email protected]> | 2024-11-26 21:07:47 +0800 |
| commit | 3bafa9480911717fd9ee49cd48e02c7c7020bc5d (patch) | |
| tree | 348a43e8b2ed30653d93b34ff511dad6eae1c9b4 /xmake/modules/package/tools/cmake.lua | |
| parent | 9aa0516630fbd4d6d5bdf0fe4a704b86a53350c8 (diff) | |
improve mingw CMAKE_SYSTEM_NAME
Diffstat (limited to 'xmake/modules/package/tools/cmake.lua')
| -rw-r--r-- | xmake/modules/package/tools/cmake.lua | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua index 7f2a3d397..0d624522c 100644 --- a/xmake/modules/package/tools/cmake.lua +++ b/xmake/modules/package/tools/cmake.lua @@ -580,7 +580,10 @@ function _get_configs_for_mingw(package, configs, opt) envs.CMAKE_EXE_LINKER_FLAGS = _get_ldflags(package, opt) envs.CMAKE_SHARED_LINKER_FLAGS = _get_shflags(package, opt) envs.CMAKE_MODULE_LINKER_FLAGS = _get_shflags(package, opt) - envs.CMAKE_SYSTEM_NAME = is_host("windows") and "" or "Windows" + -- @see https://cmake.org/cmake/help/latest/variable/CMAKE_CROSSCOMPILING.html + if not is_host("windows") then + envs.CMAKE_SYSTEM_NAME = "Windows" + end envs.CMAKE_SYSTEM_PROCESSOR = _get_cmake_system_processor(package) -- avoid find and add system include/library path -- @see https://github.com/xmake-io/xmake/issues/2037 @@ -948,6 +951,13 @@ function _get_configs(package, configs, opt) end end _insert_configs_from_envs(configs, envs or {}, opt) + + local ccache = package:data("ccache") + if ccache then + table.insert(configs, "-DCMAKE_C_COMPILER_LAUNCHER=" .. ccache) + table.insert(configs, "-DCMAKE_CXX_COMPILER_LAUNCHER=" .. ccache) + end + return configs end |
