summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2001-07-10 15:46:20 (GMT)
committerBrad King <brad.king@kitware.com>2001-07-10 15:46:20 (GMT)
commite5a3ad77e51645ae1f1a368abdaed4776a4f51cc (patch)
treef98970c2cfe84f2d6c1397ba0b9ef82555bf5450
parente0fa3f281c4d65a347759bae9848c9fb703db6bc (diff)
downloadCMake-e5a3ad77e51645ae1f1a368abdaed4776a4f51cc.zip
CMake-e5a3ad77e51645ae1f1a368abdaed4776a4f51cc.tar.gz
CMake-e5a3ad77e51645ae1f1a368abdaed4776a4f51cc.tar.bz2
ENH: Added -D(library_name)_EXPORTS to build rules for sources that are going to be linked into a shared library. This allows dllexport setup for DLL building on cygwin. It may also come in handy in unix in the future. This corresponds to the same definition added by the dll dsp template in windows.
-rw-r--r--Source/cmUnixMakefileGenerator.cxx9
1 files changed, 7 insertions, 2 deletions
diff --git a/Source/cmUnixMakefileGenerator.cxx b/Source/cmUnixMakefileGenerator.cxx
index 1e35a41..e1d1055 100644
--- a/Source/cmUnixMakefileGenerator.cxx
+++ b/Source/cmUnixMakefileGenerator.cxx
@@ -1173,6 +1173,11 @@ void cmUnixMakefileGenerator::OutputSourceObjectBuildRules(std::ostream& fout)
target != targets.end(); ++target)
{
bool shared = (target->second.GetType() == cmTarget::SHARED_LIBRARY);
+ std::string exportsDef = "";
+ if(shared)
+ {
+ exportsDef = "-D"+target->first+"_EXPORTS ";
+ }
// Iterate over every source for this target.
const std::vector<cmSourceFile>& sources = target->second.GetSourceFiles();
for(std::vector<cmSourceFile>::const_iterator source = sources.begin();
@@ -1217,12 +1222,12 @@ void cmUnixMakefileGenerator::OutputSourceObjectBuildRules(std::ostream& fout)
std::string ext = source->GetSourceExtension();
if ( ext == "cxx" || ext == "cc" || ext == "cpp" || ext == "C" )
{
- fout << "\t${CMAKE_CXX_COMPILER} ${CMAKE_CXXFLAGS} "
+ fout << "\t${CMAKE_CXX_COMPILER} ${CMAKE_CXXFLAGS} " << exportsDef.c_str()
<< (shared? "${CMAKE_SHLIB_CFLAGS} ":"") << "${INCLUDE_FLAGS} -c $< -o $@\n\n";
}
else if ( ext == "c" )
{
- fout << "\t${CMAKE_C_COMPILER} ${CMAKE_CFLAGS} "
+ fout << "\t${CMAKE_C_COMPILER} ${CMAKE_CFLAGS} " << exportsDef.c_str()
<< (shared? "${CMAKE_SHLIB_CFLAGS} ":"") << "${INCLUDE_FLAGS} -c $< -o $@\n\n";
}
}