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
14606c99
Commit
14606c99
authored
Dec 30, 2005
by
Bill Hoffman
Browse files
ENH: move framework stuff from FindFile to FindPath
parent
9b0a485c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Source/cmFindFileCommand.cxx
View file @
14606c99
...
...
@@ -89,17 +89,6 @@ bool cmFindFileCommand::InitialPass(std::vector<std::string> const& argsIn)
return
true
;
}
}
#if defined (__APPLE__)
cmStdString
fpath
=
this
->
FindHeaderInFrameworks
(
path
,
args
[
0
].
c_str
(),
args
[
1
].
c_str
());
if
(
fpath
.
size
())
{
m_Makefile
->
AddCacheDefinition
(
args
[
0
].
c_str
(),
fpath
.
c_str
(),
helpString
.
c_str
(),
cmCacheManager
::
FILEPATH
);
return
true
;
}
#endif
std
::
string
s
=
args
[
0
]
+
"-NOTFOUND"
;
m_Makefile
->
AddCacheDefinition
(
args
[
0
].
c_str
(),
s
.
c_str
(),
...
...
@@ -108,71 +97,3 @@ bool cmFindFileCommand::InitialPass(std::vector<std::string> const& argsIn)
return
true
;
}
cmStdString
cmFindFileCommand
::
FindHeaderInFrameworks
(
std
::
vector
<
std
::
string
>
path
,
const
char
*
defineVar
,
const
char
*
file
)
{
(
void
)
defineVar
;
#ifndef __APPLE__
(
void
)
path
;
(
void
)
file
;
return
cmStdString
(
""
);
#else
cmStdString
fileName
=
file
;
cmStdString
frameWorkName
;
cmStdString
::
size_type
pos
=
fileName
.
find
(
"/"
);
std
::
cerr
<<
"ff "
<<
fileName
<<
" "
<<
pos
<<
"
\n
"
;
if
(
pos
!=
fileName
.
npos
)
{
// remove the name from the slash;
fileName
=
fileName
.
substr
(
pos
+
1
);
frameWorkName
=
file
;
frameWorkName
=
frameWorkName
.
substr
(
0
,
frameWorkName
.
size
()
-
fileName
.
size
()
-
1
);
// if the framework has a path in it then just use the filename
std
::
cerr
<<
fileName
<<
" "
<<
frameWorkName
<<
"
\n
"
;
if
(
frameWorkName
.
find
(
"/"
)
!=
frameWorkName
.
npos
)
{
fileName
=
file
;
frameWorkName
=
""
;
}
}
path
.
push_back
(
"~/Library/Frameworks"
);
path
.
push_back
(
"/Library/Frameworks"
);
path
.
push_back
(
"/System/Library/Frameworks"
);
path
.
push_back
(
"/Network/Library/Frameworks"
);
for
(
std
::
vector
<
std
::
string
>::
iterator
i
=
path
.
begin
();
i
!=
path
.
end
();
++
i
)
{
if
(
frameWorkName
.
size
())
{
std
::
string
fpath
=
*
i
;
fpath
+=
"/"
;
fpath
+=
frameWorkName
;
fpath
+=
".framework"
;
std
::
string
intPath
=
fpath
;
intPath
+=
"/Headers/"
;
intPath
+=
fileName
;
std
::
cerr
<<
"try "
<<
intPath
<<
"
\n
"
;
if
(
cmSystemTools
::
FileExists
(
intPath
.
c_str
()))
{
return
fpath
;
}
}
cmStdString
glob
=
*
i
;
glob
+=
"/*/Headers/"
;
glob
+=
file
;
cmGlob
globIt
;
globIt
.
FindFiles
(
glob
);
std
::
vector
<
std
::
string
>
files
=
globIt
.
GetFiles
();
if
(
files
.
size
())
{
cmStdString
fheader
=
cmSystemTools
::
CollapseFullPath
(
files
[
0
].
c_str
());
fheader
=
cmSystemTools
::
GetFilenamePath
(
fheader
);
return
fheader
;
}
}
return
cmStdString
(
""
);
#endif
}
Source/cmFindFileCommand.h
View file @
14606c99
...
...
@@ -79,8 +79,6 @@ public:
"different extensions on different platforms, FIND_PROGRAM "
"should be used instead of FIND_FILE when looking for them."
;
}
cmStdString
FindHeaderInFrameworks
(
std
::
vector
<
std
::
string
>
path
,
const
char
*
var
,
const
char
*
file
);
cmTypeMacro
(
cmFindFileCommand
,
cmCommand
);
};
...
...
Source/cmFindPathCommand.cxx
View file @
14606c99
...
...
@@ -98,7 +98,18 @@ bool cmFindPathCommand::InitialPass(std::vector<std::string> const& argsIn)
return
true
;
}
}
#if defined (__APPLE__)
cmStdString
fpath
=
this
->
FindHeaderInFrameworks
(
path
,
args
[
0
].
c_str
(),
args
[
1
].
c_str
());
if
(
fpath
.
size
())
{
m_Makefile
->
AddCacheDefinition
(
args
[
0
].
c_str
(),
fpath
.
c_str
(),
helpString
.
c_str
(),
cmCacheManager
::
FILEPATH
);
return
true
;
}
#endif
m_Makefile
->
AddCacheDefinition
(
args
[
0
].
c_str
(),
(
args
[
0
]
+
"-NOTFOUND"
).
c_str
(),
helpString
.
c_str
(),
...
...
@@ -106,3 +117,72 @@ bool cmFindPathCommand::InitialPass(std::vector<std::string> const& argsIn)
return
true
;
}
cmStdString
cmFindPathCommand
::
FindHeaderInFrameworks
(
std
::
vector
<
std
::
string
>
path
,
const
char
*
defineVar
,
const
char
*
file
)
{
(
void
)
defineVar
;
#ifndef __APPLE__
(
void
)
path
;
(
void
)
file
;
return
cmStdString
(
""
);
#else
cmStdString
fileName
=
file
;
cmStdString
frameWorkName
;
cmStdString
::
size_type
pos
=
fileName
.
find
(
"/"
);
std
::
cerr
<<
"ff "
<<
fileName
<<
" "
<<
pos
<<
"
\n
"
;
if
(
pos
!=
fileName
.
npos
)
{
// remove the name from the slash;
fileName
=
fileName
.
substr
(
pos
+
1
);
frameWorkName
=
file
;
frameWorkName
=
frameWorkName
.
substr
(
0
,
frameWorkName
.
size
()
-
fileName
.
size
()
-
1
);
// if the framework has a path in it then just use the filename
std
::
cerr
<<
fileName
<<
" "
<<
frameWorkName
<<
"
\n
"
;
if
(
frameWorkName
.
find
(
"/"
)
!=
frameWorkName
.
npos
)
{
fileName
=
file
;
frameWorkName
=
""
;
}
}
path
.
push_back
(
"~/Library/Frameworks"
);
path
.
push_back
(
"/Library/Frameworks"
);
path
.
push_back
(
"/System/Library/Frameworks"
);
path
.
push_back
(
"/Network/Library/Frameworks"
);
for
(
std
::
vector
<
std
::
string
>::
iterator
i
=
path
.
begin
();
i
!=
path
.
end
();
++
i
)
{
if
(
frameWorkName
.
size
())
{
std
::
string
fpath
=
*
i
;
fpath
+=
"/"
;
fpath
+=
frameWorkName
;
fpath
+=
".framework"
;
std
::
string
intPath
=
fpath
;
intPath
+=
"/Headers/"
;
intPath
+=
fileName
;
std
::
cerr
<<
"try "
<<
intPath
<<
"
\n
"
;
if
(
cmSystemTools
::
FileExists
(
intPath
.
c_str
()))
{
return
fpath
;
}
}
cmStdString
glob
=
*
i
;
glob
+=
"/*/Headers/"
;
glob
+=
file
;
cmGlob
globIt
;
globIt
.
FindFiles
(
glob
);
std
::
vector
<
std
::
string
>
files
=
globIt
.
GetFiles
();
if
(
files
.
size
())
{
cmStdString
fheader
=
cmSystemTools
::
CollapseFullPath
(
files
[
0
].
c_str
());
fheader
=
cmSystemTools
::
GetFilenamePath
(
fheader
);
return
fheader
;
}
}
return
cmStdString
(
""
);
#endif
}
Source/cmFindPathCommand.h
View file @
14606c99
...
...
@@ -78,7 +78,9 @@ public:
"the cache entry <VAR>. The environment variable CMAKE_INCLUDE_PATH "
"is searched as well as the PATH variable.
\n
"
;
}
cmStdString
FindHeaderInFrameworks
(
std
::
vector
<
std
::
string
>
path
,
const
char
*
var
,
const
char
*
file
);
cmTypeMacro
(
cmFindPathCommand
,
cmCommand
);
};
...
...
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