diff options
-rw-r--r-- | Modules/DeployQt4.cmake | 2 | ||||
-rw-r--r-- | Modules/Platform/AIX-GNU-ASM.cmake | 2 | ||||
-rw-r--r-- | Modules/Platform/AIX-GNU.cmake | 3 | ||||
-rw-r--r-- | Modules/Platform/Windows-GNU.cmake | 4 | ||||
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 20 | ||||
-rw-r--r-- | Source/cmGlobalNinjaGenerator.h | 14 | ||||
-rw-r--r-- | Source/cmIncludeCommand.cxx | 7 | ||||
-rw-r--r-- | Source/cmNinjaNormalTargetGenerator.cxx | 40 | ||||
-rw-r--r-- | Source/cmProjectCommand.h | 2 | ||||
-rw-r--r-- | Tests/CTestUpdateSVN.cmake.in | 1 | ||||
-rw-r--r-- | Tests/CustomCommand/GeneratedHeader/main.cpp | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/include/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Tests/RunCMake/include/EmptyString-stderr.txt | 5 | ||||
-rw-r--r-- | Tests/RunCMake/include/EmptyString.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/include/EmptyStringOptional-stderr.txt | 5 | ||||
-rw-r--r-- | Tests/RunCMake/include/EmptyStringOptional.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/include/RunCMakeTest.cmake | 4 |
19 files changed, 89 insertions, 30 deletions
diff --git a/Modules/DeployQt4.cmake b/Modules/DeployQt4.cmake index b37695d..edf4b4e 100644 --- a/Modules/DeployQt4.cmake +++ b/Modules/DeployQt4.cmake @@ -290,7 +290,7 @@ function(install_qt4_executable executable) endforeach() endif() - resolve_qt4_paths(libs) + resolve_qt4_paths(libs "") install(CODE "INCLUDE(\"${DeployQt4_cmake_dir}/DeployQt4.cmake\") diff --git a/Modules/Platform/AIX-GNU-ASM.cmake b/Modules/Platform/AIX-GNU-ASM.cmake new file mode 100644 index 0000000..c256df6 --- /dev/null +++ b/Modules/Platform/AIX-GNU-ASM.cmake @@ -0,0 +1,2 @@ +include(Platform/AIX-GNU) +__aix_compiler_gnu(ASM) diff --git a/Modules/Platform/AIX-GNU.cmake b/Modules/Platform/AIX-GNU.cmake index 543f3e8..81ba365 100644 --- a/Modules/Platform/AIX-GNU.cmake +++ b/Modules/Platform/AIX-GNU.cmake @@ -21,5 +21,6 @@ set(__AIX_COMPILER_GNU 1) macro(__aix_compiler_gnu lang) set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-blibpath:") set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":") - set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,-G") + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,-G,-brtl,-bnoipath") + set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-brtl,-bnoipath,-bexpall") # +s, flag for exe link to use shared lib endmacro() diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake index 1a2ee5e..4a37eca 100644 --- a/Modules/Platform/Windows-GNU.cmake +++ b/Modules/Platform/Windows-GNU.cmake @@ -115,7 +115,9 @@ macro(__windows_compiler_gnu lang) list(APPEND CMAKE_${lang}_ABI_FILES "Platform/Windows-GNU-${lang}-ABI") # Support very long lists of object files. - if("${CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG}" STREQUAL "@") + # TODO: check for which gcc versions this is still needed, not needed for gcc >= 4.4. + # Ninja generator doesn't support this work around. + if("${CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG}" STREQUAL "@" AND NOT CMAKE_GENERATOR MATCHES "Ninja") foreach(rule CREATE_SHARED_MODULE CREATE_SHARED_LIBRARY LINK_EXECUTABLE) # The gcc/collect2/ld toolchain does not use response files # internally so we cannot pass long object lists. Instead pass diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 710e3b4..89c879c 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,5 +2,5 @@ SET(CMake_VERSION_MAJOR 2) SET(CMake_VERSION_MINOR 8) SET(CMake_VERSION_PATCH 8) -SET(CMake_VERSION_TWEAK 20120710) +SET(CMake_VERSION_TWEAK 20120712) #SET(CMake_VERSION_RC 1) diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 9829d19..07cc75f 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -217,6 +217,7 @@ void cmGlobalNinjaGenerator::AddCustomCommandRule() "Rule for running custom commands.", /*depfile*/ "", /*rspfile*/ "", + /*rspcontent*/ "", /*restat*/ true); } @@ -258,6 +259,7 @@ void cmGlobalNinjaGenerator::WriteRule(std::ostream& os, const std::string& comment, const std::string& depfile, const std::string& rspfile, + const std::string& rspcontent, bool restat, bool generator) { @@ -304,10 +306,15 @@ void cmGlobalNinjaGenerator::WriteRule(std::ostream& os, if(!rspfile.empty()) { - cmGlobalNinjaGenerator::Indent(os, 1); - os << "rspfile = " << rspfile << "\n"; - cmGlobalNinjaGenerator::Indent(os, 1); - os << "rspfile_content = $in" << "\n"; + if (rspcontent.empty()) + { + cmSystemTools::Error("No rspfile_content given!", comment.c_str()); + return; + } + cmGlobalNinjaGenerator::Indent(os, 1); + os << "rspfile = " << rspfile << "\n"; + cmGlobalNinjaGenerator::Indent(os, 1); + os << "rspfile_content = " << rspcontent << "\n"; } if(restat) @@ -538,6 +545,7 @@ void cmGlobalNinjaGenerator::AddRule(const std::string& name, const std::string& comment, const std::string& depfile, const std::string& rspfile, + const std::string& rspcontent, bool restat, bool generator) { @@ -555,6 +563,7 @@ void cmGlobalNinjaGenerator::AddRule(const std::string& name, comment, depfile, rspfile, + rspcontent, restat, generator); @@ -911,6 +920,7 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os) "Rule for re-running cmake.", /*depfile=*/ "", /*rspfile=*/ "", + /*rspcontent*/ "", /*restat=*/ false, /*generator=*/ true); @@ -960,6 +970,7 @@ void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os) "Rule for cleaning all built files.", /*depfile=*/ "", /*rspfile=*/ "", + /*rspcontent*/ "", /*restat=*/ false, /*generator=*/ false); WriteBuild(os, @@ -981,6 +992,7 @@ void cmGlobalNinjaGenerator::WriteTargetHelp(std::ostream& os) "Rule for printing all primary targets available.", /*depfile=*/ "", /*rspfile=*/ "", + /*rspcontent*/ "", /*restat=*/ false, /*generator=*/ false); WriteBuild(os, diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index e5f8099..ff4f85d 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -114,11 +114,12 @@ public: const std::string& name, const std::string& command, const std::string& description, - const std::string& comment = "", - const std::string& depfile = "", - const std::string& rspfile = "" , - bool restat = false, - bool generator = false); + const std::string& comment, + const std::string& depfile, + const std::string& rspfile, + const std::string& rspcontent, + bool restat, + bool generator); /** * Write a variable named @a name to @a os with value @a value and an @@ -231,9 +232,10 @@ public: void AddRule(const std::string& name, const std::string& command, const std::string& description, - const std::string& comment = "", + const std::string& comment, const std::string& depfile = "", const std::string& rspfile = "", + const std::string& rspcontent = "", bool restat = false, bool generator = false); diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx index 0ac6df4..0d5f67b 100644 --- a/Source/cmIncludeCommand.cxx +++ b/Source/cmIncludeCommand.cxx @@ -70,6 +70,13 @@ bool cmIncludeCommand } } + if(fname.empty()) + { + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, + "include() given empty file name (ignored)."); + return true; + } + if(!cmSystemTools::FileIsFullPath(fname.c_str())) { // Not a path. Maybe module. diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 0cf90aa..be7739e 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -18,6 +18,12 @@ #include "cmMakefile.h" #include <assert.h> +#include <algorithm> + +#ifndef _WIN32 +#include <unistd.h> +#endif + cmNinjaNormalTargetGenerator:: cmNinjaNormalTargetGenerator(cmTarget* target) @@ -75,10 +81,8 @@ void cmNinjaNormalTargetGenerator::Generate() } else { - this->WriteLinkRule(false); -#ifdef _WIN32 // TODO response file support only Linux - this->WriteLinkRule(true); -#endif + this->WriteLinkRule(false); // write rule without rspfile support + this->WriteLinkRule(true); // write rule with rspfile support this->WriteLinkStatement(); } } @@ -140,6 +144,7 @@ cmNinjaNormalTargetGenerator // Select whether to use a response file for objects. std::string rspfile; + std::string rspcontent; if (!this->GetGlobalGenerator()->HasRule(ruleName)) { cmLocalGenerator::RuleVariables vars; @@ -150,6 +155,7 @@ cmNinjaNormalTargetGenerator std::string responseFlag; if (!useResponseFile) { vars.Objects = "$in"; + vars.LinkLibraries = "$LINK_LIBRARIES"; } else { // handle response file std::string cmakeLinkVar = std::string("CMAKE_") + @@ -162,7 +168,9 @@ cmNinjaNormalTargetGenerator } rspfile = "$out.rsp"; responseFlag += rspfile; + rspcontent = "$in $LINK_LIBRARIES"; vars.Objects = responseFlag.c_str(); + vars.LinkLibraries = ""; } vars.ObjectDir = "$OBJECT_DIR"; @@ -189,7 +197,6 @@ cmNinjaNormalTargetGenerator vars.TargetVersionMajor = targetVersionMajor.c_str(); vars.TargetVersionMinor = targetVersionMinor.c_str(); - vars.LinkLibraries = "$LINK_LIBRARIES"; vars.Flags = "$FLAGS"; vars.LinkFlags = "$LINK_FLAGS"; @@ -227,7 +234,8 @@ cmNinjaNormalTargetGenerator description.str(), comment.str(), /*depfile*/ "", - rspfile); + rspfile, + rspcontent); } if (this->TargetNameOut != this->TargetNameReal) { @@ -365,8 +373,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() outputs.push_back(targetOutputReal); // Compute specific libraries to link with. - cmNinjaDeps explicitDeps = this->GetObjects(), - implicitDeps = this->ComputeLinkDeps(); + cmNinjaDeps explicitDeps = this->GetObjects(); + cmNinjaDeps implicitDeps = this->ComputeLinkDeps(); this->GetLocalGenerator()->GetTargetFlags(vars["LINK_LIBRARIES"], vars["FLAGS"], @@ -432,6 +440,9 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() path = GetTarget()->GetSupportDirectory(); vars["OBJECT_DIR"] = ConvertToNinjaPath(path.c_str()); EnsureDirectoryExists(path); + // ar.exe can't handle backslashes in rsp files (implictly used by gcc) + std::string& linkLibraries = vars["LINK_LIBRARIES"]; + std::replace(linkLibraries.begin(), linkLibraries.end(), '\\', '/'); } std::vector<cmCustomCommand> *cmdLists[3] = { @@ -478,12 +489,15 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() symlinkVars["POST_BUILD"] = postBuildCmdLine; } - int cmdLineLimit; -#ifdef _WIN32 - cmdLineLimit = 8000 - this->GetGlobalGenerator()-> + int linkRuleLength = this->GetGlobalGenerator()-> GetRuleCmdLength(this->LanguageLinkerRule()); +#ifdef _WIN32 + int commandLineLengthLimit = 8000 - linkRuleLength; +#elif defined(__linux) || defined(__APPLE__) + // for instance ARG_MAX is 2096152 on Ubuntu or 262144 on Mac + int commandLineLengthLimit = sysconf(_SC_ARG_MAX) - linkRuleLength - 1000; #else - cmdLineLimit = -1; // TODO + int commandLineLengthLimit = -1; #endif // Write the build statement for this target. @@ -495,7 +509,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() implicitDeps, emptyDeps, vars, - cmdLineLimit); + commandLineLengthLimit); if (targetOutput != targetOutputReal) { if (targetType == cmTarget::EXECUTABLE) { diff --git a/Source/cmProjectCommand.h b/Source/cmProjectCommand.h index 4b051af..88a1944 100644 --- a/Source/cmProjectCommand.h +++ b/Source/cmProjectCommand.h @@ -69,7 +69,7 @@ public: "C++ compiler, you can disable the check for it by explicitly listing " "the languages you want to support, e.g. C. By using the special " "language \"NONE\" all checks for any language can be disabled. " - "If a variable exists called CMAKE_PROJECT_<projectName>_INCLUDE_FILE, " + "If a variable exists called CMAKE_PROJECT_<projectName>_INCLUDE, " "the file pointed to by that variable will be included as the last step " "of the project command."; } diff --git a/Tests/CTestUpdateSVN.cmake.in b/Tests/CTestUpdateSVN.cmake.in index edafb4ef..15b833b 100644 --- a/Tests/CTestUpdateSVN.cmake.in +++ b/Tests/CTestUpdateSVN.cmake.in @@ -41,7 +41,6 @@ init_testing() #----------------------------------------------------------------------------- # Create the repository. message("Creating repository...") -file(MAKE_DIRECTORY ${TOP}/repo) run_child( COMMAND ${SVNADMIN} create --config-dir ${TOP}/config ${TOP}/repo ) diff --git a/Tests/CustomCommand/GeneratedHeader/main.cpp b/Tests/CustomCommand/GeneratedHeader/main.cpp index 1b3e85f..0b43ffe 100644 --- a/Tests/CustomCommand/GeneratedHeader/main.cpp +++ b/Tests/CustomCommand/GeneratedHeader/main.cpp @@ -1,5 +1,5 @@ #include "generated.h" -int main() +int mainGeneratedHeader() { return 0; } diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 23fc086..eca96f9 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -50,6 +50,7 @@ add_RunCMake_test(ObjectLibrary) add_RunCMake_test(build_command) add_RunCMake_test(find_package) +add_RunCMake_test(include) add_RunCMake_test(list) if("${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio [^6]") diff --git a/Tests/RunCMake/include/CMakeLists.txt b/Tests/RunCMake/include/CMakeLists.txt new file mode 100644 index 0000000..e8db6b0 --- /dev/null +++ b/Tests/RunCMake/include/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/include/EmptyString-stderr.txt b/Tests/RunCMake/include/EmptyString-stderr.txt new file mode 100644 index 0000000..006c647 --- /dev/null +++ b/Tests/RunCMake/include/EmptyString-stderr.txt @@ -0,0 +1,5 @@ +CMake Warning \(dev\) at EmptyString.cmake:1 \(include\): + include\(\) given empty file name \(ignored\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/include/EmptyString.cmake b/Tests/RunCMake/include/EmptyString.cmake new file mode 100644 index 0000000..4285cb3 --- /dev/null +++ b/Tests/RunCMake/include/EmptyString.cmake @@ -0,0 +1 @@ +include("") diff --git a/Tests/RunCMake/include/EmptyStringOptional-stderr.txt b/Tests/RunCMake/include/EmptyStringOptional-stderr.txt new file mode 100644 index 0000000..b61c679 --- /dev/null +++ b/Tests/RunCMake/include/EmptyStringOptional-stderr.txt @@ -0,0 +1,5 @@ +CMake Warning \(dev\) at EmptyStringOptional.cmake:1 \(include\): + include\(\) given empty file name \(ignored\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/include/EmptyStringOptional.cmake b/Tests/RunCMake/include/EmptyStringOptional.cmake new file mode 100644 index 0000000..549d46b --- /dev/null +++ b/Tests/RunCMake/include/EmptyStringOptional.cmake @@ -0,0 +1 @@ +include("" OPTIONAL) diff --git a/Tests/RunCMake/include/RunCMakeTest.cmake b/Tests/RunCMake/include/RunCMakeTest.cmake new file mode 100644 index 0000000..59b87ca --- /dev/null +++ b/Tests/RunCMake/include/RunCMakeTest.cmake @@ -0,0 +1,4 @@ +include(RunCMake) + +run_cmake(EmptyString) +run_cmake(EmptyStringOptional) |