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
9e526f79
Commit
9e526f79
authored
Dec 02, 2002
by
Ken Martin
Browse files
removed cmMakefile depend from cmSystemTools
parent
82a01df5
Changes
5
Hide whitespace changes
Inline
Side-by-side
Source/cmFindLibraryCommand.cxx
View file @
9e526f79
...
...
@@ -127,9 +127,7 @@ bool cmFindLibraryCommand::InitialPass(std::vector<std::string> const& argsIn)
for
(
std
::
vector
<
std
::
string
>::
iterator
i
=
names
.
begin
();
i
!=
names
.
end
()
;
++
i
)
{
library
=
cmSystemTools
::
FindLibrary
(
i
->
c_str
(),
path
,
m_Makefile
);
library
=
m_Makefile
->
FindLibrary
(
i
->
c_str
(),
path
);
if
(
library
!=
""
)
{
m_Makefile
->
AddCacheDefinition
(
args
[
0
].
c_str
(),
...
...
Source/cmMakefile.cxx
View file @
9e526f79
...
...
@@ -1459,3 +1459,79 @@ void cmMakefile::DisplayStatus(const char* message, float s)
this
->
GetLocalGenerator
()
->
GetGlobalGenerator
()
->
GetCMakeInstance
()
->
UpdateProgress
(
message
,
s
);
}
/**
* Find the library with the given name. Searches the given path and then
* the system search path. Returns the full path to the library if it is
* found. Otherwise, the empty string is returned.
*/
std
::
string
cmMakefile
::
FindLibrary
(
const
char
*
name
,
const
std
::
vector
<
std
::
string
>&
userPaths
)
{
// See if the executable exists as written.
if
(
cmSystemTools
::
FileExists
(
name
))
{
return
cmSystemTools
::
CollapseFullPath
(
name
);
}
// Add the system search path to our path.
std
::
vector
<
std
::
string
>
path
=
userPaths
;
cmSystemTools
::
GetPath
(
path
);
// Add some lib directories specific to compilers, depending on the
// current generator, so that library that might have been stored here
// can be found too.
// i.e. Microsoft Visual Studio or .Net: path to compiler/../Lib
// Borland: path to compiler/../Lib
const
char
*
genName
=
this
->
GetDefinition
(
"CMAKE_GENERATOR"
);
if
(
genName
)
{
if
(
!
strcmp
(
genName
,
"NMake Makefiles"
)
||
!
strcmp
(
genName
,
"Visual Studio 6"
))
{
const
char
*
compiler
=
this
->
GetDefinition
(
"CMAKE_CXX_COMPILER"
);
if
(
compiler
)
{
std
::
string
compiler_path
=
cmSystemTools
::
FindProgram
(
compiler
);
if
(
compiler_path
.
size
())
{
std
::
string
lib_path
=
cmSystemTools
::
GetFilenamePath
(
cmSystemTools
::
GetFilenamePath
(
compiler_path
))
+
"/Lib"
;
path
.
push_back
(
lib_path
);
}
}
}
else
if
(
!
strcmp
(
genName
,
"Visual Studio 7"
))
{
// It is likely that the compiler won't be in the path for .Net, but
// we know where devenv is.
const
char
*
devenv
=
this
->
GetDefinition
(
"MICROSOFT_DEVENV"
);
if
(
devenv
)
{
std
::
string
devenv_path
=
cmSystemTools
::
FindProgram
(
devenv
);
if
(
devenv_path
.
size
())
{
std
::
string
vc7_path
=
cmSystemTools
::
GetFilenamePath
(
cmSystemTools
::
GetFilenamePath
(
cmSystemTools
::
GetFilenamePath
(
devenv_path
)))
+
"/Vc7"
;
path
.
push_back
(
vc7_path
+
"/lib"
);
path
.
push_back
(
vc7_path
+
"/PlatformSDK/lib"
);
}
}
}
else
if
(
!
strcmp
(
genName
,
"Borland Makefiles"
))
{
const
char
*
bcb_bin_path
=
this
->
GetDefinition
(
"BCB_BIN_PATH"
);
if
(
bcb_bin_path
)
{
std
::
string
lib_path
=
cmSystemTools
::
GetFilenamePath
(
bcb_bin_path
)
+
"/Lib"
;
path
.
push_back
(
lib_path
);
}
}
}
return
cmSystemTools
::
FindLibrary
(
name
,
path
);
}
Source/cmMakefile.h
View file @
9e526f79
...
...
@@ -19,7 +19,6 @@
#include
"cmStandardIncludes.h"
#include
"cmData.h"
#include
"cmSourceFile.h"
#include
"cmSystemTools.h"
#include
"cmSourceGroup.h"
#include
"cmTarget.h"
...
...
@@ -29,6 +28,7 @@ class cmFunctionBlocker;
class
cmCommand
;
class
cmLocalGenerator
;
class
cmMakeDepend
;
class
cmSourceFile
;
/** \class cmMakefile
* \brief Process the input CMakeLists.txt file.
...
...
@@ -184,6 +184,12 @@ public:
*/
void
AddIncludeDirectory
(
const
char
*
,
bool
before
=
false
);
/**
* Find a library (as in cmSystemTools) but add in compiler specific paths
*/
std
::
string
FindLibrary
(
const
char
*
name
,
const
std
::
vector
<
std
::
string
>&
path
);
/**
* Add a variable definition to the build. This variable
* can be used in CMake to refer to lists, directories, etc.
...
...
Source/cmSystemTools.cxx
View file @
9e526f79
...
...
@@ -21,7 +21,6 @@
#include
"cmRegularExpression.h"
#include
<ctype.h>
#include
"cmDirectory.h"
#include
"cmMakefile.h"
#include
<errno.h>
...
...
@@ -1731,8 +1730,7 @@ std::string cmSystemTools::FindProgram(const char* name,
* found. Otherwise, the empty string is returned.
*/
std
::
string
cmSystemTools
::
FindLibrary
(
const
char
*
name
,
const
std
::
vector
<
std
::
string
>&
userPaths
,
const
cmMakefile
*
makefile
)
const
std
::
vector
<
std
::
string
>&
userPaths
)
{
// See if the executable exists as written.
if
(
cmSystemTools
::
FileExists
(
name
))
...
...
@@ -1743,64 +1741,6 @@ std::string cmSystemTools::FindLibrary(const char* name,
// Add the system search path to our path.
std
::
vector
<
std
::
string
>
path
=
userPaths
;
cmSystemTools
::
GetPath
(
path
);
// Add some lib directories specific to compilers, depending on the
// current generator, so that library that might have been stored here
// can be found too.
// i.e. Microsoft Visual Studio or .Net: path to compiler/../Lib
// Borland: path to compiler/../Lib
if
(
makefile
)
{
const
char
*
genName
=
makefile
->
GetDefinition
(
"CMAKE_GENERATOR"
);
if
(
genName
)
{
if
(
!
strcmp
(
genName
,
"NMake Makefiles"
)
||
!
strcmp
(
genName
,
"Visual Studio 6"
))
{
const
char
*
compiler
=
makefile
->
GetDefinition
(
"CMAKE_CXX_COMPILER"
);
if
(
compiler
)
{
std
::
string
compiler_path
=
cmSystemTools
::
FindProgram
(
compiler
);
if
(
compiler_path
.
size
())
{
std
::
string
lib_path
=
cmSystemTools
::
GetFilenamePath
(
cmSystemTools
::
GetFilenamePath
(
compiler_path
))
+
"/Lib"
;
path
.
push_back
(
lib_path
);
}
}
}
else
if
(
!
strcmp
(
genName
,
"Visual Studio 7"
))
{
// It is likely that the compiler won't be in the path for .Net, but
// we know where devenv is.
const
char
*
devenv
=
makefile
->
GetDefinition
(
"MICROSOFT_DEVENV"
);
if
(
devenv
)
{
std
::
string
devenv_path
=
cmSystemTools
::
FindProgram
(
devenv
);
if
(
devenv_path
.
size
())
{
std
::
string
vc7_path
=
cmSystemTools
::
GetFilenamePath
(
cmSystemTools
::
GetFilenamePath
(
cmSystemTools
::
GetFilenamePath
(
devenv_path
)))
+
"/Vc7"
;
path
.
push_back
(
vc7_path
+
"/lib"
);
path
.
push_back
(
vc7_path
+
"/PlatformSDK/lib"
);
}
}
}
else
if
(
!
strcmp
(
genName
,
"Borland Makefiles"
))
{
const
char
*
bcb_bin_path
=
makefile
->
GetDefinition
(
"BCB_BIN_PATH"
);
if
(
bcb_bin_path
)
{
std
::
string
lib_path
=
cmSystemTools
::
GetFilenamePath
(
bcb_bin_path
)
+
"/Lib"
;
path
.
push_back
(
lib_path
);
}
}
}
}
std
::
string
tryPath
;
for
(
std
::
vector
<
std
::
string
>::
const_iterator
p
=
path
.
begin
();
...
...
Source/cmSystemTools.h
View file @
9e526f79
...
...
@@ -19,8 +19,6 @@
#include
"cmStandardIncludes.h"
class
cmMakefile
;
/** \class cmSystemTools
* \brief A collection of useful functions for CMake.
*
...
...
@@ -236,8 +234,7 @@ public:
///! Find a library in the system PATH, with optional extra paths.
static
std
::
string
FindLibrary
(
const
char
*
name
,
const
std
::
vector
<
std
::
string
>&
path
,
const
cmMakefile
*
makefile
=
0
);
const
std
::
vector
<
std
::
string
>&
path
);
///! return true if the file is a directory.
static
bool
FileIsDirectory
(
const
char
*
name
);
...
...
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