diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake index a0aadcc9f..320327999 100644 --- a/CMakeCPack.cmake +++ b/CMakeCPack.cmake @@ -198,6 +198,17 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") set(CPACK_WIX_UPGRADE_GUID "8ffd1d72-b7f1-11e2-8ee5-00238bca4991") + if(MSVC AND NOT "$ENV{WIX}" STREQUAL "") + set(WIX_CUSTOM_ACTION_ENABLED TRUE) + if(CMAKE_CONFIGURATION_TYPES) + set(WIX_CUSTOM_ACTION_MULTI_CONFIG TRUE) + else() + set(WIX_CUSTOM_ACTION_MULTI_CONFIG FALSE) + endif() + else() + set(WIX_CUSTOM_ACTION_ENABLED FALSE) + endif() + # Set the options file that needs to be included inside CMakeCPackOptions.cmake set(QT_DIALOG_CPACK_OPTIONS_FILE ${CMake_BINARY_DIR}/Source/QtDialog/QtDialogCPack.cmake) configure_file("${CMake_SOURCE_DIR}/CMakeCPackOptions.cmake.in" diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in index ae006536d..59ae224ea 100644 --- a/CMakeCPackOptions.cmake.in +++ b/CMakeCPackOptions.cmake.in @@ -194,9 +194,9 @@ if("${CPACK_GENERATOR}" STREQUAL "WIX") # Reset CPACK_PACKAGE_VERSION to deal with WiX restriction. # But the file names still use the full CMake_VERSION value: set(CPACK_PACKAGE_FILE_NAME - "${CPACK_PACKAGE_NAME}-@CMake_VERSION@-${CPACK_SYSTEM_NAME}") + "cmake-@CMake_VERSION@-${CPACK_SYSTEM_NAME}") set(CPACK_SOURCE_PACKAGE_FILE_NAME - "${CPACK_PACKAGE_NAME}-@CMake_VERSION@-Source") + "cmake-@CMake_VERSION@") if(NOT CPACK_WIX_SIZEOF_VOID_P) set(CPACK_WIX_SIZEOF_VOID_P "@CMAKE_SIZEOF_VOID_P@") @@ -234,10 +234,57 @@ if("${CPACK_GENERATOR}" STREQUAL "WIX") set(CPACK_WIX_LIGHT_EXTRA_FLAGS "-dcl:high") set(CPACK_WIX_UI_BANNER - "@CMake_SOURCE_DIR@/Utilities/Release/cpack_wix_ui_banner.jpg" + "@CMake_SOURCE_DIR@/Utilities/Release/WiX/ui_banner.jpg" ) set(CPACK_WIX_UI_DIALOG - "@CMake_SOURCE_DIR@/Utilities/Release/cpack_wix_ui_dialog.jpg" + "@CMake_SOURCE_DIR@/Utilities/Release/WiX/ui_dialog.jpg" ) + + set(CPACK_WIX_EXTRA_SOURCES + "@CMake_SOURCE_DIR@/Utilities/Release/WiX/install_dir.wxs" + "@CMake_SOURCE_DIR@/Utilities/Release/WiX/cmake_extra_dialog.wxs" + ) + + set(_WIX_CUSTOM_ACTION_ENABLED "@WIX_CUSTOM_ACTION_ENABLED@") + if(_WIX_CUSTOM_ACTION_ENABLED) + list(APPEND CPACK_WIX_EXTRA_SOURCES + "@CMake_SOURCE_DIR@/Utilities/Release/WiX/cmake_nsis_overwrite_dialog.wxs" + ) + list(APPEND CPACK_WIX_CANDLE_EXTRA_FLAGS -dCHECK_NSIS=1) + + set(_WIX_CUSTOM_ACTION_MULTI_CONFIG "@WIX_CUSTOM_ACTION_MULTI_CONFIG@") + if(_WIX_CUSTOM_ACTION_MULTI_CONFIG) + if(CPACK_BUILD_CONFIG) + set(_WIX_CUSTOM_ACTION_CONFIG "${CPACK_BUILD_CONFIG}") + else() + set(_WIX_CUSTOM_ACTION_CONFIG "Release") + endif() + + list(APPEND CPACK_WIX_EXTRA_SOURCES + "@CMake_BINARY_DIR@/Utilities/Release/WiX/custom_action_dll-${_WIX_CUSTOM_ACTION_CONFIG}.wxs") + else() + list(APPEND CPACK_WIX_EXTRA_SOURCES + "@CMake_BINARY_DIR@/Utilities/Release/WiX/custom_action_dll.wxs") + endif() + endif() + + set(CPACK_WIX_UI_REF "CMakeUI_InstallDir") + + set(CPACK_WIX_PATCH_FILE + "@CMake_SOURCE_DIR@/Utilities/Release/WiX/patch_path_env.xml" + ) + + set(CPACK_WIX_TEMPLATE + "@CMake_SOURCE_DIR@/Utilities/Release/WiX/WIX.template.in" + ) + + set(BUILD_QtDialog "@BUILD_QtDialog@") + + if(BUILD_QtDialog) + list(APPEND CPACK_WIX_PATCH_FILE + "@CMake_SOURCE_DIR@/Utilities/Release/WiX/patch_desktop_shortcut.xml" + ) + list(APPEND CPACK_WIX_CANDLE_EXTRA_FLAGS -dBUILD_QtDialog=1) + endif() endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index ebee14b66..9381f357f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -138,8 +138,13 @@ macro(CMAKE_HANDLE_SYSTEM_LIBRARIES) option(CMAKE_USE_SYSTEM_FORM "Use system-installed libform" "${CMAKE_USE_SYSTEM_LIBRARY_FORM}") option(CMAKE_USE_SYSTEM_JSONCPP "Use system-installed jsoncpp" "${CMAKE_USE_SYSTEM_LIBRARY_JSONCPP}") + # For now use system KWIML only if explicitly requested rather + # than activating via the general system libs options. + option(CMAKE_USE_SYSTEM_KWIML "Use system-installed KWIML" OFF) + mark_as_advanced(CMAKE_USE_SYSTEM_KWIML) + # Mention to the user what system libraries are being used. - foreach(util ${UTILITIES}) + foreach(util ${UTILITIES} KWIML) if(CMAKE_USE_SYSTEM_${util}) message(STATUS "Using system-installed ${util}") endif() @@ -270,6 +275,20 @@ macro (CMAKE_BUILD_UTILITIES) # (a macro defined in this file) CMAKE_HANDLE_SYSTEM_LIBRARIES() + if(CMAKE_USE_SYSTEM_KWIML) + find_package(KWIML 1.0) + if(NOT KWIML_FOUND) + message(FATAL_ERROR "CMAKE_USE_SYSTEM_KWIML is ON but KWIML is not found!") + endif() + set(CMake_KWIML_LIBRARIES kwiml::kwiml) + else() + set(CMake_KWIML_LIBRARIES "") + if(BUILD_TESTING) + set(KWIML_TEST_ENABLE 1) + endif() + add_subdirectory(Utilities/KWIML) + endif() + #--------------------------------------------------------------------- # Build zlib library for Curl, CMake, and CTest. set(CMAKE_ZLIB_HEADER "cm_zlib.h") @@ -538,10 +557,10 @@ if("x${CMAKE_TESTS_CDASH_SERVER}" STREQUAL "x") set(CMAKE_TESTS_CDASH_SERVER "http://open.cdash.org") endif() -# Create the KWIML library for CMake. -set(KWIML cmIML) -set(KWIML_HEADER_ROOT ${CMake_BINARY_DIR}/Utilities) -add_subdirectory(Utilities/KWIML) +if(CMake_TEST_EXTERNAL_CMAKE) + set(KWIML_TEST_ENABLE 1) + add_subdirectory(Utilities/KWIML) +endif() if(NOT CMake_TEST_EXTERNAL_CMAKE) # build the utilities (a macro defined in this file) diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index 2adf317a6..abef69214 100644 --- a/CTestCustom.cmake.in +++ b/CTestCustom.cmake.in @@ -21,7 +21,8 @@ list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION "Utilities.cmcurl" "Utilities.cmexpat." "Utilities.cmlibarchive" - "/usr/include.*warning.*shadowed declaration is here" + "warning: declaration of .single. shadows a global declaration" + "/usr/include.*(warning|note).*shadowed declaration is here" "/usr/bin/ld.*warning.*-..*directory.name.*bin.*does not exist" "Redeclaration of .send..... with a different storage class specifier" "is not used for resolving any symbol" @@ -36,7 +37,7 @@ list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION "LINK : warning LNK4089: all references to.*SHELL32.dll.*discarded by /OPT:REF" "LINK : warning LNK4089: all references to.*USER32.dll.*discarded by /OPT:REF" "LINK : warning LNK4089: all references to.*ole32.dll.*discarded by /OPT:REF" - "Warning.*: .*/Utilities/KWIML/test/test_INT_format.h.* # Redundant preprocessing concatenation" + "Warning.*: .*/Utilities/KWIML/test/test_int_format.h.* # Redundant preprocessing concatenation" "Warning: library was too large for page size.*" "Warning: public.*_archive_.*in module.*archive_*clashes with prior module.*archive_.*" "Warning: public.*BZ2_bz.*in module.*bzlib.*clashes with prior module.*bzlib.*" diff --git a/Copyright.txt b/Copyright.txt index 6c9fb0934..f99998fe7 100644 --- a/Copyright.txt +++ b/Copyright.txt @@ -1,5 +1,5 @@ CMake - Cross Platform Makefile Generator -Copyright 2000-2015 Kitware, Inc. +Copyright 2000-2016 Kitware, Inc. Copyright 2000-2011 Insight Software Consortium All rights reserved. diff --git a/Help/command/add_custom_command.rst b/Help/command/add_custom_command.rst index ecbf9ddc3..8726b709e 100644 --- a/Help/command/add_custom_command.rst +++ b/Help/command/add_custom_command.rst @@ -178,7 +178,7 @@ target is already built, the command will not execute. :: - add_custom_command(TARGET target + add_custom_command(TARGET PRE_BUILD | PRE_LINK | POST_BUILD COMMAND command1 [ARGS] [args1...] [COMMAND command2 [ARGS] [args2...] ...] @@ -188,7 +188,10 @@ target is already built, the command will not execute. [VERBATIM] [USES_TERMINAL]) This defines a new command that will be associated with building the -specified target. When the command will happen is determined by which +specified ````. The ```` must be defined in the current +directory; targets defined in other directories may not be specified. + +When the command will happen is determined by which of the following is specified: ``PRE_BUILD`` diff --git a/Help/command/cmake_minimum_required.rst b/Help/command/cmake_minimum_required.rst index 857321817..dc65a9e68 100644 --- a/Help/command/cmake_minimum_required.rst +++ b/Help/command/cmake_minimum_required.rst @@ -5,7 +5,7 @@ Set the minimum required version of cmake for a project. :: - cmake_minimum_required(VERSION major[.minor[.patch[.tweak]]] + cmake_minimum_required(VERSION major.minor[.patch[.tweak]] [FATAL_ERROR]) If the current version of CMake is lower than that required it will diff --git a/Help/command/cmake_parse_arguments.rst b/Help/command/cmake_parse_arguments.rst new file mode 100644 index 000000000..6206611d2 --- /dev/null +++ b/Help/command/cmake_parse_arguments.rst @@ -0,0 +1,85 @@ +cmake_parse_arguments +--------------------- + +``cmake_parse_arguments`` is intended to be used in macros or functions for +parsing the arguments given to that macro or function. It processes the +arguments and defines a set of variables which hold the values of the +respective options. + +:: + + cmake_parse_arguments( + args...) + + +The ```` argument contains all options for the respective macro, +i.e. keywords which can be used when calling the macro without any value +following, like e.g. the ``OPTIONAL`` keyword of the :command:`install` +command. + +The ```` argument contains all keywords for this macro +which are followed by one value, like e.g. ``DESTINATION`` keyword of the +:command:`install` command. + +The ```` argument contains all keywords for this +macro which can be followed by more than one value, like e.g. the +``TARGETS`` or ``FILES`` keywords of the :command:`install` command. + +.. note:: + + All keywords shall be unique. I.e. every keyword shall only be specified + once in either ````, ```` or + ````. A warning will be emitted if uniqueness is + violated. + +When done, ``cmake_parse_arguments`` will have defined for each of the +keywords listed in ````, ```` and +```` a variable composed of the given ```` +followed by ``"_"`` and the name of the respective keyword. These +variables will then hold the respective value from the argument list. +For the ```` keywords this will be ``TRUE`` or ``FALSE``. + +All remaining arguments are collected in a variable +``_UNPARSED_ARGUMENTS``, this can be checked afterwards to see +whether your macro was called with unrecognized parameters. + +As an example here a ``my_install()`` macro, which takes similar arguments +as the real :command:`install` command: + +.. code-block:: cmake + + function(MY_INSTALL) + set(options OPTIONAL FAST) + set(oneValueArgs DESTINATION RENAME) + set(multiValueArgs TARGETS CONFIGURATIONS) + cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" + "${multiValueArgs}" ${ARGN} ) + + # ... + +Assume ``my_install()`` has been called like this: + +.. code-block:: cmake + + my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub) + +After the ``cmake_parse_arguments`` call the macro will have set the +following variables:: + + MY_INSTALL_OPTIONAL = TRUE + MY_INSTALL_FAST = FALSE (was not used in call to my_install) + MY_INSTALL_DESTINATION = "bin" + MY_INSTALL_RENAME = "" (was not used) + MY_INSTALL_TARGETS = "foo;bar" + MY_INSTALL_CONFIGURATIONS = "" (was not used) + MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (nothing expected after "OPTIONAL") + +You can then continue and process these variables. + +Keywords terminate lists of values, e.g. if directly after a +one_value_keyword another recognized keyword follows, this is +interpreted as the beginning of the new option. E.g. +``my_install(TARGETS foo DESTINATION OPTIONAL)`` would result in +``MY_INSTALL_DESTINATION`` set to ``"OPTIONAL"``, but as ``OPTIONAL`` +is a keyword itself ``MY_INSTALL_DESTINATION`` will be empty and +``MY_INSTALL_OPTIONAL`` will therefore be set to ``TRUE``. diff --git a/Help/command/get_target_property.rst b/Help/command/get_target_property.rst index 779825299..2a72c3af7 100644 --- a/Help/command/get_target_property.rst +++ b/Help/command/get_target_property.rst @@ -13,6 +13,6 @@ the variable ``VAR``. If the property is not found, ``VAR`` will be set to Properties are usually used to control how a target is built, but some query the target instead. This command can get properties for any target so far created. The targets do not need to be in the current -CMakeLists.txt file. +``CMakeLists.txt`` file. See also the more general :command:`get_property` command. diff --git a/Help/command/if.rst b/Help/command/if.rst index 2465bde38..56e618c31 100644 --- a/Help/command/if.rst +++ b/Help/command/if.rst @@ -67,9 +67,10 @@ Possible expressions are: True if the given name is an existing policy (of the form ``CMP``). ``if(TARGET target-name)`` - True if the given name is an existing logical target name such as those - created by the :command:`add_executable`, :command:`add_library`, or - :command:`add_custom_target` commands. + True if the given name is an existing logical target name created + by a call to the :command:`add_executable`, :command:`add_library`, + or :command:`add_custom_target` command that has already been invoked + (in any directory). ``if(TEST test-name)`` True if the given name is an existing test name created by the @@ -80,7 +81,7 @@ Possible expressions are: only for full paths. ``if(file1 IS_NEWER_THAN file2)`` - True if file1 is newer than file2 or if one of the two files doesn't + True if ``file1`` is newer than ``file2`` or if one of the two files doesn't exist. Behavior is well-defined only for full paths. If the file time stamps are exactly the same, an ``IS_NEWER_THAN`` comparison returns true, so that any dependent build operations will occur in the event diff --git a/Help/command/install.rst b/Help/command/install.rst index 423899e26..45167bc19 100644 --- a/Help/command/install.rst +++ b/Help/command/install.rst @@ -72,12 +72,13 @@ Installing Targets [[ARCHIVE|LIBRARY|RUNTIME|FRAMEWORK|BUNDLE| PRIVATE_HEADER|PUBLIC_HEADER|RESOURCE] [DESTINATION ] - [INCLUDES DESTINATION [ ...]] [PERMISSIONS permissions...] [CONFIGURATIONS [Debug|Release|...]] [COMPONENT ] [OPTIONAL] [NAMELINK_ONLY|NAMELINK_SKIP] - ] [...]) + ] [...] + [INCLUDES DESTINATION [ ...]] + ) The ``TARGETS`` form specifies rules for installing targets from a project. There are five kinds of target files that may be installed: @@ -97,11 +98,7 @@ change the type of target to which the subsequent properties apply. If none is given the installation properties apply to all target types. If only one is given then only targets of that type will be installed (which can be used to install just a DLL or just an import -library). The ``INCLUDES DESTINATION`` specifies a list of directories -which will be added to the :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` -target property of the ```` when exported by the -:command:`install(EXPORT)` command. If a relative path is -specified, it is treated as relative to the ``$``. +library). The ``PRIVATE_HEADER``, ``PUBLIC_HEADER``, and ``RESOURCE`` arguments cause subsequent properties to be applied to installing a ``FRAMEWORK`` @@ -131,6 +128,14 @@ option installs nothing. See the :prop_tgt:`VERSION` and :prop_tgt:`SOVERSION` target properties for details on creating versioned shared libraries. +The ``INCLUDES DESTINATION`` specifies a list of directories +which will be added to the :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` +target property of the ```` when exported by the +:command:`install(EXPORT)` command. If a relative path is +specified, it is treated as relative to the ``$``. +This is independent of the rest of the argument groups and does +not actually install anything. + One or more groups of properties may be specified in a single call to the ``TARGETS`` form of this command. A target may be installed more than once to different locations. Consider hypothetical targets ``myExe``, @@ -271,9 +276,10 @@ will install the ``icons`` directory to ``share/myproj/icons`` and the file permissions, the scripts will be given specific permissions, and any ``CVS`` directories will be excluded. -The install destination given to the directory install ``DESTINATION`` may -use "generator expressions" with the syntax ``$<...>``. See the -:manual:`cmake-generator-expressions(7)` manual for available expressions. +The list of ``dirs...`` given to ``DIRECTORY`` and the install destination +given to the directory install ``DESTINATION`` may use "generator expressions" +with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` +manual for available expressions. Custom Installation Logic ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/Help/manual/OPTIONS_BUILD.txt b/Help/manual/OPTIONS_BUILD.txt index 977264c7d..b428a74d7 100644 --- a/Help/manual/OPTIONS_BUILD.txt +++ b/Help/manual/OPTIONS_BUILD.txt @@ -86,6 +86,18 @@ Enable warnings that are meant for the author of the CMakeLists.txt files. By default this will also turn on deprecation warnings. +``-Werror=dev`` + Make developer warnings errors. + + Make warnings that are meant for the author of the CMakeLists.txt files + errors. By default this will also turn on deprecated warnings as errors. + +``-Wno-error=dev`` + Make developer warnings not errors. + + Make warnings that are meant for the author of the CMakeLists.txt files not + errors. By default this will also turn off deprecated warnings as errors. + ``-Wdeprecated`` Enable deprecated functionality warnings. @@ -97,3 +109,15 @@ Suppress warnings for usage of deprecated functionality, that are meant for the author of the CMakeLists.txt files. + +``-Werror=deprecated`` + Make deprecated macro and function warnings errors. + + Make warnings for usage of deprecated macros and functions, that are meant + for the author of the CMakeLists.txt files, errors. + +``-Wno-error=deprecated`` + Make deprecated macro and function warnings not errors. + + Make warnings for usage of deprecated macros and functions, that are meant + for the author of the CMakeLists.txt files, not errors. diff --git a/Help/manual/cmake-buildsystem.7.rst b/Help/manual/cmake-buildsystem.7.rst index 4a04f3145..9004bb26e 100644 --- a/Help/manual/cmake-buildsystem.7.rst +++ b/Help/manual/cmake-buildsystem.7.rst @@ -427,7 +427,7 @@ specified will be calculated: ) add_library(lib1Version3 SHARED lib1_v3.cpp) - set_property(TARGET lib1Version2 PROPERTY INTERFACE_CONTAINER_SIZE_REQUIRED 1000) + set_property(TARGET lib1Version3 PROPERTY INTERFACE_CONTAINER_SIZE_REQUIRED 1000) add_executable(exe1 exe1.cpp) # CONTAINER_SIZE_REQUIRED will be "200" diff --git a/Help/manual/cmake-commands.7.rst b/Help/manual/cmake-commands.7.rst index 5b92b5156..d0c298659 100644 --- a/Help/manual/cmake-commands.7.rst +++ b/Help/manual/cmake-commands.7.rst @@ -29,6 +29,7 @@ These commands may be used freely in CMake projects. /command/build_command /command/cmake_host_system_information /command/cmake_minimum_required + /command/cmake_parse_arguments /command/cmake_policy /command/configure_file /command/continue diff --git a/Help/manual/cmake-developer.7.rst b/Help/manual/cmake-developer.7.rst index a33538404..7bfdcadcb 100644 --- a/Help/manual/cmake-developer.7.rst +++ b/Help/manual/cmake-developer.7.rst @@ -718,7 +718,7 @@ same consideration applies to macros, functions and imported targets. If False, do not try to use the relevant CMake wrapping command. ``Xxx_Yy_FOUND`` - If False, optional Yy part of Xxx sytem is not available. + If False, optional Yy part of Xxx system is not available. ``Xxx_FOUND`` Set to false, or undefined, if we haven't found, or don't want to use diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst index c9219d5e2..10f05dffe 100644 --- a/Help/manual/cmake-modules.7.rst +++ b/Help/manual/cmake-modules.7.rst @@ -213,6 +213,7 @@ All Modules /module/FindwxWidgets /module/FindwxWindows /module/FindXCTest + /module/FindXalanC /module/FindXercesC /module/FindX11 /module/FindXMLRPC diff --git a/Help/manual/cmake-packages.7.rst b/Help/manual/cmake-packages.7.rst index b9073a57c..aebc5d952 100644 --- a/Help/manual/cmake-packages.7.rst +++ b/Help/manual/cmake-packages.7.rst @@ -89,7 +89,7 @@ a package is to set the ``CMAKE_PREFIX_PATH`` cache variable. Config-file packages are provided by upstream vendors as part of development packages, that is, they belong with the header files and any other files -provided to assist downsteams in using the package. +provided to assist downstreams in using the package. A set of variables which provide package status information are also set automatically when using a config-file package. The ``_FOUND`` @@ -352,7 +352,7 @@ version-specific variables ``_VERSION``, ``_VERSION_MAJOR``, used to export the targets in the ``ClimbingStatsTargets`` export-set, defined previously by the :command:`install(TARGETS)` command. This command generates the ``ClimbingStatsTargets.cmake`` file to contain :prop_tgt:`IMPORTED` -targets, suitable for use by downsteams and arranges to install it to +targets, suitable for use by downstreams and arranges to install it to ``lib/cmake/ClimbingStats``. The generated ``ClimbingStatsConfigVersion.cmake`` and a ``cmake/ClimbingStatsConfig.cmake`` are installed to the same location, completing the package. @@ -383,7 +383,7 @@ In this case, when using :command:`install(TARGETS)` the ``INCLUDES DESTINATION` was specified. This causes the ``IMPORTED`` targets to have their :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` populated with the ``include`` directory in the :variable:`CMAKE_INSTALL_PREFIX`. When the ``IMPORTED`` -target is used by downsteam, it automatically consumes the entries from +target is used by downstream, it automatically consumes the entries from that property. Creating a Package Configuration File @@ -412,7 +412,7 @@ This can also be extended to cover dependencies: target_link_libraries(ClimbingStats PUBLIC Stats::Types) As the ``Stats::Types`` target is a ``PUBLIC`` dependency of ``ClimbingStats``, -downsteams must also find the ``Stats`` package and link to the ``Stats::Types`` +downstreams must also find the ``Stats`` package and link to the ``Stats::Types`` library. The ``Stats`` package should be found in the ``ClimbingStatsConfig.cmake`` file to ensure this. The ``find_dependency`` macro from the :module:`CMakeFindDependencyMacro` helps with this by propagating @@ -464,7 +464,7 @@ Creating a Package Configuration File for the Build Tree The :command:`export(EXPORT)` command creates an :prop_tgt:`IMPORTED` targets definition file which is specific to the build-tree, and is not relocatable. -This can similiarly be used with a suitable package configuration file and +This can similarly be used with a suitable package configuration file and package version file to define a package for the build tree which may be used without installation. Consumers of the build tree can simply ensure that the :variable:`CMAKE_PREFIX_PATH` contains the build directory, or set the diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 931363c83..a41d48499 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -191,6 +191,7 @@ Properties on Targets /prop_tgt/INTERFACE_SYSTEM_INCLUDE_DIRECTORIES /prop_tgt/INTERPROCEDURAL_OPTIMIZATION_CONFIG /prop_tgt/INTERPROCEDURAL_OPTIMIZATION + /prop_tgt/IOS_INSTALL_COMBINED /prop_tgt/JOB_POOL_COMPILE /prop_tgt/JOB_POOL_LINK /prop_tgt/LABELS diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 211690050..15eaece95 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -118,6 +118,7 @@ Variables that Change Behavior /variable/CMAKE_DISABLE_FIND_PACKAGE_PackageName /variable/CMAKE_ERROR_DEPRECATED /variable/CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION + /variable/CMAKE_EXPORT_COMPILE_COMMANDS /variable/CMAKE_EXPORT_NO_PACKAGE_REGISTRY /variable/CMAKE_SYSROOT /variable/CMAKE_FIND_APPBUNDLE @@ -257,6 +258,7 @@ Variables that Control the Build /variable/CMAKE_INSTALL_NAME_DIR /variable/CMAKE_INSTALL_RPATH /variable/CMAKE_INSTALL_RPATH_USE_LINK_PATH + /variable/CMAKE_IOS_INSTALL_COMBINED /variable/CMAKE_LANG_COMPILER_LAUNCHER /variable/CMAKE_LANG_INCLUDE_WHAT_YOU_USE /variable/CMAKE_LANG_VISIBILITY_PRESET diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index dac16bf3f..92f52302c 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -167,16 +167,23 @@ Available commands are: Change the current working directory and run a command. ``compare_files `` - Check if file1 is same as file2. + Check if ```` is same as ````. If files are the same, + then returns 0, if not itreturns 1. -``copy `` - Copy file to destination (either file or directory). +``copy ... `` + Copy files to ```` (either file or directory). + If multiple files are specified, the ```` must be + directory and it must exist. -``copy_directory `` - Copy directory 'source' content to directory 'destination'. +``copy_directory ... `` + Copy directories to ```` directory. + If ```` directory does not exist it will be created. -``copy_if_different `` - Copy file if input has changed. +``copy_if_different ... `` + Copy files to ```` (either file or directory) if + they have changed. + If multiple files are specified, the ```` must be + directory and it must exist. ``echo [...]`` Displays arguments as text. @@ -188,19 +195,23 @@ Available commands are: Run command in a modified environment. ``environment`` - Display the current environment. + Display the current environment variables. -``make_directory `` - Create a directory. +``make_directory ...`` + Create ```` directories. If necessary, create parent + directories too. If a directory already exists it will be + silently ignored. -``md5sum [...]`` +``md5sum ...`` Compute md5sum of files. -``remove [-f] [...]`` - Remove the file(s), use ``-f`` to force it. +``remove [-f] ...`` + Remove the file(s), use ``-f`` to force it. If a file does + not exist it will be silently ignored. ``remove_directory `` - Remove a directory and its contents. + Remove a directory and its contents. If a directory does + not exist it will be silently ignored. ``rename `` Rename a file or directory (on one volume). @@ -233,7 +244,8 @@ Available commands are: Touch a file. ``touch_nocreate `` - Touch a file if it exists but do not create it. + Touch a file if it exists but do not create it. If a file does + not exist it will be silently ignored. UNIX-specific Command-Line Tools -------------------------------- diff --git a/Help/module/FindXalanC.rst b/Help/module/FindXalanC.rst new file mode 100644 index 000000000..b99d21256 --- /dev/null +++ b/Help/module/FindXalanC.rst @@ -0,0 +1 @@ +.. cmake-module:: ../../Modules/FindXalanC.cmake diff --git a/Help/policy/CMP0040.rst b/Help/policy/CMP0040.rst index e746c0316..d46baf647 100644 --- a/Help/policy/CMP0040.rst +++ b/Help/policy/CMP0040.rst @@ -1,18 +1,21 @@ CMP0040 ------- -The target in the TARGET signature of add_custom_command() must exist. +The target in the ``TARGET`` signature of :command:`add_custom_command` +must exist and must be defined in current directory. CMake 2.8.12 and lower silently ignored a custom command created with -the TARGET signature of :command:`add_custom_command` -if the target is unknown. +the ``TARGET`` signature of :command:`add_custom_command` +if the target is unknown or was defined outside the current directory. -The OLD behavior for this policy is to ignore custom commands -for unknown targets. The NEW behavior for this policy is to report an error -if the target referenced in :command:`add_custom_command` is unknown. +The ``OLD`` behavior for this policy is to ignore custom commands +for unknown targets. The ``NEW`` behavior for this policy is to report +an error if the target referenced in :command:`add_custom_command` is +unknown or was defined outside the current directory. This policy was introduced in CMake version 3.0. CMake version -|release| warns when the policy is not set and uses OLD behavior. Use -the cmake_policy command to set it to OLD or NEW explicitly. +|release| warns when the policy is not set and uses ``OLD`` behavior. +Use the :command:`cmake_policy` command to set it to ``OLD`` or +``NEW`` explicitly. .. include:: DEPRECATED.txt diff --git a/Help/prop_tgt/IOS_INSTALL_COMBINED.rst b/Help/prop_tgt/IOS_INSTALL_COMBINED.rst new file mode 100644 index 000000000..59f67a7eb --- /dev/null +++ b/Help/prop_tgt/IOS_INSTALL_COMBINED.rst @@ -0,0 +1,11 @@ +IOS_INSTALL_COMBINED +-------------------- + +Build a combined (device and simulator) target when installing. + +When this property is set to set to false (which is the default) then it will +either be built with the device SDK or the simulator SDK depending on the SDK +set. But if this property is set to true then the target will at install time +also be built for the corresponding SDK and combined into one library. + +This feature requires at least Xcode version 6. diff --git a/Help/prop_tgt/MACOSX_BUNDLE.rst b/Help/prop_tgt/MACOSX_BUNDLE.rst index 8d7d91416..7cd80462a 100644 --- a/Help/prop_tgt/MACOSX_BUNDLE.rst +++ b/Help/prop_tgt/MACOSX_BUNDLE.rst @@ -3,7 +3,7 @@ MACOSX_BUNDLE Build an executable as an Application Bundle on OS X or iOS. -When this property is set to true the executable when built on OS X +When this property is set to ``TRUE`` the executable when built on OS X or iOS will be created as an application bundle. This makes it a GUI executable that can be launched from the Finder. See the :prop_tgt:`MACOSX_FRAMEWORK_INFO_PLIST` target property for information about diff --git a/Help/prop_tgt/MACOSX_RPATH.rst b/Help/prop_tgt/MACOSX_RPATH.rst index 41bb8cc09..1f9a036bf 100644 --- a/Help/prop_tgt/MACOSX_RPATH.rst +++ b/Help/prop_tgt/MACOSX_RPATH.rst @@ -3,8 +3,8 @@ MACOSX_RPATH Whether this target on OS X or iOS is located at runtime using rpaths. -When this property is set to true, the directory portion of -the "install_name" field of this shared library will be ``@rpath`` +When this property is set to ``TRUE``, the directory portion of +the ``install_name`` field of this shared library will be ``@rpath`` unless overridden by :prop_tgt:`INSTALL_NAME_DIR`. This indicates the shared library is to be found at runtime using runtime paths (rpaths). @@ -18,6 +18,6 @@ can be controlled by the :prop_tgt:`INSTALL_RPATH` target property on the target linking to this target. Policy :policy:`CMP0042` was introduced to change the default value of -``MACOSX_RPATH`` to ``TRUE. This is because use of ``@rpath`` is a +``MACOSX_RPATH`` to ``TRUE``. This is because use of ``@rpath`` is a more flexible and powerful alternative to ``@executable_path`` and ``@loader_path``. diff --git a/Help/prop_tgt/RESOURCE.rst b/Help/prop_tgt/RESOURCE.rst index 5dad3ea1c..d837f7b33 100644 --- a/Help/prop_tgt/RESOURCE.rst +++ b/Help/prop_tgt/RESOURCE.rst @@ -1,11 +1,61 @@ RESOURCE -------- -Specify resource files in a :prop_tgt:`FRAMEWORK` shared library target. +Specify resource files in a :prop_tgt:`FRAMEWORK` or :prop_tgt:`BUNDLE`. -Shared library targets marked with the :prop_tgt:`FRAMEWORK` property generate -frameworks on OS X, iOS and normal shared libraries on other platforms. -This property may be set to a list of files to be placed in the -``Resources`` directory inside the framework folder. On non-Apple -platforms these files may be installed using the ``RESOURCE`` option to -the ``install(TARGETS)`` command. +Target marked with the :prop_tgt:`FRAMEWORK` or :prop_tgt:`BUNDLE` property +generate framework or application bundle (both OS X and iOS is supported) +or normal shared libraries on other platforms. +This property may be set to a list of files to be placed in the corresponding +directory (eg. ``Resources`` directory for OS X) inside the bundle. +On non-Apple platforms these files may be installed using the ``RESOURCE`` +option to the ``install(TARGETS)`` command. + +Following example of Application Bundle: + +.. code-block:: cmake + + add_executable(ExecutableTarget + addDemo.c + resourcefile.txt + appresourcedir/appres.txt + ) + + target_link_libraries(ExecutableTarget heymath mul) + + set(RESOURCE_FILES + resourcefile.txt + appresourcedir/appres.txt + ) + + set_target_properties(ExecutableTarget PROPERTIES + MACOSX_BUNDLE TRUE + MACOSX_FRAMEWORK_IDENTIFIER org.cmake.ExecutableTarget + RESOURCE "${RESOURCE_FILES}" + ) + +will produce flat structure for iOS systems:: + + ExecutableTarget.app + appres.txt + ExecutableTarget + Info.plist + resourcefile.txt + +For OS X systems it will produce following directory structure:: + + ExecutableTarget.app/ + Contents + Info.plist + MacOS + ExecutableTarget + Resources + appres.txt + resourcefile.txt + +For Linux, such cmake script produce following files:: + + ExecutableTarget + Resources + appres.txt + resourcefile.txt diff --git a/Help/release/3.5.rst b/Help/release/3.5.rst new file mode 100644 index 000000000..009eb3c7c --- /dev/null +++ b/Help/release/3.5.rst @@ -0,0 +1,185 @@ +CMake 3.5 Release Notes +*********************** + +.. only:: html + + .. contents:: + +Changes made since CMake 3.4 include the following. + +New Features +============ + +GUI +--- + +* The :manual:`cmake-gui(1)` gained options to control warnings about + deprecated functionality. + +* The :manual:`cmake-gui(1)` learned an option to set the toolset + to be used with VS IDE and Xcode generators, much like the + existing ``-T`` option to :manual:`cmake(1)`. + +* The :manual:`cmake-gui(1)` gained a Regular Expression Explorer which + may be used to create and evaluate regular expressions in real-time. + The explorer window is available via the ``Tools`` menu. + +Command-Line +------------ + +* The ``-Wdev`` and ``-Wno-dev`` :manual:`cmake(1)` options now also enable + and suppress the deprecated warnings output by default. + +* The suppression of developer warnings as errors can now be controlled with + the new ``-Werror=dev`` and ``-Wno-error=dev`` :manual:`cmake(1)` options. + +* The :manual:`cmake(1)` ``-E`` command-line tools ``copy``, + ``copy_if_different``, ``copy_directory``, and ``make_directory`` + learned to support multiple input files or directories. + +Commands +-------- + +* The :command:`cmake_parse_arguments` command is now implemented natively. + The :module:`CMakeParseArguments` module remains as an empty placeholder + for compatibility. + +* The :command:`install(DIRECTORY)` command learned to support + :manual:`generator expressions ` + in the list of directories. + +Variables +--------- + +* The :variable:`CMAKE_ERROR_DEPRECATED` variable can now be set using the + ``-Werror=deprecated`` and ``-Wno-error=deprecated`` :manual:`cmake(1)` + options. + +* The :variable:`CMAKE_WARN_DEPRECATED` variable can now be set using the + ``-Wdeprecated`` and ``-Wno-deprecated`` :manual:`cmake(1)` options. + +Properties +---------- + +* The :prop_tgt:`VS_GLOBAL_` target property is now implemented + for VS 2010 and above. Previously it worked only in VS 2008 and below. + +Modules +------- + +* The :module:`ExternalProject` module learned a new ``GIT_REMOTE_NAME`` + option to control the ``git clone --origin`` value. + +* The :module:`FindBoost` module now provides imported targets + such as ``Boost::boost`` and ``Boost::filesystem``. + +* The :module:`FindFLEX` module ``FLEX_TARGET`` macro learned a + new ``DEFINES_FILE`` option to specify a custom output header + to be generated. + +* The :module:`FindGTest` module now provides imported targets. + +* The :module:`FindGTK2` module, when ``GTK2_USE_IMPORTED_TARGETS`` is + enabled, now sets ``GTK2_LIBRARIES`` to contain the list of imported + targets instead of the paths to the libraries. Moreover it now sets + a new ``GTK2_TARGETS`` variable containing all the targets imported. + +* The :module:`FindOpenMP` module learned to support Clang. + +* The :module:`FindOpenSSL` module gained a new + ``OPENSSL_MSVC_STATIC_RT`` option to search for libraries using + the MSVC static runtime. + +* The :module:`FindPNG` module now provides imported targets. + +* The :module:`FindTIFF` module now provides imported targets. + +* A :module:`FindXalanC` module was introduced to find the + Apache Xalan-C++ XSL transform processing library. + +* The :module:`FindXercesC` module now provides imported targets. + +Platforms +--------- + +* Support was added for the ARM Compiler (arm.com) with compiler id ``ARMCC``. + +* A new platform file for cross-compiling in the Cray Linux Environment to + target compute nodes was added. See + :ref:`Cross Compiling for the Cray Linux Environment ` + for usage details. + +* The :manual:`Compile Features ` functionality + is now aware of features supported by Clang compilers on Windows (MinGW). + +* When building for embedded Apple platforms like iOS CMake learned to build and + install combined targets which contain both a device and a simulator build. + This behavior can be enabled by setting the :prop_tgt:`IOS_INSTALL_COMBINED` + target property. + +CPack +----- + +* The :module:`CPackDMG` module learned new variable to specify AppleScript + file run to customize appearance of ``DragNDrop`` installer folder, + including background image setting using supplied PNG or multi-resolution + TIFF file. See the :variable:`CPACK_DMG_DS_STORE_SETUP_SCRIPT` and + :variable:`CPACK_DMG_BACKGROUND_IMAGE` variables. + +* The :module:`CPackDeb` module learned to set the optional config + file ``Source`` field using a monolithic or per-component variable. + See :variable:`CPACK_DEBIAN_PACKAGE_SOURCE`. + +* The :module:`CPackDeb` module learned to set Package, Section + and Priority control fields per-component. + See variables :variable:`CPACK_DEBIAN__PACKAGE_SECTION` and + :variable:`CPACK_DEBIAN__PACKAGE_PRIORITY`. + +* The :module:`CPack DragNDrop generator ` learned to add + multi-lingual SLAs to a DMG which is presented to the user when they try to + mount the DMG. See the :variable:`CPACK_DMG_SLA_LANGUAGES` and + :variable:`CPACK_DMG_SLA_DIR` variables for details. + +* The :module:`CPackNSIS` module learned new variables to add bitmaps to the + installer. See the :variable:`CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP` + and :variable:`CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP` variables. + +* The :module:`CPackRPM` module learned to set Name and Group + control fields per-component. + See :variable:`CPACK_RPM__PACKAGE_NAME` + and :variable:`CPACK_RPM__PACKAGE_GROUP`. + +Other +----- + +* Warnings about deprecated functionality are now enabled by default. + They may be suppressed with ``-Wno-deprecated`` or by setting the + :variable:`CMAKE_WARN_DEPRECATED` variable to false. + +Deprecated and Removed Features +=============================== + +* The :manual:`cmake(1)` ``-E time`` command now properly passes arguments + with spaces or special characters through to the child process. This + may break scripts that worked around the bug with their own extra + quoting or escaping. + +* The :generator:`Xcode` generator was fixed to escape backslashes in + strings consistently with other generators. Projects that previously + worked around the inconsistecy with an extra level of backslashes + conditioned on the Xcode generator must be updated to remove the + workaround for CMake 3.5 and greater. + +Other Changes +============= + +* The :generator:`Visual Studio 14 2015` generator learned to map the + ``/debug:fastlink`` linker flag to the ``.vcxproj`` file property. + +* The :module:`FindGTK2` module now configures the ``GTK2::sigc++`` imported + target to enable c++11 on its dependents when using sigc++ 2.5.1 or higher. + +* The precompiled Windows binary provided on ``cmake.org`` is now a + ``.msi`` package instead of an installer executable. One may need + to manually uninstall CMake versions lower than 3.5 before installing + the new package. diff --git a/Help/release/dev/0-sample-topic.rst b/Help/release/dev/0-sample-topic.rst deleted file mode 100644 index e4cc01e23..000000000 --- a/Help/release/dev/0-sample-topic.rst +++ /dev/null @@ -1,7 +0,0 @@ -0-sample-topic --------------- - -* This is a sample release note for the change in a topic. - Developers should add similar notes for each topic branch - making a noteworthy change. Each document should be named - and titled to match the topic name to avoid merge conflicts. diff --git a/Help/release/dev/FindFLEX-DEFINES_FILE.rst b/Help/release/dev/FindFLEX-DEFINES_FILE.rst deleted file mode 100644 index 95133aa4a..000000000 --- a/Help/release/dev/FindFLEX-DEFINES_FILE.rst +++ /dev/null @@ -1,6 +0,0 @@ -FindFLEX-DEFINES_FILE ---------------------- - -* The :module:`FindFLEX` module ``FLEX_TARGET`` macro learned a - new ``DEFINES_FILE`` option to specify a custom output header - to be generated. diff --git a/Help/release/dev/FindGTK2_GTK2_TARGETS.rst b/Help/release/dev/FindGTK2_GTK2_TARGETS.rst deleted file mode 100644 index 76e3657af..000000000 --- a/Help/release/dev/FindGTK2_GTK2_TARGETS.rst +++ /dev/null @@ -1,7 +0,0 @@ -FindGTK2_GTK2_TARGETS ---------------------- - -* The :module:`FindGTK2` module, when ``GTK2_USE_IMPORTED_TARGETS`` is - enabled, now sets ``GTK2_LIBRARIES`` to contain the list of imported - targets instead of the paths to the libraries. Moreover it now sets - a new ``GTK2_TARGETS`` variable containing all the targets imported. diff --git a/Help/release/dev/FindGTK2_sigc++_c++11.rst b/Help/release/dev/FindGTK2_sigc++_c++11.rst deleted file mode 100644 index 2ba14592b..000000000 --- a/Help/release/dev/FindGTK2_sigc++_c++11.rst +++ /dev/null @@ -1,7 +0,0 @@ -FindGTK2_sigc++_c++11 ---------------------- - -* Starting with sigc++ 2.5.1, c++11 must be enabled in order to use - sigc++. The GTK2::sigc++ imported target will automatically enable the - required build flags in order to build with the version found on the - system. diff --git a/Help/release/dev/FindOpenSSL-msvc-static-rt.rst b/Help/release/dev/FindOpenSSL-msvc-static-rt.rst deleted file mode 100644 index 6e0ee276c..000000000 --- a/Help/release/dev/FindOpenSSL-msvc-static-rt.rst +++ /dev/null @@ -1,6 +0,0 @@ -FindOpenSSL-msvc-static-rt --------------------------- - -* The :module:`FindOpenSSL` module gained a new - ``OPENSSL_MSVC_STATIC_RT`` option to search for libraries using - the MSVC static runtime. diff --git a/Help/release/dev/FindXercesC-imported-targets.rst b/Help/release/dev/FindXercesC-imported-targets.rst deleted file mode 100644 index 69cec5c4d..000000000 --- a/Help/release/dev/FindXercesC-imported-targets.rst +++ /dev/null @@ -1,4 +0,0 @@ -FindXercesC-imported-targets ----------------------------- - -* The :module:`FindXercesC` module now provides imported targets. diff --git a/Help/release/dev/add-armcc-toolchain.rst b/Help/release/dev/add-armcc-toolchain.rst deleted file mode 100644 index 2cf6414dc..000000000 --- a/Help/release/dev/add-armcc-toolchain.rst +++ /dev/null @@ -1,4 +0,0 @@ -add-armcc-toolchain -------------------- - -* Support was added for the ARM Compiler (arm.com) with compiler id ``ARMCC``. diff --git a/Help/release/dev/add-cray-linux-platform.rst b/Help/release/dev/add-cray-linux-platform.rst deleted file mode 100644 index 700038260..000000000 --- a/Help/release/dev/add-cray-linux-platform.rst +++ /dev/null @@ -1,7 +0,0 @@ -add-cray-linux-platform ------------------------ - -* A new platform file for cross-compiling in the Cray Linux Environment to - target compute nodes was added. See - :ref:`Cross Compiling for the Cray Linux Environment ` - for usage details. diff --git a/Help/release/dev/better-looking-mac-packages.rst b/Help/release/dev/better-looking-mac-packages.rst deleted file mode 100644 index ef1b8e88f..000000000 --- a/Help/release/dev/better-looking-mac-packages.rst +++ /dev/null @@ -1,8 +0,0 @@ -better-looking-mac-packages ---------------------------- - -* The :module:`CPackDMG` module learned new variable to specify AppleScript - file run to customize appearance of ``DragNDrop`` installer folder, - including background image setting using supplied PNG or multi-resolution - TIFF file. See the :variable:`CPACK_DMG_DS_STORE_SETUP_SCRIPT` and - :variable:`CPACK_DMG_BACKGROUND_IMAGE` variables. diff --git a/Help/release/dev/cmake-W-options.rst b/Help/release/dev/cmake-W-options.rst deleted file mode 100644 index 57d375f5d..000000000 --- a/Help/release/dev/cmake-W-options.rst +++ /dev/null @@ -1,12 +0,0 @@ -cmake-W-options ---------------- - -* The :variable:`CMAKE_WARN_DEPRECATED` variable can now be set using the - ``-Wdeprecated`` and ``-Wno-deprecated`` :manual:`cmake(1)` options. - -* The ``-Wdev`` and ``-Wno-dev`` :manual:`cmake(1)` options now also enable - and suppress the deprecated warnings output by default. - -* Warnings about deprecated functionality are now enabled by default. - They may be suppressed with ``-Wno-deprecated`` or by setting the - :variable:`CMAKE_WARN_DEPRECATED` variable to false. diff --git a/Help/release/dev/cmake-gui-select-toolset.rst b/Help/release/dev/cmake-gui-select-toolset.rst deleted file mode 100644 index 5186f910c..000000000 --- a/Help/release/dev/cmake-gui-select-toolset.rst +++ /dev/null @@ -1,6 +0,0 @@ -cmake-gui-select-toolset ------------------------- - -* The :manual:`cmake-gui(1)` learned an option to set the toolset - to be used with VS IDE and Xcode generators, much like the - existing ``-T`` option to :manual:`cmake(1)`. diff --git a/Help/release/dev/cpack-deb-config-file-source-field.rst b/Help/release/dev/cpack-deb-config-file-source-field.rst deleted file mode 100644 index bbc2aa6ab..000000000 --- a/Help/release/dev/cpack-deb-config-file-source-field.rst +++ /dev/null @@ -1,6 +0,0 @@ -cpack-deb-config-file-source-field ----------------------------------- - -* The :module:`CPackDeb` module learned to set optional config - file ``Source`` field - monolithic and per-component variable. - See :variable:`CPACK_DEBIAN_PACKAGE_SOURCE`. diff --git a/Help/release/dev/cpack-deb-new-component-vars.rst b/Help/release/dev/cpack-deb-new-component-vars.rst deleted file mode 100644 index e30afdbc1..000000000 --- a/Help/release/dev/cpack-deb-new-component-vars.rst +++ /dev/null @@ -1,7 +0,0 @@ -cpack-deb-new-component-vars ----------------------------- - -* The :module:`CPackDeb` module learned to set Package, Section - and Priority control fields per-component. - See :variable:`CPACK_DEBIAN__PACKAGE_SECTION` - and :variable:`CPACK_DEBIAN__PACKAGE_PRIORITY`. diff --git a/Help/release/dev/cpack-dmg-multilanguage-sla.rst b/Help/release/dev/cpack-dmg-multilanguage-sla.rst deleted file mode 100644 index 9e28fa236..000000000 --- a/Help/release/dev/cpack-dmg-multilanguage-sla.rst +++ /dev/null @@ -1,7 +0,0 @@ -cpack-dmg-multilanguage-sla ---------------------------- - -* The :module:`CPack DragNDrop generator ` learned to add - multi-lingual SLAs to a DMG which is presented to the user when they try to - mount the DMG. See the :variable:`CPACK_DMG_SLA_LANGUAGES` and - :variable:`CPACK_DMG_SLA_DIR` variables for details. diff --git a/Help/release/dev/cpack-nsis-bitmap.rst b/Help/release/dev/cpack-nsis-bitmap.rst deleted file mode 100644 index c5ccfb546..000000000 --- a/Help/release/dev/cpack-nsis-bitmap.rst +++ /dev/null @@ -1,6 +0,0 @@ -cpack-nsis-bitmap ------------------ - -* The :module:`CPackNSIS` module learned new variables to add bitmaps to the - installer. See the :variable:`CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP` - and :variable:`CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP` variables. diff --git a/Help/release/dev/deprecate-CMakeForceCompiler.rst b/Help/release/dev/deprecate-CMakeForceCompiler.rst deleted file mode 100644 index dc6e817b4..000000000 --- a/Help/release/dev/deprecate-CMakeForceCompiler.rst +++ /dev/null @@ -1,5 +0,0 @@ -deprecate-CMakeForceCompiler ----------------------------- - -* The :module:`CMakeForceCompiler` module and its macros are now deprecated. - See module documentation for an explanation. diff --git a/Help/release/index.rst b/Help/release/index.rst index 752acbd30..6b7da3c7f 100644 --- a/Help/release/index.rst +++ b/Help/release/index.rst @@ -5,14 +5,13 @@ CMake Release Notes This file should include the adjacent "dev.txt" file in development versions but not in release versions. -.. include:: dev.txt - Releases ======== .. toctree:: :maxdepth: 1 + 3.5 <3.5> 3.4 <3.4> 3.3 <3.3> 3.2 <3.2> diff --git a/Help/variable/CMAKE_EXPORT_COMPILE_COMMANDS.rst b/Help/variable/CMAKE_EXPORT_COMPILE_COMMANDS.rst new file mode 100644 index 000000000..8776279e8 --- /dev/null +++ b/Help/variable/CMAKE_EXPORT_COMPILE_COMMANDS.rst @@ -0,0 +1,30 @@ +CMAKE_EXPORT_COMPILE_COMMANDS +----------------------------- + +Enable/Disable output of compile commands during generation. + +If enabled, generates a ``compile_commands.json`` file containing the exact +compiler calls for all translation units of the project in machine-readable +form. The format of the JSON file looks like: + +.. code-block:: javascript + + [ + { + "directory": "/home/user/development/project", + "command": "/usr/bin/c++ ... -c ../foo/foo.cc", + "file": "../foo/foo.cc" + }, + + ... + + { + "directory": "/home/user/development/project", + "command": "/usr/bin/c++ ... -c ../foo/bar.cc", + "file": "../foo/bar.cc" + } + ] + +.. note:: + This option is implemented only by :ref:`Makefile Generators` + and the :generator:`Ninja`. It is ignored on other generators. diff --git a/Help/variable/CMAKE_IOS_INSTALL_COMBINED.rst b/Help/variable/CMAKE_IOS_INSTALL_COMBINED.rst new file mode 100644 index 000000000..c5cb9b647 --- /dev/null +++ b/Help/variable/CMAKE_IOS_INSTALL_COMBINED.rst @@ -0,0 +1,8 @@ +CMAKE_IOS_INSTALL_COMBINED +-------------------------- + +Default value for :prop_tgt:`IOS_INSTALL_COMBINED` of targets. + +This variable is used to initialize the :prop_tgt:`IOS_INSTALL_COMBINED` +property on all the targets. See that target property for additional +information. diff --git a/Help/variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION.rst b/Help/variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION.rst index 639284963..e0be3a43e 100644 --- a/Help/variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION.rst +++ b/Help/variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION.rst @@ -8,4 +8,5 @@ specification of a target Windows version to select a corresponding SDK. The :variable:`CMAKE_SYSTEM_VERSION` variable may be set to specify a version. Otherwise CMake computes a default version based on the Windows SDK versions available. The chosen Windows target version number is provided -in ``CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION``. +in ``CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION``. If no Windows 10 SDK +is available this value will be empty. diff --git a/Help/variable/CMAKE_XCODE_ATTRIBUTE_an-attribute.rst b/Help/variable/CMAKE_XCODE_ATTRIBUTE_an-attribute.rst index 122b9f6b0..be683d668 100644 --- a/Help/variable/CMAKE_XCODE_ATTRIBUTE_an-attribute.rst +++ b/Help/variable/CMAKE_XCODE_ATTRIBUTE_an-attribute.rst @@ -8,3 +8,9 @@ in the generated Xcode project. Ignored on other generators. See the :prop_tgt:`XCODE_ATTRIBUTE_` target property to set attributes on a specific target. + +Contents of ``CMAKE_XCODE_ATTRIBUTE_`` may use +"generator expressions" with the syntax ``$<...>``. See the +:manual:`cmake-generator-expressions(7)` manual for available +expressions. See the :manual:`cmake-buildsystem(7)` manual +for more on defining buildsystem properties. diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake index b7975d3ea..45dda40c8 100644 --- a/Modules/BundleUtilities.cmake +++ b/Modules/BundleUtilities.cmake @@ -424,7 +424,9 @@ function(get_item_rpaths item rpaths_var) string(REGEX MATCHALL "rpath [^\n]+" load_cmds_ov "${load_cmds_ov}") string(REGEX REPLACE "rpath " "" load_cmds_ov "${load_cmds_ov}") if(load_cmds_ov) - gp_append_unique(${rpaths_var} "${load_cmds_ov}") + foreach(rpath ${load_cmds_ov}) + gp_append_unique(${rpaths_var} "${rpath}") + endforeach() endif() endif() diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in index c72e3381f..f109a1479 100644 --- a/Modules/CMakeCCompiler.cmake.in +++ b/Modules/CMakeCCompiler.cmake.in @@ -2,6 +2,7 @@ set(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@") set(CMAKE_C_COMPILER_ARG1 "@CMAKE_C_COMPILER_ARG1@") set(CMAKE_C_COMPILER_ID "@CMAKE_C_COMPILER_ID@") set(CMAKE_C_COMPILER_VERSION "@CMAKE_C_COMPILER_VERSION@") +set(CMAKE_C_COMPILER_WRAPPER "@CMAKE_C_COMPILER_WRAPPER@") set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "@CMAKE_C_STANDARD_COMPUTED_DEFAULT@") set(CMAKE_C_COMPILE_FEATURES "@CMAKE_C_COMPILE_FEATURES@") set(CMAKE_C90_COMPILE_FEATURES "@CMAKE_C90_COMPILE_FEATURES@") diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in index 63f8787c0..5bfe0fdfa 100644 --- a/Modules/CMakeCCompilerId.c.in +++ b/Modules/CMakeCCompilerId.c.in @@ -21,6 +21,10 @@ char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; char const* qnxnto = "INFO" ":" "qnxnto[]"; #endif +#if defined(__CRAYXE) || defined(__CRAYXC) +char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; +#endif + @CMAKE_C_COMPILER_ID_PLATFORM_CONTENT@ @CMAKE_C_COMPILER_ID_ERROR_FOR_TEST@ @@ -54,6 +58,9 @@ int main(int argc, char* argv[]) #endif #ifdef SIMULATE_VERSION_MAJOR require += info_simulate_version[argc]; +#endif +#if defined(__CRAYXE) || defined(__CRAYXC) + require += info_cray[argc]; #endif require += info_language_dialect_default[argc]; (void)argv; diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake index d2417aaa4..fa87ca84c 100644 --- a/Modules/CMakeCInformation.cmake +++ b/Modules/CMakeCInformation.cmake @@ -18,6 +18,8 @@ # It also loads a system - compiler - processor (or target hardware) # specific file, which is mainly useful for crosscompiling and embedded systems. +include(CMakeLanguageInformation) + # some compilers use different extensions (e.g. sdcc uses .rel) # so set the extension here first so it can be overridden by the compiler specific file if(UNIX) @@ -60,6 +62,12 @@ if (NOT _INCLUDED_FILE) include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) endif () + +# load any compiler-wrapper specific information +if (CMAKE_C_COMPILER_WRAPPER) + __cmake_include_compiler_wrapper(C) +endif () + # We specify the compiler information in the system file for some # platforms, but this language may not have been enabled when the file # was first included. Include it again to get the language info. diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in index 52e44f6d5..9e90aea59 100644 --- a/Modules/CMakeCXXCompiler.cmake.in +++ b/Modules/CMakeCXXCompiler.cmake.in @@ -2,6 +2,7 @@ set(CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@") set(CMAKE_CXX_COMPILER_ARG1 "@CMAKE_CXX_COMPILER_ARG1@") set(CMAKE_CXX_COMPILER_ID "@CMAKE_CXX_COMPILER_ID@") set(CMAKE_CXX_COMPILER_VERSION "@CMAKE_CXX_COMPILER_VERSION@") +set(CMAKE_CXX_COMPILER_WRAPPER "@CMAKE_CXX_COMPILER_WRAPPER@") set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "@CMAKE_CXX_STANDARD_COMPUTED_DEFAULT@") set(CMAKE_CXX_COMPILE_FEATURES "@CMAKE_CXX_COMPILE_FEATURES@") set(CMAKE_CXX98_COMPILE_FEATURES "@CMAKE_CXX98_COMPILE_FEATURES@") diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in index 61cd79093..3e5c0fcff 100644 --- a/Modules/CMakeCXXCompilerId.cpp.in +++ b/Modules/CMakeCXXCompilerId.cpp.in @@ -20,6 +20,10 @@ char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; char const* qnxnto = "INFO" ":" "qnxnto[]"; #endif +#if defined(__CRAYXE) || defined(__CRAYXC) +char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; +#endif + @CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT@ @CMAKE_CXX_COMPILER_ID_ERROR_FOR_TEST@ @@ -48,6 +52,9 @@ int main(int argc, char* argv[]) #endif #ifdef SIMULATE_VERSION_MAJOR require += info_simulate_version[argc]; +#endif +#if defined(__CRAYXE) || defined(__CRAYXC) + require += info_cray[argc]; #endif require += info_language_dialect_default[argc]; (void)argv; diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake index 091627bc3..b35280f96 100644 --- a/Modules/CMakeCXXInformation.cmake +++ b/Modules/CMakeCXXInformation.cmake @@ -18,6 +18,8 @@ # It also loads a system - compiler - processor (or target hardware) # specific file, which is mainly useful for crosscompiling and embedded systems. +include(CMakeLanguageInformation) + # some compilers use different extensions (e.g. sdcc uses .rel) # so set the extension here first so it can be overridden by the compiler specific file if(UNIX) @@ -59,6 +61,12 @@ if (NOT _INCLUDED_FILE) include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) endif () + +# load any compiler-wrapper specific information +if (CMAKE_CXX_COMPILER_WRAPPER) + __cmake_include_compiler_wrapper(CXX) +endif () + # We specify the compiler information in the system file for some # platforms, but this language may not have been enabled when the file # was first included. Include it again to get the language info. diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 81c25090c..feae1c425 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -107,6 +107,7 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) PARENT_SCOPE) set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "${CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX}" PARENT_SCOPE) set(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_${lang}_COMPILER_VERSION}" PARENT_SCOPE) + set(CMAKE_${lang}_COMPILER_WRAPPER "${CMAKE_${lang}_COMPILER_WRAPPER}" PARENT_SCOPE) set(CMAKE_${lang}_SIMULATE_ID "${CMAKE_${lang}_SIMULATE_ID}" PARENT_SCOPE) set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_${lang}_SIMULATE_VERSION}" PARENT_SCOPE) set(CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT "${CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT}" PARENT_SCOPE) @@ -182,9 +183,6 @@ Id flags: ${testflags} set(v 6) set(ext dsp) endif() - if("${id_platform}" STREQUAL "Itanium") - set(id_platform ia64) - endif() if(CMAKE_VS_PLATFORM_TOOLSET) if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android") set(id_toolset "${CMAKE_VS_PLATFORM_TOOLSET}") @@ -435,6 +433,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) set(HAVE_COMPILER_VERSION_MINOR 0) set(HAVE_COMPILER_VERSION_PATCH 0) set(HAVE_COMPILER_VERSION_TWEAK 0) + set(COMPILER_WRAPPER) set(DIGIT_VALUE_1 1) set(DIGIT_VALUE_2 10) set(DIGIT_VALUE_3 100) @@ -476,6 +475,9 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) endif() endforeach() endforeach() + if("${info}" MATCHES "INFO:compiler_wrapper\\[([^]\"]*)\\]") + set(COMPILER_WRAPPER "${CMAKE_MATCH_1}") + endif() if("${info}" MATCHES "INFO:simulate\\[([^]\"]*)\\]") set(SIMULATE_ID "${CMAKE_MATCH_1}") endif() @@ -588,6 +590,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) set(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}" PARENT_SCOPE) set(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_${lang}_COMPILER_VERSION}" PARENT_SCOPE) + set(CMAKE_${lang}_COMPILER_WRAPPER "${COMPILER_WRAPPER}" PARENT_SCOPE) set(CMAKE_${lang}_SIMULATE_ID "${CMAKE_${lang}_SIMULATE_ID}" PARENT_SCOPE) set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_${lang}_SIMULATE_VERSION}" PARENT_SCOPE) set(CMAKE_EXECUTABLE_FORMAT "${CMAKE_EXECUTABLE_FORMAT}" PARENT_SCOPE) diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index 911ffac94..ccafb0779 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -54,6 +54,7 @@ else() if(NOT CMAKE_Fortran_COMPILER_INIT) # Known compilers: # f77/f90/f95: generic compiler names + # ftn: Cray fortran compiler wrapper # g77: GNU Fortran 77 compiler # gfortran: putative GNU Fortran 95+ compiler (in progress) # fort77: native F77 compiler under HP-UX (and some older Crays) @@ -73,6 +74,7 @@ else() # then 77 or older compilers, gnu is always last in the group, # so if you paid for a compiler it is picked by default. set(CMAKE_Fortran_COMPILER_LIST + ftn ifort ifc af95 af90 efc f95 pathf2003 pathf95 pgf95 pgfortran lf95 xlf95 fort gfortran gfortran-4 g95 f90 pathf90 pgf90 xlf90 epcf90 fort77 frt pgf77 xlf fl32 af77 g77 f77 diff --git a/Modules/CMakeForceCompiler.cmake b/Modules/CMakeForceCompiler.cmake index 343ab3fe9..faa0dc58c 100644 --- a/Modules/CMakeForceCompiler.cmake +++ b/Modules/CMakeForceCompiler.cmake @@ -2,7 +2,9 @@ # CMakeForceCompiler # ------------------ # -# Deprecated. Do not use. +# Discouraged. Avoid using this module if possible. It will be deprecated +# by a future version of CMake once alternatives have been provided for all +# toolchain file use cases. # # The macros provided by this module were once intended for use by # cross-compiling toolchain files when CMake was not able to automatically @@ -12,6 +14,12 @@ # CMake detects from a compiler is now too extensive to be provided by # toolchain files using these macros. # +# The only known remaining use case for these macros is to write toolchain +# files for cross-compilers that cannot link binaries without special flags or +# custom linker scripts. These macros cause CMake to skip checks it normally +# performs as part of enabling a language and introspecting the toolchain. +# However, skipping these checks may limit some generation functionality. +# # ------------------------------------------------------------------------- # # Macro CMAKE_FORCE_C_COMPILER has the following signature: @@ -70,8 +78,6 @@ # License text for the above reference.) macro(CMAKE_FORCE_C_COMPILER compiler id) - message(DEPRECATION "The CMAKE_FORCE_C_COMPILER macro is deprecated. " - "Instead just set CMAKE_C_COMPILER and allow CMake to identify the compiler.") set(CMAKE_C_COMPILER "${compiler}") set(CMAKE_C_COMPILER_ID_RUN TRUE) set(CMAKE_C_COMPILER_ID ${id}) @@ -84,8 +90,6 @@ macro(CMAKE_FORCE_C_COMPILER compiler id) endmacro() macro(CMAKE_FORCE_CXX_COMPILER compiler id) - message(DEPRECATION "The CMAKE_FORCE_CXX_COMPILER macro is deprecated. " - "Instead just set CMAKE_CXX_COMPILER and allow CMake to identify the compiler.") set(CMAKE_CXX_COMPILER "${compiler}") set(CMAKE_CXX_COMPILER_ID_RUN TRUE) set(CMAKE_CXX_COMPILER_ID ${id}) @@ -98,8 +102,6 @@ macro(CMAKE_FORCE_CXX_COMPILER compiler id) endmacro() macro(CMAKE_FORCE_Fortran_COMPILER compiler id) - message(DEPRECATION "The CMAKE_FORCE_Fortran_COMPILER macro is deprecated. " - "Instead just set CMAKE_Fortran_COMPILER and allow CMake to identify the compiler.") set(CMAKE_Fortran_COMPILER "${compiler}") set(CMAKE_Fortran_COMPILER_ID_RUN TRUE) set(CMAKE_Fortran_COMPILER_ID ${id}) diff --git a/Modules/CMakeFortranCompiler.cmake.in b/Modules/CMakeFortranCompiler.cmake.in index 14fdd60d9..2a4bea494 100644 --- a/Modules/CMakeFortranCompiler.cmake.in +++ b/Modules/CMakeFortranCompiler.cmake.in @@ -2,6 +2,7 @@ set(CMAKE_Fortran_COMPILER "@CMAKE_Fortran_COMPILER@") set(CMAKE_Fortran_COMPILER_ARG1 "@CMAKE_Fortran_COMPILER_ARG1@") set(CMAKE_Fortran_COMPILER_ID "@CMAKE_Fortran_COMPILER_ID@") set(CMAKE_Fortran_COMPILER_VERSION "@CMAKE_Fortran_COMPILER_VERSION@") +set(CMAKE_Fortran_COMPILER_WRAPPER "@CMAKE_Fortran_COMPILER_WRAPPER@") set(CMAKE_Fortran_PLATFORM_ID "@CMAKE_Fortran_PLATFORM_ID@") set(CMAKE_Fortran_SIMULATE_ID "@CMAKE_Fortran_SIMULATE_ID@") set(CMAKE_Fortran_SIMULATE_VERSION "@CMAKE_Fortran_SIMULATE_VERSION@") diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in index 2f7f40ec6..67cda3b61 100644 --- a/Modules/CMakeFortranCompilerId.F.in +++ b/Modules/CMakeFortranCompilerId.F.in @@ -110,6 +110,9 @@ # endif PRINT *, 'INFO:compiler[]' #endif +#if defined(__CRAYXE) || defined(__CRAYXC) + PRINT *, 'INFO:compiler_wrapper[CrayPrgEnv]' +#endif #if 0 ! Identify the platform diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake index 79393d330..1fd097235 100644 --- a/Modules/CMakeFortranInformation.cmake +++ b/Modules/CMakeFortranInformation.cmake @@ -12,6 +12,8 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +include(CMakeLanguageInformation) + # This file sets the basic flags for the Fortran language in CMake. # It also loads the available platform file for the system-compiler # if it exists. @@ -36,6 +38,12 @@ if (NOT _INCLUDED_FILE) include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) endif () + +# load any compiler-wrapper specific information +if (CMAKE_Fortran_COMPILER_WRAPPER) + __cmake_include_compiler_wrapper(Fortran) +endif () + # We specify the compiler information in the system file for some # platforms, but this language may not have been enabled when the file # was first included. Include it again to get the language info. diff --git a/Modules/CMakeIOSInstallCombined.cmake b/Modules/CMakeIOSInstallCombined.cmake new file mode 100644 index 000000000..f052a3bf1 --- /dev/null +++ b/Modules/CMakeIOSInstallCombined.cmake @@ -0,0 +1,297 @@ + +#============================================================================= +# Copyright 2014-2015 Ruslan Baratov, Gregor Jasny +# +# 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. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# Function to print messages of this module +function(_ios_install_combined_message) + message("[iOS combined] " ${ARGN}) +endfunction() + +# Get build settings for the current target/config/SDK by running +# `xcodebuild -sdk ... -showBuildSettings` and parsing it's output +function(_ios_install_combined_get_build_setting sdk variable resultvar) + if("${sdk}" STREQUAL "") + message(FATAL_ERROR "`sdk` is empty") + endif() + + if("${variable}" STREQUAL "") + message(FATAL_ERROR "`variable` is empty") + endif() + + if("${resultvar}" STREQUAL "") + message(FATAL_ERROR "`resultvar` is empty") + endif() + + set( + cmd + xcodebuild -showBuildSettings + -sdk "${sdk}" + -target "${CURRENT_TARGET}" + -config "${CURRENT_CONFIG}" + ) + + execute_process( + COMMAND ${cmd} + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" + RESULT_VARIABLE result + OUTPUT_VARIABLE output + ) + + if(NOT result EQUAL 0) + message(FATAL_ERROR "Command failed (${result}): ${cmd}") + endif() + + if(NOT output MATCHES " ${variable} = ([^\n]*)") + message(FATAL_ERROR "${variable} not found.") + endif() + + set("${resultvar}" "${CMAKE_MATCH_1}" PARENT_SCOPE) +endfunction() + +# Get architectures of given SDK (iphonesimulator/iphoneos) +function(_ios_install_combined_get_valid_archs sdk resultvar) + cmake_policy(SET CMP0007 NEW) + + if("${resultvar}" STREQUAL "") + message(FATAL_ERROR "`resultvar` is empty") + endif() + + _ios_install_combined_get_build_setting("${sdk}" "VALID_ARCHS" valid_archs) + + separate_arguments(valid_archs) + list(REMOVE_ITEM valid_archs "") # remove empty elements + list(REMOVE_DUPLICATES valid_archs) + + set("${resultvar}" "${valid_archs}" PARENT_SCOPE) +endfunction() + +# Final target can contain more architectures that specified by SDK. This +# function will run 'lipo -info' and parse output. Result will be returned +# as a CMake list. +function(_ios_install_combined_get_real_archs filename resultvar) + set(cmd "${_lipo_path}" -info "${filename}") + execute_process( + COMMAND ${cmd} + RESULT_VARIABLE result + OUTPUT_VARIABLE output + ERROR_VARIABLE output + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_STRIP_TRAILING_WHITESPACE + ) + if(NOT result EQUAL 0) + message( + FATAL_ERROR "Command failed (${result}): ${cmd}\n\nOutput:\n${output}" + ) + endif() + + if(NOT output MATCHES "(Architectures in the fat file: [^\n]+ are|Non-fat file: [^\n]+ is architecture): ([^\n]*)") + message(FATAL_ERROR "Could not detect architecture from: ${output}") + endif() + + separate_arguments(CMAKE_MATCH_2) + set(${resultvar} ${CMAKE_MATCH_2} PARENT_SCOPE) +endfunction() + +# Run build command for the given SDK +function(_ios_install_combined_build sdk) + if("${sdk}" STREQUAL "") + message(FATAL_ERROR "`sdk` is empty") + endif() + + _ios_install_combined_message("Build `${CURRENT_TARGET}` for `${sdk}`") + + execute_process( + COMMAND + "${CMAKE_COMMAND}" + --build + . + --target "${CURRENT_TARGET}" + --config ${CURRENT_CONFIG} + -- + -sdk "${sdk}" + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" + RESULT_VARIABLE result + ) + + if(NOT result EQUAL 0) + message(FATAL_ERROR "Build failed") + endif() +endfunction() + +# Remove given architecture from file. This step needed only in rare cases +# when target was built in "unusual" way. Emit warning message. +function(_ios_install_combined_remove_arch lib arch) + _ios_install_combined_message( + "Warning! Unexpected architecture `${arch}` detected and will be removed " + "from file `${lib}`") + set(cmd "${_lipo_path}" -remove ${arch} -output ${lib} ${lib}) + execute_process( + COMMAND ${cmd} + RESULT_VARIABLE result + OUTPUT_VARIABLE output + ERROR_VARIABLE output + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_STRIP_TRAILING_WHITESPACE + ) + if(NOT result EQUAL 0) + message( + FATAL_ERROR "Command failed (${result}): ${cmd}\n\nOutput:\n${output}" + ) + endif() +endfunction() + +# Check that 'lib' contains only 'archs' architectures (remove others). +function(_ios_install_combined_keep_archs lib archs) + _ios_install_combined_get_real_archs("${lib}" real_archs) + set(archs_to_remove ${real_archs}) + list(REMOVE_ITEM archs_to_remove ${archs}) + foreach(x ${archs_to_remove}) + _ios_install_combined_remove_arch("${lib}" "${x}") + endforeach() +endfunction() + +function(_ios_install_combined_detect_sdks this_sdk_var corr_sdk_var) + cmake_policy(SET CMP0057 NEW) + + set(this_sdk "$ENV{PLATFORM_NAME}") + if("${this_sdk}" STREQUAL "") + message(FATAL_ERROR "Environment variable PLATFORM_NAME is empty") + endif() + + set(all_platforms "$ENV{SUPPORTED_PLATFORMS}") + if("${all_platforms}" STREQUAL "") + message(FATAL_ERROR "Environment variable SUPPORTED_PLATFORMS is empty") + endif() + + separate_arguments(all_platforms) + if(NOT this_sdk IN_LIST all_platforms) + message(FATAL_ERROR "`${this_sdk}` not found in `${all_platforms}`") + endif() + + list(REMOVE_ITEM all_platforms "" "${this_sdk}") + list(LENGTH all_platforms all_platforms_length) + if(NOT all_platforms_length EQUAL 1) + message(FATAL_ERROR "Expected one element: ${all_platforms}") + endif() + + set(${this_sdk_var} "${this_sdk}" PARENT_SCOPE) + set(${corr_sdk_var} "${all_platforms}" PARENT_SCOPE) +endfunction() + +# Create combined binary for the given target. +# +# Preconditions: +# * Target already installed at ${destination} +# for the ${PLATFORM_NAME} platform +# +# This function will: +# * Run build for the lacking platform, i.e. opposite to the ${PLATFORM_NAME} +# * Fuse both libraries by running lipo +function(ios_install_combined target destination) + if("${target}" STREQUAL "") + message(FATAL_ERROR "`target` is empty") + endif() + + if("${destination}" STREQUAL "") + message(FATAL_ERROR "`destination` is empty") + endif() + + if(NOT IS_ABSOLUTE "${destination}") + message(FATAL_ERROR "`destination` is not absolute: ${destination}") + endif() + + if(IS_DIRECTORY "${destination}" OR IS_SYMLINK "${destination}") + message(FATAL_ERROR "`destination` is no regular file: ${destination}") + endif() + + if("${CMAKE_BINARY_DIR}" STREQUAL "") + message(FATAL_ERROR "`CMAKE_BINARY_DIR` is empty") + endif() + + if(NOT IS_DIRECTORY "${CMAKE_BINARY_DIR}") + message(FATAL_ERROR "Is not a directory: ${CMAKE_BINARY_DIR}") + endif() + + if("${CMAKE_INSTALL_CONFIG_NAME}" STREQUAL "") + message(FATAL_ERROR "CMAKE_INSTALL_CONFIG_NAME is empty") + endif() + + set(cmd xcrun -f lipo) + execute_process( + COMMAND ${cmd} + RESULT_VARIABLE result + OUTPUT_VARIABLE output + ERROR_VARIABLE output + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_STRIP_TRAILING_WHITESPACE + ) + if(NOT result EQUAL 0) + message( + FATAL_ERROR "Command failed (${result}): ${cmd}\n\nOutput:\n${output}" + ) + endif() + set(_lipo_path ${output}) + + set(CURRENT_CONFIG "${CMAKE_INSTALL_CONFIG_NAME}") + set(CURRENT_TARGET "${target}") + + _ios_install_combined_message("Target: ${CURRENT_TARGET}") + _ios_install_combined_message("Config: ${CURRENT_CONFIG}") + _ios_install_combined_message("Destination: ${destination}") + + # Get SDKs + _ios_install_combined_detect_sdks(this_sdk corr_sdk) + + # Get architectures of the target + _ios_install_combined_get_valid_archs("${corr_sdk}" corr_valid_archs) + _ios_install_combined_get_valid_archs("${this_sdk}" this_valid_archs) + + # Return if there are no valid architectures for the SDK. + # (note that library already installed) + if("${corr_valid_archs}" STREQUAL "") + _ios_install_combined_message( + "No architectures detected for `${corr_sdk}` (skip)" + ) + return() + endif() + + # Trigger build of corresponding target + _ios_install_combined_build("${corr_sdk}") + + # Get location of the library in build directory + _ios_install_combined_get_build_setting( + "${corr_sdk}" "CONFIGURATION_BUILD_DIR" corr_build_dir) + _ios_install_combined_get_build_setting( + "${corr_sdk}" "EXECUTABLE_PATH" corr_executable_path) + set(corr "${corr_build_dir}/${corr_executable_path}") + + _ios_install_combined_keep_archs("${corr}" "${corr_valid_archs}") + _ios_install_combined_keep_archs("${destination}" "${this_valid_archs}") + + _ios_install_combined_message("Current: ${destination}") + _ios_install_combined_message("Corresponding: ${corr}") + + set(cmd "${_lipo_path}" -create ${corr} ${destination} -output ${destination}) + + execute_process( + COMMAND ${cmd} + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + RESULT_VARIABLE result + ) + + if(NOT result EQUAL 0) + message(FATAL_ERROR "Command failed: ${cmd}") + endif() + + _ios_install_combined_message("Install done: ${destination}") +endfunction() diff --git a/Modules/CMakeLanguageInformation.cmake b/Modules/CMakeLanguageInformation.cmake new file mode 100644 index 000000000..e03d149c0 --- /dev/null +++ b/Modules/CMakeLanguageInformation.cmake @@ -0,0 +1,37 @@ + +#============================================================================= +# Copyright 2015 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# This file contains common code blocks used by all the language information +# files + +# load any compiler-wrapper specific information +macro(__cmake_include_compiler_wrapper lang) + set(_INCLUDED_WRAPPER_FILE 0) + if (CMAKE_${lang}_COMPILER_ID) + include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_${lang}_COMPILER_WRAPPER}-${CMAKE_${lang}_COMPILER_ID}-${lang} OPTIONAL RESULT_VARIABLE _INCLUDED_WRAPPER_FILE) + endif() + if (NOT _INCLUDED_WRAPPER_FILE) + include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_${lang}_COMPILER_WRAPPER}-${lang} OPTIONAL RESULT_VARIABLE _INCLUDED_WRAPPER_FILE) + endif () + + # No platform - wrapper - lang information so maybe there's just wrapper - lang information + if(NOT _INCLUDED_WRAPPER_FILE) + if (CMAKE_${lang}_COMPILER_ID) + include(Compiler/${CMAKE_${lang}_COMPILER_WRAPPER}-${CMAKE_${lang}_COMPILER_ID}-${lang} OPTIONAL RESULT_VARIABLE _INCLUDED_WRAPPER_FILE) + endif() + if (NOT _INCLUDED_WRAPPER_FILE) + include(Compiler/${CMAKE_${lang}_COMPILER_WRAPPER}-${lang} OPTIONAL RESULT_VARIABLE _INCLUDED_WRAPPER_FILE) + endif () + endif () +endmacro () diff --git a/Modules/CMakeParseArguments.cmake b/Modules/CMakeParseArguments.cmake index 8553f38f5..fc64ab9a2 100644 --- a/Modules/CMakeParseArguments.cmake +++ b/Modules/CMakeParseArguments.cmake @@ -2,86 +2,10 @@ # CMakeParseArguments # ------------------- # -# -# -# CMAKE_PARSE_ARGUMENTS( -# args...) -# -# CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions -# for parsing the arguments given to that macro or function. It -# processes the arguments and defines a set of variables which hold the -# values of the respective options. -# -# The argument contains all options for the respective macro, -# i.e. keywords which can be used when calling the macro without any -# value following, like e.g. the OPTIONAL keyword of the install() -# command. -# -# The argument contains all keywords for this macro -# which are followed by one value, like e.g. DESTINATION keyword of the -# install() command. -# -# The argument contains all keywords for this -# macro which can be followed by more than one value, like e.g. the -# TARGETS or FILES keywords of the install() command. -# -# When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the -# keywords listed in , and -# a variable composed of the given -# followed by "_" and the name of the respective keyword. These -# variables will then hold the respective value from the argument list. -# For the keywords this will be TRUE or FALSE. -# -# All remaining arguments are collected in a variable -# _UNPARSED_ARGUMENTS, this can be checked afterwards to see -# whether your macro was called with unrecognized parameters. -# -# As an example here a my_install() macro, which takes similar arguments -# as the real install() command: -# -# :: -# -# function(MY_INSTALL) -# set(options OPTIONAL FAST) -# set(oneValueArgs DESTINATION RENAME) -# set(multiValueArgs TARGETS CONFIGURATIONS) -# cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" -# "${multiValueArgs}" ${ARGN} ) -# ... -# -# -# -# Assume my_install() has been called like this: -# -# :: -# -# my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub) -# -# -# -# After the cmake_parse_arguments() call the macro will have set the -# following variables: -# -# :: -# -# MY_INSTALL_OPTIONAL = TRUE -# MY_INSTALL_FAST = FALSE (this option was not used when calling my_install() -# MY_INSTALL_DESTINATION = "bin" -# MY_INSTALL_RENAME = "" (was not used) -# MY_INSTALL_TARGETS = "foo;bar" -# MY_INSTALL_CONFIGURATIONS = "" (was not used) -# MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL" -# -# -# -# You can then continue and process these variables. -# -# Keywords terminate lists of values, e.g. if directly after a -# one_value_keyword another recognized keyword follows, this is -# interpreted as the beginning of the new option. E.g. -# my_install(TARGETS foo DESTINATION OPTIONAL) would result in -# MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION -# would be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefor. +# This module once implemented the :command:`cmake_parse_arguments` command +# that is now implemented natively by CMake. It is now an empty placeholder +# for compatibility with projects that include it to get the command from +# CMake 3.4 and lower. #============================================================================= # Copyright 2010 Alexander Neundorf @@ -95,67 +19,3 @@ #============================================================================= # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) - - -if(__CMAKE_PARSE_ARGUMENTS_INCLUDED) - return() -endif() -set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE) - - -function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames) - # first set all result variables to empty/FALSE - foreach(arg_name ${_singleArgNames} ${_multiArgNames}) - set(${prefix}_${arg_name}) - endforeach() - - foreach(option ${_optionNames}) - set(${prefix}_${option} FALSE) - endforeach() - - set(${prefix}_UNPARSED_ARGUMENTS) - - set(insideValues FALSE) - set(currentArgName) - - # now iterate over all arguments and fill the result variables - foreach(currentArg ${ARGN}) - list(FIND _optionNames "${currentArg}" optionIndex) # ... then this marks the end of the arguments belonging to this keyword - list(FIND _singleArgNames "${currentArg}" singleArgIndex) # ... then this marks the end of the arguments belonging to this keyword - list(FIND _multiArgNames "${currentArg}" multiArgIndex) # ... then this marks the end of the arguments belonging to this keyword - - if(${optionIndex} EQUAL -1 AND ${singleArgIndex} EQUAL -1 AND ${multiArgIndex} EQUAL -1) - if(insideValues) - if("${insideValues}" STREQUAL "SINGLE") - set(${prefix}_${currentArgName} ${currentArg}) - set(insideValues FALSE) - elseif("${insideValues}" STREQUAL "MULTI") - list(APPEND ${prefix}_${currentArgName} ${currentArg}) - endif() - else() - list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg}) - endif() - else() - if(NOT ${optionIndex} EQUAL -1) - set(${prefix}_${currentArg} TRUE) - set(insideValues FALSE) - elseif(NOT ${singleArgIndex} EQUAL -1) - set(currentArgName ${currentArg}) - set(${prefix}_${currentArgName}) - set(insideValues "SINGLE") - elseif(NOT ${multiArgIndex} EQUAL -1) - set(currentArgName ${currentArg}) - set(${prefix}_${currentArgName}) - set(insideValues "MULTI") - endif() - endif() - - endforeach() - - # propagate the result variables to the caller: - foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames}) - set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE) - endforeach() - set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE) - -endfunction() diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index 1e7b05581..7fb11c3b4 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -37,6 +37,7 @@ # * Default : CPACK_PACKAGE_DESCRIPTION_SUMMARY # # .. variable:: CPACK_RPM_PACKAGE_NAME +# CPACK_RPM__PACKAGE_NAME # # The RPM package name. # @@ -81,6 +82,7 @@ # * Default : "unknown" # # .. variable:: CPACK_RPM_PACKAGE_GROUP +# CPACK_RPM__PACKAGE_GROUP # # The RPM package group. # @@ -1106,10 +1108,7 @@ function(cpack_rpm_generate_package) # Are we packaging components ? if(CPACK_RPM_PACKAGE_COMPONENT) - set(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "-${CPACK_RPM_PACKAGE_COMPONENT}") string(TOUPPER ${CPACK_RPM_PACKAGE_COMPONENT} CPACK_RPM_PACKAGE_COMPONENT_UPPER) - else() - set(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "") endif() set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}") @@ -1143,10 +1142,19 @@ function(cpack_rpm_generate_package) endif() # CPACK_RPM_PACKAGE_NAME (mandatory) + if(NOT CPACK_RPM_PACKAGE_NAME) string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_RPM_PACKAGE_NAME) endif() + if(CPACK_RPM_PACKAGE_COMPONENT) + if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_NAME) + set(CPACK_RPM_PACKAGE_NAME ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_NAME}) + else() + set(CPACK_RPM_PACKAGE_NAME ${CPACK_RPM_PACKAGE_NAME}-${CPACK_RPM_PACKAGE_COMPONENT}) + endif() + endif() + # CPACK_RPM_PACKAGE_VERSION (mandatory) if(NOT CPACK_RPM_PACKAGE_VERSION) if(NOT CPACK_PACKAGE_VERSION) @@ -1206,6 +1214,15 @@ function(cpack_rpm_generate_package) endif() # CPACK_RPM_PACKAGE_GROUP + + #Check for component group first. + #If not set, it will use regular package group logic. + if(CPACK_RPM_PACKAGE_COMPONENT) + if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_GROUP) + set(CPACK_RPM_PACKAGE_GROUP ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_GROUP}) + endif() + endif() + if(NOT CPACK_RPM_PACKAGE_GROUP) set(CPACK_RPM_PACKAGE_GROUP "unknown") endif() @@ -1613,7 +1630,7 @@ function(cpack_rpm_generate_package) ) # The name of the final spec file to be used by rpmbuild - set(CPACK_RPM_BINARY_SPECFILE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.spec") + set(CPACK_RPM_BINARY_SPECFILE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_NAME}.spec") # Print out some debug information if we were asked for that if(CPACK_RPM_PACKAGE_DEBUG) @@ -1645,7 +1662,7 @@ function(cpack_rpm_generate_package) "# -*- rpm-spec -*- BuildRoot: \@CPACK_RPM_DIRECTORY\@/\@CPACK_PACKAGE_FILE_NAME\@\@CPACK_RPM_PACKAGE_COMPONENT_PART_PATH\@ Summary: \@CPACK_RPM_PACKAGE_SUMMARY\@ -Name: \@CPACK_RPM_PACKAGE_NAME\@\@CPACK_RPM_PACKAGE_COMPONENT_PART_NAME\@ +Name: \@CPACK_RPM_PACKAGE_NAME\@ Version: \@CPACK_RPM_PACKAGE_VERSION\@ Release: \@CPACK_RPM_PACKAGE_RELEASE\@ License: \@CPACK_RPM_PACKAGE_LICENSE\@ @@ -1749,15 +1766,15 @@ mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\" $RPM_BUILD_ROOT "${CPACK_RPM_BINARY_SPECFILE}" WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}" RESULT_VARIABLE CPACK_RPMBUILD_EXEC_RESULT - ERROR_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.err" - OUTPUT_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.out") + ERROR_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.err" + OUTPUT_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.out") if(CPACK_RPM_PACKAGE_DEBUG OR CPACK_RPMBUILD_EXEC_RESULT) - file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.err RPMBUILDERR) - file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.out RPMBUILDOUT) + file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.err RPMBUILDERR) + file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.out RPMBUILDOUT) message("CPackRPM:Debug: You may consult rpmbuild logs in: ") - message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.err") + message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.err") message("CPackRPM:Debug: *** ${RPMBUILDERR} ***") - message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.out") + message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.out") message("CPackRPM:Debug: *** ${RPMBUILDOUT} ***") endif() else() diff --git a/Modules/CPackWIX.cmake b/Modules/CPackWIX.cmake index bef8e16c2..499400515 100644 --- a/Modules/CPackWIX.cmake +++ b/Modules/CPackWIX.cmake @@ -119,7 +119,8 @@ # # .. variable:: CPACK_WIX_PATCH_FILE # -# Optional XML file with fragments to be inserted into generated WiX sources +# Optional list of XML files with fragments to be inserted into +# generated WiX sources # # This optional variable can be used to specify an XML file that the # WiX generator will use to inject fragments into its generated diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake index 6a0a5e2ff..dc6271198 100644 --- a/Modules/Compiler/Clang-CXX.cmake +++ b/Modules/Compiler/Clang-CXX.cmake @@ -6,7 +6,7 @@ if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") endif() cmake_policy(GET CMP0025 appleClangPolicy) -if(WIN32 OR (APPLE AND NOT appleClangPolicy STREQUAL NEW)) +if(APPLE AND NOT appleClangPolicy STREQUAL NEW) return() endif() @@ -49,7 +49,7 @@ macro(cmake_record_cxx_compile_features) endmacro() set(_result 0) - if (UNIX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4) + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4) _get_clang_features(${CMAKE_CXX14_STANDARD_COMPILE_OPTION} CMAKE_CXX14_COMPILE_FEATURES) if (_result EQUAL 0) _get_clang_features(${CMAKE_CXX11_STANDARD_COMPILE_OPTION} CMAKE_CXX11_COMPILE_FEATURES) diff --git a/Modules/Compiler/CrayPrgEnv-C.cmake b/Modules/Compiler/CrayPrgEnv-C.cmake new file mode 100644 index 000000000..6b461ce06 --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-C.cmake @@ -0,0 +1,11 @@ +if(__craylinux_crayprgenv_c) + return() +endif() +set(__craylinux_crayprgenv_c 1) + +include(Compiler/CrayPrgEnv) +macro(__CrayPrgEnv_setup_C compiler_cmd link_cmd) + __CrayPrgEnv_setup(C + ${CMAKE_ROOT}/Modules/CMakeCCompilerABI.c + ${compiler_cmd} ${link_cmd}) +endmacro() diff --git a/Modules/Compiler/CrayPrgEnv-CXX.cmake b/Modules/Compiler/CrayPrgEnv-CXX.cmake new file mode 100644 index 000000000..aad85b67e --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-CXX.cmake @@ -0,0 +1,11 @@ +if(__craylinux_crayprgenv_cxx) + return() +endif() +set(__craylinux_crayprgenv_cxx 1) + +include(Compiler/CrayPrgEnv) +macro(__CrayPrgEnv_setup_CXX compiler_cmd link_cmd) + __CrayPrgEnv_setup(CXX + ${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp + ${compiler_cmd} ${link_cmd}) +endmacro() diff --git a/Modules/Compiler/CrayPrgEnv-Cray-C.cmake b/Modules/Compiler/CrayPrgEnv-Cray-C.cmake new file mode 100644 index 000000000..547a4b4d5 --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-Cray-C.cmake @@ -0,0 +1,7 @@ +if(__craylinux_crayprgenv_cray_c) + return() +endif() +set(__craylinux_crayprgenv_cray_c 1) + +include(Compiler/CrayPrgEnv-C) +__CrayPrgEnv_setup_C("/opt/cray/cce/.*/ccfe" "/opt/cray/cce/.*/ld") diff --git a/Modules/Compiler/CrayPrgEnv-Cray-CXX.cmake b/Modules/Compiler/CrayPrgEnv-Cray-CXX.cmake new file mode 100644 index 000000000..df8452c15 --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-Cray-CXX.cmake @@ -0,0 +1,7 @@ +if(__craylinux_crayprgenv_cray_cxx) + return() +endif() +set(__craylinux_crayprgenv_cray_cxx 1) + +include(Compiler/CrayPrgEnv-CXX) +__CrayPrgEnv_setup_CXX("/opt/cray/cce/.*/ccfe" "/opt/cray/cce/.*/ld") diff --git a/Modules/Compiler/CrayPrgEnv-Cray-Fortran.cmake b/Modules/Compiler/CrayPrgEnv-Cray-Fortran.cmake new file mode 100644 index 000000000..9f46a04c8 --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-Cray-Fortran.cmake @@ -0,0 +1,7 @@ +if(__craylinux_crayprgenv_cray_fortran) + return() +endif() +set(__craylinux_crayprgenv_cray_fortran 1) + +include(Compiler/CrayPrgEnv-Fortran) +__CrayPrgEnv_setup_Fortran("/opt/cray/cce/.*/ftnfe" "/opt/cray/cce/.*/ld") diff --git a/Modules/Compiler/CrayPrgEnv-Fortran.cmake b/Modules/Compiler/CrayPrgEnv-Fortran.cmake new file mode 100644 index 000000000..9c4d2694a --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-Fortran.cmake @@ -0,0 +1,11 @@ +if(__craylinux_crayprgenv_fortran) + return() +endif() +set(__craylinux_crayprgenv_fortran 1) + +include(Compiler/CrayPrgEnv) +macro(__CrayPrgEnv_setup_Fortran compiler_cmd link_cmd) + __CrayPrgEnv_setup(Fortran + ${CMAKE_ROOT}/Modules/CMakeFortranCompilerABI.F + ${compiler_cmd} ${link_cmd}) +endmacro() diff --git a/Modules/Compiler/CrayPrgEnv-GNU-C.cmake b/Modules/Compiler/CrayPrgEnv-GNU-C.cmake new file mode 100644 index 000000000..248081b87 --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-GNU-C.cmake @@ -0,0 +1,7 @@ +if(__craylinux_crayprgenv_gnu_c) + return() +endif() +set(__craylinux_crayprgenv_gnu_c 1) + +include(Compiler/CrayPrgEnv-C) +__CrayPrgEnv_setup_C("/opt/gcc/.*/cc1" "/opt/gcc/.*/collect2") diff --git a/Modules/Compiler/CrayPrgEnv-GNU-CXX.cmake b/Modules/Compiler/CrayPrgEnv-GNU-CXX.cmake new file mode 100644 index 000000000..be4eb6d54 --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-GNU-CXX.cmake @@ -0,0 +1,7 @@ +if(__craylinux_crayprgenv_gnu_cxx) + return() +endif() +set(__craylinux_crayprgenv_gnu_cxx 1) + +include(Compiler/CrayPrgEnv-CXX) +__CrayPrgEnv_setup_CXX("/opt/gcc/.*/cc1plus" "/opt/gcc/.*/collect2") diff --git a/Modules/Compiler/CrayPrgEnv-GNU-Fortran.cmake b/Modules/Compiler/CrayPrgEnv-GNU-Fortran.cmake new file mode 100644 index 000000000..8bd23ff88 --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-GNU-Fortran.cmake @@ -0,0 +1,7 @@ +if(__craylinux_crayprgenv_gnu_fortran) + return() +endif() +set(__craylinux_crayprgenv_gnu_fortran 1) + +include(Compiler/CrayPrgEnv-Fortran) +__CrayPrgEnv_setup_Fortran("/opt/gcc/.*/f951" "/opt/gcc/.*/collect2") diff --git a/Modules/Compiler/CrayPrgEnv-Intel-C.cmake b/Modules/Compiler/CrayPrgEnv-Intel-C.cmake new file mode 100644 index 000000000..83c4e3801 --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-Intel-C.cmake @@ -0,0 +1,7 @@ +if(__craylinux_crayprgenv_intel_c) + return() +endif() +set(__craylinux_crayprgenv_intel_c 1) + +include(Compiler/CrayPrgEnv-C) +__CrayPrgEnv_setup_C("/opt/intel/.*/mcpcom" "^ld ") diff --git a/Modules/Compiler/CrayPrgEnv-Intel-CXX.cmake b/Modules/Compiler/CrayPrgEnv-Intel-CXX.cmake new file mode 100644 index 000000000..3c3c3e63f --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-Intel-CXX.cmake @@ -0,0 +1,7 @@ +if(__craylinux_crayprgenv_intel_cxx) + return() +endif() +set(__craylinux_crayprgenv_intel_cxx 1) + +include(Compiler/CrayPrgEnv-CXX) +__CrayPrgEnv_setup_CXX("/opt/intel/.*/mcpcom" "^ld ") diff --git a/Modules/Compiler/CrayPrgEnv-Intel-Fortran.cmake b/Modules/Compiler/CrayPrgEnv-Intel-Fortran.cmake new file mode 100644 index 000000000..08a316d2c --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-Intel-Fortran.cmake @@ -0,0 +1,7 @@ +if(__craylinux_crayprgenv_intel_fortran) + return() +endif() +set(__craylinux_crayprgenv_intel_fortran 1) + +include(Compiler/CrayPrgEnv-Fortran) +__CrayPrgEnv_setup_Fortran("/opt/intel/.*/fortcom" "^ld ") diff --git a/Modules/Compiler/CrayPrgEnv-PGI-C.cmake b/Modules/Compiler/CrayPrgEnv-PGI-C.cmake new file mode 100644 index 000000000..f45767caf --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-PGI-C.cmake @@ -0,0 +1,7 @@ +if(__craylinux_crayprgenv_pgi_c) + return() +endif() +set(__craylinux_crayprgenv_pgi_c 1) + +include(Compiler/CrayPrgEnv-C) +__CrayPrgEnv_setup_C("/opt/pgi/[^ ]*/pgc" "/usr/bin/ld") diff --git a/Modules/Compiler/CrayPrgEnv-PGI-CXX.cmake b/Modules/Compiler/CrayPrgEnv-PGI-CXX.cmake new file mode 100644 index 000000000..a2a286f8c --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-PGI-CXX.cmake @@ -0,0 +1,7 @@ +if(__craylinux_crayprgenv_pgi_cxx) + return() +endif() +set(__craylinux_crayprgenv_pgi_cxx 1) + +include(Compiler/CrayPrgEnv-CXX) +__CrayPrgEnv_setup_CXX("/opt/pgi/[^ ]*/pgcpp" "/usr/bin/ld") diff --git a/Modules/Compiler/CrayPrgEnv-PGI-Fortran.cmake b/Modules/Compiler/CrayPrgEnv-PGI-Fortran.cmake new file mode 100644 index 000000000..f6ba7c0fa --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-PGI-Fortran.cmake @@ -0,0 +1,7 @@ +if(__craylinux_crayprgenv_pgi_fortran) + return() +endif() +set(__craylinux_crayprgenv_pgi_fortran 1) + +include(Compiler/CrayPrgEnv-Fortran) +__CrayPrgEnv_setup_Fortran("/opt/pgi/[^ ]*/pgf" "/usr/bin/ld") diff --git a/Modules/Compiler/CrayPrgEnv.cmake b/Modules/Compiler/CrayPrgEnv.cmake new file mode 100644 index 000000000..fa39b009a --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv.cmake @@ -0,0 +1,91 @@ +# Guard against multiple inclusions +if(__craylinux_crayprgenv) + return() +endif() +set(__craylinux_crayprgenv 1) + +macro(__cray_extract_args cmd tag_regex out_var make_absolute) + string(REGEX MATCHALL "${tag_regex}" args "${cmd}") + foreach(arg IN LISTS args) + string(REGEX REPLACE "^${tag_regex}$" "\\2" param "${arg}") + if(make_absolute) + get_filename_component(param "${param}" ABSOLUTE) + endif() + list(APPEND ${out_var} ${param}) + endforeach() +endmacro() + +function(__cray_extract_implicit src compiler_cmd link_cmd lang include_dirs_var link_dirs_var link_libs_var) + set(BIN "${CMAKE_PLATFORM_INFO_DIR}/CrayExtractImplicit_${lang}.bin") + execute_process( + COMMAND ${CMAKE_${lang}_COMPILER} ${CMAKE_${lang}_VERBOSE_FLAG} -o ${BIN} + RESULT_VARIABLE result + OUTPUT_VARIABLE output + ERROR_VARIABLE error + ) + if(EXISTS "${BIN}") + file(REMOVE "${BIN}") + endif() + set(include_dirs) + set(link_dirs) + set(link_libs) + string(REGEX REPLACE "\r?\n" ";" output_lines "${output}\n${error}") + foreach(line IN LISTS output_lines) + if("${line}" MATCHES "${compiler_cmd}") + __cray_extract_args("${line}" " -(I ?|isystem )([^ ]*)" include_dirs 1) + set(processed_include 1) + endif() + if("${line}" MATCHES "${link_cmd}") + __cray_extract_args("${line}" " -(L ?)([^ ]*)" link_dirs 1) + __cray_extract_args("${line}" " -(l ?)([^ ]*)" link_libs 0) + set(processed_link 1) + endif() + if(processed_include AND processed_link) + break() + endif() + endforeach() + + set(${include_dirs_var} "${include_dirs}" PARENT_SCOPE) + set(${link_dirs_var} "${link_dirs}" PARENT_SCOPE) + set(${link_libs_var} "${link_libs}" PARENT_SCOPE) + set(CRAY_${lang}_EXTRACTED_IMPLICIT 1 CACHE INTERNAL "" FORCE) +endfunction() + +macro(__CrayPrgEnv_setup lang test_src compiler_cmd link_cmd) + if(DEFINED ENV{CRAYPE_VERSION}) + message(STATUS "Cray Programming Environment $ENV{CRAYPE_VERSION} ${lang}") + elseif(DEFINED ENV{ASYNCPE_VERSION}) + message(STATUS "Cray XT Programming Environment $ENV{ASYNCPE_VERSION} ${lang}") + endif() + + # Flags for the Cray wrappers + set(CMAKE_STATIC_LIBRARY_LINK_${lang}_FLAGS "-static") + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "") + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared") + set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-dynamic") + + # If the link type is not explicitly specified in the environment then + # the Cray wrappers assume that the code will be built staticly so + # we check the following condition(s) are NOT met + # Compiler flags are explicitly dynamic + # Env var is dynamic and compiler flags are not explicitly static + if(NOT (((CMAKE_${lang}_FLAGS MATCHES "(^| )-dynamic($| )") OR + (CMAKE_EXE_LINKER_FLAGS MATCHES "(^| )-dynamic($| )")) + OR + (("$ENV{CRAYPE_LINK_TYPE}" STREQUAL "dynamic") AND + NOT ((CMAKE_${lang}_FLAGS MATCHES "(^| )-static($| )") OR + (CMAKE_EXE_LINKER_FLAGS MATCHES "(^| )-static($| )"))))) + set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) + set(BUILD_SHARED_LIBS FALSE CACHE BOOL "") + set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") + set(CMAKE_LINK_SEARCH_START_STATIC TRUE) + endif() + if(NOT CRAY_${lang}_EXTRACTED_IMPLICIT) + __cray_extract_implicit( + ${test_src} ${compiler_cmd} ${link_cmd} ${lang} + CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES + CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES + CMAKE_${lang}_IMPLICIT_LINK_LIBRARIES + ) + endif() +endmacro() diff --git a/Modules/Compiler/Embarcadero-DetermineCompiler.cmake b/Modules/Compiler/Embarcadero-DetermineCompiler.cmake index 2feedac35..8375624e9 100644 --- a/Modules/Compiler/Embarcadero-DetermineCompiler.cmake +++ b/Modules/Compiler/Embarcadero-DetermineCompiler.cmake @@ -4,4 +4,4 @@ set(_compiler_id_pp_test "defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__ set(_compiler_id_version_compute " # define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__CODEGEARC_VERSION__>>24 & 0x00FF) # define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__CODEGEARC_VERSION__>>16 & 0x00FF) -# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_HEX@(__CODEGEARC_VERSION__ & 0xFFFF)") +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__CODEGEARC_VERSION__ & 0xFFFF)") diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index c822bdb97..249658d62 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -57,6 +57,8 @@ Create custom targets to build projects in external trees URL of git repo ``GIT_TAG `` Git branch name, commit id or tag + ``GIT_REMOTE_NAME `` + The optional name of the remote, default to ``origin`` ``GIT_SUBMODULES ...`` Git submodules that shall be updated, all if empty ``HG_REPOSITORY `` @@ -494,7 +496,7 @@ define_property(DIRECTORY PROPERTY "EP_UPDATE_DISCONNECTED" INHERITED "ExternalProject module." ) -function(_ep_write_gitclone_script script_filename source_dir git_EXECUTABLE git_repository git_tag git_submodules src_name work_dir gitclone_infofile gitclone_stampfile) +function(_ep_write_gitclone_script script_filename source_dir git_EXECUTABLE git_repository git_tag git_remote_name git_submodules src_name work_dir gitclone_infofile gitclone_stampfile) file(WRITE ${script_filename} "if(\"${git_tag}\" STREQUAL \"\") message(FATAL_ERROR \"Tag for git checkout should not be empty.\") @@ -524,7 +526,7 @@ set(error_code 1) set(number_of_tries 0) while(error_code AND number_of_tries LESS 3) execute_process( - COMMAND \"${git_EXECUTABLE}\" clone \"${git_repository}\" \"${src_name}\" + COMMAND \"${git_EXECUTABLE}\" clone --origin \"${git_remote_name}\" \"${git_repository}\" \"${src_name}\" WORKING_DIRECTORY \"${work_dir}\" RESULT_VARIABLE error_code ) @@ -645,7 +647,7 @@ endif() endfunction() -function(_ep_write_gitupdate_script script_filename git_EXECUTABLE git_tag git_submodules git_repository work_dir) +function(_ep_write_gitupdate_script script_filename git_EXECUTABLE git_tag git_remote_name git_submodules git_repository work_dir) if(NOT GIT_VERSION_STRING VERSION_LESS 1.7.6) set(git_stash_save_options --all --quiet) else() @@ -687,7 +689,7 @@ if(\"\${show_ref_output}\" MATCHES \"refs/remotes/${git_tag}\") set(git_remote \"\${CMAKE_MATCH_1}\") set(git_tag \"\${CMAKE_MATCH_2}\") else() - set(git_remote \"origin\") + set(git_remote \"${git_remote_name}\") set(git_tag \"${git_tag}\") endif() @@ -1228,9 +1230,24 @@ function(_ep_get_build_command name step cmd_var) set(cmd "${CMAKE_COMMAND}") endif() set(args --build ".") - if (CMAKE_CFG_INTDIR AND NOT CMAKE_CFG_INTDIR STREQUAL ".") - list(APPEND args --config "${CMAKE_CFG_INTDIR}") - endif () + if(CMAKE_CONFIGURATION_TYPES) + if (CMAKE_CFG_INTDIR AND + NOT CMAKE_CFG_INTDIR STREQUAL "." AND + NOT CMAKE_CFG_INTDIR MATCHES "\\$") + # CMake 3.4 and below used the CMAKE_CFG_INTDIR placeholder value + # provided by multi-configuration generators. Some projects were + # taking advantage of that undocumented implementation detail to + # specify a specific configuration here. They should use + # BUILD_COMMAND to change the default command instead, but for + # compatibility honor the value. + set(config ${CMAKE_CFG_INTDIR}) + message(AUTHOR_WARNING "CMAKE_CFG_INTDIR should not be set by project code.\n" + "To get a non-default build command, use the BUILD_COMMAND option.") + else() + set(config $) + endif() + list(APPEND args --config ${config}) + endif() if(step STREQUAL "INSTALL") list(APPEND args --target install) endif() @@ -1238,6 +1255,9 @@ function(_ep_get_build_command name step cmd_var) if("x${step}x" STREQUAL "xTESTx") string(REGEX REPLACE "^(.*/)cmake([^/]*)$" "\\1ctest\\2" cmd "${cmd}") set(args "") + if(CMAKE_CONFIGURATION_TYPES) + list(APPEND args -C ${config}) + endif() endif() endif() else() @@ -1749,6 +1769,11 @@ function(_ep_add_download_command name) endif() get_property(git_submodules TARGET ${name} PROPERTY _EP_GIT_SUBMODULES) + get_property(git_remote_name TARGET ${name} PROPERTY _EP_GIT_REMOTE_NAME) + if(NOT git_remote_name) + set(git_remote_name "origin") + endif() + # For the download step, and the git clone operation, only the repository # should be recorded in a configured RepositoryInfo file. If the repo # changes, the clone script should be run again. But if only the tag @@ -1772,7 +1797,7 @@ function(_ep_add_download_command name) # The script will delete the source directory and then call git clone. # _ep_write_gitclone_script(${tmp_dir}/${name}-gitclone.cmake ${source_dir} - ${GIT_EXECUTABLE} ${git_repository} ${git_tag} "${git_submodules}" ${src_name} ${work_dir} + ${GIT_EXECUTABLE} ${git_repository} ${git_tag} ${git_remote_name} "${git_submodules}" ${src_name} ${work_dir} ${stamp_dir}/${name}-gitinfo.txt ${stamp_dir}/${name}-gitclone-lastrun.txt ) set(comment "Performing download step (git clone) for '${name}'") @@ -1993,9 +2018,13 @@ function(_ep_add_update_command name) if(NOT git_tag) set(git_tag "master") endif() + get_property(git_remote_name TARGET ${name} PROPERTY _EP_GIT_REMOTE_NAME) + if(NOT git_remote_name) + set(git_remote_name "origin") + endif() get_property(git_submodules TARGET ${name} PROPERTY _EP_GIT_SUBMODULES) _ep_write_gitupdate_script(${tmp_dir}/${name}-gitupdate.cmake - ${GIT_EXECUTABLE} ${git_tag} "${git_submodules}" ${git_repository} ${work_dir} + ${GIT_EXECUTABLE} ${git_tag} ${git_remote_name} "${git_submodules}" ${git_repository} ${work_dir} ) set(cmd ${CMAKE_COMMAND} -P ${tmp_dir}/${name}-gitupdate.cmake) set(always 1) diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index 6a583d957..416b666b9 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -494,18 +494,18 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN "mkl_blas95${BLAS_mkl_DLL_SUFFIX} mkl_intel_c${BLAS_mkl_DLL_SUFFIX}") endif() - if (BLA_VENDOR STREQUAL "Intel10_64lp*" OR BLA_VENDOR STREQUAL "All") + if (BLA_VENDOR MATCHES "^Intel10_64lp" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN "mkl_blas95_lp64${BLAS_mkl_DLL_SUFFIX} mkl_intel_lp64${BLAS_mkl_DLL_SUFFIX}") endif () # Add threading/sequential libs set(BLAS_SEARCH_LIBS_WIN_THREAD "") - if (BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All") + if (BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD "mkl_sequential${BLAS_mkl_DLL_SUFFIX}") endif() - if (NOT BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All") + if (NOT BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All") # old version list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD "libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}") @@ -561,14 +561,14 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN "mkl_intel_c${BLAS_mkl_DLL_SUFFIX}") endif() - if (BLA_VENDOR STREQUAL "Intel10_64lp*" OR BLA_VENDOR STREQUAL "All") + if (BLA_VENDOR MATCHES "^Intel10_64lp" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN "mkl_intel_lp64${BLAS_mkl_DLL_SUFFIX}") endif () # Add threading/sequential libs set(BLAS_SEARCH_LIBS_WIN_THREAD "") - if (NOT BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All") + if (NOT BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All") # old version list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD "libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}") @@ -576,7 +576,7 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD "libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}") endif() - if (BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All") + if (BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD "mkl_sequential${BLAS_mkl_DLL_SUFFIX}") endif() diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 33e6a4970..c3058eaec 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -54,6 +54,33 @@ # Boost__LIBRARY_DEBUG - Component library debug variant # Boost__LIBRARY_RELEASE - Component library release variant # +# The following :prop_tgt:`IMPORTED` targets are also defined:: +# +# Boost::boost - Target for header-only dependencies +# (Boost include directory) +# Boost:: - Target for specific component dependency +# (shared or static library); is lower- +# case +# Boost::diagnostic_definitions - interface target to enable diagnostic +# information about Boost's automatic linking +# during compilation (adds BOOST_LIB_DIAGNOSTIC) +# Boost::disable_autolinking - interface target to disable automatic +# linking with MSVC (adds BOOST_ALL_NO_LIB) +# Boost::dynamic_linking - interface target to enable dynamic linking +# linking with MSVC (adds BOOST_ALL_DYN_LINK) +# +# Implicit dependencies such as Boost::filesystem requiring +# Boost::system will be automatically detected and satisfied, even +# if system is not specified when using find_package and if +# Boost::system is not added to target_link_libraries. If using +# Boost::thread, then Thread::Thread will also be added automatically. +# +# It is important to note that the imported targets behave differently +# than variables created by this module: multiple calls to +# find_package(Boost) in the same directory or sub-directories with +# different options (e.g. static or shared) will not override the +# values of the targets created by the first call. +# # Users may set these hints or results as cache entries. Projects # should not read these entries directly but instead use the above # result variables. Note that some hint names start in upper-case @@ -142,6 +169,14 @@ # add_executable(foo foo.cc) # endif() # +# Example to find Boost libraries and use imported targets:: +# +# find_package(Boost 1.56 REQUIRED COMPONENTS +# date_time filesystem iostreams) +# add_executable(foo foo.cc) +# target_link_libraries(foo Boost::date_time Boost::filesystem +# Boost::iostreams) +# # Example to find Boost headers and some *static* libraries:: # # set(Boost_USE_STATIC_LIBS ON) # only find static libs @@ -471,6 +506,276 @@ function(_Boost_GUESS_COMPILER_PREFIX _ret) set(${_ret} ${_boost_COMPILER} PARENT_SCOPE) endfunction() +# +# Get component dependencies. Requires the dependencies to have been +# defined for the Boost release version. +# +# component - the component to check +# _ret - list of library dependencies +# +function(_Boost_COMPONENT_DEPENDENCIES component _ret) + # Note: to add a new Boost release, run + # + # % cmake -DBOOST_DIR=/path/to/boost/source -P Utilities/Scripts/BoostScanDeps.cmake + # + # The output may be added in a new block below. If it's the same as + # the previous release, simply update the version range of the block + # for the previous release. + # + # This information was originally generated by running + # BoostScanDeps.cmake against every boost release to date supported + # by FindBoost: + # + # % for version in /path/to/boost/sources/* + # do + # cmake -DBOOST_DIR=$version -P Utilities/Scripts/BoostScanDeps.cmake + # done + # + # The output was then updated by search and replace with these regexes: + # + # - Strip message(STATUS) prefix dashes + # s;^-- ;; + # - Indent + # s;^set(; set(;; + # - Add conditionals + # s;Scanning /path/to/boost/sources/boost_\(.*\)_\(.*\)_\(.*); elseif(NOT Boost_VERSION VERSION_LESS \10\20\3 AND Boost_VERSION VERSION_LESS xxxx); + # + # This results in the logic seen below, but will require the xxxx + # replacing with the following Boost release version (or the next + # minor version to be released, e.g. 1.59 was the latest at the time + # of writing, making 1.60 the next, so 106000 is the needed version + # number). Identical consecutive releases were then merged together + # by updating the end range of the first block and removing the + # following redundant blocks. + # + # Running the script against all historical releases should be + # required only if the BoostScanDeps.cmake script logic is changed. + # The addition of a new release should only require it to be run + # against the new release. + set(_Boost_IMPORTED_TARGETS TRUE) + if(NOT Boost_VERSION VERSION_LESS 103300 AND Boost_VERSION VERSION_LESS 103500) + set(_Boost_IOSTREAMS_DEPENDENCIES regex thread) + set(_Boost_REGEX_DEPENDENCIES thread) + set(_Boost_WAVE_DEPENDENCIES filesystem thread) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 103500 AND Boost_VERSION VERSION_LESS 103600) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_WAVE_DEPENDENCIES filesystem system thread) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 103600 AND Boost_VERSION VERSION_LESS 103800) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_WAVE_DEPENDENCIES filesystem system thread) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 103800 AND Boost_VERSION VERSION_LESS 104300) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_THREAD_DEPENDENCIES date_time) + set(_Boost_WAVE_DEPENDENCIES filesystem system thread date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 104300 AND Boost_VERSION VERSION_LESS 104400) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_THREAD_DEPENDENCIES date_time) + set(_Boost_WAVE_DEPENDENCIES filesystem system thread date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 104400 AND Boost_VERSION VERSION_LESS 104500) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random serialization) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_THREAD_DEPENDENCIES date_time) + set(_Boost_WAVE_DEPENDENCIES serialization filesystem system thread date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 104500 AND Boost_VERSION VERSION_LESS 104700) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_THREAD_DEPENDENCIES date_time) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 104700 AND Boost_VERSION VERSION_LESS 104800) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_THREAD_DEPENDENCIES date_time) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 104800 AND Boost_VERSION VERSION_LESS 105000) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_THREAD_DEPENDENCIES date_time) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 105000 AND Boost_VERSION VERSION_LESS 105300) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 105300 AND Boost_VERSION VERSION_LESS 105400) + set(_Boost_ATOMIC_DEPENDENCIES thread chrono system date_time) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 105400 AND Boost_VERSION VERSION_LESS 105500) + set(_Boost_ATOMIC_DEPENDENCIES thread chrono system date_time) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 105500 AND Boost_VERSION VERSION_LESS 105600) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_COROUTINE_DEPENDENCIES context system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 105600 AND Boost_VERSION VERSION_LESS 105900) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_COROUTINE_DEPENDENCIES context system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_RANDOM_DEPENDENCIES system) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 105900 AND Boost_VERSION VERSION_LESS 106000) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_COROUTINE_DEPENDENCIES context system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono atomic) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_RANDOM_DEPENDENCIES system) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 106000 AND Boost_VERSION VERSION_LESS 106200) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_COROUTINE_DEPENDENCIES context system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_RANDOM_DEPENDENCIES system) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + else() + message(WARNING "Imported targets not available for Boost version ${Boost_VERSION}") + set(_Boost_IMPORTED_TARGETS FALSE) + endif() + + string(TOUPPER ${component} uppercomponent) + set(${_ret} ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE) + set(_Boost_IMPORTED_TARGETS ${_Boost_IMPORTED_TARGETS} PARENT_SCOPE) + + string(REGEX REPLACE ";" " " _boost_DEPS_STRING "${_Boost_${uppercomponent}_DEPENDENCIES}") + if (NOT _boost_DEPS_STRING) + set(_boost_DEPS_STRING "(none)") + endif() + # message(STATUS "Dependencies for Boost::${component}: ${_boost_DEPS_STRING}") +endfunction() + +# +# Determine if any missing dependencies require adding to the component list. +# +# Sets _Boost_${COMPONENT}_DEPENDENCIES for each required component, +# plus _Boost_IMPORTED_TARGETS (TRUE if imported targets should be +# defined; FALSE if dependency information is unavailable). +# +# componentvar - the component list variable name +# +# +function(_Boost_MISSING_DEPENDENCIES componentvar) + # _boost_unprocessed_components - list of components requiring processing + # _boost_processed_components - components already processed (or currently being processed) + # _boost_new_components - new components discovered for future processing + # + list(APPEND _boost_unprocessed_components ${${componentvar}}) + + while(_boost_unprocessed_components) + list(APPEND _boost_processed_components ${_boost_unprocessed_components}) + foreach(component ${_boost_unprocessed_components}) + string(TOUPPER ${component} uppercomponent) + set(${_ret} ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE) + _Boost_COMPONENT_DEPENDENCIES("${component}" _Boost_${uppercomponent}_DEPENDENCIES) + set(_Boost_${uppercomponent}_DEPENDENCIES ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE) + set(_Boost_IMPORTED_TARGETS ${_Boost_IMPORTED_TARGETS} PARENT_SCOPE) + foreach(componentdep ${_Boost_${uppercomponent}_DEPENDENCIES}) + list(FIND _boost_processed_components "${componentdep}" _boost_component_found) + list(FIND _boost_new_components "${componentdep}" _boost_component_new) + if (_boost_component_found EQUAL -1 AND _boost_component_new EQUAL -1) + list(APPEND _boost_new_components ${componentdep}) + endif() + endforeach() + endforeach() + set(_boost_unprocessed_components ${_boost_new_components}) + unset(_boost_new_components) + endwhile() + set(${componentvar} ${_boost_processed_components} PARENT_SCOPE) +endfunction() + # # End functions/macros # @@ -511,8 +816,12 @@ if(Boost_FIND_VERSION_EXACT) else() # The user has not requested an exact version. Among known # versions, find those that are acceptable to the user request. + # + # Note: When adding a new Boost release, also update the dependency + # information in _Boost_COMPONENT_DEPENDENCIES. See the + # instructions at the top of _Boost_COMPONENT_DEPENDENCIES. set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS} - + "1.61.0" "1.61" "1.60.0" "1.60" "1.59.0" "1.59" "1.58.0" "1.58" "1.57.0" "1.57" "1.56.0" "1.56" "1.55.0" "1.55" "1.54.0" "1.54" "1.53.0" "1.53" "1.52.0" "1.52" "1.51.0" "1.51" "1.50.0" "1.50" "1.49.0" "1.49" "1.48.0" "1.48" "1.47.0" "1.47" "1.46.1" @@ -562,6 +871,16 @@ if(Boost_DEBUG) "Boost_NO_SYSTEM_PATHS = ${Boost_NO_SYSTEM_PATHS}") endif() +# Supply Boost_LIB_DIAGNOSTIC_DEFINITIONS as a convenience target. It +# will only contain any interface definitions on WIN32, but is created +# on all platforms to keep end user code free from platform dependent +# code. Also provide convenience targets to disable autolinking and +# enable dynamic linking. +if(NOT TARGET Boost::diagnostic_definitions) + add_library(Boost::diagnostic_definitions INTERFACE IMPORTED) + add_library(Boost::disable_autolinking INTERFACE IMPORTED) + add_library(Boost::dynamic_linking INTERFACE IMPORTED) +endif() if(WIN32) # In windows, automatic linking is performed, so you do not have # to specify the libraries. If you are linking to a dynamic @@ -581,6 +900,12 @@ if(WIN32) # code to emit a #pragma message each time a library is selected # for linking. set(Boost_LIB_DIAGNOSTIC_DEFINITIONS "-DBOOST_LIB_DIAGNOSTIC") + set_target_properties(Boost::diagnostic_definitions PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "BOOST_LIB_DIAGNOSTIC") + set_target_properties(Boost::disable_autolinking PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "BOOST_ALL_NO_LIB") + set_target_properties(Boost::dynamic_linking PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "BOOST_ALL_DYN_LINK") endif() _Boost_CHECK_SPELLING(Boost_ROOT) @@ -979,6 +1304,17 @@ if(Boost_VERSION AND Boost_FIND_COMPONENTS) endif() endif() +# Additional components may be required via component dependencies. +# Add any missing components to the list. +_Boost_MISSING_DEPENDENCIES(Boost_FIND_COMPONENTS) + +# If thread is required, get the thread libs as a dependency +list(FIND Boost_FIND_COMPONENTS thread _Boost_THREAD_DEPENDENCY_LIBS) +if(NOT _Boost_THREAD_DEPENDENCY_LIBS EQUAL -1) + include(CMakeFindDependencyMacro) + find_dependency(Threads) +endif() + # If the user changed any of our control inputs flush previous results. if(_Boost_CHANGE_LIBDIR OR _Boost_CHANGE_LIBNAME) foreach(COMPONENT ${_Boost_COMPONENTS_SEARCHED}) @@ -1221,6 +1557,70 @@ else() endforeach() endif() +# ------------------------------------------------------------------------ +# Add imported targets +# ------------------------------------------------------------------------ + +if(Boost_FOUND AND _Boost_IMPORTED_TARGETS) + # For header-only libraries + if(NOT TARGET Boost::boost) + add_library(Boost::boost INTERFACE IMPORTED) + if(Boost_INCLUDE_DIRS) + set_target_properties(Boost::boost PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}") + endif() + endif() + + foreach(COMPONENT ${Boost_FIND_COMPONENTS}) + if(NOT TARGET Boost::${COMPONENT}) + string(TOUPPER ${COMPONENT} UPPERCOMPONENT) + if(Boost_${UPPERCOMPONENT}_FOUND) + if(Boost_USE_STATIC_LIBS) + add_library(Boost::${COMPONENT} STATIC IMPORTED) + else() + # Even if Boost_USE_STATIC_LIBS is OFF, we might have static + # libraries as a result. + add_library(Boost::${COMPONENT} UNKNOWN IMPORTED) + endif() + if(Boost_INCLUDE_DIRS) + set_target_properties(Boost::${COMPONENT} PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}") + endif() + if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY}") + set_target_properties(Boost::${COMPONENT} PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION "${Boost_${UPPERCOMPONENT}_LIBRARY}") + endif() + if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG}") + set_property(TARGET Boost::${COMPONENT} APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(Boost::${COMPONENT} PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX" + IMPORTED_LOCATION_DEBUG "${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG}") + endif() + if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE}") + set_property(TARGET Boost::${COMPONENT} APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(Boost::${COMPONENT} PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX" + IMPORTED_LOCATION_RELEASE "${Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE}") + endif() + if(_Boost_${UPPERCOMPONENT}_DEPENDENCIES) + unset(_Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES) + foreach(dep ${_Boost_${UPPERCOMPONENT}_DEPENDENCIES}) + list(APPEND _Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES Boost::${dep}) + endforeach() + if(COMPONENT STREQUAL "thread") + list(APPEND _Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES Threads::Threads) + endif() + set_target_properties(Boost::${COMPONENT} PROPERTIES + INTERFACE_LINK_LIBRARIES "${_Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES}") + endif() + endif() + endif() + endforeach() +endif() + # ------------------------------------------------------------------------ # Notification to end user about what was found # ------------------------------------------------------------------------ diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index ada5b8a72..47c03f32a 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -1456,6 +1456,11 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) set(cuda_build_comment_string "Building NVCC (${cuda_build_type}) object ${generated_file_relative_path}") endif() + set(_verbatim VERBATIM) + if(ccbin_flags MATCHES "\\$\\(VCInstallDir\\)") + set(_verbatim "") + endif() + # Build the generated file and dependency file ########################## add_custom_command( OUTPUT ${generated_file} @@ -1474,6 +1479,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) -P "${custom_target_script}" WORKING_DIRECTORY "${cuda_compile_intermediate_directory}" COMMENT "${cuda_build_comment_string}" + ${_verbatim} ) # Make sure the build system knows the file is generated. @@ -1585,6 +1591,11 @@ function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options set(do_obj_build_rule FALSE) endif() + set(_verbatim VERBATIM) + if(nvcc_flags MATCHES "\\$\\(VCInstallDir\\)") + set(_verbatim "") + endif() + if (do_obj_build_rule) add_custom_command( OUTPUT ${output_file} @@ -1592,6 +1603,7 @@ function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options COMMAND ${CUDA_NVCC_EXECUTABLE} ${nvcc_flags} -dlink ${object_files} -o ${output_file} ${flags} COMMENT "Building NVCC intermediate link file ${output_file_relative_path}" + ${_verbatim} ) else() get_filename_component(output_file_dir "${output_file}" DIRECTORY) @@ -1601,6 +1613,7 @@ function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options COMMAND ${CMAKE_COMMAND} -E echo "Building NVCC intermediate link file ${output_file_relative_path}" COMMAND ${CMAKE_COMMAND} -E make_directory "${output_file_dir}" COMMAND ${CUDA_NVCC_EXECUTABLE} ${nvcc_flags} ${flags} -dlink ${object_files} -o "${output_file}" + ${_verbatim} ) endif() endif() diff --git a/Modules/FindDCMTK.cmake b/Modules/FindDCMTK.cmake index 91aafbbd0..63d253d90 100644 --- a/Modules/FindDCMTK.cmake +++ b/Modules/FindDCMTK.cmake @@ -2,17 +2,78 @@ # FindDCMTK # --------- # -# find DCMTK libraries and applications - -# DCMTK_INCLUDE_DIRS - Directories to include to use DCMTK +# Find DCMTK libraries and applications +# +# The module defines the following variables:: +# +# DCMTK_INCLUDE_DIRS - Directories to include to use DCMTK # DCMTK_LIBRARIES - Files to link against to use DCMTK # DCMTK_FOUND - If false, don't try to use DCMTK # DCMTK_DIR - (optional) Source directory for DCMTK # -# DCMTK_DIR can be used to make it simpler to find the various include -# directories and compiled libraries if you've just compiled it in the -# source tree. Just set it to the root of the tree where you extracted -# the source (default to /usr/include/dcmtk/) +# Compatibility +# ^^^^^^^^^^^^^ +# +# This module is able to find a version of DCMTK that does or does not export +# a *DCMTKConfig.cmake* file. It applies a two step process: +# +# * Step 1: Attempt to find DCMTK version providing a *DCMTKConfig.cmake* file. +# * Step 2: If step 1 failed, rely on *FindDCMTK.cmake* to set `DCMTK_*` variables details below. +# +# +# `Recent DCMTK +# `_ +# provides a *DCMTKConfig.cmake* :manual:`package configuration file +# `. To exclusively use the package configuration file +# (recommended when possible), pass the `NO_MODULE` option to +# :command:`find_package`. For example, `find_package(DCMTK NO_MODULE)`. +# This requires official DCMTK snapshot *3.6.1_20140617* or newer. +# +# +# Until all clients update to the more recent DCMTK, build systems will need +# to support different versions of DCMTK. +# +# On any given system, the following combinations of DCMTK versions could be +# considered: +# +# +--------+---------------------+-----------------------+-------------------+ +# | | SYSTEM DCMTK | LOCAL DCMTK | Supported ? | +# +--------+---------------------+-----------------------+-------------------+ +# | Case A | NA | [ ] DCMTKConfig | YES | +# +--------+---------------------+-----------------------+-------------------+ +# | Case B | NA | [X] DCMTKConfig | YES | +# +--------+---------------------+-----------------------+-------------------+ +# | Case C | [ ] DCMTKConfig | NA | YES | +# +--------+---------------------+-----------------------+-------------------+ +# | Case D | [X] DCMTKConfig | NA | YES | +# +--------+---------------------+-----------------------+-------------------+ +# | Case E | [ ] DCMTKConfig | [ ] DCMTKConfig | YES (*) | +# +--------+---------------------+-----------------------+-------------------+ +# | Case F | [X] DCMTKConfig | [ ] DCMTKConfig | NO | +# +--------+---------------------+-----------------------+-------------------+ +# | Case G | [ ] DCMTKConfig | [X] DCMTKConfig | YES | +# +--------+---------------------+-----------------------+-------------------+ +# | Case H | [X] DCMTKConfig | [X] DCMTKConfig | YES | +# +--------+---------------------+-----------------------+-------------------+ +# +# (*) See Troubleshooting section. +# +# Legend: +# +# NA ...............: Means that no System or Local DCMTK is available +# +# [ ] DCMTKConfig ..: Means that the version of DCMTK does NOT export a DCMTKConfig.cmake file. +# +# [X] DCMTKConfig ..: Means that the version of DCMTK exports a DCMTKConfig.cmake file. +# +# +# Troubleshooting +# ^^^^^^^^^^^^^^^ +# +# What to do if my project finds a different version of DCMTK? +# +# Remove DCMTK entry from the CMake cache per :command:`find_package` +# documentation. #============================================================================= # Copyright 2004-2009 Kitware, Inc. @@ -35,50 +96,142 @@ # Modified for EasyViz by Thomas Sondergaard. # -if(NOT DCMTK_FOUND AND NOT DCMTK_DIR) - set(DCMTK_DIR - "/usr/include/dcmtk/" - CACHE - PATH - "Root of DCMTK source tree (optional).") - mark_as_advanced(DCMTK_DIR) +set(_dcmtk_dir_description "The directory of DCMTK build or install tree.") + +# Ensure that DCMTK_DIR is set to a reasonable default value +# so that DCMTK libraries can be found on a standard Unix distribution. +# It also overwrite the value of DCMTK_DIR after this one has been +# set by a successful discovery of DCMTK by the unpatched FindDCMTK.cmake module +# distributed with CMake (as of 0167cea) +if(NOT DCMTK_DIR OR DCMTK_DIR STREQUAL "/usr/include/dcmtk") + set(DCMTK_DIR "/usr" CACHE PATH ${_dcmtk_dir_description} FORCE) endif() +set(_SAVED_DCMTK_DIR ${DCMTK_DIR}) +# +# Step1: Attempt to find a version of DCMTK providing a DCMTKConfig.cmake file. +# +if(NOT DCMTK_FIND_QUIETLY) + message(STATUS "Trying to find DCMTK expecting DCMTKConfig.cmake") +endif() +find_package(DCMTK QUIET NO_MODULE) +if(DCMTK_FOUND + AND NOT "x" STREQUAL "x${DCMTK_LIBRARIES}" + AND NOT "x" STREQUAL "x${DCMTK_INCLUDE_DIRS}") + + if(NOT DCMTK_FIND_QUIETLY) + message(STATUS "Trying to find DCMTK expecting DCMTKConfig.cmake - ok") + endif() + return() +else() + if(NOT DCMTK_FIND_QUIETLY) + message(STATUS "Trying to find DCMTK expecting DCMTKConfig.cmake - failed") + endif() +endif() + +if(NOT DCMTK_FIND_QUIETLY) + message(STATUS "Trying to find DCMTK relying on FindDCMTK.cmake") +endif() + +# Restore the value reset by the previous call to 'find_package(DCMTK QUIET NO_MODULE)' +set(DCMTK_DIR ${_SAVED_DCMTK_DIR} CACHE PATH ${_dcmtk_dir_description} FORCE) + + +# +# Step2: Attempt to find a version of DCMTK that does NOT provide a DCMTKConfig.cmake file. +# + +# prefer DCMTK_DIR over default system paths like /usr/lib +if(DCMTK_DIR) + set(CMAKE_PREFIX_PATH ${DCMTK_DIR}/lib ${CMAKE_PREFIX_PATH}) # this is given to FIND_LIBRARY or FIND_PATH +endif() + +# Find all libraries, store debug and release separately foreach(lib - dcmdata + dcmpstat + dcmsr + dcmsign + dcmtls + dcmqrdb + dcmnet + dcmjpeg dcmimage dcmimgle - dcmjpeg - dcmnet - dcmpstat - dcmqrdb - dcmsign - dcmsr - dcmtls + dcmdata + oflog + ofstd ijg12 ijg16 ijg8 - ofstd) + ) - find_library(DCMTK_${lib}_LIBRARY + # Find Release libraries + find_library(DCMTK_${lib}_LIBRARY_RELEASE ${lib} PATHS ${DCMTK_DIR}/${lib}/libsrc ${DCMTK_DIR}/${lib}/libsrc/Release - ${DCMTK_DIR}/${lib}/libsrc/Debug ${DCMTK_DIR}/${lib}/Release + ${DCMTK_DIR}/lib + ${DCMTK_DIR}/lib/Release + ${DCMTK_DIR}/dcmjpeg/lib${lib}/Release + NO_DEFAULT_PATH + ) + + # Find Debug libraries + find_library(DCMTK_${lib}_LIBRARY_DEBUG + ${lib}${DCMTK_CMAKE_DEBUG_POSTFIX} + PATHS + ${DCMTK_DIR}/${lib}/libsrc + ${DCMTK_DIR}/${lib}/libsrc/Debug ${DCMTK_DIR}/${lib}/Debug - ${DCMTK_DIR}/lib) + ${DCMTK_DIR}/lib + ${DCMTK_DIR}/lib/Debug + ${DCMTK_DIR}/dcmjpeg/lib${lib}/Debug + NO_DEFAULT_PATH + ) - mark_as_advanced(DCMTK_${lib}_LIBRARY) + mark_as_advanced(DCMTK_${lib}_LIBRARY_RELEASE) + mark_as_advanced(DCMTK_${lib}_LIBRARY_DEBUG) - if(DCMTK_${lib}_LIBRARY) - list(APPEND DCMTK_LIBRARIES ${DCMTK_${lib}_LIBRARY}) + # Add libraries to variable according to build type + if(DCMTK_${lib}_LIBRARY_RELEASE) + list(APPEND DCMTK_LIBRARIES optimized ${DCMTK_${lib}_LIBRARY_RELEASE}) + endif() + + if(DCMTK_${lib}_LIBRARY_DEBUG) + list(APPEND DCMTK_LIBRARIES debug ${DCMTK_${lib}_LIBRARY_DEBUG}) endif() endforeach() +set(CMAKE_THREAD_LIBS_INIT) +if(DCMTK_oflog_LIBRARY_RELEASE OR DCMTK_oflog_LIBRARY_DEBUG) + # Hack - Not having a DCMTKConfig.cmake file to read the settings from, we will attempt to + # find the library in all cases. + # Ideally, pthread library should be discovered only if DCMTK_WITH_THREADS is enabled. + set(CMAKE_THREAD_PREFER_PTHREAD TRUE) + find_package(Threads) +endif() + +if(CMAKE_THREAD_LIBS_INIT) + list(APPEND DCMTK_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) +endif() + +# +# SPECIFIC CASE FOR DCMTK BUILD DIR as DCMTK_DIR +# (as opposed to a DCMTK install dir) +# Have to find the source directory. +if(EXISTS ${DCMTK_DIR}/CMakeCache.txt) + load_cache(${DCMTK_DIR} READ_WITH_PREFIX "EXT" + DCMTK_SOURCE_DIR) + if(NOT EXISTS ${EXTDCMTK_SOURCE_DIR}) + message(FATAL_ERROR + "DCMTK build directory references +nonexistant DCMTK source directory ${EXTDCMTK_SOURCE_DIR}") + endif() +endif() set(DCMTK_config_TEST_HEADER osconfig.h) set(DCMTK_dcmdata_TEST_HEADER dctypes.h) @@ -92,6 +245,10 @@ set(DCMTK_dcmsign_TEST_HEADER sicert.h) set(DCMTK_dcmsr_TEST_HEADER dsrtree.h) set(DCMTK_dcmtls_TEST_HEADER tlslayer.h) set(DCMTK_ofstd_TEST_HEADER ofstdinc.h) +set(DCMTK_oflog_TEST_HEADER oflog.h) +set(DCMTK_dcmjpls_TEST_HEADER djlsutil.h) + +set(DCMTK_INCLUDE_DIR_NAMES) foreach(dir config @@ -99,31 +256,47 @@ foreach(dir dcmimage dcmimgle dcmjpeg + dcmjpls dcmnet dcmpstat dcmqrdb dcmsign dcmsr dcmtls - ofstd) + ofstd + oflog) + if(EXTDCMTK_SOURCE_DIR) + set(SOURCE_DIR_PATH + ${EXTDCMTK_SOURCE_DIR}/${dir}/include/dcmtk/${dir}) + endif() find_path(DCMTK_${dir}_INCLUDE_DIR ${DCMTK_${dir}_TEST_HEADER} PATHS ${DCMTK_DIR}/${dir}/include ${DCMTK_DIR}/${dir} - ${DCMTK_DIR}/include/${dir} ${DCMTK_DIR}/include/dcmtk/${dir} ${DCMTK_DIR}/${dir}/include/dcmtk/${dir} + ${DCMTK_DIR}/include/${dir} + ${SOURCE_DIR_PATH} ) mark_as_advanced(DCMTK_${dir}_INCLUDE_DIR) + list(APPEND DCMTK_INCLUDE_DIR_NAMES DCMTK_${dir}_INCLUDE_DIR) if(DCMTK_${dir}_INCLUDE_DIR) + # add the 'include' path so eg + #include "dcmtk/dcmimgle/dcmimage.h" + # works + get_filename_component(_include ${DCMTK_${dir}_INCLUDE_DIR} PATH) + get_filename_component(_include ${_include} PATH) list(APPEND DCMTK_INCLUDE_DIRS - ${DCMTK_${dir}_INCLUDE_DIR}) + ${DCMTK_${dir}_INCLUDE_DIR} + ${_include}) endif() endforeach() +list(APPEND DCMTK_INCLUDE_DIRS ${DCMTK_DIR}/include) + if(WIN32) list(APPEND DCMTK_LIBRARIES netapi32 wsock32) endif() @@ -137,21 +310,31 @@ if(DCMTK_ofstd_INCLUDE_DIR) mark_as_advanced(DCMTK_dcmtk_INCLUDE_DIR) endif() -include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -find_package_handle_standard_args(DCMTK DEFAULT_MSG - DCMTK_config_INCLUDE_DIR - DCMTK_ofstd_INCLUDE_DIR - DCMTK_ofstd_LIBRARY - DCMTK_dcmdata_INCLUDE_DIR - DCMTK_dcmdata_LIBRARY - DCMTK_dcmimgle_INCLUDE_DIR - DCMTK_dcmimgle_LIBRARY) - # Compatibility: This variable is deprecated set(DCMTK_INCLUDE_DIR ${DCMTK_INCLUDE_DIRS}) -foreach(executable dcmdump dcmdjpeg dcmdrle) - string(TOUPPER ${executable} EXECUTABLE) - find_program(DCMTK_${EXECUTABLE}_EXECUTABLE ${executable} ${DCMTK_DIR}/bin) - mark_as_advanced(DCMTK_${EXECUTABLE}_EXECUTABLE) -endforeach() +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(DCMTK + REQUIRED_VARS ${DCMTK_INCLUDE_DIR_NAMES} DCMTK_LIBRARIES + FAIL_MESSAGE "Please set DCMTK_DIR and re-run configure") + +# Workaround bug in packaging of DCMTK 3.6.0 on Debian. +# See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=637687 +if(DCMTK_FOUND AND UNIX AND NOT APPLE) + include(CheckCXXSourceCompiles) + set(CMAKE_REQUIRED_FLAGS ) + set(CMAKE_REQUIRED_DEFINITIONS ) + set(CMAKE_REQUIRED_INCLUDES ${DCMTK_INCLUDE_DIRS}) + set(CMAKE_REQUIRED_LIBRARIES ${DCMTK_LIBRARIES}) + set(CMAKE_REQUIRED_QUIET ${DCMTK_FIND_QUIETLY}) + check_cxx_source_compiles("#include \n#include \nint main(int,char*[]){return 0;}" + DCMTK_HAVE_CONFIG_H_OPTIONAL + ) + if(NOT DCMTK_HAVE_CONFIG_H_OPTIONAL) + set(DCMTK_DEFINITIONS "HAVE_CONFIG_H") + endif() +endif() + +if(NOT DCMTK_FIND_QUIETLY) + message(STATUS "Trying to find DCMTK relying on FindDCMTK.cmake - ok") +endif() diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake index eb7abfd73..ca49e4aca 100644 --- a/Modules/FindGTest.cmake +++ b/Modules/FindGTest.cmake @@ -4,88 +4,89 @@ # # Locate the Google C++ Testing Framework. # -# Defines the following variables: +# Imported targets +# ^^^^^^^^^^^^^^^^ # -# :: +# This module defines the following :prop_tgt:`IMPORTED` targets: # -# GTEST_FOUND - Found the Google Testing framework -# GTEST_INCLUDE_DIRS - Include directories +# ``GTest::GTest`` +# The Google Test ``gtest`` library, if found; adds Thread::Thread +# automatically +# ``GTest::Main`` +# The Google Test ``gtest_main`` library, if found # # +# Result variables +# ^^^^^^^^^^^^^^^^ # -# Also defines the library variables below as normal variables. These +# This module will set the following variables in your project: +# +# ``GTEST_FOUND`` +# Found the Google Testing framework +# ``GTEST_INCLUDE_DIRS`` +# the directory containing the Google Test headers +# +# The library variables below are set as normal variables. These # contain debug/optimized keywords when a debugging library is found. # -# :: +# ``GTEST_LIBRARIES`` +# The Google Test ``gtest`` library; note it also requires linking +# with an appropriate thread library +# ``GTEST_MAIN_LIBRARIES`` +# The Google Test ``gtest_main`` library +# ``GTEST_BOTH_LIBRARIES`` +# Both ``gtest`` and ``gtest_main`` # -# GTEST_BOTH_LIBRARIES - Both libgtest & libgtest-main -# GTEST_LIBRARIES - libgtest -# GTEST_MAIN_LIBRARIES - libgtest-main +# Cache variables +# ^^^^^^^^^^^^^^^ +# +# The following cache variables may also be set: +# +# ``GTEST_ROOT`` +# The root directory of the Google Test installation (may also be +# set as an environment variable) +# ``GTEST_MSVC_SEARCH`` +# If compiling with MSVC, this variable can be set to ``MD`` or +# ``MT`` (the default) to enable searching a GTest build tree # # -# -# Accepts the following variables as input: -# -# :: -# -# GTEST_ROOT - (as a CMake or environment variable) -# The root directory of the gtest install prefix -# -# -# -# :: -# -# GTEST_MSVC_SEARCH - If compiling with MSVC, this variable can be set to -# "MD" or "MT" to enable searching a GTest build tree -# (defaults: "MD") -# -# -# -# Example Usage: +# Example usage +# ^^^^^^^^^^^^^ # # :: # # enable_testing() # find_package(GTest REQUIRED) -# include_directories(${GTEST_INCLUDE_DIRS}) -# -# -# -# :: # # add_executable(foo foo.cc) -# target_link_libraries(foo ${GTEST_BOTH_LIBRARIES}) -# -# -# -# :: +# target_link_libraries(foo GTest::GTest GTest::Main) # # add_test(AllTestsInFoo foo) # # -# -# +# Deeper integration with CTest +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # # If you would like each Google test to show up in CTest as a test you -# may use the following macro. NOTE: It will slow down your tests by -# running an executable for each test and test fixture. You will also -# have to rerun CMake after adding or removing tests or test fixtures. +# may use the following macro:: # -# GTEST_ADD_TESTS(executable extra_args ARGN) +# GTEST_ADD_TESTS(executable extra_args files...) # -# :: +# ``executable`` +# the path to the test executable +# ``extra_args`` +# a list of extra arguments to be passed to executable enclosed in +# quotes (or ``""`` for none) +# ``files...`` +# a list of source files to search for tests and test fixtures. Or +# ``AUTO`` to find them from executable target # -# executable = The path to the test executable -# extra_args = Pass a list of extra arguments to be passed to -# executable enclosed in quotes (or "" for none) -# ARGN = A list of source files to search for tests & test -# fixtures. Or AUTO to find them from executable target. +# However, note that this macro will slow down your tests by running +# an executable for each test and test fixture. You will also have to +# re-run CMake after adding or removing tests or test fixtures. # +# Example usage:: # -# -# :: -# -# Example: # set(FooTestArgs --foo 1 --bar 2) # add_executable(FooTest FooUnitTest.cc) # GTEST_ADD_TESTS(FooTest "${FooTestArgs}" AUTO) @@ -208,5 +209,60 @@ if(GTEST_FOUND) _gtest_append_debugs(GTEST_LIBRARIES GTEST_LIBRARY) _gtest_append_debugs(GTEST_MAIN_LIBRARIES GTEST_MAIN_LIBRARY) set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES}) -endif() + include(CMakeFindDependencyMacro) + find_dependency(Threads) + + if(NOT TARGET GTest::GTest) + add_library(GTest::GTest UNKNOWN IMPORTED) + set_target_properties(GTest::GTest PROPERTIES + INTERFACE_LINK_LIBRARIES "Threads::Threads") + if(GTEST_INCLUDE_DIRS) + set_target_properties(GTest::GTest PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${GTEST_INCLUDE_DIRS}") + endif() + if(EXISTS "${GTEST_LIBRARY}") + set_target_properties(GTest::GTest PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION "${GTEST_LIBRARY}") + endif() + if(EXISTS "${GTEST_LIBRARY_DEBUG}") + set_property(TARGET GTest::GTest APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(GTest::GTest PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX" + IMPORTED_LOCATION_DEBUG "${GTEST_LIBRARY_DEBUG}") + endif() + if(EXISTS "${GTEST_LIBRARY_RELEASE}") + set_property(TARGET GTest::GTest APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(GTest::GTest PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX" + IMPORTED_LOCATION_RELEASE "${GTEST_LIBRARY_RELEASE}") + endif() + endif() + if(NOT TARGET GTest::Main) + add_library(GTest::Main UNKNOWN IMPORTED) + set_target_properties(GTest::Main PROPERTIES + INTERFACE_LINK_LIBRARIES "GTest::GTest") + if(EXISTS "${GTEST_MAIN_LIBRARY}") + set_target_properties(GTest::Main PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION "${GTEST_MAIN_LIBRARY}") + endif() + if(EXISTS "${GTEST_MAIN_LIBRARY_DEBUG}") + set_property(TARGET GTest::Main APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(GTest::Main PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX" + IMPORTED_LOCATION_DEBUG "${GTEST_MAIN_LIBRARY_DEBUG}") + endif() + if(EXISTS "${GTEST_MAIN_LIBRARY_RELEASE}") + set_property(TARGET GTest::Main APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(GTest::Main PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX" + IMPORTED_LOCATION_RELEASE "${GTEST_MAIN_LIBRARY_RELEASE}") + endif() + endif() +endif() diff --git a/Modules/FindGit.cmake b/Modules/FindGit.cmake index 2c3e5fd76..d18f965ee 100644 --- a/Modules/FindGit.cmake +++ b/Modules/FindGit.cmake @@ -2,27 +2,26 @@ # FindGit # ------- # -# -# # The module defines the following variables: # -# :: -# -# GIT_EXECUTABLE - path to git command line client -# GIT_FOUND - true if the command line client was found -# GIT_VERSION_STRING - the version of git found (since CMake 2.8.8) +# ``GIT_EXECUTABLE`` +# Path to Git command-line client. +# ``Git_FOUND``, ``GIT_FOUND`` +# True if the Git command-line client was found. +# ``GIT_VERSION_STRING`` +# The version of Git found. # # Example usage: # -# :: +# .. code-block:: cmake # # find_package(Git) -# if(GIT_FOUND) -# message("git found: ${GIT_EXECUTABLE}") +# if(Git_FOUND) +# message("Git found: ${GIT_EXECUTABLE}") # endif() #============================================================================= -# Copyright 2010 Kitware, Inc. +# Copyright 2010-2016 Kitware, Inc. # Copyright 2012 Rolf Eike Beer # # Distributed under the OSI-approved BSD License (the "License"); @@ -57,10 +56,11 @@ find_program(GIT_EXECUTABLE NAMES ${git_names} PATHS ${github_path} ${_git_sourcetree_path} PATH_SUFFIXES Git/cmd Git/bin - DOC "git command line client" + DOC "Git command line client" ) mark_as_advanced(GIT_EXECUTABLE) +unset(git_names) unset(_git_sourcetree_path) if(GIT_EXECUTABLE) @@ -74,7 +74,7 @@ if(GIT_EXECUTABLE) unset(git_version) endif() -# Handle the QUIETLY and REQUIRED arguments and set GIT_FOUND to TRUE if +# Handle the QUIETLY and REQUIRED arguments and set Git_FOUND to TRUE if # all listed variables are TRUE include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake index cbe21d7e1..135038c5b 100644 --- a/Modules/FindJNI.cmake +++ b/Modules/FindJNI.cmake @@ -63,7 +63,7 @@ macro(java_append_library_directories _var) elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64") set(_java_libarch "ppc64" "ppc") elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)") - set(_java_libarch "ppc") + set(_java_libarch "ppc" "ppc64") elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^sparc") # Both flavours can run on the same processor set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "sparc" "sparcv9") @@ -271,7 +271,8 @@ find_path(JAVA_INCLUDE_PATH jni.h ${JAVA_AWT_INCLUDE_DIRECTORIES} ) -find_path(JAVA_INCLUDE_PATH2 jni_md.h +find_path(JAVA_INCLUDE_PATH2 NAMES jni_md.h jniport.h + PATHS ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH}/darwin ${JAVA_INCLUDE_PATH}/win32 @@ -281,6 +282,7 @@ find_path(JAVA_INCLUDE_PATH2 jni_md.h ${JAVA_INCLUDE_PATH}/solaris ${JAVA_INCLUDE_PATH}/hp-ux ${JAVA_INCLUDE_PATH}/alpha + ${JAVA_INCLUDE_PATH}/aix ) find_path(JAVA_AWT_INCLUDE_PATH jawt.h diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake index 9f8799783..cc67df662 100644 --- a/Modules/FindJava.cmake +++ b/Modules/FindJava.cmake @@ -228,12 +228,12 @@ if(Java_FIND_COMPONENTS) endif() elseif(component STREQUAL "IdlJ") list(APPEND _JAVA_REQUIRED_VARS Java_IDLJ_EXECUTABLE) - if(Java_IdlJ_EXECUTABLE) - set(Java_Extra_FOUND TRUE) + if(Java_IDLJ_EXECUTABLE) + set(Java_IdlJ_FOUND TRUE) endif() elseif(component STREQUAL "JarSigner") list(APPEND _JAVA_REQUIRED_VARS Java_JARSIGNER_EXECUTABLE) - if(Java_IDLJ_EXECUTABLE) + if(Java_JARSIGNER_EXECUTABLE) set(Java_JarSigner_FOUND TRUE) endif() else() diff --git a/Modules/FindOpenAL.cmake b/Modules/FindOpenAL.cmake index 8150ff291..eb63cef5a 100644 --- a/Modules/FindOpenAL.cmake +++ b/Modules/FindOpenAL.cmake @@ -79,11 +79,17 @@ find_path(OPENAL_INCLUDE_DIR al.h [HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir] ) +if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(_OpenAL_ARCH_DIR libs/Win64) +else() + set(_OpenAL_ARCH_DIR libs/Win32) +endif() + find_library(OPENAL_LIBRARY NAMES OpenAL al openal OpenAL32 HINTS ENV OPENALDIR - PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64 + PATH_SUFFIXES lib64 lib libs64 libs ${_OpenAL_ARCH_DIR} PATHS ~/Library/Frameworks /Library/Frameworks @@ -94,6 +100,7 @@ find_library(OPENAL_LIBRARY [HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir] ) +unset(_OpenAL_ARCH_DIR) # handle the QUIETLY and REQUIRED arguments and set OPENAL_FOUND to TRUE if # all listed variables are TRUE diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake index a7eefa7aa..93e488bf9 100644 --- a/Modules/FindOpenGL.cmake +++ b/Modules/FindOpenGL.cmake @@ -71,9 +71,11 @@ elseif (WIN32) elseif (APPLE) - find_library(OPENGL_gl_LIBRARY OpenGL DOC "OpenGL lib for OSX") - find_library(OPENGL_glu_LIBRARY AGL DOC "AGL lib for OSX") - find_path(OPENGL_INCLUDE_DIR OpenGL/gl.h DOC "Include for OpenGL on OSX") + # The OpenGL.framework provides both gl and glu + find_library(OPENGL_gl_LIBRARY OpenGL DOC "OpenGL library for OS X") + find_library(OPENGL_glu_LIBRARY OpenGL DOC + "GLU library for OS X (usually same as OpenGL library)") + find_path(OPENGL_INCLUDE_DIR OpenGL/gl.h DOC "Include for OpenGL on OS X") list(APPEND _OpenGL_REQUIRED_VARS OPENGL_INCLUDE_DIR) else() @@ -149,7 +151,9 @@ if(OPENGL_gl_LIBRARY) set( OPENGL_LIBRARIES ${OPENGL_gl_LIBRARY} ${OPENGL_LIBRARIES}) if(OPENGL_glu_LIBRARY) set( OPENGL_GLU_FOUND "YES" ) - set( OPENGL_LIBRARIES ${OPENGL_glu_LIBRARY} ${OPENGL_LIBRARIES} ) + if(NOT "${OPENGL_glu_LIBRARY}" STREQUAL "${OPENGL_gl_LIBRARY}") + set( OPENGL_LIBRARIES ${OPENGL_glu_LIBRARY} ${OPENGL_LIBRARIES} ) + endif() else() set( OPENGL_GLU_FOUND "NO" ) endif() diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index a102c66e3..ee4bdd6c8 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -50,6 +50,8 @@ function(_OPENMP_FLAG_CANDIDATES LANG) " " #GNU "-fopenmp" + #Clang + "-fopenmp=libomp" #Microsoft Visual Studio "/openmp" #Intel windows @@ -67,6 +69,7 @@ function(_OPENMP_FLAG_CANDIDATES LANG) ) set(OMP_FLAG_GNU "-fopenmp") + set(OMP_FLAG_Clang "-fopenmp=libomp") set(OMP_FLAG_HP "+Oopenmp") if(WIN32) set(OMP_FLAG_Intel "-Qopenmp") diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake index 7cf3f2293..cae41acd9 100644 --- a/Modules/FindPNG.cmake +++ b/Modules/FindPNG.cmake @@ -2,13 +2,20 @@ # FindPNG # ------- # -# Find the native PNG includes and library +# Find libpng, the official reference library for the PNG image format. # +# Imported targets +# ^^^^^^^^^^^^^^^^ # +# This module defines the following :prop_tgt:`IMPORTED` target: # -# This module searches libpng, the library for working with PNG images. +# ``PNG::PNG`` +# The libpng library, if found. # -# It defines the following variables +# Result variables +# ^^^^^^^^^^^^^^^^ +# +# This module will set the following variables in your project: # # ``PNG_INCLUDE_DIRS`` # where to find png.h, etc. @@ -22,19 +29,22 @@ # ``PNG_VERSION_STRING`` # the version of the PNG library found (since CMake 2.8.8) # -# Also defined, but not for general use are +# Obsolete variables +# ^^^^^^^^^^^^^^^^^^ +# +# The following variables may also be set, for backwards compatibility: # # ``PNG_LIBRARY`` # where to find the PNG library. -# -# For backward compatiblity the variable PNG_INCLUDE_DIR is also set. -# It has the same value as PNG_INCLUDE_DIRS. +# ``PNG_INCLUDE_DIR`` +# where to find the PNG headers (same as PNG_INCLUDE_DIRS) # # Since PNG depends on the ZLib compression library, none of the above # will be defined unless ZLib can be found. #============================================================================= # Copyright 2002-2009 Kitware, Inc. +# Copyright 2016 Raumfeld # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -105,6 +115,32 @@ if(ZLIB_FOUND) endif() endif () + if(NOT TARGET PNG::PNG) + add_library(PNG::PNG UNKNOWN IMPORTED) + set_target_properties(PNG::PNG PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "${PNG_DEFINITIONS}" + INTERFACE_INCLUDE_DIRECTORIES "${PNG_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES ZLIB::ZLIB) + if(EXISTS "${PNG_LIBRARY}") + set_target_properties(PNG::PNG PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${PNG_LIBRARY}") + endif() + if(EXISTS "${PNG_LIBRARY_DEBUG}") + set_property(TARGET PNG::PNG APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(PNG::PNG PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C" + IMPORTED_LOCATION_DEBUG "${PNG_LIBRARY_DEBUG}") + endif() + if(EXISTS "${PNG_LIBRARY_RELEASE}") + set_property(TARGET PNG::PNG APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(PNG::PNG PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C" + IMPORTED_LOCATION_RELEASE "${PNG_LIBRARY_RELEASE}") + endif() + endif() endif () if (PNG_PNG_INCLUDE_DIR AND EXISTS "${PNG_PNG_INCLUDE_DIR}/png.h") diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index d519c1df3..4f50e3819 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -238,8 +238,8 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma if(NOT "${_extra_paths}" STREQUAL "") # Save the PKG_CONFIG_PATH environment variable, and add paths # from the CMAKE_PREFIX_PATH variables - set(_pkgconfig_path_old $ENV{PKG_CONFIG_PATH}) - set(_pkgconfig_path ${_pkgconfig_path_old}) + set(_pkgconfig_path_old "$ENV{PKG_CONFIG_PATH}") + set(_pkgconfig_path "${_pkgconfig_path_old}") if(NOT "${_pkgconfig_path}" STREQUAL "") file(TO_CMAKE_PATH "${_pkgconfig_path}" _pkgconfig_path) endif() @@ -263,6 +263,7 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma endif() endif() list(APPEND _lib_dirs "lib/pkgconfig") + list(APPEND _lib_dirs "share/pkgconfig") # Check if directories exist and eventually append them to the # pkgconfig path list @@ -284,7 +285,7 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma string(REPLACE ";" ":" _pkgconfig_path "${_pkgconfig_path}") string(REPLACE "\\ " " " _pkgconfig_path "${_pkgconfig_path}") endif() - set(ENV{PKG_CONFIG_PATH} ${_pkgconfig_path}) + set(ENV{PKG_CONFIG_PATH} "${_pkgconfig_path}") endif() # Unset variables @@ -381,6 +382,9 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma pkg_get_variable("${_pkg_check_prefix}_PREFIX" ${_pkg_check_modules_pkg} "prefix") pkg_get_variable("${_pkg_check_prefix}_INCLUDEDIR" ${_pkg_check_modules_pkg} "includedir") pkg_get_variable("${_pkg_check_prefix}_LIBDIR" ${_pkg_check_modules_pkg} "libdir") + foreach (variable IN ITEMS PREFIX INCLUDEDIR LIBDIR) + _pkgconfig_set("${_pkg_check_modules_pkg}_${variable}" "${${_pkg_check_modules_pkg}_${variable}}") + endforeach () if (NOT ${_is_silent}) message(STATUS " Found ${_pkg_check_modules_pkg}, version ${_pkgconfig_VERSION}") @@ -400,7 +404,7 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma if(NOT "${_extra_paths}" STREQUAL "") # Restore the environment variable - set(ENV{PKG_CONFIG_PATH} ${_pkgconfig_path}) + set(ENV{PKG_CONFIG_PATH} "${_pkgconfig_path_old}") endif() unset(_extra_paths) diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index 4a68cd186..2f13b09a8 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -305,7 +305,7 @@ mark_as_advanced(PROTOBUF_PROTOC_EXECUTABLE) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(PROTOBUF DEFAULT_MSG +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Protobuf DEFAULT_MSG PROTOBUF_LIBRARY PROTOBUF_INCLUDE_DIR) if(PROTOBUF_FOUND) diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake index 879192eb3..e194185f2 100644 --- a/Modules/FindPythonInterp.cmake +++ b/Modules/FindPythonInterp.cmake @@ -28,9 +28,10 @@ # for Python. You need to set this variable before calling # find_package(PythonInterp). # -# If also calling find_package(PythonLibs), call find_package(PythonInterp) -# first to get the currently active Python version by default with a consistent -# version of PYTHON_LIBRARIES. +# If calling both ``find_package(PythonInterp)`` and +# ``find_package(PythonLibs)``, call ``find_package(PythonInterp)`` first to +# get the currently active Python version by default with a consistent version +# of PYTHON_LIBRARIES. #============================================================================= # Copyright 2005-2010 Kitware, Inc. diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake index 68e1228ee..ab92f8683 100644 --- a/Modules/FindPythonLibs.cmake +++ b/Modules/FindPythonLibs.cmake @@ -32,9 +32,10 @@ # PYTHON_LIBRARY - path to the python library # PYTHON_INCLUDE_DIR - path to where Python.h is found # -# If also calling find_package(PythonInterp), call find_package(PythonInterp) -# first to get the currently active Python version by default with a consistent -# version of PYTHON_LIBRARIES. +# If calling both ``find_package(PythonInterp)`` and +# ``find_package(PythonLibs)``, call ``find_package(PythonInterp)`` first to +# get the currently active Python version by default with a consistent version +# of PYTHON_LIBRARIES. #============================================================================= # Copyright 2001-2009 Kitware, Inc. diff --git a/Modules/FindTIFF.cmake b/Modules/FindTIFF.cmake index ed092eafa..e60049848 100644 --- a/Modules/FindTIFF.cmake +++ b/Modules/FindTIFF.cmake @@ -2,24 +2,43 @@ # FindTIFF # -------- # -# Find TIFF library +# Find the TIFF library (libtiff). # -# Find the native TIFF includes and library This module defines +# Imported targets +# ^^^^^^^^^^^^^^^^ # -# :: +# This module defines the following :prop_tgt:`IMPORTED` targets: # -# TIFF_INCLUDE_DIR, where to find tiff.h, etc. -# TIFF_LIBRARIES, libraries to link against to use TIFF. -# TIFF_FOUND, If false, do not try to use TIFF. +# ``TIFF::TIFF`` +# The TIFF library, if found. # -# also defined, but not for general use are +# Result variables +# ^^^^^^^^^^^^^^^^ # -# :: +# This module will set the following variables in your project: # -# TIFF_LIBRARY, where to find the TIFF library. +# ``TIFF_FOUND`` +# true if the TIFF headers and libraries were found +# ``TIFF_INCLUDE_DIR`` +# the directory containing the TIFF headers +# ``TIFF_INCLUDE_DIRS`` +# the directory containing the TIFF headers +# ``TIFF_LIBRARIES`` +# TIFF libraries to be linked +# +# Cache variables +# ^^^^^^^^^^^^^^^ +# +# The following cache variables may also be set: +# +# ``TIFF_INCLUDE_DIR`` +# the directory containing the TIFF headers +# ``TIFF_LIBRARY`` +# the path to the TIFF library #============================================================================= # Copyright 2002-2009 Kitware, Inc. +# Copyright 2015 University of Dundee # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -65,7 +84,35 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(TIFF VERSION_VAR TIFF_VERSION_STRING) if(TIFF_FOUND) - set( TIFF_LIBRARIES ${TIFF_LIBRARY} ) + set(TIFF_LIBRARIES ${TIFF_LIBRARY}) + set(TIFF_INCLUDE_DIRS "${TIFF_INCLUDE_DIR}") + + if(NOT TARGET TIFF::TIFF) + add_library(TIFF::TIFF UNKNOWN IMPORTED) + if(TIFF_INCLUDE_DIRS) + set_target_properties(TIFF::TIFF PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${TIFF_INCLUDE_DIRS}") + endif() + if(EXISTS "${TIFF_LIBRARY}") + set_target_properties(TIFF::TIFF PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${TIFF_LIBRARY}") + endif() + if(EXISTS "${TIFF_LIBRARY_DEBUG}") + set_property(TARGET TIFF::TIFF APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(TIFF::TIFF PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C" + IMPORTED_LOCATION_DEBUG "${TIFF_LIBRARY_DEBUG}") + endif() + if(EXISTS "${TIFF_LIBRARY_RELEASE}") + set_property(TARGET TIFF::TIFF APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(TIFF::TIFF PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C" + IMPORTED_LOCATION_RELEASE "${TIFF_LIBRARY_RELEASE}") + endif() + endif() endif() mark_as_advanced(TIFF_INCLUDE_DIR TIFF_LIBRARY) diff --git a/Modules/FindXalanC.cmake b/Modules/FindXalanC.cmake new file mode 100644 index 000000000..016b7aabd --- /dev/null +++ b/Modules/FindXalanC.cmake @@ -0,0 +1,162 @@ +#.rst: +# FindXalanC +# ----------- +# +# Find the Apache Xalan-C++ XSL transform processor headers and libraries. +# +# Imported targets +# ^^^^^^^^^^^^^^^^ +# +# This module defines the following :prop_tgt:`IMPORTED` targets: +# +# ``XalanC::XalanC`` +# The Xalan-C++ ``xalan-c`` library, if found. +# +# Result variables +# ^^^^^^^^^^^^^^^^ +# +# This module will set the following variables in your project: +# +# ``XalanC_FOUND`` +# true if the Xalan headers and libraries were found +# ``XalanC_VERSION`` +# Xalan release version +# ``XalanC_INCLUDE_DIRS`` +# the directory containing the Xalan headers; note +# ``XercesC_INCLUDE_DIRS`` is also required +# ``XalanC_LIBRARIES`` +# Xalan libraries to be linked; note ``XercesC_LIBRARIES`` is also +# required +# +# Cache variables +# ^^^^^^^^^^^^^^^ +# +# The following cache variables may also be set: +# +# ``XalanC_INCLUDE_DIR`` +# the directory containing the Xalan headers +# ``XalanC_LIBRARY`` +# the Xalan library + +# Written by Roger Leigh + +#============================================================================= +# Copyright 2016 University of Dundee +# +# 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. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +function(_XalanC_GET_VERSION version_hdr) + file(STRINGS ${version_hdr} _contents REGEX "^[ \t]*#define XALAN_VERSION_.*") + if(_contents) + string(REGEX REPLACE "[^*]*#define XALAN_VERSION_MAJOR[ \t]+([0-9]+).*" "\\1" XalanC_MAJOR "${_contents}") + string(REGEX REPLACE "[^*]*#define XALAN_VERSION_MINOR[ \t]+([0-9]+).*" "\\1" XalanC_MINOR "${_contents}") + string(REGEX REPLACE "[^*]*#define XALAN_VERSION_REVISION[ \t]+([0-9]+).*" "\\1" XalanC_PATCH "${_contents}") + + if(NOT XalanC_MAJOR MATCHES "^[0-9]+$") + message(FATAL_ERROR "Version parsing failed for XALAN_VERSION_MAJOR!") + endif() + if(NOT XalanC_MINOR MATCHES "^[0-9]+$") + message(FATAL_ERROR "Version parsing failed for XALAN_VERSION_MINOR!") + endif() + if(NOT XalanC_PATCH MATCHES "^[0-9]+$") + message(FATAL_ERROR "Version parsing failed for XALAN_VERSION_REVISION!") + endif() + + set(XalanC_VERSION "${XalanC_MAJOR}.${XalanC_MINOR}.${XalanC_PATCH}" PARENT_SCOPE) + set(XalanC_VERSION_MAJOR "${XalanC_MAJOR}" PARENT_SCOPE) + set(XalanC_VERSION_MINOR "${XalanC_MINOR}" PARENT_SCOPE) + set(XalanC_VERSION_PATCH "${XalanC_PATCH}" PARENT_SCOPE) + else() + message(FATAL_ERROR "Include file ${version_hdr} does not exist or does not contain expected version information") + endif() +endfunction() + +# Find include directory +find_path(XalanC_INCLUDE_DIR + NAMES "xalanc/XalanTransformer/XalanTransformer.hpp" + DOC "Xalan-C++ include directory") +mark_as_advanced(XalanC_INCLUDE_DIR) + +if(XalanC_INCLUDE_DIR) + _XalanC_GET_VERSION("${XalanC_INCLUDE_DIR}/xalanc/Include/XalanVersion.hpp") +endif() + +if(NOT XalanC_LIBRARY) + # Find all XalanC libraries + find_library(XalanC_LIBRARY_RELEASE + NAMES "Xalan-C" "xalan-c" + "Xalan-C_${XalanC_VERSION_MAJOR}" + "Xalan-C_${XalanC_VERSION_MAJOR}_${XalanC_VERSION_MINOR}" + DOC "Xalan-C++ libraries (release)") + find_library(XalanC_LIBRARY_DEBUG + NAMES "Xalan-CD" "xalan-cd" + "Xalan-C_${XalanC_VERSION_MAJOR}D" + "Xalan-C_${XalanC_VERSION_MAJOR}_${XalanC_VERSION_MINOR}D" + DOC "Xalan-C++ libraries (debug)") + include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) + select_library_configurations(XalanC) + mark_as_advanced(XalanC_LIBRARY_RELEASE XalanC_LIBRARY_DEBUG) +endif() + +unset(XalanC_VERSION_MAJOR) +unset(XalanC_VERSION_MINOR) +unset(XalanC_VERSION_PATCH) + +unset(XalanC_XERCESC_REQUIRED) +if(XalanC_FIND_REQUIRED) + set(XalanC_XERCESC_REQUIRED REQUIRED) +endif() +find_package(XercesC ${XalanC_XERCESC_REQUIRED}) +unset(XalanC_XERCESC_REQUIRED) + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(XalanC + FOUND_VAR XalanC_FOUND + REQUIRED_VARS XalanC_LIBRARY + XalanC_INCLUDE_DIR + XalanC_VERSION + XercesC_FOUND + VERSION_VAR XalanC_VERSION + FAIL_MESSAGE "Failed to find XalanC") + +if(XalanC_FOUND) + set(XalanC_INCLUDE_DIRS "${XalanC_INCLUDE_DIR}" ${XercesC_INCLUDE_DIRS}) + set(XalanC_LIBRARIES "${XalanC_LIBRARY}" ${XercesC_LIBRARIES}) + + # For header-only libraries + if(NOT TARGET XalanC::XalanC) + add_library(XalanC::XalanC UNKNOWN IMPORTED) + if(XalanC_INCLUDE_DIRS) + set_target_properties(XalanC::XalanC PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${XalanC_INCLUDE_DIRS}") + endif() + if(EXISTS "${XalanC_LIBRARY}") + set_target_properties(XalanC::XalanC PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION "${XalanC_LIBRARY}") + endif() + if(EXISTS "${XalanC_LIBRARY_DEBUG}") + set_property(TARGET XalanC::XalanC APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(XalanC::XalanC PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX" + IMPORTED_LOCATION_DEBUG "${XalanC_LIBRARY_DEBUG}") + endif() + if(EXISTS "${XalanC_LIBRARY_RELEASE}") + set_property(TARGET XalanC::XalanC APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(XalanC::XalanC PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX" + IMPORTED_LOCATION_RELEASE "${XalanC_LIBRARY_RELEASE}") + endif() + set_target_properties(XalanC::XalanC PROPERTIES INTERFACE_LINK_LIBRARIES XercesC::XercesC) + endif() +endif() diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake index 903759404..49ce57e49 100644 --- a/Modules/FindwxWidgets.cmake +++ b/Modules/FindwxWidgets.cmake @@ -188,18 +188,6 @@ set(wxWidgets_LIBRARIES "") set(wxWidgets_LIBRARY_DIRS "") set(wxWidgets_CXX_FLAGS "") -# Using SYSTEM with INCLUDE_DIRECTORIES in conjunction with wxWidgets on -# the Mac produces compiler errors. Set wxWidgets_INCLUDE_DIRS_NO_SYSTEM -# to prevent UsewxWidgets.cmake from using SYSTEM. -# -# See cmake mailing list discussions for more info: -# https://cmake.org/pipermail/cmake/2008-April/021115.html -# https://cmake.org/pipermail/cmake/2008-April/021146.html -# -if(APPLE OR CMAKE_CXX_PLATFORM_ID MATCHES "OpenBSD") - set(wxWidgets_INCLUDE_DIRS_NO_SYSTEM 1) -endif() - # DEPRECATED: This is a patch to support the DEPRECATED use of # wxWidgets_USE_LIBS. # diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index 82054256a..4f4efbcf3 100644 --- a/Modules/GenerateExportHeader.cmake +++ b/Modules/GenerateExportHeader.cmake @@ -230,7 +230,11 @@ macro(_test_compiler_hidden_visibility) endmacro() macro(_test_compiler_has_deprecated) + # NOTE: Some Embarcadero compilers silently compile __declspec(deprecated) + # without error, but this is not a documented feature and the attribute does + # not actually generate any warnings. if(CMAKE_CXX_COMPILER_ID MATCHES Borland + OR CMAKE_CXX_COMPILER_ID MATCHES Embarcadero OR CMAKE_CXX_COMPILER_ID MATCHES HP OR GCC_TOO_OLD OR CMAKE_CXX_COMPILER_ID MATCHES PGI diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index e4018b670..391e7f8fa 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -538,7 +538,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 "^(${sysroot}/sys(tem|wow)|${windir}/sys(tem|wow)|(.*/)*msvc[^/]+dll)") + if(lower MATCHES "^(api-ms-win-|${sysroot}/sys(tem|wow)|${windir}/sys(tem|wow)|(.*/)*msvc[^/]+dll)") set(is_system 1) endif() @@ -566,7 +566,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 "^(${sysroot}/sys(tem|wow)|${windir}/sys(tem|wow)|(.*/)*msvc[^/]+dll)") + if(lower MATCHES "^(api-ms-win-|${sysroot}/sys(tem|wow)|${windir}/sys(tem|wow)|(.*/)*msvc[^/]+dll)") set(is_system 1) endif() endif() diff --git a/Modules/Platform/AIX-GNU.cmake b/Modules/Platform/AIX-GNU.cmake index e5d9434b5..d6f5331dd 100644 --- a/Modules/Platform/AIX-GNU.cmake +++ b/Modules/Platform/AIX-GNU.cmake @@ -18,10 +18,20 @@ if(__AIX_COMPILER_GNU) endif() set(__AIX_COMPILER_GNU 1) +# +# By default, runtime linking is enabled. All shared objects specified on the command line +# will be listed, even if there are no symbols referenced, in the output file. +set (CMAKE_SHARED_LINKER_FLAGS_INIT "-Wl,-brtl") +set (CMAKE_MODULE_LINKER_FLAGS_INIT "-Wl,-brtl") +set (CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,-brtl") + + macro(__aix_compiler_gnu lang) set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-blibpath:") set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":") set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,-G,-bnoipath") - set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-brtl,-bnoipath,-bexpall") # +s, flag for exe link to use shared lib + set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-bexpall") set(CMAKE_${lang}_USE_IMPLICIT_LINK_DIRECTORIES_IN_RUNTIME_PATH 1) + + set(CMAKE_${lang}_LINK_FLAGS "-Wl,-bnoipath") endmacro() diff --git a/Modules/Platform/AIX-XL.cmake b/Modules/Platform/AIX-XL.cmake index abf385569..5470441f9 100644 --- a/Modules/Platform/AIX-XL.cmake +++ b/Modules/Platform/AIX-XL.cmake @@ -18,11 +18,21 @@ if(__AIX_COMPILER_XL) endif() set(__AIX_COMPILER_XL 1) +# +# By default, runtime linking is enabled. All shared objects specified on the command line +# will be listed, even if there are no symbols referenced, in the output file. +set(CMAKE_SHARED_LINKER_FLAGS_INIT "-Wl,-brtl") +set(CMAKE_MODULE_LINKER_FLAGS_INIT "-Wl,-brtl") +set(CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,-brtl") + + macro(__aix_compiler_xl lang) set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-blibpath:") set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":") set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-G -Wl,-bnoipath") # -shared - set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-brtl,-bnoipath,-bexpall") # +s, flag for exe link to use shared lib + set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-bexpall") set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS " ") set(CMAKE_SHARED_MODULE_${lang}_FLAGS " ") + + set(CMAKE_${lang}_LINK_FLAGS "-Wl,-bnoipath") endmacro() diff --git a/Modules/Platform/CrayLinuxEnvironment.cmake b/Modules/Platform/CrayLinuxEnvironment.cmake index 19a0f713a..97771a268 100644 --- a/Modules/Platform/CrayLinuxEnvironment.cmake +++ b/Modules/Platform/CrayLinuxEnvironment.cmake @@ -2,12 +2,6 @@ # needs to be custom. We use the variables defined through Cray's environment # modules to set up the right paths for things. -# Guard against multiple inclusions -if(__CrayLinuxEnvironment) - return() -endif() -set(__CrayLinuxEnvironment 1) - set(UNIX 1) if(DEFINED ENV{CRAYOS_VERSION}) @@ -17,7 +11,12 @@ elseif(DEFINED ENV{XTOS_VERSION}) else() message(FATAL_ERROR "Neither the CRAYOS_VERSION or XTOS_VERSION environment variables are defined. This platform file should be used inside the Cray Linux Environment for targeting compute nodes (NIDs)") endif() -message(STATUS "Cray Linux Environment ${CMAKE_SYSTEM_VERSION}") + +# Guard against multiple messages +if(NOT __CrayLinuxEnvironment_message) + set(__CrayLinuxEnvironment_message 1) + message(STATUS "Cray Linux Environment ${CMAKE_SYSTEM_VERSION}") +endif() # All cray systems are x86 CPUs and have been for quite some time # Note: this may need to change in the future with 64-bit ARM @@ -29,8 +28,13 @@ set(CMAKE_STATIC_LIBRARY_PREFIX "lib") set(CMAKE_STATIC_LIBRARY_SUFFIX ".a") set(CMAKE_FIND_LIBRARY_PREFIXES "lib") -set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a") -set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE) + +# Don't override shared lib support if it's already been set and possibly +# overridden elsewhere by the CrayPrgEnv module +if(NOT CMAKE_FIND_LIBRARY_SUFFIXES) + set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a") + set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE) +endif() set(CMAKE_DL_LIBS dl) @@ -42,7 +46,6 @@ set(CMAKE_DL_LIBS dl) get_filename_component(__cmake_install_dir "${CMAKE_ROOT}" PATH) get_filename_component(__cmake_install_dir "${__cmake_install_dir}" PATH) - # Note: Some Cray's have the SYSROOT_DIR variable defined, pointing to a copy # of the NIDs userland. If so, then we'll use it. Otherwise, just assume # the userland from the login node is ok @@ -78,35 +81,63 @@ list(APPEND CMAKE_SYSTEM_LIBRARY_PATH $ENV{SYSROOT_DIR}/usr/lib64 $ENV{SYSROOT_DIR}/lib64 ) - list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES $ENV{SYSROOT_DIR}/usr/local/lib64 $ENV{SYSROOT_DIR}/usr/lib64 $ENV{SYSROOT_DIR}/lib64 ) -list(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES - $ENV{SYSROOT_DIR}/usr/include -) -list(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES - $ENV{SYSROOT_DIR}/usr/include -) -list(APPEND CMAKE_Fortran_IMPLICIT_INCLUDE_DIRECTORIES - $ENV{SYSROOT_DIR}/usr/include -) + +# Compute the intersection of several lists +function(__cray_list_intersect OUTPUT INPUT0) + if(ARGC EQUAL 2) + list(APPEND ${OUTPUT} ${${INPUT0}}) + else() + foreach(I IN LISTS ${INPUT0}) + set(__is_common 1) + foreach(L IN LISTS ARGN) + list(FIND ${L} "${I}" __idx) + if(__idx EQUAL -1) + set(__is_common 0) + break() + endif() + endforeach() + if(__is_common) + list(APPEND ${OUTPUT} "${I}") + endif() + endforeach() + endif() + set(${OUTPUT} ${${OUTPUT}} PARENT_SCOPE) +endfunction() + +macro(__list_clean_dupes var) + if(${var}) + list(REMOVE_DUPLICATES ${var}) + endif() +endmacro() + +get_property(__langs GLOBAL PROPERTY ENABLED_LANGUAGES) +set(__cray_inc_path_vars) +set(__cray_lib_path_vars) +foreach(__lang IN LISTS __langs) + list(APPEND __cray_inc_path_vars CMAKE_${__lang}_IMPLICIT_INCLUDE_DIRECTORIES) + list(APPEND __cray_lib_path_vars CMAKE_${__lang}_IMPLICIT_LINK_DIRECTORIES) +endforeach() +if(__cray_inc_path_vars) + __cray_list_intersect(__cray_implicit_include_dirs ${__cray_inc_path_vars}) + if(__cray_implicit_include_dirs) + list(INSERT CMAKE_SYSTEM_INCLUDE_PATH 0 ${__cray_implicit_include_dirs}) + endif() +endif() +if(__cray_lib_path_vars) + __cray_list_intersect(__cray_implicit_library_dirs ${__cray_lib_path_vars}) + if(__cray_implicit_library_dirs) + list(INSERT CMAKE_SYSTEM_LIBRARY_PATH 0 ${__cray_implicit_library_dirs}) + endif() +endif() +__list_clean_dupes(CMAKE_SYSTEM_PREFIX_PATH) +__list_clean_dupes(CMAKE_SYSTEM_INCLUDE_PATH) +__list_clean_dupes(CMAKE_SYSTEM_LIBRARY_PATH) +__list_clean_dupes(CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES) # Enable use of lib64 search path variants by default. set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE) - -# Check to see if we're using the cray compiler wrappers and load accordingly -# if we are -if(DEFINED ENV{CRAYPE_DIR}) - set(_CRAYPE_ROOT "$ENV{CRAYPE_DIR}") -elseif(DEFINED ENV{ASYNCPE_DIR}) - set(_CRAYPE_ROOT "$ENV{ASYNCPE_DIR}") -endif() -if(_CRAYPE_ROOT AND - ((CMAKE_C_COMPILER MATCHES "${_CRAYPE_ROOT}") OR - (CMAKE_CXX_COMPILER MATCHES "${_CRAYPE_ROOT}") OR - (CMAKE_Fortran_COMPILER MATCHES "${_CRAYPE_ROOT}"))) - include(Platform/CrayPrgEnv) -endif() diff --git a/Modules/Platform/CrayPrgEnv.cmake b/Modules/Platform/CrayPrgEnv.cmake deleted file mode 100644 index d60266b52..000000000 --- a/Modules/Platform/CrayPrgEnv.cmake +++ /dev/null @@ -1,149 +0,0 @@ -# Guard against multiple inclusions -if(__CrayPrgEnv) - return() -endif() -set(__CrayPrgEnv 1) -if(DEFINED ENV{CRAYPE_VERSION}) - message(STATUS "Cray Programming Environment $ENV{CRAYPE_VERSION}") - set(__verbose_flag "-craype-verbose") -elseif(DEFINED ENV{ASYNCPE_VERSION}) - message(STATUS "Cray Programming Environment $ENV{ASYNCPE_VERSION}") - set(__verbose_flag "-v") -else() - message(STATUS "Cray Programming Environment") -endif() - -if(NOT __CrayLinuxEnvironment) - message(FATAL_ERROR "The CrayPrgEnv platform file must not be used on its own and is intented to be included by the CrayLinuxEnvironment platform file") -endif() - -# Flags for the Cray wrappers -foreach(__lang C CXX Fortran) - set(CMAKE_STATIC_LIBRARY_LINK_${__lang}_FLAGS "-static") - set(CMAKE_SHARED_LIBRARY_${__lang}_FLAGS "") - set(CMAKE_SHARED_LIBRARY_CREATE_${__lang}_FLAGS "-shared") - set(CMAKE_SHARED_LIBRARY_LINK_${__lang}_FLAGS "-dynamic") -endforeach() - -# If the link type is not explicitly specified in the environment then -# the Cray wrappers assume that the code will be built staticly so -# we check the following condition(s) are NOT met -# Compiler flags are explicitly dynamic -# Env var is dynamic and compiler flags are not explicitly static -if(NOT (((CMAKE_C_FLAGS MATCHES "(^| )-dynamic($| )") OR - (CMAKE_CXX_FLAGS MATCHES "(^| )-dynamic($| )") OR - (CMAKE_Fortran_FLAGS MATCHES "(^| )-dynamic($| )") OR - (CMAKE_EXE_LINKER_FLAGS MATCHES "(^| )-dynamic($| )")) - OR - (("$ENV{CRAYPE_LINK_TYPE}" STREQUAL "dynamic") AND - NOT ((CMAKE_C_FLAGS MATCHES "(^| )-static($| )") OR - (CMAKE_CXX_FLAGS MATCHES "(^| )-static($| )") OR - (CMAKE_Fortran_FLAGS MATCHES "(^| )-static($| )") OR - (CMAKE_EXE_LINKER_FLAGS MATCHES "(^| )-static($| )"))))) - set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) - set(BUILD_SHARED_LIBS FALSE CACHE BOOL "") - set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") - set(CMAKE_LINK_SEARCH_START_STATIC TRUE) -endif() - -function(__cray_parse_flags_with_sep OUTPUT FLAG_TAG SEP INPUT) - string(REGEX MATCHALL "${SEP}${FLAG_TAG}([^${SEP}]+)" FLAG_ARGS "${INPUT}") - foreach(FLAG_ARG IN LISTS FLAG_ARGS) - string(REGEX REPLACE - "^${SEP}${FLAG_TAG}([^${SEP}]+)" "\\1" FLAG_VALUE - "${FLAG_ARG}") - list(APPEND ${OUTPUT} ${FLAG_VALUE}) - endforeach() - set(${OUTPUT} ${${OUTPUT}} PARENT_SCOPE) -endfunction() -macro(__cray_parse_flags OUTPUT FLAG_TAG INPUT) - __cray_parse_flags_with_sep(${OUTPUT} ${FLAG_TAG} " " "${INPUT}") -endmacro() - -# Remove duplicates in a list -macro(__cray_list_remove_duplicates VAR) - if(${VAR}) - list(REMOVE_DUPLICATES ${VAR}) - endif() -endmacro() - -# Compute the intersection of several lists -function(__cray_list_intersect OUTPUT INPUT0) - if(ARGC EQUAL 2) - list(APPEND ${OUTPUT} ${${INPUT0}}) - else() - foreach(I IN LISTS ${INPUT0}) - set(__is_common 1) - foreach(L IN LISTS ARGN) - list(FIND ${L} "${I}" __idx) - if(__idx EQUAL -1) - set(__is_common 0) - break() - endif() - endforeach() - if(__is_common) - list(APPEND ${OUTPUT} "${I}") - endif() - endforeach() - endif() - set(${OUTPUT} ${${OUTPUT}} PARENT_SCOPE) -endfunction() - -# Parse the implicit directories used by the wrappers -get_property(__langs GLOBAL PROPERTY ENABLED_LANGUAGES) -foreach(__lang IN LISTS __langs) - if(__lang STREQUAL "C") - set(__empty empty.c) - elseif(__lang STREQUAL CXX) - set(__empty empty.cxx) - elseif(__lang STREQUAL Fortran) - set(__empty empty.f90) - else() - continue() - endif() - - execute_process( - COMMAND ${CMAKE_${__lang}_COMPILER} ${__verbose_flag} ${__empty} - OUTPUT_VARIABLE __cmd_out - ERROR_QUIET - ) - string(REGEX MATCH "(^|\n)[^\n]*${__empty}[^\n]*" __driver "${__cmd_out}") - - # Parse include paths - set(__cray_flag_args) - __cray_parse_flags(__cray_flag_args "-I" "${__driver}") - __cray_parse_flags(__cray_flag_args "-isystem " "${__driver}") - list(APPEND CMAKE_${__lang}_IMPLICIT_INCLUDE_DIRECTORIES ${__cray_flag_args}) - __cray_list_remove_duplicates(CMAKE_${__lang}_IMPLICIT_INCLUDE_DIRECTORIES) - - # Parse library paths - set(__cray_flag_args) - __cray_parse_flags(__cray_flag_args "-L" "${__driver}") - list(APPEND CMAKE_${__lang}_IMPLICIT_LINK_DIRECTORIES ${__cray_flag_args}) - __cray_list_remove_duplicates(CMAKE_${__lang}_IMPLICIT_LINK_DIRECTORIES) - - # Parse libraries - set(__cray_flag_args) - __cray_parse_flags(__cray_flag_args "-l" "${__driver}") - __cray_parse_flags(__cray_linker_flags "-Wl" "${__driver}") - foreach(F IN LISTS __cray_linker_flags) - __cray_parse_flags_with_sep(__cray_flag_args "-l" "," "${F}") - endforeach() - list(APPEND CMAKE_${__lang}_IMPLICIT_LINK_LIBRARIES ${__cray_flag_args}) - __cray_list_remove_duplicates(CMAKE_${__lang}_IMPLICIT_LINK_LIBRARIES) -endforeach() - -# Determine the common directories between all languages and add them -# as system search paths -set(__cray_inc_path_vars) -set(__cray_lib_path_vars) -foreach(__lang IN LISTS __langs) - list(APPEND __cray_inc_path_vars CMAKE_${__lang}_IMPLICIT_INCLUDE_DIRECTORIES) - list(APPEND __cray_lib_path_vars CMAKE_${__lang}_IMPLICIT_LINK_DIRECTORIES) -endforeach() -if(__cray_inc_path_vars) - __cray_list_intersect(CMAKE_SYSTEM_INCLUDE_PATH ${__cray_inc_path_vars}) -endif() -if(__cray_lib_path_vars) - __cray_list_intersect(CMAKE_SYSTEM_LIBRARY_PATH ${__cray_lib_path_vars}) -endif() diff --git a/Modules/Platform/HP-UX-GNU.cmake b/Modules/Platform/HP-UX-GNU.cmake index eb909fe99..6c717842a 100644 --- a/Modules/Platform/HP-UX-GNU.cmake +++ b/Modules/Platform/HP-UX-GNU.cmake @@ -20,8 +20,10 @@ set(__HPUX_COMPILER_GNU 1) macro(__hpux_compiler_gnu lang) set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,-E,-b,+nodefaultrpath") - set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,+s,-E,+nodefaultrpath") + set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-E") set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,+b") set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":") set(CMAKE_SHARED_LIBRARY_SONAME_${lang}_FLAG "-Wl,+h") + + set(CMAKE_${lang}_LINK_FLAGS "-Wl,+s,+nodefaultrpath") endmacro() diff --git a/Modules/Platform/HP-UX-HP.cmake b/Modules/Platform/HP-UX-HP.cmake index 871ea1323..3935c31c1 100644 --- a/Modules/Platform/HP-UX-HP.cmake +++ b/Modules/Platform/HP-UX-HP.cmake @@ -22,10 +22,12 @@ macro(__hpux_compiler_hp lang) set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "+Z") set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "+Z") set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-Wl,-E,+nodefaultrpath -b -L/usr/lib") - set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,+s,-E,+nodefaultrpath") + set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-E") set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,+b") set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":") set(CMAKE_SHARED_LIBRARY_SONAME_${lang}_FLAG "-Wl,+h") set(CMAKE_${lang}_FLAGS_INIT "") + + set(CMAKE_${lang}_LINK_FLAGS "-Wl,+s,+nodefaultrpath") endmacro() diff --git a/Modules/Platform/Windows-Embarcadero.cmake b/Modules/Platform/Windows-Embarcadero.cmake index 5295a48e6..102e3a651 100644 --- a/Modules/Platform/Windows-Embarcadero.cmake +++ b/Modules/Platform/Windows-Embarcadero.cmake @@ -78,7 +78,11 @@ set (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_SHARED_LINKER_FLAGS_R # invocations within a single working directory. if(NOT DEFINED CMAKE_JOB_POOL_LINK) set(CMAKE_JOB_POOL_LINK BCC32LinkPool) - set_property(GLOBAL APPEND PROPERTY JOB_POOLS BCC32LinkPool=1) + get_property(_bccjp GLOBAL PROPERTY JOB_POOLS) + if(NOT _bccjp MATCHES "BCC32LinkPool=") + set_property(GLOBAL APPEND PROPERTY JOB_POOLS BCC32LinkPool=1) + endif() + unset(_bccjp) endif() macro(__embarcadero_language lang) diff --git a/Modules/Platform/WindowsPaths.cmake b/Modules/Platform/WindowsPaths.cmake index 658de3bf5..eafa8fa1d 100644 --- a/Modules/Platform/WindowsPaths.cmake +++ b/Modules/Platform/WindowsPaths.cmake @@ -28,46 +28,32 @@ set(__WINDOWS_PATHS_INCLUDED 1) # Windows 64-bit Binary: # ENV{ProgramFiles(x86)} = [C:\Program Files (x86)] # ENV{ProgramFiles} = [C:\Program Files] -# ENV{ProgramW6432} = -# (executed from cygwin): -# ENV{ProgramFiles(x86)} = -# ENV{ProgramFiles} = [C:\Program Files] -# ENV{ProgramW6432} = +# ENV{ProgramW6432} = [C:\Program Files] or # -# Windows 32-bit Binary: +# Windows 32-bit Binary on 64-bit Windows: # ENV{ProgramFiles(x86)} = [C:\Program Files (x86)] # ENV{ProgramFiles} = [C:\Program Files (x86)] # ENV{ProgramW6432} = [C:\Program Files] -# (executed from cygwin): -# ENV{ProgramFiles(x86)} = -# ENV{ProgramFiles} = [C:\Program Files (x86)] -# ENV{ProgramW6432} = [C:\Program Files] -if(DEFINED "ENV{ProgramW6432}") - # 32-bit binary on 64-bit windows. - # The 64-bit program files are in ProgramW6432. - list(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramW6432}") - - # The 32-bit program files are in ProgramFiles. - if(DEFINED "ENV{ProgramFiles}") - list(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramFiles}") +set(_programfiles "") +foreach(v "ProgramW6432" "ProgramFiles" "ProgramFiles(x86)") + if(DEFINED "ENV{${v}}") + file(TO_CMAKE_PATH "$ENV{${v}}" _env_programfiles) + list(APPEND _programfiles "${_env_programfiles}") + unset(_env_programfiles) endif() -else() - # 64-bit binary, or 32-bit binary on 32-bit windows. - if(DEFINED "ENV{ProgramFiles}") - list(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramFiles}") - endif() - set(programfilesx86 "ProgramFiles(x86)") - if(DEFINED "ENV{${programfilesx86}}") - # 64-bit binary. 32-bit program files are in ProgramFiles(x86). - list(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{${programfilesx86}}") - elseif(DEFINED "ENV{SystemDrive}") - # Guess the 32-bit program files location. - if(EXISTS "$ENV{SystemDrive}/Program Files (x86)") - list(APPEND CMAKE_SYSTEM_PREFIX_PATH - "$ENV{SystemDrive}/Program Files (x86)") +endforeach() +if(DEFINED "ENV{SystemDrive}") + foreach(d "Program Files" "Program Files (x86)") + if(EXISTS "$ENV{SystemDrive}/${d}") + list(APPEND _programfiles "$ENV{SystemDrive}/${d}") endif() - endif() + endforeach() endif() +if(_programfiles) + list(REMOVE_DUPLICATES _programfiles) + list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${_programfiles}) +endif() +unset(_programfiles) # Add the CMake install location. get_filename_component(_CMAKE_INSTALL_DIR "${CMAKE_ROOT}" PATH) diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index dced6eca8..475ad5ee0 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -184,7 +184,7 @@ # This is used by install_jni_symlink(). # JAR_FILE The location of the jar file so that you can include # it. -# CLASS_DIR The directory where the class files can be found. For +# CLASSDIR The directory where the class files can be found. For # example to use them with javah. # # :: @@ -444,7 +444,7 @@ function(add_jar _TARGET_NAME) if (_add_jar_MANIFEST) set(_MANIFEST_OPTION m) - set(_MANIFEST_VALUE ${_add_jar_MANIFEST}) + get_filename_component (_MANIFEST_VALUE "${_add_jar_MANIFEST}" ABSOLUTE) endif () if (LIBRARY_OUTPUT_PATH) @@ -1212,7 +1212,7 @@ function (create_javah) set (_output_files) if (WIN32 AND NOT CYGWIN AND CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") - set(_classpath_sep ";") + set(_classpath_sep "$") else () set(_classpath_sep ":") endif() @@ -1242,7 +1242,7 @@ function (create_javah) endif() endforeach() string (REPLACE ";" "${_classpath_sep}" _classpath "${_classpath}") - list (APPEND _javah_options -classpath ${_classpath}) + list (APPEND _javah_options -classpath "${_classpath}") endif() if (_create_javah_OUTPUT_DIR) diff --git a/Source/CMakeInstallDestinations.cmake b/Source/CMakeInstallDestinations.cmake index 99c86ca77..2f9d95ae5 100644 --- a/Source/CMakeInstallDestinations.cmake +++ b/Source/CMakeInstallDestinations.cmake @@ -3,24 +3,29 @@ if(BEOS) set(CMAKE_DATA_DIR_DEFAULT "share/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") # HAIKU set(CMAKE_MAN_DIR_DEFAULT "documentation/man") # HAIKU set(CMAKE_DOC_DIR_DEFAULT "documentation/doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") # HAIKU + set(CMAKE_XDGDATA_DIR_DEFAULT "share") # HAIKU elseif(CYGWIN) set(CMAKE_DATA_DIR_DEFAULT "share/cmake-${CMake_VERSION}") # CYGWIN set(CMAKE_DOC_DIR_DEFAULT "share/doc/cmake-${CMake_VERSION}") # CYGWIN set(CMAKE_MAN_DIR_DEFAULT "share/man") # CYGWIN + set(CMAKE_XDGDATA_DIR_DEFAULT "share") # CYGWIN else() set(CMAKE_DATA_DIR_DEFAULT "share/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") # OTHER set(CMAKE_DOC_DIR_DEFAULT "doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") # OTHER set(CMAKE_MAN_DIR_DEFAULT "man") # OTHER + set(CMAKE_XDGDATA_DIR_DEFAULT "share") # OTHER endif() set(CMAKE_DATA_DIR_DESC "data") set(CMAKE_DOC_DIR_DESC "docs") set(CMAKE_MAN_DIR_DESC "man pages") +set(CMAKE_XDGDATA_DIR_DESC "XDG specific files") foreach(v CMAKE_DATA_DIR CMAKE_DOC_DIR CMAKE_MAN_DIR + CMAKE_XDGDATA_DIR ) # Populate the cache with empty values so we know when the user sets them. set(${v} "" CACHE STRING "") diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index f23331bec..ab70568d3 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -566,6 +566,7 @@ target_link_libraries(CMakeLib cmsys ${CMAKE_TAR_LIBRARIES} ${CMAKE_COMPRESS_LIBRARIES} ${CMAKE_CURL_LIBRARIES} ${CMAKE_JSONCPP_LIBRARIES} + ${CMake_KWIML_LIBRARIES} ) # On Apple we need CoreFoundation diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 15782b60d..129a882b3 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 4) -set(CMake_VERSION_PATCH 20151202) -#set(CMake_VERSION_RC 1) +set(CMake_VERSION_MINOR 5) +set(CMake_VERSION_PATCH 0) +#set(CMake_VERSION_RC 0) diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index d5246db43..ece327a41 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -242,7 +242,16 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration() const char* patchFilePath = GetOption("CPACK_WIX_PATCH_FILE"); if(patchFilePath) { - this->Patch->LoadFragments(patchFilePath); + std::vector patchFilePaths; + cmSystemTools::ExpandListArgument(patchFilePath, patchFilePaths); + + for(size_t i = 0; i < patchFilePaths.size(); ++i) + { + if(!this->Patch->LoadFragments(patchFilePaths[i])) + { + return false; + } + } } return true; @@ -817,6 +826,8 @@ bool cmCPackWIXGenerator::CreateShortcutsOfSpecificType( fileDefinitions.AddAttribute("Id", componentId); fileDefinitions.AddAttribute("Guid", "*"); + this->Patch->ApplyFragment(componentId, fileDefinitions); + std::string registryKey = std::string("Software\\") + cpackVendor + "\\" + cpackPackageName; @@ -911,8 +922,9 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons( relativeDirectoryPath = "."; } - cmInstalledFile const* directoryInstalledFile = - this->GetInstalledFile(relativeDirectoryPath); + cmInstalledFile const* directoryInstalledFile = this->GetInstalledFile( + this->RelativePathWithoutComponentPrefix(relativeDirectoryPath) + ); bool emptyDirectory = dir.GetNumberOfFiles() == 2; bool createDirectory = false; @@ -980,8 +992,9 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons( } else { - cmInstalledFile const* installedFile = - this->GetInstalledFile(relativePath); + cmInstalledFile const* installedFile = this->GetInstalledFile( + this->RelativePathWithoutComponentPrefix(relativePath) + ); if(installedFile) { @@ -1230,3 +1243,16 @@ void cmCPackWIXGenerator::AddCustomFlags( stream << " " << QuotePath(*i); } } + +std::string cmCPackWIXGenerator::RelativePathWithoutComponentPrefix( + std::string const& path) +{ + if(this->Components.empty()) + { + return path; + } + + std::string::size_type pos = path.find('/'); + + return path.substr(pos + 1); +} diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.h b/Source/CPack/WiX/cmCPackWIXGenerator.h index d50160953..3f66b2c02 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.h +++ b/Source/CPack/WiX/cmCPackWIXGenerator.h @@ -168,6 +168,9 @@ private: void AddCustomFlags( std::string const& variableName, std::ostream& stream); + std::string RelativePathWithoutComponentPrefix( + std::string const& path); + std::vector WixSources; id_map_t PathToIdMap; ambiguity_map_t IdAmbiguityCounter; diff --git a/Source/CPack/WiX/cmWIXPatch.cxx b/Source/CPack/WiX/cmWIXPatch.cxx index 471c3a411..07375da10 100644 --- a/Source/CPack/WiX/cmWIXPatch.cxx +++ b/Source/CPack/WiX/cmWIXPatch.cxx @@ -20,10 +20,18 @@ cmWIXPatch::cmWIXPatch(cmCPackLog* logger): } -void cmWIXPatch::LoadFragments(std::string const& patchFilePath) +bool cmWIXPatch::LoadFragments(std::string const& patchFilePath) { cmWIXPatchParser parser(Fragments, Logger); - parser.ParseFile(patchFilePath.c_str()); + if(!parser.ParseFile(patchFilePath.c_str())) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Failed parsing XML patch file: '" << + patchFilePath << "'" << std::endl); + return false; + } + + return true; } void cmWIXPatch::ApplyFragment( diff --git a/Source/CPack/WiX/cmWIXPatch.h b/Source/CPack/WiX/cmWIXPatch.h index d53fcb47f..2f31a013e 100644 --- a/Source/CPack/WiX/cmWIXPatch.h +++ b/Source/CPack/WiX/cmWIXPatch.h @@ -26,7 +26,7 @@ class cmWIXPatch public: cmWIXPatch(cmCPackLog* logger); - void LoadFragments(std::string const& patchFilePath); + bool LoadFragments(std::string const& patchFilePath); void ApplyFragment(std::string const& id, cmWIXSourceWriter& writer); diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index 1a694eaa9..7b94ca3c0 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -693,27 +693,49 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, ofs << std::dec << std::nouppercase << std::setfill(' '); } + bool have_write_license_error = false; + std::string error; + if(oldStyle) { - WriteLicense(ofs, 0, "", cpack_license_file); + if(!this->WriteLicense(ofs, 0, "", cpack_license_file, &error)) + { + have_write_license_error = true; + } } else { - for(size_t i = 0; i < languages.size(); ++i) + for(size_t i = 0; i < languages.size() && !have_write_license_error; ++i) { if(singleLicense) { - WriteLicense(ofs, i + 5000, languages[i], cpack_license_file); + if(!this->WriteLicense(ofs, i + 5000, languages[i], + cpack_license_file, &error)) + { + have_write_license_error = true; + } } else { - WriteLicense(ofs, i + 5000, languages[i]); + if(!this->WriteLicense(ofs, i + 5000, languages[i], "", &error)) + { + have_write_license_error = true; + } } } } ofs.Close(); + if(have_write_license_error) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error writing license file to SLA." << std::endl + << error + << std::endl); + return 0; + } + // convert to UDCO std::string temp_udco = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); temp_udco += "/temp-udco.dmg"; @@ -724,7 +746,6 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, udco_image_command << " -format UDCO"; udco_image_command << " -ov -o \"" << temp_udco << "\""; - std::string error; if(!this->RunCommand(udco_image_command, &error)) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -855,9 +876,10 @@ cmCPackDragNDropGenerator::GetComponentInstallDirNameSuffix( return GetComponentPackageFileName(package_file_name, componentName, false); } -void +bool cmCPackDragNDropGenerator::WriteLicense(cmGeneratedFileStream& outputStream, - int licenseNumber, std::string licenseLanguage, std::string licenseFile) + int licenseNumber, std::string licenseLanguage, std::string licenseFile, + std::string *error) { if(!licenseFile.empty() && !singleLicense) { @@ -881,9 +903,12 @@ cmCPackDragNDropGenerator::WriteLicense(cmGeneratedFileStream& outputStream, std::getline(license_ifs, line); if(!line.empty()) { - EscapeQuotes(line); + EscapeQuotesAndBackslashes(line); std::vector lines; - BreakLongLine(line, lines); + if(!this->BreakLongLine(line, lines, error)) + { + return false; + } for(size_t i = 0; i < lines.size(); ++i) { outputStream << " \"" << lines[i] << "\"\n"; @@ -920,9 +945,12 @@ cmCPackDragNDropGenerator::WriteLicense(cmGeneratedFileStream& outputStream, std::getline(menu_ifs, line); if(!line.empty()) { - EscapeQuotes(line); + EscapeQuotesAndBackslashes(line); std::vector lines; - BreakLongLine(line, lines); + if(!this->BreakLongLine(line, lines, error)) + { + return false; + } for(size_t i = 0; i < lines.size(); ++i) { std::string comma; @@ -949,31 +977,53 @@ cmCPackDragNDropGenerator::WriteLicense(cmGeneratedFileStream& outputStream, outputStream << "};\n"; outputStream << "\n"; } + + return true; } -void +bool cmCPackDragNDropGenerator::BreakLongLine(const std::string& line, - std::vector& lines) + std::vector& lines, std::string *error) { const size_t max_line_length = 512; for(size_t i = 0; i < line.size(); i += max_line_length) { - int line_length = max_line_length; - if(i + max_line_length > line.size()) + size_t line_length = max_line_length; + if(i + line_length > line.size()) { line_length = line.size() - i; } + else while(line_length > 0 && line[i + line_length - 1] != ' ') + { + line_length = line_length - 1; + } + + if(line_length == 0) + { + *error = "Please make sure there are no words " + "(or character sequences not broken up by spaces or newlines) " + "in your license file which are more than 512 characters long."; + return false; + } lines.push_back(line.substr(i, line_length)); } + return true; } void -cmCPackDragNDropGenerator::EscapeQuotes(std::string& line) +cmCPackDragNDropGenerator::EscapeQuotesAndBackslashes(std::string& line) { - std::string::size_type pos = line.find('\"'); - while(pos != std::string::npos) + std::string::size_type backslash_pos = line.find('\\'); + while(backslash_pos != std::string::npos) { - line.replace(pos, 1, "\\\""); - pos = line.find('\"', pos + 2); + line.replace(backslash_pos, 1, "\\\\"); + backslash_pos = line.find('\\', backslash_pos + 2); + } + + std::string::size_type quote_pos = line.find('\"'); + while(quote_pos != std::string::npos) + { + line.replace(quote_pos, 1, "\\\""); + quote_pos = line.find('\"', quote_pos + 2); } } diff --git a/Source/CPack/cmCPackDragNDropGenerator.h b/Source/CPack/cmCPackDragNDropGenerator.h index b5e5ffe6b..604cdf586 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.h +++ b/Source/CPack/cmCPackDragNDropGenerator.h @@ -50,11 +50,13 @@ private: std::string slaDirectory; bool singleLicense; - void WriteLicense(cmGeneratedFileStream& outputStream, int licenseNumber, - std::string licenseLanguage, std::string licenseFile = ""); - void BreakLongLine(const std::string& line, - std::vector& lines); - void EscapeQuotes(std::string& line); + bool WriteLicense(cmGeneratedFileStream& outputStream, int licenseNumber, + std::string licenseLanguage, std::string licenseFile, + std::string *error); + bool BreakLongLine(const std::string& line, + std::vector& lines, + std::string *error); + void EscapeQuotesAndBackslashes(std::string& line); }; #endif diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index a8f983f6f..b6a4819a0 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -609,11 +609,11 @@ int cmCTestTestHandler::ProcessHandler() if ( ftit->Status != cmCTestTestHandler::COMPLETED ) { ofs << ftit->TestCount << ":" << ftit->Name << std::endl; - cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "\t" << std::setw(3) + cmCTestLog(this->CTest, HANDLER_OUTPUT, "\t" << std::setw(3) << ftit->TestCount << " - " << ftit->Name << " (" << this->GetTestStatus(ftit->Status) << ")" - << std::endl, this->Quiet); + << std::endl); } } } diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 66fd18b82..f17de5d50 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -113,12 +113,18 @@ set(SRCS QCMakeCacheView.h QCMakeWidgets.cxx QCMakeWidgets.h + RegexExplorer.cxx + RegexExplorer.h + WarningMessagesDialog.cxx + WarningMessagesDialog.h ) QT4_WRAP_UI(UI_SRCS CMakeSetupDialog.ui Compilers.ui CrossCompiler.ui AddCacheEntry.ui + RegexExplorer.ui + WarningMessagesDialog.ui ) QT4_WRAP_CPP(MOC_SRCS AddCacheEntry.h @@ -128,6 +134,8 @@ QT4_WRAP_CPP(MOC_SRCS QCMake.h QCMakeCacheView.h QCMakeWidgets.h + RegexExplorer.h + WarningMessagesDialog.h ) QT4_ADD_RESOURCES(RC_SRCS CMakeSetup.qrc) @@ -185,7 +193,7 @@ if(UNIX AND NOT APPLE) foreach (size IN ITEMS 32 128) install( FILES "${CMAKE_CURRENT_SOURCE_DIR}/CMakeSetup${size}.png" - DESTINATION "share/icons/hicolor/${size}x${size}/apps" + DESTINATION "${CMAKE_XDGDATA_DIR}/icons/hicolor/${size}x${size}/apps" ${COMPONENT} RENAME "CMakeSetup.png") endforeach () @@ -193,10 +201,10 @@ if(UNIX AND NOT APPLE) # install a desktop file so CMake appears in the application start menu # with an icon install(FILES CMake.desktop - DESTINATION share/applications + DESTINATION "${CMAKE_XDGDATA_DIR}/applications" ${COMPONENT}) install(FILES cmakecache.xml - DESTINATION share/mime/packages + DESTINATION "${CMAKE_XDGDATA_DIR}/mime/packages" ${COMPONENT}) endif() diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index 748dd7d7e..2fc4fafdc 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -33,6 +33,8 @@ #include "QCMakeCacheView.h" #include "AddCacheEntry.h" #include "FirstConfigure.h" +#include "RegexExplorer.h" +#include "WarningMessagesDialog.h" #include "cmSystemTools.h" #include "cmVersion.h" @@ -125,6 +127,9 @@ CMakeSetupDialog::CMakeSetupDialog() this, SLOT(doInstallForCommandLine())); #endif ToolsMenu->addSeparator(); + ToolsMenu->addAction(tr("Regular Expression Explorer..."), + this, SLOT(doRegexExplorerDialog())); + ToolsMenu->addSeparator(); ToolsMenu->addAction(tr("&Find in Output..."), this, SLOT(doOutputFindDialog()), QKeySequence::Find); @@ -141,9 +146,8 @@ CMakeSetupDialog::CMakeSetupDialog() this, SLOT(doOutputErrorNext())); // in Eclipse QMenu* OptionsMenu = this->menuBar()->addMenu(tr("&Options")); - this->SuppressDevWarningsAction = - OptionsMenu->addAction(tr("&Suppress dev Warnings (-Wno-dev)")); - this->SuppressDevWarningsAction->setCheckable(true); + OptionsMenu->addAction(tr("Warning Messages..."), + this, SLOT(doWarningMessagesDialog())); this->WarnUninitializedAction = OptionsMenu->addAction(tr("&Warn Uninitialized (--warn-uninitialized)")); this->WarnUninitializedAction->setCheckable(true); @@ -274,9 +278,6 @@ void CMakeSetupDialog::initialize() QObject::connect(this->AddEntry, SIGNAL(clicked(bool)), this, SLOT(addCacheEntry())); - QObject::connect(this->SuppressDevWarningsAction, SIGNAL(triggered(bool)), - this->CMakeThread->cmakeInstance(), SLOT(setSuppressDevWarnings(bool))); - QObject::connect(this->WarnUninitializedAction, SIGNAL(triggered(bool)), this->CMakeThread->cmakeInstance(), SLOT(setWarnUninitializedMode(bool))); @@ -1272,6 +1273,12 @@ void CMakeSetupDialog::doOutputFindDialog() } } +void CMakeSetupDialog::doRegexExplorerDialog() +{ + RegexExplorer dialog(this); + dialog.exec(); +} + void CMakeSetupDialog::doOutputFindPrev() { doOutputFindNext(false); @@ -1359,3 +1366,9 @@ void CMakeSetupDialog::doOutputErrorNext() this->Output->setTextCursor(textCursor); } } + +void CMakeSetupDialog::doWarningMessagesDialog() +{ + WarningMessagesDialog dialog(this, this->CMakeThread->cmakeInstance()); + dialog.exec(); +} diff --git a/Source/QtDialog/CMakeSetupDialog.h b/Source/QtDialog/CMakeSetupDialog.h index 1b26c648c..4b53b1cbd 100644 --- a/Source/QtDialog/CMakeSetupDialog.h +++ b/Source/QtDialog/CMakeSetupDialog.h @@ -82,6 +82,9 @@ protected slots: void doOutputFindNext(bool directionForward = true); void doOutputFindPrev(); void doOutputErrorNext(); + void doRegexExplorerDialog(); + /// display the modal warning messages dialog window + void doWarningMessagesDialog(); protected: @@ -101,7 +104,6 @@ protected: QAction* ExitAction; QAction* ConfigureAction; QAction* GenerateAction; - QAction* SuppressDevWarningsAction; QAction* WarnUninitializedAction; QAction* WarnUnusedAction; QAction* InstallForCommandLineAction; diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 1fcb67676..dd7c1387a 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -26,7 +26,6 @@ QCMake::QCMake(QObject* p) : QObject(p) { - this->SuppressDevWarnings = false; this->WarnUninitializedMode = false; this->WarnUnusedMode = false; qRegisterMetaType(); @@ -167,7 +166,6 @@ void QCMake::configure() this->CMakeInstance->SetGeneratorPlatform(""); this->CMakeInstance->SetGeneratorToolset(this->Toolset.toLocal8Bit().data()); this->CMakeInstance->LoadCache(); - this->CMakeInstance->SetSuppressDevWarnings(this->SuppressDevWarnings); this->CMakeInstance->SetWarnUninitialized(this->WarnUninitializedMode); this->CMakeInstance->SetWarnUnused(this->WarnUnusedMode); this->CMakeInstance->PreLoadCMakeFiles(); @@ -457,10 +455,44 @@ bool QCMake::getDebugOutput() const return this->CMakeInstance->GetDebugOutput(); } +bool QCMake::getSuppressDevWarnings() +{ + return this->CMakeInstance->GetSuppressDevWarnings(); +} void QCMake::setSuppressDevWarnings(bool value) { - this->SuppressDevWarnings = value; + this->CMakeInstance->SetSuppressDevWarnings(value); +} + +bool QCMake::getSuppressDeprecatedWarnings() +{ + return this->CMakeInstance->GetSuppressDeprecatedWarnings(); +} + +void QCMake::setSuppressDeprecatedWarnings(bool value) +{ + this->CMakeInstance->SetSuppressDeprecatedWarnings(value); +} + +bool QCMake::getDevWarningsAsErrors() +{ + return this->CMakeInstance->GetDevWarningsAsErrors(); +} + +void QCMake::setDevWarningsAsErrors(bool value) +{ + this->CMakeInstance->SetDevWarningsAsErrors(value); +} + +bool QCMake::getDeprecatedWarningsAsErrors() +{ + return this->CMakeInstance->GetDeprecatedWarningsAsErrors(); +} + +void QCMake::setDeprecatedWarningsAsErrors(bool value) +{ + this->CMakeInstance->SetDeprecatedWarningsAsErrors(value); } void QCMake::setWarnUninitializedMode(bool value) diff --git a/Source/QtDialog/QCMake.h b/Source/QtDialog/QCMake.h index 2d45da965..8942e7c90 100644 --- a/Source/QtDialog/QCMake.h +++ b/Source/QtDialog/QCMake.h @@ -91,8 +91,22 @@ public slots: void reloadCache(); /// set whether to do debug output void setDebugOutput(bool); + /// get whether to do suppress dev warnings + bool getSuppressDevWarnings(); /// set whether to do suppress dev warnings void setSuppressDevWarnings(bool value); + /// get whether to do suppress deprecated warnings + bool getSuppressDeprecatedWarnings(); + /// set whether to do suppress deprecated warnings + void setSuppressDeprecatedWarnings(bool value); + /// get whether to treat developer (author) warnings as errors + bool getDevWarningsAsErrors(); + /// set whether to treat developer (author) warnings as errors + void setDevWarningsAsErrors(bool value); + /// get whether to treat deprecated warnings as errors + bool getDeprecatedWarningsAsErrors(); + /// set whether to treat deprecated warnings as errors + void setDeprecatedWarningsAsErrors(bool value); /// set whether to run cmake with warnings about uninitialized variables void setWarnUninitializedMode(bool value); /// set whether to run cmake with warnings about unused variables @@ -146,7 +160,6 @@ protected: bool&, void* cd); static void stdoutCallback(const char* msg, size_t len, void* cd); static void stderrCallback(const char* msg, size_t len, void* cd); - bool SuppressDevWarnings; bool WarnUninitializedMode; bool WarnUnusedMode; bool WarnUnusedAllMode; diff --git a/Source/QtDialog/RegexExplorer.cxx b/Source/QtDialog/RegexExplorer.cxx new file mode 100644 index 000000000..dfcf048d1 --- /dev/null +++ b/Source/QtDialog/RegexExplorer.cxx @@ -0,0 +1,166 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Kitware, Inc., Gregor Jasny + + 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 "RegexExplorer.h" + +RegexExplorer::RegexExplorer(QWidget* p) : QDialog(p), m_matched(false) +{ + this->setupUi(this); + + for(int i = 1; i < cmsys::RegularExpression::NSUBEXP; ++i) + { + matchNumber->addItem( + QString("Match %1").arg(QString::number(i)), + QVariant(i)); + } + matchNumber->setCurrentIndex(0); +} + +void RegexExplorer::setStatusColor(QWidget* widget, bool successful) +{ + QColor color = successful ? QColor(0, 127, 0) : Qt::red; + + QPalette palette = widget->palette(); + palette.setColor(QPalette::Foreground, color); + widget->setPalette(palette); +} + +void RegexExplorer::on_regularExpression_textChanged(const QString& text) +{ +#ifdef QT_NO_STL + m_regex = text.toAscii().constData(); +#else + m_regex = text.toStdString(); +#endif + + bool validExpression = + stripEscapes(m_regex) && m_regexParser.compile(m_regex); + if(!validExpression) + { + m_regexParser.set_invalid(); + } + + setStatusColor(labelRegexValid, validExpression); + + on_inputText_textChanged(); +} + +void RegexExplorer::on_inputText_textChanged() +{ + if(m_regexParser.is_valid()) + { + QString plainText = inputText->toPlainText(); +#ifdef QT_NO_STL + m_text = plainText.toAscii().constData(); +#else + m_text = plainText.toStdString(); +#endif + m_matched = m_regexParser.find(m_text); + } + else + { + m_matched = false; + } + + setStatusColor(labelRegexMatch, m_matched); + + if(!m_matched) + { + clearMatch(); + return; + } + +#ifdef QT_NO_STL + QString matchText = m_regexParser.match(0).c_str(); +#else + QString matchText = QString::fromStdString(m_regexParser.match(0)); +#endif + match0->setPlainText(matchText); + + on_matchNumber_currentIndexChanged(matchNumber->currentIndex()); +} + +void RegexExplorer::on_matchNumber_currentIndexChanged(int index) +{ + if(!m_matched) + { + return; + } + + QVariant itemData = matchNumber->itemData(index); + int idx = itemData.toInt(); + + if(idx < 1 || idx >= cmsys::RegularExpression::NSUBEXP) + { + return; + } + +#ifdef QT_NO_STL + QString match = m_regexParser.match(idx).c_str(); +#else + QString match = QString::fromStdString(m_regexParser.match(idx)); +#endif + matchN->setPlainText(match); +} + +void RegexExplorer::clearMatch() +{ + match0->clear(); + matchN->clear(); +} + +bool RegexExplorer::stripEscapes(std::string& source) +{ + const char* in = source.c_str(); + + std::string result; + result.reserve(source.size()); + + for(char inc = *in; inc != '\0'; inc = *++in) + { + if(inc == '\\') + { + char nextc = in[1]; + if(nextc == 't') + { + result.append(1, '\t'); + in++; + } + else if(nextc == 'n') + { + result.append(1, '\n'); + in++; + } + else if(nextc == 't') + { + result.append(1, '\t'); + in++; + } + else if(isalnum(nextc) || nextc == '\0') + { + return false; + } + else + { + result.append(1, nextc); + in++; + } + } + else + { + result.append(1, inc); + } + } + + source = result; + return true; +} diff --git a/Source/QtDialog/RegexExplorer.h b/Source/QtDialog/RegexExplorer.h new file mode 100644 index 000000000..2ac9c3e2e --- /dev/null +++ b/Source/QtDialog/RegexExplorer.h @@ -0,0 +1,48 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Kitware, Inc., Gregor Jasny + + 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 RegexExplorer_h +#define RegexExplorer_h + +#include +#include +#include + +#include "ui_RegexExplorer.h" + +class QString; +class QWidget; + +class RegexExplorer : public QDialog, public Ui::RegexExplorer +{ + Q_OBJECT +public: + RegexExplorer(QWidget* p); + +private slots: + void on_regularExpression_textChanged(const QString& text); + void on_inputText_textChanged(); + void on_matchNumber_currentIndexChanged(int index); + +private: + static void setStatusColor(QWidget* widget, bool successful); + static bool stripEscapes(std::string& regex); + + void clearMatch(); + + cmsys::RegularExpression m_regexParser; + std::string m_text; + std::string m_regex; + bool m_matched; +}; + +#endif diff --git a/Source/QtDialog/RegexExplorer.ui b/Source/QtDialog/RegexExplorer.ui new file mode 100644 index 000000000..2c2d7616f --- /dev/null +++ b/Source/QtDialog/RegexExplorer.ui @@ -0,0 +1,155 @@ + + + RegexExplorer + + + + 0 + 0 + 639 + 555 + + + + Regular Expression Explorer + + + + + + Input Text + + + + + + + + + + + + Regular Expression + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + Valid + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + Match + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + Complete Match + + + + + + + true + + + + + + + + + false + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + true + + + + + + + + diff --git a/Source/QtDialog/WarningMessagesDialog.cxx b/Source/QtDialog/WarningMessagesDialog.cxx new file mode 100644 index 000000000..4bd541f3e --- /dev/null +++ b/Source/QtDialog/WarningMessagesDialog.cxx @@ -0,0 +1,99 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Kitware, Inc., Gregor Jasny + + 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 "WarningMessagesDialog.h" + +WarningMessagesDialog::WarningMessagesDialog(QWidget* prnt, QCMake* instance) + : QDialog(prnt), cmakeInstance(instance) +{ + this->setupUi(this); + this->setInitialValues(); + this->setupSignals(); +} + +void WarningMessagesDialog::setInitialValues() +{ + this->suppressDeveloperWarnings->setChecked( + this->cmakeInstance->getSuppressDevWarnings()); + this->suppressDeprecatedWarnings->setChecked( + this->cmakeInstance->getSuppressDeprecatedWarnings()); + + this->developerWarningsAsErrors->setChecked( + this->cmakeInstance->getDevWarningsAsErrors()); + this->deprecatedWarningsAsErrors->setChecked( + this->cmakeInstance->getDeprecatedWarningsAsErrors()); +} + +void WarningMessagesDialog::setupSignals() +{ + QObject::connect(this->buttonBox, SIGNAL(accepted()), + this, SLOT(doAccept())); + + QObject::connect(this->suppressDeveloperWarnings, SIGNAL(stateChanged(int)), + this, SLOT(doSuppressDeveloperWarningsChanged(int))); + QObject::connect(this->suppressDeprecatedWarnings, SIGNAL(stateChanged(int)), + this, SLOT(doSuppressDeprecatedWarningsChanged(int))); + + QObject::connect(this->developerWarningsAsErrors, SIGNAL(stateChanged(int)), + this, SLOT(doDeveloperWarningsAsErrorsChanged(int))); + QObject::connect(this->deprecatedWarningsAsErrors, SIGNAL(stateChanged(int)), + this, SLOT(doDeprecatedWarningsAsErrorsChanged(int))); +} + +void WarningMessagesDialog::doAccept() +{ + this->cmakeInstance->setSuppressDevWarnings( + this->suppressDeveloperWarnings->isChecked()); + this->cmakeInstance->setSuppressDeprecatedWarnings( + this->suppressDeprecatedWarnings->isChecked()); + + this->cmakeInstance->setDevWarningsAsErrors( + this->developerWarningsAsErrors->isChecked()); + this->cmakeInstance->setDeprecatedWarningsAsErrors( + this->deprecatedWarningsAsErrors->isChecked()); +} + +void WarningMessagesDialog::doSuppressDeveloperWarningsChanged(int state) +{ + // no warnings implies no errors either + if (state) + { + this->developerWarningsAsErrors->setChecked(false); + } +} + +void WarningMessagesDialog::doSuppressDeprecatedWarningsChanged(int state) +{ + // no warnings implies no errors either + if (state) + { + this->deprecatedWarningsAsErrors->setChecked(false); + } +} + +void WarningMessagesDialog::doDeveloperWarningsAsErrorsChanged(int state) +{ + // warnings as errors implies warnings are not suppressed + if (state) + { + this->suppressDeveloperWarnings->setChecked(false); + } +} + +void WarningMessagesDialog::doDeprecatedWarningsAsErrorsChanged(int state) +{ + // warnings as errors implies warnings are not suppressed + if (state) + { + this->suppressDeprecatedWarnings->setChecked(false); + } +} diff --git a/Source/QtDialog/WarningMessagesDialog.h b/Source/QtDialog/WarningMessagesDialog.h new file mode 100644 index 000000000..6c274a71d --- /dev/null +++ b/Source/QtDialog/WarningMessagesDialog.h @@ -0,0 +1,75 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Kitware, Inc., Gregor Jasny + + 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 WarningMessagesDialog_h +#define WarningMessagesDialog_h + +#include +#include + +#include "ui_WarningMessagesDialog.h" +#include "QCMake.h" + +/** + * Dialog window for setting the warning message related options. + */ +class WarningMessagesDialog : public QDialog, public Ui_MessagesDialog +{ + Q_OBJECT + +public: + WarningMessagesDialog(QWidget* prnt, QCMake* instance); + +private slots: + /** + * Handler for the accept event of the ok/cancel button box. + */ + void doAccept(); + + /** + * Handler for checked state changed event of the suppress developer warnings + * checkbox. + */ + void doSuppressDeveloperWarningsChanged(int state); + /** + * Handler for checked state changed event of the suppress deprecated + * warnings checkbox. + */ + void doSuppressDeprecatedWarningsChanged(int state); + + /** + * Handler for checked state changed event of the developer warnings as + * errors checkbox. + */ + void doDeveloperWarningsAsErrorsChanged(int state); + /** + * Handler for checked state changed event of the deprecated warnings as + * errors checkbox. + */ + void doDeprecatedWarningsAsErrorsChanged(int state); + +private: + QCMake* cmakeInstance; + + /** + * Set the initial values of the widgets on this dialog window, using the + * current state of the cache. + */ + void setInitialValues(); + + /** + * Setup the signals for the widgets on this dialog window. + */ + void setupSignals(); +}; + +#endif /* MessageDialog_h */ diff --git a/Source/QtDialog/WarningMessagesDialog.ui b/Source/QtDialog/WarningMessagesDialog.ui new file mode 100644 index 000000000..3b35cbc67 --- /dev/null +++ b/Source/QtDialog/WarningMessagesDialog.ui @@ -0,0 +1,173 @@ + + + MessagesDialog + + + + 0 + 0 + 300 + 300 + + + + Warning Messages + + + true + + + + + + + 0 + 0 + + + + Suppress Warnings + + + + + + + 0 + 0 + + + + Suppress developer (author) warnings. + + + Developer Warnings + + + false + + + + + + + + 0 + 0 + + + + Suppress deprecated warnings. + + + Deprecated Warnings + + + false + + + + + + + + + + + 0 + 0 + + + + Warnings as Errors + + + + + + + 0 + 0 + + + + Treat developer (author) warnings as errors. + + + Developer Warnings as Errors + + + + + + + + 0 + 0 + + + + Treat deprecated warnings as errors. + + + Deprecated Warnings as Errors + + + + + + + + + + + 0 + 0 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + MessagesDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + MessagesDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index bda933bc3..bb65ea556 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -52,13 +52,13 @@ template size_t cmArraySize(const T (&)[N]) { return N; } template -bool cmHasLiteralPrefix(T str1, const char (&str2)[N]) +bool cmHasLiteralPrefix(const T& str1, const char (&str2)[N]) { return cmHasLiteralPrefixImpl(str1, str2, N - 1); } template -bool cmHasLiteralSuffix(T str1, const char (&str2)[N]) +bool cmHasLiteralSuffix(const T& str1, const char (&str2)[N]) { return cmHasLiteralSuffixImpl(str1, str2, N - 1); } @@ -162,13 +162,13 @@ struct cmRange const_iterator end() const { return End; } bool empty() const { return std::distance(Begin, End) == 0; } difference_type size() const { return std::distance(Begin, End); } - cmRange& advance(cmIML_INT_intptr_t amount) + cmRange& advance(KWIML_INT_intptr_t amount) { std::advance(Begin, amount); return *this; } - cmRange& retreat(cmIML_INT_intptr_t amount) + cmRange& retreat(KWIML_INT_intptr_t amount) { std::advance(End, -amount); return *this; @@ -230,7 +230,7 @@ template std::string cmJoin(Range const& r, std::string delimiter) { return cmJoin(r, delimiter.c_str()); -}; +} template typename Range::const_iterator cmRemoveN(Range& r, size_t n) diff --git a/Source/cmBootstrapCommands1.cxx b/Source/cmBootstrapCommands1.cxx index 118451432..0782b3ba7 100644 --- a/Source/cmBootstrapCommands1.cxx +++ b/Source/cmBootstrapCommands1.cxx @@ -54,6 +54,7 @@ #include "cmFunctionCommand.cxx" #include "cmPathLabel.cxx" #include "cmSearchPath.cxx" +#include "cmParseArgumentsCommand.cxx" void GetBootstrapCommands1(std::vector& commands) { @@ -91,4 +92,5 @@ void GetBootstrapCommands1(std::vector& commands) commands.push_back(new cmFindProgramCommand); commands.push_back(new cmForEachCommand); commands.push_back(new cmFunctionCommand); + commands.push_back(new cmParseArgumentsCommand); } diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index ce8af55db..7466c299a 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -64,12 +64,14 @@ bool cmCacheManager::LoadCache(const std::string& path, const char *realbuffer; std::string buffer; std::string entryKey; + unsigned int lineno = 0; while(fin) { // Format is key:type=value std::string helpString; CacheEntry e; cmSystemTools::GetLineFromStream(fin, buffer); + lineno++; realbuffer = buffer.c_str(); while(*realbuffer != '0' && (*realbuffer == ' ' || @@ -77,6 +79,7 @@ bool cmCacheManager::LoadCache(const std::string& path, *realbuffer == '\r' || *realbuffer == '\n')) { + if (*realbuffer == '\n') lineno++; realbuffer++; } // skip blank lines and comment lines @@ -96,6 +99,7 @@ bool cmCacheManager::LoadCache(const std::string& path, helpString += &realbuffer[2]; } cmSystemTools::GetLineFromStream(fin, buffer); + lineno++; realbuffer = buffer.c_str(); if(!fin) { @@ -138,8 +142,10 @@ bool cmCacheManager::LoadCache(const std::string& path, } else { - cmSystemTools::Error("Parse error in cache file ", cacheFile.c_str(), - ". Offending entry: ", realbuffer); + std::ostringstream error; + error << "Parse error in cache file " << cacheFile; + error << " on line " << lineno << ". Offending entry: " << realbuffer; + cmSystemTools::Error(error.str().c_str()); } } this->CacheMajorVersion = 0; diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx index 5330acdaf..6a0ebec2d 100644 --- a/Source/cmConditionEvaluator.cxx +++ b/Source/cmConditionEvaluator.cxx @@ -12,6 +12,7 @@ #include "cmConditionEvaluator.h" #include "cmOutputConverter.h" +#include "cmAlgorithms.h" cmConditionEvaluator::cmConditionEvaluator(cmMakefile& makefile, const cmListFileContext &context, @@ -578,6 +579,7 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList &newArgs, cmake::MessageType &status) { int reducible; + std::string def_buf; const char *def; const char *def2; do @@ -594,6 +596,14 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList &newArgs, IsKeyword("MATCHES", *argP1)) { def = this->GetVariableOrString(*arg); + if (def != arg->c_str() // yes, we compare the pointer value + && cmHasLiteralPrefix(arg->GetValue(), "CMAKE_MATCH_")) + { + // The string to match is owned by our match result variables. + // Move it to our own buffer before clearing them. + def_buf = def; + def = def_buf.c_str(); + } const char* rex = argP2->c_str(); this->Makefile.ClearMatches(); cmsys::RegularExpression regEntry; diff --git a/Source/cmCurl.cxx b/Source/cmCurl.cxx index ad0c7d3e2..4f3d89083 100644 --- a/Source/cmCurl.cxx +++ b/Source/cmCurl.cxx @@ -12,6 +12,11 @@ #include "cmCurl.h" #include "cmSystemTools.h" +// curl versions before 7.21.5 did not provide this error code +#if defined(LIBCURL_VERSION_NUM) && LIBCURL_VERSION_NUM < 0x071505 +# define CURLE_NOT_BUILT_IN 4 +#endif + #define check_curl_result(result, errstr) \ if (result != CURLE_OK && result != CURLE_NOT_BUILT_IN) \ { \ diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx index 37dd328db..b480cd53b 100644 --- a/Source/cmELF.cxx +++ b/Source/cmELF.cxx @@ -15,10 +15,6 @@ #include #include -// Need the native byte order of the running CPU. -#define cmsys_CPU_UNKNOWN_OKAY // We can decide at runtime if not known. -#include - // Include the ELF format information system header. #if defined(__OpenBSD__) # include @@ -102,9 +98,9 @@ public: // In most cases the processor-specific byte order will match that // of the target execution environment. If we choose wrong here // it is fixed when the header is read. -#if cmsys_CPU_ENDIAN_ID == cmsys_CPU_ENDIAN_ID_LITTLE +#if KWIML_ABI_ENDIAN_ID == KWIML_ABI_ENDIAN_ID_LITTLE this->NeedSwap = (this->ByteOrder == ByteOrderMSB); -#elif cmsys_CPU_ENDIAN_ID == cmsys_CPU_ENDIAN_ID_BIG +#elif KWIML_ABI_ENDIAN_ID == KWIML_ABI_ENDIAN_ID_BIG this->NeedSwap = (this->ByteOrder == ByteOrderLSB); #else this->NeedSwap = false; // Final decision is at runtime anyway. @@ -198,7 +194,7 @@ struct cmELFTypes32 typedef Elf32_Shdr ELF_Shdr; typedef Elf32_Dyn ELF_Dyn; typedef Elf32_Half ELF_Half; - typedef cmIML_INT_uint32_t tagtype; + typedef KWIML_INT_uint32_t tagtype; static const char* GetName() { return "32-bit"; } }; @@ -209,7 +205,7 @@ struct cmELFTypes64 typedef Elf64_Shdr ELF_Shdr; typedef Elf64_Dyn ELF_Dyn; typedef Elf64_Half ELF_Half; - typedef cmIML_INT_uint64_t tagtype; + typedef KWIML_INT_uint64_t tagtype; static const char* GetName() { return "64-bit"; } }; diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index e8a2e6a52..c005995f7 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -772,6 +772,27 @@ cmExportFileGenerator::ResolveTargetsInGeneratorExpression( lastPos = endPos; } + pos = 0; + lastPos = pos; + while (errorString.empty() && + (pos = input.find("$", nameStartPos); + if (endPos == input.npos) + { + errorString = "$ expression incomplete"; + break; + } + std::string libName = input.substr(nameStartPos, endPos - nameStartPos); + if (cmGeneratorExpression::IsValidTargetName(libName) && + this->AddTargetNamespace(libName, target, missingTargets)) + { + input.replace(nameStartPos, endPos - nameStartPos, libName); + } + lastPos = nameStartPos + libName.size() + 1; + } + this->ReplaceInstallPrefix(input); if (!errorString.empty()) diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index b695904f8..71418e825 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -496,7 +496,7 @@ cmExportInstallFileGenerator bool containsTarget = false; for(unsigned int i=0; isize(); i++) { - if (name == (*targets)[i]->Target->GetName()) + if (name == (*targets)[i]->TargetName) { containsTarget = true; break; diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index df95d9dd6..b3557f9a2 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -2811,8 +2811,8 @@ namespace { case CURLINFO_SSL_DATA_OUT: { char buf[128]; - int n = sprintf(buf, "[%" cmIML_INT_PRIu64 " bytes data]\n", - static_cast(size)); + int n = sprintf(buf, "[%" KWIML_INT_PRIu64 " bytes data]\n", + static_cast(size)); if (n > 0) { vec->insert(vec->end(), buf, buf + n); diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h index 3eee40421..8bfd4051e 100644 --- a/Source/cmFindPackageCommand.h +++ b/Source/cmFindPackageCommand.h @@ -130,7 +130,7 @@ private: unsigned int VersionFoundPatch; unsigned int VersionFoundTweak; unsigned int VersionFoundCount; - cmIML_INT_uint64_t RequiredCMakeVersion; + KWIML_INT_uint64_t RequiredCMakeVersion; bool Quiet; bool Required; bool UseConfigFiles; diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index cc424b473..ff12320bf 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -335,7 +335,7 @@ cmState::TargetType cmGeneratorTarget::GetType() const } //---------------------------------------------------------------------------- -std::string cmGeneratorTarget::GetName() const +const std::string& cmGeneratorTarget::GetName() const { return this->Target->GetName(); } @@ -3752,7 +3752,11 @@ void cmGeneratorTarget::ConstructSourceFileFlags() const if(cmSourceFile* sf = this->Makefile->GetSource(*it)) { SourceFileFlags& flags = this->SourceFlagsMap[sf]; - flags.MacFolder = "Resources"; + flags.MacFolder = ""; + if(!this->Makefile->PlatformIsAppleIos()) + { + flags.MacFolder = "Resources"; + } flags.Type = cmGeneratorTarget::SourceFileTypeResource; } } diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index bd2347707..d96a32c55 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -55,7 +55,7 @@ public: GetLinkInformation(const std::string& config) const; cmState::TargetType GetType() const; - std::string GetName() const; + const std::string& GetName() const; std::string GetExportName() const; std::vector GetPropertyKeys() const; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 2126c7180..848028ff3 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -86,6 +86,13 @@ cmGlobalGenerator::cmGlobalGenerator(cmake* cm) this->TryCompileOuterMakefile = 0; this->ConfigureDoneCMP0026AndCMP0024 = false; + + cm->GetState()->SetMinGWMake(false); + cm->GetState()->SetMSYSShell(false); + cm->GetState()->SetNMake(false); + cm->GetState()->SetWatcomWMake(false); + cm->GetState()->SetWindowsShell(false); + cm->GetState()->SetWindowsVSIDE(false); } cmGlobalGenerator::~cmGlobalGenerator() @@ -1649,6 +1656,8 @@ void cmGlobalGenerator::ClearGeneratorMembers() this->ExportSets.clear(); this->TargetDependencies.clear(); + this->TargetSearchIndex.clear(); + this->GeneratorTargetSearchIndex.clear(); this->ProjectMap.clear(); this->RuleHashes.clear(); this->DirectoryContentMap.clear(); @@ -1850,7 +1859,7 @@ int cmGlobalGenerator::Build( !makeCommand.empty() && cmSystemTools::LowerCase( cmSystemTools::GetFilenameName(makeCommand[0])) == "vcexpress.exe") { - outputflag = cmSystemTools::OUTPUT_NORMAL; + outputflag = cmSystemTools::OUTPUT_FORWARD; } // should we do a clean first? @@ -2177,18 +2186,28 @@ bool cmGlobalGenerator::IsAlias(const std::string& name) const return this->AliasTargets.find(name) != this->AliasTargets.end(); } +void cmGlobalGenerator::IndexTarget(cmTarget* t) +{ + if (!t->IsImported() || t->IsImportedGloballyVisible()) + { + this->TargetSearchIndex[t->GetName()] = t; + } +} + +void cmGlobalGenerator::IndexGeneratorTarget(cmGeneratorTarget* gt) +{ + if (!gt->IsImported() || gt->IsImportedGloballyVisible()) + { + this->GeneratorTargetSearchIndex[gt->GetName()] = gt; + } +} + cmTarget* cmGlobalGenerator::FindTargetImpl(std::string const& name) const { - for (unsigned int i = 0; i < this->Makefiles.size(); ++i) + TargetMap::const_iterator i = this->TargetSearchIndex.find(name); + if (i != this->TargetSearchIndex.end()) { - cmTargets& tgts = this->Makefiles[i]->GetTargets(); - for (cmTargets::iterator it = tgts.begin(); it != tgts.end(); ++it) - { - if (it->second.GetName() == name) - { - return &it->second; - } - } + return i->second; } return 0; } @@ -2196,56 +2215,11 @@ cmTarget* cmGlobalGenerator::FindTargetImpl(std::string const& name) const cmGeneratorTarget* cmGlobalGenerator::FindGeneratorTargetImpl(std::string const& name) const { - for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) + GeneratorTargetMap::const_iterator i = + this->GeneratorTargetSearchIndex.find(name); + if (i != this->GeneratorTargetSearchIndex.end()) { - std::vector tgts = - this->LocalGenerators[i]->GetGeneratorTargets(); - for (std::vector::iterator it = tgts.begin(); - it != tgts.end(); ++it) - { - if ((*it)->GetName() == name) - { - return *it; - } - } - } - return 0; -} - -cmTarget* -cmGlobalGenerator::FindImportedTargetImpl(std::string const& name) const -{ - for (unsigned int i = 0; i < this->Makefiles.size(); ++i) - { - std::vector tgts = - this->Makefiles[i]->GetOwnedImportedTargets(); - for (std::vector::iterator it = tgts.begin(); - it != tgts.end(); ++it) - { - if ((*it)->GetName() == name && (*it)->IsImportedGloballyVisible()) - { - return *it; - } - } - } - return 0; -} - -cmGeneratorTarget* cmGlobalGenerator::FindImportedGeneratorTargetImpl( - std::string const& name) const -{ - for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) - { - std::vector tgts = - this->LocalGenerators[i]->GetImportedGeneratorTargets(); - for (std::vector::iterator it = tgts.begin(); - it != tgts.end(); ++it) - { - if ((*it)->IsImportedGloballyVisible() && (*it)->GetName() == name) - { - return *it; - } - } + return i->second; } return 0; } @@ -2264,11 +2238,7 @@ cmGlobalGenerator::FindTarget(const std::string& name, return this->FindTargetImpl(ai->second); } } - if (cmTarget* tgt = this->FindTargetImpl(name)) - { - return tgt; - } - return this->FindImportedTargetImpl(name); + return this->FindTargetImpl(name); } cmGeneratorTarget* @@ -2280,11 +2250,7 @@ cmGlobalGenerator::FindGeneratorTarget(const std::string& name) const { return this->FindGeneratorTargetImpl(ai->second); } - if (cmGeneratorTarget* tgt = this->FindGeneratorTargetImpl(name)) - { - return tgt; - } - return this->FindImportedGeneratorTargetImpl(name); + return this->FindGeneratorTargetImpl(name); } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index bc6e17d7f..48fa70406 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -278,6 +278,9 @@ public: std::set const& GetDirectoryContent(std::string const& dir, bool needDisk = true); + void IndexTarget(cmTarget* t); + void IndexGeneratorTarget(cmGeneratorTarget* gt); + static bool IsReservedTarget(std::string const& name); virtual const char* GetAllTargetName() const { return "ALL_BUILD"; } @@ -420,7 +423,6 @@ protected: std::map AliasTargets; cmTarget* FindTargetImpl(std::string const& name) const; - cmTarget* FindImportedTargetImpl(std::string const& name) const; cmGeneratorTarget* FindGeneratorTargetImpl(std::string const& name) const; cmGeneratorTarget* @@ -430,6 +432,26 @@ protected: virtual bool UseFolderProperty(); private: + +#if defined(CMAKE_BUILD_WITH_CMAKE) +# ifdef CMake_HAVE_CXX11_UNORDERED_MAP + typedef std::unordered_map TargetMap; + typedef std::unordered_map + GeneratorTargetMap; +# else + typedef cmsys::hash_map TargetMap; + typedef cmsys::hash_map GeneratorTargetMap; +# endif +#else + typedef std::map TargetMap; + typedef std::map GeneratorTargetMap; +#endif + // Map efficiently from target name to cmTarget instance. + // Do not use this structure for looping over all targets. + // It contains both normal and globally visible imported targets. + TargetMap TargetSearchIndex; + GeneratorTargetMap GeneratorTargetSearchIndex; + cmMakefile* TryCompileOuterMakefile; // If you add a new map here, make sure it is copied // in EnableLanguagesFromGenerator diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index a05ac24b5..c058f8ce4 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -117,7 +117,7 @@ bool cmGlobalVisualStudio14Generator::InitializeWindows(cmMakefile* mf) { if (cmHasLiteralPrefix(this->SystemVersion, "10.0")) { - return this->SelectWindows10SDK(mf); + return this->SelectWindows10SDK(mf, false); } return true; } @@ -145,17 +145,18 @@ bool cmGlobalVisualStudio14Generator::InitializeWindowsStore(cmMakefile* mf) } if (cmHasLiteralPrefix(this->SystemVersion, "10.0")) { - return this->SelectWindows10SDK(mf); + return this->SelectWindows10SDK(mf, true); } return true; } //---------------------------------------------------------------------------- -bool cmGlobalVisualStudio14Generator::SelectWindows10SDK(cmMakefile* mf) +bool cmGlobalVisualStudio14Generator::SelectWindows10SDK(cmMakefile* mf, + bool required) { // Find the default version of the Windows 10 SDK. this->WindowsTargetPlatformVersion = this->GetWindows10SDKVersion(); - if (this->WindowsTargetPlatformVersion.empty()) + if (required && this->WindowsTargetPlatformVersion.empty()) { std::ostringstream e; e << "Could not find an appropriate version of the Windows 10 SDK" @@ -231,6 +232,16 @@ cmGlobalVisualStudio14Generator::IsWindowsStoreToolsetInstalled() const win10SDK, cmSystemTools::KeyWOW64_32); } +#if defined(_WIN32) && !defined(__CYGWIN__) +struct NoWindowsH +{ + bool operator()(std::string const& p) + { + return !cmSystemTools::FileExists(p + "/um/windows.h", true); + } +}; +#endif + //---------------------------------------------------------------------------- std::string cmGlobalVisualStudio14Generator::GetWindows10SDKVersion() { @@ -254,6 +265,12 @@ std::string cmGlobalVisualStudio14Generator::GetWindows10SDKVersion() std::string path = win10Root + "Include/*"; // Grab the paths of the different SDKs that are installed cmSystemTools::GlobDirs(path, sdks); + + // Skip SDKs that do not contain because that indicates that + // only the UCRT MSIs were installed for them. + sdks.erase(std::remove_if(sdks.begin(), sdks.end(), NoWindowsH()), + sdks.end()); + if (!sdks.empty()) { // Only use the filename, which will be the SDK version. @@ -263,29 +280,21 @@ std::string cmGlobalVisualStudio14Generator::GetWindows10SDKVersion() *i = cmSystemTools::GetFilenameName(*i); } - // Sort the results to make sure we select the most recent one that - // has a version less or equal to our version of the operating system + // Sort the results to make sure we select the most recent one. std::sort(sdks.begin(), sdks.end(), cmSystemTools::VersionCompareGreater); - // Select a suitable SDK version. - if (this->SystemVersion == "10.0") + // Look for a SDK exactly matching the requested target version. + for (std::vector::iterator i = sdks.begin(); + i != sdks.end(); ++i) { - // Use the latest Windows 10 SDK since no build version was given. - return sdks.at(0); - } - else - { - // Find the SDK less or equal to our specified version - for (std::vector::iterator i = sdks.begin(); - i != sdks.end(); ++i) + if (cmSystemTools::VersionCompareEqual(*i, this->SystemVersion)) { - if (!cmSystemTools::VersionCompareGreater(*i, this->SystemVersion)) - { - // This is the most recent SDK that we can run safely - return *i; - } + return *i; } } + + // Use the latest Windows 10 SDK since the exact version is not available. + return sdks.at(0); } #endif // Return an empty string diff --git a/Source/cmGlobalVisualStudio14Generator.h b/Source/cmGlobalVisualStudio14Generator.h index 76c15d99c..57e628418 100644 --- a/Source/cmGlobalVisualStudio14Generator.h +++ b/Source/cmGlobalVisualStudio14Generator.h @@ -39,7 +39,7 @@ protected: bool IsWindowsStoreToolsetInstalled() const; virtual const char* GetIDEVersion() { return "14.0"; } - virtual bool SelectWindows10SDK(cmMakefile* mf); + virtual bool SelectWindows10SDK(cmMakefile* mf, bool required); // Used to verify that the Desktop toolset for the current generator is // installed on the machine. diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 475efa8b6..526e32f98 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -709,6 +709,15 @@ cmXCodeObject* cmGlobalXCodeGenerator return obj; } +//---------------------------------------------------------------------------- +cmXCodeObject* cmGlobalXCodeGenerator +::CreateFlatClone(cmXCodeObject* orig) +{ + cmXCodeObject* obj = this->CreateObject(orig->GetType()); + obj->CopyAttributes(orig); + return obj; +} + //---------------------------------------------------------------------------- std::string GetGroupMapKeyFromPath(cmGeneratorTarget* target, const std::string& fullpath) @@ -1656,6 +1665,46 @@ std::string cmGlobalXCodeGenerator::ExtractFlagRegex(const char* exp, return retFlag; } + //---------------------------------------------------------------------------- +// This function strips off Xcode attributes that do not target the current +// configuration +void +cmGlobalXCodeGenerator +::FilterConfigurationAttribute(std::string const& configName, + std::string& attribute) +{ + // Handle [variant=] condition explicitly here. + std::string::size_type beginVariant = attribute.find("[variant="); + if (beginVariant == std::string::npos) + { + // There is no variant in this attribute. + return; + } + + std::string::size_type endVariant = attribute.find("]", beginVariant+9); + if (endVariant == std::string::npos) + { + // There is no terminating bracket. + return; + } + + // Compare the variant to the configuration. + std::string variant = + attribute.substr(beginVariant+9, endVariant-beginVariant-9); + if (variant == configName) + { + // The variant matches the configuration so use this + // attribute but drop the [variant=] condition. + attribute.erase(beginVariant, endVariant-beginVariant+1); + } + else + { + // The variant does not match the configuration so + // do not use this attribute. + attribute.clear(); + } +} + //---------------------------------------------------------------------------- void cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase, @@ -1686,14 +1735,13 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase, } std::string cdir = this->CurrentLocalGenerator->GetCurrentBinaryDirectory(); - cdir = this->ConvertToRelativeForXCode(cdir.c_str()); + cdir = this->ConvertToRelativeForMake(cdir.c_str()); std::string makecmd = "make -C "; makecmd += cdir; makecmd += " -f "; makecmd += this->ConvertToRelativeForMake( (makefile+"$CONFIGURATION").c_str()); makecmd += " all"; - cmSystemTools::ReplaceString(makecmd, "\\ ", "\\\\ "); buildphase->AddAttribute("shellScript", this->CreateString(makecmd.c_str())); buildphase->AddAttribute("showEnvVarsInLog", @@ -2108,10 +2156,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, this->CurrentLocalGenerator ->GenerateAppleInfoPList(gtgt, "$(EXECUTABLE_NAME)", plist.c_str()); - std::string path = - this->ConvertToRelativeForXCode(plist.c_str()); buildSettings->AddAttribute("INFOPLIST_FILE", - this->CreateString(path.c_str())); + this->CreateString(plist)); } else if(this->XcodeVersion >= 22) { @@ -2157,10 +2203,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, this->CurrentLocalGenerator ->GenerateFrameworkInfoPList(gtgt, "$(EXECUTABLE_NAME)", plist.c_str()); - std::string path = - this->ConvertToRelativeForXCode(plist.c_str()); buildSettings->AddAttribute("INFOPLIST_FILE", - this->CreateString(path.c_str())); + this->CreateString(plist)); } else { @@ -2200,10 +2244,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, this->CurrentLocalGenerator ->GenerateAppleInfoPList(gtgt, "$(EXECUTABLE_NAME)", plist.c_str()); - std::string path = - this->ConvertToRelativeForXCode(plist.c_str()); buildSettings->AddAttribute("INFOPLIST_FILE", - this->CreateString(path.c_str())); + this->CreateString(plist)); } } @@ -2498,33 +2540,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, if(i->find("XCODE_ATTRIBUTE_") == 0) { std::string attribute = i->substr(16); - // Handle [variant=] condition explicitly here. - std::string::size_type beginVariant = - attribute.find("[variant="); - if (beginVariant != std::string::npos) - { - std::string::size_type endVariant = - attribute.find("]", beginVariant+9); - if (endVariant != std::string::npos) - { - // Compare the variant to the configuration. - std::string variant = - attribute.substr(beginVariant+9, endVariant-beginVariant-9); - if (variant == configName) - { - // The variant matches the configuration so use this - // attribute but drop the [variant=] condition. - attribute.erase(beginVariant, endVariant-beginVariant+1); - } - else - { - // The variant does not match the configuration so - // do not use this attribute. - attribute.clear(); - } - } - } - + this->FilterConfigurationAttribute(configName, attribute); if (!attribute.empty()) { cmGeneratorExpression ge; @@ -3426,18 +3442,19 @@ bool cmGlobalXCodeGenerator this->CreateObject(cmXCodeObject::XCConfigurationList); cmXCodeObject* buildConfigurations = this->CreateObject(cmXCodeObject::OBJECT_LIST); - std::vector configs; + typedef std::vector > Configs; + Configs configs; const char *defaultConfigName = "Debug"; if(this->XcodeVersion == 15) { cmXCodeObject* configDebug = this->CreateObject(cmXCodeObject::XCBuildConfiguration); configDebug->AddAttribute("name", this->CreateString("Debug")); - configs.push_back(configDebug); + configs.push_back(std::make_pair("Debug", configDebug)); cmXCodeObject* configRelease = this->CreateObject(cmXCodeObject::XCBuildConfiguration); configRelease->AddAttribute("name", this->CreateString("Release")); - configs.push_back(configRelease); + configs.push_back(std::make_pair("Release", configRelease)); } else { @@ -3451,13 +3468,12 @@ bool cmGlobalXCodeGenerator cmXCodeObject* config = this->CreateObject(cmXCodeObject::XCBuildConfiguration); config->AddAttribute("name", this->CreateString(name)); - configs.push_back(config); + configs.push_back(std::make_pair(name, config)); } } - for(std::vector::iterator c = configs.begin(); - c != configs.end(); ++c) + for(Configs::iterator c = configs.begin(); c != configs.end(); ++c) { - buildConfigurations->AddObject(*c); + buildConfigurations->AddObject(c->second); } configlist->AddAttribute("buildConfigurations", buildConfigurations); @@ -3513,30 +3529,37 @@ bool cmGlobalXCodeGenerator this->CreateString(this->GeneratorToolset.c_str())); } - // Put this last so it can override existing settings - // Convert "CMAKE_XCODE_ATTRIBUTE_*" variables directly. - { - std::vector vars = this->CurrentMakefile->GetDefinitions(); - for(std::vector::const_iterator i = vars.begin(); - i != vars.end(); ++i) - { - if(i->find("CMAKE_XCODE_ATTRIBUTE_") == 0) - { - buildSettings->AddAttribute(i->substr(22).c_str(), - this->CreateString( - this->CurrentMakefile->GetDefinition(i->c_str()))); - } - } - } - std::string symroot = root->GetCurrentBinaryDirectory(); symroot += "/build"; buildSettings->AddAttribute("SYMROOT", this->CreateString(symroot.c_str())); - for( std::vector::iterator i = configs.begin(); - i != configs.end(); ++i) + for(Configs::iterator i = configs.begin(); i != configs.end(); ++i) { - (*i)->AddAttribute("buildSettings", buildSettings); + cmXCodeObject* buildSettingsForCfg = this->CreateFlatClone(buildSettings); + + // Put this last so it can override existing settings + // Convert "CMAKE_XCODE_ATTRIBUTE_*" variables directly. + std::vector vars = this->CurrentMakefile->GetDefinitions(); + for(std::vector::const_iterator d = vars.begin(); + d != vars.end(); ++d) + { + if(d->find("CMAKE_XCODE_ATTRIBUTE_") == 0) + { + std::string attribute = d->substr(22); + this->FilterConfigurationAttribute(i->first, attribute); + if(!attribute.empty()) + { + cmGeneratorExpression ge; + std::string processed = + ge.Parse(this->CurrentMakefile->GetDefinition(*d)) + ->Evaluate(this->CurrentLocalGenerator, i->first); + buildSettingsForCfg->AddAttribute(attribute, + this->CreateString(processed)); + } + } + } + // store per-config buildSettings into configuration object + i->second->AddAttribute("buildSettings", buildSettingsForCfg); } this->RootObject->AddAttribute("buildConfigurationList", @@ -3880,12 +3903,6 @@ std::string cmGlobalXCodeGenerator::ConvertToRelativeForMake(const char* p) return cmSystemTools::ConvertToOutputPath(p); } -//---------------------------------------------------------------------------- -std::string cmGlobalXCodeGenerator::ConvertToRelativeForXCode(const char* p) -{ - return cmSystemTools::ConvertToOutputPath(p); -} - //---------------------------------------------------------------------------- std::string cmGlobalXCodeGenerator::RelativeToSource(const char* p) { @@ -4022,8 +4039,8 @@ void cmGlobalXCodeGenerator::AppendFlag(std::string& flags, // We escape a flag as follows: // - Place each flag in single quotes '' - // - Escape a single quote as \\' - // - Escape a backslash as \\\\ since it itself is an escape + // - Escape a single quote as \' + // - Escape a backslash as \\ since it itself is an escape // Note that in the code below we need one more level of escapes for // C string syntax in this source file. // @@ -4043,16 +4060,16 @@ void cmGlobalXCodeGenerator::AppendFlag(std::string& flags, { if (this->XcodeVersion >= 40) { - flags += "'\\\\''"; + flags += "'\\''"; } else { - flags += "\\\\'"; + flags += "\\'"; } } else if(*c == '\\') { - flags += "\\\\\\\\"; + flags += "\\\\"; } else { diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index c8a39dfa2..862746f21 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -99,7 +99,6 @@ private: std::string XCodeEscapePath(const char* p); std::string RelativeToSource(const char* p); std::string RelativeToBinary(const char* p); - std::string ConvertToRelativeForXCode(const char* p); std::string ConvertToRelativeForMake(const char* p); void CreateCustomCommands(cmXCodeObject* buildPhases, cmXCodeObject* sourceBuildPhase, @@ -131,6 +130,7 @@ private: cmXCodeObject* CreateObject(cmXCodeObject::Type type); cmXCodeObject* CreateString(const std::string& s); cmXCodeObject* CreateObjectReference(cmXCodeObject*); + cmXCodeObject* CreateFlatClone(cmXCodeObject*); cmXCodeObject* CreateXCodeTarget(cmGeneratorTarget *gtgt, cmXCodeObject* buildPhases); void ForceLinkerLanguages(); @@ -153,6 +153,8 @@ private: std::string ExtractFlag(const char* flag, std::string& flags); std::string ExtractFlagRegex(const char* exp, int matchIndex, std::string& flags); + void FilterConfigurationAttribute(std::string const& configName, + std::string& attribute); void SortXCodeObjects(); // delete all objects in the this->XCodeObjects vector. void ClearXCodeObjects(); diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index a63b6e36c..448306fe4 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -292,7 +292,7 @@ void cmGraphVizWriter::WriteGlobalFile(const char* fileName) void cmGraphVizWriter::WriteHeader(cmGeneratedFileStream& str) const { - str << this->GraphType << " " << this->GraphName << " {" << std::endl; + str << this->GraphType << " \"" << this->GraphName << "\" {" << std::endl; str << this->GraphHeader << std::endl; } diff --git a/Source/cmIDEFlagTable.h b/Source/cmIDEFlagTable.h index d9a045d6b..adc77632b 100644 --- a/Source/cmIDEFlagTable.h +++ b/Source/cmIDEFlagTable.h @@ -32,6 +32,7 @@ struct cmIDEFlagTable // /NODEFAULTLIB: => // IgnoreDefaultLibraryNames) UserFollowing = (1<<5), // expect value in following argument + CaseInsensitive = (1<<6), // flag may be any case UserValueIgnored = UserValue | UserIgnored, UserValueRequired = UserValue | UserRequired diff --git a/Source/cmIDEOptions.cxx b/Source/cmIDEOptions.cxx index 0eb903d84..509602fbd 100644 --- a/Source/cmIDEOptions.cxx +++ b/Source/cmIDEOptions.cxx @@ -13,6 +13,8 @@ #include "cmSystemTools.h" +#include + //---------------------------------------------------------------------------- cmIDEOptions::cmIDEOptions() { @@ -104,7 +106,9 @@ bool cmIDEOptions::CheckFlagTable(cmIDEFlagTable const* table, // the entry specifies UserRequired we must match only if a // non-empty value is given. int n = static_cast(strlen(entry->commandFlag)); - if(strncmp(flag+1, entry->commandFlag, n) == 0 && + if((strncmp(flag+1, entry->commandFlag, n) == 0 || + (entry->special & cmIDEFlagTable::CaseInsensitive && + cmsysString_strncasecmp(flag+1, entry->commandFlag, n))) && (!(entry->special & cmIDEFlagTable::UserRequired) || static_cast(strlen(flag+1)) > n)) { @@ -112,7 +116,9 @@ bool cmIDEOptions::CheckFlagTable(cmIDEFlagTable const* table, entry_found = true; } } - else if(strcmp(flag+1, entry->commandFlag) == 0) + else if(strcmp(flag+1, entry->commandFlag) == 0 || + (entry->special & cmIDEFlagTable::CaseInsensitive && + cmsysString_strcasecmp(flag+1, entry->commandFlag) == 0)) { if(entry->special & cmIDEFlagTable::UserFollowing) { diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 15a83ee01..2d78a4101 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -1374,10 +1374,12 @@ bool cmInstallCommand::HandleExportMode(std::vector const& args) tei != exportSet->GetTargetExports()->end(); ++tei) { cmTargetExport const* te = *tei; - cmTarget* tgt = this->Makefile->FindTarget(te->TargetName); + cmTarget* tgt = + this->Makefile->GetGlobalGenerator()->FindTarget(te->TargetName); const bool newCMP0022Behavior = - tgt->GetPolicyStatusCMP0022() != cmPolicies::WARN - && tgt->GetPolicyStatusCMP0022() != cmPolicies::OLD; + (tgt && + tgt->GetPolicyStatusCMP0022() != cmPolicies::WARN && + tgt->GetPolicyStatusCMP0022() != cmPolicies::OLD); if(!newCMP0022Behavior) { diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx index ea27f61b0..f2e860915 100644 --- a/Source/cmInstallDirectoryGenerator.cxx +++ b/Source/cmInstallDirectoryGenerator.cxx @@ -36,6 +36,16 @@ cmInstallDirectoryGenerator { this->ActionsPerConfig = true; } + + // We need per-config actions if any directories have generator expressions. + for(std::vector::const_iterator i = dirs.begin(); + !this->ActionsPerConfig && i != dirs.end(); ++i) + { + if(cmGeneratorExpression::Find(*i) != std::string::npos) + { + this->ActionsPerConfig = true; + } + } } //---------------------------------------------------------------------------- @@ -60,7 +70,7 @@ cmInstallDirectoryGenerator::GenerateScriptActions(std::ostream& os, } else { - this->AddDirectoryInstallRule(os, "", indent); + this->AddDirectoryInstallRule(os, "", indent, this->Directories); } } @@ -69,20 +79,30 @@ void cmInstallDirectoryGenerator::GenerateScriptForConfig( const std::string& config, Indent const& indent) { - this->AddDirectoryInstallRule(os, config, indent); + std::vector dirs; + cmGeneratorExpression ge; + for(std::vector::const_iterator i = this->Directories.begin(); + i != this->Directories.end(); ++i) + { + cmsys::auto_ptr cge = ge.Parse(*i); + cmSystemTools::ExpandListArgument(cge->Evaluate( + this->LocalGenerator, config), dirs); + } + this->AddDirectoryInstallRule(os, config, indent, dirs); } void cmInstallDirectoryGenerator::AddDirectoryInstallRule( std::ostream& os, const std::string& config, - Indent const& indent) + Indent const& indent, + std::vector const& dirs) { // Write code to install the directories. const char* no_rename = 0; this->AddInstallRule(os, this->GetDestination(config), cmInstallType_DIRECTORY, - this->Directories, + dirs, this->Optional, this->FilePermissions.c_str(), this->DirPermissions.c_str(), diff --git a/Source/cmInstallDirectoryGenerator.h b/Source/cmInstallDirectoryGenerator.h index 04107e1e7..9b732d3f1 100644 --- a/Source/cmInstallDirectoryGenerator.h +++ b/Source/cmInstallDirectoryGenerator.h @@ -42,7 +42,8 @@ protected: Indent const& indent); void AddDirectoryInstallRule(std::ostream& os, const std::string& config, - Indent const& indent); + Indent const& indent, + std::vector const& dirs); cmLocalGenerator* LocalGenerator; std::vector Directories; std::string FilePermissions; diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 59d06f6e0..5e88fa2c7 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -152,13 +152,19 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, // Handle OSX Bundles. if(this->Target->IsAppBundleOnApple()) { + cmMakefile const* mf = this->Target->Target->GetMakefile(); + // Install the whole app bundle directory. type = cmInstallType_DIRECTORY; literal_args += " USE_SOURCE_PERMISSIONS"; from1 += ".app"; // Tweaks apply to the binary inside the bundle. - to1 += ".app/Contents/MacOS/"; + to1 += ".app/"; + if(!mf->PlatformIsAppleIos()) + { + to1 += "Contents/MacOS/"; + } to1 += targetName; } else @@ -525,6 +531,7 @@ void cmInstallTargetGenerator::PostReplacementTweaks(std::ostream& os, { this->AddInstallNamePatchRule(os, indent, config, file); this->AddChrpathPatchRule(os, indent, config, file); + this->AddUniversalInstallRule(os, indent, file); this->AddRanlibRule(os, indent, file); this->AddStripRule(os, indent, file); } @@ -784,18 +791,10 @@ cmInstallTargetGenerator } // Write a rule to run chrpath to set the install-tree RPATH - if(newRpath.empty()) - { - os << indent << "file(RPATH_REMOVE\n" - << indent << " FILE \"" << toDestDirPath << "\")\n"; - } - else - { - os << indent << "file(RPATH_CHANGE\n" - << indent << " FILE \"" << toDestDirPath << "\"\n" - << indent << " OLD_RPATH \"" << oldRpath << "\"\n" - << indent << " NEW_RPATH \"" << newRpath << "\")\n"; - } + os << indent << "file(RPATH_CHANGE\n" + << indent << " FILE \"" << toDestDirPath << "\"\n" + << indent << " OLD_RPATH \"" << oldRpath << "\"\n" + << indent << " NEW_RPATH \"" << newRpath << "\")\n"; } } @@ -861,3 +860,46 @@ cmInstallTargetGenerator::AddRanlibRule(std::ostream& os, os << indent << "execute_process(COMMAND \"" << ranlib << "\" \"" << toDestDirPath << "\")\n"; } + +//---------------------------------------------------------------------------- +void +cmInstallTargetGenerator +::AddUniversalInstallRule(std::ostream& os, + Indent const& indent, + const std::string& toDestDirPath) +{ + cmMakefile const* mf = this->Target->Target->GetMakefile(); + + if(!mf->PlatformIsAppleIos() || !mf->IsOn("XCODE")) + { + return; + } + + const char* xcodeVersion = mf->GetDefinition("XCODE_VERSION"); + if(!xcodeVersion || cmSystemTools::VersionCompareGreater("6", xcodeVersion)) + { + return; + } + + switch(this->Target->GetType()) + { + case cmState::EXECUTABLE: + case cmState::STATIC_LIBRARY: + case cmState::SHARED_LIBRARY: + case cmState::MODULE_LIBRARY: + break; + + default: + return; + } + + if(!this->Target->Target->GetPropertyAsBool("IOS_INSTALL_COMBINED")) + { + return; + } + + os << indent << "include(CMakeIOSInstallCombined)\n"; + os << indent << "ios_install_combined(" + << "\"" << this->Target->Target->GetName() << "\" " + << "\"" << toDestDirPath << "\")\n"; +} diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h index ec89c05ea..18b313082 100644 --- a/Source/cmInstallTargetGenerator.h +++ b/Source/cmInstallTargetGenerator.h @@ -101,6 +101,8 @@ protected: const std::string& toDestDirPath); void AddRanlibRule(std::ostream& os, Indent const& indent, const std::string& toDestDirPath); + void AddUniversalInstallRule(std::ostream& os, Indent const& indent, + const std::string& toDestDirPath); std::string TargetName; cmGeneratorTarget* Target; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 6a57374f0..912be0c0f 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -455,11 +455,13 @@ void cmLocalGenerator::GenerateInstallRules() void cmLocalGenerator::AddGeneratorTarget(cmGeneratorTarget* gt) { this->GeneratorTargets.push_back(gt); + this->GlobalGenerator->IndexGeneratorTarget(gt); } void cmLocalGenerator::AddImportedGeneratorTarget(cmGeneratorTarget* gt) { this->ImportedGeneratorTargets.push_back(gt); + this->GlobalGenerator->IndexGeneratorTarget(gt); } void cmLocalGenerator::AddOwnedImportedGeneratorTarget(cmGeneratorTarget* gt) @@ -2980,7 +2982,7 @@ cmLocalGenerator::GetTargetDirectory(const cmGeneratorTarget*) const } //---------------------------------------------------------------------------- -cmIML_INT_uint64_t cmLocalGenerator::GetBackwardsCompatibility() +KWIML_INT_uint64_t cmLocalGenerator::GetBackwardsCompatibility() { // The computed version may change until the project is fully // configured. @@ -3033,7 +3035,7 @@ bool cmLocalGenerator::NeedBackwardsCompatibility_2_4() // Compatibility is needed if CMAKE_BACKWARDS_COMPATIBILITY is set // equal to or lower than the given version. - cmIML_INT_uint64_t actual_compat = this->GetBackwardsCompatibility(); + KWIML_INT_uint64_t actual_compat = this->GetBackwardsCompatibility(); return (actual_compat && actual_compat <= CMake_VERSION_ENCODE(2, 4, 255)); } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index e2f551976..68e766741 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -267,7 +267,7 @@ public: * * and is monotonically increasing with the CMake version. */ - cmIML_INT_uint64_t GetBackwardsCompatibility(); + KWIML_INT_uint64_t GetBackwardsCompatibility(); /** * Test whether compatibility is set to a given version or lower. @@ -390,7 +390,7 @@ protected: // committed. std::string TargetImplib; - cmIML_INT_uint64_t BackwardsCompatibility; + KWIML_INT_uint64_t BackwardsCompatibility; bool BackwardsCompatibilityFinal; private: void AddSharedFlags(std::string& flags, const std::string& lang, diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index e4026b084..71de7a723 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -146,16 +146,14 @@ bool cmMacroHelperCommand::InvokeInitialPass // replace formal arguments for (unsigned int j = 0; j < variables.size(); ++j) { - cmSystemTools::ReplaceString(arg.Value, variables[j].c_str(), - expandedArgs[j].c_str()); + cmSystemTools::ReplaceString(arg.Value, variables[j], + expandedArgs[j]); } // replace argc - cmSystemTools::ReplaceString(arg.Value, "${ARGC}",argcDef.c_str()); + cmSystemTools::ReplaceString(arg.Value, "${ARGC}", argcDef); - cmSystemTools::ReplaceString(arg.Value, "${ARGN}", - expandedArgn.c_str()); - cmSystemTools::ReplaceString(arg.Value, "${ARGV}", - expandedArgv.c_str()); + cmSystemTools::ReplaceString(arg.Value, "${ARGN}", expandedArgn); + cmSystemTools::ReplaceString(arg.Value, "${ARGV}", expandedArgv); // if the current argument of the current function has ${ARGV in it // then try replacing ARGV values @@ -163,8 +161,8 @@ bool cmMacroHelperCommand::InvokeInitialPass { for (unsigned int t = 0; t < expandedArgs.size(); ++t) { - cmSystemTools::ReplaceString(arg.Value, argVs[t].c_str(), - expandedArgs[t].c_str()); + cmSystemTools::ReplaceString(arg.Value, argVs[t], + expandedArgs[t]); } } } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 1b0a99ae8..950b24735 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -791,7 +791,24 @@ cmMakefile::AddCustomCommandToTarget(const std::string& target, if(issueMessage) { - e << "The target name \"" << target << "\" is unknown in this context."; + if (cmTarget const* t = this->FindTargetToUse(target)) + { + if (t->IsImported()) + { + e << "TARGET '" << target + << "' is IMPORTED and does not build here."; + } + else + { + e << "TARGET '" << target + << "' was not created in this directory."; + } + } + else + { + e << "No TARGET '" << target + << "' has been created in this directory."; + } IssueMessage(messageType, e.str()); } @@ -2111,6 +2128,7 @@ cmMakefile::AddNewTarget(cmState::TargetType type, const std::string& name) cmTarget& target = it->second; target.SetType(type, name); target.SetMakefile(this); + this->GetGlobalGenerator()->IndexTarget(&it->second); return &it->second; } @@ -2832,10 +2850,9 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew( const char* last = in; std::string result; result.reserve(source.size()); - std::stack openstack; + std::vector openstack; bool error = false; bool done = false; - openstack.push(t_lookup()); cmake::MessageType mtype = cmake::LOG; cmState* state = this->GetCMakeInstance()->GetState(); @@ -2846,10 +2863,10 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew( switch(inc) { case '}': - if(openstack.size() > 1) + if(!openstack.empty()) { - t_lookup var = openstack.top(); - openstack.pop(); + t_lookup var = openstack.back(); + openstack.pop_back(); result.append(last, in - last); std::string const& lookup = result.substr(var.loc); const char* value = NULL; @@ -2970,7 +2987,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew( last = start; in = start - 1; lookup.loc = result.size(); - openstack.push(lookup); + openstack.push_back(lookup); } break; } @@ -2997,7 +3014,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew( result.append("\r"); last = next + 1; } - else if(nextc == ';' && openstack.size() == 1) + else if(nextc == ';' && openstack.empty()) { // Handled in ExpandListArgument; pass the backslash literally. } @@ -3065,7 +3082,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew( /* FALLTHROUGH */ default: { - if(openstack.size() > 1 && + if(!openstack.empty() && !(isalnum(inc) || inc == '_' || inc == '/' || inc == '.' || inc == '+' || inc == '-')) @@ -3074,7 +3091,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew( errorstr += inc; result.append(last, in - last); errorstr += "\') in a variable name: " - "'" + result.substr(openstack.top().loc) + "'"; + "'" + result.substr(openstack.back().loc) + "'"; mtype = cmake::FATAL_ERROR; error = true; } @@ -3085,7 +3102,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew( } while(!error && !done && *++in); // Check for open variable references yet. - if(!error && openstack.size() != 1) + if(!error && !openstack.empty()) { // There's an open variable reference waiting. Policy CMP0010 flags // whether this is an error or not. The new parser now enforces @@ -4202,6 +4219,7 @@ cmMakefile::AddImportedTarget(const std::string& name, // Add to the set of available imported targets. this->ImportedTargets[name] = target.get(); + this->GetGlobalGenerator()->IndexTarget(target.get()); // Transfer ownership to this cmMakefile object. this->ImportedTargetsOwned.push_back(target.get()); diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx index 8272eb09f..1c67ceace 100644 --- a/Source/cmMessageCommand.cxx +++ b/Source/cmMessageCommand.cxx @@ -25,6 +25,7 @@ bool cmMessageCommand cmake::MessageType type = cmake::MESSAGE; bool status = false; bool fatal = false; + cmake* cm = this->Makefile->GetCMakeInstance(); if (*i == "SEND_ERROR") { type = cmake::FATAL_ERROR; @@ -43,14 +44,18 @@ bool cmMessageCommand } else if (*i == "AUTHOR_WARNING") { - if (this->Makefile->GetCMakeInstance()->GetSuppressDevWarnings( - this->Makefile)) + if (cm->GetDevWarningsAsErrors(this->Makefile)) { - return true; + fatal = true; + type = cmake::AUTHOR_ERROR; + } + else if (!cm->GetSuppressDevWarnings(this->Makefile)) + { + type = cmake::AUTHOR_WARNING; } else { - type = cmake::AUTHOR_WARNING; + return true; } ++i; } @@ -61,22 +66,18 @@ bool cmMessageCommand } else if (*i == "DEPRECATION") { - if (this->Makefile->IsOn("CMAKE_ERROR_DEPRECATED")) + if (cm->GetDeprecatedWarningsAsErrors(this->Makefile)) { fatal = true; type = cmake::DEPRECATION_ERROR; } + else if (!cm->GetSuppressDeprecatedWarnings(this->Makefile)) + { + type = cmake::DEPRECATION_WARNING; + } else { - if (this->Makefile->GetCMakeInstance()->GetSuppressDeprecatedWarnings( - this->Makefile)) - { - return true; - } - else - { - type = cmake::DEPRECATION_WARNING; - } + return true; } ++i; } diff --git a/Source/cmParseArgumentsCommand.cxx b/Source/cmParseArgumentsCommand.cxx new file mode 100644 index 000000000..ca76c889d --- /dev/null +++ b/Source/cmParseArgumentsCommand.cxx @@ -0,0 +1,200 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Matthias Maennich + Copyright 2010 Alexander Neundorf + + 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 "cmParseArgumentsCommand.h" +#include "cmAlgorithms.h" + +//---------------------------------------------------------------------------- +bool cmParseArgumentsCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) +{ + // cmake_parse_arguments(prefix options single multi ) + // 1 2 3 4 + if (args.size() < 4) + { + this->SetError("must be called with at least 4 arguments."); + return false; + } + + std::vector::const_iterator argIter = args.begin(), + argEnd = args.end(); + // the first argument is the prefix + const std::string prefix = (*argIter++) + "_"; + + // define the result maps holding key/value pairs for + // options, single values and multi values + typedef std::map options_map; + typedef std::map single_map; + typedef std::map > multi_map; + options_map options; + single_map single; + multi_map multi; + + // anything else is put into a vector of unparsed strings + std::vector unparsed; + + // remember already defined keywords + std::set used_keywords; + const std::string dup_warning = "keyword defined more than once: "; + + // the second argument is a (cmake) list of options without argument + std::vector list; + cmSystemTools::ExpandListArgument(*argIter++, list); + for (std::vector::const_iterator iter = list.begin(), + end = list.end(); + iter != end; ++iter) + { + if (!used_keywords.insert(*iter).second) + { + this->GetMakefile()->IssueMessage(cmake::WARNING, dup_warning + *iter); + } + options[*iter]; // default initialize + } + + // the third argument is a (cmake) list of single argument options + list.clear(); + cmSystemTools::ExpandListArgument(*argIter++, list); + for (std::vector::const_iterator iter = list.begin(), + end = list.end(); + iter != end; ++iter) + { + if (!used_keywords.insert(*iter).second) + { + this->GetMakefile()->IssueMessage(cmake::WARNING, dup_warning + *iter); + } + single[*iter]; // default initialize + } + + // the fourth argument is a (cmake) list of multi argument options + list.clear(); + cmSystemTools::ExpandListArgument(*argIter++, list); + for (std::vector::const_iterator iter = list.begin(), + end = list.end(); + iter != end; ++iter) + { + if (!used_keywords.insert(*iter).second) + { + this->GetMakefile()->IssueMessage(cmake::WARNING, dup_warning + *iter); + } + multi[*iter]; // default initialize + } + + enum insideValues + { + NONE, + SINGLE, + MULTI + } 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); + } + + // iterate over the arguments list and fill in the values where applicable + for (argIter = list.begin(), argEnd = list.end(); + argIter != argEnd; ++argIter) + { + const options_map::iterator optIter = options.find(*argIter); + if (optIter != options.end()) + { + insideValues = NONE; + optIter->second = true; + continue; + } + + const single_map::iterator singleIter = single.find(*argIter); + if (singleIter != single.end()) + { + insideValues = SINGLE; + currentArgName = *argIter; + continue; + } + + const multi_map::iterator multiIter = multi.find(*argIter); + if (multiIter != multi.end()) + { + insideValues = MULTI; + currentArgName = *argIter; + continue; + } + + switch(insideValues) + { + case SINGLE: + single[currentArgName] = *argIter; + insideValues = NONE; + break; + case MULTI: + multi[currentArgName].push_back(*argIter); + break; + default: + unparsed.push_back(*argIter); + break; + } + } + + // now iterate over the collected values and update their definition + // within the current scope. undefine if necessary. + + for (options_map::const_iterator iter = options.begin(), end = options.end(); + iter != end; ++iter) + { + this->Makefile->AddDefinition(prefix + iter->first, + iter->second? "TRUE": "FALSE"); + } + for (single_map::const_iterator iter = single.begin(), end = single.end(); + iter != end; ++iter) + { + if (!iter->second.empty()) + { + this->Makefile->AddDefinition(prefix + iter->first, + iter->second.c_str()); + } + else + { + this->Makefile->RemoveDefinition(prefix + iter->first); + } + } + + for (multi_map::const_iterator iter = multi.begin(), end = multi.end(); + iter != end; ++iter) + { + if (!iter->second.empty()) + { + this->Makefile->AddDefinition(prefix + iter->first, + cmJoin(cmMakeRange(iter->second), ";") + .c_str()); + } + else + { + this->Makefile->RemoveDefinition(prefix + iter->first); + } + } + + if (!unparsed.empty()) + { + this->Makefile->AddDefinition(prefix + "UNPARSED_ARGUMENTS", + cmJoin(cmMakeRange(unparsed), ";").c_str()); + } + else + { + this->Makefile->RemoveDefinition(prefix + "UNPARSED_ARGUMENTS"); + } + + return true; +} diff --git a/Source/cmParseArgumentsCommand.h b/Source/cmParseArgumentsCommand.h new file mode 100644 index 000000000..7fbf64296 --- /dev/null +++ b/Source/cmParseArgumentsCommand.h @@ -0,0 +1,54 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Matthias Maennich + + 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 cmParseArgumentsCommand_h +#define cmParseArgumentsCommand_h + +#include "cmCommand.h" + +/** \class cmParseArgumentsCommand + * + */ +class cmParseArgumentsCommand : public cmCommand +{ +public: + /** + * This is a virtual constructor for the command. + */ + virtual cmCommand* Clone() + { + return new cmParseArgumentsCommand; + } + + /** + * This is called when the command is first encountered in + * the CMakeLists.txt file. + */ + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); + + /** + * This determines if the command is invoked when in script mode. + */ + virtual bool IsScriptable() const { return true; } + + /** + * The name of the command as specified in CMakeList.txt. + */ + virtual std::string GetName() const { return "cmake_parse_arguments";} + + cmTypeMacro(cmParseArgumentsCommand, cmCommand); + +}; + + +#endif diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h index aed2e7456..272c1361d 100644 --- a/Source/cmStandardIncludes.h +++ b/Source/cmStandardIncludes.h @@ -31,7 +31,7 @@ #endif // Provide fixed-size integer types. -#include +#include #include #include diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index b2827dc23..3ba72876c 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -17,6 +17,7 @@ #include #include #include +#include #ifdef __QNX__ # include /* for malloc/free on QNX */ #endif @@ -660,14 +661,6 @@ bool cmSystemTools::RunSingleCommand(std::vectorconst& command, argv.push_back(a->c_str()); } argv.push_back(0); - if ( captureStdOut ) - { - *captureStdOut = ""; - } - if (captureStdErr && captureStdErr != captureStdOut) - { - *captureStdErr = ""; - } cmsysProcess* cp = cmsysProcess_New(); cmsysProcess_SetCommand(cp, &*argv.begin()); @@ -681,7 +674,16 @@ bool cmSystemTools::RunSingleCommand(std::vectorconst& command, { cmsysProcess_SetPipeShared(cp, cmsysProcess_Pipe_STDOUT, 1); cmsysProcess_SetPipeShared(cp, cmsysProcess_Pipe_STDERR, 1); + captureStdOut = 0; + captureStdErr = 0; } + else if (outputflag == OUTPUT_MERGE || + (captureStdErr && captureStdErr == captureStdOut)) + { + cmsysProcess_SetOption(cp, cmsysProcess_Option_MergeOutput, 1); + captureStdErr = 0; + } + assert(!captureStdErr || captureStdErr != captureStdOut); cmsysProcess_SetTimeout(cp, timeout); cmsysProcess_Execute(cp); @@ -696,65 +698,50 @@ bool cmSystemTools::RunSingleCommand(std::vectorconst& command, { while((pipe = cmsysProcess_WaitForData(cp, &data, &length, 0)) > 0) { - if(captureStdOut || captureStdErr || outputflag != OUTPUT_NONE) + // Translate NULL characters in the output into valid text. + // Visual Studio 7 puts these characters in the output of its + // build process. + for(int i=0; i < length; ++i) { - // Translate NULL characters in the output into valid text. - // Visual Studio 7 puts these characters in the output of its - // build process. - for(int i=0; i < length; ++i) + if(data[i] == '\0') { - if(data[i] == '\0') - { - data[i] = ' '; - } + data[i] = ' '; } } - if(pipe == cmsysProcess_Pipe_STDOUT || - (pipe == cmsysProcess_Pipe_STDERR && - captureStdOut == captureStdErr)) + + if (pipe == cmsysProcess_Pipe_STDOUT) { + if (outputflag != OUTPUT_NONE) + { + cmSystemTools::Stdout(data, length); + } if (captureStdOut) { tempStdOut.insert(tempStdOut.end(), data, data+length); } } - else if(pipe == cmsysProcess_Pipe_STDERR) + else if (pipe == cmsysProcess_Pipe_STDERR) { + if (outputflag != OUTPUT_NONE) + { + cmSystemTools::Stderr(data, length); + } if (captureStdErr) { tempStdErr.insert(tempStdErr.end(), data, data+length); } } - if(outputflag != OUTPUT_NONE) - { - if(outputflag == OUTPUT_MERGE) - { - cmSystemTools::Stdout(data, length); - } - else - { - if(pipe == cmsysProcess_Pipe_STDERR) - { - cmSystemTools::Stderr(data, length); - } - else if(pipe == cmsysProcess_Pipe_STDOUT) - { - cmSystemTools::Stdout(data, length); - } - } - } } } cmsysProcess_WaitForExit(cp, 0); - if ( captureStdOut && tempStdOut.begin() != tempStdOut.end()) + if (captureStdOut) { - captureStdOut->append(&*tempStdOut.begin(), tempStdOut.size()); + captureStdOut->assign(tempStdOut.begin(), tempStdOut.end()); } - if ( captureStdErr && captureStdErr != captureStdOut && - tempStdErr.begin() != tempStdErr.end()) + if (captureStdErr) { - captureStdErr->append(&*tempStdErr.begin(), tempStdErr.size()); + captureStdErr->assign(tempStdErr.begin(), tempStdErr.end()); } bool result = true; @@ -2565,6 +2552,7 @@ bool cmSystemTools::ChangeRPath(std::string const& file, *changed = false; } int rp_count = 0; + bool remove_rpath = true; cmSystemToolsRPathInfo rp[2]; { // Parse the ELF binary. @@ -2622,6 +2610,7 @@ bool cmSystemTools::ChangeRPath(std::string const& file, // If it contains the new rpath instead then it is okay. if(cmSystemToolsFindRPath(se[i]->Value, newRPath) != std::string::npos) { + remove_rpath = false; continue; } if(emsg) @@ -2642,13 +2631,30 @@ bool cmSystemTools::ChangeRPath(std::string const& file, rp[rp_count].Size = se[i]->Size; rp[rp_count].Name = se_name[i]; + std::string::size_type prefix_len = pos; + + // If oldRPath was at the end of the file's RPath, and newRPath is empty, + // we should remove the unnecessary ':' at the end. + if (newRPath.empty() && + pos > 0 && + se[i]->Value[pos - 1] == ':' && + pos + oldRPath.length() == se[i]->Value.length()) + { + prefix_len--; + } + // Construct the new value which preserves the part of the path // not being changed. - rp[rp_count].Value = se[i]->Value.substr(0, pos); + rp[rp_count].Value = se[i]->Value.substr(0, prefix_len); rp[rp_count].Value += newRPath; rp[rp_count].Value += se[i]->Value.substr(pos+oldRPath.length(), oldRPath.npos); + if (!rp[rp_count].Value.empty()) + { + remove_rpath = false; + } + // Make sure there is enough room to store the new rpath and at // least one null terminator. if(rp[rp_count].Size < rp[rp_count].Value.length()+1) @@ -2673,6 +2679,12 @@ bool cmSystemTools::ChangeRPath(std::string const& file, return true; } + // If the resulting rpath is empty, just remove the entire entry instead. + if (remove_rpath) + { + return cmSystemTools::RemoveRPath(file, emsg, changed); + } + { // Open the file for update. cmsys::ofstream f(file.c_str(), @@ -2779,6 +2791,14 @@ bool cmSystemTools::VersionCompare(cmSystemTools::CompareOp op, return op == cmSystemTools::OP_EQUAL; } +//---------------------------------------------------------------------------- +bool cmSystemTools::VersionCompareEqual(std::string const& lhs, + std::string const& rhs) +{ + return cmSystemTools::VersionCompare( + cmSystemTools::OP_EQUAL, lhs.c_str(), rhs.c_str()); +} + //---------------------------------------------------------------------------- bool cmSystemTools::VersionCompareGreater(std::string const& lhs, std::string const& rhs) diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index b6b09783a..f511ae43d 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -203,7 +203,7 @@ public: * Output is controlled with outputflag. If outputflag is OUTPUT_NONE, no * user-viewable output from the program being run will be generated. * OUTPUT_MERGE is the legacy behaviour where stdout and stderr are merged - * into stdout. OUTPUT_NORMAL passes through the output to stdout/stderr as + * into stdout. OUTPUT_FORWARD copies the output to stdout/stderr as * it was received. OUTPUT_PASSTHROUGH passes through the original handles. * * If timeout is specified, the command will be terminated after @@ -223,7 +223,7 @@ public: { OUTPUT_NONE = 0, OUTPUT_MERGE, - OUTPUT_NORMAL, + OUTPUT_FORWARD, OUTPUT_PASSTHROUGH }; static bool RunSingleCommand(const char* command, @@ -294,6 +294,8 @@ public: * Compare versions */ static bool VersionCompare(CompareOp op, const char* lhs, const char* rhs); + static bool VersionCompareEqual(std::string const& lhs, + std::string const& rhs); static bool VersionCompareGreater(std::string const& lhs, std::string const& rhs); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 9ea1a34e6..1986e5fd3 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -132,6 +132,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) this->SetPropertyDefault("Fortran_MODULE_DIRECTORY", 0); this->SetPropertyDefault("GNUtoMS", 0); this->SetPropertyDefault("OSX_ARCHITECTURES", 0); + this->SetPropertyDefault("IOS_INSTALL_COMBINED", 0); this->SetPropertyDefault("AUTOMOC", 0); this->SetPropertyDefault("AUTOUIC", 0); this->SetPropertyDefault("AUTORCC", 0); diff --git a/Source/cmVS10LinkFlagTable.h b/Source/cmVS10LinkFlagTable.h index f6b758d05..dd9232986 100644 --- a/Source/cmVS10LinkFlagTable.h +++ b/Source/cmVS10LinkFlagTable.h @@ -155,7 +155,8 @@ static cmVS7FlagTable cmVS10LinkFlagTable[] = {"AllowIsolation", "ALLOWISOLATION:NO", "", "false", 0}, {"UACUIAccess", "uiAccess='false'", "", "false", 0}, {"UACUIAccess", "uiAccess='true'", "", "true", 0}, - {"GenerateDebugInformation", "DEBUG", "", "true", 0}, + {"GenerateDebugInformation", "DEBUG", "", "true", + cmVS7FlagTable::CaseInsensitive}, {"MapExports", "MAPINFO:EXPORTS", "", "true", 0}, {"AssemblyDebug", "ASSEMBLYDEBUG:DISABLE", "", "false", 0}, {"AssemblyDebug", "ASSEMBLYDEBUG", "", "true", 0}, diff --git a/Source/cmVS11LinkFlagTable.h b/Source/cmVS11LinkFlagTable.h index 0f641e40e..2d6f6c074 100644 --- a/Source/cmVS11LinkFlagTable.h +++ b/Source/cmVS11LinkFlagTable.h @@ -177,7 +177,8 @@ static cmVS7FlagTable cmVS11LinkFlagTable[] = {"UACUIAccess", "uiAccess='false'", "", "false", 0}, {"UACUIAccess", "uiAccess='true'", "", "true", 0}, {"ManifestEmbed", "manifest:embed", "", "true", 0}, - {"GenerateDebugInformation", "DEBUG", "", "true", 0}, + {"GenerateDebugInformation", "DEBUG", "", "true", + cmVS7FlagTable::CaseInsensitive}, {"MapExports", "MAPINFO:EXPORTS", "", "true", 0}, {"AssemblyDebug", "ASSEMBLYDEBUG:DISABLE", "", "false", 0}, {"AssemblyDebug", "ASSEMBLYDEBUG", "", "true", 0}, diff --git a/Source/cmVS12LinkFlagTable.h b/Source/cmVS12LinkFlagTable.h index e5a570e7c..0be5e340d 100644 --- a/Source/cmVS12LinkFlagTable.h +++ b/Source/cmVS12LinkFlagTable.h @@ -177,7 +177,8 @@ static cmVS7FlagTable cmVS12LinkFlagTable[] = {"UACUIAccess", "uiAccess='false'", "", "false", 0}, {"UACUIAccess", "uiAccess='true'", "", "true", 0}, {"ManifestEmbed", "manifest:embed", "", "true", 0}, - {"GenerateDebugInformation", "DEBUG", "", "true", 0}, + {"GenerateDebugInformation", "DEBUG", "", "true", + cmVS7FlagTable::CaseInsensitive}, {"MapExports", "MAPINFO:EXPORTS", "", "true", 0}, {"AssemblyDebug", "ASSEMBLYDEBUG:DISABLE", "", "false", 0}, {"AssemblyDebug", "ASSEMBLYDEBUG", "", "true", 0}, diff --git a/Source/cmVS14LinkFlagTable.h b/Source/cmVS14LinkFlagTable.h index 6d81d125f..29e3d8606 100644 --- a/Source/cmVS14LinkFlagTable.h +++ b/Source/cmVS14LinkFlagTable.h @@ -177,7 +177,10 @@ static cmVS7FlagTable cmVS14LinkFlagTable[] = {"UACUIAccess", "uiAccess='false'", "", "false", 0}, {"UACUIAccess", "uiAccess='true'", "", "true", 0}, {"ManifestEmbed", "manifest:embed", "", "true", 0}, - {"GenerateDebugInformation", "DEBUG", "", "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}, diff --git a/Source/cmVersion.h b/Source/cmVersion.h index 0ab639051..84f750f19 100644 --- a/Source/cmVersion.h +++ b/Source/cmVersion.h @@ -34,7 +34,7 @@ public: /* Encode with room for up to 1000 minor releases between major releases and to encode dates until the year 10000 in the patch level. */ -#define CMake_VERSION_ENCODE__BASE cmIML_INT_UINT64_C(100000000) +#define CMake_VERSION_ENCODE__BASE KWIML_INT_UINT64_C(100000000) #define CMake_VERSION_ENCODE(major, minor, patch) \ ((((major) * 1000u) * CMake_VERSION_ENCODE__BASE) + \ (((minor) % 1000u) * CMake_VERSION_ENCODE__BASE) + \ diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 6e1fb5b60..da950bea9 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -448,6 +448,32 @@ void cmVisualStudio10TargetGenerator::Generate() (*this->BuildFileStream) << cmVS10EscapeXML(targetFrameworkVersion) << "\n"; } + + std::vector keys = this->GeneratorTarget->GetPropertyKeys(); + for(std::vector::const_iterator keyIt = keys.begin(); + keyIt != keys.end(); ++keyIt) + { + static const char* prefix = "VS_GLOBAL_"; + if(keyIt->find(prefix) != 0) + continue; + std::string globalKey = keyIt->substr(strlen(prefix)); + // Skip invalid or separately-handled properties. + if(globalKey == "" || + globalKey == "PROJECT_TYPES" || + globalKey == "ROOTNAMESPACE" || + globalKey == "KEYWORD") + { + continue; + } + const char* value = this->GeneratorTarget->GetProperty(keyIt->c_str()); + if (!value) + continue; + this->WriteString("<", 2); + (*this->BuildFileStream) << globalKey << ">" + << cmVS10EscapeXML(value) + << "\n"; + } + this->WriteString("\n", 1); this->WriteString("\n", @@ -736,13 +762,16 @@ void cmVisualStudio10TargetGenerator std::string mfcFlagValue = mfcFlag ? mfcFlag : "0"; std::string useOfMfcValue = "false"; - if(mfcFlagValue == "1") + if(this->GeneratorTarget->GetType() <= cmState::OBJECT_LIBRARY) { - useOfMfcValue = "Static"; - } - else if(mfcFlagValue == "2") - { - useOfMfcValue = "Dynamic"; + if(mfcFlagValue == "1") + { + useOfMfcValue = "Static"; + } + else if(mfcFlagValue == "2") + { + useOfMfcValue = "Dynamic"; + } } std::string mfcLine = ""; mfcLine += useOfMfcValue + "\n"; @@ -2597,14 +2626,16 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config) linkOptions.AddFlag("StackReserveSize", stackVal); } - if(linkOptions.IsDebug() || flags.find("/debug") != flags.npos) + if (this->LocalGenerator->GetVersion() >= + cmGlobalVisualStudioGenerator::VS14) { - linkOptions.AddFlag("GenerateDebugInformation", "true"); + linkOptions.AddFlag("GenerateDebugInformation", "No"); } else { linkOptions.AddFlag("GenerateDebugInformation", "false"); } + std::string pdb = this->GeneratorTarget->GetPDBDirectory(config.c_str()); pdb += "/"; pdb += targetNamePDB; @@ -2667,6 +2698,34 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config) } } + // Hack to fix flag version selection in a common use case. + // FIXME: Select flag table based on toolset instead of VS version. + if (this->LocalGenerator->GetVersion() >= + cmGlobalVisualStudioGenerator::VS14) + { + cmGlobalVisualStudio10Generator* gg = + static_cast(this->GlobalGenerator); + const char* toolset = gg->GetPlatformToolset(); + if (toolset && + (cmHasLiteralPrefix(toolset, "v100") || + cmHasLiteralPrefix(toolset, "v110") || + cmHasLiteralPrefix(toolset, "v120"))) + { + if (const char* debug = linkOptions.GetFlag("GenerateDebugInformation")) + { + // Convert value from enumeration back to boolean for older toolsets. + if (strcmp(debug, "No") == 0) + { + linkOptions.AddFlag("GenerateDebugInformation", "false"); + } + else if (strcmp(debug, "Debug") == 0) + { + linkOptions.AddFlag("GenerateDebugInformation", "true"); + } + } + } + } + this->LinkOptions[config] = pOptions.release(); return true; } diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx index c59c3609f..5bc34c136 100644 --- a/Source/cmXCodeObject.cxx +++ b/Source/cmXCodeObject.cxx @@ -255,9 +255,9 @@ void cmXCodeObject::PrintString(std::ostream& os,std::string String) for(std::string::const_iterator i = String.begin(); i != String.end(); ++i) { - if(*i == '"') + if(*i == '"' || *i == '\\') { - // Escape double-quotes. + // Escape double-quotes and backslashes. os << '\\'; } os << *i; diff --git a/Source/cm_sha2.c b/Source/cm_sha2.c index b90e060ef..649c39aaf 100644 --- a/Source/cm_sha2.c +++ b/Source/cm_sha2.c @@ -87,22 +87,21 @@ * made). */ #if !defined(BYTE_ORDER) || (BYTE_ORDER != LITTLE_ENDIAN && BYTE_ORDER != BIG_ENDIAN) -/* CMake modification: use byte order from cmIML. */ -# include "cmIML/ABI.h" +/* CMake modification: use byte order from KWIML. */ # undef BYTE_ORDER # undef BIG_ENDIAN # undef LITTLE_ENDIAN -# define BYTE_ORDER cmIML_ABI_ENDIAN_ID -# define BIG_ENDIAN cmIML_ABI_ENDIAN_ID_BIG -# define LITTLE_ENDIAN cmIML_ABI_ENDIAN_ID_LITTLE +# define BYTE_ORDER KWIML_ABI_ENDIAN_ID +# define BIG_ENDIAN KWIML_ABI_ENDIAN_ID_BIG +# define LITTLE_ENDIAN KWIML_ABI_ENDIAN_ID_LITTLE #endif /* CMake modification: use types computed in header. */ typedef cm_sha2_uint8_t sha_byte; /* Exactly 1 byte */ typedef cm_sha2_uint32_t sha_word32; /* Exactly 4 bytes */ typedef cm_sha2_uint64_t sha_word64; /* Exactly 8 bytes */ -#define SHA_UINT32_C(x) cmIML_INT_UINT32_C(x) -#define SHA_UINT64_C(x) cmIML_INT_UINT64_C(x) +#define SHA_UINT32_C(x) KWIML_INT_UINT32_C(x) +#define SHA_UINT64_C(x) KWIML_INT_UINT64_C(x) #if defined(__clang__) # pragma clang diagnostic ignored "-Wcast-align" #endif diff --git a/Source/cm_sha2.h b/Source/cm_sha2.h index 71395f06b..f1510318c 100644 --- a/Source/cm_sha2.h +++ b/Source/cm_sha2.h @@ -38,11 +38,11 @@ #include "cm_sha2_mangle.h" -/* CMake modification: use integer types from cmIML. */ -#include "cmIML/INT.h" -typedef cmIML_INT_uint8_t cm_sha2_uint8_t; -typedef cmIML_INT_uint32_t cm_sha2_uint32_t; -typedef cmIML_INT_uint64_t cm_sha2_uint64_t; +/* CMake modification: use integer types from KWIML. */ +#include +typedef KWIML_INT_uint8_t cm_sha2_uint8_t; +typedef KWIML_INT_uint32_t cm_sha2_uint32_t; +typedef KWIML_INT_uint64_t cm_sha2_uint64_t; #ifdef __cplusplus extern "C" { diff --git a/Source/cmake.cxx b/Source/cmake.cxx index c0a11965f..8f6b9524a 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -291,6 +291,7 @@ bool cmake::SetCacheArgs(const std::vector& args) std::string name; bool foundNo = false; + bool foundError = false; unsigned int nameStartPosition = 0; if (entry.find("no-", nameStartPosition) == 0) @@ -299,6 +300,12 @@ bool cmake::SetCacheArgs(const std::vector& args) nameStartPosition += 3; } + if (entry.find("error=", nameStartPosition) == 0) + { + foundError = true; + nameStartPosition += 6; + } + name = entry.substr(nameStartPosition); if (name.empty()) { @@ -306,16 +313,27 @@ bool cmake::SetCacheArgs(const std::vector& args) return false; } - if (!foundNo) + if (!foundNo && !foundError) { // -W this->DiagLevels[name] = std::max(this->DiagLevels[name], DIAG_WARN); } + else if (foundNo && !foundError) + { + // -Wno + this->DiagLevels[name] = DIAG_IGNORE; + } + else if (!foundNo && foundError) + { + // -Werror= + this->DiagLevels[name] = DIAG_ERROR; + } else { - // -Wno - this->DiagLevels[name] = DIAG_IGNORE; + // -Wno-error= + this->DiagLevels[name] = std::min(this->DiagLevels[name], + DIAG_WARN); } } else if(arg.find("-U",0) == 0) @@ -1269,17 +1287,18 @@ int cmake::Configure() diagLevel = this->DiagLevels["deprecated"]; if (diagLevel == DIAG_IGNORE) { - this->AddCacheEntry("CMAKE_WARN_DEPRECATED", "FALSE", - "Whether to issue warnings for deprecated " - "functionality.", - cmState::INTERNAL); + this->SetSuppressDeprecatedWarnings(true); + this->SetDeprecatedWarningsAsErrors(false); } else if (diagLevel == DIAG_WARN) { - this->AddCacheEntry("CMAKE_WARN_DEPRECATED", "TRUE", - "Whether to issue warnings for deprecated " - "functionality.", - cmState::INTERNAL); + this->SetSuppressDeprecatedWarnings(false); + this->SetDeprecatedWarningsAsErrors(false); + } + else if (diagLevel == DIAG_ERROR) + { + this->SetSuppressDeprecatedWarnings(false); + this->SetDeprecatedWarningsAsErrors(true); } } @@ -1289,9 +1308,11 @@ int cmake::Configure() const char* cachedWarnDeprecated = this->State->GetCacheEntryValue("CMAKE_WARN_DEPRECATED"); + const char* cachedErrorDeprecated = + this->State->GetCacheEntryValue("CMAKE_ERROR_DEPRECATED"); // don't overwrite deprecated warning setting from a previous invocation - if (!cachedWarnDeprecated) + if (!cachedWarnDeprecated && !cachedErrorDeprecated) { setDeprecatedVariables = true; } @@ -1299,32 +1320,35 @@ int cmake::Configure() diagLevel = this->DiagLevels["dev"]; if (diagLevel == DIAG_IGNORE) { - this->AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", "TRUE", - "Suppress Warnings that are meant for" - " the author of the CMakeLists.txt files.", - cmState::INTERNAL); + this->SetSuppressDevWarnings(true); + this->SetDevWarningsAsErrors(false); if (setDeprecatedVariables) { - this->AddCacheEntry("CMAKE_WARN_DEPRECATED", "FALSE", - "Whether to issue warnings for deprecated " - "functionality.", - cmState::INTERNAL); + this->SetSuppressDeprecatedWarnings(true); + this->SetDeprecatedWarningsAsErrors(false); } } else if (diagLevel == DIAG_WARN) { - this->AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", "FALSE", - "Suppress Warnings that are meant for" - " the author of the CMakeLists.txt files.", - cmState::INTERNAL); + this->SetSuppressDevWarnings(false); + this->SetDevWarningsAsErrors(false); if (setDeprecatedVariables) { - this->AddCacheEntry("CMAKE_WARN_DEPRECATED", "TRUE", - "Whether to issue warnings for deprecated " - "functionality.", - cmState::INTERNAL); + this->SetSuppressDeprecatedWarnings(false); + this->SetDeprecatedWarningsAsErrors(false); + } + } + else if (diagLevel == DIAG_ERROR) + { + this->SetSuppressDevWarnings(false); + this->SetDevWarningsAsErrors(true); + + if (setDeprecatedVariables) + { + this->SetSuppressDeprecatedWarnings(false); + this->SetDeprecatedWarningsAsErrors(true); } } } @@ -2565,16 +2589,45 @@ static bool cmakeCheckStampList(const char* stampList) return true; } +cmake::MessageType cmake::ConvertMessageType(cmake::MessageType t) +{ + bool warningsAsErrors; + + if (t == cmake::AUTHOR_WARNING || t == cmake::AUTHOR_ERROR) + { + warningsAsErrors = this->GetDevWarningsAsErrors(); + if (warningsAsErrors && t == cmake::AUTHOR_WARNING) + { + t = cmake::AUTHOR_ERROR; + } + else if (!warningsAsErrors && t == cmake::AUTHOR_ERROR) + { + t = cmake::AUTHOR_WARNING; + } + } + else if (t == cmake::DEPRECATION_WARNING || t == cmake::DEPRECATION_ERROR) + { + warningsAsErrors = this->GetDeprecatedWarningsAsErrors(); + if (warningsAsErrors && t == cmake::DEPRECATION_WARNING) + { + t = cmake::DEPRECATION_ERROR; + } + else if (!warningsAsErrors && t == cmake::DEPRECATION_ERROR) + { + t = cmake::DEPRECATION_WARNING; + } + } + + return t; +} + bool cmake::IsMessageTypeVisible(cmake::MessageType t) { bool isVisible = true; if(t == cmake::DEPRECATION_ERROR) { - // if CMAKE_ERROR_DEPRECATED is on, show the message, otherwise suppress it - const char* errorDeprecated = this->State->GetCacheEntryValue( - "CMAKE_ERROR_DEPRECATED"); - if(cmSystemTools::IsOff(errorDeprecated)) + if(!this->GetDeprecatedWarningsAsErrors()) { isVisible = false; } @@ -2586,6 +2639,13 @@ bool cmake::IsMessageTypeVisible(cmake::MessageType t) isVisible = false; } } + else if (t == cmake::AUTHOR_ERROR) + { + if (!this->GetDevWarningsAsErrors()) + { + isVisible = false; + } + } else if (t == cmake::AUTHOR_WARNING) { if (this->GetSuppressDevWarnings()) @@ -2624,6 +2684,10 @@ bool cmake::PrintMessagePreamble(cmake::MessageType t, std::ostream& msg) { msg << "CMake Warning (dev)"; } + else if (t == cmake::AUTHOR_ERROR) + { + msg << "CMake Error (dev)"; + } else { msg << "CMake Warning"; @@ -2648,6 +2712,12 @@ void displayMessage(cmake::MessageType t, std::ostringstream& msg) msg << "This warning is for project developers. Use -Wno-dev to suppress it."; } + else if (t == cmake::AUTHOR_ERROR) + { + msg << + "This error is for project developers. Use -Wno-error=dev to suppress " + "it."; + } // Add a terminating blank line. msg << "\n"; @@ -2671,7 +2741,8 @@ void displayMessage(cmake::MessageType t, std::ostringstream& msg) // Output the message. if(t == cmake::FATAL_ERROR || t == cmake::INTERNAL_ERROR - || t == cmake::DEPRECATION_ERROR) + || t == cmake::DEPRECATION_ERROR + || t == cmake::AUTHOR_ERROR) { cmSystemTools::SetErrorOccured(); cmSystemTools::Message(msg.str().c_str(), "Error"); @@ -2689,6 +2760,17 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text, { cmListFileBacktrace backtrace = bt; + if (!force) + { + // override the message type, if needed, for warnings and errors + cmake::MessageType override = this->ConvertMessageType(t); + if (override != t) + { + t = override; + force = true; + } + } + if (!force && !this->IsMessageTypeVisible(t)) { return; @@ -2716,6 +2798,17 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text, cmListFileContext const& lfc, bool force) { + if (!force) + { + // override the message type, if needed, for warnings and errors + cmake::MessageType override = this->ConvertMessageType(t); + if (override != t) + { + t = override; + force = true; + } + } + if (!force && !this->IsMessageTypeVisible(t)) { return; @@ -2881,21 +2974,6 @@ void cmake::RunCheckForUnusedVariables() #endif } -void cmake::SetSuppressDevWarnings(bool b) -{ - // equivalent to -Wno-dev - if (b) - { - this->DiagLevels["dev"] = DIAG_IGNORE; - } - // equivalent to -Wdev - else - { - this->DiagLevels["dev"] = std::max(this->DiagLevels["dev"], - DIAG_WARN); - } -} - bool cmake::GetSuppressDevWarnings(cmMakefile const* mf) { /* @@ -2914,6 +2992,27 @@ bool cmake::GetSuppressDevWarnings(cmMakefile const* mf) } } +void cmake::SetSuppressDevWarnings(bool b) +{ + std::string value; + + // equivalent to -Wno-dev + if (b) + { + value = "TRUE"; + } + // equivalent to -Wdev + else + { + value = "FALSE"; + } + + this->AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", value.c_str(), + "Suppress Warnings that are meant for" + " the author of the CMakeLists.txt files.", + cmState::INTERNAL); +} + bool cmake::GetSuppressDeprecatedWarnings(cmMakefile const* mf) { /* @@ -2932,3 +3031,95 @@ bool cmake::GetSuppressDeprecatedWarnings(cmMakefile const* mf) return cacheEntryValue && cmSystemTools::IsOff(cacheEntryValue); } } + +void cmake::SetSuppressDeprecatedWarnings(bool b) +{ + std::string value; + + // equivalent to -Wno-deprecated + if (b) + { + value = "FALSE"; + } + // equivalent to -Wdeprecated + else + { + value = "TRUE"; + } + + this->AddCacheEntry("CMAKE_WARN_DEPRECATED", value.c_str(), + "Whether to issue warnings for deprecated " + "functionality.", + cmState::INTERNAL); +} + +bool cmake::GetDevWarningsAsErrors(cmMakefile const* mf) +{ + if (mf) + { + return (mf->IsSet("CMAKE_SUPPRESS_DEVELOPER_ERRORS") && + !mf->IsOn("CMAKE_SUPPRESS_DEVELOPER_ERRORS")); + } + else + { + const char* cacheEntryValue = this->State->GetCacheEntryValue( + "CMAKE_SUPPRESS_DEVELOPER_ERRORS"); + return cacheEntryValue && cmSystemTools::IsOff(cacheEntryValue); + } +} + +void cmake::SetDevWarningsAsErrors(bool b) +{ + std::string value; + + // equivalent to -Werror=dev + if (b) + { + value = "FALSE"; + } + // equivalent to -Wno-error=dev + else + { + value = "TRUE"; + } + + this->AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_ERRORS", value.c_str(), + "Suppress errors that are meant for" + " the author of the CMakeLists.txt files.", + cmState::INTERNAL); +} + +bool cmake::GetDeprecatedWarningsAsErrors(cmMakefile const* mf) +{ + if (mf) + { + return mf->IsOn("CMAKE_ERROR_DEPRECATED"); + } + else + { + const char* cacheEntryValue = this->State->GetCacheEntryValue( + "CMAKE_ERROR_DEPRECATED"); + return cmSystemTools::IsOn(cacheEntryValue); + } +} + +void cmake::SetDeprecatedWarningsAsErrors(bool b) +{ + std::string value; + + // equivalent to -Werror=deprecated + if (b) + { + value = "TRUE"; + } + // equivalent to -Wno-error=deprecated + else + { + value = "FALSE"; + } + + this->AddCacheEntry("CMAKE_ERROR_DEPRECATED", value.c_str(), + "Whether to issue deprecation errors for macros" + " and functions.", + cmState::INTERNAL); +} diff --git a/Source/cmake.h b/Source/cmake.h index 4c5515b8a..84967056a 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -59,6 +59,7 @@ class cmake public: enum MessageType { AUTHOR_WARNING, + AUTHOR_ERROR, FATAL_ERROR, INTERNAL_ERROR, MESSAGE, @@ -71,7 +72,8 @@ class cmake enum DiagLevel { DIAG_IGNORE, - DIAG_WARN + DIAG_WARN, + DIAG_ERROR }; /** \brief Describes the working modes of cmake */ @@ -308,13 +310,16 @@ class cmake std::string const& GetCMakeEditCommand() const { return this->CMakeEditCommand; } - void SetSuppressDevWarnings(bool v); /* * Get the state of the suppression of developer (author) warnings. * Returns false, by default, if developer warnings should be shown, true * otherwise. */ bool GetSuppressDevWarnings(cmMakefile const* mf = NULL); + /* + * Set the state of the suppression of developer (author) warnings. + */ + void SetSuppressDevWarnings(bool v); /* * Get the state of the suppression of deprecated warnings. @@ -322,6 +327,32 @@ class cmake * otherwise. */ bool GetSuppressDeprecatedWarnings(cmMakefile const* mf = NULL); + /* + * Set the state of the suppression of deprecated warnings. + */ + void SetSuppressDeprecatedWarnings(bool v); + + /* + * Get the state of treating developer (author) warnings as errors. + * Returns false, by default, if warnings should not be treated as errors, + * true otherwise. + */ + bool GetDevWarningsAsErrors(cmMakefile const* mf = NULL); + /** + * Set the state of treating developer (author) warnings as errors. + */ + void SetDevWarningsAsErrors(bool v); + + /* + * Get the state of treating deprecated warnings as errors. + * Returns false, by default, if warnings should not be treated as errors, + * true otherwise. + */ + bool GetDeprecatedWarningsAsErrors(cmMakefile const* mf = NULL); + /** + * Set the state of treating developer (author) warnings as errors. + */ + void SetDeprecatedWarningsAsErrors(bool v); /** Display a message to the user. */ void IssueMessage(cmake::MessageType t, std::string const& text, @@ -434,6 +465,12 @@ private: // Print a list of valid generators to stderr. void PrintGeneratorList(); + /** + * Convert a message type between a warning and an error, based on the state + * of the error output CMake variables, in the cache. + */ + cmake::MessageType ConvertMessageType(cmake::MessageType t); + /* * Check if messages of this type should be output, based on the state of the * warning and error output CMake variables, in the cache. @@ -450,10 +487,16 @@ private: {"-G ", "Specify a build system generator."},\ {"-T ", "Specify toolset name if supported by generator."}, \ {"-A ", "Specify platform name if supported by generator."}, \ - {"-Wno-dev", "Suppress developer warnings."},\ {"-Wdev", "Enable developer warnings."},\ + {"-Wno-dev", "Suppress developer warnings."},\ + {"-Werror=dev", "Make developer warnings errors."},\ + {"-Wno-error=dev", "Make developer warnings not errors."},\ {"-Wdeprecated", "Enable deprecation warnings."},\ - {"-Wno-deprecated", "Suppress deprecation warnings."} + {"-Wno-deprecated", "Suppress deprecation warnings."},\ + {"-Werror=deprecated", "Make deprecated macro and function warnings " \ + "errors."},\ + {"-Wno-error=deprecated", "Make deprecated macro and function warnings " \ + "not errors."} #define FOR_EACH_C_FEATURE(F) \ F(c_function_prototypes) \ diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 21b126ba7..e9d77b250 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -52,25 +52,25 @@ void CMakeCommandUsage(const char* program) // If you add new commands, change here, // and in cmakemain.cxx in the options table errorStream - << "Usage: " << program << " -E [command] [arguments ...]\n" + << "Usage: " << program << " -E [arguments...]\n" << "Available commands: \n" - << " chdir dir cmd [args]... - run command in a given directory\n" + << " chdir dir cmd [args...] - run command in a given directory\n" << " compare_files file1 file2 - check if file1 is same as file2\n" - << " copy file destination - copy file to destination (either file " - "or directory)\n" - << " copy_directory source destination - copy directory 'source' " - "content to directory 'destination'\n" - << " copy_if_different in-file out-file - copy file if input has " + << " copy ... destination - copy files to destination " + "(either file or directory)\n" + << " copy_directory ... destination - copy content of ... " + "directories to 'destination' directory\n" + << " copy_if_different ... destination - copy files if it has " "changed\n" - << " echo [string]... - displays arguments as text\n" - << " echo_append [string]... - displays arguments as text but no new " + << " echo [...] - displays arguments as text\n" + << " echo_append [...] - displays arguments as text but no new " "line\n" << " env [--unset=NAME]... [NAME=VALUE]... COMMAND [ARG]...\n" << " - run command in a modified environment\n" << " environment - display the current environment\n" - << " make_directory dir - create a directory\n" - << " md5sum file1 [...] - compute md5sum of files\n" - << " remove [-f] file1 file2 ... - remove the file(s), use -f to force " + << " make_directory ... - create parent and directories\n" + << " md5sum ... - compute md5sum of files\n" + << " remove [-f] ... - remove the file(s), use -f to force " "it\n" << " remove_directory dir - remove a directory and its contents\n" << " rename oldname newname - rename a file or directory " @@ -78,7 +78,7 @@ void CMakeCommandUsage(const char* program) << " tar [cxt][vf][zjJ] file.tar [file/dir1 file/dir2 ...]\n" << " - create or extract a tar or zip archive\n" << " sleep ... - sleep for given number of seconds\n" - << " time command [args] ... - run command and return elapsed time\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" #if defined(_WIN32) && !defined(__CYGWIN__) @@ -149,42 +149,79 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) if (args.size() > 1) { // Copy file - if (args[1] == "copy" && args.size() == 4) + if (args[1] == "copy" && args.size() > 3) { - if(!cmSystemTools::cmCopyFile(args[2].c_str(), args[3].c_str())) + // If multiple source files specified, + // then destination must be directory + if ((args.size() > 4) && + (!cmSystemTools::FileIsDirectory(args[args.size() - 1]))) { - std::cerr << "Error copying file \"" << args[2] - << "\" to \"" << args[3] << "\".\n"; + std::cerr << "Error: Target (for copy command) \"" + << args[args.size() - 1] + << "\" is not a directory.\n"; return 1; } - return 0; + // If error occurs we want to continue copying next files. + bool return_value = 0; + for (std::string::size_type cc = 2; cc < args.size() - 1; cc ++) + { + if(!cmSystemTools::cmCopyFile(args[cc].c_str(), + args[args.size() - 1].c_str())) + { + std::cerr << "Error copying file \"" << args[cc] + << "\" to \"" << args[args.size() - 1] << "\".\n"; + return_value = 1; + } + } + return return_value; } // Copy file if different. - if (args[1] == "copy_if_different" && args.size() == 4) + if (args[1] == "copy_if_different" && args.size() > 3) { - if(!cmSystemTools::CopyFileIfDifferent(args[2].c_str(), - args[3].c_str())) + // If multiple source files specified, + // then destination must be directory + if ((args.size() > 4) && + (!cmSystemTools::FileIsDirectory(args[args.size() - 1]))) { - std::cerr << "Error copying file (if different) from \"" - << args[2] << "\" to \"" << args[3] - << "\".\n"; + std::cerr << "Error: Target (for copy_if_different command) \"" + << args[args.size() - 1] + << "\" is not a directory.\n"; return 1; } - return 0; + // If error occurs we want to continue copying next files. + bool return_value = 0; + for (std::string::size_type cc = 2; cc < args.size() - 1; cc ++) + { + if(!cmSystemTools::CopyFileIfDifferent(args[cc].c_str(), + args[args.size() - 1].c_str())) + { + std::cerr << "Error copying file (if different) from \"" + << args[cc] << "\" to \"" << args[args.size() - 1] + << "\".\n"; + return_value = 1; + } + } + return return_value; } // Copy directory content - if (args[1] == "copy_directory" && args.size() == 4) + if (args[1] == "copy_directory" && args.size() > 3) { - if(!cmSystemTools::CopyADirectory(args[2], args[3])) + // If error occurs we want to continue copying next files. + bool return_value = 0; + for (std::string::size_type cc = 2; cc < args.size() - 1; cc ++) { - std::cerr << "Error copying directory from \"" - << args[2] << "\" to \"" << args[3] - << "\".\n"; - return 1; + if(!cmSystemTools::CopyADirectory(args[cc].c_str(), + args[args.size() - 1].c_str())) + { + std::cerr << "Error copying directory from \"" + << args[cc] << "\" to \"" << args[args.size() - 1] + << "\".\n"; + return_value = 1; + } } - return 0; + return return_value; } // Rename a file or directory @@ -324,11 +361,10 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) } // Now run the real compiler command and return its result value. - if(!cmSystemTools::RunSingleCommand(orig_cmd, 0, &stdErr, &ret, 0, + if(!cmSystemTools::RunSingleCommand(orig_cmd, 0, 0, &ret, 0, cmSystemTools::OUTPUT_PASSTHROUGH)) { - std::cerr << "Error running '" << orig_cmd[0] << "': " - << stdErr << "\n"; + std::cerr << "Error running '" << orig_cmd[0] << "'\n"; return 1; } return ret; @@ -410,15 +446,20 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) } #endif - else if (args[1] == "make_directory" && args.size() == 3) + else if (args[1] == "make_directory" && args.size() > 2) { - if(!cmSystemTools::MakeDirectory(args[2].c_str())) + // If error occurs we want to continue copying next files. + bool return_value = 0; + for (std::string::size_type cc = 2; cc < args.size(); cc ++) { - std::cerr << "Error making directory \"" << args[2] - << "\".\n"; - return 1; + if(!cmSystemTools::MakeDirectory(args[cc].c_str())) + { + std::cerr << "Error creating directory \"" + << args[cc] << "\".\n"; + return_value = 1; + } } - return 0; + return return_value; } else if (args[1] == "remove_directory" && args.size() == 3) @@ -513,7 +554,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) // Clock command else if (args[1] == "time" && args.size() > 2) { - std::string command = cmJoin(cmMakeRange(args).advance(2), " "); + std::vector command(args.begin()+2, args.end()); clock_t clock_start, clock_finish; time_t time_start, time_finish; @@ -521,7 +562,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) time(&time_start); clock_start = clock(); int ret =0; - cmSystemTools::RunSingleCommand(command.c_str(), 0, 0, &ret); + cmSystemTools::RunSingleCommand(command, 0, 0, &ret); clock_finish = clock(); time(&time_finish); @@ -579,7 +620,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) int retval = 0; int timeout = 0; if ( cmSystemTools::RunSingleCommand(command.c_str(), 0, 0, &retval, - directory.c_str(), cmSystemTools::OUTPUT_NORMAL, timeout) ) + directory.c_str(), cmSystemTools::OUTPUT_PASSTHROUGH, timeout) ) { return retval; } @@ -772,10 +813,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) { cm.SetGlobalGenerator(ggd); cmState::Snapshot snapshot = cm.GetCurrentSnapshot(); - snapshot.GetDirectory().SetCurrentBinary - (cmSystemTools::GetCurrentWorkingDirectory()); - snapshot.GetDirectory().SetCurrentSource - (cmSystemTools::GetCurrentWorkingDirectory()); + snapshot.GetDirectory().SetCurrentBinary(startOutDir); + snapshot.GetDirectory().SetCurrentSource(startDir); cmsys::auto_ptr mf(new cmMakefile(ggd, snapshot)); cmsys::auto_ptr lgd( ggd->CreateLocalGenerator(mf.get())); diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index ce7f5635d..8b1539416 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -118,13 +118,11 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) SET(KWSYS_USE_System 1) SET(KWSYS_USE_SystemTools 1) SET(KWSYS_USE_CommandLineArguments 1) - SET(KWSYS_USE_FundamentalType 1) SET(KWSYS_USE_Terminal 1) SET(KWSYS_USE_IOStream 1) SET(KWSYS_USE_FStream 1) SET(KWSYS_USE_String 1) SET(KWSYS_USE_SystemInformation 1) - SET(KWSYS_USE_CPU 1) ENDIF() # Enforce component dependencies. @@ -375,68 +373,6 @@ IF(KWSYS_CXX_HAS___INT64) ENDIF() ENDIF() -IF(KWSYS_USE_FundamentalType) - # Look for type size helper macros. - KWSYS_PLATFORM_INFO_TEST(C KWSYS_C_TYPE_MACROS - "Checking for C type size macros") - SET(macro_regex ".*INFO:macro\\[([^]]*)\\].*") - FOREACH(info ${KWSYS_C_TYPE_MACROS}) - IF("${info}" MATCHES "${macro_regex}") - STRING(REGEX REPLACE "${macro_regex}" "\\1" macro "${info}") - SET(KWSYS_C_HAS_MACRO_${macro} 1) - ENDIF() - ENDFOREACH() - - # Determine type sizes at preprocessing time if possible, and - # otherwise fall back to a try-compile. - SET(KWSYS_C_TYPE_NAME_CHAR "char") - SET(KWSYS_C_TYPE_NAME_SHORT "short") - SET(KWSYS_C_TYPE_NAME_INT "int") - SET(KWSYS_C_TYPE_NAME_LONG "long") - SET(KWSYS_C_TYPE_NAME_LONG_LONG "long long") - SET(KWSYS_C_TYPE_NAME___INT64 "__int64") - FOREACH(type CHAR SHORT INT LONG LONG_LONG __INT64) - IF(KWSYS_C_HAS_MACRO___SIZEOF_${type}__) - # Use __SIZEOF_${type}__ macro. - SET(KWSYS_SIZEOF_${type} TRUE) - SET(KWSYS_C_CODE_SIZEOF_${type} "#define ${KWSYS_NAMESPACE}_SIZEOF_${type} __SIZEOF_${type}__") - ELSEIF(KWSYS_C_HAS_MACRO___${type}_MAX__) - # Use __${type}_MAX__ macro. - SET(KWSYS_SIZEOF_${type} TRUE) - SET(KWSYS_C_CODE_SIZEOF_${type} "#if __${type}_MAX__ == 0x7f -# define ${KWSYS_NAMESPACE}_SIZEOF_${type} 1 -#elif __${type}_MAX__ == 0x7fff -# define ${KWSYS_NAMESPACE}_SIZEOF_${type} 2 -#elif __${type}_MAX__ == 0x7fffffff -# define ${KWSYS_NAMESPACE}_SIZEOF_${type} 4 -#elif __${type}_MAX__>>32 == 0x7fffffff -# define ${KWSYS_NAMESPACE}_SIZEOF_${type} 8 -#else -# error \"Cannot determine sizeof(${KWSYS_C_TYPE_NAME_${type}}).\" -#endif") - ELSE() - # Configure a hard-coded type size. - CHECK_TYPE_SIZE("${KWSYS_C_TYPE_NAME_${type}}" KWSYS_SIZEOF_${type}) - IF(NOT KWSYS_SIZEOF_${type}) - SET(KWSYS_SIZEOF_${type} 0) - ENDIF() - SET(KWSYS_C_CODE_SIZEOF_${type} - "#define ${KWSYS_NAMESPACE}_SIZEOF_${type} ${KWSYS_SIZEOF_${type}}") - ENDIF() - ENDFOREACH() - - IF(KWSYS_USE___INT64) - KWSYS_PLATFORM_CXX_TEST(KWSYS_CAN_CONVERT_UI64_TO_DOUBLE - "Checking whether unsigned __int64 can convert to double" DIRECT) - ELSE() - SET(KWSYS_CAN_CONVERT_UI64_TO_DOUBLE 1) - ENDIF() - - # Check signedness of "char" type. - KWSYS_PLATFORM_CXX_TEST_RUN(KWSYS_CHAR_IS_SIGNED - "Checking whether char is signed" DIRECT) -ENDIF() - IF(KWSYS_USE_Encoding) # Look for type size helper macros. KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_WSTRING @@ -749,7 +685,7 @@ ENDFOREACH() # Add selected C components. FOREACH(c - Process Base64 Encoding FundamentalType MD5 Terminal System String CPU + Process Base64 Encoding MD5 Terminal System String ) IF(KWSYS_USE_${c}) # Use the corresponding header file. diff --git a/Source/kwsys/CPU.h.in b/Source/kwsys/CPU.h.in deleted file mode 100644 index 66ffbb1fd..000000000 --- a/Source/kwsys/CPU.h.in +++ /dev/null @@ -1,141 +0,0 @@ -/*============================================================================ - KWSys - Kitware System Library - 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 @KWSYS_NAMESPACE@_CPU_h -#define @KWSYS_NAMESPACE@_CPU_h - -#include <@KWSYS_NAMESPACE@/Configure.h> - -/* Identify possible endian cases. The macro - @KWSYS_NAMESPACE@_CPU_ENDIAN_ID will be defined to one of these, or - 0 if unknown. */ -#define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG 4321 -#define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE 1234 - -/* Apple always defines one of these. */ -#if defined(__LITTLE_ENDIAN__) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE -#elif defined(__BIG_ENDIAN__) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG - -/* Alpha */ -#elif defined(__alpha) || defined(__alpha__) || defined(_M_ALPHA) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE - -/* Arm */ -#elif defined(__arm__) -# if !defined(__ARMEB__) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE -# else -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG -# endif - -/* Intel x86 */ -#elif defined(__i386) || defined(__i386__) || defined(_M_IX86) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE -#elif defined(_X86_) || defined(__THW_INTEL__) || defined(__I86__) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE -#elif defined(__MWERKS__) && defined(__INTEL__) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE - -/* Intel x86-64 */ -#elif defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE -#elif defined(__amd64) || defined(__amd64__) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE - -/* Intel Architecture-64 (Itanium) */ -#elif defined(__ia64) || defined(__ia64__) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE -#elif defined(_IA64) || defined(__IA64__) || defined(_M_IA64) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE - -/* PowerPC */ -#elif defined(__powerpc) || defined(__powerpc__) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG -#elif defined(__ppc) || defined(__ppc__) || defined(__POWERPC__) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG - -/* SPARC */ -#elif defined(__sparc) || defined(__sparc__) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG - -/* HP/PA RISC */ -#elif defined(__hppa) || defined(__hppa__) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG - -/* Motorola 68k */ -#elif defined(__m68k__) || defined(M68000) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG - -/* MIPSel (MIPS little endian) */ -#elif defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE - -/* MIPSeb (MIPS big endian) */ -#elif defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG - -/* MIPS (fallback, big endian) */ -#elif defined(__mips) || defined(__mips__) || defined(__MIPS__) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG - -/* NIOS2 */ -#elif defined(__NIOS2__) || defined(__NIOS2) || defined(__nios2__) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE - -/* OpenRISC 1000 */ -#elif defined(__or1k__) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG - -/* RS/6000 */ -#elif defined(__THW_RS600) || defined(_IBMR2) || defined(_POWER) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG -#elif defined(_ARCH_PWR) || defined(_ARCH_PWR2) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG - -/* System/370 */ -#elif defined(__370__) || defined(__THW_370__) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG - -/* System/390 */ -#elif defined(__s390__) || defined(__s390x__) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG - -/* z/Architecture */ -#elif defined(__SYSC_ZARCH__) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG - -/* Aarch64 */ -#elif defined(__aarch64__) -# if !defined(__AARCH64EB__) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE -# else -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG -# endif - -/* Unknown CPU */ -#else -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID 0 -# if !defined(@KWSYS_NAMESPACE@_CPU_UNKNOWN_OKAY) -# error "The target CPU architecture is not known." -# endif -#endif - -/* If building a C or C++ file in kwsys itself, give the source file - access to the macros without a configured namespace. */ -#if defined(KWSYS_NAMESPACE) -# define KWSYS_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID -# define KWSYS_CPU_ENDIAN_ID_BIG @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG -# define KWSYS_CPU_ENDIAN_ID_LITTLE @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE -#endif - -#endif diff --git a/Source/kwsys/Configure.h.in b/Source/kwsys/Configure.h.in index 70cf8442b..cd2d96519 100644 --- a/Source/kwsys/Configure.h.in +++ b/Source/kwsys/Configure.h.in @@ -115,6 +115,11 @@ # pragma warning (disable: 4710) /* function not inlined */ # pragma warning (disable: 4786) /* identifier truncated in debug info */ # endif +# if defined(__BORLANDC__) && !defined(__cplusplus) + /* Code has no effect; raised by winnt.h in C (not C++) when ignoring an + unused parameter using "(param)" syntax (i.e. no cast to void). */ +# pragma warn -8019 +# endif #endif /* MSVC 6.0 in release mode will warn about code it produces with its diff --git a/Source/kwsys/FStream.cxx b/Source/kwsys/FStream.cxx index 018652c84..5a30997d6 100644 --- a/Source/kwsys/FStream.cxx +++ b/Source/kwsys/FStream.cxx @@ -34,6 +34,7 @@ BOM ReadBOM(std::istream& in) in.read(reinterpret_cast(bom), 2); if(!in.good()) { + in.clear(); in.seekg(orig); return BOM_None; } @@ -68,6 +69,7 @@ BOM ReadBOM(std::istream& in) in.seekg(p); return BOM_UTF16LE; } + in.clear(); in.seekg(orig); return BOM_None; } diff --git a/Source/kwsys/FundamentalType.h.in b/Source/kwsys/FundamentalType.h.in deleted file mode 100644 index ff200633a..000000000 --- a/Source/kwsys/FundamentalType.h.in +++ /dev/null @@ -1,146 +0,0 @@ -/*============================================================================ - KWSys - Kitware System Library - 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 @KWSYS_NAMESPACE@_FundamentalType_h -#define @KWSYS_NAMESPACE@_FundamentalType_h - -#include <@KWSYS_NAMESPACE@/Configure.h> - -/* Redefine all public interface symbol names to be in the proper - namespace. These macros are used internally to kwsys only, and are - not visible to user code. Use kwsysHeaderDump.pl to reproduce - these macros after making changes to the interface. */ -#if !defined(KWSYS_NAMESPACE) -# define kwsys_ns(x) @KWSYS_NAMESPACE@##x -# define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT -#endif - -#if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS -# define kwsysFundamentalType kwsys_ns(FundamentalType) -# define kwsysFundamentalType_Int8 kwsys_ns(FundamentalType_Int8) -# define kwsysFundamentalType_UInt8 kwsys_ns(FundamentalType_UInt8) -# define kwsysFundamentalType_Int16 kwsys_ns(FundamentalType_Int16) -# define kwsysFundamentalType_UInt16 kwsys_ns(FundamentalType_UInt16) -# define kwsysFundamentalType_Int32 kwsys_ns(FundamentalType_Int32) -# define kwsysFundamentalType_UInt32 kwsys_ns(FundamentalType_UInt32) -# define kwsysFundamentalType_Int64 kwsys_ns(FundamentalType_Int64) -# define kwsysFundamentalType_UInt64 kwsys_ns(FundamentalType_UInt64) -#endif - -/* The size of fundamental types. Types that do not exist have size 0. */ -@KWSYS_C_CODE_SIZEOF_CHAR@ -@KWSYS_C_CODE_SIZEOF_SHORT@ -@KWSYS_C_CODE_SIZEOF_INT@ -@KWSYS_C_CODE_SIZEOF_LONG@ -@KWSYS_C_CODE_SIZEOF_LONG_LONG@ -@KWSYS_C_CODE_SIZEOF___INT64@ - -/* Whether types "long long" and "__int64" are enabled. If a type is - enabled then it is a unique fundamental type. */ -#define @KWSYS_NAMESPACE@_USE_LONG_LONG @KWSYS_USE_LONG_LONG@ -#define @KWSYS_NAMESPACE@_USE___INT64 @KWSYS_USE___INT64@ - -/* Whether type "char" is signed (it may be signed or unsigned). */ -#define @KWSYS_NAMESPACE@_CHAR_IS_SIGNED @KWSYS_CHAR_IS_SIGNED@ - -#if defined(__cplusplus) -extern "C" -{ -#endif - -/* Select an 8-bit integer type. */ -#if @KWSYS_NAMESPACE@_SIZEOF_CHAR == 1 -typedef signed char kwsysFundamentalType_Int8; -typedef unsigned char kwsysFundamentalType_UInt8; -#else -# error "No native data type can represent an 8-bit integer." -#endif - -/* Select a 16-bit integer type. */ -#if @KWSYS_NAMESPACE@_SIZEOF_SHORT == 2 -typedef short kwsysFundamentalType_Int16; -typedef unsigned short kwsysFundamentalType_UInt16; -#elif @KWSYS_NAMESPACE@_SIZEOF_INT == 2 -typedef int kwsysFundamentalType_Int16; -typedef unsigned int kwsysFundamentalType_UInt16; -#else -# error "No native data type can represent a 16-bit integer." -#endif - -/* Select a 32-bit integer type. */ -#if @KWSYS_NAMESPACE@_SIZEOF_INT == 4 -typedef int kwsysFundamentalType_Int32; -typedef unsigned int kwsysFundamentalType_UInt32; -#elif @KWSYS_NAMESPACE@_SIZEOF_LONG == 4 -typedef long kwsysFundamentalType_Int32; -typedef unsigned long kwsysFundamentalType_UInt32; -#else -# error "No native data type can represent a 32-bit integer." -#endif - -/* Select a 64-bit integer type. */ -#if @KWSYS_NAMESPACE@_SIZEOF_LONG == 8 -typedef signed long kwsysFundamentalType_Int64; -typedef unsigned long kwsysFundamentalType_UInt64; -/* Whether UInt64 can be converted to double. */ -# define @KWSYS_NAMESPACE@_CAN_CONVERT_UI64_TO_DOUBLE 1 -#elif @KWSYS_NAMESPACE@_USE_LONG_LONG && @KWSYS_NAMESPACE@_SIZEOF_LONG_LONG == 8 -typedef signed long long kwsysFundamentalType_Int64; -typedef unsigned long long kwsysFundamentalType_UInt64; -/* Whether UInt64 can be converted to double. */ -# define @KWSYS_NAMESPACE@_CAN_CONVERT_UI64_TO_DOUBLE 1 -#elif @KWSYS_NAMESPACE@_USE___INT64 && @KWSYS_NAMESPACE@_SIZEOF___INT64 == 8 -typedef signed __int64 kwsysFundamentalType_Int64; -typedef unsigned __int64 kwsysFundamentalType_UInt64; -/* Whether UInt64 can be converted to double. */ -# define @KWSYS_NAMESPACE@_CAN_CONVERT_UI64_TO_DOUBLE @KWSYS_CAN_CONVERT_UI64_TO_DOUBLE@ -#else -# error "No native data type can represent a 64-bit integer." -#endif - -#if defined(__cplusplus) -} /* extern "C" */ -#endif - -/* If we are building a kwsys .c or .cxx file, let it use these macros. - Otherwise, undefine them to keep the namespace clean. */ -#if !defined(KWSYS_NAMESPACE) -# undef kwsys_ns -# undef kwsysEXPORT -# if !defined(KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS -# undef kwsysFundamentalType -# undef kwsysFundamentalType_Int8 -# undef kwsysFundamentalType_UInt8 -# undef kwsysFundamentalType_Int16 -# undef kwsysFundamentalType_UInt16 -# undef kwsysFundamentalType_Int32 -# undef kwsysFundamentalType_UInt32 -# undef kwsysFundamentalType_Int64 -# undef kwsysFundamentalType_UInt64 -# endif -#endif - -/* If building a C or C++ file in kwsys itself, give the source file - access to the configured macros without a configured namespace. */ -#if defined(KWSYS_NAMESPACE) -# define KWSYS_SIZEOF_CHAR @KWSYS_NAMESPACE@_SIZEOF_CHAR -# define KWSYS_SIZEOF_SHORT @KWSYS_NAMESPACE@_SIZEOF_SHORT -# define KWSYS_SIZEOF_INT @KWSYS_NAMESPACE@_SIZEOF_INT -# define KWSYS_SIZEOF_LONG @KWSYS_NAMESPACE@_SIZEOF_LONG -# define KWSYS_SIZEOF_LONG_LONG @KWSYS_NAMESPACE@_SIZEOF_LONG_LONG -# define KWSYS_SIZEOF___INT64 @KWSYS_NAMESPACE@_SIZEOF___INT64 -# define KWSYS_USE_LONG_LONG @KWSYS_NAMESPACE@_USE_LONG_LONG -# define KWSYS_USE___INT64 @KWSYS_NAMESPACE@_USE___INT64 -# define KWSYS_CHAR_IS_SIGNED @KWSYS_NAMESPACE@_CHAR_IS_SIGNED -# define KWSYS_CAN_CONVERT_UI64_TO_DOUBLE @KWSYS_NAMESPACE@_CAN_CONVERT_UI64_TO_DOUBLE -#endif - -#endif diff --git a/Source/kwsys/MD5.c b/Source/kwsys/MD5.c index a1470572d..b9d25a8d7 100644 --- a/Source/kwsys/MD5.c +++ b/Source/kwsys/MD5.c @@ -29,7 +29,7 @@ it in a single source file instead of a separate header and implementation file. */ -#if defined(__clang__) +#if defined(__clang__) && !defined(__INTEL_COMPILER) # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wcast-align" #endif @@ -433,7 +433,7 @@ static void md5_finish(md5_state_t *pms, md5_byte_t digest[16]) digest[i] = (md5_byte_t)(pms->abcd[i >> 2] >> ((i & 3) << 3)); } -#if defined(__clang__) +#if defined(__clang__) && !defined(__INTEL_COMPILER) # pragma clang diagnostic pop #endif diff --git a/Source/kwsys/ProcessUNIX.c b/Source/kwsys/ProcessUNIX.c index b0ddf5a13..07c644b8e 100644 --- a/Source/kwsys/ProcessUNIX.c +++ b/Source/kwsys/ProcessUNIX.c @@ -1595,12 +1595,12 @@ static void kwsysProcessVolatileFree(volatile void* p) { /* clang has made it impossible to free memory that points to volatile without first using special pragmas to disable a warning... */ -#if defined(__clang__) +#if defined(__clang__) && !defined(__INTEL_COMPILER) # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wcast-qual" #endif free((void*)p); /* The cast will silence most compilers, but not clang. */ -#if defined(__clang__) +#if defined(__clang__) && !defined(__INTEL_COMPILER) # pragma clang diagnostic pop #endif } diff --git a/Source/kwsys/SharedForward.h.in b/Source/kwsys/SharedForward.h.in index f22fa580a..f80ef8470 100644 --- a/Source/kwsys/SharedForward.h.in +++ b/Source/kwsys/SharedForward.h.in @@ -74,6 +74,12 @@ # endif #endif +#if defined(__BORLANDC__) && !defined(__cplusplus) + /* Code has no effect; raised by winnt.h in C (not C++) when ignoring an + unused parameter using "(param)" syntax (i.e. no cast to void). */ +# pragma warn -8019 +#endif + /*--------------------------------------------------------------------------*/ /* Full path to the directory in which this executable is built. Do diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 37fe42199..e3428f878 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -2402,8 +2402,7 @@ bool SystemTools::CopyFileAlways(const std::string& source, const std::string& d // name as the source in that directory. std::string destination_dir; - if(SystemTools::FileExists(destination) && - SystemTools::FileIsDirectory(destination)) + if(SystemTools::FileIsDirectory(destination)) { destination_dir = real_destination; SystemTools::ConvertToUnixSlashes(real_destination); @@ -2969,19 +2968,14 @@ std::string SystemTools::FindProgram( const std::vector& userPaths, bool no_system_path) { - std::vector extensions; std::string tryPath; #if defined (_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) - bool hasExtension = false; + std::vector extensions; // check to see if the name already has a .xxx at // the end of it - if(name.size() > 3 && name[name.size()-4] == '.') - { - hasExtension = true; - } // on windows try .com then .exe - if(!hasExtension) + if(name.size() <= 3 || name[name.size()-4] != '.') { extensions.push_back(".com"); extensions.push_back(".exe"); @@ -2992,8 +2986,7 @@ std::string SystemTools::FindProgram( { tryPath = name; tryPath += *i; - if(SystemTools::FileExists(tryPath) && - !SystemTools::FileIsDirectory(tryPath)) + if(SystemTools::FileExists(tryPath, true)) { return SystemTools::CollapseFullPath(tryPath); } @@ -3002,11 +2995,9 @@ std::string SystemTools::FindProgram( #endif // now try just the name - tryPath = name; - if(SystemTools::FileExists(tryPath) && - !SystemTools::FileIsDirectory(tryPath)) + if(SystemTools::FileExists(name, true)) { - return SystemTools::CollapseFullPath(tryPath); + return SystemTools::CollapseFullPath(name); } // now construct the path std::vector path; @@ -3043,6 +3034,7 @@ std::string SystemTools::FindProgram( // Remove double quotes from the path on windows SystemTools::ReplaceString(*p, "\"", ""); #endif +#if defined (_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) // first try with extensions for(std::vector::iterator ext = extensions.begin(); ext != extensions.end(); ++ext) @@ -3055,6 +3047,7 @@ std::string SystemTools::FindProgram( return SystemTools::CollapseFullPath(tryPath); } } +#endif // now try it without them tryPath = *p; tryPath += name; @@ -3133,8 +3126,7 @@ std::string SystemTools tryPath = *p; tryPath += name; tryPath += ".framework"; - if(SystemTools::FileExists(tryPath) - && SystemTools::FileIsDirectory(tryPath)) + if(SystemTools::FileIsDirectory(tryPath)) { return SystemTools::CollapseFullPath(tryPath); } @@ -4499,36 +4491,27 @@ bool SystemTools::FileIsFullPath(const char* in_name, size_t len) bool SystemTools::GetShortPath(const std::string& path, std::string& shortPath) { #if defined(_WIN32) && !defined(__CYGWIN__) - const int size = int(path.size()) +1; // size of return - char *tempPath = new char[size]; // create a buffer - DWORD ret; + std::string tempPath = path; // create a buffer // if the path passed in has quotes around it, first remove the quotes if (!path.empty() && path[0] == '"' && *path.rbegin() == '"') { - strcpy(tempPath,path.c_str()+1); - tempPath[size-2] = '\0'; - } - else - { - strcpy(tempPath,path.c_str()); + tempPath = path.substr(1, path.length()-2); } std::wstring wtempPath = Encoding::ToWide(tempPath); - std::vector buffer(wtempPath.size()+1); - buffer[0] = 0; + DWORD ret = GetShortPathNameW(wtempPath.c_str(), NULL, 0); + std::vector buffer(ret); ret = GetShortPathNameW(wtempPath.c_str(), - &buffer[0], static_cast(wtempPath.size())); + &buffer[0], static_cast(buffer.size())); - if(buffer[0] == 0 || ret > wtempPath.size()) + if (ret == 0) { - delete [] tempPath; return false; } else { shortPath = Encoding::ToNarrow(&buffer[0]); - delete [] tempPath; return true; } #else diff --git a/Source/kwsys/kwsysPlatformTestsCXX.cxx b/Source/kwsys/kwsysPlatformTestsCXX.cxx index 962693705..fc87f9135 100644 --- a/Source/kwsys/kwsysPlatformTestsCXX.cxx +++ b/Source/kwsys/kwsysPlatformTestsCXX.cxx @@ -78,21 +78,6 @@ int main() } #endif -#ifdef TEST_KWSYS_CAN_CONVERT_UI64_TO_DOUBLE -void function(double& l, unsigned __int64 const& r) -{ - l = static_cast(r); -} - -int main() -{ - double tTo = 0.0; - unsigned __int64 tFrom = 0; - function(tTo, tFrom); - return 0; -} -#endif - #ifdef TEST_KWSYS_IOS_HAS_ISTREAM_LONG_LONG # include int test_istream(std::istream& is, long long& x) @@ -145,15 +130,6 @@ int main() } #endif -#ifdef TEST_KWSYS_CHAR_IS_SIGNED -/* Return 0 for char signed and 1 for char unsigned. */ -int main() -{ - unsigned char uc = 255; - return (*reinterpret_cast(&uc) < 0)?0:1; -} -#endif - #ifdef TEST_KWSYS_LFS_WORKS /* Return 0 when LFS is available and 1 otherwise. */ #define _LARGEFILE_SOURCE @@ -341,93 +317,6 @@ int main() } #endif -#ifdef TEST_KWSYS_CXX_TYPE_INFO -/* Collect fundamental type information and save it to a CMake script. */ - -/* Include limits.h to get macros indicating long long and __int64. - Note that certain compilers need special macros to define these - macros in limits.h. */ -#if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS) -# define _MSC_EXTENSIONS -#endif -#if defined(__GNUC__) && __GNUC__ < 3 -# define _GNU_SOURCE -#endif -#include - -#include -#include - -/* Due to shell differences and limitations of ADD_DEFINITIONS the - KWSYS_CXX_TYPE_INFO_FILE macro will sometimes have double quotes - and sometimes not. This macro will make sure the value is treated - as a double-quoted string. */ -#define TO_STRING(x) TO_STRING0(x) -#define TO_STRING0(x) TO_STRING1(x) -#define TO_STRING1(x) #x - -void f() {} - -int main() -{ - /* Construct the output file name. Some preprocessors will add an - extra level of double quotes, so strip them. */ - char fbuf[] = TO_STRING(KWSYS_CXX_TYPE_INFO_FILE); - char* fname = fbuf; - if(fname[0] == '"') - { - ++fname; - int len = static_cast(strlen(fname)); - if(len > 0 && fname[len-1] == '"') - { - fname[len-1] = 0; - } - } - - /* Try to open the output file. */ - if(FILE* fout = fopen(fname, "w")) - { - /* Set the size of standard types. */ - fprintf(fout, "SET(KWSYS_SIZEOF_CHAR %d)\n", static_cast(sizeof(char))); - fprintf(fout, "SET(KWSYS_SIZEOF_SHORT %d)\n", static_cast(sizeof(short))); - fprintf(fout, "SET(KWSYS_SIZEOF_INT %d)\n", static_cast(sizeof(int))); - fprintf(fout, "SET(KWSYS_SIZEOF_LONG %d)\n", static_cast(sizeof(long))); - - /* Set the size of some non-standard but common types. */ - /* Check for a limits.h macro for long long to see if the type exists. */ -#if defined(LLONG_MAX) || defined(LONG_LONG_MAX) || defined(LONGLONG_MAX) - fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG %d)\n", static_cast(sizeof(long long))); -#else - fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG 0) # No long long available.\n"); -#endif - /* Check for a limits.h macro for __int64 to see if the type exists. */ -#if defined(_I64_MIN) - fprintf(fout, "SET(KWSYS_SIZEOF___INT64 %d)\n", static_cast(sizeof(__int64))); -#else - fprintf(fout, "SET(KWSYS_SIZEOF___INT64 0) # No __int64 available.\n"); -#endif - - /* Set the size of some pointer types. */ - fprintf(fout, "SET(KWSYS_SIZEOF_PDATA %d)\n", static_cast(sizeof(void*))); - fprintf(fout, "SET(KWSYS_SIZEOF_PFUNC %d)\n", static_cast(sizeof(&f))); - - /* Set whether the native type "char" is signed or unsigned. */ - unsigned char uc = 255; - fprintf(fout, "SET(KWSYS_CHAR_IS_SIGNED %d)\n", - (*reinterpret_cast(&uc) < 0)?1:0); - - fclose(fout); - return 0; - } - else - { - fprintf(stderr, "Failed to write fundamental type info to \"%s\".\n", - fname); - return 1; - } -} -#endif - #ifdef TEST_KWSYS_CXX_HAS_BORLAND_ASM int main() { diff --git a/Source/kwsys/testFStream.cxx b/Source/kwsys/testFStream.cxx index ac5220ac0..5e537258f 100644 --- a/Source/kwsys/testFStream.cxx +++ b/Source/kwsys/testFStream.cxx @@ -41,8 +41,13 @@ static int testNoFile() return 0; } -static kwsys::FStream::BOM expected_bom[5] = +static const int num_test_files = 7; +static const int max_test_file_size = 45; + +static kwsys::FStream::BOM expected_bom[num_test_files] = { + kwsys::FStream::BOM_None, + kwsys::FStream::BOM_None, kwsys::FStream::BOM_UTF8, kwsys::FStream::BOM_UTF16LE, kwsys::FStream::BOM_UTF16BE, @@ -50,8 +55,10 @@ static kwsys::FStream::BOM expected_bom[5] = kwsys::FStream::BOM_UTF32BE }; -static unsigned char expected_bom_data[5][5] = +static unsigned char expected_bom_data[num_test_files][5] = { + {0}, + {0}, {3, 0xEF, 0xBB, 0xBF}, {2, 0xFF, 0xFE}, {2, 0xFE, 0xFF}, @@ -59,8 +66,10 @@ static unsigned char expected_bom_data[5][5] = {4, 0x00, 0x00, 0xFE, 0xFF}, }; -static unsigned char file_data[5][45] = +static unsigned char file_data[num_test_files][max_test_file_size] = { + {1, 'H'}, + {11, 'H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd'}, {11, 'H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd'}, {22, 0x48, 0x00, 0x65, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x6F, 0x00, 0x20, 0x00, 0x57, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x6C, 0x00, 0x64, 0x00}, @@ -80,7 +89,7 @@ static unsigned char file_data[5][45] = static int testBOM() { // test various encodings in binary mode - for(int i=0; i<5; i++) + for(int i=0; i(expected_bom_data[0]+1), - *expected_bom_data[0]); - out << "Hello World"; - } - - kwsys::ifstream in("bom.txt"); - kwsys::FStream::BOM bom = kwsys::FStream::ReadBOM(in); - if(bom != kwsys::FStream::BOM_UTF8) - { - std::cout << "Unexpected BOM for utf-8 case" << std::endl; - return 1; - } - char data[45]; - in.read(data, file_data[0][0]); - if(!in.good()) - { - std::cout << "Unable to read data for utf-8 case" << std::endl; - return 1; - } - - if(memcmp(data, file_data[0]+1, file_data[0][0]) != 0) - { - std::cout << "Incorrect read data for utf-8 case" << std::endl; - return 1; - } - } - return 0; } diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx index a0f904f72..4d97688fc 100644 --- a/Source/kwsys/testSystemTools.cxx +++ b/Source/kwsys/testSystemTools.cxx @@ -172,6 +172,63 @@ static bool CheckFileOperations() << testNewDir << std::endl; res = false; } + // calling it again should just return true + if (!kwsys::SystemTools::MakeDirectory(testNewDir)) + { + std::cerr + << "Problem with second call to MakeDirectory for: " + << testNewDir << std::endl; + res = false; + } + // calling with 0 pointer should return false + if (kwsys::SystemTools::MakeDirectory(0)) + { + std::cerr + << "Problem with MakeDirectory(0)" + << std::endl; + res = false; + } + // calling with an empty string should return false + if (kwsys::SystemTools::MakeDirectory(std::string())) + { + std::cerr + << "Problem with MakeDirectory(std::string())" + << std::endl; + res = false; + } + // check existence + if (!kwsys::SystemTools::FileExists(testNewDir.c_str(), false)) + { + std::cerr + << "Problem with FileExists as C string and not file for: " + << testNewDir << std::endl; + res = false; + } + // remove it + if (!kwsys::SystemTools::RemoveADirectory(testNewDir)) + { + std::cerr + << "Problem with RemoveADirectory for: " + << testNewDir << std::endl; + res = false; + } + // check existence + if (kwsys::SystemTools::FileExists(testNewDir.c_str(), false)) + { + std::cerr + << "After RemoveADirectory: " + << "Problem with FileExists as C string and not file for: " + << testNewDir << std::endl; + res = false; + } + // create it using the char* version + if (!kwsys::SystemTools::MakeDirectory(testNewDir.c_str())) + { + std::cerr + << "Problem with second call to MakeDirectory as C string for: " + << testNewDir << std::endl; + res = false; + } if (!kwsys::SystemTools::Touch(testNewFile.c_str(), true)) { @@ -180,6 +237,97 @@ static bool CheckFileOperations() << testNewFile << std::endl; res = false; } + // calling MakeDirectory with something that is no file should fail + if (kwsys::SystemTools::MakeDirectory(testNewFile)) + { + std::cerr + << "Problem with to MakeDirectory for: " + << testNewFile << std::endl; + res = false; + } + + // calling with 0 pointer should return false + if (kwsys::SystemTools::FileExists(0)) + { + std::cerr + << "Problem with FileExists(0)" + << std::endl; + res = false; + } + if (kwsys::SystemTools::FileExists(0, true)) + { + std::cerr + << "Problem with FileExists(0) as file" + << std::endl; + res = false; + } + // calling with an empty string should return false + if (kwsys::SystemTools::FileExists(std::string())) + { + std::cerr + << "Problem with FileExists(std::string())" + << std::endl; + res = false; + } + // FileExists(x, true) should return false on a directory + if (kwsys::SystemTools::FileExists(testNewDir, true)) + { + std::cerr + << "Problem with FileExists as file for: " + << testNewDir << std::endl; + res = false; + } + if (kwsys::SystemTools::FileExists(testNewDir.c_str(), true)) + { + std::cerr + << "Problem with FileExists as C string and file for: " + << testNewDir << std::endl; + res = false; + } + // FileExists(x, false) should return true even on a directory + if (!kwsys::SystemTools::FileExists(testNewDir, false)) + { + std::cerr + << "Problem with FileExists as not file for: " + << testNewDir << std::endl; + res = false; + } + if (!kwsys::SystemTools::FileExists(testNewDir.c_str(), false)) + { + std::cerr + << "Problem with FileExists as C string and not file for: " + << testNewDir << std::endl; + res = false; + } + // should work, was created as new file before + if (!kwsys::SystemTools::FileExists(testNewFile)) + { + std::cerr + << "Problem with FileExists for: " + << testNewDir << std::endl; + res = false; + } + if (!kwsys::SystemTools::FileExists(testNewFile.c_str())) + { + std::cerr + << "Problem with FileExists as C string for: " + << testNewDir << std::endl; + res = false; + } + if (!kwsys::SystemTools::FileExists(testNewFile, true)) + { + std::cerr + << "Problem with FileExists as file for: " + << testNewDir << std::endl; + res = false; + } + if (!kwsys::SystemTools::FileExists(testNewFile.c_str(), true)) + { + std::cerr + << "Problem with FileExists as C string and file for: " + << testNewDir << std::endl; + res = false; + } // Reset umask #if defined(_WIN32) && !defined(__CYGWIN__) @@ -851,6 +999,44 @@ static bool CheckGetPath() return res; } +static bool CheckFind() +{ + bool res = true; + const std::string testFindFileName("testFindFile.txt"); + const std::string testFindFile(TEST_SYSTEMTOOLS_BINARY_DIR "/" + + testFindFileName); + + if (!kwsys::SystemTools::Touch(testFindFile.c_str(), true)) + { + std::cerr + << "Problem with Touch for: " + << testFindFile << std::endl; + // abort here as the existence of the file only makes the test meaningful + return false; + } + + std::vector searchPaths; + searchPaths.push_back(TEST_SYSTEMTOOLS_BINARY_DIR); + if (kwsys::SystemTools::FindFile(testFindFileName, + searchPaths, true).empty()) + { + std::cerr + << "Problem with FindFile without system paths for: " + << testFindFileName << std::endl; + res = false; + } + if (kwsys::SystemTools::FindFile(testFindFileName, + searchPaths, false).empty()) + { + std::cerr + << "Problem with FindFile with system paths for: " + << testFindFileName << std::endl; + res = false; + } + + return res; +} + //---------------------------------------------------------------------------- int testSystemTools(int, char*[]) { @@ -888,5 +1074,7 @@ int testSystemTools(int, char*[]) res &= CheckGetPath(); + res &= CheckFind(); + return res ? 0 : 1; } diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 5fd7159a5..7bb072156 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -269,8 +269,7 @@ if(BUILD_TESTING) set(TEST_RESOURCES TRUE) endif() # for borland and watcom there is no resource support - if("${CMAKE_GENERATOR}" MATCHES "WMake" OR - "${CMAKE_GENERATOR}" MATCHES "Borland") + if(WATCOM OR BORLAND) set(TEST_RESOURCES FALSE) endif() if(TEST_RESOURCES) @@ -686,7 +685,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release endmacro() if(CMAKE_BUILD_NIGHTLY_RELEASES) ADD_NIGHTLY_BUILD_TEST(CMakeNightlyWindows - dash2win64_release.cmake) + dash3win7_release.cmake) ADD_NIGHTLY_BUILD_TEST(CMakeNightlyOSX dashmacmini5_release.cmake) ADD_NIGHTLY_BUILD_TEST(CMakeNightlyLinux32 @@ -1356,9 +1355,18 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release endif() endif() + if(CMake_TEST_FindBoost) + add_subdirectory(FindBoost) + endif() + if(CMake_TEST_FindGSL) add_subdirectory(FindGSL) endif() + + if(CMake_TEST_FindGTest) + add_subdirectory(FindGTest) + endif() + if(CMake_TEST_FindJsonCpp) add_subdirectory(FindJsonCpp) endif() @@ -1367,6 +1375,18 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_subdirectory(FindOpenSSL) endif() + if(CMake_TEST_FindPNG) + add_subdirectory(FindPNG) + endif() + + if(CMake_TEST_FindTIFF) + add_subdirectory(FindTIFF) + endif() + + if(CMake_TEST_FindXalanC) + add_subdirectory(FindXalanC) + endif() + if(CMake_TEST_FindXercesC) add_subdirectory(FindXercesC) endif() diff --git a/Tests/CMakeOnly/CompilerIdC/CMakeLists.txt b/Tests/CMakeOnly/CompilerIdC/CMakeLists.txt index 848ffdd36..6fea73eb8 100644 --- a/Tests/CMakeOnly/CompilerIdC/CMakeLists.txt +++ b/Tests/CMakeOnly/CompilerIdC/CMakeLists.txt @@ -12,3 +12,10 @@ foreach(v message(SEND_ERROR "${v} not set!") endif() endforeach() + +# Version numbers may only contain numbers and periods. +if(NOT CMAKE_C_COMPILER_VERSION MATCHES + "^([0-9]+)(\\.([0-9]+))?(\\.([0-9]+))?(\\.([0-9]+))?$" + ) + message(SEND_ERROR "Compiler version is not numeric!") +endif() diff --git a/Tests/CMakeOnly/CompilerIdCXX/CMakeLists.txt b/Tests/CMakeOnly/CompilerIdCXX/CMakeLists.txt index 94ac31e4c..05e6bb222 100644 --- a/Tests/CMakeOnly/CompilerIdCXX/CMakeLists.txt +++ b/Tests/CMakeOnly/CompilerIdCXX/CMakeLists.txt @@ -12,3 +12,10 @@ foreach(v message(SEND_ERROR "${v} not set!") endif() endforeach() + +# Version numbers may only contain numbers and periods. +if(NOT CMAKE_CXX_COMPILER_VERSION MATCHES + "^([0-9]+)(\\.([0-9]+))?(\\.([0-9]+))?(\\.([0-9]+))?$" + ) + message(SEND_ERROR "Compiler version is not numeric!") +endif() diff --git a/Tests/CMakeOnly/CompilerIdFortran/CMakeLists.txt b/Tests/CMakeOnly/CompilerIdFortran/CMakeLists.txt index 02e466887..067fb8cd3 100644 --- a/Tests/CMakeOnly/CompilerIdFortran/CMakeLists.txt +++ b/Tests/CMakeOnly/CompilerIdFortran/CMakeLists.txt @@ -12,3 +12,10 @@ foreach(v message(SEND_ERROR "${v} not set!") endif() endforeach() + +# Version numbers may only contain numbers and periods. +if(NOT CMAKE_Fortran_COMPILER_VERSION MATCHES + "^([0-9]+)(\\.([0-9]+))?(\\.([0-9]+))?(\\.([0-9]+))?$" + ) + message(SEND_ERROR "Compiler version is not numeric!") +endif() diff --git a/Tests/CTestUpdateGIT.cmake.in b/Tests/CTestUpdateGIT.cmake.in index 6488a1f2f..46230cca3 100644 --- a/Tests/CTestUpdateGIT.cmake.in +++ b/Tests/CTestUpdateGIT.cmake.in @@ -41,7 +41,6 @@ run_child( COMMAND ${GIT} --bare init ) file(REMOVE_RECURSE ${TOP}/repo.git/hooks) -set(REPO file://${TOP}/repo.git) # Create submodule repository. message("Creating submodule...") @@ -51,17 +50,13 @@ run_child( COMMAND ${GIT} --bare init ) file(REMOVE_RECURSE ${TOP}/module.git/hooks) -set(MOD_REPO file://${TOP}/module.git) -create_content(module) -run_child(WORKING_DIRECTORY ${TOP}/module - COMMAND ${GIT} init +run_child(WORKING_DIRECTORY ${TOP} + COMMAND ${GIT} clone module.git module ) file(REMOVE_RECURSE ${TOP}/module/.git/hooks) file(APPEND ${TOP}/module/.git/config " -[remote \"origin\"] -\turl = ${MOD_REPO} -\tfetch = +refs/heads/*:refs/remotes/origin/* ${AUTHOR_CONFIG}") +create_content(module) run_child(WORKING_DIRECTORY ${TOP}/module COMMAND ${GIT} add . ) @@ -75,20 +70,17 @@ run_child(WORKING_DIRECTORY ${TOP}/module #----------------------------------------------------------------------------- # Import initial content into the repository. message("Importing content...") -create_content(import) -file(WRITE ${TOP}/import/HEAD "HEAD\n") -file(WRITE ${TOP}/import/master "master\n") # Import the content into the repository. -run_child(WORKING_DIRECTORY ${TOP}/import - COMMAND ${GIT} init +run_child(WORKING_DIRECTORY ${TOP} + COMMAND ${GIT} clone repo.git import ) file(REMOVE_RECURSE ${TOP}/import/.git/hooks) file(APPEND ${TOP}/import/.git/config " -[remote \"origin\"] -\turl = ${REPO} -\tfetch = +refs/heads/*:refs/remotes/origin/* ${AUTHOR_CONFIG}") +create_content(import) +file(WRITE ${TOP}/import/HEAD "HEAD\n") +file(WRITE ${TOP}/import/master "master\n") run_child(WORKING_DIRECTORY ${TOP}/import COMMAND ${GIT} add . ) @@ -96,7 +88,7 @@ run_child(WORKING_DIRECTORY ${TOP}/import COMMAND ${GIT} config core.safecrlf false ) run_child(WORKING_DIRECTORY ${TOP}/import - COMMAND ${GIT} submodule add ${MOD_REPO} module + COMMAND ${GIT} submodule add ../module.git module ) run_child(WORKING_DIRECTORY ${TOP}/import COMMAND ${GIT} commit -m "Initial content" @@ -123,7 +115,7 @@ run_child(WORKING_DIRECTORY ${TOP}/module message("Checking out revision 1...") run_child( WORKING_DIRECTORY ${TOP} - COMMAND ${GIT} clone ${REPO} user-source + COMMAND ${GIT} clone repo.git user-source ) file(REMOVE_RECURSE ${TOP}/user-source/.git/hooks) file(APPEND ${TOP}/user-source/.git/config "${AUTHOR_CONFIG}") @@ -278,7 +270,7 @@ set(CTEST_GIT_COMMAND \"${GIT}\") set(CTEST_GIT_UPDATE_OPTIONS) execute_process( WORKING_DIRECTORY \"${TOP}\" - COMMAND \"${GIT}\" clone \"${REPO}\" dash-source + COMMAND \"${GIT}\" clone repo.git dash-source ) # Test .git file. diff --git a/Tests/CompileOptions/CMakeLists.txt b/Tests/CompileOptions/CMakeLists.txt index 05a5f826f..692e0de0c 100644 --- a/Tests/CompileOptions/CMakeLists.txt +++ b/Tests/CompileOptions/CMakeLists.txt @@ -22,7 +22,7 @@ set_property(TARGET CompileOptions PROPERTY COMPILE_OPTIONS ${cxx_tests} ) -if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|Borland") +if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|Borland|Embarcadero") set_property(TARGET CompileOptions APPEND PROPERTY COMPILE_OPTIONS "-DTEST_OCTOTHORPE=\"#\"" ) diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index aedc89b9d..c2ecb0b1c 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -130,10 +130,15 @@ set_property(TARGET testLibCycleA PROPERTY LINK_INTERFACE_MULTIPLICITY 3) add_library(testLibNoSONAME SHARED testLibNoSONAME.c) set_property(TARGET testLibNoSONAME PROPERTY NO_SONAME 1) +cmake_policy(PUSH) +cmake_policy(SET CMP0022 NEW) # Test exporting dependent libraries into different exports add_library(testLibRequired testLibRequired.c) add_library(testLibDepends testLibDepends.c) target_link_libraries(testLibDepends LINK_PUBLIC testLibRequired) +add_library(testStaticLibRequiredPrivate testStaticLibRequiredPrivate.c) +target_link_libraries(testLibDepends PRIVATE testStaticLibRequiredPrivate) +cmake_policy(POP) macro(add_include_lib _libName) file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${_libName}.c" "/* no content */\n") @@ -270,6 +275,7 @@ install(FILES DESTINATION include/testSharedLibRequiredUser ) +cmake_policy(PUSH) cmake_policy(SET CMP0022 NEW) add_library(testSharedLibRequiredUser2 SHARED testSharedLibRequiredUser2.cpp) generate_export_header(testSharedLibRequiredUser2) @@ -283,7 +289,7 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/testsharedlibrequireduser2_export.h" DESTINATION include/testSharedLibRequiredUser2 ) -cmake_policy(SET CMP0022 OLD) +cmake_policy(POP) add_library(testSharedLibDepends SHARED testSharedLibDepends.cpp) set_property(TARGET testSharedLibDepends APPEND PROPERTY @@ -311,6 +317,8 @@ target_link_libraries(testSharedLibDepends LINK_PUBLIC renamed_on_export) target_link_libraries(testSharedLibDepends LINK_INTERFACE_LIBRARIES $<$,EXECUTABLE>:$>) +cmake_policy(PUSH) +cmake_policy(SET CMP0022 OLD) add_library(cmp0022OLD SHARED cmp0022_vs6_1.cpp) generate_export_header(cmp0022OLD BASE_NAME cmp0022) target_include_directories(cmp0022OLD PUBLIC @@ -324,7 +332,7 @@ target_include_directories(cmp0022NEW PUBLIC "$" "$/include/cmp0022>" ) -cmake_policy(SET CMP0022 OLD) +cmake_policy(POP) install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/cmp0022.h" "${CMAKE_CURRENT_BINARY_DIR}/cmp0022_export.h" @@ -388,6 +396,10 @@ install(TARGETS INCLUDES DESTINATION $/include/$ ) +install(TARGETS + testStaticLibRequiredPrivate + EXPORT RequiredExp DESTINATION lib +) install(EXPORT RequiredExp NAMESPACE Req:: FILE testLibRequiredTargets.cmake DESTINATION lib/cmake/testLibRequired) file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest") @@ -551,5 +563,5 @@ install( ARCHIVE DESTINATION lib INCLUDES DESTINATION include/abs ) -install(DIRECTORY include/abs DESTINATION $<1:include>$<0:/wrong>) +install(DIRECTORY $<1:include/abs>$<0:/wrong> DESTINATION $<1:include>$<0:/wrong>) install(EXPORT expAbs NAMESPACE expAbs_ DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/expAbs) diff --git a/Tests/ExportImport/Export/testLibDepends.c b/Tests/ExportImport/Export/testLibDepends.c index fb5a002e0..3c7774eed 100644 --- a/Tests/ExportImport/Export/testLibDepends.c +++ b/Tests/ExportImport/Export/testLibDepends.c @@ -16,5 +16,10 @@ #endif extern int testLibRequired(void); +extern int testStaticLibRequiredPrivate(void); -int testLibDepends(void) { return testLibRequired(); } +int testLibDepends(void) { + return testLibRequired() + + testStaticLibRequiredPrivate() + ; +} diff --git a/Tests/ExportImport/Export/testStaticLibRequiredPrivate.c b/Tests/ExportImport/Export/testStaticLibRequiredPrivate.c new file mode 100644 index 000000000..28a2675ff --- /dev/null +++ b/Tests/ExportImport/Export/testStaticLibRequiredPrivate.c @@ -0,0 +1 @@ +int testStaticLibRequiredPrivate(void) { return 0; } diff --git a/Tests/FindBoost/CMakeLists.txt b/Tests/FindBoost/CMakeLists.txt new file mode 100644 index 000000000..259ee266f --- /dev/null +++ b/Tests/FindBoost/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindBoost.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindBoost/Test" + "${CMake_BINARY_DIR}/Tests/FindBoost/Test" + ${build_generator_args} + --build-project TestFindBoost + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) diff --git a/Tests/FindBoost/Test/CMakeLists.txt b/Tests/FindBoost/Test/CMakeLists.txt new file mode 100644 index 000000000..ce50fc775 --- /dev/null +++ b/Tests/FindBoost/Test/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.1) +project(TestFindBoost CXX) +include(CTest) + +find_package(Boost REQUIRED COMPONENTS filesystem thread) + +add_executable(test_boost_tgt main.cxx) +target_link_libraries(test_boost_tgt + Boost::dynamic_linking + Boost::disable_autolinking + Boost::filesystem + Boost::thread) +add_test(NAME test_boost_tgt COMMAND test_boost_tgt) + +add_executable(test_boost_var main.cxx) +target_include_directories(test_boost_var PRIVATE ${Boost_INCLUDE_DIRS}) +target_link_libraries(test_boost_var PRIVATE ${Boost_FILESYSTEM_LIBRARIES} ${Boost_SYSTEM_LIBRARIES} ${Boost_THREAD_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) +add_test(NAME test_boost_var COMMAND test_boost_var) diff --git a/Tests/FindBoost/Test/main.cxx b/Tests/FindBoost/Test/main.cxx new file mode 100644 index 000000000..0f44f30b0 --- /dev/null +++ b/Tests/FindBoost/Test/main.cxx @@ -0,0 +1,26 @@ +#include +#include + +namespace +{ + + boost::mutex m1; + boost::recursive_mutex m2; + + void + threadmain() + { + boost::lock_guard lock1(m1); + boost::lock_guard lock2(m2); + + boost::filesystem::path p(boost::filesystem::current_path()); + } + +} + +int main() { + boost::thread foo(threadmain); + foo.join(); + + return 0; +} diff --git a/Tests/FindGTest/CMakeLists.txt b/Tests/FindGTest/CMakeLists.txt new file mode 100644 index 000000000..cbc92b144 --- /dev/null +++ b/Tests/FindGTest/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindGTest.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTest/Test" + "${CMake_BINARY_DIR}/Tests/FindGTest/Test" + ${build_generator_args} + --build-project TestFindGTest + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) diff --git a/Tests/FindGTest/Test/CMakeLists.txt b/Tests/FindGTest/Test/CMakeLists.txt new file mode 100644 index 000000000..99368ac71 --- /dev/null +++ b/Tests/FindGTest/Test/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.1) +project(TestFindGTest CXX) +include(CTest) + +# CMake does not actually provide FindGTest publicly. +set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../Source/Modules) + +find_package(GTest REQUIRED) + +add_executable(test_gtest_tgt main.cxx) +target_link_libraries(test_gtest_tgt GTest::Main) +add_test(NAME test_gtest_tgt COMMAND test_gtest_tgt) + +add_executable(test_gtest_var main.cxx) +target_include_directories(test_gtest_var PRIVATE ${GTEST_INCLUDE_DIRS}) +target_link_libraries(test_gtest_var PRIVATE ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) +add_test(NAME test_gtest_var COMMAND test_gtest_var) diff --git a/Tests/FindGTest/Test/main.cxx b/Tests/FindGTest/Test/main.cxx new file mode 100644 index 000000000..0572a5ddc --- /dev/null +++ b/Tests/FindGTest/Test/main.cxx @@ -0,0 +1,6 @@ +#include + +TEST(FindCMake, LinksAndRuns) +{ + ASSERT_TRUE(true); +} diff --git a/Tests/FindPNG/CMakeLists.txt b/Tests/FindPNG/CMakeLists.txt new file mode 100644 index 000000000..c665b67b2 --- /dev/null +++ b/Tests/FindPNG/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindPNG.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPNG/Test" + "${CMake_BINARY_DIR}/Tests/FindPNG/Test" + ${build_generator_args} + --build-project TestFindPNG + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) diff --git a/Tests/FindPNG/Test/CMakeLists.txt b/Tests/FindPNG/Test/CMakeLists.txt new file mode 100644 index 000000000..ad50011c7 --- /dev/null +++ b/Tests/FindPNG/Test/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.4) +project(TestFindPNG C) +include(CTest) + +find_package(PNG REQUIRED) + +add_definitions(-DCMAKE_EXPECTED_PNG_VERSION="${PNG_VERSION_STRING}") + +add_executable(test_tgt main.c) +target_link_libraries(test_tgt PNG::PNG) +add_test(NAME test_tgt COMMAND test_tgt) + +add_executable(test_var main.c) +target_include_directories(test_var PRIVATE ${PNG_INCLUDE_DIRS}) +target_link_libraries(test_var PRIVATE ${PNG_LIBRARIES}) +add_test(NAME test_var COMMAND test_var) diff --git a/Tests/FindPNG/Test/main.c b/Tests/FindPNG/Test/main.c new file mode 100644 index 000000000..27e14786b --- /dev/null +++ b/Tests/FindPNG/Test/main.c @@ -0,0 +1,20 @@ +#include +#include +#include + +int main() +{ + png_uint_32 png_version; + char png_version_string[16]; + + png_version = png_access_version_number (); + + snprintf (png_version_string, 16, "%i.%i.%i", + png_version / 10000, + (png_version % 10000) / 100, + png_version % 100); + + assert (strcmp(png_version_string, CMAKE_EXPECTED_PNG_VERSION) == 0); + + return 0; +} diff --git a/Tests/FindTIFF/CMakeLists.txt b/Tests/FindTIFF/CMakeLists.txt new file mode 100644 index 000000000..c4e0c6a7f --- /dev/null +++ b/Tests/FindTIFF/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindTIFF.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindTIFF/Test" + "${CMake_BINARY_DIR}/Tests/FindTIFF/Test" + ${build_generator_args} + --build-project TestFindTIFF + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) diff --git a/Tests/FindTIFF/Test/CMakeLists.txt b/Tests/FindTIFF/Test/CMakeLists.txt new file mode 100644 index 000000000..f17cda77f --- /dev/null +++ b/Tests/FindTIFF/Test/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.1) +project(TestFindTIFF C) +include(CTest) + +# CMake does not actually provide FindTIFF publicly. +set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../Source/Modules) + +find_package(TIFF REQUIRED) + +add_executable(test_xercesc_tgt main.c) +target_link_libraries(test_xercesc_tgt TIFF::TIFF) +add_test(NAME test_xercesc_tgt COMMAND test_xercesc_tgt) + +add_executable(test_xercesc_var main.c) +target_include_directories(test_xercesc_var PRIVATE ${TIFF_INCLUDE_DIRS}) +target_link_libraries(test_xercesc_var PRIVATE ${TIFF_LIBRARIES}) +add_test(NAME test_xercesc_var COMMAND test_xercesc_var) diff --git a/Tests/FindTIFF/Test/main.c b/Tests/FindTIFF/Test/main.c new file mode 100644 index 000000000..fc4f33757 --- /dev/null +++ b/Tests/FindTIFF/Test/main.c @@ -0,0 +1,12 @@ +#include +#include + +int main() +{ + /* Without any TIFF file to open, test that the call fails as + expected. This tests that linking worked. */ + TIFF *tiff = TIFFOpen("invalid.tiff", "r"); + assert(!tiff); + + return 0; +} diff --git a/Tests/FindXalanC/CMakeLists.txt b/Tests/FindXalanC/CMakeLists.txt new file mode 100644 index 000000000..787292936 --- /dev/null +++ b/Tests/FindXalanC/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindXalanC.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindXalanC/Test" + "${CMake_BINARY_DIR}/Tests/FindXalanC/Test" + ${build_generator_args} + --build-project TestFindXalanC + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) diff --git a/Tests/FindXalanC/Test/CMakeLists.txt b/Tests/FindXalanC/Test/CMakeLists.txt new file mode 100644 index 000000000..b445e0e10 --- /dev/null +++ b/Tests/FindXalanC/Test/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.1) +project(TestFindXalanC CXX) +include(CTest) + +# CMake does not actually provide FindXalanC publicly. +set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../Source/Modules) + +find_package(XalanC REQUIRED) + +add_executable(test_xalanc_tgt main.cxx) +target_link_libraries(test_xalanc_tgt XalanC::XalanC) +add_test(NAME test_xalanc_tgt COMMAND test_xalanc_tgt) + +add_executable(test_xalanc_var main.cxx) +target_include_directories(test_xalanc_var PRIVATE ${XalanC_INCLUDE_DIRS}) +target_link_libraries(test_xalanc_var PRIVATE ${XalanC_LIBRARIES}) +add_test(NAME test_xalanc_var COMMAND test_xalanc_var) diff --git a/Tests/FindXalanC/Test/main.cxx b/Tests/FindXalanC/Test/main.cxx new file mode 100644 index 000000000..3b4a2df8e --- /dev/null +++ b/Tests/FindXalanC/Test/main.cxx @@ -0,0 +1,10 @@ +#include +#include + +int main() +{ + xercesc::XMLPlatformUtils::Initialize(); + xalanc::XalanTransformer::initialize(); + xalanc::XalanTransformer::terminate(); + xercesc::XMLPlatformUtils::Terminate(); +} diff --git a/Tests/Fortran/CMakeLists.txt b/Tests/Fortran/CMakeLists.txt index 753ce2796..ecf38a605 100644 --- a/Tests/Fortran/CMakeLists.txt +++ b/Tests/Fortran/CMakeLists.txt @@ -223,5 +223,6 @@ if(TEST_MODULE_DEPENDS) endif() add_subdirectory(Library) + add_subdirectory(Subdir) add_subdirectory(Executable) endif() diff --git a/Tests/Fortran/Executable/CMakeLists.txt b/Tests/Fortran/Executable/CMakeLists.txt index 55f21ad46..de08d8605 100644 --- a/Tests/Fortran/Executable/CMakeLists.txt +++ b/Tests/Fortran/Executable/CMakeLists.txt @@ -3,6 +3,6 @@ include_directories(${External_BINARY_DIR}) link_directories(${External_BINARY_DIR}) add_executable(subdir_exe2 main.f90) -target_link_libraries(subdir_exe2 subdir_mods) +target_link_libraries(subdir_exe2 subdir_mods subdir_mods2) add_dependencies(subdir_exe2 ExternalTarget) target_link_libraries(subdir_exe2 myext) diff --git a/Tests/Fortran/Executable/main.f90 b/Tests/Fortran/Executable/main.f90 index f21156cda..640259c12 100644 --- a/Tests/Fortran/Executable/main.f90 +++ b/Tests/Fortran/Executable/main.f90 @@ -1,6 +1,7 @@ PROGRAM MAINF90 USE libraryModuleA USE libraryModuleB + USE subdirModuleA USE externalMod CALL printExtModGreeting END PROGRAM MAINF90 diff --git a/Tests/Fortran/Subdir/CMakeLists.txt b/Tests/Fortran/Subdir/CMakeLists.txt new file mode 100644 index 000000000..52683e587 --- /dev/null +++ b/Tests/Fortran/Subdir/CMakeLists.txt @@ -0,0 +1,2 @@ +add_library(subdir_mods2 subdir.f90) +target_include_directories(subdir_mods2 INTERFACE ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/Tests/Fortran/Subdir/subdir.f90 b/Tests/Fortran/Subdir/subdir.f90 new file mode 100644 index 000000000..68955f6b5 --- /dev/null +++ b/Tests/Fortran/Subdir/subdir.f90 @@ -0,0 +1,2 @@ +MODULE subdirModuleA +END MODULE diff --git a/Tests/JavaJavah/C.cpp b/Tests/JavaJavah/C.cpp new file mode 100644 index 000000000..ec75f4213 --- /dev/null +++ b/Tests/JavaJavah/C.cpp @@ -0,0 +1,10 @@ + +#include +#include + +#include "C.h" + +JNIEXPORT void JNICALL Java_C_printName(JNIEnv *, jobject) +{ + printf("C\n"); +} diff --git a/Tests/JavaJavah/C.java b/Tests/JavaJavah/C.java new file mode 100644 index 000000000..54b1be205 --- /dev/null +++ b/Tests/JavaJavah/C.java @@ -0,0 +1,19 @@ +class C +{ + public C() + { + } + + public native void printName(); + + static { + try { + + System.loadLibrary("B"); + + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load.\n" + e); + System.exit(1); + } + } +} diff --git a/Tests/JavaJavah/CMakeLists.txt b/Tests/JavaJavah/CMakeLists.txt index 83b0ad06a..071bf20d6 100644 --- a/Tests/JavaJavah/CMakeLists.txt +++ b/Tests/JavaJavah/CMakeLists.txt @@ -9,10 +9,13 @@ include (UseJava) # JNI support find_package(JNI) -add_jar(hello3 B.java HelloWorld2.java) -create_javah(TARGET B_javah CLASSES B CLASSPATH hello3) +add_jar(B1 B.java) +add_jar(C1 C.java) +create_javah(TARGET B_javah CLASSES B C CLASSPATH B1 C1) -add_library(B SHARED B.cpp) +add_jar(hello3 HelloWorld2.java) + +add_library(B SHARED B.cpp C.cpp) add_dependencies(B B_javah) target_include_directories(B PRIVATE ${CMAKE_CURRENT_BINARY_DIR} diff --git a/Tests/JavaJavah/HelloWorld2.java b/Tests/JavaJavah/HelloWorld2.java index faf7277fe..5ff710f95 100644 --- a/Tests/JavaJavah/HelloWorld2.java +++ b/Tests/JavaJavah/HelloWorld2.java @@ -5,6 +5,11 @@ class HelloWorld2 B b; b = new B(); b.printName(); + + C c; + c = new C(); + c.printName(); + System.out.println("Hello World!"); } } diff --git a/Tests/Module/GenerateExportHeader/exportheader_test.cpp b/Tests/Module/GenerateExportHeader/exportheader_test.cpp index 146374ad3..4f45f3786 100644 --- a/Tests/Module/GenerateExportHeader/exportheader_test.cpp +++ b/Tests/Module/GenerateExportHeader/exportheader_test.cpp @@ -39,6 +39,18 @@ void compare(const char* refName, const char* testName) std::string testLine; std::getline(ref, refLine); std::getline(test, testLine); + // Some very old Borland runtimes (C++ Builder 5 WITHOUT Update 1) add a + // trailing null to the string that we need to strip before testing for a + // trailing space. + if (refLine.size() && refLine[refLine.size()-1] == 0) + { + refLine = refLine.substr(0, refLine.size() - 1); + } + if (testLine.size() && testLine[testLine.size()-1] == 0) + { + testLine = testLine.substr(0, testLine.size() - 1); + } + // The reference files never have trailing spaces: if (testLine.size() && testLine[testLine.size()-1] == ' ') { testLine = testLine.substr(0, testLine.size() - 1); diff --git a/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target-stderr.txt b/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target-stderr.txt index 3f82d8c3d..4a1077c7d 100644 --- a/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target-stderr.txt +++ b/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target-stderr.txt @@ -1,4 +1,4 @@ CMake Error at CMP0040-NEW-missing-target.cmake:3 \(add_custom_command\): - The target name "foobar" is unknown in this context. + No TARGET 'foobar' has been created in this directory. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-stderr.txt b/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-stderr.txt index e791f0a72..e3e3ff468 100644 --- a/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-stderr.txt +++ b/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-stderr.txt @@ -4,7 +4,7 @@ CMake Warning \(dev\) at CMP0040-WARN-missing-target.cmake:2 \(add_custom_comman policy details. Use the cmake_policy command to set the policy and suppress this warning. + - The target name "foobar" is unknown in this context. + No TARGET 'foobar' has been created in this directory. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index a6cbf8660..0a388c53c 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -177,6 +177,7 @@ add_RunCMake_test(build_command) add_RunCMake_test(execute_process) add_RunCMake_test(export) add_RunCMake_test(cmake_minimum_required) +add_RunCMake_test(cmake_parse_arguments) add_RunCMake_test(continue) add_RunCMake_test(ctest_build) add_RunCMake_test(ctest_configure) diff --git a/Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-ExpectedFiles.cmake b/Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-ExpectedFiles.cmake new file mode 100644 index 000000000..1f6c11b9d --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-ExpectedFiles.cmake @@ -0,0 +1,9 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "3") +set(EXPECTED_FILE_1 "per_component*-pkg_1.deb") +set(EXPECTED_FILE_CONTENT_1 "^.*/usr/foo${whitespaces_}.*/usr/foo/CMakeLists.txt$") +set(EXPECTED_FILE_2 "per_component*-pkg_2.deb") +set(EXPECTED_FILE_CONTENT_2 "^.*/usr/foo${whitespaces_}.*/usr/foo/CMakeLists.txt$") +set(EXPECTED_FILE_3 "per_component*-pkg_3.deb") +set(EXPECTED_FILE_CONTENT_3 "^.*/usr/foo${whitespaces_}.*/usr/foo/CMakeLists.txt$") diff --git a/Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-VerifyResult.cmake b/Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-VerifyResult.cmake new file mode 100644 index 000000000..55293be50 --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-VerifyResult.cmake @@ -0,0 +1,18 @@ +function(checkPackageInfo_ TYPE FILE REGEX) + set(whitespaces_ "[\t\n\r ]*") + + getPackageInfo("${FILE}" "FILE_INFO_") + if(NOT FILE_INFO_ MATCHES "${REGEX}") + message(FATAL_ERROR "Unexpected ${TYPE} in '${FILE}'; file info: '${FILE_INFO_}'") + endif() +endfunction() + +# check package name +checkPackageInfo_("name" "${FOUND_FILE_1}" ".*Package${whitespaces_}:${whitespaces_}per_component-pkg_1") +checkPackageInfo_("name" "${FOUND_FILE_2}" ".*Package${whitespaces_}:${whitespaces_}second") +checkPackageInfo_("name" "${FOUND_FILE_3}" ".*Package${whitespaces_}:${whitespaces_}per_component-pkg_3") + +# check package group +checkPackageInfo_("group" "${FOUND_FILE_1}" ".*Section${whitespaces_}:${whitespaces_}default") +checkPackageInfo_("group" "${FOUND_FILE_2}" ".*Section${whitespaces_}:${whitespaces_}second_group") +checkPackageInfo_("group" "${FOUND_FILE_3}" ".*Section${whitespaces_}:${whitespaces_}default") diff --git a/Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-specifics.cmake b/Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-specifics.cmake new file mode 100644 index 000000000..a1da1a3cd --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-specifics.cmake @@ -0,0 +1,6 @@ +set(CPACK_PACKAGE_CONTACT "someone") +set(CPACK_DEB_COMPONENT_INSTALL "ON") + +set(CPACK_DEBIAN_PACKAGE_SECTION "default") +set(CPACK_DEBIAN_PKG_2_PACKAGE_NAME "second") +set(CPACK_DEBIAN_PKG_2_PACKAGE_SECTION "second_group") diff --git a/Tests/RunCMake/CPack/PER_COMPONENT_FIELDS.cmake b/Tests/RunCMake/CPack/PER_COMPONENT_FIELDS.cmake new file mode 100644 index 000000000..bb42cf4d5 --- /dev/null +++ b/Tests/RunCMake/CPack/PER_COMPONENT_FIELDS.cmake @@ -0,0 +1,5 @@ +install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_1) +install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_2) +install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_3) + +set(CPACK_PACKAGE_NAME "per_component") diff --git a/Tests/RunCMake/CPack/RPM/Helpers.cmake b/Tests/RunCMake/CPack/RPM/Helpers.cmake index 98cdad845..ba77a4a10 100644 --- a/Tests/RunCMake/CPack/RPM/Helpers.cmake +++ b/Tests/RunCMake/CPack/RPM/Helpers.cmake @@ -8,3 +8,12 @@ function(getPackageContent FILE RESULT_VAR) set(${RESULT_VAR} "${package_content_}" PARENT_SCOPE) endfunction() + +function(getPackageInfo FILE RESULT_VAR) + execute_process(COMMAND ${RPM_EXECUTABLE} -pqi ${FILE} + OUTPUT_VARIABLE info_content + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + + set(${RESULT_VAR} "${info_content}" PARENT_SCOPE) +endfunction() diff --git a/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-ExpectedFiles.cmake new file mode 100644 index 000000000..3d28d416e --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-ExpectedFiles.cmake @@ -0,0 +1,9 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "3") +set(EXPECTED_FILE_1 "per_component*-pkg_1.rpm") +set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$") +set(EXPECTED_FILE_2 "per_component*-pkg_2.rpm") +set(EXPECTED_FILE_CONTENT_2 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$") +set(EXPECTED_FILE_3 "per_component*-pkg_3.rpm") +set(EXPECTED_FILE_CONTENT_3 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$") diff --git a/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-VerifyResult.cmake b/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-VerifyResult.cmake new file mode 100644 index 000000000..d7d4f9de6 --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-VerifyResult.cmake @@ -0,0 +1,18 @@ +function(checkPackageInfo_ TYPE FILE REGEX) + set(whitespaces_ "[\t\n\r ]*") + + getPackageInfo("${FILE}" "FILE_INFO_") + if(NOT FILE_INFO_ MATCHES "${REGEX}") + message(FATAL_ERROR "Unexpected ${TYPE} in '${FILE}'; file info: '${FILE_INFO_}'") + endif() +endfunction() + +# check package name +checkPackageInfo_("name" "${FOUND_FILE_1}" ".*Name${whitespaces_}:${whitespaces_}per_component-pkg_1") +checkPackageInfo_("name" "${FOUND_FILE_2}" ".*Name${whitespaces_}:${whitespaces_}second") +checkPackageInfo_("name" "${FOUND_FILE_3}" ".*Name${whitespaces_}:${whitespaces_}per_component-pkg_3") + +# check package group +checkPackageInfo_("group" "${FOUND_FILE_1}" ".*Group${whitespaces_}:${whitespaces_}default") +checkPackageInfo_("group" "${FOUND_FILE_2}" ".*Group${whitespaces_}:${whitespaces_}second_group") +checkPackageInfo_("group" "${FOUND_FILE_3}" ".*Group${whitespaces_}:${whitespaces_}default") diff --git a/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-specifics.cmake b/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-specifics.cmake new file mode 100644 index 000000000..d398168e3 --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-specifics.cmake @@ -0,0 +1,5 @@ +set(CPACK_RPM_COMPONENT_INSTALL "ON") + +set(CPACK_RPM_PACKAGE_GROUP "default") +set(CPACK_RPM_pkg_2_PACKAGE_NAME "second") +set(CPACK_RPM_pkg_2_PACKAGE_GROUP "second_group") diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index b7295f450..fe2b48bb3 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -10,3 +10,4 @@ run_cpack_test(DEB_EXTRA "DEB" false) run_cpack_test(DEPENDENCIES "RPM;DEB" true) run_cpack_test(EMPTY_DIR "RPM;DEB;TGZ" true) run_cpack_test(COMPONENTS_EMPTY_DIR "RPM;DEB;TGZ" true) +run_cpack_test(PER_COMPONENT_FIELDS "RPM;DEB" false) diff --git a/Tests/RunCMake/CommandLine/E-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/E-no-arg-stderr.txt index 056ce052d..50d9b0332 100644 --- a/Tests/RunCMake/CommandLine/E-no-arg-stderr.txt +++ b/Tests/RunCMake/CommandLine/E-no-arg-stderr.txt @@ -1,3 +1,3 @@ ^CMake Error: cmake version .* -Usage: .* -E \[command\] \[arguments ...\] +Usage: .* -E \[arguments\.\.\.\] Available commands: diff --git a/Tests/RunCMake/CommandLine/E_copy-one-source-directory-target-is-directory-result.txt b/Tests/RunCMake/CommandLine/E_copy-one-source-directory-target-is-directory-result.txt new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_copy-one-source-directory-target-is-directory-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CommandLine/E_copy-one-source-directory-target-is-directory-stderr.txt b/Tests/RunCMake/CommandLine/E_copy-one-source-directory-target-is-directory-stderr.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/message/errormessage-result.txt b/Tests/RunCMake/CommandLine/E_copy-one-source-file-result.txt similarity index 100% rename from Tests/RunCMake/message/errormessage-result.txt rename to Tests/RunCMake/CommandLine/E_copy-one-source-file-result.txt diff --git a/Tests/RunCMake/CommandLine/E_copy-one-source-file-stderr.txt b/Tests/RunCMake/CommandLine/E_copy-one-source-file-stderr.txt new file mode 100644 index 000000000..9a9301d9e --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_copy-one-source-file-stderr.txt @@ -0,0 +1 @@ +^CMake Error: .* diff --git a/Tests/RunCMake/CommandLine/E_copy-three-source-files-target-is-directory-result.txt b/Tests/RunCMake/CommandLine/E_copy-three-source-files-target-is-directory-result.txt new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_copy-three-source-files-target-is-directory-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CommandLine/E_copy-three-source-files-target-is-directory-stderr.txt b/Tests/RunCMake/CommandLine/E_copy-three-source-files-target-is-directory-stderr.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/CommandLine/E_copy-three-source-files-target-is-file-result.txt b/Tests/RunCMake/CommandLine/E_copy-three-source-files-target-is-file-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_copy-three-source-files-target-is-file-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_copy-three-source-files-target-is-file-stderr.txt b/Tests/RunCMake/CommandLine/E_copy-three-source-files-target-is-file-stderr.txt new file mode 100644 index 000000000..95042168f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_copy-three-source-files-target-is-file-stderr.txt @@ -0,0 +1 @@ +^Error: Target \(for copy command\).* is not a directory.$ diff --git a/Tests/RunCMake/CommandLine/E_copy-two-good-and-one-bad-source-files-target-is-directory-result.txt b/Tests/RunCMake/CommandLine/E_copy-two-good-and-one-bad-source-files-target-is-directory-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_copy-two-good-and-one-bad-source-files-target-is-directory-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_copy-two-good-and-one-bad-source-files-target-is-directory-stderr.txt b/Tests/RunCMake/CommandLine/E_copy-two-good-and-one-bad-source-files-target-is-directory-stderr.txt new file mode 100644 index 000000000..2d0d98610 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_copy-two-good-and-one-bad-source-files-target-is-directory-stderr.txt @@ -0,0 +1 @@ +^Error copying file .*not_existing_file.bad\" to .* diff --git a/Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-directory-result.txt b/Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-directory-result.txt new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-directory-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-directory-stderr.txt b/Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-directory-stderr.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-file-result.txt b/Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-file-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-file-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-file-stderr.txt b/Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-file-stderr.txt new file mode 100644 index 000000000..6ca367767 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-file-stderr.txt @@ -0,0 +1,3 @@ +^Error copying directory from .* to .*file_for_test.txt\".* +Error copying directory from .* to .*file_for_test.txt\".* +Error copying directory from .* to .*file_for_test.txt\".$ diff --git a/Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-not-exist-result.txt b/Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-not-exist-result.txt new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-not-exist-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-not-exist-stderr.txt b/Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-not-exist-stderr.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/CommandLine/E_copy_if_different-one-source-directory-target-is-directory-result.txt b/Tests/RunCMake/CommandLine/E_copy_if_different-one-source-directory-target-is-directory-result.txt new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_copy_if_different-one-source-directory-target-is-directory-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CommandLine/E_copy_if_different-one-source-directory-target-is-directory-stderr.txt b/Tests/RunCMake/CommandLine/E_copy_if_different-one-source-directory-target-is-directory-stderr.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/CommandLine/E_copy_if_different-three-source-files-target-is-directory-result.txt b/Tests/RunCMake/CommandLine/E_copy_if_different-three-source-files-target-is-directory-result.txt new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_copy_if_different-three-source-files-target-is-directory-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CommandLine/E_copy_if_different-three-source-files-target-is-directory-stderr.txt b/Tests/RunCMake/CommandLine/E_copy_if_different-three-source-files-target-is-directory-stderr.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/CommandLine/E_copy_if_different-three-source-files-target-is-file-result.txt b/Tests/RunCMake/CommandLine/E_copy_if_different-three-source-files-target-is-file-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_copy_if_different-three-source-files-target-is-file-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_copy_if_different-three-source-files-target-is-file-stderr.txt b/Tests/RunCMake/CommandLine/E_copy_if_different-three-source-files-target-is-file-stderr.txt new file mode 100644 index 000000000..64b7b1b4c --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_copy_if_different-three-source-files-target-is-file-stderr.txt @@ -0,0 +1 @@ +^Error: Target \(for copy_if_different command\).* is not a directory.$ diff --git a/Tests/RunCMake/CommandLine/E_create_symlink-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/E_create_symlink-no-arg-stderr.txt index 056ce052d..50d9b0332 100644 --- a/Tests/RunCMake/CommandLine/E_create_symlink-no-arg-stderr.txt +++ b/Tests/RunCMake/CommandLine/E_create_symlink-no-arg-stderr.txt @@ -1,3 +1,3 @@ ^CMake Error: cmake version .* -Usage: .* -E \[command\] \[arguments ...\] +Usage: .* -E \[arguments\.\.\.\] Available commands: diff --git a/Tests/RunCMake/CommandLine/E_make_directory-directory-with-parent-result.txt b/Tests/RunCMake/CommandLine/E_make_directory-directory-with-parent-result.txt new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_make_directory-directory-with-parent-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CommandLine/E_make_directory-directory-with-parent-stderr.txt b/Tests/RunCMake/CommandLine/E_make_directory-directory-with-parent-stderr.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/CommandLine/E_make_directory-three-directories-and-file-result.txt b/Tests/RunCMake/CommandLine/E_make_directory-three-directories-and-file-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_make_directory-three-directories-and-file-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_make_directory-three-directories-and-file-stderr.txt b/Tests/RunCMake/CommandLine/E_make_directory-three-directories-and-file-stderr.txt new file mode 100644 index 000000000..08a9428f4 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_make_directory-three-directories-and-file-stderr.txt @@ -0,0 +1 @@ +^Error creating directory .*file_for_test.txt\".$ diff --git a/Tests/RunCMake/CommandLine/E_make_directory-three-directories-result.txt b/Tests/RunCMake/CommandLine/E_make_directory-three-directories-result.txt new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_make_directory-three-directories-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CommandLine/E_make_directory-three-directories-stderr.txt b/Tests/RunCMake/CommandLine/E_make_directory-three-directories-stderr.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/CommandLine/E_rename-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/E_rename-no-arg-stderr.txt index 056ce052d..50d9b0332 100644 --- a/Tests/RunCMake/CommandLine/E_rename-no-arg-stderr.txt +++ b/Tests/RunCMake/CommandLine/E_rename-no-arg-stderr.txt @@ -1,3 +1,3 @@ ^CMake Error: cmake version .* -Usage: .* -E \[command\] \[arguments ...\] +Usage: .* -E \[arguments\.\.\.\] Available commands: diff --git a/Tests/RunCMake/CommandLine/E_time-no-arg-result.txt b/Tests/RunCMake/CommandLine/E_time-no-arg-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_time-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_time-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/E_time-no-arg-stderr.txt new file mode 100644 index 000000000..50d9b0332 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_time-no-arg-stderr.txt @@ -0,0 +1,3 @@ +^CMake Error: cmake version .* +Usage: .* -E \[arguments\.\.\.\] +Available commands: diff --git a/Tests/RunCMake/CommandLine/E_time-stdout.txt b/Tests/RunCMake/CommandLine/E_time-stdout.txt new file mode 100644 index 000000000..a51446a67 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_time-stdout.txt @@ -0,0 +1,3 @@ +^hello world +Elapsed time: [^ +]*$ diff --git a/Tests/RunCMake/CommandLine/E_touch_nocreate-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/E_touch_nocreate-no-arg-stderr.txt index 056ce052d..50d9b0332 100644 --- a/Tests/RunCMake/CommandLine/E_touch_nocreate-no-arg-stderr.txt +++ b/Tests/RunCMake/CommandLine/E_touch_nocreate-no-arg-stderr.txt @@ -1,3 +1,3 @@ ^CMake Error: cmake version .* -Usage: .* -E \[command\] \[arguments ...\] +Usage: .* -E \[arguments\.\.\.\] Available commands: diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 6b4b3849c..e3b73ff25 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -12,6 +12,9 @@ run_cmake_command(E_echo_append ${CMAKE_COMMAND} -E echo_append) run_cmake_command(E_rename-no-arg ${CMAKE_COMMAND} -E rename) run_cmake_command(E_touch_nocreate-no-arg ${CMAKE_COMMAND} -E touch_nocreate) +run_cmake_command(E_time ${CMAKE_COMMAND} -E time ${CMAKE_COMMAND} -E echo "hello world") +run_cmake_command(E_time-no-arg ${CMAKE_COMMAND} -E time) + run_cmake_command(E___run_iwyu-no-iwyu ${CMAKE_COMMAND} -E __run_iwyu -- command-does-not-exist) run_cmake_command(E___run_iwyu-bad-iwyu ${CMAKE_COMMAND} -E __run_iwyu --iwyu=iwyu-does-not-exist -- command-does-not-exist) run_cmake_command(E___run_iwyu-no--- ${CMAKE_COMMAND} -E __run_iwyu --iwyu=iwyu-does-not-exist command-does-not-exist) @@ -33,6 +36,11 @@ run_cmake_command(build-bad-dir run_cmake_command(build-bad-generator ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-bad-generator) +run_cmake_command(cache-bad-entry + ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-bad-entry/) +run_cmake_command(cache-empty-entry + ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-empty-entry/) + function(run_BuildDir) # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/BuildDir-build) @@ -101,6 +109,60 @@ if(UNIX) ) endif() +set(in ${RunCMake_SOURCE_DIR}/copy_input) +set(out ${RunCMake_BINARY_DIR}/copy_output) +file(REMOVE_RECURSE "${out}") +file(MAKE_DIRECTORY ${out}) +run_cmake_command(E_copy-one-source-file + ${CMAKE_COMMAND} -E copy ${out}/f1.txt) +run_cmake_command(E_copy-one-source-directory-target-is-directory + ${CMAKE_COMMAND} -E copy ${in}/f1.txt ${out}) +run_cmake_command(E_copy-three-source-files-target-is-directory + ${CMAKE_COMMAND} -E copy ${in}/f1.txt ${in}/f2.txt ${in}/f3.txt ${out}) +run_cmake_command(E_copy-three-source-files-target-is-file + ${CMAKE_COMMAND} -E copy ${in}/f1.txt ${in}/f2.txt ${in}/f3.txt ${out}/f1.txt) +run_cmake_command(E_copy-two-good-and-one-bad-source-files-target-is-directory + ${CMAKE_COMMAND} -E copy ${in}/f1.txt ${in}/not_existing_file.bad ${in}/f3.txt ${out}) +run_cmake_command(E_copy_if_different-one-source-directory-target-is-directory + ${CMAKE_COMMAND} -E copy_if_different ${in}/f1.txt ${out}) +run_cmake_command(E_copy_if_different-three-source-files-target-is-directory + ${CMAKE_COMMAND} -E copy_if_different ${in}/f1.txt ${in}/f2.txt ${in}/f3.txt ${out}) +run_cmake_command(E_copy_if_different-three-source-files-target-is-file + ${CMAKE_COMMAND} -E copy_if_different ${in}/f1.txt ${in}/f2.txt ${in}/f3.txt ${out}/f1.txt) +unset(in) +unset(out) + +set(in ${RunCMake_SOURCE_DIR}/copy_input) +set(out ${RunCMake_BINARY_DIR}/copy_directory_output) +set(outfile ${out}/file_for_test.txt) +file(REMOVE_RECURSE "${out}") +file(MAKE_DIRECTORY ${out}) +file(WRITE ${outfile} "") +run_cmake_command(E_copy_directory-three-source-files-target-is-directory + ${CMAKE_COMMAND} -E copy_directory ${in}/d1 ${in}/d2 ${in}/d3 ${out}) +run_cmake_command(E_copy_directory-three-source-files-target-is-file + ${CMAKE_COMMAND} -E copy_directory ${in}/d1 ${in}/d2 ${in}/d3 ${outfile}) +run_cmake_command(E_copy_directory-three-source-files-target-is-not-exist + ${CMAKE_COMMAND} -E copy_directory ${in}/d1 ${in}/d2 ${in}/d3 ${out}/not_existing_directory) +unset(in) +unset(out) +unset(outfile) + +set(out ${RunCMake_BINARY_DIR}/make_directory_output) +set(outfile ${out}/file_for_test.txt) +file(REMOVE_RECURSE "${out}") +file(MAKE_DIRECTORY ${out}) +file(WRITE ${outfile} "") +run_cmake_command(E_make_directory-three-directories + ${CMAKE_COMMAND} -E make_directory ${out}/d1 ${out}/d2 ${out}/d2) +run_cmake_command(E_make_directory-directory-with-parent + ${CMAKE_COMMAND} -E make_directory ${out}/parent/child) +run_cmake_command(E_make_directory-three-directories-and-file + ${CMAKE_COMMAND} -E make_directory ${out}/d1 ${out}/d2 ${outfile}) +unset(out) +unset(outfile) + + run_cmake_command(E_env-no-command0 ${CMAKE_COMMAND} -E env) run_cmake_command(E_env-no-command1 ${CMAKE_COMMAND} -E env TEST_ENV=1) run_cmake_command(E_env-bad-arg1 ${CMAKE_COMMAND} -E env -bad-arg1) @@ -133,6 +195,14 @@ set(RunCMake_TEST_OPTIONS -Wdev) run_cmake(Wdev) unset(RunCMake_TEST_OPTIONS) +set(RunCMake_TEST_OPTIONS -Werror=dev) +run_cmake(Werror_dev) +unset(RunCMake_TEST_OPTIONS) + +set(RunCMake_TEST_OPTIONS -Wno-error=dev) +run_cmake(Wno-error_deprecated) +unset(RunCMake_TEST_OPTIONS) + # -Wdev should not override deprecated options if specified set(RunCMake_TEST_OPTIONS -Wdev -Wno-deprecated) run_cmake(Wno-deprecated) @@ -146,6 +216,11 @@ set(RunCMake_TEST_OPTIONS -Wdev) run_cmake(Wdeprecated) unset(RunCMake_TEST_OPTIONS) +# -Werror=dev should enable deprecated errors as well +set(RunCMake_TEST_OPTIONS -Werror=dev) +run_cmake(Werror_deprecated) +unset(RunCMake_TEST_OPTIONS) + set(RunCMake_TEST_OPTIONS -Wdeprecated) run_cmake(Wdeprecated) unset(RunCMake_TEST_OPTIONS) @@ -154,6 +229,14 @@ set(RunCMake_TEST_OPTIONS -Wno-deprecated) run_cmake(Wno-deprecated) unset(RunCMake_TEST_OPTIONS) +set(RunCMake_TEST_OPTIONS -Werror=deprecated) +run_cmake(Werror_deprecated) +unset(RunCMake_TEST_OPTIONS) + +set(RunCMake_TEST_OPTIONS -Wno-error=deprecated) +run_cmake(Wno-error_deprecated) +unset(RunCMake_TEST_OPTIONS) + # Dev warnings should be on by default run_cmake(Wdev) @@ -170,6 +253,7 @@ unset(RunCMake_TEST_OPTIONS) run_cmake_command(W_bad-arg1 ${CMAKE_COMMAND} -W) run_cmake_command(W_bad-arg2 ${CMAKE_COMMAND} -Wno-) +run_cmake_command(W_bad-arg3 ${CMAKE_COMMAND} -Werror=) set(RunCMake_TEST_OPTIONS --debug-output) run_cmake(debug-output) diff --git a/Tests/RunCMake/CommandLine/W_bad-arg3-result.txt b/Tests/RunCMake/CommandLine/W_bad-arg3-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/W_bad-arg3-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/W_bad-arg3-stderr.txt b/Tests/RunCMake/CommandLine/W_bad-arg3-stderr.txt new file mode 100644 index 000000000..cc643df95 --- /dev/null +++ b/Tests/RunCMake/CommandLine/W_bad-arg3-stderr.txt @@ -0,0 +1,2 @@ +CMake Error: No warning name provided. +CMake Error: Problem processing arguments. Aborting. diff --git a/Tests/RunCMake/CommandLine/Werror_deprecated-result.txt b/Tests/RunCMake/CommandLine/Werror_deprecated-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/Werror_deprecated-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/Werror_deprecated-stderr.txt b/Tests/RunCMake/CommandLine/Werror_deprecated-stderr.txt new file mode 100644 index 000000000..6acdc7362 --- /dev/null +++ b/Tests/RunCMake/CommandLine/Werror_deprecated-stderr.txt @@ -0,0 +1,4 @@ +^CMake Deprecation Error at Werror_deprecated.cmake:1 \(message\): + Some deprecated warning +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CommandLine/Werror_deprecated.cmake b/Tests/RunCMake/CommandLine/Werror_deprecated.cmake new file mode 100644 index 000000000..3142b42dc --- /dev/null +++ b/Tests/RunCMake/CommandLine/Werror_deprecated.cmake @@ -0,0 +1 @@ +message(DEPRECATION "Some deprecated warning") diff --git a/Tests/RunCMake/CommandLine/Werror_dev-result.txt b/Tests/RunCMake/CommandLine/Werror_dev-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/Werror_dev-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/Werror_dev-stderr.txt b/Tests/RunCMake/CommandLine/Werror_dev-stderr.txt new file mode 100644 index 000000000..590ec96d3 --- /dev/null +++ b/Tests/RunCMake/CommandLine/Werror_dev-stderr.txt @@ -0,0 +1,11 @@ +^CMake Error \(dev\) at Werror_dev.cmake:4 \(include\): + include\(\) given empty file name \(ignored\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This error is for project developers. Use -Wno-error=dev to suppress it. + +CMake Error \(dev\) at Werror_dev.cmake:7 \(message\): + Some author warning +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This error is for project developers. Use -Wno-error=dev to suppress it.$ diff --git a/Tests/RunCMake/CommandLine/Werror_dev.cmake b/Tests/RunCMake/CommandLine/Werror_dev.cmake new file mode 100644 index 000000000..05f333a57 --- /dev/null +++ b/Tests/RunCMake/CommandLine/Werror_dev.cmake @@ -0,0 +1,7 @@ +# with -Werror=dev this will also cause an (upgraded) AUTHOR_ERROR message, +# checks that messages issued outside of the message command, by other CMake +# commands, also are affected by -Werror=dev +include("") + +# message command sets fatal occurred flag, so run it last +message(AUTHOR_WARNING "Some author warning") diff --git a/Tests/RunCMake/CommandLine/Wno-error_deprecated-stderr.txt b/Tests/RunCMake/CommandLine/Wno-error_deprecated-stderr.txt new file mode 100644 index 000000000..0ed169861 --- /dev/null +++ b/Tests/RunCMake/CommandLine/Wno-error_deprecated-stderr.txt @@ -0,0 +1,4 @@ +^CMake Deprecation Warning at Wno-error_deprecated.cmake:2 \(message\): + Some deprecated warning +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CommandLine/Wno-error_deprecated.cmake b/Tests/RunCMake/CommandLine/Wno-error_deprecated.cmake new file mode 100644 index 000000000..676792a8d --- /dev/null +++ b/Tests/RunCMake/CommandLine/Wno-error_deprecated.cmake @@ -0,0 +1,2 @@ +# This should still produce a warning when -Wno-error=deprecated is specified +message(DEPRECATION "Some deprecated warning") diff --git a/Tests/RunCMake/CommandLine/Wno-error_dev-stderr.txt b/Tests/RunCMake/CommandLine/Wno-error_dev-stderr.txt new file mode 100644 index 000000000..dd22d5568 --- /dev/null +++ b/Tests/RunCMake/CommandLine/Wno-error_dev-stderr.txt @@ -0,0 +1,11 @@ +^CMake Warning \(dev\) at Wno-error_dev.cmake:2 \(message\): + Some author warning +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\) at Wno-error_dev.cmake:6 \(include\): + include\(\) given empty file name \(ignored\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/CommandLine/Wno-error_dev.cmake b/Tests/RunCMake/CommandLine/Wno-error_dev.cmake new file mode 100644 index 000000000..b700c1975 --- /dev/null +++ b/Tests/RunCMake/CommandLine/Wno-error_dev.cmake @@ -0,0 +1,7 @@ +# This should still produce a warning when -Wno-error=dev is specified +message(AUTHOR_WARNING "Some author warning") + +# with -Wno-error=dev this will also cause an AUTHOR_WARNING message, checks +# that messages issued outside of the message command, by other CMake commands, +# also are affected by -Wno-error=dev +include("") diff --git a/Tests/RunCMake/CommandLine/cache-bad-entry-result.txt b/Tests/RunCMake/CommandLine/cache-bad-entry-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/cache-bad-entry-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/cache-bad-entry-stderr.txt b/Tests/RunCMake/CommandLine/cache-bad-entry-stderr.txt new file mode 100644 index 000000000..150d2ca88 --- /dev/null +++ b/Tests/RunCMake/CommandLine/cache-bad-entry-stderr.txt @@ -0,0 +1 @@ +^CMake Error: Parse error in cache file .*/Tests/RunCMake/CommandLine/cache-bad-entry/CMakeCache.txt on line 7. Offending entry: BAD ENTRY.* diff --git a/Tests/RunCMake/CommandLine/cache-bad-entry/CMakeCache.txt b/Tests/RunCMake/CommandLine/cache-bad-entry/CMakeCache.txt new file mode 100644 index 000000000..75cd7c2e1 --- /dev/null +++ b/Tests/RunCMake/CommandLine/cache-bad-entry/CMakeCache.txt @@ -0,0 +1,10 @@ +# This is a comment + +// That was an empty line. This isn't. +EMPTY_LINE:BOOL=FALSE + +// Uhoh! Here it comes +BAD ENTRY + +// This is fine +GOOD_ENTRY:BOOL=TRUE diff --git a/Tests/RunCMake/CommandLine/cache-empty-entry-result.txt b/Tests/RunCMake/CommandLine/cache-empty-entry-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/cache-empty-entry-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/cache-empty-entry-stderr.txt b/Tests/RunCMake/CommandLine/cache-empty-entry-stderr.txt new file mode 100644 index 000000000..54f44525f --- /dev/null +++ b/Tests/RunCMake/CommandLine/cache-empty-entry-stderr.txt @@ -0,0 +1 @@ +^CMake Error: Parse error in cache file .*/Tests/RunCMake/CommandLine/cache-empty-entry/CMakeCache.txt on line 5. Offending entry:.* diff --git a/Tests/RunCMake/CommandLine/cache-empty-entry/CMakeCache.txt b/Tests/RunCMake/CommandLine/cache-empty-entry/CMakeCache.txt new file mode 100644 index 000000000..44da1c9c3 --- /dev/null +++ b/Tests/RunCMake/CommandLine/cache-empty-entry/CMakeCache.txt @@ -0,0 +1,7 @@ +// This is valid +VALID:BOOL=TRUE + +// This isn't + +// One final entry +FINAL:BOOL=TRUE diff --git a/Tests/RunCMake/CommandLine/copy_input/d1/d1.txt b/Tests/RunCMake/CommandLine/copy_input/d1/d1.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/CommandLine/copy_input/d2/d2.txt b/Tests/RunCMake/CommandLine/copy_input/d2/d2.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/CommandLine/copy_input/d3/d3.txt b/Tests/RunCMake/CommandLine/copy_input/d3/d3.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/CommandLine/copy_input/f1.txt b/Tests/RunCMake/CommandLine/copy_input/f1.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/CommandLine/copy_input/f2.txt b/Tests/RunCMake/CommandLine/copy_input/f2.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/CommandLine/copy_input/f3.txt b/Tests/RunCMake/CommandLine/copy_input/f3.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_cache_variables.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_cache_variables.cmake new file mode 100644 index 000000000..8d8d00099 --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_cache_variables.cmake @@ -0,0 +1,16 @@ +find_package(PkgConfig REQUIRED) +pkg_check_modules(NCURSES QUIET ncurses) + +if (NCURSES_FOUND) + foreach (variable IN ITEMS PREFIX INCLUDEDIR LIBDIR) + get_property("${variable}" + CACHE "NCURSES_${variable}" + PROPERTY TYPE + SET) + if (NOT ${variable}) + message(FATAL_ERROR "Failed to set cache entry for NCURSES_${variable}") + endif () + endforeach () +else () + message(STATUS "skipping test; ncurses not found") +endif () diff --git a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake index bb04aa29c..24089e0a5 100644 --- a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake @@ -14,4 +14,5 @@ endif() find_package(PkgConfig) if (PKG_CONFIG_FOUND) run_cmake(FindPkgConfig_GET_VARIABLE) + run_cmake(FindPkgConfig_cache_variables) endif () diff --git a/Tests/RunCMake/Framework/FrameworkLayout.cmake b/Tests/RunCMake/Framework/FrameworkLayout.cmake index 107afdfe9..51847555b 100644 --- a/Tests/RunCMake/Framework/FrameworkLayout.cmake +++ b/Tests/RunCMake/Framework/FrameworkLayout.cmake @@ -1,5 +1,11 @@ cmake_minimum_required(VERSION 3.4) enable_language(C) -add_library(Framework SHARED foo.c) -set_target_properties(Framework PROPERTIES FRAMEWORK TRUE) +add_library(Framework SHARED + foo.c + foo.h + res.txt) +set_target_properties(Framework PROPERTIES + FRAMEWORK TRUE + PUBLIC_HEADER foo.h + RESOURCE "res.txt") diff --git a/Tests/RunCMake/Framework/OSXFrameworkLayout-build-check.cmake b/Tests/RunCMake/Framework/OSXFrameworkLayout-build-check.cmake index 27d10d8cb..da1ccb40b 100644 --- a/Tests/RunCMake/Framework/OSXFrameworkLayout-build-check.cmake +++ b/Tests/RunCMake/Framework/OSXFrameworkLayout-build-check.cmake @@ -1,7 +1,10 @@ set(framework-dir "${RunCMake_TEST_BINARY_DIR}/Framework.framework") -set(plist-file "${framework-dir}/Resources/Info.plist") +set(framework-resources "${framework-dir}/Resources") +set(framework-resource-file "${framework-resources}/res.txt") set(framework-library "${framework-dir}/Framework") set(framework-versions "${framework-dir}/Versions") +set(plist-file "${framework-resources}/Info.plist") +set(framework-header "${framework-dir}/Headers/foo.h") if(NOT IS_DIRECTORY ${framework-dir}) message(SEND_ERROR "Framework not found at ${framework-dir}") @@ -15,6 +18,18 @@ if(NOT EXISTS ${framework-library}) message(SEND_ERROR "Framework library not found at ${framework-library}") endif() +if(NOT EXISTS ${framework-resource-file}) + message(SEND_ERROR "Framework resource file not found at ${framework-resource-file}") +endif() + if(NOT EXISTS ${framework-versions}) message(SEND_ERROR "Framework versions not found at ${framework-versions}") endif() + +if(NOT EXISTS ${framework-resources}) + message(SEND_ERROR "Framework Resources not found at ${framework-resources}") +endif() + +if(NOT EXISTS ${framework-header}) + message(SEND_ERROR "Framework header file not found at ${framework-header}") +endif() diff --git a/Tests/RunCMake/Framework/foo.h b/Tests/RunCMake/Framework/foo.h new file mode 100644 index 000000000..5d5f8f0c9 --- /dev/null +++ b/Tests/RunCMake/Framework/foo.h @@ -0,0 +1 @@ +int foo(); diff --git a/Tests/RunCMake/Framework/iOSFrameworkLayout-build-check.cmake b/Tests/RunCMake/Framework/iOSFrameworkLayout-build-check.cmake index 373baad7a..b81a5f732 100644 --- a/Tests/RunCMake/Framework/iOSFrameworkLayout-build-check.cmake +++ b/Tests/RunCMake/Framework/iOSFrameworkLayout-build-check.cmake @@ -1,7 +1,10 @@ set(framework-dir "${RunCMake_TEST_BINARY_DIR}/Framework.framework") -set(plist-file "${framework-dir}/Info.plist") +set(framework-resources "${framework-dir}/Resources") +set(framework-resource-file "${framework-dir}/res.txt") set(framework-library "${framework-dir}/Framework") set(framework-versions "${framework-dir}/Versions") +set(plist-file "${framework-dir}/Info.plist") +set(framework-header "${framework-dir}/Headers/foo.h") if(NOT IS_DIRECTORY ${framework-dir}) message(SEND_ERROR "Framework not found at ${framework-dir}") @@ -15,6 +18,18 @@ if(NOT EXISTS ${framework-library}) message(SEND_ERROR "Framework library not found at ${framework-library}") endif() +if(NOT EXISTS ${framework-resource-file}) + message(SEND_ERROR "Framework resource file not found at ${framework-resource-file}") +endif() + if(EXISTS ${framework-versions}) message(SEND_ERROR "Framework versions found at ${framework-versions}") endif() + +if(EXISTS ${framework-resources}) + message(SEND_ERROR "Framework Resources found at ${framework-resources}") +endif() + +if(NOT EXISTS ${framework-header}) + message(SEND_ERROR "Framework headers not found at ${framework-header}") +endif() diff --git a/Tests/RunCMake/Framework/res.txt b/Tests/RunCMake/Framework/res.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index f89d62063..395c74b30 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -3,6 +3,7 @@ include(RunCMake) run_cmake(XcodeFileType) run_cmake(XcodeAttributeGenex) run_cmake(XcodeAttributeGenexError) +run_cmake(XcodeObjectNeedsEscape) run_cmake(XcodeObjectNeedsQuote) run_cmake(XcodeOptimizationFlags) run_cmake(XcodePreserveNonOptimizationFlags) @@ -94,3 +95,39 @@ if(NOT XCODE_VERSION VERSION_LESS 7) run_cmake(XcodeTbdStub) unset(RunCMake_TEST_OPTIONS) endif() + +if(NOT XCODE_VERSION VERSION_LESS 6) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombined-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OPTIONS + "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install" + "-DCMAKE_IOS_INSTALL_COMBINED=YES") + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(XcodeIOSInstallCombined) + run_cmake_command(XcodeIOSInstallCombined-build ${CMAKE_COMMAND} --build .) + run_cmake_command(XcodeIOSInstallCombined-install ${CMAKE_COMMAND} --build . --target install) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) + unset(RunCMake_TEST_OPTIONS) + + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombinedPrune-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OPTIONS + "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install" + "-DCMAKE_IOS_INSTALL_COMBINED=YES") + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(XcodeIOSInstallCombinedPrune) + run_cmake_command(XcodeIOSInstallCombinedPrune-build ${CMAKE_COMMAND} --build .) + run_cmake_command(XcodeIOSInstallCombinedPrune-install ${CMAKE_COMMAND} --build . --target install) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) + unset(RunCMake_TEST_OPTIONS) +endif() diff --git a/Tests/RunCMake/XcodeProject/XcodeAttributeGenex-check.cmake b/Tests/RunCMake/XcodeProject/XcodeAttributeGenex-check.cmake index 637df0fd7..8a3950671 100644 --- a/Tests/RunCMake/XcodeProject/XcodeAttributeGenex-check.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeAttributeGenex-check.cmake @@ -1,3 +1,5 @@ +# per target attribute with genex + set(expect "TEST_HOST = \"[^;\"]*Tests/RunCMake/XcodeProject/XcodeAttributeGenex-build/[^;\"/]*/some\"") file(STRINGS ${RunCMake_TEST_BINARY_DIR}/XcodeAttributeGenex.xcodeproj/project.pbxproj actual REGEX "TEST_HOST = .*;" LIMIT_COUNT 1) @@ -5,3 +7,49 @@ if(NOT "${actual}" MATCHES "${expect}") message(SEND_ERROR "The actual project contains the line:\n ${actual}\n" "which does not match expected regex:\n ${expect}\n") endif() + +# per target attribute with variant + +file(STRINGS ${RunCMake_TEST_BINARY_DIR}/XcodeAttributeGenex.xcodeproj/project.pbxproj actual + REGEX "CONFIG_SPECIFIC = .*;") +list(REMOVE_DUPLICATES actual) + +set(expect "CONFIG_SPECIFIC = general") +if(NOT "${actual}" MATCHES "${expect}") + message(SEND_ERROR "The actual project contains the line:\n ${actual}\n" + "which does not match expected regex:\n ${expect}\n") +endif() + +set(expect "CONFIG_SPECIFIC = release") +if(NOT "${actual}" MATCHES "${expect}") + message(SEND_ERROR "The actual project contains the line:\n ${actual}\n" + "which does not match expected regex:\n ${expect}\n") +endif() + +# global attribute with genex + +set(expect "ANOTHER_GLOBAL = \"[^;\"]*Tests/RunCMake/XcodeProject/XcodeAttributeGenex-build/[^;\"/]*/another\"") +file(STRINGS ${RunCMake_TEST_BINARY_DIR}/XcodeAttributeGenex.xcodeproj/project.pbxproj actual + REGEX "ANOTHER_GLOBAL = .*;" LIMIT_COUNT 1) +if(NOT "${actual}" MATCHES "${expect}") + message(SEND_ERROR "The actual project contains the line:\n ${actual}\n" + "which does not match expected regex:\n ${expect}\n") +endif() + +# global attribute with variant + +file(STRINGS ${RunCMake_TEST_BINARY_DIR}/XcodeAttributeGenex.xcodeproj/project.pbxproj actual + REGEX "ANOTHER_CONFIG = .*;" LIMIT_COUNT 4) +list(REMOVE_DUPLICATES actual) + +set(expect "ANOTHER_CONFIG = general") +if(NOT "${actual}" MATCHES "${expect}") + message(SEND_ERROR "The actual project contains the line:\n ${actual}\n" + "which does not match expected regex:\n ${expect}\n") +endif() + +set(expect "ANOTHER_CONFIG = debug") +if(NOT "${actual}" MATCHES "${expect}") + message(SEND_ERROR "The actual project contains the line:\n ${actual}\n" + "which does not match expected regex:\n ${expect}\n") +endif() diff --git a/Tests/RunCMake/XcodeProject/XcodeAttributeGenex.cmake b/Tests/RunCMake/XcodeProject/XcodeAttributeGenex.cmake index 760b882c6..d8cb3bd23 100644 --- a/Tests/RunCMake/XcodeProject/XcodeAttributeGenex.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeAttributeGenex.cmake @@ -1,4 +1,16 @@ enable_language(C) add_executable(some main.c) add_executable(another main.c) -set_property(TARGET another PROPERTY XCODE_ATTRIBUTE_TEST_HOST "$") +set_target_properties(another PROPERTIES + # per target attribute with genex + XCODE_ATTRIBUTE_TEST_HOST "$" + # per target attribute with variant + XCODE_ATTRIBUTE_CONFIG_SPECIFIC[variant=Release] "release" + XCODE_ATTRIBUTE_CONFIG_SPECIFIC "general") + +# global attribute with genex +set(CMAKE_XCODE_ATTRIBUTE_ANOTHER_GLOBAL "$") + +# global attribute with variant +set(CMAKE_XCODE_ATTRIBUTE_ANOTHER_CONFIG "general") +set(CMAKE_XCODE_ATTRIBUTE_ANOTHER_CONFIG[variant=Debug] "debug") diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-install-check.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-install-check.cmake new file mode 100644 index 000000000..a1c06718f --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-install-check.cmake @@ -0,0 +1,30 @@ +function(verify_architectures file) + execute_process( + COMMAND xcrun otool -vf ${RunCMake_TEST_BINARY_DIR}/_install/${file} + OUTPUT_VARIABLE otool_out + ERROR_VARIABLE otool_err + RESULT_VARIABLE otool_result) + if(NOT otool_result EQUAL "0") + message(SEND_ERROR "Could not retrieve fat headers: ${otool_err}") + return() + endif() + + string(REGEX MATCHALL "architecture [^ \n\t]+" architectures ${otool_out}) + string(REPLACE "architecture " "" actual "${architectures}") + list(SORT actual) + + set(expected arm64 armv7 i386 x86_64) + + if(NOT actual STREQUAL expected) + message(SEND_ERROR + "The actual library contains the architectures:\n ${actual} \n" + "which do not match expected ones:\n ${expected} \n" + "otool output:\n${otool_out}") + endif() +endfunction() + +verify_architectures(bin/foo_app.app/foo_app) +verify_architectures(lib/libfoo_static.a) +verify_architectures(lib/libfoo_shared.dylib) +verify_architectures(lib/foo_bundle.bundle/foo_bundle) +verify_architectures(lib/foo_framework.framework/foo_framework) diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake new file mode 100644 index 000000000..fc830b19e --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake @@ -0,0 +1,27 @@ +cmake_minimum_required(VERSION 3.3) + +project(IOSInstallCombined CXX) + +set(CMAKE_OSX_SYSROOT iphoneos) +set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") +set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf") +set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") + +set(CMAKE_OSX_ARCHITECTURES "armv7;arm64;i386;x86_64") + +add_executable(foo_app MACOSX_BUNDLE main.cpp) +install(TARGETS foo_app BUNDLE DESTINATION bin) + +add_library(foo_static STATIC foo.cpp) +install(TARGETS foo_static ARCHIVE DESTINATION lib) + +add_library(foo_shared SHARED foo.cpp) +install(TARGETS foo_shared LIBRARY DESTINATION lib) + +add_library(foo_bundle MODULE foo.cpp) +set_target_properties(foo_bundle PROPERTIES BUNDLE TRUE) +install(TARGETS foo_bundle LIBRARY DESTINATION lib) + +add_library(foo_framework SHARED foo.cpp) +set_target_properties(foo_framework PROPERTIES FRAMEWORK TRUE) +install(TARGETS foo_framework FRAMEWORK DESTINATION lib) diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune-install-check.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune-install-check.cmake new file mode 100644 index 000000000..83da17da7 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune-install-check.cmake @@ -0,0 +1,26 @@ +function(verify_architectures file) + execute_process( + COMMAND xcrun otool -vf ${RunCMake_TEST_BINARY_DIR}/_install/${file} + OUTPUT_VARIABLE otool_out + ERROR_VARIABLE otool_err + RESULT_VARIABLE otool_result) + if(NOT otool_result EQUAL "0") + message(SEND_ERROR "Could not retrieve fat headers: ${otool_err}") + return() + endif() + + string(REGEX MATCHALL "architecture [^ \n\t]+" architectures ${otool_out}) + string(REPLACE "architecture " "" actual "${architectures}") + list(SORT actual) + + set(expected armv7 x86_64) + + if(NOT actual STREQUAL expected) + message(SEND_ERROR + "The actual library contains the architectures:\n ${actual} \n" + "which do not match expected ones:\n ${expected} \n" + "otool output:\n${otool_out}") + endif() +endfunction() + +verify_architectures(lib/libfoo.dylib) diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune-install-stdout.txt b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune-install-stdout.txt new file mode 100644 index 000000000..28edadc6b --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune-install-stdout.txt @@ -0,0 +1,2 @@ +.*Unexpected architecture `i386` detected.* +.*Unexpected architecture `arm64` detected.* \ No newline at end of file diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake new file mode 100644 index 000000000..b47d3a597 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake @@ -0,0 +1,36 @@ +cmake_minimum_required(VERSION 3.3) + +project(XcodeIOSInstallCombinedPrune CXX) + +set(CMAKE_OSX_SYSROOT iphoneos) +set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") +set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf") + +add_library(foo SHARED foo.cpp) +install(TARGETS foo DESTINATION lib) + +add_library(baz SHARED foo.cpp) +set_target_properties( + foo baz + PROPERTIES + XCODE_ATTRIBUTE_ARCHS[sdk=iphoneos*] armv7 + XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphoneos*] armv7 + XCODE_ATTRIBUTE_ARCHS[sdk=iphonesimulator*] x86_64 + XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphonesimulator*] x86_64 +) + +add_library(boo SHARED foo.cpp) +set_target_properties( + boo + PROPERTIES + XCODE_ATTRIBUTE_ARCHS[sdk=iphoneos*] arm64 + XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphoneos*] arm64 + XCODE_ATTRIBUTE_ARCHS[sdk=iphonesimulator*] i386 + XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphonesimulator*] i386 +) + +add_custom_command( + TARGET foo + POST_BUILD + COMMAND lipo -create $ $ -output $ +) diff --git a/Tests/RunCMake/XcodeProject/XcodeObjectNeedsEscape-check.cmake b/Tests/RunCMake/XcodeProject/XcodeObjectNeedsEscape-check.cmake new file mode 100644 index 000000000..c34e3feb6 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeObjectNeedsEscape-check.cmake @@ -0,0 +1,7 @@ +set(expect "-DKDESRCDIR=\\\\\\\\\\\\\"foo\\\\\\\\\\\\\"") +file(STRINGS ${RunCMake_TEST_BINARY_DIR}/XcodeObjectNeedsEscape.xcodeproj/project.pbxproj actual + REGEX "OTHER_CPLUSPLUSFLAGS = [^;]*;" LIMIT_COUNT 1) +if(NOT "${actual}" MATCHES "${expect}") + message(SEND_ERROR "The actual project contains the line:\n ${actual}\n" + "which does not match expected regex:\n ${expect}\n") +endif() diff --git a/Tests/RunCMake/XcodeProject/XcodeObjectNeedsEscape.cmake b/Tests/RunCMake/XcodeProject/XcodeObjectNeedsEscape.cmake new file mode 100644 index 000000000..7606a1906 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeObjectNeedsEscape.cmake @@ -0,0 +1,3 @@ +enable_language(CXX) +string(APPEND CMAKE_CXX_FLAGS " -DKDESRCDIR=\\\"foo\\\"") +add_library(foo STATIC foo.cpp) diff --git a/Tests/RunCMake/XcodeProject/main.cpp b/Tests/RunCMake/XcodeProject/main.cpp new file mode 100644 index 000000000..1695921f2 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/main.cpp @@ -0,0 +1,3 @@ +int main(int argc, const char * argv[]) { + return 0; +} diff --git a/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake index 2f5c938af..397c63d0a 100644 --- a/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake +++ b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake @@ -8,3 +8,5 @@ run_cmake(NoOutputOrTarget) run_cmake(OutputAndTarget) run_cmake(SourceByproducts) run_cmake(SourceUsesTerminal) +run_cmake(TargetImported) +run_cmake(TargetNotInDir) diff --git a/Tests/RunCMake/add_custom_command/TargetImported-result.txt b/Tests/RunCMake/add_custom_command/TargetImported-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/TargetImported-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_custom_command/TargetImported-stderr.txt b/Tests/RunCMake/add_custom_command/TargetImported-stderr.txt new file mode 100644 index 000000000..44c4ad886 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/TargetImported-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TargetImported.cmake:2 \(add_custom_command\): + TARGET 'TargetImported' is IMPORTED and does not build here. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/add_custom_command/TargetImported.cmake b/Tests/RunCMake/add_custom_command/TargetImported.cmake new file mode 100644 index 000000000..c0f2d66a0 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/TargetImported.cmake @@ -0,0 +1,2 @@ +add_library(TargetImported UNKNOWN IMPORTED) +add_custom_command(TARGET TargetImported COMMAND ${CMAKE_COMMAND} -E echo tada) diff --git a/Tests/RunCMake/add_custom_command/TargetNotInDir-result.txt b/Tests/RunCMake/add_custom_command/TargetNotInDir-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/TargetNotInDir-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_custom_command/TargetNotInDir-stderr.txt b/Tests/RunCMake/add_custom_command/TargetNotInDir-stderr.txt new file mode 100644 index 000000000..91876a0a0 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/TargetNotInDir-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TargetNotInDir.cmake:2 \(add_custom_command\): + TARGET 'TargetNotInDir' was not created in this directory. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/add_custom_command/TargetNotInDir.cmake b/Tests/RunCMake/add_custom_command/TargetNotInDir.cmake new file mode 100644 index 000000000..a5510262a --- /dev/null +++ b/Tests/RunCMake/add_custom_command/TargetNotInDir.cmake @@ -0,0 +1,2 @@ +add_subdirectory(TargetNotInDir) +add_custom_command(TARGET TargetNotInDir COMMAND ${CMAKE_COMMAND} -E echo tada) diff --git a/Tests/RunCMake/add_custom_command/TargetNotInDir/CMakeLists.txt b/Tests/RunCMake/add_custom_command/TargetNotInDir/CMakeLists.txt new file mode 100644 index 000000000..3d51d27b3 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/TargetNotInDir/CMakeLists.txt @@ -0,0 +1 @@ +add_custom_target(TargetNotInDir) diff --git a/Tests/RunCMake/cmake_parse_arguments/CMakeLists.txt b/Tests/RunCMake/cmake_parse_arguments/CMakeLists.txt new file mode 100644 index 000000000..6dd8cdf55 --- /dev/null +++ b/Tests/RunCMake/cmake_parse_arguments/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.4) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/cmake_parse_arguments/CornerCases.cmake b/Tests/RunCMake/cmake_parse_arguments/CornerCases.cmake new file mode 100644 index 000000000..72c82abce --- /dev/null +++ b/Tests/RunCMake/cmake_parse_arguments/CornerCases.cmake @@ -0,0 +1,34 @@ +include(${CMAKE_CURRENT_LIST_DIR}/test_utils.cmake) + +# example from the documentation +# OPTIONAL is a keyword and therefore terminates the definition of +# the multi-value DEFINITION before even a single value has been added + +set(options OPTIONAL FAST) +set(oneValueArgs DESTINATION RENAME) +set(multiValueArgs TARGETS CONFIGURATIONS) +cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" + "${multiValueArgs}" + TARGETS foo DESTINATION OPTIONAL) + +TEST(MY_INSTALL_DESTINATION UNDEFINED) +TEST(MY_INSTALL_OPTIONAL TRUE) + +macro(foo) + set(_options ) + set(_oneValueArgs FOO) + set(_multiValueArgs ) + cmake_parse_arguments(_FOO2 "${_options}" + "${_oneValueArgs}" + "${_multiValueArgs}" + "${ARGN}") + cmake_parse_arguments(_FOO1 "${_options}" + "${_oneValueArgs}" + "${_multiValueArgs}" + ${ARGN}) +endmacro() + +foo(FOO foo) + +TEST(_FOO1_FOO foo) +TEST(_FOO2_FOO foo) diff --git a/Tests/RunCMake/cmake_parse_arguments/Errors-result.txt b/Tests/RunCMake/cmake_parse_arguments/Errors-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/cmake_parse_arguments/Errors-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_parse_arguments/Errors-stderr.txt b/Tests/RunCMake/cmake_parse_arguments/Errors-stderr.txt new file mode 100644 index 000000000..f2ba9b84e --- /dev/null +++ b/Tests/RunCMake/cmake_parse_arguments/Errors-stderr.txt @@ -0,0 +1,44 @@ +CMake Error at Errors\.cmake:2 \(cmake_parse_arguments\): + cmake_parse_arguments must be called with at least 4 arguments\. +Call Stack \(most recent call first\): + CMakeLists\.txt:3 \(include\) ++ +CMake Error at Errors\.cmake:3 \(cmake_parse_arguments\): + cmake_parse_arguments must be called with at least 4 arguments\. +Call Stack \(most recent call first\): + CMakeLists\.txt:3 \(include\) ++ +CMake Error at Errors\.cmake:4 \(cmake_parse_arguments\): + cmake_parse_arguments must be called with at least 4 arguments\. +Call Stack \(most recent call first\): + CMakeLists\.txt:3 \(include\) ++ +CMake Warning at Errors\.cmake:8 \(cmake_parse_arguments\): + keyword defined more than once: OPT +Call Stack \(most recent call first\): + CMakeLists\.txt:3 \(include\) ++ +CMake Warning at Errors\.cmake:9 \(cmake_parse_arguments\): + keyword defined more than once: OPT +Call Stack \(most recent call first\): + CMakeLists\.txt:3 \(include\) ++ +CMake Warning at Errors\.cmake:10 \(cmake_parse_arguments\): + keyword defined more than once: OPT +Call Stack \(most recent call first\): + CMakeLists\.txt:3 \(include\) ++ +CMake Warning at Errors\.cmake:12 \(cmake_parse_arguments\): + keyword defined more than once: OPT +Call Stack \(most recent call first\): + CMakeLists\.txt:3 \(include\) ++ +CMake Warning at Errors\.cmake:13 \(cmake_parse_arguments\): + keyword defined more than once: OPT +Call Stack \(most recent call first\): + CMakeLists\.txt:3 \(include\) ++ +CMake Warning at Errors\.cmake:14 \(cmake_parse_arguments\): + keyword defined more than once: OPT +Call Stack \(most recent call first\): + CMakeLists\.txt:3 \(include\) diff --git a/Tests/RunCMake/cmake_parse_arguments/Errors.cmake b/Tests/RunCMake/cmake_parse_arguments/Errors.cmake new file mode 100644 index 000000000..6a380810d --- /dev/null +++ b/Tests/RunCMake/cmake_parse_arguments/Errors.cmake @@ -0,0 +1,14 @@ +# wrong argument count +cmake_parse_arguments() +cmake_parse_arguments(prefix OPT) +cmake_parse_arguments(prefix OPT SINGLE) +cmake_parse_arguments(prefix OPT SINGLE MULTI) # not an error + +# duplicate keywords +cmake_parse_arguments(prefix "OPT;OPT" "" "") +cmake_parse_arguments(prefix "" "OPT;OPT" "") +cmake_parse_arguments(prefix "" "" "OPT;OPT") + +cmake_parse_arguments(prefix "OPT" "OPT" "") +cmake_parse_arguments(prefix "" "OPT" "OPT") +cmake_parse_arguments(prefix "OPT" "" "OPT") diff --git a/Tests/RunCMake/cmake_parse_arguments/Initialization.cmake b/Tests/RunCMake/cmake_parse_arguments/Initialization.cmake new file mode 100644 index 000000000..462f923db --- /dev/null +++ b/Tests/RunCMake/cmake_parse_arguments/Initialization.cmake @@ -0,0 +1,68 @@ +include(${CMAKE_CURRENT_LIST_DIR}/test_utils.cmake) + +# unparsed arguments +cmake_parse_arguments(pref "" "" "") +TEST(pref_UNPARSED_ARGUMENTS UNDEFINED) + +cmake_parse_arguments(pref "" "" "" FOO) +TEST(pref_UNPARSED_ARGUMENTS "FOO") +cmake_parse_arguments(pref "" "" "" FOO BAR) +TEST(pref_UNPARSED_ARGUMENTS "FOO;BAR") +cmake_parse_arguments(pref "" "" "") +TEST(pref_UNPARSED_ARGUMENTS UNDEFINED) + + +# options +cmake_parse_arguments(pref "OPT1" "" "") +TEST(pref_OPT1 FALSE) + +cmake_parse_arguments(pref "OPT1;OPT2" "" "") +TEST(pref_OPT1 FALSE) +TEST(pref_OPT2 FALSE) + +cmake_parse_arguments(pref "OPT1" "" "" OPT1) +TEST(pref_OPT1 TRUE) +cmake_parse_arguments(pref "OPT1;OPT2" "" "" OPT1 OPT2) +TEST(pref_OPT1 TRUE) +TEST(pref_OPT2 TRUE) +cmake_parse_arguments(pref "OPT1;OPT2" "" "") +TEST(pref_OPT1 FALSE) +TEST(pref_OPT2 FALSE) + + +# single arguments +cmake_parse_arguments(pref "" "SINGLE1" "") +TEST(pref_SINGLE1 UNDEFINED) + +cmake_parse_arguments(pref "" "SINGLE1;SINGLE2" "") +TEST(pref_SINGLE1 UNDEFINED) +TEST(pref_SINGLE2 UNDEFINED) + + +cmake_parse_arguments(pref "" "SINGLE1" "" SINGLE1 foo) +TEST(pref_SINGLE1 foo) +cmake_parse_arguments(pref "" "SINGLE1;SINGLE2" "" SINGLE1 foo SINGLE2 bar) +TEST(pref_SINGLE1 foo) +TEST(pref_SINGLE2 bar) +cmake_parse_arguments(pref "" "SINGLE1;SINGLE2" "") +TEST(pref_SINGLE1 UNDEFINED) +TEST(pref_SINGLE2 UNDEFINED) + + +# multi arguments + +cmake_parse_arguments(pref "" "" "MULTI1") +TEST(pref_MULTI1 UNDEFINED) + +cmake_parse_arguments(pref "" "" "MULTI1;MULTI2") +TEST(pref_MULTI1 UNDEFINED) +TEST(pref_MULTI2 UNDEFINED) + +cmake_parse_arguments(pref "" "" "MULTI1" MULTI1 foo) +TEST(pref_MULTI1 foo) +cmake_parse_arguments(pref "" "" "MULTI1;MULTI2" MULTI1 foo bar MULTI2 bar foo) +TEST(pref_MULTI1 foo bar) +TEST(pref_MULTI2 bar foo) +cmake_parse_arguments(pref "" "" "MULTI1;MULTI2") +TEST(pref_MULTI1 UNDEFINED) +TEST(pref_MULTI2 UNDEFINED) diff --git a/Tests/RunCMake/cmake_parse_arguments/Mix.cmake b/Tests/RunCMake/cmake_parse_arguments/Mix.cmake new file mode 100644 index 000000000..b3eff3947 --- /dev/null +++ b/Tests/RunCMake/cmake_parse_arguments/Mix.cmake @@ -0,0 +1,24 @@ +include(${CMAKE_CURRENT_LIST_DIR}/test_utils.cmake) + +# specify two keywords for each category and set the first keyword of each +# within ARGN +cmake_parse_arguments(pref "OPT1;OPT2" "SINGLE1;SINGLE2" "MULTI1;MULTI2" + OPT1 SINGLE1 foo MULTI1 bar foo bar) +TEST(pref_OPT1 TRUE) +TEST(pref_OPT2 FALSE) +TEST(pref_SINGLE1 foo) +TEST(pref_SINGLE2 UNDEFINED) +TEST(pref_MULTI1 bar foo bar) +TEST(pref_MULTI2 UNDEFINED) +TEST(pref_UNPARSED_ARGUMENTS UNDEFINED) + +# same as above but reversed ARGN +cmake_parse_arguments(pref "OPT1;OPT2" "SINGLE1;SINGLE2" "MULTI1;MULTI2" + MULTI1 bar foo bar SINGLE1 foo OPT1) +TEST(pref_OPT1 TRUE) +TEST(pref_OPT2 FALSE) +TEST(pref_SINGLE1 foo) +TEST(pref_SINGLE2 UNDEFINED) +TEST(pref_MULTI1 bar foo bar) +TEST(pref_MULTI2 UNDEFINED) +TEST(pref_UNPARSED_ARGUMENTS UNDEFINED) diff --git a/Tests/RunCMake/cmake_parse_arguments/RunCMakeTest.cmake b/Tests/RunCMake/cmake_parse_arguments/RunCMakeTest.cmake new file mode 100644 index 000000000..b89f1a55e --- /dev/null +++ b/Tests/RunCMake/cmake_parse_arguments/RunCMakeTest.cmake @@ -0,0 +1,7 @@ +include(RunCMake) + +run_cmake(Utils) +run_cmake(Initialization) +run_cmake(Mix) +run_cmake(CornerCases) +run_cmake(Errors) diff --git a/Tests/RunCMake/cmake_parse_arguments/Utils.cmake b/Tests/RunCMake/cmake_parse_arguments/Utils.cmake new file mode 100644 index 000000000..3bbf115e8 --- /dev/null +++ b/Tests/RunCMake/cmake_parse_arguments/Utils.cmake @@ -0,0 +1,20 @@ +include(${CMAKE_CURRENT_LIST_DIR}/test_utils.cmake) + +# test the TEST macro itself + +TEST(asdf UNDEFINED) + +SET (asdf FALSE) +TEST(asdf FALSE) + +SET (asdf TRUE) +TEST(asdf TRUE) + +SET (asdf TRUE) +TEST(asdf TRUE) + +SET (asdf "some value") +TEST(asdf "some value") + +SET (asdf some list) +TEST(asdf "some;list") diff --git a/Tests/RunCMake/cmake_parse_arguments/test_utils.cmake b/Tests/RunCMake/cmake_parse_arguments/test_utils.cmake new file mode 100644 index 000000000..f5425c2bc --- /dev/null +++ b/Tests/RunCMake/cmake_parse_arguments/test_utils.cmake @@ -0,0 +1,20 @@ +macro(TEST variable) + SET(expected "${ARGN}") + if ( "${expected}" STREQUAL "UNDEFINED" ) + if (DEFINED ${variable}) + message(FATAL_ERROR "'${variable}' shall be undefined but has value '${${variable}}'") + endif() + elseif( "${expected}" STREQUAL "FALSE" ) + if (NOT ${variable} STREQUAL "FALSE") + message(FATAL_ERROR "'${variable}' shall be FALSE") + endif() + elseif( "${expected}" STREQUAL "TRUE" ) + if (NOT ${variable} STREQUAL "TRUE") + message(FATAL_ERROR "'${variable}' shall be TRUE") + endif() + else() + if (NOT ${variable} STREQUAL "${expected}") + message(FATAL_ERROR "'${variable}' shall be '${expected}'") + endif() + endif() +endmacro() diff --git a/Tests/RunCMake/ctest_submit/CDashSubmitQuiet-stderr.txt b/Tests/RunCMake/ctest_submit/CDashSubmitQuiet-stderr.txt index adf334bba..4825d7a8e 100644 --- a/Tests/RunCMake/ctest_submit/CDashSubmitQuiet-stderr.txt +++ b/Tests/RunCMake/ctest_submit/CDashSubmitQuiet-stderr.txt @@ -1,3 +1,3 @@ *Error when uploading file: .*/Configure.xml - *Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?|The requested URL returned error:.*) + *Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?.*|The requested URL returned error:.*) *Problems when submitting via HTTP diff --git a/Tests/RunCMake/ctest_submit/FailDrop-ftp-stderr.txt b/Tests/RunCMake/ctest_submit/FailDrop-ftp-stderr.txt index 64c301132..b9d9394fb 100644 --- a/Tests/RunCMake/ctest_submit/FailDrop-ftp-stderr.txt +++ b/Tests/RunCMake/ctest_submit/FailDrop-ftp-stderr.txt @@ -1,2 +1,2 @@ -Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?|The requested URL returned error:.*) +Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?.*|The requested URL returned error:.*) Problems when submitting via FTP diff --git a/Tests/RunCMake/ctest_submit/FailDrop-http-stderr.txt b/Tests/RunCMake/ctest_submit/FailDrop-http-stderr.txt index 73f013880..f52d2d844 100644 --- a/Tests/RunCMake/ctest_submit/FailDrop-http-stderr.txt +++ b/Tests/RunCMake/ctest_submit/FailDrop-http-stderr.txt @@ -1,2 +1,2 @@ -Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?|The requested URL returned error:.*) +Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?.*|The requested URL returned error:.*) Problems when submitting via HTTP diff --git a/Tests/RunCMake/ctest_submit/FailDrop-https-stderr.txt b/Tests/RunCMake/ctest_submit/FailDrop-https-stderr.txt index a1ba4f636..24083f2bc 100644 --- a/Tests/RunCMake/ctest_submit/FailDrop-https-stderr.txt +++ b/Tests/RunCMake/ctest_submit/FailDrop-https-stderr.txt @@ -1,2 +1,2 @@ -Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?|The requested URL returned error:.*|Protocol "https" not supported or disabled in .*|.* was built with SSL disabled.*) +Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?.*|The requested URL returned error:.*|Protocol "https" not supported or disabled in .*|.* was built with SSL disabled.*) Problems when submitting via HTTP diff --git a/Tests/RunCMake/if/MatchesSelf.cmake b/Tests/RunCMake/if/MatchesSelf.cmake new file mode 100644 index 000000000..3131ac4f4 --- /dev/null +++ b/Tests/RunCMake/if/MatchesSelf.cmake @@ -0,0 +1,4 @@ +foreach(n 0 1 2 3 4 5 6 7 8 9 COUNT) + if(CMAKE_MATCH_${n} MATCHES "x") + endif() +endforeach() diff --git a/Tests/RunCMake/if/RunCMakeTest.cmake b/Tests/RunCMake/if/RunCMakeTest.cmake index 3f4d2a24d..077d00a05 100644 --- a/Tests/RunCMake/if/RunCMakeTest.cmake +++ b/Tests/RunCMake/if/RunCMakeTest.cmake @@ -5,5 +5,7 @@ run_cmake(IsDirectory) run_cmake(IsDirectoryLong) run_cmake(elseif-message) +run_cmake(MatchesSelf) + run_cmake(TestNameThatExists) run_cmake(TestNameThatDoesNotExist) diff --git a/Tests/RunCMake/install/CMP0062-NEW.cmake b/Tests/RunCMake/install/CMP0062-NEW.cmake index a696f56fc..9e7a5fb82 100644 --- a/Tests/RunCMake/install/CMP0062-NEW.cmake +++ b/Tests/RunCMake/install/CMP0062-NEW.cmake @@ -1,4 +1,4 @@ - +cmake_policy(VERSION 3.2) cmake_policy(SET CMP0062 NEW) add_library(iface INTERFACE) diff --git a/Tests/RunCMake/install/CMP0062-OLD.cmake b/Tests/RunCMake/install/CMP0062-OLD.cmake index 94b809a98..8874923b4 100644 --- a/Tests/RunCMake/install/CMP0062-OLD.cmake +++ b/Tests/RunCMake/install/CMP0062-OLD.cmake @@ -1,4 +1,4 @@ - +cmake_policy(VERSION 3.2) cmake_policy(SET CMP0062 OLD) add_library(iface INTERFACE) diff --git a/Tests/RunCMake/install/CMP0062-WARN.cmake b/Tests/RunCMake/install/CMP0062-WARN.cmake index 0435a640e..018f82275 100644 --- a/Tests/RunCMake/install/CMP0062-WARN.cmake +++ b/Tests/RunCMake/install/CMP0062-WARN.cmake @@ -1,3 +1,4 @@ +cmake_policy(VERSION 3.2) add_library(iface INTERFACE) export(TARGETS iface FILE "${CMAKE_CURRENT_BINARY_DIR}/exported.cmake") diff --git a/Tests/RunCMake/install/CMakeLists.txt b/Tests/RunCMake/install/CMakeLists.txt index 4b3de84d9..6dd8cdf55 100644 --- a/Tests/RunCMake/install/CMakeLists.txt +++ b/Tests/RunCMake/install/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.4) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad-result.txt b/Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad-stderr.txt b/Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad-stderr.txt new file mode 100644 index 000000000..984415868 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad-stderr.txt @@ -0,0 +1,6 @@ +CMake Error: + Error evaluating generator expression: + + \$ + + Expression did not evaluate to a known generator expression diff --git a/Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad.cmake b/Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad.cmake new file mode 100644 index 000000000..ec0436d38 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad.cmake @@ -0,0 +1 @@ +install(DIRECTORY $ DESTINATION .) diff --git a/Tests/RunCMake/install/EXPORT-OldIFace.cmake b/Tests/RunCMake/install/EXPORT-OldIFace.cmake new file mode 100644 index 000000000..033f68446 --- /dev/null +++ b/Tests/RunCMake/install/EXPORT-OldIFace.cmake @@ -0,0 +1,7 @@ +enable_language(C) +set(CMAKE_BUILD_WITH_INSTALL_RPATH 1) +add_subdirectory(EXPORT-OldIFace) +add_library(foo SHARED empty.c) +target_link_libraries(foo bar) +install(TARGETS foo DESTINATION lib EXPORT fooExport) +install(EXPORT fooExport DESTINATION lib/cmake/foo EXPORT_LINK_INTERFACE_LIBRARIES) diff --git a/Tests/RunCMake/install/EXPORT-OldIFace/CMakeLists.txt b/Tests/RunCMake/install/EXPORT-OldIFace/CMakeLists.txt new file mode 100644 index 000000000..32292e2f6 --- /dev/null +++ b/Tests/RunCMake/install/EXPORT-OldIFace/CMakeLists.txt @@ -0,0 +1,2 @@ +add_library(bar SHARED ../empty.c) +install(TARGETS bar DESTINATION lib EXPORT fooExport) diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index 043bd1ff3..c2347d89d 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -6,9 +6,11 @@ run_cmake(DIRECTORY-message-lazy) run_cmake(SkipInstallRulesWarning) run_cmake(SkipInstallRulesNoWarning1) run_cmake(SkipInstallRulesNoWarning2) +run_cmake(DIRECTORY-DIRECTORY-bad) run_cmake(DIRECTORY-DESTINATION-bad) run_cmake(FILES-DESTINATION-bad) run_cmake(TARGETS-DESTINATION-bad) +run_cmake(EXPORT-OldIFace) run_cmake(CMP0062-OLD) run_cmake(CMP0062-NEW) run_cmake(CMP0062-WARN) diff --git a/Tests/RunCMake/message/RunCMakeTest.cmake b/Tests/RunCMake/message/RunCMakeTest.cmake index 294dfbbdc..94896930a 100644 --- a/Tests/RunCMake/message/RunCMakeTest.cmake +++ b/Tests/RunCMake/message/RunCMakeTest.cmake @@ -3,4 +3,8 @@ include(RunCMake) run_cmake(defaultmessage) run_cmake(nomessage) run_cmake(warnmessage) -run_cmake(errormessage) +# message command sets fatal occurred flag, so check each type of error + +# seperately +run_cmake(errormessage_deprecated) +run_cmake(errormessage_dev) diff --git a/Tests/RunCMake/message/errormessage-stderr.txt b/Tests/RunCMake/message/errormessage-stderr.txt deleted file mode 100644 index 49e7ca913..000000000 --- a/Tests/RunCMake/message/errormessage-stderr.txt +++ /dev/null @@ -1,4 +0,0 @@ -CMake Deprecation Error at errormessage.cmake:4 \(message\): - This is an error -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/message/errormessage.cmake b/Tests/RunCMake/message/errormessage.cmake deleted file mode 100644 index 7d3b7792b..000000000 --- a/Tests/RunCMake/message/errormessage.cmake +++ /dev/null @@ -1,4 +0,0 @@ - -set(CMAKE_ERROR_DEPRECATED ON) - -message(DEPRECATION "This is an error") diff --git a/Tests/RunCMake/message/errormessage_deprecated-result.txt b/Tests/RunCMake/message/errormessage_deprecated-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/message/errormessage_deprecated-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/message/errormessage_deprecated-stderr.txt b/Tests/RunCMake/message/errormessage_deprecated-stderr.txt new file mode 100644 index 000000000..dd21c3b3b --- /dev/null +++ b/Tests/RunCMake/message/errormessage_deprecated-stderr.txt @@ -0,0 +1,4 @@ +^CMake Deprecation Error at errormessage_deprecated.cmake:3 \(message\): + This is a deprecation error +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/message/errormessage_deprecated.cmake b/Tests/RunCMake/message/errormessage_deprecated.cmake new file mode 100644 index 000000000..579275e94 --- /dev/null +++ b/Tests/RunCMake/message/errormessage_deprecated.cmake @@ -0,0 +1,3 @@ +set(CMAKE_ERROR_DEPRECATED ON) + +message(DEPRECATION "This is a deprecation error") diff --git a/Tests/RunCMake/message/errormessage_dev-result.txt b/Tests/RunCMake/message/errormessage_dev-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/message/errormessage_dev-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/message/errormessage_dev-stderr.txt b/Tests/RunCMake/message/errormessage_dev-stderr.txt new file mode 100644 index 000000000..086b55c47 --- /dev/null +++ b/Tests/RunCMake/message/errormessage_dev-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error \(dev\) at errormessage_dev.cmake:3 \(message\): + This is a author error +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This error is for project developers. Use -Wno-error=dev to suppress it.$ diff --git a/Tests/RunCMake/message/errormessage_dev.cmake b/Tests/RunCMake/message/errormessage_dev.cmake new file mode 100644 index 000000000..6ba11657f --- /dev/null +++ b/Tests/RunCMake/message/errormessage_dev.cmake @@ -0,0 +1,3 @@ +set(CMAKE_SUPPRESS_DEVELOPER_ERRORS OFF) + +message(AUTHOR_WARNING "This is a author error") diff --git a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake index 8307607bc..1466fbf61 100644 --- a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake @@ -8,3 +8,5 @@ run_cmake(MixedSignature) run_cmake(Separate-PRIVATE-LINK_PRIVATE-uses) run_cmake(SubDirTarget) run_cmake(SharedDepNotTarget) +run_cmake(StaticPrivateDepNotExported) +run_cmake(StaticPrivateDepNotTarget) diff --git a/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported-result.txt b/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported-stderr.txt b/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported-stderr.txt new file mode 100644 index 000000000..6bb44ab4b --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported-stderr.txt @@ -0,0 +1 @@ +CMake Error: install\(EXPORT "Exp" ...\) includes target "foo" which requires target "not_exported" that is not in the export set. diff --git a/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported.cmake b/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported.cmake new file mode 100644 index 000000000..9b97918a5 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported.cmake @@ -0,0 +1,7 @@ +cmake_policy(SET CMP0022 NEW) +enable_language(C) +add_library(foo STATIC empty.c) +add_library(not_exported STATIC empty.c) +target_link_libraries(foo PRIVATE not_exported) +install(TARGETS foo EXPORT Exp DESTINATION lib) +install(EXPORT Exp DESTINATION lib/cmake/Exp) diff --git a/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotTarget.cmake b/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotTarget.cmake new file mode 100644 index 000000000..7122ae91e --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotTarget.cmake @@ -0,0 +1,6 @@ +cmake_policy(SET CMP0022 NEW) +enable_language(C) +add_library(foo STATIC empty.c) +target_link_libraries(foo PRIVATE not_a_target) +install(TARGETS foo EXPORT Exp DESTINATION lib) +install(EXPORT Exp DESTINATION lib/cmake/Exp) diff --git a/Tests/SimpleInstall/CMakeLists.txt b/Tests/SimpleInstall/CMakeLists.txt index e365076c0..2737f182f 100644 --- a/Tests/SimpleInstall/CMakeLists.txt +++ b/Tests/SimpleInstall/CMakeLists.txt @@ -252,7 +252,7 @@ else() file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS") file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS") install( - DIRECTORY TestSubDir scripts/ DESTINATION $<1:MyTest/share>$<0:/wrong> + DIRECTORY TestSubDir $<1:scripts/>$<0:/wrong> DESTINATION $<1:MyTest/share>$<0:/wrong> FILE_PERMISSIONS OWNER_READ OWNER_WRITE DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE @@ -263,7 +263,7 @@ else() # Alternate directory installation for coverage. install( - DIRECTORY scripts/ DESTINATION $<1:MyTest/share/alt>$<0:/wrong> + DIRECTORY $<1:scripts/>$<0:/wrong> DESTINATION $<1:MyTest/share/alt>$<0:/wrong> COMPONENT Development USE_SOURCE_PERMISSIONS PATTERN "CVS" EXCLUDE diff --git a/Tests/SimpleInstallS2/CMakeLists.txt b/Tests/SimpleInstallS2/CMakeLists.txt index e365076c0..2737f182f 100644 --- a/Tests/SimpleInstallS2/CMakeLists.txt +++ b/Tests/SimpleInstallS2/CMakeLists.txt @@ -252,7 +252,7 @@ else() file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS") file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS") install( - DIRECTORY TestSubDir scripts/ DESTINATION $<1:MyTest/share>$<0:/wrong> + DIRECTORY TestSubDir $<1:scripts/>$<0:/wrong> DESTINATION $<1:MyTest/share>$<0:/wrong> FILE_PERMISSIONS OWNER_READ OWNER_WRITE DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE @@ -263,7 +263,7 @@ else() # Alternate directory installation for coverage. install( - DIRECTORY scripts/ DESTINATION $<1:MyTest/share/alt>$<0:/wrong> + DIRECTORY $<1:scripts/>$<0:/wrong> DESTINATION $<1:MyTest/share/alt>$<0:/wrong> COMPONENT Development USE_SOURCE_PERMISSIONS PATTERN "CVS" EXCLUDE diff --git a/Tests/Wrapping/CMakeLists.txt b/Tests/Wrapping/CMakeLists.txt index cbb28a1b0..aca36bc31 100644 --- a/Tests/Wrapping/CMakeLists.txt +++ b/Tests/Wrapping/CMakeLists.txt @@ -85,16 +85,18 @@ endif () # Since FLTK_FLUID_EXE is supposed to create a .cxx/.h from a .fl/.fld, # create an empty one so that the dependencies can be met. # -set (FLTK_SRCS - fltk1.fl - ) add_executable(fakefluid fakefluid.cxx) set (FLTK_WRAP_UI "On") set (FLTK_FLUID_EXECUTABLE fakefluid) -fltk_wrap_ui (wraplibFLTK ${FLTK_SRCS}) +fltk_wrap_ui (wraplibFLTK fltk1.fl) add_library(wraplibFLTK ${wraplibFLTK_FLTK_UI_SRCS}) add_dependencies(wraplibFLTK fakefluid) add_dependencies(fakefluid Wrap) +fltk_wrap_ui (wrapFLTK fltk2.fl) +add_executable(wrapFLTK wrapFLTK.c ${wrapFLTK_FLTK_UI_SRCS}) +target_link_libraries(wrapFLTK wraplibFLTK) +add_dependencies(wrapFLTK fakefluid) + # # Mangled Mesa # diff --git a/Tests/Wrapping/fltk2.fl b/Tests/Wrapping/fltk2.fl new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/Wrapping/wrapFLTK.c b/Tests/Wrapping/wrapFLTK.c new file mode 100644 index 000000000..78f2de106 --- /dev/null +++ b/Tests/Wrapping/wrapFLTK.c @@ -0,0 +1 @@ +int main(void) { return 0; } diff --git a/Utilities/CMakeLists.txt b/Utilities/CMakeLists.txt index 8b3e325fa..cf6bb7285 100644 --- a/Utilities/CMakeLists.txt +++ b/Utilities/CMakeLists.txt @@ -33,3 +33,7 @@ else() # Normal documentation build. add_subdirectory(Sphinx) endif() + +if(WIX_CUSTOM_ACTION_ENABLED) + add_subdirectory(Release/WiX) +endif() diff --git a/Utilities/KWIML/.gitattributes b/Utilities/KWIML/.gitattributes new file mode 100644 index 000000000..ecbf2196c --- /dev/null +++ b/Utilities/KWIML/.gitattributes @@ -0,0 +1 @@ +*.md conflict-marker-size=78 diff --git a/Utilities/KWIML/ABI.h.in b/Utilities/KWIML/ABI.h.in deleted file mode 100644 index 87b6e96da..000000000 --- a/Utilities/KWIML/ABI.h.in +++ /dev/null @@ -1,506 +0,0 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Kitware, Inc. nor the names of its contributors - may be used to endorse or promote products derived from this - software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -============================================================================*/ -#ifndef @KWIML@_ABI_H -#define @KWIML@_ABI_H -/* -This header defines macros with information about the C ABI. -Only information that can be determined using the preprocessor at -compilation time is available. No try-compile results may be added -here. Instead we memorize results on platforms of interest. - -An includer may optionally define the following macros to suppress errors: - - @KWIML@_ABI_NO_VERIFY = skip verification declarations - @KWIML@_ABI_NO_ERROR_CHAR_SIGN = signedness of 'char' may be unknown - @KWIML@_ABI_NO_ERROR_LONG_LONG = existence of 'long long' may be unknown - @KWIML@_ABI_NO_ERROR_ENDIAN = byte order of CPU may be unknown - -An includer may test the following macros after inclusion: - - @KWIML@_ABI_SIZEOF_DATA_PTR = sizeof(void*) - @KWIML@_ABI_SIZEOF_CODE_PTR = sizeof(void(*)(void)) - @KWIML@_ABI_SIZEOF_FLOAT = sizeof(float) - @KWIML@_ABI_SIZEOF_DOUBLE = sizeof(double) - @KWIML@_ABI_SIZEOF_CHAR = sizeof(char) - @KWIML@_ABI_SIZEOF_SHORT = sizeof(short) - @KWIML@_ABI_SIZEOF_INT = sizeof(int) - @KWIML@_ABI_SIZEOF_LONG = sizeof(long) - - @KWIML@_ABI_SIZEOF_LONG_LONG = sizeof(long long) or 0 if not a type - Undefined if existence is unknown and error suppression macro - @KWIML@_ABI_NO_ERROR_LONG_LONG was defined. - - @KWIML@_ABI_SIZEOF___INT64 = 8 if '__int64' exists or 0 if not - Undefined if existence is unknown. - - @KWIML@_ABI___INT64_IS_LONG = 1 if '__int64' is 'long' (same type) - Undefined otherwise. - @KWIML@_ABI___INT64_IS_LONG_LONG = 1 if '__int64' is 'long long' (same type) - Undefined otherwise. - @KWIML@_ABI___INT64_IS_UNIQUE = 1 if '__int64' is a distinct type - Undefined otherwise. - - @KWIML@_ABI_CHAR_IS_UNSIGNED = 1 if 'char' is unsigned, else undefined - @KWIML@_ABI_CHAR_IS_SIGNED = 1 if 'char' is signed, else undefined - One of these is defined unless signedness of 'char' is unknown and - error suppression macro @KWIML@_ABI_NO_ERROR_CHAR_SIGN was defined. - - @KWIML@_ABI_ENDIAN_ID_BIG = id for big-endian (always defined) - @KWIML@_ABI_ENDIAN_ID_LITTLE = id for little-endian (always defined) - @KWIML@_ABI_ENDIAN_ID = id of byte order of target CPU - Defined to @KWIML@_ABI_ENDIAN_ID_BIG or @KWIML@_ABI_ENDIAN_ID_LITTLE - unless byte order is unknown and error suppression macro - @KWIML@_ABI_NO_ERROR_ENDIAN was defined. - -We verify most results using dummy "extern" declarations that are -invalid if the macros are wrong. Verification is disabled if -suppression macro @KWIML@_ABI_NO_VERIFY was defined. -*/ - -/*--------------------------------------------------------------------------*/ -#if !defined(@KWIML@_ABI_SIZEOF_DATA_PTR) -# if defined(__SIZEOF_POINTER__) -# define @KWIML@_ABI_SIZEOF_DATA_PTR __SIZEOF_POINTER__ -# elif defined(_SIZE_PTR) -# define @KWIML@_ABI_SIZEOF_DATA_PTR (_SIZE_PTR >> 3) -# elif defined(_LP64) || defined(__LP64__) -# define @KWIML@_ABI_SIZEOF_DATA_PTR 8 -# elif defined(_ILP32) -# define @KWIML@_ABI_SIZEOF_DATA_PTR 4 -# elif defined(__64BIT__) /* IBM XL */ -# define @KWIML@_ABI_SIZEOF_DATA_PTR 8 -# elif defined(_M_X64) -# define @KWIML@_ABI_SIZEOF_DATA_PTR 8 -# elif defined(__ia64) -# define @KWIML@_ABI_SIZEOF_DATA_PTR 8 -# elif defined(__sparcv9) -# define @KWIML@_ABI_SIZEOF_DATA_PTR 8 -# elif defined(__x86_64) || defined(__x86_64__) -# define @KWIML@_ABI_SIZEOF_DATA_PTR 8 -# elif defined(__amd64) || defined(__amd64__) -# define @KWIML@_ABI_SIZEOF_DATA_PTR 8 -# elif defined(__i386) || defined(__i386__) -# define @KWIML@_ABI_SIZEOF_DATA_PTR 4 -# endif -#endif -#if !defined(@KWIML@_ABI_SIZEOF_DATA_PTR) -# define @KWIML@_ABI_SIZEOF_DATA_PTR 4 -#endif -#if !defined(@KWIML@_ABI_SIZEOF_CODE_PTR) -# define @KWIML@_ABI_SIZEOF_CODE_PTR @KWIML@_ABI_SIZEOF_DATA_PTR -#endif - -/*--------------------------------------------------------------------------*/ -#if !defined(@KWIML@_ABI_SIZEOF_CHAR) -# define @KWIML@_ABI_SIZEOF_CHAR 1 -#endif - -#if !defined(@KWIML@_ABI_CHAR_IS_UNSIGNED) && !defined(@KWIML@_ABI_CHAR_IS_SIGNED) -# if defined(__CHAR_UNSIGNED__) /* GNU, some IBM XL, others? */ -# define @KWIML@_ABI_CHAR_IS_UNSIGNED 1 -# elif defined(_CHAR_UNSIGNED) /* Intel, IBM XL, MSVC, Borland, others? */ -# define @KWIML@_ABI_CHAR_IS_UNSIGNED 1 -# elif defined(_CHAR_SIGNED) /* IBM XL, others? */ -# define @KWIML@_ABI_CHAR_IS_SIGNED 1 -# elif defined(__CHAR_SIGNED__) /* IBM XL, Watcom, others? */ -# define @KWIML@_ABI_CHAR_IS_SIGNED 1 -# elif defined(__SIGNED_CHARS__) /* EDG, Intel, SGI MIPSpro */ -# define @KWIML@_ABI_CHAR_IS_SIGNED 1 -# elif defined(_CHAR_IS_SIGNED) /* Some SunPro, others? */ -# define @KWIML@_ABI_CHAR_IS_SIGNED 1 -# elif defined(_CHAR_IS_UNSIGNED) /* SunPro, others? */ -# define @KWIML@_ABI_CHAR_IS_UNSIGNED 1 -# elif defined(__GNUC__) /* GNU default */ -# define @KWIML@_ABI_CHAR_IS_SIGNED 1 -# elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) /* SunPro default */ -# define @KWIML@_ABI_CHAR_IS_SIGNED 1 -# elif defined(__HP_cc) || defined(__HP_aCC) /* HP default (unless +uc) */ -# define @KWIML@_ABI_CHAR_IS_SIGNED 1 -# elif defined(_SGI_COMPILER_VERSION) /* SGI MIPSpro default */ -# define @KWIML@_ABI_CHAR_IS_UNSIGNED 1 -# elif defined(__PGIC__) /* PGI default */ -# define @KWIML@_ABI_CHAR_IS_SIGNED 1 -# elif defined(_MSC_VER) /* MSVC default */ -# define @KWIML@_ABI_CHAR_IS_SIGNED 1 -# elif defined(__WATCOMC__) /* Watcom default */ -# define @KWIML@_ABI_CHAR_IS_UNSIGNED 1 -# elif defined(__BORLANDC__) /* Borland default */ -# define @KWIML@_ABI_CHAR_IS_SIGNED 1 -# elif defined(__hpux) /* Old HP: no __HP_cc/__HP_aCC/__GNUC__ above */ -# define @KWIML@_ABI_CHAR_IS_SIGNED 1 /* (unless +uc) */ -# endif -#endif -#if !defined(@KWIML@_ABI_CHAR_IS_UNSIGNED) && !defined(@KWIML@_ABI_CHAR_IS_SIGNED) \ - && !defined(@KWIML@_ABI_NO_ERROR_CHAR_SIGN) -# error "Signedness of 'char' unknown." -#endif - -/*--------------------------------------------------------------------------*/ -#if !defined(@KWIML@_ABI_SIZEOF_SHORT) -# if defined(__SIZEOF_SHORT__) -# define @KWIML@_ABI_SIZEOF_SHORT __SIZEOF_SHORT__ -# endif -#endif -#if !defined(@KWIML@_ABI_SIZEOF_SHORT) -# define @KWIML@_ABI_SIZEOF_SHORT 2 -#endif - -/*--------------------------------------------------------------------------*/ -#if !defined(@KWIML@_ABI_SIZEOF_INT) -# if defined(__SIZEOF_INT__) -# define @KWIML@_ABI_SIZEOF_INT __SIZEOF_INT__ -# elif defined(_SIZE_INT) -# define @KWIML@_ABI_SIZEOF_INT (_SIZE_INT >> 3) -# endif -#endif -#if !defined(@KWIML@_ABI_SIZEOF_INT) -# define @KWIML@_ABI_SIZEOF_INT 4 -#endif - -/*--------------------------------------------------------------------------*/ -#if !defined(@KWIML@_ABI_SIZEOF_LONG) -# if defined(__SIZEOF_LONG__) -# define @KWIML@_ABI_SIZEOF_LONG __SIZEOF_LONG__ -# elif defined(_SIZE_LONG) -# define @KWIML@_ABI_SIZEOF_LONG (_SIZE_LONG >> 3) -# elif defined(__LONG_MAX__) -# if __LONG_MAX__ == 0x7fffffff -# define @KWIML@_ABI_SIZEOF_LONG 4 -# elif __LONG_MAX__>>32 == 0x7fffffff -# define @KWIML@_ABI_SIZEOF_LONG 8 -# endif -# elif defined(_MSC_VER) /* MSVC and Intel on Windows */ -# define @KWIML@_ABI_SIZEOF_LONG 4 -# endif -#endif -#if !defined(@KWIML@_ABI_SIZEOF_LONG) -# define @KWIML@_ABI_SIZEOF_LONG @KWIML@_ABI_SIZEOF_DATA_PTR -#endif - -/*--------------------------------------------------------------------------*/ -#if !defined(@KWIML@_ABI_SIZEOF_LONG_LONG) -# if defined(__SIZEOF_LONG_LONG__) -# define @KWIML@_ABI_SIZEOF_LONG_LONG __SIZEOF_LONG_LONG__ -# elif defined(__LONG_LONG_MAX__) -# if __LONG_LONG_MAX__ == 0x7fffffff -# define @KWIML@_ABI_SIZEOF_LONG_LONG 4 -# elif __LONG_LONG_MAX__>>32 == 0x7fffffff -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# endif -# endif -#endif -#if !defined(@KWIML@_ABI_SIZEOF_LONG_LONG) -# if defined(_LONGLONG) /* SGI, some GNU, perhaps others. */ \ - && !defined(_MSC_VER) -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# elif defined(_LONG_LONG) /* IBM XL, perhaps others. */ -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# elif defined(__NO_LONG_LONG) /* EDG */ -# define @KWIML@_ABI_SIZEOF_LONG_LONG 0 -# elif defined(__cplusplus) && __cplusplus > 199711L /* C++0x */ -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) /* SunPro */ -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# elif defined(__HP_cc) || defined(__HP_aCC) /* HP */ -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# elif defined(__PGIC__) /* PGI */ -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# elif defined(__WATCOMC__) /* Watcom */ -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# elif defined(__INTEL_COMPILER) /* Intel */ -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# elif defined(__BORLANDC__) /* Borland */ -# if __BORLANDC__ >= 0x0560 -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# else -# define @KWIML@_ABI_SIZEOF_LONG_LONG 0 -# endif -# elif defined(_MSC_VER) /* Microsoft */ -# if _MSC_VER >= 1310 -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# else -# define @KWIML@_ABI_SIZEOF_LONG_LONG 0 -# endif -# elif defined(__GNUC__) /* GNU */ -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# elif defined(__hpux) /* Old HP: no __HP_cc/__HP_aCC/__GNUC__ above */ -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# endif -#endif -#if !defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && !defined(@KWIML@_ABI_NO_ERROR_LONG_LONG) -# error "Existence of 'long long' unknown." -#endif - -/*--------------------------------------------------------------------------*/ -#if !defined(@KWIML@_ABI_SIZEOF___INT64) -# if defined(__INTEL_COMPILER) -# define @KWIML@_ABI_SIZEOF___INT64 8 -# elif defined(_MSC_VER) -# define @KWIML@_ABI_SIZEOF___INT64 8 -# elif defined(__BORLANDC__) -# define @KWIML@_ABI_SIZEOF___INT64 8 -# else -# define @KWIML@_ABI_SIZEOF___INT64 0 -# endif -#endif - -#if defined(@KWIML@_ABI_SIZEOF___INT64) && @KWIML@_ABI_SIZEOF___INT64 > 0 -# if @KWIML@_ABI_SIZEOF_LONG == 8 -# define @KWIML@_ABI___INT64_IS_LONG 1 -# elif defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG == 8 -# define @KWIML@_ABI___INT64_IS_LONG_LONG 1 -# else -# define @KWIML@_ABI___INT64_IS_UNIQUE 1 -# endif -#endif - -/*--------------------------------------------------------------------------*/ -#if !defined(@KWIML@_ABI_SIZEOF_FLOAT) -# if defined(__SIZEOF_FLOAT__) -# define @KWIML@_ABI_SIZEOF_FLOAT __SIZEOF_FLOAT__ -# endif -#endif -#if !defined(@KWIML@_ABI_SIZEOF_FLOAT) -# define @KWIML@_ABI_SIZEOF_FLOAT 4 -#endif - -/*--------------------------------------------------------------------------*/ -#if !defined(@KWIML@_ABI_SIZEOF_DOUBLE) -# if defined(__SIZEOF_DOUBLE__) -# define @KWIML@_ABI_SIZEOF_DOUBLE __SIZEOF_DOUBLE__ -# endif -#endif -#if !defined(@KWIML@_ABI_SIZEOF_DOUBLE) -# define @KWIML@_ABI_SIZEOF_DOUBLE 8 -#endif - -/*--------------------------------------------------------------------------*/ -/* Identify possible endian cases. The macro @KWIML@_ABI_ENDIAN_ID will be - defined to one of these, or undefined if unknown. */ -#if !defined(@KWIML@_ABI_ENDIAN_ID_BIG) -# define @KWIML@_ABI_ENDIAN_ID_BIG 4321 -#endif -#if !defined(@KWIML@_ABI_ENDIAN_ID_LITTLE) -# define @KWIML@_ABI_ENDIAN_ID_LITTLE 1234 -#endif -#if @KWIML@_ABI_ENDIAN_ID_BIG == @KWIML@_ABI_ENDIAN_ID_LITTLE -# error "@KWIML@_ABI_ENDIAN_ID_BIG == @KWIML@_ABI_ENDIAN_ID_LITTLE" -#endif - -#if defined(@KWIML@_ABI_ENDIAN_ID) /* Skip #elif cases if already defined. */ - -/* Use dedicated symbols if the compiler defines them. Do this first - because some architectures allow runtime byte order selection by - the operating system (values for such architectures below are - guesses for compilers that do not define a dedicated symbol). - Ensure that only one is defined in case the platform or a header - defines both as possible values for some third symbol. */ -#elif defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG -#elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE -#elif defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG -#elif defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE - -/* Alpha */ -#elif defined(__alpha) || defined(__alpha__) || defined(_M_ALPHA) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE - -/* Arm */ -#elif defined(__arm__) -# if !defined(__ARMEB__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE -# else -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG -# endif - -/* Intel x86 */ -#elif defined(__i386) || defined(__i386__) || defined(_M_IX86) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE -#elif defined(_X86_) || defined(__THW_INTEL__) || defined(__I86__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE -#elif defined(__MWERKS__) && defined(__INTEL__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE - -/* Intel x86-64 */ -#elif defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE -#elif defined(__amd64) || defined(__amd64__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE - -/* Intel Architecture-64 (Itanium) */ -#elif defined(__ia64) || defined(__ia64__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE -#elif defined(_IA64) || defined(__IA64__) || defined(_M_IA64) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE - -/* PowerPC */ -#elif defined(__powerpc) || defined(__powerpc__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG -#elif defined(__ppc) || defined(__ppc__) || defined(__POWERPC__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG - -/* SPARC */ -#elif defined(__sparc) || defined(__sparc__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG - -/* HP/PA RISC */ -#elif defined(__hppa) || defined(__hppa__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG - -/* Motorola 68k */ -#elif defined(__m68k__) || defined(M68000) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG - -/* MIPSel (MIPS little endian) */ -#elif defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE - -/* MIPSeb (MIPS big endian) */ -#elif defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG - -/* MIPS (fallback, big endian) */ -#elif defined(__mips) || defined(__mips__) || defined(__MIPS__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG - -/* NIOS2 */ -#elif defined(__NIOS2__) || defined(__NIOS2) || defined(__nios2__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE - -/* OpenRISC 1000 */ -#elif defined(__or1k__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG - -/* RS/6000 */ -#elif defined(__THW_RS600) || defined(_IBMR2) || defined(_POWER) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG -#elif defined(_ARCH_PWR) || defined(_ARCH_PWR2) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG - -/* System/370 */ -#elif defined(__370__) || defined(__THW_370__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG - -/* System/390 */ -#elif defined(__s390__) || defined(__s390x__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG - -/* z/Architecture */ -#elif defined(__SYSC_ZARCH__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG - -/* VAX */ -#elif defined(__vax__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG - -/* Aarch64 */ -#elif defined(__aarch64__) -# if !defined(__AARCH64EB__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE -# else -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG -# endif - -/* Xtensa */ -#elif defined(__XTENSA_EB__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG -#elif defined(__XTENSA_EL__) -# 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." -#endif - -/*--------------------------------------------------------------------------*/ -#if !defined(@KWIML@_ABI_NO_VERIFY) -#define @KWIML@_ABI__VERIFY(n, x, y) extern int (*n)[x]; extern int (*n)[y] -#define @KWIML@_ABI__VERIFY2(n, x, y) extern int (*n)(x*); extern int (*n)(y*) -#if defined(__cplusplus) -# define @KWIML@_ABI__VERIFY3(n, x, y) extern int* n(x*); extern char* n(y*) -#else -# define @KWIML@_ABI__VERIFY3(n, x, y) extern int* n(x*) /* TODO: possible? */ -#endif -#define @KWIML@_ABI__VERIFY_BOOL(m, b) @KWIML@_ABI__VERIFY(m##__VERIFY__, 2, (b)?2:3) -#define @KWIML@_ABI__VERIFY_SIZE(m, t) @KWIML@_ABI__VERIFY(m##__VERIFY__, m, sizeof(t)) -#define @KWIML@_ABI__VERIFY_SAME(m, x, y) @KWIML@_ABI__VERIFY2(m##__VERIFY__, x, y) -#define @KWIML@_ABI__VERIFY_DIFF(m, x, y) @KWIML@_ABI__VERIFY3(m##__VERIFY__, x, y) - -@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_DATA_PTR, int*); -@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_CODE_PTR, int(*)(int)); -@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_CHAR, char); -@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_SHORT, short); -@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_INT, int); -@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_LONG, long); -#if defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG > 0 -@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_LONG_LONG, long long); -#endif -#if defined(@KWIML@_ABI_SIZEOF___INT64) && @KWIML@_ABI_SIZEOF___INT64 > 0 -@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF___INT64, __int64); -#endif -@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_FLOAT, float); -@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_DOUBLE, double); - -#if defined(@KWIML@_ABI___INT64_IS_LONG) -@KWIML@_ABI__VERIFY_SAME(@KWIML@_ABI___INT64_IS_LONG, __int64, long); -#elif defined(@KWIML@_ABI___INT64_IS_LONG_LONG) -@KWIML@_ABI__VERIFY_SAME(@KWIML@_ABI___INT64_IS_LONG_LONG, __int64, long long); -#elif defined(@KWIML@_ABI_SIZEOF___INT64) && @KWIML@_ABI_SIZEOF___INT64 > 0 -@KWIML@_ABI__VERIFY_DIFF(@KWIML@_ABI___INT64_NOT_LONG, __int64, long); -# if defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG > 0 -@KWIML@_ABI__VERIFY_DIFF(@KWIML@_ABI___INT64_NOT_LONG_LONG, __int64, long long); -# endif -#endif - -#if defined(@KWIML@_ABI_CHAR_IS_UNSIGNED) -@KWIML@_ABI__VERIFY_BOOL(@KWIML@_ABI_CHAR_IS_UNSIGNED, (char)0x80 > 0); -#elif defined(@KWIML@_ABI_CHAR_IS_SIGNED) -@KWIML@_ABI__VERIFY_BOOL(@KWIML@_ABI_CHAR_IS_SIGNED, (char)0x80 < 0); -#endif - -#undef @KWIML@_ABI__VERIFY_DIFF -#undef @KWIML@_ABI__VERIFY_SAME -#undef @KWIML@_ABI__VERIFY_SIZE -#undef @KWIML@_ABI__VERIFY_BOOL -#undef @KWIML@_ABI__VERIFY3 -#undef @KWIML@_ABI__VERIFY2 -#undef @KWIML@_ABI__VERIFY - -#endif - -#endif diff --git a/Utilities/KWIML/CMakeLists.txt b/Utilities/KWIML/CMakeLists.txt index 62b6fffb7..15e65e5c7 100644 --- a/Utilities/KWIML/CMakeLists.txt +++ b/Utilities/KWIML/CMakeLists.txt @@ -1,52 +1,29 @@ -#============================================================================= -# Kitware Information Macro Library -# Copyright 2010-2011 Kitware, Inc. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. +# Copyright Kitware, Inc. +# Distributed under the OSI-approved BSD 3-Clause 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. -#============================================================================= - -# Import the KWIML directory tree into a subdirectory under a parent -# project and configure the library as follows: -# -# set(KWIML myIML) -# subdirs(KWIML) -# -# Optional settings are as follows: -# -# KWIML_HEADER_ROOT = build tree directory to hold KWIML headers. -# Headers will go in a directory called "${KWIML}" under this root. -# For example: -# -# set(KWIML_HEADER_ROOT ${PROJECT_BINARY_DIR}) -# include_directories(${PROJECT_BINARY_DIR}) -# -# KWIML_INSTALL_INCLUDE_DIR = install KWIML with "make install" -# Specify a value relative to the install prefix and do NOT start with '/'. -# KWIML_INSTALL_INCLUDE_OPTIONS = extra header installation options -# Specify options for the install(FILES) command. -# -# KWIML_LABELS_TEST = list of labels for KWIML tests - -cmake_minimum_required(VERSION 2.6.3 FATAL_ERROR) - -#----------------------------------------------------------------------------- -if(NOT DEFINED KWIML) - if(NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") - message(FATAL_ERROR "Set KWIML namespace in parent directory!") - endif() - set(KWIML KWIML) - set(KWIML_STANDALONE 1) +if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") + cmake_minimum_required(VERSION 3.0 FATAL_ERROR) + set(kwiml_standalone 1) project(KWIML) include(CTest) mark_as_advanced(BUILD_TESTING) + if(BUILD_TESTING) + set(KWIML_TEST_ENABLE 1) + endif() + if(NOT DEFINED KWIML_INSTALL_INCLUDE_DIR) + set(KWIML_INSTALL_INCLUDE_DIR include) + endif() + set(KWIML_INCLUDE_PREFIX kwiml) +else() + cmake_minimum_required(VERSION 2.8.2 FATAL_ERROR) + set(kwiml_standalone 0) + if(KWIML_INSTALL_INCLUDE_DIR AND NOT DEFINED KWIML_INCLUDE_PREFIX) + message(FATAL_ERROR "Host project must set KWIML_INCLUDE_PREFIX") + endif() endif() -#----------------------------------------------------------------------------- get_property(KWIML_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) foreach(lang ${KWIML_LANGUAGES}) set(KWIML_LANGUAGE_${lang} 1) @@ -55,25 +32,73 @@ if(NOT KWIML_LANGUAGE_C AND NOT KWIML_LANGUAGE_CXX) set(BUILD_TESTING OFF) endif() -#----------------------------------------------------------------------------- -if(NOT KWIML_HEADER_ROOT) - set(KWIML_HEADER_ROOT "${PROJECT_BINARY_DIR}") +if(KWIML_INSTALL_INCLUDE_DIR) + install(FILES + include/kwiml/abi.h + include/kwiml/int.h + DESTINATION ${KWIML_INSTALL_INCLUDE_DIR}/${KWIML_INCLUDE_PREFIX} + ${KWIML_INSTALL_INCLUDE_OPTIONS} + ) endif() -set(KWIML_HEADER_DIR "${KWIML_HEADER_ROOT}/${KWIML}") -include_directories(${KWIML_HEADER_ROOT}) -#----------------------------------------------------------------------------- -foreach(h ABI INT) - set(header ${KWIML_HEADER_DIR}/${h}.h) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${h}.h.in ${header} @ONLY) - if(KWIML_INSTALL_INCLUDE_DIR) - install(FILES ${header} - DESTINATION ${KWIML_INSTALL_INCLUDE_DIR}/${KWIML} - ${KWIML_INSTALL_INCLUDE_OPTIONS}) - endif() -endforeach() - -#----------------------------------------------------------------------------- -if(BUILD_TESTING) +if(KWIML_TEST_ENABLE) add_subdirectory(test) endif() + +if(NOT kwiml_standalone) + return() +endif() + +#---------------------------------------------------------------------------- +set(KWIML_VERSION 1.0.0) +if(KWIML_VERSION MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+)") + set(KWIML_VERSION_MAJOR "${CMAKE_MATCH_1}") + set(KWIML_VERSION_MINOR "${CMAKE_MATCH_2}") + set(KWIML_VERSION_PATCH "${CMAKE_MATCH_3}") + math(EXPR KWIML_VERSION_DECIMAL + "${KWIML_VERSION_MAJOR}*1000000 + ${KWIML_VERSION_MINOR}*1000 + ${KWIML_VERSION_PATCH}") +else() + message(FATAL_ERROR "Failed to parse KWIML_VERSION='${KWIML_VERSION}'") +endif() + +configure_file(src/version.h.in include/kwiml/version.h @ONLY) +install(FILES + ${CMAKE_CURRENT_BINARY_DIR}/include/kwiml/version.h + DESTINATION ${KWIML_INSTALL_INCLUDE_DIR}/kwiml + ) + +if(NOT KWIML_INSTALL_PACKAGE_DIR) + set(KWIML_INSTALL_PACKAGE_DIR share/cmake/kwiml-${KWIML_VERSION_MAJOR}.${KWIML_VERSION_MINOR}) +endif() + +add_library(kwiml INTERFACE) +target_include_directories(kwiml INTERFACE + $/${KWIML_INSTALL_INCLUDE_DIR}> + $ + $ + ) +export(TARGETS kwiml + NAMESPACE kwiml:: + FILE kwiml-targets.cmake + ) +install(TARGETS kwiml + DESTINATION lib + EXPORT kwiml-targets + ) +install(EXPORT kwiml-targets + NAMESPACE kwiml:: + DESTINATION ${KWIML_INSTALL_PACKAGE_DIR} + ) + +configure_file(src/kwiml-config.cmake.in kwiml-config.cmake @ONLY) +include(CMakePackageConfigHelpers) +write_basic_package_version_file( + "${CMAKE_CURRENT_BINARY_DIR}/kwiml-config-version.cmake" + VERSION ${KWIML_VERSION} + COMPATIBILITY AnyNewerVersion + ) +install(FILES + ${CMAKE_CURRENT_BINARY_DIR}/kwiml-config.cmake + ${CMAKE_CURRENT_BINARY_DIR}/kwiml-config-version.cmake + DESTINATION ${KWIML_INSTALL_PACKAGE_DIR} + ) diff --git a/Utilities/KWIML/Copyright.txt b/Utilities/KWIML/Copyright.txt index c1e5ebc3f..a6204b0c2 100644 --- a/Utilities/KWIML/Copyright.txt +++ b/Utilities/KWIML/Copyright.txt @@ -1,5 +1,5 @@ Kitware Information Macro Library -Copyright 2010-2011 Kitware, Inc. +Copyright 2010-2015 Kitware, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/Utilities/KWIML/INT.h.in b/Utilities/KWIML/INT.h.in deleted file mode 100644 index d2eda6387..000000000 --- a/Utilities/KWIML/INT.h.in +++ /dev/null @@ -1,861 +0,0 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Kitware, Inc. nor the names of its contributors - may be used to endorse or promote products derived from this - software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -============================================================================*/ -#ifndef @KWIML@_INT_H -#define @KWIML@_INT_H -/* -This header defines macros with information about sized integer types. -Only information that can be determined using the preprocessor at -compilation time is available. No try-compile results may be added -here. Instead we memorize results on platforms of interest. - -An includer may optionally define the following macros to suppress errors: - -Input: - @KWIML@_INT_NO_VERIFY = skip verification declarations - @KWIML@_INT_NO_ERROR_INT64_T = type '@KWIML@_INT_int64_t' is optional (*) - @KWIML@_INT_NO_ERROR_UINT64_T = type '@KWIML@_INT_uint64_t' is optional (*) - @KWIML@_INT_NO_ERROR_INTPTR_T = type '@KWIML@_INT_intptr_t' is optional (*) - @KWIML@_INT_NO_ERROR_UINTPTR_T = type '@KWIML@_INT_uintptr_t' is optional (*) - -An includer may optionally define the following macros to override defaults. -Either way, an includer may test these macros after inclusion: - - @KWIML@_INT_HAVE_STDINT_H = include - @KWIML@_INT_NO_STDINT_H = do not include - @KWIML@_INT_HAVE_INTTYPES_H = include - @KWIML@_INT_NO_INTTYPES_H = do not include - -An includer may test the following macros after inclusion: - - @KWIML@_INT_HAVE_INT#_T = type 'int#_t' is available - @KWIML@_INT_HAVE_UINT#_T = type 'uint#_t' is available - # = 8, 16, 32, 64, PTR - - @KWIML@_INT_int#_t = signed integer type exactly # bits wide - @KWIML@_INT_uint#_t = unsigned integer type exactly # bits wide - # = 8, 16, 32, 64 (*), ptr (*) - - @KWIML@_INT_NO_INT64_T = type '@KWIML@_INT_int64_t' not available - @KWIML@_INT_NO_UINT64_T = type '@KWIML@_INT_uint64_t' not available - @KWIML@_INT_NO_INTPTR_T = type '@KWIML@_INT_intptr_t' not available - @KWIML@_INT_NO_UINTPTR_T = type '@KWIML@_INT_uintptr_t' not available - - @KWIML@_INT_INT#_C(c) = signed integer constant at least # bits wide - @KWIML@_INT_UINT#_C(c) = unsigned integer constant at least # bits wide - # = 8, 16, 32, 64 (*) - - @KWIML@_INT_# = print or scan format, in table below - # = 8, 16, 32, 64, PTR (*) - - signed unsigned - ----------- ------------------------------ - | decimal | decimal octal hexadecimal | - print | PRId PRIi | PRIu PRIo PRIx PRIX | - scan | SCNd SCNi | SCNu SCNo SCNx | - ----------- ------------------------------ - - The SCN*8 and SCN*64 format macros will not be defined on systems - with scanf implementations known not to support them. - - @KWIML@_INT_BROKEN_# = macro # is incorrect if defined - Some compilers define integer format macros incorrectly for their - own formatted print/scan implementations. - - @KWIML@_INT_BROKEN_INT#_C = macro INT#_C is incorrect if defined - @KWIML@_INT_BROKEN_UINT#_C = macro UINT#_C is incorrect if defined - Some compilers define integer constant macros incorrectly and - cannot handle literals as large as the integer type or even - produce bad preprocessor syntax. - - @KWIML@_INT_BROKEN_INT8_T = type 'int8_t' is available but incorrect - Some compilers have a flag to make 'char' (un)signed but do not account - for it while defining int8_t in the non-default case. - - The broken cases do not affect correctness of the macros documented above. -*/ - -#include "ABI.h" - -/*--------------------------------------------------------------------------*/ -#if defined(@KWIML@_INT_HAVE_STDINT_H) /* Already defined. */ -#elif defined(@KWIML@_INT_NO_STDINT_H) /* Already defined. */ -#elif defined(HAVE_STDINT_H) /* Optionally provided by includer. */ -# define @KWIML@_INT_HAVE_STDINT_H 1 -#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ -# define @KWIML@_INT_HAVE_STDINT_H 1 -#elif defined(_MSC_VER) /* MSVC */ -# if _MSC_VER >= 1600 -# define @KWIML@_INT_HAVE_STDINT_H 1 -# else -# define @KWIML@_INT_NO_STDINT_H 1 -# endif -#elif defined(__BORLANDC__) /* Borland */ -# if __BORLANDC__ >= 0x560 -# define @KWIML@_INT_HAVE_STDINT_H 1 -# else -# define @KWIML@_INT_NO_STDINT_H 1 -# endif -#elif defined(__WATCOMC__) /* Watcom */ -# define @KWIML@_INT_NO_STDINT_H 1 -#endif - -/*--------------------------------------------------------------------------*/ -#if defined(@KWIML@_INT_HAVE_INTTYPES_H) /* Already defined. */ -#elif defined(@KWIML@_INT_NO_INTTYPES_H) /* Already defined. */ -#elif defined(HAVE_INTTYPES_H) /* Optionally provided by includer. */ -# define @KWIML@_INT_HAVE_INTTYPES_H 1 -#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ -# define @KWIML@_INT_HAVE_INTTYPES_H 1 -#elif defined(_MSC_VER) /* MSVC */ -# define @KWIML@_INT_NO_INTTYPES_H 1 -#elif defined(__BORLANDC__) /* Borland */ -# define @KWIML@_INT_NO_INTTYPES_H 1 -#elif defined(__WATCOMC__) /* Watcom */ -# define @KWIML@_INT_NO_INTTYPES_H 1 -#else /* Assume it exists. */ -# define @KWIML@_INT_HAVE_INTTYPES_H 1 -#endif - -/*--------------------------------------------------------------------------*/ -#if defined(@KWIML@_INT_HAVE_STDINT_H) && defined(@KWIML@_INT_NO_STDINT_H) -# error "Both @KWIML@_INT_HAVE_STDINT_H and @KWIML@_INT_NO_STDINT_H defined!" -#endif -#if defined(@KWIML@_INT_HAVE_INTTYPES_H) && defined(@KWIML@_INT_NO_INTTYPES_H) -# error "Both @KWIML@_INT_HAVE_INTTYPES_H and @KWIML@_INT_NO_INTTYPES_H defined!" -#endif - -#if defined(@KWIML@_INT_HAVE_STDINT_H) -# include -#endif -#if defined(@KWIML@_INT_HAVE_INTTYPES_H) -# if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS) -# define __STDC_FORMAT_MACROS -# endif -# include -#endif - -#if defined(@KWIML@_INT_HAVE_STDINT_H) || defined(@KWIML@_INT_HAVE_INTTYPES_H) -#define @KWIML@_INT_HAVE_INT8_T 1 -#define @KWIML@_INT_HAVE_UINT8_T 1 -#define @KWIML@_INT_HAVE_INT16_T 1 -#define @KWIML@_INT_HAVE_UINT16_T 1 -#define @KWIML@_INT_HAVE_INT32_T 1 -#define @KWIML@_INT_HAVE_UINT32_T 1 -#define @KWIML@_INT_HAVE_INT64_T 1 -#define @KWIML@_INT_HAVE_UINT64_T 1 -#define @KWIML@_INT_HAVE_INTPTR_T 1 -#define @KWIML@_INT_HAVE_UINTPTR_T 1 -#endif - -#if defined(_AIX43) && !defined(_AIX50) && !defined(_AIX51) - /* AIX 4.3 defines these incorrectly with % and no quotes. */ -# define @KWIML@_INT_BROKEN_PRId8 -# define @KWIML@_INT_BROKEN_SCNd8 -# define @KWIML@_INT_BROKEN_PRIi8 -# define @KWIML@_INT_BROKEN_SCNi8 -# define @KWIML@_INT_BROKEN_PRIo8 -# define @KWIML@_INT_BROKEN_SCNo8 -# define @KWIML@_INT_BROKEN_PRIu8 -# define @KWIML@_INT_BROKEN_SCNu8 -# define @KWIML@_INT_BROKEN_PRIx8 -# define @KWIML@_INT_BROKEN_SCNx8 -# define @KWIML@_INT_BROKEN_PRIX8 -# define @KWIML@_INT_BROKEN_PRId16 -# define @KWIML@_INT_BROKEN_SCNd16 -# define @KWIML@_INT_BROKEN_PRIi16 -# define @KWIML@_INT_BROKEN_SCNi16 -# define @KWIML@_INT_BROKEN_PRIo16 -# define @KWIML@_INT_BROKEN_SCNo16 -# define @KWIML@_INT_BROKEN_PRIu16 -# define @KWIML@_INT_BROKEN_SCNu16 -# define @KWIML@_INT_BROKEN_PRIx16 -# define @KWIML@_INT_BROKEN_SCNx16 -# define @KWIML@_INT_BROKEN_PRIX16 -# define @KWIML@_INT_BROKEN_PRId32 -# define @KWIML@_INT_BROKEN_SCNd32 -# define @KWIML@_INT_BROKEN_PRIi32 -# define @KWIML@_INT_BROKEN_SCNi32 -# define @KWIML@_INT_BROKEN_PRIo32 -# define @KWIML@_INT_BROKEN_SCNo32 -# define @KWIML@_INT_BROKEN_PRIu32 -# define @KWIML@_INT_BROKEN_SCNu32 -# define @KWIML@_INT_BROKEN_PRIx32 -# define @KWIML@_INT_BROKEN_SCNx32 -# define @KWIML@_INT_BROKEN_PRIX32 -# define @KWIML@_INT_BROKEN_PRId64 -# define @KWIML@_INT_BROKEN_SCNd64 -# define @KWIML@_INT_BROKEN_PRIi64 -# define @KWIML@_INT_BROKEN_SCNi64 -# define @KWIML@_INT_BROKEN_PRIo64 -# define @KWIML@_INT_BROKEN_SCNo64 -# define @KWIML@_INT_BROKEN_PRIu64 -# define @KWIML@_INT_BROKEN_SCNu64 -# define @KWIML@_INT_BROKEN_PRIx64 -# define @KWIML@_INT_BROKEN_SCNx64 -# define @KWIML@_INT_BROKEN_PRIX64 -# define @KWIML@_INT_BROKEN_PRIdPTR -# define @KWIML@_INT_BROKEN_SCNdPTR -# define @KWIML@_INT_BROKEN_PRIiPTR -# define @KWIML@_INT_BROKEN_SCNiPTR -# define @KWIML@_INT_BROKEN_PRIoPTR -# define @KWIML@_INT_BROKEN_SCNoPTR -# define @KWIML@_INT_BROKEN_PRIuPTR -# define @KWIML@_INT_BROKEN_SCNuPTR -# define @KWIML@_INT_BROKEN_PRIxPTR -# define @KWIML@_INT_BROKEN_SCNxPTR -# define @KWIML@_INT_BROKEN_PRIXPTR -#endif - -#if (defined(__SUNPRO_C)||defined(__SUNPRO_CC)) && defined(_CHAR_IS_UNSIGNED) -# define @KWIML@_INT_BROKEN_INT8_T /* system type defined incorrectly */ -#elif defined(__BORLANDC__) && defined(_CHAR_UNSIGNED) -# define @KWIML@_INT_BROKEN_INT8_T /* system type defined incorrectly */ -#endif - -/*--------------------------------------------------------------------------*/ -#if defined(@KWIML@_INT_HAVE_INT8_T) && !defined(@KWIML@_INT_BROKEN_INT8_T) -# define @KWIML@_INT_int8_t int8_t -#else -# define @KWIML@_INT_int8_t signed char -#endif -#if defined(@KWIML@_INT_HAVE_UINT8_T) -# define @KWIML@_INT_uint8_t uint8_t -#else -# define @KWIML@_INT_uint8_t unsigned char -#endif - -#if defined(__INTEL_COMPILER) -# if defined(_WIN32) -# define @KWIML@_INT__NO_SCN8 -# endif -#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) -# define @KWIML@_INT__NO_SCN8 -#elif defined(__BORLANDC__) -# define @KWIML@_INT__NO_SCN8 -# define @KWIML@_INT__NO_SCN64 -#elif defined(_MSC_VER) -# define @KWIML@_INT__NO_SCN8 -#elif defined(__WATCOMC__) -# define @KWIML@_INT__NO_SCN8 -# elif defined(__hpux) /* HP runtime lacks support (any compiler) */ -# define @KWIML@_INT__NO_SCN8 -#endif - -/* 8-bit d, i */ -#if defined(@KWIML@_INT_HAVE_INT8_T) && defined(PRId8) \ - && !defined(@KWIML@_INT_BROKEN_PRId8) -# define @KWIML@_INT_PRId8 PRId8 -#else -# define @KWIML@_INT_PRId8 "d" -#endif -#if defined(@KWIML@_INT_HAVE_INT8_T) && defined(SCNd8) \ - && !defined(@KWIML@_INT_BROKEN_SCNd8) -# define @KWIML@_INT_SCNd8 SCNd8 -#elif !defined(@KWIML@_INT__NO_SCN8) -# define @KWIML@_INT_SCNd8 "hhd" -#endif -#if defined(@KWIML@_INT_HAVE_INT8_T) && defined(PRIi8) \ - && !defined(@KWIML@_INT_BROKEN_PRIi8) -# define @KWIML@_INT_PRIi8 PRIi8 -#else -# define @KWIML@_INT_PRIi8 "i" -#endif -#if defined(@KWIML@_INT_HAVE_INT8_T) && defined(SCNi8) \ - && !defined(@KWIML@_INT_BROKEN_SCNi8) -# define @KWIML@_INT_SCNi8 SCNi8 -#elif !defined(@KWIML@_INT__NO_SCN8) -# define @KWIML@_INT_SCNi8 "hhi" -#endif - -/* 8-bit o, u, x, X */ -#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(PRIo8) \ - && !defined(@KWIML@_INT_BROKEN_PRIo8) -# define @KWIML@_INT_PRIo8 PRIo8 -#else -# define @KWIML@_INT_PRIo8 "o" -#endif -#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(SCNo8) \ - && !defined(@KWIML@_INT_BROKEN_SCNo8) -# define @KWIML@_INT_SCNo8 SCNo8 -#elif !defined(@KWIML@_INT__NO_SCN8) -# define @KWIML@_INT_SCNo8 "hho" -#endif -#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(PRIu8) \ - && !defined(@KWIML@_INT_BROKEN_PRIu8) -# define @KWIML@_INT_PRIu8 PRIu8 -#else -# define @KWIML@_INT_PRIu8 "u" -#endif -#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(SCNu8) \ - && !defined(@KWIML@_INT_BROKEN_SCNu8) -# define @KWIML@_INT_SCNu8 SCNu8 -#elif !defined(@KWIML@_INT__NO_SCN8) -# define @KWIML@_INT_SCNu8 "hhu" -#endif -#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(PRIx8) \ - && !defined(@KWIML@_INT_BROKEN_PRIx8) -# define @KWIML@_INT_PRIx8 PRIx8 -#else -# define @KWIML@_INT_PRIx8 "x" -#endif -#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(SCNx8) \ - && !defined(@KWIML@_INT_BROKEN_SCNx8) -# define @KWIML@_INT_SCNx8 SCNx8 -#elif !defined(@KWIML@_INT__NO_SCN8) -# define @KWIML@_INT_SCNx8 "hhx" -#endif -#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(PRIX8) \ - && !defined(@KWIML@_INT_BROKEN_PRIX8) -# define @KWIML@_INT_PRIX8 PRIX8 -#else -# define @KWIML@_INT_PRIX8 "X" -#endif - -/* 8-bit constants */ -#if defined(INT8_C) && !defined(@KWIML@_INT_BROKEN_INT8_C) -# define @KWIML@_INT_INT8_C(c) INT8_C(c) -#else -# define @KWIML@_INT_INT8_C(c) c -#endif -#if defined(UINT8_C) && !defined(@KWIML@_INT_BROKEN_UINT8_C) -# define @KWIML@_INT_UINT8_C(c) UINT8_C(c) -#else -# define @KWIML@_INT_UINT8_C(c) c ## u -#endif - -/*--------------------------------------------------------------------------*/ -#if defined(@KWIML@_INT_HAVE_INT16_T) -# define @KWIML@_INT_int16_t int16_t -#else -# define @KWIML@_INT_int16_t signed short -#endif -#if defined(@KWIML@_INT_HAVE_UINT16_T) -# define @KWIML@_INT_uint16_t uint16_t -#else -# define @KWIML@_INT_uint16_t unsigned short -#endif - -/* 16-bit d, i */ -#if defined(@KWIML@_INT_HAVE_INT16_T) && defined(PRId16) \ - && !defined(@KWIML@_INT_BROKEN_PRId16) -# define @KWIML@_INT_PRId16 PRId16 -#else -# define @KWIML@_INT_PRId16 "d" -#endif -#if defined(@KWIML@_INT_HAVE_INT16_T) && defined(SCNd16) \ - && !defined(@KWIML@_INT_BROKEN_SCNd16) -# define @KWIML@_INT_SCNd16 SCNd16 -#else -# define @KWIML@_INT_SCNd16 "hd" -#endif -#if defined(@KWIML@_INT_HAVE_INT16_T) && defined(PRIi16) \ - && !defined(@KWIML@_INT_BROKEN_PRIi16) -# define @KWIML@_INT_PRIi16 PRIi16 -#else -# define @KWIML@_INT_PRIi16 "i" -#endif -#if defined(@KWIML@_INT_HAVE_INT16_T) && defined(SCNi16) \ - && !defined(@KWIML@_INT_BROKEN_SCNi16) -# define @KWIML@_INT_SCNi16 SCNi16 -#else -# define @KWIML@_INT_SCNi16 "hi" -#endif - -/* 16-bit o, u, x, X */ -#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(PRIo16) \ - && !defined(@KWIML@_INT_BROKEN_PRIo16) -# define @KWIML@_INT_PRIo16 PRIo16 -#else -# define @KWIML@_INT_PRIo16 "o" -#endif -#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(SCNo16) \ - && !defined(@KWIML@_INT_BROKEN_SCNo16) -# define @KWIML@_INT_SCNo16 SCNo16 -#else -# define @KWIML@_INT_SCNo16 "ho" -#endif -#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(PRIu16) \ - && !defined(@KWIML@_INT_BROKEN_PRIu16) -# define @KWIML@_INT_PRIu16 PRIu16 -#else -# define @KWIML@_INT_PRIu16 "u" -#endif -#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(SCNu16) \ - && !defined(@KWIML@_INT_BROKEN_SCNu16) -# define @KWIML@_INT_SCNu16 SCNu16 -#else -# define @KWIML@_INT_SCNu16 "hu" -#endif -#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(PRIx16) \ - && !defined(@KWIML@_INT_BROKEN_PRIx16) -# define @KWIML@_INT_PRIx16 PRIx16 -#else -# define @KWIML@_INT_PRIx16 "x" -#endif -#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(SCNx16) \ - && !defined(@KWIML@_INT_BROKEN_SCNx16) -# define @KWIML@_INT_SCNx16 SCNx16 -#else -# define @KWIML@_INT_SCNx16 "hx" -#endif -#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(PRIX16) \ - && !defined(@KWIML@_INT_BROKEN_PRIX16) -# define @KWIML@_INT_PRIX16 PRIX16 -#else -# define @KWIML@_INT_PRIX16 "X" -#endif - -/* 16-bit constants */ -#if defined(INT16_C) && !defined(@KWIML@_INT_BROKEN_INT16_C) -# define @KWIML@_INT_INT16_C(c) INT16_C(c) -#else -# define @KWIML@_INT_INT16_C(c) c -#endif -#if defined(UINT16_C) && !defined(@KWIML@_INT_BROKEN_UINT16_C) -# define @KWIML@_INT_UINT16_C(c) UINT16_C(c) -#else -# define @KWIML@_INT_UINT16_C(c) c ## u -#endif - -/*--------------------------------------------------------------------------*/ -#if defined(@KWIML@_INT_HAVE_INT32_T) -# define @KWIML@_INT_int32_t int32_t -#else -# define @KWIML@_INT_int32_t signed int -#endif -#if defined(@KWIML@_INT_HAVE_UINT32_T) -# define @KWIML@_INT_uint32_t uint32_t -#else -# define @KWIML@_INT_uint32_t unsigned int -#endif - -/* 32-bit d, i */ -#if defined(@KWIML@_INT_HAVE_INT32_T) && defined(PRId32) \ - && !defined(@KWIML@_INT_BROKEN_PRId32) -# define @KWIML@_INT_PRId32 PRId32 -#else -# define @KWIML@_INT_PRId32 "d" -#endif -#if defined(@KWIML@_INT_HAVE_INT32_T) && defined(SCNd32) \ - && !defined(@KWIML@_INT_BROKEN_SCNd32) -# define @KWIML@_INT_SCNd32 SCNd32 -#else -# define @KWIML@_INT_SCNd32 "d" -#endif -#if defined(@KWIML@_INT_HAVE_INT32_T) && defined(PRIi32) \ - && !defined(@KWIML@_INT_BROKEN_PRIi32) -# define @KWIML@_INT_PRIi32 PRIi32 -#else -# define @KWIML@_INT_PRIi32 "i" -#endif -#if defined(@KWIML@_INT_HAVE_INT32_T) && defined(SCNi32) \ - && !defined(@KWIML@_INT_BROKEN_SCNi32) -# define @KWIML@_INT_SCNi32 SCNi32 -#else -# define @KWIML@_INT_SCNi32 "i" -#endif - -/* 32-bit o, u, x, X */ -#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(PRIo32) \ - && !defined(@KWIML@_INT_BROKEN_PRIo32) -# define @KWIML@_INT_PRIo32 PRIo32 -#else -# define @KWIML@_INT_PRIo32 "o" -#endif -#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(SCNo32) \ - && !defined(@KWIML@_INT_BROKEN_SCNo32) -# define @KWIML@_INT_SCNo32 SCNo32 -#else -# define @KWIML@_INT_SCNo32 "o" -#endif -#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(PRIu32) \ - && !defined(@KWIML@_INT_BROKEN_PRIu32) -# define @KWIML@_INT_PRIu32 PRIu32 -#else -# define @KWIML@_INT_PRIu32 "u" -#endif -#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(SCNu32) \ - && !defined(@KWIML@_INT_BROKEN_SCNu32) -# define @KWIML@_INT_SCNu32 SCNu32 -#else -# define @KWIML@_INT_SCNu32 "u" -#endif -#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(PRIx32) \ - && !defined(@KWIML@_INT_BROKEN_PRIx32) -# define @KWIML@_INT_PRIx32 PRIx32 -#else -# define @KWIML@_INT_PRIx32 "x" -#endif -#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(SCNx32) \ - && !defined(@KWIML@_INT_BROKEN_SCNx32) -# define @KWIML@_INT_SCNx32 SCNx32 -#else -# define @KWIML@_INT_SCNx32 "x" -#endif -#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(PRIX32) \ - && !defined(@KWIML@_INT_BROKEN_PRIX32) -# define @KWIML@_INT_PRIX32 PRIX32 -#else -# define @KWIML@_INT_PRIX32 "X" -#endif - -#if defined(__hpux) && defined(__GNUC__) && !defined(__LP64__) \ - && defined(__CONCAT__) && defined(__CONCAT_U__) - /* Some HPs define UINT32_C incorrectly and break GNU. */ -# define @KWIML@_INT_BROKEN_UINT32_C -#endif - -/* 32-bit constants */ -#if defined(INT32_C) && !defined(@KWIML@_INT_BROKEN_INT32_C) -# define @KWIML@_INT_INT32_C(c) INT32_C(c) -#else -# define @KWIML@_INT_INT32_C(c) c -#endif -#if defined(UINT32_C) && !defined(@KWIML@_INT_BROKEN_UINT32_C) -# define @KWIML@_INT_UINT32_C(c) UINT32_C(c) -#else -# define @KWIML@_INT_UINT32_C(c) c ## u -#endif - -/*--------------------------------------------------------------------------*/ -#if defined(@KWIML@_INT_HAVE_INT64_T) -# define @KWIML@_INT_int64_t int64_t -#elif @KWIML@_ABI_SIZEOF_LONG == 8 -# define @KWIML@_INT_int64_t signed long -#elif defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG == 8 -# define @KWIML@_INT_int64_t signed long long -#elif defined(@KWIML@_ABI_SIZEOF___INT64) -# define @KWIML@_INT_int64_t signed __int64 -#elif defined(@KWIML@_INT_NO_ERROR_INT64_T) -# define @KWIML@_INT_NO_INT64_T -#else -# error "No type known for 'int64_t'." -#endif -#if defined(@KWIML@_INT_HAVE_UINT64_T) -# define @KWIML@_INT_uint64_t uint64_t -#elif @KWIML@_ABI_SIZEOF_LONG == 8 -# define @KWIML@_INT_uint64_t unsigned long -#elif defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG == 8 -# define @KWIML@_INT_uint64_t unsigned long long -#elif defined(@KWIML@_ABI_SIZEOF___INT64) -# define @KWIML@_INT_uint64_t unsigned __int64 -#elif defined(@KWIML@_INT_NO_ERROR_UINT64_T) -# define @KWIML@_INT_NO_UINT64_T -#else -# error "No type known for 'uint64_t'." -#endif - -#if defined(__INTEL_COMPILER) -#elif defined(__BORLANDC__) -# define @KWIML@_INT__NO_FMTLL /* type 'long long' but not 'll' format */ -# define @KWIML@_INT_BROKEN_INT64_C /* system macro defined incorrectly */ -# define @KWIML@_INT_BROKEN_UINT64_C /* system macro defined incorrectly */ -#elif defined(_MSC_VER) && _MSC_VER < 1400 -# define @KWIML@_INT__NO_FMTLL /* type 'long long' but not 'll' format */ -#endif - -#if @KWIML@_ABI_SIZEOF_LONG == 8 -# define @KWIML@_INT__FMT64 "l" -#elif defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG == 8 -# if !defined(@KWIML@_INT__NO_FMTLL) -# define @KWIML@_INT__FMT64 "ll" -# else -# define @KWIML@_INT__FMT64 "I64" -# endif -#elif defined(@KWIML@_ABI_SIZEOF___INT64) -# if defined(__BORLANDC__) -# define @KWIML@_INT__FMT64 "L" -# else -# define @KWIML@_INT__FMT64 "I64" -# endif -#endif - -/* 64-bit d, i */ -#if defined(@KWIML@_INT_HAVE_INT64_T) && defined(PRId64) \ - && !defined(@KWIML@_INT_BROKEN_PRId64) -# define @KWIML@_INT_PRId64 PRId64 -#elif defined(@KWIML@_INT__FMT64) -# define @KWIML@_INT_PRId64 @KWIML@_INT__FMT64 "d" -#endif -#if defined(@KWIML@_INT_HAVE_INT64_T) && defined(SCNd64) \ - && !defined(@KWIML@_INT_BROKEN_SCNd64) -# define @KWIML@_INT_SCNd64 SCNd64 -#elif defined(@KWIML@_INT__FMT64) && !defined(@KWIML@_INT__NO_SCN64) -# define @KWIML@_INT_SCNd64 @KWIML@_INT__FMT64 "d" -#endif -#if defined(@KWIML@_INT_HAVE_INT64_T) && defined(PRIi64) \ - && !defined(@KWIML@_INT_BROKEN_PRIi64) -# define @KWIML@_INT_PRIi64 PRIi64 -#elif defined(@KWIML@_INT__FMT64) -# define @KWIML@_INT_PRIi64 @KWIML@_INT__FMT64 "d" -#endif -#if defined(@KWIML@_INT_HAVE_INT64_T) && defined(SCNi64) \ - && !defined(@KWIML@_INT_BROKEN_SCNi64) -# define @KWIML@_INT_SCNi64 SCNi64 -#elif defined(@KWIML@_INT__FMT64) && !defined(@KWIML@_INT__NO_SCN64) -# define @KWIML@_INT_SCNi64 @KWIML@_INT__FMT64 "d" -#endif - -/* 64-bit o, u, x, X */ -#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(PRIo64) \ - && !defined(@KWIML@_INT_BROKEN_PRIo64) -# define @KWIML@_INT_PRIo64 PRIo64 -#elif defined(@KWIML@_INT__FMT64) -# define @KWIML@_INT_PRIo64 @KWIML@_INT__FMT64 "o" -#endif -#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(SCNo64) \ - && !defined(@KWIML@_INT_BROKEN_SCNo64) -# define @KWIML@_INT_SCNo64 SCNo64 -#elif defined(@KWIML@_INT__FMT64) && !defined(@KWIML@_INT__NO_SCN64) -# define @KWIML@_INT_SCNo64 @KWIML@_INT__FMT64 "o" -#endif -#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(PRIu64) \ - && !defined(@KWIML@_INT_BROKEN_PRIu64) -# define @KWIML@_INT_PRIu64 PRIu64 -#elif defined(@KWIML@_INT__FMT64) -# define @KWIML@_INT_PRIu64 @KWIML@_INT__FMT64 "u" -#endif -#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(SCNu64) \ - && !defined(@KWIML@_INT_BROKEN_SCNu64) -# define @KWIML@_INT_SCNu64 SCNu64 -#elif defined(@KWIML@_INT__FMT64) && !defined(@KWIML@_INT__NO_SCN64) -# define @KWIML@_INT_SCNu64 @KWIML@_INT__FMT64 "u" -#endif -#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(PRIx64) \ - && !defined(@KWIML@_INT_BROKEN_PRIx64) -# define @KWIML@_INT_PRIx64 PRIx64 -#elif defined(@KWIML@_INT__FMT64) -# define @KWIML@_INT_PRIx64 @KWIML@_INT__FMT64 "x" -#endif -#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(SCNx64) \ - && !defined(@KWIML@_INT_BROKEN_SCNx64) -# define @KWIML@_INT_SCNx64 SCNx64 -#elif defined(@KWIML@_INT__FMT64) && !defined(@KWIML@_INT__NO_SCN64) -# define @KWIML@_INT_SCNx64 @KWIML@_INT__FMT64 "x" -#endif -#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(PRIX64) \ - && !defined(@KWIML@_INT_BROKEN_PRIX64) -# define @KWIML@_INT_PRIX64 PRIX64 -#elif defined(@KWIML@_INT__FMT64) -# define @KWIML@_INT_PRIX64 @KWIML@_INT__FMT64 "X" -#endif - -/* 64-bit constants */ -#if defined(@KWIML@_INT_HAVE_INT64_T) && defined(INT64_C) \ - && !defined(@KWIML@_INT_BROKEN_INT64_C) -# define @KWIML@_INT_INT64_C(c) INT64_C(c) -#elif @KWIML@_ABI_SIZEOF_LONG == 8 -# define @KWIML@_INT_INT64_C(c) c ## l -#elif defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG == 8 -# define @KWIML@_INT_INT64_C(c) c ## ll -#elif defined(@KWIML@_ABI_SIZEOF___INT64) -# define @KWIML@_INT_INT64_C(c) c ## i64 -#endif -#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(UINT64_C) \ - && !defined(@KWIML@_INT_BROKEN_UINT64_C) -# define @KWIML@_INT_UINT64_C(c) UINT64_C(c) -#elif @KWIML@_ABI_SIZEOF_LONG == 8 -# define @KWIML@_INT_UINT64_C(c) c ## ul -#elif defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG == 8 -# define @KWIML@_INT_UINT64_C(c) c ## ull -#elif defined(@KWIML@_ABI_SIZEOF___INT64) -# define @KWIML@_INT_UINT64_C(c) c ## ui64 -#endif - -/*--------------------------------------------------------------------------*/ -#if defined(@KWIML@_INT_HAVE_INTPTR_T) -# define @KWIML@_INT_intptr_t intptr_t -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_intptr_t @KWIML@_INT_int32_t -#elif !defined(@KWIML@_INT_NO_INT64_T) -# define @KWIML@_INT_intptr_t @KWIML@_INT_int64_t -#elif defined(@KWIML@_INT_NO_ERROR_INTPTR_T) -# define @KWIML@_INT_NO_INTPTR_T -#else -# error "No type known for 'intptr_t'." -#endif -#if defined(@KWIML@_INT_HAVE_UINTPTR_T) -# define @KWIML@_INT_uintptr_t uintptr_t -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_uintptr_t @KWIML@_INT_uint32_t -#elif !defined(@KWIML@_INT_NO_UINT64_T) -# define @KWIML@_INT_uintptr_t @KWIML@_INT_uint64_t -#elif defined(@KWIML@_INT_NO_ERROR_UINTPTR_T) -# define @KWIML@_INT_NO_UINTPTR_T -#else -# error "No type known for 'uintptr_t'." -#endif - -#if defined(@KWIML@_INT_HAVE_INTPTR_T) && defined(PRIdPTR) \ - && !defined(@KWIML@_INT_BROKEN_PRIdPTR) -# define @KWIML@_INT_PRIdPTR PRIdPTR -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_PRIdPTR @KWIML@_INT_PRId32 -#elif !defined(@KWIML@_INT_NO_UINT64_T) -# define @KWIML@_INT_PRIdPTR @KWIML@_INT_PRId64 -#endif -#if defined(@KWIML@_INT_HAVE_INTPTR_T) && defined(SCNdPTR) \ - && !defined(@KWIML@_INT_BROKEN_SCNdPTR) -# define @KWIML@_INT_SCNdPTR SCNdPTR -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_SCNdPTR @KWIML@_INT_SCNd32 -#elif !defined(@KWIML@_INT_NO_UINT64_T) -# define @KWIML@_INT_SCNdPTR @KWIML@_INT_SCNd64 -#endif -#if defined(@KWIML@_INT_HAVE_INTPTR_T) && defined(PRIiPTR) \ - && !defined(@KWIML@_INT_BROKEN_PRIiPTR) -# define @KWIML@_INT_PRIiPTR PRIiPTR -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_PRIiPTR @KWIML@_INT_PRIi32 -#elif !defined(@KWIML@_INT_NO_UINT64_T) -# define @KWIML@_INT_PRIiPTR @KWIML@_INT_PRIi64 -#endif -#if defined(@KWIML@_INT_HAVE_INTPTR_T) && defined(SCNiPTR) \ - && !defined(@KWIML@_INT_BROKEN_SCNiPTR) -# define @KWIML@_INT_SCNiPTR SCNiPTR -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_SCNiPTR @KWIML@_INT_SCNi32 -#elif !defined(@KWIML@_INT_NO_UINT64_T) -# define @KWIML@_INT_SCNiPTR @KWIML@_INT_SCNi64 -#endif - -#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(PRIoPTR) \ - && !defined(@KWIML@_INT_BROKEN_PRIoPTR) -# define @KWIML@_INT_PRIoPTR PRIoPTR -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_PRIoPTR @KWIML@_INT_PRIo32 -#elif !defined(@KWIML@_INT_NO_UINT64_T) -# define @KWIML@_INT_PRIoPTR @KWIML@_INT_PRIo64 -#endif -#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(SCNoPTR) \ - && !defined(@KWIML@_INT_BROKEN_SCNoPTR) -# define @KWIML@_INT_SCNoPTR SCNoPTR -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_SCNoPTR @KWIML@_INT_SCNo32 -#elif !defined(@KWIML@_INT_NO_UINT64_T) -# define @KWIML@_INT_SCNoPTR @KWIML@_INT_SCNo64 -#endif -#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(PRIuPTR) \ - && !defined(@KWIML@_INT_BROKEN_PRIuPTR) -# define @KWIML@_INT_PRIuPTR PRIuPTR -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_PRIuPTR @KWIML@_INT_PRIu32 -#elif !defined(@KWIML@_INT_NO_UINT64_T) -# define @KWIML@_INT_PRIuPTR @KWIML@_INT_PRIu64 -#endif -#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(SCNuPTR) \ - && !defined(@KWIML@_INT_BROKEN_SCNuPTR) -# define @KWIML@_INT_SCNuPTR SCNuPTR -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_SCNuPTR @KWIML@_INT_SCNu32 -#elif !defined(@KWIML@_INT_NO_UINT64_T) -# define @KWIML@_INT_SCNuPTR @KWIML@_INT_SCNu64 -#endif -#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(PRIxPTR) \ - && !defined(@KWIML@_INT_BROKEN_PRIxPTR) -# define @KWIML@_INT_PRIxPTR PRIxPTR -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_PRIxPTR @KWIML@_INT_PRIx32 -#elif !defined(@KWIML@_INT_NO_UINT64_T) -# define @KWIML@_INT_PRIxPTR @KWIML@_INT_PRIx64 -#endif -#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(SCNxPTR) \ - && !defined(@KWIML@_INT_BROKEN_SCNxPTR) -# define @KWIML@_INT_SCNxPTR SCNxPTR -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_SCNxPTR @KWIML@_INT_SCNx32 -#elif !defined(@KWIML@_INT_NO_UINT64_T) -# define @KWIML@_INT_SCNxPTR @KWIML@_INT_SCNx64 -#endif -#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(PRIXPTR) \ - && !defined(@KWIML@_INT_BROKEN_PRIXPTR) -# define @KWIML@_INT_PRIXPTR PRIXPTR -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_PRIXPTR @KWIML@_INT_PRIX32 -#elif !defined(@KWIML@_INT_NO_UINT64_T) -# define @KWIML@_INT_PRIXPTR @KWIML@_INT_PRIX64 -#endif - -/*--------------------------------------------------------------------------*/ -#if !defined(@KWIML@_INT_NO_VERIFY) -#define @KWIML@_INT__VERIFY(n, x, y) extern int (*n)[x]; extern int (*n)[y] -#define @KWIML@_INT__VERIFY_BOOL(m, b) @KWIML@_INT__VERIFY(m##__VERIFY__, 2, (b)?2:3) -#define @KWIML@_INT__VERIFY_TYPE(t, s) @KWIML@_INT__VERIFY(t##__VERIFY__, s, sizeof(t)) -#define @KWIML@_INT__VERIFY_SIGN(t, u, o) @KWIML@_INT__VERIFY_BOOL(t##__SIGN, (t)((u)1 << ((sizeof(t)<<3)-1)) o 0) - -@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_int8_t, 1); -@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_uint8_t, 1); -@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_int16_t, 2); -@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_uint16_t, 2); -@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_int32_t, 4); -@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_uint32_t, 4); -#if !defined(@KWIML@_INT_NO_INT64_T) -@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_int64_t, 8); -#endif -#if !defined(@KWIML@_INT_NO_UINT64_T) -@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_uint64_t, 8); -#endif -#if !defined(@KWIML@_INT_NO_INTPTR_T) -@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_intptr_t, sizeof(void*)); -#endif -#if !defined(@KWIML@_INT_NO_UINTPTR_T) -@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_uintptr_t, sizeof(void*)); -#endif - -@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_int8_t, @KWIML@_INT_uint8_t, <); -@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_uint8_t, @KWIML@_INT_uint8_t, >); -@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_int16_t, @KWIML@_INT_uint16_t, <); -@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_uint16_t, @KWIML@_INT_uint16_t, >); -@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_int32_t, @KWIML@_INT_uint32_t, <); -@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_uint32_t, @KWIML@_INT_uint32_t, >); -#if !defined(@KWIML@_INT_NO_INT64_T) -@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_int64_t, @KWIML@_INT_uint64_t, <); -#endif -#if !defined(@KWIML@_INT_NO_UINT64_T) -@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_uint64_t, @KWIML@_INT_uint64_t, >); -#endif -#if !defined(@KWIML@_INT_NO_INTPTR_T) -@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_intptr_t, @KWIML@_INT_uintptr_t, <); -#endif -#if !defined(@KWIML@_INT_NO_UINTPTR_T) -@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_uintptr_t, @KWIML@_INT_uintptr_t, >); -#endif - -#undef @KWIML@_INT__VERIFY_SIGN -#undef @KWIML@_INT__VERIFY_TYPE -#undef @KWIML@_INT__VERIFY_BOOL -#undef @KWIML@_INT__VERIFY - -#endif - -#endif diff --git a/Utilities/KWIML/README.md b/Utilities/KWIML/README.md new file mode 100644 index 000000000..37d72d1b1 --- /dev/null +++ b/Utilities/KWIML/README.md @@ -0,0 +1,36 @@ +Kitware Information Macro Library (KWIML) +========================================= + +KWIML provides header files that use preprocessor tests to detect and +provide information about the compiler and its target architecture. +The headers contain no configuration-time test results and thus may +be installed into an architecture-independent include directory. +This makes them suitable for use in the public interface of any package. + +The following headers are provided. See header comments for details: + +* [kwiml/abi.h][]: Fundamental type size and representation. + +* [kwiml/int.h][]: Fixed-size integer types and format specifiers. + +* [kwiml/version.h][]: Information about this version of KWIML. + +The [test][] subdirectory builds tests that verify correctness of the +information provided by each header. + +License +======= + +KWIML is distributed under the OSI-approved 3-clause BSD License. + +Files used only for build and test purposes contain a copyright notice and +reference [Copyright.txt][] for details. Headers meant for installation and +distribution outside the source tree come with full inlined copies of the +copyright notice and license text. This makes them suitable for distribution +with any package under compatible license terms. + +[Copyright.txt]: Copyright.txt +[kwiml/abi.h]: include/kwiml/abi.h +[kwiml/int.h]: include/kwiml/int.h +[kwiml/version.h]: src/version.h.in +[test]: test/ diff --git a/Utilities/KWIML/README.txt b/Utilities/KWIML/README.txt deleted file mode 100644 index 6bdf859d9..000000000 --- a/Utilities/KWIML/README.txt +++ /dev/null @@ -1,29 +0,0 @@ -KWIML - The Kitware Information Macro Library - -KWIML provides header files that use preprocessor tests to detect and -provide information about the compiler and its target architecture. The -headers contain no configuration-time test results and thus may be -installed into an architecture-independent include directory. This -makes them suitable for use in the public interface of any package. - -This source tree is intended for distribution inside the source trees of -other packages. In order to avoid name collisions among multiple -packages the KWIML headers are configured with a per-package prefix on -both the header locations and the macros they define. See comments in -CMakeLists.txt for instructions to include KWIML inside another project. - -The entire KWIML source tree is distributed under the OSI-approved -3-clause BSD License. Files used only for build and test purposes -contain a copyright notice and reference Copyright.txt for details. -Headers meant for installation and distribution outside the source tree -come with full inlined copies of the copyright notice and license text. -This makes them suitable for distribution with any package under -compatible license terms. - -The following components are provided. See header comments for details: - - ABI.h = Fundamental type size and representation - INT.h = Fixed-size integer types and format specifiers - -The "test" subdirectory builds tests that verify correctness of the -information provided by each header. diff --git a/Utilities/KWIML/include/kwiml/abi.h b/Utilities/KWIML/include/kwiml/abi.h new file mode 100644 index 000000000..362636165 --- /dev/null +++ b/Utilities/KWIML/include/kwiml/abi.h @@ -0,0 +1,562 @@ +/*============================================================================ + Kitware Information Macro Library + Copyright 2010-2015 Kitware, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Kitware, Inc. nor the names of its contributors + may be used to endorse or promote products derived from this + software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +============================================================================*/ +/* +This header defines macros with information about the C ABI. +Only information that can be determined using the preprocessor at +compilation time is available. No try-compile results may be added +here. Instead we memorize results on platforms of interest. + +An includer may optionally define the following macros to suppress errors: + + KWIML_ABI_NO_VERIFY = skip verification declarations + KWIML_ABI_NO_ERROR_CHAR_SIGN = signedness of 'char' may be unknown + KWIML_ABI_NO_ERROR_LONG_LONG = existence of 'long long' may be unknown + KWIML_ABI_NO_ERROR_ENDIAN = byte order of CPU may be unknown + +An includer may test the following macros after inclusion: + + KWIML_ABI_VERSION = interface version number # of this header + + KWIML_ABI_SIZEOF_DATA_PTR = sizeof(void*) + KWIML_ABI_SIZEOF_CODE_PTR = sizeof(void(*)(void)) + KWIML_ABI_SIZEOF_FLOAT = sizeof(float) + KWIML_ABI_SIZEOF_DOUBLE = sizeof(double) + KWIML_ABI_SIZEOF_CHAR = sizeof(char) + KWIML_ABI_SIZEOF_SHORT = sizeof(short) + KWIML_ABI_SIZEOF_INT = sizeof(int) + KWIML_ABI_SIZEOF_LONG = sizeof(long) + + KWIML_ABI_SIZEOF_LONG_LONG = sizeof(long long) or 0 if not a type + Undefined if existence is unknown and error suppression macro + KWIML_ABI_NO_ERROR_LONG_LONG was defined. + + KWIML_ABI_SIZEOF___INT64 = 8 if '__int64' exists or 0 if not + Undefined if existence is unknown. + + KWIML_ABI___INT64_IS_LONG = 1 if '__int64' is 'long' (same type) + Undefined otherwise. + KWIML_ABI___INT64_IS_LONG_LONG = 1 if '__int64' is 'long long' (same type) + Undefined otherwise. + KWIML_ABI___INT64_IS_UNIQUE = 1 if '__int64' is a distinct type + Undefined otherwise. + + KWIML_ABI_CHAR_IS_UNSIGNED = 1 if 'char' is unsigned, else undefined + KWIML_ABI_CHAR_IS_SIGNED = 1 if 'char' is signed, else undefined + One of these is defined unless signedness of 'char' is unknown and + error suppression macro KWIML_ABI_NO_ERROR_CHAR_SIGN was defined. + + KWIML_ABI_ENDIAN_ID_BIG = id for big-endian (always defined) + KWIML_ABI_ENDIAN_ID_LITTLE = id for little-endian (always defined) + KWIML_ABI_ENDIAN_ID = id of byte order of target CPU + Defined to KWIML_ABI_ENDIAN_ID_BIG or KWIML_ABI_ENDIAN_ID_LITTLE + unless byte order is unknown and error suppression macro + KWIML_ABI_NO_ERROR_ENDIAN was defined. + +We verify most results using dummy "extern" declarations that are +invalid if the macros are wrong. Verification is disabled if +suppression macro KWIML_ABI_NO_VERIFY was defined. +*/ + +#define KWIML_ABI_private_VERSION 1 + +/* Guard definition of this version. */ +#ifndef KWIML_ABI_detail_DEFINED_VERSION_1 +# define KWIML_ABI_detail_DEFINED_VERSION_1 1 +# define KWIML_ABI_private_DO_DEFINE +#endif + +/* Guard verification of this version. */ +#if !defined(KWIML_ABI_NO_VERIFY) +# ifndef KWIML_ABI_detail_VERIFIED_VERSION_1 +# define KWIML_ABI_detail_VERIFIED_VERSION_1 +# define KWIML_ABI_private_DO_VERIFY +# endif +#endif + +#ifdef KWIML_ABI_private_DO_DEFINE +#undef KWIML_ABI_private_DO_DEFINE + +/* Define version as most recent of those included. */ +#if !defined(KWIML_ABI_VERSION) || KWIML_ABI_VERSION < KWIML_ABI_private_VERSION +# undef KWIML_ABI_VERSION +# define KWIML_ABI_VERSION 1 +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_ABI_SIZEOF_DATA_PTR) +# if defined(__SIZEOF_POINTER__) +# define KWIML_ABI_SIZEOF_DATA_PTR __SIZEOF_POINTER__ +# elif defined(_SIZE_PTR) +# define KWIML_ABI_SIZEOF_DATA_PTR (_SIZE_PTR >> 3) +# elif defined(_LP64) || defined(__LP64__) +# define KWIML_ABI_SIZEOF_DATA_PTR 8 +# elif defined(_ILP32) +# define KWIML_ABI_SIZEOF_DATA_PTR 4 +# elif defined(__64BIT__) /* IBM XL */ +# define KWIML_ABI_SIZEOF_DATA_PTR 8 +# elif defined(_M_X64) +# define KWIML_ABI_SIZEOF_DATA_PTR 8 +# elif defined(__ia64) +# define KWIML_ABI_SIZEOF_DATA_PTR 8 +# elif defined(__sparcv9) +# define KWIML_ABI_SIZEOF_DATA_PTR 8 +# elif defined(__x86_64) || defined(__x86_64__) +# define KWIML_ABI_SIZEOF_DATA_PTR 8 +# elif defined(__amd64) || defined(__amd64__) +# define KWIML_ABI_SIZEOF_DATA_PTR 8 +# elif defined(__i386) || defined(__i386__) +# define KWIML_ABI_SIZEOF_DATA_PTR 4 +# endif +#endif +#if !defined(KWIML_ABI_SIZEOF_DATA_PTR) +# define KWIML_ABI_SIZEOF_DATA_PTR 4 +#endif +#if !defined(KWIML_ABI_SIZEOF_CODE_PTR) +# define KWIML_ABI_SIZEOF_CODE_PTR KWIML_ABI_SIZEOF_DATA_PTR +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_ABI_SIZEOF_CHAR) +# define KWIML_ABI_SIZEOF_CHAR 1 +#endif + +#if !defined(KWIML_ABI_CHAR_IS_UNSIGNED) && !defined(KWIML_ABI_CHAR_IS_SIGNED) +# if defined(__CHAR_UNSIGNED__) /* GNU, some IBM XL, others? */ +# define KWIML_ABI_CHAR_IS_UNSIGNED 1 +# elif defined(_CHAR_UNSIGNED) /* Intel, IBM XL, MSVC, Borland, others? */ +# define KWIML_ABI_CHAR_IS_UNSIGNED 1 +# elif defined(_CHAR_SIGNED) /* IBM XL, others? */ +# define KWIML_ABI_CHAR_IS_SIGNED 1 +# elif defined(__CHAR_SIGNED__) /* IBM XL, Watcom, others? */ +# define KWIML_ABI_CHAR_IS_SIGNED 1 +# elif defined(__SIGNED_CHARS__) /* EDG, Intel, SGI MIPSpro */ +# define KWIML_ABI_CHAR_IS_SIGNED 1 +# elif defined(_CHAR_IS_SIGNED) /* Some SunPro, others? */ +# define KWIML_ABI_CHAR_IS_SIGNED 1 +# elif defined(_CHAR_IS_UNSIGNED) /* SunPro, others? */ +# define KWIML_ABI_CHAR_IS_UNSIGNED 1 +# elif defined(__GNUC__) /* GNU default */ +# define KWIML_ABI_CHAR_IS_SIGNED 1 +# elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) /* SunPro default */ +# define KWIML_ABI_CHAR_IS_SIGNED 1 +# elif defined(__HP_cc) || defined(__HP_aCC) /* HP default (unless +uc) */ +# define KWIML_ABI_CHAR_IS_SIGNED 1 +# elif defined(_SGI_COMPILER_VERSION) /* SGI MIPSpro default */ +# define KWIML_ABI_CHAR_IS_UNSIGNED 1 +# elif defined(__PGIC__) /* PGI default */ +# define KWIML_ABI_CHAR_IS_SIGNED 1 +# elif defined(_MSC_VER) /* MSVC default */ +# define KWIML_ABI_CHAR_IS_SIGNED 1 +# elif defined(__WATCOMC__) /* Watcom default */ +# define KWIML_ABI_CHAR_IS_UNSIGNED 1 +# elif defined(__BORLANDC__) /* Borland default */ +# define KWIML_ABI_CHAR_IS_SIGNED 1 +# elif defined(__hpux) /* Old HP: no __HP_cc/__HP_aCC/__GNUC__ above */ +# define KWIML_ABI_CHAR_IS_SIGNED 1 /* (unless +uc) */ +# endif +#endif +#if !defined(KWIML_ABI_CHAR_IS_UNSIGNED) && !defined(KWIML_ABI_CHAR_IS_SIGNED) \ + && !defined(KWIML_ABI_NO_ERROR_CHAR_SIGN) +# error "Signedness of 'char' unknown." +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_ABI_SIZEOF_SHORT) +# if defined(__SIZEOF_SHORT__) +# define KWIML_ABI_SIZEOF_SHORT __SIZEOF_SHORT__ +# endif +#endif +#if !defined(KWIML_ABI_SIZEOF_SHORT) +# define KWIML_ABI_SIZEOF_SHORT 2 +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_ABI_SIZEOF_INT) +# if defined(__SIZEOF_INT__) +# define KWIML_ABI_SIZEOF_INT __SIZEOF_INT__ +# elif defined(_SIZE_INT) +# define KWIML_ABI_SIZEOF_INT (_SIZE_INT >> 3) +# endif +#endif +#if !defined(KWIML_ABI_SIZEOF_INT) +# define KWIML_ABI_SIZEOF_INT 4 +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_ABI_SIZEOF_LONG) +# if defined(__SIZEOF_LONG__) +# define KWIML_ABI_SIZEOF_LONG __SIZEOF_LONG__ +# elif defined(_SIZE_LONG) +# define KWIML_ABI_SIZEOF_LONG (_SIZE_LONG >> 3) +# elif defined(__LONG_MAX__) +# if __LONG_MAX__ == 0x7fffffff +# define KWIML_ABI_SIZEOF_LONG 4 +# elif __LONG_MAX__>>32 == 0x7fffffff +# define KWIML_ABI_SIZEOF_LONG 8 +# endif +# elif defined(_MSC_VER) /* MSVC and Intel on Windows */ +# define KWIML_ABI_SIZEOF_LONG 4 +# endif +#endif +#if !defined(KWIML_ABI_SIZEOF_LONG) +# define KWIML_ABI_SIZEOF_LONG KWIML_ABI_SIZEOF_DATA_PTR +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_ABI_SIZEOF_LONG_LONG) +# if defined(__SIZEOF_LONG_LONG__) +# define KWIML_ABI_SIZEOF_LONG_LONG __SIZEOF_LONG_LONG__ +# elif defined(__LONG_LONG_MAX__) +# if __LONG_LONG_MAX__ == 0x7fffffff +# define KWIML_ABI_SIZEOF_LONG_LONG 4 +# elif __LONG_LONG_MAX__>>32 == 0x7fffffff +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# endif +# endif +#endif +#if !defined(KWIML_ABI_SIZEOF_LONG_LONG) +# if defined(_LONGLONG) /* SGI, some GNU, perhaps others. */ \ + && !defined(_MSC_VER) +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# elif defined(_LONG_LONG) /* IBM XL, perhaps others. */ +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# elif defined(__NO_LONG_LONG) /* EDG */ +# define KWIML_ABI_SIZEOF_LONG_LONG 0 +# elif defined(__cplusplus) && __cplusplus > 199711L /* C++0x */ +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) /* SunPro */ +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# elif defined(__HP_cc) || defined(__HP_aCC) /* HP */ +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# elif defined(__PGIC__) /* PGI */ +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# elif defined(__WATCOMC__) /* Watcom */ +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# elif defined(__INTEL_COMPILER) /* Intel */ +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# elif defined(__BORLANDC__) /* Borland */ +# if __BORLANDC__ >= 0x0560 +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# else +# define KWIML_ABI_SIZEOF_LONG_LONG 0 +# endif +# elif defined(_MSC_VER) /* Microsoft */ +# if _MSC_VER >= 1310 +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# else +# define KWIML_ABI_SIZEOF_LONG_LONG 0 +# endif +# elif defined(__GNUC__) /* GNU */ +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# elif defined(__hpux) /* Old HP: no __HP_cc/__HP_aCC/__GNUC__ above */ +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# endif +#endif +#if !defined(KWIML_ABI_SIZEOF_LONG_LONG) && !defined(KWIML_ABI_NO_ERROR_LONG_LONG) +# error "Existence of 'long long' unknown." +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_ABI_SIZEOF___INT64) +# if defined(__INTEL_COMPILER) +# define KWIML_ABI_SIZEOF___INT64 8 +# elif defined(_MSC_VER) +# define KWIML_ABI_SIZEOF___INT64 8 +# elif defined(__BORLANDC__) +# define KWIML_ABI_SIZEOF___INT64 8 +# else +# define KWIML_ABI_SIZEOF___INT64 0 +# endif +#endif + +#if defined(KWIML_ABI_SIZEOF___INT64) && KWIML_ABI_SIZEOF___INT64 > 0 +# if KWIML_ABI_SIZEOF_LONG == 8 +# define KWIML_ABI___INT64_IS_LONG 1 +# elif defined(KWIML_ABI_SIZEOF_LONG_LONG) && KWIML_ABI_SIZEOF_LONG_LONG == 8 +# define KWIML_ABI___INT64_IS_LONG_LONG 1 +# else +# define KWIML_ABI___INT64_IS_UNIQUE 1 +# endif +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_ABI_SIZEOF_FLOAT) +# if defined(__SIZEOF_FLOAT__) +# define KWIML_ABI_SIZEOF_FLOAT __SIZEOF_FLOAT__ +# endif +#endif +#if !defined(KWIML_ABI_SIZEOF_FLOAT) +# define KWIML_ABI_SIZEOF_FLOAT 4 +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_ABI_SIZEOF_DOUBLE) +# if defined(__SIZEOF_DOUBLE__) +# define KWIML_ABI_SIZEOF_DOUBLE __SIZEOF_DOUBLE__ +# endif +#endif +#if !defined(KWIML_ABI_SIZEOF_DOUBLE) +# define KWIML_ABI_SIZEOF_DOUBLE 8 +#endif + +/*--------------------------------------------------------------------------*/ +/* Identify possible endian cases. The macro KWIML_ABI_ENDIAN_ID will be + defined to one of these, or undefined if unknown. */ +#if !defined(KWIML_ABI_ENDIAN_ID_BIG) +# define KWIML_ABI_ENDIAN_ID_BIG 4321 +#endif +#if !defined(KWIML_ABI_ENDIAN_ID_LITTLE) +# define KWIML_ABI_ENDIAN_ID_LITTLE 1234 +#endif +#if KWIML_ABI_ENDIAN_ID_BIG == KWIML_ABI_ENDIAN_ID_LITTLE +# error "KWIML_ABI_ENDIAN_ID_BIG == KWIML_ABI_ENDIAN_ID_LITTLE" +#endif + +#if defined(KWIML_ABI_ENDIAN_ID) /* Skip #elif cases if already defined. */ + +/* Use dedicated symbols if the compiler defines them. Do this first + because some architectures allow runtime byte order selection by + the operating system (values for such architectures below are + guesses for compilers that do not define a dedicated symbol). + Ensure that only one is defined in case the platform or a header + defines both as possible values for some third symbol. */ +#elif defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG +#elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE +#elif defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG +#elif defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE + +/* Alpha */ +#elif defined(__alpha) || defined(__alpha__) || defined(_M_ALPHA) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE + +/* Arm */ +#elif defined(__arm__) +# if !defined(__ARMEB__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE +# else +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG +# endif + +/* Intel x86 */ +#elif defined(__i386) || defined(__i386__) || defined(_M_IX86) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE +#elif defined(_X86_) || defined(__THW_INTEL__) || defined(__I86__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE +#elif defined(__MWERKS__) && defined(__INTEL__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE + +/* Intel x86-64 */ +#elif defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE +#elif defined(__amd64) || defined(__amd64__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE + +/* Intel Architecture-64 (Itanium) */ +#elif defined(__ia64) || defined(__ia64__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE +#elif defined(_IA64) || defined(__IA64__) || defined(_M_IA64) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE + +/* PowerPC */ +#elif defined(__powerpc) || defined(__powerpc__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG +#elif defined(__ppc) || defined(__ppc__) || defined(__POWERPC__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG + +/* SPARC */ +#elif defined(__sparc) || defined(__sparc__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG + +/* HP/PA RISC */ +#elif defined(__hppa) || defined(__hppa__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG + +/* Motorola 68k */ +#elif defined(__m68k__) || defined(M68000) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG + +/* MIPSel (MIPS little endian) */ +#elif defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE + +/* MIPSeb (MIPS big endian) */ +#elif defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG + +/* MIPS (fallback, big endian) */ +#elif defined(__mips) || defined(__mips__) || defined(__MIPS__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG + +/* NIOS2 */ +#elif defined(__NIOS2__) || defined(__NIOS2) || defined(__nios2__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE + +/* OpenRISC 1000 */ +#elif defined(__or1k__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG + +/* RS/6000 */ +#elif defined(__THW_RS600) || defined(_IBMR2) || defined(_POWER) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG +#elif defined(_ARCH_PWR) || defined(_ARCH_PWR2) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG + +/* System/370 */ +#elif defined(__370__) || defined(__THW_370__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG + +/* System/390 */ +#elif defined(__s390__) || defined(__s390x__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG + +/* z/Architecture */ +#elif defined(__SYSC_ZARCH__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG + +/* VAX */ +#elif defined(__vax__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG + +/* Aarch64 */ +#elif defined(__aarch64__) +# if !defined(__AARCH64EB__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE +# else +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG +# endif + +/* Xtensa */ +#elif defined(__XTENSA_EB__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG +#elif defined(__XTENSA_EL__) +# 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." +#endif + +#endif /* KWIML_ABI_private_DO_DEFINE */ + +/*--------------------------------------------------------------------------*/ +#ifdef KWIML_ABI_private_DO_VERIFY +#undef KWIML_ABI_private_DO_VERIFY + +#if defined(_MSC_VER) +# pragma warning (push) +# pragma warning (disable:4310) /* cast truncates constant value */ +#endif + +#define KWIML_ABI_private_VERIFY(n, x, y) KWIML_ABI_private_VERIFY_0(KWIML_ABI_private_VERSION, n, x, y) +#define KWIML_ABI_private_VERIFY_0(V, n, x, y) KWIML_ABI_private_VERIFY_1(V, n, x, y) +#define KWIML_ABI_private_VERIFY_1(V, n, x, y) extern int (*n##_v##V)[x]; extern int (*n##_v##V)[y] + +#define KWIML_ABI_private_VERIFY_SAME_IMPL(n, x, y) KWIML_ABI_private_VERIFY_SAME_IMPL_0(KWIML_ABI_private_VERSION, n, x, y) +#define KWIML_ABI_private_VERIFY_SAME_IMPL_0(V, n, x, y) KWIML_ABI_private_VERIFY_SAME_IMPL_1(V, n, x, y) +#define KWIML_ABI_private_VERIFY_SAME_IMPL_1(V, n, x, y) extern int (*n##_v##V)(x*); extern int (*n##_v##V)(y*) + +#define KWIML_ABI_private_VERIFY_DIFF_IMPL(n, x, y) KWIML_ABI_private_VERIFY_DIFF_IMPL_0(KWIML_ABI_private_VERSION, n, x, y) +#define KWIML_ABI_private_VERIFY_DIFF_IMPL_0(V, n, x, y) KWIML_ABI_private_VERIFY_DIFF_IMPL_1(V, n, x, y) +#if defined(__cplusplus) +# define KWIML_ABI_private_VERIFY_DIFF_IMPL_1(V, n, x, y) extern int* n##_v##V(x*); extern char* n##_v##V(y*) +#else +# define KWIML_ABI_private_VERIFY_DIFF_IMPL_1(V, n, x, y) extern int* n##_v##V(x*) /* TODO: possible? */ +#endif + +#define KWIML_ABI_private_VERIFY_BOOL(m, b) KWIML_ABI_private_VERIFY(KWIML_ABI_detail_VERIFY_##m, 2, (b)?2:3) +#define KWIML_ABI_private_VERIFY_SIZE(m, t) KWIML_ABI_private_VERIFY(KWIML_ABI_detail_VERIFY_##m, m, sizeof(t)) +#define KWIML_ABI_private_VERIFY_SAME(m, x, y) KWIML_ABI_private_VERIFY_SAME_IMPL(KWIML_ABI_detail_VERIFY_##m, x, y) +#define KWIML_ABI_private_VERIFY_DIFF(m, x, y) KWIML_ABI_private_VERIFY_DIFF_IMPL(KWIML_ABI_detail_VERIFY_##m, x, y) + +KWIML_ABI_private_VERIFY_SIZE(KWIML_ABI_SIZEOF_DATA_PTR, int*); +KWIML_ABI_private_VERIFY_SIZE(KWIML_ABI_SIZEOF_CODE_PTR, int(*)(int)); +KWIML_ABI_private_VERIFY_SIZE(KWIML_ABI_SIZEOF_CHAR, char); +KWIML_ABI_private_VERIFY_SIZE(KWIML_ABI_SIZEOF_SHORT, short); +KWIML_ABI_private_VERIFY_SIZE(KWIML_ABI_SIZEOF_INT, int); +KWIML_ABI_private_VERIFY_SIZE(KWIML_ABI_SIZEOF_LONG, long); +#if defined(KWIML_ABI_SIZEOF_LONG_LONG) && KWIML_ABI_SIZEOF_LONG_LONG > 0 +KWIML_ABI_private_VERIFY_SIZE(KWIML_ABI_SIZEOF_LONG_LONG, long long); +#endif +#if defined(KWIML_ABI_SIZEOF___INT64) && KWIML_ABI_SIZEOF___INT64 > 0 +KWIML_ABI_private_VERIFY_SIZE(KWIML_ABI_SIZEOF___INT64, __int64); +#endif +KWIML_ABI_private_VERIFY_SIZE(KWIML_ABI_SIZEOF_FLOAT, float); +KWIML_ABI_private_VERIFY_SIZE(KWIML_ABI_SIZEOF_DOUBLE, double); + +#if defined(KWIML_ABI___INT64_IS_LONG) +KWIML_ABI_private_VERIFY_SAME(KWIML_ABI___INT64_IS_LONG, __int64, long); +#elif defined(KWIML_ABI___INT64_IS_LONG_LONG) +KWIML_ABI_private_VERIFY_SAME(KWIML_ABI___INT64_IS_LONG_LONG, __int64, long long); +#elif defined(KWIML_ABI_SIZEOF___INT64) && KWIML_ABI_SIZEOF___INT64 > 0 +KWIML_ABI_private_VERIFY_DIFF(KWIML_ABI___INT64_NOT_LONG, __int64, long); +# if defined(KWIML_ABI_SIZEOF_LONG_LONG) && KWIML_ABI_SIZEOF_LONG_LONG > 0 +KWIML_ABI_private_VERIFY_DIFF(KWIML_ABI___INT64_NOT_LONG_LONG, __int64, long long); +# endif +#endif + +#if defined(KWIML_ABI_CHAR_IS_UNSIGNED) +KWIML_ABI_private_VERIFY_BOOL(KWIML_ABI_CHAR_IS_UNSIGNED, (char)0x80 > 0); +#elif defined(KWIML_ABI_CHAR_IS_SIGNED) +KWIML_ABI_private_VERIFY_BOOL(KWIML_ABI_CHAR_IS_SIGNED, (char)0x80 < 0); +#endif + +#undef KWIML_ABI_private_VERIFY_DIFF +#undef KWIML_ABI_private_VERIFY_SAME +#undef KWIML_ABI_private_VERIFY_SIZE +#undef KWIML_ABI_private_VERIFY_BOOL + +#undef KWIML_ABI_private_VERIFY_DIFF_IMPL_1 +#undef KWIML_ABI_private_VERIFY_DIFF_IMPL_0 +#undef KWIML_ABI_private_VERIFY_DIFF_IMPL + +#undef KWIML_ABI_private_VERIFY_SAME_IMPL_1 +#undef KWIML_ABI_private_VERIFY_SAME_IMPL_0 +#undef KWIML_ABI_private_VERIFY_SAME_IMPL + +#undef KWIML_ABI_private_VERIFY_1 +#undef KWIML_ABI_private_VERIFY_0 +#undef KWIML_ABI_private_VERIFY + +#if defined(_MSC_VER) +# pragma warning (pop) +#endif + +#endif /* KWIML_ABI_private_DO_VERIFY */ + +#undef KWIML_ABI_private_VERSION diff --git a/Utilities/KWIML/include/kwiml/int.h b/Utilities/KWIML/include/kwiml/int.h new file mode 100644 index 000000000..b297acee4 --- /dev/null +++ b/Utilities/KWIML/include/kwiml/int.h @@ -0,0 +1,1069 @@ +/*============================================================================ + Kitware Information Macro Library + Copyright 2010-2015 Kitware, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Kitware, Inc. nor the names of its contributors + may be used to endorse or promote products derived from this + software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +============================================================================*/ +/* +This header defines macros with information about sized integer types. +Only information that can be determined using the preprocessor at +compilation time is available. No try-compile results may be added +here. Instead we memorize results on platforms of interest. + +An includer may optionally define the following macros to suppress errors: + +Input: + KWIML_INT_NO_VERIFY = skip verification declarations + KWIML_INT_NO_ERROR_INT64_T = type 'KWIML_INT_int64_t' is optional (*) + KWIML_INT_NO_ERROR_UINT64_T = type 'KWIML_INT_uint64_t' is optional (*) + KWIML_INT_NO_ERROR_INTPTR_T = type 'KWIML_INT_intptr_t' is optional (*) + KWIML_INT_NO_ERROR_UINTPTR_T = type 'KWIML_INT_uintptr_t' is optional (*) + +An includer may optionally define the following macros to override defaults. +Either way, an includer may test these macros after inclusion: + + KWIML_INT_HAVE_STDINT_H = include + KWIML_INT_NO_STDINT_H = do not include + KWIML_INT_HAVE_INTTYPES_H = include + KWIML_INT_NO_INTTYPES_H = do not include + +An includer may test the following macros after inclusion: + + KWIML_INT_VERSION = interface version number # of this header + + KWIML_INT_HAVE_INT#_T = type 'int#_t' is available + KWIML_INT_HAVE_UINT#_T = type 'uint#_t' is available + # = 8, 16, 32, 64, PTR + + KWIML_INT_int#_t = signed integer type exactly # bits wide + KWIML_INT_uint#_t = unsigned integer type exactly # bits wide + # = 8, 16, 32, 64 (*), ptr (*) + + KWIML_INT_NO_INT64_T = type 'KWIML_INT_int64_t' not available + KWIML_INT_NO_UINT64_T = type 'KWIML_INT_uint64_t' not available + KWIML_INT_NO_INTPTR_T = type 'KWIML_INT_intptr_t' not available + KWIML_INT_NO_UINTPTR_T = type 'KWIML_INT_uintptr_t' not available + + KWIML_INT_INT#_C(c) = signed integer constant at least # bits wide + KWIML_INT_UINT#_C(c) = unsigned integer constant at least # bits wide + # = 8, 16, 32, 64 (*) + + KWIML_INT_# = print or scan format, in table below + # = 8, 16, 32, 64, PTR (*) + + signed unsigned + ----------- ------------------------------ + | decimal | decimal octal hexadecimal | + print | PRId PRIi | PRIu PRIo PRIx PRIX | + scan | SCNd SCNi | SCNu SCNo SCNx | + ----------- ------------------------------ + + The SCN*8 and SCN*64 format macros will not be defined on systems + with scanf implementations known not to support them. + + KWIML_INT_BROKEN_# = macro # is incorrect if defined + Some compilers define integer format macros incorrectly for their + own formatted print/scan implementations. + + KWIML_INT_BROKEN_INT#_C = macro INT#_C is incorrect if defined + KWIML_INT_BROKEN_UINT#_C = macro UINT#_C is incorrect if defined + Some compilers define integer constant macros incorrectly and + cannot handle literals as large as the integer type or even + produce bad preprocessor syntax. + + KWIML_INT_BROKEN_INT8_T = type 'int8_t' is available but incorrect + Some compilers have a flag to make 'char' (un)signed but do not account + for it while defining int8_t in the non-default case. + + The broken cases do not affect correctness of the macros documented above. +*/ + +#include "abi.h" + +#define KWIML_INT_private_VERSION 1 + +/* Guard definition of this version. */ +#ifndef KWIML_INT_detail_DEFINED_VERSION_1 +# define KWIML_INT_detail_DEFINED_VERSION_1 1 +# define KWIML_INT_private_DO_DEFINE +#endif + +/* Guard verification of this version. */ +#if !defined(KWIML_INT_NO_VERIFY) +# ifndef KWIML_INT_detail_VERIFIED_VERSION_1 +# define KWIML_INT_detail_VERIFIED_VERSION_1 +# define KWIML_INT_private_DO_VERIFY +# endif +#endif + +#ifdef KWIML_INT_private_DO_DEFINE +#undef KWIML_INT_private_DO_DEFINE + +/* Define version as most recent of those included. */ +#if !defined(KWIML_INT_VERSION) || KWIML_INT_VERSION < KWIML_INT_private_VERSION +# undef KWIML_INT_VERSION +# define KWIML_INT_VERSION 1 +#endif + +/*--------------------------------------------------------------------------*/ +#if defined(KWIML_INT_HAVE_STDINT_H) /* Already defined. */ +#elif defined(KWIML_INT_NO_STDINT_H) /* Already defined. */ +#elif defined(HAVE_STDINT_H) /* Optionally provided by includer. */ +# define KWIML_INT_HAVE_STDINT_H 1 +#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ +# define KWIML_INT_HAVE_STDINT_H 1 +#elif defined(_MSC_VER) /* MSVC */ +# if _MSC_VER >= 1600 +# define KWIML_INT_HAVE_STDINT_H 1 +# else +# define KWIML_INT_NO_STDINT_H 1 +# endif +#elif defined(__BORLANDC__) /* Borland */ +# if __BORLANDC__ >= 0x560 +# define KWIML_INT_HAVE_STDINT_H 1 +# else +# define KWIML_INT_NO_STDINT_H 1 +# endif +#elif defined(__WATCOMC__) /* Watcom */ +# define KWIML_INT_NO_STDINT_H 1 +#endif + +/*--------------------------------------------------------------------------*/ +#if defined(KWIML_INT_HAVE_INTTYPES_H) /* Already defined. */ +#elif defined(KWIML_INT_NO_INTTYPES_H) /* Already defined. */ +#elif defined(HAVE_INTTYPES_H) /* Optionally provided by includer. */ +# define KWIML_INT_HAVE_INTTYPES_H 1 +#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ +# define KWIML_INT_HAVE_INTTYPES_H 1 +#elif defined(_MSC_VER) /* MSVC */ +# define KWIML_INT_NO_INTTYPES_H 1 +#elif defined(__BORLANDC__) /* Borland */ +# define KWIML_INT_NO_INTTYPES_H 1 +#elif defined(__WATCOMC__) /* Watcom */ +# define KWIML_INT_NO_INTTYPES_H 1 +#else /* Assume it exists. */ +# define KWIML_INT_HAVE_INTTYPES_H 1 +#endif + +/*--------------------------------------------------------------------------*/ +#if defined(KWIML_INT_HAVE_STDINT_H) && defined(KWIML_INT_NO_STDINT_H) +# error "Both KWIML_INT_HAVE_STDINT_H and KWIML_INT_NO_STDINT_H defined!" +#endif +#if defined(KWIML_INT_HAVE_INTTYPES_H) && defined(KWIML_INT_NO_INTTYPES_H) +# error "Both KWIML_INT_HAVE_INTTYPES_H and KWIML_INT_NO_INTTYPES_H defined!" +#endif + +#if defined(KWIML_INT_HAVE_STDINT_H) +# ifndef KWIML_INT_detail_INCLUDED_STDINT_H +# define KWIML_INT_detail_INCLUDED_STDINT_H +# include +# endif +#endif +#if defined(KWIML_INT_HAVE_INTTYPES_H) +# ifndef KWIML_INT_detail_INCLUDED_INTTYPES_H +# define KWIML_INT_detail_INCLUDED_INTTYPES_H +# if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS) +# define __STDC_FORMAT_MACROS +# endif +# include +# endif +#endif + +#if defined(KWIML_INT_HAVE_STDINT_H) || defined(KWIML_INT_HAVE_INTTYPES_H) +#define KWIML_INT_HAVE_INT8_T 1 +#define KWIML_INT_HAVE_UINT8_T 1 +#define KWIML_INT_HAVE_INT16_T 1 +#define KWIML_INT_HAVE_UINT16_T 1 +#define KWIML_INT_HAVE_INT32_T 1 +#define KWIML_INT_HAVE_UINT32_T 1 +#define KWIML_INT_HAVE_INT64_T 1 +#define KWIML_INT_HAVE_UINT64_T 1 +#define KWIML_INT_HAVE_INTPTR_T 1 +#define KWIML_INT_HAVE_UINTPTR_T 1 +# if defined(__cplusplus) +# define KWIML_INT_detail_GLOBAL_NS(T) ::T +# else +# define KWIML_INT_detail_GLOBAL_NS(T) T +# endif +#endif + +#if defined(_AIX43) && !defined(_AIX50) && !defined(_AIX51) + /* AIX 4.3 defines these incorrectly with % and no quotes. */ +# define KWIML_INT_BROKEN_PRId8 1 +# define KWIML_INT_BROKEN_SCNd8 1 +# define KWIML_INT_BROKEN_PRIi8 1 +# define KWIML_INT_BROKEN_SCNi8 1 +# define KWIML_INT_BROKEN_PRIo8 1 +# define KWIML_INT_BROKEN_SCNo8 1 +# define KWIML_INT_BROKEN_PRIu8 1 +# define KWIML_INT_BROKEN_SCNu8 1 +# define KWIML_INT_BROKEN_PRIx8 1 +# define KWIML_INT_BROKEN_SCNx8 1 +# define KWIML_INT_BROKEN_PRIX8 1 +# define KWIML_INT_BROKEN_PRId16 1 +# define KWIML_INT_BROKEN_SCNd16 1 +# define KWIML_INT_BROKEN_PRIi16 1 +# define KWIML_INT_BROKEN_SCNi16 1 +# define KWIML_INT_BROKEN_PRIo16 1 +# define KWIML_INT_BROKEN_SCNo16 1 +# define KWIML_INT_BROKEN_PRIu16 1 +# define KWIML_INT_BROKEN_SCNu16 1 +# define KWIML_INT_BROKEN_PRIx16 1 +# define KWIML_INT_BROKEN_SCNx16 1 +# define KWIML_INT_BROKEN_PRIX16 1 +# define KWIML_INT_BROKEN_PRId32 1 +# define KWIML_INT_BROKEN_SCNd32 1 +# define KWIML_INT_BROKEN_PRIi32 1 +# define KWIML_INT_BROKEN_SCNi32 1 +# define KWIML_INT_BROKEN_PRIo32 1 +# define KWIML_INT_BROKEN_SCNo32 1 +# define KWIML_INT_BROKEN_PRIu32 1 +# define KWIML_INT_BROKEN_SCNu32 1 +# define KWIML_INT_BROKEN_PRIx32 1 +# define KWIML_INT_BROKEN_SCNx32 1 +# define KWIML_INT_BROKEN_PRIX32 1 +# define KWIML_INT_BROKEN_PRId64 1 +# define KWIML_INT_BROKEN_SCNd64 1 +# define KWIML_INT_BROKEN_PRIi64 1 +# define KWIML_INT_BROKEN_SCNi64 1 +# define KWIML_INT_BROKEN_PRIo64 1 +# define KWIML_INT_BROKEN_SCNo64 1 +# define KWIML_INT_BROKEN_PRIu64 1 +# define KWIML_INT_BROKEN_SCNu64 1 +# define KWIML_INT_BROKEN_PRIx64 1 +# define KWIML_INT_BROKEN_SCNx64 1 +# define KWIML_INT_BROKEN_PRIX64 1 +# define KWIML_INT_BROKEN_PRIdPTR 1 +# define KWIML_INT_BROKEN_SCNdPTR 1 +# define KWIML_INT_BROKEN_PRIiPTR 1 +# define KWIML_INT_BROKEN_SCNiPTR 1 +# define KWIML_INT_BROKEN_PRIoPTR 1 +# define KWIML_INT_BROKEN_SCNoPTR 1 +# define KWIML_INT_BROKEN_PRIuPTR 1 +# define KWIML_INT_BROKEN_SCNuPTR 1 +# define KWIML_INT_BROKEN_PRIxPTR 1 +# define KWIML_INT_BROKEN_SCNxPTR 1 +# define KWIML_INT_BROKEN_PRIXPTR 1 +#endif + +#if (defined(__SUNPRO_C)||defined(__SUNPRO_CC)) && defined(_CHAR_IS_UNSIGNED) +# define KWIML_INT_BROKEN_INT8_T 1 /* system type defined incorrectly */ +#elif defined(__BORLANDC__) && defined(_CHAR_UNSIGNED) +# define KWIML_INT_BROKEN_INT8_T 1 /* system type defined incorrectly */ +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_INT_int8_t) +# if defined(KWIML_INT_HAVE_INT8_T) && !defined(KWIML_INT_BROKEN_INT8_T) +# define KWIML_INT_int8_t KWIML_INT_detail_GLOBAL_NS(int8_t) +# else +# define KWIML_INT_int8_t signed char +# endif +#endif +#if !defined(KWIML_INT_uint8_t) +# if defined(KWIML_INT_HAVE_UINT8_T) +# define KWIML_INT_uint8_t KWIML_INT_detail_GLOBAL_NS(uint8_t) +# else +# define KWIML_INT_uint8_t unsigned char +# endif +#endif + +#if defined(__INTEL_COMPILER) +# if defined(_WIN32) +# define KWIML_INT_private_NO_SCN8 +# endif +#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) +# define KWIML_INT_private_NO_SCN8 +#elif defined(__BORLANDC__) +# define KWIML_INT_private_NO_SCN8 +# define KWIML_INT_private_NO_SCN64 +#elif defined(_MSC_VER) +# define KWIML_INT_private_NO_SCN8 +#elif defined(__WATCOMC__) +# define KWIML_INT_private_NO_SCN8 +# elif defined(__hpux) /* HP runtime lacks support (any compiler) */ +# define KWIML_INT_private_NO_SCN8 +#endif + +/* 8-bit d, i */ +#if !defined(KWIML_INT_PRId8) +# if defined(KWIML_INT_HAVE_INT8_T) && defined(PRId8) \ + && !defined(KWIML_INT_BROKEN_PRId8) +# define KWIML_INT_PRId8 PRId8 +# else +# define KWIML_INT_PRId8 "d" +# endif +#endif +#if !defined(KWIML_INT_SCNd8) +# if defined(KWIML_INT_HAVE_INT8_T) && defined(SCNd8) \ + && !defined(KWIML_INT_BROKEN_SCNd8) +# define KWIML_INT_SCNd8 SCNd8 +# elif !defined(KWIML_INT_private_NO_SCN8) +# define KWIML_INT_SCNd8 "hhd" +# endif +#endif +#if !defined(KWIML_INT_PRIi8) +# if defined(KWIML_INT_HAVE_INT8_T) && defined(PRIi8) \ + && !defined(KWIML_INT_BROKEN_PRIi8) +# define KWIML_INT_PRIi8 PRIi8 +# else +# define KWIML_INT_PRIi8 "i" +# endif +#endif +#if !defined(KWIML_INT_SCNi8) +# if defined(KWIML_INT_HAVE_INT8_T) && defined(SCNi8) \ + && !defined(KWIML_INT_BROKEN_SCNi8) +# define KWIML_INT_SCNi8 SCNi8 +# elif !defined(KWIML_INT_private_NO_SCN8) +# define KWIML_INT_SCNi8 "hhi" +# endif +#endif + +/* 8-bit o, u, x, X */ +#if !defined(KWIML_INT_PRIo8) +# if defined(KWIML_INT_HAVE_UINT8_T) && defined(PRIo8) \ + && !defined(KWIML_INT_BROKEN_PRIo8) +# define KWIML_INT_PRIo8 PRIo8 +# else +# define KWIML_INT_PRIo8 "o" +# endif +#endif +#if !defined(KWIML_INT_SCNo8) +# if defined(KWIML_INT_HAVE_UINT8_T) && defined(SCNo8) \ + && !defined(KWIML_INT_BROKEN_SCNo8) +# define KWIML_INT_SCNo8 SCNo8 +# elif !defined(KWIML_INT_private_NO_SCN8) +# define KWIML_INT_SCNo8 "hho" +# endif +#endif +#if !defined(KWIML_INT_PRIu8) +# if defined(KWIML_INT_HAVE_UINT8_T) && defined(PRIu8) \ + && !defined(KWIML_INT_BROKEN_PRIu8) +# define KWIML_INT_PRIu8 PRIu8 +# else +# define KWIML_INT_PRIu8 "u" +# endif +#endif +#if !defined(KWIML_INT_SCNu8) +# if defined(KWIML_INT_HAVE_UINT8_T) && defined(SCNu8) \ + && !defined(KWIML_INT_BROKEN_SCNu8) +# define KWIML_INT_SCNu8 SCNu8 +# elif !defined(KWIML_INT_private_NO_SCN8) +# define KWIML_INT_SCNu8 "hhu" +# endif +#endif +#if !defined(KWIML_INT_PRIx8) +# if defined(KWIML_INT_HAVE_UINT8_T) && defined(PRIx8) \ + && !defined(KWIML_INT_BROKEN_PRIx8) +# define KWIML_INT_PRIx8 PRIx8 +# else +# define KWIML_INT_PRIx8 "x" +# endif +#endif +#if !defined(KWIML_INT_SCNx8) +# if defined(KWIML_INT_HAVE_UINT8_T) && defined(SCNx8) \ + && !defined(KWIML_INT_BROKEN_SCNx8) +# define KWIML_INT_SCNx8 SCNx8 +# elif !defined(KWIML_INT_private_NO_SCN8) +# define KWIML_INT_SCNx8 "hhx" +# endif +#endif +#if !defined(KWIML_INT_PRIX8) +# if defined(KWIML_INT_HAVE_UINT8_T) && defined(PRIX8) \ + && !defined(KWIML_INT_BROKEN_PRIX8) +# define KWIML_INT_PRIX8 PRIX8 +# else +# define KWIML_INT_PRIX8 "X" +# endif +#endif + +/* 8-bit constants */ +#if !defined(KWIML_INT_INT8_C) +# if defined(INT8_C) && !defined(KWIML_INT_BROKEN_INT8_C) +# define KWIML_INT_INT8_C(c) INT8_C(c) +# else +# define KWIML_INT_INT8_C(c) c +# endif +#endif +#if !defined(KWIML_INT_UINT8_C) +# if defined(UINT8_C) && !defined(KWIML_INT_BROKEN_UINT8_C) +# define KWIML_INT_UINT8_C(c) UINT8_C(c) +# else +# define KWIML_INT_UINT8_C(c) c ## u +# endif +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_INT_int16_t) +# if defined(KWIML_INT_HAVE_INT16_T) +# define KWIML_INT_int16_t KWIML_INT_detail_GLOBAL_NS(int16_t) +# else +# define KWIML_INT_int16_t signed short +# endif +#endif +#if !defined(KWIML_INT_uint16_t) +# if defined(KWIML_INT_HAVE_UINT16_T) +# define KWIML_INT_uint16_t KWIML_INT_detail_GLOBAL_NS(uint16_t) +# else +# define KWIML_INT_uint16_t unsigned short +# endif +#endif + +/* 16-bit d, i */ +#if !defined(KWIML_INT_PRId16) +# if defined(KWIML_INT_HAVE_INT16_T) && defined(PRId16) \ + && !defined(KWIML_INT_BROKEN_PRId16) +# define KWIML_INT_PRId16 PRId16 +# else +# define KWIML_INT_PRId16 "d" +# endif +#endif +#if !defined(KWIML_INT_SCNd16) +# if defined(KWIML_INT_HAVE_INT16_T) && defined(SCNd16) \ + && !defined(KWIML_INT_BROKEN_SCNd16) +# define KWIML_INT_SCNd16 SCNd16 +# else +# define KWIML_INT_SCNd16 "hd" +# endif +#endif +#if !defined(KWIML_INT_PRIi16) +# if defined(KWIML_INT_HAVE_INT16_T) && defined(PRIi16) \ + && !defined(KWIML_INT_BROKEN_PRIi16) +# define KWIML_INT_PRIi16 PRIi16 +# else +# define KWIML_INT_PRIi16 "i" +# endif +#endif +#if !defined(KWIML_INT_SCNi16) +# if defined(KWIML_INT_HAVE_INT16_T) && defined(SCNi16) \ + && !defined(KWIML_INT_BROKEN_SCNi16) +# define KWIML_INT_SCNi16 SCNi16 +# else +# define KWIML_INT_SCNi16 "hi" +# endif +#endif + +/* 16-bit o, u, x, X */ +#if !defined(KWIML_INT_PRIo16) +# if defined(KWIML_INT_HAVE_UINT16_T) && defined(PRIo16) \ + && !defined(KWIML_INT_BROKEN_PRIo16) +# define KWIML_INT_PRIo16 PRIo16 +# else +# define KWIML_INT_PRIo16 "o" +# endif +#endif +#if !defined(KWIML_INT_SCNo16) +# if defined(KWIML_INT_HAVE_UINT16_T) && defined(SCNo16) \ + && !defined(KWIML_INT_BROKEN_SCNo16) +# define KWIML_INT_SCNo16 SCNo16 +# else +# define KWIML_INT_SCNo16 "ho" +# endif +#endif +#if !defined(KWIML_INT_PRIu16) +# if defined(KWIML_INT_HAVE_UINT16_T) && defined(PRIu16) \ + && !defined(KWIML_INT_BROKEN_PRIu16) +# define KWIML_INT_PRIu16 PRIu16 +# else +# define KWIML_INT_PRIu16 "u" +# endif +#endif +#if !defined(KWIML_INT_SCNu16) +# if defined(KWIML_INT_HAVE_UINT16_T) && defined(SCNu16) \ + && !defined(KWIML_INT_BROKEN_SCNu16) +# define KWIML_INT_SCNu16 SCNu16 +# else +# define KWIML_INT_SCNu16 "hu" +# endif +#endif +#if !defined(KWIML_INT_PRIx16) +# if defined(KWIML_INT_HAVE_UINT16_T) && defined(PRIx16) \ + && !defined(KWIML_INT_BROKEN_PRIx16) +# define KWIML_INT_PRIx16 PRIx16 +# else +# define KWIML_INT_PRIx16 "x" +# endif +#endif +#if !defined(KWIML_INT_SCNx16) +# if defined(KWIML_INT_HAVE_UINT16_T) && defined(SCNx16) \ + && !defined(KWIML_INT_BROKEN_SCNx16) +# define KWIML_INT_SCNx16 SCNx16 +# else +# define KWIML_INT_SCNx16 "hx" +# endif +#endif +#if !defined(KWIML_INT_PRIX16) +# if defined(KWIML_INT_HAVE_UINT16_T) && defined(PRIX16) \ + && !defined(KWIML_INT_BROKEN_PRIX16) +# define KWIML_INT_PRIX16 PRIX16 +# else +# define KWIML_INT_PRIX16 "X" +# endif +#endif + +/* 16-bit constants */ +#if !defined(KWIML_INT_INT16_C) +# if defined(INT16_C) && !defined(KWIML_INT_BROKEN_INT16_C) +# define KWIML_INT_INT16_C(c) INT16_C(c) +# else +# define KWIML_INT_INT16_C(c) c +# endif +#endif +#if !defined(KWIML_INT_UINT16_C) +# if defined(UINT16_C) && !defined(KWIML_INT_BROKEN_UINT16_C) +# define KWIML_INT_UINT16_C(c) UINT16_C(c) +# else +# define KWIML_INT_UINT16_C(c) c ## u +# endif +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_INT_int32_t) +# if defined(KWIML_INT_HAVE_INT32_T) +# define KWIML_INT_int32_t KWIML_INT_detail_GLOBAL_NS(int32_t) +# else +# define KWIML_INT_int32_t signed int +# endif +#endif +#if !defined(KWIML_INT_uint32_t) +# if defined(KWIML_INT_HAVE_UINT32_T) +# define KWIML_INT_uint32_t KWIML_INT_detail_GLOBAL_NS(uint32_t) +# else +# define KWIML_INT_uint32_t unsigned int +# endif +#endif + +/* 32-bit d, i */ +#if !defined(KWIML_INT_PRId32) +# if defined(KWIML_INT_HAVE_INT32_T) && defined(PRId32) \ + && !defined(KWIML_INT_BROKEN_PRId32) +# define KWIML_INT_PRId32 PRId32 +# else +# define KWIML_INT_PRId32 "d" +# endif +#endif +#if !defined(KWIML_INT_SCNd32) +# if defined(KWIML_INT_HAVE_INT32_T) && defined(SCNd32) \ + && !defined(KWIML_INT_BROKEN_SCNd32) +# define KWIML_INT_SCNd32 SCNd32 +# else +# define KWIML_INT_SCNd32 "d" +# endif +#endif +#if !defined(KWIML_INT_PRIi32) +# if defined(KWIML_INT_HAVE_INT32_T) && defined(PRIi32) \ + && !defined(KWIML_INT_BROKEN_PRIi32) +# define KWIML_INT_PRIi32 PRIi32 +# else +# define KWIML_INT_PRIi32 "i" +# endif +#endif +#if !defined(KWIML_INT_SCNi32) +# if defined(KWIML_INT_HAVE_INT32_T) && defined(SCNi32) \ + && !defined(KWIML_INT_BROKEN_SCNi32) +# define KWIML_INT_SCNi32 SCNi32 +# else +# define KWIML_INT_SCNi32 "i" +# endif +#endif + +/* 32-bit o, u, x, X */ +#if !defined(KWIML_INT_PRIo32) +# if defined(KWIML_INT_HAVE_UINT32_T) && defined(PRIo32) \ + && !defined(KWIML_INT_BROKEN_PRIo32) +# define KWIML_INT_PRIo32 PRIo32 +# else +# define KWIML_INT_PRIo32 "o" +# endif +#endif +#if !defined(KWIML_INT_SCNo32) +# if defined(KWIML_INT_HAVE_UINT32_T) && defined(SCNo32) \ + && !defined(KWIML_INT_BROKEN_SCNo32) +# define KWIML_INT_SCNo32 SCNo32 +# else +# define KWIML_INT_SCNo32 "o" +# endif +#endif +#if !defined(KWIML_INT_PRIu32) +# if defined(KWIML_INT_HAVE_UINT32_T) && defined(PRIu32) \ + && !defined(KWIML_INT_BROKEN_PRIu32) +# define KWIML_INT_PRIu32 PRIu32 +# else +# define KWIML_INT_PRIu32 "u" +# endif +#endif +#if !defined(KWIML_INT_SCNu32) +# if defined(KWIML_INT_HAVE_UINT32_T) && defined(SCNu32) \ + && !defined(KWIML_INT_BROKEN_SCNu32) +# define KWIML_INT_SCNu32 SCNu32 +# else +# define KWIML_INT_SCNu32 "u" +# endif +#endif +#if !defined(KWIML_INT_PRIx32) +# if defined(KWIML_INT_HAVE_UINT32_T) && defined(PRIx32) \ + && !defined(KWIML_INT_BROKEN_PRIx32) +# define KWIML_INT_PRIx32 PRIx32 +# else +# define KWIML_INT_PRIx32 "x" +# endif +#endif +#if !defined(KWIML_INT_SCNx32) +# if defined(KWIML_INT_HAVE_UINT32_T) && defined(SCNx32) \ + && !defined(KWIML_INT_BROKEN_SCNx32) +# define KWIML_INT_SCNx32 SCNx32 +# else +# define KWIML_INT_SCNx32 "x" +# endif +#endif +#if !defined(KWIML_INT_PRIX32) +# if defined(KWIML_INT_HAVE_UINT32_T) && defined(PRIX32) \ + && !defined(KWIML_INT_BROKEN_PRIX32) +# define KWIML_INT_PRIX32 PRIX32 +# else +# define KWIML_INT_PRIX32 "X" +# endif +#endif + +#if defined(__hpux) && defined(__GNUC__) && !defined(__LP64__) \ + && defined(__CONCAT__) && defined(__CONCAT_U__) + /* Some HPs define UINT32_C incorrectly and break GNU. */ +# define KWIML_INT_BROKEN_UINT32_C 1 +#endif + +/* 32-bit constants */ +#if !defined(KWIML_INT_INT32_C) +# if defined(INT32_C) && !defined(KWIML_INT_BROKEN_INT32_C) +# define KWIML_INT_INT32_C(c) INT32_C(c) +# else +# define KWIML_INT_INT32_C(c) c +# endif +#endif +#if !defined(KWIML_INT_UINT32_C) +# if defined(UINT32_C) && !defined(KWIML_INT_BROKEN_UINT32_C) +# define KWIML_INT_UINT32_C(c) UINT32_C(c) +# else +# define KWIML_INT_UINT32_C(c) c ## u +# endif +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_INT_int64_t) && !defined(KWIML_INT_NO_INT64_T) +# if defined(KWIML_INT_HAVE_INT64_T) +# define KWIML_INT_int64_t KWIML_INT_detail_GLOBAL_NS(int64_t) +# elif KWIML_ABI_SIZEOF_LONG == 8 +# define KWIML_INT_int64_t signed long +# elif defined(KWIML_ABI_SIZEOF_LONG_LONG) && KWIML_ABI_SIZEOF_LONG_LONG == 8 +# define KWIML_INT_int64_t signed long long +# elif defined(KWIML_ABI_SIZEOF___INT64) +# define KWIML_INT_int64_t signed __int64 +# elif defined(KWIML_INT_NO_ERROR_INT64_T) +# define KWIML_INT_NO_INT64_T +# else +# error "No type known for 'int64_t'." +# endif +#endif +#if !defined(KWIML_INT_uint64_t) && !defined(KWIML_INT_NO_UINT64_T) +# if defined(KWIML_INT_HAVE_UINT64_T) +# define KWIML_INT_uint64_t KWIML_INT_detail_GLOBAL_NS(uint64_t) +# elif KWIML_ABI_SIZEOF_LONG == 8 +# define KWIML_INT_uint64_t unsigned long +# elif defined(KWIML_ABI_SIZEOF_LONG_LONG) && KWIML_ABI_SIZEOF_LONG_LONG == 8 +# define KWIML_INT_uint64_t unsigned long long +# elif defined(KWIML_ABI_SIZEOF___INT64) +# define KWIML_INT_uint64_t unsigned __int64 +# elif defined(KWIML_INT_NO_ERROR_UINT64_T) +# define KWIML_INT_NO_UINT64_T +# else +# error "No type known for 'uint64_t'." +# endif +#endif + +#if defined(__INTEL_COMPILER) +#elif defined(__BORLANDC__) +# define KWIML_INT_private_NO_FMTLL /* type 'long long' but not 'll' format */ +# define KWIML_INT_BROKEN_INT64_C 1 /* system macro defined incorrectly */ +# define KWIML_INT_BROKEN_UINT64_C 1 /* system macro defined incorrectly */ +#elif defined(_MSC_VER) && _MSC_VER < 1400 +# define KWIML_INT_private_NO_FMTLL /* type 'long long' but not 'll' format */ +#endif + +#if !defined(KWIML_INT_detail_FMT64) +# if KWIML_ABI_SIZEOF_LONG == 8 +# define KWIML_INT_detail_FMT64 "l" +# elif defined(KWIML_ABI_SIZEOF_LONG_LONG) && KWIML_ABI_SIZEOF_LONG_LONG == 8 +# if !defined(KWIML_INT_private_NO_FMTLL) +# define KWIML_INT_detail_FMT64 "ll" +# else +# define KWIML_INT_detail_FMT64 "I64" +# endif +# elif defined(KWIML_ABI_SIZEOF___INT64) +# if defined(__BORLANDC__) +# define KWIML_INT_detail_FMT64 "L" +# else +# define KWIML_INT_detail_FMT64 "I64" +# endif +# endif +#endif + +#undef KWIML_INT_private_NO_FMTLL + +/* 64-bit d, i */ +#if !defined(KWIML_INT_PRId64) +# if defined(KWIML_INT_HAVE_INT64_T) && defined(PRId64) \ + && !defined(KWIML_INT_BROKEN_PRId64) +# define KWIML_INT_PRId64 PRId64 +# elif defined(KWIML_INT_detail_FMT64) +# define KWIML_INT_PRId64 KWIML_INT_detail_FMT64 "d" +# endif +#endif +#if !defined(KWIML_INT_SCNd64) +# if defined(KWIML_INT_HAVE_INT64_T) && defined(SCNd64) \ + && !defined(KWIML_INT_BROKEN_SCNd64) +# define KWIML_INT_SCNd64 SCNd64 +# elif defined(KWIML_INT_detail_FMT64) && !defined(KWIML_INT_private_NO_SCN64) +# define KWIML_INT_SCNd64 KWIML_INT_detail_FMT64 "d" +# endif +#endif +#if !defined(KWIML_INT_PRIi64) +# if defined(KWIML_INT_HAVE_INT64_T) && defined(PRIi64) \ + && !defined(KWIML_INT_BROKEN_PRIi64) +# define KWIML_INT_PRIi64 PRIi64 +# elif defined(KWIML_INT_detail_FMT64) +# define KWIML_INT_PRIi64 KWIML_INT_detail_FMT64 "d" +# endif +#endif +#if !defined(KWIML_INT_SCNi64) +# if defined(KWIML_INT_HAVE_INT64_T) && defined(SCNi64) \ + && !defined(KWIML_INT_BROKEN_SCNi64) +# define KWIML_INT_SCNi64 SCNi64 +# elif defined(KWIML_INT_detail_FMT64) && !defined(KWIML_INT_private_NO_SCN64) +# define KWIML_INT_SCNi64 KWIML_INT_detail_FMT64 "d" +# endif +#endif + +/* 64-bit o, u, x, X */ +#if !defined(KWIML_INT_PRIo64) +# if defined(KWIML_INT_HAVE_UINT64_T) && defined(PRIo64) \ + && !defined(KWIML_INT_BROKEN_PRIo64) +# define KWIML_INT_PRIo64 PRIo64 +# elif defined(KWIML_INT_detail_FMT64) +# define KWIML_INT_PRIo64 KWIML_INT_detail_FMT64 "o" +# endif +#endif +#if !defined(KWIML_INT_SCNo64) +# if defined(KWIML_INT_HAVE_UINT64_T) && defined(SCNo64) \ + && !defined(KWIML_INT_BROKEN_SCNo64) +# define KWIML_INT_SCNo64 SCNo64 +# elif defined(KWIML_INT_detail_FMT64) && !defined(KWIML_INT_private_NO_SCN64) +# define KWIML_INT_SCNo64 KWIML_INT_detail_FMT64 "o" +# endif +#endif +#if !defined(KWIML_INT_PRIu64) +# if defined(KWIML_INT_HAVE_UINT64_T) && defined(PRIu64) \ + && !defined(KWIML_INT_BROKEN_PRIu64) +# define KWIML_INT_PRIu64 PRIu64 +# elif defined(KWIML_INT_detail_FMT64) +# define KWIML_INT_PRIu64 KWIML_INT_detail_FMT64 "u" +# endif +#endif +#if !defined(KWIML_INT_SCNu64) +# if defined(KWIML_INT_HAVE_UINT64_T) && defined(SCNu64) \ + && !defined(KWIML_INT_BROKEN_SCNu64) +# define KWIML_INT_SCNu64 SCNu64 +# elif defined(KWIML_INT_detail_FMT64) && !defined(KWIML_INT_private_NO_SCN64) +# define KWIML_INT_SCNu64 KWIML_INT_detail_FMT64 "u" +# endif +#endif +#if !defined(KWIML_INT_PRIx64) +# if defined(KWIML_INT_HAVE_UINT64_T) && defined(PRIx64) \ + && !defined(KWIML_INT_BROKEN_PRIx64) +# define KWIML_INT_PRIx64 PRIx64 +# elif defined(KWIML_INT_detail_FMT64) +# define KWIML_INT_PRIx64 KWIML_INT_detail_FMT64 "x" +# endif +#endif +#if !defined(KWIML_INT_SCNx64) +# if defined(KWIML_INT_HAVE_UINT64_T) && defined(SCNx64) \ + && !defined(KWIML_INT_BROKEN_SCNx64) +# define KWIML_INT_SCNx64 SCNx64 +# elif defined(KWIML_INT_detail_FMT64) && !defined(KWIML_INT_private_NO_SCN64) +# define KWIML_INT_SCNx64 KWIML_INT_detail_FMT64 "x" +# endif +#endif +#if !defined(KWIML_INT_PRIX64) +# if defined(KWIML_INT_HAVE_UINT64_T) && defined(PRIX64) \ + && !defined(KWIML_INT_BROKEN_PRIX64) +# define KWIML_INT_PRIX64 PRIX64 +# elif defined(KWIML_INT_detail_FMT64) +# define KWIML_INT_PRIX64 KWIML_INT_detail_FMT64 "X" +# endif +#endif + +/* 64-bit constants */ +#if !defined(KWIML_INT_INT64_C) +# if defined(KWIML_INT_HAVE_INT64_T) && defined(INT64_C) \ + && !defined(KWIML_INT_BROKEN_INT64_C) +# define KWIML_INT_INT64_C(c) INT64_C(c) +# elif KWIML_ABI_SIZEOF_LONG == 8 +# define KWIML_INT_INT64_C(c) c ## l +# elif defined(KWIML_ABI_SIZEOF_LONG_LONG) && KWIML_ABI_SIZEOF_LONG_LONG == 8 +# define KWIML_INT_INT64_C(c) c ## ll +# elif defined(KWIML_ABI_SIZEOF___INT64) +# define KWIML_INT_INT64_C(c) c ## i64 +# endif +#endif +#if !defined(KWIML_INT_UINT64_C) +# if defined(KWIML_INT_HAVE_UINT64_T) && defined(UINT64_C) \ + && !defined(KWIML_INT_BROKEN_UINT64_C) +# define KWIML_INT_UINT64_C(c) UINT64_C(c) +# elif KWIML_ABI_SIZEOF_LONG == 8 +# define KWIML_INT_UINT64_C(c) c ## ul +# elif defined(KWIML_ABI_SIZEOF_LONG_LONG) && KWIML_ABI_SIZEOF_LONG_LONG == 8 +# define KWIML_INT_UINT64_C(c) c ## ull +# elif defined(KWIML_ABI_SIZEOF___INT64) +# define KWIML_INT_UINT64_C(c) c ## ui64 +# endif +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_INT_intptr_t) && !defined(KWIML_INT_NO_INTPTR_T) +# if defined(KWIML_INT_HAVE_INTPTR_T) +# define KWIML_INT_intptr_t KWIML_INT_detail_GLOBAL_NS(intptr_t) +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_intptr_t KWIML_INT_int32_t +# elif !defined(KWIML_INT_NO_INT64_T) +# define KWIML_INT_intptr_t KWIML_INT_int64_t +# elif defined(KWIML_INT_NO_ERROR_INTPTR_T) +# define KWIML_INT_NO_INTPTR_T +# else +# error "No type known for 'intptr_t'." +# endif +#endif +#if !defined(KWIML_INT_uintptr_t) && !defined(KWIML_INT_NO_UINTPTR_T) +# if defined(KWIML_INT_HAVE_UINTPTR_T) +# define KWIML_INT_uintptr_t KWIML_INT_detail_GLOBAL_NS(uintptr_t) +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_uintptr_t KWIML_INT_uint32_t +# elif !defined(KWIML_INT_NO_UINT64_T) +# define KWIML_INT_uintptr_t KWIML_INT_uint64_t +# elif defined(KWIML_INT_NO_ERROR_UINTPTR_T) +# define KWIML_INT_NO_UINTPTR_T +# else +# error "No type known for 'uintptr_t'." +# endif +#endif + +#if !defined(KWIML_INT_PRIdPTR) +# if defined(KWIML_INT_HAVE_INTPTR_T) && defined(PRIdPTR) \ + && !defined(KWIML_INT_BROKEN_PRIdPTR) +# define KWIML_INT_PRIdPTR PRIdPTR +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_PRIdPTR KWIML_INT_PRId32 +# elif !defined(KWIML_INT_NO_UINT64_T) +# define KWIML_INT_PRIdPTR KWIML_INT_PRId64 +# endif +#endif +#if !defined(KWIML_INT_SCNdPTR) +# if defined(KWIML_INT_HAVE_INTPTR_T) && defined(SCNdPTR) \ + && !defined(KWIML_INT_BROKEN_SCNdPTR) +# define KWIML_INT_SCNdPTR SCNdPTR +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_SCNdPTR KWIML_INT_SCNd32 +# elif !defined(KWIML_INT_NO_UINT64_T) +# define KWIML_INT_SCNdPTR KWIML_INT_SCNd64 +# endif +#endif +#if !defined(KWIML_INT_PRIiPTR) +# if defined(KWIML_INT_HAVE_INTPTR_T) && defined(PRIiPTR) \ + && !defined(KWIML_INT_BROKEN_PRIiPTR) +# define KWIML_INT_PRIiPTR PRIiPTR +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_PRIiPTR KWIML_INT_PRIi32 +# elif !defined(KWIML_INT_NO_UINT64_T) +# define KWIML_INT_PRIiPTR KWIML_INT_PRIi64 +# endif +#endif +#if !defined(KWIML_INT_SCNiPTR) +# if defined(KWIML_INT_HAVE_INTPTR_T) && defined(SCNiPTR) \ + && !defined(KWIML_INT_BROKEN_SCNiPTR) +# define KWIML_INT_SCNiPTR SCNiPTR +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_SCNiPTR KWIML_INT_SCNi32 +# elif !defined(KWIML_INT_NO_UINT64_T) +# define KWIML_INT_SCNiPTR KWIML_INT_SCNi64 +# endif +#endif + +#if !defined(KWIML_INT_PRIoPTR) +# if defined(KWIML_INT_HAVE_UINTPTR_T) && defined(PRIoPTR) \ + && !defined(KWIML_INT_BROKEN_PRIoPTR) +# define KWIML_INT_PRIoPTR PRIoPTR +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_PRIoPTR KWIML_INT_PRIo32 +# elif !defined(KWIML_INT_NO_UINT64_T) +# define KWIML_INT_PRIoPTR KWIML_INT_PRIo64 +# endif +#endif +#if !defined(KWIML_INT_SCNoPTR) +# if defined(KWIML_INT_HAVE_UINTPTR_T) && defined(SCNoPTR) \ + && !defined(KWIML_INT_BROKEN_SCNoPTR) +# define KWIML_INT_SCNoPTR SCNoPTR +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_SCNoPTR KWIML_INT_SCNo32 +# elif !defined(KWIML_INT_NO_UINT64_T) +# define KWIML_INT_SCNoPTR KWIML_INT_SCNo64 +# endif +#endif +#if !defined(KWIML_INT_PRIuPTR) +# if defined(KWIML_INT_HAVE_UINTPTR_T) && defined(PRIuPTR) \ + && !defined(KWIML_INT_BROKEN_PRIuPTR) +# define KWIML_INT_PRIuPTR PRIuPTR +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_PRIuPTR KWIML_INT_PRIu32 +# elif !defined(KWIML_INT_NO_UINT64_T) +# define KWIML_INT_PRIuPTR KWIML_INT_PRIu64 +# endif +#endif +#if !defined(KWIML_INT_SCNuPTR) +# if defined(KWIML_INT_HAVE_UINTPTR_T) && defined(SCNuPTR) \ + && !defined(KWIML_INT_BROKEN_SCNuPTR) +# define KWIML_INT_SCNuPTR SCNuPTR +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_SCNuPTR KWIML_INT_SCNu32 +# elif !defined(KWIML_INT_NO_UINT64_T) +# define KWIML_INT_SCNuPTR KWIML_INT_SCNu64 +# endif +#endif +#if !defined(KWIML_INT_PRIxPTR) +# if defined(KWIML_INT_HAVE_UINTPTR_T) && defined(PRIxPTR) \ + && !defined(KWIML_INT_BROKEN_PRIxPTR) +# define KWIML_INT_PRIxPTR PRIxPTR +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_PRIxPTR KWIML_INT_PRIx32 +# elif !defined(KWIML_INT_NO_UINT64_T) +# define KWIML_INT_PRIxPTR KWIML_INT_PRIx64 +# endif +#endif +#if !defined(KWIML_INT_SCNxPTR) +# if defined(KWIML_INT_HAVE_UINTPTR_T) && defined(SCNxPTR) \ + && !defined(KWIML_INT_BROKEN_SCNxPTR) +# define KWIML_INT_SCNxPTR SCNxPTR +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_SCNxPTR KWIML_INT_SCNx32 +# elif !defined(KWIML_INT_NO_UINT64_T) +# define KWIML_INT_SCNxPTR KWIML_INT_SCNx64 +# endif +#endif +#if !defined(KWIML_INT_PRIXPTR) +# if defined(KWIML_INT_HAVE_UINTPTR_T) && defined(PRIXPTR) \ + && !defined(KWIML_INT_BROKEN_PRIXPTR) +# define KWIML_INT_PRIXPTR PRIXPTR +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_PRIXPTR KWIML_INT_PRIX32 +# elif !defined(KWIML_INT_NO_UINT64_T) +# define KWIML_INT_PRIXPTR KWIML_INT_PRIX64 +# endif +#endif + +#undef KWIML_INT_private_NO_SCN64 +#undef KWIML_INT_private_NO_SCN8 + +#endif /* KWIML_INT_private_DO_DEFINE */ + +/*--------------------------------------------------------------------------*/ +#ifdef KWIML_INT_private_DO_VERIFY +#undef KWIML_INT_private_DO_VERIFY + +#if defined(_MSC_VER) +# pragma warning (push) +# pragma warning (disable:4310) /* cast truncates constant value */ +#endif + +#define KWIML_INT_private_VERIFY(n, x, y) KWIML_INT_private_VERIFY_0(KWIML_INT_private_VERSION, n, x, y) +#define KWIML_INT_private_VERIFY_0(V, n, x, y) KWIML_INT_private_VERIFY_1(V, n, x, y) +#define KWIML_INT_private_VERIFY_1(V, n, x, y) extern int (*n##_v##V)[x]; extern int (*n##_v##V)[y] + +#define KWIML_INT_private_VERIFY_BOOL(m, b) KWIML_INT_private_VERIFY(KWIML_INT_detail_VERIFY_##m, 2, (b)?2:3) +#define KWIML_INT_private_VERIFY_TYPE(t, s) KWIML_INT_private_VERIFY(KWIML_INT_detail_VERIFY_##t, s, sizeof(t)) +#define KWIML_INT_private_VERIFY_SIGN(t, u, o) KWIML_INT_private_VERIFY_BOOL(SIGN_##t, (t)((u)1 << ((sizeof(t)<<3)-1)) o 0) + +KWIML_INT_private_VERIFY_TYPE(KWIML_INT_int8_t, 1); +KWIML_INT_private_VERIFY_TYPE(KWIML_INT_uint8_t, 1); +KWIML_INT_private_VERIFY_TYPE(KWIML_INT_int16_t, 2); +KWIML_INT_private_VERIFY_TYPE(KWIML_INT_uint16_t, 2); +KWIML_INT_private_VERIFY_TYPE(KWIML_INT_int32_t, 4); +KWIML_INT_private_VERIFY_TYPE(KWIML_INT_uint32_t, 4); +#if !defined(KWIML_INT_NO_INT64_T) +KWIML_INT_private_VERIFY_TYPE(KWIML_INT_int64_t, 8); +#endif +#if !defined(KWIML_INT_NO_UINT64_T) +KWIML_INT_private_VERIFY_TYPE(KWIML_INT_uint64_t, 8); +#endif +#if !defined(KWIML_INT_NO_INTPTR_T) +KWIML_INT_private_VERIFY_TYPE(KWIML_INT_intptr_t, sizeof(void*)); +#endif +#if !defined(KWIML_INT_NO_UINTPTR_T) +KWIML_INT_private_VERIFY_TYPE(KWIML_INT_uintptr_t, sizeof(void*)); +#endif + +KWIML_INT_private_VERIFY_SIGN(KWIML_INT_int8_t, KWIML_INT_uint8_t, <); +KWIML_INT_private_VERIFY_SIGN(KWIML_INT_uint8_t, KWIML_INT_uint8_t, >); +KWIML_INT_private_VERIFY_SIGN(KWIML_INT_int16_t, KWIML_INT_uint16_t, <); +KWIML_INT_private_VERIFY_SIGN(KWIML_INT_uint16_t, KWIML_INT_uint16_t, >); +KWIML_INT_private_VERIFY_SIGN(KWIML_INT_int32_t, KWIML_INT_uint32_t, <); +KWIML_INT_private_VERIFY_SIGN(KWIML_INT_uint32_t, KWIML_INT_uint32_t, >); +#if !defined(KWIML_INT_NO_INT64_T) +KWIML_INT_private_VERIFY_SIGN(KWIML_INT_int64_t, KWIML_INT_uint64_t, <); +#endif +#if !defined(KWIML_INT_NO_UINT64_T) +KWIML_INT_private_VERIFY_SIGN(KWIML_INT_uint64_t, KWIML_INT_uint64_t, >); +#endif +#if !defined(KWIML_INT_NO_INTPTR_T) +KWIML_INT_private_VERIFY_SIGN(KWIML_INT_intptr_t, KWIML_INT_uintptr_t, <); +#endif +#if !defined(KWIML_INT_NO_UINTPTR_T) +KWIML_INT_private_VERIFY_SIGN(KWIML_INT_uintptr_t, KWIML_INT_uintptr_t, >); +#endif + +#undef KWIML_INT_private_VERIFY_SIGN +#undef KWIML_INT_private_VERIFY_TYPE +#undef KWIML_INT_private_VERIFY_BOOL + +#undef KWIML_INT_private_VERIFY_1 +#undef KWIML_INT_private_VERIFY_0 +#undef KWIML_INT_private_VERIFY + +#if defined(_MSC_VER) +# pragma warning (pop) +#endif + +#endif /* KWIML_INT_private_DO_VERIFY */ + +#undef KWIML_INT_private_VERSION diff --git a/Utilities/KWIML/src/kwiml-config.cmake.in b/Utilities/KWIML/src/kwiml-config.cmake.in new file mode 100644 index 000000000..124f0fc55 --- /dev/null +++ b/Utilities/KWIML/src/kwiml-config.cmake.in @@ -0,0 +1 @@ +include(${CMAKE_CURRENT_LIST_DIR}/kwiml-targets.cmake) diff --git a/Utilities/KWIML/src/version.h.in b/Utilities/KWIML/src/version.h.in new file mode 100644 index 000000000..e58e0dce3 --- /dev/null +++ b/Utilities/KWIML/src/version.h.in @@ -0,0 +1,59 @@ +/*============================================================================ + Kitware Information Macro Library + Copyright 2010-2015 Kitware, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Kitware, Inc. nor the names of its contributors + may be used to endorse or promote products derived from this + software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +============================================================================*/ +#ifndef KWIML_VERSION_H +#define KWIML_VERSION_H +/* +This header defines macros with information about this version of KWIML. + +An includer may test the following macros after inclusion: + + KWIML_VERSION = KWIML version number encoded in an integer as + `printf("%d%03d%03d", MAJOR, MINOR, PATCH)`. + MAJOR is incremented on incompatible changes. + MINOR is incremented on interface additions. + PATCH is incremented on implementation updates. + + KWIML_VERSION_STRING = KWIML version number in string formatted as + `printf("%d.%d.%d", MAJOR, MINOR PATCH)`. + + KWIML_VERSION_HAS_ABI_H = header 'kwiml/abi.h' is available + KWIML_VERSION_HAS_INT_H = header 'kwiml/int.h' is available +*/ + +#define KWIML_VERSION @KWIML_VERSION_DECIMAL@ +#define KWIML_VERSION_STRING "@KWIML_VERSION@" + +#define KWIML_VERSION_HAS_ABI_H 1 +#define KWIML_VERSION_HAS_INT_H 1 + +#endif diff --git a/Utilities/KWIML/test/CMakeLists.txt b/Utilities/KWIML/test/CMakeLists.txt index a16b5cdda..4f6f37b4f 100644 --- a/Utilities/KWIML/test/CMakeLists.txt +++ b/Utilities/KWIML/test/CMakeLists.txt @@ -1,22 +1,11 @@ -#============================================================================= -# Kitware Information Macro Library -# Copyright 2010-2011 Kitware, Inc. # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. +# Copyright Kitware, Inc. +# Distributed under the OSI-approved BSD 3-Clause 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. -#============================================================================= - -set(test_defs KWIML_NAMESPACE=${KWIML}) - -# Tell CMake how to follow dependencies of sources in this directory. -set_property(DIRECTORY - PROPERTY IMPLICIT_DEPENDS_INCLUDE_TRANSFORM - "KWIML_HEADER(%)=<${KWIML}/%>" - ) +if(NOT KWIML_TEST_PREFIX) + set(KWIML_TEST_PREFIX kwiml) +endif() # Suppress printf/scanf format warnings; we test if the sizes match. foreach(lang C CXX) @@ -33,38 +22,33 @@ endif() if(KWIML_LANGUAGE_C) list(APPEND test_defs KWIML_LANGUAGE_C) list(APPEND test_srcs - test_ABI_C.c - test_INT_C.c + test_abi_C.c + test_int_C.c test_include_C.c ) endif() if(KWIML_LANGUAGE_CXX) list(APPEND test_defs KWIML_LANGUAGE_CXX) list(APPEND test_srcs - test_ABI_CXX.cxx - test_INT_CXX.cxx + test_abi_CXX.cxx + test_int_CXX.cxx test_include_CXX.cxx ) endif() -foreach(th test_ABI_endian test_INT_format) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${th}.h.in - ${CMAKE_CURRENT_BINARY_DIR}/${th}.h @ONLY) -endforeach() -include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) -add_executable(${KWIML}_test ${test_srcs}) -set_property(TARGET ${KWIML}_test PROPERTY COMPILE_DEFINITIONS ${test_defs}) -set_property(TARGET ${KWIML}_test PROPERTY +add_executable(kwiml_test ${test_srcs}) +set_property(TARGET kwiml_test PROPERTY COMPILE_DEFINITIONS ${test_defs}) +set_property(TARGET kwiml_test PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) -add_test(${KWIML}.test ${CMAKE_CURRENT_BINARY_DIR}/${KWIML}_test) -set_property(TEST ${KWIML}.test PROPERTY LABELS ${KWIML_LABELS_TEST}) +add_test(NAME ${KWIML_TEST_PREFIX}.test COMMAND kwiml_test) +set_property(TEST ${KWIML_TEST_PREFIX}.test PROPERTY LABELS ${KWIML_TEST_LABELS}) # Xcode 2.x forgets to create the output directory before linking # the individual architectures. if(CMAKE_OSX_ARCHITECTURES AND XCODE AND NOT "${XCODE_VERSION}" MATCHES "^[^12]") add_custom_command( - TARGET ${KWIML}_test + TARGET kwiml_test PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}" ) endif() diff --git a/Utilities/KWIML/test/test.c b/Utilities/KWIML/test/test.c index 131c81f92..5f5b5d776 100644 --- a/Utilities/KWIML/test/test.c +++ b/Utilities/KWIML/test/test.c @@ -1,21 +1,15 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ #ifdef __cplusplus extern "C" { #endif -extern int test_ABI_C(void); -extern int test_INT_C(void); -extern int test_ABI_CXX(void); -extern int test_INT_CXX(void); +extern int test_abi_C(void); +extern int test_int_C(void); +extern int test_abi_CXX(void); +extern int test_int_CXX(void); extern int test_include_C(void); extern int test_include_CXX(void); #ifdef __cplusplus @@ -26,13 +20,13 @@ int main(void) { int result = 1; #ifdef KWIML_LANGUAGE_C - result = test_ABI_C() && result; - result = test_INT_C() && result; + result = test_abi_C() && result; + result = test_int_C() && result; result = test_include_C() && result; #endif #ifdef KWIML_LANGUAGE_CXX - result = test_ABI_CXX() && result; - result = test_INT_CXX() && result; + result = test_abi_CXX() && result; + result = test_int_CXX() && result; result = test_include_CXX() && result; #endif return result? 0 : 1; diff --git a/Utilities/KWIML/test/test.cxx b/Utilities/KWIML/test/test.cxx index bf614218a..464325ba4 100644 --- a/Utilities/KWIML/test/test.cxx +++ b/Utilities/KWIML/test/test.cxx @@ -1,12 +1,6 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ #include "test.c" diff --git a/Utilities/KWIML/test/test.h b/Utilities/KWIML/test/test.h index b87a0e7e9..44add3faf 100644 --- a/Utilities/KWIML/test/test.h +++ b/Utilities/KWIML/test/test.h @@ -1,32 +1,11 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#ifndef KWIML_NAMESPACE -# error "Do not include test.h outside of KWIML test files." -#endif - +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ #ifndef KWIML_TEST_H #define KWIML_TEST_H -/* - Define KWIML_HEADER macro to help the test files include kwiml - headers from the configured namespace directory. The macro can be - used like this: - - #include KWIML_HEADER(ABI.h) -*/ -#define KWIML_HEADER(x) KWIML_HEADER0(KWIML_NAMESPACE/x) -#define KWIML_HEADER0(x) KWIML_HEADER1(x) -#define KWIML_HEADER1(x) - /* Quiet MS standard library deprecation warnings. */ #ifndef _CRT_SECURE_NO_DEPRECATE # define _CRT_SECURE_NO_DEPRECATE diff --git a/Utilities/KWIML/test/test_ABI_C.c b/Utilities/KWIML/test/test_ABI_C.c deleted file mode 100644 index 3ca4ad390..000000000 --- a/Utilities/KWIML/test/test_ABI_C.c +++ /dev/null @@ -1,22 +0,0 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include "test.h" -#include KWIML_HEADER(ABI.h) -#include "test_ABI_endian.h" -int test_ABI_C(void) -{ - if(!test_ABI_endian()) - { - return 0; - } - return 1; -} diff --git a/Utilities/KWIML/test/test_ABI_CXX.cxx b/Utilities/KWIML/test/test_ABI_CXX.cxx deleted file mode 100644 index 7ede20e09..000000000 --- a/Utilities/KWIML/test/test_ABI_CXX.cxx +++ /dev/null @@ -1,22 +0,0 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include "test.h" -#include KWIML_HEADER(ABI.h) -#include "test_ABI_endian.h" -extern "C" int test_ABI_CXX(void) -{ - if(!test_ABI_endian()) - { - return 0; - } - return 1; -} diff --git a/Utilities/KWIML/test/test_ABI_endian.h.in b/Utilities/KWIML/test/test_ABI_endian.h.in deleted file mode 100644 index 992baeaeb..000000000 --- a/Utilities/KWIML/test/test_ABI_endian.h.in +++ /dev/null @@ -1,47 +0,0 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include - -#ifdef __cplusplus -# define LANG "C++ " -#else -# define LANG "C " -#endif - -static int test_ABI_endian(void) -{ - int result = 1; - { -#if defined(@KWIML@_ABI_ENDIAN_ID) - int expect; - union { short s; unsigned char c[sizeof(short)]; } x; - x.s = 1; - expect = (x.c[0] == 1 ? - @KWIML@_ABI_ENDIAN_ID_LITTLE : @KWIML@_ABI_ENDIAN_ID_BIG); - printf(LANG "@KWIML@_ABI_ENDIAN_ID: expected [%d], got [%d]", - expect, @KWIML@_ABI_ENDIAN_ID); - if(@KWIML@_ABI_ENDIAN_ID == expect) - { - printf(", PASSED\n"); - } - else - { - printf(", FAILED\n"); - result = 0; - } -#else - printf(LANG "@KWIML@_ABI_ENDIAN_ID: unknown, FAILED\n"); - result = 0; -#endif - } - return result; -} diff --git a/Utilities/KWIML/test/test_INT_CXX.cxx b/Utilities/KWIML/test/test_INT_CXX.cxx deleted file mode 100644 index 9f74e9680..000000000 --- a/Utilities/KWIML/test/test_INT_CXX.cxx +++ /dev/null @@ -1,22 +0,0 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include "test.h" -#include KWIML_HEADER(INT.h) -#include "test_INT_format.h" -extern "C" int test_INT_CXX(void) -{ - if(!test_INT_format()) - { - return 0; - } - return 1; -} diff --git a/Utilities/KWIML/test/test_abi_C.c b/Utilities/KWIML/test/test_abi_C.c new file mode 100644 index 000000000..18b639f4a --- /dev/null +++ b/Utilities/KWIML/test/test_abi_C.c @@ -0,0 +1,19 @@ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ +#include "test.h" +#include "../include/kwiml/abi.h" +#include "test_abi_endian.h" +#ifndef KWIML_ABI_VERSION +# error "KWIML_ABI_VERSION not defined!" +#endif +int test_abi_C(void) +{ + if(!test_abi_endian()) + { + return 0; + } + return 1; +} diff --git a/Utilities/KWIML/test/test_abi_CXX.cxx b/Utilities/KWIML/test/test_abi_CXX.cxx new file mode 100644 index 000000000..e8feb44d2 --- /dev/null +++ b/Utilities/KWIML/test/test_abi_CXX.cxx @@ -0,0 +1,19 @@ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ +#include "test.h" +#include "../include/kwiml/abi.h" +#include "test_abi_endian.h" +#ifndef KWIML_ABI_VERSION +# error "KWIML_ABI_VERSION not defined!" +#endif +extern "C" int test_abi_CXX(void) +{ + if(!test_abi_endian()) + { + return 0; + } + return 1; +} diff --git a/Utilities/KWIML/test/test_abi_endian.h b/Utilities/KWIML/test/test_abi_endian.h new file mode 100644 index 000000000..334b018a1 --- /dev/null +++ b/Utilities/KWIML/test/test_abi_endian.h @@ -0,0 +1,41 @@ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ +#include + +#ifdef __cplusplus +# define LANG "C++ " +#else +# define LANG "C " +#endif + +static int test_abi_endian(void) +{ + int result = 1; + { +#if defined(KWIML_ABI_ENDIAN_ID) + int expect; + union { short s; unsigned char c[sizeof(short)]; } x; + x.s = 1; + expect = (x.c[0] == 1 ? + KWIML_ABI_ENDIAN_ID_LITTLE : KWIML_ABI_ENDIAN_ID_BIG); + printf(LANG "KWIML_ABI_ENDIAN_ID: expected [%d], got [%d]", + expect, KWIML_ABI_ENDIAN_ID); + if(KWIML_ABI_ENDIAN_ID == expect) + { + printf(", PASSED\n"); + } + else + { + printf(", FAILED\n"); + result = 0; + } +#else + printf(LANG "KWIML_ABI_ENDIAN_ID: unknown, FAILED\n"); + result = 0; +#endif + } + return result; +} diff --git a/Utilities/KWIML/test/test_include_C.c b/Utilities/KWIML/test/test_include_C.c index fb3e4cf7f..518544d25 100644 --- a/Utilities/KWIML/test/test_include_C.c +++ b/Utilities/KWIML/test/test_include_C.c @@ -1,20 +1,14 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ #include /* Test KWIML header inclusion after above system headers. */ #include "test.h" -#include KWIML_HEADER(ABI.h) -#include KWIML_HEADER(INT.h) +#include "../include/kwiml/abi.h" +#include "../include/kwiml/int.h" int test_include_C(void) { diff --git a/Utilities/KWIML/test/test_include_CXX.cxx b/Utilities/KWIML/test/test_include_CXX.cxx index 111311a84..82aa54616 100644 --- a/Utilities/KWIML/test/test_include_CXX.cxx +++ b/Utilities/KWIML/test/test_include_CXX.cxx @@ -1,14 +1,8 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ #include #if defined(_MSC_VER) && defined(NDEBUG) @@ -19,8 +13,8 @@ std::string test_include_CXX_use_stl_string; /* Test KWIML header inclusion after above system headers. */ #include "test.h" -#include KWIML_HEADER(ABI.h) -#include KWIML_HEADER(INT.h) +#include "../include/kwiml/abi.h" +#include "../include/kwiml/int.h" extern "C" int test_include_CXX(void) { diff --git a/Utilities/KWIML/test/test_int_C.c b/Utilities/KWIML/test/test_int_C.c new file mode 100644 index 000000000..fe8ee8e3c --- /dev/null +++ b/Utilities/KWIML/test/test_int_C.c @@ -0,0 +1,19 @@ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ +#include "test.h" +#include "../include/kwiml/int.h" +#include "test_int_format.h" +#ifndef KWIML_INT_VERSION +# error "KWIML_INT_VERSION not defined!" +#endif +int test_int_C(void) +{ + if(!test_int_format()) + { + return 0; + } + return 1; +} diff --git a/Utilities/KWIML/test/test_int_CXX.cxx b/Utilities/KWIML/test/test_int_CXX.cxx new file mode 100644 index 000000000..ffa4c9b08 --- /dev/null +++ b/Utilities/KWIML/test/test_int_CXX.cxx @@ -0,0 +1,19 @@ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ +#include "test.h" +#include "../include/kwiml/int.h" +#include "test_int_format.h" +#ifndef KWIML_INT_VERSION +# error "KWIML_INT_VERSION not defined!" +#endif +extern "C" int test_int_CXX(void) +{ + if(!test_int_format()) + { + return 0; + } + return 1; +} diff --git a/Utilities/KWIML/test/test_INT_format.h.in b/Utilities/KWIML/test/test_int_format.h similarity index 78% rename from Utilities/KWIML/test/test_INT_format.h.in rename to Utilities/KWIML/test/test_int_format.h index 71b443d6e..24dcdfba6 100644 --- a/Utilities/KWIML/test/test_INT_format.h.in +++ b/Utilities/KWIML/test/test_int_format.h @@ -1,17 +1,16 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ #include #include +#if defined(_MSC_VER) +# pragma warning (push) +# pragma warning (disable:4310) /* cast truncates constant value */ +#endif + #ifdef __cplusplus # define LANG "C++ " #else @@ -25,8 +24,8 @@ T const x = VALUE(T, U); \ T y = C(V); \ printf(LANG #C ":" \ - " expression [%" @KWIML@_INT_PRI##PRI "]," \ - " literal [%" @KWIML@_INT_PRI##PRI "]", x, y); \ + " expression [%" KWIML_INT_PRI##PRI "]," \ + " literal [%" KWIML_INT_PRI##PRI "]", x, y); \ if(x == y) \ { \ printf(", PASSED\n"); \ @@ -42,8 +41,8 @@ { \ T const x = VALUE(T, U); \ char const* str = STR; \ - sprintf(buf, "%" @KWIML@_INT_PRI##PRI, x); \ - printf(LANG "@KWIML@_INT_PRI" #PRI ":" \ + sprintf(buf, "%" KWIML_INT_PRI##PRI, x); \ + printf(LANG "KWIML_INT_PRI" #PRI ":" \ " expected [%s], got [%s]", str, buf); \ if(strcmp(str, buf) == 0) \ { \ @@ -62,13 +61,13 @@ T const x = VALUE(T, U); \ T y; \ char const* str = STR; \ - if(sscanf(str, "%" @KWIML@_INT_SCN##SCN, &y) != 1) \ + if(sscanf(str, "%" KWIML_INT_SCN##SCN, &y) != 1) \ { \ y = 0; \ } \ - printf(LANG "@KWIML@_INT_SCN" #SCN ":" \ - " expected [%" @KWIML@_INT_PRI##PRI "]," \ - " got [%" @KWIML@_INT_PRI##PRI "]", x, y); \ + printf(LANG "KWIML_INT_SCN" #SCN ":" \ + " expected [%" KWIML_INT_PRI##PRI "]," \ + " got [%" KWIML_INT_PRI##PRI "]", x, y); \ if(x == y) \ { \ printf(", PASSED\n"); \ @@ -87,41 +86,41 @@ /* Concatenate T and U now to avoid expanding them. */ #define TEST(FMT, T, U, STR) \ - TEST_(FMT, @KWIML@_INT_##T, @KWIML@_INT_##U, STR) + TEST_(FMT, KWIML_INT_##T, KWIML_INT_##U, STR) #define TEST2(PRI, SCN, T, U, STR) \ - TEST2_(PRI, SCN, @KWIML@_INT_##T, @KWIML@_INT_##U, STR) + TEST2_(PRI, SCN, KWIML_INT_##T, KWIML_INT_##U, STR) #define TEST_C(C, V, PRI, T, U) \ - TEST_C_(@KWIML@_INT_##C, V, PRI, @KWIML@_INT_##T, @KWIML@_INT_##U) + TEST_C_(KWIML_INT_##C, V, PRI, KWIML_INT_##T, KWIML_INT_##U) #define TEST_PRI(PRI, T, U, STR) \ - TEST_PRI_(PRI, @KWIML@_INT_##T, @KWIML@_INT_##U, STR) + TEST_PRI_(PRI, KWIML_INT_##T, KWIML_INT_##U, STR) #define TEST_SCN(SCN, T, U, STR) \ - TEST_SCN_(SCN, @KWIML@_INT_##T, @KWIML@_INT_##U, STR) + TEST_SCN_(SCN, KWIML_INT_##T, KWIML_INT_##U, STR) #define TEST_SCN2(PRI, SCN, T, U, STR) \ - TEST_SCN2_(PRI, SCN, @KWIML@_INT_##T, @KWIML@_INT_##U, STR) + TEST_SCN2_(PRI, SCN, KWIML_INT_##T, KWIML_INT_##U, STR) -static int test_INT_format(void) +static int test_int_format(void) { int result = 1; char buf[256]; TEST_PRI(i8, int8_t, uint8_t, "-85") -#if defined(@KWIML@_INT_SCNi8) +#if defined(KWIML_INT_SCNi8) TEST_SCN(i8, int8_t, uint8_t, "-85") #endif TEST_PRI(d8, int8_t, uint8_t, "-85") -#if defined(@KWIML@_INT_SCNd8) +#if defined(KWIML_INT_SCNd8) TEST_SCN(d8, int8_t, uint8_t, "-85") #endif TEST_PRI(o8, uint8_t, uint8_t, "253") -#if defined(@KWIML@_INT_SCNo8) +#if defined(KWIML_INT_SCNo8) TEST_SCN(o8, uint8_t, uint8_t, "253") #endif TEST_PRI(u8, uint8_t, uint8_t, "171") -#if defined(@KWIML@_INT_SCNu8) +#if defined(KWIML_INT_SCNu8) TEST_SCN(u8, uint8_t, uint8_t, "171") #endif TEST_PRI(x8, uint8_t, uint8_t, "ab") TEST_PRI(X8, uint8_t, uint8_t, "AB") -#if defined(@KWIML@_INT_SCNx8) +#if defined(KWIML_INT_SCNx8) TEST_SCN(x8, uint8_t, uint8_t, "ab") TEST_SCN2(X8, x8, uint8_t, uint8_t, "AB") #endif @@ -141,30 +140,30 @@ static int test_INT_format(void) TEST2(X32, x32, uint32_t, uint32_t, "AB000000") TEST_PRI(i64, int64_t, uint64_t, "-6124895493223874560") -#if defined(@KWIML@_INT_SCNi64) +#if defined(KWIML_INT_SCNi64) TEST_SCN(i64, int64_t, uint64_t, "-6124895493223874560") #endif TEST_PRI(d64, int64_t, uint64_t, "-6124895493223874560") -#if defined(@KWIML@_INT_SCNd64) +#if defined(KWIML_INT_SCNd64) TEST_SCN(d64, int64_t, uint64_t, "-6124895493223874560") #endif TEST_PRI(o64, uint64_t, uint64_t, "1254000000000000000000") -#if defined(@KWIML@_INT_SCNo64) +#if defined(KWIML_INT_SCNo64) TEST_SCN(o64, uint64_t, uint64_t, "1254000000000000000000") #endif TEST_PRI(u64, uint64_t, uint64_t, "12321848580485677056") -#if defined(@KWIML@_INT_SCNu64) +#if defined(KWIML_INT_SCNu64) TEST_SCN(u64, uint64_t, uint64_t, "12321848580485677056") #endif TEST_PRI(x64, uint64_t, uint64_t, "ab00000000000000") TEST_PRI(X64, uint64_t, uint64_t, "AB00000000000000") -#if defined(@KWIML@_INT_SCNx64) +#if defined(KWIML_INT_SCNx64) TEST_SCN(x64, uint64_t, uint64_t, "ab00000000000000") TEST_SCN2(X64, x64, uint64_t, uint64_t, "AB00000000000000") #endif -#if !defined(@KWIML@_INT_NO_INTPTR_T) -# if @KWIML@_ABI_SIZEOF_DATA_PTR == 4 +#if !defined(KWIML_INT_NO_INTPTR_T) +# if KWIML_ABI_SIZEOF_DATA_PTR == 4 TEST(iPTR, intptr_t, uint32_t, "-1426063360") TEST(dPTR, intptr_t, uint32_t, "-1426063360") # else @@ -173,8 +172,8 @@ static int test_INT_format(void) # endif #endif -#if !defined(@KWIML@_INT_NO_UINTPTR_T) -# if @KWIML@_ABI_SIZEOF_DATA_PTR == 4 +#if !defined(KWIML_INT_NO_UINTPTR_T) +# if KWIML_ABI_SIZEOF_DATA_PTR == 4 TEST(oPTR, uintptr_t, uintptr_t, "25300000000") TEST(uPTR, uintptr_t, uintptr_t, "2868903936") TEST(xPTR, uintptr_t, uintptr_t, "ab000000") @@ -198,3 +197,7 @@ static int test_INT_format(void) return result; } + +#if defined(_MSC_VER) +# pragma warning (pop) +#endif diff --git a/Utilities/Release/WiX/CMakeLists.txt b/Utilities/Release/WiX/CMakeLists.txt new file mode 100644 index 000000000..cc0dbe1a6 --- /dev/null +++ b/Utilities/Release/WiX/CMakeLists.txt @@ -0,0 +1,12 @@ +add_subdirectory(CustomAction) + +if(CMAKE_CONFIGURATION_TYPES) + set(CUSTOM_ACTION_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/custom_action_dll-$.wxs") +else() + set(CUSTOM_ACTION_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/custom_action_dll.wxs") +endif() + +file(GENERATE + OUTPUT "${CUSTOM_ACTION_OUTPUT}" + INPUT "${CMAKE_CURRENT_SOURCE_DIR}/custom_action_dll.wxs.in" + ) diff --git a/Utilities/Release/WiX/CustomAction/CMakeLists.txt b/Utilities/Release/WiX/CustomAction/CMakeLists.txt new file mode 100644 index 000000000..7efd01e00 --- /dev/null +++ b/Utilities/Release/WiX/CustomAction/CMakeLists.txt @@ -0,0 +1,13 @@ +foreach(CONFIG DEBUG MINSIZEREL RELEASE RELWITHDEBINFO) + string(REPLACE "/MD" "/MT" + "CMAKE_CXX_FLAGS_${CONFIG}" + "${CMAKE_CXX_FLAGS_${CONFIG}}" + ) +endforeach() + +add_library(CMakeWiXCustomActions MODULE + detect_nsis_overwrite.cpp + exports.def +) + +target_link_libraries(CMakeWiXCustomActions PRIVATE msi) diff --git a/Utilities/Release/WiX/CustomAction/detect_nsis_overwrite.cpp b/Utilities/Release/WiX/CustomAction/detect_nsis_overwrite.cpp new file mode 100644 index 000000000..dad1ae511 --- /dev/null +++ b/Utilities/Release/WiX/CustomAction/detect_nsis_overwrite.cpp @@ -0,0 +1,45 @@ +#include +#include +#include + +#include +#include + +std::wstring get_property(MSIHANDLE msi_handle, std::wstring const& name) +{ + DWORD size = 0; + + UINT status = MsiGetPropertyW(msi_handle, name.c_str(), L"", &size); + + if(status == ERROR_MORE_DATA) + { + std::vector buffer(size + 1); + MsiGetPropertyW(msi_handle, name.c_str(), &buffer[0], &size); + return std::wstring(&buffer[0]); + } + else + { + return std::wstring(); + } +} + +void set_property(MSIHANDLE msi_handle, + std::wstring const& name, std::wstring const& value) +{ + MsiSetPropertyW(msi_handle, name.c_str(), value.c_str()); +} + +extern "C" UINT __stdcall DetectNsisOverwrite(MSIHANDLE msi_handle) +{ + std::wstring install_root = get_property(msi_handle, L"INSTALL_ROOT"); + + std::wstring uninstall_exe = install_root + L"\\uninstall.exe"; + + bool uninstall_exe_exists = + GetFileAttributesW(uninstall_exe.c_str()) != INVALID_FILE_ATTRIBUTES; + + set_property(msi_handle, L"CMAKE_NSIS_OVERWRITE_DETECTED", + uninstall_exe_exists ? L"1" : L"0"); + + return ERROR_SUCCESS; +} diff --git a/Utilities/Release/WiX/CustomAction/exports.def b/Utilities/Release/WiX/CustomAction/exports.def new file mode 100644 index 000000000..0e448b20e --- /dev/null +++ b/Utilities/Release/WiX/CustomAction/exports.def @@ -0,0 +1,2 @@ +EXPORTS + DetectNsisOverwrite=DetectNsisOverwrite diff --git a/Utilities/Release/WiX/WIX.template.in b/Utilities/Release/WiX/WIX.template.in new file mode 100644 index 000000000..094999f1d --- /dev/null +++ b/Utilities/Release/WiX/WIX.template.in @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + ProductIcon.ico + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/Release/WiX/cmake_extra_dialog.wxs b/Utilities/Release/WiX/cmake_extra_dialog.wxs new file mode 100644 index 000000000..0ee3d99e7 --- /dev/null +++ b/Utilities/Release/WiX/cmake_extra_dialog.wxs @@ -0,0 +1,36 @@ + + + + + + + + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/Release/WiX/cmake_nsis_overwrite_dialog.wxs b/Utilities/Release/WiX/cmake_nsis_overwrite_dialog.wxs new file mode 100644 index 000000000..8fe60f2cd --- /dev/null +++ b/Utilities/Release/WiX/cmake_nsis_overwrite_dialog.wxs @@ -0,0 +1,21 @@ + + + + + + 1 + + + + Uninstall.exe was detected in your chosen installation prefix. + This indicates a conflicting NSIS based installation of CMake. + + Please uninstall your old CMake installation or choose a different + installation directory. + + + + + + + diff --git a/Utilities/Release/WiX/custom_action_dll.wxs.in b/Utilities/Release/WiX/custom_action_dll.wxs.in new file mode 100644 index 000000000..021e63c5f --- /dev/null +++ b/Utilities/Release/WiX/custom_action_dll.wxs.in @@ -0,0 +1,6 @@ + + + + + diff --git a/Utilities/Release/WiX/install_dir.wxs b/Utilities/Release/WiX/install_dir.wxs new file mode 100644 index 000000000..49b74e37d --- /dev/null +++ b/Utilities/Release/WiX/install_dir.wxs @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + "1"]]> + + 1 + + NOT Installed + Installed AND PATCH + + 1 + LicenseAccepted = "1" + + 1 + 1 + NOT WIXUI_DONTVALIDATEPATH + "1"]]> + + 1 + CMAKE_NSIS_OVERWRITE_DETECTED="1" + + 1]]> + 1 + 1 + + 1 + 1 + + NOT Installed + Installed AND NOT PATCH + Installed AND PATCH + + 1 + + 1 + 1 + 1 + + + + + + + + + + + diff --git a/Utilities/Release/WiX/patch_desktop_shortcut.xml b/Utilities/Release/WiX/patch_desktop_shortcut.xml new file mode 100644 index 000000000..d30705dd1 --- /dev/null +++ b/Utilities/Release/WiX/patch_desktop_shortcut.xml @@ -0,0 +1,5 @@ + + + DESKTOP_SHORTCUT_REQUESTED = 1 + + diff --git a/Utilities/Release/WiX/patch_path_env.xml b/Utilities/Release/WiX/patch_path_env.xml new file mode 100644 index 000000000..0e335c4d5 --- /dev/null +++ b/Utilities/Release/WiX/patch_path_env.xml @@ -0,0 +1,26 @@ + + + + + ADD_CMAKE_TO_PATH = "System" + + + + + + + ADD_CMAKE_TO_PATH = "User" + + + + + + + + + + diff --git a/Utilities/Release/cpack_wix_ui_banner.jpg b/Utilities/Release/WiX/ui_banner.jpg similarity index 100% rename from Utilities/Release/cpack_wix_ui_banner.jpg rename to Utilities/Release/WiX/ui_banner.jpg diff --git a/Utilities/Release/cpack_wix_ui_dialog.jpg b/Utilities/Release/WiX/ui_dialog.jpg similarity index 100% rename from Utilities/Release/cpack_wix_ui_dialog.jpg rename to Utilities/Release/WiX/ui_dialog.jpg diff --git a/Utilities/Release/create-cmake-release.cmake b/Utilities/Release/create-cmake-release.cmake index 76057d122..d41c4ecbc 100644 --- a/Utilities/Release/create-cmake-release.cmake +++ b/Utilities/Release/create-cmake-release.cmake @@ -6,7 +6,7 @@ endif() file(MAKE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/logs) set(RELEASE_SCRIPTS_BATCH_1 - dash2win64_release.cmake # Windows + dash3win7_release.cmake # Windows dashmacmini5_release.cmake # OS X x86_64 magrathea_release.cmake # Linux linux64_release.cmake # Linux x86_64 diff --git a/Utilities/Release/dash2win64_release.cmake b/Utilities/Release/dash3win7_release.cmake similarity index 61% rename from Utilities/Release/dash2win64_release.cmake rename to Utilities/Release/dash3win7_release.cmake index ecfd7c55a..f25d63897 100644 --- a/Utilities/Release/dash2win64_release.cmake +++ b/Utilities/Release/dash3win7_release.cmake @@ -1,23 +1,28 @@ -set(CMAKE_RELEASE_DIRECTORY "c:/cygwin/home/dashboard/CMakeReleaseDirectory") +set(CMAKE_RELEASE_DIRECTORY "c:/msys64/home/dashboard/CMakeReleaseDirectory") set(CONFIGURE_WITH_CMAKE TRUE) set(CMAKE_CONFIGURE_PATH "c:/Program\\ Files\\ \\(x86\\)/CMake/bin/cmake.exe") set(PROCESSORS 8) -set(HOST dash2win64) -set(CPACK_BINARY_GENERATORS "NSIS ZIP") +set(HOST dash3win7) +set(RUN_LAUNCHER ~/rel/run) +set(CPACK_BINARY_GENERATORS "WIX ZIP") set(CPACK_SOURCE_GENERATORS "ZIP") -set(MAKE_PROGRAM "make") +set(MAKE_PROGRAM "ninja") set(MAKE "${MAKE_PROGRAM} -j8") set(INITIAL_CACHE "CMAKE_BUILD_TYPE:STRING=Release CMAKE_DOC_DIR:STRING=doc/cmake CMAKE_USE_OPENSSL:BOOL=OFF CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE CMAKE_Fortran_COMPILER:FILEPATH=FALSE -CMAKE_GENERATOR:INTERNAL=Unix Makefiles +CMAKE_GENERATOR:INTERNAL=Ninja BUILD_QtDialog:BOOL:=TRUE CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:BOOL=TRUE CMake_INSTALL_DEPENDENCIES:BOOL=ON -QT_QMAKE_EXECUTABLE:FILEPATH=c:/Dashboards/Support/qt-build/Qt/bin/qmake.exe +CMAKE_EXE_LINKER_FLAGS:STRING=-machine:x86 -subsystem:console,5.01 ") +set(ppflags "-D_WIN32_WINNT=0x501 -D_USING_V110_SDK71_") +set(CFLAGS "${ppflags}") +set(CXXFLAGS "${ppflags}") +set(ENV ". ~/rel/env") get_filename_component(path "${CMAKE_CURRENT_LIST_FILE}" PATH) set(GIT_EXTRA "git config core.autocrlf true") include(${path}/release_cmake.cmake) diff --git a/Utilities/Release/release_cmake.cmake b/Utilities/Release/release_cmake.cmake index c50602dad..0d9c78458 100644 --- a/Utilities/Release/release_cmake.cmake +++ b/Utilities/Release/release_cmake.cmake @@ -19,6 +19,9 @@ endif() if(NOT DEFINED RUN_SHELL) set(RUN_SHELL "/bin/sh") endif() +if(NOT DEFINED RUN_LAUNCHER) + set(RUN_LAUNCHER "") +endif() if(NOT DEFINED PROCESSORS) set(PROCESSORS 1) endif() @@ -52,11 +55,11 @@ message("Creating CMake release ${CMAKE_CREATE_VERSION} on ${HOST} with parallel macro(remote_command comment command) message("${comment}") if(${ARGC} GREATER 2) - message("ssh ${HOST} ${command}") - execute_process(COMMAND ssh ${HOST} ${command} RESULT_VARIABLE result INPUT_FILE ${ARGV2}) + message("ssh ${HOST} ${RUN_LAUNCHER} ${command}") + execute_process(COMMAND ssh ${HOST} ${RUN_LAUNCHER} ${command} RESULT_VARIABLE result INPUT_FILE ${ARGV2}) else() - message("ssh ${HOST} ${command}") - execute_process(COMMAND ssh ${HOST} ${command} RESULT_VARIABLE result) + message("ssh ${HOST} ${RUN_LAUNCHER} ${command}") + execute_process(COMMAND ssh ${HOST} ${RUN_LAUNCHER} ${command} RESULT_VARIABLE result) endif() if(${result} GREATER 0) message(FATAL_ERROR "Error running command: ${command}, return value = ${result}") @@ -112,6 +115,9 @@ foreach(gen ${generators}) if("${gen}" STREQUAL "TZ") set(SUFFIXES ${SUFFIXES} "*.tar.Z") endif() + if("${gen}" STREQUAL "WIX") + set(SUFFIXES ${SUFFIXES} "*.msi") + endif() if("${gen}" STREQUAL "ZIP") set(SUFFIXES ${SUFFIXES} "*.zip") endif() @@ -120,6 +126,10 @@ foreach(gen ${generators}) endif() endforeach() +if(SUFFIXES) + list(REMOVE_DUPLICATES SUFFIXES) +endif() + if(LOCAL_DIR) file(MAKE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${LOCAL_DIR}") else() diff --git a/Utilities/Release/release_cmake.sh.in b/Utilities/Release/release_cmake.sh.in index 06e720fe1..14651297b 100755 --- a/Utilities/Release/release_cmake.sh.in +++ b/Utilities/Release/release_cmake.sh.in @@ -5,6 +5,7 @@ echo "" echo "remove and create working directory @CMAKE_RELEASE_DIRECTORY@" rm -rf @CMAKE_RELEASE_DIRECTORY@ mkdir @CMAKE_RELEASE_DIRECTORY@ +@ENV@ check_exit_value() { diff --git a/Utilities/Release/upload_release.cmake b/Utilities/Release/upload_release.cmake index 171811a99..f5e325e55 100644 --- a/Utilities/Release/upload_release.cmake +++ b/Utilities/Release/upload_release.cmake @@ -1,6 +1,6 @@ set(CTEST_RUN_CURRENT_SCRIPT 0) if(NOT VERSION) - set(VERSION 3.4) + set(VERSION 3.5) endif() if(NOT DEFINED PROJECT_PREFIX) set(PROJECT_PREFIX cmake-${VERSION}) diff --git a/Utilities/Scripts/BoostScanDeps.cmake b/Utilities/Scripts/BoostScanDeps.cmake new file mode 100644 index 000000000..1fbea4bda --- /dev/null +++ b/Utilities/Scripts/BoostScanDeps.cmake @@ -0,0 +1,217 @@ +# Scan the Boost headers and determine the library dependencies. Note +# that this script only scans one Boost version at once; invoke once +# for each Boost release. Note that this does require the headers for +# a given component to match the library name, since this computes +# inter-library dependencies. Library components for which this +# assumption does not hold true and which have dependencies on other +# Boost libraries will require special-casing. It also doesn't handle +# private dependencies not described in the headers, for static +# library dependencies--this is also a limitation of auto-linking, and +# I'm unaware of any specific instances where this would be +# problematic. +# +# Invoke in script mode, defining these variables: +# BOOST_DIR - the root of the boost includes +# +# The script will process each directory under the root as a +# "component". For each component, all the headers will be scanned to +# determine the components it depends upon by following all the +# possible includes from this component. This is to match the +# behaviour of autolinking. + +# Written by Roger Leigh + +#============================================================================= +# Copyright 2014-2015 University of Dundee +# +# 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. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# Determine header dependencies on libraries using the embedded dependency information. +# +# component - the component to check (uses all headers from boost/${component}) +# includedir - the path to the Boost headers +# _ret_libs - list of library dependencies +# +function(_Boost_FIND_COMPONENT_DEPENDENCIES component includedir _ret_libs) + # _boost_unprocessed_headers - list of headers requiring parsing + # _boost_processed_headers - headers already parsed (or currently being parsed) + # _boost_new_headers - new headers discovered for future processing + + set(library_component FALSE) + + # Start by finding all headers for the component; header + # dependencies via #include will be solved by future passes + + # Special-case since it is part of mpi; look only in boost/mpi/python* + if(component STREQUAL "mpi_python") + set(_boost_DEPS "python") + set(library_component TRUE) + file(GLOB_RECURSE _boost_unprocessed_headers + RELATIVE "${includedir}" + "${includedir}/boost/mpi/python/*") + list(INSERT _boost_unprocessed_headers 0 "${includedir}/boost/mpi/python.hpp") + # Special-case since it is a serialization variant; look in boost/serialization + elseif(component STREQUAL "wserialization") + set(library_component TRUE) + file(GLOB_RECURSE _boost_unprocessed_headers + RELATIVE "${includedir}" + "${includedir}/boost/serialization/*") + list(INSERT _boost_unprocessed_headers 0 "${includedir}/boost/serialization.hpp") + # Not really a library in its own right, but treat it as one + elseif(component STREQUAL "math") + set(library_component TRUE) + file(GLOB_RECURSE _boost_unprocessed_headers + RELATIVE "${includedir}" + "${includedir}/boost/math/*") + list(INSERT _boost_unprocessed_headers 0 "${includedir}/boost/math.hpp") + # Single test header + elseif(component STREQUAL "unit_test_framework") + set(library_component TRUE) + set(_boost_unprocessed_headers "${BOOST_DIR}/test/unit_test.hpp") + # Single test header + elseif(component STREQUAL "prg_exec_monitor") + set(library_component TRUE) + set(_boost_unprocessed_headers "${BOOST_DIR}/test/prg_exec_monitor.hpp") + # Single test header + elseif(component STREQUAL "test_exec_monitor") + set(library_component TRUE) + set(_boost_unprocessed_headers "${BOOST_DIR}/test/test_exec_monitor.hpp") + else() + # Default behaviour where header directory is the same as the library name. + file(GLOB_RECURSE _boost_unprocessed_headers + RELATIVE "${includedir}" + "${includedir}/boost/${component}/*") + list(INSERT _boost_unprocessed_headers 0 "${includedir}/boost/${component}.hpp") + endif() + + while(_boost_unprocessed_headers) + list(APPEND _boost_processed_headers ${_boost_unprocessed_headers}) + foreach(header ${_boost_unprocessed_headers}) + if(EXISTS "${includedir}/${header}") + file(STRINGS "${includedir}/${header}" _boost_header_includes REGEX "^#[ \t]*include[ \t]*][^>]*>") + # The optional whitespace before "#" is intentional + # (boost/serialization/config.hpp bug). + file(STRINGS "${includedir}/${header}" _boost_header_deps REGEX "^[ \t]*#[ \t]*define[ \t][ \t]*BOOST_LIB_NAME[ \t][ \t]*boost_") + + foreach(line ${_boost_header_includes}) + string(REGEX REPLACE "^#[ \t]*include[ \t]*<(boost/[^>][^>]*)>.*" "\\1" _boost_header_match "${line}") + list(FIND _boost_processed_headers "${_boost_header_match}" _boost_header_processed) + list(FIND _boost_new_headers "${_boost_header_match}" _boost_header_new) + if (_boost_header_processed EQUAL -1 AND _boost_header_new EQUAL -1) + list(APPEND _boost_new_headers ${_boost_header_match}) + endif() + endforeach() + + foreach(line ${_boost_header_deps}) + string(REGEX REPLACE "^[ \t]*#[ \t]*define[ \t][ \t]*BOOST_LIB_NAME[ \t][ \t]*boost_([^ \t][^ \t]*).*" "\\1" _boost_component_match "${line}") + list(FIND _boost_DEPS "${_boost_component_match}" _boost_dep_found) + if(_boost_component_match STREQUAL "bzip2" OR + _boost_component_match STREQUAL "zlib") + # These components may or may not be required; not + # possible to tell without knowing where and when + # BOOST_BZIP2_BINARY and BOOST_ZLIB_BINARY are defined. + # If building against an external zlib or bzip2, this is + # undesirable. + continue() + endif() + if(component STREQUAL "mpi" AND + (_boost_component_match STREQUAL "mpi_python" OR + _boost_component_match STREQUAL "python")) + # Optional python dependency; skip to avoid making it a + # hard dependency (handle as special-case for mpi_python). + continue() + endif() + if (_boost_dep_found EQUAL -1 AND + NOT "${_boost_component_match}" STREQUAL "${component}") + list(APPEND _boost_DEPS "${_boost_component_match}") + endif() + if("${_boost_component_match}" STREQUAL "${component}") + set(library_component TRUE) + endif() + endforeach() + endif() + endforeach() + set(_boost_unprocessed_headers ${_boost_new_headers}) + unset(_boost_new_headers) + endwhile() + + # message(STATUS "Unfiltered dependencies for Boost::${component}: ${_boost_DEPS}") + + if(NOT library_component) + unset(_boost_DEPS) + endif() + set(${_ret_libs} ${_boost_DEPS} PARENT_SCOPE) + + #string(REGEX REPLACE ";" " " _boost_DEPS_STRING "${_boost_DEPS}") + #if (NOT _boost_DEPS_STRING) + # set(_boost_DEPS_STRING "(none)") + #endif() + #message(STATUS "Dependencies for Boost::${component}: ${_boost_DEPS_STRING}") +endfunction() + + +message(STATUS "Scanning ${BOOST_DIR}") + +# List of all directories and files +file(GLOB boost_contents RELATIVE "${BOOST_DIR}/boost" "${BOOST_DIR}/boost/*") + +# Components as directories +foreach(component ${boost_contents}) + if(IS_DIRECTORY "${BOOST_DIR}/boost/${component}") + list(APPEND boost_components "${component}") + endif() +endforeach() + +# The following components are not top-level directories, so require +# special-casing: + +# Special-case mpi_python, since it's a part of mpi +if(IS_DIRECTORY "${BOOST_DIR}/boost/mpi" AND + IS_DIRECTORY "${BOOST_DIR}/boost/python") + list(APPEND boost_components "mpi_python") +endif() +# Special-case wserialization, which is a variant of serialization +if(IS_DIRECTORY "${BOOST_DIR}/boost/serialization") + list(APPEND boost_components "wserialization") +endif() +# Special-case math* since there are six libraries, but no actual math +# library component. Handle specially when scanning above. +# +# Special-case separate test libraries, which are all part of test +if(EXISTS "${BOOST_DIR}/test/unit_test.hpp") + list(APPEND boost_components "unit_test_framework") +endif() +if(EXISTS "${BOOST_DIR}/test/prg_exec_monitor.hpp") + list(APPEND boost_components "prg_exec_monitor") +endif() +if(EXISTS "${BOOST_DIR}/test/test_exec_monitor.hpp") + list(APPEND boost_components "test_exec_monitor") +endif() + +if(boost_components) + list(SORT boost_components) +endif() + +# Process each component defined above +foreach(component ${boost_components}) + string(TOUPPER ${component} UPPERCOMPONENT) + _Boost_FIND_COMPONENT_DEPENDENCIES("${component}" "${BOOST_DIR}" + _Boost_${UPPERCOMPONENT}_LIBRARY_DEPENDENCIES) +endforeach() + +# Output results +foreach(component ${boost_components}) + string(TOUPPER ${component} UPPERCOMPONENT) + if(_Boost_${UPPERCOMPONENT}_LIBRARY_DEPENDENCIES) + string(REGEX REPLACE ";" " " _boost_DEPS_STRING "${_Boost_${UPPERCOMPONENT}_LIBRARY_DEPENDENCIES}") + message(STATUS "set(_Boost_${UPPERCOMPONENT}_DEPENDENCIES ${_boost_DEPS_STRING})") + endif() +endforeach() diff --git a/Utilities/Scripts/update-kwiml.bash b/Utilities/Scripts/update-kwiml.bash new file mode 100755 index 000000000..5c0d1922a --- /dev/null +++ b/Utilities/Scripts/update-kwiml.bash @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +set -e +set -x +shopt -s dotglob + +readonly name="KWIML" +readonly ownership="KWIML Upstream " +readonly subtree="Utilities/KWIML" +readonly repo="https://github.com/Kitware/KWIML.git" +readonly tag="master" +readonly shortlog=true +readonly paths=" +" + +extract_source () { + git_archive +} + +. "${BASH_SOURCE%/*}/update-third-party.bash" diff --git a/Utilities/Scripts/update-kwsys.bash b/Utilities/Scripts/update-kwsys.bash new file mode 100755 index 000000000..650841f10 --- /dev/null +++ b/Utilities/Scripts/update-kwsys.bash @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +set -e +set -x +shopt -s dotglob + +readonly name="KWSys" +readonly ownership="KWSys Upstream " +readonly subtree="Source/kwsys" +readonly repo="http://public.kitware.com/KWSys.git" +readonly tag="master" +readonly shortlog=true +readonly paths=" +" + +extract_source () { + git_archive +} + +export HOOKS_ALLOW_KWSYS=1 + +. "${BASH_SOURCE%/*}/update-third-party.bash" diff --git a/Utilities/Scripts/update-third-party.bash b/Utilities/Scripts/update-third-party.bash new file mode 100644 index 000000000..8925296cb --- /dev/null +++ b/Utilities/Scripts/update-third-party.bash @@ -0,0 +1,146 @@ +######################################################################## +# Script for updating third party packages. +# +# This script should be sourced in a project-specific script which sets +# the following variables: +# +# name +# The name of the project. +# ownership +# A git author name/email for the commits. +# subtree +# The location of the thirdparty package within the main source +# tree. +# repo +# The git repository to use as upstream. +# tag +# The tag, branch or commit hash to use for upstream. +# shortlog +# Optional. Set to 'true' to get a shortlog in the commit message. +# +# Additionally, an "extract_source" function must be defined. It will be +# run within the checkout of the project on the requested tag. It should +# should place the desired tree into $extractdir/$name-reduced. This +# directory will be used as the newest commit for the project. +# +# For convenience, the function may use the "git_archive" function which +# does a standard "git archive" extraction using the (optional) "paths" +# variable to only extract a subset of the source tree. +######################################################################## + +######################################################################## +# Utility functions +######################################################################## +git_archive () { + git archive --prefix="$name-reduced/" HEAD -- $paths | \ + tar -C "$extractdir" -x +} + +die () { + echo >&2 "$@" + exit 1 +} + +warn () { + echo >&2 "warning: $@" +} + +readonly regex_date='20[0-9][0-9]-[0-9][0-9]-[0-9][0-9]' +readonly basehash_regex="$name $regex_date ([0-9a-f]*)" +readonly basehash="$( git rev-list --author="$ownership" --grep="$basehash_regex" -n 1 HEAD )" +readonly upstream_old_short="$( git cat-file commit "$basehash" | sed -n '/'"$basehash_regex"'/ {s/.*(//;s/)//;p}' | egrep '^[0-9a-f]+$' )" + +######################################################################## +# Sanity checking +######################################################################## +[ -n "$name" ] || \ + die "'name' is empty" +[ -n "$ownership" ] || \ + die "'ownership' is empty" +[ -n "$subtree" ] || \ + die "'subtree' is empty" +[ -n "$repo" ] || \ + die "'repo' is empty" +[ -n "$tag" ] || \ + die "'tag' is empty" +[ -n "$basehash" ] || \ + warn "'basehash' is empty; performing initial import" +readonly do_shortlog="${shortlog-false}" + +readonly workdir="$PWD/work" +readonly upstreamdir="$workdir/upstream" +readonly extractdir="$workdir/extract" + +[ -d "$workdir" ] && \ + die "error: workdir '$workdir' already exists" + +trap "rm -rf '$workdir'" EXIT + +# Get upstream +git clone "$repo" "$upstreamdir" + +if [ -n "$basehash" ]; then + # Use the existing package's history + git worktree add "$extractdir" "$basehash" + # Clear out the working tree + pushd "$extractdir" + git ls-files | xargs rm -v + popd +else + # Create a repo to hold this package's history + mkdir -p "$extractdir" + git -C "$extractdir" init +fi + +# Extract the subset of upstream we care about +pushd "$upstreamdir" +git checkout "$tag" +readonly upstream_hash="$( git rev-parse HEAD )" +readonly upstream_hash_short="$( git rev-parse --short=8 "$upstream_hash" )" +readonly upstream_datetime="$( git rev-list "$upstream_hash" --format='%ci' -n 1 | grep -e "^$regex_date" )" +readonly upstream_date="$( echo "$upstream_datetime" | grep -o -e "$regex_date" )" +if $do_shortlog && [ -n "$basehash" ]; then + readonly commit_shortlog=" + +Upstream Shortlog +----------------- + +$( git shortlog --no-merges --abbrev=8 --format='%h %s' "$upstream_old_short".."$upstream_hash" )" +else + readonly commit_shortlog="" +fi +extract_source || \ + die "failed to extract source" +popd + +[ -d "$extractdir/$name-reduced" ] || \ + die "expected directory to extract does not exist" +readonly commit_summary="$name $upstream_date ($upstream_hash_short)" + +# Commit the subset +pushd "$extractdir" +mv -v "$name-reduced/"* . +rmdir "$name-reduced/" +git add -A . +git commit -n --author="$ownership" --date="$upstream_datetime" -F - <<-EOF +$commit_summary + +Code extracted from: + + $repo + +at commit $upstream_hash ($tag).$commit_shortlog +EOF +git branch -f "upstream-$name" +popd + +# Merge the subset into this repository +if [ -n "$basehash" ]; then + git merge --log -s recursive "-Xsubtree=$subtree/" --no-commit "upstream-$name" +else + git fetch "$extractdir" "upstream-$name:upstream-$name" + git merge --log -s ours --no-commit "upstream-$name" + git read-tree -u --prefix="$subtree/" "upstream-$name" +fi +git commit --no-edit +git branch -d "upstream-$name" diff --git a/Utilities/Sphinx/CMakeLists.txt b/Utilities/Sphinx/CMakeLists.txt index 1baca35e4..257ba620a 100644 --- a/Utilities/Sphinx/CMakeLists.txt +++ b/Utilities/Sphinx/CMakeLists.txt @@ -156,6 +156,14 @@ if(SPHINX_MAN) if("x${m}" MATCHES "^x(.+)\\.([1-9])\\.rst$") set(name "${CMAKE_MATCH_1}") set(sec "${CMAKE_MATCH_2}") + if(NOT CMakeHelp_STANDALONE) + if(name STREQUAL "ccmake" AND NOT BUILD_CursesDialog) + continue() + endif() + if(name STREQUAL "cmake-gui" AND NOT BUILD_QtDialog) + continue() + endif() + endif() CMake_OPTIONAL_COMPONENT(sphinx-man) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/man/${name}.${sec} DESTINATION ${CMAKE_MAN_DIR}/man${sec} diff --git a/Utilities/cmThirdParty.h.in b/Utilities/cmThirdParty.h.in index 0cb6809c3..4c1177ca8 100644 --- a/Utilities/cmThirdParty.h.in +++ b/Utilities/cmThirdParty.h.in @@ -15,6 +15,7 @@ /* Whether CMake is using its own utility libraries. */ #cmakedefine CMAKE_USE_SYSTEM_CURL #cmakedefine CMAKE_USE_SYSTEM_EXPAT +#cmakedefine CMAKE_USE_SYSTEM_KWIML #cmakedefine CMAKE_USE_SYSTEM_ZLIB #cmakedefine CMAKE_USE_SYSTEM_BZIP2 #cmakedefine CMAKE_USE_SYSTEM_LIBARCHIVE diff --git a/Utilities/KWIML/test/test_INT_C.c b/Utilities/cm_kwiml.h similarity index 53% rename from Utilities/KWIML/test/test_INT_C.c rename to Utilities/cm_kwiml.h index 5513a0bd8..ab2b80b3c 100644 --- a/Utilities/KWIML/test/test_INT_C.c +++ b/Utilities/cm_kwiml.h @@ -1,6 +1,6 @@ /*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. + 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. @@ -9,14 +9,17 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#include "test.h" -#include KWIML_HEADER(INT.h) -#include "test_INT_format.h" -int test_INT_C(void) -{ - if(!test_INT_format()) - { - return 0; - } - return 1; -} +#ifndef cm_kwiml_h +#define cm_kwiml_h + +/* Use the KWIML library configured for CMake. */ +#include "cmThirdParty.h" +#ifdef CMAKE_USE_SYSTEM_KWIML +# include +# include +#else +# include "KWIML/include/kwiml/abi.h" +# include "KWIML/include/kwiml/int.h" +#endif + +#endif diff --git a/Utilities/cmjsoncpp/CMakeLists.txt b/Utilities/cmjsoncpp/CMakeLists.txt index 1c863f855..d0114e711 100644 --- a/Utilities/cmjsoncpp/CMakeLists.txt +++ b/Utilities/cmjsoncpp/CMakeLists.txt @@ -23,3 +23,4 @@ include_directories( ) add_library(cmjsoncpp ${JSONCPP_SOURCES}) +target_link_libraries(cmjsoncpp ${CMake_KWIML_LIBRARIES}) diff --git a/bootstrap b/bootstrap index b2421a11b..b3f06a138 100755 --- a/bootstrap +++ b/bootstrap @@ -63,9 +63,11 @@ cmake_copyright="`grep '^Copyright .* Kitware' "${cmake_source_dir}/Copyright.tx cmake_data_dir_keyword="OTHER" cmake_doc_dir_keyword="OTHER" cmake_man_dir_keyword="OTHER" +cmake_xdgdata_dir_keyword="OTHER" cmake_data_dir="" cmake_doc_dir="" cmake_man_dir="" +cmake_xdgdata_dir="" cmake_init_file="" cmake_bootstrap_system_libs="" cmake_bootstrap_qt_gui="" @@ -214,6 +216,7 @@ fi cmake_data_dir_default="`cmake_install_dest_default DATA ${cmake_data_dir_keyword}`" cmake_doc_dir_default="`cmake_install_dest_default DOC ${cmake_doc_dir_keyword}`" cmake_man_dir_default="`cmake_install_dest_default MAN ${cmake_man_dir_keyword}`" +cmake_xdgdata_dir_default="`cmake_install_dest_default XDGDATA ${cmake_xdgdata_dir_keyword}`" CMAKE_KNOWN_C_COMPILERS="cc gcc xlc icc tcc" CMAKE_KNOWN_CXX_COMPILERS="aCC xlC CC g++ c++ icc como " @@ -373,11 +376,6 @@ KWSYS_FILES="\ SystemTools.hxx \ Terminal.h" -KWIML_FILES=' - ABI.h - INT.h -' - # Display CMake bootstrap usage cmake_usage() { @@ -406,6 +404,8 @@ Configuration: --no-system-zlib use cmake-provided zlib library (default) --system-bzip2 use system-installed bzip2 library --no-system-bzip2 use cmake-provided bzip2 library (default) + --system-liblzma use system-installed liblzma library + --no-system-liblzma use cmake-provided liblzma library (default) --system-libarchive use system-installed libarchive library --no-system-libarchive use cmake-provided libarchive library (default) @@ -428,6 +428,8 @@ Directory and file names: ['"${cmake_doc_dir_default}"'] --mandir=DIR install man pages files in PREFIX/DIR/manN ['"${cmake_man_dir_default}"'] + --xdgdatadir=DIR install XDG specific files in PREFIX/DIR + ['"${cmake_xdgdata_dir_default}"'] ' exit 10 } @@ -455,6 +457,18 @@ cmake_error() exit ${res} } +cmake_generate_file () +{ + OUTFILE="$1" + CONTENT="$2" + echo "$CONTENT" > "$OUTFILE.tmp" + if "${_diff}" "$OUTFILE.tmp" "$OUTFILE" > /dev/null 2> /dev/null ; then + rm -f "$OUTFILE.tmp" + else + mv -f "$OUTFILE.tmp" "$OUTFILE" + fi +} + # Replace KWSYS_NAMESPACE with cmsys cmake_replace_string () { @@ -616,13 +630,14 @@ while test $# != 0; do --datadir=*) cmake_data_dir=`cmake_arg "$1"` ;; --docdir=*) cmake_doc_dir=`cmake_arg "$1"` ;; --mandir=*) cmake_man_dir=`cmake_arg "$1"` ;; + --xdgdatadir=*) cmake_xdgdata_dir=`cmake_arg "$1"` ;; --init=*) cmake_init_file=`cmake_arg "$1"` ;; --system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=1" ;; --no-system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=0" ;; - --system-bzip2|--system-curl|--system-expat|--system-jsoncpp|--system-libarchive|--system-zlib) + --system-bzip2|--system-curl|--system-expat|--system-jsoncpp|--system-libarchive|--system-zlib|--system-liblzma) lib=`cmake_arg "$1" "--system-"` cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper $lib`=1" ;; - --no-system-bzip2|--no-system-curl|--no-system-expat|--no-system-jsoncpp|--no-system-libarchive|--no-system-zlib) + --no-system-bzip2|--no-system-curl|--no-system-expat|--no-system-jsoncpp|--no-system-libarchive|--no-system-zlib|--no-system-liblzma) lib=`cmake_arg "$1" "--no-system-"` cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper $lib`=0" ;; --qt-gui) cmake_bootstrap_qt_gui="1" ;; @@ -702,11 +717,6 @@ if [ ! -d "cmsys" ]; then cmake_error 4 "Cannot create directory ${cmake_bootstrap_dir}/cmsys" fi -[ -d "cmIML" ] || mkdir "cmIML" -if [ ! -d "cmIML" ]; then - cmake_error 12 "Cannot create directory ${cmake_bootstrap_dir}/cmIML" -fi - # Delete all the bootstrap files rm -f "${cmake_bootstrap_dir}/cmake_bootstrap.log" rm -f "${cmake_bootstrap_dir}/cmConfigure.h${_tmp}" @@ -1280,10 +1290,7 @@ for a in ${KWSYS_FILES}; do "${cmake_bootstrap_dir}/cmsys/${a}" KWSYS_NAMESPACE cmsys done -for a in ${KWIML_FILES}; do - cmake_replace_string "${cmake_source_dir}/Utilities/KWIML/${a}.in" \ - "${cmake_bootstrap_dir}/cmIML/${a}" KWIML cmIML -done +cmake_generate_file "${cmake_bootstrap_dir}/cmThirdParty.h" "" # Generate Makefile dep="cmConfigure.h cmsys/*.hxx cmsys/*.h `cmake_escape \"${cmake_source_dir}\"`/Source/*.h" @@ -1326,9 +1333,9 @@ cmake_cxx_flags_SystemTools=" -DKWSYS_CXX_HAS_UTIMES=${KWSYS_CXX_HAS_UTIMES} " cmake_c_flags="${cmake_c_flags}-I`cmake_escape \"${cmake_bootstrap_dir}\"` -I`cmake_escape \"${cmake_source_dir}/Source\"` \ - -I`cmake_escape \"${cmake_bootstrap_dir}\"`" + -I`cmake_escape \"${cmake_source_dir}/Utilities\"`" cmake_cxx_flags="${cmake_cxx_flags} -I`cmake_escape \"${cmake_bootstrap_dir}\"` -I`cmake_escape \"${cmake_source_dir}/Source\"` \ - -I`cmake_escape \"${cmake_bootstrap_dir}\"`" + -I`cmake_escape \"${cmake_source_dir}/Utilities\"`" echo "cmake: ${objs}" > "${cmake_bootstrap_dir}/Makefile" echo " ${cmake_cxx_compiler} ${cmake_ld_flags} ${cmake_cxx_flags} ${objs} -o cmake" >> "${cmake_bootstrap_dir}/Makefile" for a in ${CMAKE_CXX_SOURCES}; do @@ -1368,6 +1375,7 @@ set (CMAKE_INSTALL_PREFIX "'"${cmake_prefix_dir}"'" CACHE PATH "Install path pre set (CMAKE_DOC_DIR "'"${cmake_doc_dir}"'" CACHE PATH "Install location for documentation (relative to prefix)." FORCE) set (CMAKE_MAN_DIR "'"${cmake_man_dir}"'" CACHE PATH "Install location for man pages (relative to prefix)." FORCE) set (CMAKE_DATA_DIR "'"${cmake_data_dir}"'" CACHE PATH "Install location for data (relative to prefix)." FORCE) +set (CMAKE_XDGDATA_DIR "'"${cmake_xdgdata_dir}"'" CACHE PATH "Install location for XDG specific files (relative to prefix)." FORCE) ' > "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" # Add configuration settings given as command-line options.