diff options
-rw-r--r-- | Help/manual/cmake-buildsystem.7.rst | 2 | ||||
-rw-r--r-- | Help/manual/cmake-variables.7.rst | 1 | ||||
-rw-r--r-- | Help/release/dev/capture-clang-tidy-errors.rst | 6 | ||||
-rw-r--r-- | Help/release/dev/imported-interface-no-system.rst | 5 | ||||
-rw-r--r-- | Help/variable/CMAKE_INSTALL_PREFIX.rst | 2 | ||||
-rw-r--r-- | Help/variable/CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT.rst | 14 | ||||
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 5 | ||||
-rw-r--r-- | Source/cmTargetPropertyComputer.cxx | 1 | ||||
-rw-r--r-- | Source/cmcmd.cxx | 24 | ||||
-rw-r--r-- | Source/kwsys/ConsoleBuf.hxx.in | 11 | ||||
-rw-r--r-- | Tests/InterfaceLibrary/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/ClangTidy/C-bad-Build-result.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/ClangTidy/C-bad-Build-stdout.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/ClangTidy/C-bad.cmake | 3 | ||||
-rw-r--r-- | Tests/RunCMake/ClangTidy/RunCMakeTest.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/pseudo_iwyu.c | 3 | ||||
-rw-r--r-- | Tests/RunCMake/pseudo_tidy.c | 6 |
18 files changed, 81 insertions, 9 deletions
diff --git a/Help/manual/cmake-buildsystem.7.rst b/Help/manual/cmake-buildsystem.7.rst index 4950fee..2e6a803 100644 --- a/Help/manual/cmake-buildsystem.7.rst +++ b/Help/manual/cmake-buildsystem.7.rst @@ -964,6 +964,8 @@ are: * ``EXPORT_NAME`` * ``IMPORTED`` * ``NAME`` +* ``NO_SYSTEM_FROM_IMPORTED`` +* Properties matching ``IMPORTED_LIBNAME_*`` * Properties matching ``MAP_IMPORTED_CONFIG_*`` ``INTERFACE`` libraries may be installed and exported. Any content they refer diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index d68265d..460c0b5 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -149,6 +149,7 @@ Variables that Change Behavior /variable/CMAKE_INSTALL_DEFAULT_COMPONENT_NAME /variable/CMAKE_INSTALL_MESSAGE /variable/CMAKE_INSTALL_PREFIX + /variable/CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT /variable/CMAKE_LIBRARY_PATH /variable/CMAKE_MFC_FLAG /variable/CMAKE_MODULE_PATH diff --git a/Help/release/dev/capture-clang-tidy-errors.rst b/Help/release/dev/capture-clang-tidy-errors.rst new file mode 100644 index 0000000..14c32e6 --- /dev/null +++ b/Help/release/dev/capture-clang-tidy-errors.rst @@ -0,0 +1,6 @@ +capture-clang-tidy-errors +------------------------- + +* If a command specified by the :prop_tgt:`<LANG>_CLANG_TIDY` target property + returns non-zero at build time this is now treated as an error instead of + silently ignored. diff --git a/Help/release/dev/imported-interface-no-system.rst b/Help/release/dev/imported-interface-no-system.rst new file mode 100644 index 0000000..3a727cc --- /dev/null +++ b/Help/release/dev/imported-interface-no-system.rst @@ -0,0 +1,5 @@ +imported-interface-no-system +---------------------------- + +* The :prop_tgt:`NO_SYSTEM_FROM_IMPORTED` target property is now supported + on :ref:`Imported <Imported Targets>` :ref:`Interface Libraries`. diff --git a/Help/variable/CMAKE_INSTALL_PREFIX.rst b/Help/variable/CMAKE_INSTALL_PREFIX.rst index 86f1944..7bd87d6 100644 --- a/Help/variable/CMAKE_INSTALL_PREFIX.rst +++ b/Help/variable/CMAKE_INSTALL_PREFIX.rst @@ -6,6 +6,8 @@ Install directory used by :command:`install`. If ``make install`` is invoked or ``INSTALL`` is built, this directory is prepended onto all install directories. This variable defaults to ``/usr/local`` on UNIX and ``c:/Program Files/${PROJECT_NAME}`` on Windows. +See :variable:`CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT` for how a +project might choose its own default. On UNIX one can use the ``DESTDIR`` mechanism in order to relocate the whole installation. ``DESTDIR`` means DESTination DIRectory. It is diff --git a/Help/variable/CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT.rst b/Help/variable/CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT.rst new file mode 100644 index 0000000..2a5842d --- /dev/null +++ b/Help/variable/CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT.rst @@ -0,0 +1,14 @@ +CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT +------------------------------------------- + +CMake sets this variable to a ``TRUE`` value when the +:variable:`CMAKE_INSTALL_PREFIX` has just been initialized to +its default value, typically on the first run of CMake within +a new build tree. This can be used by project code to change +the default without overriding a user-provided value: + +.. code-block:: cmake + + if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "/my/default" CACHE PATH "..." FORCE) + endif() diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 35bdcc0..79f08af 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 7) -set(CMake_VERSION_PATCH 20161120) +set(CMake_VERSION_PATCH 20161122) #set(CMake_VERSION_RC 1) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 54bdfe6..f5d9e61 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -253,7 +253,6 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, this->SetPropertyDefault("WIN32_EXECUTABLE", CM_NULLPTR); this->SetPropertyDefault("MACOSX_BUNDLE", CM_NULLPTR); this->SetPropertyDefault("MACOSX_RPATH", CM_NULLPTR); - this->SetPropertyDefault("NO_SYSTEM_FROM_IMPORTED", CM_NULLPTR); this->SetPropertyDefault("C_CLANG_TIDY", CM_NULLPTR); this->SetPropertyDefault("C_COMPILER_LAUNCHER", CM_NULLPTR); this->SetPropertyDefault("C_INCLUDE_WHAT_YOU_USE", CM_NULLPTR); @@ -271,6 +270,10 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, this->SetPropertyDefault("LINK_SEARCH_END_STATIC", CM_NULLPTR); } + if (this->GetType() != cmStateEnums::UTILITY) { + this->SetPropertyDefault("NO_SYSTEM_FROM_IMPORTED", CM_NULLPTR); + } + // Collect the set of configuration types. std::vector<std::string> configNames; mf->GetConfigurations(configNames); diff --git a/Source/cmTargetPropertyComputer.cxx b/Source/cmTargetPropertyComputer.cxx index 3a9bddb..a57bc5a 100644 --- a/Source/cmTargetPropertyComputer.cxx +++ b/Source/cmTargetPropertyComputer.cxx @@ -66,6 +66,7 @@ bool cmTargetPropertyComputer::WhiteListedInterfaceProperty( } if (prop == "IMPORTED_CONFIGURATIONS" || prop == "IMPORTED_LIBNAME" || + prop == "NO_SYSTEM_FROM_IMPORTED" || cmHasLiteralPrefix(prop, "IMPORTED_LIBNAME_") || cmHasLiteralPrefix(prop, "MAP_IMPORTED_CONFIG_")) { return true; diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 1db147a..f1ce75a 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -327,6 +327,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) iwyu_cmd.insert(iwyu_cmd.end(), orig_cmd.begin() + 1, orig_cmd.end()); // Run the iwyu command line. Capture its stderr and hide its stdout. + // Ignore its return code because the tool always returns non-zero. std::string stdErr; if (!cmSystemTools::RunSingleCommand(iwyu_cmd, CM_NULLPTR, &stdErr, &ret, CM_NULLPTR, @@ -357,14 +358,21 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) // Run the tidy command line. Capture its stdout and hide its stderr. std::string stdOut; - if (!cmSystemTools::RunSingleCommand(tidy_cmd, &stdOut, CM_NULLPTR, - &ret, CM_NULLPTR, + std::string stdErr; + if (!cmSystemTools::RunSingleCommand(tidy_cmd, &stdOut, &stdErr, &ret, + CM_NULLPTR, cmSystemTools::OUTPUT_NONE)) { - std::cerr << "Error running '" << tidy_cmd[0] << "'\n"; + std::cerr << "Error running '" << tidy_cmd[0] << "': " << stdErr + << "\n"; return 1; } // Output the stdout from clang-tidy to stderr std::cerr << stdOut; + // If clang-tidy exited with an error do the same. + if (ret != 0) { + std::cerr << stdErr; + return ret; + } } if (!lwyu.empty()) { // Construct the ldd -r -u (link what you use lwyu) command line @@ -377,11 +385,15 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) // Run the ldd -u -r command line. // Capture its stdout and hide its stderr. + // Ignore its return code because the tool always returns non-zero + // if there are any warnings, but we just want to warn. std::string stdOut; - if (!cmSystemTools::RunSingleCommand(lwyu_cmd, &stdOut, CM_NULLPTR, - &ret, CM_NULLPTR, + std::string stdErr; + if (!cmSystemTools::RunSingleCommand(lwyu_cmd, &stdOut, &stdErr, &ret, + CM_NULLPTR, cmSystemTools::OUTPUT_NONE)) { - std::cerr << "Error running '" << lwyu_cmd[0] << "'\n"; + std::cerr << "Error running '" << lwyu_cmd[0] << "': " << stdErr + << "\n"; return 1; } diff --git a/Source/kwsys/ConsoleBuf.hxx.in b/Source/kwsys/ConsoleBuf.hxx.in index 34c69a0..717462e 100644 --- a/Source/kwsys/ConsoleBuf.hxx.in +++ b/Source/kwsys/ConsoleBuf.hxx.in @@ -48,6 +48,17 @@ public: }; } + BasicConsoleBuf<CharT, Traits>* GetConsoleBuf() { return m_consolebuf; } + + void SetUTF8Pipes() + { + if (m_consolebuf) { + m_consolebuf->input_pipe_codepage = CP_UTF8; + m_consolebuf->output_pipe_codepage = CP_UTF8; + m_consolebuf->activateCodepageChange(); + } + } + ~Manager() { if (m_consolebuf) { diff --git a/Tests/InterfaceLibrary/CMakeLists.txt b/Tests/InterfaceLibrary/CMakeLists.txt index 3db210a..33c4b90 100644 --- a/Tests/InterfaceLibrary/CMakeLists.txt +++ b/Tests/InterfaceLibrary/CMakeLists.txt @@ -64,6 +64,7 @@ target_link_libraries(iface_whitelist INTERFACE $<$<BOOL:$<TARGET_PROPERTY:CUSTO add_executable(exec_whitelist dummy.cpp) target_link_libraries(exec_whitelist iface_whitelist) +set(CMAKE_NO_SYSTEM_FROM_IMPORTED 1) add_library(iface_imported INTERFACE IMPORTED) set_property(TARGET iface_imported PROPERTY INTERFACE_COMPILE_DEFINITIONS diff --git a/Tests/RunCMake/ClangTidy/C-bad-Build-result.txt b/Tests/RunCMake/ClangTidy/C-bad-Build-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/ClangTidy/C-bad-Build-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/ClangTidy/C-bad-Build-stdout.txt b/Tests/RunCMake/ClangTidy/C-bad-Build-stdout.txt new file mode 100644 index 0000000..2370ce1 --- /dev/null +++ b/Tests/RunCMake/ClangTidy/C-bad-Build-stdout.txt @@ -0,0 +1,2 @@ +stdout from bad command line arg '-bad' +stderr from bad command line arg '-bad' diff --git a/Tests/RunCMake/ClangTidy/C-bad.cmake b/Tests/RunCMake/ClangTidy/C-bad.cmake new file mode 100644 index 0000000..aa54c08 --- /dev/null +++ b/Tests/RunCMake/ClangTidy/C-bad.cmake @@ -0,0 +1,3 @@ +enable_language(C) +set(CMAKE_C_CLANG_TIDY "${PSEUDO_TIDY}" -bad) +add_executable(main main.c) diff --git a/Tests/RunCMake/ClangTidy/RunCMakeTest.cmake b/Tests/RunCMake/ClangTidy/RunCMakeTest.cmake index 27cd922..2f41e50 100644 --- a/Tests/RunCMake/ClangTidy/RunCMakeTest.cmake +++ b/Tests/RunCMake/ClangTidy/RunCMakeTest.cmake @@ -20,3 +20,4 @@ if (NOT RunCMake_GENERATOR STREQUAL "Watcom WMake") run_tidy(C-launch) run_tidy(CXX-launch) endif() +run_tidy(C-bad) diff --git a/Tests/RunCMake/pseudo_iwyu.c b/Tests/RunCMake/pseudo_iwyu.c index 1e25de7..c761741 100644 --- a/Tests/RunCMake/pseudo_iwyu.c +++ b/Tests/RunCMake/pseudo_iwyu.c @@ -3,5 +3,6 @@ int main(void) { fprintf(stderr, "should add these lines:\n#include <...>\n"); - return 0; + /* include-what-you-use always returns failure */ + return 1; } diff --git a/Tests/RunCMake/pseudo_tidy.c b/Tests/RunCMake/pseudo_tidy.c index c950d03..2feeb0f 100644 --- a/Tests/RunCMake/pseudo_tidy.c +++ b/Tests/RunCMake/pseudo_tidy.c @@ -1,9 +1,15 @@ #include <stdio.h> +#include <string.h> int main(int argc, char* argv[]) { int i; for (i = 1; i < argc; ++i) { + if (strcmp(argv[i], "-bad") == 0) { + fprintf(stdout, "stdout from bad command line arg '-bad'\n"); + fprintf(stderr, "stderr from bad command line arg '-bad'\n"); + return 1; + } if (argv[i][0] != '-') { fprintf(stdout, "%s:0:0: warning: message [checker]\n", argv[i]); break; |