From eaa9f2f8eeaacb8df762efa5f7f95820aac06729 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 4 Jun 2014 16:35:34 -0400 Subject: VS: Refactor internal generator factory logic Consume the space before the platform name as soon as possible instead of including it in the comparison. --- Source/cmGlobalVisualStudio10Generator.cxx | 8 +++++--- Source/cmGlobalVisualStudio11Generator.cxx | 13 +++++-------- Source/cmGlobalVisualStudio12Generator.cxx | 8 +++++--- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 86d0de3..a6d1c31 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -48,17 +48,19 @@ public: const char* p = cmVS10GenName(name, genName); if(!p) { return 0; } - if(strcmp(p, "") == 0) + if(!*p) { return new cmGlobalVisualStudio10Generator( genName, "", ""); } - if(strcmp(p, " Win64") == 0) + if(*p++ != ' ') + { return 0; } + if(strcmp(p, "Win64") == 0) { return new cmGlobalVisualStudio10Generator( genName, "x64", "CMAKE_FORCE_WIN64"); } - if(strcmp(p, " IA64") == 0) + if(strcmp(p, "IA64") == 0) { return new cmGlobalVisualStudio10Generator( genName, "Itanium", "CMAKE_FORCE_IA64"); diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index 7033f2a..fa134fc 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -43,27 +43,24 @@ public: const char* p = cmVS11GenName(name, genName); if(!p) { return 0; } - if(strcmp(p, "") == 0) + if(!*p) { return new cmGlobalVisualStudio11Generator( genName, "", ""); } - if(strcmp(p, " Win64") == 0) + if(*p++ != ' ') + { return 0; } + if(strcmp(p, "Win64") == 0) { return new cmGlobalVisualStudio11Generator( genName, "x64", "CMAKE_FORCE_WIN64"); } - if(strcmp(p, " ARM") == 0) + if(strcmp(p, "ARM") == 0) { return new cmGlobalVisualStudio11Generator( genName, "ARM", ""); } - if(*p++ != ' ') - { - return 0; - } - std::set installedSDKs = cmGlobalVisualStudio11Generator::GetInstalledWindowsCESDKs(); diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index 40f8b05..698624d 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -43,17 +43,19 @@ public: const char* p = cmVS12GenName(name, genName); if(!p) { return 0; } - if(strcmp(p, "") == 0) + if(!*p) { return new cmGlobalVisualStudio12Generator( genName, "", ""); } - if(strcmp(p, " Win64") == 0) + if(*p++ != ' ') + { return 0; } + if(strcmp(p, "Win64") == 0) { return new cmGlobalVisualStudio12Generator( genName, "x64", "CMAKE_FORCE_WIN64"); } - if(strcmp(p, " ARM") == 0) + if(strcmp(p, "ARM") == 0) { return new cmGlobalVisualStudio12Generator( genName, "ARM", ""); -- cgit v0.12