diff options
67 files changed, 1423 insertions, 209 deletions
diff --git a/Help/manual/OPTIONS_BUILD.txt b/Help/manual/OPTIONS_BUILD.txt index 4207db4..977264c 100644 --- a/Help/manual/OPTIONS_BUILD.txt +++ b/Help/manual/OPTIONS_BUILD.txt @@ -77,10 +77,23 @@ Suppress developer warnings. Suppress warnings that are meant for the author of the - CMakeLists.txt files. + CMakeLists.txt files. By default this will also turn off + deprecation warnings. ``-Wdev`` Enable developer warnings. Enable warnings that are meant for the author of the CMakeLists.txt - files. + files. By default this will also turn on deprecation warnings. + +``-Wdeprecated`` + Enable deprecated functionality warnings. + + Enable warnings for usage of deprecated functionality, that are meant + for the author of the CMakeLists.txt files. + +``-Wno-deprecated`` + Suppress deprecated functionality warnings. + + Suppress warnings for usage of deprecated functionality, that are meant + for the author of the CMakeLists.txt files. diff --git a/Help/prop_tgt/MACOSX_BUNDLE.rst b/Help/prop_tgt/MACOSX_BUNDLE.rst index 8d7d914..7cd8046 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 41bb8cc..1f9a036 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 5dad3ea..d837f7b 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. - -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. +Specify resource files in a :prop_tgt:`FRAMEWORK` or :prop_tgt:`BUNDLE`. + +Target marked with the :prop_tgt:`FRAMEWORK` or :prop_tgt:`BUNDLE` property +generate framework or application bundle (both OS X and iOS is supported) +or normal shared libraries on other platforms. +This property may be set to a list of files to be placed in the corresponding +directory (eg. ``Resources`` directory for OS X) inside the bundle. +On non-Apple platforms these files may be installed using the ``RESOURCE`` +option to the ``install(TARGETS)`` command. + +Following example of Application Bundle: + +.. code-block:: cmake + + add_executable(ExecutableTarget + addDemo.c + resourcefile.txt + appresourcedir/appres.txt + ) + + target_link_libraries(ExecutableTarget heymath mul) + + set(RESOURCE_FILES + resourcefile.txt + appresourcedir/appres.txt + ) + + set_target_properties(ExecutableTarget PROPERTIES + MACOSX_BUNDLE TRUE + MACOSX_FRAMEWORK_IDENTIFIER org.cmake.ExecutableTarget + RESOURCE "${RESOURCE_FILES}" + ) + +will produce flat structure for iOS systems:: + + ExecutableTarget.app + appres.txt + ExecutableTarget + Info.plist + resourcefile.txt + +For OS X systems it will produce following directory structure:: + + ExecutableTarget.app/ + Contents + Info.plist + MacOS + ExecutableTarget + Resources + appres.txt + resourcefile.txt + +For Linux, such cmake script produce following files:: + + ExecutableTarget + Resources + appres.txt + resourcefile.txt diff --git a/Help/release/dev/FindBoost-imported-targets.rst b/Help/release/dev/FindBoost-imported-targets.rst new file mode 100644 index 0000000..1129ded --- /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``. diff --git a/Help/release/dev/cmake-W-options.rst b/Help/release/dev/cmake-W-options.rst new file mode 100644 index 0000000..57d375f --- /dev/null +++ b/Help/release/dev/cmake-W-options.rst @@ -0,0 +1,12 @@ +cmake-W-options +--------------- + +* The :variable:`CMAKE_WARN_DEPRECATED` variable can now be set using the + ``-Wdeprecated`` and ``-Wno-deprecated`` :manual:`cmake(1)` options. + +* The ``-Wdev`` and ``-Wno-dev`` :manual:`cmake(1)` options now also enable + and suppress the deprecated warnings output by default. + +* Warnings about deprecated functionality are now enabled by default. + They may be suppressed with ``-Wno-deprecated`` or by setting the + :variable:`CMAKE_WARN_DEPRECATED` variable to false. diff --git a/Help/variable/CMAKE_ERROR_DEPRECATED.rst b/Help/variable/CMAKE_ERROR_DEPRECATED.rst index 277a4cc..f3a6738 100644 --- a/Help/variable/CMAKE_ERROR_DEPRECATED.rst +++ b/Help/variable/CMAKE_ERROR_DEPRECATED.rst @@ -1,8 +1,7 @@ CMAKE_ERROR_DEPRECATED ---------------------- -Whether to issue deprecation errors for macros and functions. +Whether to issue errors for deprecated functionality. -If ``TRUE``, this can be used by macros and functions to issue fatal -errors when deprecated macros or functions are used. This variable is -``FALSE`` by default. +If ``TRUE``, use of deprecated functionality will issue fatal errors. +If this variable is not set, CMake behaves as if it were set to ``FALSE``. diff --git a/Help/variable/CMAKE_WARN_DEPRECATED.rst b/Help/variable/CMAKE_WARN_DEPRECATED.rst index 662cbd8..4a224fa 100644 --- a/Help/variable/CMAKE_WARN_DEPRECATED.rst +++ b/Help/variable/CMAKE_WARN_DEPRECATED.rst @@ -1,7 +1,10 @@ CMAKE_WARN_DEPRECATED --------------------- -Whether to issue deprecation warnings for macros and functions. +Whether to issue warnings for deprecated functionality. -If ``TRUE``, this can be used by macros and functions to issue deprecation -warnings. This variable is ``FALSE`` by default. +If not ``FALSE``, use of deprecated functionality will issue warnings. +If this variable is not set, CMake behaves as if it were set to ``TRUE``. + +When running :manual:`cmake(1)`, this option can be enabled with the +``-Wdeprecated`` option, or disabled with the ``-Wno-deprecated`` option. diff --git a/Modules/CPackDMG.cmake b/Modules/CPackDMG.cmake index 6b5af7e..e34f8cd 100644 --- a/Modules/CPackDMG.cmake +++ b/Modules/CPackDMG.cmake @@ -49,11 +49,29 @@ # .. variable:: CPACK_DMG_SLA_DIR # # Directory where license and menu files for different languages are stored. +# Setting this causes CPack to look for a ``<language>.menu.txt`` and +# ``<language>.license.txt`` file for every language defined in +# ``CPACK_DMG_SLA_LANGUAGES``. If both this variable and +# ``CPACK_RESOURCE_FILE_LICENSE`` are set, CPack will only look for the menu +# files and use the same license file for all languages. # # .. variable:: CPACK_DMG_SLA_LANGUAGES # # Languages for which a license agreement is provided when mounting the -# generated DMG. +# generated DMG. A menu file consists of 9 lines of text. The first line is +# is the name of the language itself, uppercase, in English (e.g. German). +# The other lines are translations of the following strings: +# +# - Agree +# - Disagree +# - Print +# - Save... +# - You agree to the terms of the License Agreement when you click the +# "Agree" button. +# - Software License Agreement +# - This text cannot be saved. The disk may be full or locked, or the file +# may be locked. +# - Unable to print. Make sure you have selected a printer. # # For every language in this list, CPack will try to find files # ``<language>.menu.txt`` and ``<language>.license.txt`` in the directory diff --git a/Modules/Compiler/Embarcadero-DetermineCompiler.cmake b/Modules/Compiler/Embarcadero-DetermineCompiler.cmake index 2feedac..8375624 100644 --- a/Modules/Compiler/Embarcadero-DetermineCompiler.cmake +++ b/Modules/Compiler/Embarcadero-DetermineCompiler.cmake @@ -4,4 +4,4 @@ set(_compiler_id_pp_test "defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__ set(_compiler_id_version_compute " # define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__CODEGEARC_VERSION__>>24 & 0x00FF) # define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__CODEGEARC_VERSION__>>16 & 0x00FF) -# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_HEX@(__CODEGEARC_VERSION__ & 0xFFFF)") +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__CODEGEARC_VERSION__ & 0xFFFF)") diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 33e6a49..e517a6a 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -54,6 +54,33 @@ # Boost_<C>_LIBRARY_DEBUG - Component <C> library debug variant # Boost_<C>_LIBRARY_RELEASE - Component <C> library release variant # +# The following :prop_tgt:`IMPORTED` targets are also defined:: +# +# Boost::boost - Target for header-only dependencies +# (Boost include directory) +# Boost::<C> - Target for specific component dependency +# (shared or static library); <C> 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 @@ -472,6 +507,262 @@ function(_Boost_GUESS_COMPILER_PREFIX _ret) 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() + +# +# Determine if any missing dependencies require adding to the component list. +# +# Sets _Boost_${COMPONENT}_DEPENDENCIES for each required component, +# plus _Boost_IMPORTED_TARGETS (TRUE if imported targets should be +# defined; FALSE if dependency information is unavailable). +# +# componentvar - the component list variable name +# +# +function(_Boost_MISSING_DEPENDENCIES componentvar) + # _boost_unprocessed_components - list of components requiring processing + # _boost_processed_components - components already processed (or currently being processed) + # _boost_new_components - new components discovered for future processing + # + list(APPEND _boost_unprocessed_components ${${componentvar}}) + + while(_boost_unprocessed_components) + list(APPEND _boost_processed_components ${_boost_unprocessed_components}) + foreach(component ${_boost_unprocessed_components}) + string(TOUPPER ${component} uppercomponent) + set(${_ret} ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE) + _Boost_COMPONENT_DEPENDENCIES("${component}" _Boost_${uppercomponent}_DEPENDENCIES) + set(_Boost_${uppercomponent}_DEPENDENCIES ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE) + set(_Boost_IMPORTED_TARGETS ${_Boost_IMPORTED_TARGETS} PARENT_SCOPE) + foreach(componentdep ${_Boost_${uppercomponent}_DEPENDENCIES}) + list(FIND _boost_processed_components "${componentdep}" _boost_component_found) + list(FIND _boost_new_components "${componentdep}" _boost_component_new) + if (_boost_component_found EQUAL -1 AND _boost_component_new EQUAL -1) + list(APPEND _boost_new_components ${componentdep}) + endif() + endforeach() + endforeach() + set(_boost_unprocessed_components ${_boost_new_components}) + unset(_boost_new_components) + endwhile() + set(${componentvar} ${_boost_processed_components} PARENT_SCOPE) +endfunction() + +# # End functions/macros # #------------------------------------------------------------------------------- @@ -511,6 +802,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" @@ -562,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 @@ -581,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) @@ -979,6 +1290,17 @@ if(Boost_VERSION AND Boost_FIND_COMPONENTS) endif() endif() +# Additional components may be required via component dependencies. +# Add any missing components to the list. +_Boost_MISSING_DEPENDENCIES(Boost_FIND_COMPONENTS) + +# If thread is required, get the thread libs as a dependency +list(FIND Boost_FIND_COMPONENTS thread _Boost_THREAD_DEPENDENCY_LIBS) +if(NOT _Boost_THREAD_DEPENDENCY_LIBS EQUAL -1) + include(CMakeFindDependencyMacro) + find_dependency(Threads) +endif() + # If the user changed any of our control inputs flush previous results. if(_Boost_CHANGE_LIBDIR OR _Boost_CHANGE_LIBNAME) foreach(COMPONENT ${_Boost_COMPONENTS_SEARCHED}) @@ -1222,6 +1544,70 @@ else() endif() # ------------------------------------------------------------------------ +# Add imported targets +# ------------------------------------------------------------------------ + +if(Boost_FOUND AND _Boost_IMPORTED_TARGETS) + # For header-only libraries + if(NOT TARGET Boost::boost) + add_library(Boost::boost INTERFACE IMPORTED) + if(Boost_INCLUDE_DIRS) + set_target_properties(Boost::boost PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}") + endif() + endif() + + foreach(COMPONENT ${Boost_FIND_COMPONENTS}) + if(NOT TARGET Boost::${COMPONENT}) + string(TOUPPER ${COMPONENT} UPPERCOMPONENT) + if(Boost_${UPPERCOMPONENT}_FOUND) + if(Boost_USE_STATIC_LIBS) + add_library(Boost::${COMPONENT} STATIC IMPORTED) + else() + # Even if Boost_USE_STATIC_LIBS is OFF, we might have static + # libraries as a result. + add_library(Boost::${COMPONENT} UNKNOWN IMPORTED) + endif() + if(Boost_INCLUDE_DIRS) + set_target_properties(Boost::${COMPONENT} PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}") + endif() + if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY}") + set_target_properties(Boost::${COMPONENT} PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION "${Boost_${UPPERCOMPONENT}_LIBRARY}") + endif() + if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG}") + set_property(TARGET Boost::${COMPONENT} APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(Boost::${COMPONENT} PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX" + IMPORTED_LOCATION_DEBUG "${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG}") + endif() + if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE}") + set_property(TARGET Boost::${COMPONENT} APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(Boost::${COMPONENT} PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX" + IMPORTED_LOCATION_RELEASE "${Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE}") + endif() + if(_Boost_${UPPERCOMPONENT}_DEPENDENCIES) + unset(_Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES) + foreach(dep ${_Boost_${UPPERCOMPONENT}_DEPENDENCIES}) + list(APPEND _Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES Boost::${dep}) + endforeach() + if(COMPONENT STREQUAL "thread") + list(APPEND _Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES Threads::Threads) + endif() + set_target_properties(Boost::${COMPONENT} PROPERTIES + INTERFACE_LINK_LIBRARIES "${_Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES}") + endif() + endif() + endif() + endforeach() +endif() + +# ------------------------------------------------------------------------ # Notification to end user about what was found # ------------------------------------------------------------------------ diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index 8205425..4f4efbc 100644 --- a/Modules/GenerateExportHeader.cmake +++ b/Modules/GenerateExportHeader.cmake @@ -230,7 +230,11 @@ macro(_test_compiler_hidden_visibility) endmacro() macro(_test_compiler_has_deprecated) + # NOTE: Some Embarcadero compilers silently compile __declspec(deprecated) + # without error, but this is not a documented feature and the attribute does + # not actually generate any warnings. if(CMAKE_CXX_COMPILER_ID MATCHES Borland + OR CMAKE_CXX_COMPILER_ID MATCHES Embarcadero OR CMAKE_CXX_COMPILER_ID MATCHES HP OR GCC_TOO_OLD OR CMAKE_CXX_COMPILER_ID MATCHES PGI diff --git a/Modules/Platform/Windows-Embarcadero.cmake b/Modules/Platform/Windows-Embarcadero.cmake index 5295a48e..102e3a6 100644 --- a/Modules/Platform/Windows-Embarcadero.cmake +++ b/Modules/Platform/Windows-Embarcadero.cmake @@ -78,7 +78,11 @@ set (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_SHARED_LINKER_FLAGS_R # invocations within a single working directory. if(NOT DEFINED CMAKE_JOB_POOL_LINK) set(CMAKE_JOB_POOL_LINK BCC32LinkPool) - set_property(GLOBAL APPEND PROPERTY JOB_POOLS BCC32LinkPool=1) + get_property(_bccjp GLOBAL PROPERTY JOB_POOLS) + if(NOT _bccjp MATCHES "BCC32LinkPool=") + set_property(GLOBAL APPEND PROPERTY JOB_POOLS BCC32LinkPool=1) + endif() + unset(_bccjp) endif() macro(__embarcadero_language lang) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 51664fa..81d33c2 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 20151129) +set(CMake_VERSION_PATCH 20151204) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index b5df2d0..1a694ea 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -69,6 +69,7 @@ static const char* SLASTREnglish = //---------------------------------------------------------------------- cmCPackDragNDropGenerator::cmCPackDragNDropGenerator() + : singleLicense(false) { // default to one package file for components this->componentPackageMethod = ONE_PACKAGE; @@ -131,10 +132,11 @@ int cmCPackDragNDropGenerator::InitializeInternal() if(!license_file.empty() && (license_file.find("CPack.GenericLicense.txt") == std::string::npos)) { - cmCPackLogger(cmCPackLog::LOG_WARNING, + cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Both CPACK_DMG_SLA_DIR and CPACK_RESOURCE_FILE_LICENSE specified, " - "defaulting to CPACK_DMG_SLA_DIR" + "using CPACK_RESOURCE_FILE_LICENSE as a license for all languages." << std::endl); + singleLicense = true; } } if(!this->IsSet("CPACK_DMG_SLA_LANGUAGES")) @@ -166,7 +168,7 @@ int cmCPackDragNDropGenerator::InitializeInternal() for(size_t i = 0; i < languages.size(); ++i) { std::string license = slaDirectory + "/" + languages[i] + ".license.txt"; - if (!cmSystemTools::FileExists(license)) + if (!singleLicense && !cmSystemTools::FileExists(license)) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Missing license file " << languages[i] << ".license.txt" @@ -366,7 +368,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, // use sla_dir if both sla_dir and license_file are set if(!cpack_license_file.empty() && - !slaDirectory.empty()) + !slaDirectory.empty() && !singleLicense) { cpack_license_file = ""; } @@ -699,7 +701,14 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, { for(size_t i = 0; i < languages.size(); ++i) { - WriteLicense(ofs, i + 5000, languages[i]); + if(singleLicense) + { + WriteLicense(ofs, i + 5000, languages[i], cpack_license_file); + } + else + { + WriteLicense(ofs, i + 5000, languages[i]); + } } } @@ -850,7 +859,7 @@ void cmCPackDragNDropGenerator::WriteLicense(cmGeneratedFileStream& outputStream, int licenseNumber, std::string licenseLanguage, std::string licenseFile) { - if(!licenseFile.empty()) + if(!licenseFile.empty() && !singleLicense) { licenseNumber = 5002; licenseLanguage = "English"; @@ -887,7 +896,7 @@ cmCPackDragNDropGenerator::WriteLicense(cmGeneratedFileStream& outputStream, // End of License outputStream << "};\n\n"; - if(!licenseFile.empty()) + if(!licenseFile.empty() && !singleLicense) { outputStream << SLASTREnglish; } diff --git a/Source/CPack/cmCPackDragNDropGenerator.h b/Source/CPack/cmCPackDragNDropGenerator.h index 53d38c4..b5e5ffe 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.h +++ b/Source/CPack/cmCPackDragNDropGenerator.h @@ -48,6 +48,7 @@ protected: private: std::string slaDirectory; + bool singleLicense; void WriteLicense(cmGeneratedFileStream& outputStream, int licenseNumber, std::string licenseLanguage, std::string licenseFile = ""); diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index cc424b4..b05fb41 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/Source/cmLinkedTree.h b/Source/cmLinkedTree.h index 721a246..3b41459 100644 --- a/Source/cmLinkedTree.h +++ b/Source/cmLinkedTree.h @@ -24,7 +24,7 @@ needs of the cmState. For example, the Truncate() method is a specific requirement of the cmState. - An empty cmLinkedTree provides a Root() method, and an Extend() method, + An empty cmLinkedTree provides a Root() method, and an Push() method, each of which return iterators. A Tree can be built up by extending from the root, and then extending from any other iterator. @@ -142,16 +142,37 @@ public: return iterator(const_cast<cmLinkedTree*>(this), 0); } - iterator Extend(iterator it) + iterator Push(iterator it) { - return Extend_impl(it, T()); + return Push_impl(it, T()); } - iterator Extend(iterator it, T t) + iterator Push(iterator it, T t) { - return Extend_impl(it, t); + return Push_impl(it, t); } + bool IsLast(iterator it) + { + return it.Position == this->Data.size(); + } + + iterator Pop(iterator it) + { + assert(!this->Data.empty()); + assert(this->UpPositions.size() == this->Data.size()); + bool const isLast = this->IsLast(it); + ++it; + // If this is the last entry then no other entry can refer + // to it so we can drop its storage. + if (isLast) + { + this->Data.pop_back(); + this->UpPositions.pop_back(); + } + return it; + } + iterator Truncate() { assert(this->UpPositions.size() > 0); @@ -179,7 +200,7 @@ private: return &this->Data[pos]; } - iterator Extend_impl(iterator it, T t) + iterator Push_impl(iterator it, T t) { assert(this->UpPositions.size() == this->Data.size()); assert(it.Position <= this->UpPositions.size()); diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 5050229..7ba61f3 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -398,6 +398,21 @@ bool cmListFileParser::AddArgument(cmListFileLexer_Token* token, } } +cmListFileBacktrace::cmListFileBacktrace(cmState::Snapshot snapshot, + cmCommandContext const& cc) + : Context(cc) + , Snapshot(snapshot) +{ + if (this->Snapshot.IsValid()) + { + this->Snapshot.Keep(); + } +} + +cmListFileBacktrace::~cmListFileBacktrace() +{ +} + void cmListFileBacktrace::PrintTitle(std::ostream& out) const { if (!this->Snapshot.IsValid()) diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h index 5f1a310..03e0abe 100644 --- a/Source/cmListFileCache.h +++ b/Source/cmListFileCache.h @@ -90,10 +90,8 @@ class cmListFileBacktrace { public: cmListFileBacktrace(cmState::Snapshot snapshot = cmState::Snapshot(), - cmCommandContext const& cc = cmCommandContext()) - : Context(cc), Snapshot(snapshot) - { - } + cmCommandContext const& cc = cmCommandContext()); + ~cmListFileBacktrace(); void PrintTitle(std::ostream& out) const; void PrintCallStack(std::ostream& out) const; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index d92cbea..6a57374 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -3121,7 +3121,7 @@ void cmLocalGenerator::GenerateAppleInfoPList(cmGeneratorTarget* target, // override user make variables. If not the configuration will fall // back to the directory-level values set by the user. cmMakefile* mf = this->Makefile; - mf->PushScope(); + cmMakefile::ScopePushPop varScope(mf); mf->AddDefinition("MACOSX_BUNDLE_EXECUTABLE_NAME", targetName.c_str()); cmLGInfoProp(mf, target, "MACOSX_BUNDLE_INFO_STRING"); cmLGInfoProp(mf, target, "MACOSX_BUNDLE_ICON_FILE"); @@ -3132,7 +3132,6 @@ void cmLocalGenerator::GenerateAppleInfoPList(cmGeneratorTarget* target, cmLGInfoProp(mf, target, "MACOSX_BUNDLE_BUNDLE_VERSION"); cmLGInfoProp(mf, target, "MACOSX_BUNDLE_COPYRIGHT"); mf->ConfigureFile(inFile.c_str(), fname, false, false, false); - mf->PopScope(); } //---------------------------------------------------------------------------- @@ -3165,12 +3164,11 @@ void cmLocalGenerator::GenerateFrameworkInfoPList(cmGeneratorTarget* target, // override user make variables. If not the configuration will fall // back to the directory-level values set by the user. cmMakefile* mf = this->Makefile; - mf->PushScope(); + cmMakefile::ScopePushPop varScope(mf); mf->AddDefinition("MACOSX_FRAMEWORK_NAME", targetName.c_str()); cmLGInfoProp(mf, target, "MACOSX_FRAMEWORK_ICON_FILE"); cmLGInfoProp(mf, target, "MACOSX_FRAMEWORK_IDENTIFIER"); cmLGInfoProp(mf, target, "MACOSX_FRAMEWORK_SHORT_VERSION_STRING"); cmLGInfoProp(mf, target, "MACOSX_FRAMEWORK_BUNDLE_VERSION"); mf->ConfigureFile(inFile.c_str(), fname, false, false, false); - mf->PopScope(); } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 4fb4579..1b0a99a 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -105,7 +105,8 @@ cmMakefile::~cmMakefile() //---------------------------------------------------------------------------- void cmMakefile::IssueMessage(cmake::MessageType t, - std::string const& text) const + std::string const& text, + bool force) const { // Collect context information. if(!this->ExecutionStatusStack.empty()) @@ -114,7 +115,8 @@ void cmMakefile::IssueMessage(cmake::MessageType t, { this->ExecutionStatusStack.back()->SetNestedError(true); } - this->GetCMakeInstance()->IssueMessage(t, text, this->GetBacktrace()); + this->GetCMakeInstance()->IssueMessage(t, text, this->GetBacktrace(), + force); } else { @@ -129,7 +131,7 @@ void cmMakefile::IssueMessage(cmake::MessageType t, lfc.FilePath = converter.Convert(lfc.FilePath, cmOutputConverter::HOME); } lfc.Line = 0; - this->GetCMakeInstance()->IssueMessage(t, text, lfc); + this->GetCMakeInstance()->IssueMessage(t, text, lfc, force); } } @@ -391,7 +393,7 @@ cmMakefile::IncludeScope::~IncludeScope() this->EnforceCMP0011(); } } - this->Makefile->PopPolicyBarrier(this->ReportError); + this->Makefile->PopSnapshot(this->ReportError); this->Makefile->PopFunctionBlockerBarrier(this->ReportError); } @@ -505,7 +507,7 @@ public: ~ListFileScope() { - this->Makefile->PopPolicyBarrier(this->ReportError); + this->Makefile->PopSnapshot(this->ReportError); this->Makefile->PopFunctionBlockerBarrier(this->ReportError); } @@ -1534,7 +1536,7 @@ void cmMakefile::PopFunctionScope(bool reportError) { this->PopPolicy(); - this->PopPolicyBarrier(reportError); + this->PopSnapshot(reportError); this->PopFunctionBlockerBarrier(reportError); @@ -1565,7 +1567,7 @@ void cmMakefile::PushMacroScope(std::string const& fileName, void cmMakefile::PopMacroScope(bool reportError) { this->PopPolicy(); - this->PopPolicyBarrier(reportError); + this->PopSnapshot(reportError); this->PopFunctionBlockerBarrier(reportError); } @@ -1602,7 +1604,7 @@ public: ~BuildsystemFileScope() { this->Makefile->PopFunctionBlockerBarrier(this->ReportError); - this->Makefile->PopPolicyBarrier(this->ReportError); + this->Makefile->PopSnapshot(this->ReportError); #if defined(CMAKE_BUILD_WITH_CMAKE) this->GG->GetFileLockPool().PopFileScope(); #endif @@ -4168,9 +4170,7 @@ void cmMakefile::PopScope() this->CheckForUnusedVariables(); - this->StateSnapshot = - this->GetState()->Pop(this->StateSnapshot); - assert(this->StateSnapshot.IsValid()); + this->PopSnapshot(); } void cmMakefile::RaiseScope(const std::string& var, const char *varDef) @@ -4521,20 +4521,15 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id, } //---------------------------------------------------------------------------- -cmMakefile::PolicyPushPop::PolicyPushPop(cmMakefile* m, bool weak, - cmPolicies::PolicyMap const& pm): - Makefile(m), ReportError(true) +cmMakefile::PolicyPushPop::PolicyPushPop(cmMakefile* m): Makefile(m) { - this->Makefile->StateSnapshot = this->Makefile->StateSnapshot.GetState() - ->CreatePolicyScopeSnapshot(this->Makefile->StateSnapshot); - this->Makefile->PushPolicy(weak, pm); + this->Makefile->PushPolicy(); } //---------------------------------------------------------------------------- cmMakefile::PolicyPushPop::~PolicyPushPop() { this->Makefile->PopPolicy(); - this->Makefile->PopPolicyBarrier(this->ReportError); } //---------------------------------------------------------------------------- @@ -4554,8 +4549,11 @@ void cmMakefile::PopPolicy() } //---------------------------------------------------------------------------- -void cmMakefile::PopPolicyBarrier(bool reportError) +void cmMakefile::PopSnapshot(bool reportError) { + // cmState::Snapshot manages nested policy scopes within it. + // Since the scope corresponding to the snapshot is closing, + // reject any still-open nested policy scopes with an error. while (!this->StateSnapshot.CanPopPolicyScope()) { if(reportError) diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index f1dd374..362ea75 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -315,14 +315,10 @@ public: class PolicyPushPop { public: - PolicyPushPop(cmMakefile* m, - bool weak = false, - cmPolicies::PolicyMap const& pm = cmPolicies::PolicyMap()); + PolicyPushPop(cmMakefile* m); ~PolicyPushPop(); - void Quiet() { this->ReportError = false; } private: cmMakefile* Makefile; - bool ReportError; }; friend class PolicyPushPop; @@ -713,7 +709,8 @@ public: }; void IssueMessage(cmake::MessageType t, - std::string const& text) const; + std::string const& text, + bool force = false) const; /** Set whether or not to report a CMP0000 violation. */ void SetCheckCMP0000(bool b) { this->CheckCMP0000 = b; } @@ -878,7 +875,7 @@ private: void PushPolicy(bool weak = false, cmPolicies::PolicyMap const& pm = cmPolicies::PolicyMap()); void PopPolicy(); - void PopPolicyBarrier(bool reportError = true); + void PopSnapshot(bool reportError = true); friend class cmCMakePolicyCommand; class IncludeScope; friend class IncludeScope; diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx index 2854a82..8272eb0 100644 --- a/Source/cmMessageCommand.cxx +++ b/Source/cmMessageCommand.cxx @@ -43,7 +43,15 @@ bool cmMessageCommand } else if (*i == "AUTHOR_WARNING") { - type = cmake::AUTHOR_WARNING; + if (this->Makefile->GetCMakeInstance()->GetSuppressDevWarnings( + this->Makefile)) + { + return true; + } + else + { + type = cmake::AUTHOR_WARNING; + } ++i; } else if (*i == "STATUS") @@ -58,13 +66,17 @@ bool cmMessageCommand fatal = true; type = cmake::DEPRECATION_ERROR; } - else if (this->Makefile->IsOn("CMAKE_WARN_DEPRECATED")) - { - type = cmake::DEPRECATION_WARNING; - } else { - return true; + if (this->Makefile->GetCMakeInstance()->GetSuppressDeprecatedWarnings( + this->Makefile)) + { + return true; + } + else + { + type = cmake::DEPRECATION_WARNING; + } } ++i; } @@ -73,7 +85,8 @@ bool cmMessageCommand if (type != cmake::MESSAGE) { - this->Makefile->IssueMessage(type, message); + // we've overriden the message type, above, so force IssueMessage to use it + this->Makefile->IssueMessage(type, message, true); } else { diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx index e3eedc7..61efd01 100644 --- a/Source/cmOrderDirectories.cxx +++ b/Source/cmOrderDirectories.cxx @@ -73,10 +73,8 @@ public: { // Check if this directory conflicts with the entry. std::string const& dir = this->OD->OriginalDirectories[i]; - if(dir != this->Directory && - cmSystemTools::GetRealPath(dir) != - cmSystemTools::GetRealPath(this->Directory) && - this->FindConflict(dir)) + if (!this->OD->IsSameDirectory(dir, this->Directory) && + this->FindConflict(dir)) { // The library will be found in this directory but this is not // the directory named for it. Add an entry to make sure the @@ -639,3 +637,23 @@ void cmOrderDirectories::DiagnoseCycle() ->IssueMessage(cmake::WARNING, e.str(), this->Target->GetBacktrace()); } + +bool cmOrderDirectories::IsSameDirectory(std::string const& l, + std::string const& r) +{ + return this->GetRealPath(l) == this->GetRealPath(r); +} + +std::string const& cmOrderDirectories::GetRealPath(std::string const& dir) +{ + std::map<std::string, std::string>::iterator i = + this->RealPaths.lower_bound(dir); + if (i == this->RealPaths.end() || + this->RealPaths.key_comp()(dir, i->first)) + { + typedef std::map<std::string, std::string>::value_type value_type; + i = this->RealPaths.insert( + i, value_type(dir, cmSystemTools::GetRealPath(dir))); + } + return i->second; +} diff --git a/Source/cmOrderDirectories.h b/Source/cmOrderDirectories.h index 211c786..477216b 100644 --- a/Source/cmOrderDirectories.h +++ b/Source/cmOrderDirectories.h @@ -80,6 +80,12 @@ private: struct ConflictList: public std::vector<ConflictPair> {}; std::vector<ConflictList> ConflictGraph; + // Compare directories after resolving symlinks. + bool IsSameDirectory(std::string const& l, std::string const& r); + + std::string const& GetRealPath(std::string const& dir); + std::map<std::string, std::string> RealPaths; + friend class cmOrderDirectoriesConstraint; friend class cmOrderDirectoriesConstraintLibrary; }; diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h index dd8fa9c..aed2e74 100644 --- a/Source/cmStandardIncludes.h +++ b/Source/cmStandardIncludes.h @@ -54,6 +54,8 @@ #if defined( _MSC_VER ) typedef unsigned short mode_t; +#else +# include <sys/types.h> #endif // use this class to shrink the size of symbols in .o files diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 4362157..b8e604b 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -28,6 +28,7 @@ struct cmState::SnapshotDataType cmLinkedTree<cmState::PolicyStackEntry>::iterator PolicyRoot; cmLinkedTree<cmState::PolicyStackEntry>::iterator PolicyScope; cmState::SnapshotType SnapshotType; + bool Keep; cmLinkedTree<std::string>::iterator ExecutionListFile; cmLinkedTree<cmState::BuildsystemDirectoryStateType>::iterator BuildSystemDirectory; @@ -341,7 +342,7 @@ cmState::Snapshot cmState::Reset() std::string binDir = cmDefinitions::Get("CMAKE_BINARY_DIR", pos->Vars, pos->Root); this->VarTree.Clear(); - pos->Vars = this->VarTree.Extend(this->VarTree.Root()); + pos->Vars = this->VarTree.Push(this->VarTree.Root()); pos->Parent = this->VarTree.Root(); pos->Root = this->VarTree.Root(); @@ -818,14 +819,15 @@ void cmState::Directory::ComputeRelativePathTopBinary() cmState::Snapshot cmState::CreateBaseSnapshot() { - PositionType pos = this->SnapshotData.Extend(this->SnapshotData.Root()); + PositionType pos = this->SnapshotData.Push(this->SnapshotData.Root()); pos->DirectoryParent = this->SnapshotData.Root(); pos->ScopeParent = this->SnapshotData.Root(); pos->SnapshotType = BaseType; + pos->Keep = true; pos->BuildSystemDirectory = - this->BuildsystemDirectory.Extend(this->BuildsystemDirectory.Root()); + this->BuildsystemDirectory.Push(this->BuildsystemDirectory.Root()); pos->ExecutionListFile = - this->ExecutionListFiles.Extend(this->ExecutionListFiles.Root()); + this->ExecutionListFiles.Push(this->ExecutionListFiles.Root()); pos->IncludeDirectoryPosition = 0; pos->CompileDefinitionsPosition = 0; pos->CompileOptionsPosition = 0; @@ -835,7 +837,7 @@ cmState::Snapshot cmState::CreateBaseSnapshot() pos->PolicyScope = this->PolicyStack.Root(); assert(pos->Policies.IsValid()); assert(pos->PolicyRoot.IsValid()); - pos->Vars = this->VarTree.Extend(this->VarTree.Root()); + pos->Vars = this->VarTree.Push(this->VarTree.Root()); assert(pos->Vars.IsValid()); pos->Parent = this->VarTree.Root(); pos->Root = this->VarTree.Root(); @@ -848,17 +850,18 @@ cmState::CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot, long entryPointLine) { assert(originSnapshot.IsValid()); - PositionType pos = this->SnapshotData.Extend(originSnapshot.Position); + PositionType pos = this->SnapshotData.Push(originSnapshot.Position); pos->EntryPointLine = entryPointLine; pos->EntryPointCommand = entryPointCommand; pos->DirectoryParent = originSnapshot.Position; pos->ScopeParent = originSnapshot.Position; pos->SnapshotType = BuildsystemDirectoryType; + pos->Keep = true; pos->BuildSystemDirectory = - this->BuildsystemDirectory.Extend( + this->BuildsystemDirectory.Push( originSnapshot.Position->BuildSystemDirectory); pos->ExecutionListFile = - this->ExecutionListFiles.Extend( + this->ExecutionListFiles.Push( originSnapshot.Position->ExecutionListFile); pos->BuildSystemDirectory->DirectoryEnd = pos; pos->Policies = originSnapshot.Position->Policies; @@ -871,7 +874,7 @@ cmState::CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot, originSnapshot.Position->Vars; pos->Parent = origin; pos->Root = origin; - pos->Vars = this->VarTree.Extend(origin); + pos->Vars = this->VarTree.Push(origin); cmState::Snapshot snapshot = cmState::Snapshot(this, pos); originSnapshot.Position->BuildSystemDirectory->Children.push_back(snapshot); @@ -887,13 +890,14 @@ cmState::CreateFunctionCallSnapshot(cmState::Snapshot originSnapshot, long entryPointLine, std::string const& fileName) { - PositionType pos = this->SnapshotData.Extend(originSnapshot.Position, - *originSnapshot.Position); + PositionType pos = this->SnapshotData.Push(originSnapshot.Position, + *originSnapshot.Position); pos->ScopeParent = originSnapshot.Position; pos->EntryPointLine = entryPointLine; pos->EntryPointCommand = entryPointCommand; pos->SnapshotType = FunctionCallType; - pos->ExecutionListFile = this->ExecutionListFiles.Extend( + pos->Keep = false; + pos->ExecutionListFile = this->ExecutionListFiles.Push( originSnapshot.Position->ExecutionListFile, fileName); pos->BuildSystemDirectory->DirectoryEnd = pos; pos->PolicyScope = originSnapshot.Position->Policies; @@ -901,7 +905,7 @@ cmState::CreateFunctionCallSnapshot(cmState::Snapshot originSnapshot, cmLinkedTree<cmDefinitions>::iterator origin = originSnapshot.Position->Vars; pos->Parent = origin; - pos->Vars = this->VarTree.Extend(origin); + pos->Vars = this->VarTree.Push(origin); return cmState::Snapshot(this, pos); } @@ -912,12 +916,13 @@ cmState::CreateMacroCallSnapshot(cmState::Snapshot originSnapshot, long entryPointLine, std::string const& fileName) { - PositionType pos = this->SnapshotData.Extend(originSnapshot.Position, - *originSnapshot.Position); + PositionType pos = this->SnapshotData.Push(originSnapshot.Position, + *originSnapshot.Position); pos->EntryPointLine = entryPointLine; pos->EntryPointCommand = entryPointCommand; pos->SnapshotType = MacroCallType; - pos->ExecutionListFile = this->ExecutionListFiles.Extend( + pos->Keep = false; + pos->ExecutionListFile = this->ExecutionListFiles.Push( originSnapshot.Position->ExecutionListFile, fileName); assert(originSnapshot.Position->Vars.IsValid()); pos->BuildSystemDirectory->DirectoryEnd = pos; @@ -931,12 +936,13 @@ cmState::CreateCallStackSnapshot(cmState::Snapshot originSnapshot, long entryPointLine, const std::string& fileName) { - PositionType pos = this->SnapshotData.Extend(originSnapshot.Position, - *originSnapshot.Position); + PositionType pos = this->SnapshotData.Push(originSnapshot.Position, + *originSnapshot.Position); pos->EntryPointLine = entryPointLine; pos->EntryPointCommand = entryPointCommand; pos->SnapshotType = CallStackType; - pos->ExecutionListFile = this->ExecutionListFiles.Extend( + pos->Keep = true; + pos->ExecutionListFile = this->ExecutionListFiles.Push( originSnapshot.Position->ExecutionListFile, fileName); assert(originSnapshot.Position->Vars.IsValid()); pos->BuildSystemDirectory->DirectoryEnd = pos; @@ -949,18 +955,20 @@ cmState::CreateVariableScopeSnapshot(cmState::Snapshot originSnapshot, std::string const& entryPointCommand, long entryPointLine) { - PositionType pos = this->SnapshotData.Extend(originSnapshot.Position, - *originSnapshot.Position); + PositionType pos = this->SnapshotData.Push(originSnapshot.Position, + *originSnapshot.Position); pos->ScopeParent = originSnapshot.Position; pos->EntryPointLine = entryPointLine; pos->EntryPointCommand = entryPointCommand; pos->SnapshotType = VariableScopeType; + pos->Keep = false; + pos->PolicyScope = originSnapshot.Position->Policies; assert(originSnapshot.Position->Vars.IsValid()); cmLinkedTree<cmDefinitions>::iterator origin = originSnapshot.Position->Vars; pos->Parent = origin; - pos->Vars = this->VarTree.Extend(origin); + pos->Vars = this->VarTree.Push(origin); assert(pos->Vars.IsValid()); return cmState::Snapshot(this, pos); } @@ -971,12 +979,13 @@ cmState::CreateInlineListFileSnapshot(cmState::Snapshot originSnapshot, long entryPointLine, const std::string& fileName) { - PositionType pos = this->SnapshotData.Extend(originSnapshot.Position, - *originSnapshot.Position); + PositionType pos = this->SnapshotData.Push(originSnapshot.Position, + *originSnapshot.Position); pos->EntryPointLine = entryPointLine; pos->EntryPointCommand = entryPointCommand; pos->SnapshotType = InlineListFileType; - pos->ExecutionListFile = this->ExecutionListFiles.Extend( + pos->Keep = true; + pos->ExecutionListFile = this->ExecutionListFiles.Push( originSnapshot.Position->ExecutionListFile, fileName); pos->BuildSystemDirectory->DirectoryEnd = pos; pos->PolicyScope = originSnapshot.Position->Policies; @@ -986,9 +995,10 @@ cmState::CreateInlineListFileSnapshot(cmState::Snapshot originSnapshot, cmState::Snapshot cmState::CreatePolicyScopeSnapshot(cmState::Snapshot originSnapshot) { - PositionType pos = this->SnapshotData.Extend(originSnapshot.Position, - *originSnapshot.Position); + PositionType pos = this->SnapshotData.Push(originSnapshot.Position, + *originSnapshot.Position); pos->SnapshotType = PolicyScopeType; + pos->Keep = false; pos->BuildSystemDirectory->DirectoryEnd = pos; pos->PolicyScope = originSnapshot.Position->Policies; return cmState::Snapshot(this, pos); @@ -1007,6 +1017,21 @@ cmState::Snapshot cmState::Pop(cmState::Snapshot originSnapshot) prevPos->BuildSystemDirectory->CompileOptions.size(); prevPos->BuildSystemDirectory->DirectoryEnd = prevPos; + if (!pos->Keep && this->SnapshotData.IsLast(pos)) + { + if (pos->Vars != prevPos->Vars) + { + assert(this->VarTree.IsLast(pos->Vars)); + this->VarTree.Pop(pos->Vars); + } + if (pos->ExecutionListFile != prevPos->ExecutionListFile) + { + assert(this->ExecutionListFiles.IsLast(pos->ExecutionListFile)); + this->ExecutionListFiles.Pop(pos->ExecutionListFile); + } + this->SnapshotData.Pop(pos); + } + return Snapshot(this, prevPos); } @@ -1073,6 +1098,11 @@ void cmState::Directory::SetCurrentBinary(std::string const& dir) this->Snapshot_.SetDefinition("CMAKE_CURRENT_BINARY_DIR", loc.c_str()); } +void cmState::Snapshot::Keep() +{ + this->Position->Keep = true; +} + void cmState::Snapshot::SetListFile(const std::string& listfile) { *this->Position->ExecutionListFile = listfile; @@ -1187,8 +1217,8 @@ void cmState::Snapshot::PushPolicy(cmPolicies::PolicyMap entry, bool weak) { PositionType pos = this->Position; pos->Policies = - this->State->PolicyStack.Extend(pos->Policies, - PolicyStackEntry(entry, weak)); + this->State->PolicyStack.Push(pos->Policies, + PolicyStackEntry(entry, weak)); } bool cmState::Snapshot::PopPolicy() @@ -1198,7 +1228,7 @@ bool cmState::Snapshot::PopPolicy() { return false; } - ++pos->Policies; + pos->Policies = this->State->PolicyStack.Pop(pos->Policies); return true; } diff --git a/Source/cmState.h b/Source/cmState.h index 7d1fc80..6717481 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -63,6 +63,7 @@ public: std::vector<std::string> ClosureKeys() const; bool RaiseScope(std::string const& var, const char* varDef); + void Keep(); void SetListFile(std::string const& listfile); std::string GetExecutionListFile() const; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index ee1e878..c0a1196 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -127,8 +127,6 @@ cmake::cmake() this->WarnUnused = false; this->WarnUnusedCli = true; this->CheckSystemVars = false; - this->SuppressDevWarnings = false; - this->DoSuppressDevWarnings = false; this->DebugOutput = false; this->DebugTryCompile = false; this->ClearBuildSystem = false; @@ -274,15 +272,51 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args) return false; } } - else if(arg.find("-Wno-dev",0) == 0) + else if(cmHasLiteralPrefix(arg, "-W")) { - this->SuppressDevWarnings = true; - this->DoSuppressDevWarnings = true; - } - else if(arg.find("-Wdev",0) == 0) - { - this->SuppressDevWarnings = false; - this->DoSuppressDevWarnings = true; + std::string entry = arg.substr(2); + if (entry.empty()) + { + ++i; + if (i < args.size()) + { + entry = args[i]; + } + else + { + cmSystemTools::Error("-W must be followed with [no-]<name>."); + return false; + } + } + + std::string name; + bool foundNo = false; + unsigned int nameStartPosition = 0; + + if (entry.find("no-", nameStartPosition) == 0) + { + foundNo = true; + nameStartPosition += 3; + } + + name = entry.substr(nameStartPosition); + if (name.empty()) + { + cmSystemTools::Error("No warning name provided."); + return false; + } + + if (!foundNo) + { + // -W<name> + this->DiagLevels[name] = std::max(this->DiagLevels[name], + DIAG_WARN); + } + else + { + // -Wno<name> + this->DiagLevels[name] = DIAG_IGNORE; + } } else if(arg.find("-U",0) == 0) { @@ -618,11 +652,7 @@ void cmake::SetArgs(const std::vector<std::string>& args, // skip for now i++; } - else if(arg.find("-Wno-dev",0) == 0) - { - // skip for now - } - else if(arg.find("-Wdev",0) == 0) + else if(arg.find("-W",0) == 0) { // skip for now } @@ -1231,25 +1261,74 @@ int cmake::HandleDeleteCacheVariables(const std::string& var) int cmake::Configure() { - if(this->DoSuppressDevWarnings) + DiagLevel diagLevel; + + if (this->DiagLevels.count("deprecated") == 1) { - if(this->SuppressDevWarnings) + + diagLevel = this->DiagLevels["deprecated"]; + 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->AddCacheEntry("CMAKE_WARN_DEPRECATED", "FALSE", + "Whether to issue warnings for deprecated " + "functionality.", + cmState::INTERNAL); } - else + 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->AddCacheEntry("CMAKE_WARN_DEPRECATED", "TRUE", + "Whether to issue warnings for deprecated " + "functionality.", + cmState::INTERNAL); } } + + if (this->DiagLevels.count("dev") == 1) + { + bool setDeprecatedVariables = false; + + const char* cachedWarnDeprecated = + this->State->GetCacheEntryValue("CMAKE_WARN_DEPRECATED"); + + // don't overwrite deprecated warning setting from a previous invocation + if (!cachedWarnDeprecated) + { + setDeprecatedVariables = true; + } + + 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); + + if (setDeprecatedVariables) + { + this->AddCacheEntry("CMAKE_WARN_DEPRECATED", "FALSE", + "Whether to issue warnings for deprecated " + "functionality.", + cmState::INTERNAL); + } + } + 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); + + if (setDeprecatedVariables) + { + this->AddCacheEntry("CMAKE_WARN_DEPRECATED", "TRUE", + "Whether to issue warnings for deprecated " + "functionality.", + cmState::INTERNAL); + } + } + } + int ret = this->ActualConfigure(); const char* delCacheVars = this->State ->GetGlobalProperty("__CMAKE_DELETE_CACHE_CHANGE_VARS_"); @@ -1580,6 +1659,7 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure) { this->AddCMakePaths(); } + // Add any cache args if ( !this->SetCacheArgs(args) ) { @@ -2485,6 +2565,38 @@ static bool cmakeCheckStampList(const char* stampList) return true; } +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)) + { + isVisible = false; + } + } + else if (t == cmake::DEPRECATION_WARNING) + { + if (this->GetSuppressDeprecatedWarnings()) + { + isVisible = false; + } + } + else if (t == cmake::AUTHOR_WARNING) + { + if (this->GetSuppressDevWarnings()) + { + isVisible = false; + } + } + + return isVisible; +} + bool cmake::PrintMessagePreamble(cmake::MessageType t, std::ostream& msg) { // Construct the message header. @@ -2508,20 +2620,13 @@ bool cmake::PrintMessagePreamble(cmake::MessageType t, std::ostream& msg) { msg << "CMake Deprecation Warning"; } + else if (t == cmake::AUTHOR_WARNING) + { + msg << "CMake Warning (dev)"; + } else { msg << "CMake Warning"; - if(t == cmake::AUTHOR_WARNING) - { - // Allow suppression of these warnings. - const char* suppress = this->State->GetCacheEntryValue( - "CMAKE_SUPPRESS_DEVELOPER_WARNINGS"); - if(suppress && cmSystemTools::IsOn(suppress)) - { - return false; - } - msg << " (dev)"; - } } return true; } @@ -2579,10 +2684,16 @@ void displayMessage(cmake::MessageType t, std::ostringstream& msg) //---------------------------------------------------------------------------- void cmake::IssueMessage(cmake::MessageType t, std::string const& text, - cmListFileBacktrace const& bt) + cmListFileBacktrace const& bt, + bool force) { cmListFileBacktrace backtrace = bt; + if (!force && !this->IsMessageTypeVisible(t)) + { + return; + } + std::ostringstream msg; if (!this->PrintMessagePreamble(t, msg)) { @@ -2602,8 +2713,14 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text, //---------------------------------------------------------------------------- void cmake::IssueMessage(cmake::MessageType t, std::string const& text, - cmListFileContext const& lfc) + cmListFileContext const& lfc, + bool force) { + if (!force && !this->IsMessageTypeVisible(t)) + { + return; + } + std::ostringstream msg; if (!this->PrintMessagePreamble(t, msg)) { @@ -2763,3 +2880,55 @@ void cmake::RunCheckForUnusedVariables() } #endif } + +void cmake::SetSuppressDevWarnings(bool b) +{ + // equivalent to -Wno-dev + if (b) + { + this->DiagLevels["dev"] = DIAG_IGNORE; + } + // equivalent to -Wdev + else + { + this->DiagLevels["dev"] = std::max(this->DiagLevels["dev"], + DIAG_WARN); + } +} + +bool cmake::GetSuppressDevWarnings(cmMakefile const* mf) +{ + /* + * 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) +{ + /* + * 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->IsSet("CMAKE_WARN_DEPRECATED") && + !mf->IsOn("CMAKE_WARN_DEPRECATED")); + } + else + { + const char* cacheEntryValue = this->State->GetCacheEntryValue( + "CMAKE_WARN_DEPRECATED"); + return cacheEntryValue && cmSystemTools::IsOff(cacheEntryValue); + } +} diff --git a/Source/cmake.h b/Source/cmake.h index c584ad9..4c5515b 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -68,6 +68,11 @@ class cmake DEPRECATION_WARNING }; + enum DiagLevel + { + DIAG_IGNORE, + DIAG_WARN + }; /** \brief Describes the working modes of cmake */ enum WorkingMode @@ -303,17 +308,28 @@ class cmake std::string const& GetCMakeEditCommand() const { return this->CMakeEditCommand; } - void SetSuppressDevWarnings(bool v) - { - this->SuppressDevWarnings = v; - this->DoSuppressDevWarnings = true; - } + 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); + + /* + * 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); /** Display a message to the user. */ void IssueMessage(cmake::MessageType t, std::string const& text, - cmListFileBacktrace const& backtrace = cmListFileBacktrace()); + cmListFileBacktrace const& backtrace = cmListFileBacktrace(), + bool force = false); void IssueMessage(cmake::MessageType t, std::string const& text, - cmListFileContext const& lfc); + cmListFileContext const& lfc, + bool force = false); ///! run the --build option int Build(const std::string& dir, @@ -351,8 +367,7 @@ protected: cmGlobalGenerator *GlobalGenerator; cmCacheManager *CacheManager; - bool SuppressDevWarnings; - bool DoSuppressDevWarnings; + std::map<std::string, DiagLevel> DiagLevels; std::string GeneratorPlatform; std::string GeneratorToolset; @@ -419,6 +434,12 @@ private: // Print a list of valid generators to stderr. void PrintGeneratorList(); + /* + * Check if messages of this type should be output, based on the state of the + * warning and error output CMake variables, in the cache. + */ + bool IsMessageTypeVisible(cmake::MessageType t); + bool PrintMessagePreamble(cmake::MessageType t, std::ostream& msg); }; @@ -430,7 +451,9 @@ private: {"-T <toolset-name>", "Specify toolset name if supported by generator."}, \ {"-A <platform-name>", "Specify platform name if supported by generator."}, \ {"-Wno-dev", "Suppress developer warnings."},\ - {"-Wdev", "Enable developer warnings."} + {"-Wdev", "Enable developer warnings."},\ + {"-Wdeprecated", "Enable deprecation warnings."},\ + {"-Wno-deprecated", "Suppress deprecation warnings."} #define FOR_EACH_C_FEATURE(F) \ F(c_function_prototypes) \ diff --git a/Source/kwsys/CPU.h.in b/Source/kwsys/CPU.h.in index 884d71a..66ffbb1 100644 --- a/Source/kwsys/CPU.h.in +++ b/Source/kwsys/CPU.h.in @@ -88,6 +88,10 @@ #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 diff --git a/Source/kwsys/ProcessUNIX.c b/Source/kwsys/ProcessUNIX.c index 6d9b109..b0ddf5a 100644 --- a/Source/kwsys/ProcessUNIX.c +++ b/Source/kwsys/ProcessUNIX.c @@ -2241,7 +2241,7 @@ static kwsysProcessTime kwsysProcessTimeAdd(kwsysProcessTime in1, kwsysProcessTi kwsysProcessTime out; out.tv_sec = in1.tv_sec + in2.tv_sec; out.tv_usec = in1.tv_usec + in2.tv_usec; - if(out.tv_usec > 1000000) + if(out.tv_usec >= 1000000) { out.tv_usec -= 1000000; out.tv_sec += 1; diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index da34eb9..37fe421 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -2970,6 +2970,8 @@ std::string SystemTools::FindProgram( bool no_system_path) { std::vector<std::string> extensions; + std::string tryPath; + #if defined (_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) bool hasExtension = false; // check to see if the name already has a .xxx at @@ -2983,22 +2985,22 @@ std::string SystemTools::FindProgram( { extensions.push_back(".com"); extensions.push_back(".exe"); - } -#endif - std::string tryPath; - // first try with extensions if the os supports them - for(std::vector<std::string>::iterator i = - extensions.begin(); i != extensions.end(); ++i) - { - tryPath = name; - tryPath += *i; - if(SystemTools::FileExists(tryPath) && - !SystemTools::FileIsDirectory(tryPath)) + // first try with extensions if the os supports them + for(std::vector<std::string>::iterator i = + extensions.begin(); i != extensions.end(); ++i) { - return SystemTools::CollapseFullPath(tryPath); + tryPath = name; + tryPath += *i; + if(SystemTools::FileExists(tryPath) && + !SystemTools::FileIsDirectory(tryPath)) + { + return SystemTools::CollapseFullPath(tryPath); + } } } +#endif + // now try just the name tryPath = name; if(SystemTools::FileExists(tryPath) && @@ -3048,8 +3050,7 @@ std::string SystemTools::FindProgram( tryPath = *p; tryPath += name; tryPath += *ext; - if(SystemTools::FileExists(tryPath) && - !SystemTools::FileIsDirectory(tryPath)) + if(SystemTools::FileExists(tryPath, true)) { return SystemTools::CollapseFullPath(tryPath); } @@ -3057,8 +3058,7 @@ std::string SystemTools::FindProgram( // now try it without them tryPath = *p; tryPath += name; - if(SystemTools::FileExists(tryPath) && - !SystemTools::FileIsDirectory(tryPath)) + if(SystemTools::FileExists(tryPath, true)) { return SystemTools::CollapseFullPath(tryPath); } @@ -3097,8 +3097,7 @@ std::string SystemTools const std::vector<std::string>& userPaths) { // See if the executable exists as written. - if(SystemTools::FileExists(name) && - !SystemTools::FileIsDirectory(name)) + if(SystemTools::FileExists(name, true)) { return SystemTools::CollapseFullPath(name); } @@ -3144,8 +3143,7 @@ std::string SystemTools tryPath = *p; tryPath += name; tryPath += ".lib"; - if(SystemTools::FileExists(tryPath) - && !SystemTools::FileIsDirectory(tryPath)) + if(SystemTools::FileExists(tryPath, true)) { return SystemTools::CollapseFullPath(tryPath); } @@ -3154,8 +3152,7 @@ std::string SystemTools tryPath += "lib"; tryPath += name; tryPath += ".so"; - if(SystemTools::FileExists(tryPath) - && !SystemTools::FileIsDirectory(tryPath)) + if(SystemTools::FileExists(tryPath, true)) { return SystemTools::CollapseFullPath(tryPath); } @@ -3163,8 +3160,7 @@ std::string SystemTools tryPath += "lib"; tryPath += name; tryPath += ".a"; - if(SystemTools::FileExists(tryPath) - && !SystemTools::FileIsDirectory(tryPath)) + if(SystemTools::FileExists(tryPath, true)) { return SystemTools::CollapseFullPath(tryPath); } @@ -3172,8 +3168,7 @@ std::string SystemTools tryPath += "lib"; tryPath += name; tryPath += ".sl"; - if(SystemTools::FileExists(tryPath) - && !SystemTools::FileIsDirectory(tryPath)) + if(SystemTools::FileExists(tryPath, true)) { return SystemTools::CollapseFullPath(tryPath); } @@ -3181,8 +3176,7 @@ std::string SystemTools tryPath += "lib"; tryPath += name; tryPath += ".dylib"; - if(SystemTools::FileExists(tryPath) - && !SystemTools::FileIsDirectory(tryPath)) + if(SystemTools::FileExists(tryPath, true)) { return SystemTools::CollapseFullPath(tryPath); } @@ -3190,8 +3184,7 @@ std::string SystemTools tryPath += "lib"; tryPath += name; tryPath += ".dll"; - if(SystemTools::FileExists(tryPath) - && !SystemTools::FileIsDirectory(tryPath)) + if(SystemTools::FileExists(tryPath, true)) { return SystemTools::CollapseFullPath(tryPath); } diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 5fd7159..509c7ee 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) @@ -1356,6 +1355,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/CMakeOnly/CompilerIdC/CMakeLists.txt b/Tests/CMakeOnly/CompilerIdC/CMakeLists.txt index 848ffdd..6fea73e 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 94ac31e..05e6bb2 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 02e4668..067fb8c 100644 --- a/Tests/CMakeOnly/CompilerIdFortran/CMakeLists.txt +++ b/Tests/CMakeOnly/CompilerIdFortran/CMakeLists.txt @@ -12,3 +12,10 @@ foreach(v message(SEND_ERROR "${v} not set!") endif() endforeach() + +# Version numbers may only contain numbers and periods. +if(NOT CMAKE_Fortran_COMPILER_VERSION MATCHES + "^([0-9]+)(\\.([0-9]+))?(\\.([0-9]+))?(\\.([0-9]+))?$" + ) + message(SEND_ERROR "Compiler version is not numeric!") +endif() diff --git a/Tests/CompileOptions/CMakeLists.txt b/Tests/CompileOptions/CMakeLists.txt index 05a5f82..692e0de 100644 --- a/Tests/CompileOptions/CMakeLists.txt +++ b/Tests/CompileOptions/CMakeLists.txt @@ -22,7 +22,7 @@ set_property(TARGET CompileOptions PROPERTY COMPILE_OPTIONS ${cxx_tests} ) -if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|Borland") +if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|Borland|Embarcadero") set_property(TARGET CompileOptions APPEND PROPERTY COMPILE_OPTIONS "-DTEST_OCTOTHORPE=\"#\"" ) diff --git a/Tests/FindBoost/CMakeLists.txt b/Tests/FindBoost/CMakeLists.txt new file mode 100644 index 0000000..259ee26 --- /dev/null +++ b/Tests/FindBoost/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindBoost.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --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 $<CONFIGURATION> + ) diff --git a/Tests/FindBoost/Test/CMakeLists.txt b/Tests/FindBoost/Test/CMakeLists.txt new file mode 100644 index 0000000..ce50fc7 --- /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 0000000..0f44f30 --- /dev/null +++ b/Tests/FindBoost/Test/main.cxx @@ -0,0 +1,26 @@ +#include <boost/filesystem.hpp> +#include <boost/thread.hpp> + +namespace +{ + + boost::mutex m1; + boost::recursive_mutex m2; + + void + threadmain() + { + boost::lock_guard<boost::mutex> lock1(m1); + boost::lock_guard<boost::recursive_mutex> lock2(m2); + + boost::filesystem::path p(boost::filesystem::current_path()); + } + +} + +int main() { + boost::thread foo(threadmain); + foo.join(); + + return 0; +} diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 2d94e29..6b4b384 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -129,9 +129,47 @@ set(RunCMake_TEST_OPTIONS -Wno-dev) run_cmake(Wno-dev) unset(RunCMake_TEST_OPTIONS) +set(RunCMake_TEST_OPTIONS -Wdev) +run_cmake(Wdev) +unset(RunCMake_TEST_OPTIONS) + +# -Wdev should not override deprecated options if specified +set(RunCMake_TEST_OPTIONS -Wdev -Wno-deprecated) +run_cmake(Wno-deprecated) +unset(RunCMake_TEST_OPTIONS) +set(RunCMake_TEST_OPTIONS -Wno-deprecated -Wdev) +run_cmake(Wno-deprecated) +unset(RunCMake_TEST_OPTIONS) + +# -Wdev should enable deprecated warnings as well +set(RunCMake_TEST_OPTIONS -Wdev) +run_cmake(Wdeprecated) +unset(RunCMake_TEST_OPTIONS) + +set(RunCMake_TEST_OPTIONS -Wdeprecated) +run_cmake(Wdeprecated) +unset(RunCMake_TEST_OPTIONS) + +set(RunCMake_TEST_OPTIONS -Wno-deprecated) +run_cmake(Wno-deprecated) +unset(RunCMake_TEST_OPTIONS) + +# Dev warnings should be on by default +run_cmake(Wdev) + +# Deprecated warnings should be on by default +run_cmake(Wdeprecated) + +# Conflicting -W options should honor the last value set(RunCMake_TEST_OPTIONS -Wno-dev -Wdev) run_cmake(Wdev) unset(RunCMake_TEST_OPTIONS) +set(RunCMake_TEST_OPTIONS -Wdev -Wno-dev) +run_cmake(Wno-dev) +unset(RunCMake_TEST_OPTIONS) + +run_cmake_command(W_bad-arg1 ${CMAKE_COMMAND} -W) +run_cmake_command(W_bad-arg2 ${CMAKE_COMMAND} -Wno-) set(RunCMake_TEST_OPTIONS --debug-output) run_cmake(debug-output) diff --git a/Tests/RunCMake/CommandLine/W_bad-arg1-result.txt b/Tests/RunCMake/CommandLine/W_bad-arg1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/W_bad-arg1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/W_bad-arg1-stderr.txt b/Tests/RunCMake/CommandLine/W_bad-arg1-stderr.txt new file mode 100644 index 0000000..0c0f613 --- /dev/null +++ b/Tests/RunCMake/CommandLine/W_bad-arg1-stderr.txt @@ -0,0 +1,2 @@ +CMake Error: -W must be followed with \[no-\]<name>. +CMake Error: Problem processing arguments. Aborting. diff --git a/Tests/RunCMake/CommandLine/W_bad-arg2-result.txt b/Tests/RunCMake/CommandLine/W_bad-arg2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/W_bad-arg2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/W_bad-arg2-stderr.txt b/Tests/RunCMake/CommandLine/W_bad-arg2-stderr.txt new file mode 100644 index 0000000..cc643df --- /dev/null +++ b/Tests/RunCMake/CommandLine/W_bad-arg2-stderr.txt @@ -0,0 +1,2 @@ +CMake Error: No warning name provided. +CMake Error: Problem processing arguments. Aborting. diff --git a/Tests/RunCMake/CommandLine/Wdeprecated-stderr.txt b/Tests/RunCMake/CommandLine/Wdeprecated-stderr.txt new file mode 100644 index 0000000..e9be1dc --- /dev/null +++ b/Tests/RunCMake/CommandLine/Wdeprecated-stderr.txt @@ -0,0 +1,4 @@ +^CMake Deprecation Warning at Wdeprecated.cmake:1 \(message\): + Some deprecated warning +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CommandLine/Wdeprecated.cmake b/Tests/RunCMake/CommandLine/Wdeprecated.cmake new file mode 100644 index 0000000..3142b42 --- /dev/null +++ b/Tests/RunCMake/CommandLine/Wdeprecated.cmake @@ -0,0 +1 @@ +message(DEPRECATION "Some deprecated warning") diff --git a/Tests/RunCMake/CommandLine/Wdev-stderr.txt b/Tests/RunCMake/CommandLine/Wdev-stderr.txt index 92c1d23..88cfb3a 100644 --- a/Tests/RunCMake/CommandLine/Wdev-stderr.txt +++ b/Tests/RunCMake/CommandLine/Wdev-stderr.txt @@ -1,5 +1,5 @@ ^CMake Warning \(dev\) at Wdev.cmake:1 \(message\): - Some Author Warning + 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. diff --git a/Tests/RunCMake/CommandLine/Wdev.cmake b/Tests/RunCMake/CommandLine/Wdev.cmake index e5026ef..756f31e 100644 --- a/Tests/RunCMake/CommandLine/Wdev.cmake +++ b/Tests/RunCMake/CommandLine/Wdev.cmake @@ -1,4 +1,4 @@ -message(AUTHOR_WARNING "Some Author Warning") +message(AUTHOR_WARNING "Some author warning") # with -Wdev this will also cause an AUTHOR_WARNING message, checks that # messages issued outside of the message command, by other CMake commands, also diff --git a/Tests/RunCMake/CommandLine/Wno-deprecated.cmake b/Tests/RunCMake/CommandLine/Wno-deprecated.cmake new file mode 100644 index 0000000..3142b42 --- /dev/null +++ b/Tests/RunCMake/CommandLine/Wno-deprecated.cmake @@ -0,0 +1 @@ +message(DEPRECATION "Some deprecated warning") diff --git a/Tests/RunCMake/CommandLine/Wno-dev.cmake b/Tests/RunCMake/CommandLine/Wno-dev.cmake index d81b858..802b435 100644 --- a/Tests/RunCMake/CommandLine/Wno-dev.cmake +++ b/Tests/RunCMake/CommandLine/Wno-dev.cmake @@ -1,4 +1,4 @@ -message(AUTHOR_WARNING "Some Author Warning") +message(AUTHOR_WARNING "Some author warning") # without -Wno-dev this will also cause an AUTHOR_WARNING message, checks that # messages issued outside of the message command, by other CMake commands, also diff --git a/Tests/RunCMake/Framework/FrameworkLayout.cmake b/Tests/RunCMake/Framework/FrameworkLayout.cmake index 107afdf..5184755 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 27d10d8..da1ccb4 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 0000000..5d5f8f0 --- /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 373baad..b81a5f7 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 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/Framework/res.txt diff --git a/Tests/RunCMake/message/RunCMakeTest.cmake b/Tests/RunCMake/message/RunCMakeTest.cmake index d2bc0c3..294dfbb 100644 --- a/Tests/RunCMake/message/RunCMakeTest.cmake +++ b/Tests/RunCMake/message/RunCMakeTest.cmake @@ -1,5 +1,6 @@ include(RunCMake) +run_cmake(defaultmessage) run_cmake(nomessage) run_cmake(warnmessage) run_cmake(errormessage) diff --git a/Tests/RunCMake/message/defaultmessage-result.txt b/Tests/RunCMake/message/defaultmessage-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/message/defaultmessage-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/message/defaultmessage-stderr.txt b/Tests/RunCMake/message/defaultmessage-stderr.txt new file mode 100644 index 0000000..dd1b28f --- /dev/null +++ b/Tests/RunCMake/message/defaultmessage-stderr.txt @@ -0,0 +1,11 @@ +^CMake Deprecation Warning at defaultmessage.cmake:2 \(message\): + This is a deprecation warning +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Warning \(dev\) at defaultmessage.cmake:4 \(message\): + This is a author warning +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/message/defaultmessage.cmake b/Tests/RunCMake/message/defaultmessage.cmake new file mode 100644 index 0000000..427014d --- /dev/null +++ b/Tests/RunCMake/message/defaultmessage.cmake @@ -0,0 +1,4 @@ + +message(DEPRECATION "This is a deprecation warning") + +message(AUTHOR_WARNING "This is a author warning") diff --git a/Tests/RunCMake/message/nomessage.cmake b/Tests/RunCMake/message/nomessage.cmake index bcc97be..78f4769 100644 --- a/Tests/RunCMake/message/nomessage.cmake +++ b/Tests/RunCMake/message/nomessage.cmake @@ -1,2 +1,8 @@ +set(CMAKE_WARN_DEPRECATED OFF) + message(DEPRECATION "This is not issued") + +set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS ON) + +message(AUTHOR_WARNING "This is not issued") diff --git a/Tests/RunCMake/message/warnmessage-stderr.txt b/Tests/RunCMake/message/warnmessage-stderr.txt index 5c44566..e60af6e 100644 --- a/Tests/RunCMake/message/warnmessage-stderr.txt +++ b/Tests/RunCMake/message/warnmessage-stderr.txt @@ -1,4 +1,11 @@ -CMake Deprecation Warning at warnmessage.cmake:4 \(message\): - This is a warning +^CMake Deprecation Warning at warnmessage.cmake:4 \(message\): + This is a deprecation warning Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + + +CMake Warning \(dev\) at warnmessage.cmake:8 \(message\): + This is a author warning +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/message/warnmessage.cmake b/Tests/RunCMake/message/warnmessage.cmake index 4c421a1..53f2a43 100644 --- a/Tests/RunCMake/message/warnmessage.cmake +++ b/Tests/RunCMake/message/warnmessage.cmake @@ -1,4 +1,8 @@ set(CMAKE_WARN_DEPRECATED ON) -message(DEPRECATION "This is a warning") +message(DEPRECATION "This is a deprecation warning") + +set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS OFF) + +message(AUTHOR_WARNING "This is a author warning") diff --git a/Utilities/KWIML/ABI.h.in b/Utilities/KWIML/ABI.h.in index 6300ada..87b6e96 100644 --- a/Utilities/KWIML/ABI.h.in +++ b/Utilities/KWIML/ABI.h.in @@ -398,6 +398,10 @@ suppression macro @KWIML@_ABI_NO_VERIFY was defined. #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 diff --git a/Utilities/Scripts/BoostScanDeps.cmake b/Utilities/Scripts/BoostScanDeps.cmake new file mode 100644 index 0000000..1fbea4b --- /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 <rleigh@codelibre.net> + +#============================================================================= +# 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]*<boost/[^>][^>]*>") + # 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() |