From 8a60e6961e84fc3177d2439fe6b2b5f972104cd9 Mon Sep 17 00:00:00 2001 From: Roger Leigh Date: Tue, 1 Dec 2015 21:50:03 +0000 Subject: [PATCH 001/255] Utilities: Add BoostScanDeps script This script scans Boost headers in order to determine inter-library dependencies, using the "autolink" information embedded in the headers for automatic linking on Windows. This information is then output in a form suitable for use in FindBoost.cmake. --- Utilities/Scripts/BoostScanDeps.cmake | 217 ++++++++++++++++++++++++++ 1 file changed, 217 insertions(+) create mode 100644 Utilities/Scripts/BoostScanDeps.cmake diff --git a/Utilities/Scripts/BoostScanDeps.cmake b/Utilities/Scripts/BoostScanDeps.cmake new file mode 100644 index 000000000..1fbea4bda --- /dev/null +++ b/Utilities/Scripts/BoostScanDeps.cmake @@ -0,0 +1,217 @@ +# Scan the Boost headers and determine the library dependencies. Note +# that this script only scans one Boost version at once; invoke once +# for each Boost release. Note that this does require the headers for +# a given component to match the library name, since this computes +# inter-library dependencies. Library components for which this +# assumption does not hold true and which have dependencies on other +# Boost libraries will require special-casing. It also doesn't handle +# private dependencies not described in the headers, for static +# library dependencies--this is also a limitation of auto-linking, and +# I'm unaware of any specific instances where this would be +# problematic. +# +# Invoke in script mode, defining these variables: +# BOOST_DIR - the root of the boost includes +# +# The script will process each directory under the root as a +# "component". For each component, all the headers will be scanned to +# determine the components it depends upon by following all the +# possible includes from this component. This is to match the +# behaviour of autolinking. + +# Written by Roger Leigh + +#============================================================================= +# Copyright 2014-2015 University of Dundee +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# Determine header dependencies on libraries using the embedded dependency information. +# +# component - the component to check (uses all headers from boost/${component}) +# includedir - the path to the Boost headers +# _ret_libs - list of library dependencies +# +function(_Boost_FIND_COMPONENT_DEPENDENCIES component includedir _ret_libs) + # _boost_unprocessed_headers - list of headers requiring parsing + # _boost_processed_headers - headers already parsed (or currently being parsed) + # _boost_new_headers - new headers discovered for future processing + + set(library_component FALSE) + + # Start by finding all headers for the component; header + # dependencies via #include will be solved by future passes + + # Special-case since it is part of mpi; look only in boost/mpi/python* + if(component STREQUAL "mpi_python") + set(_boost_DEPS "python") + set(library_component TRUE) + file(GLOB_RECURSE _boost_unprocessed_headers + RELATIVE "${includedir}" + "${includedir}/boost/mpi/python/*") + list(INSERT _boost_unprocessed_headers 0 "${includedir}/boost/mpi/python.hpp") + # Special-case since it is a serialization variant; look in boost/serialization + elseif(component STREQUAL "wserialization") + set(library_component TRUE) + file(GLOB_RECURSE _boost_unprocessed_headers + RELATIVE "${includedir}" + "${includedir}/boost/serialization/*") + list(INSERT _boost_unprocessed_headers 0 "${includedir}/boost/serialization.hpp") + # Not really a library in its own right, but treat it as one + elseif(component STREQUAL "math") + set(library_component TRUE) + file(GLOB_RECURSE _boost_unprocessed_headers + RELATIVE "${includedir}" + "${includedir}/boost/math/*") + list(INSERT _boost_unprocessed_headers 0 "${includedir}/boost/math.hpp") + # Single test header + elseif(component STREQUAL "unit_test_framework") + set(library_component TRUE) + set(_boost_unprocessed_headers "${BOOST_DIR}/test/unit_test.hpp") + # Single test header + elseif(component STREQUAL "prg_exec_monitor") + set(library_component TRUE) + set(_boost_unprocessed_headers "${BOOST_DIR}/test/prg_exec_monitor.hpp") + # Single test header + elseif(component STREQUAL "test_exec_monitor") + set(library_component TRUE) + set(_boost_unprocessed_headers "${BOOST_DIR}/test/test_exec_monitor.hpp") + else() + # Default behaviour where header directory is the same as the library name. + file(GLOB_RECURSE _boost_unprocessed_headers + RELATIVE "${includedir}" + "${includedir}/boost/${component}/*") + list(INSERT _boost_unprocessed_headers 0 "${includedir}/boost/${component}.hpp") + endif() + + while(_boost_unprocessed_headers) + list(APPEND _boost_processed_headers ${_boost_unprocessed_headers}) + foreach(header ${_boost_unprocessed_headers}) + if(EXISTS "${includedir}/${header}") + file(STRINGS "${includedir}/${header}" _boost_header_includes REGEX "^#[ \t]*include[ \t]*][^>]*>") + # The optional whitespace before "#" is intentional + # (boost/serialization/config.hpp bug). + file(STRINGS "${includedir}/${header}" _boost_header_deps REGEX "^[ \t]*#[ \t]*define[ \t][ \t]*BOOST_LIB_NAME[ \t][ \t]*boost_") + + foreach(line ${_boost_header_includes}) + string(REGEX REPLACE "^#[ \t]*include[ \t]*<(boost/[^>][^>]*)>.*" "\\1" _boost_header_match "${line}") + list(FIND _boost_processed_headers "${_boost_header_match}" _boost_header_processed) + list(FIND _boost_new_headers "${_boost_header_match}" _boost_header_new) + if (_boost_header_processed EQUAL -1 AND _boost_header_new EQUAL -1) + list(APPEND _boost_new_headers ${_boost_header_match}) + endif() + endforeach() + + foreach(line ${_boost_header_deps}) + string(REGEX REPLACE "^[ \t]*#[ \t]*define[ \t][ \t]*BOOST_LIB_NAME[ \t][ \t]*boost_([^ \t][^ \t]*).*" "\\1" _boost_component_match "${line}") + list(FIND _boost_DEPS "${_boost_component_match}" _boost_dep_found) + if(_boost_component_match STREQUAL "bzip2" OR + _boost_component_match STREQUAL "zlib") + # These components may or may not be required; not + # possible to tell without knowing where and when + # BOOST_BZIP2_BINARY and BOOST_ZLIB_BINARY are defined. + # If building against an external zlib or bzip2, this is + # undesirable. + continue() + endif() + if(component STREQUAL "mpi" AND + (_boost_component_match STREQUAL "mpi_python" OR + _boost_component_match STREQUAL "python")) + # Optional python dependency; skip to avoid making it a + # hard dependency (handle as special-case for mpi_python). + continue() + endif() + if (_boost_dep_found EQUAL -1 AND + NOT "${_boost_component_match}" STREQUAL "${component}") + list(APPEND _boost_DEPS "${_boost_component_match}") + endif() + if("${_boost_component_match}" STREQUAL "${component}") + set(library_component TRUE) + endif() + endforeach() + endif() + endforeach() + set(_boost_unprocessed_headers ${_boost_new_headers}) + unset(_boost_new_headers) + endwhile() + + # message(STATUS "Unfiltered dependencies for Boost::${component}: ${_boost_DEPS}") + + if(NOT library_component) + unset(_boost_DEPS) + endif() + set(${_ret_libs} ${_boost_DEPS} PARENT_SCOPE) + + #string(REGEX REPLACE ";" " " _boost_DEPS_STRING "${_boost_DEPS}") + #if (NOT _boost_DEPS_STRING) + # set(_boost_DEPS_STRING "(none)") + #endif() + #message(STATUS "Dependencies for Boost::${component}: ${_boost_DEPS_STRING}") +endfunction() + + +message(STATUS "Scanning ${BOOST_DIR}") + +# List of all directories and files +file(GLOB boost_contents RELATIVE "${BOOST_DIR}/boost" "${BOOST_DIR}/boost/*") + +# Components as directories +foreach(component ${boost_contents}) + if(IS_DIRECTORY "${BOOST_DIR}/boost/${component}") + list(APPEND boost_components "${component}") + endif() +endforeach() + +# The following components are not top-level directories, so require +# special-casing: + +# Special-case mpi_python, since it's a part of mpi +if(IS_DIRECTORY "${BOOST_DIR}/boost/mpi" AND + IS_DIRECTORY "${BOOST_DIR}/boost/python") + list(APPEND boost_components "mpi_python") +endif() +# Special-case wserialization, which is a variant of serialization +if(IS_DIRECTORY "${BOOST_DIR}/boost/serialization") + list(APPEND boost_components "wserialization") +endif() +# Special-case math* since there are six libraries, but no actual math +# library component. Handle specially when scanning above. +# +# Special-case separate test libraries, which are all part of test +if(EXISTS "${BOOST_DIR}/test/unit_test.hpp") + list(APPEND boost_components "unit_test_framework") +endif() +if(EXISTS "${BOOST_DIR}/test/prg_exec_monitor.hpp") + list(APPEND boost_components "prg_exec_monitor") +endif() +if(EXISTS "${BOOST_DIR}/test/test_exec_monitor.hpp") + list(APPEND boost_components "test_exec_monitor") +endif() + +if(boost_components) + list(SORT boost_components) +endif() + +# Process each component defined above +foreach(component ${boost_components}) + string(TOUPPER ${component} UPPERCOMPONENT) + _Boost_FIND_COMPONENT_DEPENDENCIES("${component}" "${BOOST_DIR}" + _Boost_${UPPERCOMPONENT}_LIBRARY_DEPENDENCIES) +endforeach() + +# Output results +foreach(component ${boost_components}) + string(TOUPPER ${component} UPPERCOMPONENT) + if(_Boost_${UPPERCOMPONENT}_LIBRARY_DEPENDENCIES) + string(REGEX REPLACE ";" " " _boost_DEPS_STRING "${_Boost_${UPPERCOMPONENT}_LIBRARY_DEPENDENCIES}") + message(STATUS "set(_Boost_${UPPERCOMPONENT}_DEPENDENCIES ${_boost_DEPS_STRING})") + endif() +endforeach() From 5183c6e5dd6ff2bbb5cce33a6f8b6b1d74dfe217 Mon Sep 17 00:00:00 2001 From: Roger Leigh Date: Tue, 1 Dec 2015 21:53:50 +0000 Subject: [PATCH 002/255] FindBoost: Embed component dependency table The function _Boost_COMPONENT_DEPENDENCIES is used to query the library dependencies for a given component for a given version of Boost. This covers Boost releases from 1.33 to 1.59, using the information generated by Utilities/Scripts/BoostScanDeps.cmake. --- Modules/FindBoost.cmake | 221 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 221 insertions(+) diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 33e6a4970..41b728dc7 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -471,6 +471,223 @@ function(_Boost_GUESS_COMPILER_PREFIX _ret) set(${_ret} ${_boost_COMPILER} PARENT_SCOPE) endfunction() +# +# Get component dependencies. Requires the dependencies to have been +# defined for the Boost release version. +# +# component - the component to check +# _ret - list of library dependencies +# +function(_Boost_COMPONENT_DEPENDENCIES component _ret) + # Note: to add a new Boost release, run + # + # % cmake -DBOOST_DIR=/path/to/boost/source -P Utilities/Scripts/BoostScanDeps.cmake + # + # The output may be added in a new block below. If it's the same as + # the previous release, simply update the version range of the block + # for the previous release. + # + # This information was originally generated by running + # BoostScanDeps.cmake against every boost release to date supported + # by FindBoost: + # + # % for version in /path/to/boost/sources/* + # do + # cmake -DBOOST_DIR=$version -P Utilities/Scripts/BoostScanDeps.cmake + # done + # + # The output was then updated by search and replace with these regexes: + # + # - Strip message(STATUS) prefix dashes + # s;^-- ;; + # - Indent + # s;^set(; set(;; + # - Add conditionals + # s;Scanning /path/to/boost/sources/boost_\(.*\)_\(.*\)_\(.*); elseif(NOT Boost_VERSION VERSION_LESS \10\20\3 AND Boost_VERSION VERSION_LESS xxxx); + # + # This results in the logic seen below, but will require the xxxx + # replacing with the following Boost release version (or the next + # minor version to be released, e.g. 1.59 was the latest at the time + # of writing, making 1.60 the next, so 106000 is the needed version + # number). Identical consecutive releases were then merged together + # by updating the end range of the first block and removing the + # following redundant blocks. + # + # Running the script against all historical releases should be + # required only if the BoostScanDeps.cmake script logic is changed. + # The addition of a new release should only require it to be run + # against the new release. + set(_Boost_IMPORTED_TARGETS TRUE) + if(NOT Boost_VERSION VERSION_LESS 103300 AND Boost_VERSION VERSION_LESS 103500) + set(_Boost_IOSTREAMS_DEPENDENCIES regex thread) + set(_Boost_REGEX_DEPENDENCIES thread) + set(_Boost_WAVE_DEPENDENCIES filesystem thread) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 103500 AND Boost_VERSION VERSION_LESS 103600) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_WAVE_DEPENDENCIES filesystem system thread) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 103600 AND Boost_VERSION VERSION_LESS 103800) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_WAVE_DEPENDENCIES filesystem system thread) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 103800 AND Boost_VERSION VERSION_LESS 104300) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_THREAD_DEPENDENCIES date_time) + set(_Boost_WAVE_DEPENDENCIES filesystem system thread date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 104300 AND Boost_VERSION VERSION_LESS 104400) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_THREAD_DEPENDENCIES date_time) + set(_Boost_WAVE_DEPENDENCIES filesystem system thread date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 104400 AND Boost_VERSION VERSION_LESS 104500) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random serialization) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_THREAD_DEPENDENCIES date_time) + set(_Boost_WAVE_DEPENDENCIES serialization filesystem system thread date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 104500 AND Boost_VERSION VERSION_LESS 104700) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_THREAD_DEPENDENCIES date_time) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 104700 AND Boost_VERSION VERSION_LESS 104800) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_THREAD_DEPENDENCIES date_time) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 104800 AND Boost_VERSION VERSION_LESS 105000) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_THREAD_DEPENDENCIES date_time) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 105000 AND Boost_VERSION VERSION_LESS 105300) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 105300 AND Boost_VERSION VERSION_LESS 105400) + set(_Boost_ATOMIC_DEPENDENCIES thread chrono system date_time) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 105400 AND Boost_VERSION VERSION_LESS 105500) + set(_Boost_ATOMIC_DEPENDENCIES thread chrono system date_time) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 105500 AND Boost_VERSION VERSION_LESS 105600) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_COROUTINE_DEPENDENCIES context system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 105600 AND Boost_VERSION VERSION_LESS 105900) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_COROUTINE_DEPENDENCIES context system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_RANDOM_DEPENDENCIES system) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 105900 AND Boost_VERSION VERSION_LESS 106000) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_COROUTINE_DEPENDENCIES context system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono atomic) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_RANDOM_DEPENDENCIES system) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + else() + message(WARNING "Imported targets not available for Boost version ${Boost_VERSION}") + set(_Boost_IMPORTED_TARGETS FALSE) + endif() + + string(TOUPPER ${component} uppercomponent) + set(${_ret} ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE) + set(_Boost_IMPORTED_TARGETS ${_Boost_IMPORTED_TARGETS} PARENT_SCOPE) + + string(REGEX REPLACE ";" " " _boost_DEPS_STRING "${_Boost_${uppercomponent}_DEPENDENCIES}") + if (NOT _boost_DEPS_STRING) + set(_boost_DEPS_STRING "(none)") + endif() + # message(STATUS "Dependencies for Boost::${component}: ${_boost_DEPS_STRING}") +endfunction() + # # End functions/macros # @@ -511,6 +728,10 @@ if(Boost_FIND_VERSION_EXACT) else() # The user has not requested an exact version. Among known # versions, find those that are acceptable to the user request. + # + # Note: When adding a new Boost release, also update the dependency + # information in _Boost_COMPONENT_DEPENDENCIES. See the + # instructions at the top of _Boost_COMPONENT_DEPENDENCIES. set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS} "1.59.0" "1.59" "1.58.0" "1.58" "1.57.0" "1.57" "1.56.0" "1.56" "1.55.0" "1.55" From 01c80acdbdadf3811bc0a6cab0c28469a4e9f5b7 Mon Sep 17 00:00:00 2001 From: Roger Leigh Date: Tue, 1 Dec 2015 21:59:00 +0000 Subject: [PATCH 003/255] FindBoost: Automatically add missing component dependencies The function _Boost_MISSING_DEPENDENCIES will look at the user-supplied component list, check the dependency information for each component using _Boost_COMPONENT_DEPENDENCIES, and will add any missing dependencies to the component list. This ensures that all required components will be searched for. --- Modules/FindBoost.cmake | 43 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 41b728dc7..19387ce69 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -688,6 +688,45 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) # message(STATUS "Dependencies for Boost::${component}: ${_boost_DEPS_STRING}") endfunction() +# +# Determine if any missing dependencies require adding to the component list. +# +# Sets _Boost_${COMPONENT}_DEPENDENCIES for each required component, +# plus _Boost_IMPORTED_TARGETS (TRUE if imported targets should be +# defined; FALSE if dependency information is unavailable). +# +# componentvar - the component list variable name +# +# +function(_Boost_MISSING_DEPENDENCIES componentvar) + # _boost_unprocessed_components - list of components requiring processing + # _boost_processed_components - components already processed (or currently being processed) + # _boost_new_components - new components discovered for future processing + # + list(APPEND _boost_unprocessed_components ${${componentvar}}) + + while(_boost_unprocessed_components) + list(APPEND _boost_processed_components ${_boost_unprocessed_components}) + foreach(component ${_boost_unprocessed_components}) + string(TOUPPER ${component} uppercomponent) + set(${_ret} ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE) + _Boost_COMPONENT_DEPENDENCIES("${component}" _Boost_${uppercomponent}_DEPENDENCIES) + set(_Boost_${uppercomponent}_DEPENDENCIES ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE) + set(_Boost_IMPORTED_TARGETS ${_Boost_IMPORTED_TARGETS} PARENT_SCOPE) + foreach(componentdep ${_Boost_${uppercomponent}_DEPENDENCIES}) + list(FIND _boost_processed_components "${componentdep}" _boost_component_found) + list(FIND _boost_new_components "${componentdep}" _boost_component_new) + if (_boost_component_found EQUAL -1 AND _boost_component_new EQUAL -1) + list(APPEND _boost_new_components ${componentdep}) + endif() + endforeach() + endforeach() + set(_boost_unprocessed_components ${_boost_new_components}) + unset(_boost_new_components) + endwhile() + set(${componentvar} ${_boost_processed_components} PARENT_SCOPE) +endfunction() + # # End functions/macros # @@ -1200,6 +1239,10 @@ if(Boost_VERSION AND Boost_FIND_COMPONENTS) endif() endif() +# Additional components may be required via component dependencies. +# Add any missing components to the list. +_Boost_MISSING_DEPENDENCIES(Boost_FIND_COMPONENTS) + # If the user changed any of our control inputs flush previous results. if(_Boost_CHANGE_LIBDIR OR _Boost_CHANGE_LIBNAME) foreach(COMPONENT ${_Boost_COMPONENTS_SEARCHED}) From 3f9b081f6ee85e0691c36496d989edbe8382589d Mon Sep 17 00:00:00 2001 From: Roger Leigh Date: Tue, 1 Dec 2015 22:01:50 +0000 Subject: [PATCH 004/255] FindBoost: Add imported targets Targets include: - Boost::boost: Target for header-only dependencies - Boost::: Target for specific component dependency - Boost::diagnostic_definitions: adds BOOST_LIB_DIAGNOSTIC - Boost::disable_autolinking: adds BOOST_ALL_NO_LIB - Boost::dynamic_linking: adds BOOST_ALL_DYN_LINK --- Modules/FindBoost.cmake | 122 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 19387ce69..e517a6a4e 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -54,6 +54,33 @@ # Boost__LIBRARY_DEBUG - Component library debug variant # Boost__LIBRARY_RELEASE - Component library release variant # +# The following :prop_tgt:`IMPORTED` targets are also defined:: +# +# Boost::boost - Target for header-only dependencies +# (Boost include directory) +# Boost:: - Target for specific component dependency +# (shared or static library); is lower- +# case +# Boost::diagnostic_definitions - interface target to enable diagnostic +# information about Boost's automatic linking +# during compilation (adds BOOST_LIB_DIAGNOSTIC) +# Boost::disable_autolinking - interface target to disable automatic +# linking with MSVC (adds BOOST_ALL_NO_LIB) +# Boost::dynamic_linking - interface target to enable dynamic linking +# linking with MSVC (adds BOOST_ALL_DYN_LINK) +# +# Implicit dependencies such as Boost::filesystem requiring +# Boost::system will be automatically detected and satisfied, even +# if system is not specified when using find_package and if +# Boost::system is not added to target_link_libraries. If using +# Boost::thread, then Thread::Thread will also be added automatically. +# +# It is important to note that the imported targets behave differently +# than variables created by this module: multiple calls to +# find_package(Boost) in the same directory or sub-directories with +# different options (e.g. static or shared) will not override the +# values of the targets created by the first call. +# # Users may set these hints or results as cache entries. Projects # should not read these entries directly but instead use the above # result variables. Note that some hint names start in upper-case @@ -142,6 +169,14 @@ # add_executable(foo foo.cc) # endif() # +# Example to find Boost libraries and use imported targets:: +# +# find_package(Boost 1.56 REQUIRED COMPONENTS +# date_time filesystem iostreams) +# add_executable(foo foo.cc) +# target_link_libraries(foo Boost::date_time Boost::filesystem +# Boost::iostreams) +# # Example to find Boost headers and some *static* libraries:: # # set(Boost_USE_STATIC_LIBS ON) # only find static libs @@ -822,6 +857,16 @@ if(Boost_DEBUG) "Boost_NO_SYSTEM_PATHS = ${Boost_NO_SYSTEM_PATHS}") endif() +# Supply Boost_LIB_DIAGNOSTIC_DEFINITIONS as a convenience target. It +# will only contain any interface definitions on WIN32, but is created +# on all platforms to keep end user code free from platform dependent +# code. Also provide convenience targets to disable autolinking and +# enable dynamic linking. +if(NOT TARGET Boost::diagnostic_definitions) + add_library(Boost::diagnostic_definitions INTERFACE IMPORTED) + add_library(Boost::disable_autolinking INTERFACE IMPORTED) + add_library(Boost::dynamic_linking INTERFACE IMPORTED) +endif() if(WIN32) # In windows, automatic linking is performed, so you do not have # to specify the libraries. If you are linking to a dynamic @@ -841,6 +886,12 @@ if(WIN32) # code to emit a #pragma message each time a library is selected # for linking. set(Boost_LIB_DIAGNOSTIC_DEFINITIONS "-DBOOST_LIB_DIAGNOSTIC") + set_target_properties(Boost::diagnostic_definitions PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "BOOST_LIB_DIAGNOSTIC") + set_target_properties(Boost::disable_autolinking PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "BOOST_ALL_NO_LIB") + set_target_properties(Boost::dynamic_linking PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "BOOST_ALL_DYN_LINK") endif() _Boost_CHECK_SPELLING(Boost_ROOT) @@ -1243,6 +1294,13 @@ endif() # Add any missing components to the list. _Boost_MISSING_DEPENDENCIES(Boost_FIND_COMPONENTS) +# If thread is required, get the thread libs as a dependency +list(FIND Boost_FIND_COMPONENTS thread _Boost_THREAD_DEPENDENCY_LIBS) +if(NOT _Boost_THREAD_DEPENDENCY_LIBS EQUAL -1) + include(CMakeFindDependencyMacro) + find_dependency(Threads) +endif() + # If the user changed any of our control inputs flush previous results. if(_Boost_CHANGE_LIBDIR OR _Boost_CHANGE_LIBNAME) foreach(COMPONENT ${_Boost_COMPONENTS_SEARCHED}) @@ -1485,6 +1543,70 @@ else() endforeach() endif() +# ------------------------------------------------------------------------ +# Add imported targets +# ------------------------------------------------------------------------ + +if(Boost_FOUND AND _Boost_IMPORTED_TARGETS) + # For header-only libraries + if(NOT TARGET Boost::boost) + add_library(Boost::boost INTERFACE IMPORTED) + if(Boost_INCLUDE_DIRS) + set_target_properties(Boost::boost PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}") + endif() + endif() + + foreach(COMPONENT ${Boost_FIND_COMPONENTS}) + if(NOT TARGET Boost::${COMPONENT}) + string(TOUPPER ${COMPONENT} UPPERCOMPONENT) + if(Boost_${UPPERCOMPONENT}_FOUND) + if(Boost_USE_STATIC_LIBS) + add_library(Boost::${COMPONENT} STATIC IMPORTED) + else() + # Even if Boost_USE_STATIC_LIBS is OFF, we might have static + # libraries as a result. + add_library(Boost::${COMPONENT} UNKNOWN IMPORTED) + endif() + if(Boost_INCLUDE_DIRS) + set_target_properties(Boost::${COMPONENT} PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}") + endif() + if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY}") + set_target_properties(Boost::${COMPONENT} PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION "${Boost_${UPPERCOMPONENT}_LIBRARY}") + endif() + if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG}") + set_property(TARGET Boost::${COMPONENT} APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(Boost::${COMPONENT} PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX" + IMPORTED_LOCATION_DEBUG "${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG}") + endif() + if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE}") + set_property(TARGET Boost::${COMPONENT} APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(Boost::${COMPONENT} PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX" + IMPORTED_LOCATION_RELEASE "${Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE}") + endif() + if(_Boost_${UPPERCOMPONENT}_DEPENDENCIES) + unset(_Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES) + foreach(dep ${_Boost_${UPPERCOMPONENT}_DEPENDENCIES}) + list(APPEND _Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES Boost::${dep}) + endforeach() + if(COMPONENT STREQUAL "thread") + list(APPEND _Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES Threads::Threads) + endif() + set_target_properties(Boost::${COMPONENT} PROPERTIES + INTERFACE_LINK_LIBRARIES "${_Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES}") + endif() + endif() + endif() + endforeach() +endif() + # ------------------------------------------------------------------------ # Notification to end user about what was found # ------------------------------------------------------------------------ From 9fd987507622c585f4e0131678654e0643fd9a50 Mon Sep 17 00:00:00 2001 From: Roger Leigh Date: Tue, 1 Dec 2015 22:05:35 +0000 Subject: [PATCH 005/255] Tests: Add FindBoost testcase for imported targets Enable by setting CMake_TEST_FindBoost to TRUE. --- Tests/CMakeLists.txt | 4 ++++ Tests/FindBoost/CMakeLists.txt | 10 ++++++++++ Tests/FindBoost/Test/CMakeLists.txt | 18 ++++++++++++++++++ Tests/FindBoost/Test/main.cxx | 26 ++++++++++++++++++++++++++ 4 files changed, 58 insertions(+) create mode 100644 Tests/FindBoost/CMakeLists.txt create mode 100644 Tests/FindBoost/Test/CMakeLists.txt create mode 100644 Tests/FindBoost/Test/main.cxx diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 5fd7159a5..6c4567d17 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1356,6 +1356,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release endif() endif() + if(CMake_TEST_FindBoost) + add_subdirectory(FindBoost) + endif() + if(CMake_TEST_FindGSL) add_subdirectory(FindGSL) endif() diff --git a/Tests/FindBoost/CMakeLists.txt b/Tests/FindBoost/CMakeLists.txt new file mode 100644 index 000000000..259ee266f --- /dev/null +++ b/Tests/FindBoost/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindBoost.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindBoost/Test" + "${CMake_BINARY_DIR}/Tests/FindBoost/Test" + ${build_generator_args} + --build-project TestFindBoost + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) diff --git a/Tests/FindBoost/Test/CMakeLists.txt b/Tests/FindBoost/Test/CMakeLists.txt new file mode 100644 index 000000000..ce50fc775 --- /dev/null +++ b/Tests/FindBoost/Test/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.1) +project(TestFindBoost CXX) +include(CTest) + +find_package(Boost REQUIRED COMPONENTS filesystem thread) + +add_executable(test_boost_tgt main.cxx) +target_link_libraries(test_boost_tgt + Boost::dynamic_linking + Boost::disable_autolinking + Boost::filesystem + Boost::thread) +add_test(NAME test_boost_tgt COMMAND test_boost_tgt) + +add_executable(test_boost_var main.cxx) +target_include_directories(test_boost_var PRIVATE ${Boost_INCLUDE_DIRS}) +target_link_libraries(test_boost_var PRIVATE ${Boost_FILESYSTEM_LIBRARIES} ${Boost_SYSTEM_LIBRARIES} ${Boost_THREAD_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) +add_test(NAME test_boost_var COMMAND test_boost_var) diff --git a/Tests/FindBoost/Test/main.cxx b/Tests/FindBoost/Test/main.cxx new file mode 100644 index 000000000..0f44f30b0 --- /dev/null +++ b/Tests/FindBoost/Test/main.cxx @@ -0,0 +1,26 @@ +#include +#include + +namespace +{ + + boost::mutex m1; + boost::recursive_mutex m2; + + void + threadmain() + { + boost::lock_guard lock1(m1); + boost::lock_guard lock2(m2); + + boost::filesystem::path p(boost::filesystem::current_path()); + } + +} + +int main() { + boost::thread foo(threadmain); + foo.join(); + + return 0; +} From d60cef773659d69ed2fce9b963d788ab422679b9 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 2 Dec 2015 09:42:34 -0500 Subject: [PATCH 006/255] Help: Add notes for topic 'FindBoost-imported-targets.rst' --- Help/release/dev/FindBoost-imported-targets.rst | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Help/release/dev/FindBoost-imported-targets.rst diff --git a/Help/release/dev/FindBoost-imported-targets.rst b/Help/release/dev/FindBoost-imported-targets.rst new file mode 100644 index 000000000..1129dedeb --- /dev/null +++ b/Help/release/dev/FindBoost-imported-targets.rst @@ -0,0 +1,5 @@ +FindBoost-imported-targets +-------------------------- + +* The :module:`FindBoost` module now provides imported targets + such as ``Boost::boost`` and ``Boost::filesystem``. From 4ffeab0e3c451854a4a9d424b47b2179c6cf6c6b Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 3 Dec 2015 00:01:09 -0500 Subject: [PATCH 007/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 15782b60d..141015de9 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20151202) +set(CMake_VERSION_PATCH 20151203) #set(CMake_VERSION_RC 1) From e76ee2c006777e268715b39ad71f49e3d18b11a4 Mon Sep 17 00:00:00 2001 From: Bartosz Kosiorek Date: Wed, 2 Dec 2015 22:34:25 +0100 Subject: [PATCH 008/255] iOS: Fix framework resource directory layout (#15848) A typical iOS application bundle (also Framework Bundle) contains the application executable and any resources used by the application (for instance, the application icon, other images, and localized content) in the top-level bundle directory. The same rule applies to Framework Bundles. --- Help/prop_tgt/MACOSX_BUNDLE.rst | 2 +- Help/prop_tgt/MACOSX_RPATH.rst | 6 +- Help/prop_tgt/RESOURCE.rst | 64 +++++++++++++++++-- Source/cmGeneratorTarget.cxx | 6 +- .../RunCMake/Framework/FrameworkLayout.cmake | 10 ++- .../OSXFrameworkLayout-build-check.cmake | 17 ++++- Tests/RunCMake/Framework/foo.h | 1 + .../iOSFrameworkLayout-build-check.cmake | 17 ++++- Tests/RunCMake/Framework/res.txt | 0 9 files changed, 107 insertions(+), 16 deletions(-) create mode 100644 Tests/RunCMake/Framework/foo.h create mode 100644 Tests/RunCMake/Framework/res.txt diff --git a/Help/prop_tgt/MACOSX_BUNDLE.rst b/Help/prop_tgt/MACOSX_BUNDLE.rst index 8d7d91416..7cd80462a 100644 --- a/Help/prop_tgt/MACOSX_BUNDLE.rst +++ b/Help/prop_tgt/MACOSX_BUNDLE.rst @@ -3,7 +3,7 @@ MACOSX_BUNDLE Build an executable as an Application Bundle on OS X or iOS. -When this property is set to true the executable when built on OS X +When this property is set to ``TRUE`` the executable when built on OS X or iOS will be created as an application bundle. This makes it a GUI executable that can be launched from the Finder. See the :prop_tgt:`MACOSX_FRAMEWORK_INFO_PLIST` target property for information about diff --git a/Help/prop_tgt/MACOSX_RPATH.rst b/Help/prop_tgt/MACOSX_RPATH.rst index 41bb8cc09..1f9a036bf 100644 --- a/Help/prop_tgt/MACOSX_RPATH.rst +++ b/Help/prop_tgt/MACOSX_RPATH.rst @@ -3,8 +3,8 @@ MACOSX_RPATH Whether this target on OS X or iOS is located at runtime using rpaths. -When this property is set to true, the directory portion of -the "install_name" field of this shared library will be ``@rpath`` +When this property is set to ``TRUE``, the directory portion of +the ``install_name`` field of this shared library will be ``@rpath`` unless overridden by :prop_tgt:`INSTALL_NAME_DIR`. This indicates the shared library is to be found at runtime using runtime paths (rpaths). @@ -18,6 +18,6 @@ can be controlled by the :prop_tgt:`INSTALL_RPATH` target property on the target linking to this target. Policy :policy:`CMP0042` was introduced to change the default value of -``MACOSX_RPATH`` to ``TRUE. This is because use of ``@rpath`` is a +``MACOSX_RPATH`` to ``TRUE``. This is because use of ``@rpath`` is a more flexible and powerful alternative to ``@executable_path`` and ``@loader_path``. diff --git a/Help/prop_tgt/RESOURCE.rst b/Help/prop_tgt/RESOURCE.rst index 5dad3ea1c..d837f7b33 100644 --- a/Help/prop_tgt/RESOURCE.rst +++ b/Help/prop_tgt/RESOURCE.rst @@ -1,11 +1,61 @@ RESOURCE -------- -Specify resource files in a :prop_tgt:`FRAMEWORK` shared library target. +Specify resource files in a :prop_tgt:`FRAMEWORK` or :prop_tgt:`BUNDLE`. -Shared library targets marked with the :prop_tgt:`FRAMEWORK` property generate -frameworks on OS X, iOS and normal shared libraries on other platforms. -This property may be set to a list of files to be placed in the -``Resources`` directory inside the framework folder. On non-Apple -platforms these files may be installed using the ``RESOURCE`` option to -the ``install(TARGETS)`` command. +Target marked with the :prop_tgt:`FRAMEWORK` or :prop_tgt:`BUNDLE` property +generate framework or application bundle (both OS X and iOS is supported) +or normal shared libraries on other platforms. +This property may be set to a list of files to be placed in the corresponding +directory (eg. ``Resources`` directory for OS X) inside the bundle. +On non-Apple platforms these files may be installed using the ``RESOURCE`` +option to the ``install(TARGETS)`` command. + +Following example of Application Bundle: + +.. code-block:: cmake + + add_executable(ExecutableTarget + addDemo.c + resourcefile.txt + appresourcedir/appres.txt + ) + + target_link_libraries(ExecutableTarget heymath mul) + + set(RESOURCE_FILES + resourcefile.txt + appresourcedir/appres.txt + ) + + set_target_properties(ExecutableTarget PROPERTIES + MACOSX_BUNDLE TRUE + MACOSX_FRAMEWORK_IDENTIFIER org.cmake.ExecutableTarget + RESOURCE "${RESOURCE_FILES}" + ) + +will produce flat structure for iOS systems:: + + ExecutableTarget.app + appres.txt + ExecutableTarget + Info.plist + resourcefile.txt + +For OS X systems it will produce following directory structure:: + + ExecutableTarget.app/ + Contents + Info.plist + MacOS + ExecutableTarget + Resources + appres.txt + resourcefile.txt + +For Linux, such cmake script produce following files:: + + ExecutableTarget + Resources + appres.txt + resourcefile.txt diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index cc424b473..b05fb4191 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -3752,7 +3752,11 @@ void cmGeneratorTarget::ConstructSourceFileFlags() const if(cmSourceFile* sf = this->Makefile->GetSource(*it)) { SourceFileFlags& flags = this->SourceFlagsMap[sf]; - flags.MacFolder = "Resources"; + flags.MacFolder = ""; + if(!this->Makefile->PlatformIsAppleIos()) + { + flags.MacFolder = "Resources"; + } flags.Type = cmGeneratorTarget::SourceFileTypeResource; } } diff --git a/Tests/RunCMake/Framework/FrameworkLayout.cmake b/Tests/RunCMake/Framework/FrameworkLayout.cmake index 107afdfe9..51847555b 100644 --- a/Tests/RunCMake/Framework/FrameworkLayout.cmake +++ b/Tests/RunCMake/Framework/FrameworkLayout.cmake @@ -1,5 +1,11 @@ cmake_minimum_required(VERSION 3.4) enable_language(C) -add_library(Framework SHARED foo.c) -set_target_properties(Framework PROPERTIES FRAMEWORK TRUE) +add_library(Framework SHARED + foo.c + foo.h + res.txt) +set_target_properties(Framework PROPERTIES + FRAMEWORK TRUE + PUBLIC_HEADER foo.h + RESOURCE "res.txt") diff --git a/Tests/RunCMake/Framework/OSXFrameworkLayout-build-check.cmake b/Tests/RunCMake/Framework/OSXFrameworkLayout-build-check.cmake index 27d10d8cb..da1ccb40b 100644 --- a/Tests/RunCMake/Framework/OSXFrameworkLayout-build-check.cmake +++ b/Tests/RunCMake/Framework/OSXFrameworkLayout-build-check.cmake @@ -1,7 +1,10 @@ set(framework-dir "${RunCMake_TEST_BINARY_DIR}/Framework.framework") -set(plist-file "${framework-dir}/Resources/Info.plist") +set(framework-resources "${framework-dir}/Resources") +set(framework-resource-file "${framework-resources}/res.txt") set(framework-library "${framework-dir}/Framework") set(framework-versions "${framework-dir}/Versions") +set(plist-file "${framework-resources}/Info.plist") +set(framework-header "${framework-dir}/Headers/foo.h") if(NOT IS_DIRECTORY ${framework-dir}) message(SEND_ERROR "Framework not found at ${framework-dir}") @@ -15,6 +18,18 @@ if(NOT EXISTS ${framework-library}) message(SEND_ERROR "Framework library not found at ${framework-library}") endif() +if(NOT EXISTS ${framework-resource-file}) + message(SEND_ERROR "Framework resource file not found at ${framework-resource-file}") +endif() + if(NOT EXISTS ${framework-versions}) message(SEND_ERROR "Framework versions not found at ${framework-versions}") endif() + +if(NOT EXISTS ${framework-resources}) + message(SEND_ERROR "Framework Resources not found at ${framework-resources}") +endif() + +if(NOT EXISTS ${framework-header}) + message(SEND_ERROR "Framework header file not found at ${framework-header}") +endif() diff --git a/Tests/RunCMake/Framework/foo.h b/Tests/RunCMake/Framework/foo.h new file mode 100644 index 000000000..5d5f8f0c9 --- /dev/null +++ b/Tests/RunCMake/Framework/foo.h @@ -0,0 +1 @@ +int foo(); diff --git a/Tests/RunCMake/Framework/iOSFrameworkLayout-build-check.cmake b/Tests/RunCMake/Framework/iOSFrameworkLayout-build-check.cmake index 373baad7a..b81a5f732 100644 --- a/Tests/RunCMake/Framework/iOSFrameworkLayout-build-check.cmake +++ b/Tests/RunCMake/Framework/iOSFrameworkLayout-build-check.cmake @@ -1,7 +1,10 @@ set(framework-dir "${RunCMake_TEST_BINARY_DIR}/Framework.framework") -set(plist-file "${framework-dir}/Info.plist") +set(framework-resources "${framework-dir}/Resources") +set(framework-resource-file "${framework-dir}/res.txt") set(framework-library "${framework-dir}/Framework") set(framework-versions "${framework-dir}/Versions") +set(plist-file "${framework-dir}/Info.plist") +set(framework-header "${framework-dir}/Headers/foo.h") if(NOT IS_DIRECTORY ${framework-dir}) message(SEND_ERROR "Framework not found at ${framework-dir}") @@ -15,6 +18,18 @@ if(NOT EXISTS ${framework-library}) message(SEND_ERROR "Framework library not found at ${framework-library}") endif() +if(NOT EXISTS ${framework-resource-file}) + message(SEND_ERROR "Framework resource file not found at ${framework-resource-file}") +endif() + if(EXISTS ${framework-versions}) message(SEND_ERROR "Framework versions found at ${framework-versions}") endif() + +if(EXISTS ${framework-resources}) + message(SEND_ERROR "Framework Resources found at ${framework-resources}") +endif() + +if(NOT EXISTS ${framework-header}) + message(SEND_ERROR "Framework headers not found at ${framework-header}") +endif() diff --git a/Tests/RunCMake/Framework/res.txt b/Tests/RunCMake/Framework/res.txt new file mode 100644 index 000000000..e69de29bb From d8b251e2ea84e612dc30a1c9690a8b299aeb30fd Mon Sep 17 00:00:00 2001 From: Marc Chevrier Date: Thu, 3 Dec 2015 12:34:51 +0100 Subject: [PATCH 009/255] FindJava: Fix typos in IdlJ and JarSigner component implementation Fix typos introduced by commit v3.4.0-rc1~257^2~2 (FindJava: Add support for idlj and jarsigner tools, 2015-07-31) to correctly report when these components are found. --- Modules/FindJava.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake index 9f8799783..cc67df662 100644 --- a/Modules/FindJava.cmake +++ b/Modules/FindJava.cmake @@ -228,12 +228,12 @@ if(Java_FIND_COMPONENTS) endif() elseif(component STREQUAL "IdlJ") list(APPEND _JAVA_REQUIRED_VARS Java_IDLJ_EXECUTABLE) - if(Java_IdlJ_EXECUTABLE) - set(Java_Extra_FOUND TRUE) + if(Java_IDLJ_EXECUTABLE) + set(Java_IdlJ_FOUND TRUE) endif() elseif(component STREQUAL "JarSigner") list(APPEND _JAVA_REQUIRED_VARS Java_JARSIGNER_EXECUTABLE) - if(Java_IDLJ_EXECUTABLE) + if(Java_JARSIGNER_EXECUTABLE) set(Java_JarSigner_FOUND TRUE) endif() else() From 56c11eee13604e163eb5a5d9092df405be0e9a5c Mon Sep 17 00:00:00 2001 From: Marc Chevrier Date: Thu, 3 Dec 2015 12:35:37 +0100 Subject: [PATCH 010/255] UseJava: Allow relative path to manifest file just as with other sources --- Modules/UseJava.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index dced6eca8..6146d78df 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -444,7 +444,7 @@ function(add_jar _TARGET_NAME) if (_add_jar_MANIFEST) set(_MANIFEST_OPTION m) - set(_MANIFEST_VALUE ${_add_jar_MANIFEST}) + get_filename_component (_MANIFEST_VALUE "${_add_jar_MANIFEST}" ABSOLUTE) endif () if (LIBRARY_OUTPUT_PATH) From ddbda72288f022fa558d8253c8894687634448c1 Mon Sep 17 00:00:00 2001 From: James Johnston Date: Thu, 3 Dec 2015 19:10:19 +0000 Subject: [PATCH 011/255] Embarcadero: Fix bug where duplicate Ninja job pools would be created. If the platform file was included multiple times, it was possible that duplicate Ninja job pools would be created. --- Modules/Platform/Windows-Embarcadero.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Modules/Platform/Windows-Embarcadero.cmake b/Modules/Platform/Windows-Embarcadero.cmake index 5295a48e6..102e3a651 100644 --- a/Modules/Platform/Windows-Embarcadero.cmake +++ b/Modules/Platform/Windows-Embarcadero.cmake @@ -78,7 +78,11 @@ set (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_SHARED_LINKER_FLAGS_R # invocations within a single working directory. if(NOT DEFINED CMAKE_JOB_POOL_LINK) set(CMAKE_JOB_POOL_LINK BCC32LinkPool) - set_property(GLOBAL APPEND PROPERTY JOB_POOLS BCC32LinkPool=1) + get_property(_bccjp GLOBAL PROPERTY JOB_POOLS) + if(NOT _bccjp MATCHES "BCC32LinkPool=") + set_property(GLOBAL APPEND PROPERTY JOB_POOLS BCC32LinkPool=1) + endif() + unset(_bccjp) endif() macro(__embarcadero_language lang) From fc656fa4fe2926c7a50de91ff1b5564802ac4a7e Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Wed, 18 Nov 2015 22:40:59 +0100 Subject: [PATCH 012/255] cmake-gui: Add regex explorer window --- Help/release/dev/regex-explorer.rst | 6 + Source/QtDialog/CMakeLists.txt | 4 + Source/QtDialog/CMakeSetupDialog.cxx | 10 ++ Source/QtDialog/CMakeSetupDialog.h | 1 + Source/QtDialog/RegexExplorer.cxx | 166 +++++++++++++++++++++++++++ Source/QtDialog/RegexExplorer.h | 48 ++++++++ Source/QtDialog/RegexExplorer.ui | 155 +++++++++++++++++++++++++ 7 files changed, 390 insertions(+) create mode 100644 Help/release/dev/regex-explorer.rst create mode 100644 Source/QtDialog/RegexExplorer.cxx create mode 100644 Source/QtDialog/RegexExplorer.h create mode 100644 Source/QtDialog/RegexExplorer.ui diff --git a/Help/release/dev/regex-explorer.rst b/Help/release/dev/regex-explorer.rst new file mode 100644 index 000000000..21478166d --- /dev/null +++ b/Help/release/dev/regex-explorer.rst @@ -0,0 +1,6 @@ +regex-explorer +-------------- + +* The Qt base CMake GUI got a Regular Expression Explorer which could be used to + create and evaluate regular expressions in real-time. The explorer window + is available via the ``Tools`` menu. diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 66fd18b82..cad11f52a 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -113,12 +113,15 @@ set(SRCS QCMakeCacheView.h QCMakeWidgets.cxx QCMakeWidgets.h + RegexExplorer.cxx + RegexExplorer.h ) QT4_WRAP_UI(UI_SRCS CMakeSetupDialog.ui Compilers.ui CrossCompiler.ui AddCacheEntry.ui + RegexExplorer.ui ) QT4_WRAP_CPP(MOC_SRCS AddCacheEntry.h @@ -128,6 +131,7 @@ QT4_WRAP_CPP(MOC_SRCS QCMake.h QCMakeCacheView.h QCMakeWidgets.h + RegexExplorer.h ) QT4_ADD_RESOURCES(RC_SRCS CMakeSetup.qrc) diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index 748dd7d7e..2b12834f4 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -33,6 +33,7 @@ #include "QCMakeCacheView.h" #include "AddCacheEntry.h" #include "FirstConfigure.h" +#include "RegexExplorer.h" #include "cmSystemTools.h" #include "cmVersion.h" @@ -125,6 +126,9 @@ CMakeSetupDialog::CMakeSetupDialog() this, SLOT(doInstallForCommandLine())); #endif ToolsMenu->addSeparator(); + ToolsMenu->addAction(tr("Regular Expression Explorer..."), + this, SLOT(doRegexExplorerDialog())); + ToolsMenu->addSeparator(); ToolsMenu->addAction(tr("&Find in Output..."), this, SLOT(doOutputFindDialog()), QKeySequence::Find); @@ -1272,6 +1276,12 @@ void CMakeSetupDialog::doOutputFindDialog() } } +void CMakeSetupDialog::doRegexExplorerDialog() +{ + RegexExplorer dialog(this); + dialog.exec(); +} + void CMakeSetupDialog::doOutputFindPrev() { doOutputFindNext(false); diff --git a/Source/QtDialog/CMakeSetupDialog.h b/Source/QtDialog/CMakeSetupDialog.h index 1b26c648c..bfd2bc9ef 100644 --- a/Source/QtDialog/CMakeSetupDialog.h +++ b/Source/QtDialog/CMakeSetupDialog.h @@ -82,6 +82,7 @@ protected slots: void doOutputFindNext(bool directionForward = true); void doOutputFindPrev(); void doOutputErrorNext(); + void doRegexExplorerDialog(); protected: diff --git a/Source/QtDialog/RegexExplorer.cxx b/Source/QtDialog/RegexExplorer.cxx new file mode 100644 index 000000000..dfcf048d1 --- /dev/null +++ b/Source/QtDialog/RegexExplorer.cxx @@ -0,0 +1,166 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Kitware, Inc., Gregor Jasny + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#include "RegexExplorer.h" + +RegexExplorer::RegexExplorer(QWidget* p) : QDialog(p), m_matched(false) +{ + this->setupUi(this); + + for(int i = 1; i < cmsys::RegularExpression::NSUBEXP; ++i) + { + matchNumber->addItem( + QString("Match %1").arg(QString::number(i)), + QVariant(i)); + } + matchNumber->setCurrentIndex(0); +} + +void RegexExplorer::setStatusColor(QWidget* widget, bool successful) +{ + QColor color = successful ? QColor(0, 127, 0) : Qt::red; + + QPalette palette = widget->palette(); + palette.setColor(QPalette::Foreground, color); + widget->setPalette(palette); +} + +void RegexExplorer::on_regularExpression_textChanged(const QString& text) +{ +#ifdef QT_NO_STL + m_regex = text.toAscii().constData(); +#else + m_regex = text.toStdString(); +#endif + + bool validExpression = + stripEscapes(m_regex) && m_regexParser.compile(m_regex); + if(!validExpression) + { + m_regexParser.set_invalid(); + } + + setStatusColor(labelRegexValid, validExpression); + + on_inputText_textChanged(); +} + +void RegexExplorer::on_inputText_textChanged() +{ + if(m_regexParser.is_valid()) + { + QString plainText = inputText->toPlainText(); +#ifdef QT_NO_STL + m_text = plainText.toAscii().constData(); +#else + m_text = plainText.toStdString(); +#endif + m_matched = m_regexParser.find(m_text); + } + else + { + m_matched = false; + } + + setStatusColor(labelRegexMatch, m_matched); + + if(!m_matched) + { + clearMatch(); + return; + } + +#ifdef QT_NO_STL + QString matchText = m_regexParser.match(0).c_str(); +#else + QString matchText = QString::fromStdString(m_regexParser.match(0)); +#endif + match0->setPlainText(matchText); + + on_matchNumber_currentIndexChanged(matchNumber->currentIndex()); +} + +void RegexExplorer::on_matchNumber_currentIndexChanged(int index) +{ + if(!m_matched) + { + return; + } + + QVariant itemData = matchNumber->itemData(index); + int idx = itemData.toInt(); + + if(idx < 1 || idx >= cmsys::RegularExpression::NSUBEXP) + { + return; + } + +#ifdef QT_NO_STL + QString match = m_regexParser.match(idx).c_str(); +#else + QString match = QString::fromStdString(m_regexParser.match(idx)); +#endif + matchN->setPlainText(match); +} + +void RegexExplorer::clearMatch() +{ + match0->clear(); + matchN->clear(); +} + +bool RegexExplorer::stripEscapes(std::string& source) +{ + const char* in = source.c_str(); + + std::string result; + result.reserve(source.size()); + + for(char inc = *in; inc != '\0'; inc = *++in) + { + if(inc == '\\') + { + char nextc = in[1]; + if(nextc == 't') + { + result.append(1, '\t'); + in++; + } + else if(nextc == 'n') + { + result.append(1, '\n'); + in++; + } + else if(nextc == 't') + { + result.append(1, '\t'); + in++; + } + else if(isalnum(nextc) || nextc == '\0') + { + return false; + } + else + { + result.append(1, nextc); + in++; + } + } + else + { + result.append(1, inc); + } + } + + source = result; + return true; +} diff --git a/Source/QtDialog/RegexExplorer.h b/Source/QtDialog/RegexExplorer.h new file mode 100644 index 000000000..2ac9c3e2e --- /dev/null +++ b/Source/QtDialog/RegexExplorer.h @@ -0,0 +1,48 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Kitware, Inc., Gregor Jasny + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#ifndef RegexExplorer_h +#define RegexExplorer_h + +#include +#include +#include + +#include "ui_RegexExplorer.h" + +class QString; +class QWidget; + +class RegexExplorer : public QDialog, public Ui::RegexExplorer +{ + Q_OBJECT +public: + RegexExplorer(QWidget* p); + +private slots: + void on_regularExpression_textChanged(const QString& text); + void on_inputText_textChanged(); + void on_matchNumber_currentIndexChanged(int index); + +private: + static void setStatusColor(QWidget* widget, bool successful); + static bool stripEscapes(std::string& regex); + + void clearMatch(); + + cmsys::RegularExpression m_regexParser; + std::string m_text; + std::string m_regex; + bool m_matched; +}; + +#endif diff --git a/Source/QtDialog/RegexExplorer.ui b/Source/QtDialog/RegexExplorer.ui new file mode 100644 index 000000000..2c2d7616f --- /dev/null +++ b/Source/QtDialog/RegexExplorer.ui @@ -0,0 +1,155 @@ + + + RegexExplorer + + + + 0 + 0 + 639 + 555 + + + + Regular Expression Explorer + + + + + + Input Text + + + + + + + + + + + + Regular Expression + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + Valid + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + Match + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + Complete Match + + + + + + + true + + + + + + + + + false + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + true + + + + + + + + From f3b3219c9687e54a83dc7e5dabb0afc4637bb799 Mon Sep 17 00:00:00 2001 From: James Johnston Date: Thu, 3 Dec 2015 19:36:13 +0000 Subject: [PATCH 013/255] Embarcadero/Watcom: Properly skip VSResource test for other generators. This test should be skipped based on the chosen compiler, not the chosen generator. --- Tests/CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 5fd7159a5..06eb62970 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -269,8 +269,7 @@ if(BUILD_TESTING) set(TEST_RESOURCES TRUE) endif() # for borland and watcom there is no resource support - if("${CMAKE_GENERATOR}" MATCHES "WMake" OR - "${CMAKE_GENERATOR}" MATCHES "Borland") + if(WATCOM OR BORLAND) set(TEST_RESOURCES FALSE) endif() if(TEST_RESOURCES) From 060442c2e866c44ecf0c479e49e1d5ae35e8c6fb Mon Sep 17 00:00:00 2001 From: James Johnston Date: Thu, 3 Dec 2015 20:42:30 +0000 Subject: [PATCH 014/255] Embarcadero: Check code using CMAKE_CXX_COMPILER_ID and CMAKE_C_COMPILER_ID. The CMAKE_CXX_COMPILER_ID and CMAKE_C_COMPILER_ID variables are set to "Borland" for older versions of the compiler. Newer CodeGear/Embarcadero compilers will have those variables set to "Embarcadero". Search for lines of code referencing both the variable name and Borland to be sure that they also refer to Embarcadero. --- Modules/GenerateExportHeader.cmake | 4 ++++ Tests/CompileOptions/CMakeLists.txt | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index 82054256a..4f4efbcf3 100644 --- a/Modules/GenerateExportHeader.cmake +++ b/Modules/GenerateExportHeader.cmake @@ -230,7 +230,11 @@ macro(_test_compiler_hidden_visibility) endmacro() macro(_test_compiler_has_deprecated) + # NOTE: Some Embarcadero compilers silently compile __declspec(deprecated) + # without error, but this is not a documented feature and the attribute does + # not actually generate any warnings. if(CMAKE_CXX_COMPILER_ID MATCHES Borland + OR CMAKE_CXX_COMPILER_ID MATCHES Embarcadero OR CMAKE_CXX_COMPILER_ID MATCHES HP OR GCC_TOO_OLD OR CMAKE_CXX_COMPILER_ID MATCHES PGI diff --git a/Tests/CompileOptions/CMakeLists.txt b/Tests/CompileOptions/CMakeLists.txt index 05a5f826f..692e0de0c 100644 --- a/Tests/CompileOptions/CMakeLists.txt +++ b/Tests/CompileOptions/CMakeLists.txt @@ -22,7 +22,7 @@ set_property(TARGET CompileOptions PROPERTY COMPILE_OPTIONS ${cxx_tests} ) -if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|Borland") +if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|Borland|Embarcadero") set_property(TARGET CompileOptions APPEND PROPERTY COMPILE_OPTIONS "-DTEST_OCTOTHORPE=\"#\"" ) From 25211d756fad353e96d29e289d40d780a5341c92 Mon Sep 17 00:00:00 2001 From: James Johnston Date: Thu, 3 Dec 2015 21:17:26 +0000 Subject: [PATCH 015/255] Compiler ID: Compiler versions must be a valid, numeric version string. This test helps catch errors in compiler identification. --- Tests/CMakeOnly/CompilerIdC/CMakeLists.txt | 7 +++++++ Tests/CMakeOnly/CompilerIdCXX/CMakeLists.txt | 7 +++++++ Tests/CMakeOnly/CompilerIdFortran/CMakeLists.txt | 7 +++++++ 3 files changed, 21 insertions(+) diff --git a/Tests/CMakeOnly/CompilerIdC/CMakeLists.txt b/Tests/CMakeOnly/CompilerIdC/CMakeLists.txt index 848ffdd36..6fea73eb8 100644 --- a/Tests/CMakeOnly/CompilerIdC/CMakeLists.txt +++ b/Tests/CMakeOnly/CompilerIdC/CMakeLists.txt @@ -12,3 +12,10 @@ foreach(v message(SEND_ERROR "${v} not set!") endif() endforeach() + +# Version numbers may only contain numbers and periods. +if(NOT CMAKE_C_COMPILER_VERSION MATCHES + "^([0-9]+)(\\.([0-9]+))?(\\.([0-9]+))?(\\.([0-9]+))?$" + ) + message(SEND_ERROR "Compiler version is not numeric!") +endif() diff --git a/Tests/CMakeOnly/CompilerIdCXX/CMakeLists.txt b/Tests/CMakeOnly/CompilerIdCXX/CMakeLists.txt index 94ac31e4c..05e6bb222 100644 --- a/Tests/CMakeOnly/CompilerIdCXX/CMakeLists.txt +++ b/Tests/CMakeOnly/CompilerIdCXX/CMakeLists.txt @@ -12,3 +12,10 @@ foreach(v message(SEND_ERROR "${v} not set!") endif() endforeach() + +# Version numbers may only contain numbers and periods. +if(NOT CMAKE_CXX_COMPILER_VERSION MATCHES + "^([0-9]+)(\\.([0-9]+))?(\\.([0-9]+))?(\\.([0-9]+))?$" + ) + message(SEND_ERROR "Compiler version is not numeric!") +endif() diff --git a/Tests/CMakeOnly/CompilerIdFortran/CMakeLists.txt b/Tests/CMakeOnly/CompilerIdFortran/CMakeLists.txt index 02e466887..067fb8cd3 100644 --- a/Tests/CMakeOnly/CompilerIdFortran/CMakeLists.txt +++ b/Tests/CMakeOnly/CompilerIdFortran/CMakeLists.txt @@ -12,3 +12,10 @@ foreach(v message(SEND_ERROR "${v} not set!") endif() endforeach() + +# Version numbers may only contain numbers and periods. +if(NOT CMAKE_Fortran_COMPILER_VERSION MATCHES + "^([0-9]+)(\\.([0-9]+))?(\\.([0-9]+))?(\\.([0-9]+))?$" + ) + message(SEND_ERROR "Compiler version is not numeric!") +endif() From 7a3277276e69c92d0f69674cdc27bae11bcbc14f Mon Sep 17 00:00:00 2001 From: James Johnston Date: Thu, 3 Dec 2015 21:24:56 +0000 Subject: [PATCH 016/255] Embarcadero: Fix erroneous interpretation of __CODEGEARC_VERSION__. As per the following link: http://docwiki.embarcadero.com/RADStudio/Seattle/en/Example_of_CODEGEARC_VERSION_Macro The major/minor versions must be decoded as a hex string, while the patch version must be decoded as a normal decimal string. As an example, C++ Builder XE 8.1's bcc32.exe sets this macro to 0x070189C9. The file version of bcc32.exe is 7.1.5570.35273. Therefore, the correct interpretation to COMPILER_VERSION would be 7.1.35273. --- Modules/Compiler/Embarcadero-DetermineCompiler.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Compiler/Embarcadero-DetermineCompiler.cmake b/Modules/Compiler/Embarcadero-DetermineCompiler.cmake index 2feedac35..8375624e9 100644 --- a/Modules/Compiler/Embarcadero-DetermineCompiler.cmake +++ b/Modules/Compiler/Embarcadero-DetermineCompiler.cmake @@ -4,4 +4,4 @@ set(_compiler_id_pp_test "defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__ set(_compiler_id_version_compute " # define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__CODEGEARC_VERSION__>>24 & 0x00FF) # define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__CODEGEARC_VERSION__>>16 & 0x00FF) -# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_HEX@(__CODEGEARC_VERSION__ & 0xFFFF)") +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__CODEGEARC_VERSION__ & 0xFFFF)") From 7410e2ed61851385d0c06dd174a4782a54c44ab0 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 4 Dec 2015 00:01:09 -0500 Subject: [PATCH 017/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 141015de9..81d33c293 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20151203) +set(CMake_VERSION_PATCH 20151204) #set(CMake_VERSION_RC 1) From 4d4fcabdfd9ceb02d947f6631370f6091e1ed337 Mon Sep 17 00:00:00 2001 From: Marc Chevrier Date: Thu, 3 Dec 2015 12:37:26 +0100 Subject: [PATCH 018/255] FindJNI: Add support for AIX java sdk --- Modules/FindJNI.cmake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake index cbe21d7e1..135038c5b 100644 --- a/Modules/FindJNI.cmake +++ b/Modules/FindJNI.cmake @@ -63,7 +63,7 @@ macro(java_append_library_directories _var) elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64") set(_java_libarch "ppc64" "ppc") elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)") - set(_java_libarch "ppc") + set(_java_libarch "ppc" "ppc64") elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^sparc") # Both flavours can run on the same processor set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "sparc" "sparcv9") @@ -271,7 +271,8 @@ find_path(JAVA_INCLUDE_PATH jni.h ${JAVA_AWT_INCLUDE_DIRECTORIES} ) -find_path(JAVA_INCLUDE_PATH2 jni_md.h +find_path(JAVA_INCLUDE_PATH2 NAMES jni_md.h jniport.h + PATHS ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH}/darwin ${JAVA_INCLUDE_PATH}/win32 @@ -281,6 +282,7 @@ find_path(JAVA_INCLUDE_PATH2 jni_md.h ${JAVA_INCLUDE_PATH}/solaris ${JAVA_INCLUDE_PATH}/hp-ux ${JAVA_INCLUDE_PATH}/alpha + ${JAVA_INCLUDE_PATH}/aix ) find_path(JAVA_AWT_INCLUDE_PATH jawt.h From d5d90f5ec8792fafbe754e2c943825267f7aaff1 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Thu, 3 Dec 2015 19:19:37 +0100 Subject: [PATCH 019/255] KWSys 2015-12-03 (6bfc1aef) Extract upstream KWSys using the following shell commands. $ git archive --prefix=upstream-kwsys/ 6bfc1aef | tar x $ git shortlog --no-merges --abbrev=8 --format='%h %s' 9596e98d..6bfc1aef Rolf Eike Beer (6): 9e9c8ae3 SystemTools: extend test coverage of SystemTools::MakeDirectory() 3f3d9eb5 SystemTools: add basic tests for SystemTools::FindFile() 9ca5f108 SystemTools: entirely remove the extension code on non-Windows platforms 29f82f78 SystemTools: avoid needless copy of std::string ac667cdc SystemTools: remove 2 more explicit calls to FileIsDirectory() 6bfc1aef SystemTools: do not call FileExists() before calling FileIsDirectory() --- SystemTools.cxx | 26 +++--- testSystemTools.cxx | 188 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 197 insertions(+), 17 deletions(-) diff --git a/SystemTools.cxx b/SystemTools.cxx index 37fe42199..82087f060 100644 --- a/SystemTools.cxx +++ b/SystemTools.cxx @@ -2402,8 +2402,7 @@ bool SystemTools::CopyFileAlways(const std::string& source, const std::string& d // name as the source in that directory. std::string destination_dir; - if(SystemTools::FileExists(destination) && - SystemTools::FileIsDirectory(destination)) + if(SystemTools::FileIsDirectory(destination)) { destination_dir = real_destination; SystemTools::ConvertToUnixSlashes(real_destination); @@ -2969,19 +2968,14 @@ std::string SystemTools::FindProgram( const std::vector& userPaths, bool no_system_path) { - std::vector extensions; std::string tryPath; #if defined (_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) - bool hasExtension = false; + std::vector extensions; // check to see if the name already has a .xxx at // the end of it - if(name.size() > 3 && name[name.size()-4] == '.') - { - hasExtension = true; - } // on windows try .com then .exe - if(!hasExtension) + if(name.size() <= 3 || name[name.size()-4] != '.') { extensions.push_back(".com"); extensions.push_back(".exe"); @@ -2992,8 +2986,7 @@ std::string SystemTools::FindProgram( { tryPath = name; tryPath += *i; - if(SystemTools::FileExists(tryPath) && - !SystemTools::FileIsDirectory(tryPath)) + if(SystemTools::FileExists(tryPath, true)) { return SystemTools::CollapseFullPath(tryPath); } @@ -3002,11 +2995,9 @@ std::string SystemTools::FindProgram( #endif // now try just the name - tryPath = name; - if(SystemTools::FileExists(tryPath) && - !SystemTools::FileIsDirectory(tryPath)) + if(SystemTools::FileExists(name, true)) { - return SystemTools::CollapseFullPath(tryPath); + return SystemTools::CollapseFullPath(name); } // now construct the path std::vector path; @@ -3043,6 +3034,7 @@ std::string SystemTools::FindProgram( // Remove double quotes from the path on windows SystemTools::ReplaceString(*p, "\"", ""); #endif +#if defined (_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) // first try with extensions for(std::vector::iterator ext = extensions.begin(); ext != extensions.end(); ++ext) @@ -3055,6 +3047,7 @@ std::string SystemTools::FindProgram( return SystemTools::CollapseFullPath(tryPath); } } +#endif // now try it without them tryPath = *p; tryPath += name; @@ -3133,8 +3126,7 @@ std::string SystemTools tryPath = *p; tryPath += name; tryPath += ".framework"; - if(SystemTools::FileExists(tryPath) - && SystemTools::FileIsDirectory(tryPath)) + if(SystemTools::FileIsDirectory(tryPath)) { return SystemTools::CollapseFullPath(tryPath); } diff --git a/testSystemTools.cxx b/testSystemTools.cxx index a0f904f72..4d97688fc 100644 --- a/testSystemTools.cxx +++ b/testSystemTools.cxx @@ -172,6 +172,63 @@ static bool CheckFileOperations() << testNewDir << std::endl; res = false; } + // calling it again should just return true + if (!kwsys::SystemTools::MakeDirectory(testNewDir)) + { + std::cerr + << "Problem with second call to MakeDirectory for: " + << testNewDir << std::endl; + res = false; + } + // calling with 0 pointer should return false + if (kwsys::SystemTools::MakeDirectory(0)) + { + std::cerr + << "Problem with MakeDirectory(0)" + << std::endl; + res = false; + } + // calling with an empty string should return false + if (kwsys::SystemTools::MakeDirectory(std::string())) + { + std::cerr + << "Problem with MakeDirectory(std::string())" + << std::endl; + res = false; + } + // check existence + if (!kwsys::SystemTools::FileExists(testNewDir.c_str(), false)) + { + std::cerr + << "Problem with FileExists as C string and not file for: " + << testNewDir << std::endl; + res = false; + } + // remove it + if (!kwsys::SystemTools::RemoveADirectory(testNewDir)) + { + std::cerr + << "Problem with RemoveADirectory for: " + << testNewDir << std::endl; + res = false; + } + // check existence + if (kwsys::SystemTools::FileExists(testNewDir.c_str(), false)) + { + std::cerr + << "After RemoveADirectory: " + << "Problem with FileExists as C string and not file for: " + << testNewDir << std::endl; + res = false; + } + // create it using the char* version + if (!kwsys::SystemTools::MakeDirectory(testNewDir.c_str())) + { + std::cerr + << "Problem with second call to MakeDirectory as C string for: " + << testNewDir << std::endl; + res = false; + } if (!kwsys::SystemTools::Touch(testNewFile.c_str(), true)) { @@ -180,6 +237,97 @@ static bool CheckFileOperations() << testNewFile << std::endl; res = false; } + // calling MakeDirectory with something that is no file should fail + if (kwsys::SystemTools::MakeDirectory(testNewFile)) + { + std::cerr + << "Problem with to MakeDirectory for: " + << testNewFile << std::endl; + res = false; + } + + // calling with 0 pointer should return false + if (kwsys::SystemTools::FileExists(0)) + { + std::cerr + << "Problem with FileExists(0)" + << std::endl; + res = false; + } + if (kwsys::SystemTools::FileExists(0, true)) + { + std::cerr + << "Problem with FileExists(0) as file" + << std::endl; + res = false; + } + // calling with an empty string should return false + if (kwsys::SystemTools::FileExists(std::string())) + { + std::cerr + << "Problem with FileExists(std::string())" + << std::endl; + res = false; + } + // FileExists(x, true) should return false on a directory + if (kwsys::SystemTools::FileExists(testNewDir, true)) + { + std::cerr + << "Problem with FileExists as file for: " + << testNewDir << std::endl; + res = false; + } + if (kwsys::SystemTools::FileExists(testNewDir.c_str(), true)) + { + std::cerr + << "Problem with FileExists as C string and file for: " + << testNewDir << std::endl; + res = false; + } + // FileExists(x, false) should return true even on a directory + if (!kwsys::SystemTools::FileExists(testNewDir, false)) + { + std::cerr + << "Problem with FileExists as not file for: " + << testNewDir << std::endl; + res = false; + } + if (!kwsys::SystemTools::FileExists(testNewDir.c_str(), false)) + { + std::cerr + << "Problem with FileExists as C string and not file for: " + << testNewDir << std::endl; + res = false; + } + // should work, was created as new file before + if (!kwsys::SystemTools::FileExists(testNewFile)) + { + std::cerr + << "Problem with FileExists for: " + << testNewDir << std::endl; + res = false; + } + if (!kwsys::SystemTools::FileExists(testNewFile.c_str())) + { + std::cerr + << "Problem with FileExists as C string for: " + << testNewDir << std::endl; + res = false; + } + if (!kwsys::SystemTools::FileExists(testNewFile, true)) + { + std::cerr + << "Problem with FileExists as file for: " + << testNewDir << std::endl; + res = false; + } + if (!kwsys::SystemTools::FileExists(testNewFile.c_str(), true)) + { + std::cerr + << "Problem with FileExists as C string and file for: " + << testNewDir << std::endl; + res = false; + } // Reset umask #if defined(_WIN32) && !defined(__CYGWIN__) @@ -851,6 +999,44 @@ static bool CheckGetPath() return res; } +static bool CheckFind() +{ + bool res = true; + const std::string testFindFileName("testFindFile.txt"); + const std::string testFindFile(TEST_SYSTEMTOOLS_BINARY_DIR "/" + + testFindFileName); + + if (!kwsys::SystemTools::Touch(testFindFile.c_str(), true)) + { + std::cerr + << "Problem with Touch for: " + << testFindFile << std::endl; + // abort here as the existence of the file only makes the test meaningful + return false; + } + + std::vector searchPaths; + searchPaths.push_back(TEST_SYSTEMTOOLS_BINARY_DIR); + if (kwsys::SystemTools::FindFile(testFindFileName, + searchPaths, true).empty()) + { + std::cerr + << "Problem with FindFile without system paths for: " + << testFindFileName << std::endl; + res = false; + } + if (kwsys::SystemTools::FindFile(testFindFileName, + searchPaths, false).empty()) + { + std::cerr + << "Problem with FindFile with system paths for: " + << testFindFileName << std::endl; + res = false; + } + + return res; +} + //---------------------------------------------------------------------------- int testSystemTools(int, char*[]) { @@ -888,5 +1074,7 @@ int testSystemTools(int, char*[]) res &= CheckGetPath(); + res &= CheckFind(); + return res ? 0 : 1; } From 0be5020bf814efd040f7dcd35cc3a9f07d113458 Mon Sep 17 00:00:00 2001 From: Bartosz Kosiorek Date: Thu, 3 Dec 2015 00:43:37 +0100 Subject: [PATCH 020/255] cmake: Improve '-E' help message formatting --- Help/manual/cmake.1.rst | 4 ++-- Source/cmcmd.cxx | 12 ++++++------ Tests/RunCMake/CommandLine/E-no-arg-stderr.txt | 2 +- .../CommandLine/E_create_symlink-no-arg-stderr.txt | 2 +- .../RunCMake/CommandLine/E_rename-no-arg-stderr.txt | 2 +- .../CommandLine/E_touch_nocreate-no-arg-stderr.txt | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index dac16bf3f..3bfab7b5f 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -193,10 +193,10 @@ Available commands are: ``make_directory `` Create a directory. -``md5sum [...]`` +``md5sum ...`` Compute md5sum of files. -``remove [-f] [...]`` +``remove [-f] ...`` Remove the file(s), use ``-f`` to force it. ``remove_directory `` diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 21b126ba7..70107eb23 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -52,7 +52,7 @@ void CMakeCommandUsage(const char* program) // If you add new commands, change here, // and in cmakemain.cxx in the options table errorStream - << "Usage: " << program << " -E [command] [arguments ...]\n" + << "Usage: " << program << " -E [arguments...]\n" << "Available commands: \n" << " chdir dir cmd [args]... - run command in a given directory\n" << " compare_files file1 file2 - check if file1 is same as file2\n" @@ -62,15 +62,15 @@ void CMakeCommandUsage(const char* program) "content to directory 'destination'\n" << " copy_if_different in-file out-file - copy file if input has " "changed\n" - << " echo [string]... - displays arguments as text\n" - << " echo_append [string]... - displays arguments as text but no new " + << " echo [...] - displays arguments as text\n" + << " echo_append [...] - displays arguments as text but no new " "line\n" << " env [--unset=NAME]... [NAME=VALUE]... COMMAND [ARG]...\n" << " - run command in a modified environment\n" << " environment - display the current environment\n" << " make_directory dir - create a directory\n" - << " md5sum file1 [...] - compute md5sum of files\n" - << " remove [-f] file1 file2 ... - remove the file(s), use -f to force " + << " md5sum ... - compute md5sum of files\n" + << " remove [-f] ... - remove the file(s), use -f to force " "it\n" << " remove_directory dir - remove a directory and its contents\n" << " rename oldname newname - rename a file or directory " @@ -78,7 +78,7 @@ void CMakeCommandUsage(const char* program) << " tar [cxt][vf][zjJ] file.tar [file/dir1 file/dir2 ...]\n" << " - create or extract a tar or zip archive\n" << " sleep ... - sleep for given number of seconds\n" - << " time command [args] ... - run command and return elapsed time\n" + << " time command [args...] - run command and return elapsed time\n" << " touch file - touch a file.\n" << " touch_nocreate file - touch a file but do not create it.\n" #if defined(_WIN32) && !defined(__CYGWIN__) diff --git a/Tests/RunCMake/CommandLine/E-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/E-no-arg-stderr.txt index 056ce052d..50d9b0332 100644 --- a/Tests/RunCMake/CommandLine/E-no-arg-stderr.txt +++ b/Tests/RunCMake/CommandLine/E-no-arg-stderr.txt @@ -1,3 +1,3 @@ ^CMake Error: cmake version .* -Usage: .* -E \[command\] \[arguments ...\] +Usage: .* -E \[arguments\.\.\.\] Available commands: diff --git a/Tests/RunCMake/CommandLine/E_create_symlink-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/E_create_symlink-no-arg-stderr.txt index 056ce052d..50d9b0332 100644 --- a/Tests/RunCMake/CommandLine/E_create_symlink-no-arg-stderr.txt +++ b/Tests/RunCMake/CommandLine/E_create_symlink-no-arg-stderr.txt @@ -1,3 +1,3 @@ ^CMake Error: cmake version .* -Usage: .* -E \[command\] \[arguments ...\] +Usage: .* -E \[arguments\.\.\.\] Available commands: diff --git a/Tests/RunCMake/CommandLine/E_rename-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/E_rename-no-arg-stderr.txt index 056ce052d..50d9b0332 100644 --- a/Tests/RunCMake/CommandLine/E_rename-no-arg-stderr.txt +++ b/Tests/RunCMake/CommandLine/E_rename-no-arg-stderr.txt @@ -1,3 +1,3 @@ ^CMake Error: cmake version .* -Usage: .* -E \[command\] \[arguments ...\] +Usage: .* -E \[arguments\.\.\.\] Available commands: diff --git a/Tests/RunCMake/CommandLine/E_touch_nocreate-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/E_touch_nocreate-no-arg-stderr.txt index 056ce052d..50d9b0332 100644 --- a/Tests/RunCMake/CommandLine/E_touch_nocreate-no-arg-stderr.txt +++ b/Tests/RunCMake/CommandLine/E_touch_nocreate-no-arg-stderr.txt @@ -1,3 +1,3 @@ ^CMake Error: cmake version .* -Usage: .* -E \[command\] \[arguments ...\] +Usage: .* -E \[arguments\.\.\.\] Available commands: From 384ae5514e423fccb02e48a4da25e1549556d898 Mon Sep 17 00:00:00 2001 From: Bartosz Kosiorek Date: Thu, 3 Dec 2015 21:29:30 +0100 Subject: [PATCH 021/255] cmake: Teach -E copy[_if_different] to support multiple files (#15703) If multiple input files are provided then the destination must be a directory. If only one input file is provided then destination may be either a file or directory. --- Help/manual/cmake.1.rst | 8 +-- .../dev/cmake-E-copy-multiple-inputs.rst | 5 ++ Source/cmcmd.cxx | 61 ++++++++++++++----- ...e-directory-target-is-directory-result.txt | 1 + ...e-directory-target-is-directory-stderr.txt | 0 .../E_copy-one-source-file-result.txt | 1 + .../E_copy-one-source-file-stderr.txt | 1 + ...ource-files-target-is-directory-result.txt | 1 + ...ource-files-target-is-directory-stderr.txt | 0 ...ree-source-files-target-is-file-result.txt | 1 + ...ree-source-files-target-is-file-stderr.txt | 1 + ...ource-files-target-is-directory-result.txt | 1 + ...ource-files-target-is-directory-stderr.txt | 1 + ...e-directory-target-is-directory-result.txt | 1 + ...e-directory-target-is-directory-stderr.txt | 0 ...ource-files-target-is-directory-result.txt | 1 + ...ource-files-target-is-directory-stderr.txt | 0 ...ree-source-files-target-is-file-result.txt | 1 + ...ree-source-files-target-is-file-stderr.txt | 1 + Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 23 +++++++ Tests/RunCMake/CommandLine/copy_input/f1.txt | 0 Tests/RunCMake/CommandLine/copy_input/f2.txt | 0 Tests/RunCMake/CommandLine/copy_input/f3.txt | 0 23 files changed, 90 insertions(+), 19 deletions(-) create mode 100644 Help/release/dev/cmake-E-copy-multiple-inputs.rst create mode 100644 Tests/RunCMake/CommandLine/E_copy-one-source-directory-target-is-directory-result.txt create mode 100644 Tests/RunCMake/CommandLine/E_copy-one-source-directory-target-is-directory-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/E_copy-one-source-file-result.txt create mode 100644 Tests/RunCMake/CommandLine/E_copy-one-source-file-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/E_copy-three-source-files-target-is-directory-result.txt create mode 100644 Tests/RunCMake/CommandLine/E_copy-three-source-files-target-is-directory-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/E_copy-three-source-files-target-is-file-result.txt create mode 100644 Tests/RunCMake/CommandLine/E_copy-three-source-files-target-is-file-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/E_copy-two-good-and-one-bad-source-files-target-is-directory-result.txt create mode 100644 Tests/RunCMake/CommandLine/E_copy-two-good-and-one-bad-source-files-target-is-directory-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/E_copy_if_different-one-source-directory-target-is-directory-result.txt create mode 100644 Tests/RunCMake/CommandLine/E_copy_if_different-one-source-directory-target-is-directory-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/E_copy_if_different-three-source-files-target-is-directory-result.txt create mode 100644 Tests/RunCMake/CommandLine/E_copy_if_different-three-source-files-target-is-directory-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/E_copy_if_different-three-source-files-target-is-file-result.txt create mode 100644 Tests/RunCMake/CommandLine/E_copy_if_different-three-source-files-target-is-file-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/copy_input/f1.txt create mode 100644 Tests/RunCMake/CommandLine/copy_input/f2.txt create mode 100644 Tests/RunCMake/CommandLine/copy_input/f3.txt diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index 3bfab7b5f..086f259a5 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -169,14 +169,14 @@ Available commands are: ``compare_files `` Check if file1 is same as file2. -``copy `` - Copy file to destination (either file or directory). +``copy ... `` + Copy files to 'destination' (either file or directory). ``copy_directory `` Copy directory 'source' content to directory 'destination'. -``copy_if_different `` - Copy file if input has changed. +``copy_if_different ... `` + Copy files if input has changed. Destination could be file or directory. ``echo [...]`` Displays arguments as text. diff --git a/Help/release/dev/cmake-E-copy-multiple-inputs.rst b/Help/release/dev/cmake-E-copy-multiple-inputs.rst new file mode 100644 index 000000000..798af530d --- /dev/null +++ b/Help/release/dev/cmake-E-copy-multiple-inputs.rst @@ -0,0 +1,5 @@ +cmake-E-copy-multiple-inputs +---------------------------- + +* The :manual:`cmake(1)` ``-E copy`` and ``-E copy_if_different`` command-line + tools learned to support copying multiple input files to a directory. diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 70107eb23..0dc5a9a35 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -56,11 +56,11 @@ void CMakeCommandUsage(const char* program) << "Available commands: \n" << " chdir dir cmd [args]... - run command in a given directory\n" << " compare_files file1 file2 - check if file1 is same as file2\n" - << " copy file destination - copy file to destination (either file " - "or directory)\n" + << " copy ... destination - copy files to destination " + "(either file or directory)\n" << " copy_directory source destination - copy directory 'source' " "content to directory 'destination'\n" - << " copy_if_different in-file out-file - copy file if input has " + << " copy_if_different ... destination - copy files if it has " "changed\n" << " echo [...] - displays arguments as text\n" << " echo_append [...] - displays arguments as text but no new " @@ -149,29 +149,60 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) if (args.size() > 1) { // Copy file - if (args[1] == "copy" && args.size() == 4) + if (args[1] == "copy" && args.size() > 3) { - if(!cmSystemTools::cmCopyFile(args[2].c_str(), args[3].c_str())) + // If multiple source files specified, + // then destination must be directory + if ((args.size() > 4) && + (!cmSystemTools::FileIsDirectory(args[args.size() - 1]))) { - std::cerr << "Error copying file \"" << args[2] - << "\" to \"" << args[3] << "\".\n"; + std::cerr << "Error: Target (for copy command) \"" + << args[args.size() - 1] + << "\" is not a directory.\n"; return 1; } - return 0; + // If error occurs we want to continue copying next files. + bool return_value = 0; + for (std::string::size_type cc = 2; cc < args.size() - 1; cc ++) + { + if(!cmSystemTools::cmCopyFile(args[cc].c_str(), + args[args.size() - 1].c_str())) + { + std::cerr << "Error copying file \"" << args[cc] + << "\" to \"" << args[args.size() - 1] << "\".\n"; + return_value = 1; + } + } + return return_value; } // Copy file if different. - if (args[1] == "copy_if_different" && args.size() == 4) + if (args[1] == "copy_if_different" && args.size() > 3) { - if(!cmSystemTools::CopyFileIfDifferent(args[2].c_str(), - args[3].c_str())) + // If multiple source files specified, + // then destination must be directory + if ((args.size() > 4) && + (!cmSystemTools::FileIsDirectory(args[args.size() - 1]))) { - std::cerr << "Error copying file (if different) from \"" - << args[2] << "\" to \"" << args[3] - << "\".\n"; + std::cerr << "Error: Target (for copy_if_different command) \"" + << args[args.size() - 1] + << "\" is not a directory.\n"; return 1; } - return 0; + // If error occurs we want to continue copying next files. + bool return_value = 0; + for (std::string::size_type cc = 2; cc < args.size() - 1; cc ++) + { + if(!cmSystemTools::CopyFileIfDifferent(args[cc].c_str(), + args[args.size() - 1].c_str())) + { + std::cerr << "Error copying file (if different) from \"" + << args[cc] << "\" to \"" << args[args.size() - 1] + << "\".\n"; + return_value = 1; + } + } + return return_value; } // Copy directory content diff --git a/Tests/RunCMake/CommandLine/E_copy-one-source-directory-target-is-directory-result.txt b/Tests/RunCMake/CommandLine/E_copy-one-source-directory-target-is-directory-result.txt new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_copy-one-source-directory-target-is-directory-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CommandLine/E_copy-one-source-directory-target-is-directory-stderr.txt b/Tests/RunCMake/CommandLine/E_copy-one-source-directory-target-is-directory-stderr.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/CommandLine/E_copy-one-source-file-result.txt b/Tests/RunCMake/CommandLine/E_copy-one-source-file-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_copy-one-source-file-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_copy-one-source-file-stderr.txt b/Tests/RunCMake/CommandLine/E_copy-one-source-file-stderr.txt new file mode 100644 index 000000000..9a9301d9e --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_copy-one-source-file-stderr.txt @@ -0,0 +1 @@ +^CMake Error: .* diff --git a/Tests/RunCMake/CommandLine/E_copy-three-source-files-target-is-directory-result.txt b/Tests/RunCMake/CommandLine/E_copy-three-source-files-target-is-directory-result.txt new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_copy-three-source-files-target-is-directory-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CommandLine/E_copy-three-source-files-target-is-directory-stderr.txt b/Tests/RunCMake/CommandLine/E_copy-three-source-files-target-is-directory-stderr.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/CommandLine/E_copy-three-source-files-target-is-file-result.txt b/Tests/RunCMake/CommandLine/E_copy-three-source-files-target-is-file-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_copy-three-source-files-target-is-file-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_copy-three-source-files-target-is-file-stderr.txt b/Tests/RunCMake/CommandLine/E_copy-three-source-files-target-is-file-stderr.txt new file mode 100644 index 000000000..95042168f --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_copy-three-source-files-target-is-file-stderr.txt @@ -0,0 +1 @@ +^Error: Target \(for copy command\).* is not a directory.$ diff --git a/Tests/RunCMake/CommandLine/E_copy-two-good-and-one-bad-source-files-target-is-directory-result.txt b/Tests/RunCMake/CommandLine/E_copy-two-good-and-one-bad-source-files-target-is-directory-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_copy-two-good-and-one-bad-source-files-target-is-directory-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_copy-two-good-and-one-bad-source-files-target-is-directory-stderr.txt b/Tests/RunCMake/CommandLine/E_copy-two-good-and-one-bad-source-files-target-is-directory-stderr.txt new file mode 100644 index 000000000..2d0d98610 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_copy-two-good-and-one-bad-source-files-target-is-directory-stderr.txt @@ -0,0 +1 @@ +^Error copying file .*not_existing_file.bad\" to .* diff --git a/Tests/RunCMake/CommandLine/E_copy_if_different-one-source-directory-target-is-directory-result.txt b/Tests/RunCMake/CommandLine/E_copy_if_different-one-source-directory-target-is-directory-result.txt new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_copy_if_different-one-source-directory-target-is-directory-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CommandLine/E_copy_if_different-one-source-directory-target-is-directory-stderr.txt b/Tests/RunCMake/CommandLine/E_copy_if_different-one-source-directory-target-is-directory-stderr.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/CommandLine/E_copy_if_different-three-source-files-target-is-directory-result.txt b/Tests/RunCMake/CommandLine/E_copy_if_different-three-source-files-target-is-directory-result.txt new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_copy_if_different-three-source-files-target-is-directory-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CommandLine/E_copy_if_different-three-source-files-target-is-directory-stderr.txt b/Tests/RunCMake/CommandLine/E_copy_if_different-three-source-files-target-is-directory-stderr.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/CommandLine/E_copy_if_different-three-source-files-target-is-file-result.txt b/Tests/RunCMake/CommandLine/E_copy_if_different-three-source-files-target-is-file-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_copy_if_different-three-source-files-target-is-file-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_copy_if_different-three-source-files-target-is-file-stderr.txt b/Tests/RunCMake/CommandLine/E_copy_if_different-three-source-files-target-is-file-stderr.txt new file mode 100644 index 000000000..64b7b1b4c --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_copy_if_different-three-source-files-target-is-file-stderr.txt @@ -0,0 +1 @@ +^Error: Target \(for copy_if_different command\).* is not a directory.$ diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 6b4b3849c..dbc235dfa 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -101,6 +101,29 @@ if(UNIX) ) endif() +set(in ${RunCMake_SOURCE_DIR}/copy_input) +set(out ${RunCMake_BINARY_DIR}/copy_output) +file(REMOVE_RECURSE "${out}") +file(MAKE_DIRECTORY ${out}) +run_cmake_command(E_copy-one-source-file + ${CMAKE_COMMAND} -E copy ${out}/f1.txt) +run_cmake_command(E_copy-one-source-directory-target-is-directory + ${CMAKE_COMMAND} -E copy ${in}/f1.txt ${out}) +run_cmake_command(E_copy-three-source-files-target-is-directory + ${CMAKE_COMMAND} -E copy ${in}/f1.txt ${in}/f2.txt ${in}/f3.txt ${out}) +run_cmake_command(E_copy-three-source-files-target-is-file + ${CMAKE_COMMAND} -E copy ${in}/f1.txt ${in}/f2.txt ${in}/f3.txt ${out}/f1.txt) +run_cmake_command(E_copy-two-good-and-one-bad-source-files-target-is-directory + ${CMAKE_COMMAND} -E copy ${in}/f1.txt ${in}/not_existing_file.bad ${in}/f3.txt ${out}) +run_cmake_command(E_copy_if_different-one-source-directory-target-is-directory + ${CMAKE_COMMAND} -E copy_if_different ${in}/f1.txt ${out}) +run_cmake_command(E_copy_if_different-three-source-files-target-is-directory + ${CMAKE_COMMAND} -E copy_if_different ${in}/f1.txt ${in}/f2.txt ${in}/f3.txt ${out}) +run_cmake_command(E_copy_if_different-three-source-files-target-is-file + ${CMAKE_COMMAND} -E copy_if_different ${in}/f1.txt ${in}/f2.txt ${in}/f3.txt ${out}/f1.txt) +unset(in) +unset(out) + run_cmake_command(E_env-no-command0 ${CMAKE_COMMAND} -E env) run_cmake_command(E_env-no-command1 ${CMAKE_COMMAND} -E env TEST_ENV=1) run_cmake_command(E_env-bad-arg1 ${CMAKE_COMMAND} -E env -bad-arg1) diff --git a/Tests/RunCMake/CommandLine/copy_input/f1.txt b/Tests/RunCMake/CommandLine/copy_input/f1.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/CommandLine/copy_input/f2.txt b/Tests/RunCMake/CommandLine/copy_input/f2.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/CommandLine/copy_input/f3.txt b/Tests/RunCMake/CommandLine/copy_input/f3.txt new file mode 100644 index 000000000..e69de29bb From 71e5f253f9b035be7049f36dab2e942220ff6209 Mon Sep 17 00:00:00 2001 From: Chuck Atkins Date: Fri, 4 Dec 2015 10:28:03 -0500 Subject: [PATCH 022/255] Fortran: Add ftn, the Cray compiler wrapper, to the default search. --- Modules/CMakeDetermineFortranCompiler.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index 911ffac94..ccafb0779 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -54,6 +54,7 @@ else() if(NOT CMAKE_Fortran_COMPILER_INIT) # Known compilers: # f77/f90/f95: generic compiler names + # ftn: Cray fortran compiler wrapper # g77: GNU Fortran 77 compiler # gfortran: putative GNU Fortran 95+ compiler (in progress) # fort77: native F77 compiler under HP-UX (and some older Crays) @@ -73,6 +74,7 @@ else() # then 77 or older compilers, gnu is always last in the group, # so if you paid for a compiler it is picked by default. set(CMAKE_Fortran_COMPILER_LIST + ftn ifort ifc af95 af90 efc f95 pathf2003 pathf95 pgf95 pgfortran lf95 xlf95 fort gfortran gfortran-4 g95 f90 pathf90 pgf90 xlf90 epcf90 fort77 frt pgf77 xlf fl32 af77 g77 f77 From 2c03215050fee3695e7ed9362f35dff1ea9c3016 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 5 Dec 2015 00:01:06 -0500 Subject: [PATCH 023/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 81d33c293..b31aa72d1 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20151204) +set(CMake_VERSION_PATCH 20151205) #set(CMake_VERSION_RC 1) From 5609ba1bcd4803547dfbb558d8de3c3d3af6369c Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 6 Dec 2015 00:01:05 -0500 Subject: [PATCH 024/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index b31aa72d1..cff022eba 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20151205) +set(CMake_VERSION_PATCH 20151206) #set(CMake_VERSION_RC 1) From eda493a38021f439b08807bb8202bab29e79635d Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 7 Dec 2015 00:01:07 -0500 Subject: [PATCH 025/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index cff022eba..21c4ab4a7 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20151206) +set(CMake_VERSION_PATCH 20151207) #set(CMake_VERSION_RC 1) From ebaca6290d2c0be7dec22452389632949a700d28 Mon Sep 17 00:00:00 2001 From: Roger Leigh Date: Wed, 2 Dec 2015 17:20:24 +0000 Subject: [PATCH 026/255] FindTIFF: Add imported targets and update documentation - Add TIFF::TIFF imported target - Document imported target - Add testcase to test the standard variables and the imported target Also: - Add TIFF_INCLUDE_DIRS to match common practice - Update documentation generally, including documenting TIFF_INCLUDE_DIRS --- .../release/dev/FindTIFF-imported-targets.rst | 4 ++ Modules/FindTIFF.cmake | 67 ++++++++++++++++--- Tests/CMakeLists.txt | 4 ++ Tests/FindTIFF/CMakeLists.txt | 10 +++ Tests/FindTIFF/Test/CMakeLists.txt | 17 +++++ Tests/FindTIFF/Test/main.c | 12 ++++ 6 files changed, 104 insertions(+), 10 deletions(-) create mode 100644 Help/release/dev/FindTIFF-imported-targets.rst create mode 100644 Tests/FindTIFF/CMakeLists.txt create mode 100644 Tests/FindTIFF/Test/CMakeLists.txt create mode 100644 Tests/FindTIFF/Test/main.c diff --git a/Help/release/dev/FindTIFF-imported-targets.rst b/Help/release/dev/FindTIFF-imported-targets.rst new file mode 100644 index 000000000..f8bbc14ae --- /dev/null +++ b/Help/release/dev/FindTIFF-imported-targets.rst @@ -0,0 +1,4 @@ +FindTIFF-imported-targets +------------------------- + +* The :module:`FindTIFF` module now provides imported targets. diff --git a/Modules/FindTIFF.cmake b/Modules/FindTIFF.cmake index ed092eafa..e60049848 100644 --- a/Modules/FindTIFF.cmake +++ b/Modules/FindTIFF.cmake @@ -2,24 +2,43 @@ # FindTIFF # -------- # -# Find TIFF library +# Find the TIFF library (libtiff). # -# Find the native TIFF includes and library This module defines +# Imported targets +# ^^^^^^^^^^^^^^^^ # -# :: +# This module defines the following :prop_tgt:`IMPORTED` targets: # -# TIFF_INCLUDE_DIR, where to find tiff.h, etc. -# TIFF_LIBRARIES, libraries to link against to use TIFF. -# TIFF_FOUND, If false, do not try to use TIFF. +# ``TIFF::TIFF`` +# The TIFF library, if found. # -# also defined, but not for general use are +# Result variables +# ^^^^^^^^^^^^^^^^ # -# :: +# This module will set the following variables in your project: # -# TIFF_LIBRARY, where to find the TIFF library. +# ``TIFF_FOUND`` +# true if the TIFF headers and libraries were found +# ``TIFF_INCLUDE_DIR`` +# the directory containing the TIFF headers +# ``TIFF_INCLUDE_DIRS`` +# the directory containing the TIFF headers +# ``TIFF_LIBRARIES`` +# TIFF libraries to be linked +# +# Cache variables +# ^^^^^^^^^^^^^^^ +# +# The following cache variables may also be set: +# +# ``TIFF_INCLUDE_DIR`` +# the directory containing the TIFF headers +# ``TIFF_LIBRARY`` +# the path to the TIFF library #============================================================================= # Copyright 2002-2009 Kitware, Inc. +# Copyright 2015 University of Dundee # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -65,7 +84,35 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(TIFF VERSION_VAR TIFF_VERSION_STRING) if(TIFF_FOUND) - set( TIFF_LIBRARIES ${TIFF_LIBRARY} ) + set(TIFF_LIBRARIES ${TIFF_LIBRARY}) + set(TIFF_INCLUDE_DIRS "${TIFF_INCLUDE_DIR}") + + if(NOT TARGET TIFF::TIFF) + add_library(TIFF::TIFF UNKNOWN IMPORTED) + if(TIFF_INCLUDE_DIRS) + set_target_properties(TIFF::TIFF PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${TIFF_INCLUDE_DIRS}") + endif() + if(EXISTS "${TIFF_LIBRARY}") + set_target_properties(TIFF::TIFF PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${TIFF_LIBRARY}") + endif() + if(EXISTS "${TIFF_LIBRARY_DEBUG}") + set_property(TARGET TIFF::TIFF APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(TIFF::TIFF PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C" + IMPORTED_LOCATION_DEBUG "${TIFF_LIBRARY_DEBUG}") + endif() + if(EXISTS "${TIFF_LIBRARY_RELEASE}") + set_property(TARGET TIFF::TIFF APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(TIFF::TIFF PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C" + IMPORTED_LOCATION_RELEASE "${TIFF_LIBRARY_RELEASE}") + endif() + endif() endif() mark_as_advanced(TIFF_INCLUDE_DIR TIFF_LIBRARY) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 5fd7159a5..a040ec095 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1367,6 +1367,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_subdirectory(FindOpenSSL) endif() + if(CMake_TEST_FindTIFF) + add_subdirectory(FindTIFF) + endif() + if(CMake_TEST_FindXercesC) add_subdirectory(FindXercesC) endif() diff --git a/Tests/FindTIFF/CMakeLists.txt b/Tests/FindTIFF/CMakeLists.txt new file mode 100644 index 000000000..c4e0c6a7f --- /dev/null +++ b/Tests/FindTIFF/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindTIFF.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindTIFF/Test" + "${CMake_BINARY_DIR}/Tests/FindTIFF/Test" + ${build_generator_args} + --build-project TestFindTIFF + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) diff --git a/Tests/FindTIFF/Test/CMakeLists.txt b/Tests/FindTIFF/Test/CMakeLists.txt new file mode 100644 index 000000000..f17cda77f --- /dev/null +++ b/Tests/FindTIFF/Test/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.1) +project(TestFindTIFF C) +include(CTest) + +# CMake does not actually provide FindTIFF publicly. +set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../Source/Modules) + +find_package(TIFF REQUIRED) + +add_executable(test_xercesc_tgt main.c) +target_link_libraries(test_xercesc_tgt TIFF::TIFF) +add_test(NAME test_xercesc_tgt COMMAND test_xercesc_tgt) + +add_executable(test_xercesc_var main.c) +target_include_directories(test_xercesc_var PRIVATE ${TIFF_INCLUDE_DIRS}) +target_link_libraries(test_xercesc_var PRIVATE ${TIFF_LIBRARIES}) +add_test(NAME test_xercesc_var COMMAND test_xercesc_var) diff --git a/Tests/FindTIFF/Test/main.c b/Tests/FindTIFF/Test/main.c new file mode 100644 index 000000000..fc4f33757 --- /dev/null +++ b/Tests/FindTIFF/Test/main.c @@ -0,0 +1,12 @@ +#include +#include + +int main() +{ + /* Without any TIFF file to open, test that the call fails as + expected. This tests that linking worked. */ + TIFF *tiff = TIFFOpen("invalid.tiff", "r"); + assert(!tiff); + + return 0; +} From 0903812b0b8c325913d766b793bbf9438ad6b423 Mon Sep 17 00:00:00 2001 From: Bartosz Kosiorek Date: Sun, 6 Dec 2015 20:30:44 +0100 Subject: [PATCH 027/255] cmake: Refine -E chdir documentation --- Source/cmcmd.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 0dc5a9a35..33700a1ab 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -54,7 +54,7 @@ void CMakeCommandUsage(const char* program) errorStream << "Usage: " << program << " -E [arguments...]\n" << "Available commands: \n" - << " chdir dir cmd [args]... - run command in a given directory\n" + << " chdir dir cmd [args...] - run command in a given directory\n" << " compare_files file1 file2 - check if file1 is same as file2\n" << " copy ... destination - copy files to destination " "(either file or directory)\n" From 93cc80aee59cfb328d541ba527d40239ab8348b1 Mon Sep 17 00:00:00 2001 From: Bartosz Kosiorek Date: Sun, 6 Dec 2015 20:30:44 +0100 Subject: [PATCH 028/255] cmake: Refine -E copy_if_different implementation indentation --- Source/cmcmd.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 33700a1ab..c82320154 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -197,8 +197,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) args[args.size() - 1].c_str())) { std::cerr << "Error copying file (if different) from \"" - << args[cc] << "\" to \"" << args[args.size() - 1] - << "\".\n"; + << args[cc] << "\" to \"" << args[args.size() - 1] + << "\".\n"; return_value = 1; } } From 98be140fc0dc0bab8955c4fea9274ea52ac8cd9c Mon Sep 17 00:00:00 2001 From: Bartosz Kosiorek Date: Sun, 6 Dec 2015 20:30:44 +0100 Subject: [PATCH 029/255] cmake: Refine -E copy[_if_different] documentation --- Help/manual/cmake.1.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index 086f259a5..d5e85059a 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -170,13 +170,18 @@ Available commands are: Check if file1 is same as file2. ``copy ... `` - Copy files to 'destination' (either file or directory). + Copy files to ```` (either file or directory). + If multiple files are specified, the ```` must be + directory and it must exist. ``copy_directory `` Copy directory 'source' content to directory 'destination'. ``copy_if_different ... `` - Copy files if input has changed. Destination could be file or directory. + Copy files to ```` (either file or directory) if + they have changed. + If multiple files are specified, the ```` must be + directory and it must exist. ``echo [...]`` Displays arguments as text. From bc35087da3eb9039dad8fb5d27c1fab60b43f776 Mon Sep 17 00:00:00 2001 From: Bartosz Kosiorek Date: Sun, 6 Dec 2015 20:30:44 +0100 Subject: [PATCH 030/255] cmake: Teach -E copy_directory to support multiple input directories --- Help/manual/cmake.1.rst | 5 ++-- .../dev/cmake-E-copy-multiple-inputs.rst | 3 +++ Source/cmcmd.cxx | 24 ++++++++++++------- ...ource-files-target-is-directory-result.txt | 1 + ...ource-files-target-is-directory-stderr.txt | 0 ...ree-source-files-target-is-file-result.txt | 1 + ...ree-source-files-target-is-file-stderr.txt | 3 +++ ...ource-files-target-is-not-exist-result.txt | 1 + ...ource-files-target-is-not-exist-stderr.txt | 0 Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 17 +++++++++++++ .../RunCMake/CommandLine/copy_input/d1/d1.txt | 0 .../RunCMake/CommandLine/copy_input/d2/d2.txt | 0 .../RunCMake/CommandLine/copy_input/d3/d3.txt | 0 13 files changed, 44 insertions(+), 11 deletions(-) create mode 100644 Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-directory-result.txt create mode 100644 Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-directory-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-file-result.txt create mode 100644 Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-file-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-not-exist-result.txt create mode 100644 Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-not-exist-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/copy_input/d1/d1.txt create mode 100644 Tests/RunCMake/CommandLine/copy_input/d2/d2.txt create mode 100644 Tests/RunCMake/CommandLine/copy_input/d3/d3.txt diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index d5e85059a..4cbe97678 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -174,8 +174,9 @@ Available commands are: If multiple files are specified, the ```` must be directory and it must exist. -``copy_directory `` - Copy directory 'source' content to directory 'destination'. +``copy_directory ... `` + Copy directories to ```` directory. + If ```` directory does not exist it will be created. ``copy_if_different ... `` Copy files to ```` (either file or directory) if diff --git a/Help/release/dev/cmake-E-copy-multiple-inputs.rst b/Help/release/dev/cmake-E-copy-multiple-inputs.rst index 798af530d..eeb1fabc7 100644 --- a/Help/release/dev/cmake-E-copy-multiple-inputs.rst +++ b/Help/release/dev/cmake-E-copy-multiple-inputs.rst @@ -3,3 +3,6 @@ cmake-E-copy-multiple-inputs * The :manual:`cmake(1)` ``-E copy`` and ``-E copy_if_different`` command-line tools learned to support copying multiple input files to a directory. + +* The :manual:`cmake(1)` ``-E copy_directory`` command-line + tool learned to support copying multiple input directories to a directory. diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index c82320154..6a4234f09 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -58,8 +58,8 @@ void CMakeCommandUsage(const char* program) << " compare_files file1 file2 - check if file1 is same as file2\n" << " copy ... destination - copy files to destination " "(either file or directory)\n" - << " copy_directory source destination - copy directory 'source' " - "content to directory 'destination'\n" + << " copy_directory ... destination - copy content of ... " + "directories to 'destination' directory\n" << " copy_if_different ... destination - copy files if it has " "changed\n" << " echo [...] - displays arguments as text\n" @@ -206,16 +206,22 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) } // Copy directory content - if (args[1] == "copy_directory" && args.size() == 4) + if (args[1] == "copy_directory" && args.size() > 3) { - if(!cmSystemTools::CopyADirectory(args[2], args[3])) + // If error occurs we want to continue copying next files. + bool return_value = 0; + for (std::string::size_type cc = 2; cc < args.size() - 1; cc ++) { - std::cerr << "Error copying directory from \"" - << args[2] << "\" to \"" << args[3] - << "\".\n"; - return 1; + if(!cmSystemTools::CopyADirectory(args[cc].c_str(), + args[args.size() - 1].c_str())) + { + std::cerr << "Error copying directory from \"" + << args[cc] << "\" to \"" << args[args.size() - 1] + << "\".\n"; + return_value = 1; + } } - return 0; + return return_value; } // Rename a file or directory diff --git a/Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-directory-result.txt b/Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-directory-result.txt new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-directory-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-directory-stderr.txt b/Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-directory-stderr.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-file-result.txt b/Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-file-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-file-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-file-stderr.txt b/Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-file-stderr.txt new file mode 100644 index 000000000..6ca367767 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-file-stderr.txt @@ -0,0 +1,3 @@ +^Error copying directory from .* to .*file_for_test.txt\".* +Error copying directory from .* to .*file_for_test.txt\".* +Error copying directory from .* to .*file_for_test.txt\".$ diff --git a/Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-not-exist-result.txt b/Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-not-exist-result.txt new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-not-exist-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-not-exist-stderr.txt b/Tests/RunCMake/CommandLine/E_copy_directory-three-source-files-target-is-not-exist-stderr.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index dbc235dfa..57036ba3d 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -124,6 +124,23 @@ run_cmake_command(E_copy_if_different-three-source-files-target-is-file unset(in) unset(out) +set(in ${RunCMake_SOURCE_DIR}/copy_input) +set(out ${RunCMake_BINARY_DIR}/copy_directory_output) +set(outfile ${out}/file_for_test.txt) +file(REMOVE_RECURSE "${out}") +file(MAKE_DIRECTORY ${out}) +file(WRITE ${outfile} "") +run_cmake_command(E_copy_directory-three-source-files-target-is-directory + ${CMAKE_COMMAND} -E copy_directory ${in}/d1 ${in}/d2 ${in}/d3 ${out}) +run_cmake_command(E_copy_directory-three-source-files-target-is-file + ${CMAKE_COMMAND} -E copy_directory ${in}/d1 ${in}/d2 ${in}/d3 ${outfile}) +run_cmake_command(E_copy_directory-three-source-files-target-is-not-exist + ${CMAKE_COMMAND} -E copy_directory ${in}/d1 ${in}/d2 ${in}/d3 ${out}/not_existing_directory) +unset(in) +unset(out) +unset(outfile) + + run_cmake_command(E_env-no-command0 ${CMAKE_COMMAND} -E env) run_cmake_command(E_env-no-command1 ${CMAKE_COMMAND} -E env TEST_ENV=1) run_cmake_command(E_env-bad-arg1 ${CMAKE_COMMAND} -E env -bad-arg1) diff --git a/Tests/RunCMake/CommandLine/copy_input/d1/d1.txt b/Tests/RunCMake/CommandLine/copy_input/d1/d1.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/CommandLine/copy_input/d2/d2.txt b/Tests/RunCMake/CommandLine/copy_input/d2/d2.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/CommandLine/copy_input/d3/d3.txt b/Tests/RunCMake/CommandLine/copy_input/d3/d3.txt new file mode 100644 index 000000000..e69de29bb From 5eaac0c96ac51e1300664ef37239f3215bb58489 Mon Sep 17 00:00:00 2001 From: Chuck Atkins Date: Wed, 2 Dec 2015 08:47:43 -0600 Subject: [PATCH 031/255] Compiler: Add infrastructure for detecting compiler wrappers --- Modules/CMakeCCompiler.cmake.in | 1 + Modules/CMakeCInformation.cmake | 8 ++++++ Modules/CMakeCXXCompiler.cmake.in | 1 + Modules/CMakeCXXInformation.cmake | 8 ++++++ Modules/CMakeDetermineCompilerId.cmake | 6 +++++ Modules/CMakeFortranCompiler.cmake.in | 1 + Modules/CMakeFortranInformation.cmake | 8 ++++++ Modules/CMakeLanguageInformation.cmake | 37 ++++++++++++++++++++++++++ 8 files changed, 70 insertions(+) create mode 100644 Modules/CMakeLanguageInformation.cmake diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in index c72e3381f..f109a1479 100644 --- a/Modules/CMakeCCompiler.cmake.in +++ b/Modules/CMakeCCompiler.cmake.in @@ -2,6 +2,7 @@ set(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@") set(CMAKE_C_COMPILER_ARG1 "@CMAKE_C_COMPILER_ARG1@") set(CMAKE_C_COMPILER_ID "@CMAKE_C_COMPILER_ID@") set(CMAKE_C_COMPILER_VERSION "@CMAKE_C_COMPILER_VERSION@") +set(CMAKE_C_COMPILER_WRAPPER "@CMAKE_C_COMPILER_WRAPPER@") set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "@CMAKE_C_STANDARD_COMPUTED_DEFAULT@") set(CMAKE_C_COMPILE_FEATURES "@CMAKE_C_COMPILE_FEATURES@") set(CMAKE_C90_COMPILE_FEATURES "@CMAKE_C90_COMPILE_FEATURES@") diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake index d2417aaa4..fa87ca84c 100644 --- a/Modules/CMakeCInformation.cmake +++ b/Modules/CMakeCInformation.cmake @@ -18,6 +18,8 @@ # It also loads a system - compiler - processor (or target hardware) # specific file, which is mainly useful for crosscompiling and embedded systems. +include(CMakeLanguageInformation) + # some compilers use different extensions (e.g. sdcc uses .rel) # so set the extension here first so it can be overridden by the compiler specific file if(UNIX) @@ -60,6 +62,12 @@ if (NOT _INCLUDED_FILE) include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) endif () + +# load any compiler-wrapper specific information +if (CMAKE_C_COMPILER_WRAPPER) + __cmake_include_compiler_wrapper(C) +endif () + # We specify the compiler information in the system file for some # platforms, but this language may not have been enabled when the file # was first included. Include it again to get the language info. diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in index 52e44f6d5..9e90aea59 100644 --- a/Modules/CMakeCXXCompiler.cmake.in +++ b/Modules/CMakeCXXCompiler.cmake.in @@ -2,6 +2,7 @@ set(CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@") set(CMAKE_CXX_COMPILER_ARG1 "@CMAKE_CXX_COMPILER_ARG1@") set(CMAKE_CXX_COMPILER_ID "@CMAKE_CXX_COMPILER_ID@") set(CMAKE_CXX_COMPILER_VERSION "@CMAKE_CXX_COMPILER_VERSION@") +set(CMAKE_CXX_COMPILER_WRAPPER "@CMAKE_CXX_COMPILER_WRAPPER@") set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "@CMAKE_CXX_STANDARD_COMPUTED_DEFAULT@") set(CMAKE_CXX_COMPILE_FEATURES "@CMAKE_CXX_COMPILE_FEATURES@") set(CMAKE_CXX98_COMPILE_FEATURES "@CMAKE_CXX98_COMPILE_FEATURES@") diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake index 091627bc3..b35280f96 100644 --- a/Modules/CMakeCXXInformation.cmake +++ b/Modules/CMakeCXXInformation.cmake @@ -18,6 +18,8 @@ # It also loads a system - compiler - processor (or target hardware) # specific file, which is mainly useful for crosscompiling and embedded systems. +include(CMakeLanguageInformation) + # some compilers use different extensions (e.g. sdcc uses .rel) # so set the extension here first so it can be overridden by the compiler specific file if(UNIX) @@ -59,6 +61,12 @@ if (NOT _INCLUDED_FILE) include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) endif () + +# load any compiler-wrapper specific information +if (CMAKE_CXX_COMPILER_WRAPPER) + __cmake_include_compiler_wrapper(CXX) +endif () + # We specify the compiler information in the system file for some # platforms, but this language may not have been enabled when the file # was first included. Include it again to get the language info. diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 81c25090c..eb5481412 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -107,6 +107,7 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) PARENT_SCOPE) set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "${CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX}" PARENT_SCOPE) set(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_${lang}_COMPILER_VERSION}" PARENT_SCOPE) + set(CMAKE_${lang}_COMPILER_WRAPPER "${CMAKE_${lang}_COMPILER_WRAPPER}" PARENT_SCOPE) set(CMAKE_${lang}_SIMULATE_ID "${CMAKE_${lang}_SIMULATE_ID}" PARENT_SCOPE) set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_${lang}_SIMULATE_VERSION}" PARENT_SCOPE) set(CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT "${CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT}" PARENT_SCOPE) @@ -435,6 +436,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) set(HAVE_COMPILER_VERSION_MINOR 0) set(HAVE_COMPILER_VERSION_PATCH 0) set(HAVE_COMPILER_VERSION_TWEAK 0) + set(COMPILER_WRAPPER) set(DIGIT_VALUE_1 1) set(DIGIT_VALUE_2 10) set(DIGIT_VALUE_3 100) @@ -476,6 +478,9 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) endif() endforeach() endforeach() + if("${info}" MATCHES "INFO:compiler_wrapper\\[([^]\"]*)\\]") + set(COMPILER_WRAPPER "${CMAKE_MATCH_1}") + endif() if("${info}" MATCHES "INFO:simulate\\[([^]\"]*)\\]") set(SIMULATE_ID "${CMAKE_MATCH_1}") endif() @@ -588,6 +593,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) set(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}" PARENT_SCOPE) set(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_${lang}_COMPILER_VERSION}" PARENT_SCOPE) + set(CMAKE_${lang}_COMPILER_WRAPPER "${COMPILER_WRAPPER}" PARENT_SCOPE) set(CMAKE_${lang}_SIMULATE_ID "${CMAKE_${lang}_SIMULATE_ID}" PARENT_SCOPE) set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_${lang}_SIMULATE_VERSION}" PARENT_SCOPE) set(CMAKE_EXECUTABLE_FORMAT "${CMAKE_EXECUTABLE_FORMAT}" PARENT_SCOPE) diff --git a/Modules/CMakeFortranCompiler.cmake.in b/Modules/CMakeFortranCompiler.cmake.in index 14fdd60d9..2a4bea494 100644 --- a/Modules/CMakeFortranCompiler.cmake.in +++ b/Modules/CMakeFortranCompiler.cmake.in @@ -2,6 +2,7 @@ set(CMAKE_Fortran_COMPILER "@CMAKE_Fortran_COMPILER@") set(CMAKE_Fortran_COMPILER_ARG1 "@CMAKE_Fortran_COMPILER_ARG1@") set(CMAKE_Fortran_COMPILER_ID "@CMAKE_Fortran_COMPILER_ID@") set(CMAKE_Fortran_COMPILER_VERSION "@CMAKE_Fortran_COMPILER_VERSION@") +set(CMAKE_Fortran_COMPILER_WRAPPER "@CMAKE_Fortran_COMPILER_WRAPPER@") set(CMAKE_Fortran_PLATFORM_ID "@CMAKE_Fortran_PLATFORM_ID@") set(CMAKE_Fortran_SIMULATE_ID "@CMAKE_Fortran_SIMULATE_ID@") set(CMAKE_Fortran_SIMULATE_VERSION "@CMAKE_Fortran_SIMULATE_VERSION@") diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake index 79393d330..1fd097235 100644 --- a/Modules/CMakeFortranInformation.cmake +++ b/Modules/CMakeFortranInformation.cmake @@ -12,6 +12,8 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +include(CMakeLanguageInformation) + # This file sets the basic flags for the Fortran language in CMake. # It also loads the available platform file for the system-compiler # if it exists. @@ -36,6 +38,12 @@ if (NOT _INCLUDED_FILE) include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) endif () + +# load any compiler-wrapper specific information +if (CMAKE_Fortran_COMPILER_WRAPPER) + __cmake_include_compiler_wrapper(Fortran) +endif () + # We specify the compiler information in the system file for some # platforms, but this language may not have been enabled when the file # was first included. Include it again to get the language info. diff --git a/Modules/CMakeLanguageInformation.cmake b/Modules/CMakeLanguageInformation.cmake new file mode 100644 index 000000000..e03d149c0 --- /dev/null +++ b/Modules/CMakeLanguageInformation.cmake @@ -0,0 +1,37 @@ + +#============================================================================= +# Copyright 2015 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# This file contains common code blocks used by all the language information +# files + +# load any compiler-wrapper specific information +macro(__cmake_include_compiler_wrapper lang) + set(_INCLUDED_WRAPPER_FILE 0) + if (CMAKE_${lang}_COMPILER_ID) + include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_${lang}_COMPILER_WRAPPER}-${CMAKE_${lang}_COMPILER_ID}-${lang} OPTIONAL RESULT_VARIABLE _INCLUDED_WRAPPER_FILE) + endif() + if (NOT _INCLUDED_WRAPPER_FILE) + include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_${lang}_COMPILER_WRAPPER}-${lang} OPTIONAL RESULT_VARIABLE _INCLUDED_WRAPPER_FILE) + endif () + + # No platform - wrapper - lang information so maybe there's just wrapper - lang information + if(NOT _INCLUDED_WRAPPER_FILE) + if (CMAKE_${lang}_COMPILER_ID) + include(Compiler/${CMAKE_${lang}_COMPILER_WRAPPER}-${CMAKE_${lang}_COMPILER_ID}-${lang} OPTIONAL RESULT_VARIABLE _INCLUDED_WRAPPER_FILE) + endif() + if (NOT _INCLUDED_WRAPPER_FILE) + include(Compiler/${CMAKE_${lang}_COMPILER_WRAPPER}-${lang} OPTIONAL RESULT_VARIABLE _INCLUDED_WRAPPER_FILE) + endif () + endif () +endmacro () From 0763a8365528166747746e3b94e74ca98d0d705f Mon Sep 17 00:00:00 2001 From: Chuck Atkins Date: Wed, 2 Dec 2015 09:59:47 -0600 Subject: [PATCH 032/255] Cray: Add macro tests to detect the Cray compiler wrappers --- Modules/CMakeCCompilerId.c.in | 7 +++++++ Modules/CMakeCXXCompilerId.cpp.in | 7 +++++++ Modules/CMakeFortranCompilerId.F.in | 3 +++ 3 files changed, 17 insertions(+) diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in index 63f8787c0..5bfe0fdfa 100644 --- a/Modules/CMakeCCompilerId.c.in +++ b/Modules/CMakeCCompilerId.c.in @@ -21,6 +21,10 @@ char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; char const* qnxnto = "INFO" ":" "qnxnto[]"; #endif +#if defined(__CRAYXE) || defined(__CRAYXC) +char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; +#endif + @CMAKE_C_COMPILER_ID_PLATFORM_CONTENT@ @CMAKE_C_COMPILER_ID_ERROR_FOR_TEST@ @@ -54,6 +58,9 @@ int main(int argc, char* argv[]) #endif #ifdef SIMULATE_VERSION_MAJOR require += info_simulate_version[argc]; +#endif +#if defined(__CRAYXE) || defined(__CRAYXC) + require += info_cray[argc]; #endif require += info_language_dialect_default[argc]; (void)argv; diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in index 61cd79093..3e5c0fcff 100644 --- a/Modules/CMakeCXXCompilerId.cpp.in +++ b/Modules/CMakeCXXCompilerId.cpp.in @@ -20,6 +20,10 @@ char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; char const* qnxnto = "INFO" ":" "qnxnto[]"; #endif +#if defined(__CRAYXE) || defined(__CRAYXC) +char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; +#endif + @CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT@ @CMAKE_CXX_COMPILER_ID_ERROR_FOR_TEST@ @@ -48,6 +52,9 @@ int main(int argc, char* argv[]) #endif #ifdef SIMULATE_VERSION_MAJOR require += info_simulate_version[argc]; +#endif +#if defined(__CRAYXE) || defined(__CRAYXC) + require += info_cray[argc]; #endif require += info_language_dialect_default[argc]; (void)argv; diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in index 2f7f40ec6..67cda3b61 100644 --- a/Modules/CMakeFortranCompilerId.F.in +++ b/Modules/CMakeFortranCompilerId.F.in @@ -110,6 +110,9 @@ # endif PRINT *, 'INFO:compiler[]' #endif +#if defined(__CRAYXE) || defined(__CRAYXC) + PRINT *, 'INFO:compiler_wrapper[CrayPrgEnv]' +#endif #if 0 ! Identify the platform From c926efa1398aa2c4ff273dee173d84d0031bcdf6 Mon Sep 17 00:00:00 2001 From: Markus Rickert Date: Mon, 7 Dec 2015 19:11:51 +0100 Subject: [PATCH 033/255] CPackRPM: Configure RPM package group and name per component --- Modules/CPackRPM.cmake | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index 1e7b05581..7fb11c3b4 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -37,6 +37,7 @@ # * Default : CPACK_PACKAGE_DESCRIPTION_SUMMARY # # .. variable:: CPACK_RPM_PACKAGE_NAME +# CPACK_RPM__PACKAGE_NAME # # The RPM package name. # @@ -81,6 +82,7 @@ # * Default : "unknown" # # .. variable:: CPACK_RPM_PACKAGE_GROUP +# CPACK_RPM__PACKAGE_GROUP # # The RPM package group. # @@ -1106,10 +1108,7 @@ function(cpack_rpm_generate_package) # Are we packaging components ? if(CPACK_RPM_PACKAGE_COMPONENT) - set(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "-${CPACK_RPM_PACKAGE_COMPONENT}") string(TOUPPER ${CPACK_RPM_PACKAGE_COMPONENT} CPACK_RPM_PACKAGE_COMPONENT_UPPER) - else() - set(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "") endif() set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}") @@ -1143,10 +1142,19 @@ function(cpack_rpm_generate_package) endif() # CPACK_RPM_PACKAGE_NAME (mandatory) + if(NOT CPACK_RPM_PACKAGE_NAME) string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_RPM_PACKAGE_NAME) endif() + if(CPACK_RPM_PACKAGE_COMPONENT) + if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_NAME) + set(CPACK_RPM_PACKAGE_NAME ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_NAME}) + else() + set(CPACK_RPM_PACKAGE_NAME ${CPACK_RPM_PACKAGE_NAME}-${CPACK_RPM_PACKAGE_COMPONENT}) + endif() + endif() + # CPACK_RPM_PACKAGE_VERSION (mandatory) if(NOT CPACK_RPM_PACKAGE_VERSION) if(NOT CPACK_PACKAGE_VERSION) @@ -1206,6 +1214,15 @@ function(cpack_rpm_generate_package) endif() # CPACK_RPM_PACKAGE_GROUP + + #Check for component group first. + #If not set, it will use regular package group logic. + if(CPACK_RPM_PACKAGE_COMPONENT) + if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_GROUP) + set(CPACK_RPM_PACKAGE_GROUP ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_GROUP}) + endif() + endif() + if(NOT CPACK_RPM_PACKAGE_GROUP) set(CPACK_RPM_PACKAGE_GROUP "unknown") endif() @@ -1613,7 +1630,7 @@ function(cpack_rpm_generate_package) ) # The name of the final spec file to be used by rpmbuild - set(CPACK_RPM_BINARY_SPECFILE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.spec") + set(CPACK_RPM_BINARY_SPECFILE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_NAME}.spec") # Print out some debug information if we were asked for that if(CPACK_RPM_PACKAGE_DEBUG) @@ -1645,7 +1662,7 @@ function(cpack_rpm_generate_package) "# -*- rpm-spec -*- BuildRoot: \@CPACK_RPM_DIRECTORY\@/\@CPACK_PACKAGE_FILE_NAME\@\@CPACK_RPM_PACKAGE_COMPONENT_PART_PATH\@ Summary: \@CPACK_RPM_PACKAGE_SUMMARY\@ -Name: \@CPACK_RPM_PACKAGE_NAME\@\@CPACK_RPM_PACKAGE_COMPONENT_PART_NAME\@ +Name: \@CPACK_RPM_PACKAGE_NAME\@ Version: \@CPACK_RPM_PACKAGE_VERSION\@ Release: \@CPACK_RPM_PACKAGE_RELEASE\@ License: \@CPACK_RPM_PACKAGE_LICENSE\@ @@ -1749,15 +1766,15 @@ mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\" $RPM_BUILD_ROOT "${CPACK_RPM_BINARY_SPECFILE}" WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}" RESULT_VARIABLE CPACK_RPMBUILD_EXEC_RESULT - ERROR_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.err" - OUTPUT_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.out") + ERROR_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.err" + OUTPUT_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.out") if(CPACK_RPM_PACKAGE_DEBUG OR CPACK_RPMBUILD_EXEC_RESULT) - file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.err RPMBUILDERR) - file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.out RPMBUILDOUT) + file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.err RPMBUILDERR) + file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.out RPMBUILDOUT) message("CPackRPM:Debug: You may consult rpmbuild logs in: ") - message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.err") + message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.err") message("CPackRPM:Debug: *** ${RPMBUILDERR} ***") - message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.out") + message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.out") message("CPackRPM:Debug: *** ${RPMBUILDOUT} ***") endif() else() From 27e6f74f29084fbdee35eb5a8d309d99d39e66d8 Mon Sep 17 00:00:00 2001 From: Domen Vrankar Date: Mon, 7 Dec 2015 20:13:09 +0100 Subject: [PATCH 034/255] CPack: Added tests for package name and group controll fields --- .../cpack-rpm-percomponent-group-and-name.rst | 7 +++++++ .../PER_COMPONENT_FIELDS-ExpectedFiles.cmake | 9 +++++++++ .../PER_COMPONENT_FIELDS-VerifyResult.cmake | 18 ++++++++++++++++++ .../DEB/PER_COMPONENT_FIELDS-specifics.cmake | 6 ++++++ .../RunCMake/CPack/PER_COMPONENT_FIELDS.cmake | 5 +++++ Tests/RunCMake/CPack/RPM/Helpers.cmake | 9 +++++++++ .../PER_COMPONENT_FIELDS-ExpectedFiles.cmake | 9 +++++++++ .../PER_COMPONENT_FIELDS-VerifyResult.cmake | 18 ++++++++++++++++++ .../RPM/PER_COMPONENT_FIELDS-specifics.cmake | 5 +++++ Tests/RunCMake/CPack/RunCMakeTest.cmake | 1 + 10 files changed, 87 insertions(+) create mode 100644 Help/release/dev/cpack-rpm-percomponent-group-and-name.rst create mode 100644 Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-ExpectedFiles.cmake create mode 100644 Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-VerifyResult.cmake create mode 100644 Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-specifics.cmake create mode 100644 Tests/RunCMake/CPack/PER_COMPONENT_FIELDS.cmake create mode 100644 Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-ExpectedFiles.cmake create mode 100644 Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-VerifyResult.cmake create mode 100644 Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-specifics.cmake diff --git a/Help/release/dev/cpack-rpm-percomponent-group-and-name.rst b/Help/release/dev/cpack-rpm-percomponent-group-and-name.rst new file mode 100644 index 000000000..146f8ac89 --- /dev/null +++ b/Help/release/dev/cpack-rpm-percomponent-group-and-name.rst @@ -0,0 +1,7 @@ +cpack-rpm-percomponent-group-and-name +------------------------------------- + +* The :module:`CPackRPM` module learned to set Name and Group + control fields per-component. + See :variable:`CPACK_RPM__PACKAGE_NAME` + and :variable:`CPACK_RPM__PACKAGE_GROUP`. diff --git a/Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-ExpectedFiles.cmake b/Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-ExpectedFiles.cmake new file mode 100644 index 000000000..1f6c11b9d --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-ExpectedFiles.cmake @@ -0,0 +1,9 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "3") +set(EXPECTED_FILE_1 "per_component*-pkg_1.deb") +set(EXPECTED_FILE_CONTENT_1 "^.*/usr/foo${whitespaces_}.*/usr/foo/CMakeLists.txt$") +set(EXPECTED_FILE_2 "per_component*-pkg_2.deb") +set(EXPECTED_FILE_CONTENT_2 "^.*/usr/foo${whitespaces_}.*/usr/foo/CMakeLists.txt$") +set(EXPECTED_FILE_3 "per_component*-pkg_3.deb") +set(EXPECTED_FILE_CONTENT_3 "^.*/usr/foo${whitespaces_}.*/usr/foo/CMakeLists.txt$") diff --git a/Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-VerifyResult.cmake b/Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-VerifyResult.cmake new file mode 100644 index 000000000..55293be50 --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-VerifyResult.cmake @@ -0,0 +1,18 @@ +function(checkPackageInfo_ TYPE FILE REGEX) + set(whitespaces_ "[\t\n\r ]*") + + getPackageInfo("${FILE}" "FILE_INFO_") + if(NOT FILE_INFO_ MATCHES "${REGEX}") + message(FATAL_ERROR "Unexpected ${TYPE} in '${FILE}'; file info: '${FILE_INFO_}'") + endif() +endfunction() + +# check package name +checkPackageInfo_("name" "${FOUND_FILE_1}" ".*Package${whitespaces_}:${whitespaces_}per_component-pkg_1") +checkPackageInfo_("name" "${FOUND_FILE_2}" ".*Package${whitespaces_}:${whitespaces_}second") +checkPackageInfo_("name" "${FOUND_FILE_3}" ".*Package${whitespaces_}:${whitespaces_}per_component-pkg_3") + +# check package group +checkPackageInfo_("group" "${FOUND_FILE_1}" ".*Section${whitespaces_}:${whitespaces_}default") +checkPackageInfo_("group" "${FOUND_FILE_2}" ".*Section${whitespaces_}:${whitespaces_}second_group") +checkPackageInfo_("group" "${FOUND_FILE_3}" ".*Section${whitespaces_}:${whitespaces_}default") diff --git a/Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-specifics.cmake b/Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-specifics.cmake new file mode 100644 index 000000000..a1da1a3cd --- /dev/null +++ b/Tests/RunCMake/CPack/DEB/PER_COMPONENT_FIELDS-specifics.cmake @@ -0,0 +1,6 @@ +set(CPACK_PACKAGE_CONTACT "someone") +set(CPACK_DEB_COMPONENT_INSTALL "ON") + +set(CPACK_DEBIAN_PACKAGE_SECTION "default") +set(CPACK_DEBIAN_PKG_2_PACKAGE_NAME "second") +set(CPACK_DEBIAN_PKG_2_PACKAGE_SECTION "second_group") diff --git a/Tests/RunCMake/CPack/PER_COMPONENT_FIELDS.cmake b/Tests/RunCMake/CPack/PER_COMPONENT_FIELDS.cmake new file mode 100644 index 000000000..bb42cf4d5 --- /dev/null +++ b/Tests/RunCMake/CPack/PER_COMPONENT_FIELDS.cmake @@ -0,0 +1,5 @@ +install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_1) +install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_2) +install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_3) + +set(CPACK_PACKAGE_NAME "per_component") diff --git a/Tests/RunCMake/CPack/RPM/Helpers.cmake b/Tests/RunCMake/CPack/RPM/Helpers.cmake index 98cdad845..ba77a4a10 100644 --- a/Tests/RunCMake/CPack/RPM/Helpers.cmake +++ b/Tests/RunCMake/CPack/RPM/Helpers.cmake @@ -8,3 +8,12 @@ function(getPackageContent FILE RESULT_VAR) set(${RESULT_VAR} "${package_content_}" PARENT_SCOPE) endfunction() + +function(getPackageInfo FILE RESULT_VAR) + execute_process(COMMAND ${RPM_EXECUTABLE} -pqi ${FILE} + OUTPUT_VARIABLE info_content + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + + set(${RESULT_VAR} "${info_content}" PARENT_SCOPE) +endfunction() diff --git a/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-ExpectedFiles.cmake b/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-ExpectedFiles.cmake new file mode 100644 index 000000000..3d28d416e --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-ExpectedFiles.cmake @@ -0,0 +1,9 @@ +set(whitespaces_ "[\t\n\r ]*") + +set(EXPECTED_FILES_COUNT "3") +set(EXPECTED_FILE_1 "per_component*-pkg_1.rpm") +set(EXPECTED_FILE_CONTENT_1 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$") +set(EXPECTED_FILE_2 "per_component*-pkg_2.rpm") +set(EXPECTED_FILE_CONTENT_2 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$") +set(EXPECTED_FILE_3 "per_component*-pkg_3.rpm") +set(EXPECTED_FILE_CONTENT_3 "^/usr/foo${whitespaces_}/usr/foo/CMakeLists.txt$") diff --git a/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-VerifyResult.cmake b/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-VerifyResult.cmake new file mode 100644 index 000000000..d7d4f9de6 --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-VerifyResult.cmake @@ -0,0 +1,18 @@ +function(checkPackageInfo_ TYPE FILE REGEX) + set(whitespaces_ "[\t\n\r ]*") + + getPackageInfo("${FILE}" "FILE_INFO_") + if(NOT FILE_INFO_ MATCHES "${REGEX}") + message(FATAL_ERROR "Unexpected ${TYPE} in '${FILE}'; file info: '${FILE_INFO_}'") + endif() +endfunction() + +# check package name +checkPackageInfo_("name" "${FOUND_FILE_1}" ".*Name${whitespaces_}:${whitespaces_}per_component-pkg_1") +checkPackageInfo_("name" "${FOUND_FILE_2}" ".*Name${whitespaces_}:${whitespaces_}second") +checkPackageInfo_("name" "${FOUND_FILE_3}" ".*Name${whitespaces_}:${whitespaces_}per_component-pkg_3") + +# check package group +checkPackageInfo_("group" "${FOUND_FILE_1}" ".*Group${whitespaces_}:${whitespaces_}default") +checkPackageInfo_("group" "${FOUND_FILE_2}" ".*Group${whitespaces_}:${whitespaces_}second_group") +checkPackageInfo_("group" "${FOUND_FILE_3}" ".*Group${whitespaces_}:${whitespaces_}default") diff --git a/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-specifics.cmake b/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-specifics.cmake new file mode 100644 index 000000000..d398168e3 --- /dev/null +++ b/Tests/RunCMake/CPack/RPM/PER_COMPONENT_FIELDS-specifics.cmake @@ -0,0 +1,5 @@ +set(CPACK_RPM_COMPONENT_INSTALL "ON") + +set(CPACK_RPM_PACKAGE_GROUP "default") +set(CPACK_RPM_pkg_2_PACKAGE_NAME "second") +set(CPACK_RPM_pkg_2_PACKAGE_GROUP "second_group") diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index b7295f450..fe2b48bb3 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -10,3 +10,4 @@ run_cpack_test(DEB_EXTRA "DEB" false) run_cpack_test(DEPENDENCIES "RPM;DEB" true) run_cpack_test(EMPTY_DIR "RPM;DEB;TGZ" true) run_cpack_test(COMPONENTS_EMPTY_DIR "RPM;DEB;TGZ" true) +run_cpack_test(PER_COMPONENT_FIELDS "RPM;DEB" false) From c6eacfd56a9c5a8da2304c446230127b6ce42470 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 8 Dec 2015 00:01:07 -0500 Subject: [PATCH 035/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 21c4ab4a7..11d90d7f0 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20151207) +set(CMake_VERSION_PATCH 20151208) #set(CMake_VERSION_RC 1) From 3a824a963ac54930b072e2d31c54e182af3d027c Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 9 Dec 2015 00:01:06 -0500 Subject: [PATCH 036/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 11d90d7f0..c24341f16 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20151208) +set(CMake_VERSION_PATCH 20151209) #set(CMake_VERSION_RC 1) From a7ef02253bf8ef33d4ffdd761802ea30ef289b8a Mon Sep 17 00:00:00 2001 From: Chuck Atkins Date: Wed, 2 Dec 2015 10:00:44 -0600 Subject: [PATCH 037/255] Cray: Refactor the Cray platform files to use compiler wrapper checks This is an extensive refactoring of the Cray compiler wrapper usage. Using the new compiler wrapper checks, the CrayPrgEnv info files have been moved from Platform/ to Compiler/. The adjusted naming convention allows the compiler-wrapper information files to be loaded for both the CrayLinuxEnvironment platform when cross-compiling and the Linux platform if building natively on the Cray compute nodes. It also creates a separation of common arguments for compiler id and language information used to perform the appropriate introspection of implicit arguments and libraries used by the compiler wrappers based on the loaded module environment. --- Modules/Compiler/CrayPrgEnv-C.cmake | 11 ++ Modules/Compiler/CrayPrgEnv-CXX.cmake | 11 ++ Modules/Compiler/CrayPrgEnv-Cray-C.cmake | 7 + Modules/Compiler/CrayPrgEnv-Cray-CXX.cmake | 7 + .../Compiler/CrayPrgEnv-Cray-Fortran.cmake | 7 + Modules/Compiler/CrayPrgEnv-Fortran.cmake | 11 ++ Modules/Compiler/CrayPrgEnv-GNU-C.cmake | 7 + Modules/Compiler/CrayPrgEnv-GNU-CXX.cmake | 7 + Modules/Compiler/CrayPrgEnv-GNU-Fortran.cmake | 7 + Modules/Compiler/CrayPrgEnv-Intel-C.cmake | 7 + Modules/Compiler/CrayPrgEnv-Intel-CXX.cmake | 7 + .../Compiler/CrayPrgEnv-Intel-Fortran.cmake | 7 + Modules/Compiler/CrayPrgEnv-PGI-C.cmake | 7 + Modules/Compiler/CrayPrgEnv-PGI-CXX.cmake | 7 + Modules/Compiler/CrayPrgEnv-PGI-Fortran.cmake | 7 + Modules/Compiler/CrayPrgEnv.cmake | 83 ++++++++++ Modules/Platform/CrayLinuxEnvironment.cmake | 99 ++++++++---- Modules/Platform/CrayPrgEnv.cmake | 149 ------------------ 18 files changed, 265 insertions(+), 183 deletions(-) create mode 100644 Modules/Compiler/CrayPrgEnv-C.cmake create mode 100644 Modules/Compiler/CrayPrgEnv-CXX.cmake create mode 100644 Modules/Compiler/CrayPrgEnv-Cray-C.cmake create mode 100644 Modules/Compiler/CrayPrgEnv-Cray-CXX.cmake create mode 100644 Modules/Compiler/CrayPrgEnv-Cray-Fortran.cmake create mode 100644 Modules/Compiler/CrayPrgEnv-Fortran.cmake create mode 100644 Modules/Compiler/CrayPrgEnv-GNU-C.cmake create mode 100644 Modules/Compiler/CrayPrgEnv-GNU-CXX.cmake create mode 100644 Modules/Compiler/CrayPrgEnv-GNU-Fortran.cmake create mode 100644 Modules/Compiler/CrayPrgEnv-Intel-C.cmake create mode 100644 Modules/Compiler/CrayPrgEnv-Intel-CXX.cmake create mode 100644 Modules/Compiler/CrayPrgEnv-Intel-Fortran.cmake create mode 100644 Modules/Compiler/CrayPrgEnv-PGI-C.cmake create mode 100644 Modules/Compiler/CrayPrgEnv-PGI-CXX.cmake create mode 100644 Modules/Compiler/CrayPrgEnv-PGI-Fortran.cmake create mode 100644 Modules/Compiler/CrayPrgEnv.cmake delete mode 100644 Modules/Platform/CrayPrgEnv.cmake diff --git a/Modules/Compiler/CrayPrgEnv-C.cmake b/Modules/Compiler/CrayPrgEnv-C.cmake new file mode 100644 index 000000000..6b461ce06 --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-C.cmake @@ -0,0 +1,11 @@ +if(__craylinux_crayprgenv_c) + return() +endif() +set(__craylinux_crayprgenv_c 1) + +include(Compiler/CrayPrgEnv) +macro(__CrayPrgEnv_setup_C compiler_cmd link_cmd) + __CrayPrgEnv_setup(C + ${CMAKE_ROOT}/Modules/CMakeCCompilerABI.c + ${compiler_cmd} ${link_cmd}) +endmacro() diff --git a/Modules/Compiler/CrayPrgEnv-CXX.cmake b/Modules/Compiler/CrayPrgEnv-CXX.cmake new file mode 100644 index 000000000..aad85b67e --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-CXX.cmake @@ -0,0 +1,11 @@ +if(__craylinux_crayprgenv_cxx) + return() +endif() +set(__craylinux_crayprgenv_cxx 1) + +include(Compiler/CrayPrgEnv) +macro(__CrayPrgEnv_setup_CXX compiler_cmd link_cmd) + __CrayPrgEnv_setup(CXX + ${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp + ${compiler_cmd} ${link_cmd}) +endmacro() diff --git a/Modules/Compiler/CrayPrgEnv-Cray-C.cmake b/Modules/Compiler/CrayPrgEnv-Cray-C.cmake new file mode 100644 index 000000000..547a4b4d5 --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-Cray-C.cmake @@ -0,0 +1,7 @@ +if(__craylinux_crayprgenv_cray_c) + return() +endif() +set(__craylinux_crayprgenv_cray_c 1) + +include(Compiler/CrayPrgEnv-C) +__CrayPrgEnv_setup_C("/opt/cray/cce/.*/ccfe" "/opt/cray/cce/.*/ld") diff --git a/Modules/Compiler/CrayPrgEnv-Cray-CXX.cmake b/Modules/Compiler/CrayPrgEnv-Cray-CXX.cmake new file mode 100644 index 000000000..df8452c15 --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-Cray-CXX.cmake @@ -0,0 +1,7 @@ +if(__craylinux_crayprgenv_cray_cxx) + return() +endif() +set(__craylinux_crayprgenv_cray_cxx 1) + +include(Compiler/CrayPrgEnv-CXX) +__CrayPrgEnv_setup_CXX("/opt/cray/cce/.*/ccfe" "/opt/cray/cce/.*/ld") diff --git a/Modules/Compiler/CrayPrgEnv-Cray-Fortran.cmake b/Modules/Compiler/CrayPrgEnv-Cray-Fortran.cmake new file mode 100644 index 000000000..9f46a04c8 --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-Cray-Fortran.cmake @@ -0,0 +1,7 @@ +if(__craylinux_crayprgenv_cray_fortran) + return() +endif() +set(__craylinux_crayprgenv_cray_fortran 1) + +include(Compiler/CrayPrgEnv-Fortran) +__CrayPrgEnv_setup_Fortran("/opt/cray/cce/.*/ftnfe" "/opt/cray/cce/.*/ld") diff --git a/Modules/Compiler/CrayPrgEnv-Fortran.cmake b/Modules/Compiler/CrayPrgEnv-Fortran.cmake new file mode 100644 index 000000000..9c4d2694a --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-Fortran.cmake @@ -0,0 +1,11 @@ +if(__craylinux_crayprgenv_fortran) + return() +endif() +set(__craylinux_crayprgenv_fortran 1) + +include(Compiler/CrayPrgEnv) +macro(__CrayPrgEnv_setup_Fortran compiler_cmd link_cmd) + __CrayPrgEnv_setup(Fortran + ${CMAKE_ROOT}/Modules/CMakeFortranCompilerABI.F + ${compiler_cmd} ${link_cmd}) +endmacro() diff --git a/Modules/Compiler/CrayPrgEnv-GNU-C.cmake b/Modules/Compiler/CrayPrgEnv-GNU-C.cmake new file mode 100644 index 000000000..248081b87 --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-GNU-C.cmake @@ -0,0 +1,7 @@ +if(__craylinux_crayprgenv_gnu_c) + return() +endif() +set(__craylinux_crayprgenv_gnu_c 1) + +include(Compiler/CrayPrgEnv-C) +__CrayPrgEnv_setup_C("/opt/gcc/.*/cc1" "/opt/gcc/.*/collect2") diff --git a/Modules/Compiler/CrayPrgEnv-GNU-CXX.cmake b/Modules/Compiler/CrayPrgEnv-GNU-CXX.cmake new file mode 100644 index 000000000..be4eb6d54 --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-GNU-CXX.cmake @@ -0,0 +1,7 @@ +if(__craylinux_crayprgenv_gnu_cxx) + return() +endif() +set(__craylinux_crayprgenv_gnu_cxx 1) + +include(Compiler/CrayPrgEnv-CXX) +__CrayPrgEnv_setup_CXX("/opt/gcc/.*/cc1plus" "/opt/gcc/.*/collect2") diff --git a/Modules/Compiler/CrayPrgEnv-GNU-Fortran.cmake b/Modules/Compiler/CrayPrgEnv-GNU-Fortran.cmake new file mode 100644 index 000000000..8bd23ff88 --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-GNU-Fortran.cmake @@ -0,0 +1,7 @@ +if(__craylinux_crayprgenv_gnu_fortran) + return() +endif() +set(__craylinux_crayprgenv_gnu_fortran 1) + +include(Compiler/CrayPrgEnv-Fortran) +__CrayPrgEnv_setup_Fortran("/opt/gcc/.*/f951" "/opt/gcc/.*/collect2") diff --git a/Modules/Compiler/CrayPrgEnv-Intel-C.cmake b/Modules/Compiler/CrayPrgEnv-Intel-C.cmake new file mode 100644 index 000000000..83c4e3801 --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-Intel-C.cmake @@ -0,0 +1,7 @@ +if(__craylinux_crayprgenv_intel_c) + return() +endif() +set(__craylinux_crayprgenv_intel_c 1) + +include(Compiler/CrayPrgEnv-C) +__CrayPrgEnv_setup_C("/opt/intel/.*/mcpcom" "^ld ") diff --git a/Modules/Compiler/CrayPrgEnv-Intel-CXX.cmake b/Modules/Compiler/CrayPrgEnv-Intel-CXX.cmake new file mode 100644 index 000000000..3c3c3e63f --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-Intel-CXX.cmake @@ -0,0 +1,7 @@ +if(__craylinux_crayprgenv_intel_cxx) + return() +endif() +set(__craylinux_crayprgenv_intel_cxx 1) + +include(Compiler/CrayPrgEnv-CXX) +__CrayPrgEnv_setup_CXX("/opt/intel/.*/mcpcom" "^ld ") diff --git a/Modules/Compiler/CrayPrgEnv-Intel-Fortran.cmake b/Modules/Compiler/CrayPrgEnv-Intel-Fortran.cmake new file mode 100644 index 000000000..08a316d2c --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-Intel-Fortran.cmake @@ -0,0 +1,7 @@ +if(__craylinux_crayprgenv_intel_fortran) + return() +endif() +set(__craylinux_crayprgenv_intel_fortran 1) + +include(Compiler/CrayPrgEnv-Fortran) +__CrayPrgEnv_setup_Fortran("/opt/intel/.*/fortcom" "^ld ") diff --git a/Modules/Compiler/CrayPrgEnv-PGI-C.cmake b/Modules/Compiler/CrayPrgEnv-PGI-C.cmake new file mode 100644 index 000000000..f45767caf --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-PGI-C.cmake @@ -0,0 +1,7 @@ +if(__craylinux_crayprgenv_pgi_c) + return() +endif() +set(__craylinux_crayprgenv_pgi_c 1) + +include(Compiler/CrayPrgEnv-C) +__CrayPrgEnv_setup_C("/opt/pgi/[^ ]*/pgc" "/usr/bin/ld") diff --git a/Modules/Compiler/CrayPrgEnv-PGI-CXX.cmake b/Modules/Compiler/CrayPrgEnv-PGI-CXX.cmake new file mode 100644 index 000000000..a2a286f8c --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-PGI-CXX.cmake @@ -0,0 +1,7 @@ +if(__craylinux_crayprgenv_pgi_cxx) + return() +endif() +set(__craylinux_crayprgenv_pgi_cxx 1) + +include(Compiler/CrayPrgEnv-CXX) +__CrayPrgEnv_setup_CXX("/opt/pgi/[^ ]*/pgcpp" "/usr/bin/ld") diff --git a/Modules/Compiler/CrayPrgEnv-PGI-Fortran.cmake b/Modules/Compiler/CrayPrgEnv-PGI-Fortran.cmake new file mode 100644 index 000000000..f6ba7c0fa --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv-PGI-Fortran.cmake @@ -0,0 +1,7 @@ +if(__craylinux_crayprgenv_pgi_fortran) + return() +endif() +set(__craylinux_crayprgenv_pgi_fortran 1) + +include(Compiler/CrayPrgEnv-Fortran) +__CrayPrgEnv_setup_Fortran("/opt/pgi/[^ ]*/pgf" "/usr/bin/ld") diff --git a/Modules/Compiler/CrayPrgEnv.cmake b/Modules/Compiler/CrayPrgEnv.cmake new file mode 100644 index 000000000..c3e7b7332 --- /dev/null +++ b/Modules/Compiler/CrayPrgEnv.cmake @@ -0,0 +1,83 @@ +# Guard against multiple inclusions +if(__craylinux_crayprgenv) + return() +endif() +set(__craylinux_crayprgenv 1) + +macro(__cray_extract_args cmd tag_regex out_var) + string(REGEX MATCHALL "${tag_regex}" args "${cmd}") + foreach(arg IN LISTS args) + string(REGEX REPLACE "^${tag_regex}$" "\\2" param "${arg}") + get_filename_component(param_abs "${param}" ABSOLUTE) + list(APPEND ${out_var} ${param_abs}) + endforeach() +endmacro() + +function(__cray_extract_implicit src compiler_cmd link_cmd lang include_dirs_var link_dirs_var link_libs_var) + execute_process( + COMMAND ${CMAKE_${lang}_COMPILER} + ${CMAKE_${lang}_VERBOSE_FLAG} -o cray_extract_implicit_${lang} ${src} + RESULT_VARIABLE result + OUTPUT_VARIABLE output + ERROR_VARIABLE error + ) + string(REGEX REPLACE "\r?\n" ";" output_lines "${output}\n${error}") + foreach(line IN LISTS output_lines) + if("${line}" MATCHES "${compiler_cmd}") + __cray_extract_args("${line}" " -(I ?|isystem )([^ ]*)" include_dirs) + set(processed_include 1) + endif() + if("${line}" MATCHES "${link_cmd}") + __cray_extract_args("${line}" " -(L ?)([^ ]*)" link_dirs) + __cray_extract_args("${line}" " -(l ?)([^ ]*)" link_libs) + set(processed_link 1) + endif() + if(processed_include AND processed_link) + break() + endif() + endforeach() + + set(${include_dirs_var} "${include_dirs}" PARENT_SCOPE) + set(${link_dirs_var} "${link_dirs}" PARENT_SCOPE) + set(${link_libs_var} "${link_libs}" PARENT_SCOPE) + set(CRAY_${lang}_EXTRACTED_IMPLICIT 1 CACHE INTERNAL "" FORCE) +endfunction() + +macro(__CrayPrgEnv_setup lang test_src compiler_cmd link_cmd) + if(DEFINED ENV{CRAYPE_VERSION}) + message(STATUS "Cray Programming Environment $ENV{CRAYPE_VERSION} ${lang}") + elseif(DEFINED ENV{ASYNCPE_VERSION}) + message(STATUS "Cray XT Programming Environment $ENV{ASYNCPE_VERSION} ${lang}") + endif() + + # Flags for the Cray wrappers + set(CMAKE_STATIC_LIBRARY_LINK_${lang}_FLAGS "-static") + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "") + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared") + set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-dynamic") + + # If the link type is not explicitly specified in the environment then + # the Cray wrappers assume that the code will be built staticly so + # we check the following condition(s) are NOT met + # Compiler flags are explicitly dynamic + # Env var is dynamic and compiler flags are not explicitly static + if(NOT (((CMAKE_${lang}_FLAGS MATCHES "(^| )-dynamic($| )") OR + (CMAKE_EXE_LINKER_FLAGS MATCHES "(^| )-dynamic($| )")) + OR + (("$ENV{CRAYPE_LINK_TYPE}" STREQUAL "dynamic") AND + NOT ((CMAKE_${lang}_FLAGS MATCHES "(^| )-static($| )") OR + (CMAKE_EXE_LINKER_FLAGS MATCHES "(^| )-static($| )"))))) + set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) + set(BUILD_SHARED_LIBS FALSE CACHE BOOL "") + set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") + set(CMAKE_LINK_SEARCH_START_STATIC TRUE) + endif() + if(NOT CRAY_${lang}_EXTRACTED_IMPLICIT) + __cray_extract_implicit( + ${test_src} ${compiler_cmd} ${link_cmd} ${lang} + CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES + CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES + CMAKE_${lang}_IMPLICIT_LINK_LIBRARIES + ) + endif() +endmacro() diff --git a/Modules/Platform/CrayLinuxEnvironment.cmake b/Modules/Platform/CrayLinuxEnvironment.cmake index 19a0f713a..97771a268 100644 --- a/Modules/Platform/CrayLinuxEnvironment.cmake +++ b/Modules/Platform/CrayLinuxEnvironment.cmake @@ -2,12 +2,6 @@ # needs to be custom. We use the variables defined through Cray's environment # modules to set up the right paths for things. -# Guard against multiple inclusions -if(__CrayLinuxEnvironment) - return() -endif() -set(__CrayLinuxEnvironment 1) - set(UNIX 1) if(DEFINED ENV{CRAYOS_VERSION}) @@ -17,7 +11,12 @@ elseif(DEFINED ENV{XTOS_VERSION}) else() message(FATAL_ERROR "Neither the CRAYOS_VERSION or XTOS_VERSION environment variables are defined. This platform file should be used inside the Cray Linux Environment for targeting compute nodes (NIDs)") endif() -message(STATUS "Cray Linux Environment ${CMAKE_SYSTEM_VERSION}") + +# Guard against multiple messages +if(NOT __CrayLinuxEnvironment_message) + set(__CrayLinuxEnvironment_message 1) + message(STATUS "Cray Linux Environment ${CMAKE_SYSTEM_VERSION}") +endif() # All cray systems are x86 CPUs and have been for quite some time # Note: this may need to change in the future with 64-bit ARM @@ -29,8 +28,13 @@ set(CMAKE_STATIC_LIBRARY_PREFIX "lib") set(CMAKE_STATIC_LIBRARY_SUFFIX ".a") set(CMAKE_FIND_LIBRARY_PREFIXES "lib") -set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a") -set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE) + +# Don't override shared lib support if it's already been set and possibly +# overridden elsewhere by the CrayPrgEnv module +if(NOT CMAKE_FIND_LIBRARY_SUFFIXES) + set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a") + set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE) +endif() set(CMAKE_DL_LIBS dl) @@ -42,7 +46,6 @@ set(CMAKE_DL_LIBS dl) get_filename_component(__cmake_install_dir "${CMAKE_ROOT}" PATH) get_filename_component(__cmake_install_dir "${__cmake_install_dir}" PATH) - # Note: Some Cray's have the SYSROOT_DIR variable defined, pointing to a copy # of the NIDs userland. If so, then we'll use it. Otherwise, just assume # the userland from the login node is ok @@ -78,35 +81,63 @@ list(APPEND CMAKE_SYSTEM_LIBRARY_PATH $ENV{SYSROOT_DIR}/usr/lib64 $ENV{SYSROOT_DIR}/lib64 ) - list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES $ENV{SYSROOT_DIR}/usr/local/lib64 $ENV{SYSROOT_DIR}/usr/lib64 $ENV{SYSROOT_DIR}/lib64 ) -list(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES - $ENV{SYSROOT_DIR}/usr/include -) -list(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES - $ENV{SYSROOT_DIR}/usr/include -) -list(APPEND CMAKE_Fortran_IMPLICIT_INCLUDE_DIRECTORIES - $ENV{SYSROOT_DIR}/usr/include -) + +# Compute the intersection of several lists +function(__cray_list_intersect OUTPUT INPUT0) + if(ARGC EQUAL 2) + list(APPEND ${OUTPUT} ${${INPUT0}}) + else() + foreach(I IN LISTS ${INPUT0}) + set(__is_common 1) + foreach(L IN LISTS ARGN) + list(FIND ${L} "${I}" __idx) + if(__idx EQUAL -1) + set(__is_common 0) + break() + endif() + endforeach() + if(__is_common) + list(APPEND ${OUTPUT} "${I}") + endif() + endforeach() + endif() + set(${OUTPUT} ${${OUTPUT}} PARENT_SCOPE) +endfunction() + +macro(__list_clean_dupes var) + if(${var}) + list(REMOVE_DUPLICATES ${var}) + endif() +endmacro() + +get_property(__langs GLOBAL PROPERTY ENABLED_LANGUAGES) +set(__cray_inc_path_vars) +set(__cray_lib_path_vars) +foreach(__lang IN LISTS __langs) + list(APPEND __cray_inc_path_vars CMAKE_${__lang}_IMPLICIT_INCLUDE_DIRECTORIES) + list(APPEND __cray_lib_path_vars CMAKE_${__lang}_IMPLICIT_LINK_DIRECTORIES) +endforeach() +if(__cray_inc_path_vars) + __cray_list_intersect(__cray_implicit_include_dirs ${__cray_inc_path_vars}) + if(__cray_implicit_include_dirs) + list(INSERT CMAKE_SYSTEM_INCLUDE_PATH 0 ${__cray_implicit_include_dirs}) + endif() +endif() +if(__cray_lib_path_vars) + __cray_list_intersect(__cray_implicit_library_dirs ${__cray_lib_path_vars}) + if(__cray_implicit_library_dirs) + list(INSERT CMAKE_SYSTEM_LIBRARY_PATH 0 ${__cray_implicit_library_dirs}) + endif() +endif() +__list_clean_dupes(CMAKE_SYSTEM_PREFIX_PATH) +__list_clean_dupes(CMAKE_SYSTEM_INCLUDE_PATH) +__list_clean_dupes(CMAKE_SYSTEM_LIBRARY_PATH) +__list_clean_dupes(CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES) # Enable use of lib64 search path variants by default. set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE) - -# Check to see if we're using the cray compiler wrappers and load accordingly -# if we are -if(DEFINED ENV{CRAYPE_DIR}) - set(_CRAYPE_ROOT "$ENV{CRAYPE_DIR}") -elseif(DEFINED ENV{ASYNCPE_DIR}) - set(_CRAYPE_ROOT "$ENV{ASYNCPE_DIR}") -endif() -if(_CRAYPE_ROOT AND - ((CMAKE_C_COMPILER MATCHES "${_CRAYPE_ROOT}") OR - (CMAKE_CXX_COMPILER MATCHES "${_CRAYPE_ROOT}") OR - (CMAKE_Fortran_COMPILER MATCHES "${_CRAYPE_ROOT}"))) - include(Platform/CrayPrgEnv) -endif() diff --git a/Modules/Platform/CrayPrgEnv.cmake b/Modules/Platform/CrayPrgEnv.cmake deleted file mode 100644 index d60266b52..000000000 --- a/Modules/Platform/CrayPrgEnv.cmake +++ /dev/null @@ -1,149 +0,0 @@ -# Guard against multiple inclusions -if(__CrayPrgEnv) - return() -endif() -set(__CrayPrgEnv 1) -if(DEFINED ENV{CRAYPE_VERSION}) - message(STATUS "Cray Programming Environment $ENV{CRAYPE_VERSION}") - set(__verbose_flag "-craype-verbose") -elseif(DEFINED ENV{ASYNCPE_VERSION}) - message(STATUS "Cray Programming Environment $ENV{ASYNCPE_VERSION}") - set(__verbose_flag "-v") -else() - message(STATUS "Cray Programming Environment") -endif() - -if(NOT __CrayLinuxEnvironment) - message(FATAL_ERROR "The CrayPrgEnv platform file must not be used on its own and is intented to be included by the CrayLinuxEnvironment platform file") -endif() - -# Flags for the Cray wrappers -foreach(__lang C CXX Fortran) - set(CMAKE_STATIC_LIBRARY_LINK_${__lang}_FLAGS "-static") - set(CMAKE_SHARED_LIBRARY_${__lang}_FLAGS "") - set(CMAKE_SHARED_LIBRARY_CREATE_${__lang}_FLAGS "-shared") - set(CMAKE_SHARED_LIBRARY_LINK_${__lang}_FLAGS "-dynamic") -endforeach() - -# If the link type is not explicitly specified in the environment then -# the Cray wrappers assume that the code will be built staticly so -# we check the following condition(s) are NOT met -# Compiler flags are explicitly dynamic -# Env var is dynamic and compiler flags are not explicitly static -if(NOT (((CMAKE_C_FLAGS MATCHES "(^| )-dynamic($| )") OR - (CMAKE_CXX_FLAGS MATCHES "(^| )-dynamic($| )") OR - (CMAKE_Fortran_FLAGS MATCHES "(^| )-dynamic($| )") OR - (CMAKE_EXE_LINKER_FLAGS MATCHES "(^| )-dynamic($| )")) - OR - (("$ENV{CRAYPE_LINK_TYPE}" STREQUAL "dynamic") AND - NOT ((CMAKE_C_FLAGS MATCHES "(^| )-static($| )") OR - (CMAKE_CXX_FLAGS MATCHES "(^| )-static($| )") OR - (CMAKE_Fortran_FLAGS MATCHES "(^| )-static($| )") OR - (CMAKE_EXE_LINKER_FLAGS MATCHES "(^| )-static($| )"))))) - set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) - set(BUILD_SHARED_LIBS FALSE CACHE BOOL "") - set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") - set(CMAKE_LINK_SEARCH_START_STATIC TRUE) -endif() - -function(__cray_parse_flags_with_sep OUTPUT FLAG_TAG SEP INPUT) - string(REGEX MATCHALL "${SEP}${FLAG_TAG}([^${SEP}]+)" FLAG_ARGS "${INPUT}") - foreach(FLAG_ARG IN LISTS FLAG_ARGS) - string(REGEX REPLACE - "^${SEP}${FLAG_TAG}([^${SEP}]+)" "\\1" FLAG_VALUE - "${FLAG_ARG}") - list(APPEND ${OUTPUT} ${FLAG_VALUE}) - endforeach() - set(${OUTPUT} ${${OUTPUT}} PARENT_SCOPE) -endfunction() -macro(__cray_parse_flags OUTPUT FLAG_TAG INPUT) - __cray_parse_flags_with_sep(${OUTPUT} ${FLAG_TAG} " " "${INPUT}") -endmacro() - -# Remove duplicates in a list -macro(__cray_list_remove_duplicates VAR) - if(${VAR}) - list(REMOVE_DUPLICATES ${VAR}) - endif() -endmacro() - -# Compute the intersection of several lists -function(__cray_list_intersect OUTPUT INPUT0) - if(ARGC EQUAL 2) - list(APPEND ${OUTPUT} ${${INPUT0}}) - else() - foreach(I IN LISTS ${INPUT0}) - set(__is_common 1) - foreach(L IN LISTS ARGN) - list(FIND ${L} "${I}" __idx) - if(__idx EQUAL -1) - set(__is_common 0) - break() - endif() - endforeach() - if(__is_common) - list(APPEND ${OUTPUT} "${I}") - endif() - endforeach() - endif() - set(${OUTPUT} ${${OUTPUT}} PARENT_SCOPE) -endfunction() - -# Parse the implicit directories used by the wrappers -get_property(__langs GLOBAL PROPERTY ENABLED_LANGUAGES) -foreach(__lang IN LISTS __langs) - if(__lang STREQUAL "C") - set(__empty empty.c) - elseif(__lang STREQUAL CXX) - set(__empty empty.cxx) - elseif(__lang STREQUAL Fortran) - set(__empty empty.f90) - else() - continue() - endif() - - execute_process( - COMMAND ${CMAKE_${__lang}_COMPILER} ${__verbose_flag} ${__empty} - OUTPUT_VARIABLE __cmd_out - ERROR_QUIET - ) - string(REGEX MATCH "(^|\n)[^\n]*${__empty}[^\n]*" __driver "${__cmd_out}") - - # Parse include paths - set(__cray_flag_args) - __cray_parse_flags(__cray_flag_args "-I" "${__driver}") - __cray_parse_flags(__cray_flag_args "-isystem " "${__driver}") - list(APPEND CMAKE_${__lang}_IMPLICIT_INCLUDE_DIRECTORIES ${__cray_flag_args}) - __cray_list_remove_duplicates(CMAKE_${__lang}_IMPLICIT_INCLUDE_DIRECTORIES) - - # Parse library paths - set(__cray_flag_args) - __cray_parse_flags(__cray_flag_args "-L" "${__driver}") - list(APPEND CMAKE_${__lang}_IMPLICIT_LINK_DIRECTORIES ${__cray_flag_args}) - __cray_list_remove_duplicates(CMAKE_${__lang}_IMPLICIT_LINK_DIRECTORIES) - - # Parse libraries - set(__cray_flag_args) - __cray_parse_flags(__cray_flag_args "-l" "${__driver}") - __cray_parse_flags(__cray_linker_flags "-Wl" "${__driver}") - foreach(F IN LISTS __cray_linker_flags) - __cray_parse_flags_with_sep(__cray_flag_args "-l" "," "${F}") - endforeach() - list(APPEND CMAKE_${__lang}_IMPLICIT_LINK_LIBRARIES ${__cray_flag_args}) - __cray_list_remove_duplicates(CMAKE_${__lang}_IMPLICIT_LINK_LIBRARIES) -endforeach() - -# Determine the common directories between all languages and add them -# as system search paths -set(__cray_inc_path_vars) -set(__cray_lib_path_vars) -foreach(__lang IN LISTS __langs) - list(APPEND __cray_inc_path_vars CMAKE_${__lang}_IMPLICIT_INCLUDE_DIRECTORIES) - list(APPEND __cray_lib_path_vars CMAKE_${__lang}_IMPLICIT_LINK_DIRECTORIES) -endforeach() -if(__cray_inc_path_vars) - __cray_list_intersect(CMAKE_SYSTEM_INCLUDE_PATH ${__cray_inc_path_vars}) -endif() -if(__cray_lib_path_vars) - __cray_list_intersect(CMAKE_SYSTEM_LIBRARY_PATH ${__cray_lib_path_vars}) -endif() From d462ac27d814e966c54bb638444e4b125d1d665f Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 9 Dec 2015 11:38:10 -0500 Subject: [PATCH 038/255] cmELF: Use KWIML ABI.h header to get endian-ness Port away from KWSys CPU header. --- Source/cmELF.cxx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx index 37dd328db..fda6e023d 100644 --- a/Source/cmELF.cxx +++ b/Source/cmELF.cxx @@ -16,8 +16,7 @@ #include // Need the native byte order of the running CPU. -#define cmsys_CPU_UNKNOWN_OKAY // We can decide at runtime if not known. -#include +#include // Include the ELF format information system header. #if defined(__OpenBSD__) @@ -102,9 +101,9 @@ public: // In most cases the processor-specific byte order will match that // of the target execution environment. If we choose wrong here // it is fixed when the header is read. -#if cmsys_CPU_ENDIAN_ID == cmsys_CPU_ENDIAN_ID_LITTLE +#if cmIML_ABI_ENDIAN_ID == cmIML_ABI_ENDIAN_ID_LITTLE this->NeedSwap = (this->ByteOrder == ByteOrderMSB); -#elif cmsys_CPU_ENDIAN_ID == cmsys_CPU_ENDIAN_ID_BIG +#elif cmIML_ABI_ENDIAN_ID == cmIML_ABI_ENDIAN_ID_BIG this->NeedSwap = (this->ByteOrder == ByteOrderLSB); #else this->NeedSwap = false; // Final decision is at runtime anyway. From a657b324822b5bd549706b337a74fa3bfd7bc1c6 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 10 Dec 2015 00:01:06 -0500 Subject: [PATCH 039/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index c24341f16..fab29abc8 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20151209) +set(CMake_VERSION_PATCH 20151210) #set(CMake_VERSION_RC 1) From 4ce6fbc76b0ebaeef258695c2b876061b5b61073 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 10 Dec 2015 08:52:20 -0500 Subject: [PATCH 040/255] Help: Rename release notes for topic 'cmake-E-multiple-inputs' This topic name will supersede cmake-E-copy-multiple-inputs. --- ...E-copy-multiple-inputs.rst => cmake-E-multiple-inputs.rst} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename Help/release/dev/{cmake-E-copy-multiple-inputs.rst => cmake-E-multiple-inputs.rst} (83%) diff --git a/Help/release/dev/cmake-E-copy-multiple-inputs.rst b/Help/release/dev/cmake-E-multiple-inputs.rst similarity index 83% rename from Help/release/dev/cmake-E-copy-multiple-inputs.rst rename to Help/release/dev/cmake-E-multiple-inputs.rst index eeb1fabc7..aa52a9895 100644 --- a/Help/release/dev/cmake-E-copy-multiple-inputs.rst +++ b/Help/release/dev/cmake-E-multiple-inputs.rst @@ -1,5 +1,5 @@ -cmake-E-copy-multiple-inputs ----------------------------- +cmake-E-multiple-inputs +----------------------- * The :manual:`cmake(1)` ``-E copy`` and ``-E copy_if_different`` command-line tools learned to support copying multiple input files to a directory. From 7984ac5e58722295e71f6c2418e2a54d6f1a0cc1 Mon Sep 17 00:00:00 2001 From: Bartosz Kosiorek Date: Wed, 9 Dec 2015 15:59:43 +0100 Subject: [PATCH 041/255] cmake: Teach -E make_directory to support multiple input directories --- Help/manual/cmake.1.rst | 10 ++++++---- Help/release/dev/cmake-E-multiple-inputs.rst | 3 +++ Source/cmcmd.cxx | 19 ++++++++++++------- ...directory-directory-with-parent-result.txt | 1 + ...directory-directory-with-parent-stderr.txt | 0 ...tory-three-directories-and-file-result.txt | 1 + ...tory-three-directories-and-file-stderr.txt | 1 + ...ake_directory-three-directories-result.txt | 1 + ...ake_directory-three-directories-stderr.txt | 0 Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 14 ++++++++++++++ 10 files changed, 39 insertions(+), 11 deletions(-) create mode 100644 Tests/RunCMake/CommandLine/E_make_directory-directory-with-parent-result.txt create mode 100644 Tests/RunCMake/CommandLine/E_make_directory-directory-with-parent-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/E_make_directory-three-directories-and-file-result.txt create mode 100644 Tests/RunCMake/CommandLine/E_make_directory-three-directories-and-file-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/E_make_directory-three-directories-result.txt create mode 100644 Tests/RunCMake/CommandLine/E_make_directory-three-directories-stderr.txt diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index 4cbe97678..91af3e3db 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -167,7 +167,8 @@ Available commands are: Change the current working directory and run a command. ``compare_files `` - Check if file1 is same as file2. + Check if ```` is same as ````. If files are the same, + then returns 0, if not itreturns 1. ``copy ... `` Copy files to ```` (either file or directory). @@ -194,10 +195,11 @@ Available commands are: Run command in a modified environment. ``environment`` - Display the current environment. + Display the current environment variables. -``make_directory `` - Create a directory. +``make_directory ...`` + Create ```` directories. If necessary, create parent + directories too. ``md5sum ...`` Compute md5sum of files. diff --git a/Help/release/dev/cmake-E-multiple-inputs.rst b/Help/release/dev/cmake-E-multiple-inputs.rst index aa52a9895..480261d87 100644 --- a/Help/release/dev/cmake-E-multiple-inputs.rst +++ b/Help/release/dev/cmake-E-multiple-inputs.rst @@ -6,3 +6,6 @@ cmake-E-multiple-inputs * The :manual:`cmake(1)` ``-E copy_directory`` command-line tool learned to support copying multiple input directories to a directory. + +* The :manual:`cmake(1)` ``-E make_directory`` command-line + tool learned to support copying multiple input directories to a directory. diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 6a4234f09..fb7b1f5ff 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -68,7 +68,7 @@ void CMakeCommandUsage(const char* program) << " env [--unset=NAME]... [NAME=VALUE]... COMMAND [ARG]...\n" << " - run command in a modified environment\n" << " environment - display the current environment\n" - << " make_directory dir - create a directory\n" + << " make_directory ... - create parent and directories\n" << " md5sum ... - compute md5sum of files\n" << " remove [-f] ... - remove the file(s), use -f to force " "it\n" @@ -447,15 +447,20 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) } #endif - else if (args[1] == "make_directory" && args.size() == 3) + else if (args[1] == "make_directory" && args.size() > 2) { - if(!cmSystemTools::MakeDirectory(args[2].c_str())) + // If error occurs we want to continue copying next files. + bool return_value = 0; + for (std::string::size_type cc = 2; cc < args.size(); cc ++) { - std::cerr << "Error making directory \"" << args[2] - << "\".\n"; - return 1; + if(!cmSystemTools::MakeDirectory(args[cc].c_str())) + { + std::cerr << "Error creating directory \"" + << args[cc] << "\".\n"; + return_value = 1; + } } - return 0; + return return_value; } else if (args[1] == "remove_directory" && args.size() == 3) diff --git a/Tests/RunCMake/CommandLine/E_make_directory-directory-with-parent-result.txt b/Tests/RunCMake/CommandLine/E_make_directory-directory-with-parent-result.txt new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_make_directory-directory-with-parent-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CommandLine/E_make_directory-directory-with-parent-stderr.txt b/Tests/RunCMake/CommandLine/E_make_directory-directory-with-parent-stderr.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/CommandLine/E_make_directory-three-directories-and-file-result.txt b/Tests/RunCMake/CommandLine/E_make_directory-three-directories-and-file-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_make_directory-three-directories-and-file-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_make_directory-three-directories-and-file-stderr.txt b/Tests/RunCMake/CommandLine/E_make_directory-three-directories-and-file-stderr.txt new file mode 100644 index 000000000..08a9428f4 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_make_directory-three-directories-and-file-stderr.txt @@ -0,0 +1 @@ +^Error creating directory .*file_for_test.txt\".$ diff --git a/Tests/RunCMake/CommandLine/E_make_directory-three-directories-result.txt b/Tests/RunCMake/CommandLine/E_make_directory-three-directories-result.txt new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_make_directory-three-directories-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CommandLine/E_make_directory-three-directories-stderr.txt b/Tests/RunCMake/CommandLine/E_make_directory-three-directories-stderr.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 57036ba3d..5e2200f56 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -140,6 +140,20 @@ unset(in) unset(out) unset(outfile) +set(out ${RunCMake_BINARY_DIR}/make_directory_output) +set(outfile ${out}/file_for_test.txt) +file(REMOVE_RECURSE "${out}") +file(MAKE_DIRECTORY ${out}) +file(WRITE ${outfile} "") +run_cmake_command(E_make_directory-three-directories + ${CMAKE_COMMAND} -E make_directory ${out}/d1 ${out}/d2 ${out}/d2) +run_cmake_command(E_make_directory-directory-with-parent + ${CMAKE_COMMAND} -E make_directory ${out}/parent/child) +run_cmake_command(E_make_directory-three-directories-and-file + ${CMAKE_COMMAND} -E make_directory ${out}/d1 ${out}/d2 ${outfile}) +unset(out) +unset(outfile) + run_cmake_command(E_env-no-command0 ${CMAKE_COMMAND} -E env) run_cmake_command(E_env-no-command1 ${CMAKE_COMMAND} -E env TEST_ENV=1) From 39abbaed7756ac9b4d1d2e7f44575ae85388aaf6 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 10 Dec 2015 09:14:54 -0500 Subject: [PATCH 042/255] FindOpenAL: Detect Windows architecture-specific installation Some OpenAL implementations on Windows provide both Win32 and Win64 binaries. Search the location of the matching architecture. Author: George "Zogzer@GitHub" --- Modules/FindOpenAL.cmake | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Modules/FindOpenAL.cmake b/Modules/FindOpenAL.cmake index 8150ff291..eb63cef5a 100644 --- a/Modules/FindOpenAL.cmake +++ b/Modules/FindOpenAL.cmake @@ -79,11 +79,17 @@ find_path(OPENAL_INCLUDE_DIR al.h [HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir] ) +if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(_OpenAL_ARCH_DIR libs/Win64) +else() + set(_OpenAL_ARCH_DIR libs/Win32) +endif() + find_library(OPENAL_LIBRARY NAMES OpenAL al openal OpenAL32 HINTS ENV OPENALDIR - PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64 + PATH_SUFFIXES lib64 lib libs64 libs ${_OpenAL_ARCH_DIR} PATHS ~/Library/Frameworks /Library/Frameworks @@ -94,6 +100,7 @@ find_library(OPENAL_LIBRARY [HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir] ) +unset(_OpenAL_ARCH_DIR) # handle the QUIETLY and REQUIRED arguments and set OPENAL_FOUND to TRUE if # all listed variables are TRUE From e0ad72d8af9bfba80d24f823d79440ebb9136bda Mon Sep 17 00:00:00 2001 From: Andrey Mishchenko Date: Wed, 9 Dec 2015 12:15:52 -0500 Subject: [PATCH 043/255] Graphviz: Fix handling of spaces in GRAPHVIZ_GRAPH_NAME Without this patch, `SET (GRAPHVIZ_GRAPH_NAME "hello world")` does not work (it results in a parsing error in GraphViz when the generated output is processed), but `SET (GRAPHVIZ_GRAPH_NAME "\"hello world\"")` does. --- Source/cmGraphVizWriter.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index a63b6e36c..448306fe4 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -292,7 +292,7 @@ void cmGraphVizWriter::WriteGlobalFile(const char* fileName) void cmGraphVizWriter::WriteHeader(cmGeneratedFileStream& str) const { - str << this->GraphType << " " << this->GraphName << " {" << std::endl; + str << this->GraphType << " \"" << this->GraphName << "\" {" << std::endl; str << this->GraphHeader << std::endl; } From 67211011d946684bed73bcd5b976ec90f4c30856 Mon Sep 17 00:00:00 2001 From: Michael Scott Date: Sun, 6 Dec 2015 12:33:13 +0000 Subject: [PATCH 044/255] cmake-gui: Add options to control warning messages Create a new dialog window for the cmake-gui that provides controls for setting the state of suppression of developer and deprecated warning messages. This replaces the previous single checkbox for setting the state of suppression of developer warnings. Added a note for the new functionality to the release notes. --- Help/release/dev/cmake-W-options.rst | 3 + Source/QtDialog/CMakeLists.txt | 4 + Source/QtDialog/CMakeSetupDialog.cxx | 15 +-- Source/QtDialog/CMakeSetupDialog.h | 3 +- Source/QtDialog/QCMake.cxx | 18 +++- Source/QtDialog/QCMake.h | 7 +- Source/QtDialog/WarningMessagesDialog.cxx | 43 ++++++++ Source/QtDialog/WarningMessagesDialog.h | 53 ++++++++++ Source/QtDialog/WarningMessagesDialog.ui | 120 ++++++++++++++++++++++ Source/cmake.cxx | 33 +++++- Source/cmake.h | 7 ++ 11 files changed, 292 insertions(+), 14 deletions(-) create mode 100644 Source/QtDialog/WarningMessagesDialog.cxx create mode 100644 Source/QtDialog/WarningMessagesDialog.h create mode 100644 Source/QtDialog/WarningMessagesDialog.ui diff --git a/Help/release/dev/cmake-W-options.rst b/Help/release/dev/cmake-W-options.rst index 57d375f5d..38e71f99a 100644 --- a/Help/release/dev/cmake-W-options.rst +++ b/Help/release/dev/cmake-W-options.rst @@ -10,3 +10,6 @@ cmake-W-options * Warnings about deprecated functionality are now enabled by default. They may be suppressed with ``-Wno-deprecated`` or by setting the :variable:`CMAKE_WARN_DEPRECATED` variable to false. + +* Warnings about deprecated functionality can now be controlled in the + :manual:`cmake-gui(1)` application. diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index cad11f52a..9161ad3ae 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -115,6 +115,8 @@ set(SRCS QCMakeWidgets.h RegexExplorer.cxx RegexExplorer.h + WarningMessagesDialog.cxx + WarningMessagesDialog.h ) QT4_WRAP_UI(UI_SRCS CMakeSetupDialog.ui @@ -122,6 +124,7 @@ QT4_WRAP_UI(UI_SRCS CrossCompiler.ui AddCacheEntry.ui RegexExplorer.ui + WarningMessagesDialog.ui ) QT4_WRAP_CPP(MOC_SRCS AddCacheEntry.h @@ -132,6 +135,7 @@ QT4_WRAP_CPP(MOC_SRCS QCMakeCacheView.h QCMakeWidgets.h RegexExplorer.h + WarningMessagesDialog.h ) QT4_ADD_RESOURCES(RC_SRCS CMakeSetup.qrc) diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index 2b12834f4..2fc4fafdc 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -34,6 +34,7 @@ #include "AddCacheEntry.h" #include "FirstConfigure.h" #include "RegexExplorer.h" +#include "WarningMessagesDialog.h" #include "cmSystemTools.h" #include "cmVersion.h" @@ -145,9 +146,8 @@ CMakeSetupDialog::CMakeSetupDialog() this, SLOT(doOutputErrorNext())); // in Eclipse QMenu* OptionsMenu = this->menuBar()->addMenu(tr("&Options")); - this->SuppressDevWarningsAction = - OptionsMenu->addAction(tr("&Suppress dev Warnings (-Wno-dev)")); - this->SuppressDevWarningsAction->setCheckable(true); + OptionsMenu->addAction(tr("Warning Messages..."), + this, SLOT(doWarningMessagesDialog())); this->WarnUninitializedAction = OptionsMenu->addAction(tr("&Warn Uninitialized (--warn-uninitialized)")); this->WarnUninitializedAction->setCheckable(true); @@ -278,9 +278,6 @@ void CMakeSetupDialog::initialize() QObject::connect(this->AddEntry, SIGNAL(clicked(bool)), this, SLOT(addCacheEntry())); - QObject::connect(this->SuppressDevWarningsAction, SIGNAL(triggered(bool)), - this->CMakeThread->cmakeInstance(), SLOT(setSuppressDevWarnings(bool))); - QObject::connect(this->WarnUninitializedAction, SIGNAL(triggered(bool)), this->CMakeThread->cmakeInstance(), SLOT(setWarnUninitializedMode(bool))); @@ -1369,3 +1366,9 @@ void CMakeSetupDialog::doOutputErrorNext() this->Output->setTextCursor(textCursor); } } + +void CMakeSetupDialog::doWarningMessagesDialog() +{ + WarningMessagesDialog dialog(this, this->CMakeThread->cmakeInstance()); + dialog.exec(); +} diff --git a/Source/QtDialog/CMakeSetupDialog.h b/Source/QtDialog/CMakeSetupDialog.h index bfd2bc9ef..4b53b1cbd 100644 --- a/Source/QtDialog/CMakeSetupDialog.h +++ b/Source/QtDialog/CMakeSetupDialog.h @@ -83,6 +83,8 @@ protected slots: void doOutputFindPrev(); void doOutputErrorNext(); void doRegexExplorerDialog(); + /// display the modal warning messages dialog window + void doWarningMessagesDialog(); protected: @@ -102,7 +104,6 @@ protected: QAction* ExitAction; QAction* ConfigureAction; QAction* GenerateAction; - QAction* SuppressDevWarningsAction; QAction* WarnUninitializedAction; QAction* WarnUnusedAction; QAction* InstallForCommandLineAction; diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 1fcb67676..71b794068 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -26,7 +26,6 @@ QCMake::QCMake(QObject* p) : QObject(p) { - this->SuppressDevWarnings = false; this->WarnUninitializedMode = false; this->WarnUnusedMode = false; qRegisterMetaType(); @@ -167,7 +166,6 @@ void QCMake::configure() this->CMakeInstance->SetGeneratorPlatform(""); this->CMakeInstance->SetGeneratorToolset(this->Toolset.toLocal8Bit().data()); this->CMakeInstance->LoadCache(); - this->CMakeInstance->SetSuppressDevWarnings(this->SuppressDevWarnings); this->CMakeInstance->SetWarnUninitialized(this->WarnUninitializedMode); this->CMakeInstance->SetWarnUnused(this->WarnUnusedMode); this->CMakeInstance->PreLoadCMakeFiles(); @@ -457,10 +455,24 @@ bool QCMake::getDebugOutput() const return this->CMakeInstance->GetDebugOutput(); } +bool QCMake::getSuppressDevWarnings() +{ + return this->CMakeInstance->GetSuppressDevWarnings(); +} void QCMake::setSuppressDevWarnings(bool value) { - this->SuppressDevWarnings = value; + this->CMakeInstance->SetSuppressDevWarnings(value); +} + +bool QCMake::getSuppressDeprecatedWarnings() +{ + return this->CMakeInstance->GetSuppressDeprecatedWarnings(); +} + +void QCMake::setSuppressDeprecatedWarnings(bool value) +{ + this->CMakeInstance->SetSuppressDeprecatedWarnings(value); } void QCMake::setWarnUninitializedMode(bool value) diff --git a/Source/QtDialog/QCMake.h b/Source/QtDialog/QCMake.h index 2d45da965..4b787b985 100644 --- a/Source/QtDialog/QCMake.h +++ b/Source/QtDialog/QCMake.h @@ -91,8 +91,14 @@ public slots: void reloadCache(); /// set whether to do debug output void setDebugOutput(bool); + /// get whether to do suppress dev warnings + bool getSuppressDevWarnings(); /// set whether to do suppress dev warnings void setSuppressDevWarnings(bool value); + /// get whether to do suppress deprecated warnings + bool getSuppressDeprecatedWarnings(); + /// set whether to do suppress deprecated warnings + void setSuppressDeprecatedWarnings(bool value); /// set whether to run cmake with warnings about uninitialized variables void setWarnUninitializedMode(bool value); /// set whether to run cmake with warnings about unused variables @@ -146,7 +152,6 @@ protected: bool&, void* cd); static void stdoutCallback(const char* msg, size_t len, void* cd); static void stderrCallback(const char* msg, size_t len, void* cd); - bool SuppressDevWarnings; bool WarnUninitializedMode; bool WarnUnusedMode; bool WarnUnusedAllMode; diff --git a/Source/QtDialog/WarningMessagesDialog.cxx b/Source/QtDialog/WarningMessagesDialog.cxx new file mode 100644 index 000000000..735b71c38 --- /dev/null +++ b/Source/QtDialog/WarningMessagesDialog.cxx @@ -0,0 +1,43 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Kitware, Inc., Gregor Jasny + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#include "WarningMessagesDialog.h" + +WarningMessagesDialog::WarningMessagesDialog(QWidget* prnt, QCMake* instance) + : QDialog(prnt), cmakeInstance(instance) +{ + this->setupUi(this); + this->setInitialValues(); + this->setupSignals(); +} + +void WarningMessagesDialog::setInitialValues() +{ + this->suppressDeveloperWarnings->setChecked( + this->cmakeInstance->getSuppressDevWarnings()); + this->suppressDeprecatedWarnings->setChecked( + this->cmakeInstance->getSuppressDeprecatedWarnings()); +} + +void WarningMessagesDialog::setupSignals() +{ + QObject::connect(this->buttonBox, SIGNAL(accepted()), + this, SLOT(doAccept())); +} + +void WarningMessagesDialog::doAccept() +{ + this->cmakeInstance->setSuppressDevWarnings( + this->suppressDeveloperWarnings->isChecked()); + this->cmakeInstance->setSuppressDeprecatedWarnings( + this->suppressDeprecatedWarnings->isChecked()); +} diff --git a/Source/QtDialog/WarningMessagesDialog.h b/Source/QtDialog/WarningMessagesDialog.h new file mode 100644 index 000000000..028ec104d --- /dev/null +++ b/Source/QtDialog/WarningMessagesDialog.h @@ -0,0 +1,53 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Kitware, Inc., Gregor Jasny + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#ifndef WarningMessagesDialog_h +#define WarningMessagesDialog_h + +#include +#include + +#include "ui_WarningMessagesDialog.h" +#include "QCMake.h" + +/** + * Dialog window for setting the warning message related options. + */ +class WarningMessagesDialog : public QDialog, public Ui_MessagesDialog +{ + Q_OBJECT + +public: + WarningMessagesDialog(QWidget* prnt, QCMake* instance); + +private slots: + /** + * Handler for the accept event of the ok/cancel button box. + */ + void doAccept(); + +private: + QCMake* cmakeInstance; + + /** + * Set the initial values of the widgets on this dialog window, using the + * current state of the cache. + */ + void setInitialValues(); + + /** + * Setup the signals for the widgets on this dialog window. + */ + void setupSignals(); +}; + +#endif /* MessageDialog_h */ diff --git a/Source/QtDialog/WarningMessagesDialog.ui b/Source/QtDialog/WarningMessagesDialog.ui new file mode 100644 index 000000000..2367772cf --- /dev/null +++ b/Source/QtDialog/WarningMessagesDialog.ui @@ -0,0 +1,120 @@ + + + MessagesDialog + + + + 0 + 0 + 250 + 150 + + + + Warning Messages + + + true + + + + + + + 0 + 0 + + + + Suppress Warnings + + + + + + + 0 + 0 + + + + Developer Warnings + + + false + + + + + + + + 0 + 0 + + + + Deprecated Warnings + + + false + + + + + + + + + + + 0 + 0 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + MessagesDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + MessagesDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/Source/cmake.cxx b/Source/cmake.cxx index c0a11965f..e57e51214 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2883,17 +2883,23 @@ void cmake::RunCheckForUnusedVariables() void cmake::SetSuppressDevWarnings(bool b) { + std::string value; + // equivalent to -Wno-dev if (b) { - this->DiagLevels["dev"] = DIAG_IGNORE; + value = "TRUE"; } // equivalent to -Wdev else { - this->DiagLevels["dev"] = std::max(this->DiagLevels["dev"], - DIAG_WARN); + value = "FALSE"; } + + this->AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", value.c_str(), + "Suppress Warnings that are meant for" + " the author of the CMakeLists.txt files.", + cmState::INTERNAL); } bool cmake::GetSuppressDevWarnings(cmMakefile const* mf) @@ -2932,3 +2938,24 @@ bool cmake::GetSuppressDeprecatedWarnings(cmMakefile const* mf) return cacheEntryValue && cmSystemTools::IsOff(cacheEntryValue); } } + +void cmake::SetSuppressDeprecatedWarnings(bool b) +{ + std::string value; + + // equivalent to -Wno-deprecated + if (b) + { + value = "FALSE"; + } + // equivalent to -Wdeprecated + else + { + value = "TRUE"; + } + + this->AddCacheEntry("CMAKE_WARN_DEPRECATED", value.c_str(), + "Whether to issue warnings for deprecated " + "functionality.", + cmState::INTERNAL); +} diff --git a/Source/cmake.h b/Source/cmake.h index 4c5515b8a..1d63e66fc 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -308,6 +308,9 @@ class cmake std::string const& GetCMakeEditCommand() const { return this->CMakeEditCommand; } + /* + * Set the state of the suppression of developer (author) warnings. + */ void SetSuppressDevWarnings(bool v); /* * Get the state of the suppression of developer (author) warnings. @@ -316,6 +319,10 @@ class cmake */ bool GetSuppressDevWarnings(cmMakefile const* mf = NULL); + /* + * Set the state of the suppression of deprecated warnings. + */ + void SetSuppressDeprecatedWarnings(bool v); /* * Get the state of the suppression of deprecated warnings. * Returns false, by default, if deprecated warnings should be shown, true From 291275347be3f9c02aff6fb4dfa45a3e5b2f5b4a Mon Sep 17 00:00:00 2001 From: Michael Scott Date: Sun, 6 Dec 2015 12:58:24 +0000 Subject: [PATCH 045/255] cmake: Deduplicate warning message control code Remove the duplicate code in cmake::Configure to set the cache variables for the warning message suppression. Replace it with calls to the dedicated methods to carry this out. --- Source/cmake.cxx | 66 ++++++++++++++++++------------------------------ Source/cmake.h | 14 +++++----- 2 files changed, 31 insertions(+), 49 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index e57e51214..79924953e 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1269,17 +1269,11 @@ int cmake::Configure() diagLevel = this->DiagLevels["deprecated"]; if (diagLevel == DIAG_IGNORE) { - this->AddCacheEntry("CMAKE_WARN_DEPRECATED", "FALSE", - "Whether to issue warnings for deprecated " - "functionality.", - cmState::INTERNAL); + this->SetSuppressDeprecatedWarnings(true); } else if (diagLevel == DIAG_WARN) { - this->AddCacheEntry("CMAKE_WARN_DEPRECATED", "TRUE", - "Whether to issue warnings for deprecated " - "functionality.", - cmState::INTERNAL); + this->SetSuppressDeprecatedWarnings(false); } } @@ -1299,32 +1293,20 @@ int cmake::Configure() diagLevel = this->DiagLevels["dev"]; if (diagLevel == DIAG_IGNORE) { - this->AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", "TRUE", - "Suppress Warnings that are meant for" - " the author of the CMakeLists.txt files.", - cmState::INTERNAL); + this->SetSuppressDevWarnings(true); if (setDeprecatedVariables) { - this->AddCacheEntry("CMAKE_WARN_DEPRECATED", "FALSE", - "Whether to issue warnings for deprecated " - "functionality.", - cmState::INTERNAL); + this->SetSuppressDeprecatedWarnings(true); } } else if (diagLevel == DIAG_WARN) { - this->AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", "FALSE", - "Suppress Warnings that are meant for" - " the author of the CMakeLists.txt files.", - cmState::INTERNAL); + this->SetSuppressDevWarnings(false); if (setDeprecatedVariables) { - this->AddCacheEntry("CMAKE_WARN_DEPRECATED", "TRUE", - "Whether to issue warnings for deprecated " - "functionality.", - cmState::INTERNAL); + this->SetSuppressDeprecatedWarnings(false); } } } @@ -2881,6 +2863,24 @@ void cmake::RunCheckForUnusedVariables() #endif } +bool cmake::GetSuppressDevWarnings(cmMakefile const* mf) +{ + /* + * The suppression CMake variable may be set in the CMake configuration file + * itself, so we have to check what its set to in the makefile if we can. + */ + if (mf) + { + return mf->IsOn("CMAKE_SUPPRESS_DEVELOPER_WARNINGS"); + } + else + { + const char* cacheEntryValue = this->State->GetCacheEntryValue( + "CMAKE_SUPPRESS_DEVELOPER_WARNINGS"); + return cmSystemTools::IsOn(cacheEntryValue); + } +} + void cmake::SetSuppressDevWarnings(bool b) { std::string value; @@ -2902,24 +2902,6 @@ void cmake::SetSuppressDevWarnings(bool b) cmState::INTERNAL); } -bool cmake::GetSuppressDevWarnings(cmMakefile const* mf) -{ - /* - * The suppression CMake variable may be set in the CMake configuration file - * itself, so we have to check what its set to in the makefile if we can. - */ - if (mf) - { - return mf->IsOn("CMAKE_SUPPRESS_DEVELOPER_WARNINGS"); - } - else - { - const char* cacheEntryValue = this->State->GetCacheEntryValue( - "CMAKE_SUPPRESS_DEVELOPER_WARNINGS"); - return cmSystemTools::IsOn(cacheEntryValue); - } -} - bool cmake::GetSuppressDeprecatedWarnings(cmMakefile const* mf) { /* diff --git a/Source/cmake.h b/Source/cmake.h index 1d63e66fc..298d82b6b 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -308,27 +308,27 @@ class cmake std::string const& GetCMakeEditCommand() const { return this->CMakeEditCommand; } - /* - * Set the state of the suppression of developer (author) warnings. - */ - void SetSuppressDevWarnings(bool v); /* * Get the state of the suppression of developer (author) warnings. * Returns false, by default, if developer warnings should be shown, true * otherwise. */ bool GetSuppressDevWarnings(cmMakefile const* mf = NULL); - /* - * Set the state of the suppression of deprecated warnings. + * Set the state of the suppression of developer (author) warnings. */ - void SetSuppressDeprecatedWarnings(bool v); + void SetSuppressDevWarnings(bool v); + /* * Get the state of the suppression of deprecated warnings. * Returns false, by default, if deprecated warnings should be shown, true * otherwise. */ bool GetSuppressDeprecatedWarnings(cmMakefile const* mf = NULL); + /* + * Set the state of the suppression of deprecated warnings. + */ + void SetSuppressDeprecatedWarnings(bool v); /** Display a message to the user. */ void IssueMessage(cmake::MessageType t, std::string const& text, From 2b7a47d76ac5289acc1572917b8ac8266ffec0ca Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Wed, 9 Dec 2015 11:45:28 -0500 Subject: [PATCH 046/255] KWSys 2015-12-09 (cdcf4c47) Extract upstream KWSys using the following shell commands. $ git archive --prefix=upstream-kwsys/ cdcf4c47 | tar x $ git shortlog --no-merges --abbrev=8 --format='%h %s' 6bfc1aef..cdcf4c47 Brad King (2): 452b10d5 FundamentalType: Drop KWSYS_CAN_CONVERT_UI64_TO_DOUBLE macro cdcf4c47 Drop the CPU.h component of KWSys --- CMakeLists.txt | 10 +-- CPU.h.in | 141 -------------------------------------- FundamentalType.h.in | 7 -- kwsysPlatformTestsCXX.cxx | 15 ---- 4 files changed, 1 insertion(+), 172 deletions(-) delete mode 100644 CPU.h.in diff --git a/CMakeLists.txt b/CMakeLists.txt index ce7f5635d..b859e79d9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -124,7 +124,6 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) SET(KWSYS_USE_FStream 1) SET(KWSYS_USE_String 1) SET(KWSYS_USE_SystemInformation 1) - SET(KWSYS_USE_CPU 1) ENDIF() # Enforce component dependencies. @@ -425,13 +424,6 @@ IF(KWSYS_USE_FundamentalType) ENDIF() ENDFOREACH() - IF(KWSYS_USE___INT64) - KWSYS_PLATFORM_CXX_TEST(KWSYS_CAN_CONVERT_UI64_TO_DOUBLE - "Checking whether unsigned __int64 can convert to double" DIRECT) - ELSE() - SET(KWSYS_CAN_CONVERT_UI64_TO_DOUBLE 1) - ENDIF() - # Check signedness of "char" type. KWSYS_PLATFORM_CXX_TEST_RUN(KWSYS_CHAR_IS_SIGNED "Checking whether char is signed" DIRECT) @@ -749,7 +741,7 @@ ENDFOREACH() # Add selected C components. FOREACH(c - Process Base64 Encoding FundamentalType MD5 Terminal System String CPU + Process Base64 Encoding FundamentalType MD5 Terminal System String ) IF(KWSYS_USE_${c}) # Use the corresponding header file. diff --git a/CPU.h.in b/CPU.h.in deleted file mode 100644 index 66ffbb1fd..000000000 --- a/CPU.h.in +++ /dev/null @@ -1,141 +0,0 @@ -/*============================================================================ - KWSys - Kitware System Library - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#ifndef @KWSYS_NAMESPACE@_CPU_h -#define @KWSYS_NAMESPACE@_CPU_h - -#include <@KWSYS_NAMESPACE@/Configure.h> - -/* Identify possible endian cases. The macro - @KWSYS_NAMESPACE@_CPU_ENDIAN_ID will be defined to one of these, or - 0 if unknown. */ -#define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG 4321 -#define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE 1234 - -/* Apple always defines one of these. */ -#if defined(__LITTLE_ENDIAN__) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE -#elif defined(__BIG_ENDIAN__) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG - -/* Alpha */ -#elif defined(__alpha) || defined(__alpha__) || defined(_M_ALPHA) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE - -/* Arm */ -#elif defined(__arm__) -# if !defined(__ARMEB__) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE -# else -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG -# endif - -/* Intel x86 */ -#elif defined(__i386) || defined(__i386__) || defined(_M_IX86) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE -#elif defined(_X86_) || defined(__THW_INTEL__) || defined(__I86__) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE -#elif defined(__MWERKS__) && defined(__INTEL__) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE - -/* Intel x86-64 */ -#elif defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE -#elif defined(__amd64) || defined(__amd64__) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE - -/* Intel Architecture-64 (Itanium) */ -#elif defined(__ia64) || defined(__ia64__) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE -#elif defined(_IA64) || defined(__IA64__) || defined(_M_IA64) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE - -/* PowerPC */ -#elif defined(__powerpc) || defined(__powerpc__) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG -#elif defined(__ppc) || defined(__ppc__) || defined(__POWERPC__) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG - -/* SPARC */ -#elif defined(__sparc) || defined(__sparc__) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG - -/* HP/PA RISC */ -#elif defined(__hppa) || defined(__hppa__) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG - -/* Motorola 68k */ -#elif defined(__m68k__) || defined(M68000) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG - -/* MIPSel (MIPS little endian) */ -#elif defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE - -/* MIPSeb (MIPS big endian) */ -#elif defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG - -/* MIPS (fallback, big endian) */ -#elif defined(__mips) || defined(__mips__) || defined(__MIPS__) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG - -/* NIOS2 */ -#elif defined(__NIOS2__) || defined(__NIOS2) || defined(__nios2__) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE - -/* OpenRISC 1000 */ -#elif defined(__or1k__) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG - -/* RS/6000 */ -#elif defined(__THW_RS600) || defined(_IBMR2) || defined(_POWER) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG -#elif defined(_ARCH_PWR) || defined(_ARCH_PWR2) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG - -/* System/370 */ -#elif defined(__370__) || defined(__THW_370__) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG - -/* System/390 */ -#elif defined(__s390__) || defined(__s390x__) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG - -/* z/Architecture */ -#elif defined(__SYSC_ZARCH__) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG - -/* Aarch64 */ -#elif defined(__aarch64__) -# if !defined(__AARCH64EB__) -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE -# else -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG -# endif - -/* Unknown CPU */ -#else -# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID 0 -# if !defined(@KWSYS_NAMESPACE@_CPU_UNKNOWN_OKAY) -# error "The target CPU architecture is not known." -# endif -#endif - -/* If building a C or C++ file in kwsys itself, give the source file - access to the macros without a configured namespace. */ -#if defined(KWSYS_NAMESPACE) -# define KWSYS_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID -# define KWSYS_CPU_ENDIAN_ID_BIG @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG -# define KWSYS_CPU_ENDIAN_ID_LITTLE @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_LITTLE -#endif - -#endif diff --git a/FundamentalType.h.in b/FundamentalType.h.in index ff200633a..e702a7a32 100644 --- a/FundamentalType.h.in +++ b/FundamentalType.h.in @@ -90,18 +90,12 @@ typedef unsigned long kwsysFundamentalType_UInt32; #if @KWSYS_NAMESPACE@_SIZEOF_LONG == 8 typedef signed long kwsysFundamentalType_Int64; typedef unsigned long kwsysFundamentalType_UInt64; -/* Whether UInt64 can be converted to double. */ -# define @KWSYS_NAMESPACE@_CAN_CONVERT_UI64_TO_DOUBLE 1 #elif @KWSYS_NAMESPACE@_USE_LONG_LONG && @KWSYS_NAMESPACE@_SIZEOF_LONG_LONG == 8 typedef signed long long kwsysFundamentalType_Int64; typedef unsigned long long kwsysFundamentalType_UInt64; -/* Whether UInt64 can be converted to double. */ -# define @KWSYS_NAMESPACE@_CAN_CONVERT_UI64_TO_DOUBLE 1 #elif @KWSYS_NAMESPACE@_USE___INT64 && @KWSYS_NAMESPACE@_SIZEOF___INT64 == 8 typedef signed __int64 kwsysFundamentalType_Int64; typedef unsigned __int64 kwsysFundamentalType_UInt64; -/* Whether UInt64 can be converted to double. */ -# define @KWSYS_NAMESPACE@_CAN_CONVERT_UI64_TO_DOUBLE @KWSYS_CAN_CONVERT_UI64_TO_DOUBLE@ #else # error "No native data type can represent a 64-bit integer." #endif @@ -140,7 +134,6 @@ typedef unsigned __int64 kwsysFundamentalType_UInt64; # define KWSYS_USE_LONG_LONG @KWSYS_NAMESPACE@_USE_LONG_LONG # define KWSYS_USE___INT64 @KWSYS_NAMESPACE@_USE___INT64 # define KWSYS_CHAR_IS_SIGNED @KWSYS_NAMESPACE@_CHAR_IS_SIGNED -# define KWSYS_CAN_CONVERT_UI64_TO_DOUBLE @KWSYS_NAMESPACE@_CAN_CONVERT_UI64_TO_DOUBLE #endif #endif diff --git a/kwsysPlatformTestsCXX.cxx b/kwsysPlatformTestsCXX.cxx index 962693705..aaa33b8c2 100644 --- a/kwsysPlatformTestsCXX.cxx +++ b/kwsysPlatformTestsCXX.cxx @@ -78,21 +78,6 @@ int main() } #endif -#ifdef TEST_KWSYS_CAN_CONVERT_UI64_TO_DOUBLE -void function(double& l, unsigned __int64 const& r) -{ - l = static_cast(r); -} - -int main() -{ - double tTo = 0.0; - unsigned __int64 tFrom = 0; - function(tTo, tFrom); - return 0; -} -#endif - #ifdef TEST_KWSYS_IOS_HAS_ISTREAM_LONG_LONG # include int test_istream(std::istream& is, long long& x) From ecdc77f14d7a37f9d173ea2ca4946bf51c6a43d0 Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Thu, 10 Dec 2015 17:38:18 +0100 Subject: [PATCH 047/255] CPackWIX: Fix installed file property lookups when using components The WIX generator incorrectly looked for installed file properties by relative paths that included the component specific staging directory prefix. Remove that prefix in installed file property lookups when generating packages with components. --- Source/CPack/WiX/cmCPackWIXGenerator.cxx | 23 +++++++++++++++++++---- Source/CPack/WiX/cmCPackWIXGenerator.h | 3 +++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index d5246db43..da8b486c2 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -911,8 +911,9 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons( relativeDirectoryPath = "."; } - cmInstalledFile const* directoryInstalledFile = - this->GetInstalledFile(relativeDirectoryPath); + cmInstalledFile const* directoryInstalledFile = this->GetInstalledFile( + this->RelativePathWithoutComponentPrefix(relativeDirectoryPath) + ); bool emptyDirectory = dir.GetNumberOfFiles() == 2; bool createDirectory = false; @@ -980,8 +981,9 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons( } else { - cmInstalledFile const* installedFile = - this->GetInstalledFile(relativePath); + cmInstalledFile const* installedFile = this->GetInstalledFile( + this->RelativePathWithoutComponentPrefix(relativePath) + ); if(installedFile) { @@ -1230,3 +1232,16 @@ void cmCPackWIXGenerator::AddCustomFlags( stream << " " << QuotePath(*i); } } + +std::string cmCPackWIXGenerator::RelativePathWithoutComponentPrefix( + std::string const& path) +{ + if(this->Components.empty()) + { + return path; + } + + std::string::size_type pos = path.find('/'); + + return path.substr(pos + 1); +} diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.h b/Source/CPack/WiX/cmCPackWIXGenerator.h index d50160953..3f66b2c02 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.h +++ b/Source/CPack/WiX/cmCPackWIXGenerator.h @@ -168,6 +168,9 @@ private: void AddCustomFlags( std::string const& variableName, std::ostream& stream); + std::string RelativePathWithoutComponentPrefix( + std::string const& path); + std::vector WixSources; id_map_t PathToIdMap; ambiguity_map_t IdAmbiguityCounter; From 972849fbb7531b2d43e4ecc5bd0cf2b0b75922da Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 10 Dec 2015 11:16:11 -0500 Subject: [PATCH 048/255] Tests: Simplify CTest.UpdateGIT repo path construction Avoid constructing full paths to .git repositories in the test. Use relative paths and let Git convert them to absolute paths internally. This is simpler and also avoids trouble with various absolute path root component conventions on Windows (`c:/`, `/c/`, `/cygdrive/c/`). --- Tests/CTestUpdateGIT.cmake.in | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/Tests/CTestUpdateGIT.cmake.in b/Tests/CTestUpdateGIT.cmake.in index 6488a1f2f..46230cca3 100644 --- a/Tests/CTestUpdateGIT.cmake.in +++ b/Tests/CTestUpdateGIT.cmake.in @@ -41,7 +41,6 @@ run_child( COMMAND ${GIT} --bare init ) file(REMOVE_RECURSE ${TOP}/repo.git/hooks) -set(REPO file://${TOP}/repo.git) # Create submodule repository. message("Creating submodule...") @@ -51,17 +50,13 @@ run_child( COMMAND ${GIT} --bare init ) file(REMOVE_RECURSE ${TOP}/module.git/hooks) -set(MOD_REPO file://${TOP}/module.git) -create_content(module) -run_child(WORKING_DIRECTORY ${TOP}/module - COMMAND ${GIT} init +run_child(WORKING_DIRECTORY ${TOP} + COMMAND ${GIT} clone module.git module ) file(REMOVE_RECURSE ${TOP}/module/.git/hooks) file(APPEND ${TOP}/module/.git/config " -[remote \"origin\"] -\turl = ${MOD_REPO} -\tfetch = +refs/heads/*:refs/remotes/origin/* ${AUTHOR_CONFIG}") +create_content(module) run_child(WORKING_DIRECTORY ${TOP}/module COMMAND ${GIT} add . ) @@ -75,20 +70,17 @@ run_child(WORKING_DIRECTORY ${TOP}/module #----------------------------------------------------------------------------- # Import initial content into the repository. message("Importing content...") -create_content(import) -file(WRITE ${TOP}/import/HEAD "HEAD\n") -file(WRITE ${TOP}/import/master "master\n") # Import the content into the repository. -run_child(WORKING_DIRECTORY ${TOP}/import - COMMAND ${GIT} init +run_child(WORKING_DIRECTORY ${TOP} + COMMAND ${GIT} clone repo.git import ) file(REMOVE_RECURSE ${TOP}/import/.git/hooks) file(APPEND ${TOP}/import/.git/config " -[remote \"origin\"] -\turl = ${REPO} -\tfetch = +refs/heads/*:refs/remotes/origin/* ${AUTHOR_CONFIG}") +create_content(import) +file(WRITE ${TOP}/import/HEAD "HEAD\n") +file(WRITE ${TOP}/import/master "master\n") run_child(WORKING_DIRECTORY ${TOP}/import COMMAND ${GIT} add . ) @@ -96,7 +88,7 @@ run_child(WORKING_DIRECTORY ${TOP}/import COMMAND ${GIT} config core.safecrlf false ) run_child(WORKING_DIRECTORY ${TOP}/import - COMMAND ${GIT} submodule add ${MOD_REPO} module + COMMAND ${GIT} submodule add ../module.git module ) run_child(WORKING_DIRECTORY ${TOP}/import COMMAND ${GIT} commit -m "Initial content" @@ -123,7 +115,7 @@ run_child(WORKING_DIRECTORY ${TOP}/module message("Checking out revision 1...") run_child( WORKING_DIRECTORY ${TOP} - COMMAND ${GIT} clone ${REPO} user-source + COMMAND ${GIT} clone repo.git user-source ) file(REMOVE_RECURSE ${TOP}/user-source/.git/hooks) file(APPEND ${TOP}/user-source/.git/config "${AUTHOR_CONFIG}") @@ -278,7 +270,7 @@ set(CTEST_GIT_COMMAND \"${GIT}\") set(CTEST_GIT_UPDATE_OPTIONS) execute_process( WORKING_DIRECTORY \"${TOP}\" - COMMAND \"${GIT}\" clone \"${REPO}\" dash-source + COMMAND \"${GIT}\" clone repo.git dash-source ) # Test .git file. From 1549927d7dc29476ada7b0c0867e9630ebe6ea00 Mon Sep 17 00:00:00 2001 From: Chris Pavlina Date: Thu, 10 Dec 2015 10:40:27 -0500 Subject: [PATCH 049/255] FindOpenMP: Add Clang support --- Help/release/dev/FindOpenMP-clang.rst | 4 ++++ Modules/FindOpenMP.cmake | 3 +++ 2 files changed, 7 insertions(+) create mode 100644 Help/release/dev/FindOpenMP-clang.rst diff --git a/Help/release/dev/FindOpenMP-clang.rst b/Help/release/dev/FindOpenMP-clang.rst new file mode 100644 index 000000000..44c805c82 --- /dev/null +++ b/Help/release/dev/FindOpenMP-clang.rst @@ -0,0 +1,4 @@ +FindOpenMP-clang +---------------- + +* The :module:`FindOpenMP` module learned to support Clang. diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index a102c66e3..ee4bdd6c8 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -50,6 +50,8 @@ function(_OPENMP_FLAG_CANDIDATES LANG) " " #GNU "-fopenmp" + #Clang + "-fopenmp=libomp" #Microsoft Visual Studio "/openmp" #Intel windows @@ -67,6 +69,7 @@ function(_OPENMP_FLAG_CANDIDATES LANG) ) set(OMP_FLAG_GNU "-fopenmp") + set(OMP_FLAG_Clang "-fopenmp=libomp") set(OMP_FLAG_HP "+Oopenmp") if(WIN32) set(OMP_FLAG_Intel "-Qopenmp") From 93936d78d221ea49f918f95e33b97796b2a3190f Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 10 Dec 2015 14:28:57 -0500 Subject: [PATCH 050/255] Utilities/Release: Avoid repeat copy of files with same suffix --- Utilities/Release/release_cmake.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Utilities/Release/release_cmake.cmake b/Utilities/Release/release_cmake.cmake index c50602dad..f41ec9c86 100644 --- a/Utilities/Release/release_cmake.cmake +++ b/Utilities/Release/release_cmake.cmake @@ -120,6 +120,10 @@ foreach(gen ${generators}) endif() endforeach() +if(SUFFIXES) + list(REMOVE_DUPLICATES SUFFIXES) +endif() + if(LOCAL_DIR) file(MAKE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${LOCAL_DIR}") else() From a42bf6c5ddc70e0b15bbf60f11678aae71ff1f56 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 10 Dec 2015 14:30:55 -0500 Subject: [PATCH 051/255] Utilities/Release: Add support for copying .msi files --- Utilities/Release/release_cmake.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Utilities/Release/release_cmake.cmake b/Utilities/Release/release_cmake.cmake index f41ec9c86..0a3d324e7 100644 --- a/Utilities/Release/release_cmake.cmake +++ b/Utilities/Release/release_cmake.cmake @@ -112,6 +112,9 @@ foreach(gen ${generators}) if("${gen}" STREQUAL "TZ") set(SUFFIXES ${SUFFIXES} "*.tar.Z") endif() + if("${gen}" STREQUAL "WIX") + set(SUFFIXES ${SUFFIXES} "*.msi") + endif() if("${gen}" STREQUAL "ZIP") set(SUFFIXES ${SUFFIXES} "*.zip") endif() From 4c60e07d857277f1edc45358b35c6f50439324b4 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 10 Dec 2015 14:33:40 -0500 Subject: [PATCH 052/255] CMake: Fix WiX-generated .msi package file name convention Update our configuration of the CPack WIX generator for CMake itself to produce file names consistent with other CPack generators. --- CMakeCPackOptions.cmake.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in index ae006536d..4ebf30699 100644 --- a/CMakeCPackOptions.cmake.in +++ b/CMakeCPackOptions.cmake.in @@ -194,9 +194,9 @@ if("${CPACK_GENERATOR}" STREQUAL "WIX") # Reset CPACK_PACKAGE_VERSION to deal with WiX restriction. # But the file names still use the full CMake_VERSION value: set(CPACK_PACKAGE_FILE_NAME - "${CPACK_PACKAGE_NAME}-@CMake_VERSION@-${CPACK_SYSTEM_NAME}") + "cmake-@CMake_VERSION@-${CPACK_SYSTEM_NAME}") set(CPACK_SOURCE_PACKAGE_FILE_NAME - "${CPACK_PACKAGE_NAME}-@CMake_VERSION@-Source") + "cmake-@CMake_VERSION@") if(NOT CPACK_WIX_SIZEOF_VOID_P) set(CPACK_WIX_SIZEOF_VOID_P "@CMAKE_SIZEOF_VOID_P@") From 34f5ef564aa94f2f66f35c708dbfca260b419e4b Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Thu, 10 Dec 2015 20:43:33 +0100 Subject: [PATCH 053/255] iOS: Fix App Bundle layout In contrast to OS X the iOS App Bundle layout is a flat structure. --- Source/cmInstallTargetGenerator.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 59d06f6e0..c6908c32a 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -152,13 +152,19 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, // Handle OSX Bundles. if(this->Target->IsAppBundleOnApple()) { + cmMakefile const* mf = this->Target->Target->GetMakefile(); + // Install the whole app bundle directory. type = cmInstallType_DIRECTORY; literal_args += " USE_SOURCE_PERMISSIONS"; from1 += ".app"; // Tweaks apply to the binary inside the bundle. - to1 += ".app/Contents/MacOS/"; + to1 += ".app/"; + if(!mf->PlatformIsAppleIos()) + { + to1 += "Contents/MacOS/"; + } to1 += targetName; } else From 565d080a9a1e133bda868e905226181b60e90356 Mon Sep 17 00:00:00 2001 From: Ruslan Baratov Date: Thu, 8 Oct 2015 03:09:34 +0300 Subject: [PATCH 054/255] Xcode: Add support for combined install on iOS This patch solves the problem of installing both: Device and Simulator libraries on iOS. Before only one of them was installed. If the IOS_INSTALL_COMBINED property is set on a target, a special install hook will be activated which builds the corresponding target and combines both at the install location. The original patch was contributed by Ruslan Baratov, and polished by Gregor Jasny. --- Help/manual/cmake-properties.7.rst | 1 + Help/manual/cmake-variables.7.rst | 1 + Help/prop_tgt/IOS_INSTALL_COMBINED.rst | 11 + Help/release/dev/ios-universal.rst | 7 + Help/variable/CMAKE_IOS_INSTALL_COMBINED.rst | 8 + Modules/CMakeIOSInstallCombined.cmake | 297 ++++++++++++++++++ Source/cmInstallTargetGenerator.cxx | 44 +++ Source/cmInstallTargetGenerator.h | 2 + Source/cmTarget.cxx | 1 + .../RunCMake/XcodeProject/RunCMakeTest.cmake | 36 +++ ...codeIOSInstallCombined-install-check.cmake | 30 ++ .../XcodeIOSInstallCombined.cmake | 27 ++ ...OSInstallCombinedPrune-install-check.cmake | 26 ++ ...IOSInstallCombinedPrune-install-stdout.txt | 2 + .../XcodeIOSInstallCombinedPrune.cmake | 36 +++ Tests/RunCMake/XcodeProject/main.cpp | 3 + 16 files changed, 532 insertions(+) create mode 100644 Help/prop_tgt/IOS_INSTALL_COMBINED.rst create mode 100644 Help/release/dev/ios-universal.rst create mode 100644 Help/variable/CMAKE_IOS_INSTALL_COMBINED.rst create mode 100644 Modules/CMakeIOSInstallCombined.cmake create mode 100644 Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-install-check.cmake create mode 100644 Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake create mode 100644 Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune-install-check.cmake create mode 100644 Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune-install-stdout.txt create mode 100644 Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake create mode 100644 Tests/RunCMake/XcodeProject/main.cpp diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 931363c83..a41d48499 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -191,6 +191,7 @@ Properties on Targets /prop_tgt/INTERFACE_SYSTEM_INCLUDE_DIRECTORIES /prop_tgt/INTERPROCEDURAL_OPTIMIZATION_CONFIG /prop_tgt/INTERPROCEDURAL_OPTIMIZATION + /prop_tgt/IOS_INSTALL_COMBINED /prop_tgt/JOB_POOL_COMPILE /prop_tgt/JOB_POOL_LINK /prop_tgt/LABELS diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 211690050..3f4957283 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -257,6 +257,7 @@ Variables that Control the Build /variable/CMAKE_INSTALL_NAME_DIR /variable/CMAKE_INSTALL_RPATH /variable/CMAKE_INSTALL_RPATH_USE_LINK_PATH + /variable/CMAKE_IOS_INSTALL_COMBINED /variable/CMAKE_LANG_COMPILER_LAUNCHER /variable/CMAKE_LANG_INCLUDE_WHAT_YOU_USE /variable/CMAKE_LANG_VISIBILITY_PRESET diff --git a/Help/prop_tgt/IOS_INSTALL_COMBINED.rst b/Help/prop_tgt/IOS_INSTALL_COMBINED.rst new file mode 100644 index 000000000..59f67a7eb --- /dev/null +++ b/Help/prop_tgt/IOS_INSTALL_COMBINED.rst @@ -0,0 +1,11 @@ +IOS_INSTALL_COMBINED +-------------------- + +Build a combined (device and simulator) target when installing. + +When this property is set to set to false (which is the default) then it will +either be built with the device SDK or the simulator SDK depending on the SDK +set. But if this property is set to true then the target will at install time +also be built for the corresponding SDK and combined into one library. + +This feature requires at least Xcode version 6. diff --git a/Help/release/dev/ios-universal.rst b/Help/release/dev/ios-universal.rst new file mode 100644 index 000000000..f96abede3 --- /dev/null +++ b/Help/release/dev/ios-universal.rst @@ -0,0 +1,7 @@ +ios-universal +------------- + +* When building for embedded Apple platforms like iOS CMake learned to build and + install combined targets which contain both a device and a simulator build. + This behavior can be enabled by setting the :prop_tgt:`IOS_INSTALL_COMBINED` + target property. diff --git a/Help/variable/CMAKE_IOS_INSTALL_COMBINED.rst b/Help/variable/CMAKE_IOS_INSTALL_COMBINED.rst new file mode 100644 index 000000000..c5cb9b647 --- /dev/null +++ b/Help/variable/CMAKE_IOS_INSTALL_COMBINED.rst @@ -0,0 +1,8 @@ +CMAKE_IOS_INSTALL_COMBINED +-------------------------- + +Default value for :prop_tgt:`IOS_INSTALL_COMBINED` of targets. + +This variable is used to initialize the :prop_tgt:`IOS_INSTALL_COMBINED` +property on all the targets. See that target property for additional +information. diff --git a/Modules/CMakeIOSInstallCombined.cmake b/Modules/CMakeIOSInstallCombined.cmake new file mode 100644 index 000000000..f052a3bf1 --- /dev/null +++ b/Modules/CMakeIOSInstallCombined.cmake @@ -0,0 +1,297 @@ + +#============================================================================= +# Copyright 2014-2015 Ruslan Baratov, Gregor Jasny +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# Function to print messages of this module +function(_ios_install_combined_message) + message("[iOS combined] " ${ARGN}) +endfunction() + +# Get build settings for the current target/config/SDK by running +# `xcodebuild -sdk ... -showBuildSettings` and parsing it's output +function(_ios_install_combined_get_build_setting sdk variable resultvar) + if("${sdk}" STREQUAL "") + message(FATAL_ERROR "`sdk` is empty") + endif() + + if("${variable}" STREQUAL "") + message(FATAL_ERROR "`variable` is empty") + endif() + + if("${resultvar}" STREQUAL "") + message(FATAL_ERROR "`resultvar` is empty") + endif() + + set( + cmd + xcodebuild -showBuildSettings + -sdk "${sdk}" + -target "${CURRENT_TARGET}" + -config "${CURRENT_CONFIG}" + ) + + execute_process( + COMMAND ${cmd} + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" + RESULT_VARIABLE result + OUTPUT_VARIABLE output + ) + + if(NOT result EQUAL 0) + message(FATAL_ERROR "Command failed (${result}): ${cmd}") + endif() + + if(NOT output MATCHES " ${variable} = ([^\n]*)") + message(FATAL_ERROR "${variable} not found.") + endif() + + set("${resultvar}" "${CMAKE_MATCH_1}" PARENT_SCOPE) +endfunction() + +# Get architectures of given SDK (iphonesimulator/iphoneos) +function(_ios_install_combined_get_valid_archs sdk resultvar) + cmake_policy(SET CMP0007 NEW) + + if("${resultvar}" STREQUAL "") + message(FATAL_ERROR "`resultvar` is empty") + endif() + + _ios_install_combined_get_build_setting("${sdk}" "VALID_ARCHS" valid_archs) + + separate_arguments(valid_archs) + list(REMOVE_ITEM valid_archs "") # remove empty elements + list(REMOVE_DUPLICATES valid_archs) + + set("${resultvar}" "${valid_archs}" PARENT_SCOPE) +endfunction() + +# Final target can contain more architectures that specified by SDK. This +# function will run 'lipo -info' and parse output. Result will be returned +# as a CMake list. +function(_ios_install_combined_get_real_archs filename resultvar) + set(cmd "${_lipo_path}" -info "${filename}") + execute_process( + COMMAND ${cmd} + RESULT_VARIABLE result + OUTPUT_VARIABLE output + ERROR_VARIABLE output + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_STRIP_TRAILING_WHITESPACE + ) + if(NOT result EQUAL 0) + message( + FATAL_ERROR "Command failed (${result}): ${cmd}\n\nOutput:\n${output}" + ) + endif() + + if(NOT output MATCHES "(Architectures in the fat file: [^\n]+ are|Non-fat file: [^\n]+ is architecture): ([^\n]*)") + message(FATAL_ERROR "Could not detect architecture from: ${output}") + endif() + + separate_arguments(CMAKE_MATCH_2) + set(${resultvar} ${CMAKE_MATCH_2} PARENT_SCOPE) +endfunction() + +# Run build command for the given SDK +function(_ios_install_combined_build sdk) + if("${sdk}" STREQUAL "") + message(FATAL_ERROR "`sdk` is empty") + endif() + + _ios_install_combined_message("Build `${CURRENT_TARGET}` for `${sdk}`") + + execute_process( + COMMAND + "${CMAKE_COMMAND}" + --build + . + --target "${CURRENT_TARGET}" + --config ${CURRENT_CONFIG} + -- + -sdk "${sdk}" + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" + RESULT_VARIABLE result + ) + + if(NOT result EQUAL 0) + message(FATAL_ERROR "Build failed") + endif() +endfunction() + +# Remove given architecture from file. This step needed only in rare cases +# when target was built in "unusual" way. Emit warning message. +function(_ios_install_combined_remove_arch lib arch) + _ios_install_combined_message( + "Warning! Unexpected architecture `${arch}` detected and will be removed " + "from file `${lib}`") + set(cmd "${_lipo_path}" -remove ${arch} -output ${lib} ${lib}) + execute_process( + COMMAND ${cmd} + RESULT_VARIABLE result + OUTPUT_VARIABLE output + ERROR_VARIABLE output + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_STRIP_TRAILING_WHITESPACE + ) + if(NOT result EQUAL 0) + message( + FATAL_ERROR "Command failed (${result}): ${cmd}\n\nOutput:\n${output}" + ) + endif() +endfunction() + +# Check that 'lib' contains only 'archs' architectures (remove others). +function(_ios_install_combined_keep_archs lib archs) + _ios_install_combined_get_real_archs("${lib}" real_archs) + set(archs_to_remove ${real_archs}) + list(REMOVE_ITEM archs_to_remove ${archs}) + foreach(x ${archs_to_remove}) + _ios_install_combined_remove_arch("${lib}" "${x}") + endforeach() +endfunction() + +function(_ios_install_combined_detect_sdks this_sdk_var corr_sdk_var) + cmake_policy(SET CMP0057 NEW) + + set(this_sdk "$ENV{PLATFORM_NAME}") + if("${this_sdk}" STREQUAL "") + message(FATAL_ERROR "Environment variable PLATFORM_NAME is empty") + endif() + + set(all_platforms "$ENV{SUPPORTED_PLATFORMS}") + if("${all_platforms}" STREQUAL "") + message(FATAL_ERROR "Environment variable SUPPORTED_PLATFORMS is empty") + endif() + + separate_arguments(all_platforms) + if(NOT this_sdk IN_LIST all_platforms) + message(FATAL_ERROR "`${this_sdk}` not found in `${all_platforms}`") + endif() + + list(REMOVE_ITEM all_platforms "" "${this_sdk}") + list(LENGTH all_platforms all_platforms_length) + if(NOT all_platforms_length EQUAL 1) + message(FATAL_ERROR "Expected one element: ${all_platforms}") + endif() + + set(${this_sdk_var} "${this_sdk}" PARENT_SCOPE) + set(${corr_sdk_var} "${all_platforms}" PARENT_SCOPE) +endfunction() + +# Create combined binary for the given target. +# +# Preconditions: +# * Target already installed at ${destination} +# for the ${PLATFORM_NAME} platform +# +# This function will: +# * Run build for the lacking platform, i.e. opposite to the ${PLATFORM_NAME} +# * Fuse both libraries by running lipo +function(ios_install_combined target destination) + if("${target}" STREQUAL "") + message(FATAL_ERROR "`target` is empty") + endif() + + if("${destination}" STREQUAL "") + message(FATAL_ERROR "`destination` is empty") + endif() + + if(NOT IS_ABSOLUTE "${destination}") + message(FATAL_ERROR "`destination` is not absolute: ${destination}") + endif() + + if(IS_DIRECTORY "${destination}" OR IS_SYMLINK "${destination}") + message(FATAL_ERROR "`destination` is no regular file: ${destination}") + endif() + + if("${CMAKE_BINARY_DIR}" STREQUAL "") + message(FATAL_ERROR "`CMAKE_BINARY_DIR` is empty") + endif() + + if(NOT IS_DIRECTORY "${CMAKE_BINARY_DIR}") + message(FATAL_ERROR "Is not a directory: ${CMAKE_BINARY_DIR}") + endif() + + if("${CMAKE_INSTALL_CONFIG_NAME}" STREQUAL "") + message(FATAL_ERROR "CMAKE_INSTALL_CONFIG_NAME is empty") + endif() + + set(cmd xcrun -f lipo) + execute_process( + COMMAND ${cmd} + RESULT_VARIABLE result + OUTPUT_VARIABLE output + ERROR_VARIABLE output + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_STRIP_TRAILING_WHITESPACE + ) + if(NOT result EQUAL 0) + message( + FATAL_ERROR "Command failed (${result}): ${cmd}\n\nOutput:\n${output}" + ) + endif() + set(_lipo_path ${output}) + + set(CURRENT_CONFIG "${CMAKE_INSTALL_CONFIG_NAME}") + set(CURRENT_TARGET "${target}") + + _ios_install_combined_message("Target: ${CURRENT_TARGET}") + _ios_install_combined_message("Config: ${CURRENT_CONFIG}") + _ios_install_combined_message("Destination: ${destination}") + + # Get SDKs + _ios_install_combined_detect_sdks(this_sdk corr_sdk) + + # Get architectures of the target + _ios_install_combined_get_valid_archs("${corr_sdk}" corr_valid_archs) + _ios_install_combined_get_valid_archs("${this_sdk}" this_valid_archs) + + # Return if there are no valid architectures for the SDK. + # (note that library already installed) + if("${corr_valid_archs}" STREQUAL "") + _ios_install_combined_message( + "No architectures detected for `${corr_sdk}` (skip)" + ) + return() + endif() + + # Trigger build of corresponding target + _ios_install_combined_build("${corr_sdk}") + + # Get location of the library in build directory + _ios_install_combined_get_build_setting( + "${corr_sdk}" "CONFIGURATION_BUILD_DIR" corr_build_dir) + _ios_install_combined_get_build_setting( + "${corr_sdk}" "EXECUTABLE_PATH" corr_executable_path) + set(corr "${corr_build_dir}/${corr_executable_path}") + + _ios_install_combined_keep_archs("${corr}" "${corr_valid_archs}") + _ios_install_combined_keep_archs("${destination}" "${this_valid_archs}") + + _ios_install_combined_message("Current: ${destination}") + _ios_install_combined_message("Corresponding: ${corr}") + + set(cmd "${_lipo_path}" -create ${corr} ${destination} -output ${destination}) + + execute_process( + COMMAND ${cmd} + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + RESULT_VARIABLE result + ) + + if(NOT result EQUAL 0) + message(FATAL_ERROR "Command failed: ${cmd}") + endif() + + _ios_install_combined_message("Install done: ${destination}") +endfunction() diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index c6908c32a..1158a27d5 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -531,6 +531,7 @@ void cmInstallTargetGenerator::PostReplacementTweaks(std::ostream& os, { this->AddInstallNamePatchRule(os, indent, config, file); this->AddChrpathPatchRule(os, indent, config, file); + this->AddUniversalInstallRule(os, indent, file); this->AddRanlibRule(os, indent, file); this->AddStripRule(os, indent, file); } @@ -867,3 +868,46 @@ cmInstallTargetGenerator::AddRanlibRule(std::ostream& os, os << indent << "execute_process(COMMAND \"" << ranlib << "\" \"" << toDestDirPath << "\")\n"; } + +//---------------------------------------------------------------------------- +void +cmInstallTargetGenerator +::AddUniversalInstallRule(std::ostream& os, + Indent const& indent, + const std::string& toDestDirPath) +{ + cmMakefile const* mf = this->Target->Target->GetMakefile(); + + if(!mf->PlatformIsAppleIos() || !mf->IsOn("XCODE")) + { + return; + } + + const char* xcodeVersion = mf->GetDefinition("XCODE_VERSION"); + if(!xcodeVersion || cmSystemTools::VersionCompareGreater("6", xcodeVersion)) + { + return; + } + + switch(this->Target->GetType()) + { + case cmState::EXECUTABLE: + case cmState::STATIC_LIBRARY: + case cmState::SHARED_LIBRARY: + case cmState::MODULE_LIBRARY: + break; + + default: + return; + } + + if(!this->Target->Target->GetPropertyAsBool("IOS_INSTALL_COMBINED")) + { + return; + } + + os << indent << "include(CMakeIOSInstallCombined)\n"; + os << indent << "ios_install_combined(" + << "\"" << this->Target->Target->GetName() << "\" " + << "\"" << toDestDirPath << "\")\n"; +} diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h index ec89c05ea..18b313082 100644 --- a/Source/cmInstallTargetGenerator.h +++ b/Source/cmInstallTargetGenerator.h @@ -101,6 +101,8 @@ protected: const std::string& toDestDirPath); void AddRanlibRule(std::ostream& os, Indent const& indent, const std::string& toDestDirPath); + void AddUniversalInstallRule(std::ostream& os, Indent const& indent, + const std::string& toDestDirPath); std::string TargetName; cmGeneratorTarget* Target; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 9ea1a34e6..1986e5fd3 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -132,6 +132,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) this->SetPropertyDefault("Fortran_MODULE_DIRECTORY", 0); this->SetPropertyDefault("GNUtoMS", 0); this->SetPropertyDefault("OSX_ARCHITECTURES", 0); + this->SetPropertyDefault("IOS_INSTALL_COMBINED", 0); this->SetPropertyDefault("AUTOMOC", 0); this->SetPropertyDefault("AUTOUIC", 0); this->SetPropertyDefault("AUTORCC", 0); diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index f89d62063..acc007580 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -94,3 +94,39 @@ if(NOT XCODE_VERSION VERSION_LESS 7) run_cmake(XcodeTbdStub) unset(RunCMake_TEST_OPTIONS) endif() + +if(NOT XCODE_VERSION VERSION_LESS 6) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombined-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OPTIONS + "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install" + "-DCMAKE_IOS_INSTALL_COMBINED=YES") + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(XcodeIOSInstallCombined) + run_cmake_command(XcodeIOSInstallCombined-build ${CMAKE_COMMAND} --build .) + run_cmake_command(XcodeIOSInstallCombined-install ${CMAKE_COMMAND} --build . --target install) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) + unset(RunCMake_TEST_OPTIONS) + + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombinedPrune-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_OPTIONS + "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install" + "-DCMAKE_IOS_INSTALL_COMBINED=YES") + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(XcodeIOSInstallCombinedPrune) + run_cmake_command(XcodeIOSInstallCombinedPrune-build ${CMAKE_COMMAND} --build .) + run_cmake_command(XcodeIOSInstallCombinedPrune-install ${CMAKE_COMMAND} --build . --target install) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) + unset(RunCMake_TEST_OPTIONS) +endif() diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-install-check.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-install-check.cmake new file mode 100644 index 000000000..a1c06718f --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-install-check.cmake @@ -0,0 +1,30 @@ +function(verify_architectures file) + execute_process( + COMMAND xcrun otool -vf ${RunCMake_TEST_BINARY_DIR}/_install/${file} + OUTPUT_VARIABLE otool_out + ERROR_VARIABLE otool_err + RESULT_VARIABLE otool_result) + if(NOT otool_result EQUAL "0") + message(SEND_ERROR "Could not retrieve fat headers: ${otool_err}") + return() + endif() + + string(REGEX MATCHALL "architecture [^ \n\t]+" architectures ${otool_out}) + string(REPLACE "architecture " "" actual "${architectures}") + list(SORT actual) + + set(expected arm64 armv7 i386 x86_64) + + if(NOT actual STREQUAL expected) + message(SEND_ERROR + "The actual library contains the architectures:\n ${actual} \n" + "which do not match expected ones:\n ${expected} \n" + "otool output:\n${otool_out}") + endif() +endfunction() + +verify_architectures(bin/foo_app.app/foo_app) +verify_architectures(lib/libfoo_static.a) +verify_architectures(lib/libfoo_shared.dylib) +verify_architectures(lib/foo_bundle.bundle/foo_bundle) +verify_architectures(lib/foo_framework.framework/foo_framework) diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake new file mode 100644 index 000000000..fc830b19e --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake @@ -0,0 +1,27 @@ +cmake_minimum_required(VERSION 3.3) + +project(IOSInstallCombined CXX) + +set(CMAKE_OSX_SYSROOT iphoneos) +set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") +set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf") +set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") + +set(CMAKE_OSX_ARCHITECTURES "armv7;arm64;i386;x86_64") + +add_executable(foo_app MACOSX_BUNDLE main.cpp) +install(TARGETS foo_app BUNDLE DESTINATION bin) + +add_library(foo_static STATIC foo.cpp) +install(TARGETS foo_static ARCHIVE DESTINATION lib) + +add_library(foo_shared SHARED foo.cpp) +install(TARGETS foo_shared LIBRARY DESTINATION lib) + +add_library(foo_bundle MODULE foo.cpp) +set_target_properties(foo_bundle PROPERTIES BUNDLE TRUE) +install(TARGETS foo_bundle LIBRARY DESTINATION lib) + +add_library(foo_framework SHARED foo.cpp) +set_target_properties(foo_framework PROPERTIES FRAMEWORK TRUE) +install(TARGETS foo_framework FRAMEWORK DESTINATION lib) diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune-install-check.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune-install-check.cmake new file mode 100644 index 000000000..83da17da7 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune-install-check.cmake @@ -0,0 +1,26 @@ +function(verify_architectures file) + execute_process( + COMMAND xcrun otool -vf ${RunCMake_TEST_BINARY_DIR}/_install/${file} + OUTPUT_VARIABLE otool_out + ERROR_VARIABLE otool_err + RESULT_VARIABLE otool_result) + if(NOT otool_result EQUAL "0") + message(SEND_ERROR "Could not retrieve fat headers: ${otool_err}") + return() + endif() + + string(REGEX MATCHALL "architecture [^ \n\t]+" architectures ${otool_out}) + string(REPLACE "architecture " "" actual "${architectures}") + list(SORT actual) + + set(expected armv7 x86_64) + + if(NOT actual STREQUAL expected) + message(SEND_ERROR + "The actual library contains the architectures:\n ${actual} \n" + "which do not match expected ones:\n ${expected} \n" + "otool output:\n${otool_out}") + endif() +endfunction() + +verify_architectures(lib/libfoo.dylib) diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune-install-stdout.txt b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune-install-stdout.txt new file mode 100644 index 000000000..28edadc6b --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune-install-stdout.txt @@ -0,0 +1,2 @@ +.*Unexpected architecture `i386` detected.* +.*Unexpected architecture `arm64` detected.* \ No newline at end of file diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake new file mode 100644 index 000000000..b47d3a597 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake @@ -0,0 +1,36 @@ +cmake_minimum_required(VERSION 3.3) + +project(XcodeIOSInstallCombinedPrune CXX) + +set(CMAKE_OSX_SYSROOT iphoneos) +set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") +set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf") + +add_library(foo SHARED foo.cpp) +install(TARGETS foo DESTINATION lib) + +add_library(baz SHARED foo.cpp) +set_target_properties( + foo baz + PROPERTIES + XCODE_ATTRIBUTE_ARCHS[sdk=iphoneos*] armv7 + XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphoneos*] armv7 + XCODE_ATTRIBUTE_ARCHS[sdk=iphonesimulator*] x86_64 + XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphonesimulator*] x86_64 +) + +add_library(boo SHARED foo.cpp) +set_target_properties( + boo + PROPERTIES + XCODE_ATTRIBUTE_ARCHS[sdk=iphoneos*] arm64 + XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphoneos*] arm64 + XCODE_ATTRIBUTE_ARCHS[sdk=iphonesimulator*] i386 + XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphonesimulator*] i386 +) + +add_custom_command( + TARGET foo + POST_BUILD + COMMAND lipo -create $ $ -output $ +) diff --git a/Tests/RunCMake/XcodeProject/main.cpp b/Tests/RunCMake/XcodeProject/main.cpp new file mode 100644 index 000000000..1695921f2 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/main.cpp @@ -0,0 +1,3 @@ +int main(int argc, const char * argv[]) { + return 0; +} From 611735e76e14807e2145d6b67efbb080d419f19f Mon Sep 17 00:00:00 2001 From: Roger Leigh Date: Thu, 10 Dec 2015 15:52:07 +0000 Subject: [PATCH 055/255] FindGTest: Add imported targets and update documentation --- Modules/FindGTest.cmake | 166 +++++++++++++++++++++++++++------------- 1 file changed, 111 insertions(+), 55 deletions(-) diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake index eb7abfd73..ca49e4aca 100644 --- a/Modules/FindGTest.cmake +++ b/Modules/FindGTest.cmake @@ -4,88 +4,89 @@ # # Locate the Google C++ Testing Framework. # -# Defines the following variables: +# Imported targets +# ^^^^^^^^^^^^^^^^ # -# :: +# This module defines the following :prop_tgt:`IMPORTED` targets: # -# GTEST_FOUND - Found the Google Testing framework -# GTEST_INCLUDE_DIRS - Include directories +# ``GTest::GTest`` +# The Google Test ``gtest`` library, if found; adds Thread::Thread +# automatically +# ``GTest::Main`` +# The Google Test ``gtest_main`` library, if found # # +# Result variables +# ^^^^^^^^^^^^^^^^ # -# Also defines the library variables below as normal variables. These +# This module will set the following variables in your project: +# +# ``GTEST_FOUND`` +# Found the Google Testing framework +# ``GTEST_INCLUDE_DIRS`` +# the directory containing the Google Test headers +# +# The library variables below are set as normal variables. These # contain debug/optimized keywords when a debugging library is found. # -# :: +# ``GTEST_LIBRARIES`` +# The Google Test ``gtest`` library; note it also requires linking +# with an appropriate thread library +# ``GTEST_MAIN_LIBRARIES`` +# The Google Test ``gtest_main`` library +# ``GTEST_BOTH_LIBRARIES`` +# Both ``gtest`` and ``gtest_main`` # -# GTEST_BOTH_LIBRARIES - Both libgtest & libgtest-main -# GTEST_LIBRARIES - libgtest -# GTEST_MAIN_LIBRARIES - libgtest-main +# Cache variables +# ^^^^^^^^^^^^^^^ +# +# The following cache variables may also be set: +# +# ``GTEST_ROOT`` +# The root directory of the Google Test installation (may also be +# set as an environment variable) +# ``GTEST_MSVC_SEARCH`` +# If compiling with MSVC, this variable can be set to ``MD`` or +# ``MT`` (the default) to enable searching a GTest build tree # # -# -# Accepts the following variables as input: -# -# :: -# -# GTEST_ROOT - (as a CMake or environment variable) -# The root directory of the gtest install prefix -# -# -# -# :: -# -# GTEST_MSVC_SEARCH - If compiling with MSVC, this variable can be set to -# "MD" or "MT" to enable searching a GTest build tree -# (defaults: "MD") -# -# -# -# Example Usage: +# Example usage +# ^^^^^^^^^^^^^ # # :: # # enable_testing() # find_package(GTest REQUIRED) -# include_directories(${GTEST_INCLUDE_DIRS}) -# -# -# -# :: # # add_executable(foo foo.cc) -# target_link_libraries(foo ${GTEST_BOTH_LIBRARIES}) -# -# -# -# :: +# target_link_libraries(foo GTest::GTest GTest::Main) # # add_test(AllTestsInFoo foo) # # -# -# +# Deeper integration with CTest +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # # If you would like each Google test to show up in CTest as a test you -# may use the following macro. NOTE: It will slow down your tests by -# running an executable for each test and test fixture. You will also -# have to rerun CMake after adding or removing tests or test fixtures. +# may use the following macro:: # -# GTEST_ADD_TESTS(executable extra_args ARGN) +# GTEST_ADD_TESTS(executable extra_args files...) # -# :: +# ``executable`` +# the path to the test executable +# ``extra_args`` +# a list of extra arguments to be passed to executable enclosed in +# quotes (or ``""`` for none) +# ``files...`` +# a list of source files to search for tests and test fixtures. Or +# ``AUTO`` to find them from executable target # -# executable = The path to the test executable -# extra_args = Pass a list of extra arguments to be passed to -# executable enclosed in quotes (or "" for none) -# ARGN = A list of source files to search for tests & test -# fixtures. Or AUTO to find them from executable target. +# However, note that this macro will slow down your tests by running +# an executable for each test and test fixture. You will also have to +# re-run CMake after adding or removing tests or test fixtures. # +# Example usage:: # -# -# :: -# -# Example: # set(FooTestArgs --foo 1 --bar 2) # add_executable(FooTest FooUnitTest.cc) # GTEST_ADD_TESTS(FooTest "${FooTestArgs}" AUTO) @@ -208,5 +209,60 @@ if(GTEST_FOUND) _gtest_append_debugs(GTEST_LIBRARIES GTEST_LIBRARY) _gtest_append_debugs(GTEST_MAIN_LIBRARIES GTEST_MAIN_LIBRARY) set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES}) -endif() + include(CMakeFindDependencyMacro) + find_dependency(Threads) + + if(NOT TARGET GTest::GTest) + add_library(GTest::GTest UNKNOWN IMPORTED) + set_target_properties(GTest::GTest PROPERTIES + INTERFACE_LINK_LIBRARIES "Threads::Threads") + if(GTEST_INCLUDE_DIRS) + set_target_properties(GTest::GTest PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${GTEST_INCLUDE_DIRS}") + endif() + if(EXISTS "${GTEST_LIBRARY}") + set_target_properties(GTest::GTest PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION "${GTEST_LIBRARY}") + endif() + if(EXISTS "${GTEST_LIBRARY_DEBUG}") + set_property(TARGET GTest::GTest APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(GTest::GTest PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX" + IMPORTED_LOCATION_DEBUG "${GTEST_LIBRARY_DEBUG}") + endif() + if(EXISTS "${GTEST_LIBRARY_RELEASE}") + set_property(TARGET GTest::GTest APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(GTest::GTest PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX" + IMPORTED_LOCATION_RELEASE "${GTEST_LIBRARY_RELEASE}") + endif() + endif() + if(NOT TARGET GTest::Main) + add_library(GTest::Main UNKNOWN IMPORTED) + set_target_properties(GTest::Main PROPERTIES + INTERFACE_LINK_LIBRARIES "GTest::GTest") + if(EXISTS "${GTEST_MAIN_LIBRARY}") + set_target_properties(GTest::Main PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION "${GTEST_MAIN_LIBRARY}") + endif() + if(EXISTS "${GTEST_MAIN_LIBRARY_DEBUG}") + set_property(TARGET GTest::Main APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(GTest::Main PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX" + IMPORTED_LOCATION_DEBUG "${GTEST_MAIN_LIBRARY_DEBUG}") + endif() + if(EXISTS "${GTEST_MAIN_LIBRARY_RELEASE}") + set_property(TARGET GTest::Main APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(GTest::Main PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX" + IMPORTED_LOCATION_RELEASE "${GTEST_MAIN_LIBRARY_RELEASE}") + endif() + endif() +endif() From 99afe23513054db4add5143de4aa3a826e8c6c75 Mon Sep 17 00:00:00 2001 From: Roger Leigh Date: Thu, 10 Dec 2015 23:08:23 +0000 Subject: [PATCH 056/255] Tests: Add tests for FindGTest --- Tests/CMakeLists.txt | 5 +++++ Tests/FindGTest/CMakeLists.txt | 10 ++++++++++ Tests/FindGTest/Test/CMakeLists.txt | 17 +++++++++++++++++ Tests/FindGTest/Test/main.cxx | 6 ++++++ 4 files changed, 38 insertions(+) create mode 100644 Tests/FindGTest/CMakeLists.txt create mode 100644 Tests/FindGTest/Test/CMakeLists.txt create mode 100644 Tests/FindGTest/Test/main.cxx diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 5d492cfa5..65bfb77d7 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1362,6 +1362,11 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release if(CMake_TEST_FindGSL) add_subdirectory(FindGSL) endif() + + if(CMake_TEST_FindGTest) + add_subdirectory(FindGTest) + endif() + if(CMake_TEST_FindJsonCpp) add_subdirectory(FindJsonCpp) endif() diff --git a/Tests/FindGTest/CMakeLists.txt b/Tests/FindGTest/CMakeLists.txt new file mode 100644 index 000000000..cbc92b144 --- /dev/null +++ b/Tests/FindGTest/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindGTest.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTest/Test" + "${CMake_BINARY_DIR}/Tests/FindGTest/Test" + ${build_generator_args} + --build-project TestFindGTest + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) diff --git a/Tests/FindGTest/Test/CMakeLists.txt b/Tests/FindGTest/Test/CMakeLists.txt new file mode 100644 index 000000000..99368ac71 --- /dev/null +++ b/Tests/FindGTest/Test/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.1) +project(TestFindGTest CXX) +include(CTest) + +# CMake does not actually provide FindGTest publicly. +set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../Source/Modules) + +find_package(GTest REQUIRED) + +add_executable(test_gtest_tgt main.cxx) +target_link_libraries(test_gtest_tgt GTest::Main) +add_test(NAME test_gtest_tgt COMMAND test_gtest_tgt) + +add_executable(test_gtest_var main.cxx) +target_include_directories(test_gtest_var PRIVATE ${GTEST_INCLUDE_DIRS}) +target_link_libraries(test_gtest_var PRIVATE ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) +add_test(NAME test_gtest_var COMMAND test_gtest_var) diff --git a/Tests/FindGTest/Test/main.cxx b/Tests/FindGTest/Test/main.cxx new file mode 100644 index 000000000..0572a5ddc --- /dev/null +++ b/Tests/FindGTest/Test/main.cxx @@ -0,0 +1,6 @@ +#include + +TEST(FindCMake, LinksAndRuns) +{ + ASSERT_TRUE(true); +} From 693abba25176d073ab3073e7920f4aa8929cc6e0 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 11 Dec 2015 00:01:17 -0500 Subject: [PATCH 057/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index fab29abc8..6c6ba32be 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20151210) +set(CMake_VERSION_PATCH 20151211) #set(CMake_VERSION_RC 1) From f254276fc1a17de7cd5cfc016fd2137937830fca Mon Sep 17 00:00:00 2001 From: Marc Chevrier Date: Fri, 11 Dec 2015 11:08:24 +0100 Subject: [PATCH 058/255] AIX,HP-UX: Fix RPATH handling when CMP0065 is set to NEW The CMAKE_SHARED_LIBRARY_LINK__FLAGS setting has always been meant for flags needed to export symbols from executables for use by shared library plugins. Since commit v3.4.0-rc1~58^2~1 (CMP0065: Restrict the use of CMAKE_SHARED_LIBRARY_LINK__FLAGS, 2015-08-24) this is made explicit by using the flags only for executables with ENABLE_EXPORTS, guarded by CMP0065 for compatibility. On some platforms we were accidentally using this setting to pass other flags to the linker: * AIX: -bnoipath, -brtl * HP-UX: +s, +nodefaultrpath These flags are incorrectly dropped when CMP0065 is set to NEW. Fix this by moving the flags to more appropriate places for linking executables. --- Modules/Platform/AIX-GNU.cmake | 12 +++++++++++- Modules/Platform/AIX-XL.cmake | 12 +++++++++++- Modules/Platform/HP-UX-GNU.cmake | 4 +++- Modules/Platform/HP-UX-HP.cmake | 4 +++- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/Modules/Platform/AIX-GNU.cmake b/Modules/Platform/AIX-GNU.cmake index e5d9434b5..d6f5331dd 100644 --- a/Modules/Platform/AIX-GNU.cmake +++ b/Modules/Platform/AIX-GNU.cmake @@ -18,10 +18,20 @@ if(__AIX_COMPILER_GNU) endif() set(__AIX_COMPILER_GNU 1) +# +# By default, runtime linking is enabled. All shared objects specified on the command line +# will be listed, even if there are no symbols referenced, in the output file. +set (CMAKE_SHARED_LINKER_FLAGS_INIT "-Wl,-brtl") +set (CMAKE_MODULE_LINKER_FLAGS_INIT "-Wl,-brtl") +set (CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,-brtl") + + macro(__aix_compiler_gnu lang) set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-blibpath:") set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":") set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,-G,-bnoipath") - set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-brtl,-bnoipath,-bexpall") # +s, flag for exe link to use shared lib + set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-bexpall") set(CMAKE_${lang}_USE_IMPLICIT_LINK_DIRECTORIES_IN_RUNTIME_PATH 1) + + set(CMAKE_${lang}_LINK_FLAGS "-Wl,-bnoipath") endmacro() diff --git a/Modules/Platform/AIX-XL.cmake b/Modules/Platform/AIX-XL.cmake index abf385569..5470441f9 100644 --- a/Modules/Platform/AIX-XL.cmake +++ b/Modules/Platform/AIX-XL.cmake @@ -18,11 +18,21 @@ if(__AIX_COMPILER_XL) endif() set(__AIX_COMPILER_XL 1) +# +# By default, runtime linking is enabled. All shared objects specified on the command line +# will be listed, even if there are no symbols referenced, in the output file. +set(CMAKE_SHARED_LINKER_FLAGS_INIT "-Wl,-brtl") +set(CMAKE_MODULE_LINKER_FLAGS_INIT "-Wl,-brtl") +set(CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,-brtl") + + macro(__aix_compiler_xl lang) set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-blibpath:") set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":") set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-G -Wl,-bnoipath") # -shared - set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-brtl,-bnoipath,-bexpall") # +s, flag for exe link to use shared lib + set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-bexpall") set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS " ") set(CMAKE_SHARED_MODULE_${lang}_FLAGS " ") + + set(CMAKE_${lang}_LINK_FLAGS "-Wl,-bnoipath") endmacro() diff --git a/Modules/Platform/HP-UX-GNU.cmake b/Modules/Platform/HP-UX-GNU.cmake index eb909fe99..6c717842a 100644 --- a/Modules/Platform/HP-UX-GNU.cmake +++ b/Modules/Platform/HP-UX-GNU.cmake @@ -20,8 +20,10 @@ set(__HPUX_COMPILER_GNU 1) macro(__hpux_compiler_gnu lang) set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,-E,-b,+nodefaultrpath") - set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,+s,-E,+nodefaultrpath") + set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-E") set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,+b") set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":") set(CMAKE_SHARED_LIBRARY_SONAME_${lang}_FLAG "-Wl,+h") + + set(CMAKE_${lang}_LINK_FLAGS "-Wl,+s,+nodefaultrpath") endmacro() diff --git a/Modules/Platform/HP-UX-HP.cmake b/Modules/Platform/HP-UX-HP.cmake index 871ea1323..3935c31c1 100644 --- a/Modules/Platform/HP-UX-HP.cmake +++ b/Modules/Platform/HP-UX-HP.cmake @@ -22,10 +22,12 @@ macro(__hpux_compiler_hp lang) set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "+Z") set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "+Z") set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-Wl,-E,+nodefaultrpath -b -L/usr/lib") - set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,+s,-E,+nodefaultrpath") + set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-E") set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,+b") set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":") set(CMAKE_SHARED_LIBRARY_SONAME_${lang}_FLAG "-Wl,+h") set(CMAKE_${lang}_FLAGS_INIT "") + + set(CMAKE_${lang}_LINK_FLAGS "-Wl,+s,+nodefaultrpath") endmacro() From 2908103d04daeaf396173b6f868f2cad5eb47b08 Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Fri, 11 Dec 2015 10:11:16 +0100 Subject: [PATCH 059/255] FindProtobuf: Set Protobuf_FOUND in addition to PROTOBUF_FOUND All other modules use their module name (e.g. XxX for FindXxX.cmake) in find_package_handle_standard_args. Protobuf used all-caps, which triggers a bug when we try to find Protobuf with the CMakeFindDependencyMacro.cmake macro, which only checks for the mixed-case _FOUND. --- Modules/FindProtobuf.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index 4a68cd186..2f13b09a8 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -305,7 +305,7 @@ mark_as_advanced(PROTOBUF_PROTOC_EXECUTABLE) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(PROTOBUF DEFAULT_MSG +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Protobuf DEFAULT_MSG PROTOBUF_LIBRARY PROTOBUF_INCLUDE_DIR) if(PROTOBUF_FOUND) From 8ed8c2956486d841a4e62ffb8f1d82c6c8534b1c Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 12 Dec 2015 00:01:07 -0500 Subject: [PATCH 060/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 6c6ba32be..76ddf7465 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20151211) +set(CMake_VERSION_PATCH 20151212) #set(CMake_VERSION_RC 1) From 38d723b37e660223a9c8a125cf01ae5a6c9977ba Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Sat, 12 Dec 2015 00:39:08 +0100 Subject: [PATCH 061/255] CPackWIX: Allow patching of shortcut components --- Source/CPack/WiX/cmCPackWIXGenerator.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index da8b486c2..b55c5a535 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -817,6 +817,8 @@ bool cmCPackWIXGenerator::CreateShortcutsOfSpecificType( fileDefinitions.AddAttribute("Id", componentId); fileDefinitions.AddAttribute("Guid", "*"); + this->Patch->ApplyFragment(componentId, fileDefinitions); + std::string registryKey = std::string("Software\\") + cpackVendor + "\\" + cpackPackageName; From ac6025c5ff9a24a6a03b225c0b02ce67d65013d3 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 13 Dec 2015 00:01:06 -0500 Subject: [PATCH 062/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 76ddf7465..cd4685317 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20151212) +set(CMake_VERSION_PATCH 20151213) #set(CMake_VERSION_RC 1) From b97018534fbb4ce238561a1363f2698526bcda31 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 14 Dec 2015 00:01:05 -0500 Subject: [PATCH 063/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index cd4685317..4e596d98e 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20151213) +set(CMake_VERSION_PATCH 20151214) #set(CMake_VERSION_RC 1) From 08580be2ada7b226c3b8f91b6ecdbc57d843d42e Mon Sep 17 00:00:00 2001 From: David Gobbi Date: Sat, 12 Dec 2015 09:32:42 -0700 Subject: [PATCH 064/255] FindOpenGL: Don't add AGL to OPENGL_LIBRARIES on OS X. CMake had been setting OPENGL_glu_LIBRARY to AGL.framework, even though AGL is not GLU. AGL is simply the GL component for the deprecated Carbon framework. GLU is provided by OpenGL.framework. A side effect of the old behavior was that if AGL was not found (it is absent from OS X SDK 10.10 or later), then OPENGL_GLU_FOUND would be incorrectly set to "NO". --- Modules/FindOpenGL.cmake | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake index a7eefa7aa..93e488bf9 100644 --- a/Modules/FindOpenGL.cmake +++ b/Modules/FindOpenGL.cmake @@ -71,9 +71,11 @@ elseif (WIN32) elseif (APPLE) - find_library(OPENGL_gl_LIBRARY OpenGL DOC "OpenGL lib for OSX") - find_library(OPENGL_glu_LIBRARY AGL DOC "AGL lib for OSX") - find_path(OPENGL_INCLUDE_DIR OpenGL/gl.h DOC "Include for OpenGL on OSX") + # The OpenGL.framework provides both gl and glu + find_library(OPENGL_gl_LIBRARY OpenGL DOC "OpenGL library for OS X") + find_library(OPENGL_glu_LIBRARY OpenGL DOC + "GLU library for OS X (usually same as OpenGL library)") + find_path(OPENGL_INCLUDE_DIR OpenGL/gl.h DOC "Include for OpenGL on OS X") list(APPEND _OpenGL_REQUIRED_VARS OPENGL_INCLUDE_DIR) else() @@ -149,7 +151,9 @@ if(OPENGL_gl_LIBRARY) set( OPENGL_LIBRARIES ${OPENGL_gl_LIBRARY} ${OPENGL_LIBRARIES}) if(OPENGL_glu_LIBRARY) set( OPENGL_GLU_FOUND "YES" ) - set( OPENGL_LIBRARIES ${OPENGL_glu_LIBRARY} ${OPENGL_LIBRARIES} ) + if(NOT "${OPENGL_glu_LIBRARY}" STREQUAL "${OPENGL_gl_LIBRARY}") + set( OPENGL_LIBRARIES ${OPENGL_glu_LIBRARY} ${OPENGL_LIBRARIES} ) + endif() else() set( OPENGL_GLU_FOUND "NO" ) endif() From f0b5ce7f94ae699ed583777534742bbeb211407a Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 14 Dec 2015 09:56:30 -0500 Subject: [PATCH 065/255] Help: Add notes for topic 'FindGTest-imported-targets' --- Help/release/dev/FindGTest-imported-targets.rst | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 Help/release/dev/FindGTest-imported-targets.rst diff --git a/Help/release/dev/FindGTest-imported-targets.rst b/Help/release/dev/FindGTest-imported-targets.rst new file mode 100644 index 000000000..3cb98da23 --- /dev/null +++ b/Help/release/dev/FindGTest-imported-targets.rst @@ -0,0 +1,4 @@ +FindGTest-imported-targets +-------------------------- + +* The :module:`FindGTest` module now provides imported targets. From dcca789272057e2cb0aae640836c189873701d68 Mon Sep 17 00:00:00 2001 From: KWSys Upstream Date: Wed, 9 Dec 2015 11:45:28 -0500 Subject: [PATCH 066/255] KWSys 2015-12-09 (cdcf4c47) Code extracted from: http://public.kitware.com/KWSys.git at commit cdcf4c4753d8e90895f1fb2cb6ab622342bcaaa8. From de77d4a741c84e0b5774e79a0c84e945e25ad9f8 Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Mon, 14 Dec 2015 23:04:41 +0100 Subject: [PATCH 067/255] CPackWIX: Allow multiple patch files and diagnose if any are missing CPACK_WIX_PATCH_FILE now accepts a list of patch files. An error will now be produced if any of the patch files is missing. Previously this would be silently ignored. --- Modules/CPackWIX.cmake | 3 ++- Source/CPack/WiX/cmCPackWIXGenerator.cxx | 11 ++++++++++- Source/CPack/WiX/cmWIXPatch.cxx | 12 ++++++++++-- Source/CPack/WiX/cmWIXPatch.h | 2 +- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/Modules/CPackWIX.cmake b/Modules/CPackWIX.cmake index bef8e16c2..499400515 100644 --- a/Modules/CPackWIX.cmake +++ b/Modules/CPackWIX.cmake @@ -119,7 +119,8 @@ # # .. variable:: CPACK_WIX_PATCH_FILE # -# Optional XML file with fragments to be inserted into generated WiX sources +# Optional list of XML files with fragments to be inserted into +# generated WiX sources # # This optional variable can be used to specify an XML file that the # WiX generator will use to inject fragments into its generated diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index b55c5a535..ece327a41 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -242,7 +242,16 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration() const char* patchFilePath = GetOption("CPACK_WIX_PATCH_FILE"); if(patchFilePath) { - this->Patch->LoadFragments(patchFilePath); + std::vector patchFilePaths; + cmSystemTools::ExpandListArgument(patchFilePath, patchFilePaths); + + for(size_t i = 0; i < patchFilePaths.size(); ++i) + { + if(!this->Patch->LoadFragments(patchFilePaths[i])) + { + return false; + } + } } return true; diff --git a/Source/CPack/WiX/cmWIXPatch.cxx b/Source/CPack/WiX/cmWIXPatch.cxx index 471c3a411..07375da10 100644 --- a/Source/CPack/WiX/cmWIXPatch.cxx +++ b/Source/CPack/WiX/cmWIXPatch.cxx @@ -20,10 +20,18 @@ cmWIXPatch::cmWIXPatch(cmCPackLog* logger): } -void cmWIXPatch::LoadFragments(std::string const& patchFilePath) +bool cmWIXPatch::LoadFragments(std::string const& patchFilePath) { cmWIXPatchParser parser(Fragments, Logger); - parser.ParseFile(patchFilePath.c_str()); + if(!parser.ParseFile(patchFilePath.c_str())) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Failed parsing XML patch file: '" << + patchFilePath << "'" << std::endl); + return false; + } + + return true; } void cmWIXPatch::ApplyFragment( diff --git a/Source/CPack/WiX/cmWIXPatch.h b/Source/CPack/WiX/cmWIXPatch.h index d53fcb47f..2f31a013e 100644 --- a/Source/CPack/WiX/cmWIXPatch.h +++ b/Source/CPack/WiX/cmWIXPatch.h @@ -26,7 +26,7 @@ class cmWIXPatch public: cmWIXPatch(cmCPackLog* logger); - void LoadFragments(std::string const& patchFilePath); + bool LoadFragments(std::string const& patchFilePath); void ApplyFragment(std::string const& id, cmWIXSourceWriter& writer); From 7a47745d69003ec580e8f38d26dbf8858a4f5b18 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 15 Dec 2015 00:01:08 -0500 Subject: [PATCH 068/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 4e596d98e..b7a379133 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20151214) +set(CMake_VERSION_PATCH 20151215) #set(CMake_VERSION_RC 1) From 7e290214659b2b253bd7034a2f56e47d0ff032b5 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 16 Dec 2015 00:01:06 -0500 Subject: [PATCH 069/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index b7a379133..d7607575e 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20151215) +set(CMake_VERSION_PATCH 20151216) #set(CMake_VERSION_RC 1) From e51fa1dc4dcc8c06899f2681890ec61b2517420d Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 17 Dec 2015 00:01:05 -0500 Subject: [PATCH 070/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index d7607575e..8fe4618bb 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20151216) +set(CMake_VERSION_PATCH 20151217) #set(CMake_VERSION_RC 1) From 24cdb9df598a1c10fffc718255527729595442a1 Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Thu, 10 Dec 2015 23:55:07 +0100 Subject: [PATCH 071/255] CMake: Mimic NSIS options dialog in WiX installer --- CMakeCPackOptions.cmake.in | 29 ++++++++- Utilities/Release/WiX/WIX.template.in | 46 +++++++++++++ Utilities/Release/WiX/cmake_extra_dialog.wxs | 36 +++++++++++ Utilities/Release/WiX/install_dir.wxs | 61 ++++++++++++++++++ .../Release/WiX/patch_desktop_shortcut.xml | 5 ++ Utilities/Release/WiX/patch_path_env.xml | 26 ++++++++ .../ui_banner.jpg} | Bin .../ui_dialog.jpg} | Bin 8 files changed, 201 insertions(+), 2 deletions(-) create mode 100644 Utilities/Release/WiX/WIX.template.in create mode 100644 Utilities/Release/WiX/cmake_extra_dialog.wxs create mode 100644 Utilities/Release/WiX/install_dir.wxs create mode 100644 Utilities/Release/WiX/patch_desktop_shortcut.xml create mode 100644 Utilities/Release/WiX/patch_path_env.xml rename Utilities/Release/{cpack_wix_ui_banner.jpg => WiX/ui_banner.jpg} (100%) rename Utilities/Release/{cpack_wix_ui_dialog.jpg => WiX/ui_dialog.jpg} (100%) diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in index 4ebf30699..25af0c93e 100644 --- a/CMakeCPackOptions.cmake.in +++ b/CMakeCPackOptions.cmake.in @@ -234,10 +234,35 @@ if("${CPACK_GENERATOR}" STREQUAL "WIX") set(CPACK_WIX_LIGHT_EXTRA_FLAGS "-dcl:high") set(CPACK_WIX_UI_BANNER - "@CMake_SOURCE_DIR@/Utilities/Release/cpack_wix_ui_banner.jpg" + "@CMake_SOURCE_DIR@/Utilities/Release/WiX/ui_banner.jpg" ) set(CPACK_WIX_UI_DIALOG - "@CMake_SOURCE_DIR@/Utilities/Release/cpack_wix_ui_dialog.jpg" + "@CMake_SOURCE_DIR@/Utilities/Release/WiX/ui_dialog.jpg" ) + + set(CPACK_WIX_EXTRA_SOURCES + "@CMake_SOURCE_DIR@/Utilities/Release/WiX/install_dir.wxs" + "@CMake_SOURCE_DIR@/Utilities/Release/WiX/cmake_extra_dialog.wxs" + ) + + set(CPACK_WIX_UI_REF "CMakeUI_InstallDir") + + set(CPACK_WIX_PATCH_FILE + "@CMake_SOURCE_DIR@/Utilities/Release/WiX/patch_path_env.xml" + ) + + set(CPACK_WIX_TEMPLATE + "@CMake_SOURCE_DIR@/Utilities/Release/WiX/WIX.template.in" + ) + + set(BUILD_QtDialog "@BUILD_QtDialog@") + + if(BUILD_QtDialog) + list(APPEND CPACK_WIX_PATCH_FILE + "@CMake_SOURCE_DIR@/Utilities/Release/WiX/patch_desktop_shortcut.xml" + ) + + set(CPACK_WIX_CANDLE_EXTRA_FLAGS "-dBUILD_QtDialog=1") + endif() endif() diff --git a/Utilities/Release/WiX/WIX.template.in b/Utilities/Release/WiX/WIX.template.in new file mode 100644 index 000000000..094999f1d --- /dev/null +++ b/Utilities/Release/WiX/WIX.template.in @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + ProductIcon.ico + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/Release/WiX/cmake_extra_dialog.wxs b/Utilities/Release/WiX/cmake_extra_dialog.wxs new file mode 100644 index 000000000..0ee3d99e7 --- /dev/null +++ b/Utilities/Release/WiX/cmake_extra_dialog.wxs @@ -0,0 +1,36 @@ + + + + + + + + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/Release/WiX/install_dir.wxs b/Utilities/Release/WiX/install_dir.wxs new file mode 100644 index 000000000..883efba90 --- /dev/null +++ b/Utilities/Release/WiX/install_dir.wxs @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + 1 + "1"]]> + + 1 + + NOT Installed + Installed AND PATCH + + 1 + LicenseAccepted = "1" + + 1 + 1 + NOT WIXUI_DONTVALIDATEPATH + "1"]]> + WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID="1" + 1 + 1 + + 1 + 1 + + NOT Installed + Installed AND NOT PATCH + Installed AND PATCH + + 1 + + 1 + 1 + 1 + + + + + + + diff --git a/Utilities/Release/WiX/patch_desktop_shortcut.xml b/Utilities/Release/WiX/patch_desktop_shortcut.xml new file mode 100644 index 000000000..d30705dd1 --- /dev/null +++ b/Utilities/Release/WiX/patch_desktop_shortcut.xml @@ -0,0 +1,5 @@ + + + DESKTOP_SHORTCUT_REQUESTED = 1 + + diff --git a/Utilities/Release/WiX/patch_path_env.xml b/Utilities/Release/WiX/patch_path_env.xml new file mode 100644 index 000000000..0e335c4d5 --- /dev/null +++ b/Utilities/Release/WiX/patch_path_env.xml @@ -0,0 +1,26 @@ + + + + + ADD_CMAKE_TO_PATH = "System" + + + + + + + ADD_CMAKE_TO_PATH = "User" + + + + + + + + + + diff --git a/Utilities/Release/cpack_wix_ui_banner.jpg b/Utilities/Release/WiX/ui_banner.jpg similarity index 100% rename from Utilities/Release/cpack_wix_ui_banner.jpg rename to Utilities/Release/WiX/ui_banner.jpg diff --git a/Utilities/Release/cpack_wix_ui_dialog.jpg b/Utilities/Release/WiX/ui_dialog.jpg similarity index 100% rename from Utilities/Release/cpack_wix_ui_dialog.jpg rename to Utilities/Release/WiX/ui_dialog.jpg From cbbdfc2b6120e192b4248ce89af93cf34ea8a254 Mon Sep 17 00:00:00 2001 From: Matthias Maennich Date: Sat, 5 Dec 2015 18:57:41 +0100 Subject: [PATCH 072/255] CMakeParseArguments: add a RunCMake test suite --- Tests/RunCMake/CMakeLists.txt | 1 + .../cmake_parse_arguments/CMakeLists.txt | 3 + .../cmake_parse_arguments/CornerCases.cmake | 16 +++++ .../cmake_parse_arguments/Errors-result.txt | 1 + .../cmake_parse_arguments/Errors-stderr.txt | 17 +++++ .../cmake_parse_arguments/Errors.cmake | 6 ++ .../Initialization.cmake | 69 +++++++++++++++++++ .../RunCMake/cmake_parse_arguments/Mix.cmake | 25 +++++++ .../cmake_parse_arguments/RunCMakeTest.cmake | 7 ++ .../cmake_parse_arguments/Utils.cmake | 20 ++++++ .../cmake_parse_arguments/test_utils.cmake | 20 ++++++ 11 files changed, 185 insertions(+) create mode 100644 Tests/RunCMake/cmake_parse_arguments/CMakeLists.txt create mode 100644 Tests/RunCMake/cmake_parse_arguments/CornerCases.cmake create mode 100644 Tests/RunCMake/cmake_parse_arguments/Errors-result.txt create mode 100644 Tests/RunCMake/cmake_parse_arguments/Errors-stderr.txt create mode 100644 Tests/RunCMake/cmake_parse_arguments/Errors.cmake create mode 100644 Tests/RunCMake/cmake_parse_arguments/Initialization.cmake create mode 100644 Tests/RunCMake/cmake_parse_arguments/Mix.cmake create mode 100644 Tests/RunCMake/cmake_parse_arguments/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/cmake_parse_arguments/Utils.cmake create mode 100644 Tests/RunCMake/cmake_parse_arguments/test_utils.cmake diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index a6cbf8660..0a388c53c 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -177,6 +177,7 @@ add_RunCMake_test(build_command) add_RunCMake_test(execute_process) add_RunCMake_test(export) add_RunCMake_test(cmake_minimum_required) +add_RunCMake_test(cmake_parse_arguments) add_RunCMake_test(continue) add_RunCMake_test(ctest_build) add_RunCMake_test(ctest_configure) diff --git a/Tests/RunCMake/cmake_parse_arguments/CMakeLists.txt b/Tests/RunCMake/cmake_parse_arguments/CMakeLists.txt new file mode 100644 index 000000000..6dd8cdf55 --- /dev/null +++ b/Tests/RunCMake/cmake_parse_arguments/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.4) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/cmake_parse_arguments/CornerCases.cmake b/Tests/RunCMake/cmake_parse_arguments/CornerCases.cmake new file mode 100644 index 000000000..7337b71f5 --- /dev/null +++ b/Tests/RunCMake/cmake_parse_arguments/CornerCases.cmake @@ -0,0 +1,16 @@ +include(${CMAKE_CURRENT_LIST_DIR}/test_utils.cmake) +include(CMakeParseArguments) + +# example from the documentation +# OPTIONAL is a keyword and therefore terminates the definition of +# the multi-value DEFINITION before even a single value has been added + +set(options OPTIONAL FAST) +set(oneValueArgs DESTINATION RENAME) +set(multiValueArgs TARGETS CONFIGURATIONS) +cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" + "${multiValueArgs}" + TARGETS foo DESTINATION OPTIONAL) + +TEST(MY_INSTALL_DESTINATION UNDEFINED) +TEST(MY_INSTALL_OPTIONAL TRUE) diff --git a/Tests/RunCMake/cmake_parse_arguments/Errors-result.txt b/Tests/RunCMake/cmake_parse_arguments/Errors-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/cmake_parse_arguments/Errors-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_parse_arguments/Errors-stderr.txt b/Tests/RunCMake/cmake_parse_arguments/Errors-stderr.txt new file mode 100644 index 000000000..5976fdc7e --- /dev/null +++ b/Tests/RunCMake/cmake_parse_arguments/Errors-stderr.txt @@ -0,0 +1,17 @@ +CMake Error at Errors.cmake:3 \(cmake_parse_arguments\): + CMAKE_PARSE_ARGUMENTS Function invoked with incorrect arguments for + function named: CMAKE_PARSE_ARGUMENTS +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at Errors.cmake:4 \(cmake_parse_arguments\): + CMAKE_PARSE_ARGUMENTS Function invoked with incorrect arguments for + function named: CMAKE_PARSE_ARGUMENTS +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at Errors.cmake:5 \(cmake_parse_arguments\): + CMAKE_PARSE_ARGUMENTS Function invoked with incorrect arguments for + function named: CMAKE_PARSE_ARGUMENTS +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/cmake_parse_arguments/Errors.cmake b/Tests/RunCMake/cmake_parse_arguments/Errors.cmake new file mode 100644 index 000000000..2db3bb158 --- /dev/null +++ b/Tests/RunCMake/cmake_parse_arguments/Errors.cmake @@ -0,0 +1,6 @@ +include(CMakeParseArguments) + +cmake_parse_arguments() +cmake_parse_arguments(prefix OPT) +cmake_parse_arguments(prefix OPT SINGLE) +cmake_parse_arguments(prefix OPT SINGLE MULTI) # not an error diff --git a/Tests/RunCMake/cmake_parse_arguments/Initialization.cmake b/Tests/RunCMake/cmake_parse_arguments/Initialization.cmake new file mode 100644 index 000000000..8729bc618 --- /dev/null +++ b/Tests/RunCMake/cmake_parse_arguments/Initialization.cmake @@ -0,0 +1,69 @@ +include(${CMAKE_CURRENT_LIST_DIR}/test_utils.cmake) +include(CMakeParseArguments) + +# unparsed arguments +cmake_parse_arguments(pref "" "" "") +TEST(pref_UNPARSED_ARGUMENTS UNDEFINED) + +cmake_parse_arguments(pref "" "" "" FOO) +TEST(pref_UNPARSED_ARGUMENTS "FOO") +cmake_parse_arguments(pref "" "" "" FOO BAR) +TEST(pref_UNPARSED_ARGUMENTS "FOO;BAR") +cmake_parse_arguments(pref "" "" "") +TEST(pref_UNPARSED_ARGUMENTS UNDEFINED) + + +# options +cmake_parse_arguments(pref "OPT1" "" "") +TEST(pref_OPT1 FALSE) + +cmake_parse_arguments(pref "OPT1;OPT2" "" "") +TEST(pref_OPT1 FALSE) +TEST(pref_OPT2 FALSE) + +cmake_parse_arguments(pref "OPT1" "" "" OPT1) +TEST(pref_OPT1 TRUE) +cmake_parse_arguments(pref "OPT1;OPT2" "" "" OPT1 OPT2) +TEST(pref_OPT1 TRUE) +TEST(pref_OPT2 TRUE) +cmake_parse_arguments(pref "OPT1;OPT2" "" "") +TEST(pref_OPT1 FALSE) +TEST(pref_OPT2 FALSE) + + +# single arguments +cmake_parse_arguments(pref "" "SINGLE1" "") +TEST(pref_SINGLE1 UNDEFINED) + +cmake_parse_arguments(pref "" "SINGLE1;SINGLE2" "") +TEST(pref_SINGLE1 UNDEFINED) +TEST(pref_SINGLE2 UNDEFINED) + + +cmake_parse_arguments(pref "" "SINGLE1" "" SINGLE1 foo) +TEST(pref_SINGLE1 foo) +cmake_parse_arguments(pref "" "SINGLE1;SINGLE2" "" SINGLE1 foo SINGLE2 bar) +TEST(pref_SINGLE1 foo) +TEST(pref_SINGLE2 bar) +cmake_parse_arguments(pref "" "SINGLE1;SINGLE2" "") +TEST(pref_SINGLE1 UNDEFINED) +TEST(pref_SINGLE2 UNDEFINED) + + +# multi arguments + +cmake_parse_arguments(pref "" "" "MULTI1") +TEST(pref_MULTI1 UNDEFINED) + +cmake_parse_arguments(pref "" "" "MULTI1;MULTI2") +TEST(pref_MULTI1 UNDEFINED) +TEST(pref_MULTI2 UNDEFINED) + +cmake_parse_arguments(pref "" "" "MULTI1" MULTI1 foo) +TEST(pref_MULTI1 foo) +cmake_parse_arguments(pref "" "" "MULTI1;MULTI2" MULTI1 foo bar MULTI2 bar foo) +TEST(pref_MULTI1 foo bar) +TEST(pref_MULTI2 bar foo) +cmake_parse_arguments(pref "" "" "MULTI1;MULTI2") +TEST(pref_MULTI1 UNDEFINED) +TEST(pref_MULTI2 UNDEFINED) diff --git a/Tests/RunCMake/cmake_parse_arguments/Mix.cmake b/Tests/RunCMake/cmake_parse_arguments/Mix.cmake new file mode 100644 index 000000000..c14fdfd91 --- /dev/null +++ b/Tests/RunCMake/cmake_parse_arguments/Mix.cmake @@ -0,0 +1,25 @@ +include(${CMAKE_CURRENT_LIST_DIR}/test_utils.cmake) +include(CMakeParseArguments) + +# specify two keywords for each category and set the first keyword of each +# within ARGN +cmake_parse_arguments(pref "OPT1;OPT2" "SINGLE1;SINGLE2" "MULTI1;MULTI2" + OPT1 SINGLE1 foo MULTI1 bar foo bar) +TEST(pref_OPT1 TRUE) +TEST(pref_OPT2 FALSE) +TEST(pref_SINGLE1 foo) +TEST(pref_SINGLE2 UNDEFINED) +TEST(pref_MULTI1 bar foo bar) +TEST(pref_MULTI2 UNDEFINED) +TEST(pref_UNPARSED_ARGUMENTS UNDEFINED) + +# same as above but reversed ARGN +cmake_parse_arguments(pref "OPT1;OPT2" "SINGLE1;SINGLE2" "MULTI1;MULTI2" + MULTI1 bar foo bar SINGLE1 foo OPT1) +TEST(pref_OPT1 TRUE) +TEST(pref_OPT2 FALSE) +TEST(pref_SINGLE1 foo) +TEST(pref_SINGLE2 UNDEFINED) +TEST(pref_MULTI1 bar foo bar) +TEST(pref_MULTI2 UNDEFINED) +TEST(pref_UNPARSED_ARGUMENTS UNDEFINED) diff --git a/Tests/RunCMake/cmake_parse_arguments/RunCMakeTest.cmake b/Tests/RunCMake/cmake_parse_arguments/RunCMakeTest.cmake new file mode 100644 index 000000000..b89f1a55e --- /dev/null +++ b/Tests/RunCMake/cmake_parse_arguments/RunCMakeTest.cmake @@ -0,0 +1,7 @@ +include(RunCMake) + +run_cmake(Utils) +run_cmake(Initialization) +run_cmake(Mix) +run_cmake(CornerCases) +run_cmake(Errors) diff --git a/Tests/RunCMake/cmake_parse_arguments/Utils.cmake b/Tests/RunCMake/cmake_parse_arguments/Utils.cmake new file mode 100644 index 000000000..3bbf115e8 --- /dev/null +++ b/Tests/RunCMake/cmake_parse_arguments/Utils.cmake @@ -0,0 +1,20 @@ +include(${CMAKE_CURRENT_LIST_DIR}/test_utils.cmake) + +# test the TEST macro itself + +TEST(asdf UNDEFINED) + +SET (asdf FALSE) +TEST(asdf FALSE) + +SET (asdf TRUE) +TEST(asdf TRUE) + +SET (asdf TRUE) +TEST(asdf TRUE) + +SET (asdf "some value") +TEST(asdf "some value") + +SET (asdf some list) +TEST(asdf "some;list") diff --git a/Tests/RunCMake/cmake_parse_arguments/test_utils.cmake b/Tests/RunCMake/cmake_parse_arguments/test_utils.cmake new file mode 100644 index 000000000..f5425c2bc --- /dev/null +++ b/Tests/RunCMake/cmake_parse_arguments/test_utils.cmake @@ -0,0 +1,20 @@ +macro(TEST variable) + SET(expected "${ARGN}") + if ( "${expected}" STREQUAL "UNDEFINED" ) + if (DEFINED ${variable}) + message(FATAL_ERROR "'${variable}' shall be undefined but has value '${${variable}}'") + endif() + elseif( "${expected}" STREQUAL "FALSE" ) + if (NOT ${variable} STREQUAL "FALSE") + message(FATAL_ERROR "'${variable}' shall be FALSE") + endif() + elseif( "${expected}" STREQUAL "TRUE" ) + if (NOT ${variable} STREQUAL "TRUE") + message(FATAL_ERROR "'${variable}' shall be TRUE") + endif() + else() + if (NOT ${variable} STREQUAL "${expected}") + message(FATAL_ERROR "'${variable}' shall be '${expected}'") + endif() + endif() +endmacro() From e8b148318f1fab26b2289cadc2d0c5e12201169d Mon Sep 17 00:00:00 2001 From: Matthias Maennich Date: Sat, 5 Dec 2015 19:01:12 +0100 Subject: [PATCH 073/255] CMakeParseArguments: replace by native cmake_parse_arguments command Implement a native `cmake_parse_arguments` command that is fully compatible with the documented behaviour of the previous implementation. Leave the CMakeParseArguments module empty but existing for compatibility. --- Help/command/cmake_parse_arguments.rst | 78 ++++++++ Help/manual/cmake-commands.7.rst | 1 + .../dev/CMakeParseArguments-native-impl.rst | 6 + Modules/CMakeParseArguments.cmake | 148 +-------------- Source/cmBootstrapCommands1.cxx | 2 + Source/cmParseArgumentsCommand.cxx | 176 ++++++++++++++++++ Source/cmParseArgumentsCommand.h | 54 ++++++ .../cmake_parse_arguments/CornerCases.cmake | 1 - .../cmake_parse_arguments/Errors-stderr.txt | 21 +-- .../cmake_parse_arguments/Errors.cmake | 2 - .../Initialization.cmake | 1 - .../RunCMake/cmake_parse_arguments/Mix.cmake | 1 - 12 files changed, 330 insertions(+), 161 deletions(-) create mode 100644 Help/command/cmake_parse_arguments.rst create mode 100644 Help/release/dev/CMakeParseArguments-native-impl.rst create mode 100644 Source/cmParseArgumentsCommand.cxx create mode 100644 Source/cmParseArgumentsCommand.h diff --git a/Help/command/cmake_parse_arguments.rst b/Help/command/cmake_parse_arguments.rst new file mode 100644 index 000000000..7638b6102 --- /dev/null +++ b/Help/command/cmake_parse_arguments.rst @@ -0,0 +1,78 @@ +cmake_parse_arguments +--------------------- + +``cmake_parse_arguments`` is intended to be used in macros or functions for +parsing the arguments given to that macro or function. It processes the +arguments and defines a set of variables which hold the values of the +respective options. + +:: + + cmake_parse_arguments( + args...) + + +The ```` argument contains all options for the respective macro, +i.e. keywords which can be used when calling the macro without any value +following, like e.g. the ``OPTIONAL`` keyword of the :command:`install` +command. + +The ```` argument contains all keywords for this macro +which are followed by one value, like e.g. ``DESTINATION`` keyword of the +:command:`install` command. + +The ```` argument contains all keywords for this +macro which can be followed by more than one value, like e.g. the +``TARGETS`` or ``FILES`` keywords of the :command:`install` command. + +When done, ``cmake_parse_arguments`` will have defined for each of the +keywords listed in ````, ```` and +```` a variable composed of the given ```` +followed by ``"_"`` and the name of the respective keyword. These +variables will then hold the respective value from the argument list. +For the ```` keywords this will be ``TRUE`` or ``FALSE``. + +All remaining arguments are collected in a variable +``_UNPARSED_ARGUMENTS``, this can be checked afterwards to see +whether your macro was called with unrecognized parameters. + +As an example here a ``my_install()`` macro, which takes similar arguments +as the real :command:`install` command: + +.. code-block:: cmake + + function(MY_INSTALL) + set(options OPTIONAL FAST) + set(oneValueArgs DESTINATION RENAME) + set(multiValueArgs TARGETS CONFIGURATIONS) + cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" + "${multiValueArgs}" ${ARGN} ) + + # ... + +Assume ``my_install()`` has been called like this: + +.. code-block:: cmake + + my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub) + +After the ``cmake_parse_arguments`` call the macro will have set the +following variables:: + + MY_INSTALL_OPTIONAL = TRUE + MY_INSTALL_FAST = FALSE (was not used in call to my_install) + MY_INSTALL_DESTINATION = "bin" + MY_INSTALL_RENAME = "" (was not used) + MY_INSTALL_TARGETS = "foo;bar" + MY_INSTALL_CONFIGURATIONS = "" (was not used) + MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (nothing expected after "OPTIONAL") + +You can then continue and process these variables. + +Keywords terminate lists of values, e.g. if directly after a +one_value_keyword another recognized keyword follows, this is +interpreted as the beginning of the new option. E.g. +``my_install(TARGETS foo DESTINATION OPTIONAL)`` would result in +``MY_INSTALL_DESTINATION`` set to ``"OPTIONAL"``, but as ``OPTIONAL`` +is a keyword itself ``MY_INSTALL_DESTINATION`` will be empty and +``MY_INSTALL_OPTIONAL`` will therefore be set to ``TRUE``. diff --git a/Help/manual/cmake-commands.7.rst b/Help/manual/cmake-commands.7.rst index 5b92b5156..d0c298659 100644 --- a/Help/manual/cmake-commands.7.rst +++ b/Help/manual/cmake-commands.7.rst @@ -29,6 +29,7 @@ These commands may be used freely in CMake projects. /command/build_command /command/cmake_host_system_information /command/cmake_minimum_required + /command/cmake_parse_arguments /command/cmake_policy /command/configure_file /command/continue diff --git a/Help/release/dev/CMakeParseArguments-native-impl.rst b/Help/release/dev/CMakeParseArguments-native-impl.rst new file mode 100644 index 000000000..114a09931 --- /dev/null +++ b/Help/release/dev/CMakeParseArguments-native-impl.rst @@ -0,0 +1,6 @@ +CMakeParseArguments-native-impl +------------------------------- + +* The :command:`cmake_parse_arguments` command is now implemented natively. + The :module:`CMakeParseArguments` module remains as an empty placeholder + for compatibility. diff --git a/Modules/CMakeParseArguments.cmake b/Modules/CMakeParseArguments.cmake index 8553f38f5..fc64ab9a2 100644 --- a/Modules/CMakeParseArguments.cmake +++ b/Modules/CMakeParseArguments.cmake @@ -2,86 +2,10 @@ # CMakeParseArguments # ------------------- # -# -# -# CMAKE_PARSE_ARGUMENTS( -# args...) -# -# CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions -# for parsing the arguments given to that macro or function. It -# processes the arguments and defines a set of variables which hold the -# values of the respective options. -# -# The argument contains all options for the respective macro, -# i.e. keywords which can be used when calling the macro without any -# value following, like e.g. the OPTIONAL keyword of the install() -# command. -# -# The argument contains all keywords for this macro -# which are followed by one value, like e.g. DESTINATION keyword of the -# install() command. -# -# The argument contains all keywords for this -# macro which can be followed by more than one value, like e.g. the -# TARGETS or FILES keywords of the install() command. -# -# When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the -# keywords listed in , and -# a variable composed of the given -# followed by "_" and the name of the respective keyword. These -# variables will then hold the respective value from the argument list. -# For the keywords this will be TRUE or FALSE. -# -# All remaining arguments are collected in a variable -# _UNPARSED_ARGUMENTS, this can be checked afterwards to see -# whether your macro was called with unrecognized parameters. -# -# As an example here a my_install() macro, which takes similar arguments -# as the real install() command: -# -# :: -# -# function(MY_INSTALL) -# set(options OPTIONAL FAST) -# set(oneValueArgs DESTINATION RENAME) -# set(multiValueArgs TARGETS CONFIGURATIONS) -# cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" -# "${multiValueArgs}" ${ARGN} ) -# ... -# -# -# -# Assume my_install() has been called like this: -# -# :: -# -# my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub) -# -# -# -# After the cmake_parse_arguments() call the macro will have set the -# following variables: -# -# :: -# -# MY_INSTALL_OPTIONAL = TRUE -# MY_INSTALL_FAST = FALSE (this option was not used when calling my_install() -# MY_INSTALL_DESTINATION = "bin" -# MY_INSTALL_RENAME = "" (was not used) -# MY_INSTALL_TARGETS = "foo;bar" -# MY_INSTALL_CONFIGURATIONS = "" (was not used) -# MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL" -# -# -# -# You can then continue and process these variables. -# -# Keywords terminate lists of values, e.g. if directly after a -# one_value_keyword another recognized keyword follows, this is -# interpreted as the beginning of the new option. E.g. -# my_install(TARGETS foo DESTINATION OPTIONAL) would result in -# MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION -# would be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefor. +# This module once implemented the :command:`cmake_parse_arguments` command +# that is now implemented natively by CMake. It is now an empty placeholder +# for compatibility with projects that include it to get the command from +# CMake 3.4 and lower. #============================================================================= # Copyright 2010 Alexander Neundorf @@ -95,67 +19,3 @@ #============================================================================= # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) - - -if(__CMAKE_PARSE_ARGUMENTS_INCLUDED) - return() -endif() -set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE) - - -function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames) - # first set all result variables to empty/FALSE - foreach(arg_name ${_singleArgNames} ${_multiArgNames}) - set(${prefix}_${arg_name}) - endforeach() - - foreach(option ${_optionNames}) - set(${prefix}_${option} FALSE) - endforeach() - - set(${prefix}_UNPARSED_ARGUMENTS) - - set(insideValues FALSE) - set(currentArgName) - - # now iterate over all arguments and fill the result variables - foreach(currentArg ${ARGN}) - list(FIND _optionNames "${currentArg}" optionIndex) # ... then this marks the end of the arguments belonging to this keyword - list(FIND _singleArgNames "${currentArg}" singleArgIndex) # ... then this marks the end of the arguments belonging to this keyword - list(FIND _multiArgNames "${currentArg}" multiArgIndex) # ... then this marks the end of the arguments belonging to this keyword - - if(${optionIndex} EQUAL -1 AND ${singleArgIndex} EQUAL -1 AND ${multiArgIndex} EQUAL -1) - if(insideValues) - if("${insideValues}" STREQUAL "SINGLE") - set(${prefix}_${currentArgName} ${currentArg}) - set(insideValues FALSE) - elseif("${insideValues}" STREQUAL "MULTI") - list(APPEND ${prefix}_${currentArgName} ${currentArg}) - endif() - else() - list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg}) - endif() - else() - if(NOT ${optionIndex} EQUAL -1) - set(${prefix}_${currentArg} TRUE) - set(insideValues FALSE) - elseif(NOT ${singleArgIndex} EQUAL -1) - set(currentArgName ${currentArg}) - set(${prefix}_${currentArgName}) - set(insideValues "SINGLE") - elseif(NOT ${multiArgIndex} EQUAL -1) - set(currentArgName ${currentArg}) - set(${prefix}_${currentArgName}) - set(insideValues "MULTI") - endif() - endif() - - endforeach() - - # propagate the result variables to the caller: - foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames}) - set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE) - endforeach() - set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE) - -endfunction() diff --git a/Source/cmBootstrapCommands1.cxx b/Source/cmBootstrapCommands1.cxx index 118451432..0782b3ba7 100644 --- a/Source/cmBootstrapCommands1.cxx +++ b/Source/cmBootstrapCommands1.cxx @@ -54,6 +54,7 @@ #include "cmFunctionCommand.cxx" #include "cmPathLabel.cxx" #include "cmSearchPath.cxx" +#include "cmParseArgumentsCommand.cxx" void GetBootstrapCommands1(std::vector& commands) { @@ -91,4 +92,5 @@ void GetBootstrapCommands1(std::vector& commands) commands.push_back(new cmFindProgramCommand); commands.push_back(new cmForEachCommand); commands.push_back(new cmFunctionCommand); + commands.push_back(new cmParseArgumentsCommand); } diff --git a/Source/cmParseArgumentsCommand.cxx b/Source/cmParseArgumentsCommand.cxx new file mode 100644 index 000000000..ce7a7b3cd --- /dev/null +++ b/Source/cmParseArgumentsCommand.cxx @@ -0,0 +1,176 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Matthias Maennich + Copyright 2010 Alexander Neundorf + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#include "cmParseArgumentsCommand.h" +#include "cmAlgorithms.h" + +//---------------------------------------------------------------------------- +bool cmParseArgumentsCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) +{ + // cmake_parse_arguments(prefix options single multi ) + // 1 2 3 4 + if (args.size() < 4) + { + this->SetError("must be called with at least 4 arguments."); + return false; + } + + std::vector::const_iterator argIter = args.begin(), + argEnd = args.end(); + // the first argument is the prefix + const std::string prefix = (*argIter++) + "_"; + + // define the result maps holding key/value pairs for + // options, single values and multi values + typedef std::map options_map; + typedef std::map single_map; + typedef std::map > multi_map; + options_map options; + single_map single; + multi_map multi; + + // anything else is put into a vector of unparsed strings + std::vector unparsed; + + // the second argument is a (cmake) list of options without argument + std::vector list; + cmSystemTools::ExpandListArgument(*argIter++, list); + for (std::vector::const_iterator iter = list.begin(), + end = list.end(); + iter != end; ++iter) + { + options[*iter]; // default initialize + } + + // the third argument is a (cmake) list of single argument options + list.clear(); + cmSystemTools::ExpandListArgument(*argIter++, list); + for (std::vector::const_iterator iter = list.begin(), + end = list.end(); + iter != end; ++iter) + { + single[*iter]; // default initialize + } + + // the fourth argument is a (cmake) list of multi argument options + list.clear(); + cmSystemTools::ExpandListArgument(*argIter++, list); + for (std::vector::const_iterator iter = list.begin(), + end = list.end(); + iter != end; ++iter) + { + multi[*iter]; // default initialize + } + + enum insideValues + { + NONE, + SINGLE, + MULTI + } insideValues = NONE; + std::string currentArgName; + + // now iterate over the remaining arguments + // and fill in the values where applicable + for(; argIter != argEnd; ++argIter) + { + const options_map::iterator optIter = options.find(*argIter); + if (optIter != options.end()) + { + insideValues = NONE; + optIter->second = true; + continue; + } + + const single_map::iterator singleIter = single.find(*argIter); + if (singleIter != single.end()) + { + insideValues = SINGLE; + currentArgName = *argIter; + continue; + } + + const multi_map::iterator multiIter = multi.find(*argIter); + if (multiIter != multi.end()) + { + insideValues = MULTI; + currentArgName = *argIter; + continue; + } + + switch(insideValues) + { + case SINGLE: + single[currentArgName] = *argIter; + insideValues = NONE; + break; + case MULTI: + multi[currentArgName].push_back(*argIter); + break; + default: + unparsed.push_back(*argIter); + break; + } + } + + // now iterate over the collected values and update their definition + // within the current scope. undefine if necessary. + + for (options_map::const_iterator iter = options.begin(), end = options.end(); + iter != end; ++iter) + { + this->Makefile->AddDefinition(prefix + iter->first, + iter->second? "TRUE": "FALSE"); + } + for (single_map::const_iterator iter = single.begin(), end = single.end(); + iter != end; ++iter) + { + if (!iter->second.empty()) + { + this->Makefile->AddDefinition(prefix + iter->first, + iter->second.c_str()); + } + else + { + this->Makefile->RemoveDefinition(prefix + iter->first); + } + } + + for (multi_map::const_iterator iter = multi.begin(), end = multi.end(); + iter != end; ++iter) + { + if (!iter->second.empty()) + { + this->Makefile->AddDefinition(prefix + iter->first, + cmJoin(cmMakeRange(iter->second), ";") + .c_str()); + } + else + { + this->Makefile->RemoveDefinition(prefix + iter->first); + } + } + + if (!unparsed.empty()) + { + this->Makefile->AddDefinition(prefix + "UNPARSED_ARGUMENTS", + cmJoin(cmMakeRange(unparsed), ";").c_str()); + } + else + { + this->Makefile->RemoveDefinition(prefix + "UNPARSED_ARGUMENTS"); + } + + return true; +} diff --git a/Source/cmParseArgumentsCommand.h b/Source/cmParseArgumentsCommand.h new file mode 100644 index 000000000..7fbf64296 --- /dev/null +++ b/Source/cmParseArgumentsCommand.h @@ -0,0 +1,54 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2015 Matthias Maennich + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#ifndef cmParseArgumentsCommand_h +#define cmParseArgumentsCommand_h + +#include "cmCommand.h" + +/** \class cmParseArgumentsCommand + * + */ +class cmParseArgumentsCommand : public cmCommand +{ +public: + /** + * This is a virtual constructor for the command. + */ + virtual cmCommand* Clone() + { + return new cmParseArgumentsCommand; + } + + /** + * This is called when the command is first encountered in + * the CMakeLists.txt file. + */ + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); + + /** + * This determines if the command is invoked when in script mode. + */ + virtual bool IsScriptable() const { return true; } + + /** + * The name of the command as specified in CMakeList.txt. + */ + virtual std::string GetName() const { return "cmake_parse_arguments";} + + cmTypeMacro(cmParseArgumentsCommand, cmCommand); + +}; + + +#endif diff --git a/Tests/RunCMake/cmake_parse_arguments/CornerCases.cmake b/Tests/RunCMake/cmake_parse_arguments/CornerCases.cmake index 7337b71f5..9a727dd00 100644 --- a/Tests/RunCMake/cmake_parse_arguments/CornerCases.cmake +++ b/Tests/RunCMake/cmake_parse_arguments/CornerCases.cmake @@ -1,5 +1,4 @@ include(${CMAKE_CURRENT_LIST_DIR}/test_utils.cmake) -include(CMakeParseArguments) # example from the documentation # OPTIONAL is a keyword and therefore terminates the definition of diff --git a/Tests/RunCMake/cmake_parse_arguments/Errors-stderr.txt b/Tests/RunCMake/cmake_parse_arguments/Errors-stderr.txt index 5976fdc7e..5394eaf1b 100644 --- a/Tests/RunCMake/cmake_parse_arguments/Errors-stderr.txt +++ b/Tests/RunCMake/cmake_parse_arguments/Errors-stderr.txt @@ -1,17 +1,14 @@ -CMake Error at Errors.cmake:3 \(cmake_parse_arguments\): - CMAKE_PARSE_ARGUMENTS Function invoked with incorrect arguments for - function named: CMAKE_PARSE_ARGUMENTS +CMake Error at Errors\.cmake:1 \(cmake_parse_arguments\): + cmake_parse_arguments must be called with at least 4 arguments\. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:3 \(include\) + -CMake Error at Errors.cmake:4 \(cmake_parse_arguments\): - CMAKE_PARSE_ARGUMENTS Function invoked with incorrect arguments for - function named: CMAKE_PARSE_ARGUMENTS +CMake Error at Errors\.cmake:2 \(cmake_parse_arguments\): + cmake_parse_arguments must be called with at least 4 arguments\. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:3 \(include\) + -CMake Error at Errors.cmake:5 \(cmake_parse_arguments\): - CMAKE_PARSE_ARGUMENTS Function invoked with incorrect arguments for - function named: CMAKE_PARSE_ARGUMENTS +CMake Error at Errors\.cmake:3 \(cmake_parse_arguments\): + cmake_parse_arguments must be called with at least 4 arguments\. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists\.txt:3 \(include\) diff --git a/Tests/RunCMake/cmake_parse_arguments/Errors.cmake b/Tests/RunCMake/cmake_parse_arguments/Errors.cmake index 2db3bb158..98e22e94d 100644 --- a/Tests/RunCMake/cmake_parse_arguments/Errors.cmake +++ b/Tests/RunCMake/cmake_parse_arguments/Errors.cmake @@ -1,5 +1,3 @@ -include(CMakeParseArguments) - cmake_parse_arguments() cmake_parse_arguments(prefix OPT) cmake_parse_arguments(prefix OPT SINGLE) diff --git a/Tests/RunCMake/cmake_parse_arguments/Initialization.cmake b/Tests/RunCMake/cmake_parse_arguments/Initialization.cmake index 8729bc618..462f923db 100644 --- a/Tests/RunCMake/cmake_parse_arguments/Initialization.cmake +++ b/Tests/RunCMake/cmake_parse_arguments/Initialization.cmake @@ -1,5 +1,4 @@ include(${CMAKE_CURRENT_LIST_DIR}/test_utils.cmake) -include(CMakeParseArguments) # unparsed arguments cmake_parse_arguments(pref "" "" "") diff --git a/Tests/RunCMake/cmake_parse_arguments/Mix.cmake b/Tests/RunCMake/cmake_parse_arguments/Mix.cmake index c14fdfd91..b3eff3947 100644 --- a/Tests/RunCMake/cmake_parse_arguments/Mix.cmake +++ b/Tests/RunCMake/cmake_parse_arguments/Mix.cmake @@ -1,5 +1,4 @@ include(${CMAKE_CURRENT_LIST_DIR}/test_utils.cmake) -include(CMakeParseArguments) # specify two keywords for each category and set the first keyword of each # within ARGN From ab8a280857da5cf8545bd2a6f69b7378f53449a5 Mon Sep 17 00:00:00 2001 From: Matthias Maennich Date: Sat, 5 Dec 2015 19:02:19 +0100 Subject: [PATCH 074/255] cmake_parse_arguments: consider duplicate keyword as warning The behaviour of double specified keywords is rather undefined or at least not clearly documented. This change introduces a strict check and emits a warning in case a keyword has been specified more than once. --- Help/command/cmake_parse_arguments.rst | 7 ++++ Source/cmParseArgumentsCommand.cxx | 16 ++++++++ .../cmake_parse_arguments/Errors-stderr.txt | 40 ++++++++++++++++--- .../cmake_parse_arguments/Errors.cmake | 10 +++++ 4 files changed, 68 insertions(+), 5 deletions(-) diff --git a/Help/command/cmake_parse_arguments.rst b/Help/command/cmake_parse_arguments.rst index 7638b6102..6206611d2 100644 --- a/Help/command/cmake_parse_arguments.rst +++ b/Help/command/cmake_parse_arguments.rst @@ -25,6 +25,13 @@ The ```` argument contains all keywords for this macro which can be followed by more than one value, like e.g. the ``TARGETS`` or ``FILES`` keywords of the :command:`install` command. +.. note:: + + All keywords shall be unique. I.e. every keyword shall only be specified + once in either ````, ```` or + ````. A warning will be emitted if uniqueness is + violated. + When done, ``cmake_parse_arguments`` will have defined for each of the keywords listed in ````, ```` and ```` a variable composed of the given ```` diff --git a/Source/cmParseArgumentsCommand.cxx b/Source/cmParseArgumentsCommand.cxx index ce7a7b3cd..a86196515 100644 --- a/Source/cmParseArgumentsCommand.cxx +++ b/Source/cmParseArgumentsCommand.cxx @@ -43,6 +43,10 @@ bool cmParseArgumentsCommand // anything else is put into a vector of unparsed strings std::vector unparsed; + // remember already defined keywords + std::set used_keywords; + const std::string dup_warning = "keyword defined more than once: "; + // the second argument is a (cmake) list of options without argument std::vector list; cmSystemTools::ExpandListArgument(*argIter++, list); @@ -50,6 +54,10 @@ bool cmParseArgumentsCommand end = list.end(); iter != end; ++iter) { + if (!used_keywords.insert(*iter).second) + { + this->GetMakefile()->IssueMessage(cmake::WARNING, dup_warning + *iter); + } options[*iter]; // default initialize } @@ -60,6 +68,10 @@ bool cmParseArgumentsCommand end = list.end(); iter != end; ++iter) { + if (!used_keywords.insert(*iter).second) + { + this->GetMakefile()->IssueMessage(cmake::WARNING, dup_warning + *iter); + } single[*iter]; // default initialize } @@ -70,6 +82,10 @@ bool cmParseArgumentsCommand end = list.end(); iter != end; ++iter) { + if (!used_keywords.insert(*iter).second) + { + this->GetMakefile()->IssueMessage(cmake::WARNING, dup_warning + *iter); + } multi[*iter]; // default initialize } diff --git a/Tests/RunCMake/cmake_parse_arguments/Errors-stderr.txt b/Tests/RunCMake/cmake_parse_arguments/Errors-stderr.txt index 5394eaf1b..f2ba9b84e 100644 --- a/Tests/RunCMake/cmake_parse_arguments/Errors-stderr.txt +++ b/Tests/RunCMake/cmake_parse_arguments/Errors-stderr.txt @@ -1,8 +1,3 @@ -CMake Error at Errors\.cmake:1 \(cmake_parse_arguments\): - cmake_parse_arguments must be called with at least 4 arguments\. -Call Stack \(most recent call first\): - CMakeLists\.txt:3 \(include\) -+ CMake Error at Errors\.cmake:2 \(cmake_parse_arguments\): cmake_parse_arguments must be called with at least 4 arguments\. Call Stack \(most recent call first\): @@ -12,3 +7,38 @@ CMake Error at Errors\.cmake:3 \(cmake_parse_arguments\): cmake_parse_arguments must be called with at least 4 arguments\. Call Stack \(most recent call first\): CMakeLists\.txt:3 \(include\) ++ +CMake Error at Errors\.cmake:4 \(cmake_parse_arguments\): + cmake_parse_arguments must be called with at least 4 arguments\. +Call Stack \(most recent call first\): + CMakeLists\.txt:3 \(include\) ++ +CMake Warning at Errors\.cmake:8 \(cmake_parse_arguments\): + keyword defined more than once: OPT +Call Stack \(most recent call first\): + CMakeLists\.txt:3 \(include\) ++ +CMake Warning at Errors\.cmake:9 \(cmake_parse_arguments\): + keyword defined more than once: OPT +Call Stack \(most recent call first\): + CMakeLists\.txt:3 \(include\) ++ +CMake Warning at Errors\.cmake:10 \(cmake_parse_arguments\): + keyword defined more than once: OPT +Call Stack \(most recent call first\): + CMakeLists\.txt:3 \(include\) ++ +CMake Warning at Errors\.cmake:12 \(cmake_parse_arguments\): + keyword defined more than once: OPT +Call Stack \(most recent call first\): + CMakeLists\.txt:3 \(include\) ++ +CMake Warning at Errors\.cmake:13 \(cmake_parse_arguments\): + keyword defined more than once: OPT +Call Stack \(most recent call first\): + CMakeLists\.txt:3 \(include\) ++ +CMake Warning at Errors\.cmake:14 \(cmake_parse_arguments\): + keyword defined more than once: OPT +Call Stack \(most recent call first\): + CMakeLists\.txt:3 \(include\) diff --git a/Tests/RunCMake/cmake_parse_arguments/Errors.cmake b/Tests/RunCMake/cmake_parse_arguments/Errors.cmake index 98e22e94d..6a380810d 100644 --- a/Tests/RunCMake/cmake_parse_arguments/Errors.cmake +++ b/Tests/RunCMake/cmake_parse_arguments/Errors.cmake @@ -1,4 +1,14 @@ +# wrong argument count cmake_parse_arguments() cmake_parse_arguments(prefix OPT) cmake_parse_arguments(prefix OPT SINGLE) cmake_parse_arguments(prefix OPT SINGLE MULTI) # not an error + +# duplicate keywords +cmake_parse_arguments(prefix "OPT;OPT" "" "") +cmake_parse_arguments(prefix "" "OPT;OPT" "") +cmake_parse_arguments(prefix "" "" "OPT;OPT") + +cmake_parse_arguments(prefix "OPT" "OPT" "") +cmake_parse_arguments(prefix "" "OPT" "OPT") +cmake_parse_arguments(prefix "OPT" "" "OPT") From a479d7a0ae1583e0e9471e747393839f1af6a593 Mon Sep 17 00:00:00 2001 From: Emilie Harquel Date: Wed, 16 Dec 2015 14:12:56 +0100 Subject: [PATCH 075/255] BundleUtilities: Fix handling of multiple RPATHs from OS X otool The `otool` command may return multiple RPATH entires, so call `gp_append_unique` for each one. Otherwise we may try to ask `install_name_tool` to deal with the same entry twice. --- Modules/BundleUtilities.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake index b7975d3ea..45dda40c8 100644 --- a/Modules/BundleUtilities.cmake +++ b/Modules/BundleUtilities.cmake @@ -424,7 +424,9 @@ function(get_item_rpaths item rpaths_var) string(REGEX MATCHALL "rpath [^\n]+" load_cmds_ov "${load_cmds_ov}") string(REGEX REPLACE "rpath " "" load_cmds_ov "${load_cmds_ov}") if(load_cmds_ov) - gp_append_unique(${rpaths_var} "${load_cmds_ov}") + foreach(rpath ${load_cmds_ov}) + gp_append_unique(${rpaths_var} "${rpath}") + endforeach() endif() endif() From 498c36850ba3e3b04dc2cbcd0baad7e8ee750de7 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 17 Dec 2015 14:26:19 -0500 Subject: [PATCH 076/255] Add a script to help update third-party sources Use the VTK `ThirdParty/update-common.sh` script as of commit 2f24b7b0f60b67a2a28b9aef210f06f904e7a977. Co-Author: Brad King --- Utilities/Scripts/update-third-party.bash | 146 ++++++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 Utilities/Scripts/update-third-party.bash diff --git a/Utilities/Scripts/update-third-party.bash b/Utilities/Scripts/update-third-party.bash new file mode 100644 index 000000000..8925296cb --- /dev/null +++ b/Utilities/Scripts/update-third-party.bash @@ -0,0 +1,146 @@ +######################################################################## +# Script for updating third party packages. +# +# This script should be sourced in a project-specific script which sets +# the following variables: +# +# name +# The name of the project. +# ownership +# A git author name/email for the commits. +# subtree +# The location of the thirdparty package within the main source +# tree. +# repo +# The git repository to use as upstream. +# tag +# The tag, branch or commit hash to use for upstream. +# shortlog +# Optional. Set to 'true' to get a shortlog in the commit message. +# +# Additionally, an "extract_source" function must be defined. It will be +# run within the checkout of the project on the requested tag. It should +# should place the desired tree into $extractdir/$name-reduced. This +# directory will be used as the newest commit for the project. +# +# For convenience, the function may use the "git_archive" function which +# does a standard "git archive" extraction using the (optional) "paths" +# variable to only extract a subset of the source tree. +######################################################################## + +######################################################################## +# Utility functions +######################################################################## +git_archive () { + git archive --prefix="$name-reduced/" HEAD -- $paths | \ + tar -C "$extractdir" -x +} + +die () { + echo >&2 "$@" + exit 1 +} + +warn () { + echo >&2 "warning: $@" +} + +readonly regex_date='20[0-9][0-9]-[0-9][0-9]-[0-9][0-9]' +readonly basehash_regex="$name $regex_date ([0-9a-f]*)" +readonly basehash="$( git rev-list --author="$ownership" --grep="$basehash_regex" -n 1 HEAD )" +readonly upstream_old_short="$( git cat-file commit "$basehash" | sed -n '/'"$basehash_regex"'/ {s/.*(//;s/)//;p}' | egrep '^[0-9a-f]+$' )" + +######################################################################## +# Sanity checking +######################################################################## +[ -n "$name" ] || \ + die "'name' is empty" +[ -n "$ownership" ] || \ + die "'ownership' is empty" +[ -n "$subtree" ] || \ + die "'subtree' is empty" +[ -n "$repo" ] || \ + die "'repo' is empty" +[ -n "$tag" ] || \ + die "'tag' is empty" +[ -n "$basehash" ] || \ + warn "'basehash' is empty; performing initial import" +readonly do_shortlog="${shortlog-false}" + +readonly workdir="$PWD/work" +readonly upstreamdir="$workdir/upstream" +readonly extractdir="$workdir/extract" + +[ -d "$workdir" ] && \ + die "error: workdir '$workdir' already exists" + +trap "rm -rf '$workdir'" EXIT + +# Get upstream +git clone "$repo" "$upstreamdir" + +if [ -n "$basehash" ]; then + # Use the existing package's history + git worktree add "$extractdir" "$basehash" + # Clear out the working tree + pushd "$extractdir" + git ls-files | xargs rm -v + popd +else + # Create a repo to hold this package's history + mkdir -p "$extractdir" + git -C "$extractdir" init +fi + +# Extract the subset of upstream we care about +pushd "$upstreamdir" +git checkout "$tag" +readonly upstream_hash="$( git rev-parse HEAD )" +readonly upstream_hash_short="$( git rev-parse --short=8 "$upstream_hash" )" +readonly upstream_datetime="$( git rev-list "$upstream_hash" --format='%ci' -n 1 | grep -e "^$regex_date" )" +readonly upstream_date="$( echo "$upstream_datetime" | grep -o -e "$regex_date" )" +if $do_shortlog && [ -n "$basehash" ]; then + readonly commit_shortlog=" + +Upstream Shortlog +----------------- + +$( git shortlog --no-merges --abbrev=8 --format='%h %s' "$upstream_old_short".."$upstream_hash" )" +else + readonly commit_shortlog="" +fi +extract_source || \ + die "failed to extract source" +popd + +[ -d "$extractdir/$name-reduced" ] || \ + die "expected directory to extract does not exist" +readonly commit_summary="$name $upstream_date ($upstream_hash_short)" + +# Commit the subset +pushd "$extractdir" +mv -v "$name-reduced/"* . +rmdir "$name-reduced/" +git add -A . +git commit -n --author="$ownership" --date="$upstream_datetime" -F - <<-EOF +$commit_summary + +Code extracted from: + + $repo + +at commit $upstream_hash ($tag).$commit_shortlog +EOF +git branch -f "upstream-$name" +popd + +# Merge the subset into this repository +if [ -n "$basehash" ]; then + git merge --log -s recursive "-Xsubtree=$subtree/" --no-commit "upstream-$name" +else + git fetch "$extractdir" "upstream-$name:upstream-$name" + git merge --log -s ours --no-commit "upstream-$name" + git read-tree -u --prefix="$subtree/" "upstream-$name" +fi +git commit --no-edit +git branch -d "upstream-$name" From c4282347e27badf2f1e8b8b5a17bb01ce3209eea Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 17 Dec 2015 14:30:36 -0500 Subject: [PATCH 077/255] Add script to update KWSys from upstream --- Utilities/Scripts/update-kwsys.bash | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 Utilities/Scripts/update-kwsys.bash diff --git a/Utilities/Scripts/update-kwsys.bash b/Utilities/Scripts/update-kwsys.bash new file mode 100755 index 000000000..650841f10 --- /dev/null +++ b/Utilities/Scripts/update-kwsys.bash @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +set -e +set -x +shopt -s dotglob + +readonly name="KWSys" +readonly ownership="KWSys Upstream " +readonly subtree="Source/kwsys" +readonly repo="http://public.kitware.com/KWSys.git" +readonly tag="master" +readonly shortlog=true +readonly paths=" +" + +extract_source () { + git_archive +} + +export HOOKS_ALLOW_KWSYS=1 + +. "${BASH_SOURCE%/*}/update-third-party.bash" From ec1398d7aec410da0aa085cf7693d62afa11291d Mon Sep 17 00:00:00 2001 From: KWSys Upstream Date: Mon, 14 Dec 2015 09:36:13 -0500 Subject: [PATCH 078/255] KWSys 2015-12-14 (c1149ef6) Code extracted from: http://public.kitware.com/KWSys.git at commit c1149ef69956eab13221e05ffb2d9b5e55c2e3ee (master). Upstream Shortlog ----------------- Brad King (1): c1149ef6 Drop the FundamentalType.h component of KWSys --- CMakeLists.txt | 58 +--------------- FundamentalType.h.in | 139 -------------------------------------- kwsysPlatformTestsCXX.cxx | 96 -------------------------- 3 files changed, 1 insertion(+), 292 deletions(-) delete mode 100644 FundamentalType.h.in diff --git a/CMakeLists.txt b/CMakeLists.txt index b859e79d9..8b1539416 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -118,7 +118,6 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) SET(KWSYS_USE_System 1) SET(KWSYS_USE_SystemTools 1) SET(KWSYS_USE_CommandLineArguments 1) - SET(KWSYS_USE_FundamentalType 1) SET(KWSYS_USE_Terminal 1) SET(KWSYS_USE_IOStream 1) SET(KWSYS_USE_FStream 1) @@ -374,61 +373,6 @@ IF(KWSYS_CXX_HAS___INT64) ENDIF() ENDIF() -IF(KWSYS_USE_FundamentalType) - # Look for type size helper macros. - KWSYS_PLATFORM_INFO_TEST(C KWSYS_C_TYPE_MACROS - "Checking for C type size macros") - SET(macro_regex ".*INFO:macro\\[([^]]*)\\].*") - FOREACH(info ${KWSYS_C_TYPE_MACROS}) - IF("${info}" MATCHES "${macro_regex}") - STRING(REGEX REPLACE "${macro_regex}" "\\1" macro "${info}") - SET(KWSYS_C_HAS_MACRO_${macro} 1) - ENDIF() - ENDFOREACH() - - # Determine type sizes at preprocessing time if possible, and - # otherwise fall back to a try-compile. - SET(KWSYS_C_TYPE_NAME_CHAR "char") - SET(KWSYS_C_TYPE_NAME_SHORT "short") - SET(KWSYS_C_TYPE_NAME_INT "int") - SET(KWSYS_C_TYPE_NAME_LONG "long") - SET(KWSYS_C_TYPE_NAME_LONG_LONG "long long") - SET(KWSYS_C_TYPE_NAME___INT64 "__int64") - FOREACH(type CHAR SHORT INT LONG LONG_LONG __INT64) - IF(KWSYS_C_HAS_MACRO___SIZEOF_${type}__) - # Use __SIZEOF_${type}__ macro. - SET(KWSYS_SIZEOF_${type} TRUE) - SET(KWSYS_C_CODE_SIZEOF_${type} "#define ${KWSYS_NAMESPACE}_SIZEOF_${type} __SIZEOF_${type}__") - ELSEIF(KWSYS_C_HAS_MACRO___${type}_MAX__) - # Use __${type}_MAX__ macro. - SET(KWSYS_SIZEOF_${type} TRUE) - SET(KWSYS_C_CODE_SIZEOF_${type} "#if __${type}_MAX__ == 0x7f -# define ${KWSYS_NAMESPACE}_SIZEOF_${type} 1 -#elif __${type}_MAX__ == 0x7fff -# define ${KWSYS_NAMESPACE}_SIZEOF_${type} 2 -#elif __${type}_MAX__ == 0x7fffffff -# define ${KWSYS_NAMESPACE}_SIZEOF_${type} 4 -#elif __${type}_MAX__>>32 == 0x7fffffff -# define ${KWSYS_NAMESPACE}_SIZEOF_${type} 8 -#else -# error \"Cannot determine sizeof(${KWSYS_C_TYPE_NAME_${type}}).\" -#endif") - ELSE() - # Configure a hard-coded type size. - CHECK_TYPE_SIZE("${KWSYS_C_TYPE_NAME_${type}}" KWSYS_SIZEOF_${type}) - IF(NOT KWSYS_SIZEOF_${type}) - SET(KWSYS_SIZEOF_${type} 0) - ENDIF() - SET(KWSYS_C_CODE_SIZEOF_${type} - "#define ${KWSYS_NAMESPACE}_SIZEOF_${type} ${KWSYS_SIZEOF_${type}}") - ENDIF() - ENDFOREACH() - - # Check signedness of "char" type. - KWSYS_PLATFORM_CXX_TEST_RUN(KWSYS_CHAR_IS_SIGNED - "Checking whether char is signed" DIRECT) -ENDIF() - IF(KWSYS_USE_Encoding) # Look for type size helper macros. KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_WSTRING @@ -741,7 +685,7 @@ ENDFOREACH() # Add selected C components. FOREACH(c - Process Base64 Encoding FundamentalType MD5 Terminal System String + Process Base64 Encoding MD5 Terminal System String ) IF(KWSYS_USE_${c}) # Use the corresponding header file. diff --git a/FundamentalType.h.in b/FundamentalType.h.in deleted file mode 100644 index e702a7a32..000000000 --- a/FundamentalType.h.in +++ /dev/null @@ -1,139 +0,0 @@ -/*============================================================================ - KWSys - Kitware System Library - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#ifndef @KWSYS_NAMESPACE@_FundamentalType_h -#define @KWSYS_NAMESPACE@_FundamentalType_h - -#include <@KWSYS_NAMESPACE@/Configure.h> - -/* Redefine all public interface symbol names to be in the proper - namespace. These macros are used internally to kwsys only, and are - not visible to user code. Use kwsysHeaderDump.pl to reproduce - these macros after making changes to the interface. */ -#if !defined(KWSYS_NAMESPACE) -# define kwsys_ns(x) @KWSYS_NAMESPACE@##x -# define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT -#endif - -#if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS -# define kwsysFundamentalType kwsys_ns(FundamentalType) -# define kwsysFundamentalType_Int8 kwsys_ns(FundamentalType_Int8) -# define kwsysFundamentalType_UInt8 kwsys_ns(FundamentalType_UInt8) -# define kwsysFundamentalType_Int16 kwsys_ns(FundamentalType_Int16) -# define kwsysFundamentalType_UInt16 kwsys_ns(FundamentalType_UInt16) -# define kwsysFundamentalType_Int32 kwsys_ns(FundamentalType_Int32) -# define kwsysFundamentalType_UInt32 kwsys_ns(FundamentalType_UInt32) -# define kwsysFundamentalType_Int64 kwsys_ns(FundamentalType_Int64) -# define kwsysFundamentalType_UInt64 kwsys_ns(FundamentalType_UInt64) -#endif - -/* The size of fundamental types. Types that do not exist have size 0. */ -@KWSYS_C_CODE_SIZEOF_CHAR@ -@KWSYS_C_CODE_SIZEOF_SHORT@ -@KWSYS_C_CODE_SIZEOF_INT@ -@KWSYS_C_CODE_SIZEOF_LONG@ -@KWSYS_C_CODE_SIZEOF_LONG_LONG@ -@KWSYS_C_CODE_SIZEOF___INT64@ - -/* Whether types "long long" and "__int64" are enabled. If a type is - enabled then it is a unique fundamental type. */ -#define @KWSYS_NAMESPACE@_USE_LONG_LONG @KWSYS_USE_LONG_LONG@ -#define @KWSYS_NAMESPACE@_USE___INT64 @KWSYS_USE___INT64@ - -/* Whether type "char" is signed (it may be signed or unsigned). */ -#define @KWSYS_NAMESPACE@_CHAR_IS_SIGNED @KWSYS_CHAR_IS_SIGNED@ - -#if defined(__cplusplus) -extern "C" -{ -#endif - -/* Select an 8-bit integer type. */ -#if @KWSYS_NAMESPACE@_SIZEOF_CHAR == 1 -typedef signed char kwsysFundamentalType_Int8; -typedef unsigned char kwsysFundamentalType_UInt8; -#else -# error "No native data type can represent an 8-bit integer." -#endif - -/* Select a 16-bit integer type. */ -#if @KWSYS_NAMESPACE@_SIZEOF_SHORT == 2 -typedef short kwsysFundamentalType_Int16; -typedef unsigned short kwsysFundamentalType_UInt16; -#elif @KWSYS_NAMESPACE@_SIZEOF_INT == 2 -typedef int kwsysFundamentalType_Int16; -typedef unsigned int kwsysFundamentalType_UInt16; -#else -# error "No native data type can represent a 16-bit integer." -#endif - -/* Select a 32-bit integer type. */ -#if @KWSYS_NAMESPACE@_SIZEOF_INT == 4 -typedef int kwsysFundamentalType_Int32; -typedef unsigned int kwsysFundamentalType_UInt32; -#elif @KWSYS_NAMESPACE@_SIZEOF_LONG == 4 -typedef long kwsysFundamentalType_Int32; -typedef unsigned long kwsysFundamentalType_UInt32; -#else -# error "No native data type can represent a 32-bit integer." -#endif - -/* Select a 64-bit integer type. */ -#if @KWSYS_NAMESPACE@_SIZEOF_LONG == 8 -typedef signed long kwsysFundamentalType_Int64; -typedef unsigned long kwsysFundamentalType_UInt64; -#elif @KWSYS_NAMESPACE@_USE_LONG_LONG && @KWSYS_NAMESPACE@_SIZEOF_LONG_LONG == 8 -typedef signed long long kwsysFundamentalType_Int64; -typedef unsigned long long kwsysFundamentalType_UInt64; -#elif @KWSYS_NAMESPACE@_USE___INT64 && @KWSYS_NAMESPACE@_SIZEOF___INT64 == 8 -typedef signed __int64 kwsysFundamentalType_Int64; -typedef unsigned __int64 kwsysFundamentalType_UInt64; -#else -# error "No native data type can represent a 64-bit integer." -#endif - -#if defined(__cplusplus) -} /* extern "C" */ -#endif - -/* If we are building a kwsys .c or .cxx file, let it use these macros. - Otherwise, undefine them to keep the namespace clean. */ -#if !defined(KWSYS_NAMESPACE) -# undef kwsys_ns -# undef kwsysEXPORT -# if !defined(KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS -# undef kwsysFundamentalType -# undef kwsysFundamentalType_Int8 -# undef kwsysFundamentalType_UInt8 -# undef kwsysFundamentalType_Int16 -# undef kwsysFundamentalType_UInt16 -# undef kwsysFundamentalType_Int32 -# undef kwsysFundamentalType_UInt32 -# undef kwsysFundamentalType_Int64 -# undef kwsysFundamentalType_UInt64 -# endif -#endif - -/* If building a C or C++ file in kwsys itself, give the source file - access to the configured macros without a configured namespace. */ -#if defined(KWSYS_NAMESPACE) -# define KWSYS_SIZEOF_CHAR @KWSYS_NAMESPACE@_SIZEOF_CHAR -# define KWSYS_SIZEOF_SHORT @KWSYS_NAMESPACE@_SIZEOF_SHORT -# define KWSYS_SIZEOF_INT @KWSYS_NAMESPACE@_SIZEOF_INT -# define KWSYS_SIZEOF_LONG @KWSYS_NAMESPACE@_SIZEOF_LONG -# define KWSYS_SIZEOF_LONG_LONG @KWSYS_NAMESPACE@_SIZEOF_LONG_LONG -# define KWSYS_SIZEOF___INT64 @KWSYS_NAMESPACE@_SIZEOF___INT64 -# define KWSYS_USE_LONG_LONG @KWSYS_NAMESPACE@_USE_LONG_LONG -# define KWSYS_USE___INT64 @KWSYS_NAMESPACE@_USE___INT64 -# define KWSYS_CHAR_IS_SIGNED @KWSYS_NAMESPACE@_CHAR_IS_SIGNED -#endif - -#endif diff --git a/kwsysPlatformTestsCXX.cxx b/kwsysPlatformTestsCXX.cxx index aaa33b8c2..fc87f9135 100644 --- a/kwsysPlatformTestsCXX.cxx +++ b/kwsysPlatformTestsCXX.cxx @@ -130,15 +130,6 @@ int main() } #endif -#ifdef TEST_KWSYS_CHAR_IS_SIGNED -/* Return 0 for char signed and 1 for char unsigned. */ -int main() -{ - unsigned char uc = 255; - return (*reinterpret_cast(&uc) < 0)?0:1; -} -#endif - #ifdef TEST_KWSYS_LFS_WORKS /* Return 0 when LFS is available and 1 otherwise. */ #define _LARGEFILE_SOURCE @@ -326,93 +317,6 @@ int main() } #endif -#ifdef TEST_KWSYS_CXX_TYPE_INFO -/* Collect fundamental type information and save it to a CMake script. */ - -/* Include limits.h to get macros indicating long long and __int64. - Note that certain compilers need special macros to define these - macros in limits.h. */ -#if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS) -# define _MSC_EXTENSIONS -#endif -#if defined(__GNUC__) && __GNUC__ < 3 -# define _GNU_SOURCE -#endif -#include - -#include -#include - -/* Due to shell differences and limitations of ADD_DEFINITIONS the - KWSYS_CXX_TYPE_INFO_FILE macro will sometimes have double quotes - and sometimes not. This macro will make sure the value is treated - as a double-quoted string. */ -#define TO_STRING(x) TO_STRING0(x) -#define TO_STRING0(x) TO_STRING1(x) -#define TO_STRING1(x) #x - -void f() {} - -int main() -{ - /* Construct the output file name. Some preprocessors will add an - extra level of double quotes, so strip them. */ - char fbuf[] = TO_STRING(KWSYS_CXX_TYPE_INFO_FILE); - char* fname = fbuf; - if(fname[0] == '"') - { - ++fname; - int len = static_cast(strlen(fname)); - if(len > 0 && fname[len-1] == '"') - { - fname[len-1] = 0; - } - } - - /* Try to open the output file. */ - if(FILE* fout = fopen(fname, "w")) - { - /* Set the size of standard types. */ - fprintf(fout, "SET(KWSYS_SIZEOF_CHAR %d)\n", static_cast(sizeof(char))); - fprintf(fout, "SET(KWSYS_SIZEOF_SHORT %d)\n", static_cast(sizeof(short))); - fprintf(fout, "SET(KWSYS_SIZEOF_INT %d)\n", static_cast(sizeof(int))); - fprintf(fout, "SET(KWSYS_SIZEOF_LONG %d)\n", static_cast(sizeof(long))); - - /* Set the size of some non-standard but common types. */ - /* Check for a limits.h macro for long long to see if the type exists. */ -#if defined(LLONG_MAX) || defined(LONG_LONG_MAX) || defined(LONGLONG_MAX) - fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG %d)\n", static_cast(sizeof(long long))); -#else - fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG 0) # No long long available.\n"); -#endif - /* Check for a limits.h macro for __int64 to see if the type exists. */ -#if defined(_I64_MIN) - fprintf(fout, "SET(KWSYS_SIZEOF___INT64 %d)\n", static_cast(sizeof(__int64))); -#else - fprintf(fout, "SET(KWSYS_SIZEOF___INT64 0) # No __int64 available.\n"); -#endif - - /* Set the size of some pointer types. */ - fprintf(fout, "SET(KWSYS_SIZEOF_PDATA %d)\n", static_cast(sizeof(void*))); - fprintf(fout, "SET(KWSYS_SIZEOF_PFUNC %d)\n", static_cast(sizeof(&f))); - - /* Set whether the native type "char" is signed or unsigned. */ - unsigned char uc = 255; - fprintf(fout, "SET(KWSYS_CHAR_IS_SIGNED %d)\n", - (*reinterpret_cast(&uc) < 0)?1:0); - - fclose(fout); - return 0; - } - else - { - fprintf(stderr, "Failed to write fundamental type info to \"%s\".\n", - fname); - return 1; - } -} -#endif - #ifdef TEST_KWSYS_CXX_HAS_BORLAND_ASM int main() { From c7d9a249118a7b01ed8fa9cc8c61833e39d251d2 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 17 Dec 2015 14:55:38 -0500 Subject: [PATCH 079/255] Utilities/KWIML: Drop sources to make room for fresh import --- Utilities/KWIML/ABI.h.in | 506 ------------- Utilities/KWIML/CMakeLists.txt | 79 -- Utilities/KWIML/Copyright.txt | 30 - Utilities/KWIML/INT.h.in | 861 ---------------------- Utilities/KWIML/README.txt | 29 - Utilities/KWIML/test/CMakeLists.txt | 70 -- Utilities/KWIML/test/test.c | 39 - Utilities/KWIML/test/test.cxx | 12 - Utilities/KWIML/test/test.h | 37 - Utilities/KWIML/test/test_ABI_C.c | 22 - Utilities/KWIML/test/test_ABI_CXX.cxx | 22 - Utilities/KWIML/test/test_ABI_endian.h.in | 47 -- Utilities/KWIML/test/test_INT_C.c | 22 - Utilities/KWIML/test/test_INT_CXX.cxx | 22 - Utilities/KWIML/test/test_INT_format.h.in | 200 ----- Utilities/KWIML/test/test_include_C.c | 22 - Utilities/KWIML/test/test_include_CXX.cxx | 28 - 17 files changed, 2048 deletions(-) delete mode 100644 Utilities/KWIML/ABI.h.in delete mode 100644 Utilities/KWIML/CMakeLists.txt delete mode 100644 Utilities/KWIML/Copyright.txt delete mode 100644 Utilities/KWIML/INT.h.in delete mode 100644 Utilities/KWIML/README.txt delete mode 100644 Utilities/KWIML/test/CMakeLists.txt delete mode 100644 Utilities/KWIML/test/test.c delete mode 100644 Utilities/KWIML/test/test.cxx delete mode 100644 Utilities/KWIML/test/test.h delete mode 100644 Utilities/KWIML/test/test_ABI_C.c delete mode 100644 Utilities/KWIML/test/test_ABI_CXX.cxx delete mode 100644 Utilities/KWIML/test/test_ABI_endian.h.in delete mode 100644 Utilities/KWIML/test/test_INT_C.c delete mode 100644 Utilities/KWIML/test/test_INT_CXX.cxx delete mode 100644 Utilities/KWIML/test/test_INT_format.h.in delete mode 100644 Utilities/KWIML/test/test_include_C.c delete mode 100644 Utilities/KWIML/test/test_include_CXX.cxx diff --git a/Utilities/KWIML/ABI.h.in b/Utilities/KWIML/ABI.h.in deleted file mode 100644 index 87b6e96da..000000000 --- a/Utilities/KWIML/ABI.h.in +++ /dev/null @@ -1,506 +0,0 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Kitware, Inc. nor the names of its contributors - may be used to endorse or promote products derived from this - software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -============================================================================*/ -#ifndef @KWIML@_ABI_H -#define @KWIML@_ABI_H -/* -This header defines macros with information about the C ABI. -Only information that can be determined using the preprocessor at -compilation time is available. No try-compile results may be added -here. Instead we memorize results on platforms of interest. - -An includer may optionally define the following macros to suppress errors: - - @KWIML@_ABI_NO_VERIFY = skip verification declarations - @KWIML@_ABI_NO_ERROR_CHAR_SIGN = signedness of 'char' may be unknown - @KWIML@_ABI_NO_ERROR_LONG_LONG = existence of 'long long' may be unknown - @KWIML@_ABI_NO_ERROR_ENDIAN = byte order of CPU may be unknown - -An includer may test the following macros after inclusion: - - @KWIML@_ABI_SIZEOF_DATA_PTR = sizeof(void*) - @KWIML@_ABI_SIZEOF_CODE_PTR = sizeof(void(*)(void)) - @KWIML@_ABI_SIZEOF_FLOAT = sizeof(float) - @KWIML@_ABI_SIZEOF_DOUBLE = sizeof(double) - @KWIML@_ABI_SIZEOF_CHAR = sizeof(char) - @KWIML@_ABI_SIZEOF_SHORT = sizeof(short) - @KWIML@_ABI_SIZEOF_INT = sizeof(int) - @KWIML@_ABI_SIZEOF_LONG = sizeof(long) - - @KWIML@_ABI_SIZEOF_LONG_LONG = sizeof(long long) or 0 if not a type - Undefined if existence is unknown and error suppression macro - @KWIML@_ABI_NO_ERROR_LONG_LONG was defined. - - @KWIML@_ABI_SIZEOF___INT64 = 8 if '__int64' exists or 0 if not - Undefined if existence is unknown. - - @KWIML@_ABI___INT64_IS_LONG = 1 if '__int64' is 'long' (same type) - Undefined otherwise. - @KWIML@_ABI___INT64_IS_LONG_LONG = 1 if '__int64' is 'long long' (same type) - Undefined otherwise. - @KWIML@_ABI___INT64_IS_UNIQUE = 1 if '__int64' is a distinct type - Undefined otherwise. - - @KWIML@_ABI_CHAR_IS_UNSIGNED = 1 if 'char' is unsigned, else undefined - @KWIML@_ABI_CHAR_IS_SIGNED = 1 if 'char' is signed, else undefined - One of these is defined unless signedness of 'char' is unknown and - error suppression macro @KWIML@_ABI_NO_ERROR_CHAR_SIGN was defined. - - @KWIML@_ABI_ENDIAN_ID_BIG = id for big-endian (always defined) - @KWIML@_ABI_ENDIAN_ID_LITTLE = id for little-endian (always defined) - @KWIML@_ABI_ENDIAN_ID = id of byte order of target CPU - Defined to @KWIML@_ABI_ENDIAN_ID_BIG or @KWIML@_ABI_ENDIAN_ID_LITTLE - unless byte order is unknown and error suppression macro - @KWIML@_ABI_NO_ERROR_ENDIAN was defined. - -We verify most results using dummy "extern" declarations that are -invalid if the macros are wrong. Verification is disabled if -suppression macro @KWIML@_ABI_NO_VERIFY was defined. -*/ - -/*--------------------------------------------------------------------------*/ -#if !defined(@KWIML@_ABI_SIZEOF_DATA_PTR) -# if defined(__SIZEOF_POINTER__) -# define @KWIML@_ABI_SIZEOF_DATA_PTR __SIZEOF_POINTER__ -# elif defined(_SIZE_PTR) -# define @KWIML@_ABI_SIZEOF_DATA_PTR (_SIZE_PTR >> 3) -# elif defined(_LP64) || defined(__LP64__) -# define @KWIML@_ABI_SIZEOF_DATA_PTR 8 -# elif defined(_ILP32) -# define @KWIML@_ABI_SIZEOF_DATA_PTR 4 -# elif defined(__64BIT__) /* IBM XL */ -# define @KWIML@_ABI_SIZEOF_DATA_PTR 8 -# elif defined(_M_X64) -# define @KWIML@_ABI_SIZEOF_DATA_PTR 8 -# elif defined(__ia64) -# define @KWIML@_ABI_SIZEOF_DATA_PTR 8 -# elif defined(__sparcv9) -# define @KWIML@_ABI_SIZEOF_DATA_PTR 8 -# elif defined(__x86_64) || defined(__x86_64__) -# define @KWIML@_ABI_SIZEOF_DATA_PTR 8 -# elif defined(__amd64) || defined(__amd64__) -# define @KWIML@_ABI_SIZEOF_DATA_PTR 8 -# elif defined(__i386) || defined(__i386__) -# define @KWIML@_ABI_SIZEOF_DATA_PTR 4 -# endif -#endif -#if !defined(@KWIML@_ABI_SIZEOF_DATA_PTR) -# define @KWIML@_ABI_SIZEOF_DATA_PTR 4 -#endif -#if !defined(@KWIML@_ABI_SIZEOF_CODE_PTR) -# define @KWIML@_ABI_SIZEOF_CODE_PTR @KWIML@_ABI_SIZEOF_DATA_PTR -#endif - -/*--------------------------------------------------------------------------*/ -#if !defined(@KWIML@_ABI_SIZEOF_CHAR) -# define @KWIML@_ABI_SIZEOF_CHAR 1 -#endif - -#if !defined(@KWIML@_ABI_CHAR_IS_UNSIGNED) && !defined(@KWIML@_ABI_CHAR_IS_SIGNED) -# if defined(__CHAR_UNSIGNED__) /* GNU, some IBM XL, others? */ -# define @KWIML@_ABI_CHAR_IS_UNSIGNED 1 -# elif defined(_CHAR_UNSIGNED) /* Intel, IBM XL, MSVC, Borland, others? */ -# define @KWIML@_ABI_CHAR_IS_UNSIGNED 1 -# elif defined(_CHAR_SIGNED) /* IBM XL, others? */ -# define @KWIML@_ABI_CHAR_IS_SIGNED 1 -# elif defined(__CHAR_SIGNED__) /* IBM XL, Watcom, others? */ -# define @KWIML@_ABI_CHAR_IS_SIGNED 1 -# elif defined(__SIGNED_CHARS__) /* EDG, Intel, SGI MIPSpro */ -# define @KWIML@_ABI_CHAR_IS_SIGNED 1 -# elif defined(_CHAR_IS_SIGNED) /* Some SunPro, others? */ -# define @KWIML@_ABI_CHAR_IS_SIGNED 1 -# elif defined(_CHAR_IS_UNSIGNED) /* SunPro, others? */ -# define @KWIML@_ABI_CHAR_IS_UNSIGNED 1 -# elif defined(__GNUC__) /* GNU default */ -# define @KWIML@_ABI_CHAR_IS_SIGNED 1 -# elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) /* SunPro default */ -# define @KWIML@_ABI_CHAR_IS_SIGNED 1 -# elif defined(__HP_cc) || defined(__HP_aCC) /* HP default (unless +uc) */ -# define @KWIML@_ABI_CHAR_IS_SIGNED 1 -# elif defined(_SGI_COMPILER_VERSION) /* SGI MIPSpro default */ -# define @KWIML@_ABI_CHAR_IS_UNSIGNED 1 -# elif defined(__PGIC__) /* PGI default */ -# define @KWIML@_ABI_CHAR_IS_SIGNED 1 -# elif defined(_MSC_VER) /* MSVC default */ -# define @KWIML@_ABI_CHAR_IS_SIGNED 1 -# elif defined(__WATCOMC__) /* Watcom default */ -# define @KWIML@_ABI_CHAR_IS_UNSIGNED 1 -# elif defined(__BORLANDC__) /* Borland default */ -# define @KWIML@_ABI_CHAR_IS_SIGNED 1 -# elif defined(__hpux) /* Old HP: no __HP_cc/__HP_aCC/__GNUC__ above */ -# define @KWIML@_ABI_CHAR_IS_SIGNED 1 /* (unless +uc) */ -# endif -#endif -#if !defined(@KWIML@_ABI_CHAR_IS_UNSIGNED) && !defined(@KWIML@_ABI_CHAR_IS_SIGNED) \ - && !defined(@KWIML@_ABI_NO_ERROR_CHAR_SIGN) -# error "Signedness of 'char' unknown." -#endif - -/*--------------------------------------------------------------------------*/ -#if !defined(@KWIML@_ABI_SIZEOF_SHORT) -# if defined(__SIZEOF_SHORT__) -# define @KWIML@_ABI_SIZEOF_SHORT __SIZEOF_SHORT__ -# endif -#endif -#if !defined(@KWIML@_ABI_SIZEOF_SHORT) -# define @KWIML@_ABI_SIZEOF_SHORT 2 -#endif - -/*--------------------------------------------------------------------------*/ -#if !defined(@KWIML@_ABI_SIZEOF_INT) -# if defined(__SIZEOF_INT__) -# define @KWIML@_ABI_SIZEOF_INT __SIZEOF_INT__ -# elif defined(_SIZE_INT) -# define @KWIML@_ABI_SIZEOF_INT (_SIZE_INT >> 3) -# endif -#endif -#if !defined(@KWIML@_ABI_SIZEOF_INT) -# define @KWIML@_ABI_SIZEOF_INT 4 -#endif - -/*--------------------------------------------------------------------------*/ -#if !defined(@KWIML@_ABI_SIZEOF_LONG) -# if defined(__SIZEOF_LONG__) -# define @KWIML@_ABI_SIZEOF_LONG __SIZEOF_LONG__ -# elif defined(_SIZE_LONG) -# define @KWIML@_ABI_SIZEOF_LONG (_SIZE_LONG >> 3) -# elif defined(__LONG_MAX__) -# if __LONG_MAX__ == 0x7fffffff -# define @KWIML@_ABI_SIZEOF_LONG 4 -# elif __LONG_MAX__>>32 == 0x7fffffff -# define @KWIML@_ABI_SIZEOF_LONG 8 -# endif -# elif defined(_MSC_VER) /* MSVC and Intel on Windows */ -# define @KWIML@_ABI_SIZEOF_LONG 4 -# endif -#endif -#if !defined(@KWIML@_ABI_SIZEOF_LONG) -# define @KWIML@_ABI_SIZEOF_LONG @KWIML@_ABI_SIZEOF_DATA_PTR -#endif - -/*--------------------------------------------------------------------------*/ -#if !defined(@KWIML@_ABI_SIZEOF_LONG_LONG) -# if defined(__SIZEOF_LONG_LONG__) -# define @KWIML@_ABI_SIZEOF_LONG_LONG __SIZEOF_LONG_LONG__ -# elif defined(__LONG_LONG_MAX__) -# if __LONG_LONG_MAX__ == 0x7fffffff -# define @KWIML@_ABI_SIZEOF_LONG_LONG 4 -# elif __LONG_LONG_MAX__>>32 == 0x7fffffff -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# endif -# endif -#endif -#if !defined(@KWIML@_ABI_SIZEOF_LONG_LONG) -# if defined(_LONGLONG) /* SGI, some GNU, perhaps others. */ \ - && !defined(_MSC_VER) -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# elif defined(_LONG_LONG) /* IBM XL, perhaps others. */ -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# elif defined(__NO_LONG_LONG) /* EDG */ -# define @KWIML@_ABI_SIZEOF_LONG_LONG 0 -# elif defined(__cplusplus) && __cplusplus > 199711L /* C++0x */ -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) /* SunPro */ -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# elif defined(__HP_cc) || defined(__HP_aCC) /* HP */ -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# elif defined(__PGIC__) /* PGI */ -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# elif defined(__WATCOMC__) /* Watcom */ -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# elif defined(__INTEL_COMPILER) /* Intel */ -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# elif defined(__BORLANDC__) /* Borland */ -# if __BORLANDC__ >= 0x0560 -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# else -# define @KWIML@_ABI_SIZEOF_LONG_LONG 0 -# endif -# elif defined(_MSC_VER) /* Microsoft */ -# if _MSC_VER >= 1310 -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# else -# define @KWIML@_ABI_SIZEOF_LONG_LONG 0 -# endif -# elif defined(__GNUC__) /* GNU */ -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# elif defined(__hpux) /* Old HP: no __HP_cc/__HP_aCC/__GNUC__ above */ -# define @KWIML@_ABI_SIZEOF_LONG_LONG 8 -# endif -#endif -#if !defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && !defined(@KWIML@_ABI_NO_ERROR_LONG_LONG) -# error "Existence of 'long long' unknown." -#endif - -/*--------------------------------------------------------------------------*/ -#if !defined(@KWIML@_ABI_SIZEOF___INT64) -# if defined(__INTEL_COMPILER) -# define @KWIML@_ABI_SIZEOF___INT64 8 -# elif defined(_MSC_VER) -# define @KWIML@_ABI_SIZEOF___INT64 8 -# elif defined(__BORLANDC__) -# define @KWIML@_ABI_SIZEOF___INT64 8 -# else -# define @KWIML@_ABI_SIZEOF___INT64 0 -# endif -#endif - -#if defined(@KWIML@_ABI_SIZEOF___INT64) && @KWIML@_ABI_SIZEOF___INT64 > 0 -# if @KWIML@_ABI_SIZEOF_LONG == 8 -# define @KWIML@_ABI___INT64_IS_LONG 1 -# elif defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG == 8 -# define @KWIML@_ABI___INT64_IS_LONG_LONG 1 -# else -# define @KWIML@_ABI___INT64_IS_UNIQUE 1 -# endif -#endif - -/*--------------------------------------------------------------------------*/ -#if !defined(@KWIML@_ABI_SIZEOF_FLOAT) -# if defined(__SIZEOF_FLOAT__) -# define @KWIML@_ABI_SIZEOF_FLOAT __SIZEOF_FLOAT__ -# endif -#endif -#if !defined(@KWIML@_ABI_SIZEOF_FLOAT) -# define @KWIML@_ABI_SIZEOF_FLOAT 4 -#endif - -/*--------------------------------------------------------------------------*/ -#if !defined(@KWIML@_ABI_SIZEOF_DOUBLE) -# if defined(__SIZEOF_DOUBLE__) -# define @KWIML@_ABI_SIZEOF_DOUBLE __SIZEOF_DOUBLE__ -# endif -#endif -#if !defined(@KWIML@_ABI_SIZEOF_DOUBLE) -# define @KWIML@_ABI_SIZEOF_DOUBLE 8 -#endif - -/*--------------------------------------------------------------------------*/ -/* Identify possible endian cases. The macro @KWIML@_ABI_ENDIAN_ID will be - defined to one of these, or undefined if unknown. */ -#if !defined(@KWIML@_ABI_ENDIAN_ID_BIG) -# define @KWIML@_ABI_ENDIAN_ID_BIG 4321 -#endif -#if !defined(@KWIML@_ABI_ENDIAN_ID_LITTLE) -# define @KWIML@_ABI_ENDIAN_ID_LITTLE 1234 -#endif -#if @KWIML@_ABI_ENDIAN_ID_BIG == @KWIML@_ABI_ENDIAN_ID_LITTLE -# error "@KWIML@_ABI_ENDIAN_ID_BIG == @KWIML@_ABI_ENDIAN_ID_LITTLE" -#endif - -#if defined(@KWIML@_ABI_ENDIAN_ID) /* Skip #elif cases if already defined. */ - -/* Use dedicated symbols if the compiler defines them. Do this first - because some architectures allow runtime byte order selection by - the operating system (values for such architectures below are - guesses for compilers that do not define a dedicated symbol). - Ensure that only one is defined in case the platform or a header - defines both as possible values for some third symbol. */ -#elif defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG -#elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE -#elif defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG -#elif defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE - -/* Alpha */ -#elif defined(__alpha) || defined(__alpha__) || defined(_M_ALPHA) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE - -/* Arm */ -#elif defined(__arm__) -# if !defined(__ARMEB__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE -# else -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG -# endif - -/* Intel x86 */ -#elif defined(__i386) || defined(__i386__) || defined(_M_IX86) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE -#elif defined(_X86_) || defined(__THW_INTEL__) || defined(__I86__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE -#elif defined(__MWERKS__) && defined(__INTEL__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE - -/* Intel x86-64 */ -#elif defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE -#elif defined(__amd64) || defined(__amd64__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE - -/* Intel Architecture-64 (Itanium) */ -#elif defined(__ia64) || defined(__ia64__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE -#elif defined(_IA64) || defined(__IA64__) || defined(_M_IA64) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE - -/* PowerPC */ -#elif defined(__powerpc) || defined(__powerpc__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG -#elif defined(__ppc) || defined(__ppc__) || defined(__POWERPC__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG - -/* SPARC */ -#elif defined(__sparc) || defined(__sparc__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG - -/* HP/PA RISC */ -#elif defined(__hppa) || defined(__hppa__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG - -/* Motorola 68k */ -#elif defined(__m68k__) || defined(M68000) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG - -/* MIPSel (MIPS little endian) */ -#elif defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE - -/* MIPSeb (MIPS big endian) */ -#elif defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG - -/* MIPS (fallback, big endian) */ -#elif defined(__mips) || defined(__mips__) || defined(__MIPS__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG - -/* NIOS2 */ -#elif defined(__NIOS2__) || defined(__NIOS2) || defined(__nios2__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE - -/* OpenRISC 1000 */ -#elif defined(__or1k__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG - -/* RS/6000 */ -#elif defined(__THW_RS600) || defined(_IBMR2) || defined(_POWER) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG -#elif defined(_ARCH_PWR) || defined(_ARCH_PWR2) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG - -/* System/370 */ -#elif defined(__370__) || defined(__THW_370__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG - -/* System/390 */ -#elif defined(__s390__) || defined(__s390x__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG - -/* z/Architecture */ -#elif defined(__SYSC_ZARCH__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG - -/* VAX */ -#elif defined(__vax__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG - -/* Aarch64 */ -#elif defined(__aarch64__) -# if !defined(__AARCH64EB__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE -# else -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG -# endif - -/* Xtensa */ -#elif defined(__XTENSA_EB__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG -#elif defined(__XTENSA_EL__) -# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE - -/* Unknown CPU */ -#elif !defined(@KWIML@_ABI_NO_ERROR_ENDIAN) -# error "Byte order of target CPU unknown." -#endif - -/*--------------------------------------------------------------------------*/ -#if !defined(@KWIML@_ABI_NO_VERIFY) -#define @KWIML@_ABI__VERIFY(n, x, y) extern int (*n)[x]; extern int (*n)[y] -#define @KWIML@_ABI__VERIFY2(n, x, y) extern int (*n)(x*); extern int (*n)(y*) -#if defined(__cplusplus) -# define @KWIML@_ABI__VERIFY3(n, x, y) extern int* n(x*); extern char* n(y*) -#else -# define @KWIML@_ABI__VERIFY3(n, x, y) extern int* n(x*) /* TODO: possible? */ -#endif -#define @KWIML@_ABI__VERIFY_BOOL(m, b) @KWIML@_ABI__VERIFY(m##__VERIFY__, 2, (b)?2:3) -#define @KWIML@_ABI__VERIFY_SIZE(m, t) @KWIML@_ABI__VERIFY(m##__VERIFY__, m, sizeof(t)) -#define @KWIML@_ABI__VERIFY_SAME(m, x, y) @KWIML@_ABI__VERIFY2(m##__VERIFY__, x, y) -#define @KWIML@_ABI__VERIFY_DIFF(m, x, y) @KWIML@_ABI__VERIFY3(m##__VERIFY__, x, y) - -@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_DATA_PTR, int*); -@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_CODE_PTR, int(*)(int)); -@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_CHAR, char); -@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_SHORT, short); -@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_INT, int); -@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_LONG, long); -#if defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG > 0 -@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_LONG_LONG, long long); -#endif -#if defined(@KWIML@_ABI_SIZEOF___INT64) && @KWIML@_ABI_SIZEOF___INT64 > 0 -@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF___INT64, __int64); -#endif -@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_FLOAT, float); -@KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_DOUBLE, double); - -#if defined(@KWIML@_ABI___INT64_IS_LONG) -@KWIML@_ABI__VERIFY_SAME(@KWIML@_ABI___INT64_IS_LONG, __int64, long); -#elif defined(@KWIML@_ABI___INT64_IS_LONG_LONG) -@KWIML@_ABI__VERIFY_SAME(@KWIML@_ABI___INT64_IS_LONG_LONG, __int64, long long); -#elif defined(@KWIML@_ABI_SIZEOF___INT64) && @KWIML@_ABI_SIZEOF___INT64 > 0 -@KWIML@_ABI__VERIFY_DIFF(@KWIML@_ABI___INT64_NOT_LONG, __int64, long); -# if defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG > 0 -@KWIML@_ABI__VERIFY_DIFF(@KWIML@_ABI___INT64_NOT_LONG_LONG, __int64, long long); -# endif -#endif - -#if defined(@KWIML@_ABI_CHAR_IS_UNSIGNED) -@KWIML@_ABI__VERIFY_BOOL(@KWIML@_ABI_CHAR_IS_UNSIGNED, (char)0x80 > 0); -#elif defined(@KWIML@_ABI_CHAR_IS_SIGNED) -@KWIML@_ABI__VERIFY_BOOL(@KWIML@_ABI_CHAR_IS_SIGNED, (char)0x80 < 0); -#endif - -#undef @KWIML@_ABI__VERIFY_DIFF -#undef @KWIML@_ABI__VERIFY_SAME -#undef @KWIML@_ABI__VERIFY_SIZE -#undef @KWIML@_ABI__VERIFY_BOOL -#undef @KWIML@_ABI__VERIFY3 -#undef @KWIML@_ABI__VERIFY2 -#undef @KWIML@_ABI__VERIFY - -#endif - -#endif diff --git a/Utilities/KWIML/CMakeLists.txt b/Utilities/KWIML/CMakeLists.txt deleted file mode 100644 index 62b6fffb7..000000000 --- a/Utilities/KWIML/CMakeLists.txt +++ /dev/null @@ -1,79 +0,0 @@ -#============================================================================= -# Kitware Information Macro Library -# Copyright 2010-2011 Kitware, Inc. -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= - -# Import the KWIML directory tree into a subdirectory under a parent -# project and configure the library as follows: -# -# set(KWIML myIML) -# subdirs(KWIML) -# -# Optional settings are as follows: -# -# KWIML_HEADER_ROOT = build tree directory to hold KWIML headers. -# Headers will go in a directory called "${KWIML}" under this root. -# For example: -# -# set(KWIML_HEADER_ROOT ${PROJECT_BINARY_DIR}) -# include_directories(${PROJECT_BINARY_DIR}) -# -# KWIML_INSTALL_INCLUDE_DIR = install KWIML with "make install" -# Specify a value relative to the install prefix and do NOT start with '/'. -# KWIML_INSTALL_INCLUDE_OPTIONS = extra header installation options -# Specify options for the install(FILES) command. -# -# KWIML_LABELS_TEST = list of labels for KWIML tests - -cmake_minimum_required(VERSION 2.6.3 FATAL_ERROR) - -#----------------------------------------------------------------------------- -if(NOT DEFINED KWIML) - if(NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") - message(FATAL_ERROR "Set KWIML namespace in parent directory!") - endif() - set(KWIML KWIML) - set(KWIML_STANDALONE 1) - project(KWIML) - include(CTest) - mark_as_advanced(BUILD_TESTING) -endif() - -#----------------------------------------------------------------------------- -get_property(KWIML_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) -foreach(lang ${KWIML_LANGUAGES}) - set(KWIML_LANGUAGE_${lang} 1) -endforeach() -if(NOT KWIML_LANGUAGE_C AND NOT KWIML_LANGUAGE_CXX) - set(BUILD_TESTING OFF) -endif() - -#----------------------------------------------------------------------------- -if(NOT KWIML_HEADER_ROOT) - set(KWIML_HEADER_ROOT "${PROJECT_BINARY_DIR}") -endif() -set(KWIML_HEADER_DIR "${KWIML_HEADER_ROOT}/${KWIML}") -include_directories(${KWIML_HEADER_ROOT}) - -#----------------------------------------------------------------------------- -foreach(h ABI INT) - set(header ${KWIML_HEADER_DIR}/${h}.h) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${h}.h.in ${header} @ONLY) - if(KWIML_INSTALL_INCLUDE_DIR) - install(FILES ${header} - DESTINATION ${KWIML_INSTALL_INCLUDE_DIR}/${KWIML} - ${KWIML_INSTALL_INCLUDE_OPTIONS}) - endif() -endforeach() - -#----------------------------------------------------------------------------- -if(BUILD_TESTING) - add_subdirectory(test) -endif() diff --git a/Utilities/KWIML/Copyright.txt b/Utilities/KWIML/Copyright.txt deleted file mode 100644 index c1e5ebc3f..000000000 --- a/Utilities/KWIML/Copyright.txt +++ /dev/null @@ -1,30 +0,0 @@ -Kitware Information Macro Library -Copyright 2010-2011 Kitware, Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -* Neither the name of Kitware, Inc. nor the names of its contributors - may be used to endorse or promote products derived from this - software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Utilities/KWIML/INT.h.in b/Utilities/KWIML/INT.h.in deleted file mode 100644 index d2eda6387..000000000 --- a/Utilities/KWIML/INT.h.in +++ /dev/null @@ -1,861 +0,0 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Kitware, Inc. nor the names of its contributors - may be used to endorse or promote products derived from this - software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -============================================================================*/ -#ifndef @KWIML@_INT_H -#define @KWIML@_INT_H -/* -This header defines macros with information about sized integer types. -Only information that can be determined using the preprocessor at -compilation time is available. No try-compile results may be added -here. Instead we memorize results on platforms of interest. - -An includer may optionally define the following macros to suppress errors: - -Input: - @KWIML@_INT_NO_VERIFY = skip verification declarations - @KWIML@_INT_NO_ERROR_INT64_T = type '@KWIML@_INT_int64_t' is optional (*) - @KWIML@_INT_NO_ERROR_UINT64_T = type '@KWIML@_INT_uint64_t' is optional (*) - @KWIML@_INT_NO_ERROR_INTPTR_T = type '@KWIML@_INT_intptr_t' is optional (*) - @KWIML@_INT_NO_ERROR_UINTPTR_T = type '@KWIML@_INT_uintptr_t' is optional (*) - -An includer may optionally define the following macros to override defaults. -Either way, an includer may test these macros after inclusion: - - @KWIML@_INT_HAVE_STDINT_H = include - @KWIML@_INT_NO_STDINT_H = do not include - @KWIML@_INT_HAVE_INTTYPES_H = include - @KWIML@_INT_NO_INTTYPES_H = do not include - -An includer may test the following macros after inclusion: - - @KWIML@_INT_HAVE_INT#_T = type 'int#_t' is available - @KWIML@_INT_HAVE_UINT#_T = type 'uint#_t' is available - # = 8, 16, 32, 64, PTR - - @KWIML@_INT_int#_t = signed integer type exactly # bits wide - @KWIML@_INT_uint#_t = unsigned integer type exactly # bits wide - # = 8, 16, 32, 64 (*), ptr (*) - - @KWIML@_INT_NO_INT64_T = type '@KWIML@_INT_int64_t' not available - @KWIML@_INT_NO_UINT64_T = type '@KWIML@_INT_uint64_t' not available - @KWIML@_INT_NO_INTPTR_T = type '@KWIML@_INT_intptr_t' not available - @KWIML@_INT_NO_UINTPTR_T = type '@KWIML@_INT_uintptr_t' not available - - @KWIML@_INT_INT#_C(c) = signed integer constant at least # bits wide - @KWIML@_INT_UINT#_C(c) = unsigned integer constant at least # bits wide - # = 8, 16, 32, 64 (*) - - @KWIML@_INT_# = print or scan format, in table below - # = 8, 16, 32, 64, PTR (*) - - signed unsigned - ----------- ------------------------------ - | decimal | decimal octal hexadecimal | - print | PRId PRIi | PRIu PRIo PRIx PRIX | - scan | SCNd SCNi | SCNu SCNo SCNx | - ----------- ------------------------------ - - The SCN*8 and SCN*64 format macros will not be defined on systems - with scanf implementations known not to support them. - - @KWIML@_INT_BROKEN_# = macro # is incorrect if defined - Some compilers define integer format macros incorrectly for their - own formatted print/scan implementations. - - @KWIML@_INT_BROKEN_INT#_C = macro INT#_C is incorrect if defined - @KWIML@_INT_BROKEN_UINT#_C = macro UINT#_C is incorrect if defined - Some compilers define integer constant macros incorrectly and - cannot handle literals as large as the integer type or even - produce bad preprocessor syntax. - - @KWIML@_INT_BROKEN_INT8_T = type 'int8_t' is available but incorrect - Some compilers have a flag to make 'char' (un)signed but do not account - for it while defining int8_t in the non-default case. - - The broken cases do not affect correctness of the macros documented above. -*/ - -#include "ABI.h" - -/*--------------------------------------------------------------------------*/ -#if defined(@KWIML@_INT_HAVE_STDINT_H) /* Already defined. */ -#elif defined(@KWIML@_INT_NO_STDINT_H) /* Already defined. */ -#elif defined(HAVE_STDINT_H) /* Optionally provided by includer. */ -# define @KWIML@_INT_HAVE_STDINT_H 1 -#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ -# define @KWIML@_INT_HAVE_STDINT_H 1 -#elif defined(_MSC_VER) /* MSVC */ -# if _MSC_VER >= 1600 -# define @KWIML@_INT_HAVE_STDINT_H 1 -# else -# define @KWIML@_INT_NO_STDINT_H 1 -# endif -#elif defined(__BORLANDC__) /* Borland */ -# if __BORLANDC__ >= 0x560 -# define @KWIML@_INT_HAVE_STDINT_H 1 -# else -# define @KWIML@_INT_NO_STDINT_H 1 -# endif -#elif defined(__WATCOMC__) /* Watcom */ -# define @KWIML@_INT_NO_STDINT_H 1 -#endif - -/*--------------------------------------------------------------------------*/ -#if defined(@KWIML@_INT_HAVE_INTTYPES_H) /* Already defined. */ -#elif defined(@KWIML@_INT_NO_INTTYPES_H) /* Already defined. */ -#elif defined(HAVE_INTTYPES_H) /* Optionally provided by includer. */ -# define @KWIML@_INT_HAVE_INTTYPES_H 1 -#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ -# define @KWIML@_INT_HAVE_INTTYPES_H 1 -#elif defined(_MSC_VER) /* MSVC */ -# define @KWIML@_INT_NO_INTTYPES_H 1 -#elif defined(__BORLANDC__) /* Borland */ -# define @KWIML@_INT_NO_INTTYPES_H 1 -#elif defined(__WATCOMC__) /* Watcom */ -# define @KWIML@_INT_NO_INTTYPES_H 1 -#else /* Assume it exists. */ -# define @KWIML@_INT_HAVE_INTTYPES_H 1 -#endif - -/*--------------------------------------------------------------------------*/ -#if defined(@KWIML@_INT_HAVE_STDINT_H) && defined(@KWIML@_INT_NO_STDINT_H) -# error "Both @KWIML@_INT_HAVE_STDINT_H and @KWIML@_INT_NO_STDINT_H defined!" -#endif -#if defined(@KWIML@_INT_HAVE_INTTYPES_H) && defined(@KWIML@_INT_NO_INTTYPES_H) -# error "Both @KWIML@_INT_HAVE_INTTYPES_H and @KWIML@_INT_NO_INTTYPES_H defined!" -#endif - -#if defined(@KWIML@_INT_HAVE_STDINT_H) -# include -#endif -#if defined(@KWIML@_INT_HAVE_INTTYPES_H) -# if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS) -# define __STDC_FORMAT_MACROS -# endif -# include -#endif - -#if defined(@KWIML@_INT_HAVE_STDINT_H) || defined(@KWIML@_INT_HAVE_INTTYPES_H) -#define @KWIML@_INT_HAVE_INT8_T 1 -#define @KWIML@_INT_HAVE_UINT8_T 1 -#define @KWIML@_INT_HAVE_INT16_T 1 -#define @KWIML@_INT_HAVE_UINT16_T 1 -#define @KWIML@_INT_HAVE_INT32_T 1 -#define @KWIML@_INT_HAVE_UINT32_T 1 -#define @KWIML@_INT_HAVE_INT64_T 1 -#define @KWIML@_INT_HAVE_UINT64_T 1 -#define @KWIML@_INT_HAVE_INTPTR_T 1 -#define @KWIML@_INT_HAVE_UINTPTR_T 1 -#endif - -#if defined(_AIX43) && !defined(_AIX50) && !defined(_AIX51) - /* AIX 4.3 defines these incorrectly with % and no quotes. */ -# define @KWIML@_INT_BROKEN_PRId8 -# define @KWIML@_INT_BROKEN_SCNd8 -# define @KWIML@_INT_BROKEN_PRIi8 -# define @KWIML@_INT_BROKEN_SCNi8 -# define @KWIML@_INT_BROKEN_PRIo8 -# define @KWIML@_INT_BROKEN_SCNo8 -# define @KWIML@_INT_BROKEN_PRIu8 -# define @KWIML@_INT_BROKEN_SCNu8 -# define @KWIML@_INT_BROKEN_PRIx8 -# define @KWIML@_INT_BROKEN_SCNx8 -# define @KWIML@_INT_BROKEN_PRIX8 -# define @KWIML@_INT_BROKEN_PRId16 -# define @KWIML@_INT_BROKEN_SCNd16 -# define @KWIML@_INT_BROKEN_PRIi16 -# define @KWIML@_INT_BROKEN_SCNi16 -# define @KWIML@_INT_BROKEN_PRIo16 -# define @KWIML@_INT_BROKEN_SCNo16 -# define @KWIML@_INT_BROKEN_PRIu16 -# define @KWIML@_INT_BROKEN_SCNu16 -# define @KWIML@_INT_BROKEN_PRIx16 -# define @KWIML@_INT_BROKEN_SCNx16 -# define @KWIML@_INT_BROKEN_PRIX16 -# define @KWIML@_INT_BROKEN_PRId32 -# define @KWIML@_INT_BROKEN_SCNd32 -# define @KWIML@_INT_BROKEN_PRIi32 -# define @KWIML@_INT_BROKEN_SCNi32 -# define @KWIML@_INT_BROKEN_PRIo32 -# define @KWIML@_INT_BROKEN_SCNo32 -# define @KWIML@_INT_BROKEN_PRIu32 -# define @KWIML@_INT_BROKEN_SCNu32 -# define @KWIML@_INT_BROKEN_PRIx32 -# define @KWIML@_INT_BROKEN_SCNx32 -# define @KWIML@_INT_BROKEN_PRIX32 -# define @KWIML@_INT_BROKEN_PRId64 -# define @KWIML@_INT_BROKEN_SCNd64 -# define @KWIML@_INT_BROKEN_PRIi64 -# define @KWIML@_INT_BROKEN_SCNi64 -# define @KWIML@_INT_BROKEN_PRIo64 -# define @KWIML@_INT_BROKEN_SCNo64 -# define @KWIML@_INT_BROKEN_PRIu64 -# define @KWIML@_INT_BROKEN_SCNu64 -# define @KWIML@_INT_BROKEN_PRIx64 -# define @KWIML@_INT_BROKEN_SCNx64 -# define @KWIML@_INT_BROKEN_PRIX64 -# define @KWIML@_INT_BROKEN_PRIdPTR -# define @KWIML@_INT_BROKEN_SCNdPTR -# define @KWIML@_INT_BROKEN_PRIiPTR -# define @KWIML@_INT_BROKEN_SCNiPTR -# define @KWIML@_INT_BROKEN_PRIoPTR -# define @KWIML@_INT_BROKEN_SCNoPTR -# define @KWIML@_INT_BROKEN_PRIuPTR -# define @KWIML@_INT_BROKEN_SCNuPTR -# define @KWIML@_INT_BROKEN_PRIxPTR -# define @KWIML@_INT_BROKEN_SCNxPTR -# define @KWIML@_INT_BROKEN_PRIXPTR -#endif - -#if (defined(__SUNPRO_C)||defined(__SUNPRO_CC)) && defined(_CHAR_IS_UNSIGNED) -# define @KWIML@_INT_BROKEN_INT8_T /* system type defined incorrectly */ -#elif defined(__BORLANDC__) && defined(_CHAR_UNSIGNED) -# define @KWIML@_INT_BROKEN_INT8_T /* system type defined incorrectly */ -#endif - -/*--------------------------------------------------------------------------*/ -#if defined(@KWIML@_INT_HAVE_INT8_T) && !defined(@KWIML@_INT_BROKEN_INT8_T) -# define @KWIML@_INT_int8_t int8_t -#else -# define @KWIML@_INT_int8_t signed char -#endif -#if defined(@KWIML@_INT_HAVE_UINT8_T) -# define @KWIML@_INT_uint8_t uint8_t -#else -# define @KWIML@_INT_uint8_t unsigned char -#endif - -#if defined(__INTEL_COMPILER) -# if defined(_WIN32) -# define @KWIML@_INT__NO_SCN8 -# endif -#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) -# define @KWIML@_INT__NO_SCN8 -#elif defined(__BORLANDC__) -# define @KWIML@_INT__NO_SCN8 -# define @KWIML@_INT__NO_SCN64 -#elif defined(_MSC_VER) -# define @KWIML@_INT__NO_SCN8 -#elif defined(__WATCOMC__) -# define @KWIML@_INT__NO_SCN8 -# elif defined(__hpux) /* HP runtime lacks support (any compiler) */ -# define @KWIML@_INT__NO_SCN8 -#endif - -/* 8-bit d, i */ -#if defined(@KWIML@_INT_HAVE_INT8_T) && defined(PRId8) \ - && !defined(@KWIML@_INT_BROKEN_PRId8) -# define @KWIML@_INT_PRId8 PRId8 -#else -# define @KWIML@_INT_PRId8 "d" -#endif -#if defined(@KWIML@_INT_HAVE_INT8_T) && defined(SCNd8) \ - && !defined(@KWIML@_INT_BROKEN_SCNd8) -# define @KWIML@_INT_SCNd8 SCNd8 -#elif !defined(@KWIML@_INT__NO_SCN8) -# define @KWIML@_INT_SCNd8 "hhd" -#endif -#if defined(@KWIML@_INT_HAVE_INT8_T) && defined(PRIi8) \ - && !defined(@KWIML@_INT_BROKEN_PRIi8) -# define @KWIML@_INT_PRIi8 PRIi8 -#else -# define @KWIML@_INT_PRIi8 "i" -#endif -#if defined(@KWIML@_INT_HAVE_INT8_T) && defined(SCNi8) \ - && !defined(@KWIML@_INT_BROKEN_SCNi8) -# define @KWIML@_INT_SCNi8 SCNi8 -#elif !defined(@KWIML@_INT__NO_SCN8) -# define @KWIML@_INT_SCNi8 "hhi" -#endif - -/* 8-bit o, u, x, X */ -#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(PRIo8) \ - && !defined(@KWIML@_INT_BROKEN_PRIo8) -# define @KWIML@_INT_PRIo8 PRIo8 -#else -# define @KWIML@_INT_PRIo8 "o" -#endif -#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(SCNo8) \ - && !defined(@KWIML@_INT_BROKEN_SCNo8) -# define @KWIML@_INT_SCNo8 SCNo8 -#elif !defined(@KWIML@_INT__NO_SCN8) -# define @KWIML@_INT_SCNo8 "hho" -#endif -#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(PRIu8) \ - && !defined(@KWIML@_INT_BROKEN_PRIu8) -# define @KWIML@_INT_PRIu8 PRIu8 -#else -# define @KWIML@_INT_PRIu8 "u" -#endif -#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(SCNu8) \ - && !defined(@KWIML@_INT_BROKEN_SCNu8) -# define @KWIML@_INT_SCNu8 SCNu8 -#elif !defined(@KWIML@_INT__NO_SCN8) -# define @KWIML@_INT_SCNu8 "hhu" -#endif -#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(PRIx8) \ - && !defined(@KWIML@_INT_BROKEN_PRIx8) -# define @KWIML@_INT_PRIx8 PRIx8 -#else -# define @KWIML@_INT_PRIx8 "x" -#endif -#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(SCNx8) \ - && !defined(@KWIML@_INT_BROKEN_SCNx8) -# define @KWIML@_INT_SCNx8 SCNx8 -#elif !defined(@KWIML@_INT__NO_SCN8) -# define @KWIML@_INT_SCNx8 "hhx" -#endif -#if defined(@KWIML@_INT_HAVE_UINT8_T) && defined(PRIX8) \ - && !defined(@KWIML@_INT_BROKEN_PRIX8) -# define @KWIML@_INT_PRIX8 PRIX8 -#else -# define @KWIML@_INT_PRIX8 "X" -#endif - -/* 8-bit constants */ -#if defined(INT8_C) && !defined(@KWIML@_INT_BROKEN_INT8_C) -# define @KWIML@_INT_INT8_C(c) INT8_C(c) -#else -# define @KWIML@_INT_INT8_C(c) c -#endif -#if defined(UINT8_C) && !defined(@KWIML@_INT_BROKEN_UINT8_C) -# define @KWIML@_INT_UINT8_C(c) UINT8_C(c) -#else -# define @KWIML@_INT_UINT8_C(c) c ## u -#endif - -/*--------------------------------------------------------------------------*/ -#if defined(@KWIML@_INT_HAVE_INT16_T) -# define @KWIML@_INT_int16_t int16_t -#else -# define @KWIML@_INT_int16_t signed short -#endif -#if defined(@KWIML@_INT_HAVE_UINT16_T) -# define @KWIML@_INT_uint16_t uint16_t -#else -# define @KWIML@_INT_uint16_t unsigned short -#endif - -/* 16-bit d, i */ -#if defined(@KWIML@_INT_HAVE_INT16_T) && defined(PRId16) \ - && !defined(@KWIML@_INT_BROKEN_PRId16) -# define @KWIML@_INT_PRId16 PRId16 -#else -# define @KWIML@_INT_PRId16 "d" -#endif -#if defined(@KWIML@_INT_HAVE_INT16_T) && defined(SCNd16) \ - && !defined(@KWIML@_INT_BROKEN_SCNd16) -# define @KWIML@_INT_SCNd16 SCNd16 -#else -# define @KWIML@_INT_SCNd16 "hd" -#endif -#if defined(@KWIML@_INT_HAVE_INT16_T) && defined(PRIi16) \ - && !defined(@KWIML@_INT_BROKEN_PRIi16) -# define @KWIML@_INT_PRIi16 PRIi16 -#else -# define @KWIML@_INT_PRIi16 "i" -#endif -#if defined(@KWIML@_INT_HAVE_INT16_T) && defined(SCNi16) \ - && !defined(@KWIML@_INT_BROKEN_SCNi16) -# define @KWIML@_INT_SCNi16 SCNi16 -#else -# define @KWIML@_INT_SCNi16 "hi" -#endif - -/* 16-bit o, u, x, X */ -#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(PRIo16) \ - && !defined(@KWIML@_INT_BROKEN_PRIo16) -# define @KWIML@_INT_PRIo16 PRIo16 -#else -# define @KWIML@_INT_PRIo16 "o" -#endif -#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(SCNo16) \ - && !defined(@KWIML@_INT_BROKEN_SCNo16) -# define @KWIML@_INT_SCNo16 SCNo16 -#else -# define @KWIML@_INT_SCNo16 "ho" -#endif -#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(PRIu16) \ - && !defined(@KWIML@_INT_BROKEN_PRIu16) -# define @KWIML@_INT_PRIu16 PRIu16 -#else -# define @KWIML@_INT_PRIu16 "u" -#endif -#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(SCNu16) \ - && !defined(@KWIML@_INT_BROKEN_SCNu16) -# define @KWIML@_INT_SCNu16 SCNu16 -#else -# define @KWIML@_INT_SCNu16 "hu" -#endif -#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(PRIx16) \ - && !defined(@KWIML@_INT_BROKEN_PRIx16) -# define @KWIML@_INT_PRIx16 PRIx16 -#else -# define @KWIML@_INT_PRIx16 "x" -#endif -#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(SCNx16) \ - && !defined(@KWIML@_INT_BROKEN_SCNx16) -# define @KWIML@_INT_SCNx16 SCNx16 -#else -# define @KWIML@_INT_SCNx16 "hx" -#endif -#if defined(@KWIML@_INT_HAVE_UINT16_T) && defined(PRIX16) \ - && !defined(@KWIML@_INT_BROKEN_PRIX16) -# define @KWIML@_INT_PRIX16 PRIX16 -#else -# define @KWIML@_INT_PRIX16 "X" -#endif - -/* 16-bit constants */ -#if defined(INT16_C) && !defined(@KWIML@_INT_BROKEN_INT16_C) -# define @KWIML@_INT_INT16_C(c) INT16_C(c) -#else -# define @KWIML@_INT_INT16_C(c) c -#endif -#if defined(UINT16_C) && !defined(@KWIML@_INT_BROKEN_UINT16_C) -# define @KWIML@_INT_UINT16_C(c) UINT16_C(c) -#else -# define @KWIML@_INT_UINT16_C(c) c ## u -#endif - -/*--------------------------------------------------------------------------*/ -#if defined(@KWIML@_INT_HAVE_INT32_T) -# define @KWIML@_INT_int32_t int32_t -#else -# define @KWIML@_INT_int32_t signed int -#endif -#if defined(@KWIML@_INT_HAVE_UINT32_T) -# define @KWIML@_INT_uint32_t uint32_t -#else -# define @KWIML@_INT_uint32_t unsigned int -#endif - -/* 32-bit d, i */ -#if defined(@KWIML@_INT_HAVE_INT32_T) && defined(PRId32) \ - && !defined(@KWIML@_INT_BROKEN_PRId32) -# define @KWIML@_INT_PRId32 PRId32 -#else -# define @KWIML@_INT_PRId32 "d" -#endif -#if defined(@KWIML@_INT_HAVE_INT32_T) && defined(SCNd32) \ - && !defined(@KWIML@_INT_BROKEN_SCNd32) -# define @KWIML@_INT_SCNd32 SCNd32 -#else -# define @KWIML@_INT_SCNd32 "d" -#endif -#if defined(@KWIML@_INT_HAVE_INT32_T) && defined(PRIi32) \ - && !defined(@KWIML@_INT_BROKEN_PRIi32) -# define @KWIML@_INT_PRIi32 PRIi32 -#else -# define @KWIML@_INT_PRIi32 "i" -#endif -#if defined(@KWIML@_INT_HAVE_INT32_T) && defined(SCNi32) \ - && !defined(@KWIML@_INT_BROKEN_SCNi32) -# define @KWIML@_INT_SCNi32 SCNi32 -#else -# define @KWIML@_INT_SCNi32 "i" -#endif - -/* 32-bit o, u, x, X */ -#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(PRIo32) \ - && !defined(@KWIML@_INT_BROKEN_PRIo32) -# define @KWIML@_INT_PRIo32 PRIo32 -#else -# define @KWIML@_INT_PRIo32 "o" -#endif -#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(SCNo32) \ - && !defined(@KWIML@_INT_BROKEN_SCNo32) -# define @KWIML@_INT_SCNo32 SCNo32 -#else -# define @KWIML@_INT_SCNo32 "o" -#endif -#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(PRIu32) \ - && !defined(@KWIML@_INT_BROKEN_PRIu32) -# define @KWIML@_INT_PRIu32 PRIu32 -#else -# define @KWIML@_INT_PRIu32 "u" -#endif -#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(SCNu32) \ - && !defined(@KWIML@_INT_BROKEN_SCNu32) -# define @KWIML@_INT_SCNu32 SCNu32 -#else -# define @KWIML@_INT_SCNu32 "u" -#endif -#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(PRIx32) \ - && !defined(@KWIML@_INT_BROKEN_PRIx32) -# define @KWIML@_INT_PRIx32 PRIx32 -#else -# define @KWIML@_INT_PRIx32 "x" -#endif -#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(SCNx32) \ - && !defined(@KWIML@_INT_BROKEN_SCNx32) -# define @KWIML@_INT_SCNx32 SCNx32 -#else -# define @KWIML@_INT_SCNx32 "x" -#endif -#if defined(@KWIML@_INT_HAVE_UINT32_T) && defined(PRIX32) \ - && !defined(@KWIML@_INT_BROKEN_PRIX32) -# define @KWIML@_INT_PRIX32 PRIX32 -#else -# define @KWIML@_INT_PRIX32 "X" -#endif - -#if defined(__hpux) && defined(__GNUC__) && !defined(__LP64__) \ - && defined(__CONCAT__) && defined(__CONCAT_U__) - /* Some HPs define UINT32_C incorrectly and break GNU. */ -# define @KWIML@_INT_BROKEN_UINT32_C -#endif - -/* 32-bit constants */ -#if defined(INT32_C) && !defined(@KWIML@_INT_BROKEN_INT32_C) -# define @KWIML@_INT_INT32_C(c) INT32_C(c) -#else -# define @KWIML@_INT_INT32_C(c) c -#endif -#if defined(UINT32_C) && !defined(@KWIML@_INT_BROKEN_UINT32_C) -# define @KWIML@_INT_UINT32_C(c) UINT32_C(c) -#else -# define @KWIML@_INT_UINT32_C(c) c ## u -#endif - -/*--------------------------------------------------------------------------*/ -#if defined(@KWIML@_INT_HAVE_INT64_T) -# define @KWIML@_INT_int64_t int64_t -#elif @KWIML@_ABI_SIZEOF_LONG == 8 -# define @KWIML@_INT_int64_t signed long -#elif defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG == 8 -# define @KWIML@_INT_int64_t signed long long -#elif defined(@KWIML@_ABI_SIZEOF___INT64) -# define @KWIML@_INT_int64_t signed __int64 -#elif defined(@KWIML@_INT_NO_ERROR_INT64_T) -# define @KWIML@_INT_NO_INT64_T -#else -# error "No type known for 'int64_t'." -#endif -#if defined(@KWIML@_INT_HAVE_UINT64_T) -# define @KWIML@_INT_uint64_t uint64_t -#elif @KWIML@_ABI_SIZEOF_LONG == 8 -# define @KWIML@_INT_uint64_t unsigned long -#elif defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG == 8 -# define @KWIML@_INT_uint64_t unsigned long long -#elif defined(@KWIML@_ABI_SIZEOF___INT64) -# define @KWIML@_INT_uint64_t unsigned __int64 -#elif defined(@KWIML@_INT_NO_ERROR_UINT64_T) -# define @KWIML@_INT_NO_UINT64_T -#else -# error "No type known for 'uint64_t'." -#endif - -#if defined(__INTEL_COMPILER) -#elif defined(__BORLANDC__) -# define @KWIML@_INT__NO_FMTLL /* type 'long long' but not 'll' format */ -# define @KWIML@_INT_BROKEN_INT64_C /* system macro defined incorrectly */ -# define @KWIML@_INT_BROKEN_UINT64_C /* system macro defined incorrectly */ -#elif defined(_MSC_VER) && _MSC_VER < 1400 -# define @KWIML@_INT__NO_FMTLL /* type 'long long' but not 'll' format */ -#endif - -#if @KWIML@_ABI_SIZEOF_LONG == 8 -# define @KWIML@_INT__FMT64 "l" -#elif defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG == 8 -# if !defined(@KWIML@_INT__NO_FMTLL) -# define @KWIML@_INT__FMT64 "ll" -# else -# define @KWIML@_INT__FMT64 "I64" -# endif -#elif defined(@KWIML@_ABI_SIZEOF___INT64) -# if defined(__BORLANDC__) -# define @KWIML@_INT__FMT64 "L" -# else -# define @KWIML@_INT__FMT64 "I64" -# endif -#endif - -/* 64-bit d, i */ -#if defined(@KWIML@_INT_HAVE_INT64_T) && defined(PRId64) \ - && !defined(@KWIML@_INT_BROKEN_PRId64) -# define @KWIML@_INT_PRId64 PRId64 -#elif defined(@KWIML@_INT__FMT64) -# define @KWIML@_INT_PRId64 @KWIML@_INT__FMT64 "d" -#endif -#if defined(@KWIML@_INT_HAVE_INT64_T) && defined(SCNd64) \ - && !defined(@KWIML@_INT_BROKEN_SCNd64) -# define @KWIML@_INT_SCNd64 SCNd64 -#elif defined(@KWIML@_INT__FMT64) && !defined(@KWIML@_INT__NO_SCN64) -# define @KWIML@_INT_SCNd64 @KWIML@_INT__FMT64 "d" -#endif -#if defined(@KWIML@_INT_HAVE_INT64_T) && defined(PRIi64) \ - && !defined(@KWIML@_INT_BROKEN_PRIi64) -# define @KWIML@_INT_PRIi64 PRIi64 -#elif defined(@KWIML@_INT__FMT64) -# define @KWIML@_INT_PRIi64 @KWIML@_INT__FMT64 "d" -#endif -#if defined(@KWIML@_INT_HAVE_INT64_T) && defined(SCNi64) \ - && !defined(@KWIML@_INT_BROKEN_SCNi64) -# define @KWIML@_INT_SCNi64 SCNi64 -#elif defined(@KWIML@_INT__FMT64) && !defined(@KWIML@_INT__NO_SCN64) -# define @KWIML@_INT_SCNi64 @KWIML@_INT__FMT64 "d" -#endif - -/* 64-bit o, u, x, X */ -#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(PRIo64) \ - && !defined(@KWIML@_INT_BROKEN_PRIo64) -# define @KWIML@_INT_PRIo64 PRIo64 -#elif defined(@KWIML@_INT__FMT64) -# define @KWIML@_INT_PRIo64 @KWIML@_INT__FMT64 "o" -#endif -#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(SCNo64) \ - && !defined(@KWIML@_INT_BROKEN_SCNo64) -# define @KWIML@_INT_SCNo64 SCNo64 -#elif defined(@KWIML@_INT__FMT64) && !defined(@KWIML@_INT__NO_SCN64) -# define @KWIML@_INT_SCNo64 @KWIML@_INT__FMT64 "o" -#endif -#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(PRIu64) \ - && !defined(@KWIML@_INT_BROKEN_PRIu64) -# define @KWIML@_INT_PRIu64 PRIu64 -#elif defined(@KWIML@_INT__FMT64) -# define @KWIML@_INT_PRIu64 @KWIML@_INT__FMT64 "u" -#endif -#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(SCNu64) \ - && !defined(@KWIML@_INT_BROKEN_SCNu64) -# define @KWIML@_INT_SCNu64 SCNu64 -#elif defined(@KWIML@_INT__FMT64) && !defined(@KWIML@_INT__NO_SCN64) -# define @KWIML@_INT_SCNu64 @KWIML@_INT__FMT64 "u" -#endif -#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(PRIx64) \ - && !defined(@KWIML@_INT_BROKEN_PRIx64) -# define @KWIML@_INT_PRIx64 PRIx64 -#elif defined(@KWIML@_INT__FMT64) -# define @KWIML@_INT_PRIx64 @KWIML@_INT__FMT64 "x" -#endif -#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(SCNx64) \ - && !defined(@KWIML@_INT_BROKEN_SCNx64) -# define @KWIML@_INT_SCNx64 SCNx64 -#elif defined(@KWIML@_INT__FMT64) && !defined(@KWIML@_INT__NO_SCN64) -# define @KWIML@_INT_SCNx64 @KWIML@_INT__FMT64 "x" -#endif -#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(PRIX64) \ - && !defined(@KWIML@_INT_BROKEN_PRIX64) -# define @KWIML@_INT_PRIX64 PRIX64 -#elif defined(@KWIML@_INT__FMT64) -# define @KWIML@_INT_PRIX64 @KWIML@_INT__FMT64 "X" -#endif - -/* 64-bit constants */ -#if defined(@KWIML@_INT_HAVE_INT64_T) && defined(INT64_C) \ - && !defined(@KWIML@_INT_BROKEN_INT64_C) -# define @KWIML@_INT_INT64_C(c) INT64_C(c) -#elif @KWIML@_ABI_SIZEOF_LONG == 8 -# define @KWIML@_INT_INT64_C(c) c ## l -#elif defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG == 8 -# define @KWIML@_INT_INT64_C(c) c ## ll -#elif defined(@KWIML@_ABI_SIZEOF___INT64) -# define @KWIML@_INT_INT64_C(c) c ## i64 -#endif -#if defined(@KWIML@_INT_HAVE_UINT64_T) && defined(UINT64_C) \ - && !defined(@KWIML@_INT_BROKEN_UINT64_C) -# define @KWIML@_INT_UINT64_C(c) UINT64_C(c) -#elif @KWIML@_ABI_SIZEOF_LONG == 8 -# define @KWIML@_INT_UINT64_C(c) c ## ul -#elif defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG == 8 -# define @KWIML@_INT_UINT64_C(c) c ## ull -#elif defined(@KWIML@_ABI_SIZEOF___INT64) -# define @KWIML@_INT_UINT64_C(c) c ## ui64 -#endif - -/*--------------------------------------------------------------------------*/ -#if defined(@KWIML@_INT_HAVE_INTPTR_T) -# define @KWIML@_INT_intptr_t intptr_t -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_intptr_t @KWIML@_INT_int32_t -#elif !defined(@KWIML@_INT_NO_INT64_T) -# define @KWIML@_INT_intptr_t @KWIML@_INT_int64_t -#elif defined(@KWIML@_INT_NO_ERROR_INTPTR_T) -# define @KWIML@_INT_NO_INTPTR_T -#else -# error "No type known for 'intptr_t'." -#endif -#if defined(@KWIML@_INT_HAVE_UINTPTR_T) -# define @KWIML@_INT_uintptr_t uintptr_t -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_uintptr_t @KWIML@_INT_uint32_t -#elif !defined(@KWIML@_INT_NO_UINT64_T) -# define @KWIML@_INT_uintptr_t @KWIML@_INT_uint64_t -#elif defined(@KWIML@_INT_NO_ERROR_UINTPTR_T) -# define @KWIML@_INT_NO_UINTPTR_T -#else -# error "No type known for 'uintptr_t'." -#endif - -#if defined(@KWIML@_INT_HAVE_INTPTR_T) && defined(PRIdPTR) \ - && !defined(@KWIML@_INT_BROKEN_PRIdPTR) -# define @KWIML@_INT_PRIdPTR PRIdPTR -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_PRIdPTR @KWIML@_INT_PRId32 -#elif !defined(@KWIML@_INT_NO_UINT64_T) -# define @KWIML@_INT_PRIdPTR @KWIML@_INT_PRId64 -#endif -#if defined(@KWIML@_INT_HAVE_INTPTR_T) && defined(SCNdPTR) \ - && !defined(@KWIML@_INT_BROKEN_SCNdPTR) -# define @KWIML@_INT_SCNdPTR SCNdPTR -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_SCNdPTR @KWIML@_INT_SCNd32 -#elif !defined(@KWIML@_INT_NO_UINT64_T) -# define @KWIML@_INT_SCNdPTR @KWIML@_INT_SCNd64 -#endif -#if defined(@KWIML@_INT_HAVE_INTPTR_T) && defined(PRIiPTR) \ - && !defined(@KWIML@_INT_BROKEN_PRIiPTR) -# define @KWIML@_INT_PRIiPTR PRIiPTR -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_PRIiPTR @KWIML@_INT_PRIi32 -#elif !defined(@KWIML@_INT_NO_UINT64_T) -# define @KWIML@_INT_PRIiPTR @KWIML@_INT_PRIi64 -#endif -#if defined(@KWIML@_INT_HAVE_INTPTR_T) && defined(SCNiPTR) \ - && !defined(@KWIML@_INT_BROKEN_SCNiPTR) -# define @KWIML@_INT_SCNiPTR SCNiPTR -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_SCNiPTR @KWIML@_INT_SCNi32 -#elif !defined(@KWIML@_INT_NO_UINT64_T) -# define @KWIML@_INT_SCNiPTR @KWIML@_INT_SCNi64 -#endif - -#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(PRIoPTR) \ - && !defined(@KWIML@_INT_BROKEN_PRIoPTR) -# define @KWIML@_INT_PRIoPTR PRIoPTR -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_PRIoPTR @KWIML@_INT_PRIo32 -#elif !defined(@KWIML@_INT_NO_UINT64_T) -# define @KWIML@_INT_PRIoPTR @KWIML@_INT_PRIo64 -#endif -#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(SCNoPTR) \ - && !defined(@KWIML@_INT_BROKEN_SCNoPTR) -# define @KWIML@_INT_SCNoPTR SCNoPTR -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_SCNoPTR @KWIML@_INT_SCNo32 -#elif !defined(@KWIML@_INT_NO_UINT64_T) -# define @KWIML@_INT_SCNoPTR @KWIML@_INT_SCNo64 -#endif -#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(PRIuPTR) \ - && !defined(@KWIML@_INT_BROKEN_PRIuPTR) -# define @KWIML@_INT_PRIuPTR PRIuPTR -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_PRIuPTR @KWIML@_INT_PRIu32 -#elif !defined(@KWIML@_INT_NO_UINT64_T) -# define @KWIML@_INT_PRIuPTR @KWIML@_INT_PRIu64 -#endif -#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(SCNuPTR) \ - && !defined(@KWIML@_INT_BROKEN_SCNuPTR) -# define @KWIML@_INT_SCNuPTR SCNuPTR -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_SCNuPTR @KWIML@_INT_SCNu32 -#elif !defined(@KWIML@_INT_NO_UINT64_T) -# define @KWIML@_INT_SCNuPTR @KWIML@_INT_SCNu64 -#endif -#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(PRIxPTR) \ - && !defined(@KWIML@_INT_BROKEN_PRIxPTR) -# define @KWIML@_INT_PRIxPTR PRIxPTR -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_PRIxPTR @KWIML@_INT_PRIx32 -#elif !defined(@KWIML@_INT_NO_UINT64_T) -# define @KWIML@_INT_PRIxPTR @KWIML@_INT_PRIx64 -#endif -#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(SCNxPTR) \ - && !defined(@KWIML@_INT_BROKEN_SCNxPTR) -# define @KWIML@_INT_SCNxPTR SCNxPTR -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_SCNxPTR @KWIML@_INT_SCNx32 -#elif !defined(@KWIML@_INT_NO_UINT64_T) -# define @KWIML@_INT_SCNxPTR @KWIML@_INT_SCNx64 -#endif -#if defined(@KWIML@_INT_HAVE_UINTPTR_T) && defined(PRIXPTR) \ - && !defined(@KWIML@_INT_BROKEN_PRIXPTR) -# define @KWIML@_INT_PRIXPTR PRIXPTR -#elif @KWIML@_ABI_SIZEOF_DATA_PTR == 4 -# define @KWIML@_INT_PRIXPTR @KWIML@_INT_PRIX32 -#elif !defined(@KWIML@_INT_NO_UINT64_T) -# define @KWIML@_INT_PRIXPTR @KWIML@_INT_PRIX64 -#endif - -/*--------------------------------------------------------------------------*/ -#if !defined(@KWIML@_INT_NO_VERIFY) -#define @KWIML@_INT__VERIFY(n, x, y) extern int (*n)[x]; extern int (*n)[y] -#define @KWIML@_INT__VERIFY_BOOL(m, b) @KWIML@_INT__VERIFY(m##__VERIFY__, 2, (b)?2:3) -#define @KWIML@_INT__VERIFY_TYPE(t, s) @KWIML@_INT__VERIFY(t##__VERIFY__, s, sizeof(t)) -#define @KWIML@_INT__VERIFY_SIGN(t, u, o) @KWIML@_INT__VERIFY_BOOL(t##__SIGN, (t)((u)1 << ((sizeof(t)<<3)-1)) o 0) - -@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_int8_t, 1); -@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_uint8_t, 1); -@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_int16_t, 2); -@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_uint16_t, 2); -@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_int32_t, 4); -@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_uint32_t, 4); -#if !defined(@KWIML@_INT_NO_INT64_T) -@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_int64_t, 8); -#endif -#if !defined(@KWIML@_INT_NO_UINT64_T) -@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_uint64_t, 8); -#endif -#if !defined(@KWIML@_INT_NO_INTPTR_T) -@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_intptr_t, sizeof(void*)); -#endif -#if !defined(@KWIML@_INT_NO_UINTPTR_T) -@KWIML@_INT__VERIFY_TYPE(@KWIML@_INT_uintptr_t, sizeof(void*)); -#endif - -@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_int8_t, @KWIML@_INT_uint8_t, <); -@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_uint8_t, @KWIML@_INT_uint8_t, >); -@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_int16_t, @KWIML@_INT_uint16_t, <); -@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_uint16_t, @KWIML@_INT_uint16_t, >); -@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_int32_t, @KWIML@_INT_uint32_t, <); -@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_uint32_t, @KWIML@_INT_uint32_t, >); -#if !defined(@KWIML@_INT_NO_INT64_T) -@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_int64_t, @KWIML@_INT_uint64_t, <); -#endif -#if !defined(@KWIML@_INT_NO_UINT64_T) -@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_uint64_t, @KWIML@_INT_uint64_t, >); -#endif -#if !defined(@KWIML@_INT_NO_INTPTR_T) -@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_intptr_t, @KWIML@_INT_uintptr_t, <); -#endif -#if !defined(@KWIML@_INT_NO_UINTPTR_T) -@KWIML@_INT__VERIFY_SIGN(@KWIML@_INT_uintptr_t, @KWIML@_INT_uintptr_t, >); -#endif - -#undef @KWIML@_INT__VERIFY_SIGN -#undef @KWIML@_INT__VERIFY_TYPE -#undef @KWIML@_INT__VERIFY_BOOL -#undef @KWIML@_INT__VERIFY - -#endif - -#endif diff --git a/Utilities/KWIML/README.txt b/Utilities/KWIML/README.txt deleted file mode 100644 index 6bdf859d9..000000000 --- a/Utilities/KWIML/README.txt +++ /dev/null @@ -1,29 +0,0 @@ -KWIML - The Kitware Information Macro Library - -KWIML provides header files that use preprocessor tests to detect and -provide information about the compiler and its target architecture. The -headers contain no configuration-time test results and thus may be -installed into an architecture-independent include directory. This -makes them suitable for use in the public interface of any package. - -This source tree is intended for distribution inside the source trees of -other packages. In order to avoid name collisions among multiple -packages the KWIML headers are configured with a per-package prefix on -both the header locations and the macros they define. See comments in -CMakeLists.txt for instructions to include KWIML inside another project. - -The entire KWIML source tree is distributed under the OSI-approved -3-clause BSD License. Files used only for build and test purposes -contain a copyright notice and reference Copyright.txt for details. -Headers meant for installation and distribution outside the source tree -come with full inlined copies of the copyright notice and license text. -This makes them suitable for distribution with any package under -compatible license terms. - -The following components are provided. See header comments for details: - - ABI.h = Fundamental type size and representation - INT.h = Fixed-size integer types and format specifiers - -The "test" subdirectory builds tests that verify correctness of the -information provided by each header. diff --git a/Utilities/KWIML/test/CMakeLists.txt b/Utilities/KWIML/test/CMakeLists.txt deleted file mode 100644 index a16b5cdda..000000000 --- a/Utilities/KWIML/test/CMakeLists.txt +++ /dev/null @@ -1,70 +0,0 @@ -#============================================================================= -# Kitware Information Macro Library -# Copyright 2010-2011 Kitware, Inc. -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= - -set(test_defs KWIML_NAMESPACE=${KWIML}) - -# Tell CMake how to follow dependencies of sources in this directory. -set_property(DIRECTORY - PROPERTY IMPLICIT_DEPENDS_INCLUDE_TRANSFORM - "KWIML_HEADER(%)=<${KWIML}/%>" - ) - -# Suppress printf/scanf format warnings; we test if the sizes match. -foreach(lang C CXX) - if(KWIML_LANGUAGE_${lang} AND CMAKE_${lang}_COMPILER_ID STREQUAL "GNU") - set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} -Wno-format") - endif() -endforeach() - -if(KWIML_LANGUAGE_C) - set(test_srcs test.c) -else() - set(test_srcs test.cxx) -endif() -if(KWIML_LANGUAGE_C) - list(APPEND test_defs KWIML_LANGUAGE_C) - list(APPEND test_srcs - test_ABI_C.c - test_INT_C.c - test_include_C.c - ) -endif() -if(KWIML_LANGUAGE_CXX) - list(APPEND test_defs KWIML_LANGUAGE_CXX) - list(APPEND test_srcs - test_ABI_CXX.cxx - test_INT_CXX.cxx - test_include_CXX.cxx - ) -endif() - -foreach(th test_ABI_endian test_INT_format) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${th}.h.in - ${CMAKE_CURRENT_BINARY_DIR}/${th}.h @ONLY) -endforeach() -include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) -add_executable(${KWIML}_test ${test_srcs}) -set_property(TARGET ${KWIML}_test PROPERTY COMPILE_DEFINITIONS ${test_defs}) -set_property(TARGET ${KWIML}_test PROPERTY - RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) -add_test(${KWIML}.test ${CMAKE_CURRENT_BINARY_DIR}/${KWIML}_test) -set_property(TEST ${KWIML}.test PROPERTY LABELS ${KWIML_LABELS_TEST}) - -# Xcode 2.x forgets to create the output directory before linking -# the individual architectures. -if(CMAKE_OSX_ARCHITECTURES AND XCODE - AND NOT "${XCODE_VERSION}" MATCHES "^[^12]") - add_custom_command( - TARGET ${KWIML}_test - PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}" - ) -endif() diff --git a/Utilities/KWIML/test/test.c b/Utilities/KWIML/test/test.c deleted file mode 100644 index 131c81f92..000000000 --- a/Utilities/KWIML/test/test.c +++ /dev/null @@ -1,39 +0,0 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#ifdef __cplusplus -extern "C" { -#endif -extern int test_ABI_C(void); -extern int test_INT_C(void); -extern int test_ABI_CXX(void); -extern int test_INT_CXX(void); -extern int test_include_C(void); -extern int test_include_CXX(void); -#ifdef __cplusplus -} // extern "C" -#endif - -int main(void) -{ - int result = 1; -#ifdef KWIML_LANGUAGE_C - result = test_ABI_C() && result; - result = test_INT_C() && result; - result = test_include_C() && result; -#endif -#ifdef KWIML_LANGUAGE_CXX - result = test_ABI_CXX() && result; - result = test_INT_CXX() && result; - result = test_include_CXX() && result; -#endif - return result? 0 : 1; -} diff --git a/Utilities/KWIML/test/test.cxx b/Utilities/KWIML/test/test.cxx deleted file mode 100644 index bf614218a..000000000 --- a/Utilities/KWIML/test/test.cxx +++ /dev/null @@ -1,12 +0,0 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include "test.c" diff --git a/Utilities/KWIML/test/test.h b/Utilities/KWIML/test/test.h deleted file mode 100644 index b87a0e7e9..000000000 --- a/Utilities/KWIML/test/test.h +++ /dev/null @@ -1,37 +0,0 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#ifndef KWIML_NAMESPACE -# error "Do not include test.h outside of KWIML test files." -#endif - -#ifndef KWIML_TEST_H -#define KWIML_TEST_H - -/* - Define KWIML_HEADER macro to help the test files include kwiml - headers from the configured namespace directory. The macro can be - used like this: - - #include KWIML_HEADER(ABI.h) -*/ -#define KWIML_HEADER(x) KWIML_HEADER0(KWIML_NAMESPACE/x) -#define KWIML_HEADER0(x) KWIML_HEADER1(x) -#define KWIML_HEADER1(x) - -/* Quiet MS standard library deprecation warnings. */ -#ifndef _CRT_SECURE_NO_DEPRECATE -# define _CRT_SECURE_NO_DEPRECATE -#endif - -#else -# error "test.h included multiple times." -#endif diff --git a/Utilities/KWIML/test/test_ABI_C.c b/Utilities/KWIML/test/test_ABI_C.c deleted file mode 100644 index 3ca4ad390..000000000 --- a/Utilities/KWIML/test/test_ABI_C.c +++ /dev/null @@ -1,22 +0,0 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include "test.h" -#include KWIML_HEADER(ABI.h) -#include "test_ABI_endian.h" -int test_ABI_C(void) -{ - if(!test_ABI_endian()) - { - return 0; - } - return 1; -} diff --git a/Utilities/KWIML/test/test_ABI_CXX.cxx b/Utilities/KWIML/test/test_ABI_CXX.cxx deleted file mode 100644 index 7ede20e09..000000000 --- a/Utilities/KWIML/test/test_ABI_CXX.cxx +++ /dev/null @@ -1,22 +0,0 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include "test.h" -#include KWIML_HEADER(ABI.h) -#include "test_ABI_endian.h" -extern "C" int test_ABI_CXX(void) -{ - if(!test_ABI_endian()) - { - return 0; - } - return 1; -} diff --git a/Utilities/KWIML/test/test_ABI_endian.h.in b/Utilities/KWIML/test/test_ABI_endian.h.in deleted file mode 100644 index 992baeaeb..000000000 --- a/Utilities/KWIML/test/test_ABI_endian.h.in +++ /dev/null @@ -1,47 +0,0 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include - -#ifdef __cplusplus -# define LANG "C++ " -#else -# define LANG "C " -#endif - -static int test_ABI_endian(void) -{ - int result = 1; - { -#if defined(@KWIML@_ABI_ENDIAN_ID) - int expect; - union { short s; unsigned char c[sizeof(short)]; } x; - x.s = 1; - expect = (x.c[0] == 1 ? - @KWIML@_ABI_ENDIAN_ID_LITTLE : @KWIML@_ABI_ENDIAN_ID_BIG); - printf(LANG "@KWIML@_ABI_ENDIAN_ID: expected [%d], got [%d]", - expect, @KWIML@_ABI_ENDIAN_ID); - if(@KWIML@_ABI_ENDIAN_ID == expect) - { - printf(", PASSED\n"); - } - else - { - printf(", FAILED\n"); - result = 0; - } -#else - printf(LANG "@KWIML@_ABI_ENDIAN_ID: unknown, FAILED\n"); - result = 0; -#endif - } - return result; -} diff --git a/Utilities/KWIML/test/test_INT_C.c b/Utilities/KWIML/test/test_INT_C.c deleted file mode 100644 index 5513a0bd8..000000000 --- a/Utilities/KWIML/test/test_INT_C.c +++ /dev/null @@ -1,22 +0,0 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include "test.h" -#include KWIML_HEADER(INT.h) -#include "test_INT_format.h" -int test_INT_C(void) -{ - if(!test_INT_format()) - { - return 0; - } - return 1; -} diff --git a/Utilities/KWIML/test/test_INT_CXX.cxx b/Utilities/KWIML/test/test_INT_CXX.cxx deleted file mode 100644 index 9f74e9680..000000000 --- a/Utilities/KWIML/test/test_INT_CXX.cxx +++ /dev/null @@ -1,22 +0,0 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include "test.h" -#include KWIML_HEADER(INT.h) -#include "test_INT_format.h" -extern "C" int test_INT_CXX(void) -{ - if(!test_INT_format()) - { - return 0; - } - return 1; -} diff --git a/Utilities/KWIML/test/test_INT_format.h.in b/Utilities/KWIML/test/test_INT_format.h.in deleted file mode 100644 index 71b443d6e..000000000 --- a/Utilities/KWIML/test/test_INT_format.h.in +++ /dev/null @@ -1,200 +0,0 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include -#include - -#ifdef __cplusplus -# define LANG "C++ " -#else -# define LANG "C " -#endif - -#define VALUE(T, U) (T)((U)0xab << ((sizeof(T)-1)<<3)) - -#define TEST_C_(C, V, PRI, T, U) \ - { \ - T const x = VALUE(T, U); \ - T y = C(V); \ - printf(LANG #C ":" \ - " expression [%" @KWIML@_INT_PRI##PRI "]," \ - " literal [%" @KWIML@_INT_PRI##PRI "]", x, y); \ - if(x == y) \ - { \ - printf(", PASSED\n"); \ - } \ - else \ - { \ - printf(", FAILED\n"); \ - result = 0; \ - } \ - } - -#define TEST_PRI_(PRI, T, U, STR) \ - { \ - T const x = VALUE(T, U); \ - char const* str = STR; \ - sprintf(buf, "%" @KWIML@_INT_PRI##PRI, x); \ - printf(LANG "@KWIML@_INT_PRI" #PRI ":" \ - " expected [%s], got [%s]", str, buf); \ - if(strcmp(str, buf) == 0) \ - { \ - printf(", PASSED\n"); \ - } \ - else \ - { \ - printf(", FAILED\n"); \ - result = 0; \ - } \ - } - -#define TEST_SCN_(SCN, T, U, STR) TEST_SCN2_(SCN, SCN, T, U, STR) -#define TEST_SCN2_(PRI, SCN, T, U, STR) \ - { \ - T const x = VALUE(T, U); \ - T y; \ - char const* str = STR; \ - if(sscanf(str, "%" @KWIML@_INT_SCN##SCN, &y) != 1) \ - { \ - y = 0; \ - } \ - printf(LANG "@KWIML@_INT_SCN" #SCN ":" \ - " expected [%" @KWIML@_INT_PRI##PRI "]," \ - " got [%" @KWIML@_INT_PRI##PRI "]", x, y); \ - if(x == y) \ - { \ - printf(", PASSED\n"); \ - } \ - else \ - { \ - printf(", FAILED\n"); \ - result = 0; \ - } \ - } - -#define TEST_(FMT, T, U, STR) TEST2_(FMT, FMT, T, U, STR) -#define TEST2_(PRI, SCN, T, U, STR) \ - TEST_PRI_(PRI, T, U, STR) \ - TEST_SCN2_(PRI, SCN, T, U, STR) - -/* Concatenate T and U now to avoid expanding them. */ -#define TEST(FMT, T, U, STR) \ - TEST_(FMT, @KWIML@_INT_##T, @KWIML@_INT_##U, STR) -#define TEST2(PRI, SCN, T, U, STR) \ - TEST2_(PRI, SCN, @KWIML@_INT_##T, @KWIML@_INT_##U, STR) -#define TEST_C(C, V, PRI, T, U) \ - TEST_C_(@KWIML@_INT_##C, V, PRI, @KWIML@_INT_##T, @KWIML@_INT_##U) -#define TEST_PRI(PRI, T, U, STR) \ - TEST_PRI_(PRI, @KWIML@_INT_##T, @KWIML@_INT_##U, STR) -#define TEST_SCN(SCN, T, U, STR) \ - TEST_SCN_(SCN, @KWIML@_INT_##T, @KWIML@_INT_##U, STR) -#define TEST_SCN2(PRI, SCN, T, U, STR) \ - TEST_SCN2_(PRI, SCN, @KWIML@_INT_##T, @KWIML@_INT_##U, STR) - -static int test_INT_format(void) -{ - int result = 1; - char buf[256]; - TEST_PRI(i8, int8_t, uint8_t, "-85") -#if defined(@KWIML@_INT_SCNi8) - TEST_SCN(i8, int8_t, uint8_t, "-85") -#endif - TEST_PRI(d8, int8_t, uint8_t, "-85") -#if defined(@KWIML@_INT_SCNd8) - TEST_SCN(d8, int8_t, uint8_t, "-85") -#endif - TEST_PRI(o8, uint8_t, uint8_t, "253") -#if defined(@KWIML@_INT_SCNo8) - TEST_SCN(o8, uint8_t, uint8_t, "253") -#endif - TEST_PRI(u8, uint8_t, uint8_t, "171") -#if defined(@KWIML@_INT_SCNu8) - TEST_SCN(u8, uint8_t, uint8_t, "171") -#endif - TEST_PRI(x8, uint8_t, uint8_t, "ab") - TEST_PRI(X8, uint8_t, uint8_t, "AB") -#if defined(@KWIML@_INT_SCNx8) - TEST_SCN(x8, uint8_t, uint8_t, "ab") - TEST_SCN2(X8, x8, uint8_t, uint8_t, "AB") -#endif - - TEST(i16, int16_t, uint16_t, "-21760") - TEST(d16, int16_t, uint16_t, "-21760") - TEST(o16, uint16_t, uint16_t, "125400") - TEST(u16, uint16_t, uint16_t, "43776") - TEST(x16, uint16_t, uint16_t, "ab00") - TEST2(X16, x16, uint16_t, uint16_t, "AB00") - - TEST(i32, int32_t, uint32_t, "-1426063360") - TEST(d32, int32_t, uint32_t, "-1426063360") - TEST(o32, uint32_t, uint32_t, "25300000000") - TEST(u32, uint32_t, uint32_t, "2868903936") - TEST(x32, uint32_t, uint32_t, "ab000000") - TEST2(X32, x32, uint32_t, uint32_t, "AB000000") - - TEST_PRI(i64, int64_t, uint64_t, "-6124895493223874560") -#if defined(@KWIML@_INT_SCNi64) - TEST_SCN(i64, int64_t, uint64_t, "-6124895493223874560") -#endif - TEST_PRI(d64, int64_t, uint64_t, "-6124895493223874560") -#if defined(@KWIML@_INT_SCNd64) - TEST_SCN(d64, int64_t, uint64_t, "-6124895493223874560") -#endif - TEST_PRI(o64, uint64_t, uint64_t, "1254000000000000000000") -#if defined(@KWIML@_INT_SCNo64) - TEST_SCN(o64, uint64_t, uint64_t, "1254000000000000000000") -#endif - TEST_PRI(u64, uint64_t, uint64_t, "12321848580485677056") -#if defined(@KWIML@_INT_SCNu64) - TEST_SCN(u64, uint64_t, uint64_t, "12321848580485677056") -#endif - TEST_PRI(x64, uint64_t, uint64_t, "ab00000000000000") - TEST_PRI(X64, uint64_t, uint64_t, "AB00000000000000") -#if defined(@KWIML@_INT_SCNx64) - TEST_SCN(x64, uint64_t, uint64_t, "ab00000000000000") - TEST_SCN2(X64, x64, uint64_t, uint64_t, "AB00000000000000") -#endif - -#if !defined(@KWIML@_INT_NO_INTPTR_T) -# if @KWIML@_ABI_SIZEOF_DATA_PTR == 4 - TEST(iPTR, intptr_t, uint32_t, "-1426063360") - TEST(dPTR, intptr_t, uint32_t, "-1426063360") -# else - TEST(iPTR, intptr_t, uint64_t, "-6124895493223874560") - TEST(dPTR, intptr_t, uint64_t, "-6124895493223874560") -# endif -#endif - -#if !defined(@KWIML@_INT_NO_UINTPTR_T) -# if @KWIML@_ABI_SIZEOF_DATA_PTR == 4 - TEST(oPTR, uintptr_t, uintptr_t, "25300000000") - TEST(uPTR, uintptr_t, uintptr_t, "2868903936") - TEST(xPTR, uintptr_t, uintptr_t, "ab000000") - TEST2(XPTR, xPTR, uintptr_t, uintptr_t, "AB000000") -# else - TEST(oPTR, uintptr_t, uintptr_t, "1254000000000000000000") - TEST(uPTR, uintptr_t, uintptr_t, "12321848580485677056") - TEST(xPTR, uintptr_t, uintptr_t, "ab00000000000000") - TEST2(XPTR, xPTR, uintptr_t, uintptr_t, "AB00000000000000") -# endif -#endif - - TEST_C(INT8_C, -0x55, i8, int8_t, uint8_t) - TEST_C(UINT8_C, 0xAB, u8, uint8_t, uint8_t) - TEST_C(INT16_C, -0x5500, i16, int16_t, uint16_t) - TEST_C(UINT16_C, 0xAB00, u16, uint16_t, uint16_t) - TEST_C(INT32_C, -0x55000000, i32, int32_t, uint32_t) - TEST_C(UINT32_C, 0xAB000000, u32, uint32_t, uint32_t) - TEST_C(INT64_C, -0x5500000000000000, i64, int64_t, uint64_t) - TEST_C(UINT64_C, 0xAB00000000000000, u64, uint64_t, uint64_t) - - return result; -} diff --git a/Utilities/KWIML/test/test_include_C.c b/Utilities/KWIML/test/test_include_C.c deleted file mode 100644 index fb3e4cf7f..000000000 --- a/Utilities/KWIML/test/test_include_C.c +++ /dev/null @@ -1,22 +0,0 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include - -/* Test KWIML header inclusion after above system headers. */ -#include "test.h" -#include KWIML_HEADER(ABI.h) -#include KWIML_HEADER(INT.h) - -int test_include_C(void) -{ - return 1; -} diff --git a/Utilities/KWIML/test/test_include_CXX.cxx b/Utilities/KWIML/test/test_include_CXX.cxx deleted file mode 100644 index 111311a84..000000000 --- a/Utilities/KWIML/test/test_include_CXX.cxx +++ /dev/null @@ -1,28 +0,0 @@ -/*============================================================================ - Kitware Information Macro Library - Copyright 2010-2011 Kitware, Inc. - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include - -#if defined(_MSC_VER) && defined(NDEBUG) -// Use C++ runtime to avoid linker warning: -// warning LNK4089: all references to 'MSVCP71.dll' discarded by /OPT:REF -std::string test_include_CXX_use_stl_string; -#endif - -/* Test KWIML header inclusion after above system headers. */ -#include "test.h" -#include KWIML_HEADER(ABI.h) -#include KWIML_HEADER(INT.h) - -extern "C" int test_include_CXX(void) -{ - return 1; -} From 55b21d072e2df9a35a354fd33e8cf2d0c3bd22be Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 17 Dec 2015 14:56:31 -0500 Subject: [PATCH 080/255] Add script to update KWIML from upstream --- Utilities/Scripts/update-kwiml.bash | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 Utilities/Scripts/update-kwiml.bash diff --git a/Utilities/Scripts/update-kwiml.bash b/Utilities/Scripts/update-kwiml.bash new file mode 100755 index 000000000..5c0d1922a --- /dev/null +++ b/Utilities/Scripts/update-kwiml.bash @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +set -e +set -x +shopt -s dotglob + +readonly name="KWIML" +readonly ownership="KWIML Upstream " +readonly subtree="Utilities/KWIML" +readonly repo="https://github.com/Kitware/KWIML.git" +readonly tag="master" +readonly shortlog=true +readonly paths=" +" + +extract_source () { + git_archive +} + +. "${BASH_SOURCE%/*}/update-third-party.bash" From 3fdbb0a806f67f10ea8428e03a4523d08d2b083c Mon Sep 17 00:00:00 2001 From: KWIML Upstream Date: Wed, 9 Dec 2015 13:31:42 -0500 Subject: [PATCH 081/255] KWIML 2015-12-09 (43f9f8d0) Code extracted from: https://github.com/Kitware/KWIML.git at commit 43f9f8d0b0c8ee62aa056a2020981a6d98a40dd4 (master). --- .gitattributes | 1 + CMakeLists.txt | 104 ++++ Copyright.txt | 30 ++ README.md | 36 ++ include/kwiml/abi.h | 562 +++++++++++++++++++ include/kwiml/int.h | 1069 +++++++++++++++++++++++++++++++++++++ src/kwiml-config.cmake.in | 1 + src/version.h.in | 59 ++ test/CMakeLists.txt | 54 ++ test/test.c | 33 ++ test/test.cxx | 6 + test/test.h | 16 + test/test_abi_C.c | 19 + test/test_abi_CXX.cxx | 19 + test/test_abi_endian.h | 41 ++ test/test_include_C.c | 16 + test/test_include_CXX.cxx | 22 + test/test_int_C.c | 19 + test/test_int_CXX.cxx | 19 + test/test_int_format.h | 203 +++++++ 20 files changed, 2329 insertions(+) create mode 100644 .gitattributes create mode 100644 CMakeLists.txt create mode 100644 Copyright.txt create mode 100644 README.md create mode 100644 include/kwiml/abi.h create mode 100644 include/kwiml/int.h create mode 100644 src/kwiml-config.cmake.in create mode 100644 src/version.h.in create mode 100644 test/CMakeLists.txt create mode 100644 test/test.c create mode 100644 test/test.cxx create mode 100644 test/test.h create mode 100644 test/test_abi_C.c create mode 100644 test/test_abi_CXX.cxx create mode 100644 test/test_abi_endian.h create mode 100644 test/test_include_C.c create mode 100644 test/test_include_CXX.cxx create mode 100644 test/test_int_C.c create mode 100644 test/test_int_CXX.cxx create mode 100644 test/test_int_format.h diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..ecbf2196c --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.md conflict-marker-size=78 diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..15e65e5c7 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,104 @@ +# +# Copyright Kitware, Inc. +# Distributed under the OSI-approved BSD 3-Clause License. +# See accompanying file Copyright.txt for details. +# +if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") + cmake_minimum_required(VERSION 3.0 FATAL_ERROR) + set(kwiml_standalone 1) + project(KWIML) + include(CTest) + mark_as_advanced(BUILD_TESTING) + if(BUILD_TESTING) + set(KWIML_TEST_ENABLE 1) + endif() + if(NOT DEFINED KWIML_INSTALL_INCLUDE_DIR) + set(KWIML_INSTALL_INCLUDE_DIR include) + endif() + set(KWIML_INCLUDE_PREFIX kwiml) +else() + cmake_minimum_required(VERSION 2.8.2 FATAL_ERROR) + set(kwiml_standalone 0) + if(KWIML_INSTALL_INCLUDE_DIR AND NOT DEFINED KWIML_INCLUDE_PREFIX) + message(FATAL_ERROR "Host project must set KWIML_INCLUDE_PREFIX") + endif() +endif() + +get_property(KWIML_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) +foreach(lang ${KWIML_LANGUAGES}) + set(KWIML_LANGUAGE_${lang} 1) +endforeach() +if(NOT KWIML_LANGUAGE_C AND NOT KWIML_LANGUAGE_CXX) + set(BUILD_TESTING OFF) +endif() + +if(KWIML_INSTALL_INCLUDE_DIR) + install(FILES + include/kwiml/abi.h + include/kwiml/int.h + DESTINATION ${KWIML_INSTALL_INCLUDE_DIR}/${KWIML_INCLUDE_PREFIX} + ${KWIML_INSTALL_INCLUDE_OPTIONS} + ) +endif() + +if(KWIML_TEST_ENABLE) + add_subdirectory(test) +endif() + +if(NOT kwiml_standalone) + return() +endif() + +#---------------------------------------------------------------------------- +set(KWIML_VERSION 1.0.0) +if(KWIML_VERSION MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+)") + set(KWIML_VERSION_MAJOR "${CMAKE_MATCH_1}") + set(KWIML_VERSION_MINOR "${CMAKE_MATCH_2}") + set(KWIML_VERSION_PATCH "${CMAKE_MATCH_3}") + math(EXPR KWIML_VERSION_DECIMAL + "${KWIML_VERSION_MAJOR}*1000000 + ${KWIML_VERSION_MINOR}*1000 + ${KWIML_VERSION_PATCH}") +else() + message(FATAL_ERROR "Failed to parse KWIML_VERSION='${KWIML_VERSION}'") +endif() + +configure_file(src/version.h.in include/kwiml/version.h @ONLY) +install(FILES + ${CMAKE_CURRENT_BINARY_DIR}/include/kwiml/version.h + DESTINATION ${KWIML_INSTALL_INCLUDE_DIR}/kwiml + ) + +if(NOT KWIML_INSTALL_PACKAGE_DIR) + set(KWIML_INSTALL_PACKAGE_DIR share/cmake/kwiml-${KWIML_VERSION_MAJOR}.${KWIML_VERSION_MINOR}) +endif() + +add_library(kwiml INTERFACE) +target_include_directories(kwiml INTERFACE + $/${KWIML_INSTALL_INCLUDE_DIR}> + $ + $ + ) +export(TARGETS kwiml + NAMESPACE kwiml:: + FILE kwiml-targets.cmake + ) +install(TARGETS kwiml + DESTINATION lib + EXPORT kwiml-targets + ) +install(EXPORT kwiml-targets + NAMESPACE kwiml:: + DESTINATION ${KWIML_INSTALL_PACKAGE_DIR} + ) + +configure_file(src/kwiml-config.cmake.in kwiml-config.cmake @ONLY) +include(CMakePackageConfigHelpers) +write_basic_package_version_file( + "${CMAKE_CURRENT_BINARY_DIR}/kwiml-config-version.cmake" + VERSION ${KWIML_VERSION} + COMPATIBILITY AnyNewerVersion + ) +install(FILES + ${CMAKE_CURRENT_BINARY_DIR}/kwiml-config.cmake + ${CMAKE_CURRENT_BINARY_DIR}/kwiml-config-version.cmake + DESTINATION ${KWIML_INSTALL_PACKAGE_DIR} + ) diff --git a/Copyright.txt b/Copyright.txt new file mode 100644 index 000000000..a6204b0c2 --- /dev/null +++ b/Copyright.txt @@ -0,0 +1,30 @@ +Kitware Information Macro Library +Copyright 2010-2015 Kitware, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +* Neither the name of Kitware, Inc. nor the names of its contributors + may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md new file mode 100644 index 000000000..37d72d1b1 --- /dev/null +++ b/README.md @@ -0,0 +1,36 @@ +Kitware Information Macro Library (KWIML) +========================================= + +KWIML provides header files that use preprocessor tests to detect and +provide information about the compiler and its target architecture. +The headers contain no configuration-time test results and thus may +be installed into an architecture-independent include directory. +This makes them suitable for use in the public interface of any package. + +The following headers are provided. See header comments for details: + +* [kwiml/abi.h][]: Fundamental type size and representation. + +* [kwiml/int.h][]: Fixed-size integer types and format specifiers. + +* [kwiml/version.h][]: Information about this version of KWIML. + +The [test][] subdirectory builds tests that verify correctness of the +information provided by each header. + +License +======= + +KWIML is distributed under the OSI-approved 3-clause BSD License. + +Files used only for build and test purposes contain a copyright notice and +reference [Copyright.txt][] for details. Headers meant for installation and +distribution outside the source tree come with full inlined copies of the +copyright notice and license text. This makes them suitable for distribution +with any package under compatible license terms. + +[Copyright.txt]: Copyright.txt +[kwiml/abi.h]: include/kwiml/abi.h +[kwiml/int.h]: include/kwiml/int.h +[kwiml/version.h]: src/version.h.in +[test]: test/ diff --git a/include/kwiml/abi.h b/include/kwiml/abi.h new file mode 100644 index 000000000..362636165 --- /dev/null +++ b/include/kwiml/abi.h @@ -0,0 +1,562 @@ +/*============================================================================ + Kitware Information Macro Library + Copyright 2010-2015 Kitware, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Kitware, Inc. nor the names of its contributors + may be used to endorse or promote products derived from this + software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +============================================================================*/ +/* +This header defines macros with information about the C ABI. +Only information that can be determined using the preprocessor at +compilation time is available. No try-compile results may be added +here. Instead we memorize results on platforms of interest. + +An includer may optionally define the following macros to suppress errors: + + KWIML_ABI_NO_VERIFY = skip verification declarations + KWIML_ABI_NO_ERROR_CHAR_SIGN = signedness of 'char' may be unknown + KWIML_ABI_NO_ERROR_LONG_LONG = existence of 'long long' may be unknown + KWIML_ABI_NO_ERROR_ENDIAN = byte order of CPU may be unknown + +An includer may test the following macros after inclusion: + + KWIML_ABI_VERSION = interface version number # of this header + + KWIML_ABI_SIZEOF_DATA_PTR = sizeof(void*) + KWIML_ABI_SIZEOF_CODE_PTR = sizeof(void(*)(void)) + KWIML_ABI_SIZEOF_FLOAT = sizeof(float) + KWIML_ABI_SIZEOF_DOUBLE = sizeof(double) + KWIML_ABI_SIZEOF_CHAR = sizeof(char) + KWIML_ABI_SIZEOF_SHORT = sizeof(short) + KWIML_ABI_SIZEOF_INT = sizeof(int) + KWIML_ABI_SIZEOF_LONG = sizeof(long) + + KWIML_ABI_SIZEOF_LONG_LONG = sizeof(long long) or 0 if not a type + Undefined if existence is unknown and error suppression macro + KWIML_ABI_NO_ERROR_LONG_LONG was defined. + + KWIML_ABI_SIZEOF___INT64 = 8 if '__int64' exists or 0 if not + Undefined if existence is unknown. + + KWIML_ABI___INT64_IS_LONG = 1 if '__int64' is 'long' (same type) + Undefined otherwise. + KWIML_ABI___INT64_IS_LONG_LONG = 1 if '__int64' is 'long long' (same type) + Undefined otherwise. + KWIML_ABI___INT64_IS_UNIQUE = 1 if '__int64' is a distinct type + Undefined otherwise. + + KWIML_ABI_CHAR_IS_UNSIGNED = 1 if 'char' is unsigned, else undefined + KWIML_ABI_CHAR_IS_SIGNED = 1 if 'char' is signed, else undefined + One of these is defined unless signedness of 'char' is unknown and + error suppression macro KWIML_ABI_NO_ERROR_CHAR_SIGN was defined. + + KWIML_ABI_ENDIAN_ID_BIG = id for big-endian (always defined) + KWIML_ABI_ENDIAN_ID_LITTLE = id for little-endian (always defined) + KWIML_ABI_ENDIAN_ID = id of byte order of target CPU + Defined to KWIML_ABI_ENDIAN_ID_BIG or KWIML_ABI_ENDIAN_ID_LITTLE + unless byte order is unknown and error suppression macro + KWIML_ABI_NO_ERROR_ENDIAN was defined. + +We verify most results using dummy "extern" declarations that are +invalid if the macros are wrong. Verification is disabled if +suppression macro KWIML_ABI_NO_VERIFY was defined. +*/ + +#define KWIML_ABI_private_VERSION 1 + +/* Guard definition of this version. */ +#ifndef KWIML_ABI_detail_DEFINED_VERSION_1 +# define KWIML_ABI_detail_DEFINED_VERSION_1 1 +# define KWIML_ABI_private_DO_DEFINE +#endif + +/* Guard verification of this version. */ +#if !defined(KWIML_ABI_NO_VERIFY) +# ifndef KWIML_ABI_detail_VERIFIED_VERSION_1 +# define KWIML_ABI_detail_VERIFIED_VERSION_1 +# define KWIML_ABI_private_DO_VERIFY +# endif +#endif + +#ifdef KWIML_ABI_private_DO_DEFINE +#undef KWIML_ABI_private_DO_DEFINE + +/* Define version as most recent of those included. */ +#if !defined(KWIML_ABI_VERSION) || KWIML_ABI_VERSION < KWIML_ABI_private_VERSION +# undef KWIML_ABI_VERSION +# define KWIML_ABI_VERSION 1 +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_ABI_SIZEOF_DATA_PTR) +# if defined(__SIZEOF_POINTER__) +# define KWIML_ABI_SIZEOF_DATA_PTR __SIZEOF_POINTER__ +# elif defined(_SIZE_PTR) +# define KWIML_ABI_SIZEOF_DATA_PTR (_SIZE_PTR >> 3) +# elif defined(_LP64) || defined(__LP64__) +# define KWIML_ABI_SIZEOF_DATA_PTR 8 +# elif defined(_ILP32) +# define KWIML_ABI_SIZEOF_DATA_PTR 4 +# elif defined(__64BIT__) /* IBM XL */ +# define KWIML_ABI_SIZEOF_DATA_PTR 8 +# elif defined(_M_X64) +# define KWIML_ABI_SIZEOF_DATA_PTR 8 +# elif defined(__ia64) +# define KWIML_ABI_SIZEOF_DATA_PTR 8 +# elif defined(__sparcv9) +# define KWIML_ABI_SIZEOF_DATA_PTR 8 +# elif defined(__x86_64) || defined(__x86_64__) +# define KWIML_ABI_SIZEOF_DATA_PTR 8 +# elif defined(__amd64) || defined(__amd64__) +# define KWIML_ABI_SIZEOF_DATA_PTR 8 +# elif defined(__i386) || defined(__i386__) +# define KWIML_ABI_SIZEOF_DATA_PTR 4 +# endif +#endif +#if !defined(KWIML_ABI_SIZEOF_DATA_PTR) +# define KWIML_ABI_SIZEOF_DATA_PTR 4 +#endif +#if !defined(KWIML_ABI_SIZEOF_CODE_PTR) +# define KWIML_ABI_SIZEOF_CODE_PTR KWIML_ABI_SIZEOF_DATA_PTR +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_ABI_SIZEOF_CHAR) +# define KWIML_ABI_SIZEOF_CHAR 1 +#endif + +#if !defined(KWIML_ABI_CHAR_IS_UNSIGNED) && !defined(KWIML_ABI_CHAR_IS_SIGNED) +# if defined(__CHAR_UNSIGNED__) /* GNU, some IBM XL, others? */ +# define KWIML_ABI_CHAR_IS_UNSIGNED 1 +# elif defined(_CHAR_UNSIGNED) /* Intel, IBM XL, MSVC, Borland, others? */ +# define KWIML_ABI_CHAR_IS_UNSIGNED 1 +# elif defined(_CHAR_SIGNED) /* IBM XL, others? */ +# define KWIML_ABI_CHAR_IS_SIGNED 1 +# elif defined(__CHAR_SIGNED__) /* IBM XL, Watcom, others? */ +# define KWIML_ABI_CHAR_IS_SIGNED 1 +# elif defined(__SIGNED_CHARS__) /* EDG, Intel, SGI MIPSpro */ +# define KWIML_ABI_CHAR_IS_SIGNED 1 +# elif defined(_CHAR_IS_SIGNED) /* Some SunPro, others? */ +# define KWIML_ABI_CHAR_IS_SIGNED 1 +# elif defined(_CHAR_IS_UNSIGNED) /* SunPro, others? */ +# define KWIML_ABI_CHAR_IS_UNSIGNED 1 +# elif defined(__GNUC__) /* GNU default */ +# define KWIML_ABI_CHAR_IS_SIGNED 1 +# elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) /* SunPro default */ +# define KWIML_ABI_CHAR_IS_SIGNED 1 +# elif defined(__HP_cc) || defined(__HP_aCC) /* HP default (unless +uc) */ +# define KWIML_ABI_CHAR_IS_SIGNED 1 +# elif defined(_SGI_COMPILER_VERSION) /* SGI MIPSpro default */ +# define KWIML_ABI_CHAR_IS_UNSIGNED 1 +# elif defined(__PGIC__) /* PGI default */ +# define KWIML_ABI_CHAR_IS_SIGNED 1 +# elif defined(_MSC_VER) /* MSVC default */ +# define KWIML_ABI_CHAR_IS_SIGNED 1 +# elif defined(__WATCOMC__) /* Watcom default */ +# define KWIML_ABI_CHAR_IS_UNSIGNED 1 +# elif defined(__BORLANDC__) /* Borland default */ +# define KWIML_ABI_CHAR_IS_SIGNED 1 +# elif defined(__hpux) /* Old HP: no __HP_cc/__HP_aCC/__GNUC__ above */ +# define KWIML_ABI_CHAR_IS_SIGNED 1 /* (unless +uc) */ +# endif +#endif +#if !defined(KWIML_ABI_CHAR_IS_UNSIGNED) && !defined(KWIML_ABI_CHAR_IS_SIGNED) \ + && !defined(KWIML_ABI_NO_ERROR_CHAR_SIGN) +# error "Signedness of 'char' unknown." +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_ABI_SIZEOF_SHORT) +# if defined(__SIZEOF_SHORT__) +# define KWIML_ABI_SIZEOF_SHORT __SIZEOF_SHORT__ +# endif +#endif +#if !defined(KWIML_ABI_SIZEOF_SHORT) +# define KWIML_ABI_SIZEOF_SHORT 2 +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_ABI_SIZEOF_INT) +# if defined(__SIZEOF_INT__) +# define KWIML_ABI_SIZEOF_INT __SIZEOF_INT__ +# elif defined(_SIZE_INT) +# define KWIML_ABI_SIZEOF_INT (_SIZE_INT >> 3) +# endif +#endif +#if !defined(KWIML_ABI_SIZEOF_INT) +# define KWIML_ABI_SIZEOF_INT 4 +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_ABI_SIZEOF_LONG) +# if defined(__SIZEOF_LONG__) +# define KWIML_ABI_SIZEOF_LONG __SIZEOF_LONG__ +# elif defined(_SIZE_LONG) +# define KWIML_ABI_SIZEOF_LONG (_SIZE_LONG >> 3) +# elif defined(__LONG_MAX__) +# if __LONG_MAX__ == 0x7fffffff +# define KWIML_ABI_SIZEOF_LONG 4 +# elif __LONG_MAX__>>32 == 0x7fffffff +# define KWIML_ABI_SIZEOF_LONG 8 +# endif +# elif defined(_MSC_VER) /* MSVC and Intel on Windows */ +# define KWIML_ABI_SIZEOF_LONG 4 +# endif +#endif +#if !defined(KWIML_ABI_SIZEOF_LONG) +# define KWIML_ABI_SIZEOF_LONG KWIML_ABI_SIZEOF_DATA_PTR +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_ABI_SIZEOF_LONG_LONG) +# if defined(__SIZEOF_LONG_LONG__) +# define KWIML_ABI_SIZEOF_LONG_LONG __SIZEOF_LONG_LONG__ +# elif defined(__LONG_LONG_MAX__) +# if __LONG_LONG_MAX__ == 0x7fffffff +# define KWIML_ABI_SIZEOF_LONG_LONG 4 +# elif __LONG_LONG_MAX__>>32 == 0x7fffffff +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# endif +# endif +#endif +#if !defined(KWIML_ABI_SIZEOF_LONG_LONG) +# if defined(_LONGLONG) /* SGI, some GNU, perhaps others. */ \ + && !defined(_MSC_VER) +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# elif defined(_LONG_LONG) /* IBM XL, perhaps others. */ +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# elif defined(__NO_LONG_LONG) /* EDG */ +# define KWIML_ABI_SIZEOF_LONG_LONG 0 +# elif defined(__cplusplus) && __cplusplus > 199711L /* C++0x */ +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) /* SunPro */ +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# elif defined(__HP_cc) || defined(__HP_aCC) /* HP */ +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# elif defined(__PGIC__) /* PGI */ +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# elif defined(__WATCOMC__) /* Watcom */ +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# elif defined(__INTEL_COMPILER) /* Intel */ +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# elif defined(__BORLANDC__) /* Borland */ +# if __BORLANDC__ >= 0x0560 +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# else +# define KWIML_ABI_SIZEOF_LONG_LONG 0 +# endif +# elif defined(_MSC_VER) /* Microsoft */ +# if _MSC_VER >= 1310 +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# else +# define KWIML_ABI_SIZEOF_LONG_LONG 0 +# endif +# elif defined(__GNUC__) /* GNU */ +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# elif defined(__hpux) /* Old HP: no __HP_cc/__HP_aCC/__GNUC__ above */ +# define KWIML_ABI_SIZEOF_LONG_LONG 8 +# endif +#endif +#if !defined(KWIML_ABI_SIZEOF_LONG_LONG) && !defined(KWIML_ABI_NO_ERROR_LONG_LONG) +# error "Existence of 'long long' unknown." +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_ABI_SIZEOF___INT64) +# if defined(__INTEL_COMPILER) +# define KWIML_ABI_SIZEOF___INT64 8 +# elif defined(_MSC_VER) +# define KWIML_ABI_SIZEOF___INT64 8 +# elif defined(__BORLANDC__) +# define KWIML_ABI_SIZEOF___INT64 8 +# else +# define KWIML_ABI_SIZEOF___INT64 0 +# endif +#endif + +#if defined(KWIML_ABI_SIZEOF___INT64) && KWIML_ABI_SIZEOF___INT64 > 0 +# if KWIML_ABI_SIZEOF_LONG == 8 +# define KWIML_ABI___INT64_IS_LONG 1 +# elif defined(KWIML_ABI_SIZEOF_LONG_LONG) && KWIML_ABI_SIZEOF_LONG_LONG == 8 +# define KWIML_ABI___INT64_IS_LONG_LONG 1 +# else +# define KWIML_ABI___INT64_IS_UNIQUE 1 +# endif +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_ABI_SIZEOF_FLOAT) +# if defined(__SIZEOF_FLOAT__) +# define KWIML_ABI_SIZEOF_FLOAT __SIZEOF_FLOAT__ +# endif +#endif +#if !defined(KWIML_ABI_SIZEOF_FLOAT) +# define KWIML_ABI_SIZEOF_FLOAT 4 +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_ABI_SIZEOF_DOUBLE) +# if defined(__SIZEOF_DOUBLE__) +# define KWIML_ABI_SIZEOF_DOUBLE __SIZEOF_DOUBLE__ +# endif +#endif +#if !defined(KWIML_ABI_SIZEOF_DOUBLE) +# define KWIML_ABI_SIZEOF_DOUBLE 8 +#endif + +/*--------------------------------------------------------------------------*/ +/* Identify possible endian cases. The macro KWIML_ABI_ENDIAN_ID will be + defined to one of these, or undefined if unknown. */ +#if !defined(KWIML_ABI_ENDIAN_ID_BIG) +# define KWIML_ABI_ENDIAN_ID_BIG 4321 +#endif +#if !defined(KWIML_ABI_ENDIAN_ID_LITTLE) +# define KWIML_ABI_ENDIAN_ID_LITTLE 1234 +#endif +#if KWIML_ABI_ENDIAN_ID_BIG == KWIML_ABI_ENDIAN_ID_LITTLE +# error "KWIML_ABI_ENDIAN_ID_BIG == KWIML_ABI_ENDIAN_ID_LITTLE" +#endif + +#if defined(KWIML_ABI_ENDIAN_ID) /* Skip #elif cases if already defined. */ + +/* Use dedicated symbols if the compiler defines them. Do this first + because some architectures allow runtime byte order selection by + the operating system (values for such architectures below are + guesses for compilers that do not define a dedicated symbol). + Ensure that only one is defined in case the platform or a header + defines both as possible values for some third symbol. */ +#elif defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG +#elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE +#elif defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG +#elif defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE + +/* Alpha */ +#elif defined(__alpha) || defined(__alpha__) || defined(_M_ALPHA) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE + +/* Arm */ +#elif defined(__arm__) +# if !defined(__ARMEB__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE +# else +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG +# endif + +/* Intel x86 */ +#elif defined(__i386) || defined(__i386__) || defined(_M_IX86) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE +#elif defined(_X86_) || defined(__THW_INTEL__) || defined(__I86__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE +#elif defined(__MWERKS__) && defined(__INTEL__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE + +/* Intel x86-64 */ +#elif defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE +#elif defined(__amd64) || defined(__amd64__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE + +/* Intel Architecture-64 (Itanium) */ +#elif defined(__ia64) || defined(__ia64__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE +#elif defined(_IA64) || defined(__IA64__) || defined(_M_IA64) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE + +/* PowerPC */ +#elif defined(__powerpc) || defined(__powerpc__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG +#elif defined(__ppc) || defined(__ppc__) || defined(__POWERPC__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG + +/* SPARC */ +#elif defined(__sparc) || defined(__sparc__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG + +/* HP/PA RISC */ +#elif defined(__hppa) || defined(__hppa__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG + +/* Motorola 68k */ +#elif defined(__m68k__) || defined(M68000) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG + +/* MIPSel (MIPS little endian) */ +#elif defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE + +/* MIPSeb (MIPS big endian) */ +#elif defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG + +/* MIPS (fallback, big endian) */ +#elif defined(__mips) || defined(__mips__) || defined(__MIPS__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG + +/* NIOS2 */ +#elif defined(__NIOS2__) || defined(__NIOS2) || defined(__nios2__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE + +/* OpenRISC 1000 */ +#elif defined(__or1k__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG + +/* RS/6000 */ +#elif defined(__THW_RS600) || defined(_IBMR2) || defined(_POWER) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG +#elif defined(_ARCH_PWR) || defined(_ARCH_PWR2) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG + +/* System/370 */ +#elif defined(__370__) || defined(__THW_370__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG + +/* System/390 */ +#elif defined(__s390__) || defined(__s390x__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG + +/* z/Architecture */ +#elif defined(__SYSC_ZARCH__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG + +/* VAX */ +#elif defined(__vax__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG + +/* Aarch64 */ +#elif defined(__aarch64__) +# if !defined(__AARCH64EB__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE +# else +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG +# endif + +/* Xtensa */ +#elif defined(__XTENSA_EB__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_BIG +#elif defined(__XTENSA_EL__) +# define KWIML_ABI_ENDIAN_ID KWIML_ABI_ENDIAN_ID_LITTLE + +/* Unknown CPU */ +#elif !defined(KWIML_ABI_NO_ERROR_ENDIAN) +# error "Byte order of target CPU unknown." +#endif + +#endif /* KWIML_ABI_private_DO_DEFINE */ + +/*--------------------------------------------------------------------------*/ +#ifdef KWIML_ABI_private_DO_VERIFY +#undef KWIML_ABI_private_DO_VERIFY + +#if defined(_MSC_VER) +# pragma warning (push) +# pragma warning (disable:4310) /* cast truncates constant value */ +#endif + +#define KWIML_ABI_private_VERIFY(n, x, y) KWIML_ABI_private_VERIFY_0(KWIML_ABI_private_VERSION, n, x, y) +#define KWIML_ABI_private_VERIFY_0(V, n, x, y) KWIML_ABI_private_VERIFY_1(V, n, x, y) +#define KWIML_ABI_private_VERIFY_1(V, n, x, y) extern int (*n##_v##V)[x]; extern int (*n##_v##V)[y] + +#define KWIML_ABI_private_VERIFY_SAME_IMPL(n, x, y) KWIML_ABI_private_VERIFY_SAME_IMPL_0(KWIML_ABI_private_VERSION, n, x, y) +#define KWIML_ABI_private_VERIFY_SAME_IMPL_0(V, n, x, y) KWIML_ABI_private_VERIFY_SAME_IMPL_1(V, n, x, y) +#define KWIML_ABI_private_VERIFY_SAME_IMPL_1(V, n, x, y) extern int (*n##_v##V)(x*); extern int (*n##_v##V)(y*) + +#define KWIML_ABI_private_VERIFY_DIFF_IMPL(n, x, y) KWIML_ABI_private_VERIFY_DIFF_IMPL_0(KWIML_ABI_private_VERSION, n, x, y) +#define KWIML_ABI_private_VERIFY_DIFF_IMPL_0(V, n, x, y) KWIML_ABI_private_VERIFY_DIFF_IMPL_1(V, n, x, y) +#if defined(__cplusplus) +# define KWIML_ABI_private_VERIFY_DIFF_IMPL_1(V, n, x, y) extern int* n##_v##V(x*); extern char* n##_v##V(y*) +#else +# define KWIML_ABI_private_VERIFY_DIFF_IMPL_1(V, n, x, y) extern int* n##_v##V(x*) /* TODO: possible? */ +#endif + +#define KWIML_ABI_private_VERIFY_BOOL(m, b) KWIML_ABI_private_VERIFY(KWIML_ABI_detail_VERIFY_##m, 2, (b)?2:3) +#define KWIML_ABI_private_VERIFY_SIZE(m, t) KWIML_ABI_private_VERIFY(KWIML_ABI_detail_VERIFY_##m, m, sizeof(t)) +#define KWIML_ABI_private_VERIFY_SAME(m, x, y) KWIML_ABI_private_VERIFY_SAME_IMPL(KWIML_ABI_detail_VERIFY_##m, x, y) +#define KWIML_ABI_private_VERIFY_DIFF(m, x, y) KWIML_ABI_private_VERIFY_DIFF_IMPL(KWIML_ABI_detail_VERIFY_##m, x, y) + +KWIML_ABI_private_VERIFY_SIZE(KWIML_ABI_SIZEOF_DATA_PTR, int*); +KWIML_ABI_private_VERIFY_SIZE(KWIML_ABI_SIZEOF_CODE_PTR, int(*)(int)); +KWIML_ABI_private_VERIFY_SIZE(KWIML_ABI_SIZEOF_CHAR, char); +KWIML_ABI_private_VERIFY_SIZE(KWIML_ABI_SIZEOF_SHORT, short); +KWIML_ABI_private_VERIFY_SIZE(KWIML_ABI_SIZEOF_INT, int); +KWIML_ABI_private_VERIFY_SIZE(KWIML_ABI_SIZEOF_LONG, long); +#if defined(KWIML_ABI_SIZEOF_LONG_LONG) && KWIML_ABI_SIZEOF_LONG_LONG > 0 +KWIML_ABI_private_VERIFY_SIZE(KWIML_ABI_SIZEOF_LONG_LONG, long long); +#endif +#if defined(KWIML_ABI_SIZEOF___INT64) && KWIML_ABI_SIZEOF___INT64 > 0 +KWIML_ABI_private_VERIFY_SIZE(KWIML_ABI_SIZEOF___INT64, __int64); +#endif +KWIML_ABI_private_VERIFY_SIZE(KWIML_ABI_SIZEOF_FLOAT, float); +KWIML_ABI_private_VERIFY_SIZE(KWIML_ABI_SIZEOF_DOUBLE, double); + +#if defined(KWIML_ABI___INT64_IS_LONG) +KWIML_ABI_private_VERIFY_SAME(KWIML_ABI___INT64_IS_LONG, __int64, long); +#elif defined(KWIML_ABI___INT64_IS_LONG_LONG) +KWIML_ABI_private_VERIFY_SAME(KWIML_ABI___INT64_IS_LONG_LONG, __int64, long long); +#elif defined(KWIML_ABI_SIZEOF___INT64) && KWIML_ABI_SIZEOF___INT64 > 0 +KWIML_ABI_private_VERIFY_DIFF(KWIML_ABI___INT64_NOT_LONG, __int64, long); +# if defined(KWIML_ABI_SIZEOF_LONG_LONG) && KWIML_ABI_SIZEOF_LONG_LONG > 0 +KWIML_ABI_private_VERIFY_DIFF(KWIML_ABI___INT64_NOT_LONG_LONG, __int64, long long); +# endif +#endif + +#if defined(KWIML_ABI_CHAR_IS_UNSIGNED) +KWIML_ABI_private_VERIFY_BOOL(KWIML_ABI_CHAR_IS_UNSIGNED, (char)0x80 > 0); +#elif defined(KWIML_ABI_CHAR_IS_SIGNED) +KWIML_ABI_private_VERIFY_BOOL(KWIML_ABI_CHAR_IS_SIGNED, (char)0x80 < 0); +#endif + +#undef KWIML_ABI_private_VERIFY_DIFF +#undef KWIML_ABI_private_VERIFY_SAME +#undef KWIML_ABI_private_VERIFY_SIZE +#undef KWIML_ABI_private_VERIFY_BOOL + +#undef KWIML_ABI_private_VERIFY_DIFF_IMPL_1 +#undef KWIML_ABI_private_VERIFY_DIFF_IMPL_0 +#undef KWIML_ABI_private_VERIFY_DIFF_IMPL + +#undef KWIML_ABI_private_VERIFY_SAME_IMPL_1 +#undef KWIML_ABI_private_VERIFY_SAME_IMPL_0 +#undef KWIML_ABI_private_VERIFY_SAME_IMPL + +#undef KWIML_ABI_private_VERIFY_1 +#undef KWIML_ABI_private_VERIFY_0 +#undef KWIML_ABI_private_VERIFY + +#if defined(_MSC_VER) +# pragma warning (pop) +#endif + +#endif /* KWIML_ABI_private_DO_VERIFY */ + +#undef KWIML_ABI_private_VERSION diff --git a/include/kwiml/int.h b/include/kwiml/int.h new file mode 100644 index 000000000..b297acee4 --- /dev/null +++ b/include/kwiml/int.h @@ -0,0 +1,1069 @@ +/*============================================================================ + Kitware Information Macro Library + Copyright 2010-2015 Kitware, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Kitware, Inc. nor the names of its contributors + may be used to endorse or promote products derived from this + software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +============================================================================*/ +/* +This header defines macros with information about sized integer types. +Only information that can be determined using the preprocessor at +compilation time is available. No try-compile results may be added +here. Instead we memorize results on platforms of interest. + +An includer may optionally define the following macros to suppress errors: + +Input: + KWIML_INT_NO_VERIFY = skip verification declarations + KWIML_INT_NO_ERROR_INT64_T = type 'KWIML_INT_int64_t' is optional (*) + KWIML_INT_NO_ERROR_UINT64_T = type 'KWIML_INT_uint64_t' is optional (*) + KWIML_INT_NO_ERROR_INTPTR_T = type 'KWIML_INT_intptr_t' is optional (*) + KWIML_INT_NO_ERROR_UINTPTR_T = type 'KWIML_INT_uintptr_t' is optional (*) + +An includer may optionally define the following macros to override defaults. +Either way, an includer may test these macros after inclusion: + + KWIML_INT_HAVE_STDINT_H = include + KWIML_INT_NO_STDINT_H = do not include + KWIML_INT_HAVE_INTTYPES_H = include + KWIML_INT_NO_INTTYPES_H = do not include + +An includer may test the following macros after inclusion: + + KWIML_INT_VERSION = interface version number # of this header + + KWIML_INT_HAVE_INT#_T = type 'int#_t' is available + KWIML_INT_HAVE_UINT#_T = type 'uint#_t' is available + # = 8, 16, 32, 64, PTR + + KWIML_INT_int#_t = signed integer type exactly # bits wide + KWIML_INT_uint#_t = unsigned integer type exactly # bits wide + # = 8, 16, 32, 64 (*), ptr (*) + + KWIML_INT_NO_INT64_T = type 'KWIML_INT_int64_t' not available + KWIML_INT_NO_UINT64_T = type 'KWIML_INT_uint64_t' not available + KWIML_INT_NO_INTPTR_T = type 'KWIML_INT_intptr_t' not available + KWIML_INT_NO_UINTPTR_T = type 'KWIML_INT_uintptr_t' not available + + KWIML_INT_INT#_C(c) = signed integer constant at least # bits wide + KWIML_INT_UINT#_C(c) = unsigned integer constant at least # bits wide + # = 8, 16, 32, 64 (*) + + KWIML_INT_# = print or scan format, in table below + # = 8, 16, 32, 64, PTR (*) + + signed unsigned + ----------- ------------------------------ + | decimal | decimal octal hexadecimal | + print | PRId PRIi | PRIu PRIo PRIx PRIX | + scan | SCNd SCNi | SCNu SCNo SCNx | + ----------- ------------------------------ + + The SCN*8 and SCN*64 format macros will not be defined on systems + with scanf implementations known not to support them. + + KWIML_INT_BROKEN_# = macro # is incorrect if defined + Some compilers define integer format macros incorrectly for their + own formatted print/scan implementations. + + KWIML_INT_BROKEN_INT#_C = macro INT#_C is incorrect if defined + KWIML_INT_BROKEN_UINT#_C = macro UINT#_C is incorrect if defined + Some compilers define integer constant macros incorrectly and + cannot handle literals as large as the integer type or even + produce bad preprocessor syntax. + + KWIML_INT_BROKEN_INT8_T = type 'int8_t' is available but incorrect + Some compilers have a flag to make 'char' (un)signed but do not account + for it while defining int8_t in the non-default case. + + The broken cases do not affect correctness of the macros documented above. +*/ + +#include "abi.h" + +#define KWIML_INT_private_VERSION 1 + +/* Guard definition of this version. */ +#ifndef KWIML_INT_detail_DEFINED_VERSION_1 +# define KWIML_INT_detail_DEFINED_VERSION_1 1 +# define KWIML_INT_private_DO_DEFINE +#endif + +/* Guard verification of this version. */ +#if !defined(KWIML_INT_NO_VERIFY) +# ifndef KWIML_INT_detail_VERIFIED_VERSION_1 +# define KWIML_INT_detail_VERIFIED_VERSION_1 +# define KWIML_INT_private_DO_VERIFY +# endif +#endif + +#ifdef KWIML_INT_private_DO_DEFINE +#undef KWIML_INT_private_DO_DEFINE + +/* Define version as most recent of those included. */ +#if !defined(KWIML_INT_VERSION) || KWIML_INT_VERSION < KWIML_INT_private_VERSION +# undef KWIML_INT_VERSION +# define KWIML_INT_VERSION 1 +#endif + +/*--------------------------------------------------------------------------*/ +#if defined(KWIML_INT_HAVE_STDINT_H) /* Already defined. */ +#elif defined(KWIML_INT_NO_STDINT_H) /* Already defined. */ +#elif defined(HAVE_STDINT_H) /* Optionally provided by includer. */ +# define KWIML_INT_HAVE_STDINT_H 1 +#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ +# define KWIML_INT_HAVE_STDINT_H 1 +#elif defined(_MSC_VER) /* MSVC */ +# if _MSC_VER >= 1600 +# define KWIML_INT_HAVE_STDINT_H 1 +# else +# define KWIML_INT_NO_STDINT_H 1 +# endif +#elif defined(__BORLANDC__) /* Borland */ +# if __BORLANDC__ >= 0x560 +# define KWIML_INT_HAVE_STDINT_H 1 +# else +# define KWIML_INT_NO_STDINT_H 1 +# endif +#elif defined(__WATCOMC__) /* Watcom */ +# define KWIML_INT_NO_STDINT_H 1 +#endif + +/*--------------------------------------------------------------------------*/ +#if defined(KWIML_INT_HAVE_INTTYPES_H) /* Already defined. */ +#elif defined(KWIML_INT_NO_INTTYPES_H) /* Already defined. */ +#elif defined(HAVE_INTTYPES_H) /* Optionally provided by includer. */ +# define KWIML_INT_HAVE_INTTYPES_H 1 +#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ +# define KWIML_INT_HAVE_INTTYPES_H 1 +#elif defined(_MSC_VER) /* MSVC */ +# define KWIML_INT_NO_INTTYPES_H 1 +#elif defined(__BORLANDC__) /* Borland */ +# define KWIML_INT_NO_INTTYPES_H 1 +#elif defined(__WATCOMC__) /* Watcom */ +# define KWIML_INT_NO_INTTYPES_H 1 +#else /* Assume it exists. */ +# define KWIML_INT_HAVE_INTTYPES_H 1 +#endif + +/*--------------------------------------------------------------------------*/ +#if defined(KWIML_INT_HAVE_STDINT_H) && defined(KWIML_INT_NO_STDINT_H) +# error "Both KWIML_INT_HAVE_STDINT_H and KWIML_INT_NO_STDINT_H defined!" +#endif +#if defined(KWIML_INT_HAVE_INTTYPES_H) && defined(KWIML_INT_NO_INTTYPES_H) +# error "Both KWIML_INT_HAVE_INTTYPES_H and KWIML_INT_NO_INTTYPES_H defined!" +#endif + +#if defined(KWIML_INT_HAVE_STDINT_H) +# ifndef KWIML_INT_detail_INCLUDED_STDINT_H +# define KWIML_INT_detail_INCLUDED_STDINT_H +# include +# endif +#endif +#if defined(KWIML_INT_HAVE_INTTYPES_H) +# ifndef KWIML_INT_detail_INCLUDED_INTTYPES_H +# define KWIML_INT_detail_INCLUDED_INTTYPES_H +# if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS) +# define __STDC_FORMAT_MACROS +# endif +# include +# endif +#endif + +#if defined(KWIML_INT_HAVE_STDINT_H) || defined(KWIML_INT_HAVE_INTTYPES_H) +#define KWIML_INT_HAVE_INT8_T 1 +#define KWIML_INT_HAVE_UINT8_T 1 +#define KWIML_INT_HAVE_INT16_T 1 +#define KWIML_INT_HAVE_UINT16_T 1 +#define KWIML_INT_HAVE_INT32_T 1 +#define KWIML_INT_HAVE_UINT32_T 1 +#define KWIML_INT_HAVE_INT64_T 1 +#define KWIML_INT_HAVE_UINT64_T 1 +#define KWIML_INT_HAVE_INTPTR_T 1 +#define KWIML_INT_HAVE_UINTPTR_T 1 +# if defined(__cplusplus) +# define KWIML_INT_detail_GLOBAL_NS(T) ::T +# else +# define KWIML_INT_detail_GLOBAL_NS(T) T +# endif +#endif + +#if defined(_AIX43) && !defined(_AIX50) && !defined(_AIX51) + /* AIX 4.3 defines these incorrectly with % and no quotes. */ +# define KWIML_INT_BROKEN_PRId8 1 +# define KWIML_INT_BROKEN_SCNd8 1 +# define KWIML_INT_BROKEN_PRIi8 1 +# define KWIML_INT_BROKEN_SCNi8 1 +# define KWIML_INT_BROKEN_PRIo8 1 +# define KWIML_INT_BROKEN_SCNo8 1 +# define KWIML_INT_BROKEN_PRIu8 1 +# define KWIML_INT_BROKEN_SCNu8 1 +# define KWIML_INT_BROKEN_PRIx8 1 +# define KWIML_INT_BROKEN_SCNx8 1 +# define KWIML_INT_BROKEN_PRIX8 1 +# define KWIML_INT_BROKEN_PRId16 1 +# define KWIML_INT_BROKEN_SCNd16 1 +# define KWIML_INT_BROKEN_PRIi16 1 +# define KWIML_INT_BROKEN_SCNi16 1 +# define KWIML_INT_BROKEN_PRIo16 1 +# define KWIML_INT_BROKEN_SCNo16 1 +# define KWIML_INT_BROKEN_PRIu16 1 +# define KWIML_INT_BROKEN_SCNu16 1 +# define KWIML_INT_BROKEN_PRIx16 1 +# define KWIML_INT_BROKEN_SCNx16 1 +# define KWIML_INT_BROKEN_PRIX16 1 +# define KWIML_INT_BROKEN_PRId32 1 +# define KWIML_INT_BROKEN_SCNd32 1 +# define KWIML_INT_BROKEN_PRIi32 1 +# define KWIML_INT_BROKEN_SCNi32 1 +# define KWIML_INT_BROKEN_PRIo32 1 +# define KWIML_INT_BROKEN_SCNo32 1 +# define KWIML_INT_BROKEN_PRIu32 1 +# define KWIML_INT_BROKEN_SCNu32 1 +# define KWIML_INT_BROKEN_PRIx32 1 +# define KWIML_INT_BROKEN_SCNx32 1 +# define KWIML_INT_BROKEN_PRIX32 1 +# define KWIML_INT_BROKEN_PRId64 1 +# define KWIML_INT_BROKEN_SCNd64 1 +# define KWIML_INT_BROKEN_PRIi64 1 +# define KWIML_INT_BROKEN_SCNi64 1 +# define KWIML_INT_BROKEN_PRIo64 1 +# define KWIML_INT_BROKEN_SCNo64 1 +# define KWIML_INT_BROKEN_PRIu64 1 +# define KWIML_INT_BROKEN_SCNu64 1 +# define KWIML_INT_BROKEN_PRIx64 1 +# define KWIML_INT_BROKEN_SCNx64 1 +# define KWIML_INT_BROKEN_PRIX64 1 +# define KWIML_INT_BROKEN_PRIdPTR 1 +# define KWIML_INT_BROKEN_SCNdPTR 1 +# define KWIML_INT_BROKEN_PRIiPTR 1 +# define KWIML_INT_BROKEN_SCNiPTR 1 +# define KWIML_INT_BROKEN_PRIoPTR 1 +# define KWIML_INT_BROKEN_SCNoPTR 1 +# define KWIML_INT_BROKEN_PRIuPTR 1 +# define KWIML_INT_BROKEN_SCNuPTR 1 +# define KWIML_INT_BROKEN_PRIxPTR 1 +# define KWIML_INT_BROKEN_SCNxPTR 1 +# define KWIML_INT_BROKEN_PRIXPTR 1 +#endif + +#if (defined(__SUNPRO_C)||defined(__SUNPRO_CC)) && defined(_CHAR_IS_UNSIGNED) +# define KWIML_INT_BROKEN_INT8_T 1 /* system type defined incorrectly */ +#elif defined(__BORLANDC__) && defined(_CHAR_UNSIGNED) +# define KWIML_INT_BROKEN_INT8_T 1 /* system type defined incorrectly */ +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_INT_int8_t) +# if defined(KWIML_INT_HAVE_INT8_T) && !defined(KWIML_INT_BROKEN_INT8_T) +# define KWIML_INT_int8_t KWIML_INT_detail_GLOBAL_NS(int8_t) +# else +# define KWIML_INT_int8_t signed char +# endif +#endif +#if !defined(KWIML_INT_uint8_t) +# if defined(KWIML_INT_HAVE_UINT8_T) +# define KWIML_INT_uint8_t KWIML_INT_detail_GLOBAL_NS(uint8_t) +# else +# define KWIML_INT_uint8_t unsigned char +# endif +#endif + +#if defined(__INTEL_COMPILER) +# if defined(_WIN32) +# define KWIML_INT_private_NO_SCN8 +# endif +#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) +# define KWIML_INT_private_NO_SCN8 +#elif defined(__BORLANDC__) +# define KWIML_INT_private_NO_SCN8 +# define KWIML_INT_private_NO_SCN64 +#elif defined(_MSC_VER) +# define KWIML_INT_private_NO_SCN8 +#elif defined(__WATCOMC__) +# define KWIML_INT_private_NO_SCN8 +# elif defined(__hpux) /* HP runtime lacks support (any compiler) */ +# define KWIML_INT_private_NO_SCN8 +#endif + +/* 8-bit d, i */ +#if !defined(KWIML_INT_PRId8) +# if defined(KWIML_INT_HAVE_INT8_T) && defined(PRId8) \ + && !defined(KWIML_INT_BROKEN_PRId8) +# define KWIML_INT_PRId8 PRId8 +# else +# define KWIML_INT_PRId8 "d" +# endif +#endif +#if !defined(KWIML_INT_SCNd8) +# if defined(KWIML_INT_HAVE_INT8_T) && defined(SCNd8) \ + && !defined(KWIML_INT_BROKEN_SCNd8) +# define KWIML_INT_SCNd8 SCNd8 +# elif !defined(KWIML_INT_private_NO_SCN8) +# define KWIML_INT_SCNd8 "hhd" +# endif +#endif +#if !defined(KWIML_INT_PRIi8) +# if defined(KWIML_INT_HAVE_INT8_T) && defined(PRIi8) \ + && !defined(KWIML_INT_BROKEN_PRIi8) +# define KWIML_INT_PRIi8 PRIi8 +# else +# define KWIML_INT_PRIi8 "i" +# endif +#endif +#if !defined(KWIML_INT_SCNi8) +# if defined(KWIML_INT_HAVE_INT8_T) && defined(SCNi8) \ + && !defined(KWIML_INT_BROKEN_SCNi8) +# define KWIML_INT_SCNi8 SCNi8 +# elif !defined(KWIML_INT_private_NO_SCN8) +# define KWIML_INT_SCNi8 "hhi" +# endif +#endif + +/* 8-bit o, u, x, X */ +#if !defined(KWIML_INT_PRIo8) +# if defined(KWIML_INT_HAVE_UINT8_T) && defined(PRIo8) \ + && !defined(KWIML_INT_BROKEN_PRIo8) +# define KWIML_INT_PRIo8 PRIo8 +# else +# define KWIML_INT_PRIo8 "o" +# endif +#endif +#if !defined(KWIML_INT_SCNo8) +# if defined(KWIML_INT_HAVE_UINT8_T) && defined(SCNo8) \ + && !defined(KWIML_INT_BROKEN_SCNo8) +# define KWIML_INT_SCNo8 SCNo8 +# elif !defined(KWIML_INT_private_NO_SCN8) +# define KWIML_INT_SCNo8 "hho" +# endif +#endif +#if !defined(KWIML_INT_PRIu8) +# if defined(KWIML_INT_HAVE_UINT8_T) && defined(PRIu8) \ + && !defined(KWIML_INT_BROKEN_PRIu8) +# define KWIML_INT_PRIu8 PRIu8 +# else +# define KWIML_INT_PRIu8 "u" +# endif +#endif +#if !defined(KWIML_INT_SCNu8) +# if defined(KWIML_INT_HAVE_UINT8_T) && defined(SCNu8) \ + && !defined(KWIML_INT_BROKEN_SCNu8) +# define KWIML_INT_SCNu8 SCNu8 +# elif !defined(KWIML_INT_private_NO_SCN8) +# define KWIML_INT_SCNu8 "hhu" +# endif +#endif +#if !defined(KWIML_INT_PRIx8) +# if defined(KWIML_INT_HAVE_UINT8_T) && defined(PRIx8) \ + && !defined(KWIML_INT_BROKEN_PRIx8) +# define KWIML_INT_PRIx8 PRIx8 +# else +# define KWIML_INT_PRIx8 "x" +# endif +#endif +#if !defined(KWIML_INT_SCNx8) +# if defined(KWIML_INT_HAVE_UINT8_T) && defined(SCNx8) \ + && !defined(KWIML_INT_BROKEN_SCNx8) +# define KWIML_INT_SCNx8 SCNx8 +# elif !defined(KWIML_INT_private_NO_SCN8) +# define KWIML_INT_SCNx8 "hhx" +# endif +#endif +#if !defined(KWIML_INT_PRIX8) +# if defined(KWIML_INT_HAVE_UINT8_T) && defined(PRIX8) \ + && !defined(KWIML_INT_BROKEN_PRIX8) +# define KWIML_INT_PRIX8 PRIX8 +# else +# define KWIML_INT_PRIX8 "X" +# endif +#endif + +/* 8-bit constants */ +#if !defined(KWIML_INT_INT8_C) +# if defined(INT8_C) && !defined(KWIML_INT_BROKEN_INT8_C) +# define KWIML_INT_INT8_C(c) INT8_C(c) +# else +# define KWIML_INT_INT8_C(c) c +# endif +#endif +#if !defined(KWIML_INT_UINT8_C) +# if defined(UINT8_C) && !defined(KWIML_INT_BROKEN_UINT8_C) +# define KWIML_INT_UINT8_C(c) UINT8_C(c) +# else +# define KWIML_INT_UINT8_C(c) c ## u +# endif +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_INT_int16_t) +# if defined(KWIML_INT_HAVE_INT16_T) +# define KWIML_INT_int16_t KWIML_INT_detail_GLOBAL_NS(int16_t) +# else +# define KWIML_INT_int16_t signed short +# endif +#endif +#if !defined(KWIML_INT_uint16_t) +# if defined(KWIML_INT_HAVE_UINT16_T) +# define KWIML_INT_uint16_t KWIML_INT_detail_GLOBAL_NS(uint16_t) +# else +# define KWIML_INT_uint16_t unsigned short +# endif +#endif + +/* 16-bit d, i */ +#if !defined(KWIML_INT_PRId16) +# if defined(KWIML_INT_HAVE_INT16_T) && defined(PRId16) \ + && !defined(KWIML_INT_BROKEN_PRId16) +# define KWIML_INT_PRId16 PRId16 +# else +# define KWIML_INT_PRId16 "d" +# endif +#endif +#if !defined(KWIML_INT_SCNd16) +# if defined(KWIML_INT_HAVE_INT16_T) && defined(SCNd16) \ + && !defined(KWIML_INT_BROKEN_SCNd16) +# define KWIML_INT_SCNd16 SCNd16 +# else +# define KWIML_INT_SCNd16 "hd" +# endif +#endif +#if !defined(KWIML_INT_PRIi16) +# if defined(KWIML_INT_HAVE_INT16_T) && defined(PRIi16) \ + && !defined(KWIML_INT_BROKEN_PRIi16) +# define KWIML_INT_PRIi16 PRIi16 +# else +# define KWIML_INT_PRIi16 "i" +# endif +#endif +#if !defined(KWIML_INT_SCNi16) +# if defined(KWIML_INT_HAVE_INT16_T) && defined(SCNi16) \ + && !defined(KWIML_INT_BROKEN_SCNi16) +# define KWIML_INT_SCNi16 SCNi16 +# else +# define KWIML_INT_SCNi16 "hi" +# endif +#endif + +/* 16-bit o, u, x, X */ +#if !defined(KWIML_INT_PRIo16) +# if defined(KWIML_INT_HAVE_UINT16_T) && defined(PRIo16) \ + && !defined(KWIML_INT_BROKEN_PRIo16) +# define KWIML_INT_PRIo16 PRIo16 +# else +# define KWIML_INT_PRIo16 "o" +# endif +#endif +#if !defined(KWIML_INT_SCNo16) +# if defined(KWIML_INT_HAVE_UINT16_T) && defined(SCNo16) \ + && !defined(KWIML_INT_BROKEN_SCNo16) +# define KWIML_INT_SCNo16 SCNo16 +# else +# define KWIML_INT_SCNo16 "ho" +# endif +#endif +#if !defined(KWIML_INT_PRIu16) +# if defined(KWIML_INT_HAVE_UINT16_T) && defined(PRIu16) \ + && !defined(KWIML_INT_BROKEN_PRIu16) +# define KWIML_INT_PRIu16 PRIu16 +# else +# define KWIML_INT_PRIu16 "u" +# endif +#endif +#if !defined(KWIML_INT_SCNu16) +# if defined(KWIML_INT_HAVE_UINT16_T) && defined(SCNu16) \ + && !defined(KWIML_INT_BROKEN_SCNu16) +# define KWIML_INT_SCNu16 SCNu16 +# else +# define KWIML_INT_SCNu16 "hu" +# endif +#endif +#if !defined(KWIML_INT_PRIx16) +# if defined(KWIML_INT_HAVE_UINT16_T) && defined(PRIx16) \ + && !defined(KWIML_INT_BROKEN_PRIx16) +# define KWIML_INT_PRIx16 PRIx16 +# else +# define KWIML_INT_PRIx16 "x" +# endif +#endif +#if !defined(KWIML_INT_SCNx16) +# if defined(KWIML_INT_HAVE_UINT16_T) && defined(SCNx16) \ + && !defined(KWIML_INT_BROKEN_SCNx16) +# define KWIML_INT_SCNx16 SCNx16 +# else +# define KWIML_INT_SCNx16 "hx" +# endif +#endif +#if !defined(KWIML_INT_PRIX16) +# if defined(KWIML_INT_HAVE_UINT16_T) && defined(PRIX16) \ + && !defined(KWIML_INT_BROKEN_PRIX16) +# define KWIML_INT_PRIX16 PRIX16 +# else +# define KWIML_INT_PRIX16 "X" +# endif +#endif + +/* 16-bit constants */ +#if !defined(KWIML_INT_INT16_C) +# if defined(INT16_C) && !defined(KWIML_INT_BROKEN_INT16_C) +# define KWIML_INT_INT16_C(c) INT16_C(c) +# else +# define KWIML_INT_INT16_C(c) c +# endif +#endif +#if !defined(KWIML_INT_UINT16_C) +# if defined(UINT16_C) && !defined(KWIML_INT_BROKEN_UINT16_C) +# define KWIML_INT_UINT16_C(c) UINT16_C(c) +# else +# define KWIML_INT_UINT16_C(c) c ## u +# endif +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_INT_int32_t) +# if defined(KWIML_INT_HAVE_INT32_T) +# define KWIML_INT_int32_t KWIML_INT_detail_GLOBAL_NS(int32_t) +# else +# define KWIML_INT_int32_t signed int +# endif +#endif +#if !defined(KWIML_INT_uint32_t) +# if defined(KWIML_INT_HAVE_UINT32_T) +# define KWIML_INT_uint32_t KWIML_INT_detail_GLOBAL_NS(uint32_t) +# else +# define KWIML_INT_uint32_t unsigned int +# endif +#endif + +/* 32-bit d, i */ +#if !defined(KWIML_INT_PRId32) +# if defined(KWIML_INT_HAVE_INT32_T) && defined(PRId32) \ + && !defined(KWIML_INT_BROKEN_PRId32) +# define KWIML_INT_PRId32 PRId32 +# else +# define KWIML_INT_PRId32 "d" +# endif +#endif +#if !defined(KWIML_INT_SCNd32) +# if defined(KWIML_INT_HAVE_INT32_T) && defined(SCNd32) \ + && !defined(KWIML_INT_BROKEN_SCNd32) +# define KWIML_INT_SCNd32 SCNd32 +# else +# define KWIML_INT_SCNd32 "d" +# endif +#endif +#if !defined(KWIML_INT_PRIi32) +# if defined(KWIML_INT_HAVE_INT32_T) && defined(PRIi32) \ + && !defined(KWIML_INT_BROKEN_PRIi32) +# define KWIML_INT_PRIi32 PRIi32 +# else +# define KWIML_INT_PRIi32 "i" +# endif +#endif +#if !defined(KWIML_INT_SCNi32) +# if defined(KWIML_INT_HAVE_INT32_T) && defined(SCNi32) \ + && !defined(KWIML_INT_BROKEN_SCNi32) +# define KWIML_INT_SCNi32 SCNi32 +# else +# define KWIML_INT_SCNi32 "i" +# endif +#endif + +/* 32-bit o, u, x, X */ +#if !defined(KWIML_INT_PRIo32) +# if defined(KWIML_INT_HAVE_UINT32_T) && defined(PRIo32) \ + && !defined(KWIML_INT_BROKEN_PRIo32) +# define KWIML_INT_PRIo32 PRIo32 +# else +# define KWIML_INT_PRIo32 "o" +# endif +#endif +#if !defined(KWIML_INT_SCNo32) +# if defined(KWIML_INT_HAVE_UINT32_T) && defined(SCNo32) \ + && !defined(KWIML_INT_BROKEN_SCNo32) +# define KWIML_INT_SCNo32 SCNo32 +# else +# define KWIML_INT_SCNo32 "o" +# endif +#endif +#if !defined(KWIML_INT_PRIu32) +# if defined(KWIML_INT_HAVE_UINT32_T) && defined(PRIu32) \ + && !defined(KWIML_INT_BROKEN_PRIu32) +# define KWIML_INT_PRIu32 PRIu32 +# else +# define KWIML_INT_PRIu32 "u" +# endif +#endif +#if !defined(KWIML_INT_SCNu32) +# if defined(KWIML_INT_HAVE_UINT32_T) && defined(SCNu32) \ + && !defined(KWIML_INT_BROKEN_SCNu32) +# define KWIML_INT_SCNu32 SCNu32 +# else +# define KWIML_INT_SCNu32 "u" +# endif +#endif +#if !defined(KWIML_INT_PRIx32) +# if defined(KWIML_INT_HAVE_UINT32_T) && defined(PRIx32) \ + && !defined(KWIML_INT_BROKEN_PRIx32) +# define KWIML_INT_PRIx32 PRIx32 +# else +# define KWIML_INT_PRIx32 "x" +# endif +#endif +#if !defined(KWIML_INT_SCNx32) +# if defined(KWIML_INT_HAVE_UINT32_T) && defined(SCNx32) \ + && !defined(KWIML_INT_BROKEN_SCNx32) +# define KWIML_INT_SCNx32 SCNx32 +# else +# define KWIML_INT_SCNx32 "x" +# endif +#endif +#if !defined(KWIML_INT_PRIX32) +# if defined(KWIML_INT_HAVE_UINT32_T) && defined(PRIX32) \ + && !defined(KWIML_INT_BROKEN_PRIX32) +# define KWIML_INT_PRIX32 PRIX32 +# else +# define KWIML_INT_PRIX32 "X" +# endif +#endif + +#if defined(__hpux) && defined(__GNUC__) && !defined(__LP64__) \ + && defined(__CONCAT__) && defined(__CONCAT_U__) + /* Some HPs define UINT32_C incorrectly and break GNU. */ +# define KWIML_INT_BROKEN_UINT32_C 1 +#endif + +/* 32-bit constants */ +#if !defined(KWIML_INT_INT32_C) +# if defined(INT32_C) && !defined(KWIML_INT_BROKEN_INT32_C) +# define KWIML_INT_INT32_C(c) INT32_C(c) +# else +# define KWIML_INT_INT32_C(c) c +# endif +#endif +#if !defined(KWIML_INT_UINT32_C) +# if defined(UINT32_C) && !defined(KWIML_INT_BROKEN_UINT32_C) +# define KWIML_INT_UINT32_C(c) UINT32_C(c) +# else +# define KWIML_INT_UINT32_C(c) c ## u +# endif +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_INT_int64_t) && !defined(KWIML_INT_NO_INT64_T) +# if defined(KWIML_INT_HAVE_INT64_T) +# define KWIML_INT_int64_t KWIML_INT_detail_GLOBAL_NS(int64_t) +# elif KWIML_ABI_SIZEOF_LONG == 8 +# define KWIML_INT_int64_t signed long +# elif defined(KWIML_ABI_SIZEOF_LONG_LONG) && KWIML_ABI_SIZEOF_LONG_LONG == 8 +# define KWIML_INT_int64_t signed long long +# elif defined(KWIML_ABI_SIZEOF___INT64) +# define KWIML_INT_int64_t signed __int64 +# elif defined(KWIML_INT_NO_ERROR_INT64_T) +# define KWIML_INT_NO_INT64_T +# else +# error "No type known for 'int64_t'." +# endif +#endif +#if !defined(KWIML_INT_uint64_t) && !defined(KWIML_INT_NO_UINT64_T) +# if defined(KWIML_INT_HAVE_UINT64_T) +# define KWIML_INT_uint64_t KWIML_INT_detail_GLOBAL_NS(uint64_t) +# elif KWIML_ABI_SIZEOF_LONG == 8 +# define KWIML_INT_uint64_t unsigned long +# elif defined(KWIML_ABI_SIZEOF_LONG_LONG) && KWIML_ABI_SIZEOF_LONG_LONG == 8 +# define KWIML_INT_uint64_t unsigned long long +# elif defined(KWIML_ABI_SIZEOF___INT64) +# define KWIML_INT_uint64_t unsigned __int64 +# elif defined(KWIML_INT_NO_ERROR_UINT64_T) +# define KWIML_INT_NO_UINT64_T +# else +# error "No type known for 'uint64_t'." +# endif +#endif + +#if defined(__INTEL_COMPILER) +#elif defined(__BORLANDC__) +# define KWIML_INT_private_NO_FMTLL /* type 'long long' but not 'll' format */ +# define KWIML_INT_BROKEN_INT64_C 1 /* system macro defined incorrectly */ +# define KWIML_INT_BROKEN_UINT64_C 1 /* system macro defined incorrectly */ +#elif defined(_MSC_VER) && _MSC_VER < 1400 +# define KWIML_INT_private_NO_FMTLL /* type 'long long' but not 'll' format */ +#endif + +#if !defined(KWIML_INT_detail_FMT64) +# if KWIML_ABI_SIZEOF_LONG == 8 +# define KWIML_INT_detail_FMT64 "l" +# elif defined(KWIML_ABI_SIZEOF_LONG_LONG) && KWIML_ABI_SIZEOF_LONG_LONG == 8 +# if !defined(KWIML_INT_private_NO_FMTLL) +# define KWIML_INT_detail_FMT64 "ll" +# else +# define KWIML_INT_detail_FMT64 "I64" +# endif +# elif defined(KWIML_ABI_SIZEOF___INT64) +# if defined(__BORLANDC__) +# define KWIML_INT_detail_FMT64 "L" +# else +# define KWIML_INT_detail_FMT64 "I64" +# endif +# endif +#endif + +#undef KWIML_INT_private_NO_FMTLL + +/* 64-bit d, i */ +#if !defined(KWIML_INT_PRId64) +# if defined(KWIML_INT_HAVE_INT64_T) && defined(PRId64) \ + && !defined(KWIML_INT_BROKEN_PRId64) +# define KWIML_INT_PRId64 PRId64 +# elif defined(KWIML_INT_detail_FMT64) +# define KWIML_INT_PRId64 KWIML_INT_detail_FMT64 "d" +# endif +#endif +#if !defined(KWIML_INT_SCNd64) +# if defined(KWIML_INT_HAVE_INT64_T) && defined(SCNd64) \ + && !defined(KWIML_INT_BROKEN_SCNd64) +# define KWIML_INT_SCNd64 SCNd64 +# elif defined(KWIML_INT_detail_FMT64) && !defined(KWIML_INT_private_NO_SCN64) +# define KWIML_INT_SCNd64 KWIML_INT_detail_FMT64 "d" +# endif +#endif +#if !defined(KWIML_INT_PRIi64) +# if defined(KWIML_INT_HAVE_INT64_T) && defined(PRIi64) \ + && !defined(KWIML_INT_BROKEN_PRIi64) +# define KWIML_INT_PRIi64 PRIi64 +# elif defined(KWIML_INT_detail_FMT64) +# define KWIML_INT_PRIi64 KWIML_INT_detail_FMT64 "d" +# endif +#endif +#if !defined(KWIML_INT_SCNi64) +# if defined(KWIML_INT_HAVE_INT64_T) && defined(SCNi64) \ + && !defined(KWIML_INT_BROKEN_SCNi64) +# define KWIML_INT_SCNi64 SCNi64 +# elif defined(KWIML_INT_detail_FMT64) && !defined(KWIML_INT_private_NO_SCN64) +# define KWIML_INT_SCNi64 KWIML_INT_detail_FMT64 "d" +# endif +#endif + +/* 64-bit o, u, x, X */ +#if !defined(KWIML_INT_PRIo64) +# if defined(KWIML_INT_HAVE_UINT64_T) && defined(PRIo64) \ + && !defined(KWIML_INT_BROKEN_PRIo64) +# define KWIML_INT_PRIo64 PRIo64 +# elif defined(KWIML_INT_detail_FMT64) +# define KWIML_INT_PRIo64 KWIML_INT_detail_FMT64 "o" +# endif +#endif +#if !defined(KWIML_INT_SCNo64) +# if defined(KWIML_INT_HAVE_UINT64_T) && defined(SCNo64) \ + && !defined(KWIML_INT_BROKEN_SCNo64) +# define KWIML_INT_SCNo64 SCNo64 +# elif defined(KWIML_INT_detail_FMT64) && !defined(KWIML_INT_private_NO_SCN64) +# define KWIML_INT_SCNo64 KWIML_INT_detail_FMT64 "o" +# endif +#endif +#if !defined(KWIML_INT_PRIu64) +# if defined(KWIML_INT_HAVE_UINT64_T) && defined(PRIu64) \ + && !defined(KWIML_INT_BROKEN_PRIu64) +# define KWIML_INT_PRIu64 PRIu64 +# elif defined(KWIML_INT_detail_FMT64) +# define KWIML_INT_PRIu64 KWIML_INT_detail_FMT64 "u" +# endif +#endif +#if !defined(KWIML_INT_SCNu64) +# if defined(KWIML_INT_HAVE_UINT64_T) && defined(SCNu64) \ + && !defined(KWIML_INT_BROKEN_SCNu64) +# define KWIML_INT_SCNu64 SCNu64 +# elif defined(KWIML_INT_detail_FMT64) && !defined(KWIML_INT_private_NO_SCN64) +# define KWIML_INT_SCNu64 KWIML_INT_detail_FMT64 "u" +# endif +#endif +#if !defined(KWIML_INT_PRIx64) +# if defined(KWIML_INT_HAVE_UINT64_T) && defined(PRIx64) \ + && !defined(KWIML_INT_BROKEN_PRIx64) +# define KWIML_INT_PRIx64 PRIx64 +# elif defined(KWIML_INT_detail_FMT64) +# define KWIML_INT_PRIx64 KWIML_INT_detail_FMT64 "x" +# endif +#endif +#if !defined(KWIML_INT_SCNx64) +# if defined(KWIML_INT_HAVE_UINT64_T) && defined(SCNx64) \ + && !defined(KWIML_INT_BROKEN_SCNx64) +# define KWIML_INT_SCNx64 SCNx64 +# elif defined(KWIML_INT_detail_FMT64) && !defined(KWIML_INT_private_NO_SCN64) +# define KWIML_INT_SCNx64 KWIML_INT_detail_FMT64 "x" +# endif +#endif +#if !defined(KWIML_INT_PRIX64) +# if defined(KWIML_INT_HAVE_UINT64_T) && defined(PRIX64) \ + && !defined(KWIML_INT_BROKEN_PRIX64) +# define KWIML_INT_PRIX64 PRIX64 +# elif defined(KWIML_INT_detail_FMT64) +# define KWIML_INT_PRIX64 KWIML_INT_detail_FMT64 "X" +# endif +#endif + +/* 64-bit constants */ +#if !defined(KWIML_INT_INT64_C) +# if defined(KWIML_INT_HAVE_INT64_T) && defined(INT64_C) \ + && !defined(KWIML_INT_BROKEN_INT64_C) +# define KWIML_INT_INT64_C(c) INT64_C(c) +# elif KWIML_ABI_SIZEOF_LONG == 8 +# define KWIML_INT_INT64_C(c) c ## l +# elif defined(KWIML_ABI_SIZEOF_LONG_LONG) && KWIML_ABI_SIZEOF_LONG_LONG == 8 +# define KWIML_INT_INT64_C(c) c ## ll +# elif defined(KWIML_ABI_SIZEOF___INT64) +# define KWIML_INT_INT64_C(c) c ## i64 +# endif +#endif +#if !defined(KWIML_INT_UINT64_C) +# if defined(KWIML_INT_HAVE_UINT64_T) && defined(UINT64_C) \ + && !defined(KWIML_INT_BROKEN_UINT64_C) +# define KWIML_INT_UINT64_C(c) UINT64_C(c) +# elif KWIML_ABI_SIZEOF_LONG == 8 +# define KWIML_INT_UINT64_C(c) c ## ul +# elif defined(KWIML_ABI_SIZEOF_LONG_LONG) && KWIML_ABI_SIZEOF_LONG_LONG == 8 +# define KWIML_INT_UINT64_C(c) c ## ull +# elif defined(KWIML_ABI_SIZEOF___INT64) +# define KWIML_INT_UINT64_C(c) c ## ui64 +# endif +#endif + +/*--------------------------------------------------------------------------*/ +#if !defined(KWIML_INT_intptr_t) && !defined(KWIML_INT_NO_INTPTR_T) +# if defined(KWIML_INT_HAVE_INTPTR_T) +# define KWIML_INT_intptr_t KWIML_INT_detail_GLOBAL_NS(intptr_t) +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_intptr_t KWIML_INT_int32_t +# elif !defined(KWIML_INT_NO_INT64_T) +# define KWIML_INT_intptr_t KWIML_INT_int64_t +# elif defined(KWIML_INT_NO_ERROR_INTPTR_T) +# define KWIML_INT_NO_INTPTR_T +# else +# error "No type known for 'intptr_t'." +# endif +#endif +#if !defined(KWIML_INT_uintptr_t) && !defined(KWIML_INT_NO_UINTPTR_T) +# if defined(KWIML_INT_HAVE_UINTPTR_T) +# define KWIML_INT_uintptr_t KWIML_INT_detail_GLOBAL_NS(uintptr_t) +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_uintptr_t KWIML_INT_uint32_t +# elif !defined(KWIML_INT_NO_UINT64_T) +# define KWIML_INT_uintptr_t KWIML_INT_uint64_t +# elif defined(KWIML_INT_NO_ERROR_UINTPTR_T) +# define KWIML_INT_NO_UINTPTR_T +# else +# error "No type known for 'uintptr_t'." +# endif +#endif + +#if !defined(KWIML_INT_PRIdPTR) +# if defined(KWIML_INT_HAVE_INTPTR_T) && defined(PRIdPTR) \ + && !defined(KWIML_INT_BROKEN_PRIdPTR) +# define KWIML_INT_PRIdPTR PRIdPTR +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_PRIdPTR KWIML_INT_PRId32 +# elif !defined(KWIML_INT_NO_UINT64_T) +# define KWIML_INT_PRIdPTR KWIML_INT_PRId64 +# endif +#endif +#if !defined(KWIML_INT_SCNdPTR) +# if defined(KWIML_INT_HAVE_INTPTR_T) && defined(SCNdPTR) \ + && !defined(KWIML_INT_BROKEN_SCNdPTR) +# define KWIML_INT_SCNdPTR SCNdPTR +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_SCNdPTR KWIML_INT_SCNd32 +# elif !defined(KWIML_INT_NO_UINT64_T) +# define KWIML_INT_SCNdPTR KWIML_INT_SCNd64 +# endif +#endif +#if !defined(KWIML_INT_PRIiPTR) +# if defined(KWIML_INT_HAVE_INTPTR_T) && defined(PRIiPTR) \ + && !defined(KWIML_INT_BROKEN_PRIiPTR) +# define KWIML_INT_PRIiPTR PRIiPTR +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_PRIiPTR KWIML_INT_PRIi32 +# elif !defined(KWIML_INT_NO_UINT64_T) +# define KWIML_INT_PRIiPTR KWIML_INT_PRIi64 +# endif +#endif +#if !defined(KWIML_INT_SCNiPTR) +# if defined(KWIML_INT_HAVE_INTPTR_T) && defined(SCNiPTR) \ + && !defined(KWIML_INT_BROKEN_SCNiPTR) +# define KWIML_INT_SCNiPTR SCNiPTR +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_SCNiPTR KWIML_INT_SCNi32 +# elif !defined(KWIML_INT_NO_UINT64_T) +# define KWIML_INT_SCNiPTR KWIML_INT_SCNi64 +# endif +#endif + +#if !defined(KWIML_INT_PRIoPTR) +# if defined(KWIML_INT_HAVE_UINTPTR_T) && defined(PRIoPTR) \ + && !defined(KWIML_INT_BROKEN_PRIoPTR) +# define KWIML_INT_PRIoPTR PRIoPTR +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_PRIoPTR KWIML_INT_PRIo32 +# elif !defined(KWIML_INT_NO_UINT64_T) +# define KWIML_INT_PRIoPTR KWIML_INT_PRIo64 +# endif +#endif +#if !defined(KWIML_INT_SCNoPTR) +# if defined(KWIML_INT_HAVE_UINTPTR_T) && defined(SCNoPTR) \ + && !defined(KWIML_INT_BROKEN_SCNoPTR) +# define KWIML_INT_SCNoPTR SCNoPTR +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_SCNoPTR KWIML_INT_SCNo32 +# elif !defined(KWIML_INT_NO_UINT64_T) +# define KWIML_INT_SCNoPTR KWIML_INT_SCNo64 +# endif +#endif +#if !defined(KWIML_INT_PRIuPTR) +# if defined(KWIML_INT_HAVE_UINTPTR_T) && defined(PRIuPTR) \ + && !defined(KWIML_INT_BROKEN_PRIuPTR) +# define KWIML_INT_PRIuPTR PRIuPTR +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_PRIuPTR KWIML_INT_PRIu32 +# elif !defined(KWIML_INT_NO_UINT64_T) +# define KWIML_INT_PRIuPTR KWIML_INT_PRIu64 +# endif +#endif +#if !defined(KWIML_INT_SCNuPTR) +# if defined(KWIML_INT_HAVE_UINTPTR_T) && defined(SCNuPTR) \ + && !defined(KWIML_INT_BROKEN_SCNuPTR) +# define KWIML_INT_SCNuPTR SCNuPTR +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_SCNuPTR KWIML_INT_SCNu32 +# elif !defined(KWIML_INT_NO_UINT64_T) +# define KWIML_INT_SCNuPTR KWIML_INT_SCNu64 +# endif +#endif +#if !defined(KWIML_INT_PRIxPTR) +# if defined(KWIML_INT_HAVE_UINTPTR_T) && defined(PRIxPTR) \ + && !defined(KWIML_INT_BROKEN_PRIxPTR) +# define KWIML_INT_PRIxPTR PRIxPTR +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_PRIxPTR KWIML_INT_PRIx32 +# elif !defined(KWIML_INT_NO_UINT64_T) +# define KWIML_INT_PRIxPTR KWIML_INT_PRIx64 +# endif +#endif +#if !defined(KWIML_INT_SCNxPTR) +# if defined(KWIML_INT_HAVE_UINTPTR_T) && defined(SCNxPTR) \ + && !defined(KWIML_INT_BROKEN_SCNxPTR) +# define KWIML_INT_SCNxPTR SCNxPTR +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_SCNxPTR KWIML_INT_SCNx32 +# elif !defined(KWIML_INT_NO_UINT64_T) +# define KWIML_INT_SCNxPTR KWIML_INT_SCNx64 +# endif +#endif +#if !defined(KWIML_INT_PRIXPTR) +# if defined(KWIML_INT_HAVE_UINTPTR_T) && defined(PRIXPTR) \ + && !defined(KWIML_INT_BROKEN_PRIXPTR) +# define KWIML_INT_PRIXPTR PRIXPTR +# elif KWIML_ABI_SIZEOF_DATA_PTR == 4 +# define KWIML_INT_PRIXPTR KWIML_INT_PRIX32 +# elif !defined(KWIML_INT_NO_UINT64_T) +# define KWIML_INT_PRIXPTR KWIML_INT_PRIX64 +# endif +#endif + +#undef KWIML_INT_private_NO_SCN64 +#undef KWIML_INT_private_NO_SCN8 + +#endif /* KWIML_INT_private_DO_DEFINE */ + +/*--------------------------------------------------------------------------*/ +#ifdef KWIML_INT_private_DO_VERIFY +#undef KWIML_INT_private_DO_VERIFY + +#if defined(_MSC_VER) +# pragma warning (push) +# pragma warning (disable:4310) /* cast truncates constant value */ +#endif + +#define KWIML_INT_private_VERIFY(n, x, y) KWIML_INT_private_VERIFY_0(KWIML_INT_private_VERSION, n, x, y) +#define KWIML_INT_private_VERIFY_0(V, n, x, y) KWIML_INT_private_VERIFY_1(V, n, x, y) +#define KWIML_INT_private_VERIFY_1(V, n, x, y) extern int (*n##_v##V)[x]; extern int (*n##_v##V)[y] + +#define KWIML_INT_private_VERIFY_BOOL(m, b) KWIML_INT_private_VERIFY(KWIML_INT_detail_VERIFY_##m, 2, (b)?2:3) +#define KWIML_INT_private_VERIFY_TYPE(t, s) KWIML_INT_private_VERIFY(KWIML_INT_detail_VERIFY_##t, s, sizeof(t)) +#define KWIML_INT_private_VERIFY_SIGN(t, u, o) KWIML_INT_private_VERIFY_BOOL(SIGN_##t, (t)((u)1 << ((sizeof(t)<<3)-1)) o 0) + +KWIML_INT_private_VERIFY_TYPE(KWIML_INT_int8_t, 1); +KWIML_INT_private_VERIFY_TYPE(KWIML_INT_uint8_t, 1); +KWIML_INT_private_VERIFY_TYPE(KWIML_INT_int16_t, 2); +KWIML_INT_private_VERIFY_TYPE(KWIML_INT_uint16_t, 2); +KWIML_INT_private_VERIFY_TYPE(KWIML_INT_int32_t, 4); +KWIML_INT_private_VERIFY_TYPE(KWIML_INT_uint32_t, 4); +#if !defined(KWIML_INT_NO_INT64_T) +KWIML_INT_private_VERIFY_TYPE(KWIML_INT_int64_t, 8); +#endif +#if !defined(KWIML_INT_NO_UINT64_T) +KWIML_INT_private_VERIFY_TYPE(KWIML_INT_uint64_t, 8); +#endif +#if !defined(KWIML_INT_NO_INTPTR_T) +KWIML_INT_private_VERIFY_TYPE(KWIML_INT_intptr_t, sizeof(void*)); +#endif +#if !defined(KWIML_INT_NO_UINTPTR_T) +KWIML_INT_private_VERIFY_TYPE(KWIML_INT_uintptr_t, sizeof(void*)); +#endif + +KWIML_INT_private_VERIFY_SIGN(KWIML_INT_int8_t, KWIML_INT_uint8_t, <); +KWIML_INT_private_VERIFY_SIGN(KWIML_INT_uint8_t, KWIML_INT_uint8_t, >); +KWIML_INT_private_VERIFY_SIGN(KWIML_INT_int16_t, KWIML_INT_uint16_t, <); +KWIML_INT_private_VERIFY_SIGN(KWIML_INT_uint16_t, KWIML_INT_uint16_t, >); +KWIML_INT_private_VERIFY_SIGN(KWIML_INT_int32_t, KWIML_INT_uint32_t, <); +KWIML_INT_private_VERIFY_SIGN(KWIML_INT_uint32_t, KWIML_INT_uint32_t, >); +#if !defined(KWIML_INT_NO_INT64_T) +KWIML_INT_private_VERIFY_SIGN(KWIML_INT_int64_t, KWIML_INT_uint64_t, <); +#endif +#if !defined(KWIML_INT_NO_UINT64_T) +KWIML_INT_private_VERIFY_SIGN(KWIML_INT_uint64_t, KWIML_INT_uint64_t, >); +#endif +#if !defined(KWIML_INT_NO_INTPTR_T) +KWIML_INT_private_VERIFY_SIGN(KWIML_INT_intptr_t, KWIML_INT_uintptr_t, <); +#endif +#if !defined(KWIML_INT_NO_UINTPTR_T) +KWIML_INT_private_VERIFY_SIGN(KWIML_INT_uintptr_t, KWIML_INT_uintptr_t, >); +#endif + +#undef KWIML_INT_private_VERIFY_SIGN +#undef KWIML_INT_private_VERIFY_TYPE +#undef KWIML_INT_private_VERIFY_BOOL + +#undef KWIML_INT_private_VERIFY_1 +#undef KWIML_INT_private_VERIFY_0 +#undef KWIML_INT_private_VERIFY + +#if defined(_MSC_VER) +# pragma warning (pop) +#endif + +#endif /* KWIML_INT_private_DO_VERIFY */ + +#undef KWIML_INT_private_VERSION diff --git a/src/kwiml-config.cmake.in b/src/kwiml-config.cmake.in new file mode 100644 index 000000000..124f0fc55 --- /dev/null +++ b/src/kwiml-config.cmake.in @@ -0,0 +1 @@ +include(${CMAKE_CURRENT_LIST_DIR}/kwiml-targets.cmake) diff --git a/src/version.h.in b/src/version.h.in new file mode 100644 index 000000000..e58e0dce3 --- /dev/null +++ b/src/version.h.in @@ -0,0 +1,59 @@ +/*============================================================================ + Kitware Information Macro Library + Copyright 2010-2015 Kitware, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Kitware, Inc. nor the names of its contributors + may be used to endorse or promote products derived from this + software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +============================================================================*/ +#ifndef KWIML_VERSION_H +#define KWIML_VERSION_H +/* +This header defines macros with information about this version of KWIML. + +An includer may test the following macros after inclusion: + + KWIML_VERSION = KWIML version number encoded in an integer as + `printf("%d%03d%03d", MAJOR, MINOR, PATCH)`. + MAJOR is incremented on incompatible changes. + MINOR is incremented on interface additions. + PATCH is incremented on implementation updates. + + KWIML_VERSION_STRING = KWIML version number in string formatted as + `printf("%d.%d.%d", MAJOR, MINOR PATCH)`. + + KWIML_VERSION_HAS_ABI_H = header 'kwiml/abi.h' is available + KWIML_VERSION_HAS_INT_H = header 'kwiml/int.h' is available +*/ + +#define KWIML_VERSION @KWIML_VERSION_DECIMAL@ +#define KWIML_VERSION_STRING "@KWIML_VERSION@" + +#define KWIML_VERSION_HAS_ABI_H 1 +#define KWIML_VERSION_HAS_INT_H 1 + +#endif diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 000000000..4f6f37b4f --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,54 @@ +# +# Copyright Kitware, Inc. +# Distributed under the OSI-approved BSD 3-Clause License. +# See accompanying file Copyright.txt for details. +# +if(NOT KWIML_TEST_PREFIX) + set(KWIML_TEST_PREFIX kwiml) +endif() + +# Suppress printf/scanf format warnings; we test if the sizes match. +foreach(lang C CXX) + if(KWIML_LANGUAGE_${lang} AND CMAKE_${lang}_COMPILER_ID STREQUAL "GNU") + set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} -Wno-format") + endif() +endforeach() + +if(KWIML_LANGUAGE_C) + set(test_srcs test.c) +else() + set(test_srcs test.cxx) +endif() +if(KWIML_LANGUAGE_C) + list(APPEND test_defs KWIML_LANGUAGE_C) + list(APPEND test_srcs + test_abi_C.c + test_int_C.c + test_include_C.c + ) +endif() +if(KWIML_LANGUAGE_CXX) + list(APPEND test_defs KWIML_LANGUAGE_CXX) + list(APPEND test_srcs + test_abi_CXX.cxx + test_int_CXX.cxx + test_include_CXX.cxx + ) +endif() + +add_executable(kwiml_test ${test_srcs}) +set_property(TARGET kwiml_test PROPERTY COMPILE_DEFINITIONS ${test_defs}) +set_property(TARGET kwiml_test PROPERTY + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +add_test(NAME ${KWIML_TEST_PREFIX}.test COMMAND kwiml_test) +set_property(TEST ${KWIML_TEST_PREFIX}.test PROPERTY LABELS ${KWIML_TEST_LABELS}) + +# Xcode 2.x forgets to create the output directory before linking +# the individual architectures. +if(CMAKE_OSX_ARCHITECTURES AND XCODE + AND NOT "${XCODE_VERSION}" MATCHES "^[^12]") + add_custom_command( + TARGET kwiml_test + PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}" + ) +endif() diff --git a/test/test.c b/test/test.c new file mode 100644 index 000000000..5f5b5d776 --- /dev/null +++ b/test/test.c @@ -0,0 +1,33 @@ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ +#ifdef __cplusplus +extern "C" { +#endif +extern int test_abi_C(void); +extern int test_int_C(void); +extern int test_abi_CXX(void); +extern int test_int_CXX(void); +extern int test_include_C(void); +extern int test_include_CXX(void); +#ifdef __cplusplus +} // extern "C" +#endif + +int main(void) +{ + int result = 1; +#ifdef KWIML_LANGUAGE_C + result = test_abi_C() && result; + result = test_int_C() && result; + result = test_include_C() && result; +#endif +#ifdef KWIML_LANGUAGE_CXX + result = test_abi_CXX() && result; + result = test_int_CXX() && result; + result = test_include_CXX() && result; +#endif + return result? 0 : 1; +} diff --git a/test/test.cxx b/test/test.cxx new file mode 100644 index 000000000..464325ba4 --- /dev/null +++ b/test/test.cxx @@ -0,0 +1,6 @@ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ +#include "test.c" diff --git a/test/test.h b/test/test.h new file mode 100644 index 000000000..44add3faf --- /dev/null +++ b/test/test.h @@ -0,0 +1,16 @@ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ +#ifndef KWIML_TEST_H +#define KWIML_TEST_H + +/* Quiet MS standard library deprecation warnings. */ +#ifndef _CRT_SECURE_NO_DEPRECATE +# define _CRT_SECURE_NO_DEPRECATE +#endif + +#else +# error "test.h included multiple times." +#endif diff --git a/test/test_abi_C.c b/test/test_abi_C.c new file mode 100644 index 000000000..18b639f4a --- /dev/null +++ b/test/test_abi_C.c @@ -0,0 +1,19 @@ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ +#include "test.h" +#include "../include/kwiml/abi.h" +#include "test_abi_endian.h" +#ifndef KWIML_ABI_VERSION +# error "KWIML_ABI_VERSION not defined!" +#endif +int test_abi_C(void) +{ + if(!test_abi_endian()) + { + return 0; + } + return 1; +} diff --git a/test/test_abi_CXX.cxx b/test/test_abi_CXX.cxx new file mode 100644 index 000000000..e8feb44d2 --- /dev/null +++ b/test/test_abi_CXX.cxx @@ -0,0 +1,19 @@ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ +#include "test.h" +#include "../include/kwiml/abi.h" +#include "test_abi_endian.h" +#ifndef KWIML_ABI_VERSION +# error "KWIML_ABI_VERSION not defined!" +#endif +extern "C" int test_abi_CXX(void) +{ + if(!test_abi_endian()) + { + return 0; + } + return 1; +} diff --git a/test/test_abi_endian.h b/test/test_abi_endian.h new file mode 100644 index 000000000..334b018a1 --- /dev/null +++ b/test/test_abi_endian.h @@ -0,0 +1,41 @@ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ +#include + +#ifdef __cplusplus +# define LANG "C++ " +#else +# define LANG "C " +#endif + +static int test_abi_endian(void) +{ + int result = 1; + { +#if defined(KWIML_ABI_ENDIAN_ID) + int expect; + union { short s; unsigned char c[sizeof(short)]; } x; + x.s = 1; + expect = (x.c[0] == 1 ? + KWIML_ABI_ENDIAN_ID_LITTLE : KWIML_ABI_ENDIAN_ID_BIG); + printf(LANG "KWIML_ABI_ENDIAN_ID: expected [%d], got [%d]", + expect, KWIML_ABI_ENDIAN_ID); + if(KWIML_ABI_ENDIAN_ID == expect) + { + printf(", PASSED\n"); + } + else + { + printf(", FAILED\n"); + result = 0; + } +#else + printf(LANG "KWIML_ABI_ENDIAN_ID: unknown, FAILED\n"); + result = 0; +#endif + } + return result; +} diff --git a/test/test_include_C.c b/test/test_include_C.c new file mode 100644 index 000000000..518544d25 --- /dev/null +++ b/test/test_include_C.c @@ -0,0 +1,16 @@ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ +#include + +/* Test KWIML header inclusion after above system headers. */ +#include "test.h" +#include "../include/kwiml/abi.h" +#include "../include/kwiml/int.h" + +int test_include_C(void) +{ + return 1; +} diff --git a/test/test_include_CXX.cxx b/test/test_include_CXX.cxx new file mode 100644 index 000000000..82aa54616 --- /dev/null +++ b/test/test_include_CXX.cxx @@ -0,0 +1,22 @@ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ +#include + +#if defined(_MSC_VER) && defined(NDEBUG) +// Use C++ runtime to avoid linker warning: +// warning LNK4089: all references to 'MSVCP71.dll' discarded by /OPT:REF +std::string test_include_CXX_use_stl_string; +#endif + +/* Test KWIML header inclusion after above system headers. */ +#include "test.h" +#include "../include/kwiml/abi.h" +#include "../include/kwiml/int.h" + +extern "C" int test_include_CXX(void) +{ + return 1; +} diff --git a/test/test_int_C.c b/test/test_int_C.c new file mode 100644 index 000000000..fe8ee8e3c --- /dev/null +++ b/test/test_int_C.c @@ -0,0 +1,19 @@ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ +#include "test.h" +#include "../include/kwiml/int.h" +#include "test_int_format.h" +#ifndef KWIML_INT_VERSION +# error "KWIML_INT_VERSION not defined!" +#endif +int test_int_C(void) +{ + if(!test_int_format()) + { + return 0; + } + return 1; +} diff --git a/test/test_int_CXX.cxx b/test/test_int_CXX.cxx new file mode 100644 index 000000000..ffa4c9b08 --- /dev/null +++ b/test/test_int_CXX.cxx @@ -0,0 +1,19 @@ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ +#include "test.h" +#include "../include/kwiml/int.h" +#include "test_int_format.h" +#ifndef KWIML_INT_VERSION +# error "KWIML_INT_VERSION not defined!" +#endif +extern "C" int test_int_CXX(void) +{ + if(!test_int_format()) + { + return 0; + } + return 1; +} diff --git a/test/test_int_format.h b/test/test_int_format.h new file mode 100644 index 000000000..24dcdfba6 --- /dev/null +++ b/test/test_int_format.h @@ -0,0 +1,203 @@ +/* + Copyright Kitware, Inc. + Distributed under the OSI-approved BSD 3-Clause License. + See accompanying file Copyright.txt for details. +*/ +#include +#include + +#if defined(_MSC_VER) +# pragma warning (push) +# pragma warning (disable:4310) /* cast truncates constant value */ +#endif + +#ifdef __cplusplus +# define LANG "C++ " +#else +# define LANG "C " +#endif + +#define VALUE(T, U) (T)((U)0xab << ((sizeof(T)-1)<<3)) + +#define TEST_C_(C, V, PRI, T, U) \ + { \ + T const x = VALUE(T, U); \ + T y = C(V); \ + printf(LANG #C ":" \ + " expression [%" KWIML_INT_PRI##PRI "]," \ + " literal [%" KWIML_INT_PRI##PRI "]", x, y); \ + if(x == y) \ + { \ + printf(", PASSED\n"); \ + } \ + else \ + { \ + printf(", FAILED\n"); \ + result = 0; \ + } \ + } + +#define TEST_PRI_(PRI, T, U, STR) \ + { \ + T const x = VALUE(T, U); \ + char const* str = STR; \ + sprintf(buf, "%" KWIML_INT_PRI##PRI, x); \ + printf(LANG "KWIML_INT_PRI" #PRI ":" \ + " expected [%s], got [%s]", str, buf); \ + if(strcmp(str, buf) == 0) \ + { \ + printf(", PASSED\n"); \ + } \ + else \ + { \ + printf(", FAILED\n"); \ + result = 0; \ + } \ + } + +#define TEST_SCN_(SCN, T, U, STR) TEST_SCN2_(SCN, SCN, T, U, STR) +#define TEST_SCN2_(PRI, SCN, T, U, STR) \ + { \ + T const x = VALUE(T, U); \ + T y; \ + char const* str = STR; \ + if(sscanf(str, "%" KWIML_INT_SCN##SCN, &y) != 1) \ + { \ + y = 0; \ + } \ + printf(LANG "KWIML_INT_SCN" #SCN ":" \ + " expected [%" KWIML_INT_PRI##PRI "]," \ + " got [%" KWIML_INT_PRI##PRI "]", x, y); \ + if(x == y) \ + { \ + printf(", PASSED\n"); \ + } \ + else \ + { \ + printf(", FAILED\n"); \ + result = 0; \ + } \ + } + +#define TEST_(FMT, T, U, STR) TEST2_(FMT, FMT, T, U, STR) +#define TEST2_(PRI, SCN, T, U, STR) \ + TEST_PRI_(PRI, T, U, STR) \ + TEST_SCN2_(PRI, SCN, T, U, STR) + +/* Concatenate T and U now to avoid expanding them. */ +#define TEST(FMT, T, U, STR) \ + TEST_(FMT, KWIML_INT_##T, KWIML_INT_##U, STR) +#define TEST2(PRI, SCN, T, U, STR) \ + TEST2_(PRI, SCN, KWIML_INT_##T, KWIML_INT_##U, STR) +#define TEST_C(C, V, PRI, T, U) \ + TEST_C_(KWIML_INT_##C, V, PRI, KWIML_INT_##T, KWIML_INT_##U) +#define TEST_PRI(PRI, T, U, STR) \ + TEST_PRI_(PRI, KWIML_INT_##T, KWIML_INT_##U, STR) +#define TEST_SCN(SCN, T, U, STR) \ + TEST_SCN_(SCN, KWIML_INT_##T, KWIML_INT_##U, STR) +#define TEST_SCN2(PRI, SCN, T, U, STR) \ + TEST_SCN2_(PRI, SCN, KWIML_INT_##T, KWIML_INT_##U, STR) + +static int test_int_format(void) +{ + int result = 1; + char buf[256]; + TEST_PRI(i8, int8_t, uint8_t, "-85") +#if defined(KWIML_INT_SCNi8) + TEST_SCN(i8, int8_t, uint8_t, "-85") +#endif + TEST_PRI(d8, int8_t, uint8_t, "-85") +#if defined(KWIML_INT_SCNd8) + TEST_SCN(d8, int8_t, uint8_t, "-85") +#endif + TEST_PRI(o8, uint8_t, uint8_t, "253") +#if defined(KWIML_INT_SCNo8) + TEST_SCN(o8, uint8_t, uint8_t, "253") +#endif + TEST_PRI(u8, uint8_t, uint8_t, "171") +#if defined(KWIML_INT_SCNu8) + TEST_SCN(u8, uint8_t, uint8_t, "171") +#endif + TEST_PRI(x8, uint8_t, uint8_t, "ab") + TEST_PRI(X8, uint8_t, uint8_t, "AB") +#if defined(KWIML_INT_SCNx8) + TEST_SCN(x8, uint8_t, uint8_t, "ab") + TEST_SCN2(X8, x8, uint8_t, uint8_t, "AB") +#endif + + TEST(i16, int16_t, uint16_t, "-21760") + TEST(d16, int16_t, uint16_t, "-21760") + TEST(o16, uint16_t, uint16_t, "125400") + TEST(u16, uint16_t, uint16_t, "43776") + TEST(x16, uint16_t, uint16_t, "ab00") + TEST2(X16, x16, uint16_t, uint16_t, "AB00") + + TEST(i32, int32_t, uint32_t, "-1426063360") + TEST(d32, int32_t, uint32_t, "-1426063360") + TEST(o32, uint32_t, uint32_t, "25300000000") + TEST(u32, uint32_t, uint32_t, "2868903936") + TEST(x32, uint32_t, uint32_t, "ab000000") + TEST2(X32, x32, uint32_t, uint32_t, "AB000000") + + TEST_PRI(i64, int64_t, uint64_t, "-6124895493223874560") +#if defined(KWIML_INT_SCNi64) + TEST_SCN(i64, int64_t, uint64_t, "-6124895493223874560") +#endif + TEST_PRI(d64, int64_t, uint64_t, "-6124895493223874560") +#if defined(KWIML_INT_SCNd64) + TEST_SCN(d64, int64_t, uint64_t, "-6124895493223874560") +#endif + TEST_PRI(o64, uint64_t, uint64_t, "1254000000000000000000") +#if defined(KWIML_INT_SCNo64) + TEST_SCN(o64, uint64_t, uint64_t, "1254000000000000000000") +#endif + TEST_PRI(u64, uint64_t, uint64_t, "12321848580485677056") +#if defined(KWIML_INT_SCNu64) + TEST_SCN(u64, uint64_t, uint64_t, "12321848580485677056") +#endif + TEST_PRI(x64, uint64_t, uint64_t, "ab00000000000000") + TEST_PRI(X64, uint64_t, uint64_t, "AB00000000000000") +#if defined(KWIML_INT_SCNx64) + TEST_SCN(x64, uint64_t, uint64_t, "ab00000000000000") + TEST_SCN2(X64, x64, uint64_t, uint64_t, "AB00000000000000") +#endif + +#if !defined(KWIML_INT_NO_INTPTR_T) +# if KWIML_ABI_SIZEOF_DATA_PTR == 4 + TEST(iPTR, intptr_t, uint32_t, "-1426063360") + TEST(dPTR, intptr_t, uint32_t, "-1426063360") +# else + TEST(iPTR, intptr_t, uint64_t, "-6124895493223874560") + TEST(dPTR, intptr_t, uint64_t, "-6124895493223874560") +# endif +#endif + +#if !defined(KWIML_INT_NO_UINTPTR_T) +# if KWIML_ABI_SIZEOF_DATA_PTR == 4 + TEST(oPTR, uintptr_t, uintptr_t, "25300000000") + TEST(uPTR, uintptr_t, uintptr_t, "2868903936") + TEST(xPTR, uintptr_t, uintptr_t, "ab000000") + TEST2(XPTR, xPTR, uintptr_t, uintptr_t, "AB000000") +# else + TEST(oPTR, uintptr_t, uintptr_t, "1254000000000000000000") + TEST(uPTR, uintptr_t, uintptr_t, "12321848580485677056") + TEST(xPTR, uintptr_t, uintptr_t, "ab00000000000000") + TEST2(XPTR, xPTR, uintptr_t, uintptr_t, "AB00000000000000") +# endif +#endif + + TEST_C(INT8_C, -0x55, i8, int8_t, uint8_t) + TEST_C(UINT8_C, 0xAB, u8, uint8_t, uint8_t) + TEST_C(INT16_C, -0x5500, i16, int16_t, uint16_t) + TEST_C(UINT16_C, 0xAB00, u16, uint16_t, uint16_t) + TEST_C(INT32_C, -0x55000000, i32, int32_t, uint32_t) + TEST_C(UINT32_C, 0xAB000000, u32, uint32_t, uint32_t) + TEST_C(INT64_C, -0x5500000000000000, i64, int64_t, uint64_t) + TEST_C(UINT64_C, 0xAB00000000000000, u64, uint64_t, uint64_t) + + return result; +} + +#if defined(_MSC_VER) +# pragma warning (pop) +#endif From 0a31fdabecd2724d456aef0664ad7da1ca28f359 Mon Sep 17 00:00:00 2001 From: Roger Leigh Date: Thu, 17 Dec 2015 21:46:58 +0000 Subject: [PATCH 082/255] FindBoost: Add support for Boost 1.60 --- Modules/FindBoost.cmake | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index e517a6a4e..edfed8e82 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -707,6 +707,20 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_TIMER_DEPENDENCIES chrono system) set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 106000 AND Boost_VERSION VERSION_LESS 106100) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_COROUTINE_DEPENDENCIES context system) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_RANDOM_DEPENDENCIES system) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) else() message(WARNING "Imported targets not available for Boost version ${Boost_VERSION}") set(_Boost_IMPORTED_TARGETS FALSE) @@ -807,7 +821,7 @@ else() # information in _Boost_COMPONENT_DEPENDENCIES. See the # instructions at the top of _Boost_COMPONENT_DEPENDENCIES. set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS} - + "1.60.0" "1.60" "1.59.0" "1.59" "1.58.0" "1.58" "1.57.0" "1.57" "1.56.0" "1.56" "1.55.0" "1.55" "1.54.0" "1.54" "1.53.0" "1.53" "1.52.0" "1.52" "1.51.0" "1.51" "1.50.0" "1.50" "1.49.0" "1.49" "1.48.0" "1.48" "1.47.0" "1.47" "1.46.1" From 614c8a1c920083c3ae76ff035168f7096db6c510 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 18 Dec 2015 00:01:07 -0500 Subject: [PATCH 083/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 8fe4618bb..75151390e 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20151217) +set(CMake_VERSION_PATCH 20151218) #set(CMake_VERSION_RC 1) From 036b6ef7c47ccb19f291d2f36df37aaf885b4ba8 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 17 Dec 2015 15:03:42 -0500 Subject: [PATCH 084/255] Port CMake from cmIML to KWIML KWIML no longer uses a configured prefix. --- CMakeLists.txt | 6 +++--- CTestCustom.cmake.in | 2 +- Source/cmAlgorithms.h | 4 ++-- Source/cmELF.cxx | 11 ++++------- Source/cmFileCommand.cxx | 4 ++-- Source/cmFindPackageCommand.h | 2 +- Source/cmLocalGenerator.cxx | 4 ++-- Source/cmLocalGenerator.h | 4 ++-- Source/cmStandardIncludes.h | 2 +- Source/cmVersion.h | 2 +- Source/cm_sha2.c | 13 ++++++------- Source/cm_sha2.h | 10 +++++----- Utilities/cm_kwiml.h | 18 ++++++++++++++++++ bootstrap | 19 ++----------------- 14 files changed, 50 insertions(+), 51 deletions(-) create mode 100644 Utilities/cm_kwiml.h diff --git a/CMakeLists.txt b/CMakeLists.txt index ebee14b66..932d07e7b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -538,9 +538,9 @@ if("x${CMAKE_TESTS_CDASH_SERVER}" STREQUAL "x") set(CMAKE_TESTS_CDASH_SERVER "http://open.cdash.org") endif() -# Create the KWIML library for CMake. -set(KWIML cmIML) -set(KWIML_HEADER_ROOT ${CMake_BINARY_DIR}/Utilities) +if(BUILD_TESTING) + set(KWIML_TEST_ENABLE 1) +endif() add_subdirectory(Utilities/KWIML) if(NOT CMake_TEST_EXTERNAL_CMAKE) diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index 2adf317a6..db64559bb 100644 --- a/CTestCustom.cmake.in +++ b/CTestCustom.cmake.in @@ -36,7 +36,7 @@ list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION "LINK : warning LNK4089: all references to.*SHELL32.dll.*discarded by /OPT:REF" "LINK : warning LNK4089: all references to.*USER32.dll.*discarded by /OPT:REF" "LINK : warning LNK4089: all references to.*ole32.dll.*discarded by /OPT:REF" - "Warning.*: .*/Utilities/KWIML/test/test_INT_format.h.* # Redundant preprocessing concatenation" + "Warning.*: .*/Utilities/KWIML/test/test_int_format.h.* # Redundant preprocessing concatenation" "Warning: library was too large for page size.*" "Warning: public.*_archive_.*in module.*archive_*clashes with prior module.*archive_.*" "Warning: public.*BZ2_bz.*in module.*bzlib.*clashes with prior module.*bzlib.*" diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index bda933bc3..ef607d212 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -162,13 +162,13 @@ struct cmRange const_iterator end() const { return End; } bool empty() const { return std::distance(Begin, End) == 0; } difference_type size() const { return std::distance(Begin, End); } - cmRange& advance(cmIML_INT_intptr_t amount) + cmRange& advance(KWIML_INT_intptr_t amount) { std::advance(Begin, amount); return *this; } - cmRange& retreat(cmIML_INT_intptr_t amount) + cmRange& retreat(KWIML_INT_intptr_t amount) { std::advance(End, -amount); return *this; diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx index fda6e023d..b480cd53b 100644 --- a/Source/cmELF.cxx +++ b/Source/cmELF.cxx @@ -15,9 +15,6 @@ #include #include -// Need the native byte order of the running CPU. -#include - // Include the ELF format information system header. #if defined(__OpenBSD__) # include @@ -101,9 +98,9 @@ public: // In most cases the processor-specific byte order will match that // of the target execution environment. If we choose wrong here // it is fixed when the header is read. -#if cmIML_ABI_ENDIAN_ID == cmIML_ABI_ENDIAN_ID_LITTLE +#if KWIML_ABI_ENDIAN_ID == KWIML_ABI_ENDIAN_ID_LITTLE this->NeedSwap = (this->ByteOrder == ByteOrderMSB); -#elif cmIML_ABI_ENDIAN_ID == cmIML_ABI_ENDIAN_ID_BIG +#elif KWIML_ABI_ENDIAN_ID == KWIML_ABI_ENDIAN_ID_BIG this->NeedSwap = (this->ByteOrder == ByteOrderLSB); #else this->NeedSwap = false; // Final decision is at runtime anyway. @@ -197,7 +194,7 @@ struct cmELFTypes32 typedef Elf32_Shdr ELF_Shdr; typedef Elf32_Dyn ELF_Dyn; typedef Elf32_Half ELF_Half; - typedef cmIML_INT_uint32_t tagtype; + typedef KWIML_INT_uint32_t tagtype; static const char* GetName() { return "32-bit"; } }; @@ -208,7 +205,7 @@ struct cmELFTypes64 typedef Elf64_Shdr ELF_Shdr; typedef Elf64_Dyn ELF_Dyn; typedef Elf64_Half ELF_Half; - typedef cmIML_INT_uint64_t tagtype; + typedef KWIML_INT_uint64_t tagtype; static const char* GetName() { return "64-bit"; } }; diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index df95d9dd6..b3557f9a2 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -2811,8 +2811,8 @@ namespace { case CURLINFO_SSL_DATA_OUT: { char buf[128]; - int n = sprintf(buf, "[%" cmIML_INT_PRIu64 " bytes data]\n", - static_cast(size)); + int n = sprintf(buf, "[%" KWIML_INT_PRIu64 " bytes data]\n", + static_cast(size)); if (n > 0) { vec->insert(vec->end(), buf, buf + n); diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h index 3eee40421..8bfd4051e 100644 --- a/Source/cmFindPackageCommand.h +++ b/Source/cmFindPackageCommand.h @@ -130,7 +130,7 @@ private: unsigned int VersionFoundPatch; unsigned int VersionFoundTweak; unsigned int VersionFoundCount; - cmIML_INT_uint64_t RequiredCMakeVersion; + KWIML_INT_uint64_t RequiredCMakeVersion; bool Quiet; bool Required; bool UseConfigFiles; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 6a57374f0..1d17032d8 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2980,7 +2980,7 @@ cmLocalGenerator::GetTargetDirectory(const cmGeneratorTarget*) const } //---------------------------------------------------------------------------- -cmIML_INT_uint64_t cmLocalGenerator::GetBackwardsCompatibility() +KWIML_INT_uint64_t cmLocalGenerator::GetBackwardsCompatibility() { // The computed version may change until the project is fully // configured. @@ -3033,7 +3033,7 @@ bool cmLocalGenerator::NeedBackwardsCompatibility_2_4() // Compatibility is needed if CMAKE_BACKWARDS_COMPATIBILITY is set // equal to or lower than the given version. - cmIML_INT_uint64_t actual_compat = this->GetBackwardsCompatibility(); + KWIML_INT_uint64_t actual_compat = this->GetBackwardsCompatibility(); return (actual_compat && actual_compat <= CMake_VERSION_ENCODE(2, 4, 255)); } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index e2f551976..68e766741 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -267,7 +267,7 @@ public: * * and is monotonically increasing with the CMake version. */ - cmIML_INT_uint64_t GetBackwardsCompatibility(); + KWIML_INT_uint64_t GetBackwardsCompatibility(); /** * Test whether compatibility is set to a given version or lower. @@ -390,7 +390,7 @@ protected: // committed. std::string TargetImplib; - cmIML_INT_uint64_t BackwardsCompatibility; + KWIML_INT_uint64_t BackwardsCompatibility; bool BackwardsCompatibilityFinal; private: void AddSharedFlags(std::string& flags, const std::string& lang, diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h index aed2e7456..272c1361d 100644 --- a/Source/cmStandardIncludes.h +++ b/Source/cmStandardIncludes.h @@ -31,7 +31,7 @@ #endif // Provide fixed-size integer types. -#include +#include #include #include diff --git a/Source/cmVersion.h b/Source/cmVersion.h index 0ab639051..84f750f19 100644 --- a/Source/cmVersion.h +++ b/Source/cmVersion.h @@ -34,7 +34,7 @@ public: /* Encode with room for up to 1000 minor releases between major releases and to encode dates until the year 10000 in the patch level. */ -#define CMake_VERSION_ENCODE__BASE cmIML_INT_UINT64_C(100000000) +#define CMake_VERSION_ENCODE__BASE KWIML_INT_UINT64_C(100000000) #define CMake_VERSION_ENCODE(major, minor, patch) \ ((((major) * 1000u) * CMake_VERSION_ENCODE__BASE) + \ (((minor) % 1000u) * CMake_VERSION_ENCODE__BASE) + \ diff --git a/Source/cm_sha2.c b/Source/cm_sha2.c index b90e060ef..649c39aaf 100644 --- a/Source/cm_sha2.c +++ b/Source/cm_sha2.c @@ -87,22 +87,21 @@ * made). */ #if !defined(BYTE_ORDER) || (BYTE_ORDER != LITTLE_ENDIAN && BYTE_ORDER != BIG_ENDIAN) -/* CMake modification: use byte order from cmIML. */ -# include "cmIML/ABI.h" +/* CMake modification: use byte order from KWIML. */ # undef BYTE_ORDER # undef BIG_ENDIAN # undef LITTLE_ENDIAN -# define BYTE_ORDER cmIML_ABI_ENDIAN_ID -# define BIG_ENDIAN cmIML_ABI_ENDIAN_ID_BIG -# define LITTLE_ENDIAN cmIML_ABI_ENDIAN_ID_LITTLE +# define BYTE_ORDER KWIML_ABI_ENDIAN_ID +# define BIG_ENDIAN KWIML_ABI_ENDIAN_ID_BIG +# define LITTLE_ENDIAN KWIML_ABI_ENDIAN_ID_LITTLE #endif /* CMake modification: use types computed in header. */ typedef cm_sha2_uint8_t sha_byte; /* Exactly 1 byte */ typedef cm_sha2_uint32_t sha_word32; /* Exactly 4 bytes */ typedef cm_sha2_uint64_t sha_word64; /* Exactly 8 bytes */ -#define SHA_UINT32_C(x) cmIML_INT_UINT32_C(x) -#define SHA_UINT64_C(x) cmIML_INT_UINT64_C(x) +#define SHA_UINT32_C(x) KWIML_INT_UINT32_C(x) +#define SHA_UINT64_C(x) KWIML_INT_UINT64_C(x) #if defined(__clang__) # pragma clang diagnostic ignored "-Wcast-align" #endif diff --git a/Source/cm_sha2.h b/Source/cm_sha2.h index 71395f06b..f1510318c 100644 --- a/Source/cm_sha2.h +++ b/Source/cm_sha2.h @@ -38,11 +38,11 @@ #include "cm_sha2_mangle.h" -/* CMake modification: use integer types from cmIML. */ -#include "cmIML/INT.h" -typedef cmIML_INT_uint8_t cm_sha2_uint8_t; -typedef cmIML_INT_uint32_t cm_sha2_uint32_t; -typedef cmIML_INT_uint64_t cm_sha2_uint64_t; +/* CMake modification: use integer types from KWIML. */ +#include +typedef KWIML_INT_uint8_t cm_sha2_uint8_t; +typedef KWIML_INT_uint32_t cm_sha2_uint32_t; +typedef KWIML_INT_uint64_t cm_sha2_uint64_t; #ifdef __cplusplus extern "C" { diff --git a/Utilities/cm_kwiml.h b/Utilities/cm_kwiml.h new file mode 100644 index 000000000..2e1a10806 --- /dev/null +++ b/Utilities/cm_kwiml.h @@ -0,0 +1,18 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2015 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cm_kwiml_h +#define cm_kwiml_h + +#include "KWIML/include/kwiml/abi.h" +#include "KWIML/include/kwiml/int.h" + +#endif diff --git a/bootstrap b/bootstrap index b2421a11b..860b5e49e 100755 --- a/bootstrap +++ b/bootstrap @@ -373,11 +373,6 @@ KWSYS_FILES="\ SystemTools.hxx \ Terminal.h" -KWIML_FILES=' - ABI.h - INT.h -' - # Display CMake bootstrap usage cmake_usage() { @@ -702,11 +697,6 @@ if [ ! -d "cmsys" ]; then cmake_error 4 "Cannot create directory ${cmake_bootstrap_dir}/cmsys" fi -[ -d "cmIML" ] || mkdir "cmIML" -if [ ! -d "cmIML" ]; then - cmake_error 12 "Cannot create directory ${cmake_bootstrap_dir}/cmIML" -fi - # Delete all the bootstrap files rm -f "${cmake_bootstrap_dir}/cmake_bootstrap.log" rm -f "${cmake_bootstrap_dir}/cmConfigure.h${_tmp}" @@ -1280,11 +1270,6 @@ for a in ${KWSYS_FILES}; do "${cmake_bootstrap_dir}/cmsys/${a}" KWSYS_NAMESPACE cmsys done -for a in ${KWIML_FILES}; do - cmake_replace_string "${cmake_source_dir}/Utilities/KWIML/${a}.in" \ - "${cmake_bootstrap_dir}/cmIML/${a}" KWIML cmIML -done - # Generate Makefile dep="cmConfigure.h cmsys/*.hxx cmsys/*.h `cmake_escape \"${cmake_source_dir}\"`/Source/*.h" objs="" @@ -1326,9 +1311,9 @@ cmake_cxx_flags_SystemTools=" -DKWSYS_CXX_HAS_UTIMES=${KWSYS_CXX_HAS_UTIMES} " cmake_c_flags="${cmake_c_flags}-I`cmake_escape \"${cmake_bootstrap_dir}\"` -I`cmake_escape \"${cmake_source_dir}/Source\"` \ - -I`cmake_escape \"${cmake_bootstrap_dir}\"`" + -I`cmake_escape \"${cmake_source_dir}/Utilities\"`" cmake_cxx_flags="${cmake_cxx_flags} -I`cmake_escape \"${cmake_bootstrap_dir}\"` -I`cmake_escape \"${cmake_source_dir}/Source\"` \ - -I`cmake_escape \"${cmake_bootstrap_dir}\"`" + -I`cmake_escape \"${cmake_source_dir}/Utilities\"`" echo "cmake: ${objs}" > "${cmake_bootstrap_dir}/Makefile" echo " ${cmake_cxx_compiler} ${cmake_ld_flags} ${cmake_cxx_flags} ${objs} -o cmake" >> "${cmake_bootstrap_dir}/Makefile" for a in ${CMAKE_CXX_SOURCES}; do From a5dd0c9d427d66f7e361b0aa714a0a41b65ae4f0 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 18 Dec 2015 09:57:55 -0500 Subject: [PATCH 085/255] Add option to use a system-installed KWIML Do not activate it with the general use-system-libs options for now because KWIML is not commonly distributed or available. --- CMakeLists.txt | 25 ++++++++++++++++++++++--- Source/CMakeLists.txt | 1 + Utilities/cmThirdParty.h.in | 1 + Utilities/cm_kwiml.h | 11 +++++++++-- Utilities/cmjsoncpp/CMakeLists.txt | 1 + bootstrap | 14 ++++++++++++++ 6 files changed, 48 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 932d07e7b..9381f357f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -138,8 +138,13 @@ macro(CMAKE_HANDLE_SYSTEM_LIBRARIES) option(CMAKE_USE_SYSTEM_FORM "Use system-installed libform" "${CMAKE_USE_SYSTEM_LIBRARY_FORM}") option(CMAKE_USE_SYSTEM_JSONCPP "Use system-installed jsoncpp" "${CMAKE_USE_SYSTEM_LIBRARY_JSONCPP}") + # For now use system KWIML only if explicitly requested rather + # than activating via the general system libs options. + option(CMAKE_USE_SYSTEM_KWIML "Use system-installed KWIML" OFF) + mark_as_advanced(CMAKE_USE_SYSTEM_KWIML) + # Mention to the user what system libraries are being used. - foreach(util ${UTILITIES}) + foreach(util ${UTILITIES} KWIML) if(CMAKE_USE_SYSTEM_${util}) message(STATUS "Using system-installed ${util}") endif() @@ -270,6 +275,20 @@ macro (CMAKE_BUILD_UTILITIES) # (a macro defined in this file) CMAKE_HANDLE_SYSTEM_LIBRARIES() + if(CMAKE_USE_SYSTEM_KWIML) + find_package(KWIML 1.0) + if(NOT KWIML_FOUND) + message(FATAL_ERROR "CMAKE_USE_SYSTEM_KWIML is ON but KWIML is not found!") + endif() + set(CMake_KWIML_LIBRARIES kwiml::kwiml) + else() + set(CMake_KWIML_LIBRARIES "") + if(BUILD_TESTING) + set(KWIML_TEST_ENABLE 1) + endif() + add_subdirectory(Utilities/KWIML) + endif() + #--------------------------------------------------------------------- # Build zlib library for Curl, CMake, and CTest. set(CMAKE_ZLIB_HEADER "cm_zlib.h") @@ -538,10 +557,10 @@ if("x${CMAKE_TESTS_CDASH_SERVER}" STREQUAL "x") set(CMAKE_TESTS_CDASH_SERVER "http://open.cdash.org") endif() -if(BUILD_TESTING) +if(CMake_TEST_EXTERNAL_CMAKE) set(KWIML_TEST_ENABLE 1) + add_subdirectory(Utilities/KWIML) endif() -add_subdirectory(Utilities/KWIML) if(NOT CMake_TEST_EXTERNAL_CMAKE) # build the utilities (a macro defined in this file) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index f23331bec..ab70568d3 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -566,6 +566,7 @@ target_link_libraries(CMakeLib cmsys ${CMAKE_TAR_LIBRARIES} ${CMAKE_COMPRESS_LIBRARIES} ${CMAKE_CURL_LIBRARIES} ${CMAKE_JSONCPP_LIBRARIES} + ${CMake_KWIML_LIBRARIES} ) # On Apple we need CoreFoundation diff --git a/Utilities/cmThirdParty.h.in b/Utilities/cmThirdParty.h.in index 0cb6809c3..4c1177ca8 100644 --- a/Utilities/cmThirdParty.h.in +++ b/Utilities/cmThirdParty.h.in @@ -15,6 +15,7 @@ /* Whether CMake is using its own utility libraries. */ #cmakedefine CMAKE_USE_SYSTEM_CURL #cmakedefine CMAKE_USE_SYSTEM_EXPAT +#cmakedefine CMAKE_USE_SYSTEM_KWIML #cmakedefine CMAKE_USE_SYSTEM_ZLIB #cmakedefine CMAKE_USE_SYSTEM_BZIP2 #cmakedefine CMAKE_USE_SYSTEM_LIBARCHIVE diff --git a/Utilities/cm_kwiml.h b/Utilities/cm_kwiml.h index 2e1a10806..ab2b80b3c 100644 --- a/Utilities/cm_kwiml.h +++ b/Utilities/cm_kwiml.h @@ -12,7 +12,14 @@ #ifndef cm_kwiml_h #define cm_kwiml_h -#include "KWIML/include/kwiml/abi.h" -#include "KWIML/include/kwiml/int.h" +/* Use the KWIML library configured for CMake. */ +#include "cmThirdParty.h" +#ifdef CMAKE_USE_SYSTEM_KWIML +# include +# include +#else +# include "KWIML/include/kwiml/abi.h" +# include "KWIML/include/kwiml/int.h" +#endif #endif diff --git a/Utilities/cmjsoncpp/CMakeLists.txt b/Utilities/cmjsoncpp/CMakeLists.txt index 1c863f855..d0114e711 100644 --- a/Utilities/cmjsoncpp/CMakeLists.txt +++ b/Utilities/cmjsoncpp/CMakeLists.txt @@ -23,3 +23,4 @@ include_directories( ) add_library(cmjsoncpp ${JSONCPP_SOURCES}) +target_link_libraries(cmjsoncpp ${CMake_KWIML_LIBRARIES}) diff --git a/bootstrap b/bootstrap index 860b5e49e..9e3036366 100755 --- a/bootstrap +++ b/bootstrap @@ -450,6 +450,18 @@ cmake_error() exit ${res} } +cmake_generate_file () +{ + OUTFILE="$1" + CONTENT="$2" + echo "$CONTENT" > "$OUTFILE.tmp" + if "${_diff}" "$OUTFILE.tmp" "$OUTFILE" > /dev/null 2> /dev/null ; then + rm -f "$OUTFILE.tmp" + else + mv -f "$OUTFILE.tmp" "$OUTFILE" + fi +} + # Replace KWSYS_NAMESPACE with cmsys cmake_replace_string () { @@ -1270,6 +1282,8 @@ for a in ${KWSYS_FILES}; do "${cmake_bootstrap_dir}/cmsys/${a}" KWSYS_NAMESPACE cmsys done +cmake_generate_file "${cmake_bootstrap_dir}/cmThirdParty.h" "" + # Generate Makefile dep="cmConfigure.h cmsys/*.hxx cmsys/*.h `cmake_escape \"${cmake_source_dir}\"`/Source/*.h" objs="" From 928d2085d8ebeadc498e9e9f884b8adabf3346c3 Mon Sep 17 00:00:00 2001 From: Chuck Atkins Date: Fri, 18 Dec 2015 09:27:55 -0600 Subject: [PATCH 086/255] CrayPrgEnv: Don't use absolute paths for imlicit libraries When parsing implicit include dirs, link dirs, and link libs, all arguments are resolved to absolute paths instead of relative paths. This is correct for link and include directories but link libraries should only include the library name, not it's path. --- Modules/Compiler/CrayPrgEnv.cmake | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Modules/Compiler/CrayPrgEnv.cmake b/Modules/Compiler/CrayPrgEnv.cmake index c3e7b7332..61daa0fb9 100644 --- a/Modules/Compiler/CrayPrgEnv.cmake +++ b/Modules/Compiler/CrayPrgEnv.cmake @@ -4,12 +4,14 @@ if(__craylinux_crayprgenv) endif() set(__craylinux_crayprgenv 1) -macro(__cray_extract_args cmd tag_regex out_var) +macro(__cray_extract_args cmd tag_regex out_var make_absolute) string(REGEX MATCHALL "${tag_regex}" args "${cmd}") foreach(arg IN LISTS args) string(REGEX REPLACE "^${tag_regex}$" "\\2" param "${arg}") - get_filename_component(param_abs "${param}" ABSOLUTE) - list(APPEND ${out_var} ${param_abs}) + if(make_absolute) + get_filename_component(param "${param}" ABSOLUTE) + endif() + list(APPEND ${out_var} ${param}) endforeach() endmacro() @@ -21,15 +23,18 @@ function(__cray_extract_implicit src compiler_cmd link_cmd lang include_dirs_var OUTPUT_VARIABLE output ERROR_VARIABLE error ) + set(include_dirs) + set(link_dirs) + set(link_libs) string(REGEX REPLACE "\r?\n" ";" output_lines "${output}\n${error}") foreach(line IN LISTS output_lines) if("${line}" MATCHES "${compiler_cmd}") - __cray_extract_args("${line}" " -(I ?|isystem )([^ ]*)" include_dirs) + __cray_extract_args("${line}" " -(I ?|isystem )([^ ]*)" include_dirs 1) set(processed_include 1) endif() if("${line}" MATCHES "${link_cmd}") - __cray_extract_args("${line}" " -(L ?)([^ ]*)" link_dirs) - __cray_extract_args("${line}" " -(l ?)([^ ]*)" link_libs) + __cray_extract_args("${line}" " -(L ?)([^ ]*)" link_dirs 1) + __cray_extract_args("${line}" " -(l ?)([^ ]*)" link_libs 0) set(processed_link 1) endif() if(processed_include AND processed_link) From a5149d31beaf7e36c449659066f5348136666a8c Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 19 Dec 2015 00:01:07 -0500 Subject: [PATCH 087/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 75151390e..99c621a39 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20151218) +set(CMake_VERSION_PATCH 20151219) #set(CMake_VERSION_RC 1) From 693a42fb00650180c98a15a62e11e450b6ab99f0 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 20 Dec 2015 00:01:16 -0500 Subject: [PATCH 088/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 99c621a39..85a752eef 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20151219) +set(CMake_VERSION_PATCH 20151220) #set(CMake_VERSION_RC 1) From ba88bfcf212bc8e93eb065e6d4bafbbf34394e68 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 21 Dec 2015 00:01:16 -0500 Subject: [PATCH 089/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 85a752eef..15feed4f2 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20151220) +set(CMake_VERSION_PATCH 20151221) #set(CMake_VERSION_RC 1) From d9bf5206d007507fff3e1a89b8f49d7960a209c8 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 21 Dec 2015 09:30:26 -0500 Subject: [PATCH 090/255] CMakeDetermineCompilerId: Fix VS Itanium platform name (#15889) VS expects the platform to be just `Itanium`, so drop the incorrect special case mapping it to `ia64`. This platform name has been wrong since the logic was added by commit v2.8.10~148^2~8 (VS: Detect the compiler id and tool location, 2012-08-16). --- Modules/CMakeDetermineCompilerId.cmake | 3 --- 1 file changed, 3 deletions(-) diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 81c25090c..5b3c7f2d7 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -182,9 +182,6 @@ Id flags: ${testflags} set(v 6) set(ext dsp) endif() - if("${id_platform}" STREQUAL "Itanium") - set(id_platform ia64) - endif() if(CMAKE_VS_PLATFORM_TOOLSET) if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android") set(id_toolset "${CMAKE_VS_PLATFORM_TOOLSET}") From a95b47154ef0508cb30c82b79dab75526743498a Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 10 Dec 2015 14:57:22 -0500 Subject: [PATCH 091/255] Utilities/Release: Add optional remote launcher to ssh calls --- Utilities/Release/release_cmake.cmake | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Utilities/Release/release_cmake.cmake b/Utilities/Release/release_cmake.cmake index 0a3d324e7..0d9c78458 100644 --- a/Utilities/Release/release_cmake.cmake +++ b/Utilities/Release/release_cmake.cmake @@ -19,6 +19,9 @@ endif() if(NOT DEFINED RUN_SHELL) set(RUN_SHELL "/bin/sh") endif() +if(NOT DEFINED RUN_LAUNCHER) + set(RUN_LAUNCHER "") +endif() if(NOT DEFINED PROCESSORS) set(PROCESSORS 1) endif() @@ -52,11 +55,11 @@ message("Creating CMake release ${CMAKE_CREATE_VERSION} on ${HOST} with parallel macro(remote_command comment command) message("${comment}") if(${ARGC} GREATER 2) - message("ssh ${HOST} ${command}") - execute_process(COMMAND ssh ${HOST} ${command} RESULT_VARIABLE result INPUT_FILE ${ARGV2}) + message("ssh ${HOST} ${RUN_LAUNCHER} ${command}") + execute_process(COMMAND ssh ${HOST} ${RUN_LAUNCHER} ${command} RESULT_VARIABLE result INPUT_FILE ${ARGV2}) else() - message("ssh ${HOST} ${command}") - execute_process(COMMAND ssh ${HOST} ${command} RESULT_VARIABLE result) + message("ssh ${HOST} ${RUN_LAUNCHER} ${command}") + execute_process(COMMAND ssh ${HOST} ${RUN_LAUNCHER} ${command} RESULT_VARIABLE result) endif() if(${result} GREATER 0) message(FATAL_ERROR "Error running command: ${command}, return value = ${result}") From 240b065faa9bc3b1a8dcf073a94028cd473a8c62 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 10 Dec 2015 14:58:11 -0500 Subject: [PATCH 092/255] Utilities/Release: Optionally load environment on remote build server --- Utilities/Release/release_cmake.sh.in | 1 + 1 file changed, 1 insertion(+) diff --git a/Utilities/Release/release_cmake.sh.in b/Utilities/Release/release_cmake.sh.in index 06e720fe1..14651297b 100755 --- a/Utilities/Release/release_cmake.sh.in +++ b/Utilities/Release/release_cmake.sh.in @@ -5,6 +5,7 @@ echo "" echo "remove and create working directory @CMAKE_RELEASE_DIRECTORY@" rm -rf @CMAKE_RELEASE_DIRECTORY@ mkdir @CMAKE_RELEASE_DIRECTORY@ +@ENV@ check_exit_value() { From 083312a8fd39f6ff7a9abc79184e31eb233e8933 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 10 Dec 2015 14:59:09 -0500 Subject: [PATCH 093/255] Utilities/Release: Switch to .msi builder for Windows binary Use a new build machine to produce the Windows binary using the CPack WiX generator to produce a `.msi` installer. --- Help/release/dev/release-windows.rst | 7 +++++++ Tests/CMakeLists.txt | 2 +- Utilities/Release/create-cmake-release.cmake | 2 +- ...2win64_release.cmake => dash3win7_release.cmake} | 13 +++++++------ 4 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 Help/release/dev/release-windows.rst rename Utilities/Release/{dash2win64_release.cmake => dash3win7_release.cmake} (70%) diff --git a/Help/release/dev/release-windows.rst b/Help/release/dev/release-windows.rst new file mode 100644 index 000000000..cc9f2d5a0 --- /dev/null +++ b/Help/release/dev/release-windows.rst @@ -0,0 +1,7 @@ +release-windows +--------------- + +* The precompiled Windows binary provided on ``cmake.org`` is now a + ``.msi`` package instead of an installer executable. One may need + to manually uninstall CMake versions lower than 3.5 before installing + the new package. diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 65bfb77d7..043b7570b 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -685,7 +685,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release endmacro() if(CMAKE_BUILD_NIGHTLY_RELEASES) ADD_NIGHTLY_BUILD_TEST(CMakeNightlyWindows - dash2win64_release.cmake) + dash3win7_release.cmake) ADD_NIGHTLY_BUILD_TEST(CMakeNightlyOSX dashmacmini5_release.cmake) ADD_NIGHTLY_BUILD_TEST(CMakeNightlyLinux32 diff --git a/Utilities/Release/create-cmake-release.cmake b/Utilities/Release/create-cmake-release.cmake index 76057d122..d41c4ecbc 100644 --- a/Utilities/Release/create-cmake-release.cmake +++ b/Utilities/Release/create-cmake-release.cmake @@ -6,7 +6,7 @@ endif() file(MAKE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/logs) set(RELEASE_SCRIPTS_BATCH_1 - dash2win64_release.cmake # Windows + dash3win7_release.cmake # Windows dashmacmini5_release.cmake # OS X x86_64 magrathea_release.cmake # Linux linux64_release.cmake # Linux x86_64 diff --git a/Utilities/Release/dash2win64_release.cmake b/Utilities/Release/dash3win7_release.cmake similarity index 70% rename from Utilities/Release/dash2win64_release.cmake rename to Utilities/Release/dash3win7_release.cmake index ecfd7c55a..290b4736b 100644 --- a/Utilities/Release/dash2win64_release.cmake +++ b/Utilities/Release/dash3win7_release.cmake @@ -1,23 +1,24 @@ -set(CMAKE_RELEASE_DIRECTORY "c:/cygwin/home/dashboard/CMakeReleaseDirectory") +set(CMAKE_RELEASE_DIRECTORY "c:/msys64/home/dashboard/CMakeReleaseDirectory") set(CONFIGURE_WITH_CMAKE TRUE) set(CMAKE_CONFIGURE_PATH "c:/Program\\ Files\\ \\(x86\\)/CMake/bin/cmake.exe") set(PROCESSORS 8) -set(HOST dash2win64) -set(CPACK_BINARY_GENERATORS "NSIS ZIP") +set(HOST dash3win7) +set(RUN_LAUNCHER ~/rel/run) +set(CPACK_BINARY_GENERATORS "WIX ZIP") set(CPACK_SOURCE_GENERATORS "ZIP") -set(MAKE_PROGRAM "make") +set(MAKE_PROGRAM "ninja") set(MAKE "${MAKE_PROGRAM} -j8") set(INITIAL_CACHE "CMAKE_BUILD_TYPE:STRING=Release CMAKE_DOC_DIR:STRING=doc/cmake CMAKE_USE_OPENSSL:BOOL=OFF CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE CMAKE_Fortran_COMPILER:FILEPATH=FALSE -CMAKE_GENERATOR:INTERNAL=Unix Makefiles +CMAKE_GENERATOR:INTERNAL=Ninja BUILD_QtDialog:BOOL:=TRUE CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:BOOL=TRUE CMake_INSTALL_DEPENDENCIES:BOOL=ON -QT_QMAKE_EXECUTABLE:FILEPATH=c:/Dashboards/Support/qt-build/Qt/bin/qmake.exe ") +set(ENV ". ~/rel/env") get_filename_component(path "${CMAKE_CURRENT_LIST_FILE}" PATH) set(GIT_EXTRA "git config core.autocrlf true") include(${path}/release_cmake.cmake) From fae4779864d1e5a93369b1ac7de9ee7428a28043 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 18 Dec 2015 14:35:34 -0500 Subject: [PATCH 094/255] Utilities/Release: Configure Windows binary to support Windows XP Compile with `-D_WIN32_WINNT=0x501` to use a WinXP-compatible API. Compile with `-D_USING_V110_SDK71_` to tell the VS standard library headers that we are building with a WinXP-compatible Windows SDK. Link executables with `-subsystem:console,5.01` to make them runnable on Windows XP. Ideally `cmake-gui` should instead be linked with `-subsystem:windows,5.01` but with the Ninja and Makefile generators CMake adds `-subsystem:windows` after our `-subsystem:console,5.01` flag and the linker seems to interpret this combination as we need. --- Utilities/Release/dash3win7_release.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Utilities/Release/dash3win7_release.cmake b/Utilities/Release/dash3win7_release.cmake index 290b4736b..f25d63897 100644 --- a/Utilities/Release/dash3win7_release.cmake +++ b/Utilities/Release/dash3win7_release.cmake @@ -17,7 +17,11 @@ CMAKE_GENERATOR:INTERNAL=Ninja BUILD_QtDialog:BOOL:=TRUE CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:BOOL=TRUE CMake_INSTALL_DEPENDENCIES:BOOL=ON +CMAKE_EXE_LINKER_FLAGS:STRING=-machine:x86 -subsystem:console,5.01 ") +set(ppflags "-D_WIN32_WINNT=0x501 -D_USING_V110_SDK71_") +set(CFLAGS "${ppflags}") +set(CXXFLAGS "${ppflags}") set(ENV ". ~/rel/env") get_filename_component(path "${CMAKE_CURRENT_LIST_FILE}" PATH) set(GIT_EXTRA "git config core.autocrlf true") From 7656662148782b7751c62efd256e644c7295c883 Mon Sep 17 00:00:00 2001 From: Niels Ole Salscheider Date: Mon, 21 Dec 2015 16:02:11 +0100 Subject: [PATCH 095/255] QtDialog: Add option to control XDG file install destination Create a `CMAKE_XDGDATA_DIR` option and add a corresponding flag to the `bootstrap` script. This is needed for multiarch layouts where the prefix is `/usr/${host}` but where architecture-independent files (like the XDG-specific ones) are installed to `/usr/share`. --- Source/CMakeInstallDestinations.cmake | 5 +++++ Source/QtDialog/CMakeLists.txt | 6 +++--- bootstrap | 7 +++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Source/CMakeInstallDestinations.cmake b/Source/CMakeInstallDestinations.cmake index 99c86ca77..2f9d95ae5 100644 --- a/Source/CMakeInstallDestinations.cmake +++ b/Source/CMakeInstallDestinations.cmake @@ -3,24 +3,29 @@ if(BEOS) set(CMAKE_DATA_DIR_DEFAULT "share/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") # HAIKU set(CMAKE_MAN_DIR_DEFAULT "documentation/man") # HAIKU set(CMAKE_DOC_DIR_DEFAULT "documentation/doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") # HAIKU + set(CMAKE_XDGDATA_DIR_DEFAULT "share") # HAIKU elseif(CYGWIN) set(CMAKE_DATA_DIR_DEFAULT "share/cmake-${CMake_VERSION}") # CYGWIN set(CMAKE_DOC_DIR_DEFAULT "share/doc/cmake-${CMake_VERSION}") # CYGWIN set(CMAKE_MAN_DIR_DEFAULT "share/man") # CYGWIN + set(CMAKE_XDGDATA_DIR_DEFAULT "share") # CYGWIN else() set(CMAKE_DATA_DIR_DEFAULT "share/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") # OTHER set(CMAKE_DOC_DIR_DEFAULT "doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") # OTHER set(CMAKE_MAN_DIR_DEFAULT "man") # OTHER + set(CMAKE_XDGDATA_DIR_DEFAULT "share") # OTHER endif() set(CMAKE_DATA_DIR_DESC "data") set(CMAKE_DOC_DIR_DESC "docs") set(CMAKE_MAN_DIR_DESC "man pages") +set(CMAKE_XDGDATA_DIR_DESC "XDG specific files") foreach(v CMAKE_DATA_DIR CMAKE_DOC_DIR CMAKE_MAN_DIR + CMAKE_XDGDATA_DIR ) # Populate the cache with empty values so we know when the user sets them. set(${v} "" CACHE STRING "") diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 9161ad3ae..f17de5d50 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -193,7 +193,7 @@ if(UNIX AND NOT APPLE) foreach (size IN ITEMS 32 128) install( FILES "${CMAKE_CURRENT_SOURCE_DIR}/CMakeSetup${size}.png" - DESTINATION "share/icons/hicolor/${size}x${size}/apps" + DESTINATION "${CMAKE_XDGDATA_DIR}/icons/hicolor/${size}x${size}/apps" ${COMPONENT} RENAME "CMakeSetup.png") endforeach () @@ -201,10 +201,10 @@ if(UNIX AND NOT APPLE) # install a desktop file so CMake appears in the application start menu # with an icon install(FILES CMake.desktop - DESTINATION share/applications + DESTINATION "${CMAKE_XDGDATA_DIR}/applications" ${COMPONENT}) install(FILES cmakecache.xml - DESTINATION share/mime/packages + DESTINATION "${CMAKE_XDGDATA_DIR}/mime/packages" ${COMPONENT}) endif() diff --git a/bootstrap b/bootstrap index b2421a11b..97e85bfdf 100755 --- a/bootstrap +++ b/bootstrap @@ -63,9 +63,11 @@ cmake_copyright="`grep '^Copyright .* Kitware' "${cmake_source_dir}/Copyright.tx cmake_data_dir_keyword="OTHER" cmake_doc_dir_keyword="OTHER" cmake_man_dir_keyword="OTHER" +cmake_xdgdata_dir_keyword="OTHER" cmake_data_dir="" cmake_doc_dir="" cmake_man_dir="" +cmake_xdgdata_dir="" cmake_init_file="" cmake_bootstrap_system_libs="" cmake_bootstrap_qt_gui="" @@ -214,6 +216,7 @@ fi cmake_data_dir_default="`cmake_install_dest_default DATA ${cmake_data_dir_keyword}`" cmake_doc_dir_default="`cmake_install_dest_default DOC ${cmake_doc_dir_keyword}`" cmake_man_dir_default="`cmake_install_dest_default MAN ${cmake_man_dir_keyword}`" +cmake_xdgdata_dir_default="`cmake_install_dest_default XDGDATA ${cmake_xdgdata_dir_keyword}`" CMAKE_KNOWN_C_COMPILERS="cc gcc xlc icc tcc" CMAKE_KNOWN_CXX_COMPILERS="aCC xlC CC g++ c++ icc como " @@ -428,6 +431,8 @@ Directory and file names: ['"${cmake_doc_dir_default}"'] --mandir=DIR install man pages files in PREFIX/DIR/manN ['"${cmake_man_dir_default}"'] + --xdgdatadir=DIR install XDG specific files in PREFIX/DIR + ['"${cmake_xdgdata_dir_default}"'] ' exit 10 } @@ -616,6 +621,7 @@ while test $# != 0; do --datadir=*) cmake_data_dir=`cmake_arg "$1"` ;; --docdir=*) cmake_doc_dir=`cmake_arg "$1"` ;; --mandir=*) cmake_man_dir=`cmake_arg "$1"` ;; + --xdgdatadir=*) cmake_xdgdata_dir=`cmake_arg "$1"` ;; --init=*) cmake_init_file=`cmake_arg "$1"` ;; --system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=1" ;; --no-system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=0" ;; @@ -1368,6 +1374,7 @@ set (CMAKE_INSTALL_PREFIX "'"${cmake_prefix_dir}"'" CACHE PATH "Install path pre set (CMAKE_DOC_DIR "'"${cmake_doc_dir}"'" CACHE PATH "Install location for documentation (relative to prefix)." FORCE) set (CMAKE_MAN_DIR "'"${cmake_man_dir}"'" CACHE PATH "Install location for man pages (relative to prefix)." FORCE) set (CMAKE_DATA_DIR "'"${cmake_data_dir}"'" CACHE PATH "Install location for data (relative to prefix)." FORCE) +set (CMAKE_XDGDATA_DIR "'"${cmake_xdgdata_dir}"'" CACHE PATH "Install location for XDG specific files (relative to prefix)." FORCE) ' > "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" # Add configuration settings given as command-line options. From 8a45573e99165e926482b07da5ceb3dd86307ea5 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 22 Dec 2015 00:01:07 -0500 Subject: [PATCH 096/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 15feed4f2..636083d87 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20151221) +set(CMake_VERSION_PATCH 20151222) #set(CMake_VERSION_RC 1) From 56653b81b85c7484a37b6574a1f4b628f462c717 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 23 Dec 2015 00:01:05 -0500 Subject: [PATCH 097/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 636083d87..7cc561579 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20151222) +set(CMake_VERSION_PATCH 20151223) #set(CMake_VERSION_RC 1) From 554c3074556fb8fbf4918fc3e2ea3bef97add1ad Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 24 Dec 2015 00:01:07 -0500 Subject: [PATCH 098/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 7cc561579..7c730e52b 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20151223) +set(CMake_VERSION_PATCH 20151224) #set(CMake_VERSION_RC 1) From 630e444e97df52d35a93d22c54359881c1e11193 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 25 Dec 2015 00:01:06 -0500 Subject: [PATCH 099/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 7c730e52b..c8c71b533 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20151224) +set(CMake_VERSION_PATCH 20151225) #set(CMake_VERSION_RC 1) From 0b3b5fb16984e81639a92796ddf1f846ae6e8cea Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 26 Dec 2015 00:01:06 -0500 Subject: [PATCH 100/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index c8c71b533..ba2902e7e 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20151225) +set(CMake_VERSION_PATCH 20151226) #set(CMake_VERSION_RC 1) From 1d73f6525c523661e51173829b327acf9de9dfc4 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 27 Dec 2015 00:01:05 -0500 Subject: [PATCH 101/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ba2902e7e..842b6bafb 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20151226) +set(CMake_VERSION_PATCH 20151227) #set(CMake_VERSION_RC 1) From 9fdb66cff6c28fa279ff510ae9af6662b155524f Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 28 Dec 2015 00:01:06 -0500 Subject: [PATCH 102/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 842b6bafb..342fe0cc2 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20151227) +set(CMake_VERSION_PATCH 20151228) #set(CMake_VERSION_RC 1) From 69374919fd3fde3cd414eddfe01be79d16908391 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 29 Dec 2015 00:01:08 -0500 Subject: [PATCH 103/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 342fe0cc2..07a675be4 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20151228) +set(CMake_VERSION_PATCH 20151229) #set(CMake_VERSION_RC 1) From 64e26850fc2a98994424a34eada9bec90f384c7e Mon Sep 17 00:00:00 2001 From: Chuck Atkins Date: Tue, 29 Dec 2015 12:08:35 -0500 Subject: [PATCH 104/255] CrayPrgEnv: Cleanup binaries from implicit compile flag detection --- Modules/Compiler/CrayPrgEnv.cmake | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Modules/Compiler/CrayPrgEnv.cmake b/Modules/Compiler/CrayPrgEnv.cmake index 61daa0fb9..fa39b009a 100644 --- a/Modules/Compiler/CrayPrgEnv.cmake +++ b/Modules/Compiler/CrayPrgEnv.cmake @@ -16,13 +16,16 @@ macro(__cray_extract_args cmd tag_regex out_var make_absolute) endmacro() function(__cray_extract_implicit src compiler_cmd link_cmd lang include_dirs_var link_dirs_var link_libs_var) + set(BIN "${CMAKE_PLATFORM_INFO_DIR}/CrayExtractImplicit_${lang}.bin") execute_process( - COMMAND ${CMAKE_${lang}_COMPILER} - ${CMAKE_${lang}_VERBOSE_FLAG} -o cray_extract_implicit_${lang} ${src} + COMMAND ${CMAKE_${lang}_COMPILER} ${CMAKE_${lang}_VERBOSE_FLAG} -o ${BIN} RESULT_VARIABLE result OUTPUT_VARIABLE output ERROR_VARIABLE error ) + if(EXISTS "${BIN}") + file(REMOVE "${BIN}") + endif() set(include_dirs) set(link_dirs) set(link_libs) From f04a09d1bd7107b73d2063c1ac4de3080b21cea4 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 30 Dec 2015 00:01:05 -0500 Subject: [PATCH 105/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 07a675be4..4c8f3d7a8 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20151229) +set(CMake_VERSION_PATCH 20151230) #set(CMake_VERSION_RC 1) From 4aff1650d698fe31dd5d1f1cfdd359737d16c727 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 31 Dec 2015 00:01:09 -0500 Subject: [PATCH 106/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 4c8f3d7a8..d93b5bb7d 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20151230) +set(CMake_VERSION_PATCH 20151231) #set(CMake_VERSION_RC 1) From d5eb7d8565d01af80e4ab0b08014e52286d43f95 Mon Sep 17 00:00:00 2001 From: James Johnston Date: Thu, 31 Dec 2015 17:45:34 +0000 Subject: [PATCH 107/255] GenerateExportHeader: Work around buggy std::getline behavior in BCB5. --- .../GenerateExportHeader/exportheader_test.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Tests/Module/GenerateExportHeader/exportheader_test.cpp b/Tests/Module/GenerateExportHeader/exportheader_test.cpp index 146374ad3..4f45f3786 100644 --- a/Tests/Module/GenerateExportHeader/exportheader_test.cpp +++ b/Tests/Module/GenerateExportHeader/exportheader_test.cpp @@ -39,6 +39,18 @@ void compare(const char* refName, const char* testName) std::string testLine; std::getline(ref, refLine); std::getline(test, testLine); + // Some very old Borland runtimes (C++ Builder 5 WITHOUT Update 1) add a + // trailing null to the string that we need to strip before testing for a + // trailing space. + if (refLine.size() && refLine[refLine.size()-1] == 0) + { + refLine = refLine.substr(0, refLine.size() - 1); + } + if (testLine.size() && testLine[testLine.size()-1] == 0) + { + testLine = testLine.substr(0, testLine.size() - 1); + } + // The reference files never have trailing spaces: if (testLine.size() && testLine[testLine.size()-1] == ' ') { testLine = testLine.substr(0, testLine.size() - 1); From 9647b32f85d368e9e7adc78372ab5639f4ae64bd Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 31 Dec 2015 19:15:34 -0500 Subject: [PATCH 108/255] Copyright.txt: Update year range to end in 2016 --- Copyright.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Copyright.txt b/Copyright.txt index 6c9fb0934..f99998fe7 100644 --- a/Copyright.txt +++ b/Copyright.txt @@ -1,5 +1,5 @@ CMake - Cross Platform Makefile Generator -Copyright 2000-2015 Kitware, Inc. +Copyright 2000-2016 Kitware, Inc. Copyright 2000-2011 Insight Software Consortium All rights reserved. From 9ebc5626ef9a11b9f55641755504f054079caa7c Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 1 Jan 2016 00:01:06 -0500 Subject: [PATCH 109/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index d93b5bb7d..e0f4a22f8 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20151231) +set(CMake_VERSION_PATCH 20160101) #set(CMake_VERSION_RC 1) From 90b50b2e28d32bcf239d3f6bc4d1114756a78827 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 2 Jan 2016 00:01:06 -0500 Subject: [PATCH 110/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index e0f4a22f8..602847545 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20160101) +set(CMake_VERSION_PATCH 20160102) #set(CMake_VERSION_RC 1) From 506504d44049b91fe51539a1b7a29cdc65234b7f Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 3 Jan 2016 00:01:06 -0500 Subject: [PATCH 111/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 602847545..4cd8c807a 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20160102) +set(CMake_VERSION_PATCH 20160103) #set(CMake_VERSION_RC 1) From 28db2268e8e36521626071a39596b9aaa87defbb Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Sat, 2 Jan 2016 17:57:06 +0100 Subject: [PATCH 112/255] Xcode: Factor out XCODE_ATTRIBUTE_ variant filter (#14947) Move the variant= filter out to a helper function so that it can be re-used later for CMAKE_XCODE_ATTRIBUTE_*. --- Source/cmGlobalXCodeGenerator.cxx | 68 +++++++++++++++++++------------ Source/cmGlobalXCodeGenerator.h | 2 + 2 files changed, 43 insertions(+), 27 deletions(-) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 475efa8b6..c9d2742cc 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1656,6 +1656,46 @@ std::string cmGlobalXCodeGenerator::ExtractFlagRegex(const char* exp, return retFlag; } + //---------------------------------------------------------------------------- +// This function strips off Xcode attributes that do not target the current +// configuration +void +cmGlobalXCodeGenerator +::FilterConfigurationAttribute(std::string const& configName, + std::string& attribute) +{ + // Handle [variant=] condition explicitly here. + std::string::size_type beginVariant = attribute.find("[variant="); + if (beginVariant == std::string::npos) + { + // There is no variant in this attribute. + return; + } + + std::string::size_type endVariant = attribute.find("]", beginVariant+9); + if (endVariant == std::string::npos) + { + // There is no terminating bracket. + return; + } + + // Compare the variant to the configuration. + std::string variant = + attribute.substr(beginVariant+9, endVariant-beginVariant-9); + if (variant == configName) + { + // The variant matches the configuration so use this + // attribute but drop the [variant=] condition. + attribute.erase(beginVariant, endVariant-beginVariant+1); + } + else + { + // The variant does not match the configuration so + // do not use this attribute. + attribute.clear(); + } +} + //---------------------------------------------------------------------------- void cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase, @@ -2498,33 +2538,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, if(i->find("XCODE_ATTRIBUTE_") == 0) { std::string attribute = i->substr(16); - // Handle [variant=] condition explicitly here. - std::string::size_type beginVariant = - attribute.find("[variant="); - if (beginVariant != std::string::npos) - { - std::string::size_type endVariant = - attribute.find("]", beginVariant+9); - if (endVariant != std::string::npos) - { - // Compare the variant to the configuration. - std::string variant = - attribute.substr(beginVariant+9, endVariant-beginVariant-9); - if (variant == configName) - { - // The variant matches the configuration so use this - // attribute but drop the [variant=] condition. - attribute.erase(beginVariant, endVariant-beginVariant+1); - } - else - { - // The variant does not match the configuration so - // do not use this attribute. - attribute.clear(); - } - } - } - + this->FilterConfigurationAttribute(configName, attribute); if (!attribute.empty()) { cmGeneratorExpression ge; diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index c8a39dfa2..4801064c2 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -153,6 +153,8 @@ private: std::string ExtractFlag(const char* flag, std::string& flags); std::string ExtractFlagRegex(const char* exp, int matchIndex, std::string& flags); + void FilterConfigurationAttribute(std::string const& configName, + std::string& attribute); void SortXCodeObjects(); // delete all objects in the this->XCodeObjects vector. void ClearXCodeObjects(); From 28f98ceef1770fe252c0c3c1e59aca773cc64009 Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Sun, 3 Jan 2016 11:53:38 +0100 Subject: [PATCH 113/255] Xcode: Make CMAKE_XCODE_ATTRIBUTE calculation last step (#14947) --- Source/cmGlobalXCodeGenerator.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index c9d2742cc..6f192cb8b 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3527,6 +3527,10 @@ bool cmGlobalXCodeGenerator this->CreateString(this->GeneratorToolset.c_str())); } + std::string symroot = root->GetCurrentBinaryDirectory(); + symroot += "/build"; + buildSettings->AddAttribute("SYMROOT", this->CreateString(symroot.c_str())); + // Put this last so it can override existing settings // Convert "CMAKE_XCODE_ATTRIBUTE_*" variables directly. { @@ -3543,10 +3547,6 @@ bool cmGlobalXCodeGenerator } } - std::string symroot = root->GetCurrentBinaryDirectory(); - symroot += "/build"; - buildSettings->AddAttribute("SYMROOT", this->CreateString(symroot.c_str())); - for( std::vector::iterator i = configs.begin(); i != configs.end(); ++i) { From dc0ddb9e34f885d32f0fa3bb25072ec77e4a79bb Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Sun, 3 Jan 2016 11:58:52 +0100 Subject: [PATCH 114/255] Xcode: Store configuration name along with XcodeObject (#14947) --- Source/cmGlobalXCodeGenerator.cxx | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 6f192cb8b..3ac113782 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3440,18 +3440,19 @@ bool cmGlobalXCodeGenerator this->CreateObject(cmXCodeObject::XCConfigurationList); cmXCodeObject* buildConfigurations = this->CreateObject(cmXCodeObject::OBJECT_LIST); - std::vector configs; + typedef std::vector > Configs; + Configs configs; const char *defaultConfigName = "Debug"; if(this->XcodeVersion == 15) { cmXCodeObject* configDebug = this->CreateObject(cmXCodeObject::XCBuildConfiguration); configDebug->AddAttribute("name", this->CreateString("Debug")); - configs.push_back(configDebug); + configs.push_back(std::make_pair("Debug", configDebug)); cmXCodeObject* configRelease = this->CreateObject(cmXCodeObject::XCBuildConfiguration); configRelease->AddAttribute("name", this->CreateString("Release")); - configs.push_back(configRelease); + configs.push_back(std::make_pair("Release", configRelease)); } else { @@ -3465,13 +3466,12 @@ bool cmGlobalXCodeGenerator cmXCodeObject* config = this->CreateObject(cmXCodeObject::XCBuildConfiguration); config->AddAttribute("name", this->CreateString(name)); - configs.push_back(config); + configs.push_back(std::make_pair(name, config)); } } - for(std::vector::iterator c = configs.begin(); - c != configs.end(); ++c) + for(Configs::iterator c = configs.begin(); c != configs.end(); ++c) { - buildConfigurations->AddObject(*c); + buildConfigurations->AddObject(c->second); } configlist->AddAttribute("buildConfigurations", buildConfigurations); @@ -3547,10 +3547,9 @@ bool cmGlobalXCodeGenerator } } - for( std::vector::iterator i = configs.begin(); - i != configs.end(); ++i) + for(Configs::iterator i = configs.begin(); i != configs.end(); ++i) { - (*i)->AddAttribute("buildSettings", buildSettings); + i->second->AddAttribute("buildSettings", buildSettings); } this->RootObject->AddAttribute("buildConfigurationList", From d8bc26a065f1999698c9b499ca793f9adf740a9d Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Sun, 3 Jan 2016 11:55:50 +0100 Subject: [PATCH 115/255] Xcode: Parse variant and genex for CMAKE_XCODE_ATTRIBUTE (#14947) --- .../CMAKE_XCODE_ATTRIBUTE_an-attribute.rst | 6 +++ Source/cmGlobalXCodeGenerator.cxx | 51 ++++++++++++------- Source/cmGlobalXCodeGenerator.h | 1 + .../XcodeAttributeGenex-check.cmake | 48 +++++++++++++++++ .../XcodeProject/XcodeAttributeGenex.cmake | 14 ++++- 5 files changed, 102 insertions(+), 18 deletions(-) diff --git a/Help/variable/CMAKE_XCODE_ATTRIBUTE_an-attribute.rst b/Help/variable/CMAKE_XCODE_ATTRIBUTE_an-attribute.rst index 122b9f6b0..be683d668 100644 --- a/Help/variable/CMAKE_XCODE_ATTRIBUTE_an-attribute.rst +++ b/Help/variable/CMAKE_XCODE_ATTRIBUTE_an-attribute.rst @@ -8,3 +8,9 @@ in the generated Xcode project. Ignored on other generators. See the :prop_tgt:`XCODE_ATTRIBUTE_` target property to set attributes on a specific target. + +Contents of ``CMAKE_XCODE_ATTRIBUTE_`` may use +"generator expressions" with the syntax ``$<...>``. See the +:manual:`cmake-generator-expressions(7)` manual for available +expressions. See the :manual:`cmake-buildsystem(7)` manual +for more on defining buildsystem properties. diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 3ac113782..fa9af121b 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -709,6 +709,15 @@ cmXCodeObject* cmGlobalXCodeGenerator return obj; } +//---------------------------------------------------------------------------- +cmXCodeObject* cmGlobalXCodeGenerator +::CreateFlatClone(cmXCodeObject* orig) +{ + cmXCodeObject* obj = this->CreateObject(orig->GetType()); + obj->CopyAttributes(orig); + return obj; +} + //---------------------------------------------------------------------------- std::string GetGroupMapKeyFromPath(cmGeneratorTarget* target, const std::string& fullpath) @@ -3531,25 +3540,33 @@ bool cmGlobalXCodeGenerator symroot += "/build"; buildSettings->AddAttribute("SYMROOT", this->CreateString(symroot.c_str())); - // Put this last so it can override existing settings - // Convert "CMAKE_XCODE_ATTRIBUTE_*" variables directly. - { - std::vector vars = this->CurrentMakefile->GetDefinitions(); - for(std::vector::const_iterator i = vars.begin(); - i != vars.end(); ++i) - { - if(i->find("CMAKE_XCODE_ATTRIBUTE_") == 0) - { - buildSettings->AddAttribute(i->substr(22).c_str(), - this->CreateString( - this->CurrentMakefile->GetDefinition(i->c_str()))); - } - } - } - for(Configs::iterator i = configs.begin(); i != configs.end(); ++i) { - i->second->AddAttribute("buildSettings", buildSettings); + cmXCodeObject* buildSettingsForCfg = this->CreateFlatClone(buildSettings); + + // Put this last so it can override existing settings + // Convert "CMAKE_XCODE_ATTRIBUTE_*" variables directly. + std::vector vars = this->CurrentMakefile->GetDefinitions(); + for(std::vector::const_iterator d = vars.begin(); + d != vars.end(); ++d) + { + if(d->find("CMAKE_XCODE_ATTRIBUTE_") == 0) + { + std::string attribute = d->substr(22); + this->FilterConfigurationAttribute(i->first, attribute); + if(!attribute.empty()) + { + cmGeneratorExpression ge; + std::string processed = + ge.Parse(this->CurrentMakefile->GetDefinition(*d)) + ->Evaluate(this->CurrentLocalGenerator, i->first); + buildSettingsForCfg->AddAttribute(attribute, + this->CreateString(processed)); + } + } + } + // store per-config buildSettings into configuration object + i->second->AddAttribute("buildSettings", buildSettingsForCfg); } this->RootObject->AddAttribute("buildConfigurationList", diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 4801064c2..965982235 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -131,6 +131,7 @@ private: cmXCodeObject* CreateObject(cmXCodeObject::Type type); cmXCodeObject* CreateString(const std::string& s); cmXCodeObject* CreateObjectReference(cmXCodeObject*); + cmXCodeObject* CreateFlatClone(cmXCodeObject*); cmXCodeObject* CreateXCodeTarget(cmGeneratorTarget *gtgt, cmXCodeObject* buildPhases); void ForceLinkerLanguages(); diff --git a/Tests/RunCMake/XcodeProject/XcodeAttributeGenex-check.cmake b/Tests/RunCMake/XcodeProject/XcodeAttributeGenex-check.cmake index 637df0fd7..8a3950671 100644 --- a/Tests/RunCMake/XcodeProject/XcodeAttributeGenex-check.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeAttributeGenex-check.cmake @@ -1,3 +1,5 @@ +# per target attribute with genex + set(expect "TEST_HOST = \"[^;\"]*Tests/RunCMake/XcodeProject/XcodeAttributeGenex-build/[^;\"/]*/some\"") file(STRINGS ${RunCMake_TEST_BINARY_DIR}/XcodeAttributeGenex.xcodeproj/project.pbxproj actual REGEX "TEST_HOST = .*;" LIMIT_COUNT 1) @@ -5,3 +7,49 @@ if(NOT "${actual}" MATCHES "${expect}") message(SEND_ERROR "The actual project contains the line:\n ${actual}\n" "which does not match expected regex:\n ${expect}\n") endif() + +# per target attribute with variant + +file(STRINGS ${RunCMake_TEST_BINARY_DIR}/XcodeAttributeGenex.xcodeproj/project.pbxproj actual + REGEX "CONFIG_SPECIFIC = .*;") +list(REMOVE_DUPLICATES actual) + +set(expect "CONFIG_SPECIFIC = general") +if(NOT "${actual}" MATCHES "${expect}") + message(SEND_ERROR "The actual project contains the line:\n ${actual}\n" + "which does not match expected regex:\n ${expect}\n") +endif() + +set(expect "CONFIG_SPECIFIC = release") +if(NOT "${actual}" MATCHES "${expect}") + message(SEND_ERROR "The actual project contains the line:\n ${actual}\n" + "which does not match expected regex:\n ${expect}\n") +endif() + +# global attribute with genex + +set(expect "ANOTHER_GLOBAL = \"[^;\"]*Tests/RunCMake/XcodeProject/XcodeAttributeGenex-build/[^;\"/]*/another\"") +file(STRINGS ${RunCMake_TEST_BINARY_DIR}/XcodeAttributeGenex.xcodeproj/project.pbxproj actual + REGEX "ANOTHER_GLOBAL = .*;" LIMIT_COUNT 1) +if(NOT "${actual}" MATCHES "${expect}") + message(SEND_ERROR "The actual project contains the line:\n ${actual}\n" + "which does not match expected regex:\n ${expect}\n") +endif() + +# global attribute with variant + +file(STRINGS ${RunCMake_TEST_BINARY_DIR}/XcodeAttributeGenex.xcodeproj/project.pbxproj actual + REGEX "ANOTHER_CONFIG = .*;" LIMIT_COUNT 4) +list(REMOVE_DUPLICATES actual) + +set(expect "ANOTHER_CONFIG = general") +if(NOT "${actual}" MATCHES "${expect}") + message(SEND_ERROR "The actual project contains the line:\n ${actual}\n" + "which does not match expected regex:\n ${expect}\n") +endif() + +set(expect "ANOTHER_CONFIG = debug") +if(NOT "${actual}" MATCHES "${expect}") + message(SEND_ERROR "The actual project contains the line:\n ${actual}\n" + "which does not match expected regex:\n ${expect}\n") +endif() diff --git a/Tests/RunCMake/XcodeProject/XcodeAttributeGenex.cmake b/Tests/RunCMake/XcodeProject/XcodeAttributeGenex.cmake index 760b882c6..d8cb3bd23 100644 --- a/Tests/RunCMake/XcodeProject/XcodeAttributeGenex.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeAttributeGenex.cmake @@ -1,4 +1,16 @@ enable_language(C) add_executable(some main.c) add_executable(another main.c) -set_property(TARGET another PROPERTY XCODE_ATTRIBUTE_TEST_HOST "$") +set_target_properties(another PROPERTIES + # per target attribute with genex + XCODE_ATTRIBUTE_TEST_HOST "$" + # per target attribute with variant + XCODE_ATTRIBUTE_CONFIG_SPECIFIC[variant=Release] "release" + XCODE_ATTRIBUTE_CONFIG_SPECIFIC "general") + +# global attribute with genex +set(CMAKE_XCODE_ATTRIBUTE_ANOTHER_GLOBAL "$") + +# global attribute with variant +set(CMAKE_XCODE_ATTRIBUTE_ANOTHER_CONFIG "general") +set(CMAKE_XCODE_ATTRIBUTE_ANOTHER_CONFIG[variant=Debug] "debug") From 3d2d17c00c2b20185b7fe0af22ba06bba3730d7c Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 4 Jan 2016 00:01:08 -0500 Subject: [PATCH 116/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 4cd8c807a..b1225b72e 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20160103) +set(CMake_VERSION_PATCH 20160104) #set(CMake_VERSION_RC 1) From a6cbc89179f7fc6e4ac359df48eb1d31abe027cb Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 5 Jan 2016 00:01:05 -0500 Subject: [PATCH 117/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index b1225b72e..29fdd3f23 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20160104) +set(CMake_VERSION_PATCH 20160105) #set(CMake_VERSION_RC 1) From bc908abd989c9a241b11733cbda6213520aa0dd8 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 6 Jan 2016 00:01:07 -0500 Subject: [PATCH 118/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 29fdd3f23..2b2b99738 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20160105) +set(CMake_VERSION_PATCH 20160106) #set(CMake_VERSION_RC 1) From b021455e40f921ab3887dec8cde665838b92bd66 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 7 Jan 2016 00:01:05 -0500 Subject: [PATCH 119/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 2b2b99738..cf87759e1 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20160106) +set(CMake_VERSION_PATCH 20160107) #set(CMake_VERSION_RC 1) From f2b0bf6e3f45f4f2a474732f29528299825bf7e9 Mon Sep 17 00:00:00 2001 From: KWSys Upstream Date: Thu, 7 Jan 2016 13:00:32 -0500 Subject: [PATCH 120/255] KWSys 2016-01-07 (2418443e) Code extracted from: http://public.kitware.com/KWSys.git at commit 2418443ed01e5caeb47908064fd4dad2eff4736f (master). Upstream Shortlog ----------------- Clinton Stimpson (1): 2418443e FStream: Fix reading BOM on single-character files --- FStream.cxx | 2 ++ testFStream.cxx | 79 +++++++++---------------------------------------- 2 files changed, 16 insertions(+), 65 deletions(-) diff --git a/FStream.cxx b/FStream.cxx index 018652c84..5a30997d6 100644 --- a/FStream.cxx +++ b/FStream.cxx @@ -34,6 +34,7 @@ BOM ReadBOM(std::istream& in) in.read(reinterpret_cast(bom), 2); if(!in.good()) { + in.clear(); in.seekg(orig); return BOM_None; } @@ -68,6 +69,7 @@ BOM ReadBOM(std::istream& in) in.seekg(p); return BOM_UTF16LE; } + in.clear(); in.seekg(orig); return BOM_None; } diff --git a/testFStream.cxx b/testFStream.cxx index ac5220ac0..5e537258f 100644 --- a/testFStream.cxx +++ b/testFStream.cxx @@ -41,8 +41,13 @@ static int testNoFile() return 0; } -static kwsys::FStream::BOM expected_bom[5] = +static const int num_test_files = 7; +static const int max_test_file_size = 45; + +static kwsys::FStream::BOM expected_bom[num_test_files] = { + kwsys::FStream::BOM_None, + kwsys::FStream::BOM_None, kwsys::FStream::BOM_UTF8, kwsys::FStream::BOM_UTF16LE, kwsys::FStream::BOM_UTF16BE, @@ -50,8 +55,10 @@ static kwsys::FStream::BOM expected_bom[5] = kwsys::FStream::BOM_UTF32BE }; -static unsigned char expected_bom_data[5][5] = +static unsigned char expected_bom_data[num_test_files][5] = { + {0}, + {0}, {3, 0xEF, 0xBB, 0xBF}, {2, 0xFF, 0xFE}, {2, 0xFE, 0xFF}, @@ -59,8 +66,10 @@ static unsigned char expected_bom_data[5][5] = {4, 0x00, 0x00, 0xFE, 0xFF}, }; -static unsigned char file_data[5][45] = +static unsigned char file_data[num_test_files][max_test_file_size] = { + {1, 'H'}, + {11, 'H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd'}, {11, 'H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd'}, {22, 0x48, 0x00, 0x65, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x6F, 0x00, 0x20, 0x00, 0x57, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x6C, 0x00, 0x64, 0x00}, @@ -80,7 +89,7 @@ static unsigned char file_data[5][45] = static int testBOM() { // test various encodings in binary mode - for(int i=0; i<5; i++) + for(int i=0; i(expected_bom_data[0]+1), - *expected_bom_data[0]); - out << "Hello World"; - } - - kwsys::ifstream in("bom.txt"); - kwsys::FStream::BOM bom = kwsys::FStream::ReadBOM(in); - if(bom != kwsys::FStream::BOM_UTF8) - { - std::cout << "Unexpected BOM for utf-8 case" << std::endl; - return 1; - } - char data[45]; - in.read(data, file_data[0][0]); - if(!in.good()) - { - std::cout << "Unable to read data for utf-8 case" << std::endl; - return 1; - } - - if(memcmp(data, file_data[0]+1, file_data[0][0]) != 0) - { - std::cout << "Incorrect read data for utf-8 case" << std::endl; - return 1; - } - } - return 0; } From ba39d7e9d04b6a8d3d9bccdf07b69cd2d959a083 Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Sun, 27 Dec 2015 16:33:46 +0100 Subject: [PATCH 121/255] Xcode: Escape all backslashes in strings (#15328) Before this change backslashes in strings were escaped during compile flags adds via AppendFlag(). But global flags like OTHER_CPLUSPLUSFLAGS are not added as flags but as plain strings so they were not escaped properly. Now the escaping is performed within cmXCodeObject::PrintString() which ensures that strings are always encoded. --- Source/cmGlobalXCodeGenerator.cxx | 31 ++++++------------- Source/cmGlobalXCodeGenerator.h | 1 - Source/cmXCodeObject.cxx | 4 +-- .../RunCMake/XcodeProject/RunCMakeTest.cmake | 1 + .../XcodeObjectNeedsEscape-check.cmake | 7 +++++ .../XcodeProject/XcodeObjectNeedsEscape.cmake | 3 ++ 6 files changed, 22 insertions(+), 25 deletions(-) create mode 100644 Tests/RunCMake/XcodeProject/XcodeObjectNeedsEscape-check.cmake create mode 100644 Tests/RunCMake/XcodeProject/XcodeObjectNeedsEscape.cmake diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 475efa8b6..344964825 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1686,14 +1686,13 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase, } std::string cdir = this->CurrentLocalGenerator->GetCurrentBinaryDirectory(); - cdir = this->ConvertToRelativeForXCode(cdir.c_str()); + cdir = this->ConvertToRelativeForMake(cdir.c_str()); std::string makecmd = "make -C "; makecmd += cdir; makecmd += " -f "; makecmd += this->ConvertToRelativeForMake( (makefile+"$CONFIGURATION").c_str()); makecmd += " all"; - cmSystemTools::ReplaceString(makecmd, "\\ ", "\\\\ "); buildphase->AddAttribute("shellScript", this->CreateString(makecmd.c_str())); buildphase->AddAttribute("showEnvVarsInLog", @@ -2108,10 +2107,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, this->CurrentLocalGenerator ->GenerateAppleInfoPList(gtgt, "$(EXECUTABLE_NAME)", plist.c_str()); - std::string path = - this->ConvertToRelativeForXCode(plist.c_str()); buildSettings->AddAttribute("INFOPLIST_FILE", - this->CreateString(path.c_str())); + this->CreateString(plist)); } else if(this->XcodeVersion >= 22) { @@ -2157,10 +2154,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, this->CurrentLocalGenerator ->GenerateFrameworkInfoPList(gtgt, "$(EXECUTABLE_NAME)", plist.c_str()); - std::string path = - this->ConvertToRelativeForXCode(plist.c_str()); buildSettings->AddAttribute("INFOPLIST_FILE", - this->CreateString(path.c_str())); + this->CreateString(plist)); } else { @@ -2200,10 +2195,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, this->CurrentLocalGenerator ->GenerateAppleInfoPList(gtgt, "$(EXECUTABLE_NAME)", plist.c_str()); - std::string path = - this->ConvertToRelativeForXCode(plist.c_str()); buildSettings->AddAttribute("INFOPLIST_FILE", - this->CreateString(path.c_str())); + this->CreateString(plist)); } } @@ -3880,12 +3873,6 @@ std::string cmGlobalXCodeGenerator::ConvertToRelativeForMake(const char* p) return cmSystemTools::ConvertToOutputPath(p); } -//---------------------------------------------------------------------------- -std::string cmGlobalXCodeGenerator::ConvertToRelativeForXCode(const char* p) -{ - return cmSystemTools::ConvertToOutputPath(p); -} - //---------------------------------------------------------------------------- std::string cmGlobalXCodeGenerator::RelativeToSource(const char* p) { @@ -4022,8 +4009,8 @@ void cmGlobalXCodeGenerator::AppendFlag(std::string& flags, // We escape a flag as follows: // - Place each flag in single quotes '' - // - Escape a single quote as \\' - // - Escape a backslash as \\\\ since it itself is an escape + // - Escape a single quote as \' + // - Escape a backslash as \\ since it itself is an escape // Note that in the code below we need one more level of escapes for // C string syntax in this source file. // @@ -4043,16 +4030,16 @@ void cmGlobalXCodeGenerator::AppendFlag(std::string& flags, { if (this->XcodeVersion >= 40) { - flags += "'\\\\''"; + flags += "'\\''"; } else { - flags += "\\\\'"; + flags += "\\'"; } } else if(*c == '\\') { - flags += "\\\\\\\\"; + flags += "\\\\"; } else { diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index c8a39dfa2..b5fd13ca4 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -99,7 +99,6 @@ private: std::string XCodeEscapePath(const char* p); std::string RelativeToSource(const char* p); std::string RelativeToBinary(const char* p); - std::string ConvertToRelativeForXCode(const char* p); std::string ConvertToRelativeForMake(const char* p); void CreateCustomCommands(cmXCodeObject* buildPhases, cmXCodeObject* sourceBuildPhase, diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx index c59c3609f..5bc34c136 100644 --- a/Source/cmXCodeObject.cxx +++ b/Source/cmXCodeObject.cxx @@ -255,9 +255,9 @@ void cmXCodeObject::PrintString(std::ostream& os,std::string String) for(std::string::const_iterator i = String.begin(); i != String.end(); ++i) { - if(*i == '"') + if(*i == '"' || *i == '\\') { - // Escape double-quotes. + // Escape double-quotes and backslashes. os << '\\'; } os << *i; diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index acc007580..395c74b30 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -3,6 +3,7 @@ include(RunCMake) run_cmake(XcodeFileType) run_cmake(XcodeAttributeGenex) run_cmake(XcodeAttributeGenexError) +run_cmake(XcodeObjectNeedsEscape) run_cmake(XcodeObjectNeedsQuote) run_cmake(XcodeOptimizationFlags) run_cmake(XcodePreserveNonOptimizationFlags) diff --git a/Tests/RunCMake/XcodeProject/XcodeObjectNeedsEscape-check.cmake b/Tests/RunCMake/XcodeProject/XcodeObjectNeedsEscape-check.cmake new file mode 100644 index 000000000..c34e3feb6 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeObjectNeedsEscape-check.cmake @@ -0,0 +1,7 @@ +set(expect "-DKDESRCDIR=\\\\\\\\\\\\\"foo\\\\\\\\\\\\\"") +file(STRINGS ${RunCMake_TEST_BINARY_DIR}/XcodeObjectNeedsEscape.xcodeproj/project.pbxproj actual + REGEX "OTHER_CPLUSPLUSFLAGS = [^;]*;" LIMIT_COUNT 1) +if(NOT "${actual}" MATCHES "${expect}") + message(SEND_ERROR "The actual project contains the line:\n ${actual}\n" + "which does not match expected regex:\n ${expect}\n") +endif() diff --git a/Tests/RunCMake/XcodeProject/XcodeObjectNeedsEscape.cmake b/Tests/RunCMake/XcodeProject/XcodeObjectNeedsEscape.cmake new file mode 100644 index 000000000..7606a1906 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeObjectNeedsEscape.cmake @@ -0,0 +1,3 @@ +enable_language(CXX) +string(APPEND CMAKE_CXX_FLAGS " -DKDESRCDIR=\\\"foo\\\"") +add_library(foo STATIC foo.cpp) From b947fc27d5e8c54b2e4cd58c6c9b22b34a843039 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 21 Dec 2015 09:48:35 -0500 Subject: [PATCH 122/255] CTestCustom: Suppress -Wshadow warning about Solaris 'single' typedef On Solaris the system `/usr/include/floatingpoint.h` header contains typedef float single; so the GNU compiler warns that uses of the name `single` shadow it. Just suppress the warning because our uses of this name would become less readable with a different name. --- CTestCustom.cmake.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index db64559bb..abef69214 100644 --- a/CTestCustom.cmake.in +++ b/CTestCustom.cmake.in @@ -21,7 +21,8 @@ list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION "Utilities.cmcurl" "Utilities.cmexpat." "Utilities.cmlibarchive" - "/usr/include.*warning.*shadowed declaration is here" + "warning: declaration of .single. shadows a global declaration" + "/usr/include.*(warning|note).*shadowed declaration is here" "/usr/bin/ld.*warning.*-..*directory.name.*bin.*does not exist" "Redeclaration of .send..... with a different storage class specifier" "is not used for resolving any symbol" From bbb3c4ffc18dcadc774b7fe4b2ceca1557ddb253 Mon Sep 17 00:00:00 2001 From: Andrey Mishchenko Date: Sat, 2 Jan 2016 16:11:00 -0500 Subject: [PATCH 123/255] CPack/DragNDrop: Fix handling of certain license file content (#15899) There were issues in the special-character-escaping and line-wrapping code which caused DragNDrop packaging to fail mysteriously at a later step with parsing errors in the `sla.r` file generated by the following code. --- Source/CPack/cmCPackDragNDropGenerator.cxx | 90 +++++++++++++++++----- Source/CPack/cmCPackDragNDropGenerator.h | 12 +-- 2 files changed, 77 insertions(+), 25 deletions(-) diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index 1a694eaa9..7b94ca3c0 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -693,27 +693,49 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, ofs << std::dec << std::nouppercase << std::setfill(' '); } + bool have_write_license_error = false; + std::string error; + if(oldStyle) { - WriteLicense(ofs, 0, "", cpack_license_file); + if(!this->WriteLicense(ofs, 0, "", cpack_license_file, &error)) + { + have_write_license_error = true; + } } else { - for(size_t i = 0; i < languages.size(); ++i) + for(size_t i = 0; i < languages.size() && !have_write_license_error; ++i) { if(singleLicense) { - WriteLicense(ofs, i + 5000, languages[i], cpack_license_file); + if(!this->WriteLicense(ofs, i + 5000, languages[i], + cpack_license_file, &error)) + { + have_write_license_error = true; + } } else { - WriteLicense(ofs, i + 5000, languages[i]); + if(!this->WriteLicense(ofs, i + 5000, languages[i], "", &error)) + { + have_write_license_error = true; + } } } } ofs.Close(); + if(have_write_license_error) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error writing license file to SLA." << std::endl + << error + << std::endl); + return 0; + } + // convert to UDCO std::string temp_udco = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); temp_udco += "/temp-udco.dmg"; @@ -724,7 +746,6 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, udco_image_command << " -format UDCO"; udco_image_command << " -ov -o \"" << temp_udco << "\""; - std::string error; if(!this->RunCommand(udco_image_command, &error)) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -855,9 +876,10 @@ cmCPackDragNDropGenerator::GetComponentInstallDirNameSuffix( return GetComponentPackageFileName(package_file_name, componentName, false); } -void +bool cmCPackDragNDropGenerator::WriteLicense(cmGeneratedFileStream& outputStream, - int licenseNumber, std::string licenseLanguage, std::string licenseFile) + int licenseNumber, std::string licenseLanguage, std::string licenseFile, + std::string *error) { if(!licenseFile.empty() && !singleLicense) { @@ -881,9 +903,12 @@ cmCPackDragNDropGenerator::WriteLicense(cmGeneratedFileStream& outputStream, std::getline(license_ifs, line); if(!line.empty()) { - EscapeQuotes(line); + EscapeQuotesAndBackslashes(line); std::vector lines; - BreakLongLine(line, lines); + if(!this->BreakLongLine(line, lines, error)) + { + return false; + } for(size_t i = 0; i < lines.size(); ++i) { outputStream << " \"" << lines[i] << "\"\n"; @@ -920,9 +945,12 @@ cmCPackDragNDropGenerator::WriteLicense(cmGeneratedFileStream& outputStream, std::getline(menu_ifs, line); if(!line.empty()) { - EscapeQuotes(line); + EscapeQuotesAndBackslashes(line); std::vector lines; - BreakLongLine(line, lines); + if(!this->BreakLongLine(line, lines, error)) + { + return false; + } for(size_t i = 0; i < lines.size(); ++i) { std::string comma; @@ -949,31 +977,53 @@ cmCPackDragNDropGenerator::WriteLicense(cmGeneratedFileStream& outputStream, outputStream << "};\n"; outputStream << "\n"; } + + return true; } -void +bool cmCPackDragNDropGenerator::BreakLongLine(const std::string& line, - std::vector& lines) + std::vector& lines, std::string *error) { const size_t max_line_length = 512; for(size_t i = 0; i < line.size(); i += max_line_length) { - int line_length = max_line_length; - if(i + max_line_length > line.size()) + size_t line_length = max_line_length; + if(i + line_length > line.size()) { line_length = line.size() - i; } + else while(line_length > 0 && line[i + line_length - 1] != ' ') + { + line_length = line_length - 1; + } + + if(line_length == 0) + { + *error = "Please make sure there are no words " + "(or character sequences not broken up by spaces or newlines) " + "in your license file which are more than 512 characters long."; + return false; + } lines.push_back(line.substr(i, line_length)); } + return true; } void -cmCPackDragNDropGenerator::EscapeQuotes(std::string& line) +cmCPackDragNDropGenerator::EscapeQuotesAndBackslashes(std::string& line) { - std::string::size_type pos = line.find('\"'); - while(pos != std::string::npos) + std::string::size_type backslash_pos = line.find('\\'); + while(backslash_pos != std::string::npos) { - line.replace(pos, 1, "\\\""); - pos = line.find('\"', pos + 2); + line.replace(backslash_pos, 1, "\\\\"); + backslash_pos = line.find('\\', backslash_pos + 2); + } + + std::string::size_type quote_pos = line.find('\"'); + while(quote_pos != std::string::npos) + { + line.replace(quote_pos, 1, "\\\""); + quote_pos = line.find('\"', quote_pos + 2); } } diff --git a/Source/CPack/cmCPackDragNDropGenerator.h b/Source/CPack/cmCPackDragNDropGenerator.h index b5e5ffe6b..604cdf586 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.h +++ b/Source/CPack/cmCPackDragNDropGenerator.h @@ -50,11 +50,13 @@ private: std::string slaDirectory; bool singleLicense; - void WriteLicense(cmGeneratedFileStream& outputStream, int licenseNumber, - std::string licenseLanguage, std::string licenseFile = ""); - void BreakLongLine(const std::string& line, - std::vector& lines); - void EscapeQuotes(std::string& line); + bool WriteLicense(cmGeneratedFileStream& outputStream, int licenseNumber, + std::string licenseLanguage, std::string licenseFile, + std::string *error); + bool BreakLongLine(const std::string& line, + std::vector& lines, + std::string *error); + void EscapeQuotesAndBackslashes(std::string& line); }; #endif From 963d99de1477f1a117dca232c74b4dd2e3f7949a Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 8 Jan 2016 00:01:08 -0500 Subject: [PATCH 124/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index cf87759e1..bf3b849f9 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20160107) +set(CMake_VERSION_PATCH 20160108) #set(CMake_VERSION_RC 1) From c173e37fa32b9d212cc6305f5e6dc881ba34e140 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 7 Jan 2016 14:54:32 -0500 Subject: [PATCH 125/255] VS: Do not select a partial Windows 10 SDK folder (#15831) Skip SDK candidate folders that do not contain as they are not full SDKs. --- Source/cmGlobalVisualStudio14Generator.cxx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index 41825fb15..803b50083 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -229,6 +229,16 @@ cmGlobalVisualStudio14Generator::IsWindowsStoreToolsetInstalled() const win10SDK, cmSystemTools::KeyWOW64_32); } +#if defined(_WIN32) && !defined(__CYGWIN__) +struct NoWindowsH +{ + bool operator()(std::string const& p) + { + return !cmSystemTools::FileExists(p + "/um/windows.h", true); + } +}; +#endif + //---------------------------------------------------------------------------- std::string cmGlobalVisualStudio14Generator::GetWindows10SDKVersion() { @@ -252,6 +262,12 @@ std::string cmGlobalVisualStudio14Generator::GetWindows10SDKVersion() std::string path = win10Root + "Include/*"; // Grab the paths of the different SDKs that are installed cmSystemTools::GlobDirs(path, sdks); + + // Skip SDKs that do not contain because that indicates that + // only the UCRT MSIs were installed for them. + sdks.erase(std::remove_if(sdks.begin(), sdks.end(), NoWindowsH()), + sdks.end()); + if (!sdks.empty()) { // Only use the filename, which will be the SDK version. From 2b48f63ce38e49a5c3ee84aa3763da00c8af08f3 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 8 Jan 2016 11:47:39 -0500 Subject: [PATCH 126/255] FindBLAS: Fix pattern matching on BLAS vendor name The if(STREQUAL) expressions do not support globbing expressions. Use regular experssions with MATCHES instead. Reported-by: Yahui Wang --- Modules/FindBLAS.cmake | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index 6a583d957..416b666b9 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -494,18 +494,18 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN "mkl_blas95${BLAS_mkl_DLL_SUFFIX} mkl_intel_c${BLAS_mkl_DLL_SUFFIX}") endif() - if (BLA_VENDOR STREQUAL "Intel10_64lp*" OR BLA_VENDOR STREQUAL "All") + if (BLA_VENDOR MATCHES "^Intel10_64lp" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN "mkl_blas95_lp64${BLAS_mkl_DLL_SUFFIX} mkl_intel_lp64${BLAS_mkl_DLL_SUFFIX}") endif () # Add threading/sequential libs set(BLAS_SEARCH_LIBS_WIN_THREAD "") - if (BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All") + if (BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD "mkl_sequential${BLAS_mkl_DLL_SUFFIX}") endif() - if (NOT BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All") + if (NOT BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All") # old version list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD "libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}") @@ -561,14 +561,14 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN "mkl_intel_c${BLAS_mkl_DLL_SUFFIX}") endif() - if (BLA_VENDOR STREQUAL "Intel10_64lp*" OR BLA_VENDOR STREQUAL "All") + if (BLA_VENDOR MATCHES "^Intel10_64lp" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN "mkl_intel_lp64${BLAS_mkl_DLL_SUFFIX}") endif () # Add threading/sequential libs set(BLAS_SEARCH_LIBS_WIN_THREAD "") - if (NOT BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All") + if (NOT BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All") # old version list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD "libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}") @@ -576,7 +576,7 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD "libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}") endif() - if (BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All") + if (BLA_VENDOR MATCHES "_seq$" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD "mkl_sequential${BLAS_mkl_DLL_SUFFIX}") endif() From f086c665da00228cabf465dc1eb7223d40fd6270 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 8 Jan 2016 14:12:48 -0500 Subject: [PATCH 127/255] VS: Fix VS 2015 .vcxproj file value for GenerateDebugInformation (#15894) Starting with VS 2015 the GenerateDebugInformation build property is an enumeration (`No`, `Debug`, `DebugFastLink`) instead of a boolean value (`false`, `true`). For now we simply change to `No` and `Debug` fix current behavior. Support for `/debug:fastlink` can be added later. --- Source/cmVisualStudio10TargetGenerator.cxx | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 1de284721..6b4677391 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2579,11 +2579,27 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config) if(linkOptions.IsDebug() || flags.find("/debug") != flags.npos) { - linkOptions.AddFlag("GenerateDebugInformation", "true"); + if (this->LocalGenerator->GetVersion() >= + cmGlobalVisualStudioGenerator::VS14) + { + linkOptions.AddFlag("GenerateDebugInformation", "Debug"); + } + else + { + linkOptions.AddFlag("GenerateDebugInformation", "true"); + } } else { - linkOptions.AddFlag("GenerateDebugInformation", "false"); + if (this->LocalGenerator->GetVersion() >= + cmGlobalVisualStudioGenerator::VS14) + { + linkOptions.AddFlag("GenerateDebugInformation", "No"); + } + else + { + linkOptions.AddFlag("GenerateDebugInformation", "false"); + } } std::string pdb = this->Target->GetPDBDirectory(config.c_str()); pdb += "/"; From c6ff95be6113bb2880653caa4efc0d125016f7e0 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 9 Jan 2016 00:01:11 -0500 Subject: [PATCH 128/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index bf3b849f9..aa8132ec2 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20160108) +set(CMake_VERSION_PATCH 20160109) #set(CMake_VERSION_RC 1) From 7a45d91dc4dcbf52a576cca37878bc5c37f293f3 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 10 Jan 2016 00:01:06 -0500 Subject: [PATCH 129/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index aa8132ec2..635deea7b 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20160109) +set(CMake_VERSION_PATCH 20160110) #set(CMake_VERSION_RC 1) From 196d912200667750d73d872c1c237eebe9d426e0 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 11 Jan 2016 00:01:06 -0500 Subject: [PATCH 130/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 635deea7b..d44f58eb3 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20160110) +set(CMake_VERSION_PATCH 20160111) #set(CMake_VERSION_RC 1) From 4ca9df8bd1991870a8a4acfeae26933e8ca7dc9a Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 8 Jan 2016 14:30:06 -0500 Subject: [PATCH 131/255] cmIDEOptions: Add support for case-insensitive flags --- Source/cmIDEFlagTable.h | 1 + Source/cmIDEOptions.cxx | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Source/cmIDEFlagTable.h b/Source/cmIDEFlagTable.h index d9a045d6b..adc77632b 100644 --- a/Source/cmIDEFlagTable.h +++ b/Source/cmIDEFlagTable.h @@ -32,6 +32,7 @@ struct cmIDEFlagTable // /NODEFAULTLIB: => // IgnoreDefaultLibraryNames) UserFollowing = (1<<5), // expect value in following argument + CaseInsensitive = (1<<6), // flag may be any case UserValueIgnored = UserValue | UserIgnored, UserValueRequired = UserValue | UserRequired diff --git a/Source/cmIDEOptions.cxx b/Source/cmIDEOptions.cxx index 0eb903d84..509602fbd 100644 --- a/Source/cmIDEOptions.cxx +++ b/Source/cmIDEOptions.cxx @@ -13,6 +13,8 @@ #include "cmSystemTools.h" +#include + //---------------------------------------------------------------------------- cmIDEOptions::cmIDEOptions() { @@ -104,7 +106,9 @@ bool cmIDEOptions::CheckFlagTable(cmIDEFlagTable const* table, // the entry specifies UserRequired we must match only if a // non-empty value is given. int n = static_cast(strlen(entry->commandFlag)); - if(strncmp(flag+1, entry->commandFlag, n) == 0 && + if((strncmp(flag+1, entry->commandFlag, n) == 0 || + (entry->special & cmIDEFlagTable::CaseInsensitive && + cmsysString_strncasecmp(flag+1, entry->commandFlag, n))) && (!(entry->special & cmIDEFlagTable::UserRequired) || static_cast(strlen(flag+1)) > n)) { @@ -112,7 +116,9 @@ bool cmIDEOptions::CheckFlagTable(cmIDEFlagTable const* table, entry_found = true; } } - else if(strcmp(flag+1, entry->commandFlag) == 0) + else if(strcmp(flag+1, entry->commandFlag) == 0 || + (entry->special & cmIDEFlagTable::CaseInsensitive && + cmsysString_strcasecmp(flag+1, entry->commandFlag) == 0)) { if(entry->special & cmIDEFlagTable::UserFollowing) { From c22da7cff74a293d6362598c2a381147d658022f Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 8 Jan 2016 14:36:45 -0500 Subject: [PATCH 132/255] VS: Drop unused condition in link debug flag generation The `linkOptions.IsDebug()` call never returns true because it checks for `DebugInformationFormat` which is a compiler (cl) flag. --- Source/cmVisualStudio10TargetGenerator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 669c78543..56f724f51 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2597,7 +2597,7 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config) linkOptions.AddFlag("StackReserveSize", stackVal); } - if(linkOptions.IsDebug() || flags.find("/debug") != flags.npos) + if(flags.find("/debug") != flags.npos) { if (this->LocalGenerator->GetVersion() >= cmGlobalVisualStudioGenerator::VS14) From b3677b35d320cce5d23831ec398d6bb283d1444e Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 8 Jan 2016 14:38:58 -0500 Subject: [PATCH 133/255] VS: Map the link `/debug` to its IDE property Fix the link flag table entries for this flag to be case-insensitive. Also fix the VS 2015 value for the build property enumeration name. This causes `linkOptions.Parse(...)` to correctly extract the `/debug` flag and map it to the IDE property instead. Therefore we do not need to look for the flag explicitly when initializing the property. --- Source/cmVS10LinkFlagTable.h | 3 ++- Source/cmVS11LinkFlagTable.h | 3 ++- Source/cmVS12LinkFlagTable.h | 3 ++- Source/cmVS14LinkFlagTable.h | 3 ++- Source/cmVisualStudio10TargetGenerator.cxx | 24 +++++----------------- 5 files changed, 13 insertions(+), 23 deletions(-) diff --git a/Source/cmVS10LinkFlagTable.h b/Source/cmVS10LinkFlagTable.h index f6b758d05..dd9232986 100644 --- a/Source/cmVS10LinkFlagTable.h +++ b/Source/cmVS10LinkFlagTable.h @@ -155,7 +155,8 @@ static cmVS7FlagTable cmVS10LinkFlagTable[] = {"AllowIsolation", "ALLOWISOLATION:NO", "", "false", 0}, {"UACUIAccess", "uiAccess='false'", "", "false", 0}, {"UACUIAccess", "uiAccess='true'", "", "true", 0}, - {"GenerateDebugInformation", "DEBUG", "", "true", 0}, + {"GenerateDebugInformation", "DEBUG", "", "true", + cmVS7FlagTable::CaseInsensitive}, {"MapExports", "MAPINFO:EXPORTS", "", "true", 0}, {"AssemblyDebug", "ASSEMBLYDEBUG:DISABLE", "", "false", 0}, {"AssemblyDebug", "ASSEMBLYDEBUG", "", "true", 0}, diff --git a/Source/cmVS11LinkFlagTable.h b/Source/cmVS11LinkFlagTable.h index 0f641e40e..2d6f6c074 100644 --- a/Source/cmVS11LinkFlagTable.h +++ b/Source/cmVS11LinkFlagTable.h @@ -177,7 +177,8 @@ static cmVS7FlagTable cmVS11LinkFlagTable[] = {"UACUIAccess", "uiAccess='false'", "", "false", 0}, {"UACUIAccess", "uiAccess='true'", "", "true", 0}, {"ManifestEmbed", "manifest:embed", "", "true", 0}, - {"GenerateDebugInformation", "DEBUG", "", "true", 0}, + {"GenerateDebugInformation", "DEBUG", "", "true", + cmVS7FlagTable::CaseInsensitive}, {"MapExports", "MAPINFO:EXPORTS", "", "true", 0}, {"AssemblyDebug", "ASSEMBLYDEBUG:DISABLE", "", "false", 0}, {"AssemblyDebug", "ASSEMBLYDEBUG", "", "true", 0}, diff --git a/Source/cmVS12LinkFlagTable.h b/Source/cmVS12LinkFlagTable.h index e5a570e7c..0be5e340d 100644 --- a/Source/cmVS12LinkFlagTable.h +++ b/Source/cmVS12LinkFlagTable.h @@ -177,7 +177,8 @@ static cmVS7FlagTable cmVS12LinkFlagTable[] = {"UACUIAccess", "uiAccess='false'", "", "false", 0}, {"UACUIAccess", "uiAccess='true'", "", "true", 0}, {"ManifestEmbed", "manifest:embed", "", "true", 0}, - {"GenerateDebugInformation", "DEBUG", "", "true", 0}, + {"GenerateDebugInformation", "DEBUG", "", "true", + cmVS7FlagTable::CaseInsensitive}, {"MapExports", "MAPINFO:EXPORTS", "", "true", 0}, {"AssemblyDebug", "ASSEMBLYDEBUG:DISABLE", "", "false", 0}, {"AssemblyDebug", "ASSEMBLYDEBUG", "", "true", 0}, diff --git a/Source/cmVS14LinkFlagTable.h b/Source/cmVS14LinkFlagTable.h index 6d81d125f..1e781e888 100644 --- a/Source/cmVS14LinkFlagTable.h +++ b/Source/cmVS14LinkFlagTable.h @@ -177,7 +177,8 @@ static cmVS7FlagTable cmVS14LinkFlagTable[] = {"UACUIAccess", "uiAccess='false'", "", "false", 0}, {"UACUIAccess", "uiAccess='true'", "", "true", 0}, {"ManifestEmbed", "manifest:embed", "", "true", 0}, - {"GenerateDebugInformation", "DEBUG", "", "true", 0}, + {"GenerateDebugInformation", "DEBUG", "", "Debug", + cmVS7FlagTable::CaseInsensitive}, {"MapExports", "MAPINFO:EXPORTS", "", "true", 0}, {"AssemblyDebug", "ASSEMBLYDEBUG:DISABLE", "", "false", 0}, {"AssemblyDebug", "ASSEMBLYDEBUG", "", "true", 0}, diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 56f724f51..2120035fa 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2597,30 +2597,16 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config) linkOptions.AddFlag("StackReserveSize", stackVal); } - if(flags.find("/debug") != flags.npos) + if (this->LocalGenerator->GetVersion() >= + cmGlobalVisualStudioGenerator::VS14) { - if (this->LocalGenerator->GetVersion() >= - cmGlobalVisualStudioGenerator::VS14) - { - linkOptions.AddFlag("GenerateDebugInformation", "Debug"); - } - else - { - linkOptions.AddFlag("GenerateDebugInformation", "true"); - } + linkOptions.AddFlag("GenerateDebugInformation", "No"); } else { - if (this->LocalGenerator->GetVersion() >= - cmGlobalVisualStudioGenerator::VS14) - { - linkOptions.AddFlag("GenerateDebugInformation", "No"); - } - else - { - linkOptions.AddFlag("GenerateDebugInformation", "false"); - } + linkOptions.AddFlag("GenerateDebugInformation", "false"); } + std::string pdb = this->GeneratorTarget->GetPDBDirectory(config.c_str()); pdb += "/"; pdb += targetNamePDB; From 3baca6364bb1569e6856337d80e54b37a96d017e Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 11 Jan 2016 10:08:01 -0500 Subject: [PATCH 134/255] Record compile features for MinGW Clang on Windows (#15897) Drop the 'UNIX' condition on Clang compiler features. This enables use of compile features with MinGW Clang, though additional work may be needed for clang-cl. --- Help/release/dev/mingw-clang-compile-features.rst | 5 +++++ Modules/Compiler/Clang-CXX.cmake | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 Help/release/dev/mingw-clang-compile-features.rst diff --git a/Help/release/dev/mingw-clang-compile-features.rst b/Help/release/dev/mingw-clang-compile-features.rst new file mode 100644 index 000000000..5b1fb9642 --- /dev/null +++ b/Help/release/dev/mingw-clang-compile-features.rst @@ -0,0 +1,5 @@ +mingw-clang-compile-features +---------------------------- + +* The :manual:`Compile Features ` functionality + is now aware of features supported by Clang compilers on Windows (MinGW). diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake index 6a0a5e2ff..dc6271198 100644 --- a/Modules/Compiler/Clang-CXX.cmake +++ b/Modules/Compiler/Clang-CXX.cmake @@ -6,7 +6,7 @@ if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") endif() cmake_policy(GET CMP0025 appleClangPolicy) -if(WIN32 OR (APPLE AND NOT appleClangPolicy STREQUAL NEW)) +if(APPLE AND NOT appleClangPolicy STREQUAL NEW) return() endif() @@ -49,7 +49,7 @@ macro(cmake_record_cxx_compile_features) endmacro() set(_result 0) - if (UNIX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4) + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4) _get_clang_features(${CMAKE_CXX14_STANDARD_COMPILE_OPTION} CMAKE_CXX14_COMPILE_FEATURES) if (_result EQUAL 0) _get_clang_features(${CMAKE_CXX11_STANDARD_COMPILE_OPTION} CMAKE_CXX11_COMPILE_FEATURES) From 8e7356a2921c769c091c52140564b04108e692c4 Mon Sep 17 00:00:00 2001 From: KWSys Upstream Date: Mon, 11 Jan 2016 09:01:00 -0500 Subject: [PATCH 135/255] KWSys 2016-01-11 (e8bf616e) Code extracted from: http://public.kitware.com/KWSys.git at commit e8bf616e3556368bf19dbebcd3529a89011ebacb (master). Upstream Shortlog ----------------- Brad King (1): e8bf616e SystemTools: Fix GetShortPath buffer sizing Jan van Dorsten (1): cfb2477d SystemTools: Simplify GetShortPath de-quoting step Robert Maynard (1): 8ef9773d Don't use clang diagnostic pragma's when compiling with ICC on OSX. --- MD5.c | 4 ++-- ProcessUNIX.c | 4 ++-- SystemTools.cxx | 21 ++++++--------------- 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/MD5.c b/MD5.c index a1470572d..b9d25a8d7 100644 --- a/MD5.c +++ b/MD5.c @@ -29,7 +29,7 @@ it in a single source file instead of a separate header and implementation file. */ -#if defined(__clang__) +#if defined(__clang__) && !defined(__INTEL_COMPILER) # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wcast-align" #endif @@ -433,7 +433,7 @@ static void md5_finish(md5_state_t *pms, md5_byte_t digest[16]) digest[i] = (md5_byte_t)(pms->abcd[i >> 2] >> ((i & 3) << 3)); } -#if defined(__clang__) +#if defined(__clang__) && !defined(__INTEL_COMPILER) # pragma clang diagnostic pop #endif diff --git a/ProcessUNIX.c b/ProcessUNIX.c index b0ddf5a13..07c644b8e 100644 --- a/ProcessUNIX.c +++ b/ProcessUNIX.c @@ -1595,12 +1595,12 @@ static void kwsysProcessVolatileFree(volatile void* p) { /* clang has made it impossible to free memory that points to volatile without first using special pragmas to disable a warning... */ -#if defined(__clang__) +#if defined(__clang__) && !defined(__INTEL_COMPILER) # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wcast-qual" #endif free((void*)p); /* The cast will silence most compilers, but not clang. */ -#if defined(__clang__) +#if defined(__clang__) && !defined(__INTEL_COMPILER) # pragma clang diagnostic pop #endif } diff --git a/SystemTools.cxx b/SystemTools.cxx index 82087f060..e3428f878 100644 --- a/SystemTools.cxx +++ b/SystemTools.cxx @@ -4491,36 +4491,27 @@ bool SystemTools::FileIsFullPath(const char* in_name, size_t len) bool SystemTools::GetShortPath(const std::string& path, std::string& shortPath) { #if defined(_WIN32) && !defined(__CYGWIN__) - const int size = int(path.size()) +1; // size of return - char *tempPath = new char[size]; // create a buffer - DWORD ret; + std::string tempPath = path; // create a buffer // if the path passed in has quotes around it, first remove the quotes if (!path.empty() && path[0] == '"' && *path.rbegin() == '"') { - strcpy(tempPath,path.c_str()+1); - tempPath[size-2] = '\0'; - } - else - { - strcpy(tempPath,path.c_str()); + tempPath = path.substr(1, path.length()-2); } std::wstring wtempPath = Encoding::ToWide(tempPath); - std::vector buffer(wtempPath.size()+1); - buffer[0] = 0; + DWORD ret = GetShortPathNameW(wtempPath.c_str(), NULL, 0); + std::vector buffer(ret); ret = GetShortPathNameW(wtempPath.c_str(), - &buffer[0], static_cast(wtempPath.size())); + &buffer[0], static_cast(buffer.size())); - if(buffer[0] == 0 || ret > wtempPath.size()) + if (ret == 0) { - delete [] tempPath; return false; } else { shortPath = Encoding::ToNarrow(&buffer[0]); - delete [] tempPath; return true; } #else From af39f11521af7fc2ec037103df1ad5a616dd7f19 Mon Sep 17 00:00:00 2001 From: Mike Fitzgerald Date: Fri, 8 Jan 2016 17:33:28 -0500 Subject: [PATCH 136/255] VS: Implement VS_GLOBAL_* target properties in VS 2010+ (#13666) These have been documented but previously only implemented for VS 2008 and below. --- Help/release/dev/vs-global-properties.rst | 5 +++++ Source/cmVisualStudio10TargetGenerator.cxx | 26 ++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 Help/release/dev/vs-global-properties.rst diff --git a/Help/release/dev/vs-global-properties.rst b/Help/release/dev/vs-global-properties.rst new file mode 100644 index 000000000..cae49b742 --- /dev/null +++ b/Help/release/dev/vs-global-properties.rst @@ -0,0 +1,5 @@ +vs-global-properties +-------------------- + +* The :prop_tgt:`VS_GLOBAL_` target property is now implemented + for VS 2010 and above. Previously it worked only in VS 2008 and below. diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 669c78543..c9705aca4 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -448,6 +448,32 @@ void cmVisualStudio10TargetGenerator::Generate() (*this->BuildFileStream) << cmVS10EscapeXML(targetFrameworkVersion) << "\n"; } + + std::vector keys = this->GeneratorTarget->GetPropertyKeys(); + for(std::vector::const_iterator keyIt = keys.begin(); + keyIt != keys.end(); ++keyIt) + { + static const char* prefix = "VS_GLOBAL_"; + if(keyIt->find(prefix) != 0) + continue; + std::string globalKey = keyIt->substr(strlen(prefix)); + // Skip invalid or separately-handled properties. + if(globalKey == "" || + globalKey == "PROJECT_TYPES" || + globalKey == "ROOTNAMESPACE" || + globalKey == "KEYWORD") + { + continue; + } + const char* value = this->GeneratorTarget->GetProperty(keyIt->c_str()); + if (!value) + continue; + this->WriteString("<", 2); + (*this->BuildFileStream) << globalKey << ">" + << cmVS10EscapeXML(value) + << "\n"; + } + this->WriteString("\n", 1); this->WriteString("\n", From ad594de8cc9c4063830df58453b0679c209ff4d8 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 11 Jan 2016 13:42:07 -0500 Subject: [PATCH 137/255] cmSystemTools: Add VersionCompareEqual helper Wrap a call to VersionCompare with OP_EQUAL. --- Source/cmSystemTools.cxx | 8 ++++++++ Source/cmSystemTools.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 2c5aa8a1a..d8b841509 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -2776,6 +2776,14 @@ bool cmSystemTools::VersionCompare(cmSystemTools::CompareOp op, return op == cmSystemTools::OP_EQUAL; } +//---------------------------------------------------------------------------- +bool cmSystemTools::VersionCompareEqual(std::string const& lhs, + std::string const& rhs) +{ + return cmSystemTools::VersionCompare( + cmSystemTools::OP_EQUAL, lhs.c_str(), rhs.c_str()); +} + //---------------------------------------------------------------------------- bool cmSystemTools::VersionCompareGreater(std::string const& lhs, std::string const& rhs) diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index b6b09783a..9cafbecfd 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -294,6 +294,8 @@ public: * Compare versions */ static bool VersionCompare(CompareOp op, const char* lhs, const char* rhs); + static bool VersionCompareEqual(std::string const& lhs, + std::string const& rhs); static bool VersionCompareGreater(std::string const& lhs, std::string const& rhs); From a57caf7eecdfe61e4ac5f63b145fc9269610f3f0 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 11 Jan 2016 13:44:11 -0500 Subject: [PATCH 138/255] VS: Fix Windows 10 SDK version selection (#15831) In commit v3.4.0-rc1~5^2~1 (VS: Add support for selecting the Windows 10 SDK, 2015-09-30) we added Windows 10 SDK selection choosing the most recent SDK that is not newer than the target version. This is backward because it should be up to the application code to not use APIs newer than the target version. It is up to the build system to provide a SDK that has at least the APIs expected to be available for the target version. Furthermore, since the default target version is the host version of Windows, the old approach breaks when the only SDK available is for a newer version of Windows. Fix this by always selecting a Windows 10 SDK if one exists. Use the SDK for the exact version if is available. Otherwise use the latest version of the SDK available because that will have at least the APIs expected for the target version. --- Source/cmGlobalVisualStudio14Generator.cxx | 26 ++++++++-------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index 803b50083..83499f1a6 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -277,29 +277,21 @@ std::string cmGlobalVisualStudio14Generator::GetWindows10SDKVersion() *i = cmSystemTools::GetFilenameName(*i); } - // Sort the results to make sure we select the most recent one that - // has a version less or equal to our version of the operating system + // Sort the results to make sure we select the most recent one. std::sort(sdks.begin(), sdks.end(), cmSystemTools::VersionCompareGreater); - // Select a suitable SDK version. - if (this->SystemVersion == "10.0") + // Look for a SDK exactly matching the requested target version. + for (std::vector::iterator i = sdks.begin(); + i != sdks.end(); ++i) { - // Use the latest Windows 10 SDK since no build version was given. - return sdks.at(0); - } - else - { - // Find the SDK less or equal to our specified version - for (std::vector::iterator i = sdks.begin(); - i != sdks.end(); ++i) + if (cmSystemTools::VersionCompareEqual(*i, this->SystemVersion)) { - if (!cmSystemTools::VersionCompareGreater(*i, this->SystemVersion)) - { - // This is the most recent SDK that we can run safely - return *i; - } + return *i; } } + + // Use the latest Windows 10 SDK since the exact version is not available. + return sdks.at(0); } #endif // Return an empty string From 4d05f195d9518eb5075f5b2a024f6c5874aab042 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 11 Jan 2016 16:21:13 -0500 Subject: [PATCH 139/255] FindwxWidgets: Drop suppression of -isystem This was added by commit v2.8.0~2292 (... Set variable wxWidgets_INCLUDE_DIRS_NO_SYSTEM on the Mac ..., 2008-04-16) and updated by commit v2.8.9~183^2 (FindwxWidgets: Do not use -isystem on OpenBSD, 2012-05-14). Since the underlying cause was never investigated fully we do not know the conditions under which -isystem breaks wxWidgets, but suppressing -isystem is problematic for users that do not want to see warnings in wxWidgets headers. Simply drop the special case for now so we can see whether anyone hits the problem again, at which point it can be investigated in more detail. Reported-by: Simon Wells --- Modules/FindwxWidgets.cmake | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake index 903759404..49ce57e49 100644 --- a/Modules/FindwxWidgets.cmake +++ b/Modules/FindwxWidgets.cmake @@ -188,18 +188,6 @@ set(wxWidgets_LIBRARIES "") set(wxWidgets_LIBRARY_DIRS "") set(wxWidgets_CXX_FLAGS "") -# Using SYSTEM with INCLUDE_DIRECTORIES in conjunction with wxWidgets on -# the Mac produces compiler errors. Set wxWidgets_INCLUDE_DIRS_NO_SYSTEM -# to prevent UsewxWidgets.cmake from using SYSTEM. -# -# See cmake mailing list discussions for more info: -# https://cmake.org/pipermail/cmake/2008-April/021115.html -# https://cmake.org/pipermail/cmake/2008-April/021146.html -# -if(APPLE OR CMAKE_CXX_PLATFORM_ID MATCHES "OpenBSD") - set(wxWidgets_INCLUDE_DIRS_NO_SYSTEM 1) -endif() - # DEPRECATED: This is a patch to support the DEPRECATED use of # wxWidgets_USE_LIBS. # From 31b4700ed640bee962f9db9ce25fa84261a944d2 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Mon, 11 Jan 2016 16:08:56 -0500 Subject: [PATCH 140/255] FindDCMTK: Improve compatibility with DCMTKConfig.cmake. This improvement to the FindDCMTK module improves compatibility with recent DCMTK, which provides a DCMTKConfig.cmake file. See the module comments for a compatibility matrix. It also provides DCMTK_INCLUDE_DIRS. Ported from CommonTK (commontk.org). --- Modules/FindDCMTK.cmake | 286 +++++++++++++++++++++++++++++++++------- 1 file changed, 240 insertions(+), 46 deletions(-) diff --git a/Modules/FindDCMTK.cmake b/Modules/FindDCMTK.cmake index 91aafbbd0..56939720a 100644 --- a/Modules/FindDCMTK.cmake +++ b/Modules/FindDCMTK.cmake @@ -2,9 +2,10 @@ # FindDCMTK # --------- # -# find DCMTK libraries and applications - -# DCMTK_INCLUDE_DIRS - Directories to include to use DCMTK +# - find DCMTK libraries and applications +# The module defines the following variables: +# +# DCMTK_INCLUDE_DIRS - Directories to include to use DCMTK # DCMTK_LIBRARIES - Files to link against to use DCMTK # DCMTK_FOUND - If false, don't try to use DCMTK # DCMTK_DIR - (optional) Source directory for DCMTK @@ -12,8 +13,91 @@ # DCMTK_DIR can be used to make it simpler to find the various include # directories and compiled libraries if you've just compiled it in the # source tree. Just set it to the root of the tree where you extracted -# the source (default to /usr/include/dcmtk/) - +# the source (default to /usr) +# +# +# This file is able to find version of DCMTK that do or do not export +# a DCMTKConfig.cmake file. +# +# IMPORTANT: A set of patches has been contributed to DCMTK +# maintainers, as soon as: +# (1) it has been integrated upstream so that it is available in +# an official release (for example X.Y.Z), +# (2) code bases have been updated to build against X.Y.Z +# This file could be removed. +# +# The set of patches is listed here: https://github.com/commontk/DCMTK/compare/79030ba...f461865 +# +# +# Waiting for this to happen, build systems will have to be able +# to support different versions of DCMTK. +# +# On any given system, the following combination of DCMTK version could be +# considered: +# +# | SYSTEM DCMTK + LOCAL DCMTK | Supported ? | +# --------------------------------------------------------------------------- +# Case A | NA + [ ] DCMTKConfig | YES | +# ------------------------------------------------------|-------------------- +# Case B | NA + [X] DCMTKConfig | YES | +# ------------------------------------------------------|-------------------- +# Case C | [ ] DCMTKConfig + NA | YES | +# ------------------------------------------------------|-------------------- +# Case D | [X] DCMTKConfig + NA | YES | +# ------------------------------------------------------|-------------------- +# Case E | [ ] DCMTKConfig + [ ] DCMTKConfig | YES (*) | +# ------------------------------------------------------|-------------------- +# Case F | [X] DCMTKConfig + [ ] DCMTKConfig | NO | +# ------------------------------------------------------|-------------------- +# Case G | [ ] DCMTKConfig + [X] DCMTKConfig | YES | +# ------------------------------------------------------|-------------------- +# Case H | [X] DCMTKConfig + [X] DCMTKConfig | YES | +# --------------------------------------------------------------------------- +# +# (*) See Troubleshooting section. +# +# Legend: +# +# NA ...............: Means that no System or Local DCMTK is available +# +# [ ] DCMTKConfig ..: Means that the version of DCMTK does NOT export a DCMTKConfig.cmake file. +# +# [X] DCMTKConfig ..: Means that the version of DCMTK exports a DCMTKConfig.cmake file. +# +# +# +# In CTK commits 52d953 and 74b4b07, the FindDCMTK.cmake module has been updated to be able +# to find both version of DCMTK ([ ] DCMTKConfig and [X] DCMTKConfig). +# +# It is a two steps process: +# +# * Step 1: Attempt to find DCMTK version providing a DCMTKConfig.cmake file. This is done +# with the help of '' +# +# * Step 2: If step 1 failed, rely on FindDCMTK.cmake to set DCMTK_* variables details below. +# +# +# +# Troubleshooting: +# +# What to do if my project find a different version of DCMTK ? +# +# Remove DCMTK entry from the CMake registry. +# Search for "CMake user package registry" on http://www.cmake.org/cmake/help/v2.8.9/cmake.html#command:find_package +# +# Details: As some point, the DCMTK build tree was exported [1][2][3]. Indeed, before the set of +# patches discussed above has been contributed to upstream DCMTK, an initial implementation of +# a DCMTK build system exporting its build tree has been implemented and has been tested by some +# folks. This had the effect of populating the CMake registry. +# +# Since Step1 does not exclude the CMake registry, when dealing with case E, the incorrect version of +# DCMTK could be found. +# +# [1] http://slicer-devel.65872.n3.nabble.com/Packaging-seems-to-work-again-tp4028121p4028134.html +# [2] https://www.assembla.com/spaces/slicerrt/tickets/244-dcmtk_dir-vs--dcmtkconfig-cmake?comment=267984263#comment:267984263 +# [3] http://www.cmake.org/cmake/help/v2.8.11/cmake.html#command:export +# +# #============================================================================= # Copyright 2004-2009 Kitware, Inc. # Copyright 2009-2010 Mathieu Malaterre @@ -26,7 +110,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distribute this file outside of CMake, substitute the full +# (To distributed this file outside of CMake, substitute the full # License text for the above reference.) # @@ -35,50 +119,133 @@ # Modified for EasyViz by Thomas Sondergaard. # -if(NOT DCMTK_FOUND AND NOT DCMTK_DIR) - set(DCMTK_DIR - "/usr/include/dcmtk/" - CACHE - PATH - "Root of DCMTK source tree (optional).") - mark_as_advanced(DCMTK_DIR) +set(_dcmtk_dir_description "The directory of DCMTK build or install tree.") + +# Ensure that DCMTK_DIR is set to a reasonable default value +# so that DCMTK libraries can be found on a standard Unix distribution. +# It also overwrite the value of DCMTK_DIR after this one has been +# set by a successful discovery of DCMTK by the unpatched FindDCMTK.cmake module +# distributed with CMake (as of 0167cea) +if(NOT DCMTK_DIR OR DCMTK_DIR STREQUAL "/usr/include/dcmtk") + set(DCMTK_DIR "/usr" CACHE PATH ${_dcmtk_dir_description} FORCE) endif() +set(_SAVED_DCMTK_DIR ${DCMTK_DIR}) +# +# Step1: Attempt to find a version of DCMTK providing a DCMTKConfig.cmake file. +# +message(STATUS "Trying to find DCMTK expecting DCMTKConfig.cmake") +find_package(DCMTK QUIET NO_MODULE) +if(DCMTK_FOUND + AND NOT "x" STREQUAL "x${DCMTK_LIBRARIES}" + AND NOT "x" STREQUAL "x${DCMTK_INCLUDE_DIRS}") + message(STATUS "Trying to find DCMTK expecting DCMTKConfig.cmake - ok") + return() +else() + message(STATUS "Trying to find DCMTK expecting DCMTKConfig.cmake - failed") +endif() + +message(STATUS "Trying to find DCMTK relying on FindDCMTK.cmake") + +# Restore the value reset by the previous call to 'find_package(DCMTK QUIET NO_MODULE)' +set(DCMTK_DIR ${_SAVED_DCMTK_DIR} CACHE PATH ${_dcmtk_dir_description} FORCE) + + +# +# Step2: Attempt to find a version of DCMTK that does NOT provide a DCMTKConfig.cmake file. +# + +# prefer DCMTK_DIR over default system paths like /usr/lib +if(DCMTK_DIR) + set(CMAKE_PREFIX_PATH ${DCMTK_DIR}/lib ${CMAKE_PREFIX_PATH}) # this is given to FIND_LIBRARY or FIND_PATH +endif() + +# Find all libraries, store debug and release separately foreach(lib - dcmdata + dcmpstat + dcmsr + dcmsign + dcmtls + dcmqrdb + dcmnet + dcmjpeg dcmimage dcmimgle - dcmjpeg - dcmnet - dcmpstat - dcmqrdb - dcmsign - dcmsr - dcmtls + dcmdata + oflog + ofstd ijg12 ijg16 ijg8 - ofstd) + ) - find_library(DCMTK_${lib}_LIBRARY + # Find Release libraries + find_library(DCMTK_${lib}_LIBRARY_RELEASE ${lib} PATHS ${DCMTK_DIR}/${lib}/libsrc ${DCMTK_DIR}/${lib}/libsrc/Release - ${DCMTK_DIR}/${lib}/libsrc/Debug ${DCMTK_DIR}/${lib}/Release + ${DCMTK_DIR}/lib + ${DCMTK_DIR}/lib/Release + ${DCMTK_DIR}/dcmjpeg/lib${lib}/Release + NO_DEFAULT_PATH + ) + + # Find Debug libraries + find_library(DCMTK_${lib}_LIBRARY_DEBUG + ${lib}${DCMTK_CMAKE_DEBUG_POSTFIX} + PATHS + ${DCMTK_DIR}/${lib}/libsrc + ${DCMTK_DIR}/${lib}/libsrc/Debug ${DCMTK_DIR}/${lib}/Debug - ${DCMTK_DIR}/lib) + ${DCMTK_DIR}/lib + ${DCMTK_DIR}/lib/Debug + ${DCMTK_DIR}/dcmjpeg/lib${lib}/Debug + NO_DEFAULT_PATH + ) - mark_as_advanced(DCMTK_${lib}_LIBRARY) + mark_as_advanced(DCMTK_${lib}_LIBRARY_RELEASE) + mark_as_advanced(DCMTK_${lib}_LIBRARY_DEBUG) - if(DCMTK_${lib}_LIBRARY) - list(APPEND DCMTK_LIBRARIES ${DCMTK_${lib}_LIBRARY}) + # Add libraries to variable according to build type + if(DCMTK_${lib}_LIBRARY_RELEASE) + list(APPEND DCMTK_LIBRARIES optimized ${DCMTK_${lib}_LIBRARY_RELEASE}) + endif() + + if(DCMTK_${lib}_LIBRARY_DEBUG) + list(APPEND DCMTK_LIBRARIES debug ${DCMTK_${lib}_LIBRARY_DEBUG}) endif() endforeach() +set(CMAKE_THREAD_LIBS_INIT) +if(DCMTK_oflog_LIBRARY_RELEASE OR DCMTK_oflog_LIBRARY_DEBUG) + # Hack - Not having a DCMTKConfig.cmake file to read the settings from, we will attempt to + # find the library in all cases. + # Ideally, pthread library should be discovered only if DCMTK_WITH_THREADS is enabled. + set(CMAKE_THREAD_PREFER_PTHREAD TRUE) + find_package(Threads) +endif() + +if(CMAKE_THREAD_LIBS_INIT) + list(APPEND DCMTK_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) +endif() + +# +# SPECIFIC CASE FOR DCMTK BUILD DIR as DCMTK_DIR +# (as opposed to a DCMTK install dir) +# Have to find the source directory. +if(EXISTS ${DCMTK_DIR}/CMakeCache.txt) + load_cache(${DCMTK_DIR} READ_WITH_PREFIX "EXT" + DCMTK_SOURCE_DIR) + if(NOT EXISTS ${EXTDCMTK_SOURCE_DIR}) + message(FATAL_ERROR + "DCMTK build directory references +nonexistant DCMTK source directory ${EXTDCMTK_SOURCE_DIR}") + endif() +endif() set(DCMTK_config_TEST_HEADER osconfig.h) set(DCMTK_dcmdata_TEST_HEADER dctypes.h) @@ -92,6 +259,10 @@ set(DCMTK_dcmsign_TEST_HEADER sicert.h) set(DCMTK_dcmsr_TEST_HEADER dsrtree.h) set(DCMTK_dcmtls_TEST_HEADER tlslayer.h) set(DCMTK_ofstd_TEST_HEADER ofstdinc.h) +set(DCMTK_oflog_TEST_HEADER oflog.h) +set(DCMTK_dcmjpls_TEST_HEADER djlsutil.h) + +set(DCMTK_INCLUDE_DIR_NAMES) foreach(dir config @@ -99,31 +270,47 @@ foreach(dir dcmimage dcmimgle dcmjpeg + dcmjpls dcmnet dcmpstat dcmqrdb dcmsign dcmsr dcmtls - ofstd) + ofstd + oflog) + if(EXTDCMTK_SOURCE_DIR) + set(SOURCE_DIR_PATH + ${EXTDCMTK_SOURCE_DIR}/${dir}/include/dcmtk/${dir}) + endif() find_path(DCMTK_${dir}_INCLUDE_DIR ${DCMTK_${dir}_TEST_HEADER} PATHS ${DCMTK_DIR}/${dir}/include ${DCMTK_DIR}/${dir} - ${DCMTK_DIR}/include/${dir} ${DCMTK_DIR}/include/dcmtk/${dir} ${DCMTK_DIR}/${dir}/include/dcmtk/${dir} + ${DCMTK_DIR}/include/${dir} + ${SOURCE_DIR_PATH} ) mark_as_advanced(DCMTK_${dir}_INCLUDE_DIR) + list(APPEND DCMTK_INCLUDE_DIR_NAMES DCMTK_${dir}_INCLUDE_DIR) if(DCMTK_${dir}_INCLUDE_DIR) + # add the 'include' path so eg + #include "dcmtk/dcmimgle/dcmimage.h" + # works + get_filename_component(_include ${DCMTK_${dir}_INCLUDE_DIR} PATH) + get_filename_component(_include ${_include} PATH) list(APPEND DCMTK_INCLUDE_DIRS - ${DCMTK_${dir}_INCLUDE_DIR}) + ${DCMTK_${dir}_INCLUDE_DIR} + ${_include}) endif() endforeach() +list(APPEND DCMTK_INCLUDE_DIRS ${DCMTK_DIR}/include) + if(WIN32) list(APPEND DCMTK_LIBRARIES netapi32 wsock32) endif() @@ -137,21 +324,28 @@ if(DCMTK_ofstd_INCLUDE_DIR) mark_as_advanced(DCMTK_dcmtk_INCLUDE_DIR) endif() -include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -find_package_handle_standard_args(DCMTK DEFAULT_MSG - DCMTK_config_INCLUDE_DIR - DCMTK_ofstd_INCLUDE_DIR - DCMTK_ofstd_LIBRARY - DCMTK_dcmdata_INCLUDE_DIR - DCMTK_dcmdata_LIBRARY - DCMTK_dcmimgle_INCLUDE_DIR - DCMTK_dcmimgle_LIBRARY) - # Compatibility: This variable is deprecated set(DCMTK_INCLUDE_DIR ${DCMTK_INCLUDE_DIRS}) -foreach(executable dcmdump dcmdjpeg dcmdrle) - string(TOUPPER ${executable} EXECUTABLE) - find_program(DCMTK_${EXECUTABLE}_EXECUTABLE ${executable} ${DCMTK_DIR}/bin) - mark_as_advanced(DCMTK_${EXECUTABLE}_EXECUTABLE) -endforeach() +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(DCMTK + REQUIRED_VARS ${DCMTK_INCLUDE_DIR_NAMES} DCMTK_LIBRARIES + FAIL_MESSAGE "Please set DCMTK_DIR and re-run configure") + +# Workaround bug in packaging of DCMTK 3.6.0 on Debian. +# See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=637687 +if(DCMTK_FOUND AND UNIX AND NOT APPLE) + include(CheckCXXSourceCompiles) + set(CMAKE_REQUIRED_FLAGS ) + set(CMAKE_REQUIRED_DEFINITIONS ) + set(CMAKE_REQUIRED_INCLUDES ${DCMTK_INCLUDE_DIRS}) + set(CMAKE_REQUIRED_LIBRARIES ${DCMTK_LIBRARIES}) + check_cxx_source_compiles("#include \n#include \nint main(int,char*[]){return 0;}" + DCMTK_HAVE_CONFIG_H_OPTIONAL + ) + if(NOT DCMTK_HAVE_CONFIG_H_OPTIONAL) + set(DCMTK_DEFINITIONS "HAVE_CONFIG_H") + endif() +endif() + +message(STATUS "Trying to find DCMTK relying on FindDCMTK.cmake - ok") From d50cbbb03d53da6b990402a482a56b3163807dcb Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Mon, 11 Jan 2016 16:46:12 -0500 Subject: [PATCH 141/255] FindDCMTK: Obey QUIET option for find_package. --- Modules/FindDCMTK.cmake | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/Modules/FindDCMTK.cmake b/Modules/FindDCMTK.cmake index 56939720a..89e9c4fb3 100644 --- a/Modules/FindDCMTK.cmake +++ b/Modules/FindDCMTK.cmake @@ -135,18 +135,27 @@ set(_SAVED_DCMTK_DIR ${DCMTK_DIR}) # # Step1: Attempt to find a version of DCMTK providing a DCMTKConfig.cmake file. # -message(STATUS "Trying to find DCMTK expecting DCMTKConfig.cmake") +if(NOT DCMTK_FIND_QUIETLY) + message(STATUS "Trying to find DCMTK expecting DCMTKConfig.cmake") +endif() find_package(DCMTK QUIET NO_MODULE) if(DCMTK_FOUND AND NOT "x" STREQUAL "x${DCMTK_LIBRARIES}" AND NOT "x" STREQUAL "x${DCMTK_INCLUDE_DIRS}") - message(STATUS "Trying to find DCMTK expecting DCMTKConfig.cmake - ok") + + if(NOT DCMTK_FIND_QUIETLY) + message(STATUS "Trying to find DCMTK expecting DCMTKConfig.cmake - ok") + endif() return() else() - message(STATUS "Trying to find DCMTK expecting DCMTKConfig.cmake - failed") + if(NOT DCMTK_FIND_QUIETLY) + message(STATUS "Trying to find DCMTK expecting DCMTKConfig.cmake - failed") + endif() endif() -message(STATUS "Trying to find DCMTK relying on FindDCMTK.cmake") +if(NOT DCMTK_FIND_QUIETLY) + message(STATUS "Trying to find DCMTK relying on FindDCMTK.cmake") +endif() # Restore the value reset by the previous call to 'find_package(DCMTK QUIET NO_MODULE)' set(DCMTK_DIR ${_SAVED_DCMTK_DIR} CACHE PATH ${_dcmtk_dir_description} FORCE) @@ -340,6 +349,7 @@ if(DCMTK_FOUND AND UNIX AND NOT APPLE) set(CMAKE_REQUIRED_DEFINITIONS ) set(CMAKE_REQUIRED_INCLUDES ${DCMTK_INCLUDE_DIRS}) set(CMAKE_REQUIRED_LIBRARIES ${DCMTK_LIBRARIES}) + set(CMAKE_REQUIRED_QUIET ${DCMTK_FIND_QUIETLY}) check_cxx_source_compiles("#include \n#include \nint main(int,char*[]){return 0;}" DCMTK_HAVE_CONFIG_H_OPTIONAL ) @@ -348,4 +358,6 @@ if(DCMTK_FOUND AND UNIX AND NOT APPLE) endif() endif() -message(STATUS "Trying to find DCMTK relying on FindDCMTK.cmake - ok") +if(NOT DCMTK_FIND_QUIETLY) + message(STATUS "Trying to find DCMTK relying on FindDCMTK.cmake - ok") +endif() From cd9a59b1993bc7732dae4d683c5864847f36a046 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 12 Jan 2016 00:01:09 -0500 Subject: [PATCH 142/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index d44f58eb3..585f6e070 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20160111) +set(CMake_VERSION_PATCH 20160112) #set(CMake_VERSION_RC 1) From ffcc235c7ee2528638fd2ae4029eabcd5b0f1042 Mon Sep 17 00:00:00 2001 From: KWSys Upstream Date: Mon, 11 Jan 2016 16:30:05 +0000 Subject: [PATCH 143/255] KWSys 2016-01-11 (bc07fbf7) Code extracted from: http://public.kitware.com/KWSys.git at commit bc07fbf7a884713815b3ac72d85487bf6aa338f5 (master). Upstream Shortlog ----------------- James Johnston (1): bc07fbf7 Configure: Silence spurious warnings from Embarcadero compiler. --- Configure.h.in | 5 +++++ SharedForward.h.in | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/Configure.h.in b/Configure.h.in index 70cf8442b..cd2d96519 100644 --- a/Configure.h.in +++ b/Configure.h.in @@ -115,6 +115,11 @@ # pragma warning (disable: 4710) /* function not inlined */ # pragma warning (disable: 4786) /* identifier truncated in debug info */ # endif +# if defined(__BORLANDC__) && !defined(__cplusplus) + /* Code has no effect; raised by winnt.h in C (not C++) when ignoring an + unused parameter using "(param)" syntax (i.e. no cast to void). */ +# pragma warn -8019 +# endif #endif /* MSVC 6.0 in release mode will warn about code it produces with its diff --git a/SharedForward.h.in b/SharedForward.h.in index f22fa580a..f80ef8470 100644 --- a/SharedForward.h.in +++ b/SharedForward.h.in @@ -74,6 +74,12 @@ # endif #endif +#if defined(__BORLANDC__) && !defined(__cplusplus) + /* Code has no effect; raised by winnt.h in C (not C++) when ignoring an + unused parameter using "(param)" syntax (i.e. no cast to void). */ +# pragma warn -8019 +#endif + /*--------------------------------------------------------------------------*/ /* Full path to the directory in which this executable is built. Do From 8c8e53d06011ef476780d10601adac78baf8aead Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Tue, 12 Jan 2016 12:25:15 -0500 Subject: [PATCH 144/255] FindDCMTK: Minor documentation grammatical issues. Also remove CTK integration reference to avoid confusion. --- Modules/FindDCMTK.cmake | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Modules/FindDCMTK.cmake b/Modules/FindDCMTK.cmake index 89e9c4fb3..115c26bb5 100644 --- a/Modules/FindDCMTK.cmake +++ b/Modules/FindDCMTK.cmake @@ -16,11 +16,11 @@ # the source (default to /usr) # # -# This file is able to find version of DCMTK that do or do not export +# This file is able to find version of DCMTK that does or does not export # a DCMTKConfig.cmake file. # # IMPORTANT: A set of patches has been contributed to DCMTK -# maintainers, as soon as: +# maintainers and merged upstream. As soon as: # (1) it has been integrated upstream so that it is available in # an official release (for example X.Y.Z), # (2) code bases have been updated to build against X.Y.Z @@ -65,22 +65,17 @@ # [X] DCMTKConfig ..: Means that the version of DCMTK exports a DCMTKConfig.cmake file. # # -# -# In CTK commits 52d953 and 74b4b07, the FindDCMTK.cmake module has been updated to be able -# to find both version of DCMTK ([ ] DCMTKConfig and [X] DCMTKConfig). -# -# It is a two steps process: +# It is a two step process: # # * Step 1: Attempt to find DCMTK version providing a DCMTKConfig.cmake file. This is done # with the help of '' -# # * Step 2: If step 1 failed, rely on FindDCMTK.cmake to set DCMTK_* variables details below. # # # # Troubleshooting: # -# What to do if my project find a different version of DCMTK ? +# What to do if my project finds a different version of DCMTK? # # Remove DCMTK entry from the CMake registry. # Search for "CMake user package registry" on http://www.cmake.org/cmake/help/v2.8.9/cmake.html#command:find_package From 36d87e18a1ffe4d4f23fbd1bb4ba77c9bc10c099 Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Tue, 12 Jan 2016 15:48:55 +0100 Subject: [PATCH 145/255] FindPkgConfig: add PREFIX/share/pkgconfig to PKG_CONFIG_PATH (#15910) Most packages install their .pc files into PREFIX/lib/pkgconfig, but some put them into PREFIX/share/pkgconfig. Either is valid, and pkg-config itself looks in both for the /usr and /usr/local prefixes. This fixes an issue where some packages (yajl, for example) are not found if they are installed into a non-standard prefix and CMAKE_PREFIX_PATH is used to locate them. --- Modules/FindPkgConfig.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index d519c1df3..eba69532a 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -263,6 +263,7 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma endif() endif() list(APPEND _lib_dirs "lib/pkgconfig") + list(APPEND _lib_dirs "share/pkgconfig") # Check if directories exist and eventually append them to the # pkgconfig path list From fc5d6592291aaff7238b7625468f9820a596d758 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 12 Jan 2016 13:56:17 -0500 Subject: [PATCH 146/255] VS: Map link `/debug:fastlink` flag to VS 2015 IDE property (#15894) Suggested-by: Thomas Laguzzi --- Help/release/dev/vs-debug-fastlink.rst | 5 +++++ Source/cmVS14LinkFlagTable.h | 2 ++ 2 files changed, 7 insertions(+) create mode 100644 Help/release/dev/vs-debug-fastlink.rst diff --git a/Help/release/dev/vs-debug-fastlink.rst b/Help/release/dev/vs-debug-fastlink.rst new file mode 100644 index 000000000..c2e0599df --- /dev/null +++ b/Help/release/dev/vs-debug-fastlink.rst @@ -0,0 +1,5 @@ +vs-debug-fastlink +----------------- + +* The :generator:`Visual Studio 14 2015` generator learned to map the + ``/debug:fastlink`` linker flag to the ``.vcxproj`` file property. diff --git a/Source/cmVS14LinkFlagTable.h b/Source/cmVS14LinkFlagTable.h index 1e781e888..29e3d8606 100644 --- a/Source/cmVS14LinkFlagTable.h +++ b/Source/cmVS14LinkFlagTable.h @@ -177,6 +177,8 @@ static cmVS7FlagTable cmVS14LinkFlagTable[] = {"UACUIAccess", "uiAccess='false'", "", "false", 0}, {"UACUIAccess", "uiAccess='true'", "", "true", 0}, {"ManifestEmbed", "manifest:embed", "", "true", 0}, + {"GenerateDebugInformation", "DEBUG:FASTLINK", "", "DebugFastLink", + cmVS7FlagTable::CaseInsensitive}, {"GenerateDebugInformation", "DEBUG", "", "Debug", cmVS7FlagTable::CaseInsensitive}, {"MapExports", "MAPINFO:EXPORTS", "", "true", 0}, From 28f2d750edaf6ee1af660d3a0ae6792c65c47997 Mon Sep 17 00:00:00 2001 From: Michael Scott Date: Mon, 21 Dec 2015 21:39:27 +0000 Subject: [PATCH 147/255] Add -Werror and -Wno-error command-line options Expand the -W set of cmake options to include support for the -Werror and -Wno-error format, which is used to control upgrading and downgrading warning and error messages. Implement support for these new formats for the dev and deprecated message types. Add tests and updated documentation for new options. --- Help/manual/OPTIONS_BUILD.txt | 24 +++ Help/release/dev/cmake-W-options.rst | 7 + Source/cmMessageCommand.cxx | 29 +-- Source/cmake.cxx | 200 +++++++++++++++++- Source/cmake.h | 42 +++- Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 22 ++ .../W_bad-arg3-result.txt} | 0 .../CommandLine/W_bad-arg3-stderr.txt | 2 + .../CommandLine/Werror_deprecated-result.txt | 1 + .../CommandLine/Werror_deprecated-stderr.txt | 4 + .../CommandLine/Werror_deprecated.cmake | 1 + .../CommandLine/Werror_dev-result.txt | 1 + .../CommandLine/Werror_dev-stderr.txt | 11 + Tests/RunCMake/CommandLine/Werror_dev.cmake | 7 + .../Wno-error_deprecated-stderr.txt | 4 + .../CommandLine/Wno-error_deprecated.cmake | 2 + .../CommandLine/Wno-error_dev-stderr.txt | 11 + .../RunCMake/CommandLine/Wno-error_dev.cmake | 7 + Tests/RunCMake/message/RunCMakeTest.cmake | 6 +- .../RunCMake/message/errormessage-stderr.txt | 4 - Tests/RunCMake/message/errormessage.cmake | 4 - .../errormessage_deprecated-result.txt | 1 + .../errormessage_deprecated-stderr.txt | 4 + .../message/errormessage_deprecated.cmake | 3 + .../message/errormessage_dev-result.txt | 1 + .../message/errormessage_dev-stderr.txt | 5 + Tests/RunCMake/message/errormessage_dev.cmake | 3 + 27 files changed, 371 insertions(+), 35 deletions(-) rename Tests/RunCMake/{message/errormessage-result.txt => CommandLine/W_bad-arg3-result.txt} (100%) create mode 100644 Tests/RunCMake/CommandLine/W_bad-arg3-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/Werror_deprecated-result.txt create mode 100644 Tests/RunCMake/CommandLine/Werror_deprecated-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/Werror_deprecated.cmake create mode 100644 Tests/RunCMake/CommandLine/Werror_dev-result.txt create mode 100644 Tests/RunCMake/CommandLine/Werror_dev-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/Werror_dev.cmake create mode 100644 Tests/RunCMake/CommandLine/Wno-error_deprecated-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/Wno-error_deprecated.cmake create mode 100644 Tests/RunCMake/CommandLine/Wno-error_dev-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/Wno-error_dev.cmake delete mode 100644 Tests/RunCMake/message/errormessage-stderr.txt delete mode 100644 Tests/RunCMake/message/errormessage.cmake create mode 100644 Tests/RunCMake/message/errormessage_deprecated-result.txt create mode 100644 Tests/RunCMake/message/errormessage_deprecated-stderr.txt create mode 100644 Tests/RunCMake/message/errormessage_deprecated.cmake create mode 100644 Tests/RunCMake/message/errormessage_dev-result.txt create mode 100644 Tests/RunCMake/message/errormessage_dev-stderr.txt create mode 100644 Tests/RunCMake/message/errormessage_dev.cmake diff --git a/Help/manual/OPTIONS_BUILD.txt b/Help/manual/OPTIONS_BUILD.txt index 977264c7d..b428a74d7 100644 --- a/Help/manual/OPTIONS_BUILD.txt +++ b/Help/manual/OPTIONS_BUILD.txt @@ -86,6 +86,18 @@ Enable warnings that are meant for the author of the CMakeLists.txt files. By default this will also turn on deprecation warnings. +``-Werror=dev`` + Make developer warnings errors. + + Make warnings that are meant for the author of the CMakeLists.txt files + errors. By default this will also turn on deprecated warnings as errors. + +``-Wno-error=dev`` + Make developer warnings not errors. + + Make warnings that are meant for the author of the CMakeLists.txt files not + errors. By default this will also turn off deprecated warnings as errors. + ``-Wdeprecated`` Enable deprecated functionality warnings. @@ -97,3 +109,15 @@ Suppress warnings for usage of deprecated functionality, that are meant for the author of the CMakeLists.txt files. + +``-Werror=deprecated`` + Make deprecated macro and function warnings errors. + + Make warnings for usage of deprecated macros and functions, that are meant + for the author of the CMakeLists.txt files, errors. + +``-Wno-error=deprecated`` + Make deprecated macro and function warnings not errors. + + Make warnings for usage of deprecated macros and functions, that are meant + for the author of the CMakeLists.txt files, not errors. diff --git a/Help/release/dev/cmake-W-options.rst b/Help/release/dev/cmake-W-options.rst index 38e71f99a..c055f9602 100644 --- a/Help/release/dev/cmake-W-options.rst +++ b/Help/release/dev/cmake-W-options.rst @@ -13,3 +13,10 @@ cmake-W-options * Warnings about deprecated functionality can now be controlled in the :manual:`cmake-gui(1)` application. + +* The suppression of developer warnings as errors can now be controlled with + the new ``-Werror=dev`` and ``-Wno-error=dev`` :manual:`cmake(1)` options. + +* The :variable:`CMAKE_ERROR_DEPRECATED` variable can now be set using the + ``-Werror=deprecated`` and ``-Wno-error=deprecated`` :manual:`cmake(1)` + options. diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx index 8272eb09f..1c67ceace 100644 --- a/Source/cmMessageCommand.cxx +++ b/Source/cmMessageCommand.cxx @@ -25,6 +25,7 @@ bool cmMessageCommand cmake::MessageType type = cmake::MESSAGE; bool status = false; bool fatal = false; + cmake* cm = this->Makefile->GetCMakeInstance(); if (*i == "SEND_ERROR") { type = cmake::FATAL_ERROR; @@ -43,14 +44,18 @@ bool cmMessageCommand } else if (*i == "AUTHOR_WARNING") { - if (this->Makefile->GetCMakeInstance()->GetSuppressDevWarnings( - this->Makefile)) + if (cm->GetDevWarningsAsErrors(this->Makefile)) { - return true; + fatal = true; + type = cmake::AUTHOR_ERROR; + } + else if (!cm->GetSuppressDevWarnings(this->Makefile)) + { + type = cmake::AUTHOR_WARNING; } else { - type = cmake::AUTHOR_WARNING; + return true; } ++i; } @@ -61,22 +66,18 @@ bool cmMessageCommand } else if (*i == "DEPRECATION") { - if (this->Makefile->IsOn("CMAKE_ERROR_DEPRECATED")) + if (cm->GetDeprecatedWarningsAsErrors(this->Makefile)) { fatal = true; type = cmake::DEPRECATION_ERROR; } + else if (!cm->GetSuppressDeprecatedWarnings(this->Makefile)) + { + type = cmake::DEPRECATION_WARNING; + } else { - if (this->Makefile->GetCMakeInstance()->GetSuppressDeprecatedWarnings( - this->Makefile)) - { - return true; - } - else - { - type = cmake::DEPRECATION_WARNING; - } + return true; } ++i; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 79924953e..8f6b9524a 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -291,6 +291,7 @@ bool cmake::SetCacheArgs(const std::vector& args) std::string name; bool foundNo = false; + bool foundError = false; unsigned int nameStartPosition = 0; if (entry.find("no-", nameStartPosition) == 0) @@ -299,6 +300,12 @@ bool cmake::SetCacheArgs(const std::vector& args) nameStartPosition += 3; } + if (entry.find("error=", nameStartPosition) == 0) + { + foundError = true; + nameStartPosition += 6; + } + name = entry.substr(nameStartPosition); if (name.empty()) { @@ -306,16 +313,27 @@ bool cmake::SetCacheArgs(const std::vector& args) return false; } - if (!foundNo) + if (!foundNo && !foundError) { // -W this->DiagLevels[name] = std::max(this->DiagLevels[name], DIAG_WARN); } + else if (foundNo && !foundError) + { + // -Wno + this->DiagLevels[name] = DIAG_IGNORE; + } + else if (!foundNo && foundError) + { + // -Werror= + this->DiagLevels[name] = DIAG_ERROR; + } else { - // -Wno - this->DiagLevels[name] = DIAG_IGNORE; + // -Wno-error= + this->DiagLevels[name] = std::min(this->DiagLevels[name], + DIAG_WARN); } } else if(arg.find("-U",0) == 0) @@ -1270,10 +1288,17 @@ int cmake::Configure() if (diagLevel == DIAG_IGNORE) { this->SetSuppressDeprecatedWarnings(true); + this->SetDeprecatedWarningsAsErrors(false); } else if (diagLevel == DIAG_WARN) { this->SetSuppressDeprecatedWarnings(false); + this->SetDeprecatedWarningsAsErrors(false); + } + else if (diagLevel == DIAG_ERROR) + { + this->SetSuppressDeprecatedWarnings(false); + this->SetDeprecatedWarningsAsErrors(true); } } @@ -1283,9 +1308,11 @@ int cmake::Configure() const char* cachedWarnDeprecated = this->State->GetCacheEntryValue("CMAKE_WARN_DEPRECATED"); + const char* cachedErrorDeprecated = + this->State->GetCacheEntryValue("CMAKE_ERROR_DEPRECATED"); // don't overwrite deprecated warning setting from a previous invocation - if (!cachedWarnDeprecated) + if (!cachedWarnDeprecated && !cachedErrorDeprecated) { setDeprecatedVariables = true; } @@ -1294,19 +1321,34 @@ int cmake::Configure() if (diagLevel == DIAG_IGNORE) { this->SetSuppressDevWarnings(true); + this->SetDevWarningsAsErrors(false); if (setDeprecatedVariables) { this->SetSuppressDeprecatedWarnings(true); + this->SetDeprecatedWarningsAsErrors(false); } } else if (diagLevel == DIAG_WARN) { this->SetSuppressDevWarnings(false); + this->SetDevWarningsAsErrors(false); if (setDeprecatedVariables) { this->SetSuppressDeprecatedWarnings(false); + this->SetDeprecatedWarningsAsErrors(false); + } + } + else if (diagLevel == DIAG_ERROR) + { + this->SetSuppressDevWarnings(false); + this->SetDevWarningsAsErrors(true); + + if (setDeprecatedVariables) + { + this->SetSuppressDeprecatedWarnings(false); + this->SetDeprecatedWarningsAsErrors(true); } } } @@ -2547,16 +2589,45 @@ static bool cmakeCheckStampList(const char* stampList) return true; } +cmake::MessageType cmake::ConvertMessageType(cmake::MessageType t) +{ + bool warningsAsErrors; + + if (t == cmake::AUTHOR_WARNING || t == cmake::AUTHOR_ERROR) + { + warningsAsErrors = this->GetDevWarningsAsErrors(); + if (warningsAsErrors && t == cmake::AUTHOR_WARNING) + { + t = cmake::AUTHOR_ERROR; + } + else if (!warningsAsErrors && t == cmake::AUTHOR_ERROR) + { + t = cmake::AUTHOR_WARNING; + } + } + else if (t == cmake::DEPRECATION_WARNING || t == cmake::DEPRECATION_ERROR) + { + warningsAsErrors = this->GetDeprecatedWarningsAsErrors(); + if (warningsAsErrors && t == cmake::DEPRECATION_WARNING) + { + t = cmake::DEPRECATION_ERROR; + } + else if (!warningsAsErrors && t == cmake::DEPRECATION_ERROR) + { + t = cmake::DEPRECATION_WARNING; + } + } + + return t; +} + bool cmake::IsMessageTypeVisible(cmake::MessageType t) { bool isVisible = true; if(t == cmake::DEPRECATION_ERROR) { - // if CMAKE_ERROR_DEPRECATED is on, show the message, otherwise suppress it - const char* errorDeprecated = this->State->GetCacheEntryValue( - "CMAKE_ERROR_DEPRECATED"); - if(cmSystemTools::IsOff(errorDeprecated)) + if(!this->GetDeprecatedWarningsAsErrors()) { isVisible = false; } @@ -2568,6 +2639,13 @@ bool cmake::IsMessageTypeVisible(cmake::MessageType t) isVisible = false; } } + else if (t == cmake::AUTHOR_ERROR) + { + if (!this->GetDevWarningsAsErrors()) + { + isVisible = false; + } + } else if (t == cmake::AUTHOR_WARNING) { if (this->GetSuppressDevWarnings()) @@ -2606,6 +2684,10 @@ bool cmake::PrintMessagePreamble(cmake::MessageType t, std::ostream& msg) { msg << "CMake Warning (dev)"; } + else if (t == cmake::AUTHOR_ERROR) + { + msg << "CMake Error (dev)"; + } else { msg << "CMake Warning"; @@ -2630,6 +2712,12 @@ void displayMessage(cmake::MessageType t, std::ostringstream& msg) msg << "This warning is for project developers. Use -Wno-dev to suppress it."; } + else if (t == cmake::AUTHOR_ERROR) + { + msg << + "This error is for project developers. Use -Wno-error=dev to suppress " + "it."; + } // Add a terminating blank line. msg << "\n"; @@ -2653,7 +2741,8 @@ void displayMessage(cmake::MessageType t, std::ostringstream& msg) // Output the message. if(t == cmake::FATAL_ERROR || t == cmake::INTERNAL_ERROR - || t == cmake::DEPRECATION_ERROR) + || t == cmake::DEPRECATION_ERROR + || t == cmake::AUTHOR_ERROR) { cmSystemTools::SetErrorOccured(); cmSystemTools::Message(msg.str().c_str(), "Error"); @@ -2671,6 +2760,17 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text, { cmListFileBacktrace backtrace = bt; + if (!force) + { + // override the message type, if needed, for warnings and errors + cmake::MessageType override = this->ConvertMessageType(t); + if (override != t) + { + t = override; + force = true; + } + } + if (!force && !this->IsMessageTypeVisible(t)) { return; @@ -2698,6 +2798,17 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text, cmListFileContext const& lfc, bool force) { + if (!force) + { + // override the message type, if needed, for warnings and errors + cmake::MessageType override = this->ConvertMessageType(t); + if (override != t) + { + t = override; + force = true; + } + } + if (!force && !this->IsMessageTypeVisible(t)) { return; @@ -2941,3 +3052,74 @@ void cmake::SetSuppressDeprecatedWarnings(bool b) "functionality.", cmState::INTERNAL); } + +bool cmake::GetDevWarningsAsErrors(cmMakefile const* mf) +{ + if (mf) + { + return (mf->IsSet("CMAKE_SUPPRESS_DEVELOPER_ERRORS") && + !mf->IsOn("CMAKE_SUPPRESS_DEVELOPER_ERRORS")); + } + else + { + const char* cacheEntryValue = this->State->GetCacheEntryValue( + "CMAKE_SUPPRESS_DEVELOPER_ERRORS"); + return cacheEntryValue && cmSystemTools::IsOff(cacheEntryValue); + } +} + +void cmake::SetDevWarningsAsErrors(bool b) +{ + std::string value; + + // equivalent to -Werror=dev + if (b) + { + value = "FALSE"; + } + // equivalent to -Wno-error=dev + else + { + value = "TRUE"; + } + + this->AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_ERRORS", value.c_str(), + "Suppress errors that are meant for" + " the author of the CMakeLists.txt files.", + cmState::INTERNAL); +} + +bool cmake::GetDeprecatedWarningsAsErrors(cmMakefile const* mf) +{ + if (mf) + { + return mf->IsOn("CMAKE_ERROR_DEPRECATED"); + } + else + { + const char* cacheEntryValue = this->State->GetCacheEntryValue( + "CMAKE_ERROR_DEPRECATED"); + return cmSystemTools::IsOn(cacheEntryValue); + } +} + +void cmake::SetDeprecatedWarningsAsErrors(bool b) +{ + std::string value; + + // equivalent to -Werror=deprecated + if (b) + { + value = "TRUE"; + } + // equivalent to -Wno-error=deprecated + else + { + value = "FALSE"; + } + + this->AddCacheEntry("CMAKE_ERROR_DEPRECATED", value.c_str(), + "Whether to issue deprecation errors for macros" + " and functions.", + cmState::INTERNAL); +} diff --git a/Source/cmake.h b/Source/cmake.h index 298d82b6b..84967056a 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -59,6 +59,7 @@ class cmake public: enum MessageType { AUTHOR_WARNING, + AUTHOR_ERROR, FATAL_ERROR, INTERNAL_ERROR, MESSAGE, @@ -71,7 +72,8 @@ class cmake enum DiagLevel { DIAG_IGNORE, - DIAG_WARN + DIAG_WARN, + DIAG_ERROR }; /** \brief Describes the working modes of cmake */ @@ -330,6 +332,28 @@ class cmake */ void SetSuppressDeprecatedWarnings(bool v); + /* + * Get the state of treating developer (author) warnings as errors. + * Returns false, by default, if warnings should not be treated as errors, + * true otherwise. + */ + bool GetDevWarningsAsErrors(cmMakefile const* mf = NULL); + /** + * Set the state of treating developer (author) warnings as errors. + */ + void SetDevWarningsAsErrors(bool v); + + /* + * Get the state of treating deprecated warnings as errors. + * Returns false, by default, if warnings should not be treated as errors, + * true otherwise. + */ + bool GetDeprecatedWarningsAsErrors(cmMakefile const* mf = NULL); + /** + * Set the state of treating developer (author) warnings as errors. + */ + void SetDeprecatedWarningsAsErrors(bool v); + /** Display a message to the user. */ void IssueMessage(cmake::MessageType t, std::string const& text, cmListFileBacktrace const& backtrace = cmListFileBacktrace(), @@ -441,6 +465,12 @@ private: // Print a list of valid generators to stderr. void PrintGeneratorList(); + /** + * Convert a message type between a warning and an error, based on the state + * of the error output CMake variables, in the cache. + */ + cmake::MessageType ConvertMessageType(cmake::MessageType t); + /* * Check if messages of this type should be output, based on the state of the * warning and error output CMake variables, in the cache. @@ -457,10 +487,16 @@ private: {"-G ", "Specify a build system generator."},\ {"-T ", "Specify toolset name if supported by generator."}, \ {"-A ", "Specify platform name if supported by generator."}, \ - {"-Wno-dev", "Suppress developer warnings."},\ {"-Wdev", "Enable developer warnings."},\ + {"-Wno-dev", "Suppress developer warnings."},\ + {"-Werror=dev", "Make developer warnings errors."},\ + {"-Wno-error=dev", "Make developer warnings not errors."},\ {"-Wdeprecated", "Enable deprecation warnings."},\ - {"-Wno-deprecated", "Suppress deprecation warnings."} + {"-Wno-deprecated", "Suppress deprecation warnings."},\ + {"-Werror=deprecated", "Make deprecated macro and function warnings " \ + "errors."},\ + {"-Wno-error=deprecated", "Make deprecated macro and function warnings " \ + "not errors."} #define FOR_EACH_C_FEATURE(F) \ F(c_function_prototypes) \ diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 5e2200f56..e77ba1f91 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -187,6 +187,14 @@ set(RunCMake_TEST_OPTIONS -Wdev) run_cmake(Wdev) unset(RunCMake_TEST_OPTIONS) +set(RunCMake_TEST_OPTIONS -Werror=dev) +run_cmake(Werror_dev) +unset(RunCMake_TEST_OPTIONS) + +set(RunCMake_TEST_OPTIONS -Wno-error=dev) +run_cmake(Wno-error_deprecated) +unset(RunCMake_TEST_OPTIONS) + # -Wdev should not override deprecated options if specified set(RunCMake_TEST_OPTIONS -Wdev -Wno-deprecated) run_cmake(Wno-deprecated) @@ -200,6 +208,11 @@ set(RunCMake_TEST_OPTIONS -Wdev) run_cmake(Wdeprecated) unset(RunCMake_TEST_OPTIONS) +# -Werror=dev should enable deprecated errors as well +set(RunCMake_TEST_OPTIONS -Werror=dev) +run_cmake(Werror_deprecated) +unset(RunCMake_TEST_OPTIONS) + set(RunCMake_TEST_OPTIONS -Wdeprecated) run_cmake(Wdeprecated) unset(RunCMake_TEST_OPTIONS) @@ -208,6 +221,14 @@ set(RunCMake_TEST_OPTIONS -Wno-deprecated) run_cmake(Wno-deprecated) unset(RunCMake_TEST_OPTIONS) +set(RunCMake_TEST_OPTIONS -Werror=deprecated) +run_cmake(Werror_deprecated) +unset(RunCMake_TEST_OPTIONS) + +set(RunCMake_TEST_OPTIONS -Wno-error=deprecated) +run_cmake(Wno-error_deprecated) +unset(RunCMake_TEST_OPTIONS) + # Dev warnings should be on by default run_cmake(Wdev) @@ -224,6 +245,7 @@ unset(RunCMake_TEST_OPTIONS) run_cmake_command(W_bad-arg1 ${CMAKE_COMMAND} -W) run_cmake_command(W_bad-arg2 ${CMAKE_COMMAND} -Wno-) +run_cmake_command(W_bad-arg3 ${CMAKE_COMMAND} -Werror=) set(RunCMake_TEST_OPTIONS --debug-output) run_cmake(debug-output) diff --git a/Tests/RunCMake/message/errormessage-result.txt b/Tests/RunCMake/CommandLine/W_bad-arg3-result.txt similarity index 100% rename from Tests/RunCMake/message/errormessage-result.txt rename to Tests/RunCMake/CommandLine/W_bad-arg3-result.txt diff --git a/Tests/RunCMake/CommandLine/W_bad-arg3-stderr.txt b/Tests/RunCMake/CommandLine/W_bad-arg3-stderr.txt new file mode 100644 index 000000000..cc643df95 --- /dev/null +++ b/Tests/RunCMake/CommandLine/W_bad-arg3-stderr.txt @@ -0,0 +1,2 @@ +CMake Error: No warning name provided. +CMake Error: Problem processing arguments. Aborting. diff --git a/Tests/RunCMake/CommandLine/Werror_deprecated-result.txt b/Tests/RunCMake/CommandLine/Werror_deprecated-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/Werror_deprecated-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/Werror_deprecated-stderr.txt b/Tests/RunCMake/CommandLine/Werror_deprecated-stderr.txt new file mode 100644 index 000000000..6acdc7362 --- /dev/null +++ b/Tests/RunCMake/CommandLine/Werror_deprecated-stderr.txt @@ -0,0 +1,4 @@ +^CMake Deprecation Error at Werror_deprecated.cmake:1 \(message\): + Some deprecated warning +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CommandLine/Werror_deprecated.cmake b/Tests/RunCMake/CommandLine/Werror_deprecated.cmake new file mode 100644 index 000000000..3142b42dc --- /dev/null +++ b/Tests/RunCMake/CommandLine/Werror_deprecated.cmake @@ -0,0 +1 @@ +message(DEPRECATION "Some deprecated warning") diff --git a/Tests/RunCMake/CommandLine/Werror_dev-result.txt b/Tests/RunCMake/CommandLine/Werror_dev-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/Werror_dev-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/Werror_dev-stderr.txt b/Tests/RunCMake/CommandLine/Werror_dev-stderr.txt new file mode 100644 index 000000000..590ec96d3 --- /dev/null +++ b/Tests/RunCMake/CommandLine/Werror_dev-stderr.txt @@ -0,0 +1,11 @@ +^CMake Error \(dev\) at Werror_dev.cmake:4 \(include\): + include\(\) given empty file name \(ignored\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This error is for project developers. Use -Wno-error=dev to suppress it. + +CMake Error \(dev\) at Werror_dev.cmake:7 \(message\): + Some author warning +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This error is for project developers. Use -Wno-error=dev to suppress it.$ diff --git a/Tests/RunCMake/CommandLine/Werror_dev.cmake b/Tests/RunCMake/CommandLine/Werror_dev.cmake new file mode 100644 index 000000000..05f333a57 --- /dev/null +++ b/Tests/RunCMake/CommandLine/Werror_dev.cmake @@ -0,0 +1,7 @@ +# with -Werror=dev this will also cause an (upgraded) AUTHOR_ERROR message, +# checks that messages issued outside of the message command, by other CMake +# commands, also are affected by -Werror=dev +include("") + +# message command sets fatal occurred flag, so run it last +message(AUTHOR_WARNING "Some author warning") diff --git a/Tests/RunCMake/CommandLine/Wno-error_deprecated-stderr.txt b/Tests/RunCMake/CommandLine/Wno-error_deprecated-stderr.txt new file mode 100644 index 000000000..0ed169861 --- /dev/null +++ b/Tests/RunCMake/CommandLine/Wno-error_deprecated-stderr.txt @@ -0,0 +1,4 @@ +^CMake Deprecation Warning at Wno-error_deprecated.cmake:2 \(message\): + Some deprecated warning +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CommandLine/Wno-error_deprecated.cmake b/Tests/RunCMake/CommandLine/Wno-error_deprecated.cmake new file mode 100644 index 000000000..676792a8d --- /dev/null +++ b/Tests/RunCMake/CommandLine/Wno-error_deprecated.cmake @@ -0,0 +1,2 @@ +# This should still produce a warning when -Wno-error=deprecated is specified +message(DEPRECATION "Some deprecated warning") diff --git a/Tests/RunCMake/CommandLine/Wno-error_dev-stderr.txt b/Tests/RunCMake/CommandLine/Wno-error_dev-stderr.txt new file mode 100644 index 000000000..dd22d5568 --- /dev/null +++ b/Tests/RunCMake/CommandLine/Wno-error_dev-stderr.txt @@ -0,0 +1,11 @@ +^CMake Warning \(dev\) at Wno-error_dev.cmake:2 \(message\): + Some author warning +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\) at Wno-error_dev.cmake:6 \(include\): + include\(\) given empty file name \(ignored\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/CommandLine/Wno-error_dev.cmake b/Tests/RunCMake/CommandLine/Wno-error_dev.cmake new file mode 100644 index 000000000..b700c1975 --- /dev/null +++ b/Tests/RunCMake/CommandLine/Wno-error_dev.cmake @@ -0,0 +1,7 @@ +# This should still produce a warning when -Wno-error=dev is specified +message(AUTHOR_WARNING "Some author warning") + +# with -Wno-error=dev this will also cause an AUTHOR_WARNING message, checks +# that messages issued outside of the message command, by other CMake commands, +# also are affected by -Wno-error=dev +include("") diff --git a/Tests/RunCMake/message/RunCMakeTest.cmake b/Tests/RunCMake/message/RunCMakeTest.cmake index 294dfbbdc..94896930a 100644 --- a/Tests/RunCMake/message/RunCMakeTest.cmake +++ b/Tests/RunCMake/message/RunCMakeTest.cmake @@ -3,4 +3,8 @@ include(RunCMake) run_cmake(defaultmessage) run_cmake(nomessage) run_cmake(warnmessage) -run_cmake(errormessage) +# message command sets fatal occurred flag, so check each type of error + +# seperately +run_cmake(errormessage_deprecated) +run_cmake(errormessage_dev) diff --git a/Tests/RunCMake/message/errormessage-stderr.txt b/Tests/RunCMake/message/errormessage-stderr.txt deleted file mode 100644 index 49e7ca913..000000000 --- a/Tests/RunCMake/message/errormessage-stderr.txt +++ /dev/null @@ -1,4 +0,0 @@ -CMake Deprecation Error at errormessage.cmake:4 \(message\): - This is an error -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/message/errormessage.cmake b/Tests/RunCMake/message/errormessage.cmake deleted file mode 100644 index 7d3b7792b..000000000 --- a/Tests/RunCMake/message/errormessage.cmake +++ /dev/null @@ -1,4 +0,0 @@ - -set(CMAKE_ERROR_DEPRECATED ON) - -message(DEPRECATION "This is an error") diff --git a/Tests/RunCMake/message/errormessage_deprecated-result.txt b/Tests/RunCMake/message/errormessage_deprecated-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/message/errormessage_deprecated-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/message/errormessage_deprecated-stderr.txt b/Tests/RunCMake/message/errormessage_deprecated-stderr.txt new file mode 100644 index 000000000..dd21c3b3b --- /dev/null +++ b/Tests/RunCMake/message/errormessage_deprecated-stderr.txt @@ -0,0 +1,4 @@ +^CMake Deprecation Error at errormessage_deprecated.cmake:3 \(message\): + This is a deprecation error +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/message/errormessage_deprecated.cmake b/Tests/RunCMake/message/errormessage_deprecated.cmake new file mode 100644 index 000000000..579275e94 --- /dev/null +++ b/Tests/RunCMake/message/errormessage_deprecated.cmake @@ -0,0 +1,3 @@ +set(CMAKE_ERROR_DEPRECATED ON) + +message(DEPRECATION "This is a deprecation error") diff --git a/Tests/RunCMake/message/errormessage_dev-result.txt b/Tests/RunCMake/message/errormessage_dev-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/message/errormessage_dev-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/message/errormessage_dev-stderr.txt b/Tests/RunCMake/message/errormessage_dev-stderr.txt new file mode 100644 index 000000000..086b55c47 --- /dev/null +++ b/Tests/RunCMake/message/errormessage_dev-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error \(dev\) at errormessage_dev.cmake:3 \(message\): + This is a author error +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This error is for project developers. Use -Wno-error=dev to suppress it.$ diff --git a/Tests/RunCMake/message/errormessage_dev.cmake b/Tests/RunCMake/message/errormessage_dev.cmake new file mode 100644 index 000000000..6ba11657f --- /dev/null +++ b/Tests/RunCMake/message/errormessage_dev.cmake @@ -0,0 +1,3 @@ +set(CMAKE_SUPPRESS_DEVELOPER_ERRORS OFF) + +message(AUTHOR_WARNING "This is a author error") From 821667018cc0ea049c52647b507d1a8e4bbe2c3a Mon Sep 17 00:00:00 2001 From: Michael Scott Date: Sat, 26 Dec 2015 16:04:13 +0000 Subject: [PATCH 148/255] cmake-gui: Add options to control warning-as-error messages Add new widgets to the warning messages dialog to control treating warnings as errors. --- Source/QtDialog/QCMake.cxx | 20 ++++++++ Source/QtDialog/QCMake.h | 8 ++++ Source/QtDialog/WarningMessagesDialog.cxx | 56 ++++++++++++++++++++++ Source/QtDialog/WarningMessagesDialog.h | 22 +++++++++ Source/QtDialog/WarningMessagesDialog.ui | 57 ++++++++++++++++++++++- 5 files changed, 161 insertions(+), 2 deletions(-) diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 71b794068..dd7c1387a 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -475,6 +475,26 @@ void QCMake::setSuppressDeprecatedWarnings(bool value) this->CMakeInstance->SetSuppressDeprecatedWarnings(value); } +bool QCMake::getDevWarningsAsErrors() +{ + return this->CMakeInstance->GetDevWarningsAsErrors(); +} + +void QCMake::setDevWarningsAsErrors(bool value) +{ + this->CMakeInstance->SetDevWarningsAsErrors(value); +} + +bool QCMake::getDeprecatedWarningsAsErrors() +{ + return this->CMakeInstance->GetDeprecatedWarningsAsErrors(); +} + +void QCMake::setDeprecatedWarningsAsErrors(bool value) +{ + this->CMakeInstance->SetDeprecatedWarningsAsErrors(value); +} + void QCMake::setWarnUninitializedMode(bool value) { this->WarnUninitializedMode = value; diff --git a/Source/QtDialog/QCMake.h b/Source/QtDialog/QCMake.h index 4b787b985..8942e7c90 100644 --- a/Source/QtDialog/QCMake.h +++ b/Source/QtDialog/QCMake.h @@ -99,6 +99,14 @@ public slots: bool getSuppressDeprecatedWarnings(); /// set whether to do suppress deprecated warnings void setSuppressDeprecatedWarnings(bool value); + /// get whether to treat developer (author) warnings as errors + bool getDevWarningsAsErrors(); + /// set whether to treat developer (author) warnings as errors + void setDevWarningsAsErrors(bool value); + /// get whether to treat deprecated warnings as errors + bool getDeprecatedWarningsAsErrors(); + /// set whether to treat deprecated warnings as errors + void setDeprecatedWarningsAsErrors(bool value); /// set whether to run cmake with warnings about uninitialized variables void setWarnUninitializedMode(bool value); /// set whether to run cmake with warnings about unused variables diff --git a/Source/QtDialog/WarningMessagesDialog.cxx b/Source/QtDialog/WarningMessagesDialog.cxx index 735b71c38..4bd541f3e 100644 --- a/Source/QtDialog/WarningMessagesDialog.cxx +++ b/Source/QtDialog/WarningMessagesDialog.cxx @@ -26,12 +26,27 @@ void WarningMessagesDialog::setInitialValues() this->cmakeInstance->getSuppressDevWarnings()); this->suppressDeprecatedWarnings->setChecked( this->cmakeInstance->getSuppressDeprecatedWarnings()); + + this->developerWarningsAsErrors->setChecked( + this->cmakeInstance->getDevWarningsAsErrors()); + this->deprecatedWarningsAsErrors->setChecked( + this->cmakeInstance->getDeprecatedWarningsAsErrors()); } void WarningMessagesDialog::setupSignals() { QObject::connect(this->buttonBox, SIGNAL(accepted()), this, SLOT(doAccept())); + + QObject::connect(this->suppressDeveloperWarnings, SIGNAL(stateChanged(int)), + this, SLOT(doSuppressDeveloperWarningsChanged(int))); + QObject::connect(this->suppressDeprecatedWarnings, SIGNAL(stateChanged(int)), + this, SLOT(doSuppressDeprecatedWarningsChanged(int))); + + QObject::connect(this->developerWarningsAsErrors, SIGNAL(stateChanged(int)), + this, SLOT(doDeveloperWarningsAsErrorsChanged(int))); + QObject::connect(this->deprecatedWarningsAsErrors, SIGNAL(stateChanged(int)), + this, SLOT(doDeprecatedWarningsAsErrorsChanged(int))); } void WarningMessagesDialog::doAccept() @@ -40,4 +55,45 @@ void WarningMessagesDialog::doAccept() this->suppressDeveloperWarnings->isChecked()); this->cmakeInstance->setSuppressDeprecatedWarnings( this->suppressDeprecatedWarnings->isChecked()); + + this->cmakeInstance->setDevWarningsAsErrors( + this->developerWarningsAsErrors->isChecked()); + this->cmakeInstance->setDeprecatedWarningsAsErrors( + this->deprecatedWarningsAsErrors->isChecked()); +} + +void WarningMessagesDialog::doSuppressDeveloperWarningsChanged(int state) +{ + // no warnings implies no errors either + if (state) + { + this->developerWarningsAsErrors->setChecked(false); + } +} + +void WarningMessagesDialog::doSuppressDeprecatedWarningsChanged(int state) +{ + // no warnings implies no errors either + if (state) + { + this->deprecatedWarningsAsErrors->setChecked(false); + } +} + +void WarningMessagesDialog::doDeveloperWarningsAsErrorsChanged(int state) +{ + // warnings as errors implies warnings are not suppressed + if (state) + { + this->suppressDeveloperWarnings->setChecked(false); + } +} + +void WarningMessagesDialog::doDeprecatedWarningsAsErrorsChanged(int state) +{ + // warnings as errors implies warnings are not suppressed + if (state) + { + this->suppressDeprecatedWarnings->setChecked(false); + } } diff --git a/Source/QtDialog/WarningMessagesDialog.h b/Source/QtDialog/WarningMessagesDialog.h index 028ec104d..6c274a71d 100644 --- a/Source/QtDialog/WarningMessagesDialog.h +++ b/Source/QtDialog/WarningMessagesDialog.h @@ -35,6 +35,28 @@ private slots: */ void doAccept(); + /** + * Handler for checked state changed event of the suppress developer warnings + * checkbox. + */ + void doSuppressDeveloperWarningsChanged(int state); + /** + * Handler for checked state changed event of the suppress deprecated + * warnings checkbox. + */ + void doSuppressDeprecatedWarningsChanged(int state); + + /** + * Handler for checked state changed event of the developer warnings as + * errors checkbox. + */ + void doDeveloperWarningsAsErrorsChanged(int state); + /** + * Handler for checked state changed event of the deprecated warnings as + * errors checkbox. + */ + void doDeprecatedWarningsAsErrorsChanged(int state); + private: QCMake* cmakeInstance; diff --git a/Source/QtDialog/WarningMessagesDialog.ui b/Source/QtDialog/WarningMessagesDialog.ui index 2367772cf..3b35cbc67 100644 --- a/Source/QtDialog/WarningMessagesDialog.ui +++ b/Source/QtDialog/WarningMessagesDialog.ui @@ -6,8 +6,8 @@ 0 0 - 250 - 150 + 300 + 300 @@ -37,6 +37,9 @@ 0 + + Suppress developer (author) warnings. + Developer Warnings @@ -53,6 +56,9 @@ 0 + + Suppress deprecated warnings. + Deprecated Warnings @@ -64,6 +70,53 @@ + + + + + 0 + 0 + + + + Warnings as Errors + + + + + + + 0 + 0 + + + + Treat developer (author) warnings as errors. + + + Developer Warnings as Errors + + + + + + + + 0 + 0 + + + + Treat deprecated warnings as errors. + + + Deprecated Warnings as Errors + + + + + + From d790f4feeadc863d47ffec9d901d4bf5519001df Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Tue, 12 Jan 2016 14:44:21 -0500 Subject: [PATCH 149/255] FindDCMTK: Keep original copyright notice. This is a follow-up to 31b4700ed640bee962f9db9ce25fa84261a944d2. Remove the extra character that was added to ensure the CMake.ModuleNotices test passes. --- Modules/FindDCMTK.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/FindDCMTK.cmake b/Modules/FindDCMTK.cmake index 115c26bb5..e79c2cd9b 100644 --- a/Modules/FindDCMTK.cmake +++ b/Modules/FindDCMTK.cmake @@ -105,7 +105,7 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -# (To distributed this file outside of CMake, substitute the full +# (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # From 361c199ff602d492d4261f0387d84913a0989473 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Tue, 12 Jan 2016 15:44:10 -0500 Subject: [PATCH 150/255] FindDCMTK: Add reStructuredText formatting. --- Modules/FindDCMTK.cmake | 98 +++++++++++++++++++++-------------------- 1 file changed, 51 insertions(+), 47 deletions(-) diff --git a/Modules/FindDCMTK.cmake b/Modules/FindDCMTK.cmake index e79c2cd9b..12386169f 100644 --- a/Modules/FindDCMTK.cmake +++ b/Modules/FindDCMTK.cmake @@ -1,32 +1,35 @@ #.rst: # FindDCMTK # --------- +# Find DCMTK libraries and applications # -# - find DCMTK libraries and applications -# The module defines the following variables: +# The module defines the following variables:: # # DCMTK_INCLUDE_DIRS - Directories to include to use DCMTK # DCMTK_LIBRARIES - Files to link against to use DCMTK # DCMTK_FOUND - If false, don't try to use DCMTK # DCMTK_DIR - (optional) Source directory for DCMTK # -# DCMTK_DIR can be used to make it simpler to find the various include +# `DCMTK_DIR` can be used to make it simpler to find the various include # directories and compiled libraries if you've just compiled it in the # source tree. Just set it to the root of the tree where you extracted -# the source (default to /usr) +# the source (default to `/usr`) # # # This file is able to find version of DCMTK that does or does not export -# a DCMTKConfig.cmake file. +# a *DCMTKConfig.cmake* file. # -# IMPORTANT: A set of patches has been contributed to DCMTK -# maintainers and merged upstream. As soon as: -# (1) it has been integrated upstream so that it is available in +# .. important:: +# A set of patches has been contributed to DCMTK +# maintainers and merged upstream. As soon as: +# +# 1) it has been integrated upstream so that it is available in # an official release (for example X.Y.Z), -# (2) code bases have been updated to build against X.Y.Z -# This file could be removed. +# 2) code bases have been updated to build against X.Y.Z # -# The set of patches is listed here: https://github.com/commontk/DCMTK/compare/79030ba...f461865 +# This file could be removed. +# +# The set of patches is listed here: https://github.com/commontk/DCMTK/compare/79030ba...f461865 # # # Waiting for this to happen, build systems will have to be able @@ -35,24 +38,25 @@ # On any given system, the following combination of DCMTK version could be # considered: # -# | SYSTEM DCMTK + LOCAL DCMTK | Supported ? | -# --------------------------------------------------------------------------- -# Case A | NA + [ ] DCMTKConfig | YES | -# ------------------------------------------------------|-------------------- -# Case B | NA + [X] DCMTKConfig | YES | -# ------------------------------------------------------|-------------------- -# Case C | [ ] DCMTKConfig + NA | YES | -# ------------------------------------------------------|-------------------- -# Case D | [X] DCMTKConfig + NA | YES | -# ------------------------------------------------------|-------------------- -# Case E | [ ] DCMTKConfig + [ ] DCMTKConfig | YES (*) | -# ------------------------------------------------------|-------------------- -# Case F | [X] DCMTKConfig + [ ] DCMTKConfig | NO | -# ------------------------------------------------------|-------------------- -# Case G | [ ] DCMTKConfig + [X] DCMTKConfig | YES | -# ------------------------------------------------------|-------------------- -# Case H | [X] DCMTKConfig + [X] DCMTKConfig | YES | -# --------------------------------------------------------------------------- +# +--------+---------------------+-----------------------+-------------------+ +# | | SYSTEM DCMTK | LOCAL DCMTK | Supported ? | +# +--------+---------------------+-----------------------+-------------------+ +# | Case A | NA | [ ] DCMTKConfig | YES | +# +--------+---------------------+-----------------------+-------------------+ +# | Case B | NA | [X] DCMTKConfig | YES | +# +--------+---------------------+-----------------------+-------------------+ +# | Case C | [ ] DCMTKConfig | NA | YES | +# +--------+---------------------+-----------------------+-------------------+ +# | Case D | [X] DCMTKConfig | NA | YES | +# +--------+---------------------+-----------------------+-------------------+ +# | Case E | [ ] DCMTKConfig | [ ] DCMTKConfig | YES (*) | +# +--------+---------------------+-----------------------+-------------------+ +# | Case F | [X] DCMTKConfig | [ ] DCMTKConfig | NO | +# +--------+---------------------+-----------------------+-------------------+ +# | Case G | [ ] DCMTKConfig | [X] DCMTKConfig | YES | +# +--------+---------------------+-----------------------+-------------------+ +# | Case H | [X] DCMTKConfig | [X] DCMTKConfig | YES | +# +--------+---------------------+-----------------------+-------------------+ # # (*) See Troubleshooting section. # @@ -67,31 +71,31 @@ # # It is a two step process: # -# * Step 1: Attempt to find DCMTK version providing a DCMTKConfig.cmake file. This is done -# with the help of '' -# * Step 2: If step 1 failed, rely on FindDCMTK.cmake to set DCMTK_* variables details below. +# * Step 1: Attempt to find DCMTK version providing a DCMTKConfig.cmake file. This is done with the help of `''` +# * Step 2: If step 1 failed, rely on FindDCMTK.cmake to set DCMTK_* variables details below. # +# Troubleshooting +# ^^^^^^^^^^^^^^^ # +# What to do if my project finds a different version of DCMTK? # -# Troubleshooting: +# Remove DCMTK entry from the CMake registry per :command:`find_package` +# documentation. # -# What to do if my project finds a different version of DCMTK? +# Details +# ^^^^^^^ # -# Remove DCMTK entry from the CMake registry. -# Search for "CMake user package registry" on http://www.cmake.org/cmake/help/v2.8.9/cmake.html#command:find_package +# At some point, the DCMTK build tree was exported [1][2][3]. Indeed, before the set of +# patches discussed above has been contributed to upstream DCMTK, an initial implementation of +# a DCMTK build system exporting its build tree has been implemented and has been tested by some +# folks. This had the effect of populating the CMake registry. # -# Details: As some point, the DCMTK build tree was exported [1][2][3]. Indeed, before the set of -# patches discussed above has been contributed to upstream DCMTK, an initial implementation of -# a DCMTK build system exporting its build tree has been implemented and has been tested by some -# folks. This had the effect of populating the CMake registry. -# -# Since Step1 does not exclude the CMake registry, when dealing with case E, the incorrect version of -# DCMTK could be found. -# -# [1] http://slicer-devel.65872.n3.nabble.com/Packaging-seems-to-work-again-tp4028121p4028134.html -# [2] https://www.assembla.com/spaces/slicerrt/tickets/244-dcmtk_dir-vs--dcmtkconfig-cmake?comment=267984263#comment:267984263 -# [3] http://www.cmake.org/cmake/help/v2.8.11/cmake.html#command:export +# Since Step1 does not exclude the CMake registry, when dealing with case E, the incorrect version of +# DCMTK could be found. # +# - [1] http://slicer-devel.65872.n3.nabble.com/Packaging-seems-to-work-again-tp4028121p4028134.html +# - [2] https://www.assembla.com/spaces/slicerrt/tickets/244-dcmtk_dir-vs--dcmtkconfig-cmake?comment=267984263#comment:267984263 +# - [3] http://www.cmake.org/cmake/help/v2.8.11/cmake.html#command:export # #============================================================================= # Copyright 2004-2009 Kitware, Inc. From 39b7954d4de734d6f08fab1a6fb442abc2e9bb5c Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 13 Jan 2016 00:01:10 -0500 Subject: [PATCH 151/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 585f6e070..f9fdef498 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20160112) +set(CMake_VERSION_PATCH 20160113) #set(CMake_VERSION_RC 1) From 630c8aa8435fced988545d396714398faa3426b1 Mon Sep 17 00:00:00 2001 From: Yves Frederix Date: Tue, 12 Jan 2016 21:01:07 +0100 Subject: [PATCH 152/255] install: Allow generator expressions in DIRECTORY Teach install(DIRECTORY) to support generator expressions in the list of directories, much like install(FILES) already supports. --- Help/command/install.rst | 7 +++-- Help/release/dev/install-DIRECTORY-genex.rst | 6 ++++ Source/cmInstallDirectoryGenerator.cxx | 28 ++++++++++++++++--- Source/cmInstallDirectoryGenerator.h | 3 +- Tests/ExportImport/Export/CMakeLists.txt | 2 +- .../DIRECTORY-DIRECTORY-bad-result.txt | 1 + .../DIRECTORY-DIRECTORY-bad-stderr.txt | 6 ++++ .../install/DIRECTORY-DIRECTORY-bad.cmake | 1 + Tests/RunCMake/install/RunCMakeTest.cmake | 1 + Tests/SimpleInstall/CMakeLists.txt | 4 +-- Tests/SimpleInstallS2/CMakeLists.txt | 4 +-- 11 files changed, 50 insertions(+), 13 deletions(-) create mode 100644 Help/release/dev/install-DIRECTORY-genex.rst create mode 100644 Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad-result.txt create mode 100644 Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad-stderr.txt create mode 100644 Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad.cmake diff --git a/Help/command/install.rst b/Help/command/install.rst index 423899e26..5d2add7ed 100644 --- a/Help/command/install.rst +++ b/Help/command/install.rst @@ -271,9 +271,10 @@ will install the ``icons`` directory to ``share/myproj/icons`` and the file permissions, the scripts will be given specific permissions, and any ``CVS`` directories will be excluded. -The install destination given to the directory install ``DESTINATION`` may -use "generator expressions" with the syntax ``$<...>``. See the -:manual:`cmake-generator-expressions(7)` manual for available expressions. +The list of ``dirs...`` given to ``DIRECTORY`` and the install destination +given to the directory install ``DESTINATION`` may use "generator expressions" +with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` +manual for available expressions. Custom Installation Logic ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/Help/release/dev/install-DIRECTORY-genex.rst b/Help/release/dev/install-DIRECTORY-genex.rst new file mode 100644 index 000000000..e48f19b2e --- /dev/null +++ b/Help/release/dev/install-DIRECTORY-genex.rst @@ -0,0 +1,6 @@ +install-DIRECTORY-genex +----------------------- + +* The :command:`install(DIRECTORY)` command learned to support + :manual:`generator expressions ` + in the list of directories. diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx index ea27f61b0..f2e860915 100644 --- a/Source/cmInstallDirectoryGenerator.cxx +++ b/Source/cmInstallDirectoryGenerator.cxx @@ -36,6 +36,16 @@ cmInstallDirectoryGenerator { this->ActionsPerConfig = true; } + + // We need per-config actions if any directories have generator expressions. + for(std::vector::const_iterator i = dirs.begin(); + !this->ActionsPerConfig && i != dirs.end(); ++i) + { + if(cmGeneratorExpression::Find(*i) != std::string::npos) + { + this->ActionsPerConfig = true; + } + } } //---------------------------------------------------------------------------- @@ -60,7 +70,7 @@ cmInstallDirectoryGenerator::GenerateScriptActions(std::ostream& os, } else { - this->AddDirectoryInstallRule(os, "", indent); + this->AddDirectoryInstallRule(os, "", indent, this->Directories); } } @@ -69,20 +79,30 @@ void cmInstallDirectoryGenerator::GenerateScriptForConfig( const std::string& config, Indent const& indent) { - this->AddDirectoryInstallRule(os, config, indent); + std::vector dirs; + cmGeneratorExpression ge; + for(std::vector::const_iterator i = this->Directories.begin(); + i != this->Directories.end(); ++i) + { + cmsys::auto_ptr cge = ge.Parse(*i); + cmSystemTools::ExpandListArgument(cge->Evaluate( + this->LocalGenerator, config), dirs); + } + this->AddDirectoryInstallRule(os, config, indent, dirs); } void cmInstallDirectoryGenerator::AddDirectoryInstallRule( std::ostream& os, const std::string& config, - Indent const& indent) + Indent const& indent, + std::vector const& dirs) { // Write code to install the directories. const char* no_rename = 0; this->AddInstallRule(os, this->GetDestination(config), cmInstallType_DIRECTORY, - this->Directories, + dirs, this->Optional, this->FilePermissions.c_str(), this->DirPermissions.c_str(), diff --git a/Source/cmInstallDirectoryGenerator.h b/Source/cmInstallDirectoryGenerator.h index 04107e1e7..9b732d3f1 100644 --- a/Source/cmInstallDirectoryGenerator.h +++ b/Source/cmInstallDirectoryGenerator.h @@ -42,7 +42,8 @@ protected: Indent const& indent); void AddDirectoryInstallRule(std::ostream& os, const std::string& config, - Indent const& indent); + Indent const& indent, + std::vector const& dirs); cmLocalGenerator* LocalGenerator; std::vector Directories; std::string FilePermissions; diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index aedc89b9d..dcba9acdd 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -551,5 +551,5 @@ install( ARCHIVE DESTINATION lib INCLUDES DESTINATION include/abs ) -install(DIRECTORY include/abs DESTINATION $<1:include>$<0:/wrong>) +install(DIRECTORY $<1:include/abs>$<0:/wrong> DESTINATION $<1:include>$<0:/wrong>) install(EXPORT expAbs NAMESPACE expAbs_ DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/expAbs) diff --git a/Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad-result.txt b/Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad-stderr.txt b/Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad-stderr.txt new file mode 100644 index 000000000..984415868 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad-stderr.txt @@ -0,0 +1,6 @@ +CMake Error: + Error evaluating generator expression: + + \$ + + Expression did not evaluate to a known generator expression diff --git a/Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad.cmake b/Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad.cmake new file mode 100644 index 000000000..ec0436d38 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad.cmake @@ -0,0 +1 @@ +install(DIRECTORY $ DESTINATION .) diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index 043bd1ff3..2c1b29d9c 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -6,6 +6,7 @@ run_cmake(DIRECTORY-message-lazy) run_cmake(SkipInstallRulesWarning) run_cmake(SkipInstallRulesNoWarning1) run_cmake(SkipInstallRulesNoWarning2) +run_cmake(DIRECTORY-DIRECTORY-bad) run_cmake(DIRECTORY-DESTINATION-bad) run_cmake(FILES-DESTINATION-bad) run_cmake(TARGETS-DESTINATION-bad) diff --git a/Tests/SimpleInstall/CMakeLists.txt b/Tests/SimpleInstall/CMakeLists.txt index e365076c0..2737f182f 100644 --- a/Tests/SimpleInstall/CMakeLists.txt +++ b/Tests/SimpleInstall/CMakeLists.txt @@ -252,7 +252,7 @@ else() file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS") file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS") install( - DIRECTORY TestSubDir scripts/ DESTINATION $<1:MyTest/share>$<0:/wrong> + DIRECTORY TestSubDir $<1:scripts/>$<0:/wrong> DESTINATION $<1:MyTest/share>$<0:/wrong> FILE_PERMISSIONS OWNER_READ OWNER_WRITE DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE @@ -263,7 +263,7 @@ else() # Alternate directory installation for coverage. install( - DIRECTORY scripts/ DESTINATION $<1:MyTest/share/alt>$<0:/wrong> + DIRECTORY $<1:scripts/>$<0:/wrong> DESTINATION $<1:MyTest/share/alt>$<0:/wrong> COMPONENT Development USE_SOURCE_PERMISSIONS PATTERN "CVS" EXCLUDE diff --git a/Tests/SimpleInstallS2/CMakeLists.txt b/Tests/SimpleInstallS2/CMakeLists.txt index e365076c0..2737f182f 100644 --- a/Tests/SimpleInstallS2/CMakeLists.txt +++ b/Tests/SimpleInstallS2/CMakeLists.txt @@ -252,7 +252,7 @@ else() file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS") file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS") install( - DIRECTORY TestSubDir scripts/ DESTINATION $<1:MyTest/share>$<0:/wrong> + DIRECTORY TestSubDir $<1:scripts/>$<0:/wrong> DESTINATION $<1:MyTest/share>$<0:/wrong> FILE_PERMISSIONS OWNER_READ OWNER_WRITE DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE @@ -263,7 +263,7 @@ else() # Alternate directory installation for coverage. install( - DIRECTORY scripts/ DESTINATION $<1:MyTest/share/alt>$<0:/wrong> + DIRECTORY $<1:scripts/>$<0:/wrong> DESTINATION $<1:MyTest/share/alt>$<0:/wrong> COMPONENT Development USE_SOURCE_PERMISSIONS PATTERN "CVS" EXCLUDE From a7393cbd40b4387d352413c48cec36b9d3cd0b51 Mon Sep 17 00:00:00 2001 From: Zack Galbreath Date: Wed, 13 Jan 2016 09:49:40 -0500 Subject: [PATCH 153/255] ctest_test: Report which tests failed even when QUIET is used Since commit v3.3.0-rc1~410^2~3 (ctest_test: Add QUIET option, 2015-02-17) if tests fail when QUIET is used one sees: The following tests FAILED: but not the subsequent line(s) indicating which tests failed. Restore the list of failed tests. --- Source/CTest/cmCTestTestHandler.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index a8f983f6f..b6a4819a0 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -609,11 +609,11 @@ int cmCTestTestHandler::ProcessHandler() if ( ftit->Status != cmCTestTestHandler::COMPLETED ) { ofs << ftit->TestCount << ":" << ftit->Name << std::endl; - cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "\t" << std::setw(3) + cmCTestLog(this->CTest, HANDLER_OUTPUT, "\t" << std::setw(3) << ftit->TestCount << " - " << ftit->Name << " (" << this->GetTestStatus(ftit->Status) << ")" - << std::endl, this->Quiet); + << std::endl); } } } From 7a37afa7e709bb1134ad7fb058195bc85f261b87 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 13 Jan 2016 14:27:02 -0500 Subject: [PATCH 154/255] bootstrap: Add option to build with system liblzma (#15916) --- bootstrap | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bootstrap b/bootstrap index d1274c150..b3f06a138 100755 --- a/bootstrap +++ b/bootstrap @@ -404,6 +404,8 @@ Configuration: --no-system-zlib use cmake-provided zlib library (default) --system-bzip2 use system-installed bzip2 library --no-system-bzip2 use cmake-provided bzip2 library (default) + --system-liblzma use system-installed liblzma library + --no-system-liblzma use cmake-provided liblzma library (default) --system-libarchive use system-installed libarchive library --no-system-libarchive use cmake-provided libarchive library (default) @@ -632,10 +634,10 @@ while test $# != 0; do --init=*) cmake_init_file=`cmake_arg "$1"` ;; --system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=1" ;; --no-system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=0" ;; - --system-bzip2|--system-curl|--system-expat|--system-jsoncpp|--system-libarchive|--system-zlib) + --system-bzip2|--system-curl|--system-expat|--system-jsoncpp|--system-libarchive|--system-zlib|--system-liblzma) lib=`cmake_arg "$1" "--system-"` cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper $lib`=1" ;; - --no-system-bzip2|--no-system-curl|--no-system-expat|--no-system-jsoncpp|--no-system-libarchive|--no-system-zlib) + --no-system-bzip2|--no-system-curl|--no-system-expat|--no-system-jsoncpp|--no-system-libarchive|--no-system-zlib|--no-system-liblzma) lib=`cmake_arg "$1" "--no-system-"` cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper $lib`=0" ;; --qt-gui) cmake_bootstrap_qt_gui="1" ;; From 6be2dedaedec4d6df7844119d2e4954535d66ad2 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 14 Jan 2016 00:01:07 -0500 Subject: [PATCH 155/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index f9fdef498..ea958625a 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20160113) +set(CMake_VERSION_PATCH 20160114) #set(CMake_VERSION_RC 1) From 4b24626e0096f5bf6d57b5861a2eb001067c8f89 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Wed, 13 Jan 2016 10:53:03 -0500 Subject: [PATCH 156/255] FindDCMTK: Simplify documentation. --- Modules/FindDCMTK.cmake | 62 +++++++++++++---------------------------- 1 file changed, 20 insertions(+), 42 deletions(-) diff --git a/Modules/FindDCMTK.cmake b/Modules/FindDCMTK.cmake index 12386169f..63d253d90 100644 --- a/Modules/FindDCMTK.cmake +++ b/Modules/FindDCMTK.cmake @@ -1,6 +1,7 @@ #.rst: # FindDCMTK # --------- +# # Find DCMTK libraries and applications # # The module defines the following variables:: @@ -10,32 +11,29 @@ # DCMTK_FOUND - If false, don't try to use DCMTK # DCMTK_DIR - (optional) Source directory for DCMTK # -# `DCMTK_DIR` can be used to make it simpler to find the various include -# directories and compiled libraries if you've just compiled it in the -# source tree. Just set it to the root of the tree where you extracted -# the source (default to `/usr`) +# Compatibility +# ^^^^^^^^^^^^^ +# +# This module is able to find a version of DCMTK that does or does not export +# a *DCMTKConfig.cmake* file. It applies a two step process: +# +# * Step 1: Attempt to find DCMTK version providing a *DCMTKConfig.cmake* file. +# * Step 2: If step 1 failed, rely on *FindDCMTK.cmake* to set `DCMTK_*` variables details below. # # -# This file is able to find version of DCMTK that does or does not export -# a *DCMTKConfig.cmake* file. -# -# .. important:: -# A set of patches has been contributed to DCMTK -# maintainers and merged upstream. As soon as: -# -# 1) it has been integrated upstream so that it is available in -# an official release (for example X.Y.Z), -# 2) code bases have been updated to build against X.Y.Z -# -# This file could be removed. -# -# The set of patches is listed here: https://github.com/commontk/DCMTK/compare/79030ba...f461865 +# `Recent DCMTK +# `_ +# provides a *DCMTKConfig.cmake* :manual:`package configuration file +# `. To exclusively use the package configuration file +# (recommended when possible), pass the `NO_MODULE` option to +# :command:`find_package`. For example, `find_package(DCMTK NO_MODULE)`. +# This requires official DCMTK snapshot *3.6.1_20140617* or newer. # # -# Waiting for this to happen, build systems will have to be able +# Until all clients update to the more recent DCMTK, build systems will need # to support different versions of DCMTK. # -# On any given system, the following combination of DCMTK version could be +# On any given system, the following combinations of DCMTK versions could be # considered: # # +--------+---------------------+-----------------------+-------------------+ @@ -69,34 +67,14 @@ # [X] DCMTKConfig ..: Means that the version of DCMTK exports a DCMTKConfig.cmake file. # # -# It is a two step process: -# -# * Step 1: Attempt to find DCMTK version providing a DCMTKConfig.cmake file. This is done with the help of `''` -# * Step 2: If step 1 failed, rely on FindDCMTK.cmake to set DCMTK_* variables details below. -# # Troubleshooting # ^^^^^^^^^^^^^^^ # # What to do if my project finds a different version of DCMTK? # -# Remove DCMTK entry from the CMake registry per :command:`find_package` +# Remove DCMTK entry from the CMake cache per :command:`find_package` # documentation. -# -# Details -# ^^^^^^^ -# -# At some point, the DCMTK build tree was exported [1][2][3]. Indeed, before the set of -# patches discussed above has been contributed to upstream DCMTK, an initial implementation of -# a DCMTK build system exporting its build tree has been implemented and has been tested by some -# folks. This had the effect of populating the CMake registry. -# -# Since Step1 does not exclude the CMake registry, when dealing with case E, the incorrect version of -# DCMTK could be found. -# -# - [1] http://slicer-devel.65872.n3.nabble.com/Packaging-seems-to-work-again-tp4028121p4028134.html -# - [2] https://www.assembla.com/spaces/slicerrt/tickets/244-dcmtk_dir-vs--dcmtkconfig-cmake?comment=267984263#comment:267984263 -# - [3] http://www.cmake.org/cmake/help/v2.8.11/cmake.html#command:export -# + #============================================================================= # Copyright 2004-2009 Kitware, Inc. # Copyright 2009-2010 Mathieu Malaterre From b8d002af1aeefb435a9560b056f081e5d8dff734 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 15 Jan 2016 00:01:07 -0500 Subject: [PATCH 157/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ea958625a..17ed24809 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20160114) +set(CMake_VERSION_PATCH 20160115) #set(CMake_VERSION_RC 1) From 6ccc307053f03c4c48a2cb9d5795f91d341a5c39 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 15 Jan 2016 08:44:15 -0500 Subject: [PATCH 158/255] FindCUDA: Support special characters in path (#15919) Add `VERBATIM` to all `add_custom_command` calls so that CMake will escape arguments properly even when special characters such as "()" are present. Suggested-by: Nils Gladitz --- Modules/FindCUDA.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index ada5b8a72..1674e2dcf 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -1474,6 +1474,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) -P "${custom_target_script}" WORKING_DIRECTORY "${cuda_compile_intermediate_directory}" COMMENT "${cuda_build_comment_string}" + VERBATIM ) # Make sure the build system knows the file is generated. @@ -1592,6 +1593,7 @@ function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options COMMAND ${CUDA_NVCC_EXECUTABLE} ${nvcc_flags} -dlink ${object_files} -o ${output_file} ${flags} COMMENT "Building NVCC intermediate link file ${output_file_relative_path}" + VERBATIM ) else() get_filename_component(output_file_dir "${output_file}" DIRECTORY) @@ -1601,6 +1603,7 @@ function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options COMMAND ${CMAKE_COMMAND} -E echo "Building NVCC intermediate link file ${output_file_relative_path}" COMMAND ${CMAKE_COMMAND} -E make_directory "${output_file_dir}" COMMAND ${CUDA_NVCC_EXECUTABLE} ${nvcc_flags} ${flags} -dlink ${object_files} -o "${output_file}" + VERBATIM ) endif() endif() From 0ca122fcb3df3331a6daaeec090bd967daa0f2b9 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 15 Jan 2016 09:54:56 -0500 Subject: [PATCH 159/255] Tests: Isolate policy changes in ExportImport test Use cmake_policy(PUSH/POP) to isolate CMP0022 policy changes. --- Tests/ExportImport/Export/CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index dcba9acdd..9b6a543b4 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -270,6 +270,7 @@ install(FILES DESTINATION include/testSharedLibRequiredUser ) +cmake_policy(PUSH) cmake_policy(SET CMP0022 NEW) add_library(testSharedLibRequiredUser2 SHARED testSharedLibRequiredUser2.cpp) generate_export_header(testSharedLibRequiredUser2) @@ -283,7 +284,7 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/testsharedlibrequireduser2_export.h" DESTINATION include/testSharedLibRequiredUser2 ) -cmake_policy(SET CMP0022 OLD) +cmake_policy(POP) add_library(testSharedLibDepends SHARED testSharedLibDepends.cpp) set_property(TARGET testSharedLibDepends APPEND PROPERTY @@ -311,6 +312,8 @@ target_link_libraries(testSharedLibDepends LINK_PUBLIC renamed_on_export) target_link_libraries(testSharedLibDepends LINK_INTERFACE_LIBRARIES $<$,EXECUTABLE>:$>) +cmake_policy(PUSH) +cmake_policy(SET CMP0022 OLD) add_library(cmp0022OLD SHARED cmp0022_vs6_1.cpp) generate_export_header(cmp0022OLD BASE_NAME cmp0022) target_include_directories(cmp0022OLD PUBLIC @@ -324,7 +327,7 @@ target_include_directories(cmp0022NEW PUBLIC "$" "$/include/cmp0022>" ) -cmake_policy(SET CMP0022 OLD) +cmake_policy(POP) install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/cmp0022.h" "${CMAKE_CURRENT_BINARY_DIR}/cmp0022_export.h" From e5cbec14a5aec9203bd0e29fa0172fa00c97e521 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 15 Jan 2016 09:49:21 -0500 Subject: [PATCH 160/255] Tests: Use CMP0022 NEW behavior in some ExportImport cases --- Tests/ExportImport/Export/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index 9b6a543b4..9c50d6cc6 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -130,10 +130,13 @@ set_property(TARGET testLibCycleA PROPERTY LINK_INTERFACE_MULTIPLICITY 3) add_library(testLibNoSONAME SHARED testLibNoSONAME.c) set_property(TARGET testLibNoSONAME PROPERTY NO_SONAME 1) +cmake_policy(PUSH) +cmake_policy(SET CMP0022 NEW) # Test exporting dependent libraries into different exports add_library(testLibRequired testLibRequired.c) add_library(testLibDepends testLibDepends.c) target_link_libraries(testLibDepends LINK_PUBLIC testLibRequired) +cmake_policy(POP) macro(add_include_lib _libName) file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${_libName}.c" "/* no content */\n") From aea1b03617bed037bbd12af36d7ef92feff0ba74 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 15 Jan 2016 10:02:52 -0500 Subject: [PATCH 161/255] Fix export of STATIC library PRIVATE dependencies with CMP0022 NEW MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The target_link_libraries command records the PRIVATE dependencies of a STATIC library in INTERFACE_LINK_LIBRARIES as "$". This hides the target name from export namespacing logic inside a generator expression. When user-written generator expressions reference a target name they must put it inside a "$" expression to allow the export logic to rename the target. In the case that the private dependency is not already a generator expression, target_link_libraries must use "$>" to allow the export logic to rename the target. Reported-by: Tamás Kenéz --- Source/cmTargetLinkLibrariesCommand.cxx | 7 +++++-- Tests/ExportImport/Export/CMakeLists.txt | 6 ++++++ Tests/ExportImport/Export/testLibDepends.c | 7 ++++++- Tests/ExportImport/Export/testStaticLibRequiredPrivate.c | 1 + 4 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 Tests/ExportImport/Export/testStaticLibRequiredPrivate.c diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index 435346a30..5f3246ace 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -432,8 +432,11 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, { std::string configLib = this->Target ->GetDebugGeneratorExpressions(lib, llt); - if (cmGeneratorExpression::IsValidTargetName(lib) - || cmGeneratorExpression::Find(lib) != std::string::npos) + if (cmGeneratorExpression::IsValidTargetName(configLib)) + { + configLib = "$>"; + } + else if (cmGeneratorExpression::Find(configLib) != std::string::npos) { configLib = "$"; } diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index 9c50d6cc6..c2ecb0b1c 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -136,6 +136,8 @@ cmake_policy(SET CMP0022 NEW) add_library(testLibRequired testLibRequired.c) add_library(testLibDepends testLibDepends.c) target_link_libraries(testLibDepends LINK_PUBLIC testLibRequired) +add_library(testStaticLibRequiredPrivate testStaticLibRequiredPrivate.c) +target_link_libraries(testLibDepends PRIVATE testStaticLibRequiredPrivate) cmake_policy(POP) macro(add_include_lib _libName) @@ -394,6 +396,10 @@ install(TARGETS INCLUDES DESTINATION $/include/$ ) +install(TARGETS + testStaticLibRequiredPrivate + EXPORT RequiredExp DESTINATION lib +) install(EXPORT RequiredExp NAMESPACE Req:: FILE testLibRequiredTargets.cmake DESTINATION lib/cmake/testLibRequired) file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest") diff --git a/Tests/ExportImport/Export/testLibDepends.c b/Tests/ExportImport/Export/testLibDepends.c index fb5a002e0..3c7774eed 100644 --- a/Tests/ExportImport/Export/testLibDepends.c +++ b/Tests/ExportImport/Export/testLibDepends.c @@ -16,5 +16,10 @@ #endif extern int testLibRequired(void); +extern int testStaticLibRequiredPrivate(void); -int testLibDepends(void) { return testLibRequired(); } +int testLibDepends(void) { + return testLibRequired() + + testStaticLibRequiredPrivate() + ; +} diff --git a/Tests/ExportImport/Export/testStaticLibRequiredPrivate.c b/Tests/ExportImport/Export/testStaticLibRequiredPrivate.c new file mode 100644 index 000000000..28a2675ff --- /dev/null +++ b/Tests/ExportImport/Export/testStaticLibRequiredPrivate.c @@ -0,0 +1 @@ +int testStaticLibRequiredPrivate(void) { return 0; } From 09b2f1c3f5819a5a3ec03069e7c2811172ac3591 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 15 Jan 2016 14:04:19 -0500 Subject: [PATCH 162/255] Windows: Find Program Files directories more robustly from environment In Modules/Platform/WindowsPaths.cmake our previously recorded environment variable combinations no longer seem to be correct. For example, a 64-bit cmake binary may see ProgramW6432 in the environment and end up not considering the "ProgramFiles(x86)" variable. Instead check for all possible environment variables in the preferred order and then remove duplicates. Reported-by: Shawn Waldon --- Modules/Platform/WindowsPaths.cmake | 52 +++++++++++------------------ 1 file changed, 19 insertions(+), 33 deletions(-) diff --git a/Modules/Platform/WindowsPaths.cmake b/Modules/Platform/WindowsPaths.cmake index 658de3bf5..eafa8fa1d 100644 --- a/Modules/Platform/WindowsPaths.cmake +++ b/Modules/Platform/WindowsPaths.cmake @@ -28,46 +28,32 @@ set(__WINDOWS_PATHS_INCLUDED 1) # Windows 64-bit Binary: # ENV{ProgramFiles(x86)} = [C:\Program Files (x86)] # ENV{ProgramFiles} = [C:\Program Files] -# ENV{ProgramW6432} = -# (executed from cygwin): -# ENV{ProgramFiles(x86)} = -# ENV{ProgramFiles} = [C:\Program Files] -# ENV{ProgramW6432} = +# ENV{ProgramW6432} = [C:\Program Files] or # -# Windows 32-bit Binary: +# Windows 32-bit Binary on 64-bit Windows: # ENV{ProgramFiles(x86)} = [C:\Program Files (x86)] # ENV{ProgramFiles} = [C:\Program Files (x86)] # ENV{ProgramW6432} = [C:\Program Files] -# (executed from cygwin): -# ENV{ProgramFiles(x86)} = -# ENV{ProgramFiles} = [C:\Program Files (x86)] -# ENV{ProgramW6432} = [C:\Program Files] -if(DEFINED "ENV{ProgramW6432}") - # 32-bit binary on 64-bit windows. - # The 64-bit program files are in ProgramW6432. - list(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramW6432}") - - # The 32-bit program files are in ProgramFiles. - if(DEFINED "ENV{ProgramFiles}") - list(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramFiles}") +set(_programfiles "") +foreach(v "ProgramW6432" "ProgramFiles" "ProgramFiles(x86)") + if(DEFINED "ENV{${v}}") + file(TO_CMAKE_PATH "$ENV{${v}}" _env_programfiles) + list(APPEND _programfiles "${_env_programfiles}") + unset(_env_programfiles) endif() -else() - # 64-bit binary, or 32-bit binary on 32-bit windows. - if(DEFINED "ENV{ProgramFiles}") - list(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramFiles}") - endif() - set(programfilesx86 "ProgramFiles(x86)") - if(DEFINED "ENV{${programfilesx86}}") - # 64-bit binary. 32-bit program files are in ProgramFiles(x86). - list(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{${programfilesx86}}") - elseif(DEFINED "ENV{SystemDrive}") - # Guess the 32-bit program files location. - if(EXISTS "$ENV{SystemDrive}/Program Files (x86)") - list(APPEND CMAKE_SYSTEM_PREFIX_PATH - "$ENV{SystemDrive}/Program Files (x86)") +endforeach() +if(DEFINED "ENV{SystemDrive}") + foreach(d "Program Files" "Program Files (x86)") + if(EXISTS "$ENV{SystemDrive}/${d}") + list(APPEND _programfiles "$ENV{SystemDrive}/${d}") endif() - endif() + endforeach() endif() +if(_programfiles) + list(REMOVE_DUPLICATES _programfiles) + list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${_programfiles}) +endif() +unset(_programfiles) # Add the CMake install location. get_filename_component(_CMAKE_INSTALL_DIR "${CMAKE_ROOT}" PATH) From 83d633919a75bde05acdf642ff79c5b310fce824 Mon Sep 17 00:00:00 2001 From: Adam Rankin Date: Fri, 15 Jan 2016 12:34:46 -0500 Subject: [PATCH 163/255] ExternalProject: Add option to set `git clone -o` argument Add a `GIT_REMOTE_NAME` option to `ExternalProject_Add` to support git clone --origin Default to `origin` if not specified. --- .../dev/ExternalProject-git-clone-o.rst | 5 ++++ Modules/ExternalProject.cmake | 23 ++++++++++++++----- 2 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 Help/release/dev/ExternalProject-git-clone-o.rst diff --git a/Help/release/dev/ExternalProject-git-clone-o.rst b/Help/release/dev/ExternalProject-git-clone-o.rst new file mode 100644 index 000000000..c9ff3e19d --- /dev/null +++ b/Help/release/dev/ExternalProject-git-clone-o.rst @@ -0,0 +1,5 @@ +ExternalProject-git-clone-o +--------------------------- + +* The :module:`ExternalProject` module learned a new ``GIT_REMOTE_NAME`` + option to control the ``git clone --origin`` value. diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index c822bdb97..5c5c54a79 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -57,6 +57,8 @@ Create custom targets to build projects in external trees URL of git repo ``GIT_TAG `` Git branch name, commit id or tag + ``GIT_REMOTE_NAME `` + The optional name of the remote, default to ``origin`` ``GIT_SUBMODULES ...`` Git submodules that shall be updated, all if empty ``HG_REPOSITORY `` @@ -494,7 +496,7 @@ define_property(DIRECTORY PROPERTY "EP_UPDATE_DISCONNECTED" INHERITED "ExternalProject module." ) -function(_ep_write_gitclone_script script_filename source_dir git_EXECUTABLE git_repository git_tag git_submodules src_name work_dir gitclone_infofile gitclone_stampfile) +function(_ep_write_gitclone_script script_filename source_dir git_EXECUTABLE git_repository git_tag git_remote_name git_submodules src_name work_dir gitclone_infofile gitclone_stampfile) file(WRITE ${script_filename} "if(\"${git_tag}\" STREQUAL \"\") message(FATAL_ERROR \"Tag for git checkout should not be empty.\") @@ -524,7 +526,7 @@ set(error_code 1) set(number_of_tries 0) while(error_code AND number_of_tries LESS 3) execute_process( - COMMAND \"${git_EXECUTABLE}\" clone \"${git_repository}\" \"${src_name}\" + COMMAND \"${git_EXECUTABLE}\" clone --origin \"${git_remote_name}\" \"${git_repository}\" \"${src_name}\" WORKING_DIRECTORY \"${work_dir}\" RESULT_VARIABLE error_code ) @@ -645,7 +647,7 @@ endif() endfunction() -function(_ep_write_gitupdate_script script_filename git_EXECUTABLE git_tag git_submodules git_repository work_dir) +function(_ep_write_gitupdate_script script_filename git_EXECUTABLE git_tag git_remote_name git_submodules git_repository work_dir) if(NOT GIT_VERSION_STRING VERSION_LESS 1.7.6) set(git_stash_save_options --all --quiet) else() @@ -687,7 +689,7 @@ if(\"\${show_ref_output}\" MATCHES \"refs/remotes/${git_tag}\") set(git_remote \"\${CMAKE_MATCH_1}\") set(git_tag \"\${CMAKE_MATCH_2}\") else() - set(git_remote \"origin\") + set(git_remote \"${git_remote_name}\") set(git_tag \"${git_tag}\") endif() @@ -1749,6 +1751,11 @@ function(_ep_add_download_command name) endif() get_property(git_submodules TARGET ${name} PROPERTY _EP_GIT_SUBMODULES) + get_property(git_remote_name TARGET ${name} PROPERTY _EP_GIT_REMOTE_NAME) + if(NOT git_remote_name) + set(git_remote_name "origin") + endif() + # For the download step, and the git clone operation, only the repository # should be recorded in a configured RepositoryInfo file. If the repo # changes, the clone script should be run again. But if only the tag @@ -1772,7 +1779,7 @@ function(_ep_add_download_command name) # The script will delete the source directory and then call git clone. # _ep_write_gitclone_script(${tmp_dir}/${name}-gitclone.cmake ${source_dir} - ${GIT_EXECUTABLE} ${git_repository} ${git_tag} "${git_submodules}" ${src_name} ${work_dir} + ${GIT_EXECUTABLE} ${git_repository} ${git_tag} ${git_remote_name} "${git_submodules}" ${src_name} ${work_dir} ${stamp_dir}/${name}-gitinfo.txt ${stamp_dir}/${name}-gitclone-lastrun.txt ) set(comment "Performing download step (git clone) for '${name}'") @@ -1993,9 +2000,13 @@ function(_ep_add_update_command name) if(NOT git_tag) set(git_tag "master") endif() + get_property(git_remote_name TARGET ${name} PROPERTY _EP_GIT_REMOTE_NAME) + if(NOT git_remote_name) + set(git_remote_name "origin") + endif() get_property(git_submodules TARGET ${name} PROPERTY _EP_GIT_SUBMODULES) _ep_write_gitupdate_script(${tmp_dir}/${name}-gitupdate.cmake - ${GIT_EXECUTABLE} ${git_tag} "${git_submodules}" ${git_repository} ${work_dir} + ${GIT_EXECUTABLE} ${git_tag} ${git_remote_name} "${git_submodules}" ${git_repository} ${work_dir} ) set(cmd ${CMAKE_COMMAND} -P ${tmp_dir}/${name}-gitupdate.cmake) set(always 1) From 3ec9226779776811240bde88a3f173c29aa935b5 Mon Sep 17 00:00:00 2001 From: Lior Goldberg Date: Fri, 25 Dec 2015 15:08:51 +0200 Subject: [PATCH 164/255] install: Do not remove compiler-defined RPATH entries Some compilers may add their own RPATH entries when invoking the linker. For example, a GCC installation may contain the following definition in the specs file: *link_libgcc: %D -rpath <> In this case binaries may contain RPATH entries that CMake did not add. When we update the RPATH on installation we must preserve these entries even if CMake thinks the INSTALL_RPATH value should be empty. Fix this by always using file(RPATH_CHANGE) and teach it to behave as file(RPATH_REMOVE) if the actual RPATH in the file is empty after replacing the build-tree RPATH with the install-tree RPATH. This will preserve any compiler-added RPATH value instead of removing it. --- Source/cmInstallTargetGenerator.cxx | 16 ++++------------ Source/cmSystemTools.cxx | 27 ++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 1158a27d5..5e88fa2c7 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -791,18 +791,10 @@ cmInstallTargetGenerator } // Write a rule to run chrpath to set the install-tree RPATH - if(newRpath.empty()) - { - os << indent << "file(RPATH_REMOVE\n" - << indent << " FILE \"" << toDestDirPath << "\")\n"; - } - else - { - os << indent << "file(RPATH_CHANGE\n" - << indent << " FILE \"" << toDestDirPath << "\"\n" - << indent << " OLD_RPATH \"" << oldRpath << "\"\n" - << indent << " NEW_RPATH \"" << newRpath << "\")\n"; - } + os << indent << "file(RPATH_CHANGE\n" + << indent << " FILE \"" << toDestDirPath << "\"\n" + << indent << " OLD_RPATH \"" << oldRpath << "\"\n" + << indent << " NEW_RPATH \"" << newRpath << "\")\n"; } } diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 008272cbd..a89a6e0b6 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -2565,6 +2565,7 @@ bool cmSystemTools::ChangeRPath(std::string const& file, *changed = false; } int rp_count = 0; + bool remove_rpath = true; cmSystemToolsRPathInfo rp[2]; { // Parse the ELF binary. @@ -2622,6 +2623,7 @@ bool cmSystemTools::ChangeRPath(std::string const& file, // If it contains the new rpath instead then it is okay. if(cmSystemToolsFindRPath(se[i]->Value, newRPath) != std::string::npos) { + remove_rpath = false; continue; } if(emsg) @@ -2642,13 +2644,30 @@ bool cmSystemTools::ChangeRPath(std::string const& file, rp[rp_count].Size = se[i]->Size; rp[rp_count].Name = se_name[i]; + std::string::size_type prefix_len = pos; + + // If oldRPath was at the end of the file's RPath, and newRPath is empty, + // we should remove the unnecessary ':' at the end. + if (newRPath.empty() && + pos > 0 && + se[i]->Value[pos - 1] == ':' && + pos + oldRPath.length() == se[i]->Value.length()) + { + prefix_len--; + } + // Construct the new value which preserves the part of the path // not being changed. - rp[rp_count].Value = se[i]->Value.substr(0, pos); + rp[rp_count].Value = se[i]->Value.substr(0, prefix_len); rp[rp_count].Value += newRPath; rp[rp_count].Value += se[i]->Value.substr(pos+oldRPath.length(), oldRPath.npos); + if (!rp[rp_count].Value.empty()) + { + remove_rpath = false; + } + // Make sure there is enough room to store the new rpath and at // least one null terminator. if(rp[rp_count].Size < rp[rp_count].Value.length()+1) @@ -2673,6 +2692,12 @@ bool cmSystemTools::ChangeRPath(std::string const& file, return true; } + // If the resulting rpath is empty, just remove the entire entry instead. + if (remove_rpath) + { + return cmSystemTools::RemoveRPath(file, emsg, changed); + } + { // Open the file for update. cmsys::ofstream f(file.c_str(), From 6e92f7b2de3d6a25e4e77e274de110a2974c74ca Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Fri, 15 Jan 2016 15:08:45 +0100 Subject: [PATCH 165/255] Help: Document the CMAKE_EXPORT_COMPILE_COMMANDS variable --- Help/manual/cmake-variables.7.rst | 1 + .../CMAKE_EXPORT_COMPILE_COMMANDS.rst | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 Help/variable/CMAKE_EXPORT_COMPILE_COMMANDS.rst diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 3f4957283..15eaece95 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -118,6 +118,7 @@ Variables that Change Behavior /variable/CMAKE_DISABLE_FIND_PACKAGE_PackageName /variable/CMAKE_ERROR_DEPRECATED /variable/CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION + /variable/CMAKE_EXPORT_COMPILE_COMMANDS /variable/CMAKE_EXPORT_NO_PACKAGE_REGISTRY /variable/CMAKE_SYSROOT /variable/CMAKE_FIND_APPBUNDLE diff --git a/Help/variable/CMAKE_EXPORT_COMPILE_COMMANDS.rst b/Help/variable/CMAKE_EXPORT_COMPILE_COMMANDS.rst new file mode 100644 index 000000000..8776279e8 --- /dev/null +++ b/Help/variable/CMAKE_EXPORT_COMPILE_COMMANDS.rst @@ -0,0 +1,30 @@ +CMAKE_EXPORT_COMPILE_COMMANDS +----------------------------- + +Enable/Disable output of compile commands during generation. + +If enabled, generates a ``compile_commands.json`` file containing the exact +compiler calls for all translation units of the project in machine-readable +form. The format of the JSON file looks like: + +.. code-block:: javascript + + [ + { + "directory": "/home/user/development/project", + "command": "/usr/bin/c++ ... -c ../foo/foo.cc", + "file": "../foo/foo.cc" + }, + + ... + + { + "directory": "/home/user/development/project", + "command": "/usr/bin/c++ ... -c ../foo/bar.cc", + "file": "../foo/bar.cc" + } + ] + +.. note:: + This option is implemented only by :ref:`Makefile Generators` + and the :generator:`Ninja`. It is ignored on other generators. From 8979a1070097fde3ca0ab45bdd6580b7acd07ca4 Mon Sep 17 00:00:00 2001 From: Rob Gowin Date: Fri, 15 Jan 2016 11:52:00 -0600 Subject: [PATCH 166/255] FindPkgConfig: Fix restoration of PKG_CONFIG_PATH in environment The original value is saved in `_pkg_config_path_old`. Fix this typo left by commit v3.1.0-rc1~763^2 (FindPkgConfig: Extend PKG_CONFIG_PATH using CMake variables, 2014-03-06). --- Modules/FindPkgConfig.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index eba69532a..f24d2dab0 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -401,7 +401,7 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma if(NOT "${_extra_paths}" STREQUAL "") # Restore the environment variable - set(ENV{PKG_CONFIG_PATH} ${_pkgconfig_path}) + set(ENV{PKG_CONFIG_PATH} ${_pkgconfig_path_old}) endif() unset(_extra_paths) From 66942a764cd7692921080247e184b26d43140e54 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 16 Jan 2016 00:01:07 -0500 Subject: [PATCH 167/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 17ed24809..39c0347ba 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20160115) +set(CMake_VERSION_PATCH 20160116) #set(CMake_VERSION_RC 1) From 27410a9c62f883f3bada885b0ef6cdb343ea40b5 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 17 Jan 2016 00:01:07 -0500 Subject: [PATCH 168/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 39c0347ba..7e895f397 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20160116) +set(CMake_VERSION_PATCH 20160117) #set(CMake_VERSION_RC 1) From 03c0303d2e4bc07b9c5df1ecdbf89da6e36259d9 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 18 Jan 2016 00:01:06 -0500 Subject: [PATCH 169/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 7e895f397..cb13018b2 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20160117) +set(CMake_VERSION_PATCH 20160118) #set(CMake_VERSION_RC 1) From 5079cc1243e3ffaea353c88a97b7d605c0807667 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 19 Jan 2016 00:01:07 -0500 Subject: [PATCH 170/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index cb13018b2..b38f6ebbe 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20160118) +set(CMake_VERSION_PATCH 20160119) #set(CMake_VERSION_RC 1) From 53511936e43c14f362b1e1ba069a77f5ba251ccc Mon Sep 17 00:00:00 2001 From: Rob Gowin Date: Fri, 15 Jan 2016 18:43:53 -0600 Subject: [PATCH 171/255] FindPkgConfig: Quote ${_pkgconfig_path} to protect semicolons on Windows --- Modules/FindPkgConfig.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index f24d2dab0..177e7b8dd 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -238,8 +238,8 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma if(NOT "${_extra_paths}" STREQUAL "") # Save the PKG_CONFIG_PATH environment variable, and add paths # from the CMAKE_PREFIX_PATH variables - set(_pkgconfig_path_old $ENV{PKG_CONFIG_PATH}) - set(_pkgconfig_path ${_pkgconfig_path_old}) + set(_pkgconfig_path_old "$ENV{PKG_CONFIG_PATH}") + set(_pkgconfig_path "${_pkgconfig_path_old}") if(NOT "${_pkgconfig_path}" STREQUAL "") file(TO_CMAKE_PATH "${_pkgconfig_path}" _pkgconfig_path) endif() @@ -285,7 +285,7 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma string(REPLACE ";" ":" _pkgconfig_path "${_pkgconfig_path}") string(REPLACE "\\ " " " _pkgconfig_path "${_pkgconfig_path}") endif() - set(ENV{PKG_CONFIG_PATH} ${_pkgconfig_path}) + set(ENV{PKG_CONFIG_PATH} "${_pkgconfig_path}") endif() # Unset variables @@ -401,7 +401,7 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma if(NOT "${_extra_paths}" STREQUAL "") # Restore the environment variable - set(ENV{PKG_CONFIG_PATH} ${_pkgconfig_path_old}) + set(ENV{PKG_CONFIG_PATH} "${_pkgconfig_path_old}") endif() unset(_extra_paths) From 77cd74a3ea964fa390d85c371902387e9ffc4a92 Mon Sep 17 00:00:00 2001 From: Ashley Whetter Date: Sun, 17 Jan 2016 22:09:30 +0000 Subject: [PATCH 172/255] Print line number of cache parse errors (#11109) Track the line number while parsing `CMakeCache.txt` files and include it in a parse failure error message. --- Source/cmCacheManager.cxx | 10 ++++++++-- Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 5 +++++ Tests/RunCMake/CommandLine/cache-bad-entry-result.txt | 1 + Tests/RunCMake/CommandLine/cache-bad-entry-stderr.txt | 1 + .../CommandLine/cache-bad-entry/CMakeCache.txt | 10 ++++++++++ .../RunCMake/CommandLine/cache-empty-entry-result.txt | 1 + .../RunCMake/CommandLine/cache-empty-entry-stderr.txt | 1 + .../CommandLine/cache-empty-entry/CMakeCache.txt | 7 +++++++ 8 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 Tests/RunCMake/CommandLine/cache-bad-entry-result.txt create mode 100644 Tests/RunCMake/CommandLine/cache-bad-entry-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/cache-bad-entry/CMakeCache.txt create mode 100644 Tests/RunCMake/CommandLine/cache-empty-entry-result.txt create mode 100644 Tests/RunCMake/CommandLine/cache-empty-entry-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/cache-empty-entry/CMakeCache.txt diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index ce8af55db..7466c299a 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -64,12 +64,14 @@ bool cmCacheManager::LoadCache(const std::string& path, const char *realbuffer; std::string buffer; std::string entryKey; + unsigned int lineno = 0; while(fin) { // Format is key:type=value std::string helpString; CacheEntry e; cmSystemTools::GetLineFromStream(fin, buffer); + lineno++; realbuffer = buffer.c_str(); while(*realbuffer != '0' && (*realbuffer == ' ' || @@ -77,6 +79,7 @@ bool cmCacheManager::LoadCache(const std::string& path, *realbuffer == '\r' || *realbuffer == '\n')) { + if (*realbuffer == '\n') lineno++; realbuffer++; } // skip blank lines and comment lines @@ -96,6 +99,7 @@ bool cmCacheManager::LoadCache(const std::string& path, helpString += &realbuffer[2]; } cmSystemTools::GetLineFromStream(fin, buffer); + lineno++; realbuffer = buffer.c_str(); if(!fin) { @@ -138,8 +142,10 @@ bool cmCacheManager::LoadCache(const std::string& path, } else { - cmSystemTools::Error("Parse error in cache file ", cacheFile.c_str(), - ". Offending entry: ", realbuffer); + std::ostringstream error; + error << "Parse error in cache file " << cacheFile; + error << " on line " << lineno << ". Offending entry: " << realbuffer; + cmSystemTools::Error(error.str().c_str()); } } this->CacheMajorVersion = 0; diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index e77ba1f91..8068973a7 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -33,6 +33,11 @@ run_cmake_command(build-bad-dir run_cmake_command(build-bad-generator ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-bad-generator) +run_cmake_command(cache-bad-entry + ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-bad-entry/) +run_cmake_command(cache-empty-entry + ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-empty-entry/) + function(run_BuildDir) # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/BuildDir-build) diff --git a/Tests/RunCMake/CommandLine/cache-bad-entry-result.txt b/Tests/RunCMake/CommandLine/cache-bad-entry-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/cache-bad-entry-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/cache-bad-entry-stderr.txt b/Tests/RunCMake/CommandLine/cache-bad-entry-stderr.txt new file mode 100644 index 000000000..150d2ca88 --- /dev/null +++ b/Tests/RunCMake/CommandLine/cache-bad-entry-stderr.txt @@ -0,0 +1 @@ +^CMake Error: Parse error in cache file .*/Tests/RunCMake/CommandLine/cache-bad-entry/CMakeCache.txt on line 7. Offending entry: BAD ENTRY.* diff --git a/Tests/RunCMake/CommandLine/cache-bad-entry/CMakeCache.txt b/Tests/RunCMake/CommandLine/cache-bad-entry/CMakeCache.txt new file mode 100644 index 000000000..75cd7c2e1 --- /dev/null +++ b/Tests/RunCMake/CommandLine/cache-bad-entry/CMakeCache.txt @@ -0,0 +1,10 @@ +# This is a comment + +// That was an empty line. This isn't. +EMPTY_LINE:BOOL=FALSE + +// Uhoh! Here it comes +BAD ENTRY + +// This is fine +GOOD_ENTRY:BOOL=TRUE diff --git a/Tests/RunCMake/CommandLine/cache-empty-entry-result.txt b/Tests/RunCMake/CommandLine/cache-empty-entry-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/cache-empty-entry-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/cache-empty-entry-stderr.txt b/Tests/RunCMake/CommandLine/cache-empty-entry-stderr.txt new file mode 100644 index 000000000..54f44525f --- /dev/null +++ b/Tests/RunCMake/CommandLine/cache-empty-entry-stderr.txt @@ -0,0 +1 @@ +^CMake Error: Parse error in cache file .*/Tests/RunCMake/CommandLine/cache-empty-entry/CMakeCache.txt on line 5. Offending entry:.* diff --git a/Tests/RunCMake/CommandLine/cache-empty-entry/CMakeCache.txt b/Tests/RunCMake/CommandLine/cache-empty-entry/CMakeCache.txt new file mode 100644 index 000000000..44da1c9c3 --- /dev/null +++ b/Tests/RunCMake/CommandLine/cache-empty-entry/CMakeCache.txt @@ -0,0 +1,7 @@ +// This is valid +VALID:BOOL=TRUE + +// This isn't + +// One final entry +FINAL:BOOL=TRUE From 18c3714f4f4cf35f2b040d887850cb3607345e5d Mon Sep 17 00:00:00 2001 From: Marc Chevrier Date: Tue, 19 Jan 2016 09:52:04 +0100 Subject: [PATCH 173/255] UseJava: Fix create_javah CLASSPATH handling on Windows Preserve semicolons in the value. --- Modules/UseJava.cmake | 4 ++-- Tests/JavaJavah/C.cpp | 10 ++++++++++ Tests/JavaJavah/C.java | 19 +++++++++++++++++++ Tests/JavaJavah/CMakeLists.txt | 9 ++++++--- Tests/JavaJavah/HelloWorld2.java | 5 +++++ 5 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 Tests/JavaJavah/C.cpp create mode 100644 Tests/JavaJavah/C.java diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index 6146d78df..adaba02f2 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -1212,7 +1212,7 @@ function (create_javah) set (_output_files) if (WIN32 AND NOT CYGWIN AND CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") - set(_classpath_sep ";") + set(_classpath_sep "$") else () set(_classpath_sep ":") endif() @@ -1242,7 +1242,7 @@ function (create_javah) endif() endforeach() string (REPLACE ";" "${_classpath_sep}" _classpath "${_classpath}") - list (APPEND _javah_options -classpath ${_classpath}) + list (APPEND _javah_options -classpath "${_classpath}") endif() if (_create_javah_OUTPUT_DIR) diff --git a/Tests/JavaJavah/C.cpp b/Tests/JavaJavah/C.cpp new file mode 100644 index 000000000..ec75f4213 --- /dev/null +++ b/Tests/JavaJavah/C.cpp @@ -0,0 +1,10 @@ + +#include +#include + +#include "C.h" + +JNIEXPORT void JNICALL Java_C_printName(JNIEnv *, jobject) +{ + printf("C\n"); +} diff --git a/Tests/JavaJavah/C.java b/Tests/JavaJavah/C.java new file mode 100644 index 000000000..54b1be205 --- /dev/null +++ b/Tests/JavaJavah/C.java @@ -0,0 +1,19 @@ +class C +{ + public C() + { + } + + public native void printName(); + + static { + try { + + System.loadLibrary("B"); + + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load.\n" + e); + System.exit(1); + } + } +} diff --git a/Tests/JavaJavah/CMakeLists.txt b/Tests/JavaJavah/CMakeLists.txt index 83b0ad06a..071bf20d6 100644 --- a/Tests/JavaJavah/CMakeLists.txt +++ b/Tests/JavaJavah/CMakeLists.txt @@ -9,10 +9,13 @@ include (UseJava) # JNI support find_package(JNI) -add_jar(hello3 B.java HelloWorld2.java) -create_javah(TARGET B_javah CLASSES B CLASSPATH hello3) +add_jar(B1 B.java) +add_jar(C1 C.java) +create_javah(TARGET B_javah CLASSES B C CLASSPATH B1 C1) -add_library(B SHARED B.cpp) +add_jar(hello3 HelloWorld2.java) + +add_library(B SHARED B.cpp C.cpp) add_dependencies(B B_javah) target_include_directories(B PRIVATE ${CMAKE_CURRENT_BINARY_DIR} diff --git a/Tests/JavaJavah/HelloWorld2.java b/Tests/JavaJavah/HelloWorld2.java index faf7277fe..5ff710f95 100644 --- a/Tests/JavaJavah/HelloWorld2.java +++ b/Tests/JavaJavah/HelloWorld2.java @@ -5,6 +5,11 @@ class HelloWorld2 B b; b = new B(); b.printName(); + + C c; + c = new C(); + c.printName(); + System.out.println("Hello World!"); } } From 6506dcaa20a7d17737517dbcba6102be564d8d66 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 19 Jan 2016 10:47:26 -0500 Subject: [PATCH 174/255] CMake 3.4.2 --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 5717d37ba..4b3e7f71a 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 1) +set(CMake_VERSION_PATCH 2) #set(CMake_VERSION_RC 0) From c8daac3556bc4ef7b39e0e632ead55d566e927cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Klitzing?= Date: Tue, 19 Jan 2016 15:05:31 -0500 Subject: [PATCH 175/255] GetPrerequisites: Define api-ms-win-* files as system libraries (#15691) Suggested-by: Gilles Khouzam --- Modules/GetPrerequisites.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index e4018b670..391e7f8fa 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -538,7 +538,7 @@ function(gp_resolved_file_type original_file file exepath dirs type_var) string(TOLOWER "$ENV{windir}" windir) file(TO_CMAKE_PATH "${windir}" windir) - if(lower MATCHES "^(${sysroot}/sys(tem|wow)|${windir}/sys(tem|wow)|(.*/)*msvc[^/]+dll)") + if(lower MATCHES "^(api-ms-win-|${sysroot}/sys(tem|wow)|${windir}/sys(tem|wow)|(.*/)*msvc[^/]+dll)") set(is_system 1) endif() @@ -566,7 +566,7 @@ function(gp_resolved_file_type original_file file exepath dirs type_var) string(TOLOWER "${env_windir}" windir) string(TOLOWER "${env_sysdir}" sysroot) - if(lower MATCHES "^(${sysroot}/sys(tem|wow)|${windir}/sys(tem|wow)|(.*/)*msvc[^/]+dll)") + if(lower MATCHES "^(api-ms-win-|${sysroot}/sys(tem|wow)|${windir}/sys(tem|wow)|(.*/)*msvc[^/]+dll)") set(is_system 1) endif() endif() From fb1526f57fe4720aff596b312e6a767502b86e13 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 14 Jan 2016 14:41:09 -0500 Subject: [PATCH 176/255] cmake: Change `-E chdir` to pass through stdout/stderr directly Use OUTPUT_PASSTHROUGH instead of OUTPUT_NORMAL in order to avoid buffering the output just to re-print it. --- Source/cmcmd.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index fb7b1f5ff..7da81bbd1 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -621,7 +621,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) int retval = 0; int timeout = 0; if ( cmSystemTools::RunSingleCommand(command.c_str(), 0, 0, &retval, - directory.c_str(), cmSystemTools::OUTPUT_NORMAL, timeout) ) + directory.c_str(), cmSystemTools::OUTPUT_PASSTHROUGH, timeout) ) { return retval; } From 92e9bb21758f73266e1f805e366ce90d2cbd688d Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 14 Jan 2016 14:42:11 -0500 Subject: [PATCH 177/255] cmcmd.cxx: Remove unused code in __run_iwyu implementation Do not try to capture stderr with OUTPUT_PASSTHROUGH. RunSingleCommand will never populate it. --- Source/cmcmd.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 7da81bbd1..8dd902bea 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -361,11 +361,10 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) } // Now run the real compiler command and return its result value. - if(!cmSystemTools::RunSingleCommand(orig_cmd, 0, &stdErr, &ret, 0, + if(!cmSystemTools::RunSingleCommand(orig_cmd, 0, 0, &ret, 0, cmSystemTools::OUTPUT_PASSTHROUGH)) { - std::cerr << "Error running '" << orig_cmd[0] << "': " - << stdErr << "\n"; + std::cerr << "Error running '" << orig_cmd[0] << "'\n"; return 1; } return ret; From ffa2a8c967df09c4630e50e7c7339e36b027ecaf Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 14 Jan 2016 14:54:58 -0500 Subject: [PATCH 178/255] cmSystemTools: Rename OUTPUT_NORMAL to OUTPUT_FORWARD to clarify its purpose The OUTPUT_NORMAL value is not really "normal" and has only one caller. Rename it to OUTPUT_FORWARD to clarify that we are explicitly forwarding the output. --- Source/cmGlobalGenerator.cxx | 2 +- Source/cmSystemTools.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 2126c7180..c50bf66ae 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1850,7 +1850,7 @@ int cmGlobalGenerator::Build( !makeCommand.empty() && cmSystemTools::LowerCase( cmSystemTools::GetFilenameName(makeCommand[0])) == "vcexpress.exe") { - outputflag = cmSystemTools::OUTPUT_NORMAL; + outputflag = cmSystemTools::OUTPUT_FORWARD; } // should we do a clean first? diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 9cafbecfd..f511ae43d 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -203,7 +203,7 @@ public: * Output is controlled with outputflag. If outputflag is OUTPUT_NONE, no * user-viewable output from the program being run will be generated. * OUTPUT_MERGE is the legacy behaviour where stdout and stderr are merged - * into stdout. OUTPUT_NORMAL passes through the output to stdout/stderr as + * into stdout. OUTPUT_FORWARD copies the output to stdout/stderr as * it was received. OUTPUT_PASSTHROUGH passes through the original handles. * * If timeout is specified, the command will be terminated after @@ -223,7 +223,7 @@ public: { OUTPUT_NONE = 0, OUTPUT_MERGE, - OUTPUT_NORMAL, + OUTPUT_FORWARD, OUTPUT_PASSTHROUGH }; static bool RunSingleCommand(const char* command, From dc039cc02c857b2c418481533a236dad6a586a7f Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 14 Jan 2016 16:14:25 -0500 Subject: [PATCH 179/255] cmSystemTools: Drop redundant condition in RunSingleCommand The output processing loop is already guarded by a condition so we do not need to repeat the condition inside the loop. --- Source/cmSystemTools.cxx | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index a89a6e0b6..2b0c2ed92 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -696,19 +696,17 @@ bool cmSystemTools::RunSingleCommand(std::vectorconst& command, { while((pipe = cmsysProcess_WaitForData(cp, &data, &length, 0)) > 0) { - if(captureStdOut || captureStdErr || outputflag != OUTPUT_NONE) + // Translate NULL characters in the output into valid text. + // Visual Studio 7 puts these characters in the output of its + // build process. + for(int i=0; i < length; ++i) { - // Translate NULL characters in the output into valid text. - // Visual Studio 7 puts these characters in the output of its - // build process. - for(int i=0; i < length; ++i) + if(data[i] == '\0') { - if(data[i] == '\0') - { - data[i] = ' '; - } + data[i] = ' '; } } + if(pipe == cmsysProcess_Pipe_STDOUT || (pipe == cmsysProcess_Pipe_STDERR && captureStdOut == captureStdErr)) From ce3b713baa1c899ae7739c192040e24445368a0a Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 14 Jan 2016 16:11:00 -0500 Subject: [PATCH 180/255] cmSystemTools: Simplify RunSingleCommand output string construction Assign to the result strings instead setting to empty and appending. The old approach was left from when we directly buffered output in the strings. --- Source/cmSystemTools.cxx | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 2b0c2ed92..3a730b2a0 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -660,14 +660,6 @@ bool cmSystemTools::RunSingleCommand(std::vectorconst& command, argv.push_back(a->c_str()); } argv.push_back(0); - if ( captureStdOut ) - { - *captureStdOut = ""; - } - if (captureStdErr && captureStdErr != captureStdOut) - { - *captureStdErr = ""; - } cmsysProcess* cp = cmsysProcess_New(); cmsysProcess_SetCommand(cp, &*argv.begin()); @@ -745,14 +737,13 @@ bool cmSystemTools::RunSingleCommand(std::vectorconst& command, } cmsysProcess_WaitForExit(cp, 0); - if ( captureStdOut && tempStdOut.begin() != tempStdOut.end()) + if (captureStdOut) { - captureStdOut->append(&*tempStdOut.begin(), tempStdOut.size()); + captureStdOut->assign(tempStdOut.begin(), tempStdOut.end()); } - if ( captureStdErr && captureStdErr != captureStdOut && - tempStdErr.begin() != tempStdErr.end()) + if (captureStdErr && captureStdErr != captureStdOut) { - captureStdErr->append(&*tempStdErr.begin(), tempStdErr.size()); + captureStdErr->assign(tempStdErr.begin(), tempStdErr.end()); } bool result = true; From 1040e690c6c99979f8edf2a121de6d835be96dbe Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 14 Jan 2016 16:11:23 -0500 Subject: [PATCH 181/255] cmSystemTools: Teach RunSingleCommand to merge child pipes when possible Audit the code to make sure there are no callers that use OUTPUT_MERGE with separate capture strings. Then change RunSingleCommand to implement output merging by giving the child process a single pipe for both its stdout and stderr descriptors. This will more cleanly merge the content on atomic write boundaries in the child instead of on arbitrary buffering boundaries in the parent. --- Source/cmSystemTools.cxx | 44 +++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 3a730b2a0..3ba72876c 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -17,6 +17,7 @@ #include #include #include +#include #ifdef __QNX__ # include /* for malloc/free on QNX */ #endif @@ -673,7 +674,16 @@ bool cmSystemTools::RunSingleCommand(std::vectorconst& command, { cmsysProcess_SetPipeShared(cp, cmsysProcess_Pipe_STDOUT, 1); cmsysProcess_SetPipeShared(cp, cmsysProcess_Pipe_STDERR, 1); + captureStdOut = 0; + captureStdErr = 0; } + else if (outputflag == OUTPUT_MERGE || + (captureStdErr && captureStdErr == captureStdOut)) + { + cmsysProcess_SetOption(cp, cmsysProcess_Option_MergeOutput, 1); + captureStdErr = 0; + } + assert(!captureStdErr || captureStdErr != captureStdOut); cmsysProcess_SetTimeout(cp, timeout); cmsysProcess_Execute(cp); @@ -699,40 +709,28 @@ bool cmSystemTools::RunSingleCommand(std::vectorconst& command, } } - if(pipe == cmsysProcess_Pipe_STDOUT || - (pipe == cmsysProcess_Pipe_STDERR && - captureStdOut == captureStdErr)) + if (pipe == cmsysProcess_Pipe_STDOUT) { + if (outputflag != OUTPUT_NONE) + { + cmSystemTools::Stdout(data, length); + } if (captureStdOut) { tempStdOut.insert(tempStdOut.end(), data, data+length); } } - else if(pipe == cmsysProcess_Pipe_STDERR) + else if (pipe == cmsysProcess_Pipe_STDERR) { + if (outputflag != OUTPUT_NONE) + { + cmSystemTools::Stderr(data, length); + } if (captureStdErr) { tempStdErr.insert(tempStdErr.end(), data, data+length); } } - if(outputflag != OUTPUT_NONE) - { - if(outputflag == OUTPUT_MERGE) - { - cmSystemTools::Stdout(data, length); - } - else - { - if(pipe == cmsysProcess_Pipe_STDERR) - { - cmSystemTools::Stderr(data, length); - } - else if(pipe == cmsysProcess_Pipe_STDOUT) - { - cmSystemTools::Stdout(data, length); - } - } - } } } @@ -741,7 +739,7 @@ bool cmSystemTools::RunSingleCommand(std::vectorconst& command, { captureStdOut->assign(tempStdOut.begin(), tempStdOut.end()); } - if (captureStdErr && captureStdErr != captureStdOut) + if (captureStdErr) { captureStdErr->assign(tempStdErr.begin(), tempStdErr.end()); } From a15e375cddb415ebe89aa5896d783b821aca940c Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Tue, 19 Jan 2016 14:01:08 -0700 Subject: [PATCH 182/255] Fix MFC setting on utility targets (#15867) Multi-byte MFC is deprecated, and some projects will not compile if MFC is enabled. --- Source/cmVisualStudio10TargetGenerator.cxx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 27ae68549..09d4a9075 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -762,13 +762,16 @@ void cmVisualStudio10TargetGenerator std::string mfcFlagValue = mfcFlag ? mfcFlag : "0"; std::string useOfMfcValue = "false"; - if(mfcFlagValue == "1") + if(this->GeneratorTarget->GetType() <= cmState::OBJECT_LIBRARY) { - useOfMfcValue = "Static"; - } - else if(mfcFlagValue == "2") - { - useOfMfcValue = "Dynamic"; + if(mfcFlagValue == "1") + { + useOfMfcValue = "Static"; + } + else if(mfcFlagValue == "2") + { + useOfMfcValue = "Dynamic"; + } } std::string mfcLine = ""; mfcLine += useOfMfcValue + "\n"; From 15fe480bf06f5ab5aae5641d2ebe6ca368099450 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 20 Jan 2016 00:01:12 -0500 Subject: [PATCH 183/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index b38f6ebbe..1c3bcf770 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20160119) +set(CMake_VERSION_PATCH 20160120) #set(CMake_VERSION_RC 1) From 5d739a3c843c95aec6c5c8df4d7e87e606c0c8ea Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 19 Jan 2016 16:07:28 -0500 Subject: [PATCH 184/255] ExternalProject: Simplify `cmake --build` configuration passing Check CMAKE_CONFIGURATION_TYPES instead of CMAKE_CFG_INTDIR in order to recognize multi-config generators. Then use $ to pass the configuration value. --- Modules/ExternalProject.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 5c5c54a79..085aa0d6e 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -1230,9 +1230,9 @@ function(_ep_get_build_command name step cmd_var) set(cmd "${CMAKE_COMMAND}") endif() set(args --build ".") - if (CMAKE_CFG_INTDIR AND NOT CMAKE_CFG_INTDIR STREQUAL ".") - list(APPEND args --config "${CMAKE_CFG_INTDIR}") - endif () + if(CMAKE_CONFIGURATION_TYPES) + list(APPEND args --config $) + endif() if(step STREQUAL "INSTALL") list(APPEND args --target install) endif() From ec00e89e83eeb91633affd662870b7a6955dbf5a Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 19 Jan 2016 16:09:29 -0500 Subject: [PATCH 185/255] ExternalProject: Fix TEST_BEFORE_INSTALL for multi-config generators In multi-config generators we must tell `ctest` what configuration to test. Reported-by: Taylor Braun-Jones --- Modules/ExternalProject.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 085aa0d6e..7070dc470 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -1240,6 +1240,9 @@ function(_ep_get_build_command name step cmd_var) if("x${step}x" STREQUAL "xTESTx") string(REGEX REPLACE "^(.*/)cmake([^/]*)$" "\\1ctest\\2" cmd "${cmd}") set(args "") + if(CMAKE_CONFIGURATION_TYPES) + list(APPEND args -C $) + endif() endif() endif() else() From 1787269ef3c476ee1176c92c54e5b22f9cb7f3fe Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 20 Jan 2016 08:45:55 -0500 Subject: [PATCH 186/255] cmake: Fix `-E time` argument passing to child Since this command was introduced in 2002 it has incorrectly constructed the child process command line by concatenating arguments separated by spaces with no quoting. Fix this by passing the command argument vector directly to RunSingleCommand without an intermediate quoting and re-parsing step. Reported-by: Andrey Pokrovskiy --- Help/release/dev/cmake-E-time-quoting.rst | 7 +++++++ Source/cmcmd.cxx | 4 ++-- Tests/RunCMake/CommandLine/E_time-no-arg-result.txt | 1 + Tests/RunCMake/CommandLine/E_time-no-arg-stderr.txt | 3 +++ Tests/RunCMake/CommandLine/E_time-stdout.txt | 3 +++ Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 3 +++ 6 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 Help/release/dev/cmake-E-time-quoting.rst create mode 100644 Tests/RunCMake/CommandLine/E_time-no-arg-result.txt create mode 100644 Tests/RunCMake/CommandLine/E_time-no-arg-stderr.txt create mode 100644 Tests/RunCMake/CommandLine/E_time-stdout.txt diff --git a/Help/release/dev/cmake-E-time-quoting.rst b/Help/release/dev/cmake-E-time-quoting.rst new file mode 100644 index 000000000..23b17c57c --- /dev/null +++ b/Help/release/dev/cmake-E-time-quoting.rst @@ -0,0 +1,7 @@ +cmake-E-time-quoting +-------------------- + +* The :manual:`cmake(1)` ``-E time`` command now properly passes arguments + with spaces or special characters through to the child process. This + may break scripts that worked around the bug with their own extra + quoting or escaping. diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 8dd902bea..1dc304c3a 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -554,7 +554,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) // Clock command else if (args[1] == "time" && args.size() > 2) { - std::string command = cmJoin(cmMakeRange(args).advance(2), " "); + std::vector command(args.begin()+2, args.end()); clock_t clock_start, clock_finish; time_t time_start, time_finish; @@ -562,7 +562,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) time(&time_start); clock_start = clock(); int ret =0; - cmSystemTools::RunSingleCommand(command.c_str(), 0, 0, &ret); + cmSystemTools::RunSingleCommand(command, 0, 0, &ret); clock_finish = clock(); time(&time_finish); diff --git a/Tests/RunCMake/CommandLine/E_time-no-arg-result.txt b/Tests/RunCMake/CommandLine/E_time-no-arg-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_time-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/E_time-no-arg-stderr.txt b/Tests/RunCMake/CommandLine/E_time-no-arg-stderr.txt new file mode 100644 index 000000000..50d9b0332 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_time-no-arg-stderr.txt @@ -0,0 +1,3 @@ +^CMake Error: cmake version .* +Usage: .* -E \[arguments\.\.\.\] +Available commands: diff --git a/Tests/RunCMake/CommandLine/E_time-stdout.txt b/Tests/RunCMake/CommandLine/E_time-stdout.txt new file mode 100644 index 000000000..a51446a67 --- /dev/null +++ b/Tests/RunCMake/CommandLine/E_time-stdout.txt @@ -0,0 +1,3 @@ +^hello world +Elapsed time: [^ +]*$ diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 8068973a7..e3b73ff25 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -12,6 +12,9 @@ run_cmake_command(E_echo_append ${CMAKE_COMMAND} -E echo_append) run_cmake_command(E_rename-no-arg ${CMAKE_COMMAND} -E rename) run_cmake_command(E_touch_nocreate-no-arg ${CMAKE_COMMAND} -E touch_nocreate) +run_cmake_command(E_time ${CMAKE_COMMAND} -E time ${CMAKE_COMMAND} -E echo "hello world") +run_cmake_command(E_time-no-arg ${CMAKE_COMMAND} -E time) + run_cmake_command(E___run_iwyu-no-iwyu ${CMAKE_COMMAND} -E __run_iwyu -- command-does-not-exist) run_cmake_command(E___run_iwyu-bad-iwyu ${CMAKE_COMMAND} -E __run_iwyu --iwyu=iwyu-does-not-exist -- command-does-not-exist) run_cmake_command(E___run_iwyu-no--- ${CMAKE_COMMAND} -E __run_iwyu --iwyu=iwyu-does-not-exist command-does-not-exist) From f9e45ab9d412b08ded8a11ff1f4f0ef90e10358c Mon Sep 17 00:00:00 2001 From: Roger Leigh Date: Tue, 19 Jan 2016 13:32:38 +0000 Subject: [PATCH 187/255] FindXalanC: New module to find the Apache Xalan-C++ library --- Help/manual/cmake-modules.7.rst | 1 + Help/module/FindXalanC.rst | 1 + Help/release/dev/FindXalanC.rst | 5 + Modules/FindXalanC.cmake | 162 +++++++++++++++++++++++++++ Tests/CMakeLists.txt | 4 + Tests/FindXalanC/CMakeLists.txt | 10 ++ Tests/FindXalanC/Test/CMakeLists.txt | 17 +++ Tests/FindXalanC/Test/main.cxx | 10 ++ 8 files changed, 210 insertions(+) create mode 100644 Help/module/FindXalanC.rst create mode 100644 Help/release/dev/FindXalanC.rst create mode 100644 Modules/FindXalanC.cmake create mode 100644 Tests/FindXalanC/CMakeLists.txt create mode 100644 Tests/FindXalanC/Test/CMakeLists.txt create mode 100644 Tests/FindXalanC/Test/main.cxx diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst index c9219d5e2..10f05dffe 100644 --- a/Help/manual/cmake-modules.7.rst +++ b/Help/manual/cmake-modules.7.rst @@ -213,6 +213,7 @@ All Modules /module/FindwxWidgets /module/FindwxWindows /module/FindXCTest + /module/FindXalanC /module/FindXercesC /module/FindX11 /module/FindXMLRPC diff --git a/Help/module/FindXalanC.rst b/Help/module/FindXalanC.rst new file mode 100644 index 000000000..b99d21256 --- /dev/null +++ b/Help/module/FindXalanC.rst @@ -0,0 +1 @@ +.. cmake-module:: ../../Modules/FindXalanC.cmake diff --git a/Help/release/dev/FindXalanC.rst b/Help/release/dev/FindXalanC.rst new file mode 100644 index 000000000..53697740d --- /dev/null +++ b/Help/release/dev/FindXalanC.rst @@ -0,0 +1,5 @@ +FindXalanC +---------- + +* A :module:`FindXalanC` module was introduced to find the + Apache Xalan-C++ XSL transform processing library. diff --git a/Modules/FindXalanC.cmake b/Modules/FindXalanC.cmake new file mode 100644 index 000000000..016b7aabd --- /dev/null +++ b/Modules/FindXalanC.cmake @@ -0,0 +1,162 @@ +#.rst: +# FindXalanC +# ----------- +# +# Find the Apache Xalan-C++ XSL transform processor headers and libraries. +# +# Imported targets +# ^^^^^^^^^^^^^^^^ +# +# This module defines the following :prop_tgt:`IMPORTED` targets: +# +# ``XalanC::XalanC`` +# The Xalan-C++ ``xalan-c`` library, if found. +# +# Result variables +# ^^^^^^^^^^^^^^^^ +# +# This module will set the following variables in your project: +# +# ``XalanC_FOUND`` +# true if the Xalan headers and libraries were found +# ``XalanC_VERSION`` +# Xalan release version +# ``XalanC_INCLUDE_DIRS`` +# the directory containing the Xalan headers; note +# ``XercesC_INCLUDE_DIRS`` is also required +# ``XalanC_LIBRARIES`` +# Xalan libraries to be linked; note ``XercesC_LIBRARIES`` is also +# required +# +# Cache variables +# ^^^^^^^^^^^^^^^ +# +# The following cache variables may also be set: +# +# ``XalanC_INCLUDE_DIR`` +# the directory containing the Xalan headers +# ``XalanC_LIBRARY`` +# the Xalan library + +# Written by Roger Leigh + +#============================================================================= +# Copyright 2016 University of Dundee +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +function(_XalanC_GET_VERSION version_hdr) + file(STRINGS ${version_hdr} _contents REGEX "^[ \t]*#define XALAN_VERSION_.*") + if(_contents) + string(REGEX REPLACE "[^*]*#define XALAN_VERSION_MAJOR[ \t]+([0-9]+).*" "\\1" XalanC_MAJOR "${_contents}") + string(REGEX REPLACE "[^*]*#define XALAN_VERSION_MINOR[ \t]+([0-9]+).*" "\\1" XalanC_MINOR "${_contents}") + string(REGEX REPLACE "[^*]*#define XALAN_VERSION_REVISION[ \t]+([0-9]+).*" "\\1" XalanC_PATCH "${_contents}") + + if(NOT XalanC_MAJOR MATCHES "^[0-9]+$") + message(FATAL_ERROR "Version parsing failed for XALAN_VERSION_MAJOR!") + endif() + if(NOT XalanC_MINOR MATCHES "^[0-9]+$") + message(FATAL_ERROR "Version parsing failed for XALAN_VERSION_MINOR!") + endif() + if(NOT XalanC_PATCH MATCHES "^[0-9]+$") + message(FATAL_ERROR "Version parsing failed for XALAN_VERSION_REVISION!") + endif() + + set(XalanC_VERSION "${XalanC_MAJOR}.${XalanC_MINOR}.${XalanC_PATCH}" PARENT_SCOPE) + set(XalanC_VERSION_MAJOR "${XalanC_MAJOR}" PARENT_SCOPE) + set(XalanC_VERSION_MINOR "${XalanC_MINOR}" PARENT_SCOPE) + set(XalanC_VERSION_PATCH "${XalanC_PATCH}" PARENT_SCOPE) + else() + message(FATAL_ERROR "Include file ${version_hdr} does not exist or does not contain expected version information") + endif() +endfunction() + +# Find include directory +find_path(XalanC_INCLUDE_DIR + NAMES "xalanc/XalanTransformer/XalanTransformer.hpp" + DOC "Xalan-C++ include directory") +mark_as_advanced(XalanC_INCLUDE_DIR) + +if(XalanC_INCLUDE_DIR) + _XalanC_GET_VERSION("${XalanC_INCLUDE_DIR}/xalanc/Include/XalanVersion.hpp") +endif() + +if(NOT XalanC_LIBRARY) + # Find all XalanC libraries + find_library(XalanC_LIBRARY_RELEASE + NAMES "Xalan-C" "xalan-c" + "Xalan-C_${XalanC_VERSION_MAJOR}" + "Xalan-C_${XalanC_VERSION_MAJOR}_${XalanC_VERSION_MINOR}" + DOC "Xalan-C++ libraries (release)") + find_library(XalanC_LIBRARY_DEBUG + NAMES "Xalan-CD" "xalan-cd" + "Xalan-C_${XalanC_VERSION_MAJOR}D" + "Xalan-C_${XalanC_VERSION_MAJOR}_${XalanC_VERSION_MINOR}D" + DOC "Xalan-C++ libraries (debug)") + include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) + select_library_configurations(XalanC) + mark_as_advanced(XalanC_LIBRARY_RELEASE XalanC_LIBRARY_DEBUG) +endif() + +unset(XalanC_VERSION_MAJOR) +unset(XalanC_VERSION_MINOR) +unset(XalanC_VERSION_PATCH) + +unset(XalanC_XERCESC_REQUIRED) +if(XalanC_FIND_REQUIRED) + set(XalanC_XERCESC_REQUIRED REQUIRED) +endif() +find_package(XercesC ${XalanC_XERCESC_REQUIRED}) +unset(XalanC_XERCESC_REQUIRED) + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(XalanC + FOUND_VAR XalanC_FOUND + REQUIRED_VARS XalanC_LIBRARY + XalanC_INCLUDE_DIR + XalanC_VERSION + XercesC_FOUND + VERSION_VAR XalanC_VERSION + FAIL_MESSAGE "Failed to find XalanC") + +if(XalanC_FOUND) + set(XalanC_INCLUDE_DIRS "${XalanC_INCLUDE_DIR}" ${XercesC_INCLUDE_DIRS}) + set(XalanC_LIBRARIES "${XalanC_LIBRARY}" ${XercesC_LIBRARIES}) + + # For header-only libraries + if(NOT TARGET XalanC::XalanC) + add_library(XalanC::XalanC UNKNOWN IMPORTED) + if(XalanC_INCLUDE_DIRS) + set_target_properties(XalanC::XalanC PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${XalanC_INCLUDE_DIRS}") + endif() + if(EXISTS "${XalanC_LIBRARY}") + set_target_properties(XalanC::XalanC PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION "${XalanC_LIBRARY}") + endif() + if(EXISTS "${XalanC_LIBRARY_DEBUG}") + set_property(TARGET XalanC::XalanC APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(XalanC::XalanC PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX" + IMPORTED_LOCATION_DEBUG "${XalanC_LIBRARY_DEBUG}") + endif() + if(EXISTS "${XalanC_LIBRARY_RELEASE}") + set_property(TARGET XalanC::XalanC APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(XalanC::XalanC PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX" + IMPORTED_LOCATION_RELEASE "${XalanC_LIBRARY_RELEASE}") + endif() + set_target_properties(XalanC::XalanC PROPERTIES INTERFACE_LINK_LIBRARIES XercesC::XercesC) + endif() +endif() diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 043b7570b..240144f71 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1379,6 +1379,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_subdirectory(FindTIFF) endif() + if(CMake_TEST_FindXalanC) + add_subdirectory(FindXalanC) + endif() + if(CMake_TEST_FindXercesC) add_subdirectory(FindXercesC) endif() diff --git a/Tests/FindXalanC/CMakeLists.txt b/Tests/FindXalanC/CMakeLists.txt new file mode 100644 index 000000000..787292936 --- /dev/null +++ b/Tests/FindXalanC/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindXalanC.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindXalanC/Test" + "${CMake_BINARY_DIR}/Tests/FindXalanC/Test" + ${build_generator_args} + --build-project TestFindXalanC + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) diff --git a/Tests/FindXalanC/Test/CMakeLists.txt b/Tests/FindXalanC/Test/CMakeLists.txt new file mode 100644 index 000000000..b445e0e10 --- /dev/null +++ b/Tests/FindXalanC/Test/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.1) +project(TestFindXalanC CXX) +include(CTest) + +# CMake does not actually provide FindXalanC publicly. +set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../Source/Modules) + +find_package(XalanC REQUIRED) + +add_executable(test_xalanc_tgt main.cxx) +target_link_libraries(test_xalanc_tgt XalanC::XalanC) +add_test(NAME test_xalanc_tgt COMMAND test_xalanc_tgt) + +add_executable(test_xalanc_var main.cxx) +target_include_directories(test_xalanc_var PRIVATE ${XalanC_INCLUDE_DIRS}) +target_link_libraries(test_xalanc_var PRIVATE ${XalanC_LIBRARIES}) +add_test(NAME test_xalanc_var COMMAND test_xalanc_var) diff --git a/Tests/FindXalanC/Test/main.cxx b/Tests/FindXalanC/Test/main.cxx new file mode 100644 index 000000000..3b4a2df8e --- /dev/null +++ b/Tests/FindXalanC/Test/main.cxx @@ -0,0 +1,10 @@ +#include +#include + +int main() +{ + xercesc::XMLPlatformUtils::Initialize(); + xalanc::XalanTransformer::initialize(); + xalanc::XalanTransformer::terminate(); + xercesc::XMLPlatformUtils::Terminate(); +} From 275f2a85b21d781e237dd22252261a0a62d9879b Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Fri, 15 Jan 2016 14:06:45 +0100 Subject: [PATCH 188/255] Remove temporary allocations when calling cmGeneratorTarget::GetName. This happens quite often from within comparisons such as in NamedGeneratorTargetFinder or FindGeneratorTargetImpl. It is the top hotspot of both, number of allocations as well as number of temporary allocations - the majority of calls lead to temporary allocations. In raw numbers, this patch removes ~1E6 temporary allocations of 1.5E6 temporary allocations in total when running the cmake daemon on the KDevelop build dir. That is 2/3 of the total. This hotspot was found with heaptrack. --- Source/cmGeneratorTarget.cxx | 2 +- Source/cmGeneratorTarget.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index b05fb4191..ff12320bf 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -335,7 +335,7 @@ cmState::TargetType cmGeneratorTarget::GetType() const } //---------------------------------------------------------------------------- -std::string cmGeneratorTarget::GetName() const +const std::string& cmGeneratorTarget::GetName() const { return this->Target->GetName(); } diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index bd2347707..d96a32c55 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -55,7 +55,7 @@ public: GetLinkInformation(const std::string& config) const; cmState::TargetType GetType() const; - std::string GetName() const; + const std::string& GetName() const; std::string GetExportName() const; std::vector GetPropertyKeys() const; From f9599ed42f5bfda35b98936257423f00e260498f Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Fri, 15 Jan 2016 14:17:29 +0100 Subject: [PATCH 189/255] Remove temporary allocations by extending the lifetime of the retval. See also Herb Sutter's article on the "most important const": http://herbsutter.com/2008/01/01/gotw-88-a-candidate-for-the-most-important-const/ When running the CMake daemon on the KDevelop build dir, this removes some hundreds of thousands of temporary allocations. This hotspot was found with heaptrack. --- Source/cmGlobalGenerator.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 2126c7180..b9296c119 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2198,9 +2198,9 @@ cmGlobalGenerator::FindGeneratorTargetImpl(std::string const& name) const { for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) { - std::vector tgts = + const std::vector& tgts = this->LocalGenerators[i]->GetGeneratorTargets(); - for (std::vector::iterator it = tgts.begin(); + for (std::vector::const_iterator it = tgts.begin(); it != tgts.end(); ++it) { if ((*it)->GetName() == name) @@ -2217,9 +2217,9 @@ cmGlobalGenerator::FindImportedTargetImpl(std::string const& name) const { for (unsigned int i = 0; i < this->Makefiles.size(); ++i) { - std::vector tgts = + const std::vector& tgts = this->Makefiles[i]->GetOwnedImportedTargets(); - for (std::vector::iterator it = tgts.begin(); + for (std::vector::const_iterator it = tgts.begin(); it != tgts.end(); ++it) { if ((*it)->GetName() == name && (*it)->IsImportedGloballyVisible()) @@ -2236,9 +2236,9 @@ cmGeneratorTarget* cmGlobalGenerator::FindImportedGeneratorTargetImpl( { for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) { - std::vector tgts = + const std::vector& tgts = this->LocalGenerators[i]->GetImportedGeneratorTargets(); - for (std::vector::iterator it = tgts.begin(); + for (std::vector::const_iterator it = tgts.begin(); it != tgts.end(); ++it) { if ((*it)->IsImportedGloballyVisible() && (*it)->GetName() == name) From ad9394f4fdb69f3f3376d7377fac0a22568aed7c Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Fri, 15 Jan 2016 14:19:33 +0100 Subject: [PATCH 190/255] Remove temporary allocations in cmMacroHelper::InvokeInitialPass. This code used to convert std::string's to raw C strings only to put that back into a std::string. This patch thus removes ~70k temporary allocations when running the CMake daemon on KDevelop. This hotspot was found with heaptrack. --- Source/cmMacroCommand.cxx | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index e4026b084..71de7a723 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -146,16 +146,14 @@ bool cmMacroHelperCommand::InvokeInitialPass // replace formal arguments for (unsigned int j = 0; j < variables.size(); ++j) { - cmSystemTools::ReplaceString(arg.Value, variables[j].c_str(), - expandedArgs[j].c_str()); + cmSystemTools::ReplaceString(arg.Value, variables[j], + expandedArgs[j]); } // replace argc - cmSystemTools::ReplaceString(arg.Value, "${ARGC}",argcDef.c_str()); + cmSystemTools::ReplaceString(arg.Value, "${ARGC}", argcDef); - cmSystemTools::ReplaceString(arg.Value, "${ARGN}", - expandedArgn.c_str()); - cmSystemTools::ReplaceString(arg.Value, "${ARGV}", - expandedArgv.c_str()); + cmSystemTools::ReplaceString(arg.Value, "${ARGN}", expandedArgn); + cmSystemTools::ReplaceString(arg.Value, "${ARGV}", expandedArgv); // if the current argument of the current function has ${ARGV in it // then try replacing ARGV values @@ -163,8 +161,8 @@ bool cmMacroHelperCommand::InvokeInitialPass { for (unsigned int t = 0; t < expandedArgs.size(); ++t) { - cmSystemTools::ReplaceString(arg.Value, argVs[t].c_str(), - expandedArgs[t].c_str()); + cmSystemTools::ReplaceString(arg.Value, argVs[t], + expandedArgs[t]); } } } From bd2384f593d0cf2c894ff781c4e5278fff2ac96c Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Fri, 15 Jan 2016 14:37:25 +0100 Subject: [PATCH 191/255] Optimize cmMakefile::ExpandVariablesInStringNew. We can remove the temporary allocations required for the default-constructed t_lookup passed into the openstack by refactoring the code slightly. Furthermore, we use a vector instead of a stack, since the latter is based on a deque which is not required for a heap / lifo structure. This patch removes ~215k allocations. This hotspot was found with heaptrack. --- Source/cmMakefile.cxx | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 1b0a99ae8..ba0d67234 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2832,10 +2832,9 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew( const char* last = in; std::string result; result.reserve(source.size()); - std::stack openstack; + std::vector openstack; bool error = false; bool done = false; - openstack.push(t_lookup()); cmake::MessageType mtype = cmake::LOG; cmState* state = this->GetCMakeInstance()->GetState(); @@ -2846,10 +2845,10 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew( switch(inc) { case '}': - if(openstack.size() > 1) + if(!openstack.empty()) { - t_lookup var = openstack.top(); - openstack.pop(); + t_lookup var = openstack.back(); + openstack.pop_back(); result.append(last, in - last); std::string const& lookup = result.substr(var.loc); const char* value = NULL; @@ -2970,7 +2969,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew( last = start; in = start - 1; lookup.loc = result.size(); - openstack.push(lookup); + openstack.push_back(lookup); } break; } @@ -2997,7 +2996,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew( result.append("\r"); last = next + 1; } - else if(nextc == ';' && openstack.size() == 1) + else if(nextc == ';' && openstack.empty()) { // Handled in ExpandListArgument; pass the backslash literally. } @@ -3065,7 +3064,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew( /* FALLTHROUGH */ default: { - if(openstack.size() > 1 && + if(!openstack.empty() && !(isalnum(inc) || inc == '_' || inc == '/' || inc == '.' || inc == '+' || inc == '-')) @@ -3074,7 +3073,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew( errorstr += inc; result.append(last, in - last); errorstr += "\') in a variable name: " - "'" + result.substr(openstack.top().loc) + "'"; + "'" + result.substr(openstack.back().loc) + "'"; mtype = cmake::FATAL_ERROR; error = true; } @@ -3085,7 +3084,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew( } while(!error && !done && *++in); // Check for open variable references yet. - if(!error && openstack.size() != 1) + if(!error && !openstack.empty()) { // There's an open variable reference waiting. Policy CMP0010 flags // whether this is an error or not. The new parser now enforces From 70788e92641c4cf4c3f20af607cc6e203203b420 Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Fri, 15 Jan 2016 14:55:22 +0100 Subject: [PATCH 192/255] Remove temporary allocations when calling cmHasLiteral{Suf,Pre}fix. When the first argument passed is a std::string, we need to take it by const&, otherwise we copy the string and trigger a temporary allocation. This patch removes a few 10k temporary allocations when running the CMake daemon on the KDevelop build dir. This hotspot was found with heaptrack. --- Source/cmAlgorithms.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index ef607d212..54617f30f 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -52,13 +52,13 @@ template size_t cmArraySize(const T (&)[N]) { return N; } template -bool cmHasLiteralPrefix(T str1, const char (&str2)[N]) +bool cmHasLiteralPrefix(const T& str1, const char (&str2)[N]) { return cmHasLiteralPrefixImpl(str1, str2, N - 1); } template -bool cmHasLiteralSuffix(T str1, const char (&str2)[N]) +bool cmHasLiteralSuffix(const T& str1, const char (&str2)[N]) { return cmHasLiteralSuffixImpl(str1, str2, N - 1); } From 750ae8d5a8890f5d8091105a0b03bee085cc4dff Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 21 Jan 2016 00:01:04 -0500 Subject: [PATCH 193/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 1c3bcf770..06c5a99d2 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20160120) +set(CMake_VERSION_PATCH 20160121) #set(CMake_VERSION_RC 1) From 40249bccdf9c66453433da3608da9cc89cbee675 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 20 Jan 2016 14:38:05 -0500 Subject: [PATCH 194/255] FindPkgConfig: set standard variables in the cache MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes a regression introduced when the code was simplified to use the variable queries. Fixes #15903. Reported-by: Bernd Lörwald --- Modules/FindPkgConfig.cmake | 3 +++ .../FindPkgConfig_cache_variables.cmake | 16 ++++++++++++++++ Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake | 1 + 3 files changed, 20 insertions(+) create mode 100644 Tests/RunCMake/FindPkgConfig/FindPkgConfig_cache_variables.cmake diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index 177e7b8dd..4f50e3819 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -382,6 +382,9 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma pkg_get_variable("${_pkg_check_prefix}_PREFIX" ${_pkg_check_modules_pkg} "prefix") pkg_get_variable("${_pkg_check_prefix}_INCLUDEDIR" ${_pkg_check_modules_pkg} "includedir") pkg_get_variable("${_pkg_check_prefix}_LIBDIR" ${_pkg_check_modules_pkg} "libdir") + foreach (variable IN ITEMS PREFIX INCLUDEDIR LIBDIR) + _pkgconfig_set("${_pkg_check_modules_pkg}_${variable}" "${${_pkg_check_modules_pkg}_${variable}}") + endforeach () if (NOT ${_is_silent}) message(STATUS " Found ${_pkg_check_modules_pkg}, version ${_pkgconfig_VERSION}") diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_cache_variables.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_cache_variables.cmake new file mode 100644 index 000000000..8d8d00099 --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_cache_variables.cmake @@ -0,0 +1,16 @@ +find_package(PkgConfig REQUIRED) +pkg_check_modules(NCURSES QUIET ncurses) + +if (NCURSES_FOUND) + foreach (variable IN ITEMS PREFIX INCLUDEDIR LIBDIR) + get_property("${variable}" + CACHE "NCURSES_${variable}" + PROPERTY TYPE + SET) + if (NOT ${variable}) + message(FATAL_ERROR "Failed to set cache entry for NCURSES_${variable}") + endif () + endforeach () +else () + message(STATUS "skipping test; ncurses not found") +endif () diff --git a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake index bb04aa29c..24089e0a5 100644 --- a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake @@ -14,4 +14,5 @@ endif() find_package(PkgConfig) if (PKG_CONFIG_FOUND) run_cmake(FindPkgConfig_GET_VARIABLE) + run_cmake(FindPkgConfig_cache_variables) endif () From 7dbfdddf33ab2d52e471c8533897bc2d7aeb40c9 Mon Sep 17 00:00:00 2001 From: Andrey Pokrovskiy Date: Wed, 20 Jan 2016 18:29:58 -0800 Subject: [PATCH 195/255] cmExportInstallFileGenerator: Fix crash in FindNamespaces Refactoring merged by commit 9afbb733ec (Merge topic 'use-generator-target', 2015-10-20) in and around commit 381e7afd (cmExportSet: Store a cmGeneratorTarget, 2015-10-17) forgot to update one place in this method. This leads to a crash in code such as add_library(A a.c) add_library(B b.c) target_link_libraries(B A) install(TARGETS B DESTINATION lib EXPORT ExpB) install(EXPORT ExpB DESTINATION lib/cmake/test) add_executable(C c.c) install(TARGETS C DESTINATION bin EXPORT ExpC) Fix the target name reference to avoid using an unpopulated Target pointer. --- Source/cmExportInstallFileGenerator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index b695904f8..71418e825 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -496,7 +496,7 @@ cmExportInstallFileGenerator bool containsTarget = false; for(unsigned int i=0; isize(); i++) { - if (name == (*targets)[i]->Target->GetName()) + if (name == (*targets)[i]->TargetName) { containsTarget = true; break; From d7e863c1c1f4962f589e53b42a87a66cf5ab00b7 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 21 Jan 2016 11:44:17 -0500 Subject: [PATCH 196/255] VS: Do not fail on Windows 10 with VS 2015 if no SDK is available (#15929) Since commit v3.4.0-rc1~5^2~1 (VS: Add support for selecting the Windows 10 SDK, 2015-09-30) the VS 2015 generator requires a Windows 10 SDK to be available when CMAKE_SYSTEM_VERSION specifies Windows 10 (e.g. when building on a Windows 10 host). Howewver, it is possible to install VS 2015 without any Windows 10 SDK. Instead of failing with an error message about the lack of a Windows 10 SDK, simply tolerate this case and use the default Windows 8.1 SDK. Since building for Windows Store still requires the SDK, retain the diagnostic in that case. --- .../CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION.rst | 3 ++- Source/cmGlobalVisualStudio14Generator.cxx | 9 +++++---- Source/cmGlobalVisualStudio14Generator.h | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Help/variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION.rst b/Help/variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION.rst index 639284963..e0be3a43e 100644 --- a/Help/variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION.rst +++ b/Help/variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION.rst @@ -8,4 +8,5 @@ specification of a target Windows version to select a corresponding SDK. The :variable:`CMAKE_SYSTEM_VERSION` variable may be set to specify a version. Otherwise CMake computes a default version based on the Windows SDK versions available. The chosen Windows target version number is provided -in ``CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION``. +in ``CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION``. If no Windows 10 SDK +is available this value will be empty. diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index 83499f1a6..2f266cd84 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -115,7 +115,7 @@ bool cmGlobalVisualStudio14Generator::InitializeWindows(cmMakefile* mf) { if (cmHasLiteralPrefix(this->SystemVersion, "10.0")) { - return this->SelectWindows10SDK(mf); + return this->SelectWindows10SDK(mf, false); } return true; } @@ -143,17 +143,18 @@ bool cmGlobalVisualStudio14Generator::InitializeWindowsStore(cmMakefile* mf) } if (cmHasLiteralPrefix(this->SystemVersion, "10.0")) { - return this->SelectWindows10SDK(mf); + return this->SelectWindows10SDK(mf, true); } return true; } //---------------------------------------------------------------------------- -bool cmGlobalVisualStudio14Generator::SelectWindows10SDK(cmMakefile* mf) +bool cmGlobalVisualStudio14Generator::SelectWindows10SDK(cmMakefile* mf, + bool required) { // Find the default version of the Windows 10 SDK. this->WindowsTargetPlatformVersion = this->GetWindows10SDKVersion(); - if (this->WindowsTargetPlatformVersion.empty()) + if (required && this->WindowsTargetPlatformVersion.empty()) { std::ostringstream e; e << "Could not find an appropriate version of the Windows 10 SDK" diff --git a/Source/cmGlobalVisualStudio14Generator.h b/Source/cmGlobalVisualStudio14Generator.h index 76c15d99c..57e628418 100644 --- a/Source/cmGlobalVisualStudio14Generator.h +++ b/Source/cmGlobalVisualStudio14Generator.h @@ -39,7 +39,7 @@ protected: bool IsWindowsStoreToolsetInstalled() const; virtual const char* GetIDEVersion() { return "14.0"; } - virtual bool SelectWindows10SDK(cmMakefile* mf); + virtual bool SelectWindows10SDK(cmMakefile* mf, bool required); // Used to verify that the Desktop toolset for the current generator is // installed on the machine. From f98ae28e3dd633126e7897a593f2d15ba68a75d9 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 21 Jan 2016 13:42:46 -0500 Subject: [PATCH 197/255] Tests: Cover fltk_wrap_ui on an executable that links libraries MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CMake 3.4 may crash on this case. The problem seems to have been fixed since then, but keep it working by adding a test case now. Reported-by: Gonzalo Garramuño --- Tests/Wrapping/CMakeLists.txt | 10 ++++++---- Tests/Wrapping/fltk2.fl | 0 Tests/Wrapping/wrapFLTK.c | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 Tests/Wrapping/fltk2.fl create mode 100644 Tests/Wrapping/wrapFLTK.c diff --git a/Tests/Wrapping/CMakeLists.txt b/Tests/Wrapping/CMakeLists.txt index cbb28a1b0..aca36bc31 100644 --- a/Tests/Wrapping/CMakeLists.txt +++ b/Tests/Wrapping/CMakeLists.txt @@ -85,16 +85,18 @@ endif () # Since FLTK_FLUID_EXE is supposed to create a .cxx/.h from a .fl/.fld, # create an empty one so that the dependencies can be met. # -set (FLTK_SRCS - fltk1.fl - ) add_executable(fakefluid fakefluid.cxx) set (FLTK_WRAP_UI "On") set (FLTK_FLUID_EXECUTABLE fakefluid) -fltk_wrap_ui (wraplibFLTK ${FLTK_SRCS}) +fltk_wrap_ui (wraplibFLTK fltk1.fl) add_library(wraplibFLTK ${wraplibFLTK_FLTK_UI_SRCS}) add_dependencies(wraplibFLTK fakefluid) add_dependencies(fakefluid Wrap) +fltk_wrap_ui (wrapFLTK fltk2.fl) +add_executable(wrapFLTK wrapFLTK.c ${wrapFLTK_FLTK_UI_SRCS}) +target_link_libraries(wrapFLTK wraplibFLTK) +add_dependencies(wrapFLTK fakefluid) + # # Mangled Mesa # diff --git a/Tests/Wrapping/fltk2.fl b/Tests/Wrapping/fltk2.fl new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/Wrapping/wrapFLTK.c b/Tests/Wrapping/wrapFLTK.c new file mode 100644 index 000000000..78f2de106 --- /dev/null +++ b/Tests/Wrapping/wrapFLTK.c @@ -0,0 +1 @@ +int main(void) { return 0; } From 9b08c6233052fa1c3d393ee474c874f997491f7b Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Tue, 19 Jan 2016 17:43:05 +0000 Subject: [PATCH 198/255] FindPNG: Create an imported PNG::PNG target (#15911) Imported targets are now the recommended way of dealing with external library dependencies. Add one for FindPNG and update documentation accordingly. Also add a test case activated by CMake_TEST_FindPNG. --- Help/release/dev/FindPNG-imported-targets.rst | 4 ++ Modules/FindPNG.cmake | 50 ++++++++++++++++--- Tests/CMakeLists.txt | 4 ++ Tests/FindPNG/CMakeLists.txt | 10 ++++ Tests/FindPNG/Test/CMakeLists.txt | 16 ++++++ Tests/FindPNG/Test/main.c | 20 ++++++++ 6 files changed, 97 insertions(+), 7 deletions(-) create mode 100644 Help/release/dev/FindPNG-imported-targets.rst create mode 100644 Tests/FindPNG/CMakeLists.txt create mode 100644 Tests/FindPNG/Test/CMakeLists.txt create mode 100644 Tests/FindPNG/Test/main.c diff --git a/Help/release/dev/FindPNG-imported-targets.rst b/Help/release/dev/FindPNG-imported-targets.rst new file mode 100644 index 000000000..e0d0ab16e --- /dev/null +++ b/Help/release/dev/FindPNG-imported-targets.rst @@ -0,0 +1,4 @@ +FindPNG-imported-targets +------------------------ + +* The :module:`FindPNG` module now provides imported targets. diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake index 7cf3f2293..cae41acd9 100644 --- a/Modules/FindPNG.cmake +++ b/Modules/FindPNG.cmake @@ -2,13 +2,20 @@ # FindPNG # ------- # -# Find the native PNG includes and library +# Find libpng, the official reference library for the PNG image format. # +# Imported targets +# ^^^^^^^^^^^^^^^^ # +# This module defines the following :prop_tgt:`IMPORTED` target: # -# This module searches libpng, the library for working with PNG images. +# ``PNG::PNG`` +# The libpng library, if found. # -# It defines the following variables +# Result variables +# ^^^^^^^^^^^^^^^^ +# +# This module will set the following variables in your project: # # ``PNG_INCLUDE_DIRS`` # where to find png.h, etc. @@ -22,19 +29,22 @@ # ``PNG_VERSION_STRING`` # the version of the PNG library found (since CMake 2.8.8) # -# Also defined, but not for general use are +# Obsolete variables +# ^^^^^^^^^^^^^^^^^^ +# +# The following variables may also be set, for backwards compatibility: # # ``PNG_LIBRARY`` # where to find the PNG library. -# -# For backward compatiblity the variable PNG_INCLUDE_DIR is also set. -# It has the same value as PNG_INCLUDE_DIRS. +# ``PNG_INCLUDE_DIR`` +# where to find the PNG headers (same as PNG_INCLUDE_DIRS) # # Since PNG depends on the ZLib compression library, none of the above # will be defined unless ZLib can be found. #============================================================================= # Copyright 2002-2009 Kitware, Inc. +# Copyright 2016 Raumfeld # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -105,6 +115,32 @@ if(ZLIB_FOUND) endif() endif () + if(NOT TARGET PNG::PNG) + add_library(PNG::PNG UNKNOWN IMPORTED) + set_target_properties(PNG::PNG PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "${PNG_DEFINITIONS}" + INTERFACE_INCLUDE_DIRECTORIES "${PNG_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES ZLIB::ZLIB) + if(EXISTS "${PNG_LIBRARY}") + set_target_properties(PNG::PNG PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${PNG_LIBRARY}") + endif() + if(EXISTS "${PNG_LIBRARY_DEBUG}") + set_property(TARGET PNG::PNG APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(PNG::PNG PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C" + IMPORTED_LOCATION_DEBUG "${PNG_LIBRARY_DEBUG}") + endif() + if(EXISTS "${PNG_LIBRARY_RELEASE}") + set_property(TARGET PNG::PNG APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(PNG::PNG PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C" + IMPORTED_LOCATION_RELEASE "${PNG_LIBRARY_RELEASE}") + endif() + endif() endif () if (PNG_PNG_INCLUDE_DIR AND EXISTS "${PNG_PNG_INCLUDE_DIR}/png.h") diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 043b7570b..3cca77bc1 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1375,6 +1375,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_subdirectory(FindOpenSSL) endif() + if(CMake_TEST_FindPNG) + add_subdirectory(FindPNG) + endif() + if(CMake_TEST_FindTIFF) add_subdirectory(FindTIFF) endif() diff --git a/Tests/FindPNG/CMakeLists.txt b/Tests/FindPNG/CMakeLists.txt new file mode 100644 index 000000000..c665b67b2 --- /dev/null +++ b/Tests/FindPNG/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindPNG.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPNG/Test" + "${CMake_BINARY_DIR}/Tests/FindPNG/Test" + ${build_generator_args} + --build-project TestFindPNG + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) diff --git a/Tests/FindPNG/Test/CMakeLists.txt b/Tests/FindPNG/Test/CMakeLists.txt new file mode 100644 index 000000000..ad50011c7 --- /dev/null +++ b/Tests/FindPNG/Test/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.4) +project(TestFindPNG C) +include(CTest) + +find_package(PNG REQUIRED) + +add_definitions(-DCMAKE_EXPECTED_PNG_VERSION="${PNG_VERSION_STRING}") + +add_executable(test_tgt main.c) +target_link_libraries(test_tgt PNG::PNG) +add_test(NAME test_tgt COMMAND test_tgt) + +add_executable(test_var main.c) +target_include_directories(test_var PRIVATE ${PNG_INCLUDE_DIRS}) +target_link_libraries(test_var PRIVATE ${PNG_LIBRARIES}) +add_test(NAME test_var COMMAND test_var) diff --git a/Tests/FindPNG/Test/main.c b/Tests/FindPNG/Test/main.c new file mode 100644 index 000000000..27e14786b --- /dev/null +++ b/Tests/FindPNG/Test/main.c @@ -0,0 +1,20 @@ +#include +#include +#include + +int main() +{ + png_uint_32 png_version; + char png_version_string[16]; + + png_version = png_access_version_number (); + + snprintf (png_version_string, 16, "%i.%i.%i", + png_version / 10000, + (png_version % 10000) / 100, + png_version % 100); + + assert (strcmp(png_version_string, CMAKE_EXPECTED_PNG_VERSION) == 0); + + return 0; +} From f81ccc575331b4e184622b192deac2865931de19 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 22 Jan 2016 00:01:03 -0500 Subject: [PATCH 199/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 06c5a99d2..58d6beebd 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20160121) +set(CMake_VERSION_PATCH 20160122) #set(CMake_VERSION_RC 1) From b94e855d5fbf5cae975034ce5d7836425c8ad87f Mon Sep 17 00:00:00 2001 From: Sergei Nikulov Date: Fri, 22 Jan 2016 10:50:25 +0300 Subject: [PATCH 200/255] FindBoost: Add support for Boost 1.61 --- Modules/FindBoost.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index edfed8e82..c3058eaec 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -707,7 +707,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_TIMER_DEPENDENCIES chrono system) set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION VERSION_LESS 106000 AND Boost_VERSION VERSION_LESS 106100) + elseif(NOT Boost_VERSION VERSION_LESS 106000 AND Boost_VERSION VERSION_LESS 106200) set(_Boost_CHRONO_DEPENDENCIES system) set(_Boost_COROUTINE_DEPENDENCIES context system) set(_Boost_FILESYSTEM_DEPENDENCIES system) @@ -821,7 +821,7 @@ else() # information in _Boost_COMPONENT_DEPENDENCIES. See the # instructions at the top of _Boost_COMPONENT_DEPENDENCIES. set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS} - "1.60.0" "1.60" + "1.61.0" "1.61" "1.60.0" "1.60" "1.59.0" "1.59" "1.58.0" "1.58" "1.57.0" "1.57" "1.56.0" "1.56" "1.55.0" "1.55" "1.54.0" "1.54" "1.53.0" "1.53" "1.52.0" "1.52" "1.51.0" "1.51" "1.50.0" "1.50" "1.49.0" "1.49" "1.48.0" "1.48" "1.47.0" "1.47" "1.46.1" From 4a3fa1e8a09ef1fa674d36c1188bb73aed0de231 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 23 Jan 2016 00:01:04 -0500 Subject: [PATCH 201/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 58d6beebd..72ac6ebba 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20160122) +set(CMake_VERSION_PATCH 20160123) #set(CMake_VERSION_RC 1) From 490483b947fe3fcefc73af3e899b47dcf0eddbde Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 24 Jan 2016 00:01:03 -0500 Subject: [PATCH 202/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 72ac6ebba..6453278e2 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20160123) +set(CMake_VERSION_PATCH 20160124) #set(CMake_VERSION_RC 1) From b9dadca90b2b10a71ffca87a308dcbfef5058f3c Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 25 Jan 2016 00:01:03 -0500 Subject: [PATCH 203/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 6453278e2..87792d123 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20160124) +set(CMake_VERSION_PATCH 20160125) #set(CMake_VERSION_RC 1) From 0aef6f2412177a236deb292654402518777f3cb0 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 25 Jan 2016 09:50:47 -0500 Subject: [PATCH 204/255] CMake 3.4.3 --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 4b3e7f71a..41da4374d 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 2) +set(CMake_VERSION_PATCH 3) #set(CMake_VERSION_RC 0) From e7eab0ec40f19a1fc81920bdd0dcf356a5b362d4 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 26 Jan 2016 00:01:13 -0500 Subject: [PATCH 205/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 87792d123..18f52bf5f 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20160125) +set(CMake_VERSION_PATCH 20160126) #set(CMake_VERSION_RC 1) From 1053db7b0cbe89acfa693fbd76b20992fe9ba023 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 26 Jan 2016 09:27:21 -0500 Subject: [PATCH 206/255] UseJava: Fix documented name of `CLASSDIR` property (#15936) It is not `CLASS_DIR`. --- Modules/UseJava.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index adaba02f2..475ad5ee0 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -184,7 +184,7 @@ # This is used by install_jni_symlink(). # JAR_FILE The location of the jar file so that you can include # it. -# CLASS_DIR The directory where the class files can be found. For +# CLASSDIR The directory where the class files can be found. For # example to use them with javah. # # :: From 30e294f68fb78a4d813fa0f9df668e543e4cf991 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 27 Jan 2016 00:01:03 -0500 Subject: [PATCH 207/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 18f52bf5f..02a3de8be 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20160126) +set(CMake_VERSION_PATCH 20160127) #set(CMake_VERSION_RC 1) From facfb52c9fe36c172c4aa21b40c5886efa28e0ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Gr=C3=BCninger?= Date: Tue, 26 Jan 2016 21:53:16 +0100 Subject: [PATCH 208/255] FindGit: Document Git_FOUND, unset internal var * Git is called Git, not git. * FindGit sets Git_FOUND, too. * Unset internal variable git_names --- Modules/FindGit.cmake | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Modules/FindGit.cmake b/Modules/FindGit.cmake index 2c3e5fd76..363ab879d 100644 --- a/Modules/FindGit.cmake +++ b/Modules/FindGit.cmake @@ -8,21 +8,21 @@ # # :: # -# GIT_EXECUTABLE - path to git command line client -# GIT_FOUND - true if the command line client was found -# GIT_VERSION_STRING - the version of git found (since CMake 2.8.8) +# GIT_EXECUTABLE - path to Git command line client +# Git_FOUND / GIT_FOUND - true if the Git command line client was found +# GIT_VERSION_STRING - the version of Git found # # Example usage: # # :: # # find_package(Git) -# if(GIT_FOUND) -# message("git found: ${GIT_EXECUTABLE}") +# if(Git_FOUND) +# message("Git found: ${GIT_EXECUTABLE}") # endif() #============================================================================= -# Copyright 2010 Kitware, Inc. +# Copyright 2010-2016 Kitware, Inc. # Copyright 2012 Rolf Eike Beer # # Distributed under the OSI-approved BSD License (the "License"); @@ -57,10 +57,11 @@ find_program(GIT_EXECUTABLE NAMES ${git_names} PATHS ${github_path} ${_git_sourcetree_path} PATH_SUFFIXES Git/cmd Git/bin - DOC "git command line client" + DOC "Git command line client" ) mark_as_advanced(GIT_EXECUTABLE) +unset(git_names) unset(_git_sourcetree_path) if(GIT_EXECUTABLE) @@ -74,7 +75,7 @@ if(GIT_EXECUTABLE) unset(git_version) endif() -# Handle the QUIETLY and REQUIRED arguments and set GIT_FOUND to TRUE if +# Handle the QUIETLY and REQUIRED arguments and set Git_FOUND to TRUE if # all listed variables are TRUE include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) From fa78ee97ff30cc066a620cacdfe4144852947dc4 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 27 Jan 2016 09:23:48 -0500 Subject: [PATCH 209/255] FindGit: Improve documentation formatting --- Modules/FindGit.cmake | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Modules/FindGit.cmake b/Modules/FindGit.cmake index 363ab879d..d18f965ee 100644 --- a/Modules/FindGit.cmake +++ b/Modules/FindGit.cmake @@ -2,19 +2,18 @@ # FindGit # ------- # -# -# # The module defines the following variables: # -# :: -# -# GIT_EXECUTABLE - path to Git command line client -# Git_FOUND / GIT_FOUND - true if the Git command line client was found -# GIT_VERSION_STRING - the version of Git found +# ``GIT_EXECUTABLE`` +# Path to Git command-line client. +# ``Git_FOUND``, ``GIT_FOUND`` +# True if the Git command-line client was found. +# ``GIT_VERSION_STRING`` +# The version of Git found. # # Example usage: # -# :: +# .. code-block:: cmake # # find_package(Git) # if(Git_FOUND) From 5335d275527d4f58e4f2992d307c1c62cd94dd3c Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 28 Jan 2016 00:01:04 -0500 Subject: [PATCH 210/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 02a3de8be..d6becbc1b 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20160127) +set(CMake_VERSION_PATCH 20160128) #set(CMake_VERSION_RC 1) From 88968265e24bc294b4055d7db8a1f9ffbaf73698 Mon Sep 17 00:00:00 2001 From: Bartosz Kosiorek Date: Thu, 28 Jan 2016 10:52:15 +0100 Subject: [PATCH 211/255] Help: Improve markup in `get_target_property` documentation --- Help/command/get_target_property.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Help/command/get_target_property.rst b/Help/command/get_target_property.rst index 779825299..2a72c3af7 100644 --- a/Help/command/get_target_property.rst +++ b/Help/command/get_target_property.rst @@ -13,6 +13,6 @@ the variable ``VAR``. If the property is not found, ``VAR`` will be set to Properties are usually used to control how a target is built, but some query the target instead. This command can get properties for any target so far created. The targets do not need to be in the current -CMakeLists.txt file. +``CMakeLists.txt`` file. See also the more general :command:`get_property` command. From a336e438e2dc45ffffcd656cfc81507f94e0cec5 Mon Sep 17 00:00:00 2001 From: Bartosz Kosiorek Date: Thu, 28 Jan 2016 10:52:15 +0100 Subject: [PATCH 212/255] Help: Improve markup in `if` command documentation --- Help/command/if.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Help/command/if.rst b/Help/command/if.rst index 2465bde38..9548d0bff 100644 --- a/Help/command/if.rst +++ b/Help/command/if.rst @@ -80,7 +80,7 @@ Possible expressions are: only for full paths. ``if(file1 IS_NEWER_THAN file2)`` - True if file1 is newer than file2 or if one of the two files doesn't + True if ``file1`` is newer than ``file2`` or if one of the two files doesn't exist. Behavior is well-defined only for full paths. If the file time stamps are exactly the same, an ``IS_NEWER_THAN`` comparison returns true, so that any dependent build operations will occur in the event From 63c5808f9328797ef225c0d81d60b0fa39ac7d3b Mon Sep 17 00:00:00 2001 From: Bartosz Kosiorek Date: Thu, 28 Jan 2016 10:52:15 +0100 Subject: [PATCH 213/255] Help: Clarify scope of `if(TARGET)` expression --- Help/command/if.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Help/command/if.rst b/Help/command/if.rst index 9548d0bff..56e618c31 100644 --- a/Help/command/if.rst +++ b/Help/command/if.rst @@ -67,9 +67,10 @@ Possible expressions are: True if the given name is an existing policy (of the form ``CMP``). ``if(TARGET target-name)`` - True if the given name is an existing logical target name such as those - created by the :command:`add_executable`, :command:`add_library`, or - :command:`add_custom_target` commands. + True if the given name is an existing logical target name created + by a call to the :command:`add_executable`, :command:`add_library`, + or :command:`add_custom_target` command that has already been invoked + (in any directory). ``if(TEST test-name)`` True if the given name is an existing test name created by the From 8c615af4dfaaec38dfb7f42ec951485644c2e24b Mon Sep 17 00:00:00 2001 From: Bartosz Kosiorek Date: Thu, 28 Jan 2016 10:52:15 +0100 Subject: [PATCH 214/255] Help: Clarify policy `CMP0040` documentation (#15681) State explicitly that the target must be defined in the current directory. While at it, improve markup formatting. --- Help/policy/CMP0040.rst | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Help/policy/CMP0040.rst b/Help/policy/CMP0040.rst index e746c0316..d46baf647 100644 --- a/Help/policy/CMP0040.rst +++ b/Help/policy/CMP0040.rst @@ -1,18 +1,21 @@ CMP0040 ------- -The target in the TARGET signature of add_custom_command() must exist. +The target in the ``TARGET`` signature of :command:`add_custom_command` +must exist and must be defined in current directory. CMake 2.8.12 and lower silently ignored a custom command created with -the TARGET signature of :command:`add_custom_command` -if the target is unknown. +the ``TARGET`` signature of :command:`add_custom_command` +if the target is unknown or was defined outside the current directory. -The OLD behavior for this policy is to ignore custom commands -for unknown targets. The NEW behavior for this policy is to report an error -if the target referenced in :command:`add_custom_command` is unknown. +The ``OLD`` behavior for this policy is to ignore custom commands +for unknown targets. The ``NEW`` behavior for this policy is to report +an error if the target referenced in :command:`add_custom_command` is +unknown or was defined outside the current directory. This policy was introduced in CMake version 3.0. CMake version -|release| warns when the policy is not set and uses OLD behavior. Use -the cmake_policy command to set it to OLD or NEW explicitly. +|release| warns when the policy is not set and uses ``OLD`` behavior. +Use the :command:`cmake_policy` command to set it to ``OLD`` or +``NEW`` explicitly. .. include:: DEPRECATED.txt From 4d53e0a75e3ccddf14f556e88302573f14aa8830 Mon Sep 17 00:00:00 2001 From: Bartosz Kosiorek Date: Thu, 28 Jan 2016 10:52:15 +0100 Subject: [PATCH 215/255] Help: Clarify `add_custom_command(TARGET)` scope (#15681) --- Help/command/add_custom_command.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Help/command/add_custom_command.rst b/Help/command/add_custom_command.rst index ecbf9ddc3..8726b709e 100644 --- a/Help/command/add_custom_command.rst +++ b/Help/command/add_custom_command.rst @@ -178,7 +178,7 @@ target is already built, the command will not execute. :: - add_custom_command(TARGET target + add_custom_command(TARGET PRE_BUILD | PRE_LINK | POST_BUILD COMMAND command1 [ARGS] [args1...] [COMMAND command2 [ARGS] [args2...] ...] @@ -188,7 +188,10 @@ target is already built, the command will not execute. [VERBATIM] [USES_TERMINAL]) This defines a new command that will be associated with building the -specified target. When the command will happen is determined by which +specified ````. The ```` must be defined in the current +directory; targets defined in other directories may not be specified. + +When the command will happen is determined by which of the following is specified: ``PRE_BUILD`` From d257d68138a00758910bbca3dd77dcfcc04e65cc Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 28 Jan 2016 10:12:26 -0500 Subject: [PATCH 216/255] add_custom_command: Clarify error when TARGET is out of scope (#15681) The add_custom_command(TARGET) signature only works for targets defined in the current directory. Clarify this in the error message when the target exists but was defined elsewhere. Inspired-by: Bartosz Kosiorek --- Source/cmMakefile.cxx | 19 ++++++++++++++++++- .../CMP0040-NEW-missing-target-stderr.txt | 2 +- .../CMP0040-WARN-missing-target-stderr.txt | 2 +- .../add_custom_command/RunCMakeTest.cmake | 2 ++ .../TargetImported-result.txt | 1 + .../TargetImported-stderr.txt | 4 ++++ .../add_custom_command/TargetImported.cmake | 2 ++ .../TargetNotInDir-result.txt | 1 + .../TargetNotInDir-stderr.txt | 4 ++++ .../add_custom_command/TargetNotInDir.cmake | 2 ++ .../TargetNotInDir/CMakeLists.txt | 1 + 11 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 Tests/RunCMake/add_custom_command/TargetImported-result.txt create mode 100644 Tests/RunCMake/add_custom_command/TargetImported-stderr.txt create mode 100644 Tests/RunCMake/add_custom_command/TargetImported.cmake create mode 100644 Tests/RunCMake/add_custom_command/TargetNotInDir-result.txt create mode 100644 Tests/RunCMake/add_custom_command/TargetNotInDir-stderr.txt create mode 100644 Tests/RunCMake/add_custom_command/TargetNotInDir.cmake create mode 100644 Tests/RunCMake/add_custom_command/TargetNotInDir/CMakeLists.txt diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ba0d67234..cba29eb04 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -791,7 +791,24 @@ cmMakefile::AddCustomCommandToTarget(const std::string& target, if(issueMessage) { - e << "The target name \"" << target << "\" is unknown in this context."; + if (cmTarget const* t = this->FindTargetToUse(target)) + { + if (t->IsImported()) + { + e << "TARGET '" << target + << "' is IMPORTED and does not build here."; + } + else + { + e << "TARGET '" << target + << "' was not created in this directory."; + } + } + else + { + e << "No TARGET '" << target + << "' has been created in this directory."; + } IssueMessage(messageType, e.str()); } diff --git a/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target-stderr.txt b/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target-stderr.txt index 3f82d8c3d..4a1077c7d 100644 --- a/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target-stderr.txt +++ b/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target-stderr.txt @@ -1,4 +1,4 @@ CMake Error at CMP0040-NEW-missing-target.cmake:3 \(add_custom_command\): - The target name "foobar" is unknown in this context. + No TARGET 'foobar' has been created in this directory. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-stderr.txt b/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-stderr.txt index e791f0a72..e3e3ff468 100644 --- a/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-stderr.txt +++ b/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-stderr.txt @@ -4,7 +4,7 @@ CMake Warning \(dev\) at CMP0040-WARN-missing-target.cmake:2 \(add_custom_comman policy details. Use the cmake_policy command to set the policy and suppress this warning. + - The target name "foobar" is unknown in this context. + No TARGET 'foobar' has been created in this directory. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake index 2f5c938af..397c63d0a 100644 --- a/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake +++ b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake @@ -8,3 +8,5 @@ run_cmake(NoOutputOrTarget) run_cmake(OutputAndTarget) run_cmake(SourceByproducts) run_cmake(SourceUsesTerminal) +run_cmake(TargetImported) +run_cmake(TargetNotInDir) diff --git a/Tests/RunCMake/add_custom_command/TargetImported-result.txt b/Tests/RunCMake/add_custom_command/TargetImported-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/TargetImported-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_custom_command/TargetImported-stderr.txt b/Tests/RunCMake/add_custom_command/TargetImported-stderr.txt new file mode 100644 index 000000000..44c4ad886 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/TargetImported-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TargetImported.cmake:2 \(add_custom_command\): + TARGET 'TargetImported' is IMPORTED and does not build here. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/add_custom_command/TargetImported.cmake b/Tests/RunCMake/add_custom_command/TargetImported.cmake new file mode 100644 index 000000000..c0f2d66a0 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/TargetImported.cmake @@ -0,0 +1,2 @@ +add_library(TargetImported UNKNOWN IMPORTED) +add_custom_command(TARGET TargetImported COMMAND ${CMAKE_COMMAND} -E echo tada) diff --git a/Tests/RunCMake/add_custom_command/TargetNotInDir-result.txt b/Tests/RunCMake/add_custom_command/TargetNotInDir-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/TargetNotInDir-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_custom_command/TargetNotInDir-stderr.txt b/Tests/RunCMake/add_custom_command/TargetNotInDir-stderr.txt new file mode 100644 index 000000000..91876a0a0 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/TargetNotInDir-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at TargetNotInDir.cmake:2 \(add_custom_command\): + TARGET 'TargetNotInDir' was not created in this directory. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/add_custom_command/TargetNotInDir.cmake b/Tests/RunCMake/add_custom_command/TargetNotInDir.cmake new file mode 100644 index 000000000..a5510262a --- /dev/null +++ b/Tests/RunCMake/add_custom_command/TargetNotInDir.cmake @@ -0,0 +1,2 @@ +add_subdirectory(TargetNotInDir) +add_custom_command(TARGET TargetNotInDir COMMAND ${CMAKE_COMMAND} -E echo tada) diff --git a/Tests/RunCMake/add_custom_command/TargetNotInDir/CMakeLists.txt b/Tests/RunCMake/add_custom_command/TargetNotInDir/CMakeLists.txt new file mode 100644 index 000000000..3d51d27b3 --- /dev/null +++ b/Tests/RunCMake/add_custom_command/TargetNotInDir/CMakeLists.txt @@ -0,0 +1 @@ +add_custom_target(TargetNotInDir) From 76a51dfab8b0ebeadb377862758fdddd555cb10c Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 29 Jan 2016 00:01:04 -0500 Subject: [PATCH 217/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index d6becbc1b..7d0d5c1fb 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20160128) +set(CMake_VERSION_PATCH 20160129) #set(CMake_VERSION_RC 1) From f270404a3d3cb11a9c57253e5f2a0a45f1595231 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 30 Jan 2016 00:01:03 -0500 Subject: [PATCH 218/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 7d0d5c1fb..c3f1b6200 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20160129) +set(CMake_VERSION_PATCH 20160130) #set(CMake_VERSION_RC 1) From 13b4ef24e1abd69b4fd8eec55772670a85bd5aa8 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 31 Jan 2016 00:01:03 -0500 Subject: [PATCH 219/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index c3f1b6200..7e713e45f 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20160130) +set(CMake_VERSION_PATCH 20160131) #set(CMake_VERSION_RC 1) From e18d0df5ed7170b9cc4eafa9f73c6605cc9b4107 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 1 Feb 2016 00:01:03 -0500 Subject: [PATCH 220/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 7e713e45f..e14724738 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20160131) +set(CMake_VERSION_PATCH 20160201) #set(CMake_VERSION_RC 1) From 6ffc4323670f3671f262b3e9f035f1ea3f714986 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 1 Feb 2016 09:49:08 -0500 Subject: [PATCH 221/255] cmConditionEvaluator: Fix matching of `CMAKE_MATCH_*` values (#15944) While evaluating `if(MATCHES)` we get a `const char*` pointer to the string to be matched. On code like if(CMAKE_MATCH_COUNT MATCHES "Y") the string to be matched may be owned by our own result variables. We must move the value to our own buffer before clearing them. Otherwise we risk reading freed storage. --- Source/cmConditionEvaluator.cxx | 10 ++++++++++ Tests/RunCMake/if/MatchesSelf.cmake | 4 ++++ Tests/RunCMake/if/RunCMakeTest.cmake | 2 ++ 3 files changed, 16 insertions(+) create mode 100644 Tests/RunCMake/if/MatchesSelf.cmake diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx index 5330acdaf..6a0ebec2d 100644 --- a/Source/cmConditionEvaluator.cxx +++ b/Source/cmConditionEvaluator.cxx @@ -12,6 +12,7 @@ #include "cmConditionEvaluator.h" #include "cmOutputConverter.h" +#include "cmAlgorithms.h" cmConditionEvaluator::cmConditionEvaluator(cmMakefile& makefile, const cmListFileContext &context, @@ -578,6 +579,7 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList &newArgs, cmake::MessageType &status) { int reducible; + std::string def_buf; const char *def; const char *def2; do @@ -594,6 +596,14 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList &newArgs, IsKeyword("MATCHES", *argP1)) { def = this->GetVariableOrString(*arg); + if (def != arg->c_str() // yes, we compare the pointer value + && cmHasLiteralPrefix(arg->GetValue(), "CMAKE_MATCH_")) + { + // The string to match is owned by our match result variables. + // Move it to our own buffer before clearing them. + def_buf = def; + def = def_buf.c_str(); + } const char* rex = argP2->c_str(); this->Makefile.ClearMatches(); cmsys::RegularExpression regEntry; diff --git a/Tests/RunCMake/if/MatchesSelf.cmake b/Tests/RunCMake/if/MatchesSelf.cmake new file mode 100644 index 000000000..3131ac4f4 --- /dev/null +++ b/Tests/RunCMake/if/MatchesSelf.cmake @@ -0,0 +1,4 @@ +foreach(n 0 1 2 3 4 5 6 7 8 9 COUNT) + if(CMAKE_MATCH_${n} MATCHES "x") + endif() +endforeach() diff --git a/Tests/RunCMake/if/RunCMakeTest.cmake b/Tests/RunCMake/if/RunCMakeTest.cmake index 3f4d2a24d..077d00a05 100644 --- a/Tests/RunCMake/if/RunCMakeTest.cmake +++ b/Tests/RunCMake/if/RunCMakeTest.cmake @@ -5,5 +5,7 @@ run_cmake(IsDirectory) run_cmake(IsDirectoryLong) run_cmake(elseif-message) +run_cmake(MatchesSelf) + run_cmake(TestNameThatExists) run_cmake(TestNameThatDoesNotExist) From 6f83db1cc10beca21b088bfe8d623f6256eb3d0b Mon Sep 17 00:00:00 2001 From: Prayag Verma Date: Mon, 1 Feb 2016 00:33:56 +0530 Subject: [PATCH 222/255] Help: Fix typo in `cmake-developer(7)` manual Fix spelling mistake `sytem` => `system`. --- Help/manual/cmake-developer.7.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Help/manual/cmake-developer.7.rst b/Help/manual/cmake-developer.7.rst index a33538404..7bfdcadcb 100644 --- a/Help/manual/cmake-developer.7.rst +++ b/Help/manual/cmake-developer.7.rst @@ -718,7 +718,7 @@ same consideration applies to macros, functions and imported targets. If False, do not try to use the relevant CMake wrapping command. ``Xxx_Yy_FOUND`` - If False, optional Yy part of Xxx sytem is not available. + If False, optional Yy part of Xxx system is not available. ``Xxx_FOUND`` Set to false, or undefined, if we haven't found, or don't want to use From ccb2d5c07f32fb6bd96128527a36a00868e905fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Gr=C3=BCninger?= Date: Fri, 29 Jan 2016 22:16:03 +0100 Subject: [PATCH 223/255] cmAlgorithms.h: remove superfluous semicolon after method --- Source/cmAlgorithms.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 54617f30f..bb65ea556 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -230,7 +230,7 @@ template std::string cmJoin(Range const& r, std::string delimiter) { return cmJoin(r, delimiter.c_str()); -}; +} template typename Range::const_iterator cmRemoveN(Range& r, size_t n) From 377a12b2d239c531b324d31759aa05450ee8d622 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 1 Feb 2016 12:47:27 -0500 Subject: [PATCH 224/255] Help: Consolidate 3.5 release notes Move all development release notes into a new version-specific document: tail -q -n +3 Help/release/dev/* > Help/release/3.5.rst git rm -- Help/release/dev/* except the sample topic: git checkout HEAD -- Help/release/dev/0-sample-topic.rst Reference the new document from the release notes index document. Add a title and intro sentence to the new document by hand. --- Help/release/3.5.rst | 153 ++++++++++++++++++ .../dev/CMakeParseArguments-native-impl.rst | 6 - .../dev/ExternalProject-git-clone-o.rst | 5 - .../dev/FindBoost-imported-targets.rst | 5 - Help/release/dev/FindFLEX-DEFINES_FILE.rst | 6 - Help/release/dev/FindGTK2_GTK2_TARGETS.rst | 7 - Help/release/dev/FindGTK2_sigc++_c++11.rst | 7 - .../dev/FindGTest-imported-targets.rst | 4 - Help/release/dev/FindOpenMP-clang.rst | 4 - .../dev/FindOpenSSL-msvc-static-rt.rst | 6 - Help/release/dev/FindPNG-imported-targets.rst | 4 - .../release/dev/FindTIFF-imported-targets.rst | 4 - Help/release/dev/FindXalanC.rst | 5 - .../dev/FindXercesC-imported-targets.rst | 4 - Help/release/dev/add-armcc-toolchain.rst | 4 - Help/release/dev/add-cray-linux-platform.rst | 7 - .../dev/better-looking-mac-packages.rst | 8 - Help/release/dev/cmake-E-multiple-inputs.rst | 11 -- Help/release/dev/cmake-E-time-quoting.rst | 7 - Help/release/dev/cmake-W-options.rst | 22 --- Help/release/dev/cmake-gui-select-toolset.rst | 6 - .../cpack-deb-config-file-source-field.rst | 6 - .../dev/cpack-deb-new-component-vars.rst | 7 - .../dev/cpack-dmg-multilanguage-sla.rst | 7 - Help/release/dev/cpack-nsis-bitmap.rst | 6 - .../cpack-rpm-percomponent-group-and-name.rst | 7 - .../dev/deprecate-CMakeForceCompiler.rst | 5 - Help/release/dev/install-DIRECTORY-genex.rst | 6 - Help/release/dev/ios-universal.rst | 7 - .../dev/mingw-clang-compile-features.rst | 5 - Help/release/dev/regex-explorer.rst | 6 - Help/release/dev/release-windows.rst | 7 - Help/release/dev/vs-debug-fastlink.rst | 5 - Help/release/dev/vs-global-properties.rst | 5 - Help/release/index.rst | 1 + 35 files changed, 154 insertions(+), 211 deletions(-) create mode 100644 Help/release/3.5.rst delete mode 100644 Help/release/dev/CMakeParseArguments-native-impl.rst delete mode 100644 Help/release/dev/ExternalProject-git-clone-o.rst delete mode 100644 Help/release/dev/FindBoost-imported-targets.rst delete mode 100644 Help/release/dev/FindFLEX-DEFINES_FILE.rst delete mode 100644 Help/release/dev/FindGTK2_GTK2_TARGETS.rst delete mode 100644 Help/release/dev/FindGTK2_sigc++_c++11.rst delete mode 100644 Help/release/dev/FindGTest-imported-targets.rst delete mode 100644 Help/release/dev/FindOpenMP-clang.rst delete mode 100644 Help/release/dev/FindOpenSSL-msvc-static-rt.rst delete mode 100644 Help/release/dev/FindPNG-imported-targets.rst delete mode 100644 Help/release/dev/FindTIFF-imported-targets.rst delete mode 100644 Help/release/dev/FindXalanC.rst delete mode 100644 Help/release/dev/FindXercesC-imported-targets.rst delete mode 100644 Help/release/dev/add-armcc-toolchain.rst delete mode 100644 Help/release/dev/add-cray-linux-platform.rst delete mode 100644 Help/release/dev/better-looking-mac-packages.rst delete mode 100644 Help/release/dev/cmake-E-multiple-inputs.rst delete mode 100644 Help/release/dev/cmake-E-time-quoting.rst delete mode 100644 Help/release/dev/cmake-W-options.rst delete mode 100644 Help/release/dev/cmake-gui-select-toolset.rst delete mode 100644 Help/release/dev/cpack-deb-config-file-source-field.rst delete mode 100644 Help/release/dev/cpack-deb-new-component-vars.rst delete mode 100644 Help/release/dev/cpack-dmg-multilanguage-sla.rst delete mode 100644 Help/release/dev/cpack-nsis-bitmap.rst delete mode 100644 Help/release/dev/cpack-rpm-percomponent-group-and-name.rst delete mode 100644 Help/release/dev/deprecate-CMakeForceCompiler.rst delete mode 100644 Help/release/dev/install-DIRECTORY-genex.rst delete mode 100644 Help/release/dev/ios-universal.rst delete mode 100644 Help/release/dev/mingw-clang-compile-features.rst delete mode 100644 Help/release/dev/regex-explorer.rst delete mode 100644 Help/release/dev/release-windows.rst delete mode 100644 Help/release/dev/vs-debug-fastlink.rst delete mode 100644 Help/release/dev/vs-global-properties.rst diff --git a/Help/release/3.5.rst b/Help/release/3.5.rst new file mode 100644 index 000000000..3b466788f --- /dev/null +++ b/Help/release/3.5.rst @@ -0,0 +1,153 @@ +CMake 3.5 Release Notes +*********************** + +.. only:: html + + .. contents:: + +Changes made since CMake 3.4 include the following. + +* Support was added for the ARM Compiler (arm.com) with compiler id ``ARMCC``. + +* A new platform file for cross-compiling in the Cray Linux Environment to + target compute nodes was added. See + :ref:`Cross Compiling for the Cray Linux Environment ` + for usage details. + +* The :module:`CPackDMG` module learned new variable to specify AppleScript + file run to customize appearance of ``DragNDrop`` installer folder, + including background image setting using supplied PNG or multi-resolution + TIFF file. See the :variable:`CPACK_DMG_DS_STORE_SETUP_SCRIPT` and + :variable:`CPACK_DMG_BACKGROUND_IMAGE` variables. + +* The :manual:`cmake(1)` ``-E copy`` and ``-E copy_if_different`` command-line + tools learned to support copying multiple input files to a directory. + +* The :manual:`cmake(1)` ``-E copy_directory`` command-line + tool learned to support copying multiple input directories to a directory. + +* The :manual:`cmake(1)` ``-E make_directory`` command-line + tool learned to support copying multiple input directories to a directory. + +* The :manual:`cmake(1)` ``-E time`` command now properly passes arguments + with spaces or special characters through to the child process. This + may break scripts that worked around the bug with their own extra + quoting or escaping. + +* The :manual:`cmake-gui(1)` learned an option to set the toolset + to be used with VS IDE and Xcode generators, much like the + existing ``-T`` option to :manual:`cmake(1)`. + +* The :command:`cmake_parse_arguments` command is now implemented natively. + The :module:`CMakeParseArguments` module remains as an empty placeholder + for compatibility. + +* The :variable:`CMAKE_WARN_DEPRECATED` variable can now be set using the + ``-Wdeprecated`` and ``-Wno-deprecated`` :manual:`cmake(1)` options. + +* The ``-Wdev`` and ``-Wno-dev`` :manual:`cmake(1)` options now also enable + and suppress the deprecated warnings output by default. + +* Warnings about deprecated functionality are now enabled by default. + They may be suppressed with ``-Wno-deprecated`` or by setting the + :variable:`CMAKE_WARN_DEPRECATED` variable to false. + +* Warnings about deprecated functionality can now be controlled in the + :manual:`cmake-gui(1)` application. + +* The suppression of developer warnings as errors can now be controlled with + the new ``-Werror=dev`` and ``-Wno-error=dev`` :manual:`cmake(1)` options. + +* The :variable:`CMAKE_ERROR_DEPRECATED` variable can now be set using the + ``-Werror=deprecated`` and ``-Wno-error=deprecated`` :manual:`cmake(1)` + options. + +* The :module:`CPackDeb` module learned to set optional config + file ``Source`` field - monolithic and per-component variable. + See :variable:`CPACK_DEBIAN_PACKAGE_SOURCE`. + +* The :module:`CPackDeb` module learned to set Package, Section + and Priority control fields per-component. + See :variable:`CPACK_DEBIAN__PACKAGE_SECTION` + and :variable:`CPACK_DEBIAN__PACKAGE_PRIORITY`. + +* The :module:`CPack DragNDrop generator ` learned to add + multi-lingual SLAs to a DMG which is presented to the user when they try to + mount the DMG. See the :variable:`CPACK_DMG_SLA_LANGUAGES` and + :variable:`CPACK_DMG_SLA_DIR` variables for details. + +* The :module:`CPackNSIS` module learned new variables to add bitmaps to the + installer. See the :variable:`CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP` + and :variable:`CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP` variables. + +* The :module:`CPackRPM` module learned to set Name and Group + control fields per-component. + See :variable:`CPACK_RPM__PACKAGE_NAME` + and :variable:`CPACK_RPM__PACKAGE_GROUP`. + +* The :module:`CMakeForceCompiler` module and its macros are now deprecated. + See module documentation for an explanation. + +* The :module:`ExternalProject` module learned a new ``GIT_REMOTE_NAME`` + option to control the ``git clone --origin`` value. + +* The :module:`FindBoost` module now provides imported targets + such as ``Boost::boost`` and ``Boost::filesystem``. + +* The :module:`FindFLEX` module ``FLEX_TARGET`` macro learned a + new ``DEFINES_FILE`` option to specify a custom output header + to be generated. + +* The :module:`FindGTest` module now provides imported targets. + +* The :module:`FindGTK2` module, when ``GTK2_USE_IMPORTED_TARGETS`` is + enabled, now sets ``GTK2_LIBRARIES`` to contain the list of imported + targets instead of the paths to the libraries. Moreover it now sets + a new ``GTK2_TARGETS`` variable containing all the targets imported. + +* Starting with sigc++ 2.5.1, c++11 must be enabled in order to use + sigc++. The GTK2::sigc++ imported target will automatically enable the + required build flags in order to build with the version found on the + system. + +* The :module:`FindOpenMP` module learned to support Clang. + +* The :module:`FindOpenSSL` module gained a new + ``OPENSSL_MSVC_STATIC_RT`` option to search for libraries using + the MSVC static runtime. + +* The :module:`FindPNG` module now provides imported targets. + +* The :module:`FindTIFF` module now provides imported targets. + +* A :module:`FindXalanC` module was introduced to find the + Apache Xalan-C++ XSL transform processing library. + +* The :module:`FindXercesC` module now provides imported targets. + +* The :command:`install(DIRECTORY)` command learned to support + :manual:`generator expressions ` + in the list of directories. + +* When building for embedded Apple platforms like iOS CMake learned to build and + install combined targets which contain both a device and a simulator build. + This behavior can be enabled by setting the :prop_tgt:`IOS_INSTALL_COMBINED` + target property. + +* The :manual:`Compile Features ` functionality + is now aware of features supported by Clang compilers on Windows (MinGW). + +* The Qt base CMake GUI got a Regular Expression Explorer which could be used to + create and evaluate regular expressions in real-time. The explorer window + is available via the ``Tools`` menu. + +* The precompiled Windows binary provided on ``cmake.org`` is now a + ``.msi`` package instead of an installer executable. One may need + to manually uninstall CMake versions lower than 3.5 before installing + the new package. + +* The :generator:`Visual Studio 14 2015` generator learned to map the + ``/debug:fastlink`` linker flag to the ``.vcxproj`` file property. + +* The :prop_tgt:`VS_GLOBAL_` target property is now implemented + for VS 2010 and above. Previously it worked only in VS 2008 and below. diff --git a/Help/release/dev/CMakeParseArguments-native-impl.rst b/Help/release/dev/CMakeParseArguments-native-impl.rst deleted file mode 100644 index 114a09931..000000000 --- a/Help/release/dev/CMakeParseArguments-native-impl.rst +++ /dev/null @@ -1,6 +0,0 @@ -CMakeParseArguments-native-impl -------------------------------- - -* The :command:`cmake_parse_arguments` command is now implemented natively. - The :module:`CMakeParseArguments` module remains as an empty placeholder - for compatibility. diff --git a/Help/release/dev/ExternalProject-git-clone-o.rst b/Help/release/dev/ExternalProject-git-clone-o.rst deleted file mode 100644 index c9ff3e19d..000000000 --- a/Help/release/dev/ExternalProject-git-clone-o.rst +++ /dev/null @@ -1,5 +0,0 @@ -ExternalProject-git-clone-o ---------------------------- - -* The :module:`ExternalProject` module learned a new ``GIT_REMOTE_NAME`` - option to control the ``git clone --origin`` value. diff --git a/Help/release/dev/FindBoost-imported-targets.rst b/Help/release/dev/FindBoost-imported-targets.rst deleted file mode 100644 index 1129dedeb..000000000 --- a/Help/release/dev/FindBoost-imported-targets.rst +++ /dev/null @@ -1,5 +0,0 @@ -FindBoost-imported-targets --------------------------- - -* The :module:`FindBoost` module now provides imported targets - such as ``Boost::boost`` and ``Boost::filesystem``. diff --git a/Help/release/dev/FindFLEX-DEFINES_FILE.rst b/Help/release/dev/FindFLEX-DEFINES_FILE.rst deleted file mode 100644 index 95133aa4a..000000000 --- a/Help/release/dev/FindFLEX-DEFINES_FILE.rst +++ /dev/null @@ -1,6 +0,0 @@ -FindFLEX-DEFINES_FILE ---------------------- - -* The :module:`FindFLEX` module ``FLEX_TARGET`` macro learned a - new ``DEFINES_FILE`` option to specify a custom output header - to be generated. diff --git a/Help/release/dev/FindGTK2_GTK2_TARGETS.rst b/Help/release/dev/FindGTK2_GTK2_TARGETS.rst deleted file mode 100644 index 76e3657af..000000000 --- a/Help/release/dev/FindGTK2_GTK2_TARGETS.rst +++ /dev/null @@ -1,7 +0,0 @@ -FindGTK2_GTK2_TARGETS ---------------------- - -* The :module:`FindGTK2` module, when ``GTK2_USE_IMPORTED_TARGETS`` is - enabled, now sets ``GTK2_LIBRARIES`` to contain the list of imported - targets instead of the paths to the libraries. Moreover it now sets - a new ``GTK2_TARGETS`` variable containing all the targets imported. diff --git a/Help/release/dev/FindGTK2_sigc++_c++11.rst b/Help/release/dev/FindGTK2_sigc++_c++11.rst deleted file mode 100644 index 2ba14592b..000000000 --- a/Help/release/dev/FindGTK2_sigc++_c++11.rst +++ /dev/null @@ -1,7 +0,0 @@ -FindGTK2_sigc++_c++11 ---------------------- - -* Starting with sigc++ 2.5.1, c++11 must be enabled in order to use - sigc++. The GTK2::sigc++ imported target will automatically enable the - required build flags in order to build with the version found on the - system. diff --git a/Help/release/dev/FindGTest-imported-targets.rst b/Help/release/dev/FindGTest-imported-targets.rst deleted file mode 100644 index 3cb98da23..000000000 --- a/Help/release/dev/FindGTest-imported-targets.rst +++ /dev/null @@ -1,4 +0,0 @@ -FindGTest-imported-targets --------------------------- - -* The :module:`FindGTest` module now provides imported targets. diff --git a/Help/release/dev/FindOpenMP-clang.rst b/Help/release/dev/FindOpenMP-clang.rst deleted file mode 100644 index 44c805c82..000000000 --- a/Help/release/dev/FindOpenMP-clang.rst +++ /dev/null @@ -1,4 +0,0 @@ -FindOpenMP-clang ----------------- - -* The :module:`FindOpenMP` module learned to support Clang. diff --git a/Help/release/dev/FindOpenSSL-msvc-static-rt.rst b/Help/release/dev/FindOpenSSL-msvc-static-rt.rst deleted file mode 100644 index 6e0ee276c..000000000 --- a/Help/release/dev/FindOpenSSL-msvc-static-rt.rst +++ /dev/null @@ -1,6 +0,0 @@ -FindOpenSSL-msvc-static-rt --------------------------- - -* The :module:`FindOpenSSL` module gained a new - ``OPENSSL_MSVC_STATIC_RT`` option to search for libraries using - the MSVC static runtime. diff --git a/Help/release/dev/FindPNG-imported-targets.rst b/Help/release/dev/FindPNG-imported-targets.rst deleted file mode 100644 index e0d0ab16e..000000000 --- a/Help/release/dev/FindPNG-imported-targets.rst +++ /dev/null @@ -1,4 +0,0 @@ -FindPNG-imported-targets ------------------------- - -* The :module:`FindPNG` module now provides imported targets. diff --git a/Help/release/dev/FindTIFF-imported-targets.rst b/Help/release/dev/FindTIFF-imported-targets.rst deleted file mode 100644 index f8bbc14ae..000000000 --- a/Help/release/dev/FindTIFF-imported-targets.rst +++ /dev/null @@ -1,4 +0,0 @@ -FindTIFF-imported-targets -------------------------- - -* The :module:`FindTIFF` module now provides imported targets. diff --git a/Help/release/dev/FindXalanC.rst b/Help/release/dev/FindXalanC.rst deleted file mode 100644 index 53697740d..000000000 --- a/Help/release/dev/FindXalanC.rst +++ /dev/null @@ -1,5 +0,0 @@ -FindXalanC ----------- - -* A :module:`FindXalanC` module was introduced to find the - Apache Xalan-C++ XSL transform processing library. diff --git a/Help/release/dev/FindXercesC-imported-targets.rst b/Help/release/dev/FindXercesC-imported-targets.rst deleted file mode 100644 index 69cec5c4d..000000000 --- a/Help/release/dev/FindXercesC-imported-targets.rst +++ /dev/null @@ -1,4 +0,0 @@ -FindXercesC-imported-targets ----------------------------- - -* The :module:`FindXercesC` module now provides imported targets. diff --git a/Help/release/dev/add-armcc-toolchain.rst b/Help/release/dev/add-armcc-toolchain.rst deleted file mode 100644 index 2cf6414dc..000000000 --- a/Help/release/dev/add-armcc-toolchain.rst +++ /dev/null @@ -1,4 +0,0 @@ -add-armcc-toolchain -------------------- - -* Support was added for the ARM Compiler (arm.com) with compiler id ``ARMCC``. diff --git a/Help/release/dev/add-cray-linux-platform.rst b/Help/release/dev/add-cray-linux-platform.rst deleted file mode 100644 index 700038260..000000000 --- a/Help/release/dev/add-cray-linux-platform.rst +++ /dev/null @@ -1,7 +0,0 @@ -add-cray-linux-platform ------------------------ - -* A new platform file for cross-compiling in the Cray Linux Environment to - target compute nodes was added. See - :ref:`Cross Compiling for the Cray Linux Environment ` - for usage details. diff --git a/Help/release/dev/better-looking-mac-packages.rst b/Help/release/dev/better-looking-mac-packages.rst deleted file mode 100644 index ef1b8e88f..000000000 --- a/Help/release/dev/better-looking-mac-packages.rst +++ /dev/null @@ -1,8 +0,0 @@ -better-looking-mac-packages ---------------------------- - -* The :module:`CPackDMG` module learned new variable to specify AppleScript - file run to customize appearance of ``DragNDrop`` installer folder, - including background image setting using supplied PNG or multi-resolution - TIFF file. See the :variable:`CPACK_DMG_DS_STORE_SETUP_SCRIPT` and - :variable:`CPACK_DMG_BACKGROUND_IMAGE` variables. diff --git a/Help/release/dev/cmake-E-multiple-inputs.rst b/Help/release/dev/cmake-E-multiple-inputs.rst deleted file mode 100644 index 480261d87..000000000 --- a/Help/release/dev/cmake-E-multiple-inputs.rst +++ /dev/null @@ -1,11 +0,0 @@ -cmake-E-multiple-inputs ------------------------ - -* The :manual:`cmake(1)` ``-E copy`` and ``-E copy_if_different`` command-line - tools learned to support copying multiple input files to a directory. - -* The :manual:`cmake(1)` ``-E copy_directory`` command-line - tool learned to support copying multiple input directories to a directory. - -* The :manual:`cmake(1)` ``-E make_directory`` command-line - tool learned to support copying multiple input directories to a directory. diff --git a/Help/release/dev/cmake-E-time-quoting.rst b/Help/release/dev/cmake-E-time-quoting.rst deleted file mode 100644 index 23b17c57c..000000000 --- a/Help/release/dev/cmake-E-time-quoting.rst +++ /dev/null @@ -1,7 +0,0 @@ -cmake-E-time-quoting --------------------- - -* The :manual:`cmake(1)` ``-E time`` command now properly passes arguments - with spaces or special characters through to the child process. This - may break scripts that worked around the bug with their own extra - quoting or escaping. diff --git a/Help/release/dev/cmake-W-options.rst b/Help/release/dev/cmake-W-options.rst deleted file mode 100644 index c055f9602..000000000 --- a/Help/release/dev/cmake-W-options.rst +++ /dev/null @@ -1,22 +0,0 @@ -cmake-W-options ---------------- - -* The :variable:`CMAKE_WARN_DEPRECATED` variable can now be set using the - ``-Wdeprecated`` and ``-Wno-deprecated`` :manual:`cmake(1)` options. - -* The ``-Wdev`` and ``-Wno-dev`` :manual:`cmake(1)` options now also enable - and suppress the deprecated warnings output by default. - -* Warnings about deprecated functionality are now enabled by default. - They may be suppressed with ``-Wno-deprecated`` or by setting the - :variable:`CMAKE_WARN_DEPRECATED` variable to false. - -* Warnings about deprecated functionality can now be controlled in the - :manual:`cmake-gui(1)` application. - -* The suppression of developer warnings as errors can now be controlled with - the new ``-Werror=dev`` and ``-Wno-error=dev`` :manual:`cmake(1)` options. - -* The :variable:`CMAKE_ERROR_DEPRECATED` variable can now be set using the - ``-Werror=deprecated`` and ``-Wno-error=deprecated`` :manual:`cmake(1)` - options. diff --git a/Help/release/dev/cmake-gui-select-toolset.rst b/Help/release/dev/cmake-gui-select-toolset.rst deleted file mode 100644 index 5186f910c..000000000 --- a/Help/release/dev/cmake-gui-select-toolset.rst +++ /dev/null @@ -1,6 +0,0 @@ -cmake-gui-select-toolset ------------------------- - -* The :manual:`cmake-gui(1)` learned an option to set the toolset - to be used with VS IDE and Xcode generators, much like the - existing ``-T`` option to :manual:`cmake(1)`. diff --git a/Help/release/dev/cpack-deb-config-file-source-field.rst b/Help/release/dev/cpack-deb-config-file-source-field.rst deleted file mode 100644 index bbc2aa6ab..000000000 --- a/Help/release/dev/cpack-deb-config-file-source-field.rst +++ /dev/null @@ -1,6 +0,0 @@ -cpack-deb-config-file-source-field ----------------------------------- - -* The :module:`CPackDeb` module learned to set optional config - file ``Source`` field - monolithic and per-component variable. - See :variable:`CPACK_DEBIAN_PACKAGE_SOURCE`. diff --git a/Help/release/dev/cpack-deb-new-component-vars.rst b/Help/release/dev/cpack-deb-new-component-vars.rst deleted file mode 100644 index e30afdbc1..000000000 --- a/Help/release/dev/cpack-deb-new-component-vars.rst +++ /dev/null @@ -1,7 +0,0 @@ -cpack-deb-new-component-vars ----------------------------- - -* The :module:`CPackDeb` module learned to set Package, Section - and Priority control fields per-component. - See :variable:`CPACK_DEBIAN__PACKAGE_SECTION` - and :variable:`CPACK_DEBIAN__PACKAGE_PRIORITY`. diff --git a/Help/release/dev/cpack-dmg-multilanguage-sla.rst b/Help/release/dev/cpack-dmg-multilanguage-sla.rst deleted file mode 100644 index 9e28fa236..000000000 --- a/Help/release/dev/cpack-dmg-multilanguage-sla.rst +++ /dev/null @@ -1,7 +0,0 @@ -cpack-dmg-multilanguage-sla ---------------------------- - -* The :module:`CPack DragNDrop generator ` learned to add - multi-lingual SLAs to a DMG which is presented to the user when they try to - mount the DMG. See the :variable:`CPACK_DMG_SLA_LANGUAGES` and - :variable:`CPACK_DMG_SLA_DIR` variables for details. diff --git a/Help/release/dev/cpack-nsis-bitmap.rst b/Help/release/dev/cpack-nsis-bitmap.rst deleted file mode 100644 index c5ccfb546..000000000 --- a/Help/release/dev/cpack-nsis-bitmap.rst +++ /dev/null @@ -1,6 +0,0 @@ -cpack-nsis-bitmap ------------------ - -* The :module:`CPackNSIS` module learned new variables to add bitmaps to the - installer. See the :variable:`CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP` - and :variable:`CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP` variables. diff --git a/Help/release/dev/cpack-rpm-percomponent-group-and-name.rst b/Help/release/dev/cpack-rpm-percomponent-group-and-name.rst deleted file mode 100644 index 146f8ac89..000000000 --- a/Help/release/dev/cpack-rpm-percomponent-group-and-name.rst +++ /dev/null @@ -1,7 +0,0 @@ -cpack-rpm-percomponent-group-and-name -------------------------------------- - -* The :module:`CPackRPM` module learned to set Name and Group - control fields per-component. - See :variable:`CPACK_RPM__PACKAGE_NAME` - and :variable:`CPACK_RPM__PACKAGE_GROUP`. diff --git a/Help/release/dev/deprecate-CMakeForceCompiler.rst b/Help/release/dev/deprecate-CMakeForceCompiler.rst deleted file mode 100644 index dc6e817b4..000000000 --- a/Help/release/dev/deprecate-CMakeForceCompiler.rst +++ /dev/null @@ -1,5 +0,0 @@ -deprecate-CMakeForceCompiler ----------------------------- - -* The :module:`CMakeForceCompiler` module and its macros are now deprecated. - See module documentation for an explanation. diff --git a/Help/release/dev/install-DIRECTORY-genex.rst b/Help/release/dev/install-DIRECTORY-genex.rst deleted file mode 100644 index e48f19b2e..000000000 --- a/Help/release/dev/install-DIRECTORY-genex.rst +++ /dev/null @@ -1,6 +0,0 @@ -install-DIRECTORY-genex ------------------------ - -* The :command:`install(DIRECTORY)` command learned to support - :manual:`generator expressions ` - in the list of directories. diff --git a/Help/release/dev/ios-universal.rst b/Help/release/dev/ios-universal.rst deleted file mode 100644 index f96abede3..000000000 --- a/Help/release/dev/ios-universal.rst +++ /dev/null @@ -1,7 +0,0 @@ -ios-universal -------------- - -* When building for embedded Apple platforms like iOS CMake learned to build and - install combined targets which contain both a device and a simulator build. - This behavior can be enabled by setting the :prop_tgt:`IOS_INSTALL_COMBINED` - target property. diff --git a/Help/release/dev/mingw-clang-compile-features.rst b/Help/release/dev/mingw-clang-compile-features.rst deleted file mode 100644 index 5b1fb9642..000000000 --- a/Help/release/dev/mingw-clang-compile-features.rst +++ /dev/null @@ -1,5 +0,0 @@ -mingw-clang-compile-features ----------------------------- - -* The :manual:`Compile Features ` functionality - is now aware of features supported by Clang compilers on Windows (MinGW). diff --git a/Help/release/dev/regex-explorer.rst b/Help/release/dev/regex-explorer.rst deleted file mode 100644 index 21478166d..000000000 --- a/Help/release/dev/regex-explorer.rst +++ /dev/null @@ -1,6 +0,0 @@ -regex-explorer --------------- - -* The Qt base CMake GUI got a Regular Expression Explorer which could be used to - create and evaluate regular expressions in real-time. The explorer window - is available via the ``Tools`` menu. diff --git a/Help/release/dev/release-windows.rst b/Help/release/dev/release-windows.rst deleted file mode 100644 index cc9f2d5a0..000000000 --- a/Help/release/dev/release-windows.rst +++ /dev/null @@ -1,7 +0,0 @@ -release-windows ---------------- - -* The precompiled Windows binary provided on ``cmake.org`` is now a - ``.msi`` package instead of an installer executable. One may need - to manually uninstall CMake versions lower than 3.5 before installing - the new package. diff --git a/Help/release/dev/vs-debug-fastlink.rst b/Help/release/dev/vs-debug-fastlink.rst deleted file mode 100644 index c2e0599df..000000000 --- a/Help/release/dev/vs-debug-fastlink.rst +++ /dev/null @@ -1,5 +0,0 @@ -vs-debug-fastlink ------------------ - -* The :generator:`Visual Studio 14 2015` generator learned to map the - ``/debug:fastlink`` linker flag to the ``.vcxproj`` file property. diff --git a/Help/release/dev/vs-global-properties.rst b/Help/release/dev/vs-global-properties.rst deleted file mode 100644 index cae49b742..000000000 --- a/Help/release/dev/vs-global-properties.rst +++ /dev/null @@ -1,5 +0,0 @@ -vs-global-properties --------------------- - -* The :prop_tgt:`VS_GLOBAL_` target property is now implemented - for VS 2010 and above. Previously it worked only in VS 2008 and below. diff --git a/Help/release/index.rst b/Help/release/index.rst index 752acbd30..7ecf91081 100644 --- a/Help/release/index.rst +++ b/Help/release/index.rst @@ -13,6 +13,7 @@ Releases .. toctree:: :maxdepth: 1 + 3.5 <3.5> 3.4 <3.4> 3.3 <3.3> 3.2 <3.2> From ad701d9f013b5a40d6f241f334340d78c1083c1a Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 1 Feb 2016 13:38:00 -0500 Subject: [PATCH 225/255] Help: Organize and revise 3.5 release notes Add section headers similar to the 3.4 release notes and move each individual bullet into an appropriate section. Revise a few bullets. --- Help/release/3.5.rst | 183 +++++++++++++++++++++++++------------------ 1 file changed, 106 insertions(+), 77 deletions(-) diff --git a/Help/release/3.5.rst b/Help/release/3.5.rst index 3b466788f..3d1e3b4aa 100644 --- a/Help/release/3.5.rst +++ b/Help/release/3.5.rst @@ -7,86 +7,65 @@ CMake 3.5 Release Notes Changes made since CMake 3.4 include the following. -* Support was added for the ARM Compiler (arm.com) with compiler id ``ARMCC``. +New Features +============ -* A new platform file for cross-compiling in the Cray Linux Environment to - target compute nodes was added. See - :ref:`Cross Compiling for the Cray Linux Environment ` - for usage details. +GUI +--- -* The :module:`CPackDMG` module learned new variable to specify AppleScript - file run to customize appearance of ``DragNDrop`` installer folder, - including background image setting using supplied PNG or multi-resolution - TIFF file. See the :variable:`CPACK_DMG_DS_STORE_SETUP_SCRIPT` and - :variable:`CPACK_DMG_BACKGROUND_IMAGE` variables. - -* The :manual:`cmake(1)` ``-E copy`` and ``-E copy_if_different`` command-line - tools learned to support copying multiple input files to a directory. - -* The :manual:`cmake(1)` ``-E copy_directory`` command-line - tool learned to support copying multiple input directories to a directory. - -* The :manual:`cmake(1)` ``-E make_directory`` command-line - tool learned to support copying multiple input directories to a directory. - -* The :manual:`cmake(1)` ``-E time`` command now properly passes arguments - with spaces or special characters through to the child process. This - may break scripts that worked around the bug with their own extra - quoting or escaping. +* The :manual:`cmake-gui(1)` gained options to control warnings about + deprecated functionality. * The :manual:`cmake-gui(1)` learned an option to set the toolset to be used with VS IDE and Xcode generators, much like the existing ``-T`` option to :manual:`cmake(1)`. -* The :command:`cmake_parse_arguments` command is now implemented natively. - The :module:`CMakeParseArguments` module remains as an empty placeholder - for compatibility. +* The :manual:`cmake-gui(1)` gained a Regular Expression Explorer which + may be used to create and evaluate regular expressions in real-time. + The explorer window is available via the ``Tools`` menu. -* The :variable:`CMAKE_WARN_DEPRECATED` variable can now be set using the - ``-Wdeprecated`` and ``-Wno-deprecated`` :manual:`cmake(1)` options. +Command-Line +------------ * The ``-Wdev`` and ``-Wno-dev`` :manual:`cmake(1)` options now also enable and suppress the deprecated warnings output by default. -* Warnings about deprecated functionality are now enabled by default. - They may be suppressed with ``-Wno-deprecated`` or by setting the - :variable:`CMAKE_WARN_DEPRECATED` variable to false. - -* Warnings about deprecated functionality can now be controlled in the - :manual:`cmake-gui(1)` application. - * The suppression of developer warnings as errors can now be controlled with the new ``-Werror=dev`` and ``-Wno-error=dev`` :manual:`cmake(1)` options. +* The :manual:`cmake(1)` ``-E`` command-line tools ``copy``, + ``copy_if_different``, ``copy_directory``, and ``make_directory`` + learned to support multiple input files or directories. + +Commands +-------- + +* The :command:`cmake_parse_arguments` command is now implemented natively. + The :module:`CMakeParseArguments` module remains as an empty placeholder + for compatibility. + +* The :command:`install(DIRECTORY)` command learned to support + :manual:`generator expressions ` + in the list of directories. + +Variables +--------- + * The :variable:`CMAKE_ERROR_DEPRECATED` variable can now be set using the ``-Werror=deprecated`` and ``-Wno-error=deprecated`` :manual:`cmake(1)` options. -* The :module:`CPackDeb` module learned to set optional config - file ``Source`` field - monolithic and per-component variable. - See :variable:`CPACK_DEBIAN_PACKAGE_SOURCE`. +* The :variable:`CMAKE_WARN_DEPRECATED` variable can now be set using the + ``-Wdeprecated`` and ``-Wno-deprecated`` :manual:`cmake(1)` options. -* The :module:`CPackDeb` module learned to set Package, Section - and Priority control fields per-component. - See :variable:`CPACK_DEBIAN__PACKAGE_SECTION` - and :variable:`CPACK_DEBIAN__PACKAGE_PRIORITY`. +Properties +---------- -* The :module:`CPack DragNDrop generator ` learned to add - multi-lingual SLAs to a DMG which is presented to the user when they try to - mount the DMG. See the :variable:`CPACK_DMG_SLA_LANGUAGES` and - :variable:`CPACK_DMG_SLA_DIR` variables for details. +* The :prop_tgt:`VS_GLOBAL_` target property is now implemented + for VS 2010 and above. Previously it worked only in VS 2008 and below. -* The :module:`CPackNSIS` module learned new variables to add bitmaps to the - installer. See the :variable:`CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP` - and :variable:`CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP` variables. - -* The :module:`CPackRPM` module learned to set Name and Group - control fields per-component. - See :variable:`CPACK_RPM__PACKAGE_NAME` - and :variable:`CPACK_RPM__PACKAGE_GROUP`. - -* The :module:`CMakeForceCompiler` module and its macros are now deprecated. - See module documentation for an explanation. +Modules +------- * The :module:`ExternalProject` module learned a new ``GIT_REMOTE_NAME`` option to control the ``git clone --origin`` value. @@ -105,11 +84,6 @@ Changes made since CMake 3.4 include the following. targets instead of the paths to the libraries. Moreover it now sets a new ``GTK2_TARGETS`` variable containing all the targets imported. -* Starting with sigc++ 2.5.1, c++11 must be enabled in order to use - sigc++. The GTK2::sigc++ imported target will automatically enable the - required build flags in order to build with the version found on the - system. - * The :module:`FindOpenMP` module learned to support Clang. * The :module:`FindOpenSSL` module gained a new @@ -125,29 +99,84 @@ Changes made since CMake 3.4 include the following. * The :module:`FindXercesC` module now provides imported targets. -* The :command:`install(DIRECTORY)` command learned to support - :manual:`generator expressions ` - in the list of directories. +Platforms +--------- + +* Support was added for the ARM Compiler (arm.com) with compiler id ``ARMCC``. + +* A new platform file for cross-compiling in the Cray Linux Environment to + target compute nodes was added. See + :ref:`Cross Compiling for the Cray Linux Environment ` + for usage details. + +* The :manual:`Compile Features ` functionality + is now aware of features supported by Clang compilers on Windows (MinGW). * When building for embedded Apple platforms like iOS CMake learned to build and install combined targets which contain both a device and a simulator build. This behavior can be enabled by setting the :prop_tgt:`IOS_INSTALL_COMBINED` target property. -* The :manual:`Compile Features ` functionality - is now aware of features supported by Clang compilers on Windows (MinGW). +CPack +----- -* The Qt base CMake GUI got a Regular Expression Explorer which could be used to - create and evaluate regular expressions in real-time. The explorer window - is available via the ``Tools`` menu. +* The :module:`CPackDMG` module learned new variable to specify AppleScript + file run to customize appearance of ``DragNDrop`` installer folder, + including background image setting using supplied PNG or multi-resolution + TIFF file. See the :variable:`CPACK_DMG_DS_STORE_SETUP_SCRIPT` and + :variable:`CPACK_DMG_BACKGROUND_IMAGE` variables. + +* The :module:`CPackDeb` module learned to set the optional config + file ``Source`` field using a monolithic or per-component variable. + See :variable:`CPACK_DEBIAN_PACKAGE_SOURCE`. + +* The :module:`CPackDeb` module learned to set Package, Section + and Priority control fields per-component. + See variables :variable:`CPACK_DEBIAN__PACKAGE_SECTION` and + :variable:`CPACK_DEBIAN__PACKAGE_PRIORITY`. + +* The :module:`CPack DragNDrop generator ` learned to add + multi-lingual SLAs to a DMG which is presented to the user when they try to + mount the DMG. See the :variable:`CPACK_DMG_SLA_LANGUAGES` and + :variable:`CPACK_DMG_SLA_DIR` variables for details. + +* The :module:`CPackNSIS` module learned new variables to add bitmaps to the + installer. See the :variable:`CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP` + and :variable:`CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP` variables. + +* The :module:`CPackRPM` module learned to set Name and Group + control fields per-component. + See :variable:`CPACK_RPM__PACKAGE_NAME` + and :variable:`CPACK_RPM__PACKAGE_GROUP`. + +Other +----- + +* Warnings about deprecated functionality are now enabled by default. + They may be suppressed with ``-Wno-deprecated`` or by setting the + :variable:`CMAKE_WARN_DEPRECATED` variable to false. + +Deprecated and Removed Features +=============================== + +* The :module:`CMakeForceCompiler` module and its macros are now deprecated. + See module documentation for an explanation. + +* The :manual:`cmake(1)` ``-E time`` command now properly passes arguments + with spaces or special characters through to the child process. This + may break scripts that worked around the bug with their own extra + quoting or escaping. + +Other Changes +============= + +* The :generator:`Visual Studio 14 2015` generator learned to map the + ``/debug:fastlink`` linker flag to the ``.vcxproj`` file property. + +* The :module:`FindGTK2` module now configures the ``GTK2::sigc++`` imported + target to enable c++11 on its dependents when using sigc++ 2.5.1 or higher. * The precompiled Windows binary provided on ``cmake.org`` is now a ``.msi`` package instead of an installer executable. One may need to manually uninstall CMake versions lower than 3.5 before installing the new package. - -* The :generator:`Visual Studio 14 2015` generator learned to map the - ``/debug:fastlink`` linker flag to the ``.vcxproj`` file property. - -* The :prop_tgt:`VS_GLOBAL_` target property is now implemented - for VS 2010 and above. Previously it worked only in VS 2008 and below. From 6a230df6368e699521aff1ded3e3f452a161385b Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 2 Feb 2016 00:01:05 -0500 Subject: [PATCH 226/255] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index e14724738..d3b2ff5d2 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20160201) +set(CMake_VERSION_PATCH 20160202) #set(CMake_VERSION_RC 1) From 021a74a6cbc01728964c55c88233491a30f0d812 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 2 Feb 2016 08:34:47 -0500 Subject: [PATCH 227/255] Help: Drop development topic notes to prepare release Release versions do not have the development topic section of the CMake Release Notes index page. --- Help/release/dev/0-sample-topic.rst | 7 ------- Help/release/index.rst | 2 -- 2 files changed, 9 deletions(-) delete mode 100644 Help/release/dev/0-sample-topic.rst diff --git a/Help/release/dev/0-sample-topic.rst b/Help/release/dev/0-sample-topic.rst deleted file mode 100644 index e4cc01e23..000000000 --- a/Help/release/dev/0-sample-topic.rst +++ /dev/null @@ -1,7 +0,0 @@ -0-sample-topic --------------- - -* This is a sample release note for the change in a topic. - Developers should add similar notes for each topic branch - making a noteworthy change. Each document should be named - and titled to match the topic name to avoid merge conflicts. diff --git a/Help/release/index.rst b/Help/release/index.rst index 7ecf91081..6b7da3c7f 100644 --- a/Help/release/index.rst +++ b/Help/release/index.rst @@ -5,8 +5,6 @@ CMake Release Notes This file should include the adjacent "dev.txt" file in development versions but not in release versions. -.. include:: dev.txt - Releases ======== From 8a8d22cf1e5d20b7c3b32c1ec9b5f06b339c2a50 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 2 Feb 2016 08:37:05 -0500 Subject: [PATCH 228/255] CMake 3.5.0-rc1 version update --- Source/CMakeVersion.cmake | 6 +++--- Utilities/Release/upload_release.cmake | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index d3b2ff5d2..e4f44b7f1 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) -set(CMake_VERSION_MINOR 4) -set(CMake_VERSION_PATCH 20160202) -#set(CMake_VERSION_RC 1) +set(CMake_VERSION_MINOR 5) +set(CMake_VERSION_PATCH 0) +set(CMake_VERSION_RC 1) diff --git a/Utilities/Release/upload_release.cmake b/Utilities/Release/upload_release.cmake index 171811a99..f5e325e55 100644 --- a/Utilities/Release/upload_release.cmake +++ b/Utilities/Release/upload_release.cmake @@ -1,6 +1,6 @@ set(CTEST_RUN_CURRENT_SCRIPT 0) if(NOT VERSION) - set(VERSION 3.4) + set(VERSION 3.5) endif() if(NOT DEFINED PROJECT_PREFIX) set(PROJECT_PREFIX cmake-${VERSION}) From c5eb21b6d1f4187778ad49545761a818e1126541 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 5 Feb 2016 08:55:15 -0500 Subject: [PATCH 229/255] Fix dependency scanning configuration in subdirectories Refactoring in commit v3.5.0-rc1~347^2~2 (Set the current dirs on the snapshot before creating the cmMakefile) accidentally changed the source and binary directories configured in `cmake -E cmake_depends` for use during dependency scanning. This can cause the wrong directory information to be loaded. It also breaks Fortran module dependency scanning for modules provided by targets in subdirectories that do not have Fortran_MODULE_DIRECTORY set. Fix the dependency scanning directory configuration and add a test to cover the Fortran module case in which the breakage was observed. Reported-by: Kelly Thompson --- Source/cmcmd.cxx | 6 ++---- Tests/Fortran/CMakeLists.txt | 1 + Tests/Fortran/Executable/CMakeLists.txt | 2 +- Tests/Fortran/Executable/main.f90 | 1 + Tests/Fortran/Subdir/CMakeLists.txt | 2 ++ Tests/Fortran/Subdir/subdir.f90 | 2 ++ 6 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 Tests/Fortran/Subdir/CMakeLists.txt create mode 100644 Tests/Fortran/Subdir/subdir.f90 diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 1dc304c3a..e9d77b250 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -813,10 +813,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) { cm.SetGlobalGenerator(ggd); cmState::Snapshot snapshot = cm.GetCurrentSnapshot(); - snapshot.GetDirectory().SetCurrentBinary - (cmSystemTools::GetCurrentWorkingDirectory()); - snapshot.GetDirectory().SetCurrentSource - (cmSystemTools::GetCurrentWorkingDirectory()); + snapshot.GetDirectory().SetCurrentBinary(startOutDir); + snapshot.GetDirectory().SetCurrentSource(startDir); cmsys::auto_ptr mf(new cmMakefile(ggd, snapshot)); cmsys::auto_ptr lgd( ggd->CreateLocalGenerator(mf.get())); diff --git a/Tests/Fortran/CMakeLists.txt b/Tests/Fortran/CMakeLists.txt index 753ce2796..ecf38a605 100644 --- a/Tests/Fortran/CMakeLists.txt +++ b/Tests/Fortran/CMakeLists.txt @@ -223,5 +223,6 @@ if(TEST_MODULE_DEPENDS) endif() add_subdirectory(Library) + add_subdirectory(Subdir) add_subdirectory(Executable) endif() diff --git a/Tests/Fortran/Executable/CMakeLists.txt b/Tests/Fortran/Executable/CMakeLists.txt index 55f21ad46..de08d8605 100644 --- a/Tests/Fortran/Executable/CMakeLists.txt +++ b/Tests/Fortran/Executable/CMakeLists.txt @@ -3,6 +3,6 @@ include_directories(${External_BINARY_DIR}) link_directories(${External_BINARY_DIR}) add_executable(subdir_exe2 main.f90) -target_link_libraries(subdir_exe2 subdir_mods) +target_link_libraries(subdir_exe2 subdir_mods subdir_mods2) add_dependencies(subdir_exe2 ExternalTarget) target_link_libraries(subdir_exe2 myext) diff --git a/Tests/Fortran/Executable/main.f90 b/Tests/Fortran/Executable/main.f90 index f21156cda..640259c12 100644 --- a/Tests/Fortran/Executable/main.f90 +++ b/Tests/Fortran/Executable/main.f90 @@ -1,6 +1,7 @@ PROGRAM MAINF90 USE libraryModuleA USE libraryModuleB + USE subdirModuleA USE externalMod CALL printExtModGreeting END PROGRAM MAINF90 diff --git a/Tests/Fortran/Subdir/CMakeLists.txt b/Tests/Fortran/Subdir/CMakeLists.txt new file mode 100644 index 000000000..52683e587 --- /dev/null +++ b/Tests/Fortran/Subdir/CMakeLists.txt @@ -0,0 +1,2 @@ +add_library(subdir_mods2 subdir.f90) +target_include_directories(subdir_mods2 INTERFACE ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/Tests/Fortran/Subdir/subdir.f90 b/Tests/Fortran/Subdir/subdir.f90 new file mode 100644 index 000000000..68955f6b5 --- /dev/null +++ b/Tests/Fortran/Subdir/subdir.f90 @@ -0,0 +1,2 @@ +MODULE subdirModuleA +END MODULE From e86383e135e4cae9d54575445d945df1f6272b3a Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 5 Feb 2016 09:40:13 -0500 Subject: [PATCH 230/255] Tests: Use newer policy settings in RunCMake.install test In particular, avoid CMP0042 warnings on OS X. --- Tests/RunCMake/install/CMP0062-NEW.cmake | 2 +- Tests/RunCMake/install/CMP0062-OLD.cmake | 2 +- Tests/RunCMake/install/CMP0062-WARN.cmake | 1 + Tests/RunCMake/install/CMakeLists.txt | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Tests/RunCMake/install/CMP0062-NEW.cmake b/Tests/RunCMake/install/CMP0062-NEW.cmake index a696f56fc..9e7a5fb82 100644 --- a/Tests/RunCMake/install/CMP0062-NEW.cmake +++ b/Tests/RunCMake/install/CMP0062-NEW.cmake @@ -1,4 +1,4 @@ - +cmake_policy(VERSION 3.2) cmake_policy(SET CMP0062 NEW) add_library(iface INTERFACE) diff --git a/Tests/RunCMake/install/CMP0062-OLD.cmake b/Tests/RunCMake/install/CMP0062-OLD.cmake index 94b809a98..8874923b4 100644 --- a/Tests/RunCMake/install/CMP0062-OLD.cmake +++ b/Tests/RunCMake/install/CMP0062-OLD.cmake @@ -1,4 +1,4 @@ - +cmake_policy(VERSION 3.2) cmake_policy(SET CMP0062 OLD) add_library(iface INTERFACE) diff --git a/Tests/RunCMake/install/CMP0062-WARN.cmake b/Tests/RunCMake/install/CMP0062-WARN.cmake index 0435a640e..018f82275 100644 --- a/Tests/RunCMake/install/CMP0062-WARN.cmake +++ b/Tests/RunCMake/install/CMP0062-WARN.cmake @@ -1,3 +1,4 @@ +cmake_policy(VERSION 3.2) add_library(iface INTERFACE) export(TARGETS iface FILE "${CMAKE_CURRENT_BINARY_DIR}/exported.cmake") diff --git a/Tests/RunCMake/install/CMakeLists.txt b/Tests/RunCMake/install/CMakeLists.txt index 4b3de84d9..6dd8cdf55 100644 --- a/Tests/RunCMake/install/CMakeLists.txt +++ b/Tests/RunCMake/install/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.4) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) From 47460f3e152a59af81edd816cdfe6e0d54e38090 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 4 Feb 2016 11:45:54 -0500 Subject: [PATCH 231/255] install(EXPORT): Fix crash on target in another directory Refactoring merged by commit v3.5.0-rc1~299 (Merge topic 'use-generator-target', 2015-10-20) in and around commit v3.5.0-rc1~299^2~13 (cmExportSet: Store a cmGeneratorTarget, 2015-10-17) changed export sets to delay looking up actual targets and stores only their names. However, in InstallCommand::HandleExportMode we need to lookup targets immediately to check them for EXPORT_LINK_INTERFACE_LIBRARIES. The check was accidentally made local to the current directory, so if an export set contains a target from another directory the lookup fails and CMake crashes. Fix the check to look up the target name globally, and tolerate when no target is found just in case. Reported-by: Kelly Thompson --- Source/cmInstallCommand.cxx | 8 +++++--- Tests/RunCMake/install/EXPORT-OldIFace.cmake | 6 ++++++ Tests/RunCMake/install/EXPORT-OldIFace/CMakeLists.txt | 2 ++ Tests/RunCMake/install/RunCMakeTest.cmake | 1 + 4 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 Tests/RunCMake/install/EXPORT-OldIFace.cmake create mode 100644 Tests/RunCMake/install/EXPORT-OldIFace/CMakeLists.txt diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 15a83ee01..2d78a4101 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -1374,10 +1374,12 @@ bool cmInstallCommand::HandleExportMode(std::vector const& args) tei != exportSet->GetTargetExports()->end(); ++tei) { cmTargetExport const* te = *tei; - cmTarget* tgt = this->Makefile->FindTarget(te->TargetName); + cmTarget* tgt = + this->Makefile->GetGlobalGenerator()->FindTarget(te->TargetName); const bool newCMP0022Behavior = - tgt->GetPolicyStatusCMP0022() != cmPolicies::WARN - && tgt->GetPolicyStatusCMP0022() != cmPolicies::OLD; + (tgt && + tgt->GetPolicyStatusCMP0022() != cmPolicies::WARN && + tgt->GetPolicyStatusCMP0022() != cmPolicies::OLD); if(!newCMP0022Behavior) { diff --git a/Tests/RunCMake/install/EXPORT-OldIFace.cmake b/Tests/RunCMake/install/EXPORT-OldIFace.cmake new file mode 100644 index 000000000..8dfb46b12 --- /dev/null +++ b/Tests/RunCMake/install/EXPORT-OldIFace.cmake @@ -0,0 +1,6 @@ +enable_language(C) +add_subdirectory(EXPORT-OldIFace) +add_library(foo SHARED empty.c) +target_link_libraries(foo bar) +install(TARGETS foo DESTINATION lib EXPORT fooExport) +install(EXPORT fooExport DESTINATION lib/cmake/foo EXPORT_LINK_INTERFACE_LIBRARIES) diff --git a/Tests/RunCMake/install/EXPORT-OldIFace/CMakeLists.txt b/Tests/RunCMake/install/EXPORT-OldIFace/CMakeLists.txt new file mode 100644 index 000000000..32292e2f6 --- /dev/null +++ b/Tests/RunCMake/install/EXPORT-OldIFace/CMakeLists.txt @@ -0,0 +1,2 @@ +add_library(bar SHARED ../empty.c) +install(TARGETS bar DESTINATION lib EXPORT fooExport) diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index 2c1b29d9c..c2347d89d 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -10,6 +10,7 @@ run_cmake(DIRECTORY-DIRECTORY-bad) run_cmake(DIRECTORY-DESTINATION-bad) run_cmake(FILES-DESTINATION-bad) run_cmake(TARGETS-DESTINATION-bad) +run_cmake(EXPORT-OldIFace) run_cmake(CMP0062-OLD) run_cmake(CMP0062-NEW) run_cmake(CMP0062-WARN) From 1b9d15c1e7adff5170f10d488483e1dc4e99d507 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 5 Feb 2016 14:18:01 -0500 Subject: [PATCH 232/255] ExternalProject: Be compatible with projects setting CMAKE_CFG_INTDIR Since commit v3.5.0-rc1~32^2~1 (ExternalProject: Simplify `cmake --build` configuration passing, 2016-01-19) we use the `$` generator expression to generate the `cmake --build . --config ` value for the default BUILD_COMMAND instead of the CMAKE_CFG_INTDIR placeholder value provided by multi-config generators. However, some projects have been abusing the old implementation detail by setting CMAKE_CFG_INTDIR themselves to get a specific configuration. Those projects should be updated to set their own BUILD_COMMAND to get non-default behavior. Meanwhile we can be compatible with their existing releases by detecting when CMAKE_CFG_INTDIR is not a generator-provided placeholder and using its value instead. --- Modules/ExternalProject.cmake | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 7070dc470..249658d62 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -1231,7 +1231,22 @@ function(_ep_get_build_command name step cmd_var) endif() set(args --build ".") if(CMAKE_CONFIGURATION_TYPES) - list(APPEND args --config $) + if (CMAKE_CFG_INTDIR AND + NOT CMAKE_CFG_INTDIR STREQUAL "." AND + NOT CMAKE_CFG_INTDIR MATCHES "\\$") + # CMake 3.4 and below used the CMAKE_CFG_INTDIR placeholder value + # provided by multi-configuration generators. Some projects were + # taking advantage of that undocumented implementation detail to + # specify a specific configuration here. They should use + # BUILD_COMMAND to change the default command instead, but for + # compatibility honor the value. + set(config ${CMAKE_CFG_INTDIR}) + message(AUTHOR_WARNING "CMAKE_CFG_INTDIR should not be set by project code.\n" + "To get a non-default build command, use the BUILD_COMMAND option.") + else() + set(config $) + endif() + list(APPEND args --config ${config}) endif() if(step STREQUAL "INSTALL") list(APPEND args --target install) @@ -1241,7 +1256,7 @@ function(_ep_get_build_command name step cmd_var) string(REGEX REPLACE "^(.*/)cmake([^/]*)$" "\\1ctest\\2" cmd "${cmd}") set(args "") if(CMAKE_CONFIGURATION_TYPES) - list(APPEND args -C $) + list(APPEND args -C ${config}) endif() endif() endif() From 2859d9ef6b6899ce87d104acd8a3cd232c53d65e Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Mon, 8 Feb 2016 09:22:54 -0500 Subject: [PATCH 233/255] Tests: Extend ctest_submit host lookup failure matching (#15958) Match this message: Could not resolve host: -no-site-; Name or service not known ^^^^^^^^^^^^^^^^^^^^^^^^^^^ --- Tests/RunCMake/ctest_submit/CDashSubmitQuiet-stderr.txt | 2 +- Tests/RunCMake/ctest_submit/FailDrop-ftp-stderr.txt | 2 +- Tests/RunCMake/ctest_submit/FailDrop-http-stderr.txt | 2 +- Tests/RunCMake/ctest_submit/FailDrop-https-stderr.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Tests/RunCMake/ctest_submit/CDashSubmitQuiet-stderr.txt b/Tests/RunCMake/ctest_submit/CDashSubmitQuiet-stderr.txt index adf334bba..4825d7a8e 100644 --- a/Tests/RunCMake/ctest_submit/CDashSubmitQuiet-stderr.txt +++ b/Tests/RunCMake/ctest_submit/CDashSubmitQuiet-stderr.txt @@ -1,3 +1,3 @@ *Error when uploading file: .*/Configure.xml - *Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?|The requested URL returned error:.*) + *Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?.*|The requested URL returned error:.*) *Problems when submitting via HTTP diff --git a/Tests/RunCMake/ctest_submit/FailDrop-ftp-stderr.txt b/Tests/RunCMake/ctest_submit/FailDrop-ftp-stderr.txt index 64c301132..b9d9394fb 100644 --- a/Tests/RunCMake/ctest_submit/FailDrop-ftp-stderr.txt +++ b/Tests/RunCMake/ctest_submit/FailDrop-ftp-stderr.txt @@ -1,2 +1,2 @@ -Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?|The requested URL returned error:.*) +Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?.*|The requested URL returned error:.*) Problems when submitting via FTP diff --git a/Tests/RunCMake/ctest_submit/FailDrop-http-stderr.txt b/Tests/RunCMake/ctest_submit/FailDrop-http-stderr.txt index 73f013880..f52d2d844 100644 --- a/Tests/RunCMake/ctest_submit/FailDrop-http-stderr.txt +++ b/Tests/RunCMake/ctest_submit/FailDrop-http-stderr.txt @@ -1,2 +1,2 @@ -Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?|The requested URL returned error:.*) +Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?.*|The requested URL returned error:.*) Problems when submitting via HTTP diff --git a/Tests/RunCMake/ctest_submit/FailDrop-https-stderr.txt b/Tests/RunCMake/ctest_submit/FailDrop-https-stderr.txt index a1ba4f636..24083f2bc 100644 --- a/Tests/RunCMake/ctest_submit/FailDrop-https-stderr.txt +++ b/Tests/RunCMake/ctest_submit/FailDrop-https-stderr.txt @@ -1,2 +1,2 @@ -Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?|The requested URL returned error:.*|Protocol "https" not supported or disabled in .*|.* was built with SSL disabled.*) +Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?.*|The requested URL returned error:.*|Protocol "https" not supported or disabled in .*|.* was built with SSL disabled.*) Problems when submitting via HTTP From 8282547e0f9d7370e6f84f97a448b9842009c8c8 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 8 Feb 2016 09:37:24 -0500 Subject: [PATCH 234/255] Install ccmake.1 and cmake-gui.1 conditionally with their tools (#15957) --- Utilities/Sphinx/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Utilities/Sphinx/CMakeLists.txt b/Utilities/Sphinx/CMakeLists.txt index 1baca35e4..257ba620a 100644 --- a/Utilities/Sphinx/CMakeLists.txt +++ b/Utilities/Sphinx/CMakeLists.txt @@ -156,6 +156,14 @@ if(SPHINX_MAN) if("x${m}" MATCHES "^x(.+)\\.([1-9])\\.rst$") set(name "${CMAKE_MATCH_1}") set(sec "${CMAKE_MATCH_2}") + if(NOT CMakeHelp_STANDALONE) + if(name STREQUAL "ccmake" AND NOT BUILD_CursesDialog) + continue() + endif() + if(name STREQUAL "cmake-gui" AND NOT BUILD_QtDialog) + continue() + endif() + endif() CMake_OPTIONAL_COMPONENT(sphinx-man) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/man/${name}.${sec} DESTINATION ${CMAKE_MAN_DIR}/man${sec} From d8c90800174b6b5256fea5ea0813977c608c5ff0 Mon Sep 17 00:00:00 2001 From: Paul Wilkinson Date: Sun, 7 Feb 2016 20:46:27 +0000 Subject: [PATCH 235/255] Help: Fix mistake in cmake-buildsystem(7) example The COMPATIBLE_INTERFACE_NUMBER_MAX example now sets INTERFACE_CONTAINER_SIZE_REQUIRED on lib1Version2 and lib1Version3. Previously set it on lib1Version2 twice and never on lib1Version3. --- Help/manual/cmake-buildsystem.7.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Help/manual/cmake-buildsystem.7.rst b/Help/manual/cmake-buildsystem.7.rst index 4a04f3145..9004bb26e 100644 --- a/Help/manual/cmake-buildsystem.7.rst +++ b/Help/manual/cmake-buildsystem.7.rst @@ -427,7 +427,7 @@ specified will be calculated: ) add_library(lib1Version3 SHARED lib1_v3.cpp) - set_property(TARGET lib1Version2 PROPERTY INTERFACE_CONTAINER_SIZE_REQUIRED 1000) + set_property(TARGET lib1Version3 PROPERTY INTERFACE_CONTAINER_SIZE_REQUIRED 1000) add_executable(exe1 exe1.cpp) # CONTAINER_SIZE_REQUIRED will be "200" From a3b91d164043bdef713c0490f3069c00851ccf13 Mon Sep 17 00:00:00 2001 From: Horst Kronstorfer Date: Mon, 8 Feb 2016 12:55:25 +0100 Subject: [PATCH 236/255] Help: Fix command specification for cmake_minimum_required Implementation indicates that at least two components of VERSION must be specified (see Source/cmCMakeMinimumRequired.cxx.) Therefore the minor version is not optional. --- Help/command/cmake_minimum_required.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Help/command/cmake_minimum_required.rst b/Help/command/cmake_minimum_required.rst index 857321817..dc65a9e68 100644 --- a/Help/command/cmake_minimum_required.rst +++ b/Help/command/cmake_minimum_required.rst @@ -5,7 +5,7 @@ Set the minimum required version of cmake for a project. :: - cmake_minimum_required(VERSION major[.minor[.patch[.tweak]]] + cmake_minimum_required(VERSION major.minor[.patch[.tweak]] [FATAL_ERROR]) If the current version of CMake is lower than that required it will From a1ad098dc8fc5204fc797b92faed517337816b82 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 8 Feb 2016 10:44:43 -0500 Subject: [PATCH 237/255] Tests: Avoid OS X 10.5 limitation warning in RunCMake.install test The EXPORT-OldIFace test case uses install(TARGETS) and so generates a warning: CMake Warning in CMakeLists.txt: WARNING: Target "foo" has runtime paths which cannot be changed during install. To change runtime paths, OS X version 10.6 or newer is required. Therefore, runtime paths will not be changed when installing. CMAKE_BUILD_WITH_INSTALL_RPATH may be used to work around this limitation. Set CMAKE_BUILD_WITH_INSTALL_RPATH to avoid the warning since we do not need to run the binaries from the build tree anyway. --- Tests/RunCMake/install/EXPORT-OldIFace.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/Tests/RunCMake/install/EXPORT-OldIFace.cmake b/Tests/RunCMake/install/EXPORT-OldIFace.cmake index 8dfb46b12..033f68446 100644 --- a/Tests/RunCMake/install/EXPORT-OldIFace.cmake +++ b/Tests/RunCMake/install/EXPORT-OldIFace.cmake @@ -1,4 +1,5 @@ enable_language(C) +set(CMAKE_BUILD_WITH_INSTALL_RPATH 1) add_subdirectory(EXPORT-OldIFace) add_library(foo SHARED empty.c) target_link_libraries(foo bar) From 6cbf6a51976c9092f84ef4a90d35fb6fd60f5898 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 8 Feb 2016 12:37:47 -0500 Subject: [PATCH 238/255] Fix internal target lookup performance regression Refactoring in commit v3.5.0-rc1~272^2~13 (cmGlobalGenerator: Remove direct storage of targets, 2015-10-25) replaced an efficient data structure mapping from target name to cmTarget instance with a linear search. Lookups through cmGlobalGenerator::FindTarget are done a lot. Restore the efficient mapping structure with a name indicating its purpose. Reported-by: Bartosz Kosiorek --- Source/cmGlobalGenerator.cxx | 46 ++++++++++-------------------------- Source/cmGlobalGenerator.h | 18 +++++++++++++- Source/cmMakefile.cxx | 2 ++ 3 files changed, 32 insertions(+), 34 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index d7bec4492..65e7b1281 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1649,6 +1649,7 @@ void cmGlobalGenerator::ClearGeneratorMembers() this->ExportSets.clear(); this->TargetDependencies.clear(); + this->TargetSearchIndex.clear(); this->ProjectMap.clear(); this->RuleHashes.clear(); this->DirectoryContentMap.clear(); @@ -2177,18 +2178,20 @@ bool cmGlobalGenerator::IsAlias(const std::string& name) const return this->AliasTargets.find(name) != this->AliasTargets.end(); } +void cmGlobalGenerator::IndexTarget(cmTarget* t) +{ + if (!t->IsImported() || t->IsImportedGloballyVisible()) + { + this->TargetSearchIndex[t->GetName()] = t; + } +} + cmTarget* cmGlobalGenerator::FindTargetImpl(std::string const& name) const { - for (unsigned int i = 0; i < this->Makefiles.size(); ++i) + TargetMap::const_iterator i = this->TargetSearchIndex.find(name); + if (i != this->TargetSearchIndex.end()) { - cmTargets& tgts = this->Makefiles[i]->GetTargets(); - for (cmTargets::iterator it = tgts.begin(); it != tgts.end(); ++it) - { - if (it->second.GetName() == name) - { - return &it->second; - } - } + return i->second; } return 0; } @@ -2212,25 +2215,6 @@ cmGlobalGenerator::FindGeneratorTargetImpl(std::string const& name) const return 0; } -cmTarget* -cmGlobalGenerator::FindImportedTargetImpl(std::string const& name) const -{ - for (unsigned int i = 0; i < this->Makefiles.size(); ++i) - { - const std::vector& tgts = - this->Makefiles[i]->GetOwnedImportedTargets(); - for (std::vector::const_iterator it = tgts.begin(); - it != tgts.end(); ++it) - { - if ((*it)->GetName() == name && (*it)->IsImportedGloballyVisible()) - { - return *it; - } - } - } - return 0; -} - cmGeneratorTarget* cmGlobalGenerator::FindImportedGeneratorTargetImpl( std::string const& name) const { @@ -2264,11 +2248,7 @@ cmGlobalGenerator::FindTarget(const std::string& name, return this->FindTargetImpl(ai->second); } } - if (cmTarget* tgt = this->FindTargetImpl(name)) - { - return tgt; - } - return this->FindImportedTargetImpl(name); + return this->FindTargetImpl(name); } cmGeneratorTarget* diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index bc6e17d7f..82bb35c48 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -278,6 +278,8 @@ public: std::set const& GetDirectoryContent(std::string const& dir, bool needDisk = true); + void IndexTarget(cmTarget* t); + static bool IsReservedTarget(std::string const& name); virtual const char* GetAllTargetName() const { return "ALL_BUILD"; } @@ -420,7 +422,6 @@ protected: std::map AliasTargets; cmTarget* FindTargetImpl(std::string const& name) const; - cmTarget* FindImportedTargetImpl(std::string const& name) const; cmGeneratorTarget* FindGeneratorTargetImpl(std::string const& name) const; cmGeneratorTarget* @@ -430,6 +431,21 @@ protected: virtual bool UseFolderProperty(); private: + +#if defined(CMAKE_BUILD_WITH_CMAKE) +# ifdef CMake_HAVE_CXX11_UNORDERED_MAP + typedef std::unordered_map TargetMap; +# else + typedef cmsys::hash_map TargetMap; +# endif +#else + typedef std::map TargetMap; +#endif + // Map efficiently from target name to cmTarget instance. + // Do not use this structure for looping over all targets. + // It contains both normal and globally visible imported targets. + TargetMap TargetSearchIndex; + cmMakefile* TryCompileOuterMakefile; // If you add a new map here, make sure it is copied // in EnableLanguagesFromGenerator diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index cba29eb04..950b24735 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2128,6 +2128,7 @@ cmMakefile::AddNewTarget(cmState::TargetType type, const std::string& name) cmTarget& target = it->second; target.SetType(type, name); target.SetMakefile(this); + this->GetGlobalGenerator()->IndexTarget(&it->second); return &it->second; } @@ -4218,6 +4219,7 @@ cmMakefile::AddImportedTarget(const std::string& name, // Add to the set of available imported targets. this->ImportedTargets[name] = target.get(); + this->GetGlobalGenerator()->IndexTarget(target.get()); // Transfer ownership to this cmMakefile object. this->ImportedTargetsOwned.push_back(target.get()); From 9b7d5871b86036da009119e14f54d161f2d44f24 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 8 Feb 2016 12:50:56 -0500 Subject: [PATCH 239/255] Improve internal generator target structure lookup In commit v3.5.0-rc1~272^2~6 (cmGlobalGenerator: Add FindGeneratorTarget API, 2015-10-25) a lookup was implemented via linear search. Replace it with an efficient data structure. Suggested-by: Stephen Kelly --- Source/cmGlobalGenerator.cxx | 49 +++++++++++------------------------- Source/cmGlobalGenerator.h | 6 +++++ Source/cmLocalGenerator.cxx | 2 ++ 3 files changed, 22 insertions(+), 35 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 65e7b1281..fc8cf0652 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1650,6 +1650,7 @@ void cmGlobalGenerator::ClearGeneratorMembers() this->ExportSets.clear(); this->TargetDependencies.clear(); this->TargetSearchIndex.clear(); + this->GeneratorTargetSearchIndex.clear(); this->ProjectMap.clear(); this->RuleHashes.clear(); this->DirectoryContentMap.clear(); @@ -2186,6 +2187,14 @@ void cmGlobalGenerator::IndexTarget(cmTarget* t) } } +void cmGlobalGenerator::IndexGeneratorTarget(cmGeneratorTarget* gt) +{ + if (!gt->IsImported() || gt->IsImportedGloballyVisible()) + { + this->GeneratorTargetSearchIndex[gt->GetName()] = gt; + } +} + cmTarget* cmGlobalGenerator::FindTargetImpl(std::string const& name) const { TargetMap::const_iterator i = this->TargetSearchIndex.find(name); @@ -2199,37 +2208,11 @@ cmTarget* cmGlobalGenerator::FindTargetImpl(std::string const& name) const cmGeneratorTarget* cmGlobalGenerator::FindGeneratorTargetImpl(std::string const& name) const { - for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) + GeneratorTargetMap::const_iterator i = + this->GeneratorTargetSearchIndex.find(name); + if (i != this->GeneratorTargetSearchIndex.end()) { - const std::vector& tgts = - this->LocalGenerators[i]->GetGeneratorTargets(); - for (std::vector::const_iterator it = tgts.begin(); - it != tgts.end(); ++it) - { - if ((*it)->GetName() == name) - { - return *it; - } - } - } - return 0; -} - -cmGeneratorTarget* cmGlobalGenerator::FindImportedGeneratorTargetImpl( - std::string const& name) const -{ - for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) - { - const std::vector& tgts = - this->LocalGenerators[i]->GetImportedGeneratorTargets(); - for (std::vector::const_iterator it = tgts.begin(); - it != tgts.end(); ++it) - { - if ((*it)->IsImportedGloballyVisible() && (*it)->GetName() == name) - { - return *it; - } - } + return i->second; } return 0; } @@ -2260,11 +2243,7 @@ cmGlobalGenerator::FindGeneratorTarget(const std::string& name) const { return this->FindGeneratorTargetImpl(ai->second); } - if (cmGeneratorTarget* tgt = this->FindGeneratorTargetImpl(name)) - { - return tgt; - } - return this->FindImportedGeneratorTargetImpl(name); + return this->FindGeneratorTargetImpl(name); } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 82bb35c48..48fa70406 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -279,6 +279,7 @@ public: bool needDisk = true); void IndexTarget(cmTarget* t); + void IndexGeneratorTarget(cmGeneratorTarget* gt); static bool IsReservedTarget(std::string const& name); @@ -435,16 +436,21 @@ private: #if defined(CMAKE_BUILD_WITH_CMAKE) # ifdef CMake_HAVE_CXX11_UNORDERED_MAP typedef std::unordered_map TargetMap; + typedef std::unordered_map + GeneratorTargetMap; # else typedef cmsys::hash_map TargetMap; + typedef cmsys::hash_map GeneratorTargetMap; # endif #else typedef std::map TargetMap; + typedef std::map GeneratorTargetMap; #endif // Map efficiently from target name to cmTarget instance. // Do not use this structure for looping over all targets. // It contains both normal and globally visible imported targets. TargetMap TargetSearchIndex; + GeneratorTargetMap GeneratorTargetSearchIndex; cmMakefile* TryCompileOuterMakefile; // If you add a new map here, make sure it is copied diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 1d17032d8..912be0c0f 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -455,11 +455,13 @@ void cmLocalGenerator::GenerateInstallRules() void cmLocalGenerator::AddGeneratorTarget(cmGeneratorTarget* gt) { this->GeneratorTargets.push_back(gt); + this->GlobalGenerator->IndexGeneratorTarget(gt); } void cmLocalGenerator::AddImportedGeneratorTarget(cmGeneratorTarget* gt) { this->ImportedGeneratorTargets.push_back(gt); + this->GlobalGenerator->IndexGeneratorTarget(gt); } void cmLocalGenerator::AddOwnedImportedGeneratorTarget(cmGeneratorTarget* gt) From a12b0f1b193024b71583b9150aeead33d364d189 Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Sun, 7 Feb 2016 20:25:56 +0100 Subject: [PATCH 240/255] CMake: Prevent WiX installations over existing NSIS installations Use a custom action to look for Uninstall.exe in the user selected installation prefix. Its presence indicates a previous NSIS installation. Inform the user and request manual resolution of the issue. --- CMakeCPack.cmake | 11 +++++ CMakeCPackOptions.cmake.in | 28 ++++++++++-- Utilities/CMakeLists.txt | 4 ++ Utilities/Release/WiX/CMakeLists.txt | 12 +++++ .../Release/WiX/CustomAction/CMakeLists.txt | 13 ++++++ .../CustomAction/detect_nsis_overwrite.cpp | 45 +++++++++++++++++++ .../Release/WiX/CustomAction/exports.def | 2 + .../WiX/cmake_nsis_overwrite_dialog.wxs | 21 +++++++++ .../Release/WiX/custom_action_dll.wxs.in | 6 +++ Utilities/Release/WiX/install_dir.wxs | 13 +++++- 10 files changed, 151 insertions(+), 4 deletions(-) create mode 100644 Utilities/Release/WiX/CMakeLists.txt create mode 100644 Utilities/Release/WiX/CustomAction/CMakeLists.txt create mode 100644 Utilities/Release/WiX/CustomAction/detect_nsis_overwrite.cpp create mode 100644 Utilities/Release/WiX/CustomAction/exports.def create mode 100644 Utilities/Release/WiX/cmake_nsis_overwrite_dialog.wxs create mode 100644 Utilities/Release/WiX/custom_action_dll.wxs.in diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake index a0aadcc9f..320327999 100644 --- a/CMakeCPack.cmake +++ b/CMakeCPack.cmake @@ -198,6 +198,17 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") set(CPACK_WIX_UPGRADE_GUID "8ffd1d72-b7f1-11e2-8ee5-00238bca4991") + if(MSVC AND NOT "$ENV{WIX}" STREQUAL "") + set(WIX_CUSTOM_ACTION_ENABLED TRUE) + if(CMAKE_CONFIGURATION_TYPES) + set(WIX_CUSTOM_ACTION_MULTI_CONFIG TRUE) + else() + set(WIX_CUSTOM_ACTION_MULTI_CONFIG FALSE) + endif() + else() + set(WIX_CUSTOM_ACTION_ENABLED FALSE) + endif() + # Set the options file that needs to be included inside CMakeCPackOptions.cmake set(QT_DIALOG_CPACK_OPTIONS_FILE ${CMake_BINARY_DIR}/Source/QtDialog/QtDialogCPack.cmake) configure_file("${CMake_SOURCE_DIR}/CMakeCPackOptions.cmake.in" diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in index 25af0c93e..59ae224ea 100644 --- a/CMakeCPackOptions.cmake.in +++ b/CMakeCPackOptions.cmake.in @@ -246,6 +246,29 @@ if("${CPACK_GENERATOR}" STREQUAL "WIX") "@CMake_SOURCE_DIR@/Utilities/Release/WiX/cmake_extra_dialog.wxs" ) + set(_WIX_CUSTOM_ACTION_ENABLED "@WIX_CUSTOM_ACTION_ENABLED@") + if(_WIX_CUSTOM_ACTION_ENABLED) + list(APPEND CPACK_WIX_EXTRA_SOURCES + "@CMake_SOURCE_DIR@/Utilities/Release/WiX/cmake_nsis_overwrite_dialog.wxs" + ) + list(APPEND CPACK_WIX_CANDLE_EXTRA_FLAGS -dCHECK_NSIS=1) + + set(_WIX_CUSTOM_ACTION_MULTI_CONFIG "@WIX_CUSTOM_ACTION_MULTI_CONFIG@") + if(_WIX_CUSTOM_ACTION_MULTI_CONFIG) + if(CPACK_BUILD_CONFIG) + set(_WIX_CUSTOM_ACTION_CONFIG "${CPACK_BUILD_CONFIG}") + else() + set(_WIX_CUSTOM_ACTION_CONFIG "Release") + endif() + + list(APPEND CPACK_WIX_EXTRA_SOURCES + "@CMake_BINARY_DIR@/Utilities/Release/WiX/custom_action_dll-${_WIX_CUSTOM_ACTION_CONFIG}.wxs") + else() + list(APPEND CPACK_WIX_EXTRA_SOURCES + "@CMake_BINARY_DIR@/Utilities/Release/WiX/custom_action_dll.wxs") + endif() + endif() + set(CPACK_WIX_UI_REF "CMakeUI_InstallDir") set(CPACK_WIX_PATCH_FILE @@ -261,8 +284,7 @@ if("${CPACK_GENERATOR}" STREQUAL "WIX") if(BUILD_QtDialog) list(APPEND CPACK_WIX_PATCH_FILE "@CMake_SOURCE_DIR@/Utilities/Release/WiX/patch_desktop_shortcut.xml" - ) - - set(CPACK_WIX_CANDLE_EXTRA_FLAGS "-dBUILD_QtDialog=1") + ) + list(APPEND CPACK_WIX_CANDLE_EXTRA_FLAGS -dBUILD_QtDialog=1) endif() endif() diff --git a/Utilities/CMakeLists.txt b/Utilities/CMakeLists.txt index 8b3e325fa..cf6bb7285 100644 --- a/Utilities/CMakeLists.txt +++ b/Utilities/CMakeLists.txt @@ -33,3 +33,7 @@ else() # Normal documentation build. add_subdirectory(Sphinx) endif() + +if(WIX_CUSTOM_ACTION_ENABLED) + add_subdirectory(Release/WiX) +endif() diff --git a/Utilities/Release/WiX/CMakeLists.txt b/Utilities/Release/WiX/CMakeLists.txt new file mode 100644 index 000000000..cc0dbe1a6 --- /dev/null +++ b/Utilities/Release/WiX/CMakeLists.txt @@ -0,0 +1,12 @@ +add_subdirectory(CustomAction) + +if(CMAKE_CONFIGURATION_TYPES) + set(CUSTOM_ACTION_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/custom_action_dll-$.wxs") +else() + set(CUSTOM_ACTION_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/custom_action_dll.wxs") +endif() + +file(GENERATE + OUTPUT "${CUSTOM_ACTION_OUTPUT}" + INPUT "${CMAKE_CURRENT_SOURCE_DIR}/custom_action_dll.wxs.in" + ) diff --git a/Utilities/Release/WiX/CustomAction/CMakeLists.txt b/Utilities/Release/WiX/CustomAction/CMakeLists.txt new file mode 100644 index 000000000..7efd01e00 --- /dev/null +++ b/Utilities/Release/WiX/CustomAction/CMakeLists.txt @@ -0,0 +1,13 @@ +foreach(CONFIG DEBUG MINSIZEREL RELEASE RELWITHDEBINFO) + string(REPLACE "/MD" "/MT" + "CMAKE_CXX_FLAGS_${CONFIG}" + "${CMAKE_CXX_FLAGS_${CONFIG}}" + ) +endforeach() + +add_library(CMakeWiXCustomActions MODULE + detect_nsis_overwrite.cpp + exports.def +) + +target_link_libraries(CMakeWiXCustomActions PRIVATE msi) diff --git a/Utilities/Release/WiX/CustomAction/detect_nsis_overwrite.cpp b/Utilities/Release/WiX/CustomAction/detect_nsis_overwrite.cpp new file mode 100644 index 000000000..dad1ae511 --- /dev/null +++ b/Utilities/Release/WiX/CustomAction/detect_nsis_overwrite.cpp @@ -0,0 +1,45 @@ +#include +#include +#include + +#include +#include + +std::wstring get_property(MSIHANDLE msi_handle, std::wstring const& name) +{ + DWORD size = 0; + + UINT status = MsiGetPropertyW(msi_handle, name.c_str(), L"", &size); + + if(status == ERROR_MORE_DATA) + { + std::vector buffer(size + 1); + MsiGetPropertyW(msi_handle, name.c_str(), &buffer[0], &size); + return std::wstring(&buffer[0]); + } + else + { + return std::wstring(); + } +} + +void set_property(MSIHANDLE msi_handle, + std::wstring const& name, std::wstring const& value) +{ + MsiSetPropertyW(msi_handle, name.c_str(), value.c_str()); +} + +extern "C" UINT __stdcall DetectNsisOverwrite(MSIHANDLE msi_handle) +{ + std::wstring install_root = get_property(msi_handle, L"INSTALL_ROOT"); + + std::wstring uninstall_exe = install_root + L"\\uninstall.exe"; + + bool uninstall_exe_exists = + GetFileAttributesW(uninstall_exe.c_str()) != INVALID_FILE_ATTRIBUTES; + + set_property(msi_handle, L"CMAKE_NSIS_OVERWRITE_DETECTED", + uninstall_exe_exists ? L"1" : L"0"); + + return ERROR_SUCCESS; +} diff --git a/Utilities/Release/WiX/CustomAction/exports.def b/Utilities/Release/WiX/CustomAction/exports.def new file mode 100644 index 000000000..0e448b20e --- /dev/null +++ b/Utilities/Release/WiX/CustomAction/exports.def @@ -0,0 +1,2 @@ +EXPORTS + DetectNsisOverwrite=DetectNsisOverwrite diff --git a/Utilities/Release/WiX/cmake_nsis_overwrite_dialog.wxs b/Utilities/Release/WiX/cmake_nsis_overwrite_dialog.wxs new file mode 100644 index 000000000..8fe60f2cd --- /dev/null +++ b/Utilities/Release/WiX/cmake_nsis_overwrite_dialog.wxs @@ -0,0 +1,21 @@ + + + + + + 1 + + + + Uninstall.exe was detected in your chosen installation prefix. + This indicates a conflicting NSIS based installation of CMake. + + Please uninstall your old CMake installation or choose a different + installation directory. + + + + + + + diff --git a/Utilities/Release/WiX/custom_action_dll.wxs.in b/Utilities/Release/WiX/custom_action_dll.wxs.in new file mode 100644 index 000000000..021e63c5f --- /dev/null +++ b/Utilities/Release/WiX/custom_action_dll.wxs.in @@ -0,0 +1,6 @@ + + + + + diff --git a/Utilities/Release/WiX/install_dir.wxs b/Utilities/Release/WiX/install_dir.wxs index 883efba90..49b74e37d 100644 --- a/Utilities/Release/WiX/install_dir.wxs +++ b/Utilities/Release/WiX/install_dir.wxs @@ -9,6 +9,9 @@ + + + @@ -36,7 +39,11 @@ 1 NOT WIXUI_DONTVALIDATEPATH "1"]]> - WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID="1" + + 1 + CMAKE_NSIS_OVERWRITE_DETECTED="1" + + 1]]> 1 1 @@ -57,5 +64,9 @@ + + + + From 1ea55acf8aaa1a59b4453e4aec1fc704d7696321 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 9 Feb 2016 13:20:39 -0500 Subject: [PATCH 241/255] cmCurl: Fix compilation with system curl versions prior to 7.21.5 This version introduced CURLE_NOT_BUILT_IN which we have used since commit v3.4.0-rc1~211^2~4 (cmCurl: Tolerate lack of CURLOPT_CAPATH support, 2015-08-12). For older versions, just define the name to the then-unused error code so that we can compile. --- Source/cmCurl.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Source/cmCurl.cxx b/Source/cmCurl.cxx index ad0c7d3e2..4f3d89083 100644 --- a/Source/cmCurl.cxx +++ b/Source/cmCurl.cxx @@ -12,6 +12,11 @@ #include "cmCurl.h" #include "cmSystemTools.h" +// curl versions before 7.21.5 did not provide this error code +#if defined(LIBCURL_VERSION_NUM) && LIBCURL_VERSION_NUM < 0x071505 +# define CURLE_NOT_BUILT_IN 4 +#endif + #define check_curl_result(result, errstr) \ if (result != CURLE_OK && result != CURLE_NOT_BUILT_IN) \ { \ From 8d1b37a2b207956c05e017645de3681a077d0a5b Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 10 Feb 2016 09:23:57 -0500 Subject: [PATCH 242/255] CMake 3.5.0-rc2 --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index e4f44b7f1..58eb1fc48 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,4 +2,4 @@ set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 5) set(CMake_VERSION_PATCH 0) -set(CMake_VERSION_RC 1) +set(CMake_VERSION_RC 2) From 878632c90e4811ed08e5d1c298de8ae61d79f620 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 11 Feb 2016 09:52:37 -0500 Subject: [PATCH 243/255] Help: Add release note about Xcode escaping fix (#15969) The fix in commit v3.5.0-rc1~84^2 (Xcode: Escape all backslashes in strings, 2015-12-27) is a change in behavior that can break existing projects that worked around the inconsistency with other generators. Add a release note to call attention to this change in behavior. --- Help/release/3.5.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Help/release/3.5.rst b/Help/release/3.5.rst index 3d1e3b4aa..62703b32c 100644 --- a/Help/release/3.5.rst +++ b/Help/release/3.5.rst @@ -167,6 +167,12 @@ Deprecated and Removed Features may break scripts that worked around the bug with their own extra quoting or escaping. +* The :generator:`Xcode` generator was fixed to escape backslashes in + strings consistently with other generators. Projects that previously + worked around the inconsistecy with an extra level of backslashes + conditioned on the Xcode generator must be updated to remove the + workaround for CMake 3.5 and greater. + Other Changes ============= From da490e11599e7948bb0a3ed3a53cdf5f80253b2d Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 12 Feb 2016 10:15:11 -0500 Subject: [PATCH 244/255] cmake-gui: Fix cmState initialization when changing generators (#15959) Refactoring in commit v3.3.0-rc1~29^2~1 (cmState: Host some state from the cmGlobalGenerator, 2015-05-24) moved storage of some generator traits over to cmState. However, it accidentally removed initialization of the values from the cmGlobalGenerator constructor. This is needed because generator subclasses update the settings in their constructors. Since a single cmState instance is shared across multiple build trees by cmake-gui, initializing the values in its constructor is not enough. Fix this by restoring the needed initializations to the cmGlobalGenerator constructor. --- Source/cmGlobalGenerator.cxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index d7bec4492..7ffd5af5f 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -86,6 +86,13 @@ cmGlobalGenerator::cmGlobalGenerator(cmake* cm) this->TryCompileOuterMakefile = 0; this->ConfigureDoneCMP0026AndCMP0024 = false; + + cm->GetState()->SetMinGWMake(false); + cm->GetState()->SetMSYSShell(false); + cm->GetState()->SetNMake(false); + cm->GetState()->SetWatcomWMake(false); + cm->GetState()->SetWindowsShell(false); + cm->GetState()->SetWindowsVSIDE(false); } cmGlobalGenerator::~cmGlobalGenerator() From c8c45a2c4e10715e5cf05acaa0ac2c80f28b9a6a Mon Sep 17 00:00:00 2001 From: Dimitar Yordanov Date: Fri, 12 Feb 2016 13:21:12 +0100 Subject: [PATCH 245/255] cmake_parse_arguments: Restore ;-list argument flattening The re-implementation in commit v3.5.0-rc1~116^2~1 (CMakeParseArguments: replace by native cmake_parse_arguments command, 2015-12-05) introduced a regression when parsing the ARGN arguments with cmake_parse_arguments. The original implementation used foreach(currentArg ${ARGN}) to iterate over input arguments. This flattened ;-lists within the arguments whether they were quoted or not. Fix our new implementation to preserve this behavior and add a test case to cover it. Signed-off-by: Dimitar Yordanov Signed-off-by: Matthias Maennich --- Source/cmParseArgumentsCommand.cxx | 12 ++++++++++-- .../cmake_parse_arguments/CornerCases.cmake | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/Source/cmParseArgumentsCommand.cxx b/Source/cmParseArgumentsCommand.cxx index a86196515..ca76c889d 100644 --- a/Source/cmParseArgumentsCommand.cxx +++ b/Source/cmParseArgumentsCommand.cxx @@ -97,10 +97,18 @@ bool cmParseArgumentsCommand } insideValues = NONE; std::string currentArgName; - // now iterate over the remaining arguments - // and fill in the values where applicable + // Flatten ;-lists in the arguments into a single list as was done + // by the original function(CMAKE_PARSE_ARGUMENTS). + list.clear(); for(; argIter != argEnd; ++argIter) { + cmSystemTools::ExpandListArgument(*argIter, list); + } + + // iterate over the arguments list and fill in the values where applicable + for (argIter = list.begin(), argEnd = list.end(); + argIter != argEnd; ++argIter) + { const options_map::iterator optIter = options.find(*argIter); if (optIter != options.end()) { diff --git a/Tests/RunCMake/cmake_parse_arguments/CornerCases.cmake b/Tests/RunCMake/cmake_parse_arguments/CornerCases.cmake index 9a727dd00..72c82abce 100644 --- a/Tests/RunCMake/cmake_parse_arguments/CornerCases.cmake +++ b/Tests/RunCMake/cmake_parse_arguments/CornerCases.cmake @@ -13,3 +13,22 @@ cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" TEST(MY_INSTALL_DESTINATION UNDEFINED) TEST(MY_INSTALL_OPTIONAL TRUE) + +macro(foo) + set(_options ) + set(_oneValueArgs FOO) + set(_multiValueArgs ) + cmake_parse_arguments(_FOO2 "${_options}" + "${_oneValueArgs}" + "${_multiValueArgs}" + "${ARGN}") + cmake_parse_arguments(_FOO1 "${_options}" + "${_oneValueArgs}" + "${_multiValueArgs}" + ${ARGN}) +endmacro() + +foo(FOO foo) + +TEST(_FOO1_FOO foo) +TEST(_FOO2_FOO foo) From beaa4fa5ddba4298dfc94b38e1695bac28ea5faf Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 17 Feb 2016 09:14:20 -0500 Subject: [PATCH 246/255] CMakeForceCompiler: De-deprecate until more use cases have alternatives We deprecated this module in commit v3.5.0-rc1~295^2 (CMakeForceCompiler: Deprecate this module and its macros, 2015-10-19) in order to determine whether anyone still has use cases that require it. Indeed we still need to provide a way to work with toolchains that cannot link binaries without special flags. Remove the deprecation warnings until we can provide an alternative to the module for this use case. --- Help/release/3.5.rst | 3 --- Modules/CMakeForceCompiler.cmake | 16 +++++++++------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Help/release/3.5.rst b/Help/release/3.5.rst index 62703b32c..009eb3c7c 100644 --- a/Help/release/3.5.rst +++ b/Help/release/3.5.rst @@ -159,9 +159,6 @@ Other Deprecated and Removed Features =============================== -* The :module:`CMakeForceCompiler` module and its macros are now deprecated. - See module documentation for an explanation. - * The :manual:`cmake(1)` ``-E time`` command now properly passes arguments with spaces or special characters through to the child process. This may break scripts that worked around the bug with their own extra diff --git a/Modules/CMakeForceCompiler.cmake b/Modules/CMakeForceCompiler.cmake index 343ab3fe9..faa0dc58c 100644 --- a/Modules/CMakeForceCompiler.cmake +++ b/Modules/CMakeForceCompiler.cmake @@ -2,7 +2,9 @@ # CMakeForceCompiler # ------------------ # -# Deprecated. Do not use. +# Discouraged. Avoid using this module if possible. It will be deprecated +# by a future version of CMake once alternatives have been provided for all +# toolchain file use cases. # # The macros provided by this module were once intended for use by # cross-compiling toolchain files when CMake was not able to automatically @@ -12,6 +14,12 @@ # CMake detects from a compiler is now too extensive to be provided by # toolchain files using these macros. # +# The only known remaining use case for these macros is to write toolchain +# files for cross-compilers that cannot link binaries without special flags or +# custom linker scripts. These macros cause CMake to skip checks it normally +# performs as part of enabling a language and introspecting the toolchain. +# However, skipping these checks may limit some generation functionality. +# # ------------------------------------------------------------------------- # # Macro CMAKE_FORCE_C_COMPILER has the following signature: @@ -70,8 +78,6 @@ # License text for the above reference.) macro(CMAKE_FORCE_C_COMPILER compiler id) - message(DEPRECATION "The CMAKE_FORCE_C_COMPILER macro is deprecated. " - "Instead just set CMAKE_C_COMPILER and allow CMake to identify the compiler.") set(CMAKE_C_COMPILER "${compiler}") set(CMAKE_C_COMPILER_ID_RUN TRUE) set(CMAKE_C_COMPILER_ID ${id}) @@ -84,8 +90,6 @@ macro(CMAKE_FORCE_C_COMPILER compiler id) endmacro() macro(CMAKE_FORCE_CXX_COMPILER compiler id) - message(DEPRECATION "The CMAKE_FORCE_CXX_COMPILER macro is deprecated. " - "Instead just set CMAKE_CXX_COMPILER and allow CMake to identify the compiler.") set(CMAKE_CXX_COMPILER "${compiler}") set(CMAKE_CXX_COMPILER_ID_RUN TRUE) set(CMAKE_CXX_COMPILER_ID ${id}) @@ -98,8 +102,6 @@ macro(CMAKE_FORCE_CXX_COMPILER compiler id) endmacro() macro(CMAKE_FORCE_Fortran_COMPILER compiler id) - message(DEPRECATION "The CMAKE_FORCE_Fortran_COMPILER macro is deprecated. " - "Instead just set CMAKE_Fortran_COMPILER and allow CMake to identify the compiler.") set(CMAKE_Fortran_COMPILER "${compiler}") set(CMAKE_Fortran_COMPILER_ID_RUN TRUE) set(CMAKE_Fortran_COMPILER_ID ${id}) From 70f2708fa58da21ef19986872aee530a84cc9ad0 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 17 Feb 2016 10:11:01 -0500 Subject: [PATCH 247/255] Help: Clarify install(TARGETS) INCLUDES DESTINATION option The option does not actually participate in argument groups like the others because it does not actually install anything. Fix the order in the documentation accordingly. Reported-by: Daniel Wirtz --- Help/command/install.rst | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Help/command/install.rst b/Help/command/install.rst index 5d2add7ed..45167bc19 100644 --- a/Help/command/install.rst +++ b/Help/command/install.rst @@ -72,12 +72,13 @@ Installing Targets [[ARCHIVE|LIBRARY|RUNTIME|FRAMEWORK|BUNDLE| PRIVATE_HEADER|PUBLIC_HEADER|RESOURCE] [DESTINATION ] - [INCLUDES DESTINATION [ ...]] [PERMISSIONS permissions...] [CONFIGURATIONS [Debug|Release|...]] [COMPONENT ] [OPTIONAL] [NAMELINK_ONLY|NAMELINK_SKIP] - ] [...]) + ] [...] + [INCLUDES DESTINATION [ ...]] + ) The ``TARGETS`` form specifies rules for installing targets from a project. There are five kinds of target files that may be installed: @@ -97,11 +98,7 @@ change the type of target to which the subsequent properties apply. If none is given the installation properties apply to all target types. If only one is given then only targets of that type will be installed (which can be used to install just a DLL or just an import -library). The ``INCLUDES DESTINATION`` specifies a list of directories -which will be added to the :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` -target property of the ```` when exported by the -:command:`install(EXPORT)` command. If a relative path is -specified, it is treated as relative to the ``$``. +library). The ``PRIVATE_HEADER``, ``PUBLIC_HEADER``, and ``RESOURCE`` arguments cause subsequent properties to be applied to installing a ``FRAMEWORK`` @@ -131,6 +128,14 @@ option installs nothing. See the :prop_tgt:`VERSION` and :prop_tgt:`SOVERSION` target properties for details on creating versioned shared libraries. +The ``INCLUDES DESTINATION`` specifies a list of directories +which will be added to the :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` +target property of the ```` when exported by the +:command:`install(EXPORT)` command. If a relative path is +specified, it is treated as relative to the ``$``. +This is independent of the rest of the argument groups and does +not actually install anything. + One or more groups of properties may be specified in a single call to the ``TARGETS`` form of this command. A target may be installed more than once to different locations. Consider hypothetical targets ``myExe``, From 87f44b7525ebc9761b32b98f0c9e1276431e6ec1 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 17 Feb 2016 13:34:15 -0500 Subject: [PATCH 248/255] Fix export of STATIC library PRIVATE non-target dependencies In commit v3.5.0-rc1~43^2 (Fix export of STATIC library PRIVATE dependencies with CMP0022 NEW, 2016-01-15) we taught target_link_libraries to generate `$>` in INTERFACE_LINK_LIBRARIES instead of `$` so that `dep` can be recognized as a target name and updated during export. However, this approach does not work when `dep` is just a plain library name and not a target because `$` requires the name of a reachable target. Since we do not know during target_link_libraries whether the name will correspond to a reachable target or not, we cannot inject the `$` expression. Revert this change and solve the original problem instead by teaching the export logic to recognize and update target names directly in `$` expressions. Reported-by: Ben Boeckel --- Source/cmExportFileGenerator.cxx | 21 +++++++++++++++++++ Source/cmTargetLinkLibrariesCommand.cxx | 7 ++----- .../target_link_libraries/RunCMakeTest.cmake | 2 ++ .../StaticPrivateDepNotExported-result.txt | 1 + .../StaticPrivateDepNotExported-stderr.txt | 1 + .../StaticPrivateDepNotExported.cmake | 7 +++++++ .../StaticPrivateDepNotTarget.cmake | 6 ++++++ 7 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported-result.txt create mode 100644 Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported-stderr.txt create mode 100644 Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported.cmake create mode 100644 Tests/RunCMake/target_link_libraries/StaticPrivateDepNotTarget.cmake diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index e8a2e6a52..c005995f7 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -772,6 +772,27 @@ cmExportFileGenerator::ResolveTargetsInGeneratorExpression( lastPos = endPos; } + pos = 0; + lastPos = pos; + while (errorString.empty() && + (pos = input.find("$", nameStartPos); + if (endPos == input.npos) + { + errorString = "$ expression incomplete"; + break; + } + std::string libName = input.substr(nameStartPos, endPos - nameStartPos); + if (cmGeneratorExpression::IsValidTargetName(libName) && + this->AddTargetNamespace(libName, target, missingTargets)) + { + input.replace(nameStartPos, endPos - nameStartPos, libName); + } + lastPos = nameStartPos + libName.size() + 1; + } + this->ReplaceInstallPrefix(input); if (!errorString.empty()) diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index 5f3246ace..435346a30 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -432,11 +432,8 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, { std::string configLib = this->Target ->GetDebugGeneratorExpressions(lib, llt); - if (cmGeneratorExpression::IsValidTargetName(configLib)) - { - configLib = "$>"; - } - else if (cmGeneratorExpression::Find(configLib) != std::string::npos) + if (cmGeneratorExpression::IsValidTargetName(lib) + || cmGeneratorExpression::Find(lib) != std::string::npos) { configLib = "$"; } diff --git a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake index 8307607bc..1466fbf61 100644 --- a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake @@ -8,3 +8,5 @@ run_cmake(MixedSignature) run_cmake(Separate-PRIVATE-LINK_PRIVATE-uses) run_cmake(SubDirTarget) run_cmake(SharedDepNotTarget) +run_cmake(StaticPrivateDepNotExported) +run_cmake(StaticPrivateDepNotTarget) diff --git a/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported-result.txt b/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported-stderr.txt b/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported-stderr.txt new file mode 100644 index 000000000..6bb44ab4b --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported-stderr.txt @@ -0,0 +1 @@ +CMake Error: install\(EXPORT "Exp" ...\) includes target "foo" which requires target "not_exported" that is not in the export set. diff --git a/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported.cmake b/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported.cmake new file mode 100644 index 000000000..9b97918a5 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotExported.cmake @@ -0,0 +1,7 @@ +cmake_policy(SET CMP0022 NEW) +enable_language(C) +add_library(foo STATIC empty.c) +add_library(not_exported STATIC empty.c) +target_link_libraries(foo PRIVATE not_exported) +install(TARGETS foo EXPORT Exp DESTINATION lib) +install(EXPORT Exp DESTINATION lib/cmake/Exp) diff --git a/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotTarget.cmake b/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotTarget.cmake new file mode 100644 index 000000000..7122ae91e --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/StaticPrivateDepNotTarget.cmake @@ -0,0 +1,6 @@ +cmake_policy(SET CMP0022 NEW) +enable_language(C) +add_library(foo STATIC empty.c) +target_link_libraries(foo PRIVATE not_a_target) +install(TARGETS foo EXPORT Exp DESTINATION lib) +install(EXPORT Exp DESTINATION lib/cmake/Exp) From 1911cda03efc71f97e610e0b593282c835f2d4f4 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 17 Feb 2016 15:14:22 -0500 Subject: [PATCH 249/255] FindCUDA: Fix regression under Visual Studio generators Since commit v3.5.0-rc1~47^2 (FindCUDA: Support special characters in path, 2016-01-15) our add_custom_command calls use VERBATIM so that CMake will automatically quote special characters correctly. However, this breaks the special `$(VCInstallDir)` placeholder used with Visual Studio generators. Since we do not support preservation of such placeholders with VERBATIM (see issue #15001) we must fall back to not using VERBATIM when the placeholder is used. A better fix would be to stop using `$(VCInstallDir)` and use the value of `CMAKE_${CUDA_C_OR_CXX}_COMPILER` instead, but that will require additional semantic and documentation changes. For now simply fix the regression with the above approach. Reported-by: Stephen Sorley --- Modules/FindCUDA.cmake | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 1674e2dcf..47c03f32a 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -1456,6 +1456,11 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) set(cuda_build_comment_string "Building NVCC (${cuda_build_type}) object ${generated_file_relative_path}") endif() + set(_verbatim VERBATIM) + if(ccbin_flags MATCHES "\\$\\(VCInstallDir\\)") + set(_verbatim "") + endif() + # Build the generated file and dependency file ########################## add_custom_command( OUTPUT ${generated_file} @@ -1474,7 +1479,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) -P "${custom_target_script}" WORKING_DIRECTORY "${cuda_compile_intermediate_directory}" COMMENT "${cuda_build_comment_string}" - VERBATIM + ${_verbatim} ) # Make sure the build system knows the file is generated. @@ -1586,6 +1591,11 @@ function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options set(do_obj_build_rule FALSE) endif() + set(_verbatim VERBATIM) + if(nvcc_flags MATCHES "\\$\\(VCInstallDir\\)") + set(_verbatim "") + endif() + if (do_obj_build_rule) add_custom_command( OUTPUT ${output_file} @@ -1593,7 +1603,7 @@ function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options COMMAND ${CUDA_NVCC_EXECUTABLE} ${nvcc_flags} -dlink ${object_files} -o ${output_file} ${flags} COMMENT "Building NVCC intermediate link file ${output_file_relative_path}" - VERBATIM + ${_verbatim} ) else() get_filename_component(output_file_dir "${output_file}" DIRECTORY) @@ -1603,7 +1613,7 @@ function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options COMMAND ${CMAKE_COMMAND} -E echo "Building NVCC intermediate link file ${output_file_relative_path}" COMMAND ${CMAKE_COMMAND} -E make_directory "${output_file_dir}" COMMAND ${CUDA_NVCC_EXECUTABLE} ${nvcc_flags} ${flags} -dlink ${object_files} -o "${output_file}" - VERBATIM + ${_verbatim} ) endif() endif() From d203761520f5dd21a9cc4de5c4ca0d0e4e188e34 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 18 Feb 2016 10:41:26 -0500 Subject: [PATCH 250/255] CMake 3.5.0-rc3 --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 58eb1fc48..0c19881c2 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,4 +2,4 @@ set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 5) set(CMake_VERSION_PATCH 0) -set(CMake_VERSION_RC 2) +set(CMake_VERSION_RC 3) From b347503028a639103f27fcd2752b133993bb30ec Mon Sep 17 00:00:00 2001 From: Bartosz Kosiorek Date: Fri, 19 Feb 2016 17:48:20 +0100 Subject: [PATCH 251/255] Help: Clarify `cmake -E` command behavior with respect to file existence --- Help/manual/cmake.1.rst | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index 91af3e3db..92f52302c 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -199,16 +199,19 @@ Available commands are: ``make_directory ...`` Create ```` directories. If necessary, create parent - directories too. + directories too. If a directory already exists it will be + silently ignored. ``md5sum ...`` Compute md5sum of files. ``remove [-f] ...`` - Remove the file(s), use ``-f`` to force it. + Remove the file(s), use ``-f`` to force it. If a file does + not exist it will be silently ignored. ``remove_directory `` - Remove a directory and its contents. + Remove a directory and its contents. If a directory does + not exist it will be silently ignored. ``rename `` Rename a file or directory (on one volume). @@ -241,7 +244,8 @@ Available commands are: Touch a file. ``touch_nocreate `` - Touch a file if it exists but do not create it. + Touch a file if it exists but do not create it. If a file does + not exist it will be silently ignored. UNIX-specific Command-Line Tools -------------------------------- From 33507e2aa71cf0677361e0d01344f8186fcde5ad Mon Sep 17 00:00:00 2001 From: Ashley Whetter Date: Sun, 21 Feb 2016 15:17:07 +0000 Subject: [PATCH 252/255] Help: Fix typos in cmake-packages.7 manual --- Help/manual/cmake-packages.7.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Help/manual/cmake-packages.7.rst b/Help/manual/cmake-packages.7.rst index b9073a57c..aebc5d952 100644 --- a/Help/manual/cmake-packages.7.rst +++ b/Help/manual/cmake-packages.7.rst @@ -89,7 +89,7 @@ a package is to set the ``CMAKE_PREFIX_PATH`` cache variable. Config-file packages are provided by upstream vendors as part of development packages, that is, they belong with the header files and any other files -provided to assist downsteams in using the package. +provided to assist downstreams in using the package. A set of variables which provide package status information are also set automatically when using a config-file package. The ``_FOUND`` @@ -352,7 +352,7 @@ version-specific variables ``_VERSION``, ``_VERSION_MAJOR``, used to export the targets in the ``ClimbingStatsTargets`` export-set, defined previously by the :command:`install(TARGETS)` command. This command generates the ``ClimbingStatsTargets.cmake`` file to contain :prop_tgt:`IMPORTED` -targets, suitable for use by downsteams and arranges to install it to +targets, suitable for use by downstreams and arranges to install it to ``lib/cmake/ClimbingStats``. The generated ``ClimbingStatsConfigVersion.cmake`` and a ``cmake/ClimbingStatsConfig.cmake`` are installed to the same location, completing the package. @@ -383,7 +383,7 @@ In this case, when using :command:`install(TARGETS)` the ``INCLUDES DESTINATION` was specified. This causes the ``IMPORTED`` targets to have their :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` populated with the ``include`` directory in the :variable:`CMAKE_INSTALL_PREFIX`. When the ``IMPORTED`` -target is used by downsteam, it automatically consumes the entries from +target is used by downstream, it automatically consumes the entries from that property. Creating a Package Configuration File @@ -412,7 +412,7 @@ This can also be extended to cover dependencies: target_link_libraries(ClimbingStats PUBLIC Stats::Types) As the ``Stats::Types`` target is a ``PUBLIC`` dependency of ``ClimbingStats``, -downsteams must also find the ``Stats`` package and link to the ``Stats::Types`` +downstreams must also find the ``Stats`` package and link to the ``Stats::Types`` library. The ``Stats`` package should be found in the ``ClimbingStatsConfig.cmake`` file to ensure this. The ``find_dependency`` macro from the :module:`CMakeFindDependencyMacro` helps with this by propagating @@ -464,7 +464,7 @@ Creating a Package Configuration File for the Build Tree The :command:`export(EXPORT)` command creates an :prop_tgt:`IMPORTED` targets definition file which is specific to the build-tree, and is not relocatable. -This can similiarly be used with a suitable package configuration file and +This can similarly be used with a suitable package configuration file and package version file to define a package for the build tree which may be used without installation. Consumers of the build tree can simply ensure that the :variable:`CMAKE_PREFIX_PATH` contains the build directory, or set the From 3aa6fea69c0bd1614e13a67eb23ca033c0fe1795 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 24 Feb 2016 12:15:48 -0500 Subject: [PATCH 253/255] VS: Fix VS 2015 .vcxproj debug setting for older toolsets (#15986) Since commit v3.4.2~2^2 (VS: Fix VS 2015 .vcxproj file value for GenerateDebugInformation, 2016-01-08) we generate invalid project files for the v110 and v120 toolsets. VS complains: C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(639,9): error MSB4030: "Debug" is an invalid value for the "GenerateDebugInformation" parameter of the "Link" task. The "GenerateDebugInformation" parameter is of type "System.Boolean". This reveals that our VS flag map selection should be based on the toolset instead of the version of VS. However, that will be a non-trivial change so for now fix this particular use case by hard-coding a correction to the flag map. Reported-by: Gregor Jasny --- Source/cmVisualStudio10TargetGenerator.cxx | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 6b4677391..c9c09fdfd 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2661,6 +2661,34 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config) } } + // Hack to fix flag version selection in a common use case. + // FIXME: Select flag table based on toolset instead of VS version. + if (this->LocalGenerator->GetVersion() >= + cmGlobalVisualStudioGenerator::VS14) + { + cmGlobalVisualStudio10Generator* gg = + static_cast(this->GlobalGenerator); + const char* toolset = gg->GetPlatformToolset(); + if (toolset && + (cmHasLiteralPrefix(toolset, "v100") || + cmHasLiteralPrefix(toolset, "v110") || + cmHasLiteralPrefix(toolset, "v120"))) + { + if (const char* debug = linkOptions.GetFlag("GenerateDebugInformation")) + { + // Convert value from enumeration back to boolean for older toolsets. + if (strcmp(debug, "No") == 0) + { + linkOptions.AddFlag("GenerateDebugInformation", "false"); + } + else if (strcmp(debug, "Debug") == 0) + { + linkOptions.AddFlag("GenerateDebugInformation", "true"); + } + } + } + } + this->LinkOptions[config] = pOptions.release(); return true; } From 743f2a803143e8947df007048bdd3780722ead58 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 7 Mar 2016 10:56:31 -0500 Subject: [PATCH 254/255] FindPython{Interp,Libs}: Clarify recommended call order Improve wording in our advice about how to call both of these modules. --- Modules/FindPythonInterp.cmake | 7 ++++--- Modules/FindPythonLibs.cmake | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake index 879192eb3..e194185f2 100644 --- a/Modules/FindPythonInterp.cmake +++ b/Modules/FindPythonInterp.cmake @@ -28,9 +28,10 @@ # for Python. You need to set this variable before calling # find_package(PythonInterp). # -# If also calling find_package(PythonLibs), call find_package(PythonInterp) -# first to get the currently active Python version by default with a consistent -# version of PYTHON_LIBRARIES. +# If calling both ``find_package(PythonInterp)`` and +# ``find_package(PythonLibs)``, call ``find_package(PythonInterp)`` first to +# get the currently active Python version by default with a consistent version +# of PYTHON_LIBRARIES. #============================================================================= # Copyright 2005-2010 Kitware, Inc. diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake index 68e1228ee..ab92f8683 100644 --- a/Modules/FindPythonLibs.cmake +++ b/Modules/FindPythonLibs.cmake @@ -32,9 +32,10 @@ # PYTHON_LIBRARY - path to the python library # PYTHON_INCLUDE_DIR - path to where Python.h is found # -# If also calling find_package(PythonInterp), call find_package(PythonInterp) -# first to get the currently active Python version by default with a consistent -# version of PYTHON_LIBRARIES. +# If calling both ``find_package(PythonInterp)`` and +# ``find_package(PythonLibs)``, call ``find_package(PythonInterp)`` first to +# get the currently active Python version by default with a consistent version +# of PYTHON_LIBRARIES. #============================================================================= # Copyright 2001-2009 Kitware, Inc. From b369959eb55dbea601315530185cb480c922cc77 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 8 Mar 2016 08:44:49 -0500 Subject: [PATCH 255/255] CMake 3.5.0 --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 0c19881c2..129a882b3 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,4 +2,4 @@ set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 5) set(CMake_VERSION_PATCH 0) -set(CMake_VERSION_RC 3) +#set(CMake_VERSION_RC 0)