diff options
Diffstat (limited to 'xmake/plugins')
| -rw-r--r-- | xmake/plugins/project/cmake/cmakelists.lua | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/xmake/plugins/project/cmake/cmakelists.lua b/xmake/plugins/project/cmake/cmakelists.lua index 44ad8d3c2..0c51d7817 100644 --- a/xmake/plugins/project/cmake/cmakelists.lua +++ b/xmake/plugins/project/cmake/cmakelists.lua @@ -67,15 +67,18 @@ end -- add project info function _add_project(cmakelists) + local cmake_version = _get_cmake_minver() cmakelists:print([[# this is the build file for project %s # it is autogenerated by the xmake build system. # do not edit by hand. ]], project.name() or "") cmakelists:print("# project") - cmakelists:print("cmake_minimum_required(VERSION %s)", _get_cmake_minver()) + cmakelists:print("cmake_minimum_required(VERSION %s)", cmake_version) -- see https://github.com/xmake-io/xmake/issues/1661#issuecomment-927951660 - cmakelists:print("cmake_policy(SET CMP0091 NEW)") - cmakelists:print('set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded")') + if cmake_version:ge("3.15") then + cmakelists:print("cmake_policy(SET CMP0091 NEW)") + cmakelists:print('set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded")') + end local project_name = project.name() if not project_name then for _, target in pairs(project.targets()) do |
