diff options
95 files changed, 567 insertions, 573 deletions
diff --git a/Help/manual/cmake-developer.7.rst b/Help/manual/cmake-developer.7.rst index 7bfdcad..afaccc6 100644 --- a/Help/manual/cmake-developer.7.rst +++ b/Help/manual/cmake-developer.7.rst @@ -24,9 +24,10 @@ to build with such toolchains. std::auto_ptr ------------- -Some implementations have a ``std::auto_ptr`` which can not be used as a -return value from a function. ``std::auto_ptr`` may not be used. Use -``cmsys::auto_ptr`` instead. +The ``std::auto_ptr`` template is deprecated in C++11. We want to use it +so we can build on C++98 compilers but we do not want to turn off compiler +warnings about deprecated interfaces in general. Use the ``CM_AUTO_PTR`` +macro instead. size_t ------ diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index 43f4637..0cfe983 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -51,6 +51,14 @@ The :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` variable may also be used to determine whether to report an error on use of deprecated macros or functions. +Policies Introduced by CMake 3.7 +================================ + +.. toctree:: + :maxdepth: 1 + + CMP0066: Honor per-config flags in try_compile() source-file signature. </policy/CMP0066> + Policies Introduced by CMake 3.4 ================================ diff --git a/Help/policy/CMP0066.rst b/Help/policy/CMP0066.rst new file mode 100644 index 0000000..d1dcb0e --- /dev/null +++ b/Help/policy/CMP0066.rst @@ -0,0 +1,27 @@ +CMP0066 +------- + +Honor per-config flags in :command:`try_compile` source-file signature. + +The source file signature of the :command:`try_compile` command uses the value +of the :variable:`CMAKE_<LANG>_FLAGS` variable in the test project so that the +test compilation works as it would in the main project. However, CMake 3.6 and +below do not also honor config-specific compiler flags such as those in the +:variable:`CMAKE_<LANG>_FLAGS_DEBUG` variable. CMake 3.7 and above prefer to +honor config-specific compiler flags too. This policy provides compatibility +for projects that do not expect config-specific compiler flags to be used. + +The ``OLD`` behavior of this policy is to ignore config-specific flag +variables like :variable:`CMAKE_<LANG>_FLAGS_DEBUG` and only use CMake's +built-in defaults for the current compiler and platform. + +The ``NEW`` behavior of this policy is to honor config-specific flag +variabldes like :variable:`CMAKE_<LANG>_FLAGS_DEBUG`. + +This policy was introduced in CMake version 3.7. Unlike most policies, +CMake version |release| does *not* warn by default when this policy +is not set and simply uses OLD behavior. See documentation of the +:variable:`CMAKE_POLICY_WARNING_CMP0066 <CMAKE_POLICY_WARNING_CMP<NNNN>>` +variable to control the warning. + +.. include:: DEPRECATED.txt diff --git a/Help/release/3.6.rst b/Help/release/3.6.rst index 5c08b39..771c9dd 100644 --- a/Help/release/3.6.rst +++ b/Help/release/3.6.rst @@ -42,11 +42,6 @@ Commands commands gained support for the ``%s`` placeholder. This is the number of seconds since the UNIX Epoch. -* The :command:`try_compile` command source file signature now honors - configuration-specific flags (e.g. :variable:`CMAKE_<LANG>_FLAGS_DEBUG`) - in the generated test project. Previously only the default such flags - for the current toolchain were used. - Variables --------- diff --git a/Help/release/dev/GenerateExportHeader-custom-content.rst b/Help/release/dev/GenerateExportHeader-custom-content.rst new file mode 100644 index 0000000..161261c --- /dev/null +++ b/Help/release/dev/GenerateExportHeader-custom-content.rst @@ -0,0 +1,6 @@ +GenerateExportHeader-custom-content +----------------------------------- + +* The :module:`GenerateExportHeader` module learned a new + ``CUSTOM_CONTENT_FROM_VARIABLE`` option to specify a variable + containing custom content for inclusion in the generated header. diff --git a/Help/release/dev/try_compile-config-flags.rst b/Help/release/dev/try_compile-config-flags.rst new file mode 100644 index 0000000..ebfd6a4 --- /dev/null +++ b/Help/release/dev/try_compile-config-flags.rst @@ -0,0 +1,7 @@ +try_compile-config-flags +------------------------ + +* The :command:`try_compile` command source file signature now honors + configuration-specific flags (e.g. :variable:`CMAKE_<LANG>_FLAGS_DEBUG`) + in the generated test project. Previously only the default such flags + for the current toolchain were used. See policy :policy:`CMP0066`. diff --git a/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst b/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst index 582f9e4..36cf75f 100644 --- a/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst +++ b/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst @@ -15,6 +15,8 @@ warn by default: policy :policy:`CMP0060`. * ``CMAKE_POLICY_WARNING_CMP0065`` controls the warning for policy :policy:`CMP0065`. +* ``CMAKE_POLICY_WARNING_CMP0066`` controls the warning for + policy :policy:`CMP0066`. This variable should not be set by a project in CMake code. Project developers running CMake may set this variable in their cache to diff --git a/Help/variable/CMAKE_TRY_COMPILE_PLATFORM_VARIABLES.rst b/Help/variable/CMAKE_TRY_COMPILE_PLATFORM_VARIABLES.rst index 8e43465..0f96787 100644 --- a/Help/variable/CMAKE_TRY_COMPILE_PLATFORM_VARIABLES.rst +++ b/Help/variable/CMAKE_TRY_COMPILE_PLATFORM_VARIABLES.rst @@ -8,3 +8,19 @@ the host project. This variable should not be set by project code. It is meant to be set by CMake's platform information modules for the current toolchain, or by a toolchain file when used with :variable:`CMAKE_TOOLCHAIN_FILE`. + +Variables meaningful to CMake, such as :variable:`CMAKE_<LANG>_FLAGS`, are +propagated automatically. The ``CMAKE_TRY_COMPILE_PLATFORM_VARIABLES`` +variable may be set to pass custom variables meaningful to a toolchain file. +For example, a toolchain file may contain: + +.. code-block:: cmake + + set(CMAKE_SYSTEM_NAME ...) + set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES MY_CUSTOM_VARIABLE) + # ... use MY_CUSTOM_VARIABLE ... + +If a user passes ``-DMY_CUSTOM_VARIABLE=SomeValue`` to CMake then this +setting will be made visible to the toolchain file both for the main +project and for test projects generated by the :command:`try_compile` +command source file signature. diff --git a/Modules/CMakeASMInformation.cmake b/Modules/CMakeASMInformation.cmake index 0e547c4..1bb16ac 100644 --- a/Modules/CMakeASMInformation.cmake +++ b/Modules/CMakeASMInformation.cmake @@ -76,10 +76,11 @@ endif() # Support for CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT and friends: set(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT "$ENV{ASM${ASM_DIALECT}FLAGS} ${CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT}") -# avoid just having a space as the initial value for the cache -if(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT STREQUAL " ") - set(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT) -endif() + +foreach(c "" _DEBUG _RELEASE _MINSIZEREL _RELWITHDEBINFO) + string(STRIP "${CMAKE_ASM${ASM_DIALECT}_FLAGS${c}_INIT}" CMAKE_ASM${ASM_DIALECT}_FLAGS${c}_INIT) +endforeach() + set (CMAKE_ASM${ASM_DIALECT}_FLAGS "${CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT}" CACHE STRING "Flags used by the assembler during all build types.") diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake index fa87ca8..98eedc4 100644 --- a/Modules/CMakeCInformation.cmake +++ b/Modules/CMakeCInformation.cmake @@ -111,10 +111,11 @@ if(NOT CMAKE_MODULE_EXISTS) endif() set(CMAKE_C_FLAGS_INIT "$ENV{CFLAGS} ${CMAKE_C_FLAGS_INIT}") -# avoid just having a space as the initial value for the cache -if(CMAKE_C_FLAGS_INIT STREQUAL " ") - set(CMAKE_C_FLAGS_INIT) -endif() + +foreach(c "" _DEBUG _RELEASE _MINSIZEREL _RELWITHDEBINFO) + string(STRIP "${CMAKE_C_FLAGS${c}_INIT}" CMAKE_C_FLAGS${c}_INIT) +endforeach() + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS_INIT}" CACHE STRING "Flags used by the compiler during all build types.") diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake index b35280f..07e4f39 100644 --- a/Modules/CMakeCXXInformation.cmake +++ b/Modules/CMakeCXXInformation.cmake @@ -206,10 +206,11 @@ endforeach() # use _INIT variables so that this only happens the first time # and you can set these flags in the cmake cache set(CMAKE_CXX_FLAGS_INIT "$ENV{CXXFLAGS} ${CMAKE_CXX_FLAGS_INIT}") -# avoid just having a space as the initial value for the cache -if(CMAKE_CXX_FLAGS_INIT STREQUAL " ") - set(CMAKE_CXX_FLAGS_INIT) -endif() + +foreach(c "" _DEBUG _RELEASE _MINSIZEREL _RELWITHDEBINFO) + string(STRIP "${CMAKE_CXX_FLAGS${c}_INIT}" CMAKE_CXX_FLAGS${c}_INIT) +endforeach() + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_INIT}" CACHE STRING "Flags used by the compiler during all build types.") diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake index 1fd0972..45dbfcc 100644 --- a/Modules/CMakeFortranInformation.cmake +++ b/Modules/CMakeFortranInformation.cmake @@ -173,10 +173,11 @@ endif() set(CMAKE_VERBOSE_MAKEFILE FALSE CACHE BOOL "If this value is on, makefiles will be generated without the .SILENT directive, and all commands will be echoed to the console during the make. This is useful for debugging only. With Visual Studio IDE projects all commands are done without /nologo.") set(CMAKE_Fortran_FLAGS_INIT "$ENV{FFLAGS} ${CMAKE_Fortran_FLAGS_INIT}") -# avoid just having a space as the initial value for the cache -if(CMAKE_Fortran_FLAGS_INIT STREQUAL " ") - set(CMAKE_Fortran_FLAGS_INIT) -endif() + +foreach(c "" _DEBUG _RELEASE _MINSIZEREL _RELWITHDEBINFO) + string(STRIP "${CMAKE_Fortran_FLAGS${c}_INIT}" CMAKE_Fortran_FLAGS${c}_INIT) +endforeach() + set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS_INIT}" CACHE STRING "Flags for Fortran compiler.") diff --git a/Modules/CMakeRCInformation.cmake b/Modules/CMakeRCInformation.cmake index 94abd4b..60276e2 100644 --- a/Modules/CMakeRCInformation.cmake +++ b/Modules/CMakeRCInformation.cmake @@ -28,9 +28,9 @@ set(CMAKE_SYSTEM_AND_RC_COMPILER_INFO_FILE ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake) include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL) +string(STRIP "$ENV{RCFLAGS} ${CMAKE_RC_FLAGS_INIT}" CMAKE_RC_FLAGS_INIT) - -set (CMAKE_RC_FLAGS "$ENV{RCFLAGS} ${CMAKE_RC_FLAGS_INIT}" CACHE STRING +set (CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS_INIT}" CACHE STRING "Flags for Windows Resource Compiler.") # These are the only types of flags that should be passed to the rc diff --git a/Modules/CPackComponent.cmake b/Modules/CPackComponent.cmake index 038a717..6a33086 100644 --- a/Modules/CPackComponent.cmake +++ b/Modules/CPackComponent.cmake @@ -360,6 +360,20 @@ macro(cpack_append_string_variable_set_command var strvar) endif () endmacro() +# Macro that appends a SET command for the given list variable name (var) +# to the macro named strvar, but only if the variable named "var" +# has been defined. It's like add variable, but wrap each item to quotes. +# The string will eventually be appended to a CPack configuration file. +macro(cpack_append_list_variable_set_command var strvar) + if (DEFINED ${var}) + string(APPEND ${strvar} "set(${var}") + foreach(_val IN LISTS ${var}) + string(APPEND ${strvar} "\n \"${_val}\"") + endforeach() + string(APPEND ${strvar} ")\n") + endif () +endmacro() + # Macro that appends a SET command for the given variable name (var) # to the macro named strvar, but only if the variable named "var" # has been set to true. The string will eventually be diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake index 083fc28..2f0e03e 100644 --- a/Modules/CPackIFW.cmake +++ b/Modules/CPackIFW.cmake @@ -571,7 +571,7 @@ macro(cpack_ifw_configure_component compname) endforeach() foreach(_IFW_ARG_NAME ${_IFW_MULTI_ARGS}) - cpack_append_variable_set_command( + cpack_append_list_variable_set_command( CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_${_IFW_ARG_NAME} _CPACK_IFWCOMP_STR) endforeach() @@ -604,7 +604,7 @@ macro(cpack_ifw_configure_component_group grpname) endforeach() foreach(_IFW_ARG_NAME ${_IFW_MULTI_ARGS}) - cpack_append_variable_set_command( + cpack_append_list_variable_set_command( CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_${_IFW_ARG_NAME} _CPACK_IFWGRP_STR) endforeach() diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index d231ff0..7706bbc 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -1683,8 +1683,8 @@ function(cpack_rpm_generate_package) set(CPACK_RPM_USER_INSTALL_FILES "") foreach(F IN LISTS CPACK_RPM_USER_FILELIST_INTERNAL) - string(REGEX REPLACE "%[A-Za-z0-9\(\),-]* " "" F_PATH ${F}) - string(REGEX MATCH "%[A-Za-z0-9\(\),-]*" F_PREFIX ${F}) + string(REGEX REPLACE "%[A-Za-z]+(\\([^()]*\\))? " "" F_PATH ${F}) + string(REGEX MATCH "%[A-Za-z]+(\\([^()]*\\))?" F_PREFIX ${F}) if(CPACK_RPM_PACKAGE_DEBUG) message("CPackRPM:Debug: F_PREFIX=<${F_PREFIX}>, F_PATH=<${F_PATH}>") diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index 6389d30..6205b8c 100644 --- a/Modules/GenerateExportHeader.cmake +++ b/Modules/GenerateExportHeader.cmake @@ -20,6 +20,7 @@ # [NO_DEPRECATED_MACRO_NAME <no_deprecated_macro_name>] # [DEFINE_NO_DEPRECATED] # [PREFIX_NAME <prefix_name>] +# [CUSTOM_CONTENT_FROM_VARIABLE <variable>] # ) # # @@ -60,8 +61,10 @@ # The CMake fragment will generate a file in the # ``${CMAKE_CURRENT_BINARY_DIR}`` called ``somelib_export.h`` containing the # macros ``SOMELIB_EXPORT``, ``SOMELIB_NO_EXPORT``, ``SOMELIB_DEPRECATED``, -# ``SOMELIB_DEPRECATED_EXPORT`` and ``SOMELIB_DEPRECATED_NO_EXPORT``. The -# resulting file should be installed with other headers in the library. +# ``SOMELIB_DEPRECATED_EXPORT`` and ``SOMELIB_DEPRECATED_NO_EXPORT``. +# They will be followed by content taken from the variable specified by +# the ``CUSTOM_CONTENT_FROM_VARIABLE`` option, if any. +# The resulting file should be installed with other headers in the library. # # The ``BASE_NAME`` argument can be used to override the file name and the # names used for the macros: @@ -288,7 +291,7 @@ macro(_DO_GENERATE_EXPORT_HEADER TARGET_LIBRARY) set(options DEFINE_NO_DEPRECATED) set(oneValueArgs PREFIX_NAME BASE_NAME EXPORT_MACRO_NAME EXPORT_FILE_NAME DEPRECATED_MACRO_NAME NO_EXPORT_MACRO_NAME STATIC_DEFINE - NO_DEPRECATED_MACRO_NAME) + NO_DEPRECATED_MACRO_NAME CUSTOM_CONTENT_FROM_VARIABLE) set(multiValueArgs) cmake_parse_arguments(_GEH "${options}" "${oneValueArgs}" "${multiValueArgs}" @@ -361,6 +364,14 @@ macro(_DO_GENERATE_EXPORT_HEADER TARGET_LIBRARY) endif() string(MAKE_C_IDENTIFIER ${EXPORT_IMPORT_CONDITION} EXPORT_IMPORT_CONDITION) + if(_GEH_CUSTOM_CONTENT_FROM_VARIABLE) + if(DEFINED "${_GEH_CUSTOM_CONTENT_FROM_VARIABLE}") + set(CUSTOM_CONTENT "${${_GEH_CUSTOM_CONTENT_FROM_VARIABLE}}") + else() + set(CUSTOM_CONTENT "") + endif() + endif() + configure_file("${_GENERATE_EXPORT_HEADER_MODULE_DIR}/exportheader.cmake.in" "${EXPORT_FILE_NAME}" @ONLY) endmacro() diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake index aa84077..1c6e751 100644 --- a/Modules/InstallRequiredSystemLibraries.cmake +++ b/Modules/InstallRequiredSystemLibraries.cmake @@ -25,8 +25,8 @@ # # ``CMAKE_INSTALL_UCRT_LIBRARIES`` # Set to TRUE to install the Windows Universal CRT libraries for -# app-local deployment. This is meaningful only with MSVC from -# Visual Studio 2015 or higher. +# app-local deployment (e.g. to Windows XP). This is meaningful +# only with MSVC from Visual Studio 2015 or higher. # # ``CMAKE_INSTALL_MFC_LIBRARIES`` # Set to TRUE to install the MSVC MFC runtime libraries. diff --git a/Modules/exportheader.cmake.in b/Modules/exportheader.cmake.in index 7cfbcbd..9dd75bf 100644 --- a/Modules/exportheader.cmake.in +++ b/Modules/exportheader.cmake.in @@ -38,5 +38,5 @@ # define @NO_DEPRECATED_MACRO_NAME@ # endif #endif - +@CUSTOM_CONTENT@ #endif diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index fd73984..d49ebbb 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -364,6 +364,7 @@ set(SRCS cmake.cxx cmake.h + cm_auto_ptr.hxx cm_get_date.h cm_get_date.c cm_sha2.h diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 4e2ea58..98a00a8 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160628) +set(CMake_VERSION_PATCH 20160706) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/IFW/cmCPackIFWRepository.cxx b/Source/CPack/IFW/cmCPackIFWRepository.cxx index ee6d5e5..fcb1c77 100644 --- a/Source/CPack/IFW/cmCPackIFWRepository.cxx +++ b/Source/CPack/IFW/cmCPackIFWRepository.cxx @@ -299,8 +299,8 @@ void cmCPackIFWRepository::WriteRepositoryUpdate(cmXMLWriter& xout) if (Update == Add || Update == Remove) { xout.Attribute("url", Url); } else if (Update == Replace) { - xout.Attribute("oldurl", OldUrl); - xout.Attribute("newurl", NewUrl); + xout.Attribute("oldUrl", OldUrl); + xout.Attribute("newUrl", NewUrl); } // Enabled if (!Enabled.empty()) { diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index b5b364d..97216c3 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -1044,7 +1044,7 @@ std::string cmCPackWIXGenerator::CreateNewIdForPath(std::string const& path) std::string cmCPackWIXGenerator::CreateHashedId( std::string const& path, std::string const& normalizedFilename) { - cmsys::auto_ptr<cmCryptoHash> sha1 = cmCryptoHash::New("SHA1"); + CM_AUTO_PTR<cmCryptoHash> sha1 = cmCryptoHash::New("SHA1"); std::string hash = sha1->HashString(path.c_str()); std::string identifier; diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 914d0dc..df8bb0f 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -624,7 +624,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( cm.AddCMakePaths(); cm.SetProgressCallback(cmCPackGeneratorProgress, this); cmGlobalGenerator gg(&cm); - cmsys::auto_ptr<cmMakefile> mf( + CM_AUTO_PTR<cmMakefile> mf( new cmMakefile(&gg, cm.GetCurrentSnapshot())); if (!installSubDirectory.empty() && installSubDirectory != "/") { tempInstallDirectory += installSubDirectory; diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index b4a2c6f..771519c 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -185,7 +185,7 @@ int main(int argc, char const* const* argv) cminst.GetCurrentSnapshot().SetDefaultDefinitions(); cminst.GetState()->RemoveUnscriptableCommands(); cmGlobalGenerator cmgg(&cminst); - cmsys::auto_ptr<cmMakefile> globalMF( + CM_AUTO_PTR<cmMakefile> globalMF( new cmMakefile(&cmgg, cminst.GetCurrentSnapshot())); #if defined(__CYGWIN__) globalMF->AddDefinition("CMAKE_LEGACY_CYGWIN_WIN32", "0"); diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index 477f16e..3eed79e 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -612,7 +612,7 @@ int cmCTestLaunch::Main(int argc, const char* const argv[]) #include "cmGlobalGenerator.h" #include "cmMakefile.h" #include "cmake.h" -#include <cmsys/auto_ptr.hxx> +#include <cm_auto_ptr.hxx> void cmCTestLaunch::LoadConfig() { cmake cm; @@ -620,7 +620,7 @@ void cmCTestLaunch::LoadConfig() cm.SetHomeOutputDirectory(""); cm.GetCurrentSnapshot().SetDefaultDefinitions(); cmGlobalGenerator gg(&cm); - cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot())); + CM_AUTO_PTR<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot())); std::string fname = this->LogDir; fname += "CTestLaunchConfig.cmake"; if (cmSystemTools::FileExists(fname.c_str()) && diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 1b6b442..cd250fb 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1352,7 +1352,7 @@ void cmCTestTestHandler::GetListOfTests() cm.SetHomeOutputDirectory(""); cm.GetCurrentSnapshot().SetDefaultDefinitions(); cmGlobalGenerator gg(&cm); - cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot())); + CM_AUTO_PTR<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot())); mf->AddDefinition("CTEST_CONFIGURATION_TYPE", this->CTest->GetConfigType().c_str()); diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index 8131c90..ac7eb05 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -30,7 +30,7 @@ #include "cmCTestSVN.h" #include "cmCTestVC.h" -#include <cmsys/auto_ptr.hxx> +#include <cm_auto_ptr.hxx> //#include <cmsys/RegularExpression.hxx> #include <cmsys/Process.h> @@ -159,7 +159,7 @@ int cmCTestUpdateHandler::ProcessHandler() , this->Quiet); // Create an object to interact with the VCS tool. - cmsys::auto_ptr<cmCTestVC> vc; + CM_AUTO_PTR<cmCTestVC> vc; switch (this->UpdateType) { case e_CVS: vc.reset(new cmCTestCVS(this->CTest, ofs)); diff --git a/Source/Checks/cm_cxx_override.cxx b/Source/Checks/cm_cxx_override.cxx index e196968..5a33fbb 100644 --- a/Source/Checks/cm_cxx_override.cxx +++ b/Source/Checks/cm_cxx_override.cxx @@ -1,11 +1,13 @@ struct Foo { + Foo() {} virtual ~Foo() {} virtual int test() const = 0; }; struct Bar : Foo { + Bar() {} ~Bar() override {} int test() const override { return 0; } }; diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 68c65ac..80c0dc0 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -36,6 +36,12 @@ if (Qt5Widgets_FOUND) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}") + if(CMake_QT_STATIC_QXcbIntegrationPlugin_LIBRARIES) + list(APPEND CMake_QT_LIBRARIES ${CMake_QT_STATIC_QXcbIntegrationPlugin_LIBRARIES}) + set_property(SOURCE CMakeSetup.cxx + PROPERTY COMPILE_DEFINITIONS USE_QXcbIntegrationPlugin) + endif() + # We need to install platform plugin and add qt.conf for Qt5 on Mac and Windows. # FIXME: This should be part of Qt5 CMake scripts, but unfortunatelly # Qt5 support is missing there. diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index c849d52..ee3389c 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -22,6 +22,7 @@ #include <QString> #include <QTextCodec> #include <QTranslator> +#include <QtPlugin> #include <cmsys/CommandLineArguments.hxx> #include <cmsys/Encoding.hxx> #include <cmsys/SystemTools.hxx> @@ -44,6 +45,10 @@ static int cmOSXInstall(std::string dir); static void cmAddPluginPath(); #endif +#if defined(USE_QXcbIntegrationPlugin) +Q_IMPORT_PLUGIN(QXcbIntegrationPlugin); +#endif + int main(int argc, char** argv) { cmsys::Encoding::CommandLineArguments encoding_args = diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index fc218c9..3bb997a 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -51,7 +51,7 @@ #include <math.h> #include <stdlib.h> -#include <cmsys/auto_ptr.hxx> +#include <cm_auto_ptr.hxx> #include <cm_zlib.h> #include <cmsys/Base64.h> @@ -474,7 +474,7 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) cm.SetHomeOutputDirectory(""); cm.GetCurrentSnapshot().SetDefaultDefinitions(); cmGlobalGenerator gg(&cm); - cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot())); + CM_AUTO_PTR<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot())); if (!this->ReadCustomConfigurationFileTree(this->BinaryDir.c_str(), mf.get())) { cmCTestOptionalLog( @@ -1165,7 +1165,7 @@ int cmCTest::RunTest(std::vector<const char*> argv, std::string* output, } std::string oldpath = cmSystemTools::GetCurrentWorkingDirectory(); - cmsys::auto_ptr<cmSystemTools::SaveRestoreEnvironment> saveEnv; + CM_AUTO_PTR<cmSystemTools::SaveRestoreEnvironment> saveEnv; if (modifyEnv) { saveEnv.reset(new cmSystemTools::SaveRestoreEnvironment); cmSystemTools::AppendEnv(*environment); @@ -1193,7 +1193,7 @@ int cmCTest::RunTest(std::vector<const char*> argv, std::string* output, *output = ""; } - cmsys::auto_ptr<cmSystemTools::SaveRestoreEnvironment> saveEnv; + CM_AUTO_PTR<cmSystemTools::SaveRestoreEnvironment> saveEnv; if (modifyEnv) { saveEnv.reset(new cmSystemTools::SaveRestoreEnvironment); cmSystemTools::AppendEnv(*environment); diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 7d35a9e..e9367b1 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -333,14 +333,43 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv, fprintf(fout, "set(CMAKE_%s_FLAGS \"${CMAKE_%s_FLAGS}" " ${COMPILE_DEFINITIONS}\")\n", li->c_str(), li->c_str()); - static std::string const cfgDefault = "DEBUG"; - std::string const cfg = - !tcConfig.empty() ? cmSystemTools::UpperCase(tcConfig) : cfgDefault; - std::string const langFlagsCfg = "CMAKE_" + *li + "_FLAGS_" + cfg; - const char* flagsCfg = this->Makefile->GetDefinition(langFlagsCfg); - fprintf( - fout, "set(%s %s)\n", langFlagsCfg.c_str(), - cmOutputConverter::EscapeForCMake(flagsCfg ? flagsCfg : "").c_str()); + } + switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0066)) { + case cmPolicies::WARN: + if (this->Makefile->PolicyOptionalWarningEnabled( + "CMAKE_POLICY_WARNING_CMP0066")) { + std::ostringstream w; + /* clang-format off */ + w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0066) << "\n" + "For compatibility with older versions of CMake, try_compile " + "is not honoring caller config-specific compiler flags " + "(e.g. CMAKE_C_FLAGS_DEBUG) in the test project." + ; + /* clang-format on */ + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + } + case cmPolicies::OLD: + // OLD behavior is to do nothing. + break; + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + this->Makefile->IssueMessage( + cmake::FATAL_ERROR, + cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0066)); + case cmPolicies::NEW: { + // NEW behavior is to pass config-specific compiler flags. + static std::string const cfgDefault = "DEBUG"; + std::string const cfg = + !tcConfig.empty() ? cmSystemTools::UpperCase(tcConfig) : cfgDefault; + for (std::set<std::string>::iterator li = testLangs.begin(); + li != testLangs.end(); ++li) { + std::string const langFlagsCfg = "CMAKE_" + *li + "_FLAGS_" + cfg; + const char* flagsCfg = this->Makefile->GetDefinition(langFlagsCfg); + fprintf(fout, "set(%s %s)\n", langFlagsCfg.c_str(), + cmOutputConverter::EscapeForCMake(flagsCfg ? flagsCfg : "") + .c_str()); + } + } break; } switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0056)) { case cmPolicies::WARN: diff --git a/Source/cmCryptoHash.cxx b/Source/cmCryptoHash.cxx index e54b3c7..8d60c1f 100644 --- a/Source/cmCryptoHash.cxx +++ b/Source/cmCryptoHash.cxx @@ -15,22 +15,22 @@ #include <cmsys/FStream.hxx> #include <cmsys/MD5.h> -cmsys::auto_ptr<cmCryptoHash> cmCryptoHash::New(const char* algo) +CM_AUTO_PTR<cmCryptoHash> cmCryptoHash::New(const char* algo) { if (strcmp(algo, "MD5") == 0) { - return cmsys::auto_ptr<cmCryptoHash>(new cmCryptoHashMD5); + return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHashMD5); } else if (strcmp(algo, "SHA1") == 0) { - return cmsys::auto_ptr<cmCryptoHash>(new cmCryptoHashSHA1); + return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHashSHA1); } else if (strcmp(algo, "SHA224") == 0) { - return cmsys::auto_ptr<cmCryptoHash>(new cmCryptoHashSHA224); + return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHashSHA224); } else if (strcmp(algo, "SHA256") == 0) { - return cmsys::auto_ptr<cmCryptoHash>(new cmCryptoHashSHA256); + return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHashSHA256); } else if (strcmp(algo, "SHA384") == 0) { - return cmsys::auto_ptr<cmCryptoHash>(new cmCryptoHashSHA384); + return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHashSHA384); } else if (strcmp(algo, "SHA512") == 0) { - return cmsys::auto_ptr<cmCryptoHash>(new cmCryptoHashSHA512); + return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHashSHA512); } else { - return cmsys::auto_ptr<cmCryptoHash>(CM_NULLPTR); + return CM_AUTO_PTR<cmCryptoHash>(CM_NULLPTR); } } diff --git a/Source/cmCryptoHash.h b/Source/cmCryptoHash.h index 85adf69..6aaaf93 100644 --- a/Source/cmCryptoHash.h +++ b/Source/cmCryptoHash.h @@ -14,13 +14,13 @@ #include "cmStandardIncludes.h" -#include <cmsys/auto_ptr.hxx> +#include <cm_auto_ptr.hxx> class cmCryptoHash { public: virtual ~cmCryptoHash() {} - static cmsys::auto_ptr<cmCryptoHash> New(const char* algo); + static CM_AUTO_PTR<cmCryptoHash> New(const char* algo); std::string HashString(const std::string& input); std::string HashFile(const std::string& file); diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx index 2b9248d..7533369 100644 --- a/Source/cmCustomCommand.cxx +++ b/Source/cmCustomCommand.cxx @@ -13,7 +13,7 @@ #include "cmMakefile.h" -#include <cmsys/auto_ptr.hxx> +#include <cm_auto_ptr.hxx> cmCustomCommand::cmCustomCommand() : Backtrace() diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index 315a1b6..6165bcf 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -66,7 +66,7 @@ std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const } } - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = this->GE->Parse(argv0); + CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = this->GE->Parse(argv0); std::string exe = cge->Evaluate(this->LG, this->Config); return exe; @@ -145,7 +145,7 @@ std::vector<std::string> const& cmCustomCommandGenerator::GetDepends() const std::vector<std::string> depends = this->CC.GetDepends(); for (std::vector<std::string>::const_iterator i = depends.begin(); i != depends.end(); ++i) { - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = this->GE->Parse(*i); + CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = this->GE->Parse(*i); std::vector<std::string> result; cmSystemTools::ExpandListArgument(cge->Evaluate(this->LG, this->Config), result); diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx index 59667cd..15755cb 100644 --- a/Source/cmELF.cxx +++ b/Source/cmELF.cxx @@ -13,8 +13,8 @@ #include "cmELF.h" +#include <cm_auto_ptr.hxx> #include <cmsys/FStream.hxx> -#include <cmsys/auto_ptr.hxx> // Include the ELF format information system header. #if defined(__OpenBSD__) @@ -107,7 +107,7 @@ public: }; // Construct and take ownership of the file stream object. - cmELFInternal(cmELF* external, cmsys::auto_ptr<cmsys::ifstream>& fin, + cmELFInternal(cmELF* external, CM_AUTO_PTR<cmsys::ifstream>& fin, ByteOrderType order) : External(external) , Stream(*fin.release()) @@ -237,7 +237,7 @@ public: typedef typename Types::tagtype tagtype; // Construct with a stream and byte swap indicator. - cmELFInternalImpl(cmELF* external, cmsys::auto_ptr<cmsys::ifstream>& fin, + cmELFInternalImpl(cmELF* external, CM_AUTO_PTR<cmsys::ifstream>& fin, ByteOrderType order); // Return the number of sections as specified by the ELF header. @@ -537,8 +537,9 @@ private: }; template <class Types> -cmELFInternalImpl<Types>::cmELFInternalImpl( - cmELF* external, cmsys::auto_ptr<cmsys::ifstream>& fin, ByteOrderType order) +cmELFInternalImpl<Types>::cmELFInternalImpl(cmELF* external, + CM_AUTO_PTR<cmsys::ifstream>& fin, + ByteOrderType order) : cmELFInternal(external, fin, order) { // Read the main header. @@ -755,7 +756,7 @@ cmELF::cmELF(const char* fname) : Internal(CM_NULLPTR) { // Try to open the file. - cmsys::auto_ptr<cmsys::ifstream> fin(new cmsys::ifstream(fname)); + CM_AUTO_PTR<cmsys::ifstream> fin(new cmsys::ifstream(fname)); // Quit now if the file could not be opened. if (!fin.get() || !*fin) { diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 736c7da..d93e406 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -25,8 +25,8 @@ #include "cmVersion.h" #include <assert.h> +#include <cm_auto_ptr.hxx> #include <cmsys/FStream.hxx> -#include <cmsys/auto_ptr.hxx> static std::string cmExportFileGeneratorEscape(std::string const& str) { @@ -69,15 +69,15 @@ const char* cmExportFileGenerator::GetMainExportFileName() const bool cmExportFileGenerator::GenerateImportFile() { // Open the output file to generate it. - cmsys::auto_ptr<cmsys::ofstream> foutPtr; + CM_AUTO_PTR<cmsys::ofstream> foutPtr; if (this->AppendMode) { // Open for append. - cmsys::auto_ptr<cmsys::ofstream> ap( + CM_AUTO_PTR<cmsys::ofstream> ap( new cmsys::ofstream(this->MainImportFile.c_str(), std::ios::app)); foutPtr = ap; } else { // Generate atomically and with copy-if-different. - cmsys::auto_ptr<cmGeneratedFileStream> ap( + CM_AUTO_PTR<cmGeneratedFileStream> ap( new cmGeneratedFileStream(this->MainImportFile.c_str(), true)); ap->SetCopyIfDifferent(true); foutPtr = ap; @@ -393,7 +393,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface( std::string dirs = cmGeneratorExpression::Preprocess( tei->InterfaceIncludeDirectories, preprocessRule, true); this->ReplaceInstallPrefix(dirs); - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(dirs); + CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(dirs); std::string exportDirs = cge->Evaluate(target->GetLocalGenerator(), "", false, target); diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx index ab43aa8..c8272cb 100644 --- a/Source/cmExportLibraryDependenciesCommand.cxx +++ b/Source/cmExportLibraryDependenciesCommand.cxx @@ -16,7 +16,7 @@ #include "cmVersion.h" #include "cmake.h" -#include <cmsys/auto_ptr.hxx> +#include <cm_auto_ptr.hxx> bool cmExportLibraryDependenciesCommand::InitialPass( std::vector<std::string> const& args, cmExecutionStatus&) @@ -53,13 +53,13 @@ void cmExportLibraryDependenciesCommand::FinalPass() void cmExportLibraryDependenciesCommand::ConstFinalPass() const { // Use copy-if-different if not appending. - cmsys::auto_ptr<cmsys::ofstream> foutPtr; + CM_AUTO_PTR<cmsys::ofstream> foutPtr; if (this->Append) { - cmsys::auto_ptr<cmsys::ofstream> ap( + CM_AUTO_PTR<cmsys::ofstream> ap( new cmsys::ofstream(this->Filename.c_str(), std::ios::app)); foutPtr = ap; } else { - cmsys::auto_ptr<cmGeneratedFileStream> ap( + CM_AUTO_PTR<cmGeneratedFileStream> ap( new cmGeneratedFileStream(this->Filename.c_str(), true)); ap->SetCopyIfDifferent(true); foutPtr = ap; diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx index fdc0760..2916e6b 100644 --- a/Source/cmExportTryCompileFileGenerator.cxx +++ b/Source/cmExportTryCompileFileGenerator.cxx @@ -66,7 +66,7 @@ std::string cmExportTryCompileFileGenerator::FindTargets( cmGeneratorExpressionDAGChecker dagChecker(tgt->GetName(), propName, CM_NULLPTR, CM_NULLPTR); - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop); + CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(prop); cmTarget dummyHead; dummyHead.SetType(cmState::EXECUTABLE, "try_compile_dummy_exe"); diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 4aecf7c..5a1238b 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -34,12 +34,12 @@ // include sys/stat.h after sys/types.h #include <sys/stat.h> +#include <cm_auto_ptr.hxx> #include <cmsys/Directory.hxx> #include <cmsys/Encoding.hxx> #include <cmsys/FStream.hxx> #include <cmsys/Glob.hxx> #include <cmsys/RegularExpression.hxx> -#include <cmsys/auto_ptr.hxx> // Table of permissions flags. #if defined(_WIN32) && !defined(__CYGWIN__) @@ -330,7 +330,7 @@ bool cmFileCommand::HandleHashCommand(std::vector<std::string> const& args) return false; } - cmsys::auto_ptr<cmCryptoHash> hash(cmCryptoHash::New(args[0].c_str())); + CM_AUTO_PTR<cmCryptoHash> hash(cmCryptoHash::New(args[0].c_str())); if (hash.get()) { std::string out = hash->HashFile(args[1]); if (!out.empty()) { @@ -2478,7 +2478,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) const char* cainfo = this->Makefile->GetDefinition("CMAKE_TLS_CAINFO"); std::string expectedHash; std::string hashMatchMSG; - cmsys::auto_ptr<cmCryptoHash> hash; + CM_AUTO_PTR<cmCryptoHash> hash; bool showProgress = false; while (i != args.end()) { @@ -2534,7 +2534,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) this->SetError("DOWNLOAD missing sum value for EXPECTED_MD5."); return false; } - hash = cmsys::auto_ptr<cmCryptoHash>(cmCryptoHash::New("MD5")); + hash = CM_AUTO_PTR<cmCryptoHash>(cmCryptoHash::New("MD5")); hashMatchMSG = "MD5 sum"; expectedHash = cmSystemTools::LowerCase(*i); } else if (*i == "SHOW_PROGRESS") { @@ -2555,7 +2555,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) } std::string algo = i->substr(0, pos); expectedHash = cmSystemTools::LowerCase(i->substr(pos + 1)); - hash = cmsys::auto_ptr<cmCryptoHash>(cmCryptoHash::New(algo.c_str())); + hash = CM_AUTO_PTR<cmCryptoHash>(cmCryptoHash::New(algo.c_str())); if (!hash.get()) { std::string err = "DOWNLOAD EXPECTED_HASH given unknown ALGO: "; err += algo; @@ -2971,11 +2971,11 @@ void cmFileCommand::AddEvaluationFile(const std::string& inputName, cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); cmGeneratorExpression outputGe(lfbt); - cmsys::auto_ptr<cmCompiledGeneratorExpression> outputCge = + CM_AUTO_PTR<cmCompiledGeneratorExpression> outputCge = outputGe.Parse(outputExpr); cmGeneratorExpression conditionGe(lfbt); - cmsys::auto_ptr<cmCompiledGeneratorExpression> conditionCge = + CM_AUTO_PTR<cmCompiledGeneratorExpression> conditionCge = conditionGe.Parse(condition); this->Makefile->AddEvaluationFile(inputName, outputCge, conditionCge, diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 09fa795..d5fd75d 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -1500,9 +1500,9 @@ void cmFindPackageCommand::StoreVersionFound() this->Makefile->AddDefinition(ver + "_COUNT", buf); } +#include <cm_auto_ptr.hxx> #include <cmsys/Glob.hxx> #include <cmsys/String.h> -#include <cmsys/auto_ptr.hxx> class cmFileList; class cmFileListGeneratorBase @@ -1515,10 +1515,10 @@ protected: private: bool Search(cmFileList&); virtual bool Search(std::string const& parent, cmFileList&) = 0; - virtual cmsys::auto_ptr<cmFileListGeneratorBase> Clone() const = 0; + virtual CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const = 0; friend class cmFileList; cmFileListGeneratorBase* SetNext(cmFileListGeneratorBase const& next); - cmsys::auto_ptr<cmFileListGeneratorBase> Next; + CM_AUTO_PTR<cmFileListGeneratorBase> Next; }; class cmFileList @@ -1551,7 +1551,7 @@ public: private: virtual bool Visit(std::string const& fullPath) = 0; friend class cmFileListGeneratorBase; - cmsys::auto_ptr<cmFileListGeneratorBase> First; + CM_AUTO_PTR<cmFileListGeneratorBase> First; cmFileListGeneratorBase* Last; }; @@ -1621,9 +1621,9 @@ private: std::string fullPath = parent + this->String; return this->Consider(fullPath, lister); } - cmsys::auto_ptr<cmFileListGeneratorBase> Clone() const CM_OVERRIDE + CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const CM_OVERRIDE { - cmsys::auto_ptr<cmFileListGeneratorBase> g( + CM_AUTO_PTR<cmFileListGeneratorBase> g( new cmFileListGeneratorFixed(*this)); return g; } @@ -1655,9 +1655,9 @@ private: } return false; } - cmsys::auto_ptr<cmFileListGeneratorBase> Clone() const CM_OVERRIDE + CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const CM_OVERRIDE { - cmsys::auto_ptr<cmFileListGeneratorBase> g( + CM_AUTO_PTR<cmFileListGeneratorBase> g( new cmFileListGeneratorEnumerate(*this)); return g; } @@ -1706,9 +1706,9 @@ private: } return false; } - cmsys::auto_ptr<cmFileListGeneratorBase> Clone() const CM_OVERRIDE + CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const CM_OVERRIDE { - cmsys::auto_ptr<cmFileListGeneratorBase> g( + CM_AUTO_PTR<cmFileListGeneratorBase> g( new cmFileListGeneratorProject(*this)); return g; } @@ -1763,9 +1763,9 @@ private: } return false; } - cmsys::auto_ptr<cmFileListGeneratorBase> Clone() const CM_OVERRIDE + CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const CM_OVERRIDE { - cmsys::auto_ptr<cmFileListGeneratorBase> g( + CM_AUTO_PTR<cmFileListGeneratorBase> g( new cmFileListGeneratorMacProject(*this)); return g; } @@ -1807,9 +1807,9 @@ private: } return false; } - cmsys::auto_ptr<cmFileListGeneratorBase> Clone() const CM_OVERRIDE + CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const CM_OVERRIDE { - cmsys::auto_ptr<cmFileListGeneratorBase> g( + CM_AUTO_PTR<cmFileListGeneratorBase> g( new cmFileListGeneratorCaseInsensitive(*this)); return g; } @@ -1853,10 +1853,9 @@ private: } return false; } - cmsys::auto_ptr<cmFileListGeneratorBase> Clone() const CM_OVERRIDE + CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const CM_OVERRIDE { - cmsys::auto_ptr<cmFileListGeneratorBase> g( - new cmFileListGeneratorGlob(*this)); + CM_AUTO_PTR<cmFileListGeneratorBase> g(new cmFileListGeneratorGlob(*this)); return g; } }; diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx index daf43e6..c6e5f06 100644 --- a/Source/cmForEachCommand.cxx +++ b/Source/cmForEachCommand.cxx @@ -11,7 +11,7 @@ ============================================================================*/ #include "cmForEachCommand.h" -#include <cmsys/auto_ptr.hxx> +#include <cm_auto_ptr.hxx> cmForEachFunctionBlocker::cmForEachFunctionBlocker(cmMakefile* mf) : Makefile(mf) @@ -36,8 +36,7 @@ bool cmForEachFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff, // if this is the endofreach for this statement if (!this->Depth) { // Remove the function blocker for this scope or bail. - cmsys::auto_ptr<cmFunctionBlocker> fb( - mf.RemoveFunctionBlocker(this, lff)); + CM_AUTO_PTR<cmFunctionBlocker> fb(mf.RemoveFunctionBlocker(this, lff)); if (!fb.get()) { return false; } @@ -184,7 +183,7 @@ bool cmForEachCommand::InitialPass(std::vector<std::string> const& args, bool cmForEachCommand::HandleInMode(std::vector<std::string> const& args) { - cmsys::auto_ptr<cmForEachFunctionBlocker> f( + CM_AUTO_PTR<cmForEachFunctionBlocker> f( new cmForEachFunctionBlocker(this->Makefile)); f->Args.push_back(args[0]); diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 53243b8..983bfb4 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -26,14 +26,14 @@ cmGeneratorExpression::cmGeneratorExpression( { } -cmsys::auto_ptr<cmCompiledGeneratorExpression> cmGeneratorExpression::Parse( +CM_AUTO_PTR<cmCompiledGeneratorExpression> cmGeneratorExpression::Parse( std::string const& input) { - return cmsys::auto_ptr<cmCompiledGeneratorExpression>( + return CM_AUTO_PTR<cmCompiledGeneratorExpression>( new cmCompiledGeneratorExpression(this->Backtrace, input)); } -cmsys::auto_ptr<cmCompiledGeneratorExpression> cmGeneratorExpression::Parse( +CM_AUTO_PTR<cmCompiledGeneratorExpression> cmGeneratorExpression::Parse( const char* input) { return this->Parse(std::string(input ? input : "")); diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 5d02427..2f91608 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -17,8 +17,8 @@ #include "cmListFileCache.h" +#include <cm_auto_ptr.hxx> #include <cmsys/RegularExpression.hxx> -#include <cmsys/auto_ptr.hxx> class cmGeneratorTarget; class cmLocalGenerator; @@ -47,9 +47,8 @@ public: cmListFileBacktrace const& backtrace = cmListFileBacktrace()); ~cmGeneratorExpression(); - cmsys::auto_ptr<cmCompiledGeneratorExpression> Parse( - std::string const& input); - cmsys::auto_ptr<cmCompiledGeneratorExpression> Parse(const char* input); + CM_AUTO_PTR<cmCompiledGeneratorExpression> Parse(std::string const& input); + CM_AUTO_PTR<cmCompiledGeneratorExpression> Parse(const char* input); enum PreprocessContext { diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx index f9dbc2d..c01c4fc 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.cxx +++ b/Source/cmGeneratorExpressionEvaluationFile.cxx @@ -23,9 +23,8 @@ cmGeneratorExpressionEvaluationFile::cmGeneratorExpressionEvaluationFile( const std::string& input, - cmsys::auto_ptr<cmCompiledGeneratorExpression> outputFileExpr, - cmsys::auto_ptr<cmCompiledGeneratorExpression> condition, - bool inputIsContent) + CM_AUTO_PTR<cmCompiledGeneratorExpression> outputFileExpr, + CM_AUTO_PTR<cmCompiledGeneratorExpression> condition, bool inputIsContent) : Input(input) , OutputFileExpr(outputFileExpr) , Condition(condition) @@ -135,7 +134,7 @@ void cmGeneratorExpressionEvaluationFile::Generate(cmLocalGenerator* lg) cmListFileBacktrace lfbt = this->OutputFileExpr->GetBacktrace(); cmGeneratorExpression contentGE(lfbt); - cmsys::auto_ptr<cmCompiledGeneratorExpression> inputExpression = + CM_AUTO_PTR<cmCompiledGeneratorExpression> inputExpression = contentGE.Parse(inputContent); std::map<std::string, std::string> outputFiles; diff --git a/Source/cmGeneratorExpressionEvaluationFile.h b/Source/cmGeneratorExpressionEvaluationFile.h index bfd6add..52ba2d8 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.h +++ b/Source/cmGeneratorExpressionEvaluationFile.h @@ -14,7 +14,7 @@ #include "cmGeneratorExpression.h" -#include <cmsys/auto_ptr.hxx> +#include <cm_auto_ptr.hxx> #include <sys/types.h> class cmLocalGenerator; @@ -24,9 +24,8 @@ class cmGeneratorExpressionEvaluationFile public: cmGeneratorExpressionEvaluationFile( const std::string& input, - cmsys::auto_ptr<cmCompiledGeneratorExpression> outputFileExpr, - cmsys::auto_ptr<cmCompiledGeneratorExpression> condition, - bool inputIsContent); + CM_AUTO_PTR<cmCompiledGeneratorExpression> outputFileExpr, + CM_AUTO_PTR<cmCompiledGeneratorExpression> condition, bool inputIsContent); void Generate(cmLocalGenerator* lg); @@ -42,8 +41,8 @@ private: private: const std::string Input; - const cmsys::auto_ptr<cmCompiledGeneratorExpression> OutputFileExpr; - const cmsys::auto_ptr<cmCompiledGeneratorExpression> Condition; + const CM_AUTO_PTR<cmCompiledGeneratorExpression> OutputFileExpr; + const CM_AUTO_PTR<cmCompiledGeneratorExpression> Condition; std::vector<std::string> Files; const bool InputIsContent; }; diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 830979f..ca7250b 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -24,7 +24,7 @@ std::string cmGeneratorExpressionNode::EvaluateDependentExpression( cmGeneratorExpressionDAGChecker* dagChecker) { cmGeneratorExpression ge(context->Backtrace); - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop); + CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(prop); cge->SetEvaluateForBuildsystem(context->EvaluateForBuildsystem); std::string result = cge->Evaluate(lg, context->Config, context->Quiet, headTarget, diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index c7dd3e4..c9cbd00 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -42,13 +42,13 @@ class cmGeneratorTarget::TargetPropertyEntry static cmLinkImplItem NoLinkImplItem; public: - TargetPropertyEntry(cmsys::auto_ptr<cmCompiledGeneratorExpression> cge, + TargetPropertyEntry(CM_AUTO_PTR<cmCompiledGeneratorExpression> cge, cmLinkImplItem const& item = NoLinkImplItem) : ge(cge) , LinkImplItem(item) { } - const cmsys::auto_ptr<cmCompiledGeneratorExpression> ge; + const CM_AUTO_PTR<cmCompiledGeneratorExpression> ge; cmLinkImplItem const& LinkImplItem; }; cmLinkImplItem cmGeneratorTarget::TargetPropertyEntry::NoLinkImplItem; @@ -253,7 +253,7 @@ void CreatePropertyGeneratorExpressions( for (std::vector<std::string>::const_iterator it = entries.begin(); it != entries.end(); ++it, ++btIt) { cmGeneratorExpression ge(*btIt); - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*it); + CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(*it); cge->SetEvaluateForBuildsystem(evaluateForBuildsystem); items.push_back(new cmGeneratorTarget::TargetPropertyEntry(cge)); } @@ -443,7 +443,7 @@ std::string cmGeneratorTarget::GetOutputName(const std::string& config, // Now evaluate genex and update the previously-prepared map entry. cmGeneratorExpression ge; - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(outName); + CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(outName); i->second = cge->Evaluate(this->LocalGenerator, config); } else if (i->second.empty()) { // An empty map entry indicates we have been called recursively @@ -461,7 +461,7 @@ void cmGeneratorTarget::AddSource(const std::string& src) this->Target->AddSource(src); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); cmGeneratorExpression ge(lfbt); - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(src); + CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(src); cge->SetEvaluateForBuildsystem(true); this->SourceEntries.push_back(new TargetPropertyEntry(cge)); this->SourceFilesMap.clear(); @@ -477,7 +477,7 @@ void cmGeneratorTarget::AddTracedSources(std::vector<std::string> const& srcs) this->LinkImplementationLanguageIsContextDependent = true; cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); cmGeneratorExpression ge(lfbt); - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(srcFiles); + CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(srcFiles); cge->SetEvaluateForBuildsystem(true); this->SourceEntries.push_back( new cmGeneratorTarget::TargetPropertyEntry(cge)); @@ -862,7 +862,7 @@ static void AddInterfaceEntries( if (it->Target) { std::string genex = "$<TARGET_PROPERTY:" + *it + "," + prop + ">"; cmGeneratorExpression ge(it->Backtrace); - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(genex); + CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(genex); cge->SetEvaluateForBuildsystem(true); entries.push_back( new cmGeneratorTarget::TargetPropertyEntry(cge, *it)); @@ -2119,8 +2119,7 @@ void cmTargetTraceDependencies::CheckCustomCommand(cmCustomCommand const& cc) // Check for target references in generator expressions. for (cmCustomCommandLine::const_iterator cli = cit->begin(); cli != cit->end(); ++cli) { - const cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = - ge.Parse(*cli); + const CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(*cli); cge->Evaluate(this->GeneratorTarget->GetLocalGenerator(), "", true); std::set<cmGeneratorTarget*> geTargets = cge->GetTargets(); targets.insert(geTargets.begin(), geTargets.end()); @@ -2405,7 +2404,7 @@ std::vector<std::string> cmGeneratorTarget::GetIncludeDirectories( libDir = frameworkCheck.match(1); cmGeneratorExpression ge; - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = + CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(libDir.c_str()); linkInterfaceIncludeDirectoriesEntries.push_back( new cmGeneratorTarget::TargetPropertyEntry(cge)); @@ -2629,7 +2628,7 @@ void cmGeneratorTarget::GetCompileDefinitions( } case cmPolicies::OLD: { cmGeneratorExpression ge; - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = + CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(configProp); linkInterfaceCompileDefinitionsEntries.push_back( new cmGeneratorTarget::TargetPropertyEntry(cge)); @@ -3981,7 +3980,7 @@ void cmGeneratorTarget::ExpandLinkItems( dagChecker.SetTransitivePropertiesOnly(); } std::vector<std::string> libs; - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value); + CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(value); cmSystemTools::ExpandListArgument(cge->Evaluate(this->LocalGenerator, config, false, headTarget, this, &dagChecker), @@ -4246,8 +4245,7 @@ bool cmGeneratorTarget::ComputeOutputDir(const std::string& config, if (const char* config_outdir = this->GetProperty(configProp)) { // Use the user-specified per-configuration output directory. cmGeneratorExpression ge; - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = - ge.Parse(config_outdir); + CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(config_outdir); out = cge->Evaluate(this->LocalGenerator, config); // Skip per-configuration subdirectory. @@ -4255,7 +4253,7 @@ bool cmGeneratorTarget::ComputeOutputDir(const std::string& config, } else if (const char* outdir = this->GetProperty(propertyName)) { // Use the user-specified output directory. cmGeneratorExpression ge; - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(outdir); + CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(outdir); out = cge->Evaluate(this->LocalGenerator, config); // Skip per-configuration subdirectory if the value contained a @@ -4990,7 +4988,7 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries( cmGeneratorExpressionDAGChecker dagChecker( this->GetName(), "LINK_LIBRARIES", CM_NULLPTR, CM_NULLPTR); cmGeneratorExpression ge(*btIt); - cmsys::auto_ptr<cmCompiledGeneratorExpression> const cge = ge.Parse(*le); + CM_AUTO_PTR<cmCompiledGeneratorExpression> const cge = ge.Parse(*le); std::string const evaluated = cge->Evaluate(this->LocalGenerator, config, false, head, &dagChecker); cmSystemTools::ExpandListArgument(evaluated, llibs); diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index a33bd8b..262909f 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -674,7 +674,7 @@ std::set<std::string> cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild( target->Target->GetMakefile()->GetDefinition( "CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD"); cmGeneratorExpression ge; - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = + CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(propertyValue); if (cmSystemTools::IsOn( cge->Evaluate(target->GetLocalGenerator(), *i))) { diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index e82cb16..e65ca09 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -24,7 +24,7 @@ #include "cmXCodeObject.h" #include "cmake.h" -#include <cmsys/auto_ptr.hxx> +#include <cm_auto_ptr.hxx> #if defined(CMAKE_BUILD_WITH_CMAKE) #include "cmXMLParser.h" @@ -175,7 +175,7 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::Factory::CreateGlobalGenerator( parser.ParseFile( "/Developer/Applications/Xcode.app/Contents/version.plist"); } - cmsys::auto_ptr<cmGlobalXCodeGenerator> gg( + CM_AUTO_PTR<cmGlobalXCodeGenerator> gg( new cmGlobalXCodeGenerator(cm, parser.Version)); if (gg->XcodeVersion == 20) { cmSystemTools::Message("Xcode 2.0 not really supported by cmake, " diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index ed35ecd..adb9936 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -64,9 +64,8 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName, cm.SetHomeOutputDirectory(""); cm.GetCurrentSnapshot().SetDefaultDefinitions(); cmGlobalGenerator ggi(&cm); - cmsys::auto_ptr<cmMakefile> mf( - new cmMakefile(&ggi, cm.GetCurrentSnapshot())); - cmsys::auto_ptr<cmLocalGenerator> lg(ggi.CreateLocalGenerator(mf.get())); + CM_AUTO_PTR<cmMakefile> mf(new cmMakefile(&ggi, cm.GetCurrentSnapshot())); + CM_AUTO_PTR<cmLocalGenerator> lg(ggi.CreateLocalGenerator(mf.get())); const char* inFileName = settingsFileName; diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index cb5ba76..dd04136 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -46,8 +46,7 @@ bool cmIfFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff, // if this is the endif for this if statement, then start executing if (!this->ScopeDepth) { // Remove the function blocker for this scope or bail. - cmsys::auto_ptr<cmFunctionBlocker> fb( - mf.RemoveFunctionBlocker(this, lff)); + CM_AUTO_PTR<cmFunctionBlocker> fb(mf.RemoveFunctionBlocker(this, lff)); if (!fb.get()) { return false; } diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx index a637b25..3928231 100644 --- a/Source/cmInstallDirectoryGenerator.cxx +++ b/Source/cmInstallDirectoryGenerator.cxx @@ -69,7 +69,7 @@ void cmInstallDirectoryGenerator::GenerateScriptForConfig( cmGeneratorExpression ge; for (std::vector<std::string>::const_iterator i = this->Directories.begin(); i != this->Directories.end(); ++i) { - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*i); + CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(*i); cmSystemTools::ExpandListArgument( cge->Evaluate(this->LocalGenerator, config), dirs); } diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx index 8885ef2..93a740c 100644 --- a/Source/cmInstallFilesGenerator.cxx +++ b/Source/cmInstallFilesGenerator.cxx @@ -90,7 +90,7 @@ void cmInstallFilesGenerator::GenerateScriptForConfig( cmGeneratorExpression ge; for (std::vector<std::string>::const_iterator i = this->Files.begin(); i != this->Files.end(); ++i) { - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*i); + CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(*i); cmSystemTools::ExpandListArgument( cge->Evaluate(this->LocalGenerator, config), files); } diff --git a/Source/cmInstalledFile.h b/Source/cmInstalledFile.h index d000891..00ff611 100644 --- a/Source/cmInstalledFile.h +++ b/Source/cmInstalledFile.h @@ -22,7 +22,7 @@ class cmInstalledFile { public: - typedef cmsys::auto_ptr<cmCompiledGeneratorExpression> + typedef CM_AUTO_PTR<cmCompiledGeneratorExpression> CompiledGeneratorExpressionPtrType; typedef std::vector<cmCompiledGeneratorExpression*> ExpressionVectorType; diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index c6cfa88..75970772 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -30,8 +30,8 @@ #include "cmDependsJava.h" #endif +#include <cm_auto_ptr.hxx> #include <cmsys/Terminal.h> -#include <cmsys/auto_ptr.hxx> #include <algorithm> #include <queue> @@ -121,7 +121,7 @@ void cmLocalUnixMakefileGenerator3::Generate() if ((*t)->GetType() == cmState::INTERFACE_LIBRARY) { continue; } - cmsys::auto_ptr<cmMakefileTargetGenerator> tg( + CM_AUTO_PTR<cmMakefileTargetGenerator> tg( cmMakefileTargetGenerator::New(*t)); if (tg.get()) { tg->WriteRuleFiles(); diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 2f6bf07..c38e99c 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -1850,7 +1850,7 @@ void cmLocalVisualStudio7Generator::OutputTargetRules( if (!addedPrelink) { event.Write(target->GetPreLinkCommands()); } - cmsys::auto_ptr<cmCustomCommand> pcc( + CM_AUTO_PTR<cmCustomCommand> pcc( this->MaybeCreateImplibDir(target, configName, this->FortranProject)); if (pcc.get()) { event.Write(*pcc); diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index 85ab615..bdb1c2b 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -74,12 +74,12 @@ void cmLocalVisualStudioGenerator::ComputeObjectFilenames( } } -cmsys::auto_ptr<cmCustomCommand> +CM_AUTO_PTR<cmCustomCommand> cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmGeneratorTarget* target, const std::string& config, bool isFortran) { - cmsys::auto_ptr<cmCustomCommand> pcc; + CM_AUTO_PTR<cmCustomCommand> pcc; // If an executable exports symbols then VS wants to create an // import library but forgets to create the output directory. diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h index c24d813..87acda2 100644 --- a/Source/cmLocalVisualStudioGenerator.h +++ b/Source/cmLocalVisualStudioGenerator.h @@ -16,7 +16,7 @@ #include "cmGlobalVisualStudioGenerator.h" -#include <cmsys/auto_ptr.hxx> +#include <cm_auto_ptr.hxx> class cmSourceFile; class cmSourceGroup; @@ -59,8 +59,9 @@ protected: virtual bool CustomCommandUseLocal() const { return false; } /** Construct a custom command to make exe import lib dir. */ - cmsys::auto_ptr<cmCustomCommand> MaybeCreateImplibDir( - cmGeneratorTarget* target, const std::string& config, bool isFortran); + CM_AUTO_PTR<cmCustomCommand> MaybeCreateImplibDir(cmGeneratorTarget* target, + const std::string& config, + bool isFortran); }; #endif diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index eae4258..0d550dd 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -35,10 +35,10 @@ #include "cmake.h" #include <stdlib.h> // required for atoi +#include <cm_auto_ptr.hxx> #include <cmsys/FStream.hxx> #include <cmsys/RegularExpression.hxx> #include <cmsys/SystemTools.hxx> -#include <cmsys/auto_ptr.hxx> #include <assert.h> #include <ctype.h> // for isspace @@ -262,7 +262,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, // Lookup the command prototype. if (cmCommand* proto = this->GetState()->GetCommand(name)) { // Clone the prototype. - cmsys::auto_ptr<cmCommand> pcmd(proto->Clone()); + CM_AUTO_PTR<cmCommand> pcmd(proto->Clone()); pcmd->SetMakefile(this); // Decide whether to invoke the command. @@ -589,9 +589,8 @@ void cmMakefile::EnforceDirectoryLevelRules() const void cmMakefile::AddEvaluationFile( const std::string& inputFile, - cmsys::auto_ptr<cmCompiledGeneratorExpression> outputName, - cmsys::auto_ptr<cmCompiledGeneratorExpression> condition, - bool inputIsContent) + CM_AUTO_PTR<cmCompiledGeneratorExpression> outputName, + CM_AUTO_PTR<cmCompiledGeneratorExpression> condition, bool inputIsContent) { this->EvaluationFiles.push_back(new cmGeneratorExpressionEvaluationFile( inputFile, outputName, condition, inputIsContent)); @@ -2890,7 +2889,7 @@ void cmMakefile::PopFunctionBlockerBarrier(bool reportError) FunctionBlockersType::size_type barrier = this->FunctionBlockerBarriers.back(); while (this->FunctionBlockers.size() > barrier) { - cmsys::auto_ptr<cmFunctionBlocker> fb(this->FunctionBlockers.back()); + CM_AUTO_PTR<cmFunctionBlocker> fb(this->FunctionBlockers.back()); this->FunctionBlockers.pop_back(); if (reportError) { // Report the context in which the unclosed block was opened. @@ -3027,7 +3026,7 @@ void cmMakefile::AddFunctionBlocker(cmFunctionBlocker* fb) this->FunctionBlockers.push_back(fb); } -cmsys::auto_ptr<cmFunctionBlocker> cmMakefile::RemoveFunctionBlocker( +CM_AUTO_PTR<cmFunctionBlocker> cmMakefile::RemoveFunctionBlocker( cmFunctionBlocker* fb, const cmListFileFunction& lff) { // Find the function blocker stack barrier for the current scope. @@ -3060,11 +3059,11 @@ cmsys::auto_ptr<cmFunctionBlocker> cmMakefile::RemoveFunctionBlocker( } cmFunctionBlocker* b = *pos; this->FunctionBlockers.erase(pos); - return cmsys::auto_ptr<cmFunctionBlocker>(b); + return CM_AUTO_PTR<cmFunctionBlocker>(b); } } - return cmsys::auto_ptr<cmFunctionBlocker>(); + return CM_AUTO_PTR<cmFunctionBlocker>(); } const char* cmMakefile::GetHomeDirectory() const @@ -3692,7 +3691,7 @@ cmTarget* cmMakefile::AddImportedTarget(const std::string& name, cmState::TargetType type, bool global) { // Create the target. - cmsys::auto_ptr<cmTarget> target(new cmTarget); + CM_AUTO_PTR<cmTarget> target(new cmTarget); target->SetType(type, name); target->MarkAsImported(global); target->SetMakefile(this); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 642b691..d07b4e1 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -28,8 +28,8 @@ #include "cmSourceGroup.h" #endif +#include <cm_auto_ptr.hxx> #include <cmsys/RegularExpression.hxx> -#include <cmsys/auto_ptr.hxx> #if defined(CMAKE_BUILD_WITH_CMAKE) #ifdef CMake_HAVE_CXX_UNORDERED_MAP #include <unordered_map> @@ -97,7 +97,7 @@ public: * Remove the function blocker whose scope ends with the given command. * This returns ownership of the function blocker object. */ - cmsys::auto_ptr<cmFunctionBlocker> RemoveFunctionBlocker( + CM_AUTO_PTR<cmFunctionBlocker> RemoveFunctionBlocker( cmFunctionBlocker* fb, const cmListFileFunction& lff); /** @@ -771,11 +771,10 @@ public: void EnforceDirectoryLevelRules() const; - void AddEvaluationFile( - const std::string& inputFile, - cmsys::auto_ptr<cmCompiledGeneratorExpression> outputName, - cmsys::auto_ptr<cmCompiledGeneratorExpression> condition, - bool inputIsContent); + void AddEvaluationFile(const std::string& inputFile, + CM_AUTO_PTR<cmCompiledGeneratorExpression> outputName, + CM_AUTO_PTR<cmCompiledGeneratorExpression> condition, + bool inputIsContent); std::vector<cmGeneratorExpressionEvaluationFile*> GetEvaluationFiles() const; std::vector<cmExportBuildFileGenerator*> GetExportBuildFileGenerators() diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index e922fbd..2f9c4da 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -134,7 +134,7 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules() if (const char* additional_clean_files = this->Makefile->GetProperty("ADDITIONAL_MAKE_CLEAN_FILES")) { cmGeneratorExpression ge; - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = + CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(additional_clean_files); cmSystemTools::ExpandListArgument( diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index ff49e31..0c8ff60 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -203,7 +203,10 @@ class cmPolicy; SELECT(POLICY, CMP0065, \ "Do not add flags to export symbols from executables without " \ "the ENABLE_EXPORTS target property.", \ - 3, 4, 0, cmPolicies::WARN) + 3, 4, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0066, \ + "Honor per-config flags in try_compile() source-file signature.", 3, \ + 7, 0, cmPolicies::WARN) #define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) #define CM_FOR_EACH_POLICY_ID(POLICY) \ diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 7ada431..4b40c08 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -155,7 +155,7 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory, snapshot.GetDirectory().SetCurrentBinary(targetDirectory); snapshot.GetDirectory().SetCurrentSource(targetDirectory); - cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, snapshot)); + CM_AUTO_PTR<cmMakefile> mf(new cmMakefile(&gg, snapshot)); gg.SetCurrentMakefile(mf.get()); this->ReadAutogenInfoFile(mf.get(), targetDirectory, config); diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index a348aef..dce4687 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -89,7 +89,7 @@ bool cmStringCommand::HandleHashCommand(std::vector<std::string> const& args) return false; } - cmsys::auto_ptr<cmCryptoHash> hash(cmCryptoHash::New(args[0].c_str())); + CM_AUTO_PTR<cmCryptoHash> hash(cmCryptoHash::New(args[0].c_str())); if (hash.get()) { std::string out = hash->HashString(args[2]); this->Makefile->AddDefinition(args[1], out.c_str()); diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 5829d4f..209a729 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -19,7 +19,7 @@ #include "cmPolicies.h" #include "cmPropertyMap.h" -#include <cmsys/auto_ptr.hxx> +#include <cm_auto_ptr.hxx> #if defined(CMAKE_BUILD_WITH_CMAKE) #ifdef CMake_HAVE_CXX_UNORDERED_MAP #include <unordered_map> diff --git a/Source/cmTypeMacro.h b/Source/cmTypeMacro.h index 5c534c3..147eba8 100644 --- a/Source/cmTypeMacro.h +++ b/Source/cmTypeMacro.h @@ -15,7 +15,7 @@ // All subclasses of cmCommand or cmCTestGenericHandler should // invoke this macro. #define cmTypeMacro(thisClass, superclass) \ - virtual const char* GetNameOfClass() { return #thisClass; } \ + const char* GetNameOfClass() CM_OVERRIDE { return #thisClass; } \ typedef superclass Superclass; \ static bool IsTypeOf(const char* type) \ { \ @@ -24,7 +24,10 @@ } \ return Superclass::IsTypeOf(type); \ } \ - virtual bool IsA(const char* type) { return thisClass::IsTypeOf(type); } \ + bool IsA(const char* type) CM_OVERRIDE \ + { \ + return thisClass::IsTypeOf(type); \ + } \ static thisClass* SafeDownCast(cmObject* c) \ { \ if (c && c->IsA(#thisClass)) { \ diff --git a/Source/cmVariableWatch.cxx b/Source/cmVariableWatch.cxx index 11eaa93..56e2770 100644 --- a/Source/cmVariableWatch.cxx +++ b/Source/cmVariableWatch.cxx @@ -13,7 +13,7 @@ #include "cmAlgorithms.h" -#include <cmsys/auto_ptr.hxx> +#include <cm_auto_ptr.hxx> static const char* const cmVariableWatchAccessStrings[] = { "READ_ACCESS", "UNKNOWN_READ_ACCESS", "UNKNOWN_DEFINED_ACCESS", @@ -48,7 +48,7 @@ bool cmVariableWatch::AddWatch(const std::string& variable, WatchMethod method, void* client_data /*=0*/, DeleteData delete_data /*=0*/) { - cmsys::auto_ptr<cmVariableWatch::Pair> p(new cmVariableWatch::Pair); + CM_AUTO_PTR<cmVariableWatch::Pair> p(new cmVariableWatch::Pair); p->Method = method; p->ClientData = client_data; p->DeleteDataCall = delete_data; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 635fad2..13e7c89 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -42,7 +42,7 @@ #include "cmVisualStudioGeneratorOptions.h" #include "windows.h" -#include <cmsys/auto_ptr.hxx> +#include <cm_auto_ptr.hxx> cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetClFlagTable() const { @@ -1229,8 +1229,7 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf) if (!deployContent.empty()) { cmGeneratorExpression ge; - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = - ge.Parse(deployContent); + CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(deployContent); // Deployment location cannot be set on a configuration basis if (!deployLocation.empty()) { this->WriteString("<Link>", 3); @@ -1684,7 +1683,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( // copied from cmLocalVisualStudio7Generator.cxx 805 // TODO: Integrate code below with cmLocalVisualStudio7Generator. - cmsys::auto_ptr<Options> pOptions(new Options( + CM_AUTO_PTR<Options> pOptions(new Options( this->LocalGenerator, Options::Compiler, this->GetClFlagTable())); Options& clOptions = *pOptions; @@ -1848,7 +1847,7 @@ bool cmVisualStudio10TargetGenerator::ComputeRcOptions() bool cmVisualStudio10TargetGenerator::ComputeRcOptions( std::string const& configName) { - cmsys::auto_ptr<Options> pOptions(new Options( + CM_AUTO_PTR<Options> pOptions(new Options( this->LocalGenerator, Options::ResourceCompiler, this->GetRcFlagTable())); Options& rcOptions = *pOptions; @@ -1905,7 +1904,7 @@ bool cmVisualStudio10TargetGenerator::ComputeMasmOptions() bool cmVisualStudio10TargetGenerator::ComputeMasmOptions( std::string const& configName) { - cmsys::auto_ptr<Options> pOptions(new Options( + CM_AUTO_PTR<Options> pOptions(new Options( this->LocalGenerator, Options::MasmCompiler, this->GetMasmFlagTable())); Options& masmOptions = *pOptions; @@ -2058,7 +2057,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions( if (const char* nativeLibDirectoriesExpression = this->GeneratorTarget->GetProperty("ANDROID_NATIVE_LIB_DIRECTORIES")) { cmGeneratorExpression ge; - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = + CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(nativeLibDirectoriesExpression); std::string nativeLibDirs = cge->Evaluate(this->LocalGenerator, configName); @@ -2071,7 +2070,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions( this->GeneratorTarget->GetProperty( "ANDROID_NATIVE_LIB_DEPENDENCIES")) { cmGeneratorExpression ge; - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = + CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(nativeLibDependenciesExpression); std::string nativeLibDeps = cge->Evaluate(this->LocalGenerator, configName); @@ -2090,7 +2089,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions( if (const char* jarDirectoriesExpression = this->GeneratorTarget->GetProperty("ANDROID_JAR_DIRECTORIES")) { cmGeneratorExpression ge; - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = + CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(jarDirectoriesExpression); std::string jarDirectories = cge->Evaluate(this->LocalGenerator, configName); @@ -2150,7 +2149,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions() bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( std::string const& config) { - cmsys::auto_ptr<Options> pOptions(new Options( + CM_AUTO_PTR<Options> pOptions(new Options( this->LocalGenerator, Options::Linker, this->GetLinkFlagTable(), 0, this)); Options& linkOptions = *pOptions; diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx index bec2861..93a6271 100644 --- a/Source/cmWhileCommand.cxx +++ b/Source/cmWhileCommand.cxx @@ -37,8 +37,7 @@ bool cmWhileFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff, // if this is the endwhile for this while loop then execute if (!this->Depth) { // Remove the function blocker for this scope or bail. - cmsys::auto_ptr<cmFunctionBlocker> fb( - mf.RemoveFunctionBlocker(this, lff)); + CM_AUTO_PTR<cmFunctionBlocker> fb(mf.RemoveFunctionBlocker(this, lff)); if (!fb.get()) { return false; } diff --git a/Source/kwsys/auto_ptr.hxx.in b/Source/cm_auto_ptr.hxx index ad9654c..2cd35c3 100644 --- a/Source/kwsys/auto_ptr.hxx.in +++ b/Source/cm_auto_ptr.hxx @@ -1,6 +1,6 @@ /*============================================================================ - KWSys - Kitware System Library - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + CMake - Cross Platform Makefile Generator + Copyright 2000-2016 Kitware, Inc. Distributed under the OSI-approved BSD License (the "License"); see accompanying file Copyright.txt for details. @@ -9,26 +9,29 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#ifndef @KWSYS_NAMESPACE@_auto_ptr_hxx -#define @KWSYS_NAMESPACE@_auto_ptr_hxx +#ifndef CM_AUTO_PTR_HXX +#define CM_AUTO_PTR_HXX -#include <@KWSYS_NAMESPACE@/Configure.hxx> +#include <cmsys/Configure.hxx> -// The HP compiler and VS6 cannot handle the conversions necessary to use +// FIXME: Use std::auto_ptr on compilers that do not warn about it. +#define CM_AUTO_PTR cm::auto_ptr + +// The HP compiler cannot handle the conversions necessary to use // auto_ptr_ref to pass an auto_ptr returned from one function // directly to another function as in use_auto_ptr(get_auto_ptr()). // We instead use const_cast to achieve the syntax on those platforms. // We do not use const_cast on other platforms to maintain the C++ // standard design and guarantee that if an auto_ptr is bound // to a reference-to-const then ownership will be maintained. -#if defined(__HP_aCC) || (defined(_MSC_VER) && _MSC_VER <= 1200) -# define @KWSYS_NAMESPACE@_AUTO_PTR_REF 0 -# define @KWSYS_NAMESPACE@_AUTO_PTR_CONST const -# define @KWSYS_NAMESPACE@_AUTO_PTR_CAST(a) cast(a) +#if defined(__HP_aCC) +#define cm_AUTO_PTR_REF 0 +#define cm_AUTO_PTR_CONST const +#define cm_AUTO_PTR_CAST(a) cast(a) #else -# define @KWSYS_NAMESPACE@_AUTO_PTR_REF 1 -# define @KWSYS_NAMESPACE@_AUTO_PTR_CONST -# define @KWSYS_NAMESPACE@_AUTO_PTR_CAST(a) a +#define cm_AUTO_PTR_REF 1 +#define cm_AUTO_PTR_CONST +#define cm_AUTO_PTR_CAST(a) a #endif // In C++11, clang will warn about using dynamic exception specifications @@ -36,24 +39,24 @@ // mimic std::auto_ptr, we want to keep the 'throw()' decorations below. // So we suppress the warning. #if defined(__clang__) && defined(__has_warning) -# if __has_warning("-Wdeprecated") -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wdeprecated" -# endif +#if __has_warning("-Wdeprecated") +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated" +#endif #endif -namespace @KWSYS_NAMESPACE@ -{ +namespace cm { -template <class X> class auto_ptr; +template <class X> +class auto_ptr; -#if @KWSYS_NAMESPACE@_AUTO_PTR_REF -namespace detail -{ +#if cm_AUTO_PTR_REF +namespace detail { // The auto_ptr_ref template is supposed to be a private member of // auto_ptr but Borland 5.8 cannot handle it. Instead put it in // a private namespace. -template <class Y> struct auto_ptr_ref +template <class Y> +struct auto_ptr_ref { Y* p_; @@ -62,7 +65,10 @@ template <class Y> struct auto_ptr_ref // this should be done with the explicit keyword but Borland 5.x // generates code in the conversion operator to call itself // infinately. - auto_ptr_ref(Y* p, int): p_(p) {} + auto_ptr_ref(Y* p, int) + : p_(p) + { + } }; } #endif @@ -71,10 +77,12 @@ template <class Y> struct auto_ptr_ref template <class X> class auto_ptr { -#if !@KWSYS_NAMESPACE@_AUTO_PTR_REF +#if !cm_AUTO_PTR_REF template <typename Y> static inline auto_ptr<Y>& cast(auto_ptr<Y> const& a) - { return const_cast<auto_ptr<Y>&>(a); } + { + return const_cast<auto_ptr<Y>&>(a); + } #endif /** The pointer to the object held. */ @@ -87,19 +95,19 @@ public: /** Construct from an auto_ptr holding a compatible object. This transfers ownership to the newly constructed auto_ptr. */ template <class Y> - auto_ptr(auto_ptr<Y> @KWSYS_NAMESPACE@_AUTO_PTR_CONST& a) throw(): - x_(@KWSYS_NAMESPACE@_AUTO_PTR_CAST(a).release()) - { - } + auto_ptr(auto_ptr<Y> cm_AUTO_PTR_CONST& a) throw() + : x_(cm_AUTO_PTR_CAST(a).release()) + { + } /** Assign from an auto_ptr holding a compatible object. This transfers ownership to the left-hand-side of the assignment. */ template <class Y> - auto_ptr& operator=(auto_ptr<Y> @KWSYS_NAMESPACE@_AUTO_PTR_CONST& a) throw() - { - this->reset(@KWSYS_NAMESPACE@_AUTO_PTR_CAST(a).release()); + auto_ptr& operator=(auto_ptr<Y> cm_AUTO_PTR_CONST& a) throw() + { + this->reset(cm_AUTO_PTR_CAST(a).release()); return *this; - } + } /** * Explicitly construct from a raw pointer. This is typically @@ -107,113 +115,107 @@ public: * * auto_ptr<X> ptr(new X()); */ - explicit auto_ptr(X* p=0) throw(): x_(p) - { - } + explicit auto_ptr(X* p = 0) throw() + : x_(p) + { + } /** Construct from another auto_ptr holding an object of the same type. This transfers ownership to the newly constructed auto_ptr. */ - auto_ptr(auto_ptr @KWSYS_NAMESPACE@_AUTO_PTR_CONST& a) throw(): - x_(@KWSYS_NAMESPACE@_AUTO_PTR_CAST(a).release()) - { - } + auto_ptr(auto_ptr cm_AUTO_PTR_CONST& a) throw() + : x_(cm_AUTO_PTR_CAST(a).release()) + { + } /** Assign from another auto_ptr holding an object of the same type. This transfers ownership to the newly constructed auto_ptr. */ - auto_ptr& operator=(auto_ptr @KWSYS_NAMESPACE@_AUTO_PTR_CONST& a) throw() - { - this->reset(@KWSYS_NAMESPACE@_AUTO_PTR_CAST(a).release()); + auto_ptr& operator=(auto_ptr cm_AUTO_PTR_CONST& a) throw() + { + this->reset(cm_AUTO_PTR_CAST(a).release()); return *this; - } + } /** Destruct and delete the object held. */ ~auto_ptr() throw() - { + { // Assume object destructor is nothrow. delete this->x_; - } + } /** Dereference and return a reference to the object held. */ - X& operator*() const throw() - { - return *this->x_; - } + X& operator*() const throw() { return *this->x_; } /** Return a pointer to the object held. */ - X* operator->() const throw() - { - return this->x_; - } + X* operator->() const throw() { return this->x_; } /** Return a pointer to the object held. */ - X* get() const throw() - { - return this->x_; - } + X* get() const throw() { return this->x_; } /** Return a pointer to the object held and reset to hold no object. This transfers ownership to the caller. */ X* release() throw() - { + { X* x = this->x_; this->x_ = 0; return x; - } + } /** Assume ownership of the given object. The object previously held is deleted. */ - void reset(X* p=0) throw() - { - if(this->x_ != p) - { + void reset(X* p = 0) throw() + { + if (this->x_ != p) { // Assume object destructor is nothrow. delete this->x_; this->x_ = p; - } } + } /** Convert to an auto_ptr holding an object of a compatible type. This transfers ownership to the returned auto_ptr. */ - template <class Y> operator auto_ptr<Y>() throw() - { + template <class Y> + operator auto_ptr<Y>() throw() + { return auto_ptr<Y>(this->release()); - } + } -#if @KWSYS_NAMESPACE@_AUTO_PTR_REF +#if cm_AUTO_PTR_REF /** Construct from an auto_ptr_ref. This is used when the constructor argument is a call to a function returning an auto_ptr. */ - auto_ptr(detail::auto_ptr_ref<X> r) throw(): x_(r.p_) - { - } + auto_ptr(detail::auto_ptr_ref<X> r) throw() + : x_(r.p_) + { + } /** Assign from an auto_ptr_ref. This is used when a function returning an auto_ptr is passed on the right-hand-side of an assignment. */ auto_ptr& operator=(detail::auto_ptr_ref<X> r) throw() - { + { this->reset(r.p_); return *this; - } + } /** Convert to an auto_ptr_ref. This is used when a function returning an auto_ptr is the argument to the constructor of another auto_ptr. */ - template <class Y> operator detail::auto_ptr_ref<Y>() throw() - { + template <class Y> + operator detail::auto_ptr_ref<Y>() throw() + { return detail::auto_ptr_ref<Y>(this->release(), 1); - } + } #endif }; -} // namespace @KWSYS_NAMESPACE@ +} // namespace cm // Undo warning suppression. #if defined(__clang__) && defined(__has_warning) -# if __has_warning("-Wdeprecated") -# pragma clang diagnostic pop -# endif +#if __has_warning("-Wdeprecated") +#pragma clang diagnostic pop +#endif #endif #endif diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 79e7c2b..c597605 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -397,7 +397,7 @@ void cmake::ReadListFile(const std::vector<std::string>& args, snapshot.GetDirectory().SetCurrentSource( cmSystemTools::GetCurrentWorkingDirectory()); snapshot.SetDefaultDefinitions(); - cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(gg, snapshot)); + CM_AUTO_PTR<cmMakefile> mf(new cmMakefile(gg, snapshot)); if (this->GetWorkingMode() != NORMAL_MODE) { std::string file(cmSystemTools::CollapseFullPath(path)); cmSystemTools::ConvertToUnixSlashes(file); @@ -1743,7 +1743,7 @@ int cmake::CheckBuildSystem() cm.SetHomeOutputDirectory(""); cm.GetCurrentSnapshot().SetDefaultDefinitions(); cmGlobalGenerator gg(&cm); - cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot())); + CM_AUTO_PTR<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot())); if (!mf->ReadListFile(this->CheckBuildSystemArgument.c_str()) || cmSystemTools::GetErrorOccuredFlag()) { if (verbose) { @@ -1764,14 +1764,12 @@ int cmake::CheckBuildSystem() } // Create the generator and use it to clear the dependencies. - cmsys::auto_ptr<cmGlobalGenerator> ggd( - this->CreateGlobalGenerator(genName)); + CM_AUTO_PTR<cmGlobalGenerator> ggd(this->CreateGlobalGenerator(genName)); if (ggd.get()) { cm.GetCurrentSnapshot().SetDefaultDefinitions(); - cmsys::auto_ptr<cmMakefile> mfd( + CM_AUTO_PTR<cmMakefile> mfd( new cmMakefile(ggd.get(), cm.GetCurrentSnapshot())); - cmsys::auto_ptr<cmLocalGenerator> lgd( - ggd->CreateLocalGenerator(mfd.get())); + CM_AUTO_PTR<cmLocalGenerator> lgd(ggd->CreateLocalGenerator(mfd.get())); lgd->ClearDependencies(mfd.get(), verbose); } } @@ -1911,7 +1909,7 @@ void cmake::MarkCliAsUsed(const std::string& variable) void cmake::GenerateGraphViz(const char* fileName) const { #ifdef CMAKE_BUILD_WITH_CMAKE - cmsys::auto_ptr<cmGraphVizWriter> gvWriter( + CM_AUTO_PTR<cmGraphVizWriter> gvWriter( new cmGraphVizWriter(this->GetGlobalGenerator()->GetLocalGenerators())); std::string settingsFile = this->GetHomeOutputDirectory(); @@ -2392,7 +2390,7 @@ int cmake::Build(const std::string& dir, const std::string& target, std::cerr << "Error: could not find CMAKE_GENERATOR in Cache\n"; return 1; } - cmsys::auto_ptr<cmGlobalGenerator> gen( + CM_AUTO_PTR<cmGlobalGenerator> gen( this->CreateGlobalGenerator(cachedGenerator)); if (!gen.get()) { std::cerr << "Error: could create CMAKE_GENERATOR \"" << cachedGenerator diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 2427286..010a3b2 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -765,9 +765,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) cmState::Snapshot snapshot = cm.GetCurrentSnapshot(); snapshot.GetDirectory().SetCurrentBinary(startOutDir); snapshot.GetDirectory().SetCurrentSource(startDir); - cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(ggd, snapshot)); - cmsys::auto_ptr<cmLocalGenerator> lgd( - ggd->CreateLocalGenerator(mf.get())); + CM_AUTO_PTR<cmMakefile> mf(new cmMakefile(ggd, snapshot)); + CM_AUTO_PTR<cmLocalGenerator> lgd(ggd->CreateLocalGenerator(mf.get())); // Actually scan dependencies. return lgd->UpdateDependencies(depInfo.c_str(), verbose, color) ? 0 diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index 8b15394..39b03b3 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -663,7 +663,6 @@ SET(KWSYS_CLASSES) SET(KWSYS_H_FILES Configure SharedForward) SET(KWSYS_HXX_FILES Configure String hashtable hash_fun hash_map hash_set - auto_ptr ) # Add selected C++ classes. @@ -903,7 +902,6 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) # C++ tests IF(NOT WATCOM) SET(KWSYS_CXX_TESTS - testAutoPtr testHashSTL ) ENDIF() diff --git a/Source/kwsys/testAutoPtr.cxx b/Source/kwsys/testAutoPtr.cxx deleted file mode 100644 index ed75ff4..0000000 --- a/Source/kwsys/testAutoPtr.cxx +++ /dev/null @@ -1,166 +0,0 @@ -/*============================================================================ - KWSys - Kitware System Library - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#ifdef __BORLANDC__ -# pragma warn -8027 /* 'for' not inlined. */ -# pragma warn -8026 /* exception not inlined. */ -#endif -#include "kwsysPrivate.h" -#include KWSYS_HEADER(auto_ptr.hxx) -// Work-around CMake dependency scanning limitation. This must -// duplicate the above list of headers. -#if 0 -# include "auto_ptr.hxx.in" -#endif - -#include <stdio.h> - -#define ASSERT(x,y) if (!(x)) { printf("FAIL: " y "\n"); status = 1; } - -int instances = 0; // don't declare as static - -struct A -{ - A() { ++instances; } - ~A() { --instances; } - A* self() {return this; } -}; -struct B: public A {}; - -static int function_call(kwsys::auto_ptr<A> a) -{ - return a.get()? 1:0; -} - -static A* get_A(A& a) { return &a; } - -static kwsys::auto_ptr<A> generate_auto_ptr_A() -{ - return kwsys::auto_ptr<A>(new A); -} - -static kwsys::auto_ptr<B> generate_auto_ptr_B() -{ - return kwsys::auto_ptr<B>(new B); -} - -int testAutoPtr(int, char*[]) -{ - int status = 0; - - // Keep everything in a subscope so we can detect leaks. - { - kwsys::auto_ptr<A> pa0; - kwsys::auto_ptr<A> pa1(new A()); - kwsys::auto_ptr<B> pb1(new B()); - kwsys::auto_ptr<B> pb2(new B()); - kwsys::auto_ptr<A> pa2(new B()); - - A* ptr = get_A(*pa1); - ASSERT(ptr == pa1.get(), - "auto_ptr does not return correct object when dereferenced"); - ptr = pa1->self(); - ASSERT(ptr == pa1.get(), - "auto_ptr does not return correct pointer from operator->"); - - A* before = pa0.get(); - pa0.reset(new A()); - ASSERT(pa0.get() && pa0.get() != before, - "auto_ptr empty after reset(new A())"); - - before = pa0.get(); - pa0.reset(new B()); - ASSERT(pa0.get() && pa0.get() != before, - "auto_ptr empty after reset(new B())"); - - delete pa0.release(); - ASSERT(!pa0.get(), "auto_ptr holds an object after release()"); - - kwsys::auto_ptr<A> pa3(pb1); - ASSERT(!pb1.get(), - "auto_ptr full after being used to construct another"); - ASSERT(pa3.get(), - "auto_ptr empty after construction from another"); - - { - kwsys::auto_ptr<A> pa; - pa = pa3; - ASSERT(!pa3.get(), - "auto_ptr full after assignment to another"); - ASSERT(pa.get(), - "auto_ptr empty after assignment from another"); - } - - { - kwsys::auto_ptr<A> pa; - pa = pb2; - ASSERT(!pb2.get(), - "auto_ptr full after assignment to compatible"); - ASSERT(pa.get(), - "auto_ptr empty after assignment from compatible"); - } - - { - int receive = function_call(pa2); - ASSERT(receive, - "auto_ptr did not receive ownership in called function"); - ASSERT(!pa2.get(), - "auto_ptr did not release ownership to called function"); - } - - { - int received = function_call(generate_auto_ptr_A()); - ASSERT(received, - "auto_ptr in called function did not take ownership " - "from factory function"); - } - -#if 0 - // Is this allowed by the standard? - { - int received = function_call(generate_auto_ptr_B()); - ASSERT(received, - "auto_ptr in called function did not take ownership " - "from factory function with conversion"); - } -#endif - - { - kwsys::auto_ptr<A> pa(generate_auto_ptr_A()); - ASSERT(pa.get(), - "auto_ptr empty after construction from factory function"); - } - - { - kwsys::auto_ptr<A> pa; - pa = generate_auto_ptr_A(); - ASSERT(pa.get(), - "auto_ptr empty after assignment from factory function"); - } - - { - kwsys::auto_ptr<A> pa(generate_auto_ptr_B()); - ASSERT(pa.get(), - "auto_ptr empty after construction from compatible factory function"); - } - - { - kwsys::auto_ptr<A> pa; - pa = generate_auto_ptr_B(); - ASSERT(pa.get(), - "auto_ptr empty after assignment from compatible factory function"); - } - } - - ASSERT(instances == 0, "auto_ptr leaked an object"); - - return status; -} diff --git a/Tests/Module/GenerateExportHeader/lib_shared_and_static/CMakeLists.txt b/Tests/Module/GenerateExportHeader/lib_shared_and_static/CMakeLists.txt index c1be125..a057746 100644 --- a/Tests/Module/GenerateExportHeader/lib_shared_and_static/CMakeLists.txt +++ b/Tests/Module/GenerateExportHeader/lib_shared_and_static/CMakeLists.txt @@ -25,9 +25,12 @@ add_library(shared_variant SHARED ${lib_SRCS}) set_target_properties(shared_variant PROPERTIES DEFINE_SYMBOL SHARED_VARIANT_MAKEDLL) add_library(static_variant ${lib_SRCS}) +set(MY_CUSTOM_CONTENT "#define MY_CUSTOM_CONTENT_ADDED") + generate_export_header(shared_variant BASE_NAME libshared_and_static PREFIX_NAME MYPREFIX_ + CUSTOM_CONTENT_FROM_VARIABLE MY_CUSTOM_CONTENT ) set_target_properties(static_variant PROPERTIES COMPILE_FLAGS -DLIBSHARED_AND_STATIC_STATIC_DEFINE) diff --git a/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp b/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp index 2764905..846c207 100644 --- a/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp +++ b/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp @@ -1,6 +1,10 @@ #include "libshared_and_static.h" +#ifndef MY_CUSTOM_CONTENT_ADDED +#error "MY_CUSTOM_CONTENT_ADDED not defined!" +#endif + int LibsharedAndStatic::libshared_and_static() const { return 0; diff --git a/Tests/RunCMake/try_compile/CMP0066-stderr.txt b/Tests/RunCMake/try_compile/CMP0066-stderr.txt new file mode 100644 index 0000000..b14e290 --- /dev/null +++ b/Tests/RunCMake/try_compile/CMP0066-stderr.txt @@ -0,0 +1,15 @@ +before try_compile with CMP0066 WARN-default +after try_compile with CMP0066 WARN-default +* +CMake Warning \(dev\) at CMP0066.cmake:[0-9]+ \(try_compile\): + Policy CMP0066 is not set: Honor per-config flags in try_compile\(\) + source-file signature. Run "cmake --help-policy CMP0066" for policy + details. Use the cmake_policy command to set the policy and suppress this + warning. + + For compatibility with older versions of CMake, try_compile is not honoring + caller config-specific compiler flags \(e.g. CMAKE_C_FLAGS_DEBUG\) in the + test project. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/try_compile/CMP0066-stdout.txt b/Tests/RunCMake/try_compile/CMP0066-stdout.txt new file mode 100644 index 0000000..1eb2f83 --- /dev/null +++ b/Tests/RunCMake/try_compile/CMP0066-stdout.txt @@ -0,0 +1,4 @@ +-- try_compile with CMP0066 WARN-default worked as expected +-- try_compile with CMP0066 WARN-enabled worked as expected +-- try_compile with CMP0066 OLD worked as expected +-- try_compile with CMP0066 NEW worked as expected diff --git a/Tests/RunCMake/try_compile/CMP0066.cmake b/Tests/RunCMake/try_compile/CMP0066.cmake new file mode 100644 index 0000000..4b95251 --- /dev/null +++ b/Tests/RunCMake/try_compile/CMP0066.cmake @@ -0,0 +1,58 @@ +enable_language(C) +set(CMAKE_C_FLAGS_RELEASE "-DPP_ERROR ${CMAKE_C_FLAGS_DEBUG}") +set(CMAKE_TRY_COMPILE_CONFIGURATION Release) + +#----------------------------------------------------------------------------- +message("before try_compile with CMP0066 WARN-default") +try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c + OUTPUT_VARIABLE out + ) +string(REPLACE "\n" "\n " out " ${out}") +if(NOT RESULT) + message(FATAL_ERROR "try_compile with CMP0066 WARN-default failed but should have passed:\n${out}") +else() + message(STATUS "try_compile with CMP0066 WARN-default worked as expected") +endif() +message("after try_compile with CMP0066 WARN-default") + +#----------------------------------------------------------------------------- +set(CMAKE_POLICY_WARNING_CMP0066 ON) +try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c + OUTPUT_VARIABLE out + ) +string(REPLACE "\n" "\n " out " ${out}") +if(NOT RESULT) + message(FATAL_ERROR "try_compile with CMP0066 WARN-enabled failed but should have passed:\n${out}") +else() + message(STATUS "try_compile with CMP0066 WARN-enabled worked as expected") +endif() + +#----------------------------------------------------------------------------- +cmake_policy(SET CMP0066 OLD) +try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c + OUTPUT_VARIABLE out + ) +string(REPLACE "\n" "\n " out " ${out}") +if(NOT RESULT) + message(FATAL_ERROR "try_compile with CMP0066 OLD failed but should have passed:\n${out}") +else() + message(STATUS "try_compile with CMP0066 OLD worked as expected") +endif() + +#----------------------------------------------------------------------------- +cmake_policy(SET CMP0066 NEW) +try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c + OUTPUT_VARIABLE out + ) +string(REPLACE "\n" "\n " out " ${out}") +if(RESULT) + message(FATAL_ERROR "try_compile with CMP0066 NEW passed but should have failed:\n${out}") +elseif(NOT "x${out}" MATCHES "PP_ERROR is defined") + message(FATAL_ERROR "try_compile with CMP0066 NEW did not fail with PP_ERROR:\n${out}") +else() + message(STATUS "try_compile with CMP0066 NEW worked as expected") +endif() diff --git a/Tests/RunCMake/try_compile/CompileFlags.cmake b/Tests/RunCMake/try_compile/CompileFlags.cmake deleted file mode 100644 index d4dc074..0000000 --- a/Tests/RunCMake/try_compile/CompileFlags.cmake +++ /dev/null @@ -1,17 +0,0 @@ -enable_language(C) -set(CMAKE_C_FLAGS_RELEASE "-DPP_ERROR ${CMAKE_C_FLAGS_DEBUG}") - -#----------------------------------------------------------------------------- -set(CMAKE_TRY_COMPILE_CONFIGURATION Release) -try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/src.c - OUTPUT_VARIABLE out - ) -string(REPLACE "\n" "\n " out " ${out}") -if(RESULT) - message(FATAL_ERROR "try_compile passed but should have failed:\n${out}") -elseif(NOT "x${out}" MATCHES "PP_ERROR is defined") - message(FATAL_ERROR "try_compile did not fail with PP_ERROR:\n${out}") -else() - message(STATUS "try_compile with per-config flag worked as expected") -endif() diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake index ec099fe..522433a 100644 --- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake +++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake @@ -25,7 +25,7 @@ run_cmake(TargetTypeInvalid) run_cmake(TargetTypeStatic) run_cmake(CMP0056) -run_cmake(CompileFlags) +run_cmake(CMP0066) if(RunCMake_GENERATOR MATCHES "Make|Ninja") # Use a single build tree for a few tests without cleaning. diff --git a/Utilities/Release/osx_release.cmake b/Utilities/Release/osx_release.cmake index 35705ed..e7e5ba4 100644 --- a/Utilities/Release/osx_release.cmake +++ b/Utilities/Release/osx_release.cmake @@ -13,6 +13,8 @@ set(CFLAGS "") set(CXXFLAGS "-stdlib=libc++") set(INITIAL_CACHE " CMAKE_BUILD_TYPE:STRING=Release +CMAKE_C_STANDARD:STRING=11 +CMAKE_CXX_STANDARD:STRING=11 CMAKE_OSX_ARCHITECTURES:STRING=x86_64 CMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.7 CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE @@ -21,8 +23,6 @@ BUILD_QtDialog:BOOL=TRUE CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:STRING=3 CMake_INSTALL_DEPENDENCIES:BOOL=ON CMAKE_SKIP_RPATH:BOOL=TRUE -CMake_NO_C_STANDARD:BOOL=TRUE -CMake_NO_CXX_STANDARD:BOOL=TRUE CMake_TEST_NO_FindPackageModeMakefileTest:BOOL=TRUE ") set(ENV [[ diff --git a/Utilities/Scripts/clang-format.bash b/Utilities/Scripts/clang-format.bash index 760a8d4..a9ef62b 100755 --- a/Utilities/Scripts/clang-format.bash +++ b/Utilities/Scripts/clang-format.bash @@ -36,15 +36,19 @@ Example to format locally modified files staged for commit: Utilities/Scripts/clang-format.bash --cached -Example to format the current topic: +Example to format files modified by the most recent commit: - git filter-branch \ - --tree-filter "Utilities/Scripts/clang-format.bash --amend" \ - master.. + Utilities/Scripts/clang-format.bash --amend Example to format all files: Utilities/Scripts/clang-format.bash --tracked + +Example to format the current topic: + + git filter-branch \ + --tree-filter "Utilities/Scripts/clang-format.bash --tracked" \ + master.. ' die() { diff --git a/Utilities/Scripts/update-liblzma.bash b/Utilities/Scripts/update-liblzma.bash new file mode 100755 index 0000000..088eb91 --- /dev/null +++ b/Utilities/Scripts/update-liblzma.bash @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +set -e +set -x +shopt -s dotglob + +readonly name="liblzma" +readonly ownership="liblzma upstream <xz-devel@tukaani.org>" +readonly subtree="Utilities/cmliblzma" +readonly repo="http://git.tukaani.org/xz.git" +readonly tag="v5.0.8" +readonly shortlog=false +readonly paths=" + COPYING + src/common/common_w32res.rc + src/common/sysdefs.h + src/common/tuklib_integer.h + src/liblzma/ +" + +extract_source () { + git_archive + pushd "${extractdir}/${name}-reduced" + mv src/common . + mv src/liblzma . + rmdir src + popd +} + +. "${BASH_SOURCE%/*}/update-third-party.bash" diff --git a/Utilities/cmliblzma/CMakeLists.txt b/Utilities/cmliblzma/CMakeLists.txt index 8920536..e806680 100644 --- a/Utilities/cmliblzma/CMakeLists.txt +++ b/Utilities/cmliblzma/CMakeLists.txt @@ -182,10 +182,6 @@ SET(LZMA_SRCS liblzma/simple/x86.c ) -IF(WIN32 AND BUILD_SHARED_LIBS) - SET(LZMA_SRCS ${LZMA_SRCS} liblzma/liblzma_w32res.rc) -ENDIF() - CONFIGURE_FILE(config.h.in config.h @ONLY) INCLUDE_DIRECTORIES( @@ -209,7 +205,7 @@ ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "PathScale") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -woffall") ENDIF() -ADD_LIBRARY(cmliblzma ${LZMA_SRCS}) +ADD_LIBRARY(cmliblzma STATIC ${LZMA_SRCS}) IF(CMAKE_C_COMPILER_ID STREQUAL "XL") # Disable the XL compiler optimizer because it causes crashes diff --git a/Utilities/cmliblzma/README-CMake.txt b/Utilities/cmliblzma/README-CMake.txt deleted file mode 100644 index b512997..0000000 --- a/Utilities/cmliblzma/README-CMake.txt +++ /dev/null @@ -1,66 +0,0 @@ -The Utilities/cmliblzma directory contains a reduced distribution -of the liblzma source tree with only the library source code and -CMake build system. It is not a submodule; the actual content is part -of our source tree and changes can be made and committed directly. - -We update from upstream using Git's "subtree" merge strategy. A -special branch contains commits of upstream liblzma snapshots and -nothing else. No Git ref points explicitly to the head of this -branch, but it is merged into our history. - -Update liblzma from upstream as follows. Create a local branch to -explicitly reference the upstream snapshot branch head: - - git branch liblzma-upstream c289e634 - -Use a temporary directory to checkout the branch: - - mkdir liblzma-tmp - cd liblzma-tmp - git init - git pull .. liblzma-upstream - rm -rf * - -Now place the (reduced) liblzma content in this directory. See -instructions shown by - - git log c289e634 - -for help extracting the content from the upstream svn repo. Then run -the following commands to commit the new version. Substitute the -appropriate date and version number: - - git add --all - - GIT_AUTHOR_NAME='liblzma upstream' \ - GIT_AUTHOR_EMAIL='xz-devel@tukaani.org' \ - GIT_AUTHOR_DATE='Sun Jun 30 19:55:49 2013 +0300' \ - git commit -m 'liblzma 5.0.5-gb69900ed (reduced)' && - git commit --amend - -Edit the commit message to describe the procedure used to obtain the -content. Then push the changes back up to the main local repository: - - git push .. HEAD:liblzma-upstream - cd .. - rm -rf liblzma-tmp - -Create a topic in the main repository on which to perform the update: - - git checkout -b update-liblzma master - -Merge the liblzma-upstream branch as a subtree: - - git merge -s recursive -X subtree=Utilities/cmliblzma \ - liblzma-upstream - -If there are conflicts, resolve them and commit. Build and test the -tree. Commit any additional changes needed to succeed. - -Finally, run - - git rev-parse --short=8 liblzma-upstream - -to get the commit from which the liblzma-upstream branch must be started -on the next update. Edit the "git branch liblzma-upstream" line above to -record it, and commit this file. diff --git a/Utilities/cmliblzma/liblzma/api/lzma/block.h b/Utilities/cmliblzma/liblzma/api/lzma/block.h index 8a4bf23..e6710a7 100644 --- a/Utilities/cmliblzma/liblzma/api/lzma/block.h +++ b/Utilities/cmliblzma/liblzma/api/lzma/block.h @@ -318,6 +318,9 @@ extern LZMA_API(lzma_ret) lzma_block_header_encode( * The size of the Block Header must have already been decoded with * lzma_block_header_size_decode() macro and stored to block->header_size. * + * The integrity check type from Stream Header must have been stored + * to block->check. + * * block->filters must have been allocated, but they don't need to be * initialized (possible existing filter options are not freed). * diff --git a/Utilities/cmliblzma/liblzma/api/lzma/version.h b/Utilities/cmliblzma/liblzma/api/lzma/version.h index 66e9396..09866b9 100644 --- a/Utilities/cmliblzma/liblzma/api/lzma/version.h +++ b/Utilities/cmliblzma/liblzma/api/lzma/version.h @@ -22,7 +22,7 @@ */ #define LZMA_VERSION_MAJOR 5 #define LZMA_VERSION_MINOR 0 -#define LZMA_VERSION_PATCH 5 +#define LZMA_VERSION_PATCH 8 #define LZMA_VERSION_STABILITY LZMA_VERSION_STABILITY_STABLE #ifndef LZMA_VERSION_COMMIT diff --git a/Utilities/cmliblzma/liblzma/check/crc32_fast.c b/Utilities/cmliblzma/liblzma/check/crc32_fast.c index 13f65b4..c2c3cb7 100644 --- a/Utilities/cmliblzma/liblzma/check/crc32_fast.c +++ b/Utilities/cmliblzma/liblzma/check/crc32_fast.c @@ -20,7 +20,7 @@ #include "crc_macros.h" -// If you make any changes, do some bench marking! Seemingly unrelated +// If you make any changes, do some benchmarking! Seemingly unrelated // changes can very easily ruin the performance (and very probably is // very compiler dependent). extern LZMA_API(uint32_t) diff --git a/Utilities/cmliblzma/liblzma/check/sha256.c b/Utilities/cmliblzma/liblzma/check/sha256.c index c2c85eb..3af6aa6 100644 --- a/Utilities/cmliblzma/liblzma/check/sha256.c +++ b/Utilities/cmliblzma/liblzma/check/sha256.c @@ -80,7 +80,7 @@ static const uint32_t SHA256_K[64] = { static void -transform(uint32_t state[], const uint32_t data[]) +transform(uint32_t state[8], const uint32_t data[16]) { uint32_t W[16]; uint32_t T[8]; diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_presets.c b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_presets.c index 8af9b9f..9332abf 100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_presets.c +++ b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_presets.c @@ -16,8 +16,9 @@ extern LZMA_API(lzma_bool) lzma_lzma_preset(lzma_options_lzma *options, uint32_t preset) { - static const uint8_t dict_size_values[] = { 18, 20, 21, 22, 22, 23, 23, 24, 25, 26 }; - static const uint8_t depth_values[] = { 4, 8, 24, 48 }; + static const uint8_t dict_pow2[] + = { 18, 20, 21, 22, 22, 23, 23, 24, 25, 26 }; + static const uint8_t depths[] = { 4, 8, 24, 48 }; const uint32_t level = preset & LZMA_PRESET_LEVEL_MASK; const uint32_t flags = preset & ~LZMA_PRESET_LEVEL_MASK; @@ -33,13 +34,13 @@ lzma_lzma_preset(lzma_options_lzma *options, uint32_t preset) options->lp = LZMA_LP_DEFAULT; options->pb = LZMA_PB_DEFAULT; - options->dict_size = UINT32_C(1) << dict_size_values[level]; + options->dict_size = UINT32_C(1) << dict_pow2[level]; if (level <= 3) { options->mode = LZMA_MODE_FAST; options->mf = level == 0 ? LZMA_MF_HC3 : LZMA_MF_HC4; options->nice_len = level <= 1 ? 128 : 273; - options->depth = depth_values[level]; + options->depth = depths[level]; } else { options->mode = LZMA_MODE_NORMAL; options->mf = LZMA_MF_BT4; @@ -365,7 +365,6 @@ KWSYS_CXX_SOURCES="\ SystemTools" KWSYS_FILES="\ - auto_ptr.hxx \ Directory.hxx \ Encoding.h \ Encoding.hxx \ |