Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
CMake
CMake
Commits
05955d64
Commit
05955d64
authored
Jan 09, 2003
by
Ken Martin
Browse files
fix bug in env settings
parent
bd217452
Changes
4
Hide whitespace changes
Inline
Side-by-side
Source/cmGlobalGenerator.cxx
View file @
05955d64
...
...
@@ -21,46 +21,11 @@
cmGlobalGenerator
::
cmGlobalGenerator
()
{
// Save the environment variables CXX and CC
m_CXXEnvironment
=
getenv
(
"CXX"
);
m_CCEnvironment
=
getenv
(
"CC"
);
// do nothing duh
}
cmGlobalGenerator
::~
cmGlobalGenerator
()
{
// restore the original environment variables CXX and CC
// Restor CC
static
char
envCC
[
5000
];
std
::
string
env
=
"CC="
;
if
(
m_CCEnvironment
)
{
env
+=
m_CCEnvironment
;
}
std
::
string
::
size_type
size
=
env
.
size
();
if
(
size
>
4999
)
{
size
=
4999
;
}
strncpy
(
envCC
,
env
.
c_str
(),
size
);
envCC
[
4999
]
=
0
;
putenv
(
envCC
);
// Restore CXX
static
char
envCXX
[
5000
];
env
=
"CXX="
;
if
(
m_CXXEnvironment
)
{
env
+=
m_CXXEnvironment
;
}
size
=
env
.
size
();
if
(
size
>
4999
)
{
size
=
4999
;
}
strncpy
(
envCXX
,
env
.
c_str
(),
size
);
envCXX
[
4999
]
=
0
;
putenv
(
envCXX
);
// Delete any existing cmLocalGenerators
unsigned
int
i
;
for
(
i
=
0
;
i
<
m_LocalGenerators
.
size
();
++
i
)
...
...
Source/cmGlobalGenerator.h
View file @
05955d64
...
...
@@ -109,8 +109,6 @@ protected:
private:
std
::
map
<
cmStdString
,
bool
>
m_LanguageEnabled
;
const
char
*
m_CXXEnvironment
;
const
char
*
m_CCEnvironment
;
};
#endif
Source/cmake.cxx
View file @
05955d64
...
...
@@ -708,9 +708,46 @@ void cmake::SetGlobalGenerator(cmGlobalGenerator *gg)
if
(
m_GlobalGenerator
)
{
delete
m_GlobalGenerator
;
// restore the original environment variables CXX and CC
// Restor CC
static
char
envCC
[
5000
];
std
::
string
env
=
"CC="
;
if
(
m_CCEnvironment
)
{
env
+=
m_CCEnvironment
;
}
std
::
string
::
size_type
size
=
env
.
size
();
if
(
size
>
4999
)
{
size
=
4999
;
}
strncpy
(
envCC
,
env
.
c_str
(),
size
);
envCC
[
4999
]
=
0
;
putenv
(
envCC
);
// Restore CXX
static
char
envCXX
[
5000
];
env
=
"CXX="
;
if
(
m_CXXEnvironment
)
{
env
+=
m_CXXEnvironment
;
}
size
=
env
.
size
();
if
(
size
>
4999
)
{
size
=
4999
;
}
strncpy
(
envCXX
,
env
.
c_str
(),
size
);
envCXX
[
4999
]
=
0
;
putenv
(
envCXX
);
}
// set the new
m_GlobalGenerator
=
gg
;
// Save the environment variables CXX and CC
m_CXXEnvironment
=
getenv
(
"CXX"
);
m_CCEnvironment
=
getenv
(
"CC"
);
// set the cmake instance just to be sure
gg
->
SetCMakeInstance
(
this
);
}
...
...
Source/cmake.h
View file @
05955d64
...
...
@@ -266,5 +266,7 @@ private:
bool
m_Local
;
bool
m_InTryCompile
;
std
::
string
m_CMakeCommand
;
const
char
*
m_CXXEnvironment
;
const
char
*
m_CCEnvironment
;
};
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment