diff options
Diffstat (limited to 'Source/cmExtraCodeBlocksGenerator.cxx')
-rw-r--r-- | Source/cmExtraCodeBlocksGenerator.cxx | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 32b0ca93b..87b8f9bd3 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -16,6 +16,7 @@ #include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" +#include "cmProperty.h" #include "cmRange.h" #include "cmSourceFile.h" #include "cmStateTypes.h" @@ -95,7 +96,7 @@ struct Tree std::string path; // only one component of the path std::vector<Tree> folders; std::set<std::string> files; - void InsertPath(const std::vector<std::string>& splitted, + void InsertPath(const std::vector<std::string>& split, std::vector<std::string>::size_type start, const std::string& fileName); void BuildVirtualFolder(cmXMLWriter& xml) const; @@ -106,34 +107,34 @@ struct Tree const std::string& fsPath) const; }; -void Tree::InsertPath(const std::vector<std::string>& splitted, +void Tree::InsertPath(const std::vector<std::string>& split, std::vector<std::string>::size_type start, const std::string& fileName) { - if (start == splitted.size()) { + if (start == split.size()) { files.insert(fileName); return; } for (Tree& folder : folders) { - if (folder.path == splitted[start]) { - if (start + 1 < splitted.size()) { - folder.InsertPath(splitted, start + 1, fileName); + if (folder.path == split[start]) { + if (start + 1 < split.size()) { + folder.InsertPath(split, start + 1, fileName); return; } - // last part of splitted + // last part of split folder.files.insert(fileName); return; } } // Not found in folders, thus insert Tree newFolder; - newFolder.path = splitted[start]; - if (start + 1 < splitted.size()) { - newFolder.InsertPath(splitted, start + 1, fileName); + newFolder.path = split[start]; + if (start + 1 < split.size()) { + newFolder.InsertPath(split, start + 1, fileName); folders.push_back(newFolder); return; } - // last part of splitted + // last part of split newFolder.files.insert(fileName); folders.push_back(newFolder); } @@ -224,11 +225,11 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( const std::string& relative = cmSystemTools::RelativePath( it.second[0]->GetSourceDirectory(), listFile); - std::vector<std::string> splitted; - cmSystemTools::SplitPath(relative, splitted, false); + std::vector<std::string> split; + cmSystemTools::SplitPath(relative, split, false); // Split filename from path - std::string fileName = *(splitted.end() - 1); - splitted.erase(splitted.end() - 1, splitted.end()); + std::string fileName = *(split.end() - 1); + split.erase(split.end() - 1, split.end()); // We don't want paths with CMakeFiles in them // or do we? @@ -236,13 +237,12 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( // // Also we can disable external (outside the project) files by setting ON // CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES variable. - const bool excludeExternal = - cmIsOn(it.second[0]->GetMakefile()->GetSafeDefinition( - "CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES")); - if (!splitted.empty() && + const bool excludeExternal = it.second[0]->GetMakefile()->IsOn( + "CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES"); + if (!split.empty() && (!excludeExternal || (relative.find("..") == std::string::npos)) && relative.find("CMakeFiles") == std::string::npos) { - tree.InsertPath(splitted, 1, fileName); + tree.InsertPath(split, 1, fileName); } } } @@ -370,7 +370,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( std::string lang = s->GetOrDetermineLanguage(); if (lang == "C" || lang == "CXX" || lang == "CUDA") { std::string const& srcext = s->GetExtension(); - isCFile = cm->IsSourceExtension(srcext); + isCFile = cm->IsACLikeSourceExtension(srcext); } std::string const& fullPath = s->ResolveFullPath(); @@ -380,9 +380,8 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( cmSystemTools::RelativePath(lg->GetSourceDirectory(), fullPath); // Do not add this file if it has ".." in relative path and // if CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES variable is on. - const bool excludeExternal = - cmIsOn(lg->GetMakefile()->GetSafeDefinition( - "CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES")); + const bool excludeExternal = lg->GetMakefile()->IsOn( + "CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES"); if (excludeExternal && (relative.find("..") != std::string::npos)) { continue; @@ -498,15 +497,15 @@ void cmExtraCodeBlocksGenerator::AppendTarget( if (target->GetType() == cmStateEnums::EXECUTABLE) { // Determine the directory where the executable target is created, and // set the working directory to this dir. - const char* runtimeOutputDir = + cmProp runtimeOutputDir = makefile->GetDefinition("CMAKE_RUNTIME_OUTPUT_DIRECTORY"); - if (runtimeOutputDir != nullptr) { - workingDir = runtimeOutputDir; + if (runtimeOutputDir) { + workingDir = *runtimeOutputDir; } else { - const char* executableOutputDir = + cmProp executableOutputDir = makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH"); - if (executableOutputDir != nullptr) { - workingDir = executableOutputDir; + if (executableOutputDir) { + workingDir = *executableOutputDir; } } } @@ -691,7 +690,8 @@ int cmExtraCodeBlocksGenerator::GetCBTargetType(cmGeneratorTarget* target) { switch (target->GetType()) { case cmStateEnums::EXECUTABLE: - if ((target->GetPropertyAsBool("WIN32_EXECUTABLE")) || + if ((target->IsWin32Executable( + target->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"))) || (target->GetPropertyAsBool("MACOSX_BUNDLE"))) { return 0; } |