diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CMakeLists.txt | 8 | ||||
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestSubmitHandler.cxx | 3 | ||||
-rw-r--r-- | Source/QtDialog/CMakeSetupDialog.cxx | 2 | ||||
-rw-r--r-- | Source/QtDialog/CMakeSetupDialog.ui | 2 | ||||
-rw-r--r-- | Source/QtDialog/QMacInstallDialog.cxx | 6 | ||||
-rw-r--r-- | Source/cmCTest.cxx | 3 | ||||
-rw-r--r-- | Source/cmCoreTryCompile.cxx | 2 | ||||
-rw-r--r-- | Source/cmCurl.cxx | 64 | ||||
-rw-r--r-- | Source/cmCurl.h | 21 | ||||
-rw-r--r-- | Source/cmFileCommand.cxx | 9 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 14 | ||||
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 3 | ||||
-rw-r--r-- | Source/cmNinjaNormalTargetGenerator.cxx | 29 | ||||
-rw-r--r-- | Source/cmNinjaTargetGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/cmTryRunCommand.cxx | 3 | ||||
-rw-r--r-- | Source/cmake.cxx | 2 | ||||
-rw-r--r-- | Source/kwsys/Directory.cxx | 5 |
18 files changed, 151 insertions, 31 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index c04cf9a..07839f3 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -175,6 +175,8 @@ set(SRCS cmCPackPropertiesGenerator.cxx cmCryptoHash.cxx cmCryptoHash.h + cmCurl.cxx + cmCurl.h cmCustomCommand.cxx cmCustomCommand.h cmCustomCommandGenerator.cxx @@ -497,6 +499,12 @@ if(WIN32 AND NOT CYGWIN) install(TARGETS cmcldeps DESTINATION bin) endif() +foreach(v CURL_CA_BUNDLE CURL_CA_PATH) + if(${v}) + set_property(SOURCE cmCurl.cxx APPEND PROPERTY COMPILE_DEFINITIONS ${v}="${${v}}") + endif() +endforeach() + # create a library used by the command line and the GUI add_library(CMakeLib ${SRCS}) target_link_libraries(CMakeLib cmsys diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 25cde98..edd2e5a 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 1) -set(CMake_VERSION_PATCH 20150123) +set(CMake_VERSION_PATCH 20150127) #set(CMake_VERSION_RC 1) diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 11e3343..3d9545f 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -26,7 +26,7 @@ #include <cm_jsoncpp_reader.h> // For curl submission -#include "cm_curl.h" +#include "cmCurl.h" #include "cmCTestCurl.h" #include <sys/stat.h> @@ -366,6 +366,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, curl = curl_easy_init(); if(curl) { + cmCurlSetCAInfo(curl); if(verifyPeerOff) { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index 0574681..b8077f2 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -119,7 +119,7 @@ CMakeSetupDialog::CMakeSetupDialog() QAction* showChangesAction = ToolsMenu->addAction(tr("&Show My Changes")); QObject::connect(showChangesAction, SIGNAL(triggered(bool)), this, SLOT(showUserChanges())); -#if defined(Q_WS_MAC) +#if defined(Q_WS_MAC) || defined(Q_OS_MAC) this->InstallForCommandLineAction = ToolsMenu->addAction(tr("&Install For Command Line Use")); QObject::connect(this->InstallForCommandLineAction, SIGNAL(triggered(bool)), diff --git a/Source/QtDialog/CMakeSetupDialog.ui b/Source/QtDialog/CMakeSetupDialog.ui index 98da249..b04bd93 100644 --- a/Source/QtDialog/CMakeSetupDialog.ui +++ b/Source/QtDialog/CMakeSetupDialog.ui @@ -134,7 +134,7 @@ </property> <property name="sizeHint" stdset="0"> <size> - <width>40</width> + <width>12</width> <height>23</height> </size> </property> diff --git a/Source/QtDialog/QMacInstallDialog.cxx b/Source/QtDialog/QMacInstallDialog.cxx index 8b8c531..fa7df43 100644 --- a/Source/QtDialog/QMacInstallDialog.cxx +++ b/Source/QtDialog/QMacInstallDialog.cxx @@ -15,11 +15,11 @@ QMacInstallDialog::QMacInstallDialog(QWidget*w) { this->Internals = new QMacInstallDialogInternals; this->Internals->setupUi(this); - QObject::connect(this->Internals->choosePathButton, SIGNAL(pressed()), + QObject::connect(this->Internals->choosePathButton, SIGNAL(clicked(bool)), this, SLOT(ShowBrowser())); - QObject::connect(this->Internals->skipInstallButton, SIGNAL(pressed()), + QObject::connect(this->Internals->skipInstallButton, SIGNAL(clicked(bool)), this, SLOT(SkipInstall())); - QObject::connect(this->Internals->doInstallButton, SIGNAL(pressed()), + QObject::connect(this->Internals->doInstallButton, SIGNAL(clicked(bool)), this, SLOT(DoInstall())); this->Internals->InstallPrefix->setText("/usr/bin/"); diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 1ef4c92..f08b87c 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -9,7 +9,7 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#include "cm_curl.h" +#include "cmCurl.h" // include before anything that includes windows.h #include "cmCTest.h" #include "cmake.h" @@ -192,6 +192,7 @@ int cmCTest::HTTPRequest(std::string url, HTTPMethod method, FILE* file; ::curl_global_init(CURL_GLOBAL_ALL); curl = ::curl_easy_init(); + cmCurlSetCAInfo(curl); //set request options based on method switch(method) diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 60d8dd9..5b5d6b6 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -109,7 +109,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv) } default: this->Makefile->IssueMessage(cmake::FATAL_ERROR, - "Only libraries may be used as try_compile IMPORTED " + "Only libraries may be used as try_compile or try_run IMPORTED " "LINK_LIBRARIES. Got " + std::string(tgt->GetName()) + " of " "type " + tgt->GetTargetTypeName(tgt->GetType()) + "."); return -1; diff --git a/Source/cmCurl.cxx b/Source/cmCurl.cxx new file mode 100644 index 0000000..96d3547 --- /dev/null +++ b/Source/cmCurl.cxx @@ -0,0 +1,64 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2015 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmCurl.h" +#include "cmSystemTools.h" + +#define check_curl_result(result, errstr) \ + if (result != CURLE_OK) \ + { \ + e += e.empty()? "" : "\n"; \ + e += errstr; \ + e += ::curl_easy_strerror(result); \ + } + +//---------------------------------------------------------------------------- +std::string cmCurlSetCAInfo(::CURL *curl, const char* cafile) +{ + std::string e; + if(cafile && *cafile) + { + ::CURLcode res = ::curl_easy_setopt(curl, CURLOPT_CAINFO, cafile); + check_curl_result(res, "Unable to set TLS/SSL Verify CAINFO: "); + } +#if !defined(CMAKE_USE_SYSTEM_CURL) && \ + !defined(_WIN32) && !defined(__APPLE__) && \ + !defined(CURL_CA_BUNDLE) && !defined(CURL_CA_PATH) +# define CMAKE_CAFILE_FEDORA "/etc/pki/tls/certs/ca-bundle.crt" + else if(cmSystemTools::FileExists(CMAKE_CAFILE_FEDORA, true)) + { + ::CURLcode res = + ::curl_easy_setopt(curl, CURLOPT_CAINFO, CMAKE_CAFILE_FEDORA); + check_curl_result(res, "Unable to set TLS/SSL Verify CAINFO: "); + } +# undef CMAKE_CAFILE_FEDORA + else + { +# define CMAKE_CAFILE_COMMON "/etc/ssl/certs/ca-certificates.crt" + if(cmSystemTools::FileExists(CMAKE_CAFILE_COMMON, true)) + { + ::CURLcode res = + ::curl_easy_setopt(curl, CURLOPT_CAINFO, CMAKE_CAFILE_COMMON); + check_curl_result(res, "Unable to set TLS/SSL Verify CAINFO: "); + } +# undef CMAKE_CAFILE_COMMON +# define CMAKE_CAPATH_COMMON "/etc/ssl/certs" + if(cmSystemTools::FileIsDirectory(CMAKE_CAPATH_COMMON)) + { + ::CURLcode res = + ::curl_easy_setopt(curl, CURLOPT_CAPATH, CMAKE_CAPATH_COMMON); + check_curl_result(res, "Unable to set TLS/SSL Verify CAPATH: "); + } +# undef CMAKE_CAPATH_COMMON + } +#endif + return e; +} diff --git a/Source/cmCurl.h b/Source/cmCurl.h new file mode 100644 index 0000000..0c5609c --- /dev/null +++ b/Source/cmCurl.h @@ -0,0 +1,21 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2015 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmCurl_h +#define cmCurl_h + +#include <cmsys/Configure.h> +#include "cm_curl.h" +#include "cmStandardIncludes.h" + +std::string cmCurlSetCAInfo(::CURL *curl, const char* cafile = 0); + +#endif diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 2c92db2..f125292 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -20,7 +20,7 @@ #include "cmTimestamp.h" #if defined(CMAKE_BUILD_WITH_CMAKE) -#include "cm_curl.h" +#include "cmCurl.h" #include "cmFileLockResult.h" #endif @@ -3068,10 +3068,11 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) } // check to see if a CAINFO file has been specified // command arg comes first - if(cainfo && *cainfo) + std::string const& cainfo_err = cmCurlSetCAInfo(curl, cainfo); + if (!cainfo_err.empty()) { - res = ::curl_easy_setopt(curl, CURLOPT_CAINFO, cainfo); - check_curl_result(res, "Unable to set TLS/SSL Verify CAINFO: "); + this->SetError(cainfo_err); + return false; } cmFileCommandVectorOfChar chunkDebug; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index dd3b1ec..4c95a9f 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2191,7 +2191,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) = this->CreateGlobalTarget(this->GetPackageTargetName(), "Run CPack packaging tool...", &cpackCommandLines, depends, - workingDir.c_str(), /*uses_terminal*/false); + workingDir.c_str(), /*uses_terminal*/true); } // CPack source const char* packageSourceTargetName = this->GetPackageSourceTargetName(); @@ -2215,7 +2215,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) = this->CreateGlobalTarget(packageSourceTargetName, "Run CPack packaging tool for source...", &cpackCommandLines, depends, - workingDir.c_str(), /*uses_terminal*/false); + workingDir.c_str(), /*uses_terminal*/true); } } @@ -2241,7 +2241,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) (*targets)[this->GetTestTargetName()] = this->CreateGlobalTarget(this->GetTestTargetName(), "Running tests...", &cpackCommandLines, depends, 0, - /*uses_terminal*/false); + /*uses_terminal*/true); } //Edit Cache @@ -2296,7 +2296,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) (*targets)[rebuildCacheTargetName] = this->CreateGlobalTarget( rebuildCacheTargetName, "Running CMake to regenerate build system...", - &cpackCommandLines, depends, 0, /*uses_terminal*/false); + &cpackCommandLines, depends, 0, /*uses_terminal*/true); } //Install @@ -2377,7 +2377,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) (*targets)[this->GetInstallTargetName()] = this->CreateGlobalTarget( this->GetInstallTargetName(), "Install the project...", - &cpackCommandLines, depends, 0, /*uses_terminal*/false); + &cpackCommandLines, depends, 0, /*uses_terminal*/true); // install_local if(const char* install_local = this->GetInstallLocalTargetName()) @@ -2393,7 +2393,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) (*targets)[install_local] = this->CreateGlobalTarget( install_local, "Installing only the local directory...", - &cpackCommandLines, depends, 0, /*uses_terminal*/false); + &cpackCommandLines, depends, 0, /*uses_terminal*/true); } // install_strip @@ -2410,7 +2410,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) (*targets)[install_strip] = this->CreateGlobalTarget( install_strip, "Installing the project stripped...", - &cpackCommandLines, depends, 0, /*uses_terminal*/false); + &cpackCommandLines, depends, 0, /*uses_terminal*/true); } } } diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index f8471fd..7ed0c10 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1870,7 +1870,8 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags, std::string includeFlags = this->LocalGenerator->GetIncludeFlags(includes, this->GeneratorTarget, - lang, false, useResponseFile); + lang, false, useResponseFile, + config); if(includeFlags.empty()) { return; diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 32a5ccf..c352c1a 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -22,6 +22,7 @@ #include <assert.h> #include <algorithm> +#include <limits> #ifndef _WIN32 #include <unistd.h> @@ -366,15 +367,29 @@ cmNinjaNormalTargetGenerator static int calculateCommandLineLengthLimit(int linkRuleLength) { + static int const limits[] = { #ifdef _WIN32 - return 8000 - linkRuleLength; -#elif defined(__linux) || defined(__APPLE__) || defined(__HAIKU__) - // for instance ARG_MAX is 2096152 on Ubuntu or 262144 on Mac - return ((int)sysconf(_SC_ARG_MAX)) - linkRuleLength - 1000; -#else - (void)linkRuleLength; - return -1; + 8000, #endif +#if defined(__APPLE__) || defined(__HAIKU__) || defined(__linux) + // for instance ARG_MAX is 2096152 on Ubuntu or 262144 on Mac + ((int)sysconf(_SC_ARG_MAX)) - 1000, +#endif +#if defined(__linux) + // #define MAX_ARG_STRLEN (PAGE_SIZE * 32) in Linux's binfmts.h + ((int)sysconf(_SC_PAGESIZE) * 32) - 1000, +#endif + std::numeric_limits<int>::max() + }; + + size_t const arrSz = cmArraySize(limits); + int const sz = *std::min_element(limits, limits + arrSz); + if (sz == std::numeric_limits<int>::max()) + { + return -1; + } + + return sz - linkRuleLength; } diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index c019ceb..67824c6 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -170,8 +170,10 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile const* source, std::string includeFlags = this->LocalGenerator->GetIncludeFlags(includes, this->GeneratorTarget, language, - language == "RC" ? true : false); // full include paths for RC + language == "RC" ? true : false, // full include paths for RC // needed by cmcldeps + false, + this->GetConfigName()); if(cmGlobalNinjaGenerator::IsMinGW()) cmSystemTools::ReplaceString(includeFlags, "\\", "/"); diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx index 3daf61e..b5280cf 100644 --- a/Source/cmTryRunCommand.cxx +++ b/Source/cmTryRunCommand.cxx @@ -48,7 +48,8 @@ bool cmTryRunCommand { ++i; while (i < argv.size() && argv[i] != "COMPILE_DEFINITIONS" && - argv[i] != "CMAKE_FLAGS") + argv[i] != "CMAKE_FLAGS" && + argv[i] != "LINK_LIBRARIES") { runArgs += " "; runArgs += argv[i]; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 29d8206..652e451 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -437,7 +437,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args) return false; } } - std::cerr << "loading initial cache file " << path << "\n"; + std::cout << "loading initial cache file " << path << "\n"; this->ReadListFile(args, path.c_str()); } else if(arg.find("-P",0) == 0) diff --git a/Source/kwsys/Directory.cxx b/Source/kwsys/Directory.cxx index 04b2866..58cea63 100644 --- a/Source/kwsys/Directory.cxx +++ b/Source/kwsys/Directory.cxx @@ -244,6 +244,11 @@ unsigned long Directory::GetNumberOfFilesInDirectory(const kwsys_stl::string& na { DIR* dir = opendir(name.c_str()); + if (!dir) + { + return 0; + } + unsigned long count = 0; for (kwsys_dirent* d = readdir(dir); d; d = readdir(dir) ) { |