ENH: Added explicit declarations of some C functions that are hard to get from standard headers in como (www.comeaucomputing.com) strict mode.

This commit is contained in:
Brad King 2002-10-02 17:31:59 -04:00
parent cd8e26f14c
commit 5ce73bdd14
2 changed files with 15 additions and 22 deletions

View File

@ -40,19 +40,11 @@ void cmGlobalUnixMakefileGenerator::EnableLanguage(const char* lang,
static char envCC[5000];
if(mf->GetDefinition("CMAKE_C_COMPILER"))
{
#if !defined(_WIN32) && defined(__COMO__)
std::string env = "${CMAKE_C_COMPILER}";
mf->ExpandVariablesInString(env);
strncpy(envCC, env.c_str(), 4999);
envCC[4999] = 0;
setenv("CC", envCC, 1);
#else
std::string env = "CC=${CMAKE_C_COMPILER}";
mf->ExpandVariablesInString(env);
strncpy(envCC, env.c_str(), 4999);
envCC[4999] = 0;
putenv(envCC);
#endif
}
if (m_CMakeInstance->GetIsInTryCompile())
{
@ -80,7 +72,7 @@ void cmGlobalUnixMakefileGenerator::EnableLanguage(const char* lang,
if (!versionValue || atof(versionValue) <= 1.4)
{
std::string fpath = root + "/Modules/CMakeBackwardCompatibilityC.cmake";
mf->ReadListFile(NULL,fpath.c_str());
mf->ReadListFile(0,fpath.c_str());
}
}
}
@ -91,19 +83,11 @@ void cmGlobalUnixMakefileGenerator::EnableLanguage(const char* lang,
static char envCXX[5000];
if(mf->GetDefinition("CMAKE_CXX_COMPILER"))
{
#if !defined(_WIN32) && defined(__COMO__)
std::string env = "${CMAKE_CXX_COMPILER}";
mf->ExpandVariablesInString(env);
strncpy(envCXX, env.c_str(), 4999);
envCXX[4999] = 0;
setenv("CXX", envCXX, 1);
#else
std::string env = "CXX=${CMAKE_CXX_COMPILER}";
mf->ExpandVariablesInString(env);
strncpy(envCXX, env.c_str(), 4999);
envCXX[4999] = 0;
putenv(envCXX);
#endif
}
std::string cmd = root;
if (m_CMakeInstance->GetIsInTryCompile())
@ -131,7 +115,7 @@ void cmGlobalUnixMakefileGenerator::EnableLanguage(const char* lang,
if (!versionValue || atof(versionValue) <= 1.4)
{
fpath = root + "/Modules/CMakeBackwardCompatibilityCXX.cmake";
mf->ReadListFile(NULL,fpath.c_str());
mf->ReadListFile(0,fpath.c_str());
}
}
}

View File

@ -27,10 +27,6 @@
#include "cmConfigure.h"
#endif
#if !defined(_WIN32) && defined(__COMO__)
# define _BSD_SOURCE
#endif
#ifdef _MSC_VER
#pragma warning ( disable : 4786 )
#pragma warning ( disable : 4503 )
@ -70,6 +66,19 @@
// include the "c" string header
#include <string.h>
#if !defined(_WIN32) && defined(__COMO__)
// Hack for como strict mode to avoid defining _SVID_SOURCE or _BSD_SOURCE.
extern "C"
{
extern FILE *popen (__const char *__command, __const char *__modes) __THROW;
extern int pclose (FILE *__stream) __THROW;
extern char *realpath (__const char *__restrict __name,
char *__restrict __resolved) __THROW;
extern char *strdup (__const char *__s) __THROW;
extern int putenv (char *__string) __THROW;
}
#endif
// if std:: is not supported, then just #define it away
#ifdef CMAKE_NO_STD_NAMESPACE
#define std