diff options
245 files changed, 3993 insertions, 1211 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 71850de..c2060ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -115,7 +115,7 @@ endmacro() if(NOT CMake_TEST_EXTERNAL_CMAKE) set(CMAKE_BUILD_ON_VISUAL_STUDIO 0) - if(WIN32 AND NOT UNIX AND NOT BORLAND AND NOT MINGW ) + if(WIN32 AND NOT UNIX AND NOT MINGW) set(CMAKE_BUILD_ON_VISUAL_STUDIO 1) endif() endif() @@ -555,7 +555,7 @@ CMAKE_SETUP_TESTING() if(NOT CMake_TEST_EXTERNAL_CMAKE) if(NOT CMake_VERSION_IS_RELEASE) - if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" AND + if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS 4.2) set(C_FLAGS_LIST -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security diff --git a/CompileFlags.cmake b/CompileFlags.cmake index 7e9fb16..e7beb3f 100644 --- a/CompileFlags.cmake +++ b/CompileFlags.cmake @@ -20,7 +20,7 @@ if(CMAKE_GENERATOR MATCHES "Visual Studio 6") set(CMAKE_SKIP_COMPATIBILITY_TESTS 1) endif() -if(WIN32 AND "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$") +if(WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "Intel") set(_INTEL_WINDOWS 1) endif() diff --git a/Help/command/add_compile_options.rst b/Help/command/add_compile_options.rst index 214f4be..3fe2a33 100644 --- a/Help/command/add_compile_options.rst +++ b/Help/command/add_compile_options.rst @@ -7,15 +7,16 @@ Adds options to the compilation of source files. add_compile_options(<option> ...) -Adds options to the compiler command line for sources in the current -directory and below. This command can be used to add any options, but -alternative commands exist to add preprocessor definitions -(:command:`target_compile_definitions` and :command:`add_definitions`) or -include directories (:command:`target_include_directories` and -:command:`include_directories`). See documentation of the -:prop_tgt:`directory <COMPILE_OPTIONS>` and +Adds options to the compiler command line for targets in the current +directory and below that are added after this command is invoked. +See documentation of the :prop_dir:`directory <COMPILE_OPTIONS>` and :prop_tgt:`target <COMPILE_OPTIONS>` ``COMPILE_OPTIONS`` properties. +This command can be used to add any options, but alternative commands +exist to add preprocessor definitions (:command:`target_compile_definitions` +and :command:`add_definitions`) or include directories +(:command:`target_include_directories` and :command:`include_directories`). + Arguments to ``add_compile_options`` may use "generator expressions" with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for available expressions. See the :manual:`cmake-buildsystem(7)` diff --git a/Help/command/add_definitions.rst b/Help/command/add_definitions.rst index 2965c37..a04faf5 100644 --- a/Help/command/add_definitions.rst +++ b/Help/command/add_definitions.rst @@ -7,10 +7,12 @@ Adds -D define flags to the compilation of source files. add_definitions(-DFOO -DBAR ...) -Adds definitions to the compiler command line for sources in the current -directory and below. This command can be used to add any flags, but -it is intended to add preprocessor definitions. Flags -beginning in -D or /D that look like preprocessor definitions are +Adds definitions to the compiler command line for targets in the current +directory and below (whether added before or after this command is invoked). +This command can be used to add any flags, but it is intended to add +preprocessor definitions (see the :command:`add_compile_options` command +to add other flags). +Flags beginning in -D or /D that look like preprocessor definitions are automatically added to the :prop_dir:`COMPILE_DEFINITIONS` directory property for the current directory. Definitions with non-trivial values may be left in the set of flags instead of being converted for reasons of diff --git a/Help/command/add_library.rst b/Help/command/add_library.rst index f86f3c5..7c06203 100644 --- a/Help/command/add_library.rst +++ b/Help/command/add_library.rst @@ -35,7 +35,7 @@ variable :variable:`BUILD_SHARED_LIBS` is ``ON``. For ``SHARED`` and property is set to ``ON`` automatically. By default the library file will be created in the build tree directory -corresponding to the source tree directory in which thecommand was +corresponding to the source tree directory in which the command was invoked. See documentation of the :prop_tgt:`ARCHIVE_OUTPUT_DIRECTORY`, :prop_tgt:`LIBRARY_OUTPUT_DIRECTORY`, and :prop_tgt:`RUNTIME_OUTPUT_DIRECTORY` target properties to change this @@ -133,14 +133,17 @@ Creates an :ref:`Interface Library <Interface Libraries>`. An ``INTERFACE`` library target does not directly create build output, though it may have properties set on it and it may be installed, exported and imported. Typically the ``INTERFACE_*`` properties are populated on -the interface target using the :command:`set_property`, -:command:`target_link_libraries(INTERFACE)`, -:command:`target_include_directories(INTERFACE)`, -:command:`target_compile_options(INTERFACE)`, -:command:`target_compile_definitions(INTERFACE)`, -and :command:`target_sources(INTERFACE)` commands, and then it -is used as an argument to :command:`target_link_libraries` like any other -target. +the interface target using the commands: + +* :command:`set_property`, +* :command:`target_link_libraries(INTERFACE)`, +* :command:`target_include_directories(INTERFACE)`, +* :command:`target_compile_options(INTERFACE)`, +* :command:`target_compile_definitions(INTERFACE)`, and +* :command:`target_sources(INTERFACE)`, + +and then it is used as an argument to :command:`target_link_libraries` +like any other target. An ``INTERFACE`` :ref:`Imported Target <Imported Targets>` may also be created with this signature. An ``IMPORTED`` library target references a diff --git a/Help/command/target_compile_options.rst b/Help/command/target_compile_options.rst index 0fdeba6..3362c5d 100644 --- a/Help/command/target_compile_options.rst +++ b/Help/command/target_compile_options.rst @@ -12,8 +12,8 @@ Add compile options to a target. Specify compile options to use when compiling a given target. The named ``<target>`` must have been created by a command such as :command:`add_executable` or :command:`add_library` and must not be an -:prop_tgt:`IMPORTED Target`. If ``BEFORE`` is specified, the content will -be prepended to the property instead of being appended. +:ref:`IMPORTED Target <Imported Targets>`. If ``BEFORE`` is specified, +the content will be prepended to the property instead of being appended. This command can be used to add any options, but alternative commands exist to add preprocessor definitions diff --git a/Help/command/target_sources.rst b/Help/command/target_sources.rst index ff756b4..d6f148d 100644 --- a/Help/command/target_sources.rst +++ b/Help/command/target_sources.rst @@ -12,7 +12,7 @@ Add sources to a target. Specify sources to use when compiling a given target. The named ``<target>`` must have been created by a command such as :command:`add_executable` or :command:`add_library` and must not be an -:prop_tgt:`IMPORTED Target`. +:ref:`IMPORTED Target <Imported Targets>`. The ``INTERFACE``, ``PUBLIC`` and ``PRIVATE`` keywords are required to specify the scope of the following arguments. ``PRIVATE`` and ``PUBLIC`` diff --git a/Help/manual/cmake-buildsystem.7.rst b/Help/manual/cmake-buildsystem.7.rst index 1ce9a7e..43f0e97 100644 --- a/Help/manual/cmake-buildsystem.7.rst +++ b/Help/manual/cmake-buildsystem.7.rst @@ -3,7 +3,7 @@ cmake-buildsystem(7) ******************** -.. only:: html or latex +.. only:: html .. contents:: diff --git a/Help/manual/cmake-commands.7.rst b/Help/manual/cmake-commands.7.rst index 8ff73a4..9c1d3b9 100644 --- a/Help/manual/cmake-commands.7.rst +++ b/Help/manual/cmake-commands.7.rst @@ -3,7 +3,7 @@ cmake-commands(7) ***************** -.. only:: html or latex +.. only:: html .. contents:: diff --git a/Help/manual/cmake-compile-features.7.rst b/Help/manual/cmake-compile-features.7.rst index 8e3dbb8..4259224 100644 --- a/Help/manual/cmake-compile-features.7.rst +++ b/Help/manual/cmake-compile-features.7.rst @@ -3,7 +3,7 @@ cmake-compile-features(7) ************************* -.. only:: html or latex +.. only:: html .. contents:: diff --git a/Help/manual/cmake-developer.7.rst b/Help/manual/cmake-developer.7.rst index eea5fc3..0884a59 100644 --- a/Help/manual/cmake-developer.7.rst +++ b/Help/manual/cmake-developer.7.rst @@ -3,7 +3,7 @@ cmake-developer(7) ****************** -.. only:: html or latex +.. only:: html .. contents:: diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index 981bd84..c47a7c4 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -3,7 +3,7 @@ cmake-generator-expressions(7) ****************************** -.. only:: html or latex +.. only:: html .. contents:: diff --git a/Help/manual/cmake-generators.7.rst b/Help/manual/cmake-generators.7.rst index 7f5093f..4bc8c5f 100644 --- a/Help/manual/cmake-generators.7.rst +++ b/Help/manual/cmake-generators.7.rst @@ -3,7 +3,7 @@ cmake-generators(7) ******************* -.. only:: html or latex +.. only:: html .. contents:: diff --git a/Help/manual/cmake-language.7.rst b/Help/manual/cmake-language.7.rst index b83dcad..9c511ca 100644 --- a/Help/manual/cmake-language.7.rst +++ b/Help/manual/cmake-language.7.rst @@ -3,7 +3,7 @@ cmake-language(7) ***************** -.. only:: html or latex +.. only:: html .. contents:: @@ -79,6 +79,10 @@ A CMake Language source file consists of zero or more `Command Invocations`_ separated by newlines and optionally spaces and `Comments`_: +.. raw:: latex + + \begin{small} + .. productionlist:: file: `file_element`* file_element: `command_invocation` `line_ending` | @@ -87,6 +91,10 @@ spaces and `Comments`_: space: <match '[ \t]+'> newline: <match '\n'> +.. raw:: latex + + \end{small} + Note that any source file line not inside `Command Arguments`_ or a `Bracket Comment`_ can end in a `Line Comment`_. @@ -98,6 +106,10 @@ Command Invocations A *command invocation* is a name followed by paren-enclosed arguments separated by whitespace: +.. raw:: latex + + \begin{small} + .. productionlist:: command_invocation: `space`* `identifier` `space`* '(' `arguments` ')' identifier: <match '[A-Za-z_][A-Za-z0-9_]*'> @@ -106,6 +118,10 @@ separated by whitespace: : `separation`* '(' `arguments` ')' separation: `space` | `line_ending` +.. raw:: latex + + \end{small} + For example: .. code-block:: cmake @@ -137,9 +153,17 @@ Command Arguments There are three types of arguments within `Command Invocations`_: +.. raw:: latex + + \begin{small} + .. productionlist:: argument: `bracket_argument` | `quoted_argument` | `unquoted_argument` +.. raw:: latex + + \end{small} + .. _`Bracket Argument`: Bracket Argument @@ -149,6 +173,10 @@ A *bracket argument*, inspired by `Lua`_ long bracket syntax, encloses content between opening and closing "brackets" of the same length: +.. raw:: latex + + \begin{small} + .. productionlist:: bracket_argument: `bracket_open` `bracket_content` `bracket_close` bracket_open: '[' '='{len} '[' @@ -156,6 +184,10 @@ same length: : of the same {len} as the `bracket_open`> bracket_close: ']' '='{len} ']' +.. raw:: latex + + \end{small} + An opening bracket of length *len >= 0* is written ``[`` followed by *len* ``=`` followed by ``[`` and the corresponding closing bracket is written ``]`` followed by *len* ``=`` followed by ``]``. @@ -197,6 +229,10 @@ Quoted Argument A *quoted argument* encloses content between opening and closing double-quote characters: +.. raw:: latex + + \begin{small} + .. productionlist:: quoted_argument: '"' `quoted_element`* '"' quoted_element: <any character except '\' or '"'> | @@ -204,6 +240,10 @@ double-quote characters: : `quoted_continuation` quoted_continuation: '\' `newline` +.. raw:: latex + + \end{small} + Quoted argument content consists of all text between opening and closing quotes. Both `Escape Sequences`_ and `Variable References`_ are evaluated. A quoted argument is always given to the command @@ -246,12 +286,20 @@ An *unquoted argument* is not enclosed by any quoting syntax. It may not contain any whitespace, ``(``, ``)``, ``#``, ``"``, or ``\`` except when escaped by a backslash: +.. raw:: latex + + \begin{small} + .. productionlist:: unquoted_argument: `unquoted_element`+ | `unquoted_legacy` unquoted_element: <any character except whitespace or one of '()#"\'> | : `escape_sequence` unquoted_legacy: <see note in text> +.. raw:: latex + + \end{small} + Unquoted argument content consists of all text in a contiguous block of allowed or escaped characters. Both `Escape Sequences`_ and `Variable References`_ are evaluated. The resulting value is divided @@ -294,12 +342,20 @@ Escape Sequences An *escape sequence* is a ``\`` followed by one character: +.. raw:: latex + + \begin{small} + .. productionlist:: escape_sequence: `escape_identity` | `escape_encoded` | `escape_semicolon` escape_identity: '\' <match '[^A-Za-z0-9;]'> escape_encoded: '\t' | '\r' | '\n' escape_semicolon: '\;' +.. raw:: latex + + \end{small} + A ``\`` followed by a non-alphanumeric character simply encodes the literal character without interpreting it as syntax. A ``\t``, ``\r``, or ``\n`` encodes a tab, carriage return, or newline character, respectively. A ``\;`` @@ -348,9 +404,17 @@ Bracket Comment A ``#`` immediately followed by a `Bracket Argument`_ forms a *bracket comment* consisting of the entire bracket enclosure: +.. raw:: latex + + \begin{small} + .. productionlist:: bracket_comment: '#' `bracket_argument` +.. raw:: latex + + \end{small} + For example: .. code-block:: cmake @@ -371,10 +435,18 @@ Line Comment A ``#`` not immediately followed by a `Bracket Argument`_ forms a *line comment* that runs until the end of the line: +.. raw:: latex + + \begin{small} + .. productionlist:: line_comment: '#' <any text not starting in a `bracket_argument` : and not containing a `newline`> +.. raw:: latex + + \end{small} + For example: .. code-block:: cmake diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst index 61e4bb4..f5a35b3 100644 --- a/Help/manual/cmake-modules.7.rst +++ b/Help/manual/cmake-modules.7.rst @@ -3,7 +3,7 @@ cmake-modules(7) **************** -.. only:: html or latex +.. only:: html .. contents:: diff --git a/Help/manual/cmake-packages.7.rst b/Help/manual/cmake-packages.7.rst index c4cca6d..13e2ba0 100644 --- a/Help/manual/cmake-packages.7.rst +++ b/Help/manual/cmake-packages.7.rst @@ -3,7 +3,7 @@ cmake-packages(7) ***************** -.. only:: html or latex +.. only:: html .. contents:: @@ -282,7 +282,8 @@ shared library: generate_export_header(ClimbingStats) set_property(TARGET ClimbingStats PROPERTY VERSION ${Upstream_VERSION}) set_property(TARGET ClimbingStats PROPERTY SOVERSION 3) - set_property(TARGET ClimbingStats PROPERTY INTERFACE_ClimbingStats_MAJOR_VERSION 3) + set_property(TARGET ClimbingStats PROPERTY + INTERFACE_ClimbingStats_MAJOR_VERSION 3) set_property(TARGET ClimbingStats APPEND PROPERTY COMPATIBLE_INTERFACE_STRING ClimbingStats_MAJOR_VERSION ) @@ -316,7 +317,7 @@ shared library: ) configure_file(cmake/ClimbingStatsConfig.cmake "${CMAKE_CURRENT_BINARY_DIR}/ClimbingStats/ClimbingStatsConfig.cmake" - COPY_ONLY + COPYONLY ) set(ConfigPackageLocation lib/cmake/ClimbingStats) @@ -479,7 +480,7 @@ be true. This can be tested with logic in the package configuration file: foreach(_comp ${ClimbingStats_FIND_COMPONENTS}) if (NOT ";${_supported_components};" MATCHES _comp) set(ClimbingStats_FOUND False) - set(ClimbingStats_NOTFOUND_MESSAGE "Specified unsupported component: ${_comp}") + set(ClimbingStats_NOTFOUND_MESSAGE "Unsupported component: ${_comp}") endif() include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStats${_comp}Targets.cmake") endforeach() diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index f1717a0..7074bd5 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -3,7 +3,7 @@ cmake-policies(7) ***************** -.. only:: html or latex +.. only:: html .. contents:: @@ -20,6 +20,12 @@ for a policy, also avoiding the warning. Each policy can also be set to either ``NEW`` or ``OLD`` behavior explicitly on the command line with the :variable:`CMAKE_POLICY_DEFAULT_CMP<NNNN>` variable. +Note that policies are not reliable feature toggles. A policy should +almost never be set to ``OLD``, except to silence warnings in an otherwise +frozen or stable codebase, or temporarily as part of a larger migration +path. The ``OLD`` behavior of each policy is undesirable and will be +replaced with an error condition in a future release. + The :command:`cmake_minimum_required` command does more than report an error if a too-old version of CMake is used to build a project. It also sets all policies introduced in that CMake version or earlier to diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 38bcd04..bf456f5 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -3,7 +3,7 @@ cmake-properties(7) ******************* -.. only:: html or latex +.. only:: html .. contents:: diff --git a/Help/manual/cmake-qt.7.rst b/Help/manual/cmake-qt.7.rst index fe8d62d..e8a2c1e 100644 --- a/Help/manual/cmake-qt.7.rst +++ b/Help/manual/cmake-qt.7.rst @@ -3,7 +3,7 @@ cmake-qt(7) *********** -.. only:: html or latex +.. only:: html .. contents:: diff --git a/Help/manual/cmake-toolchains.7.rst b/Help/manual/cmake-toolchains.7.rst index fad5481..afc8ba2 100644 --- a/Help/manual/cmake-toolchains.7.rst +++ b/Help/manual/cmake-toolchains.7.rst @@ -3,7 +3,7 @@ cmake-toolchains(7) ******************* -.. only:: html or latex +.. only:: html .. contents:: diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 1deb8bb..99088e0 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -3,7 +3,7 @@ cmake-variables(7) ****************** -.. only:: html or latex +.. only:: html .. contents:: diff --git a/Help/prop_dir/COMPILE_OPTIONS.rst b/Help/prop_dir/COMPILE_OPTIONS.rst index 5953059..5530860 100644 --- a/Help/prop_dir/COMPILE_OPTIONS.rst +++ b/Help/prop_dir/COMPILE_OPTIONS.rst @@ -6,9 +6,9 @@ List of options to pass to the compiler. This property specifies the list of options given so far to the :command:`add_compile_options` command. -This property is used to populate the :prop_tgt:`COMPILE_OPTIONS` target -property, which is used by the generators to set the options for the -compiler. +This property is used to initialize the :prop_tgt:`COMPILE_OPTIONS` target +property when a target is created, which is used by the generators to set +the options for the compiler. Contents of ``COMPILE_OPTIONS`` may use "generator expressions" with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual diff --git a/Help/prop_sf/AUTOUIC_OPTIONS.rst b/Help/prop_sf/AUTOUIC_OPTIONS.rst index 6dfabb0..bb48da9 100644 --- a/Help/prop_sf/AUTOUIC_OPTIONS.rst +++ b/Help/prop_sf/AUTOUIC_OPTIONS.rst @@ -6,7 +6,7 @@ Additional options for ``uic`` when using :prop_tgt:`AUTOUIC` This property holds additional command line options which will be used when ``uic`` is executed during the build via :prop_tgt:`AUTOUIC`, i.e. it is equivalent to the optional ``OPTIONS`` argument of the -:module:`qt4_wrap_ui()<FindQt4>` macro. +:module:`qt4_wrap_ui() <FindQt4>` macro. By default it is empty. diff --git a/Help/release/3.1.0.rst b/Help/release/3.1.0.rst index 652bcd3..e7a695d 100644 --- a/Help/release/3.1.0.rst +++ b/Help/release/3.1.0.rst @@ -238,10 +238,6 @@ Modules * The :module:`FindPkgConfig` module learned to use the ``PKG_CONFIG`` environment variable value as the ``pkg-config`` executable, if set. -* The :module:`FindVTK` module dropped support for finding VTK 4.0. - It is now a thin-wrapper around ``find_package(VTK ... NO_MODULE)``. - This produces much clearer error messages when VTK is not found. - * The :module:`FindZLIB` module now provides imported targets. * The :module:`GenerateExportHeader` module ``generate_export_header`` @@ -356,6 +352,17 @@ Deprecated and Removed Features it is deprecated and should not longer be used. Use the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable instead. +* The :module:`FindITK` module has been removed altogether. + It was a thin-wrapper around ``find_package(ITK ... NO_MODULE)``. + This produces much clearer error messages when ITK is not found. + +* The :module:`FindVTK` module has been removed altogether. + It was a thin-wrapper around ``find_package(VTK ... NO_MODULE)``. + This produces much clearer error messages when VTK is not found. + + The module also provided compatibility support for finding VTK 4.0. + This capability has been dropped. + Other Changes ============= diff --git a/Help/release/dev/0-sample-topic.rst b/Help/release/dev/0-sample-topic.rst new file mode 100644 index 0000000..e4cc01e --- /dev/null +++ b/Help/release/dev/0-sample-topic.rst @@ -0,0 +1,7 @@ +0-sample-topic +-------------- + +* This is a sample release note for the change in a topic. + Developers should add similar notes for each topic branch + making a noteworthy change. Each document should be named + and titled to match the topic name to avoid merge conflicts. diff --git a/Help/release/dev/ExternalProject_CMAKE_CACHE_DEFAULT_ARGS.rst b/Help/release/dev/ExternalProject_CMAKE_CACHE_DEFAULT_ARGS.rst new file mode 100644 index 0000000..1838ab6 --- /dev/null +++ b/Help/release/dev/ExternalProject_CMAKE_CACHE_DEFAULT_ARGS.rst @@ -0,0 +1,6 @@ +ExternalProject_CMAKE_CACHE_DEFAULT_ARGS +---------------------------------------- + +* The :module:`ExternalProject` module ``ExternalProject_Add`` function + learned a new ``CMAKE_CACHE_DEFAULT_ARGS`` option to initialize cache + values in the external project without setting them on future builds. diff --git a/Help/release/dev/ExternalProject_independent-step-targets.rst b/Help/release/dev/ExternalProject_independent-step-targets.rst new file mode 100644 index 0000000..02e8db8 --- /dev/null +++ b/Help/release/dev/ExternalProject_independent-step-targets.rst @@ -0,0 +1,6 @@ +ExternalProject_independent-step-targets +---------------------------------------- + +* The :module:`ExternalProject` module learned options to create + independent external project step targets that do not depend + on the builtin steps. diff --git a/Help/release/dev/add_javascript_coverage_parser.rst b/Help/release/dev/add_javascript_coverage_parser.rst new file mode 100644 index 0000000..0d068ee --- /dev/null +++ b/Help/release/dev/add_javascript_coverage_parser.rst @@ -0,0 +1,4 @@ +add_javascript_coverage_parser +------------------------------ + +* The :command:`ctest_coverage` learned to support Javascript coverage. diff --git a/Help/release/dev/cpack-rpm-component-descriptions.rst b/Help/release/dev/cpack-rpm-component-descriptions.rst new file mode 100644 index 0000000..769a912 --- /dev/null +++ b/Help/release/dev/cpack-rpm-component-descriptions.rst @@ -0,0 +1,7 @@ +cpack-rpm-component-descriptions +-------------------------------- + +* The :module:`CPackRPM` module learned options to set per-component + descriptions and summaries. See the + :variable:`CPACK_RPM_<component>_PACKAGE_DESCRIPTION` and + :variable:`CPACK_RPM_<component>_PACKAGE_SUMMARY` variables. diff --git a/Help/release/dev/cpack-rpm-pre-post-install.rst b/Help/release/dev/cpack-rpm-pre-post-install.rst new file mode 100644 index 0000000..0909d94 --- /dev/null +++ b/Help/release/dev/cpack-rpm-pre-post-install.rst @@ -0,0 +1,12 @@ +cpack-rpm-pre-post-install +-------------------------- + +* The :module:`CPackRPM` module learned options to specify + requirements for pre- and post-install scripts. See the + :variable:`CPACK_RPM_PACKAGE_REQUIRES_PRE` and + :variable:`CPACK_RPM_PACKAGE_REQUIRES_POST` variables. + +* The :module:`CPackRPM` module learned options to specify + requirements for pre- and post-uninstall scripts. See the + :variable:`CPACK_RPM_PACKAGE_REQUIRES_PREUN` and + :variable:`CPACK_RPM_PACKAGE_REQUIRES_POSTUN` variables. diff --git a/Help/release/dev/ctest-delphi-coverage.rst b/Help/release/dev/ctest-delphi-coverage.rst new file mode 100644 index 0000000..efa97c9 --- /dev/null +++ b/Help/release/dev/ctest-delphi-coverage.rst @@ -0,0 +1,4 @@ +ctest-delphi-coverage +--------------------- + +* The :command:`ctest_coverage` learned to support Delphi coverage. diff --git a/Help/release/index.rst b/Help/release/index.rst index 616a582..abc19b8 100644 --- a/Help/release/index.rst +++ b/Help/release/index.rst @@ -5,6 +5,8 @@ CMake Release Notes This file should include the adjacent "dev.txt" file in development versions but not in release versions. +.. include:: dev.txt + Releases ======== diff --git a/Modules/AutogenInfo.cmake.in b/Modules/AutogenInfo.cmake.in index 602b065..7d89420 100644 --- a/Modules/AutogenInfo.cmake.in +++ b/Modules/AutogenInfo.cmake.in @@ -1,5 +1,6 @@ set(AM_SOURCES @_cpp_files@ ) set(AM_RCC_SOURCES @_rcc_files@ ) +set(AM_RCC_INPUTS @_qt_rcc_inputs@) set(AM_SKIP_MOC @_skip_moc@ ) set(AM_SKIP_UIC @_skip_uic@ ) set(AM_HEADERS @_moc_headers@ ) diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index 6b425c6..937aa8c 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -108,7 +108,7 @@ if(NOT CMAKE_C_COMPILER_ID_RUN) CMAKE_DETERMINE_COMPILER_ID(C CFLAGS CMakeCCompilerId.c) # Set old compiler and platform id variables. - if("${CMAKE_C_COMPILER_ID}" MATCHES "GNU") + if(CMAKE_C_COMPILER_ID MATCHES "GNU") set(CMAKE_COMPILER_IS_GNUCC 1) endif() if("${CMAKE_C_PLATFORM_ID}" MATCHES "MinGW") @@ -131,11 +131,11 @@ endif () # "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-" if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX) - if("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR "${CMAKE_C_COMPILER_ID}" MATCHES "Clang") + if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") get_filename_component(COMPILER_BASENAME "${CMAKE_C_COMPILER}" NAME) if (COMPILER_BASENAME MATCHES "^(.+-)(clang|g?cc)(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) - elseif("${CMAKE_C_COMPILER_ID}" MATCHES "Clang") + elseif(CMAKE_C_COMPILER_ID MATCHES "Clang") if(CMAKE_C_COMPILER_TARGET) set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_C_COMPILER_TARGET}-) endif() @@ -150,7 +150,7 @@ if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX) if ("${_CMAKE_TOOLCHAIN_PREFIX}" MATCHES "(.+-)?llvm-$") set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) endif () - elseif("${CMAKE_C_COMPILER_ID}" MATCHES "TI") + elseif(CMAKE_C_COMPILER_ID MATCHES "TI") # TI compilers are named e.g. cl6x, cl470 or armcl.exe get_filename_component(COMPILER_BASENAME "${CMAKE_C_COMPILER}" NAME) if (COMPILER_BASENAME MATCHES "^(.+)?cl([^.]+)?(\\.exe)?$") diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 613f4b3..0ea9ce1 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -48,7 +48,7 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) CMAKE_DETERMINE_COMPILER_ID_VENDOR(${lang}) endif() - if (COMPILER_QNXNTO AND CMAKE_${lang}_COMPILER_ID STREQUAL GNU) + if (COMPILER_QNXNTO AND CMAKE_${lang}_COMPILER_ID STREQUAL "GNU") execute_process( COMMAND "${CMAKE_${lang}_COMPILER}" -V @@ -307,7 +307,7 @@ Id flags: ${testflags} # ... # /path/to/cc ...CompilerId${lang}/... # to extract the compiler front-end for the language. - if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerId${lang}(/CompilerId${lang}.xctest)?/(\\./)?CompilerId${lang}[ \t\n\\\"]") + if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerId${lang}/(\\./)?(CompilerId${lang}.xctest/)?CompilerId${lang}[ \t\n\\\"]") set(_comp "${CMAKE_MATCH_2}") if(EXISTS "${_comp}") set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE) diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index 96df6a2..a4bb86c 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -152,12 +152,12 @@ if(NOT CMAKE_Fortran_COMPILER_ID_RUN) endif() # Set old compiler and platform id variables. - if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU") + if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") set(CMAKE_COMPILER_IS_GNUG77 1) endif() - if("${CMAKE_Fortran_PLATFORM_ID}" MATCHES "MinGW") + if(CMAKE_Fortran_PLATFORM_ID MATCHES "MinGW") set(CMAKE_COMPILER_IS_MINGW 1) - elseif("${CMAKE_Fortran_PLATFORM_ID}" MATCHES "Cygwin") + elseif(CMAKE_Fortran_PLATFORM_ID MATCHES "Cygwin") set(CMAKE_COMPILER_IS_CYGWIN 1) endif() endif() @@ -175,7 +175,7 @@ endif () # "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-" if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX) - if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU") + if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") get_filename_component(COMPILER_BASENAME "${CMAKE_Fortran_COMPILER}" NAME) if (COMPILER_BASENAME MATCHES "^(.+-)g?fortran(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) diff --git a/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake b/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake index 365d381..064e650 100644 --- a/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake +++ b/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake @@ -26,11 +26,18 @@ macro(_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang _resultIncludeDirs _resultDefines if (${_lang} STREQUAL "c++") set(_compilerExecutable "${CMAKE_CXX_COMPILER}") set(_arg1 "${CMAKE_CXX_COMPILER_ARG1}") + + if (CMAKE_CXX_FLAGS MATCHES "(-stdlib=[^ ]+)") + set(_stdlib "${CMAKE_MATCH_1}") + endif () + if (CMAKE_CXX_FLAGS MATCHES "(-std=[^ ]+)") + set(_stdver "${CMAKE_MATCH_1}") + endif () else () set(_compilerExecutable "${CMAKE_C_COMPILER}") set(_arg1 "${CMAKE_C_COMPILER_ARG1}") endif () - execute_process(COMMAND ${_compilerExecutable} ${_arg1} -v -E -x ${_lang} -dD dummy + execute_process(COMMAND ${_compilerExecutable} ${_arg1} ${_stdver} ${_stdlib} -v -E -x ${_lang} -dD dummy WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/CMakeFiles ERROR_VARIABLE _gccOutput OUTPUT_VARIABLE _gccStdout ) @@ -90,7 +97,7 @@ set(ENV{LANG} C) # Now check for C, works for gcc and Intel compiler at least if (NOT CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS) - if ("${CMAKE_C_COMPILER_ID}" MATCHES GNU OR "${CMAKE_C_COMPILER_ID}" MATCHES Intel OR "${CMAKE_C_COMPILER_ID}" MATCHES Clang) + if (CMAKE_C_COMPILER_ID MATCHES GNU OR CMAKE_C_COMPILER_ID MATCHES Intel OR CMAKE_C_COMPILER_ID MATCHES Clang) _DETERMINE_GCC_SYSTEM_INCLUDE_DIRS(c _dirs _defines) set(CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS "${_dirs}" CACHE INTERNAL "C compiler system include directories") set(CMAKE_EXTRA_GENERATOR_C_SYSTEM_DEFINED_MACROS "${_defines}" CACHE INTERNAL "C compiler system defined macros") diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake index e0ba131..50cb972 100644 --- a/Modules/CMakeFindBinUtils.cmake +++ b/Modules/CMakeFindBinUtils.cmake @@ -30,12 +30,12 @@ # License text for the above reference.) # if it's the MS C/CXX compiler, search for link -if("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC" - OR "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC" - OR "${CMAKE_Fortran_SIMULATE_ID}" STREQUAL "MSVC" - OR "${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC" - OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" - OR ("${CMAKE_GENERATOR}" MATCHES "Visual Studio" +if(CMAKE_C_SIMULATE_ID STREQUAL "MSVC" + OR CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC" + OR CMAKE_Fortran_SIMULATE_ID STREQUAL "MSVC" + OR CMAKE_C_COMPILER_ID STREQUAL "MSVC" + OR CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" + OR (CMAKE_GENERATOR MATCHES "Visual Studio" AND NOT CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")) find_program(CMAKE_LINKER NAMES link HINTS ${_CMAKE_TOOLCHAIN_LOCATION}) diff --git a/Modules/CMakeForceCompiler.cmake b/Modules/CMakeForceCompiler.cmake index 0e6b5af..1d8b110 100644 --- a/Modules/CMakeForceCompiler.cmake +++ b/Modules/CMakeForceCompiler.cmake @@ -70,7 +70,7 @@ macro(CMAKE_FORCE_C_COMPILER compiler id) set(CMAKE_C_COMPILER_FORCED TRUE) # Set old compiler id variables. - if("${CMAKE_C_COMPILER_ID}" MATCHES "GNU") + if(CMAKE_C_COMPILER_ID MATCHES "GNU") set(CMAKE_COMPILER_IS_GNUCC 1) endif() endmacro() @@ -94,7 +94,7 @@ macro(CMAKE_FORCE_Fortran_COMPILER compiler id) set(CMAKE_Fortran_COMPILER_FORCED TRUE) # Set old compiler id variables. - if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU") + if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") set(CMAKE_COMPILER_IS_GNUG77 1) endif() endmacro() diff --git a/Modules/CMakeNinjaFindMake.cmake b/Modules/CMakeNinjaFindMake.cmake index c3ca767..2f35cf4 100644 --- a/Modules/CMakeNinjaFindMake.cmake +++ b/Modules/CMakeNinjaFindMake.cmake @@ -12,6 +12,7 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -find_program(CMAKE_MAKE_PROGRAM ninja +find_program(CMAKE_MAKE_PROGRAM + NAMES ninja-build ninja DOC "Program used to build from build.ninja files.") mark_as_advanced(CMAKE_MAKE_PROGRAM) diff --git a/Modules/CPackBundle.cmake b/Modules/CPackBundle.cmake index d8293c0..d26a0b3 100644 --- a/Modules/CPackBundle.cmake +++ b/Modules/CPackBundle.cmake @@ -33,6 +33,31 @@ # Path to a startup script. This is a path to an executable or script that # will be run whenever an end-user double-clicks the generated bundle in the # OSX Finder. Optional. +# +# .. variable:: CPACK_BUNDLE_APPLE_CERT_APP +# +# The name of your Apple supplied code signing certificate for the application. +# The name usually takes the form "Developer ID Application: [Name]" or +# "3rd Party Mac Developer Application: [Name]". If this variable is not set +# the application will not be signed. +# +# .. variable:: CPACK_BUNDLE_APPLE_ENTITLEMENTS +# +# The name of the plist file that contains your apple entitlements for sandboxing +# your application. This file is required for submission to the Mac App Store. +# +# .. variable:: CPACK_BUNDLE_APPLE_CODESIGN_FILES +# +# A list of additional files that you wish to be signed. You do not need to +# list the main application folder, or the main executable. You should +# list any frameworks and plugins that are included in your app bundle. +# +# .. variable:: CPACK_COMMAND_CODESIGN +# +# Path to the codesign(1) command used to sign applications with an +# Apple cert. This variable can be used to override the automatically +# detected command (or specify its location if the auto-detection fails +# to find it.) #============================================================================= # Copyright 2006-2009 Kitware, Inc. diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake index 4b8dc1e..6f2eeb3 100644 --- a/Modules/CPackIFW.cmake +++ b/Modules/CPackIFW.cmake @@ -96,7 +96,7 @@ # # If this is ``ON`` all components will be downloaded. # By default is ``OFF`` or used value -# from :variable:`CPACK_DOWNLOAD_ALL` if set +# from ``CPACK_DOWNLOAD_ALL`` if set # # Components # """""""""" diff --git a/Modules/CPackNSIS.cmake b/Modules/CPackNSIS.cmake index 9d23ec0..4b2e0eb 100644 --- a/Modules/CPackNSIS.cmake +++ b/Modules/CPackNSIS.cmake @@ -114,8 +114,8 @@ # installation prefix. Like:: # # set(CPACK_NSIS_MENU_LINKS -# "doc/cmake-@CMake_VERSION_MAJOR@.@CMake_VERSION_MINOR@/cmake.html" "CMake Help" -# "http://www.cmake.org" "CMake Web Site") +# "doc/cmake-@CMake_VERSION_MAJOR@.@CMake_VERSION_MINOR@/cmake.html" +# "CMake Help" "http://www.cmake.org" "CMake Web Site") # #============================================================================= diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index 2864b21..56d9b66 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -29,6 +29,7 @@ # However as a handy reminder here comes the list of specific variables: # # .. variable:: CPACK_RPM_PACKAGE_SUMMARY +# CPACK_RPM_<component>_PACKAGE_SUMMARY # # The RPM package summary. # @@ -100,11 +101,13 @@ # * Default : - # # .. variable:: CPACK_RPM_PACKAGE_DESCRIPTION +# CPACK_RPM_<component>_PACKAGE_DESCRIPTION # # RPM package description. # # * Mandatory : YES -# * Default : CPACK_PACKAGE_DESCRIPTION_FILE if set or "no package +# * Default : CPACK_COMPONENT_<compName>_DESCRIPTION (component based installers +# only) if set, CPACK_PACKAGE_DESCRIPTION_FILE if set or "no package # description available" # # .. variable:: CPACK_RPM_COMPRESSION_TYPE @@ -135,6 +138,56 @@ # # rpm -qp --requires file.rpm # +# .. variable:: CPACK_RPM_PACKAGE_REQUIRES_PRE +# +# RPM spec requires(pre) field. +# +# * Mandatory : NO +# * Default : - +# +# May be used to set RPM preinstall dependencies (requires(pre)). Note that you must enclose +# the complete requires string between quotes, for example:: +# +# set(CPACK_RPM_PACKAGE_REQUIRES_PRE "shadow-utils, initscripts") +# +# .. variable:: CPACK_RPM_PACKAGE_REQUIRES_POST +# +# RPM spec requires(post) field. +# +# * Mandatory : NO +# * Default : - +# +# May be used to set RPM postinstall dependencies (requires(post)). Note that you must enclose +# the complete requires string between quotes, for example:: +# +# set(CPACK_RPM_PACKAGE_REQUIRES_POST "shadow-utils, initscripts") +# +# +# .. variable:: CPACK_RPM_PACKAGE_REQUIRES_POSTUN +# +# RPM spec requires(postun) field. +# +# * Mandatory : NO +# * Default : - +# +# May be used to set RPM postuninstall dependencies (requires(postun)). Note that you must enclose +# the complete requires string between quotes, for example:: +# +# set(CPACK_RPM_PACKAGE_REQUIRES_POSTUN "shadow-utils, initscripts") +# +# +# .. variable:: CPACK_RPM_PACKAGE_REQUIRES_PREUN +# +# RPM spec requires(preun) field. +# +# * Mandatory : NO +# * Default : - +# +# May be used to set RPM preuninstall dependencies (requires(preun)). Note that you must enclose +# the complete requires string between quotes, for example:: +# +# set(CPACK_RPM_PACKAGE_REQUIRES_PREUN "shadow-utils, initscripts") +# # .. variable:: CPACK_RPM_PACKAGE_SUGGESTS # # RPM spec suggest field. @@ -384,7 +437,7 @@ if(CPACK_RPM_PACKAGE_DEBUG) OUTPUT_VARIABLE _TMP_LSB_RELEASE_OUTPUT ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) - string(REPLACE "\n" ", " + string(REGEX REPLACE "\n" ", " LSB_RELEASE_OUTPUT ${_TMP_LSB_RELEASE_OUTPUT}) else () @@ -397,7 +450,7 @@ endif() # to shut down warning about space in buildtree # some recent RPM version should support space in different places. # not checked [yet]. -if(CPACK_TOPLEVEL_DIRECTORY MATCHES " ") +if(CPACK_TOPLEVEL_DIRECTORY MATCHES ".* .*") message(FATAL_ERROR "${RPMBUILD_EXECUTABLE} can't handle paths with spaces, use a build directory without spaces for building RPMs.") endif() @@ -414,6 +467,7 @@ endif() # Are we packaging components ? if(CPACK_RPM_PACKAGE_COMPONENT) set(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "-${CPACK_RPM_PACKAGE_COMPONENT}") + string(TOUPPER ${CPACK_RPM_PACKAGE_COMPONENT} CPACK_RPM_PACKAGE_COMPONENT_UPPER) else() set(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "") endif() @@ -430,12 +484,31 @@ set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACK # # CPACK_RPM_PACKAGE_SUMMARY (mandatory) + +# CPACK_RPM_PACKAGE_SUMMARY_ is used only locally so that it can be unset each time before use otherwise +# component packaging could leak variable content between components +unset(CPACK_RPM_PACKAGE_SUMMARY_) +if(CPACK_RPM_PACKAGE_SUMMARY) + set(CPACK_RPM_PACKAGE_SUMMARY_ ${CPACK_RPM_PACKAGE_SUMMARY}) + unset(CPACK_RPM_PACKAGE_SUMMARY) +endif() + +#Check for component summary first. +#If not set, it will use regular package summary logic. +if(CPACK_RPM_PACKAGE_COMPONENT) + if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_SUMMARY) + set(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_SUMMARY}) + endif() +endif() + if(NOT CPACK_RPM_PACKAGE_SUMMARY) - # if neither var is defined lets use the name as summary - if(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY) - string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_RPM_PACKAGE_SUMMARY) - else() + if(CPACK_RPM_PACKAGE_SUMMARY_) + set(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_RPM_PACKAGE_SUMMARY_}) + elseif(CPACK_PACKAGE_DESCRIPTION_SUMMARY) set(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}) + else() + # if neither var is defined lets use the name as summary + string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_RPM_PACKAGE_SUMMARY) endif() endif() @@ -508,12 +581,33 @@ endif() # if it is defined # - set to a default value # -if (NOT CPACK_RPM_PACKAGE_DESCRIPTION) - if (CPACK_PACKAGE_DESCRIPTION_FILE) - file(READ ${CPACK_PACKAGE_DESCRIPTION_FILE} CPACK_RPM_PACKAGE_DESCRIPTION) - else () - set(CPACK_RPM_PACKAGE_DESCRIPTION "no package description available") - endif () + +# CPACK_RPM_PACKAGE_DESCRIPTION_ is used only locally so that it can be unset each time before use otherwise +# component packaging could leak variable content between components +unset(CPACK_RPM_PACKAGE_DESCRIPTION_) +if(CPACK_RPM_PACKAGE_DESCRIPTION) + set(CPACK_RPM_PACKAGE_DESCRIPTION_ ${CPACK_RPM_PACKAGE_DESCRIPTION}) + unset(CPACK_RPM_PACKAGE_DESCRIPTION) +endif() + +#Check for a component description first. +#If not set, it will use regular package description logic. +if(CPACK_RPM_PACKAGE_COMPONENT) + if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_DESCRIPTION) + set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_DESCRIPTION}) + elseif(CPACK_COMPONENT_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_DESCRIPTION) + set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_COMPONENT_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_DESCRIPTION}) + endif() +endif() + +if(NOT CPACK_RPM_PACKAGE_DESCRIPTION) + if(CPACK_RPM_PACKAGE_DESCRIPTION_) + set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_RPM_PACKAGE_DESCRIPTION_}) + elseif(CPACK_PACKAGE_DESCRIPTION_FILE) + file(READ ${CPACK_PACKAGE_DESCRIPTION_FILE} CPACK_RPM_PACKAGE_DESCRIPTION) + else () + set(CPACK_RPM_PACKAGE_DESCRIPTION "no package description available") + endif () endif () # CPACK_RPM_COMPRESSION_TYPE @@ -556,7 +650,7 @@ endif() # There may be some COMPONENT specific variables as well # If component specific var is not provided we use the global one # for each component -foreach(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX CONFLICTS AUTOPROV AUTOREQ AUTOREQPROV) +foreach(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX CONFLICTS AUTOPROV AUTOREQ AUTOREQPROV REQUIRES_PRE REQUIRES_POST REQUIRES_PREUN REQUIRES_POSTUN) if(CPACK_RPM_PACKAGE_DEBUG) message("CPackRPM:Debug: processing ${_RPM_SPEC_HEADER}") endif() @@ -595,6 +689,13 @@ foreach(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX CONFLIC string(TOLOWER "${_PACKAGE_HEADER_TAIL}" _PACKAGE_HEADER_TAIL) string(SUBSTRING ${_RPM_SPEC_HEADER} 0 1 _PACKAGE_HEADER_NAME) set(_PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME}${_PACKAGE_HEADER_TAIL}") + # The following keywords require parentheses around the "pre" or "post" suffix in the final RPM spec file. + set(SCRIPTS_REQUIREMENTS_LIST REQUIRES_PRE REQUIRES_POST REQUIRES_PREUN REQUIRES_POSTUN) + list(FIND SCRIPTS_REQUIREMENTS_LIST ${_RPM_SPEC_HEADER} IS_SCRIPTS_REQUIREMENT_FOUND) + if(NOT ${IS_SCRIPTS_REQUIREMENT_FOUND} EQUAL -1) + string(REPLACE "_" "(" _PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME}") + set(_PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME})") + endif() if(CPACK_RPM_PACKAGE_DEBUG) message("CPackRPM:Debug: User defined ${_PACKAGE_HEADER_NAME}:\n ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP}") endif() @@ -991,6 +1092,10 @@ Group: \@CPACK_RPM_PACKAGE_GROUP\@ Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@ \@TMP_RPM_URL\@ \@TMP_RPM_REQUIRES\@ +\@TMP_RPM_REQUIRES_PRE\@ +\@TMP_RPM_REQUIRES_POST\@ +\@TMP_RPM_REQUIRES_PREUN\@ +\@TMP_RPM_REQUIRES_POSTUN\@ \@TMP_RPM_PROVIDES\@ \@TMP_RPM_OBSOLETES\@ \@TMP_RPM_CONFLICTS\@ @@ -1100,3 +1205,15 @@ else() message(FATAL_ERROR "RPM packaging through alien not done (yet)") endif() endif() + +# reset variables from temporary variables +if(CPACK_RPM_PACKAGE_SUMMARY_) + set(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_RPM_PACKAGE_SUMMARY_}) +else() + unset(CPACK_RPM_PACKAGE_SUMMARY) +endif() +if(CPACK_RPM_PACKAGE_DESCRIPTION_) + set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_RPM_PACKAGE_DESCRIPTION_}) +else() + unset(CPACK_RPM_PACKAGE_DESCRIPTION) +endif() diff --git a/Modules/CheckStructHasMember.cmake b/Modules/CheckStructHasMember.cmake index c8949cf..de31d2c 100644 --- a/Modules/CheckStructHasMember.cmake +++ b/Modules/CheckStructHasMember.cmake @@ -69,8 +69,7 @@ macro (CHECK_STRUCT_HAS_MEMBER _STRUCT _MEMBER _HEADER _RESULT) ${_INCLUDE_FILES} int main() { - ${_STRUCT}* tmp; - (void) tmp->${_MEMBER}; + (void)((${_STRUCT} *)0)->${_MEMBER}; return 0; } ") diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index d6a6b72..8513437 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -1,187 +1,322 @@ -#.rst: -# ExternalProject -# --------------- -# -# Create custom targets to build projects in external trees -# -# The ``ExternalProject_Add`` function creates a custom target to drive -# download, update/patch, configure, build, install and test steps of an -# external project: -# -# .. code-block:: cmake -# -# ExternalProject_Add(<name> # Name for custom target -# [DEPENDS projects...] # Targets on which the project depends -# [PREFIX dir] # Root dir for entire project -# [LIST_SEPARATOR sep] # Sep to be replaced by ; in cmd lines -# [TMP_DIR dir] # Directory to store temporary files -# [STAMP_DIR dir] # Directory to store step timestamps -# [EXCLUDE_FROM_ALL 1] # The "all" target does not depend on this -# #--Download step-------------- -# [DOWNLOAD_NAME fname] # File name to store (if not end of URL) -# [DOWNLOAD_DIR dir] # Directory to store downloaded files -# [DOWNLOAD_COMMAND cmd...] # Command to download source tree -# [DOWNLOAD_NO_PROGRESS 1] # Disable download progress reports -# [CVS_REPOSITORY cvsroot] # CVSROOT of CVS repository -# [CVS_MODULE mod] # Module to checkout from CVS repo -# [CVS_TAG tag] # Tag to checkout from CVS repo -# [SVN_REPOSITORY url] # URL of Subversion repo -# [SVN_REVISION -r<rev>] # Revision to checkout from Subversion repo -# [SVN_USERNAME john ] # Username for Subversion checkout and update -# [SVN_PASSWORD doe ] # Password for Subversion checkout and update -# [SVN_TRUST_CERT 1 ] # Trust the Subversion server site certificate -# [GIT_REPOSITORY url] # URL of git repo -# [GIT_TAG tag] # Git branch name, commit id or tag -# [GIT_SUBMODULES modules...] # Git submodules that shall be updated, all if empty -# [HG_REPOSITORY url] # URL of mercurial repo -# [HG_TAG tag] # Mercurial branch name, commit id or tag -# [URL /.../src.tgz] # Full path or URL of source -# [URL_HASH ALGO=value] # Hash of file at URL -# [URL_MD5 md5] # Equivalent to URL_HASH MD5=md5 -# [TLS_VERIFY bool] # Should certificate for https be checked -# [TLS_CAINFO file] # Path to a certificate authority file -# [TIMEOUT seconds] # Time allowed for file download operations -# #--Update/Patch step---------- -# [UPDATE_COMMAND cmd...] # Source work-tree update command -# [PATCH_COMMAND cmd...] # Command to patch downloaded source -# #--Configure step------------- -# [SOURCE_DIR dir] # Source dir to be used for build -# [CONFIGURE_COMMAND cmd...] # Build tree configuration command -# [CMAKE_COMMAND /.../cmake] # Specify alternative cmake executable -# [CMAKE_GENERATOR gen] # Specify generator for native build -# [CMAKE_GENERATOR_PLATFORM p] # Generator-specific platform name -# [CMAKE_GENERATOR_TOOLSET t] # Generator-specific toolset name -# [CMAKE_ARGS args...] # Arguments to CMake command line -# [CMAKE_CACHE_ARGS args...] # Initial cache arguments, of the form -Dvar:string=on -# #--Build step----------------- -# [BINARY_DIR dir] # Specify build dir location -# [BUILD_COMMAND cmd...] # Command to drive the native build -# [BUILD_IN_SOURCE 1] # Use source dir for build dir -# [BUILD_ALWAYS 1] # No stamp file, build step always runs -# #--Install step--------------- -# [INSTALL_DIR dir] # Installation prefix -# [INSTALL_COMMAND cmd...] # Command to drive install after build -# #--Test step------------------ -# [TEST_BEFORE_INSTALL 1] # Add test step executed before install step -# [TEST_AFTER_INSTALL 1] # Add test step executed after install step -# [TEST_COMMAND cmd...] # Command to drive test -# #--Output logging------------- -# [LOG_DOWNLOAD 1] # Wrap download in script to log output -# [LOG_UPDATE 1] # Wrap update in script to log output -# [LOG_CONFIGURE 1] # Wrap configure in script to log output -# [LOG_BUILD 1] # Wrap build in script to log output -# [LOG_TEST 1] # Wrap test in script to log output -# [LOG_INSTALL 1] # Wrap install in script to log output -# #--Custom targets------------- -# [STEP_TARGETS st1 st2 ...] # Generate custom targets for these steps -# ) -# -# The ``*_DIR`` options specify directories for the project, with default -# directories computed as follows. If the ``PREFIX`` option is given to -# ``ExternalProject_Add()`` or the ``EP_PREFIX`` directory property is set, -# then an external project is built and installed under the specified prefix:: -# -# TMP_DIR = <prefix>/tmp -# STAMP_DIR = <prefix>/src/<name>-stamp -# DOWNLOAD_DIR = <prefix>/src -# SOURCE_DIR = <prefix>/src/<name> -# BINARY_DIR = <prefix>/src/<name>-build -# INSTALL_DIR = <prefix> -# -# Otherwise, if the ``EP_BASE`` directory property is set then components -# of an external project are stored under the specified base:: -# -# TMP_DIR = <base>/tmp/<name> -# STAMP_DIR = <base>/Stamp/<name> -# DOWNLOAD_DIR = <base>/Download/<name> -# SOURCE_DIR = <base>/Source/<name> -# BINARY_DIR = <base>/Build/<name> -# INSTALL_DIR = <base>/Install/<name> -# -# If no ``PREFIX``, ``EP_PREFIX``, or ``EP_BASE`` is specified then the -# default is to set ``PREFIX`` to ``<name>-prefix``. Relative paths are -# interpreted with respect to the build directory corresponding to the -# source directory in which ``ExternalProject_Add`` is invoked. -# -# If ``SOURCE_DIR`` is explicitly set to an existing directory the project -# will be built from it. Otherwise a download step must be specified -# using one of the ``DOWNLOAD_COMMAND``, ``CVS_*``, ``SVN_*``, or ``URL`` -# options. The ``URL`` option may refer locally to a directory or source -# tarball, or refer to a remote tarball (e.g. ``http://.../src.tgz``). -# -# The ``ExternalProject_Add_Step`` function adds a custom step to an -# external project: -# -# .. code-block:: cmake -# -# ExternalProject_Add_Step(<name> <step> # Names of project and custom step -# [COMMAND cmd...] # Command line invoked by this step -# [COMMENT "text..."] # Text printed when step executes -# [DEPENDEES steps...] # Steps on which this step depends -# [DEPENDERS steps...] # Steps that depend on this step -# [DEPENDS files...] # Files on which this step depends -# [ALWAYS 1] # No stamp file, step always runs -# [EXCLUDE_FROM_MAIN 1] # Main target does not depend on this step -# [WORKING_DIRECTORY dir] # Working directory for command -# [LOG 1] # Wrap step in script to log output -# ) -# -# The command line, comment, and working directory of every standard and -# custom step is processed to replace tokens ``<SOURCE_DIR>``, -# ``<BINARY_DIR>``, ``<INSTALL_DIR>``, and ``<TMP_DIR>`` with -# corresponding property values. -# -# Any builtin step that specifies a ``<step>_COMMAND cmd...`` or custom -# step that specifies a ``COMMAND cmd...`` may specify additional command -# lines using the form ``COMMAND cmd...``. At build time the commands -# will be executed in order and aborted if any one fails. For example:: -# -# ... BUILD_COMMAND make COMMAND echo done ... -# -# specifies to run ``make`` and then ``echo done`` during the build step. -# Whether the current working directory is preserved between commands is -# not defined. Behavior of shell operators like ``&&`` is not defined. -# -# The ``ExternalProject_Get_Property`` function retrieves external project -# target properties:: -# -# ExternalProject_Get_Property(<name> [prop1 [prop2 [...]]]) -# -# It stores property values in variables of the same name. Property -# names correspond to the keyword argument names of -# ``ExternalProject_Add``. -# -# The ``ExternalProject_Add_StepTargets`` function generates custom -# targets for the steps listed:: -# -# ExternalProject_Add_StepTargets(<name> [step1 [step2 [...]]]) -# -# If ``STEP_TARGETS`` is set then ``ExternalProject_Add_StepTargets`` is -# automatically called at the end of matching calls to -# ``ExternalProject_Add_Step``. Pass ``STEP_TARGETS`` explicitly to -# individual ``ExternalProject_Add`` calls, or implicitly to all -# ``ExternalProject_Add`` calls by setting the directory property -# ``EP_STEP_TARGETS``. -# -# If ``STEP_TARGETS`` is not set, clients may still manually call -# ``ExternalProject_Add_StepTargets`` after calling -# ``ExternalProject_Add`` or ``ExternalProject_Add_Step``. -# -# This functionality is provided to make it easy to drive the steps -# independently of each other by specifying targets on build command -# lines. For example, you may be submitting to a sub-project based -# dashboard, where you want to drive the configure portion of the build, -# then submit to the dashboard, followed by the build portion, followed -# by tests. If you invoke a custom target that depends on a step -# halfway through the step dependency chain, then all the previous steps -# will also run to ensure everything is up to date. -# -# For example, to drive configure, build and test steps independently -# for each ``ExternalProject_Add`` call in your project, write the following -# line prior to any ``ExternalProject_Add`` calls in your ``CMakeLists.txt`` -# file:: -# -# set_property(DIRECTORY PROPERTY EP_STEP_TARGETS configure build test) +#[=======================================================================[.rst: +ExternalProject +--------------- + +Create custom targets to build projects in external trees + +.. command:: ExternalProject_Add + + The ``ExternalProject_Add`` function creates a custom target to drive + download, update/patch, configure, build, install and test steps of an + external project:: + + ExternalProject_Add(<name> [<option>...]) + + General options are: + + ``DEPENDS <projects>...`` + Targets on which the project depends + ``PREFIX <dir>`` + Root dir for entire project + ``LIST_SEPARATOR <sep>`` + Sep to be replaced by ; in cmd lines + ``TMP_DIR <dir>`` + Directory to store temporary files + ``STAMP_DIR <dir>`` + Directory to store step timestamps + ``EXCLUDE_FROM_ALL 1`` + The "all" target does not depend on this + + Download step options are: + + ``DOWNLOAD_NAME <fname>`` + File name to store (if not end of URL) + ``DOWNLOAD_DIR <dir>`` + Directory to store downloaded files + ``DOWNLOAD_COMMAND <cmd>...`` + Command to download source tree + ``DOWNLOAD_NO_PROGRESS 1`` + Disable download progress reports + ``CVS_REPOSITORY <cvsroot>`` + CVSROOT of CVS repository + ``CVS_MODULE <mod>`` + Module to checkout from CVS repo + ``CVS_TAG <tag>`` + Tag to checkout from CVS repo + ``SVN_REPOSITORY <url>`` + URL of Subversion repo + ``SVN_REVISION -r<rev>`` + Revision to checkout from Subversion repo + ``SVN_USERNAME <username>`` + Username for Subversion checkout and update + ``SVN_PASSWORD <password>`` + Password for Subversion checkout and update + ``SVN_TRUST_CERT 1`` + Trust the Subversion server site certificate + ``GIT_REPOSITORY <url>`` + URL of git repo + ``GIT_TAG <tag>`` + Git branch name, commit id or tag + ``GIT_SUBMODULES <module>...`` + Git submodules that shall be updated, all if empty + ``HG_REPOSITORY <url>`` + URL of mercurial repo + ``HG_TAG <tag>`` + Mercurial branch name, commit id or tag + ``URL /.../src.tgz`` + Full path or URL of source + ``URL_HASH ALGO=value`` + Hash of file at URL + ``URL_MD5 md5`` + Equivalent to URL_HASH MD5=md5 + ``TLS_VERIFY <bool>`` + Should certificate for https be checked + ``TLS_CAINFO <file>`` + Path to a certificate authority file + ``TIMEOUT <seconds>`` + Time allowed for file download operations + + Update/Patch step options are: + + ``UPDATE_COMMAND <cmd>...`` + Source work-tree update command + ``PATCH_COMMAND <cmd>...`` + Command to patch downloaded source + + Configure step options are: + + ``SOURCE_DIR <dir>`` + Source dir to be used for build + ``CONFIGURE_COMMAND <cmd>...`` + Build tree configuration command + ``CMAKE_COMMAND /.../cmake`` + Specify alternative cmake executable + ``CMAKE_GENERATOR <gen>`` + Specify generator for native build + ``CMAKE_GENERATOR_PLATFORM <platform>`` + Generator-specific platform name + ``CMAKE_GENERATOR_TOOLSET <toolset>`` + Generator-specific toolset name + ``CMAKE_ARGS <arg>...`` + Arguments to CMake command line. + These arguments are passed to CMake command line, and can contain + arguments other than cache values, see also + :manual:`CMake Options <cmake(1)>`. Arguments in the form + ``-Dvar:string=on`` are always passed to the command line, and + therefore cannot be changed by the user. + ``CMAKE_CACHE_ARGS <arg>...`` + Initial cache arguments, of the form ``-Dvar:string=on``. + These arguments are written in a pre-load a script that populates + CMake cache, see also :manual:`cmake -C <cmake(1)>`. This allows to + overcome command line length limits. + These arguments are :command:`set` using the ``FORCE`` argument, + and therefore cannot be changed by the user. + ``CMAKE_CACHE_DEFAULT_ARGS <arg>...`` + Initial default cache arguments, of the form ``-Dvar:string=on``. + These arguments are written in a pre-load a script that populates + CMake cache, see also :manual:`cmake -C <cmake(1)>`. This allows to + overcome command line length limits. + These arguments can be used as default value that will be set if no + previous value is found in the cache, and that the user can change + later. + + Build step options are: + + ``BINARY_DIR <dir>`` + Specify build dir location + ``BUILD_COMMAND <cmd>...`` + Command to drive the native build + ``BUILD_IN_SOURCE 1`` + Use source dir for build dir + ``BUILD_ALWAYS 1`` + No stamp file, build step always runs + + Install step options are: + + ``INSTALL_DIR <dir>`` + Installation prefix + ``INSTALL_COMMAND <cmd>...`` + Command to drive install after build + + Test step options are: + + ``TEST_BEFORE_INSTALL 1`` + Add test step executed before install step + ``TEST_AFTER_INSTALL 1`` + Add test step executed after install step + ``TEST_COMMAND <cmd>...`` + Command to drive test + + Output logging options are: + + ``LOG_DOWNLOAD 1`` + Wrap download in script to log output + ``LOG_UPDATE 1`` + Wrap update in script to log output + ``LOG_CONFIGURE 1`` + Wrap configure in script to log output + ``LOG_BUILD 1`` + Wrap build in script to log output + ``LOG_TEST 1`` + Wrap test in script to log output + ``LOG_INSTALL 1`` + Wrap install in script to log output + + Other options are: + + ``STEP_TARGETS <step-target>...`` + Generate custom targets for these steps + ``INDEPENDENT_STEP_TARGETS <step-target>...`` + Generate custom targets for these steps that do not depend on other + external projects even if a dependency is set + + The ``*_DIR`` options specify directories for the project, with default + directories computed as follows. If the ``PREFIX`` option is given to + ``ExternalProject_Add()`` or the ``EP_PREFIX`` directory property is set, + then an external project is built and installed under the specified prefix:: + + TMP_DIR = <prefix>/tmp + STAMP_DIR = <prefix>/src/<name>-stamp + DOWNLOAD_DIR = <prefix>/src + SOURCE_DIR = <prefix>/src/<name> + BINARY_DIR = <prefix>/src/<name>-build + INSTALL_DIR = <prefix> + + Otherwise, if the ``EP_BASE`` directory property is set then components + of an external project are stored under the specified base:: + + TMP_DIR = <base>/tmp/<name> + STAMP_DIR = <base>/Stamp/<name> + DOWNLOAD_DIR = <base>/Download/<name> + SOURCE_DIR = <base>/Source/<name> + BINARY_DIR = <base>/Build/<name> + INSTALL_DIR = <base>/Install/<name> + + If no ``PREFIX``, ``EP_PREFIX``, or ``EP_BASE`` is specified then the + default is to set ``PREFIX`` to ``<name>-prefix``. Relative paths are + interpreted with respect to the build directory corresponding to the + source directory in which ``ExternalProject_Add`` is invoked. + + If ``SOURCE_DIR`` is explicitly set to an existing directory the project + will be built from it. Otherwise a download step must be specified + using one of the ``DOWNLOAD_COMMAND``, ``CVS_*``, ``SVN_*``, or ``URL`` + options. The ``URL`` option may refer locally to a directory or source + tarball, or refer to a remote tarball (e.g. ``http://.../src.tgz``). + +.. command:: ExternalProject_Add_Step + + The ``ExternalProject_Add_Step`` function adds a custom step to an + external project:: + + ExternalProject_Add_Step(<name> <step> [<option>...]) + + Options are: + + ``COMMAND <cmd>...`` + Command line invoked by this step + ``COMMENT "<text>..."`` + Text printed when step executes + ``DEPENDEES <step>...`` + Steps on which this step depends + ``DEPENDERS <step>...`` + Steps that depend on this step + ``DEPENDS <file>...`` + Files on which this step depends + ``ALWAYS 1`` + No stamp file, step always runs + ``EXCLUDE_FROM_MAIN 1`` + Main target does not depend on this step + ``WORKING_DIRECTORY <dir>`` + Working directory for command + ``LOG 1`` + Wrap step in script to log output + + The command line, comment, and working directory of every standard and + custom step is processed to replace tokens ``<SOURCE_DIR>``, + ``<BINARY_DIR>``, ``<INSTALL_DIR>``, and ``<TMP_DIR>`` with + corresponding property values. + +Any builtin step that specifies a ``<step>_COMMAND cmd...`` or custom +step that specifies a ``COMMAND cmd...`` may specify additional command +lines using the form ``COMMAND cmd...``. At build time the commands +will be executed in order and aborted if any one fails. For example:: + + ... BUILD_COMMAND make COMMAND echo done ... + +specifies to run ``make`` and then ``echo done`` during the build step. +Whether the current working directory is preserved between commands is +not defined. Behavior of shell operators like ``&&`` is not defined. + +.. command:: ExternalProject_Get_Property + + The ``ExternalProject_Get_Property`` function retrieves external project + target properties:: + + ExternalProject_Get_Property(<name> [prop1 [prop2 [...]]]) + + It stores property values in variables of the same name. Property + names correspond to the keyword argument names of + ``ExternalProject_Add``. + +.. command:: ExternalProject_Add_StepTargets + + The ``ExternalProject_Add_StepTargets`` function generates custom + targets for the steps listed:: + + ExternalProject_Add_StepTargets(<name> [NO_DEPENDS] [step1 [step2 [...]]]) + +If ``NO_DEPENDS`` is set, the target will not depend on the +dependencies of the complete project. This is usually safe to use for +the download, update, and patch steps that do not require that all the +dependencies are updated and built. Using ``NO_DEPENDS`` for other +of the default steps might break parallel builds, so you should avoid, +it. For custom steps, you should consider whether or not the custom +commands requires that the dependencies are configured, built and +installed. + +If ``STEP_TARGETS`` or ``INDEPENDENT_STEP_TARGETS`` is set then +``ExternalProject_Add_StepTargets`` is automatically called at the end +of matching calls to ``ExternalProject_Add_Step``. Pass +``STEP_TARGETS`` or ``INDEPENDENT_STEP_TARGETS`` explicitly to +individual ``ExternalProject_Add`` calls, or implicitly to all +``ExternalProject_Add`` calls by setting the directory properties +``EP_STEP_TARGETS`` and ``EP_INDEPENDENT_STEP_TARGETS``. The +``INDEPENDENT`` version of the argument and of the property will call +``ExternalProject_Add_StepTargets`` with the ``NO_DEPENDS`` argument. + +If ``STEP_TARGETS`` and ``INDEPENDENT_STEP_TARGETS`` are not set, +clients may still manually call ``ExternalProject_Add_StepTargets`` +after calling ``ExternalProject_Add`` or ``ExternalProject_Add_Step``. + +This functionality is provided to make it easy to drive the steps +independently of each other by specifying targets on build command +lines. For example, you may be submitting to a sub-project based +dashboard, where you want to drive the configure portion of the build, +then submit to the dashboard, followed by the build portion, followed +by tests. If you invoke a custom target that depends on a step +halfway through the step dependency chain, then all the previous steps +will also run to ensure everything is up to date. + +For example, to drive configure, build and test steps independently +for each ``ExternalProject_Add`` call in your project, write the following +line prior to any ``ExternalProject_Add`` calls in your ``CMakeLists.txt`` +file:: + + set_property(DIRECTORY PROPERTY EP_STEP_TARGETS configure build test) + +.. command:: ExternalProject_Add_StepDependencies + + The ``ExternalProject_Add_StepDependencies`` function add some + dependencies for some external project step:: + + ExternalProject_Add_StepDependencies(<name> <step> [target1 [target2 [...]]]) + + This function takes care to set both target and file level + dependencies, and will ensure that parallel builds will not break. + It should be used instead of :command:`add_dependencies()` when adding + a dependency for some of the step targets generated by + ``ExternalProject``. +#]=======================================================================] #============================================================================= # Copyright 2008-2013 Kitware, Inc. @@ -200,9 +335,9 @@ math(EXPR _ep_documentation_line_count "${CMAKE_CURRENT_LIST_LINE} - 16") file(STRINGS "${CMAKE_CURRENT_LIST_FILE}" lines LIMIT_COUNT ${_ep_documentation_line_count} - REGEX "^# ( \\[[A-Z0-9_]+ [^]]*\\] +#.*$|[A-Za-z0-9_]+\\()") + REGEX "^\\.\\. command:: [A-Za-z0-9_]+|^ ``[A-Z0-9_]+ .*``$") foreach(line IN LISTS lines) - if("${line}" MATCHES "^# ([A-Za-z0-9_]+)\\(") + if("${line}" MATCHES "^\\.\\. command:: ([A-Za-z0-9_]+)") if(_ep_func) set(_ep_keywords_${_ep_func} "${_ep_keywords_${_ep_func}})$") endif() @@ -210,8 +345,8 @@ foreach(line IN LISTS lines) #message("function [${_ep_func}]") set(_ep_keywords_${_ep_func} "^(") set(_ep_keyword_sep) - else() - string(REGEX REPLACE "^# \\[([A-Z0-9_]+) .*" "\\1" _ep_key "${line}") + elseif("${line}" MATCHES "^ ``([A-Z0-9_]+) .*``$") + set(_ep_key "${CMAKE_MATCH_1}") #message(" keyword [${_ep_key}]") set(_ep_keywords_${_ep_func} "${_ep_keywords_${_ep_func}}${_ep_keyword_sep}${_ep_key}") @@ -290,10 +425,19 @@ define_property(DIRECTORY PROPERTY "EP_STEP_TARGETS" INHERITED BRIEF_DOCS "List of ExternalProject steps that automatically get corresponding targets" FULL_DOCS + "These targets will be dependent on the main target dependencies" "See documentation of the ExternalProject_Add_StepTargets() function in the " "ExternalProject module." ) +define_property(DIRECTORY PROPERTY "EP_INDEPENDENT_STEP_TARGETS" INHERITED + BRIEF_DOCS + "List of ExternalProject steps that automatically get corresponding targets" + FULL_DOCS + "These targets will not be dependent on the main target dependencies" + "See documentation of the ExternalProject_Add_StepTargets() function in the " + "ExternalProject module." + ) function(_ep_write_gitclone_script script_filename source_dir git_EXECUTABLE git_repository git_tag git_submodules src_name work_dir gitclone_infofile gitclone_stampfile) file(WRITE ${script_filename} @@ -897,17 +1041,20 @@ macro(_ep_replace_location_tags target_name) endmacro() -function(_ep_write_initial_cache target_name script_filename args) - # Write out values into an initial cache, that will be passed to CMake with -C +function(_ep_command_line_to_initial_cache var args force) set(script_initial_cache "") set(regex "^([^:]+):([^=]+)=(.*)$") set(setArg "") + set(forceArg "") + if(force) + set(forceArg "FORCE") + endif() foreach(line ${args}) if("${line}" MATCHES "^-D(.*)") set(line "${CMAKE_MATCH_1}") if(setArg) # This is required to build up lists in variables, or complete an entry - set(setArg "${setArg}${accumulator}\" CACHE ${type} \"Initial cache\" FORCE)") + set(setArg "${setArg}${accumulator}\" CACHE ${type} \"Initial cache\" ${forceArg})") set(script_initial_cache "${script_initial_cache}\n${setArg}") set(accumulator "") set(setArg "") @@ -927,9 +1074,15 @@ function(_ep_write_initial_cache target_name script_filename args) endforeach() # Catch the final line of the args if(setArg) - set(setArg "${setArg}${accumulator}\" CACHE ${type} \"Initial cache\" FORCE)") + set(setArg "${setArg}${accumulator}\" CACHE ${type} \"Initial cache\" ${forceArg})") set(script_initial_cache "${script_initial_cache}\n${setArg}") endif() + set(${var} ${script_initial_cache} PARENT_SCOPE) +endfunction() + + +function(_ep_write_initial_cache target_name script_filename script_initial_cache) + # Write out values into an initial cache, that will be passed to CMake with -C # Replace location tags. _ep_replace_location_tags(${target_name} script_initial_cache) # Write out the initial cache file to the location specified. @@ -1167,19 +1320,28 @@ endfunction() function(ExternalProject_Add_StepTargets name) set(steps ${ARGN}) - + if("${ARGV1}" STREQUAL "NO_DEPENDS") + set(no_deps 1) + list(REMOVE_AT steps 0) + endif() foreach(step ${steps}) + if(no_deps AND "${step}" MATCHES "^(configure|build|install|test)$") + message(AUTHOR_WARNING "Using NO_DEPENDS for \"${step}\" step might break parallel builds") + endif() _ep_get_step_stampfile(${name} ${step} stamp_file) add_custom_target(${name}-${step} DEPENDS ${stamp_file}) + set_property(TARGET ${name}-${step} PROPERTY _EP_IS_EXTERNAL_PROJECT_STEP 1) set_property(TARGET ${name}-${step} PROPERTY LABELS ${name}) set_property(TARGET ${name}-${step} PROPERTY FOLDER "ExternalProjectTargets/${name}") # Depend on other external projects (target-level). - get_property(deps TARGET ${name} PROPERTY _EP_DEPENDS) - foreach(arg IN LISTS deps) - add_dependencies(${name}-${step} ${arg}) - endforeach() + if(NOT no_deps) + get_property(deps TARGET ${name} PROPERTY _EP_DEPENDS) + foreach(arg IN LISTS deps) + add_dependencies(${name}-${step} ${arg}) + endforeach() + endif() endforeach() endfunction() @@ -1270,6 +1432,7 @@ function(ExternalProject_Add_Step name step) WORKING_DIRECTORY ${work_dir} VERBATIM ) + set_property(TARGET ${name} APPEND PROPERTY _EP_STEPS ${step}) # Add custom "step target"? get_property(step_targets TARGET ${name} PROPERTY _EP_STEP_TARGETS) @@ -1282,6 +1445,60 @@ function(ExternalProject_Add_Step name step) break() endif() endforeach() + + get_property(independent_step_targets TARGET ${name} PROPERTY _EP_INDEPENDENT_STEP_TARGETS) + if(NOT independent_step_targets) + get_property(independent_step_targets DIRECTORY PROPERTY EP_INDEPENDENT_STEP_TARGETS) + endif() + foreach(st ${independent_step_targets}) + if("${st}" STREQUAL "${step}") + ExternalProject_Add_StepTargets(${name} NO_DEPENDS ${step}) + break() + endif() + endforeach() +endfunction() + + +function(ExternalProject_Add_StepDependencies name step) + set(dependencies ${ARGN}) + + # Sanity checks on "name" and "step". + if(NOT TARGET ${name}) + message(FATAL_ERROR "Cannot find target \"${name}\". Perhaps it has not yet been created using ExternalProject_Add.") + endif() + + get_property(is_ep TARGET ${name} PROPERTY _EP_IS_EXTERNAL_PROJECT) + if(NOT is_ep) + message(FATAL_ERROR "Target \"${name}\" was not generated by ExternalProject_Add.") + endif() + + get_property(steps TARGET ${name} PROPERTY _EP_STEPS) + list(FIND steps ${step} is_step) + if(NOT is_step) + message(FATAL_ERROR "External project \"${name}\" does not have a step \"${step}\".") + endif() + + if(TARGET ${name}-${step}) + get_property(is_ep_step TARGET ${name}-${step} PROPERTY _EP_IS_EXTERNAL_PROJECT_STEP) + if(NOT is_ep_step) + message(FATAL_ERROR "Target \"${name}\" was not generated by ExternalProject_Add_StepTargets.") + endif() + endif() + + # Always add file-level dependency, but add target-level dependency + # only if the target exists for that step. + _ep_get_step_stampfile(${name} ${step} stamp_file) + foreach(dep ${dependencies}) + add_custom_command(APPEND + OUTPUT ${stamp_file} + DEPENDS ${dep}) + if(TARGET ${name}-${step}) + foreach(dep ${dependencies}) + add_dependencies(${name}-${step} ${dep}) + endforeach() + endif() + endforeach() + endfunction() @@ -1744,11 +1961,20 @@ function(_ep_add_configure_command name) get_property(cmake_args TARGET ${name} PROPERTY _EP_CMAKE_ARGS) list(APPEND cmd ${cmake_args}) - # If there are any CMAKE_CACHE_ARGS, write an initial cache and use it + # If there are any CMAKE_CACHE_ARGS or CMAKE_CACHE_DEFAULT_ARGS, + # write an initial cache and use it get_property(cmake_cache_args TARGET ${name} PROPERTY _EP_CMAKE_CACHE_ARGS) - if(cmake_cache_args) + get_property(cmake_cache_default_args TARGET ${name} PROPERTY _EP_CMAKE_CACHE_DEFAULT_ARGS) + + if(cmake_cache_args OR cmake_cache_default_args) set(_ep_cache_args_script "${tmp_dir}/${name}-cache.cmake") - _ep_write_initial_cache(${name} "${_ep_cache_args_script}" "${cmake_cache_args}") + if(cmake_cache_args) + _ep_command_line_to_initial_cache(script_initial_cache_force "${cmake_cache_args}" 1) + endif() + if(cmake_cache_default_args) + _ep_command_line_to_initial_cache(script_initial_cache_default "${cmake_cache_default_args}" 0) + endif() + _ep_write_initial_cache(${name} "${_ep_cache_args_script}" "${script_initial_cache_force}${script_initial_cache_default}") list(APPEND cmd "-C${_ep_cache_args_script}") endif() diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake index 37bc6b5..9016db8 100644 --- a/Modules/FeatureSummary.cmake +++ b/Modules/FeatureSummary.cmake @@ -17,7 +17,7 @@ # :: # # -- The following OPTIONAL packages have been found: -# LibXml2 (required version >= 2.4) , XML processing library. , <http://xmlsoft.org> +# LibXml2 (required version >= 2.4), XML processing lib, <http://xmlsoft.org> # * Enables HTML-import in MyWordProcessor # * Enables odt-export in MyWordProcessor # PNG , A PNG image library. , <http://www.libpng.org/pub/png/> diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 3642b3e..aad6575 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -321,7 +321,7 @@ macro(_Boost_FIND_LIBRARY var) # If Boost_LIBRARY_DIR is known then search only there. if(Boost_LIBRARY_DIR) - set(_boost_LIBRARY_SEARCH_DIRS ${Boost_LIBRARY_DIR} NO_DEFAULT_PATH) + set(_boost_LIBRARY_SEARCH_DIRS ${Boost_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) endif() endmacro() @@ -855,7 +855,7 @@ if(_Boost_CHANGE_LIBDIR AND NOT _Boost_LIBRARY_DIR_CHANGED) endif() if(Boost_LIBRARY_DIR) - set(_boost_LIBRARY_SEARCH_DIRS ${Boost_LIBRARY_DIR} NO_DEFAULT_PATH) + set(_boost_LIBRARY_SEARCH_DIRS ${Boost_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) else() set(_boost_LIBRARY_SEARCH_DIRS "") if(BOOST_LIBRARYDIR) diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 3dd975c..29bb875 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -278,13 +278,13 @@ # Only available for CUDA version 3.2+. # CUDA_cusparse_LIBRARY -- CUDA Sparse Matrix library. # Only available for CUDA version 3.2+. -# CUDA_npp_LIBRARY -- NVIDIA Performance Primitives library. +# CUDA_npp_LIBRARY -- NVIDIA Performance Primitives lib. # Only available for CUDA version 4.0+. -# CUDA_nppc_LIBRARY -- NVIDIA Performance Primitives library (core). +# CUDA_nppc_LIBRARY -- NVIDIA Performance Primitives lib (core). # Only available for CUDA version 5.5+. -# CUDA_nppi_LIBRARY -- NVIDIA Performance Primitives library (image processing). +# CUDA_nppi_LIBRARY -- NVIDIA Performance Primitives lib (image processing). # Only available for CUDA version 5.5+. -# CUDA_npps_LIBRARY -- NVIDIA Performance Primitives library (signal processing). +# CUDA_npps_LIBRARY -- NVIDIA Performance Primitives lib (signal processing). # Only available for CUDA version 5.5+. # CUDA_nvcuvenc_LIBRARY -- CUDA Video Encoder library. # Only available for CUDA version 3.2+. diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake index 0184c39..a21ca89 100644 --- a/Modules/FindCurses.cmake +++ b/Modules/FindCurses.cmake @@ -50,6 +50,8 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake) + find_library(CURSES_CURSES_LIBRARY NAMES curses ) find_library(CURSES_NCURSES_LIBRARY NAMES ncurses ) @@ -81,7 +83,6 @@ endif() # prefix as the library was found, if still not found, try curses.h with the # default search paths. if(CURSES_CURSES_LIBRARY AND CURSES_NEED_NCURSES) - include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake) include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) cmake_push_check_state() set(CMAKE_REQUIRED_QUIET ${Curses_FIND_QUIETLY}) diff --git a/Modules/FindGettext.cmake b/Modules/FindGettext.cmake index 16478cb..f972ad0 100644 --- a/Modules/FindGettext.cmake +++ b/Modules/FindGettext.cmake @@ -17,6 +17,7 @@ # # # Additionally it provides the following macros: +# # GETTEXT_CREATE_TRANSLATIONS ( outputFile [ALL] file1 ... fileN ) # # :: @@ -32,8 +33,9 @@ # :: # # Process the given pot file to mo files. -# If INSTALL_DESTINATION is given then automatically install rules will be created, -# the language subdirectory will be taken into account (by default use share/locale/). +# If INSTALL_DESTINATION is given then automatically install rules will +# be created, the language subdirectory will be taken into account +# (by default use share/locale/). # If ALL is specified, the pot file is processed when building the all traget. # It creates a custom target "potfile". # @@ -43,8 +45,9 @@ # :: # # Process the given po files to mo files for the given language. -# If INSTALL_DESTINATION is given then automatically install rules will be created, -# the language subdirectory will be taken into account (by default use share/locale/). +# If INSTALL_DESTINATION is given then automatically install rules will +# be created, the language subdirectory will be taken into account +# (by default use share/locale/). # If ALL is specified, the po files are processed when building the all traget. # It creates a custom target "pofiles". diff --git a/Modules/FindIce.cmake b/Modules/FindIce.cmake index 55528b8..76cecc1 100644 --- a/Modules/FindIce.cmake +++ b/Modules/FindIce.cmake @@ -43,7 +43,7 @@ # # Ice_HOME - the root of the Ice installation # -# The environment variable :envvar:`ICE_HOME` may also be used; the +# The environment variable ``ICE_HOME`` may also be used; the # Ice_HOME variable takes precedence. # # The following cache variables may also be set:: diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake index 0bd7eb0..79be34e 100644 --- a/Modules/FindJava.cmake +++ b/Modules/FindJava.cmake @@ -17,7 +17,7 @@ # Java_JAVAH_EXECUTABLE = the full path to the Java header generator # Java_JAVADOC_EXECUTABLE = the full path to the Java documention generator # Java_JAR_EXECUTABLE = the full path to the Java archiver -# Java_VERSION_STRING = Version of the package found (java version), eg. 1.6.0_12 +# Java_VERSION_STRING = Version of java found, eg. 1.6.0_12 # Java_VERSION_MAJOR = The major version of the package found. # Java_VERSION_MINOR = The minor version of the package found. # Java_VERSION_PATCH = The patch version of the package found. diff --git a/Modules/FindLibXslt.cmake b/Modules/FindLibXslt.cmake index bf2f821..2416341 100644 --- a/Modules/FindLibXslt.cmake +++ b/Modules/FindLibXslt.cmake @@ -17,10 +17,10 @@ # Additionally, the following two variables are set (but not required # for using xslt): # -# :: -# -# LIBXSLT_EXSLT_LIBRARIES - Link to these if you need to link against the exslt library -# LIBXSLT_XSLTPROC_EXECUTABLE - Contains the full path to the xsltproc executable if found +# ``LIBXSLT_EXSLT_LIBRARIES`` +# Link to these if you need to link against the exslt library. +# ``LIBXSLT_XSLTPROC_EXECUTABLE`` +# Contains the full path to the xsltproc executable if found. #============================================================================= # Copyright 2006-2009 Kitware, Inc. diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index 3be5e3c..ba4ea5b 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -160,7 +160,7 @@ set(_MPI_XL_Fortran_COMPILER_NAMES mpixlf95 mpixlf95_r mpxlf95 mpxlf95 # or if we know it matches the regular compiler. foreach (lang C CXX Fortran) foreach (id GNU Intel PGI XL) - if (NOT CMAKE_${lang}_COMPILER_ID OR "${CMAKE_${lang}_COMPILER_ID}" STREQUAL "${id}") + if (NOT CMAKE_${lang}_COMPILER_ID OR CMAKE_${lang}_COMPILER_ID STREQUAL id) list(APPEND _MPI_${lang}_COMPILER_NAMES ${_MPI_${id}_${lang}_COMPILER_NAMES}) endif() unset(_MPI_${id}_${lang}_COMPILER_NAMES) # clean up the namespace here diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake index 6bcf1e7..2de1fb3 100644 --- a/Modules/FindPackageHandleStandardArgs.cmake +++ b/Modules/FindPackageHandleStandardArgs.cmake @@ -319,7 +319,7 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) endif () unset(_VERSION_HEAD) else () - if (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}") + if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL VERSION) set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"") set(VERSION_OK FALSE) else () @@ -329,7 +329,7 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) unset(_VERSION_DOTS) else() # minimum version specified: - if ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}") + if (${_NAME}_FIND_VERSION VERSION_GREATER VERSION) set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is at least \"${${_NAME}_FIND_VERSION}\"") set(VERSION_OK FALSE) else () diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index d728324..bf58ede 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -490,9 +490,10 @@ endmacro() pkg_check_modules (XRENDER REQUIRED xrender) - Defines e.g.: - ``XRENDER_LIBRARIES=Xrender;X11`` and - ``XRENDER_STATIC_LIBRARIES=Xrender;X11;pthread;Xau;Xdmcp`` + Defines for example:: + + XRENDER_LIBRARIES=Xrender;X11`` + XRENDER_STATIC_LIBRARIES=Xrender;X11;pthread;Xau;Xdmcp #]========================================] macro(pkg_check_modules _prefix _module0) # check cached value diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index 72ca6ed..f01bd41 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -2,127 +2,80 @@ # FindProtobuf # ------------ # -# -# # Locate and configure the Google Protocol Buffers library. # # The following variables can be set and are optional: # -# :: -# -# PROTOBUF_SRC_ROOT_FOLDER - When compiling with MSVC, if this cache variable is set -# the protobuf-default VS project build locations -# (vsprojects/Debug & vsprojects/Release) will be searched -# for libraries and binaries. -# -# -# -# :: -# -# PROTOBUF_IMPORT_DIRS - List of additional directories to be searched for -# imported .proto files. (New in CMake 2.8.8) -# -# +# ``PROTOBUF_SRC_ROOT_FOLDER`` +# When compiling with MSVC, if this cache variable is set +# the protobuf-default VS project build locations +# (vsprojects/Debug & vsprojects/Release) will be searched +# for libraries and binaries. +# ``PROTOBUF_IMPORT_DIRS`` +# List of additional directories to be searched for +# imported .proto files. # # Defines the following variables: # -# :: -# -# PROTOBUF_FOUND - Found the Google Protocol Buffers library (libprotobuf & header files) -# PROTOBUF_INCLUDE_DIRS - Include directories for Google Protocol Buffers -# PROTOBUF_LIBRARIES - The protobuf libraries -# -# [New in CMake 2.8.5] -# -# :: -# -# PROTOBUF_PROTOC_LIBRARIES - The protoc libraries -# PROTOBUF_LITE_LIBRARIES - The protobuf-lite libraries -# -# +# ``PROTOBUF_FOUND`` +# Found the Google Protocol Buffers library +# (libprotobuf & header files) +# ``PROTOBUF_INCLUDE_DIRS`` +# Include directories for Google Protocol Buffers +# ``PROTOBUF_LIBRARIES`` +# The protobuf libraries +# ``PROTOBUF_PROTOC_LIBRARIES`` +# The protoc libraries +# ``PROTOBUF_LITE_LIBRARIES`` +# The protobuf-lite libraries # # The following cache variables are also available to set or use: # -# :: -# -# PROTOBUF_LIBRARY - The protobuf library -# PROTOBUF_PROTOC_LIBRARY - The protoc library -# PROTOBUF_INCLUDE_DIR - The include directory for protocol buffers -# PROTOBUF_PROTOC_EXECUTABLE - The protoc compiler -# -# [New in CMake 2.8.5] -# -# :: -# -# PROTOBUF_LIBRARY_DEBUG - The protobuf library (debug) -# PROTOBUF_PROTOC_LIBRARY_DEBUG - The protoc library (debug) -# PROTOBUF_LITE_LIBRARY - The protobuf lite library -# PROTOBUF_LITE_LIBRARY_DEBUG - The protobuf lite library (debug) -# -# -# -# :: -# -# ==================================================================== -# Example: -# -# -# -# :: -# -# find_package(Protobuf REQUIRED) -# include_directories(${PROTOBUF_INCLUDE_DIRS}) -# -# -# -# :: -# -# include_directories(${CMAKE_CURRENT_BINARY_DIR}) -# PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS foo.proto) -# add_executable(bar bar.cc ${PROTO_SRCS} ${PROTO_HDRS}) -# target_link_libraries(bar ${PROTOBUF_LIBRARIES}) -# -# -# -# NOTE: You may need to link against pthreads, depending -# -# :: -# -# on the platform. -# -# -# -# NOTE: The PROTOBUF_GENERATE_CPP macro & add_executable() or -# add_library() -# -# :: -# -# calls only work properly within the same directory. -# -# -# -# :: -# -# ==================================================================== -# -# -# -# PROTOBUF_GENERATE_CPP (public function) -# -# :: -# -# SRCS = Variable to define with autogenerated -# source files -# HDRS = Variable to define with autogenerated -# header files -# ARGN = proto files -# -# -# -# :: -# -# ==================================================================== - +# ``PROTOBUF_LIBRARY`` +# The protobuf library +# ``PROTOBUF_PROTOC_LIBRARY`` +# The protoc library +# ``PROTOBUF_INCLUDE_DIR`` +# The include directory for protocol buffers +# ``PROTOBUF_PROTOC_EXECUTABLE`` +# The protoc compiler +# ``PROTOBUF_LIBRARY_DEBUG`` +# The protobuf library (debug) +# ``PROTOBUF_PROTOC_LIBRARY_DEBUG`` +# The protoc library (debug) +# ``PROTOBUF_LITE_LIBRARY`` +# The protobuf lite library +# ``PROTOBUF_LITE_LIBRARY_DEBUG`` +# The protobuf lite library (debug) +# +# Example: +# +# .. code-block:: cmake +# +# find_package(Protobuf REQUIRED) +# include_directories(${PROTOBUF_INCLUDE_DIRS}) +# include_directories(${CMAKE_CURRENT_BINARY_DIR}) +# protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS foo.proto) +# add_executable(bar bar.cc ${PROTO_SRCS} ${PROTO_HDRS}) +# target_link_libraries(bar ${PROTOBUF_LIBRARIES}) +# +# .. note:: +# The PROTOBUF_GENERATE_CPP macro and add_executable() or +# add_library() calls only work properly within the same +# directory. +# +# .. command:: protobuf_generate_cpp +# +# Add custom commands to process ``.proto`` files:: +# +# protobuf_generate_cpp (<SRCS> <HDRS> [<ARGN>...]) +# +# ``SRCS`` +# Variable to define with autogenerated source files +# ``HDRS`` +# Variable to define with autogenerated header files +# ``ARGN`` +# ``.proto`` files #============================================================================= # Copyright 2009 Kitware, Inc. diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index 2c39de5..a79246a 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -23,7 +23,7 @@ # .. note:: # # When using :prop_tgt:`IMPORTED` targets, the qtmain.lib static library is -# automatically linked on Windows for :variable:`WIN32 <WIN32_EXECUTABLE>` +# automatically linked on Windows for :prop_tgt:`WIN32 <WIN32_EXECUTABLE>` # executables. To disable that globally, set the # ``QT4_NO_LINK_QTMAIN`` variable before finding Qt4. To disable that # for a particular executable, set the ``QT4_NO_LINK_QTMAIN`` target @@ -104,9 +104,11 @@ # macro QT4_ADD_DBUS_INTERFACES(outfiles inputfile ... ) # Create the interface header and implementation files # for all listed interface xml files. -# The basename will be automatically determined from the name of the xml file. +# The basename will be automatically determined from the name +# of the xml file. # -# The source file properties described for QT4_ADD_DBUS_INTERFACE also apply here. +# The source file properties described for +# QT4_ADD_DBUS_INTERFACE also apply here. # # # :: @@ -172,7 +174,7 @@ # a class uses the Q_OBJECT macro, moc has to run on it. If you don't # want to use QT4_WRAP_CPP() (which is reliable and mature), you can insert # #include "foo.moc" -# in foo.cpp and then give foo.cpp as argument to QT4_AUTOMOC(). This will the +# in foo.cpp and then give foo.cpp as argument to QT4_AUTOMOC(). This will # scan all listed files at cmake-time for such included moc files and if it # finds them cause a rule to be generated to run moc at build time on the # accompanying header file foo.h. @@ -188,8 +190,8 @@ # This function is obsolete. Use target_link_libraries with IMPORTED targets # instead. # Make <target> use the <modules> from Qt. Using a Qt module means -# to link to the library, add the relevant include directories for the module, -# and add the relevant compiler defines for using the module. +# to link to the library, add the relevant include directories for the +# module, and add the relevant compiler defines for using the module. # Modules are roughly equivalent to components of Qt4, so usage would be # something like: # qt4_use_modules(myexe Core Gui Declarative) diff --git a/Modules/FindSDL_image.cmake b/Modules/FindSDL_image.cmake index fc2c043..49b5e40 100644 --- a/Modules/FindSDL_image.cmake +++ b/Modules/FindSDL_image.cmake @@ -11,7 +11,8 @@ # SDL_IMAGE_LIBRARIES, the name of the library to link against # SDL_IMAGE_INCLUDE_DIRS, where to find the headers # SDL_IMAGE_FOUND, if false, do not try to link against -# SDL_IMAGE_VERSION_STRING - human-readable string containing the version of SDL_image +# SDL_IMAGE_VERSION_STRING - human-readable string containing the +# version of SDL_image # # # diff --git a/Modules/FindSDL_mixer.cmake b/Modules/FindSDL_mixer.cmake index 176fee6..9e11796 100644 --- a/Modules/FindSDL_mixer.cmake +++ b/Modules/FindSDL_mixer.cmake @@ -11,7 +11,8 @@ # SDL_MIXER_LIBRARIES, the name of the library to link against # SDL_MIXER_INCLUDE_DIRS, where to find the headers # SDL_MIXER_FOUND, if false, do not try to link against -# SDL_MIXER_VERSION_STRING - human-readable string containing the version of SDL_mixer +# SDL_MIXER_VERSION_STRING - human-readable string containing the +# version of SDL_mixer # # # diff --git a/Modules/FindSDL_sound.cmake b/Modules/FindSDL_sound.cmake index 5fa40a5..494d358 100644 --- a/Modules/FindSDL_sound.cmake +++ b/Modules/FindSDL_sound.cmake @@ -21,7 +21,8 @@ # flags to SDL_SOUND_LIBRARIES. This is prepended to SDL_SOUND_LIBRARIES. # This is available mostly for cases this module failed to anticipate for # and you must add additional flags. This is marked as ADVANCED. -# SDL_SOUND_VERSION_STRING, human-readable string containing the version of SDL_sound +# SDL_SOUND_VERSION_STRING, human-readable string containing the +# version of SDL_sound # # # diff --git a/Modules/FindSquish.cmake b/Modules/FindSquish.cmake index 4fdecb4..51e279d 100644 --- a/Modules/FindSquish.cmake +++ b/Modules/FindSquish.cmake @@ -41,8 +41,9 @@ # # :: # -# squish_v4_add_test(cmakeTestName AUT targetName SUITE suiteName TEST squishTestName -# [SETTINGSGROUP group] [PRE_COMMAND command] [POST_COMMAND command] ) +# squish_v4_add_test(cmakeTestName +# AUT targetName SUITE suiteName TEST squishTestName +# [SETTINGSGROUP group] [PRE_COMMAND command] [POST_COMMAND command] ) # # # diff --git a/Modules/FortranCInterface/CMakeLists.txt b/Modules/FortranCInterface/CMakeLists.txt index b6232ed..721a262 100644 --- a/Modules/FortranCInterface/CMakeLists.txt +++ b/Modules/FortranCInterface/CMakeLists.txt @@ -71,7 +71,7 @@ endif() # Generate C symbol sources. set(symbol_sources) -if(NOT "${CMAKE_Fortran_COMPILER_ID}" MATCHES "^(PathScale|Cray)$") +if(NOT CMAKE_Fortran_COMPILER_ID MATCHES "^(PathScale|Cray)$") # Provide mymodule_ and my_module_ init symbols because: # - PGI Fortran uses module init symbols # but not for: diff --git a/Modules/Platform/Darwin-GNU-Fortran.cmake b/Modules/Platform/Darwin-GNU-Fortran.cmake index f4b509a..6724f9b 100644 --- a/Modules/Platform/Darwin-GNU-Fortran.cmake +++ b/Modules/Platform/Darwin-GNU-Fortran.cmake @@ -14,6 +14,8 @@ include(Platform/Darwin-GNU) __darwin_compiler_gnu(Fortran) +cmake_gnu_set_sysroot_flag(Fortran) +cmake_gnu_set_osx_deployment_target_flag(Fortran) set(CMAKE_Fortran_OSX_COMPATIBILITY_VERSION_FLAG "-compatibility_version ") set(CMAKE_Fortran_OSX_CURRENT_VERSION_FLAG "-current_version ") diff --git a/Modules/Platform/Windows-wcl386.cmake b/Modules/Platform/Windows-wcl386.cmake index ac410de..88f9bf7 100644 --- a/Modules/Platform/Windows-wcl386.cmake +++ b/Modules/Platform/Windows-wcl386.cmake @@ -18,8 +18,8 @@ set(CMAKE_CREATE_CONSOLE_EXE "system nt" ) set(CMAKE_SHARED_LINKER_FLAGS_INIT "system nt_dll") set(CMAKE_MODULE_LINKER_FLAGS_INIT "system nt_dll") foreach(type SHARED MODULE EXE) - set(CMAKE_${type}_LINKER_FLAGS_DEBUG_INIT "debug all opt map, symfile") - set(CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO_INIT "debug all opt map, symfile") + set(CMAKE_${type}_LINKER_FLAGS_DEBUG_INIT "debug all opt map") + set(CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO_INIT "debug all opt map") endforeach() set(CMAKE_C_COMPILE_OPTIONS_DLL "-bd") # Note: This variable is a ';' separated list diff --git a/Modules/Platform/eCos.cmake b/Modules/Platform/eCos.cmake index a203826..e1279ef 100644 --- a/Modules/Platform/eCos.cmake +++ b/Modules/Platform/eCos.cmake @@ -28,7 +28,7 @@ include(Platform/UnixPaths) # eCos can be built only with gcc get_property(_IN_TC GLOBAL PROPERTY IN_TRY_COMPILE) -if(CMAKE_C_COMPILER AND NOT "${CMAKE_C_COMPILER_ID}" MATCHES "GNU" AND NOT _IN_TC) +if(CMAKE_C_COMPILER AND NOT CMAKE_C_COMPILER_ID MATCHES "GNU" AND NOT _IN_TC) message(FATAL_ERROR "GNU gcc is required for eCos") endif() if(CMAKE_CXX_COMPILER AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" AND NOT _IN_TC) diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake index 8c4daac..6516b0a 100644 --- a/Modules/Qt4Macros.cmake +++ b/Modules/Qt4Macros.cmake @@ -232,7 +232,7 @@ macro (QT4_ADD_RESOURCES outfiles ) # let's make a configured file and add it as a dependency so cmake is run # again when dependencies need to be recomputed. QT4_MAKE_OUTPUT_FILE("${infile}" "" "qrc.depends" out_depends) - configure_file("${infile}" "${out_depends}" COPY_ONLY) + configure_file("${infile}" "${out_depends}" COPYONLY) else() # The .qrc file does not exist (yet). Let's add a dependency and hope # that it will be generated later diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index 127012f..3a6acd8 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -398,7 +398,7 @@ function(add_jar _TARGET_NAME) ${CMAKE_JAVA_LIBRARY_OUTPUT_PATH} ) - if (WIN32 AND NOT CYGWIN AND CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") + if (CMAKE_HOST_WIN32 AND NOT CYGWIN AND CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") set(CMAKE_JAVA_INCLUDE_FLAG_SEP ";") else () set(CMAKE_JAVA_INCLUDE_FLAG_SEP ":") diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index 31ab48d..bab1b21 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -272,6 +272,8 @@ macro(SWIG_ADD_MODULE name language) if(WIN32 AND NOT CYGWIN) set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES SUFFIX ".pyd") endif() + elseif ("${swig_lowercase_language}" STREQUAL "r") + set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES PREFIX "") elseif ("${swig_lowercase_language}" STREQUAL "ruby") # In ruby you want: # require 'LIBRARY' diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index f9405b3..7705683 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -473,7 +473,7 @@ set(SRCS ${SRCS} cmNinjaUtilityTargetGenerator.cxx cmNinjaUtilityTargetGenerator.h ) -if(WIN32 AND NOT CYGWIN AND NOT BORLAND) +if(WIN32 AND NOT CYGWIN) set_source_files_properties(cmcldeps.cxx PROPERTIES COMPILE_DEFINITIONS _WIN32_WINNT=0x0501) add_executable(cmcldeps cmcldeps.cxx) target_link_libraries(cmcldeps CMakeLib) @@ -522,8 +522,10 @@ set(CTEST_SRCS cmCTest.cxx CTest/cmParseCacheCoverage.cxx CTest/cmParseGTMCoverage.cxx CTest/cmParseJacocoCoverage.cxx + CTest/cmParseBlanketJSCoverage.cxx CTest/cmParsePHPCoverage.cxx CTest/cmParseCoberturaCoverage.cxx + CTest/cmParseDelphiCoverage.cxx CTest/cmCTestEmptyBinaryDirectoryCommand.cxx CTest/cmCTestGenericHandler.cxx CTest/cmCTestHandlerCommand.cxx diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 716f229..08f8dba 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 0) -set(CMake_VERSION_RC 1) +set(CMake_VERSION_PATCH 20141110) +#set(CMake_VERSION_RC 1) diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index 6e7b8d7..e2437b5 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -56,7 +56,7 @@ int cmCPackArchiveGenerator::addOneComponentToArchive(cmArchiveWrite& archive, localToplevel += "/"+ component->Name; std::string dir = cmSystemTools::GetCurrentWorkingDirectory(); // Change to local toplevel - cmSystemTools::ChangeDirectory(localToplevel.c_str()); + cmSystemTools::ChangeDirectory(localToplevel); std::string filePrefix; if (this->IsOn("CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY")) { @@ -80,7 +80,7 @@ int cmCPackArchiveGenerator::addOneComponentToArchive(cmArchiveWrite& archive, } } // Go back to previous dir - cmSystemTools::ChangeDirectory(dir.c_str()); + cmSystemTools::ChangeDirectory(dir); return 1; } @@ -270,7 +270,7 @@ int cmCPackArchiveGenerator::PackageFiles() DECLARE_AND_OPEN_ARCHIVE(packageFileNames[0],archive); std::vector<std::string>::const_iterator fileIt; std::string dir = cmSystemTools::GetCurrentWorkingDirectory(); - cmSystemTools::ChangeDirectory(toplevel.c_str()); + cmSystemTools::ChangeDirectory(toplevel); for ( fileIt = files.begin(); fileIt != files.end(); ++ fileIt ) { // Get the relative path to the file @@ -288,7 +288,7 @@ int cmCPackArchiveGenerator::PackageFiles() return 0; } } - cmSystemTools::ChangeDirectory(dir.c_str()); + cmSystemTools::ChangeDirectory(dir); // The destructor of cmArchiveWrite will close and finish the write return 1; } diff --git a/Source/CPack/cmCPackBundleGenerator.cxx b/Source/CPack/cmCPackBundleGenerator.cxx index 6c994f1..fbd1d21 100644 --- a/Source/CPack/cmCPackBundleGenerator.cxx +++ b/Source/CPack/cmCPackBundleGenerator.cxx @@ -39,6 +39,21 @@ int cmCPackBundleGenerator::InitializeInternal() return 0; } + if(this->GetOption("CPACK_BUNDLE_APPLE_CERT_APP")) + { + const std::string codesign_path = cmSystemTools::FindProgram("codesign", + std::vector<std::string>(), false); + + if(codesign_path.empty()) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Cannot locate codesign command" + << std::endl); + return 0; + } + this->SetOptionIfNotSet("CPACK_COMMAND_CODESIGN", codesign_path.c_str()); + } + return this->Superclass::InitializeInternal(); } @@ -53,7 +68,7 @@ const char* cmCPackBundleGenerator::GetPackagingInstallPrefix() } //---------------------------------------------------------------------- -int cmCPackBundleGenerator::PackageFiles() +int cmCPackBundleGenerator::ConstructBundle() { // Get required arguments ... @@ -165,6 +180,22 @@ int cmCPackBundleGenerator::PackageFiles() cmSystemTools::SetPermissions(command_target.str().c_str(), 0777); } + return 1; +} + +//---------------------------------------------------------------------- +int cmCPackBundleGenerator::PackageFiles() +{ + if(!this->ConstructBundle()) + { + return 0; + } + + if(!this->SignBundle(toplevel)) + { + return 0; + } + return this->CreateDMG(toplevel, packageFileNames[0]); } @@ -172,3 +203,96 @@ bool cmCPackBundleGenerator::SupportsComponentInstallation() const { return false; } + + +int cmCPackBundleGenerator::SignBundle(const std::string& src_dir) +{ + const std::string cpack_apple_cert_app = + this->GetOption("CPACK_BUNDLE_APPLE_CERT_APP") + ? this->GetOption("CPACK_BUNDLE_APPLE_CERT_APP") : ""; + + // codesign the application. + if(!cpack_apple_cert_app.empty()) + { + std::string bundle_path; + bundle_path = src_dir + "/"; + bundle_path += this->GetOption("CPACK_BUNDLE_NAME"); + bundle_path += ".app"; + + // A list of additional files to sign, ie. frameworks and plugins. + const std::string sign_files = + this->GetOption("CPACK_BUNDLE_APPLE_CODESIGN_FILES") + ? this->GetOption("CPACK_BUNDLE_APPLE_CODESIGN_FILES") : ""; + + std::vector<std::string> relFiles; + cmSystemTools::ExpandListArgument(sign_files, relFiles); + + // sign the files supplied by the user, ie. frameworks. + for(std::vector<std::string>::iterator it = relFiles.begin(); + it != relFiles.end(); ++it) + { + cmOStringStream temp_sign_file_cmd; + temp_sign_file_cmd << this->GetOption("CPACK_COMMAND_CODESIGN"); + temp_sign_file_cmd << " --deep -f -s \"" << cpack_apple_cert_app; + temp_sign_file_cmd << "\" -i "; + temp_sign_file_cmd << this->GetOption("CPACK_APPLE_BUNDLE_ID"); + temp_sign_file_cmd << " \""; + temp_sign_file_cmd << bundle_path; + temp_sign_file_cmd << it->c_str() << "\""; + + if(!this->RunCommand(temp_sign_file_cmd)) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error signing file:" + << bundle_path << it->c_str() << std::endl); + + return 0; + } + } + + // sign main binary + cmOStringStream temp_sign_binary_cmd; + temp_sign_binary_cmd << this->GetOption("CPACK_COMMAND_CODESIGN"); + temp_sign_binary_cmd << " --deep -f -s \"" << cpack_apple_cert_app; + temp_sign_binary_cmd << "\" \"" << bundle_path << "\""; + + if(!this->RunCommand(temp_sign_binary_cmd)) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error signing the application binary." + << std::endl); + + return 0; + } + + // sign app bundle + cmOStringStream temp_codesign_cmd; + temp_codesign_cmd << this->GetOption("CPACK_COMMAND_CODESIGN"); + temp_codesign_cmd << " --deep -f -s \"" << cpack_apple_cert_app << "\""; + if(this->GetOption("CPACK_BUNDLE_APPLE_ENTITLEMENTS")) + { + temp_codesign_cmd << " --entitlements "; + temp_codesign_cmd << this->GetOption("CPACK_BUNDLE_APPLE_ENTITLEMENTS"); + } + temp_codesign_cmd << " \"" << bundle_path << "\""; + + if(!this->RunCommand(temp_codesign_cmd)) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error signing the application package." + << std::endl); + + return 0; + } + + cmCPackLogger(cmCPackLog::LOG_OUTPUT, + "- Application has been codesigned" + << std::endl); + cmCPackLogger(cmCPackLog::LOG_VERBOSE, + (this->GetOption("CPACK_BUNDLE_APPLE_ENTITLEMENTS") + ? "with entitlement sandboxing" : "without entitlement sandboxing") + << std::endl); + } + + return 1; +} diff --git a/Source/CPack/cmCPackBundleGenerator.h b/Source/CPack/cmCPackBundleGenerator.h index ed0187d..9cb2f0a 100644 --- a/Source/CPack/cmCPackBundleGenerator.h +++ b/Source/CPack/cmCPackBundleGenerator.h @@ -31,6 +31,8 @@ public: protected: virtual int InitializeInternal(); virtual const char* GetPackagingInstallPrefix(); + int ConstructBundle(); + int SignBundle(const std::string& src_dir); int PackageFiles(); bool SupportsComponentInstallation() const; diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index 936942b..c939cd2 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -58,7 +58,7 @@ int cmCPackDebGenerator::PackageOnePack(std::string initialTopLevel, // Begin the archive for this pack std::string localToplevel(initialTopLevel); std::string packageFileName( - cmSystemTools::GetParentDirectory(toplevel.c_str()) + cmSystemTools::GetParentDirectory(toplevel) ); std::string outputFileName( std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME")) @@ -186,7 +186,7 @@ int cmCPackDebGenerator::PackageComponentsAllInOne() // The ALL GROUPS in ONE package case std::string localToplevel(initialTopLevel); std::string packageFileName( - cmSystemTools::GetParentDirectory(toplevel.c_str()) + cmSystemTools::GetParentDirectory(toplevel) ); std::string outputFileName( std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME")) @@ -540,7 +540,7 @@ int cmCPackDebGenerator::createDeb() localcopy += filenamename; // if we can copy the file, it means it does exist, let's add it: if( cmsys::SystemTools::CopyFileIfDifferent( - i->c_str(), localcopy.c_str()) ) + *i, localcopy) ) { // debian is picky and need relative to ./ path in the tar.* cmd += " ./"; diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 1461bb1..31f0b59 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -399,7 +399,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( cmCPackLogger(cmCPackLog::LOG_DEBUG, "Copy file: " << inFile << " -> " << filePath << std::endl); /* If the file is a symlink we will have to re-create it */ - if ( cmSystemTools::FileIsSymlink(inFile.c_str())) + if ( cmSystemTools::FileIsSymlink(inFile)) { std::string targetFile; std::string inFileRelative = @@ -429,7 +429,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( goToDir += "/"+subdir; cmCPackLogger(cmCPackLog::LOG_DEBUG, "Change dir to: " << goToDir <<std::endl); - cmSystemTools::ChangeDirectory(goToDir.c_str()); + cmSystemTools::ChangeDirectory(goToDir); for (symlinkedIt=symlinkedFiles.begin(); symlinkedIt != symlinkedFiles.end(); ++symlinkedIt) @@ -448,7 +448,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( } cmCPackLogger(cmCPackLog::LOG_DEBUG, "Going back to: " << curDir <<std::endl); - cmSystemTools::ChangeDirectory(curDir.c_str()); + cmSystemTools::ChangeDirectory(curDir); } } } diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx index c8737f4..94ca536 100644 --- a/Source/CPack/cmCPackGeneratorFactory.cxx +++ b/Source/CPack/cmCPackGeneratorFactory.cxx @@ -47,9 +47,6 @@ #include "cmCPackLog.h" -#if defined(__BORLANDC__) -# pragma warn -8008 /* condition is always true */ -#endif //---------------------------------------------------------------------- cmCPackGeneratorFactory::cmCPackGeneratorFactory() diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index a5eee6b..c1fff7d 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -657,8 +657,8 @@ bool cmCPackNSISGenerator::GetListOfSubdirectories(const char* topdir, cmsys_stl::string fullPath = topdir; fullPath += "/"; fullPath += dir.GetFile(static_cast<unsigned long>(fileNum)); - if(cmsys::SystemTools::FileIsDirectory(fullPath.c_str()) && - !cmsys::SystemTools::FileIsSymlink(fullPath.c_str())) + if(cmsys::SystemTools::FileIsDirectory(fullPath) && + !cmsys::SystemTools::FileIsSymlink(fullPath)) { if (!this->GetListOfSubdirectories(fullPath.c_str(), dirs)) { @@ -771,7 +771,7 @@ CreateComponentDescription(cmCPackComponent *component, << archiveFile << std::endl); if (cmSystemTools::FileExists(archiveFile.c_str(), true)) { - if (!cmSystemTools::RemoveFile(archiveFile.c_str())) + if (!cmSystemTools::RemoveFile(archiveFile)) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Unable to remove archive file " << archiveFile diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx index c6171dc..71ab3a0 100644 --- a/Source/CPack/cmCPackRPMGenerator.cxx +++ b/Source/CPack/cmCPackRPMGenerator.cxx @@ -57,7 +57,7 @@ int cmCPackRPMGenerator::PackageOnePack(std::string initialToplevel, // Begin the archive for this pack std::string localToplevel(initialToplevel); std::string packageFileName( - cmSystemTools::GetParentDirectory(toplevel.c_str()) + cmSystemTools::GetParentDirectory(toplevel) ); std::string outputFileName( GetComponentPackageFileName(this->GetOption("CPACK_PACKAGE_FILE_NAME"), @@ -166,7 +166,7 @@ int cmCPackRPMGenerator::PackageComponentsAllInOne() // The ALL GROUPS in ONE package case std::string localToplevel(initialTopLevel); std::string packageFileName( - cmSystemTools::GetParentDirectory(toplevel.c_str()) + cmSystemTools::GetParentDirectory(toplevel) ); std::string outputFileName( std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME")) diff --git a/Source/CPack/cmCPackSTGZGenerator.cxx b/Source/CPack/cmCPackSTGZGenerator.cxx index 6c1d201..e5da5cf 100644 --- a/Source/CPack/cmCPackSTGZGenerator.cxx +++ b/Source/CPack/cmCPackSTGZGenerator.cxx @@ -71,8 +71,6 @@ int cmCPackSTGZGenerator::PackageFiles() retval &= cmSystemTools::SetPermissions((*it).c_str(), #if defined( _MSC_VER ) || defined( __MINGW32__ ) S_IREAD | S_IWRITE | S_IEXEC -#elif defined( __BORLANDC__ ) - S_IRUSR | S_IWUSR | S_IXUSR #else S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP | diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index c57028d..26bf607 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -267,7 +267,7 @@ int main (int argc, char const* const* argv) if ( cmSystemTools::FileExists(cpackConfigFile.c_str()) ) { cpackConfigFile = - cmSystemTools::CollapseFullPath(cpackConfigFile.c_str()); + cmSystemTools::CollapseFullPath(cpackConfigFile); cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE, "Read CPack configuration file: " << cpackConfigFile << std::endl); diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index 41db042..a101e39 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -109,7 +109,7 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring, out << "Error: cmake execution failed\n"; out << cmakeOutString << "\n"; // return to the original directory - cmSystemTools::ChangeDirectory(cwd.c_str()); + cmSystemTools::ChangeDirectory(cwd); if(outstring) { *outstring = out.str(); @@ -128,7 +128,7 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring, out << "Error: cmake execution failed\n"; out << cmakeOutString << "\n"; // return to the original directory - cmSystemTools::ChangeDirectory(cwd.c_str()); + cmSystemTools::ChangeDirectory(cwd); if(outstring) { *outstring = out.str(); @@ -241,11 +241,11 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); out << "Internal cmake changing into directory: " << this->BinaryDir << std::endl; - if (!cmSystemTools::FileIsDirectory(this->BinaryDir.c_str())) + if (!cmSystemTools::FileIsDirectory(this->BinaryDir)) { cmSystemTools::MakeDirectory(this->BinaryDir.c_str()); } - cmSystemTools::ChangeDirectory(this->BinaryDir.c_str()); + cmSystemTools::ChangeDirectory(this->BinaryDir); if(this->BuildNoCMake) { @@ -374,7 +374,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) cmCTestLog(this->CTest, ERROR_MESSAGE, out.str()); } // return to the original directory - cmSystemTools::ChangeDirectory(cwd.c_str()); + cmSystemTools::ChangeDirectory(cwd); return 1; } @@ -391,7 +391,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) if(this->BuildRunDir.size()) { out << "Run test in directory: " << this->BuildRunDir << "\n"; - cmSystemTools::ChangeDirectory(this->BuildRunDir.c_str()); + cmSystemTools::ChangeDirectory(this->BuildRunDir); } out << "Running test command: \"" << fullPath << "\""; for(size_t k=0; k < this->TestCommandArgs.size(); ++k) @@ -453,9 +453,9 @@ int cmCTestBuildAndTestHandler::ProcessCommandLineArguments( // dir must exist before CollapseFullPath is called cmSystemTools::MakeDirectory(this->BinaryDir.c_str()); this->BinaryDir - = cmSystemTools::CollapseFullPath(this->BinaryDir.c_str()); + = cmSystemTools::CollapseFullPath(this->BinaryDir); this->SourceDir - = cmSystemTools::CollapseFullPath(this->SourceDir.c_str()); + = cmSystemTools::CollapseFullPath(this->SourceDir); } else { diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 2ec1365..5e8f8f0 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -36,9 +36,6 @@ #include <math.h> #include <float.h> -#if defined(__BORLANDC__) -# pragma warn -8060 /* possibly incorrect assignment */ -#endif static const char* cmCTestErrorMatches[] = { "^[Bb]us [Ee]rror", @@ -610,7 +607,7 @@ void cmCTestBuildHandler::GenerateXMLLaunched(std::ostream& os) int numWarningsAllowed = this->MaxWarnings; // Identify fragments on disk. cmsys::Directory launchDir; - launchDir.Load(this->CTestLaunchDir.c_str()); + launchDir.Load(this->CTestLaunchDir); unsigned long n = launchDir.GetNumberOfFiles(); for(unsigned long i=0; i < n; ++i) { @@ -649,7 +646,7 @@ void cmCTestBuildHandler::GenerateXMLLogScraped(std::ostream& os) std::string srcdir = this->CTest->GetCTestConfiguration("SourceDirectory"); // make sure the source dir is in the correct case on windows // via a call to collapse full path. - srcdir = cmSystemTools::CollapseFullPath(srcdir.c_str()); + srcdir = cmSystemTools::CollapseFullPath(srcdir); srcdir += "/"; for ( it = ew.begin(); it != ew.end() && (numErrorsAllowed || numWarningsAllowed); it++ ) @@ -695,7 +692,7 @@ void cmCTestBuildHandler::GenerateXMLLogScraped(std::ostream& os) { // make sure it is a full path with the correct case cm->SourceFile = cmSystemTools::CollapseFullPath( - cm->SourceFile.c_str()); + cm->SourceFile); cmSystemTools::ReplaceString( cm->SourceFile, srcdir.c_str(), ""); } @@ -822,7 +819,7 @@ cmCTestBuildHandler::LaunchHelper::LaunchHelper(cmCTestBuildHandler* handler): launchDir += "/Build"; // Clean out any existing launcher fragments. - cmSystemTools::RemoveADirectory(launchDir.c_str()); + cmSystemTools::RemoveADirectory(launchDir); if(this->Handler->UseCTestLaunch) { diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 76f6584..8dc22a8 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -15,6 +15,8 @@ #include "cmParseGTMCoverage.h" #include "cmParseCacheCoverage.h" #include "cmParseJacocoCoverage.h" +#include "cmParseDelphiCoverage.h" +#include "cmParseBlanketJSCoverage.h" #include "cmCTest.h" #include "cmake.h" #include "cmMakefile.h" @@ -164,7 +166,7 @@ void cmCTestCoverageHandler::CleanCoverageLogFiles(std::ostream& log) fi != files.end(); ++fi) { log << "Removing old coverage log: " << *fi << "\n"; - cmSystemTools::RemoveFile(fi->c_str()); + cmSystemTools::RemoveFile(*fi); } } @@ -237,10 +239,10 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file, std::string fSrcDir = cmSystemTools::CollapseFullPath(srcDir); std::string fBinDir = cmSystemTools::CollapseFullPath(binDir); std::string fFile = cmSystemTools::CollapseFullPath(file); - bool sourceSubDir = cmSystemTools::IsSubDirectory(fFile.c_str(), - fSrcDir.c_str()); - bool buildSubDir = cmSystemTools::IsSubDirectory(fFile.c_str(), - fBinDir.c_str()); + bool sourceSubDir = cmSystemTools::IsSubDirectory(fFile, + fSrcDir); + bool buildSubDir = cmSystemTools::IsSubDirectory(fFile, + fBinDir); // Always check parent directory of the file. std::string fileDir = cmSystemTools::GetFilenamePath(fFile); std::string checkDir; @@ -423,6 +425,19 @@ int cmCTestCoverageHandler::ProcessHandler() return error; } + file_count += this->HandleBlanketJSCoverage(&cont); + error = cont.Error; + if ( file_count < 0 ) + { + return error; + } + + file_count += this->HandleDelphiCoverage(&cont); + error = cont.Error; + if ( file_count < 0 ) + { + return error; + } std::set<std::string> uncovered = this->FindUncoveredFiles(&cont); if ( file_count == 0 ) @@ -758,8 +773,8 @@ void cmCTestCoverageHandler::PopulateCustomVectors(cmMakefile *mf) //---------------------------------------------------------------------- bool IsFileInDir(const std::string &infile, const std::string &indir) { - std::string file = cmSystemTools::CollapseFullPath(infile.c_str()); - std::string dir = cmSystemTools::CollapseFullPath(indir.c_str()); + std::string file = cmSystemTools::CollapseFullPath(infile); + std::string dir = cmSystemTools::CollapseFullPath(indir); if ( file.size() > dir.size() && @@ -779,7 +794,7 @@ int cmCTestCoverageHandler::HandlePHPCoverage( { cmParsePHPCoverage cov(*cont, this->CTest); std::string coverageDir = this->CTest->GetBinaryDir() + "/xdebugCoverage"; - if(cmSystemTools::FileIsDirectory(coverageDir.c_str())) + if(cmSystemTools::FileIsDirectory(coverageDir)) { cov.ReadPHPCoverageDirectory(coverageDir.c_str()); } @@ -910,8 +925,69 @@ int cmCTestCoverageHandler::HandleJacocoCoverage( return static_cast<int>(cont->TotalCoverage.size()); } +//---------------------------------------------------------------------- +int cmCTestCoverageHandler::HandleDelphiCoverage( + cmCTestCoverageHandlerContainer* cont) +{ + cmParseDelphiCoverage cov = + cmParseDelphiCoverage(*cont, this->CTest); + cmsys::Glob g; + std::vector<std::string> files; + g.SetRecurse(true); + + + std::string BinDir + = this->CTest->GetBinaryDir(); + std::string coverageFile = BinDir+ "/*.html"; + + + g.FindFiles(coverageFile); + files=g.GetFiles(); + if (files.size() > 0) + { + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Found Delphi HTML Files, Performing Coverage" << std::endl); + cov.LoadCoverageData(files); + } + else + { + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " Cannot find Delphi coverage files: " << coverageFile + << std::endl); + } + return static_cast<int>(cont->TotalCoverage.size()); +} //---------------------------------------------------------------------- +int cmCTestCoverageHandler::HandleBlanketJSCoverage( + cmCTestCoverageHandlerContainer* cont) + { + cmParseBlanketJSCoverage cov = + cmParseBlanketJSCoverage(*cont, this->CTest); + std::string SourceDir + = this->CTest->GetCTestConfiguration("SourceDirectory"); + + //Look for something other than output.json, still JSON extension. + std::string coverageFile = SourceDir+ "/*.json"; + cmsys::Glob g; + std::vector<std::string> files; + g.FindFiles(coverageFile); + files=g.GetFiles(); + if (files.size() > 0) + { + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Found BlanketJS output JSON, Performing Coverage" << std::endl); + cov.LoadCoverageData(files); + } + else + { + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " Cannot find BlanketJS coverage files: " << coverageFile + << std::endl); + } + return static_cast<int>(cont->TotalCoverage.size()); + } +//---------------------------------------------------------------------- int cmCTestCoverageHandler::HandleGCovCoverage( cmCTestCoverageHandlerContainer* cont) { @@ -974,7 +1050,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( std::string tempDir = testingDir + "/CoverageInfo"; std::string currentDirectory = cmSystemTools::GetCurrentWorkingDirectory(); cmSystemTools::MakeDirectory(tempDir.c_str()); - cmSystemTools::ChangeDirectory(tempDir.c_str()); + cmSystemTools::ChangeDirectory(tempDir); int gcovStyle = 0; @@ -1295,7 +1371,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( *cont->OFS << " produced in source dir: " << sourceFile << std::endl; actualSourceFile - = cmSystemTools::CollapseFullPath(sourceFile.c_str()); + = cmSystemTools::CollapseFullPath(sourceFile); } else if ( IsFileInDir(sourceFile, cont->BinaryDir) ) { @@ -1304,7 +1380,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( *cont->OFS << " produced in binary dir: " << sourceFile << std::endl; actualSourceFile - = cmSystemTools::CollapseFullPath(sourceFile.c_str()); + = cmSystemTools::CollapseFullPath(sourceFile); } if ( actualSourceFile.empty() ) @@ -1345,7 +1421,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( } } - cmSystemTools::ChangeDirectory(currentDirectory.c_str()); + cmSystemTools::ChangeDirectory(currentDirectory); return file_count; } @@ -1409,8 +1485,8 @@ int cmCTestCoverageHandler::HandleLCovCoverage( for ( it = files.begin(); it != files.end(); ++ it ) { cmCTestLog(this->CTest, HANDLER_OUTPUT, "." << std::flush); - std::string fileDir = cmSystemTools::GetFilenamePath(it->c_str()); - cmSystemTools::ChangeDirectory(fileDir.c_str()); + std::string fileDir = cmSystemTools::GetFilenamePath(*it); + cmSystemTools::ChangeDirectory(fileDir); std::string command = "\"" + lcovCommand + "\" " + lcovExtraFlags + " "; @@ -1609,7 +1685,7 @@ int cmCTestCoverageHandler::HandleLCovCoverage( } } - cmSystemTools::ChangeDirectory(currentDirectory.c_str()); + cmSystemTools::ChangeDirectory(currentDirectory); return file_count; } @@ -1653,7 +1729,7 @@ void cmCTestCoverageHandler::FindLCovFiles(std::vector<std::string>& files) gl.RecurseThroughSymlinksOff(); std::string prevBinaryDir; cmSystemTools::ChangeDirectory( - this->CTest->GetCTestConfiguration("BuildDirectory").c_str()); + this->CTest->GetCTestConfiguration("BuildDirectory")); // Run profmerge to merge all *.dyn files into dpi files cmSystemTools::RunSingleCommand("profmerge"); @@ -1696,9 +1772,9 @@ int cmCTestCoverageHandler::HandleTracePyCoverage( std::string tempDir = testingDir + "/CoverageInfo"; std::string currentDirectory = cmSystemTools::GetCurrentWorkingDirectory(); cmSystemTools::MakeDirectory(tempDir.c_str()); - cmSystemTools::ChangeDirectory(tempDir.c_str()); + cmSystemTools::ChangeDirectory(tempDir); - cmSystemTools::ChangeDirectory(currentDirectory.c_str()); + cmSystemTools::ChangeDirectory(currentDirectory); std::vector<std::string>::iterator fileIt; int file_count = 0; @@ -1714,7 +1790,7 @@ int cmCTestCoverageHandler::HandleTracePyCoverage( } std::string actualSourceFile - = cmSystemTools::CollapseFullPath(fileName.c_str()); + = cmSystemTools::CollapseFullPath(fileName); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Check coverage for file: " << actualSourceFile << std::endl); @@ -1802,7 +1878,7 @@ int cmCTestCoverageHandler::HandleTracePyCoverage( } ++ file_count; } - cmSystemTools::ChangeDirectory(currentDirectory.c_str()); + cmSystemTools::ChangeDirectory(currentDirectory); return file_count; } @@ -2132,7 +2208,7 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary( file += "/"; file += sourceFile; } - file = cmSystemTools::CollapseFullPath(file.c_str()); + file = cmSystemTools::CollapseFullPath(file); bool shouldIDoCoverage = this->ShouldIDoCoverage(file.c_str(), cont->SourceDir.c_str(), diff --git a/Source/CTest/cmCTestCoverageHandler.h b/Source/CTest/cmCTestCoverageHandler.h index d0f274c..4aec795 100644 --- a/Source/CTest/cmCTestCoverageHandler.h +++ b/Source/CTest/cmCTestCoverageHandler.h @@ -84,6 +84,12 @@ private: //! Handle coverage for Jacoco int HandleJacocoCoverage(cmCTestCoverageHandlerContainer* cont); + //! Handle coverage for Delphi (Pascal) + int HandleDelphiCoverage(cmCTestCoverageHandlerContainer* cont); + + //! Handle coverage for Jacoco + int HandleBlanketJSCoverage(cmCTestCoverageHandlerContainer* cont); + //! Handle coverage using Bullseye int HandleBullseyeCoverage(cmCTestCoverageHandlerContainer* cont); int RunBullseyeSourceSummary(cmCTestCoverageHandlerContainer* cont); diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index aaa01b2..98bc9d7 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -158,7 +158,7 @@ std::string cmCTestGIT::FindTopDir() { top_dir += "/"; top_dir += cdup; - top_dir = cmSystemTools::CollapseFullPath(top_dir.c_str()); + top_dir = cmSystemTools::CollapseFullPath(top_dir); } return top_dir; } diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx index 0e29160..5b525dd 100644 --- a/Source/CTest/cmCTestHandlerCommand.cxx +++ b/Source/CTest/cmCTestHandlerCommand.cxx @@ -137,7 +137,7 @@ bool cmCTestHandlerCommand } std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory(); cmSystemTools::ChangeDirectory( - this->CTest->GetCTestConfiguration("BuildDirectory").c_str()); + this->CTest->GetCTestConfiguration("BuildDirectory")); int res = handler->ProcessHandler(); if ( this->Values[ct_RETURN_VALUE] && *this->Values[ct_RETURN_VALUE]) { @@ -146,7 +146,7 @@ bool cmCTestHandlerCommand this->Makefile->AddDefinition( this->Values[ct_RETURN_VALUE], str.str().c_str()); } - cmSystemTools::ChangeDirectory(current_dir.c_str()); + cmSystemTools::ChangeDirectory(current_dir); return true; } diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index 10a5199..b65d23b 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -48,8 +48,8 @@ cmCTestLaunch::~cmCTestLaunch() cmsysProcess_Delete(this->Process); if(!this->Passthru) { - cmSystemTools::RemoveFile(this->LogOut.c_str()); - cmSystemTools::RemoveFile(this->LogErr.c_str()); + cmSystemTools::RemoveFile(this->LogOut); + cmSystemTools::RemoveFile(this->LogErr); } } @@ -434,8 +434,8 @@ void cmCTestLaunch::WriteXMLAction(std::ostream& fxml) // If file is in source tree use its relative location. if(cmSystemTools::FileIsFullPath(this->SourceDir.c_str()) && cmSystemTools::FileIsFullPath(source.c_str()) && - cmSystemTools::IsSubDirectory(source.c_str(), - this->SourceDir.c_str())) + cmSystemTools::IsSubDirectory(source, + this->SourceDir)) { source = cmSystemTools::RelativePath(this->SourceDir.c_str(), source.c_str()); diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 4835010..089e84b 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -1221,10 +1221,10 @@ cmCTestMemCheckHandler::PostProcessBoundsCheckerTest(cmCTestTestResult& res, } } cmSystemTools::Delay(1000); - cmSystemTools::RemoveFile(this->BoundsCheckerDPBDFile.c_str()); + cmSystemTools::RemoveFile(this->BoundsCheckerDPBDFile); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Remove: " << this->BoundsCheckerDPBDFile << std::endl); - cmSystemTools::RemoveFile(this->BoundsCheckerXMLFile.c_str()); + cmSystemTools::RemoveFile(this->BoundsCheckerXMLFile); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Remove: " << this->BoundsCheckerXMLFile << std::endl); } @@ -1255,7 +1255,7 @@ cmCTestMemCheckHandler::AppendMemTesterOutput(cmCTestTestResult& res, } if(this->LogWithPID) { - cmSystemTools::RemoveFile(ofile.c_str()); + cmSystemTools::RemoveFile(ofile); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Remove: "<< ofile <<"\n"); } } diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 7ba434c..4c89caa 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -123,7 +123,7 @@ void cmCTestMultiProcessHandler::StartTestProcess(int test) testRun->SetTestProperties(this->Properties[test]); std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory(); - cmSystemTools::ChangeDirectory(this->Properties[test]->Directory.c_str()); + cmSystemTools::ChangeDirectory(this->Properties[test]->Directory); // Lock the resources we'll be using this->LockResources(test); @@ -156,7 +156,7 @@ void cmCTestMultiProcessHandler::StartTestProcess(int test) this->Failed->push_back(this->Properties[test]->Name); delete testRun; } - cmSystemTools::ChangeDirectory(current_dir.c_str()); + cmSystemTools::ChangeDirectory(current_dir); } //--------------------------------------------------------- @@ -334,7 +334,7 @@ void cmCTestMultiProcessHandler::UpdateCostData() { if(line == "---") break; std::vector<cmsys::String> parts = - cmSystemTools::SplitString(line.c_str(), ' '); + cmSystemTools::SplitString(line, ' '); //Format: <name> <previous_runs> <avg_cost> if(parts.size() < 3) break; @@ -357,7 +357,7 @@ void cmCTestMultiProcessHandler::UpdateCostData() } } fin.close(); - cmSystemTools::RemoveFile(fname.c_str()); + cmSystemTools::RemoveFile(fname); } // Add all tests not previously listed in the file @@ -393,7 +393,7 @@ void cmCTestMultiProcessHandler::ReadCostData() if(line == "---") break; std::vector<cmsys::String> parts = - cmSystemTools::SplitString(line.c_str(), ' '); + cmSystemTools::SplitString(line, ' '); // Probably an older version of the file, will be fixed next run if(parts.size() < 3) @@ -621,7 +621,7 @@ void cmCTestMultiProcessHandler::MarkFinished() { std::string fname = this->CTest->GetBinaryDir() + "/Testing/Temporary/CTestCheckpoint.txt"; - cmSystemTools::RemoveFile(fname.c_str()); + cmSystemTools::RemoveFile(fname); } //--------------------------------------------------------- @@ -639,7 +639,7 @@ void cmCTestMultiProcessHandler::PrintTestList() //push working dir std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory(); - cmSystemTools::ChangeDirectory(p.Directory.c_str()); + cmSystemTools::ChangeDirectory(p.Directory); cmCTestRunTest testRun(this->TestHandler); testRun.SetIndex(p.Index); @@ -676,7 +676,7 @@ void cmCTestMultiProcessHandler::PrintTestList() cmCTestLog(this->CTest, HANDLER_OUTPUT, " "); cmCTestLog(this->CTest, HANDLER_OUTPUT, p.Name.c_str() << std::endl); //pop working dir - cmSystemTools::ChangeDirectory(current_dir.c_str()); + cmSystemTools::ChangeDirectory(current_dir); } cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl << "Total Tests: " @@ -735,7 +735,7 @@ void cmCTestMultiProcessHandler::CheckResume() } else if(cmSystemTools::FileExists(fname.c_str(), true)) { - cmSystemTools::RemoveFile(fname.c_str()); + cmSystemTools::RemoveFile(fname); } } diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index bdd8c02..9e3c9fc 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -280,12 +280,12 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) // Set the working directory to the tests directory std::string oldpath = cmSystemTools::GetCurrentWorkingDirectory(); - cmSystemTools::ChangeDirectory(this->TestProperties->Directory.c_str()); + cmSystemTools::ChangeDirectory(this->TestProperties->Directory); this->DartProcessing(); // restore working directory - cmSystemTools::ChangeDirectory(oldpath.c_str()); + cmSystemTools::ChangeDirectory(oldpath); // if this is doing MemCheck then all the output needs to be put into diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index f050148..749eb58 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -184,7 +184,7 @@ int cmCTestScriptHandler::ProcessHandler() { // for each script run it res += this->RunConfigurationScript - (cmSystemTools::CollapseFullPath(this->ConfigurationScripts[i].c_str()), + (cmSystemTools::CollapseFullPath(this->ConfigurationScripts[i]), this->ScriptProcessScope[i]); } if ( res ) @@ -482,8 +482,8 @@ int cmCTestScriptHandler::ExtractVariables() = this->Makefile->GetSafeDefinition("CTEST_BINARY_DIRECTORY"); // add in translations for src and bin - cmSystemTools::AddKeepPath(this->SourceDir.c_str()); - cmSystemTools::AddKeepPath(this->BinaryDir.c_str()); + cmSystemTools::AddKeepPath(this->SourceDir); + cmSystemTools::AddKeepPath(this->BinaryDir); this->CTestCmd = this->Makefile->GetSafeDefinition("CTEST_COMMAND"); @@ -743,11 +743,11 @@ int cmCTestScriptHandler::BackupDirectories() // if for some reason those directories exist then first delete them if (cmSystemTools::FileExists(this->BackupSourceDir.c_str())) { - cmSystemTools::RemoveADirectory(this->BackupSourceDir.c_str()); + cmSystemTools::RemoveADirectory(this->BackupSourceDir); } if (cmSystemTools::FileExists(this->BackupBinaryDir.c_str())) { - cmSystemTools::RemoveADirectory(this->BackupBinaryDir.c_str()); + cmSystemTools::RemoveADirectory(this->BackupBinaryDir); } // first rename the src and binary directories @@ -991,8 +991,8 @@ int cmCTestScriptHandler::RunConfigurationDashboard() // if all was succesful, delete the backup dirs to free up disk space if (this->Backup) { - cmSystemTools::RemoveADirectory(this->BackupSourceDir.c_str()); - cmSystemTools::RemoveADirectory(this->BackupBinaryDir.c_str()); + cmSystemTools::RemoveADirectory(this->BackupSourceDir); + cmSystemTools::RemoveADirectory(this->BackupBinaryDir); } return 0; @@ -1033,11 +1033,11 @@ void cmCTestScriptHandler::RestoreBackupDirectories() // if for some reason those directories exist then first delete them if (cmSystemTools::FileExists(this->SourceDir.c_str())) { - cmSystemTools::RemoveADirectory(this->SourceDir.c_str()); + cmSystemTools::RemoveADirectory(this->SourceDir); } if (cmSystemTools::FileExists(this->BinaryDir.c_str())) { - cmSystemTools::RemoveADirectory(this->BinaryDir.c_str()); + cmSystemTools::RemoveADirectory(this->BinaryDir); } // rename the src and binary directories rename(this->BackupSourceDir.c_str(), this->SourceDir.c_str()); @@ -1100,7 +1100,7 @@ bool cmCTestScriptHandler::TryToRemoveBinaryDirectoryOnce( const std::string& directoryPath) { cmsys::Directory directory; - directory.Load(directoryPath.c_str()); + directory.Load(directoryPath); for(unsigned long i = 0; i < directory.GetNumberOfFiles(); ++i) { @@ -1113,26 +1113,26 @@ bool cmCTestScriptHandler::TryToRemoveBinaryDirectoryOnce( std::string fullPath = directoryPath + std::string("/") + path; - bool isDirectory = cmSystemTools::FileIsDirectory(fullPath.c_str()) && - !cmSystemTools::FileIsSymlink(fullPath.c_str()); + bool isDirectory = cmSystemTools::FileIsDirectory(fullPath) && + !cmSystemTools::FileIsSymlink(fullPath); if(isDirectory) { - if(!cmSystemTools::RemoveADirectory(fullPath.c_str())) + if(!cmSystemTools::RemoveADirectory(fullPath)) { return false; } } else { - if(!cmSystemTools::RemoveFile(fullPath.c_str())) + if(!cmSystemTools::RemoveFile(fullPath)) { return false; } } } - return cmSystemTools::RemoveADirectory(directoryPath.c_str()); + return cmSystemTools::RemoveADirectory(directoryPath); } //------------------------------------------------------------------------- diff --git a/Source/CTest/cmCTestStartCommand.cxx b/Source/CTest/cmCTestStartCommand.cxx index da46f4a..1a39a8a 100644 --- a/Source/CTest/cmCTestStartCommand.cxx +++ b/Source/CTest/cmCTestStartCommand.cxx @@ -124,7 +124,7 @@ bool cmCTestStartCommand { return false; } - if(!cmSystemTools::FileIsDirectory(sourceDir.c_str())) + if(!cmSystemTools::FileIsDirectory(sourceDir)) { cmOStringStream e; e << "given source path\n" diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 06fcb75..5f065c2 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -236,7 +236,7 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix, } unsigned long filelen = cmSystemTools::FileLength(local_file.c_str()); - ftpfile = cmsys::SystemTools::Fopen(local_file.c_str(), "rb"); + ftpfile = cmsys::SystemTools::Fopen(local_file, "rb"); *this->LogFile << "\tUpload file: " << local_file << " to " << upload_as << std::endl; cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Upload file: " @@ -477,7 +477,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, } unsigned long filelen = cmSystemTools::FileLength(local_file.c_str()); - ftpfile = cmsys::SystemTools::Fopen(local_file.c_str(), "rb"); + ftpfile = cmsys::SystemTools::Fopen(local_file, "rb"); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Upload file: " << local_file << " to " << upload_as << " Size: " << filelen << std::endl); @@ -567,7 +567,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, << count << std::endl); ::fclose(ftpfile); - ftpfile = cmsys::SystemTools::Fopen(local_file.c_str(), "rb"); + ftpfile = cmsys::SystemTools::Fopen(local_file, "rb"); ::curl_easy_setopt(curl, CURLOPT_INFILE, ftpfile); chunk.clear(); @@ -931,13 +931,13 @@ bool cmCTestSubmitHandler::SubmitUsingCP( cmSystemTools::ConvertToUnixSlashes(lfname); lfname += "/" + *file; std::string rfname = destination + "/" + remoteprefix + *file; - cmSystemTools::CopyFileAlways(lfname.c_str(), rfname.c_str()); + cmSystemTools::CopyFileAlways(lfname, rfname); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Copy file: " << lfname << " to " << rfname << std::endl); } std::string tagDoneFile = destination + "/" + remoteprefix + "DONE"; - cmSystemTools::Touch(tagDoneFile.c_str(), true); + cmSystemTools::Touch(tagDoneFile, true); if ( problems ) { return false; @@ -1418,20 +1418,20 @@ int cmCTestSubmitHandler::ProcessHandler() // change to the build directory so that we can uses a relative path // on windows since scp dosn't support "c:" a drive in the path oldWorkingDirectory = cmSystemTools::GetCurrentWorkingDirectory(); - cmSystemTools::ChangeDirectory(buildDirectory.c_str()); + cmSystemTools::ChangeDirectory(buildDirectory); if ( !this->SubmitUsingSCP( this->CTest->GetCTestConfiguration("ScpCommand"), "Testing/"+this->CTest->GetCurrentTag(), files, prefix, url) ) { - cmSystemTools::ChangeDirectory(oldWorkingDirectory.c_str()); + cmSystemTools::ChangeDirectory(oldWorkingDirectory); cmCTestLog(this->CTest, ERROR_MESSAGE, " Problems when submitting via SCP" << std::endl); ofs << " Problems when submitting via SCP" << std::endl; return -1; } - cmSystemTools::ChangeDirectory(oldWorkingDirectory.c_str()); + cmSystemTools::ChangeDirectory(oldWorkingDirectory); cmCTestLog(this->CTest, HANDLER_OUTPUT, " Submission successful" << std::endl); ofs << " Submission successful" << std::endl; @@ -1447,7 +1447,7 @@ int cmCTestSubmitHandler::ProcessHandler() // on windows since scp dosn't support "c:" a drive in the path std::string oldWorkingDirectory = cmSystemTools::GetCurrentWorkingDirectory(); - cmSystemTools::ChangeDirectory(buildDirectory.c_str()); + cmSystemTools::ChangeDirectory(buildDirectory); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Change directory: " << buildDirectory << std::endl); @@ -1457,14 +1457,14 @@ int cmCTestSubmitHandler::ProcessHandler() prefix, location) ) { - cmSystemTools::ChangeDirectory(oldWorkingDirectory.c_str()); + cmSystemTools::ChangeDirectory(oldWorkingDirectory); cmCTestLog(this->CTest, ERROR_MESSAGE, " Problems when submitting via CP" << std::endl); ofs << " Problems when submitting via cp" << std::endl; return -1; } - cmSystemTools::ChangeDirectory(oldWorkingDirectory.c_str()); + cmSystemTools::ChangeDirectory(oldWorkingDirectory); cmCTestLog(this->CTest, HANDLER_OUTPUT, " Submission successful" << std::endl); ofs << " Submission successful" << std::endl; diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index f21d166..435fb32 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -93,12 +93,12 @@ bool cmCTestSubdirCommand fname += *it; } - if ( !cmSystemTools::FileIsDirectory(fname.c_str()) ) + if ( !cmSystemTools::FileIsDirectory(fname) ) { // No subdirectory? So what... continue; } - cmSystemTools::ChangeDirectory(fname.c_str()); + cmSystemTools::ChangeDirectory(fname); const char* testFilename; if( cmSystemTools::FileExists("CTestTestfile.cmake") ) { @@ -120,7 +120,7 @@ bool cmCTestSubdirCommand bool readit = this->Makefile->ReadListFile(this->Makefile->GetCurrentListFile(), fname.c_str()); - cmSystemTools::ChangeDirectory(cwd.c_str()); + cmSystemTools::ChangeDirectory(cwd); if(!readit) { std::string m = "Could not find include file: "; @@ -129,7 +129,7 @@ bool cmCTestSubdirCommand return false; } } - cmSystemTools::ChangeDirectory(cwd.c_str()); + cmSystemTools::ChangeDirectory(cwd); return true; } @@ -175,7 +175,7 @@ bool cmCTestAddSubdirectoryCommand } std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); - cmSystemTools::ChangeDirectory(cwd.c_str()); + cmSystemTools::ChangeDirectory(cwd); std::string fname = cwd; fname += "/"; fname += args[1]; @@ -185,7 +185,7 @@ bool cmCTestAddSubdirectoryCommand // No subdirectory? So what... return true; } - cmSystemTools::ChangeDirectory(fname.c_str()); + cmSystemTools::ChangeDirectory(fname); const char* testFilename; if( cmSystemTools::FileExists("CTestTestfile.cmake") ) { @@ -200,7 +200,7 @@ bool cmCTestAddSubdirectoryCommand else { // No CTestTestfile? Who cares... - cmSystemTools::ChangeDirectory(cwd.c_str()); + cmSystemTools::ChangeDirectory(cwd); return true; } fname += "/"; @@ -208,7 +208,7 @@ bool cmCTestAddSubdirectoryCommand bool readit = this->Makefile->ReadListFile(this->Makefile->GetCurrentListFile(), fname.c_str()); - cmSystemTools::ChangeDirectory(cwd.c_str()); + cmSystemTools::ChangeDirectory(cwd); if(!readit) { std::string m = "Could not find include file: "; @@ -1498,9 +1498,9 @@ std::string cmCTestTestHandler { // first check without exe extension if(cmSystemTools::FileExists(attempted[ai].c_str()) - && !cmSystemTools::FileIsDirectory(attempted[ai].c_str())) + && !cmSystemTools::FileIsDirectory(attempted[ai])) { - fullPath = cmSystemTools::CollapseFullPath(attempted[ai].c_str()); + fullPath = cmSystemTools::CollapseFullPath(attempted[ai]); resultingConfig = attemptedConfigs[ai]; } // then try with the exe extension @@ -1510,9 +1510,9 @@ std::string cmCTestTestHandler tempPath = attempted[ai]; tempPath += cmSystemTools::GetExecutableExtension(); if(cmSystemTools::FileExists(tempPath.c_str()) - && !cmSystemTools::FileIsDirectory(tempPath.c_str())) + && !cmSystemTools::FileIsDirectory(tempPath)) { - fullPath = cmSystemTools::CollapseFullPath(tempPath.c_str()); + fullPath = cmSystemTools::CollapseFullPath(tempPath); resultingConfig = attemptedConfigs[ai]; } else @@ -1746,7 +1746,7 @@ void cmCTestTestHandler::ExpandTestsToRunInformationForRerunFailed() std::string dirName = this->CTest->GetBinaryDir() + "/Testing/Temporary"; cmsys::Directory directory; - if (directory.Load(dirName.c_str()) == 0) + if (directory.Load(dirName) == 0) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Unable to read the contents of " << dirName << std::endl); @@ -1754,7 +1754,7 @@ void cmCTestTestHandler::ExpandTestsToRunInformationForRerunFailed() } int numFiles = static_cast<int> - (cmsys::Directory::GetNumberOfFilesInDirectory(dirName.c_str())); + (cmsys::Directory::GetNumberOfFilesInDirectory(dirName)); std::string pattern = "LastTestsFailed"; std::string logName = ""; @@ -1777,7 +1777,7 @@ void cmCTestTestHandler::ExpandTestsToRunInformationForRerunFailed() // if multiple matching logs were found we use the most recently // modified one. int res; - cmSystemTools::FileTimeCompare(logName.c_str(), fileName.c_str(), &res); + cmSystemTools::FileTimeCompare(logName, fileName, &res); if (res == -1) { logName = fileName; diff --git a/Source/CTest/cmParseBlanketJSCoverage.cxx b/Source/CTest/cmParseBlanketJSCoverage.cxx new file mode 100644 index 0000000..5f4a708 --- /dev/null +++ b/Source/CTest/cmParseBlanketJSCoverage.cxx @@ -0,0 +1,166 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc. + + 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 "cmStandardIncludes.h" +#include <stdio.h> +#include <stdlib.h> +#include "cmSystemTools.h" +#include "cmParseBlanketJSCoverage.h" +#include <cmsys/Directory.hxx> +#include <cmsys/Glob.hxx> +#include <cmsys/FStream.hxx> + + +class cmParseBlanketJSCoverage::JSONParser + { +public: + typedef cmCTestCoverageHandlerContainer:: + SingleFileCoverageVector FileLinesType; + JSONParser(cmCTestCoverageHandlerContainer& cont) + : Coverage(cont) + { + } + + virtual ~JSONParser() + { + } + + std::string getValue(std::string line, int type) + { + size_t begIndex; + size_t endIndex; + endIndex = line.rfind(','); + begIndex = line.find_first_of(':'); + if(type == 0) + { + // A unique substring to remove the extra characters + // around the files name in the JSON (extra " and ,) + std::string foundFileName = + line.substr(begIndex+3,endIndex-(begIndex+4)); + return foundFileName; + } + else + { + return line.substr(begIndex,line.npos); + } + } + bool ParseFile(std::string file) + { + FileLinesType localCoverageVector; + std::string filename; + bool foundFile = false; + bool inSource = false; + std::string covResult; + std::string line; + + cmsys::ifstream in(file.c_str()); + if(!in) + { + return false; + } + while( cmSystemTools::GetLineFromStream(in, line)) + { + if(line.find("filename") != line.npos) + { + if(foundFile) + { + /* + * Upon finding a second file name, generate a + * vector within the total coverage to capture the + * information in the local vector + */ + FileLinesType& CoverageVector = + this->Coverage.TotalCoverage[filename.c_str()]; + CoverageVector = localCoverageVector; + localCoverageVector.clear(); + foundFile=false; + } + foundFile= true; + inSource = false; + filename = getValue(line,0).c_str(); + } + else if((line.find("coverage") != line.npos) && foundFile && inSource ) + { + /* + * two types of "coverage" in the JSON structure + * + * The coverage result over the file or set of files + * and the coverage for each individual line + * + * FoundFile and foundSource ensure that + * only the value of the line coverage is captured + */ + std::string result = getValue(line,1).c_str(); + result = result.substr(2,result.npos); + if(result == "\"\"") + { + // Empty quotation marks indicate that the + // line is not executable + localCoverageVector.push_back(-1); + } + else + { + // Else, it contains the number of time executed + localCoverageVector.push_back(atoi(result.c_str())); + } + } + else if(line.find("source") != line.npos) + { + inSource=true; + } + } + + // On exit, capture end of last file covered. + FileLinesType& CoverageVector = + this->Coverage.TotalCoverage[filename.c_str()]; + CoverageVector = localCoverageVector; + foundFile=false; + localCoverageVector.clear(); + return true; + } +private: + cmCTestCoverageHandlerContainer& Coverage; +}; + +cmParseBlanketJSCoverage::cmParseBlanketJSCoverage( + cmCTestCoverageHandlerContainer& cont, cmCTest* ctest) + :Coverage(cont), CTest(ctest) + { + } + +bool cmParseBlanketJSCoverage::LoadCoverageData(std::vector<std::string> files) + { + size_t i=0; + std::string path; + cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT, + "Found " << files.size() <<" Files" << std::endl); + for(i=0;i<files.size();i++) + { + cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT, + "Reading JSON File " << files[i] << std::endl); + + if(!this->ReadJSONFile(files[i])) + { + return false; + } + } + return true; + } + +bool cmParseBlanketJSCoverage::ReadJSONFile(std::string file) + { + cmParseBlanketJSCoverage::JSONParser parser + (this->Coverage); + cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT, + "Parsing " << file << std::endl); + parser.ParseFile(file); + return true; + } diff --git a/Source/CTest/cmParseBlanketJSCoverage.h b/Source/CTest/cmParseBlanketJSCoverage.h new file mode 100644 index 0000000..fc1d477 --- /dev/null +++ b/Source/CTest/cmParseBlanketJSCoverage.h @@ -0,0 +1,48 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc. + + 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 cmParseBlanketJSCoverage_h +#define cmParseBlanketJSCoverage_h + +#include "cmStandardIncludes.h" +#include "cmCTestCoverageHandler.h" + + +/** \class cmParseBlanketJSCoverage + * \brief Parse BlanketJS coverage information + * + * This class is used to parse BlanketJS(Pascal) coverage information + * generated by the Blanket.js library when used in conjunction with the + * test runner mocha.js, which is used to write out the JSON format. + * + * Blanket.js: + * http://blanketjs.org/ + * + * Mocha.js + * http://visionmedia.github.io/mocha/ + */ +class cmParseBlanketJSCoverage +{ +public: + cmParseBlanketJSCoverage(cmCTestCoverageHandlerContainer& cont, + cmCTest* ctest); + bool LoadCoverageData(std::vector<std::string> files); + // Read the JSON output + bool ReadJSONFile(std::string file); + +protected: + + class JSONParser; + cmCTestCoverageHandlerContainer& Coverage; + cmCTest* CTest; +}; +#endif diff --git a/Source/CTest/cmParseCacheCoverage.cxx b/Source/CTest/cmParseCacheCoverage.cxx index d17f169..97454a8 100644 --- a/Source/CTest/cmParseCacheCoverage.cxx +++ b/Source/CTest/cmParseCacheCoverage.cxx @@ -31,7 +31,7 @@ bool cmParseCacheCoverage::LoadCoverageData(const char* d) { std::string file = dir.GetFile(i); if(file != "." && file != ".." - && !cmSystemTools::FileIsDirectory(file.c_str())) + && !cmSystemTools::FileIsDirectory(file)) { std::string path = d; path += "/"; diff --git a/Source/CTest/cmParseDelphiCoverage.cxx b/Source/CTest/cmParseDelphiCoverage.cxx new file mode 100644 index 0000000..ad71c85 --- /dev/null +++ b/Source/CTest/cmParseDelphiCoverage.cxx @@ -0,0 +1,253 @@ +#include "cmStandardIncludes.h" +#include <stdio.h> +#include <stdlib.h> +#include "cmSystemTools.h" +#include "cmXMLParser.h" +#include "cmParseDelphiCoverage.h" +#include <cmsys/Directory.hxx> +#include <cmsys/Glob.hxx> +#include <cmsys/FStream.hxx> + + +class cmParseDelphiCoverage::HTMLParser +{ +public: + typedef cmCTestCoverageHandlerContainer::SingleFileCoverageVector + FileLinesType; + HTMLParser(cmCTest* ctest, cmCTestCoverageHandlerContainer& cont) + : CTest(ctest), Coverage(cont) + { + } + + virtual ~HTMLParser() + { + } + + bool initializeDelphiFile(const std::string filename, + cmParseDelphiCoverage::HTMLParser::FileLinesType &coverageVector) + { + std::string line; + size_t comPos; + size_t semiPos; + bool blockComFlag= false; + bool lineComFlag= false; + std::vector<std::string> beginSet; + cmsys::ifstream in(filename.c_str()); + if(!in) + { + return false; + } + while(cmSystemTools::GetLineFromStream(in, line)) + { + lineComFlag=false; + // Unique cases found in lines. + size_t beginPos = line.find("begin"); + + //Check that the begin is the first non-space string on the line + if( (beginPos == line.find_first_not_of(' ')) && beginPos != line.npos ) + { + beginSet.push_back("begin"); + coverageVector.push_back(-1); + continue; + } + else if(line.find('{') != line.npos) + { + blockComFlag=true; + } + else if(line.find('}') != line.npos) + { + blockComFlag=false; + coverageVector.push_back(-1); + continue; + } + else if((line.find("end;") != line.npos) + && (beginSet.size() > 0)) + { + beginSet.pop_back(); + coverageVector.push_back(-1); + continue; + } + + // This checks for comments after lines of code, finding the + // comment symbol after the ending semicolon. + comPos = line.find("//"); + if(comPos != line.npos) + { + semiPos= line.find(';'); + if(comPos < semiPos) + { + lineComFlag=true; + } + } + //Based up what was found, add a line to the coverageVector + if((beginSet.size() > 0) && line != "" && !blockComFlag + && !lineComFlag) + { + coverageVector.push_back(0); + } + else + { + coverageVector.push_back(-1); + } + } + return true; + } + bool ParseFile(const char* file) + { + std::string line=file; + std::string lineresult; + std::string lastroutine; + std::string filename; + std::string filelineoffset; + size_t afterLineNum = 0; + size_t lastoffset = 0; + size_t endcovpos = 0; + size_t endnamepos = 0; + size_t pos = 0; + + /* + * This first 'while' section goes through the found HTML + * file name and attempts to capture the source file name + * which is set as part of the HTML file name: the name of + * the file is found in parenthesis '()' + * + * See test HTML file name: UTCovTest(UTCovTest.pas).html. + * + * Find the text inside each pair of parenthesis and check + * to see if it ends in '.pas'. If it can't be found, + * exit the function. + */ + while(true) + { + lastoffset = line.find('(',pos); + if(lastoffset==line.npos) + { + cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT, + endnamepos << "File not found " << lastoffset << std::endl); + return false; + } + endnamepos = line.find(')',lastoffset); + filename = line.substr(lastoffset+1, + (endnamepos-1)-lastoffset); + if(filename.find(".pas") != filename.npos) + { + cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT, + "Coverage found for file: " << filename << std::endl); + break; + } + pos = lastoffset+1; + endnamepos = 0; + lastoffset =0; + } + /* + * Glob through the source directory for the + * file found above + */ + cmsys::Glob gl; + gl.RecurseOn(); + gl.RecurseThroughSymlinksOff(); + std::string glob = Coverage.SourceDir + "*/" + filename; + gl.FindFiles(glob); + std::vector<std::string> const& files = gl.GetFiles(); + if(files.size() == 0) + { + /* + * If that doesn't find any matching files + * return a failure. + */ + cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT, + "Unable to find file matching" << glob << std::endl); + return false; + } + FileLinesType& coverageVector = + this->Coverage.TotalCoverage[files[0]]; + + /* + * Initialize the file to have all code between 'begin' and + * 'end' tags marked as executable + */ + + this->initializeDelphiFile(files[0],coverageVector); + + cmsys::ifstream in(file); + if(!in) + { + return false; + } + + /* + * Now read the HTML file, looking for the lines that have an + * "inline" in it. Then parse out the "class" value of that + * line to determine if the line is executed or not. + * + * Sample HTML line: + * + * <tr class="covered"><td>47</td><td><pre style="display:inline;"> + * CheckEquals(1,2-1);</pre></td></tr> + * + */ + + while( cmSystemTools::GetLineFromStream(in, line)) + { + if(line.find("inline") == line.npos) + { + continue; + } + + lastoffset = line.find("class="); + endcovpos = line.find(">",lastoffset); + lineresult = line.substr(lastoffset+7,(endcovpos-8)-lastoffset); + + if(lineresult == "covered") + { + afterLineNum = line.find('<',endcovpos+5); + filelineoffset= line.substr(endcovpos+5, + afterLineNum-(endcovpos+5)); + coverageVector[atoi(filelineoffset.c_str())-1] = 1; + } + } + return true; + } + + + private: + cmCTest* CTest; + cmCTestCoverageHandlerContainer& Coverage; +}; + +cmParseDelphiCoverage::cmParseDelphiCoverage( + cmCTestCoverageHandlerContainer& cont, cmCTest* ctest) + :Coverage(cont), CTest(ctest) + { + } + +bool cmParseDelphiCoverage::LoadCoverageData( + const std::vector<std::string> files) + { + size_t i; + std::string path; + size_t numf = files.size(); + for (i = 0; i < numf; i++) + { + path = files[i]; + + cmCTestLog(this->CTest,HANDLER_VERBOSE_OUTPUT, + "Reading HTML File " << path << std::endl); + if(cmSystemTools::GetFilenameLastExtension(path) == ".html") + { + if(!this->ReadDelphiHTML(path.c_str())) + { + return false; + } + } + } + return true; + }; + +bool cmParseDelphiCoverage::ReadDelphiHTML(const char* file) + { + cmParseDelphiCoverage::HTMLParser + parser(this->CTest, this->Coverage); + parser.ParseFile(file); + return true; + }; diff --git a/Source/CTest/cmParseDelphiCoverage.h b/Source/CTest/cmParseDelphiCoverage.h new file mode 100644 index 0000000..018340b --- /dev/null +++ b/Source/CTest/cmParseDelphiCoverage.h @@ -0,0 +1,46 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc. + + 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 cmParseDelphiCoverage_h +#define cmParseDelphiCoverage_h + +#include "cmStandardIncludes.h" +#include "cmCTestCoverageHandler.h" + + +/** \class cmParseDelphiCoverage + * \brief Parse Delphi coverage information + * + * This class is used to parse Delphi(Pascal) coverage information + * generated by the Delphi-Code-Coverage tool + * + * https://code.google.com/p/delphi-code-coverage/ + */ + +class cmParseDelphiCoverage + { + public: + cmParseDelphiCoverage(cmCTestCoverageHandlerContainer& cont, + cmCTest* ctest); + bool LoadCoverageData(const std::vector<std::string> files); + bool ReadDelphiHTML(const char* file); + // Read a single HTML file from output + bool ReadHTMLFile(const char* f); + + + protected: + + class HTMLParser; + cmCTestCoverageHandlerContainer& Coverage; + cmCTest* CTest; + }; +#endif diff --git a/Source/CTest/cmParseGTMCoverage.cxx b/Source/CTest/cmParseGTMCoverage.cxx index be10c2e..d77244a 100644 --- a/Source/CTest/cmParseGTMCoverage.cxx +++ b/Source/CTest/cmParseGTMCoverage.cxx @@ -30,7 +30,7 @@ bool cmParseGTMCoverage::LoadCoverageData(const char* d) { std::string file = dir.GetFile(i); if(file != "." && file != ".." - && !cmSystemTools::FileIsDirectory(file.c_str())) + && !cmSystemTools::FileIsDirectory(file)) { std::string path = d; path += "/"; diff --git a/Source/CTest/cmParsePHPCoverage.cxx b/Source/CTest/cmParsePHPCoverage.cxx index 3b7f968..c7f5a68 100644 --- a/Source/CTest/cmParsePHPCoverage.cxx +++ b/Source/CTest/cmParsePHPCoverage.cxx @@ -239,7 +239,7 @@ bool cmParsePHPCoverage::ReadPHPCoverageDirectory(const char* d) { std::string file = dir.GetFile(i); if(file != "." && file != ".." - && !cmSystemTools::FileIsDirectory(file.c_str())) + && !cmSystemTools::FileIsDirectory(file)) { std::string path = d; path += "/"; diff --git a/Source/CursesDialog/cmCursesPathWidget.cxx b/Source/CursesDialog/cmCursesPathWidget.cxx index cd93bc3..89e2238 100644 --- a/Source/CursesDialog/cmCursesPathWidget.cxx +++ b/Source/CursesDialog/cmCursesPathWidget.cxx @@ -69,7 +69,7 @@ void cmCursesPathWidget::OnTab(cmCursesMainForm* fm, WINDOW* w) cstr = cstr.substr(0, cstr.size()-1); } - if ( cmSystemTools::FileIsDirectory(cstr.c_str()) ) + if ( cmSystemTools::FileIsDirectory(cstr) ) { cstr += "/"; } diff --git a/Source/QtDialog/CMake.desktop b/Source/QtDialog/CMake.desktop index 7be495f..842091f 100644 --- a/Source/QtDialog/CMake.desktop +++ b/Source/QtDialog/CMake.desktop @@ -3,7 +3,7 @@ Version=1.0 Name=CMake Comment=Cross-platform buildsystem Exec=cmake-gui %f -Icon=CMakeSetup32 +Icon=CMakeSetup Terminal=false X-MultipleArgs=false Type=Application diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 03c2fb4..b59af94 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -171,11 +171,17 @@ set(CMAKE_INSTALL_DESTINATION_ARGS install(TARGETS cmake-gui RUNTIME DESTINATION bin ${CMAKE_INSTALL_DESTINATION_ARGS}) -if(UNIX) +if(UNIX AND NOT APPLE) + foreach (size IN ITEMS 32 128) + install( + FILES "${CMAKE_CURRENT_SOURCE_DIR}/CMakeSetup${size}.png" + DESTINATION "share/icons/hicolor/${size}x${size}/apps" + RENAME "CMakeSetup.png") + endforeach () + # install a desktop file so CMake appears in the application start menu # with an icon install(FILES CMake.desktop DESTINATION share/applications ) - install(FILES CMakeSetup32.png DESTINATION share/pixmaps ) install(FILES cmakecache.xml DESTINATION share/mime/packages ) endif() diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx index 6a95550..2d19610 100644 --- a/Source/cmAddCustomCommandCommand.cxx +++ b/Source/cmAddCustomCommandCommand.cxx @@ -300,7 +300,7 @@ bool cmAddCustomCommandCommand if(!working.empty()) { const char* build_dir = this->Makefile->GetCurrentOutputDirectory(); - working = cmSystemTools::CollapseFullPath(working.c_str(), build_dir); + working = cmSystemTools::CollapseFullPath(working, build_dir); } // Choose which mode of the command to use. diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx index 2fb0eb3..3235502 100644 --- a/Source/cmAddCustomTargetCommand.cxx +++ b/Source/cmAddCustomTargetCommand.cxx @@ -218,7 +218,7 @@ bool cmAddCustomTargetCommand { const char* build_dir = this->Makefile->GetCurrentOutputDirectory(); working_directory = - cmSystemTools::CollapseFullPath(working_directory.c_str(), build_dir); + cmSystemTools::CollapseFullPath(working_directory, build_dir); } // Add the utility target to the makefile. diff --git a/Source/cmAddSubDirectoryCommand.cxx b/Source/cmAddSubDirectoryCommand.cxx index 4ea2524..477a3d9 100644 --- a/Source/cmAddSubDirectoryCommand.cxx +++ b/Source/cmAddSubDirectoryCommand.cxx @@ -61,7 +61,7 @@ bool cmAddSubDirectoryCommand::InitialPass srcPath += "/"; srcPath += srcArg; } - if(!cmSystemTools::FileIsDirectory(srcPath.c_str())) + if(!cmSystemTools::FileIsDirectory(srcPath)) { std::string error = "given source \""; error += srcArg; @@ -69,7 +69,7 @@ bool cmAddSubDirectoryCommand::InitialPass this->SetError(error); return false; } - srcPath = cmSystemTools::CollapseFullPath(srcPath.c_str()); + srcPath = cmSystemTools::CollapseFullPath(srcPath); // Compute the full path to the binary directory. std::string binPath; @@ -78,7 +78,7 @@ bool cmAddSubDirectoryCommand::InitialPass // No binary directory was specified. If the source directory is // not a subdirectory of the current directory then it is an // error. - if(!cmSystemTools::IsSubDirectory(srcPath.c_str(), + if(!cmSystemTools::IsSubDirectory(srcPath, this->Makefile->GetCurrentDirectory())) { cmOStringStream e; @@ -118,7 +118,7 @@ bool cmAddSubDirectoryCommand::InitialPass binPath += binArg; } } - binPath = cmSystemTools::CollapseFullPath(binPath.c_str()); + binPath = cmSystemTools::CollapseFullPath(binPath); // Add the subdirectory using the computed full paths. this->Makefile->AddSubDirectory(srcPath, binPath, diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index a7905a4..f88f72c 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -208,7 +208,7 @@ int cmCTest::HTTPRequest(std::string url, HTTPMethod method, return -1; } ::curl_easy_setopt(curl, CURLOPT_PUT, 1); - file = cmsys::SystemTools::Fopen(putFile.c_str(), "rb"); + file = cmsys::SystemTools::Fopen(putFile, "rb"); ::curl_easy_setopt(curl, CURLOPT_INFILE, file); //fall through to append GET fields case cmCTest::HTTP_GET: @@ -524,7 +524,7 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) std::string testingDir = this->BinaryDir + "/Testing"; if ( cmSystemTools::FileExists(testingDir.c_str()) ) { - if ( !cmSystemTools::FileIsDirectory(testingDir.c_str()) ) + if ( !cmSystemTools::FileIsDirectory(testingDir) ) { cmCTestLog(this, ERROR_MESSAGE, "File " << testingDir << " is in the place of the testing directory" << std::endl); @@ -809,7 +809,7 @@ bool cmCTest::UpdateCTestConfiguration() if ( !this->GetCTestConfiguration("BuildDirectory").empty() ) { this->BinaryDir = this->GetCTestConfiguration("BuildDirectory"); - cmSystemTools::ChangeDirectory(this->BinaryDir.c_str()); + cmSystemTools::ChangeDirectory(this->BinaryDir); } this->TimeOut = atoi(this->GetCTestConfiguration("TimeOut").c_str()); if ( this->ProduceXML ) @@ -884,7 +884,7 @@ bool cmCTest::OpenOutputFile(const std::string& path, } if ( cmSystemTools::FileExists(testingDir.c_str()) ) { - if ( !cmSystemTools::FileIsDirectory(testingDir.c_str()) ) + if ( !cmSystemTools::FileIsDirectory(testingDir) ) { cmCTestLog(this, ERROR_MESSAGE, "File " << testingDir << " is in the place of the testing directory" @@ -1061,17 +1061,17 @@ int cmCTest::ProcessTests() if ( !notest ) { std::string notes_dir = this->BinaryDir + "/Testing/Notes"; - if ( cmSystemTools::FileIsDirectory(notes_dir.c_str()) ) + if ( cmSystemTools::FileIsDirectory(notes_dir) ) { cmsys::Directory d; - d.Load(notes_dir.c_str()); + d.Load(notes_dir); unsigned long kk; for ( kk = 0; kk < d.GetNumberOfFiles(); kk ++ ) { const char* file = d.GetFile(kk); std::string fullname = notes_dir + "/" + file; if ( cmSystemTools::FileExists(fullname.c_str()) && - !cmSystemTools::FileIsDirectory(fullname.c_str()) ) + !cmSystemTools::FileIsDirectory(fullname) ) { if ( this->NotesFiles.size() > 0 ) { @@ -1294,7 +1294,7 @@ int cmCTest::RunTest(std::vector<const char*> argv, cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, "Test timeout computed to be: " << timeout << "\n"); if(cmSystemTools::SameFile( - argv[0], cmSystemTools::GetCTestCommand().c_str()) && + argv[0], cmSystemTools::GetCTestCommand()) && !this->ForceNewCTestProcess) { cmCTest inst; @@ -1342,7 +1342,7 @@ int cmCTest::RunTest(std::vector<const char*> argv, { *log << *output; } - cmSystemTools::ChangeDirectory(oldpath.c_str()); + cmSystemTools::ChangeDirectory(oldpath); cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, "Internal cmCTest object used to run test." << std::endl @@ -1681,7 +1681,7 @@ std::string cmCTest::Base64GzipEncodeFile(std::string file) return ""; } std::string base64 = this->Base64EncodeFile(tarFile); - cmSystemTools::RemoveFile(tarFile.c_str()); + cmSystemTools::RemoveFile(tarFile); return base64; } @@ -2628,10 +2628,10 @@ std::string cmCTest::GetShortPathToFile(const char* cfname) { const std::string& sourceDir = cmSystemTools::CollapseFullPath( - this->GetCTestConfiguration("SourceDirectory").c_str()); + this->GetCTestConfiguration("SourceDirectory")); const std::string& buildDir = cmSystemTools::CollapseFullPath( - this->GetCTestConfiguration("BuildDirectory").c_str()); + this->GetCTestConfiguration("BuildDirectory")); std::string fname = cmSystemTools::CollapseFullPath(cfname); // Find relative paths to both directories diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index d6b84a0..6a47ea7 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -139,7 +139,7 @@ bool cmCacheManager::ParseEntry(const std::string& entry, { // input line is: key:type=value static cmsys::RegularExpression reg( - "^([^:]*):([^=]*)=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$"); + "^([^=:]*):([^=]*)=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$"); // input line is: "key":type=value static cmsys::RegularExpression regQuoted( "^\"([^\"]*)\":([^=]*)=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$"); @@ -189,7 +189,7 @@ void cmCacheManager::CleanCMakeFiles(const std::string& path) for(std::vector<std::string>::iterator i = files.begin(); i != files.end(); ++i) { - cmSystemTools::RemoveFile(i->c_str()); + cmSystemTools::RemoveFile(*i); } } @@ -336,7 +336,7 @@ bool cmCacheManager::LoadCache(const std::string& path, cmSystemTools::ConvertToUnixSlashes(currentcwd); currentcwd += "/CMakeCache.txt"; oldcwd += "/CMakeCache.txt"; - if(!cmSystemTools::SameFile(oldcwd.c_str(), currentcwd.c_str())) + if(!cmSystemTools::SameFile(oldcwd, currentcwd)) { std::string message = std::string("The current CMakeCache.txt directory ") + @@ -586,13 +586,13 @@ bool cmCacheManager::DeleteCache(const std::string& path) cacheFile += "/CMakeCache.txt"; if(cmSystemTools::FileExists(cacheFile.c_str())) { - cmSystemTools::RemoveFile(cacheFile.c_str()); + cmSystemTools::RemoveFile(cacheFile); // now remove the files in the CMakeFiles directory // this cleans up language cache files cmakeFiles += cmake::GetCMakeFilesDirectory(); - if(cmSystemTools::FileIsDirectory(cmakeFiles.c_str())) + if(cmSystemTools::FileIsDirectory(cmakeFiles)) { - cmSystemTools::RemoveADirectory(cmakeFiles.c_str()); + cmSystemTools::RemoveADirectory(cmakeFiles); } } return true; diff --git a/Source/cmCommandArgumentParser.cxx b/Source/cmCommandArgumentParser.cxx index c5146c5..9f8a4de 100644 --- a/Source/cmCommandArgumentParser.cxx +++ b/Source/cmCommandArgumentParser.cxx @@ -183,12 +183,6 @@ static void cmCommandArgumentError(yyscan_t yyscanner, const char* message); #define YYINITDEPTH 10000 /* Disable some warnings in the generated code. */ -#ifdef __BORLANDC__ -# pragma warn -8004 /* Variable assigned a value that is not used. */ -# pragma warn -8008 /* condition always returns true */ -# pragma warn -8060 /* possibly incorrect assignment */ -# pragma warn -8066 /* unreachable code */ -#endif #ifdef _MSC_VER # pragma warning (disable: 4102) /* Unused goto label. */ # pragma warning (disable: 4065) /* Switch statement contains default but no diff --git a/Source/cmCommandArgumentParser.y b/Source/cmCommandArgumentParser.y index 48f5c8e..b1d53f6 100644 --- a/Source/cmCommandArgumentParser.y +++ b/Source/cmCommandArgumentParser.y @@ -64,12 +64,6 @@ static void cmCommandArgumentError(yyscan_t yyscanner, const char* message); #define YYINITDEPTH 10000 /* Disable some warnings in the generated code. */ -#ifdef __BORLANDC__ -# pragma warn -8004 /* Variable assigned a value that is not used. */ -# pragma warn -8008 /* condition always returns true */ -# pragma warn -8060 /* possibly incorrect assignment */ -# pragma warn -8066 /* unreachable code */ -#endif #ifdef _MSC_VER # pragma warning (disable: 4102) /* Unused goto label. */ # pragma warning (disable: 4065) /* Switch statement contains default but no diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index e1852a3..f4fa5c6 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -675,7 +675,7 @@ void cmComputeLinkInformation::AddItem(std::string const& item, // This is not a CMake target. Use the name given. if(cmSystemTools::FileIsFullPath(item.c_str())) { - if(cmSystemTools::FileIsDirectory(item.c_str())) + if(cmSystemTools::FileIsDirectory(item)) { // This is a directory. this->AddDirectoryItem(item); @@ -1937,10 +1937,10 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs, // Do not add any path inside the source or build tree. const char* topSourceDir = this->Makefile->GetHomeDirectory(); const char* topBinaryDir = this->Makefile->GetHomeOutputDirectory(); - if(!cmSystemTools::ComparePath(ri->c_str(), topSourceDir) && - !cmSystemTools::ComparePath(ri->c_str(), topBinaryDir) && - !cmSystemTools::IsSubDirectory(ri->c_str(), topSourceDir) && - !cmSystemTools::IsSubDirectory(ri->c_str(), topBinaryDir)) + if(!cmSystemTools::ComparePath(*ri, topSourceDir) && + !cmSystemTools::ComparePath(*ri, topBinaryDir) && + !cmSystemTools::IsSubDirectory(*ri, topSourceDir) && + !cmSystemTools::IsSubDirectory(*ri, topBinaryDir)) { std::string d = *ri; if (!rootPath.empty() && d.find(rootPath) == 0) diff --git a/Source/cmConfigureFileCommand.cxx b/Source/cmConfigureFileCommand.cxx index 395e6c8..cc6cf5f 100644 --- a/Source/cmConfigureFileCommand.cxx +++ b/Source/cmConfigureFileCommand.cxx @@ -32,7 +32,7 @@ bool cmConfigureFileCommand this->InputFile += inFile; // If the input location is a directory, error out. - if(cmSystemTools::FileIsDirectory(this->InputFile.c_str())) + if(cmSystemTools::FileIsDirectory(this->InputFile)) { cmOStringStream e; e << "input location\n" @@ -51,7 +51,7 @@ bool cmConfigureFileCommand this->OutputFile += outFile; // If the output location is already a directory put the file in it. - if(cmSystemTools::FileIsDirectory(this->OutputFile.c_str())) + if(cmSystemTools::FileIsDirectory(this->OutputFile)) { this->OutputFile += "/"; this->OutputFile += cmSystemTools::GetFilenameName(inFile); @@ -74,6 +74,7 @@ bool cmConfigureFileCommand this->CopyOnly = false; this->EscapeQuotes = false; + std::string unknown_args; this->AtOnly = false; for(unsigned int i=2;i < args.size();++i) { @@ -99,6 +100,18 @@ bool cmConfigureFileCommand { /* Ignore legacy option. */ } + else + { + unknown_args += " "; + unknown_args += args[i]; + unknown_args += "\n"; + } + } + if (!unknown_args.empty()) + { + std::string msg = "configure_file called with unknown argument(s):\n"; + msg += unknown_args; + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, msg); } if ( !this->ConfigureFile() ) diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index bc5708d..512f5cf 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -233,7 +233,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv) { // remove any CMakeCache.txt files so we will have a clean test std::string ccFile = this->BinaryDirectory + "/CMakeCache.txt"; - cmSystemTools::RemoveFile(ccFile.c_str()); + cmSystemTools::RemoveFile(ccFile); // Choose sources. if(!useSources) @@ -279,7 +279,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv) sourceDirectory = this->BinaryDirectory.c_str(); // now create a CMakeLists.txt file in that directory - FILE *fout = cmsys::SystemTools::Fopen(outFileName.c_str(),"w"); + FILE *fout = cmsys::SystemTools::Fopen(outFileName,"w"); if (!fout) { cmOStringStream e; @@ -514,8 +514,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv) if ((res==0) && (copyFile.size())) { if(this->OutputFile.empty() || - !cmSystemTools::CopyFileAlways(this->OutputFile.c_str(), - copyFile.c_str())) + !cmSystemTools::CopyFileAlways(this->OutputFile, + copyFile)) { cmOStringStream emsg; emsg << "Cannot copy output executable\n" @@ -580,10 +580,10 @@ void cmCoreTryCompile::CleanupFiles(const char* binDir) std::string fullPath = binDir; fullPath += "/"; fullPath += dir.GetFile(static_cast<unsigned long>(fileNum)); - if(cmSystemTools::FileIsDirectory(fullPath.c_str())) + if(cmSystemTools::FileIsDirectory(fullPath)) { this->CleanupFiles(fullPath.c_str()); - cmSystemTools::RemoveADirectory(fullPath.c_str()); + cmSystemTools::RemoveADirectory(fullPath); } else { @@ -599,7 +599,7 @@ void cmCoreTryCompile::CleanupFiles(const char* binDir) } if(retry.Count == 0) #else - if(!cmSystemTools::RemoveFile(fullPath.c_str())) + if(!cmSystemTools::RemoveFile(fullPath)) #endif { std::string m = "Remove failed on file: " + fullPath; @@ -649,7 +649,7 @@ void cmCoreTryCompile::FindOutputFile(const std::string& targetName) command += tmpOutputFile; if(cmSystemTools::FileExists(command.c_str())) { - tmpOutputFile = cmSystemTools::CollapseFullPath(command.c_str()); + tmpOutputFile = cmSystemTools::CollapseFullPath(command); this->OutputFile = tmpOutputFile; return; } diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx index 134f45b..947db82 100644 --- a/Source/cmDepends.cxx +++ b/Source/cmDepends.cxx @@ -94,7 +94,7 @@ bool cmDepends::Check(const char *makeFile, const char *internalFile, // Get the CWD but do not call CollapseFullPath because // we only need it to cd back, and the form does not matter oldcwd = cmSystemTools::GetCurrentWorkingDirectory(false); - cmSystemTools::ChangeDirectory(this->CompileDirectory.c_str()); + cmSystemTools::ChangeDirectory(this->CompileDirectory); } // Check whether dependencies must be regenerated. @@ -111,7 +111,7 @@ bool cmDepends::Check(const char *makeFile, const char *internalFile, // Restore working directory. if(oldcwd != ".") { - cmSystemTools::ChangeDirectory(oldcwd.c_str()); + cmSystemTools::ChangeDirectory(oldcwd); } return okay; diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index 8fc8347..4082d24 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -668,7 +668,7 @@ bool cmDependsFortran::CopyModule(const std::vector<std::string>& args) if(cmDependsFortran::ModulesDiffer(mod_upper.c_str(), stamp.c_str(), compilerId.c_str())) { - if(!cmSystemTools::CopyFileAlways(mod_upper.c_str(), stamp.c_str())) + if(!cmSystemTools::CopyFileAlways(mod_upper, stamp)) { std::cerr << "Error copying Fortran module from \"" << mod_upper << "\" to \"" << stamp @@ -683,7 +683,7 @@ bool cmDependsFortran::CopyModule(const std::vector<std::string>& args) if(cmDependsFortran::ModulesDiffer(mod_lower.c_str(), stamp.c_str(), compilerId.c_str())) { - if(!cmSystemTools::CopyFileAlways(mod_lower.c_str(), stamp.c_str())) + if(!cmSystemTools::CopyFileAlways(mod_lower, stamp)) { std::cerr << "Error copying Fortran module from \"" << mod_lower << "\" to \"" << stamp diff --git a/Source/cmDependsFortranParser.cxx b/Source/cmDependsFortranParser.cxx index 7b49a9c..9d51025 100644 --- a/Source/cmDependsFortranParser.cxx +++ b/Source/cmDependsFortranParser.cxx @@ -144,12 +144,6 @@ static bool cmDependsFortranParserIsKeyword(const char* word, } /* Disable some warnings in the generated code. */ -#ifdef __BORLANDC__ -# pragma warn -8004 /* Variable assigned a value that is not used. */ -# pragma warn -8008 /* condition always returns true */ -# pragma warn -8060 /* possibly incorrect assignment */ -# pragma warn -8066 /* unreachable code */ -#endif #ifdef _MSC_VER # pragma warning (disable: 4102) /* Unused goto label. */ # pragma warning (disable: 4065) /* Switch contains default but no case. */ diff --git a/Source/cmDependsFortranParser.y b/Source/cmDependsFortranParser.y index d814f30..a987c13 100644 --- a/Source/cmDependsFortranParser.y +++ b/Source/cmDependsFortranParser.y @@ -68,12 +68,6 @@ static bool cmDependsFortranParserIsKeyword(const char* word, } /* Disable some warnings in the generated code. */ -#ifdef __BORLANDC__ -# pragma warn -8004 /* Variable assigned a value that is not used. */ -# pragma warn -8008 /* condition always returns true */ -# pragma warn -8060 /* possibly incorrect assignment */ -# pragma warn -8066 /* unreachable code */ -#endif #ifdef _MSC_VER # pragma warning (disable: 4102) /* Unused goto label. */ # pragma warning (disable: 4065) /* Switch contains default but no case. */ diff --git a/Source/cmDependsJavaParser.cxx b/Source/cmDependsJavaParser.cxx index 586c0de..899f4d2 100644 --- a/Source/cmDependsJavaParser.cxx +++ b/Source/cmDependsJavaParser.cxx @@ -336,12 +336,6 @@ static void cmDependsJavaError(yyscan_t yyscanner, const char* message); #define jpStoreClass(str) \ yyGetParser->AddClassFound(str); yyGetParser->DeallocateParserType(&(str)) /* Disable some warnings in the generated code. */ -#ifdef __BORLANDC__ -# pragma warn -8004 /* Variable assigned a value that is not used. */ -# pragma warn -8008 /* condition always returns true */ -# pragma warn -8060 /* possibly incorrect assignment */ -# pragma warn -8066 /* unreachable code */ -#endif #ifdef _MSC_VER # pragma warning (disable: 4102) /* Unused goto label. */ # pragma warning (disable: 4065) /* Switch statement contains default but diff --git a/Source/cmDependsJavaParser.y b/Source/cmDependsJavaParser.y index 944d4b5..b66dc6d 100644 --- a/Source/cmDependsJavaParser.y +++ b/Source/cmDependsJavaParser.y @@ -52,12 +52,6 @@ static void cmDependsJavaError(yyscan_t yyscanner, const char* message); #define jpElementStart(cnt) yyGetParser->PrepareElement(&yyval) #define jpStoreClass(str) yyGetParser->AddClassFound(str); yyGetParser->DeallocateParserType(&(str)) /* Disable some warnings in the generated code. */ -#ifdef __BORLANDC__ -# pragma warn -8004 /* Variable assigned a value that is not used. */ -# pragma warn -8008 /* condition always returns true */ -# pragma warn -8060 /* possibly incorrect assignment */ -# pragma warn -8066 /* unreachable code */ -#endif #ifdef _MSC_VER # pragma warning (disable: 4102) /* Unused goto label. */ # pragma warning (disable: 4065) /* Switch statement contains default but no case. */ diff --git a/Source/cmExprParser.cxx b/Source/cmExprParser.cxx index 77880c0..c12b42e 100644 --- a/Source/cmExprParser.cxx +++ b/Source/cmExprParser.cxx @@ -157,12 +157,6 @@ static void cmExprError(yyscan_t yyscanner, const char* message); /* Disable some warnings in the generated code. */ -#ifdef __BORLANDC__ -# pragma warn -8004 /* Variable assigned a value that is not used. */ -# pragma warn -8008 /* condition always returns true */ -# pragma warn -8060 /* possibly incorrect assignment */ -# pragma warn -8066 /* unreachable code */ -#endif #ifdef _MSC_VER # pragma warning (disable: 4102) /* Unused goto label. */ # pragma warning (disable: 4065) /* Switch statement contains default but diff --git a/Source/cmExprParser.y b/Source/cmExprParser.y index 12c2e48..f2c85d0 100644 --- a/Source/cmExprParser.y +++ b/Source/cmExprParser.y @@ -52,12 +52,6 @@ static void cmExprError(yyscan_t yyscanner, const char* message); /* Disable some warnings in the generated code. */ -#ifdef __BORLANDC__ -# pragma warn -8004 /* Variable assigned a value that is not used. */ -# pragma warn -8008 /* condition always returns true */ -# pragma warn -8060 /* possibly incorrect assignment */ -# pragma warn -8066 /* unreachable code */ -#endif #ifdef _MSC_VER # pragma warning (disable: 4102) /* Unused goto label. */ # pragma warning (disable: 4065) /* Switch statement contains default but no case. */ diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 56a6edb..79d7bcaff 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -276,7 +276,7 @@ void cmExtraCodeBlocksGenerator it->second[0]->GetMakefile()->GetHomeDirectory(), jt->c_str()); std::vector<std::string> splitted; - cmSystemTools::SplitPath(relative.c_str(), splitted, false); + cmSystemTools::SplitPath(relative, splitted, false); // Split filename from path std::string fileName = *(splitted.end()-1); splitted.erase(splitted.end() - 1, splitted.end()); diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 1beb3fd..2f69882 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -124,8 +124,8 @@ void cmExtraEclipseCDT4Generator::Generate() "Enable CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT instead."); } - if (cmSystemTools::IsSubDirectory(this->HomeOutputDirectory.c_str(), - this->HomeDirectory.c_str())) + if (cmSystemTools::IsSubDirectory(this->HomeOutputDirectory, + this->HomeDirectory)) { mf->IssueMessage(cmake::WARNING, "The build directory is a subdirectory " "of the source directory.\n" @@ -495,8 +495,8 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile() std::string linkSourceDirectory = this->GetEclipsePath( mf->GetStartDirectory()); // .project dir can't be subdir of a linked resource dir - if (!cmSystemTools::IsSubDirectory(this->HomeOutputDirectory.c_str(), - linkSourceDirectory.c_str())) + if (!cmSystemTools::IsSubDirectory(this->HomeOutputDirectory, + linkSourceDirectory)) { this->AppendLinkedResource(fout, sourceLinkedResourceName, this->GetEclipsePath(linkSourceDirectory), @@ -590,7 +590,7 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets( ++fileIt) { std::string fullPath = (*fileIt)->GetFullPath(); - if (!cmSystemTools::FileIsDirectory(fullPath.c_str())) + if (!cmSystemTools::FileIsDirectory(fullPath)) { std::string linkName4 = linkName3; linkName4 += "/"; @@ -635,8 +635,8 @@ void cmExtraEclipseCDT4Generator::CreateLinksToSubprojects( // a linked resource must not point to a parent directory of .project or // .project itself if ((baseDir != linkSourceDirectory) && - !cmSystemTools::IsSubDirectory(baseDir.c_str(), - linkSourceDirectory.c_str())) + !cmSystemTools::IsSubDirectory(baseDir, + linkSourceDirectory)) { std::string linkName = "[Subprojects]/"; linkName += it->first; @@ -663,7 +663,7 @@ void cmExtraEclipseCDT4Generator::AppendIncludeDirectories( { if (!inc->empty()) { - std::string dir = cmSystemTools::CollapseFullPath(inc->c_str()); + std::string dir = cmSystemTools::CollapseFullPath(*inc); // handle framework include dirs on OSX, the remainder after the // Frameworks/ part has to be stripped @@ -819,7 +819,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const // exlude source directory from output search path // - only if not named the same as an output directory if (!cmSystemTools::FileIsDirectory( - std::string(this->HomeOutputDirectory + "/" + *it).c_str())) + std::string(this->HomeOutputDirectory + "/" + *it))) { excludeFromOut += this->EscapeForXML(*it) + "/|"; } diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 1325cec..7ebd750 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -220,8 +220,6 @@ bool cmFileCommand::HandleWriteCommand(std::vector<std::string> const& args, cmSystemTools::SetPermissions(fileName.c_str(), #if defined( _MSC_VER ) || defined( __MINGW32__ ) mode | S_IWRITE -#elif defined( __BORLANDC__ ) - mode | S_IWUSR #else mode | S_IWUSR | S_IWGRP #endif @@ -1504,7 +1502,7 @@ bool cmFileCopier::Run(std::vector<std::string> const& args) { // Split the input file into its directory and name components. std::vector<std::string> fromPathComponents; - cmSystemTools::SplitPath(files[i].c_str(), fromPathComponents); + cmSystemTools::SplitPath(files[i], fromPathComponents); std::string fromName = *(fromPathComponents.end()-1); std::string fromDir = cmSystemTools::JoinPath(fromPathComponents.begin(), fromPathComponents.end()-1); @@ -2203,7 +2201,7 @@ bool cmFileInstaller::HandleInstallDestination() return false; } } - if ( !cmSystemTools::FileIsDirectory(destination.c_str()) ) + if ( !cmSystemTools::FileIsDirectory(destination) ) { std::string errstring = "INSTALL destination: " + destination + " is not a directory."; @@ -2553,14 +2551,14 @@ bool cmFileCommand::HandleRemove(std::vector<std::string> const& args, fileName += "/" + *i; } - if(cmSystemTools::FileIsDirectory(fileName.c_str()) && - !cmSystemTools::FileIsSymlink(fileName.c_str()) && recurse) + if(cmSystemTools::FileIsDirectory(fileName) && + !cmSystemTools::FileIsSymlink(fileName) && recurse) { - cmSystemTools::RemoveADirectory(fileName.c_str()); + cmSystemTools::RemoveADirectory(fileName); } else { - cmSystemTools::RemoveFile(fileName.c_str()); + cmSystemTools::RemoveFile(fileName); } } return true; @@ -2584,7 +2582,7 @@ bool cmFileCommand::HandleCMakePathCommand(std::vector<std::string> #else char pathSep = ':'; #endif - std::vector<cmsys::String> path = cmSystemTools::SplitString(i->c_str(), + std::vector<cmsys::String> path = cmSystemTools::SplitString(*i, pathSep); i++; const char* var = i->c_str(); @@ -3241,7 +3239,7 @@ cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args) // Open file for reading: // - FILE *fin = cmsys::SystemTools::Fopen(filename.c_str(), "rb"); + FILE *fin = cmsys::SystemTools::Fopen(filename, "rb"); if(!fin) { std::string errStr = "UPLOAD cannot open file '"; diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx index 10241f2..6376d42 100644 --- a/Source/cmFindCommon.cxx +++ b/Source/cmFindCommon.cxx @@ -182,9 +182,9 @@ void cmFindCommon::RerootPaths(std::vector<std::string>& paths) // already inside. Skip the unrooted path if it is relative to // a user home directory or is empty. std::string rootedDir; - if(cmSystemTools::IsSubDirectory(ui->c_str(), ri->c_str()) + if(cmSystemTools::IsSubDirectory(*ui, *ri) || (stagePrefix - && cmSystemTools::IsSubDirectory(ui->c_str(), stagePrefix))) + && cmSystemTools::IsSubDirectory(*ui, stagePrefix))) { rootedDir = *ui; } @@ -195,7 +195,7 @@ void cmFindCommon::RerootPaths(std::vector<std::string>& paths) rootedDir += "/"; // Append the original path with its old root removed. - rootedDir += cmSystemTools::SplitPathRootComponent(ui->c_str()); + rootedDir += cmSystemTools::SplitPathRootComponent(*ui); } // Store the new path. @@ -428,7 +428,7 @@ void cmFindCommon::AddPathInternal(std::string const& in_path, // Convert to clean full path. std::string fullPath = - cmSystemTools::CollapseFullPath(in_path.c_str(), relbase); + cmSystemTools::CollapseFullPath(in_path, relbase); // Insert the path if has not already been emitted. if(this->SearchPathsEmitted.insert(fullPath).second) diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index fe5e45f..16deaab 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -107,7 +107,7 @@ void cmFindLibraryCommand::AddArchitecturePath( // Follow "lib<suffix>". std::string next_dir = cur_dir + suffix; - if(cmSystemTools::FileIsDirectory(next_dir.c_str())) + if(cmSystemTools::FileIsDirectory(next_dir)) { next_dir += dir.substr(pos+3); std::string::size_type next_pos = pos+3+strlen(suffix)+1; @@ -115,7 +115,7 @@ void cmFindLibraryCommand::AddArchitecturePath( } // Follow "lib". - if(cmSystemTools::FileIsDirectory(cur_dir.c_str())) + if(cmSystemTools::FileIsDirectory(cur_dir)) { this->AddArchitecturePath(dir, pos+3+1, suffix, false); } @@ -124,13 +124,13 @@ void cmFindLibraryCommand::AddArchitecturePath( { // Check for <dir><suffix>/. std::string cur_dir = dir + suffix + "/"; - if(cmSystemTools::FileIsDirectory(cur_dir.c_str())) + if(cmSystemTools::FileIsDirectory(cur_dir)) { this->SearchPaths.push_back(cur_dir); } // Now add the original unchanged path - if(cmSystemTools::FileIsDirectory(dir.c_str())) + if(cmSystemTools::FileIsDirectory(dir)) { this->SearchPaths.push_back(dir); } @@ -353,7 +353,7 @@ bool cmFindLibraryHelper::CheckDirectoryForName(std::string const& path, if(cmSystemTools::FileExists(this->TestPath.c_str(), true)) { this->BestPath = - cmSystemTools::CollapseFullPath(this->TestPath.c_str()); + cmSystemTools::CollapseFullPath(this->TestPath); cmSystemTools::ConvertToUnixSlashes(this->BestPath); return true; } @@ -382,7 +382,7 @@ bool cmFindLibraryHelper::CheckDirectoryForName(std::string const& path, { this->TestPath = path; this->TestPath += origName; - if(!cmSystemTools::FileIsDirectory(this->TestPath.c_str())) + if(!cmSystemTools::FileIsDirectory(this->TestPath)) { // This is a matching file. Check if it is better than the // best name found so far. Earlier prefixes are preferred, @@ -506,9 +506,9 @@ std::string cmFindLibraryCommand::FindFrameworkLibraryNamesPerDir() fwPath = *di; fwPath += *ni; fwPath += ".framework"; - if(cmSystemTools::FileIsDirectory(fwPath.c_str())) + if(cmSystemTools::FileIsDirectory(fwPath)) { - return cmSystemTools::CollapseFullPath(fwPath.c_str()); + return cmSystemTools::CollapseFullPath(fwPath); } } } @@ -532,9 +532,9 @@ std::string cmFindLibraryCommand::FindFrameworkLibraryDirsPerName() fwPath = *di; fwPath += *ni; fwPath += ".framework"; - if(cmSystemTools::FileIsDirectory(fwPath.c_str())) + if(cmSystemTools::FileIsDirectory(fwPath)) { - return cmSystemTools::CollapseFullPath(fwPath.c_str()); + return cmSystemTools::CollapseFullPath(fwPath); } } } diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 55a61f5..4633e71 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -1335,7 +1335,7 @@ public: void cmFindPackageCommand::LoadPackageRegistryDir(std::string const& dir) { cmsys::Directory files; - if(!files.Load(dir.c_str())) + if(!files.Load(dir)) { return; } @@ -1347,7 +1347,7 @@ void cmFindPackageCommand::LoadPackageRegistryDir(std::string const& dir) fname += "/"; fname += files.GetFile(i); - if(!cmSystemTools::FileIsDirectory(fname.c_str())) + if(!cmSystemTools::FileIsDirectory(fname)) { // Hold this file hostage until it behaves. cmFindPackageCommandHoldFile holdFile(fname.c_str()); @@ -1379,7 +1379,7 @@ bool cmFindPackageCommand::CheckPackageRegistryEntry(std::istream& is) if(cmSystemTools::FileExists(fname.c_str())) { // The path exists. Look for the package here. - if(!cmSystemTools::FileIsDirectory(fname.c_str())) + if(!cmSystemTools::FileIsDirectory(fname)) { fname = cmSystemTools::GetFilenamePath(fname); } @@ -1419,7 +1419,7 @@ void cmFindPackageCommand::AddPrefixesBuilds() cmSystemTools::ExpandRegistryValues(f); cmSystemTools::ConvertToUnixSlashes(f); if(cmSystemTools::FileIsFullPath(f.c_str()) && - cmSystemTools::FileIsDirectory(f.c_str())) + cmSystemTools::FileIsDirectory(f)) { this->AddPathInternal(f, FullPath); } @@ -1847,7 +1847,7 @@ private: // Construct a list of matches. std::vector<std::string> matches; cmsys::Directory d; - d.Load(parent.c_str()); + d.Load(parent); for(unsigned long i=0; i < d.GetNumberOfFiles(); ++i) { const char* fname = d.GetFile(i); @@ -1901,7 +1901,7 @@ private: // Construct a list of matches. std::vector<std::string> matches; cmsys::Directory d; - d.Load(parent.c_str()); + d.Load(parent); for(unsigned long i=0; i < d.GetNumberOfFiles(); ++i) { const char* fname = d.GetFile(i); @@ -1955,7 +1955,7 @@ private: // Look for matching files. std::vector<std::string> matches; cmsys::Directory d; - d.Load(parent.c_str()); + d.Load(parent); for(unsigned long i=0; i < d.GetNumberOfFiles(); ++i) { const char* fname = d.GetFile(i); @@ -2007,7 +2007,7 @@ private: for(std::vector<std::string>::const_iterator fi = files.begin(); fi != files.end(); ++fi) { - if(cmSystemTools::FileIsDirectory(fi->c_str())) + if(cmSystemTools::FileIsDirectory(*fi)) { if(this->Consider(*fi, lister)) { @@ -2035,7 +2035,7 @@ bool cmFindPackageCommand::SearchPrefix(std::string const& prefix_in) } // Skip this if the prefix does not exist. - if(!cmSystemTools::FileIsDirectory(prefix_in.c_str())) + if(!cmSystemTools::FileIsDirectory(prefix_in)) { return false; } diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx index 5531cdf..f4cc4c2 100644 --- a/Source/cmFindPathCommand.cxx +++ b/Source/cmFindPathCommand.cxx @@ -136,7 +136,7 @@ cmFindPathCommand::FindHeaderInFramework(std::string const& file, std::vector<std::string> files = globIt.GetFiles(); if(files.size()) { - std::string fheader = cmSystemTools::CollapseFullPath(files[0].c_str()); + std::string fheader = cmSystemTools::CollapseFullPath(files[0]); if(this->IncludeFileInPath) { return fheader; diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx index f6e37f6..b6577e1 100644 --- a/Source/cmFindProgramCommand.cxx +++ b/Source/cmFindProgramCommand.cxx @@ -97,7 +97,7 @@ std::string cmFindProgramCommand std::string executable = GetBundleExecutable(appPath); if (!executable.empty()) { - return cmSystemTools::CollapseFullPath(executable.c_str()); + return cmSystemTools::CollapseFullPath(executable); } } } diff --git a/Source/cmGeneratedFileStream.cxx b/Source/cmGeneratedFileStream.cxx index 78ad4b2..600b793 100644 --- a/Source/cmGeneratedFileStream.cxx +++ b/Source/cmGeneratedFileStream.cxx @@ -152,7 +152,7 @@ void cmGeneratedFileStreamBase::Open(const char* name) #endif // Make sure the temporary file that will be used is not present. - cmSystemTools::RemoveFile(this->TempName.c_str()); + cmSystemTools::RemoveFile(this->TempName); std::string dir = cmSystemTools::GetFilenamePath(this->TempName); cmSystemTools::MakeDirectory(dir.c_str()); @@ -174,7 +174,7 @@ bool cmGeneratedFileStreamBase::Close() if(!this->Name.empty() && this->Okay && (!this->CopyIfDifferent || - cmSystemTools::FilesDiffer(this->TempName.c_str(), resname.c_str()))) + cmSystemTools::FilesDiffer(this->TempName, resname))) { // The destination is to be replaced. Rename the temporary to the // destination atomically. @@ -185,7 +185,7 @@ bool cmGeneratedFileStreamBase::Close() { this->RenameFile(gzname.c_str(), resname.c_str()); } - cmSystemTools::RemoveFile(gzname.c_str()); + cmSystemTools::RemoveFile(gzname); } else { @@ -198,7 +198,7 @@ bool cmGeneratedFileStreamBase::Close() // Else, the destination was not replaced. // // Always delete the temporary file. We never want it to stay around. - cmSystemTools::RemoveFile(this->TempName.c_str()); + cmSystemTools::RemoveFile(this->TempName); return replaced; } diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 7fc1464..09d02ea 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -33,18 +33,10 @@ cmGeneratorExpression::cmGeneratorExpression( cmsys::auto_ptr<cmCompiledGeneratorExpression> cmGeneratorExpression::Parse(std::string const& input) { -#if !defined(__BORLANDC__) return cmsys::auto_ptr<cmCompiledGeneratorExpression>( new cmCompiledGeneratorExpression( this->Backtrace ? *this->Backtrace : cmListFileBacktrace(NULL), input)); -#else - cmListFileBacktrace emptyBacktrace(NULL); - return cmsys::auto_ptr<cmCompiledGeneratorExpression>( - new cmCompiledGeneratorExpression( - this->Backtrace ? *this->Backtrace : emptyBacktrace, - input)); -#endif } //---------------------------------------------------------------------------- diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index c1478df..27fe910 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -1253,7 +1253,7 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode std::string tgtName = parameters.front(); cmGeneratorTarget* gt = - context->Makefile->FindGeneratorTargetToUse(tgtName.c_str()); + context->Makefile->FindGeneratorTargetToUse(tgtName); if (!gt) { cmOStringStream e; @@ -1286,12 +1286,16 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode std::string obj_dir = gt->ObjectDirectory; std::string result; const char* sep = ""; - for(std::map<cmSourceFile const*, std::string>::const_iterator it - = mapping.begin(); it != mapping.end(); ++it) + for(std::vector<cmSourceFile const*>::const_iterator it + = objectSources.begin(); it != objectSources.end(); ++it) { - assert(!it->second.empty()); + // Find the object file name corresponding to this source file. + std::map<cmSourceFile const*, std::string>::const_iterator + map_it = mapping.find(*it); + // It must exist because we populated the mapping just above. + assert(!map_it->second.empty()); result += sep; - std::string objFile = obj_dir + it->second; + std::string objFile = obj_dir + map_it->second; cmSourceFile* sf = context->Makefile->GetOrCreateSource(objFile, true); sf->SetObjectLibrary(tgtName); sf->SetProperty("EXTERNAL_OBJECT", "1"); diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 14b5a92..1d1225f 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -772,8 +772,8 @@ bool cmTargetTraceDependencies::IsUtility(std::string const& dep) std::string tLocation = t->GetLocationForBuild(); tLocation = cmSystemTools::GetFilenamePath(tLocation); std::string depLocation = cmSystemTools::GetFilenamePath(dep); - depLocation = cmSystemTools::CollapseFullPath(depLocation.c_str()); - tLocation = cmSystemTools::CollapseFullPath(tLocation.c_str()); + depLocation = cmSystemTools::CollapseFullPath(depLocation); + tLocation = cmSystemTools::CollapseFullPath(tLocation); if(depLocation == tLocation) { this->Target->AddUtility(util); diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx index fcc3da1..8fb2fa1 100644 --- a/Source/cmGetDirectoryPropertyCommand.cxx +++ b/Source/cmGetDirectoryPropertyCommand.cxx @@ -49,7 +49,7 @@ bool cmGetDirectoryPropertyCommand } // The local generators are associated with collapsed paths. - sd = cmSystemTools::CollapseFullPath(sd.c_str()); + sd = cmSystemTools::CollapseFullPath(sd); // lookup the makefile from the directory name cmLocalGenerator *lg = diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx index 10406d2..77850af 100644 --- a/Source/cmGetFilenameComponentCommand.cxx +++ b/Source/cmGetFilenameComponentCommand.cxx @@ -97,11 +97,11 @@ bool cmGetFilenameComponentCommand // If the path given is relative evaluate it relative to the // current source directory. result = cmSystemTools::CollapseFullPath( - filename.c_str(), this->Makefile->GetCurrentDirectory()); + filename, this->Makefile->GetCurrentDirectory()); if(args[2] == "REALPATH") { // Resolve symlinks if possible - result = cmSystemTools::GetRealPath(result.c_str()); + result = cmSystemTools::GetRealPath(result); } } else diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index 9a88191..3c59c25 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -259,7 +259,7 @@ bool cmGetPropertyCommand::HandleDirectoryMode() } // The local generators are associated with collapsed paths. - dir = cmSystemTools::CollapseFullPath(dir.c_str()); + dir = cmSystemTools::CollapseFullPath(dir); // Lookup the generator. if(cmLocalGenerator* lg = diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index ae0e807..a729c3d 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -300,7 +300,7 @@ void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf) cmSystemTools::SplitProgramPath(makeProgram.c_str(), dir, file); std::string saveFile = file; - cmSystemTools::GetShortPath(makeProgram.c_str(), makeProgram); + cmSystemTools::GetShortPath(makeProgram, makeProgram); cmSystemTools::SplitProgramPath(makeProgram.c_str(), dir, file); makeProgram = dir; @@ -691,7 +691,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages, compilerLangFile += "/CMake"; compilerLangFile += lang; compilerLangFile += "Compiler.cmake"; - cmSystemTools::RemoveFile(compilerLangFile.c_str()); + cmSystemTools::RemoveFile(compilerLangFile); if(!this->CMakeInstance->GetIsInTryCompile()) { this->PrintCompilerAdvice(noCompiler, lang, @@ -758,7 +758,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages, compilerLangFile += "/CMake"; compilerLangFile += lang; compilerLangFile += "Compiler.cmake"; - cmSystemTools::RemoveFile(compilerLangFile.c_str()); + cmSystemTools::RemoveFile(compilerLangFile); } } // end if in try compile } // end need test language @@ -1735,7 +1735,7 @@ int cmGlobalGenerator::Build( * Run an executable command and put the stdout in output. */ std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); - cmSystemTools::ChangeDirectory(bindir.c_str()); + cmSystemTools::ChangeDirectory(bindir); output += "Change Dir: "; output += bindir; output += "\n"; @@ -1765,7 +1765,7 @@ int cmGlobalGenerator::Build( output += "\nGenerator: execution of make clean failed.\n"; // return to the original directory - cmSystemTools::ChangeDirectory(cwd.c_str()); + cmSystemTools::ChangeDirectory(cwd); return 1; } output += *outputPtr; @@ -1792,7 +1792,7 @@ int cmGlobalGenerator::Build( + makeCommandStr + "\n"; // return to the original directory - cmSystemTools::ChangeDirectory(cwd.c_str()); + cmSystemTools::ChangeDirectory(cwd); return 1; } output += *outputPtr; @@ -1806,7 +1806,7 @@ int cmGlobalGenerator::Build( retVal = 1; } - cmSystemTools::ChangeDirectory(cwd.c_str()); + cmSystemTools::ChangeDirectory(cwd); return retVal; } @@ -2723,7 +2723,7 @@ cmGlobalGenerator::GetDirectoryContent(std::string const& dir, bool needDisk) { // Load the directory content from disk. cmsys::Directory d; - if(d.Load(dir.c_str())) + if(d.Load(dir)) { unsigned long n = d.GetNumberOfFiles(); for(unsigned long i = 0; i < n; ++i) @@ -2830,8 +2830,8 @@ void cmGlobalGenerator::CheckRuleHashes(std::string const& pfile, { // The rule has changed. Delete the output so it will be // built again. - fname = cmSystemTools::CollapseFullPath(fname.c_str(), home.c_str()); - cmSystemTools::RemoveFile(fname.c_str()); + fname = cmSystemTools::CollapseFullPath(fname, home.c_str()); + cmSystemTools::RemoveFile(fname); } } else @@ -2843,7 +2843,7 @@ void cmGlobalGenerator::CheckRuleHashes(std::string const& pfile, // that if the feature is turned back on and the rule has // changed the file is still rebuilt. std::string fpath = - cmSystemTools::CollapseFullPath(fname.c_str(), home.c_str()); + cmSystemTools::CollapseFullPath(fname, home.c_str()); if(cmSystemTools::FileExists(fpath.c_str())) { RuleHash hash; @@ -2860,7 +2860,7 @@ void cmGlobalGenerator::WriteRuleHashes(std::string const& pfile) // Now generate a new persistence file with the current hashes. if(this->RuleHashes.empty()) { - cmSystemTools::RemoveFile(pfile.c_str()); + cmSystemTools::RemoveFile(pfile); } else { @@ -2965,7 +2965,7 @@ void cmGlobalGenerator::WriteSummary(cmTarget* target) } else { - cmSystemTools::RemoveFile(file.c_str()); + cmSystemTools::RemoveFile(file); } } diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx index 89d25c4..ee0c583 100644 --- a/Source/cmGlobalKdevelopGenerator.cxx +++ b/Source/cmGlobalKdevelopGenerator.cxx @@ -222,7 +222,7 @@ bool cmGlobalKdevelopGenerator it!=files.end(); it++) { // get the full path to the file - tmp=cmSystemTools::CollapseFullPath(it->c_str(), projectDir.c_str()); + tmp=cmSystemTools::CollapseFullPath(*it, projectDir.c_str()); // just select the first source file if (fileToOpen.empty()) { @@ -274,7 +274,7 @@ void cmGlobalKdevelopGenerator // kdevelop blacklist so they are not monitored for added or removed files // since this is handled by adding files to the cmake files cmsys::Directory d; - if (d.Load(projectDir.c_str())) + if (d.Load(projectDir)) { size_t numf = d.GetNumberOfFiles(); for (unsigned int i = 0; i < numf; i++) @@ -285,7 +285,7 @@ void cmGlobalKdevelopGenerator std::string tmp = projectDir; tmp += "/"; tmp += nextFile; - if (cmSystemTools::FileIsDirectory(tmp.c_str())) + if (cmSystemTools::FileIsDirectory(tmp)) { tmp += "/CMakeCache.txt"; if ((nextFile == "CMakeFiles") diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 6e7b06b..498ae9a 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -771,7 +771,7 @@ void cmGlobalNinjaGenerator::AddCXXCompileCommand( if (!cmSystemTools::FileIsFullPath(sourceFileName.c_str())) { sourceFileName = cmSystemTools::CollapseFullPath( - sourceFileName.c_str(), + sourceFileName, this->GetCMakeInstance()->GetHomeOutputDirectory()); } @@ -851,7 +851,7 @@ cmGlobalNinjaGenerator case cmTarget::STATIC_LIBRARY: case cmTarget::MODULE_LIBRARY: outputs.push_back(ng->ConvertToNinjaPath( - target->GetFullPath(configName, false, realname).c_str())); + target->GetFullPath(configName, false, realname))); break; case cmTarget::OBJECT_LIBRARY: @@ -970,7 +970,7 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) typedef std::vector<std::string>::const_iterator vect_it; for(vect_it j = files.begin(); j != files.end(); ++j) { - knownDependencies.insert( ng->ConvertToNinjaPath( j->c_str() ) ); + knownDependencies.insert( ng->ConvertToNinjaPath( *j ) ); } //get list files which are implicit dependencies as well and will be phony //for rebuild manifest @@ -978,7 +978,7 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) typedef std::vector<std::string>::const_iterator vect_it; for(vect_it j = lf.begin(); j != lf.end(); ++j) { - knownDependencies.insert( ng->ConvertToNinjaPath( j->c_str() ) ); + knownDependencies.insert( ng->ConvertToNinjaPath( *j ) ); } } knownDependencies.insert( "CMakeCache.txt" ); @@ -994,7 +994,7 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) typedef std::vector<std::string>::const_iterator vect_it; for(vect_it j = files.begin(); j != files.end(); ++j) { - knownDependencies.insert( ng->ConvertToNinjaPath( j->c_str() ) ); + knownDependencies.insert( ng->ConvertToNinjaPath( *j ) ); } } @@ -1002,7 +1002,7 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) i != this->TargetAliases.end(); ++i) { - knownDependencies.insert( ng->ConvertToNinjaPath(i->first.c_str()) ); + knownDependencies.insert( ng->ConvertToNinjaPath(i->first) ); } //remove all source files we know will exist. @@ -1011,7 +1011,7 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) i != this->AssumedSourceDependencies.end(); ++i) { - knownDependencies.insert( ng->ConvertToNinjaPath(i->first.c_str()) ); + knownDependencies.insert( ng->ConvertToNinjaPath(i->first) ); } //insert outputs from all WirteBuild commands @@ -1051,9 +1051,9 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) { //verify the file is in the build directory std::string const absDepPath = cmSystemTools::CollapseFullPath( - i->c_str(), rootBuildDirectory.c_str()); - bool const inBuildDir = cmSystemTools::IsSubDirectory(absDepPath.c_str(), - rootBuildDirectory.c_str()); + *i, rootBuildDirectory.c_str()); + bool const inBuildDir = cmSystemTools::IsSubDirectory(absDepPath, + rootBuildDirectory); if(inBuildDir) { cmNinjaDeps deps(1,*i); @@ -1129,7 +1129,7 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os) for(std::vector<std::string>::const_iterator fi = lf.begin(); fi != lf.end(); ++fi) { - implicitDeps.push_back(ng->ConvertToNinjaPath(fi->c_str())); + implicitDeps.push_back(ng->ConvertToNinjaPath(*fi)); } } implicitDeps.push_back("CMakeCache.txt"); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 13e6988..5e7a898 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -2314,6 +2314,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, group->AddObject(this->CreateString("-Wmost")); group->AddObject(this->CreateString("-Wno-four-char-constants")); group->AddObject(this->CreateString("-Wno-unknown-pragmas")); + group->AddObject(this->CreateString("$(inherited)")); buildSettings->AddAttribute("WARNING_CFLAGS", group); } else diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx index 0a4f5c9..0a1d280 100644 --- a/Source/cmIncludeCommand.cxx +++ b/Source/cmIncludeCommand.cxx @@ -90,7 +90,7 @@ bool cmIncludeCommand } std::string fname_abs = - cmSystemTools::CollapseFullPath(fname.c_str(), + cmSystemTools::CollapseFullPath(fname, this->Makefile->GetStartDirectory()); cmGlobalGenerator *gg = this->Makefile->GetLocalGenerator() diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index ec500d9..c3c9c55 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -167,7 +167,7 @@ bool cmInstallCommand::HandleScriptMode(std::vector<std::string> const& args) script += "/"; script += args[i]; } - if(cmSystemTools::FileIsDirectory(script.c_str())) + if(cmSystemTools::FileIsDirectory(script)) { this->SetError("given a directory as value of SCRIPT argument."); return false; @@ -1111,7 +1111,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) // Make sure the name is a directory. if(cmSystemTools::FileExists(dir.c_str()) && - !cmSystemTools::FileIsDirectory(dir.c_str())) + !cmSystemTools::FileIsDirectory(dir)) { cmOStringStream e; e << args[0] << " given non-directory \"" @@ -1393,7 +1393,7 @@ bool cmInstallCommand::MakeFilesFullPath(const char* modeName, } // Make sure the file is not a directory. - if(gpos == file.npos && cmSystemTools::FileIsDirectory(file.c_str())) + if(gpos == file.npos && cmSystemTools::FileIsDirectory(file)) { cmOStringStream e; e << modeName << " given directory \"" << (*fileIt) << "\" to install."; diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 3fc5b69..1c39563 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -19,9 +19,6 @@ #include <cmsys/RegularExpression.hxx> -#ifdef __BORLANDC__ -# pragma warn -8060 /* possibly incorrect assignment */ -#endif //---------------------------------------------------------------------------- struct cmListFileParser diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 50e279b..69b56c6 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -221,19 +221,19 @@ void cmLocalGenerator::SetupPathConversions() std::string outdir; outdir = cmSystemTools::CollapseFullPath(this->Makefile->GetHomeDirectory()); - cmSystemTools::SplitPath(outdir.c_str(), this->HomeDirectoryComponents); + cmSystemTools::SplitPath(outdir, this->HomeDirectoryComponents); outdir = cmSystemTools::CollapseFullPath(this->Makefile->GetStartDirectory()); - cmSystemTools::SplitPath(outdir.c_str(), this->StartDirectoryComponents); + cmSystemTools::SplitPath(outdir, this->StartDirectoryComponents); outdir = cmSystemTools::CollapseFullPath (this->Makefile->GetHomeOutputDirectory()); - cmSystemTools::SplitPath(outdir.c_str(), + cmSystemTools::SplitPath(outdir, this->HomeOutputDirectoryComponents); outdir = cmSystemTools::CollapseFullPath (this->Makefile->GetStartOutputDirectory()); - cmSystemTools::SplitPath(outdir.c_str(), + cmSystemTools::SplitPath(outdir, this->StartOutputDirectoryComponents); } @@ -1247,7 +1247,7 @@ cmLocalGenerator::ConvertToOutputForExistingCommon(const std::string& remote, cmSystemTools::FileExists(remote.c_str())) { std::string tmp; - if(cmSystemTools::GetShortPath(remote.c_str(), tmp)) + if(cmSystemTools::GetShortPath(remote, tmp)) { return this->Convert(tmp, NONE, format, true); } @@ -1371,7 +1371,7 @@ std::string cmLocalGenerator::GetIncludeFlags( { std::string frameworkDir = *i; frameworkDir += "/../"; - frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir.c_str()); + frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir); if(emitted.insert(frameworkDir).second) { if (sysFwSearchFlag && target && @@ -1613,10 +1613,10 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs, { // Emit this directory only if it is a subdirectory of the // top-level source or binary tree. - if(cmSystemTools::ComparePath(i->c_str(), topSourceDir) || - cmSystemTools::ComparePath(i->c_str(), topBinaryDir) || - cmSystemTools::IsSubDirectory(i->c_str(), topSourceDir) || - cmSystemTools::IsSubDirectory(i->c_str(), topBinaryDir)) + if(cmSystemTools::ComparePath(*i, topSourceDir) || + cmSystemTools::ComparePath(*i, topBinaryDir) || + cmSystemTools::IsSubDirectory(*i, topSourceDir) || + cmSystemTools::IsSubDirectory(*i, topBinaryDir)) { if(emitted.insert(*i).second) { @@ -2109,11 +2109,11 @@ bool cmLocalGenerator::GetRealDependency(const std::string& inName, { tLocation = target->GetLocation(config); tLocation = cmSystemTools::GetFilenamePath(tLocation); - tLocation = cmSystemTools::CollapseFullPath(tLocation.c_str()); + tLocation = cmSystemTools::CollapseFullPath(tLocation); } std::string depLocation = cmSystemTools::GetFilenamePath( std::string(inName)); - depLocation = cmSystemTools::CollapseFullPath(depLocation.c_str()); + depLocation = cmSystemTools::CollapseFullPath(depLocation); if(depLocation != tLocation) { // it is a full path to a depend that has the same name @@ -2743,7 +2743,7 @@ std::string cmLocalGenerator::Convert(const std::string& source, result); break; case FULL: - result = cmSystemTools::CollapseFullPath(result.c_str()); + result = cmSystemTools::CollapseFullPath(result); break; case NONE: break; @@ -2807,7 +2807,7 @@ std::string cmLocalGenerator::Convert(RelativeRoot remote, if(!local.empty() && (!optional || this->UseRelativePaths)) { std::vector<std::string> components; - cmSystemTools::SplitPath(local.c_str(), components); + cmSystemTools::SplitPath(local, components); std::string result = this->ConvertToRelativePath(components, remotePath); return this->ConvertToOutputFormat(result, output); } @@ -2827,7 +2827,7 @@ std::string cmLocalGenerator::FindRelativePathTopSource() { std::string parentTop = parent->FindRelativePathTopSource(); if(cmSystemTools::IsSubDirectory( - this->Makefile->GetStartDirectory(), parentTop.c_str())) + this->Makefile->GetStartDirectory(), parentTop)) { return parentTop; } @@ -2847,7 +2847,7 @@ std::string cmLocalGenerator::FindRelativePathTopBinary() { std::string parentTop = parent->FindRelativePathTopBinary(); if(cmSystemTools::IsSubDirectory( - this->Makefile->GetStartOutputDirectory(), parentTop.c_str())) + this->Makefile->GetStartOutputDirectory(), parentTop)) { return parentTop; } @@ -2933,12 +2933,12 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector<std::string>& local, // Identify the longest shared path component between the remote // path and the local path. std::vector<std::string> remote; - cmSystemTools::SplitPath(in_remote.c_str(), remote); + cmSystemTools::SplitPath(in_remote, remote); unsigned int common=0; while(common < remote.size() && common < local.size() && - cmSystemTools::ComparePath(remote[common].c_str(), - local[common].c_str())) + cmSystemTools::ComparePath(remote[common], + local[common])) { ++common; } diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 398b55a..9225f64 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -352,7 +352,7 @@ void cmLocalNinjaGenerator::AppendCustomCommandDeps( i != deps.end(); ++i) { std::string dep; if (this->GetRealDependency(*i, this->GetConfigName(), dep)) - ninjaDeps.push_back(ConvertToNinjaPath(dep.c_str())); + ninjaDeps.push_back(ConvertToNinjaPath(dep)); } } diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h index 1d27224..01e16df 100644 --- a/Source/cmLocalNinjaGenerator.h +++ b/Source/cmLocalNinjaGenerator.h @@ -74,7 +74,7 @@ public: map_to_ninja_path(cmLocalNinjaGenerator *LocalGen) : LocalGenerator(LocalGen) {} std::string operator()(const std::string &path) { - return LocalGenerator->ConvertToNinjaPath(path.c_str()); + return LocalGenerator->ConvertToNinjaPath(path); } }; diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 23513fa..c18e027 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -700,7 +700,7 @@ cmLocalUnixMakefileGenerator3 // name. This is needed to avoid funny quoting problems on // lines with shell redirection operators. std::string scmd; - if(cmSystemTools::GetShortPath(cmd.c_str(), scmd)) + if(cmSystemTools::GetShortPath(cmd, scmd)) { return this->Convert(scmd, NONE, SHELL); } @@ -1733,7 +1733,7 @@ void cmLocalUnixMakefileGenerator3::CheckMultipleOutputs(bool verbose) << depender << "\" does not exist." << std::endl; cmSystemTools::Stdout(msg.str().c_str()); } - cmSystemTools::RemoveFile(dependee.c_str()); + cmSystemTools::RemoveFile(dependee); } } } @@ -1988,7 +1988,7 @@ void cmLocalUnixMakefileGenerator3::ClearDependencies(cmMakefile* mf, // Remove the internal dependency check file to force // regeneration. std::string internalDependFile = dir + "/depend.internal"; - cmSystemTools::RemoveFile(internalDependFile.c_str()); + cmSystemTools::RemoveFile(internalDependFile); } } diff --git a/Source/cmMakeDepend.cxx b/Source/cmMakeDepend.cxx index 52832db..1499e57 100644 --- a/Source/cmMakeDepend.cxx +++ b/Source/cmMakeDepend.cxx @@ -329,9 +329,9 @@ std::string cmMakeDepend::FullPath(const char* fname, const char *extraPath) } path = path + fname; if(cmSystemTools::FileExists(path.c_str(), true) - && !cmSystemTools::FileIsDirectory(path.c_str())) + && !cmSystemTools::FileIsDirectory(path)) { - std::string fp = cmSystemTools::CollapseFullPath(path.c_str()); + std::string fp = cmSystemTools::CollapseFullPath(path); this->DirectoryToFileToPathMap[extraPath? extraPath: ""][fname] = fp; return fp; } @@ -346,9 +346,9 @@ std::string cmMakeDepend::FullPath(const char* fname, const char *extraPath) } path = path + fname; if(cmSystemTools::FileExists(path.c_str(), true) - && !cmSystemTools::FileIsDirectory(path.c_str())) + && !cmSystemTools::FileIsDirectory(path)) { - std::string fp = cmSystemTools::CollapseFullPath(path.c_str()); + std::string fp = cmSystemTools::CollapseFullPath(path); this->DirectoryToFileToPathMap[extraPath][fname] = fp; return fp; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 0bd1624..8a8aadc 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1832,7 +1832,7 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, { if(!cmSystemTools::IsOff(files[cc].c_str())) { - files[cc] = cmSystemTools::CollapseFullPath(files[cc].c_str()); + files[cc] = cmSystemTools::CollapseFullPath(files[cc]); } if ( cc > 0 ) { @@ -1937,11 +1937,11 @@ void cmMakefile::CheckForUnused(const char* reason, bt.push_back(lfc); } if (this->CheckSystemVars || - cmSystemTools::IsSubDirectory(path.c_str(), + cmSystemTools::IsSubDirectory(path, this->GetHomeDirectory()) || - (cmSystemTools::IsSubDirectory(path.c_str(), + (cmSystemTools::IsSubDirectory(path, this->GetHomeOutputDirectory()) && - !cmSystemTools::IsSubDirectory(path.c_str(), + !cmSystemTools::IsSubDirectory(path, cmake::GetCMakeFilesDirectory()))) { cmOStringStream msg; @@ -2878,7 +2878,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew( bt.push_back(lfc); msg << "uninitialized variable \'" << lookup << "\'"; this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, - msg.str().c_str(), bt); + msg.str(), bt); } } } @@ -3556,7 +3556,7 @@ int cmMakefile::TryCompile(const std::string& srcdir, { this->Internal->IsSourceFileTryCompile = fast; // does the binary directory exist ? If not create it... - if (!cmSystemTools::FileIsDirectory(bindir.c_str())) + if (!cmSystemTools::FileIsDirectory(bindir)) { cmSystemTools::MakeDirectory(bindir.c_str()); } @@ -3564,7 +3564,7 @@ int cmMakefile::TryCompile(const std::string& srcdir, // change to the tests directory and run cmake // use the cmake object instead of calling cmake std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); - cmSystemTools::ChangeDirectory(bindir.c_str()); + cmSystemTools::ChangeDirectory(bindir); // make sure the same generator is used // use this program as the cmake to be run, it should not @@ -3579,7 +3579,7 @@ int cmMakefile::TryCompile(const std::string& srcdir, cmSystemTools::Error( "Internal CMake error, TryCompile bad GlobalGenerator"); // return to the original directory - cmSystemTools::ChangeDirectory(cwd.c_str()); + cmSystemTools::ChangeDirectory(cwd); this->Internal->IsSourceFileTryCompile = false; return 1; } @@ -3653,7 +3653,7 @@ int cmMakefile::TryCompile(const std::string& srcdir, cmSystemTools::Error( "Internal CMake error, TryCompile configure of cmake failed"); // return to the original directory - cmSystemTools::ChangeDirectory(cwd.c_str()); + cmSystemTools::ChangeDirectory(cwd); this->Internal->IsSourceFileTryCompile = false; return 1; } @@ -3663,7 +3663,7 @@ int cmMakefile::TryCompile(const std::string& srcdir, cmSystemTools::Error( "Internal CMake error, TryCompile generation of cmake failed"); // return to the original directory - cmSystemTools::ChangeDirectory(cwd.c_str()); + cmSystemTools::ChangeDirectory(cwd); this->Internal->IsSourceFileTryCompile = false; return 1; } @@ -3677,7 +3677,7 @@ int cmMakefile::TryCompile(const std::string& srcdir, output, this); - cmSystemTools::ChangeDirectory(cwd.c_str()); + cmSystemTools::ChangeDirectory(cwd); this->Internal->IsSourceFileTryCompile = false; return ret; } @@ -4036,7 +4036,7 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile, { cmSystemTools::SetPermissions(soutfile.c_str(), perm); } - cmSystemTools::RemoveFile(tempOutputFile.c_str()); + cmSystemTools::RemoveFile(tempOutputFile); } return res; } @@ -5208,7 +5208,7 @@ HaveCFeatureAvailable(cmTarget const* target, const std::string& feature) const cmOStringStream e; e << "The C_STANDARD property on target \"" << target->GetName() << "\" contained an invalid value: \"" << existingCStandard << "\"."; - this->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + this->IssueMessage(cmake::FATAL_ERROR, e.str()); return false; } @@ -5459,7 +5459,7 @@ AddRequiredTargetCFeature(cmTarget *target, const std::string& feature) const cmOStringStream e; e << "The C_STANDARD property on target \"" << target->GetName() << "\" contained an invalid value: \"" << existingCStandard << "\"."; - this->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + this->IssueMessage(cmake::FATAL_ERROR, e.str()); return false; } } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 164290a..824513b 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -466,7 +466,7 @@ public: this->cmStartDirectory = dir; cmSystemTools::ConvertToUnixSlashes(this->cmStartDirectory); this->cmStartDirectory = - cmSystemTools::CollapseFullPath(this->cmStartDirectory.c_str()); + cmSystemTools::CollapseFullPath(this->cmStartDirectory); this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR", this->cmStartDirectory.c_str()); } @@ -479,7 +479,7 @@ public: this->StartOutputDirectory = lib; cmSystemTools::ConvertToUnixSlashes(this->StartOutputDirectory); this->StartOutputDirectory = - cmSystemTools::CollapseFullPath(this->StartOutputDirectory.c_str()); + cmSystemTools::CollapseFullPath(this->StartOutputDirectory); cmSystemTools::MakeDirectory(this->StartOutputDirectory.c_str()); this->AddDefinition("CMAKE_CURRENT_BINARY_DIR", this->StartOutputDirectory.c_str()); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 1f8f686..1adcb8a 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1577,7 +1577,7 @@ std::string cmMakefileTargetGenerator::GetFrameworkFlags(std::string const& l) { std::string frameworkDir = *i; frameworkDir += "/../"; - frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir.c_str()); + frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir); emitted.insert(frameworkDir); } } diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index e344df4..0cc3e3b 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -375,14 +375,14 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() cmTarget& target = *this->GetTarget(); const std::string cfgName = this->GetConfigName(); std::string targetOutput = ConvertToNinjaPath( - target.GetFullPath(cfgName).c_str()); + target.GetFullPath(cfgName)); std::string targetOutputReal = ConvertToNinjaPath( target.GetFullPath(cfgName, /*implib=*/false, - /*realpath=*/true).c_str()); + /*realpath=*/true)); std::string targetOutputImplib = ConvertToNinjaPath( target.GetFullPath(cfgName, - /*implib=*/true).c_str()); + /*implib=*/true)); if (target.IsAppBundleOnApple()) { @@ -394,11 +394,11 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() targetOutput = outpath; targetOutput += "/"; targetOutput += this->TargetNameOut; - targetOutput = this->ConvertToNinjaPath(targetOutput.c_str()); + targetOutput = this->ConvertToNinjaPath(targetOutput); targetOutputReal = outpath; targetOutputReal += "/"; targetOutputReal += this->TargetNameReal; - targetOutputReal = this->ConvertToNinjaPath(targetOutputReal.c_str()); + targetOutputReal = this->ConvertToNinjaPath(targetOutputReal); } else if (target.IsFrameworkOnApple()) { @@ -531,7 +531,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() if (mf->IsOn("CMAKE_COMPILER_IS_MINGW")) { const std::string objPath = GetTarget()->GetSupportDirectory(); - vars["OBJECT_DIR"] = ConvertToNinjaPath(objPath.c_str()); + vars["OBJECT_DIR"] = ConvertToNinjaPath(objPath); EnsureDirectoryExists(objPath); // ar.exe can't handle backslashes in rsp files (implicitly used by gcc) std::string& linkLibraries = vars["LINK_LIBRARIES"]; diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 816e6d8..80213d8 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -277,7 +277,7 @@ std::string cmNinjaTargetGenerator ::GetSourceFilePath(cmSourceFile const* source) const { - return ConvertToNinjaPath(source->GetFullPath().c_str()); + return ConvertToNinjaPath(source->GetFullPath()); } std::string @@ -298,7 +298,7 @@ cmNinjaTargetGenerator std::string cmNinjaTargetGenerator::GetTargetOutputDir() const { std::string dir = this->Target->GetDirectory(this->GetConfigName()); - return ConvertToNinjaPath(dir.c_str()); + return ConvertToNinjaPath(dir); } std::string @@ -346,11 +346,11 @@ bool cmNinjaTargetGenerator::SetMsvcTargetPdbVariable(cmNinjaVars& vars) const } vars["TARGET_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat( - ConvertToNinjaPath(pdbPath.c_str()), + ConvertToNinjaPath(pdbPath), cmLocalGenerator::SHELL); vars["TARGET_COMPILE_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat( - ConvertToNinjaPath(compilePdbPath.c_str()), + ConvertToNinjaPath(compilePdbPath), cmLocalGenerator::SHELL); EnsureParentDirectoryExists(pdbPath); @@ -564,7 +564,7 @@ cmNinjaTargetGenerator std::string def = this->GeneratorTarget->GetModuleDefinitionFile(config); if(!def.empty()) { - this->ModuleDefinitionFile = this->ConvertToNinjaPath(def.c_str()); + this->ModuleDefinitionFile = this->ConvertToNinjaPath(def); } this->GetBuildFileStream() << "\n"; @@ -628,11 +628,11 @@ cmNinjaTargetGenerator std::string objectDir = this->Target->GetSupportDirectory(); vars["OBJECT_DIR"] = this->GetLocalGenerator()->ConvertToOutputFormat( - ConvertToNinjaPath(objectDir.c_str()), + ConvertToNinjaPath(objectDir), cmLocalGenerator::SHELL); std::string objectFileDir = cmSystemTools::GetFilenamePath(objectFileName); vars["OBJECT_FILE_DIR"] = this->GetLocalGenerator()->ConvertToOutputFormat( - ConvertToNinjaPath(objectFileDir.c_str()), + ConvertToNinjaPath(objectFileDir), cmLocalGenerator::SHELL); this->addPoolNinjaVariable("JOB_POOL_COMPILE", this->GetTarget(), vars); @@ -650,7 +650,7 @@ cmNinjaTargetGenerator if (!cmSystemTools::FileIsFullPath(sourceFileName.c_str())) { escapedSourceFileName = cmSystemTools::CollapseFullPath( - escapedSourceFileName.c_str(), + escapedSourceFileName, this->GetGlobalGenerator()->GetCMakeInstance()-> GetHomeOutputDirectory()); } @@ -754,7 +754,7 @@ void cmNinjaTargetGenerator ::EnsureParentDirectoryExists(const std::string& path) const { - EnsureDirectoryExists(cmSystemTools::GetParentDirectory(path.c_str())); + EnsureDirectoryExists(cmSystemTools::GetParentDirectory(path)); } @@ -775,14 +775,14 @@ cmNinjaTargetGenerator::MacOSXContentGeneratorType::operator()( // Get the input file location. std::string input = source.GetFullPath(); input = - this->Generator->GetLocalGenerator()->ConvertToNinjaPath(input.c_str()); + this->Generator->GetLocalGenerator()->ConvertToNinjaPath(input); // Get the output file location. std::string output = macdir; output += "/"; output += cmSystemTools::GetFilenameName(input); output = - this->Generator->GetLocalGenerator()->ConvertToNinjaPath(output.c_str()); + this->Generator->GetLocalGenerator()->ConvertToNinjaPath(output); // Write a build statement to copy the content into the bundle. this->Generator->GetGlobalGenerator()->WriteMacOSXContentBuild(input, diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx index 786e6e2..9a086ca 100644 --- a/Source/cmOSXBundleGenerator.cxx +++ b/Source/cmOSXBundleGenerator.cxx @@ -112,7 +112,7 @@ void cmOSXBundleGenerator::CreateFramework( oldName = frameworkVersion; newName = versions; newName += "/Current"; - cmSystemTools::RemoveFile(newName.c_str()); + cmSystemTools::RemoveFile(newName); cmSystemTools::CreateSymlink(oldName.c_str(), newName.c_str()); this->Makefile->AddCMakeOutputFile(newName); @@ -121,7 +121,7 @@ void cmOSXBundleGenerator::CreateFramework( oldName += name; newName = contentdir; newName += name; - cmSystemTools::RemoveFile(newName.c_str()); + cmSystemTools::RemoveFile(newName); cmSystemTools::CreateSymlink(oldName.c_str(), newName.c_str()); this->Makefile->AddCMakeOutputFile(newName); @@ -132,7 +132,7 @@ void cmOSXBundleGenerator::CreateFramework( oldName = "Versions/Current/Resources"; newName = contentdir; newName += "Resources"; - cmSystemTools::RemoveFile(newName.c_str()); + cmSystemTools::RemoveFile(newName); cmSystemTools::CreateSymlink(oldName.c_str(), newName.c_str()); this->Makefile->AddCMakeOutputFile(newName); } @@ -144,7 +144,7 @@ void cmOSXBundleGenerator::CreateFramework( oldName = "Versions/Current/Headers"; newName = contentdir; newName += "Headers"; - cmSystemTools::RemoveFile(newName.c_str()); + cmSystemTools::RemoveFile(newName); cmSystemTools::CreateSymlink(oldName.c_str(), newName.c_str()); this->Makefile->AddCMakeOutputFile(newName); } @@ -156,7 +156,7 @@ void cmOSXBundleGenerator::CreateFramework( oldName = "Versions/Current/PrivateHeaders"; newName = contentdir; newName += "PrivateHeaders"; - cmSystemTools::RemoveFile(newName.c_str()); + cmSystemTools::RemoveFile(newName); cmSystemTools::CreateSymlink(oldName.c_str(), newName.c_str()); this->Makefile->AddCMakeOutputFile(newName); } diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx index 007364c..3cdd2f6 100644 --- a/Source/cmOrderDirectories.cxx +++ b/Source/cmOrderDirectories.cxx @@ -140,7 +140,7 @@ bool cmOrderDirectoriesConstraint::FileMayConflict(std::string const& dir, { // The file conflicts only if it is not the same as the original // file due to a symlink or hardlink. - return !cmSystemTools::SameFile(this->FullPath.c_str(), file.c_str()); + return !cmSystemTools::SameFile(this->FullPath, file); } // Check if the file will be built by cmake. diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 93ebde6..929cbc0 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -166,6 +166,112 @@ static std::string getAutogenTargetDir(cmTarget const* target) return targetDir; } +std::string cmQtAutoGenerators::ListQt5RccInputs(cmSourceFile* sf, + cmTarget const* target, + std::vector<std::string>& depends) +{ + std::string rccCommand = this->GetRccExecutable(target); + std::vector<std::string> qrcEntries; + + std::vector<std::string> command; + command.push_back(rccCommand); + command.push_back("--list"); + + std::string absFile = cmsys::SystemTools::GetRealPath( + sf->GetFullPath().c_str()); + + command.push_back(absFile); + + std::string output; + int retVal = 0; + bool result = cmSystemTools::RunSingleCommand(command, &output, + &retVal, 0, + cmSystemTools::OUTPUT_NONE); + if (!result || retVal) + { + std::cerr << "AUTOGEN: error: Rcc list process for " << sf->GetFullPath() + << " failed:\n" << output << std::endl; + return std::string(); + } + + std::istringstream ostr(output); + std::string oline; + while(std::getline(ostr, oline)) + { + if (oline.empty()) + { + // The output of rcc --list contains many empty lines. + continue; + } + if (cmHasLiteralPrefix(oline, "RCC: Error in")) + { + static std::string searchString = "Cannot find file '"; + + std::string::size_type pos = oline.find(searchString); + if (pos == std::string::npos) + { + std::cerr << "AUTOGEN: error: Rcc lists unparsable output " + << oline << std::endl; + return std::string(); + } + pos += searchString.length(); + std::string::size_type sz = oline.size() - pos - 1; + qrcEntries.push_back(oline.substr(pos, sz)); + } + else + { + qrcEntries.push_back(oline); + } + } + depends.insert(depends.end(), qrcEntries.begin(), qrcEntries.end()); + std::string entriesList; + const char* sep = ""; + for(std::vector<std::string>::const_iterator it = qrcEntries.begin(); + it != qrcEntries.end(); ++it) + { + entriesList += sep; + entriesList += *it; + sep = "@list_sep@"; + } + return entriesList; +} + +std::string cmQtAutoGenerators::ListQt4RccInputs(cmSourceFile* sf, + std::vector<std::string>& depends) +{ + const std::string qrcContents = ReadAll(sf->GetFullPath()); + + cmsys::RegularExpression fileMatchRegex("(<file[^<]+)"); + + std::string entriesList; + const char* sep = ""; + + size_t offset = 0; + while (fileMatchRegex.find(qrcContents.c_str() + offset)) + { + std::string qrcEntry = fileMatchRegex.match(1); + + offset += qrcEntry.size(); + + cmsys::RegularExpression fileReplaceRegex("(^<file[^>]*>)"); + fileReplaceRegex.find(qrcEntry); + std::string tag = fileReplaceRegex.match(1); + + qrcEntry = qrcEntry.substr(tag.size()); + + if (!cmSystemTools::FileIsFullPath(qrcEntry.c_str())) + { + qrcEntry = sf->GetLocation().GetDirectory() + "/" + qrcEntry; + } + + entriesList += sep; + entriesList += qrcEntry; + sep = "@list_sep@"; + depends.push_back(qrcEntry); + } + return entriesList; +} + bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) { cmMakefile* makefile = target->GetMakefile(); @@ -271,6 +377,61 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) } } } +#endif + + std::vector<std::string> rcc_output; + if(makefile->GetLocalGenerator()->GetGlobalGenerator()->GetName() == "Ninja" +#if defined(_WIN32) && !defined(__CYGWIN__) + || usePRE_BUILD +#endif + ) + { + std::vector<cmSourceFile*> srcFiles; + target->GetConfigCommonSourceFiles(srcFiles); + for(std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin(); + fileIt != srcFiles.end(); + ++fileIt) + { + cmSourceFile* sf = *fileIt; + std::string absFile = cmsys::SystemTools::GetRealPath( + sf->GetFullPath().c_str()); + + std::string ext = sf->GetExtension(); + + if (target->GetPropertyAsBool("AUTORCC")) + { + if (ext == "qrc" + && !cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTORCC"))) + { + std::string basename = cmsys::SystemTools:: + GetFilenameWithoutLastExtension(absFile); + + std::string rcc_output_dir = target->GetSupportDirectory(); + cmSystemTools::MakeDirectory(rcc_output_dir.c_str()); + std::string rcc_output_file = rcc_output_dir; + rcc_output_file += "/qrc_" + basename + ".cpp"; + rcc_output.push_back(rcc_output_file); + + if (!cmSystemTools::IsOn(sf->GetPropertyForUser("GENERATED"))) + { + if (qtMajorVersion == "5") + { + this->ListQt5RccInputs(sf, target, depends); + } + else + { + this->ListQt4RccInputs(sf, depends); + } +#if defined(_WIN32) && !defined(__CYGWIN__) + usePRE_BUILD = false; +#endif + } + } + } + } + } + +#if defined(_WIN32) && !defined(__CYGWIN__) if(usePRE_BUILD) { // Add the pre-build command directly to bypass the OBJECT_LIBRARY @@ -287,10 +448,29 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) else #endif { - cmTarget* autogenTarget = makefile->AddUtilityCommand( + cmTarget* autogenTarget = 0; + if (!rcc_output.empty()) + { + makefile->AddCustomCommandToOutput(rcc_output, depends, "", + commandLines, 0, + workingDirectory.c_str(), + false, false); + + cmCustomCommandLines no_commands; + autogenTarget = makefile->AddUtilityCommand( + autogenTargetName, true, + workingDirectory.c_str(), rcc_output, + no_commands, false, autogenComment.c_str()); + + } + else + { + autogenTarget = makefile->AddUtilityCommand( autogenTargetName, true, workingDirectory.c_str(), depends, commandLines, false, autogenComment.c_str()); + } + // Set target folder const char* autogenFolder = makefile->GetCMakeInstance()->GetProperty( "AUTOMOC_TARGETS_FOLDER"); @@ -418,6 +598,8 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target) inputFile += "/Modules/AutogenInfo.cmake.in"; std::string outputFile = targetDir; outputFile += "/AutogenInfo.cmake"; + makefile->AddDefinition("_qt_rcc_inputs", + makefile->GetDefinition("_qt_rcc_inputs_" + target->GetName())); makefile->ConfigureFile(inputFile.c_str(), outputFile.c_str(), false, true, false); @@ -488,7 +670,7 @@ void cmQtAutoGenerators::SetupSourceFiles(cmTarget const* target) { cmSourceFile* sf = *fileIt; std::string absFile = cmsys::SystemTools::GetRealPath( - sf->GetFullPath().c_str()); + sf->GetFullPath()); bool skipMoc = cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTOMOC")); bool generated = cmSystemTools::IsOn(sf->GetPropertyForUser("GENERATED")); @@ -766,7 +948,7 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, { cmSourceFile* sf = *fileIt; std::string absFile = cmsys::SystemTools::GetRealPath( - sf->GetFullPath().c_str()); + sf->GetFullPath()); if (!skipped.insert(absFile).second) { @@ -869,9 +1051,12 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target) std::vector<cmSourceFile*> srcFiles; target->GetConfigCommonSourceFiles(srcFiles); + std::string qrcInputs; + const char* qrcInputsSep = ""; + std::string rccFileFiles; std::string rccFileOptions; - const char *sep = ""; + const char *optionSep = ""; const char *qtVersion = makefile->GetDefinition("_target_qt_version"); @@ -880,6 +1065,11 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target) { cmSystemTools::ExpandListArgument(opts, rccOptions); } + std::string qtMajorVersion = makefile->GetSafeDefinition("QT_VERSION_MAJOR"); + if (qtMajorVersion == "") + { + qtMajorVersion = makefile->GetSafeDefinition("Qt5Core_VERSION_MAJOR"); + } for(std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin(); fileIt != srcFiles.end(); @@ -890,7 +1080,7 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target) if (ext == "qrc") { std::string absFile = cmsys::SystemTools::GetRealPath( - sf->GetFullPath().c_str()); + sf->GetFullPath()); bool skip = cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTORCC")); if (!skip) @@ -909,9 +1099,9 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target) if (!rccOptions.empty()) { - rccFileFiles += sep; + rccFileFiles += optionSep; rccFileFiles += absFile; - rccFileOptions += sep; + rccFileOptions += optionSep; } const char *listSep = ""; for(std::vector<std::string>::const_iterator it = rccOptions.begin(); @@ -922,10 +1112,34 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target) rccFileOptions += *it; listSep = "@list_sep@"; } - sep = ";"; + optionSep = ";"; + + std::vector<std::string> depends; + + std::string entriesList; + if (!cmSystemTools::IsOn(sf->GetPropertyForUser("GENERATED"))) + { + if (qtMajorVersion == "5") + { + entriesList = this->ListQt5RccInputs(sf, target, depends); + } + else + { + entriesList = this->ListQt4RccInputs(sf, depends); + } + if (entriesList.empty()) + { + return; + } + } + qrcInputs += qrcInputsSep; + qrcInputs += entriesList; + qrcInputsSep = ";"; } } } + makefile->AddDefinition("_qt_rcc_inputs_" + target->GetName(), + cmLocalGenerator::EscapeForCMake(qrcInputs).c_str()); makefile->AddDefinition("_rcc_files", cmLocalGenerator::EscapeForCMake(_rcc_files).c_str()); @@ -935,6 +1149,29 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target) makefile->AddDefinition("_qt_rcc_options_options", cmLocalGenerator::EscapeForCMake(rccFileOptions).c_str()); + makefile->AddDefinition("_qt_rcc_executable", + this->GetRccExecutable(target).c_str()); +} + +std::string cmQtAutoGenerators::GetRccExecutable(cmTarget const* target) +{ + cmMakefile *makefile = target->GetMakefile(); + const char *qtVersion = makefile->GetDefinition("_target_qt_version"); + if (!qtVersion) + { + qtVersion = makefile->GetDefinition("Qt5Core_VERSION_MAJOR"); + if (!qtVersion) + { + qtVersion = makefile->GetDefinition("QT_VERSION_MAJOR"); + } + if (const char *targetQtVersion = + target->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION", + "")) + { + qtVersion = targetQtVersion; + } + } + std::string targetName = target->GetName(); if (strcmp(qtVersion, "5") == 0) { @@ -943,9 +1180,9 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target) { cmSystemTools::Error("Qt5::rcc target not found ", targetName.c_str()); - return; + return std::string(); } - makefile->AddDefinition("_qt_rcc_executable", qt5Rcc->GetLocation("")); + return qt5Rcc->GetLocation(""); } else if (strcmp(qtVersion, "4") == 0) { @@ -954,15 +1191,14 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target) { cmSystemTools::Error("Qt4::rcc target not found ", targetName.c_str()); - return; + return std::string(); } - makefile->AddDefinition("_qt_rcc_executable", qt4Rcc->GetLocation("")); - } - else - { - cmSystemTools::Error("The CMAKE_AUTORCC feature supports only Qt 4 and " - "Qt 5 ", targetName.c_str()); + return qt4Rcc->GetLocation(""); } + + cmSystemTools::Error("The CMAKE_AUTORCC feature supports only Qt 4 and " + "Qt 5 ", targetName.c_str()); + return std::string(); } static cmGlobalGenerator* CreateGlobalGenerator(cmake* cm, @@ -1013,7 +1249,7 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(cmMakefile* makefile, const std::string& config) { std::string filename( - cmSystemTools::CollapseFullPath(targetDirectory.c_str())); + cmSystemTools::CollapseFullPath(targetDirectory)); cmSystemTools::ConvertToUnixSlashes(filename); filename += "/AutogenInfo.cmake"; @@ -1030,7 +1266,10 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(cmMakefile* makefile, "AM_Qt5Core_VERSION_MAJOR"); } this->Sources = makefile->GetSafeDefinition("AM_SOURCES"); - this->RccSources = makefile->GetSafeDefinition("AM_RCC_SOURCES"); + { + std::string rccSources = makefile->GetSafeDefinition("AM_RCC_SOURCES"); + cmSystemTools::ExpandListArgument(rccSources, this->RccSources); + } this->SkipMoc = makefile->GetSafeDefinition("AM_SKIP_MOC"); this->SkipUic = makefile->GetSafeDefinition("AM_SKIP_UIC"); this->Headers = makefile->GetSafeDefinition("AM_HEADERS"); @@ -1128,6 +1367,28 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(cmMakefile* makefile, cmSystemTools::ReplaceString(*optionIt, "@list_sep@", ";"); this->RccOptions[*fileIt] = *optionIt; } + + const char *rccInputs = makefile->GetSafeDefinition("AM_RCC_INPUTS"); + std::vector<std::string> rccInputLists; + cmSystemTools::ExpandListArgument(rccInputs, rccInputLists); + + if (this->RccSources.size() != rccInputLists.size()) + { + cmSystemTools::Error("Error processing file: ", filename.c_str()); + return false; + } + + for (std::vector<std::string>::iterator fileIt = this->RccSources.begin(), + inputIt = rccInputLists.begin(); + fileIt != this->RccSources.end(); + ++fileIt, ++inputIt) + { + cmSystemTools::ReplaceString(*inputIt, "@list_sep@", ";"); + std::vector<std::string> rccInputFiles; + cmSystemTools::ExpandListArgument(*inputIt, rccInputFiles); + + this->RccInputs[*fileIt] = rccInputFiles; + } } this->CurrentCompileSettingsStr = this->MakeCompileSettingsString(makefile); @@ -1158,7 +1419,7 @@ bool cmQtAutoGenerators::ReadOldMocDefinitionsFile(cmMakefile* makefile, const std::string& targetDirectory) { std::string filename( - cmSystemTools::CollapseFullPath(targetDirectory.c_str())); + cmSystemTools::CollapseFullPath(targetDirectory)); cmSystemTools::ConvertToUnixSlashes(filename); filename += "/AutomocOldMocDefinitions.cmake"; @@ -1176,7 +1437,7 @@ cmQtAutoGenerators::WriteOldMocDefinitionsFile( const std::string& targetDirectory) { std::string filename( - cmSystemTools::CollapseFullPath(targetDirectory.c_str())); + cmSystemTools::CollapseFullPath(targetDirectory)); cmSystemTools::ConvertToUnixSlashes(filename); filename += "/AutomocOldMocDefinitions.cmake"; @@ -1222,7 +1483,7 @@ void cmQtAutoGenerators::Init() { // Go up twice to get to the framework root std::vector<std::string> pathComponents; - cmsys::SystemTools::SplitPath(path.c_str(), pathComponents); + cmsys::SystemTools::SplitPath(path, pathComponents); std::string frameworkPath =cmsys::SystemTools::JoinPath( pathComponents.begin(), pathComponents.end() - 2); frameworkPaths.insert(frameworkPath); @@ -1484,7 +1745,7 @@ void cmQtAutoGenerators::ParseCppFile(const std::string& absFilename, } const std::string absPath = cmsys::SystemTools::GetFilenamePath( - cmsys::SystemTools::GetRealPath(absFilename.c_str())) + '/'; + cmsys::SystemTools::GetRealPath(absFilename)) + '/'; const std::string scannedFileBasename = cmsys::SystemTools:: GetFilenameWithoutLastExtension(absFilename); std::string macroName; @@ -1672,7 +1933,7 @@ void cmQtAutoGenerators::StrictParseCppFile(const std::string& absFilename, } const std::string absPath = cmsys::SystemTools::GetFilenamePath( - cmsys::SystemTools::GetRealPath(absFilename.c_str())) + '/'; + cmsys::SystemTools::GetRealPath(absFilename)) + '/'; const std::string scannedFileBasename = cmsys::SystemTools:: GetFilenameWithoutLastExtension(absFilename); @@ -1802,7 +2063,7 @@ void cmQtAutoGenerators::ParseForUic(const std::string& absFilename, std::string::size_type matchOffset = 0; const std::string realName = - cmsys::SystemTools::GetRealPath(absFilename.c_str()); + cmsys::SystemTools::GetRealPath(absFilename); matchOffset = 0; if ((strstr(contentsString.c_str(), "ui_") != NULL) @@ -1836,7 +2097,7 @@ cmQtAutoGenerators::SearchHeadersForCppFile(const std::string& absFilename, const std::string basename = cmsys::SystemTools::GetFilenameWithoutLastExtension(absFilename); const std::string absPath = cmsys::SystemTools::GetFilenamePath( - cmsys::SystemTools::GetRealPath(absFilename.c_str())) + '/'; + cmsys::SystemTools::GetRealPath(absFilename)) + '/'; for(std::vector<std::string>::const_iterator ext = headerExtensions.begin(); ext != headerExtensions.end(); @@ -1904,8 +2165,8 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile, { const std::string mocFilePath = this->Builddir + mocFileName; int sourceNewerThanMoc = 0; - bool success = cmsys::SystemTools::FileTimeCompare(sourceFile.c_str(), - mocFilePath.c_str(), + bool success = cmsys::SystemTools::FileTimeCompare(sourceFile, + mocFilePath, &sourceNewerThanMoc); if (this->GenerateAll || !success || sourceNewerThanMoc >= 0) { @@ -1968,7 +2229,7 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile, std::cerr << "AUTOGEN: error: process for " << mocFilePath <<" failed:\n" << output << std::endl; this->RunMocFailed = true; - cmSystemTools::RemoveFile(mocFilePath.c_str()); + cmSystemTools::RemoveFile(mocFilePath); } return true; } @@ -1984,14 +2245,14 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& realName, } const std::string path = cmsys::SystemTools::GetFilenamePath( - realName.c_str()) + '/'; + realName) + '/'; std::string ui_output_file = "ui_" + uiFileName + ".h"; std::string ui_input_file = path + uiFileName + ".ui"; int sourceNewerThanUi = 0; - bool success = cmsys::SystemTools::FileTimeCompare(ui_input_file.c_str(), - (this->Builddir + ui_output_file).c_str(), + bool success = cmsys::SystemTools::FileTimeCompare(ui_input_file, + this->Builddir + ui_output_file, &sourceNewerThanUi); if (this->GenerateAll || !success || sourceNewerThanUi >= 0) { @@ -2042,7 +2303,7 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& realName, std::cerr << "AUTOUIC: error: process for " << ui_output_file << " failed:\n" << output << std::endl; this->RunUicFailed = true; - cmSystemTools::RemoveFile(ui_output_file.c_str()); + cmSystemTools::RemoveFile(ui_output_file); return false; } return true; @@ -2050,13 +2311,29 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& realName, return false; } -bool cmQtAutoGenerators::GenerateQrc() +bool cmQtAutoGenerators::InputFilesNewerThanQrc(const std::string& qrcFile, + const std::string& rccOutput) { - std::vector<std::string> sourceFiles; - cmSystemTools::ExpandListArgument(this->RccSources, sourceFiles); + std::vector<std::string> const& files = this->RccInputs[qrcFile]; + for (std::vector<std::string>::const_iterator it = files.begin(); + it != files.end(); ++it) + { + int inputNewerThanQrc = 0; + bool success = cmsys::SystemTools::FileTimeCompare(it->c_str(), + rccOutput.c_str(), + &inputNewerThanQrc); + if (!success || inputNewerThanQrc >= 0) + { + return true; + } + } + return false; +} - for(std::vector<std::string>::const_iterator si = sourceFiles.begin(); - si != sourceFiles.end(); ++si) +bool cmQtAutoGenerators::GenerateQrc() +{ + for(std::vector<std::string>::const_iterator si = this->RccSources.begin(); + si != this->RccSources.end(); ++si) { std::string ext = cmsys::SystemTools::GetFilenameLastExtension(*si); @@ -2075,10 +2352,14 @@ bool cmQtAutoGenerators::GenerateQrc() + ".dir/qrc_" + basename + ".cpp"; int sourceNewerThanQrc = 0; - bool success = cmsys::SystemTools::FileTimeCompare(si->c_str(), + bool generateQrc = !cmsys::SystemTools::FileTimeCompare(*si, rcc_output_file.c_str(), &sourceNewerThanQrc); - if (this->GenerateAll || !success || sourceNewerThanQrc >= 0) + generateQrc = generateQrc || (sourceNewerThanQrc >= 0); + generateQrc = generateQrc || this->InputFilesNewerThanQrc(*si, + rcc_output_file); + + if (this->GenerateAll || generateQrc) { std::map<std::string, std::string>::const_iterator optionIt = this->RccOptions.find(*si); @@ -2118,7 +2399,7 @@ bool cmQtAutoGenerators::GenerateQrc() std::cerr << "AUTORCC: error: process for " << rcc_output_file << " failed:\n" << output << std::endl; this->RunRccFailed = true; - cmSystemTools::RemoveFile(rcc_output_file.c_str()); + cmSystemTools::RemoveFile(rcc_output_file); return false; } } diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h index c298f5d..79fa5df 100644 --- a/Source/cmQtAutoGenerators.h +++ b/Source/cmQtAutoGenerators.h @@ -86,9 +86,20 @@ private: void MergeRccOptions(std::vector<std::string> &opts, const std::vector<std::string> &fileOpts, bool isQt5); + std::string GetRccExecutable(cmTarget const* target); + + std::string ListQt5RccInputs(cmSourceFile* sf, cmTarget const* target, + std::vector<std::string>& depends); + + std::string ListQt4RccInputs(cmSourceFile* sf, + std::vector<std::string>& depends); + + bool InputFilesNewerThanQrc(const std::string& qrcFile, + const std::string& rccOutput); + std::string QtMajorVersion; std::string Sources; - std::string RccSources; + std::vector<std::string> RccSources; std::string SkipMoc; std::string SkipUic; std::string Headers; @@ -116,6 +127,7 @@ private: std::vector<std::string> UicTargetOptions; std::map<std::string, std::string> UicOptions; std::map<std::string, std::string> RccOptions; + std::map<std::string, std::vector<std::string> > RccInputs; bool Verbose; bool ColorOutput; diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx index c624d17..653d764 100644 --- a/Source/cmSetPropertyCommand.cxx +++ b/Source/cmSetPropertyCommand.cxx @@ -204,7 +204,7 @@ bool cmSetPropertyCommand::HandleDirectoryMode() } // The local generators are associated with collapsed paths. - dir = cmSystemTools::CollapseFullPath(dir.c_str()); + dir = cmSystemTools::CollapseFullPath(dir); // Lookup the generator. if(cmLocalGenerator* lg = diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index b833d3f..6fe5c62 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -179,7 +179,7 @@ bool cmSourceFile::FindFullPath(std::string* error) tryPath += "/"; } tryPath += this->Location.GetName(); - tryPath = cmSystemTools::CollapseFullPath(tryPath.c_str(), *di); + tryPath = cmSystemTools::CollapseFullPath(tryPath, *di); if(this->TryFullPath(tryPath, "")) { return true; diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx index 1c2454e..efc4376 100644 --- a/Source/cmSourceFileLocation.cxx +++ b/Source/cmSourceFileLocation.cxx @@ -63,7 +63,7 @@ cmSourceFileLocation if (cmSystemTools::FileIsFullPath(this->Directory.c_str())) { this->Directory - = cmSystemTools::CollapseFullPath(this->Directory.c_str()); + = cmSystemTools::CollapseFullPath(this->Directory); } this->Name = cmSystemTools::GetFilenameName(name); this->UpdateExtension(name); @@ -92,7 +92,7 @@ void cmSourceFileLocation::DirectoryUseSource() { this->Directory = cmSystemTools::CollapseFullPath( - this->Directory.c_str(), this->Makefile->GetCurrentDirectory()); + this->Directory, this->Makefile->GetCurrentDirectory()); this->AmbiguousDirectory = false; } } @@ -105,7 +105,7 @@ void cmSourceFileLocation::DirectoryUseBinary() { this->Directory = cmSystemTools::CollapseFullPath( - this->Directory.c_str(), this->Makefile->GetCurrentOutputDirectory()); + this->Directory, this->Makefile->GetCurrentOutputDirectory()); this->AmbiguousDirectory = false; } } @@ -280,10 +280,10 @@ bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc) // Compare possible directory combinations. std::string const& srcDir = cmSystemTools::CollapseFullPath( - this->Directory.c_str(), this->Makefile->GetCurrentDirectory()); + this->Directory, this->Makefile->GetCurrentDirectory()); std::string const& binDir = cmSystemTools::CollapseFullPath( - this->Directory.c_str(), this->Makefile->GetCurrentOutputDirectory()); + this->Directory, this->Makefile->GetCurrentOutputDirectory()); if(srcDir != loc.Directory && binDir != loc.Directory) { @@ -295,10 +295,10 @@ bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc) // Compare possible directory combinations. std::string const& srcDir = cmSystemTools::CollapseFullPath( - loc.Directory.c_str(), loc.Makefile->GetCurrentDirectory()); + loc.Directory, loc.Makefile->GetCurrentDirectory()); std::string const& binDir = cmSystemTools::CollapseFullPath( - loc.Directory.c_str(), loc.Makefile->GetCurrentOutputDirectory()); + loc.Directory, loc.Makefile->GetCurrentOutputDirectory()); if(srcDir != this->Directory && binDir != this->Directory) { diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h index 8baf7b3..ffabd7a 100644 --- a/Source/cmStandardIncludes.h +++ b/Source/cmStandardIncludes.h @@ -28,12 +28,6 @@ #define CMAKE_NO_ANSI_FOR_SCOPE #endif -#ifdef __BORLANDC__ -# pragma warn -8030 /* Temporary used for parameter */ -# pragma warn -8027 /* 'for' not inlined. */ -# pragma warn -8026 /* 'exception' not inlined. */ -# pragma warn -8004 /* value never used */ -#endif #ifdef __ICL #pragma warning ( disable : 985 ) @@ -78,10 +72,6 @@ public: #if defined(_MSC_VER) # pragma warning (push,1) #endif -#if defined(__BORLANDC__) -# pragma warn -8008 /* condition is always false (RESET BELOW!) */ -# pragma warn -8066 /* unreachable code (RESET BELOW!) */ -#endif #ifndef CMAKE_NO_ANSI_STREAM_HEADERS # include <fstream> @@ -112,10 +102,6 @@ public: #include <set> #include <deque> -#if defined(__BORLANDC__) -# pragma warn .8008 /* condition is always false (disabled above) */ -# pragma warn .8066 /* unreachable code (disabled above) */ -#endif #if defined(_MSC_VER) # pragma warning(pop) #endif @@ -134,10 +120,6 @@ public: // include blockers are put in place that prevent including the // C-style versions from ever including the sub-headers. Therefore we // have to include the sub-headers here to get the using declarations. -#if defined(__BORLANDC__) -# include <mem.h> /* mem... functions from string.h */ -# include <search.h> /* search functions from stdlib.h */ -#endif #if !defined(_WIN32) && defined(__COMO__) @@ -412,8 +394,7 @@ inline bool cmHasLiteralSuffixImpl(const char* str1, } #if defined(_MSC_VER) && _MSC_VER < 1300 \ - || defined(__GNUC__) && __GNUC__ < 3 \ - || defined(__BORLANDC__) + || defined(__GNUC__) && __GNUC__ < 3 #define cmArrayBegin(a) a #define cmArraySize(a) (sizeof(a)/sizeof(*a)) diff --git a/Source/cmStandardLexer.h b/Source/cmStandardLexer.h index acd636c..981e03e 100644 --- a/Source/cmStandardLexer.h +++ b/Source/cmStandardLexer.h @@ -25,25 +25,6 @@ # pragma warning ( disable : 4786 ) #endif -#if defined(__BORLANDC__) -# pragma warn -8008 /* condition always returns true */ -# pragma warn -8066 /* unreachable code */ -#endif - -/* Borland system header defines these macros without first undef-ing them. */ -#if defined(__BORLANDC__) && __BORLANDC__ >= 0x580 -# undef INT8_MIN -# undef INT16_MIN -# undef INT32_MIN -# undef INT8_MAX -# undef INT16_MAX -# undef INT32_MAX -# undef UINT8_MAX -# undef UINT16_MAX -# undef UINT32_MAX -# include <stdint.h> -#endif - /* Make sure SGI termios does not define ECHO differently. */ #if defined(__sgi) && !defined(__GNUC__) # include <sys/termios.h> diff --git a/Source/cmSubdirCommand.cxx b/Source/cmSubdirCommand.cxx index cdde916..93ad4f3 100644 --- a/Source/cmSubdirCommand.cxx +++ b/Source/cmSubdirCommand.cxx @@ -42,7 +42,7 @@ bool cmSubdirCommand std::string srcPath = std::string(this->Makefile->GetCurrentDirectory()) + "/" + i->c_str(); - if (cmSystemTools::FileIsDirectory(srcPath.c_str())) + if (cmSystemTools::FileIsDirectory(srcPath)) { std::string binPath = std::string(this->Makefile->GetCurrentOutputDirectory()) + @@ -51,7 +51,7 @@ bool cmSubdirCommand excludeFromAll, preorder, false); } // otherwise it is a full path - else if ( cmSystemTools::FileIsDirectory(i->c_str()) ) + else if ( cmSystemTools::FileIsDirectory(*i) ) { // we must compute the binPath from the srcPath, we just take the last // element from the source path and use that diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index fbb4416..3247f7f 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -52,8 +52,7 @@ #include <sys/stat.h> #if defined(_WIN32) && \ - (defined(_MSC_VER) || defined(__WATCOMC__) || \ - defined(__BORLANDC__) || defined(__MINGW32__)) + (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__MINGW32__)) # include <io.h> #endif @@ -97,7 +96,7 @@ cm_archive_entry_pathname(struct archive_entry *entry) { #if cmsys_STL_HAS_WSTRING return cmsys::Encoding::ToNarrow( - archive_entry_pathname_w(entry)).c_str(); + archive_entry_pathname_w(entry)); #else return archive_entry_pathname(entry); #endif @@ -881,7 +880,7 @@ std::string cmSystemTools::FileExistsInParentDirectories(const char* fname, break; } prevDir = dir; - dir = cmSystemTools::GetParentDirectory(dir.c_str()); + dir = cmSystemTools::GetParentDirectory(dir); } return ""; } @@ -1014,7 +1013,7 @@ void cmSystemTools::Glob(const std::string& directory, cmsys::Directory d; cmsys::RegularExpression reg(regexp.c_str()); - if (d.Load(directory.c_str())) + if (d.Load(directory)) { size_t numf; unsigned int i; @@ -1044,7 +1043,7 @@ void cmSystemTools::GlobDirs(const std::string& path, std::string finishPath = path.substr(pos+2); cmsys::Directory d; - if (d.Load(startPath.c_str())) + if (d.Load(startPath)) { for (unsigned int i = 0; i < d.GetNumberOfFiles(); ++i) { @@ -1054,7 +1053,7 @@ void cmSystemTools::GlobDirs(const std::string& path, std::string fname = startPath; fname +="/"; fname += d.GetFile(i); - if(cmSystemTools::FileIsDirectory(fname.c_str())) + if(cmSystemTools::FileIsDirectory(fname)) { fname += finishPath; cmSystemTools::GlobDirs(fname, files); @@ -1168,7 +1167,7 @@ bool cmSystemTools::SimpleGlob(const std::string& glob, bool res = false; cmsys::Directory d; - if (d.Load(path.c_str())) + if (d.Load(path)) { for (unsigned int i = 0; i < d.GetNumberOfFiles(); ++i) { @@ -1182,11 +1181,11 @@ bool cmSystemTools::SimpleGlob(const std::string& glob, } fname += d.GetFile(i); std::string sfname = d.GetFile(i); - if ( type > 0 && cmSystemTools::FileIsDirectory(fname.c_str()) ) + if ( type > 0 && cmSystemTools::FileIsDirectory(fname) ) { continue; } - if ( type < 0 && !cmSystemTools::FileIsDirectory(fname.c_str()) ) + if ( type < 0 && !cmSystemTools::FileIsDirectory(fname) ) { continue; } @@ -1354,8 +1353,8 @@ std::string cmSystemTools::CollapseCombinedPath(std::string const& dir, std::vector<std::string> dirComponents; std::vector<std::string> fileComponents; - cmSystemTools::SplitPath(dir.c_str(), dirComponents); - cmSystemTools::SplitPath(file.c_str(), fileComponents); + cmSystemTools::SplitPath(dir, dirComponents); + cmSystemTools::SplitPath(file, fileComponents); if(fileComponents.empty()) { @@ -1649,9 +1648,6 @@ namespace{ fprintf(out, " -> %s", archive_entry_symlink(entry)); } } -#ifdef __BORLANDC__ -# pragma warn -8066 /* unreachable code */ -#endif long copy_data(struct archive *ar, struct archive *aw) { @@ -2176,7 +2172,7 @@ void cmSystemTools::FindCMakeResources(const char* argv0) if(cmSystemTools::FindProgramPath(argv0, exe, errorMsg)) { // remove symlinks - exe = cmSystemTools::GetRealPath(exe.c_str()); + exe = cmSystemTools::GetRealPath(exe); exe_dir = cmSystemTools::GetFilenamePath(exe); } @@ -2227,7 +2223,7 @@ void cmSystemTools::FindCMakeResources(const char* argv0) cmsys::ifstream fin(src_dir_txt.c_str()); std::string src_dir; if(fin && cmSystemTools::GetLineFromStream(fin, src_dir) && - cmSystemTools::FileIsDirectory(src_dir.c_str())) + cmSystemTools::FileIsDirectory(src_dir)) { cmSystemToolsCMakeRoot = src_dir; } @@ -2237,7 +2233,7 @@ void cmSystemTools::FindCMakeResources(const char* argv0) src_dir_txt = dir + "/CMakeFiles/CMakeSourceDir.txt"; cmsys::ifstream fin2(src_dir_txt.c_str()); if(fin2 && cmSystemTools::GetLineFromStream(fin2, src_dir) && - cmSystemTools::FileIsDirectory(src_dir.c_str())) + cmSystemTools::FileIsDirectory(src_dir)) { cmSystemToolsCMakeRoot = src_dir; } @@ -2333,7 +2329,7 @@ bool cmSystemTools::GuessLibrarySOName(std::string const& fullPath, #endif // If the file is not a symlink we have no guess for its soname. - if(!cmSystemTools::FileIsSymlink(fullPath.c_str())) + if(!cmSystemTools::FileIsSymlink(fullPath)) { return false; } @@ -2638,29 +2634,37 @@ bool cmSystemTools::ChangeRPath(std::string const& file, bool cmSystemTools::VersionCompare(cmSystemTools::CompareOp op, const char* lhss, const char* rhss) { - // Parse out up to 8 components. - unsigned int lhs[8] = {0,0,0,0,0,0,0,0}; - unsigned int rhs[8] = {0,0,0,0,0,0,0,0}; - sscanf(lhss, "%u.%u.%u.%u.%u.%u.%u.%u", - &lhs[0], &lhs[1], &lhs[2], &lhs[3], - &lhs[4], &lhs[5], &lhs[6], &lhs[7]); - sscanf(rhss, "%u.%u.%u.%u.%u.%u.%u.%u", - &rhs[0], &rhs[1], &rhs[2], &rhs[3], - &rhs[4], &rhs[5], &rhs[6], &rhs[7]); + const char *endl = lhss; + const char *endr = rhss; + unsigned long lhs, rhs; - // Do component-wise comparison. - for(unsigned int i=0; i < 8; ++i) + while (((*endl >= '0') && (*endl <= '9')) || + ((*endr >= '0') && (*endr <= '9'))) { - if(lhs[i] < rhs[i]) + // Do component-wise comparison. + lhs = strtoul(endl, const_cast<char**>(&endl), 10); + rhs = strtoul(endr, const_cast<char**>(&endr), 10); + + if(lhs < rhs) { // lhs < rhs, so true if operation is LESS return op == cmSystemTools::OP_LESS; } - else if(lhs[i] > rhs[i]) + else if(lhs > rhs) { // lhs > rhs, so true if operation is GREATER return op == cmSystemTools::OP_GREATER; } + + if (*endr == '.') + { + endr++; + } + + if (*endl == '.') + { + endl++; + } } // lhs == rhs, so true if operation is EQUAL return op == cmSystemTools::OP_EQUAL; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index b476a27..ee62f06 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2171,7 +2171,7 @@ cmTarget::GetIncludeDirectories(const std::string& config) const it = impl->Libraries.begin(); it != impl->Libraries.end(); ++it) { - std::string libDir = cmSystemTools::CollapseFullPath(it->c_str()); + std::string libDir = cmSystemTools::CollapseFullPath(*it); static cmsys::RegularExpression frameworkCheck("(.*\\.framework)(/Versions/[^/]+)?/[^/]+$"); @@ -4555,7 +4555,7 @@ bool cmTarget::ComputeOutputDir(const std::string& config, // specified as a relative path. Treat a relative path as // relative to the current output directory for this makefile. out = (cmSystemTools::CollapseFullPath - (out.c_str(), this->Makefile->GetStartOutputDirectory())); + (out, this->Makefile->GetStartOutputDirectory())); // The generator may add the configuration's subdirectory. if(!conf.empty()) @@ -4621,7 +4621,7 @@ bool cmTarget::ComputePDBOutputDir(const std::string& kind, // specified as a relative path. Treat a relative path as // relative to the current output directory for this makefile. out = (cmSystemTools::CollapseFullPath - (out.c_str(), this->Makefile->GetStartOutputDirectory())); + (out, this->Makefile->GetStartOutputDirectory())); // The generator may add the configuration's subdirectory. if(!conf.empty()) @@ -5286,7 +5286,7 @@ cmTarget::GetObjectLibrariesCMP0026(std::vector<cmTarget*>& objlibs) const { continue; } - cmTarget *objLib = this->Makefile->FindTargetToUse(objLibName.c_str()); + cmTarget *objLib = this->Makefile->FindTargetToUse(objLibName); if(objLib) { objlibs.push_back(objLib); diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx index cc6e139..8f2deeb 100644 --- a/Source/cmTryRunCommand.cxx +++ b/Source/cmTryRunCommand.cxx @@ -239,7 +239,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, copyDest += "-"; copyDest += this->RunResultVariable; copyDest += cmSystemTools::GetFilenameExtension(this->OutputFile); - cmSystemTools::CopyFileAlways(this->OutputFile.c_str(), copyDest.c_str()); + cmSystemTools::CopyFileAlways(this->OutputFile, copyDest); std::string resultFileName = this->Makefile->GetHomeOutputDirectory(); resultFileName += "/TryRunResults.cmake"; diff --git a/Source/cmWriteFileCommand.cxx b/Source/cmWriteFileCommand.cxx index af955ec..cc9f220 100644 --- a/Source/cmWriteFileCommand.cxx +++ b/Source/cmWriteFileCommand.cxx @@ -63,8 +63,6 @@ bool cmWriteFileCommand cmSystemTools::SetPermissions(fileName.c_str(), #if defined( _MSC_VER ) || defined( __MINGW32__ ) mode | S_IWRITE -#elif defined( __BORLANDC__ ) - mode | S_IWUSR #else mode | S_IWUSR | S_IWGRP #endif diff --git a/Source/cm_sha2.c b/Source/cm_sha2.c index 24de2b2..4738920 100644 --- a/Source/cm_sha2.c +++ b/Source/cm_sha2.c @@ -103,9 +103,6 @@ typedef cm_sha2_uint32_t sha_word32; /* Exactly 4 bytes */ typedef cm_sha2_uint64_t sha_word64; /* Exactly 8 bytes */ #define SHA_UINT32_C(x) cmIML_INT_UINT32_C(x) #define SHA_UINT64_C(x) cmIML_INT_UINT64_C(x) -#if defined(__BORLANDC__) -# pragma warn -8004 /* variable assigned value that is never used */ -#endif #if defined(__clang__) # pragma clang diagnostic ignored "-Wcast-align" #endif diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 09d270d..dc1b113 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -647,7 +647,7 @@ void cmake::SetArgs(const std::vector<std::string>& args, { directoriesSet = true; std::string path = arg.substr(2); - path = cmSystemTools::CollapseFullPath(path.c_str()); + path = cmSystemTools::CollapseFullPath(path); cmSystemTools::ConvertToUnixSlashes(path); this->SetHomeDirectory(path); } @@ -663,7 +663,7 @@ void cmake::SetArgs(const std::vector<std::string>& args, { directoriesSet = true; std::string path = arg.substr(2); - path = cmSystemTools::CollapseFullPath(path.c_str()); + path = cmSystemTools::CollapseFullPath(path); cmSystemTools::ConvertToUnixSlashes(path); this->SetHomeOutputDirectory(path); } @@ -723,7 +723,7 @@ void cmake::SetArgs(const std::vector<std::string>& args, else if(arg.find("--graphviz=",0) == 0) { std::string path = arg.substr(strlen("--graphviz=")); - path = cmSystemTools::CollapseFullPath(path.c_str()); + path = cmSystemTools::CollapseFullPath(path); cmSystemTools::ConvertToUnixSlashes(path); this->GraphVizFile = path; if ( this->GraphVizFile.empty() ) @@ -1212,7 +1212,7 @@ int cmake::DoPreConfigureChecks() cacheStart += "/CMakeLists.txt"; std::string currentStart = this->GetHomeDirectory(); currentStart += "/CMakeLists.txt"; - if(!cmSystemTools::SameFile(cacheStart.c_str(), currentStart.c_str())) + if(!cmSystemTools::SameFile(cacheStart, currentStart)) { std::string message = "The source \""; message += currentStart; @@ -1377,9 +1377,7 @@ int cmake::ActualConfigure() } else { -#if defined(__BORLANDC__) && defined(_WIN32) - this->SetGlobalGenerator(new cmGlobalBorlandMakefileGenerator); -#elif defined(_WIN32) && !defined(__CYGWIN__) && !defined(CMAKE_BOOT_MINGW) +#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(CMAKE_BOOT_MINGW) std::string installedCompiler; // Try to find the newest VS installed on the computer and // use that as a default if -G is not specified @@ -1948,7 +1946,7 @@ void cmake::UpdateConversionPathTable() { // two entries per line table >> a; table >> b; - cmSystemTools::AddTranslationPath( a.c_str(), b.c_str()); + cmSystemTools::AddTranslationPath( a, b); } } } @@ -2043,7 +2041,7 @@ int cmake::CheckBuildSystem() pi != products.end(); ++pi) { if(!(cmSystemTools::FileExists(pi->c_str()) || - cmSystemTools::FileIsSymlink(pi->c_str()))) + cmSystemTools::FileIsSymlink(*pi))) { if(verbose) { @@ -2166,7 +2164,7 @@ void cmake::TruncateOutputLog(const char* fname) } if ( !this->CacheManager->GetCacheValue("CMAKE_CACHEFILE_DIR") ) { - cmSystemTools::RemoveFile(fullPath.c_str()); + cmSystemTools::RemoveFile(fullPath); return; } off_t fsize = st.st_size; @@ -2392,7 +2390,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args) std::string resultFile; std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); std::string destPath = cwd + "/__cmake_systeminformation"; - cmSystemTools::RemoveADirectory(destPath.c_str()); + cmSystemTools::RemoveADirectory(destPath); if (!cmSystemTools::MakeDirectory(destPath.c_str())) { std::cerr << "Error: --system-information must be run from a " @@ -2474,7 +2472,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args) } // now run cmake on the CMakeLists file - cmSystemTools::ChangeDirectory(destPath.c_str()); + cmSystemTools::ChangeDirectory(destPath); std::vector<std::string> args2; args2.push_back(args[0]); args2.push_back(destPath); @@ -2490,12 +2488,12 @@ int cmake::GetSystemInformation(std::vector<std::string>& args) } // change back to the original directory - cmSystemTools::ChangeDirectory(cwd.c_str()); + cmSystemTools::ChangeDirectory(cwd); // echo results to stdout if needed if (writeToStdout) { - FILE* fin = cmsys::SystemTools::Fopen(resultFile.c_str(), "r"); + FILE* fin = cmsys::SystemTools::Fopen(resultFile, "r"); if(fin) { const int bufferSize = 4096; @@ -2514,7 +2512,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args) } // clean up the directory - cmSystemTools::RemoveADirectory(destPath.c_str()); + cmSystemTools::RemoveADirectory(destPath); return 0; } @@ -2770,7 +2768,7 @@ int cmake::Build(const std::string& dir, const std::vector<std::string>& nativeOptions, bool clean) { - if(!cmSystemTools::FileIsDirectory(dir.c_str())) + if(!cmSystemTools::FileIsDirectory(dir)) { std::cerr << "Error: " << dir << " is not a directory\n"; return 1; diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index a0c67e0..f5436ff 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -128,7 +128,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) // Copy directory content if (args[1] == "copy_directory" && args.size() == 4) { - if(!cmSystemTools::CopyADirectory(args[2].c_str(), args[3].c_str())) + if(!cmSystemTools::CopyADirectory(args[2], args[3])) { std::cerr << "Error copying directory from \"" << args[2] << "\" to \"" << args[3] @@ -155,7 +155,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) // Compare files if (args[1] == "compare_files" && args.size() == 4) { - if(cmSystemTools::FilesDiffer(args[2].c_str(), args[3].c_str())) + if(cmSystemTools::FilesDiffer(args[2], args[3])) { std::cerr << "Files \"" << args[2] << "\" to \"" << args[3] @@ -269,8 +269,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) else if (args[1] == "remove_directory" && args.size() == 3) { - if(cmSystemTools::FileIsDirectory(args[2].c_str()) && - !cmSystemTools::RemoveADirectory(args[2].c_str())) + if(cmSystemTools::FileIsDirectory(args[2]) && + !cmSystemTools::RemoveADirectory(args[2])) { std::cerr << "Error removing directory \"" << args[2] << "\".\n"; @@ -293,7 +293,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) { // Complain if the file could not be removed, still exists, // and the -f option was not given. - if(!cmSystemTools::RemoveFile(args[cc].c_str()) && !force && + if(!cmSystemTools::RemoveFile(args[cc]) && !force && cmSystemTools::FileExists(args[cc].c_str())) { return 1; @@ -309,7 +309,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) { // Complain if the file could not be removed, still exists, // and the -f option was not given. - if(!cmSystemTools::Touch(args[cc].c_str(), true)) + if(!cmSystemTools::Touch(args[cc], true)) { return 1; } @@ -323,7 +323,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) { // Complain if the file could not be removed, still exists, // and the -f option was not given. - if(!cmSystemTools::Touch(args[cc].c_str(), false)) + if(!cmSystemTools::Touch(args[cc], false)) { return 1; } @@ -453,10 +453,10 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) // basically remove the directory std::string dirName = args[2]; dirName += "/Progress"; - cmSystemTools::RemoveADirectory(dirName.c_str()); + cmSystemTools::RemoveADirectory(dirName); // is the last argument a filename that exists? - FILE *countFile = cmsys::SystemTools::Fopen(args[3].c_str(),"r"); + FILE *countFile = cmsys::SystemTools::Fopen(args[3],"r"); int count; if (countFile) { @@ -476,7 +476,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) // write the count into the directory std::string fName = dirName; fName += "/count.txt"; - FILE *progFile = cmsys::SystemTools::Fopen(fName.c_str(),"w"); + FILE *progFile = cmsys::SystemTools::Fopen(fName,"w"); if (progFile) { fprintf(progFile,"%i\n",count); @@ -497,7 +497,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) // read the count fName = dirName; fName += "/count.txt"; - progFile = cmsys::SystemTools::Fopen(fName.c_str(),"r"); + progFile = cmsys::SystemTools::Fopen(fName,"r"); int count = 0; if (!progFile) { @@ -517,7 +517,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) fName = dirName; fName += "/"; fName += args[i]; - progFile = cmsys::SystemTools::Fopen(fName.c_str(),"w"); + progFile = cmsys::SystemTools::Fopen(fName,"w"); if (progFile) { fprintf(progFile,"empty"); @@ -525,7 +525,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) } } int fileNum = static_cast<int> - (cmsys::Directory::GetNumberOfFilesInDirectory(dirName.c_str())); + (cmsys::Directory::GetNumberOfFilesInDirectory(dirName)); if (count > 0) { // print the progress @@ -660,10 +660,10 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) // Create a local generator configured for the directory in // which dependencies will be scanned. - homeDir = cmSystemTools::CollapseFullPath(homeDir.c_str()); - startDir = cmSystemTools::CollapseFullPath(startDir.c_str()); - homeOutDir = cmSystemTools::CollapseFullPath(homeOutDir.c_str()); - startOutDir = cmSystemTools::CollapseFullPath(startOutDir.c_str()); + homeDir = cmSystemTools::CollapseFullPath(homeDir); + startDir = cmSystemTools::CollapseFullPath(startDir); + homeOutDir = cmSystemTools::CollapseFullPath(homeOutDir); + startOutDir = cmSystemTools::CollapseFullPath(startOutDir); cm.SetHomeDirectory(homeDir); cm.SetStartDirectory(startDir); cm.SetHomeOutputDirectory(homeOutDir); @@ -885,9 +885,9 @@ int cmcmd::SymlinkExecutable(std::vector<std::string>& args) bool cmcmd::SymlinkInternal(std::string const& file, std::string const& link) { if(cmSystemTools::FileExists(link.c_str()) || - cmSystemTools::FileIsSymlink(link.c_str())) + cmSystemTools::FileIsSymlink(link)) { - cmSystemTools::RemoveFile(link.c_str()); + cmSystemTools::RemoveFile(link); } #if defined(_WIN32) && !defined(__CYGWIN__) return cmSystemTools::CopyFileAlways(file.c_str(), link.c_str()); @@ -1318,7 +1318,7 @@ int cmcmd::VisualStudioLinkIncremental(std::vector<std::string>& args, } std::string manifestFile = targetName; manifestFile += ".embed.manifest"; - std::string fullPath= cmSystemTools::CollapseFullPath(manifestFile.c_str()); + std::string fullPath= cmSystemTools::CollapseFullPath(manifestFile); fout << type << " /* CREATEPROCESS_MANIFEST_RESOURCE_ID " "*/ 24 /* RT_MANIFEST */ " << "\"" << fullPath << "\""; fout.close(); diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index 8ca4360..2292d64 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -265,7 +265,7 @@ STRING(COMPARE EQUAL "${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}" KWSYS_IN_SOURCE_BUILD) IF(NOT KWSYS_IN_SOURCE_BUILD) CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/kwsysPrivate.h - ${PROJECT_BINARY_DIR}/kwsysPrivate.h COPY_ONLY IMMEDIATE) + ${PROJECT_BINARY_DIR}/kwsysPrivate.h COPYONLY IMMEDIATE) ENDIF(NOT KWSYS_IN_SOURCE_BUILD) # Select plugin module file name convention. @@ -1075,7 +1075,7 @@ ENDIF(KWSYS_ENABLE_C AND KWSYS_C_SRCS) ADD_DEFINITIONS("-DKWSYS_NAMESPACE=${KWSYS_NAMESPACE}") # Disable deprecation warnings for standard C functions. -IF(MSVC OR (WIN32 AND "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$")) +IF(MSVC OR (WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "Intel")) ADD_DEFINITIONS( -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_DEPRECATE @@ -1232,7 +1232,7 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) ENDFOREACH(n) # Some Apple compilers produce bad optimizations in this source. - IF(APPLE AND "${CMAKE_C_COMPILER_ID}" MATCHES "^(GNU|LLVM)$") + IF(APPLE AND CMAKE_C_COMPILER_ID MATCHES "^(GNU|LLVM)$") SET_SOURCE_FILES_PROPERTIES(testProcess.c PROPERTIES COMPILE_FLAGS -O0) ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "XL") # Tell IBM XL not to warn about our test infinite loop diff --git a/Source/kwsys/Directory.hxx.in b/Source/kwsys/Directory.hxx.in index 0acb191..1bcf90e 100644 --- a/Source/kwsys/Directory.hxx.in +++ b/Source/kwsys/Directory.hxx.in @@ -18,7 +18,6 @@ /* Define these macros temporarily to keep the code readable. */ #if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS # define kwsys_stl @KWSYS_NAMESPACE@_stl -# define kwsys_ios @KWSYS_NAMESPACE@_ios #endif namespace @KWSYS_NAMESPACE@ @@ -87,7 +86,6 @@ private: /* Undefine temporary macros. */ #if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS # undef kwsys_stl -# undef kwsys_ios #endif #endif diff --git a/Source/kwsys/DynamicLoader.cxx b/Source/kwsys/DynamicLoader.cxx index 44cf6af..66c7d57 100644 --- a/Source/kwsys/DynamicLoader.cxx +++ b/Source/kwsys/DynamicLoader.cxx @@ -40,9 +40,9 @@ namespace KWSYS_NAMESPACE { //---------------------------------------------------------------------------- -DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const char* libname ) +DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const kwsys_stl::string& libname ) { - return shl_load(libname, BIND_DEFERRED | DYNAMIC_PATH, 0L); + return shl_load(libname.c_str(), BIND_DEFERRED | DYNAMIC_PATH, 0L); } //---------------------------------------------------------------------------- @@ -53,7 +53,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib) //---------------------------------------------------------------------------- DynamicLoader::SymbolPointer -DynamicLoader::GetSymbolAddress(DynamicLoader::LibraryHandle lib, const char* sym) +DynamicLoader::GetSymbolAddress(DynamicLoader::LibraryHandle lib, const kwsys_stl::string& sym) { void* addr; int status; @@ -62,7 +62,7 @@ DynamicLoader::GetSymbolAddress(DynamicLoader::LibraryHandle lib, const char* sy * TYPE_DATA Look for a symbol in the data segment (for example, variables). * TYPE_UNDEFINED Look for any symbol. */ - status = shl_findsym (&lib, sym, TYPE_UNDEFINED, &addr); + status = shl_findsym (&lib, sym.c_str(), TYPE_UNDEFINED, &addr); void* result = (status < 0) ? (void*)0 : addr; // Hack to cast pointer-to-data to pointer-to-function. @@ -111,18 +111,18 @@ namespace KWSYS_NAMESPACE { //---------------------------------------------------------------------------- -DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const char* libname ) +DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const kwsys_stl::string& libname ) { NSObjectFileImageReturnCode rc; NSObjectFileImage image = 0; - rc = NSCreateObjectFileImageFromFile(libname, &image); + rc = NSCreateObjectFileImageFromFile(libname.c_str(), &image); // rc == NSObjectFileImageInappropriateFile when trying to load a dylib file if( rc != NSObjectFileImageSuccess ) { return 0; } - NSModule handle = NSLinkModule(image, libname, + NSModule handle = NSLinkModule(image, libname.c_str(), NSLINKMODULE_OPTION_BINDNOW|NSLINKMODULE_OPTION_RETURN_ON_ERROR); NSDestroyObjectFileImage(image); return handle; @@ -142,14 +142,14 @@ int DynamicLoader::CloseLibrary( DynamicLoader::LibraryHandle lib) //---------------------------------------------------------------------------- DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( - DynamicLoader::LibraryHandle lib, const char* sym) + DynamicLoader::LibraryHandle lib, const kwsys_stl::string& sym) { void *result=0; // Need to prepend symbols with '_' on Apple-gcc compilers - size_t len = strlen(sym); + size_t len = sym.size(); char *rsym = new char[len + 1 + 1]; strcpy(rsym, "_"); - strcat(rsym+1, sym); + strcat(rsym+1, sym.c_str()); NSSymbol symbol = NSLookupSymbolInModule(lib, rsym); if(symbol) @@ -183,13 +183,13 @@ namespace KWSYS_NAMESPACE { //---------------------------------------------------------------------------- -DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const char* libname) +DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const kwsys_stl::string& libname) { DynamicLoader::LibraryHandle lh; - int length = MultiByteToWideChar(CP_UTF8, 0, libname, -1, NULL, 0); + int length = MultiByteToWideChar(CP_UTF8, 0, libname.c_str(), -1, NULL, 0); wchar_t* wchars = new wchar_t[length+1]; wchars[0] = '\0'; - MultiByteToWideChar(CP_UTF8, 0, libname, -1, wchars, length); + MultiByteToWideChar(CP_UTF8, 0, libname.c_str(), -1, wchars, length); lh = LoadLibraryW(wchars); delete [] wchars; return lh; @@ -203,7 +203,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib) //---------------------------------------------------------------------------- DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( - DynamicLoader::LibraryHandle lib, const char* sym) + DynamicLoader::LibraryHandle lib, const kwsys_stl::string& sym) { // TODO: The calling convention affects the name of the symbol. We // should have a tool to help get the symbol with the desired @@ -230,12 +230,12 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( void *result; #if defined(__BORLANDC__) || defined(__WATCOMC__) // Need to prepend symbols with '_' - size_t len = strlen(sym); + size_t len = sym.size(); char *rsym = new char[len + 1 + 1]; strcpy(rsym, "_"); - strcat(rsym, sym); + strcat(rsym, sym.c_str()); #else - const char *rsym = sym; + const char *rsym = sym.c_str(); #endif result = (void*)GetProcAddress(lib, rsym); #if defined(__BORLANDC__) || defined(__WATCOMC__) @@ -298,11 +298,11 @@ namespace KWSYS_NAMESPACE static image_id last_dynamic_err = B_OK; //---------------------------------------------------------------------------- -DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const char* libname ) +DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const kwsys_stl::string& libname ) { // image_id's are integers, errors are negative. Add one just in case we // get a valid image_id of zero (is that even possible?). - image_id rc = load_add_on(libname); + image_id rc = load_add_on(libname.c_str()); if (rc < 0) { last_dynamic_err = rc; @@ -336,7 +336,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib) //---------------------------------------------------------------------------- DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( - DynamicLoader::LibraryHandle lib, const char* sym) + DynamicLoader::LibraryHandle lib, const kwsys_stl::string& sym) { // Hack to cast pointer-to-data to pointer-to-function. union @@ -356,7 +356,7 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( // !!! FIXME: BeOS can do function-only lookups...does this ever // !!! FIXME: actually _want_ a data symbol lookup, or was this union // !!! FIXME: a leftover of dlsym()? (s/ANY/TEXT for functions only). - status_t rc = get_image_symbol(lib-1,sym,B_SYMBOL_TYPE_ANY,&result.pvoid); + status_t rc = get_image_symbol(lib-1,sym.c_str(),B_SYMBOL_TYPE_ANY,&result.pvoid); if (rc != B_OK) { last_dynamic_err = rc; @@ -389,7 +389,7 @@ namespace KWSYS_NAMESPACE { //---------------------------------------------------------------------------- -DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const char* libname ) +DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const kwsys_stl::string& libname ) { return 0; } @@ -407,7 +407,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib) //---------------------------------------------------------------------------- DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( - DynamicLoader::LibraryHandle lib, const char* sym) + DynamicLoader::LibraryHandle lib, const kwsys_stl::string& sym) { return 0; } @@ -433,12 +433,12 @@ namespace KWSYS_NAMESPACE { //---------------------------------------------------------------------------- -DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const char* libname ) +DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const kwsys_stl::string& libname ) { - char *name = (char *)calloc(1, strlen(libname) + 1); + char *name = (char *)calloc(1, libname.size() + 1); dld_init(program_invocation_name); - strncpy(name, libname, strlen(libname)); - dld_link(libname); + strncpy(name, libname.c_str(), libname.size()); + dld_link(libname.c_str()); return (void *)name; } @@ -452,7 +452,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib) //---------------------------------------------------------------------------- DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( - DynamicLoader::LibraryHandle lib, const char* sym) + DynamicLoader::LibraryHandle lib, const kwsys_stl::string& sym) { // Hack to cast pointer-to-data to pointer-to-function. union @@ -460,7 +460,7 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( void* pvoid; DynamicLoader::SymbolPointer psym; } result; - result.pvoid = dld_get_symbol(sym); + result.pvoid = dld_get_symbol(sym.c_str()); return result.psym; } @@ -485,9 +485,9 @@ namespace KWSYS_NAMESPACE { //---------------------------------------------------------------------------- -DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const char* libname ) +DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const kwsys_stl::string& libname ) { - return dlopen(libname, RTLD_LAZY); + return dlopen(libname.c_str(), RTLD_LAZY); } //---------------------------------------------------------------------------- @@ -504,7 +504,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib) //---------------------------------------------------------------------------- DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( - DynamicLoader::LibraryHandle lib, const char* sym) + DynamicLoader::LibraryHandle lib, const kwsys_stl::string& sym) { // Hack to cast pointer-to-data to pointer-to-function. union @@ -512,7 +512,7 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( void* pvoid; DynamicLoader::SymbolPointer psym; } result; - result.pvoid = dlsym(lib, sym); + result.pvoid = dlsym(lib, sym.c_str()); return result.psym; } diff --git a/Source/kwsys/DynamicLoader.hxx.in b/Source/kwsys/DynamicLoader.hxx.in index 64468ec..75811ab 100644 --- a/Source/kwsys/DynamicLoader.hxx.in +++ b/Source/kwsys/DynamicLoader.hxx.in @@ -13,6 +13,7 @@ #define @KWSYS_NAMESPACE@_DynamicLoader_hxx #include <@KWSYS_NAMESPACE@/Configure.h> +#include <@KWSYS_NAMESPACE@/stl/string> #if defined(__hpux) #include <dl.h> @@ -27,6 +28,11 @@ #include <be/kernel/image.h> #endif +/* Define these macros temporarily to keep the code readable. */ +#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS +# define kwsys_stl @KWSYS_NAMESPACE@_stl +#endif + namespace @KWSYS_NAMESPACE@ { /** \class DynamicLoader @@ -77,14 +83,14 @@ public: /** Load a dynamic library into the current process. * The returned LibraryHandle can be used to access the symbols in the * library. */ - static LibraryHandle OpenLibrary(const char*); + static LibraryHandle OpenLibrary(const kwsys_stl::string&); /** Attempt to detach a dynamic library from the * process. A value of true is returned if it is sucessful. */ static int CloseLibrary(LibraryHandle); /** Find the address of the symbol in the given library. */ - static SymbolPointer GetSymbolAddress(LibraryHandle, const char*); + static SymbolPointer GetSymbolAddress(LibraryHandle, const kwsys_stl::string&); /** Return the default module prefix for the current platform. */ static const char* LibPrefix() { return "@KWSYS_DynamicLoader_PREFIX@"; } @@ -98,4 +104,9 @@ public: } // namespace @KWSYS_NAMESPACE@ +/* Undefine temporary macros. */ +#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS +# undef kwsys_stl +#endif + #endif diff --git a/Source/kwsys/Glob.cxx b/Source/kwsys/Glob.cxx index 0916d2e..5a96aed 100644 --- a/Source/kwsys/Glob.cxx +++ b/Source/kwsys/Glob.cxx @@ -501,7 +501,7 @@ void Glob::AddFile(kwsys_stl::vector<kwsys_stl::string>& files, const kwsys_stl: { if ( !this->Relative.empty() ) { - files.push_back(kwsys::SystemTools::RelativePath(this->Relative.c_str(), file.c_str())); + files.push_back(kwsys::SystemTools::RelativePath(this->Relative, file)); } else { diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx index 84b5f39..d23c248 100644 --- a/Source/kwsys/SystemInformation.cxx +++ b/Source/kwsys/SystemInformation.cxx @@ -5156,7 +5156,7 @@ bool SystemInformationImplementation::QueryOSInformation() } } - sprintf (operatingSystem, "%s (Build %ld)", osvi.szCSDVersion, osvi.dwBuildNumber & 0xFFFF); + sprintf (operatingSystem, "%ls (Build %ld)", osvi.szCSDVersion, osvi.dwBuildNumber & 0xFFFF); this->OSVersion = operatingSystem; } else @@ -5205,7 +5205,7 @@ bool SystemInformationImplementation::QueryOSInformation() if (osvi.dwMajorVersion <= 4) { // NB: NT 4.0 and earlier. - sprintf (operatingSystem, "version %ld.%ld %s (Build %ld)", + sprintf (operatingSystem, "version %ld.%ld %ls (Build %ld)", osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.szCSDVersion, @@ -5236,7 +5236,7 @@ bool SystemInformationImplementation::QueryOSInformation() else { // Windows 2000 and everything else. - sprintf (operatingSystem,"%s (Build %ld)", osvi.szCSDVersion, osvi.dwBuildNumber & 0xFFFF); + sprintf (operatingSystem,"%ls (Build %ld)", osvi.szCSDVersion, osvi.dwBuildNumber & 0xFFFF); this->OSVersion = operatingSystem; } break; diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index b1221e3..e4c82d8 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -222,7 +222,7 @@ inline int Rmdir(const kwsys_stl::string& dir) inline const char* Getcwd(char* buf, unsigned int len) { std::vector<wchar_t> w_buf(len); - if(const wchar_t* ret = _wgetcwd(&w_buf[0], len)) + if(_wgetcwd(&w_buf[0], len)) { // make sure the drive letter is capital if(wcslen(&w_buf[0]) > 1 && w_buf[1] == L':') @@ -385,6 +385,11 @@ const char* SystemTools::GetEnv(const char* key) return getenv(key); } +const char* SystemTools::GetEnv(const kwsys_stl::string& key) +{ + return SystemTools::GetEnv(key.c_str()); +} + bool SystemTools::GetEnv(const char* key, kwsys_stl::string& result) { const char* v = getenv(key); @@ -399,6 +404,11 @@ bool SystemTools::GetEnv(const char* key, kwsys_stl::string& result) } } +bool SystemTools::GetEnv(const kwsys_stl::string& key, kwsys_stl::string& result) +{ + return SystemTools::GetEnv(key.c_str(), result); +} + //---------------------------------------------------------------------------- #if defined(__CYGWIN__) || defined(__GLIBC__) @@ -410,27 +420,28 @@ bool SystemTools::GetEnv(const char* key, kwsys_stl::string& result) #if KWSYS_CXX_HAS_UNSETENV /* unsetenv("A") removes A from the environment. On older platforms it returns void instead of int. */ -static int kwsysUnPutEnv(const char* env) +static int kwsysUnPutEnv(const kwsys_stl::string& env) { - if(const char* eq = strchr(env, '=')) + size_t pos = env.find('='); + if(pos != env.npos) { - std::string name(env, eq-env); + std::string name = env.substr(0, pos); unsetenv(name.c_str()); } else { - unsetenv(env); + unsetenv(env.c_str()); } return 0; } #elif defined(KWSYS_PUTENV_EMPTY) || defined(KWSYS_PUTENV_NAME) /* putenv("A=") or putenv("A") removes A from the environment. */ -static int kwsysUnPutEnv(const char* env) +static int kwsysUnPutEnv(const kwsys_stl::string& env) { int err = 0; - const char* eq = strchr(env, '='); - size_t const len = eq? (size_t)(eq-env) : strlen(env); + size_t pos = env.find('='); + size_t const len = pos == env.npos ? env.size() : pos; # ifdef KWSYS_PUTENV_EMPTY size_t const sz = len + 2; # else @@ -442,7 +453,7 @@ static int kwsysUnPutEnv(const char* env) { return -1; } - strncpy(buf, env, len); + strncpy(buf, env.c_str(), len); # ifdef KWSYS_PUTENV_EMPTY buf[len] = '='; buf[len+1] = 0; @@ -471,17 +482,17 @@ static int kwsysUnPutEnv(const char* env) #else /* Manipulate the "environ" global directly. */ -static int kwsysUnPutEnv(const char* env) +static int kwsysUnPutEnv(const kwsys_stl::string& env) { - const char* eq = strchr(env, '='); - size_t const len = eq? (size_t)(eq-env) : strlen(env); + size_t pos = env.find('='); + size_t const len = pos == env.npos ? env.size() : pos; int in = 0; int out = 0; while(environ[in]) { if(strlen(environ[in]) > len && environ[in][len] == '=' && - strncmp(env, environ[in], len) == 0) + strncmp(env.c_str(), environ[in], len) == 0) { ++in; } @@ -504,12 +515,13 @@ static int kwsysUnPutEnv(const char* env) /* setenv("A", "B", 1) will set A=B in the environment and makes its own copies of the strings. */ -bool SystemTools::PutEnv(const char* env) +bool SystemTools::PutEnv(const kwsys_stl::string& env) { - if(const char* eq = strchr(env, '=')) + size_t pos = env.find('='); + if(pos != env.npos) { - std::string name(env, eq-env); - return setenv(name.c_str(), eq+1, 1) == 0; + std::string name = env.substr(0, pos); + return setenv(name.c_str(), env.c_str() + pos + 1, 1) == 0; } else { @@ -517,7 +529,7 @@ bool SystemTools::PutEnv(const char* env) } } -bool SystemTools::UnPutEnv(const char* env) +bool SystemTools::UnPutEnv(const kwsys_stl::string& env) { return kwsysUnPutEnv(env) == 0; } @@ -603,14 +615,14 @@ public: static kwsysEnv kwsysEnvInstance; -bool SystemTools::PutEnv(const char* env) +bool SystemTools::PutEnv(const kwsys_stl::string& env) { - return kwsysEnvInstance.Put(env); + return kwsysEnvInstance.Put(env.c_str()); } -bool SystemTools::UnPutEnv(const char* env) +bool SystemTools::UnPutEnv(const kwsys_stl::string& env) { - return kwsysEnvInstance.UnPut(env); + return kwsysEnvInstance.UnPut(env.c_str()); } #endif @@ -689,8 +701,35 @@ bool SystemTools::MakeDirectory(const kwsys_stl::string& path) // replace replace with with as many times as it shows up in source. // write the result into source. void SystemTools::ReplaceString(kwsys_stl::string& source, - const char* replace, - const char* with) + const kwsys_stl::string& replace, + const kwsys_stl::string& with) +{ + // do while hangs if replaceSize is 0 + if (replace.empty()) + { + return; + } + + SystemTools::ReplaceString(source, replace.c_str(), replace.size(), with); +} + +void SystemTools::ReplaceString(kwsys_stl::string& source, + const char* replace, + const char* with) +{ + // do while hangs if replaceSize is 0 + if (!*replace) + { + return; + } + + SystemTools::ReplaceString(source, replace, strlen(replace), with ? with : ""); +} + +void SystemTools::ReplaceString(kwsys_stl::string& source, + const char* replace, + size_t replaceSize, + const kwsys_stl::string& with) { const char *src = source.c_str(); char *searchPos = const_cast<char *>(strstr(src,replace)); @@ -702,12 +741,6 @@ void SystemTools::ReplaceString(kwsys_stl::string& source, } // perform replacements until done - size_t replaceSize = strlen(replace); - // do while hangs if replaceSize is 0 - if(replaceSize == 0) - { - return; - } char *orig = strdup(src); char *currentPos = orig; searchPos = searchPos - src + orig; @@ -739,20 +772,20 @@ void SystemTools::ReplaceString(kwsys_stl::string& source, #endif #if defined(_WIN32) && !defined(__CYGWIN__) -static bool SystemToolsParseRegistryKey(const char* key, +static bool SystemToolsParseRegistryKey(const kwsys_stl::string& key, HKEY& primaryKey, kwsys_stl::string& second, kwsys_stl::string& valuename) { kwsys_stl::string primary = key; - size_t start = primary.find("\\"); + size_t start = primary.find('\\'); if (start == kwsys_stl::string::npos) { return false; } - size_t valuenamepos = primary.find(";"); + size_t valuenamepos = primary.find(';'); if (valuenamepos != kwsys_stl::string::npos) { valuename = primary.substr(valuenamepos+1); @@ -810,7 +843,7 @@ static DWORD SystemToolsMakeRegistryMode(DWORD mode, #if defined(_WIN32) && !defined(__CYGWIN__) bool -SystemTools::GetRegistrySubKeys(const char *key, +SystemTools::GetRegistrySubKeys(const kwsys_stl::string& key, kwsys_stl::vector<kwsys_stl::string>& subkeys, KeyWOW64 view) { @@ -849,7 +882,7 @@ SystemTools::GetRegistrySubKeys(const char *key, return true; } #else -bool SystemTools::GetRegistrySubKeys(const char *, +bool SystemTools::GetRegistrySubKeys(const kwsys_stl::string&, kwsys_stl::vector<kwsys_stl::string>&, KeyWOW64) { @@ -865,7 +898,7 @@ bool SystemTools::GetRegistrySubKeys(const char *, // => will return the data of the "Root" value of the key #if defined(_WIN32) && !defined(__CYGWIN__) -bool SystemTools::ReadRegistryValue(const char *key, kwsys_stl::string &value, +bool SystemTools::ReadRegistryValue(const kwsys_stl::string& key, kwsys_stl::string &value, KeyWOW64 view) { bool valueset = false; @@ -922,7 +955,7 @@ bool SystemTools::ReadRegistryValue(const char *key, kwsys_stl::string &value, return valueset; } #else -bool SystemTools::ReadRegistryValue(const char *, kwsys_stl::string &, +bool SystemTools::ReadRegistryValue(const kwsys_stl::string&, kwsys_stl::string &, KeyWOW64) { return false; @@ -938,7 +971,8 @@ bool SystemTools::ReadRegistryValue(const char *, kwsys_stl::string &, // => will set the data of the "Root" value of the key #if defined(_WIN32) && !defined(__CYGWIN__) -bool SystemTools::WriteRegistryValue(const char *key, const char *value, +bool SystemTools::WriteRegistryValue(const kwsys_stl::string& key, + const kwsys_stl::string& value, KeyWOW64 view) { HKEY primaryKey = HKEY_CURRENT_USER; @@ -978,7 +1012,7 @@ bool SystemTools::WriteRegistryValue(const char *key, const char *value, return false; } #else -bool SystemTools::WriteRegistryValue(const char *, const char *, KeyWOW64) +bool SystemTools::WriteRegistryValue(const kwsys_stl::string&, const kwsys_stl::string&, KeyWOW64) { return false; } @@ -992,7 +1026,7 @@ bool SystemTools::WriteRegistryValue(const char *, const char *, KeyWOW64) // => will delete the data of the "Root" value of the key #if defined(_WIN32) && !defined(__CYGWIN__) -bool SystemTools::DeleteRegistryValue(const char *key, KeyWOW64 view) +bool SystemTools::DeleteRegistryValue(const kwsys_stl::string& key, KeyWOW64 view) { HKEY primaryKey = HKEY_CURRENT_USER; kwsys_stl::string second; @@ -1023,7 +1057,7 @@ bool SystemTools::DeleteRegistryValue(const char *key, KeyWOW64 view) return false; } #else -bool SystemTools::DeleteRegistryValue(const char *, KeyWOW64) +bool SystemTools::DeleteRegistryValue(const kwsys_stl::string&, KeyWOW64) { return false; } @@ -2245,12 +2279,13 @@ bool SystemTools::CopyFileAlways(const kwsys_stl::string& source, const kwsys_st SystemTools::MakeDirectory(destination_dir); // Open files - -#if defined(_WIN32) || defined(__CYGWIN__) - kwsys::ifstream fin(source.c_str(), - kwsys_ios::ios::binary | kwsys_ios::ios::in); +#if defined(_WIN32) + kwsys::ifstream fin(Encoding::ToNarrow( + SystemTools::ConvertToWindowsExtendedPath(source)).c_str(), + kwsys_ios::ios::in | kwsys_ios_binary); #else - kwsys::ifstream fin(source.c_str()); + kwsys::ifstream fin(source.c_str(), + kwsys_ios::ios::in | kwsys_ios_binary); #endif if(!fin) { @@ -2263,12 +2298,13 @@ bool SystemTools::CopyFileAlways(const kwsys_stl::string& source, const kwsys_st // that do not allow file removal can be modified. SystemTools::RemoveFile(real_destination); -#if defined(_WIN32) || defined(__CYGWIN__) - kwsys::ofstream fout(real_destination.c_str(), - kwsys_ios::ios::binary | kwsys_ios::ios::out | kwsys_ios::ios::trunc); +#if defined(_WIN32) + kwsys::ofstream fout(Encoding::ToNarrow( + SystemTools::ConvertToWindowsExtendedPath(real_destination)).c_str(), + kwsys_ios::ios::out | kwsys_ios::ios::trunc | kwsys_ios_binary); #else kwsys::ofstream fout(real_destination.c_str(), - kwsys_ios::ios::out | kwsys_ios::ios::trunc); + kwsys_ios::ios::out | kwsys_ios::ios::trunc | kwsys_ios_binary); #endif if(!fout) { @@ -2379,7 +2415,7 @@ bool SystemTools::CopyADirectory(const kwsys_stl::string& source, const kwsys_st // return size of file; also returns zero if no file exists -unsigned long SystemTools::FileLength(const char* filename) +unsigned long SystemTools::FileLength(const kwsys_stl::string& filename) { unsigned long length = 0; #ifdef _WIN32 @@ -2397,7 +2433,7 @@ unsigned long SystemTools::FileLength(const char* filename) } #else struct stat fs; - if (stat(filename, &fs) == 0) + if (stat(filename.c_str(), &fs) == 0) { length = static_cast<unsigned long>(fs.st_size); } @@ -2663,7 +2699,7 @@ size_t SystemTools::GetMaximumFilePathLength() * found. Otherwise, the empty string is returned. */ kwsys_stl::string SystemTools -::FindName(const char* name, +::FindName(const kwsys_stl::string& name, const kwsys_stl::vector<kwsys_stl::string>& userPaths, bool no_system_path) { @@ -2716,7 +2752,7 @@ kwsys_stl::string SystemTools * found. Otherwise, the empty string is returned. */ kwsys_stl::string SystemTools -::FindFile(const char* name, +::FindFile(const kwsys_stl::string& name, const kwsys_stl::vector<kwsys_stl::string>& userPaths, bool no_system_path) { @@ -2735,7 +2771,7 @@ kwsys_stl::string SystemTools * found. Otherwise, the empty string is returned. */ kwsys_stl::string SystemTools -::FindDirectory(const char* name, +::FindDirectory(const kwsys_stl::string& name, const kwsys_stl::vector<kwsys_stl::string>& userPaths, bool no_system_path) { @@ -3078,29 +3114,29 @@ bool SystemTools::FileIsSymlink(const kwsys_stl::string& name) } #if defined(_WIN32) && !defined(__CYGWIN__) -bool SystemTools::CreateSymlink(const char*, const char*) +bool SystemTools::CreateSymlink(const kwsys_stl::string&, const kwsys_stl::string&) { return false; } #else -bool SystemTools::CreateSymlink(const char* origName, const char* newName) +bool SystemTools::CreateSymlink(const kwsys_stl::string& origName, const kwsys_stl::string& newName) { - return symlink(origName, newName) >= 0; + return symlink(origName.c_str(), newName.c_str()) >= 0; } #endif #if defined(_WIN32) && !defined(__CYGWIN__) -bool SystemTools::ReadSymlink(const char*, kwsys_stl::string&) +bool SystemTools::ReadSymlink(const kwsys_stl::string&, kwsys_stl::string&) { return false; } #else -bool SystemTools::ReadSymlink(const char* newName, +bool SystemTools::ReadSymlink(const kwsys_stl::string& newName, kwsys_stl::string& origName) { char buf[KWSYS_SYSTEMTOOLS_MAXPATH+1]; int count = - static_cast<int>(readlink(newName, buf, KWSYS_SYSTEMTOOLS_MAXPATH)); + static_cast<int>(readlink(newName.c_str(), buf, KWSYS_SYSTEMTOOLS_MAXPATH)); if(count >= 0) { // Add null-terminator. @@ -3136,14 +3172,14 @@ kwsys_stl::string SystemTools::GetCurrentWorkingDirectory(bool collapse) return path; } -kwsys_stl::string SystemTools::GetProgramPath(const char* in_name) +kwsys_stl::string SystemTools::GetProgramPath(const kwsys_stl::string& in_name) { kwsys_stl::string dir, file; SystemTools::SplitProgramPath(in_name, dir, file); return dir; } -bool SystemTools::SplitProgramPath(const char* in_name, +bool SystemTools::SplitProgramPath(const kwsys_stl::string& in_name, kwsys_stl::string& dir, kwsys_stl::string& file, bool) @@ -3409,7 +3445,62 @@ kwsys_stl::string SystemTools::CollapseFullPath(const kwsys_stl::string& in_path SystemTools::CheckTranslationPath(newPath); #ifdef _WIN32 - newPath = SystemTools::GetActualCaseForPath(newPath.c_str()); + newPath = SystemTools::GetActualCaseForPath(newPath); + SystemTools::ConvertToUnixSlashes(newPath); +#endif + // Return the reconstructed path. + return newPath; +} + +kwsys_stl::string SystemTools::CollapseFullPath(const kwsys_stl::string& in_path, + const kwsys_stl::string& in_base) +{ + // Collect the output path components. + kwsys_stl::vector<kwsys_stl::string> out_components; + + // Split the input path components. + kwsys_stl::vector<kwsys_stl::string> path_components; + SystemTools::SplitPath(in_path, path_components); + + // If the input path is relative, start with a base path. + if(path_components[0].length() == 0) + { + kwsys_stl::vector<kwsys_stl::string> base_components; + // Use the given base path. + SystemTools::SplitPath(in_base, base_components); + + // Append base path components to the output path. + out_components.push_back(base_components[0]); + SystemToolsAppendComponents(out_components, + base_components.begin()+1, + base_components.end()); + } + + // Append input path components to the output path. + SystemToolsAppendComponents(out_components, + path_components.begin(), + path_components.end()); + + // Transform the path back to a string. + kwsys_stl::string newPath = SystemTools::JoinPath(out_components); + + // Update the translation table with this potentially new path. I am not + // sure why this line is here, it seems really questionable, but yet I + // would put good money that if I remove it something will break, basically + // from what I can see it created a mapping from the collapsed path, to be + // replaced by the input path, which almost completely does the opposite of + // this function, the only thing preventing this from happening a lot is + // that if the in_path has a .. in it, then it is not added to the + // translation table. So for most calls this either does nothing due to the + // .. or it adds a translation between identical paths as nothing was + // collapsed, so I am going to try to comment it out, and see what hits the + // fan, hopefully quickly. + // Commented out line below: + //SystemTools::AddTranslationPath(newPath, in_path); + + SystemTools::CheckTranslationPath(newPath); +#ifdef _WIN32 + newPath = SystemTools::GetActualCaseForPath(newPath); SystemTools::ConvertToUnixSlashes(newPath); #endif // Return the reconstructed path. @@ -3569,7 +3660,7 @@ static int GetCasePathName(const kwsys_stl::string & pathIn, //---------------------------------------------------------------------------- -kwsys_stl::string SystemTools::GetActualCaseForPath(const char* p) +kwsys_stl::string SystemTools::GetActualCaseForPath(const kwsys_stl::string& p) { #ifndef _WIN32 return p; @@ -3930,7 +4021,7 @@ kwsys_stl::string SystemTools::GetFilenameName(const kwsys_stl::string& filename kwsys_stl::string SystemTools::GetFilenameExtension(const kwsys_stl::string& filename) { kwsys_stl::string name = SystemTools::GetFilenameName(filename); - kwsys_stl::string::size_type dot_pos = name.find("."); + kwsys_stl::string::size_type dot_pos = name.find('.'); if(dot_pos != kwsys_stl::string::npos) { return name.substr(dot_pos); @@ -3948,7 +4039,7 @@ kwsys_stl::string SystemTools::GetFilenameExtension(const kwsys_stl::string& fil kwsys_stl::string SystemTools::GetFilenameLastExtension(const kwsys_stl::string& filename) { kwsys_stl::string name = SystemTools::GetFilenameName(filename); - kwsys_stl::string::size_type dot_pos = name.rfind("."); + kwsys_stl::string::size_type dot_pos = name.rfind('.'); if(dot_pos != kwsys_stl::string::npos) { return name.substr(dot_pos); @@ -3966,7 +4057,7 @@ kwsys_stl::string SystemTools::GetFilenameLastExtension(const kwsys_stl::string& kwsys_stl::string SystemTools::GetFilenameWithoutExtension(const kwsys_stl::string& filename) { kwsys_stl::string name = SystemTools::GetFilenameName(filename); - kwsys_stl::string::size_type dot_pos = name.find("."); + kwsys_stl::string::size_type dot_pos = name.find('.'); if(dot_pos != kwsys_stl::string::npos) { return name.substr(0, dot_pos); @@ -3987,7 +4078,7 @@ kwsys_stl::string SystemTools::GetFilenameWithoutLastExtension(const kwsys_stl::string& filename) { kwsys_stl::string name = SystemTools::GetFilenameName(filename); - kwsys_stl::string::size_type dot_pos = name.rfind("."); + kwsys_stl::string::size_type dot_pos = name.rfind('.'); if(dot_pos != kwsys_stl::string::npos) { return name.substr(0, dot_pos); @@ -4276,7 +4367,7 @@ bool SystemTools::GetShortPath(const kwsys_stl::string& path, kwsys_stl::string& #endif } -void SystemTools::SplitProgramFromArgs(const char* path, +void SystemTools::SplitProgramFromArgs(const kwsys_stl::string& path, kwsys_stl::string& program, kwsys_stl::string& args) { // see if this is a full path to a program @@ -4352,7 +4443,7 @@ kwsys_stl::string SystemTools::GetCurrentDateTime(const char* format) return kwsys_stl::string(buf); } -kwsys_stl::string SystemTools::MakeCidentifier(const char* s) +kwsys_stl::string SystemTools::MakeCidentifier(const kwsys_stl::string& s) { kwsys_stl::string str(s); if (str.find_first_of("0123456789") == 0) diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in index e88bc8f..beb2a7e 100644 --- a/Source/kwsys/SystemTools.hxx.in +++ b/Source/kwsys/SystemTools.hxx.in @@ -89,9 +89,9 @@ public: * then an underscore is prepended. Note that this can produce * identifiers that the standard reserves (_[A-Z].* and __.*). */ - static kwsys_stl::string MakeCidentifier(const char* s); + static kwsys_stl::string MakeCidentifier(const kwsys_stl::string& s); - static kwsys_stl::string MakeCindentifier(const char* s) + static kwsys_stl::string MakeCindentifier(const kwsys_stl::string& s) { return MakeCidentifier(s); } @@ -102,6 +102,9 @@ public: static void ReplaceString(kwsys_stl::string& source, const char* replace, const char* with); + static void ReplaceString(kwsys_stl::string& source, + const kwsys_stl::string& replace, + const kwsys_stl::string& with); /** * Return a capitalized string (i.e the first letter is uppercased, @@ -306,7 +309,7 @@ public: /** * Return file length */ - static unsigned long FileLength(const char *filename); + static unsigned long FileLength(const kwsys_stl::string& filename); /** Change the modification time or create a file @@ -335,15 +338,15 @@ public: * does not exist path is returned unchanged. This does nothing * on unix but return path. */ - static kwsys_stl::string GetActualCaseForPath(const char* path); + static kwsys_stl::string GetActualCaseForPath(const kwsys_stl::string& path); /** * Given the path to a program executable, get the directory part of * the path with the file stripped off. If there is no directory * part, the empty string is returned. */ - static kwsys_stl::string GetProgramPath(const char*); - static bool SplitProgramPath(const char* in_name, + static kwsys_stl::string GetProgramPath(const kwsys_stl::string&); + static bool SplitProgramPath(const kwsys_stl::string& in_name, kwsys_stl::string& dir, kwsys_stl::string& file, bool errorReport = true); @@ -376,6 +379,8 @@ public: static kwsys_stl::string CollapseFullPath(const kwsys_stl::string& in_relative); static kwsys_stl::string CollapseFullPath(const kwsys_stl::string& in_relative, const char* in_base); + static kwsys_stl::string CollapseFullPath(const kwsys_stl::string& in_relative, + const kwsys_stl::string& in_base); /** * Get the real path for a given path, removing all symlinks. In @@ -446,7 +451,7 @@ public: * Split a program from its arguments and handle spaces in the paths */ static void SplitProgramFromArgs( - const char* path, + const kwsys_stl::string& path, kwsys_stl::string& program, kwsys_stl::string& args); /** @@ -582,7 +587,7 @@ public: * Find a file in the system PATH, with optional extra paths */ static kwsys_stl::string FindFile( - const char* name, + const kwsys_stl::string& name, const kwsys_stl::vector<kwsys_stl::string>& path = kwsys_stl::vector<kwsys_stl::string>(), bool no_system_path = false); @@ -591,7 +596,7 @@ public: * Find a directory in the system PATH, with optional extra paths */ static kwsys_stl::string FindDirectory( - const char* name, + const kwsys_stl::string& name, const kwsys_stl::vector<kwsys_stl::string>& path = kwsys_stl::vector<kwsys_stl::string>(), bool no_system_path = false); @@ -662,13 +667,13 @@ public: * Create a symbolic link if the platform supports it. Returns whether * creation succeded. */ - static bool CreateSymlink(const char* origName, const char* newName); + static bool CreateSymlink(const kwsys_stl::string& origName, const kwsys_stl::string& newName); /** * Read the contents of a symbolic link. Returns whether reading * succeded. */ - static bool ReadSymlink(const char* newName, kwsys_stl::string& origName); + static bool ReadSymlink(const kwsys_stl::string& newName, kwsys_stl::string& origName); /** * Try to locate the file 'filename' in the directory 'dir'. @@ -750,26 +755,26 @@ public: /** * Get a list of subkeys. */ - static bool GetRegistrySubKeys(const char *key, + static bool GetRegistrySubKeys(const kwsys_stl::string& key, kwsys_stl::vector<kwsys_stl::string>& subkeys, KeyWOW64 view = KeyWOW64_Default); /** * Read a registry value */ - static bool ReadRegistryValue(const char *key, kwsys_stl::string &value, + static bool ReadRegistryValue(const kwsys_stl::string& key, kwsys_stl::string &value, KeyWOW64 view = KeyWOW64_Default); /** * Write a registry value */ - static bool WriteRegistryValue(const char *key, const char *value, + static bool WriteRegistryValue(const kwsys_stl::string& key, const kwsys_stl::string& value, KeyWOW64 view = KeyWOW64_Default); /** * Delete a registry value */ - static bool DeleteRegistryValue(const char *key, + static bool DeleteRegistryValue(const kwsys_stl::string& key, KeyWOW64 view = KeyWOW64_Default); /** ----------------------------------------------------------------- @@ -789,15 +794,17 @@ public: * Read an environment variable */ static const char* GetEnv(const char* key); + static const char* GetEnv(const kwsys_stl::string& key); static bool GetEnv(const char* key, kwsys_stl::string& result); + static bool GetEnv(const kwsys_stl::string& key, kwsys_stl::string& result); /** Put a string into the environment of the form var=value */ - static bool PutEnv(const char* env); + static bool PutEnv(const kwsys_stl::string& env); /** Remove a string from the environment. Input is of the form "var" or "var=value" (value is ignored). */ - static bool UnPutEnv(const char* env); + static bool UnPutEnv(const kwsys_stl::string& env); /** * Get current working directory CWD @@ -906,6 +913,14 @@ private: } /** + * Actual implementation of ReplaceString. + */ + static void ReplaceString(kwsys_stl::string& source, + const char* replace, + size_t replaceSize, + const kwsys_stl::string& with); + + /** * Actual implementation of FileIsFullPath. */ static bool FileIsFullPath(const char*, size_t); @@ -915,7 +930,7 @@ private: * optional extra paths. */ static kwsys_stl::string FindName( - const char* name, + const kwsys_stl::string& name, const kwsys_stl::vector<kwsys_stl::string>& path = kwsys_stl::vector<kwsys_stl::string>(), bool no_system_path = false); diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx index b41532b..42b6249 100644 --- a/Source/kwsys/testSystemTools.cxx +++ b/Source/kwsys/testSystemTools.cxx @@ -124,7 +124,7 @@ static bool CheckFileOperations() res = false; } - if (kwsys::SystemTools::FileLength(testBinFile.c_str()) != 766) + if (kwsys::SystemTools::FileLength(testBinFile) != 766) { kwsys_ios::cerr << "Problem with FileLength - incorrect length for: " @@ -512,7 +512,7 @@ static bool CheckStringOperations() //---------------------------------------------------------------------------- -static bool CheckPutEnv(const char* env, const char* name, const char* value) +static bool CheckPutEnv(const kwsys_stl::string& env, const char* name, const char* value) { if(!kwsys::SystemTools::PutEnv(env)) { diff --git a/Tests/Assembler/CMakeLists.txt b/Tests/Assembler/CMakeLists.txt index fdc5c00..fb17ebb 100644 --- a/Tests/Assembler/CMakeLists.txt +++ b/Tests/Assembler/CMakeLists.txt @@ -9,7 +9,7 @@ set(SRCS) # and also generate assembler files from C: if("${CMAKE_GENERATOR}" MATCHES "Makefile|Xcode" AND NOT CMAKE_OSX_ARCHITECTURES) - if(("${CMAKE_C_COMPILER_ID}" MATCHES "^(GNU|Clang|AppleClang|HP|SunPro|XL)$") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel" AND UNIX)) + if((CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang|HP|SunPro|XL)$") OR (CMAKE_C_COMPILER_ID STREQUAL "Intel" AND UNIX)) set(C_FLAGS "${CMAKE_C_FLAGS}") separate_arguments(C_FLAGS) if(CMAKE_OSX_SYSROOT AND CMAKE_C_SYSROOT_FLAG AND NOT ";${C_FLAGS};" MATCHES ";${CMAKE_C_SYSROOT_FLAG};") diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 25cc846..ef3c4df 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1501,7 +1501,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set_tests_properties ( SimpleInstall-Stage2 PROPERTIES DEPENDS SimpleInstall) # Test static linking on toolchains known to support it. - if("${CMAKE_C_COMPILER_ID}" MATCHES "^(GNU)$" + if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT APPLE AND NOT WIN32 AND NOT CYGWIN AND EXISTS "/usr/lib/libm.a") add_test(LinkStatic ${CMAKE_CTEST_COMMAND} @@ -1781,6 +1781,27 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release endif() if(WIN32) + # Macro to search for available Windows CE SDKs in the windows Registry + macro(select_wince_sdk selected_reg selected_sdk) + if(CMAKE_HOST_WIN32) + execute_process(COMMAND reg QUERY "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows CE Tools\\SDKs" + OUTPUT_VARIABLE sdk_reg + ERROR_VARIABLE my_err) + string(REGEX REPLACE "HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Wow6432Node\\\\Microsoft\\\\Windows CE Tools\\\\SDKs\\\\" ";" sdk_list "${sdk_reg}") + list(LENGTH sdk_list sdk_list_len) + if (${sdk_list_len} GREATER 1) + list(GET sdk_list 1 _sdk) # The first entry is always empty due to the regex replace above + string(STRIP ${_sdk} _sdk) # Make sure there is no newline in the SDK name + endif() + # Build a key to be used by get_filename_component that is pointing to the SDK directory + set(_reg "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows CE Tools\\SDKs\\${_sdk}]") + + # Set return values + set(${selected_reg} ${_reg}) + set(${selected_sdk} ${_sdk}) + endif(CMAKE_HOST_WIN32) + endmacro(select_wince_sdk) + set(reg_vs10 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;InstallDir]") set(reg_vs11 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0;InstallDir]") set(reg_vs12 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\12.0;InstallDir]") @@ -1788,8 +1809,9 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set(reg_ws81 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.1;InstallationFolder]") set(reg_wp80 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\WindowsPhone\\v8.0;InstallationFolder]") set(reg_wp81 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\WindowsPhone\\v8.1;InstallationFolder]") + select_wince_sdk(reg_wince wince_sdk) set(reg_tegra "[HKEY_LOCAL_MACHINE\\SOFTWARE\\NVIDIA Corporation\\Nsight Tegra;sdkRoot]") - foreach(reg vs10 vs11 vs12 ws80 ws81 wp80 wp81 tegra) + foreach(reg vs10 vs11 vs12 ws80 ws81 wp80 wp81 wince tegra) get_filename_component(r "${reg_${reg}}" ABSOLUTE) if(IS_DIRECTORY "${r}") set(${reg} 1) @@ -1835,6 +1857,35 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release endif() endif() + if(WIN32 AND wince) + macro(add_test_VSWinCE name generator systemName systemVersion generatorPlatform) + # TODO: Fix the tutorial to make it work in cross compile + # currently the MakeTable is build for target and can not be used on the host + # This happens in part 5 so we build only part 1-4 of the tutorial + foreach(STP RANGE 1 4) + add_test(NAME "TutorialStep${STP}.${name}" COMMAND ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/Tutorial/Step${STP}" + "${CMake_BINARY_DIR}/Tests/Tutorial/Step${STP}_${name}" + --build-generator "${generator}" + --build-project Tutorial + --build-config $<CONFIGURATION> + --build-options -DCMAKE_SYSTEM_NAME=${systemName} + -DCMAKE_SYSTEM_VERSION=${systemVersion} + -DCMAKE_GENERATOR_PLATFORM=${generatorPlatform}) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Tutorial/Step${STP}_${name}") + endforeach() + endmacro() + + if(vs11) + add_test_VSWinCE(vs11-ce80-ARM "Visual Studio 11 2012" WindowsCE 8.0 ${wince_sdk}) + endif() + + if(vs12) + add_test_VSWinCE(vs12-ce80-ARM "Visual Studio 12 2013" WindowsCE 8.0 ${wince_sdk}) + endif() + endif() + if(tegra AND NOT "${CMake_SOURCE_DIR};${CMake_BINARY_DIR}" MATCHES " ") macro(add_test_VSNsightTegra name generator) add_test(NAME VSNsightTegra.${name} COMMAND ${CMAKE_CTEST_COMMAND} @@ -2339,6 +2390,42 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release "Process file.*CoverageTest.java.*Total LOC:.*17.*Percentage Coverage: 76.47*" ENVIRONMENT COVFILE=) + # Adding a test case for Javascript Coverage + configure_file( + "${CMake_SOURCE_DIR}/Tests/JavascriptCoverage/DartConfiguration.tcl.in" + "${CMake_BINARY_DIR}/Testing/JavascriptCoverage/DartConfiguration.tcl") + configure_file( + "${CMake_SOURCE_DIR}/Tests/JavascriptCoverage/output.json.in" + "${CMake_BINARY_DIR}/Testing/JavascriptCoverage/output.json") + file(COPY "${CMake_SOURCE_DIR}/Tests/JavascriptCoverage/" + DESTINATION "${CMake_BINARY_DIR}/Testing/JavascriptCoverage" + FILES_MATCHING PATTERN "*.js") + add_test(NAME CTestJavascriptCoverage + COMMAND cmake -E chdir + ${CMake_BINARY_DIR}/Testing/JavascriptCoverage + $<TARGET_FILE:ctest> -T Coverage --debug) + set_tests_properties(CTestJavascriptCoverage PROPERTIES + PASS_REGULAR_EXPRESSION + "Process file.*test3.js.*Total LOC:.*49.*Percentage Coverage: 79.59*" + ENVIRONMENT COVFILE=) + + # test coverage for Delphi-code-Coverage + configure_file( + "${CMake_SOURCE_DIR}/Tests/DelphiCoverage/DartConfiguration.tcl.in" + "${CMake_BINARY_DIR}/Testing/DelphiCoverage/DartConfiguration.tcl") + file(COPY "${CMake_SOURCE_DIR}/Tests/DelphiCoverage/src" + DESTINATION "${CMake_BINARY_DIR}/Testing/DelphiCoverage") + file(COPY "${CMake_SOURCE_DIR}/Tests/DelphiCoverage/UTCovTest(UTCovTest.pas).html" + DESTINATION "${CMake_BINARY_DIR}/Testing/DelphiCoverage") + add_test(NAME CTestDelphiCoverage + COMMAND cmake -E chdir + ${CMake_BINARY_DIR}/Testing/DelphiCoverage + $<TARGET_FILE:ctest> -T Coverage --debug) + set_tests_properties(CTestDelphiCoverage PROPERTIES + PASS_REGULAR_EXPRESSION + "Process file.*UTCovTest.pas.*Total LOC:.*20.*Percentage Coverage: 95.*" + ENVIRONMENT COVFILE=) + function(add_config_tests cfg) set(base "${CMake_BINARY_DIR}/Tests/CTestConfig") diff --git a/Tests/CMakeTests/VersionTest.cmake.in b/Tests/CMakeTests/VersionTest.cmake.in index 9e31cb4..4e946ab 100644 --- a/Tests/CMakeTests/VersionTest.cmake.in +++ b/Tests/CMakeTests/VersionTest.cmake.in @@ -8,9 +8,85 @@ else() message("CMAKE_VERSION=[${CMAKE_VERSION}] is not less than [${min_ver}]") endif() -set(v 1.2.3.4.5.6.7) -if("${v}.8" VERSION_LESS "${v}.9") - message(STATUS "${v}.8 is less than ${v}.9") -else() - message(FATAL_ERROR "${v}.8 is not less than ${v}.9?") -endif() +set(EQUALV "1 1") +list(APPEND EQUALV "1.0 1") +list(APPEND EQUALV "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 1") +list(APPEND EQUALV "1.2.3.4.5.6.7 1.2.3.4.5.6.7") +list(APPEND EQUALV "1.2.3.4.5.6.7.8.9 1.2.3.4.5.6.7.8.9") + +foreach(v IN LISTS EQUALV) + string(REGEX MATCH "(.*) (.*)" _dummy "${v}") + # modify any of the operands to see the negative check also works + if("${CMAKE_MATCH_1}.2" VERSION_EQUAL CMAKE_MATCH_2) + message(FATAL_ERROR "${CMAKE_MATCH_1}.2 is equal ${CMAKE_MATCH_2}?") + else() + message(STATUS "${CMAKE_MATCH_1}.2 is not equal ${CMAKE_MATCH_2}") + endif() + + if(CMAKE_MATCH_1 VERSION_EQUAL "${CMAKE_MATCH_2}.2") + message(FATAL_ERROR "${CMAKE_MATCH_1} is equal ${CMAKE_MATCH_2}.2?") + else() + message(STATUS "${CMAKE_MATCH_1} is not equal ${CMAKE_MATCH_2}.2") + endif() +endforeach() + +# test the negative outcomes first, due to the implementation the positive +# allow some additional strings to pass that would not fail for the negative +# tests + +list(APPEND EQUALV "1a 1") +list(APPEND EQUALV "1.1a 1.1") +list(APPEND EQUALV "1.0a 1") +list(APPEND EQUALV "1a 1.0") + +foreach(v IN LISTS EQUALV) + # check equal versions + string(REGEX MATCH "(.*) (.*)" _dummy "${v}") + if(CMAKE_MATCH_1 VERSION_EQUAL CMAKE_MATCH_2) + message(STATUS "${CMAKE_MATCH_1} is equal ${CMAKE_MATCH_2}") + else() + message(FATAL_ERROR "${CMAKE_MATCH_1} is not equal ${CMAKE_MATCH_2}?") + endif() + + # still equal, but inverted order of operands + string(REGEX MATCH "(.*) (.*)" _dummy "${v}") + if(CMAKE_MATCH_2 VERSION_EQUAL CMAKE_MATCH_1) + message(STATUS "${CMAKE_MATCH_2} is equal ${CMAKE_MATCH_1}") + else() + message(FATAL_ERROR "${CMAKE_MATCH_2} is not equal ${CMAKE_MATCH_1}?") + endif() +endforeach() + +set(LESSV "1.2.3.4.5.6.7.8 1.2.3.4.5.6.7.9") +list(APPEND LESSV "1.2.3.4.5.6.7 1.2.3.4.5.6.7.9") +list(APPEND LESSV "1 1.0.0.1") +foreach(v IN LISTS LESSV) + string(REGEX MATCH "(.*) (.*)" _dummy "${v}") + # check less + if(CMAKE_MATCH_1 VERSION_LESS CMAKE_MATCH_2) + message(STATUS "${CMAKE_MATCH_1} is less than ${CMAKE_MATCH_2}") + else() + message(FATAL_ERROR "${CMAKE_MATCH_1} is not less than ${CMAKE_MATCH_2}?") + endif() + + # check greater + if(CMAKE_MATCH_2 VERSION_GREATER CMAKE_MATCH_1) + message(STATUS "${CMAKE_MATCH_2} is greater than ${CMAKE_MATCH_1}") + else() + message(FATAL_ERROR "${CMAKE_MATCH_2} is not greater than ${CMAKE_MATCH_1}?") + endif() + + # check less negative case + if(NOT CMAKE_MATCH_2 VERSION_LESS CMAKE_MATCH_1) + message(STATUS "${CMAKE_MATCH_2} is not less than ${CMAKE_MATCH_1}") + else() + message(FATAL_ERROR "${CMAKE_MATCH_2} is less than ${CMAKE_MATCH_1}?") + endif() + + # check greater negative case + if(NOT CMAKE_MATCH_1 VERSION_GREATER CMAKE_MATCH_2) + message(STATUS "${CMAKE_MATCH_1} is not greater than ${CMAKE_MATCH_2}") + else() + message(FATAL_ERROR "${CMAKE_MATCH_1} is greater than ${CMAKE_MATCH_2}?") + endif() +endforeach() diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in index 450c204..8c01b32 100644 --- a/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in +++ b/Tests/CPackComponentsForAll/MyLibCPackConfig-IgnoreGroup.cmake.in @@ -8,6 +8,13 @@ endif() if(CPACK_GENERATOR MATCHES "RPM") set(CPACK_RPM_COMPONENT_INSTALL "ON") set(CPACK_RPM_applications_PACKAGE_REQUIRES "mylib-libraries") + + # test package summary override + set(CPACK_RPM_PACKAGE_SUMMARY "default summary") + set(CPACK_RPM_libraries_PACKAGE_SUMMARY "libraries summary") + + # test package description override + set(CPACK_RPM_libraries_PACKAGE_DESCRIPTION "libraries description") endif() if(CPACK_GENERATOR MATCHES "DEB") @@ -20,4 +27,4 @@ endif() #set(CPACK_COMPONENTS_ALL_GROUPS_IN_ONE_PACKAGE) #set(CPACK_COMPONENTS_GROUPING) set(CPACK_COMPONENTS_IGNORE_GROUPS 1) -#set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1)
\ No newline at end of file +#set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1) diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake index 0b6d07d..4d56218 100644 --- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake +++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake @@ -123,3 +123,62 @@ if(expected_file_mask) message(FATAL_ERROR "error: expected_count=${expected_count} does not match actual_count=${actual_count}: CPackComponents test fails. (CPack_output=${CPack_output}, CPack_error=${CPack_error})") endif() endif() + +# Validate content +if(CPackGen MATCHES "RPM") + find_program(RPM_EXECUTABLE rpm) + if(NOT RPM_EXECUTABLE) + message(FATAL_ERROR "error: missing rpm executable required by the test") + endif() + + set(CPACK_RPM_PACKAGE_SUMMARY "default summary") + set(CPACK_RPM_libraries_PACKAGE_SUMMARY "libraries summary") + set(CPACK_RPM_libraries_PACKAGE_DESCRIPTION "libraries description") + set(CPACK_COMPONENT_APPLICATIONS_DESCRIPTION + "An extremely useful application that makes use of MyLib") + set(CPACK_COMPONENT_HEADERS_DESCRIPTION + "C/C\\+\\+ header files for use with MyLib") + + if(${CPackComponentWay} STREQUAL "IgnoreGroup") + foreach(check_file ${expected_file}) + string(REGEX MATCH ".*libraries.*" check_file_libraries_match ${check_file}) + string(REGEX MATCH ".*headers.*" check_file_headers_match ${check_file}) + string(REGEX MATCH ".*applications.*" check_file_applications_match ${check_file}) + string(REGEX MATCH ".*Unspecified.*" check_file_Unspecified_match ${check_file}) + + execute_process(COMMAND ${RPM_EXECUTABLE} -pqi ${check_file} + OUTPUT_VARIABLE check_file_content + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + + if(check_file_libraries_match) + set(check_file_match_expected_summary ".*${CPACK_RPM_libraries_PACKAGE_SUMMARY}.*") + set(check_file_match_expected_description ".*${CPACK_RPM_libraries_PACKAGE_DESCRIPTION}.*") + elseif(check_file_headers_match) + set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") + set(check_file_match_expected_description ".*${CPACK_COMPONENT_HEADERS_DESCRIPTION}.*") + elseif(check_file_applications_match) + set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") + set(check_file_match_expected_description ".*${CPACK_COMPONENT_APPLICATIONS_DESCRIPTION}.*") + elseif(check_file_Unspecified_match) + set(check_file_match_expected_summary ".*${CPACK_RPM_PACKAGE_SUMMARY}.*") + set(check_file_match_expected_description ".*DESCRIPTION.*") + else() + message(FATAL_ERROR "error: unexpected rpm package '${check_file}'") + endif() + + string(REGEX MATCH ${check_file_match_expected_summary} check_file_match_summary ${check_file_content}) + + if(NOT check_file_match_summary) + message(FATAL_ERROR "error: '${check_file}' rpm package summary does not match expected value - regex '${check_file_match_expected_summary}'") + endif() + + string(REGEX MATCH ${check_file_match_expected_description} check_file_match_description ${check_file_content}) + + if(NOT check_file_match_description) + message(FATAL_ERROR "error: '${check_file}' rpm package description does not match expected value - regex '${check_file_match_expected_description}'") + endif() + endforeach() + elseif(${CPackComponentWay} STREQUAL "IgnoreGroup") + endif() +endif() diff --git a/Tests/DelphiCoverage/DartConfiguration.tcl.in b/Tests/DelphiCoverage/DartConfiguration.tcl.in new file mode 100644 index 0000000..4edcea6 --- /dev/null +++ b/Tests/DelphiCoverage/DartConfiguration.tcl.in @@ -0,0 +1,8 @@ +# This file is configured by CMake automatically as DartConfiguration.tcl +# If you choose not to use CMake, this file may be hand configured, by +# filling in the required variables. + + +# Configuration directories and files +SourceDirectory: ${CMake_BINARY_DIR}/Testing/DelphiCoverage +BuildDirectory: ${CMake_BINARY_DIR}/Testing/DelphiCoverage diff --git a/Tests/DelphiCoverage/UTCovTest(UTCovTest.pas).html b/Tests/DelphiCoverage/UTCovTest(UTCovTest.pas).html new file mode 100644 index 0000000..9caaea3 --- /dev/null +++ b/Tests/DelphiCoverage/UTCovTest(UTCovTest.pas).html @@ -0,0 +1,117 @@ +<!DOCTYPE html> +<html> +<head> + <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> + <title>Delphi CodeCoverage Coverage Report</title> +<style type="text/css"> +table {border-spacing:0; border-collapse:collapse;} +table, td, th {border: 1px solid black;} +td, th {background: white; margin: 0; padding: 2px 0.5em 2px 0.5em} +td {border-width: 0 1px 0 0;} +th {border-width: 1px 1px 1px 0;} +p, h1, h2, h3, th {font-family: verdana,arial,sans-serif; font-size: 10pt;} +td {font-family: courier,monospace; font-size: 10pt;} +th {background: #CCCCCC;} +table.o tr td:nth-child(1) {font-weight: bold;} +table.o tr td:nth-child(2) {text-align: right;} +table.o tr td {border-width: 1px;} +table.s {width: 100%;} +table.s tr td {padding: 0 0.25em 0 0.25em;} +table.s tr td:first-child {text-align: right; font-weight: bold;} +table.s tr.notcovered td {background: #DDDDFF;} +table.s tr.nocodegen td {background: #FFFFEE;} +table.s tr.covered td {background: #CCFFCC;} +table.s tr.covered td:first-child {color: green;} +table.s {border-width: 1px 0 1px 1px;} +table.sum tr td {border-width: 1px;} +table.sum tr th {text-align:right;} +table.sum tr th:first-child {text-align:center;} +table.sum tr td {text-align:right;} +table.sum tr td:first-child {text-align:left;} +</style> +</head> +<body> +<p>Coverage report for <strong>UTCovTest (C:\Users\joe.snyder\Work\OSEHRA\VistA\Packages\Order Entry Results Reporting\CPRS\Testing\Tests\UTCovTest.pas)</strong>.</p> +<p> Generated at 10/3/2014 12:24:11 PM by <a href="http://code.google.com/p/delphi-code-coverage/" title="Code Coverage for Delphi 5+">DelphiCodeCoverage</a> - an open source tool for Delphi Code Coverage.</p> +<p> Statistics for C:\Users\joe.snyder\Work\OSEHRA\VistA\Packages\Order Entry Results Reporting\CPRS\Testing\Tests\UTCovTest.pas </p> +<table class="o"><tr><td>Number of lines covered</td><td>19</td></tr><tr><td>Number of lines with code gen</td><td>19</td></tr><tr><td>Line coverage</td><td>100%</td></tr></table> +<br /><br /> +<table class="s"> +<tr class="nocodegen"><td>1</td><td><pre style="display:inline;">//---------------------------------------------------------------------------</pre></td></tr> +<tr class="nocodegen"><td>2</td><td><pre style="display:inline;">// Copyright 2012 The Open Source Electronic Health Record Agent</pre></td></tr> +<tr class="nocodegen"><td>3</td><td><pre style="display:inline;">//</pre></td></tr> +<tr class="nocodegen"><td>4</td><td><pre style="display:inline;">// Licensed under the Apache License, Version 2.0 (the "License");</pre></td></tr> +<tr class="nocodegen"><td>5</td><td><pre style="display:inline;">// you may not use this file except in compliance with the License.</pre></td></tr> +<tr class="nocodegen"><td>6</td><td><pre style="display:inline;">// You may obtain a copy of the License at</pre></td></tr> +<tr class="nocodegen"><td>7</td><td><pre style="display:inline;">//</pre></td></tr> +<tr class="nocodegen"><td>8</td><td><pre style="display:inline;">// http://www.apache.org/licenses/LICENSE-2.0</pre></td></tr> +<tr class="nocodegen"><td>9</td><td><pre style="display:inline;">//</pre></td></tr> +<tr class="nocodegen"><td>10</td><td><pre style="display:inline;">// Unless required by applicable law or agreed to in writing, software</pre></td></tr> +<tr class="nocodegen"><td>11</td><td><pre style="display:inline;">// distributed under the License is distributed on an "AS IS" BASIS,</pre></td></tr> +<tr class="nocodegen"><td>12</td><td><pre style="display:inline;">// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</pre></td></tr> +<tr class="nocodegen"><td>13</td><td><pre style="display:inline;">// See the License for the specific language governing permissions and</pre></td></tr> +<tr class="nocodegen"><td>14</td><td><pre style="display:inline;">// limitations under the License.</pre></td></tr> +<tr class="nocodegen"><td>15</td><td><pre style="display:inline;">//---------------------------------------------------------------------------</pre></td></tr> +<tr class="nocodegen"><td>16</td><td><pre style="display:inline;">unit UTCovTest;</pre></td></tr> +<tr class="nocodegen"><td>17</td><td><pre style="display:inline;">interface</pre></td></tr> +<tr class="nocodegen"><td>18</td><td><pre style="display:inline;">uses UnitTest, TestFrameWork,SysUtils,Windows;</pre></td></tr> +<tr class="nocodegen"><td>19</td><td><pre style="display:inline;"></pre></td></tr> +<tr class="nocodegen"><td>20</td><td><pre style="display:inline;">implementation</pre></td></tr> +<tr class="nocodegen"><td>21</td><td><pre style="display:inline;">type</pre></td></tr> +<tr class="nocodegen"><td>22</td><td><pre style="display:inline;">UTCovTestTests=class(TTestCase)</pre></td></tr> +<tr class="nocodegen"><td>23</td><td><pre style="display:inline;"> public</pre></td></tr> +<tr class="nocodegen"><td>24</td><td><pre style="display:inline;"> procedure SetUp; override;</pre></td></tr> +<tr class="nocodegen"><td>25</td><td><pre style="display:inline;"> procedure TearDown; override;</pre></td></tr> +<tr class="nocodegen"><td>26</td><td><pre style="display:inline;"></pre></td></tr> +<tr class="nocodegen"><td>27</td><td><pre style="display:inline;"> published</pre></td></tr> +<tr class="nocodegen"><td>28</td><td><pre style="display:inline;"> procedure TestCov1;</pre></td></tr> +<tr class="nocodegen"><td>29</td><td><pre style="display:inline;"> procedure TestCov2;</pre></td></tr> +<tr class="nocodegen"><td>30</td><td><pre style="display:inline;"> procedure TestCov3;</pre></td></tr> +<tr class="nocodegen"><td>31</td><td><pre style="display:inline;"> end;</pre></td></tr> +<tr class="nocodegen"><td>32</td><td><pre style="display:inline;"></pre></td></tr> +<tr class="nocodegen"><td>33</td><td><pre style="display:inline;">procedure NotRun;</pre></td></tr> +<tr class="nocodegen"><td>34</td><td><pre style="display:inline;">begin</pre></td></tr> +<tr class="nocodegen"><td>35</td><td><pre style="display:inline;"> WriteLn('This line will never run');</pre></td></tr> +<tr class="nocodegen"><td>36</td><td><pre style="display:inline;">end;</pre></td></tr> +<tr class="nocodegen"><td>37</td><td><pre style="display:inline;">procedure UTCovTestTests.SetUp;</pre></td></tr> +<tr class="nocodegen"><td>38</td><td><pre style="display:inline;">begin</pre></td></tr> +<tr class="covered"><td>39</td><td><pre style="display:inline;">end;</pre></td></tr> +<tr class="nocodegen"><td>40</td><td><pre style="display:inline;"></pre></td></tr> +<tr class="nocodegen"><td>41</td><td><pre style="display:inline;">procedure UTCovTestTests.TearDown;</pre></td></tr> +<tr class="nocodegen"><td>42</td><td><pre style="display:inline;">begin</pre></td></tr> +<tr class="covered"><td>43</td><td><pre style="display:inline;">end;</pre></td></tr> +<tr class="nocodegen"><td>44</td><td><pre style="display:inline;"></pre></td></tr> +<tr class="nocodegen"><td>45</td><td><pre style="display:inline;">procedure UTCovTestTests.TestCov1;</pre></td></tr> +<tr class="covered"><td>46</td><td><pre style="display:inline;">begin</pre></td></tr> +<tr class="nocodegen"><td>47</td><td><pre style="display:inline;"> {</pre></td></tr> +<tr class="nocodegen"><td>48</td><td><pre style="display:inline;"> Block comment lines</pre></td></tr> +<tr class="nocodegen"><td>49</td><td><pre style="display:inline;"> }</pre></td></tr> +<tr class="covered"><td>50</td><td><pre style="display:inline;"> CheckEquals(1,2-1);</pre></td></tr> +<tr class="covered"><td>51</td><td><pre style="display:inline;">end;</pre></td></tr> +<tr class="nocodegen"><td>52</td><td><pre style="display:inline;"></pre></td></tr> +<tr class="nocodegen"><td>53</td><td><pre style="display:inline;">procedure UTCovTestTests.TestCov2;</pre></td></tr> +<tr class="nocodegen"><td>54</td><td><pre style="display:inline;">var</pre></td></tr> +<tr class="nocodegen"><td>55</td><td><pre style="display:inline;"> i:DWORD;</pre></td></tr> +<tr class="covered"><td>56</td><td><pre style="display:inline;">begin</pre></td></tr> +<tr class="covered"><td>57</td><td><pre style="display:inline;"> for i := 0 to 1 do</pre></td></tr> +<tr class="covered"><td>58</td><td><pre style="display:inline;"> WriteLn( IntToStr(i));</pre></td></tr> +<tr class="nocodegen"><td>59</td><td><pre style="display:inline;"> // Comment</pre></td></tr> +<tr class="covered"><td>60</td><td><pre style="display:inline;"> CheckEquals(i,2);</pre></td></tr> +<tr class="covered"><td>61</td><td><pre style="display:inline;">end;</pre></td></tr> +<tr class="nocodegen"><td>62</td><td><pre style="display:inline;"></pre></td></tr> +<tr class="nocodegen"><td>63</td><td><pre style="display:inline;">procedure UTCovTestTests.TestCov3;</pre></td></tr> +<tr class="nocodegen"><td>64</td><td><pre style="display:inline;">var</pre></td></tr> +<tr class="nocodegen"><td>65</td><td><pre style="display:inline;"> i : DWORD;</pre></td></tr> +<tr class="covered"><td>66</td><td><pre style="display:inline;">begin</pre></td></tr> +<tr class="covered"><td>67</td><td><pre style="display:inline;"> i := 0;</pre></td></tr> +<tr class="covered"><td>68</td><td><pre style="display:inline;"> while i < 5 do</pre></td></tr> +<tr class="covered"><td>69</td><td><pre style="display:inline;"> i := i+1;</pre></td></tr> +<tr class="covered"><td>70</td><td><pre style="display:inline;"> CheckEquals(i,5);</pre></td></tr> +<tr class="covered"><td>71</td><td><pre style="display:inline;">end;</pre></td></tr> +<tr class="nocodegen"><td>72</td><td><pre style="display:inline;"></pre></td></tr> +<tr class="covered"><td>73</td><td><pre style="display:inline;">begin</pre></td></tr> +<tr class="covered"><td>74</td><td><pre style="display:inline;"> UnitTest.addSuite(UTCovTestTests.Suite);</pre></td></tr> +<tr class="covered"><td>75</td><td><pre style="display:inline;">end.</pre></td></tr> +</table> +</body> +</html> diff --git a/Tests/DelphiCoverage/src/UTCovTest.pas b/Tests/DelphiCoverage/src/UTCovTest.pas new file mode 100644 index 0000000..66db3c0 --- /dev/null +++ b/Tests/DelphiCoverage/src/UTCovTest.pas @@ -0,0 +1,75 @@ +//--------------------------------------------------------------------------- +// Copyright 2012 The Open Source Electronic Health Record Agent +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//--------------------------------------------------------------------------- +unit UTCovTest; +interface +uses UnitTest, TestFrameWork,SysUtils,Windows; + +implementation +type +UTCovTestTests=class(TTestCase) + public + procedure SetUp; override; + procedure TearDown; override; + + published + procedure TestCov1; + procedure TestCov2; + procedure TestCov3; + end; + +procedure NotRun; +begin + WriteLn('This line will never run'); +end; +procedure UTCovTestTests.SetUp; +begin +end; + +procedure UTCovTestTests.TearDown; +begin +end; + +procedure UTCovTestTests.TestCov1; +begin + { + Block comment lines + } + CheckEquals(1,2-1); +end; + +procedure UTCovTestTests.TestCov2; +var + i:DWORD; +begin + for i := 0 to 1 do + WriteLn( IntToStr(i)); + // Comment + CheckEquals(i,2); +end; + +procedure UTCovTestTests.TestCov3; +var + i : DWORD; +begin + i := 0; + while i < 5 do + i := i+1; + CheckEquals(i,5); +end; + +begin + UnitTest.addSuite(UTCovTestTests.Suite); +end.
\ No newline at end of file diff --git a/Tests/ExternalProjectLocal/CMakeLists.txt b/Tests/ExternalProjectLocal/CMakeLists.txt index f942197..cbbb555 100644 --- a/Tests/ExternalProjectLocal/CMakeLists.txt +++ b/Tests/ExternalProjectLocal/CMakeLists.txt @@ -66,6 +66,7 @@ if(can_build_tutorial_step5) ExternalProject_Add(${proj} URL "${CMAKE_CURRENT_SOURCE_DIR}/../Tutorial/Step5" CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -G ${CMAKE_GENERATOR} <SOURCE_DIR> + CMAKE_CACHE_DEFAULT_ARGS -DUSE_MYMATH:BOOL=OFF TEST_AFTER_INSTALL 1 LOG_TEST 1 ) diff --git a/Tests/ExternalProjectUpdate/CMakeLists.txt b/Tests/ExternalProjectUpdate/CMakeLists.txt index c33e90b..582b0a8 100644 --- a/Tests/ExternalProjectUpdate/CMakeLists.txt +++ b/Tests/ExternalProjectUpdate/CMakeLists.txt @@ -19,6 +19,7 @@ set(base "${CMAKE_BINARY_DIR}/CMakeExternals") set(binary_base "${base}/Build") set_property(DIRECTORY PROPERTY EP_BASE ${base}) set_property(DIRECTORY PROPERTY EP_STEP_TARGETS configure build test) +set_property(DIRECTORY PROPERTY EP_INDEPENDENT_STEP_TARGETS update) set(do_git_tests 0) @@ -68,8 +69,8 @@ if(do_git_tests) CMAKE_GENERATOR "${CMAKE_GENERATOR}" CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> INSTALL_COMMAND "" - DEPENDS "SetupLocalGITRepository" ) + ExternalProject_Add_StepDependencies(${proj} download SetupLocalGITRepository) set_property(TARGET ${proj} PROPERTY FOLDER "GIT") endif() diff --git a/Tests/ForceInclude/CMakeLists.txt b/Tests/ForceInclude/CMakeLists.txt index 5c02ebb..e231054 100644 --- a/Tests/ForceInclude/CMakeLists.txt +++ b/Tests/ForceInclude/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8.3.20110103) project(ForceInclude C) # Make sure the proper compiler is in use. -if(NOT MSVC AND NOT "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$") +if(NOT MSVC AND NOT CMAKE_C_COMPILER_ID STREQUAL "Intel") message(FATAL_ERROR "The ForceInclude test works only with MSVC or Intel") endif() diff --git a/Tests/Fortran/CMakeLists.txt b/Tests/Fortran/CMakeLists.txt index 1982a60..8700c94 100644 --- a/Tests/Fortran/CMakeLists.txt +++ b/Tests/Fortran/CMakeLists.txt @@ -13,11 +13,11 @@ message("CMAKE_Fortran_COMPILER = ${CMAKE_Fortran_COMPILER}") message("CMAKE_Fortran_FLAGS = ${CMAKE_Fortran_FLAGS}") set(_SHARED SHARED) -if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "^(XL|VisualAge)$") +if(CMAKE_Fortran_COMPILER_ID MATCHES "^(XL|VisualAge)$") # We do not implement SHARED Fortran libs on AIX yet! # Workaround: Set LINKER_LANGUAGE to C, which uses 'xlc' and Fortran implicits. set(_SHARED STATIC) -elseif("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU") +elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") # g77 2.96 does not support shared libs on Itanium because g2c is not -fPIC execute_process(COMMAND ${CMAKE_Fortran_COMPILER} --version OUTPUT_VARIABLE output ERROR_VARIABLE output) @@ -29,10 +29,10 @@ endif() # Pick a module .def file with the properly mangled symbol name. set(world_def "") if(WIN32 AND NOT CYGWIN) - if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU") + if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") set(world_def world_gnu.def) - elseif("${CMAKE_Fortran_COMPILER_ID}" MATCHES "Intel" OR - "${CMAKE_GENERATOR}" MATCHES "Visual Studio") # Intel plugin + elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Intel" OR + CMAKE_GENERATOR MATCHES "Visual Studio") # Intel plugin set(world_def world_icl.def) endif() endif() @@ -119,7 +119,7 @@ endfunction() # call the test_fortran_c_interface_module function if("${CMAKE_Fortran_COMPILER_ID}:${CMAKE_C_COMPILER_ID}" MATCHES "(Intel:MSVC|Absoft:GNU)" - OR ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "${CMAKE_C_COMPILER_ID}" )) + OR (CMAKE_Fortran_COMPILER_ID MATCHES CMAKE_C_COMPILER_ID )) test_fortran_c_interface_module() else() message("Fortran does not match c compiler") @@ -128,7 +128,7 @@ else() # hack to make g77 work after CL has been enabled # as a languge, cmake needs language specific versions # of these variables.... - if(WIN32 AND "${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU") + if(WIN32 AND CMAKE_Fortran_COMPILER_ID MATCHES "GNU") set(CMAKE_CREATE_CONSOLE_EXE ) set(CMAKE_LIBRARY_PATH_FLAG "-L") set(CMAKE_LINK_LIBRARY_FLAG "-l") @@ -137,8 +137,8 @@ else() # gnu and sunpro do not use the same flags here... # however if LDFLAGS is used to set -m64 it causes odd stuf # with the fortran build - if( ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU") - AND ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "SunPro")) + if( (CMAKE_C_COMPILER_ID MATCHES "GNU") + AND (CMAKE_Fortran_COMPILER_ID MATCHES "SunPro")) set(CMAKE_EXE_LINKER_FLAGS "") set(CMAKE_Fortran_FLAGS "") endif() diff --git a/Tests/FortranC/CMakeLists.txt b/Tests/FortranC/CMakeLists.txt index f335583..79c670d 100644 --- a/Tests/FortranC/CMakeLists.txt +++ b/Tests/FortranC/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8) project(FortranC C Fortran) # Skip this test for compilers not known to be compatible. -if(NOT ("${CMAKE_C_COMPILER_ID}" STREQUAL "${CMAKE_Fortran_COMPILER_ID}" OR +if(NOT (CMAKE_C_COMPILER_ID STREQUAL CMAKE_Fortran_COMPILER_ID OR "${CMAKE_C_COMPILER_ID}-${CMAKE_Fortran_COMPILER_ID}" MATCHES "^(MSVC-Intel)$")) message(STATUS "${CMAKE_C_COMPILER_ID} C and ${CMAKE_Fortran_COMPILER_ID} Fortran not known to be compatible!") return() diff --git a/Tests/JavascriptCoverage/DartConfiguration.tcl.in b/Tests/JavascriptCoverage/DartConfiguration.tcl.in new file mode 100644 index 0000000..f94d988 --- /dev/null +++ b/Tests/JavascriptCoverage/DartConfiguration.tcl.in @@ -0,0 +1,8 @@ +# This file is configured by CMake automatically as DartConfiguration.tcl +# If you choose not to use CMake, this file may be hand configured, by +# filling in the required variables. + + +# Configuration directories and files +SourceDirectory: ${CMake_BINARY_DIR}/Testing/JavascriptCoverage +BuildDirectory: ${CMake_BINARY_DIR}/Testing/JavascriptCoverage diff --git a/Tests/JavascriptCoverage/output.json.in b/Tests/JavascriptCoverage/output.json.in new file mode 100644 index 0000000..717cffe --- /dev/null +++ b/Tests/JavascriptCoverage/output.json.in @@ -0,0 +1,448 @@ +{ + "instrumentation": "node-jscoverage", + "sloc": 29, + "hits": 28, + "misses": 1, + "coverage": 96.55172413793103, + "files": [ + { + "filename": "${CMake_BINARY_DIR}/Testing/JavascriptCoverage/test.js", + "coverage": 96.55172413793103, + "hits": 28, + "misses": 1, + "sloc": 29, + "source": { + "1": { + "source": "var assert = require(\"assert\")", + "coverage": 1 + }, + "2": { + "source": "var test = {", + "coverage": 1 + }, + "3": { + "source": " version: \"1.0.0\"", + "coverage": "" + }, + "4": { + "source": "}", + "coverage": "" + }, + "5": { + "source": "function covTest(p1,p2) {", + "coverage": 1 + }, + "6": { + "source": " if (p1 > 3) {", + "coverage": 2 + }, + "7": { + "source": " return 1;", + "coverage": 1 + }, + "8": { + "source": " }", + "coverage": "" + }, + "9": { + "source": " else {", + "coverage": "" + }, + "10": { + "source": " return p1 + p2;", + "coverage": 1 + }, + "11": { + "source": " }", + "coverage": "" + }, + "12": { + "source": "}", + "coverage": "" + }, + "13": { + "source": "", + "coverage": "" + }, + "14": { + "source": "function covTest2(p1,p2) {", + "coverage": 1 + }, + "15": { + "source": " return 0;", + "coverage": 0 + }, + "16": { + "source": "}", + "coverage": "" + }, + "17": { + "source": "", + "coverage": "" + }, + "18": { + "source": "function covTest3(p1) {", + "coverage": 1 + }, + "19": { + "source": " for(i=0;i < p1;i++){", + "coverage": 1 + }, + "20": { + "source": " }", + "coverage": "" + }, + "21": { + "source": " return i;", + "coverage": 1 + }, + "22": { + "source": "}", + "coverage": "" + }, + "23": { + "source": "function covTest4(p1) {", + "coverage": 1 + }, + "24": { + "source": " i=0;", + "coverage": 1 + }, + "25": { + "source": " while(i < p1){", + "coverage": 1 + }, + "26": { + "source": " i++;", + "coverage": 5 + }, + "27": { + "source": " }", + "coverage": "" + }, + "28": { + "source": " return i;", + "coverage": 1 + }, + "29": { + "source": "}", + "coverage": "" + }, + "30": { + "source": "", + "coverage": "" + }, + "31": { + "source": "describe('Array', function(){", + "coverage": 1 + }, + "32": { + "source": " describe('CovTest', function(){", + "coverage": 1 + }, + "33": { + "source": " it('should return when the value is not present', function(){", + "coverage": 1 + }, + "34": { + "source": " assert.equal(4,covTest(2,2));", + "coverage": 1 + }, + "35": { + "source": " })", + "coverage": "" + }, + "36": { + "source": " })", + "coverage": "" + }, + "37": { + "source": " ", + "coverage": "" + }, + "38": { + "source": " describe('CovTest>3', function(){", + "coverage": 1 + }, + "39": { + "source": " it('should return when the value is not present', function(){", + "coverage": 1 + }, + "40": { + "source": " assert.equal(1,covTest(4,2));", + "coverage": 1 + }, + "41": { + "source": " })", + "coverage": "" + }, + "42": { + "source": " })", + "coverage": "" + }, + "43": { + "source": " describe('covTest4', function(){", + "coverage": 1 + }, + "44": { + "source": " it('should return when the value is not present', function(){", + "coverage": 1 + }, + "45": { + "source": " assert.equal(5,covTest4(5));", + "coverage": 1 + }, + "46": { + "source": " })", + "coverage": "" + }, + "47": { + "source": " })", + "coverage": "" + }, + "48": { + "source": " describe('covTest3', function(){", + "coverage": 1 + }, + "49": { + "source": " it('should return when the value is not present', function(){", + "coverage": 1 + }, + "50": { + "source": " assert.equal(5,covTest3(5));", + "coverage": 1 + }, + "51": { + "source": " })", + "coverage": "" + }, + "52": { + "source": " })", + "coverage": "" + }, + "53": { + "source": "})", + "coverage": "" + }, + "54": { + "source": "", + "coverage": "" + } + } + "filename": "${CMake_BINARY_DIR}/Testing/JavascriptCoverage/test3.js", + "coverage": 55.00000000000001, + "hits": 11, + "misses": 9, + "sloc": 20, + "source": { + "1": { + "source": "var assert = require(\"assert\")", + "coverage": 1 + }, + "2": { + "source": "var test = {", + "coverage": 1 + }, + "3": { + "source": " version: \"1.0.0\"", + "coverage": "" + }, + "4": { + "source": "}", + "coverage": "" + }, + "5": { + "source": "function covTest(p1,p2) {", + "coverage": 1 + }, + "6": { + "source": " if (p1 > 3) {", + "coverage": 0 + }, + "7": { + "source": " return 1;", + "coverage": 0 + }, + "8": { + "source": " }", + "coverage": "" + }, + "9": { + "source": " else {", + "coverage": "" + }, + "10": { + "source": " return p1 + p2;", + "coverage": 0 + }, + "11": { + "source": " }", + "coverage": "" + }, + "12": { + "source": "}", + "coverage": "" + }, + "13": { + "source": "", + "coverage": "" + }, + "14": { + "source": "function covTest2(p1,p2) {", + "coverage": 1 + }, + "15": { + "source": " return 0;", + "coverage": 1 + }, + "16": { + "source": "}", + "coverage": "" + }, + "17": { + "source": "", + "coverage": "" + }, + "18": { + "source": "function covTest3(p1) {", + "coverage": 1 + }, + "19": { + "source": " for(i=0;i < p1;i++){", + "coverage": 0 + }, + "20": { + "source": " }", + "coverage": "" + }, + "21": { + "source": " return i;", + "coverage": 0 + }, + "22": { + "source": "}", + "coverage": "" + }, + "23": { + "source": "function covTest4(p1) {", + "coverage": 1 + }, + "24": { + "source": " i=0;", + "coverage": 0 + }, + "25": { + "source": " while(i < p1){", + "coverage": 0 + }, + "26": { + "source": " i++;", + "coverage": 0 + }, + "27": { + "source": " }", + "coverage": "" + }, + "28": { + "source": " return i;", + "coverage": 0 + }, + "29": { + "source": "}", + "coverage": "" + }, + "30": { + "source": "", + "coverage": "" + }, + "31": { + "source": "describe('Array', function(){", + "coverage": 1 + }, + "32": { + "source": " describe('CovTest2', function(){", + "coverage": 1 + }, + "33": { + "source": " it('should return when the value is not present', function(){", + "coverage": 1 + }, + "34": { + "source": " assert.equal(0,covTest2(2,2));", + "coverage": 1 + }, + "35": { + "source": " })", + "coverage": "" + }, + "36": { + "source": " })", + "coverage": "" + }, + "37": { + "source": "})", + "coverage": "" + }, + "38": { + "source": "", + "coverage": "" + } + } + } + ], + "stats": { + "suites": 5, + "tests": 4, + "passes": 4, + "pending": 0, + "failures": 0, + "start": "2014-10-23T17:56:02.339Z", + "end": "2014-10-23T17:56:02.344Z", + "duration": 5 + }, + "tests": [ + { + "title": "should return when the value is not present", + "fullTitle": "Array CovTest should return when the value is not present", + "duration": 0 + }, + { + "title": "should return when the value is not present", + "fullTitle": "Array CovTest>3 should return when the value is not present", + "duration": 0 + }, + { + "title": "should return when the value is not present", + "fullTitle": "Array covTest4 should return when the value is not present", + "duration": 0 + }, + { + "title": "should return when the value is not present", + "fullTitle": "Array covTest3 should return when the value is not present", + "duration": 0 + } + ], + "failures": [], + "passes": [ + { + "title": "should return when the value is not present", + "fullTitle": "Array CovTest should return when the value is not present", + "duration": 0 + }, + { + "title": "should return when the value is not present", + "fullTitle": "Array CovTest>3 should return when the value is not present", + "duration": 0 + }, + { + "title": "should return when the value is not present", + "fullTitle": "Array covTest4 should return when the value is not present", + "duration": 0 + }, + { + "title": "should return when the value is not present", + "fullTitle": "Array covTest3 should return when the value is not present", + "duration": 0 + } + ] +}
\ No newline at end of file diff --git a/Tests/JavascriptCoverage/test.js b/Tests/JavascriptCoverage/test.js new file mode 100644 index 0000000..273e921c --- /dev/null +++ b/Tests/JavascriptCoverage/test.js @@ -0,0 +1,53 @@ +var assert = require("assert") +var test = { + version: "1.0.0" +} +function covTest(p1,p2) { + if (p1 > 3) { + return 1; + } + else { + return p1 + p2; + } +} + +function covTest2(p1,p2) { + return 0; +} + +function covTest3(p1) { + for(i=0;i < p1;i++){ + } + return i; +} +function covTest4(p1) { + i=0; + while(i < p1){ + i++; + } + return i; +} + +describe('Array', function(){ + describe('CovTest', function(){ + it('should return when the value is not present', function(){ + assert.equal(4,covTest(2,2)); + }) + }) + + describe('CovTest>3', function(){ + it('should return when the value is not present', function(){ + assert.equal(1,covTest(4,2)); + }) + }) + describe('covTest4', function(){ + it('should return when the value is not present', function(){ + assert.equal(5,covTest4(5)); + }) + }) + describe('covTest3', function(){ + it('should return when the value is not present', function(){ + assert.equal(5,covTest3(5)); + }) + }) +}) diff --git a/Tests/JavascriptCoverage/test3.js b/Tests/JavascriptCoverage/test3.js new file mode 100644 index 0000000..a1e31bc --- /dev/null +++ b/Tests/JavascriptCoverage/test3.js @@ -0,0 +1,37 @@ +var assert = require("assert") +var test = { + version: "1.0.0" +} +function covTest(p1,p2) { + if (p1 > 3) { + return 1; + } + else { + return p1 + p2; + } +} + +function covTest2(p1,p2) { + return 0; +} + +function covTest3(p1) { + for(i=0;i < p1;i++){ + } + return i; +} +function covTest4(p1) { + i=0; + while(i < p1){ + i++; + } + return i; +} + +describe('Array', function(){ + describe('CovTest2', function(){ + it('should return when the value is not present', function(){ + assert.equal(0,covTest2(2,2)); + }) + }) +}) diff --git a/Tests/LinkStatic/CMakeLists.txt b/Tests/LinkStatic/CMakeLists.txt index 2062c43..200d4e5 100644 --- a/Tests/LinkStatic/CMakeLists.txt +++ b/Tests/LinkStatic/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 2.8.4.20110303 FATAL_ERROR) project(LinkStatic C) -if(NOT "${CMAKE_C_COMPILER_ID}" MATCHES "^(GNU)$") +if(NOT CMAKE_C_COMPILER_ID STREQUAL "GNU") message(FATAL_ERROR "This test works only with the GNU compiler!") endif() diff --git a/Tests/ModuleDefinition/CMakeLists.txt b/Tests/ModuleDefinition/CMakeLists.txt index a30f643..bfbb343 100644 --- a/Tests/ModuleDefinition/CMakeLists.txt +++ b/Tests/ModuleDefinition/CMakeLists.txt @@ -13,7 +13,7 @@ add_custom_command(OUTPUT example_dll_gen.def add_library(example_dll_gen SHARED example_dll_gen.c example_dll_gen.def) # Test /DEF:<file> flag recognition for VS. -if(MSVC OR "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$") +if(MSVC OR CMAKE_C_COMPILER_ID STREQUAL "Intel") add_library(example_dll_2 SHARED example_dll_2.c) set_property(TARGET example_dll_2 PROPERTY LINK_FLAGS /DEF:"${ModuleDefinition_SOURCE_DIR}/example_dll_2.def") diff --git a/Tests/PDBDirectoryAndName/CMakeLists.txt b/Tests/PDBDirectoryAndName/CMakeLists.txt index 90af600..180f9fe 100644 --- a/Tests/PDBDirectoryAndName/CMakeLists.txt +++ b/Tests/PDBDirectoryAndName/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8) project(PDBDirectoryAndName C) # Make sure the proper compiler is in use. -if(NOT MSVC AND NOT "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$") +if(NOT MSVC AND NOT CMAKE_C_COMPILER_ID STREQUAL "Intel") message(FATAL_ERROR "The PDBDirectoryAndName test works only with MSVC or Intel") endif() diff --git a/Tests/PrecompiledHeader/CMakeLists.txt b/Tests/PrecompiledHeader/CMakeLists.txt index 6958131..98bdd88 100644 --- a/Tests/PrecompiledHeader/CMakeLists.txt +++ b/Tests/PrecompiledHeader/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required (VERSION 2.6) project(PrecompiledHeader C) # Make sure the proper compiler is in use. -if(NOT MSVC AND NOT "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$") +if(NOT MSVC AND NOT CMAKE_C_COMPILER_ID STREQUAL "Intel") message(FATAL_ERROR "The PrecompiledHeader test works only with MSVC or Intel") endif() diff --git a/Tests/Preprocess/CMakeLists.txt b/Tests/Preprocess/CMakeLists.txt index cdfdcc1..8ff0cfd 100644 --- a/Tests/Preprocess/CMakeLists.txt +++ b/Tests/Preprocess/CMakeLists.txt @@ -114,7 +114,7 @@ endif() set(EXPR_OP1 "/") if((NOT MSVC OR PP_NMAKE) AND - NOT "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$") + NOT CMAKE_C_COMPILER_ID STREQUAL "Intel") # MSVC cl, Intel icl: % # When the cl compiler is invoked from the command line then % must # be written %% (to distinguish from %ENV% syntax). However cl does diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 3fd00b8..a60b556 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -113,3 +113,35 @@ set_target_properties(no_link_language PROPERTIES AUTOMOC TRUE) qtx_wrap_cpp(uicOnlyMoc sub/uiconly.h) add_executable(uiconly sub/uiconly.cpp ${uicOnlyMoc}) target_link_libraries(uiconly ${QT_LIBRARIES}) + +try_compile(RCC_DEPENDS + "${CMAKE_CURRENT_BINARY_DIR}/autorcc_depends" + "${CMAKE_CURRENT_SOURCE_DIR}/autorcc_depends" + autorcc_depends + CMAKE_FLAGS "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" "-DQT_TEST_VERSION=${QT_TEST_VERSION}" + OUTPUT_VARIABLE output +) +if (NOT RCC_DEPENDS) + message(SEND_ERROR "Initial build of autorcc_depends failed. Output: ${output}") +endif() + +file(STRINGS "${CMAKE_CURRENT_BINARY_DIR}/autorcc_depends/info_file.txt" qrc_files) + +list(GET qrc_files 0 qrc_file1) + +set(timeformat "%Y%j%H%M%S") + +file(TIMESTAMP "${qrc_file1}" file1_before "${timeformat}") + +execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change. +execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${CMAKE_CURRENT_SOURCE_DIR}/autorcc_depends/res1_input.txt") + +execute_process(COMMAND "${CMAKE_COMMAND}" --build . + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/autorcc_depends" +) + +file(TIMESTAMP "${qrc_file1}" file1_step1 "${timeformat}") + +if (NOT file1_step1 GREATER file1_before) + message(SEND_ERROR "file1 (${qrc_file1}) should have changed in the first step!") +endif() diff --git a/Tests/QtAutogen/autorcc_depends/CMakeLists.txt b/Tests/QtAutogen/autorcc_depends/CMakeLists.txt new file mode 100644 index 0000000..afd95bc --- /dev/null +++ b/Tests/QtAutogen/autorcc_depends/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 2.8) +project(autorcc_depends) + +set(CMAKE_AUTORCC ON) + +if (QT_TEST_VERSION STREQUAL 4) + find_package(Qt4 REQUIRED) + set(QT_CORE_TARGET Qt4::QtCore) +else() + if (NOT QT_TEST_VERSION STREQUAL 5) + message(SEND_ERROR "Invalid Qt version specified.") + endif() + + find_package(Qt5Core REQUIRED) + set(QT_CORE_TARGET Qt5::Core) +endif() + +add_executable(test_res1 + test_res1.cpp + res1.qrc +) +target_link_libraries(test_res1 ${QT_CORE_TARGET}) +add_custom_command(TARGET test_res1 POST_BUILD COMMAND + ${CMAKE_COMMAND} -E echo "$<TARGET_FILE:test_res1>" > info_file.txt) diff --git a/Tests/QtAutogen/autorcc_depends/res1.qrc b/Tests/QtAutogen/autorcc_depends/res1.qrc new file mode 100644 index 0000000..cfea618 --- /dev/null +++ b/Tests/QtAutogen/autorcc_depends/res1.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/"> + <file>res1_input.txt</file> + </qresource> +</RCC> diff --git a/Tests/QtAutogen/autorcc_depends/res1_input.txt b/Tests/QtAutogen/autorcc_depends/res1_input.txt new file mode 100644 index 0000000..da62762 --- /dev/null +++ b/Tests/QtAutogen/autorcc_depends/res1_input.txt @@ -0,0 +1 @@ +Res1 input. diff --git a/Tests/QtAutogen/autorcc_depends/test_res1.cpp b/Tests/QtAutogen/autorcc_depends/test_res1.cpp new file mode 100644 index 0000000..766b775 --- /dev/null +++ b/Tests/QtAutogen/autorcc_depends/test_res1.cpp @@ -0,0 +1,5 @@ + +int main() +{ + return 0; +} diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index fd3bb03..a99b46f 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -153,3 +153,4 @@ add_RunCMake_test(CommandLine) add_RunCMake_test(install) add_RunCMake_test(CPackInstallProperties) +add_RunCMake_test(ExternalProject) diff --git a/Tests/RunCMake/CommandLine/CMakeLists.txt b/Tests/RunCMake/CommandLine/CMakeLists.txt new file mode 100644 index 0000000..2897109 --- /dev/null +++ b/Tests/RunCMake/CommandLine/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.0) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CommandLine/D_nested_cache-stderr.txt b/Tests/RunCMake/CommandLine/D_nested_cache-stderr.txt new file mode 100644 index 0000000..bba64bc --- /dev/null +++ b/Tests/RunCMake/CommandLine/D_nested_cache-stderr.txt @@ -0,0 +1 @@ +^-->-DBAR:BOOL=BAZ<--$ diff --git a/Tests/RunCMake/CommandLine/D_nested_cache.cmake b/Tests/RunCMake/CommandLine/D_nested_cache.cmake new file mode 100644 index 0000000..9b57284 --- /dev/null +++ b/Tests/RunCMake/CommandLine/D_nested_cache.cmake @@ -0,0 +1 @@ +message("-->${FOO}<--") diff --git a/Tests/RunCMake/CommandLine/D_typed_nested_cache-stderr.txt b/Tests/RunCMake/CommandLine/D_typed_nested_cache-stderr.txt new file mode 100644 index 0000000..bba64bc --- /dev/null +++ b/Tests/RunCMake/CommandLine/D_typed_nested_cache-stderr.txt @@ -0,0 +1 @@ +^-->-DBAR:BOOL=BAZ<--$ diff --git a/Tests/RunCMake/CommandLine/D_typed_nested_cache.cmake b/Tests/RunCMake/CommandLine/D_typed_nested_cache.cmake new file mode 100644 index 0000000..9b57284 --- /dev/null +++ b/Tests/RunCMake/CommandLine/D_typed_nested_cache.cmake @@ -0,0 +1 @@ +message("-->${FOO}<--") diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 5622a5b..84e3614 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -43,3 +43,11 @@ run_cmake_command(E_sleep-bad-arg2 ${CMAKE_COMMAND} -E sleep 1 -1) run_cmake_command(E_sleep-one-tenth ${CMAKE_COMMAND} -E sleep 0.1) run_cmake_command(P_directory ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}) + +set(RunCMake_TEST_OPTIONS + "-DFOO=-DBAR:BOOL=BAZ") +run_cmake(D_nested_cache) + +set(RunCMake_TEST_OPTIONS + "-DFOO:STRING=-DBAR:BOOL=BAZ") +run_cmake(D_typed_nested_cache) diff --git a/Tests/RunCMake/ExternalProject/Add_StepDependencies.cmake b/Tests/RunCMake/ExternalProject/Add_StepDependencies.cmake new file mode 100644 index 0000000..38683f1 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Add_StepDependencies.cmake @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION ${CMAKE_VERSION}) + +include(ExternalProject) + +ExternalProject_Add(BAR URL https://cmake.org/bar.tar.gz) + +ExternalProject_Add(FOO URL https://cmake.org/foo.tar.gz STEP_TARGETS update) +ExternalProject_Add_Step(FOO do_something COMMAND ${CMAKE_COMMAND} -E echo "Doing something") +ExternalProject_Add_Step(FOO do_something_else COMMAND ${CMAKE_COMMAND} -E echo "Doing something else") +ExternalProject_Add_StepTargets(FOO do_something) + +# download and do_something_else are not targets, but the file-level +# dependency are set. +ExternalProject_Add_StepDependencies(FOO download BAR) +ExternalProject_Add_StepDependencies(FOO do_something_else BAR) + +# update and do_something are targets, therefore both file-level and +# target-level dependencies are set. +ExternalProject_Add_StepDependencies(FOO update BAR) +ExternalProject_Add_StepDependencies(FOO do_something BAR) diff --git a/Tests/RunCMake/ExternalProject/Add_StepDependencies_no_target.cmake b/Tests/RunCMake/ExternalProject/Add_StepDependencies_no_target.cmake new file mode 100644 index 0000000..264c3f0 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Add_StepDependencies_no_target.cmake @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION ${CMAKE_VERSION}) + +include(ExternalProject) + +ExternalProject_Add(BAR URL https://cmake.org/bar.tar.gz) + +ExternalProject_Add(FOO URL https://cmake.org/foo.tar.gz STEP_TARGETS update) +ExternalProject_Add_Step(FOO do_something COMMAND ${CMAKE_COMMAND} -E echo "Doing something") +ExternalProject_Add_Step(FOO do_something_else COMMAND ${CMAKE_COMMAND} -E echo "Doing something else") +ExternalProject_Add_StepTargets(FOO do_something) diff --git a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_ARGS.cmake b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_ARGS.cmake new file mode 100644 index 0000000..bf9b12d --- /dev/null +++ b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_ARGS.cmake @@ -0,0 +1,21 @@ +include(ExternalProject) + +set(_tmp_dir "${CMAKE_CURRENT_BINARY_DIR}/tmp") +set(_cache_file "${_tmp_dir}/FOO-cache.cmake") + +ExternalProject_Add(FOO TMP_DIR "${_tmp_dir}" + DOWNLOAD_COMMAND "" + CMAKE_CACHE_ARGS "-DFOO:STRING=BAR") + +if(NOT EXISTS "${_cache_file}") + message(FATAL_ERROR "Initial cache not created") +endif() + +file(READ "${_cache_file}" _cache) + +if(NOT "${_cache}" MATCHES "set\\(FOO \"BAR\".+\\)") # \(\) + message(FATAL_ERROR "Cannot find FOO argument in cache") +endif() +if(NOT "${CMAKE_MATCH_0}" MATCHES FORCE) + message(FATAL_ERROR "Expected forced FOO argument") +endif() diff --git a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS.cmake b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS.cmake new file mode 100644 index 0000000..c216664 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS.cmake @@ -0,0 +1,21 @@ +include(ExternalProject) + +set(_tmp_dir "${CMAKE_CURRENT_BINARY_DIR}/tmp") +set(_cache_file "${_tmp_dir}/FOO-cache.cmake") + +ExternalProject_Add(FOO TMP_DIR "${_tmp_dir}" + DOWNLOAD_COMMAND "" + CMAKE_CACHE_DEFAULT_ARGS "-DFOO:STRING=BAR") + +if(NOT EXISTS "${_cache_file}") + message(FATAL_ERROR "Initial cache not created") +endif() + +file(READ "${_cache_file}" _cache) + +if(NOT "${_cache}" MATCHES "set\\(FOO \"BAR\".+\\)") # \(\) + message(FATAL_ERROR "Cannot find FOO argument in cache") +endif() +if("${CMAKE_MATCH_0}" MATCHES FORCE) + message(FATAL_ERROR "Expected not forced FOO argument") +endif() diff --git a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_mix.cmake b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_mix.cmake new file mode 100644 index 0000000..894e183 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_mix.cmake @@ -0,0 +1,29 @@ +include(ExternalProject) + +set(_tmp_dir "${CMAKE_CURRENT_BINARY_DIR}/tmp") +set(_cache_file "${_tmp_dir}/FOO-cache.cmake") + +ExternalProject_Add(FOO TMP_DIR "${_tmp_dir}" + DOWNLOAD_COMMAND "" + CMAKE_CACHE_ARGS "-DFOO:STRING=BAR" + CMAKE_CACHE_DEFAULT_ARGS "-DBAR:STRING=BAZ") + +if(NOT EXISTS "${_cache_file}") + message(FATAL_ERROR "Initial cache not created") +endif() + +file(READ "${_cache_file}" _cache) + +if(NOT "${_cache}" MATCHES "set\\(FOO \"BAR\".+\\)") # \(\) + message(FATAL_ERROR "Cannot find FOO argument in cache") +endif() +if(NOT "${CMAKE_MATCH_0}" MATCHES FORCE) + message(FATAL_ERROR "Expected forced FOO argument") +endif() + +if(NOT "${_cache}" MATCHES "set\\(BAR \"BAZ\".+\\)") # \(\) + message(FATAL_ERROR "Cannot find BAR argument in cache") +endif() +if("${CMAKE_MATCH_0}" MATCHES FORCE) + message(FATAL_ERROR "Expected not forced BAR argument") +endif() diff --git a/Tests/RunCMake/ExternalProject/CMakeLists.txt b/Tests/RunCMake/ExternalProject/CMakeLists.txt new file mode 100644 index 0000000..c585733 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION ${CMAKE_VERSION}) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS-stderr.txt b/Tests/RunCMake/ExternalProject/NO_DEPENDS-stderr.txt new file mode 100644 index 0000000..4cb051d --- /dev/null +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS-stderr.txt @@ -0,0 +1,36 @@ +CMake Warning \(dev\) at .*/Modules/ExternalProject.cmake:[0-9]+. \(message\): + Using NO_DEPENDS for "configure" step might break parallel builds +Call Stack \(most recent call first\): + .*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) + .*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_Step\) + .*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_configure_command\) + NO_DEPENDS.cmake:[0-9]+ \(ExternalProject_Add\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\) at .*/Modules/ExternalProject.cmake:[0-9]+. \(message\): + Using NO_DEPENDS for "build" step might break parallel builds +Call Stack \(most recent call first\): + .*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) + .*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_Step\) + .*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_build_command\) + NO_DEPENDS.cmake:[0-9]+ \(ExternalProject_Add\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\) at .*/Modules/ExternalProject.cmake:[0-9]+. \(message\): + Using NO_DEPENDS for "install" step might break parallel builds +Call Stack \(most recent call first\): + .*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) + .*/Modules/ExternalProject.cmake:[0-9]+ \(ExternalProject_Add_Step\) + .*/Modules/ExternalProject.cmake:[0-9]+ \(_ep_add_install_command\) + NO_DEPENDS.cmake:[0-9]+ \(ExternalProject_Add\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\) at .*/Modules/ExternalProject.cmake:[0-9]+. \(message\): + Using NO_DEPENDS for "test" step might break parallel builds +Call Stack \(most recent call first\): + NO_DEPENDS.cmake:[0-9]+ \(ExternalProject_Add_StepTargets\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/ExternalProject/NO_DEPENDS.cmake b/Tests/RunCMake/ExternalProject/NO_DEPENDS.cmake new file mode 100644 index 0000000..57626d6 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/NO_DEPENDS.cmake @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 2.8.12) + +include(ExternalProject RESULT_VARIABLE GOO) + +set_property(DIRECTORY PROPERTY EP_INDEPENDENT_STEP_TARGETS download patch update configure build) + +ExternalProject_Add(FOO + URL https://example.org/foo.tar.gz) + +ExternalProject_Add(BAR + URL https://example.org/bar.tar.gz + TEST_COMMAND echo test + INDEPENDENT_STEP_TARGETS install) +# This one should not give a warning +ExternalProject_Add_Step(BAR bar + COMMAND echo bar) + +ExternalProject_Add_StepTargets(BAR NO_DEPENDS test bar) diff --git a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake new file mode 100644 index 0000000..0f5dcef --- /dev/null +++ b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake @@ -0,0 +1,8 @@ +include(RunCMake) + +run_cmake(CMAKE_CACHE_ARGS) +run_cmake(CMAKE_CACHE_DEFAULT_ARGS) +run_cmake(CMAKE_CACHE_mix) +run_cmake(NO_DEPENDS) +run_cmake(Add_StepDependencies) +run_cmake(Add_StepDependencies_no_target) diff --git a/Tests/RunCMake/configure_file/RunCMakeTest.cmake b/Tests/RunCMake/configure_file/RunCMakeTest.cmake index c8bfa57..c010256 100644 --- a/Tests/RunCMake/configure_file/RunCMakeTest.cmake +++ b/Tests/RunCMake/configure_file/RunCMakeTest.cmake @@ -6,3 +6,4 @@ run_cmake(UTF16LE-BOM) run_cmake(UTF16BE-BOM) run_cmake(UTF32LE-BOM) run_cmake(UTF32BE-BOM) +run_cmake(UnknownArg) diff --git a/Tests/RunCMake/configure_file/UnknownArg-stderr.txt b/Tests/RunCMake/configure_file/UnknownArg-stderr.txt new file mode 100644 index 0000000..46930c0 --- /dev/null +++ b/Tests/RunCMake/configure_file/UnknownArg-stderr.txt @@ -0,0 +1,10 @@ +CMake Warning \(dev\) at UnknownArg.cmake:1 \(configure_file\): + configure_file called with unknown argument\(s\): + + COPY_ONLY + COPYFILE + COPY_FILE + +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/configure_file/UnknownArg.cmake b/Tests/RunCMake/configure_file/UnknownArg.cmake new file mode 100644 index 0000000..5125c83 --- /dev/null +++ b/Tests/RunCMake/configure_file/UnknownArg.cmake @@ -0,0 +1,2 @@ +configure_file(${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in UnknownArg.txt + @ONLY COPYONLY COPY_ONLY COPYFILE COPY_FILE) diff --git a/Tests/StringFileTest/CMakeLists.txt b/Tests/StringFileTest/CMakeLists.txt index e6c6152..faf3bc9 100644 --- a/Tests/StringFileTest/CMakeLists.txt +++ b/Tests/StringFileTest/CMakeLists.txt @@ -189,7 +189,7 @@ string(CONFIGURE "${infile}" infile+-/out @ONLY) set(infile "${infile+-/out}") # Write include file to a file -string(REGEX REPLACE "includefile" "${file}" outfile "${infile}") +string(REGEX REPLACE "includefile" "Includes/Values.h" outfile "${infile}") file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/OutputFile.h-tmp" "${outfile}") file(RENAME "${CMAKE_CURRENT_BINARY_DIR}/OutputFile.h-tmp" "${CMAKE_CURRENT_BINARY_DIR}/OutputFile.h") diff --git a/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt index a4d9490..e497503 100644 --- a/Tests/TryCompile/CMakeLists.txt +++ b/Tests/TryCompile/CMakeLists.txt @@ -265,7 +265,7 @@ TEST_FAIL(CXX_RUN_SHOULD_FAIL "CHECK_CXX_SOURCE_RUNS() succeeded, but should hav TEST_ASSERT(CXX_RUN_SHOULD_WORK "CHECK_CXX_SOURCE_RUNS() failed") foreach(lang C CXX) - if(NOT "${CMAKE_${lang}_COMPILER_ID}" MATCHES "^(PathScale)$") + if(NOT CMAKE_${lang}_COMPILER_ID STREQUAL "PathScale") set(${lang}_DD --) endif() endforeach() @@ -280,7 +280,7 @@ include(CheckCXXCompilerFlag) CHECK_CXX_COMPILER_FLAG(${CXX_DD}-_this_is_not_a_flag_ CXX_BOGUS_FLAG) TEST_FAIL(CXX_BOGUS_FLAG "CHECK_CXX_COMPILER_FLAG() succeeded, but should have failed") -if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") +if(CMAKE_C_COMPILER_ID STREQUAL "GNU") unset(C_STRICT_PROTOTYPES CACHE) CHECK_C_COMPILER_FLAG("-Werror;-Wstrict-prototypes" C_STRICT_PROTOTYPES) TEST_ASSERT(C_STRICT_PROTOTYPES "CHECK_C_COMPILER_FLAG failed -Werror -Wstrict-prototypes") diff --git a/Tests/Tutorial/Step2/tutorial.cxx b/Tests/Tutorial/Step2/tutorial.cxx index 82b416f..c27da0b 100644 --- a/Tests/Tutorial/Step2/tutorial.cxx +++ b/Tests/Tutorial/Step2/tutorial.cxx @@ -21,12 +21,16 @@ int main (int argc, char *argv[]) } double inputValue = atof(argv[1]); + double outputValue = 0; + if(inputValue >= 0) + { #ifdef USE_MYMATH - double outputValue = mysqrt(inputValue); + outputValue = mysqrt(inputValue); #else - double outputValue = sqrt(inputValue); + outputValue = sqrt(inputValue); #endif + } fprintf(stdout,"The square root of %g is %g\n", inputValue, outputValue); diff --git a/Tests/Tutorial/Step3/tutorial.cxx b/Tests/Tutorial/Step3/tutorial.cxx index 82b416f..c27da0b 100644 --- a/Tests/Tutorial/Step3/tutorial.cxx +++ b/Tests/Tutorial/Step3/tutorial.cxx @@ -21,12 +21,16 @@ int main (int argc, char *argv[]) } double inputValue = atof(argv[1]); + double outputValue = 0; + if(inputValue >= 0) + { #ifdef USE_MYMATH - double outputValue = mysqrt(inputValue); + outputValue = mysqrt(inputValue); #else - double outputValue = sqrt(inputValue); + outputValue = sqrt(inputValue); #endif + } fprintf(stdout,"The square root of %g is %g\n", inputValue, outputValue); diff --git a/Tests/Tutorial/Step4/tutorial.cxx b/Tests/Tutorial/Step4/tutorial.cxx index 82b416f..c27da0b 100644 --- a/Tests/Tutorial/Step4/tutorial.cxx +++ b/Tests/Tutorial/Step4/tutorial.cxx @@ -21,12 +21,16 @@ int main (int argc, char *argv[]) } double inputValue = atof(argv[1]); + double outputValue = 0; + if(inputValue >= 0) + { #ifdef USE_MYMATH - double outputValue = mysqrt(inputValue); + outputValue = mysqrt(inputValue); #else - double outputValue = sqrt(inputValue); + outputValue = sqrt(inputValue); #endif + } fprintf(stdout,"The square root of %g is %g\n", inputValue, outputValue); diff --git a/Tests/Tutorial/Step5/tutorial.cxx b/Tests/Tutorial/Step5/tutorial.cxx index 82b416f..c27da0b 100644 --- a/Tests/Tutorial/Step5/tutorial.cxx +++ b/Tests/Tutorial/Step5/tutorial.cxx @@ -21,12 +21,16 @@ int main (int argc, char *argv[]) } double inputValue = atof(argv[1]); + double outputValue = 0; + if(inputValue >= 0) + { #ifdef USE_MYMATH - double outputValue = mysqrt(inputValue); + outputValue = mysqrt(inputValue); #else - double outputValue = sqrt(inputValue); + outputValue = sqrt(inputValue); #endif + } fprintf(stdout,"The square root of %g is %g\n", inputValue, outputValue); diff --git a/Tests/Tutorial/Step6/tutorial.cxx b/Tests/Tutorial/Step6/tutorial.cxx index 82b416f..c27da0b 100644 --- a/Tests/Tutorial/Step6/tutorial.cxx +++ b/Tests/Tutorial/Step6/tutorial.cxx @@ -21,12 +21,16 @@ int main (int argc, char *argv[]) } double inputValue = atof(argv[1]); + double outputValue = 0; + if(inputValue >= 0) + { #ifdef USE_MYMATH - double outputValue = mysqrt(inputValue); + outputValue = mysqrt(inputValue); #else - double outputValue = sqrt(inputValue); + outputValue = sqrt(inputValue); #endif + } fprintf(stdout,"The square root of %g is %g\n", inputValue, outputValue); diff --git a/Tests/Tutorial/Step7/tutorial.cxx b/Tests/Tutorial/Step7/tutorial.cxx index 82b416f..c27da0b 100644 --- a/Tests/Tutorial/Step7/tutorial.cxx +++ b/Tests/Tutorial/Step7/tutorial.cxx @@ -21,12 +21,16 @@ int main (int argc, char *argv[]) } double inputValue = atof(argv[1]); + double outputValue = 0; + if(inputValue >= 0) + { #ifdef USE_MYMATH - double outputValue = mysqrt(inputValue); + outputValue = mysqrt(inputValue); #else - double outputValue = sqrt(inputValue); + outputValue = sqrt(inputValue); #endif + } fprintf(stdout,"The square root of %g is %g\n", inputValue, outputValue); diff --git a/Utilities/KWIML/test/CMakeLists.txt b/Utilities/KWIML/test/CMakeLists.txt index a2359cc..a16b5cd 100644 --- a/Utilities/KWIML/test/CMakeLists.txt +++ b/Utilities/KWIML/test/CMakeLists.txt @@ -20,7 +20,7 @@ set_property(DIRECTORY # Suppress printf/scanf format warnings; we test if the sizes match. foreach(lang C CXX) - if(KWIML_LANGUAGE_${lang} AND "${CMAKE_${lang}_COMPILER_ID}" STREQUAL GNU) + if(KWIML_LANGUAGE_${lang} AND CMAKE_${lang}_COMPILER_ID STREQUAL "GNU") set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} -Wno-format") endif() endforeach() diff --git a/Utilities/Release/upload_release.cmake b/Utilities/Release/upload_release.cmake index 5f4da8f..841f244 100644 --- a/Utilities/Release/upload_release.cmake +++ b/Utilities/Release/upload_release.cmake @@ -1,6 +1,6 @@ set(CTEST_RUN_CURRENT_SCRIPT 0) if(NOT VERSION) - set(VERSION 3.0) + set(VERSION 3.1) endif() if(NOT DEFINED PROJECT_PREFIX) set(PROJECT_PREFIX cmake-${VERSION}) diff --git a/Utilities/Sphinx/conf.py.in b/Utilities/Sphinx/conf.py.in index d81bbcf..eb24a6e 100644 --- a/Utilities/Sphinx/conf.py.in +++ b/Utilities/Sphinx/conf.py.in @@ -31,6 +31,8 @@ exclude_patterns = [] extensions = ['cmake'] templates_path = ['@conf_path@/templates'] +nitpicky = True + cmake_manuals = sorted(glob.glob(r'@conf_docs@/manual/*.rst')) cmake_manual_description = re.compile('^\.\. cmake-manual-description:(.*)$') man_pages = [] @@ -60,7 +62,7 @@ html_style = 'cmake.css' html_theme = 'default' html_title = 'CMake %s Documentation' % release html_short_title = '%s Documentation' % release -html_favicon = 'cmake-favicon.ico' +html_favicon = '@conf_path@/static/cmake-favicon.ico' # Not supported yet by sphinx: # https://bitbucket.org/birkenfeld/sphinx/issue/1448/make-qthelp-more-configurable # qthelp_namespace = "org.cmake" diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt index 03f10a0..97fd2ff 100644 --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt @@ -19,11 +19,6 @@ SET(OPERATING_SYSTEM "${CMAKE_SYSTEM_NAME}") SET(CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS}") SET(CMAKE_REQUIRED_FLAGS ${CMAKE_ANSI_CFLAGS}) -# Disable warnings on Borland to avoid changing 3rd party code. -IF(BORLAND) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w-") -ENDIF(BORLAND) - # If we are on AIX, do the _ALL_SOURCE magic IF(${CMAKE_SYSTEM_NAME} MATCHES AIX) SET(_ALL_SOURCE 1) diff --git a/Utilities/cmlibarchive/CMakeLists.txt b/Utilities/cmlibarchive/CMakeLists.txt index f1459d4..b150408 100644 --- a/Utilities/cmlibarchive/CMakeLists.txt +++ b/Utilities/cmlibarchive/CMakeLists.txt @@ -56,13 +56,11 @@ SET(CMAKE_REQUIRED_LIBRARIES) SET(CMAKE_REQUIRED_FLAGS) # Disable warnings to avoid changing 3rd party code. -IF("${CMAKE_C_COMPILER_ID}" MATCHES +IF(CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang|XL|VisualAge|SunPro|MIPSpro|HP|Intel)$") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w") -ELSEIF("${CMAKE_C_COMPILER_ID}" MATCHES "^(PathScale)$") +ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "PathScale") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -woffall") -ELSEIF(BORLAND) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w-") ENDIF() # Enable CTest/CDash support @@ -666,14 +664,14 @@ ENDMACRO(CHECK_CRYPTO_WIN CRYPTO_LIST) MACRO(CHECK_ICONV LIB TRY_ICONV_CONST) IF(NOT HAVE_ICONV) CMAKE_PUSH_CHECK_STATE() # Save the state of the variables - IF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$") + IF (CMAKE_C_COMPILER_ID STREQUAL "GNU") # # During checking iconv proto type, we should use -Werror to avoid the # success of iconv detection with a warnig which success is a miss # detection. So this needs for all build mode(even it's a release mode). # SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror") - ENDIF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$") + ENDIF (CMAKE_C_COMPILER_ID STREQUAL "GNU") IF (MSVC) # NOTE: /WX option is the same as gcc's -Werror option. SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} /WX") diff --git a/Utilities/cmliblzma/CMakeLists.txt b/Utilities/cmliblzma/CMakeLists.txt index 23549c5..d991438 100644 --- a/Utilities/cmliblzma/CMakeLists.txt +++ b/Utilities/cmliblzma/CMakeLists.txt @@ -95,6 +95,7 @@ CHECK_TYPE_SIZE("unsigned short" SIZE_OF_UNSIGNED_SHORT) CHECK_TYPE_SIZE("unsigned" SIZE_OF_UNSIGNED) CHECK_TYPE_SIZE("unsigned long" SIZE_OF_UNSIGNED_LONG) CHECK_TYPE_SIZE("unsigned long long" SIZE_OF_UNSIGNED_LONG_LONG) +CHECK_TYPE_SIZE("size_t" SIZE_OF_SIZE_T) CHECK_TYPE_SIZE("__int64" __INT64) CHECK_TYPE_SIZE("unsigned __int64" UNSIGNED___INT64) @@ -201,13 +202,11 @@ INCLUDE_DIRECTORIES( ) # Disable warnings to avoid changing 3rd party code. -IF("${CMAKE_C_COMPILER_ID}" MATCHES +IF(CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang|XL|VisualAge|SunPro|MIPSpro|HP|Intel)$") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w") -ELSEIF("${CMAKE_C_COMPILER_ID}" MATCHES "^(PathScale)$") +ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "PathScale") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -woffall") -ELSEIF(BORLAND) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w-") ENDIF() ADD_LIBRARY(cmliblzma ${LZMA_SRCS}) diff --git a/Utilities/cmliblzma/common/sysdefs.h b/Utilities/cmliblzma/common/sysdefs.h index c84f01c..a6edea8 100644 --- a/Utilities/cmliblzma/common/sysdefs.h +++ b/Utilities/cmliblzma/common/sysdefs.h @@ -124,9 +124,9 @@ // The code currently assumes that size_t is either 32-bit or 64-bit. #ifndef SIZE_MAX -# if SIZEOF_SIZE_T == 4 +# if SIZE_OF_SIZE_T == 4 # define SIZE_MAX UINT32_MAX -# elif SIZEOF_SIZE_T == 8 +# elif SIZE_OF_SIZE_T == 8 # define SIZE_MAX UINT64_MAX # else # error size_t is not 32-bit or 64-bit diff --git a/Utilities/cmliblzma/config.h.in b/Utilities/cmliblzma/config.h.in index b197f27..017c435 100644 --- a/Utilities/cmliblzma/config.h.in +++ b/Utilities/cmliblzma/config.h.in @@ -29,6 +29,7 @@ @SIZE_OF_UNSIGNED_CODE@ @SIZE_OF_UNSIGNED_LONG_CODE@ @SIZE_OF_UNSIGNED_LONG_LONG_CODE@ +@SIZE_OF_SIZE_T_CODE@ /* * If we lack int64_t, define it to the first of __int64, int, long, and long long @@ -277,9 +278,6 @@ typedef uint64_t uintmax_t; /* Define to 1 if the system has the type `_Bool'. */ #cmakedefine HAVE__BOOL 1 -/* The size of `size_t', as computed by sizeof. */ -#cmakedefine SIZEOF_SIZE_T @SIZEOF_SIZE_T@ - /* Define to 1 if the system supports fast unaligned access to 16-bit and 32-bit integers. */ #define TUKLIB_FAST_UNALIGNED_ACCESS 1 diff --git a/Utilities/cmzlib/CMakeLists.txt b/Utilities/cmzlib/CMakeLists.txt index f161056..66e8be2 100644 --- a/Utilities/cmzlib/CMakeLists.txt +++ b/Utilities/cmzlib/CMakeLists.txt @@ -18,12 +18,10 @@ IF(WIN32) IF(BUILD_SHARED_LIBS) SET(ZLIB_DLL 1) IF(NOT UNIX) - IF(NOT BORLAND) - IF(NOT MINGW) - SET(ZLIB_SRCS ${ZLIB_SRCS} zlib.def zlib.rc ) - ENDIF(NOT MINGW) - ENDIF(NOT BORLAND) - ENDIF(NOT UNIX) + IF(NOT MINGW) + SET(ZLIB_SRCS ${ZLIB_SRCS} zlib.def zlib.rc ) + ENDIF(NOT MINGW) + ENDIF(NOT UNIX) ENDIF(BUILD_SHARED_LIBS) ENDIF(WIN32) |