diff options
| author | ruki <[email protected]> | 2021-09-28 00:56:13 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-09-28 00:56:13 +0800 |
| commit | 9adbd3eaa529a66ef9f070d39f6896d45221f9b6 (patch) | |
| tree | 6485adcddc894d5494182e926c4ed2a39db8919f | |
| parent | 64b17a551574c998fd9fce3f902bf6718ae11954 (diff) | |
improve cmakelists
| -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 |
