diff options
103 files changed, 815 insertions, 928 deletions
diff --git a/Help/command/add_executable.rst b/Help/command/add_executable.rst index 19ca658..c088796 100644 --- a/Help/command/add_executable.rst +++ b/Help/command/add_executable.rst @@ -40,6 +40,9 @@ the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for available expressions. See the :manual:`cmake-buildsystem(7)` manual for more on defining buildsystem properties. +See also :prop_sf:`HEADER_FILE_ONLY` on what to do if some sources are +pre-processed, and you want to have the original sources reachable from +within IDE. -------------------------------------------------------------------------- diff --git a/Help/command/add_library.rst b/Help/command/add_library.rst index 3a76040..02788e3 100644 --- a/Help/command/add_library.rst +++ b/Help/command/add_library.rst @@ -59,6 +59,10 @@ the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for available expressions. See the :manual:`cmake-buildsystem(7)` manual for more on defining buildsystem properties. +See also :prop_sf:`HEADER_FILE_ONLY` on what to do if some sources are +pre-processed, and you want to have the original sources reachable from +within IDE. + Imported Libraries ^^^^^^^^^^^^^^^^^^ diff --git a/Help/prop_sf/HEADER_FILE_ONLY.rst b/Help/prop_sf/HEADER_FILE_ONLY.rst index b4fb2db..71d62ae 100644 --- a/Help/prop_sf/HEADER_FILE_ONLY.rst +++ b/Help/prop_sf/HEADER_FILE_ONLY.rst @@ -7,3 +7,18 @@ A property on a source file that indicates if the source file is a header file with no associated implementation. This is set automatically based on the file extension and is used by CMake to determine if certain dependency information should be computed. + +By setting this property to ``ON``, you can disable compilation of +the given source file, even if it should be compiled because it is +part of the library's/executable's sources. + +This is useful if you have some source files which you somehow +pre-process, and then add these pre-processed sources via +:command:`add_library` or :command:`add_executable`. Normally, in IDE, +there would be no reference of the original sources, only of these +pre-processed sources. So by setting this property for all the original +source files to ``ON``, and then either calling :command:`add_library` +or :command:`add_executable` while passing both the pre-processed +sources and the original sources, or by using :command:`target_sources` +to add original source files will do exactly what would one expect, i.e. +the original source files would be visible in IDE, and will not be built. diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index e7d9d5f..1093be0 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -76,10 +76,10 @@ cmake_policy(SET CMP0057 NEW) # if IN_LIST function(_OPENMP_FLAG_CANDIDATES LANG) if(NOT OpenMP_${LANG}_FLAG) - set(OpenMP_FLAG_CANDIDATES "") + unset(OpenMP_FLAG_CANDIDATES) set(OMP_FLAG_GNU "-fopenmp") - set(OMP_FLAG_Clang "-fopenmp=libomp" "-fopenmp=libiomp5") + set(OMP_FLAG_Clang "-fopenmp=libomp" "-fopenmp=libiomp5" "-fopenmp") set(OMP_FLAG_HP "+Oopenmp") if(WIN32) set(OMP_FLAG_Intel "-Qopenmp") @@ -92,16 +92,21 @@ function(_OPENMP_FLAG_CANDIDATES LANG) set(OMP_FLAG_MIPSpro "-mp") set(OMP_FLAG_MSVC "-openmp") set(OMP_FLAG_PathScale "-openmp") + set(OMP_FLAG_NAG "-openmp") + set(OMP_FLAG_Absoft "-openmp") set(OMP_FLAG_PGI "-mp") set(OMP_FLAG_SunPro "-xopenmp") set(OMP_FLAG_XL "-qsmp=omp") # Cray compiles with OpenMP automatically + set(OMP_FLAG_Cray " ") + # If we know the correct flags, use those if(DEFINED OMP_FLAG_${CMAKE_${LANG}_COMPILER_ID}) - list(APPEND OpenMP_FLAG_CANDIDATES "${OMP_FLAG_${CMAKE_${LANG}_COMPILER_ID}}") + set(OpenMP_FLAG_CANDIDATES "${OMP_FLAG_${CMAKE_${LANG}_COMPILER_ID}}") + # Fall back to reasonable default tries otherwise + else() + set(OpenMP_FLAG_CANDIDATES "-openmp" "-fopenmp" "-mp" " ") endif() - - list(APPEND OpenMP_FLAG_CANDIDATES " ") set(OpenMP_${LANG}_FLAG_CANDIDATES "${OpenMP_FLAG_CANDIDATES}" PARENT_SCOPE) else() set(OpenMP_${LANG}_FLAG_CANDIDATES "${OpenMP_${LANG}_FLAG}" PARENT_SCOPE) @@ -152,7 +157,7 @@ endfunction() include(${CMAKE_ROOT}/Modules/CMakeParseImplicitLinkInfo.cmake) -function(_OPENMP_GET_FLAGS LANG OPENMP_FLAG_VAR OPENMP_LIB_NAMES_VAR) +function(_OPENMP_GET_FLAGS LANG FLAG_MODE OPENMP_FLAG_VAR OPENMP_LIB_NAMES_VAR) _OPENMP_FLAG_CANDIDATES("${LANG}") _OPENMP_WRITE_SOURCE_FILE("${LANG}" "TEST_SOURCE" OpenMPTryFlag _OPENMP_TEST_SRC) @@ -161,13 +166,13 @@ function(_OPENMP_GET_FLAGS LANG OPENMP_FLAG_VAR OPENMP_LIB_NAMES_VAR) if(CMAKE_${LANG}_VERBOSE_FLAG) string(APPEND OPENMP_FLAGS_TEST " ${CMAKE_${LANG}_VERBOSE_FLAG}") endif() - try_compile( OpenMP_TRY_COMPILE_RESULT ${CMAKE_BINARY_DIR} ${_OPENMP_TEST_SRC} + string(REGEX REPLACE "[-/=+]" "" OPENMP_PLAIN_FLAG "${OPENMP_FLAG}") + try_compile( OpenMP_COMPILE_RESULT_${FLAG_MODE}_${OPENMP_PLAIN_FLAG} ${CMAKE_BINARY_DIR} ${_OPENMP_TEST_SRC} CMAKE_FLAGS "-DCOMPILE_DEFINITIONS:STRING=${OPENMP_FLAGS_TEST}" OUTPUT_VARIABLE OpenMP_TRY_COMPILE_OUTPUT ) - if(OpenMP_TRY_COMPILE_RESULT) - unset(OpenMP_TRY_COMPILE_RESULT CACHE) + if(OpenMP_COMPILE_RESULT_${FLAG_MODE}_${OPENMP_PLAIN_FLAG}) set("${OPENMP_FLAG_VAR}" "${OPENMP_FLAG}" PARENT_SCOPE) if(CMAKE_${LANG}_VERBOSE_FLAG) @@ -219,7 +224,6 @@ function(_OPENMP_GET_FLAGS LANG OPENMP_FLAG_VAR OPENMP_LIB_NAMES_VAR) endif() set("${OPENMP_LIB_NAMES_VAR}" "NOTFOUND" PARENT_SCOPE) set("${OPENMP_FLAG_VAR}" "NOTFOUND" PARENT_SCOPE) - unset(OpenMP_TRY_COMPILE_RESULT CACHE) endforeach() endfunction() @@ -265,19 +269,18 @@ function(_OPENMP_GET_SPEC_DATE LANG SPEC_DATE) _OPENMP_WRITE_SOURCE_FILE("${LANG}" "CHECK_VERSION_SOURCE" OpenMPCheckVersion _OPENMP_TEST_SRC) set(BIN_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindOpenMP/ompver_${LANG}.bin") - try_compile(OpenMP_TRY_COMPILE_RESULT "${CMAKE_BINARY_DIR}" "${_OPENMP_TEST_SRC}" + string(REGEX REPLACE "[-/=+]" "" OPENMP_PLAIN_FLAG "${OPENMP_FLAG}") + try_compile(OpenMP_SPECTEST_${LANG}_${OPENMP_PLAIN_FLAG} "${CMAKE_BINARY_DIR}" "${_OPENMP_TEST_SRC}" CMAKE_FLAGS "-DCOMPILE_DEFINITIONS:STRING=${OpenMP_${LANG}_FLAGS}" COPY_FILE ${BIN_FILE}) - if(${OpenMP_TRY_COMPILE_RESULT}) + if(${OpenMP_SPECTEST_${LANG}_${OPENMP_PLAIN_FLAG}}) file(STRINGS ${BIN_FILE} specstr LIMIT_COUNT 1 REGEX "INFO:OpenMP-date") set(regex_spec_date ".*INFO:OpenMP-date\\[0*([^]]*)\\].*") if("${specstr}" MATCHES "${regex_spec_date}") set(${SPEC_DATE} "${CMAKE_MATCH_1}" PARENT_SCOPE) endif() endif() - - unset(OpenMP_TRY_COMPILE_RESULT CACHE) endfunction() macro(_OPENMP_SET_VERSION_BY_SPEC_DATE LANG) @@ -318,7 +321,7 @@ foreach(LANG IN ITEMS C CXX) if(CMAKE_${LANG}_COMPILER_LOADED) if(NOT DEFINED OpenMP_${LANG}_FLAGS OR "${OpenMP_${LANG}_FLAGS}" STREQUAL "NOTFOUND" OR NOT DEFINED OpenMP_${LANG}_LIB_NAMES OR "${OpenMP_${LANG}_LIB_NAMES}" STREQUAL "NOTFOUND") - _OPENMP_GET_FLAGS("${LANG}" OpenMP_${LANG}_FLAGS_WORK OpenMP_${LANG}_LIB_NAMES_WORK) + _OPENMP_GET_FLAGS("${LANG}" "${LANG}" OpenMP_${LANG}_FLAGS_WORK OpenMP_${LANG}_LIB_NAMES_WORK) endif() set(OpenMP_${LANG}_FLAGS "${OpenMP_${LANG}_FLAGS_WORK}" @@ -334,7 +337,7 @@ if(CMAKE_Fortran_COMPILER_LOADED) OR NOT DEFINED OpenMP_Fortran_LIB_NAMES OR "${OpenMP_Fortran_LIB_NAMES}" STREQUAL "NOTFOUND" OR NOT DEFINED OpenMP_Fortran_HAVE_OMPLIB_MODULE) set(OpenMP_Fortran_INCLUDE_LINE "use omp_lib\n implicit none") - _OPENMP_GET_FLAGS("Fortran" OpenMP_Fortran_FLAGS_WORK OpenMP_Fortran_LIB_NAMES_WORK) + _OPENMP_GET_FLAGS("Fortran" "FortranHeader" OpenMP_Fortran_FLAGS_WORK OpenMP_Fortran_LIB_NAMES_WORK) if(OpenMP_Fortran_FLAGS_WORK) set(OpenMP_Fortran_HAVE_OMPLIB_MODULE TRUE CACHE BOOL INTERNAL "") endif() @@ -350,7 +353,7 @@ if(CMAKE_Fortran_COMPILER_LOADED) OR NOT DEFINED OpenMP_Fortran_LIB_NAMES OR "${OpenMP_Fortran_LIB_NAMES}" STREQUAL "NOTFOUND" OR NOT DEFINED OpenMP_Fortran_HAVE_OMPLIB_HEADER) set(OpenMP_Fortran_INCLUDE_LINE "implicit none\n include 'omp_lib.h'") - _OPENMP_GET_FLAGS("Fortran" OpenMP_Fortran_FLAGS_WORK OpenMP_Fortran_LIB_NAMES_WORK) + _OPENMP_GET_FLAGS("Fortran" "FortranModule" OpenMP_Fortran_FLAGS_WORK OpenMP_Fortran_LIB_NAMES_WORK) if(OpenMP_Fortran_FLAGS_WORK) set(OpenMP_Fortran_HAVE_OMPLIB_HEADER TRUE CACHE BOOL INTERNAL "") endif() diff --git a/Modules/Internal/FeatureTesting.cmake b/Modules/Internal/FeatureTesting.cmake index 50b8526..de336e7 100644 --- a/Modules/Internal/FeatureTesting.cmake +++ b/Modules/Internal/FeatureTesting.cmake @@ -22,9 +22,18 @@ macro(_record_compiler_features lang compile_flags feature_list) file(APPEND "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.${lang_lc}" "\n};\n\nint main(int argc, char** argv) { (void)argv; return features[argc]; }\n") + if(CMAKE_${lang}_LINK_WITH_STANDARD_COMPILE_OPTION) + # This toolchain requires use of the language standard flag + # when linking in order to use the matching standard library. + set(compile_flags_for_link "${compile_flags}") + else() + set(compile_flags_for_link "") + endif() + try_compile(CMAKE_${lang}_FEATURE_TEST ${CMAKE_BINARY_DIR} "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.${lang_lc}" COMPILE_DEFINITIONS "${compile_flags}" + LINK_LIBRARIES "${compile_flags_for_link}" OUTPUT_VARIABLE _output COPY_FILE "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.bin" COPY_FILE_ERROR _copy_error @@ -35,6 +44,7 @@ macro(_record_compiler_features lang compile_flags feature_list) set(_result 255) endif() unset(CMAKE_${lang}_FEATURE_TEST CACHE) + unset(compile_flags_for_link) if (_result EQUAL 0) file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index e702359..6c443d6 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 8) -set(CMake_VERSION_PATCH 20170509) +set(CMake_VERSION_PATCH 20170511) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/IFW/cmCPackIFWCommon.cxx b/Source/CPack/IFW/cmCPackIFWCommon.cxx index 60954ea..436f4d3 100644 --- a/Source/CPack/IFW/cmCPackIFWCommon.cxx +++ b/Source/CPack/IFW/cmCPackIFWCommon.cxx @@ -19,67 +19,72 @@ cmCPackIFWCommon::cmCPackIFWCommon() const char* cmCPackIFWCommon::GetOption(const std::string& op) const { - return Generator ? Generator->cmCPackGenerator::GetOption(op) : CM_NULLPTR; + return this->Generator ? this->Generator->cmCPackGenerator::GetOption(op) + : CM_NULLPTR; } bool cmCPackIFWCommon::IsOn(const std::string& op) const { - return Generator ? Generator->cmCPackGenerator::IsOn(op) : false; + return this->Generator ? this->Generator->cmCPackGenerator::IsOn(op) : false; } bool cmCPackIFWCommon::IsSetToOff(const std::string& op) const { - return Generator ? Generator->cmCPackGenerator::IsSetToOff(op) : false; + return this->Generator ? this->Generator->cmCPackGenerator::IsSetToOff(op) + : false; } bool cmCPackIFWCommon::IsSetToEmpty(const std::string& op) const { - return Generator ? Generator->cmCPackGenerator::IsSetToEmpty(op) : false; + return this->Generator ? this->Generator->cmCPackGenerator::IsSetToEmpty(op) + : false; } bool cmCPackIFWCommon::IsVersionLess(const char* version) { - if (!Generator) { + if (!this->Generator) { return false; } return cmSystemTools::VersionCompare( - cmSystemTools::OP_LESS, Generator->FrameworkVersion.data(), version); + cmSystemTools::OP_LESS, this->Generator->FrameworkVersion.data(), version); } bool cmCPackIFWCommon::IsVersionGreater(const char* version) { - if (!Generator) { + if (!this->Generator) { return false; } return cmSystemTools::VersionCompare( - cmSystemTools::OP_GREATER, Generator->FrameworkVersion.data(), version); + cmSystemTools::OP_GREATER, this->Generator->FrameworkVersion.data(), + version); } bool cmCPackIFWCommon::IsVersionEqual(const char* version) { - if (!Generator) { + if (!this->Generator) { return false; } return cmSystemTools::VersionCompare( - cmSystemTools::OP_EQUAL, Generator->FrameworkVersion.data(), version); + cmSystemTools::OP_EQUAL, this->Generator->FrameworkVersion.data(), + version); } void cmCPackIFWCommon::WriteGeneratedByToStrim(cmXMLWriter& xout) { - if (!Generator) { + if (!this->Generator) { return; } std::ostringstream comment; comment << "Generated by CPack " << CMake_VERSION << " IFW generator " << "for QtIFW "; - if (IsVersionEqual("1.9.9")) { + if (this->IsVersionEqual("1.9.9")) { comment << "less 2.0"; } else { - comment << Generator->FrameworkVersion; + comment << this->Generator->FrameworkVersion; } comment << " tools at " << cmTimestamp().CurrentTime("", true); xout.Comment(comment.str().c_str()); diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx index a9628d6..226ea0a 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx +++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx @@ -17,7 +17,7 @@ cmCPackIFWGenerator::cmCPackIFWGenerator() { - Generator = this; + this->Generator = this; } cmCPackIFWGenerator::~cmCPackIFWGenerator() @@ -29,38 +29,40 @@ int cmCPackIFWGenerator::PackageFiles() cmCPackIFWLogger(OUTPUT, "- Configuration" << std::endl); // Installer configuragion - Installer.GenerateInstallerFile(); + this->Installer.GenerateInstallerFile(); // Packages configuration - Installer.GeneratePackageFiles(); + this->Installer.GeneratePackageFiles(); std::string ifwTLD = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); std::string ifwTmpFile = ifwTLD; ifwTmpFile += "/IFWOutput.log"; // Run repogen - if (!Installer.RemoteRepositories.empty()) { - std::string ifwCmd = RepoGen; + if (!this->Installer.RemoteRepositories.empty()) { + std::string ifwCmd = this->RepoGen; - if (IsVersionLess("2.0.0")) { + if (this->IsVersionLess("2.0.0")) { ifwCmd += " -c " + this->toplevel + "/config/config.xml"; } ifwCmd += " -p " + this->toplevel + "/packages"; - if (!PkgsDirsVector.empty()) { - for (std::vector<std::string>::iterator it = PkgsDirsVector.begin(); - it != PkgsDirsVector.end(); ++it) { + if (!this->PkgsDirsVector.empty()) { + for (std::vector<std::string>::iterator it = + this->PkgsDirsVector.begin(); + it != this->PkgsDirsVector.end(); ++it) { ifwCmd += " -p " + *it; } } - if (!OnlineOnly && !DownloadedPackages.empty()) { + if (!this->OnlineOnly && !this->DownloadedPackages.empty()) { ifwCmd += " -i "; - std::set<cmCPackIFWPackage*>::iterator it = DownloadedPackages.begin(); + std::set<cmCPackIFWPackage*>::iterator it = + this->DownloadedPackages.begin(); ifwCmd += (*it)->Name; ++it; - while (it != DownloadedPackages.end()) { + while (it != this->DownloadedPackages.end()) { ifwCmd += "," + (*it)->Name; ++it; } @@ -85,8 +87,8 @@ int cmCPackIFWGenerator::PackageFiles() return 0; } - if (!Repository.RepositoryUpdate.empty() && - !Repository.PatchUpdatesXml()) { + if (!this->Repository.RepositoryUpdate.empty() && + !this->Repository.PatchUpdatesXml()) { cmCPackIFWLogger(WARNING, "Problem patch IFW \"Updates\" " << "file: " << this->toplevel + "/repository/Updates.xml" @@ -100,16 +102,17 @@ int cmCPackIFWGenerator::PackageFiles() // Run binary creator { - std::string ifwCmd = BinCreator; + std::string ifwCmd = this->BinCreator; ifwCmd += " -c " + this->toplevel + "/config/config.xml"; - if (!Installer.Resources.empty()) { + if (!this->Installer.Resources.empty()) { ifwCmd += " -r "; - std::vector<std::string>::iterator it = Installer.Resources.begin(); + std::vector<std::string>::iterator it = + this->Installer.Resources.begin(); std::string path = this->toplevel + "/resources/"; ifwCmd += path + *it; ++it; - while (it != Installer.Resources.end()) { + while (it != this->Installer.Resources.end()) { ifwCmd += "," + path + *it; ++it; } @@ -117,45 +120,48 @@ int cmCPackIFWGenerator::PackageFiles() ifwCmd += " -p " + this->toplevel + "/packages"; - if (!PkgsDirsVector.empty()) { - for (std::vector<std::string>::iterator it = PkgsDirsVector.begin(); - it != PkgsDirsVector.end(); ++it) { + if (!this->PkgsDirsVector.empty()) { + for (std::vector<std::string>::iterator it = + this->PkgsDirsVector.begin(); + it != this->PkgsDirsVector.end(); ++it) { ifwCmd += " -p " + *it; } } - if (OnlineOnly) { + if (this->OnlineOnly) { ifwCmd += " --online-only"; - } else if (!DownloadedPackages.empty() && - !Installer.RemoteRepositories.empty()) { + } else if (!this->DownloadedPackages.empty() && + !this->Installer.RemoteRepositories.empty()) { ifwCmd += " -e "; - std::set<cmCPackIFWPackage*>::iterator it = DownloadedPackages.begin(); + std::set<cmCPackIFWPackage*>::iterator it = + this->DownloadedPackages.begin(); ifwCmd += (*it)->Name; ++it; - while (it != DownloadedPackages.end()) { + while (it != this->DownloadedPackages.end()) { ifwCmd += "," + (*it)->Name; ++it; } - } else if (!DependentPackages.empty()) { + } else if (!this->DependentPackages.empty()) { ifwCmd += " -i "; // Binary - std::set<cmCPackIFWPackage*>::iterator bit = BinaryPackages.begin(); - while (bit != BinaryPackages.end()) { + std::set<cmCPackIFWPackage*>::iterator bit = + this->BinaryPackages.begin(); + while (bit != this->BinaryPackages.end()) { ifwCmd += (*bit)->Name + ","; ++bit; } // Depend - DependenceMap::iterator it = DependentPackages.begin(); + DependenceMap::iterator it = this->DependentPackages.begin(); ifwCmd += it->second.Name; ++it; - while (it != DependentPackages.end()) { + while (it != this->DependentPackages.end()) { ifwCmd += "," + it->second.Name; ++it; } } // TODO: set correct name for multipackages if (!this->packageFileNames.empty()) { - ifwCmd += " " + packageFileNames[0]; + ifwCmd += " " + this->packageFileNames[0]; } else { ifwCmd += " installer"; } @@ -184,12 +190,12 @@ int cmCPackIFWGenerator::PackageFiles() const char* cmCPackIFWGenerator::GetPackagingInstallPrefix() { - const char* defPrefix = cmCPackGenerator::GetPackagingInstallPrefix(); + const char* defPrefix = this->cmCPackGenerator::GetPackagingInstallPrefix(); std::string tmpPref = defPrefix ? defPrefix : ""; if (this->Components.empty()) { - tmpPref += "packages/" + GetRootPackageName() + "/data"; + tmpPref += "packages/" + this->GetRootPackageName() + "/data"; } this->SetOption("CPACK_IFW_PACKAGING_INSTALL_PREFIX", tmpPref.c_str()); @@ -199,7 +205,7 @@ const char* cmCPackIFWGenerator::GetPackagingInstallPrefix() const char* cmCPackIFWGenerator::GetOutputExtension() { - return ExecutableSuffix.c_str(); + return this->ExecutableSuffix.c_str(); } int cmCPackIFWGenerator::InitializeInternal() @@ -219,12 +225,12 @@ int cmCPackIFWGenerator::InitializeInternal() const char* BinCreatorStr = this->GetOption(BinCreatorOpt); if (!BinCreatorStr || cmSystemTools::IsNOTFOUND(BinCreatorStr)) { - BinCreator = ""; + this->BinCreator = ""; } else { - BinCreator = BinCreatorStr; + this->BinCreator = BinCreatorStr; } - if (BinCreator.empty()) { + if (this->BinCreator.empty()) { cmCPackIFWLogger(ERROR, "Cannot find QtIFW compiler \"binarycreator\": " "likely it is not installed, or not in your PATH" << std::endl); @@ -235,39 +241,40 @@ int cmCPackIFWGenerator::InitializeInternal() const char* RepoGenStr = this->GetOption(RepoGenOpt); if (!RepoGenStr || cmSystemTools::IsNOTFOUND(RepoGenStr)) { - RepoGen = ""; + this->RepoGen = ""; } else { - RepoGen = RepoGenStr; + this->RepoGen = RepoGenStr; } // Framework version if (const char* FrameworkVersionSrt = this->GetOption(FrameworkVersionOpt)) { - FrameworkVersion = FrameworkVersionSrt; + this->FrameworkVersion = FrameworkVersionSrt; } else { - FrameworkVersion = "1.9.9"; + this->FrameworkVersion = "1.9.9"; } // Variables that Change Behavior // Resolve duplicate names - ResolveDuplicateNames = this->IsOn("CPACK_IFW_RESOLVE_DUPLICATE_NAMES"); + this->ResolveDuplicateNames = + this->IsOn("CPACK_IFW_RESOLVE_DUPLICATE_NAMES"); // Additional packages dirs - PkgsDirsVector.clear(); + this->PkgsDirsVector.clear(); if (const char* dirs = this->GetOption("CPACK_IFW_PACKAGES_DIRECTORIES")) { - cmSystemTools::ExpandListArgument(dirs, PkgsDirsVector); + cmSystemTools::ExpandListArgument(dirs, this->PkgsDirsVector); } // Installer - Installer.Generator = this; - Installer.ConfigureFromOptions(); + this->Installer.Generator = this; + this->Installer.ConfigureFromOptions(); // Repository - Repository.Generator = this; - Repository.Name = "Unspecified"; + this->Repository.Generator = this; + this->Repository.Name = "Unspecified"; if (const char* site = this->GetOption("CPACK_DOWNLOAD_SITE")) { - Repository.Url = site; - Installer.RemoteRepositories.push_back(&Repository); + this->Repository.Url = site; + this->Installer.RemoteRepositories.push_back(&this->Repository); } // Repositories @@ -276,20 +283,20 @@ int cmCPackIFWGenerator::InitializeInternal() cmSystemTools::ExpandListArgument(RepoAllStr, RepoAllVector); for (std::vector<std::string>::iterator rit = RepoAllVector.begin(); rit != RepoAllVector.end(); ++rit) { - GetRepository(*rit); + this->GetRepository(*rit); } } if (const char* ifwDownloadAll = this->GetOption("CPACK_IFW_DOWNLOAD_ALL")) { - OnlineOnly = cmSystemTools::IsOn(ifwDownloadAll); + this->OnlineOnly = cmSystemTools::IsOn(ifwDownloadAll); } else if (const char* cpackDownloadAll = this->GetOption("CPACK_DOWNLOAD_ALL")) { - OnlineOnly = cmSystemTools::IsOn(cpackDownloadAll); + this->OnlineOnly = cmSystemTools::IsOn(cpackDownloadAll); } else { - OnlineOnly = false; + this->OnlineOnly = false; } - if (!Installer.RemoteRepositories.empty() && RepoGen.empty()) { + if (!this->Installer.RemoteRepositories.empty() && this->RepoGen.empty()) { cmCPackIFWLogger(ERROR, "Cannot find QtIFW repository generator \"repogen\": " "likely it is not installed, or not in your PATH" @@ -299,15 +306,15 @@ int cmCPackIFWGenerator::InitializeInternal() // Executable suffix if (const char* optExeSuffix = this->GetOption("CMAKE_EXECUTABLE_SUFFIX")) { - ExecutableSuffix = optExeSuffix; - if (ExecutableSuffix.empty()) { + this->ExecutableSuffix = optExeSuffix; + if (this->ExecutableSuffix.empty()) { std::string sysName(this->GetOption("CMAKE_SYSTEM_NAME")); if (sysName == "Linux") { - ExecutableSuffix = ".run"; + this->ExecutableSuffix = ".run"; } } } else { - ExecutableSuffix = cmCPackGenerator::GetOutputExtension(); + this->ExecutableSuffix = this->cmCPackGenerator::GetOutputExtension(); } return this->Superclass::InitializeInternal(); @@ -319,49 +326,50 @@ std::string cmCPackIFWGenerator::GetComponentInstallDirNameSuffix( const std::string prefix = "packages/"; const std::string suffix = "/data"; - if (componentPackageMethod == ONE_PACKAGE) { - return std::string(prefix + GetRootPackageName() + suffix); + if (this->componentPackageMethod == this->ONE_PACKAGE) { + return std::string(prefix + this->GetRootPackageName() + suffix); } - return prefix + GetComponentPackageName(&Components[componentName]) + suffix; + return prefix + + this->GetComponentPackageName(&this->Components[componentName]) + suffix; } cmCPackComponent* cmCPackIFWGenerator::GetComponent( const std::string& projectName, const std::string& componentName) { - ComponentsMap::iterator cit = Components.find(componentName); - if (cit != Components.end()) { + ComponentsMap::iterator cit = this->Components.find(componentName); + if (cit != this->Components.end()) { return &(cit->second); } cmCPackComponent* component = - cmCPackGenerator::GetComponent(projectName, componentName); + this->cmCPackGenerator::GetComponent(projectName, componentName); if (!component) { return component; } - std::string name = GetComponentPackageName(component); - PackagesMap::iterator pit = Packages.find(name); - if (pit != Packages.end()) { + std::string name = this->GetComponentPackageName(component); + PackagesMap::iterator pit = this->Packages.find(name); + if (pit != this->Packages.end()) { return component; } - cmCPackIFWPackage* package = &Packages[name]; + cmCPackIFWPackage* package = &this->Packages[name]; package->Name = name; package->Generator = this; if (package->ConfigureFromComponent(component)) { - package->Installer = &Installer; - Installer.Packages.insert( + package->Installer = &this->Installer; + this->Installer.Packages.insert( std::pair<std::string, cmCPackIFWPackage*>(name, package)); - ComponentPackages.insert( + this->ComponentPackages.insert( std::pair<cmCPackComponent*, cmCPackIFWPackage*>(component, package)); if (component->IsDownloaded) { - DownloadedPackages.insert(package); + this->DownloadedPackages.insert(package); } else { - BinaryPackages.insert(package); + this->BinaryPackages.insert(package); } } else { - Packages.erase(name); + this->Packages.erase(name); cmCPackIFWLogger(ERROR, "Cannot configure package \"" << name << "\" for component \"" << component->Name << "\"" << std::endl); @@ -374,29 +382,29 @@ cmCPackComponentGroup* cmCPackIFWGenerator::GetComponentGroup( const std::string& projectName, const std::string& groupName) { cmCPackComponentGroup* group = - cmCPackGenerator::GetComponentGroup(projectName, groupName); + this->cmCPackGenerator::GetComponentGroup(projectName, groupName); if (!group) { return group; } - std::string name = GetGroupPackageName(group); - PackagesMap::iterator pit = Packages.find(name); - if (pit != Packages.end()) { + std::string name = this->GetGroupPackageName(group); + PackagesMap::iterator pit = this->Packages.find(name); + if (pit != this->Packages.end()) { return group; } - cmCPackIFWPackage* package = &Packages[name]; + cmCPackIFWPackage* package = &this->Packages[name]; package->Name = name; package->Generator = this; if (package->ConfigureFromGroup(group)) { - package->Installer = &Installer; - Installer.Packages.insert( + package->Installer = &this->Installer; + this->Installer.Packages.insert( std::pair<std::string, cmCPackIFWPackage*>(name, package)); - GroupPackages.insert( + this->GroupPackages.insert( std::pair<cmCPackComponentGroup*, cmCPackIFWPackage*>(group, package)); - BinaryPackages.insert(package); + this->BinaryPackages.insert(package); } else { - Packages.erase(name); + this->Packages.erase(name); cmCPackIFWLogger(ERROR, "Cannot configure package \"" << name << "\" for component group \"" << group->Name << "\"" << std::endl); @@ -422,7 +430,7 @@ bool cmCPackIFWGenerator::SupportsComponentInstallation() const bool cmCPackIFWGenerator::IsOnePackage() const { - return componentPackageMethod == ONE_PACKAGE; + return this->componentPackageMethod == cmCPackGenerator::ONE_PACKAGE; } std::string cmCPackIFWGenerator::GetRootPackageName() @@ -455,16 +463,16 @@ std::string cmCPackIFWGenerator::GetGroupPackageName( if (!group) { return name; } - if (cmCPackIFWPackage* package = GetGroupPackage(group)) { + if (cmCPackIFWPackage* package = this->GetGroupPackage(group)) { return package->Name; } const char* option = - GetOption("CPACK_IFW_COMPONENT_GROUP_" + - cmsys::SystemTools::UpperCase(group->Name) + "_NAME"); + this->GetOption("CPACK_IFW_COMPONENT_GROUP_" + + cmsys::SystemTools::UpperCase(group->Name) + "_NAME"); name = option ? option : group->Name; if (group->ParentGroup) { - cmCPackIFWPackage* package = GetGroupPackage(group->ParentGroup); - bool dot = !ResolveDuplicateNames; + cmCPackIFWPackage* package = this->GetGroupPackage(group->ParentGroup); + bool dot = !this->ResolveDuplicateNames; if (dot && name.substr(0, package->Name.size()) == package->Name) { dot = false; } @@ -482,20 +490,21 @@ std::string cmCPackIFWGenerator::GetComponentPackageName( if (!component) { return name; } - if (cmCPackIFWPackage* package = GetComponentPackage(component)) { + if (cmCPackIFWPackage* package = this->GetComponentPackage(component)) { return package->Name; } std::string prefix = "CPACK_IFW_COMPONENT_" + cmsys::SystemTools::UpperCase(component->Name) + "_"; - const char* option = GetOption(prefix + "NAME"); + const char* option = this->GetOption(prefix + "NAME"); name = option ? option : component->Name; if (component->Group) { - cmCPackIFWPackage* package = GetGroupPackage(component->Group); - if ((componentPackageMethod == ONE_PACKAGE_PER_GROUP) || - IsOn(prefix + "COMMON")) { + cmCPackIFWPackage* package = this->GetGroupPackage(component->Group); + if ((this->componentPackageMethod == + cmCPackGenerator::ONE_PACKAGE_PER_GROUP) || + this->IsOn(prefix + "COMMON")) { return package->Name; } - bool dot = !ResolveDuplicateNames; + bool dot = !this->ResolveDuplicateNames; if (dot && name.substr(0, package->Name.size()) == package->Name) { dot = false; } @@ -510,37 +519,37 @@ cmCPackIFWPackage* cmCPackIFWGenerator::GetGroupPackage( cmCPackComponentGroup* group) const { std::map<cmCPackComponentGroup*, cmCPackIFWPackage*>::const_iterator pit = - GroupPackages.find(group); - return pit != GroupPackages.end() ? pit->second : CM_NULLPTR; + this->GroupPackages.find(group); + return pit != this->GroupPackages.end() ? pit->second : CM_NULLPTR; } cmCPackIFWPackage* cmCPackIFWGenerator::GetComponentPackage( cmCPackComponent* component) const { std::map<cmCPackComponent*, cmCPackIFWPackage*>::const_iterator pit = - ComponentPackages.find(component); - return pit != ComponentPackages.end() ? pit->second : CM_NULLPTR; + this->ComponentPackages.find(component); + return pit != this->ComponentPackages.end() ? pit->second : CM_NULLPTR; } cmCPackIFWRepository* cmCPackIFWGenerator::GetRepository( const std::string& repositoryName) { - RepositoriesMap::iterator rit = Repositories.find(repositoryName); - if (rit != Repositories.end()) { + RepositoriesMap::iterator rit = this->Repositories.find(repositoryName); + if (rit != this->Repositories.end()) { return &(rit->second); } - cmCPackIFWRepository* repository = &Repositories[repositoryName]; + cmCPackIFWRepository* repository = &this->Repositories[repositoryName]; repository->Name = repositoryName; repository->Generator = this; if (repository->ConfigureFromOptions()) { if (repository->Update == cmCPackIFWRepository::None) { - Installer.RemoteRepositories.push_back(repository); + this->Installer.RemoteRepositories.push_back(repository); } else { - Repository.RepositoryUpdate.push_back(repository); + this->Repository.RepositoryUpdate.push_back(repository); } } else { - Repositories.erase(repositoryName); + this->Repositories.erase(repositoryName); repository = CM_NULLPTR; cmCPackIFWLogger(WARNING, "Invalid repository \"" << repositoryName << "\"" diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx index 317137f..288e924 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx +++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx @@ -35,107 +35,107 @@ void cmCPackIFWInstaller::ConfigureFromOptions() // Name; if (const char* optIFW_PACKAGE_NAME = this->GetOption("CPACK_IFW_PACKAGE_NAME")) { - Name = optIFW_PACKAGE_NAME; + this->Name = optIFW_PACKAGE_NAME; } else if (const char* optPACKAGE_NAME = this->GetOption("CPACK_PACKAGE_NAME")) { - Name = optPACKAGE_NAME; + this->Name = optPACKAGE_NAME; } else { - Name = "Your package"; + this->Name = "Your package"; } // Title; if (const char* optIFW_PACKAGE_TITLE = - GetOption("CPACK_IFW_PACKAGE_TITLE")) { - Title = optIFW_PACKAGE_TITLE; + this->GetOption("CPACK_IFW_PACKAGE_TITLE")) { + this->Title = optIFW_PACKAGE_TITLE; } else if (const char* optPACKAGE_DESCRIPTION_SUMMARY = - GetOption("CPACK_PACKAGE_DESCRIPTION_SUMMARY")) { - Title = optPACKAGE_DESCRIPTION_SUMMARY; + this->GetOption("CPACK_PACKAGE_DESCRIPTION_SUMMARY")) { + this->Title = optPACKAGE_DESCRIPTION_SUMMARY; } else { - Title = "Your package description"; + this->Title = "Your package description"; } // Version; - if (const char* option = GetOption("CPACK_PACKAGE_VERSION")) { - Version = option; + if (const char* option = this->GetOption("CPACK_PACKAGE_VERSION")) { + this->Version = option; } else { - Version = "1.0.0"; + this->Version = "1.0.0"; } // Publisher if (const char* optIFW_PACKAGE_PUBLISHER = - GetOption("CPACK_IFW_PACKAGE_PUBLISHER")) { - Publisher = optIFW_PACKAGE_PUBLISHER; + this->GetOption("CPACK_IFW_PACKAGE_PUBLISHER")) { + this->Publisher = optIFW_PACKAGE_PUBLISHER; } else if (const char* optPACKAGE_VENDOR = GetOption("CPACK_PACKAGE_VENDOR")) { - Publisher = optPACKAGE_VENDOR; + this->Publisher = optPACKAGE_VENDOR; } // ProductUrl - if (const char* option = GetOption("CPACK_IFW_PRODUCT_URL")) { - ProductUrl = option; + if (const char* option = this->GetOption("CPACK_IFW_PRODUCT_URL")) { + this->ProductUrl = option; } // ApplicationIcon - if (const char* option = GetOption("CPACK_IFW_PACKAGE_ICON")) { + if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_ICON")) { if (cmSystemTools::FileExists(option)) { - InstallerApplicationIcon = option; + this->InstallerApplicationIcon = option; } else { - printSkippedOptionWarning("CPACK_IFW_PACKAGE_ICON", option); + this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_ICON", option); } } // WindowIcon - if (const char* option = GetOption("CPACK_IFW_PACKAGE_WINDOW_ICON")) { + if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_WINDOW_ICON")) { if (cmSystemTools::FileExists(option)) { - InstallerWindowIcon = option; + this->InstallerWindowIcon = option; } else { - printSkippedOptionWarning("CPACK_IFW_PACKAGE_WINDOW_ICON", option); + this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_WINDOW_ICON", option); } } // Logo - if (const char* option = GetOption("CPACK_IFW_PACKAGE_LOGO")) { + if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_LOGO")) { if (cmSystemTools::FileExists(option)) { - Logo = option; + this->Logo = option; } else { - printSkippedOptionWarning("CPACK_IFW_PACKAGE_LOGO", option); + this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_LOGO", option); } } // Watermark - if (const char* option = GetOption("CPACK_IFW_PACKAGE_WATERMARK")) { + if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_WATERMARK")) { if (cmSystemTools::FileExists(option)) { - Watermark = option; + this->Watermark = option; } else { - printSkippedOptionWarning("CPACK_IFW_PACKAGE_WATERMARK", option); + this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_WATERMARK", option); } } // Banner - if (const char* option = GetOption("CPACK_IFW_PACKAGE_BANNER")) { + if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_BANNER")) { if (cmSystemTools::FileExists(option)) { - Banner = option; + this->Banner = option; } else { - printSkippedOptionWarning("CPACK_IFW_PACKAGE_BANNER", option); + this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_BANNER", option); } } // Background - if (const char* option = GetOption("CPACK_IFW_PACKAGE_BACKGROUND")) { + if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_BACKGROUND")) { if (cmSystemTools::FileExists(option)) { - Background = option; + this->Background = option; } else { - printSkippedOptionWarning("CPACK_IFW_PACKAGE_BACKGROUND", option); + this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_BACKGROUND", option); } } // WizardStyle - if (const char* option = GetOption("CPACK_IFW_PACKAGE_WIZARD_STYLE")) { + if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_WIZARD_STYLE")) { // Setting the user value in any case - WizardStyle = option; + this->WizardStyle = option; // Check known values - if (WizardStyle != "Modern" && WizardStyle != "Aero" && - WizardStyle != "Mac" && WizardStyle != "Classic") { + if (this->WizardStyle != "Modern" && this->WizardStyle != "Aero" && + this->WizardStyle != "Mac" && this->WizardStyle != "Classic") { cmCPackIFWLogger( WARNING, "Option CPACK_IFW_PACKAGE_WIZARD_STYLE has unknown value \"" << option << "\". Expected values are: Modern, Aero, Mac, Classic." @@ -145,87 +145,89 @@ void cmCPackIFWInstaller::ConfigureFromOptions() // WizardDefaultWidth if (const char* option = - GetOption("CPACK_IFW_PACKAGE_WIZARD_DEFAULT_WIDTH")) { - WizardDefaultWidth = option; + this->GetOption("CPACK_IFW_PACKAGE_WIZARD_DEFAULT_WIDTH")) { + this->WizardDefaultWidth = option; } // WizardDefaultHeight if (const char* option = - GetOption("CPACK_IFW_PACKAGE_WIZARD_DEFAULT_HEIGHT")) { - WizardDefaultHeight = option; + this->GetOption("CPACK_IFW_PACKAGE_WIZARD_DEFAULT_HEIGHT")) { + this->WizardDefaultHeight = option; } // TitleColor - if (const char* option = GetOption("CPACK_IFW_PACKAGE_TITLE_COLOR")) { - TitleColor = option; + if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_TITLE_COLOR")) { + this->TitleColor = option; } // Start menu if (const char* optIFW_START_MENU_DIR = this->GetOption("CPACK_IFW_PACKAGE_START_MENU_DIRECTORY")) { - StartMenuDir = optIFW_START_MENU_DIR; + this->StartMenuDir = optIFW_START_MENU_DIR; } else { - StartMenuDir = Name; + this->StartMenuDir = Name; } // Default target directory for installation if (const char* optIFW_TARGET_DIRECTORY = - GetOption("CPACK_IFW_TARGET_DIRECTORY")) { - TargetDir = optIFW_TARGET_DIRECTORY; + this->GetOption("CPACK_IFW_TARGET_DIRECTORY")) { + this->TargetDir = optIFW_TARGET_DIRECTORY; } else if (const char* optPACKAGE_INSTALL_DIRECTORY = - GetOption("CPACK_PACKAGE_INSTALL_DIRECTORY")) { - TargetDir = "@ApplicationsDir@/"; - TargetDir += optPACKAGE_INSTALL_DIRECTORY; + this->GetOption("CPACK_PACKAGE_INSTALL_DIRECTORY")) { + this->TargetDir = "@ApplicationsDir@/"; + this->TargetDir += optPACKAGE_INSTALL_DIRECTORY; } else { - TargetDir = "@RootDir@/usr/local"; + this->TargetDir = "@RootDir@/usr/local"; } // Default target directory for installation with administrator rights - if (const char* option = GetOption("CPACK_IFW_ADMIN_TARGET_DIRECTORY")) { - AdminTargetDir = option; + if (const char* option = + this->GetOption("CPACK_IFW_ADMIN_TARGET_DIRECTORY")) { + this->AdminTargetDir = option; } // Maintenance tool if (const char* optIFW_MAINTENANCE_TOOL = this->GetOption("CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_NAME")) { - MaintenanceToolName = optIFW_MAINTENANCE_TOOL; + this->MaintenanceToolName = optIFW_MAINTENANCE_TOOL; } // Maintenance tool ini file if (const char* optIFW_MAINTENANCE_TOOL_INI = this->GetOption("CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_INI_FILE")) { - MaintenanceToolIniFile = optIFW_MAINTENANCE_TOOL_INI; + this->MaintenanceToolIniFile = optIFW_MAINTENANCE_TOOL_INI; } // Allow non-ASCII characters if (this->GetOption("CPACK_IFW_PACKAGE_ALLOW_NON_ASCII_CHARACTERS")) { - if (IsOn("CPACK_IFW_PACKAGE_ALLOW_NON_ASCII_CHARACTERS")) { - AllowNonAsciiCharacters = "true"; + if (this->IsOn("CPACK_IFW_PACKAGE_ALLOW_NON_ASCII_CHARACTERS")) { + this->AllowNonAsciiCharacters = "true"; } else { - AllowNonAsciiCharacters = "false"; + this->AllowNonAsciiCharacters = "false"; } } // Space in path if (this->GetOption("CPACK_IFW_PACKAGE_ALLOW_SPACE_IN_PATH")) { - if (IsOn("CPACK_IFW_PACKAGE_ALLOW_SPACE_IN_PATH")) { - AllowSpaceInPath = "true"; + if (this->IsOn("CPACK_IFW_PACKAGE_ALLOW_SPACE_IN_PATH")) { + this->AllowSpaceInPath = "true"; } else { - AllowSpaceInPath = "false"; + this->AllowSpaceInPath = "false"; } } // Control script if (const char* optIFW_CONTROL_SCRIPT = this->GetOption("CPACK_IFW_PACKAGE_CONTROL_SCRIPT")) { - ControlScript = optIFW_CONTROL_SCRIPT; + this->ControlScript = optIFW_CONTROL_SCRIPT; } // Resources if (const char* optIFW_PACKAGE_RESOURCES = this->GetOption("CPACK_IFW_PACKAGE_RESOURCES")) { - Resources.clear(); - cmSystemTools::ExpandListArgument(optIFW_PACKAGE_RESOURCES, Resources); + this->Resources.clear(); + cmSystemTools::ExpandListArgument(optIFW_PACKAGE_RESOURCES, + this->Resources); } } @@ -239,19 +241,20 @@ public: : installer(i) , file(false) { - path = i->Directory + "/resources"; + this->path = i->Directory + "/resources"; } bool ParseResource(size_t r) { - hasFiles = false; - hasErrors = false; + this->hasFiles = false; + this->hasErrors = false; - basePath = cmSystemTools::GetFilenamePath(installer->Resources[r]); + this->basePath = + cmSystemTools::GetFilenamePath(this->installer->Resources[r]); - ParseFile(installer->Resources[r].data()); + this->ParseFile(this->installer->Resources[r].data()); - return hasFiles && !hasErrors; + return this->hasFiles && !this->hasErrors; } cmCPackIFWInstaller* installer; @@ -261,22 +264,22 @@ public: protected: void StartElement(const std::string& name, const char** /*atts*/) CM_OVERRIDE { - file = name == "file"; + this->file = name == "file"; if (file) { - hasFiles = true; + this->hasFiles = true; } } void CharacterDataHandler(const char* data, int length) CM_OVERRIDE { - if (file) { + if (this->file) { std::string content(data, data + length); content = cmSystemTools::TrimWhitespace(content); - std::string source = basePath + "/" + content; - std::string destination = path + "/" + content; + std::string source = this->basePath + "/" + content; + std::string destination = this->path + "/" + content; if (!cmSystemTools::CopyFileIfDifferent(source.data(), destination.data())) { - hasErrors = true; + this->hasErrors = true; } } } @@ -287,12 +290,12 @@ protected: void cmCPackIFWInstaller::GenerateInstallerFile() { // Lazy directory initialization - if (Directory.empty() && Generator) { - Directory = Generator->toplevel; + if (this->Directory.empty() && this->Generator) { + this->Directory = this->Generator->toplevel; } // Output stream - cmGeneratedFileStream fout((Directory + "/config/config.xml").data()); + cmGeneratedFileStream fout((this->Directory + "/config/config.xml").data()); cmXMLWriter xout(fout); xout.StartDocument(); @@ -301,163 +304,165 @@ void cmCPackIFWInstaller::GenerateInstallerFile() xout.StartElement("Installer"); - xout.Element("Name", Name); - xout.Element("Version", Version); - xout.Element("Title", Title); + xout.Element("Name", this->Name); + xout.Element("Version", this->Version); + xout.Element("Title", this->Title); - if (!Publisher.empty()) { - xout.Element("Publisher", Publisher); + if (!this->Publisher.empty()) { + xout.Element("Publisher", this->Publisher); } - if (!ProductUrl.empty()) { - xout.Element("ProductUrl", ProductUrl); + if (!this->ProductUrl.empty()) { + xout.Element("ProductUrl", this->ProductUrl); } // ApplicationIcon - if (!InstallerApplicationIcon.empty()) { + if (!this->InstallerApplicationIcon.empty()) { std::string name = - cmSystemTools::GetFilenameName(InstallerApplicationIcon); - std::string path = Directory + "/config/" + name; + cmSystemTools::GetFilenameName(this->InstallerApplicationIcon); + std::string path = this->Directory + "/config/" + name; name = cmSystemTools::GetFilenameWithoutExtension(name); - cmsys::SystemTools::CopyFileIfDifferent(InstallerApplicationIcon, path); + cmsys::SystemTools::CopyFileIfDifferent(this->InstallerApplicationIcon, + path); xout.Element("InstallerApplicationIcon", name); } // WindowIcon - if (!InstallerWindowIcon.empty()) { - std::string name = cmSystemTools::GetFilenameName(InstallerWindowIcon); - std::string path = Directory + "/config/" + name; - cmsys::SystemTools::CopyFileIfDifferent(InstallerWindowIcon, path); + if (!this->InstallerWindowIcon.empty()) { + std::string name = + cmSystemTools::GetFilenameName(this->InstallerWindowIcon); + std::string path = this->Directory + "/config/" + name; + cmsys::SystemTools::CopyFileIfDifferent(this->InstallerWindowIcon, path); xout.Element("InstallerWindowIcon", name); } // Logo - if (!Logo.empty()) { - std::string name = cmSystemTools::GetFilenameName(Logo); - std::string path = Directory + "/config/" + name; - cmsys::SystemTools::CopyFileIfDifferent(Logo, path); + if (!this->Logo.empty()) { + std::string name = cmSystemTools::GetFilenameName(this->Logo); + std::string path = this->Directory + "/config/" + name; + cmsys::SystemTools::CopyFileIfDifferent(this->Logo, path); xout.Element("Logo", name); } // Banner - if (!Banner.empty()) { - std::string name = cmSystemTools::GetFilenameName(Banner); - std::string path = Directory + "/config/" + name; - cmsys::SystemTools::CopyFileIfDifferent(Banner, path); + if (!this->Banner.empty()) { + std::string name = cmSystemTools::GetFilenameName(this->Banner); + std::string path = this->Directory + "/config/" + name; + cmsys::SystemTools::CopyFileIfDifferent(this->Banner, path); xout.Element("Banner", name); } // Watermark - if (!Watermark.empty()) { - std::string name = cmSystemTools::GetFilenameName(Watermark); - std::string path = Directory + "/config/" + name; - cmsys::SystemTools::CopyFileIfDifferent(Watermark, path); + if (!this->Watermark.empty()) { + std::string name = cmSystemTools::GetFilenameName(this->Watermark); + std::string path = this->Directory + "/config/" + name; + cmsys::SystemTools::CopyFileIfDifferent(this->Watermark, path); xout.Element("Watermark", name); } // Background - if (!Background.empty()) { - std::string name = cmSystemTools::GetFilenameName(Background); - std::string path = Directory + "/config/" + name; - cmsys::SystemTools::CopyFileIfDifferent(Background, path); + if (!this->Background.empty()) { + std::string name = cmSystemTools::GetFilenameName(this->Background); + std::string path = this->Directory + "/config/" + name; + cmsys::SystemTools::CopyFileIfDifferent(this->Background, path); xout.Element("Background", name); } // WizardStyle - if (!WizardStyle.empty()) { - xout.Element("WizardStyle", WizardStyle); + if (!this->WizardStyle.empty()) { + xout.Element("WizardStyle", this->WizardStyle); } // WizardDefaultWidth - if (!WizardDefaultWidth.empty()) { - xout.Element("WizardDefaultWidth", WizardDefaultWidth); + if (!this->WizardDefaultWidth.empty()) { + xout.Element("WizardDefaultWidth", this->WizardDefaultWidth); } // WizardDefaultHeight - if (!WizardDefaultHeight.empty()) { - xout.Element("WizardDefaultHeight", WizardDefaultHeight); + if (!this->WizardDefaultHeight.empty()) { + xout.Element("WizardDefaultHeight", this->WizardDefaultHeight); } // TitleColor - if (!TitleColor.empty()) { - xout.Element("TitleColor", TitleColor); + if (!this->TitleColor.empty()) { + xout.Element("TitleColor", this->TitleColor); } // Start menu - if (!IsVersionLess("2.0")) { - xout.Element("StartMenuDir", StartMenuDir); + if (!this->IsVersionLess("2.0")) { + xout.Element("StartMenuDir", this->StartMenuDir); } // Target dir - if (!TargetDir.empty()) { - xout.Element("TargetDir", TargetDir); + if (!this->TargetDir.empty()) { + xout.Element("TargetDir", this->TargetDir); } // Admin target dir - if (!AdminTargetDir.empty()) { - xout.Element("AdminTargetDir", AdminTargetDir); + if (!this->AdminTargetDir.empty()) { + xout.Element("AdminTargetDir", this->AdminTargetDir); } // Remote repositories - if (!RemoteRepositories.empty()) { + if (!this->RemoteRepositories.empty()) { xout.StartElement("RemoteRepositories"); - for (RepositoriesVector::iterator rit = RemoteRepositories.begin(); - rit != RemoteRepositories.end(); ++rit) { + for (RepositoriesVector::iterator rit = this->RemoteRepositories.begin(); + rit != this->RemoteRepositories.end(); ++rit) { (*rit)->WriteRepositoryConfig(xout); } xout.EndElement(); } // Maintenance tool - if (!IsVersionLess("2.0") && !MaintenanceToolName.empty()) { - xout.Element("MaintenanceToolName", MaintenanceToolName); + if (!this->IsVersionLess("2.0") && !this->MaintenanceToolName.empty()) { + xout.Element("MaintenanceToolName", this->MaintenanceToolName); } // Maintenance tool ini file - if (!IsVersionLess("2.0") && !MaintenanceToolIniFile.empty()) { - xout.Element("MaintenanceToolIniFile", MaintenanceToolIniFile); + if (!this->IsVersionLess("2.0") && !this->MaintenanceToolIniFile.empty()) { + xout.Element("MaintenanceToolIniFile", this->MaintenanceToolIniFile); } // Different allows - if (IsVersionLess("2.0")) { + if (this->IsVersionLess("2.0")) { // CPack IFW default policy xout.Comment("CPack IFW default policy for QtIFW less 2.0"); xout.Element("AllowNonAsciiCharacters", "true"); xout.Element("AllowSpaceInPath", "true"); } else { - if (!AllowNonAsciiCharacters.empty()) { - xout.Element("AllowNonAsciiCharacters", AllowNonAsciiCharacters); + if (!this->AllowNonAsciiCharacters.empty()) { + xout.Element("AllowNonAsciiCharacters", this->AllowNonAsciiCharacters); } - if (!AllowSpaceInPath.empty()) { - xout.Element("AllowSpaceInPath", AllowSpaceInPath); + if (!this->AllowSpaceInPath.empty()) { + xout.Element("AllowSpaceInPath", this->AllowSpaceInPath); } } // Control script (copy to config dir) - if (!IsVersionLess("2.0") && !ControlScript.empty()) { - std::string name = cmSystemTools::GetFilenameName(ControlScript); - std::string path = Directory + "/config/" + name; - cmsys::SystemTools::CopyFileIfDifferent(ControlScript, path); + if (!this->IsVersionLess("2.0") && !this->ControlScript.empty()) { + std::string name = cmSystemTools::GetFilenameName(this->ControlScript); + std::string path = this->Directory + "/config/" + name; + cmsys::SystemTools::CopyFileIfDifferent(this->ControlScript, path); xout.Element("ControlScript", name); } // Resources (copy to resources dir) - if (!Resources.empty()) { + if (!this->Resources.empty()) { std::vector<std::string> resources; cmCPackIFWResourcesParser parser(this); - for (size_t i = 0; i < Resources.size(); i++) { + for (size_t i = 0; i < this->Resources.size(); i++) { if (parser.ParseResource(i)) { - std::string name = cmSystemTools::GetFilenameName(Resources[i]); - std::string path = Directory + "/resources/" + name; - cmsys::SystemTools::CopyFileIfDifferent(Resources[i], path); + std::string name = cmSystemTools::GetFilenameName(this->Resources[i]); + std::string path = this->Directory + "/resources/" + name; + cmsys::SystemTools::CopyFileIfDifferent(this->Resources[i], path); resources.push_back(name); } else { cmCPackIFWLogger(WARNING, "Can't copy resources from \"" - << Resources[i] << "\". Resource will be skipped." - << std::endl); + << this->Resources[i] + << "\". Resource will be skipped." << std::endl); } } - Resources = resources; + this->Resources = resources; } xout.EndElement(); @@ -466,13 +471,13 @@ void cmCPackIFWInstaller::GenerateInstallerFile() void cmCPackIFWInstaller::GeneratePackageFiles() { - if (Packages.empty() || Generator->IsOnePackage()) { + if (this->Packages.empty() || this->Generator->IsOnePackage()) { // Generate default package cmCPackIFWPackage package; - package.Generator = Generator; + package.Generator = this->Generator; package.Installer = this; // Check package group - if (const char* option = GetOption("CPACK_IFW_PACKAGE_GROUP")) { + if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_GROUP")) { package.ConfigureFromGroup(option); std::string forcedOption = "CPACK_IFW_COMPONENT_GROUP_" + cmsys::SystemTools::UpperCase(option) + "_FORCED_INSTALLATION"; @@ -487,8 +492,8 @@ void cmCPackIFWInstaller::GeneratePackageFiles() } // Generate packages meta information - for (PackagesMap::iterator pit = Packages.begin(); pit != Packages.end(); - ++pit) { + for (PackagesMap::iterator pit = this->Packages.begin(); + pit != this->Packages.end(); ++pit) { cmCPackIFWPackage* package = pit->second; package->GeneratePackageFile(); } diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx index 7a0a00c..e6ef421 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.cxx +++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx @@ -18,7 +18,7 @@ //---------------------------------------------------------- CompareStruct --- cmCPackIFWPackage::CompareStruct::CompareStruct() - : Type(CompareNone) + : Type(cmCPackIFWPackage::CompareNone) { } @@ -33,56 +33,58 @@ cmCPackIFWPackage::DependenceStruct::DependenceStruct( // Search compare section size_t pos = std::string::npos; if ((pos = dependence.find("<=")) != std::string::npos) { - Compare.Type = CompareLessOrEqual; - Compare.Value = dependence.substr(pos + 2); + this->Compare.Type = cmCPackIFWPackage::CompareLessOrEqual; + this->Compare.Value = dependence.substr(pos + 2); } else if ((pos = dependence.find(">=")) != std::string::npos) { - Compare.Type = CompareGreaterOrEqual; - Compare.Value = dependence.substr(pos + 2); + this->Compare.Type = cmCPackIFWPackage::CompareGreaterOrEqual; + this->Compare.Value = dependence.substr(pos + 2); } else if ((pos = dependence.find('<')) != std::string::npos) { - Compare.Type = CompareLess; - Compare.Value = dependence.substr(pos + 1); + this->Compare.Type = cmCPackIFWPackage::CompareLess; + this->Compare.Value = dependence.substr(pos + 1); } else if ((pos = dependence.find('=')) != std::string::npos) { - Compare.Type = CompareEqual; - Compare.Value = dependence.substr(pos + 1); + this->Compare.Type = cmCPackIFWPackage::CompareEqual; + this->Compare.Value = dependence.substr(pos + 1); } else if ((pos = dependence.find('>')) != std::string::npos) { - Compare.Type = CompareGreater; - Compare.Value = dependence.substr(pos + 1); + this->Compare.Type = cmCPackIFWPackage::CompareGreater; + this->Compare.Value = dependence.substr(pos + 1); } else if ((pos = dependence.find('-')) != std::string::npos) { - Compare.Type = CompareNone; - Compare.Value = dependence.substr(pos + 1); + this->Compare.Type = cmCPackIFWPackage::CompareNone; + this->Compare.Value = dependence.substr(pos + 1); } size_t dashPos = dependence.find('-'); if (dashPos != std::string::npos) { pos = dashPos; } - Name = pos == std::string::npos ? dependence : dependence.substr(0, pos); + this->Name = + pos == std::string::npos ? dependence : dependence.substr(0, pos); } std::string cmCPackIFWPackage::DependenceStruct::NameWithCompare() const { - if (Compare.Type == CompareNone) { - return Name; + if (this->Compare.Type == cmCPackIFWPackage::CompareNone) { + return this->Name; } - std::string result = Name; + std::string result = this->Name; - if (Compare.Type != CompareNone || !Compare.Value.empty()) { + if (this->Compare.Type != cmCPackIFWPackage::CompareNone || + !this->Compare.Value.empty()) { result += "-"; } - if (Compare.Type == CompareLessOrEqual) { + if (this->Compare.Type == cmCPackIFWPackage::CompareLessOrEqual) { result += "<="; - } else if (Compare.Type == CompareGreaterOrEqual) { + } else if (this->Compare.Type == cmCPackIFWPackage::CompareGreaterOrEqual) { result += ">="; - } else if (Compare.Type == CompareLess) { + } else if (this->Compare.Type == cmCPackIFWPackage::CompareLess) { result += "<"; - } else if (Compare.Type == CompareEqual) { + } else if (this->Compare.Type == cmCPackIFWPackage::CompareEqual) { result += "="; - } else if (Compare.Type == CompareGreater) { + } else if (this->Compare.Type == cmCPackIFWPackage::CompareGreater) { result += ">"; } - result += Compare.Value; + result += this->Compare.Value; return result; } @@ -99,62 +101,62 @@ std::string cmCPackIFWPackage::GetComponentName(cmCPackComponent* component) return ""; } const char* option = - GetOption("CPACK_IFW_COMPONENT_" + - cmsys::SystemTools::UpperCase(component->Name) + "_NAME"); + this->GetOption("CPACK_IFW_COMPONENT_" + + cmsys::SystemTools::UpperCase(component->Name) + "_NAME"); return option ? option : component->Name; } void cmCPackIFWPackage::DefaultConfiguration() { - DisplayName = ""; - Description = ""; - Version = ""; - ReleaseDate = ""; - Script = ""; - Licenses.clear(); - UserInterfaces.clear(); - Translations.clear(); - SortingPriority = ""; - UpdateText = ""; - Default = ""; - Essential = ""; - Virtual = ""; - ForcedInstallation = ""; - RequiresAdminRights = ""; + this->DisplayName = ""; + this->Description = ""; + this->Version = ""; + this->ReleaseDate = ""; + this->Script = ""; + this->Licenses.clear(); + this->UserInterfaces.clear(); + this->Translations.clear(); + this->SortingPriority = ""; + this->UpdateText = ""; + this->Default = ""; + this->Essential = ""; + this->Virtual = ""; + this->ForcedInstallation = ""; + this->RequiresAdminRights = ""; } // Defaul configuration (all in one package) int cmCPackIFWPackage::ConfigureFromOptions() { // Restore defaul configuration - DefaultConfiguration(); + this->DefaultConfiguration(); // Name - Name = Generator->GetRootPackageName(); + this->Name = this->Generator->GetRootPackageName(); // Display name if (const char* option = this->GetOption("CPACK_PACKAGE_NAME")) { - DisplayName = option; + this->DisplayName = option; } else { - DisplayName = "Your package"; + this->DisplayName = "Your package"; } // Description if (const char* option = this->GetOption("CPACK_PACKAGE_DESCRIPTION_SUMMARY")) { - Description = option; + this->Description = option; } else { - Description = "Your package description"; + this->Description = "Your package description"; } // Version - if (const char* option = GetOption("CPACK_PACKAGE_VERSION")) { - Version = option; + if (const char* option = this->GetOption("CPACK_PACKAGE_VERSION")) { + this->Version = option; } else { - Version = "1.0.0"; + this->Version = "1.0.0"; } - ForcedInstallation = "true"; + this->ForcedInstallation = "true"; return 1; } @@ -166,36 +168,36 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component) } // Restore defaul configuration - DefaultConfiguration(); + this->DefaultConfiguration(); std::string prefix = "CPACK_IFW_COMPONENT_" + cmsys::SystemTools::UpperCase(component->Name) + "_"; // Display name - DisplayName = component->DisplayName; + this->DisplayName = component->DisplayName; // Description - Description = component->Description; + this->Description = component->Description; // Version - if (const char* optVERSION = GetOption(prefix + "VERSION")) { - Version = optVERSION; + if (const char* optVERSION = this->GetOption(prefix + "VERSION")) { + this->Version = optVERSION; } else if (const char* optPACKAGE_VERSION = - GetOption("CPACK_PACKAGE_VERSION")) { - Version = optPACKAGE_VERSION; + this->GetOption("CPACK_PACKAGE_VERSION")) { + this->Version = optPACKAGE_VERSION; } else { - Version = "1.0.0"; + this->Version = "1.0.0"; } // Script - if (const char* option = GetOption(prefix + "SCRIPT")) { - Script = option; + if (const char* option = this->GetOption(prefix + "SCRIPT")) { + this->Script = option; } // User interfaces if (const char* option = this->GetOption(prefix + "USER_INTERFACES")) { - UserInterfaces.clear(); - cmSystemTools::ExpandListArgument(option, UserInterfaces); + this->UserInterfaces.clear(); + cmSystemTools::ExpandListArgument(option, this->UserInterfaces); } // CMake dependencies @@ -203,27 +205,27 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component) std::vector<cmCPackComponent*>::iterator dit; for (dit = component->Dependencies.begin(); dit != component->Dependencies.end(); ++dit) { - Dependencies.insert(Generator->ComponentPackages[*dit]); + this->Dependencies.insert(this->Generator->ComponentPackages[*dit]); } } // Licenses if (const char* option = this->GetOption(prefix + "LICENSES")) { - Licenses.clear(); - cmSystemTools::ExpandListArgument(option, Licenses); - if (Licenses.size() % 2 != 0) { + this->Licenses.clear(); + cmSystemTools::ExpandListArgument(option, this->Licenses); + if (this->Licenses.size() % 2 != 0) { cmCPackIFWLogger( WARNING, prefix << "LICENSES" << " should contain pairs of <display_name> and <file_path>." << std::endl); - Licenses.clear(); + this->Licenses.clear(); } } // Priority if (const char* option = this->GetOption(prefix + "PRIORITY")) { - SortingPriority = option; + this->SortingPriority = option; cmCPackIFWLogger( WARNING, "The \"PRIORITY\" option is set " << "for component \"" << component->Name << "\", but there option is " @@ -232,20 +234,20 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component) } // Default - Default = component->IsDisabledByDefault ? "false" : "true"; + this->Default = component->IsDisabledByDefault ? "false" : "true"; // Essential if (this->IsOn(prefix + "ESSENTIAL")) { - Essential = "true"; + this->Essential = "true"; } // Virtual - Virtual = component->IsHidden ? "true" : ""; + this->Virtual = component->IsHidden ? "true" : ""; // ForcedInstallation - ForcedInstallation = component->IsRequired ? "true" : "false"; + this->ForcedInstallation = component->IsRequired ? "true" : "false"; - return ConfigureFromPrefix(prefix); + return this->ConfigureFromPrefix(prefix); } int cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup* group) @@ -255,52 +257,52 @@ int cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup* group) } // Restore defaul configuration - DefaultConfiguration(); + this->DefaultConfiguration(); std::string prefix = "CPACK_IFW_COMPONENT_GROUP_" + cmsys::SystemTools::UpperCase(group->Name) + "_"; - DisplayName = group->DisplayName; - Description = group->Description; + this->DisplayName = group->DisplayName; + this->Description = group->Description; // Version - if (const char* optVERSION = GetOption(prefix + "VERSION")) { - Version = optVERSION; + if (const char* optVERSION = this->GetOption(prefix + "VERSION")) { + this->Version = optVERSION; } else if (const char* optPACKAGE_VERSION = - GetOption("CPACK_PACKAGE_VERSION")) { - Version = optPACKAGE_VERSION; + this->GetOption("CPACK_PACKAGE_VERSION")) { + this->Version = optPACKAGE_VERSION; } else { - Version = "1.0.0"; + this->Version = "1.0.0"; } // Script - if (const char* option = GetOption(prefix + "SCRIPT")) { - Script = option; + if (const char* option = this->GetOption(prefix + "SCRIPT")) { + this->Script = option; } // User interfaces if (const char* option = this->GetOption(prefix + "USER_INTERFACES")) { - UserInterfaces.clear(); - cmSystemTools::ExpandListArgument(option, UserInterfaces); + this->UserInterfaces.clear(); + cmSystemTools::ExpandListArgument(option, this->UserInterfaces); } // Licenses if (const char* option = this->GetOption(prefix + "LICENSES")) { - Licenses.clear(); - cmSystemTools::ExpandListArgument(option, Licenses); - if (Licenses.size() % 2 != 0) { + this->Licenses.clear(); + cmSystemTools::ExpandListArgument(option, this->Licenses); + if (this->Licenses.size() % 2 != 0) { cmCPackIFWLogger( WARNING, prefix << "LICENSES" << " should contain pairs of <display_name> and <file_path>." << std::endl); - Licenses.clear(); + this->Licenses.clear(); } } // Priority if (const char* option = this->GetOption(prefix + "PRIORITY")) { - SortingPriority = option; + this->SortingPriority = option; cmCPackIFWLogger( WARNING, "The \"PRIORITY\" option is set " << "for component group \"" << group->Name @@ -309,7 +311,7 @@ int cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup* group) << std::endl); } - return ConfigureFromPrefix(prefix); + return this->ConfigureFromPrefix(prefix); } int cmCPackIFWPackage::ConfigureFromGroup(const std::string& groupName) @@ -320,29 +322,29 @@ int cmCPackIFWPackage::ConfigureFromGroup(const std::string& groupName) std::string prefix = "CPACK_COMPONENT_GROUP_" + cmsys::SystemTools::UpperCase(groupName) + "_"; - if (const char* option = GetOption(prefix + "DISPLAY_NAME")) { + if (const char* option = this->GetOption(prefix + "DISPLAY_NAME")) { group.DisplayName = option; } else { group.DisplayName = group.Name; } - if (const char* option = GetOption(prefix + "DESCRIPTION")) { + if (const char* option = this->GetOption(prefix + "DESCRIPTION")) { group.Description = option; } - group.IsBold = IsOn(prefix + "BOLD_TITLE"); - group.IsExpandedByDefault = IsOn(prefix + "EXPANDED"); + group.IsBold = this->IsOn(prefix + "BOLD_TITLE"); + group.IsExpandedByDefault = this->IsOn(prefix + "EXPANDED"); // Package configuration group.Name = groupName; if (Generator) { - Name = Generator->GetGroupPackageName(&group); + this->Name = this->Generator->GetGroupPackageName(&group); } else { - Name = group.Name; + this->Name = group.Name; } - return ConfigureFromGroup(&group); + return this->ConfigureFromGroup(&group); } // Common options for components and groups @@ -353,51 +355,51 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix) // Display name option = prefix + "DISPLAY_NAME"; - if (IsSetToEmpty(option)) { - DisplayName.clear(); - } else if (const char* value = GetOption(option)) { - DisplayName = value; + if (this->IsSetToEmpty(option)) { + this->DisplayName.clear(); + } else if (const char* value = this->GetOption(option)) { + this->DisplayName = value; } // Description option = prefix + "DESCRIPTION"; - if (IsSetToEmpty(option)) { - Description.clear(); - } else if (const char* value = GetOption(option)) { - Description = value; + if (this->IsSetToEmpty(option)) { + this->Description.clear(); + } else if (const char* value = this->GetOption(option)) { + this->Description = value; } // Release date option = prefix + "RELEASE_DATE"; - if (IsSetToEmpty(option)) { - ReleaseDate.clear(); - } else if (const char* value = GetOption(option)) { - ReleaseDate = value; + if (this->IsSetToEmpty(option)) { + this->ReleaseDate.clear(); + } else if (const char* value = this->GetOption(option)) { + this->ReleaseDate = value; } // Sorting priority option = prefix + "SORTING_PRIORITY"; - if (IsSetToEmpty(option)) { - SortingPriority.clear(); - } else if (const char* value = GetOption(option)) { - SortingPriority = value; + if (this->IsSetToEmpty(option)) { + this->SortingPriority.clear(); + } else if (const char* value = this->GetOption(option)) { + this->SortingPriority = value; } // Update text option = prefix + "UPDATE_TEXT"; - if (IsSetToEmpty(option)) { - UpdateText.clear(); - } else if (const char* value = GetOption(option)) { - UpdateText = value; + if (this->IsSetToEmpty(option)) { + this->UpdateText.clear(); + } else if (const char* value = this->GetOption(option)) { + this->UpdateText = value; } // Translations option = prefix + "TRANSLATIONS"; - if (IsSetToEmpty(option)) { - Translations.clear(); + if (this->IsSetToEmpty(option)) { + this->Translations.clear(); } else if (const char* value = this->GetOption(option)) { - Translations.clear(); - cmSystemTools::ExpandListArgument(value, Translations); + this->Translations.clear(); + cmSystemTools::ExpandListArgument(value, this->Translations); } // QtIFW dependencies @@ -413,84 +415,84 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix) for (std::vector<std::string>::iterator dit = deps.begin(); dit != deps.end(); ++dit) { DependenceStruct dep(*dit); - if (Generator->Packages.count(dep.Name)) { - cmCPackIFWPackage& depPkg = Generator->Packages[dep.Name]; + if (this->Generator->Packages.count(dep.Name)) { + cmCPackIFWPackage& depPkg = this->Generator->Packages[dep.Name]; dep.Name = depPkg.Name; } - bool hasDep = Generator->DependentPackages.count(dep.Name) > 0; - DependenceStruct& depRef = Generator->DependentPackages[dep.Name]; + bool hasDep = this->Generator->DependentPackages.count(dep.Name) > 0; + DependenceStruct& depRef = this->Generator->DependentPackages[dep.Name]; if (!hasDep) { depRef = dep; } - AlienDependencies.insert(&depRef); + this->AlienDependencies.insert(&depRef); } // Automatic dependency on option = prefix + "AUTO_DEPEND_ON"; - if (IsSetToEmpty(option)) { - AlienAutoDependOn.clear(); + if (this->IsSetToEmpty(option)) { + this->AlienAutoDependOn.clear(); } else if (const char* value = this->GetOption(option)) { std::vector<std::string> depsOn; cmSystemTools::ExpandListArgument(value, depsOn); for (std::vector<std::string>::iterator dit = depsOn.begin(); dit != depsOn.end(); ++dit) { DependenceStruct dep(*dit); - if (Generator->Packages.count(dep.Name)) { - cmCPackIFWPackage& depPkg = Generator->Packages[dep.Name]; + if (this->Generator->Packages.count(dep.Name)) { + cmCPackIFWPackage& depPkg = this->Generator->Packages[dep.Name]; dep.Name = depPkg.Name; } - bool hasDep = Generator->DependentPackages.count(dep.Name) > 0; - DependenceStruct& depRef = Generator->DependentPackages[dep.Name]; + bool hasDep = this->Generator->DependentPackages.count(dep.Name) > 0; + DependenceStruct& depRef = this->Generator->DependentPackages[dep.Name]; if (!hasDep) { depRef = dep; } - AlienAutoDependOn.insert(&depRef); + this->AlienAutoDependOn.insert(&depRef); } } // Visibility option = prefix + "VIRTUAL"; - if (IsSetToEmpty(option)) { - Virtual.clear(); - } else if (IsOn(option)) { - Virtual = "true"; + if (this->IsSetToEmpty(option)) { + this->Virtual.clear(); + } else if (this->IsOn(option)) { + this->Virtual = "true"; } // Default selection option = prefix + "DEFAULT"; - if (IsSetToEmpty(option)) { - Default.clear(); - } else if (const char* value = GetOption(option)) { + if (this->IsSetToEmpty(option)) { + this->Default.clear(); + } else if (const char* value = this->GetOption(option)) { std::string lowerValue = cmsys::SystemTools::LowerCase(value); if (lowerValue == "true") { - Default = "true"; + this->Default = "true"; } else if (lowerValue == "false") { - Default = "false"; + this->Default = "false"; } else if (lowerValue == "script") { - Default = "script"; + this->Default = "script"; } else { - Default = value; + this->Default = value; } } // Forsed installation option = prefix + "FORCED_INSTALLATION"; - if (IsSetToEmpty(option)) { - ForcedInstallation.clear(); - } else if (IsOn(option)) { - ForcedInstallation = "true"; - } else if (IsSetToOff(option)) { - ForcedInstallation = "false"; + if (this->IsSetToEmpty(option)) { + this->ForcedInstallation.clear(); + } else if (this->IsOn(option)) { + this->ForcedInstallation = "true"; + } else if (this->IsSetToOff(option)) { + this->ForcedInstallation = "false"; } // Requires admin rights option = prefix + "REQUIRES_ADMIN_RIGHTS"; - if (IsSetToEmpty(option)) { - RequiresAdminRights.clear(); - } else if (IsOn(option)) { - RequiresAdminRights = "true"; - } else if (IsSetToOff(option)) { - RequiresAdminRights = "false"; + if (this->IsSetToEmpty(option)) { + this->RequiresAdminRights.clear(); + } else if (this->IsOn(option)) { + this->RequiresAdminRights = "true"; + } else if (this->IsSetToOff(option)) { + this->RequiresAdminRights = "false"; } return 1; @@ -499,16 +501,16 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix) void cmCPackIFWPackage::GeneratePackageFile() { // Lazy directory initialization - if (Directory.empty()) { - if (Installer) { - Directory = Installer->Directory + "/packages/" + Name; - } else if (Generator) { - Directory = Generator->toplevel + "/packages/" + Name; + if (this->Directory.empty()) { + if (this->Installer) { + this->Directory = this->Installer->Directory + "/packages/" + this->Name; + } else if (this->Generator) { + this->Directory = this->Generator->toplevel + "/packages/" + this->Name; } } // Output stream - cmGeneratedFileStream fout((Directory + "/meta/package.xml").data()); + cmGeneratedFileStream fout((this->Directory + "/meta/package.xml").data()); cmXMLWriter xout(fout); xout.StartDocument(); @@ -517,28 +519,28 @@ void cmCPackIFWPackage::GeneratePackageFile() xout.StartElement("Package"); - xout.Element("DisplayName", DisplayName); - xout.Element("Description", Description); + xout.Element("DisplayName", this->DisplayName); + xout.Element("Description", this->Description); // Update text - if (!UpdateText.empty()) { - xout.Element("UpdateText", UpdateText); + if (!this->UpdateText.empty()) { + xout.Element("UpdateText", this->UpdateText); } - xout.Element("Name", Name); - xout.Element("Version", Version); + xout.Element("Name", this->Name); + xout.Element("Version", this->Version); - if (!ReleaseDate.empty()) { - xout.Element("ReleaseDate", ReleaseDate); + if (!this->ReleaseDate.empty()) { + xout.Element("ReleaseDate", this->ReleaseDate); } else { xout.Element("ReleaseDate", cmTimestamp().CurrentTime("%Y-%m-%d", true)); } // Script (copy to meta dir) - if (!Script.empty()) { - std::string name = cmSystemTools::GetFilenameName(Script); - std::string path = Directory + "/meta/" + name; - cmsys::SystemTools::CopyFileIfDifferent(Script, path); + if (!this->Script.empty()) { + std::string name = cmSystemTools::GetFilenameName(this->Script); + std::string path = this->Directory + "/meta/" + name; + cmsys::SystemTools::CopyFileIfDifferent(this->Script, path); xout.Element("Script", name); } @@ -546,7 +548,7 @@ void cmCPackIFWPackage::GeneratePackageFile() std::vector<std::string> userInterfaces = UserInterfaces; for (size_t i = 0; i < userInterfaces.size(); i++) { std::string name = cmSystemTools::GetFilenameName(userInterfaces[i]); - std::string path = Directory + "/meta/" + name; + std::string path = this->Directory + "/meta/" + name; cmsys::SystemTools::CopyFileIfDifferent(userInterfaces[i], path); userInterfaces[i] = name; } @@ -562,7 +564,7 @@ void cmCPackIFWPackage::GeneratePackageFile() std::vector<std::string> translations = Translations; for (size_t i = 0; i < translations.size(); i++) { std::string name = cmSystemTools::GetFilenameName(translations[i]); - std::string path = Directory + "/meta/" + name; + std::string path = this->Directory + "/meta/" + name; cmsys::SystemTools::CopyFileIfDifferent(translations[i], path); translations[i] = name; } @@ -576,12 +578,13 @@ void cmCPackIFWPackage::GeneratePackageFile() // Dependencies std::set<DependenceStruct> compDepSet; - for (std::set<DependenceStruct*>::iterator ait = AlienDependencies.begin(); - ait != AlienDependencies.end(); ++ait) { + for (std::set<DependenceStruct*>::iterator ait = + this->AlienDependencies.begin(); + ait != this->AlienDependencies.end(); ++ait) { compDepSet.insert(*(*ait)); } - for (std::set<cmCPackIFWPackage*>::iterator it = Dependencies.begin(); - it != Dependencies.end(); ++it) { + for (std::set<cmCPackIFWPackage*>::iterator it = this->Dependencies.begin(); + it != this->Dependencies.end(); ++it) { compDepSet.insert(DependenceStruct((*it)->Name)); } // Write dependencies @@ -599,8 +602,9 @@ void cmCPackIFWPackage::GeneratePackageFile() // Automatic dependency on std::set<DependenceStruct> compAutoDepSet; - for (std::set<DependenceStruct*>::iterator ait = AlienAutoDependOn.begin(); - ait != AlienAutoDependOn.end(); ++ait) { + for (std::set<DependenceStruct*>::iterator ait = + this->AlienAutoDependOn.begin(); + ait != this->AlienAutoDependOn.end(); ++ait) { compAutoDepSet.insert(*(*ait)); } // Write automatic dependency on @@ -617,10 +621,10 @@ void cmCPackIFWPackage::GeneratePackageFile() } // Licenses (copy to meta dir) - std::vector<std::string> licenses = Licenses; + std::vector<std::string> licenses = this->Licenses; for (size_t i = 1; i < licenses.size(); i += 2) { std::string name = cmSystemTools::GetFilenameName(licenses[i]); - std::string path = Directory + "/meta/" + name; + std::string path = this->Directory + "/meta/" + name; cmsys::SystemTools::CopyFileIfDifferent(licenses[i], path); licenses[i] = name; } @@ -635,28 +639,28 @@ void cmCPackIFWPackage::GeneratePackageFile() xout.EndElement(); } - if (!ForcedInstallation.empty()) { - xout.Element("ForcedInstallation", ForcedInstallation); + if (!this->ForcedInstallation.empty()) { + xout.Element("ForcedInstallation", this->ForcedInstallation); } - if (!RequiresAdminRights.empty()) { - xout.Element("RequiresAdminRights", RequiresAdminRights); + if (!this->RequiresAdminRights.empty()) { + xout.Element("RequiresAdminRights", this->RequiresAdminRights); } - if (!Virtual.empty()) { - xout.Element("Virtual", Virtual); - } else if (!Default.empty()) { - xout.Element("Default", Default); + if (!this->Virtual.empty()) { + xout.Element("Virtual", this->Virtual); + } else if (!this->Default.empty()) { + xout.Element("Default", this->Default); } // Essential - if (!Essential.empty()) { - xout.Element("Essential", Essential); + if (!this->Essential.empty()) { + xout.Element("Essential", this->Essential); } // Priority - if (!SortingPriority.empty()) { - xout.Element("SortingPriority", SortingPriority); + if (!this->SortingPriority.empty()) { + xout.Element("SortingPriority", this->SortingPriority); } xout.EndElement(); diff --git a/Source/CPack/IFW/cmCPackIFWRepository.cxx b/Source/CPack/IFW/cmCPackIFWRepository.cxx index 9190596..b115db0 100644 --- a/Source/CPack/IFW/cmCPackIFWRepository.cxx +++ b/Source/CPack/IFW/cmCPackIFWRepository.cxx @@ -11,7 +11,7 @@ #include <stddef.h> cmCPackIFWRepository::cmCPackIFWRepository() - : Update(None) + : Update(cmCPackIFWRepository::None) { } @@ -19,18 +19,18 @@ bool cmCPackIFWRepository::IsValid() const { bool valid = true; - switch (Update) { - case None: - valid = !Url.empty(); + switch (this->Update) { + case cmCPackIFWRepository::None: + valid = !this->Url.empty(); break; - case Add: - valid = !Url.empty(); + case cmCPackIFWRepository::Add: + valid = !this->Url.empty(); break; - case Remove: - valid = !Url.empty(); + case cmCPackIFWRepository::Remove: + valid = !this->Url.empty(); break; - case Replace: - valid = !OldUrl.empty() && !NewUrl.empty(); + case cmCPackIFWRepository::Replace: + valid = !this->OldUrl.empty() && !this->NewUrl.empty(); break; } @@ -40,74 +40,74 @@ bool cmCPackIFWRepository::IsValid() const bool cmCPackIFWRepository::ConfigureFromOptions() { // Name; - if (Name.empty()) { + if (this->Name.empty()) { return false; } std::string prefix = - "CPACK_IFW_REPOSITORY_" + cmsys::SystemTools::UpperCase(Name) + "_"; + "CPACK_IFW_REPOSITORY_" + cmsys::SystemTools::UpperCase(this->Name) + "_"; // Update - if (IsOn(prefix + "ADD")) { - Update = Add; + if (this->IsOn(prefix + "ADD")) { + this->Update = cmCPackIFWRepository::Add; } else if (IsOn(prefix + "REMOVE")) { - Update = Remove; + this->Update = cmCPackIFWRepository::Remove; } else if (IsOn(prefix + "REPLACE")) { - Update = Replace; + this->Update = cmCPackIFWRepository::Replace; } else { - Update = None; + this->Update = cmCPackIFWRepository::None; } // Url - if (const char* url = GetOption(prefix + "URL")) { - Url = url; + if (const char* url = this->GetOption(prefix + "URL")) { + this->Url = url; } else { - Url = ""; + this->Url = ""; } // Old url - if (const char* oldUrl = GetOption(prefix + "OLD_URL")) { - OldUrl = oldUrl; + if (const char* oldUrl = this->GetOption(prefix + "OLD_URL")) { + this->OldUrl = oldUrl; } else { - OldUrl = ""; + this->OldUrl = ""; } // New url - if (const char* newUrl = GetOption(prefix + "NEW_URL")) { - NewUrl = newUrl; + if (const char* newUrl = this->GetOption(prefix + "NEW_URL")) { + this->NewUrl = newUrl; } else { - NewUrl = ""; + this->NewUrl = ""; } // Enabled - if (IsOn(prefix + "DISABLED")) { - Enabled = "0"; + if (this->IsOn(prefix + "DISABLED")) { + this->Enabled = "0"; } else { - Enabled = ""; + this->Enabled = ""; } // Username - if (const char* username = GetOption(prefix + "USERNAME")) { - Username = username; + if (const char* username = this->GetOption(prefix + "USERNAME")) { + this->Username = username; } else { - Username = ""; + this->Username = ""; } // Password - if (const char* password = GetOption(prefix + "PASSWORD")) { - Password = password; + if (const char* password = this->GetOption(prefix + "PASSWORD")) { + this->Password = password; } else { - Password = ""; + this->Password = ""; } // DisplayName - if (const char* displayName = GetOption(prefix + "DISPLAY_NAME")) { - DisplayName = displayName; + if (const char* displayName = this->GetOption(prefix + "DISPLAY_NAME")) { + this->DisplayName = displayName; } else { - DisplayName = ""; + this->DisplayName = ""; } - return IsValid(); + return this->IsValid(); } /** \class cmCPackeIFWUpdatesPatcher @@ -130,8 +130,8 @@ public: protected: void StartElement(const std::string& name, const char** atts) CM_OVERRIDE { - xout.StartElement(name); - StartFragment(atts); + this->xout.StartElement(name); + this->StartFragment(atts); } void StartFragment(const char** atts) @@ -139,23 +139,23 @@ protected: for (size_t i = 0; atts[i]; i += 2) { const char* key = atts[i]; const char* value = atts[i + 1]; - xout.Attribute(key, value); + this->xout.Attribute(key, value); } } void EndElement(const std::string& name) CM_OVERRIDE { - if (name == "Updates" && !patched) { - repository->WriteRepositoryUpdates(xout); - patched = true; + if (name == "Updates" && !this->patched) { + this->repository->WriteRepositoryUpdates(this->xout); + this->patched = true; } - xout.EndElement(); - if (patched) { + this->xout.EndElement(); + if (this->patched) { return; } if (name == "Checksum") { - repository->WriteRepositoryUpdates(xout); - patched = true; + this->repository->WriteRepositoryUpdates(this->xout); + this->patched = true; } } @@ -166,20 +166,21 @@ protected: content == "\n") { return; } - xout.Content(content); + this->xout.Content(content); } }; bool cmCPackIFWRepository::PatchUpdatesXml() { // Lazy directory initialization - if (Directory.empty() && Generator) { - Directory = Generator->toplevel; + if (this->Directory.empty() && this->Generator) { + this->Directory = this->Generator->toplevel; } // Filenames - std::string updatesXml = Directory + "/repository/Updates.xml"; - std::string updatesPatchXml = Directory + "/repository/UpdatesPatch.xml"; + std::string updatesXml = this->Directory + "/repository/Updates.xml"; + std::string updatesPatchXml = + this->Directory + "/repository/UpdatesPatch.xml"; // Output stream cmGeneratedFileStream fout(updatesPatchXml.data()); @@ -187,7 +188,7 @@ bool cmCPackIFWRepository::PatchUpdatesXml() xout.StartDocument(); - WriteGeneratedByToStrim(xout); + this->WriteGeneratedByToStrim(xout); // Patch { @@ -207,22 +208,22 @@ void cmCPackIFWRepository::WriteRepositoryConfig(cmXMLWriter& xout) xout.StartElement("Repository"); // Url - xout.Element("Url", Url); + xout.Element("Url", this->Url); // Enabled - if (!Enabled.empty()) { - xout.Element("Enabled", Enabled); + if (!this->Enabled.empty()) { + xout.Element("Enabled", this->Enabled); } // Username - if (!Username.empty()) { - xout.Element("Username", Username); + if (!this->Username.empty()) { + xout.Element("Username", this->Username); } // Password - if (!Password.empty()) { - xout.Element("Password", Password); + if (!this->Password.empty()) { + xout.Element("Password", this->Password); } // DisplayName - if (!DisplayName.empty()) { - xout.Element("DisplayName", DisplayName); + if (!this->DisplayName.empty()) { + xout.Element("DisplayName", this->DisplayName); } xout.EndElement(); @@ -232,42 +233,43 @@ void cmCPackIFWRepository::WriteRepositoryUpdate(cmXMLWriter& xout) { xout.StartElement("Repository"); - switch (Update) { - case None: + switch (this->Update) { + case cmCPackIFWRepository::None: break; - case Add: + case cmCPackIFWRepository::Add: xout.Attribute("action", "add"); break; - case Remove: + case cmCPackIFWRepository::Remove: xout.Attribute("action", "remove"); break; - case Replace: + case cmCPackIFWRepository::Replace: xout.Attribute("action", "replace"); break; } // Url - if (Update == Add || Update == Remove) { - xout.Attribute("url", Url); - } else if (Update == Replace) { - xout.Attribute("oldUrl", OldUrl); - xout.Attribute("newUrl", NewUrl); + if (this->Update == cmCPackIFWRepository::Add || + this->Update == cmCPackIFWRepository::Remove) { + xout.Attribute("url", this->Url); + } else if (Update == cmCPackIFWRepository::Replace) { + xout.Attribute("oldUrl", this->OldUrl); + xout.Attribute("newUrl", this->NewUrl); } // Enabled - if (!Enabled.empty()) { - xout.Attribute("enabled", Enabled); + if (!this->Enabled.empty()) { + xout.Attribute("enabled", this->Enabled); } // Username - if (!Username.empty()) { - xout.Attribute("username", Username); + if (!this->Username.empty()) { + xout.Attribute("username", this->Username); } // Password - if (!Password.empty()) { - xout.Attribute("password", Password); + if (!this->Password.empty()) { + xout.Attribute("password", this->Password); } // DisplayName - if (!DisplayName.empty()) { - xout.Attribute("displayname", DisplayName); + if (!this->DisplayName.empty()) { + xout.Attribute("displayname", this->DisplayName); } xout.EndElement(); @@ -275,10 +277,10 @@ void cmCPackIFWRepository::WriteRepositoryUpdate(cmXMLWriter& xout) void cmCPackIFWRepository::WriteRepositoryUpdates(cmXMLWriter& xout) { - if (!RepositoryUpdate.empty()) { + if (!this->RepositoryUpdate.empty()) { xout.StartElement("RepositoryUpdate"); - for (RepositoriesVector::iterator rit = RepositoryUpdate.begin(); - rit != RepositoryUpdate.end(); ++rit) { + for (RepositoriesVector::iterator rit = this->RepositoryUpdate.begin(); + rit != this->RepositoryUpdate.end(); ++rit) { (*rit)->WriteRepositoryUpdate(xout); } xout.EndElement(); diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index c5495c6..c873529 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -620,7 +620,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( << installComponent << std::endl); } - cmake cm; + cmake cm(cmake::RoleScript); cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); cm.GetCurrentSnapshot().SetDefaultDefinitions(); diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index a48c8cd..a44bc3d 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -23,7 +23,6 @@ #include "cmDocumentationEntry.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" -#include "cmState.h" #include "cmStateSnapshot.h" #include "cmSystemTools.h" #include "cm_auto_ptr.hxx" @@ -189,11 +188,10 @@ int main(int argc, char const* const* argv) cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE, "Read CPack config file: " << cpackConfigFile << std::endl); - cmake cminst; + cmake cminst(cmake::RoleScript); cminst.SetHomeDirectory(""); cminst.SetHomeOutputDirectory(""); cminst.GetCurrentSnapshot().SetDefaultDefinitions(); - cminst.GetState()->RemoveUnscriptableCommands(); cmGlobalGenerator cmgg(&cminst); CM_AUTO_PTR<cmMakefile> globalMF( new cmMakefile(&cmgg, cminst.GetCurrentSnapshot())); diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index ed7dd5d..cc29071 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -167,7 +167,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) return 1; } - cmake cm; + cmake cm(cmake::RoleProject); cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); std::string cmakeOutString; diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index a782150..5b21351 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -623,7 +623,7 @@ int cmCTestLaunch::Main(int argc, const char* const argv[]) void cmCTestLaunch::LoadConfig() { - cmake cm; + cmake cm(cmake::RoleScript); cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); cm.GetCurrentSnapshot().SetDefaultDefinitions(); diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 60e48b6..1fea8e5 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -275,7 +275,7 @@ void cmCTestScriptHandler::CreateCMake() delete this->GlobalGenerator; delete this->Makefile; } - this->CMake = new cmake; + this->CMake = new cmake(cmake::RoleScript); this->CMake->SetHomeDirectory(""); this->CMake->SetHomeOutputDirectory(""); this->CMake->GetCurrentSnapshot().SetDefaultDefinitions(); @@ -290,10 +290,6 @@ void cmCTestScriptHandler::CreateCMake() this->CMake->SetProgressCallback(ctestScriptProgressCallback, this->CTest); - // remove all cmake commands which are not scriptable, since they can't be - // used in ctest scripts - this->CMake->GetState()->RemoveUnscriptableCommands(); - // add any ctest specific commands, probably should have common superclass // for ctest commands to clean this up. If a couple more commands are // created with the same format lets do that - ken diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index a5cc1fa..349e91a 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1650,7 +1650,7 @@ void cmCTestTestHandler::GetListOfTests() } cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Constructing a list of tests" << std::endl, this->Quiet); - cmake cm; + cmake cm(cmake::RoleScript); cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); cm.GetCurrentSnapshot().SetDefaultDefinitions(); diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx index 1698a84..28a0e95 100644 --- a/Source/CursesDialog/ccmake.cxx +++ b/Source/CursesDialog/ccmake.cxx @@ -81,7 +81,7 @@ int main(int argc, char const* const* argv) cmDocumentation doc; doc.addCMakeStandardDocSections(); if (doc.CheckOptions(argc, argv)) { - cmake hcm; + cmake hcm(cmake::RoleInternal); hcm.SetHomeDirectory(""); hcm.SetHomeOutputDirectory(""); hcm.AddCMakePaths(); diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index ca824c0..0fa7aa5 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -40,7 +40,7 @@ cmCursesMainForm::cmCursesMainForm(std::vector<std::string> const& args, "Welcome to ccmake, curses based user interface for CMake."); this->HelpMessage.push_back(""); this->HelpMessage.push_back(s_ConstHelpMessage); - this->CMakeInstance = new cmake; + this->CMakeInstance = new cmake(cmake::RoleProject); this->CMakeInstance->SetCMakeEditCommand( cmSystemTools::GetCMakeCursesCommand()); diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index b955d77..7fa2ac6 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -59,7 +59,7 @@ int main(int argc, char** argv) doc.addCMakeStandardDocSections(); if (argc2 > 1 && doc.CheckOptions(argc2, argv2)) { // Construct and print requested documentation. - cmake hcm; + cmake hcm(cmake::RoleInternal); hcm.SetHomeDirectory(""); hcm.SetHomeOutputDirectory(""); hcm.AddCMakePaths(); diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 28820a6..d473d9b 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -27,7 +27,7 @@ QCMake::QCMake(QObject* p) cmSystemTools::SetStdoutCallback(QCMake::stdoutCallback, this); cmSystemTools::SetStderrCallback(QCMake::stderrCallback, this); - this->CMakeInstance = new cmake; + this->CMakeInstance = new cmake(cmake::RoleProject); this->CMakeInstance->SetCMakeEditCommand( cmSystemTools::GetCMakeGUICommand()); this->CMakeInstance->SetProgressCallback(QCMake::progressCallback, this); diff --git a/Source/cmBreakCommand.cxx b/Source/cmBreakCommand.cxx index 9bb6137..3772c6f 100644 --- a/Source/cmBreakCommand.cxx +++ b/Source/cmBreakCommand.cxx @@ -41,7 +41,7 @@ bool cmBreakCommand::InitialPass(std::vector<std::string> const& args, } } - status.SetBreakInvoked(true); + status.SetBreakInvoked(); if (!args.empty()) { bool issueMessage = true; diff --git a/Source/cmBreakCommand.h b/Source/cmBreakCommand.h index 8ce5ca2..0038883 100644 --- a/Source/cmBreakCommand.h +++ b/Source/cmBreakCommand.h @@ -33,11 +33,6 @@ public: cmExecutionStatus& status) CM_OVERRIDE; /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE { return "break"; } diff --git a/Source/cmBuildNameCommand.h b/Source/cmBuildNameCommand.h index 00f645a..9008c27 100644 --- a/Source/cmBuildNameCommand.h +++ b/Source/cmBuildNameCommand.h @@ -19,7 +19,6 @@ public: bool InitialPass(std::vector<std::string> const& args, cmExecutionStatus& status) CM_OVERRIDE; std::string GetName() const CM_OVERRIDE { return "build_name"; } - bool IsScriptable() const CM_OVERRIDE { return true; } }; #endif diff --git a/Source/cmCMakeHostSystemInformationCommand.h b/Source/cmCMakeHostSystemInformationCommand.h index fe148a3..4263e75 100644 --- a/Source/cmCMakeHostSystemInformationCommand.h +++ b/Source/cmCMakeHostSystemInformationCommand.h @@ -41,11 +41,6 @@ public: cmExecutionStatus& status) CM_OVERRIDE; /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE diff --git a/Source/cmCMakeMinimumRequired.h b/Source/cmCMakeMinimumRequired.h index 8db0860..d264675 100644 --- a/Source/cmCMakeMinimumRequired.h +++ b/Source/cmCMakeMinimumRequired.h @@ -33,11 +33,6 @@ public: cmExecutionStatus& status) CM_OVERRIDE; /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE { return "cmake_minimum_required"; } diff --git a/Source/cmCMakePolicyCommand.h b/Source/cmCMakePolicyCommand.h index 789e294..cc02169 100644 --- a/Source/cmCMakePolicyCommand.h +++ b/Source/cmCMakePolicyCommand.h @@ -34,11 +34,6 @@ public: cmExecutionStatus& status) CM_OVERRIDE; /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE { return "cmake_policy"; } diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 010221e..f469998 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -416,7 +416,7 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) } } - cmake cm; + cmake cm(cmake::RoleScript); cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); cm.GetCurrentSnapshot().SetDefaultDefinitions(); diff --git a/Source/cmCommand.h b/Source/cmCommand.h index 62eced0..2e2ba43 100644 --- a/Source/cmCommand.h +++ b/Source/cmCommand.h @@ -80,11 +80,6 @@ public: virtual cmCommand* Clone() = 0; /** - * This determines if the command is invoked when in script mode. - */ - virtual bool IsScriptable() const { return false; } - - /** * This determines if the command is defined in a cmake script. * It is the case for cmMacroHelperCommand and cmFunctionHelperCommand. */ diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx index 1576722..adf46ff 100644 --- a/Source/cmCommands.cxx +++ b/Source/cmCommands.cxx @@ -266,3 +266,64 @@ void GetProjectCommands(cmState* state) "The variable_requires command should not be called; see CMP0035.")); #endif } + +void GetProjectCommandsInScriptMode(cmState* state) +{ +#define CM_UNEXPECTED_PROJECT_COMMAND(NAME) \ + state->AddCommand(new cmUnexpectedCommand(NAME, "command is not " \ + "scriptable")) + + CM_UNEXPECTED_PROJECT_COMMAND("add_compile_options"); + CM_UNEXPECTED_PROJECT_COMMAND("add_custom_command"); + CM_UNEXPECTED_PROJECT_COMMAND("add_custom_target"); + CM_UNEXPECTED_PROJECT_COMMAND("add_definitions"); + CM_UNEXPECTED_PROJECT_COMMAND("add_dependencies"); + CM_UNEXPECTED_PROJECT_COMMAND("add_executable"); + CM_UNEXPECTED_PROJECT_COMMAND("add_library"); + CM_UNEXPECTED_PROJECT_COMMAND("add_subdirectory"); + CM_UNEXPECTED_PROJECT_COMMAND("add_test"); + CM_UNEXPECTED_PROJECT_COMMAND("aux_source_directory"); + CM_UNEXPECTED_PROJECT_COMMAND("build_command"); + CM_UNEXPECTED_PROJECT_COMMAND("create_test_sourcelist"); + CM_UNEXPECTED_PROJECT_COMMAND("define_property"); + CM_UNEXPECTED_PROJECT_COMMAND("enable_language"); + CM_UNEXPECTED_PROJECT_COMMAND("enable_testing"); + CM_UNEXPECTED_PROJECT_COMMAND("export"); + CM_UNEXPECTED_PROJECT_COMMAND("fltk_wrap_ui"); + CM_UNEXPECTED_PROJECT_COMMAND("get_source_file_property"); + CM_UNEXPECTED_PROJECT_COMMAND("get_target_property"); + CM_UNEXPECTED_PROJECT_COMMAND("get_test_property"); + CM_UNEXPECTED_PROJECT_COMMAND("include_directories"); + CM_UNEXPECTED_PROJECT_COMMAND("include_external_msproject"); + CM_UNEXPECTED_PROJECT_COMMAND("include_regular_expression"); + CM_UNEXPECTED_PROJECT_COMMAND("install"); + CM_UNEXPECTED_PROJECT_COMMAND("link_directories"); + CM_UNEXPECTED_PROJECT_COMMAND("link_libraries"); + CM_UNEXPECTED_PROJECT_COMMAND("load_cache"); + CM_UNEXPECTED_PROJECT_COMMAND("project"); + CM_UNEXPECTED_PROJECT_COMMAND("qt_wrap_cpp"); + CM_UNEXPECTED_PROJECT_COMMAND("qt_wrap_ui"); + CM_UNEXPECTED_PROJECT_COMMAND("remove_definitions"); + CM_UNEXPECTED_PROJECT_COMMAND("set_source_files_properties"); + CM_UNEXPECTED_PROJECT_COMMAND("set_target_properties"); + CM_UNEXPECTED_PROJECT_COMMAND("set_tests_properties"); + CM_UNEXPECTED_PROJECT_COMMAND("source_group"); + CM_UNEXPECTED_PROJECT_COMMAND("target_compile_definitions"); + CM_UNEXPECTED_PROJECT_COMMAND("target_compile_features"); + CM_UNEXPECTED_PROJECT_COMMAND("target_compile_options"); + CM_UNEXPECTED_PROJECT_COMMAND("target_include_directories"); + CM_UNEXPECTED_PROJECT_COMMAND("target_link_libraries"); + CM_UNEXPECTED_PROJECT_COMMAND("target_sources"); + CM_UNEXPECTED_PROJECT_COMMAND("try_compile"); + CM_UNEXPECTED_PROJECT_COMMAND("try_run"); + + // deprected commands + CM_UNEXPECTED_PROJECT_COMMAND("export_library_dependencies"); + CM_UNEXPECTED_PROJECT_COMMAND("load_command"); + CM_UNEXPECTED_PROJECT_COMMAND("output_required_files"); + CM_UNEXPECTED_PROJECT_COMMAND("subdir_depends"); + CM_UNEXPECTED_PROJECT_COMMAND("utility_source"); + CM_UNEXPECTED_PROJECT_COMMAND("variable_requires"); + +#undef CM_UNEXPECTED_PROJECT_COMMAND +} diff --git a/Source/cmCommands.h b/Source/cmCommands.h index 7895ece..1f8fafb 100644 --- a/Source/cmCommands.h +++ b/Source/cmCommands.h @@ -12,5 +12,6 @@ class cmState; */ void GetScriptingCommands(cmState* state); void GetProjectCommands(cmState* state); +void GetProjectCommandsInScriptMode(cmState* state); #endif diff --git a/Source/cmConfigureFileCommand.h b/Source/cmConfigureFileCommand.h index 882219d..402423d 100644 --- a/Source/cmConfigureFileCommand.h +++ b/Source/cmConfigureFileCommand.h @@ -30,11 +30,6 @@ public: */ std::string GetName() const CM_OVERRIDE { return "configure_file"; } - /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - private: int ConfigureFile(); diff --git a/Source/cmContinueCommand.cxx b/Source/cmContinueCommand.cxx index 53d035d..2298a05 100644 --- a/Source/cmContinueCommand.cxx +++ b/Source/cmContinueCommand.cxx @@ -19,7 +19,7 @@ bool cmContinueCommand::InitialPass(std::vector<std::string> const& args, return true; } - status.SetContinueInvoked(true); + status.SetContinueInvoked(); if (!args.empty()) { this->Makefile->IssueMessage(cmake::FATAL_ERROR, diff --git a/Source/cmContinueCommand.h b/Source/cmContinueCommand.h index 4428d79..4b416a4 100644 --- a/Source/cmContinueCommand.h +++ b/Source/cmContinueCommand.h @@ -33,11 +33,6 @@ public: cmExecutionStatus& status) CM_OVERRIDE; /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE { return "continue"; } diff --git a/Source/cmDisallowedCommand.h b/Source/cmDisallowedCommand.h index 7c141dd..38d1d93 100644 --- a/Source/cmDisallowedCommand.h +++ b/Source/cmDisallowedCommand.h @@ -42,11 +42,6 @@ public: return this->Command->HasFinalPass(); } - bool IsScriptable() const CM_OVERRIDE - { - return this->Command->IsScriptable(); - } - std::string GetName() const CM_OVERRIDE { return this->Command->GetName(); } private: diff --git a/Source/cmExecProgramCommand.h b/Source/cmExecProgramCommand.h index 53d35cf..2a59612 100644 --- a/Source/cmExecProgramCommand.h +++ b/Source/cmExecProgramCommand.h @@ -41,11 +41,6 @@ public: */ std::string GetName() const CM_OVERRIDE { return "exec_program"; } - /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - private: static bool RunCommand(const char* command, std::string& output, int& retVal, const char* directory = CM_NULLPTR, diff --git a/Source/cmExecuteProcessCommand.h b/Source/cmExecuteProcessCommand.h index 65e16d4..e57e22d 100644 --- a/Source/cmExecuteProcessCommand.h +++ b/Source/cmExecuteProcessCommand.h @@ -37,11 +37,6 @@ public: * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE { return "execute_process"; } - - /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } }; #endif diff --git a/Source/cmExecutionStatus.h b/Source/cmExecutionStatus.h index fd3c416..ac5fe1d 100644 --- a/Source/cmExecutionStatus.h +++ b/Source/cmExecutionStatus.h @@ -11,16 +11,13 @@ class cmExecutionStatus { public: - cmExecutionStatus() { this->Clear(); } - - void SetReturnInvoked(bool val) { this->ReturnInvoked = val; } - bool GetReturnInvoked() { return this->ReturnInvoked; } - - void SetBreakInvoked(bool val) { this->BreakInvoked = val; } - bool GetBreakInvoked() { return this->BreakInvoked; } - - void SetContinueInvoked(bool val) { this->ContinueInvoked = val; } - bool GetContinueInvoked() { return this->ContinueInvoked; } + cmExecutionStatus() + : ReturnInvoked(false) + , BreakInvoked(false) + , ContinueInvoked(false) + , NestedError(false) + { + } void Clear() { @@ -29,8 +26,18 @@ public: this->ContinueInvoked = false; this->NestedError = false; } - void SetNestedError(bool val) { this->NestedError = val; } - bool GetNestedError() { return this->NestedError; } + + void SetReturnInvoked() { this->ReturnInvoked = true; } + bool GetReturnInvoked() const { return this->ReturnInvoked; } + + void SetBreakInvoked() { this->BreakInvoked = true; } + bool GetBreakInvoked() const { return this->BreakInvoked; } + + void SetContinueInvoked() { this->ContinueInvoked = true; } + bool GetContinueInvoked() const { return this->ContinueInvoked; } + + void SetNestedError() { this->NestedError = true; } + bool GetNestedError() const { return this->NestedError; } private: bool ReturnInvoked; diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h index 121fec0..ff0b35e 100644 --- a/Source/cmFileCommand.h +++ b/Source/cmFileCommand.h @@ -32,11 +32,6 @@ public: cmExecutionStatus& status) CM_OVERRIDE; /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE { return "file"; } diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx index 110195c..6ffbb6e 100644 --- a/Source/cmFindCommon.cxx +++ b/Source/cmFindCommon.cxx @@ -334,15 +334,3 @@ void cmFindCommon::ComputeFinalPaths() std::for_each(this->SearchPaths.begin(), this->SearchPaths.end(), &AddTrailingSlash); } - -void cmFindCommon::SetMakefile(cmMakefile* makefile) -{ - cmCommand::SetMakefile(makefile); - - // If we are building for Apple (OSX or also iphone), make sure - // that frameworks and bundles are searched first. - if (this->Makefile->IsOn("APPLE")) { - this->SearchFrameworkFirst = true; - this->SearchAppBundleFirst = true; - } -} diff --git a/Source/cmFindCommon.h b/Source/cmFindCommon.h index 426d233..bbb7a38 100644 --- a/Source/cmFindCommon.h +++ b/Source/cmFindCommon.h @@ -14,8 +14,6 @@ #include "cmPathLabel.h" #include "cmSearchPath.h" -class cmMakefile; - /** \class cmFindCommon * \brief Base class for FIND_XXX implementations. * @@ -105,7 +103,6 @@ protected: bool CheckCommonArgument(std::string const& arg); void AddPathSuffix(std::string const& arg); - void SetMakefile(cmMakefile* makefile); bool NoDefaultPath; bool NoCMakePath; diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h index 4a60505..41af976 100644 --- a/Source/cmFindLibraryCommand.h +++ b/Source/cmFindLibraryCommand.h @@ -37,11 +37,6 @@ public: cmExecutionStatus& status) CM_OVERRIDE; /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE { return "find_library"; } diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h index c42ecce..e4ecfad 100644 --- a/Source/cmFindPackageCommand.h +++ b/Source/cmFindPackageCommand.h @@ -61,11 +61,6 @@ public: cmExecutionStatus& status) CM_OVERRIDE; /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE { return "find_package"; } diff --git a/Source/cmFindPathCommand.h b/Source/cmFindPathCommand.h index 205bb17..92849c3 100644 --- a/Source/cmFindPathCommand.h +++ b/Source/cmFindPathCommand.h @@ -37,11 +37,6 @@ public: cmExecutionStatus& status) CM_OVERRIDE; /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE { return "find_path"; } diff --git a/Source/cmFindProgramCommand.h b/Source/cmFindProgramCommand.h index 73894ba..af56aef 100644 --- a/Source/cmFindProgramCommand.h +++ b/Source/cmFindProgramCommand.h @@ -38,11 +38,6 @@ public: cmExecutionStatus& status) CM_OVERRIDE; /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE { return "find_program"; } diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx index 6273f6e..8346b23 100644 --- a/Source/cmForEachCommand.cxx +++ b/Source/cmForEachCommand.cxx @@ -58,7 +58,7 @@ bool cmForEachFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff, status.Clear(); mf.ExecuteCommand(this->Functions[c], status); if (status.GetReturnInvoked()) { - inStatus.SetReturnInvoked(true); + inStatus.SetReturnInvoked(); // restore the variable to its prior value mf.AddDefinition(this->Args[0], oldDef.c_str()); return true; diff --git a/Source/cmForEachCommand.h b/Source/cmForEachCommand.h index c71b905..30f0342 100644 --- a/Source/cmForEachCommand.h +++ b/Source/cmForEachCommand.h @@ -49,11 +49,6 @@ public: cmExecutionStatus& status) CM_OVERRIDE; /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE { return "foreach"; } diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index 31adcb7..dccc29f 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -40,11 +40,6 @@ public: } /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ @@ -126,7 +121,7 @@ bool cmFunctionHelperCommand::InvokeInitialPass( // The error message should have already included the call stack // so we do not need to report an error here. functionScope.Quiet(); - inStatus.SetNestedError(true); + inStatus.SetNestedError(); return false; } if (status.GetReturnInvoked()) { diff --git a/Source/cmFunctionCommand.h b/Source/cmFunctionCommand.h index d6cc18e..fa13aa4 100644 --- a/Source/cmFunctionCommand.h +++ b/Source/cmFunctionCommand.h @@ -46,11 +46,6 @@ public: cmExecutionStatus& status) CM_OVERRIDE; /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE { return "function"; } diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 3f50e32..073bde2 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -489,7 +489,9 @@ bool cmGeneratorTarget::IsIPOEnabled(const std::string& config) const // problem is already reported, no need to issue a message return false; } - if (cmp0069 == cmPolicies::WARN) { + const bool in_try_compile = + this->LocalGenerator->GetCMakeInstance()->GetIsInTryCompile(); + if (cmp0069 == cmPolicies::WARN && !in_try_compile) { std::ostringstream w; w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0069) << "\n"; w << "INTERPROCEDURAL_OPTIMIZATION property will be ignored for target " diff --git a/Source/cmGetCMakePropertyCommand.h b/Source/cmGetCMakePropertyCommand.h index c454e34..b0ddb22 100644 --- a/Source/cmGetCMakePropertyCommand.h +++ b/Source/cmGetCMakePropertyCommand.h @@ -25,11 +25,6 @@ public: cmExecutionStatus& status) CM_OVERRIDE; /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE { return "get_cmake_property"; } diff --git a/Source/cmGetDirectoryPropertyCommand.h b/Source/cmGetDirectoryPropertyCommand.h index 0adf818..f91a466 100644 --- a/Source/cmGetDirectoryPropertyCommand.h +++ b/Source/cmGetDirectoryPropertyCommand.h @@ -25,11 +25,6 @@ public: cmExecutionStatus& status) CM_OVERRIDE; /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE { return "get_directory_property"; } diff --git a/Source/cmGetFilenameComponentCommand.h b/Source/cmGetFilenameComponentCommand.h index efc9d7b..cf64564 100644 --- a/Source/cmGetFilenameComponentCommand.h +++ b/Source/cmGetFilenameComponentCommand.h @@ -34,11 +34,6 @@ public: cmExecutionStatus& status) CM_OVERRIDE; /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE { return "get_filename_component"; } diff --git a/Source/cmGetPropertyCommand.h b/Source/cmGetPropertyCommand.h index a57c675..7bbcec0 100644 --- a/Source/cmGetPropertyCommand.h +++ b/Source/cmGetPropertyCommand.h @@ -27,11 +27,6 @@ public: cmExecutionStatus& status) CM_OVERRIDE; /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE { return "get_property"; } diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 587e18a..d9a8cab 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -1903,7 +1903,7 @@ int cmcmd_cmake_ninja_dyndep(std::vector<std::string>::const_iterator argBeg, } } - cmake cm; + cmake cm(cmake::RoleInternal); cm.SetHomeDirectory(dir_top_src); cm.SetHomeOutputDirectory(dir_top_bld); CM_AUTO_PTR<cmGlobalNinjaGenerator> ggd( diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index ee9e47a..0e02b0a 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -647,9 +647,9 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf) xw.EndElement(); // ItemGroup xw.StartElement("PropertyGroup"); xw.Attribute("Label", "Globals"); - xw.StartElement("ProjectGUID"); + xw.StartElement("ProjectGuid"); xw.Content("{F3FC6D86-508D-3FB1-96D2-995F08B142EC}"); - xw.EndElement(); // ProjectGUID + xw.EndElement(); // ProjectGuid xw.StartElement("Keyword"); xw.Content("Win32Proj"); xw.EndElement(); // Keyword diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index 1fcd3cb..7e953ce 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -61,7 +61,7 @@ cmGraphVizWriter::cmGraphVizWriter( void cmGraphVizWriter::ReadSettings(const char* settingsFileName, const char* fallbackSettingsFileName) { - cmake cm; + cmake cm(cmake::RoleScript); cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); cm.GetCurrentSnapshot().SetDefaultDefinitions(); diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index 421c3dd..0972664 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -137,15 +137,15 @@ bool cmIfFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff, status.Clear(); mf.ExecuteCommand(this->Functions[c], status); if (status.GetReturnInvoked()) { - inStatus.SetReturnInvoked(true); + inStatus.SetReturnInvoked(); return true; } if (status.GetBreakInvoked()) { - inStatus.SetBreakInvoked(true); + inStatus.SetBreakInvoked(); return true; } if (status.GetContinueInvoked()) { - inStatus.SetContinueInvoked(true); + inStatus.SetContinueInvoked(); return true; } } diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h index 59d32e6..c6c44cb 100644 --- a/Source/cmIfCommand.h +++ b/Source/cmIfCommand.h @@ -69,11 +69,6 @@ public: */ std::string GetName() const CM_OVERRIDE { return "if"; } - /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - // Filter the given variable definition based on policy CMP0054. static const char* GetDefinitionIfUnquoted( const cmMakefile* mf, cmExpandedCommandArgument const& argument); diff --git a/Source/cmIncludeCommand.h b/Source/cmIncludeCommand.h index 06200cd..5a37800 100644 --- a/Source/cmIncludeCommand.h +++ b/Source/cmIncludeCommand.h @@ -34,11 +34,6 @@ public: cmExecutionStatus& status) CM_OVERRIDE; /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE { return "include"; } diff --git a/Source/cmListCommand.h b/Source/cmListCommand.h index 8d4aeb1..7272ea1 100644 --- a/Source/cmListCommand.h +++ b/Source/cmListCommand.h @@ -32,11 +32,6 @@ public: cmExecutionStatus& status) CM_OVERRIDE; /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE { return "list"; } diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index e0e3e54..124bd80 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -322,7 +322,13 @@ std::string cmLocalNinjaGenerator::BuildCommandLine( } else if (cmdLines.size() > 1) { cmd << "cmd.exe /C \""; } - cmd << *li; + // Put current cmdLine in brackets if it contains "||" because it has + // higher precedence than "&&" in cmd.exe + if (li->find("||") != std::string::npos) { + cmd << "( " << *li << " )"; + } else { + cmd << *li; + } } if (cmdLines.size() > 1) { cmd << "\""; diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 583f801..507b579 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -41,11 +41,6 @@ public: } /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ @@ -156,15 +151,15 @@ bool cmMacroHelperCommand::InvokeInitialPass( // The error message should have already included the call stack // so we do not need to report an error here. macroScope.Quiet(); - inStatus.SetNestedError(true); + inStatus.SetNestedError(); return false; } if (status.GetReturnInvoked()) { - inStatus.SetReturnInvoked(true); + inStatus.SetReturnInvoked(); return true; } if (status.GetBreakInvoked()) { - inStatus.SetBreakInvoked(true); + inStatus.SetBreakInvoked(); return true; } } diff --git a/Source/cmMacroCommand.h b/Source/cmMacroCommand.h index f0020ff..fd9c92b 100644 --- a/Source/cmMacroCommand.h +++ b/Source/cmMacroCommand.h @@ -46,11 +46,6 @@ public: cmExecutionStatus& status) CM_OVERRIDE; /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE { return "macro"; } diff --git a/Source/cmMakeDirectoryCommand.h b/Source/cmMakeDirectoryCommand.h index 54f4ab3..e2f0932 100644 --- a/Source/cmMakeDirectoryCommand.h +++ b/Source/cmMakeDirectoryCommand.h @@ -40,11 +40,6 @@ public: * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE { return "make_directory"; } - - /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } }; #endif diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index cb11060..5af0084 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -118,7 +118,7 @@ void cmMakefile::IssueMessage(cmake::MessageType t, { if (!this->ExecutionStatusStack.empty()) { if ((t == cmake::FATAL_ERROR) || (t == cmake::INTERNAL_ERROR)) { - this->ExecutionStatusStack.back()->SetNestedError(true); + this->ExecutionStatusStack.back()->SetNestedError(); } } this->GetCMakeInstance()->IssueMessage(t, text, this->GetBacktrace()); @@ -272,11 +272,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, pcmd->SetMakefile(this); // Decide whether to invoke the command. - if (!cmSystemTools::GetFatalErrorOccured() && - (this->GetCMakeInstance()->GetWorkingMode() != cmake::SCRIPT_MODE || - pcmd->IsScriptable())) - - { + if (!cmSystemTools::GetFatalErrorOccured()) { // if trace is enabled, print out invoke information if (this->GetCMakeInstance()->GetTrace()) { this->PrintCommandTrace(lff); @@ -298,15 +294,6 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, // use the command this->FinalPassCommands.push_back(pcmd.release()); } - } else if (this->GetCMakeInstance()->GetWorkingMode() == - cmake::SCRIPT_MODE && - !pcmd->IsScriptable()) { - std::string error = "Command "; - error += pcmd->GetName(); - error += "() is not scriptable"; - this->IssueMessage(cmake::FATAL_ERROR, error); - result = false; - cmSystemTools::SetFatalErrorOccured(); } } else { if (!cmSystemTools::GetFatalErrorOccured()) { @@ -3187,7 +3174,7 @@ int cmMakefile::TryCompile(const std::string& srcdir, // make sure the same generator is used // use this program as the cmake to be run, it should not // be run that way but the cmake object requires a vailid path - cmake cm; + cmake cm(cmake::RoleProject); cm.SetIsInTryCompile(true); cmGlobalGenerator* gg = cm.CreateGlobalGenerator(this->GetGlobalGenerator()->GetName()); diff --git a/Source/cmMarkAsAdvancedCommand.h b/Source/cmMarkAsAdvancedCommand.h index 8c2f85b..4f80746 100644 --- a/Source/cmMarkAsAdvancedCommand.h +++ b/Source/cmMarkAsAdvancedCommand.h @@ -36,14 +36,6 @@ public: * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE { return "mark_as_advanced"; } - - /** - * This determines if the command is invoked when in script mode. - * mark_as_advanced() will have no effect in script mode, but this will - * make many of the modules usable in cmake/ctest scripts, (among them - * FindUnixMake.cmake used by the CTEST_BUILD command. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } }; #endif diff --git a/Source/cmMathCommand.h b/Source/cmMathCommand.h index 496d836..ef0eb4a 100644 --- a/Source/cmMathCommand.h +++ b/Source/cmMathCommand.h @@ -29,11 +29,6 @@ public: cmExecutionStatus& status) CM_OVERRIDE; /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE { return "math"; } diff --git a/Source/cmMessageCommand.h b/Source/cmMessageCommand.h index ca83ed6..fd2dbe7 100644 --- a/Source/cmMessageCommand.h +++ b/Source/cmMessageCommand.h @@ -35,11 +35,6 @@ public: * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE { return "message"; } - - /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } }; #endif diff --git a/Source/cmOptionCommand.h b/Source/cmOptionCommand.h index 86fa41f..0227357 100644 --- a/Source/cmOptionCommand.h +++ b/Source/cmOptionCommand.h @@ -36,11 +36,6 @@ public: * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE { return "option"; } - - /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } }; #endif diff --git a/Source/cmParseArgumentsCommand.h b/Source/cmParseArgumentsCommand.h index 4d9416d..f3de5b6 100644 --- a/Source/cmParseArgumentsCommand.h +++ b/Source/cmParseArgumentsCommand.h @@ -31,11 +31,6 @@ public: cmExecutionStatus& status) CM_OVERRIDE; /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE { return "cmake_parse_arguments"; } diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index eec1fc6..7461a0a 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -286,7 +286,7 @@ cmQtAutoGenerators::cmQtAutoGenerators() bool cmQtAutoGenerators::Run(const std::string& targetDirectory, const std::string& config) { - cmake cm; + cmake cm(cmake::RoleScript); cm.SetHomeOutputDirectory(targetDirectory); cm.SetHomeDirectory(targetDirectory); cm.GetCurrentSnapshot().SetDefaultDefinitions(); diff --git a/Source/cmRemoveCommand.h b/Source/cmRemoveCommand.h index 38223a5..84e591d 100644 --- a/Source/cmRemoveCommand.h +++ b/Source/cmRemoveCommand.h @@ -33,11 +33,6 @@ public: cmExecutionStatus& status) CM_OVERRIDE; /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE { return "remove"; } diff --git a/Source/cmReturnCommand.cxx b/Source/cmReturnCommand.cxx index f8b3129..ceea8b4 100644 --- a/Source/cmReturnCommand.cxx +++ b/Source/cmReturnCommand.cxx @@ -8,6 +8,6 @@ bool cmReturnCommand::InitialPass(std::vector<std::string> const&, cmExecutionStatus& status) { - status.SetReturnInvoked(true); + status.SetReturnInvoked(); return true; } diff --git a/Source/cmReturnCommand.h b/Source/cmReturnCommand.h index ceed6b5..a4a6283 100644 --- a/Source/cmReturnCommand.h +++ b/Source/cmReturnCommand.h @@ -33,11 +33,6 @@ public: cmExecutionStatus& status) CM_OVERRIDE; /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE { return "return"; } diff --git a/Source/cmSeparateArgumentsCommand.h b/Source/cmSeparateArgumentsCommand.h index 7edde48..e4df5da 100644 --- a/Source/cmSeparateArgumentsCommand.h +++ b/Source/cmSeparateArgumentsCommand.h @@ -33,11 +33,6 @@ public: cmExecutionStatus& status) CM_OVERRIDE; /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE { return "separate_arguments"; } diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index 4e9e80f..defba77 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -215,7 +215,7 @@ bool cmServerProtocol::Activate(cmServer* server, { assert(server); this->m_Server = server; - this->m_CMakeInstance = std::make_unique<cmake>(); + this->m_CMakeInstance = std::make_unique<cmake>(cmake::RoleProject); const bool result = this->DoActivate(request, errorMessage); if (!result) { this->m_CMakeInstance = CM_NULLPTR; diff --git a/Source/cmSetCommand.h b/Source/cmSetCommand.h index 1c67bf9..e3a3175 100644 --- a/Source/cmSetCommand.h +++ b/Source/cmSetCommand.h @@ -33,11 +33,6 @@ public: cmExecutionStatus& status) CM_OVERRIDE; /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE { return "set"; } diff --git a/Source/cmSetDirectoryPropertiesCommand.h b/Source/cmSetDirectoryPropertiesCommand.h index e04de6e..4657b66 100644 --- a/Source/cmSetDirectoryPropertiesCommand.h +++ b/Source/cmSetDirectoryPropertiesCommand.h @@ -29,11 +29,6 @@ public: cmExecutionStatus& status) CM_OVERRIDE; /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE diff --git a/Source/cmSetPropertyCommand.h b/Source/cmSetPropertyCommand.h index 3657f63..7f5c977 100644 --- a/Source/cmSetPropertyCommand.h +++ b/Source/cmSetPropertyCommand.h @@ -36,11 +36,6 @@ public: */ std::string GetName() const CM_OVERRIDE { return "set_property"; } - /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - private: std::set<std::string> Names; std::string PropertyName; diff --git a/Source/cmSiteNameCommand.h b/Source/cmSiteNameCommand.h index c7425f6..e133c6c 100644 --- a/Source/cmSiteNameCommand.h +++ b/Source/cmSiteNameCommand.h @@ -33,11 +33,6 @@ public: cmExecutionStatus& status) CM_OVERRIDE; /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE { return "site_name"; } diff --git a/Source/cmState.cxx b/Source/cmState.cxx index aca0358..43f439c 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -410,21 +410,6 @@ void cmState::AddCommand(cmCommand* command) this->Commands.insert(std::make_pair(name, command)); } -void cmState::RemoveUnscriptableCommands() -{ - std::vector<std::string> unscriptableCommands; - for (std::map<std::string, cmCommand*>::iterator pos = - this->Commands.begin(); - pos != this->Commands.end();) { - if (!pos->second->IsScriptable()) { - delete pos->second; - this->Commands.erase(pos++); - } else { - ++pos; - } - } -} - cmCommand* cmState::GetCommand(std::string const& name) const { cmCommand* command = CM_NULLPTR; diff --git a/Source/cmState.h b/Source/cmState.h index d2af5ce..240d75b 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -121,7 +121,6 @@ public: cmCommand* GetCommand(std::string const& name) const; void AddCommand(cmCommand* command); - void RemoveUnscriptableCommands(); void RenameCommand(std::string const& oldName, std::string const& newName); void RemoveUserDefinedCommands(); std::vector<std::string> GetCommandNames() const; diff --git a/Source/cmStringCommand.h b/Source/cmStringCommand.h index 89ecb12..dc3ce5a 100644 --- a/Source/cmStringCommand.h +++ b/Source/cmStringCommand.h @@ -32,11 +32,6 @@ public: cmExecutionStatus& status) CM_OVERRIDE; /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE { return "string"; } diff --git a/Source/cmUnexpectedCommand.h b/Source/cmUnexpectedCommand.h index aee5d4d..1605997 100644 --- a/Source/cmUnexpectedCommand.h +++ b/Source/cmUnexpectedCommand.h @@ -29,8 +29,6 @@ public: bool InitialPass(std::vector<std::string> const& args, cmExecutionStatus& status) CM_OVERRIDE; - bool IsScriptable() const CM_OVERRIDE { return true; } - std::string GetName() const CM_OVERRIDE { return this->Name; } private: diff --git a/Source/cmUnsetCommand.h b/Source/cmUnsetCommand.h index 7e0f5b5..d60bd3e 100644 --- a/Source/cmUnsetCommand.h +++ b/Source/cmUnsetCommand.h @@ -33,11 +33,6 @@ public: cmExecutionStatus& status) CM_OVERRIDE; /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE { return "unset"; } diff --git a/Source/cmUseMangledMesaCommand.h b/Source/cmUseMangledMesaCommand.h index e8bd8c6..104614a 100644 --- a/Source/cmUseMangledMesaCommand.h +++ b/Source/cmUseMangledMesaCommand.h @@ -19,7 +19,6 @@ public: bool InitialPass(std::vector<std::string> const& args, cmExecutionStatus& status) CM_OVERRIDE; std::string GetName() const CM_OVERRIDE { return "use_mangled_mesa"; } - bool IsScriptable() const CM_OVERRIDE { return true; } protected: void CopyAndFullPathMesaHeader(const char* source, const char* outdir); }; diff --git a/Source/cmVariableWatchCommand.h b/Source/cmVariableWatchCommand.h index 7096ed5..ca338e6 100644 --- a/Source/cmVariableWatchCommand.h +++ b/Source/cmVariableWatchCommand.h @@ -38,11 +38,6 @@ public: bool InitialPass(std::vector<std::string> const& args, cmExecutionStatus& status) CM_OVERRIDE; - /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - /** This command does not really have a final pass but it needs to stay alive since it owns variable watch callback information. */ bool HasFinalPass() const CM_OVERRIDE { return true; } diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index c81ba7a..4fcf5dc 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -297,8 +297,8 @@ void cmVisualStudio10TargetGenerator::Generate() this->WriteProjectConfigurations(); } this->WriteString("<PropertyGroup Label=\"Globals\">\n", 1); - this->WriteString("<ProjectGUID>", 2); - (*this->BuildFileStream) << "{" << this->GUID << "}</ProjectGUID>\n"; + this->WriteString("<ProjectGuid>", 2); + (*this->BuildFileStream) << "{" << this->GUID << "}</ProjectGuid>\n"; if (this->MSTools && this->GeneratorTarget->GetType() <= cmStateEnums::GLOBAL_TARGET) { diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx index 38ea637..24d7bf1 100644 --- a/Source/cmWhileCommand.cxx +++ b/Source/cmWhileCommand.cxx @@ -82,7 +82,7 @@ bool cmWhileFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff, cmExecutionStatus status; mf.ExecuteCommand(this->Functions[c], status); if (status.GetReturnInvoked()) { - inStatus.SetReturnInvoked(true); + inStatus.SetReturnInvoked(); return true; } if (status.GetBreakInvoked()) { diff --git a/Source/cmWhileCommand.h b/Source/cmWhileCommand.h index daf1046..d353063 100644 --- a/Source/cmWhileCommand.h +++ b/Source/cmWhileCommand.h @@ -59,11 +59,6 @@ public: } /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE { return "while"; } diff --git a/Source/cmWriteFileCommand.h b/Source/cmWriteFileCommand.h index 7196ccf..aea8653 100644 --- a/Source/cmWriteFileCommand.h +++ b/Source/cmWriteFileCommand.h @@ -32,11 +32,6 @@ public: cmExecutionStatus& status) CM_OVERRIDE; /** - * This determines if the command is invoked when in script mode. - */ - bool IsScriptable() const CM_OVERRIDE { return true; } - - /** * The name of the command as specified in CMakeList.txt. */ std::string GetName() const CM_OVERRIDE { return "write_file"; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 737587d..53e9ab0 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -136,7 +136,7 @@ void cmWarnUnusedCliWarning(const std::string& variable, int /*unused*/, cm->MarkCliAsUsed(variable); } -cmake::cmake() +cmake::cmake(Role role) { this->Trace = false; this->TraceExpand = false; @@ -174,8 +174,12 @@ cmake::cmake() this->AddDefaultGenerators(); this->AddDefaultExtraGenerators(); - this->AddScriptingCommands(); - this->AddProjectCommands(); + if (role == RoleScript || role == RoleProject) { + this->AddScriptingCommands(); + } + if (role == RoleProject) { + this->AddProjectCommands(); + } // Make sure we can capture the build tool output. cmSystemTools::EnableVSConsoleOutput(); @@ -443,6 +447,8 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args) cmSystemTools::Error("No cmake script provided."); return false; } + // Register fake project commands that hint misuse in script mode. + GetProjectCommandsInScriptMode(this->State); this->ReadListFile(args, path.c_str()); } else if (arg.find("--find-package", 0) == 0) { findPackageMode = true; @@ -1888,7 +1894,7 @@ int cmake::CheckBuildSystem() // Read the rerun check file and use it to decide whether to do the // global generate. - cmake cm; + cmake cm(RoleScript); // Actually, all we need is the `set` command. cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); cm.GetCurrentSnapshot().SetDefaultDefinitions(); @@ -2419,6 +2425,9 @@ int cmake::Build(const std::string& dir, const std::string& target, std::string homeOutputOrig = this->GetHomeOutputDirectory(); this->SetDirectoriesFromFile(cachePath.c_str()); + this->AddScriptingCommands(); + this->AddProjectCommands(); + int ret = this->Configure(); if (ret) { cmSystemTools::Message("CMake Configure step failed. " diff --git a/Source/cmake.h b/Source/cmake.h index 16a2830..4ddacf7 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -58,6 +58,13 @@ class cmake CM_DISABLE_COPY(cmake) public: + enum Role + { + RoleInternal, // no commands + RoleScript, // script commands + RoleProject // all commands + }; + enum MessageType { AUTHOR_WARNING, @@ -112,7 +119,7 @@ public: typedef std::map<std::string, cmInstalledFile> InstalledFilesMap; /// Default constructor - cmake(); + cmake(Role role); /// Destructor ~cmake(); diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 3d11241..f472b8a 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -201,7 +201,7 @@ int do_cmake(int ac, char const* const* av) doc.addCMakeStandardDocSections(); if (doc.CheckOptions(ac, av)) { // Construct and print requested documentation. - cmake hcm; + cmake hcm(cmake::RoleInternal); hcm.SetHomeDirectory(""); hcm.SetHomeOutputDirectory(""); hcm.AddCMakePaths(); @@ -283,13 +283,13 @@ int do_cmake(int ac, char const* const* av) } } if (sysinfo) { - cmake cm; + cmake cm(cmake::RoleProject); cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); int ret = cm.GetSystemInformation(args); return ret; } - cmake cm; + cmake cm(cmake::RoleProject); cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); cmSystemTools::SetMessageCallback(cmakemainMessageCallback, (void*)&cm); @@ -407,7 +407,7 @@ static int do_build(int ac, char const* const* av) return 1; } - cmake cm; + cmake cm(cmake::RoleInternal); cmSystemTools::SetMessageCallback(cmakemainMessageCallback, (void*)&cm); cm.SetProgressCallback(cmakemainProgressCallback, (void*)&cm); return cm.Build(dir, target, config, nativeOptions, clean); diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index cc954e6..dc267e7 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -583,7 +583,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) std::cerr << "-E capabilities accepts no additional arguments\n"; return 1; } - cmake cm; + cmake cm(cmake::RoleInternal); #if defined(HAVE_SERVER_MODE) && HAVE_SERVER_MODE std::cout << cm.ReportCapabilities(true); #else @@ -760,7 +760,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) const bool verbose = isCMakeVerbose(); // Create a cmake object instance to process dependencies. - cmake cm; + cmake cm(cmake::RoleScript); // All we need is the `set` command. std::string gen; std::string homeDir; std::string startDir; diff --git a/Source/ctest.cxx b/Source/ctest.cxx index 15d4cf4..84e815d 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -7,7 +7,6 @@ #include "cmCTest.h" #include "cmDocumentation.h" #include "cmSystemTools.h" -#include "cmake.h" #include "cmsys/Encoding.hxx" #if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE) @@ -170,11 +169,6 @@ int main(int argc, char const* const* argv) cmDocumentation doc; doc.addCTestStandardDocSections(); if (doc.CheckOptions(argc, argv)) { - cmake hcm; - hcm.SetHomeDirectory(""); - hcm.SetHomeOutputDirectory(""); - hcm.AddCMakePaths(); - // Construct and print requested documentation. cmCTestScriptHandler* ch = static_cast<cmCTestScriptHandler*>(inst.GetHandler("script")); diff --git a/Templates/TestDriver.cxx.in b/Templates/TestDriver.cxx.in index ecf6fa1..0d3f44f 100644 --- a/Templates/TestDriver.cxx.in +++ b/Templates/TestDriver.cxx.in @@ -40,7 +40,7 @@ static const int NumTests = static char* lowercase(const char* string) { char *new_string, *p; - size_t stringSize = 0; + size_t stringSize; stringSize = CM_CAST(size_t, strlen(string) + 1); new_string = CM_CAST(char*, malloc(sizeof(char) * stringSize)); diff --git a/Tests/FindMPI/Test/CMakeLists.txt b/Tests/FindMPI/Test/CMakeLists.txt index 6f177f9..3910c25 100644 --- a/Tests/FindMPI/Test/CMakeLists.txt +++ b/Tests/FindMPI/Test/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.8) -project(TestFindMPI) +project(TestFindMPI NONE) include(CTest) macro(source_code_mapper_helper LANG_NAME) diff --git a/Tests/FindOpenMP/Test/CMakeLists.txt b/Tests/FindOpenMP/Test/CMakeLists.txt index 6313ef6..2692947 100644 --- a/Tests/FindOpenMP/Test/CMakeLists.txt +++ b/Tests/FindOpenMP/Test/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.8) -project(TestFindOpenMP) +project(TestFindOpenMP NONE) include(CTest) macro(source_code_mapper_helper LANG_NAME SRC_FILE_NAME) diff --git a/Tests/RunCMake/Ninja/CommandConcat.cmake b/Tests/RunCMake/Ninja/CommandConcat.cmake new file mode 100644 index 0000000..790cf9d --- /dev/null +++ b/Tests/RunCMake/Ninja/CommandConcat.cmake @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.7) +project(concat_cmd NONE) +set(output1 ${CMAKE_BINARY_DIR}/out1.txt) +set(output2 ${CMAKE_BINARY_DIR}/out2.txt) +file(REMOVE ${output1} ${output2}) +# Check that second command runs if first command contains "||" which has higher precedence than "&&" on Windows +add_custom_target(concat_cmd ALL + COMMAND ${CMAKE_COMMAND} -E echo "Hello || pipe world" && ${CMAKE_COMMAND} -E touch ${output1} || exit 1 + COMMAND ${CMAKE_COMMAND} -E touch ${output2}) +# Check output +add_custom_target(check_output ALL + COMMAND ${CMAKE_COMMAND} -E copy ${output1} ${output1}.copy + COMMAND ${CMAKE_COMMAND} -E copy ${output2} ${output2}.copy) +add_dependencies(check_output concat_cmd) diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake index 8c3bc20..b3720fb 100644 --- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake +++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake @@ -40,6 +40,16 @@ run_CMP0058(NEW-by) run_cmake(CustomCommandDepfile) +function(run_CommandConcat) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CommandConcat-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(CommandConcat) + run_cmake_command(CommandConcat-build ${CMAKE_COMMAND} --build .) +endfunction() +run_CommandConcat() + function(run_SubDir) # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/SubDir-build) @@ -1454,8 +1454,6 @@ for a in ${CMAKE_CXX_SOURCES}; do echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile" echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} ${src_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile" done -echo "cmBootstrapCommands1.o : $cmBootstrapCommands1Deps" >> "${cmake_bootstrap_dir}/Makefile" -echo "cmBootstrapCommands2.o : $cmBootstrapCommands2Deps" >> "${cmake_bootstrap_dir}/Makefile" for a in ${CMAKE_C_SOURCES}; do src=`cmake_escape "${cmake_source_dir}/Source/${a}.c"` echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile" |