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
ff8ac8ee
Commit
ff8ac8ee
authored
Aug 02, 2015
by
Stephen Kelly
Browse files
cmLocalGenerator: Create from already-constructed cmMakefile.
Don't manage the lifetime of the cmMakefile with cmLocalGenerator.
parent
0bd7279f
Changes
49
Hide whitespace changes
Inline
Side-by-side
Source/CPack/cmCPackGenerator.cxx
View file @
ff8ac8ee
...
...
@@ -716,9 +716,10 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
cm
.
AddCMakePaths
();
cm
.
SetProgressCallback
(
cmCPackGeneratorProgress
,
this
);
cmGlobalGenerator
gg
(
&
cm
);
cmsys
::
auto_ptr
<
cmMakefile
>
mf
(
new
cmMakefile
(
&
gg
,
cm
.
GetCurrentSnapshot
()));
cmsys
::
auto_ptr
<
cmLocalGenerator
>
lg
(
gg
.
CreateLocalGenerator
(
cm
.
GetCurrentSnapshot
()));
cmMakefile
*
mf
=
lg
->
GetMakefile
();
gg
.
CreateLocalGenerator
(
mf
.
get
()));
std
::
string
realInstallDirectory
=
tempInstallDirectory
;
if
(
!
installSubDirectory
.
empty
()
&&
installSubDirectory
!=
"/"
)
{
...
...
Source/CPack/cpack.cxx
View file @
ff8ac8ee
...
...
@@ -202,9 +202,10 @@ int main (int argc, char const* const* argv)
cminst
.
SetHomeOutputDirectory
(
""
);
cminst
.
GetState
()
->
RemoveUnscriptableCommands
();
cmGlobalGenerator
cmgg
(
&
cminst
);
cmsys
::
auto_ptr
<
cmMakefile
>
globalMF
(
new
cmMakefile
(
&
cmgg
,
cminst
.
GetCurrentSnapshot
()));
cmsys
::
auto_ptr
<
cmLocalGenerator
>
cmlg
(
cmgg
.
CreateLocalGenerator
(
cminst
.
GetCurrentSnapshot
()));
cmMakefile
*
globalMF
=
cmlg
->
GetMakefile
();
cmgg
.
CreateLocalGenerator
(
globalMF
.
get
()));
#if defined(__CYGWIN__)
globalMF
->
AddDefinition
(
"CMAKE_LEGACY_CYGWIN_WIN32"
,
"0"
);
#endif
...
...
@@ -358,8 +359,8 @@ int main (int argc, char const* const* argv)
++
it
)
{
const
char
*
gen
=
it
->
c_str
();
cmMakefile
::
ScopePushPop
raii
(
globalMF
);
cmMakefile
*
mf
=
globalMF
;
cmMakefile
::
ScopePushPop
raii
(
globalMF
.
get
()
);
cmMakefile
*
mf
=
globalMF
.
get
()
;
cmCPack_Log
(
&
log
,
cmCPackLog
::
LOG_VERBOSE
,
"Specified generator: "
<<
gen
<<
std
::
endl
);
if
(
parsed
&&
!
mf
->
GetDefinition
(
"CPACK_PACKAGE_NAME"
)
)
...
...
Source/CTest/cmCTestLaunch.cxx
View file @
ff8ac8ee
...
...
@@ -738,9 +738,9 @@ void cmCTestLaunch::LoadConfig()
cm
.
SetHomeDirectory
(
""
);
cm
.
SetHomeOutputDirectory
(
""
);
cmGlobalGenerator
gg
(
&
cm
);
cmsys
::
auto_ptr
<
cmMakefile
>
mf
(
new
cmMakefile
(
&
gg
,
cm
.
GetCurrentSnapshot
()));
cmsys
::
auto_ptr
<
cmLocalGenerator
>
lg
(
gg
.
CreateLocalGenerator
(
cm
.
GetCurrentSnapshot
()));
cmMakefile
*
mf
=
lg
->
GetMakefile
();
gg
.
CreateLocalGenerator
(
mf
.
get
()));
std
::
string
fname
=
this
->
LogDir
;
fname
+=
"CTestLaunchConfig.cmake"
;
if
(
cmSystemTools
::
FileExists
(
fname
.
c_str
())
&&
...
...
Source/CTest/cmCTestScriptHandler.cxx
View file @
ff8ac8ee
...
...
@@ -125,6 +125,7 @@ void cmCTestScriptHandler::Initialize()
// what time in seconds did this script start running
this
->
ScriptStartTime
=
0
;
delete
this
->
Makefile
;
this
->
Makefile
=
0
;
delete
this
->
LocalGenerator
;
...
...
@@ -139,8 +140,7 @@ void cmCTestScriptHandler::Initialize()
//----------------------------------------------------------------------
cmCTestScriptHandler
::~
cmCTestScriptHandler
()
{
// local generator owns the makefile
this
->
Makefile
=
0
;
delete
this
->
Makefile
;
delete
this
->
LocalGenerator
;
delete
this
->
GlobalGenerator
;
delete
this
->
CMake
;
...
...
@@ -317,6 +317,7 @@ void cmCTestScriptHandler::CreateCMake()
delete
this
->
CMake
;
delete
this
->
GlobalGenerator
;
delete
this
->
LocalGenerator
;
delete
this
->
Makefile
;
}
this
->
CMake
=
new
cmake
;
this
->
CMake
->
SetHomeDirectory
(
""
);
...
...
@@ -325,8 +326,9 @@ void cmCTestScriptHandler::CreateCMake()
this
->
GlobalGenerator
=
new
cmGlobalGenerator
(
this
->
CMake
);
cmState
::
Snapshot
snapshot
=
this
->
CMake
->
GetCurrentSnapshot
();
this
->
LocalGenerator
=
this
->
GlobalGenerator
->
CreateLocalGenerator
(
snapshot
);
this
->
Makefile
=
this
->
LocalGenerator
->
GetMakefile
();
this
->
Makefile
=
new
cmMakefile
(
this
->
GlobalGenerator
,
snapshot
);
this
->
LocalGenerator
=
this
->
GlobalGenerator
->
CreateLocalGenerator
(
this
->
Makefile
);
this
->
CMake
->
SetProgressCallback
(
ctestScriptProgressCallback
,
this
->
CTest
);
...
...
Source/CTest/cmCTestTestHandler.cxx
View file @
ff8ac8ee
...
...
@@ -1592,9 +1592,9 @@ void cmCTestTestHandler::GetListOfTests()
cm
.
SetHomeDirectory
(
""
);
cm
.
SetHomeOutputDirectory
(
""
);
cmGlobalGenerator
gg
(
&
cm
);
cmsys
::
auto_ptr
<
cmMakefile
>
mf
(
new
cmMakefile
(
&
gg
,
cm
.
GetCurrentSnapshot
()));
cmsys
::
auto_ptr
<
cmLocalGenerator
>
lg
(
gg
.
CreateLocalGenerator
(
cm
.
GetCurrentSnapshot
()));
cmMakefile
*
mf
=
lg
->
GetMakefile
();
gg
.
CreateLocalGenerator
(
mf
.
get
()));
mf
->
AddDefinition
(
"CTEST_CONFIGURATION_TYPE"
,
this
->
CTest
->
GetConfigType
().
c_str
());
...
...
Source/cmCTest.cxx
View file @
ff8ac8ee
...
...
@@ -520,10 +520,10 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
cm
.
SetHomeDirectory
(
""
);
cm
.
SetHomeOutputDirectory
(
""
);
cmGlobalGenerator
gg
(
&
cm
);
cmsys
::
auto_ptr
<
cm
LocalGenerator
>
lg
(
gg
.
CreateLocalGenerator
(
cm
.
GetCurrentSnapsho
t
()));
cmMakefile
*
mf
=
lg
->
GetMakefile
()
;
if
(
!
this
->
ReadCustomConfigurationFileTree
(
this
->
BinaryDir
.
c_str
(),
mf
)
)
cmsys
::
auto_ptr
<
cm
Makefile
>
mf
(
new
cmMakefile
(
&
gg
,
cm
.
GetCurrentSnapshot
()));
cmsys
::
auto_ptr
<
cmLocalGenerator
>
lg
(
gg
.
CreateLocalGenerator
(
mf
.
ge
t
()));
if
(
!
this
->
ReadCustomConfigurationFileTree
(
this
->
BinaryDir
.
c_str
()
,
mf
.
get
()
)
)
{
cmCTestOptionalLog
(
this
,
DEBUG
,
"Cannot find custom configuration file tree"
<<
std
::
endl
,
quiet
);
...
...
Source/cmGlobalBorlandMakefileGenerator.cxx
View file @
ff8ac8ee
...
...
@@ -44,10 +44,10 @@ void cmGlobalBorlandMakefileGenerator
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator
*
cmGlobalBorlandMakefileGenerator
::
CreateLocalGenerator
(
cm
State
::
Snapshot
snapshot
)
cm
Makefile
*
mf
)
{
cmLocalUnixMakefileGenerator3
*
lg
=
new
cmLocalUnixMakefileGenerator3
(
this
,
snapshot
);
new
cmLocalUnixMakefileGenerator3
(
this
,
mf
);
lg
->
SetMakefileVariableSize
(
32
);
lg
->
SetMakeCommandEscapeTargetTwice
(
true
);
lg
->
SetBorlandMakeCurlyHack
(
true
);
...
...
Source/cmGlobalBorlandMakefileGenerator.h
View file @
ff8ac8ee
...
...
@@ -36,7 +36,7 @@ public:
static
void
GetDocumentation
(
cmDocumentationEntry
&
entry
);
///! Create a local generator appropriate to this Global Generator
virtual
cmLocalGenerator
*
CreateLocalGenerator
(
cm
State
::
Snapshot
snapshot
);
virtual
cmLocalGenerator
*
CreateLocalGenerator
(
cm
Makefile
*
mf
);
/**
* Try to determine system information such as shared library
...
...
Source/cmGlobalGenerator.cxx
View file @
ff8ac8ee
...
...
@@ -1127,10 +1127,10 @@ void cmGlobalGenerator::Configure()
this
->
FirstTimeProgress
=
0.0
f
;
this
->
ClearGeneratorMembers
();
// start with this directory
cmLocalGenerator
*
lg
=
this
->
CreateLocalGenerator
(
this
->
GetCMakeInstance
()
->
GetCurrentSnapshot
()
);
this
->
Makefiles
.
push_back
(
lg
->
GetMakefile
()
);
cmMakefile
*
dirMf
=
new
cmMakefile
(
this
,
this
->
GetCMakeInstance
()
->
GetCurrentSnapshot
());
this
->
Makefiles
.
push_back
(
dirMf
);
cmLocalGenerator
*
lg
=
this
->
CreateLocalGenerator
(
dirMf
);
this
->
LocalGenerators
.
push_back
(
lg
);
// set the Start directories
...
...
@@ -1601,6 +1601,7 @@ void cmGlobalGenerator::ClearGeneratorMembers()
cmDeleteAll
(
this
->
BuildExportSets
);
this
->
BuildExportSets
.
clear
();
cmDeleteAll
(
this
->
Makefiles
);
this
->
Makefiles
.
clear
();
cmDeleteAll
(
this
->
LocalGenerators
);
...
...
@@ -1987,9 +1988,9 @@ void cmGlobalGenerator::EnableInstallTarget()
}
cmLocalGenerator
*
cmGlobalGenerator
::
CreateLocalGenerator
(
cm
State
::
Snapshot
snapshot
)
cmGlobalGenerator
::
CreateLocalGenerator
(
cm
Makefile
*
mf
)
{
return
new
cmLocalGenerator
(
this
,
snapshot
);
return
new
cmLocalGenerator
(
this
,
mf
);
}
void
cmGlobalGenerator
::
EnableLanguagesFromGenerator
(
cmGlobalGenerator
*
gen
,
...
...
Source/cmGlobalGenerator.h
View file @
ff8ac8ee
...
...
@@ -57,7 +57,7 @@ public:
virtual
~
cmGlobalGenerator
();
virtual
cmLocalGenerator
*
CreateLocalGenerator
(
cm
State
::
Snapshot
snapshot
=
cmState
::
Snapshot
()
);
CreateLocalGenerator
(
cm
Makefile
*
mf
);
///! Get the name for this generator
virtual
std
::
string
GetName
()
const
{
return
"Generic"
;
}
...
...
Source/cmGlobalGhsMultiGenerator.cxx
View file @
ff8ac8ee
...
...
@@ -33,9 +33,9 @@ cmGlobalGhsMultiGenerator::~cmGlobalGhsMultiGenerator()
}
cmLocalGenerator
*
cmGlobalGhsMultiGenerator
::
CreateLocalGenerator
(
cm
State
::
Snapshot
snapshot
)
cmGlobalGhsMultiGenerator
::
CreateLocalGenerator
(
cm
Makefile
*
mf
)
{
return
new
cmLocalGhsMultiGenerator
(
this
,
snapshot
);
return
new
cmLocalGhsMultiGenerator
(
this
,
mf
);
}
void
cmGlobalGhsMultiGenerator
::
GetDocumentation
(
cmDocumentationEntry
&
entry
)
...
...
Source/cmGlobalGhsMultiGenerator.h
View file @
ff8ac8ee
...
...
@@ -31,7 +31,7 @@ public:
{
return
new
cmGlobalGeneratorSimpleFactory
<
cmGlobalGhsMultiGenerator
>
();
}
///! create the correct local generator
virtual
cmLocalGenerator
*
CreateLocalGenerator
(
cm
State
::
Snapshot
snapshot
);
virtual
cmLocalGenerator
*
CreateLocalGenerator
(
cm
Makefile
*
mf
);
/// @return the name of this generator.
static
std
::
string
GetActualName
()
{
return
"Green Hills MULTI"
;
}
...
...
Source/cmGlobalNinjaGenerator.cxx
View file @
ff8ac8ee
...
...
@@ -528,9 +528,9 @@ cmGlobalNinjaGenerator::cmGlobalNinjaGenerator(cmake* cm)
// Virtual public methods.
cmLocalGenerator
*
cmGlobalNinjaGenerator
::
CreateLocalGenerator
(
cm
State
::
Snapshot
snapshot
)
cmGlobalNinjaGenerator
::
CreateLocalGenerator
(
cm
Makefile
*
mf
)
{
return
new
cmLocalNinjaGenerator
(
this
,
snapshot
);
return
new
cmLocalNinjaGenerator
(
this
,
mf
);
}
void
cmGlobalNinjaGenerator
...
...
Source/cmGlobalNinjaGenerator.h
View file @
ff8ac8ee
...
...
@@ -167,7 +167,7 @@ public:
virtual
~
cmGlobalNinjaGenerator
()
{
}
virtual
cmLocalGenerator
*
CreateLocalGenerator
(
cm
State
::
Snapshot
snapshot
);
virtual
cmLocalGenerator
*
CreateLocalGenerator
(
cm
Makefile
*
mf
);
virtual
std
::
string
GetName
()
const
{
return
cmGlobalNinjaGenerator
::
GetActualName
();
}
...
...
Source/cmGlobalUnixMakefileGenerator3.cxx
View file @
ff8ac8ee
...
...
@@ -60,9 +60,9 @@ void cmGlobalUnixMakefileGenerator3
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator
*
cmGlobalUnixMakefileGenerator3
::
CreateLocalGenerator
(
cm
State
::
Snapshot
snapshot
)
cm
Makefile
*
mf
)
{
return
new
cmLocalUnixMakefileGenerator3
(
this
,
snapshot
);
return
new
cmLocalUnixMakefileGenerator3
(
this
,
mf
);
}
//----------------------------------------------------------------------------
...
...
@@ -577,17 +577,20 @@ void cmGlobalUnixMakefileGenerator3
makeOptions
.
begin
(),
makeOptions
.
end
());
if
(
!
targetName
.
empty
())
{
cmMakefile
*
mf
;
cmLocalUnixMakefileGenerator3
*
lg
;
if
(
!
this
->
LocalGenerators
.
empty
())
{
lg
=
static_cast
<
cmLocalUnixMakefileGenerator3
*>
(
this
->
LocalGenerators
[
0
]);
mf
=
lg
->
GetMakefile
();
}
else
{
cmState
::
Snapshot
snapshot
=
this
->
CMakeInstance
->
GetCurrentSnapshot
();
mf
=
new
cmMakefile
(
this
,
snapshot
);
lg
=
static_cast
<
cmLocalUnixMakefileGenerator3
*>
(
this
->
CreateLocalGenerator
(
snapshot
));
(
this
->
CreateLocalGenerator
(
mf
));
// set the Start directories
lg
->
GetMakefile
()
->
SetCurrentSourceDirectory
(
this
->
CMakeInstance
->
GetHomeDirectory
());
...
...
@@ -606,6 +609,7 @@ void cmGlobalUnixMakefileGenerator3
if
(
this
->
LocalGenerators
.
empty
())
{
delete
lg
;
delete
mf
;
}
}
}
...
...
Source/cmGlobalUnixMakefileGenerator3.h
View file @
ff8ac8ee
...
...
@@ -67,8 +67,7 @@ public:
/** Get the documentation entry for this generator. */
static
void
GetDocumentation
(
cmDocumentationEntry
&
entry
);
///! Create a local generator appropriate to this Global Generator3
virtual
cmLocalGenerator
*
CreateLocalGenerator
(
cmState
::
Snapshot
snapshot
);
virtual
cmLocalGenerator
*
CreateLocalGenerator
(
cmMakefile
*
mf
);
/**
* Try to determine system information such as shared library
...
...
Source/cmGlobalVisualStudio10Generator.cxx
View file @
ff8ac8ee
...
...
@@ -307,9 +307,9 @@ void cmGlobalVisualStudio10Generator::WriteSLNHeader(std::ostream& fout)
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator
*
cmGlobalVisualStudio10Generator
::
CreateLocalGenerator
(
cm
State
::
Snapshot
snapshot
)
cm
Makefile
*
mf
)
{
return
new
cmLocalVisualStudio10Generator
(
this
,
snapshot
);
return
new
cmLocalVisualStudio10Generator
(
this
,
mf
);
}
//----------------------------------------------------------------------------
...
...
Source/cmGlobalVisualStudio10Generator.h
View file @
ff8ac8ee
...
...
@@ -48,7 +48,7 @@ public:
virtual
bool
Compute
();
///! create the correct local generator
virtual
cmLocalGenerator
*
CreateLocalGenerator
(
cm
State
::
Snapshot
snapshot
);
virtual
cmLocalGenerator
*
CreateLocalGenerator
(
cm
Makefile
*
mf
);
/**
* Try to determine system information such as shared library
...
...
Source/cmGlobalVisualStudio6Generator.cxx
View file @
ff8ac8ee
...
...
@@ -173,10 +173,9 @@ cmGlobalVisualStudio6Generator::GenerateBuildCommand(
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator
*
cmGlobalVisualStudio6Generator
::
CreateLocalGenerator
(
cmState
::
Snapshot
snapshot
)
cmGlobalVisualStudio6Generator
::
CreateLocalGenerator
(
cmMakefile
*
mf
)
{
return
new
cmLocalVisualStudio6Generator
(
this
,
snapshot
);
return
new
cmLocalVisualStudio6Generator
(
this
,
mf
);
}
...
...
Source/cmGlobalVisualStudio6Generator.h
View file @
ff8ac8ee
...
...
@@ -39,7 +39,7 @@ public:
static
void
GetDocumentation
(
cmDocumentationEntry
&
entry
);
///! Create a local generator appropriate to this Global Generator
virtual
cmLocalGenerator
*
CreateLocalGenerator
(
cm
State
::
Snapshot
snapshot
);
virtual
cmLocalGenerator
*
CreateLocalGenerator
(
cm
Makefile
*
mf
);
/**
* Try to determine system information such as shared library
...
...
Prev
1
2
3
Next
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