diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-08-22 09:30:19 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2013-08-22 10:06:58 (GMT) |
commit | 33055c405ed3b0e1df52c186f0d8a3e878aa88a8 (patch) | |
tree | 14f5a4fb37a84f5748584329e454502d524fe967 /Source | |
parent | 7324eb896eb7337aaec2baf44d11d419a9d87b30 (diff) | |
download | CMake-33055c405ed3b0e1df52c186f0d8a3e878aa88a8.zip CMake-33055c405ed3b0e1df52c186f0d8a3e878aa88a8.tar.gz CMake-33055c405ed3b0e1df52c186f0d8a3e878aa88a8.tar.bz2 |
Generate modern-style cmake code.
The commits 9db31162 (Remove CMake-language block-end command
arguments, 2012-08-13) and 77543bde (Convert CMake-language
commands to lower case, 2012-08-13) changed most cmake code
to use lowercase commands and no parameters in termination
commands. However, those changes excluded cmake code generated
in c++ by cmake.
Make a similar style change to code generated by cmake.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 4 | ||||
-rw-r--r-- | Source/cmCoreTryCompile.cxx | 32 | ||||
-rw-r--r-- | Source/cmExportLibraryDependencies.cxx | 12 | ||||
-rw-r--r-- | Source/cmGlobalUnixMakefileGenerator3.cxx | 10 | ||||
-rw-r--r-- | Source/cmInstallExportGenerator.cxx | 24 | ||||
-rw-r--r-- | Source/cmInstallGenerator.cxx | 14 | ||||
-rw-r--r-- | Source/cmInstallScriptGenerator.cxx | 6 | ||||
-rw-r--r-- | Source/cmInstallTargetGenerator.cxx | 24 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 75 | ||||
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.cxx | 32 | ||||
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 14 | ||||
-rw-r--r-- | Source/cmQtAutomoc.cxx | 4 | ||||
-rw-r--r-- | Source/cmScriptGenerator.cxx | 10 | ||||
-rw-r--r-- | Source/cmTestGenerator.cxx | 8 | ||||
-rw-r--r-- | Source/cmTryRunCommand.cxx | 4 |
15 files changed, 137 insertions, 136 deletions
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 497774d..85d7a56 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -249,7 +249,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "ADD_TEST";} + virtual const char* GetName() const { return "add_test";} // Unused methods virtual const char* GetTerseDocumentation() const { return ""; } @@ -297,7 +297,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "SET_TESTS_PROPERTIES";} + virtual const char* GetName() const { return "set_tests_properties";} // Unused methods virtual const char* GetTerseDocumentation() const { return ""; } diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 086f27a..8dfaf3b 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -294,7 +294,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv) cmVersion::GetPatchVersion(), cmVersion::GetTweakVersion()); if(def) { - fprintf(fout, "SET(CMAKE_MODULE_PATH %s)\n", def); + fprintf(fout, "set(CMAKE_MODULE_PATH %s)\n", def); } std::string projectLangs; @@ -307,35 +307,35 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv) if(const char* rulesOverridePath = this->Makefile->GetDefinition(rulesOverrideLang.c_str())) { - fprintf(fout, "SET(%s \"%s\")\n", + fprintf(fout, "set(%s \"%s\")\n", rulesOverrideLang.c_str(), rulesOverridePath); } else if(const char* rulesOverridePath2 = this->Makefile->GetDefinition(rulesOverrideBase.c_str())) { - fprintf(fout, "SET(%s \"%s\")\n", + fprintf(fout, "set(%s \"%s\")\n", rulesOverrideBase.c_str(), rulesOverridePath2); } } - fprintf(fout, "PROJECT(CMAKE_TRY_COMPILE%s)\n", projectLangs.c_str()); - fprintf(fout, "SET(CMAKE_VERBOSE_MAKEFILE 1)\n"); + fprintf(fout, "project(CMAKE_TRY_COMPILE%s)\n", projectLangs.c_str()); + fprintf(fout, "set(CMAKE_VERBOSE_MAKEFILE 1)\n"); for(std::set<std::string>::iterator li = testLangs.begin(); li != testLangs.end(); ++li) { std::string langFlags = "CMAKE_" + *li + "_FLAGS"; const char* flags = this->Makefile->GetDefinition(langFlags.c_str()); - fprintf(fout, "SET(CMAKE_%s_FLAGS %s)\n", li->c_str(), + fprintf(fout, "set(CMAKE_%s_FLAGS %s)\n", li->c_str(), lg->EscapeForCMake(flags?flags:"").c_str()); - fprintf(fout, "SET(CMAKE_%s_FLAGS \"${CMAKE_%s_FLAGS}" + fprintf(fout, "set(CMAKE_%s_FLAGS \"${CMAKE_%s_FLAGS}" " ${COMPILE_DEFINITIONS}\")\n", li->c_str(), li->c_str()); } - fprintf(fout, "INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES})\n"); - fprintf(fout, "SET(CMAKE_SUPPRESS_REGENERATION 1)\n"); - fprintf(fout, "LINK_DIRECTORIES(${LINK_DIRECTORIES})\n"); + fprintf(fout, "include_directories(${INCLUDE_DIRECTORIES})\n"); + fprintf(fout, "set(CMAKE_SUPPRESS_REGENERATION 1)\n"); + fprintf(fout, "link_directories(${LINK_DIRECTORIES})\n"); // handle any compile flags we need to pass on if (compileDefs.size()) { - fprintf(fout, "ADD_DEFINITIONS( "); + fprintf(fout, "add_definitions( "); for (size_t i = 0; i < compileDefs.size(); ++i) { fprintf(fout,"%s ",compileDefs[i].c_str()); @@ -406,14 +406,14 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv) } if(this->Makefile->GetDefinition("CMAKE_POSITION_INDEPENDENT_CODE")!=0) { - fprintf(fout, "SET(CMAKE_POSITION_INDEPENDENT_CODE \"ON\")\n"); + fprintf(fout, "set(CMAKE_POSITION_INDEPENDENT_CODE \"ON\")\n"); } /* Put the executable at a known location (for COPY_FILE). */ - fprintf(fout, "SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"%s\")\n", + fprintf(fout, "set(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"%s\")\n", this->BinaryDirectory.c_str()); /* Create the actual executable. */ - fprintf(fout, "ADD_EXECUTABLE(%s", targetName); + fprintf(fout, "add_executable(%s", targetName); for(std::vector<std::string>::iterator si = sources.begin(); si != sources.end(); ++si) { @@ -429,11 +429,11 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv) if (useOldLinkLibs) { fprintf(fout, - "TARGET_LINK_LIBRARIES(%s ${LINK_LIBRARIES})\n",targetName); + "target_link_libraries(%s ${LINK_LIBRARIES})\n",targetName); } else { - fprintf(fout, "TARGET_LINK_LIBRARIES(%s %s)\n", + fprintf(fout, "target_link_libraries(%s %s)\n", targetName, libsToLink.c_str()); } diff --git a/Source/cmExportLibraryDependencies.cxx b/Source/cmExportLibraryDependencies.cxx index f07b783..e3b1626 100644 --- a/Source/cmExportLibraryDependencies.cxx +++ b/Source/cmExportLibraryDependencies.cxx @@ -169,7 +169,7 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const const char* vertest = "\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" GREATER 2.4"; fout << "# Generated by CMake " << cmVersion::GetCMakeVersion() << "\n\n"; - fout << "IF(" << vertest << ")\n"; + fout << "if(" << vertest << ")\n"; fout << " # Information for CMake 2.6 and above.\n"; for(std::map<cmStdString, cmStdString>::const_iterator i = libDepsNew.begin(); @@ -177,10 +177,10 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const { if(!i->second.empty()) { - fout << " SET(\"" << i->first << "\" \"" << i->second << "\")\n"; + fout << " set(\"" << i->first << "\" \"" << i->second << "\")\n"; } } - fout << "ELSE(" << vertest << ")\n"; + fout << "else()\n"; fout << " # Information for CMake 2.4 and lower.\n"; for(std::map<cmStdString, cmStdString>::const_iterator i = libDepsOld.begin(); @@ -188,7 +188,7 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const { if(!i->second.empty()) { - fout << " SET(\"" << i->first << "\" \"" << i->second << "\")\n"; + fout << " set(\"" << i->first << "\" \"" << i->second << "\")\n"; } } for(std::map<cmStdString, cmStdString>::const_iterator i = libTypes.begin(); @@ -196,9 +196,9 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const { if(i->second != "general") { - fout << " SET(\"" << i->first << "\" \"" << i->second << "\")\n"; + fout << " set(\"" << i->first << "\" \"" << i->second << "\")\n"; } } - fout << "ENDIF(" << vertest << ")\n"; + fout << "endif()\n"; return; } diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 88cd6e5..3a9dc44 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -281,7 +281,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() // Save the generator name cmakefileStream << "# The generator used is:\n" - << "SET(CMAKE_DEPENDS_GENERATOR \"" << this->GetName() << "\")\n\n"; + << "set(CMAKE_DEPENDS_GENERATOR \"" << this->GetName() << "\")\n\n"; // for each cmMakefile get its list of dependencies std::vector<std::string> lfiles; @@ -312,7 +312,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() // Save the list to the cmake file. cmakefileStream << "# The top level Makefile was generated from the following files:\n" - << "SET(CMAKE_MAKEFILE_DEPENDS\n" + << "set(CMAKE_MAKEFILE_DEPENDS\n" << " \"" << lg->Convert(cache.c_str(), cmLocalGenerator::START_OUTPUT).c_str() << "\"\n"; @@ -335,7 +335,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() // Set the corresponding makefile in the cmake file. cmakefileStream << "# The corresponding makefile is:\n" - << "SET(CMAKE_MAKEFILE_OUTPUTS\n" + << "set(CMAKE_MAKEFILE_OUTPUTS\n" << " \"" << lg->Convert(makefileName.c_str(), cmLocalGenerator::START_OUTPUT).c_str() << "\"\n" @@ -348,7 +348,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() { cmakefileStream << "# Byproducts of CMake generate step:\n" - << "SET(CMAKE_MAKEFILE_PRODUCTS\n"; + << "set(CMAKE_MAKEFILE_PRODUCTS\n"; const std::vector<std::string>& outfiles = lg->GetMakefile()->GetOutputFiles(); for(std::vector<std::string>::const_iterator k = outfiles.begin(); @@ -390,7 +390,7 @@ void cmGlobalUnixMakefileGenerator3 cmakefileStream << "# Dependency information for all targets:\n"; cmakefileStream - << "SET(CMAKE_DEPEND_INFO_FILES\n"; + << "set(CMAKE_DEPEND_INFO_FILES\n"; for (unsigned int i = 0; i < lGenerators.size(); ++i) { lg = static_cast<cmLocalUnixMakefileGenerator3 *>(lGenerators[i]); diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index 3e9e6ac..1287ea6 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -183,11 +183,11 @@ cmInstallExportGenerator::GenerateScriptConfigs(std::ostream& os, { files.push_back(i->second); std::string config_test = this->CreateConfigTest(i->first.c_str()); - os << indent << "IF(" << config_test << ")\n"; + os << indent << "if(" << config_test << ")\n"; this->AddInstallRule(os, cmInstallType_FILES, files, false, this->FilePermissions.c_str(), 0, 0, 0, indent.Next()); - os << indent << "ENDIF(" << config_test << ")\n"; + os << indent << "endif()\n"; files.clear(); } } @@ -202,23 +202,23 @@ void cmInstallExportGenerator::GenerateScriptActions(std::ostream& os, installedDir += "/"; std::string installedFile = installedDir; installedFile += this->FileName; - os << indent << "IF(EXISTS \"" << installedFile << "\")\n"; + os << indent << "if(EXISTS \"" << installedFile << "\")\n"; Indent indentN = indent.Next(); Indent indentNN = indentN.Next(); Indent indentNNN = indentNN.Next(); - os << indentN << "FILE(DIFFERENT EXPORT_FILE_CHANGED FILES\n" + os << indentN << "file(DIFFERENT EXPORT_FILE_CHANGED FILES\n" << indentN << " \"" << installedFile << "\"\n" << indentN << " \"" << this->MainImportFile << "\")\n"; - os << indentN << "IF(EXPORT_FILE_CHANGED)\n"; - os << indentNN << "FILE(GLOB OLD_CONFIG_FILES \"" << installedDir + os << indentN << "if(EXPORT_FILE_CHANGED)\n"; + os << indentNN << "file(GLOB OLD_CONFIG_FILES \"" << installedDir << this->EFGen->GetConfigImportFileGlob() << "\")\n"; - os << indentNN << "IF(OLD_CONFIG_FILES)\n"; - os << indentNNN << "MESSAGE(STATUS \"Old export file \\\"" << installedFile + os << indentNN << "if(OLD_CONFIG_FILES)\n"; + os << indentNNN << "message(STATUS \"Old export file \\\"" << installedFile << "\\\" will be replaced. Removing files [${OLD_CONFIG_FILES}].\")\n"; - os << indentNNN << "FILE(REMOVE ${OLD_CONFIG_FILES})\n"; - os << indentNN << "ENDIF(OLD_CONFIG_FILES)\n"; - os << indentN << "ENDIF(EXPORT_FILE_CHANGED)\n"; - os << indent << "ENDIF()\n"; + os << indentNNN << "file(REMOVE ${OLD_CONFIG_FILES})\n"; + os << indentNN << "endif()\n"; + os << indentN << "endif()\n"; + os << indent << "endif()\n"; // Install the main export file. std::vector<std::string> files; diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx index 3be2c2b..d105a0c 100644 --- a/Source/cmInstallGenerator.cxx +++ b/Source/cmInstallGenerator.cxx @@ -80,18 +80,18 @@ void cmInstallGenerator } } os << "\")\n"; - os << indent << "IF (CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION)\n"; + os << indent << "if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION)\n"; os << indent << indent << "message(WARNING \"ABSOLUTE path INSTALL " << "DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}\")\n"; - os << indent << "ENDIF (CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION)\n"; + os << indent << "endif()\n"; - os << indent << "IF (CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION)\n"; + os << indent << "if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION)\n"; os << indent << indent << "message(FATAL_ERROR \"ABSOLUTE path INSTALL " << "DESTINATION forbidden (by caller): " << "${CMAKE_ABSOLUTE_DESTINATION_FILES}\")\n"; - os << indent << "ENDIF (CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION)\n"; + os << indent << "endif()\n"; } - os << "FILE(INSTALL DESTINATION \"" << dest << "\" TYPE " << stype.c_str(); + os << "file(INSTALL DESTINATION \"" << dest << "\" TYPE " << stype.c_str(); if(optional) { os << " OPTIONAL"; @@ -153,13 +153,13 @@ void cmInstallGenerator::GenerateScript(std::ostream& os) // Begin this block of installation. std::string component_test = this->CreateComponentTest(this->Component.c_str()); - os << indent << "IF(" << component_test << ")\n"; + os << indent << "if(" << component_test << ")\n"; // Generate the script possibly with per-configuration code. this->GenerateScriptConfigs(os, indent.Next()); // End this block of installation. - os << indent << "ENDIF(" << component_test << ")\n\n"; + os << indent << "endif()\n\n"; } //---------------------------------------------------------------------------- diff --git a/Source/cmInstallScriptGenerator.cxx b/Source/cmInstallScriptGenerator.cxx index bcfbe63..1ecf021 100644 --- a/Source/cmInstallScriptGenerator.cxx +++ b/Source/cmInstallScriptGenerator.cxx @@ -32,7 +32,7 @@ void cmInstallScriptGenerator::GenerateScript(std::ostream& os) Indent indent; std::string component_test = this->CreateComponentTest(this->Component.c_str()); - os << indent << "IF(" << component_test << ")\n"; + os << indent << "if(" << component_test << ")\n"; if(this->Code) { @@ -40,8 +40,8 @@ void cmInstallScriptGenerator::GenerateScript(std::ostream& os) } else { - os << indent.Next() << "INCLUDE(\"" << this->Script << "\")\n"; + os << indent.Next() << "include(\"" << this->Script << "\")\n"; } - os << indent << "ENDIF(" << component_test << ")\n\n"; + os << indent << "endif()\n\n"; } diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index c9624c8..d0768c8 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -407,10 +407,10 @@ cmInstallTargetGenerator std::string tws = tw.str(); if(!tws.empty()) { - os << indent << "IF(EXISTS \"" << file << "\" AND\n" + os << indent << "if(EXISTS \"" << file << "\" AND\n" << indent << " NOT IS_SYMLINK \"" << file << "\")\n"; os << tws; - os << indent << "ENDIF()\n"; + os << indent << "endif()\n"; } } @@ -434,7 +434,7 @@ cmInstallTargetGenerator if(!tws.empty()) { Indent indent2 = indent.Next().Next(); - os << indent << "FOREACH(file\n"; + os << indent << "foreach(file\n"; for(std::vector<std::string>::const_iterator i = files.begin(); i != files.end(); ++i) { @@ -442,7 +442,7 @@ cmInstallTargetGenerator } os << indent2 << ")\n"; os << tws; - os << indent << "ENDFOREACH()\n"; + os << indent << "endforeach()\n"; } } } @@ -577,7 +577,7 @@ cmInstallTargetGenerator // install_name value and references. if(!new_id.empty() || !install_name_remap.empty()) { - os << indent << "EXECUTE_PROCESS(COMMAND \"" << installNameTool; + os << indent << "execute_process(COMMAND \"" << installNameTool; os << "\""; if(!new_id.empty()) { @@ -626,7 +626,7 @@ cmInstallTargetGenerator // Write a rule to remove the installed file if its rpath is not the // new rpath. This is needed for existing build/install trees when // the installed rpath changes but the file is not rebuilt. - os << indent << "FILE(RPATH_CHECK\n" + os << indent << "file(RPATH_CHECK\n" << indent << " FILE \"" << toDestDirPath << "\"\n" << indent << " RPATH \"" << newRpath << "\")\n"; } @@ -697,12 +697,12 @@ cmInstallTargetGenerator // Write a rule to run chrpath to set the install-tree RPATH if(newRpath.empty()) { - os << indent << "FILE(RPATH_REMOVE\n" + os << indent << "file(RPATH_REMOVE\n" << indent << " FILE \"" << toDestDirPath << "\")\n"; } else { - os << indent << "FILE(RPATH_CHANGE\n" + os << indent << "file(RPATH_CHANGE\n" << indent << " FILE \"" << toDestDirPath << "\"\n" << indent << " OLD_RPATH \"" << oldRpath << "\"\n" << indent << " NEW_RPATH \"" << newRpath << "\")\n"; @@ -736,11 +736,11 @@ cmInstallTargetGenerator::AddStripRule(std::ostream& os, return; } - os << indent << "IF(CMAKE_INSTALL_DO_STRIP)\n"; - os << indent << " EXECUTE_PROCESS(COMMAND \"" + os << indent << "if(CMAKE_INSTALL_DO_STRIP)\n"; + os << indent << " execute_process(COMMAND \"" << this->Target->GetMakefile()->GetDefinition("CMAKE_STRIP") << "\" \"" << toDestDirPath << "\")\n"; - os << indent << "ENDIF(CMAKE_INSTALL_DO_STRIP)\n"; + os << indent << "endif()\n"; } //---------------------------------------------------------------------------- @@ -769,6 +769,6 @@ cmInstallTargetGenerator::AddRanlibRule(std::ostream& os, return; } - os << indent << "EXECUTE_PROCESS(COMMAND \"" + os << indent << "execute_process(COMMAND \"" << ranlib << "\" \"" << toDestDirPath << "\")\n"; } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 9c04109..afc04b9 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -297,7 +297,7 @@ void cmLocalGenerator::GenerateTestFiles() this->Makefile->GetProperty("TEST_INCLUDE_FILE"); if ( testIncludeFile ) { - fout << "INCLUDE(\"" << testIncludeFile << "\")" << std::endl; + fout << "include(\"" << testIncludeFile << "\")" << std::endl; } // Ask each test generator to write its code. @@ -313,7 +313,8 @@ void cmLocalGenerator::GenerateTestFiles() size_t i; for(i = 0; i < this->Children.size(); ++i) { - fout << "SUBDIRS("; + // TODO: Use add_subdirectory instead? + fout << "subdirs("; std::string outP = this->Children[i]->GetMakefile()->GetStartOutputDirectory(); fout << this->Convert(outP.c_str(),START_OUTPUT); @@ -416,39 +417,39 @@ void cmLocalGenerator::GenerateInstallRules() fout << "# Install script for directory: " << this->Makefile->GetCurrentDirectory() << std::endl << std::endl; fout << "# Set the install prefix" << std::endl - << "IF(NOT DEFINED CMAKE_INSTALL_PREFIX)" << std::endl - << " SET(CMAKE_INSTALL_PREFIX \"" << prefix << "\")" << std::endl - << "ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX)" << std::endl - << "STRING(REGEX REPLACE \"/$\" \"\" CMAKE_INSTALL_PREFIX " + << "if(NOT DEFINED CMAKE_INSTALL_PREFIX)" << std::endl + << " set(CMAKE_INSTALL_PREFIX \"" << prefix << "\")" << std::endl + << "endif()" << std::endl + << "string(REGEX REPLACE \"/$\" \"\" CMAKE_INSTALL_PREFIX " << "\"${CMAKE_INSTALL_PREFIX}\")" << std::endl << std::endl; // Write support code for generating per-configuration install rules. fout << "# Set the install configuration name.\n" - "IF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)\n" - " IF(BUILD_TYPE)\n" - " STRING(REGEX REPLACE \"^[^A-Za-z0-9_]+\" \"\"\n" + "if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)\n" + " if(BUILD_TYPE)\n" + " string(REGEX REPLACE \"^[^A-Za-z0-9_]+\" \"\"\n" " CMAKE_INSTALL_CONFIG_NAME \"${BUILD_TYPE}\")\n" - " ELSE(BUILD_TYPE)\n" - " SET(CMAKE_INSTALL_CONFIG_NAME \"" << default_config << "\")\n" - " ENDIF(BUILD_TYPE)\n" - " MESSAGE(STATUS \"Install configuration: " + " else()\n" + " set(CMAKE_INSTALL_CONFIG_NAME \"" << default_config << "\")\n" + " endif()\n" + " message(STATUS \"Install configuration: " "\\\"${CMAKE_INSTALL_CONFIG_NAME}\\\"\")\n" - "ENDIF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)\n" + "endif()\n" "\n"; // Write support code for dealing with component-specific installs. fout << "# Set the component getting installed.\n" - "IF(NOT CMAKE_INSTALL_COMPONENT)\n" - " IF(COMPONENT)\n" - " MESSAGE(STATUS \"Install component: \\\"${COMPONENT}\\\"\")\n" - " SET(CMAKE_INSTALL_COMPONENT \"${COMPONENT}\")\n" - " ELSE(COMPONENT)\n" - " SET(CMAKE_INSTALL_COMPONENT)\n" - " ENDIF(COMPONENT)\n" - "ENDIF(NOT CMAKE_INSTALL_COMPONENT)\n" + "if(NOT CMAKE_INSTALL_COMPONENT)\n" + " if(COMPONENT)\n" + " message(STATUS \"Install component: \\\"${COMPONENT}\\\"\")\n" + " set(CMAKE_INSTALL_COMPONENT \"${COMPONENT}\")\n" + " else()\n" + " set(CMAKE_INSTALL_COMPONENT)\n" + " endif()\n" + "endif()\n" "\n"; // Copy user-specified install options to the install code. @@ -457,9 +458,9 @@ void cmLocalGenerator::GenerateInstallRules() { fout << "# Install shared libraries without execute permission?\n" - "IF(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)\n" - " SET(CMAKE_INSTALL_SO_NO_EXE \"" << so_no_exe << "\")\n" - "ENDIF(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)\n" + "if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)\n" + " set(CMAKE_INSTALL_SO_NO_EXE \"" << so_no_exe << "\")\n" + "endif()\n" "\n"; } @@ -479,7 +480,7 @@ void cmLocalGenerator::GenerateInstallRules() // Include install scripts from subdirectories. if(!this->Children.empty()) { - fout << "IF(NOT CMAKE_INSTALL_LOCAL_ONLY)\n"; + fout << "if(NOT CMAKE_INSTALL_LOCAL_ONLY)\n"; fout << " # Include the install script for each subdirectory.\n"; for(std::vector<cmLocalGenerator*>::const_iterator ci = this->Children.begin(); ci != this->Children.end(); ++ci) @@ -488,34 +489,34 @@ void cmLocalGenerator::GenerateInstallRules() { std::string odir = (*ci)->GetMakefile()->GetStartOutputDirectory(); cmSystemTools::ConvertToUnixSlashes(odir); - fout << " INCLUDE(\"" << odir.c_str() + fout << " include(\"" << odir.c_str() << "/cmake_install.cmake\")" << std::endl; } } fout << "\n"; - fout << "ENDIF(NOT CMAKE_INSTALL_LOCAL_ONLY)\n\n"; + fout << "endif()\n\n"; } // Record the install manifest. if ( toplevel_install ) { fout << - "IF(CMAKE_INSTALL_COMPONENT)\n" - " SET(CMAKE_INSTALL_MANIFEST \"install_manifest_" + "if(CMAKE_INSTALL_COMPONENT)\n" + " set(CMAKE_INSTALL_MANIFEST \"install_manifest_" "${CMAKE_INSTALL_COMPONENT}.txt\")\n" - "ELSE(CMAKE_INSTALL_COMPONENT)\n" - " SET(CMAKE_INSTALL_MANIFEST \"install_manifest.txt\")\n" - "ENDIF(CMAKE_INSTALL_COMPONENT)\n\n"; + "else()\n" + " set(CMAKE_INSTALL_MANIFEST \"install_manifest.txt\")\n" + "endif()\n\n"; fout - << "FILE(WRITE \"" + << "file(WRITE \"" << homedir.c_str() << "/${CMAKE_INSTALL_MANIFEST}\" " << "\"\")" << std::endl; fout - << "FOREACH(file ${CMAKE_INSTALL_MANIFEST_FILES})" << std::endl - << " FILE(APPEND \"" + << "foreach(file ${CMAKE_INSTALL_MANIFEST_FILES})" << std::endl + << " file(APPEND \"" << homedir.c_str() << "/${CMAKE_INSTALL_MANIFEST}\" " << "\"${file}\\n\")" << std::endl - << "ENDFOREACH(file)" << std::endl; + << "endforeach()" << std::endl; } } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 56da1f9..2443583 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -474,9 +474,9 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile() // Setup relative path conversion tops. infoFileStream << "# Relative path conversion top directories.\n" - << "SET(CMAKE_RELATIVE_PATH_TOP_SOURCE \"" << this->RelativePathTopSource + << "set(CMAKE_RELATIVE_PATH_TOP_SOURCE \"" << this->RelativePathTopSource << "\")\n" - << "SET(CMAKE_RELATIVE_PATH_TOP_BINARY \"" << this->RelativePathTopBinary + << "set(CMAKE_RELATIVE_PATH_TOP_BINARY \"" << this->RelativePathTopBinary << "\")\n" << "\n"; @@ -485,7 +485,7 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile() { infoFileStream << "# Force unix paths in dependencies.\n" - << "SET(CMAKE_FORCE_UNIX_PATHS 1)\n" + << "set(CMAKE_FORCE_UNIX_PATHS 1)\n" << "\n"; } @@ -495,21 +495,21 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile() << "# The C and CXX include file regular expressions for " << "this directory.\n"; infoFileStream - << "SET(CMAKE_C_INCLUDE_REGEX_SCAN "; + << "set(CMAKE_C_INCLUDE_REGEX_SCAN "; this->WriteCMakeArgument(infoFileStream, this->Makefile->GetIncludeRegularExpression()); infoFileStream << ")\n"; infoFileStream - << "SET(CMAKE_C_INCLUDE_REGEX_COMPLAIN "; + << "set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "; this->WriteCMakeArgument(infoFileStream, this->Makefile->GetComplainRegularExpression()); infoFileStream << ")\n"; infoFileStream - << "SET(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN})\n"; + << "set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN})\n"; infoFileStream - << "SET(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN " + << "set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN " "${CMAKE_C_INCLUDE_REGEX_COMPLAIN})\n"; } @@ -1176,7 +1176,7 @@ cmLocalUnixMakefileGenerator3 { cmSystemTools::Error("Could not create ", cleanfilePath.c_str()); } - fout << "FILE(REMOVE_RECURSE\n"; + fout << "file(REMOVE_RECURSE\n"; std::string remove = "$(CMAKE_COMMAND) -P "; remove += this->Convert(cleanfile.c_str(), START_OUTPUT, SHELL); for(std::vector<std::string>::const_iterator f = files.begin(); @@ -1196,16 +1196,16 @@ cmLocalUnixMakefileGenerator3 target.GetLanguages(languages); fout << "\n" << "# Per-language clean rules from dependency scanning.\n" - << "FOREACH(lang"; + << "foreach(lang"; for(std::set<cmStdString>::const_iterator l = languages.begin(); l != languages.end(); ++l) { fout << " " << *l; } fout << ")\n" - << " INCLUDE(" << this->GetTargetDirectory(target) + << " include(" << this->GetTargetDirectory(target) << "/cmake_clean_${lang}.cmake OPTIONAL)\n" - << "ENDFOREACH(lang)\n"; + << "endforeach()\n"; } } } @@ -1915,7 +1915,7 @@ void cmLocalUnixMakefileGenerator3 cmakefileStream << "# The set of languages for which implicit dependencies are needed:\n"; cmakefileStream - << "SET(CMAKE_DEPENDS_LANGUAGES\n"; + << "set(CMAKE_DEPENDS_LANGUAGES\n"; for(ImplicitDependLanguageMap::const_iterator l = implicitLangs.begin(); l != implicitLangs.end(); ++l) { @@ -1930,7 +1930,7 @@ void cmLocalUnixMakefileGenerator3 l = implicitLangs.begin(); l != implicitLangs.end(); ++l) { cmakefileStream - << "SET(CMAKE_DEPENDS_CHECK_" << l->first.c_str() << "\n"; + << "set(CMAKE_DEPENDS_CHECK_" << l->first.c_str() << "\n"; ImplicitDependFileMap const& implicitPairs = l->second; // for each file pair @@ -1954,7 +1954,7 @@ void cmLocalUnixMakefileGenerator3 if(cid && *cid) { cmakefileStream - << "SET(CMAKE_" << l->first.c_str() << "_COMPILER_ID \"" + << "set(CMAKE_" << l->first.c_str() << "_COMPILER_ID \"" << cid << "\")\n"; } } @@ -1968,7 +1968,7 @@ void cmLocalUnixMakefileGenerator3 cmakefileStream << "\n" << "# Preprocessor definitions for this target.\n" - << "SET(CMAKE_TARGET_DEFINITIONS\n"; + << "set(CMAKE_TARGET_DEFINITIONS\n"; for(std::set<std::string>::const_iterator di = defines.begin(); di != defines.end(); ++di) { @@ -1995,7 +1995,7 @@ void cmLocalUnixMakefileGenerator3 if(!transformRules.empty()) { cmakefileStream - << "SET(CMAKE_INCLUDE_TRANSFORMS\n"; + << "set(CMAKE_INCLUDE_TRANSFORMS\n"; for(std::vector<std::string>::const_iterator tri = transformRules.begin(); tri != transformRules.end(); ++tri) { diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 0829cab..8ee62be 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -968,7 +968,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() *this->InfoFileStream << "\n" << "# Pairs of files generated by the same build rule.\n" - << "SET(CMAKE_MULTIPLE_OUTPUT_PAIRS\n"; + << "set(CMAKE_MULTIPLE_OUTPUT_PAIRS\n"; for(MultipleOutputPairsType::const_iterator pi = this->MultipleOutputPairs.begin(); pi != this->MultipleOutputPairs.end(); ++pi) @@ -986,7 +986,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() *this->InfoFileStream << "\n" << "# Targets to which this target links.\n" - << "SET(CMAKE_TARGET_LINKED_INFO_FILES\n"; + << "set(CMAKE_TARGET_LINKED_INFO_FILES\n"; std::set<cmTarget const*> emitted; const char* cfg = this->LocalGenerator->ConfigurationName.c_str(); if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(cfg)) @@ -1018,7 +1018,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() *this->InfoFileStream << "\n" << "# Fortran module output directory.\n" - << "SET(CMAKE_Fortran_TARGET_MODULE_DIR \"" << mdir << "\")\n"; + << "set(CMAKE_Fortran_TARGET_MODULE_DIR \"" << mdir << "\")\n"; } // Target-specific include directories: @@ -1026,7 +1026,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() << "\n" << "# The include file search paths:\n"; *this->InfoFileStream - << "SET(CMAKE_C_TARGET_INCLUDE_PATH\n"; + << "set(CMAKE_C_TARGET_INCLUDE_PATH\n"; std::vector<std::string> includes; const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); @@ -1045,13 +1045,13 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() *this->InfoFileStream << " )\n"; *this->InfoFileStream - << "SET(CMAKE_CXX_TARGET_INCLUDE_PATH " + << "set(CMAKE_CXX_TARGET_INCLUDE_PATH " << "${CMAKE_C_TARGET_INCLUDE_PATH})\n"; *this->InfoFileStream - << "SET(CMAKE_Fortran_TARGET_INCLUDE_PATH " + << "set(CMAKE_Fortran_TARGET_INCLUDE_PATH " << "${CMAKE_C_TARGET_INCLUDE_PATH})\n"; *this->InfoFileStream - << "SET(CMAKE_ASM_TARGET_INCLUDE_PATH " + << "set(CMAKE_ASM_TARGET_INCLUDE_PATH " << "${CMAKE_C_TARGET_INCLUDE_PATH})\n"; // and now write the rule to use it diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx index 93e39ab..0cbbc33 100644 --- a/Source/cmQtAutomoc.cxx +++ b/Source/cmQtAutomoc.cxx @@ -436,7 +436,7 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target) it = configDefines.begin(), end = configDefines.end(); it != end; ++it) { - infoFile << "SET(AM_MOC_COMPILE_DEFINITIONS_" << it->first << + infoFile << "set(AM_MOC_COMPILE_DEFINITIONS_" << it->first << " " << it->second << ")\n"; } } @@ -446,7 +446,7 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target) it = configIncludes.begin(), end = configIncludes.end(); it != end; ++it) { - infoFile << "SET(AM_MOC_INCLUDES_" << it->first << + infoFile << "set(AM_MOC_INCLUDES_" << it->first << " " << it->second << ")\n"; } } diff --git a/Source/cmScriptGenerator.cxx b/Source/cmScriptGenerator.cxx index cabe98a..3b6a49b 100644 --- a/Source/cmScriptGenerator.cxx +++ b/Source/cmScriptGenerator.cxx @@ -185,9 +185,9 @@ void cmScriptGenerator::GenerateScriptActionsOnce(std::ostream& os, { // Generate a per-configuration block. std::string config_test = this->CreateConfigTest(this->Configurations); - os << indent << "IF(" << config_test << ")\n"; + os << indent << "if(" << config_test << ")\n"; this->GenerateScriptActions(os, indent.Next()); - os << indent << "ENDIF(" << config_test << ")\n"; + os << indent << "endif(" << config_test << ")\n"; } } @@ -219,7 +219,7 @@ void cmScriptGenerator::GenerateScriptActionsPerConfig(std::ostream& os, { // Generate a per-configuration block. std::string config_test = this->CreateConfigTest(config); - os << indent << (first? "IF(" : "ELSEIF(") << config_test << ")\n"; + os << indent << (first? "if(" : "elseif(") << config_test << ")\n"; this->GenerateScriptForConfig(os, config, indent.Next()); first = false; } @@ -228,10 +228,10 @@ void cmScriptGenerator::GenerateScriptActionsPerConfig(std::ostream& os, { if(this->NeedsScriptNoConfig()) { - os << indent << "ELSE()\n"; + os << indent << "else()\n"; this->GenerateScriptNoConfig(os, indent.Next()); } - os << indent << "ENDIF()\n"; + os << indent << "endif()\n"; } } } diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx index 42f511e..327084b 100644 --- a/Source/cmTestGenerator.cxx +++ b/Source/cmTestGenerator.cxx @@ -53,7 +53,7 @@ void cmTestGenerator::GenerateScriptConfigs(std::ostream& os, cmPropertyMap* mpit = &test->GetProperties(); if ( mpit->size() ) { - fout << "SET_TESTS_PROPERTIES(" << test->GetName() << " PROPERTIES "; + fout << "set_tests_properties(" << test->GetName() << " PROPERTIES "; for ( pit = mpit->begin(); pit != mpit->end(); ++ pit ) { fout << " " << pit->first @@ -94,7 +94,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, cmGeneratorExpression ge(this->Test->GetBacktrace()); // Start the test command. - os << indent << "ADD_TEST(" << this->Test->GetName() << " "; + os << indent << "add_test(" << this->Test->GetName() << " "; // Get the test command line to be executed. std::vector<std::string> const& command = this->Test->GetCommand(); @@ -133,7 +133,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, void cmTestGenerator::GenerateScriptNoConfig(std::ostream& os, Indent const& indent) { - os << indent << "ADD_TEST(" << this->Test->GetName() << " NOT_AVAILABLE)\n"; + os << indent << "add_test(" << this->Test->GetName() << " NOT_AVAILABLE)\n"; } //---------------------------------------------------------------------------- @@ -157,7 +157,7 @@ void cmTestGenerator::GenerateOldStyle(std::ostream& fout, std::string exe = command[0]; cmSystemTools::ConvertToUnixSlashes(exe); fout << indent; - fout << "ADD_TEST("; + fout << "add_test("; fout << this->Test->GetName() << " \"" << exe << "\""; for(std::vector<std::string>::const_iterator argit = command.begin()+1; diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx index 4fc0b13..879d4fd 100644 --- a/Source/cmTryRunCommand.cxx +++ b/Source/cmTryRunCommand.cxx @@ -353,13 +353,13 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, cmsys::SystemTools::ReplaceString(comment, "\n", "\n# "); file << comment << "\n\n"; - file << "SET( " << this->RunResultVariable << " \n \"" + file << "set( " << this->RunResultVariable << " \n \"" << this->Makefile->GetDefinition(this->RunResultVariable.c_str()) << "\"\n CACHE STRING \"Result from TRY_RUN\" FORCE)\n\n"; if (out!=0) { - file << "SET( " << internalRunOutputName << " \n \"" + file << "set( " << internalRunOutputName << " \n \"" << this->Makefile->GetDefinition(internalRunOutputName.c_str()) << "\"\n CACHE STRING \"Output from TRY_RUN\" FORCE)\n\n"; } |