diff options
author | Brad King <brad.king@kitware.com> | 2013-06-27 16:04:02 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-06-27 16:57:32 (GMT) |
commit | d221eac81261679d3580849218220290fcd122df (patch) | |
tree | 15df696e0e790c05387fd0441d52110e16a71ec1 /Source/cmLocalVisualStudio6Generator.cxx | |
parent | b6385cabec5356b471dc37bd999d1803555ba386 (diff) | |
download | CMake-d221eac81261679d3580849218220290fcd122df.zip CMake-d221eac81261679d3580849218220290fcd122df.tar.gz CMake-d221eac81261679d3580849218220290fcd122df.tar.bz2 |
Refactor target COMPILE_OPTIONS and COMPILE_FLAGS handling
Replace the cmLocalGenerator GetCompileOptions method with an
AddCompileOptions method since all call sites of the former simply
append the result to a flags string anyway.
Add a "lang" argument to AddCompileOptions and move the
CMAKE_<LANG>_FLAGS_REGEX filter into it. Move the call sites in each
generator to a location that has both the language and configuration
available. In the Makefile generator this also moves the flags from
build.make to flags.make where they belong.
Diffstat (limited to 'Source/cmLocalVisualStudio6Generator.cxx')
-rw-r--r-- | Source/cmLocalVisualStudio6Generator.cxx | 34 |
1 files changed, 8 insertions, 26 deletions
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 2527429..0b61e1d 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -1674,6 +1674,14 @@ void cmLocalVisualStudio6Generator flagVar = baseFlagVar + "_RELWITHDEBINFO"; flagsRelWithDebInfo = this->Makefile->GetSafeDefinition(flagVar.c_str()); flagsRelWithDebInfo += " -DCMAKE_INTDIR=\\\"RelWithDebInfo\\\" "; + + this->AddCompileOptions(flags, &target, linkLanguage, 0); + this->AddCompileOptions(flagsDebug, &target, linkLanguage, "Debug"); + this->AddCompileOptions(flagsRelease, &target, linkLanguage, "Release"); + this->AddCompileOptions(flagsMinSizeRel, &target, linkLanguage, + "MinSizeRel"); + this->AddCompileOptions(flagsRelWithDebInfo, &target, linkLanguage, + "RelWithDebInfo"); } // if _UNICODE and _SBCS are not found, then add -D_MBCS @@ -1686,32 +1694,6 @@ void cmLocalVisualStudio6Generator flags += " /D \"_MBCS\""; } - { - std::string targetFlags; - this->GetCompileOptions(targetFlags, &target, 0); - // Add per-target flags. - if(!targetFlags.empty()) - { - flags += " "; - flags += targetFlags; - } - } -#define ADD_FLAGS(CONFIG) \ - { \ - std::string targetFlags; \ - this->GetCompileOptions(targetFlags, &target, #CONFIG); \ - if(!targetFlags.empty()) \ - { \ - flags ## CONFIG += " "; \ - flags ## CONFIG += targetFlags; \ - } \ - } - - ADD_FLAGS(Debug) - ADD_FLAGS(Release) - ADD_FLAGS(MinSizeRel) - ADD_FLAGS(RelWithDebInfo) - // Add per-target and per-configuration preprocessor definitions. std::set<std::string> definesSet; std::set<std::string> debugDefinesSet; |