Added ability to toggle on/off use of C system() function call, using OSG_SYSTEM_SUPPORTED Cmake option

This commit is contained in:
Robert Osfield
2018-01-12 19:52:31 +00:00
parent 6a3d9b2aa2
commit ae57f3cd46
10 changed files with 40 additions and 10 deletions

View File

@@ -16,13 +16,29 @@
#include <osg/Config>
#ifdef OSG_ENVVAR_SUPPORTED
#if defined(OSG_SYSTEM_SUPPORTED) || defined(OSG_ENVVAR_SUPPORTED)
#include <stdlib.h>
#endif
#ifdef OSG_ENVVAR_SUPPORTED
#include <sstream>
#endif
namespace osg {
#ifdef OSG_SYSTEM_SUPPORTED
inline int system(const char* command)
{
return ::system(command);
}
#else
inline int system(const char* command)
{
OSG_WARN<<"system("<<command<<") not supported on this platform."<<std::endl;
return 0;
}
#endif
inline unsigned int getClampedLength(const char* str, unsigned int maxNumChars=4096)
{
unsigned int i = 0;