Skip to content
GitLab
Menu
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
ac432c7e
Commit
ac432c7e
authored
Mar 10, 2006
by
Bill Hoffman
Browse files
ENH: add a new FILE SYSTEM_PATH that allows you to read a environment variable with a path in it.
parent
7387cb58
Changes
2
Hide whitespace changes
Inline
Side-by-side
Source/cmFileCommand.cxx
View file @
ac432c7e
...
...
@@ -71,6 +71,10 @@ bool cmFileCommand::InitialPass(std::vector<std::string> const& args)
{
return
this
->
HandleRelativePathCommand
(
args
);
}
else
if
(
subCommand
==
"SYSTEM_PATH"
)
{
return
this
->
HandleSystemPathCommand
(
args
);
}
std
::
string
e
=
"does not recognize sub-command "
+
subCommand
;
this
->
SetError
(
e
.
c_str
());
...
...
@@ -889,3 +893,28 @@ bool cmFileCommand::HandleRemove(std::vector<std::string> const& args,
return
true
;
}
bool
cmFileCommand
::
HandleSystemPathCommand
(
std
::
vector
<
std
::
string
>
const
&
args
)
{
std
::
vector
<
std
::
string
>::
const_iterator
i
=
args
.
begin
();
if
(
args
.
size
()
!=
3
)
{
this
->
SetError
(
"FILE(SYSTEM_PATH ENV result) must be called with "
"only three arguments."
);
return
false
;
}
i
++
;
// Get rid of subcommand
std
::
vector
<
std
::
string
>
path
;
cmSystemTools
::
GetPath
(
path
,
i
->
c_str
());
i
++
;
const
char
*
var
=
i
->
c_str
();
std
::
string
value
;
for
(
std
::
vector
<
std
::
string
>::
iterator
j
=
path
.
begin
();
j
!=
path
.
end
();
++
j
)
{
value
+=
*
j
;
value
+=
";"
;
}
m_Makefile
->
AddDefinition
(
var
,
value
.
c_str
());
return
true
;
}
Source/cmFileCommand.h
View file @
ac432c7e
...
...
@@ -73,6 +73,7 @@ public:
" FILE(REMOVE_RECURSE [directory]...)
\n
"
" FILE(MAKE_DIRECTORY [directory]...)
\n
"
" FILE(RELATIVE_PATH variable directory file)
\n
"
" FILE(SYSTEM_PATH ENVIRONMENT_VARIABLE result)
\n
"
"WRITE will write a message into a file called 'filename'. It "
"overwrites the file if it already exists, and creates the file "
"if it does not exist.
\n
"
...
...
@@ -98,7 +99,9 @@ public:
" /dir/*.py - match all python files in /dir and subdirectories
\n
"
"MAKE_DIRECTORY will create a directory at the specified location
\n
"
"RELATIVE_PATH will determine relative path from directory to the given"
" file"
;
" file."
" SYSTEM_PATH will look up the environment variable named and "
"convert its contents into a cmake list of unix style paths. "
;
}
cmTypeMacro
(
cmFileCommand
,
cmCommand
);
...
...
@@ -111,6 +114,7 @@ protected:
bool
HandleMakeDirectoryCommand
(
std
::
vector
<
std
::
string
>
const
&
args
);
bool
HandleInstallCommand
(
std
::
vector
<
std
::
string
>
const
&
args
);
bool
HandleRelativePathCommand
(
std
::
vector
<
std
::
string
>
const
&
args
);
bool
HandleSystemPathCommand
(
std
::
vector
<
std
::
string
>
const
&
args
);
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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