summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2002-04-08 17:36:18 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2002-04-08 17:36:18 (GMT)
commit65e3edea04fdd058719659e99a7a3da3dfb80b25 (patch)
treedb1d3a1c33d40bb43c5333399163a76df7aee689 /Source
parent7883b6c7dc38c73638947575c75aeb06acba9c90 (diff)
downloadCMake-65e3edea04fdd058719659e99a7a3da3dfb80b25.zip
CMake-65e3edea04fdd058719659e99a7a3da3dfb80b25.tar.gz
CMake-65e3edea04fdd058719659e99a7a3da3dfb80b25.tar.bz2
ENH: use separate vars for creating c++ and c shared libraries and add a test for c libraries
Diffstat (limited to 'Source')
-rw-r--r--Source/cmExecProgramCommand.cxx2
-rw-r--r--Source/cmUnixMakefileGenerator.cxx58
2 files changed, 45 insertions, 15 deletions
diff --git a/Source/cmExecProgramCommand.cxx b/Source/cmExecProgramCommand.cxx
index 7e1ad76..685e2fc 100644
--- a/Source/cmExecProgramCommand.cxx
+++ b/Source/cmExecProgramCommand.cxx
@@ -28,7 +28,7 @@ bool cmExecProgramCommand::InitialPass(std::vector<std::string> const& args)
std::string arguments;
bool doingargs = false;
int count = 0;
- for(int i=0; i < args.size(); ++i)
+ for(size_t i=0; i < args.size(); ++i)
{
if(doingargs)
{
diff --git a/Source/cmUnixMakefileGenerator.cxx b/Source/cmUnixMakefileGenerator.cxx
index 789789b..87847be 100644
--- a/Source/cmUnixMakefileGenerator.cxx
+++ b/Source/cmUnixMakefileGenerator.cxx
@@ -427,14 +427,33 @@ void cmUnixMakefileGenerator::OutputLinkLibraries(std::ostream& fout,
std::string runtimeSep;
std::vector<std::string> runtimeDirs;
- if(m_Makefile->GetDefinition("CMAKE_SHLIB_RUNTIME_FLAG"))
+ bool cxx = tgt.HasCxx();
+ if(!cxx)
{
- runtimeFlag = m_Makefile->GetDefinition("CMAKE_SHLIB_RUNTIME_FLAG");
+ if(m_Makefile->GetDefinition("CMAKE_SHLIB_RUNTIME_FLAG"))
+ {
+ runtimeFlag = m_Makefile->GetDefinition("CMAKE_SHLIB_RUNTIME_FLAG");
+ }
+
+ if(m_Makefile->GetDefinition("CMAKE_SHLIB_RUNTIME_SEP"))
+ {
+ runtimeSep = m_Makefile->GetDefinition("CMAKE_SHLIB_RUNTIME_SEP");
+ }
}
- if(m_Makefile->GetDefinition("CMAKE_SHLIB_RUNTIME_SEP"))
+ else
{
- runtimeSep = m_Makefile->GetDefinition("CMAKE_SHLIB_RUNTIME_SEP");
+ if(m_Makefile->GetDefinition("CMAKE_CXX_SHLIB_RUNTIME_FLAG"))
+ {
+ runtimeFlag = m_Makefile->GetDefinition("CMAKE_CXX_SHLIB_RUNTIME_FLAG");
+ }
+
+ if(m_Makefile->GetDefinition("CMAKE_CXX_SHLIB_RUNTIME_SEP"))
+ {
+ runtimeSep = m_Makefile->GetDefinition("CMAKE_CXX_SHLIB_RUNTIME_SEP");
+ }
}
+
+
// concatenate all paths or no?
bool runtimeConcatenate = ( runtimeSep!="" );
@@ -607,13 +626,13 @@ void cmUnixMakefileGenerator::OutputSharedLibraryRule(std::ostream& fout,
std::string command2;
if(t.HasCxx())
{
- command2 = "$(CMAKE_CXX_COMPILER) $(CMAKE_SHLIB_LINK_FLAGS) "
- "$(CMAKE_SHLIB_BUILD_FLAGS) $(CMAKE_CXX_FLAGS) -o \\\n";
+ command2 = "$(CMAKE_CXX_LINK_SHARED) $(CMAKE_CXX_SHLIB_LINK_FLAGS) "
+ "$(CMAKE_CXX_SHLIB_BUILD_FLAGS) $(CMAKE_CXX_FLAGS) -o \\\n";
}
else
{
- command2 = "$(CMAKE_C_COMPILER) $(CMAKE_SHLIB_LINK_FLAGS) "
- "$(CMAKE_SHLIB_BUILD_FLAGS) $(CMAKE_C_FLAGS) -o \\\n";
+ command2 = "$(CMAKE_C_LINK_SHARED) $(CMAKE_SHLIB_LINK_FLAGS) "
+ "$(CMAKE_SHLIB_BUILD_FLAGS) -o \\\n";
}
command2 += "\t ";
std::string libName = m_LibraryOutputPath + "lib" + std::string(name) + "$(SHLIB_SUFFIX)";
@@ -651,13 +670,13 @@ void cmUnixMakefileGenerator::OutputModuleLibraryRule(std::ostream& fout,
std::string command2;
if(t.HasCxx())
{
- command2 = "$(CMAKE_CXX_COMPILER) $(CMAKE_SHLIB_LINK_FLAGS) "
- "$(CMAKE_SHLIB_BUILD_FLAGS) $(CMAKE_CXX_FLAGS) -o \\\n";
+ command2 = "$(CMAKE_CXX_LINK_SHARED) $(CMAKE_CXX_SHLIB_LINK_FLAGS) "
+ "$(CMAKE_CXX_SHLIB_BUILD_FLAGS) $(CMAKE_CXX_FLAGS) -o \\\n";
}
else
{
- command2 = "$(CMAKE_C_COMPILER) $(CMAKE_SHLIB_LINK_FLAGS) "
- "$(CMAKE_SHLIB_BUILD_FLAGS) $(CMAKE_C_FLAGS) -o \\\n";
+ command2 = "$(CMAKE_C_LINK_SHARED) $(CMAKE_SHLIB_LINK_FLAGS) "
+ "$(CMAKE_SHLIB_BUILD_FLAGS) -o \\\n";
}
command2 += "\t ";
std::string libName = m_LibraryOutputPath + "lib" + std::string(name) + "$(MODULE_SUFFIX)";
@@ -735,7 +754,7 @@ void cmUnixMakefileGenerator::OutputExecutableRule(std::ostream& fout,
if(t.HasCxx())
{
command =
- "$(CMAKE_CXX_COMPILER) $(CMAKE_SHLIB_LINK_FLAGS) $(CMAKE_CXX_FLAGS) ";
+ "$(CMAKE_CXX_COMPILER) $(CMAKE_CXX_SHLIB_LINK_FLAGS) $(CMAKE_CXX_FLAGS) ";
}
else
{
@@ -1510,8 +1529,19 @@ void cmUnixMakefileGenerator::OutputMakeVariables(std::ostream& fout)
"CMAKE_CXX_AR = @CMAKE_CXX_AR@\n"
"CMAKE_CXX_AR_ARGS = @CMAKE_CXX_AR_ARGS@\n"
"CMAKE_C_COMPILER = @CMAKE_C_COMPILER@\n"
- "CMAKE_C_FLAGS = @CMAKE_C_FLAGS@\n"
+ "CMAKE_C_COMPILER = @CMAKE_C_COMPILER@\n"
+ "CMAKE_C_LINK_SHARED = @CMAKE_C_LINK_SHARED@\n"
+ "CMAKE_CXX_LINK_SHARED = @CMAKE_CXX_LINK_SHARED@\n"
"CMAKE_SHLIB_CFLAGS = @CMAKE_SHLIB_CFLAGS@\n"
+
+ "CMAKE_CXX_SHLIB_CFLAGS = @CMAKE_CXX_SHLIB_CFLAGS@\n"
+ "CMAKE_CXX_SHLIB_BUILD_FLAGS = @CMAKE_CXX_SHLIB_BUILD_FLAGS@\n"
+ "CMAKE_CXX_SHLIB_LINK_FLAGS = @CMAKE_CXX_SHLIB_LINK_FLAGS@\n"
+ "CMAKE_CXX_MODULE_BUILD_FLAGS = @CMAKE_CXX_MODULE_BUILD_FLAGS@\n"
+ "CMAKE_CXX_MODULE_LINK_FLAGS = @CMAKE_CXX_MODULE_LINK_FLAGS@\n"
+ "CMAKE_CXX_SHLIB_RUNTIME_FLAG = @CMAKE_CXX_SHLIB_RUNTIME_FLAG@\n"
+ "CMAKE_CXX_SHLIB_RUNTIME_SEP = @CMAKE_CXX_SHLIB_RUNTIME_SEP@\n"
+
"\n"
"CMAKE_CXX_COMPILER = @CMAKE_CXX_COMPILER@\n"
"CMAKE_CXX_FLAGS = @CMAKE_CXX_FLAGS@\n"