Commit 437043bb authored by Brad King's avatar Brad King
Browse files

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

parent 6388ebce
...@@ -135,7 +135,22 @@ cmExportFileGenerator ...@@ -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")
...@@ -193,7 +208,6 @@ cmExportFileGenerator ...@@ -193,7 +208,6 @@ cmExportFileGenerator
std::string prop = "IMPORTED_LINK_LIBRARIES"; std::string prop = "IMPORTED_LINK_LIBRARIES";
prop += suffix; prop += suffix;
properties[prop] = link_libs; properties[prop] = link_libs;
}
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
......
...@@ -67,6 +67,9 @@ protected: ...@@ -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;
......
...@@ -5,7 +5,9 @@ if(CMAKE_ANSI_CFLAGS) ...@@ -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)
......
#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[]) ...@@ -20,5 +22,5 @@ int main(int argc, const char* argv[])
return 1; return 1;
} }
} }
return 0; return testExe1lib();
} }
int testExe1lib() { return 0; }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment