diff options
245 files changed, 4817 insertions, 2887 deletions
@@ -1,2 +1,7 @@ # Exclude MacOS Finder files. .DS_Store + +*.user* + +*.pyc +Testing diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake index 4d7c6fd..47bb7cf 100644 --- a/CMakeCPack.cmake +++ b/CMakeCPack.cmake @@ -190,31 +190,6 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") set(CPACK_PACKAGE_EXECUTABLES "ccmake" "CMake") endif() - # cygwin specific packaging stuff - if(CYGWIN) - # setup the cygwin package name - set(CPACK_PACKAGE_NAME cmake) - # setup the name of the package for cygwin cmake-2.4.3 - set(CPACK_PACKAGE_FILE_NAME - "${CPACK_PACKAGE_NAME}-${CMake_VERSION}") - # the source has the same name as the binary - set(CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME}) - # Create a cygwin version number in case there are changes for cygwin - # that are not reflected upstream in CMake - set(CPACK_CYGWIN_PATCH_NUMBER 1 CACHE STRING "patch number for CMake cygwin packages") - mark_as_advanced(CPACK_CYGWIN_PATCH_NUMBER) - # These files are required by the cmCPackCygwinSourceGenerator and the files - # put into the release tar files. - set(CPACK_CYGWIN_BUILD_SCRIPT - "${CMake_BINARY_DIR}/${CPACK_PACKAGE_FILE_NAME}-${CPACK_CYGWIN_PATCH_NUMBER}.sh") - set(CPACK_CYGWIN_PATCH_FILE - "${CMake_BINARY_DIR}/${CPACK_PACKAGE_FILE_NAME}-${CPACK_CYGWIN_PATCH_NUMBER}.patch") - # include the sub directory cmake file for cygwin that - # configures some files and adds some install targets - # this file uses some of the package file name variables - include(Utilities/Release/Cygwin/CMakeLists.txt) - endif() - set(CPACK_WIX_UPGRADE_GUID "8ffd1d72-b7f1-11e2-8ee5-00238bca4991") if(MSVC AND NOT "$ENV{WIX}" STREQUAL "") diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index 1699492..8489178 100644 --- a/CTestCustom.cmake.in +++ b/CTestCustom.cmake.in @@ -81,6 +81,7 @@ list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION "index_encoder.c.241.2. warning: Value stored to .out_start. is never read" "index.c.*warning: Access to field.*results in a dereference of a null pointer.*loaded from variable.*" "cm_sha2.*warning: Value stored to.*is never read" + "cmFortranLexer.cxx:[0-9]+:[0-9]+: warning: Call to 'realloc' has an allocation size of 0 bytes" "testProcess.*warning: Dereference of null pointer .loaded from variable .invalidAddress.." "liblzma/simple/x86.c:[0-9]+:[0-9]+: warning: The result of the '<<' expression is undefined" "libuv/src/.*:[0-9]+:[0-9]+: warning: Dereference of null pointer" diff --git a/CompileFlags.cmake b/CompileFlags.cmake index 3c053fa..535f68b 100644 --- a/CompileFlags.cmake +++ b/CompileFlags.cmake @@ -64,7 +64,7 @@ endif() # Workaround for short jump tables on PA-RISC if(CMAKE_SYSTEM_PROCESSOR MATCHES "^parisc") - if(CMAKE_COMPILER_IS_GNUC) + if(CMAKE_COMPILER_IS_GNUCC) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mlong-calls") endif() if(CMAKE_COMPILER_IS_GNUCXX) diff --git a/Help/command/cmake_parse_arguments.rst b/Help/command/cmake_parse_arguments.rst index 6206611..ec4ffed 100644 --- a/Help/command/cmake_parse_arguments.rst +++ b/Help/command/cmake_parse_arguments.rst @@ -11,6 +11,17 @@ respective options. cmake_parse_arguments(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...) + cmake_parse_arguments(PARSE_ARGV N <prefix> <options> <one_value_keywords> + <multi_value_keywords>) + +The first signature reads processes arguments passed in the ``args...``. +This may be used in either a :command:`macro` or a :command:`function`. + +The ``PARSE_ARGV`` signature is only for use in a :command:`function` +body. In this case the arguments that are parsed come from the +``ARGV#`` variables of the calling function. The parsing starts with +the Nth argument, where ``N`` is an unsigned integer. This allows for +the values to have special characters like ``;`` in them. The ``<options>`` argument contains all options for the respective macro, i.e. keywords which can be used when calling the macro without any value diff --git a/Help/command/export.rst b/Help/command/export.rst index 4419dc1..53675a7 100644 --- a/Help/command/export.rst +++ b/Help/command/export.rst @@ -55,3 +55,18 @@ build tree. In some cases, for example for packaging and for system wide installations, it is not desirable to write the user package registry. If the :variable:`CMAKE_EXPORT_NO_PACKAGE_REGISTRY` variable is enabled, the ``export(PACKAGE)`` command will do nothing. + +:: + + export(TARGETS [target1 [target2 [...]]] [ANDROID_MK <filename>]) + +This signature exports cmake built targets to the android ndk build system +by creating an Android.mk file that references the prebuilt targets. The +Android NDK supports the use of prebuilt libraries, both static and shared. +This allows cmake to build the libraries of a project and make them available +to an ndk build system complete with transitive dependencies, include flags +and defines required to use the libraries. The signature takes a list of +targets and puts them in the Android.mk file specified by the ``<filename>`` +given. This signature can only be used if policy CMP0022 is NEW for all +targets given. A error will be issued if that policy is set to OLD for one +of the targets. diff --git a/Help/command/file.rst b/Help/command/file.rst index 256d16d..f8727f0 100644 --- a/Help/command/file.rst +++ b/Help/command/file.rst @@ -222,6 +222,9 @@ Options to both ``DOWNLOAD`` and ``UPLOAD`` are: ``TIMEOUT <seconds>`` Terminate the operation after a given total time has elapsed. +``USERPWD <username>:<password>`` + Set username and password for operation. + Additional options to ``DOWNLOAD`` are: ``EXPECTED_HASH ALGO=<value>`` diff --git a/Help/command/install.rst b/Help/command/install.rst index aaf12cc..d57dd75 100644 --- a/Help/command/install.rst +++ b/Help/command/install.rst @@ -314,7 +314,8 @@ Installing Exports :: install(EXPORT <export-name> DESTINATION <dir> - [NAMESPACE <namespace>] [FILE <name>.cmake] + [NAMESPACE <namespace>] [[FILE <name>.cmake]| + [EXPORT_ANDROID_MK <name>.mk]] [PERMISSIONS permissions...] [CONFIGURATIONS [Debug|Release|...]] [EXPORT_LINK_INTERFACE_LIBRARIES] @@ -342,6 +343,13 @@ specified that does not match that given to the targets associated with included in the export but a target to which it links is not included the behavior is unspecified. +In additon to cmake language files, the ``EXPORT_ANDROID_MK`` option maybe +used to specifiy an export to the android ndk build system. The Android +NDK supports the use of prebuilt libraries, both static and shared. This +allows cmake to build the libraries of a project and make them available +to an ndk build system complete with transitive dependencies, include flags +and defines required to use the libraries. + The ``EXPORT`` form is useful to help outside projects use targets built and installed by the current project. For example, the code @@ -349,9 +357,11 @@ and installed by the current project. For example, the code install(TARGETS myexe EXPORT myproj DESTINATION bin) install(EXPORT myproj NAMESPACE mp_ DESTINATION lib/myproj) + install(EXPORT_ANDROID_MK myexp DESTINATION share/ndk-modules) will install the executable myexe to ``<prefix>/bin`` and code to import -it in the file ``<prefix>/lib/myproj/myproj.cmake``. An outside project +it in the file ``<prefix>/lib/myproj/myproj.cmake`` and +``<prefix>/lib/share/ndk-modules/Android.mk``. An outside project may load this file with the include command and reference the ``myexe`` executable from the installation tree using the imported target name ``mp_myexe`` as if the target were built in its own tree. diff --git a/Help/command/separate_arguments.rst b/Help/command/separate_arguments.rst index 0e3e5a5..1fd3cd1 100644 --- a/Help/command/separate_arguments.rst +++ b/Help/command/separate_arguments.rst @@ -13,19 +13,21 @@ entire command line must be given in one "<args>" argument. The ``UNIX_COMMAND`` mode separates arguments by unquoted whitespace. It recognizes both single-quote and double-quote pairs. A backslash -escapes the next literal character (\" is "); there are no special -escapes (\n is just n). +escapes the next literal character (``\"`` is ``"``); there are no special +escapes (``\n`` is just ``n``). The ``WINDOWS_COMMAND`` mode parses a windows command-line using the same syntax the runtime library uses to construct argv at startup. It separates arguments by whitespace that is not double-quoted. Backslashes are literal unless they precede double-quotes. See the -MSDN article "Parsing C Command-Line Arguments" for details. +MSDN article `Parsing C Command-Line Arguments`_ for details. + +.. _`Parsing C Command-Line Arguments`: https://msdn.microsoft.com/library/a1y7w461.aspx :: - separate_arguments(VARIABLE) + separate_arguments(<var>) -Convert the value of ``VARIABLE`` to a semi-colon separated list. All +Convert the value of ``<var>`` to a semi-colon separated list. All spaces are replaced with ';'. This helps with generating command lines. diff --git a/Help/command/string.rst b/Help/command/string.rst index 19a095a..8028333 100644 --- a/Help/command/string.rst +++ b/Help/command/string.rst @@ -278,12 +278,14 @@ specifiers: %I The hour on a 12-hour clock (01-12). %j The day of the current year (001-366). %m The month of the current year (01-12). + %b Abbreviated month name (e.g. Oct). %M The minute of the current hour (00-59). %s Seconds since midnight (UTC) 1-Jan-1970 (UNIX time). %S The second of the current minute. 60 represents a leap second. (00-60) %U The week number of the current year (00-53). %w The day of the current week. 0 is Sunday. (0-6) + %a Abbreviated weekday name (e.g. Fri). %y The last two digits of the current year (00-99) %Y The current year. diff --git a/Help/generator/Visual Studio 15.rst b/Help/generator/Visual Studio 15.rst new file mode 100644 index 0000000..2b9e33a --- /dev/null +++ b/Help/generator/Visual Studio 15.rst @@ -0,0 +1,16 @@ +Visual Studio 15 +---------------- + +Generates Visual Studio 15 project files. + +The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set +to specify a target platform name. + +For compatibility with CMake versions prior to 3.1, one may specify +a target platform name optionally at the end of this generator name: + +``Visual Studio 15 Win64`` + Specify target platform ``x64``. + +``Visual Studio 15 ARM`` + Specify target platform ``ARM``. diff --git a/Help/manual/cmake-generators.7.rst b/Help/manual/cmake-generators.7.rst index cde8de8..3df3a81 100644 --- a/Help/manual/cmake-generators.7.rst +++ b/Help/manual/cmake-generators.7.rst @@ -82,6 +82,7 @@ Visual Studio Generators /generator/Visual Studio 11 2012 /generator/Visual Studio 12 2013 /generator/Visual Studio 14 2015 + /generator/Visual Studio 15 Other Generators ^^^^^^^^^^^^^^^^ diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index b14f667..74c9265 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -332,7 +332,9 @@ Variables for Languages .. toctree:: :maxdepth: 1 - /variable/CMAKE_COMPILER_IS_GNULANG + /variable/CMAKE_COMPILER_IS_GNUCC + /variable/CMAKE_COMPILER_IS_GNUCXX + /variable/CMAKE_COMPILER_IS_GNUG77 /variable/CMAKE_C_COMPILE_FEATURES /variable/CMAKE_C_EXTENSIONS /variable/CMAKE_C_STANDARD diff --git a/Help/release/dev/GNUInstallDirs-function.rst b/Help/release/dev/GNUInstallDirs-function.rst new file mode 100644 index 0000000..65ea7fb --- /dev/null +++ b/Help/release/dev/GNUInstallDirs-function.rst @@ -0,0 +1,5 @@ +GNUInstallDirs-function +----------------------- + +* The :module:`GNUInstallDirs` module gained a new + :command:`GNUInstallDirs_get_absolute_install_dir` command. diff --git a/Help/release/dev/add_androidmk_generator.rst b/Help/release/dev/add_androidmk_generator.rst new file mode 100644 index 0000000..dd7867c --- /dev/null +++ b/Help/release/dev/add_androidmk_generator.rst @@ -0,0 +1,10 @@ +add_androidmk_generator +----------------------- + +* The :command:`install` command gained an ``EXPORT_ANDROID_MK`` + subcommand to install ``Android.mk`` files referencing installed + libraries as prebuilts for the Android NDK build system. + +* The :command:`export` command gained an ``ANDROID_MK`` option + to generate ``Android.mk`` files referencing CMake-built + libraries as prebuilts for the Android NDK build system. diff --git a/Help/release/dev/bzip2-imported-targets.rst b/Help/release/dev/bzip2-imported-targets.rst new file mode 100644 index 0000000..be58b96 --- /dev/null +++ b/Help/release/dev/bzip2-imported-targets.rst @@ -0,0 +1,4 @@ +bzip2-imported-targets +---------------------- + +* The :module:`FindBZip2` module now provides imported targets. diff --git a/Help/release/dev/cmake-gui-open-project.rst b/Help/release/dev/cmake-gui-open-project.rst new file mode 100644 index 0000000..32f0f0f --- /dev/null +++ b/Help/release/dev/cmake-gui-open-project.rst @@ -0,0 +1,5 @@ +cmake-gui-open-project +---------------------- + +* :manual:`cmake-gui(1)` gained a button to open the generated project file + for :ref:`Visual Studio Generators` and the :generator:`Xcode` generator. diff --git a/Help/release/dev/cpack-deb-package-description-fallback.rst b/Help/release/dev/cpack-deb-package-description-fallback.rst new file mode 100644 index 0000000..71ca821 --- /dev/null +++ b/Help/release/dev/cpack-deb-package-description-fallback.rst @@ -0,0 +1,15 @@ +cpack-deb-package-description-fallback +-------------------------------------- + +* The :module:`CPackDeb` module gained a new + :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_DESCRIPTION` + variable for component-specific package descriptions. + +* The :module:`CPackDeb` module changed its package description + override rules to match :module:`CPackRPM` module behavior. + If the :variable:`CPACK_PACKAGE_DESCRIPTION_FILE` variable is set to + a non-default location then it is preferred to the + :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY` variable. + This is a behavior change from previous versions but produces + more consistent and expected behavior. + See :variable:`CPACK_DEBIAN_PACKAGE_DESCRIPTION`. diff --git a/Help/release/dev/file-curl-userpw.rst b/Help/release/dev/file-curl-userpw.rst new file mode 100644 index 0000000..4ae1fee --- /dev/null +++ b/Help/release/dev/file-curl-userpw.rst @@ -0,0 +1,5 @@ +file-curl-userpw +---------------- + +* The :command:`file(DOWNLOAD)` and :command:`file(UPLOAD)` commands + gained a ``USERPWD <username>:<password>`` option. diff --git a/Help/release/dev/parse_arguments_argv_n.rst b/Help/release/dev/parse_arguments_argv_n.rst new file mode 100644 index 0000000..758b72a --- /dev/null +++ b/Help/release/dev/parse_arguments_argv_n.rst @@ -0,0 +1,6 @@ +parse_arguments_argv_n +---------------------- + +* The :command:`cmake_parse_arguments` command gained a new + mode to read arguments directly from ``ARGC`` and ``ARGV#`` + variables inside a :command:`function` body. diff --git a/Help/release/dev/timestamp-names.rst b/Help/release/dev/timestamp-names.rst new file mode 100644 index 0000000..ea54b5c --- /dev/null +++ b/Help/release/dev/timestamp-names.rst @@ -0,0 +1,6 @@ +timestamp-names +--------------- + +* The :command:`string(TIMESTAMP)` and :command:`file(TIMESTAMP)` + commands gained support for the ``%a`` and ``%b`` placeholders. + These are the abbreviated weekday and month names. diff --git a/Help/release/dev/vs-15-generator.rst b/Help/release/dev/vs-15-generator.rst new file mode 100644 index 0000000..be40cbc --- /dev/null +++ b/Help/release/dev/vs-15-generator.rst @@ -0,0 +1,4 @@ +vs-15-generator +--------------- + +* The :generator:`Visual Studio 15` generator was added. diff --git a/Help/release/dev/wix-feature-patch.rst b/Help/release/dev/wix-feature-patch.rst new file mode 100644 index 0000000..0b1cbe3 --- /dev/null +++ b/Help/release/dev/wix-feature-patch.rst @@ -0,0 +1,5 @@ +wix-feature-patch +----------------- + +* The CPack WIX generator now supports + CPACK_WIX_PATCH_FILE fragments for Feature elements. diff --git a/Help/variable/CMAKE_COMPILER_IS_GNUCC.rst b/Help/variable/CMAKE_COMPILER_IS_GNUCC.rst new file mode 100644 index 0000000..a40667e --- /dev/null +++ b/Help/variable/CMAKE_COMPILER_IS_GNUCC.rst @@ -0,0 +1,5 @@ +CMAKE_COMPILER_IS_GNUCC +----------------------- + +True if the ``C`` compiler is GNU. +Use :variable:`CMAKE_C_COMPILER_ID <CMAKE_<LANG>_COMPILER_ID>` instead. diff --git a/Help/variable/CMAKE_COMPILER_IS_GNUCXX.rst b/Help/variable/CMAKE_COMPILER_IS_GNUCXX.rst new file mode 100644 index 0000000..f1f5cf7 --- /dev/null +++ b/Help/variable/CMAKE_COMPILER_IS_GNUCXX.rst @@ -0,0 +1,5 @@ +CMAKE_COMPILER_IS_GNUCXX +------------------------ + +True if the C++ (``CXX``) compiler is GNU. +Use :variable:`CMAKE_CXX_COMPILER_ID <CMAKE_<LANG>_COMPILER_ID>` instead. diff --git a/Help/variable/CMAKE_COMPILER_IS_GNUG77.rst b/Help/variable/CMAKE_COMPILER_IS_GNUG77.rst new file mode 100644 index 0000000..3d6dab4 --- /dev/null +++ b/Help/variable/CMAKE_COMPILER_IS_GNUG77.rst @@ -0,0 +1,5 @@ +CMAKE_COMPILER_IS_GNUG77 +------------------------ + +True if the ``Fortran`` compiler is GNU. +Use :variable:`CMAKE_Fortran_COMPILER_ID <CMAKE_<LANG>_COMPILER_ID>` instead. diff --git a/Help/variable/CMAKE_COMPILER_IS_GNULANG.rst b/Help/variable/CMAKE_COMPILER_IS_GNULANG.rst deleted file mode 100644 index 4b652c0..0000000 --- a/Help/variable/CMAKE_COMPILER_IS_GNULANG.rst +++ /dev/null @@ -1,15 +0,0 @@ -CMAKE_COMPILER_IS_GNU<LANG> ---------------------------- - -True if the compiler is GNU. - -If the selected ``<LANG>`` compiler is the GNU compiler then this is ``TRUE``, -if not it is ``FALSE``. Unlike the other per-language variables, this -uses the GNU syntax for identifying languages instead of the CMake -syntax. Recognized values of the ``<LANG>`` suffix are: - -:: - - CC = C compiler - CXX = C++ compiler - G77 = Fortran compiler diff --git a/Help/variable/MSVC10.rst b/Help/variable/MSVC10.rst index 33692ad..98e0493 100644 --- a/Help/variable/MSVC10.rst +++ b/Help/variable/MSVC10.rst @@ -1,6 +1,5 @@ MSVC10 ------ -``True`` when using Microsoft Visual C++ 10.0 - -Set to ``true`` when the compiler is version 10.0 of Microsoft Visual C++. +``True`` when using the Microsoft Visual Studio ``v100`` toolset +(``cl`` version 16) or another compiler that simulates it. diff --git a/Help/variable/MSVC11.rst b/Help/variable/MSVC11.rst index 3ab606d..42b7b86 100644 --- a/Help/variable/MSVC11.rst +++ b/Help/variable/MSVC11.rst @@ -1,6 +1,5 @@ MSVC11 ------ -``True`` when using Microsoft Visual C++ 11.0 - -Set to ``true`` when the compiler is version 11.0 of Microsoft Visual C++. +``True`` when using the Microsoft Visual Studio ``v110`` toolset +(``cl`` version 17) or another compiler that simulates it. diff --git a/Help/variable/MSVC12.rst b/Help/variable/MSVC12.rst index 15fa64b..0648f35 100644 --- a/Help/variable/MSVC12.rst +++ b/Help/variable/MSVC12.rst @@ -1,6 +1,5 @@ MSVC12 ------ -``True`` when using Microsoft Visual C++ 12.0. - -Set to ``true`` when the compiler is version 12.0 of Microsoft Visual C++. +``True`` when using the Microsoft Visual Studio ``v120`` toolset +(``cl`` version 18) or another compiler that simulates it. diff --git a/Help/variable/MSVC14.rst b/Help/variable/MSVC14.rst index 0b9125d..f67ebc7 100644 --- a/Help/variable/MSVC14.rst +++ b/Help/variable/MSVC14.rst @@ -1,6 +1,5 @@ MSVC14 ------ -``True`` when using Microsoft Visual C++ 14.0. - -Set to ``true`` when the compiler is version 14.0 of Microsoft Visual C++. +``True`` when using the Microsoft Visual Studio ``v140`` toolset +(``cl`` version 19) or another compiler that simulates it. diff --git a/Help/variable/MSVC80.rst b/Help/variable/MSVC80.rst index b17777c..0d33e82 100644 --- a/Help/variable/MSVC80.rst +++ b/Help/variable/MSVC80.rst @@ -1,6 +1,5 @@ MSVC80 ------ -``True`` when using Microsoft Visual C++ 8.0. - -Set to ``true`` when the compiler is version 8.0 of Microsoft Visual C++. +``True`` when using the Microsoft Visual Studio ``v80`` toolset +(``cl`` version 14) or another compiler that simulates it. diff --git a/Help/variable/MSVC90.rst b/Help/variable/MSVC90.rst index 7162d6c..1716e6f 100644 --- a/Help/variable/MSVC90.rst +++ b/Help/variable/MSVC90.rst @@ -1,6 +1,5 @@ MSVC90 ------ -``True`` when using Microsoft Visual C++ 9.0. - -Set to ``true`` when the compiler is version 9.0 of Microsoft Visual C++. +``True`` when using the Microsoft Visual Studio ``v90`` toolset +(``cl`` version 15) or another compiler that simulates it. diff --git a/Help/variable/MSVC_VERSION.rst b/Help/variable/MSVC_VERSION.rst index ef3b0b5..e2aff3c9 100644 --- a/Help/variable/MSVC_VERSION.rst +++ b/Help/variable/MSVC_VERSION.rst @@ -13,4 +13,4 @@ Known version numbers are:: 1600 = VS 10.0 1700 = VS 11.0 1800 = VS 12.0 - 1900 = VS 14.0 + 1900 = VS 14.0, 15.0 diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index 1a7b923..423bb00 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -156,16 +156,18 @@ # * Default : :code:`CPACK_PACKAGE_CONTACT` # # .. variable:: CPACK_DEBIAN_PACKAGE_DESCRIPTION -# CPACK_COMPONENT_<COMPONENT>_DESCRIPTION +# CPACK_DEBIAN_<COMPONENT>_PACKAGE_DESCRIPTION # # The Debian package description # # * Mandatory : YES # * Default : # -# - :variable:`CPACK_DEBIAN_PACKAGE_DESCRIPTION` if set or -# - :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY` -# +# - :variable:`CPACK_COMPONENT_<compName>_DESCRIPTION` (component based installers only) if set, +# - :variable:`CPACK_PACKAGE_DESCRIPTION_FILE` if set to non default location, +# - :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY` if set, +# - :variable:`CPACK_PACKAGE_DESCRIPTION_FILE` default value if set, +# - or "no package description available" # # .. variable:: CPACK_DEBIAN_PACKAGE_SECTION # CPACK_DEBIAN_<COMPONENT>_PACKAGE_SECTION @@ -829,24 +831,23 @@ function(cpack_deb_prepare_package_vars) endif() # Description: (mandatory) - if(NOT CPACK_DEB_PACKAGE_COMPONENT) - if(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION) - if(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY) - message(FATAL_ERROR "CPackDeb: Debian package requires a summary for a package, set CPACK_PACKAGE_DESCRIPTION_SUMMARY or CPACK_DEBIAN_PACKAGE_DESCRIPTION") - endif() - set(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}) + if(CPACK_DEB_PACKAGE_COMPONENT) + if(CPACK_DEBIAN_${_local_component_name}_PACKAGE_DESCRIPTION) + set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "${CPACK_DEBIAN_${_local_component_name}_PACKAGE_DESCRIPTION}") + elseif(CPACK_COMPONENT_${_local_component_name}_DESCRIPTION) + set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "${CPACK_COMPONENT_${_local_component_name}_DESCRIPTION}") endif() - else() - set(component_description_var CPACK_COMPONENT_${_local_component_name}_DESCRIPTION) - - # component description overrides package description - if(${component_description_var}) - set(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${${component_description_var}}) - elseif(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION) - if(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY) - message(FATAL_ERROR "CPackDeb: Debian package requires a summary for a package, set CPACK_PACKAGE_DESCRIPTION_SUMMARY or CPACK_DEBIAN_PACKAGE_DESCRIPTION or ${component_description_var}") - endif() - set(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}) + endif() + + if(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION) + if(CPACK_PACKAGE_DESCRIPTION_FILE AND NOT "${CPACK_PACKAGE_DESCRIPTION_FILE}" STREQUAL "${CMAKE_ROOT}/Templates/CPack.GenericDescription.txt") + file(READ "${CPACK_PACKAGE_DESCRIPTION_FILE}" CPACK_DEBIAN_PACKAGE_DESCRIPTION) + elseif(CPACK_PACKAGE_DESCRIPTION_SUMMARY) + set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}") + elseif(CPACK_PACKAGE_DESCRIPTION_FILE) # use default package description file content + file(READ "${CPACK_PACKAGE_DESCRIPTION_FILE}" CPACK_DEBIAN_PACKAGE_DESCRIPTION) + else() + set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "no package description available") endif() endif() diff --git a/Modules/CPackWIX.cmake b/Modules/CPackWIX.cmake index 08ff0cb..d02df2d 100644 --- a/Modules/CPackWIX.cmake +++ b/Modules/CPackWIX.cmake @@ -147,7 +147,7 @@ # } # # Currently fragments can be injected into most -# Component, File and Directory elements. +# Component, File, Directory and Feature elements. # # The following additional special Ids can be used: # diff --git a/Modules/Compiler/MSVC-CXX-FeatureTests.cmake b/Modules/Compiler/MSVC-CXX-FeatureTests.cmake index 79d5962..5969586 100644 --- a/Modules/Compiler/MSVC-CXX-FeatureTests.cmake +++ b/Modules/Compiler/MSVC-CXX-FeatureTests.cmake @@ -9,6 +9,9 @@ set(_cmake_oldestSupported "_MSC_VER >= 1600") +# VS version 15 (not 2015) introduces support for aggregate initializers. +set(_cmake_feature_test_cxx_aggregate_default_initializers "_MSC_FULL_VER >= 190024406") + # VS 2015 Update 2 introduces support for variable templates. # https://www.visualstudio.com/en-us/news/vs2015-update2-vs.aspx set(_cmake_feature_test_cxx_variable_templates "_MSC_FULL_VER >= 190023918") diff --git a/Modules/ExternalData.cmake b/Modules/ExternalData.cmake index a0bffe7..e7f8408 100644 --- a/Modules/ExternalData.cmake +++ b/Modules/ExternalData.cmake @@ -86,6 +86,10 @@ Module Functions in one of the paths specified in the ``ExternalData_OBJECT_STORES`` variable. + Typically only one target is needed to manage all external data within + a project. Call this function once at the end of configuration after + all data references have been processed. + Module Variables ^^^^^^^^^^^^^^^^ @@ -394,8 +398,14 @@ function(ExternalData_add_target target) set(files "") - # Set "_ExternalData_FILE_${file}" for each output file to avoid duplicate - # rules. Use local data first to prefer real files over content links. + # Set a "_ExternalData_FILE_${file}" variable for each output file to avoid + # duplicate entries within this target. Set a directory property of the same + # name to avoid repeating custom commands with the same output in this directory. + # Repeating custom commands with the same output across directories or across + # targets in the same directory may be a race, but this is likely okay because + # we use atomic replacement of output files. + # + # Use local data first to prefer real files over content links. # Custom commands to copy or link local data. get_property(data_local GLOBAL PROPERTY _ExternalData_${target}_LOCAL) @@ -405,16 +415,20 @@ function(ExternalData_add_target target) list(GET tuple 1 name) if(NOT DEFINED "_ExternalData_FILE_${file}") set("_ExternalData_FILE_${file}" 1) - add_custom_command( - COMMENT "Generating ${file}" - OUTPUT "${file}" - COMMAND ${CMAKE_COMMAND} -Drelative_top=${CMAKE_BINARY_DIR} - -Dfile=${file} -Dname=${name} - -DExternalData_ACTION=local - -DExternalData_CONFIG=${config} - -P ${_ExternalData_SELF} - MAIN_DEPENDENCY "${name}" - ) + get_property(added DIRECTORY PROPERTY "_ExternalData_FILE_${file}") + if(NOT added) + set_property(DIRECTORY PROPERTY "_ExternalData_FILE_${file}" 1) + add_custom_command( + COMMENT "Generating ${file}" + OUTPUT "${file}" + COMMAND ${CMAKE_COMMAND} -Drelative_top=${CMAKE_BINARY_DIR} + -Dfile=${file} -Dname=${name} + -DExternalData_ACTION=local + -DExternalData_CONFIG=${config} + -P ${_ExternalData_SELF} + MAIN_DEPENDENCY "${name}" + ) + endif() list(APPEND files "${file}") endif() endforeach() @@ -429,23 +443,27 @@ function(ExternalData_add_target target) set(stamp "${ext}-stamp") if(NOT DEFINED "_ExternalData_FILE_${file}") set("_ExternalData_FILE_${file}" 1) - add_custom_command( - # Users care about the data file, so hide the hash/timestamp file. - COMMENT "Generating ${file}" - # The hash/timestamp file is the output from the build perspective. - # List the real file as a second output in case it is a broken link. - # The files must be listed in this order so CMake can hide from the - # make tool that a symlink target may not be newer than the input. - OUTPUT "${file}${stamp}" "${file}" - # Run the data fetch/update script. - COMMAND ${CMAKE_COMMAND} -Drelative_top=${CMAKE_BINARY_DIR} - -Dfile=${file} -Dname=${name} -Dext=${ext} - -DExternalData_ACTION=fetch - -DExternalData_CONFIG=${config} - -P ${_ExternalData_SELF} - # Update whenever the object hash changes. - MAIN_DEPENDENCY "${name}${ext}" - ) + get_property(added DIRECTORY PROPERTY "_ExternalData_FILE_${file}") + if(NOT added) + set_property(DIRECTORY PROPERTY "_ExternalData_FILE_${file}" 1) + add_custom_command( + # Users care about the data file, so hide the hash/timestamp file. + COMMENT "Generating ${file}" + # The hash/timestamp file is the output from the build perspective. + # List the real file as a second output in case it is a broken link. + # The files must be listed in this order so CMake can hide from the + # make tool that a symlink target may not be newer than the input. + OUTPUT "${file}${stamp}" "${file}" + # Run the data fetch/update script. + COMMAND ${CMAKE_COMMAND} -Drelative_top=${CMAKE_BINARY_DIR} + -Dfile=${file} -Dname=${name} -Dext=${ext} + -DExternalData_ACTION=fetch + -DExternalData_CONFIG=${config} + -P ${_ExternalData_SELF} + # Update whenever the object hash changes. + MAIN_DEPENDENCY "${name}${ext}" + ) + endif() list(APPEND files "${file}${stamp}") endif() endforeach() diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake index b670025..152d812 100644 --- a/Modules/FindBZip2.cmake +++ b/Modules/FindBZip2.cmake @@ -4,7 +4,16 @@ # # Try to find BZip2 # -# Once done this will define +# IMPORTED Targets +# ^^^^^^^^^^^^^^^^ +# +# This module defines :prop_tgt:`IMPORTED` target ``BZip2::BZip2``, if +# BZip2 has been found. +# +# Result Variables +# ^^^^^^^^^^^^^^^^ +# +# This module defines the following variables: # # :: # @@ -64,6 +73,31 @@ if (BZIP2_FOUND) set(CMAKE_REQUIRED_LIBRARIES ${BZIP2_LIBRARIES}) CHECK_SYMBOL_EXISTS(BZ2_bzCompressInit "bzlib.h" BZIP2_NEED_PREFIX) cmake_pop_check_state() + + if(NOT TARGET BZip2::BZip2) + add_library(BZip2::BZip2 UNKNOWN IMPORTED) + set_target_properties(BZip2::BZip2 PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${BZIP2_INCLUDE_DIRS}") + + if(BZIP2_LIBRARY_RELEASE) + set_property(TARGET BZip2::BZip2 APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(BZip2::BZip2 PROPERTIES + IMPORTED_LOCATION_RELEASE "${BZIP2_LIBRARY_RELEASE}") + endif() + + if(BZIP2_LIBRARY_DEBUG) + set_property(TARGET BZip2::BZip2 APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(BZip2::BZip2 PROPERTIES + IMPORTED_LOCATION_DEBUG "${BZIP2_LIBRARY_DEBUG}") + endif() + + if(NOT BZIP2_LIBRARY_RELEASE AND NOT BZIP2_LIBRARY_DEBUG) + set_property(TARGET BZip2::BZip2 APPEND PROPERTY + IMPORTED_LOCATION "${BZIP2_LIBRARY}") + endif() + endif() endif () mark_as_advanced(BZIP2_INCLUDE_DIR) diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index 9f96fe6..c813f8f 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -635,7 +635,7 @@ function(matlab_get_version_from_matlab_run matlab_binary_program matlab_list_ve set(devnull INPUT_FILE NUL) endif() - # timeout set to 30 seconds, in case it does not start + # timeout set to 120 seconds, in case it does not start # note as said before OUTPUT_VARIABLE cannot be used in a platform # independent manner however, not setting it would flush the output of Matlab # in the current console (unix variant) @@ -644,11 +644,18 @@ function(matlab_get_version_from_matlab_run matlab_binary_program matlab_list_ve OUTPUT_VARIABLE _matlab_version_from_cmd_dummy RESULT_VARIABLE _matlab_result_version_call ERROR_VARIABLE _matlab_result_version_call_error - TIMEOUT 30 + TIMEOUT 120 WORKING_DIRECTORY "${_matlab_temporary_folder}" ${devnull} ) + if("${_matlab_result_version_call}" MATCHES "timeout") + if(MATLAB_FIND_DEBUG) + message(WARNING "[MATLAB] Unable to determine the version of Matlab." + " Matlab call timed out after 120 seconds.") + endif() + return() + endif() if(${_matlab_result_version_call}) if(MATLAB_FIND_DEBUG) @@ -698,7 +705,6 @@ function(matlab_get_version_from_matlab_run matlab_binary_program matlab_list_ve endfunction() - #.rst: # .. command:: matlab_add_unit_test # @@ -720,6 +726,7 @@ endfunction() # matlab_add_unit_test( # NAME <name> # UNITTEST_FILE matlab_file_containing_unittest.m +# [CUSTOM_MATLAB_COMMAND matlab_command_to_run_as_test] # [UNITTEST_PRECOMMAND matlab_command_to_run] # [TIMEOUT timeout] # [ADDITIONAL_PATH path1 [path2 ...]] @@ -735,6 +742,11 @@ endfunction() # ``UNITTEST_FILE`` # the matlab unittest file. Its path will be automatically # added to the Matlab path. +# ``CUSTOM_MATLAB_COMMAND`` +# Matlab script command to run as the test. +# IIf this is not set, then the following is run: +# "runtests('matlab_file_name'), exit(max([ans(1,:).Failed])) +# matlab_file_name comes from UNITTEST_FILE without the .m. # ``UNITTEST_PRECOMMAND`` # Matlab script command to be ran before the file # containing the test (eg. GPU device initialisation based on CMake @@ -748,12 +760,18 @@ endfunction() # ``MATLAB_ADDITIONAL_STARTUP_OPTIONS`` # a list of additional option in order # to run Matlab from the command line. +# -nosplash -nodesktop -nodisplay are always added. # ``TEST_ARGS`` # Additional options provided to the add_test command. These # options are added to the default options (eg. "CONFIGURATIONS Release") # ``NO_UNITTEST_FRAMEWORK`` # when set, indicates that the test should not # use the unittest framework of Matlab (available for versions >= R2013a). +# ``WORKING_DIRECTORY`` +# This will be the working directory for the test. If specified it will +# also be the output directory used for the log file of the test run. +# If not specifed the temporary directory ${CMAKE_BINARY_DIR}/Matlab will +# be used as the working directory and the log location. # function(matlab_add_unit_test) @@ -762,11 +780,12 @@ function(matlab_add_unit_test) endif() set(options NO_UNITTEST_FRAMEWORK) - set(oneValueArgs NAME UNITTEST_PRECOMMAND UNITTEST_FILE TIMEOUT) + set(oneValueArgs NAME UNITTEST_FILE TIMEOUT WORKING_DIRECTORY + UNITTEST_PRECOMMAND CUSTOM_TEST_COMMAND) set(multiValueArgs ADDITIONAL_PATH MATLAB_ADDITIONAL_STARTUP_OPTIONS TEST_ARGS) set(prefix _matlab_unittest_prefix) - cmake_parse_arguments(${prefix} "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) + cmake_parse_arguments(PARSE_ARGV 0 ${prefix} "${options}" "${oneValueArgs}" "${multiValueArgs}" ) if(NOT ${prefix}_NAME) message(FATAL_ERROR "[MATLAB] The Matlab test name cannot be empty") @@ -774,15 +793,17 @@ function(matlab_add_unit_test) add_test(NAME ${${prefix}_NAME} COMMAND ${CMAKE_COMMAND} - -Dtest_name=${${prefix}_NAME} - -Dadditional_paths=${${prefix}_ADDITIONAL_PATH} - -Dtest_timeout=${${prefix}_TIMEOUT} - -Doutput_directory=${_matlab_temporary_folder} - -DMatlab_PROGRAM=${Matlab_MAIN_PROGRAM} - -Dno_unittest_framework=${${prefix}_NO_UNITTEST_FRAMEWORK} - -DMatlab_ADDITIONNAL_STARTUP_OPTIONS=${${prefix}_MATLAB_ADDITIONAL_STARTUP_OPTIONS} - -Dunittest_file_to_run=${${prefix}_UNITTEST_FILE} - -Dcmd_to_run_before_test=${${prefix}_UNITTEST_PRECOMMAND} + "-Dtest_name=${${prefix}_NAME}" + "-Dadditional_paths=${${prefix}_ADDITIONAL_PATH}" + "-Dtest_timeout=${${prefix}_TIMEOUT}" + "-Doutput_directory=${_matlab_temporary_folder}" + "-Dworking_directory=${${prefix}_WORKING_DIRECTORY}" + "-DMatlab_PROGRAM=${Matlab_MAIN_PROGRAM}" + "-Dno_unittest_framework=${${prefix}_NO_UNITTEST_FRAMEWORK}" + "-DMatlab_ADDITIONNAL_STARTUP_OPTIONS=${${prefix}_MATLAB_ADDITIONAL_STARTUP_OPTIONS}" + "-Dunittest_file_to_run=${${prefix}_UNITTEST_FILE}" + "-Dcustom_Matlab_test_command=${${prefix}_CUSTOM_TEST_COMMAND}" + "-Dcmd_to_run_before_test=${${prefix}_UNITTEST_PRECOMMAND}" -P ${_FindMatlab_SELF_DIR}/MatlabTestsRedirect.cmake ${${prefix}_TEST_ARGS} ${${prefix}_UNPARSED_ARGUMENTS} @@ -1030,13 +1051,17 @@ function(_Matlab_get_version_from_root matlab_root matlab_known_version matlab_f set(matlab_list_of_all_versions) matlab_get_version_from_matlab_run("${Matlab_PROG_VERSION_STRING_AUTO_DETECT}" matlab_list_of_all_versions) - list(GET matlab_list_of_all_versions 0 _matlab_version_tmp) + list(LENGTH matlab_list_of_all_versions list_of_all_versions_length) + if(${list_of_all_versions_length} GREATER 0) + list(GET matlab_list_of_all_versions 0 _matlab_version_tmp) + else() + set(_matlab_version_tmp "unknown") + endif() # set the version into the cache set(Matlab_VERSION_STRING_INTERNAL ${_matlab_version_tmp} CACHE INTERNAL "Matlab version (automatically determined)" FORCE) # warning, just in case several versions found (should not happen) - list(LENGTH matlab_list_of_all_versions list_of_all_versions_length) if((${list_of_all_versions_length} GREATER 1) AND MATLAB_FIND_DEBUG) message(WARNING "[MATLAB] Found several versions, taking the first one (versions found ${matlab_list_of_all_versions})") endif() diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake index e194185..4d726f2 100644 --- a/Modules/FindPythonInterp.cmake +++ b/Modules/FindPythonInterp.cmake @@ -52,7 +52,7 @@ unset(_Python_NAMES) set(_PYTHON1_VERSIONS 1.6 1.5) set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0) -set(_PYTHON3_VERSIONS 3.6 3.5 3.4 3.3 3.2 3.1 3.0) +set(_PYTHON3_VERSIONS 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0) if(PythonInterp_FIND_VERSION) if(PythonInterp_FIND_VERSION_COUNT GREATER 1) diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake index ab92f86..d9916a1 100644 --- a/Modules/FindPythonLibs.cmake +++ b/Modules/FindPythonLibs.cmake @@ -84,7 +84,7 @@ set(CMAKE_FIND_FRAMEWORK LAST) set(_PYTHON1_VERSIONS 1.6 1.5) set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0) -set(_PYTHON3_VERSIONS 3.6 3.5 3.4 3.3 3.2 3.1 3.0) +set(_PYTHON3_VERSIONS 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0) if(PythonLibs_FIND_VERSION) if(PythonLibs_FIND_VERSION_COUNT GREATER 1) diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake index b42084e..0c80b8a 100644 --- a/Modules/GNUInstallDirs.cmake +++ b/Modules/GNUInstallDirs.cmake @@ -99,6 +99,23 @@ # `Filesystem Hierarchy Standard`_. # # .. _`Filesystem Hierarchy Standard`: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html +# +# Macros +# ^^^^^^ +# +# .. command:: GNUInstallDirs_get_absolute_install_dir +# +# :: +# +# GNUInstallDirs_get_absolute_install_dir(absvar var) +# +# Set the given variable ``absvar`` to the absolute path contained +# within the variable ``var``. This is to allow the computation of an +# absolute path, accounting for all the special cases documented +# above. While this macro is used to compute the various +# ``CMAKE_INSTALL_FULL_<dir>`` variables, it is exposed publicly to +# allow users who create additional path variables to also compute +# absolute paths where necessary, using the same logic. #============================================================================= # Copyright 2015 Alex Turbov <i.zaufi@gmail.com> @@ -300,55 +317,59 @@ mark_as_advanced( CMAKE_INSTALL_DOCDIR ) -# Result directories -# -foreach(dir - BINDIR - SBINDIR - LIBEXECDIR - SYSCONFDIR - SHAREDSTATEDIR - LOCALSTATEDIR - LIBDIR - INCLUDEDIR - OLDINCLUDEDIR - DATAROOTDIR - DATADIR - INFODIR - LOCALEDIR - MANDIR - DOCDIR - ) - if(NOT IS_ABSOLUTE "${CMAKE_INSTALL_${dir}}") +macro(GNUInstallDirs_get_absolute_install_dir absvar var) + if(NOT IS_ABSOLUTE "${${var}}") # Handle special cases: # - CMAKE_INSTALL_PREFIX == / # - CMAKE_INSTALL_PREFIX == /usr # - CMAKE_INSTALL_PREFIX == /opt/... if("${CMAKE_INSTALL_PREFIX}" STREQUAL "/") if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR") - set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}") + set(${absvar} "/${${var}}") else() - if (NOT "${CMAKE_INSTALL_${dir}}" MATCHES "^usr/") - set(CMAKE_INSTALL_${dir} "usr/${CMAKE_INSTALL_${dir}}") + if (NOT "${${var}}" MATCHES "^usr/") + set(${var} "usr/${${var}}") endif() - set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}") + set(${absvar} "/${${var}}") endif() elseif("${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$") if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR") - set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}") + set(${absvar} "/${${var}}") else() - set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}") + set(${absvar} "${CMAKE_INSTALL_PREFIX}/${${var}}") endif() elseif("${CMAKE_INSTALL_PREFIX}" MATCHES "^/opt/.*") if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR") - set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}${CMAKE_INSTALL_PREFIX}") + set(${absvar} "/${${var}}${CMAKE_INSTALL_PREFIX}") else() - set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}") + set(${absvar} "${CMAKE_INSTALL_PREFIX}/${${var}}") endif() else() - set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}") + set(${absvar} "${CMAKE_INSTALL_PREFIX}/${${var}}") endif() else() - set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_${dir}}") + set(${absvar} "${${var}}") endif() +endmacro() + +# Result directories +# +foreach(dir + BINDIR + SBINDIR + LIBEXECDIR + SYSCONFDIR + SHAREDSTATEDIR + LOCALSTATEDIR + LIBDIR + INCLUDEDIR + OLDINCLUDEDIR + DATAROOTDIR + DATADIR + INFODIR + LOCALEDIR + MANDIR + DOCDIR + ) + GNUInstallDirs_get_absolute_install_dir(CMAKE_INSTALL_FULL_${dir} CMAKE_INSTALL_${dir}) endforeach() diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index e33b927..bacf137 100644 --- a/Modules/GenerateExportHeader.cmake +++ b/Modules/GenerateExportHeader.cmake @@ -208,7 +208,7 @@ macro(_test_compiler_hidden_visibility) if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.2") set(GCC_TOO_OLD TRUE) - elseif(CMAKE_COMPILER_IS_GNUC AND CMAKE_C_COMPILER_VERSION VERSION_LESS "4.2") + elseif(CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER_VERSION VERSION_LESS "4.2") set(GCC_TOO_OLD TRUE) elseif(CMAKE_CXX_COMPILER_ID MATCHES Intel AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "12.0") set(_INTEL_TOO_OLD TRUE) diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index 58f5a92..127fda2 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -544,7 +544,7 @@ function(gp_resolved_file_type original_file file exepath dirs type_var) string(TOLOWER "$ENV{windir}" windir) file(TO_CMAKE_PATH "${windir}" windir) - if(lower MATCHES "^(api-ms-win-|${sysroot}/sys(tem|wow)|${windir}/sys(tem|wow)|(.*/)*msvc[^/]+dll)") + if(lower MATCHES "^(${sysroot}/sys(tem|wow)|${windir}/sys(tem|wow)|(.*/)*(msvc|api-ms-win-)[^/]+dll)") set(is_system 1) endif() @@ -572,7 +572,7 @@ function(gp_resolved_file_type original_file file exepath dirs type_var) string(TOLOWER "${env_windir}" windir) string(TOLOWER "${env_sysdir}" sysroot) - if(lower MATCHES "^(api-ms-win-|${sysroot}/sys(tem|wow)|${windir}/sys(tem|wow)|(.*/)*msvc[^/]+dll)") + if(lower MATCHES "^(${sysroot}/sys(tem|wow)|${windir}/sys(tem|wow)|(.*/)*(msvc|api-ms-win-)[^/]+dll)") set(is_system 1) endif() endif() diff --git a/Modules/MatlabTestsRedirect.cmake b/Modules/MatlabTestsRedirect.cmake index 0ef4c3e..76f9a53 100644 --- a/Modules/MatlabTestsRedirect.cmake +++ b/Modules/MatlabTestsRedirect.cmake @@ -23,11 +23,12 @@ # -DMatlab_PROGRAM=matlab_exe_location # -DMatlab_ADDITIONNAL_STARTUP_OPTIONS="" # -Dtest_name=name_of_the_test +# -Dcustom_Matlab_test_command="" # -Dcmd_to_run_before_test="" # -Dunittest_file_to_run # -P FindMatlab_TestsRedirect.cmake -set(Matlab_UNIT_TESTS_CMD -nosplash -nojvm -nodesktop -nodisplay ${Matlab_ADDITIONNAL_STARTUP_OPTIONS}) +set(Matlab_UNIT_TESTS_CMD -nosplash -nodesktop -nodisplay ${Matlab_ADDITIONNAL_STARTUP_OPTIONS}) if(WIN32) set(Matlab_UNIT_TESTS_CMD ${Matlab_UNIT_TESTS_CMD} -wait) endif() @@ -36,6 +37,13 @@ if(NOT test_timeout) set(test_timeout 180) endif() +# If timeout is -1, then do not put a timeout on the execute_process +if(test_timeout EQUAL -1) + set(test_timeout "") +else() + set(test_timeout TIMEOUT ${test_timeout}) +endif() + if(NOT cmd_to_run_before_test) set(cmd_to_run_before_test) endif() @@ -50,16 +58,30 @@ foreach(s IN LISTS additional_paths) endif() endforeach() -set(unittest_to_run "runtests('${unittest_file_to_run_name}'), exit(max([ans(1,:).Failed]))") +if(custom_Matlab_test_command) + set(unittest_to_run "${custom_Matlab_test_command}") +else() + set(unittest_to_run "runtests('${unittest_file_to_run_name}'), exit(max([ans(1,:).Failed]))") +endif() + + if(no_unittest_framework) set(unittest_to_run "try, ${unittest_file_to_run_name}, catch err, disp('An exception has been thrown during the execution'), disp(err), disp(err.stack), exit(1), end, exit(0)") endif() set(Matlab_SCRIPT_TO_RUN - "addpath(${concat_string}), path, ${cmd_to_run_before_test}, ${unittest_to_run}" + "addpath(${concat_string}); ${cmd_to_run_before_test}; ${unittest_to_run}" ) +# if the working directory is not specified then default +# to the output_directory because the log file will go there +# if the working_directory is specified it will override the +# output_directory +if(NOT working_directory) + set(working_directory "${output_directory}") +endif() -set(Matlab_LOG_FILE "${output_directory}/${test_name}.log") +string(REPLACE "/" "_" log_file_name "${test_name}.log") +set(Matlab_LOG_FILE "${working_directory}/${log_file_name}") set(devnull) if(UNIX) @@ -69,11 +91,14 @@ elseif(WIN32) endif() execute_process( - COMMAND "${Matlab_PROGRAM}" ${Matlab_UNIT_TESTS_CMD} -logfile "${test_name}.log" -r "${Matlab_SCRIPT_TO_RUN}" + # Do not use a full path to log file. Depend on the fact that the log file + # is always going to go in the working_directory. This is because matlab + # on unix is a shell script that does not handle spaces in the logfile path. + COMMAND "${Matlab_PROGRAM}" ${Matlab_UNIT_TESTS_CMD} -logfile "${log_file_name}" -r "${Matlab_SCRIPT_TO_RUN}" RESULT_VARIABLE res - TIMEOUT ${test_timeout} + ${test_timeout} OUTPUT_QUIET # we do not want the output twice - WORKING_DIRECTORY "${output_directory}" + WORKING_DIRECTORY "${working_directory}" ${devnull} ) @@ -87,5 +112,5 @@ message("Matlab test ${name_of_the_test} output:\n${matlab_log_content}") # if w if(NOT (res EQUAL 0)) - message( FATAL_ERROR "[MATLAB] TEST FAILED" ) + message( FATAL_ERROR "[MATLAB] TEST FAILED Matlab returned ${res}" ) endif() diff --git a/Source/.gitattributes b/Source/.gitattributes index bd25ea8..5002b2a 100644 --- a/Source/.gitattributes +++ b/Source/.gitattributes @@ -3,3 +3,5 @@ cm_sha2.* whitespace=indent-with-non-tab # Preserve indentation style in generated code. cmListFileLexer.c whitespace=-tab-in-indent,-indent-with-non-tab +cmFortranLexer.cxx whitespace=-tab-in-indent,-indent-with-non-tab +cmFortranLexer.h whitespace=-tab-in-indent,-indent-with-non-tab diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 6c3ebf5..39773e1 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -221,10 +221,14 @@ set(SRCS cmExprLexer.cxx cmExprParser.cxx cmExprParserHelper.cxx + cmExportBuildAndroidMKGenerator.h + cmExportBuildAndroidMKGenerator.cxx cmExportBuildFileGenerator.h cmExportBuildFileGenerator.cxx cmExportFileGenerator.h cmExportFileGenerator.cxx + cmExportInstallAndroidMKGenerator.h + cmExportInstallAndroidMKGenerator.cxx cmExportInstallFileGenerator.h cmExportInstallFileGenerator.cxx cmExportTryCompileFileGenerator.h @@ -492,6 +496,8 @@ if (WIN32) cmGlobalVisualStudio12Generator.cxx cmGlobalVisualStudio14Generator.h cmGlobalVisualStudio14Generator.cxx + cmGlobalVisualStudio15Generator.h + cmGlobalVisualStudio15Generator.cxx cmGlobalVisualStudioGenerator.cxx cmGlobalVisualStudioGenerator.h cmIDEFlagTable.h diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 1b36905..0569e8e 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 6) -set(CMake_VERSION_PATCH 20160907) +set(CMake_VERSION_PATCH 20160915) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx index 4a5eb90..a6f1585 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx +++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx @@ -12,21 +12,20 @@ #include "cmCPackIFWGenerator.h" -#include <CPack/cmCPackComponentGroup.h> -#include <CPack/cmCPackLog.h> - -#include <cmsys/Directory.hxx> -#include <cmsys/Glob.hxx> -#include <cmsys/RegularExpression.hxx> -#include <cmsys/SystemTools.hxx> - -#include <cmGeneratedFileStream.h> -#include <cmGlobalGenerator.h> -#include <cmMakefile.h> -#include <cmSystemTools.h> -#include <cmTimestamp.h> -#include <cmVersionConfig.h> -#include <cmXMLWriter.h> +#include "CPack/cmCPackComponentGroup.h" +#include "CPack/cmCPackGenerator.h" +#include "CPack/cmCPackLog.h" +#include "cmCPackIFWInstaller.h" +#include "cmCPackIFWPackage.h" +#include "cmCPackIFWRepository.h" +#include "cmGeneratedFileStream.h" +#include "cmSystemTools.h" +#include "cmTimestamp.h" +#include "cmVersionConfig.h" +#include "cmXMLWriter.h" + +#include <sstream> +#include <utility> cmCPackIFWGenerator::cmCPackIFWGenerator() { diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.h b/Source/CPack/IFW/cmCPackIFWGenerator.h index 12f2ca6..17d61bf 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.h +++ b/Source/CPack/IFW/cmCPackIFWGenerator.h @@ -13,11 +13,19 @@ #ifndef cmCPackIFWGenerator_h #define cmCPackIFWGenerator_h -#include <CPack/cmCPackGenerator.h> +#include <cmConfigure.h> +#include "CPack/cmCPackComponentGroup.h" +#include "CPack/cmCPackGenerator.h" #include "cmCPackIFWInstaller.h" #include "cmCPackIFWPackage.h" #include "cmCPackIFWRepository.h" +#include "cmTypeMacro.h" + +#include <map> +#include <set> +#include <string> +#include <vector> class cmXMLWriter; diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx index 13a3613..5a3efc9 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx +++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx @@ -12,12 +12,16 @@ #include "cmCPackIFWInstaller.h" +#include "CPack/cmCPackGenerator.h" #include "cmCPackIFWGenerator.h" - -#include <CPack/cmCPackLog.h> - -#include <cmGeneratedFileStream.h> -#include <cmXMLWriter.h> +#include "cmCPackIFWPackage.h" +#include "cmCPackIFWRepository.h" +#include "cmGeneratedFileStream.h" +#include "cmSystemTools.h" +#include "cmXMLWriter.h" + +#include <cmConfigure.h> +#include <utility> #ifdef cmCPackLogger #undef cmCPackLogger diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.h b/Source/CPack/IFW/cmCPackIFWInstaller.h index 3170116..f72d379 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.h +++ b/Source/CPack/IFW/cmCPackIFWInstaller.h @@ -13,10 +13,14 @@ #ifndef cmCPackIFWInstaller_h #define cmCPackIFWInstaller_h -#include <cmStandardIncludes.h> +#include <cmConfigure.h> // IWYU pragma: keep + +#include <map> +#include <string> +#include <vector> -class cmCPackIFWPackage; class cmCPackIFWGenerator; +class cmCPackIFWPackage; class cmCPackIFWRepository; class cmXMLWriter; diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx index 5db06e6..bc503fc 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.cxx +++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx @@ -12,13 +12,20 @@ #include "cmCPackIFWPackage.h" +#include "CPack/cmCPackComponentGroup.h" +#include "CPack/cmCPackGenerator.h" +#include "CPack/cmCPackLog.h" #include "cmCPackIFWGenerator.h" - -#include <CPack/cmCPackLog.h> - -#include <cmGeneratedFileStream.h> -#include <cmTimestamp.h> -#include <cmXMLWriter.h> +#include "cmCPackIFWInstaller.h" +#include "cmGeneratedFileStream.h" +#include "cmSystemTools.h" +#include "cmTimestamp.h" +#include "cmXMLWriter.h" + +#include <cmConfigure.h> +#include <map> +#include <sstream> +#include <stddef.h> //----------------------------------------------------------------- Logger --- #ifdef cmCPackLogger diff --git a/Source/CPack/IFW/cmCPackIFWPackage.h b/Source/CPack/IFW/cmCPackIFWPackage.h index 55b07ec..579eeb8 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.h +++ b/Source/CPack/IFW/cmCPackIFWPackage.h @@ -13,12 +13,16 @@ #ifndef cmCPackIFWPackage_h #define cmCPackIFWPackage_h -#include <cmStandardIncludes.h> +#include <cmConfigure.h> // IWYU pragma: keep + +#include <set> +#include <string> +#include <vector> class cmCPackComponent; class cmCPackComponentGroup; -class cmCPackIFWInstaller; class cmCPackIFWGenerator; +class cmCPackIFWInstaller; class cmXMLWriter; /** \class cmCPackIFWPackage diff --git a/Source/CPack/IFW/cmCPackIFWRepository.cxx b/Source/CPack/IFW/cmCPackIFWRepository.cxx index fcb1c77..947e420 100644 --- a/Source/CPack/IFW/cmCPackIFWRepository.cxx +++ b/Source/CPack/IFW/cmCPackIFWRepository.cxx @@ -12,13 +12,15 @@ #include "cmCPackIFWRepository.h" +#include "CPack/cmCPackGenerator.h" #include "cmCPackIFWGenerator.h" +#include "cmGeneratedFileStream.h" +#include "cmSystemTools.h" +#include "cmXMLParser.h" +#include "cmXMLWriter.h" -#include <CPack/cmCPackLog.h> - -#include <cmGeneratedFileStream.h> -#include <cmXMLParser.h> -#include <cmXMLWriter.h> +#include <cmConfigure.h> +#include <stddef.h> #ifdef cmCPackLogger #undef cmCPackLogger diff --git a/Source/CPack/IFW/cmCPackIFWRepository.h b/Source/CPack/IFW/cmCPackIFWRepository.h index 5ffb775..a0c535b 100644 --- a/Source/CPack/IFW/cmCPackIFWRepository.h +++ b/Source/CPack/IFW/cmCPackIFWRepository.h @@ -13,7 +13,10 @@ #ifndef cmCPackIFWRepository_h #define cmCPackIFWRepository_h -#include <cmStandardIncludes.h> +#include <cmConfigure.h> // IWYU pragma: keep + +#include <string> +#include <vector> class cmCPackIFWGenerator; class cmXMLWriter; diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index d7f69a1..ba5787e 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -35,6 +35,7 @@ cmCPackWIXGenerator::cmCPackWIXGenerator() : Patch(0) + , ComponentGuidType(cmWIXSourceWriter::WIX_GENERATED_GUID) { } @@ -234,6 +235,12 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration() } } + // if install folder is supposed to be set absolutely, the default + // component guid "*" cannot be used + if (cmSystemTools::IsOn(GetOption("CPACK_WIX_SKIP_PROGRAM_FOLDER"))) { + this->ComponentGuidType = cmWIXSourceWriter::CMAKE_GENERATED_GUID; + } + return true; } @@ -317,7 +324,9 @@ void cmCPackWIXGenerator::CreateWiXVariablesIncludeFile() { std::string includeFilename = this->CPackTopLevel + "/cpack_variables.wxi"; - cmWIXSourceWriter includeFile(this->Logger, includeFilename, true); + cmWIXSourceWriter includeFile(this->Logger, includeFilename, + this->ComponentGuidType, + cmWIXSourceWriter::INCLUDE_ELEMENT_ROOT); CopyDefinition(includeFile, "CPACK_WIX_PRODUCT_GUID"); CopyDefinition(includeFile, "CPACK_WIX_UPGRADE_GUID"); @@ -338,7 +347,9 @@ void cmCPackWIXGenerator::CreateWiXPropertiesIncludeFile() { std::string includeFilename = this->CPackTopLevel + "/properties.wxi"; - cmWIXSourceWriter includeFile(this->Logger, includeFilename, true); + cmWIXSourceWriter includeFile(this->Logger, includeFilename, + this->ComponentGuidType, + cmWIXSourceWriter::INCLUDE_ELEMENT_ROOT); std::string prefix = "CPACK_WIX_PROPERTY_"; std::vector<std::string> options = GetOptions(); @@ -386,7 +397,9 @@ void cmCPackWIXGenerator::CreateWiXProductFragmentIncludeFile() { std::string includeFilename = this->CPackTopLevel + "/product_fragment.wxi"; - cmWIXSourceWriter includeFile(this->Logger, includeFilename, true); + cmWIXSourceWriter includeFile(this->Logger, includeFilename, + this->ComponentGuidType, + cmWIXSourceWriter::INCLUDE_ELEMENT_ROOT); this->Patch->ApplyFragment("#PRODUCT", includeFile); } @@ -413,13 +426,15 @@ void cmCPackWIXGenerator::AddDefinition(cmWIXSourceWriter& source, bool cmCPackWIXGenerator::CreateWiXSourceFiles() { + // if install folder is supposed to be set absolutely, the default + // component guid "*" cannot be used std::string directoryDefinitionsFilename = this->CPackTopLevel + "/directories.wxs"; this->WixSources.push_back(directoryDefinitionsFilename); cmWIXDirectoriesSourceWriter directoryDefinitions( - this->Logger, directoryDefinitionsFilename); + this->Logger, directoryDefinitionsFilename, this->ComponentGuidType); directoryDefinitions.BeginElement("Fragment"); std::string installRoot; @@ -439,13 +454,8 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() this->WixSources.push_back(fileDefinitionsFilename); - cmWIXFilesSourceWriter fileDefinitions(this->Logger, - fileDefinitionsFilename); - - // if install folder is supposed to be set absolutely, the default - // component guid "*" cannot be used - fileDefinitions.GenerateComponentGuids = - cmSystemTools::IsOn(GetOption("CPACK_WIX_SKIP_PROGRAM_FOLDER")); + cmWIXFilesSourceWriter fileDefinitions(this->Logger, fileDefinitionsFilename, + this->ComponentGuidType); fileDefinitions.BeginElement("Fragment"); @@ -454,8 +464,8 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() this->WixSources.push_back(featureDefinitionsFilename); - cmWIXFeaturesSourceWriter featureDefinitions(this->Logger, - featureDefinitionsFilename); + cmWIXFeaturesSourceWriter featureDefinitions( + this->Logger, featureDefinitionsFilename, this->ComponentGuidType); featureDefinitions.BeginElement("Fragment"); @@ -618,7 +628,7 @@ bool cmCPackWIXGenerator::CreateFeatureHierarchy( i != ComponentGroups.end(); ++i) { cmCPackComponentGroup const& group = i->second; if (group.ParentGroup == 0) { - featureDefinitions.EmitFeatureForComponentGroup(group); + featureDefinitions.EmitFeatureForComponentGroup(group, *this->Patch); } } @@ -628,7 +638,7 @@ bool cmCPackWIXGenerator::CreateFeatureHierarchy( cmCPackComponent const& component = i->second; if (!component.Group) { - featureDefinitions.EmitFeatureForComponent(component); + featureDefinitions.EmitFeatureForComponent(component, *this->Patch); } } @@ -764,7 +774,8 @@ bool cmCPackWIXGenerator::CreateShortcutsOfSpecificType( fileDefinitions.BeginElement("Component"); fileDefinitions.AddAttribute("Id", componentId); - fileDefinitions.AddAttribute("Guid", "*"); + fileDefinitions.AddAttribute( + "Guid", fileDefinitions.CreateGuidFromComponentId(componentId)); this->Patch->ApplyFragment(componentId, fileDefinitions); diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.h b/Source/CPack/WiX/cmCPackWIXGenerator.h index 9d3a522..883df9a 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.h +++ b/Source/CPack/WiX/cmCPackWIXGenerator.h @@ -162,6 +162,8 @@ private: std::string CPackTopLevel; cmWIXPatch* Patch; + + cmWIXSourceWriter::GuidType ComponentGuidType; }; #endif diff --git a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx index 97e3a51..9704195 100644 --- a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx @@ -13,8 +13,8 @@ #include "cmWIXDirectoriesSourceWriter.h" cmWIXDirectoriesSourceWriter::cmWIXDirectoriesSourceWriter( - cmCPackLog* logger, std::string const& filename) - : cmWIXSourceWriter(logger, filename) + cmCPackLog* logger, std::string const& filename, GuidType componentGuidType) + : cmWIXSourceWriter(logger, filename, componentGuidType) { } diff --git a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h index 023f4b8..6ebe281 100644 --- a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h +++ b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h @@ -25,8 +25,8 @@ class cmWIXDirectoriesSourceWriter : public cmWIXSourceWriter { public: - cmWIXDirectoriesSourceWriter(cmCPackLog* logger, - std::string const& filename); + cmWIXDirectoriesSourceWriter(cmCPackLog* logger, std::string const& filename, + GuidType componentGuidType); void EmitStartMenuFolder(std::string const& startMenuFolder); diff --git a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx index 1747b62..c9f17cc 100644 --- a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx @@ -13,8 +13,8 @@ #include "cmWIXFeaturesSourceWriter.h" cmWIXFeaturesSourceWriter::cmWIXFeaturesSourceWriter( - cmCPackLog* logger, std::string const& filename) - : cmWIXSourceWriter(logger, filename) + cmCPackLog* logger, std::string const& filename, GuidType componentGuidType) + : cmWIXSourceWriter(logger, filename, componentGuidType) { } @@ -24,7 +24,7 @@ void cmWIXFeaturesSourceWriter::CreateCMakePackageRegistryEntry( BeginElement("Component"); AddAttribute("Id", "CM_PACKAGE_REGISTRY"); AddAttribute("Directory", "TARGETDIR"); - AddAttribute("Guid", "*"); + AddAttribute("Guid", CreateGuidFromComponentId("CM_PACKAGE_REGISTRY")); std::string registryKey = std::string("Software\\Kitware\\CMake\\Packages\\") + package; @@ -42,7 +42,7 @@ void cmWIXFeaturesSourceWriter::CreateCMakePackageRegistryEntry( } void cmWIXFeaturesSourceWriter::EmitFeatureForComponentGroup( - cmCPackComponentGroup const& group) + cmCPackComponentGroup const& group, cmWIXPatch& patch) { BeginElement("Feature"); AddAttribute("Id", "CM_G_" + group.Name); @@ -57,20 +57,22 @@ void cmWIXFeaturesSourceWriter::EmitFeatureForComponentGroup( for (std::vector<cmCPackComponentGroup*>::const_iterator i = group.Subgroups.begin(); i != group.Subgroups.end(); ++i) { - EmitFeatureForComponentGroup(**i); + EmitFeatureForComponentGroup(**i, patch); } for (std::vector<cmCPackComponent*>::const_iterator i = group.Components.begin(); i != group.Components.end(); ++i) { - EmitFeatureForComponent(**i); + EmitFeatureForComponent(**i, patch); } + patch.ApplyFragment("CM_G_" + group.Name, *this); + EndElement("Feature"); } void cmWIXFeaturesSourceWriter::EmitFeatureForComponent( - cmCPackComponent const& component) + cmCPackComponent const& component, cmWIXPatch& patch) { BeginElement("Feature"); AddAttribute("Id", "CM_C_" + component.Name); @@ -90,6 +92,8 @@ void cmWIXFeaturesSourceWriter::EmitFeatureForComponent( AddAttribute("Level", "2"); } + patch.ApplyFragment("CM_C_" + component.Name, *this); + EndElement("Feature"); } diff --git a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h index ee9c17a..124ed42 100644 --- a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h +++ b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h @@ -13,6 +13,7 @@ #ifndef cmWIXFeaturesSourceWriter_h #define cmWIXFeaturesSourceWriter_h +#include "cmWIXPatch.h" #include "cmWIXSourceWriter.h" #include <CPack/cmCPackGenerator.h> @@ -23,14 +24,17 @@ class cmWIXFeaturesSourceWriter : public cmWIXSourceWriter { public: - cmWIXFeaturesSourceWriter(cmCPackLog* logger, std::string const& filename); + cmWIXFeaturesSourceWriter(cmCPackLog* logger, std::string const& filename, + GuidType componentGuidType); void CreateCMakePackageRegistryEntry(std::string const& package, std::string const& upgradeGuid); - void EmitFeatureForComponentGroup(const cmCPackComponentGroup& group); + void EmitFeatureForComponentGroup(const cmCPackComponentGroup& group, + cmWIXPatch& patch); - void EmitFeatureForComponent(const cmCPackComponent& component); + void EmitFeatureForComponent(const cmCPackComponent& component, + cmWIXPatch& patch); void EmitComponentRef(std::string const& id); }; diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx index dde9635..846edde 100644 --- a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx @@ -24,9 +24,9 @@ #include <sys/stat.h> cmWIXFilesSourceWriter::cmWIXFilesSourceWriter(cmCPackLog* logger, - std::string const& filename) - : cmWIXSourceWriter(logger, filename) - , GenerateComponentGuids(false) + std::string const& filename, + GuidType componentGuidType) + : cmWIXSourceWriter(logger, filename, componentGuidType) { } @@ -130,13 +130,7 @@ std::string cmWIXFilesSourceWriter::EmitComponentFile( std::string componentId = std::string("CM_C") + id; std::string fileId = std::string("CM_F") + id; - std::string guid = "*"; - if (this->GenerateComponentGuids) { - std::string md5 = cmSystemTools::ComputeStringMD5(componentId); - cmUuid uuid; - std::vector<unsigned char> ns; - guid = uuid.FromMd5(ns, md5); - } + std::string guid = CreateGuidFromComponentId(componentId); BeginElement("DirectoryRef"); AddAttribute("Id", directoryId); diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.h b/Source/CPack/WiX/cmWIXFilesSourceWriter.h index eeb84cb..c1952af 100644 --- a/Source/CPack/WiX/cmWIXFilesSourceWriter.h +++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.h @@ -26,7 +26,8 @@ class cmWIXFilesSourceWriter : public cmWIXSourceWriter { public: - cmWIXFilesSourceWriter(cmCPackLog* logger, std::string const& filename); + cmWIXFilesSourceWriter(cmCPackLog* logger, std::string const& filename, + GuidType componentGuidType); void EmitShortcut(std::string const& id, cmWIXShortcut const& shortcut, std::string const& shortcutPrefix, size_t shortcutIndex); @@ -47,8 +48,6 @@ public: std::string const& id, std::string const& filePath, cmWIXPatch& patch, cmInstalledFile const* installedFile); - - bool GenerateComponentGuids; }; #endif diff --git a/Source/CPack/WiX/cmWIXSourceWriter.cxx b/Source/CPack/WiX/cmWIXSourceWriter.cxx index 2c0384e..a287424 100644 --- a/Source/CPack/WiX/cmWIXSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXSourceWriter.cxx @@ -14,19 +14,23 @@ #include <CPack/cmCPackGenerator.h> +#include <cmUuid.h> + #include <windows.h> cmWIXSourceWriter::cmWIXSourceWriter(cmCPackLog* logger, std::string const& filename, - bool isIncludeFile) + GuidType componentGuidType, + RootElementType rootElementType) : Logger(logger) , File(filename.c_str()) , State(DEFAULT) , SourceFilename(filename) + , ComponentGuidType(componentGuidType) { WriteXMLDeclaration(); - if (isIncludeFile) { + if (rootElementType == INCLUDE_ELEMENT_ROOT) { BeginElement("Include"); } else { BeginElement("Wix"); @@ -173,6 +177,19 @@ std::string cmWIXSourceWriter::CMakeEncodingToUtf8(std::string const& value) #endif } +std::string cmWIXSourceWriter::CreateGuidFromComponentId( + std::string const& componentId) +{ + std::string guid = "*"; + if (this->ComponentGuidType == CMAKE_GENERATED_GUID) { + std::string md5 = cmSystemTools::ComputeStringMD5(componentId); + cmUuid uuid; + std::vector<unsigned char> ns; + guid = uuid.FromMd5(ns, md5); + } + return guid; +} + void cmWIXSourceWriter::WriteXMLDeclaration() { File << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl; diff --git a/Source/CPack/WiX/cmWIXSourceWriter.h b/Source/CPack/WiX/cmWIXSourceWriter.h index 4efc026..c29ffa7 100644 --- a/Source/CPack/WiX/cmWIXSourceWriter.h +++ b/Source/CPack/WiX/cmWIXSourceWriter.h @@ -26,8 +26,21 @@ class cmWIXSourceWriter { public: + enum GuidType + { + WIX_GENERATED_GUID, + CMAKE_GENERATED_GUID + }; + + enum RootElementType + { + WIX_ELEMENT_ROOT, + INCLUDE_ELEMENT_ROOT + }; + cmWIXSourceWriter(cmCPackLog* logger, std::string const& filename, - bool isIncludeFile = false); + GuidType componentGuidType, + RootElementType rootElementType = WIX_ELEMENT_ROOT); ~cmWIXSourceWriter(); @@ -45,6 +58,8 @@ public: void AddAttributeUnlessEmpty(std::string const& key, std::string const& value); + std::string CreateGuidFromComponentId(std::string const& componentId); + static std::string CMakeEncodingToUtf8(std::string const& value); protected: @@ -70,6 +85,8 @@ private: std::vector<std::string> Elements; std::string SourceFilename; + + GuidType ComponentGuidType; }; #endif diff --git a/Source/CPack/cmCPack7zGenerator.cxx b/Source/CPack/cmCPack7zGenerator.cxx index b01c216..39d2e54 100644 --- a/Source/CPack/cmCPack7zGenerator.cxx +++ b/Source/CPack/cmCPack7zGenerator.cxx @@ -12,6 +12,9 @@ #include "cmCPack7zGenerator.h" +#include "cmArchiveWrite.h" +#include "cmCPackArchiveGenerator.h" + cmCPack7zGenerator::cmCPack7zGenerator() : cmCPackArchiveGenerator(cmArchiveWrite::CompressNone, "7zip") { diff --git a/Source/CPack/cmCPack7zGenerator.h b/Source/CPack/cmCPack7zGenerator.h index ddbcc34..94add69 100644 --- a/Source/CPack/cmCPack7zGenerator.h +++ b/Source/CPack/cmCPack7zGenerator.h @@ -13,7 +13,11 @@ #ifndef cmCPack7zGenerator_h #define cmCPack7zGenerator_h +#include <cmConfigure.h> + #include "cmCPackArchiveGenerator.h" +#include "cmCPackGenerator.h" +#include "cmTypeMacro.h" /** \class cmCPack7zGenerator * \brief A generator for 7z files diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index 377fee1..ddf2ccb 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -12,17 +12,16 @@ #include "cmCPackArchiveGenerator.h" +#include "cmCPackComponentGroup.h" +#include "cmCPackGenerator.h" #include "cmCPackLog.h" #include "cmGeneratedFileStream.h" -#include "cmGlobalGenerator.h" -#include "cmMakefile.h" #include "cmSystemTools.h" -#include "cmake.h" -#include <errno.h> -#include <cm_libarchive.h> -#include <cmsys/Directory.hxx> -#include <cmsys/SystemTools.hxx> +#include <map> +#include <ostream> +#include <utility> +#include <vector> cmCPackArchiveGenerator::cmCPackArchiveGenerator(cmArchiveWrite::Compress t, std::string const& format) diff --git a/Source/CPack/cmCPackArchiveGenerator.h b/Source/CPack/cmCPackArchiveGenerator.h index a018ebd..6db6fb0 100644 --- a/Source/CPack/cmCPackArchiveGenerator.h +++ b/Source/CPack/cmCPackArchiveGenerator.h @@ -13,9 +13,16 @@ #ifndef cmCPackArchiveGenerator_h #define cmCPackArchiveGenerator_h -#include "cmCPackGenerator.h" +#include <cmConfigure.h> #include "cmArchiveWrite.h" +#include "cmCPackGenerator.h" +#include "cmTypeMacro.h" + +#include <iosfwd> +#include <string> + +class cmCPackComponent; /** \class cmCPackArchiveGenerator * \brief A generator base for libarchive generation. diff --git a/Source/CPack/cmCPackComponentGroup.h b/Source/CPack/cmCPackComponentGroup.h index 78b81b3..8e9218e 100644 --- a/Source/CPack/cmCPackComponentGroup.h +++ b/Source/CPack/cmCPackComponentGroup.h @@ -15,7 +15,8 @@ #include <cmConfigure.h> -#include "cmStandardIncludes.h" +#include <string> +#include <vector> class cmCPackComponentGroup; diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index b909598..2e18265 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -13,16 +13,21 @@ #include "cmCPackDebGenerator.h" #include "cmArchiveWrite.h" +#include "cmCPackComponentGroup.h" +#include "cmCPackGenerator.h" #include "cmCPackLog.h" #include "cmGeneratedFileStream.h" -#include "cmMakefile.h" #include "cmSystemTools.h" #include <cmsys/Glob.hxx> -#include <cmsys/SystemTools.hxx> - -#include <limits.h> // USHRT_MAX +#include <limits.h> +#include <map> +#include <ostream> +#include <set> +#include <stdio.h> +#include <string.h> #include <sys/stat.h> +#include <utility> // NOTE: // A debian package .deb is simply an 'ar' archive. The only subtle difference @@ -743,14 +748,6 @@ std::string cmCPackDebGenerator::GetComponentInstallDirNameSuffix( * SUCH DAMAGE. */ -#include <sys/types.h> -// include sys/stat.h after sys/types.h -#include <sys/stat.h> - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - #define ARMAG "!<arch>\n" /* ar "magic number" */ #define SARMAG 8 /* strlen(ARMAG); */ diff --git a/Source/CPack/cmCPackDebGenerator.h b/Source/CPack/cmCPackDebGenerator.h index bcdc509..c76bf99 100644 --- a/Source/CPack/cmCPackDebGenerator.h +++ b/Source/CPack/cmCPackDebGenerator.h @@ -13,7 +13,13 @@ #ifndef cmCPackDebGenerator_h #define cmCPackDebGenerator_h +#include <cmConfigure.h> + #include "cmCPackGenerator.h" +#include "cmTypeMacro.h" + +#include <string> +#include <vector> /** \class cmCPackDebGenerator * \brief A generator for Debian packages diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 96c218c..d6b58f2 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -17,14 +17,17 @@ #include "cmGeneratedFileStream.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" +#include "cmState.h" #include "cmXMLSafe.h" +#include "cm_auto_ptr.hxx" #include "cmake.h" #include <algorithm> #include <cmsys/FStream.hxx> #include <cmsys/Glob.hxx> -#include <cmsys/SystemTools.hxx> +#include <cmsys/RegularExpression.hxx> #include <list> +#include <utility> #if defined(__HAIKU__) #include <FindDirectory.h> diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index 23e4bb7..f89f349 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -13,15 +13,21 @@ #ifndef cmCPackGenerator_h #define cmCPackGenerator_h -#include "cmObject.h" +#include <cmConfigure.h> +#include "cmCPackComponentGroup.h" +#include "cmObject.h" #include "cmSystemTools.h" +#include "cmTypeMacro.h" + #include <map> +#include <sstream> +#include <string> #include <vector> -#include "cmCPackComponentGroup.h" // cmCPackComponent and friends -// Forward declarations are insufficient since we use them in -// std::map data members below... +class cmCPackLog; +class cmInstalledFile; +class cmMakefile; #define cmCPackTypeMacro(klass, superclass) \ cmTypeMacro(klass, superclass); \ @@ -46,10 +52,6 @@ #endif #define cout no_cout_use_cmCPack_Log -class cmMakefile; -class cmCPackLog; -class cmInstalledFile; - /** \class cmCPackGenerator * \brief A superclass of all CPack Generators * diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx index 0f0268f..fb84739 100644 --- a/Source/CPack/cmCPackGeneratorFactory.cxx +++ b/Source/CPack/cmCPackGeneratorFactory.cxx @@ -49,6 +49,9 @@ #include "cmAlgorithms.h" #include "cmCPackLog.h" +#include <ostream> +#include <utility> + cmCPackGeneratorFactory::cmCPackGeneratorFactory() { if (cmCPackTGZGenerator::CanGenerate()) { diff --git a/Source/CPack/cmCPackGeneratorFactory.h b/Source/CPack/cmCPackGeneratorFactory.h index f0ed57a..4c07ea3 100644 --- a/Source/CPack/cmCPackGeneratorFactory.h +++ b/Source/CPack/cmCPackGeneratorFactory.h @@ -13,10 +13,17 @@ #ifndef cmCPackGeneratorFactory_h #define cmCPackGeneratorFactory_h +#include <cmConfigure.h> + #include "cmObject.h" +#include "cmTypeMacro.h" + +#include <map> +#include <string> +#include <vector> -class cmCPackLog; class cmCPackGenerator; +class cmCPackLog; /** \class cmCPackGeneratorFactory * \brief A container for CPack generators diff --git a/Source/CPack/cmCPackLog.cxx b/Source/CPack/cmCPackLog.cxx index 339323e..8439de1 100644 --- a/Source/CPack/cmCPackLog.cxx +++ b/Source/CPack/cmCPackLog.cxx @@ -15,6 +15,8 @@ #include "cmGeneratedFileStream.h" #include "cmSystemTools.h" +#include <iostream> + cmCPackLog::cmCPackLog() { this->Verbose = false; diff --git a/Source/CPack/cmCPackLog.h b/Source/CPack/cmCPackLog.h index 77f0f0b..c1bf82c 100644 --- a/Source/CPack/cmCPackLog.h +++ b/Source/CPack/cmCPackLog.h @@ -13,7 +13,14 @@ #ifndef cmCPackLog_h #define cmCPackLog_h +#include <cmConfigure.h> + #include "cmObject.h" +#include "cmTypeMacro.h" + +#include <ostream> +#include <string.h> +#include <string> #define cmCPack_Log(ctSelf, logType, msg) \ do { \ diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index d8ff907..2db94f1 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -13,16 +13,19 @@ #include "cmCPackNSISGenerator.h" #include "cmCPackComponentGroup.h" +#include "cmCPackGenerator.h" #include "cmCPackLog.h" #include "cmGeneratedFileStream.h" -#include "cmGlobalGenerator.h" -#include "cmMakefile.h" #include "cmSystemTools.h" +#include <algorithm> #include <cmsys/Directory.hxx> -#include <cmsys/Glob.hxx> #include <cmsys/RegularExpression.hxx> -#include <cmsys/SystemTools.hxx> +#include <map> +#include <sstream> +#include <stdlib.h> +#include <string.h> +#include <utility> /* NSIS uses different command line syntax on Windows and others */ #ifdef _WIN32 diff --git a/Source/CPack/cmCPackNSISGenerator.h b/Source/CPack/cmCPackNSISGenerator.h index 4923cf0..ae03e6b 100644 --- a/Source/CPack/cmCPackNSISGenerator.h +++ b/Source/CPack/cmCPackNSISGenerator.h @@ -13,9 +13,18 @@ #ifndef cmCPackNSISGenerator_h #define cmCPackNSISGenerator_h +#include <cmConfigure.h> + #include "cmCPackGenerator.h" +#include "cmTypeMacro.h" +#include <iosfwd> #include <set> +#include <string> +#include <vector> + +class cmCPackComponent; +class cmCPackComponentGroup; /** \class cmCPackNSISGenerator * \brief A generator for NSIS files diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx index 5d81a49..0f2e9b9 100644 --- a/Source/CPack/cmCPackRPMGenerator.cxx +++ b/Source/CPack/cmCPackRPMGenerator.cxx @@ -11,9 +11,17 @@ ============================================================================*/ #include "cmCPackRPMGenerator.h" +#include "cmCPackComponentGroup.h" +#include "cmCPackGenerator.h" #include "cmCPackLog.h" #include "cmSystemTools.h" +#include <algorithm> +#include <map> +#include <ostream> +#include <utility> +#include <vector> + cmCPackRPMGenerator::cmCPackRPMGenerator() { } diff --git a/Source/CPack/cmCPackRPMGenerator.h b/Source/CPack/cmCPackRPMGenerator.h index 4baef08..10c5572 100644 --- a/Source/CPack/cmCPackRPMGenerator.h +++ b/Source/CPack/cmCPackRPMGenerator.h @@ -13,7 +13,12 @@ #ifndef cmCPackRPMGenerator_h #define cmCPackRPMGenerator_h +#include <cmConfigure.h> + #include "cmCPackGenerator.h" +#include "cmTypeMacro.h" + +#include <string> /** \class cmCPackRPMGenerator * \brief A generator for RPM packages diff --git a/Source/CPack/cmCPackSTGZGenerator.cxx b/Source/CPack/cmCPackSTGZGenerator.cxx index 4d07a7e..4c33a08 100644 --- a/Source/CPack/cmCPackSTGZGenerator.cxx +++ b/Source/CPack/cmCPackSTGZGenerator.cxx @@ -12,13 +12,15 @@ #include "cmCPackSTGZGenerator.h" +#include "cmCPackGenerator.h" #include "cmCPackLog.h" -#include "cmGlobalGenerator.h" -#include "cmMakefile.h" #include "cmSystemTools.h" -#include "cmake.h" #include <cmsys/FStream.hxx> +#include <sstream> +#include <stdio.h> +#include <string> +#include <vector> #include <sys/types.h> // include sys/stat.h after sys/types.h diff --git a/Source/CPack/cmCPackSTGZGenerator.h b/Source/CPack/cmCPackSTGZGenerator.h index 94cc8aa..2a68f2c 100644 --- a/Source/CPack/cmCPackSTGZGenerator.h +++ b/Source/CPack/cmCPackSTGZGenerator.h @@ -13,7 +13,13 @@ #ifndef cmCPackSTGZGenerator_h #define cmCPackSTGZGenerator_h +#include <cmConfigure.h> + +#include "cmCPackGenerator.h" #include "cmCPackTGZGenerator.h" +#include "cmTypeMacro.h" + +#include <iosfwd> /** \class cmCPackSTGZGenerator * \brief A generator for Self extractable TGZ files diff --git a/Source/CPack/cmCPackTGZGenerator.cxx b/Source/CPack/cmCPackTGZGenerator.cxx index 7c5c245..8df53a8 100644 --- a/Source/CPack/cmCPackTGZGenerator.cxx +++ b/Source/CPack/cmCPackTGZGenerator.cxx @@ -12,6 +12,9 @@ #include "cmCPackTGZGenerator.h" +#include "cmArchiveWrite.h" +#include "cmCPackArchiveGenerator.h" + cmCPackTGZGenerator::cmCPackTGZGenerator() : cmCPackArchiveGenerator(cmArchiveWrite::CompressGZip, "paxr") { diff --git a/Source/CPack/cmCPackTGZGenerator.h b/Source/CPack/cmCPackTGZGenerator.h index cb7620c..78cd109 100644 --- a/Source/CPack/cmCPackTGZGenerator.h +++ b/Source/CPack/cmCPackTGZGenerator.h @@ -13,7 +13,11 @@ #ifndef cmCPackTGZGenerator_h #define cmCPackTGZGenerator_h +#include <cmConfigure.h> + #include "cmCPackArchiveGenerator.h" +#include "cmCPackGenerator.h" +#include "cmTypeMacro.h" /** \class cmCPackTGZGenerator * \brief A generator for TGZ files diff --git a/Source/CPack/cmCPackTXZGenerator.cxx b/Source/CPack/cmCPackTXZGenerator.cxx index d17a164..c708022 100644 --- a/Source/CPack/cmCPackTXZGenerator.cxx +++ b/Source/CPack/cmCPackTXZGenerator.cxx @@ -12,6 +12,9 @@ #include "cmCPackTXZGenerator.h" +#include "cmArchiveWrite.h" +#include "cmCPackArchiveGenerator.h" + cmCPackTXZGenerator::cmCPackTXZGenerator() : cmCPackArchiveGenerator(cmArchiveWrite::CompressXZ, "paxr") { diff --git a/Source/CPack/cmCPackTXZGenerator.h b/Source/CPack/cmCPackTXZGenerator.h index 87c92ef..6d6db74 100644 --- a/Source/CPack/cmCPackTXZGenerator.h +++ b/Source/CPack/cmCPackTXZGenerator.h @@ -13,7 +13,11 @@ #ifndef cmCPackTXZGenerator_h #define cmCPackTXZGenerator_h +#include <cmConfigure.h> + #include "cmCPackArchiveGenerator.h" +#include "cmCPackGenerator.h" +#include "cmTypeMacro.h" /** \class cmCPackTXZGenerator * \brief A generator for TXZ files diff --git a/Source/CPack/cmCPackTarBZip2Generator.cxx b/Source/CPack/cmCPackTarBZip2Generator.cxx index 694d392..09bda8c 100644 --- a/Source/CPack/cmCPackTarBZip2Generator.cxx +++ b/Source/CPack/cmCPackTarBZip2Generator.cxx @@ -12,6 +12,9 @@ #include "cmCPackTarBZip2Generator.h" +#include "cmArchiveWrite.h" +#include "cmCPackArchiveGenerator.h" + cmCPackTarBZip2Generator::cmCPackTarBZip2Generator() : cmCPackArchiveGenerator(cmArchiveWrite::CompressBZip2, "paxr") { diff --git a/Source/CPack/cmCPackTarBZip2Generator.h b/Source/CPack/cmCPackTarBZip2Generator.h index 6fec882..d7b7277 100644 --- a/Source/CPack/cmCPackTarBZip2Generator.h +++ b/Source/CPack/cmCPackTarBZip2Generator.h @@ -13,7 +13,11 @@ #ifndef cmCPackTarBZip2Generator_h #define cmCPackTarBZip2Generator_h +#include <cmConfigure.h> + #include "cmCPackArchiveGenerator.h" +#include "cmCPackGenerator.h" +#include "cmTypeMacro.h" /** \class cmCPackTarBZip2Generator * \brief A generator for TarBZip2 files diff --git a/Source/CPack/cmCPackTarCompressGenerator.cxx b/Source/CPack/cmCPackTarCompressGenerator.cxx index aec6893..a2b0b66 100644 --- a/Source/CPack/cmCPackTarCompressGenerator.cxx +++ b/Source/CPack/cmCPackTarCompressGenerator.cxx @@ -12,6 +12,9 @@ #include "cmCPackTarCompressGenerator.h" +#include "cmArchiveWrite.h" +#include "cmCPackArchiveGenerator.h" + cmCPackTarCompressGenerator::cmCPackTarCompressGenerator() : cmCPackArchiveGenerator(cmArchiveWrite::CompressCompress, "paxr") { diff --git a/Source/CPack/cmCPackTarCompressGenerator.h b/Source/CPack/cmCPackTarCompressGenerator.h index 02926a2..9213d81 100644 --- a/Source/CPack/cmCPackTarCompressGenerator.h +++ b/Source/CPack/cmCPackTarCompressGenerator.h @@ -13,7 +13,11 @@ #ifndef cmCPackTarCompressGenerator_h #define cmCPackTarCompressGenerator_h -#include "cmCPackTGZGenerator.h" +#include <cmConfigure.h> + +#include "cmCPackArchiveGenerator.h" +#include "cmCPackGenerator.h" +#include "cmTypeMacro.h" /** \class cmCPackTarCompressGenerator * \brief A generator for TarCompress files diff --git a/Source/CPack/cmCPackZIPGenerator.cxx b/Source/CPack/cmCPackZIPGenerator.cxx index 9b42e6d..f2a2547 100644 --- a/Source/CPack/cmCPackZIPGenerator.cxx +++ b/Source/CPack/cmCPackZIPGenerator.cxx @@ -12,6 +12,9 @@ #include "cmCPackZIPGenerator.h" +#include "cmArchiveWrite.h" +#include "cmCPackArchiveGenerator.h" + cmCPackZIPGenerator::cmCPackZIPGenerator() : cmCPackArchiveGenerator(cmArchiveWrite::CompressNone, "zip") { diff --git a/Source/CPack/cmCPackZIPGenerator.h b/Source/CPack/cmCPackZIPGenerator.h index 1130826..fdb10a9 100644 --- a/Source/CPack/cmCPackZIPGenerator.h +++ b/Source/CPack/cmCPackZIPGenerator.h @@ -13,7 +13,11 @@ #ifndef cmCPackZIPGenerator_h #define cmCPackZIPGenerator_h +#include <cmConfigure.h> + #include "cmCPackArchiveGenerator.h" +#include "cmCPackGenerator.h" +#include "cmTypeMacro.h" /** \class cmCPackZIPGenerator * \brief A generator for ZIP files diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index de572c0..be524b3 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -9,22 +9,30 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#include "cmSystemTools.h" +#include <cmConfigure.h> -// Need these for documentation support. #include "cmCPackGenerator.h" #include "cmCPackGeneratorFactory.h" +#include "cmCPackLog.h" #include "cmDocumentation.h" +#include "cmDocumentationEntry.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" +#include "cmState.h" +#include "cmSystemTools.h" +#include "cmTypeMacro.h" +#include "cm_auto_ptr.hxx" #include "cmake.h" -#include "cmake.h" - -#include "cmCPackLog.h" #include <cmsys/CommandLineArguments.hxx> #include <cmsys/Encoding.hxx> -#include <cmsys/SystemTools.hxx> +#include <iostream> +#include <map> +#include <sstream> +#include <stddef.h> +#include <string> +#include <utility> +#include <vector> static const char* cmDocumentationName[][2] = { { CM_NULLPTR, " cpack - Packaging driver provided by CMake." }, diff --git a/Source/CPack/cygwin.readme b/Source/CPack/cygwin.readme deleted file mode 100644 index c0cd4b9..0000000 --- a/Source/CPack/cygwin.readme +++ /dev/null @@ -1,69 +0,0 @@ -http://cygwin.com/setup.html - - -Need to produce two tar files: - -Source- - -- create subdirs -- copy src -- duplicate src -- configure files into duplicate src - CPack.cygwin-readme.in - CPack.cygwin-install.sh.in - CPack.setup.hint.in -- diff duplicate src and orig src -- write diff into toplevel -- create tar file call super class - -cmake-2.2.3-1 - - -1. a source release -cmake-2.2.3-2-src.tar.bz2 - -cmake-2.2.3-2.patch has cmake-2.2.3/CYGWIN-PATCHES/cmake.README cmake-2.2.3/CYGWIN-PATCHES/setup.hint -cmake-2.2.3-2.sh -> script to create cygwin release -cmake-2.2.3.tar.bz2 -> unmodified cmake sources for 2.2.3 - - - - - -2 a binary release -cmake-2.2.3-2.tar.bz2 - -normal binary release with use as the root of the tree: - -Here is the bootstrap command used: - - ${SOURCE_DIR}/bootstrap --prefix=/usr --datadir=/share/cmake-${VER} \ - --docdir=/share/doc/cmake-${VER} --mandir=/share/man - -CMAKE_DOC_DIR /share/doc/${PKG}-${VER} -CMAKE_MAN_DIR /share/man -CMAKE_DATA_DIR /share/${PKG}-${VER} - -Here is the directory stucture: - -usr/bin/cmake.exe -usr/share/doc/cmake-2.2.3/MANIFEST *** -usr/share/doc/Cygwin/cmake-2.2.3-2.README **** -usr/share/cmake-2.2.3/Modules - - - -usr/bin -usr/share/cmake-2.2.3/include -usr/share/cmake-2.2.3/Modules/Platform -usr/share/cmake-2.2.3/Modules -usr/share/cmake-2.2.3/Templates -usr/share/cmake-2.2.3 -usr/share/doc/cmake-2.2.3 -usr/share/doc/Cygwin -usr/share/doc -usr/share/man/man1 -usr/share/man -usr/share -usr - diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index f680612..0832820 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -108,13 +108,8 @@ std::string cmCTestSVN::LoadInfo(SVNInfo& svninfo) void cmCTestSVN::NoteOldRevision() { - // Info for root repository - this->Repositories.push_back(SVNInfo("")); - this->RootInfo = &(this->Repositories.back()); - // Info for the external repositories - this->LoadExternals(); + this->LoadRepositories(); - // Get info for all the repositories std::list<SVNInfo>::iterator itbeg = this->Repositories.begin(); std::list<SVNInfo>::iterator itend = this->Repositories.end(); for (; itbeg != itend; itbeg++) { @@ -134,7 +129,8 @@ void cmCTestSVN::NoteOldRevision() void cmCTestSVN::NoteNewRevision() { - // Get info for the external repositories + this->LoadRepositories(); + std::list<SVNInfo>::iterator itbeg = this->Repositories.begin(); std::list<SVNInfo>::iterator itend = this->Repositories.end(); for (; itbeg != itend; itbeg++) { @@ -534,8 +530,13 @@ private: } }; -void cmCTestSVN::LoadExternals() +void cmCTestSVN::LoadRepositories() { + // Info for root repository + this->Repositories.clear(); + this->Repositories.push_back(SVNInfo("")); + this->RootInfo = &(this->Repositories.back()); + // Run "svn status" to get the list of external repositories std::vector<const char*> svn_status; svn_status.push_back("status"); diff --git a/Source/CTest/cmCTestSVN.h b/Source/CTest/cmCTestSVN.h index 6f2374d..2301b10 100644 --- a/Source/CTest/cmCTestSVN.h +++ b/Source/CTest/cmCTestSVN.h @@ -86,7 +86,7 @@ private: SVNInfo* RootInfo; std::string LoadInfo(SVNInfo& svninfo); - void LoadExternals(); + void LoadRepositories(); void LoadModifications() CM_OVERRIDE; void LoadRevisions() CM_OVERRIDE; void LoadRevisions(SVNInfo& svninfo); diff --git a/Source/CursesDialog/cmCursesStandardIncludes.h b/Source/CursesDialog/cmCursesStandardIncludes.h index 4929958..1d8d7c6 100644 --- a/Source/CursesDialog/cmCursesStandardIncludes.h +++ b/Source/CursesDialog/cmCursesStandardIncludes.h @@ -14,10 +14,6 @@ #include <cmConfigure.h> -#if defined(__sun__) && defined(__GNUC__) -#define _MSE_INT_H -#endif - #if defined(__hpux) #define _BOOL_DEFINED #include <sys/time.h> diff --git a/Source/CursesDialog/form/form.h b/Source/CursesDialog/form/form.h index 1219cb5..b65a3ca 100644 --- a/Source/CursesDialog/form/form.h +++ b/Source/CursesDialog/form/form.h @@ -33,10 +33,6 @@ #ifndef FORM_H #define FORM_H -#if defined(__sun__) && defined(__GNUC__) - #define _MSE_INT_H -#endif - #include <cmFormConfigure.h> /* figure out which curses.h to include */ diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index 5b84597..14ce3f7 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -14,6 +14,7 @@ #include <QCloseEvent> #include <QCoreApplication> +#include <QDesktopServices> #include <QDialogButtonBox> #include <QDragEnterEvent> #include <QFileDialog> @@ -227,6 +228,8 @@ void CMakeSetupDialog::initialize() QObject::connect(this->GenerateButton, SIGNAL(clicked(bool)), this, SLOT(doGenerate())); + QObject::connect(this->OpenProjectButton, SIGNAL(clicked(bool)), this, + SLOT(doOpenProject())); QObject::connect(this->BrowseSourceDirectoryButton, SIGNAL(clicked(bool)), this, SLOT(doSourceBrowse())); @@ -499,6 +502,26 @@ void CMakeSetupDialog::doGenerate() this->ConfigureNeeded = true; } +QString CMakeSetupDialog::getProjectFilename() +{ + QStringList nameFilter; + nameFilter << "*.sln" + << "*.xcodeproj"; + QDir directory(this->BinaryDirectory->currentText()); + QStringList nlnFile = directory.entryList(nameFilter); + + if (nlnFile.count() == 1) { + return this->BinaryDirectory->currentText() + "/" + nlnFile.at(0); + } + + return QString(); +} + +void CMakeSetupDialog::doOpenProject() +{ + QDesktopServices::openUrl(QUrl::fromLocalFile(this->getProjectFilename())); +} + void CMakeSetupDialog::closeEvent(QCloseEvent* e) { // prompt for close if there are unsaved changes, and we're not busy @@ -617,6 +640,11 @@ void CMakeSetupDialog::updateBinaryDirectory(const QString& dir) this->BinaryDirectory->setEditText(dir); this->BinaryDirectory->blockSignals(false); } + if (!this->getProjectFilename().isEmpty()) { + this->OpenProjectButton->setEnabled(true); + } else { + this->OpenProjectButton->setEnabled(false); + } } void CMakeSetupDialog::doBinaryBrowse() @@ -1002,22 +1030,28 @@ void CMakeSetupDialog::enterState(CMakeSetupDialog::State s) if (s == Interrupting) { this->ConfigureButton->setEnabled(false); this->GenerateButton->setEnabled(false); + this->OpenProjectButton->setEnabled(false); } else if (s == Configuring) { this->setEnabledState(false); this->GenerateButton->setEnabled(false); this->GenerateAction->setEnabled(false); + this->OpenProjectButton->setEnabled(false); this->ConfigureButton->setText(tr("&Stop")); } else if (s == Generating) { this->CacheModified = false; this->setEnabledState(false); this->ConfigureButton->setEnabled(false); this->GenerateAction->setEnabled(false); + this->OpenProjectButton->setEnabled(false); this->GenerateButton->setText(tr("&Stop")); } else if (s == ReadyConfigure) { this->setEnabledState(true); this->GenerateButton->setEnabled(true); this->GenerateAction->setEnabled(true); this->ConfigureButton->setEnabled(true); + if (!this->getProjectFilename().isEmpty()) { + this->OpenProjectButton->setEnabled(true); + } this->ConfigureButton->setText(tr("&Configure")); this->GenerateButton->setText(tr("&Generate")); } else if (s == ReadyGenerate) { @@ -1025,6 +1059,9 @@ void CMakeSetupDialog::enterState(CMakeSetupDialog::State s) this->GenerateButton->setEnabled(true); this->GenerateAction->setEnabled(true); this->ConfigureButton->setEnabled(true); + if (!this->getProjectFilename().isEmpty()) { + this->OpenProjectButton->setEnabled(true); + } this->ConfigureButton->setText(tr("&Configure")); this->GenerateButton->setText(tr("&Generate")); } diff --git a/Source/QtDialog/CMakeSetupDialog.h b/Source/QtDialog/CMakeSetupDialog.h index 2a4ea7a..992de01 100644 --- a/Source/QtDialog/CMakeSetupDialog.h +++ b/Source/QtDialog/CMakeSetupDialog.h @@ -41,6 +41,8 @@ protected slots: void initialize(); void doConfigure(); void doGenerate(); + QString getProjectFilename(); + void doOpenProject(); void doInstallForCommandLine(); void doHelp(); void doAbout(); diff --git a/Source/QtDialog/CMakeSetupDialog.ui b/Source/QtDialog/CMakeSetupDialog.ui index b04bd93..8d8e0cd 100644 --- a/Source/QtDialog/CMakeSetupDialog.ui +++ b/Source/QtDialog/CMakeSetupDialog.ui @@ -238,6 +238,13 @@ </property> </widget> </item> + <item> + <widget class="QPushButton" name="OpenProjectButton"> + <property name="text"> + <string>Open &Project</string> + </property> + </widget> + </item> <item> <widget class="QLabel" name="Generator"> <property name="text"> diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx index 88ea049..ed11f7b 100644 --- a/Source/QtDialog/QCMakeCacheView.cxx +++ b/Source/QtDialog/QCMakeCacheView.cxx @@ -95,10 +95,7 @@ protected: // if there are no children if (!m->hasChildren(idx)) { bool adv = m->data(idx, QCMakeCacheModel::AdvancedRole).toBool(); - if (!adv || (adv && this->ShowAdvanced)) { - return true; - } - return false; + return !adv || this->ShowAdvanced; } // check children @@ -554,14 +551,16 @@ QWidget* QCMakeCacheModelDelegate::createEditor( QObject::connect(editor, SIGNAL(fileDialogExists(bool)), this, SLOT(setFileDialogFlag(bool))); return editor; - } else if (type == QCMakeProperty::FILEPATH) { + } + if (type == QCMakeProperty::FILEPATH) { QCMakeFilePathEditor* editor = new QCMakeFilePathEditor(p, var.data(Qt::DisplayRole).toString()); QObject::connect(editor, SIGNAL(fileDialogExists(bool)), this, SLOT(setFileDialogFlag(bool))); return editor; - } else if (type == QCMakeProperty::STRING && - var.data(QCMakeCacheModel::StringsRole).isValid()) { + } + if (type == QCMakeProperty::STRING && + var.data(QCMakeCacheModel::StringsRole).isValid()) { QCMakeComboBox* editor = new QCMakeComboBox( p, var.data(QCMakeCacheModel::StringsRole).toStringList()); editor->setFrame(false); diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index 1eece98..eb4c1ec 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -130,6 +130,12 @@ bool cmDependsFortran::WriteDependencies(const std::set<std::string>& sources, if (cmFortran_yyparse(parser.Scanner) != 0) { // Failed to parse the file. Report failure to write dependencies. okay = false; + /* clang-format off */ + std::cerr << + "warning: failed to parse dependencies from Fortran source " + "'" << src << "': " << parser.Error << std::endl + ; + /* clang-format on */ } } return okay; @@ -706,10 +712,5 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, // Compare the remaining content. If no compiler id matched above, // including the case none was given, this will compare the whole // content. - if (!cmFortranStreamsDiffer(finModFile, finStampFile)) { - return false; - } - - // The modules are different. - return true; + return cmFortranStreamsDiffer(finModFile, finStampFile); } diff --git a/Source/cmExecutionStatus.h b/Source/cmExecutionStatus.h index 14e1454..7302837 100644 --- a/Source/cmExecutionStatus.h +++ b/Source/cmExecutionStatus.h @@ -40,12 +40,16 @@ public: this->ReturnInvoked = false; this->BreakInvoked = false; this->ContinueInvoked = false; + this->NestedError = false; } + void SetNestedError(bool val) { this->NestedError = val; } + bool GetNestedError() { return this->NestedError; } private: bool ReturnInvoked; bool BreakInvoked; bool ContinueInvoked; + bool NestedError; }; #endif diff --git a/Source/cmExportBuildAndroidMKGenerator.cxx b/Source/cmExportBuildAndroidMKGenerator.cxx new file mode 100644 index 0000000..3247cc8 --- /dev/null +++ b/Source/cmExportBuildAndroidMKGenerator.cxx @@ -0,0 +1,193 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmExportBuildAndroidMKGenerator.h" + +#include "cmExportSet.h" +#include "cmGeneratorTarget.h" +#include "cmGlobalGenerator.h" +#include "cmLocalGenerator.h" +#include "cmMakefile.h" +#include "cmTargetExport.h" + +cmExportBuildAndroidMKGenerator::cmExportBuildAndroidMKGenerator() +{ + this->LG = CM_NULLPTR; + this->ExportSet = CM_NULLPTR; +} + +void cmExportBuildAndroidMKGenerator::GenerateImportHeaderCode( + std::ostream& os, const std::string&) +{ + os << "LOCAL_PATH := $(call my-dir)\n\n"; +} + +void cmExportBuildAndroidMKGenerator::GenerateImportFooterCode(std::ostream&) +{ +} + +void cmExportBuildAndroidMKGenerator::GenerateExpectedTargetsCode( + std::ostream&, const std::string&) +{ +} + +void cmExportBuildAndroidMKGenerator::GenerateImportTargetCode( + std::ostream& os, const cmGeneratorTarget* target) +{ + std::string targetName = this->Namespace; + targetName += target->GetExportName(); + os << "include $(CLEAR_VARS)\n"; + os << "LOCAL_MODULE := "; + os << targetName << "\n"; + os << "LOCAL_SRC_FILES := "; + std::string path = target->GetLocalGenerator()->ConvertToOutputFormat( + target->GetFullPath(), cmOutputConverter::MAKERULE); + os << path << "\n"; +} + +void cmExportBuildAndroidMKGenerator::GenerateImportPropertyCode( + std::ostream&, const std::string&, cmGeneratorTarget const*, + ImportPropertyMap const&) +{ +} + +void cmExportBuildAndroidMKGenerator::GenerateMissingTargetsCheckCode( + std::ostream&, const std::vector<std::string>&) +{ +} + +void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties( + const cmGeneratorTarget* target, std::ostream& os, + const ImportPropertyMap& properties) +{ + std::string config = ""; + if (this->Configurations.size()) { + config = this->Configurations[0]; + } + cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties( + target, os, properties, cmExportBuildAndroidMKGenerator::BUILD, config); +} + +void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties( + const cmGeneratorTarget* target, std::ostream& os, + const ImportPropertyMap& properties, GenerateType type, + std::string const& config) +{ + const bool newCMP0022Behavior = + target->GetPolicyStatusCMP0022() != cmPolicies::WARN && + target->GetPolicyStatusCMP0022() != cmPolicies::OLD; + if (!newCMP0022Behavior) { + std::ostringstream w; + if (type == cmExportBuildAndroidMKGenerator::BUILD) { + w << "export(TARGETS ... ANDROID_MK) called with policy CMP0022"; + } else { + w << "install( EXPORT_ANDROID_MK ...) called with policy CMP0022"; + } + w << " set to OLD for target " << target->Target->GetName() << ". " + << "The export will only work with CMP0022 set to NEW."; + target->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + } + if (!properties.empty()) { + os << "LOCAL_CPP_FEATURES := rtti exceptions\n"; + for (ImportPropertyMap::const_iterator pi = properties.begin(); + pi != properties.end(); ++pi) { + if (pi->first == "INTERFACE_COMPILE_OPTIONS") { + os << "LOCAL_CPP_FEATURES += "; + os << (pi->second) << "\n"; + } else if (pi->first == "INTERFACE_LINK_LIBRARIES") { + // need to look at list in pi->second and see if static or shared + // FindTargetToLink + // target->GetLocalGenerator()->FindGeneratorTargetToUse() + // then add to LOCAL_CPPFLAGS + std::vector<std::string> libraries; + cmSystemTools::ExpandListArgument(pi->second, libraries); + std::string staticLibs; + std::string sharedLibs; + std::string ldlibs; + for (std::vector<std::string>::iterator i = libraries.begin(); + i != libraries.end(); ++i) { + cmGeneratorTarget* gt = + target->GetLocalGenerator()->FindGeneratorTargetToUse(*i); + if (gt) { + + if (gt->GetType() == cmState::SHARED_LIBRARY || + gt->GetType() == cmState::MODULE_LIBRARY) { + sharedLibs += " " + *i; + } else { + staticLibs += " " + *i; + } + } else { + // evaluate any generator expressions with the current + // build type of the makefile + cmGeneratorExpression ge; + CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(*i); + std::string evaluated = + cge->Evaluate(target->GetLocalGenerator(), config); + bool relpath = false; + if (type == cmExportBuildAndroidMKGenerator::INSTALL) { + relpath = i->substr(0, 3) == "../"; + } + // check for full path or if it already has a -l, or + // in the case of an install check for relative paths + // if it is full or a link library then use string directly + if (cmSystemTools::FileIsFullPath(evaluated) || + evaluated.substr(0, 2) == "-l" || relpath) { + ldlibs += " " + evaluated; + // if it is not a path and does not have a -l then add -l + } else if (!evaluated.empty()) { + ldlibs += " -l" + evaluated; + } + } + } + if (!sharedLibs.empty()) { + os << "LOCAL_SHARED_LIBRARIES :=" << sharedLibs << "\n"; + } + if (!staticLibs.empty()) { + os << "LOCAL_STATIC_LIBRARIES :=" << staticLibs << "\n"; + } + if (!ldlibs.empty()) { + os << "LOCAL_EXPORT_LDLIBS :=" << ldlibs << "\n"; + } + } else if (pi->first == "INTERFACE_INCLUDE_DIRECTORIES") { + std::string includes = pi->second; + std::vector<std::string> includeList; + cmSystemTools::ExpandListArgument(includes, includeList); + os << "LOCAL_EXPORT_C_INCLUDES := "; + std::string end; + for (std::vector<std::string>::iterator i = includeList.begin(); + i != includeList.end(); ++i) { + os << end << *i; + end = "\\\n"; + } + os << "\n"; + } else { + os << "# " << pi->first << " " << (pi->second) << "\n"; + } + } + } + switch (target->GetType()) { + case cmState::SHARED_LIBRARY: + case cmState::MODULE_LIBRARY: + os << "include $(PREBUILT_SHARED_LIBRARY)\n"; + break; + case cmState::STATIC_LIBRARY: + os << "include $(PREBUILT_STATIC_LIBRARY)\n"; + break; + case cmState::EXECUTABLE: + case cmState::UTILITY: + case cmState::OBJECT_LIBRARY: + case cmState::GLOBAL_TARGET: + case cmState::INTERFACE_LIBRARY: + case cmState::UNKNOWN_LIBRARY: + break; + } + os << "\n"; +} diff --git a/Source/cmExportBuildAndroidMKGenerator.h b/Source/cmExportBuildAndroidMKGenerator.h new file mode 100644 index 0000000..e26aba0 --- /dev/null +++ b/Source/cmExportBuildAndroidMKGenerator.h @@ -0,0 +1,68 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmExportBuildAndroidMKGenerator_h +#define cmExportBuildAndroidMKGenerator_h + +#include "cmExportBuildFileGenerator.h" +#include "cmListFileCache.h" + +class cmExportSet; + +/** \class cmExportBuildAndroidMKGenerator + * \brief Generate a file exporting targets from a build tree. + * + * cmExportBuildAndroidMKGenerator generates a file exporting targets from + * a build tree. This exports the targets to the Android ndk build tool + * makefile format for prebuilt libraries. + * + * This is used to implement the EXPORT() command. + */ +class cmExportBuildAndroidMKGenerator : public cmExportBuildFileGenerator +{ +public: + cmExportBuildAndroidMKGenerator(); + // this is so cmExportInstallAndroidMKGenerator can share this + // function as they are almost the same + enum GenerateType + { + BUILD, + INSTALL + }; + static void GenerateInterfaceProperties(cmGeneratorTarget const* target, + std::ostream& os, + const ImportPropertyMap& properties, + GenerateType type, + std::string const& config); + +protected: + // Implement virtual methods from the superclass. + virtual void GeneratePolicyHeaderCode(std::ostream&) {} + virtual void GeneratePolicyFooterCode(std::ostream&) {} + virtual void GenerateImportHeaderCode(std::ostream& os, + const std::string& config = ""); + virtual void GenerateImportFooterCode(std::ostream& os); + virtual void GenerateImportTargetCode(std::ostream& os, + const cmGeneratorTarget* target); + virtual void GenerateExpectedTargetsCode(std::ostream& os, + const std::string& expectedTargets); + virtual void GenerateImportPropertyCode(std::ostream& os, + const std::string& config, + cmGeneratorTarget const* target, + ImportPropertyMap const& properties); + virtual void GenerateMissingTargetsCheckCode( + std::ostream& os, const std::vector<std::string>& missingTargets); + virtual void GenerateInterfaceProperties( + cmGeneratorTarget const* target, std::ostream& os, + const ImportPropertyMap& properties); +}; + +#endif diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index fc62492..134a63f 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -18,6 +18,7 @@ #include <cmsys/Encoding.hxx> #include <cmsys/RegularExpression.hxx> +#include "cmExportBuildAndroidMKGenerator.h" #include "cmExportBuildFileGenerator.h" #if defined(__HAIKU__) @@ -34,6 +35,7 @@ cmExportCommand::cmExportCommand() , Namespace(&Helper, "NAMESPACE", &ArgumentGroup) , Filename(&Helper, "FILE", &ArgumentGroup) , ExportOld(&Helper, "EXPORT_LINK_INTERFACE_LIBRARIES", &ArgumentGroup) + , AndroidMKFile(&Helper, "ANDROID_MK") { this->ExportSet = CM_NULLPTR; } @@ -66,13 +68,18 @@ bool cmExportCommand::InitialPass(std::vector<std::string> const& args, } std::string fname; - if (!this->Filename.WasFound()) { + bool android = false; + if (this->AndroidMKFile.WasFound()) { + fname = this->AndroidMKFile.GetString(); + android = true; + } + if (!this->Filename.WasFound() && fname.empty()) { if (args[0] != "EXPORT") { this->SetError("FILE <filename> option missing."); return false; } fname = this->ExportSetName.GetString() + ".cmake"; - } else { + } else if (fname.empty()) { // Make sure the file has a .cmake extension. if (cmSystemTools::GetFilenameLastExtension(this->Filename.GetCString()) != ".cmake") { @@ -176,7 +183,12 @@ bool cmExportCommand::InitialPass(std::vector<std::string> const& args, } // Setup export file generation. - cmExportBuildFileGenerator* ebfg = new cmExportBuildFileGenerator; + cmExportBuildFileGenerator* ebfg = CM_NULLPTR; + if (android) { + ebfg = new cmExportBuildAndroidMKGenerator; + } else { + ebfg = new cmExportBuildFileGenerator; + } ebfg->SetExportFile(fname.c_str()); ebfg->SetNamespace(this->Namespace.GetCString()); ebfg->SetAppendMode(this->Append.IsEnabled()); diff --git a/Source/cmExportCommand.h b/Source/cmExportCommand.h index 0a149af..481d2c5 100644 --- a/Source/cmExportCommand.h +++ b/Source/cmExportCommand.h @@ -54,6 +54,7 @@ private: cmCAString Namespace; cmCAString Filename; cmCAEnabler ExportOld; + cmCAString AndroidMKFile; cmExportSet* ExportSet; diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 23c77d9..c4c7d7d 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -96,24 +96,8 @@ bool cmExportFileGenerator::GenerateImportFile() } std::ostream& os = *foutPtr; - // Protect that file against use with older CMake versions. - /* clang-format off */ - os << "# Generated by CMake\n\n"; - os << "if(\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" LESS 2.5)\n" - << " message(FATAL_ERROR \"CMake >= 2.6.0 required\")\n" - << "endif()\n"; - /* clang-format on */ - - // Isolate the file policy level. - // We use 2.6 here instead of the current version because newer - // versions of CMake should be able to export files imported by 2.6 - // until the import format changes. - /* clang-format off */ - os << "cmake_policy(PUSH)\n" - << "cmake_policy(VERSION 2.6)\n"; - /* clang-format on */ - // Start with the import file header. + this->GeneratePolicyHeaderCode(os); this->GenerateImportHeaderCode(os); // Create all the imported targets. @@ -121,7 +105,7 @@ bool cmExportFileGenerator::GenerateImportFile() // End with the import file footer. this->GenerateImportFooterCode(os); - os << "cmake_policy(POP)\n"; + this->GeneratePolicyFooterCode(os); return result; } @@ -832,6 +816,31 @@ void cmExportFileGenerator::SetImportLinkProperty( properties[prop] = link_entries; } +void cmExportFileGenerator::GeneratePolicyHeaderCode(std::ostream& os) +{ + // Protect that file against use with older CMake versions. + /* clang-format off */ + os << "# Generated by CMake\n\n"; + os << "if(\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" LESS 2.5)\n" + << " message(FATAL_ERROR \"CMake >= 2.6.0 required\")\n" + << "endif()\n"; + /* clang-format on */ + + // Isolate the file policy level. + // We use 2.6 here instead of the current version because newer + // versions of CMake should be able to export files imported by 2.6 + // until the import format changes. + /* clang-format off */ + os << "cmake_policy(PUSH)\n" + << "cmake_policy(VERSION 2.6)\n"; + /* clang-format on */ +} + +void cmExportFileGenerator::GeneratePolicyFooterCode(std::ostream& os) +{ + os << "cmake_policy(POP)\n"; +} + void cmExportFileGenerator::GenerateImportHeaderCode(std::ostream& os, const std::string& config) { diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h index 354994a..d106ab7 100644 --- a/Source/cmExportFileGenerator.h +++ b/Source/cmExportFileGenerator.h @@ -78,25 +78,28 @@ protected: std::vector<std::string>& missingTargets); // Methods to implement export file code generation. - void GenerateImportHeaderCode(std::ostream& os, - const std::string& config = ""); - void GenerateImportFooterCode(std::ostream& os); + virtual void GeneratePolicyHeaderCode(std::ostream& os); + virtual void GeneratePolicyFooterCode(std::ostream& os); + virtual void GenerateImportHeaderCode(std::ostream& os, + const std::string& config = ""); + virtual void GenerateImportFooterCode(std::ostream& os); void GenerateImportVersionCode(std::ostream& os); - void GenerateImportTargetCode(std::ostream& os, - cmGeneratorTarget const* target); - void GenerateImportPropertyCode(std::ostream& os, const std::string& config, - cmGeneratorTarget const* target, - ImportPropertyMap const& properties); - void GenerateImportedFileChecksCode( + virtual void GenerateImportTargetCode(std::ostream& os, + cmGeneratorTarget const* target); + virtual void GenerateImportPropertyCode(std::ostream& os, + const std::string& config, + cmGeneratorTarget const* target, + ImportPropertyMap const& properties); + virtual void GenerateImportedFileChecksCode( std::ostream& os, cmGeneratorTarget* target, ImportPropertyMap const& properties, const std::set<std::string>& importedLocations); - void GenerateImportedFileCheckLoop(std::ostream& os); - void GenerateMissingTargetsCheckCode( + virtual void GenerateImportedFileCheckLoop(std::ostream& os); + virtual void GenerateMissingTargetsCheckCode( std::ostream& os, const std::vector<std::string>& missingTargets); - void GenerateExpectedTargetsCode(std::ostream& os, - const std::string& expectedTargets); + virtual void GenerateExpectedTargetsCode(std::ostream& os, + const std::string& expectedTargets); // Collect properties with detailed information about targets beyond // their location on disk. @@ -140,9 +143,9 @@ protected: ImportPropertyMap& properties); void PopulateCompatibleInterfaceProperties(cmGeneratorTarget* target, ImportPropertyMap& properties); - void GenerateInterfaceProperties(cmGeneratorTarget const* target, - std::ostream& os, - const ImportPropertyMap& properties); + virtual void GenerateInterfaceProperties( + cmGeneratorTarget const* target, std::ostream& os, + const ImportPropertyMap& properties); void PopulateIncludeDirectoriesInterface( cmTargetExport* target, cmGeneratorExpression::PreprocessContext preprocessRule, @@ -169,8 +172,8 @@ protected: std::vector<std::string>& missingTargets, FreeTargetsReplace replace = NoReplaceFreeTargets); - void GenerateRequiredCMakeVersion(std::ostream& os, - const char* versionString); + virtual void GenerateRequiredCMakeVersion(std::ostream& os, + const char* versionString); // The namespace in which the exports are placed in the generated file. std::string Namespace; diff --git a/Source/cmExportInstallAndroidMKGenerator.cxx b/Source/cmExportInstallAndroidMKGenerator.cxx new file mode 100644 index 0000000..8f815b7 --- /dev/null +++ b/Source/cmExportInstallAndroidMKGenerator.cxx @@ -0,0 +1,146 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmExportInstallAndroidMKGenerator.h" + +#include "cmAlgorithms.h" +#include "cmExportBuildAndroidMKGenerator.h" +#include "cmExportSet.h" +#include "cmExportSetMap.h" +#include "cmGeneratedFileStream.h" +#include "cmGeneratorTarget.h" +#include "cmGlobalGenerator.h" +#include "cmInstallExportGenerator.h" +#include "cmInstallTargetGenerator.h" +#include "cmLocalGenerator.h" +#include "cmTargetExport.h" + +cmExportInstallAndroidMKGenerator::cmExportInstallAndroidMKGenerator( + cmInstallExportGenerator* iegen) + : cmExportInstallFileGenerator(iegen) +{ +} + +void cmExportInstallAndroidMKGenerator::GenerateImportHeaderCode( + std::ostream& os, const std::string&) +{ + std::string installDir = this->IEGen->GetDestination(); + os << "LOCAL_PATH := $(call my-dir)\n"; + size_t numDotDot = cmSystemTools::CountChar(installDir.c_str(), '/'); + numDotDot += (installDir.size() > 0) ? 1 : 0; + std::string path; + for (size_t n = 0; n < numDotDot; n++) { + path += "/.."; + } + os << "_IMPORT_PREFIX := " + << "$(LOCAL_PATH)" << path << "\n\n"; + for (std::vector<cmTargetExport*>::const_iterator tei = + this->IEGen->GetExportSet()->GetTargetExports()->begin(); + tei != this->IEGen->GetExportSet()->GetTargetExports()->end(); ++tei) { + // Collect import properties for this target. + cmTargetExport const* te = *tei; + if (te->Target->GetType() == cmState::INTERFACE_LIBRARY) { + continue; + } + std::string dest; + if (te->LibraryGenerator) { + dest = te->LibraryGenerator->GetDestination(""); + } + if (te->ArchiveGenerator) { + dest = te->ArchiveGenerator->GetDestination(""); + } + te->Target->Target->SetProperty("__dest", dest.c_str()); + } +} + +void cmExportInstallAndroidMKGenerator::GenerateImportFooterCode(std::ostream&) +{ +} + +void cmExportInstallAndroidMKGenerator::GenerateImportTargetCode( + std::ostream& os, const cmGeneratorTarget* target) +{ + std::string targetName = this->Namespace; + targetName += target->GetExportName(); + os << "include $(CLEAR_VARS)\n"; + os << "LOCAL_MODULE := "; + os << targetName << "\n"; + os << "LOCAL_SRC_FILES := $(_IMPORT_PREFIX)/"; + os << target->Target->GetProperty("__dest") << "/"; + std::string config = ""; + if (this->Configurations.size()) { + config = this->Configurations[0]; + } + os << target->GetFullName(config) << "\n"; +} + +void cmExportInstallAndroidMKGenerator::GenerateExpectedTargetsCode( + std::ostream&, const std::string&) +{ +} + +void cmExportInstallAndroidMKGenerator::GenerateImportPropertyCode( + std::ostream&, const std::string&, cmGeneratorTarget const*, + ImportPropertyMap const&) +{ +} + +void cmExportInstallAndroidMKGenerator::GenerateMissingTargetsCheckCode( + std::ostream&, const std::vector<std::string>&) +{ +} + +void cmExportInstallAndroidMKGenerator::GenerateInterfaceProperties( + cmGeneratorTarget const* target, std::ostream& os, + const ImportPropertyMap& properties) +{ + std::string config = ""; + if (this->Configurations.size()) { + config = this->Configurations[0]; + } + cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties( + target, os, properties, cmExportBuildAndroidMKGenerator::INSTALL, config); +} + +void cmExportInstallAndroidMKGenerator::LoadConfigFiles(std::ostream&) +{ +} + +void cmExportInstallAndroidMKGenerator::GenerateImportPrefix(std::ostream&) +{ +} + +void cmExportInstallAndroidMKGenerator::GenerateRequiredCMakeVersion( + std::ostream&, const char*) +{ +} + +void cmExportInstallAndroidMKGenerator::CleanupTemporaryVariables( + std::ostream&) +{ +} + +void cmExportInstallAndroidMKGenerator::GenerateImportedFileCheckLoop( + std::ostream&) +{ +} + +void cmExportInstallAndroidMKGenerator::GenerateImportedFileChecksCode( + std::ostream&, cmGeneratorTarget*, ImportPropertyMap const&, + const std::set<std::string>&) +{ +} + +bool cmExportInstallAndroidMKGenerator::GenerateImportFileConfig( + const std::string&, std::vector<std::string>&) +{ + return true; +} diff --git a/Source/cmExportInstallAndroidMKGenerator.h b/Source/cmExportInstallAndroidMKGenerator.h new file mode 100644 index 0000000..4b9f51c --- /dev/null +++ b/Source/cmExportInstallAndroidMKGenerator.h @@ -0,0 +1,72 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmExportInstallAndroidMKGenerator_h +#define cmExportInstallAndroidMKGenerator_h + +#include "cmExportInstallFileGenerator.h" + +class cmInstallExportGenerator; +class cmInstallTargetGenerator; + +/** \class cmExportInstallAndroidMKGenerator + * \brief Generate a file exporting targets from an install tree. + * + * cmExportInstallAndroidMKGenerator generates files exporting targets from + * install an installation tree. The files are placed in a temporary + * location for installation by cmInstallExportGenerator. The file format + * is for the ndk build system and is a makefile fragment specifing prebuilt + * libraries to the ndk build system. + * + * This is used to implement the INSTALL(EXPORT_ANDROID_MK) command. + */ +class cmExportInstallAndroidMKGenerator : public cmExportInstallFileGenerator +{ +public: + /** Construct with the export installer that will install the + files. */ + cmExportInstallAndroidMKGenerator(cmInstallExportGenerator* iegen); + +protected: + // Implement virtual methods from the superclass. + virtual void GeneratePolicyHeaderCode(std::ostream&) {} + virtual void GeneratePolicyFooterCode(std::ostream&) {} + virtual void GenerateImportHeaderCode(std::ostream& os, + const std::string& config = ""); + virtual void GenerateImportFooterCode(std::ostream& os); + virtual void GenerateImportTargetCode(std::ostream& os, + const cmGeneratorTarget* target); + virtual void GenerateExpectedTargetsCode(std::ostream& os, + const std::string& expectedTargets); + virtual void GenerateImportPropertyCode(std::ostream& os, + const std::string& config, + cmGeneratorTarget const* target, + ImportPropertyMap const& properties); + virtual void GenerateMissingTargetsCheckCode( + std::ostream& os, const std::vector<std::string>& missingTargets); + virtual void GenerateInterfaceProperties( + cmGeneratorTarget const* target, std::ostream& os, + const ImportPropertyMap& properties); + virtual void GenerateImportPrefix(std::ostream& os); + virtual void LoadConfigFiles(std::ostream&); + virtual void GenerateRequiredCMakeVersion(std::ostream& os, + const char* versionString); + virtual void CleanupTemporaryVariables(std::ostream&); + virtual void GenerateImportedFileCheckLoop(std::ostream& os); + virtual void GenerateImportedFileChecksCode( + std::ostream& os, cmGeneratorTarget* target, + ImportPropertyMap const& properties, + const std::set<std::string>& importedLocations); + virtual bool GenerateImportFileConfig(const std::string& config, + std::vector<std::string>&); +}; + +#endif diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index ceba69a..f47038f 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -75,55 +75,8 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) this->GenerateExpectedTargetsCode(os, expectedTargets); } - // Set an _IMPORT_PREFIX variable for import location properties - // to reference if they are relative to the install prefix. - std::string installPrefix = - this->IEGen->GetLocalGenerator()->GetMakefile()->GetSafeDefinition( - "CMAKE_INSTALL_PREFIX"); - std::string const& expDest = this->IEGen->GetDestination(); - if (cmSystemTools::FileIsFullPath(expDest)) { - // The export file is being installed to an absolute path so the - // package is not relocatable. Use the configured install prefix. - /* clang-format off */ - os << - "# The installation prefix configured by this project.\n" - "set(_IMPORT_PREFIX \"" << installPrefix << "\")\n" - "\n"; - /* clang-format on */ - } else { - // Add code to compute the installation prefix relative to the - // import file location. - std::string absDest = installPrefix + "/" + expDest; - std::string absDestS = absDest + "/"; - os << "# Compute the installation prefix relative to this file.\n" - << "get_filename_component(_IMPORT_PREFIX" - << " \"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n"; - if (cmHasLiteralPrefix(absDestS.c_str(), "/lib/") || - cmHasLiteralPrefix(absDestS.c_str(), "/lib64/") || - cmHasLiteralPrefix(absDestS.c_str(), "/usr/lib/") || - cmHasLiteralPrefix(absDestS.c_str(), "/usr/lib64/")) { - // Handle "/usr move" symlinks created by some Linux distros. - /* clang-format off */ - os << - "# Use original install prefix when loaded through a\n" - "# cross-prefix symbolic link such as /lib -> /usr/lib.\n" - "get_filename_component(_realCurr \"${_IMPORT_PREFIX}\" REALPATH)\n" - "get_filename_component(_realOrig \"" << absDest << "\" REALPATH)\n" - "if(_realCurr STREQUAL _realOrig)\n" - " set(_IMPORT_PREFIX \"" << absDest << "\")\n" - "endif()\n" - "unset(_realOrig)\n" - "unset(_realCurr)\n"; - /* clang-format on */ - } - std::string dest = expDest; - while (!dest.empty()) { - os << "get_filename_component(_IMPORT_PREFIX \"${_IMPORT_PREFIX}\" " - "PATH)\n"; - dest = cmSystemTools::GetFilenamePath(dest); - } - os << "\n"; - } + // Compute the relative import prefix for the file + this->GenerateImportPrefix(os); std::vector<std::string> missingTargets; @@ -201,24 +154,9 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) this->GenerateRequiredCMakeVersion(os, "2.8.12"); } - // Now load per-configuration properties for them. - /* clang-format off */ - os << "# Load information for each installed configuration.\n" - << "get_filename_component(_DIR \"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n" - << "file(GLOB CONFIG_FILES \"${_DIR}/" - << this->GetConfigImportFileGlob() << "\")\n" - << "foreach(f ${CONFIG_FILES})\n" - << " include(${f})\n" - << "endforeach()\n" - << "\n"; - /* clang-format on */ + this->LoadConfigFiles(os); - // Cleanup the import prefix variable. - /* clang-format off */ - os << "# Cleanup temporary variables.\n" - << "set(_IMPORT_PREFIX)\n" - << "\n"; - /* clang-format on */ + this->CleanupTemporaryVariables(os); this->GenerateImportedFileCheckLoop(os); bool result = true; @@ -239,6 +177,86 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) return result; } +void cmExportInstallFileGenerator::GenerateImportPrefix(std::ostream& os) +{ + // Set an _IMPORT_PREFIX variable for import location properties + // to reference if they are relative to the install prefix. + std::string installPrefix = + this->IEGen->GetLocalGenerator()->GetMakefile()->GetSafeDefinition( + "CMAKE_INSTALL_PREFIX"); + std::string const& expDest = this->IEGen->GetDestination(); + if (cmSystemTools::FileIsFullPath(expDest)) { + // The export file is being installed to an absolute path so the + // package is not relocatable. Use the configured install prefix. + /* clang-format off */ + os << + "# The installation prefix configured by this project.\n" + "set(_IMPORT_PREFIX \"" << installPrefix << "\")\n" + "\n"; + /* clang-format on */ + } else { + // Add code to compute the installation prefix relative to the + // import file location. + std::string absDest = installPrefix + "/" + expDest; + std::string absDestS = absDest + "/"; + os << "# Compute the installation prefix relative to this file.\n" + << "get_filename_component(_IMPORT_PREFIX" + << " \"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n"; + if (cmHasLiteralPrefix(absDestS.c_str(), "/lib/") || + cmHasLiteralPrefix(absDestS.c_str(), "/lib64/") || + cmHasLiteralPrefix(absDestS.c_str(), "/usr/lib/") || + cmHasLiteralPrefix(absDestS.c_str(), "/usr/lib64/")) { + // Handle "/usr move" symlinks created by some Linux distros. + /* clang-format off */ + os << + "# Use original install prefix when loaded through a\n" + "# cross-prefix symbolic link such as /lib -> /usr/lib.\n" + "get_filename_component(_realCurr \"${_IMPORT_PREFIX}\" REALPATH)\n" + "get_filename_component(_realOrig \"" << absDest << "\" REALPATH)\n" + "if(_realCurr STREQUAL _realOrig)\n" + " set(_IMPORT_PREFIX \"" << absDest << "\")\n" + "endif()\n" + "unset(_realOrig)\n" + "unset(_realCurr)\n"; + /* clang-format on */ + } + std::string dest = expDest; + while (!dest.empty()) { + os << "get_filename_component(_IMPORT_PREFIX \"${_IMPORT_PREFIX}\" " + "PATH)\n"; + dest = cmSystemTools::GetFilenamePath(dest); + } + os << "if(_IMPORT_PREFIX STREQUAL \"/\")\n" + << " set(_IMPORT_PREFIX \"\")\n" + << "endif()\n" + << "\n"; + } +} + +void cmExportInstallFileGenerator::CleanupTemporaryVariables(std::ostream& os) +{ + /* clang-format off */ + os << "# Cleanup temporary variables.\n" + << "set(_IMPORT_PREFIX)\n" + << "\n"; + /* clang-format on */ +} + +void cmExportInstallFileGenerator::LoadConfigFiles(std::ostream& os) +{ + // Now load per-configuration properties for them. + /* clang-format off */ + os << "# Load information for each installed configuration.\n" + << "get_filename_component(_DIR \"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n" + << "file(GLOB CONFIG_FILES \"${_DIR}/" + << this->GetConfigImportFileGlob() << "\")\n" + << "foreach(f ${CONFIG_FILES})\n" + << " include(${f})\n" + << "endforeach()\n" + << "\n"; + /* clang-format on */ +} + void cmExportInstallFileGenerator::ReplaceInstallPrefix(std::string& input) { std::string::size_type pos = 0; diff --git a/Source/cmExportInstallFileGenerator.h b/Source/cmExportInstallFileGenerator.h index c693dc1..63f2d40 100644 --- a/Source/cmExportInstallFileGenerator.h +++ b/Source/cmExportInstallFileGenerator.h @@ -80,9 +80,17 @@ protected: std::vector<std::string> FindNamespaces(cmGlobalGenerator* gg, const std::string& name); + /** Generate the relative import prefix. */ + virtual void GenerateImportPrefix(std::ostream&); + + /** Generate the relative import prefix. */ + virtual void LoadConfigFiles(std::ostream&); + + virtual void CleanupTemporaryVariables(std::ostream&); + /** Generate a per-configuration file for the targets. */ - bool GenerateImportFileConfig(const std::string& config, - std::vector<std::string>& missingTargets); + virtual bool GenerateImportFileConfig( + const std::string& config, std::vector<std::string>& missingTargets); /** Fill in properties indicating installed file locations. */ void SetImportLocationProperty(const std::string& config, diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx index a0aefb8..6c31481 100644 --- a/Source/cmExportTryCompileFileGenerator.cxx +++ b/Source/cmExportTryCompileFileGenerator.cxx @@ -77,9 +77,8 @@ std::string cmExportTryCompileFileGenerator::FindTargets( CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(prop); - cmTarget dummyHead; - dummyHead.SetType(cmState::EXECUTABLE, "try_compile_dummy_exe"); - dummyHead.SetMakefile(tgt->Target->GetMakefile()); + cmTarget dummyHead("try_compile_dummy_exe", cmState::EXECUTABLE, + cmTarget::VisibilityNormal, tgt->Target->GetMakefile()); cmGeneratorTarget gDummyHead(&dummyHead, tgt->GetLocalGenerator()); diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 835b118..2c226cd 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -2481,6 +2481,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) std::string hashMatchMSG; CM_AUTO_PTR<cmCryptoHash> hash; bool showProgress = false; + std::string userpwd; while (i != args.end()) { if (*i == "TIMEOUT") { @@ -2564,6 +2565,18 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) return false; } hashMatchMSG = algo + " hash"; + } else if (*i == "USERPWD") { + ++i; + if (i == args.end()) { + this->SetError("DOWNLOAD missing string for USERPWD."); + return false; + } + userpwd = *i; + } else { + // Do not return error for compatibility reason. + std::string err = "Unexpected argument: "; + err += *i; + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, err.c_str()); } ++i; } @@ -2698,6 +2711,11 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) check_curl_result(res, "DOWNLOAD cannot set progress data: "); } + if (!userpwd.empty()) { + res = ::curl_easy_setopt(curl, CURLOPT_USERPWD, userpwd.c_str()); + check_curl_result(res, "DOWNLOAD cannot set user password: "); + } + res = ::curl_easy_perform(curl); /* always cleanup */ @@ -2778,6 +2796,7 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args) std::string logVar; std::string statusVar; bool showProgress = false; + std::string userpwd; while (i != args.end()) { if (*i == "TIMEOUT") { @@ -2812,6 +2831,18 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args) statusVar = *i; } else if (*i == "SHOW_PROGRESS") { showProgress = true; + } else if (*i == "USERPWD") { + ++i; + if (i == args.end()) { + this->SetError("UPLOAD missing string for USERPWD."); + return false; + } + userpwd = *i; + } else { + // Do not return error for compatibility reason. + std::string err = "Unexpected argument: "; + err += *i; + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, err.c_str()); } ++i; @@ -2920,6 +2951,11 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args) ::curl_easy_setopt(curl, CURLOPT_INFILESIZE, static_cast<long>(file_size)); check_curl_result(res, "UPLOAD cannot set input file size: "); + if (!userpwd.empty()) { + res = ::curl_easy_setopt(curl, CURLOPT_USERPWD, userpwd.c_str()); + check_curl_result(res, "UPLOAD cannot set user password: "); + } + res = ::curl_easy_perform(curl); /* always cleanup */ diff --git a/Source/cmFortranLexer.cxx b/Source/cmFortranLexer.cxx index 7cde4cb..7bcd993 100644 --- a/Source/cmFortranLexer.cxx +++ b/Source/cmFortranLexer.cxx @@ -1,14 +1,3 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2000-2015 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ #line 2 "cmFortranLexer.cxx" #line 4 "cmFortranLexer.cxx" @@ -19,8 +8,8 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 39 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 1 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -99,25 +88,13 @@ typedef unsigned int flex_uint32_t; #endif /* ! FLEXINT_H */ -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST - -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST +/* TODO: this is always defined, so inline it */ #define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) #else -#define yyconst +#define yynoreturn #endif /* Returned upon end-of-file. */ @@ -204,83 +181,83 @@ typedef size_t yy_size_t; /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ - *yy_cp = yyg->yy_hold_char; \ - YY_RESTORE_YY_MORE_OFFSET \ - yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) + *yy_cp = yyg->yy_hold_char; \ + YY_RESTORE_YY_MORE_OFFSET \ + yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - yy_size_t yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + int yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; - int yy_buffer_status; + int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via cmFortran_yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via cmFortran_yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ #define YY_BUFFER_EOF_PENDING 2 - }; + }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* We provide macros for accessing buffer states in case in the @@ -314,7 +291,7 @@ static void cmFortran_yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yys YY_BUFFER_STATE cmFortran_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); YY_BUFFER_STATE cmFortran_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); -YY_BUFFER_STATE cmFortran_yy_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner ); +YY_BUFFER_STATE cmFortran_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); void *cmFortran_yyalloc (yy_size_t ,yyscan_t yyscanner ); void *cmFortran_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); @@ -323,30 +300,30 @@ void cmFortran_yyfree (void * ,yyscan_t yyscanner ); #define yy_new_buffer cmFortran_yy_create_buffer #define yy_set_interactive(is_interactive) \ - { \ - if ( ! YY_CURRENT_BUFFER ){ \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ cmFortran_yyensure_buffer_stack (yyscanner); \ - YY_CURRENT_BUFFER_LVALUE = \ + YY_CURRENT_BUFFER_LVALUE = \ cmFortran_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ - } + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } #define yy_set_bol(at_bol) \ - { \ - if ( ! YY_CURRENT_BUFFER ){\ + { \ + if ( ! YY_CURRENT_BUFFER ){\ cmFortran_yyensure_buffer_stack (yyscanner); \ - YY_CURRENT_BUFFER_LVALUE = \ + YY_CURRENT_BUFFER_LVALUE = \ cmFortran_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ - } + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ -#define cmFortran_yywrap(yyscanner) 1 +#define cmFortran_yywrap(yyscanner) (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; @@ -358,51 +335,54 @@ typedef int yy_state_type; static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); static int yy_get_next_buffer (yyscan_t yyscanner ); -static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); +static void yynoreturn yy_fatal_error (yyconst char* msg ,yyscan_t yyscanner ); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ - yyg->yytext_ptr = yy_bp; \ - yyleng = (size_t) (yy_cp - yy_bp); \ - yyg->yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ - yyg->yy_c_buf_p = yy_cp; - -#define YY_NUM_RULES 45 -#define YY_END_OF_BUFFER 46 + yyg->yytext_ptr = yy_bp; \ + yyleng = (int) (yy_cp - yy_bp); \ + yyg->yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yyg->yy_c_buf_p = yy_cp; + +#define YY_NUM_RULES 50 +#define YY_END_OF_BUFFER 51 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info - { - flex_int32_t yy_verify; - flex_int32_t yy_nxt; - }; -static yyconst flex_int16_t yy_accept[173] = + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[199] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 46, 40, 42, 41, 44, 1, 40, 33, 2, 35, - 40, 41, 38, 40, 39, 40, 39, 42, 40, 41, - 40, 39, 9, 8, 9, 4, 3, 40, 0, 10, - 0, 0, 0, 0, 0, 33, 33, 34, 36, 38, - 40, 39, 0, 43, 39, 0, 0, 0, 12, 0, - 0, 0, 0, 0, 0, 40, 0, 11, 39, 0, - 0, 5, 0, 0, 0, 29, 0, 0, 33, 33, - 33, 33, 0, 0, 12, 12, 0, 0, 0, 23, - 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, + 51, 45, 47, 46, 49, 1, 45, 33, 2, 35, + 45, 46, 38, 45, 44, 44, 44, 44, 44, 45, + 44, 47, 45, 46, 45, 44, 9, 8, 9, 4, + 3, 45, 0, 10, 0, 0, 0, 0, 0, 33, + 33, 34, 36, 38, 45, 44, 44, 44, 44, 44, + 0, 48, 44, 0, 0, 0, 12, 0, 0, 0, + 0, 0, 0, 45, 0, 11, 44, 0, 0, 5, + 0, 0, 0, 29, 0, 0, 33, 33, 33, 33, + 0, 0, 39, 44, 44, 44, 43, 12, 12, 0, + + 0, 0, 23, 0, 0, 0, 0, 0, 0, 6, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 44, + 44, 44, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 30, 31, 0, 0, 0, 0, + 0, 0, 44, 44, 44, 0, 24, 25, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 32, 27, 0, + 0, 20, 0, 44, 44, 42, 0, 26, 21, 0, + 0, 0, 19, 0, 0, 18, 28, 0, 0, 40, + 44, 17, 22, 0, 7, 37, 7, 15, 0, 44, + 14, 16, 41, 0, 0, 0, 13, 0 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 30, 31, - 0, 0, 0, 0, 0, 0, 0, 24, 25, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 32, 27, - 0, 0, 20, 0, 0, 26, 21, 0, 0, 0, - 19, 0, 0, 18, 28, 0, 0, 17, 22, 0, - 7, 37, 7, 15, 0, 14, 16, 0, 0, 0, - 13, 0 } ; -static yyconst flex_int32_t yy_ec[256] = +static yyconst YY_CHAR yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, @@ -410,14 +390,14 @@ static yyconst flex_int32_t yy_ec[256] = 1, 5, 6, 7, 8, 9, 1, 10, 11, 1, 1, 12, 1, 13, 1, 1, 1, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 16, 17, - 18, 19, 20, 1, 21, 21, 22, 23, 24, 25, - 21, 21, 26, 21, 21, 27, 21, 28, 21, 21, - 21, 21, 29, 21, 30, 21, 21, 21, 21, 21, - 1, 31, 1, 1, 32, 1, 21, 21, 33, 34, - - 35, 36, 21, 21, 37, 21, 21, 38, 21, 39, - 21, 21, 21, 21, 40, 21, 41, 21, 21, 21, - 21, 21, 1, 1, 1, 1, 1, 1, 1, 1, + 18, 19, 20, 1, 21, 22, 23, 24, 25, 26, + 22, 22, 27, 22, 22, 28, 29, 30, 31, 22, + 22, 32, 33, 34, 35, 22, 22, 22, 22, 22, + 1, 36, 1, 1, 37, 1, 21, 22, 38, 39, + + 40, 41, 22, 22, 42, 22, 22, 43, 29, 44, + 31, 22, 22, 32, 45, 34, 46, 22, 22, 22, + 22, 22, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -434,195 +414,211 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[42] = +static yyconst YY_CHAR yy_meta[47] = { 0, 1, 2, 2, 3, 4, 3, 3, 1, 1, 3, 3, 1, 3, 5, 1, 3, 1, 3, 6, 1, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 1, 5, 7, 7, 7, 7, 7, 7, 7, 7, - 7 + 7, 7, 7, 7, 7, 1, 5, 7, 7, 7, + 7, 7, 7, 7, 7, 7 } ; -static yyconst flex_int16_t yy_base[182] = +static yyconst flex_uint16_t yy_base[208] = { 0, - 0, 40, 0, 41, 220, 48, 44, 54, 56, 65, - 220, 0, 535, 535, 216, 535, 81, 74, 535, 535, - 186, 535, 153, 145, 0, 85, 122, 87, 154, 155, - 195, 227, 535, 147, 91, 535, 535, 0, 147, 535, - 267, 34, 70, 74, 34, 122, 141, 535, 0, 535, - 112, 0, 98, 535, 0, 156, 307, 0, 143, 43, - 155, 151, 48, 101, 130, 348, 130, 535, 0, 121, - 197, 165, 172, 244, 182, 183, 191, 248, 273, 293, - 308, 314, 321, 246, 275, 216, 269, 299, 304, 327, - 307, 304, 312, 116, 107, 367, 535, 327, 334, 347, - - 347, 350, 352, 349, 354, 359, 357, 363, 366, 365, - 369, 372, 369, 373, 374, 101, 86, 372, 535, 535, - 378, 380, 386, 382, 388, 388, 389, 535, 535, 393, - 394, 396, 392, 430, 400, 56, 47, 403, 535, 535, - 409, 414, 535, 409, 416, 535, 535, 416, 419, 441, - 535, 117, 0, 535, 535, 423, 426, 535, 535, 430, - 535, 535, 535, 535, 432, 457, 535, 459, 0, 25, - 535, 535, 476, 483, 489, 492, 499, 506, 513, 520, - 527 + 0, 45, 0, 46, 392, 53, 49, 59, 61, 71, + 392, 0, 572, 572, 364, 572, 91, 77, 572, 572, + 342, 572, 317, 232, 0, 19, 42, 218, 40, 92, + 137, 96, 174, 240, 220, 257, 572, 238, 97, 572, + 572, 0, 205, 572, 302, 50, 77, 83, 59, 137, + 156, 572, 0, 572, 123, 0, 84, 130, 90, 92, + 167, 572, 0, 176, 347, 0, 190, 94, 175, 200, + 121, 92, 201, 393, 193, 572, 0, 162, 222, 175, + 171, 209, 176, 281, 184, 207, 307, 313, 328, 348, + 338, 111, 0, 205, 213, 125, 0, 354, 185, 280, + + 336, 300, 340, 309, 278, 321, 139, 130, 245, 572, + 335, 347, 351, 356, 360, 375, 375, 379, 383, 300, + 80, 381, 384, 390, 392, 393, 397, 399, 397, 402, + 403, 106, 105, 284, 572, 572, 407, 408, 411, 320, + 413, 413, 420, 419, 421, 420, 572, 572, 421, 426, + 428, 420, 467, 432, 101, 83, 438, 572, 572, 439, + 446, 572, 436, 449, 63, 0, 450, 572, 572, 450, + 453, 481, 572, 64, 0, 572, 572, 454, 460, 0, + 464, 572, 572, 463, 572, 572, 572, 572, 468, 471, + 495, 572, 0, 496, 0, 38, 572, 572, 513, 520, + + 526, 529, 536, 543, 550, 557, 564 } ; -static yyconst flex_int16_t yy_def[182] = +static yyconst flex_int16_t yy_def[208] = { 0, - 172, 1, 1, 1, 1, 1, 173, 173, 173, 173, - 172, 174, 172, 172, 175, 172, 174, 172, 172, 172, - 174, 172, 172, 174, 176, 174, 176, 172, 172, 172, - 177, 172, 172, 172, 172, 172, 172, 174, 175, 172, - 172, 172, 172, 172, 172, 172, 178, 172, 174, 172, - 174, 176, 172, 172, 27, 172, 172, 57, 174, 172, - 172, 172, 172, 172, 172, 177, 177, 172, 32, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 178, 178, - 178, 178, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 179, 180, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 181, 181, - 172, 0, 172, 172, 172, 172, 172, 172, 172, 172, - 172 + 198, 1, 1, 1, 1, 1, 199, 199, 199, 199, + 198, 200, 198, 198, 201, 198, 200, 198, 198, 198, + 200, 198, 198, 200, 202, 202, 202, 202, 202, 200, + 202, 198, 198, 198, 203, 198, 198, 198, 198, 198, + 198, 200, 201, 198, 198, 198, 198, 198, 198, 198, + 204, 198, 200, 198, 200, 202, 202, 202, 202, 202, + 198, 198, 31, 198, 198, 65, 200, 198, 198, 198, + 198, 198, 198, 203, 203, 198, 36, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 204, 204, 204, 204, + 198, 198, 202, 202, 202, 202, 202, 198, 198, 198, + + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 202, + 202, 202, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 202, 202, 202, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 202, 202, 202, 198, 198, 198, 198, + 198, 198, 198, 205, 206, 198, 198, 198, 198, 202, + 202, 198, 198, 198, 198, 198, 198, 198, 198, 202, + 198, 198, 202, 198, 207, 207, 198, 0, 198, 198, + + 198, 198, 198, 198, 198, 198, 198 } ; -static yyconst flex_int16_t yy_nxt[577] = +static yyconst flex_uint16_t yy_nxt[619] = { 0, 12, 13, 14, 13, 13, 15, 16, 12, 17, 18, 19, 12, 20, 12, 21, 22, 12, 23, 12, 24, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 26, 27, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 28, 28, 171, 28, 28, 34, 29, 29, 28, - 30, 153, 28, 35, 36, 29, 34, 73, 34, 31, - 152, 78, 37, 35, 36, 35, 87, 34, 73, 32, - 32, 37, 78, 92, 35, 46, 46, 87, 46, 47, - 32, 32, 41, 48, 92, 41, 53, 54, 56, 53, - 137, 56, 71, 72, 57, 71, 74, 75, 76, 53, - - 54, 77, 53, 42, 43, 136, 44, 74, 75, 76, - 45, 117, 77, 83, 42, 43, 83, 44, 162, 162, - 116, 45, 38, 46, 46, 95, 46, 47, 93, 38, - 38, 48, 68, 38, 94, 55, 38, 84, 38, 93, - 38, 38, 80, 46, 86, 80, 81, 86, 84, 40, - 82, 70, 38, 55, 38, 58, 59, 56, 58, 65, - 56, 38, 38, 57, 51, 38, 96, 59, 38, 96, - 38, 50, 38, 38, 97, 90, 60, 61, 91, 62, - 63, 88, 89, 64, 38, 38, 90, 60, 61, 91, - 62, 63, 88, 89, 64, 66, 98, 68, 71, 72, - - 49, 71, 66, 66, 101, 102, 66, 98, 66, 66, - 103, 66, 104, 66, 66, 101, 102, 86, 40, 172, - 86, 103, 30, 104, 172, 66, 66, 67, 67, 68, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 69, 67, 67, 67, 67, 67, 67, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 67, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, 41, 99, - 105, 41, 100, 106, 80, 46, 86, 80, 81, 86, - 99, 105, 82, 100, 106, 172, 172, 172, 85, 42, - 43, 172, 44, 107, 80, 46, 45, 80, 81, 172, - - 42, 43, 82, 44, 107, 172, 172, 45, 58, 80, - 46, 58, 80, 81, 172, 80, 46, 82, 80, 81, - 85, 172, 83, 82, 108, 83, 110, 109, 113, 60, - 61, 114, 62, 63, 115, 108, 64, 110, 109, 113, - 60, 61, 114, 62, 63, 115, 84, 64, 66, 111, - 68, 172, 118, 172, 112, 66, 66, 84, 119, 66, - 111, 66, 66, 118, 66, 112, 66, 66, 96, 119, - 120, 96, 121, 122, 123, 124, 97, 125, 66, 66, - 126, 120, 127, 121, 122, 123, 124, 128, 125, 129, - 130, 126, 131, 127, 132, 133, 134, 135, 128, 138, - - 129, 130, 139, 131, 140, 132, 133, 134, 135, 141, - 138, 142, 143, 139, 144, 140, 145, 146, 147, 148, - 141, 149, 142, 143, 151, 144, 154, 145, 146, 147, - 148, 150, 149, 155, 150, 151, 156, 154, 157, 158, - 159, 160, 150, 85, 155, 150, 164, 156, 165, 157, - 158, 159, 160, 166, 85, 167, 172, 164, 168, 165, - 168, 168, 172, 168, 166, 172, 167, 172, 172, 172, - 172, 172, 172, 169, 172, 169, 33, 33, 33, 33, - 33, 33, 33, 38, 172, 172, 172, 38, 38, 39, - 39, 39, 39, 39, 39, 39, 52, 172, 52, 67, - - 67, 67, 67, 67, 67, 67, 79, 79, 79, 79, - 79, 79, 79, 161, 161, 161, 172, 161, 161, 161, - 163, 172, 163, 172, 163, 163, 163, 170, 170, 170, - 170, 170, 172, 170, 11, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172 + 25, 25, 25, 25, 26, 25, 27, 25, 28, 25, + 25, 25, 25, 25, 29, 30, 31, 25, 25, 26, + 25, 27, 25, 25, 25, 29, 32, 32, 57, 32, + 32, 38, 33, 33, 32, 34, 197, 32, 39, 40, + 33, 38, 57, 38, 35, 186, 186, 41, 39, 40, + 39, 58, 60, 38, 81, 36, 36, 41, 50, 50, + 39, 50, 51, 181, 60, 58, 52, 175, 86, 81, + 36, 36, 45, 61, 62, 45, 61, 64, 79, 80, + + 64, 79, 86, 65, 82, 174, 83, 93, 84, 156, + 155, 144, 85, 96, 46, 47, 97, 48, 100, 82, + 83, 106, 93, 84, 91, 49, 85, 91, 96, 46, + 47, 97, 48, 100, 133, 106, 49, 42, 50, 50, + 119, 50, 51, 132, 42, 42, 52, 105, 42, 92, + 63, 42, 94, 42, 119, 42, 42, 88, 50, 122, + 88, 89, 105, 95, 92, 90, 108, 94, 61, 62, + 122, 61, 42, 63, 42, 66, 109, 64, 66, 109, + 64, 42, 42, 65, 110, 42, 99, 67, 42, 99, + 42, 99, 42, 42, 99, 76, 111, 68, 69, 114, + + 70, 71, 101, 67, 102, 107, 117, 44, 72, 42, + 42, 111, 68, 69, 114, 70, 71, 101, 102, 72, + 74, 117, 76, 79, 80, 103, 79, 74, 74, 104, + 118, 74, 120, 74, 74, 112, 74, 121, 74, 74, + 103, 113, 78, 104, 73, 118, 109, 120, 59, 109, + 112, 55, 121, 113, 110, 74, 74, 75, 75, 76, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 77, 75, 75, 75, 75, 75, 75, 77, 77, 77, + 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, + 77, 77, 75, 77, 77, 77, 77, 77, 77, 77, + + 77, 77, 77, 45, 115, 123, 45, 130, 88, 50, + 116, 88, 89, 157, 88, 50, 90, 88, 89, 115, + 123, 130, 90, 126, 116, 46, 47, 157, 48, 88, + 50, 129, 88, 89, 143, 54, 49, 90, 126, 91, + 46, 47, 91, 48, 131, 143, 129, 49, 66, 88, + 50, 66, 88, 89, 161, 99, 53, 90, 99, 131, + 98, 134, 124, 127, 92, 161, 44, 98, 125, 128, + 68, 69, 135, 70, 71, 136, 134, 124, 127, 92, + 125, 72, 137, 128, 138, 68, 69, 135, 70, 71, + 136, 198, 72, 74, 34, 76, 198, 137, 139, 138, + + 74, 74, 140, 141, 74, 142, 74, 74, 145, 74, + 146, 74, 74, 139, 198, 147, 148, 140, 141, 149, + 142, 150, 151, 145, 152, 146, 153, 154, 74, 74, + 147, 148, 158, 159, 149, 160, 150, 151, 162, 152, + 163, 153, 154, 164, 165, 166, 168, 158, 159, 167, + 160, 169, 170, 162, 171, 163, 198, 173, 164, 165, + 166, 168, 176, 167, 177, 171, 169, 170, 172, 178, + 179, 172, 173, 180, 182, 183, 184, 176, 188, 177, + 98, 179, 172, 189, 178, 172, 190, 191, 180, 182, + 183, 184, 192, 188, 98, 193, 194, 194, 189, 194, + + 194, 190, 191, 198, 198, 198, 198, 192, 198, 198, + 193, 195, 195, 37, 37, 37, 37, 37, 37, 37, + 42, 198, 198, 198, 42, 42, 43, 43, 43, 43, + 43, 43, 43, 56, 198, 56, 75, 75, 75, 75, + 75, 75, 75, 87, 87, 87, 87, 87, 87, 87, + 185, 185, 185, 198, 185, 185, 185, 187, 198, 187, + 198, 187, 187, 187, 196, 196, 196, 196, 196, 198, + 196, 11, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198 } ; -static yyconst flex_int16_t yy_chk[577] = +static yyconst flex_int16_t yy_chk[619] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 4, 170, 2, 4, 7, 2, 4, 6, - 6, 137, 6, 7, 7, 6, 8, 42, 9, 6, - 136, 45, 9, 8, 8, 9, 60, 10, 42, 6, - 6, 10, 45, 63, 10, 18, 18, 60, 18, 18, - 6, 6, 17, 18, 63, 17, 26, 26, 28, 26, - 117, 28, 35, 35, 28, 35, 43, 43, 44, 53, - - 53, 44, 53, 17, 17, 116, 17, 43, 43, 44, - 17, 95, 44, 51, 17, 17, 51, 17, 152, 152, - 94, 17, 27, 46, 46, 70, 46, 46, 64, 27, - 27, 46, 67, 27, 65, 27, 27, 51, 27, 64, - 27, 27, 47, 47, 59, 47, 47, 59, 51, 39, - 47, 34, 27, 27, 29, 29, 59, 56, 29, 30, - 56, 29, 29, 56, 24, 29, 72, 29, 29, 72, - 29, 23, 29, 29, 72, 62, 29, 29, 62, 29, - 29, 61, 61, 29, 29, 29, 62, 29, 29, 62, - 29, 29, 61, 61, 29, 31, 73, 31, 71, 71, - - 21, 71, 31, 31, 75, 76, 31, 73, 31, 31, - 76, 31, 77, 31, 31, 75, 76, 86, 15, 11, - 86, 76, 5, 77, 0, 31, 31, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 41, 74, - 78, 41, 74, 84, 79, 79, 85, 79, 79, 85, - 74, 78, 79, 74, 84, 0, 0, 0, 85, 41, - 41, 0, 41, 87, 80, 80, 41, 80, 80, 0, - - 41, 41, 80, 41, 87, 0, 0, 41, 57, 81, - 81, 57, 81, 81, 0, 82, 82, 81, 82, 82, - 57, 0, 83, 82, 88, 83, 89, 88, 91, 57, - 57, 92, 57, 57, 93, 88, 57, 89, 88, 91, - 57, 57, 92, 57, 57, 93, 83, 57, 66, 90, - 66, 0, 98, 0, 90, 66, 66, 83, 99, 66, - 90, 66, 66, 98, 66, 90, 66, 66, 96, 99, - 100, 96, 101, 102, 103, 104, 96, 105, 66, 66, - 106, 100, 107, 101, 102, 103, 104, 108, 105, 109, - 110, 106, 111, 107, 112, 113, 114, 115, 108, 118, - - 109, 110, 121, 111, 122, 112, 113, 114, 115, 123, - 118, 124, 125, 121, 126, 122, 127, 130, 131, 132, - 123, 133, 124, 125, 135, 126, 138, 127, 130, 131, - 132, 134, 133, 141, 134, 135, 142, 138, 144, 145, - 148, 149, 150, 134, 141, 150, 156, 142, 157, 144, - 145, 148, 149, 160, 150, 165, 0, 156, 166, 157, - 168, 166, 0, 168, 160, 0, 165, 0, 0, 0, - 0, 0, 0, 166, 0, 168, 173, 173, 173, 173, - 173, 173, 173, 174, 0, 0, 0, 174, 174, 175, - 175, 175, 175, 175, 175, 175, 176, 0, 176, 177, - - 177, 177, 177, 177, 177, 177, 178, 178, 178, 178, - 178, 178, 178, 179, 179, 179, 0, 179, 179, 179, - 180, 0, 180, 0, 180, 180, 180, 181, 181, 181, - 181, 181, 0, 181, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172 + 1, 1, 1, 1, 1, 1, 2, 4, 26, 2, + 4, 7, 2, 4, 6, 6, 196, 6, 7, 7, + 6, 8, 26, 9, 6, 174, 174, 9, 8, 8, + 9, 27, 29, 10, 46, 6, 6, 10, 18, 18, + 10, 18, 18, 165, 29, 27, 18, 156, 49, 46, + 6, 6, 17, 30, 30, 17, 30, 32, 39, 39, + + 32, 39, 49, 32, 47, 155, 47, 57, 48, 133, + 132, 121, 48, 59, 17, 17, 60, 17, 68, 47, + 47, 72, 57, 48, 55, 17, 48, 55, 59, 17, + 17, 60, 17, 68, 108, 72, 17, 31, 50, 50, + 92, 50, 50, 107, 31, 31, 50, 71, 31, 55, + 31, 31, 58, 31, 92, 31, 31, 51, 51, 96, + 51, 51, 71, 58, 55, 51, 78, 58, 61, 61, + 96, 61, 31, 31, 33, 33, 80, 64, 33, 80, + 64, 33, 33, 64, 80, 33, 99, 33, 33, 99, + 33, 67, 33, 33, 67, 75, 81, 33, 33, 83, + + 33, 33, 69, 67, 69, 73, 85, 43, 33, 33, + 33, 81, 33, 33, 83, 33, 33, 69, 69, 33, + 35, 85, 35, 79, 79, 70, 79, 35, 35, 70, + 86, 35, 94, 35, 35, 82, 35, 95, 35, 35, + 70, 82, 38, 70, 34, 86, 109, 94, 28, 109, + 82, 24, 95, 82, 109, 35, 35, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, + + 36, 36, 36, 45, 84, 100, 45, 105, 87, 87, + 84, 87, 87, 134, 88, 88, 87, 88, 88, 84, + 100, 105, 88, 102, 84, 45, 45, 134, 45, 89, + 89, 104, 89, 89, 120, 23, 45, 89, 102, 91, + 45, 45, 91, 45, 106, 120, 104, 45, 65, 90, + 90, 65, 90, 90, 140, 98, 21, 90, 98, 106, + 65, 111, 101, 103, 91, 140, 15, 98, 101, 103, + 65, 65, 112, 65, 65, 113, 111, 101, 103, 91, + 101, 65, 114, 103, 115, 65, 65, 112, 65, 65, + 113, 11, 65, 74, 5, 74, 0, 114, 116, 115, + + 74, 74, 117, 118, 74, 119, 74, 74, 122, 74, + 123, 74, 74, 116, 0, 124, 125, 117, 118, 126, + 119, 127, 128, 122, 129, 123, 130, 131, 74, 74, + 124, 125, 137, 138, 126, 139, 127, 128, 141, 129, + 142, 130, 131, 143, 144, 145, 149, 137, 138, 146, + 139, 150, 151, 141, 152, 142, 0, 154, 143, 144, + 145, 149, 157, 146, 160, 152, 150, 151, 153, 161, + 163, 153, 154, 164, 167, 170, 171, 157, 178, 160, + 153, 163, 172, 179, 161, 172, 181, 184, 164, 167, + 170, 171, 189, 178, 172, 190, 191, 194, 179, 191, + + 194, 181, 184, 0, 0, 0, 0, 189, 0, 0, + 190, 191, 194, 199, 199, 199, 199, 199, 199, 199, + 200, 0, 0, 0, 200, 200, 201, 201, 201, 201, + 201, 201, 201, 202, 0, 202, 203, 203, 203, 203, + 203, 203, 203, 204, 204, 204, 204, 204, 204, 204, + 205, 205, 205, 0, 205, 205, 205, 206, 0, 206, + 0, 206, 206, 206, 207, 207, 207, 207, 207, 0, + 207, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198 } ; /* The intent behind this definition is that it'll catch @@ -636,7 +632,7 @@ static yyconst flex_int16_t yy_chk[577] = #line 2 "cmFortranLexer.in.l" /*============================================================================ CMake - Cross Platform Makefile Generator - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + Copyright 2000-2015 Kitware, Inc., Insight Software Consortium Distributed under the OSI-approved BSD License (the "License"); see accompanying file Copyright.txt for details. @@ -659,28 +655,21 @@ static yyconst flex_int16_t yy_chk[577] = This file must be translated to C and modified to build everywhere. -Run flex like this: +Run flex >= 2.6 like this: flex -i --prefix=cmFortran_yy --header-file=cmFortranLexer.h -ocmFortranLexer.cxx cmFortranLexer.in.l Modify cmFortranLexer.cxx: - - remove TABs - - remove use of the 'register' storage class specifier - - remove "yyscanner" argument from these methods: - yy_fatal_error, cmFortran_yyalloc, cmFortran_yyrealloc, cmFortran_yyfree + - remove trailing whitespace: sed -i 's/\s*$//' cmFortranLexer.h cmFortranLexer.cxx + - remove blank lines at end of file - remove "yyscanner = NULL" from end of cmFortran_yylex_destroy - remove all YY_BREAK lines occurring right after return statements - - change while ( 1 ) to for(;;) - -Modify cmFortranLexer.h: - - remove TABs - - remove the yy_init_globals function - - remove the block that includes unistd.h - - remove #line directives (avoids bogus warning on old Sun) + - add cast in cmFortran_yy_scan_bytes for loop condition of _yybytes_len to size_t */ #include "cmStandardLexer.h" +#undef YY_NO_UNPUT #define cmFortranLexer_cxx #include "cmFortranParser.h" /* Interface to parser object. */ @@ -729,8 +718,8 @@ struct yyguts_t size_t yy_buffer_stack_max; /**< capacity of stack. */ YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ char yy_hold_char; - yy_size_t yy_n_chars; - yy_size_t yyleng_r; + int yy_n_chars; + int yyleng_r; char *yy_c_buf_p; int yy_init; int yy_start; @@ -771,23 +760,23 @@ void cmFortran_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); FILE *cmFortran_yyget_in (yyscan_t yyscanner ); -void cmFortran_yyset_in (FILE * in_str ,yyscan_t yyscanner ); +void cmFortran_yyset_in (FILE * _in_str ,yyscan_t yyscanner ); FILE *cmFortran_yyget_out (yyscan_t yyscanner ); -void cmFortran_yyset_out (FILE * out_str ,yyscan_t yyscanner ); +void cmFortran_yyset_out (FILE * _out_str ,yyscan_t yyscanner ); -yy_size_t cmFortran_yyget_leng (yyscan_t yyscanner ); + int cmFortran_yyget_leng (yyscan_t yyscanner ); char *cmFortran_yyget_text (yyscan_t yyscanner ); int cmFortran_yyget_lineno (yyscan_t yyscanner ); -void cmFortran_yyset_lineno (int line_number ,yyscan_t yyscanner ); +void cmFortran_yyset_lineno (int _line_number ,yyscan_t yyscanner ); int cmFortran_yyget_column (yyscan_t yyscanner ); -void cmFortran_yyset_column (int column_no ,yyscan_t yyscanner ); +void cmFortran_yyset_column (int _column_no ,yyscan_t yyscanner ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -801,8 +790,12 @@ extern int cmFortran_yywrap (yyscan_t yyscanner ); #endif #endif +#ifndef YY_NO_UNPUT + static void yyunput (int c,char *buf_ptr ,yyscan_t yyscanner); +#endif + #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); #endif @@ -836,7 +829,7 @@ static int input (yyscan_t yyscanner ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) +#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -844,33 +837,33 @@ static int input (yyscan_t yyscanner ); */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ - if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ - { \ - int c = '*'; \ - size_t n; \ - for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else \ - { \ - errno=0; \ - while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ - { \ - if( errno != EINTR) \ - { \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - break; \ - } \ - errno=0; \ - clearerr(yyin); \ - } \ - }\ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = (int) fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ \ #endif @@ -915,135 +908,135 @@ extern int cmFortran_yylex (yyscan_t yyscanner); /* Code executed at the end of each rule. */ #ifndef YY_BREAK -#define YY_BREAK break; +#define YY_BREAK /*LINTED*/break; #endif #define YY_RULE_SETUP \ - if ( yyleng > 0 ) \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ - (yytext[yyleng - 1] == '\n'); \ - YY_USER_ACTION + if ( yyleng > 0 ) \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ + (yytext[yyleng - 1] == '\n'); \ + YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { - yy_state_type yy_current_state; - char *yy_cp, *yy_bp; - int yy_act; + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - if ( !yyg->yy_init ) - { - yyg->yy_init = 1; + if ( !yyg->yy_init ) + { + yyg->yy_init = 1; #ifdef YY_USER_INIT - YY_USER_INIT; + YY_USER_INIT; #endif - if ( ! yyg->yy_start ) - yyg->yy_start = 1; /* first start state */ + if ( ! yyg->yy_start ) + yyg->yy_start = 1; /* first start state */ - if ( ! yyin ) - yyin = stdin; + if ( ! yyin ) + yyin = stdin; - if ( ! yyout ) - yyout = stdout; + if ( ! yyout ) + yyout = stdout; - if ( ! YY_CURRENT_BUFFER ) { - cmFortran_yyensure_buffer_stack (yyscanner); - YY_CURRENT_BUFFER_LVALUE = - cmFortran_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); - } + if ( ! YY_CURRENT_BUFFER ) { + cmFortran_yyensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + cmFortran_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + } - cmFortran_yy_load_buffer_state(yyscanner ); - } + cmFortran_yy_load_buffer_state(yyscanner ); + } - { -#line 72 "cmFortranLexer.in.l" + { +#line 65 "cmFortranLexer.in.l" -#line 956 "cmFortranLexer.cxx" +#line 960 "cmFortranLexer.cxx" - for(;;) /* loops until end-of-file is reached */ - { - yy_cp = yyg->yy_c_buf_p; + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ + { + yy_cp = yyg->yy_c_buf_p; - /* Support of yytext. */ - *yy_cp = yyg->yy_hold_char; + /* Support of yytext. */ + *yy_cp = yyg->yy_hold_char; - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; - yy_current_state = yyg->yy_start; - yy_current_state += YY_AT_BOL(); + yy_current_state = yyg->yy_start; + yy_current_state += YY_AT_BOL(); yy_match: - do - { - YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; - if ( yy_accept[yy_current_state] ) - { - yyg->yy_last_accepting_state = yy_current_state; - yyg->yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 173 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 535 ); + do + { + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 199 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 572 ); yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = yyg->yy_last_accepting_cpos; - yy_current_state = yyg->yy_last_accepting_state; - yy_act = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - -do_action: /* This label is used only to access EOF actions. */ - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = yyg->yy_hold_char; - yy_cp = yyg->yy_last_accepting_cpos; - yy_current_state = yyg->yy_last_accepting_state; - goto yy_find_action; + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = yyg->yy_hold_char; + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + goto yy_find_action; case 1: YY_RULE_SETUP -#line 74 "cmFortranLexer.in.l" +#line 67 "cmFortranLexer.in.l" { cmFortranParser_StringStart(yyextra); cmFortranParser_SetOldStartcond(yyextra, YY_START); BEGIN(str_dq); } - YY_BREAK + YY_BREAK case 2: YY_RULE_SETUP -#line 80 "cmFortranLexer.in.l" +#line 73 "cmFortranLexer.in.l" { cmFortranParser_StringStart(yyextra); cmFortranParser_SetOldStartcond(yyextra, YY_START); BEGIN(str_sq); } - YY_BREAK + YY_BREAK case 3: -#line 87 "cmFortranLexer.in.l" +#line 80 "cmFortranLexer.in.l" case 4: YY_RULE_SETUP -#line 87 "cmFortranLexer.in.l" +#line 80 "cmFortranLexer.in.l" { BEGIN(cmFortranParser_GetOldStartcond(yyextra) ); yylvalp->string = strdup(cmFortranParser_StringEnd(yyextra)); @@ -1051,17 +1044,17 @@ YY_RULE_SETUP } case 5: /* rule 5 can match eol */ -#line 94 "cmFortranLexer.in.l" +#line 87 "cmFortranLexer.in.l" case 6: /* rule 6 can match eol */ YY_RULE_SETUP -#line 94 "cmFortranLexer.in.l" +#line 87 "cmFortranLexer.in.l" /* Ignore (continued strings, free fmt) */ - YY_BREAK + YY_BREAK case 7: /* rule 7 can match eol */ YY_RULE_SETUP -#line 96 "cmFortranLexer.in.l" +#line 89 "cmFortranLexer.in.l" { if (cmFortranParser_GetOldStartcond(yyextra) == fixed_fmt) ; /* Ignore (cont. strings, fixed fmt) */ @@ -1070,11 +1063,11 @@ YY_RULE_SETUP unput(yytext[strlen(yytext)-1]); } } - YY_BREAK + YY_BREAK case 8: /* rule 8 can match eol */ YY_RULE_SETUP -#line 106 "cmFortranLexer.in.l" +#line 99 "cmFortranLexer.in.l" { unput ('\n'); BEGIN(INITIAL); @@ -1082,29 +1075,29 @@ YY_RULE_SETUP } case 9: YY_RULE_SETUP -#line 112 "cmFortranLexer.in.l" +#line 105 "cmFortranLexer.in.l" { cmFortranParser_StringAppend(yyextra, yytext[0]); } - YY_BREAK + YY_BREAK case 10: /* rule 10 can match eol */ YY_RULE_SETUP -#line 116 "cmFortranLexer.in.l" +#line 109 "cmFortranLexer.in.l" { return EOSTMT; } /* Treat comments like */ case 11: /* rule 11 can match eol */ YY_RULE_SETUP -#line 117 "cmFortranLexer.in.l" +#line 110 "cmFortranLexer.in.l" { return EOSTMT; } /* empty lines */ case 12: YY_RULE_SETUP -#line 119 "cmFortranLexer.in.l" +#line 112 "cmFortranLexer.in.l" { return CPP_LINE_DIRECTIVE; } case 13: /* rule 13 can match eol */ YY_RULE_SETUP -#line 120 "cmFortranLexer.in.l" +#line 113 "cmFortranLexer.in.l" { yytext[yyleng-1] = 0; yylvalp->string = strdup(strchr(yytext, '<')+1); @@ -1112,530 +1105,554 @@ YY_RULE_SETUP } case 14: YY_RULE_SETUP -#line 125 "cmFortranLexer.in.l" +#line 118 "cmFortranLexer.in.l" { return CPP_INCLUDE; } case 15: YY_RULE_SETUP -#line 126 "cmFortranLexer.in.l" +#line 119 "cmFortranLexer.in.l" { return F90PPR_INCLUDE; } case 16: YY_RULE_SETUP -#line 127 "cmFortranLexer.in.l" +#line 120 "cmFortranLexer.in.l" { return COCO_INCLUDE; } case 17: YY_RULE_SETUP -#line 129 "cmFortranLexer.in.l" +#line 122 "cmFortranLexer.in.l" { return CPP_DEFINE; } case 18: YY_RULE_SETUP -#line 130 "cmFortranLexer.in.l" +#line 123 "cmFortranLexer.in.l" { return F90PPR_DEFINE; } case 19: YY_RULE_SETUP -#line 132 "cmFortranLexer.in.l" +#line 125 "cmFortranLexer.in.l" { return CPP_UNDEF; } case 20: YY_RULE_SETUP -#line 133 "cmFortranLexer.in.l" +#line 126 "cmFortranLexer.in.l" { return F90PPR_UNDEF; } case 21: YY_RULE_SETUP -#line 135 "cmFortranLexer.in.l" +#line 128 "cmFortranLexer.in.l" { return CPP_IFDEF; } case 22: YY_RULE_SETUP -#line 136 "cmFortranLexer.in.l" +#line 129 "cmFortranLexer.in.l" { return CPP_IFNDEF; } case 23: YY_RULE_SETUP -#line 137 "cmFortranLexer.in.l" +#line 130 "cmFortranLexer.in.l" { return CPP_IF; } case 24: YY_RULE_SETUP -#line 138 "cmFortranLexer.in.l" +#line 131 "cmFortranLexer.in.l" { return CPP_ELIF; } case 25: YY_RULE_SETUP -#line 139 "cmFortranLexer.in.l" +#line 132 "cmFortranLexer.in.l" { return CPP_ELSE; } case 26: YY_RULE_SETUP -#line 140 "cmFortranLexer.in.l" +#line 133 "cmFortranLexer.in.l" { return CPP_ENDIF; } case 27: YY_RULE_SETUP -#line 142 "cmFortranLexer.in.l" +#line 135 "cmFortranLexer.in.l" { return F90PPR_IFDEF; } case 28: YY_RULE_SETUP -#line 143 "cmFortranLexer.in.l" +#line 136 "cmFortranLexer.in.l" { return F90PPR_IFNDEF; } case 29: YY_RULE_SETUP -#line 144 "cmFortranLexer.in.l" +#line 137 "cmFortranLexer.in.l" { return F90PPR_IF; } case 30: YY_RULE_SETUP -#line 145 "cmFortranLexer.in.l" +#line 138 "cmFortranLexer.in.l" { return F90PPR_ELIF; } case 31: YY_RULE_SETUP -#line 146 "cmFortranLexer.in.l" +#line 139 "cmFortranLexer.in.l" { return F90PPR_ELSE; } case 32: YY_RULE_SETUP -#line 147 "cmFortranLexer.in.l" +#line 140 "cmFortranLexer.in.l" { return F90PPR_ENDIF; } /* Line continuations, possible involving comments. */ case 33: /* rule 33 can match eol */ YY_RULE_SETUP -#line 150 "cmFortranLexer.in.l" +#line 143 "cmFortranLexer.in.l" - YY_BREAK + YY_BREAK case 34: /* rule 34 can match eol */ YY_RULE_SETUP -#line 151 "cmFortranLexer.in.l" +#line 144 "cmFortranLexer.in.l" - YY_BREAK + YY_BREAK case 35: YY_RULE_SETUP -#line 153 "cmFortranLexer.in.l" +#line 146 "cmFortranLexer.in.l" { return COMMA; } case 36: YY_RULE_SETUP -#line 155 "cmFortranLexer.in.l" +#line 148 "cmFortranLexer.in.l" { return DCOLON; } case 37: /* rule 37 can match eol */ YY_RULE_SETUP -#line 157 "cmFortranLexer.in.l" +#line 150 "cmFortranLexer.in.l" { return GARBAGE; } case 38: YY_RULE_SETUP -#line 159 "cmFortranLexer.in.l" +#line 152 "cmFortranLexer.in.l" { return ASSIGNMENT_OP; } case 39: YY_RULE_SETUP -#line 161 "cmFortranLexer.in.l" +#line 154 "cmFortranLexer.in.l" +{ return END; } +case 40: +YY_RULE_SETUP +#line 155 "cmFortranLexer.in.l" +{ return INCLUDE; } +case 41: +YY_RULE_SETUP +#line 156 "cmFortranLexer.in.l" +{ return INTERFACE; } +case 42: +YY_RULE_SETUP +#line 157 "cmFortranLexer.in.l" +{ return MODULE; } +case 43: +YY_RULE_SETUP +#line 158 "cmFortranLexer.in.l" +{ return USE; } +case 44: +YY_RULE_SETUP +#line 160 "cmFortranLexer.in.l" { yylvalp->string = strdup(yytext); return WORD; } -case 40: +case 45: YY_RULE_SETUP -#line 166 "cmFortranLexer.in.l" +#line 165 "cmFortranLexer.in.l" { return GARBAGE; } -case 41: -/* rule 41 can match eol */ +case 46: +/* rule 46 can match eol */ YY_RULE_SETUP -#line 168 "cmFortranLexer.in.l" +#line 167 "cmFortranLexer.in.l" { return EOSTMT; } -case 42: +case 47: YY_RULE_SETUP -#line 171 "cmFortranLexer.in.l" +#line 170 "cmFortranLexer.in.l" /* Ignore */ - YY_BREAK -case 43: -/* rule 43 can match eol */ + YY_BREAK +case 48: +/* rule 48 can match eol */ YY_RULE_SETUP -#line 172 "cmFortranLexer.in.l" +#line 171 "cmFortranLexer.in.l" /* Ignore line-endings preceded by \ */ - YY_BREAK -case 44: + YY_BREAK +case 49: YY_RULE_SETUP -#line 174 "cmFortranLexer.in.l" +#line 173 "cmFortranLexer.in.l" { return *yytext; } case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(free_fmt): case YY_STATE_EOF(fixed_fmt): case YY_STATE_EOF(str_sq): case YY_STATE_EOF(str_dq): -#line 176 "cmFortranLexer.in.l" +#line 175 "cmFortranLexer.in.l" { if(!cmFortranParser_FilePop(yyextra) ) { return YY_NULL; } } - YY_BREAK -case 45: + YY_BREAK +case 50: YY_RULE_SETUP -#line 183 "cmFortranLexer.in.l" +#line 182 "cmFortranLexer.in.l" ECHO; - YY_BREAK -#line 1291 "cmFortranLexer.cxx" - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yyg->yy_hold_char; - YY_RESTORE_YY_MORE_OFFSET - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * cmFortran_yylex(). If so, then we have to assure - * consistency between YY_CURRENT_BUFFER and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( yyscanner ); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); - - yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++yyg->yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = yyg->yy_c_buf_p; - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer( yyscanner ) ) - { - case EOB_ACT_END_OF_FILE: - { - yyg->yy_did_buffer_switch_on_eof = 0; - - if ( cmFortran_yywrap(yyscanner ) ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! yyg->yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - yyg->yy_c_buf_p = - yyg->yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( yyscanner ); - - yy_cp = yyg->yy_c_buf_p; - yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - yyg->yy_c_buf_p = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; - - yy_current_state = yy_get_previous_state( yyscanner ); - - yy_cp = yyg->yy_c_buf_p; - yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of user's declarations */ + YY_BREAK +#line 1320 "cmFortranLexer.cxx" + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yyg->yy_hold_char; + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * cmFortran_yylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); + + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yyg->yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = yyg->yy_c_buf_p; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( yyscanner ) ) + { + case EOB_ACT_END_OF_FILE: + { + yyg->yy_did_buffer_switch_on_eof = 0; + + if ( cmFortran_yywrap(yyscanner ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = + yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yyg->yy_c_buf_p = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of user's declarations */ } /* end of cmFortran_yylex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - char *source = yyg->yytext_ptr; - int number_to_move, i; - int ret_val; - - if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; - - else - { - yy_size_t num_to_read = - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; - - int yy_c_buf_p_offset = - (int) (yyg->yy_c_buf_p - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - yy_size_t new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - cmFortran_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - - number_to_move - 1; - - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - yyg->yy_n_chars, num_to_read ); - - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; - } - - if ( yyg->yy_n_chars == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - cmFortran_yyrestart(yyin ,yyscanner); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { - /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) cmFortran_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); - if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); - } - - yyg->yy_n_chars += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; - - yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = yyg->yytext_ptr; + yy_size_t number_to_move, i; + int ret_val; + + if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (yy_size_t) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; + + int yy_c_buf_p_offset = + (int) (yyg->yy_c_buf_p - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + cmFortran_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = NULL; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + yyg->yy_n_chars, num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + if ( yyg->yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + cmFortran_yyrestart(yyin ,yyscanner); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((int) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) cmFortran_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + yyg->yy_n_chars += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; - return ret_val; + return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state (yyscan_t yyscanner) { - yy_state_type yy_current_state; - char *yy_cp; + yy_state_type yy_current_state; + char *yy_cp; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yy_current_state = yyg->yy_start; - yy_current_state += YY_AT_BOL(); - - for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) - { - YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - yyg->yy_last_accepting_state = yy_current_state; - yyg->yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 173 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - } - - return yy_current_state; + yy_current_state = yyg->yy_start; + yy_current_state += YY_AT_BOL(); + + for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) + { + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 199 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; + } + + return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis - * next_state = yy_try_NUL_trans( current_state ); + * next_state = yy_try_NUL_trans( current_state ); */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) { - int yy_is_jam; + int yy_is_jam; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ - char *yy_cp = yyg->yy_c_buf_p; - - YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - yyg->yy_last_accepting_state = yy_current_state; - yyg->yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 173 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 172); - - (void)yyg; - return yy_is_jam ? 0 : yy_current_state; + char *yy_cp = yyg->yy_c_buf_p; + + YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 199 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; + yy_is_jam = (yy_current_state == 198); + + (void)yyg; + return yy_is_jam ? 0 : yy_current_state; } +#ifndef YY_NO_UNPUT + static void yyunput (int c, char * yy_bp , yyscan_t yyscanner) { - char *yy_cp; + char *yy_cp; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yy_cp = yyg->yy_c_buf_p; - /* undo effects of setting up yytext */ - *yy_cp = yyg->yy_hold_char; + /* undo effects of setting up yytext */ + *yy_cp = yyg->yy_hold_char; - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - yy_size_t number_to_move = yyg->yy_n_chars + 2; - char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + int number_to_move = yyg->yy_n_chars + 2; + char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + yyg->yy_n_chars = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } - *--yy_cp = (char) c; + *--yy_cp = (char) c; - yyg->yytext_ptr = yy_bp; - yyg->yy_hold_char = *yy_cp; - yyg->yy_c_buf_p = yy_cp; + yyg->yytext_ptr = yy_bp; + yyg->yy_hold_char = *yy_cp; + yyg->yy_c_buf_p = yy_cp; } +#endif + #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (yyscan_t yyscanner) @@ -1644,74 +1661,74 @@ static int yy_get_next_buffer (yyscan_t yyscanner) #endif { - int c; + int c; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - *yyg->yy_c_buf_p = yyg->yy_hold_char; - - if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) - /* This was really a NUL. */ - *yyg->yy_c_buf_p = '\0'; - - else - { /* need more input */ - yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr; - ++yyg->yy_c_buf_p; - - switch ( yy_get_next_buffer( yyscanner ) ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - cmFortran_yyrestart(yyin ,yyscanner); - - /*FALLTHROUGH*/ - - case EOB_ACT_END_OF_FILE: - { - if ( cmFortran_yywrap(yyscanner ) ) - return EOF; - - if ( ! yyg->yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; + *yyg->yy_c_buf_p = yyg->yy_hold_char; + + if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + /* This was really a NUL. */ + *yyg->yy_c_buf_p = '\0'; + + else + { /* need more input */ + int offset = yyg->yy_c_buf_p - yyg->yytext_ptr; + ++yyg->yy_c_buf_p; + + switch ( yy_get_next_buffer( yyscanner ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + cmFortran_yyrestart(yyin ,yyscanner); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( cmFortran_yywrap(yyscanner ) ) + return 0; + + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; #ifdef __cplusplus - return yyinput(yyscanner); + return yyinput(yyscanner); #else - return input(yyscanner); + return input(yyscanner); #endif - } + } - case EOB_ACT_CONTINUE_SCAN: - yyg->yy_c_buf_p = yyg->yytext_ptr + offset; - break; - } - } - } + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = yyg->yytext_ptr + offset; + break; + } + } + } - c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ - *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ - yyg->yy_hold_char = *++yyg->yy_c_buf_p; + c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ + *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ + yyg->yy_hold_char = *++yyg->yy_c_buf_p; - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); - return c; + return c; } -#endif /* ifndef YY_NO_INPUT */ +#endif /* ifndef YY_NO_INPUT */ /** Immediately switch to a different input stream. * @param input_file A readable stream. @@ -1722,14 +1739,14 @@ static int yy_get_next_buffer (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - if ( ! YY_CURRENT_BUFFER ){ + if ( ! YY_CURRENT_BUFFER ){ cmFortran_yyensure_buffer_stack (yyscanner); - YY_CURRENT_BUFFER_LVALUE = + YY_CURRENT_BUFFER_LVALUE = cmFortran_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); - } + } - cmFortran_yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); - cmFortran_yy_load_buffer_state(yyscanner ); + cmFortran_yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); + cmFortran_yy_load_buffer_state(yyscanner ); } /** Switch to a different input buffer. @@ -1740,41 +1757,41 @@ static int yy_get_next_buffer (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - /* TODO. We should be able to replace this entire function body - * with - * cmFortran_yypop_buffer_state(); - * cmFortran_yypush_buffer_state(new_buffer); + /* TODO. We should be able to replace this entire function body + * with + * cmFortran_yypop_buffer_state(); + * cmFortran_yypush_buffer_state(new_buffer); */ - cmFortran_yyensure_buffer_stack (yyscanner); - if ( YY_CURRENT_BUFFER == new_buffer ) - return; - - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *yyg->yy_c_buf_p = yyg->yy_hold_char; - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; - } - - YY_CURRENT_BUFFER_LVALUE = new_buffer; - cmFortran_yy_load_buffer_state(yyscanner ); - - /* We don't actually know whether we did this switch during - * EOF (cmFortran_yywrap()) processing, but the only time this flag - * is looked at is after cmFortran_yywrap() is called, so it's safe - * to go ahead and always set it. - */ - yyg->yy_did_buffer_switch_on_eof = 1; + cmFortran_yyensure_buffer_stack (yyscanner); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + cmFortran_yy_load_buffer_state(yyscanner ); + + /* We don't actually know whether we did this switch during + * EOF (cmFortran_yywrap()) processing, but the only time this flag + * is looked at is after cmFortran_yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yyg->yy_did_buffer_switch_on_eof = 1; } static void cmFortran_yy_load_buffer_state (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; - yyg->yy_hold_char = *yyg->yy_c_buf_p; + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + yyg->yy_hold_char = *yyg->yy_c_buf_p; } /** Allocate and initialize an input buffer state. @@ -1785,26 +1802,26 @@ static void cmFortran_yy_load_buffer_state (yyscan_t yyscanner) */ YY_BUFFER_STATE cmFortran_yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) { - YY_BUFFER_STATE b; + YY_BUFFER_STATE b; - b = (YY_BUFFER_STATE) cmFortran_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in cmFortran_yy_create_buffer()" ); + b = (YY_BUFFER_STATE) cmFortran_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in cmFortran_yy_create_buffer()" ); - b->yy_buf_size = size; + b->yy_buf_size = (yy_size_t)size; - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) cmFortran_yyalloc(b->yy_buf_size + 2 ,yyscanner ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in cmFortran_yy_create_buffer()" ); + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) cmFortran_yyalloc(b->yy_buf_size + 2 ,yyscanner ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in cmFortran_yy_create_buffer()" ); - b->yy_is_our_buffer = 1; + b->yy_is_our_buffer = 1; - cmFortran_yy_init_buffer(b,file ,yyscanner); + cmFortran_yy_init_buffer(b,file ,yyscanner); - return b; + return b; } /** Destroy the buffer. @@ -1815,16 +1832,16 @@ static void cmFortran_yy_load_buffer_state (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - if ( ! b ) - return; + if ( ! b ) + return; - if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; - if ( b->yy_is_our_buffer ) - cmFortran_yyfree((void *) b->yy_ch_buf ,yyscanner ); + if ( b->yy_is_our_buffer ) + cmFortran_yyfree((void *) b->yy_ch_buf ,yyscanner ); - cmFortran_yyfree((void *) b ,yyscanner ); + cmFortran_yyfree((void *) b ,yyscanner ); } /* Initializes or reinitializes a buffer. @@ -1834,13 +1851,13 @@ static void cmFortran_yy_load_buffer_state (yyscan_t yyscanner) static void cmFortran_yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) { - int oerrno = errno; + int oerrno = errno; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - cmFortran_yy_flush_buffer(b ,yyscanner); + cmFortran_yy_flush_buffer(b ,yyscanner); - b->yy_input_file = file; - b->yy_fill_buffer = 1; + b->yy_input_file = file; + b->yy_fill_buffer = 1; /* If b is the current buffer, then cmFortran_yy_init_buffer was _probably_ * called from cmFortran_yyrestart() or through yy_get_next_buffer. @@ -1853,7 +1870,7 @@ static void cmFortran_yy_load_buffer_state (yyscan_t yyscanner) b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; - errno = oerrno; + errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. @@ -1863,25 +1880,25 @@ static void cmFortran_yy_load_buffer_state (yyscan_t yyscanner) void cmFortran_yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - if ( ! b ) - return; + if ( ! b ) + return; - b->yy_n_chars = 0; + b->yy_n_chars = 0; - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - b->yy_buf_pos = &b->yy_ch_buf[0]; + b->yy_buf_pos = &b->yy_ch_buf[0]; - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; - if ( b == YY_CURRENT_BUFFER ) - cmFortran_yy_load_buffer_state(yyscanner ); + if ( b == YY_CURRENT_BUFFER ) + cmFortran_yy_load_buffer_state(yyscanner ); } /** Pushes the new state onto the stack. The new state becomes @@ -1893,28 +1910,28 @@ static void cmFortran_yy_load_buffer_state (yyscan_t yyscanner) void cmFortran_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - if (new_buffer == NULL) - return; - - cmFortran_yyensure_buffer_stack(yyscanner); - - /* This block is copied from cmFortran_yy_switch_to_buffer. */ - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *yyg->yy_c_buf_p = yyg->yy_hold_char; - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; - } - - /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) - yyg->yy_buffer_stack_top++; - YY_CURRENT_BUFFER_LVALUE = new_buffer; - - /* copied from cmFortran_yy_switch_to_buffer. */ - cmFortran_yy_load_buffer_state(yyscanner ); - yyg->yy_did_buffer_switch_on_eof = 1; + if (new_buffer == NULL) + return; + + cmFortran_yyensure_buffer_stack(yyscanner); + + /* This block is copied from cmFortran_yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + yyg->yy_buffer_stack_top++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from cmFortran_yy_switch_to_buffer. */ + cmFortran_yy_load_buffer_state(yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; } /** Removes and deletes the top of the stack, if present. @@ -1924,18 +1941,18 @@ void cmFortran_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscan void cmFortran_yypop_buffer_state (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - if (!YY_CURRENT_BUFFER) - return; - - cmFortran_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner); - YY_CURRENT_BUFFER_LVALUE = NULL; - if (yyg->yy_buffer_stack_top > 0) - --yyg->yy_buffer_stack_top; - - if (YY_CURRENT_BUFFER) { - cmFortran_yy_load_buffer_state(yyscanner ); - yyg->yy_did_buffer_switch_on_eof = 1; - } + if (!YY_CURRENT_BUFFER) + return; + + cmFortran_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner); + YY_CURRENT_BUFFER_LVALUE = NULL; + if (yyg->yy_buffer_stack_top > 0) + --yyg->yy_buffer_stack_top; + + if (YY_CURRENT_BUFFER) { + cmFortran_yy_load_buffer_state(yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; + } } /* Allocates the stack if it does not exist. @@ -1943,46 +1960,46 @@ void cmFortran_yypop_buffer_state (yyscan_t yyscanner) */ static void cmFortran_yyensure_buffer_stack (yyscan_t yyscanner) { - yy_size_t num_to_alloc; + int num_to_alloc; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - if (!yyg->yy_buffer_stack) { + if (!yyg->yy_buffer_stack) { - /* First allocation is just for 2 elements, since we don't know if this - * scanner will even need a stack. We use 2 instead of 1 to avoid an - * immediate realloc on the next call. + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. */ - num_to_alloc = 1; - yyg->yy_buffer_stack = (struct yy_buffer_state**)cmFortran_yyalloc - (num_to_alloc * sizeof(struct yy_buffer_state*) - , yyscanner); - if ( ! yyg->yy_buffer_stack ) - YY_FATAL_ERROR( "out of dynamic memory in cmFortran_yyensure_buffer_stack()" ); - - memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - - yyg->yy_buffer_stack_max = num_to_alloc; - yyg->yy_buffer_stack_top = 0; - return; - } - - if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ - - /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; - - num_to_alloc = yyg->yy_buffer_stack_max + grow_size; - yyg->yy_buffer_stack = (struct yy_buffer_state**)cmFortran_yyrealloc - (yyg->yy_buffer_stack, - num_to_alloc * sizeof(struct yy_buffer_state*) - , yyscanner); - if ( ! yyg->yy_buffer_stack ) - YY_FATAL_ERROR( "out of dynamic memory in cmFortran_yyensure_buffer_stack()" ); - - /* zero only the new slots.*/ - memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); - yyg->yy_buffer_stack_max = num_to_alloc; - } + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ + yyg->yy_buffer_stack = (struct yy_buffer_state**)cmFortran_yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in cmFortran_yyensure_buffer_stack()" ); + + memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + yyg->yy_buffer_stack_max = num_to_alloc; + yyg->yy_buffer_stack_top = 0; + return; + } + + if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + yy_size_t grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = yyg->yy_buffer_stack_max + grow_size; + yyg->yy_buffer_stack = (struct yy_buffer_state**)cmFortran_yyrealloc + (yyg->yy_buffer_stack, + num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in cmFortran_yyensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); + yyg->yy_buffer_stack_max = num_to_alloc; + } } /** Setup the input buffer state to scan directly from a user-specified character buffer. @@ -1993,31 +2010,31 @@ static void cmFortran_yyensure_buffer_stack (yyscan_t yyscanner) */ YY_BUFFER_STATE cmFortran_yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) { - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) cmFortran_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in cmFortran_yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - cmFortran_yy_switch_to_buffer(b ,yyscanner ); - - return b; + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return NULL; + + b = (YY_BUFFER_STATE) cmFortran_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in cmFortran_yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = NULL; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + cmFortran_yy_switch_to_buffer(b ,yyscanner ); + + return b; } /** Setup the input buffer state to scan a string. The next call to cmFortran_yylex() will @@ -2031,7 +2048,7 @@ YY_BUFFER_STATE cmFortran_yy_scan_buffer (char * base, yy_size_t size , yyscan YY_BUFFER_STATE cmFortran_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner) { - return cmFortran_yy_scan_bytes(yystr,strlen(yystr) ,yyscanner); + return cmFortran_yy_scan_bytes(yystr,(int) strlen(yystr) ,yyscanner); } /** Setup the input buffer state to scan the given bytes. The next call to cmFortran_yylex() will @@ -2041,62 +2058,64 @@ YY_BUFFER_STATE cmFortran_yy_scan_string (yyconst char * yystr , yyscan_t yyscan * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE cmFortran_yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner) +YY_BUFFER_STATE cmFortran_yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - yy_size_t i; + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + yy_size_t i; - /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *) cmFortran_yyalloc(n ,yyscanner ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in cmFortran_yy_scan_bytes()" ); + /* Get memory for full buffer, including space for trailing EOB's. */ + n = (yy_size_t) _yybytes_len + 2; + buf = (char *) cmFortran_yyalloc(n ,yyscanner ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in cmFortran_yy_scan_bytes()" ); - for ( i = 0; i < _yybytes_len; ++i ) - buf[i] = yybytes[i]; + for ( i = 0; i < (size_t)_yybytes_len; ++i ) + buf[i] = yybytes[i]; - buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - b = cmFortran_yy_scan_buffer(buf,n ,yyscanner); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in cmFortran_yy_scan_bytes()" ); + b = cmFortran_yy_scan_buffer(buf,n ,yyscanner); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in cmFortran_yy_scan_bytes()" ); - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; - return b; + return b; } #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif -static void yy_fatal_error (yyconst char* msg , yyscan_t) +static void yynoreturn yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ - yytext[yyleng] = yyg->yy_hold_char; \ - yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ - yyg->yy_hold_char = *yyg->yy_c_buf_p; \ - *yyg->yy_c_buf_p = '\0'; \ - yyleng = yyless_macro_arg; \ - } \ - while ( 0 ) + yytext[yyleng] = yyg->yy_hold_char; \ + yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ + yyg->yy_hold_char = *yyg->yy_c_buf_p; \ + *yyg->yy_c_buf_p = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ @@ -2156,7 +2175,7 @@ FILE *cmFortran_yyget_out (yyscan_t yyscanner) /** Get the length of the current token. * @param yyscanner The scanner object. */ -yy_size_t cmFortran_yyget_leng (yyscan_t yyscanner) +int cmFortran_yyget_leng (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyleng; @@ -2183,10 +2202,10 @@ void cmFortran_yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) } /** Set the current line number. - * @param line_number The line number to set. + * @param _line_number line number * @param yyscanner The scanner object. */ -void cmFortran_yyset_lineno (int line_number , yyscan_t yyscanner) +void cmFortran_yyset_lineno (int _line_number , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; @@ -2194,14 +2213,14 @@ void cmFortran_yyset_lineno (int line_number , yyscan_t yyscanner) if (! YY_CURRENT_BUFFER ) YY_FATAL_ERROR( "cmFortran_yyset_lineno called with no buffer" ); - yylineno = line_number; + yylineno = _line_number; } /** Set the current column. - * @param column_no The column number to set. + * @param _column_no column number * @param yyscanner The scanner object. */ -void cmFortran_yyset_column (int column_no , yyscan_t yyscanner) +void cmFortran_yyset_column (int _column_no , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; @@ -2209,25 +2228,25 @@ void cmFortran_yyset_column (int column_no , yyscan_t yyscanner) if (! YY_CURRENT_BUFFER ) YY_FATAL_ERROR( "cmFortran_yyset_column called with no buffer" ); - yycolumn = column_no; + yycolumn = _column_no; } /** Set the input stream. This does not discard the current * input buffer. - * @param in_str A readable stream. + * @param _in_str A readable stream. * @param yyscanner The scanner object. * @see cmFortran_yy_switch_to_buffer */ -void cmFortran_yyset_in (FILE * in_str , yyscan_t yyscanner) +void cmFortran_yyset_in (FILE * _in_str , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yyin = in_str ; + yyin = _in_str ; } -void cmFortran_yyset_out (FILE * out_str , yyscan_t yyscanner) +void cmFortran_yyset_out (FILE * _out_str , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yyout = out_str ; + yyout = _out_str ; } int cmFortran_yyget_debug (yyscan_t yyscanner) @@ -2236,10 +2255,10 @@ int cmFortran_yyget_debug (yyscan_t yyscanner) return yy_flex_debug; } -void cmFortran_yyset_debug (int bdebug , yyscan_t yyscanner) +void cmFortran_yyset_debug (int _bdebug , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yy_flex_debug = bdebug ; + yy_flex_debug = _bdebug ; } /* Accessor methods for yylval and yylloc */ @@ -2315,10 +2334,10 @@ static int yy_init_globals (yyscan_t yyscanner) * This function is called from cmFortran_yylex_destroy(), so don't allocate here. */ - yyg->yy_buffer_stack = 0; + yyg->yy_buffer_stack = NULL; yyg->yy_buffer_stack_top = 0; yyg->yy_buffer_stack_max = 0; - yyg->yy_c_buf_p = (char *) 0; + yyg->yy_c_buf_p = NULL; yyg->yy_init = 0; yyg->yy_start = 0; @@ -2331,8 +2350,8 @@ static int yy_init_globals (yyscan_t yyscanner) yyin = stdin; yyout = stdout; #else - yyin = (FILE *) 0; - yyout = (FILE *) 0; + yyin = NULL; + yyout = NULL; #endif /* For future reference: Set errno on error, since we are called by @@ -2347,15 +2366,15 @@ int cmFortran_yylex_destroy (yyscan_t yyscanner) struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* Pop the buffer stack, destroying each element. */ - while(YY_CURRENT_BUFFER){ - cmFortran_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); - YY_CURRENT_BUFFER_LVALUE = NULL; - cmFortran_yypop_buffer_state(yyscanner); - } + while(YY_CURRENT_BUFFER){ + cmFortran_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); + YY_CURRENT_BUFFER_LVALUE = NULL; + cmFortran_yypop_buffer_state(yyscanner); + } - /* Destroy the stack itself. */ - cmFortran_yyfree(yyg->yy_buffer_stack ,yyscanner); - yyg->yy_buffer_stack = NULL; + /* Destroy the stack itself. */ + cmFortran_yyfree(yyg->yy_buffer_stack ,yyscanner); + yyg->yy_buffer_stack = NULL; /* Destroy the start condition stack. */ cmFortran_yyfree(yyg->yy_start_stack ,yyscanner ); @@ -2377,43 +2396,53 @@ int cmFortran_yylex_destroy (yyscan_t yyscanner) #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) { - int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + + int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) { - int n; - for ( n = 0; s[n]; ++n ) - ; + int n; + for ( n = 0; s[n]; ++n ) + ; - return n; + return n; } #endif -void *cmFortran_yyalloc (yy_size_t size , yyscan_t) +void *cmFortran_yyalloc (yy_size_t size , yyscan_t yyscanner) { - return (void *) malloc( size ); + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + return malloc(size); } -void *cmFortran_yyrealloc (void * ptr, yy_size_t size , yyscan_t) +void *cmFortran_yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner) { - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return realloc(ptr, size); } -void cmFortran_yyfree (void * ptr , yyscan_t) +void cmFortran_yyfree (void * ptr , yyscan_t yyscanner) { - free( (char *) ptr ); /* see cmFortran_yyrealloc() for (char *) cast */ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + free( (char *) ptr ); /* see cmFortran_yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" diff --git a/Source/cmFortranLexer.h b/Source/cmFortranLexer.h index b9ff0dc..cb175ec 100644 --- a/Source/cmFortranLexer.h +++ b/Source/cmFortranLexer.h @@ -1,26 +1,19 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2000-2015 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ #ifndef cmFortran_yyHEADER_H #define cmFortran_yyHEADER_H 1 #define cmFortran_yyIN_HEADER 1 +#line 6 "cmFortranLexer.h" + +#line 8 "cmFortranLexer.h" + #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 39 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 1 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -99,25 +92,13 @@ typedef unsigned int flex_uint32_t; #endif /* ! FLEXINT_H */ -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST - -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST +/* TODO: this is always defined, so inline it */ #define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) #else -#define yyconst +#define yynoreturn #endif /* An opaque pointer. */ @@ -163,52 +144,52 @@ typedef size_t yy_size_t; #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - yy_size_t yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + int yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; - int yy_buffer_status; + int yy_buffer_status; - }; + }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ void cmFortran_yyrestart (FILE *input_file ,yyscan_t yyscanner ); @@ -221,7 +202,7 @@ void cmFortran_yypop_buffer_state (yyscan_t yyscanner ); YY_BUFFER_STATE cmFortran_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); YY_BUFFER_STATE cmFortran_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); -YY_BUFFER_STATE cmFortran_yy_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner ); +YY_BUFFER_STATE cmFortran_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); void *cmFortran_yyalloc (yy_size_t ,yyscan_t yyscanner ); void *cmFortran_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); @@ -229,7 +210,7 @@ void cmFortran_yyfree (void * ,yyscan_t yyscanner ); /* Begin user sect3 */ -#define cmFortran_yywrap(yyscanner) 1 +#define cmFortran_yywrap(yyscanner) (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP #define yytext_ptr yytext_r @@ -243,6 +224,14 @@ void cmFortran_yyfree (void * ,yyscan_t yyscanner ); #endif +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include <unistd.h> +#endif + #ifndef YY_EXTRA_TYPE #define YY_EXTRA_TYPE void * #endif @@ -266,23 +255,23 @@ void cmFortran_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); FILE *cmFortran_yyget_in (yyscan_t yyscanner ); -void cmFortran_yyset_in (FILE * in_str ,yyscan_t yyscanner ); +void cmFortran_yyset_in (FILE * _in_str ,yyscan_t yyscanner ); FILE *cmFortran_yyget_out (yyscan_t yyscanner ); -void cmFortran_yyset_out (FILE * out_str ,yyscan_t yyscanner ); +void cmFortran_yyset_out (FILE * _out_str ,yyscan_t yyscanner ); -yy_size_t cmFortran_yyget_leng (yyscan_t yyscanner ); + int cmFortran_yyget_leng (yyscan_t yyscanner ); char *cmFortran_yyget_text (yyscan_t yyscanner ); int cmFortran_yyget_lineno (yyscan_t yyscanner ); -void cmFortran_yyset_lineno (int line_number ,yyscan_t yyscanner ); +void cmFortran_yyset_lineno (int _line_number ,yyscan_t yyscanner ); int cmFortran_yyget_column (yyscan_t yyscanner ); -void cmFortran_yyset_column (int column_no ,yyscan_t yyscanner ); +void cmFortran_yyset_column (int _column_no ,yyscan_t yyscanner ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -348,5 +337,9 @@ extern int cmFortran_yylex (yyscan_t yyscanner); #undef YY_DECL #endif +#line 182 "cmFortranLexer.in.l" + + +#line 344 "cmFortranLexer.h" #undef cmFortran_yyIN_HEADER #endif /* cmFortran_yyHEADER_H */ diff --git a/Source/cmFortranLexer.in.l b/Source/cmFortranLexer.in.l index e59ff5f..6870f7c 100644 --- a/Source/cmFortranLexer.in.l +++ b/Source/cmFortranLexer.in.l @@ -24,28 +24,21 @@ This file must be translated to C and modified to build everywhere. -Run flex like this: +Run flex >= 2.6 like this: flex -i --prefix=cmFortran_yy --header-file=cmFortranLexer.h -ocmFortranLexer.cxx cmFortranLexer.in.l Modify cmFortranLexer.cxx: - - remove TABs - - remove use of the 'register' storage class specifier - - remove "yyscanner" argument from these methods: - yy_fatal_error, cmFortran_yyalloc, cmFortran_yyrealloc, cmFortran_yyfree + - remove trailing whitespace: sed -i 's/\s*$//' cmFortranLexer.h cmFortranLexer.cxx + - remove blank lines at end of file - remove "yyscanner = NULL" from end of cmFortran_yylex_destroy - remove all YY_BREAK lines occurring right after return statements - - change while ( 1 ) to for(;;) - -Modify cmFortranLexer.h: - - remove TABs - - remove the yy_init_globals function - - remove the block that includes unistd.h - - remove #line directives (avoids bogus warning on old Sun) + - add cast in yy_scan_bytes for loop condition of _yybytes_len to size_t */ #include "cmStandardLexer.h" +#undef YY_NO_UNPUT #define cmFortranLexer_cxx #include "cmFortranParser.h" /* Interface to parser object. */ @@ -158,6 +151,12 @@ $[ \t]*endif { return F90PPR_ENDIF; } =|=> { return ASSIGNMENT_OP; } +[Ee][Nn][Dd] { return END; } +[Ii][Nn][Cc][Ll][Uu][Dd][Ee] { return INCLUDE; } +[Ii][Nn][Tt][Ee][Rr][Ff][Aa][Cc][Ee] { return INTERFACE; } +[Mm][Oo][Dd][Uu][Ll][Ee] { return MODULE; } +[Uu][Ss][Ee] { return USE; } + [a-zA-Z_][a-zA-Z_0-9]* { yylvalp->string = strdup(yytext); return WORD; diff --git a/Source/cmFortranParser.cxx b/Source/cmFortranParser.cxx index 21a6443..bf4e7c4 100644 --- a/Source/cmFortranParser.cxx +++ b/Source/cmFortranParser.cxx @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 3.0.2. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -44,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.0.2" +#define YYBISON_VERSION "3.0.4" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -123,12 +123,6 @@ static void cmFortran_yyerror(yyscan_t yyscanner, const char* message) cmFortranParser_Error(parser, message); } -static bool cmFortranParserIsKeyword(const char* word, - const char* keyword) -{ - return cmsysString_strcasecmp(word, keyword) == 0; -} - /* Disable some warnings in the generated code. */ #ifdef _MSC_VER # pragma warning (disable: 4102) /* Unused goto label. */ @@ -139,7 +133,7 @@ static bool cmFortranParserIsKeyword(const char* word, # pragma warning (disable: 4244) /* Conversion to smaller type, data loss. */ #endif -#line 143 "cmFortranParser.cxx" /* yacc.c:339 */ +#line 137 "cmFortranParser.cxx" /* yacc.c:339 */ # ifndef YY_NULLPTR # if defined __cplusplus && 201103L <= __cplusplus @@ -199,11 +193,15 @@ extern int cmFortran_yydebug; F90PPR_ENDIF = 280, COMMA = 281, DCOLON = 282, - CPP_TOENDL = 283, - UNTERMINATED_STRING = 284, - STRING = 285, - WORD = 286, - CPP_INCLUDE_ANGLE = 287 + UNTERMINATED_STRING = 283, + STRING = 284, + WORD = 285, + CPP_INCLUDE_ANGLE = 286, + END = 287, + INCLUDE = 288, + INTERFACE = 289, + MODULE = 290, + USE = 291 }; #endif /* Tokens. */ @@ -232,23 +230,29 @@ extern int cmFortran_yydebug; #define F90PPR_ENDIF 280 #define COMMA 281 #define DCOLON 282 -#define CPP_TOENDL 283 -#define UNTERMINATED_STRING 284 -#define STRING 285 -#define WORD 286 -#define CPP_INCLUDE_ANGLE 287 +#define UNTERMINATED_STRING 283 +#define STRING 284 +#define WORD 285 +#define CPP_INCLUDE_ANGLE 286 +#define END 287 +#define INCLUDE 288 +#define INTERFACE 289 +#define MODULE 290 +#define USE 291 /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE YYSTYPE; + union YYSTYPE { -#line 81 "cmFortranParser.y" /* yacc.c:355 */ +#line 75 "cmFortranParser.y" /* yacc.c:355 */ char* string; -#line 251 "cmFortranParser.cxx" /* yacc.c:355 */ +#line 253 "cmFortranParser.cxx" /* yacc.c:355 */ }; + +typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif @@ -261,7 +265,7 @@ int cmFortran_yyparse (yyscan_t yyscanner); /* Copy the second part of user declarations. */ -#line 265 "cmFortranParser.cxx" /* yacc.c:358 */ +#line 269 "cmFortranParser.cxx" /* yacc.c:358 */ #ifdef short # undef short @@ -503,21 +507,21 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 2 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 290 +#define YYLAST 469 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 33 +#define YYNTOKENS 37 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 16 +#define YYNNTS 14 /* YYNRULES -- Number of rules. */ -#define YYNRULES 54 +#define YYNRULES 57 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 101 +#define YYNSTATES 109 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 287 +#define YYMAXUTOK 291 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -554,19 +558,20 @@ static const yytype_uint8 yytranslate[] = 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32 + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36 }; #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = +static const yytype_uint8 yyrline[] = { - 0, 104, 104, 104, 106, 106, 108, 114, 124, 154, - 165, 178, 189, 196, 203, 210, 216, 222, 228, 234, - 239, 244, 249, 254, 258, 259, 260, 265, 265, 265, - 266, 266, 267, 267, 268, 268, 269, 269, 270, 270, - 271, 271, 272, 272, 273, 273, 274, 274, 277, 278, - 279, 280, 281, 282, 283 + 0, 102, 102, 102, 105, 109, 114, 119, 124, 128, + 133, 141, 146, 151, 156, 161, 166, 171, 176, 181, + 185, 189, 193, 197, 198, 203, 203, 203, 204, 204, + 205, 205, 206, 206, 207, 207, 208, 208, 209, 209, + 210, 210, 211, 211, 212, 212, 215, 216, 217, 218, + 219, 220, 221, 222, 223, 224, 225, 226 }; #endif @@ -580,11 +585,10 @@ static const char *const yytname[] = "F90PPR_DEFINE", "CPP_DEFINE", "F90PPR_UNDEF", "CPP_UNDEF", "CPP_IFDEF", "CPP_IFNDEF", "CPP_IF", "CPP_ELSE", "CPP_ELIF", "CPP_ENDIF", "F90PPR_IFDEF", "F90PPR_IFNDEF", "F90PPR_IF", "F90PPR_ELSE", - "F90PPR_ELIF", "F90PPR_ENDIF", "COMMA", "DCOLON", "CPP_TOENDL", - "UNTERMINATED_STRING", "STRING", "WORD", "CPP_INCLUDE_ANGLE", "$accept", - "code", "stmt", "assignment_stmt", "keyword_stmt", "include", "define", - "undef", "ifdef", "ifndef", "if", "elif", "else", "endif", "other", - "misc_code", YY_NULLPTR + "F90PPR_ELIF", "F90PPR_ENDIF", "COMMA", "DCOLON", "UNTERMINATED_STRING", + "STRING", "WORD", "CPP_INCLUDE_ANGLE", "END", "INCLUDE", "INTERFACE", + "MODULE", "USE", "$accept", "code", "stmt", "include", "define", "undef", + "ifdef", "ifndef", "if", "elif", "else", "endif", "other", "misc_code", YY_NULLPTR }; #endif @@ -596,14 +600,14 @@ static const yytype_uint16 yytoknum[] = 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287 + 285, 286, 287, 288, 289, 290, 291 }; # endif -#define YYPACT_NINF -30 +#define YYPACT_NINF -38 #define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-30))) + (!!((Yystate) == (-38))) #define YYTABLE_NINF -1 @@ -614,17 +618,17 @@ static const yytype_uint16 yytoknum[] = STATE-NUM. */ static const yytype_int16 yypact[] = { - -30, 41, -30, -30, -30, -30, -29, -30, -30, -30, - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -30, -30, 259, -30, -30, -30, - -30, -28, -23, -18, -16, -13, -30, -30, -30, -30, - 2, -30, -30, -30, -30, -12, -9, -30, -30, 64, - -30, -30, -30, -30, -30, 71, 77, 83, 112, -30, - -30, -30, -30, -30, -30, -30, -30, -30, 118, 124, - 130, -24, -30, 159, 165, -30, 171, 177, 206, 212, - 218, -30, -30, -30, -30, -30, -30, -30, -1, 224, - -30, -30, -30, -30, -30, -30, -30, -30, -30, 253, - -30 + -38, 39, -38, 3, -38, -20, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -22, -16, 1, -8, + -6, -38, -4, -7, -3, -2, -1, -38, -38, -38, + -38, -38, -38, 62, -38, -38, -38, -38, -38, 0, + 2, -38, -38, -38, -38, -38, -38, 73, 107, 118, + 152, 163, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, 197, 208, 242, 253, + 6, -38, 287, 298, 332, 343, 377, 388, -38, -38, + -38, -38, -38, -38, -38, -38, -38, 4, 422, -38, + -38, -38, -38, -38, -38, -38, -38, 433, -38 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. @@ -632,31 +636,31 @@ static const yytype_int16 yypact[] = means the default is an error. */ static const yytype_uint8 yydefact[] = { - 2, 0, 1, 26, 25, 46, 0, 27, 28, 29, - 31, 30, 33, 32, 34, 36, 38, 42, 40, 44, - 35, 37, 39, 43, 41, 45, 0, 46, 3, 5, - 4, 0, 0, 0, 0, 0, 46, 46, 46, 46, - 0, 46, 7, 46, 46, 0, 0, 46, 46, 0, - 46, 46, 46, 46, 46, 0, 0, 0, 0, 24, - 51, 50, 53, 52, 54, 49, 48, 47, 0, 0, - 0, 0, 46, 0, 0, 13, 0, 0, 0, 0, - 0, 19, 20, 21, 22, 12, 6, 23, 0, 0, - 11, 8, 14, 15, 16, 17, 18, 46, 9, 0, - 10 + 2, 0, 1, 0, 23, 0, 25, 26, 27, 29, + 28, 31, 30, 32, 34, 36, 40, 38, 42, 33, + 35, 37, 41, 39, 43, 44, 0, 0, 0, 0, + 0, 3, 0, 0, 0, 0, 0, 44, 44, 44, + 44, 24, 44, 0, 44, 44, 4, 44, 44, 0, + 0, 44, 44, 44, 44, 44, 44, 0, 0, 0, + 0, 0, 13, 54, 53, 56, 55, 57, 52, 46, + 47, 48, 49, 50, 51, 45, 0, 0, 0, 0, + 0, 44, 0, 0, 0, 0, 0, 0, 19, 20, + 21, 22, 12, 8, 11, 7, 6, 0, 0, 5, + 14, 15, 16, 17, 18, 44, 9, 0, 10 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -27, -30 + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -37, -38 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { - -1, 1, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 38, 39, 40, 67 + -1, 1, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 43, 75 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If @@ -664,109 +668,143 @@ static const yytype_int8 yydefgoto[] = number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_uint8 yytable[] = { - 49, 41, 50, 88, 0, 59, 60, 61, 51, 55, - 56, 57, 58, 52, 68, 53, 69, 70, 54, 71, - 73, 74, 72, 76, 77, 78, 79, 80, 62, 63, - 97, 64, 65, 66, 0, 0, 0, 0, 0, 0, - 0, 2, 3, 0, 4, 89, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 75, 60, 61, - 99, 0, 26, 27, 81, 60, 61, 0, 0, 0, - 82, 60, 61, 0, 0, 0, 83, 60, 61, 0, - 62, 63, 0, 64, 65, 66, 0, 62, 63, 0, - 64, 65, 66, 62, 63, 0, 64, 65, 66, 62, - 63, 0, 64, 65, 66, 84, 60, 61, 0, 0, - 0, 85, 60, 61, 0, 0, 0, 86, 60, 61, - 0, 0, 0, 87, 60, 61, 0, 0, 62, 63, - 0, 64, 65, 66, 62, 63, 0, 64, 65, 66, - 62, 63, 0, 64, 65, 66, 62, 63, 0, 64, - 65, 66, 90, 60, 61, 0, 0, 0, 91, 60, - 61, 0, 0, 0, 92, 60, 61, 0, 0, 0, - 93, 60, 61, 0, 0, 62, 63, 0, 64, 65, - 66, 62, 63, 0, 64, 65, 66, 62, 63, 0, - 64, 65, 66, 62, 63, 0, 64, 65, 66, 94, - 60, 61, 0, 0, 0, 95, 60, 61, 0, 0, - 0, 96, 60, 61, 0, 0, 0, 98, 60, 61, - 0, 0, 62, 63, 0, 64, 65, 66, 62, 63, - 0, 64, 65, 66, 62, 63, 0, 64, 65, 66, - 62, 63, 0, 64, 65, 66, 100, 60, 61, 0, - 0, 0, 42, 43, 44, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, - 63, 0, 64, 65, 66, 45, 46, 0, 0, 47, - 48 + 57, 58, 59, 60, 46, 61, 41, 76, 77, 42, + 78, 79, 44, 45, 82, 83, 84, 85, 86, 87, + 49, 50, 48, 53, 51, 52, 0, 54, 55, 56, + 80, 47, 81, 97, 105, 0, 0, 0, 0, 2, + 3, 0, 4, 0, 98, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 62, 63, 64, 107, 0, + 25, 26, 27, 28, 29, 30, 88, 63, 64, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 65, 66, + 67, 68, 69, 0, 70, 71, 72, 73, 74, 65, + 66, 67, 68, 69, 0, 70, 71, 72, 73, 74, + 89, 63, 64, 0, 0, 0, 0, 0, 0, 0, + 0, 90, 63, 64, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 65, 66, 67, 68, 69, 0, 70, + 71, 72, 73, 74, 65, 66, 67, 68, 69, 0, + 70, 71, 72, 73, 74, 91, 63, 64, 0, 0, + 0, 0, 0, 0, 0, 0, 92, 63, 64, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 65, 66, + 67, 68, 69, 0, 70, 71, 72, 73, 74, 65, + 66, 67, 68, 69, 0, 70, 71, 72, 73, 74, + 93, 63, 64, 0, 0, 0, 0, 0, 0, 0, + 0, 94, 63, 64, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 65, 66, 67, 68, 69, 0, 70, + 71, 72, 73, 74, 65, 66, 67, 68, 69, 0, + 70, 71, 72, 73, 74, 95, 63, 64, 0, 0, + 0, 0, 0, 0, 0, 0, 96, 63, 64, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 65, 66, + 67, 68, 69, 0, 70, 71, 72, 73, 74, 65, + 66, 67, 68, 69, 0, 70, 71, 72, 73, 74, + 99, 63, 64, 0, 0, 0, 0, 0, 0, 0, + 0, 100, 63, 64, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 65, 66, 67, 68, 69, 0, 70, + 71, 72, 73, 74, 65, 66, 67, 68, 69, 0, + 70, 71, 72, 73, 74, 101, 63, 64, 0, 0, + 0, 0, 0, 0, 0, 0, 102, 63, 64, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 65, 66, + 67, 68, 69, 0, 70, 71, 72, 73, 74, 65, + 66, 67, 68, 69, 0, 70, 71, 72, 73, 74, + 103, 63, 64, 0, 0, 0, 0, 0, 0, 0, + 0, 104, 63, 64, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 65, 66, 67, 68, 69, 0, 70, + 71, 72, 73, 74, 65, 66, 67, 68, 69, 0, + 70, 71, 72, 73, 74, 106, 63, 64, 0, 0, + 0, 0, 0, 0, 0, 0, 108, 63, 64, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 65, 66, + 67, 68, 69, 0, 70, 71, 72, 73, 74, 65, + 66, 67, 68, 69, 0, 70, 71, 72, 73, 74 }; static const yytype_int8 yycheck[] = { - 27, 30, 30, 27, -1, 3, 4, 5, 31, 36, - 37, 38, 39, 31, 41, 31, 43, 44, 31, 31, - 47, 48, 31, 50, 51, 52, 53, 54, 26, 27, - 31, 29, 30, 31, -1, -1, -1, -1, -1, -1, - -1, 0, 1, -1, 3, 72, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 3, 4, 5, - 97, -1, 31, 32, 3, 4, 5, -1, -1, -1, - 3, 4, 5, -1, -1, -1, 3, 4, 5, -1, - 26, 27, -1, 29, 30, 31, -1, 26, 27, -1, - 29, 30, 31, 26, 27, -1, 29, 30, 31, 26, - 27, -1, 29, 30, 31, 3, 4, 5, -1, -1, - -1, 3, 4, 5, -1, -1, -1, 3, 4, 5, - -1, -1, -1, 3, 4, 5, -1, -1, 26, 27, - -1, 29, 30, 31, 26, 27, -1, 29, 30, 31, - 26, 27, -1, 29, 30, 31, 26, 27, -1, 29, - 30, 31, 3, 4, 5, -1, -1, -1, 3, 4, - 5, -1, -1, -1, 3, 4, 5, -1, -1, -1, - 3, 4, 5, -1, -1, 26, 27, -1, 29, 30, - 31, 26, 27, -1, 29, 30, 31, 26, 27, -1, - 29, 30, 31, 26, 27, -1, 29, 30, 31, 3, - 4, 5, -1, -1, -1, 3, 4, 5, -1, -1, - -1, 3, 4, 5, -1, -1, -1, 3, 4, 5, - -1, -1, 26, 27, -1, 29, 30, 31, 26, 27, - -1, 29, 30, 31, 26, 27, -1, 29, 30, 31, - 26, 27, -1, 29, 30, 31, 3, 4, 5, -1, - -1, -1, 3, 4, 5, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 26, - 27, -1, 29, 30, 31, 26, 27, -1, -1, 30, - 31 + 37, 38, 39, 40, 3, 42, 3, 44, 45, 29, + 47, 48, 34, 29, 51, 52, 53, 54, 55, 56, + 26, 27, 30, 30, 30, 29, -1, 30, 30, 30, + 30, 30, 30, 27, 30, -1, -1, -1, -1, 0, + 1, -1, 3, -1, 81, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 3, 4, 5, 105, -1, + 31, 32, 33, 34, 35, 36, 3, 4, 5, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 26, 27, + 28, 29, 30, -1, 32, 33, 34, 35, 36, 26, + 27, 28, 29, 30, -1, 32, 33, 34, 35, 36, + 3, 4, 5, -1, -1, -1, -1, -1, -1, -1, + -1, 3, 4, 5, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 26, 27, 28, 29, 30, -1, 32, + 33, 34, 35, 36, 26, 27, 28, 29, 30, -1, + 32, 33, 34, 35, 36, 3, 4, 5, -1, -1, + -1, -1, -1, -1, -1, -1, 3, 4, 5, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 26, 27, + 28, 29, 30, -1, 32, 33, 34, 35, 36, 26, + 27, 28, 29, 30, -1, 32, 33, 34, 35, 36, + 3, 4, 5, -1, -1, -1, -1, -1, -1, -1, + -1, 3, 4, 5, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 26, 27, 28, 29, 30, -1, 32, + 33, 34, 35, 36, 26, 27, 28, 29, 30, -1, + 32, 33, 34, 35, 36, 3, 4, 5, -1, -1, + -1, -1, -1, -1, -1, -1, 3, 4, 5, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 26, 27, + 28, 29, 30, -1, 32, 33, 34, 35, 36, 26, + 27, 28, 29, 30, -1, 32, 33, 34, 35, 36, + 3, 4, 5, -1, -1, -1, -1, -1, -1, -1, + -1, 3, 4, 5, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 26, 27, 28, 29, 30, -1, 32, + 33, 34, 35, 36, 26, 27, 28, 29, 30, -1, + 32, 33, 34, 35, 36, 3, 4, 5, -1, -1, + -1, -1, -1, -1, -1, -1, 3, 4, 5, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 26, 27, + 28, 29, 30, -1, 32, 33, 34, 35, 36, 26, + 27, 28, 29, 30, -1, 32, 33, 34, 35, 36, + 3, 4, 5, -1, -1, -1, -1, -1, -1, -1, + -1, 3, 4, 5, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 26, 27, 28, 29, 30, -1, 32, + 33, 34, 35, 36, 26, 27, 28, 29, 30, -1, + 32, 33, 34, 35, 36, 3, 4, 5, -1, -1, + -1, -1, -1, -1, -1, -1, 3, 4, 5, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 26, 27, + 28, 29, 30, -1, 32, 33, 34, 35, 36, 26, + 27, 28, 29, 30, -1, 32, 33, 34, 35, 36 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 34, 0, 1, 3, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 31, 32, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 30, 3, 4, 5, 26, 27, 30, 31, 47, - 30, 31, 31, 31, 31, 47, 47, 47, 47, 3, - 4, 5, 26, 27, 29, 30, 31, 48, 47, 47, - 47, 31, 31, 47, 47, 3, 47, 47, 47, 47, - 47, 3, 3, 3, 3, 3, 3, 3, 27, 47, - 3, 3, 3, 3, 3, 3, 3, 31, 3, 47, - 3 + 0, 38, 0, 1, 3, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 31, 32, 33, 34, 35, + 36, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 3, 29, 49, 34, 29, 3, 30, 30, 26, + 27, 30, 29, 30, 30, 30, 30, 49, 49, 49, + 49, 49, 3, 4, 5, 26, 27, 28, 29, 30, + 32, 33, 34, 35, 36, 50, 49, 49, 49, 49, + 30, 30, 49, 49, 49, 49, 49, 49, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 27, 49, 3, + 3, 3, 3, 3, 3, 30, 3, 49, 3 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 33, 34, 34, 35, 35, 36, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 38, 38, 38, - 39, 39, 40, 40, 41, 41, 42, 42, 43, 43, - 44, 44, 45, 45, 46, 46, 47, 47, 48, 48, - 48, 48, 48, 48, 48 + 0, 37, 38, 38, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 40, 40, 40, 41, 41, + 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, + 47, 47, 48, 48, 49, 49, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 50 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { - 0, 2, 0, 2, 1, 1, 4, 2, 4, 5, + 0, 2, 0, 2, 2, 4, 4, 4, 4, 5, 7, 4, 4, 3, 4, 4, 4, 4, 4, 3, - 3, 3, 3, 4, 3, 1, 1, 1, 1, 1, + 3, 3, 3, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 0, 2, 1, 1, - 1, 1, 1, 1, 1 + 1, 1, 1, 1, 0, 2, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1 }; @@ -1448,240 +1486,207 @@ yyreduce: YY_REDUCE_PRINT (yyn); switch (yyn) { - case 6: + case 4: +#line 105 "cmFortranParser.y" /* yacc.c:1646 */ + { + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_SetInInterface(parser, true); + } +#line 1496 "cmFortranParser.cxx" /* yacc.c:1646 */ + break; + + case 5: #line 109 "cmFortranParser.y" /* yacc.c:1646 */ { - free((yyvsp[-3].string)); - } -#line 1457 "cmFortranParser.cxx" /* yacc.c:1646 */ + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleUse(parser, (yyvsp[-2].string)); + free((yyvsp[-2].string)); + } +#line 1506 "cmFortranParser.cxx" /* yacc.c:1646 */ + break; + + case 6: +#line 114 "cmFortranParser.y" /* yacc.c:1646 */ + { + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleModule(parser, (yyvsp[-2].string)); + free((yyvsp[-2].string)); + } +#line 1516 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 7: -#line 115 "cmFortranParser.y" /* yacc.c:1646 */ +#line 119 "cmFortranParser.y" /* yacc.c:1646 */ { - if (cmFortranParserIsKeyword((yyvsp[-1].string), "interface")) - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); - cmFortranParser_SetInInterface(parser, true); - } - free((yyvsp[-1].string)); - } -#line 1471 "cmFortranParser.cxx" /* yacc.c:1646 */ + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_SetInInterface(parser, true); + free((yyvsp[-2].string)); + } +#line 1526 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 8: -#line 125 "cmFortranParser.y" /* yacc.c:1646 */ +#line 124 "cmFortranParser.y" /* yacc.c:1646 */ { - if (cmFortranParserIsKeyword((yyvsp[-3].string), "use")) - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); - cmFortranParser_RuleUse(parser, (yyvsp[-2].string)); - } - else if (cmFortranParserIsKeyword((yyvsp[-3].string), "module")) - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); - cmFortranParser_RuleModule(parser, (yyvsp[-2].string)); - } - else if (cmFortranParserIsKeyword((yyvsp[-3].string), "interface")) - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); - cmFortranParser_SetInInterface(parser, true); - } - else if (cmFortranParserIsKeyword((yyvsp[-2].string), "interface") && - cmFortranParserIsKeyword((yyvsp[-3].string), "end")) - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); - cmFortranParser_SetInInterface(parser, false); - } - free((yyvsp[-3].string)); - free((yyvsp[-2].string)); - } -#line 1505 "cmFortranParser.cxx" /* yacc.c:1646 */ + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_SetInInterface(parser, false); + } +#line 1535 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 9: -#line 155 "cmFortranParser.y" /* yacc.c:1646 */ +#line 128 "cmFortranParser.y" /* yacc.c:1646 */ { - if (cmFortranParserIsKeyword((yyvsp[-4].string), "use")) - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); - cmFortranParser_RuleUse(parser, (yyvsp[-2].string)); - } - free((yyvsp[-4].string)); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleUse(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); - } -#line 1520 "cmFortranParser.cxx" /* yacc.c:1646 */ + } +#line 1545 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 10: -#line 166 "cmFortranParser.y" /* yacc.c:1646 */ +#line 133 "cmFortranParser.y" /* yacc.c:1646 */ { - if (cmFortranParserIsKeyword((yyvsp[-6].string), "use") && - cmFortranParserIsKeyword((yyvsp[-4].string), "non_intrinsic") ) - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); + if (cmsysString_strcasecmp((yyvsp[-4].string), "non_intrinsic") == 0) { + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleUse(parser, (yyvsp[-2].string)); - } - free((yyvsp[-6].string)); + } free((yyvsp[-4].string)); free((yyvsp[-2].string)); - } -#line 1537 "cmFortranParser.cxx" /* yacc.c:1646 */ + } +#line 1558 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 11: -#line 179 "cmFortranParser.y" /* yacc.c:1646 */ +#line 141 "cmFortranParser.y" /* yacc.c:1646 */ { - if (cmFortranParserIsKeyword((yyvsp[-3].string), "include")) - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); - cmFortranParser_RuleInclude(parser, (yyvsp[-2].string)); - } - free((yyvsp[-3].string)); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleInclude(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); - } -#line 1552 "cmFortranParser.cxx" /* yacc.c:1646 */ + } +#line 1568 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 12: -#line 190 "cmFortranParser.y" /* yacc.c:1646 */ +#line 146 "cmFortranParser.y" /* yacc.c:1646 */ { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleLineDirective(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); - } -#line 1563 "cmFortranParser.cxx" /* yacc.c:1646 */ + } +#line 1578 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 13: -#line 197 "cmFortranParser.y" /* yacc.c:1646 */ +#line 151 "cmFortranParser.y" /* yacc.c:1646 */ { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleInclude(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); - } -#line 1574 "cmFortranParser.cxx" /* yacc.c:1646 */ + } +#line 1588 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 14: -#line 204 "cmFortranParser.y" /* yacc.c:1646 */ +#line 156 "cmFortranParser.y" /* yacc.c:1646 */ { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleInclude(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); - } -#line 1585 "cmFortranParser.cxx" /* yacc.c:1646 */ + } +#line 1598 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 15: -#line 211 "cmFortranParser.y" /* yacc.c:1646 */ +#line 161 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleDefine(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); - } -#line 1595 "cmFortranParser.cxx" /* yacc.c:1646 */ + } +#line 1608 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 16: -#line 217 "cmFortranParser.y" /* yacc.c:1646 */ +#line 166 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleUndef(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); - } -#line 1605 "cmFortranParser.cxx" /* yacc.c:1646 */ + } +#line 1618 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 17: -#line 223 "cmFortranParser.y" /* yacc.c:1646 */ +#line 171 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleIfdef(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); - } -#line 1615 "cmFortranParser.cxx" /* yacc.c:1646 */ + } +#line 1628 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 18: -#line 229 "cmFortranParser.y" /* yacc.c:1646 */ +#line 176 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleIfndef(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); - } -#line 1625 "cmFortranParser.cxx" /* yacc.c:1646 */ + } +#line 1638 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 19: -#line 235 "cmFortranParser.y" /* yacc.c:1646 */ +#line 181 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleIf(parser); - } -#line 1634 "cmFortranParser.cxx" /* yacc.c:1646 */ + } +#line 1647 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 20: -#line 240 "cmFortranParser.y" /* yacc.c:1646 */ +#line 185 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleElif(parser); - } -#line 1643 "cmFortranParser.cxx" /* yacc.c:1646 */ + } +#line 1656 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 21: -#line 245 "cmFortranParser.y" /* yacc.c:1646 */ +#line 189 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleElse(parser); - } -#line 1652 "cmFortranParser.cxx" /* yacc.c:1646 */ + } +#line 1665 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 22: -#line 250 "cmFortranParser.y" /* yacc.c:1646 */ +#line 193 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleEndif(parser); - } -#line 1661 "cmFortranParser.cxx" /* yacc.c:1646 */ - break; - - case 23: -#line 255 "cmFortranParser.y" /* yacc.c:1646 */ - { - free((yyvsp[-3].string)); - } -#line 1669 "cmFortranParser.cxx" /* yacc.c:1646 */ + } +#line 1674 "cmFortranParser.cxx" /* yacc.c:1646 */ break; - case 48: -#line 277 "cmFortranParser.y" /* yacc.c:1646 */ + case 46: +#line 215 "cmFortranParser.y" /* yacc.c:1646 */ { free ((yyvsp[0].string)); } -#line 1675 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1680 "cmFortranParser.cxx" /* yacc.c:1646 */ break; - case 49: -#line 278 "cmFortranParser.y" /* yacc.c:1646 */ + case 52: +#line 221 "cmFortranParser.y" /* yacc.c:1646 */ { free ((yyvsp[0].string)); } -#line 1681 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1686 "cmFortranParser.cxx" /* yacc.c:1646 */ break; -#line 1685 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1690 "cmFortranParser.cxx" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1911,6 +1916,6 @@ yyreturn: #endif return yyresult; } -#line 286 "cmFortranParser.y" /* yacc.c:1906 */ +#line 229 "cmFortranParser.y" /* yacc.c:1906 */ /* End of grammar */ diff --git a/Source/cmFortranParser.h b/Source/cmFortranParser.h index 5f1c7ac..2b58375 100644 --- a/Source/cmFortranParser.h +++ b/Source/cmFortranParser.h @@ -73,6 +73,7 @@ union cmFortran_yystype_u #define YYSTYPE cmFortran_yystype #define YYSTYPE_IS_DECLARED 1 #if !defined(cmFortranLexer_cxx) +#define YY_NO_UNISTD_H #include "cmFortranLexer.h" #endif #if !defined(cmFortranLexer_cxx) @@ -117,11 +118,13 @@ struct cmFortranFile : File(file) , Buffer(buffer) , Directory(dir) + , LastCharWasNewline(false) { } FILE* File; YY_BUFFER_STATE Buffer; std::string Directory; + bool LastCharWasNewline; }; struct cmFortranParser_s @@ -146,6 +149,9 @@ struct cmFortranParser_s // Buffer for string literals. std::string TokenString; + // Error message text if a parser error occurs. + std::string Error; + // Flag for whether lexer is reading from inside an interface. bool InInterface; diff --git a/Source/cmFortranParser.y b/Source/cmFortranParser.y index 83f441a..b856a1a 100644 --- a/Source/cmFortranParser.y +++ b/Source/cmFortranParser.y @@ -52,12 +52,6 @@ static void cmFortran_yyerror(yyscan_t yyscanner, const char* message) cmFortranParser_Error(parser, message); } -static bool cmFortranParserIsKeyword(const char* word, - const char* keyword) -{ - return cmsysString_strcasecmp(word, keyword) == 0; -} - /* Disable some warnings in the generated code. */ #ifdef _MSC_VER # pragma warning (disable: 4102) /* Unused goto label. */ @@ -92,10 +86,14 @@ static bool cmFortranParserIsKeyword(const char* word, %token F90PPR_IFDEF F90PPR_IFNDEF F90PPR_IF %token F90PPR_ELSE F90PPR_ELIF F90PPR_ENDIF %token COMMA DCOLON -%token <string> CPP_TOENDL %token <number> UNTERMINATED_STRING %token <string> STRING WORD %token <string> CPP_INCLUDE_ANGLE +%token END +%token INCLUDE +%token INTERFACE +%token MODULE +%token USE /*-------------------------------------------------------------------------*/ /* grammar */ @@ -103,161 +101,101 @@ static bool cmFortranParserIsKeyword(const char* word, code: /* empty */ | code stmt; -stmt: keyword_stmt | assignment_stmt; - -assignment_stmt: WORD ASSIGNMENT_OP other EOSTMT /* Ignore */ - { - free($1); - } - -keyword_stmt: - WORD EOSTMT - { - if (cmFortranParserIsKeyword($1, "interface")) - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); - cmFortranParser_SetInInterface(parser, true); - } - free($1); - } -| WORD WORD other EOSTMT - { - if (cmFortranParserIsKeyword($1, "use")) - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); - cmFortranParser_RuleUse(parser, $2); - } - else if (cmFortranParserIsKeyword($1, "module")) - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); - cmFortranParser_RuleModule(parser, $2); - } - else if (cmFortranParserIsKeyword($1, "interface")) - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); - cmFortranParser_SetInInterface(parser, true); - } - else if (cmFortranParserIsKeyword($2, "interface") && - cmFortranParserIsKeyword($1, "end")) - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); - cmFortranParser_SetInInterface(parser, false); - } - free($1); +stmt: + INTERFACE EOSTMT { + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_SetInInterface(parser, true); + } +| USE WORD other EOSTMT { + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleUse(parser, $2); free($2); - } -| WORD DCOLON WORD other EOSTMT - { - if (cmFortranParserIsKeyword($1, "use")) - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); - cmFortranParser_RuleUse(parser, $3); - } - free($1); + } +| MODULE WORD other EOSTMT { + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleModule(parser, $2); + free($2); + } +| INTERFACE WORD other EOSTMT { + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_SetInInterface(parser, true); + free($2); + } +| END INTERFACE other EOSTMT { + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_SetInInterface(parser, false); + } +| USE DCOLON WORD other EOSTMT { + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleUse(parser, $3); free($3); - } -| WORD COMMA WORD DCOLON WORD other EOSTMT - { - if (cmFortranParserIsKeyword($1, "use") && - cmFortranParserIsKeyword($3, "non_intrinsic") ) - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); + } +| USE COMMA WORD DCOLON WORD other EOSTMT { + if (cmsysString_strcasecmp($3, "non_intrinsic") == 0) { + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleUse(parser, $5); - } - free($1); + } free($3); free($5); - } -| WORD STRING other EOSTMT /* Ignore */ - { - if (cmFortranParserIsKeyword($1, "include")) - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); - cmFortranParser_RuleInclude(parser, $2); - } - free($1); + } +| INCLUDE STRING other EOSTMT { + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleInclude(parser, $2); free($2); - } -| CPP_LINE_DIRECTIVE STRING other EOSTMT - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); + } +| CPP_LINE_DIRECTIVE STRING other EOSTMT { + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleLineDirective(parser, $2); free($2); - } -| CPP_INCLUDE_ANGLE other EOSTMT - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); + } +| CPP_INCLUDE_ANGLE other EOSTMT { + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleInclude(parser, $1); free($1); - } -| include STRING other EOSTMT - { - cmFortranParser* parser = - cmFortran_yyget_extra(yyscanner); + } +| include STRING other EOSTMT { + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleInclude(parser, $2); free($2); - } -| define WORD other EOSTMT - { + } +| define WORD other EOSTMT { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleDefine(parser, $2); free($2); - } -| undef WORD other EOSTMT - { + } +| undef WORD other EOSTMT { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleUndef(parser, $2); free($2); - } -| ifdef WORD other EOSTMT - { + } +| ifdef WORD other EOSTMT { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleIfdef(parser, $2); free($2); - } -| ifndef WORD other EOSTMT - { + } +| ifndef WORD other EOSTMT { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleIfndef(parser, $2); free($2); - } -| if other EOSTMT - { + } +| if other EOSTMT { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleIf(parser); - } -| elif other EOSTMT - { + } +| elif other EOSTMT { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleElif(parser); - } -| else other EOSTMT - { + } +| else other EOSTMT { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleElse(parser); - } -| endif other EOSTMT - { + } +| endif other EOSTMT { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleEndif(parser); - } -| WORD GARBAGE other EOSTMT /* Ignore */ - { - free($1); - } -| GARBAGE other EOSTMT + } | EOSTMT -| error +| error EOSTMT /* tolerate unknown statements until their end */ ; @@ -275,6 +213,11 @@ other: /* empty */ | other misc_code ; misc_code: WORD { free ($1); } +| END +| INCLUDE +| INTERFACE +| MODULE +| USE | STRING { free ($1); } | GARBAGE | ASSIGNMENT_OP diff --git a/Source/cmFortranParserImpl.cxx b/Source/cmFortranParserImpl.cxx index 71edf9f..639b3f0 100644 --- a/Source/cmFortranParserImpl.cxx +++ b/Source/cmFortranParserImpl.cxx @@ -119,8 +119,19 @@ int cmFortranParser_Input(cmFortranParser* parser, char* buffer, // Read from the file on top of the stack. If the stack is empty, // the end of the translation unit has been reached. if (!parser->FileStack.empty()) { - FILE* file = parser->FileStack.top().File; - return (int)fread(buffer, 1, bufferSize, file); + cmFortranFile& ff = parser->FileStack.top(); + FILE* file = ff.File; + size_t n = fread(buffer, 1, bufferSize, file); + if (n > 0) { + ff.LastCharWasNewline = buffer[n - 1] == '\n'; + } else if (!ff.LastCharWasNewline) { + // The file ended without a newline. Inject one so + // that the file always ends in an end-of-statement. + buffer[0] = '\n'; + n = 1; + ff.LastCharWasNewline = true; + } + return (int)n; } return 0; } @@ -164,11 +175,9 @@ int cmFortranParser_GetOldStartcond(cmFortranParser* parser) return parser->OldStartcond; } -void cmFortranParser_Error(cmFortranParser* /*unused*/, const char* /*unused*/) +void cmFortranParser_Error(cmFortranParser* parser, const char* msg) { - // If there is a parser error just ignore it. The source will not - // compile and the user will edit it. Then dependencies will have - // to be regenerated anyway. + parser->Error = msg ? msg : "unknown error"; } void cmFortranParser_RuleUse(cmFortranParser* parser, const char* name) diff --git a/Source/cmFortranParserTokens.h b/Source/cmFortranParserTokens.h index ac49840..e988df4 100644 --- a/Source/cmFortranParserTokens.h +++ b/Source/cmFortranParserTokens.h @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 3.0.2. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -70,11 +70,15 @@ extern int cmFortran_yydebug; F90PPR_ENDIF = 280, COMMA = 281, DCOLON = 282, - CPP_TOENDL = 283, - UNTERMINATED_STRING = 284, - STRING = 285, - WORD = 286, - CPP_INCLUDE_ANGLE = 287 + UNTERMINATED_STRING = 283, + STRING = 284, + WORD = 285, + CPP_INCLUDE_ANGLE = 286, + END = 287, + INCLUDE = 288, + INTERFACE = 289, + MODULE = 290, + USE = 291 }; #endif /* Tokens. */ @@ -103,23 +107,29 @@ extern int cmFortran_yydebug; #define F90PPR_ENDIF 280 #define COMMA 281 #define DCOLON 282 -#define CPP_TOENDL 283 -#define UNTERMINATED_STRING 284 -#define STRING 285 -#define WORD 286 -#define CPP_INCLUDE_ANGLE 287 +#define UNTERMINATED_STRING 283 +#define STRING 284 +#define WORD 285 +#define CPP_INCLUDE_ANGLE 286 +#define END 287 +#define INCLUDE 288 +#define INTERFACE 289 +#define MODULE 290 +#define USE 291 /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE YYSTYPE; + union YYSTYPE { -#line 81 "cmFortranParser.y" /* yacc.c:1909 */ +#line 75 "cmFortranParser.y" /* yacc.c:1909 */ char* string; -#line 122 "cmFortranParserTokens.h" /* yacc.c:1909 */ +#line 130 "cmFortranParserTokens.h" /* yacc.c:1909 */ }; + +typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index f0e4854..40c54db 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -76,7 +76,7 @@ public: }; bool cmFunctionHelperCommand::InvokeInitialPass( - const std::vector<cmListFileArgument>& args, cmExecutionStatus&) + const std::vector<cmListFileArgument>& args, cmExecutionStatus& inStatus) { // Expand the argument list to the function. std::vector<std::string> expandedArgs; @@ -129,11 +129,11 @@ bool cmFunctionHelperCommand::InvokeInitialPass( for (unsigned int c = 0; c < this->Functions.size(); ++c) { cmExecutionStatus status; if (!this->Makefile->ExecuteCommand(this->Functions[c], status) || - (cmSystemTools::GetErrorOccuredFlag() && - !cmSystemTools::GetFatalErrorOccured())) { + status.GetNestedError()) { // The error message should have already included the call stack // so we do not need to report an error here. functionScope.Quiet(); + inStatus.SetNestedError(true); return false; } if (status.GetReturnInvoked()) { diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index ee2907c..4f8c036 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -327,7 +327,6 @@ cmGeneratorTarget::~cmGeneratorTarget() cmDeleteAll(this->CompileDefinitionsEntries); cmDeleteAll(this->SourceEntries); cmDeleteAll(this->LinkInformation); - this->LinkInformation.clear(); } cmLocalGenerator* cmGeneratorTarget::GetLocalGenerator() const @@ -469,9 +468,8 @@ std::string cmGeneratorTarget::GetOutputName(const std::string& config, return i->second; } -void cmGeneratorTarget::AddSource(const std::string& src) +void cmGeneratorTarget::AddSourceCommon(const std::string& src) { - this->Target->AddSource(src); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); cmGeneratorExpression ge(lfbt); CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(src); @@ -481,19 +479,17 @@ void cmGeneratorTarget::AddSource(const std::string& src) this->LinkImplementationLanguageIsContextDependent = true; } +void cmGeneratorTarget::AddSource(const std::string& src) +{ + this->Target->AddSource(src); + this->AddSourceCommon(src); +} + void cmGeneratorTarget::AddTracedSources(std::vector<std::string> const& srcs) { this->Target->AddTracedSources(srcs); if (!srcs.empty()) { - std::string srcFiles = cmJoin(srcs, ";"); - this->SourceFilesMap.clear(); - this->LinkImplementationLanguageIsContextDependent = true; - cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(lfbt); - CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(srcFiles); - cge->SetEvaluateForBuildsystem(true); - this->SourceEntries.push_back( - new cmGeneratorTarget::TargetPropertyEntry(cge)); + this->AddSourceCommon(cmJoin(srcs, ";")); } } @@ -840,14 +836,10 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory( &dagChecker, result, excludeImported); } - std::set<std::string> unique; - for (std::vector<std::string>::iterator li = result.begin(); - li != result.end(); ++li) { - cmSystemTools::ConvertToUnixSlashes(*li); - unique.insert(*li); - } - result.clear(); - result.insert(result.end(), unique.begin(), unique.end()); + std::for_each(result.begin(), result.end(), + cmSystemTools::ConvertToUnixSlashes); + std::sort(result.begin(), result.end()); + result.erase(std::unique(result.begin(), result.end()), result.end()); IncludeCacheType::value_type entry(config_upper, result); iter = this->SystemIncludesCache.insert(entry).first; @@ -1288,11 +1280,11 @@ bool cmGeneratorTarget::HasMacOSXRpathInstallNameDir( if (!this->Makefile->IsSet("CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG")) { std::ostringstream w; - w << "Attempting to use"; + w << "Attempting to use "; if (macosx_rpath) { - w << " MACOSX_RPATH"; + w << "MACOSX_RPATH"; } else { - w << " @rpath"; + w << "@rpath"; } w << " without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being set."; w << " This could be because you are using a Mac OS X version"; diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 173f15d..715220e 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -540,6 +540,8 @@ public: std::string GetFortranModuleDirectory() const; private: + void AddSourceCommon(const std::string& src); + std::string CreateFortranModuleDirectory() const; mutable bool FortranModuleDirectoryCreated; mutable std::string FortranModuleDirectory; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index ef8266f..e85d80e 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1068,8 +1068,8 @@ void cmGlobalGenerator::Configure() cmTargets* targets = &(mf->GetTargets()); cmTargets::iterator tit; for (tit = globalTargets.begin(); tit != globalTargets.end(); ++tit) { - (*targets)[tit->first] = tit->second; - (*targets)[tit->first].SetMakefile(mf); + targets->insert( + cmTargets::value_type(tit->first, tit->second.CopyForDirectory(mf))); } } @@ -2101,9 +2101,12 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) } } if (cmSystemTools::FileExists(configFile.c_str())) { - (*targets)[this->GetPackageTargetName()] = this->CreateGlobalTarget( - this->GetPackageTargetName(), "Run CPack packaging tool...", - &cpackCommandLines, depends, workingDir.c_str(), /*uses_terminal*/ true); + targets->insert(cmTargets::value_type( + this->GetPackageTargetName(), + this->CreateGlobalTarget(this->GetPackageTargetName(), + "Run CPack packaging tool...", + &cpackCommandLines, depends, workingDir.c_str(), + /*uses_terminal*/ true))); } // CPack source const char* packageSourceTargetName = this->GetPackageSourceTargetName(); @@ -2122,10 +2125,12 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) if (cmSystemTools::FileExists(configFile.c_str())) { singleLine.push_back(configFile); cpackCommandLines.push_back(singleLine); - (*targets)[packageSourceTargetName] = this->CreateGlobalTarget( - packageSourceTargetName, "Run CPack packaging tool for source...", - &cpackCommandLines, depends, workingDir.c_str(), - /*uses_terminal*/ true); + targets->insert(cmTargets::value_type( + packageSourceTargetName, + this->CreateGlobalTarget( + packageSourceTargetName, "Run CPack packaging tool for source...", + &cpackCommandLines, depends, workingDir.c_str(), + /*uses_terminal*/ true))); } } @@ -2146,10 +2151,11 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) singleLine.push_back("$(ARGS)"); } cpackCommandLines.push_back(singleLine); - (*targets)[this->GetTestTargetName()] = + targets->insert(cmTargets::value_type( + this->GetTestTargetName(), this->CreateGlobalTarget(this->GetTestTargetName(), "Running tests...", &cpackCommandLines, depends, CM_NULLPTR, - /*uses_terminal*/ true); + /*uses_terminal*/ true))); } // Edit Cache @@ -2167,18 +2173,22 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) singleLine.push_back("-H$(CMAKE_SOURCE_DIR)"); singleLine.push_back("-B$(CMAKE_BINARY_DIR)"); cpackCommandLines.push_back(singleLine); - (*targets)[editCacheTargetName] = this->CreateGlobalTarget( - editCacheTargetName, "Running CMake cache editor...", - &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ true); + targets->insert(cmTargets::value_type( + editCacheTargetName, + this->CreateGlobalTarget( + editCacheTargetName, "Running CMake cache editor...", + &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ true))); } else { singleLine.push_back(cmSystemTools::GetCMakeCommand()); singleLine.push_back("-E"); singleLine.push_back("echo"); singleLine.push_back("No interactive CMake dialog available."); cpackCommandLines.push_back(singleLine); - (*targets)[editCacheTargetName] = this->CreateGlobalTarget( - editCacheTargetName, "No interactive CMake dialog available...", - &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ false); + targets->insert(cmTargets::value_type( + editCacheTargetName, + this->CreateGlobalTarget( + editCacheTargetName, "No interactive CMake dialog available...", + &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ false))); } } @@ -2193,9 +2203,11 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) singleLine.push_back("-H$(CMAKE_SOURCE_DIR)"); singleLine.push_back("-B$(CMAKE_BINARY_DIR)"); cpackCommandLines.push_back(singleLine); - (*targets)[rebuildCacheTargetName] = this->CreateGlobalTarget( - rebuildCacheTargetName, "Running CMake to regenerate build system...", - &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ true); + targets->insert(cmTargets::value_type( + rebuildCacheTargetName, + this->CreateGlobalTarget( + rebuildCacheTargetName, "Running CMake to regenerate build system...", + &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ true))); } // Install @@ -2219,9 +2231,11 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) ostr << "Only default component available"; } singleLine.push_back(ostr.str()); - (*targets)["list_install_components"] = this->CreateGlobalTarget( - "list_install_components", ostr.str().c_str(), &cpackCommandLines, - depends, CM_NULLPTR, /*uses_terminal*/ false); + targets->insert(cmTargets::value_type( + "list_install_components", + this->CreateGlobalTarget("list_install_components", ostr.str().c_str(), + &cpackCommandLines, depends, CM_NULLPTR, + /*uses_terminal*/ false))); } std::string cmd = cmSystemTools::GetCMakeCommand(); cpackCommandLines.erase(cpackCommandLines.begin(), @@ -2260,9 +2274,11 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) singleLine.push_back("-P"); singleLine.push_back("cmake_install.cmake"); cpackCommandLines.push_back(singleLine); - (*targets)[this->GetInstallTargetName()] = this->CreateGlobalTarget( - this->GetInstallTargetName(), "Install the project...", - &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ true); + targets->insert(cmTargets::value_type( + this->GetInstallTargetName(), + this->CreateGlobalTarget(this->GetInstallTargetName(), + "Install the project...", &cpackCommandLines, + depends, CM_NULLPTR, /*uses_terminal*/ true))); // install_local if (const char* install_local = this->GetInstallLocalTargetName()) { @@ -2274,9 +2290,11 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) cpackCommandLines.end()); cpackCommandLines.push_back(localCmdLine); - (*targets)[install_local] = this->CreateGlobalTarget( - install_local, "Installing only the local directory...", - &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ true); + targets->insert(cmTargets::value_type( + install_local, + this->CreateGlobalTarget( + install_local, "Installing only the local directory...", + &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ true))); } // install_strip @@ -2290,9 +2308,11 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) cpackCommandLines.end()); cpackCommandLines.push_back(stripCmdLine); - (*targets)[install_strip] = this->CreateGlobalTarget( - install_strip, "Installing the project stripped...", - &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ true); + targets->insert(cmTargets::value_type( + install_strip, + this->CreateGlobalTarget( + install_strip, "Installing the project stripped...", + &cpackCommandLines, depends, CM_NULLPTR, /*uses_terminal*/ true))); } } } @@ -2332,8 +2352,8 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget( const char* workingDirectory, bool uses_terminal) { // Package - cmTarget target; - target.SetType(cmState::GLOBAL_TARGET, name); + cmTarget target(name, cmState::GLOBAL_TARGET, cmTarget::VisibilityNormal, + CM_NULLPTR); target.SetProperty("EXCLUDE_FROM_ALL", "TRUE"); std::vector<std::string> no_outputs; diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 819feb1..ac9c8ef 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -350,16 +350,36 @@ std::string const& cmGlobalVisualStudio10Generator::GetMSBuildCommand() std::string cmGlobalVisualStudio10Generator::FindMSBuildCommand() { std::string msbuild; - std::string mskey = - "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\"; + std::string mskey; + + // Search in standard location. + mskey = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\"; mskey += this->GetToolsVersion(); mskey += ";MSBuildToolsPath"; if (cmSystemTools::ReadRegistryValue(mskey.c_str(), msbuild, cmSystemTools::KeyWOW64_32)) { cmSystemTools::ConvertToUnixSlashes(msbuild); - msbuild += "/"; + msbuild += "/MSBuild.exe"; + if (cmSystemTools::FileExists(msbuild, true)) { + return msbuild; + } + } + + // Search where VS15Preview places it. + mskey = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7;"; + mskey += this->GetIDEVersion(); + if (cmSystemTools::ReadRegistryValue(mskey.c_str(), msbuild, + cmSystemTools::KeyWOW64_32)) { + cmSystemTools::ConvertToUnixSlashes(msbuild); + msbuild += "/MSBuild/"; + msbuild += this->GetIDEVersion(); + msbuild += "/Bin/MSBuild.exe"; + if (cmSystemTools::FileExists(msbuild, true)) { + return msbuild; + } } - msbuild += "MSBuild.exe"; + + msbuild = "MSBuild.exe"; return msbuild; } @@ -462,6 +482,10 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand( bool cmGlobalVisualStudio10Generator::Find64BitTools(cmMakefile* mf) { + if (this->DefaultPlatformToolset == "v100") { + // The v100 64-bit toolset does not exist in the express edition. + this->DefaultPlatformToolset.clear(); + } if (this->GetPlatformToolset()) { return true; } diff --git a/Source/cmGlobalVisualStudio15Generator.cxx b/Source/cmGlobalVisualStudio15Generator.cxx new file mode 100644 index 0000000..98076c3 --- /dev/null +++ b/Source/cmGlobalVisualStudio15Generator.cxx @@ -0,0 +1,151 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2016 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmGlobalVisualStudio15Generator.h" + +#include "cmAlgorithms.h" +#include "cmLocalVisualStudio10Generator.h" +#include "cmMakefile.h" + +static const char vs15generatorName[] = "Visual Studio 15"; + +// Map generator name without year to name with year. +static const char* cmVS15GenName(const std::string& name, std::string& genName) +{ + if (strncmp(name.c_str(), vs15generatorName, + sizeof(vs15generatorName) - 1) != 0) { + return 0; + } + const char* p = name.c_str() + sizeof(vs15generatorName) - 1; + genName = std::string(vs15generatorName) + p; + return p; +} + +class cmGlobalVisualStudio15Generator::Factory + : public cmGlobalGeneratorFactory +{ +public: + virtual cmGlobalGenerator* CreateGlobalGenerator(const std::string& name, + cmake* cm) const + { + std::string genName; + const char* p = cmVS15GenName(name, genName); + if (!p) { + return 0; + } + if (!*p) { + return new cmGlobalVisualStudio15Generator(cm, genName, ""); + } + if (*p++ != ' ') { + return 0; + } + if (strcmp(p, "Win64") == 0) { + return new cmGlobalVisualStudio15Generator(cm, genName, "x64"); + } + if (strcmp(p, "ARM") == 0) { + return new cmGlobalVisualStudio15Generator(cm, genName, "ARM"); + } + return 0; + } + + virtual void GetDocumentation(cmDocumentationEntry& entry) const + { + entry.Name = std::string(vs15generatorName) + " [arch]"; + entry.Brief = "Generates Visual Studio 15 project files. " + "Optional [arch] can be \"Win64\" or \"ARM\"."; + } + + virtual void GetGenerators(std::vector<std::string>& names) const + { + names.push_back(vs15generatorName); + names.push_back(vs15generatorName + std::string(" ARM")); + names.push_back(vs15generatorName + std::string(" Win64")); + } + + bool SupportsToolset() const CM_OVERRIDE { return true; } + bool SupportsPlatform() const CM_OVERRIDE { return true; } +}; + +cmGlobalGeneratorFactory* cmGlobalVisualStudio15Generator::NewFactory() +{ + return new Factory; +} + +cmGlobalVisualStudio15Generator::cmGlobalVisualStudio15Generator( + cmake* cm, const std::string& name, const std::string& platformName) + : cmGlobalVisualStudio14Generator(cm, name, platformName) +{ + std::string vc15Express; + this->ExpressEdition = cmSystemTools::ReadRegistryValue( + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\15.0\\Setup\\VC;" + "ProductDir", + vc15Express, cmSystemTools::KeyWOW64_32); + this->DefaultPlatformToolset = "v140"; + this->Version = VS15; +} + +bool cmGlobalVisualStudio15Generator::MatchesGeneratorName( + const std::string& name) const +{ + std::string genName; + if (cmVS15GenName(name, genName)) { + return genName == this->GetName(); + } + return false; +} + +void cmGlobalVisualStudio15Generator::WriteSLNHeader(std::ostream& fout) +{ + // Visual Studio 15 writes .sln format 12.00 + fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; + if (this->ExpressEdition) { + fout << "# Visual Studio Express 15 for Windows Desktop\n"; + } else { + fout << "# Visual Studio 15\n"; + } +} + +bool cmGlobalVisualStudio15Generator::SelectWindowsStoreToolset( + std::string& toolset) const +{ + if (cmHasLiteralPrefix(this->SystemVersion, "10.0")) { + if (this->IsWindowsStoreToolsetInstalled() && + this->IsWindowsDesktopToolsetInstalled()) { + toolset = "v140"; // VS 15 uses v140 toolset + return true; + } else { + return false; + } + } + return this->cmGlobalVisualStudio14Generator::SelectWindowsStoreToolset( + toolset); +} + +bool cmGlobalVisualStudio15Generator::IsWindowsDesktopToolsetInstalled() const +{ + const char desktop10Key[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\" + "VisualStudio\\15.0\\VC\\Runtimes"; + + std::vector<std::string> vc15; + return cmSystemTools::GetRegistrySubKeys(desktop10Key, vc15, + cmSystemTools::KeyWOW64_32); +} + +bool cmGlobalVisualStudio15Generator::IsWindowsStoreToolsetInstalled() const +{ + const char universal10Key[] = + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\" + "VisualStudio\\15.0\\Setup\\Build Tools for Windows 10;SrcPath"; + + std::string win10SDK; + return cmSystemTools::ReadRegistryValue(universal10Key, win10SDK, + cmSystemTools::KeyWOW64_32); +} diff --git a/Source/cmGlobalVisualStudio15Generator.h b/Source/cmGlobalVisualStudio15Generator.h new file mode 100644 index 0000000..f673883 --- /dev/null +++ b/Source/cmGlobalVisualStudio15Generator.h @@ -0,0 +1,46 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2016 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmGlobalVisualStudio15Generator_h +#define cmGlobalVisualStudio15Generator_h + +#include "cmGlobalVisualStudio14Generator.h" + +/** \class cmGlobalVisualStudio15Generator */ +class cmGlobalVisualStudio15Generator : public cmGlobalVisualStudio14Generator +{ +public: + cmGlobalVisualStudio15Generator(cmake* cm, const std::string& name, + const std::string& platformName); + static cmGlobalGeneratorFactory* NewFactory(); + + virtual bool MatchesGeneratorName(const std::string& name) const; + + virtual void WriteSLNHeader(std::ostream& fout); + + virtual const char* GetToolsVersion() { return "15.0"; } +protected: + virtual bool SelectWindowsStoreToolset(std::string& toolset) const; + + virtual const char* GetIDEVersion() { return "15.0"; } + + // Used to verify that the Desktop toolset for the current generator is + // installed on the machine. + virtual bool IsWindowsDesktopToolsetInstalled() const; + + // These aren't virtual because we need to check if the selected version + // of the toolset is installed + bool IsWindowsStoreToolsetInstalled() const; + +private: + class Factory; +}; +#endif diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 08be304..0dc4497 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -150,13 +150,32 @@ std::string const& cmGlobalVisualStudio7Generator::GetDevEnvCommand() std::string cmGlobalVisualStudio7Generator::FindDevEnvCommand() { std::string vscmd; - std::string vskey = this->GetRegistryBase() + ";InstallDir"; + std::string vskey; + + // Search in standard location. + vskey = this->GetRegistryBase() + ";InstallDir"; if (cmSystemTools::ReadRegistryValue(vskey.c_str(), vscmd, cmSystemTools::KeyWOW64_32)) { cmSystemTools::ConvertToUnixSlashes(vscmd); - vscmd += "/"; + vscmd += "/devenv.com"; + if (cmSystemTools::FileExists(vscmd, true)) { + return vscmd; + } } - vscmd += "devenv.com"; + + // Search where VS15Preview places it. + vskey = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7;"; + vskey += this->GetIDEVersion(); + if (cmSystemTools::ReadRegistryValue(vskey.c_str(), vscmd, + cmSystemTools::KeyWOW64_32)) { + cmSystemTools::ConvertToUnixSlashes(vscmd); + vscmd += "/Common7/IDE/devenv.com"; + if (cmSystemTools::FileExists(vscmd, true)) { + return vscmd; + } + } + + vscmd = "devenv.com"; return vscmd; } diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index 1d456ff..3312ed6 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -34,7 +34,8 @@ public: VS11 = 110, VS12 = 120, /* VS13 = 130 was skipped */ - VS14 = 140 + VS14 = 140, + VS15 = 150 }; cmGlobalVisualStudioGenerator(cmake* cm); diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 4912eac..e464bce 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -83,6 +83,8 @@ bool cmInstallCommand::InitialPass(std::vector<std::string> const& args, return this->HandleDirectoryMode(args); } else if (args[0] == "EXPORT") { return this->HandleExportMode(args); + } else if (args[0] == "EXPORT_ANDROID_MK") { + return this->HandleExportAndroidMKMode(args); } // Unknown mode. @@ -1097,6 +1099,100 @@ bool cmInstallCommand::HandleDirectoryMode( return true; } +bool cmInstallCommand::HandleExportAndroidMKMode( + std::vector<std::string> const& args) +{ +#ifdef CMAKE_BUILD_WITH_CMAKE + // This is the EXPORT mode. + cmInstallCommandArguments ica(this->DefaultComponentName); + cmCAString exp(&ica.Parser, "EXPORT_ANDROID_MK"); + cmCAString name_space(&ica.Parser, "NAMESPACE", &ica.ArgumentGroup); + cmCAEnabler exportOld(&ica.Parser, "EXPORT_LINK_INTERFACE_LIBRARIES", + &ica.ArgumentGroup); + cmCAString filename(&ica.Parser, "FILE", &ica.ArgumentGroup); + exp.Follows(0); + + ica.ArgumentGroup.Follows(&exp); + std::vector<std::string> unknownArgs; + ica.Parse(&args, &unknownArgs); + + if (!unknownArgs.empty()) { + // Unknown argument. + std::ostringstream e; + e << args[0] << " given unknown argument \"" << unknownArgs[0] << "\"."; + this->SetError(e.str()); + return false; + } + + if (!ica.Finalize()) { + return false; + } + + // Make sure there is a destination. + if (ica.GetDestination().empty()) { + // A destination is required. + std::ostringstream e; + e << args[0] << " given no DESTINATION!"; + this->SetError(e.str()); + return false; + } + + // Check the file name. + std::string fname = filename.GetString(); + if (fname.find_first_of(":/\\") != fname.npos) { + std::ostringstream e; + e << args[0] << " given invalid export file name \"" << fname << "\". " + << "The FILE argument may not contain a path. " + << "Specify the path in the DESTINATION argument."; + this->SetError(e.str()); + return false; + } + + // Check the file extension. + if (!fname.empty() && + cmSystemTools::GetFilenameLastExtension(fname) != ".mk") { + std::ostringstream e; + e << args[0] << " given invalid export file name \"" << fname << "\". " + << "The FILE argument must specify a name ending in \".mk\"."; + this->SetError(e.str()); + return false; + } + if (fname.find_first_of(":/\\") != fname.npos) { + std::ostringstream e; + e << args[0] << " given export name \"" << exp.GetString() << "\". " + << "This name cannot be safely converted to a file name. " + << "Specify a different export name or use the FILE option to set " + << "a file name explicitly."; + this->SetError(e.str()); + return false; + } + // Use the default name + if (fname.empty()) { + fname = "Android.mk"; + } + + cmExportSet* exportSet = + this->Makefile->GetGlobalGenerator()->GetExportSets()[exp.GetString()]; + + cmInstallGenerator::MessageLevel message = + cmInstallGenerator::SelectMessageLevel(this->Makefile); + + // Create the export install generator. + cmInstallExportGenerator* exportGenerator = new cmInstallExportGenerator( + exportSet, ica.GetDestination().c_str(), ica.GetPermissions().c_str(), + ica.GetConfigurations(), ica.GetComponent().c_str(), message, + ica.GetExcludeFromAll(), fname.c_str(), name_space.GetCString(), + exportOld.IsEnabled(), true); + this->Makefile->AddInstallGenerator(exportGenerator); + + return true; +#else + static_cast<void>(args); + this->SetError("EXPORT_ANDROID_MK not supported in bootstrap cmake"); + return false; +#endif +} + bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args) { // This is the EXPORT mode. @@ -1203,7 +1299,7 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args) exportSet, ica.GetDestination().c_str(), ica.GetPermissions().c_str(), ica.GetConfigurations(), ica.GetComponent().c_str(), message, ica.GetExcludeFromAll(), fname.c_str(), name_space.GetCString(), - exportOld.IsEnabled()); + exportOld.IsEnabled(), false); this->Makefile->AddInstallGenerator(exportGenerator); return true; diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h index 3718ad5..7bc974c 100644 --- a/Source/cmInstallCommand.h +++ b/Source/cmInstallCommand.h @@ -48,6 +48,7 @@ private: bool HandleFilesMode(std::vector<std::string> const& args); bool HandleDirectoryMode(std::vector<std::string> const& args); bool HandleExportMode(std::vector<std::string> const& args); + bool HandleExportAndroidMKMode(std::vector<std::string> const& args); bool MakeFilesFullPath(const char* modeName, const std::vector<std::string>& relFiles, std::vector<std::string>& absFiles); diff --git a/Source/cmInstallExportAndroidMKGenerator.cxx b/Source/cmInstallExportAndroidMKGenerator.cxx new file mode 100644 index 0000000..43bdc01 --- /dev/null +++ b/Source/cmInstallExportAndroidMKGenerator.cxx @@ -0,0 +1,149 @@ + +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmInstallExportAndroidMKGenerator.h" + +#include <stdio.h> + +#include "cmExportInstallFileGenerator.h" +#include "cmExportSet.h" +#include "cmGeneratedFileStream.h" +#include "cmGlobalGenerator.h" +#include "cmInstallFilesGenerator.h" +#include "cmInstallTargetGenerator.h" +#include "cmLocalGenerator.h" +#include "cmMakefile.h" +#include "cmake.h" + +cmInstallExportAndroidMKGenerator::cmInstallExportAndroidMKGenerator( + cmExportSet* exportSet, const char* destination, + const char* file_permissions, std::vector<std::string> const& configurations, + const char* component, MessageLevel message, bool exclude_from_all, + const char* filename, const char* name_space, bool exportOld) + : cmInstallExportGenerator(exportSet, destination, file_permissions, + configurations, component, message, + exclude_from_all, filename, name_space, exportOld) +{ +} + +cmInstallExportAndroidMKGenerator::~cmInstallExportAndroidMKGenerator() +{ +} + +void cmInstallExportAndroidMKGenerator::Compute(cmLocalGenerator* lg) +{ + this->LocalGenerator = lg; + this->ExportSet->Compute(lg); +} + +void cmInstallExportAndroidMKGenerator::GenerateScript(std::ostream& os) +{ + // Skip empty sets. + if (ExportSet->GetTargetExports()->empty()) { + std::ostringstream e; + e << "INSTALL(EXPORT) given unknown export \"" << ExportSet->GetName() + << "\""; + cmSystemTools::Error(e.str().c_str()); + return; + } + + // Create the temporary directory in which to store the files. + this->ComputeTempDir(); + cmSystemTools::MakeDirectory(this->TempDir.c_str()); + + // Construct a temporary location for the file. + this->MainImportFile = this->TempDir; + this->MainImportFile += "/"; + this->MainImportFile += this->FileName; + + // Generate the import file for this export set. + this->EFGen->SetExportFile(this->MainImportFile.c_str()); + this->EFGen->SetNamespace(this->Namespace); + this->EFGen->SetExportOld(this->ExportOld); + if (this->ConfigurationTypes->empty()) { + if (!this->ConfigurationName.empty()) { + this->EFGen->AddConfiguration(this->ConfigurationName); + } else { + this->EFGen->AddConfiguration(""); + } + } else { + for (std::vector<std::string>::const_iterator ci = + this->ConfigurationTypes->begin(); + ci != this->ConfigurationTypes->end(); ++ci) { + this->EFGen->AddConfiguration(*ci); + } + } + this->EFGen->GenerateImportFile(); + + // Perform the main install script generation. + this->cmInstallGenerator::GenerateScript(os); +} + +void cmInstallExportAndroidMKGenerator::GenerateScriptConfigs( + std::ostream& os, Indent const& indent) +{ + // Create the main install rules first. + this->cmInstallGenerator::GenerateScriptConfigs(os, indent); + + // Now create a configuration-specific install rule for the import + // file of each configuration. + std::vector<std::string> files; + for (std::map<std::string, std::string>::const_iterator i = + this->EFGen->GetConfigImportFiles().begin(); + i != this->EFGen->GetConfigImportFiles().end(); ++i) { + files.push_back(i->second); + std::string config_test = this->CreateConfigTest(i->first); + os << indent << "if(" << config_test << ")\n"; + this->AddInstallRule(os, this->Destination, cmInstallType_FILES, files, + false, this->FilePermissions.c_str(), CM_NULLPTR, + CM_NULLPTR, CM_NULLPTR, indent.Next()); + os << indent << "endif()\n"; + files.clear(); + } +} + +void cmInstallExportAndroidMKGenerator::GenerateScriptActions( + std::ostream& os, Indent const& indent) +{ + // Remove old per-configuration export files if the main changes. + std::string installedDir = "$ENV{DESTDIR}"; + installedDir += this->ConvertToAbsoluteDestination(this->Destination); + installedDir += "/"; + std::string installedFile = installedDir; + installedFile += this->FileName; + os << indent << "if(EXISTS \"" << installedFile << "\")\n"; + Indent indentN = indent.Next(); + Indent indentNN = indentN.Next(); + Indent indentNNN = indentNN.Next(); + /* clang-format off */ + os << indentN << "file(DIFFERENT EXPORT_FILE_CHANGED FILES\n" + << indentN << " \"" << installedFile << "\"\n" + << indentN << " \"" << this->MainImportFile << "\")\n"; + os << indentN << "if(EXPORT_FILE_CHANGED)\n"; + os << indentNN << "file(GLOB OLD_CONFIG_FILES \"" << installedDir + << this->EFGen->GetConfigImportFileGlob() << "\")\n"; + os << indentNN << "if(OLD_CONFIG_FILES)\n"; + os << indentNNN << "message(STATUS \"Old export file \\\"" << installedFile + << "\\\" will be replaced. Removing files [${OLD_CONFIG_FILES}].\")\n"; + os << indentNNN << "file(REMOVE ${OLD_CONFIG_FILES})\n"; + os << indentNN << "endif()\n"; + os << indentN << "endif()\n"; + os << indent << "endif()\n"; + /* clang-format on */ + + // Install the main export file. + std::vector<std::string> files; + files.push_back(this->MainImportFile); + this->AddInstallRule(os, this->Destination, cmInstallType_FILES, files, + false, this->FilePermissions.c_str(), CM_NULLPTR, + CM_NULLPTR, CM_NULLPTR, indent); +} diff --git a/Source/cmInstallExportAndroidMKGenerator.h b/Source/cmInstallExportAndroidMKGenerator.h new file mode 100644 index 0000000..158972d --- /dev/null +++ b/Source/cmInstallExportAndroidMKGenerator.h @@ -0,0 +1,46 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmInstallExportAndroidMKGenerator_h +#define cmInstallExportAndroidMKGenerator_h + +#include "cmInstallExportGenerator.h" + +class cmExportInstallFileGenerator; +class cmInstallFilesGenerator; +class cmInstallTargetGenerator; +class cmExportSet; +class cmMakefile; + +/** \class cmInstallExportAndroidMKGenerator + * \brief Generate rules for creating an export files. + */ +class cmInstallExportAndroidMKGenerator : public cmInstallExportGenerator +{ +public: + cmInstallExportAndroidMKGenerator( + cmExportSet* exportSet, const char* dest, const char* file_permissions, + const std::vector<std::string>& configurations, const char* component, + MessageLevel message, bool exclude_from_all, const char* filename, + const char* name_space, bool exportOld); + ~cmInstallExportAndroidMKGenerator(); + + void Compute(cmLocalGenerator* lg); + +protected: + virtual void GenerateScript(std::ostream& os); + virtual void GenerateScriptConfigs(std::ostream& os, Indent const& indent); + virtual void GenerateScriptActions(std::ostream& os, Indent const& indent); + void GenerateImportFile(cmExportSet const* exportSet); + void GenerateImportFile(const char* config, cmExportSet const* exportSet); +}; + +#endif diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index 27628f4..5ea7faf 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -16,6 +16,9 @@ #include <sstream> #include <utility> +#ifdef CMAKE_BUILD_WITH_CMAKE +#include "cmExportInstallAndroidMKGenerator.h" +#endif #include "cmExportInstallFileGenerator.h" #include "cmExportSet.h" #include "cmInstallType.h" @@ -27,7 +30,7 @@ cmInstallExportGenerator::cmInstallExportGenerator( cmExportSet* exportSet, const char* destination, const char* file_permissions, std::vector<std::string> const& configurations, const char* component, MessageLevel message, bool exclude_from_all, - const char* filename, const char* name_space, bool exportOld) + const char* filename, const char* name_space, bool exportOld, bool android) : cmInstallGenerator(destination, configurations, component, message, exclude_from_all) , ExportSet(exportSet) @@ -37,7 +40,13 @@ cmInstallExportGenerator::cmInstallExportGenerator( , ExportOld(exportOld) , LocalGenerator(CM_NULLPTR) { - this->EFGen = new cmExportInstallFileGenerator(this); + if (android) { +#ifdef CMAKE_BUILD_WITH_CMAKE + this->EFGen = new cmExportInstallAndroidMKGenerator(this); +#endif + } else { + this->EFGen = new cmExportInstallFileGenerator(this); + } exportSet->AddInstallation(this); } diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h index 5539827..ac02386 100644 --- a/Source/cmInstallExportGenerator.h +++ b/Source/cmInstallExportGenerator.h @@ -37,7 +37,8 @@ public: const std::vector<std::string>& configurations, const char* component, MessageLevel message, bool exclude_from_all, const char* filename, - const char* name_space, bool exportOld); + const char* name_space, bool exportOld, + bool android); ~cmInstallExportGenerator() CM_OVERRIDE; cmExportSet* GetExportSet() { return this->ExportSet; } diff --git a/Source/cmInstallTargetsCommand.cxx b/Source/cmInstallTargetsCommand.cxx index 056ea24..6b594b6 100644 --- a/Source/cmInstallTargetsCommand.cxx +++ b/Source/cmInstallTargetsCommand.cxx @@ -37,14 +37,17 @@ bool cmInstallTargetsCommand::InitialPass(std::vector<std::string> const& args, } runtime_dir = *s; - } else if (tgts.find(*s) != tgts.end()) { - tgts[*s].SetInstallPath(args[0].c_str()); - tgts[*s].SetRuntimeInstallPath(runtime_dir.c_str()); - tgts[*s].SetHaveInstallRule(true); } else { - std::string str = "Cannot find target: \"" + *s + "\" to install."; - this->SetError(str); - return false; + cmTargets::iterator ti = tgts.find(*s); + if (ti != tgts.end()) { + ti->second.SetInstallPath(args[0].c_str()); + ti->second.SetRuntimeInstallPath(runtime_dir.c_str()); + ti->second.SetHaveInstallRule(true); + } else { + std::string str = "Cannot find target: \"" + *s + "\" to install."; + this->SetError(str); + return false; + } } } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 694a9f6..a76bed3 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -175,15 +175,14 @@ void cmLocalGenerator::GenerateTestFiles() (*gi)->Compute(this); (*gi)->Generate(fout, config, configurationTypes); } - size_t i; - std::vector<cmState::Snapshot> children = - this->Makefile->GetStateSnapshot().GetChildren(); - for (i = 0; i < children.size(); ++i) { + typedef std::vector<cmState::Snapshot> vec_t; + vec_t const& children = this->Makefile->GetStateSnapshot().GetChildren(); + for (vec_t::const_iterator i = children.begin(); i != children.end(); ++i) { // TODO: Use add_subdirectory instead? - fout << "subdirs("; - std::string outP = children[i].GetDirectory().GetCurrentBinary(); - fout << this->ConvertToRelativePath(outP, START_OUTPUT); - fout << ")" << std::endl; + std::string outP = i->GetDirectory().GetCurrentBinary(); + outP = this->ConvertToRelativePath(outP, START_OUTPUT); + outP = cmOutputConverter::EscapeForCMake(outP); + fout << "subdirs(" << outP << ")" << std::endl; } } @@ -1531,9 +1530,6 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, linkLibs += " "; } - // Write the library flags to the build rule. - fout << linkLibs; - // Check what kind of rpath flags to use. if (cli.GetRuntimeSep().empty()) { // Each rpath entry gets its own option ("-R a -R b -R c") @@ -1560,6 +1556,9 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, } } + // Write the library flags to the build rule. + fout << linkLibs; + // Add the linker runtime search path if any. std::string rpath_link = cli.GetRPathLinkString(); if (!cli.GetRPathLinkFlag().empty() && !rpath_link.empty()) { diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 9d312ee..ee9dc8a 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -159,11 +159,11 @@ bool cmMacroHelperCommand::InvokeInitialPass( } cmExecutionStatus status; if (!this->Makefile->ExecuteCommand(newLFF, status) || - (cmSystemTools::GetErrorOccuredFlag() && - !cmSystemTools::GetFatalErrorOccured())) { + status.GetNestedError()) { // The error message should have already included the call stack // so we do not need to report an error here. macroScope.Quiet(); + inStatus.SetNestedError(true); return false; } if (status.GetReturnInvoked()) { diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 11ccca1..508c670 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -117,6 +117,11 @@ cmMakefile::~cmMakefile() void cmMakefile::IssueMessage(cmake::MessageType t, std::string const& text) const { + if (!this->ExecutionStatusStack.empty()) { + if ((t == cmake::FATAL_ERROR) || (t == cmake::INTERNAL_ERROR)) { + this->ExecutionStatusStack.back()->SetNestedError(true); + } + } this->GetCMakeInstance()->IssueMessage(t, text, this->GetBacktrace()); } @@ -277,19 +282,11 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, if (this->GetCMakeInstance()->GetTrace()) { this->PrintCommandTrace(lff); } - - bool hadPreviousNonFatalError = cmSystemTools::GetErrorOccuredFlag() && - !cmSystemTools::GetFatalErrorOccured(); - cmSystemTools::ResetErrorOccuredFlag(); - + // Try invoking the command. bool invokeSucceeded = pcmd->InvokeInitialPass(lff.Arguments, status); - bool hadNestedError = cmSystemTools::GetErrorOccuredFlag() && - !cmSystemTools::GetFatalErrorOccured(); - if (hadPreviousNonFatalError) { - cmSystemTools::SetErrorOccured(); - } + bool hadNestedError = status.GetNestedError(); if (!invokeSucceeded || hadNestedError) { - if (!hadNestedError && !cmSystemTools::GetFatalErrorOccured()) { + if (!hadNestedError) { // The command invocation requested that we report an error. this->IssueMessage(cmake::FATAL_ERROR, pcmd->GetError()); } @@ -982,8 +979,9 @@ void cmMakefile::AddCustomCommandOldStyle( // then add the source to the target to make sure the rule is // included. if (sf && !sf->GetPropertyAsBool("__CMAKE_RULE")) { - if (this->Targets.find(target) != this->Targets.end()) { - this->Targets[target].AddSource(sf->GetFullPath()); + cmTargets::iterator ti = this->Targets.find(target); + if (ti != this->Targets.end()) { + ti->second.AddSource(sf->GetFullPath()); } else { cmSystemTools::Error("Attempt to add a custom rule to a target " "that does not exist yet for target ", @@ -1927,10 +1925,10 @@ cmTarget* cmMakefile::AddNewTarget(cmState::TargetType type, const std::string& name) { cmTargets::iterator it = - this->Targets.insert(cmTargets::value_type(name, cmTarget())).first; - cmTarget& target = it->second; - target.SetType(type, name); - target.SetMakefile(this); + this->Targets + .insert(cmTargets::value_type( + name, cmTarget(name, type, cmTarget::VisibilityNormal, this))) + .first; this->GetGlobalGenerator()->IndexTarget(&it->second); return &it->second; } @@ -3712,10 +3710,10 @@ cmTarget* cmMakefile::AddImportedTarget(const std::string& name, cmState::TargetType type, bool global) { // Create the target. - CM_AUTO_PTR<cmTarget> target(new cmTarget); - target->SetType(type, name); - target->MarkAsImported(global); - target->SetMakefile(this); + CM_AUTO_PTR<cmTarget> target( + new cmTarget(name, type, global ? cmTarget::VisibilityImportedGlobally + : cmTarget::VisibilityImported, + this)); // Add to the set of available imported targets. this->ImportedTargets[name] = target.get(); diff --git a/Source/cmParseArgumentsCommand.cxx b/Source/cmParseArgumentsCommand.cxx index 8f524ec..f9313c5 100644 --- a/Source/cmParseArgumentsCommand.cxx +++ b/Source/cmParseArgumentsCommand.cxx @@ -20,6 +20,8 @@ bool cmParseArgumentsCommand::InitialPass(std::vector<std::string> const& args, { // cmake_parse_arguments(prefix options single multi <ARGN>) // 1 2 3 4 + // or + // cmake_parse_arguments(PARSE_ARGV N prefix options single multi) if (args.size() < 4) { this->SetError("must be called with at least 4 arguments."); return false; @@ -27,6 +29,27 @@ bool cmParseArgumentsCommand::InitialPass(std::vector<std::string> const& args, std::vector<std::string>::const_iterator argIter = args.begin(), argEnd = args.end(); + bool parseFromArgV = false; + unsigned long argvStart = 0; + if (*argIter == "PARSE_ARGV") { + if (args.size() != 6) { + this->Makefile->IssueMessage( + cmake::FATAL_ERROR, + "PARSE_ARGV must be called with exactly 6 arguments."); + cmSystemTools::SetFatalErrorOccured(); + return true; + } + parseFromArgV = true; + argIter++; // move past PARSE_ARGV + if (!cmSystemTools::StringToULong(argIter->c_str(), &argvStart)) { + this->Makefile->IssueMessage(cmake::FATAL_ERROR, "PARSE_ARGV index '" + + *argIter + + "' is not an unsigned integer"); + cmSystemTools::SetFatalErrorOccured(); + return true; + } + argIter++; // move past N + } // the first argument is the prefix const std::string prefix = (*argIter++) + "_"; @@ -90,11 +113,37 @@ bool cmParseArgumentsCommand::InitialPass(std::vector<std::string> const& args, } insideValues = NONE; std::string currentArgName; - // Flatten ;-lists in the arguments into a single list as was done - // by the original function(CMAKE_PARSE_ARGUMENTS). list.clear(); - for (; argIter != argEnd; ++argIter) { - cmSystemTools::ExpandListArgument(*argIter, list); + if (!parseFromArgV) { + // Flatten ;-lists in the arguments into a single list as was done + // by the original function(CMAKE_PARSE_ARGUMENTS). + for (; argIter != argEnd; ++argIter) { + cmSystemTools::ExpandListArgument(*argIter, list); + } + } else { + // in the PARSE_ARGV move read the arguments from ARGC and ARGV# + std::string argc = this->Makefile->GetSafeDefinition("ARGC"); + unsigned long count; + if (!cmSystemTools::StringToULong(argc.c_str(), &count)) { + this->Makefile->IssueMessage(cmake::FATAL_ERROR, + "PARSE_ARGV called with ARGC='" + argc + + "' that is not an unsigned integer"); + cmSystemTools::SetFatalErrorOccured(); + return true; + } + for (unsigned long i = argvStart; i < count; ++i) { + std::ostringstream argName; + argName << "ARGV" << i; + const char* arg = this->Makefile->GetDefinition(argName.str()); + if (!arg) { + this->Makefile->IssueMessage(cmake::FATAL_ERROR, + "PARSE_ARGV called with " + + argName.str() + " not set"); + cmSystemTools::SetFatalErrorOccured(); + return true; + } + list.push_back(arg); + } } // iterate over the arguments list and fill in the values where applicable diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index a0a9c50..36ed614 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1766,9 +1766,7 @@ bool cmSystemTools::CopyFileTime(const char* fromFile, const char* toFile) if (!GetFileTime(hFrom, &timeCreation, &timeLastAccess, &timeLastWrite)) { return false; } - if (!SetFileTime(hTo, &timeCreation, &timeLastAccess, &timeLastWrite)) { - return false; - } + return SetFileTime(hTo, &timeCreation, &timeLastAccess, &timeLastWrite) != 0; #else struct stat fromStat; if (stat(fromFile, &fromStat) < 0) { @@ -1778,11 +1776,8 @@ bool cmSystemTools::CopyFileTime(const char* fromFile, const char* toFile) struct utimbuf buf; buf.actime = fromStat.st_atime; buf.modtime = fromStat.st_mtime; - if (utime(toFile, &buf) < 0) { - return false; - } + return utime(toFile, &buf) >= 0; #endif - return true; } cmSystemToolsFileTime* cmSystemTools::FileTimeNew() @@ -1828,16 +1823,11 @@ bool cmSystemTools::FileTimeSet(const char* fname, cmSystemToolsFileTime* t) if (!h) { return false; } - if (!SetFileTime(h, &t->timeCreation, &t->timeLastAccess, - &t->timeLastWrite)) { - return false; - } + return SetFileTime(h, &t->timeCreation, &t->timeLastAccess, + &t->timeLastWrite) != 0; #else - if (utime(fname, &t->timeBuf) < 0) { - return false; - } + return utime(fname, &t->timeBuf) >= 0; #endif - return true; } #ifdef _WIN32 diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index d5274cd..d964f00 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -59,28 +59,41 @@ public: std::vector<cmListFileBacktrace> LinkImplementationPropertyBacktraces; }; -cmTarget::cmTarget() +cmTarget::cmTarget(std::string const& name, cmState::TargetType type, + Visibility vis, cmMakefile* mf) { + assert(mf || type == cmState::GLOBAL_TARGET); + this->Name = name; + this->TargetTypeValue = type; this->Makefile = CM_NULLPTR; this->HaveInstallRule = false; this->DLLPlatform = false; this->IsAndroid = false; - this->IsImportedTarget = false; - this->ImportedGloballyVisible = false; + this->IsImportedTarget = + (vis == VisibilityImported || vis == VisibilityImportedGlobally); + this->ImportedGloballyVisible = vis == VisibilityImportedGlobally; this->BuildInterfaceIncludesAppended = false; -} -void cmTarget::SetType(cmState::TargetType type, const std::string& name) -{ - this->Name = name; // only add dependency information for library targets - this->TargetTypeValue = type; if (this->TargetTypeValue >= cmState::STATIC_LIBRARY && this->TargetTypeValue <= cmState::MODULE_LIBRARY) { this->RecordDependencies = true; } else { this->RecordDependencies = false; } + + if (mf) { + this->SetMakefile(mf); + } +} + +cmTarget cmTarget::CopyForDirectory(cmMakefile* mf) const +{ + assert(this->GetType() == cmState::GLOBAL_TARGET); + assert(this->GetMakefile() == CM_NULLPTR); + cmTarget result(*this); + result.SetMakefile(mf); + return result; } void cmTarget::SetMakefile(cmMakefile* mf) @@ -1062,12 +1075,6 @@ void cmTarget::CheckProperty(const std::string& prop, } } -void cmTarget::MarkAsImported(bool global) -{ - this->IsImportedTarget = true; - this->ImportedGloballyVisible = global; -} - bool cmTarget::HandleLocationPropertyPolicy(cmMakefile* context) const { if (this->IsImported()) { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index fc30166..ebc92f3 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -63,7 +63,16 @@ private: class cmTarget { public: - cmTarget(); + enum Visibility + { + VisibilityNormal, + VisibilityImported, + VisibilityImportedGlobally + }; + + cmTarget(std::string const& name, cmState::TargetType type, Visibility vis, + cmMakefile* mf); + enum CustomCommandType { PRE_BUILD, @@ -76,18 +85,13 @@ public: */ cmState::TargetType GetType() const { return this->TargetTypeValue; } - /** - * Set the target type - */ - void SetType(cmState::TargetType f, const std::string& name); - - void MarkAsImported(bool global = false); - ///! Set/Get the name of the target const std::string& GetName() const { return this->Name; } - ///! Set the cmMakefile that owns this target - void SetMakefile(cmMakefile* mf); + /** Get a copy of this target adapted for the given directory. */ + cmTarget CopyForDirectory(cmMakefile* mf) const; + + /** Get the cmMakefile that owns this target. */ cmMakefile* GetMakefile() const { return this->Makefile; } #define DECLARE_TARGET_POLICY(POLICY) \ @@ -279,6 +283,8 @@ public: }; private: + void SetMakefile(cmMakefile* mf); + bool HandleLocationPropertyPolicy(cmMakefile* context) const; const char* GetSuffixVariableInternal(bool implib) const; diff --git a/Source/cmTimestamp.cxx b/Source/cmTimestamp.cxx index 61b74db..a94212c 100644 --- a/Source/cmTimestamp.cxx +++ b/Source/cmTimestamp.cxx @@ -123,6 +123,8 @@ std::string cmTimestamp::AddTimestampComponent(char flag, formatString += flag; switch (flag) { + case 'a': + case 'b': case 'd': case 'H': case 'I': diff --git a/Source/cmVS14CLFlagTable.h b/Source/cmVS14CLFlagTable.h index 5812e79..c48db68 100644 --- a/Source/cmVS14CLFlagTable.h +++ b/Source/cmVS14CLFlagTable.h @@ -60,6 +60,9 @@ static cmVS7FlagTable cmVS14CLFlagTable[] = { { "BufferSecurityCheck", "GS-", "Disable Security Check", "false", 0 }, { "BufferSecurityCheck", "GS", "Enable Security Check", "true", 0 }, + { "ControlFlowGuard", "guard:cf", "Yes", "Guard", 0 }, + { "ControlFlowGuard", "", "No", "false", 0 }, + { "EnableEnhancedInstructionSet", "arch:SSE", "Streaming SIMD Extensions", "StreamingSIMDExtensions", 0 }, { "EnableEnhancedInstructionSet", "arch:SSE2", "Streaming SIMD Extensions 2", @@ -76,6 +79,10 @@ static cmVS7FlagTable cmVS14CLFlagTable[] = { { "FloatingPointModel", "fp:strict", "Strict", "Strict", 0 }, { "FloatingPointModel", "fp:fast", "Fast", "Fast", 0 }, + { "LanguageStandard", "std:c++14", "ISO C++14 Standard", "stdcpp14", 0 }, + { "LanguageStandard", "std:c++latest", "ISO C++ Latest Draft Standard", + "stdcpplatest", 0 }, + { "PrecompiledHeader", "Yc", "Create", "Create", cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue }, { "PrecompiledHeader", "Yu", "Use", "Use", @@ -164,6 +171,9 @@ static cmVS7FlagTable cmVS14CLFlagTable[] = { { "TreatWChar_tAsBuiltInType", "Zc:wchar_t", "", "true", 0 }, { "ForceConformanceInForLoopScope", "Zc:forScope-", "", "false", 0 }, { "ForceConformanceInForLoopScope", "Zc:forScope", "", "true", 0 }, + { "RemoveUnreferencedCodeData", "Zc:inline", "", "true", 0 }, + { "EnforceTypeConversionRules", "Zc:rvalueCast-", "", "false", 0 }, + { "EnforceTypeConversionRules", "Zc:rvalueCast", "", "true", 0 }, { "RuntimeTypeInfo", "GR-", "", "false", 0 }, { "RuntimeTypeInfo", "GR", "", "true", 0 }, { "OpenMPSupport", "openmp-", "", "false", 0 }, @@ -215,6 +225,8 @@ static cmVS7FlagTable cmVS14CLFlagTable[] = { "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable }, // String Properties + { "WarningVersion", "Wv:", "Warning Version", "", + cmVS7FlagTable::UserValue }, // Skip [TrackerLogDirectory] - no command line Switch. { "PreprocessOutputPath", "Fi", "Preprocess Output Path", "", cmVS7FlagTable::UserValue }, diff --git a/Source/cmVS14LinkFlagTable.h b/Source/cmVS14LinkFlagTable.h index 6e56422..596f880 100644 --- a/Source/cmVS14LinkFlagTable.h +++ b/Source/cmVS14LinkFlagTable.h @@ -35,6 +35,12 @@ static cmVS7FlagTable cmVS14LinkFlagTable[] = { { "UACExecutionLevel", "level='requireAdministrator'", "requireAdministrator", "RequireAdministrator", 0 }, + { "GenerateDebugInformation", "DEBUG:FASTLINK", + "Optimize for faster linking", "DebugFastLink", + cmVS7FlagTable::CaseInsensitive }, + { "GenerateDebugInformation", "DEBUG", "Optimize for debugging", "Debug", + cmVS7FlagTable::CaseInsensitive }, + { "SubSystem", "", "Not Set", "NotSet", 0 }, { "SubSystem", "SUBSYSTEM:CONSOLE", "Console", "Console", 0 }, { "SubSystem", "SUBSYSTEM:WINDOWS", "Windows", "Windows", 0 }, @@ -54,6 +60,8 @@ static cmVS7FlagTable cmVS14LinkFlagTable[] = { { "Driver", "DRIVER:WDM", "WDM", "WDM", 0 }, { "LinkTimeCodeGeneration", "", "Default", "Default", 0 }, + { "LinkTimeCodeGeneration", "LTCG:incremental", + "Use Fast Link Time Code Generation", "UseFastLinkTimeCodeGeneration", 0 }, { "LinkTimeCodeGeneration", "LTCG", "Use Link Time Code Generation", "UseLinkTimeCodeGeneration", 0 }, { "LinkTimeCodeGeneration", "LTCG:PGInstrument", @@ -121,6 +129,9 @@ static cmVS7FlagTable cmVS14LinkFlagTable[] = { { "CLRSupportLastError", "CLRSupportLastError:SYSTEMDLL", "System Dlls Only", "SystemDlls", 0 }, + { "LinkControlFlowGuard", "guard:cf", "Enable Security Check with Guard", + "Guard", 0 }, + // Bool Properties { "LinkIncremental", "INCREMENTAL:NO", "", "false", 0 }, { "LinkIncremental", "INCREMENTAL", "", "true", 0 }, @@ -138,10 +149,6 @@ static cmVS7FlagTable cmVS14LinkFlagTable[] = { { "UACUIAccess", "uiAccess='false'", "", "false", 0 }, { "UACUIAccess", "uiAccess='true'", "", "true", 0 }, { "ManifestEmbed", "manifest:embed", "", "true", 0 }, - { "GenerateDebugInformation", "DEBUG:FASTLINK", "", "DebugFastLink", - cmVS7FlagTable::CaseInsensitive }, - { "GenerateDebugInformation", "DEBUG", "", "Debug", - cmVS7FlagTable::CaseInsensitive }, { "MapExports", "MAPINFO:EXPORTS", "", "true", 0 }, { "AssemblyDebug", "ASSEMBLYDEBUG:DISABLE", "", "false", 0 }, { "AssemblyDebug", "ASSEMBLYDEBUG", "", "true", 0 }, @@ -195,6 +202,8 @@ static cmVS7FlagTable cmVS14LinkFlagTable[] = { { "AdditionalLibraryDirectories", "LIBPATH:", "Additional Library Directories", "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable }, + { "Natvis", "NATVIS:", "Natvis files", "", + cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable }, // Skip [AdditionalDependencies] - no command line Switch. { "IgnoreSpecificDefaultLibraries", "NODEFAULTLIB:", "Ignore Specific Default Libraries", "", diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index 3b31d7b..9badda6 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -96,6 +96,7 @@ void cmVisualStudioGeneratorOptions::FixExceptionHandlingDefault() case cmGlobalVisualStudioGenerator::VS11: case cmGlobalVisualStudioGenerator::VS12: case cmGlobalVisualStudioGenerator::VS14: + case cmGlobalVisualStudioGenerator::VS15: // by default VS puts <ExceptionHandling></ExceptionHandling> empty // for a project, to make our projects look the same put a new line // and space over for the closing </ExceptionHandling> as the default diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 25f9e3a..18a7894 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -35,7 +35,7 @@ #if defined(CMAKE_BUILD_WITH_CMAKE) #include "cmGraphVizWriter.h" #include "cmVariableWatch.h" -#include <cm_jsoncpp_value.h> + #include <cm_jsoncpp_writer.h> #endif @@ -66,6 +66,7 @@ #include "cmGlobalVisualStudio11Generator.h" #include "cmGlobalVisualStudio12Generator.h" #include "cmGlobalVisualStudio14Generator.h" +#include "cmGlobalVisualStudio15Generator.h" #include "cmGlobalVisualStudio71Generator.h" #include "cmGlobalVisualStudio8Generator.h" #include "cmGlobalVisualStudio9Generator.h" @@ -232,10 +233,9 @@ cmake::~cmake() delete this->FileComparison; } -std::string cmake::ReportCapabilities() const -{ - std::string result; #if defined(CMAKE_BUILD_WITH_CMAKE) +Json::Value cmake::ReportCapabilitiesJson() const +{ Json::Value obj = Json::objectValue; // Version information: Json::Value version = Json::objectValue; @@ -286,8 +286,16 @@ std::string cmake::ReportCapabilities() const #else obj["serverMode"] = false; #endif + return obj; +} +#endif + +std::string cmake::ReportCapabilities() const +{ + std::string result; +#if defined(CMAKE_BUILD_WITH_CMAKE) Json::FastWriter writer; - result = writer.write(obj); + result = writer.write(this->ReportCapabilitiesJson()); #else result = "Not supported"; #endif @@ -1038,6 +1046,28 @@ const char* cmake::GetHomeOutputDirectory() const return this->State->GetBinaryDirectory(); } +std::string cmake::FindCacheFile(const std::string& binaryDir) +{ + std::string cachePath = binaryDir; + cmSystemTools::ConvertToUnixSlashes(cachePath); + std::string cacheFile = cachePath; + cacheFile += "/CMakeCache.txt"; + if (!cmSystemTools::FileExists(cacheFile.c_str())) { + // search in parent directories for cache + std::string cmakeFiles = cachePath; + cmakeFiles += "/CMakeFiles"; + if (cmSystemTools::FileExists(cmakeFiles.c_str())) { + std::string cachePathFound = + cmSystemTools::FileExistsInParentDirectories("CMakeCache.txt", + cachePath.c_str(), "/"); + if (!cachePathFound.empty()) { + cachePath = cmSystemTools::GetFilenamePath(cachePathFound); + } + } + } + return cachePath; +} + void cmake::SetGlobalGenerator(cmGlobalGenerator* gg) { if (!gg) { @@ -1317,6 +1347,7 @@ int cmake::ActualConfigure() { "11.0", "Visual Studio 11 2012" }, { "12.0", "Visual Studio 12 2013" }, { "14.0", "Visual Studio 14 2015" }, + { "15.0", "Visual Studio 15" }, { 0, 0 } }; for (int i = 0; version[i].MSVersion != 0; i++) { @@ -1634,6 +1665,7 @@ void cmake::AddDefaultGenerators() { #if defined(_WIN32) && !defined(__CYGWIN__) #if !defined(CMAKE_BOOT_MINGW) + this->Generators.push_back(cmGlobalVisualStudio15Generator::NewFactory()); this->Generators.push_back(cmGlobalVisualStudio14Generator::NewFactory()); this->Generators.push_back(cmGlobalVisualStudio12Generator::NewFactory()); this->Generators.push_back(cmGlobalVisualStudio11Generator::NewFactory()); @@ -2334,24 +2366,8 @@ int cmake::Build(const std::string& dir, const std::string& target, std::cerr << "Error: " << dir << " is not a directory\n"; return 1; } - std::string cachePath = dir; - cmSystemTools::ConvertToUnixSlashes(cachePath); - std::string cacheFile = cachePath; - cacheFile += "/CMakeCache.txt"; - if (!cmSystemTools::FileExists(cacheFile.c_str())) { - // search in parent directories for cache - std::string cmakeFiles = cachePath; - cmakeFiles += "/CMakeFiles"; - if (cmSystemTools::FileExists(cmakeFiles.c_str())) { - std::string cachePathFound = - cmSystemTools::FileExistsInParentDirectories("CMakeCache.txt", - cachePath.c_str(), "/"); - if (!cachePathFound.empty()) { - cachePath = cmSystemTools::GetFilenamePath(cachePathFound); - } - } - } + std::string cachePath = FindCacheFile(dir); if (!this->LoadCache(cachePath)) { std::cerr << "Error: could not load cache\n"; return 1; diff --git a/Source/cmake.h b/Source/cmake.h index 9dc429d..6095a59 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -24,6 +24,10 @@ #include <string> #include <vector> +#if defined(CMAKE_BUILD_WITH_CMAKE) +#include "cm_jsoncpp_value.h" +#endif + class cmExternalMakefileProjectGeneratorFactory; class cmFileTimeComparison; class cmGlobalGenerator; @@ -118,6 +122,9 @@ public: /// Destructor ~cmake(); +#if defined(CMAKE_BUILD_WITH_CMAKE) + Json::Value ReportCapabilitiesJson() const; +#endif std::string ReportCapabilities() const; static const char* GetCMakeFilesDirectory() { return "/CMakeFiles"; } @@ -186,6 +193,9 @@ public: return this->GlobalGenerator; } + ///! Return the full path to where the CMakeCache.txt file should be. + static std::string FindCacheFile(const std::string& binaryDir); + ///! Return the global generator assigned to this instance of cmake void SetGlobalGenerator(cmGlobalGenerator*); diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index c2e1d53..900bba0 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -91,9 +91,9 @@ void CMakeCommandUsage(const char* program) << " remove_directory dir - remove a directory and its contents\n" << " rename oldname newname - rename a file or directory " "(on one volume)\n" + << " sleep <number>... - sleep for given number of seconds\n" << " tar [cxt][vf][zjJ] file.tar [file/dir1 file/dir2 ...]\n" << " - create or extract a tar or zip archive\n" - << " sleep <number>... - sleep for given number of seconds\n" << " time command [args...] - run command and return elapsed time\n" << " touch file - touch a file.\n" << " touch_nocreate file - touch a file but do not create it.\n" diff --git a/Source/cmparseMSBuildXML.py b/Source/cmparseMSBuildXML.py index 056a0db..1b38d15 100755 --- a/Source/cmparseMSBuildXML.py +++ b/Source/cmparseMSBuildXML.py @@ -15,6 +15,9 @@ # "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/V140/1033/cl.xml" # "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/V140/1033/lib.xml" # "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/V140/1033/link.xml" +# "${PROGRAMFILES}/Microsoft Visual Studio/VS15Preview/Common7/IDE/VC/VCTargets/1033/cl.xml" +# "${PROGRAMFILES}/Microsoft Visual Studio/VS15Preview/Common7/IDE/VC/VCTargets/1033/lib.xml" +# "${PROGRAMFILES}/Microsoft Visual Studio/VS15Preview/Common7/IDE/VC/VCTargets/1033/link.xml" # # BoolProperty <Name>true|false</Name> # simple example: diff --git a/Templates/cygwin-package.sh.in b/Templates/cygwin-package.sh.in deleted file mode 100755 index 69b6c0f..0000000 --- a/Templates/cygwin-package.sh.in +++ /dev/null @@ -1,103 +0,0 @@ -#!/bin/sh - -# this is a sample shell script used for building a cmake -# based project for a cygwin setup package. - -# get the current directory -TOP_DIR=`cd \`echo "$0" | sed -n '/\//{s/\/[^\/]*$//;p;}'\`;pwd` - -# create build directory -mkdirs() -{ - ( - mkdir -p "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" - ) -} - -# cd into -# untar source tree and apply patch -prep() -{ - ( - cd "$TOP_DIR" && - tar xvfj @CPACK_PACKAGE_FILE_NAME@.tar.bz2 - patch -p0 < "@CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.patch" && - mkdirs - ) -} - -# configure the build tree in .build directory -# of the source tree -conf() -{ - ( - cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" && - cmake .. - ) -} - -# build the package in the .build directory -build() -{ - ( - cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" && - make && - make test - ) -} - -# clean the build tree -clean() -{ - ( - cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" && - make clean - ) -} - -# create the package -pkg() -{ - ( - cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" && - cpack && - mv @CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.tar.bz2 "$TOP_DIR" - ) -} - -# create the source package -spkg() -{ - ( - cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" && - cpack --config CPackSourceConfig.cmake && - mv @CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@-src.tar.bz2 "$TOP_DIR" - ) -} - -# clean up -finish() -{ - ( - rm -rf "@CPACK_PACKAGE_FILE_NAME@" - ) -} - -case $1 in - prep) prep ; STATUS=$? ;; - mkdirs) mkdirs ; STATUS=$? ;; - conf) conf ; STATUS=$? ;; - build) build ; STATUS=$? ;; - clean) clean ; STATUS=$? ;; - package) pkg ; STATUS=$? ;; - pkg) pkg ; STATUS=$? ;; - src-package) spkg ; STATUS=$? ;; - spkg) spkg ; STATUS=$? ;; - finish) finish ; STATUS=$? ;; - all) ( - prep && conf && build && pkg && spkg && finish ; - STATUS=$? - ) ;; - *) echo "Error: bad argument (all or one of these: prep mkdirs conf build clean package pkg src-package spkg finish)" ; exit 1 ;; -esac -exit ${STATUS} diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 8293286..97770ed 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1356,6 +1356,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_subdirectory(FindBoost) endif() + if(CMake_TEST_FindBZip2) + add_subdirectory(FindBZip2) + endif() + if(CMake_TEST_FindGSL) add_subdirectory(FindGSL) endif() @@ -1412,9 +1416,9 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release # Matlab module if(CMake_TEST_FindMatlab) - ADD_TEST_MACRO(FindMatlab.basic_checks ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>) - ADD_TEST_MACRO(FindMatlab.versions_checks ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>) - ADD_TEST_MACRO(FindMatlab.components_checks ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>) + ADD_TEST_MACRO(FindMatlab.basic_checks ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>) + ADD_TEST_MACRO(FindMatlab.versions_checks ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>) + ADD_TEST_MACRO(FindMatlab.components_checks ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>) endif() find_package(GTK2 QUIET) diff --git a/Tests/CMakeTests/String-TIMESTAMP-MonthWeekNames.cmake b/Tests/CMakeTests/String-TIMESTAMP-MonthWeekNames.cmake new file mode 100644 index 0000000..1cd44ff --- /dev/null +++ b/Tests/CMakeTests/String-TIMESTAMP-MonthWeekNames.cmake @@ -0,0 +1,11 @@ +string(TIMESTAMP output "%a;%b") +message("~${output}~") + +list(LENGTH output output_length) + +set(expected_output_length 2) + +if(NOT output_length EQUAL ${expected_output_length}) + message(FATAL_ERROR "expected ${expected_output_length} entries in output " + "with all specifiers; found ${output_length}") +endif() diff --git a/Tests/CMakeTests/StringTest.cmake.in b/Tests/CMakeTests/StringTest.cmake.in index aba35fe..a45b205 100644 --- a/Tests/CMakeTests/StringTest.cmake.in +++ b/Tests/CMakeTests/StringTest.cmake.in @@ -36,6 +36,8 @@ set(TIMESTAMP-IncompleteSpecifier-RESULT 0) set(TIMESTAMP-IncompleteSpecifier-STDERR "~foobar%~") set(TIMESTAMP-AllSpecifiers-RESULT 0) set(TIMESTAMP-AllSpecifiers-STDERR "~[0-9]+(;[0-9]+)*~") +set(TIMESTAMP-MonthWeekNames-RESULT 0) +set(TIMESTAMP-MonthWeekNames-STDERR "~[^%]+;[^%]+~") set(TIMESTAMP-UnixTime-RESULT 0) set(TIMESTAMP-UnixTime-STDERR "~[1-9][0-9]+~") @@ -60,6 +62,7 @@ check_cmake_test(String TIMESTAMP-UnknownSpecifier TIMESTAMP-IncompleteSpecifier TIMESTAMP-AllSpecifiers + TIMESTAMP-MonthWeekNames TIMESTAMP-UnixTime ) diff --git a/Tests/CPackComponentsDEB/MyLibCPackConfig-components-description1.cmake.in b/Tests/CPackComponentsDEB/MyLibCPackConfig-components-description1.cmake.in index 74d816c..6c5a655 100644 --- a/Tests/CPackComponentsDEB/MyLibCPackConfig-components-description1.cmake.in +++ b/Tests/CPackComponentsDEB/MyLibCPackConfig-components-description1.cmake.in @@ -15,8 +15,8 @@ set(CPACK_COMPONENTS_IGNORE_GROUPS 1) #set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1) # overriding previous descriptions -set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "main description") -set(CPACK_COMPONENT_APPLICATIONS_DESCRIPTION "applications_description") -set(CPACK_COMPONENT_HEADERS_DESCRIPTION "headers_description") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "main description") +set(CPACK_DEBIAN_APPLICATIONS_PACKAGE_DESCRIPTION "applications_description") +set(CPACK_COMPONENT_HEADERS_DESCRIPTION "headers_description") # libraries does not have any description and should inherit from CPACK_PACKAGE_DESCRIPTION_SUMMARY unset(CPACK_COMPONENT_LIBRARIES_DESCRIPTION) diff --git a/Tests/CPackComponentsDEB/MyLibCPackConfig-components-description2.cmake.in b/Tests/CPackComponentsDEB/MyLibCPackConfig-components-description2.cmake.in index cda79bc..92226d8 100644 --- a/Tests/CPackComponentsDEB/MyLibCPackConfig-components-description2.cmake.in +++ b/Tests/CPackComponentsDEB/MyLibCPackConfig-components-description2.cmake.in @@ -17,10 +17,12 @@ set(CPACK_COMPONENTS_IGNORE_GROUPS 1) # overriding previous descriptions set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "main description 2") +# and override CPACK_PACKAGE_DESCRIPTION_SUMMARY because of precedence +set(CPACK_PACKAGE_DESCRIPTION_FILE + "@CPackComponentsDEB_SOURCE_DIR@/pkg_description.txt") + # Components do not have any description unset(CPACK_COMPONENT_APPLICATIONS_DESCRIPTION) unset(CPACK_COMPONENT_HEADERS_DESCRIPTION) -unset(CPACK_COMPONENT_LIBRARIES_DESCRIPTION) - set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION "library description") diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description2.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description2.cmake index 35ca74c..7b94ca0 100644 --- a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description2.cmake +++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description2.cmake @@ -55,12 +55,12 @@ if(DPKGDEB_EXECUTABLE) message(STATUS "package='${dpkg_package_name}', description='${dpkg_description}'") if("${dpkg_package_name}" STREQUAL "mylib-applications") - if(NOT "${dpkg_description}" STREQUAL "main description 2") + if(NOT "${dpkg_description}" STREQUAL "Debian package description file") set(dpkgdeb_output_errors_all ${dpkgdeb_output_errors_all} "dpkg-deb: ${_f}: Incorrect description for package ${dpkg_package_name}: ${dpkg_description} != applications_description") endif() elseif("${dpkg_package_name}" STREQUAL "mylib-headers") - if(NOT "${dpkg_description}" STREQUAL "main description 2") + if(NOT "${dpkg_description}" STREQUAL "Debian package description file") set(dpkgdeb_output_errors_all ${dpkgdeb_output_errors_all} "dpkg-deb: ${_f}: Incorrect description for package ${dpkg_package_name}: ${dpkg_description} != headers_description") endif() diff --git a/Tests/CPackComponentsDEB/pkg_description.txt b/Tests/CPackComponentsDEB/pkg_description.txt new file mode 100644 index 0000000..99f8f9b --- /dev/null +++ b/Tests/CPackComponentsDEB/pkg_description.txt @@ -0,0 +1 @@ +Debian package description file diff --git a/Tests/FindBZip2/CMakeLists.txt b/Tests/FindBZip2/CMakeLists.txt new file mode 100644 index 0000000..0eb3b99 --- /dev/null +++ b/Tests/FindBZip2/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindBZip2.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindBZip2/Test" + "${CMake_BINARY_DIR}/Tests/FindBZip2/Test" + ${build_generator_args} + --build-project TestFindBZip2 + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) diff --git a/Tests/FindBZip2/Test/CMakeLists.txt b/Tests/FindBZip2/Test/CMakeLists.txt new file mode 100644 index 0000000..e9cb618 --- /dev/null +++ b/Tests/FindBZip2/Test/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.4) +project(TestFindBZip2 C) +include(CTest) + +find_package(BZip2 REQUIRED) + +add_definitions(-DCMAKE_EXPECTED_BZip2_VERSION="${BZip2_VERSION_STRING}") + +add_executable(test_tgt main.c) +target_link_libraries(test_tgt BZip2::BZip2) +add_test(NAME test_tgt COMMAND test_tgt) + +add_executable(test_var main.c) +target_include_directories(test_var PRIVATE ${BZIP2_INCLUDE_DIRS}) +target_link_libraries(test_var PRIVATE ${BZIP2_LIBRARIES}) +add_test(NAME test_var COMMAND test_var) diff --git a/Tests/FindBZip2/Test/main.c b/Tests/FindBZip2/Test/main.c new file mode 100644 index 0000000..8e24c94 --- /dev/null +++ b/Tests/FindBZip2/Test/main.c @@ -0,0 +1,23 @@ +#include <bzlib.h> +#include <stdio.h> +#include <stdlib.h> + +int main() +{ + int chunksize = 1024; + FILE* file = fopen("test.bzip2", "wb"); + char* buf = malloc(sizeof(char) * chunksize); + int error, rsize; + unsigned int in, out; + BZFILE* bzfile = BZ2_bzWriteOpen(&error, file, 64, 1, 10); + + /* Don't actually write anything for the purposes of the test */ + + BZ2_bzWriteClose(&error, bzfile, 1, &in, &out); + free(buf); + fclose(file); + + remove("test.bzip2"); + + return 0; +} diff --git a/Tests/Module/ExternalData/CMakeLists.txt b/Tests/Module/ExternalData/CMakeLists.txt index f07ab71..1018dd8 100644 --- a/Tests/Module/ExternalData/CMakeLists.txt +++ b/Tests/Module/ExternalData/CMakeLists.txt @@ -53,4 +53,5 @@ ExternalData_Add_Target(Data1) add_subdirectory(Data2) add_subdirectory(Data3) add_subdirectory(Data4) +add_subdirectory(Data5) add_subdirectory(DataNoSymlinks) diff --git a/Tests/Module/ExternalData/Data5/CMakeLists.txt b/Tests/Module/ExternalData/Data5/CMakeLists.txt new file mode 100644 index 0000000..13c7fab --- /dev/null +++ b/Tests/Module/ExternalData/Data5/CMakeLists.txt @@ -0,0 +1,22 @@ +# Test adding the same data file in multiple tests +ExternalData_Add_Test(Data5.A + NAME Data5Check.A + COMMAND ${CMAKE_COMMAND} + -D Data5=DATA{../Data.dat} + -P ${CMAKE_CURRENT_SOURCE_DIR}/Data5Check.cmake + ) +ExternalData_Add_Target(Data5.A) +ExternalData_Add_Test(Data5.B + NAME Data5Check.B + COMMAND ${CMAKE_COMMAND} + -D Data5=DATA{../Data.dat} + -P ${CMAKE_CURRENT_SOURCE_DIR}/Data5Check.cmake + ) +ExternalData_Add_Target(Data5.B) +ExternalData_Add_Test(Data5.C + NAME Data5Check.C + COMMAND ${CMAKE_COMMAND} + -D Data5=DATA{../Data.dat} + -P ${CMAKE_CURRENT_SOURCE_DIR}/Data5Check.cmake + ) +ExternalData_Add_Target(Data5.C) diff --git a/Tests/Module/ExternalData/Data5/Data5Check.cmake b/Tests/Module/ExternalData/Data5/Data5Check.cmake new file mode 100644 index 0000000..4dea9a4 --- /dev/null +++ b/Tests/Module/ExternalData/Data5/Data5Check.cmake @@ -0,0 +1,4 @@ +file(STRINGS "${Data5}" lines LIMIT_INPUT 1024) +if(NOT "x${lines}" STREQUAL "xInput file already transformed.") + message(SEND_ERROR "Input file:\n ${Data5}\ndoes not have expected content, but [[${lines}]]") +endif() diff --git a/Tests/RunCMake/AndroidMK/AndroidMK-check.cmake b/Tests/RunCMake/AndroidMK/AndroidMK-check.cmake new file mode 100644 index 0000000..691e326 --- /dev/null +++ b/Tests/RunCMake/AndroidMK/AndroidMK-check.cmake @@ -0,0 +1,30 @@ +# This file does a regex file compare on the generated +# Android.mk files from the AndroidMK test + +macro(compare_file_to_expected file expected_file) + file(READ "${file}" ANDROID_MK) + # clean up new lines + string(REGEX REPLACE "\r\n" "\n" ANDROID_MK "${ANDROID_MK}") + string(REGEX REPLACE "\n+$" "" ANDROID_MK "${ANDROID_MK}") + # read in the expected regex file + file(READ "${expected_file}" expected) + # clean up new lines + string(REGEX REPLACE "\r\n" "\n" expected "${expected}") + string(REGEX REPLACE "\n+$" "" expected "${expected}") + # compare the file to the expected regex and if there is not a match + # put an error message in RunCMake_TEST_FAILED + if(NOT "${ANDROID_MK}" MATCHES "${expected}") + set(RunCMake_TEST_FAILED + "${file} does not match ${expected_file}: + +Android.mk contents = [\n${ANDROID_MK}\n] +Expected = [\n${expected}\n]") + endif() +endmacro() + +compare_file_to_expected( +"${RunCMake_BINARY_DIR}/AndroidMK-build/Android.mk" +"${RunCMake_TEST_SOURCE_DIR}/expectedBuildAndroidMK.txt") +compare_file_to_expected( +"${RunCMake_BINARY_DIR}/AndroidMK-build/CMakeFiles/Export/share/ndk-modules/Android.mk" +"${RunCMake_TEST_SOURCE_DIR}/expectedInstallAndroidMK.txt") diff --git a/Tests/RunCMake/AndroidMK/AndroidMK.cmake b/Tests/RunCMake/AndroidMK/AndroidMK.cmake new file mode 100644 index 0000000..ed21e58 --- /dev/null +++ b/Tests/RunCMake/AndroidMK/AndroidMK.cmake @@ -0,0 +1,11 @@ +project(build) +set(CMAKE_BUILD_TYPE Debug) +add_library(foo foo.cxx) +add_library(car foo.cxx) +add_library(bar foo.cxx) +add_library(dog foo.cxx) +target_link_libraries(foo car bar dog debug -lm) +export(TARGETS bar dog car foo ANDROID_MK + ${build_BINARY_DIR}/Android.mk) +install(TARGETS bar dog car foo DESTINATION lib EXPORT myexp) +install(EXPORT_ANDROID_MK myexp DESTINATION share/ndk-modules) diff --git a/Tests/RunCMake/AndroidMK/CMakeLists.txt b/Tests/RunCMake/AndroidMK/CMakeLists.txt new file mode 100644 index 0000000..576787a --- /dev/null +++ b/Tests/RunCMake/AndroidMK/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.5) +project(${RunCMake_TEST} NONE) # or languages needed +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/AndroidMK/RunCMakeTest.cmake b/Tests/RunCMake/AndroidMK/RunCMakeTest.cmake new file mode 100644 index 0000000..786d45b --- /dev/null +++ b/Tests/RunCMake/AndroidMK/RunCMakeTest.cmake @@ -0,0 +1,2 @@ +include(RunCMake) +run_cmake(AndroidMK) diff --git a/Tests/RunCMake/AndroidMK/expectedBuildAndroidMK.txt b/Tests/RunCMake/AndroidMK/expectedBuildAndroidMK.txt new file mode 100644 index 0000000..def8fcb --- /dev/null +++ b/Tests/RunCMake/AndroidMK/expectedBuildAndroidMK.txt @@ -0,0 +1,23 @@ +LOCAL_PATH.*call my-dir.* +include.*CLEAR_VARS.* +LOCAL_MODULE.*bar +LOCAL_SRC_FILES.*bar.* +include.*PREBUILT_STATIC_LIBRARY.* +.* +include.*CLEAR_VARS.* +LOCAL_MODULE.*dog +LOCAL_SRC_FILES.*.*dog.* +include.*PREBUILT_STATIC_LIBRARY.* +.* +include.*CLEAR_VARS.* +LOCAL_MODULE.*car +LOCAL_SRC_FILES.*.*car.* +include.*PREBUILT_STATIC_LIBRARY.* +.* +include.*CLEAR_VARS.* +LOCAL_MODULE.*foo +LOCAL_SRC_FILES.*.*foo.* +LOCAL_CPP_FEATURES.*rtti exceptions +LOCAL_STATIC_LIBRARIES.*car bar dog +LOCAL_EXPORT_LDLIBS := -lm +include.*PREBUILT_STATIC_LIBRARY.* diff --git a/Tests/RunCMake/AndroidMK/expectedInstallAndroidMK.txt b/Tests/RunCMake/AndroidMK/expectedInstallAndroidMK.txt new file mode 100644 index 0000000..1bdb308 --- /dev/null +++ b/Tests/RunCMake/AndroidMK/expectedInstallAndroidMK.txt @@ -0,0 +1,25 @@ +LOCAL_PATH.*call my-dir.* +_IMPORT_PREFIX.*LOCAL_PATH./../.. + +include.*CLEAR_VARS.* +LOCAL_MODULE.*bar +LOCAL_SRC_FILES.*_IMPORT_PREFIX./lib.*bar.* +include.*PREBUILT_STATIC_LIBRARY.* + +include.*CLEAR_VARS. +LOCAL_MODULE.*dog +LOCAL_SRC_FILES.*_IMPORT_PREFIX./lib.*dog.* +include.*PREBUILT_STATIC_LIBRARY.* + +include.*CLEAR_VARS.* +LOCAL_MODULE.*car +LOCAL_SRC_FILES.*_IMPORT_PREFIX./lib.*car.* +include.*PREBUILT_STATIC_LIBRARY.* + +include.*CLEAR_VARS.* +LOCAL_MODULE.*foo +LOCAL_SRC_FILES.*_IMPORT_PREFIX\)/lib.*foo.* +LOCAL_CPP_FEATURES.*rtti exceptions +LOCAL_STATIC_LIBRARIES.*car bar dog +LOCAL_EXPORT_LDLIBS := -lm +include.*PREBUILT_STATIC_LIBRARY.* diff --git a/Tests/RunCMake/AndroidMK/foo.cxx b/Tests/RunCMake/AndroidMK/foo.cxx new file mode 100644 index 0000000..3695dc9 --- /dev/null +++ b/Tests/RunCMake/AndroidMK/foo.cxx @@ -0,0 +1,3 @@ +void foo() +{ +} diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index fa3d0f9..e36b2a6 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -331,6 +331,8 @@ add_RunCMake_test_group(CPack "DEB;RPM;TGZ") # for MSVC compilers CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS property is used add_RunCMake_test(AutoExportDll) +add_RunCMake_test(AndroidMK) + if(CMake_TEST_ANDROID_NDK OR CMake_TEST_ANDROID_STANDALONE_TOOLCHAIN) if(NOT "${CMAKE_GENERATOR}" MATCHES "Make|Ninja") message(FATAL_ERROR "Android tests supported only by Makefile and Ninja generators") diff --git a/Tests/RunCMake/Configure/ContinueAfterError-result.txt b/Tests/RunCMake/Configure/ContinueAfterError-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Configure/ContinueAfterError-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Configure/ContinueAfterError-stderr.txt b/Tests/RunCMake/Configure/ContinueAfterError-stderr.txt new file mode 100644 index 0000000..f40a3ef --- /dev/null +++ b/Tests/RunCMake/Configure/ContinueAfterError-stderr.txt @@ -0,0 +1,13 @@ +^CMake Error at ContinueAfterError.cmake:[0-9]+ \(message\): + error in loop body +Call Stack \(most recent call first\): + ContinueAfterError.cmake:[0-9]+ \(m\) + ContinueAfterError.cmake:[0-9]+ \(f\) + CMakeLists.txt:[0-9]+ \(include\) ++ +CMake Error at ContinueAfterError.cmake:[0-9]+ \(message\): + error in loop body +Call Stack \(most recent call first\): + ContinueAfterError.cmake:[0-9]+ \(m\) + ContinueAfterError.cmake:[0-9]+ \(f\) + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/Configure/ContinueAfterError-stdout.txt b/Tests/RunCMake/Configure/ContinueAfterError-stdout.txt new file mode 100644 index 0000000..f03aa07 --- /dev/null +++ b/Tests/RunCMake/Configure/ContinueAfterError-stdout.txt @@ -0,0 +1,11 @@ +-- before f +-- start f +-- start m +-- start loop body +-- end loop body +-- start loop body +-- end loop body +-- end m +-- end f +-- after f +-- Configuring incomplete, errors occurred! diff --git a/Tests/RunCMake/Configure/ContinueAfterError.cmake b/Tests/RunCMake/Configure/ContinueAfterError.cmake new file mode 100644 index 0000000..d094390 --- /dev/null +++ b/Tests/RunCMake/Configure/ContinueAfterError.cmake @@ -0,0 +1,19 @@ +macro(m) + message(STATUS " start m") + foreach(i 1 2) + message(STATUS " start loop body") + message(SEND_ERROR "error in loop body") + message(STATUS " end loop body") + endforeach() + message(STATUS " end m") +endmacro() + +function(f) + message(STATUS " start f") + m() + message(STATUS " end f") +endfunction() + +message(STATUS "before f") +f() +message(STATUS "after f") diff --git a/Tests/RunCMake/Configure/RunCMakeTest.cmake b/Tests/RunCMake/Configure/RunCMakeTest.cmake index 58e1a2a..91adb4e 100644 --- a/Tests/RunCMake/Configure/RunCMakeTest.cmake +++ b/Tests/RunCMake/Configure/RunCMakeTest.cmake @@ -1,5 +1,6 @@ include(RunCMake) +run_cmake(ContinueAfterError) run_cmake(CustomTargetAfterError) run_cmake(ErrorLogs) run_cmake(FailCopyFileABI) diff --git a/Tests/RunCMake/GenerateExportHeader/GEH-failures.cmake b/Tests/RunCMake/GenerateExportHeader/GEH-failures.cmake new file mode 100644 index 0000000..7182cdf --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/GEH-failures.cmake @@ -0,0 +1,67 @@ +set(failure_test_executables + ${CMAKE_CURRENT_BINARY_DIR}/failure_test_targets) +file(WRITE ${failure_test_executables} "") + +# Check if we should do anything. If the compiler doesn't support hidden +# visibility, the failure tests won't fail, so just write an empty targets +# list and punt. +if(NOT WIN32 AND NOT CYGWIN AND NOT COMPILER_HAS_HIDDEN_VISIBILITY) + return() +endif() + +# Read the input source file +file(READ ${CMAKE_CURRENT_SOURCE_DIR}/exportheader_test.cpp content_post) +set(content_pre "") + +# Generate source files for failure test executables +set(counter 0) +while(1) + # Find first occurrence of link error marker in remaining content + string(REGEX MATCH "//([^;\n]+;) LINK ERROR( [(][^)]+[)])?\n(.*)" + match "${content_post}") + if(match STREQUAL "") + # No more matches + break() + endif() + + # Shift content buffers and extract failing statement + string(LENGTH "${content_post}" content_post_length) + string(LENGTH "${match}" matched_length) + math(EXPR shift_length "${content_post_length} - ${matched_length}") + + string(SUBSTRING "${content_post}" 0 ${shift_length} shift) + set(content_pre "${content_pre}${shift}") + set(content_post "${CMAKE_MATCH_3}") + set(content_active "//${CMAKE_MATCH_1} LINK ERROR${CMAKE_MATCH_2}") + set(statement "${CMAKE_MATCH_1}") + + # Check if potential error is conditional, and evaluate condition if so + string(REGEX REPLACE " [(]([^)]+)[)]" "\\1" condition "${CMAKE_MATCH_2}") + if(NOT condition STREQUAL "") + string(REGEX REPLACE " +" ";" condition "${condition}") + if(${condition}) + else() + message(STATUS "Not testing '${statement}'; " + "condition (${condition}) is FALSE") + set(content_pre "${content_pre}// link error removed\n") + continue() + endif() + endif() + + if(NOT skip) + message(STATUS "Creating failure test for '${statement}'") + math(EXPR counter "${counter} + 1") + + # Write new source file + set(out ${CMAKE_CURRENT_BINARY_DIR}/exportheader_failtest-${counter}.cpp) + file(WRITE ${out} "${content_pre}${statement}\n${content_post}") + + # Add executable for failure test + add_executable(GEH-fail-${counter} EXCLUDE_FROM_ALL ${out}) + target_link_libraries(GEH-fail-${counter} ${link_libraries}) + file(APPEND ${failure_test_executables} "GEH-fail-${counter}\n") + endif() + + # Add placeholder where failing statement was removed + set(content_pre "${content_pre}${content_active}\n") +endwhile() diff --git a/Tests/RunCMake/GenerateExportHeader/GEH-link-error-result.txt b/Tests/RunCMake/GenerateExportHeader/GEH-link-error-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/GEH-link-error-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/GenerateExportHeader/GEH-link-error-stderr.txt b/Tests/RunCMake/GenerateExportHeader/GEH-link-error-stderr.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/GEH-link-error-stderr.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/GenerateExportHeader/GEH.cmake b/Tests/RunCMake/GenerateExportHeader/GEH.cmake index ee0871b..cddba29 100644 --- a/Tests/RunCMake/GenerateExportHeader/GEH.cmake +++ b/Tests/RunCMake/GenerateExportHeader/GEH.cmake @@ -123,3 +123,5 @@ target_compile_definitions(GenerateExportHeader "SRC_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}/reference/${_platform}\"" "BIN_DIR=\"${CMAKE_CURRENT_BINARY_DIR}\"" ) + +include(${CMAKE_CURRENT_LIST_DIR}/GEH-failures.cmake) diff --git a/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake b/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake index e534c1f..9423ef5 100644 --- a/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake +++ b/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake @@ -12,6 +12,16 @@ function(run_GEH) run_cmake(GEH) run_cmake_command(GEH-build ${CMAKE_COMMAND} --build . --config Debug) run_cmake_command(GEH-run ${RunCMake_TEST_BINARY_DIR}/GenerateExportHeader) + + file(STRINGS "${RunCMake_TEST_BINARY_DIR}/failure_test_targets" + failure_test_targets) + + foreach(failure_test_target ${failure_test_targets}) + run_cmake_command(GEH-link-error ${CMAKE_COMMAND} + --build . + --config Debug + --target ${failure_test_target}) + endforeach() endfunction() run_GEH() diff --git a/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp b/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp index 26bea7e..7e3e0e4 100644 --- a/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp +++ b/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp @@ -3,14 +3,6 @@ #include "libstatic.h" -// #define BUILD_FAIL - -#ifndef BUILD_FAIL -#define DOES_NOT_BUILD(function) -#else -#define DOES_NOT_BUILD(function) function -#endif - #include <fstream> #include <iostream> #include <stdlib.h> @@ -64,74 +56,114 @@ void compare(const char* refName, const char* testName) int main() { { - Libshared l; - l.libshared(); - l.libshared_exported(); - l.libshared_deprecated(); - l.libshared_not_exported(); - - DOES_NOT_BUILD(l.libshared_excluded();) + libshared::Class l; + // l.method(); LINK ERROR + l.method_exported(); + // l.method_deprecated(); LINK ERROR + l.method_deprecated_exported(); + // l.method_excluded(); LINK ERROR + + // use_int(l.data); LINK ERROR + use_int(l.data_exported); + // use_int(l.data_excluded); LINK ERROR } { - LibsharedNotExported l; - DOES_NOT_BUILD(l.libshared();) - l.libshared_exported(); - l.libshared_deprecated(); - DOES_NOT_BUILD(l.libshared_not_exported();) - DOES_NOT_BUILD(l.libshared_excluded();) + libshared::ExportedClass l; + l.method(); + l.method_deprecated(); +#if defined(_WIN32) || defined(__CYGWIN__) + l.method_excluded(); +#else +// l.method_excluded(); LINK ERROR (NOT WIN32 AND NOT CYGWIN) +#endif + + use_int(l.data); +#if defined(_WIN32) || defined(__CYGWIN__) + use_int(l.data_excluded); +#else +// use_int(l.data_excluded); LINK ERROR (NOT WIN32 AND NOT CYGWIN) +#endif } { - LibsharedExcluded l; - DOES_NOT_BUILD(l.libshared();) - l.libshared_exported(); - l.libshared_deprecated(); - DOES_NOT_BUILD(l.libshared_not_exported();) - DOES_NOT_BUILD(l.libshared_excluded();) + libshared::ExcludedClass l; + // l.method(); LINK ERROR + l.method_exported(); + // l.method_deprecated(); LINK ERROR + l.method_deprecated_exported(); + // l.method_excluded(); LINK ERROR + + // use_int(l.data); LINK ERROR + use_int(l.data_exported); + // use_int(l.data_excluded); LINK ERROR } - libshared_exported(); - libshared_deprecated(); - DOES_NOT_BUILD(libshared_not_exported();) - DOES_NOT_BUILD(libshared_excluded();) + // libshared::function(); LINK ERROR + libshared::function_exported(); + // libshared::function_deprecated(); LINK ERROR + libshared::function_deprecated_exported(); + // libshared::function_excluded(); LINK ERROR + + // use_int(libshared::data); LINK ERROR + use_int(libshared::data_exported); + // use_int(libshared::data_excluded); LINK ERROR { - Libstatic l; - l.libstatic(); - l.libstatic_exported(); - l.libstatic_deprecated(); - l.libstatic_not_exported(); - l.libstatic_excluded(); + libstatic::Class l; + l.method(); + l.method_exported(); + l.method_deprecated(); + l.method_deprecated_exported(); + l.method_excluded(); + + use_int(l.data); + use_int(l.data_exported); + use_int(l.data_excluded); } { - LibstaticNotExported l; - l.libstatic(); - l.libstatic_exported(); - l.libstatic_deprecated(); - l.libstatic_not_exported(); - l.libstatic_excluded(); + libstatic::ExportedClass l; + l.method(); + l.method_exported(); + l.method_deprecated(); + l.method_deprecated_exported(); + l.method_excluded(); + + use_int(l.data); + use_int(l.data_exported); + use_int(l.data_excluded); } { - LibstaticExcluded l; - l.libstatic(); - l.libstatic_exported(); - l.libstatic_deprecated(); - l.libstatic_not_exported(); - l.libstatic_excluded(); + libstatic::ExcludedClass l; + l.method(); + l.method_exported(); + l.method_deprecated(); + l.method_deprecated_exported(); + l.method_excluded(); + + use_int(l.data); + use_int(l.data_exported); + use_int(l.data_excluded); } - libstatic_exported(); - libstatic_deprecated(); - libstatic_not_exported(); - libstatic_excluded(); + libstatic::function(); + libstatic::function_exported(); + libstatic::function_deprecated(); + libstatic::function_deprecated_exported(); + libstatic::function_excluded(); + + use_int(libstatic::data); + use_int(libstatic::data_exported); + use_int(libstatic::data_excluded); +#if defined(SRC_DIR) && defined(BIN_DIR) compare(SRC_DIR "/libshared_export.h", BIN_DIR "/libshared/libshared_export.h"); compare(SRC_DIR "/libstatic_export.h", BIN_DIR "/libstatic/libstatic_export.h"); +#endif return 0; } diff --git a/Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp b/Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp index 846c207..9ac8381 100644 --- a/Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp +++ b/Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp @@ -1,106 +1,121 @@ - #include "libshared_and_static.h" #ifndef MY_CUSTOM_CONTENT_ADDED #error "MY_CUSTOM_CONTENT_ADDED not defined!" #endif -int LibsharedAndStatic::libshared_and_static() const +int libshared_and_static::Class::method() const { return 0; } -int LibsharedAndStatic::libshared_and_static_exported() const +int libshared_and_static::Class::method_exported() const { return 0; } -int LibsharedAndStatic::libshared_and_static_deprecated() const +int libshared_and_static::Class::method_deprecated() const { return 0; } -int LibsharedAndStatic::libshared_and_static_not_exported() const +int libshared_and_static::Class::method_deprecated_exported() const { return 0; } -int LibsharedAndStatic::libshared_and_static_excluded() const +int libshared_and_static::Class::method_excluded() const { return 0; } -int LibsharedAndStaticNotExported::libshared_and_static() const -{ - return 0; -} +int const libshared_and_static::Class::data = 1; -int LibsharedAndStaticNotExported::libshared_and_static_exported() const +int const libshared_and_static::Class::data_exported = 1; + +int const libshared_and_static::Class::data_excluded = 1; + +int libshared_and_static::ExportedClass::method() const { return 0; } -int LibsharedAndStaticNotExported::libshared_and_static_deprecated() const +int libshared_and_static::ExportedClass::method_deprecated() const { return 0; } -int LibsharedAndStaticNotExported::libshared_and_static_not_exported() const +int libshared_and_static::ExportedClass::method_excluded() const { return 0; } -int LibsharedAndStaticNotExported::libshared_and_static_excluded() const +int const libshared_and_static::ExportedClass::data = 1; + +int const libshared_and_static::ExportedClass::data_excluded = 1; + +int libshared_and_static::ExcludedClass::method() const { return 0; } -int LibsharedAndStaticExcluded::libshared_and_static() const +int libshared_and_static::ExcludedClass::method_exported() const { return 0; } -int LibsharedAndStaticExcluded::libshared_and_static_exported() const +int libshared_and_static::ExcludedClass::method_deprecated() const { return 0; } -int LibsharedAndStaticExcluded::libshared_and_static_deprecated() const +int libshared_and_static::ExcludedClass::method_deprecated_exported() const { return 0; } -int LibsharedAndStaticExcluded::libshared_and_static_not_exported() const +int libshared_and_static::ExcludedClass::method_excluded() const { return 0; } -int LibsharedAndStaticExcluded::libshared_and_static_excluded() const +int const libshared_and_static::ExcludedClass::data = 1; + +int const libshared_and_static::ExcludedClass::data_exported = 1; + +int const libshared_and_static::ExcludedClass::data_excluded = 1; + +int libshared_and_static::function() { return 0; } -int libshared_and_static() +int libshared_and_static::function_exported() { return 0; } -int libshared_and_static_exported() +int libshared_and_static::function_deprecated() { return 0; } -int libshared_and_static_deprecated() +int libshared_and_static::function_deprecated_exported() { return 0; } -int libshared_and_static_not_exported() +int libshared_and_static::function_excluded() { return 0; } -int libshared_and_static_excluded() +int const libshared_and_static::data = 1; + +int const libshared_and_static::data_exported = 1; + +int const libshared_and_static::data_excluded = 1; + +void use_int(int) { - return 0; } diff --git a/Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h b/Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h index ea672fe..2c3fcfd 100644 --- a/Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h +++ b/Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h @@ -1,66 +1,83 @@ - -#ifndef SHARED_AND_STATIC_H -#define SHARED_AND_STATIC_H +#ifndef LIBSHARED_AND_STATIC_H +#define LIBSHARED_AND_STATIC_H #include "libshared_and_static_export.h" -class MYPREFIX_LIBSHARED_AND_STATIC_EXPORT LibsharedAndStatic +namespace libshared_and_static { + +class Class { public: - int libshared_and_static() const; + int method() const; + + int MYPREFIX_LIBSHARED_AND_STATIC_EXPORT method_exported() const; + + int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED method_deprecated() const; - int libshared_and_static_exported() const; + int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED_EXPORT + method_deprecated_exported() const; - int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED - libshared_and_static_deprecated() const; + int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT method_excluded() const; - int libshared_and_static_not_exported() const; + static int const data; - int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT - libshared_and_static_excluded() const; + static int const MYPREFIX_LIBSHARED_AND_STATIC_EXPORT data_exported; + + static int const MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT data_excluded; }; -class LibsharedAndStaticNotExported +class MYPREFIX_LIBSHARED_AND_STATIC_EXPORT ExportedClass { public: - int libshared_and_static() const; + int method() const; - int MYPREFIX_LIBSHARED_AND_STATIC_EXPORT - libshared_and_static_exported() const; + int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED method_deprecated() const; - int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED - libshared_and_static_deprecated() const; + int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT method_excluded() const; - int libshared_and_static_not_exported() const; + static int const data; - int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT - libshared_and_static_excluded() const; + static int const MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT data_excluded; }; -class MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT LibsharedAndStaticExcluded +class MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT ExcludedClass { public: - int libshared_and_static() const; + int method() const; + + int MYPREFIX_LIBSHARED_AND_STATIC_EXPORT method_exported() const; + + int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED method_deprecated() const; - int MYPREFIX_LIBSHARED_AND_STATIC_EXPORT - libshared_and_static_exported() const; + int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED_EXPORT + method_deprecated_exported() const; - int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED - libshared_and_static_deprecated() const; + int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT method_excluded() const; - int libshared_and_static_not_exported() const; + static int const data; - int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT - libshared_and_static_excluded() const; + static int const MYPREFIX_LIBSHARED_AND_STATIC_EXPORT data_exported; + + static int const MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT data_excluded; }; -MYPREFIX_LIBSHARED_AND_STATIC_EXPORT int libshared_and_static_exported(); +int function(); + +int MYPREFIX_LIBSHARED_AND_STATIC_EXPORT function_exported(); + +int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED function_deprecated(); + +int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED_EXPORT +function_deprecated_exported(); + +int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT function_excluded(); + +extern int const data; -MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED_EXPORT int -libshared_and_static_deprecated(); +extern int const MYPREFIX_LIBSHARED_AND_STATIC_EXPORT data_exported; -int libshared_and_static_not_exported(); +extern int const MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT data_excluded; -int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded(); +} // namespace libshared_and_static #endif diff --git a/Tests/RunCMake/GenerateExportHeader/libshared/libshared.cpp b/Tests/RunCMake/GenerateExportHeader/libshared/libshared.cpp index ad6d356..328ef6f 100644 --- a/Tests/RunCMake/GenerateExportHeader/libshared/libshared.cpp +++ b/Tests/RunCMake/GenerateExportHeader/libshared/libshared.cpp @@ -1,102 +1,117 @@ - #include "libshared.h" -int Libshared::libshared() const +int libshared::Class::method() const { return 0; } -int Libshared::libshared_exported() const +int libshared::Class::method_exported() const { return 0; } -int Libshared::libshared_deprecated() const +int libshared::Class::method_deprecated() const { return 0; } -int Libshared::libshared_not_exported() const +int libshared::Class::method_deprecated_exported() const { return 0; } -int Libshared::libshared_excluded() const +int libshared::Class::method_excluded() const { return 0; } -int LibsharedNotExported::libshared() const -{ - return 0; -} +int const libshared::Class::data = 1; -int LibsharedNotExported::libshared_exported() const +int const libshared::Class::data_exported = 1; + +int const libshared::Class::data_excluded = 1; + +int libshared::ExportedClass::method() const { return 0; } -int LibsharedNotExported::libshared_deprecated() const +int libshared::ExportedClass::method_deprecated() const { return 0; } -int LibsharedNotExported::libshared_not_exported() const +int libshared::ExportedClass::method_excluded() const { return 0; } -int LibsharedNotExported::libshared_excluded() const +int const libshared::ExportedClass::data = 1; + +int const libshared::ExportedClass::data_excluded = 1; + +int libshared::ExcludedClass::method() const { return 0; } -int LibsharedExcluded::libshared() const +int libshared::ExcludedClass::method_exported() const { return 0; } -int LibsharedExcluded::libshared_exported() const +int libshared::ExcludedClass::method_deprecated() const { return 0; } -int LibsharedExcluded::libshared_deprecated() const +int libshared::ExcludedClass::method_deprecated_exported() const { return 0; } -int LibsharedExcluded::libshared_not_exported() const +int libshared::ExcludedClass::method_excluded() const { return 0; } -int LibsharedExcluded::libshared_excluded() const +int const libshared::ExcludedClass::data = 1; + +int const libshared::ExcludedClass::data_exported = 1; + +int const libshared::ExcludedClass::data_excluded = 1; + +int libshared::function() { return 0; } -int libshared() +int libshared::function_exported() { return 0; } -int libshared_exported() +int libshared::function_deprecated() { return 0; } -int libshared_deprecated() +int libshared::function_deprecated_exported() { return 0; } -int libshared_not_exported() +int libshared::function_excluded() { return 0; } -int libshared_excluded() +int const libshared::data = 1; + +int const libshared::data_exported = 1; + +int const libshared::data_excluded = 1; + +void use_int(int) { - return 0; } diff --git a/Tests/RunCMake/GenerateExportHeader/libshared/libshared.h b/Tests/RunCMake/GenerateExportHeader/libshared/libshared.h index bd9f2e3..6574bd5 100644 --- a/Tests/RunCMake/GenerateExportHeader/libshared/libshared.h +++ b/Tests/RunCMake/GenerateExportHeader/libshared/libshared.h @@ -1,57 +1,82 @@ - #ifndef LIBSHARED_H #define LIBSHARED_H #include "libshared_export.h" -class LIBSHARED_EXPORT Libshared +namespace libshared { + +class Class { public: - int libshared() const; + int method() const; + + int LIBSHARED_EXPORT method_exported() const; + + int LIBSHARED_DEPRECATED method_deprecated() const; - int libshared_exported() const; + int LIBSHARED_DEPRECATED_EXPORT method_deprecated_exported() const; - int LIBSHARED_DEPRECATED libshared_deprecated() const; + int LIBSHARED_NO_EXPORT method_excluded() const; - int libshared_not_exported() const; + static int const data; - int LIBSHARED_NO_EXPORT libshared_excluded() const; + static int const LIBSHARED_EXPORT data_exported; + + static int const LIBSHARED_NO_EXPORT data_excluded; }; -class LibsharedNotExported +class LIBSHARED_EXPORT ExportedClass { public: - int libshared() const; + int method() const; - int LIBSHARED_EXPORT libshared_exported() const; + int LIBSHARED_DEPRECATED method_deprecated() const; - int LIBSHARED_DEPRECATED_EXPORT libshared_deprecated() const; + int LIBSHARED_NO_EXPORT method_excluded() const; - int libshared_not_exported() const; + static int const data; - int LIBSHARED_NO_EXPORT libshared_excluded() const; + static int const LIBSHARED_NO_EXPORT data_excluded; }; -class LIBSHARED_NO_EXPORT LibsharedExcluded +class LIBSHARED_NO_EXPORT ExcludedClass { public: - int libshared() const; + int method() const; + + int LIBSHARED_EXPORT method_exported() const; + + int LIBSHARED_DEPRECATED method_deprecated() const; - int LIBSHARED_EXPORT libshared_exported() const; + int LIBSHARED_DEPRECATED_EXPORT method_deprecated_exported() const; - int LIBSHARED_DEPRECATED_EXPORT libshared_deprecated() const; + int LIBSHARED_NO_EXPORT method_excluded() const; - int libshared_not_exported() const; + static int const data; - int LIBSHARED_NO_EXPORT libshared_excluded() const; + static int const LIBSHARED_EXPORT data_exported; + + static int const LIBSHARED_NO_EXPORT data_excluded; }; -LIBSHARED_EXPORT int libshared_exported(); +int function(); + +int LIBSHARED_EXPORT function_exported(); + +int LIBSHARED_DEPRECATED function_deprecated(); + +int LIBSHARED_DEPRECATED_EXPORT function_deprecated_exported(); + +int LIBSHARED_NO_EXPORT function_excluded(); + +extern int const data; + +extern int const LIBSHARED_EXPORT data_exported; -LIBSHARED_DEPRECATED_EXPORT int libshared_deprecated(); +extern int const LIBSHARED_NO_EXPORT data_excluded; -int libshared_not_exported(); +} // namespace libshared -int LIBSHARED_NO_EXPORT libshared_excluded(); +LIBSHARED_EXPORT void use_int(int); #endif diff --git a/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.cpp b/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.cpp index 89381af..e1d1255 100644 --- a/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.cpp +++ b/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.cpp @@ -1,97 +1,125 @@ - #include "libstatic.h" -int Libstatic::libstatic() const +int libstatic::Class::method() const { return 0; } -int Libstatic::libstatic_exported() const +int libstatic::Class::method_exported() const { return 0; } -int Libstatic::libstatic_deprecated() const +int libstatic::Class::method_deprecated() const { return 0; } -int Libstatic::libstatic_not_exported() const +int libstatic::Class::method_deprecated_exported() const { return 0; } -int Libstatic::libstatic_excluded() const +int libstatic::Class::method_excluded() const { return 0; } -int LibstaticNotExported::libstatic() const +int const libstatic::Class::data = 1; + +int const libstatic::Class::data_exported = 1; + +int const libstatic::Class::data_excluded = 1; + +int libstatic::ExportedClass::method() const { return 0; } -int LibstaticNotExported::libstatic_exported() const +int libstatic::ExportedClass::method_exported() const { return 0; } -int LibstaticNotExported::libstatic_deprecated() const +int libstatic::ExportedClass::method_deprecated() const { return 0; } -int LibstaticNotExported::libstatic_not_exported() const +int libstatic::ExportedClass::method_deprecated_exported() const { return 0; } -int LibstaticNotExported::libstatic_excluded() const +int libstatic::ExportedClass::method_excluded() const { return 0; } -int LibstaticExcluded::libstatic() const +int const libstatic::ExportedClass::data = 1; + +int const libstatic::ExportedClass::data_exported = 1; + +int const libstatic::ExportedClass::data_excluded = 1; + +int libstatic::ExcludedClass::method() const { return 0; } -int LibstaticExcluded::libstatic_exported() const +int libstatic::ExcludedClass::method_exported() const { return 0; } -int LibstaticExcluded::libstatic_deprecated() const +int libstatic::ExcludedClass::method_deprecated() const { return 0; } -int LibstaticExcluded::libstatic_not_exported() const +int libstatic::ExcludedClass::method_deprecated_exported() const { return 0; } -int LibstaticExcluded::libstatic_excluded() const +int libstatic::ExcludedClass::method_excluded() const { return 0; } -int libstatic_exported() +int const libstatic::ExcludedClass::data = 1; + +int const libstatic::ExcludedClass::data_exported = 1; + +int const libstatic::ExcludedClass::data_excluded = 1; + +int libstatic::function() +{ + return 0; +} + +int libstatic::function_exported() { return 0; } -int libstatic_deprecated() +int libstatic::function_deprecated() { return 0; } -int libstatic_not_exported() +int libstatic::function_deprecated_exported() { return 0; } -int libstatic_excluded() +int libstatic::function_excluded() { return 0; } + +int const libstatic::data = 1; + +int const libstatic::data_exported = 1; + +int const libstatic::data_excluded = 1; diff --git a/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.h b/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.h index 6072d9b..1017e12 100644 --- a/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.h +++ b/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.h @@ -1,57 +1,86 @@ - #ifndef LIBSTATIC_H #define LIBSTATIC_H #include "libstatic_export.h" -class LIBSTATIC_EXPORT Libstatic +namespace libstatic { + +class Class { public: - int libstatic() const; + int method() const; + + int LIBSTATIC_EXPORT method_exported() const; + + int LIBSTATIC_DEPRECATED method_deprecated() const; - int libstatic_exported() const; + int LIBSTATIC_DEPRECATED_EXPORT method_deprecated_exported() const; - int LIBSTATIC_DEPRECATED libstatic_deprecated() const; + int LIBSTATIC_NO_EXPORT method_excluded() const; - int libstatic_not_exported() const; + static int const data; - int LIBSTATIC_NO_EXPORT libstatic_excluded() const; + static int const LIBSTATIC_EXPORT data_exported; + + static int const LIBSTATIC_NO_EXPORT data_excluded; }; -class LibstaticNotExported +class LIBSTATIC_EXPORT ExportedClass { public: - int libstatic() const; + int method() const; + + int LIBSTATIC_EXPORT method_exported() const; + + int LIBSTATIC_DEPRECATED method_deprecated() const; + + int LIBSTATIC_DEPRECATED_EXPORT method_deprecated_exported() const; - int LIBSTATIC_EXPORT libstatic_exported() const; + int LIBSTATIC_NO_EXPORT method_excluded() const; - int LIBSTATIC_DEPRECATED libstatic_deprecated() const; + static int const data; - int libstatic_not_exported() const; + static int const LIBSTATIC_EXPORT data_exported; - int LIBSTATIC_NO_EXPORT libstatic_excluded() const; + static int const LIBSTATIC_NO_EXPORT data_excluded; }; -class LIBSTATIC_NO_EXPORT LibstaticExcluded +class LIBSTATIC_NO_EXPORT ExcludedClass { public: - int libstatic() const; + int method() const; - int LIBSTATIC_EXPORT libstatic_exported() const; + int LIBSTATIC_EXPORT method_exported() const; - int LIBSTATIC_DEPRECATED libstatic_deprecated() const; + int LIBSTATIC_DEPRECATED method_deprecated() const; - int libstatic_not_exported() const; + int LIBSTATIC_DEPRECATED_EXPORT method_deprecated_exported() const; - int LIBSTATIC_NO_EXPORT libstatic_excluded() const; + int LIBSTATIC_NO_EXPORT method_excluded() const; + + static int const data; + + static int const LIBSTATIC_EXPORT data_exported; + + static int const LIBSTATIC_NO_EXPORT data_excluded; }; -LIBSTATIC_EXPORT int libstatic_exported(); +int function(); + +int LIBSTATIC_EXPORT function_exported(); + +int LIBSTATIC_DEPRECATED function_deprecated(); + +int LIBSTATIC_DEPRECATED_EXPORT function_deprecated_exported(); + +int LIBSTATIC_NO_EXPORT function_excluded(); + +extern int const data; -LIBSTATIC_DEPRECATED_EXPORT int libstatic_deprecated(); +extern int const LIBSTATIC_EXPORT data_exported; -int libstatic_not_exported(); +extern int const LIBSTATIC_NO_EXPORT data_excluded; -int LIBSTATIC_NO_EXPORT libstatic_excluded(); +} // namespace libstatic #endif diff --git a/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake index 4d0a0a1..27250cb 100644 --- a/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorPlatform/RunCMakeTest.cmake @@ -3,7 +3,7 @@ include(RunCMake) set(RunCMake_GENERATOR_PLATFORM "") run_cmake(NoPlatform) -if("${RunCMake_GENERATOR}" MATCHES "^Visual Studio ([89]|1[0124])( 20[0-9][0-9])?$") +if("${RunCMake_GENERATOR}" MATCHES "^Visual Studio ([89]|1[01245])( 20[0-9][0-9])?$") set(RunCMake_GENERATOR_PLATFORM "x64") run_cmake(x64Platform) else() @@ -17,7 +17,7 @@ set(RunCMake_TEST_OPTIONS -A "Extra Platform") run_cmake(TwoPlatforms) unset(RunCMake_TEST_OPTIONS) -if("${RunCMake_GENERATOR}" MATCHES "^Visual Studio ([89]|1[0124])( 20[0-9][0-9])?$") +if("${RunCMake_GENERATOR}" MATCHES "^Visual Studio ([89]|1[01245])( 20[0-9][0-9])?$") set(RunCMake_TEST_OPTIONS -DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/TestPlatform-toolchain.cmake) run_cmake(TestPlatformToolchain) unset(RunCMake_TEST_OPTIONS) diff --git a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake index 6220657..283a2a0 100644 --- a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake @@ -3,7 +3,7 @@ include(RunCMake) set(RunCMake_GENERATOR_TOOLSET "") run_cmake(NoToolset) -if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[0124]|Xcode" AND NOT XCODE_BELOW_3) +if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[01245]|Xcode" AND NOT XCODE_BELOW_3) set(RunCMake_GENERATOR_TOOLSET "Test Toolset") run_cmake(TestToolset) else() @@ -17,7 +17,7 @@ set(RunCMake_TEST_OPTIONS -T "Extra Toolset") run_cmake(TwoToolsets) unset(RunCMake_TEST_OPTIONS) -if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[0124]|Xcode" AND NOT XCODE_BELOW_3) +if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[01245]|Xcode" AND NOT XCODE_BELOW_3) set(RunCMake_TEST_OPTIONS -DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/TestToolset-toolchain.cmake) run_cmake(TestToolsetToolchain) unset(RunCMake_TEST_OPTIONS) diff --git a/Tests/RunCMake/cmake_parse_arguments/ArgvN.cmake b/Tests/RunCMake/cmake_parse_arguments/ArgvN.cmake new file mode 100644 index 0000000..61bde03 --- /dev/null +++ b/Tests/RunCMake/cmake_parse_arguments/ArgvN.cmake @@ -0,0 +1,30 @@ +include(${CMAKE_CURRENT_LIST_DIR}/test_utils.cmake) + +function(test1) + cmake_parse_arguments(PARSE_ARGV 0 + pref "OPT1;OPT2" "SINGLE1;SINGLE2" "MULTI1;MULTI2") + + TEST(pref_OPT1 TRUE) + TEST(pref_OPT2 FALSE) + TEST(pref_SINGLE1 "foo;bar") + TEST(pref_SINGLE2 UNDEFINED) + TEST(pref_MULTI1 bar foo bar) + TEST(pref_MULTI2 UNDEFINED) + TEST(pref_UNPARSED_ARGUMENTS UNDEFINED) +endfunction() +test1(OPT1 SINGLE1 "foo;bar" MULTI1 bar foo bar) + +function(test2 arg1) + cmake_parse_arguments(PARSE_ARGV 1 + pref "OPT1;OPT2" "SINGLE1;SINGLE2" "MULTI1;MULTI2") + + TEST(arg1 "first named") + TEST(pref_OPT1 TRUE) + TEST(pref_OPT2 FALSE) + TEST(pref_SINGLE1 "foo;bar") + TEST(pref_SINGLE2 UNDEFINED) + TEST(pref_MULTI1 bar foo bar) + TEST(pref_MULTI2 UNDEFINED) + TEST(pref_UNPARSED_ARGUMENTS UNDEFINED) +endfunction() +test2("first named" OPT1 SINGLE1 "foo;bar" MULTI1 bar foo bar) diff --git a/Tests/RunCMake/cmake_parse_arguments/BadArgvN1-result.txt b/Tests/RunCMake/cmake_parse_arguments/BadArgvN1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_parse_arguments/BadArgvN1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_parse_arguments/BadArgvN1-stderr.txt b/Tests/RunCMake/cmake_parse_arguments/BadArgvN1-stderr.txt new file mode 100644 index 0000000..e44ab4d --- /dev/null +++ b/Tests/RunCMake/cmake_parse_arguments/BadArgvN1-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at BadArgvN1.cmake:[0-9]+ \(cmake_parse_arguments\): + PARSE_ARGV must be called with exactly 6 arguments. +Call Stack \(most recent call first\): + BadArgvN1.cmake:[0-9]+ \(test1\) + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/cmake_parse_arguments/BadArgvN1.cmake b/Tests/RunCMake/cmake_parse_arguments/BadArgvN1.cmake new file mode 100644 index 0000000..f894130 --- /dev/null +++ b/Tests/RunCMake/cmake_parse_arguments/BadArgvN1.cmake @@ -0,0 +1,4 @@ +function(test1) + cmake_parse_arguments(PARSE_ARGV 0 pref "" "" "" extra) +endfunction() +test1() diff --git a/Tests/RunCMake/cmake_parse_arguments/BadArgvN2-result.txt b/Tests/RunCMake/cmake_parse_arguments/BadArgvN2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_parse_arguments/BadArgvN2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_parse_arguments/BadArgvN2-stderr.txt b/Tests/RunCMake/cmake_parse_arguments/BadArgvN2-stderr.txt new file mode 100644 index 0000000..1dde86d --- /dev/null +++ b/Tests/RunCMake/cmake_parse_arguments/BadArgvN2-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at BadArgvN2.cmake:[0-9]+ \(cmake_parse_arguments\): + PARSE_ARGV index 'pref' is not an unsigned integer +Call Stack \(most recent call first\): + BadArgvN2.cmake:[0-9]+ \(test2\) + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/cmake_parse_arguments/BadArgvN2.cmake b/Tests/RunCMake/cmake_parse_arguments/BadArgvN2.cmake new file mode 100644 index 0000000..d20c2c8 --- /dev/null +++ b/Tests/RunCMake/cmake_parse_arguments/BadArgvN2.cmake @@ -0,0 +1,4 @@ +function(test2) + cmake_parse_arguments(PARSE_ARGV pref "" "" "" extra) +endfunction() +test2() diff --git a/Tests/RunCMake/cmake_parse_arguments/BadArgvN3-result.txt b/Tests/RunCMake/cmake_parse_arguments/BadArgvN3-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_parse_arguments/BadArgvN3-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_parse_arguments/BadArgvN3-stderr.txt b/Tests/RunCMake/cmake_parse_arguments/BadArgvN3-stderr.txt new file mode 100644 index 0000000..5a30dc9 --- /dev/null +++ b/Tests/RunCMake/cmake_parse_arguments/BadArgvN3-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at BadArgvN3.cmake:[0-9]+ \(cmake_parse_arguments\): + PARSE_ARGV called with ARGC='' that is not an unsigned integer +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/cmake_parse_arguments/BadArgvN3.cmake b/Tests/RunCMake/cmake_parse_arguments/BadArgvN3.cmake new file mode 100644 index 0000000..8fb3fdd --- /dev/null +++ b/Tests/RunCMake/cmake_parse_arguments/BadArgvN3.cmake @@ -0,0 +1 @@ +cmake_parse_arguments(PARSE_ARGV 0 pref "" "" "") diff --git a/Tests/RunCMake/cmake_parse_arguments/BadArgvN4-result.txt b/Tests/RunCMake/cmake_parse_arguments/BadArgvN4-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_parse_arguments/BadArgvN4-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_parse_arguments/BadArgvN4-stderr.txt b/Tests/RunCMake/cmake_parse_arguments/BadArgvN4-stderr.txt new file mode 100644 index 0000000..f4bdac4 --- /dev/null +++ b/Tests/RunCMake/cmake_parse_arguments/BadArgvN4-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at BadArgvN4.cmake:[0-9]+ \(cmake_parse_arguments\): + PARSE_ARGV called with ARGV0 not set +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/cmake_parse_arguments/BadArgvN4.cmake b/Tests/RunCMake/cmake_parse_arguments/BadArgvN4.cmake new file mode 100644 index 0000000..b887a28 --- /dev/null +++ b/Tests/RunCMake/cmake_parse_arguments/BadArgvN4.cmake @@ -0,0 +1,3 @@ +set(ARGC 1) +cmake_parse_arguments(PARSE_ARGV 0 pref "" "" "") +unset(ARGC) diff --git a/Tests/RunCMake/cmake_parse_arguments/RunCMakeTest.cmake b/Tests/RunCMake/cmake_parse_arguments/RunCMakeTest.cmake index b89f1a5..22d7ee4 100644 --- a/Tests/RunCMake/cmake_parse_arguments/RunCMakeTest.cmake +++ b/Tests/RunCMake/cmake_parse_arguments/RunCMakeTest.cmake @@ -5,3 +5,8 @@ run_cmake(Initialization) run_cmake(Mix) run_cmake(CornerCases) run_cmake(Errors) +run_cmake(ArgvN) +run_cmake(BadArgvN1) +run_cmake(BadArgvN2) +run_cmake(BadArgvN3) +run_cmake(BadArgvN4) diff --git a/Tests/RunCMake/file/DOWNLOAD-pass-not-set-result.txt b/Tests/RunCMake/file/DOWNLOAD-pass-not-set-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-pass-not-set-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/DOWNLOAD-pass-not-set-stderr.txt b/Tests/RunCMake/file/DOWNLOAD-pass-not-set-stderr.txt new file mode 100644 index 0000000..2fa2731 --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-pass-not-set-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at DOWNLOAD-pass-not-set.cmake:[0-9]+ \(file\): + file DOWNLOAD missing string for USERPWD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/DOWNLOAD-pass-not-set.cmake b/Tests/RunCMake/file/DOWNLOAD-pass-not-set.cmake new file mode 100644 index 0000000..61eff6d --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-pass-not-set.cmake @@ -0,0 +1 @@ +file(DOWNLOAD "" "" USERPWD) diff --git a/Utilities/Release/Cygwin/cygwin-patch.diff.in b/Tests/RunCMake/file/DOWNLOAD-unused-argument-result.txt index e69de29..e69de29 100644 --- a/Utilities/Release/Cygwin/cygwin-patch.diff.in +++ b/Tests/RunCMake/file/DOWNLOAD-unused-argument-result.txt diff --git a/Tests/RunCMake/file/DOWNLOAD-unused-argument-stderr.txt b/Tests/RunCMake/file/DOWNLOAD-unused-argument-stderr.txt new file mode 100644 index 0000000..82a78c9 --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-unused-argument-stderr.txt @@ -0,0 +1,5 @@ +^CMake Warning \(dev\) at DOWNLOAD-unused-argument.cmake:[0-9]+ \(file\): + Unexpected argument: JUNK +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/file/DOWNLOAD-unused-argument.cmake b/Tests/RunCMake/file/DOWNLOAD-unused-argument.cmake new file mode 100644 index 0000000..2e3fbe1 --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-unused-argument.cmake @@ -0,0 +1,5 @@ +file(DOWNLOAD + "file://${CMAKE_CURRENT_SOURCE_DIR}/DOWNLOAD-unused-argument.txt" + "${CMAKE_CURRENT_BINARY_DIR}/unused-argument.txt" + JUNK + ) diff --git a/Tests/RunCMake/file/DOWNLOAD-unused-argument.txt b/Tests/RunCMake/file/DOWNLOAD-unused-argument.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-unused-argument.txt diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake index 5f85bba..d8e9ce0 100644 --- a/Tests/RunCMake/file/RunCMakeTest.cmake +++ b/Tests/RunCMake/file/RunCMakeTest.cmake @@ -1,6 +1,10 @@ include(RunCMake) run_cmake(DOWNLOAD-hash-mismatch) +run_cmake(DOWNLOAD-unused-argument) +run_cmake(DOWNLOAD-pass-not-set) +run_cmake(UPLOAD-unused-argument) +run_cmake(UPLOAD-pass-not-set) run_cmake(INSTALL-DIRECTORY) run_cmake(INSTALL-MESSAGE-bad) run_cmake(FileOpenFailRead) diff --git a/Tests/RunCMake/file/UPLOAD-pass-not-set-result.txt b/Tests/RunCMake/file/UPLOAD-pass-not-set-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/UPLOAD-pass-not-set-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/UPLOAD-pass-not-set-stderr.txt b/Tests/RunCMake/file/UPLOAD-pass-not-set-stderr.txt new file mode 100644 index 0000000..089c0ad --- /dev/null +++ b/Tests/RunCMake/file/UPLOAD-pass-not-set-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at UPLOAD-pass-not-set.cmake:[0-9]+ \(file\): + file UPLOAD missing string for USERPWD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/UPLOAD-pass-not-set.cmake b/Tests/RunCMake/file/UPLOAD-pass-not-set.cmake new file mode 100644 index 0000000..4f3d86c --- /dev/null +++ b/Tests/RunCMake/file/UPLOAD-pass-not-set.cmake @@ -0,0 +1 @@ +file(UPLOAD "" "" USERPWD) diff --git a/Tests/RunCMake/file/UPLOAD-unused-argument-result.txt b/Tests/RunCMake/file/UPLOAD-unused-argument-result.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/file/UPLOAD-unused-argument-result.txt diff --git a/Tests/RunCMake/file/UPLOAD-unused-argument-stderr.txt b/Tests/RunCMake/file/UPLOAD-unused-argument-stderr.txt new file mode 100644 index 0000000..3c1b744 --- /dev/null +++ b/Tests/RunCMake/file/UPLOAD-unused-argument-stderr.txt @@ -0,0 +1,5 @@ +^CMake Warning \(dev\) at UPLOAD-unused-argument.cmake:[0-9]+ \(file\): + Unexpected argument: JUNK +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/file/UPLOAD-unused-argument.cmake b/Tests/RunCMake/file/UPLOAD-unused-argument.cmake new file mode 100644 index 0000000..94ac9ac --- /dev/null +++ b/Tests/RunCMake/file/UPLOAD-unused-argument.cmake @@ -0,0 +1,5 @@ +file(UPLOAD + "${CMAKE_CURRENT_SOURCE_DIR}/UPLOAD-unused-argument.txt" + "file://${CMAKE_CURRENT_BINARY_DIR}/unused-argument.txt" + JUNK + ) diff --git a/Tests/RunCMake/file/UPLOAD-unused-argument.txt b/Tests/RunCMake/file/UPLOAD-unused-argument.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/file/UPLOAD-unused-argument.txt diff --git a/Tests/VSExternalInclude/CMakeLists.txt b/Tests/VSExternalInclude/CMakeLists.txt index 20301c2..7465243 100644 --- a/Tests/VSExternalInclude/CMakeLists.txt +++ b/Tests/VSExternalInclude/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required (VERSION 2.6) project(VSExternalInclude) -if(${CMAKE_GENERATOR} MATCHES "Visual Studio 1[0124]") +if(${CMAKE_GENERATOR} MATCHES "Visual Studio 1[01245]") set(PROJECT_EXT vcxproj) else() set(PROJECT_EXT vcproj) @@ -55,7 +55,7 @@ add_dependencies(VSExternalInclude lib2) # and the sln file can no longer be the only source # of that depend. So, for VS 10 make the executable # depend on lib1 and lib2 -if(${CMAKE_GENERATOR} MATCHES "Visual Studio 1[0124]") +if(${CMAKE_GENERATOR} MATCHES "Visual Studio 1[01245]") add_dependencies(VSExternalInclude lib1) endif() diff --git a/Utilities/KWIML/Copyright.txt b/Utilities/KWIML/Copyright.txt index a6204b0..515c4eb 100644 --- a/Utilities/KWIML/Copyright.txt +++ b/Utilities/KWIML/Copyright.txt @@ -1,5 +1,5 @@ Kitware Information Macro Library -Copyright 2010-2015 Kitware, Inc. +Copyright 2010-2016 Kitware, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/Utilities/KWIML/include/kwiml/abi.h b/Utilities/KWIML/include/kwiml/abi.h index 3626361..5ffd542 100644 --- a/Utilities/KWIML/include/kwiml/abi.h +++ b/Utilities/KWIML/include/kwiml/abi.h @@ -1,6 +1,6 @@ /*============================================================================ Kitware Information Macro Library - Copyright 2010-2015 Kitware, Inc. + Copyright 2010-2016 Kitware, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -467,6 +467,10 @@ suppression macro KWIML_ABI_NO_VERIFY was defined. #elif defined(__XTENSA_EL__) # define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE +/* RISC-V */ +#elif defined(__riscv__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE + /* Unknown CPU */ #elif !defined(KWIML_ABI_NO_ERROR_ENDIAN) # error "Byte order of target CPU unknown." diff --git a/Utilities/KWIML/include/kwiml/int.h b/Utilities/KWIML/include/kwiml/int.h index b297ace..489c603 100644 --- a/Utilities/KWIML/include/kwiml/int.h +++ b/Utilities/KWIML/include/kwiml/int.h @@ -1,6 +1,6 @@ /*============================================================================ Kitware Information Macro Library - Copyright 2010-2015 Kitware, Inc. + Copyright 2010-2016 Kitware, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/Utilities/KWIML/src/version.h.in b/Utilities/KWIML/src/version.h.in index e58e0dc..0ac8854 100644 --- a/Utilities/KWIML/src/version.h.in +++ b/Utilities/KWIML/src/version.h.in @@ -1,6 +1,6 @@ /*============================================================================ Kitware Information Macro Library - Copyright 2010-2015 Kitware, Inc. + Copyright 2010-2016 Kitware, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/Utilities/Release/Cygwin/CMakeLists.txt b/Utilities/Release/Cygwin/CMakeLists.txt deleted file mode 100644 index 73a8220..0000000 --- a/Utilities/Release/Cygwin/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -file(GLOB INSTALLED_CURSES /usr/bin/cygncurses-*.dll) -set(MAX 0) -foreach(f ${INSTALLED_CURSES}) - if(NOT "${f}" MATCHES "\\+") - string(REGEX REPLACE ".*-([0-9]*).dll" "\\1" NUMBER "${f}") - if(NUMBER GREATER MAX) - set(MAX ${NUMBER}) - endif() - endif() -endforeach() -string(REGEX REPLACE "/usr/bin/" "\\1" NUMBER "${f}") -set(CMAKE_NCURSES_VERSION "libncurses${MAX}") -message(STATUS "Using curses version: libncurses${MAX}") -configure_file("${CMake_SOURCE_DIR}/Utilities/Release/Cygwin/cygwin-setup.hint.in" - "${CMake_BINARY_DIR}/setup.hint") -configure_file("${CMake_SOURCE_DIR}/Utilities/Release/Cygwin/README.cygwin.in" - "${CMake_BINARY_DIR}/Docs/${CPACK_PACKAGE_FILE_NAME}-${CPACK_CYGWIN_PATCH_NUMBER}.README") -install_files(/share/doc/Cygwin FILES - ${CMake_BINARY_DIR}/Docs/${CPACK_PACKAGE_FILE_NAME}-${CPACK_CYGWIN_PATCH_NUMBER}.README - ) -configure_file("${CMake_SOURCE_DIR}/Utilities/Release/Cygwin/cygwin-package.sh.in" - ${CPACK_CYGWIN_BUILD_SCRIPT}) -configure_file("${CMake_SOURCE_DIR}/Utilities/Release/Cygwin/cygwin-patch.diff.in" - ${CPACK_CYGWIN_PATCH_FILE}) - diff --git a/Utilities/Release/Cygwin/README.cygwin.in b/Utilities/Release/Cygwin/README.cygwin.in deleted file mode 100644 index 17cf2a1..0000000 --- a/Utilities/Release/Cygwin/README.cygwin.in +++ /dev/null @@ -1,42 +0,0 @@ -cmake --------------------------------------- -Runtime requirements: - cygwin-1.5.21(0.156/4/2) or newer - -Build requirements - cygwin-1.5.21(0.156/4/2) or newer - make - -Canonical homepage: - https://cmake.org - -Canonical download: - ftp://www.cmake.org/pub/cmake/ - ------------------------------------- - -Build instructions: - unpack @CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@-src.tar.bz2 - if you use setup to install this src package, it will be - unpacked under /usr/src automatically - cd /usr/src - ./@CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.sh all - -This will create: - /usr/src/@CPACK_PACKAGE_FILE_NAME@.tar.bz2 - /usr/src/@CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@-src.tar.bz2 - -------------------------------------------- - -Port Notes: - -The directory /usr/share/@CPACK_PACKAGE_FILE_NAME@/include is purposely not -located at /usr/include/@CPACK_PACKAGE_FILE_NAME@ or /usr/include/cmake. The -files it contains are not meant for inclusion in any C or C++ program. -They are used for compiling dynamically loadable CMake commands inside -projects that provide them. CMake will automatically provide the -proper include path when the files are needed. - ------------------- - -Cygwin port maintained by: CMake Developers <cmake@www.cmake.org> diff --git a/Utilities/Release/Cygwin/cygwin-package.sh.in b/Utilities/Release/Cygwin/cygwin-package.sh.in deleted file mode 100755 index dff27f1..0000000 --- a/Utilities/Release/Cygwin/cygwin-package.sh.in +++ /dev/null @@ -1,90 +0,0 @@ -TOP_DIR=`cd \`echo "$0" | sed -n '/\//{s/\/[^\/]*$//;p;}'\`;pwd` - -# create build directory -mkdirs() -{ - ( - mkdir -p "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" - ) -} - -# cd into -# untar source tree and apply patch -prep() -{ - ( - cd "$TOP_DIR" && - tar xvfj @CPACK_PACKAGE_FILE_NAME@.tar.bz2 - patch -p0 < "@CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.patch" && - mkdirs - ) -} - -conf() -{ - ( - cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" && - ../bootstrap --parallel=2 - ) -} - -build() -{ - ( - cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" && - make -j2 && - make test - ) -} - -clean() -{ - ( - cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" && - make clean - ) -} - -pkg() -{ - ( - cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" && - ./bin/cpack && - mv @CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.tar.bz2 "$TOP_DIR" - ) -} - -spkg() -{ - ( - cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" && - ./bin/cpack --config CPackSourceConfig.cmake && - mv @CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@-src.tar.bz2 "$TOP_DIR" - ) -} - -finish() -{ - ( - rm -rf "@CPACK_PACKAGE_FILE_NAME@" - ) -} - -case $1 in - prep) prep ; STATUS=$? ;; - mkdirs) mkdirs ; STATUS=$? ;; - conf) conf ; STATUS=$? ;; - build) build ; STATUS=$? ;; - clean) clean ; STATUS=$? ;; - package) pkg ; STATUS=$? ;; - pkg) pkg ; STATUS=$? ;; - src-package) spkg ; STATUS=$? ;; - spkg) spkg ; STATUS=$? ;; - finish) finish ; STATUS=$? ;; - all) ( - prep && conf && build && pkg && spkg && finish ; - STATUS=$? - ) ;; - *) echo "Error: bad argument (all or one of these: prep mkdirs conf build clean package pkg src-package spkg finish)" ; exit 1 ;; -esac -exit ${STATUS} diff --git a/Utilities/Release/Cygwin/cygwin-setup.hint.in b/Utilities/Release/Cygwin/cygwin-setup.hint.in deleted file mode 100644 index a2532fc..0000000 --- a/Utilities/Release/Cygwin/cygwin-setup.hint.in +++ /dev/null @@ -1,5 +0,0 @@ -# CMake setup.hint file for cygwin setup.exe program -category: Devel -requires: libgcc1 libidn11 @CMAKE_NCURSES_VERSION@ libstdc++6 -sdesc: "A cross platform build manager" -ldesc: "CMake is a cross platform build manager. It allows you to specify build parameters for C and C++ programs in a cross platform manner. For cygwin Makefiles will be generated. CMake is also capable of generating microsoft project files, nmake, and borland makefiles. CMake can also perform system inspection operations like finding installed libraries and header files." diff --git a/Utilities/Release/README b/Utilities/Release/README index 12eafe1..ed1d52e 100644 --- a/Utilities/Release/README +++ b/Utilities/Release/README @@ -15,7 +15,4 @@ Then as kitware@hythloth, using an up-to-date CMake: create-cmake-release.cmake: script to run to create release sh scripts Add or remove machines in create-cmake-release.cmake. -Cygwin -> directory that contains cpack cygwin package files used in - CMakeCPack.cmake - machine_release.cmake : config files for each machine diff --git a/Utilities/Release/create-cmake-release.cmake b/Utilities/Release/create-cmake-release.cmake index 192549ebc..7b144f1 100644 --- a/Utilities/Release/create-cmake-release.cmake +++ b/Utilities/Release/create-cmake-release.cmake @@ -12,7 +12,6 @@ set(RELEASE_SCRIPTS_BATCH_1 ) set(RELEASE_SCRIPTS_BATCH_2 - cygwin_release.cmake # Cygwin x86 win64_release.cmake # Windows x64 ) diff --git a/Utilities/Release/cygwin_release.cmake b/Utilities/Release/cygwin_release.cmake deleted file mode 100644 index ca3e794..0000000 --- a/Utilities/Release/cygwin_release.cmake +++ /dev/null @@ -1,32 +0,0 @@ -set(CMAKE_RELEASE_DIRECTORY "c:/cygwin/home/dashboard/CMakeReleaseCygwin") -set(PROCESSORS 9) -set(BOOTSTRAP_ARGS "") -set(MAKE_PROGRAM "make") -set(MAKE "${MAKE_PROGRAM} -j8") -set(HOST dash2win64) -set(CPACK_BINARY_GENERATORS "CygwinBinary") -set(CPACK_SOURCE_GENERATORS "CygwinSource") -set(MAKE_PROGRAM "make") -set(INITIAL_CACHE "CMAKE_BUILD_TYPE:STRING=Release -CMAKE_Fortran_COMPILER_FULLPATH:FILEPATH=FALSE -CTEST_TEST_TIMEOUT:STRING=7200 -DART_TESTING_TIMEOUT:STRING=7200 -SPHINX_HTML:BOOL=ON -SPHINX_MAN:BOOL=ON -CMake_INSTALL_DEPENDENCIES:BOOL=ON -") -set(CXX g++) -set(CC gcc) -set(GIT_EXTRA "git config core.autocrlf false") -get_filename_component(path "${CMAKE_CURRENT_LIST_FILE}" PATH) - -# WARNING: Temporary fix!! This exclusion of the ExternalProject test -# is temporary until we can set up a new cygwin build machine. -# It only fails because of cygwin/non-cygwin "svn" mismatches in this -# particular environment. This is less than ideal, but at least it -# allows us to produce cygwin builds in the short term. -set(EXTRA_CTEST_ARGS "-E ExternalProject") - -set(LOCAL_DIR cygwin) - -include(${path}/release_cmake.cmake) diff --git a/Utilities/Release/release_cmake.cmake b/Utilities/Release/release_cmake.cmake index 0d9c784..0db89b5 100644 --- a/Utilities/Release/release_cmake.cmake +++ b/Utilities/Release/release_cmake.cmake @@ -108,10 +108,6 @@ foreach(gen ${generators}) if("${gen}" STREQUAL "TBZ2") set(SUFFIXES ${SUFFIXES} "*.tar.bz2") endif() - if("${gen}" MATCHES "Cygwin") - set(SUFFIXES ${SUFFIXES} "*.tar.bz2") - set(extra_files setup.hint) - endif() if("${gen}" STREQUAL "TZ") set(SUFFIXES ${SUFFIXES} "*.tar.Z") endif() diff --git a/Utilities/Scripts/update-kwiml.bash b/Utilities/Scripts/update-kwiml.bash index 5c0d192..4497c92 100755 --- a/Utilities/Scripts/update-kwiml.bash +++ b/Utilities/Scripts/update-kwiml.bash @@ -7,7 +7,7 @@ shopt -s dotglob readonly name="KWIML" readonly ownership="KWIML Upstream <kwrobot@kitware.com>" readonly subtree="Utilities/KWIML" -readonly repo="https://github.com/Kitware/KWIML.git" +readonly repo="https://gitlab.kitware.com/utils/kwiml.git" readonly tag="master" readonly shortlog=true readonly paths=" diff --git a/Utilities/cmcurl/lib/vtls/nss.c b/Utilities/cmcurl/lib/vtls/nss.c index ad33f25..e467360 100644 --- a/Utilities/cmcurl/lib/vtls/nss.c +++ b/Utilities/cmcurl/lib/vtls/nss.c @@ -1004,10 +1004,10 @@ static SECStatus SelectClientCert(void *arg, PRFileDesc *sock, struct ssl_connect_data *connssl = (struct ssl_connect_data *)arg; struct Curl_easy *data = connssl->data; const char *nickname = connssl->client_nickname; + static const char pem_slotname[] = "PEM Token #1"; if(connssl->obj_clicert) { /* use the cert/key provided by PEM reader */ - static const char pem_slotname[] = "PEM Token #1"; SECItem cert_der = { 0, NULL, 0 }; void *proto_win = SSL_RevealPinArg(sock); struct CERTCertificateStr *cert; @@ -1069,6 +1069,12 @@ static SECStatus SelectClientCert(void *arg, PRFileDesc *sock, if(NULL == nickname) nickname = "[unknown]"; + if(!strncmp(nickname, pem_slotname, sizeof(pem_slotname) - 1U)) { + failf(data, "NSS: refusing previously loaded certificate from file: %s", + nickname); + return SECFailure; + } + if(NULL == *pRetKey) { failf(data, "NSS: private key not found for certificate: %s", nickname); return SECFailure; diff --git a/Utilities/cmlibuv/CMakeLists.txt b/Utilities/cmlibuv/CMakeLists.txt index e25ac82..1b384b5 100644 --- a/Utilities/cmlibuv/CMakeLists.txt +++ b/Utilities/cmlibuv/CMakeLists.txt @@ -168,6 +168,9 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux") endif() if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") + list(APPEND uv_libraries + kvm + ) list(APPEND uv_headers include/uv-bsd.h ) @@ -178,6 +181,9 @@ if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") endif() if(CMAKE_SYSTEM_NAME STREQUAL "NetBSD") + list(APPEND uv_libraries + kvm + ) list(APPEND uv_headers include/uv-bsd.h ) @@ -188,6 +194,9 @@ if(CMAKE_SYSTEM_NAME STREQUAL "NetBSD") endif() if(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") + list(APPEND uv_libraries + kvm + ) list(APPEND uv_headers include/uv-bsd.h ) |