summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--Help/cpack_gen/external.rst54
-rw-r--r--Help/variable/CMAKE_ANDROID_STL_TYPE.rst3
-rw-r--r--Modules/Compiler/GNU.cmake8
-rw-r--r--Modules/Compiler/Intel.cmake8
-rw-r--r--Modules/Compiler/QCC.cmake8
-rw-r--r--Modules/FindLua.cmake9
-rw-r--r--Modules/Platform/Android-Common.cmake4
-rw-r--r--Modules/Platform/Android/Determine-Compiler-NDK.cmake13
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/cmCPackExtGenerator.cxx70
-rw-r--r--Source/CPack/cmCPackExtGenerator.h2
-rw-r--r--Source/CPack/cmCPackGenerator.h1
-rw-r--r--Source/cmGeneratorExpression.cxx6
-rw-r--r--Source/cmGeneratorExpression.h15
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx8
-rw-r--r--Source/cmMakefileTargetGenerator.cxx10
-rw-r--r--Source/cmServerProtocol.cxx2
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx16
-rw-r--r--Source/cmake.cxx19
-rw-r--r--Source/cmake.h8
-rw-r--r--Tests/FindPackageModeMakefileTest/foo.cpp2
-rw-r--r--Tests/FindPackageModeMakefileTest/foo.h8
-rw-r--r--Tests/RunCMake/Android/RunCMakeTest.cmake11
-rw-r--r--Tests/RunCMake/Android/common.cmake7
-rw-r--r--Tests/RunCMake/CPack/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/CPack/tests/EXT/ExpectedFiles.cmake3
-rw-r--r--Tests/RunCMake/CPack/tests/EXT/create_package.cmake24
-rw-r--r--Tests/RunCMake/CPack/tests/EXT/stage_and_package-stderr.txt1
-rw-r--r--Tests/RunCMake/CPack/tests/EXT/test.cmake3
30 files changed, 227 insertions, 102 deletions
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/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/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/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/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index e1ffe53..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()) {
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/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index 76d837a..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);
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index abd0416..d9f1942 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -369,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);
@@ -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);
@@ -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 };
@@ -4152,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 */
@@ -4235,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 */
@@ -4298,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 */
@@ -4353,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 */
@@ -4413,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 */
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)