BUG: Fix export/import file generation to not store link dependencies of executables or modules.

This commit is contained in:
Brad King 2008-01-28 13:37:59 -05:00
parent 6388ebceb1
commit 437043bb04
5 changed files with 25 additions and 3 deletions

View File

@ -135,7 +135,22 @@ cmExportFileGenerator
} }
// Add the transitive link dependencies for this configuration. // Add the transitive link dependencies for this configuration.
if(target->GetType() == cmTarget::STATIC_LIBRARY ||
target->GetType() == cmTarget::SHARED_LIBRARY)
{ {
this->SetImportLinkProperties(config, suffix, target, properties);
}
}
//----------------------------------------------------------------------------
void
cmExportFileGenerator
::SetImportLinkProperties(const char* config, std::string const& suffix,
cmTarget* target, ImportPropertyMap& properties)
{
// Get the makefile in which to lookup target information.
cmMakefile* mf = target->GetMakefile();
// Compute which library configuration to link. // Compute which library configuration to link.
cmTarget::LinkLibraryType linkType = cmTarget::OPTIMIZED; cmTarget::LinkLibraryType linkType = cmTarget::OPTIMIZED;
if(config && cmSystemTools::UpperCase(config) == "DEBUG") if(config && cmSystemTools::UpperCase(config) == "DEBUG")
@ -194,7 +209,6 @@ cmExportFileGenerator
prop += suffix; prop += suffix;
properties[prop] = link_libs; properties[prop] = link_libs;
} }
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmExportFileGenerator::GenerateImportHeaderCode(std::ostream& os, void cmExportFileGenerator::GenerateImportHeaderCode(std::ostream& os,

View File

@ -67,6 +67,9 @@ protected:
void SetImportDetailProperties(const char* config, void SetImportDetailProperties(const char* config,
std::string const& suffix, cmTarget* target, std::string const& suffix, cmTarget* target,
ImportPropertyMap& properties); ImportPropertyMap& properties);
void SetImportLinkProperties(const char* config,
std::string const& suffix, cmTarget* target,
ImportPropertyMap& properties);
/** Each subclass knows how to generate its kind of export file. */ /** Each subclass knows how to generate its kind of export file. */
virtual bool GenerateMainFile(std::ostream& os) = 0; virtual bool GenerateMainFile(std::ostream& os) = 0;

View File

@ -5,7 +5,9 @@ if(CMAKE_ANSI_CFLAGS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_ANSI_CFLAGS}") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_ANSI_CFLAGS}")
endif(CMAKE_ANSI_CFLAGS) endif(CMAKE_ANSI_CFLAGS)
add_library(testExe1lib STATIC testExe1lib.c) # not exported
add_executable(testExe1 testExe1.c) add_executable(testExe1 testExe1.c)
target_link_libraries(testExe1 testExe1lib)
add_executable(testExe2 testExe2.c) add_executable(testExe2 testExe2.c)
set_property(TARGET testExe2 PROPERTY ENABLE_EXPORTS 1) set_property(TARGET testExe2 PROPERTY ENABLE_EXPORTS 1)

View File

@ -1,5 +1,7 @@
#include <stdio.h> #include <stdio.h>
extern int testExe1lib();
int main(int argc, const char* argv[]) int main(int argc, const char* argv[])
{ {
if(argc < 2) if(argc < 2)
@ -20,5 +22,5 @@ int main(int argc, const char* argv[])
return 1; return 1;
} }
} }
return 0; return testExe1lib();
} }

View File

@ -0,0 +1 @@
int testExe1lib() { return 0; }