Merge pull request #144 from build-cpp/msvc-runtime-subproject

Do not set CMAKE_MSVC_RUNTIME_LIBRARY if it's already set
main
Duncan Ogilvie 5 months ago committed by GitHub
commit a2f33297e4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -731,23 +731,6 @@ void generate_cmake(const char *path, const parser::Project *parent_project) {
if (is_root_project) {
cmd("cmake_minimum_required")("VERSION", project.cmake_version).endl();
if (project.project_msvc_runtime != parser::msvc_last) {
comment("Enable support for MSVC_RUNTIME_LIBRARY");
cmd("cmake_policy")("SET", "CMP0091", "NEW");
switch (project.project_msvc_runtime) {
case parser::msvc_dynamic:
cmd("set")("CMAKE_MSVC_RUNTIME_LIBRARY", "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL");
break;
case parser::msvc_static:
cmd("set")("CMAKE_MSVC_RUNTIME_LIBRARY", "MultiThreaded$<$<CONFIG:Debug>:Debug>");
break;
default:
break;
}
endl();
}
// clang-format on
if (!project.allow_in_tree) {
// clang-format off
@ -778,6 +761,26 @@ void generate_cmake(const char *path, const parser::Project *parent_project) {
cmd("endif")().endl();
// clang-format on
if (project.project_msvc_runtime != parser::msvc_last) {
comment("Enable support for MSVC_RUNTIME_LIBRARY");
cmd("cmake_policy")("SET", "CMP0091", "NEW");
// clang-format off
cmd("if")("NOT", "DEFINED", "CMAKE_MSVC_RUNTIME_LIBRARY");
switch (project.project_msvc_runtime) {
case parser::msvc_dynamic:
cmd("set")("CMAKE_MSVC_RUNTIME_LIBRARY", "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL");
break;
case parser::msvc_static:
cmd("set")("CMAKE_MSVC_RUNTIME_LIBRARY", "MultiThreaded$<$<CONFIG:Debug>:Debug>");
break;
default:
break;
}
cmd("endif")().endl();
// clang-format on
}
fs::path cmkr_include(project.cmkr_include);
if (!project.cmkr_include.empty() && !fs::exists(cmkr_include) && cmkr_include.is_relative()) {
create_file(cmkr_include, resources::cmkr);

Loading…
Cancel
Save