summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/FindBoost.cmake7
-rw-r--r--Modules/FindGTK2.cmake7
-rw-r--r--Modules/FindX11.cmake2
-rw-r--r--Modules/UseJava.cmake7
-rw-r--r--Source/CMakeLists.txt9
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmBootstrapCommands1.cxx91
-rw-r--r--Source/cmBootstrapCommands2.cxx (renamed from Source/cmBootstrapCommands.cxx)73
-rw-r--r--Source/cmCMakeHostSystemInformationCommand.cxx126
-rw-r--r--Source/cmCMakeHostSystemInformationCommand.h102
-rw-r--r--Source/cmCommands.cxx2
-rw-r--r--Source/cmCommands.h5
-rw-r--r--Source/cmCoreTryCompile.cxx150
-rw-r--r--Source/cmDocumentVariables.cxx7
-rw-r--r--Source/cmELF.cxx7
-rw-r--r--Source/cmGetCMakePropertyCommand.cxx2
-rw-r--r--Source/cmGetPropertyCommand.cxx3
-rw-r--r--Source/cmTarget.cxx5
-rw-r--r--Source/cmTryCompileCommand.h10
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx7
-rw-r--r--Source/cmake.cxx8
-rw-r--r--Tests/CMakeTests/CMakeHostSystemInformation-BadArg1.cmake1
-rw-r--r--Tests/CMakeTests/CMakeHostSystemInformation-BadArg2.cmake1
-rw-r--r--Tests/CMakeTests/CMakeHostSystemInformation-BadArg3.cmake1
-rw-r--r--Tests/CMakeTests/CMakeHostSystemInformation-QueryList.cmake5
-rw-r--r--Tests/CMakeTests/CMakeHostSystemInformationTest.cmake.in33
-rw-r--r--Tests/CMakeTests/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/try_compile/BadSources1-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/BadSources1-stderr.txt12
-rw-r--r--Tests/RunCMake/try_compile/BadSources1.cmake1
-rw-r--r--Tests/RunCMake/try_compile/BadSources2-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/BadSources2-stderr.txt12
-rw-r--r--Tests/RunCMake/try_compile/BadSources2.cmake5
-rw-r--r--Tests/RunCMake/try_compile/NoSources-result.txt1
-rw-r--r--Tests/RunCMake/try_compile/NoSources-stderr.txt4
-rw-r--r--Tests/RunCMake/try_compile/NoSources.cmake1
-rw-r--r--Tests/RunCMake/try_compile/RunCMakeTest.cmake3
-rw-r--r--Tests/TryCompile/CMakeLists.txt18
-rw-r--r--Tests/TryCompile/fail2a.c1
-rw-r--r--Tests/TryCompile/fail2b.c1
-rw-r--r--Tests/TryCompile/pass2a.c2
-rw-r--r--Tests/TryCompile/pass2b.cxx1
-rwxr-xr-xbootstrap18
43 files changed, 602 insertions, 154 deletions
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index d1ce2f4..4cc32be 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -1020,7 +1020,12 @@ if(Boost_FOUND)
# We were unable to find some libraries, so generate a sensible
# error message that lists the libraries we were unable to find.
set(Boost_ERROR_REASON
- "${Boost_ERROR_REASON}\nThe following Boost libraries could not be found:\n")
+ "${Boost_ERROR_REASON}\nCould not find the following")
+ if(Boost_USE_STATIC_LIBS)
+ set(Boost_ERROR_REASON "${Boost_ERROR_REASON} static")
+ endif()
+ set(Boost_ERROR_REASON
+ "${Boost_ERROR_REASON} Boost libraries:\n")
foreach(COMPONENT ${_Boost_MISSING_COMPONENTS})
set(Boost_ERROR_REASON
"${Boost_ERROR_REASON} boost_${COMPONENT}\n")
diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake
index 06cf962..f398c79 100644
--- a/Modules/FindGTK2.cmake
+++ b/Modules/FindGTK2.cmake
@@ -164,6 +164,7 @@ function(_GTK2_FIND_INCLUDE_DIR _var _hdr)
cairo
cairomm-1.0
gdk-pixbuf-2.0
+ gthread-2.0
gdkmm-2.4
giomm-2.4
gtk-2.0
@@ -460,9 +461,13 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
_GTK2_FIND_INCLUDE_DIR(GTK2_PANGO_INCLUDE_DIR pango/pango.h)
_GTK2_FIND_LIBRARY (GTK2_PANGO_LIBRARY pango false true)
+ _GTK2_FIND_LIBRARY (GTK2_PANGOCAIRO_LIBRARY pangocairo false true)
+
_GTK2_FIND_INCLUDE_DIR(GTK2_GDK_PIXBUF_INCLUDE_DIR gdk-pixbuf/gdk-pixbuf.h)
_GTK2_FIND_LIBRARY (GTK2_GDK_PIXBUF_LIBRARY gdk_pixbuf false true)
+ _GTK2_FIND_LIBRARY (GTK2_GTHREAD_LIBRARY gthread false true)
+
_GTK2_FIND_LIBRARY (GTK2_GIO_LIBRARY gio false true)
_GTK2_FIND_INCLUDE_DIR(GTK2_ATK_INCLUDE_DIR atk/atk.h)
@@ -489,8 +494,6 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
_GTK2_FIND_INCLUDE_DIR(GTK2_PANGOMMCONFIG_INCLUDE_DIR pangommconfig.h)
_GTK2_FIND_LIBRARY (GTK2_PANGOMM_LIBRARY pangomm true true)
- _GTK2_FIND_LIBRARY (GTK2_PANGOCAIRO_LIBRARY pangocairo true true)
-
_GTK2_FIND_INCLUDE_DIR(GTK2_CAIROMM_INCLUDE_DIR cairomm/cairomm.h)
_GTK2_FIND_INCLUDE_DIR(GTK2_CAIROMMCONFIG_INCLUDE_DIR cairommconfig.h)
_GTK2_FIND_LIBRARY (GTK2_CAIROMM_LIBRARY cairomm true true)
diff --git a/Modules/FindX11.cmake b/Modules/FindX11.cmake
index 3cd3cef..131d979 100644
--- a/Modules/FindX11.cmake
+++ b/Modules/FindX11.cmake
@@ -68,6 +68,7 @@ if (UNIX)
/usr/openwin/include
/usr/openwin/share/include
/opt/graphics/OpenGL/include
+ /opt/X11/include
)
set(X11_LIB_SEARCH_PATH
@@ -75,6 +76,7 @@ if (UNIX)
/usr/X11R6/lib
/usr/X11R7/lib
/usr/openwin/lib
+ /opt/X11/lib
)
find_path(X11_X11_INCLUDE_PATH X11/X.h ${X11_INC_SEARCH_PATH})
diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake
index 9c23127..0242b24 100644
--- a/Modules/UseJava.cmake
+++ b/Modules/UseJava.cmake
@@ -221,6 +221,13 @@ set(_JAVA_SYMLINK_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaSymlinks.cmake)
function(add_jar _TARGET_NAME)
+ # In CMake < 2.8.12, add_jar used variables which were set prior to calling
+ # add_jar for customizing the behavior of add_jar. In order to be backwards
+ # compatible, check if any of those variables are set, and use them to
+ # initialize values of the named arguments. (Giving the corresponding named
+ # argument will override the value set here.)
+ #
+ # New features should use named arguments only.
if(DEFINED CMAKE_JAVA_TARGET_VERSION)
set(_add_jar_VERSION "${CMAKE_JAVA_TARGET_VERSION}")
endif()
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 1893167..70d4b48 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -11,7 +11,11 @@
#=============================================================================
include(CheckIncludeFile)
# Check if we can build support for ELF parsing.
-CHECK_INCLUDE_FILE("elf.h" HAVE_ELF_H)
+if(CMAKE_CXX_PLATFORM_ID MATCHES "OpenBSD")
+ CHECK_INCLUDE_FILES("stdint.h;elf_abi.h" HAVE_ELF_H)
+else()
+ CHECK_INCLUDE_FILE("elf.h" HAVE_ELF_H)
+endif()
if(HAVE_ELF_H)
set(CMAKE_USE_ELF_PARSER 1)
else()
@@ -113,7 +117,8 @@ endif()
set(SRCS
cmStandardIncludes.cxx
cmArchiveWrite.cxx
- cmBootstrapCommands.cxx
+ cmBootstrapCommands1.cxx
+ cmBootstrapCommands2.cxx
cmCacheManager.cxx
cmCacheManager.h
cmCommands.cxx
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 0b20214..7393ec2 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -2,5 +2,5 @@
set(CMake_VERSION_MAJOR 2)
set(CMake_VERSION_MINOR 8)
set(CMake_VERSION_PATCH 11)
-set(CMake_VERSION_TWEAK 20130621)
+set(CMake_VERSION_TWEAK 20130624)
#set(CMake_VERSION_RC 1)
diff --git a/Source/cmBootstrapCommands1.cxx b/Source/cmBootstrapCommands1.cxx
new file mode 100644
index 0000000..9093579
--- /dev/null
+++ b/Source/cmBootstrapCommands1.cxx
@@ -0,0 +1,91 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+// This file is used to compile all the commands
+// that CMake knows about at compile time.
+// This is sort of a boot strapping approach since you would
+// like to have CMake to build CMake.
+#include "cmCommands.h"
+#include "cmAddCustomCommandCommand.cxx"
+#include "cmAddCustomTargetCommand.cxx"
+#include "cmAddDefinitionsCommand.cxx"
+#include "cmAddDependenciesCommand.cxx"
+#include "cmAddExecutableCommand.cxx"
+#include "cmAddLibraryCommand.cxx"
+#include "cmAddSubDirectoryCommand.cxx"
+#include "cmAddTestCommand.cxx"
+#include "cmBreakCommand.cxx"
+#include "cmBuildCommand.cxx"
+#include "cmCMakeMinimumRequired.cxx"
+#include "cmCMakePolicyCommand.cxx"
+#include "cmCommandArgumentsHelper.cxx"
+#include "cmConfigureFileCommand.cxx"
+#include "cmCoreTryCompile.cxx"
+#include "cmCreateTestSourceList.cxx"
+#include "cmDefinePropertyCommand.cxx"
+#include "cmElseCommand.cxx"
+#include "cmEnableLanguageCommand.cxx"
+#include "cmEnableTestingCommand.cxx"
+#include "cmEndForEachCommand.cxx"
+#include "cmEndFunctionCommand.cxx"
+#include "cmEndIfCommand.cxx"
+#include "cmEndMacroCommand.cxx"
+#include "cmEndWhileCommand.cxx"
+#include "cmExecProgramCommand.cxx"
+#include "cmExecuteProcessCommand.cxx"
+#include "cmExternalMakefileProjectGenerator.cxx"
+#include "cmFindBase.cxx"
+#include "cmFindCommon.cxx"
+#include "cmFileCommand.cxx"
+#include "cmFindFileCommand.cxx"
+#include "cmFindLibraryCommand.cxx"
+#include "cmFindPackageCommand.cxx"
+#include "cmFindPathCommand.cxx"
+#include "cmFindProgramCommand.cxx"
+#include "cmForEachCommand.cxx"
+#include "cmFunctionCommand.cxx"
+
+void GetBootstrapCommands1(std::list<cmCommand*>& commands)
+{
+ commands.push_back(new cmAddCustomCommandCommand);
+ commands.push_back(new cmAddCustomTargetCommand);
+ commands.push_back(new cmAddDefinitionsCommand);
+ commands.push_back(new cmAddDependenciesCommand);
+ commands.push_back(new cmAddExecutableCommand);
+ commands.push_back(new cmAddLibraryCommand);
+ commands.push_back(new cmAddSubDirectoryCommand);
+ commands.push_back(new cmAddTestCommand);
+ commands.push_back(new cmBreakCommand);
+ commands.push_back(new cmBuildCommand);
+ commands.push_back(new cmCMakeMinimumRequired);
+ commands.push_back(new cmCMakePolicyCommand);
+ commands.push_back(new cmConfigureFileCommand);
+ commands.push_back(new cmCreateTestSourceList);
+ commands.push_back(new cmDefinePropertyCommand);
+ commands.push_back(new cmElseCommand);
+ commands.push_back(new cmEnableLanguageCommand);
+ commands.push_back(new cmEnableTestingCommand);
+ commands.push_back(new cmEndForEachCommand);
+ commands.push_back(new cmEndFunctionCommand);
+ commands.push_back(new cmEndIfCommand);
+ commands.push_back(new cmEndMacroCommand);
+ commands.push_back(new cmEndWhileCommand);
+ commands.push_back(new cmExecProgramCommand);
+ commands.push_back(new cmExecuteProcessCommand);
+ commands.push_back(new cmFileCommand);
+ commands.push_back(new cmFindFileCommand);
+ commands.push_back(new cmFindLibraryCommand);
+ commands.push_back(new cmFindPackageCommand);
+ commands.push_back(new cmFindPathCommand);
+ commands.push_back(new cmFindProgramCommand);
+ commands.push_back(new cmForEachCommand);
+ commands.push_back(new cmFunctionCommand);
+}
diff --git a/Source/cmBootstrapCommands.cxx b/Source/cmBootstrapCommands2.cxx
index 1b7a751..be72526 100644
--- a/Source/cmBootstrapCommands.cxx
+++ b/Source/cmBootstrapCommands2.cxx
@@ -14,44 +14,6 @@
// This is sort of a boot strapping approach since you would
// like to have CMake to build CMake.
#include "cmCommands.h"
-#include "cmAddCustomCommandCommand.cxx"
-#include "cmAddCustomTargetCommand.cxx"
-#include "cmAddDefinitionsCommand.cxx"
-#include "cmAddDependenciesCommand.cxx"
-#include "cmAddExecutableCommand.cxx"
-#include "cmAddLibraryCommand.cxx"
-#include "cmAddSubDirectoryCommand.cxx"
-#include "cmAddTestCommand.cxx"
-#include "cmBreakCommand.cxx"
-#include "cmBuildCommand.cxx"
-#include "cmCMakeMinimumRequired.cxx"
-#include "cmCMakePolicyCommand.cxx"
-#include "cmCommandArgumentsHelper.cxx"
-#include "cmConfigureFileCommand.cxx"
-#include "cmCoreTryCompile.cxx"
-#include "cmCreateTestSourceList.cxx"
-#include "cmDefinePropertyCommand.cxx"
-#include "cmElseCommand.cxx"
-#include "cmEnableLanguageCommand.cxx"
-#include "cmEnableTestingCommand.cxx"
-#include "cmEndForEachCommand.cxx"
-#include "cmEndFunctionCommand.cxx"
-#include "cmEndIfCommand.cxx"
-#include "cmEndMacroCommand.cxx"
-#include "cmEndWhileCommand.cxx"
-#include "cmExecProgramCommand.cxx"
-#include "cmExecuteProcessCommand.cxx"
-#include "cmExternalMakefileProjectGenerator.cxx"
-#include "cmFindBase.cxx"
-#include "cmFindCommon.cxx"
-#include "cmFileCommand.cxx"
-#include "cmFindFileCommand.cxx"
-#include "cmFindLibraryCommand.cxx"
-#include "cmFindPackageCommand.cxx"
-#include "cmFindPathCommand.cxx"
-#include "cmFindProgramCommand.cxx"
-#include "cmForEachCommand.cxx"
-#include "cmFunctionCommand.cxx"
#include "cmGeneratorExpressionEvaluationFile.cxx"
#include "cmGetCMakePropertyCommand.cxx"
#include "cmGetDirectoryPropertyCommand.cxx"
@@ -96,41 +58,8 @@
#include "cmUnsetCommand.cxx"
#include "cmWhileCommand.cxx"
-void GetBootstrapCommands(std::list<cmCommand*>& commands)
+void GetBootstrapCommands2(std::list<cmCommand*>& commands)
{
- commands.push_back(new cmAddCustomCommandCommand);
- commands.push_back(new cmAddCustomTargetCommand);
- commands.push_back(new cmAddDefinitionsCommand);
- commands.push_back(new cmAddDependenciesCommand);
- commands.push_back(new cmAddExecutableCommand);
- commands.push_back(new cmAddLibraryCommand);
- commands.push_back(new cmAddSubDirectoryCommand);
- commands.push_back(new cmAddTestCommand);
- commands.push_back(new cmBreakCommand);
- commands.push_back(new cmBuildCommand);
- commands.push_back(new cmCMakeMinimumRequired);
- commands.push_back(new cmCMakePolicyCommand);
- commands.push_back(new cmConfigureFileCommand);
- commands.push_back(new cmCreateTestSourceList);
- commands.push_back(new cmDefinePropertyCommand);
- commands.push_back(new cmElseCommand);
- commands.push_back(new cmEnableLanguageCommand);
- commands.push_back(new cmEnableTestingCommand);
- commands.push_back(new cmEndForEachCommand);
- commands.push_back(new cmEndFunctionCommand);
- commands.push_back(new cmEndIfCommand);
- commands.push_back(new cmEndMacroCommand);
- commands.push_back(new cmEndWhileCommand);
- commands.push_back(new cmExecProgramCommand);
- commands.push_back(new cmExecuteProcessCommand);
- commands.push_back(new cmFileCommand);
- commands.push_back(new cmFindFileCommand);
- commands.push_back(new cmFindLibraryCommand);
- commands.push_back(new cmFindPackageCommand);
- commands.push_back(new cmFindPathCommand);
- commands.push_back(new cmFindProgramCommand);
- commands.push_back(new cmForEachCommand);
- commands.push_back(new cmFunctionCommand);
commands.push_back(new cmGetCMakePropertyCommand);
commands.push_back(new cmGetDirectoryPropertyCommand);
commands.push_back(new cmGetFilenameComponentCommand);
diff --git a/Source/cmCMakeHostSystemInformationCommand.cxx b/Source/cmCMakeHostSystemInformationCommand.cxx
new file mode 100644
index 0000000..62f2383
--- /dev/null
+++ b/Source/cmCMakeHostSystemInformationCommand.cxx
@@ -0,0 +1,126 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2013 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#include "cmCMakeHostSystemInformationCommand.h"
+
+#include <cmsys/ios/sstream>
+
+// cmCMakeHostSystemInformation
+bool cmCMakeHostSystemInformationCommand
+::InitialPass(std::vector<std::string> const &args, cmExecutionStatus &)
+{
+ size_t current_index = 0;
+
+ if(args.size() < (current_index + 2) || args[current_index] != "RESULT")
+ {
+ this->SetError("missing RESULT specification.");
+ return false;
+ }
+
+ std::string variable = args[current_index + 1];
+ current_index += 2;
+
+ if(args.size() < (current_index + 2) || args[current_index] != "QUERY")
+ {
+ this->SetError("missing QUERY specification");
+ return false;
+ }
+
+ cmsys::SystemInformation info;
+ info.RunCPUCheck();
+ info.RunOSCheck();
+ info.RunMemoryCheck();
+
+ std::string result_list;
+ for(size_t i = current_index + 1; i < args.size(); ++i)
+ {
+ std::string key = args[i];
+ if(i != current_index + 1)
+ {
+ result_list += ";";
+ }
+ std::string value;
+ if(!this->GetValue(info, key, value)) return false;
+
+ result_list += value;
+ }
+
+ this->Makefile->AddDefinition(variable.c_str(), result_list.c_str());
+
+ return true;
+}
+
+bool cmCMakeHostSystemInformationCommand
+::GetValue(cmsys::SystemInformation &info,
+ std::string const& key, std::string &value)
+{
+ if(key == "NUMBER_OF_LOGICAL_CORES")
+ {
+ value = this->ValueToString(info.GetNumberOfLogicalCPU());
+ }
+ else if(key == "NUMBER_OF_PHYSICAL_CORES")
+ {
+ value = this->ValueToString(info.GetNumberOfPhysicalCPU());
+ }
+ else if(key == "HOSTNAME")
+ {
+ value = this->ValueToString(info.GetHostname());
+ }
+ else if(key == "FQDN")
+ {
+ value = this->ValueToString(info.GetFullyQualifiedDomainName());
+ }
+ else if(key == "TOTAL_VIRTUAL_MEMORY")
+ {
+ value = this->ValueToString(info.GetTotalVirtualMemory());
+ }
+ else if(key == "AVAILABLE_VIRTUAL_MEMORY")
+ {
+ value = this->ValueToString(info.GetAvailableVirtualMemory());
+ }
+ else if(key == "TOTAL_PHYSICAL_MEMORY")
+ {
+ value = this->ValueToString(info.GetTotalPhysicalMemory());
+ }
+ else if(key == "AVAILABLE_PHYSICAL_MEMORY")
+ {
+ value = this->ValueToString(info.GetAvailablePhysicalMemory());
+ }
+ else
+ {
+ std::string e = "does not recognize <key> " + key;
+ this->SetError(e.c_str());
+ return false;
+ }
+
+ return true;
+}
+
+std::string cmCMakeHostSystemInformationCommand
+::ValueToString(size_t value) const
+{
+ cmsys_ios::stringstream tmp;
+ tmp << value;
+ return tmp.str();
+}
+
+std::string cmCMakeHostSystemInformationCommand
+::ValueToString(const char *value) const
+{
+ std::string safe_string = value ? value : "";
+ return safe_string;
+}
+
+std::string cmCMakeHostSystemInformationCommand
+::ValueToString(std::string const& value) const
+{
+ return value;
+}
diff --git a/Source/cmCMakeHostSystemInformationCommand.h b/Source/cmCMakeHostSystemInformationCommand.h
new file mode 100644
index 0000000..d1b8700
--- /dev/null
+++ b/Source/cmCMakeHostSystemInformationCommand.h
@@ -0,0 +1,102 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2013 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef cmCMakeHostSystemInformationCommand_h
+#define cmCMakeHostSystemInformationCommand_h
+
+#include "cmCommand.h"
+
+#include <cmsys/SystemInformation.hxx>
+
+/** \class cmCMakeHostSystemInformationCommand
+ * \brief Query host system specific information
+ *
+ * cmCMakeHostSystemInformationCommand queries system information of
+ * the sytem on which CMake runs.
+ */
+class cmCMakeHostSystemInformationCommand : public cmCommand
+{
+public:
+ /**
+ * This is a virtual constructor for the command.
+ */
+ virtual cmCommand* Clone()
+ {
+ return new cmCMakeHostSystemInformationCommand;
+ }
+
+ /**
+ * This is called when the command is first encountered in
+ * the CMakeLists.txt file.
+ */
+ virtual bool InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus &status);
+
+ /**
+ * This determines if the command is invoked when in script mode.
+ */
+ virtual bool IsScriptable() const { return true; }
+
+ /**
+ * The name of the command as specified in CMakeList.txt.
+ */
+ virtual const char* GetName() const
+ {
+ return "cmake_host_system_information";
+ }
+
+ /**
+ * Succinct documentation.
+ */
+ virtual const char* GetTerseDocumentation() const
+ {
+ return "Query host system specific information.";
+ }
+
+ /**
+ * More documentation.
+ */
+ virtual const char* GetFullDocumentation() const
+ {
+ return
+ " cmake_host_system_information(RESULT <variable> QUERY <key> ...)\n"
+ "Queries system information of the host system on which cmake runs. "
+ "One or more <key> can be provided to "
+ "select the information to be queried. "
+ "The list of queried values is stored in <variable>.\n"
+ "<key> can be one of the following values:\n"
+ " NUMBER_OF_LOGICAL_CORES = Number of logical cores.\n"
+ " NUMBER_OF_PHYSICAL_CORES = Number of physical cores.\n"
+ " HOSTNAME = Hostname.\n"
+ " FQDN = Fully qualified domain name.\n"
+ " TOTAL_VIRTUAL_MEMORY = "
+ "Total virtual memory in megabytes.\n"
+ " AVAILABLE_VIRTUAL_MEMORY = "
+ "Available virtual memory in megabytes.\n"
+ " TOTAL_PHYSICAL_MEMORY = "
+ "Total physical memory in megabytes.\n"
+ " AVAILABLE_PHYSICAL_MEMORY = "
+ "Available physical memory in megabytes.\n"
+ ;
+ }
+
+ cmTypeMacro(cmCMakeHostSystemInformationCommand, cmCommand);
+
+private:
+ bool GetValue(cmsys::SystemInformation &info,
+ std::string const& key, std::string &value);
+
+ std::string ValueToString(size_t value) const;
+ std::string ValueToString(const char *value) const;
+ std::string ValueToString(std::string const& value) const;
+};
+
+#endif
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
index 3cfbf43..1e2a85c 100644
--- a/Source/cmCommands.cxx
+++ b/Source/cmCommands.cxx
@@ -14,6 +14,7 @@
#include "cmAddCompileOptionsCommand.cxx"
#include "cmAuxSourceDirectoryCommand.cxx"
#include "cmBuildNameCommand.cxx"
+#include "cmCMakeHostSystemInformationCommand.cxx"
#include "cmElseIfCommand.cxx"
#include "cmExportCommand.cxx"
#include "cmExportLibraryDependencies.cxx"
@@ -56,6 +57,7 @@ void GetPredefinedCommands(std::list<cmCommand*>&
commands.push_back(new cmAddCompileOptionsCommand);
commands.push_back(new cmAuxSourceDirectoryCommand);
commands.push_back(new cmBuildNameCommand);
+ commands.push_back(new cmCMakeHostSystemInformationCommand);
commands.push_back(new cmElseIfCommand);
commands.push_back(new cmExportCommand);
commands.push_back(new cmExportLibraryDependenciesCommand);
diff --git a/Source/cmCommands.h b/Source/cmCommands.h
index 096fc20..c56673f 100644
--- a/Source/cmCommands.h
+++ b/Source/cmCommands.h
@@ -16,12 +16,13 @@
class cmCommand;
/**
* Global function to return all compiled in commands.
- * To add a new command edit cmCommands.cxx or cmBootstrapCommands.cxx
+ * To add a new command edit cmCommands.cxx or cmBootstrapCommands[12].cxx
* and add your command.
* It is up to the caller to delete the commands created by this
* call.
*/
-void GetBootstrapCommands(std::list<cmCommand*>& commands);
+void GetBootstrapCommands1(std::list<cmCommand*>& commands);
+void GetBootstrapCommands2(std::list<cmCommand*>& commands);
void GetPredefinedCommands(std::list<cmCommand*>& commands);
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index bf28428..b43a7a7 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -38,10 +38,13 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
char targetNameBuf[64];
bool didOutputVariable = false;
bool didCopyFile = false;
+ bool useSources = argv[2] == "SOURCES";
+ std::vector<std::string> sources;
enum Doing { DoingNone, DoingCMakeFlags, DoingCompileDefinitions,
- DoingLinkLibraries, DoingOutputVariable, DoingCopyFile };
- Doing doing = DoingNone;
+ DoingLinkLibraries, DoingOutputVariable, DoingCopyFile,
+ DoingSources };
+ Doing doing = useSources? DoingSources : DoingNone;
for(size_t i=3; i < argv.size(); ++i)
{
if(argv[i] == "CMAKE_FLAGS")
@@ -118,6 +121,10 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
copyFile = argv[i].c_str();
doing = DoingNone;
}
+ else if(doing == DoingSources)
+ {
+ sources.push_back(argv[i]);
+ }
else if(i == 3)
{
this->SrcFileSignature = false;
@@ -149,6 +156,13 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
return -1;
}
+ if(useSources && sources.empty())
+ {
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR,
+ "SOURCES must be followed by at least one source file");
+ return -1;
+ }
+
// compute the binary dir when TRY_COMPILE is called with a src file
// signature
if (this->SrcFileSignature)
@@ -193,6 +207,44 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
std::string ccFile = this->BinaryDirectory + "/CMakeCache.txt";
cmSystemTools::RemoveFile(ccFile.c_str());
+ // Choose sources.
+ if(!useSources)
+ {
+ sources.push_back(argv[2]);
+ }
+
+ // Detect languages to enable.
+ cmGlobalGenerator* gg =
+ this->Makefile->GetCMakeInstance()->GetGlobalGenerator();
+ std::set<std::string> testLangs;
+ for(std::vector<std::string>::iterator si = sources.begin();
+ si != sources.end(); ++si)
+ {
+ std::string ext = cmSystemTools::GetFilenameLastExtension(*si);
+ if(const char* lang = gg->GetLanguageFromExtension(ext.c_str()))
+ {
+ testLangs.insert(lang);
+ }
+ else
+ {
+ cmOStringStream err;
+ err << "Unknown extension \"" << ext << "\" for file\n"
+ << " " << *si << "\n"
+ << "try_compile() works only for enabled languages. "
+ << "Currently these are:\n ";
+ std::vector<std::string> langs;
+ gg->GetEnabledLanguages(langs);
+ for(std::vector<std::string>::iterator l = langs.begin();
+ l != langs.end(); ++l)
+ {
+ err << " " << *l;
+ }
+ err << "\nSee project() command to enable other languages.";
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR, err.str());
+ return -1;
+ }
+ }
+
// we need to create a directory and CMakeLists file etc...
// first create the directories
sourceDirectory = this->BinaryDirectory.c_str();
@@ -209,10 +261,6 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
return -1;
}
- std::string source = argv[2];
- std::string ext = cmSystemTools::GetFilenameLastExtension(source);
- const char* lang =(this->Makefile->GetCMakeInstance()->GetGlobalGenerator()
- ->GetLanguageFromExtension(ext.c_str()));
const char* def = this->Makefile->GetDefinition("CMAKE_MODULE_PATH");
fprintf(fout, "cmake_minimum_required(VERSION %u.%u.%u.%u)\n",
cmVersion::GetMajorVersion(), cmVersion::GetMinorVersion(),
@@ -222,57 +270,39 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
fprintf(fout, "SET(CMAKE_MODULE_PATH %s)\n", def);
}
- const char* rulesOverrideBase = "CMAKE_USER_MAKE_RULES_OVERRIDE";
- std::string rulesOverrideLang =
- rulesOverrideBase + (lang ? std::string("_") + lang : std::string(""));
- if(const char* rulesOverridePath =
- this->Makefile->GetDefinition(rulesOverrideLang.c_str()))
+ std::string projectLangs;
+ for(std::set<std::string>::iterator li = testLangs.begin();
+ li != testLangs.end(); ++li)
{
- fprintf(fout, "SET(%s \"%s\")\n",
- rulesOverrideLang.c_str(), rulesOverridePath);
- }
- else if(const char* rulesOverridePath2 =
- this->Makefile->GetDefinition(rulesOverrideBase))
- {
- fprintf(fout, "SET(%s \"%s\")\n",
- rulesOverrideBase, rulesOverridePath2);
- }
-
- if(lang)
- {
- fprintf(fout, "PROJECT(CMAKE_TRY_COMPILE %s)\n", lang);
- }
- else
- {
- fclose(fout);
- cmOStringStream err;
- err << "Unknown extension \"" << ext << "\" for file\n"
- << " " << source << "\n"
- << "try_compile() works only for enabled languages. "
- << "Currently these are:\n ";
- std::vector<std::string> langs;
- this->Makefile->GetCMakeInstance()->GetGlobalGenerator()->
- GetEnabledLanguages(langs);
- for(std::vector<std::string>::iterator l = langs.begin();
- l != langs.end(); ++l)
+ projectLangs += " " + *li;
+ std::string rulesOverrideBase = "CMAKE_USER_MAKE_RULES_OVERRIDE";
+ std::string rulesOverrideLang = rulesOverrideBase + "_" + *li;
+ if(const char* rulesOverridePath =
+ this->Makefile->GetDefinition(rulesOverrideLang.c_str()))
{
- err << " " << *l;
+ fprintf(fout, "SET(%s \"%s\")\n",
+ rulesOverrideLang.c_str(), rulesOverridePath);
+ }
+ else if(const char* rulesOverridePath2 =
+ this->Makefile->GetDefinition(rulesOverrideBase.c_str()))
+ {
+ fprintf(fout, "SET(%s \"%s\")\n",
+ rulesOverrideBase.c_str(), rulesOverridePath2);
}
- err << "\nSee project() command to enable other languages.";
- this->Makefile->IssueMessage(cmake::FATAL_ERROR, err.str());
- return -1;
}
- std::string langFlags = "CMAKE_";
- langFlags += lang;
- langFlags += "_FLAGS";
+ fprintf(fout, "PROJECT(CMAKE_TRY_COMPILE%s)\n", projectLangs.c_str());
fprintf(fout, "SET(CMAKE_VERBOSE_MAKEFILE 1)\n");
- fprintf(fout, "SET(CMAKE_%s_FLAGS \"", lang);
- const char* flags = this->Makefile->GetDefinition(langFlags.c_str());
- if(flags)
+ for(std::set<std::string>::iterator li = testLangs.begin();
+ li != testLangs.end(); ++li)
{
- fprintf(fout, " %s ", flags);
+ fprintf(fout, "SET(CMAKE_%s_FLAGS \"", li->c_str());
+ std::string langFlags = "CMAKE_" + *li + "_FLAGS";
+ if(const char* flags = this->Makefile->GetDefinition(langFlags.c_str()))
+ {
+ fprintf(fout, " %s ", flags);
+ }
+ fprintf(fout, " ${COMPILE_DEFINITIONS}\")\n");
}
- fprintf(fout, " ${COMPILE_DEFINITIONS}\")\n");
fprintf(fout, "INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES})\n");
fprintf(fout, "SET(CMAKE_SUPPRESS_REGENERATION 1)\n");
fprintf(fout, "LINK_DIRECTORIES(${LINK_DIRECTORIES})\n");
@@ -357,7 +387,19 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
fprintf(fout, "SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"%s\")\n",
this->BinaryDirectory.c_str());
/* Create the actual executable. */
- fprintf(fout, "ADD_EXECUTABLE(%s \"%s\")\n", targetName, source.c_str());
+ fprintf(fout, "ADD_EXECUTABLE(%s", targetName);
+ for(std::vector<std::string>::iterator si = sources.begin();
+ si != sources.end(); ++si)
+ {
+ fprintf(fout, " \"%s\"", si->c_str());
+
+ // Add dependencies on any non-temporary sources.
+ if(si->find("CMakeTmp") == si->npos)
+ {
+ this->Makefile->AddCMakeDependFile(si->c_str());
+ }
+ }
+ fprintf(fout, ")\n");
if (useOldLinkLibs)
{
fprintf(fout,
@@ -371,12 +413,6 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
}
fclose(fout);
projectName = "CMAKE_TRY_COMPILE";
- // if the source is not in CMakeTmp
- if(source.find("CMakeTmp") == source.npos)
- {
- this->Makefile->AddCMakeDependFile(source.c_str());
- }
-
}
bool erroroc = cmSystemTools::GetErrorOccuredFlag();
diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx
index 689508f..ceaa302 100644
--- a/Source/cmDocumentVariables.cxx
+++ b/Source/cmDocumentVariables.cxx
@@ -648,6 +648,10 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"WARNING: DESTDIR may not be used on Windows because installation"
" prefix usually contains a drive letter like in \"C:/Program Files\""
" which cannot be prepended with some other prefix."
+ "\n"
+ "The installation prefix is also added to CMAKE_SYSTEM_PREFIX_PATH "
+ "so that find_package, find_program, find_library, find_path, and "
+ "find_file will search the prefix for other software."
,false,
"Variables That Change Behavior");
@@ -725,7 +729,8 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"adds /bin to each of the directories in the path, FIND_LIBRARY() "
"appends /lib to each of the directories, and FIND_PATH() and "
"FIND_FILE() append /include . By default this contains the standard "
- "directories for the current system. It is NOT intended "
+ "directories for the current system and the CMAKE_INSTALL_PREFIX. "
+ "It is NOT intended "
"to be modified by the project, use CMAKE_PREFIX_PATH for this. See also "
"CMAKE_SYSTEM_INCLUDE_PATH, CMAKE_SYSTEM_LIBRARY_PATH, "
"CMAKE_SYSTEM_PROGRAM_PATH, and CMAKE_SYSTEM_IGNORE_PATH.", false,
diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx
index 1158fc0..30de9a8 100644
--- a/Source/cmELF.cxx
+++ b/Source/cmELF.cxx
@@ -19,7 +19,12 @@
#include <cmsys/CPU.h>
// Include the ELF format information system header.
-#include <elf.h>
+#if defined(__OpenBSD__)
+# include <stdint.h>
+# include <elf_abi.h>
+#else
+# include <elf.h>
+#endif
#if defined(__sun)
# include <sys/link.h> // For dynamic section information
#endif
diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx
index 8bb5487..e7ad91a 100644
--- a/Source/cmGetCMakePropertyCommand.cxx
+++ b/Source/cmGetCMakePropertyCommand.cxx
@@ -11,6 +11,8 @@
============================================================================*/
#include "cmGetCMakePropertyCommand.h"
+#include "cmGlobalGenerator.h"
+#include "cmLocalGenerator.h"
#include "cmake.h"
// cmGetCMakePropertyCommand
diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx
index 7d33358..985dc50 100644
--- a/Source/cmGetPropertyCommand.cxx
+++ b/Source/cmGetPropertyCommand.cxx
@@ -13,6 +13,9 @@
#include "cmake.h"
#include "cmTest.h"
+#include "cmGlobalGenerator.h"
+#include "cmLocalGenerator.h"
+#include "cmSourceFile.h"
#include "cmPropertyDefinition.h"
//----------------------------------------------------------------------------
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 7d25b91..b14db43 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1403,6 +1403,11 @@ void cmTarget::DefineProperties(cmake *cm)
"Sets the \"RootNamespace\" attribute for a generated Visual Studio "
"project. The attribute will be generated only if this is set.");
cm->DefineProperty
+ ("VS_DOTNET_TARGET_FRAMEWORK_VERSION", cmProperty::TARGET,
+ "Specify the .NET target framework version.",
+ "Used to specify the .NET target framework version for C++/CLI. "
+ "For example, \"v4.5\".");
+ cm->DefineProperty
("VS_DOTNET_REFERENCES", cmProperty::TARGET,
"Visual Studio managed project .NET references",
"Adds one or more semicolon-delimited .NET references to a "
diff --git a/Source/cmTryCompileCommand.h b/Source/cmTryCompileCommand.h
index 6caa130..163756d 100644
--- a/Source/cmTryCompileCommand.h
+++ b/Source/cmTryCompileCommand.h
@@ -64,16 +64,16 @@ public:
"Specify targetName to build a specific target instead of the 'all' or "
"'ALL_BUILD' target."
"\n"
- " try_compile(RESULT_VAR <bindir> <srcfile>\n"
+ " try_compile(RESULT_VAR <bindir> <srcfile|SOURCES srcfile...>\n"
" [CMAKE_FLAGS flags...]\n"
" [COMPILE_DEFINITIONS flags...]\n"
" [LINK_LIBRARIES libs...]\n"
" [OUTPUT_VARIABLE <var>]\n"
" [COPY_FILE <fileName>])\n"
- "Try building a source file into an executable. "
- "In this form the user need only supply a source file that defines "
- "a 'main'. "
- "CMake will create a CMakeLists.txt file to build the source "
+ "Try building an executable from one or more source files. "
+ "In this form the user need only supply one or more source files "
+ "that include a definition for 'main'. "
+ "CMake will create a CMakeLists.txt file to build the source(s) "
"as an executable. "
"Specify COPY_FILE to get a copy of the linked executable at the "
"given fileName."
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index f8de3a8..2c9ec8e 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -280,6 +280,13 @@ void cmVisualStudio10TargetGenerator::Generate()
}
this->WriteString("<ProjectName>", 2);
(*this->BuildFileStream) << projLabel << "</ProjectName>\n";
+ if(const char* targetFrameworkVersion = this->Target->GetProperty(
+ "VS_DOTNET_TARGET_FRAMEWORK_VERSION"))
+ {
+ this->WriteString("<TargetFrameworkVersion>", 2);
+ (*this->BuildFileStream) << targetFrameworkVersion
+ << "</TargetFrameworkVersion>\n";
+ }
this->WriteString("</PropertyGroup>\n", 1);
this->WriteString("<Import Project="
"\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n",
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index e757f3a..e500a27 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -1168,9 +1168,8 @@ void CMakeCommandUsage(const char* program)
<< " remove_directory dir - remove a directory and its contents\n"
<< " rename oldname newname - rename a file or directory "
"(on one volume)\n"
- << " tar [cxt][vfz][cvfj] file.tar "
- "file/dir1 file/dir2 ... - create a tar "
- "archive\n"
+ << " tar [cxt][vfz][cvfj] file.tar [file/dir1 file/dir2 ...]\n"
+ << " - create or extract a tar or zip archive\n"
<< " time command [args] ... - run command and return elapsed time\n"
<< " touch file - touch a file.\n"
<< " touch_nocreate file - touch a file but do not create it.\n"
@@ -2642,7 +2641,8 @@ const char* cmake::GetCacheDefinition(const char* name) const
void cmake::AddDefaultCommands()
{
std::list<cmCommand*> commands;
- GetBootstrapCommands(commands);
+ GetBootstrapCommands1(commands);
+ GetBootstrapCommands2(commands);
GetPredefinedCommands(commands);
for(std::list<cmCommand*>::iterator i = commands.begin();
i != commands.end(); ++i)
diff --git a/Tests/CMakeTests/CMakeHostSystemInformation-BadArg1.cmake b/Tests/CMakeTests/CMakeHostSystemInformation-BadArg1.cmake
new file mode 100644
index 0000000..1655eb4
--- /dev/null
+++ b/Tests/CMakeTests/CMakeHostSystemInformation-BadArg1.cmake
@@ -0,0 +1 @@
+cmake_host_system_information(HOSTNAME)
diff --git a/Tests/CMakeTests/CMakeHostSystemInformation-BadArg2.cmake b/Tests/CMakeTests/CMakeHostSystemInformation-BadArg2.cmake
new file mode 100644
index 0000000..1f056d5
--- /dev/null
+++ b/Tests/CMakeTests/CMakeHostSystemInformation-BadArg2.cmake
@@ -0,0 +1 @@
+cmake_host_system_information(RESULT FQDN HOSTNAME)
diff --git a/Tests/CMakeTests/CMakeHostSystemInformation-BadArg3.cmake b/Tests/CMakeTests/CMakeHostSystemInformation-BadArg3.cmake
new file mode 100644
index 0000000..9c5a558
--- /dev/null
+++ b/Tests/CMakeTests/CMakeHostSystemInformation-BadArg3.cmake
@@ -0,0 +1 @@
+cmake_host_system_information(RESULT RESULT QUERY FOOBAR)
diff --git a/Tests/CMakeTests/CMakeHostSystemInformation-QueryList.cmake b/Tests/CMakeTests/CMakeHostSystemInformation-QueryList.cmake
new file mode 100644
index 0000000..1c3156d
--- /dev/null
+++ b/Tests/CMakeTests/CMakeHostSystemInformation-QueryList.cmake
@@ -0,0 +1,5 @@
+cmake_host_system_information(RESULT RESULT
+ QUERY NUMBER_OF_LOGICAL_CORES NUMBER_OF_PHYSICAL_CORES
+)
+
+message("[${RESULT}]")
diff --git a/Tests/CMakeTests/CMakeHostSystemInformationTest.cmake.in b/Tests/CMakeTests/CMakeHostSystemInformationTest.cmake.in
new file mode 100644
index 0000000..3294a2f
--- /dev/null
+++ b/Tests/CMakeTests/CMakeHostSystemInformationTest.cmake.in
@@ -0,0 +1,33 @@
+set(BadArg1-RESULT 1)
+set(BadArg1-STDERR "missing RESULT specification")
+set(BadArg2-RESULT 1)
+set(BadArg2-STDERR "missing QUERY specification")
+set(BadArg3-RESULT 1)
+set(BadArg3-STDERR "does not recognize <key> FOOBAR")
+set(QueryList-RESULT 0)
+set(QueryList-STDERR "\\[[0-9]+;[0-9]+\\]")
+
+function(try_and_print key)
+ cmake_host_system_information(RESULT RESULT QUERY ${key})
+ message(STATUS "[${key}] [${RESULT}]")
+endfunction()
+
+message("CTEST_FULL_OUTPUT (Avoid ctest truncation of output)")
+
+try_and_print(NUMBER_OF_LOGICAL_CORES)
+try_and_print(NUMBER_OF_PHYSICAL_CORES)
+try_and_print(HOSTNAME)
+try_and_print(FQDN)
+try_and_print(TOTAL_VIRTUAL_MEMORY)
+try_and_print(AVAILABLE_VIRTUAL_MEMORY)
+try_and_print(TOTAL_PHYSICAL_MEMORY)
+try_and_print(AVAILABLE_PHYSICAL_MEMORY)
+
+include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake")
+
+check_cmake_test(CMakeHostSystemInformation
+ BadArg1
+ BadArg2
+ BadArg3
+ QueryList
+)
diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt
index b049995..344b772 100644
--- a/Tests/CMakeTests/CMakeLists.txt
+++ b/Tests/CMakeTests/CMakeLists.txt
@@ -32,6 +32,7 @@ AddCMakeTest(CompilerIdVendor "")
AddCMakeTest(ProcessorCount "-DKWSYS_TEST_EXE=$<TARGET_FILE:cmsysTestsCxx>")
AddCMakeTest(PushCheckState "")
AddCMakeTest(While "")
+AddCMakeTest(CMakeHostSystemInformation "")
AddCMakeTest(FileDownload "")
set_property(TEST CMake.FileDownload PROPERTY
diff --git a/Tests/RunCMake/try_compile/BadSources1-result.txt b/Tests/RunCMake/try_compile/BadSources1-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/try_compile/BadSources1-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_compile/BadSources1-stderr.txt b/Tests/RunCMake/try_compile/BadSources1-stderr.txt
new file mode 100644
index 0000000..864a294
--- /dev/null
+++ b/Tests/RunCMake/try_compile/BadSources1-stderr.txt
@@ -0,0 +1,12 @@
+CMake Error at BadSources1.cmake:1 \(try_compile\):
+ Unknown extension ".c" for file
+
+ .*/Tests/RunCMake/try_compile/src.c
+
+ try_compile\(\) works only for enabled languages. Currently these are:
+
+ NONE
+
+ See project\(\) command to enable other languages.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/BadSources1.cmake b/Tests/RunCMake/try_compile/BadSources1.cmake
new file mode 100644
index 0000000..aa4dc5e
--- /dev/null
+++ b/Tests/RunCMake/try_compile/BadSources1.cmake
@@ -0,0 +1 @@
+try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.c)
diff --git a/Tests/RunCMake/try_compile/BadSources2-result.txt b/Tests/RunCMake/try_compile/BadSources2-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/try_compile/BadSources2-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_compile/BadSources2-stderr.txt b/Tests/RunCMake/try_compile/BadSources2-stderr.txt
new file mode 100644
index 0000000..3313f99
--- /dev/null
+++ b/Tests/RunCMake/try_compile/BadSources2-stderr.txt
@@ -0,0 +1,12 @@
+CMake Error at BadSources2.cmake:2 \(try_compile\):
+ Unknown extension ".cxx" for file
+
+ .*/Tests/RunCMake/try_compile/src.cxx
+
+ try_compile\(\) works only for enabled languages. Currently these are:
+
+ C NONE( RC)?
+
+ See project\(\) command to enable other languages.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/BadSources2.cmake b/Tests/RunCMake/try_compile/BadSources2.cmake
new file mode 100644
index 0000000..ed2b036
--- /dev/null
+++ b/Tests/RunCMake/try_compile/BadSources2.cmake
@@ -0,0 +1,5 @@
+enable_language(C)
+try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR}
+ SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/src.cxx
+ )
diff --git a/Tests/RunCMake/try_compile/NoSources-result.txt b/Tests/RunCMake/try_compile/NoSources-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/try_compile/NoSources-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/try_compile/NoSources-stderr.txt b/Tests/RunCMake/try_compile/NoSources-stderr.txt
new file mode 100644
index 0000000..023032b
--- /dev/null
+++ b/Tests/RunCMake/try_compile/NoSources-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at NoSources.cmake:1 \(try_compile\):
+ SOURCES must be followed by at least one source file
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/try_compile/NoSources.cmake b/Tests/RunCMake/try_compile/NoSources.cmake
new file mode 100644
index 0000000..8a73af4
--- /dev/null
+++ b/Tests/RunCMake/try_compile/NoSources.cmake
@@ -0,0 +1 @@
+try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} SOURCES)
diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
index 31643cf..3494695 100644
--- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake
+++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
@@ -7,6 +7,9 @@ run_cmake(NoCopyFile)
run_cmake(NoCopyFile2)
run_cmake(NoOutputVariable)
run_cmake(NoOutputVariable2)
+run_cmake(NoSources)
run_cmake(BadLinkLibraries)
+run_cmake(BadSources1)
+run_cmake(BadSources2)
run_cmake(NonSourceCopyFile)
run_cmake(NonSourceCompileDefinitions)
diff --git a/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt
index b6b66d8..4540fd0 100644
--- a/Tests/TryCompile/CMakeLists.txt
+++ b/Tests/TryCompile/CMakeLists.txt
@@ -71,6 +71,24 @@ if(SHOULD_FAIL)
message(SEND_ERROR "Should fail passed ${TRY_OUT}")
endif()
+# try to compile two files that should compile
+try_compile(SHOULD_PASS
+ ${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
+ SOURCES ${TryCompile_SOURCE_DIR}/pass2a.c ${TryCompile_SOURCE_DIR}/pass2b.cxx
+ OUTPUT_VARIABLE TRY_OUT)
+if(NOT SHOULD_PASS)
+ message(SEND_ERROR "should pass failed ${TRY_OUT}")
+endif()
+
+# try to compile two files that should not compile
+try_compile(SHOULD_FAIL
+ ${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
+ SOURCES ${TryCompile_SOURCE_DIR}/fail2a.c ${TryCompile_SOURCE_DIR}/fail2b.c
+ OUTPUT_VARIABLE TRY_OUT)
+if(SHOULD_FAIL)
+ message(SEND_ERROR "Should fail passed ${TRY_OUT}")
+endif()
+
if(NOT SHOULD_FAIL)
if(SHOULD_PASS)
message("All Tests passed, ignore all previous output.")
diff --git a/Tests/TryCompile/fail2a.c b/Tests/TryCompile/fail2a.c
new file mode 100644
index 0000000..78f2de1
--- /dev/null
+++ b/Tests/TryCompile/fail2a.c
@@ -0,0 +1 @@
+int main(void) { return 0; }
diff --git a/Tests/TryCompile/fail2b.c b/Tests/TryCompile/fail2b.c
new file mode 100644
index 0000000..5ee809c
--- /dev/null
+++ b/Tests/TryCompile/fail2b.c
@@ -0,0 +1 @@
+does_not_compile
diff --git a/Tests/TryCompile/pass2a.c b/Tests/TryCompile/pass2a.c
new file mode 100644
index 0000000..bbfe6d5
--- /dev/null
+++ b/Tests/TryCompile/pass2a.c
@@ -0,0 +1,2 @@
+extern int pass2b(void);
+int main() { return pass2b(); }
diff --git a/Tests/TryCompile/pass2b.cxx b/Tests/TryCompile/pass2b.cxx
new file mode 100644
index 0000000..4c539e2
--- /dev/null
+++ b/Tests/TryCompile/pass2b.cxx
@@ -0,0 +1 @@
+extern "C" int pass2b(void) { return 0; }
diff --git a/bootstrap b/bootstrap
index 1e2d825..281c3d0 100755
--- a/bootstrap
+++ b/bootstrap
@@ -247,7 +247,8 @@ CMAKE_CXX_SOURCES="\
cmMakefileUtilityTargetGenerator \
cmOSXBundleGenerator \
cmNewLineStyle \
- cmBootstrapCommands \
+ cmBootstrapCommands1 \
+ cmBootstrapCommands2 \
cmCommands \
cmTarget \
cmTest \
@@ -1449,11 +1450,15 @@ for a in ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES} ${KWSYS_CXX_SOURCES} ${KWSYS_C_
objs="${objs} ${a}.o"
done
-# Generate dependencies for cmBootstrapCommands.cxx
-for file in `grep "#include.*cm[^.]*.cxx" "${cmake_source_dir}/Source/cmBootstrapCommands.cxx" | sed "s/.* \"\(.*\)\"/\1/"`; do
- cmBootstrapCommandsDeps="${cmBootstrapCommandsDeps} `cmake_escape "${cmake_source_dir}/Source/$file"`"
+# Generate dependencies for cmBootstrapCommands1.cxx
+for file in `grep "#include.*cm[^.]*.cxx" "${cmake_source_dir}/Source/cmBootstrapCommands1.cxx" | sed "s/.* \"\(.*\)\"/\1/"`; do
+ cmBootstrapCommands1Deps="${cmBootstrapCommands1Deps} `cmake_escape "${cmake_source_dir}/Source/$file"`"
done
-cmBootstrapCommandsDeps=`echo $cmBootstrapCommandsDeps`
+cmBootstrapCommands1Deps=`echo $cmBootstrapCommands1Deps`
+for file in `grep "#include.*cm[^.]*.cxx" "${cmake_source_dir}/Source/cmBootstrapCommands2.cxx" | sed "s/.* \"\(.*\)\"/\1/"`; do
+ cmBootstrapCommands2Deps="${cmBootstrapCommands2Deps} `cmake_escape "${cmake_source_dir}/Source/$file"`"
+done
+cmBootstrapCommands2Deps=`echo $cmBootstrapCommands2Deps`
if [ "x${cmake_ansi_cxx_flags}" != "x" ]; then
cmake_cxx_flags="${cmake_ansi_cxx_flags} ${cmake_cxx_flags}"
@@ -1486,7 +1491,8 @@ for a in ${CMAKE_CXX_SOURCES}; do
echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
done
-echo "cmBootstrapCommands.o : $cmBootstrapCommandsDeps" >> "${cmake_bootstrap_dir}/Makefile"
+echo "cmBootstrapCommands1.o : $cmBootstrapCommands1Deps" >> "${cmake_bootstrap_dir}/Makefile"
+echo "cmBootstrapCommands2.o : $cmBootstrapCommands2Deps" >> "${cmake_bootstrap_dir}/Makefile"
for a in ${CMAKE_C_SOURCES}; do
src=`cmake_escape "${cmake_source_dir}/Source/${a}.c"`
echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"