diff options
51 files changed, 386 insertions, 62 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index bdc160d..28fd02f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -287,6 +287,13 @@ macro (CMAKE_BUILD_UTILITIES) if(CMAKE_TESTS_CDASH_SERVER) set(CMAKE_CURL_TEST_URL "${CMAKE_TESTS_CDASH_SERVER}/user.php") endif() + option(CMAKE_USE_OPENSSL "Use OpenSSL." OFF) + mark_as_advanced(CMAKE_USE_OPENSSL) + if(CMAKE_USE_OPENSSL) + set(CURL_CA_BUNDLE "" CACHE FILEPATH "Path to SSL CA Certificate Bundle") + set(CURL_CA_PATH "" CACHE PATH "Path to SSL CA Certificate Directory") + mark_as_advanced(CURL_CA_BUNDLE CURL_CA_PATH) + endif() add_subdirectory(Utilities/cmcurl) CMAKE_SET_TARGET_FOLDER(cmcurl "Utilities/3rdParty") CMAKE_SET_TARGET_FOLDER(LIBCURL "Utilities/3rdParty") diff --git a/Help/command/link_libraries.rst b/Help/command/link_libraries.rst index d690c9b..fd5dc37 100644 --- a/Help/command/link_libraries.rst +++ b/Help/command/link_libraries.rst @@ -1,16 +1,19 @@ link_libraries -------------- -Deprecated. Use the target_link_libraries() command instead. - Link libraries to all targets added later. :: - link_libraries(library1 <debug | optimized> library2 ...) + link_libraries([item1 [item2 [...]]] + [[debug|optimized|general] <item>] ...) + +Specify libraries or flags to use when linking any targets created later in +the current directory or below by commands such as :command:`add_executable` +or :command:`add_library`. See the :command:`target_link_libraries` command +for meaning of arguments. -Specify a list of libraries to be linked into any following targets -(typically added with the add_executable or add_library calls). This -command is passed down to all subdirectories. The debug and optimized -strings may be used to indicate that the next library listed is to be -used only for that specific type of build. +.. note:: + The :command:`target_link_libraries` command should be preferred whenever + possible. Library dependencies are chained automatically, so directory-wide + specification of link libraries is rarely needed. diff --git a/Help/command/try_run.rst b/Help/command/try_run.rst index 9a17ad9..b8ea0fe 100644 --- a/Help/command/try_run.rst +++ b/Help/command/try_run.rst @@ -6,8 +6,9 @@ Try compiling and then running some code. :: try_run(RUN_RESULT_VAR COMPILE_RESULT_VAR - bindir srcfile [CMAKE_FLAGS <Flags>] + bindir srcfile [CMAKE_FLAGS <flags>] [COMPILE_DEFINITIONS <flags>] + [LINK_LIBRARIES <libs>] [COMPILE_OUTPUT_VARIABLE comp] [RUN_OUTPUT_VARIABLE run] [OUTPUT_VARIABLE var] @@ -22,6 +23,12 @@ where the output from the compile step goes. RUN_OUTPUT_VARIABLE specifies the variable where the output from the running executable goes. +The srcfile signature also accepts a LINK_LIBRARIES argument which may +contain a list of libraries or IMPORTED targets which will be linked +to in the generated project. If LINK_LIBRARIES is specified as a +parameter to try_run, then any LINK_LIBRARIES passed as +CMAKE_FLAGS will be ignored. + For compatibility reasons OUTPUT_VARIABLE is still supported, which gives you the output from the compile and run step combined. diff --git a/Help/manual/cmake-commands.7.rst b/Help/manual/cmake-commands.7.rst index 4616dd1..c916f77 100644 --- a/Help/manual/cmake-commands.7.rst +++ b/Help/manual/cmake-commands.7.rst @@ -68,6 +68,7 @@ These commands may be used freely in CMake projects. /command/include /command/install /command/link_directories + /command/link_libraries /command/list /command/load_cache /command/load_command @@ -118,7 +119,6 @@ versions of CMake. Do not use them in new code. /command/install_files /command/install_programs /command/install_targets - /command/link_libraries /command/make_directory /command/output_required_files /command/remove diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index af2c348..c342dbe 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -181,6 +181,7 @@ Variables that Describe the System /variable/CMAKE_SYSTEM_VERSION /variable/CYGWIN /variable/ENV + /variable/MINGW /variable/MSVC10 /variable/MSVC11 /variable/MSVC12 diff --git a/Help/prop_tgt/INTERFACE_SYSTEM_INCLUDE_DIRECTORIES.rst b/Help/prop_tgt/INTERFACE_SYSTEM_INCLUDE_DIRECTORIES.rst index b54b6c1..a0a97ad 100644 --- a/Help/prop_tgt/INTERFACE_SYSTEM_INCLUDE_DIRECTORIES.rst +++ b/Help/prop_tgt/INTERFACE_SYSTEM_INCLUDE_DIRECTORIES.rst @@ -7,8 +7,15 @@ Targets may populate this property to publish the include directories which contain system headers, and therefore should not result in compiler warnings. The :command:`target_include_directories(SYSTEM)` command signature populates this property with values given to the -``PUBLIC`` and ``INTERFACE`` keywords. Projects may also get and set the -property directly. +``PUBLIC`` and ``INTERFACE`` keywords. + +Projects may also get and set the property directly, but must be aware that +adding directories to this property does not make those directories used +during compilation. Adding directories to this property marks directories +as ``SYSTEM`` which otherwise would be used in a non-``SYSTEM`` manner. This +can appear similar to 'duplication', so prefer the +high-level :command:`target_include_directories(SYSTEM)` command and avoid +setting the property by low-level means. When target dependencies are specified using :command:`target_link_libraries`, CMake will read this property from all target dependencies to mark the diff --git a/Help/release/dev/FindCUDA-cusolver.rst b/Help/release/dev/FindCUDA-cusolver.rst new file mode 100644 index 0000000..7a61e78 --- /dev/null +++ b/Help/release/dev/FindCUDA-cusolver.rst @@ -0,0 +1,5 @@ +FindCUDA-cusolver +----------------- + +* The :module:`FindCUDA` module learned about the ``cusolver`` + library in CUDA 7.0. diff --git a/Help/release/dev/console-pool.rst b/Help/release/dev/console-pool.rst index 19c2f19..1d9bdb8 100644 --- a/Help/release/dev/console-pool.rst +++ b/Help/release/dev/console-pool.rst @@ -5,4 +5,6 @@ console-pool commands learned a new ``USES_TERMINAL`` option to request that the command be given direct access to the terminal if possible. The :generator:`Ninja` generator will places such commands in the - ``console`` pool. + ``console`` pool. Build targets provided by CMake that are meant + for individual interactive use, such as ``install``, are now + placed in this pool. diff --git a/Help/release/dev/curl-default-cainfo.rst b/Help/release/dev/curl-default-cainfo.rst new file mode 100644 index 0000000..ed45d36 --- /dev/null +++ b/Help/release/dev/curl-default-cainfo.rst @@ -0,0 +1,8 @@ +curl-default-cainfo +------------------- + +* When CMake is built with OpenSSL on systems other than Windows + and OS X, commands supporting network communication via ``https``, + such as :command:`file(DOWNLOAD)`, :command:`file(UPLOAD)`, and + :command:`ctest_submit`, now search for OS-configured certificate + authorities in a few ``/etc`` paths to be trusted automatically. diff --git a/Help/release/dev/try-run-link-libraries.rst b/Help/release/dev/try-run-link-libraries.rst new file mode 100644 index 0000000..4f20cbd --- /dev/null +++ b/Help/release/dev/try-run-link-libraries.rst @@ -0,0 +1,5 @@ +try-run-link-libraries +---------------------- + +* The :command:`try_run` command learned to honor the ``LINK_LIBRARIES`` + option just as :command:`try_compile` already does. diff --git a/Help/variable/MINGW.rst b/Help/variable/MINGW.rst new file mode 100644 index 0000000..521d417 --- /dev/null +++ b/Help/variable/MINGW.rst @@ -0,0 +1,6 @@ +MINGW +----- + +True when using MinGW + +Set to true when the compiler is some version of MinGW. diff --git a/Modules/CTestTargets.cmake b/Modules/CTestTargets.cmake index 5b6e062..1157850 100644 --- a/Modules/CTestTargets.cmake +++ b/Modules/CTestTargets.cmake @@ -67,6 +67,7 @@ if(NOT _CTEST_TARGETS_ADDED) foreach(mode Experimental Nightly Continuous NightlyMemoryCheck) add_custom_target(${mode} ${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode} + USES_TERMINAL ) set_property(TARGET ${mode} PROPERTY RULE_LAUNCH_CUSTOM "") set_property(TARGET ${mode} PROPERTY FOLDER "CTestDashboardTargets") @@ -82,6 +83,7 @@ if(NOT _CTEST_TARGETS_ADDED) ) add_custom_target(${mode}${testtype} ${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode}${testtype} + USES_TERMINAL ) set_property(TARGET ${mode}${testtype} PROPERTY RULE_LAUNCH_CUSTOM "") set_property(TARGET ${mode}${testtype} PROPERTY FOLDER "CTestDashboardTargets") @@ -94,6 +96,7 @@ if(NOT _CTEST_TARGETS_ADDED) if(CTEST_TEST_TARGET_ALIAS) add_custom_target(${CTEST_TEST_TARGET_ALIAS} ${CMAKE_CTEST_COMMAND} ${__conf_types} + USES_TERMINAL ) endif() endif() diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 52d41eb..74e8ae2 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -1456,6 +1456,15 @@ function(ExternalProject_Add_Step name step) if(always) set_property(SOURCE ${stamp_file} PROPERTY SYMBOLIC 1) set(touch) + # Remove any existing stamp in case the option changed in an existing tree. + if(CMAKE_CONFIGURATION_TYPES) + foreach(cfg ${CMAKE_CONFIGURATION_TYPES}) + string(REPLACE "/${CMAKE_CFG_INTDIR}" "/${cfg}" stamp_file_config "${stamp_file}") + file(REMOVE ${stamp_file_config}) + endforeach() + else() + file(REMOVE ${stamp_file}) + endif() else() set(touch ${CMAKE_COMMAND} -E touch ${stamp_file}) endif() diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake index 9016db8..3eea9db 100644 --- a/Modules/FeatureSummary.cmake +++ b/Modules/FeatureSummary.cmake @@ -40,7 +40,7 @@ # [FATAL_ON_MISSING_REQUIRED_PACKAGES] # [DESCRIPTION "Found packages:"] # WHAT (ALL | PACKAGES_FOUND | PACKAGES_NOT_FOUND -# | ENABLED_FEATURES | DISABLED_FEATURES] +# | ENABLED_FEATURES | DISABLED_FEATURES) # ) # # @@ -265,7 +265,7 @@ # Does the same as SET_PACKAGE_INFO(<name> <description> <url> ) #============================================================================= -# Copyright 2007-2009 Kitware, Inc. +# Copyright 2007-2015 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index cae9214..81e1cad 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -483,6 +483,10 @@ mark_as_advanced( CUDA_HOST_COMPILATION_CPP CUDA_NVCC_FLAGS CUDA_PROPAGATE_HOST_FLAGS + CUDA_BUILD_CUBIN + CUDA_BUILD_EMULATION + CUDA_VERBOSE_BUILD + CUDA_SEPARABLE_COMPILATION ) # Makefile and similar generators don't define CMAKE_CONFIGURATION_TYPES, so we 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) ) { diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt index ef37dcb..aacf4c1 100644 --- a/Tests/CompileFeatures/CMakeLists.txt +++ b/Tests/CompileFeatures/CMakeLists.txt @@ -63,6 +63,14 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL SunPro) endif() if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" + AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.5) + # The cxx_raw_string_literals feature happens to work in some distributions + # of GNU 4.4, but it is first documented as available with GNU 4.5. + list(REMOVE_ITEM CXX_non_features + cxx_raw_string_literals + ) +endif() +if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6) # The cxx_constexpr feature happens to work (for *this* testcase) with # GNU 4.5, but it is first documented as available with GNU 4.6. diff --git a/Tests/Complex/Executable/CMakeLists.txt b/Tests/Complex/Executable/CMakeLists.txt index 508221c..a1f8e68 100644 --- a/Tests/Complex/Executable/CMakeLists.txt +++ b/Tests/Complex/Executable/CMakeLists.txt @@ -21,7 +21,7 @@ if(TARGET NotATarget) message(FATAL_ERROR "if(TARGET NotATarget) returned true!") endif() - # Use LINK_LIBRARIES instead of TARGET_LINK_LIBRARIES to +# Use LINK_LIBRARIES instead of TARGET_LINK_LIBRARIES to set(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared;CMakeTestCLibraryShared) link_libraries(${COMPLEX_LIBS}) diff --git a/Tests/ComplexOneConfig/Executable/CMakeLists.txt b/Tests/ComplexOneConfig/Executable/CMakeLists.txt index e910f20..b2307b2 100644 --- a/Tests/ComplexOneConfig/Executable/CMakeLists.txt +++ b/Tests/ComplexOneConfig/Executable/CMakeLists.txt @@ -21,7 +21,7 @@ if(TARGET NotATarget) message(FATAL_ERROR "if(TARGET NotATarget) returned true!") endif() - # Use LINK_LIBRARIES instead of TARGET_LINK_LIBRARIES to +# Use LINK_LIBRARIES instead of TARGET_LINK_LIBRARIES to set(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared;CMakeTestCLibraryShared) link_libraries(${COMPLEX_LIBS}) diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt index 9450c82..358776b 100644 --- a/Tests/ExportImport/Import/A/CMakeLists.txt +++ b/Tests/ExportImport/Import/A/CMakeLists.txt @@ -311,6 +311,21 @@ if (((CMAKE_C_COMPILER_ID STREQUAL GNU AND CMAKE_C_COMPILER_VERSION VERSION_GREA message(SEND_ERROR "EXP_ERROR_VARIABLE try_compile failed, but it was expected to succeed ${OUTPUT}.") endif() + if(NOT CMAKE_CROSSCOMPILING) + unset(EXP_RUN_VAR CACHE) + unset(EXP_COMPILE_VAR CACHE) + try_run(EXP_RUN_VAR EXP_COMPILE_VAR + "${CMAKE_CURRENT_SOURCE_DIR}/test_system" + "${CMAKE_CURRENT_SOURCE_DIR}/test_system.cpp" + COMPILE_DEFINITIONS "-Wunused-variable -Werror=unused-variable" + LINK_LIBRARIES exp_systemlib + OUTPUT_VARIABLE OUTPUT + ) + if(NOT EXP_COMPILE_VAR) + message(SEND_ERROR "try_run compile failed, but it was expected to succeed ${OUTPUT}.") + endif() + endif() + add_executable(test_system_bld test_system.cpp) target_link_libraries(test_system_bld bld_systemlib) target_compile_options(test_system_bld PRIVATE -Wunused-variable -Werror=unused-variable) @@ -326,5 +341,20 @@ if (((CMAKE_C_COMPILER_ID STREQUAL GNU AND CMAKE_C_COMPILER_VERSION VERSION_GREA if(NOT BLD_ERROR_VARIABLE) message(SEND_ERROR "BLD_ERROR_VARIABLE try_compile failed, but it was expected to succeed.") endif() + + if(NOT CMAKE_CROSSCOMPILING) + unset(BLD_RUN_VAR CACHE) + unset(BLD_COMPILE_VAR CACHE) + try_run(BLD_RUN_VAR BLD_COMPILE_VAR + "${CMAKE_CURRENT_SOURCE_DIR}/test_system" + "${CMAKE_CURRENT_SOURCE_DIR}/test_system.cpp" + COMPILE_DEFINITIONS "-Wunused-variable -Werror=unused-variable" + LINK_LIBRARIES bld_systemlib + OUTPUT_VARIABLE OUTPUT + ) + if(NOT BLD_COMPILE_VAR) + message(SEND_ERROR "try_run compile failed, but it was expected to succeed ${OUTPUT}.") + endif() + endif() endif() endif() diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt index abe9f74..0215e93 100644 --- a/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt +++ b/Tests/IncludeDirectories/SystemIncludeDirectories/CMakeLists.txt @@ -14,8 +14,14 @@ target_include_directories(upstream SYSTEM PUBLIC $<TARGET_PROPERTY:systemlib,INTERFACE_INCLUDE_DIRECTORIES> ) +add_library(config_specific INTERFACE) +set(testConfig ${CMAKE_BUILD_TYPE}) +target_include_directories(config_specific SYSTEM INTERFACE + "$<$<CONFIG:${testConfig}>:${CMAKE_CURRENT_SOURCE_DIR}/config_specific>" +) + add_library(consumer consumer.cpp) -target_link_libraries(consumer upstream) +target_link_libraries(consumer upstream config_specific) target_compile_options(consumer PRIVATE -Werror=unused-variable) add_library(iface IMPORTED INTERFACE) diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/config_specific/config_iface.h b/Tests/IncludeDirectories/SystemIncludeDirectories/config_specific/config_iface.h new file mode 100644 index 0000000..05d3604 --- /dev/null +++ b/Tests/IncludeDirectories/SystemIncludeDirectories/config_specific/config_iface.h @@ -0,0 +1,14 @@ + +#ifndef CONFIG_IFACE_H +#define CONFIG_IFACE_H + +#ifdef _WIN32 +__declspec(dllexport) +#endif +int configUnusedFunc() +{ + int unused; + return 0; +} + +#endif diff --git a/Tests/IncludeDirectories/SystemIncludeDirectories/consumer.cpp b/Tests/IncludeDirectories/SystemIncludeDirectories/consumer.cpp index 197dae8..be18ebf 100644 --- a/Tests/IncludeDirectories/SystemIncludeDirectories/consumer.cpp +++ b/Tests/IncludeDirectories/SystemIncludeDirectories/consumer.cpp @@ -1,6 +1,8 @@ #include "upstream.h" +#include "config_iface.h" + int consumer() { return upstream(); diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 12c1f47..d1457a7 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -133,6 +133,7 @@ add_RunCMake_test(project) add_RunCMake_test(return) add_RunCMake_test(string) add_RunCMake_test(try_compile) +add_RunCMake_test(try_run) add_RunCMake_test(set) add_RunCMake_test(variable_watch) add_RunCMake_test(CMP0004) diff --git a/Tests/RunCMake/try_compile/BadLinkLibraries-stderr.txt b/Tests/RunCMake/try_compile/BadLinkLibraries-stderr.txt index eceffec..652bcfc 100644 --- a/Tests/RunCMake/try_compile/BadLinkLibraries-stderr.txt +++ b/Tests/RunCMake/try_compile/BadLinkLibraries-stderr.txt @@ -1,5 +1,5 @@ CMake Error at BadLinkLibraries.cmake:2 \(try_compile\): - Only libraries may be used as try_compile IMPORTED LINK_LIBRARIES. Got - not_a_library of type UTILITY. + Only libraries may be used as try_compile or try_run IMPORTED + LINK_LIBRARIES. Got not_a_library of type UTILITY. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_run/BadLinkLibraries-result.txt b/Tests/RunCMake/try_run/BadLinkLibraries-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_run/BadLinkLibraries-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_run/BadLinkLibraries-stderr.txt b/Tests/RunCMake/try_run/BadLinkLibraries-stderr.txt new file mode 100644 index 0000000..dcd1bfc --- /dev/null +++ b/Tests/RunCMake/try_run/BadLinkLibraries-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at BadLinkLibraries.cmake:2 \(try_run\): + Only libraries may be used as try_compile or try_run IMPORTED + LINK_LIBRARIES. Got not_a_library of type UTILITY. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_run/BadLinkLibraries.cmake b/Tests/RunCMake/try_run/BadLinkLibraries.cmake new file mode 100644 index 0000000..a124bf6 --- /dev/null +++ b/Tests/RunCMake/try_run/BadLinkLibraries.cmake @@ -0,0 +1,4 @@ +add_custom_target(not_a_library) +try_run(RUN_RESULT COMPILE_RESULT + ${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp ${CMAKE_CURRENT_SOURCE_DIR}/src.c + LINK_LIBRARIES not_a_library) diff --git a/Tests/RunCMake/try_run/CMakeLists.txt b/Tests/RunCMake/try_run/CMakeLists.txt new file mode 100644 index 0000000..e034780 --- /dev/null +++ b/Tests/RunCMake/try_run/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.0) +project(${RunCMake_TEST} C) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/try_run/RunCMakeTest.cmake b/Tests/RunCMake/try_run/RunCMakeTest.cmake new file mode 100644 index 0000000..1ec9a55 --- /dev/null +++ b/Tests/RunCMake/try_run/RunCMakeTest.cmake @@ -0,0 +1,3 @@ +include(RunCMake) + +run_cmake(BadLinkLibraries) diff --git a/Tests/RunCMake/try_run/src.c b/Tests/RunCMake/try_run/src.c new file mode 100644 index 0000000..78f2de1 --- /dev/null +++ b/Tests/RunCMake/try_run/src.c @@ -0,0 +1 @@ +int main(void) { return 0; } diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt index 0db741e..08bdff5 100644 --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt @@ -425,9 +425,6 @@ endif() #----------------------------------------------------------------------------- -option(CMAKE_USE_OPENSSL "Use OpenSSL code. Experimental" OFF) -mark_as_advanced(CMAKE_USE_OPENSSL) - set(USE_SSLEAY OFF) set(USE_OPENSSL OFF) set(HAVE_LIBCRYPTO OFF) @@ -454,11 +451,13 @@ if(CMAKE_USE_OPENSSL) check_include_file("openssl/rand.h" HAVE_OPENSSL_RAND_H) # Optionally build with a specific CA cert bundle. - set(CURL_CA_BUNDLE "" CACHE FILEPATH "Path to SSL CA Certificate Bundle") - mark_as_advanced(CURL_CA_BUNDLE) if(CURL_CA_BUNDLE) add_definitions(-DCURL_CA_BUNDLE="${CURL_CA_BUNDLE}") endif() + # Optionally build with a specific CA cert dir. + if(CURL_CA_PATH) + add_definitions(-DCURL_CA_PATH="${CURL_CA_PATH}") + endif() endif(OPENSSL_FOUND) elseif(WIN32) # Use Windows SSL/TLS native implementation. diff --git a/Utilities/cmcurl/README-CMake.txt b/Utilities/cmcurl/README-CMake.txt new file mode 100644 index 0000000..3f053d8 --- /dev/null +++ b/Utilities/cmcurl/README-CMake.txt @@ -0,0 +1,66 @@ +The Utilities/cmcurl directory contains a reduced distribution +of the curl source tree with only the library source code and +CMake build system. It is not a submodule; the actual content is part +of our source tree and changes can be made and committed directly. + +We update from upstream using Git's "subtree" merge strategy. A +special branch contains commits of upstream curl snapshots and +nothing else. No Git ref points explicitly to the head of this +branch, but it is merged into our history. + +Update curl from upstream as follows. Create a local branch to +explicitly reference the upstream snapshot branch head: + + git branch curl-upstream 3fe5d9bf + +Use a temporary directory to checkout the branch: + + mkdir curl-tmp + cd curl-tmp + git init + git pull .. curl-upstream + rm -rf * + +Now place the (reduced) curl content in this directory. See +instructions shown by + + git log 3fe5d9bf + +for help extracting the content from the upstream repo. Then run +the following commands to commit the new version. Substitute the +appropriate date and version number: + + git add --all + + GIT_AUTHOR_NAME='Curl Upstream' \ + GIT_AUTHOR_EMAIL='curl-library@cool.haxx.se' \ + GIT_AUTHOR_DATE='Wed Sep 10 08:07:58 2014 +0200' \ + git commit -m 'curl 7.38.0 (reduced)' && + git commit --amend + +Edit the commit message to describe the procedure used to obtain the +content. Then push the changes back up to the main local repository: + + git push .. HEAD:curl-upstream + cd .. + rm -rf curl-tmp + +Create a topic in the main repository on which to perform the update: + + git checkout -b update-curl master + +Merge the curl-upstream branch as a subtree: + + git merge -s recursive -X subtree=Utilities/cmcurl \ + curl-upstream + +If there are conflicts, resolve them and commit. Build and test the +tree. Commit any additional changes needed to succeed. + +Finally, run + + git rev-parse --short=8 curl-upstream + +to get the commit from which the curl-upstream branch must be started +on the next update. Edit the "git branch curl-upstream" line above to +record it, and commit this file. diff --git a/Utilities/cmcurl/lib/curl_config.h.cmake b/Utilities/cmcurl/lib/curl_config.h.cmake index b5db3b6..a561c3d 100644 --- a/Utilities/cmcurl/lib/curl_config.h.cmake +++ b/Utilities/cmcurl/lib/curl_config.h.cmake @@ -3,12 +3,6 @@ /* when building libcurl itself */ #cmakedefine BUILDING_LIBCURL 1 -/* Location of default ca bundle */ -#cmakedefine CURL_CA_BUNDLE ${CURL_CA_BUNDLE} - -/* Location of default ca path */ -#cmakedefine CURL_CA_PATH ${CURL_CA_PATH} - /* to disable cookies support */ #cmakedefine CURL_DISABLE_COOKIES 1 |