diff options
75 files changed, 347 insertions, 219 deletions
diff --git a/Auxiliary/vim/syntax/cmake.vim b/Auxiliary/vim/syntax/cmake.vim index 98d6ef1..5c153c1 100644 --- a/Auxiliary/vim/syntax/cmake.vim +++ b/Auxiliary/vim/syntax/cmake.vim @@ -110,7 +110,7 @@ syn keyword cmakeKWctest_coverage contained \ APPEND BUILD CAPTURE_CMAKE_ERROR LABELS QUIET RETURN_VALUE syn keyword cmakeKWctest_memcheck contained - \ APPEND BUILD DEFECT_COUNT EXCLUDE EXCLUDE_FIXTURE EXCLUDE_FIXTURE_CLEANUP EXCLUDE_FIXTURE_SETUP EXCLUDE_LABEL INCLUDE INCLUDE_LABEL OFF ON PARALLEL_LEVEL QUIET RETURN_VALUE SCHEDULE_RANDOM START STOP_TIME STRIDE TEST_LOAD + \ APPEND BUILD CAPTURE_CMAKE_ERROR DEFECT_COUNT EXCLUDE EXCLUDE_FIXTURE EXCLUDE_FIXTURE_CLEANUP EXCLUDE_FIXTURE_SETUP EXCLUDE_LABEL INCLUDE INCLUDE_LABEL OFF ON PARALLEL_LEVEL QUIET RETURN_VALUE SCHEDULE_RANDOM START STOP_TIME STRIDE TEST_LOAD syn keyword cmakeKWctest_run_script contained \ NEW_PROCESS RETURN_VALUE @@ -119,13 +119,13 @@ syn keyword cmakeKWctest_start contained \ APPEND QUIET TAG TRACK syn keyword cmakeKWctest_submit contained - \ API CDASH_UPLOAD CDASH_UPLOAD_TYPE CTEST_EXTRA_SUBMIT_FILES CTEST_NOTES_FILES FILES HTTPHEADER PARTS QUIET RETRY_COUNT RETRY_DELAY RETURN_VALUE + \ API CAPTURE_CMAKE_ERROR CDASH_UPLOAD CDASH_UPLOAD_TYPE CTEST_EXTRA_SUBMIT_FILES CTEST_NOTES_FILES FILES HTTPHEADER PARTS QUIET RETRY_COUNT RETRY_DELAY RETURN_VALUE syn keyword cmakeKWctest_test contained \ APPEND BUILD CAPTURE_CMAKE_ERROR CPU EXCLUDE EXCLUDE_FIXTURE EXCLUDE_FIXTURE_CLEANUP EXCLUDE_FIXTURE_SETUP EXCLUDE_LABEL INCLUDE INCLUDE_LABEL OFF ON PARALLEL_LEVEL QUIET RETURN_VALUE SCHEDULE_RANDOM START STOP_TIME STRIDE TEST_LOAD syn keyword cmakeKWctest_update contained - \ QUIET RETURN_VALUE SOURCE + \ CAPTURE_CMAKE_ERROR QUIET RETURN_VALUE SOURCE syn keyword cmakeKWctest_upload contained \ CAPTURE_CMAKE_ERROR FILES QUIET diff --git a/CMakeLists.txt b/CMakeLists.txt index 1fcd8f8..7f16e79 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -498,7 +498,7 @@ macro (CMAKE_BUILD_UTILITIES) #--------------------------------------------------------------------- # Build or use system libarchive for CMake and CTest. if(CMAKE_USE_SYSTEM_LIBARCHIVE) - find_package(LibArchive 3.0.0) + find_package(LibArchive 3.1.0) if(NOT LibArchive_FOUND) message(FATAL_ERROR "CMAKE_USE_SYSTEM_LIBARCHIVE is ON but LibArchive is not found!") endif() diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index aef375a..18e0078 100644 --- a/CTestCustom.cmake.in +++ b/CTestCustom.cmake.in @@ -2,6 +2,7 @@ list(APPEND CTEST_CUSTOM_ERROR_MATCH "ERROR:") list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION + "warning: cast from 'char\\*' to 'cmCursesWidget\\*' increases required alignment of target type" # Occurs when using Solaris's system libform "xtree.[0-9]+. : warning C4702: unreachable code" "warning LNK4221" "warning LNK4204" # Occurs by race condition with objects in small libs diff --git a/Help/command/ctest_submit.rst b/Help/command/ctest_submit.rst index a412792..2ba6bef 100644 --- a/Help/command/ctest_submit.rst +++ b/Help/command/ctest_submit.rst @@ -10,6 +10,7 @@ Perform the :ref:`CTest Submit Step` as a :ref:`Dashboard Client`. [RETRY_COUNT <count>] [RETRY_DELAY <delay>] [RETURN_VALUE <result-var>] + [CAPTURE_CMAKE_ERROR <result-var>] [QUIET] ) @@ -52,6 +53,10 @@ The options are: Store in the ``<result-var>`` variable ``0`` for success and non-zero on failure. +``CAPTURE_CMAKE_ERROR <result-var>`` + Store in the ``<result-var>`` variable -1 if there are any errors running + the command and prevent ctest from returning non-zero if an error occurs. + ``QUIET`` Suppress all non-error messages that would have otherwise been printed to the console. diff --git a/Help/command/ctest_update.rst b/Help/command/ctest_update.rst index b205bca..df1a4e5 100644 --- a/Help/command/ctest_update.rst +++ b/Help/command/ctest_update.rst @@ -5,7 +5,10 @@ Perform the :ref:`CTest Update Step` as a :ref:`Dashboard Client`. :: - ctest_update([SOURCE <source-dir>] [RETURN_VALUE <result-var>] [QUIET]) + ctest_update([SOURCE <source-dir>] + [RETURN_VALUE <result-var>] + [CAPTURE_CMAKE_ERROR <result-var>] + [QUIET]) Update the source tree from version control and record results in ``Update.xml`` for submission with the :command:`ctest_submit` command. @@ -20,6 +23,10 @@ The options are: Store in the ``<result-var>`` variable the number of files updated or ``-1`` on error. +``CAPTURE_CMAKE_ERROR <result-var>`` + Store in the ``<result-var>`` variable -1 if there are any errors running + the command and prevent ctest from returning non-zero if an error occurs. + ``QUIET`` Tell CTest to suppress most non-error messages that it would have otherwise printed to the console. CTest will still report diff --git a/Help/cpack_gen/external.rst b/Help/cpack_gen/external.rst index a69866d..f98e1c9 100644 --- a/Help/cpack_gen/external.rst +++ b/Help/cpack_gen/external.rst @@ -10,19 +10,32 @@ tools. For this reason, CPack provides the "External" generator, which allows external packaging software to take advantage of some of the functionality provided by CPack, such as component installation and the dependency graph. -The CPack External generator doesn't actually package any files. Instead, it -generates a .json file containing the CPack internal metadata, which gives -external software information on how to package the software. This metadata -file contains a list of CPack components and component groups, the various -options passed to :command:`cpack_add_component` and +Integration with External Packaging Tools +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The CPack External generator generates a .json file containing the +CPack internal metadata, which gives external software information +on how to package the software. External packaging software may itself +invoke CPack, consume the generated metadata, +install and package files as required. + +Alternatively CPack can invoke an external packaging software +through an optional custom CMake script in +:variable:`CPACK_EXT_PACKAGE_SCRIPT` instead. + +Staging of installation files may also optionally be +taken care of by the generator when enabled through the +:variable:`CPACK_EXT_ENABLE_STAGING` variable. + +JSON Format +^^^^^^^^^^^ + +The JSON metadata file contains a list of CPack components and component groups, +the various options passed to :command:`cpack_add_component` and :command:`cpack_add_component_group`, the dependencies between the components and component groups, and various other options passed to CPack. -Format -^^^^^^ - -The file produced by the CPack External generator is a .json file with an -object as its root. This root object will always provide two fields: +The JSON's root object will always provide two fields: ``formatVersionMajor`` and ``formatVersionMinor``, which are always integers that describe the output format of the generator. Backwards-compatible changes to the output format (for example, adding a new field that didn't exist before) @@ -247,3 +260,24 @@ Variables specific to CPack External generator If an invalid version is encountered in ``CPACK_EXT_REQUESTED_VERSIONS`` (one that doesn't match ``major.minor``, where ``major`` and ``minor`` are integers), it is ignored. + +.. variable:: CPACK_EXT_ENABLE_STAGING + + This variable can be set to true to enable optional installation + into a temporary staging area which can then be picked up + and packaged by an external packaging tool. + The top level directory used by CPack for the current packaging + task is contained in ``CPACK_TOPLEVEL_DIRECTORY``. + It is automatically cleaned up on each run before packaging is initiated + and can be used for custom temporary files required by + the external packaging tool. + It also contains the staging area ``CPACK_TEMPORARY_DIRECTORY`` + into which CPack performs the installation when staging is enabled. + +.. variable:: CPACK_EXT_PACKAGE_SCRIPT + + This variable can optionally specify the full path to + a CMake script file to be run as part of the CPack invocation. + It is invoked after (optional) staging took place and may + run an external packaging tool. The script has access to + the variables defined by the CPack config file. diff --git a/Help/variable/CMAKE_ANDROID_STL_TYPE.rst b/Help/variable/CMAKE_ANDROID_STL_TYPE.rst index cfb76aa..d174575 100644 --- a/Help/variable/CMAKE_ANDROID_STL_TYPE.rst +++ b/Help/variable/CMAKE_ANDROID_STL_TYPE.rst @@ -30,7 +30,8 @@ set to specify the STL variant to be used. The value may be one of: ``stlport_shared`` STLport Shared -The default value is ``gnustl_static``. Note that this default differs from +The default value is ``gnustl_static`` on NDK versions that provide it +and otherwise ``c++_static``. Note that this default differs from the native NDK build system because CMake may be used to build projects for Android that are not natively implemented for it and use the C++ standard library. diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake index 9f4c8d1..4491d4b 100644 --- a/Modules/Compiler/GNU.cmake +++ b/Modules/Compiler/GNU.cmake @@ -90,5 +90,11 @@ macro(__compiler_gnu lang) ) endif() - set(CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "${CMAKE_${lang}_COMPILER}" "-dM" "-E" "-c" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp") + set(CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "${CMAKE_${lang}_COMPILER}") + if(CMAKE_${lang}_COMPILER_ARG1) + separate_arguments(_COMPILER_ARGS NATIVE_COMMAND "${CMAKE_${lang}_COMPILER_ARG1}") + list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND ${_COMPILER_ARGS}) + unset(_COMPILER_ARGS) + endif() + list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "-dM" "-E" "-c" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp") endmacro() diff --git a/Modules/Compiler/Intel.cmake b/Modules/Compiler/Intel.cmake index 635ac4d..f2f16e0 100644 --- a/Modules/Compiler/Intel.cmake +++ b/Modules/Compiler/Intel.cmake @@ -25,6 +25,12 @@ else() string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O3") string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g") - set(CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "${CMAKE_${lang}_COMPILER}" "-QdM" "-P" "-Za" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp") + set(CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "${CMAKE_${lang}_COMPILER}") + if(CMAKE_${lang}_COMPILER_ARG1) + separate_arguments(_COMPILER_ARGS NATIVE_COMMAND "${CMAKE_${lang}_COMPILER_ARG1}") + list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND ${_COMPILER_ARGS}) + unset(_COMPILER_ARGS) + endif() + list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "-QdM" "-P" "-Za" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp") endmacro() endif() diff --git a/Modules/Compiler/QCC.cmake b/Modules/Compiler/QCC.cmake index 9f2b735..9ba9900 100644 --- a/Modules/Compiler/QCC.cmake +++ b/Modules/Compiler/QCC.cmake @@ -19,7 +19,13 @@ macro(__compiler_qcc lang) set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE NO) set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER NO) - set(CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "${CMAKE_${lang}_COMPILER}" "-Wp,-dM" "-E" "-c" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp") + set(CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "${CMAKE_${lang}_COMPILER}") + if(CMAKE_${lang}_COMPILER_ARG1) + separate_arguments(_COMPILER_ARGS NATIVE_COMMAND "${CMAKE_${lang}_COMPILER_ARG1}") + list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND ${_COMPILER_ARGS}) + unset(_COMPILER_ARGS) + endif() + list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "-Wp,-dM" "-E" "-c" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp") unset(CMAKE_${lang}_COMPILE_OPTIONS_IPO) unset(CMAKE_${lang}_ARCHIVE_CREATE_IPO) diff --git a/Modules/FindLua.cmake b/Modules/FindLua.cmake index b57a46e..e86c15c 100644 --- a/Modules/FindLua.cmake +++ b/Modules/FindLua.cmake @@ -42,13 +42,6 @@ cmake_policy(SET CMP0012 NEW) # For while(TRUE) unset(_lua_include_subdirs) unset(_lua_library_names) unset(_lua_append_versions) -set(_lua_additional_paths - ~/Library/Frameworks - /Library/Frameworks - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt) # this is a function only to have all the variables inside go away automatically function(_lua_get_versions) @@ -161,7 +154,6 @@ function(_lua_find_header) HINTS ENV LUA_DIR PATH_SUFFIXES ${subdir} - PATHS ${_lua_additional_paths} ) if (LUA_INCLUDE_DIR) break() @@ -209,7 +201,6 @@ find_library(LUA_LIBRARY HINTS ENV LUA_DIR PATH_SUFFIXES lib - PATHS ${_lua_additional_paths} ) unset(_lua_library_names) diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index 9e13fc3..f2ada3b 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -1167,21 +1167,24 @@ function(_Matlab_get_version_from_root matlab_root matlab_or_mcr matlab_known_ve # return the updated value set(${matlab_final_version} ${Matlab_VERSION_STRING_INTERNAL} PARENT_SCOPE) - else() + elseif(EXISTS "${matlab_root}/VersionInfo.xml") # MCR # we cannot run anything in order to extract the version. We assume that the file # VersionInfo.xml exists under the MatlabRoot, we look for it and extract the version from there set(_matlab_version_tmp "unknown") file(STRINGS "${matlab_root}/VersionInfo.xml" versioninfo_string NEWLINE_CONSUME) - # parses "<version>9.2.0.538062</version>" - string(REGEX MATCH "<version>(.*)</version>" - version_reg_match - ${versioninfo_string} - ) - - if(NOT "${version_reg_match}" STREQUAL "") - if("${CMAKE_MATCH_1}" MATCHES "(([0-9])\\.([0-9]))[\\.0-9]*") - set(_matlab_version_tmp "${CMAKE_MATCH_1}") + + if(versioninfo_string) + # parses "<version>9.2.0.538062</version>" + string(REGEX MATCH "<version>(.*)</version>" + version_reg_match + ${versioninfo_string} + ) + + if(NOT "${version_reg_match}" STREQUAL "") + if("${CMAKE_MATCH_1}" MATCHES "(([0-9])\\.([0-9]))[\\.0-9]*") + set(_matlab_version_tmp "${CMAKE_MATCH_1}") + endif() endif() endif() set(${matlab_final_version} "${_matlab_version_tmp}" PARENT_SCOPE) @@ -1189,8 +1192,7 @@ function(_Matlab_get_version_from_root matlab_root matlab_or_mcr matlab_known_ve "${_matlab_version_tmp}" CACHE INTERNAL "Matlab (MCR) version (automatically determined)" FORCE) - - endif() # Matlab or MCR + endif() # Matlab or MCR endfunction() diff --git a/Modules/Platform/Android-Common.cmake b/Modules/Platform/Android-Common.cmake index 80a8f41..f8b9346 100644 --- a/Modules/Platform/Android-Common.cmake +++ b/Modules/Platform/Android-Common.cmake @@ -32,8 +32,10 @@ if(CMAKE_ANDROID_NDK) ) endif() unset(_ANDROID_STL_TYPE_FOUND) - else() + elseif(IS_DIRECTORY ${CMAKE_ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++) set(CMAKE_ANDROID_STL_TYPE "gnustl_static") + else() + set(CMAKE_ANDROID_STL_TYPE "c++_static") endif() unset(_ANDROID_STL_TYPES) diff --git a/Modules/Platform/Android/Determine-Compiler-NDK.cmake b/Modules/Platform/Android/Determine-Compiler-NDK.cmake index 0649925..5f2cc52 100644 --- a/Modules/Platform/Android/Determine-Compiler-NDK.cmake +++ b/Modules/Platform/Android/Determine-Compiler-NDK.cmake @@ -35,7 +35,18 @@ elseif(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION) endif() set(_ANDROID_TOOL_PATTERNS "*-${CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION}") else() - set(_ANDROID_TOOL_PATTERNS "*-[0-9].[0-9]") + # If we can find any gcc toolchains then use one by default. + # Otherwise we look for clang toolchains (e.g. NDK r18+). + file(GLOB _ANDROID_CONFIG_MKS_FOR_GCC + "${CMAKE_ANDROID_NDK}/build/core/toolchains/*-[0-9].[0-9]/config.mk" + "${CMAKE_ANDROID_NDK}/toolchains/*-[0-9].[0-9]/config.mk" + ) + if(_ANDROID_CONFIG_MKS_FOR_GCC) + set(_ANDROID_TOOL_PATTERNS "*-[0-9].[0-9]") + else() + set(_ANDROID_TOOL_PATTERNS "*-clang") + endif() + unset(_ANDROID_CONFIG_MKS_FOR_GCC) endif() set(_ANDROID_CONFIG_MK_PATTERNS) foreach(base "build/core/toolchains" "toolchains") diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 2c9922d..bcc291e 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 12) -set(CMake_VERSION_PATCH 20180828) +set(CMake_VERSION_PATCH 20180831) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/cmCPackExtGenerator.cxx b/Source/CPack/cmCPackExtGenerator.cxx index c36b098..4c560b9 100644 --- a/Source/CPack/cmCPackExtGenerator.cxx +++ b/Source/CPack/cmCPackExtGenerator.cxx @@ -5,6 +5,7 @@ #include "cmAlgorithms.h" #include "cmCPackComponentGroup.h" #include "cmCPackLog.h" +#include "cmMakefile.h" #include "cmSystemTools.h" #include "cm_jsoncpp_value.h" @@ -56,6 +57,23 @@ int cmCPackExtGenerator::PackageFiles() return 0; } + const char* packageScript = this->GetOption("CPACK_EXT_PACKAGE_SCRIPT"); + if (packageScript && *packageScript) { + if (!cmSystemTools::FileIsFullPath(packageScript)) { + cmCPackLogger( + cmCPackLog::LOG_ERROR, + "CPACK_EXT_PACKAGE_SCRIPT does not contain a full file path" + << std::endl); + return 0; + } + + int res = this->MakefileMap->ReadListFile(packageScript); + + if (cmSystemTools::GetErrorOccuredFlag() || !res) { + return 0; + } + } + return 1; } @@ -67,16 +85,22 @@ bool cmCPackExtGenerator::SupportsComponentInstallation() const int cmCPackExtGenerator::InstallProjectViaInstallCommands( bool setDestDir, const std::string& tempInstallDirectory) { - (void)setDestDir; - (void)tempInstallDirectory; + if (this->StagingEnabled()) { + return cmCPackGenerator::InstallProjectViaInstallCommands( + setDestDir, tempInstallDirectory); + } + return 1; } int cmCPackExtGenerator::InstallProjectViaInstallScript( bool setDestDir, const std::string& tempInstallDirectory) { - (void)setDestDir; - (void)tempInstallDirectory; + if (this->StagingEnabled()) { + return cmCPackGenerator::InstallProjectViaInstallScript( + setDestDir, tempInstallDirectory); + } + return 1; } @@ -84,9 +108,11 @@ int cmCPackExtGenerator::InstallProjectViaInstalledDirectories( bool setDestDir, const std::string& tempInstallDirectory, const mode_t* default_dir_mode) { - (void)setDestDir; - (void)tempInstallDirectory; - (void)default_dir_mode; + if (this->StagingEnabled()) { + return cmCPackGenerator::InstallProjectViaInstalledDirectories( + setDestDir, tempInstallDirectory, default_dir_mode); + } + return 1; } @@ -94,10 +120,11 @@ int cmCPackExtGenerator::RunPreinstallTarget( const std::string& installProjectName, const std::string& installDirectory, cmGlobalGenerator* globalGenerator, const std::string& buildConfig) { - (void)installProjectName; - (void)installDirectory; - (void)globalGenerator; - (void)buildConfig; + if (this->StagingEnabled()) { + return cmCPackGenerator::RunPreinstallTarget( + installProjectName, installDirectory, globalGenerator, buildConfig); + } + return 1; } @@ -108,18 +135,21 @@ int cmCPackExtGenerator::InstallCMakeProject( const std::string& installSubDirectory, const std::string& buildConfig, std::string& absoluteDestFiles) { - (void)setDestDir; - (void)installDirectory; - (void)baseTempInstallDirectory; - (void)default_dir_mode; - (void)component; - (void)componentInstall; - (void)installSubDirectory; - (void)buildConfig; - (void)absoluteDestFiles; + if (this->StagingEnabled()) { + return cmCPackGenerator::InstallCMakeProject( + setDestDir, installDirectory, baseTempInstallDirectory, default_dir_mode, + component, componentInstall, installSubDirectory, buildConfig, + absoluteDestFiles); + } + return 1; } +bool cmCPackExtGenerator::StagingEnabled() const +{ + return !cmSystemTools::IsOff(this->GetOption("CPACK_EXT_ENABLE_STAGING")); +} + cmCPackExtGenerator::cmCPackExtVersionGenerator::cmCPackExtVersionGenerator( cmCPackExtGenerator* parent) : Parent(parent) diff --git a/Source/CPack/cmCPackExtGenerator.h b/Source/CPack/cmCPackExtGenerator.h index fa12d7f..103e56d 100644 --- a/Source/CPack/cmCPackExtGenerator.h +++ b/Source/CPack/cmCPackExtGenerator.h @@ -52,6 +52,8 @@ protected: std::string& absoluteDestFiles) override; private: + bool StagingEnabled() const; + class cmCPackExtVersionGenerator { public: diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index c13c649..4755f94 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -321,7 +321,6 @@ protected: bool Trace; bool TraceExpand; -private: cmMakefile* MakefileMap; }; diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 3f6654b..c5941ce 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -83,6 +83,7 @@ static const char* cmCTestErrorExceptions[] = { "instantiated from ", "candidates are:", ": warning", + ": WARNING", ": \\(Warning\\)", ": note", "Note:", diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 04d1839..9c9532a 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -1087,7 +1087,7 @@ void cmCTestMemCheckHandler::TestOutputFileNames( g.FindFiles(ofile); if (g.GetFiles().empty()) { std::string log = "Cannot find memory tester output file: " + ofile; - cmCTestLog(this->CTest, ERROR_MESSAGE, log << std::endl); + cmCTestLog(this->CTest, WARNING, log << std::endl); ofile.clear(); } else { files = g.GetFiles(); @@ -1095,7 +1095,7 @@ void cmCTestMemCheckHandler::TestOutputFileNames( } } else if (!cmSystemTools::FileExists(ofile)) { std::string log = "Cannot find memory tester output file: " + ofile; - cmCTestLog(this->CTest, ERROR_MESSAGE, log << std::endl); + cmCTestLog(this->CTest, WARNING, log << std::endl); ofile.clear(); } files.push_back(std::move(ofile)); diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx index 1e3faef..91ccdf7 100644 --- a/Source/cmAddCustomCommandCommand.cxx +++ b/Source/cmAddCustomCommandCommand.cxx @@ -320,7 +320,7 @@ bool cmAddCustomCommandCommand::InitialPass( // Convert working directory to a full path. if (!working.empty()) { - const char* build_dir = this->Makefile->GetCurrentBinaryDirectory(); + const std::string& build_dir = this->Makefile->GetCurrentBinaryDirectory(); working = cmSystemTools::CollapseFullPath(working, build_dir); } diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx index 4655f58..82ee6b4 100644 --- a/Source/cmAddCustomTargetCommand.cxx +++ b/Source/cmAddCustomTargetCommand.cxx @@ -183,7 +183,7 @@ bool cmAddCustomTargetCommand::InitialPass( // Convert working directory to a full path. if (!working_directory.empty()) { - const char* build_dir = this->Makefile->GetCurrentBinaryDirectory(); + const std::string& build_dir = this->Makefile->GetCurrentBinaryDirectory(); working_directory = cmSystemTools::CollapseFullPath(working_directory, build_dir); } diff --git a/Source/cmAddSubDirectoryCommand.cxx b/Source/cmAddSubDirectoryCommand.cxx index f673c72..75bd6fb 100644 --- a/Source/cmAddSubDirectoryCommand.cxx +++ b/Source/cmAddSubDirectoryCommand.cxx @@ -80,17 +80,17 @@ bool cmAddSubDirectoryCommand::InitialPass( // Remove the CurrentDirectory from the srcPath and replace it // with the CurrentOutputDirectory. - const char* src = this->Makefile->GetCurrentSourceDirectory(); - const char* bin = this->Makefile->GetCurrentBinaryDirectory(); - size_t srcLen = strlen(src); - size_t binLen = strlen(bin); + const std::string& src = this->Makefile->GetCurrentSourceDirectory(); + const std::string& bin = this->Makefile->GetCurrentBinaryDirectory(); + size_t srcLen = src.length(); + size_t binLen = bin.length(); if (srcLen > 0 && src[srcLen - 1] == '/') { --srcLen; } if (binLen > 0 && bin[binLen - 1] == '/') { --binLen; } - binPath = std::string(bin, binLen) + srcPath.substr(srcLen); + binPath = bin.substr(0, binLen) + srcPath.substr(srcLen); } else { // Use the binary directory specified. // Interpret a relative path with respect to the current binary directory. diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index be3d2f4..3aa59d6 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -118,22 +118,22 @@ const char* CCONV cmGetHomeOutputDirectory(void* arg) const char* CCONV cmGetStartDirectory(void* arg) { cmMakefile* mf = static_cast<cmMakefile*>(arg); - return mf->GetCurrentSourceDirectory(); + return mf->GetCurrentSourceDirectory().c_str(); } const char* CCONV cmGetStartOutputDirectory(void* arg) { cmMakefile* mf = static_cast<cmMakefile*>(arg); - return mf->GetCurrentBinaryDirectory(); + return mf->GetCurrentBinaryDirectory().c_str(); } const char* CCONV cmGetCurrentDirectory(void* arg) { cmMakefile* mf = static_cast<cmMakefile*>(arg); - return mf->GetCurrentSourceDirectory(); + return mf->GetCurrentSourceDirectory().c_str(); } const char* CCONV cmGetCurrentOutputDirectory(void* arg) { cmMakefile* mf = static_cast<cmMakefile*>(arg); - return mf->GetCurrentBinaryDirectory(); + return mf->GetCurrentBinaryDirectory().c_str(); } const char* CCONV cmGetDefinition(void* arg, const char* def) { diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index c6ec5bf..f965a29 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -254,12 +254,12 @@ bool cmExportCommand::HandlePackage(std::vector<std::string> const& args) // We store the current build directory in the registry as a value // named by a hash of its own content. This is deterministic and is // unique with high probability. - const char* outDir = this->Makefile->GetCurrentBinaryDirectory(); + const std::string& outDir = this->Makefile->GetCurrentBinaryDirectory(); std::string hash = cmSystemTools::ComputeStringMD5(outDir); #if defined(_WIN32) && !defined(__CYGWIN__) - this->StorePackageRegistryWin(package, outDir, hash.c_str()); + this->StorePackageRegistryWin(package, outDir.c_str(), hash.c_str()); #else - this->StorePackageRegistryDir(package, outDir, hash.c_str()); + this->StorePackageRegistryDir(package, outDir.c_str(), hash.c_str()); #endif return true; diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index 582a2e7..fe5c7bb 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -122,7 +122,7 @@ std::vector<std::string> cmExtraCodeLiteGenerator::CreateProjectsByTarget( for (cmLocalGenerator* lg : lgs) { for (cmGeneratorTarget* lt : lg->GetGeneratorTargets()) { cmStateEnums::TargetType type = lt->GetType(); - std::string outputDir = lg->GetCurrentBinaryDirectory(); + std::string const& outputDir = lg->GetCurrentBinaryDirectory(); std::string targetName = lt->GetName(); std::string filename = outputDir + "/" + targetName + ".project"; retval.push_back(targetName); @@ -161,7 +161,7 @@ std::vector<std::string> cmExtraCodeLiteGenerator::CreateProjectsByProjectMaps( // for each sub project in the workspace create a codelite project for (auto const& it : this->GlobalGenerator->GetProjectMap()) { - std::string outputDir = it.second[0]->GetCurrentBinaryDirectory(); + std::string const& outputDir = it.second[0]->GetCurrentBinaryDirectory(); std::string projectName = it.second[0]->GetProjectName(); retval.push_back(projectName); std::string filename = outputDir + "/" + projectName + ".project"; @@ -184,7 +184,7 @@ std::vector<std::string> cmExtraCodeLiteGenerator::CreateProjectsByProjectMaps( void cmExtraCodeLiteGenerator::CreateProjectFile( const std::vector<cmLocalGenerator*>& lgs) { - std::string outputDir = lgs[0]->GetCurrentBinaryDirectory(); + std::string const& outputDir = lgs[0]->GetCurrentBinaryDirectory(); std::string projectName = lgs[0]->GetProjectName(); std::string filename = outputDir + "/"; diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index d49e490..1c29017 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -3471,7 +3471,7 @@ bool cmFileCommand::HandleLockCommand(std::vector<std::string> const& args) } if (!cmsys::SystemTools::FileIsFullPath(path)) { - path = this->Makefile->GetCurrentSourceDirectory() + ("/" + path); + path = this->Makefile->GetCurrentSourceDirectory() + "/" + path; } // Unify path (remove '//', '/../', ...) diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index b1b2b88..6823cd5 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -386,11 +386,11 @@ void cmCompiledGeneratorExpression::GetMaxLanguageStandard( } } -const char* cmGeneratorExpressionInterpreter::Evaluate( +const std::string& cmGeneratorExpressionInterpreter::Evaluate( const char* expression, const std::string& property) { if (this->Target.empty()) { - return this->EvaluateExpression(expression).c_str(); + return this->EvaluateExpression(expression); } // Specify COMPILE_OPTIONS to DAGchecker, same semantic as COMPILE_FLAGS @@ -398,5 +398,5 @@ const char* cmGeneratorExpressionInterpreter::Evaluate( this->Target, property == "COMPILE_FLAGS" ? "COMPILE_OPTIONS" : property, nullptr, nullptr); - return this->EvaluateExpression(expression, &dagChecker).c_str(); + return this->EvaluateExpression(expression, &dagChecker); } diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 1ceb7da..2b7df91 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -179,17 +179,10 @@ public: { } - const char* Evaluate(const char* expression) - { - return this->EvaluateExpression(expression).c_str(); - } - const char* Evaluate(const std::string& expression) - { - return this->Evaluate(expression.c_str()); - } - const char* Evaluate(const char* expression, const std::string& property); - const char* Evaluate(const std::string& expression, - const std::string& property) + const std::string& Evaluate(const char* expression, + const std::string& property); + const std::string& Evaluate(const std::string& expression, + const std::string& property) { return this->Evaluate(expression.c_str(), property); } diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 0b3a945..eb1852d 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -3606,8 +3606,9 @@ bool cmGeneratorTarget::StrictTargetComparison::operator()( { int nameResult = strcmp(t1->GetName().c_str(), t2->GetName().c_str()); if (nameResult == 0) { - return strcmp(t1->GetLocalGenerator()->GetCurrentBinaryDirectory(), - t2->GetLocalGenerator()->GetCurrentBinaryDirectory()) < 0; + return strcmp( + t1->GetLocalGenerator()->GetCurrentBinaryDirectory().c_str(), + t2->GetLocalGenerator()->GetCurrentBinaryDirectory().c_str()) < 0; } return nameResult < 0; } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 4060269..bbebb90 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -64,8 +64,8 @@ bool cmTarget::StrictTargetComparison::operator()(cmTarget const* t1, { int nameResult = strcmp(t1->GetName().c_str(), t2->GetName().c_str()); if (nameResult == 0) { - return strcmp(t1->GetMakefile()->GetCurrentBinaryDirectory(), - t2->GetMakefile()->GetCurrentBinaryDirectory()) < 0; + return strcmp(t1->GetMakefile()->GetCurrentBinaryDirectory().c_str(), + t2->GetMakefile()->GetCurrentBinaryDirectory().c_str()) < 0; } return nameResult < 0; } diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 677a340..0c80910 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -1011,8 +1011,7 @@ void cmGlobalNinjaGenerator::AppendTargetDepends( std::set<std::string> const& utils = target->GetUtilities(); for (std::string const& util : utils) { std::string d = - target->GetLocalGenerator()->GetCurrentBinaryDirectory() + - std::string("/") + util; + target->GetLocalGenerator()->GetCurrentBinaryDirectory() + "/" + util; outputs.push_back(this->ConvertToNinjaPath(d)); } } else { diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index a5709d5..5ea323a 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -1014,7 +1014,7 @@ void cmGlobalVisualStudio10Generator::PathTooLong(cmGeneratorTarget* target, std::string const& sfRel) { size_t len = - (strlen(target->GetLocalGenerator()->GetCurrentBinaryDirectory()) + 1 + + (target->GetLocalGenerator()->GetCurrentBinaryDirectory().length() + 1 + sfRel.length()); if (len > this->LongestSource.Length) { this->LongestSource.Length = len; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 164ffb0..7456d3c 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -762,9 +762,10 @@ public: using cmGeneratorExpressionInterpreter::Evaluate; - const char* Evaluate(const char* expression, const std::string& property) + const std::string& Evaluate(const char* expression, + const std::string& property) { - const char* processed = + const std::string& processed = this->cmGeneratorExpressionInterpreter::Evaluate(expression, property); if (this->GetCompiledGeneratorExpression() .GetHadContextSensitiveCondition()) { @@ -821,7 +822,8 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile( const std::string COMPILE_DEFINITIONS("COMPILE_DEFINITIONS"); if (const char* compile_defs = sf->GetProperty(COMPILE_DEFINITIONS)) { this->AppendDefines( - flagsBuild, genexInterpreter.Evaluate(compile_defs, COMPILE_DEFINITIONS), + flagsBuild, + genexInterpreter.Evaluate(compile_defs, COMPILE_DEFINITIONS).c_str(), true); } if (!flagsBuild.IsEmpty()) { @@ -3040,7 +3042,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( // Point Xcode at the top of the source tree. { std::string pdir = - this->RelativeToBinary(root->GetCurrentSourceDirectory()); + this->RelativeToBinary(root->GetCurrentSourceDirectory().c_str()); this->RootObject->AddAttribute("projectDirPath", this->CreateString(pdir)); this->RootObject->AddAttribute("projectRoot", this->CreateString("")); } diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx index b569b73..c9b50a3 100644 --- a/Source/cmInstallDirectoryGenerator.cxx +++ b/Source/cmInstallDirectoryGenerator.cxx @@ -73,7 +73,7 @@ void cmInstallDirectoryGenerator::GenerateScriptForConfig( cmMakefile const& mf = *this->LocalGenerator->GetMakefile(); for (std::string& d : dirs) { if (!cmSystemTools::FileIsFullPath(d)) { - d = std::string(mf.GetCurrentSourceDirectory()) + "/" + d; + d = mf.GetCurrentSourceDirectory() + "/" + d; } } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 75b7f23..532f9a9 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2528,14 +2528,14 @@ std::string const& cmLocalGenerator::GetBinaryDirectory() const return this->GetCMakeInstance()->GetHomeOutputDirectory(); } -const char* cmLocalGenerator::GetCurrentBinaryDirectory() const +std::string const& cmLocalGenerator::GetCurrentBinaryDirectory() const { - return this->StateSnapshot.GetDirectory().GetCurrentBinary().c_str(); + return this->StateSnapshot.GetDirectory().GetCurrentBinary(); } -const char* cmLocalGenerator::GetCurrentSourceDirectory() const +std::string const& cmLocalGenerator::GetCurrentSourceDirectory() const { - return this->StateSnapshot.GetDirectory().GetCurrentSource().c_str(); + return this->StateSnapshot.GetDirectory().GetCurrentSource(); } std::string cmLocalGenerator::GetTargetDirectory( diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index a00302c..27a42b3 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -296,8 +296,8 @@ public: std::string const& GetSourceDirectory() const; std::string const& GetBinaryDirectory() const; - const char* GetCurrentBinaryDirectory() const; - const char* GetCurrentSourceDirectory() const; + std::string const& GetCurrentBinaryDirectory() const; + std::string const& GetCurrentSourceDirectory() const; /** * Generate a Mac OS X application bundle Info.plist file. diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 93e515b..80f2803 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -118,7 +118,7 @@ void cmLocalVisualStudio7Generator::WriteProjectFiles() if (this->GetCurrentBinaryDirectory() != this->GetSourceDirectory()) { if (!cmSystemTools::MakeDirectory(this->GetCurrentBinaryDirectory())) { cmSystemTools::Error("Error creating directory ", - this->GetCurrentBinaryDirectory()); + this->GetCurrentBinaryDirectory().c_str()); } } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 9e14917..6127b57 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1635,14 +1635,14 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath, } } -const char* cmMakefile::GetCurrentSourceDirectory() const +const std::string& cmMakefile::GetCurrentSourceDirectory() const { - return this->StateSnapshot.GetDirectory().GetCurrentSource().c_str(); + return this->StateSnapshot.GetDirectory().GetCurrentSource(); } -const char* cmMakefile::GetCurrentBinaryDirectory() const +const std::string& cmMakefile::GetCurrentBinaryDirectory() const { - return this->StateSnapshot.GetDirectory().GetCurrentBinary().c_str(); + return this->StateSnapshot.GetDirectory().GetCurrentBinary(); } std::vector<cmTarget*> cmMakefile::GetImportedTargets() const diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 616a37f..4085e99 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -327,8 +327,8 @@ public: */ void SetArgcArgv(const std::vector<std::string>& args); - const char* GetCurrentSourceDirectory() const; - const char* GetCurrentBinaryDirectory() const; + std::string const& GetCurrentSourceDirectory() const; + std::string const& GetCurrentBinaryDirectory() const; //@} diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index b9845ba..08bb2ce 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -456,7 +456,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) // clean set just in case. exeCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), - (targetFullPath + ".manifest").c_str())); + targetFullPath + ".manifest")); #endif if (targetNameReal != targetName) { exeCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath( diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 2c565b8..2d2915c 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -635,7 +635,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( if (this->GeneratorTarget->GetType() != cmStateEnums::STATIC_LIBRARY) { libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), - (targetFullPath + ".manifest").c_str())); + targetFullPath + ".manifest")); } #endif diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 79baca6..e8cf255 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -445,7 +445,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( // Add flags from source file properties. const std::string COMPILE_FLAGS("COMPILE_FLAGS"); if (const char* cflags = source.GetProperty(COMPILE_FLAGS)) { - const char* evaluatedFlags = + const std::string& evaluatedFlags = genexInterpreter.Evaluate(cflags, COMPILE_FLAGS); this->LocalGenerator->AppendFlags(flags, evaluatedFlags); *this->FlagFileStream << "# Custom flags: " << relativeObj @@ -455,7 +455,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( const std::string COMPILE_OPTIONS("COMPILE_OPTIONS"); if (const char* coptions = source.GetProperty(COMPILE_OPTIONS)) { - const char* evaluatedOptions = + const std::string& evaluatedOptions = genexInterpreter.Evaluate(coptions, COMPILE_OPTIONS); this->LocalGenerator->AppendCompileOptions(flags, evaluatedOptions); *this->FlagFileStream << "# Custom options: " << relativeObj @@ -468,7 +468,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( const std::string INCLUDE_DIRECTORIES("INCLUDE_DIRECTORIES"); if (const char* cincludes = source.GetProperty(INCLUDE_DIRECTORIES)) { - const char* evaluatedIncludes = + const std::string& evaluatedIncludes = genexInterpreter.Evaluate(cincludes, INCLUDE_DIRECTORIES); this->LocalGenerator->AppendIncludeDirectories(includes, evaluatedIncludes, source); @@ -484,7 +484,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( // Add source-specific preprocessor definitions. const std::string COMPILE_DEFINITIONS("COMPILE_DEFINITIONS"); if (const char* compile_defs = source.GetProperty(COMPILE_DEFINITIONS)) { - const char* evaluatedDefs = + const std::string& evaluatedDefs = genexInterpreter.Evaluate(compile_defs, COMPILE_DEFINITIONS); this->LocalGenerator->AppendDefines(defines, evaluatedDefs); *this->FlagFileStream << "# Custom defines: " << relativeObj @@ -494,7 +494,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( std::string defPropName = "COMPILE_DEFINITIONS_"; defPropName += configUpper; if (const char* config_compile_defs = source.GetProperty(defPropName)) { - const char* evaluatedDefs = + const std::string& evaluatedDefs = genexInterpreter.Evaluate(config_compile_defs, COMPILE_DEFINITIONS); this->LocalGenerator->AppendDefines(defines, evaluatedDefs); *this->FlagFileStream << "# Custom defines: " << relativeObj << "_DEFINES_" diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index ee44007..305c7a6 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -35,19 +35,19 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args, srcdir += "_SOURCE_DIR"; this->Makefile->AddCacheDefinition( - bindir, this->Makefile->GetCurrentBinaryDirectory(), + bindir, this->Makefile->GetCurrentBinaryDirectory().c_str(), "Value Computed by CMake", cmStateEnums::STATIC); this->Makefile->AddCacheDefinition( - srcdir, this->Makefile->GetCurrentSourceDirectory(), + srcdir, this->Makefile->GetCurrentSourceDirectory().c_str(), "Value Computed by CMake", cmStateEnums::STATIC); bindir = "PROJECT_BINARY_DIR"; srcdir = "PROJECT_SOURCE_DIR"; - this->Makefile->AddDefinition(bindir, - this->Makefile->GetCurrentBinaryDirectory()); - this->Makefile->AddDefinition(srcdir, - this->Makefile->GetCurrentSourceDirectory()); + this->Makefile->AddDefinition( + bindir, this->Makefile->GetCurrentBinaryDirectory().c_str()); + this->Makefile->AddDefinition( + srcdir, this->Makefile->GetCurrentSourceDirectory().c_str()); this->Makefile->AddDefinition("PROJECT_NAME", projectName.c_str()); diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index db7fde6..5dd3c8b 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -231,7 +231,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets() { // Collapsed current binary directory std::string const cbd = cmSystemTools::CollapseFullPath( - "", makefile->GetCurrentBinaryDirectory()); + std::string(), makefile->GetCurrentBinaryDirectory()); // Info directory this->Dir.Info = cbd; @@ -452,7 +452,7 @@ bool cmQtAutoGenInitializer::InitUic() this->Target->GetSafeProperty("AUTOUIC_SEARCH_PATHS"); if (!usp.empty()) { cmSystemTools::ExpandListArgument(usp, this->Uic.SearchPaths); - std::string const srcDir = makefile->GetCurrentSourceDirectory(); + std::string const& srcDir = makefile->GetCurrentSourceDirectory(); for (std::string& path : this->Uic.SearchPaths) { path = cmSystemTools::CollapseFullPath(path, srcDir); } diff --git a/Source/cmSearchPath.cxx b/Source/cmSearchPath.cxx index 5b29868..5dd4413 100644 --- a/Source/cmSearchPath.cxx +++ b/Source/cmSearchPath.cxx @@ -69,7 +69,8 @@ void cmSearchPath::AddUserPath(const std::string& path) // Process them all from the current directory for (std::string const& p : outPaths) { - this->AddPathInternal(p, this->FC->Makefile->GetCurrentSourceDirectory()); + this->AddPathInternal( + p, this->FC->Makefile->GetCurrentSourceDirectory().c_str()); } } @@ -83,8 +84,8 @@ void cmSearchPath::AddCMakePath(const std::string& variable) cmSystemTools::ExpandListArgument(value, expanded); for (std::string const& p : expanded) { - this->AddPathInternal(p, - this->FC->Makefile->GetCurrentSourceDirectory()); + this->AddPathInternal( + p, this->FC->Makefile->GetCurrentSourceDirectory().c_str()); } } } @@ -107,8 +108,8 @@ void cmSearchPath::AddCMakePrefixPath(const std::string& variable) std::vector<std::string> expanded; cmSystemTools::ExpandListArgument(value, expanded); - this->AddPrefixPaths(expanded, - this->FC->Makefile->GetCurrentSourceDirectory()); + this->AddPrefixPaths( + expanded, this->FC->Makefile->GetCurrentSourceDirectory().c_str()); } } diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index f0a5e26..31101e4 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -728,7 +728,7 @@ static Json::Value DumpSourceFilesList( const std::string INCLUDE_DIRECTORIES("INCLUDE_DIRECTORIES"); if (const char* cincludes = file->GetProperty(INCLUDE_DIRECTORIES)) { - const char* evaluatedIncludes = + const std::string& evaluatedIncludes = genexInterpreter.Evaluate(cincludes, INCLUDE_DIRECTORIES); lg->AppendIncludeDirectories(includes, evaluatedIncludes, *file); @@ -769,7 +769,7 @@ static Json::Value DumpSourceFilesList( groupFileList.push_back(file->GetFullPath()); } - const std::string baseDir = target->Makefile->GetCurrentSourceDirectory(); + const std::string& baseDir = target->Makefile->GetCurrentSourceDirectory(); Json::Value result = Json::arrayValue; for (auto const& it : fileGroups) { Json::Value group = DumpSourceFileGroup(it.first, it.second, baseDir); diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 05e26ea..5d1f3f0 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -132,8 +132,8 @@ bool cmSourceFile::FindFullPath(std::string* error) cmMakefile const* mf = this->Location.GetMakefile(); const char* tryDirs[3] = { nullptr, nullptr, nullptr }; if (this->Location.DirectoryIsAmbiguous()) { - tryDirs[0] = mf->GetCurrentSourceDirectory(); - tryDirs[1] = mf->GetCurrentBinaryDirectory(); + tryDirs[0] = mf->GetCurrentSourceDirectory().c_str(); + tryDirs[1] = mf->GetCurrentBinaryDirectory().c_str(); } else { tryDirs[0] = ""; } diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx index bd8d318..15433f9 100644 --- a/Source/cmSourceFileLocation.cxx +++ b/Source/cmSourceFileLocation.cxx @@ -205,18 +205,18 @@ bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc) } } else if (this->AmbiguousDirectory) { // Compare possible directory combinations. - std::string const& srcDir = cmSystemTools::CollapseFullPath( + std::string const srcDir = cmSystemTools::CollapseFullPath( this->Directory, this->Makefile->GetCurrentSourceDirectory()); - std::string const& binDir = cmSystemTools::CollapseFullPath( + std::string const binDir = cmSystemTools::CollapseFullPath( this->Directory, this->Makefile->GetCurrentBinaryDirectory()); if (srcDir != loc.Directory && binDir != loc.Directory) { return false; } } else if (loc.AmbiguousDirectory) { // Compare possible directory combinations. - std::string const& srcDir = cmSystemTools::CollapseFullPath( + std::string const srcDir = cmSystemTools::CollapseFullPath( loc.Directory, loc.Makefile->GetCurrentSourceDirectory()); - std::string const& binDir = cmSystemTools::CollapseFullPath( + std::string const binDir = cmSystemTools::CollapseFullPath( loc.Directory, loc.Makefile->GetCurrentBinaryDirectory()); if (srcDir != this->Directory && binDir != this->Directory) { return false; diff --git a/Source/cmSubdirCommand.cxx b/Source/cmSubdirCommand.cxx index c74ca59..9d36228 100644 --- a/Source/cmSubdirCommand.cxx +++ b/Source/cmSubdirCommand.cxx @@ -30,18 +30,17 @@ bool cmSubdirCommand::InitialPass(std::vector<std::string> const& args, // if they specified a relative path then compute the full std::string srcPath = - std::string(this->Makefile->GetCurrentSourceDirectory()) + "/" + i; + this->Makefile->GetCurrentSourceDirectory() + "/" + i; if (cmSystemTools::FileIsDirectory(srcPath)) { std::string binPath = - std::string(this->Makefile->GetCurrentBinaryDirectory()) + "/" + i; + this->Makefile->GetCurrentBinaryDirectory() + "/" + i; this->Makefile->AddSubDirectory(srcPath, binPath, excludeFromAll, false); } // otherwise it is a full path else if (cmSystemTools::FileIsDirectory(i)) { // we must compute the binPath from the srcPath, we just take the last // element from the source path and use that - std::string binPath = - std::string(this->Makefile->GetCurrentBinaryDirectory()) + "/" + + std::string binPath = this->Makefile->GetCurrentBinaryDirectory() + "/" + cmSystemTools::GetFilenameName(i); this->Makefile->AddSubDirectory(i, binPath, excludeFromAll, false); } else { diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index cc5a176..cfcb31a 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1127,10 +1127,11 @@ void cmTarget::AppendBuildInterfaceIncludes() this->BuildInterfaceIncludesAppended = true; if (this->Makefile->IsOn("CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE")) { - const char* binDir = this->Makefile->GetCurrentBinaryDirectory(); - const char* srcDir = this->Makefile->GetCurrentSourceDirectory(); - const std::string dirs = std::string(binDir ? binDir : "") + - std::string(binDir ? ";" : "") + std::string(srcDir ? srcDir : ""); + std::string dirs = this->Makefile->GetCurrentBinaryDirectory(); + if (!dirs.empty()) { + dirs += ';'; + } + dirs += this->Makefile->GetCurrentSourceDirectory(); if (!dirs.empty()) { this->AppendProperty("INTERFACE_INCLUDE_DIRECTORIES", ("$<BUILD_INTERFACE:" + dirs + ">").c_str()); diff --git a/Source/cmTargetIncludeDirectoriesCommand.cxx b/Source/cmTargetIncludeDirectoriesCommand.cxx index fc546cc..af142aa 100644 --- a/Source/cmTargetIncludeDirectoriesCommand.cxx +++ b/Source/cmTargetIncludeDirectoriesCommand.cxx @@ -35,8 +35,7 @@ std::string cmTargetIncludeDirectoriesCommand::Join( { std::string dirs; std::string sep; - std::string prefix = - this->Makefile->GetCurrentSourceDirectory() + std::string("/"); + std::string prefix = this->Makefile->GetCurrentSourceDirectory() + "/"; for (std::string const& it : content) { if (cmSystemTools::FileIsFullPath(it) || cmGeneratorExpression::Find(it) == 0) { @@ -56,8 +55,7 @@ bool cmTargetIncludeDirectoriesCommand::HandleDirectContent( cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); tgt->InsertInclude(this->Join(content), lfbt, prepend); if (system) { - std::string prefix = - this->Makefile->GetCurrentSourceDirectory() + std::string("/"); + std::string prefix = this->Makefile->GetCurrentSourceDirectory() + "/"; std::set<std::string> sdirs; for (std::string const& it : content) { if (cmSystemTools::FileIsFullPath(it) || diff --git a/Source/cmTargetSourcesCommand.cxx b/Source/cmTargetSourcesCommand.cxx index c57d68b..7429053 100644 --- a/Source/cmTargetSourcesCommand.cxx +++ b/Source/cmTargetSourcesCommand.cxx @@ -2,7 +2,6 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmTargetSourcesCommand.h" -#include <cstring> #include <sstream> #include "cmAlgorithms.h" @@ -71,8 +70,8 @@ std::vector<std::string> cmTargetSourcesCommand::ConvertToAbsoluteContent( if (cmSystemTools::FileIsFullPath(src) || cmGeneratorExpression::Find(src) == 0 || (!isInterfaceContent && - strcmp(this->Makefile->GetCurrentSourceDirectory(), - tgt->GetMakefile()->GetCurrentSourceDirectory()) == 0)) { + (this->Makefile->GetCurrentSourceDirectory() == + tgt->GetMakefile()->GetCurrentSourceDirectory()))) { absoluteSrc = src; } else { changedPath = true; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 4597bc6..d9f1942 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -250,11 +250,10 @@ cmVisualStudio10TargetGenerator::cmVisualStudio10TargetGenerator( this->TargetCompileAsWinRT = false; this->IsMissingFiles = false; this->DefaultArtifactDir = - this->LocalGenerator->GetCurrentBinaryDirectory() + std::string("/") + + this->LocalGenerator->GetCurrentBinaryDirectory() + "/" + this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); - this->InSourceBuild = - (strcmp(this->Makefile->GetCurrentSourceDirectory(), - this->Makefile->GetCurrentBinaryDirectory()) == 0); + this->InSourceBuild = (this->Makefile->GetCurrentSourceDirectory() == + this->Makefile->GetCurrentBinaryDirectory()); } cmVisualStudio10TargetGenerator::~cmVisualStudio10TargetGenerator() @@ -370,7 +369,7 @@ void cmVisualStudio10TargetGenerator::Generate() path += "/"; path += this->Name; path += ProjectFileExtension; - cmGeneratedFileStream BuildFileStream(path.c_str()); + cmGeneratedFileStream BuildFileStream(path); const std::string PathToProjectFile = path; BuildFileStream.SetCopyIfDifferent(true); @@ -722,8 +721,7 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReferences(Elem& e0) if (!name.empty()) { std::string path = i.second.GetValue(); if (!cmsys::SystemTools::FileIsFullPath(path)) { - path = std::string(this->Makefile->GetCurrentSourceDirectory()) + - "/" + path; + path = this->Makefile->GetCurrentSourceDirectory() + "/" + path; } ConvertToWindowsSlash(path); this->DotNetHintReferences[""].push_back( @@ -929,8 +927,10 @@ void cmVisualStudio10TargetGenerator::WriteXamlFilesGroup(Elem& e0) e2.SetHasElements(); if (this->ProjectType == csproj && !this->InSourceBuild) { // add <Link> tag to written XAML source if necessary - const std::string srcDir = this->Makefile->GetCurrentSourceDirectory(); - const std::string binDir = this->Makefile->GetCurrentBinaryDirectory(); + const std::string& srcDir = + this->Makefile->GetCurrentSourceDirectory(); + const std::string& binDir = + this->Makefile->GetCurrentBinaryDirectory(); std::string link; if (obj.find(srcDir) == 0) { link = obj.substr(srcDir.length() + 1); @@ -1398,7 +1398,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups() path += computeProjectFileExtension(this->GeneratorTarget, *this->Configurations.begin()); path += ".filters"; - cmGeneratedFileStream fout(path.c_str()); + cmGeneratedFileStream fout(path); fout.SetCopyIfDifferent(true); char magic[] = { char(0xEF), char(0xBB), char(0xBF) }; fout.write(magic, 3); @@ -1877,7 +1877,7 @@ void cmVisualStudio10TargetGenerator::WriteSource(Elem& e2, std::string sourceRel = this->ConvertPath(sf->GetFullPath(), true); size_t const maxLen = 250; if (sf->GetCustomCommand() || - ((strlen(this->LocalGenerator->GetCurrentBinaryDirectory()) + 1 + + ((this->LocalGenerator->GetCurrentBinaryDirectory().length() + 1 + sourceRel.length()) <= maxLen)) { forceRelative = true; sourceFile = sourceRel; @@ -1886,7 +1886,7 @@ void cmVisualStudio10TargetGenerator::WriteSource(Elem& e2, } } ConvertToWindowsSlash(sourceFile); - e2.StartElement(tool.c_str()); + e2.StartElement(tool); e2.Attribute("Include", sourceFile); ToolSource toolSource = { sf, forceRelative }; @@ -4144,8 +4144,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP80(Elem& e1) // this can cause an overwrite problem if projects aren't organized in // folders std::string manifestFile = - this->LocalGenerator->GetCurrentBinaryDirectory() + - std::string("/WMAppManifest.xml"); + this->LocalGenerator->GetCurrentBinaryDirectory() + "/WMAppManifest.xml"; std::string artifactDir = this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); ConvertToWindowsSlash(artifactDir); @@ -4153,7 +4152,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP80(Elem& e1) std::string targetNameXML = cmVS10EscapeXML(this->GeneratorTarget->GetName()); - cmGeneratedFileStream fout(manifestFile.c_str()); + cmGeneratedFileStream fout(manifestFile); fout.SetCopyIfDifferent(true); /* clang-format off */ @@ -4236,7 +4235,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP81(Elem& e1) std::string targetNameXML = cmVS10EscapeXML(this->GeneratorTarget->GetName()); - cmGeneratedFileStream fout(manifestFile.c_str()); + cmGeneratedFileStream fout(manifestFile); fout.SetCopyIfDifferent(true); /* clang-format off */ @@ -4299,7 +4298,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWS80(Elem& e1) std::string targetNameXML = cmVS10EscapeXML(this->GeneratorTarget->GetName()); - cmGeneratedFileStream fout(manifestFile.c_str()); + cmGeneratedFileStream fout(manifestFile); fout.SetCopyIfDifferent(true); /* clang-format off */ @@ -4354,7 +4353,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWS81(Elem& e1) std::string targetNameXML = cmVS10EscapeXML(this->GeneratorTarget->GetName()); - cmGeneratedFileStream fout(manifestFile.c_str()); + cmGeneratedFileStream fout(manifestFile); fout.SetCopyIfDifferent(true); /* clang-format off */ @@ -4414,7 +4413,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWS10_0(Elem& e1) std::string targetNameXML = cmVS10EscapeXML(this->GeneratorTarget->GetName()); - cmGeneratedFileStream fout(manifestFile.c_str()); + cmGeneratedFileStream fout(manifestFile); fout.SetCopyIfDifferent(true); /* clang-format off */ @@ -4581,7 +4580,7 @@ void cmVisualStudio10TargetGenerator::GetCSharpSourceLink( std::string const& binaryDir = LocalGenerator->GetCurrentBinaryDirectory(); if (!cmSystemTools::IsSubDirectory(sourceFilePath, binaryDir)) { - const std::string stripFromPath = + const std::string& stripFromPath = this->Makefile->GetCurrentSourceDirectory(); if (sourceFilePath.find(stripFromPath) == 0) { if (const char* l = sf->GetProperty("VS_CSHARP_Link")) { diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 5bb1f22..1bf8f7d 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1262,10 +1262,7 @@ int cmake::ActualConfigure() this->UpdateConversionPathTable(); this->CleanupCommandsAndMacros(); - int res = 0; - if (this->GetWorkingMode() == NORMAL_MODE) { - res = this->DoPreConfigureChecks(); - } + int res = this->DoPreConfigureChecks(); if (res < 0) { return -2; } @@ -1431,11 +1428,8 @@ int cmake::ActualConfigure() "CMakeLists.txt ?"); } - // only save the cache if there were no fatal errors - if (this->GetWorkingMode() == NORMAL_MODE) { - this->State->SaveVerificationScript(this->GetHomeOutputDirectory()); - this->SaveCache(this->GetHomeOutputDirectory()); - } + this->State->SaveVerificationScript(this->GetHomeOutputDirectory()); + this->SaveCache(this->GetHomeOutputDirectory()); if (cmSystemTools::GetErrorOccuredFlag()) { return -1; } @@ -1588,7 +1582,7 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure) } int ret = this->Configure(); - if (ret || this->GetWorkingMode() != NORMAL_MODE) { + if (ret) { #if defined(CMAKE_HAVE_VS_GENERATORS) if (!this->VSSolutionFile.empty() && this->GlobalGenerator) { // CMake is running to regenerate a Visual Studio build tree @@ -1634,9 +1628,8 @@ int cmake::Generate() // Save the cache again after a successful Generate so that any internal // variables created during Generate are saved. (Specifically target GUIDs // for the Visual Studio and Xcode generators.) - if (this->GetWorkingMode() == NORMAL_MODE) { - this->SaveCache(this->GetHomeOutputDirectory()); - } + this->SaveCache(this->GetHomeOutputDirectory()); + return 0; } diff --git a/Source/cmake.h b/Source/cmake.h index 86e06df..4b4c67c 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -297,8 +297,10 @@ public: ///! this is called by generators to update the progress void UpdateProgress(const char* msg, float prog); +#if defined(CMAKE_BUILD_WITH_CMAKE) ///! Get the variable watch object cmVariableWatch* GetVariableWatch() { return this->VariableWatch; } +#endif void GetGeneratorDocumentation(std::vector<cmDocumentationEntry>&); @@ -493,8 +495,6 @@ protected: void GenerateGraphViz(const char* fileName) const; - cmVariableWatch* VariableWatch; - private: ProgressCallbackType ProgressCallback; void* ProgressCallbackClientData; @@ -525,6 +525,10 @@ private: std::string GraphVizFile; InstalledFilesMap InstalledFiles; +#if defined(CMAKE_BUILD_WITH_CMAKE) + cmVariableWatch* VariableWatch; +#endif + cmState* State; cmStateSnapshot CurrentSnapshot; cmMessenger* Messenger; diff --git a/Tests/FindPackageModeMakefileTest/foo.cpp b/Tests/FindPackageModeMakefileTest/foo.cpp index 6aea226..7cb9381 100644 --- a/Tests/FindPackageModeMakefileTest/foo.cpp +++ b/Tests/FindPackageModeMakefileTest/foo.cpp @@ -1,3 +1,5 @@ +#include "foo.h" + int foo() { return 1477; diff --git a/Tests/FindPackageModeMakefileTest/foo.h b/Tests/FindPackageModeMakefileTest/foo.h index 4ec598a..7051eda 100644 --- a/Tests/FindPackageModeMakefileTest/foo.h +++ b/Tests/FindPackageModeMakefileTest/foo.h @@ -1,6 +1,14 @@ #ifndef FOO_H #define FOO_H +#ifdef __cplusplus +extern "C" { +#endif + int foo(); +#ifdef __cplusplus +} // extern "C" +#endif + #endif diff --git a/Tests/RunCMake/Android/RunCMakeTest.cmake b/Tests/RunCMake/Android/RunCMakeTest.cmake index 2027c4f..45798ce 100644 --- a/Tests/RunCMake/Android/RunCMakeTest.cmake +++ b/Tests/RunCMake/Android/RunCMakeTest.cmake @@ -61,8 +61,12 @@ foreach(ndk IN LISTS TEST_ANDROID_NDK) list(APPEND _abis_${_version} ${_abis}) endif() endforeach() - set(_abis_ ${_abis_${_latest_gcc}}) set(_abis_clang ${_abis_${_latest_clang}}) + if(_latest_gcc) + set(_abis_ ${_abis_${_latest_gcc}}) + else() + set(_abis_ ${_abis_clang}) + endif() if(_versions MATCHES "clang") set(_versions "clang" ${_versions}) endif() @@ -132,10 +136,11 @@ foreach(ndk IN LISTS TEST_ANDROID_NDK) set(stl_types none system - gnustl_static - gnustl_shared ) + if(IS_DIRECTORY "${ndk}/sources/cxx-stl/gnu-libstdc++") + list(APPEND stl_types gnustl_static gnustl_shared) + endif() if(IS_DIRECTORY "${ndk}/sources/cxx-stl/gabi++/libs") list(APPEND stl_types gabi++_static gabi++_shared) endif() diff --git a/Tests/RunCMake/Android/common.cmake b/Tests/RunCMake/Android/common.cmake index f931be1..aaa7c89 100644 --- a/Tests/RunCMake/Android/common.cmake +++ b/Tests/RunCMake/Android/common.cmake @@ -8,7 +8,6 @@ endif() foreach(f "${CMAKE_C_ANDROID_TOOLCHAIN_PREFIX}gcc${CMAKE_C_ANDROID_TOOLCHAIN_SUFFIX}" "${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}g++${CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX}" - "${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}cpp${CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX}" "${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}ar${CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX}" "${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}ld${CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX}" ) @@ -61,10 +60,12 @@ execute_process( if(NOT _res EQUAL 0) message(SEND_ERROR "Failed to run 'gcc -dumpmachine':\n ${_res}") endif() -if(NOT _out STREQUAL "${CMAKE_C_ANDROID_TOOLCHAIN_MACHINE}") +string(REPLACE "--" "-" _out_check "${_out}") +if(NOT _out_check STREQUAL "${CMAKE_C_ANDROID_TOOLCHAIN_MACHINE}" + AND NOT (_out STREQUAL "arm--linux-android" AND CMAKE_C_ANDROID_TOOLCHAIN_MACHINE STREQUAL "arm-linux-androideabi")) message(SEND_ERROR "'gcc -dumpmachine' produced:\n" " ${_out}\n" - "which is not equal to CMAKE_C_ANDROID_TOOLCHAIN_MACHINE:\n" + "which does not match CMAKE_C_ANDROID_TOOLCHAIN_MACHINE:\n" " ${CMAKE_C_ANDROID_TOOLCHAIN_MACHINE}" ) endif() diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index b273c1e..91fed3e 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -35,4 +35,4 @@ run_cpack_test(USER_FILELIST "RPM" false "MONOLITHIC") run_cpack_test(MD5SUMS "DEB" false "MONOLITHIC;COMPONENT") run_cpack_test(CPACK_INSTALL_SCRIPT "ZIP" false "MONOLITHIC") run_cpack_test(DEB_PACKAGE_VERSION_BACK_COMPATIBILITY "DEB" false "MONOLITHIC;COMPONENT") -run_cpack_test_subtests(EXT "none;good;good_multi;bad_major;bad_minor;invalid_good;invalid_bad" "Ext" false "MONOLITHIC;COMPONENT") +run_cpack_test_subtests(EXT "none;good;good_multi;bad_major;bad_minor;invalid_good;invalid_bad;stage_and_package" "Ext" false "MONOLITHIC;COMPONENT") diff --git a/Tests/RunCMake/CPack/tests/EXT/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/EXT/ExpectedFiles.cmake index 2634111..91608c9 100644 --- a/Tests/RunCMake/CPack/tests/EXT/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/EXT/ExpectedFiles.cmake @@ -1,4 +1,5 @@ -if(RunCMake_SUBTEST_SUFFIX MATCHES "^(none|good(_multi)?|invalid_good)$") +if(RunCMake_SUBTEST_SUFFIX MATCHES "^(none|good(_multi)?|invalid_good)$" + OR RunCMake_SUBTEST_SUFFIX STREQUAL "stage_and_package") set(EXPECTED_FILES_COUNT "1") set(EXPECTED_FILE_CONTENT_1_LIST "/share;/share/cpack-test;/share/cpack-test/f1.txt;/share/cpack-test/f2.txt;/share/cpack-test/f3.txt;/share/cpack-test/f4.txt") else() diff --git a/Tests/RunCMake/CPack/tests/EXT/create_package.cmake b/Tests/RunCMake/CPack/tests/EXT/create_package.cmake new file mode 100644 index 0000000..e308ccb --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EXT/create_package.cmake @@ -0,0 +1,24 @@ +message("This script could run an external packaging tool") + +function(expect_variable VAR) + if(NOT ${VAR}) + message(FATAL_ERROR "${VAR} is unexpectedly not set") + endif() +endfunction() + +function(expect_file FILE) + if(NOT EXISTS "${FILE}") + message(FATAL_ERROR "${FILE} is unexpectedly missing") + endif() +endfunction() + +expect_variable(CPACK_COMPONENTS_ALL) +expect_variable(CPACK_TOPLEVEL_DIRECTORY) +expect_variable(CPACK_TEMPORARY_DIRECTORY) +expect_variable(CPACK_PACKAGE_DIRECTORY) +expect_variable(CPACK_PACKAGE_FILE_NAME) + +expect_file(${CPACK_TEMPORARY_DIRECTORY}/f1/share/cpack-test/f1.txt) +expect_file(${CPACK_TEMPORARY_DIRECTORY}/f2/share/cpack-test/f2.txt) +expect_file(${CPACK_TEMPORARY_DIRECTORY}/f3/share/cpack-test/f3.txt) +expect_file(${CPACK_TEMPORARY_DIRECTORY}/f4/share/cpack-test/f4.txt) diff --git a/Tests/RunCMake/CPack/tests/EXT/stage_and_package-stderr.txt b/Tests/RunCMake/CPack/tests/EXT/stage_and_package-stderr.txt new file mode 100644 index 0000000..40f2743 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/EXT/stage_and_package-stderr.txt @@ -0,0 +1 @@ +^This script could run an external packaging tool$ diff --git a/Tests/RunCMake/CPack/tests/EXT/test.cmake b/Tests/RunCMake/CPack/tests/EXT/test.cmake index 6bd3cb8..976cb6a 100644 --- a/Tests/RunCMake/CPack/tests/EXT/test.cmake +++ b/Tests/RunCMake/CPack/tests/EXT/test.cmake @@ -14,6 +14,9 @@ elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "invalid_good") set(CPACK_EXT_REQUESTED_VERSIONS "1;1.0") elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "invalid_bad") set(CPACK_EXT_REQUESTED_VERSIONS "1") +elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "stage_and_package") + set(CPACK_EXT_ENABLE_STAGING 1) + set(CPACK_EXT_PACKAGE_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/create_package.cmake") endif() file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/f1.txt" test1) diff --git a/Tests/RunCMake/ctest_memcheck/DummyAddressLeakSanitizer-result.txt b/Tests/RunCMake/ctest_memcheck/DummyAddressLeakSanitizer-result.txt deleted file mode 100644 index b57e2de..0000000 --- a/Tests/RunCMake/ctest_memcheck/DummyAddressLeakSanitizer-result.txt +++ /dev/null @@ -1 +0,0 @@ -(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-result.txt b/Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-result.txt deleted file mode 100644 index b57e2de..0000000 --- a/Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-result.txt +++ /dev/null @@ -1 +0,0 @@ -(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-result.txt b/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-result.txt deleted file mode 100644 index b57e2de..0000000 --- a/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-result.txt +++ /dev/null @@ -1 +0,0 @@ -(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizerPrintDefects-result.txt b/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizerPrintDefects-result.txt deleted file mode 100644 index b57e2de..0000000 --- a/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizerPrintDefects-result.txt +++ /dev/null @@ -1 +0,0 @@ -(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-result.txt b/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-result.txt deleted file mode 100644 index b57e2de..0000000 --- a/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-result.txt +++ /dev/null @@ -1 +0,0 @@ -(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-result.txt b/Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-result.txt deleted file mode 100644 index b57e2de..0000000 --- a/Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-result.txt +++ /dev/null @@ -1 +0,0 @@ -(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-result.txt b/Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-result.txt deleted file mode 100644 index b57e2de..0000000 --- a/Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-result.txt +++ /dev/null @@ -1 +0,0 @@ -(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-result.txt b/Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-result.txt deleted file mode 100644 index b57e2de..0000000 --- a/Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-result.txt +++ /dev/null @@ -1 +0,0 @@ -(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-result.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-result.txt deleted file mode 100644 index b57e2de..0000000 --- a/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-result.txt +++ /dev/null @@ -1 +0,0 @@ -(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-result.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-result.txt deleted file mode 100644 index b57e2de..0000000 --- a/Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-result.txt +++ /dev/null @@ -1 +0,0 @@ -(-1|255) |