diff options
63 files changed, 944 insertions, 444 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e60dc78..67c4cdc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,13 +1,7 @@ # Distributed under the OSI-approved BSD 3-Clause License. See accompanying # file Copyright.txt or https://cmake.org/licensing for details. -cmake_minimum_required(VERSION 2.8.12.2 FATAL_ERROR) -if(POLICY CMP0025) - cmake_policy(SET CMP0025 NEW) -endif() -if(POLICY CMP0053) - cmake_policy(SET CMP0053 NEW) -endif() +cmake_minimum_required(VERSION 3.1 FATAL_ERROR) project(CMake) # Make sure we can find internal find_package modules only used for @@ -80,6 +74,10 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE) # check for available C++ features include(${CMake_SOURCE_DIR}/Source/Checks/cm_cxx_features.cmake) + + if(NOT CMake_HAVE_CXX_UNIQUE_PTR) + message(FATAL_ERROR "The C++ compiler does not support C++11 (e.g. std::unique_ptr).") + endif() endif() # set the internal encoding of CMake to UTF-8 @@ -341,11 +339,7 @@ macro (CMAKE_BUILD_UTILITIES) endif() if(CMAKE_USE_SYSTEM_LIBRHASH) - if(NOT CMAKE_VERSION VERSION_LESS 3.0) - find_package(LibRHash) - else() - message(FATAL_ERROR "CMAKE_USE_SYSTEM_LIBRHASH requires CMake >= 3.0") - endif() + find_package(LibRHash) if(NOT LibRHash_FOUND) message(FATAL_ERROR "CMAKE_USE_SYSTEM_LIBRHASH is ON but LibRHash is not found!") @@ -511,11 +505,7 @@ macro (CMAKE_BUILD_UTILITIES) #--------------------------------------------------------------------- # Build jsoncpp library. if(CMAKE_USE_SYSTEM_JSONCPP) - if(NOT CMAKE_VERSION VERSION_LESS 3.0) - find_package(JsonCpp) - else() - message(FATAL_ERROR "CMAKE_USE_SYSTEM_JSONCPP requires CMake >= 3.0") - endif() + find_package(JsonCpp) if(NOT JsonCpp_FOUND) message(FATAL_ERROR "CMAKE_USE_SYSTEM_JSONCPP is ON but a JsonCpp is not found!") @@ -530,11 +520,7 @@ macro (CMAKE_BUILD_UTILITIES) #--------------------------------------------------------------------- # Build libuv library. if(CMAKE_USE_SYSTEM_LIBUV) - if(NOT CMAKE_VERSION VERSION_LESS 3.0) - find_package(LibUV 1.0.0) - else() - message(FATAL_ERROR "CMAKE_USE_SYSTEM_LIBUV requires CMake >= 3.0") - endif() + find_package(LibUV 1.0.0) if(NOT LIBUV_FOUND) message(FATAL_ERROR "CMAKE_USE_SYSTEM_LIBUV is ON but a libuv is not found!") diff --git a/Help/command/if.rst b/Help/command/if.rst index edd343d..f04f233 100644 --- a/Help/command/if.rst +++ b/Help/command/if.rst @@ -30,7 +30,7 @@ else and endif clause is optional. Long expressions can be used and there is a traditional order of precedence. Parenthetical expressions are evaluated first followed by unary tests such as ``EXISTS``, ``COMMAND``, and ``DEFINED``. Then any binary tests such as -``EQUAL``, ``LESS``, ``LESS_EQUAL, ``GREATER``, ``GREATER_EQUAL``, +``EQUAL``, ``LESS``, ``LESS_EQUAL``, ``GREATER``, ``GREATER_EQUAL``, ``STREQUAL``, ``STRLESS``, ``STRLESS_EQUAL``, ``STRGREATER``, ``STRGREATER_EQUAL``, ``VERSION_EQUAL``, ``VERSION_LESS``, ``VERSION_LESS_EQUAL``, ``VERSION_GREATER``, ``VERSION_GREATER_EQUAL``, diff --git a/Help/command/string.rst b/Help/command/string.rst index 4f0c45c..ba4a412 100644 --- a/Help/command/string.rst +++ b/Help/command/string.rst @@ -132,6 +132,15 @@ APPEND Append all the input arguments to the string. +PREPEND +""""""" + +:: + + string(PREPEND <string variable> [<input>...]) + +Prepend all the input arguments to the string. + CONCAT """""" diff --git a/Help/dev/source.rst b/Help/dev/source.rst index 16a9252..b40a884 100644 --- a/Help/dev/source.rst +++ b/Help/dev/source.rst @@ -23,20 +23,18 @@ format only a subset of files, such as those that are locally modified. C++ Subset Permitted ==================== -CMake supports compiling as C++98 in addition to C++11 and C++14. -In order to support building on older toolchains some constructs -need to be handled with care: +CMake requires compiling as C++11 or above. However, in order to support +building on older toolchains some constructs need to be handled with care: -* Use ``CM_AUTO_PTR`` instead of ``std::auto_ptr``. +* Do not use ``CM_AUTO_PTR`` or ``std::auto_ptr``. - The ``std::auto_ptr`` template is deprecated in C++11. We want to use it - so we can build on C++98 compilers but we do not want to turn off compiler - warnings about deprecated interfaces in general. Use the ``CM_AUTO_PTR`` - macro instead. + The ``std::auto_ptr`` template is deprecated in C++11. The ``CM_AUTO_PTR`` + macro remains leftover from C++98 support until its uses can be ported to + ``std::unique_ptr``. Do not add new uses of the macro. * Use ``CM_EQ_DELETE;`` instead of ``= delete;``. - Defining functions as *deleted* is not supported in C++98. Using + Older C++11 compilers do not support deleting functions. Using ``CM_EQ_DELETE`` will delete the functions if the compiler supports it and give them no implementation otherwise. Calling such a function will lead to compiler errors if the compiler supports *deleted* functions and linker diff --git a/Help/manual/cmake-qt.7.rst b/Help/manual/cmake-qt.7.rst index b3b09d1..e345cd2 100644 --- a/Help/manual/cmake-qt.7.rst +++ b/Help/manual/cmake-qt.7.rst @@ -70,7 +70,8 @@ be included by the user in the C++ implementation file with a preprocessor Included ``moc_*.cpp`` and ``*.moc`` files will be generated in the ``<AUTOGEN_BUILD_DIR>/include`` directory which is automatically added to the target's :prop_tgt:`INCLUDE_DIRECTORIES`. -(This differs from CMake 3.7 and below; see their documentation for details.) + +* This differs from CMake 3.7 and below; see their documentation for details. * For multi configuration generators, the include directory is ``<AUTOGEN_BUILD_DIR>/include_<CONFIG>``. @@ -110,15 +111,23 @@ inspects the C++ files in the target to determine if they require ``uic`` to be run, and to create rules to execute ``uic`` at the appropriate time. If a preprocessor ``#include`` directive is found which matches -``ui_<basename>.h``, and a ``<basename>.ui`` file exists, then ``uic`` will -be executed to generate the appropriate file. The ``<basename>.ui`` file is -searched for first in the vicinity of including file and afterwards in the -optional :prop_tgt:`AUTOUIC_SEARCH_PATHS` of the target. +``<path>ui_<basename>.h``, and a ``<basename>.ui`` file exists, +then ``uic`` will be executed to generate the appropriate file. +The ``<basename>.ui`` file is searched for in the following places + +1. ``<source_dir>/<basename>.ui`` +2. ``<source_dir>/<path><basename>.ui`` +3. ``<AUTOUIC_SEARCH_PATHS>/<basename>.ui`` +4. ``<AUTOUIC_SEARCH_PATHS>/<path><basename>.ui`` + +where ``<source_dir>`` is the directory of the C++ file and +:prop_tgt:`AUTOUIC_SEARCH_PATHS` is a list of additional search paths. The generated generated ``ui_*.h`` files are placed in the ``<AUTOGEN_BUILD_DIR>/include`` directory which is automatically added to the target's :prop_tgt:`INCLUDE_DIRECTORIES`. -(This differs from CMake 3.7 and below; see their documentation for details.) + +* This differs from CMake 3.7 and below; see their documentation for details. * For multi configuration generators, the include directory is ``<AUTOGEN_BUILD_DIR>/include_<CONFIG>``. diff --git a/Help/manual/cmake-server.7.rst b/Help/manual/cmake-server.7.rst index f6d3032..c56e5a7 100644 --- a/Help/manual/cmake-server.7.rst +++ b/Help/manual/cmake-server.7.rst @@ -277,7 +277,9 @@ Giving the "major" version of the requested protocol version will make the serve use the latest minor version of that protocol. Use this if you do not explicitly need to depend on a specific minor version. -Each protocol version may request additional attributes to be present. +If the build directory already contains a CMake cache, it is sufficient to set +the "buildDirectory" attribute. To create a fresh build directory, additional +attributes are required depending on the protocol version. Protocol version 1.0 requires the following attributes to be set: @@ -664,8 +666,7 @@ and will not survive the build directory getting cleaned out. Type "cache" ^^^^^^^^^^^^ -The "cache" request can be used once a project is configured and will -list the cached configuration values. +The "cache" request will list the cached configuration values. Example:: diff --git a/Help/release/dev/cpackifw-package-file-extension.rst b/Help/release/dev/cpackifw-package-file-extension.rst new file mode 100644 index 0000000..e264081 --- /dev/null +++ b/Help/release/dev/cpackifw-package-file-extension.rst @@ -0,0 +1,6 @@ +cpackifw-package-file-extension +------------------------------- + +* The :module:`CPackIFW` module gained new + :variable:`CPACK_IFW_PACKAGE_FILE_EXTENSION` variable to customize + target binary format. diff --git a/Help/release/dev/require-c++11.rst b/Help/release/dev/require-c++11.rst new file mode 100644 index 0000000..7b849e7 --- /dev/null +++ b/Help/release/dev/require-c++11.rst @@ -0,0 +1,5 @@ +require-c++11 +------------- + +* Support for building CMake itself with C++98 compilers was dropped. + CMake is now implemented using C++11. diff --git a/Help/release/dev/string_prepend.rst b/Help/release/dev/string_prepend.rst new file mode 100644 index 0000000..f896e91 --- /dev/null +++ b/Help/release/dev/string_prepend.rst @@ -0,0 +1,4 @@ +string_prepend +-------------- + +* The :command:`string` command learned a new ``PREPEND`` subcommand. diff --git a/Modules/CMakeCUDAInformation.cmake b/Modules/CMakeCUDAInformation.cmake index 9bba847..f4609cd 100644 --- a/Modules/CMakeCUDAInformation.cmake +++ b/Modules/CMakeCUDAInformation.cmake @@ -198,11 +198,11 @@ endif() #These are used when linking relocatable (dc) cuda code if(NOT CMAKE_CUDA_DEVICE_LINK_LIBRARY) set(CMAKE_CUDA_DEVICE_LINK_LIBRARY - "<CMAKE_CUDA_COMPILER> <CMAKE_CUDA_LINK_FLAGS> <LANGUAGE_COMPILE_FLAGS> ${CMAKE_CUDA_COMPILE_OPTIONS_PIC} ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") + "<CMAKE_CUDA_COMPILER> ${CMAKE_CUDA_HOST_FLAGS} <CMAKE_CUDA_LINK_FLAGS> <LANGUAGE_COMPILE_FLAGS> ${CMAKE_CUDA_COMPILE_OPTIONS_PIC} ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") endif() if(NOT CMAKE_CUDA_DEVICE_LINK_EXECUTABLE) set(CMAKE_CUDA_DEVICE_LINK_EXECUTABLE - "<CMAKE_CUDA_COMPILER> <FLAGS> <CMAKE_CUDA_LINK_FLAGS> ${CMAKE_CUDA_COMPILE_OPTIONS_PIC} ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") + "<CMAKE_CUDA_COMPILER> ${CMAKE_CUDA_HOST_FLAGS} <FLAGS> <CMAKE_CUDA_LINK_FLAGS> ${CMAKE_CUDA_COMPILE_OPTIONS_PIC} ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") endif() unset(_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS) diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index daba7d5..85d564e 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -73,7 +73,8 @@ # # <PackageName>_<VersionNumber>-<DebianRevisionNumber>_<DebianArchitecture>.deb # -# Alternatively provided package file name must end with ``.deb`` suffix. +# Alternatively provided package file name must end +# with either ``.deb`` or ``.ipk`` suffix. # # .. note:: # @@ -977,9 +978,9 @@ function(cpack_deb_prepare_package_vars) else() cmake_policy(PUSH) cmake_policy(SET CMP0010 NEW) - if(NOT CPACK_DEBIAN_FILE_NAME MATCHES ".*\\.deb") + if(NOT CPACK_DEBIAN_FILE_NAME MATCHES ".*\\.(deb|ipk)") cmake_policy(POP) - message(FATAL_ERROR "'${CPACK_DEBIAN_FILE_NAME}' is not a valid DEB package file name as it must end with '.deb'!") + message(FATAL_ERROR "'${CPACK_DEBIAN_FILE_NAME}' is not a valid DEB package file name as it must end with '.deb' or '.ipk'!") endif() cmake_policy(POP) diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake index c1cb52f..0210410 100644 --- a/Modules/CPackIFW.cmake +++ b/Modules/CPackIFW.cmake @@ -221,6 +221,19 @@ # You can use :command:`cpack_ifw_add_package_resources` command to resolve # relative paths. # +# .. variable:: CPACK_IFW_PACKAGE_FILE_EXTENSION +# +# The target binary extension. +# +# On Linux, the name of the target binary is automatically extended with +# '.run', if you do not specify the extension. +# +# On Windows, the target is created as an application with the extension +# '.exe', which is automatically added, if not supplied. +# +# On Mac, the target is created as an DMG disk image with the extension +# '.dmg', which is automatically added, if not supplied. +# # .. variable:: CPACK_IFW_REPOSITORIES_ALL # # The list of remote repositories. diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index fa2a6e4..3913494 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -2422,7 +2422,11 @@ mv *.rpm %_rpmdir" set(RPMBUILD_FLAGS "-bs") file(WRITE ${CPACK_RPM_BINARY_SPECFILE}.in - "# -*- rpm-spec -*- + "# Restore old style debuginfo creation for rpm >= 4.14. +%undefine _debugsource_packages +%undefine _debuginfo_subpackages + +# -*- rpm-spec -*- BuildRoot: %_topdir/\@CPACK_PACKAGE_FILE_NAME\@ Summary: \@CPACK_RPM_PACKAGE_SUMMARY\@ Name: \@CPACK_RPM_PACKAGE_NAME\@ @@ -2527,7 +2531,11 @@ Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@ if(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE OR NOT CPACK_RPM_USER_BINARY_SPECFILE) file(WRITE ${CPACK_RPM_BINARY_SPECFILE}.in - "# -*- rpm-spec -*- + "# Restore old style debuginfo creation for rpm >= 4.14. +%undefine _debugsource_packages +%undefine _debuginfo_subpackages + +# -*- rpm-spec -*- BuildRoot: %_topdir/\@CPACK_PACKAGE_FILE_NAME\@\@CPACK_RPM_PACKAGE_COMPONENT_PART_PATH\@ Summary: \@CPACK_RPM_PACKAGE_SUMMARY\@ Name: \@CPACK_RPM_PACKAGE_NAME\@ diff --git a/Modules/Compiler/Clang-FindBinUtils.cmake b/Modules/Compiler/Clang-FindBinUtils.cmake index e2822a1..b852660 100644 --- a/Modules/Compiler/Clang-FindBinUtils.cmake +++ b/Modules/Compiler/Clang-FindBinUtils.cmake @@ -2,6 +2,12 @@ if(NOT DEFINED _CMAKE_PROCESSING_LANGUAGE OR _CMAKE_PROCESSING_LANGUAGE STREQUAL message(FATAL_ERROR "Internal error: _CMAKE_PROCESSING_LANGUAGE is not set") endif() +# Debian: +# * /usr/bin/llvm-ar-4.0 +# * /usr/bin/llvm-ranlib-4.0 +string(REGEX MATCH "^([0-9]+\\.[0-9]+)" __version_x_y + "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_VERSION}") + # Try to find tools in the same directory as Clang itself get_filename_component(__clang_hint_1 "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER}" REALPATH) get_filename_component(__clang_hint_1 "${__clang_hint_1}" DIRECTORY) @@ -12,6 +18,7 @@ set(__clang_hints ${__clang_hint_1} ${__clang_hint_2}) # http://manpages.ubuntu.com/manpages/precise/en/man1/llvm-ar.1.html find_program(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_AR NAMES + "${_CMAKE_TOOLCHAIN_PREFIX}llvm-ar-${__version_x_y}" "${_CMAKE_TOOLCHAIN_PREFIX}llvm-ar" HINTS ${__clang_hints} DOC "LLVM archiver" @@ -20,6 +27,7 @@ mark_as_advanced(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_AR) # http://manpages.ubuntu.com/manpages/precise/en/man1/llvm-ranlib.1.html find_program(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_RANLIB NAMES + "${_CMAKE_TOOLCHAIN_PREFIX}llvm-ranlib-${__version_x_y}" "${_CMAKE_TOOLCHAIN_PREFIX}llvm-ranlib" HINTS ${__clang_hints} DOC "Generate index for LLVM archive" diff --git a/Modules/FindCygwin.cmake b/Modules/FindCygwin.cmake index 086c7dc..092a3bd 100644 --- a/Modules/FindCygwin.cmake +++ b/Modules/FindCygwin.cmake @@ -8,7 +8,11 @@ # this module looks for Cygwin if (WIN32) - find_program(CYGWIN_INSTALL_PATH + if(CYGWIN_INSTALL_PATH) + set(CYGWIN_BAT "${CYGWIN_INSTALL_PATH}/cygwin.bat") + endif() + + find_program(CYGWIN_BAT NAMES cygwin.bat PATHS "C:/Cygwin" @@ -16,8 +20,7 @@ if (WIN32) "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Cygwin\\setup;rootdir]" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Cygnus Solutions\\Cygwin\\mounts v2\\/;native]" ) - get_filename_component(CYGWIN_INSTALL_PATH "${CYGWIN_INSTALL_PATH}" DIRECTORY) - mark_as_advanced( - CYGWIN_INSTALL_PATH - ) + get_filename_component(CYGWIN_INSTALL_PATH "${CYGWIN_BAT}" DIRECTORY) + mark_as_advanced(CYGWIN_BAT) + endif () diff --git a/Modules/FindIce.cmake b/Modules/FindIce.cmake index e0286ee..a8133da 100644 --- a/Modules/FindIce.cmake +++ b/Modules/FindIce.cmake @@ -10,8 +10,16 @@ # # This module supports multiple components. # Components can include any of: ``Freeze``, ``Glacier2``, ``Ice``, -# ``IceBox``, ``IceDB``, ``IceGrid``, ``IcePatch``, ``IceSSL``, -# ``IceStorm``, ``IceUtil``, ``IceXML``, or ``Slice``. +# ``IceBox``, ``IceDB``, ``IceDiscovery``, ``IceGrid``, +# ``IceLocatorDiscovery``, ``IcePatch``, ``IceSSL``, ``IceStorm``, +# ``IceUtil``, ``IceXML``, or ``Slice``. +# +# Ice 3.7 and later also include C++11-specific components: +# ``Glacier2++11``, ``Ice++11``, ``IceBox++11``, ``IceDiscovery++11`` +# ``IceGrid``, ``IceLocatorDiscovery++11``, ``IceSSL++11``, +# ``IceStorm++11`` +# +# Note that the set of supported components is Ice version-specific. # # This module reports information about the Ice installation in # several variables. General variables:: @@ -28,7 +36,7 @@ # Ice::<C> # # Where ``<C>`` is the name of an Ice component, for example -# ``Ice::Glacier2``. +# ``Ice::Glacier2`` or ``Ice++11``. # # Ice slice programs are reported in:: # @@ -39,6 +47,7 @@ # Ice_SLICE2HTML_EXECUTABLE - path to slice2html executable # Ice_SLICE2JAVA_EXECUTABLE - path to slice2java executable # Ice_SLICE2JS_EXECUTABLE - path to slice2js executable +# Ice_SLICE2OBJC_EXECUTABLE - path to slice2objc executable # Ice_SLICE2PHP_EXECUTABLE - path to slice2php executable # Ice_SLICE2PY_EXECUTABLE - path to slice2py executable # Ice_SLICE2RB_EXECUTABLE - path to slice2rb executable @@ -47,10 +56,13 @@ # # Ice_GLACIER2ROUTER_EXECUTABLE - path to glacier2router executable # Ice_ICEBOX_EXECUTABLE - path to icebox executable +# Ice_ICEBOXXX11_EXECUTABLE - path to icebox++11 executable # Ice_ICEBOXADMIN_EXECUTABLE - path to iceboxadmin executable # Ice_ICEBOXD_EXECUTABLE - path to iceboxd executable # Ice_ICEBOXNET_EXECUTABLE - path to iceboxnet executable +# Ice_ICEBRIDGE_EXECUTABLE - path to icebridge executable # Ice_ICEGRIDADMIN_EXECUTABLE - path to icegridadmin executable +# Ice_ICEGRIDDB_EXECUTABLE - path to icegriddb executable # Ice_ICEGRIDNODE_EXECUTABLE - path to icegridnode executable # Ice_ICEGRIDNODED_EXECUTABLE - path to icegridnoded executable # Ice_ICEGRIDREGISTRY_EXECUTABLE - path to icegridregistry executable @@ -60,6 +72,7 @@ # Ice_ICEPATCH2SERVER_EXECUTABLE - path to icepatch2server executable # Ice_ICESERVICEINSTALL_EXECUTABLE - path to iceserviceinstall executable # Ice_ICESTORMADMIN_EXECUTABLE - path to icestormadmin executable +# Ice_ICESTORMDB_EXECUTABLE - path to icestormdb executable # Ice_ICESTORMMIGRATE_EXECUTABLE - path to icestormmigrate executable # # Ice db programs (Windows only; standard system versions on all other @@ -95,6 +108,13 @@ # The environment variable ``ICE_HOME`` may also be used; the # Ice_HOME variable takes precedence. # +# .. note:: +# On Windows, Ice 3.7.0 and later provide libraries via the NuGet +# package manager. Appropriate NuGet packages will be searched for +# using ``CMAKE_PREFIX_PATH``, or alternatively ``Ice_HOME`` may be +# set to the location of a specific NuGet package to restrict the +# search. +# # The following cache variables may also be set:: # # Ice_<P>_EXECUTABLE - the path to executable <P> @@ -124,12 +144,67 @@ # Written by Roger Leigh <rleigh@codelibre.net> + set(_Ice_db_programs + db_archive + db_checkpoint + db_deadlock + db_dump + db_hotbackup + db_load + db_log_verify + db_printlog + db_recover + db_stat + db_tuner + db_upgrade + db_verify + dumpdb + transformdb) + + set(_Ice_programs + glacier2router + icebox + icebox++11 + iceboxadmin + iceboxd + iceboxnet + icebridge + icegridadmin + icegriddb + icegridnode + icegridnoded + icegridregistry + icegridregistryd + icepatch2calc + icepatch2client + icepatch2server + iceserviceinstall + icestormadmin + icestormdb + icestormmigrate) + + set(_Ice_slice_programs + slice2cpp + slice2cs + slice2freezej + slice2freeze + slice2html + slice2java + slice2js + slice2objc + slice2php + slice2py + slice2rb) + + # The Ice checks are contained in a function due to the large number # of temporary variables needed. function(_Ice_FIND) # Released versions of Ice, including generic short forms set(ice_versions 3 + 3.7 + 3.7.0 3.6 3.6.3 3.6.2 @@ -146,6 +221,14 @@ function(_Ice_FIND) 3.3.1 3.3.0) + foreach(ver ${ice_versions}) + string(REGEX MATCH "^([0-9]+)\\.([0-9]+)\$" two_digit_version_match "${ver}") + if(two_digit_version_match) + string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\$" "\\1\\2" two_digit_version "${ver}") + list(APPEND ice_suffix_versions "${two_digit_version}") + endif() + endforeach() + # Set up search paths, taking compiler into account. Search Ice_HOME, # with ICE_HOME in the environment as a fallback if unset. if(Ice_HOME) @@ -159,52 +242,77 @@ function(_Ice_FIND) endif() endif() + set(_bin "bin/Win32") + set(_lib "lib/Win32") if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(_bin "bin/x64") + set(_lib "lib/x64") # 64-bit path suffix set(_x64 "/x64") # 64-bit library directory set(_lib64 "lib64") endif() - if(MSVC_VERSION) - # VS 8.0 - if(NOT MSVC_VERSION VERSION_LESS 1400 AND MSVC_VERSION VERSION_LESS 1500) - set(vcver "vc80") - set(vcyear "2005") - # VS 9.0 - elseif(NOT MSVC_VERSION VERSION_LESS 1500 AND MSVC_VERSION VERSION_LESS 1600) - set(vcver "vc90") + unset(vcvers) + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.10) + set(vcvers "141;140") + elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19) + set(vcvers "140") + elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18) + set(vcvers "120") + elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17) + set(vcvers "110") + elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16) + set(vcvers "100") + elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15) + set(vcvers "90") set(vcyear "2008") - # VS 10.0 - elseif(NOT MSVC_VERSION VERSION_LESS 1600 AND MSVC_VERSION VERSION_LESS 1700) - set(vcver "vc100") - # VS 11.0 - elseif(NOT MSVC_VERSION VERSION_LESS 1700 AND MSVC_VERSION VERSION_LESS 1800) - set(vcver "vc110") - # VS 12.0 - elseif(NOT MSVC_VERSION VERSION_LESS 1800 AND MSVC_VERSION VERSION_LESS 1900) - set(vcver "vc120") - # VS 14.0 - elseif(NOT MSVC_VERSION VERSION_LESS 1900 AND MSVC_VERSION VERSION_LESS 2000) - set(vcver "vc140") + elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14) + set(vcvers "80") + set(vcyear "2005") + else() # Unknown version + set(vcvers Unknown) endif() endif() # For compatibility with ZeroC Windows builds. - if(vcver) - # Earlier Ice (3.3) builds don't use vcnnn subdirectories, but are harmless to check. - list(APPEND ice_binary_suffixes "bin/${vcver}${_x64}" "bin/${vcver}") - list(APPEND ice_library_suffixes "lib/${vcver}${_x64}" "lib/${vcver}") + if(vcvers) + list(APPEND ice_binary_suffixes "build/native/${_bin}/Release" "tools") + list(APPEND ice_debug_library_suffixes "build/native/${_lib}/Debug") + list(APPEND ice_release_library_suffixes "build/native/${_lib}/Release") + foreach(vcver IN LISTS vcvers) + # Earlier Ice (3.3) builds don't use vcnnn subdirectories, but are harmless to check. + list(APPEND ice_binary_suffixes "bin/vc${vcver}${_x64}" "bin/vc${vcver}") + list(APPEND ice_debug_library_suffixes "lib/vc${vcver}${_x64}" "lib/vc${vcver}") + list(APPEND ice_release_library_suffixes "lib/vc${vcver}${_x64}" "lib/vc${vcver}") + endforeach() endif() # Generic 64-bit and 32-bit directories list(APPEND ice_binary_suffixes "bin${_x64}" "bin") - list(APPEND ice_library_suffixes "libx32" "${_lib64}" "lib${_x64}" "lib") + list(APPEND ice_debug_library_suffixes "libx32" "${_lib64}" "lib${_x64}" "lib") + list(APPEND ice_release_library_suffixes "libx32" "${_lib64}" "lib${_x64}" "lib") + if(vcvers) + list(APPEND ice_include_suffixes "build/native/include") + endif() list(APPEND ice_include_suffixes "include") list(APPEND ice_slice_suffixes "slice") # On Windows, look in the registry for install locations. Different # versions of Ice install support different compiler versions. - if(vcver) + if(vcvers) + foreach(ice_version ${ice_versions}) + foreach(vcver IN LISTS vcvers) + list(APPEND ice_nuget_dirs "zeroc.ice.v${vcver}.${ice_version}") + endforeach() + endforeach() + find_path(Ice_NUGET_DIR + NAMES "tools/slice2cpp.exe" + PATH_SUFFIXES ${ice_nuget_dirs} + DOC "Ice NuGet directory") + if(Ice_NUGET_DIR) + list(APPEND ice_roots "${Ice_NUGET_DIR}") + endif() foreach(ice_version ${ice_versions}) # Ice 3.3 releases use a Visual Studio year suffix and value is # enclosed in double quotes, though only the leading quote is @@ -239,55 +347,8 @@ function(_Ice_FIND) endforeach() endif() - set(db_programs - db_archive - db_checkpoint - db_deadlock - db_dump - db_hotbackup - db_load - db_log_verify - db_printlog - db_recover - db_stat - db_tuner - db_upgrade - db_verify - dumpdb - transformdb) - - set(ice_programs - glacier2router - icebox - iceboxadmin - iceboxd - iceboxnet - icegridadmin - icegridnode - icegridnoded - icegridregistry - icegridregistryd - icepatch2calc - icepatch2client - icepatch2server - iceserviceinstall - icestormadmin - icestormmigrate) - - set(slice_programs - slice2cpp - slice2cs - slice2freezej - slice2freeze - slice2html - slice2java - slice2js - slice2php - slice2py - slice2rb) - # Find all Ice programs - foreach(program ${db_programs} ${ice_programs} ${slice_programs}) + foreach(program ${_Ice_db_programs} ${_Ice_programs} ${_Ice_slice_programs}) string(TOUPPER "${program}" program_upcase) set(cache_var "Ice_${program_upcase}_EXECUTABLE") set(program_var "Ice_${program_upcase}_EXECUTABLE") @@ -336,6 +397,7 @@ function(_Ice_FIND) list(APPEND ice_slice_suffixes "Ice-${Ice_VERSION_SLICE2CPP_FULL}/slice" "Ice-${Ice_VERSION_SLICE2CPP_SHORT}/slice" + "ice/slice" Ice) # Find slice directory @@ -356,13 +418,39 @@ function(_Ice_FIND) set(component_cache_release "${component_cache}_RELEASE") set(component_cache_debug "${component_cache}_DEBUG") set(component_found "${component_upcase}_FOUND") - find_library("${component_cache_release}" "${component}" + set(component_library "${component}") + unset(component_library_release_names) + unset(component_library_debug_names) + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + string(REGEX MATCH ".+\\+\\+11$" component_library_cpp11 "${component_library}") + if(component_library_cpp11) + string(REGEX REPLACE "^(.+)(\\+\\+11)$" "\\1" component_library "${component_library}") + endif() + foreach(suffix_ver ${ice_suffix_versions}) + set(_name "${component_library}${suffix_ver}") + if(component_library_cpp11) + string(APPEND _name "++11") + endif() + list(APPEND component_library_debug_names "${_name}d") + list(APPEND component_library_release_names "${_name}") + endforeach() + set(_name "${component_library}") + if(component_library_cpp11) + string(APPEND _name "++11") + endif() + list(APPEND component_library_debug_names "${_name}d") + list(APPEND component_library_release_names "${_name}") + else() + list(APPEND component_library_debug_names "${component_library}d") + list(APPEND component_library_release_names "${component_library}") + endif() + find_library("${component_cache_release}" ${component_library_release_names} HINTS ${ice_roots} - PATH_SUFFIXES ${ice_library_suffixes} + PATH_SUFFIXES ${ice_release_library_suffixes} DOC "Ice ${component} library (release)") - find_library("${component_cache_debug}" "${component}d" + find_library("${component_cache_debug}" ${component_library_debug_names} HINTS ${ice_roots} - PATH_SUFFIXES ${ice_library_suffixes} + PATH_SUFFIXES ${ice_debug_library_suffixes} DOC "Ice ${component} library (debug)") include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) select_library_configurations(Ice_${component_upcase}) @@ -410,9 +498,14 @@ function(_Ice_FIND) if(Ice_DEBUG) message(STATUS "--------FindIce.cmake search debug--------") message(STATUS "ICE binary path search order: ${ice_roots}") + message(STATUS "ICE binary suffixes: ${ice_binary_suffixes}") message(STATUS "ICE include path search order: ${ice_roots}") + message(STATUS "ICE include suffixes: ${ice_include_suffixes}") message(STATUS "ICE slice path search order: ${ice_roots} ${ice_slice_paths}") + message(STATUS "ICE slice suffixes: ${ice_slice_suffixes}") message(STATUS "ICE library path search order: ${ice_roots}") + message(STATUS "ICE debug library suffixes: ${ice_debug_library_suffixes}") + message(STATUS "ICE release library suffixes: ${ice_release_library_suffixes}") message(STATUS "----------------") endif() endfunction() @@ -489,49 +582,10 @@ if(Ice_DEBUG) message(STATUS "Ice_SLICE_DIR directory: ${Ice_SLICE_DIR}") message(STATUS "Ice_LIBRARIES: ${Ice_LIBRARIES}") - message(STATUS "slice2cpp executable: ${Ice_SLICE2CPP_EXECUTABLE}") - message(STATUS "slice2cs executable: ${Ice_SLICE2CS_EXECUTABLE}") - message(STATUS "slice2freezej executable: ${Ice_SLICE2FREEZEJ_EXECUTABLE}") - message(STATUS "slice2freeze executable: ${Ice_SLICE2FREEZE_EXECUTABLE}") - message(STATUS "slice2html executable: ${Ice_SLICE2HTML_EXECUTABLE}") - message(STATUS "slice2java executable: ${Ice_SLICE2JAVA_EXECUTABLE}") - message(STATUS "slice2js executable: ${Ice_SLICE2JS_EXECUTABLE}") - message(STATUS "slice2php executable: ${Ice_SLICE2PHP_EXECUTABLE}") - message(STATUS "slice2py executable: ${Ice_SLICE2PY_EXECUTABLE}") - message(STATUS "slice2rb executable: ${Ice_SLICE2RB_EXECUTABLE}") - message(STATUS "glacier2router executable: ${Ice_GLACIER2ROUTER_EXECUTABLE}") - - message(STATUS "icebox executable: ${Ice_ICEBOX_EXECUTABLE}") - message(STATUS "iceboxadmin executable: ${Ice_ICEBOXADMIN_EXECUTABLE}") - message(STATUS "iceboxd executable: ${Ice_ICEBOXD_EXECUTABLE}") - message(STATUS "iceboxnet executable: ${Ice_ICEBOXNET_EXECUTABLE}") - message(STATUS "icegridadmin executable: ${Ice_ICEGRIDADMIN_EXECUTABLE}") - message(STATUS "icegridnode executable: ${Ice_ICEGRIDNODE_EXECUTABLE}") - message(STATUS "icegridnoded executable: ${Ice_ICEGRIDNODED_EXECUTABLE}") - message(STATUS "icegridregistry executable: ${Ice_ICEGRIDREGISTRY_EXECUTABLE}") - message(STATUS "icegridregistryd executable: ${Ice_ICEGRIDREGISTRYD_EXECUTABLE}") - message(STATUS "icepatch2calc executable: ${Ice_ICEPATCH2CALC_EXECUTABLE}") - message(STATUS "icepatch2client executable: ${Ice_ICEPATCH2CLIENT_EXECUTABLE}") - message(STATUS "icepatch2server executable: ${Ice_ICEPATCH2SERVER_EXECUTABLE}") - message(STATUS "iceserviceinstall executable: ${Ice_ICESERVICEINSTALL_EXECUTABLE}") - message(STATUS "icestormadmin executable: ${Ice_ICESTORMADMIN_EXECUTABLE}") - message(STATUS "icestormmigrate executable: ${Ice_ICESTORMMIGRATE_EXECUTABLE}") - - message(STATUS "db_archive executable: ${Ice_DB_ARCHIVE_EXECUTABLE}") - message(STATUS "db_checkpoint executable: ${Ice_DB_CHECKPOINT_EXECUTABLE}") - message(STATUS "db_deadlock executable: ${Ice_DB_DEADLOCK_EXECUTABLE}") - message(STATUS "db_dump executable: ${Ice_DB_DUMP_EXECUTABLE}") - message(STATUS "db_hotbackup executable: ${Ice_DB_HOTBACKUP_EXECUTABLE}") - message(STATUS "db_load executable: ${Ice_DB_LOAD_EXECUTABLE}") - message(STATUS "db_log_verify executable: ${Ice_DB_LOG_VERIFY_EXECUTABLE}") - message(STATUS "db_printlog executable: ${Ice_DB_PRINTLOG_EXECUTABLE}") - message(STATUS "db_recover executable: ${Ice_DB_RECOVER_EXECUTABLE}") - message(STATUS "db_stat executable: ${Ice_DB_STAT_EXECUTABLE}") - message(STATUS "db_tuner executable: ${Ice_DB_TUNER_EXECUTABLE}") - message(STATUS "db_upgrade executable: ${Ice_DB_UPGRADE_EXECUTABLE}") - message(STATUS "db_verify executable: ${Ice_DB_VERIFY_EXECUTABLE}") - message(STATUS "dumpdb executable: ${Ice_DUMPDB_EXECUTABLE}") - message(STATUS "transformdb executable: ${Ice_TRANSFORMDB_EXECUTABLE}") + foreach(program ${_Ice_db_programs} ${_Ice_programs} ${_Ice_slice_programs}) + string(TOUPPER "${program}" program_upcase) + message(STATUS "${program} executable: ${Ice_${program_upcase}_EXECUTABLE}") + endforeach() foreach(component ${Ice_FIND_COMPONENTS}) string(TOUPPER "${component}" component_upcase) @@ -542,3 +596,7 @@ if(Ice_DEBUG) endforeach() message(STATUS "----------------") endif() + +unset(_Ice_db_programs) +unset(_Ice_programs) +unset(_Ice_slice_programs) @@ -51,7 +51,7 @@ Building CMake from Scratch UNIX/Mac OSX/MinGW/MSYS/Cygwin ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -You need to have a compiler and a make installed. +You need to have a C++ compiler (supporting C++11) and a ``make`` installed. Run the ``bootstrap`` script you find in the source directory of CMake. You can use the ``--help`` option to see the supported options. You may use the ``--prefix=<install_prefix>`` option to specify a custom diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 74637cf..d0146db 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 9) -set(CMake_VERSION_PATCH 20170814) +set(CMake_VERSION_PATCH 20170821) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx index 226ea0a..6861623 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx +++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx @@ -164,6 +164,7 @@ int cmCPackIFWGenerator::PackageFiles() ifwCmd += " " + this->packageFileNames[0]; } else { ifwCmd += " installer"; + ifwCmd += this->OutputExtension; } cmCPackIFWLogger(VERBOSE, "Execute: " << ifwCmd << std::endl); std::string output; @@ -205,7 +206,7 @@ const char* cmCPackIFWGenerator::GetPackagingInstallPrefix() const char* cmCPackIFWGenerator::GetOutputExtension() { - return this->ExecutableSuffix.c_str(); + return this->OutputExtension.c_str(); } int cmCPackIFWGenerator::InitializeInternal() @@ -305,16 +306,29 @@ int cmCPackIFWGenerator::InitializeInternal() } // Executable suffix - if (const char* optExeSuffix = this->GetOption("CMAKE_EXECUTABLE_SUFFIX")) { - this->ExecutableSuffix = optExeSuffix; - if (this->ExecutableSuffix.empty()) { - std::string sysName(this->GetOption("CMAKE_SYSTEM_NAME")); - if (sysName == "Linux") { - this->ExecutableSuffix = ".run"; - } - } + std::string exeSuffix(this->GetOption("CMAKE_EXECUTABLE_SUFFIX")); + std::string sysName(this->GetOption("CMAKE_SYSTEM_NAME")); + if (sysName == "Linux") { + this->ExecutableSuffix = ".run"; + } else if (sysName == "Windows") { + this->ExecutableSuffix = ".exe"; + } else if (sysName == "Darwin") { + this->ExecutableSuffix = ".app"; + } else { + this->ExecutableSuffix = exeSuffix; + } + + // Output extension + if (const char* optOutExt = + this->GetOption("CPACK_IFW_PACKAGE_FILE_EXTENSION")) { + this->OutputExtension = optOutExt; + } else if (sysName == "Darwin") { + this->OutputExtension = ".dmg"; } else { - this->ExecutableSuffix = this->cmCPackGenerator::GetOutputExtension(); + this->OutputExtension = this->ExecutableSuffix; + } + if (this->OutputExtension.empty()) { + this->OutputExtension = this->cmCPackGenerator::GetOutputExtension(); } return this->Superclass::InitializeInternal(); diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.h b/Source/CPack/IFW/cmCPackIFWGenerator.h index 8348cee..9d635f8 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.h +++ b/Source/CPack/IFW/cmCPackIFWGenerator.h @@ -61,8 +61,8 @@ protected: const char* GetPackagingInstallPrefix() CM_OVERRIDE; /** - * @brief Extension of binary installer - * @return Executable suffix or value from default implementation + * @brief Target binary extension + * @return Executable suffix or disk image format */ const char* GetOutputExtension() CM_OVERRIDE; @@ -143,6 +143,7 @@ private: std::string BinCreator; std::string FrameworkVersion; std::string ExecutableSuffix; + std::string OutputExtension; bool OnlineOnly; bool ResolveDuplicateNames; diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index ff19eac..8a3a671 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -161,7 +161,7 @@ void cmComputeTargetDepends::CollectTargets() std::vector<cmLocalGenerator*> const& lgens = this->GlobalGenerator->GetLocalGenerators(); for (unsigned int i = 0; i < lgens.size(); ++i) { - const std::vector<cmGeneratorTarget*> targets = + const std::vector<cmGeneratorTarget*>& targets = lgens[i]->GetGeneratorTargets(); for (std::vector<cmGeneratorTarget*>::const_iterator ti = targets.begin(); ti != targets.end(); ++ti) { diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 5b7b827..e7a8975 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -296,8 +296,9 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( // and UTILITY targets for (std::vector<cmLocalGenerator*>::const_iterator lg = lgs.begin(); lg != lgs.end(); lg++) { - std::vector<cmGeneratorTarget*> targets = (*lg)->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin(); + const std::vector<cmGeneratorTarget*>& targets = + (*lg)->GetGeneratorTargets(); + for (std::vector<cmGeneratorTarget*>::const_iterator ti = targets.begin(); ti != targets.end(); ti++) { std::string targetName = (*ti)->GetName(); switch ((*ti)->GetType()) { @@ -359,8 +360,9 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( for (std::vector<cmLocalGenerator*>::const_iterator lg = lgs.begin(); lg != lgs.end(); lg++) { cmMakefile* makefile = (*lg)->GetMakefile(); - std::vector<cmGeneratorTarget*> targets = (*lg)->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin(); + const std::vector<cmGeneratorTarget*>& targets = + (*lg)->GetGeneratorTargets(); + for (std::vector<cmGeneratorTarget*>::const_iterator ti = targets.begin(); ti != targets.end(); ti++) { switch ((*ti)->GetType()) { case cmStateEnums::EXECUTABLE: diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index b478f34..96502d5 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -292,8 +292,9 @@ void cmExtraCodeLiteGenerator::CreateNewProjectFile( for (std::vector<cmLocalGenerator*>::const_iterator lg = lgs.begin(); lg != lgs.end(); lg++) { cmMakefile* makefile = (*lg)->GetMakefile(); - std::vector<cmGeneratorTarget*> targets = (*lg)->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin(); + const std::vector<cmGeneratorTarget*>& targets = + (*lg)->GetGeneratorTargets(); + for (std::vector<cmGeneratorTarget*>::const_iterator ti = targets.begin(); ti != targets.end(); ti++) { projectType = CollectSourceFiles(makefile, *ti, cFiles, otherFiles); } diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 2a6ce98..473af37 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -475,7 +475,7 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(cmXMLWriter& xml) this->GlobalGenerator->GetLocalGenerators().begin(); lgIt != this->GlobalGenerator->GetLocalGenerators().end(); ++lgIt) { cmMakefile* makefile = (*lgIt)->GetMakefile(); - const std::vector<cmGeneratorTarget*> targets = + const std::vector<cmGeneratorTarget*>& targets = (*lgIt)->GetGeneratorTargets(); for (std::vector<cmGeneratorTarget*>::const_iterator ti = targets.begin(); @@ -853,8 +853,9 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const for (std::vector<cmLocalGenerator*>::const_iterator it = this->GlobalGenerator->GetLocalGenerators().begin(); it != this->GlobalGenerator->GetLocalGenerators().end(); ++it) { - std::vector<cmGeneratorTarget*> targets = (*it)->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::iterator l = targets.begin(); + const std::vector<cmGeneratorTarget*>& targets = + (*it)->GetGeneratorTargets(); + for (std::vector<cmGeneratorTarget*>::const_iterator l = targets.begin(); l != targets.end(); ++l) { std::vector<std::string> includeDirs; std::string config = mf->GetSafeDefinition("CMAKE_BUILD_TYPE"); @@ -910,7 +911,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const for (std::vector<cmLocalGenerator*>::const_iterator it = this->GlobalGenerator->GetLocalGenerators().begin(); it != this->GlobalGenerator->GetLocalGenerators().end(); ++it) { - const std::vector<cmGeneratorTarget*> targets = + const std::vector<cmGeneratorTarget*>& targets = (*it)->GetGeneratorTargets(); std::string subdir = (*it)->ConvertToRelativePath( this->HomeOutputDirectory, (*it)->GetCurrentBinaryDirectory()); diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx index 3730433..e366774 100644 --- a/Source/cmExtraKateGenerator.cxx +++ b/Source/cmExtraKateGenerator.cxx @@ -115,7 +115,7 @@ void cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg, for (std::vector<cmLocalGenerator*>::const_iterator it = this->GlobalGenerator->GetLocalGenerators().begin(); it != this->GlobalGenerator->GetLocalGenerators().end(); ++it) { - const std::vector<cmGeneratorTarget*> targets = + const std::vector<cmGeneratorTarget*>& targets = (*it)->GetGeneratorTargets(); std::string currentDir = (*it)->GetCurrentBinaryDirectory(); bool topLevel = (currentDir == (*it)->GetBinaryDirectory()); diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 1fd1418..a62a546 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -185,8 +185,9 @@ void cmExtraSublimeTextGenerator::AppendAllTargets( for (std::vector<cmLocalGenerator*>::const_iterator lg = lgs.begin(); lg != lgs.end(); lg++) { cmMakefile* makefile = (*lg)->GetMakefile(); - std::vector<cmGeneratorTarget*> targets = (*lg)->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin(); + const std::vector<cmGeneratorTarget*>& targets = + (*lg)->GetGeneratorTargets(); + for (std::vector<cmGeneratorTarget*>::const_iterator ti = targets.begin(); ti != targets.end(); ti++) { std::string targetName = (*ti)->GetName(); switch ((*ti)->GetType()) { diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 18d10c5..85ba5ee 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2594,9 +2594,9 @@ void cmGlobalGenerator::GetTargetSets(TargetDependSet& projectTargets, continue; } // Get the targets in the makefile - std::vector<cmGeneratorTarget*> tgts = (*i)->GetGeneratorTargets(); + const std::vector<cmGeneratorTarget*>& tgts = (*i)->GetGeneratorTargets(); // loop over all the targets - for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin(); + for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin(); l != tgts.end(); ++l) { cmGeneratorTarget* target = *l; if (this->IsRootOnlyTarget(target) && @@ -2789,9 +2789,9 @@ void cmGlobalGenerator::WriteSummary() cmGeneratedFileStream fout(fname.c_str()); for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) { - std::vector<cmGeneratorTarget*> tgts = + const std::vector<cmGeneratorTarget*>& tgts = this->LocalGenerators[i]->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::iterator it = tgts.begin(); + for (std::vector<cmGeneratorTarget*>::const_iterator it = tgts.begin(); it != tgts.end(); ++it) { if ((*it)->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx index e72c6e3..85a1417 100644 --- a/Source/cmGlobalKdevelopGenerator.cxx +++ b/Source/cmGlobalKdevelopGenerator.cxx @@ -128,8 +128,9 @@ bool cmGlobalKdevelopGenerator::CreateFilelistFile( } // get all sources - std::vector<cmGeneratorTarget*> targets = (*it)->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin(); + const std::vector<cmGeneratorTarget*>& targets = + (*it)->GetGeneratorTargets(); + for (std::vector<cmGeneratorTarget*>::const_iterator ti = targets.begin(); ti != targets.end(); ti++) { std::vector<cmSourceFile*> sources; cmGeneratorTarget* gt = *ti; diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 23b3718..e42bf20 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -382,8 +382,8 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefileLanguageRules( for (unsigned int i = 0; i < lGenerators.size(); ++i) { lg = static_cast<cmLocalUnixMakefileGenerator3*>(lGenerators[i]); // for all of out targets - std::vector<cmGeneratorTarget*> tgts = lg->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin(); + const std::vector<cmGeneratorTarget*>& tgts = lg->GetGeneratorTargets(); + for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin(); l != tgts.end(); l++) { if (((*l)->GetType() == cmStateEnums::EXECUTABLE) || ((*l)->GetType() == cmStateEnums::STATIC_LIBRARY) || @@ -414,8 +414,8 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRule2( // The directory-level rule should depend on the target-level rules // for all targets in the directory. std::vector<std::string> depends; - std::vector<cmGeneratorTarget*> targets = lg->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::iterator l = targets.begin(); + const std::vector<cmGeneratorTarget*>& targets = lg->GetGeneratorTargets(); + for (std::vector<cmGeneratorTarget*>::const_iterator l = targets.begin(); l != targets.end(); ++l) { cmGeneratorTarget* gtarget = *l; int type = gtarget->GetType(); @@ -547,8 +547,8 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules( for (i = 0; i < this->LocalGenerators.size(); ++i) { lg = static_cast<cmLocalUnixMakefileGenerator3*>(this->LocalGenerators[i]); // for each target Generate the rule files for each target. - std::vector<cmGeneratorTarget*> targets = lg->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin(); + const std::vector<cmGeneratorTarget*>& targets = lg->GetGeneratorTargets(); + for (std::vector<cmGeneratorTarget*>::const_iterator t = targets.begin(); t != targets.end(); ++t) { cmGeneratorTarget* gtarget = *t; // Don't emit the same rule twice (e.g. two targets with the same @@ -629,8 +629,8 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2( depends.push_back("cmake_check_build_system"); // for each target Generate the rule files for each target. - std::vector<cmGeneratorTarget*> targets = lg->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin(); + const std::vector<cmGeneratorTarget*>& targets = lg->GetGeneratorTargets(); + for (std::vector<cmGeneratorTarget*>::const_iterator t = targets.begin(); t != targets.end(); ++t) { cmGeneratorTarget* gtarget = *t; int type = gtarget->GetType(); @@ -807,7 +807,7 @@ void cmGlobalUnixMakefileGenerator3::InitializeProgressMarks() this->LocalGenerators.begin(); lgi != this->LocalGenerators.end(); ++lgi) { cmLocalGenerator* lg = *lgi; - std::vector<cmGeneratorTarget*> targets = lg->GetGeneratorTargets(); + const std::vector<cmGeneratorTarget*>& targets = lg->GetGeneratorTargets(); for (std::vector<cmGeneratorTarget*>::const_iterator t = targets.begin(); t != targets.end(); ++t) { cmGeneratorTarget* gt = *t; @@ -952,8 +952,9 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule( // the targets if (lg2 == lg || lg->IsRootMakefile()) { // for each target Generate the rule files for each target. - std::vector<cmGeneratorTarget*> targets = lg2->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin(); + const std::vector<cmGeneratorTarget*>& targets = + lg2->GetGeneratorTargets(); + for (std::vector<cmGeneratorTarget*>::const_iterator t = targets.begin(); t != targets.end(); ++t) { cmGeneratorTarget* target = *t; cmStateEnums::TargetType type = target->GetType(); diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index 7e953ce..015f887 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -420,7 +420,8 @@ int cmGraphVizWriter::CollectAllTargets() for (std::vector<cmLocalGenerator*>::const_iterator lit = this->LocalGenerators.begin(); lit != this->LocalGenerators.end(); ++lit) { - std::vector<cmGeneratorTarget*> targets = (*lit)->GetGeneratorTargets(); + const std::vector<cmGeneratorTarget*>& targets = + (*lit)->GetGeneratorTargets(); for (std::vector<cmGeneratorTarget*>::const_iterator it = targets.begin(); it != targets.end(); ++it) { const char* realTargetName = (*it)->GetName().c_str(); @@ -445,7 +446,8 @@ int cmGraphVizWriter::CollectAllExternalLibs(int cnt) for (std::vector<cmLocalGenerator*>::const_iterator lit = this->LocalGenerators.begin(); lit != this->LocalGenerators.end(); ++lit) { - std::vector<cmGeneratorTarget*> targets = (*lit)->GetGeneratorTargets(); + const std::vector<cmGeneratorTarget*>& targets = + (*lit)->GetGeneratorTargets(); for (std::vector<cmGeneratorTarget*>::const_iterator it = targets.begin(); it != targets.end(); ++it) { const char* realTargetName = (*it)->GetName().c_str(); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 2c5db10..2c8157e 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -214,8 +214,8 @@ void cmLocalGenerator::TraceDependencies() this->GlobalGenerator->CreateEvaluationSourceFiles(*ci); } // Generate the rule files for each target. - std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin(); + const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets(); + for (std::vector<cmGeneratorTarget*>::const_iterator t = targets.begin(); t != targets.end(); ++t) { if ((*t)->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; @@ -548,6 +548,8 @@ void cmLocalGenerator::GenerateInstallRules() void cmLocalGenerator::AddGeneratorTarget(cmGeneratorTarget* gt) { this->GeneratorTargets.push_back(gt); + this->GeneratorTargetSearchIndex.insert( + std::pair<std::string, cmGeneratorTarget*>(gt->GetName(), gt)); this->GlobalGenerator->IndexGeneratorTarget(gt); } @@ -581,11 +583,10 @@ private: cmGeneratorTarget* cmLocalGenerator::FindLocalNonAliasGeneratorTarget( const std::string& name) const { - std::vector<cmGeneratorTarget*>::const_iterator ti = - std::find_if(this->GeneratorTargets.begin(), this->GeneratorTargets.end(), - NamedGeneratorTargetFinder(name)); - if (ti != this->GeneratorTargets.end()) { - return *ti; + GeneratorTargetMap::const_iterator ti = + this->GeneratorTargetSearchIndex.find(name); + if (ti != this->GeneratorTargetSearchIndex.end()) { + return ti->second; } return CM_NULLPTR; } @@ -600,8 +601,8 @@ void cmLocalGenerator::ComputeTargetManifest() } // Add our targets to the manifest for each configuration. - std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin(); + const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets(); + for (std::vector<cmGeneratorTarget*>::const_iterator t = targets.begin(); t != targets.end(); ++t) { cmGeneratorTarget* target = *t; if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { @@ -625,8 +626,8 @@ bool cmLocalGenerator::ComputeTargetCompileFeatures() } // Process compile features of all targets. - std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin(); + const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets(); + for (std::vector<cmGeneratorTarget*>::const_iterator t = targets.begin(); t != targets.end(); ++t) { cmGeneratorTarget* target = *t; for (std::vector<std::string>::iterator ci = configNames.begin(); @@ -2121,8 +2122,8 @@ void cmLocalGenerator::GenerateTargetInstallRules( { // Convert the old-style install specification from each target to // an install generator and run it. - std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin(); + const std::vector<cmGeneratorTarget*>& tgts = this->GetGeneratorTargets(); + for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin(); l != tgts.end(); ++l) { if ((*l)->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 9f78be4..9083c83 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -16,6 +16,7 @@ #include "cmOutputConverter.h" #include "cmPolicies.h" #include "cmStateSnapshot.h" +#include "cm_unordered_map.hxx" #include "cmake.h" class cmComputeLinkInformation; @@ -353,8 +354,11 @@ protected: std::string::size_type ObjectPathMax; std::set<std::string> ObjectMaxPathViolations; - std::set<cmGeneratorTarget const*> WarnCMP0063; + typedef CM_UNORDERED_MAP<std::string, cmGeneratorTarget*> GeneratorTargetMap; + GeneratorTargetMap GeneratorTargetSearchIndex; std::vector<cmGeneratorTarget*> GeneratorTargets; + + std::set<cmGeneratorTarget const*> WarnCMP0063; std::vector<cmGeneratorTarget*> ImportedGeneratorTargets; std::vector<cmGeneratorTarget*> OwnedImportedGeneratorTargets; std::map<std::string, std::string> AliasTargets; diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 266710c..9fa3ca5 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -79,8 +79,8 @@ void cmLocalNinjaGenerator::Generate() } } - std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin(); + const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets(); + for (std::vector<cmGeneratorTarget*>::const_iterator t = targets.begin(); t != targets.end(); ++t) { if ((*t)->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 9b9d22c..2d10021 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -116,10 +116,10 @@ void cmLocalUnixMakefileGenerator3::Generate() this->Makefile->IsOn("CMAKE_SKIP_ASSEMBLY_SOURCE_RULES"); // Generate the rule files for each target. - std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets(); + const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets(); cmGlobalUnixMakefileGenerator3* gg = static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator); - for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin(); + for (std::vector<cmGeneratorTarget*>::const_iterator t = targets.begin(); t != targets.end(); ++t) { if ((*t)->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; @@ -172,8 +172,8 @@ void cmLocalUnixMakefileGenerator3::ComputeObjectFilenames( void cmLocalUnixMakefileGenerator3::GetLocalObjectFiles( std::map<std::string, LocalObjectInfo>& localObjectFiles) { - std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets(); - for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin(); + const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets(); + for (std::vector<cmGeneratorTarget*>::const_iterator ti = targets.begin(); ti != targets.end(); ++ti) { cmGeneratorTarget* gt = *ti; if (gt->GetType() == cmStateEnums::INTERFACE_LIBRARY) { @@ -382,9 +382,9 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefileTargets( // for each target we just provide a rule to cd up to the top and do a make // on the target - std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets(); + const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets(); std::string localName; - for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin(); + for (std::vector<cmGeneratorTarget*>::const_iterator t = targets.begin(); t != targets.end(); ++t) { if (((*t)->GetType() == cmStateEnums::EXECUTABLE) || ((*t)->GetType() == cmStateEnums::STATIC_LIBRARY) || @@ -1562,8 +1562,8 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules( this->WriteDivider(ruleFileStream); ruleFileStream << "# Targets provided globally by CMake.\n" << "\n"; - std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets(); - std::vector<cmGeneratorTarget*>::iterator glIt; + const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets(); + std::vector<cmGeneratorTarget*>::const_iterator glIt; for (glIt = targets.begin(); glIt != targets.end(); ++glIt) { if ((*glIt)->GetType() == cmStateEnums::GLOBAL_TARGET) { std::string targetString = diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 6ea1c72..1fe07ce 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -1255,7 +1255,9 @@ bool cmQtAutoGenerators::MocGenerateAll( if (!this->MocPredefsCmd.empty()) { if (this->MocSettingsChanged || FileAbsentOrOlder(this->MocPredefsFileAbs, this->SettingsFile)) { - this->LogBold("Generating MOC predefs " + this->MocPredefsFileRel); + if (this->Verbose) { + this->LogBold("Generating MOC predefs " + this->MocPredefsFileRel); + } std::string output; { @@ -1342,7 +1344,9 @@ bool cmQtAutoGenerators::MocGenerateAll( if (this->FileDiffers(this->MocCompFileAbs, automocSource)) { // Actually write mocs compilation file - this->LogBold("Generating MOC compilation " + this->MocCompFileRel); + if (this->Verbose) { + this->LogBold("Generating MOC compilation " + this->MocCompFileRel); + } if (!this->FileWrite("AutoMoc", this->MocCompFileAbs, automocSource)) { return false; } @@ -1393,7 +1397,9 @@ bool cmQtAutoGenerators::MocGenerateFile( } if (generateMoc) { // Log - this->LogBold("Generating MOC source " + mocFileRel); + if (this->Verbose) { + this->LogBold("Generating MOC source " + mocFileRel); + } // Make sure the parent directory exists if (this->MakeParentDirectory("AutoMoc", mocFileAbs)) { @@ -1448,31 +1454,62 @@ bool cmQtAutoGenerators::MocGenerateFile( bool cmQtAutoGenerators::UicFindIncludedFile(std::string& absFile, const std::string& sourceFile, - const std::string& includeString) + const std::string& searchPath, + const std::string& searchFile) { bool success = false; - // Search in vicinity of the source + std::vector<std::string> testFiles; + // Collect search paths list { - std::string testPath = SubDirPrefix(sourceFile); - testPath += includeString; - if (cmsys::SystemTools::FileExists(testPath.c_str())) { - absFile = cmsys::SystemTools::GetRealPath(testPath); + const std::string searchFileFull = searchPath + searchFile; + // Vicinity of the source + { + const std::string sourcePath = SubDirPrefix(sourceFile); + testFiles.push_back(sourcePath + searchFile); + if (!searchPath.empty()) { + testFiles.push_back(sourcePath + searchFileFull); + } + } + // AUTOUIC search paths + if (!this->UicSearchPaths.empty()) { + for (std::vector<std::string>::const_iterator iit = + this->UicSearchPaths.begin(); + iit != this->UicSearchPaths.end(); ++iit) { + testFiles.push_back(*iit + "/" + searchFile); + } + if (!searchPath.empty()) { + for (std::vector<std::string>::const_iterator iit = + this->UicSearchPaths.begin(); + iit != this->UicSearchPaths.end(); ++iit) { + testFiles.push_back(*iit + "/" + searchFileFull); + } + } + } + } + + // Search for the .ui file! + for (std::vector<std::string>::const_iterator iit = testFiles.begin(); + iit != testFiles.end(); ++iit) { + const std::string& testFile = *iit; + if (cmsys::SystemTools::FileExists(testFile.c_str())) { + absFile = cmsys::SystemTools::GetRealPath(testFile); success = true; + break; } } - // Search in include directories + + // Log error if (!success) { - for (std::vector<std::string>::const_iterator iit = - this->UicSearchPaths.begin(); - iit != this->UicSearchPaths.end(); ++iit) { - const std::string fullPath = ((*iit) + '/' + includeString); - if (cmsys::SystemTools::FileExists(fullPath.c_str())) { - absFile = cmsys::SystemTools::GetRealPath(fullPath); - success = true; - break; - } + std::ostringstream ost; + ost << "AutoUic: Error: " << Quoted(sourceFile) << "\n"; + ost << "Could not find " << Quoted(searchFile) << " in\n"; + for (std::vector<std::string>::const_iterator iit = testFiles.begin(); + iit != testFiles.end(); ++iit) { + ost << " " << Quoted(*iit) << "\n"; } + this->LogError(ost.str()); } + return success; } @@ -1502,16 +1539,14 @@ bool cmQtAutoGenerators::UicGenerateAll( const std::string uiBasePath = SubDirPrefix(*uit); const std::string uiBaseName = cmsys::SystemTools::GetFilenameWithoutLastExtension(*uit).substr(3); - const std::string searchFileName = uiBasePath + uiBaseName + ".ui"; + const std::string uiFileName = uiBaseName + ".ui"; std::string uiInputFile; - if (UicFindIncludedFile(uiInputFile, source, searchFileName)) { + if (UicFindIncludedFile(uiInputFile, source, uiBasePath, uiFileName)) { std::string uiOutputFile = uiBasePath + "ui_" + uiBaseName + ".h"; cmSystemTools::ReplaceString(uiOutputFile, "..", "__"); uiGenMap[uiInputFile] = uiOutputFile; testMap[uiInputFile] = uiOutputFile; } else { - this->LogError("AutoUic: Error: " + Quoted(sit->first) + - "\nCould not find " + Quoted(searchFileName)); return false; } } @@ -1569,7 +1604,9 @@ bool cmQtAutoGenerators::UicGenerateFile(const std::string& realName, } if (generateUic) { // Log - this->LogBold("Generating UIC header " + uicFileRel); + if (this->Verbose) { + this->LogBold("Generating UIC header " + uicFileRel); + } // Make sure the parent directory exists if (this->MakeParentDirectory("AutoUic", uicFileAbs)) { @@ -1714,7 +1751,9 @@ bool cmQtAutoGenerators::RccGenerateFile(const std::string& rccInputFile, // Regenerate on demand if (generateRcc) { // Log - this->LogBold("Generating RCC source " + rccOutputFile); + if (this->Verbose) { + this->LogBold("Generating RCC source " + rccOutputFile); + } // Make sure the parent directory exists if (this->MakeParentDirectory("AutoRcc", rccBuildFile)) { @@ -1785,7 +1824,9 @@ bool cmQtAutoGenerators::RccGenerateFile(const std::string& rccInputFile, // Write content to file if (this->FileDiffers(wrapperFileAbs, content)) { // Write new wrapper file if the content differs - this->LogBold("Generating RCC wrapper " + wrapperFileRel); + if (this->Verbose) { + this->LogBold("Generating RCC wrapper " + wrapperFileRel); + } if (!this->FileWrite("AutoRcc", wrapperFileAbs, content)) { // Error rccGenerated = false; diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h index b525364..337aa17 100644 --- a/Source/cmQtAutoGenerators.h +++ b/Source/cmQtAutoGenerators.h @@ -112,7 +112,8 @@ private: // -- Uic file generation bool UicFindIncludedFile(std::string& absFile, const std::string& sourceFile, - const std::string& includeString); + const std::string& searchPath, + const std::string& searchFile); bool UicGenerateAll( const std::map<std::string, std::vector<std::string> >& includedUis); bool UicGenerateFile(const std::string& realName, diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index 7a841a8..baaf11a 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -269,6 +269,10 @@ static bool testHomeDirectory(cmState* state, std::string& value, { const std::string cachedValue = std::string(state->GetCacheEntryValue("CMAKE_HOME_DIRECTORY")); + if (value.empty()) { + value = cachedValue; + return true; + } const std::string suffix = "/CMakeLists.txt"; const std::string cachedValueCML = cachedValue + suffix; const std::string valueCML = value + suffix; @@ -279,9 +283,6 @@ static bool testHomeDirectory(cmState* state, std::string& value, "source directory value.")); return false; } - if (value.empty()) { - value = cachedValue; - } return true; } @@ -292,15 +293,15 @@ static bool testValue(cmState* state, const std::string& key, const char* entry = state->GetCacheEntryValue(key); const std::string cachedValue = entry == nullptr ? std::string() : std::string(entry); - if (!cachedValue.empty() && !value.empty() && cachedValue != value) { + if (value.empty()) { + value = cachedValue; + } + if (!cachedValue.empty() && cachedValue != value) { setErrorMessage(errorMessage, std::string("\"") + key + "\" is set but incompatible with configured " + keyDescription + " value."); return false; } - if (value.empty()) { - value = cachedValue; - } return true; } @@ -489,10 +490,6 @@ bool cmServerProtocol1::IsExperimental() const cmServerResponse cmServerProtocol1::ProcessCache( const cmServerRequest& request) { - if (this->m_State < STATE_CONFIGURED) { - return request.ReportError("This project was not configured yet."); - } - cmState* state = this->CMakeInstance()->GetState(); Json::Value result = Json::objectValue; @@ -750,14 +747,14 @@ static Json::Value DumpBacktrace(const cmListFileBacktrace& backtrace) if (!backtraceCopy.Top().Name.empty()) { entry[kNAME_KEY] = backtraceCopy.Top().Name; } - result.append(std::move(entry)); + result.append(entry); backtraceCopy = backtraceCopy.Pop(); } return result; } static void DumpBacktraceRange(Json::Value& result, const std::string& type, - const cmBacktraceRange& range) + cmBacktraceRange range) { for (const auto& bt : range) { Json::Value obj = Json::objectValue; diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index 5a6cf48..b07eae1 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -62,6 +62,9 @@ bool cmStringCommand::InitialPass(std::vector<std::string> const& args, if (subCommand == "APPEND") { return this->HandleAppendCommand(args); } + if (subCommand == "PREPEND") { + return this->HandlePrependCommand(args); + } if (subCommand == "CONCAT") { return this->HandleConcatCommand(args); } @@ -643,6 +646,30 @@ bool cmStringCommand::HandleAppendCommand(std::vector<std::string> const& args) return true; } +bool cmStringCommand::HandlePrependCommand( + std::vector<std::string> const& args) +{ + if (args.size() < 2) { + this->SetError("sub-command PREPEND requires at least one argument."); + return false; + } + + // Skip if nothing to prepend. + if (args.size() < 3) { + return true; + } + + const std::string& variable = args[1]; + + std::string value = cmJoin(cmMakeRange(args).advance(2), std::string()); + const char* oldValue = this->Makefile->GetDefinition(variable); + if (oldValue) { + value += oldValue; + } + this->Makefile->AddDefinition(variable, value.c_str()); + return true; +} + bool cmStringCommand::HandleConcatCommand(std::vector<std::string> const& args) { if (args.size() < 2) { diff --git a/Source/cmStringCommand.h b/Source/cmStringCommand.h index 88015ad..0dded15 100644 --- a/Source/cmStringCommand.h +++ b/Source/cmStringCommand.h @@ -46,6 +46,7 @@ protected: bool HandleLengthCommand(std::vector<std::string> const& args); bool HandleSubstringCommand(std::vector<std::string> const& args); bool HandleAppendCommand(std::vector<std::string> const& args); + bool HandlePrependCommand(std::vector<std::string> const& args); bool HandleConcatCommand(std::vector<std::string> const& args); bool HandleStripCommand(std::vector<std::string> const& args); bool HandleRandomCommand(std::vector<std::string> const& args); diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index e915b1a..d7d0c51 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -20,6 +20,21 @@ # KWSYS_HEADER_ROOT = The directory into which to generate the kwsys headers. # A directory called "${KWSYS_NAMESPACE}" will be # created under this root directory to hold the files. +# KWSYS_SPLIT_OBJECTS_FROM_INTERFACE +# = Instead of creating a single ${KWSYS_NAMESPACE} library +# target, create three separate targets: +# ${KWSYS_NAMESPACE} +# - An INTERFACE library only containing usage +# requirements. +# ${KWSYS_NAMESPACE}_objects +# - An OBJECT library for the built kwsys objects. +# Note: This is omitted from the install rules +# ${KWSYS_NAMESPACE}_private +# - An INTERFACE library combining both that is +# appropriate for use with PRIVATE linking in +# target_link_libraries. Because of how interface +# properties propagate, this target is not suitable +# for use with PUBLIC or INTERFACE linking. # # Example: # @@ -79,6 +94,10 @@ FOREACH(p ENDFOREACH() SET(CMAKE_LEGACY_CYGWIN_WIN32 0) +IF(CMAKE_VERSION VERSION_LESS 3.0) + SET(KWSYS_SPLIT_OBJECTS_FROM_INTERFACE 0) +ENDIF() + #----------------------------------------------------------------------------- # If a namespace is not specified, use "kwsys" and enable testing. # This should be the case only when kwsys is not included inside @@ -430,6 +449,11 @@ SET_SOURCE_FILES_PROPERTIES(ProcessUNIX.c System.c PROPERTIES COMPILE_FLAGS "-DKWSYS_C_HAS_PTRDIFF_T=${KWSYS_C_HAS_PTRDIFF_T} -DKWSYS_C_HAS_SSIZE_T=${KWSYS_C_HAS_SSIZE_T}" ) +IF(DEFINED KWSYS_PROCESS_USE_SELECT) + GET_PROPERTY(ProcessUNIX_FLAGS SOURCE ProcessUNIX.c PROPERTY COMPILE_FLAGS) + SET_PROPERTY(SOURCE ProcessUNIX.c PROPERTY COMPILE_FLAGS "${ProcessUNIX_FLAGS} -DKWSYSPE_USE_SELECT=${KWSYSPE_USE_SELECT}") +ENDIF() + IF(KWSYS_USE_DynamicLoader) GET_PROPERTY(KWSYS_SUPPORTS_SHARED_LIBS GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS) IF(KWSYS_SUPPORTS_SHARED_LIBS) @@ -795,68 +819,144 @@ ENDFOREACH() #----------------------------------------------------------------------------- # Add the library with the configured name and list of sources. IF(KWSYS_C_SRCS OR KWSYS_CXX_SRCS) - ADD_LIBRARY(${KWSYS_NAMESPACE} ${KWSYS_LIBRARY_TYPE} - ${KWSYS_C_SRCS} ${KWSYS_CXX_SRCS}) - SET_PROPERTY(TARGET ${KWSYS_NAMESPACE} PROPERTY C_CLANG_TIDY "") - SET_PROPERTY(TARGET ${KWSYS_NAMESPACE} PROPERTY CXX_CLANG_TIDY "") - SET_PROPERTY(TARGET ${KWSYS_NAMESPACE} PROPERTY C_INCLUDE_WHAT_YOU_USE "") - SET_PROPERTY(TARGET ${KWSYS_NAMESPACE} PROPERTY CXX_INCLUDE_WHAT_YOU_USE "") - SET_PROPERTY(TARGET ${KWSYS_NAMESPACE} PROPERTY LABELS ${KWSYS_LABELS_LIB}) + IF(KWSYS_SPLIT_OBJECTS_FROM_INTERFACE) + SET(KWSYS_TARGET_INTERFACE ${KWSYS_NAMESPACE}) + SET(KWSYS_TARGET_OBJECT ${KWSYS_NAMESPACE}_objects) + SET(KWSYS_TARGET_LINK ${KWSYS_NAMESPACE}_private) + SET(KWSYS_TARGET_INSTALL ${KWSYS_TARGET_INTERFACE} ${KWSYS_TARGET_LINK}) + SET(KWSYS_LINK_DEPENDENCY INTERFACE) + ADD_LIBRARY(${KWSYS_TARGET_OBJECT} OBJECT + ${KWSYS_C_SRCS} ${KWSYS_CXX_SRCS}) + IF(KWSYS_BUILD_SHARED) + SET_PROPERTY(TARGET ${KWSYS_TARGET_OBJECT} PROPERTY + POSITION_INDEPENDENT_CODE TRUE) + ENDIF() + ADD_LIBRARY(${KWSYS_TARGET_INTERFACE} INTERFACE) + ADD_LIBRARY(${KWSYS_TARGET_LINK} INTERFACE) + TARGET_LINK_LIBRARIES(${KWSYS_TARGET_LINK} INTERFACE + ${KWSYS_TARGET_INTERFACE}) + TARGET_SOURCES(${KWSYS_TARGET_LINK} INTERFACE + $<TARGET_OBJECTS:${KWSYS_TARGET_OBJECT}>) + ELSE() + SET(KWSYS_TARGET_INTERFACE ${KWSYS_NAMESPACE}) + SET(KWSYS_TARGET_OBJECT ${KWSYS_NAMESPACE}) + SET(KWSYS_TARGET_LINK ${KWSYS_NAMESPACE}) + set(KWSYS_TARGET_INSTALL ${KWSYS_TARGET_LINK}) + SET(KWSYS_LINK_DEPENDENCY PUBLIC) + ADD_LIBRARY(${KWSYS_TARGET_INTERFACE} ${KWSYS_LIBRARY_TYPE} + ${KWSYS_C_SRCS} ${KWSYS_CXX_SRCS}) + ENDIF() + SET_TARGET_PROPERTIES(${KWSYS_TARGET_OBJECT} PROPERTIES + C_CLANG_TIDY "" + CXX_CLANG_TIDY "" + C_INCLUDE_WHAT_YOU_USE "" + CXX_INCLUDE_WHAT_YOU_USE "" + LABELS "${KWSYS_LABELS_LIB}") IF(KWSYS_USE_DynamicLoader) IF(UNIX) - TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE} ${CMAKE_DL_LIBS}) + TARGET_LINK_LIBRARIES(${KWSYS_TARGET_INTERFACE} ${KWSYS_LINK_DEPENDENCY} + ${CMAKE_DL_LIBS}) ENDIF() ENDIF() IF(KWSYS_USE_SystemInformation) IF(WIN32) - TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE} ws2_32) + TARGET_LINK_LIBRARIES(${KWSYS_TARGET_INTERFACE} ${KWSYS_LINK_DEPENDENCY} ws2_32) IF(KWSYS_SYS_HAS_PSAPI) - TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE} Psapi) + TARGET_LINK_LIBRARIES(${KWSYS_TARGET_INTERFACE} ${KWSYS_LINK_DEPENDENCY} + Psapi) ENDIF() ELSEIF(UNIX) IF (EXECINFO_LIB AND KWSYS_CXX_HAS_BACKTRACE) # backtrace on FreeBSD is not in libc - TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE} ${EXECINFO_LIB}) + TARGET_LINK_LIBRARIES(${KWSYS_TARGET_INTERFACE} ${KWSYS_LINK_DEPENDENCY} + ${EXECINFO_LIB}) ENDIF() IF (KWSYS_CXX_HAS_DLADDR) # for symbol lookup using dladdr - TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE} ${CMAKE_DL_LIBS}) + TARGET_LINK_LIBRARIES(${KWSYS_TARGET_INTERFACE} ${KWSYS_LINK_DEPENDENCY} + ${CMAKE_DL_LIBS}) ENDIF() IF (CMAKE_SYSTEM_NAME STREQUAL "SunOS") - TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE} socket) + TARGET_LINK_LIBRARIES(${KWSYS_TARGET_INTERFACE} ${KWSYS_LINK_DEPENDENCY} + socket) ENDIF() ENDIF() ENDIF() # Apply user-defined target properties to the library. IF(KWSYS_PROPERTIES_CXX) - SET_TARGET_PROPERTIES(${KWSYS_NAMESPACE} PROPERTIES - ${KWSYS_PROPERTIES_CXX} - ) + SET_TARGET_PROPERTIES(${KWSYS_TARGET_INTERFACE} PROPERTIES + ${KWSYS_PROPERTIES_CXX}) + ENDIF() + + # Set up include usage requirement + IF(COMMAND TARGET_INCLUDE_DIRECTORIES) + TARGET_INCLUDE_DIRECTORIES(${KWSYS_TARGET_INTERFACE} INTERFACE + $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>) + IF(KWSYS_INSTALL_INCLUDE_DIR) + TARGET_INCLUDE_DIRECTORIES(${KWSYS_TARGET_INTERFACE} INTERFACE + $<INSTALL_INTERFACE:${KWSYS_INSTALL_INCLUDE_DIR}>) + ENDIF() ENDIF() # Create an install target for the library. IF(KWSYS_INSTALL_LIBRARY_RULE) - INSTALL(TARGETS ${KWSYS_NAMESPACE} ${KWSYS_INSTALL_LIBRARY_RULE}) + INSTALL(TARGETS ${KWSYS_TARGET_INSTALL} ${KWSYS_INSTALL_LIBRARY_RULE}) ENDIF() ENDIF() # Add a C-only library if requested. IF(KWSYS_ENABLE_C AND KWSYS_C_SRCS) - ADD_LIBRARY(${KWSYS_NAMESPACE}_c ${KWSYS_LIBRARY_TYPE} ${KWSYS_C_SRCS}) - SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}_c PROPERTY LABELS ${KWSYS_LABELS_LIB}) + IF(KWSYS_SPLIT_OBJECTS_FROM_INTERFACE) + SET(KWSYS_TARGET_C_INTERFACE ${KWSYS_NAMESPACE}_c) + SET(KWSYS_TARGET_C_OBJECT ${KWSYS_NAMESPACE}_c_objects) + SET(KWSYS_TARGET_C_LINK ${KWSYS_NAMESPACE}_c_private) + SET(KWSYS_TARGET_C_INSTALL + ${KWSYS_TARGET_C_INTERFACE} ${KWSYS_TARGET_C_LINK}) + SET(KWSYS_LINK_DEPENDENCY INTERFACE) + ADD_LIBRARY(${KWSYS_TARGET_C_OBJECT} OBJECT ${KWSYS_C_SRCS}) + IF(KWSYS_BUILD_SHARED) + SET_PROPERTY(TARGET ${KWSYS_TARGET_C_OBJECT} PROPERTY + POSITION_INDEPENDENT_CODE TRUE) + ENDIF() + ADD_LIBRARY(${KWSYS_TARGET_C_INTERFACE} INTERFACE) + ADD_LIBRARY(${KWSYS_TARGET_C_LINK} INTERFACE) + TARGET_LINK_LIBRARIES(${KWSYS_TARGET_C_LINK} INTERFACE + ${KWSYS_TARGET_C_INTERFACE}) + TARGET_SOURCES(${KWSYS_TARGET_C_LINK} INTERFACE + $<TARGET_OBJECTS:${KWSYS_TARGET_C_OBJECT}>) + ELSE() + SET(KWSYS_TARGET_C_INTERFACE ${KWSYS_NAMESPACE}_c) + SET(KWSYS_TARGET_C_OBJECT ${KWSYS_NAMESPACE}_c) + SET(KWSYS_TARGET_C_LINK ${KWSYS_NAMESPACE}_c) + SET(KWSYS_TARGET_C_INSTALL ${KWSYS_TARGET_C_LINK}) + SET(KWSYS_LINK_DEPENDENCY PUBLIC) + ADD_LIBRARY(${KWSYS_TARGET_C_INTERFACE} ${KWSYS_LIBRARY_TYPE} + ${KWSYS_C_SRCS}) + ENDIF() + SET_TARGET_PROPERTIES(${KWSYS_TARGET_C_OBJECT} PROPERTIES + LABELS "${KWSYS_LABELS_LIB}") # Apply user-defined target properties to the library. IF(KWSYS_PROPERTIES_C) - SET_TARGET_PROPERTIES(${KWSYS_NAMESPACE}_c PROPERTIES - ${KWSYS_PROPERTIES_C} - ) + SET_TARGET_PROPERTIES(${KWSYS_TARGET_C_INTERFACE} PROPERTIES + ${KWSYS_PROPERTIES_C}) + ENDIF() + + # Set up include usage requirement + IF(COMMAND TARGET_INCLUDE_DIRECTORIES) + TARGET_INCLUDE_DIRECTORIES(${KWSYS_TARGET_C_INTERFACE} INTERFACE + $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>) + IF(KWSYS_INSTALL_INCLUDE_DIR) + TARGET_INCLUDE_DIRECTORIES(${KWSYS_TARGET_C_INTERFACE} INTERFACE + $<INSTALL_INTERFACE:${KWSYS_INSTALL_INCLUDE_DIR}>) + ENDIF() ENDIF() # Create an install target for the library. IF(KWSYS_INSTALL_LIBRARY_RULE) - INSTALL(TARGETS ${KWSYS_NAMESPACE}_c ${KWSYS_INSTALL_LIBRARY_RULE}) + INSTALL(TARGETS ${KWSYS_TARGET_C_INSTALL}) ENDIF() ENDIF() @@ -915,7 +1015,7 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) ) ADD_EXECUTABLE(${KWSYS_NAMESPACE}TestsC ${KWSYS_C_TEST_SRCS}) SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestsC PROPERTY LABELS ${KWSYS_LABELS_EXE}) - TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE}TestsC ${KWSYS_NAMESPACE}_c) + TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE}TestsC ${KWSYS_TARGET_C_LINK}) FOREACH(test ${KWSYS_C_TESTS}) ADD_TEST(kwsys.${test} ${EXEC_DIR}/${KWSYS_NAMESPACE}TestsC ${test} ${KWSYS_TEST_ARGS_${test}}) SET_PROPERTY(TEST kwsys.${test} PROPERTY LABELS ${KWSYS_LABELS_TEST}) @@ -950,7 +1050,7 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) SET_PROPERTY(TARGET testConsoleBufChild PROPERTY C_INCLUDE_WHAT_YOU_USE "") SET_PROPERTY(TARGET testConsoleBufChild PROPERTY CXX_INCLUDE_WHAT_YOU_USE "") SET_PROPERTY(TARGET testConsoleBufChild PROPERTY LABELS ${KWSYS_LABELS_EXE}) - TARGET_LINK_LIBRARIES(testConsoleBufChild ${KWSYS_NAMESPACE}) + TARGET_LINK_LIBRARIES(testConsoleBufChild ${KWSYS_TARGET_LINK}) SET(KWSYS_CXX_TESTS ${KWSYS_CXX_TESTS} testConsoleBuf ) @@ -969,7 +1069,7 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) # If kwsys contains the DynamicLoader, need extra library ADD_LIBRARY(${KWSYS_NAMESPACE}TestDynload MODULE testDynload.c) SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestDynload PROPERTY LABELS ${KWSYS_LABELS_LIB}) - ADD_DEPENDENCIES(${KWSYS_NAMESPACE}TestDynload ${KWSYS_NAMESPACE}) + ADD_DEPENDENCIES(${KWSYS_NAMESPACE}TestDynload ${KWSYS_TARGET_INTERFACE}) ENDIF() CREATE_TEST_SOURCELIST( KWSYS_CXX_TEST_SRCS ${KWSYS_NAMESPACE}TestsCxx.cxx @@ -981,7 +1081,7 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestsCxx PROPERTY C_INCLUDE_WHAT_YOU_USE "") SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestsCxx PROPERTY CXX_INCLUDE_WHAT_YOU_USE "") SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestsCxx PROPERTY LABELS ${KWSYS_LABELS_EXE}) - TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE}TestsCxx ${KWSYS_NAMESPACE}) + TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE}TestsCxx ${KWSYS_TARGET_LINK}) SET(TEST_SYSTEMTOOLS_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") SET(TEST_SYSTEMTOOLS_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}") @@ -1032,7 +1132,7 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) # Process tests. ADD_EXECUTABLE(${KWSYS_NAMESPACE}TestProcess testProcess.c) SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestProcess PROPERTY LABELS ${KWSYS_LABELS_EXE}) - TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE}TestProcess ${KWSYS_NAMESPACE}_c) + TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE}TestProcess ${KWSYS_TARGET_C_LINK}) IF(NOT CYGWIN) SET(KWSYS_TEST_PROCESS_7 7) ENDIF() @@ -1060,7 +1160,7 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) ADD_EXECUTABLE(${KWSYS_NAMESPACE}TestSharedForward ${PROJECT_BINARY_DIR}/testSharedForward.c) SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestSharedForward PROPERTY LABELS ${KWSYS_LABELS_EXE}) - ADD_DEPENDENCIES(${KWSYS_NAMESPACE}TestSharedForward ${KWSYS_NAMESPACE}_c) + ADD_DEPENDENCIES(${KWSYS_NAMESPACE}TestSharedForward ${KWSYS_TARGET_C_LINK}) ADD_TEST(kwsys.testSharedForward ${EXEC_DIR}/${KWSYS_NAMESPACE}TestSharedForward 1) SET_PROPERTY(TEST kwsys.testSharedForward PROPERTY LABELS ${KWSYS_LABELS_TEST}) diff --git a/Source/kwsys/ProcessUNIX.c b/Source/kwsys/ProcessUNIX.c index 9ebcfce..3b32ca7 100644 --- a/Source/kwsys/ProcessUNIX.c +++ b/Source/kwsys/ProcessUNIX.c @@ -99,7 +99,8 @@ static inline void kwsysProcess_usleep(unsigned int msec) * pipes' file handles to be non-blocking and just poll them directly * without select(). */ -#if !defined(__BEOS__) && !defined(__VMS) && !defined(__MINT__) +#if !defined(__BEOS__) && !defined(__VMS) && !defined(__MINT__) && \ + !defined(KWSYSPE_USE_SELECT) #define KWSYSPE_USE_SELECT 1 #endif diff --git a/Source/kwsys/RegularExpression.cxx b/Source/kwsys/RegularExpression.cxx index 6d7f832..26e84e0 100644 --- a/Source/kwsys/RegularExpression.cxx +++ b/Source/kwsys/RegularExpression.cxx @@ -258,11 +258,6 @@ const unsigned char MAGIC = 0234; #define UCHARAT(p) (reinterpret_cast<const unsigned char*>(p))[0] -#define FAIL(m) \ - { \ - regerror(m); \ - return (0); \ - } #define ISMULT(c) ((c) == '*' || (c) == '+' || (c) == '?') #define META "^$.[()|?+*\\" diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index c5bbd41..11f3b81 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -847,6 +847,8 @@ void SystemTools::ReplaceString(std::string& source, const char* replace, free(orig); } +#if defined(_WIN32) && !defined(__CYGWIN__) + #if defined(KEY_WOW64_32KEY) && defined(KEY_WOW64_64KEY) #define KWSYS_ST_KEY_WOW64_32KEY KEY_WOW64_32KEY #define KWSYS_ST_KEY_WOW64_64KEY KEY_WOW64_64KEY @@ -855,7 +857,6 @@ void SystemTools::ReplaceString(std::string& source, const char* replace, #define KWSYS_ST_KEY_WOW64_64KEY 0x0100 #endif -#if defined(_WIN32) && !defined(__CYGWIN__) static bool SystemToolsParseRegistryKey(const std::string& key, HKEY& primaryKey, std::string& second, std::string& valuename) @@ -3796,11 +3797,7 @@ std::string SystemTools::GetFilenamePath(const std::string& filename) */ std::string SystemTools::GetFilenameName(const std::string& filename) { -#if defined(_WIN32) std::string::size_type slash_pos = filename.find_last_of("/\\"); -#else - std::string::size_type slash_pos = filename.rfind('/'); -#endif if (slash_pos != std::string::npos) { return filename.substr(slash_pos + 1); } else { diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx index e6fbf6c..1871f5d 100644 --- a/Source/kwsys/testSystemTools.cxx +++ b/Source/kwsys/testSystemTools.cxx @@ -758,6 +758,30 @@ static bool CheckGetPath() return res; } +static bool CheckGetFilenameName() +{ + const char* windowsFilepath = "C:\\somewhere\\something"; + const char* unixFilepath = "/somewhere/something"; + + std::string expectedFilename = "something"; + + bool res = true; + std::string filename = kwsys::SystemTools::GetFilenameName(windowsFilepath); + if (filename != expectedFilename) { + std::cerr << "GetFilenameName(" << windowsFilepath << ") yielded " + << filename << " instead of " << expectedFilename << std::endl; + res = false; + } + + filename = kwsys::SystemTools::GetFilenameName(unixFilepath); + if (filename != expectedFilename) { + std::cerr << "GetFilenameName(" << unixFilepath << ") yielded " << filename + << " instead of " << expectedFilename << std::endl; + res = false; + } + return res; +} + static bool CheckFind() { bool res = true; @@ -875,5 +899,7 @@ int testSystemTools(int, char* []) res &= CheckGetLineFromStream(); + res &= CheckGetFilenameName(); + return res ? 0 : 1; } diff --git a/Tests/QtAutogen/uicInclude/PageC2.ui b/Tests/QtAutogen/uicInclude/PageC2.ui new file mode 100644 index 0000000..daab868 --- /dev/null +++ b/Tests/QtAutogen/uicInclude/PageC2.ui @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>PageC2</class> + <widget class="QWidget" name="PageC2"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QTreeView" name="treeView"/> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/Tests/QtAutogen/uicInclude/dirB/sub/PageB.ui b/Tests/QtAutogen/uicInclude/dirB/PageB.ui index fa6dfa6..fa6dfa6 100644 --- a/Tests/QtAutogen/uicInclude/dirB/sub/PageB.ui +++ b/Tests/QtAutogen/uicInclude/dirB/PageB.ui diff --git a/Tests/QtAutogen/uicInclude/dirB/PageB2.ui b/Tests/QtAutogen/uicInclude/dirB/PageB2.ui new file mode 100644 index 0000000..2225150 --- /dev/null +++ b/Tests/QtAutogen/uicInclude/dirB/PageB2.ui @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>PageB2</class> + <widget class="QWidget" name="PageB2"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QTreeView" name="treeView"/> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/Tests/QtAutogen/uicInclude/dirB/subB/PageBsub.ui b/Tests/QtAutogen/uicInclude/dirB/subB/PageBsub.ui new file mode 100644 index 0000000..873016e --- /dev/null +++ b/Tests/QtAutogen/uicInclude/dirB/subB/PageBsub.ui @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>PageBsub</class> + <widget class="QWidget" name="PageBsub"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QTreeView" name="treeView"/> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/Tests/QtAutogen/uicInclude/main.cpp b/Tests/QtAutogen/uicInclude/main.cpp index 4ca66a7..c8e7609 100644 --- a/Tests/QtAutogen/uicInclude/main.cpp +++ b/Tests/QtAutogen/uicInclude/main.cpp @@ -6,5 +6,13 @@ int main(int argv, char** args) return 0; } -#include "sub/ui_PageB.h" +// .ui files in CMAKE_AUTOUIC_SEARCH_PATHS +#include "ui_PageA.h" +// .ui files in AUTOUIC_SEARCH_PATHS +#include "sub/gen/deep/ui_PageB2.h" +#include "subB/ui_PageBsub.h" +#include "ui_PageB.h" +// .ui files in source's vicinity +#include "sub/gen/deep/ui_PageC2.h" +#include "subC/ui_PageCsub.h" #include "ui_PageC.h" diff --git a/Tests/QtAutogen/uicInclude/subC/PageCsub.ui b/Tests/QtAutogen/uicInclude/subC/PageCsub.ui new file mode 100644 index 0000000..0268326 --- /dev/null +++ b/Tests/QtAutogen/uicInclude/subC/PageCsub.ui @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>PageCsub</class> + <widget class="QWidget" name="PageCsub"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QTreeView" name="treeView"/> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/Tests/RunCMake/string/Prepend.cmake b/Tests/RunCMake/string/Prepend.cmake new file mode 100644 index 0000000..8eaeebb --- /dev/null +++ b/Tests/RunCMake/string/Prepend.cmake @@ -0,0 +1,58 @@ +set(out) +string(PREPEND out) +if(DEFINED out) + message(FATAL_ERROR "\"string(PREPEND out)\" set out to \"${out}\"") +endif() + +set(out "") +string(PREPEND out) +if(NOT out STREQUAL "") + message(FATAL_ERROR "\"string(PREPEND out)\" set out to \"${out}\"") +endif() + +set(out x) +string(PREPEND out) +if(NOT out STREQUAL "x") + message(FATAL_ERROR "\"string(PREPEND out)\" set out to \"${out}\"") +endif() + + +set(out) +string(PREPEND out a) +if(NOT out STREQUAL "a") + message(FATAL_ERROR "\"string(PREPEND out a)\" set out to \"${out}\"") +endif() + +set(out "") +string(PREPEND out a) +if(NOT out STREQUAL "a") + message(FATAL_ERROR "\"string(PREPEND out a)\" set out to \"${out}\"") +endif() + +set(out x) +string(PREPEND out a) +if(NOT out STREQUAL "ax") + message(FATAL_ERROR "\"string(PREPEND out a)\" set out to \"${out}\"") +endif() + + +set(out x) +string(PREPEND out a "b") +if(NOT out STREQUAL "abx") + message(FATAL_ERROR "\"string(PREPEND out a \"b\")\" set out to \"${out}\"") +endif() + +set(b) +set(out x) +string(PREPEND out ${b}) +if(NOT out STREQUAL "x") + message(FATAL_ERROR "\"string(PREPEND out \${b})\" set out to \"${out}\"") +endif() + +set(b b) +set(out x) +string(PREPEND out a "${b}" [[ +${c}]]) +if(NOT out STREQUAL "ab\${c}x") + message(FATAL_ERROR "\"string(PREPEND out a \"\${b}\" [[\${c}]])\" set out to \"${out}\"") +endif() diff --git a/Tests/RunCMake/string/PrependNoArgs-result.txt b/Tests/RunCMake/string/PrependNoArgs-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/string/PrependNoArgs-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/string/PrependNoArgs-stderr.txt b/Tests/RunCMake/string/PrependNoArgs-stderr.txt new file mode 100644 index 0000000..8d433f9 --- /dev/null +++ b/Tests/RunCMake/string/PrependNoArgs-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at PrependNoArgs.cmake:1 \(string\): + string sub-command PREPEND requires at least one argument. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/string/PrependNoArgs.cmake b/Tests/RunCMake/string/PrependNoArgs.cmake new file mode 100644 index 0000000..f324f28 --- /dev/null +++ b/Tests/RunCMake/string/PrependNoArgs.cmake @@ -0,0 +1 @@ +string(PREPEND) diff --git a/Tests/RunCMake/string/RunCMakeTest.cmake b/Tests/RunCMake/string/RunCMakeTest.cmake index 32b61b5..513d1e3 100644 --- a/Tests/RunCMake/string/RunCMakeTest.cmake +++ b/Tests/RunCMake/string/RunCMakeTest.cmake @@ -3,6 +3,9 @@ include(RunCMake) run_cmake(Append) run_cmake(AppendNoArgs) +run_cmake(Prepend) +run_cmake(PrependNoArgs) + run_cmake(Concat) run_cmake(ConcatNoArgs) diff --git a/Tests/Server/CMakeLists.txt b/Tests/Server/CMakeLists.txt index e7eaa8d..2ad05c3 100644 --- a/Tests/Server/CMakeLists.txt +++ b/Tests/Server/CMakeLists.txt @@ -20,6 +20,7 @@ macro(do_test bsname file) endif() endmacro() +do_test("test_cache" "tc_cache.json") do_test("test_handshake" "tc_handshake.json") do_test("test_globalSettings" "tc_globalSettings.json") do_test("test_buildsystem1" "tc_buildsystem1.json") diff --git a/Tests/Server/cmakelib.py b/Tests/Server/cmakelib.py index 78450d5..2218e02 100644 --- a/Tests/Server/cmakelib.py +++ b/Tests/Server/cmakelib.py @@ -95,6 +95,21 @@ def initProc(cmakeCommand): return cmakeCommand +def exitProc(cmakeCommand): + # Tell the server to exit. + cmakeCommand.stdin.close() + cmakeCommand.stdout.close() + + # Wait for the server to exit. + # If this version of python supports it, terminate the server after a timeout. + try: + cmakeCommand.wait(timeout=5) + except TypeError: + cmakeCommand.wait() + except: + cmakeCommand.terminate() + raise + def waitForMessage(cmakeCommand, expected): data = ordered(expected) packet = ordered(waitForRawMessage(cmakeCommand)) @@ -197,3 +212,27 @@ def validateGlobalSettings(cmakeCommand, cmakeCommandPath, data): print("Validating", i) if (packet[i] != data[i]): sys.exit(1) + +def validateCache(cmakeCommand, data): + packet = waitForReply(cmakeCommand, 'cache', '', False) + + cache = packet['cache'] + + if (data['isEmpty']): + if (cache != []): + print('Expected empty cache, but got data.\n') + sys.exit(1) + return; + + if (cache == []): + print('Expected cache contents, but got none.\n') + sys.exit(1) + + hadHomeDir = False + for value in cache: + if (value['key'] == 'CMAKE_HOME_DIRECTORY'): + hadHomeDir = True + + if (not hadHomeDir): + print('No CMAKE_HOME_DIRECTORY found in cache.') + sys.exit(1) diff --git a/Tests/Server/server-test.py b/Tests/Server/server-test.py index 5621111..f5a3f28 100644 --- a/Tests/Server/server-test.py +++ b/Tests/Server/server-test.py @@ -84,7 +84,7 @@ for obj in testData: if 'extraGenerator' in data: extraGenerator = data['extraGenerator'] if not os.path.isabs(buildDirectory): buildDirectory = buildDir + "/" + buildDirectory - if not os.path.isabs(sourceDirectory): + if sourceDirectory != '' and not os.path.isabs(sourceDirectory): sourceDirectory = sourceDir + "/" + sourceDirectory cmakelib.handshake(proc, major, minor, sourceDirectory, buildDirectory, generator, extraGenerator) @@ -95,26 +95,20 @@ for obj in testData: if not 'generator' in data: data['generator'] = cmakeGenerator if not 'extraGenerator' in data: data['extraGenerator'] = '' cmakelib.validateGlobalSettings(proc, cmakeCommand, data) + elif 'validateCache' in obj: + data = obj['validateCache'] + if not 'isEmpty' in data: data['isEmpty'] = false + cmakelib.validateCache(proc, data) elif 'message' in obj: print("MESSAGE:", obj["message"]) + elif 'reconnect' in obj: + cmakelib.exitProc(proc) + proc = cmakelib.initProc(cmakeCommand) else: print("Unknown command:", json.dumps(obj)) sys.exit(2) print("Completed") -# Tell the server to exit. -proc.stdin.close() -proc.stdout.close() - -# Wait for the server to exit. -# If this version of python supports it, terminate the server after a timeout. -try: - proc.wait(timeout=5) -except TypeError: - proc.wait() -except: - proc.terminate() - raise - +cmakelib.exitProc(proc) sys.exit(proc.returncode) diff --git a/Tests/Server/tc_cache.json b/Tests/Server/tc_cache.json new file mode 100644 index 0000000..74af6d9 --- /dev/null +++ b/Tests/Server/tc_cache.json @@ -0,0 +1,24 @@ +[ +{ "message": "Testing cache" }, + +{ "message": "Cache after first handshake is empty:" }, +{ "handshake": {"major": 1, "sourceDirectory": "buildsystem1", "buildDirectory": "buildsystem1"} }, +{ "send": { "type": "cache" } }, +{ "validateCache": { "isEmpty": true } }, + +{ "message": "Cache after configure is populated:" }, +{ "send": { "type": "configure" } }, +{ "reply": { "type": "configure", "skipProgress":true } }, +{ "send": { "type": "cache" } }, +{ "validateCache": { "isEmpty": false } }, + +{ "message": "Handshake for existing cache requires buildDirectory only:" }, +{ "reconnect": {} }, +{ "handshake": {"major": 1, "sourceDirectory": "", "buildDirectory": "buildsystem1"} }, + +{ "message": "Cache after reconnect is again populated:" }, +{ "send": { "type": "cache" } }, +{ "validateCache": { "isEmpty": false } }, + +{ "message": "Everything ok." } +] diff --git a/Tests/Server/tc_handshake.json b/Tests/Server/tc_handshake.json index 975bb3d..4bb7fa7 100644 --- a/Tests/Server/tc_handshake.json +++ b/Tests/Server/tc_handshake.json @@ -11,6 +11,10 @@ { "send": {"test": "sometext","cookie":"monster"} }, { "recv": {"cookie":"monster","errorMessage":"No type given in request.","inReplyTo":"","type":"error"} }, +{ "message": "Testing commands before handshake" }, +{ "send": {"type": "cache","cookie":"monster"} }, +{ "recv": {"cookie":"monster","errorMessage":"Waiting for type \"handshake\".","inReplyTo":"cache","type":"error"} }, + { "message": "Testing handshake" }, { "send": {"type": "sometype","cookie":"monster2"} }, { "recv": {"cookie":"monster2","errorMessage":"Waiting for type \"handshake\".","inReplyTo":"sometype","type":"error"} }, diff --git a/Utilities/Doxygen/CMakeLists.txt b/Utilities/Doxygen/CMakeLists.txt index f1e8f95..6a90c84 100644 --- a/Utilities/Doxygen/CMakeLists.txt +++ b/Utilities/Doxygen/CMakeLists.txt @@ -3,7 +3,7 @@ if(NOT CMake_SOURCE_DIR) set(CMakeDeveloperReference_STANDALONE 1) - cmake_minimum_required(VERSION 2.8.12.2 FATAL_ERROR) + cmake_minimum_required(VERSION 3.1 FATAL_ERROR) get_filename_component(tmp "${CMAKE_CURRENT_SOURCE_DIR}" PATH) get_filename_component(CMake_SOURCE_DIR "${tmp}" PATH) include(${CMake_SOURCE_DIR}/Modules/CTestUseLaunchers.cmake) diff --git a/Utilities/Sphinx/CMakeLists.txt b/Utilities/Sphinx/CMakeLists.txt index a29380c..2de821c 100644 --- a/Utilities/Sphinx/CMakeLists.txt +++ b/Utilities/Sphinx/CMakeLists.txt @@ -3,7 +3,7 @@ if(NOT CMake_SOURCE_DIR) set(CMakeHelp_STANDALONE 1) - cmake_minimum_required(VERSION 2.8.12.2 FATAL_ERROR) + cmake_minimum_required(VERSION 3.1 FATAL_ERROR) get_filename_component(tmp "${CMAKE_CURRENT_SOURCE_DIR}" PATH) get_filename_component(CMake_SOURCE_DIR "${tmp}" PATH) include(${CMake_SOURCE_DIR}/Modules/CTestUseLaunchers.cmake) @@ -80,7 +80,7 @@ cmake_sphinx_build="" cmake_sphinx_flags="" # Determine whether this is a Cygwin environment. -if echo "${cmake_system}" | grep -q CYGWIN; then +if echo "${cmake_system}" | grep CYGWIN >/dev/null 2>&1; then cmake_system_cygwin=true cmake_doc_dir_keyword="CYGWIN" cmake_man_dir_keyword="CYGWIN" @@ -89,21 +89,21 @@ else fi # Determine whether this is a MinGW environment. -if echo "${cmake_system}" | grep -q 'MINGW\|MSYS'; then +if echo "${cmake_system}" | grep 'MINGW\|MSYS' >/dev/null 2>&1; then cmake_system_mingw=true else cmake_system_mingw=false fi # Determine whether this is OS X -if echo "${cmake_system}" | grep -q Darwin; then +if echo "${cmake_system}" | grep Darwin >/dev/null 2>&1; then cmake_system_darwin=true else cmake_system_darwin=false fi # Determine whether this is BeOS -if echo "${cmake_system}" | grep -q BeOS; then +if echo "${cmake_system}" | grep BeOS >/dev/null 2>&1; then cmake_system_beos=true cmake_doc_dir_keyword="HAIKU" cmake_man_dir_keyword="HAIKU" @@ -112,7 +112,7 @@ else fi # Determine whether this is Haiku -if echo "${cmake_system}" | grep -q Haiku; then +if echo "${cmake_system}" | grep Haiku >/dev/null 2>&1; then cmake_system_haiku=true cmake_doc_dir_keyword="HAIKU" cmake_man_dir_keyword="HAIKU" @@ -121,14 +121,14 @@ else fi # Determine whether this is OpenVMS -if echo "${cmake_system}" | grep -q OpenVMS; then +if echo "${cmake_system}" | grep OpenVMS >/dev/null 2>&1; then cmake_system_openvms=true else cmake_system_openvms=false fi # Determine whether this is HP-UX -if echo "${cmake_system}" | grep -q HP-UX; then +if echo "${cmake_system}" | grep HP-UX >/dev/null 2>&1; then die 'CMake no longer compiles on HP-UX. See https://gitlab.kitware.com/cmake/cmake/issues/17137 @@ -140,7 +140,7 @@ else fi # Determine whether this is Linux -if echo "${cmake_system}" | grep -q Linux; then +if echo "${cmake_system}" | grep Linux >/dev/null 2>&1; then cmake_system_linux=true else cmake_system_linux=false @@ -151,11 +151,11 @@ else # may falsely detect parisc on HP-UX m68k cmake_machine_parisc=false if ${cmake_system_linux}; then - if uname -m | grep -q parisc; then + if uname -m | grep parisc >/dev/null 2>&1; then cmake_machine_parisc=true fi elif ${cmake_system_hpux}; then - if uname -m | grep -q ia64; then : ; else + if uname -m | grep ia64 >/dev/null 2>&1; then : ; else cmake_machine_parisc=true fi fi @@ -855,16 +855,6 @@ if ${cmake_system_haiku}; then cmake_ld_flags="${LDFLAGS} -lroot -lbe" fi -# Workaround for short jump tables on PA-RISC -if ${cmake_machine_parisc}; then - if ${cmake_c_compiler_is_gnu}; then - cmake_c_flags="${CFLAGS} -mlong-calls" - fi - if ${cmake_cxx_compiler_is_gnu}; then - cmake_cxx_flags="${CXXFLAGS} -mlong-calls" - fi -fi - #----------------------------------------------------------------------------- # Detect known toolchains on some platforms. cmake_toolchains='' @@ -945,35 +935,26 @@ echo ' # error "The CMAKE_C_COMPILER is set to a C++ compiler" #endif -#include<stdio.h> +#include <stdio.h> -#if defined(__CLASSIC_C__) -int main(argc, argv) - int argc; - char* argv[]; -#else int main(int argc, char* argv[]) -#endif { printf("%d%c", (argv != 0), (char)0x0a); - return argc-1; + return argc - 1; } ' > "${TMPFILE}.c" -for a in ${cmake_c_compilers}; do - if [ -z "${cmake_c_compiler}" ] && \ - cmake_try_run "${a}" "${cmake_c_flags}" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then - cmake_c_compiler="${a}" - fi -done for std in 11 99 90; do try_flags="`cmake_extract_standard_flags \"${cmake_toolchain}\" C \"${std}\"`" - for flag in $try_flags; do - echo "Checking whether ${cmake_c_compiler} supports ${flag}" >> cmake_bootstrap.log 2>&1 - if cmake_try_run "${cmake_c_compiler}" "${cmake_c_flags} ${flag}" \ - "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then - cmake_c_flags="${cmake_c_flags} ${flag}" - break 2 - fi + for compiler in ${cmake_c_compilers}; do + for flag in '' $try_flags; do + echo "Checking whether '${compiler} ${cmake_c_flags} ${flag}' works." >> cmake_bootstrap.log 2>&1 + if cmake_try_run "${compiler}" "${cmake_c_flags} ${flag}" \ + "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then + cmake_c_compiler="${compiler}" + cmake_c_flags="${cmake_c_flags} ${flag}" + break 3 + fi + done done done rm -f "${TMPFILE}.c" @@ -1004,58 +985,45 @@ fi # Check if C++ compiler works TMPFILE=`cmake_tmp_file` echo ' -#if defined(TEST1) -# include <iostream> -#else -# include <iostream.h> -#endif +#include <iostream> +#include <memory> #if __cplusplus >= 201103L && defined(__SUNPRO_CC) && __SUNPRO_CC < 0x5140 #error "SunPro <= 5.13 C++ 11 mode not supported due to bug in move semantics." #endif -class NeedCXX +class Class { public: - NeedCXX() { this->Foo = 1; } - int GetFoo() { return this->Foo; } + int Get() const { return this->Member; } private: - int Foo; + int Member = 1; }; int main() { - NeedCXX c; -#ifdef TEST3 - cout << c.GetFoo() << endl; -#else - std::cout << c.GetFoo() << std::endl; -#endif + auto const c = std::unique_ptr<Class>(new Class); + std::cout << c->Get() << std::endl; return 0; } ' > "${TMPFILE}.cxx" -for a in ${cmake_cxx_compilers}; do - for b in 1 2 3; do - if [ -z "${cmake_cxx_compiler}" ] && \ - cmake_try_run "${a}" "${cmake_cxx_flags} -DTEST${b}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then - cmake_cxx_compiler="${a}" - fi - done -done -for std in 14 11 98; do +for std in 17 14 11; do try_flags="`cmake_extract_standard_flags \"${cmake_toolchain}\" CXX \"${std}\"`" - for flag in $try_flags; do - echo "Checking for wheter ${cmake_cxx_flags} supports ${flag}" >> cmake_bootstrap.log 2>&1 - if cmake_try_run "${cmake_cxx_compiler}" "${cmake_cxx_flags} ${flag} -DTEST1" \ - "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then - cmake_cxx_flags="${cmake_cxx_flags} ${flag} " - break 2 - fi + for compiler in ${cmake_cxx_compilers}; do + for flag in '' $try_flags; do + echo "Checking whether '${compiler} ${cmake_cxx_flags} ${flag}' works." >> cmake_bootstrap.log 2>&1 + if cmake_try_run "${compiler}" "${cmake_cxx_flags} ${flag}" \ + "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then + cmake_cxx_compiler="${compiler}" + cmake_cxx_flags="${cmake_cxx_flags} ${flag} " + break 3 + fi + done done done rm -f "${TMPFILE}.cxx" if [ -z "${cmake_cxx_compiler}" ]; then - cmake_error 7 "Cannot find appropriate C++ compiler on this system. +cmake_error 7 "Cannot find a C++ compiler supporting C++11 on this system. Please specify one using environment variable CXX. See cmake_bootstrap.log for compilers attempted." fi @@ -1120,31 +1088,6 @@ if [ "x${cmake_full_make_flags}" != "x${cmake_make_flags}" ]; then echo "---------------------------------------------" fi -# Ok, we have CC, CXX, and MAKE. - -# Test C++ compiler features - -# Are we GCC? - -TMPFILE=`cmake_tmp_file` -echo ' -#if defined(__GNUC__) && !defined(__INTEL_COMPILER) -#include <iostream> -int main() { std::cout << "This is GNU" << std::endl; return 0;} -#endif -' > ${TMPFILE}.cxx -cmake_cxx_compiler_is_gnu=0 -if cmake_try_run "${cmake_cxx_compiler}" \ - "${cmake_cxx_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then - cmake_cxx_compiler_is_gnu=1 -fi -if [ "x${cmake_cxx_compiler_is_gnu}" = "x1" ]; then - echo "${cmake_cxx_compiler} is GNU compiler" -else - echo "${cmake_cxx_compiler} is not GNU compiler" -fi -rm -f "${TMPFILE}.cxx" - # Test for kwsys features KWSYS_NAME_IS_KWSYS=0 KWSYS_BUILD_SHARED=0 |