summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalUnixMakefileGenerator3.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmGlobalUnixMakefileGenerator3.cxx')
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx102
1 files changed, 53 insertions, 49 deletions
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 4a5cc77..23b3718 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -2,6 +2,11 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGlobalUnixMakefileGenerator3.h"
+#include <algorithm>
+#include <functional>
+#include <sstream>
+#include <utility>
+
#include "cmAlgorithms.h"
#include "cmDocumentationEntry.h"
#include "cmGeneratedFileStream.h"
@@ -12,16 +17,14 @@
#include "cmMakefile.h"
#include "cmMakefileTargetGenerator.h"
#include "cmOutputConverter.h"
+#include "cmState.h"
+#include "cmStateDirectory.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetDepend.h"
#include "cmake.h"
-#include <algorithm>
-#include <functional>
-#include <sstream>
-#include <utility>
-
cmGlobalUnixMakefileGenerator3::cmGlobalUnixMakefileGenerator3(cmake* cm)
: cmGlobalCommonGenerator(cm)
{
@@ -93,7 +96,7 @@ std::string cmGlobalUnixMakefileGenerator3::GetEditCacheCommand() const
if (!editCacheCommand.empty()) {
cm->AddCacheEntry("CMAKE_EDIT_COMMAND", editCacheCommand.c_str(),
"Path to cache edit program executable.",
- cmState::INTERNAL);
+ cmStateEnums::INTERNAL);
}
}
const char* edit_cmd = cm->GetCacheDefinition("CMAKE_EDIT_COMMAND");
@@ -201,7 +204,8 @@ void cmGlobalUnixMakefileGenerator3::WriteMainMakefile2()
this->GetCMakeInstance()->GetHomeOutputDirectory();
makefileName += cmake::GetCMakeFilesDirectory();
makefileName += "/Makefile2";
- cmGeneratedFileStream makefileStream(makefileName.c_str());
+ cmGeneratedFileStream makefileStream(makefileName.c_str(), false,
+ this->GetMakefileEncoding());
if (!makefileStream) {
return;
}
@@ -306,16 +310,12 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
// reset lg to the first makefile
lg = static_cast<cmLocalUnixMakefileGenerator3*>(this->LocalGenerators[0]);
- // Build the path to the cache file.
- std::string cache = this->GetCMakeInstance()->GetHomeOutputDirectory();
- cache += "/CMakeCache.txt";
-
std::string currentBinDir = lg->GetCurrentBinaryDirectory();
// Save the list to the cmake file.
cmakefileStream
<< "# The top level Makefile was generated from the following files:\n"
<< "set(CMAKE_MAKEFILE_DEPENDS\n"
- << " \"" << lg->ConvertToRelativePath(currentBinDir, cache) << "\"\n";
+ << " \"CMakeCache.txt\"\n";
for (std::vector<std::string>::const_iterator i = lfiles.begin();
i != lfiles.end(); ++i) {
cmakefileStream << " \"" << lg->ConvertToRelativePath(currentBinDir, *i)
@@ -385,12 +385,12 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefileLanguageRules(
std::vector<cmGeneratorTarget*> tgts = lg->GetGeneratorTargets();
for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
l != tgts.end(); l++) {
- if (((*l)->GetType() == cmState::EXECUTABLE) ||
- ((*l)->GetType() == cmState::STATIC_LIBRARY) ||
- ((*l)->GetType() == cmState::SHARED_LIBRARY) ||
- ((*l)->GetType() == cmState::MODULE_LIBRARY) ||
- ((*l)->GetType() == cmState::OBJECT_LIBRARY) ||
- ((*l)->GetType() == cmState::UTILITY)) {
+ if (((*l)->GetType() == cmStateEnums::EXECUTABLE) ||
+ ((*l)->GetType() == cmStateEnums::STATIC_LIBRARY) ||
+ ((*l)->GetType() == cmStateEnums::SHARED_LIBRARY) ||
+ ((*l)->GetType() == cmStateEnums::MODULE_LIBRARY) ||
+ ((*l)->GetType() == cmStateEnums::OBJECT_LIBRARY) ||
+ ((*l)->GetType() == cmStateEnums::UTILITY)) {
cmGeneratorTarget* gt = *l;
std::string tname = lg->GetRelativeTargetDirectory(gt);
tname += "/DependInfo.cmake";
@@ -419,10 +419,12 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRule2(
l != targets.end(); ++l) {
cmGeneratorTarget* gtarget = *l;
int type = gtarget->GetType();
- if ((type == cmState::EXECUTABLE) || (type == cmState::STATIC_LIBRARY) ||
- (type == cmState::SHARED_LIBRARY) ||
- (type == cmState::MODULE_LIBRARY) ||
- (type == cmState::OBJECT_LIBRARY) || (type == cmState::UTILITY)) {
+ if ((type == cmStateEnums::EXECUTABLE) ||
+ (type == cmStateEnums::STATIC_LIBRARY) ||
+ (type == cmStateEnums::SHARED_LIBRARY) ||
+ (type == cmStateEnums::MODULE_LIBRARY) ||
+ (type == cmStateEnums::OBJECT_LIBRARY) ||
+ (type == cmStateEnums::UTILITY)) {
// Add this to the list of depends rules in this directory.
if ((!check_all || !gtarget->GetPropertyAsBool("EXCLUDE_FROM_ALL")) &&
(!check_relink ||
@@ -437,9 +439,8 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRule2(
// The directory-level rule should depend on the directory-level
// rules of the subdirectories.
- std::vector<cmState::Snapshot> children =
- lg->GetStateSnapshot().GetChildren();
- for (std::vector<cmState::Snapshot>::const_iterator ci = children.begin();
+ std::vector<cmStateSnapshot> children = lg->GetStateSnapshot().GetChildren();
+ for (std::vector<cmStateSnapshot>::const_iterator ci = children.begin();
ci != children.end(); ++ci) {
std::string subdir = ci->GetDirectory().GetCurrentBinary();
subdir += "/";
@@ -508,7 +509,7 @@ void cmGlobalUnixMakefileGenerator3::GenerateBuildCommand(
if (!this->Makefiles.empty()) {
mf = this->Makefiles[0];
} else {
- cmState::Snapshot snapshot = this->CMakeInstance->GetCurrentSnapshot();
+ cmStateSnapshot snapshot = this->CMakeInstance->GetCurrentSnapshot();
snapshot.GetDirectory().SetCurrentSource(
this->CMakeInstance->GetHomeDirectory());
snapshot.GetDirectory().SetCurrentBinary(
@@ -557,11 +558,12 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules(
if (!name.empty() && emitted.insert(name).second &&
// Handle user targets here. Global targets are handled in
// the local generator on a per-directory basis.
- ((type == cmState::EXECUTABLE) ||
- (type == cmState::STATIC_LIBRARY) ||
- (type == cmState::SHARED_LIBRARY) ||
- (type == cmState::MODULE_LIBRARY) ||
- (type == cmState::OBJECT_LIBRARY) || (type == cmState::UTILITY))) {
+ ((type == cmStateEnums::EXECUTABLE) ||
+ (type == cmStateEnums::STATIC_LIBRARY) ||
+ (type == cmStateEnums::SHARED_LIBRARY) ||
+ (type == cmStateEnums::MODULE_LIBRARY) ||
+ (type == cmStateEnums::OBJECT_LIBRARY) ||
+ (type == cmStateEnums::UTILITY))) {
// Add a rule to build the target by name.
lg->WriteDivider(ruleFileStream);
ruleFileStream << "# Target rules for targets named " << name
@@ -633,11 +635,12 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2(
cmGeneratorTarget* gtarget = *t;
int type = gtarget->GetType();
std::string name = gtarget->GetName();
- if (!name.empty() &&
- ((type == cmState::EXECUTABLE) || (type == cmState::STATIC_LIBRARY) ||
- (type == cmState::SHARED_LIBRARY) ||
- (type == cmState::MODULE_LIBRARY) ||
- (type == cmState::OBJECT_LIBRARY) || (type == cmState::UTILITY))) {
+ if (!name.empty() && ((type == cmStateEnums::EXECUTABLE) ||
+ (type == cmStateEnums::STATIC_LIBRARY) ||
+ (type == cmStateEnums::SHARED_LIBRARY) ||
+ (type == cmStateEnums::MODULE_LIBRARY) ||
+ (type == cmStateEnums::OBJECT_LIBRARY) ||
+ (type == cmStateEnums::UTILITY))) {
std::string makefileName;
// Add a rule to build the target by name.
localName = lg->GetRelativeTargetDirectory(gtarget);
@@ -811,13 +814,13 @@ void cmGlobalUnixMakefileGenerator3::InitializeProgressMarks()
cmLocalGenerator* tlg = gt->GetLocalGenerator();
- if (gt->GetType() == cmState::INTERFACE_LIBRARY ||
+ if (gt->GetType() == cmStateEnums::INTERFACE_LIBRARY ||
gt->GetPropertyAsBool("EXCLUDE_FROM_ALL")) {
continue;
}
- cmState::Snapshot csnp = lg->GetStateSnapshot();
- cmState::Snapshot tsnp = tlg->GetStateSnapshot();
+ cmStateSnapshot csnp = lg->GetStateSnapshot();
+ cmStateSnapshot tsnp = tlg->GetStateSnapshot();
// Consider the directory containing the target and all its
// parents until something excludes the target.
@@ -850,7 +853,7 @@ size_t cmGlobalUnixMakefileGenerator3::CountProgressMarksInTarget(
TargetDependSet const& depends = this->GetTargetDirectDepends(target);
for (TargetDependSet::const_iterator di = depends.begin();
di != depends.end(); ++di) {
- if ((*di)->GetType() == cmState::INTERFACE_LIBRARY) {
+ if ((*di)->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
continue;
}
count += this->CountProgressMarksInTarget(*di, emitted);
@@ -911,7 +914,7 @@ void cmGlobalUnixMakefileGenerator3::AppendGlobalTargetDepends(
i != depends_set.end(); ++i) {
// Create the target-level dependency.
cmGeneratorTarget const* dep = *i;
- if (dep->GetType() == cmState::INTERFACE_LIBRARY) {
+ if (dep->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
continue;
}
cmLocalUnixMakefileGenerator3* lg3 =
@@ -953,14 +956,15 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule(
for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
t != targets.end(); ++t) {
cmGeneratorTarget* target = *t;
- cmState::TargetType type = target->GetType();
- if ((type == cmState::EXECUTABLE) ||
- (type == cmState::STATIC_LIBRARY) ||
- (type == cmState::SHARED_LIBRARY) ||
- (type == cmState::MODULE_LIBRARY) ||
- (type == cmState::OBJECT_LIBRARY) ||
- (type == cmState::GLOBAL_TARGET) || (type == cmState::UTILITY)) {
- std::string name = target->GetName();
+ cmStateEnums::TargetType type = target->GetType();
+ if ((type == cmStateEnums::EXECUTABLE) ||
+ (type == cmStateEnums::STATIC_LIBRARY) ||
+ (type == cmStateEnums::SHARED_LIBRARY) ||
+ (type == cmStateEnums::MODULE_LIBRARY) ||
+ (type == cmStateEnums::OBJECT_LIBRARY) ||
+ (type == cmStateEnums::GLOBAL_TARGET) ||
+ (type == cmStateEnums::UTILITY)) {
+ std::string const& name = target->GetName();
if (emittedTargets.insert(name).second) {
path = "... ";
path += name;