From 246e9641807e817f0a6051130128d5433e1b83a6 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Thu, 6 Dec 2007 08:40:18 -0500 Subject: BUG: fix for bug 5455, handle nodefaultlib with more than one lib --- Source/cmLocalVisualStudio7Generator.cxx | 19 ++++++++++++++++++- Source/cmLocalVisualStudio7Generator.h | 4 ++++ Tests/COnly/CMakeLists.txt | 5 ++++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 18c3007..4e7db83 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -365,7 +365,7 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorLinkFlagTable[] = {"LinkIncremental", "INCREMENTAL:NO", "link incremental", "1", 0}, {"LinkIncremental", "INCREMENTAL:YES", "link incremental", "2", 0}, {"IgnoreDefaultLibraryNames", "NODEFAULTLIB:", "default libs to ignore", "", - cmVS7FlagTable::UserValue}, + cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, {"IgnoreAllDefaultLibraries", "NODEFAULTLIB", "ignore all default libs", "TRUE", 0}, {"ModuleDefinitionFile", "DEF:", "add an export def file", "", @@ -1807,6 +1807,23 @@ cmLocalVisualStudio7GeneratorOptions // Ignore the user-specified value. this->FlagMap[entry->IDEName] = entry->value; } + else if(entry->special & cmVS7FlagTable::SemicolonAppendable) + { + const char *new_value = flag+1+n; + + std::map::iterator itr; + itr = this->FlagMap.find(entry->IDEName); + if(itr != this->FlagMap.end()) + { + // Append to old value (if present) with semicolons; + itr->second += ";"; + itr->second += new_value; + } + else + { + this->FlagMap[entry->IDEName] = new_value; + } + } else { // Use the user-specified value. diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index e2820ef..c73aa7a 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -137,6 +137,10 @@ struct cmVS7FlagTable UserIgnored = (1<<1), // ignore any user value UserRequired = (1<<2), // match only when user value is non-empty Continue = (1<<3), // continue looking for matching entries + SemicolonAppendable = (1<<4), // a flag that if specified multiple times + // should have its value appended to the + // old value with semicolons (e.g. + // /NODEFAULTLIB: => IgnoreDefaultLibraryNames) UserValueIgnored = UserValue | UserIgnored, UserValueRequired = UserValue | UserRequired diff --git a/Tests/COnly/CMakeLists.txt b/Tests/COnly/CMakeLists.txt index 6b28fec..35e70eb 100644 --- a/Tests/COnly/CMakeLists.txt +++ b/Tests/COnly/CMakeLists.txt @@ -6,6 +6,9 @@ add_library(testc1 STATIC libc1.c) add_library(testc2 SHARED libc2.c) add_executable (COnly conly.c foo.c foo.h) target_link_libraries(COnly testc1 testc2) - +if(MSVC_VERSION) + set_target_properties(COnly PROPERTIES + LINK_FLAGS " /NODEFAULTLIB:\"libc.lib\" /NODEFAULTLIB:\"libcmt.lib\" /NODEFAULTLIB:\"msvcrt.lib\" /NODEFAULTLIB:\"libcd.lib\" /NODEFAULTLIB:\"libcmtd.lib\"") +endif(MSVC_VERSION) string(ASCII 35 32 67 77 97 107 101 ASCII_STRING) message(STATUS "String: ${ASCII_STRING}") -- cgit v0.12