summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/CMakeCCompiler.cmake.in2
-rw-r--r--Modules/CMakeCCompilerId.c.in15
-rw-r--r--Modules/CMakeCXXCompiler.cmake.in2
-rw-r--r--Modules/CMakeCXXCompilerId.cpp.in15
-rw-r--r--Modules/CMakeCheckCompilerFlagCommonPatterns.cmake41
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake24
-rw-r--r--Modules/CMakeFindBinUtils.cmake6
-rw-r--r--Modules/CMakeFindEclipseCDT4.cmake46
-rw-r--r--Modules/CMakeGraphVizOptions.cmake2
-rw-r--r--Modules/CMakePackageConfigHelpers.cmake39
-rw-r--r--Modules/CMakePlatformId.h.in18
-rw-r--r--Modules/CheckCCompilerFlag.cmake16
-rw-r--r--Modules/CheckCXXCompilerFlag.cmake19
-rw-r--r--Modules/CheckStructHasMember.cmake35
-rw-r--r--Modules/Compiler/Clang-CXX.cmake4
-rw-r--r--Modules/Compiler/Clang.cmake20
-rw-r--r--Modules/FindGTK2.cmake5
-rw-r--r--Modules/FindLua.cmake153
-rw-r--r--Modules/FindOpenSSL.cmake2
-rw-r--r--Modules/FindPythonInterp.cmake18
-rw-r--r--Modules/FindPythonLibs.cmake10
-rw-r--r--Modules/FindwxWidgets.cmake2
-rw-r--r--Modules/FortranCInterface/Detect.cmake2
-rw-r--r--Modules/GenerateExportHeader.cmake47
-rw-r--r--Modules/Platform/Windows-Clang-C.cmake2
-rw-r--r--Modules/Platform/Windows-Clang-CXX.cmake2
-rw-r--r--Modules/Platform/Windows-Clang.cmake32
-rw-r--r--Modules/Platform/Windows-MSVC.cmake8
-rw-r--r--Modules/UseJava.cmake16
-rw-r--r--Modules/exportheader.cmake.in10
-rw-r--r--Source/CMakeLists.txt3
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/cmCPackGenerator.h9
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx34
-rw-r--r--Source/CTest/cmCTestCoverageHandler.h4
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx140
-rw-r--r--Source/CTest/cmCTestTestHandler.h15
-rw-r--r--Source/CTest/cmParsePythonCoverage.cxx113
-rw-r--r--Source/CTest/cmParsePythonCoverage.h48
-rw-r--r--Source/CursesDialog/CMakeLists.txt1
-rw-r--r--Source/CursesDialog/cmCursesCacheEntryComposite.cxx25
-rw-r--r--Source/CursesDialog/cmCursesOptionsWidget.cxx106
-rw-r--r--Source/CursesDialog/cmCursesOptionsWidget.h39
-rw-r--r--Source/QtDialog/CMakeSetupDialog.cxx9
-rw-r--r--Source/cmAddCustomCommandCommand.h4
-rw-r--r--Source/cmAddDependenciesCommand.h12
-rw-r--r--Source/cmAddLibraryCommand.cxx40
-rw-r--r--Source/cmAddLibraryCommand.h10
-rw-r--r--Source/cmAddTestCommand.h3
-rw-r--r--Source/cmCTest.cxx6
-rw-r--r--Source/cmCommandArgumentLexer.cxx4
-rw-r--r--Source/cmComputeLinkDepends.cxx7
-rw-r--r--Source/cmComputeLinkInformation.cxx5
-rw-r--r--Source/cmCoreTryCompile.cxx33
-rw-r--r--Source/cmCreateTestSourceList.h2
-rw-r--r--Source/cmDependsFortranLexer.cxx4
-rw-r--r--Source/cmDependsJavaLexer.cxx4
-rw-r--r--Source/cmDocumentGeneratorExpressions.h3
-rw-r--r--Source/cmDocumentVariables.cxx48
-rw-r--r--Source/cmDocumentation.cxx8
-rw-r--r--Source/cmDocumentation.h13
-rw-r--r--Source/cmExportBuildFileGenerator.cxx24
-rw-r--r--Source/cmExportCommand.cxx3
-rw-r--r--Source/cmExportFileGenerator.cxx19
-rw-r--r--Source/cmExportInstallFileGenerator.cxx19
-rw-r--r--Source/cmExportLibraryDependencies.cxx12
-rw-r--r--Source/cmExprLexer.cxx4
-rw-r--r--Source/cmGeneratorExpression.cxx6
-rw-r--r--Source/cmGeneratorExpression.h2
-rw-r--r--Source/cmGeneratorExpressionEvaluator.cxx35
-rw-r--r--Source/cmGlobalGenerator.cxx16
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx7
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx18
-rw-r--r--Source/cmGlobalVisualStudio6Generator.cxx4
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx4
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx27
-rw-r--r--Source/cmGlobalVisualStudio8Generator.h2
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx4
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx25
-rw-r--r--Source/cmGraphVizWriter.cxx4
-rw-r--r--Source/cmIncludeCommand.h4
-rw-r--r--Source/cmInstallCommand.cxx8
-rw-r--r--Source/cmInstallExportGenerator.cxx24
-rw-r--r--Source/cmInstallGenerator.cxx14
-rw-r--r--Source/cmInstallScriptGenerator.cxx6
-rw-r--r--Source/cmInstallTargetGenerator.cxx29
-rw-r--r--Source/cmListFileLexer.c1
-rw-r--r--Source/cmListFileLexer.in.l1
-rw-r--r--Source/cmLocalGenerator.cxx83
-rw-r--r--Source/cmLocalNinjaGenerator.cxx1
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx32
-rw-r--r--Source/cmLocalVisualStudio10Generator.cxx4
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx14
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx12
-rw-r--r--Source/cmMakefile.cxx5
-rw-r--r--Source/cmMakefileTargetGenerator.cxx31
-rw-r--r--Source/cmMarkAsAdvancedCommand.h2
-rw-r--r--Source/cmNewLineStyle.cxx2
-rw-r--r--Source/cmPolicies.cxx64
-rw-r--r--Source/cmQtAutomoc.cxx50
-rw-r--r--Source/cmScriptGenerator.cxx10
-rw-r--r--Source/cmSetTestsPropertiesCommand.h3
-rw-r--r--Source/cmTarget.cxx217
-rw-r--r--Source/cmTarget.h7
-rw-r--r--Source/cmTargetLinkLibrariesCommand.cxx14
-rw-r--r--Source/cmTargetPropCommandBase.cxx9
-rw-r--r--Source/cmTestGenerator.cxx62
-rw-r--r--Source/cmTryRunCommand.cxx4
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx8
-rw-r--r--Source/cmake.cxx1372
-rw-r--r--Source/cmake.h30
-rw-r--r--Source/cmakemain.cxx3
-rw-r--r--Source/cmcmd.cxx1374
-rw-r--r--Source/cmcmd.h54
-rw-r--r--Source/ctest.cxx7
-rw-r--r--Tests/AliasTarget/CMakeLists.txt3
-rw-r--r--Tests/CMakeLists.txt33
-rw-r--r--Tests/CMakeOnly/AllFindModules/CMakeLists.txt11
-rw-r--r--Tests/CMakeOnly/CMakeLists.txt2
-rw-r--r--Tests/CMakeOnly/CheckStructHasMember/CMakeLists.txt93
-rw-r--r--Tests/CMakeOnly/CheckStructHasMember/cm_cshm.h9
-rw-r--r--Tests/CMakeOnly/CheckStructHasMember/cm_cshm.hxx16
-rw-r--r--Tests/CMakeTests/CMakeLists.txt9
-rw-r--r--Tests/CMakeTests/PolicyCheckTest.cmake.in154
-rw-r--r--Tests/CTestTestMemcheck/CMakeLists.txt37
-rw-r--r--Tests/CompatibleInterface/CMakeLists.txt2
-rw-r--r--Tests/Contracts/Trilinos/CMakeLists.txt (renamed from Tests/Contracts/Trilinos-10-6/CMakeLists.txt)6
-rw-r--r--Tests/Contracts/Trilinos/Dashboard.cmake.in (renamed from Tests/Contracts/Trilinos-10-6/Dashboard.cmake.in)4
-rw-r--r--Tests/Contracts/Trilinos/EnvScript.cmake (renamed from Tests/Contracts/Trilinos-10-6/EnvScript.cmake)0
-rw-r--r--Tests/Contracts/Trilinos/Patch.cmake (renamed from Tests/Contracts/Trilinos-10-6/Patch.cmake)0
-rw-r--r--Tests/Contracts/Trilinos/RunTest.cmake (renamed from Tests/Contracts/Trilinos-10-6/RunTest.cmake)2
-rw-r--r--Tests/Contracts/Trilinos/ValidateBuild.cmake.in (renamed from Tests/Contracts/Trilinos-10-6/ValidateBuild.cmake.in)6
-rw-r--r--Tests/ExportImport/Export/CMakeLists.txt12
-rw-r--r--Tests/ExportImport/Export/Interface/CMakeLists.txt49
-rw-r--r--Tests/ExportImport/Export/Interface/headeronly/headeronly.h7
-rw-r--r--Tests/ExportImport/Export/Interface/sharedlib.cpp7
-rw-r--r--Tests/ExportImport/Export/Interface/sharedlib/sharedlib.h7
-rw-r--r--Tests/ExportImport/Export/systemlib.cpp7
-rw-r--r--Tests/ExportImport/Export/systemlib.h22
-rw-r--r--Tests/ExportImport/Import/A/CMakeLists.txt47
-rw-r--r--Tests/ExportImport/Import/A/test_system.cpp9
-rw-r--r--Tests/ExportImport/Import/CMakeLists.txt3
-rw-r--r--Tests/ExportImport/Import/Interface/CMakeLists.txt55
-rw-r--r--Tests/ExportImport/Import/Interface/headeronlytest.cpp17
-rw-r--r--Tests/ExportImport/Import/Interface/interfacetest.cpp20
-rw-r--r--Tests/GeneratorExpression/CMakeLists.txt37
-rw-r--r--Tests/GeneratorExpression/check-part3.cmake8
-rw-r--r--Tests/GeneratorExpression/echo.c8
-rw-r--r--Tests/GeneratorExpression/pwd.c34
-rw-r--r--Tests/InterfaceLibrary/CMakeLists.txt15
-rw-r--r--Tests/InterfaceLibrary/definetestexe.cpp9
-rw-r--r--Tests/InterfaceLibrary/libsdir/CMakeLists.txt26
-rw-r--r--Tests/InterfaceLibrary/libsdir/shareddependlib.cpp7
-rw-r--r--Tests/InterfaceLibrary/libsdir/shareddependlib/shareddependlib.h12
-rw-r--r--Tests/InterfaceLibrary/libsdir/sharedlib.cpp12
-rw-r--r--Tests/InterfaceLibrary/libsdir/sharedlib/sharedlib.h15
-rw-r--r--Tests/InterfaceLibrary/sharedlibtestexe.cpp19
-rw-r--r--Tests/MakeClean/ToClean/CMakeLists.txt12
-rw-r--r--Tests/PositionIndependentTargets/CMakeLists.txt1
-rw-r--r--Tests/PositionIndependentTargets/interface/CMakeLists.txt27
-rw-r--r--Tests/PythonCoverage/DartConfiguration.tcl.in8
-rw-r--r--Tests/PythonCoverage/coverage.xml.in35
-rw-r--r--Tests/PythonCoverage/coveragetest/foo.py8
-rw-r--r--Tests/PythonCoverage/coveragetest/test_foo.py11
-rw-r--r--Tests/QtAutomoc/CMakeLists.txt2
-rw-r--r--Tests/QtAutomoc/gadget.cpp4
-rw-r--r--Tests/QtAutomoc/gadget.h18
-rw-r--r--Tests/RunCMake/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/CheckModules/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/CheckModules/CheckStructHasMemberMissingKey-result.txt1
-rw-r--r--Tests/RunCMake/CheckModules/CheckStructHasMemberMissingKey-stderr.txt8
-rw-r--r--Tests/RunCMake/CheckModules/CheckStructHasMemberMissingKey.cmake2
-rw-r--r--Tests/RunCMake/CheckModules/CheckStructHasMemberMissingLanguage-result.txt1
-rw-r--r--Tests/RunCMake/CheckModules/CheckStructHasMemberMissingLanguage-stderr.txt8
-rw-r--r--Tests/RunCMake/CheckModules/CheckStructHasMemberMissingLanguage.cmake2
-rw-r--r--Tests/RunCMake/CheckModules/CheckStructHasMemberOk.cmake4
-rw-r--r--Tests/RunCMake/CheckModules/CheckStructHasMemberTooManyArguments-result.txt1
-rw-r--r--Tests/RunCMake/CheckModules/CheckStructHasMemberTooManyArguments-stderr.txt8
-rw-r--r--Tests/RunCMake/CheckModules/CheckStructHasMemberTooManyArguments.cmake2
-rw-r--r--Tests/RunCMake/CheckModules/CheckStructHasMemberUnknownLanguage-result.txt1
-rw-r--r--Tests/RunCMake/CheckModules/CheckStructHasMemberUnknownLanguage-stderr.txt10
-rw-r--r--Tests/RunCMake/CheckModules/CheckStructHasMemberUnknownLanguage.cmake2
-rw-r--r--Tests/RunCMake/CheckModules/CheckStructHasMemberWrongKey-result.txt1
-rw-r--r--Tests/RunCMake/CheckModules/CheckStructHasMemberWrongKey-stderr.txt8
-rw-r--r--Tests/RunCMake/CheckModules/CheckStructHasMemberWrongKey.cmake2
-rw-r--r--Tests/RunCMake/CheckModules/RunCMakeTest.cmake8
-rw-r--r--Tests/RunCMake/PositionIndependentCode/Conflict4-result.txt1
-rw-r--r--Tests/RunCMake/PositionIndependentCode/Conflict4-stderr.txt4
-rw-r--r--Tests/RunCMake/PositionIndependentCode/Conflict4.cmake8
-rw-r--r--Tests/RunCMake/PositionIndependentCode/Conflict5-result.txt1
-rw-r--r--Tests/RunCMake/PositionIndependentCode/Conflict5-stderr.txt3
-rw-r--r--Tests/RunCMake/PositionIndependentCode/Conflict5.cmake9
-rw-r--r--Tests/RunCMake/PositionIndependentCode/Conflict6-result.txt1
-rw-r--r--Tests/RunCMake/PositionIndependentCode/Conflict6-stderr.txt4
-rw-r--r--Tests/RunCMake/PositionIndependentCode/Conflict6.cmake8
-rw-r--r--Tests/RunCMake/PositionIndependentCode/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/RunCMake.cmake1
-rw-r--r--Tests/RunCMake/include_directories/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/include_directories/incomplete-genex.cmake23
-rw-r--r--Tests/RunCMake/interface_library/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/interface_library/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/interface_library/invalid_name-result.txt1
-rw-r--r--Tests/RunCMake/interface_library/invalid_name-stderr.txt15
-rw-r--r--Tests/RunCMake/interface_library/invalid_name.cmake6
-rw-r--r--Tests/RunCMake/interface_library/target_commands-result.txt1
-rw-r--r--Tests/RunCMake/interface_library/target_commands-stderr.txt47
-rw-r--r--Tests/RunCMake/interface_library/target_commands.cmake13
-rw-r--r--Utilities/cmbzip2/compress.c2
-rw-r--r--Utilities/cmcurl/multi.c2
-rw-r--r--Utilities/cmcurl/parsedate.h2
-rwxr-xr-xbootstrap1
211 files changed, 4473 insertions, 1905 deletions
diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in
index c41adc9..3e8d4ff 100644
--- a/Modules/CMakeCCompiler.cmake.in
+++ b/Modules/CMakeCCompiler.cmake.in
@@ -3,6 +3,8 @@ set(CMAKE_C_COMPILER_ARG1 "@CMAKE_C_COMPILER_ARG1@")
set(CMAKE_C_COMPILER_ID "@CMAKE_C_COMPILER_ID@")
set(CMAKE_C_COMPILER_VERSION "@CMAKE_C_COMPILER_VERSION@")
set(CMAKE_C_PLATFORM_ID "@CMAKE_C_PLATFORM_ID@")
+set(CMAKE_C_SIMULATE_ID "@CMAKE_C_SIMULATE_ID@")
+set(CMAKE_C_SIMULATE_VERSION "@CMAKE_C_SIMULATE_VERSION@")
@SET_MSVC_C_ARCHITECTURE_ID@
set(CMAKE_AR "@CMAKE_AR@")
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in
index 56c11a0..6dde1c3 100644
--- a/Modules/CMakeCCompilerId.c.in
+++ b/Modules/CMakeCCompilerId.c.in
@@ -38,6 +38,12 @@
# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
+# if defined(_MSC_VER)
+# define SIMULATE_ID "MSVC"
+ /* _MSC_VER = VVRR */
+# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
+# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
+# endif
#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)
# define COMPILER_ID "Embarcadero"
@@ -211,6 +217,9 @@
because some compilers will just produce instructions to fill the
array rather than assigning a pointer to a static array. */
char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
+#ifdef SIMULATE_ID
+char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
+#endif
@CMAKE_C_COMPILER_ID_PLATFORM_CONTENT@
@@ -228,6 +237,12 @@ int main(int argc, char* argv[])
#ifdef COMPILER_VERSION_MAJOR
require += info_version[argc];
#endif
+#ifdef SIMULATE_ID
+ require += info_simulate[argc];
+#endif
+#ifdef SIMULATE_VERSION_MAJOR
+ require += info_simulate_version[argc];
+#endif
(void)argv;
return require;
}
diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in
index 9287b81..777f007 100644
--- a/Modules/CMakeCXXCompiler.cmake.in
+++ b/Modules/CMakeCXXCompiler.cmake.in
@@ -3,6 +3,8 @@ set(CMAKE_CXX_COMPILER_ARG1 "@CMAKE_CXX_COMPILER_ARG1@")
set(CMAKE_CXX_COMPILER_ID "@CMAKE_CXX_COMPILER_ID@")
set(CMAKE_CXX_COMPILER_VERSION "@CMAKE_CXX_COMPILER_VERSION@")
set(CMAKE_CXX_PLATFORM_ID "@CMAKE_CXX_PLATFORM_ID@")
+set(CMAKE_CXX_SIMULATE_ID "@CMAKE_CXX_SIMULATE_ID@")
+set(CMAKE_CXX_SIMULATE_VERSION "@CMAKE_CXX_SIMULATE_VERSION@")
@SET_MSVC_CXX_ARCHITECTURE_ID@
set(CMAKE_AR "@CMAKE_AR@")
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in
index 2b8bf6e..3a60922 100644
--- a/Modules/CMakeCXXCompilerId.cpp.in
+++ b/Modules/CMakeCXXCompilerId.cpp.in
@@ -43,6 +43,12 @@
# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
+# if defined(_MSC_VER)
+# define SIMULATE_ID "MSVC"
+ /* _MSC_VER = VVRR */
+# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
+# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
+# endif
#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)
# define COMPILER_ID "Embarcadero"
@@ -204,6 +210,9 @@
because some compilers will just produce instructions to fill the
array rather than assigning a pointer to a static array. */
char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
+#ifdef SIMULATE_ID
+char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
+#endif
@CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT@
@@ -217,6 +226,12 @@ int main(int argc, char* argv[])
#ifdef COMPILER_VERSION_MAJOR
require += info_version[argc];
#endif
+#ifdef SIMULATE_ID
+ require += info_simulate[argc];
+#endif
+#ifdef SIMULATE_VERSION_MAJOR
+ require += info_simulate_version[argc];
+#endif
(void)argv;
return require;
}
diff --git a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake
new file mode 100644
index 0000000..9d8ba9e
--- /dev/null
+++ b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake
@@ -0,0 +1,41 @@
+
+#=============================================================================
+# Copyright 2006-2011 Kitware, Inc.
+# Copyright 2006 Alexander Neundorf <neundorf@kde.org>
+# Copyright 2011 Matthias Kretz <kretz@kde.org>
+# Copyright 2013 Rolf Eike Beer <eike@sf-mail.de>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# Do NOT include this module directly into any of your code. It is meant as
+# a library for Check*CompilerFlag.cmake modules. It's content may change in
+# any way between releases.
+
+macro (CHECK_COMPILER_FLAG_COMMON_PATTERNS _VAR)
+ set(${_VAR}
+ FAIL_REGEX "unrecognized .*option" # GNU
+ FAIL_REGEX "unknown .*option" # Clang
+ FAIL_REGEX "ignoring unknown option" # MSVC
+ FAIL_REGEX "warning D9002" # MSVC, any lang
+ FAIL_REGEX "option.*not supported" # Intel
+ FAIL_REGEX "invalid argument .*option" # Intel
+ FAIL_REGEX "ignoring option .*argument required" # Intel
+ FAIL_REGEX "[Uu]nknown option" # HP
+ FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro
+ FAIL_REGEX "command option .* is not recognized" # XL
+ FAIL_REGEX "command option .* contains an incorrect subargument" # XL
+ FAIL_REGEX "not supported in this configuration; ignored" # AIX
+ FAIL_REGEX "File with unknown suffix passed to linker" # PGI
+ FAIL_REGEX "WARNING: unknown flag:" # Open64
+ FAIL_REGEX "Incorrect command line option:" # Borland
+ FAIL_REGEX "Warning: illegal option" # SunStudio 12
+ )
+endmacro ()
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 8ca5334..de4a882 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -80,6 +80,8 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
set(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}"
PARENT_SCOPE)
set(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_${lang}_COMPILER_VERSION}" PARENT_SCOPE)
+ set(CMAKE_${lang}_SIMULATE_ID "${CMAKE_${lang}_SIMULATE_ID}" PARENT_SCOPE)
+ set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_${lang}_SIMULATE_VERSION}" PARENT_SCOPE)
endfunction()
#-----------------------------------------------------------------------------
@@ -161,7 +163,8 @@ Id flags: ${testflags}
)
# Match the compiler location line printed out.
if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "CMAKE_${lang}_COMPILER=([^%\r\n]+)[\r\n]")
- set(_comp "${CMAKE_MATCH_1}")
+ # Strip VS diagnostic output from the end of the line.
+ string(REGEX REPLACE " \\(TaskId:[0-9]*\\)$" "" _comp "${CMAKE_MATCH_1}")
if(EXISTS "${_comp}")
file(TO_CMAKE_PATH "${_comp}" _comp)
set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE)
@@ -308,9 +311,12 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
set(COMPILER_ID)
set(COMPILER_VERSION)
set(PLATFORM_ID)
+ set(ARCHITECTURE_ID)
+ set(SIMULATE_ID)
+ set(SIMULATE_VERSION)
file(STRINGS ${file}
- CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 4 REGEX "INFO:")
- set(HAVE_COMPILER_TWICE 0)
+ CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 6 REGEX "INFO:")
+ set(COMPILER_ID_TWICE)
foreach(info ${CMAKE_${lang}_COMPILER_ID_STRINGS})
if("${info}" MATCHES ".*INFO:compiler\\[([^]\"]*)\\].*")
if(COMPILER_ID)
@@ -332,6 +338,14 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
string(REGEX REPLACE "^0+([0-9])" "\\1" COMPILER_VERSION "${COMPILER_VERSION}")
string(REGEX REPLACE "\\.0+([0-9])" ".\\1" COMPILER_VERSION "${COMPILER_VERSION}")
endif()
+ if("${info}" MATCHES ".*INFO:simulate\\[([^]\"]*)\\].*")
+ set(SIMULATE_ID "${CMAKE_MATCH_1}")
+ endif()
+ if("${info}" MATCHES ".*INFO:simulate_version\\[([^]\"]*)\\].*")
+ set(SIMULATE_VERSION "${CMAKE_MATCH_1}")
+ string(REGEX REPLACE "^0+([0-9])" "\\1" SIMULATE_VERSION "${SIMULATE_VERSION}")
+ string(REGEX REPLACE "\\.0+([0-9])" ".\\1" SIMULATE_VERSION "${SIMULATE_VERSION}")
+ endif()
endforeach()
# Detect the exact architecture from the PE header.
@@ -369,6 +383,8 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
set(CMAKE_${lang}_PLATFORM_ID "${PLATFORM_ID}")
set(MSVC_${lang}_ARCHITECTURE_ID "${ARCHITECTURE_ID}")
set(CMAKE_${lang}_COMPILER_VERSION "${COMPILER_VERSION}")
+ set(CMAKE_${lang}_SIMULATE_ID "${SIMULATE_ID}")
+ set(CMAKE_${lang}_SIMULATE_VERSION "${SIMULATE_VERSION}")
endif()
# Check the compiler identification string.
@@ -417,6 +433,8 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
set(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}"
PARENT_SCOPE)
set(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_${lang}_COMPILER_VERSION}" PARENT_SCOPE)
+ set(CMAKE_${lang}_SIMULATE_ID "${CMAKE_${lang}_SIMULATE_ID}" PARENT_SCOPE)
+ set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_${lang}_SIMULATE_VERSION}" PARENT_SCOPE)
set(CMAKE_EXECUTABLE_FORMAT "${CMAKE_EXECUTABLE_FORMAT}" PARENT_SCOPE)
endfunction()
diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake
index e70c013..b4e2ae5 100644
--- a/Modules/CMakeFindBinUtils.cmake
+++ b/Modules/CMakeFindBinUtils.cmake
@@ -30,8 +30,10 @@
# License text for the above reference.)
# if it's the MS C/CXX compiler, search for link
-if("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC"
- OR "${CMAKE_C_COMPILER_ID}" MATCHES "MSVC"
+if("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC"
+ OR "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC"
+ OR "${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC"
+ OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC"
OR "${CMAKE_GENERATOR}" MATCHES "Visual Studio")
find_program(CMAKE_LINKER NAMES link HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
diff --git a/Modules/CMakeFindEclipseCDT4.cmake b/Modules/CMakeFindEclipseCDT4.cmake
index ae17454..b67e0f0 100644
--- a/Modules/CMakeFindEclipseCDT4.cmake
+++ b/Modules/CMakeFindEclipseCDT4.cmake
@@ -19,18 +19,6 @@ find_program(CMAKE_ECLIPSE_EXECUTABLE NAMES eclipse DOC "The Eclipse executable"
function(_FIND_ECLIPSE_VERSION)
# This code is in a function so the variables used here have only local scope
- if(CMAKE_ECLIPSE_EXECUTABLE)
- # use REALPATH to resolve symlinks (http://public.kitware.com/Bug/view.php?id=13036)
- get_filename_component(_REALPATH_CMAKE_ECLIPSE_EXECUTABLE "${CMAKE_ECLIPSE_EXECUTABLE}" REALPATH)
- get_filename_component(_ECLIPSE_DIR "${_REALPATH_CMAKE_ECLIPSE_EXECUTABLE}" PATH)
- file(GLOB _ECLIPSE_FEATURE_DIR "${_ECLIPSE_DIR}/features/org.eclipse.platform*")
- if(APPLE AND NOT _ECLIPSE_FEATURE_DIR)
- file(GLOB _ECLIPSE_FEATURE_DIR "${_ECLIPSE_DIR}/../../../features/org.eclipse.platform*")
- endif()
- if("${_ECLIPSE_FEATURE_DIR}" MATCHES ".+org.eclipse.platform_([0-9]+\\.[0-9]+).+")
- set(_ECLIPSE_VERSION ${CMAKE_MATCH_1})
- endif()
- endif()
# Set up a map with the names of the Eclipse releases:
set(_ECLIPSE_VERSION_NAME_ "Unknown" )
@@ -41,15 +29,34 @@ function(_FIND_ECLIPSE_VERSION)
set(_ECLIPSE_VERSION_NAME_3.6 "Helios" )
set(_ECLIPSE_VERSION_NAME_3.7 "Indigo" )
set(_ECLIPSE_VERSION_NAME_4.2 "Juno" )
+ set(_ECLIPSE_VERSION_NAME_4.3 "Kepler" )
+
+ if(NOT DEFINED CMAKE_ECLIPSE_VERSION)
+ if(CMAKE_ECLIPSE_EXECUTABLE)
+ # use REALPATH to resolve symlinks (http://public.kitware.com/Bug/view.php?id=13036)
+ get_filename_component(_REALPATH_CMAKE_ECLIPSE_EXECUTABLE "${CMAKE_ECLIPSE_EXECUTABLE}" REALPATH)
+ get_filename_component(_ECLIPSE_DIR "${_REALPATH_CMAKE_ECLIPSE_EXECUTABLE}" PATH)
+ file(GLOB _ECLIPSE_FEATURE_DIR "${_ECLIPSE_DIR}/features/org.eclipse.platform*")
+ if(APPLE AND NOT _ECLIPSE_FEATURE_DIR)
+ file(GLOB _ECLIPSE_FEATURE_DIR "${_ECLIPSE_DIR}/../../../features/org.eclipse.platform*")
+ endif()
+ if("${_ECLIPSE_FEATURE_DIR}" MATCHES ".+org.eclipse.platform_([0-9]+\\.[0-9]+).+")
+ set(_ECLIPSE_VERSION ${CMAKE_MATCH_1})
+ endif()
+ endif()
+
+ if(_ECLIPSE_VERSION)
+ message(STATUS "Found Eclipse version ${_ECLIPSE_VERSION} (${_ECLIPSE_VERSION_NAME_${_ECLIPSE_VERSION}})")
+ else()
+ set(_ECLIPSE_VERSION "3.6" )
+ message(STATUS "Could not determine Eclipse version, assuming at least ${_ECLIPSE_VERSION} (${_ECLIPSE_VERSION_NAME_${_ECLIPSE_VERSION}}). Adjust CMAKE_ECLIPSE_VERSION if this is wrong.")
+ endif()
- if(_ECLIPSE_VERSION)
- message(STATUS "Found Eclipse version ${_ECLIPSE_VERSION} (${_ECLIPSE_VERSION_NAME_${_ECLIPSE_VERSION}})")
+ set(CMAKE_ECLIPSE_VERSION "${_ECLIPSE_VERSION} (${_ECLIPSE_VERSION_NAME_${_ECLIPSE_VERSION}})" CACHE STRING "The version of Eclipse. If Eclipse has not been found, 3.6 (Helios) is assumed.")
else()
- set(_ECLIPSE_VERSION "3.6" )
- message(STATUS "Could not determine Eclipse version, assuming at least ${_ECLIPSE_VERSION} (${_ECLIPSE_VERSION_NAME_${_ECLIPSE_VERSION}}). Adjust CMAKE_ECLIPSE_VERSION if this is wrong.")
+ message(STATUS "Eclipse version is set to ${CMAKE_ECLIPSE_VERSION}. Adjust CMAKE_ECLIPSE_VERSION if this is wrong.")
endif()
- set(CMAKE_ECLIPSE_VERSION "${_ECLIPSE_VERSION} (${_ECLIPSE_VERSION_NAME_${_ECLIPSE_VERSION}})" CACHE STRING "The version of Eclipse. If Eclipse has not been found, 3.6 (Helios) is assumed.")
set_property(CACHE CMAKE_ECLIPSE_VERSION PROPERTY STRINGS "3.2 (${_ECLIPSE_VERSION_NAME_3.2})"
"3.3 (${_ECLIPSE_VERSION_NAME_3.3})"
"3.4 (${_ECLIPSE_VERSION_NAME_3.4})"
@@ -57,16 +64,17 @@ function(_FIND_ECLIPSE_VERSION)
"3.6 (${_ECLIPSE_VERSION_NAME_3.6})"
"3.7 (${_ECLIPSE_VERSION_NAME_3.7})"
"4.2 (${_ECLIPSE_VERSION_NAME_4.2})"
+ "4.3 (${_ECLIPSE_VERSION_NAME_4.3})"
)
endfunction()
-_FIND_ECLIPSE_VERSION()
+_find_eclipse_version()
# Try to find out how many CPUs we have and set the -j argument for make accordingly
set(_CMAKE_ECLIPSE_INITIAL_MAKE_ARGS "")
include(ProcessorCount)
-PROCESSORCOUNT(_CMAKE_ECLIPSE_PROCESSOR_COUNT)
+processorcount(_CMAKE_ECLIPSE_PROCESSOR_COUNT)
# Only set -j if we are under UNIX and if the make-tool used actually has "make" in the name
# (we may also get here in the future e.g. for ninja)
diff --git a/Modules/CMakeGraphVizOptions.cmake b/Modules/CMakeGraphVizOptions.cmake
index e4af54c..2f04abb 100644
--- a/Modules/CMakeGraphVizOptions.cmake
+++ b/Modules/CMakeGraphVizOptions.cmake
@@ -53,7 +53,7 @@
# Default : TRUE
##end
##variable
-# GRAPHVIZ_MODULE_LIBS - Set this to FALSE to exclude static libraries from the generated graphs.
+# GRAPHVIZ_MODULE_LIBS - Set this to FALSE to exclude module libraries from the generated graphs.
# Mandatory : NO
# Default : TRUE
##end
diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake
index d042d5e..3c56b7f 100644
--- a/Modules/CMakePackageConfigHelpers.cmake
+++ b/Modules/CMakePackageConfigHelpers.cmake
@@ -3,7 +3,8 @@
# CONFIGURE_PACKAGE_CONFIG_FILE(<input> <output> INSTALL_DESTINATION <path>
# [PATH_VARS <var1> <var2> ... <varN>]
# [NO_SET_AND_CHECK_MACRO]
-# [NO_CHECK_REQUIRED_COMPONENTS_MACRO])
+# [NO_CHECK_REQUIRED_COMPONENTS_MACRO]
+# [NO_FIND_DEPENDENCY_MACRO])
#
# CONFIGURE_PACKAGE_CONFIG_FILE() should be used instead of the plain
# configure_file() command when creating the <Name>Config.cmake or <Name>-config.cmake
@@ -154,7 +155,7 @@ endmacro()
function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile)
- set(options NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO)
+ set(options NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO NO_FIND_DEPENDENCY_MACRO)
set(oneValueArgs INSTALL_DESTINATION )
set(multiValueArgs PATH_VARS )
@@ -240,6 +241,40 @@ endmacro()
")
endif()
+ if(NOT CCF_NO_FIND_DEPENDENCY_MACRO)
+ set(PACKAGE_INIT "${PACKAGE_INIT}
+macro(find_dependency dep)
+ if (NOT \${dep}_FOUND)
+ if (\${ARGV1})
+ set(version \${ARGV1})
+ endif()
+ set(exact_arg)
+ if(\${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION_EXACT)
+ set(exact_arg EXACT)
+ endif()
+ set(quiet_arg)
+ if(\${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
+ set(quiet_arg QUIET)
+ endif()
+ set(required_arg)
+ if(\${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED)
+ set(required_arg REQUIRED)
+ endif()
+
+ find_package(\${dep} \${version} \${exact_arg} \${quiet_arg} \${required_arg})
+ if (NOT \${dep}_FOUND)
+ set(\${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE \"\${CMAKE_FIND_PACKAGE_NAME} could not be found because dependency \${dep} could not be found.\")
+ set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND False)
+ return()
+ endif()
+ set(required_arg)
+ set(quiet_arg)
+ set(exact_arg)
+ endif()
+endmacro()
+")
+ endif()
+
set(PACKAGE_INIT "${PACKAGE_INIT}
####################################################################################")
diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in
index 69171c2..1e41fec 100644
--- a/Modules/CMakePlatformId.h.in
+++ b/Modules/CMakePlatformId.h.in
@@ -151,6 +151,24 @@ char const info_version[] = {
']','\0'};
#endif
+/* Construct a string literal encoding the version number components. */
+#ifdef SIMULATE_VERSION_MAJOR
+char const info_simulate_version[] = {
+ 'I', 'N', 'F', 'O', ':',
+ 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[',
+ SIMULATE_VERSION_MAJOR,
+# ifdef SIMULATE_VERSION_MINOR
+ '.', SIMULATE_VERSION_MINOR,
+# ifdef SIMULATE_VERSION_PATCH
+ '.', SIMULATE_VERSION_PATCH,
+# ifdef SIMULATE_VERSION_TWEAK
+ '.', SIMULATE_VERSION_TWEAK,
+# endif
+# endif
+# endif
+ ']','\0'};
+#endif
+
/* Construct the string literal in pieces to prevent the source from
getting matched. Store it in a pointer rather than an array
because some compilers will just produce instructions to fill the
diff --git a/Modules/CheckCCompilerFlag.cmake b/Modules/CheckCCompilerFlag.cmake
index bc15e9a..dab5710 100644
--- a/Modules/CheckCCompilerFlag.cmake
+++ b/Modules/CheckCCompilerFlag.cmake
@@ -26,36 +26,30 @@
# License text for the above reference.)
include(CheckCSourceCompiles)
+include(CMakeCheckCompilerFlagCommonPatterns)
macro (CHECK_C_COMPILER_FLAG _FLAG _RESULT)
set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
+
# Normalize locale during test compilation.
set(_CheckCCompilerFlag_LOCALE_VARS LC_ALL LC_MESSAGES LANG)
foreach(v ${_CheckCCompilerFlag_LOCALE_VARS})
set(_CheckCCompilerFlag_SAVED_${v} "$ENV{${v}}")
set(ENV{${v}} C)
endforeach()
+ CHECK_COMPILER_FLAG_COMMON_PATTERNS(_CheckCCompilerFlag_COMMON_PATTERNS)
CHECK_C_SOURCE_COMPILES("int main(void) { return 0; }" ${_RESULT}
# Some compilers do not fail with a bad flag
FAIL_REGEX "command line option .* is valid for .* but not for C" # GNU
- FAIL_REGEX "unrecognized .*option" # GNU
- FAIL_REGEX "unknown .*option" # Clang
- FAIL_REGEX "ignoring unknown option" # MSVC
- FAIL_REGEX "warning D9002" # MSVC, any lang
- FAIL_REGEX "option.*not supported" # Intel
- FAIL_REGEX "invalid argument .*option" # Intel
- FAIL_REGEX "ignoring option .*argument required" # Intel
- FAIL_REGEX "[Uu]nknown option" # HP
- FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro
- FAIL_REGEX "command option .* is not recognized" # XL
- FAIL_REGEX "WARNING: unknown flag:" # Open64
+ ${_CheckCCompilerFlag_COMMON_PATTERNS}
)
foreach(v ${_CheckCCompilerFlag_LOCALE_VARS})
set(ENV{${v}} ${_CheckCCompilerFlag_SAVED_${v}})
unset(_CheckCCompilerFlag_SAVED_${v})
endforeach()
unset(_CheckCCompilerFlag_LOCALE_VARS)
+ unset(_CheckCCompilerFlag_COMMON_PATTERNS)
set (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
endmacro ()
diff --git a/Modules/CheckCXXCompilerFlag.cmake b/Modules/CheckCXXCompilerFlag.cmake
index eee3a70..4435a1f 100644
--- a/Modules/CheckCXXCompilerFlag.cmake
+++ b/Modules/CheckCXXCompilerFlag.cmake
@@ -26,6 +26,7 @@
# License text for the above reference.)
include(CheckCXXSourceCompiles)
+include(CMakeCheckCompilerFlagCommonPatterns)
macro (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT)
set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
@@ -37,28 +38,18 @@ macro (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT)
set(_CheckCXXCompilerFlag_SAVED_${v} "$ENV{${v}}")
set(ENV{${v}} C)
endforeach()
- CHECK_CXX_SOURCE_COMPILES("int main() { return 0;}" ${_RESULT}
+ CHECK_COMPILER_FLAG_COMMON_PATTERNS(_CheckCXXCompilerFlag_COMMON_PATTERNS)
+ CHECK_CXX_SOURCE_COMPILES("int main() { return 0; }" ${_RESULT}
# Some compilers do not fail with a bad flag
FAIL_REGEX "command line option .* is valid for .* but not for C\\\\+\\\\+" # GNU
- FAIL_REGEX "unrecognized .*option" # GNU
- FAIL_REGEX "unknown .*option" # Clang
- FAIL_REGEX "ignoring unknown option" # MSVC
- FAIL_REGEX "warning D9002" # MSVC, any lang
- FAIL_REGEX "option.*not supported" # Intel
- FAIL_REGEX "invalid argument .*option" # Intel
- FAIL_REGEX "ignoring option .*argument required" # Intel
- FAIL_REGEX "[Uu]nknown option" # HP
- FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro
- FAIL_REGEX "command option .* is not recognized" # XL
- FAIL_REGEX "not supported in this configuration; ignored" # AIX
- FAIL_REGEX "File with unknown suffix passed to linker" # PGI
- FAIL_REGEX "WARNING: unknown flag:" # Open64
+ ${_CheckCXXCompilerFlag_COMMON_PATTERNS}
)
foreach(v ${_CheckCXXCompilerFlag_LOCALE_VARS})
set(ENV{${v}} ${_CheckCXXCompilerFlag_SAVED_${v}})
unset(_CheckCXXCompilerFlag_SAVED_${v})
endforeach()
unset(_CheckCXXCompilerFlag_LOCALE_VARS)
+ unset(_CheckCXXCompilerFlag_COMMON_PATTERNS)
set (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
endmacro ()
diff --git a/Modules/CheckStructHasMember.cmake b/Modules/CheckStructHasMember.cmake
index ea2891c..d28cc2a 100644
--- a/Modules/CheckStructHasMember.cmake
+++ b/Modules/CheckStructHasMember.cmake
@@ -1,10 +1,12 @@
# - Check if the given struct or class has the specified member variable
-# CHECK_STRUCT_HAS_MEMBER (STRUCT MEMBER HEADER VARIABLE)
+# CHECK_STRUCT_HAS_MEMBER (<struct> <member> <header> <variable>
+# [LANGUAGE <language>])
#
-# STRUCT - the name of the struct or class you are interested in
-# MEMBER - the member which existence you want to check
-# HEADER - the header(s) where the prototype should be declared
-# VARIABLE - variable to store the result
+# <struct> - the name of the struct or class you are interested in
+# <member> - the member which existence you want to check
+# <header> - the header(s) where the prototype should be declared
+# <variable> - variable to store the result
+# <language> - the compiler to use (C or CXX)
#
# The following variables may be set before calling this macro to
# modify the way the check is run:
@@ -12,8 +14,9 @@
# CMAKE_REQUIRED_FLAGS = string of compile command line flags
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories
+# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
#
-# Example: CHECK_STRUCT_HAS_MEMBER("struct timeval" tv_sec sys/select.h HAVE_TIMEVAL_TV_SEC)
+# Example: CHECK_STRUCT_HAS_MEMBER("struct timeval" tv_sec sys/select.h HAVE_TIMEVAL_TV_SEC LANGUAGE C)
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
@@ -29,6 +32,7 @@
# License text for the above reference.)
include(CheckCSourceCompiles)
+include(CheckCXXSourceCompiles)
macro (CHECK_STRUCT_HAS_MEMBER _STRUCT _MEMBER _HEADER _RESULT)
set(_INCLUDE_FILES)
@@ -36,16 +40,29 @@ macro (CHECK_STRUCT_HAS_MEMBER _STRUCT _MEMBER _HEADER _RESULT)
set(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n")
endforeach ()
+ if("x${ARGN}" STREQUAL "x")
+ set(_lang C)
+ elseif("x${ARGN}" MATCHES "^xLANGUAGE;([a-zA-Z]+)$")
+ set(_lang "${CMAKE_MATCH_1}")
+ else()
+ message(FATAL_ERROR "Unknown arguments:\n ${ARGN}\n")
+ endif()
+
set(_CHECK_STRUCT_MEMBER_SOURCE_CODE "
${_INCLUDE_FILES}
int main()
{
${_STRUCT}* tmp;
tmp->${_MEMBER};
- return 0;
+ return 0;
}
")
- CHECK_C_SOURCE_COMPILES("${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT})
+ if("${_lang}" STREQUAL "C")
+ CHECK_C_SOURCE_COMPILES("${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT})
+ elseif("${_lang}" STREQUAL "CXX")
+ CHECK_CXX_SOURCE_COMPILES("${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT})
+ else()
+ message(FATAL_ERROR "Unknown language:\n ${_lang}\nSupported languages: C, CXX.\n")
+ endif()
endmacro ()
-
diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake
index 972d889..0372e18 100644
--- a/Modules/Compiler/Clang-CXX.cmake
+++ b/Modules/Compiler/Clang-CXX.cmake
@@ -1,4 +1,6 @@
include(Compiler/Clang)
__compiler_clang(CXX)
-set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
+if(NOT CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")
+ set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
+endif()
diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake
index ec4562a..7d7be5c 100644
--- a/Modules/Compiler/Clang.cmake
+++ b/Modules/Compiler/Clang.cmake
@@ -18,11 +18,17 @@ if(__COMPILER_CLANG)
endif()
set(__COMPILER_CLANG 1)
-include(Compiler/GNU)
+if(CMAKE_C_SIMULATE_ID STREQUAL "MSVC"
+ OR CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")
+ macro(__compiler_clang lang)
+ endmacro()
+else()
+ include(Compiler/GNU)
-macro(__compiler_clang lang)
- __compiler_gnu(${lang})
- set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
- set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ")
- set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
-endmacro()
+ macro(__compiler_clang lang)
+ __compiler_gnu(${lang})
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
+ set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
+ endmacro()
+endif()
diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake
index 77aac6d..316a2da 100644
--- a/Modules/FindGTK2.cmake
+++ b/Modules/FindGTK2.cmake
@@ -240,6 +240,7 @@ function(_GTK2_FIND_INCLUDE_DIR _var _hdr)
PATH_SUFFIXES
${_suffixes}
)
+ mark_as_advanced(GTK2_${_var}_INCLUDE_DIR)
if(${_var}_INCLUDE_DIR)
set(GTK2_INCLUDE_DIRS ${GTK2_INCLUDE_DIRS} ${${_var}_INCLUDE_DIR} PARENT_SCOPE)
@@ -449,7 +450,7 @@ endif()
# Find all components
#
-find_package(Freetype)
+find_package(Freetype QUIET)
list(APPEND GTK2_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS})
list(APPEND GTK2_LIBRARIES ${FREETYPE_LIBRARIES})
@@ -586,6 +587,8 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
string(TOUPPER ${_GTK2_component} _COMPONENT_UPPER)
+ set(GTK2_${_COMPONENT_UPPER}_FIND_QUIETLY ${GTK2_FIND_QUIETLY})
+
if(_GTK2_component STREQUAL "gtk")
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK2_${_COMPONENT_UPPER} "Some or all of the gtk libraries were not found."
GTK2_GTK_LIBRARY
diff --git a/Modules/FindLua.cmake b/Modules/FindLua.cmake
new file mode 100644
index 0000000..31fe54c
--- /dev/null
+++ b/Modules/FindLua.cmake
@@ -0,0 +1,153 @@
+# Locate Lua library
+# This module defines
+# LUA_FOUND - if false, do not try to link to Lua
+# LUA_LIBRARIES - both lua and lualib
+# LUA_INCLUDE_DIR - where to find lua.h
+# LUA_VERSION_STRING - the version of Lua found
+# LUA_VERSION_MAJOR - the major version of Lua
+# LUA_VERSION_MINOR - the minor version of Lua
+# LUA_VERSION_PATCH - the patch version of Lua
+#
+# Note that the expected include convention is
+# #include "lua.h"
+# and not
+# #include <lua/lua.h>
+# This is because, the lua location is not standardized and may exist
+# in locations other than lua/
+
+#=============================================================================
+# Copyright 2007-2009 Kitware, Inc.
+# Copyright 2013 Rolf Eike Beer <eike@sf-mail.de>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+unset(_lua_include_subdirs)
+unset(_lua_library_names)
+
+# this is a function only to have all the variables inside go away automatically
+function(set_lua_version_vars)
+ set(LUA_VERSIONS5 5.3 5.2 5.1 5.0)
+
+ if (Lua_FIND_VERSION_EXACT)
+ if (Lua_FIND_VERSION_COUNT GREATER 1)
+ set(lua_append_versions ${Lua_FIND_VERSION_MAJOR} ${Lua_FIND_VERSION_MINOR})
+ endif ()
+ elseif (Lua_FIND_VERSION)
+ # once there is a different major version supported this should become a loop
+ if (NOT Lua_FIND_VERSION_MAJOR GREATER 5)
+ if (Lua_FIND_VERSION_COUNT EQUAL 1)
+ set(lua_append_versions ${LUA_VERSIONS5})
+ else ()
+ foreach (subver IN LISTS LUA_VERSIONS5)
+ if (NOT subver VERSION_LESS ${Lua_FIND_VERSION})
+ list(APPEND lua_append_versions ${subver})
+ endif ()
+ endforeach ()
+ endif ()
+ endif ()
+ else ()
+ # once there is a different major version supported this should become a loop
+ set(lua_append_versions ${LUA_VERSIONS5})
+ endif ()
+
+ foreach (ver IN LISTS lua_append_versions)
+ string(REGEX MATCH "^([0-9]+)\\.([0-9]+)$" _ver "${ver}")
+ list(APPEND _lua_include_subdirs
+ include/lua${CMAKE_MATCH_1}${CMAKE_MATCH_2}
+ include/lua${CMAKE_MATCH_1}.${CMAKE_MATCH_2}
+ include/lua-${CMAKE_MATCH_1}.${CMAKE_MATCH_2}
+ )
+ list(APPEND _lua_library_names
+ lua${CMAKE_MATCH_1}${CMAKE_MATCH_2}
+ lua${CMAKE_MATCH_1}.${CMAKE_MATCH_2}
+ lua-${CMAKE_MATCH_1}.${CMAKE_MATCH_2}
+ )
+ endforeach ()
+
+ set(_lua_include_subdirs "${_lua_include_subdirs}" PARENT_SCOPE)
+ set(_lua_library_names "${_lua_library_names}" PARENT_SCOPE)
+endfunction(set_lua_version_vars)
+
+set_lua_version_vars()
+
+find_path(LUA_INCLUDE_DIR lua.h
+ HINTS
+ ENV LUA_DIR
+ PATH_SUFFIXES ${_lua_include_subdirs} include/lua include
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /sw # Fink
+ /opt/local # DarwinPorts
+ /opt/csw # Blastwave
+ /opt
+)
+unset(_lua_include_subdirs)
+
+find_library(LUA_LIBRARY
+ NAMES ${_lua_library_names} lua
+ HINTS
+ ENV LUA_DIR
+ PATH_SUFFIXES lib
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /sw
+ /opt/local
+ /opt/csw
+ /opt
+)
+unset(_lua_library_names)
+
+if (LUA_LIBRARY)
+ # include the math library for Unix
+ if (UNIX AND NOT APPLE AND NOT BEOS)
+ find_library(LUA_MATH_LIBRARY m)
+ set(LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}")
+ # For Windows and Mac, don't need to explicitly include the math library
+ else ()
+ set(LUA_LIBRARIES "${LUA_LIBRARY}")
+ endif ()
+endif ()
+
+if (LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h")
+ # At least 5.[012] have different ways to express the version
+ # so all of them need to be tested. Lua 5.2 defines LUA_VERSION
+ # and LUA_RELEASE as joined by the C preprocessor, so avoid those.
+ file(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_strings
+ REGEX "^#define[ \t]+LUA_(RELEASE[ \t]+\"Lua [0-9]|VERSION([ \t]+\"Lua [0-9]|_[MR])).*")
+
+ string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MAJOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MAJOR ";${lua_version_strings};")
+ if (LUA_VERSION_MAJOR MATCHES "^[0-9]+$")
+ string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MINOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MINOR ";${lua_version_strings};")
+ string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_RELEASE[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_PATCH ";${lua_version_strings};")
+ set(LUA_VERSION_STRING "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}.${LUA_VERSION_PATCH}")
+ else ()
+ string(REGEX REPLACE ".*;#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};")
+ if (NOT LUA_VERSION_STRING MATCHES "^[0-9.]+$")
+ string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};")
+ endif ()
+ string(REGEX REPLACE "^([0-9]+)\\.[0-9.]*$" "\\1" LUA_VERSION_MAJOR "${LUA_VERSION_STRING}")
+ string(REGEX REPLACE "^[0-9]+\\.([0-9]+)[0-9.]*$" "\\1" LUA_VERSION_MINOR "${LUA_VERSION_STRING}")
+ string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]).*" "\\1" LUA_VERSION_PATCH "${LUA_VERSION_STRING}")
+ endif ()
+
+ unset(lua_version_strings)
+endif()
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if
+# all listed variables are TRUE
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua
+ REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR
+ VERSION_VAR LUA_VERSION_STRING)
+
+mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARY LUA_MATH_LIBRARY)
diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake
index 9851f67..b610438 100644
--- a/Modules/FindOpenSSL.cmake
+++ b/Modules/FindOpenSSL.cmake
@@ -138,6 +138,8 @@ if(WIN32 AND NOT CYGWIN)
select_library_configurations(LIB_EAY)
select_library_configurations(SSL_EAY)
+ mark_as_advanced(LIB_EAY_LIBRARY_DEBUG LIB_EAY_LIBRARY_RELEASE
+ SSL_EAY_LIBRARY_DEBUG SSL_EAY_LIBRARY_RELEASE)
set( OPENSSL_LIBRARIES ${SSL_EAY_LIBRARY} ${LIB_EAY_LIBRARY} )
elseif(MINGW)
# same player, for MinGW
diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake
index 7fb65b8..b6b7897 100644
--- a/Modules/FindPythonInterp.cmake
+++ b/Modules/FindPythonInterp.cmake
@@ -36,28 +36,30 @@ set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
set(_PYTHON3_VERSIONS 3.3 3.2 3.1 3.0)
if(PythonInterp_FIND_VERSION)
- if(PythonInterp_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$")
- string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*" "\\1" _PYTHON_FIND_MAJ_MIN "${PythonInterp_FIND_VERSION}")
- string(REGEX REPLACE "^([0-9]+).*" "\\1" _PYTHON_FIND_MAJ "${_PYTHON_FIND_MAJ_MIN}")
- list(APPEND _Python_NAMES python${_PYTHON_FIND_MAJ_MIN} python${_PYTHON_FIND_MAJ})
+ if(PythonInterp_FIND_VERSION_COUNT GREATER 1)
+ set(_PYTHON_FIND_MAJ_MIN "${PythonInterp_FIND_VERSION_MAJOR}.${PythonInterp_FIND_VERSION_MINOR}")
+ list(APPEND _Python_NAMES
+ python${_PYTHON_FIND_MAJ_MIN}
+ python${PythonInterp_FIND_VERSION_MAJOR})
unset(_PYTHON_FIND_OTHER_VERSIONS)
if(NOT PythonInterp_FIND_VERSION_EXACT)
- foreach(_PYTHON_V ${_PYTHON${_PYTHON_FIND_MAJ}_VERSIONS})
+ foreach(_PYTHON_V ${_PYTHON${PythonInterp_FIND_VERSION_MAJOR}_VERSIONS})
if(NOT _PYTHON_V VERSION_LESS _PYTHON_FIND_MAJ_MIN)
list(APPEND _PYTHON_FIND_OTHER_VERSIONS ${_PYTHON_V})
endif()
endforeach()
endif()
unset(_PYTHON_FIND_MAJ_MIN)
- unset(_PYTHON_FIND_MAJ)
else()
- list(APPEND _Python_NAMES python${PythonInterp_FIND_VERSION})
- set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonInterp_FIND_VERSION}_VERSIONS})
+ list(APPEND _Python_NAMES python${PythonInterp_FIND_VERSION_MAJOR})
+ set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonInterp_FIND_VERSION_MAJOR}_VERSIONS})
endif()
else()
set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS})
endif()
+message(STATUS "names ${_Python_NAMES}")
+message(STATUS "other versions ${_PYTHON_FIND_OTHER_VERSIONS}")
list(APPEND _Python_NAMES python)
# Search for the current active python version first
diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake
index bffa9fb..8356ed9 100644
--- a/Modules/FindPythonLibs.cmake
+++ b/Modules/FindPythonLibs.cmake
@@ -41,9 +41,8 @@ set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
set(_PYTHON3_VERSIONS 3.3 3.2 3.1 3.0)
if(PythonLibs_FIND_VERSION)
- if(PythonLibs_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$")
- string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*" "\\1" _PYTHON_FIND_MAJ_MIN "${PythonLibs_FIND_VERSION}")
- string(REGEX REPLACE "^([0-9]+).*" "\\1" _PYTHON_FIND_MAJ "${_PYTHON_FIND_MAJ_MIN}")
+ if(PythonLibs_FIND_VERSION_COUNT GREATER 1)
+ set(_PYTHON_FIND_MAJ_MIN "${PythonLibs_FIND_VERSION_MAJOR}.${PythonLibs_FIND_VERSION_MINOR}")
unset(_PYTHON_FIND_OTHER_VERSIONS)
if(PythonLibs_FIND_VERSION_EXACT)
if(_PYTHON_FIND_MAJ_MIN STREQUAL PythonLibs_FIND_VERSION)
@@ -52,16 +51,15 @@ if(PythonLibs_FIND_VERSION)
set(_PYTHON_FIND_OTHER_VERSIONS "${PythonLibs_FIND_VERSION}" "${_PYTHON_FIND_MAJ_MIN}")
endif()
else()
- foreach(_PYTHON_V ${_PYTHON${_PYTHON_FIND_MAJ}_VERSIONS})
+ foreach(_PYTHON_V ${_PYTHON${PythonLibs_FIND_VERSION_MAJOR}_VERSIONS})
if(NOT _PYTHON_V VERSION_LESS _PYTHON_FIND_MAJ_MIN)
list(APPEND _PYTHON_FIND_OTHER_VERSIONS ${_PYTHON_V})
endif()
endforeach()
endif()
unset(_PYTHON_FIND_MAJ_MIN)
- unset(_PYTHON_FIND_MAJ)
else()
- set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonLibs_FIND_VERSION}_VERSIONS})
+ set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonLibs_FIND_VERSION_MAJOR}_VERSIONS})
endif()
else()
set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS})
diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake
index 37a894c..28c1b64 100644
--- a/Modules/FindwxWidgets.cmake
+++ b/Modules/FindwxWidgets.cmake
@@ -475,6 +475,8 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
# settings.
if(MINGW)
set(WX_LIB_DIR_PREFIX gcc)
+ elseif(CMAKE_CL_64)
+ set(WX_LIB_DIR_PREFIX vc_x64)
else()
set(WX_LIB_DIR_PREFIX vc)
endif()
diff --git a/Modules/FortranCInterface/Detect.cmake b/Modules/FortranCInterface/Detect.cmake
index 798c44c..afeb9c5 100644
--- a/Modules/FortranCInterface/Detect.cmake
+++ b/Modules/FortranCInterface/Detect.cmake
@@ -49,7 +49,7 @@ unset(FortranCInterface_COMPILED CACHE)
# Locate the sample project executable.
if(FortranCInterface_COMPILED)
find_program(FortranCInterface_EXE
- NAMES FortranCInterface
+ NAMES FortranCInterface${CMAKE_EXECUTABLE_SUFFIX}
PATHS ${FortranCInterface_BINARY_DIR} ${FortranCInterface_BINARY_DIR}/Debug
NO_DEFAULT_PATH
)
diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake
index 4ef14ac..b2fda09 100644
--- a/Modules/GenerateExportHeader.cmake
+++ b/Modules/GenerateExportHeader.cmake
@@ -1,6 +1,5 @@
# - Function for generation of export macros for libraries
-# This module provides the function GENERATE_EXPORT_HEADER() and the
-# accompanying ADD_COMPILER_EXPORT_FLAGS() function.
+# This module provides the function GENERATE_EXPORT_HEADER().
#
# The GENERATE_EXPORT_HEADER function can be used to generate a file suitable
# for preprocessor inclusion which contains EXPORT macros to be used in
@@ -18,20 +17,17 @@
# [PREFIX_NAME <prefix_name>]
# )
#
-# ADD_COMPILER_EXPORT_FLAGS( [<output_variable>] )
+# The target properties CXX_VISIBILITY_PRESET and VISIBILITY_INLINES_HIDDEN
+# can be used to add the appropriate compile flags for targets. See the
+# documentation of those target properties, and the convenience variables
+# CMAKE_CXX_VISIBILITY_PRESET and CMAKE_VISIBILITY_INLINES_HIDDEN.
#
# By default GENERATE_EXPORT_HEADER() generates macro names in a file name
-# determined by the name of the library. The ADD_COMPILER_EXPORT_FLAGS function
-# adds -fvisibility=hidden to CMAKE_CXX_FLAGS if supported, and is a no-op on
-# Windows which does not need extra compiler flags for exporting support. You
-# may optionally pass a single argument to ADD_COMPILER_EXPORT_FLAGS that will
-# be populated with the required CXX_FLAGS required to enable visibility support
-# for the compiler/architecture in use.
+# determined by the name of the library. This means that in the simplest case,
+# users of generate_export_header will be equivalent to:
#
-# This means that in the simplest case, users of these functions will be
-# equivalent to:
-#
-# add_compiler_export_flags()
+# set(CMAKE_CXX_VISIBILITY_PRESET hidden)
+# set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
# add_library(somelib someclass.cpp)
# generate_export_header(somelib)
# install(TARGETS somelib DESTINATION ${LIBRARY_INSTALL_DIR})
@@ -128,6 +124,20 @@
# generate_export_header(somelib PREFIX_NAME VTK_)
#
# Generates the macros VTK_SOMELIB_EXPORT etc.
+#
+#
+# ADD_COMPILER_EXPORT_FLAGS( [<output_variable>] )
+#
+# The ADD_COMPILER_EXPORT_FLAGS function
+# adds -fvisibility=hidden to CMAKE_CXX_FLAGS if supported, and is a no-op on
+# Windows which does not need extra compiler flags for exporting support. You
+# may optionally pass a single argument to ADD_COMPILER_EXPORT_FLAGS that will
+# be populated with the required CXX_FLAGS required to enable visibility support
+# for the compiler/architecture in use.
+#
+# This function is deprecated. Set the target properties CXX_VISIBILITY_PRESET
+# and VISIBILITY_INLINES_HIDDEN instead.
+#
#=============================================================================
# Copyright 2011 Stephen Kelly <steveire@gmail.com>
@@ -326,6 +336,17 @@ function(GENERATE_EXPORT_HEADER TARGET_LIBRARY)
endfunction()
function(add_compiler_export_flags)
+ if(NOT CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.12)
+ if(CMAKE_WARN_DEPRECATED)
+ set(messageType WARNING)
+ endif()
+ if(CMAKE_ERROR_DEPRECATED)
+ set(messageType FATAL_ERROR)
+ endif()
+ if(messageType)
+ message(${messageType} "The add_compiler_export_flags function is obsolete. Use the CXX_VISIBILITY_PRESET and VISIBILITY_INLINES_HIDDEN target properties instead.")
+ endif()
+ endif()
_test_compiler_hidden_visibility()
_test_compiler_has_deprecated()
diff --git a/Modules/Platform/Windows-Clang-C.cmake b/Modules/Platform/Windows-Clang-C.cmake
new file mode 100644
index 0000000..d007105
--- /dev/null
+++ b/Modules/Platform/Windows-Clang-C.cmake
@@ -0,0 +1,2 @@
+include(Platform/Windows-Clang)
+__windows_compiler_clang(C)
diff --git a/Modules/Platform/Windows-Clang-CXX.cmake b/Modules/Platform/Windows-Clang-CXX.cmake
new file mode 100644
index 0000000..2c3688a
--- /dev/null
+++ b/Modules/Platform/Windows-Clang-CXX.cmake
@@ -0,0 +1,2 @@
+include(Platform/Windows-Clang)
+__windows_compiler_clang(CXX)
diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake
new file mode 100644
index 0000000..4c936fe
--- /dev/null
+++ b/Modules/Platform/Windows-Clang.cmake
@@ -0,0 +1,32 @@
+
+#=============================================================================
+# Copyright 2001-2013 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# This module is shared by multiple languages; use include blocker.
+if(__WINDOWS_CLANG)
+ return()
+endif()
+set(__WINDOWS_CLANG 1)
+
+if(CMAKE_C_SIMULATE_ID STREQUAL "MSVC"
+ OR CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")
+ include(Platform/Windows-MSVC)
+ macro(__windows_compiler_clang lang)
+ __windows_compiler_msvc(${lang})
+ endmacro()
+else()
+ include(Platform/Windows-GNU)
+ macro(__windows_compiler_clang lang)
+ __windows_compiler_gnu(${lang})
+ endmacro()
+endif()
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index 7036ba0..a2cfe33 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -65,7 +65,11 @@ else()
endif()
if(NOT MSVC_VERSION)
- if(CMAKE_C_COMPILER_VERSION)
+ if(CMAKE_C_SIMULATE_VERSION)
+ set(_compiler_version ${CMAKE_C_SIMULATE_VERSION})
+ elseif(CMAKE_CXX_SIMULATE_VERSION)
+ set(_compiler_version ${CMAKE_CXX_SIMULATE_VERSION})
+ elseif(CMAKE_C_COMPILER_VERSION)
set(_compiler_version ${CMAKE_C_COMPILER_VERSION})
else()
set(_compiler_version ${CMAKE_CXX_COMPILER_VERSION})
@@ -220,7 +224,7 @@ set (CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INI
set (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT})
macro(__windows_compiler_msvc lang)
- if(NOT "${CMAKE_${lang}_COMPILER_VERSION}" VERSION_LESS 14)
+ if(NOT MSVC_VERSION LESS 1400)
# for 2005 make sure the manifest is put in the dll with mt
set(_CMAKE_VS_LINK_DLL "<CMAKE_COMMAND> -E vs_link_dll ")
set(_CMAKE_VS_LINK_EXE "<CMAKE_COMMAND> -E vs_link_exe ")
diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake
index c0fd07c..c9635b5 100644
--- a/Modules/UseJava.cmake
+++ b/Modules/UseJava.cmake
@@ -49,6 +49,11 @@
#
# add_jar(example ENTRY_POINT com/examples/MyProject/Main)
#
+# To define a custom manifest for the jar, you can set it with the manifest
+# named argument:
+#
+# add_jar(example MANIFEST /path/to/manifest)
+#
# To add a VERSION to the target output name you can set it using
# the VERSION named argument to add_jar. This will create a jar file with the
# name shibboleet-1.0.0.jar and will create a symlink shibboleet.jar
@@ -246,7 +251,7 @@ function(add_jar _TARGET_NAME)
cmake_parse_arguments(_add_jar
""
- "VERSION;OUTPUT_DIR;OUTPUT_NAME;ENTRY_POINT"
+ "VERSION;OUTPUT_DIR;OUTPUT_NAME;ENTRY_POINT;MANIFEST"
"SOURCES;INCLUDE_JARS"
${ARGN}
)
@@ -262,6 +267,11 @@ function(add_jar _TARGET_NAME)
set(_ENTRY_POINT_VALUE ${_add_jar_ENTRY_POINT})
endif ()
+ if (_add_jar_MANIFEST)
+ set(_MANIFEST_OPTION m)
+ set(_MANIFEST_VALUE ${_add_jar_MANIFEST})
+ endif ()
+
if (LIBRARY_OUTPUT_PATH)
set(CMAKE_JAVA_LIBRARY_OUTPUT_PATH ${LIBRARY_OUTPUT_PATH})
else ()
@@ -405,7 +415,7 @@ function(add_jar _TARGET_NAME)
add_custom_command(
OUTPUT ${_JAVA_JAR_OUTPUT_PATH}
COMMAND ${Java_JAR_EXECUTABLE}
- -cf${_ENTRY_POINT_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE}
+ -cf${_ENTRY_POINT_OPTION}${_MANIFEST_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE} ${_MANIFEST_VALUE}
${_JAVA_RESOURCE_FILES} @java_class_filelist
COMMAND ${CMAKE_COMMAND}
-D_JAVA_TARGET_DIR=${_add_jar_OUTPUT_DIR}
@@ -425,7 +435,7 @@ function(add_jar _TARGET_NAME)
add_custom_command(
OUTPUT ${_JAVA_JAR_OUTPUT_PATH}
COMMAND ${Java_JAR_EXECUTABLE}
- -cf${_ENTRY_POINT_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE}
+ -cf${_ENTRY_POINT_OPTION}${_MANIFEST_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE} ${_MANIFEST_VALUE}
${_JAVA_RESOURCE_FILES} @java_class_filelist
COMMAND ${CMAKE_COMMAND}
-D_JAVA_TARGET_DIR=${_add_jar_OUTPUT_DIR}
diff --git a/Modules/exportheader.cmake.in b/Modules/exportheader.cmake.in
index 80a879d..118de16 100644
--- a/Modules/exportheader.cmake.in
+++ b/Modules/exportheader.cmake.in
@@ -23,8 +23,14 @@
#ifndef @DEPRECATED_MACRO_NAME@
# define @DEPRECATED_MACRO_NAME@ @DEFINE_DEPRECATED@
-# define @DEPRECATED_MACRO_NAME@_EXPORT @EXPORT_MACRO_NAME@ @DEFINE_DEPRECATED@
-# define @DEPRECATED_MACRO_NAME@_NO_EXPORT @NO_EXPORT_MACRO_NAME@ @DEFINE_DEPRECATED@
+#endif
+
+#ifndef @DEPRECATED_MACRO_NAME@_EXPORT
+# define @DEPRECATED_MACRO_NAME@_EXPORT @EXPORT_MACRO_NAME@ @DEPRECATED_MACRO_NAME@
+#endif
+
+#ifndef @DEPRECATED_MACRO_NAME@_NO_EXPORT
+# define @DEPRECATED_MACRO_NAME@_NO_EXPORT @NO_EXPORT_MACRO_NAME@ @DEPRECATED_MACRO_NAME@
#endif
#cmakedefine01 DEFINE_NO_DEPRECATED
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 8412e3e..9b81e8b 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -439,6 +439,7 @@ set(CTEST_SRCS cmCTest.cxx
CTest/cmParseCacheCoverage.cxx
CTest/cmParseGTMCoverage.cxx
CTest/cmParsePHPCoverage.cxx
+ CTest/cmParsePythonCoverage.cxx
CTest/cmCTestEmptyBinaryDirectoryCommand.cxx
CTest/cmCTestGenericHandler.cxx
CTest/cmCTestHandlerCommand.cxx
@@ -545,7 +546,7 @@ if(APPLE)
endif()
# Build CMake executable
-add_executable(cmake cmakemain.cxx)
+add_executable(cmake cmakemain.cxx cmcmd.cxx cmcmd.h)
target_link_libraries(cmake CMakeLib)
# Build special executable for running programs on Windows 98.
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index e7d0bb7..6298218 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 12)
-set(CMake_VERSION_TWEAK 20131007)
+set(CMake_VERSION_TWEAK 20131009)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h
index 8fafef9..5cb2280 100644
--- a/Source/CPack/cmCPackGenerator.h
+++ b/Source/CPack/cmCPackGenerator.h
@@ -160,9 +160,10 @@ protected:
* CPack specific generator may mangle CPACK_PACKAGE_FILE_NAME
* with CPACK_COMPONENT_xxxx_<NAME>_DISPLAY_NAME if
* CPACK_<GEN>_USE_DISPLAY_NAME_IN_FILENAME is ON.
- * @param[in] initialPackageFileName
- * @param[in] groupOrComponentName
- * @param[in] isGroupName
+ * @param[in] initialPackageFileName the initial package name to be mangled
+ * @param[in] groupOrComponentName the name of the group/component
+ * @param[in] isGroupName true if previous name refers to a group,
+ * false otherwise
*/
virtual std::string GetComponentPackageFileName(
const std::string& initialPackageFileName,
@@ -172,7 +173,7 @@ protected:
/**
* Package the list of files and/or components which
* has been prepared by the beginning of DoPackage.
- * @pre @ref toplevel has been filled-in
+ * @pre the @ref toplevel has been filled-in
* @pre the list of file @ref files has been populated
* @pre packageFileNames contains at least 1 entry
* @post packageFileNames may have been updated and contains
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index 20aded2..ef071b9 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -11,6 +11,7 @@
============================================================================*/
#include "cmCTestCoverageHandler.h"
#include "cmParsePHPCoverage.h"
+#include "cmParsePythonCoverage.h"
#include "cmParseGTMCoverage.h"
#include "cmParseCacheCoverage.h"
#include "cmCTest.h"
@@ -392,6 +393,13 @@ int cmCTestCoverageHandler::ProcessHandler()
{
return error;
}
+ file_count += this->HandlePythonCoverage(&cont);
+ error = cont.Error;
+ if ( file_count < 0 )
+ {
+ return error;
+ }
+
file_count += this->HandleMumpsCoverage(&cont);
error = cont.Error;
if ( file_count < 0 )
@@ -761,6 +769,32 @@ int cmCTestCoverageHandler::HandlePHPCoverage(
}
return static_cast<int>(cont->TotalCoverage.size());
}
+
+//----------------------------------------------------------------------
+int cmCTestCoverageHandler::HandlePythonCoverage(
+ cmCTestCoverageHandlerContainer* cont)
+{
+ cmParsePythonCoverage cov(*cont, this->CTest);
+
+ // Assume the coverage.xml is in the source directory
+ std::string coverageXMLFile = this->CTest->GetBinaryDir() + "/coverage.xml";
+
+ if(cmSystemTools::FileExists(coverageXMLFile.c_str()))
+ {
+ cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+ "Parsing coverage.py XML file: " << coverageXMLFile
+ << std::endl);
+ cov.ReadCoverageXML(coverageXMLFile.c_str());
+ }
+ else
+ {
+ cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+ "Cannot find coverage.py XML file: " << coverageXMLFile
+ << std::endl);
+ }
+ return static_cast<int>(cont->TotalCoverage.size());
+}
+
//----------------------------------------------------------------------
int cmCTestCoverageHandler::HandleMumpsCoverage(
cmCTestCoverageHandlerContainer* cont)
diff --git a/Source/CTest/cmCTestCoverageHandler.h b/Source/CTest/cmCTestCoverageHandler.h
index 92b0b22..3506928 100644
--- a/Source/CTest/cmCTestCoverageHandler.h
+++ b/Source/CTest/cmCTestCoverageHandler.h
@@ -70,6 +70,10 @@ private:
//! Handle coverage using xdebug php coverage
int HandlePHPCoverage(cmCTestCoverageHandlerContainer* cont);
+
+ //! Handle coverage for Python with coverage.py
+ int HandlePythonCoverage(cmCTestCoverageHandlerContainer* cont);
+
//! Handle coverage for mumps
int HandleMumpsCoverage(cmCTestCoverageHandlerContainer* cont);
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 497774d..09d343d 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -20,6 +20,7 @@
#include <cmsys/Process.h>
#include <cmsys/RegularExpression.hxx>
#include <cmsys/Base64.h>
+#include <cmsys/Directory.hxx>
#include "cmMakefile.h"
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
@@ -249,7 +250,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "ADD_TEST";}
+ virtual const char* GetName() const { return "add_test";}
// Unused methods
virtual const char* GetTerseDocumentation() const { return ""; }
@@ -297,7 +298,7 @@ public:
/**
* The name of the command as specified in CMakeList.txt.
*/
- virtual const char* GetName() const { return "SET_TESTS_PROPERTIES";}
+ virtual const char* GetName() const { return "set_tests_properties";}
// Unused methods
virtual const char* GetTerseDocumentation() const { return ""; }
@@ -537,6 +538,7 @@ int cmCTestTestHandler::ProcessHandler()
this->UseExcludeRegExp();
this->SetExcludeRegExp(val);
}
+ this->SetRerunFailed(cmSystemTools::IsOn(this->GetOption("RerunFailed")));
this->TestResults.clear();
@@ -819,6 +821,13 @@ void cmCTestTestHandler::ComputeTestList()
{
this->TestList.clear(); // clear list of test
this->GetListOfTests();
+
+ if (this->RerunFailed)
+ {
+ this->ComputeTestListForRerunFailed();
+ return;
+ }
+
cmCTestTestHandler::ListOfTests::size_type tmsize = this->TestList.size();
// how many tests are in based on RegExp?
int inREcnt = 0;
@@ -881,9 +890,47 @@ void cmCTestTestHandler::ComputeTestList()
this->TotalNumberOfTests = this->TestList.size();
// Set the TestList to the final list of all test
this->TestList = finalList;
+
+ this->UpdateMaxTestNameWidth();
+}
+
+void cmCTestTestHandler::ComputeTestListForRerunFailed()
+{
+ this->ExpandTestsToRunInformationForRerunFailed();
+
+ cmCTestTestHandler::ListOfTests::iterator it;
+ ListOfTests finalList;
+ int cnt = 0;
+ for ( it = this->TestList.begin(); it != this->TestList.end(); it ++ )
+ {
+ cnt ++;
+
+ // if this test is not in our list of tests to run, then skip it.
+ if ((this->TestsToRun.size() &&
+ std::find(this->TestsToRun.begin(), this->TestsToRun.end(), cnt)
+ == this->TestsToRun.end()))
+ {
+ continue;
+ }
+
+ it->Index = cnt;
+ finalList.push_back(*it);
+ }
+
+ // Save the total number of tests before exclusions
+ this->TotalNumberOfTests = this->TestList.size();
+
+ // Set the TestList to the list of failed tests to rerun
+ this->TestList = finalList;
+
+ this->UpdateMaxTestNameWidth();
+}
+
+void cmCTestTestHandler::UpdateMaxTestNameWidth()
+{
std::string::size_type max = this->CTest->GetMaxTestNameWidth();
- for (it = this->TestList.begin();
- it != this->TestList.end(); it ++ )
+ for ( cmCTestTestHandler::ListOfTests::iterator it = this->TestList.begin();
+ it != this->TestList.end(); it ++ )
{
cmCTestTestProperties& p = *it;
if(max < p.Name.size())
@@ -1708,6 +1755,91 @@ void cmCTestTestHandler::ExpandTestsToRunInformation(size_t numTests)
this->TestsToRun.erase(new_end, this->TestsToRun.end());
}
+void cmCTestTestHandler::ExpandTestsToRunInformationForRerunFailed()
+{
+
+ std::string dirName = this->CTest->GetBinaryDir() + "/Testing/Temporary";
+
+ cmsys::Directory directory;
+ if (directory.Load(dirName.c_str()) == 0)
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "Unable to read the contents of "
+ << dirName << std::endl);
+ return;
+ }
+
+ int numFiles = static_cast<int>
+ (cmsys::Directory::GetNumberOfFilesInDirectory(dirName.c_str()));
+ std::string pattern = "LastTestsFailed";
+ std::string logName = "";
+
+ for (int i = 0; i < numFiles; ++i)
+ {
+ std::string fileName = directory.GetFile(i);
+ // bcc crashes if we attempt a normal substring comparison,
+ // hence the following workaround
+ std::string fileNameSubstring = fileName.substr(0, pattern.length());
+ if (fileNameSubstring.compare(pattern) != 0)
+ {
+ continue;
+ }
+ if (logName == "")
+ {
+ logName = fileName;
+ }
+ else
+ {
+ // if multiple matching logs were found we use the most recently
+ // modified one.
+ int res;
+ cmSystemTools::FileTimeCompare(logName.c_str(), fileName.c_str(), &res);
+ if (res == -1)
+ {
+ logName = fileName;
+ }
+ }
+ }
+
+ std::string lastTestsFailedLog = this->CTest->GetBinaryDir()
+ + "/Testing/Temporary/" + logName;
+
+ if ( !cmSystemTools::FileExists(lastTestsFailedLog.c_str()) )
+ {
+ if ( !this->CTest->GetShowOnly() && !this->CTest->ShouldPrintLabels() )
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE, lastTestsFailedLog
+ << " does not exist!" << std::endl);
+ }
+ return;
+ }
+
+ // parse the list of tests to rerun from LastTestsFailed.log
+ std::ifstream ifs(lastTestsFailedLog.c_str());
+ if ( ifs )
+ {
+ std::string line;
+ std::string::size_type pos;
+ while ( cmSystemTools::GetLineFromStream(ifs, line) )
+ {
+ pos = line.find(':', 0);
+ if (pos == line.npos)
+ {
+ continue;
+ }
+
+ int val = atoi(line.substr(0, pos).c_str());
+ this->TestsToRun.push_back(val);
+ }
+ ifs.close();
+ }
+ else if ( !this->CTest->GetShowOnly() && !this->CTest->ShouldPrintLabels() )
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "Problem reading file: "
+ << lastTestsFailedLog.c_str() <<
+ " while generating list of previously failed tests." << std::endl);
+ }
+}
+
//----------------------------------------------------------------------
// Just for convenience
#define SPACE_REGEX "[ \t\r\n]"
diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h
index 93b793b..398f052 100644
--- a/Source/CTest/cmCTestTestHandler.h
+++ b/Source/CTest/cmCTestTestHandler.h
@@ -44,6 +44,12 @@ public:
void SetUseUnion(bool val) { this->UseUnion = val; }
/**
+ * Set whether or not CTest should only execute the tests that failed
+ * on the previous run. By default this is false.
+ */
+ void SetRerunFailed(bool val) { this->RerunFailed = val; }
+
+ /**
* This method is called when reading CTest custom file
*/
void PopulateCustomVectors(cmMakefile *mf);
@@ -213,6 +219,12 @@ private:
// based on union regex and -I stuff
void ComputeTestList();
+ // compute the lists of tests that will actually run
+ // based on LastTestFailed.log
+ void ComputeTestListForRerunFailed();
+
+ void UpdateMaxTestNameWidth();
+
bool GetValue(const char* tag,
std::string& value,
std::ifstream& fin);
@@ -235,6 +247,7 @@ private:
const char* GetTestStatus(int status);
void ExpandTestsToRunInformation(size_t numPossibleTests);
+ void ExpandTestsToRunInformationForRerunFailed();
std::vector<cmStdString> CustomPreTest;
std::vector<cmStdString> CustomPostTest;
@@ -268,6 +281,8 @@ private:
cmsys::RegularExpression DartStuff;
std::ostream* LogFile;
+
+ bool RerunFailed;
};
#endif
diff --git a/Source/CTest/cmParsePythonCoverage.cxx b/Source/CTest/cmParsePythonCoverage.cxx
new file mode 100644
index 0000000..a086f13
--- /dev/null
+++ b/Source/CTest/cmParsePythonCoverage.cxx
@@ -0,0 +1,113 @@
+#include "cmStandardIncludes.h"
+#include "cmSystemTools.h"
+#include "cmXMLParser.h"
+#include "cmParsePythonCoverage.h"
+#include <cmsys/Directory.hxx>
+
+
+//----------------------------------------------------------------------------
+class cmParsePythonCoverage::XMLParser: public cmXMLParser
+{
+public:
+ XMLParser(cmCTest* ctest, cmCTestCoverageHandlerContainer& cont)
+ : CTest(ctest), Coverage(cont)
+ {
+ }
+
+ virtual ~XMLParser()
+ {
+ }
+
+protected:
+
+ virtual void StartElement(const char* name, const char** atts)
+ {
+ if(strcmp(name, "class") == 0)
+ {
+ int tagCount = 0;
+ while(true)
+ {
+ if(strcmp(atts[tagCount], "filename") == 0)
+ {
+ cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Reading file: "
+ << atts[tagCount+1] << std::endl);
+ this->CurFileName = this->Coverage.SourceDir + "/" +
+ atts[tagCount+1];
+ FileLinesType& curFileLines =
+ this->Coverage.TotalCoverage[this->CurFileName];
+ std::ifstream fin(this->CurFileName.c_str());
+ if(!fin)
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "Python Coverage: Error opening " << this->CurFileName
+ << std::endl);
+ this->Coverage.Error++;
+ break;
+ }
+
+ std::string line;
+ curFileLines.push_back(-1);
+ while(cmSystemTools::GetLineFromStream(fin, line))
+ {
+ curFileLines.push_back(-1);
+ }
+
+ break;
+ }
+ ++tagCount;
+ }
+ }
+ else if(strcmp(name, "line") == 0)
+ {
+ int tagCount = 0;
+ int curNumber = -1;
+ int curHits = -1;
+ while(true)
+ {
+ if(strcmp(atts[tagCount], "hits") == 0)
+ {
+ curHits = atoi(atts[tagCount+1]);
+ }
+ else if(strcmp(atts[tagCount], "number") == 0)
+ {
+ curNumber = atoi(atts[tagCount+1]);
+ }
+
+ if(curHits > -1 && curNumber > -1)
+ {
+ FileLinesType& curFileLines =
+ this->Coverage.TotalCoverage[this->CurFileName];
+ curFileLines[curNumber] = curHits;
+ break;
+ }
+ ++tagCount;
+ }
+ }
+ }
+
+ virtual void EndElement(const char*) {}
+
+private:
+
+ typedef cmCTestCoverageHandlerContainer::SingleFileCoverageVector
+ FileLinesType;
+ cmCTest* CTest;
+ cmCTestCoverageHandlerContainer& Coverage;
+ std::string CurFileName;
+
+};
+
+
+cmParsePythonCoverage::cmParsePythonCoverage(
+ cmCTestCoverageHandlerContainer& cont,
+ cmCTest* ctest)
+ :Coverage(cont), CTest(ctest)
+{
+}
+
+bool cmParsePythonCoverage::ReadCoverageXML(const char* xmlFile)
+{
+ cmParsePythonCoverage::XMLParser parser(this->CTest, this->Coverage);
+ parser.ParseFile(xmlFile);
+ return true;
+}
diff --git a/Source/CTest/cmParsePythonCoverage.h b/Source/CTest/cmParsePythonCoverage.h
new file mode 100644
index 0000000..668c7f9
--- /dev/null
+++ b/Source/CTest/cmParsePythonCoverage.h
@@ -0,0 +1,48 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc.
+
+ 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 cmParsePythonCoverage_h
+#define cmParsePythonCoverage_h
+
+#include "cmStandardIncludes.h"
+#include "cmCTestCoverageHandler.h"
+
+/** \class cmParsePythonCoverage
+ * \brief Parse coverage.py Python coverage information
+ *
+ * This class is used to parse the output of the coverage.py tool that
+ * is currently maintained by Ned Batchelder. That tool has a command
+ * that produces xml output in the format typically output by the common
+ * Java-based Cobertura coverage application. This helper class parses
+ * that XML file to fill the coverage-handler container.
+ */
+class cmParsePythonCoverage
+{
+public:
+
+ //! Create the coverage parser by passing in the coverage handler
+ //! container and the cmCTest object
+ cmParsePythonCoverage(cmCTestCoverageHandlerContainer& cont,
+ cmCTest* ctest);
+
+ //! Read the XML produced by running `coverage xml`
+ bool ReadCoverageXML(const char* xmlFile);
+
+private:
+
+ class XMLParser;
+ cmCTestCoverageHandlerContainer& Coverage;
+ cmCTest* CTest;
+ std::string CurFileName;
+};
+
+#endif
diff --git a/Source/CursesDialog/CMakeLists.txt b/Source/CursesDialog/CMakeLists.txt
index 5efc2fb..548f5a5 100644
--- a/Source/CursesDialog/CMakeLists.txt
+++ b/Source/CursesDialog/CMakeLists.txt
@@ -11,6 +11,7 @@
#=============================================================================
set( CURSES_SRCS
+ CursesDialog/cmCursesOptionsWidget
CursesDialog/cmCursesBoolWidget
CursesDialog/cmCursesCacheEntryComposite
CursesDialog/cmCursesDummyWidget
diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
index c58d037..249137f 100644
--- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
+++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
@@ -10,6 +10,7 @@
See the License for more information.
============================================================================*/
#include "cmCursesCacheEntryComposite.h"
+#include "cmCursesOptionsWidget.h"
#include "cmCursesStringWidget.h"
#include "cmCursesLabelWidget.h"
#include "cmCursesBoolWidget.h"
@@ -69,9 +70,27 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
it.GetValue());
break;
case cmCacheManager::STRING:
- this->Entry = new cmCursesStringWidget(this->EntryWidth, 1, 1, 1);
- static_cast<cmCursesStringWidget*>(this->Entry)->SetString(
- it.GetValue());
+ if(it.PropertyExists("STRINGS"))
+ {
+ cmCursesOptionsWidget* ow =
+ new cmCursesOptionsWidget(this->EntryWidth, 1, 1, 1);
+ this->Entry = ow;
+ std::vector<std::string> options;
+ cmSystemTools::ExpandListArgument(
+ std::string(it.GetProperty("STRINGS")), options);
+ for(std::vector<std::string>::iterator
+ si = options.begin(); si != options.end(); ++si)
+ {
+ ow->AddOption(*si);
+ }
+ ow->SetOption(it.GetValue());
+ }
+ else
+ {
+ this->Entry = new cmCursesStringWidget(this->EntryWidth, 1, 1, 1);
+ static_cast<cmCursesStringWidget*>(this->Entry)->SetString(
+ it.GetValue());
+ }
break;
case cmCacheManager::UNINITIALIZED:
cmSystemTools::Error("Found an undefined variable: ", it.GetName());
diff --git a/Source/CursesDialog/cmCursesOptionsWidget.cxx b/Source/CursesDialog/cmCursesOptionsWidget.cxx
new file mode 100644
index 0000000..652b2df
--- /dev/null
+++ b/Source/CursesDialog/cmCursesOptionsWidget.cxx
@@ -0,0 +1,106 @@
+/*============================================================================
+ 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.
+============================================================================*/
+#include "cmCursesOptionsWidget.h"
+#include "cmCursesMainForm.h"
+
+inline int ctrl(int z)
+{
+ return (z&037);
+}
+
+cmCursesOptionsWidget::cmCursesOptionsWidget(int width, int height,
+ int left, int top) :
+ cmCursesWidget(width, height, left, top)
+{
+ this->Type = cmCacheManager::BOOL; // this is a bit of a hack
+ // there is no option type, and string type causes ccmake to cast
+ // the widget into a string widget at some point. BOOL is safe for
+ // now.
+ set_field_fore(this->Field, A_NORMAL);
+ set_field_back(this->Field, A_STANDOUT);
+ field_opts_off(this->Field, O_STATIC);
+}
+
+bool cmCursesOptionsWidget::HandleInput(int& key, cmCursesMainForm*, WINDOW* w)
+{
+
+ // 10 == enter
+ if (key == 10 || key == KEY_ENTER)
+ {
+ this->NextOption();
+ touchwin(w);
+ wrefresh(w);
+ return true;
+ }
+ else if (key == KEY_LEFT || key == ctrl('b'))
+ {
+ touchwin(w);
+ wrefresh(w);
+ this->PreviousOption();
+ return true;
+ }
+ else if (key == KEY_RIGHT || key == ctrl('f'))
+ {
+ this->NextOption();
+ touchwin(w);
+ wrefresh(w);
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ return false;
+}
+
+void cmCursesOptionsWidget::AddOption(std::string const & option )
+{
+ this->Options.push_back(option);
+}
+
+void cmCursesOptionsWidget::NextOption()
+{
+ this->CurrentOption++;
+ if(this->CurrentOption > this->Options.size()-1)
+ {
+ this->CurrentOption = 0;
+ }
+ this->SetValue(this->Options[this->CurrentOption].c_str());
+}
+void cmCursesOptionsWidget::PreviousOption()
+{
+ if(this->CurrentOption == 0)
+ {
+ this->CurrentOption = this->Options.size()-1;
+ }
+ else
+ {
+ this->CurrentOption--;
+ }
+ this->SetValue(this->Options[this->CurrentOption].c_str());
+}
+
+void cmCursesOptionsWidget::SetOption(const char* value)
+{
+ this->CurrentOption = 0; // default to 0 index
+ this->SetValue(value);
+ int index = 0;
+ for(std::vector<std::string>::iterator i = this->Options.begin();
+ i != this->Options.end(); ++i)
+ {
+ if(*i == value)
+ {
+ this->CurrentOption = index;
+ }
+ index++;
+ }
+}
diff --git a/Source/CursesDialog/cmCursesOptionsWidget.h b/Source/CursesDialog/cmCursesOptionsWidget.h
new file mode 100644
index 0000000..b52ac9d
--- /dev/null
+++ b/Source/CursesDialog/cmCursesOptionsWidget.h
@@ -0,0 +1,39 @@
+/*============================================================================
+ 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.
+============================================================================*/
+#ifndef __cmCursesOptionsWidget_h
+#define __cmCursesOptionsWidget_h
+
+#include "cmCursesWidget.h"
+class cmCursesMainForm;
+
+class cmCursesOptionsWidget : public cmCursesWidget
+{
+public:
+ cmCursesOptionsWidget(int width, int height, int left, int top);
+
+ // Description:
+ // Handle user input. Called by the container of this widget
+ // when this widget has focus. Returns true if the input was
+ // handled.
+ virtual bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w);
+ void SetOption(const char*);
+ void AddOption(std::string const &);
+ void NextOption();
+ void PreviousOption();
+protected:
+ cmCursesOptionsWidget(const cmCursesOptionsWidget& from);
+ void operator=(const cmCursesOptionsWidget&);
+ std::vector<std::string> Options;
+ std::vector<std::string>::size_type CurrentOption;
+};
+
+#endif // __cmCursesOptionsWidget_h
diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx
index 4d62f72..a4dfdc9 100644
--- a/Source/QtDialog/CMakeSetupDialog.cxx
+++ b/Source/QtDialog/CMakeSetupDialog.cxx
@@ -66,9 +66,8 @@ CMakeSetupDialog::CMakeSetupDialog()
// create the GUI
QSettings settings;
settings.beginGroup("Settings/StartPath");
- int h = settings.value("Height", 500).toInt();
- int w = settings.value("Width", 700).toInt();
- this->resize(w, h);
+ restoreGeometry(settings.value("geometry").toByteArray());
+ restoreState(settings.value("windowState").toByteArray());
this->AddVariableCompletions = settings.value("AddVariableCompletionEntries",
QStringList("CMAKE_INSTALL_PREFIX")).toStringList();
@@ -299,8 +298,8 @@ CMakeSetupDialog::~CMakeSetupDialog()
{
QSettings settings;
settings.beginGroup("Settings/StartPath");
- settings.setValue("Height", this->height());
- settings.setValue("Width", this->width());
+ settings.setValue("windowState", QVariant(saveState()));
+ settings.setValue("geometry", QVariant(saveGeometry()));
settings.setValue("SplitterSizes", this->Splitter->saveState());
// wait for thread to stop
diff --git a/Source/cmAddCustomCommandCommand.h b/Source/cmAddCustomCommandCommand.h
index 1cc1e3a..2504185 100644
--- a/Source/cmAddCustomCommandCommand.h
+++ b/Source/cmAddCustomCommandCommand.h
@@ -16,9 +16,7 @@
#include "cmDocumentGeneratorExpressions.h"
/** \class cmAddCustomCommandCommand
- * \brief
- *
- * cmAddCustomCommandCommand defines a new command (rule) that can
+ * \brief cmAddCustomCommandCommand defines a new command (rule) that can
* be executed within the build process
*
*/
diff --git a/Source/cmAddDependenciesCommand.h b/Source/cmAddDependenciesCommand.h
index ed80067..148fd99 100644
--- a/Source/cmAddDependenciesCommand.h
+++ b/Source/cmAddDependenciesCommand.h
@@ -56,14 +56,14 @@ public:
virtual const char* GetFullDocumentation() const
{
return
- " add_dependencies(target-name depend-target1\n"
- " depend-target2 ...)\n"
- "Make a top-level target depend on other top-level targets. A "
- "top-level target is one created by ADD_EXECUTABLE, ADD_LIBRARY, "
- "or ADD_CUSTOM_TARGET. Adding dependencies with this command "
- "can be used to make sure one target is built before another target. "
+ " add_dependencies(<target> [<target-dependency>]...)\n"
+ "Make a top-level <target> depend on other top-level targets to "
+ "ensure that they build before <target> does. "
+ "A top-level target is one created by ADD_EXECUTABLE, ADD_LIBRARY, "
+ "or ADD_CUSTOM_TARGET. "
"Dependencies added to an IMPORTED target are followed transitively "
"in its place since the target itself does not build. "
+ "\n"
"See the DEPENDS option of ADD_CUSTOM_TARGET "
"and ADD_CUSTOM_COMMAND for adding file-level dependencies in custom "
"rules. See the OBJECT_DEPENDS option in "
diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx
index cbc6ed1..0e61c99 100644
--- a/Source/cmAddLibraryCommand.cxx
+++ b/Source/cmAddLibraryCommand.cxx
@@ -82,6 +82,12 @@ bool cmAddLibraryCommand
++s;
isAlias = true;
}
+ else if(libType == "INTERFACE")
+ {
+ ++s;
+ type = cmTarget::INTERFACE_LIBRARY;
+ haveSpecifiedType = true;
+ }
else if(*s == "EXCLUDE_FROM_ALL")
{
++s;
@@ -151,7 +157,8 @@ bool cmAddLibraryCommand
if(aliasedType != cmTarget::SHARED_LIBRARY
&& aliasedType != cmTarget::STATIC_LIBRARY
&& aliasedType != cmTarget::MODULE_LIBRARY
- && aliasedType != cmTarget::OBJECT_LIBRARY)
+ && aliasedType != cmTarget::OBJECT_LIBRARY
+ && aliasedType != cmTarget::INTERFACE_LIBRARY)
{
cmOStringStream e;
e << "cannot create ALIAS target \"" << libName
@@ -213,6 +220,16 @@ bool cmAddLibraryCommand
);
return true;
}
+ if(type == cmTarget::INTERFACE_LIBRARY)
+ {
+ if (!cmGeneratorExpression::IsValidTargetName(libName))
+ {
+ cmOStringStream e;
+ e << "Invalid name for IMPORTED INTERFACE library target: " << libName;
+ this->SetError(e.str().c_str());
+ return false;
+ }
+ }
// Make sure the target does not already exist.
if(this->Makefile->FindTargetToUse(libName.c_str()))
@@ -249,6 +266,26 @@ bool cmAddLibraryCommand
}
}
+ std::vector<std::string> srclists;
+
+ if(type == cmTarget::INTERFACE_LIBRARY)
+ {
+ if (!cmGeneratorExpression::IsValidTargetName(libName)
+ || libName.find("::") != std::string::npos)
+ {
+ cmOStringStream e;
+ e << "Invalid name for INTERFACE library target: " << libName;
+ this->SetError(e.str().c_str());
+ return false;
+ }
+
+ this->Makefile->AddLibrary(libName.c_str(),
+ type,
+ srclists,
+ excludeFromAll);
+ return true;
+ }
+
if (s == args.end())
{
std::string msg = "You have called ADD_LIBRARY for library ";
@@ -258,7 +295,6 @@ bool cmAddLibraryCommand
cmSystemTools::Message(msg.c_str() ,"Warning");
}
- std::vector<std::string> srclists;
while (s != args.end())
{
srclists.push_back(*s);
diff --git a/Source/cmAddLibraryCommand.h b/Source/cmAddLibraryCommand.h
index 59354b0..64d048b 100644
--- a/Source/cmAddLibraryCommand.h
+++ b/Source/cmAddLibraryCommand.h
@@ -151,6 +151,16 @@ public:
"properties of <target>, that is, it may not be used as the operand of "
"set_property, set_target_properties, target_link_libraries etc. An "
"ALIAS target may not be installed of exported."
+ "\n"
+ "The signature\n"
+ " add_library(<name> INTERFACE)\n"
+ "creates an interface target. An interface target does not directly "
+ "create build output, though it may have properties set on it and it "
+ "may be installed, exported and imported. Typically the INTERFACE_* "
+ "properties are populated on the interface target using the "
+ "set_property(), target_link_libraries(), target_include_directories() "
+ "and target_compile_defintions() commands, and then it is used as an "
+ "argument to target_link_libraries() like any other target."
;
}
diff --git a/Source/cmAddTestCommand.h b/Source/cmAddTestCommand.h
index ec7fda3..ce98aaa 100644
--- a/Source/cmAddTestCommand.h
+++ b/Source/cmAddTestCommand.h
@@ -66,7 +66,8 @@ public:
"built by this project or an arbitrary executable on the "
"system (like tclsh). The test will be run with the current working "
"directory set to the CMakeList.txt files corresponding directory "
- "in the binary tree.\n"
+ "in the binary tree. Tests added using this signature do not support "
+ "generator expressions.\n"
"\n"
" add_test(NAME <name> [CONFIGURATIONS [Debug|Release|...]]\n"
" [WORKING_DIRECTORY dir]\n"
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 14e1f50..feae61a 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -2187,6 +2187,12 @@ void cmCTest::HandleCommandLineArguments(size_t &i,
this->GetHandler("memcheck")->
SetPersistentOption("ExcludeRegularExpression", args[i].c_str());
}
+
+ if(this->CheckArgument(arg, "--rerun-failed"))
+ {
+ this->GetHandler("test")->SetPersistentOption("RerunFailed", "true");
+ this->GetHandler("memcheck")->SetPersistentOption("RerunFailed", "true");
+ }
}
//----------------------------------------------------------------------
diff --git a/Source/cmCommandArgumentLexer.cxx b/Source/cmCommandArgumentLexer.cxx
index e68f6b5..e62e53e 100644
--- a/Source/cmCommandArgumentLexer.cxx
+++ b/Source/cmCommandArgumentLexer.cxx
@@ -1820,7 +1820,7 @@ void cmCommandArgument_yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yysca
}
/** Set the current line number.
- * @param line_number
+ * @param line_number The line number to set.
* @param yyscanner The scanner object.
*/
void cmCommandArgument_yyset_lineno (int line_number , yyscan_t yyscanner)
@@ -1835,7 +1835,7 @@ void cmCommandArgument_yyset_lineno (int line_number , yyscan_t yyscanner)
}
/** Set the current column.
- * @param column_no
+ * @param column_no The column number to set.
* @param yyscanner The scanner object.
*/
void cmCommandArgument_yyset_column (int column_no , yyscan_t yyscanner)
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index dec2b54..a2f3f7d 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -355,9 +355,16 @@ void cmComputeLinkDepends::FollowLinkEntry(BFSEntry const& qe)
if(cmTarget::LinkInterface const* iface =
entry.Target->GetLinkInterface(this->Config, this->HeadTarget))
{
+ const bool isIface =
+ entry.Target->GetType() == cmTarget::INTERFACE_LIBRARY;
// This target provides its own link interface information.
this->AddLinkEntries(depender_index, iface->Libraries);
+ if (isIface)
+ {
+ return;
+ }
+
// Handle dependent shared libraries.
this->FollowSharedDeps(depender_index, iface);
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index fb7b5b6..d3b28ed 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -655,6 +655,11 @@ void cmComputeLinkInformation::AddItem(std::string const& item, cmTarget* tgt)
(this->UseImportLibrary &&
(impexe || tgt->GetType() == cmTarget::SHARED_LIBRARY));
+ if(tgt->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ this->Items.push_back(Item(std::string(), true, tgt));
+ return;
+ }
// Pass the full path to the target file.
std::string lib = tgt->GetFullPath(config, implib, true);
if(!this->LinkDependsNoShared ||
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 086f27a..bc4bf18 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -99,6 +99,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
{
case cmTarget::SHARED_LIBRARY:
case cmTarget::STATIC_LIBRARY:
+ case cmTarget::INTERFACE_LIBRARY:
case cmTarget::UNKNOWN_LIBRARY:
break;
case cmTarget::EXECUTABLE:
@@ -294,7 +295,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
cmVersion::GetPatchVersion(), cmVersion::GetTweakVersion());
if(def)
{
- fprintf(fout, "SET(CMAKE_MODULE_PATH %s)\n", def);
+ fprintf(fout, "set(CMAKE_MODULE_PATH %s)\n", def);
}
std::string projectLangs;
@@ -307,35 +308,35 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
if(const char* rulesOverridePath =
this->Makefile->GetDefinition(rulesOverrideLang.c_str()))
{
- fprintf(fout, "SET(%s \"%s\")\n",
+ 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",
+ fprintf(fout, "set(%s \"%s\")\n",
rulesOverrideBase.c_str(), rulesOverridePath2);
}
}
- fprintf(fout, "PROJECT(CMAKE_TRY_COMPILE%s)\n", projectLangs.c_str());
- fprintf(fout, "SET(CMAKE_VERBOSE_MAKEFILE 1)\n");
+ fprintf(fout, "project(CMAKE_TRY_COMPILE%s)\n", projectLangs.c_str());
+ fprintf(fout, "set(CMAKE_VERBOSE_MAKEFILE 1)\n");
for(std::set<std::string>::iterator li = testLangs.begin();
li != testLangs.end(); ++li)
{
std::string langFlags = "CMAKE_" + *li + "_FLAGS";
const char* flags = this->Makefile->GetDefinition(langFlags.c_str());
- fprintf(fout, "SET(CMAKE_%s_FLAGS %s)\n", li->c_str(),
+ fprintf(fout, "set(CMAKE_%s_FLAGS %s)\n", li->c_str(),
lg->EscapeForCMake(flags?flags:"").c_str());
- fprintf(fout, "SET(CMAKE_%s_FLAGS \"${CMAKE_%s_FLAGS}"
+ fprintf(fout, "set(CMAKE_%s_FLAGS \"${CMAKE_%s_FLAGS}"
" ${COMPILE_DEFINITIONS}\")\n", li->c_str(), li->c_str());
}
- fprintf(fout, "INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES})\n");
- fprintf(fout, "SET(CMAKE_SUPPRESS_REGENERATION 1)\n");
- fprintf(fout, "LINK_DIRECTORIES(${LINK_DIRECTORIES})\n");
+ fprintf(fout, "include_directories(${INCLUDE_DIRECTORIES})\n");
+ fprintf(fout, "set(CMAKE_SUPPRESS_REGENERATION 1)\n");
+ fprintf(fout, "link_directories(${LINK_DIRECTORIES})\n");
// handle any compile flags we need to pass on
if (compileDefs.size())
{
- fprintf(fout, "ADD_DEFINITIONS( ");
+ fprintf(fout, "add_definitions( ");
for (size_t i = 0; i < compileDefs.size(); ++i)
{
fprintf(fout,"%s ",compileDefs[i].c_str());
@@ -406,14 +407,14 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
}
if(this->Makefile->GetDefinition("CMAKE_POSITION_INDEPENDENT_CODE")!=0)
{
- fprintf(fout, "SET(CMAKE_POSITION_INDEPENDENT_CODE \"ON\")\n");
+ fprintf(fout, "set(CMAKE_POSITION_INDEPENDENT_CODE \"ON\")\n");
}
/* Put the executable at a known location (for COPY_FILE). */
- fprintf(fout, "SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"%s\")\n",
+ fprintf(fout, "set(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"%s\")\n",
this->BinaryDirectory.c_str());
/* Create the actual executable. */
- fprintf(fout, "ADD_EXECUTABLE(%s", targetName);
+ fprintf(fout, "add_executable(%s", targetName);
for(std::vector<std::string>::iterator si = sources.begin();
si != sources.end(); ++si)
{
@@ -429,11 +430,11 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
if (useOldLinkLibs)
{
fprintf(fout,
- "TARGET_LINK_LIBRARIES(%s ${LINK_LIBRARIES})\n",targetName);
+ "target_link_libraries(%s ${LINK_LIBRARIES})\n",targetName);
}
else
{
- fprintf(fout, "TARGET_LINK_LIBRARIES(%s %s)\n",
+ fprintf(fout, "target_link_libraries(%s %s)\n",
targetName,
libsToLink.c_str());
}
diff --git a/Source/cmCreateTestSourceList.h b/Source/cmCreateTestSourceList.h
index 3aa0a79..b9c6341 100644
--- a/Source/cmCreateTestSourceList.h
+++ b/Source/cmCreateTestSourceList.h
@@ -15,7 +15,7 @@
#include "cmCommand.h"
/** \class cmCreateTestSourceList
- * \brief
+ * \brief Test driver generation command
*
*/
diff --git a/Source/cmDependsFortranLexer.cxx b/Source/cmDependsFortranLexer.cxx
index 924d9d2..1eff1e4 100644
--- a/Source/cmDependsFortranLexer.cxx
+++ b/Source/cmDependsFortranLexer.cxx
@@ -2165,7 +2165,7 @@ void cmDependsFortran_yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscan
}
/** Set the current line number.
- * @param line_number
+ * @param line_number The line number to set.
* @param yyscanner The scanner object.
*/
void cmDependsFortran_yyset_lineno (int line_number , yyscan_t yyscanner)
@@ -2180,7 +2180,7 @@ void cmDependsFortran_yyset_lineno (int line_number , yyscan_t yyscanner)
}
/** Set the current column.
- * @param line_number
+ * @param column_no The column number to set.
* @param yyscanner The scanner object.
*/
void cmDependsFortran_yyset_column (int column_no , yyscan_t yyscanner)
diff --git a/Source/cmDependsJavaLexer.cxx b/Source/cmDependsJavaLexer.cxx
index 0af44b0..1e505a5 100644
--- a/Source/cmDependsJavaLexer.cxx
+++ b/Source/cmDependsJavaLexer.cxx
@@ -2330,7 +2330,7 @@ void cmDependsJava_yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner
}
/** Set the current line number.
- * @param line_number
+ * @param line_number The line number to set.
* @param yyscanner The scanner object.
*/
void cmDependsJava_yyset_lineno (int line_number , yyscan_t yyscanner)
@@ -2345,7 +2345,7 @@ void cmDependsJava_yyset_lineno (int line_number , yyscan_t yyscanner)
}
/** Set the current column.
- * @param column_no
+ * @param column_no The column number to set.
* @param yyscanner The scanner object.
*/
void cmDependsJava_yyset_column (int column_no , yyscan_t yyscanner)
diff --git a/Source/cmDocumentGeneratorExpressions.h b/Source/cmDocumentGeneratorExpressions.h
index 46cd77e..7bab741 100644
--- a/Source/cmDocumentGeneratorExpressions.h
+++ b/Source/cmDocumentGeneratorExpressions.h
@@ -40,6 +40,9 @@
"is exported using export(), or when the target is used by another " \
"target in the same buildsystem. Expands to the empty string " \
"otherwise.\n" \
+ " $<PLATFORM_ID> = The CMake-id of the platform " \
+ " $<PLATFORM_ID:comp> = '1' if the The CMake-id of the " \
+ "platform matches comp, otherwise '0'.\n" \
" $<C_COMPILER_ID> = The CMake-id of the C compiler " \
"used.\n" \
" $<C_COMPILER_ID:comp> = '1' if the CMake-id of the C " \
diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx
index a2a1bd6..58634ea 100644
--- a/Source/cmDocumentVariables.cxx
+++ b/Source/cmDocumentVariables.cxx
@@ -428,7 +428,7 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"PROJECT command.",false,
"Variables that Provide Information");
cm->DefineProperty
- ("[Project name]_BINARY_DIR", cmProperty::VARIABLE,
+ ("<PROJECT-NAME>_BINARY_DIR", cmProperty::VARIABLE,
"Top level binary directory for the named project.",
"A variable is created with the name used in the PROJECT "
"command, and is the binary directory for the project. "
@@ -436,7 +436,7 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"several projects.",false,
"Variables that Provide Information");
cm->DefineProperty
- ("[Project name]_SOURCE_DIR", cmProperty::VARIABLE,
+ ("<PROJECT-NAME>_SOURCE_DIR", cmProperty::VARIABLE,
"Top level source directory for the named project.",
"A variable is created with the name used in the PROJECT "
"command, and is the source directory for the project."
@@ -1477,7 +1477,7 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"On most compilers this is \"-L\".",false,
"Variables that Control the Build");
cm->DefineProperty
- ("CMAKE_LINK_DEF_FILE_FLAG ", cmProperty::VARIABLE,
+ ("CMAKE_LINK_DEF_FILE_FLAG", cmProperty::VARIABLE,
"Linker flag to be used to specify a .def file for dll creation.",
"The flag will be used to add a .def file when creating "
"a dll on Windows; this is only defined on Windows."
@@ -1563,6 +1563,14 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
false,
"Variables that Control the Build");
cm->DefineProperty
+ ("CMAKE_NO_SYSTEM_FROM_IMPORTED", cmProperty::VARIABLE,
+ "Default value for NO_SYSTEM_FROM_IMPORTED of targets.",
+ "This variable is used to initialize the "
+ "NO_SYSTEM_FROM_IMPORTED property on all the targets. "
+ "See that target property for additional information.",
+ false,
+ "Variables that Control the Build");
+ cm->DefineProperty
("CMAKE_<LANG>_VISIBILITY_PRESET", cmProperty::VARIABLE,
"Default value for <LANG>_VISIBILITY_PRESET of targets.",
"This variable is used to initialize the "
@@ -1578,6 +1586,14 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"See that target property for additional information.",
false,
"Variables that Control the Build");
+ cm->DefineProperty
+ ("CMAKE_MAP_IMPORTED_CONFIG_<CONFIG>", cmProperty::VARIABLE,
+ "Default value for MAP_IMPORTED_CONFIG_<CONFIG> of targets.",
+ "This variable is used to initialize the "
+ "MAP_IMPORTED_CONFIG_<CONFIG> property on all the targets. "
+ "See that target property for additional information.",
+ false,
+ "Variables that Control the Build");
// Variables defined when the a language is enabled These variables will
// also be defined whenever CMake has loaded its support for compiling (LANG)
@@ -1660,6 +1676,28 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"Variables for Languages");
cm->DefineProperty
+ ("CMAKE_<LANG>_SIMULATE_ID", cmProperty::VARIABLE,
+ "Identification string of \"simulated\" compiler.",
+ "Some compilers simulate other compilers to serve as drop-in "
+ "replacements. "
+ "When CMake detects such a compiler it sets this variable to what "
+ "would have been the CMAKE_<LANG>_COMPILER_ID for the simulated "
+ "compiler.",
+ false,
+ "Variables for Languages");
+
+ cm->DefineProperty
+ ("CMAKE_<LANG>_SIMULATE_VERSION", cmProperty::VARIABLE,
+ "Version string of \"simulated\" compiler.",
+ "Some compilers simulate other compilers to serve as drop-in "
+ "replacements. "
+ "When CMake detects such a compiler it sets this variable to what "
+ "would have been the CMAKE_<LANG>_COMPILER_VERSION for the simulated "
+ "compiler.",
+ false,
+ "Variables for Languages");
+
+ cm->DefineProperty
("CMAKE_<LANG>_SIZEOF_DATA_PTR", cmProperty::VARIABLE,
"Size of pointer-to-data types for language <LANG>.",
"This holds the size (in bytes) of pointer-to-data types in the target "
@@ -1854,7 +1892,7 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"Variables for Languages");
cm->DefineProperty
- ("CMAKE_<LANG>_LINK_EXECUTABLE ", cmProperty::VARIABLE,
+ ("CMAKE_<LANG>_LINK_EXECUTABLE", cmProperty::VARIABLE,
"Rule variable to link an executable.",
"Rule variable to link an executable for the given language."
,false,
@@ -1941,8 +1979,6 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
cmProperty::VARIABLE,0,0);
cm->DefineProperty("CMAKE_<LANG>_INFORMATION_LOADED",
cmProperty::VARIABLE,0,0);
- cm->DefineProperty("CMAKE_<LANG>_LINK_EXECUTABLE",
- cmProperty::VARIABLE,0,0);
cm->DefineProperty("CMAKE_<LANG>_LINK_FLAGS",
cmProperty::VARIABLE,0,0);
cm->DefineProperty("CMAKE_<LANG>_RESPONSE_FILE_LINK_FLAG",
diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx
index 4edacbb..58ce36b 100644
--- a/Source/cmDocumentation.cxx
+++ b/Source/cmDocumentation.cxx
@@ -829,10 +829,10 @@ int cmDocumentation::GetStructuredDocFromFile(
std::vector<cmDocumentationEntry>& commands,
cmake* cm)
{
- typedef enum sdoce {
+ enum sdoce {
SDOC_NONE, SDOC_MODULE, SDOC_MACRO, SDOC_FUNCTION, SDOC_VARIABLE,
SDOC_SECTION,
- SDOC_UNKNOWN} sdoc_t;
+ SDOC_UNKNOWN};
int nbDocItemFound = 0;
int docCtxIdx = 0;
std::vector<int> docContextStack(60);
@@ -1617,7 +1617,7 @@ bool cmDocumentation::PrintDocumentationSinglePolicy(std::ostream& os)
return true;
}
- // Argument was not a command. Complain.
+ // Argument was not a policy. Complain.
os << "Argument \"" << this->CurrentArgument.c_str()
<< "\" to --help-policy is not a CMake policy.\n";
return false;
@@ -1639,7 +1639,7 @@ bool cmDocumentation::PrintDocumentationSingleVariable(std::ostream& os)
return true;
}
- // Argument was not a command. Complain.
+ // Argument was not a variable. Complain.
os << "Argument \"" << this->CurrentArgument.c_str()
<< "\" to --help-variable is not a defined variable. "
<< "Use --help-variable-list to see all defined variables.\n";
diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h
index e180f60..218f44d 100644
--- a/Source/cmDocumentation.h
+++ b/Source/cmDocumentation.h
@@ -154,11 +154,11 @@ public:
/**
* Retrieve the list of documented module located in
* path which match the globing expression globExpr.
- * @param[in] path, directory where to start the search
+ * @param[in] path directory where to start the search
* we will recurse into it.
- * @param[in] globExpr, the globing expression used to
+ * @param[in] globExpr the globing expression used to
* match the file in path.
- * @param[out] the list of obtained pairs (may be empty)
+ * @param[out] docModuleList the list of obtained pairs (may be empty)
* @return 0 on success 1 on error or empty list
*/
int getDocumentedModulesListInDir(
@@ -180,10 +180,9 @@ public:
* @param[in] fname the script file name to be parsed for documentation
* @param[in,out] commands the vector of command/macros documentation
* entry found in the script file.
- * @param[in,out] the cmake object instance to which variable documentation
- * will be attached (using @see cmake::DefineProperty)
- * @param[in] the documentation section in which the property will be
- * inserted.
+ * @param[in,out] cm the cmake object instance to which variable
+ * documentation will be attached
+ * (using @see cmake::DefineProperty)
* @return the number of documented items (command and variable)
* found in the file.
*/
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index cdc3316..243e5ce 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -47,6 +47,10 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
}
return false;
}
+ if (te->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ this->GenerateRequiredCMakeVersion(os, "2.8.12.20131007"); // 2.8.13
+ }
}
this->GenerateExpectedTargetsCode(os, expectedTargets);
@@ -118,16 +122,22 @@ cmExportBuildFileGenerator
// Collect import properties for this target.
cmTarget* target = *tei;
ImportPropertyMap properties;
- this->SetImportLocationProperty(config, suffix, target, properties);
+
+ if (target->GetType() != cmTarget::INTERFACE_LIBRARY)
+ {
+ this->SetImportLocationProperty(config, suffix, target, properties);
+ }
if(!properties.empty())
{
// Get the rest of the target details.
- this->SetImportDetailProperties(config, suffix,
- target, properties, missingTargets);
- this->SetImportLinkInterface(config, suffix,
- cmGeneratorExpression::BuildInterface,
- target, properties, missingTargets);
-
+ if (target->GetType() != cmTarget::INTERFACE_LIBRARY)
+ {
+ this->SetImportDetailProperties(config, suffix,
+ target, properties, missingTargets);
+ this->SetImportLinkInterface(config, suffix,
+ cmGeneratorExpression::BuildInterface,
+ target, properties, missingTargets);
+ }
// TOOD: PUBLIC_HEADER_LOCATION
// This should wait until the build feature propagation stuff
diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx
index 4558fb6..837bb39 100644
--- a/Source/cmExportCommand.cxx
+++ b/Source/cmExportCommand.cxx
@@ -130,7 +130,8 @@ bool cmExportCommand
if((target->GetType() == cmTarget::EXECUTABLE) ||
(target->GetType() == cmTarget::STATIC_LIBRARY) ||
(target->GetType() == cmTarget::SHARED_LIBRARY) ||
- (target->GetType() == cmTarget::MODULE_LIBRARY))
+ (target->GetType() == cmTarget::MODULE_LIBRARY) ||
+ (target->GetType() == cmTarget::INTERFACE_LIBRARY))
{
targets.push_back(target);
}
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index ef336ea..25c5710 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -378,11 +378,14 @@ void getCompatibleInterfaceProperties(cmTarget *target,
if (!info)
{
- cmMakefile* mf = target->GetMakefile();
- cmOStringStream e;
- e << "Exporting the target \"" << target->GetName() << "\" is not "
- "allowed since its linker language cannot be determined";
- mf->IssueMessage(cmake::FATAL_ERROR, e.str());
+ if (target->GetType() != cmTarget::INTERFACE_LIBRARY)
+ {
+ cmMakefile* mf = target->GetMakefile();
+ cmOStringStream e;
+ e << "Exporting the target \"" << target->GetName() << "\" is not "
+ "allowed since its linker language cannot be determined";
+ mf->IssueMessage(cmake::FATAL_ERROR, e.str());
+ }
return;
}
@@ -736,9 +739,10 @@ cmExportFileGenerator
"IMPORTED_LINK_INTERFACE_LANGUAGES",
iface->Languages, properties, missingTargets);
+ std::vector<std::string> dummy;
this->SetImportLinkProperty(suffix, target,
"IMPORTED_LINK_DEPENDENT_LIBRARIES",
- iface->SharedDeps, properties, missingTargets);
+ iface->SharedDeps, properties, dummy);
if(iface->Multiplicity > 0)
{
std::string prop = "IMPORTED_LINK_INTERFACE_MULTIPLICITY";
@@ -887,6 +891,9 @@ cmExportFileGenerator
case cmTarget::UNKNOWN_LIBRARY:
os << "add_library(" << targetName << " UNKNOWN IMPORTED)\n";
break;
+ case cmTarget::INTERFACE_LIBRARY:
+ os << "add_library(" << targetName << " INTERFACE IMPORTED)\n";
+ break;
default: // should never happen
break;
}
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index c8b4a79..c71008e 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -114,6 +114,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
std::vector<std::string> missingTargets;
bool require2_8_12 = false;
+ bool require2_8_13 = false;
// Create all the imported targets.
for(std::vector<cmTargetExport*>::const_iterator
tei = allTargets.begin();
@@ -153,6 +154,10 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
require2_8_12 = true;
}
}
+ if (te->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ require2_8_13 = true;
+ }
this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE",
te, properties);
this->PopulateCompatibleInterfaceProperties(te, properties);
@@ -160,7 +165,11 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
this->GenerateInterfaceProperties(te, os, properties);
}
- if (require2_8_12)
+ if (require2_8_13)
+ {
+ this->GenerateRequiredCMakeVersion(os, "2.8.12.20131007");
+ }
+ else if (require2_8_12)
{
this->GenerateRequiredCMakeVersion(os, "2.8.12");
}
@@ -286,6 +295,14 @@ cmExportInstallFileGenerator
cmTargetExport const* te = *tei;
ImportPropertyMap properties;
std::set<std::string> importedLocations;
+ if (!properties.empty()
+ && te->Target->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ this->GenerateImportPropertyCode(os, config, te->Target, properties);
+ this->GenerateImportedFileChecksCode(os, te->Target, properties,
+ importedLocations);
+ continue;
+ }
this->SetImportLocationProperty(config, suffix, te->ArchiveGenerator,
properties, importedLocations);
this->SetImportLocationProperty(config, suffix, te->LibraryGenerator,
diff --git a/Source/cmExportLibraryDependencies.cxx b/Source/cmExportLibraryDependencies.cxx
index f07b783..e3b1626 100644
--- a/Source/cmExportLibraryDependencies.cxx
+++ b/Source/cmExportLibraryDependencies.cxx
@@ -169,7 +169,7 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const
const char* vertest =
"\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" GREATER 2.4";
fout << "# Generated by CMake " << cmVersion::GetCMakeVersion() << "\n\n";
- fout << "IF(" << vertest << ")\n";
+ fout << "if(" << vertest << ")\n";
fout << " # Information for CMake 2.6 and above.\n";
for(std::map<cmStdString, cmStdString>::const_iterator
i = libDepsNew.begin();
@@ -177,10 +177,10 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const
{
if(!i->second.empty())
{
- fout << " SET(\"" << i->first << "\" \"" << i->second << "\")\n";
+ fout << " set(\"" << i->first << "\" \"" << i->second << "\")\n";
}
}
- fout << "ELSE(" << vertest << ")\n";
+ fout << "else()\n";
fout << " # Information for CMake 2.4 and lower.\n";
for(std::map<cmStdString, cmStdString>::const_iterator
i = libDepsOld.begin();
@@ -188,7 +188,7 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const
{
if(!i->second.empty())
{
- fout << " SET(\"" << i->first << "\" \"" << i->second << "\")\n";
+ fout << " set(\"" << i->first << "\" \"" << i->second << "\")\n";
}
}
for(std::map<cmStdString, cmStdString>::const_iterator i = libTypes.begin();
@@ -196,9 +196,9 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const
{
if(i->second != "general")
{
- fout << " SET(\"" << i->first << "\" \"" << i->second << "\")\n";
+ fout << " set(\"" << i->first << "\" \"" << i->second << "\")\n";
}
}
- fout << "ENDIF(" << vertest << ")\n";
+ fout << "endif()\n";
return;
}
diff --git a/Source/cmExprLexer.cxx b/Source/cmExprLexer.cxx
index 9947c77..aa384cd 100644
--- a/Source/cmExprLexer.cxx
+++ b/Source/cmExprLexer.cxx
@@ -1716,7 +1716,7 @@ void cmExpr_yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
}
/** Set the current line number.
- * @param line_number
+ * @param line_number The line number to set.
* @param yyscanner The scanner object.
*/
void cmExpr_yyset_lineno (int line_number , yyscan_t yyscanner)
@@ -1731,7 +1731,7 @@ void cmExpr_yyset_lineno (int line_number , yyscan_t yyscanner)
}
/** Set the current column.
- * @param column_no
+ * @param column_no The column number to set.
* @param yyscanner The scanner object.
*/
void cmExpr_yyset_column (int column_no , yyscan_t yyscanner)
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index d73c72c..97853f3 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -71,7 +71,7 @@ const char *cmCompiledGeneratorExpression::Evaluate(
cmTarget *currentTarget,
cmGeneratorExpressionDAGChecker *dagChecker) const
{
- if (!this->NeedsParsing)
+ if (!this->NeedsEvaluation)
{
return this->Input.c_str();
}
@@ -129,9 +129,9 @@ cmCompiledGeneratorExpression::cmCompiledGeneratorExpression(
cmGeneratorExpressionLexer l;
std::vector<cmGeneratorExpressionToken> tokens =
l.Tokenize(this->Input.c_str());
- this->NeedsParsing = l.GetSawGeneratorExpression();
+ this->NeedsEvaluation = l.GetSawGeneratorExpression();
- if (this->NeedsParsing)
+ if (this->NeedsEvaluation)
{
cmGeneratorExpressionParser p(tokens);
p.Parse(this->Evaluators);
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h
index c20f130..bc0f6c2 100644
--- a/Source/cmGeneratorExpression.h
+++ b/Source/cmGeneratorExpression.h
@@ -126,7 +126,7 @@ private:
cmListFileBacktrace Backtrace;
std::vector<cmGeneratorExpressionEvaluator*> Evaluators;
const std::string Input;
- bool NeedsParsing;
+ bool NeedsEvaluation;
mutable std::set<cmTarget*> DependTargets;
mutable std::set<cmTarget*> AllTargetsSeen;
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index abe4e70..7fd0fdc 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -438,6 +438,39 @@ static const struct CxxCompilerVersionNode : public CompilerVersionNode
//----------------------------------------------------------------------------
+struct PlatformIdNode : public cmGeneratorExpressionNode
+{
+ PlatformIdNode() {}
+
+ virtual int NumExpectedParameters() const { return ZeroOrMoreParameters; }
+
+ std::string Evaluate(const std::vector<std::string> &parameters,
+ cmGeneratorExpressionContext *context,
+ const GeneratorExpressionContent *,
+ cmGeneratorExpressionDAGChecker *) const
+ {
+ const char *platformId = context->Makefile ?
+ context->Makefile->GetSafeDefinition(
+ "CMAKE_SYSTEM_NAME") : "";
+ if (parameters.size() == 0)
+ {
+ return platformId ? platformId : "";
+ }
+
+ if (!platformId)
+ {
+ return parameters.front().empty() ? "1" : "0";
+ }
+
+ if (cmsysString_strcasecmp(parameters.begin()->c_str(), platformId) == 0)
+ {
+ return "1";
+ }
+ return "0";
+ }
+} platformIdNode;
+
+//----------------------------------------------------------------------------
static const struct VersionGreaterNode : public cmGeneratorExpressionNode
{
VersionGreaterNode() {}
@@ -1356,6 +1389,8 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier)
return &cCompilerVersionNode;
else if (identifier == "CXX_COMPILER_VERSION")
return &cxxCompilerVersionNode;
+ else if (identifier == "PLATFORM_ID")
+ return &platformIdNode;
else if (identifier == "CONFIGURATION")
return &configurationNode;
else if (identifier == "CONFIG")
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 2c3834a..eacf85b 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -146,9 +146,17 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang,
const char* cname = this->GetCMakeInstance()->
GetCacheManager()->GetCacheValue(langComp.c_str());
std::string changeVars;
- if(cname && (path != cname) && (optional==false))
+ if(cname && !optional)
{
- std::string cnameString = cname;
+ std::string cnameString;
+ if(!cmSystemTools::FileIsFullPath(cname))
+ {
+ cnameString = cmSystemTools::FindProgram(cname);
+ }
+ else
+ {
+ cnameString = cname;
+ }
std::string pathString = path;
// get rid of potentially multiple slashes:
cmSystemTools::ConvertToUnixSlashes(cnameString);
@@ -2596,6 +2604,10 @@ void cmGlobalGenerator::WriteSummary()
for(std::map<cmStdString,cmTarget *>::const_iterator ti =
this->TotalTargets.begin(); ti != this->TotalTargets.end(); ++ti)
{
+ if ((ti->second)->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ continue;
+ }
this->WriteSummary(ti->second);
fout << ti->second->GetSupportDirectory() << "\n";
}
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 61d0272..e45d024 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -877,7 +877,12 @@ cmGlobalNinjaGenerator
cmTargetDependSet const& targetDeps =
this->GetTargetDirectDepends(*target);
for (cmTargetDependSet::const_iterator i = targetDeps.begin();
- i != targetDeps.end(); ++i) {
+ i != targetDeps.end(); ++i)
+ {
+ if ((*i)->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ continue;
+ }
this->AppendTargetOutputs(*i, outputs);
}
}
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 88cd6e5..9e23ae9 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -281,7 +281,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
// Save the generator name
cmakefileStream
<< "# The generator used is:\n"
- << "SET(CMAKE_DEPENDS_GENERATOR \"" << this->GetName() << "\")\n\n";
+ << "set(CMAKE_DEPENDS_GENERATOR \"" << this->GetName() << "\")\n\n";
// for each cmMakefile get its list of dependencies
std::vector<std::string> lfiles;
@@ -312,7 +312,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
// Save the list to the cmake file.
cmakefileStream
<< "# The top level Makefile was generated from the following files:\n"
- << "SET(CMAKE_MAKEFILE_DEPENDS\n"
+ << "set(CMAKE_MAKEFILE_DEPENDS\n"
<< " \""
<< lg->Convert(cache.c_str(),
cmLocalGenerator::START_OUTPUT).c_str() << "\"\n";
@@ -335,7 +335,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
// Set the corresponding makefile in the cmake file.
cmakefileStream
<< "# The corresponding makefile is:\n"
- << "SET(CMAKE_MAKEFILE_OUTPUTS\n"
+ << "set(CMAKE_MAKEFILE_OUTPUTS\n"
<< " \""
<< lg->Convert(makefileName.c_str(),
cmLocalGenerator::START_OUTPUT).c_str() << "\"\n"
@@ -348,7 +348,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
{
cmakefileStream
<< "# Byproducts of CMake generate step:\n"
- << "SET(CMAKE_MAKEFILE_PRODUCTS\n";
+ << "set(CMAKE_MAKEFILE_PRODUCTS\n";
const std::vector<std::string>& outfiles =
lg->GetMakefile()->GetOutputFiles();
for(std::vector<std::string>::const_iterator k = outfiles.begin();
@@ -390,7 +390,7 @@ void cmGlobalUnixMakefileGenerator3
cmakefileStream
<< "# Dependency information for all targets:\n";
cmakefileStream
- << "SET(CMAKE_DEPEND_INFO_FILES\n";
+ << "set(CMAKE_DEPEND_INFO_FILES\n";
for (unsigned int i = 0; i < lGenerators.size(); ++i)
{
lg = static_cast<cmLocalUnixMakefileGenerator3 *>(lGenerators[i]);
@@ -881,6 +881,10 @@ cmGlobalUnixMakefileGenerator3
for(TargetDependSet::const_iterator di = depends.begin();
di != depends.end(); ++di)
{
+ if ((*di)->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ continue;
+ }
count += this->CountProgressMarksInTarget(*di, emitted);
}
}
@@ -967,6 +971,10 @@ cmGlobalUnixMakefileGenerator3
{
// Create the target-level dependency.
cmTarget const* dep = *i;
+ if (dep->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ continue;
+ }
cmLocalUnixMakefileGenerator3* lg3 =
static_cast<cmLocalUnixMakefileGenerator3*>
(dep->GetMakefile()->GetLocalGenerator());
diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx
index b3fabda..5296248 100644
--- a/Source/cmGlobalVisualStudio6Generator.cxx
+++ b/Source/cmGlobalVisualStudio6Generator.cxx
@@ -200,6 +200,10 @@ void cmGlobalVisualStudio6Generator
tt != orderedProjectTargets.end(); ++tt)
{
cmTarget* target = *tt;
+ if(target->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ continue;
+ }
// Write the project into the DSW file
const char* expath = target->GetProperty("EXTERNAL_MSPROJECT");
if(expath)
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index b475665..65eb3a9 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -392,6 +392,10 @@ void cmGlobalVisualStudio7Generator::WriteTargetDepends(
projectTargets.begin(); tt != projectTargets.end(); ++tt)
{
cmTarget* target = *tt;
+ if(target->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ continue;
+ }
cmMakefile* mf = target->GetMakefile();
const char *vcprojName =
target->GetProperty("GENERATOR_FILE_NAME");
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index e4244e0..92e40a8 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -202,7 +202,7 @@ std::string cmGlobalVisualStudio8Generator::GetUserMacrosRegKeyBase()
}
//----------------------------------------------------------------------------
-void cmGlobalVisualStudio8Generator::AddCheckTarget()
+bool cmGlobalVisualStudio8Generator::AddCheckTarget()
{
// Add a special target on which all other targets depend that
// checks the build system and optionally re-runs CMake.
@@ -216,7 +216,7 @@ void cmGlobalVisualStudio8Generator::AddCheckTarget()
// Skip the target if no regeneration is to be done.
if(mf->IsOn("CMAKE_SUPPRESS_REGENERATION"))
{
- return;
+ return false;
}
std::string cmake_command = mf->GetRequiredDefinition("CMAKE_COMMAND");
@@ -315,21 +315,24 @@ void cmGlobalVisualStudio8Generator::AddCheckTarget()
cmSystemTools::Error("Error adding rule for ", stamps[0].c_str());
}
}
+
+ return true;
}
//----------------------------------------------------------------------------
void cmGlobalVisualStudio8Generator::Generate()
{
- this->AddCheckTarget();
-
- // All targets depend on the build-system check target.
- for(std::map<cmStdString,cmTarget *>::const_iterator
- ti = this->TotalTargets.begin();
- ti != this->TotalTargets.end(); ++ti)
+ if(this->AddCheckTarget())
{
- if(ti->first != CMAKE_CHECK_BUILD_SYSTEM_TARGET)
+ // All targets depend on the build-system check target.
+ for(std::map<cmStdString,cmTarget *>::const_iterator
+ ti = this->TotalTargets.begin();
+ ti != this->TotalTargets.end(); ++ti)
{
- ti->second->AddUtility(CMAKE_CHECK_BUILD_SYSTEM_TARGET);
+ if(ti->first != CMAKE_CHECK_BUILD_SYSTEM_TARGET)
+ {
+ ti->second->AddUtility(CMAKE_CHECK_BUILD_SYSTEM_TARGET);
+ }
}
}
@@ -406,6 +409,10 @@ void cmGlobalVisualStudio8Generator::WriteProjectDepends(
for(OrderedTargetDependSet::const_iterator i = depends.begin();
i != depends.end(); ++i)
{
+ if((*i)->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ continue;
+ }
std::string guid = this->GetGUID((*i)->GetName());
fout << "\t\t{" << guid << "} = {" << guid << "}\n";
}
diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h
index d181742..2376f8a 100644
--- a/Source/cmGlobalVisualStudio8Generator.h
+++ b/Source/cmGlobalVisualStudio8Generator.h
@@ -71,7 +71,7 @@ protected:
virtual bool VSLinksDependencies() const { return false; }
- void AddCheckTarget();
+ bool AddCheckTarget();
static cmIDEFlagTable const* GetExtraFlagTableVS8();
virtual void WriteSLNHeader(std::ostream& fout);
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 5931016..af80070 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -349,6 +349,10 @@ cmGlobalVisualStudioGenerator::GetTargetLinkClosure(cmTarget* target)
void cmGlobalVisualStudioGenerator::FollowLinkDepends(
cmTarget* target, std::set<cmTarget*>& linked)
{
+ if(target->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ return;
+ }
if(linked.insert(target).second &&
target->GetType() == cmTarget::STATIC_LIBRARY)
{
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 0a2b32b..5a0fb07 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -976,6 +976,11 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
continue;
}
+ if(cmtarget.GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ continue;
+ }
+
if(cmtarget.GetType() == cmTarget::UTILITY ||
cmtarget.GetType() == cmTarget::GLOBAL_TARGET)
{
@@ -1686,6 +1691,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
cmXCodeObject* buildSettings,
const char* configName)
{
+ if(target.GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ return;
+ }
+
std::string flags;
std::string defFlags;
bool shared = ((target.GetType() == cmTarget::SHARED_LIBRARY) ||
@@ -2550,6 +2560,10 @@ cmXCodeObject*
cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget,
cmXCodeObject* buildPhases)
{
+ if(cmtarget.GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ return 0;
+ }
cmXCodeObject* target =
this->CreateObject(cmXCodeObject::PBXNativeTarget);
target->AddAttribute("buildPhases", buildPhases);
@@ -2756,6 +2770,10 @@ void cmGlobalXCodeGenerator
::AddDependAndLinkInformation(cmXCodeObject* target)
{
cmTarget* cmtarget = target->GetTarget();
+ if(cmtarget->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ return;
+ }
if(!cmtarget)
{
cmSystemTools::Error("Error no target on xobject\n");
@@ -2867,7 +2885,8 @@ void cmGlobalXCodeGenerator
{
linkLibs += this->XCodeEscapePath(li->Value.c_str());
}
- else
+ else if (!li->Target
+ || li->Target->GetType() != cmTarget::INTERFACE_LIBRARY)
{
linkLibs += li->Value;
}
@@ -2909,6 +2928,10 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
{
continue;
}
+ if(cmtarget.GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ continue;
+ }
// add the soon to be generated Info.plist file as a source for a
// MACOSX_BUNDLE file
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
index 4816da9..3a7070e 100644
--- a/Source/cmGraphVizWriter.cxx
+++ b/Source/cmGraphVizWriter.cxx
@@ -534,8 +534,8 @@ int cmGraphVizWriter::CollectAllExternalLibs(int cnt)
ostr << this->GraphNodePrefix << cnt++;
this->TargetNamesNodes[libName] = ostr.str();
this->TargetPtrs[libName] = NULL;
- //str << " \"" << ostr.c_str() << "\" [ label=\"" << libName
- //<< "\" shape=\"ellipse\"];" << std::endl;
+ // str << " \"" << ostr.c_str() << "\" [ label=\"" << libName
+ // << "\" shape=\"ellipse\"];" << std::endl;
}
}
}
diff --git a/Source/cmIncludeCommand.h b/Source/cmIncludeCommand.h
index d97b7c3..8ff8b20 100644
--- a/Source/cmIncludeCommand.h
+++ b/Source/cmIncludeCommand.h
@@ -15,9 +15,7 @@
#include "cmCommand.h"
/** \class cmIncludeCommand
- * \brief
- *
- * cmIncludeCommand defines a list of distant
+ * \brief cmIncludeCommand defines a list of distant
* files that can be "included" in the current list file.
* In almost every sense, this is identical to a C/C++
* #include command. Arguments are first expended as usual.
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index 3c76bd6..d309a2a 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -379,7 +379,8 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
target->GetType() != cmTarget::STATIC_LIBRARY &&
target->GetType() != cmTarget::SHARED_LIBRARY &&
target->GetType() != cmTarget::MODULE_LIBRARY &&
- target->GetType() != cmTarget::OBJECT_LIBRARY)
+ target->GetType() != cmTarget::OBJECT_LIBRARY &&
+ target->GetType() != cmTarget::INTERFACE_LIBRARY)
{
cmOStringStream e;
e << "TARGETS given target \"" << (*targetIt)
@@ -626,6 +627,11 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
}
}
break;
+ case cmTarget::INTERFACE_LIBRARY:
+ // Nothing to do. An INTERFACE_LIBRARY can be installed, but the
+ // only effect of that is to make it exportable. It installs no
+ // other files itself.
+ break;
default:
// This should never happen due to the above type check.
// Ignore the case.
diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx
index 3e9e6ac..1287ea6 100644
--- a/Source/cmInstallExportGenerator.cxx
+++ b/Source/cmInstallExportGenerator.cxx
@@ -183,11 +183,11 @@ cmInstallExportGenerator::GenerateScriptConfigs(std::ostream& os,
{
files.push_back(i->second);
std::string config_test = this->CreateConfigTest(i->first.c_str());
- os << indent << "IF(" << config_test << ")\n";
+ os << indent << "if(" << config_test << ")\n";
this->AddInstallRule(os, cmInstallType_FILES, files, false,
this->FilePermissions.c_str(), 0, 0, 0,
indent.Next());
- os << indent << "ENDIF(" << config_test << ")\n";
+ os << indent << "endif()\n";
files.clear();
}
}
@@ -202,23 +202,23 @@ void cmInstallExportGenerator::GenerateScriptActions(std::ostream& os,
installedDir += "/";
std::string installedFile = installedDir;
installedFile += this->FileName;
- os << indent << "IF(EXISTS \"" << installedFile << "\")\n";
+ os << indent << "if(EXISTS \"" << installedFile << "\")\n";
Indent indentN = indent.Next();
Indent indentNN = indentN.Next();
Indent indentNNN = indentNN.Next();
- os << indentN << "FILE(DIFFERENT EXPORT_FILE_CHANGED FILES\n"
+ os << indentN << "file(DIFFERENT EXPORT_FILE_CHANGED FILES\n"
<< indentN << " \"" << installedFile << "\"\n"
<< indentN << " \"" << this->MainImportFile << "\")\n";
- os << indentN << "IF(EXPORT_FILE_CHANGED)\n";
- os << indentNN << "FILE(GLOB OLD_CONFIG_FILES \"" << installedDir
+ os << indentN << "if(EXPORT_FILE_CHANGED)\n";
+ os << indentNN << "file(GLOB OLD_CONFIG_FILES \"" << installedDir
<< this->EFGen->GetConfigImportFileGlob() << "\")\n";
- os << indentNN << "IF(OLD_CONFIG_FILES)\n";
- os << indentNNN << "MESSAGE(STATUS \"Old export file \\\"" << installedFile
+ os << indentNN << "if(OLD_CONFIG_FILES)\n";
+ os << indentNNN << "message(STATUS \"Old export file \\\"" << installedFile
<< "\\\" will be replaced. Removing files [${OLD_CONFIG_FILES}].\")\n";
- os << indentNNN << "FILE(REMOVE ${OLD_CONFIG_FILES})\n";
- os << indentNN << "ENDIF(OLD_CONFIG_FILES)\n";
- os << indentN << "ENDIF(EXPORT_FILE_CHANGED)\n";
- os << indent << "ENDIF()\n";
+ os << indentNNN << "file(REMOVE ${OLD_CONFIG_FILES})\n";
+ os << indentNN << "endif()\n";
+ os << indentN << "endif()\n";
+ os << indent << "endif()\n";
// Install the main export file.
std::vector<std::string> files;
diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx
index 3be2c2b..d105a0c 100644
--- a/Source/cmInstallGenerator.cxx
+++ b/Source/cmInstallGenerator.cxx
@@ -80,18 +80,18 @@ void cmInstallGenerator
}
}
os << "\")\n";
- os << indent << "IF (CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION)\n";
+ os << indent << "if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION)\n";
os << indent << indent << "message(WARNING \"ABSOLUTE path INSTALL "
<< "DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}\")\n";
- os << indent << "ENDIF (CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION)\n";
+ os << indent << "endif()\n";
- os << indent << "IF (CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION)\n";
+ os << indent << "if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION)\n";
os << indent << indent << "message(FATAL_ERROR \"ABSOLUTE path INSTALL "
<< "DESTINATION forbidden (by caller): "
<< "${CMAKE_ABSOLUTE_DESTINATION_FILES}\")\n";
- os << indent << "ENDIF (CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION)\n";
+ os << indent << "endif()\n";
}
- os << "FILE(INSTALL DESTINATION \"" << dest << "\" TYPE " << stype.c_str();
+ os << "file(INSTALL DESTINATION \"" << dest << "\" TYPE " << stype.c_str();
if(optional)
{
os << " OPTIONAL";
@@ -153,13 +153,13 @@ void cmInstallGenerator::GenerateScript(std::ostream& os)
// Begin this block of installation.
std::string component_test =
this->CreateComponentTest(this->Component.c_str());
- os << indent << "IF(" << component_test << ")\n";
+ os << indent << "if(" << component_test << ")\n";
// Generate the script possibly with per-configuration code.
this->GenerateScriptConfigs(os, indent.Next());
// End this block of installation.
- os << indent << "ENDIF(" << component_test << ")\n\n";
+ os << indent << "endif()\n\n";
}
//----------------------------------------------------------------------------
diff --git a/Source/cmInstallScriptGenerator.cxx b/Source/cmInstallScriptGenerator.cxx
index bcfbe63..1ecf021 100644
--- a/Source/cmInstallScriptGenerator.cxx
+++ b/Source/cmInstallScriptGenerator.cxx
@@ -32,7 +32,7 @@ void cmInstallScriptGenerator::GenerateScript(std::ostream& os)
Indent indent;
std::string component_test =
this->CreateComponentTest(this->Component.c_str());
- os << indent << "IF(" << component_test << ")\n";
+ os << indent << "if(" << component_test << ")\n";
if(this->Code)
{
@@ -40,8 +40,8 @@ void cmInstallScriptGenerator::GenerateScript(std::ostream& os)
}
else
{
- os << indent.Next() << "INCLUDE(\"" << this->Script << "\")\n";
+ os << indent.Next() << "include(\"" << this->Script << "\")\n";
}
- os << indent << "ENDIF(" << component_test << ")\n\n";
+ os << indent << "endif()\n\n";
}
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index c9624c8..7b9109e 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -90,6 +90,11 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
case cmTarget::STATIC_LIBRARY: type = cmInstallType_STATIC_LIBRARY; break;
case cmTarget::SHARED_LIBRARY: type = cmInstallType_SHARED_LIBRARY; break;
case cmTarget::MODULE_LIBRARY: type = cmInstallType_MODULE_LIBRARY; break;
+ case cmTarget::INTERFACE_LIBRARY:
+ // Not reachable. We never create a cmInstallTargetGenerator for
+ // an INTERFACE_LIBRARY.
+ assert(!"INTERFACE_LIBRARY targets have no installable outputs.");
+ break;
case cmTarget::OBJECT_LIBRARY:
case cmTarget::UTILITY:
case cmTarget::GLOBAL_TARGET:
@@ -407,10 +412,10 @@ cmInstallTargetGenerator
std::string tws = tw.str();
if(!tws.empty())
{
- os << indent << "IF(EXISTS \"" << file << "\" AND\n"
+ os << indent << "if(EXISTS \"" << file << "\" AND\n"
<< indent << " NOT IS_SYMLINK \"" << file << "\")\n";
os << tws;
- os << indent << "ENDIF()\n";
+ os << indent << "endif()\n";
}
}
@@ -434,7 +439,7 @@ cmInstallTargetGenerator
if(!tws.empty())
{
Indent indent2 = indent.Next().Next();
- os << indent << "FOREACH(file\n";
+ os << indent << "foreach(file\n";
for(std::vector<std::string>::const_iterator i = files.begin();
i != files.end(); ++i)
{
@@ -442,7 +447,7 @@ cmInstallTargetGenerator
}
os << indent2 << ")\n";
os << tws;
- os << indent << "ENDFOREACH()\n";
+ os << indent << "endforeach()\n";
}
}
}
@@ -577,7 +582,7 @@ cmInstallTargetGenerator
// install_name value and references.
if(!new_id.empty() || !install_name_remap.empty())
{
- os << indent << "EXECUTE_PROCESS(COMMAND \"" << installNameTool;
+ os << indent << "execute_process(COMMAND \"" << installNameTool;
os << "\"";
if(!new_id.empty())
{
@@ -626,7 +631,7 @@ cmInstallTargetGenerator
// Write a rule to remove the installed file if its rpath is not the
// new rpath. This is needed for existing build/install trees when
// the installed rpath changes but the file is not rebuilt.
- os << indent << "FILE(RPATH_CHECK\n"
+ os << indent << "file(RPATH_CHECK\n"
<< indent << " FILE \"" << toDestDirPath << "\"\n"
<< indent << " RPATH \"" << newRpath << "\")\n";
}
@@ -697,12 +702,12 @@ cmInstallTargetGenerator
// Write a rule to run chrpath to set the install-tree RPATH
if(newRpath.empty())
{
- os << indent << "FILE(RPATH_REMOVE\n"
+ os << indent << "file(RPATH_REMOVE\n"
<< indent << " FILE \"" << toDestDirPath << "\")\n";
}
else
{
- os << indent << "FILE(RPATH_CHANGE\n"
+ os << indent << "file(RPATH_CHANGE\n"
<< indent << " FILE \"" << toDestDirPath << "\"\n"
<< indent << " OLD_RPATH \"" << oldRpath << "\"\n"
<< indent << " NEW_RPATH \"" << newRpath << "\")\n";
@@ -736,11 +741,11 @@ cmInstallTargetGenerator::AddStripRule(std::ostream& os,
return;
}
- os << indent << "IF(CMAKE_INSTALL_DO_STRIP)\n";
- os << indent << " EXECUTE_PROCESS(COMMAND \""
+ os << indent << "if(CMAKE_INSTALL_DO_STRIP)\n";
+ os << indent << " execute_process(COMMAND \""
<< this->Target->GetMakefile()->GetDefinition("CMAKE_STRIP")
<< "\" \"" << toDestDirPath << "\")\n";
- os << indent << "ENDIF(CMAKE_INSTALL_DO_STRIP)\n";
+ os << indent << "endif()\n";
}
//----------------------------------------------------------------------------
@@ -769,6 +774,6 @@ cmInstallTargetGenerator::AddRanlibRule(std::ostream& os,
return;
}
- os << indent << "EXECUTE_PROCESS(COMMAND \""
+ os << indent << "execute_process(COMMAND \""
<< ranlib << "\" \"" << toDestDirPath << "\")\n";
}
diff --git a/Source/cmListFileLexer.c b/Source/cmListFileLexer.c
index 2841fe5..f127add 100644
--- a/Source/cmListFileLexer.c
+++ b/Source/cmListFileLexer.c
@@ -2271,6 +2271,7 @@ static void cmListFileLexerInit(cmListFileLexer* lexer)
/*--------------------------------------------------------------------------*/
static void cmListFileLexerDestroy(cmListFileLexer* lexer)
{
+ cmListFileLexerSetToken(lexer, 0, 0);
if(lexer->file || lexer->string_buffer)
{
cmListFileLexer_yylex_destroy(lexer->scanner);
diff --git a/Source/cmListFileLexer.in.l b/Source/cmListFileLexer.in.l
index 12b53ee..bd3c1eb 100644
--- a/Source/cmListFileLexer.in.l
+++ b/Source/cmListFileLexer.in.l
@@ -292,6 +292,7 @@ static void cmListFileLexerInit(cmListFileLexer* lexer)
/*--------------------------------------------------------------------------*/
static void cmListFileLexerDestroy(cmListFileLexer* lexer)
{
+ cmListFileLexerSetToken(lexer, 0, 0);
if(lexer->file || lexer->string_buffer)
{
cmListFileLexer_yylex_destroy(lexer->scanner);
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 9c04109..b4cb5bd 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -297,7 +297,7 @@ void cmLocalGenerator::GenerateTestFiles()
this->Makefile->GetProperty("TEST_INCLUDE_FILE");
if ( testIncludeFile )
{
- fout << "INCLUDE(\"" << testIncludeFile << "\")" << std::endl;
+ fout << "include(\"" << testIncludeFile << "\")" << std::endl;
}
// Ask each test generator to write its code.
@@ -313,7 +313,8 @@ void cmLocalGenerator::GenerateTestFiles()
size_t i;
for(i = 0; i < this->Children.size(); ++i)
{
- fout << "SUBDIRS(";
+ // TODO: Use add_subdirectory instead?
+ fout << "subdirs(";
std::string outP =
this->Children[i]->GetMakefile()->GetStartOutputDirectory();
fout << this->Convert(outP.c_str(),START_OUTPUT);
@@ -416,39 +417,39 @@ void cmLocalGenerator::GenerateInstallRules()
fout << "# Install script for directory: "
<< this->Makefile->GetCurrentDirectory() << std::endl << std::endl;
fout << "# Set the install prefix" << std::endl
- << "IF(NOT DEFINED CMAKE_INSTALL_PREFIX)" << std::endl
- << " SET(CMAKE_INSTALL_PREFIX \"" << prefix << "\")" << std::endl
- << "ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX)" << std::endl
- << "STRING(REGEX REPLACE \"/$\" \"\" CMAKE_INSTALL_PREFIX "
+ << "if(NOT DEFINED CMAKE_INSTALL_PREFIX)" << std::endl
+ << " set(CMAKE_INSTALL_PREFIX \"" << prefix << "\")" << std::endl
+ << "endif()" << std::endl
+ << "string(REGEX REPLACE \"/$\" \"\" CMAKE_INSTALL_PREFIX "
<< "\"${CMAKE_INSTALL_PREFIX}\")" << std::endl
<< std::endl;
// Write support code for generating per-configuration install rules.
fout <<
"# Set the install configuration name.\n"
- "IF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)\n"
- " IF(BUILD_TYPE)\n"
- " STRING(REGEX REPLACE \"^[^A-Za-z0-9_]+\" \"\"\n"
+ "if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)\n"
+ " if(BUILD_TYPE)\n"
+ " string(REGEX REPLACE \"^[^A-Za-z0-9_]+\" \"\"\n"
" CMAKE_INSTALL_CONFIG_NAME \"${BUILD_TYPE}\")\n"
- " ELSE(BUILD_TYPE)\n"
- " SET(CMAKE_INSTALL_CONFIG_NAME \"" << default_config << "\")\n"
- " ENDIF(BUILD_TYPE)\n"
- " MESSAGE(STATUS \"Install configuration: "
+ " else()\n"
+ " set(CMAKE_INSTALL_CONFIG_NAME \"" << default_config << "\")\n"
+ " endif()\n"
+ " message(STATUS \"Install configuration: "
"\\\"${CMAKE_INSTALL_CONFIG_NAME}\\\"\")\n"
- "ENDIF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)\n"
+ "endif()\n"
"\n";
// Write support code for dealing with component-specific installs.
fout <<
"# Set the component getting installed.\n"
- "IF(NOT CMAKE_INSTALL_COMPONENT)\n"
- " IF(COMPONENT)\n"
- " MESSAGE(STATUS \"Install component: \\\"${COMPONENT}\\\"\")\n"
- " SET(CMAKE_INSTALL_COMPONENT \"${COMPONENT}\")\n"
- " ELSE(COMPONENT)\n"
- " SET(CMAKE_INSTALL_COMPONENT)\n"
- " ENDIF(COMPONENT)\n"
- "ENDIF(NOT CMAKE_INSTALL_COMPONENT)\n"
+ "if(NOT CMAKE_INSTALL_COMPONENT)\n"
+ " if(COMPONENT)\n"
+ " message(STATUS \"Install component: \\\"${COMPONENT}\\\"\")\n"
+ " set(CMAKE_INSTALL_COMPONENT \"${COMPONENT}\")\n"
+ " else()\n"
+ " set(CMAKE_INSTALL_COMPONENT)\n"
+ " endif()\n"
+ "endif()\n"
"\n";
// Copy user-specified install options to the install code.
@@ -457,9 +458,9 @@ void cmLocalGenerator::GenerateInstallRules()
{
fout <<
"# Install shared libraries without execute permission?\n"
- "IF(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)\n"
- " SET(CMAKE_INSTALL_SO_NO_EXE \"" << so_no_exe << "\")\n"
- "ENDIF(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)\n"
+ "if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)\n"
+ " set(CMAKE_INSTALL_SO_NO_EXE \"" << so_no_exe << "\")\n"
+ "endif()\n"
"\n";
}
@@ -479,7 +480,7 @@ void cmLocalGenerator::GenerateInstallRules()
// Include install scripts from subdirectories.
if(!this->Children.empty())
{
- fout << "IF(NOT CMAKE_INSTALL_LOCAL_ONLY)\n";
+ fout << "if(NOT CMAKE_INSTALL_LOCAL_ONLY)\n";
fout << " # Include the install script for each subdirectory.\n";
for(std::vector<cmLocalGenerator*>::const_iterator
ci = this->Children.begin(); ci != this->Children.end(); ++ci)
@@ -488,34 +489,34 @@ void cmLocalGenerator::GenerateInstallRules()
{
std::string odir = (*ci)->GetMakefile()->GetStartOutputDirectory();
cmSystemTools::ConvertToUnixSlashes(odir);
- fout << " INCLUDE(\"" << odir.c_str()
+ fout << " include(\"" << odir.c_str()
<< "/cmake_install.cmake\")" << std::endl;
}
}
fout << "\n";
- fout << "ENDIF(NOT CMAKE_INSTALL_LOCAL_ONLY)\n\n";
+ fout << "endif()\n\n";
}
// Record the install manifest.
if ( toplevel_install )
{
fout <<
- "IF(CMAKE_INSTALL_COMPONENT)\n"
- " SET(CMAKE_INSTALL_MANIFEST \"install_manifest_"
+ "if(CMAKE_INSTALL_COMPONENT)\n"
+ " set(CMAKE_INSTALL_MANIFEST \"install_manifest_"
"${CMAKE_INSTALL_COMPONENT}.txt\")\n"
- "ELSE(CMAKE_INSTALL_COMPONENT)\n"
- " SET(CMAKE_INSTALL_MANIFEST \"install_manifest.txt\")\n"
- "ENDIF(CMAKE_INSTALL_COMPONENT)\n\n";
+ "else()\n"
+ " set(CMAKE_INSTALL_MANIFEST \"install_manifest.txt\")\n"
+ "endif()\n\n";
fout
- << "FILE(WRITE \""
+ << "file(WRITE \""
<< homedir.c_str() << "/${CMAKE_INSTALL_MANIFEST}\" "
<< "\"\")" << std::endl;
fout
- << "FOREACH(file ${CMAKE_INSTALL_MANIFEST_FILES})" << std::endl
- << " FILE(APPEND \""
+ << "foreach(file ${CMAKE_INSTALL_MANIFEST_FILES})" << std::endl
+ << " file(APPEND \""
<< homedir.c_str() << "/${CMAKE_INSTALL_MANIFEST}\" "
<< "\"${file}\\n\")" << std::endl
- << "ENDFOREACH(file)" << std::endl;
+ << "endforeach()" << std::endl;
}
}
@@ -1793,6 +1794,10 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
ItemVector const& items = cli.GetItems();
for(ItemVector::const_iterator li = items.begin(); li != items.end(); ++li)
{
+ if(li->Target && li->Target->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ continue;
+ }
if(li->IsPath)
{
linkLibs += this->ConvertToLinkReference(li->Value);
@@ -1996,6 +2001,10 @@ bool cmLocalGenerator::GetRealDependency(const char* inName,
// An object library has no single file on which to depend.
// This was listed to get the target-level dependency.
return false;
+ case cmTarget::INTERFACE_LIBRARY:
+ // An interface library has no file on which to depend.
+ // This was listed to get the target-level dependency.
+ return false;
case cmTarget::UTILITY:
case cmTarget::GLOBAL_TARGET:
// A utility target has no file on which to depend. This was listed
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index a522e37..89b05d7 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -17,7 +17,6 @@
#include "cmNinjaTargetGenerator.h"
#include "cmGeneratedFileStream.h"
#include "cmSourceFile.h"
-#include "cmComputeLinkInformation.h"
#include "cmake.h"
#include <assert.h>
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 56da1f9..2443583 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -474,9 +474,9 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile()
// Setup relative path conversion tops.
infoFileStream
<< "# Relative path conversion top directories.\n"
- << "SET(CMAKE_RELATIVE_PATH_TOP_SOURCE \"" << this->RelativePathTopSource
+ << "set(CMAKE_RELATIVE_PATH_TOP_SOURCE \"" << this->RelativePathTopSource
<< "\")\n"
- << "SET(CMAKE_RELATIVE_PATH_TOP_BINARY \"" << this->RelativePathTopBinary
+ << "set(CMAKE_RELATIVE_PATH_TOP_BINARY \"" << this->RelativePathTopBinary
<< "\")\n"
<< "\n";
@@ -485,7 +485,7 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile()
{
infoFileStream
<< "# Force unix paths in dependencies.\n"
- << "SET(CMAKE_FORCE_UNIX_PATHS 1)\n"
+ << "set(CMAKE_FORCE_UNIX_PATHS 1)\n"
<< "\n";
}
@@ -495,21 +495,21 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile()
<< "# The C and CXX include file regular expressions for "
<< "this directory.\n";
infoFileStream
- << "SET(CMAKE_C_INCLUDE_REGEX_SCAN ";
+ << "set(CMAKE_C_INCLUDE_REGEX_SCAN ";
this->WriteCMakeArgument(infoFileStream,
this->Makefile->GetIncludeRegularExpression());
infoFileStream
<< ")\n";
infoFileStream
- << "SET(CMAKE_C_INCLUDE_REGEX_COMPLAIN ";
+ << "set(CMAKE_C_INCLUDE_REGEX_COMPLAIN ";
this->WriteCMakeArgument(infoFileStream,
this->Makefile->GetComplainRegularExpression());
infoFileStream
<< ")\n";
infoFileStream
- << "SET(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN})\n";
+ << "set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN})\n";
infoFileStream
- << "SET(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN "
+ << "set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN "
"${CMAKE_C_INCLUDE_REGEX_COMPLAIN})\n";
}
@@ -1176,7 +1176,7 @@ cmLocalUnixMakefileGenerator3
{
cmSystemTools::Error("Could not create ", cleanfilePath.c_str());
}
- fout << "FILE(REMOVE_RECURSE\n";
+ fout << "file(REMOVE_RECURSE\n";
std::string remove = "$(CMAKE_COMMAND) -P ";
remove += this->Convert(cleanfile.c_str(), START_OUTPUT, SHELL);
for(std::vector<std::string>::const_iterator f = files.begin();
@@ -1196,16 +1196,16 @@ cmLocalUnixMakefileGenerator3
target.GetLanguages(languages);
fout << "\n"
<< "# Per-language clean rules from dependency scanning.\n"
- << "FOREACH(lang";
+ << "foreach(lang";
for(std::set<cmStdString>::const_iterator l = languages.begin();
l != languages.end(); ++l)
{
fout << " " << *l;
}
fout << ")\n"
- << " INCLUDE(" << this->GetTargetDirectory(target)
+ << " include(" << this->GetTargetDirectory(target)
<< "/cmake_clean_${lang}.cmake OPTIONAL)\n"
- << "ENDFOREACH(lang)\n";
+ << "endforeach()\n";
}
}
}
@@ -1915,7 +1915,7 @@ void cmLocalUnixMakefileGenerator3
cmakefileStream
<< "# The set of languages for which implicit dependencies are needed:\n";
cmakefileStream
- << "SET(CMAKE_DEPENDS_LANGUAGES\n";
+ << "set(CMAKE_DEPENDS_LANGUAGES\n";
for(ImplicitDependLanguageMap::const_iterator
l = implicitLangs.begin(); l != implicitLangs.end(); ++l)
{
@@ -1930,7 +1930,7 @@ void cmLocalUnixMakefileGenerator3
l = implicitLangs.begin(); l != implicitLangs.end(); ++l)
{
cmakefileStream
- << "SET(CMAKE_DEPENDS_CHECK_" << l->first.c_str() << "\n";
+ << "set(CMAKE_DEPENDS_CHECK_" << l->first.c_str() << "\n";
ImplicitDependFileMap const& implicitPairs = l->second;
// for each file pair
@@ -1954,7 +1954,7 @@ void cmLocalUnixMakefileGenerator3
if(cid && *cid)
{
cmakefileStream
- << "SET(CMAKE_" << l->first.c_str() << "_COMPILER_ID \""
+ << "set(CMAKE_" << l->first.c_str() << "_COMPILER_ID \""
<< cid << "\")\n";
}
}
@@ -1968,7 +1968,7 @@ void cmLocalUnixMakefileGenerator3
cmakefileStream
<< "\n"
<< "# Preprocessor definitions for this target.\n"
- << "SET(CMAKE_TARGET_DEFINITIONS\n";
+ << "set(CMAKE_TARGET_DEFINITIONS\n";
for(std::set<std::string>::const_iterator di = defines.begin();
di != defines.end(); ++di)
{
@@ -1995,7 +1995,7 @@ void cmLocalUnixMakefileGenerator3
if(!transformRules.empty())
{
cmakefileStream
- << "SET(CMAKE_INCLUDE_TRANSFORMS\n";
+ << "set(CMAKE_INCLUDE_TRANSFORMS\n";
for(std::vector<std::string>::const_iterator tri = transformRules.begin();
tri != transformRules.end(); ++tri)
{
diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx
index c3789a0..aedd6ed 100644
--- a/Source/cmLocalVisualStudio10Generator.cxx
+++ b/Source/cmLocalVisualStudio10Generator.cxx
@@ -76,6 +76,10 @@ void cmLocalVisualStudio10Generator::Generate()
cmTargets &tgts = this->Makefile->GetTargets();
for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l)
{
+ if(l->second.GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ continue;
+ }
if(static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator)
->TargetIsFortranOnly(l->second))
{
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index e5b4057..a665b93 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -91,6 +91,11 @@ void cmLocalVisualStudio6Generator::AddCMakeListsRules()
for(cmTargets::iterator l = tgts.begin();
l != tgts.end(); l++)
{
+ if (l->second.GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ continue;
+ }
+
// Add a rule to regenerate the build system when the target
// specification source changes.
const char* suppRegenRule =
@@ -146,8 +151,10 @@ void cmLocalVisualStudio6Generator::OutputDSPFile()
case cmTarget::GLOBAL_TARGET:
this->SetBuildType(UTILITY, l->first.c_str(), l->second);
break;
+ case cmTarget::INTERFACE_LIBRARY:
+ continue;
default:
- cmSystemTools::Error("Bad target type", l->first.c_str());
+ cmSystemTools::Error("Bad target type: ", l->first.c_str());
break;
}
// INCLUDE_EXTERNAL_MSPROJECT command only affects the workspace
@@ -165,7 +172,7 @@ void cmLocalVisualStudio6Generator::OutputDSPFile()
dir += l->first.substr(0, pos);
if(!cmSystemTools::MakeDirectory(dir.c_str()))
{
- cmSystemTools::Error("Error creating directory ", dir.c_str());
+ cmSystemTools::Error("Error creating directory: ", dir.c_str());
}
}
this->CreateSingleDSP(l->first.c_str(),l->second);
@@ -1839,7 +1846,8 @@ void cmLocalVisualStudio6Generator
options +=
this->ConvertToOptionallyRelativeOutputPath(l->Value.c_str());
}
- else
+ else if (!l->Target
+ || l->Target->GetType() != cmTarget::INTERFACE_LIBRARY)
{
options += l->Value;
}
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index bd6c860..64de448 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -78,6 +78,10 @@ void cmLocalVisualStudio7Generator::AddHelperCommands()
static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator);
for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++)
{
+ if(l->second.GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ continue;
+ }
const char* path = l->second.GetProperty("EXTERNAL_MSPROJECT");
if(path)
{
@@ -181,6 +185,10 @@ void cmLocalVisualStudio7Generator::WriteProjectFiles()
for(cmTargets::iterator l = tgts.begin();
l != tgts.end(); l++)
{
+ if(l->second.GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ continue;
+ }
// INCLUDE_EXTERNAL_MSPROJECT command only affects the workspace
// so don't build a projectfile for it
if(!l->second.GetProperty("EXTERNAL_MSPROJECT"))
@@ -1258,6 +1266,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
}
case cmTarget::UTILITY:
case cmTarget::GLOBAL_TARGET:
+ case cmTarget::INTERFACE_LIBRARY:
break;
}
}
@@ -1288,7 +1297,8 @@ cmLocalVisualStudio7GeneratorInternals
cmLocalGenerator::UNCHANGED);
fout << lg->ConvertToXMLOutputPath(rel.c_str()) << " ";
}
- else
+ else if (!l->Target
+ || l->Target->GetType() != cmTarget::INTERFACE_LIBRARY)
{
fout << l->Value << " ";
}
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 34541e9..40e55c2 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1463,6 +1463,7 @@ void cmMakefile::AddLinkLibraryForTarget(const char *target,
// if it is not a static or shared library then you can not link to it
if(!((tgt->GetType() == cmTarget::STATIC_LIBRARY) ||
(tgt->GetType() == cmTarget::SHARED_LIBRARY) ||
+ (tgt->GetType() == cmTarget::INTERFACE_LIBRARY) ||
tgt->IsExecutableWithExports()))
{
cmOStringStream e;
@@ -1990,6 +1991,7 @@ void cmMakefile::AddGlobalLinkInformation(const char* name, cmTarget& target)
{
case cmTarget::UTILITY:
case cmTarget::GLOBAL_TARGET:
+ case cmTarget::INTERFACE_LIBRARY:
return;
default:;
}
@@ -2017,7 +2019,8 @@ cmTarget* cmMakefile::AddLibrary(const char* lname, cmTarget::TargetType type,
if ( (type != cmTarget::STATIC_LIBRARY)
&& (type != cmTarget::SHARED_LIBRARY)
&& (type != cmTarget::MODULE_LIBRARY)
- && (type != cmTarget::OBJECT_LIBRARY))
+ && (type != cmTarget::OBJECT_LIBRARY)
+ && (type != cmTarget::INTERFACE_LIBRARY))
{
this->IssueMessage(cmake::INTERNAL_ERROR,
"cmMakefile::AddLibrary given invalid target type.");
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 0829cab..42091e3 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -21,6 +21,7 @@
#include "cmTarget.h"
#include "cmake.h"
#include "cmComputeLinkInformation.h"
+#include "cmGeneratorExpression.h"
#include "cmMakefileExecutableTargetGenerator.h"
#include "cmMakefileLibraryTargetGenerator.h"
@@ -131,7 +132,14 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
this->Makefile->GetProperty
("ADDITIONAL_MAKE_CLEAN_FILES"))
{
- cmSystemTools::ExpandListArgument(additional_clean_files,
+ const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE");
+ cmListFileBacktrace lfbt;
+ cmGeneratorExpression ge(lfbt);
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
+ ge.Parse(additional_clean_files);
+
+ cmSystemTools::ExpandListArgument(cge->Evaluate(this->Makefile, config,
+ false, this->Target, 0, 0),
this->CleanFiles);
}
@@ -968,7 +976,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
*this->InfoFileStream
<< "\n"
<< "# Pairs of files generated by the same build rule.\n"
- << "SET(CMAKE_MULTIPLE_OUTPUT_PAIRS\n";
+ << "set(CMAKE_MULTIPLE_OUTPUT_PAIRS\n";
for(MultipleOutputPairsType::const_iterator pi =
this->MultipleOutputPairs.begin();
pi != this->MultipleOutputPairs.end(); ++pi)
@@ -986,7 +994,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
*this->InfoFileStream
<< "\n"
<< "# Targets to which this target links.\n"
- << "SET(CMAKE_TARGET_LINKED_INFO_FILES\n";
+ << "set(CMAKE_TARGET_LINKED_INFO_FILES\n";
std::set<cmTarget const*> emitted;
const char* cfg = this->LocalGenerator->ConfigurationName.c_str();
if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(cfg))
@@ -996,7 +1004,12 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
i = items.begin(); i != items.end(); ++i)
{
cmTarget const* linkee = i->Target;
- if(linkee && !linkee->IsImported() && emitted.insert(linkee).second)
+ if(linkee && !linkee->IsImported()
+ // We can ignore the INTERFACE_LIBRARY items because
+ // Target->GetLinkInformation already processed their
+ // link interface and they don't have any output themselves.
+ && linkee->GetType() != cmTarget::INTERFACE_LIBRARY
+ && emitted.insert(linkee).second)
{
cmMakefile* mf = linkee->GetMakefile();
cmLocalGenerator* lg = mf->GetLocalGenerator();
@@ -1018,7 +1031,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
*this->InfoFileStream
<< "\n"
<< "# Fortran module output directory.\n"
- << "SET(CMAKE_Fortran_TARGET_MODULE_DIR \"" << mdir << "\")\n";
+ << "set(CMAKE_Fortran_TARGET_MODULE_DIR \"" << mdir << "\")\n";
}
// Target-specific include directories:
@@ -1026,7 +1039,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
<< "\n"
<< "# The include file search paths:\n";
*this->InfoFileStream
- << "SET(CMAKE_C_TARGET_INCLUDE_PATH\n";
+ << "set(CMAKE_C_TARGET_INCLUDE_PATH\n";
std::vector<std::string> includes;
const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE");
@@ -1045,13 +1058,13 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
*this->InfoFileStream
<< " )\n";
*this->InfoFileStream
- << "SET(CMAKE_CXX_TARGET_INCLUDE_PATH "
+ << "set(CMAKE_CXX_TARGET_INCLUDE_PATH "
<< "${CMAKE_C_TARGET_INCLUDE_PATH})\n";
*this->InfoFileStream
- << "SET(CMAKE_Fortran_TARGET_INCLUDE_PATH "
+ << "set(CMAKE_Fortran_TARGET_INCLUDE_PATH "
<< "${CMAKE_C_TARGET_INCLUDE_PATH})\n";
*this->InfoFileStream
- << "SET(CMAKE_ASM_TARGET_INCLUDE_PATH "
+ << "set(CMAKE_ASM_TARGET_INCLUDE_PATH "
<< "${CMAKE_C_TARGET_INCLUDE_PATH})\n";
// and now write the rule to use it
diff --git a/Source/cmMarkAsAdvancedCommand.h b/Source/cmMarkAsAdvancedCommand.h
index 246eb8a..adfc553 100644
--- a/Source/cmMarkAsAdvancedCommand.h
+++ b/Source/cmMarkAsAdvancedCommand.h
@@ -56,7 +56,7 @@ public:
virtual const char* GetFullDocumentation() const
{
return
- " mark_as_advanced([CLEAR|FORCE] VAR VAR2 VAR...)\n"
+ " mark_as_advanced([CLEAR|FORCE] VAR [VAR2 ...])\n"
"Mark the named cached variables as advanced. An advanced variable "
"will not be displayed in any of the cmake GUIs unless the show "
"advanced option is on. "
diff --git a/Source/cmNewLineStyle.cxx b/Source/cmNewLineStyle.cxx
index 6f7b6a9..a7d7429 100644
--- a/Source/cmNewLineStyle.cxx
+++ b/Source/cmNewLineStyle.cxx
@@ -78,7 +78,7 @@ const std::string cmNewLineStyle::GetCharacters() const
return "\r\n";
default:
;
- };
+ }
return "";
}
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index c3d6a94..1d3469f 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -27,11 +27,11 @@ public:
cmPolicies::PolicyStatus status)
{
if (!idString || !shortDescription || ! longDescription)
- {
+ {
cmSystemTools::Error("Attempt to define a policy without "
"all parameters being specified!");
return;
- }
+ }
this->ID = iD;
this->IDString = idString;
this->ShortDescription = shortDescription;
@@ -61,29 +61,29 @@ public:
unsigned int tweakV)
{
if (majorV < this->MajorVersionIntroduced)
- {
+ {
return true;
- }
+ }
if (majorV > this->MajorVersionIntroduced)
- {
+ {
return false;
- }
+ }
if (minorV < this->MinorVersionIntroduced)
- {
+ {
return true;
- }
+ }
if (minorV > this->MinorVersionIntroduced)
- {
+ {
return false;
- }
+ }
if (patchV < this->PatchVersionIntroduced)
- {
+ {
return true;
- }
+ }
if (patchV > this->PatchVersionIntroduced)
- {
+ {
return false;
- }
+ }
return (tweakV < this->TweakVersionIntroduced);
}
@@ -645,9 +645,9 @@ cmPolicies::~cmPolicies()
std::map<cmPolicies::PolicyID,cmPolicy *>::iterator i
= this->Policies.begin();
for (;i != this->Policies.end(); ++i)
- {
+ {
delete i->second;
- }
+ }
}
void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD,
@@ -662,11 +662,11 @@ void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD,
{
// a policy must be unique and can only be defined once
if (this->Policies.find(iD) != this->Policies.end())
- {
+ {
cmSystemTools::Error("Attempt to redefine a CMake policy for policy "
"ID ", this->GetPolicyIDString(iD).c_str());
return;
- }
+ }
this->Policies[iD] = new cmPolicy(iD, idString,
shortDescription,
@@ -820,15 +820,15 @@ bool cmPolicies::GetPolicyDefault(cmMakefile* mf, std::string const& policy,
bool cmPolicies::GetPolicyID(const char *id, cmPolicies::PolicyID &pid)
{
if (!id || strlen(id) < 1)
- {
+ {
return false;
- }
+ }
std::map<std::string,cmPolicies::PolicyID>::iterator pos =
this->PolicyStringMap.find(id);
if (pos == this->PolicyStringMap.end())
- {
+ {
return false;
- }
+ }
pid = pos->second;
return true;
}
@@ -838,9 +838,9 @@ std::string cmPolicies::GetPolicyIDString(cmPolicies::PolicyID pid)
std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos =
this->Policies.find(pid);
if (pos == this->Policies.end())
- {
+ {
return "";
- }
+ }
return pos->second->IDString;
}
@@ -851,11 +851,11 @@ std::string cmPolicies::GetPolicyWarning(cmPolicies::PolicyID id)
std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos =
this->Policies.find(id);
if (pos == this->Policies.end())
- {
+ {
cmSystemTools::Error(
"Request for warning text for undefined policy!");
return "Request for warning text for undefined policy!";
- }
+ }
cmOStringStream msg;
msg <<
@@ -875,11 +875,11 @@ std::string cmPolicies::GetRequiredPolicyError(cmPolicies::PolicyID id)
std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos =
this->Policies.find(id);
if (pos == this->Policies.end())
- {
+ {
cmSystemTools::Error(
"Request for error text for undefined policy!");
return "Request for error text for undefined policy!";
- }
+ }
cmOStringStream error;
error <<
@@ -905,10 +905,10 @@ cmPolicies::GetPolicyStatus(cmPolicies::PolicyID id)
std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos =
this->Policies.find(id);
if (pos == this->Policies.end())
- {
+ {
// TODO is this right?
return cmPolicies::WARN;
- }
+ }
return pos->second->Status;
}
@@ -919,7 +919,7 @@ void cmPolicies::GetDocumentation(std::vector<cmDocumentationEntry>& v)
std::map<cmPolicies::PolicyID,cmPolicy *>::iterator i
= this->Policies.begin();
for (;i != this->Policies.end(); ++i)
- {
+ {
cmOStringStream full;
full << i->second->LongDescription;
full << "\nThis policy was introduced in CMake version ";
@@ -956,7 +956,7 @@ void cmPolicies::GetDocumentation(std::vector<cmDocumentationEntry>& v)
i->second->ShortDescription.c_str(),
full.str().c_str());
v.push_back(e);
- }
+ }
}
//----------------------------------------------------------------------------
diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx
index 93e39ab..651e0ad 100644
--- a/Source/cmQtAutomoc.cxx
+++ b/Source/cmQtAutomoc.cxx
@@ -32,16 +32,28 @@
#include "cmQtAutomoc.h"
-static bool containsQ_OBJECT(const std::string& text)
+static bool requiresMocing(const std::string& text, std::string &macroName)
{
// this simple check is much much faster than the regexp
- if (strstr(text.c_str(), "Q_OBJECT") == NULL)
+ if (strstr(text.c_str(), "Q_OBJECT") == NULL
+ && strstr(text.c_str(), "Q_GADGET") == NULL)
{
return false;
}
cmsys::RegularExpression qObjectRegExp("[\n][ \t]*Q_OBJECT[^a-zA-Z0-9_]");
- return qObjectRegExp.find(text);
+ if (qObjectRegExp.find(text))
+ {
+ macroName = "Q_OBJECT";
+ return true;
+ }
+ cmsys::RegularExpression qGadgetRegExp("[\n][ \t]*Q_GADGET[^a-zA-Z0-9_]");
+ if (qGadgetRegExp.find(text))
+ {
+ macroName = "Q_GADGET";
+ return true;
+ }
+ return false;
}
@@ -436,7 +448,7 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
it = configDefines.begin(), end = configDefines.end();
it != end; ++it)
{
- infoFile << "SET(AM_MOC_COMPILE_DEFINITIONS_" << it->first <<
+ infoFile << "set(AM_MOC_COMPILE_DEFINITIONS_" << it->first <<
" " << it->second << ")\n";
}
}
@@ -446,7 +458,7 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
it = configIncludes.begin(), end = configIncludes.end();
it != end; ++it)
{
- infoFile << "SET(AM_MOC_INCLUDES_" << it->first <<
+ infoFile << "set(AM_MOC_INCLUDES_" << it->first <<
" " << it->second << ")\n";
}
}
@@ -837,7 +849,8 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename,
cmsys::SystemTools::GetRealPath(absFilename.c_str())) + '/';
const std::string scannedFileBasename = cmsys::SystemTools::
GetFilenameWithoutLastExtension(absFilename);
- const bool cppContainsQ_OBJECT = containsQ_OBJECT(contentsString);
+ std::string macroName;
+ const bool requiresMoc = requiresMocing(contentsString, macroName);
bool dotMocIncluded = false;
bool mocUnderscoreIncluded = false;
std::string ownMocUnderscoreFile;
@@ -908,7 +921,7 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename,
else
{
std::string fileToMoc = absFilename;
- if ((basename != scannedFileBasename) || (cppContainsQ_OBJECT==false))
+ if ((basename != scannedFileBasename) || (requiresMoc==false))
{
std::string mocSubDir = extractSubDir(absPath, currentMoc);
std::string headerToMoc = findMatchingHeader(
@@ -917,12 +930,12 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename,
{
// this is for KDE4 compatibility:
fileToMoc = headerToMoc;
- if ((cppContainsQ_OBJECT==false) &&(basename==scannedFileBasename))
+ if ((requiresMoc==false) &&(basename==scannedFileBasename))
{
std::cerr << "AUTOMOC: warning: " << absFilename << ": The file "
"includes the moc file \"" << currentMoc <<
- "\", but does not contain a Q_OBJECT macro. "
- "Running moc on "
+ "\", but does not contain a " << macroName
+ << " macro. Running moc on "
<< "\"" << headerToMoc << "\" ! Include \"moc_"
<< basename << ".cpp\" for a compatiblity with "
"strict mode (see CMAKE_AUTOMOC_RELAXED_MODE).\n"
@@ -965,13 +978,14 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename,
// If this is the case, the moc_foo.cpp should probably be generated from
// foo.cpp instead of foo.h, because otherwise it won't build.
// But warn, since this is not how it is supposed to be used.
- if ((dotMocIncluded == false) && (cppContainsQ_OBJECT == true))
+ if ((dotMocIncluded == false) && (requiresMoc == true))
{
if (mocUnderscoreIncluded == true)
{
// this is for KDE4 compatibility:
std::cerr << "AUTOMOC: warning: " << absFilename << ": The file "
- << "contains a Q_OBJECT macro, but does not include "
+ << "contains a " << macroName << " macro, but does not "
+ "include "
<< "\"" << scannedFileBasename << ".moc\", but instead "
"includes "
<< "\"" << ownMocUnderscoreFile << "\". Running moc on "
@@ -986,7 +1000,8 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename,
{
// otherwise always error out since it will not compile:
std::cerr << "AUTOMOC: error: " << absFilename << ": The file "
- << "contains a Q_OBJECT macro, but does not include "
+ << "contains a " << macroName << " macro, but does not "
+ "include "
<< "\"" << scannedFileBasename << ".moc\" !\n"
<< std::endl;
::exit(EXIT_FAILURE);
@@ -1094,11 +1109,13 @@ void cmQtAutomoc::StrictParseCppFile(const std::string& absFilename,
// If this is the case, the moc_foo.cpp should probably be generated from
// foo.cpp instead of foo.h, because otherwise it won't build.
// But warn, since this is not how it is supposed to be used.
- if ((dotMocIncluded == false) && (containsQ_OBJECT(contentsString)))
+ std::string macroName;
+ if ((dotMocIncluded == false) && (requiresMocing(contentsString,
+ macroName)))
{
// otherwise always error out since it will not compile:
std::cerr << "AUTOMOC: error: " << absFilename << ": The file "
- << "contains a Q_OBJECT macro, but does not include "
+ << "contains a " << macroName << " macro, but does not include "
<< "\"" << scannedFileBasename << ".moc\" !\n"
<< std::endl;
::exit(EXIT_FAILURE);
@@ -1165,7 +1182,8 @@ void cmQtAutomoc::ParseHeaders(const std::set<std::string>& absHeaders,
const std::string currentMoc = "moc_" + basename + ".cpp";
const std::string contents = this->ReadAll(headerName);
- if (containsQ_OBJECT(contents))
+ std::string macroName;
+ if (requiresMocing(contents, macroName))
{
//std::cout << "header contains Q_OBJECT macro";
notIncludedMocs[headerName] = currentMoc;
diff --git a/Source/cmScriptGenerator.cxx b/Source/cmScriptGenerator.cxx
index cabe98a..3b6a49b 100644
--- a/Source/cmScriptGenerator.cxx
+++ b/Source/cmScriptGenerator.cxx
@@ -185,9 +185,9 @@ void cmScriptGenerator::GenerateScriptActionsOnce(std::ostream& os,
{
// Generate a per-configuration block.
std::string config_test = this->CreateConfigTest(this->Configurations);
- os << indent << "IF(" << config_test << ")\n";
+ os << indent << "if(" << config_test << ")\n";
this->GenerateScriptActions(os, indent.Next());
- os << indent << "ENDIF(" << config_test << ")\n";
+ os << indent << "endif(" << config_test << ")\n";
}
}
@@ -219,7 +219,7 @@ void cmScriptGenerator::GenerateScriptActionsPerConfig(std::ostream& os,
{
// Generate a per-configuration block.
std::string config_test = this->CreateConfigTest(config);
- os << indent << (first? "IF(" : "ELSEIF(") << config_test << ")\n";
+ os << indent << (first? "if(" : "elseif(") << config_test << ")\n";
this->GenerateScriptForConfig(os, config, indent.Next());
first = false;
}
@@ -228,10 +228,10 @@ void cmScriptGenerator::GenerateScriptActionsPerConfig(std::ostream& os,
{
if(this->NeedsScriptNoConfig())
{
- os << indent << "ELSE()\n";
+ os << indent << "else()\n";
this->GenerateScriptNoConfig(os, indent.Next());
}
- os << indent << "ENDIF()\n";
+ os << indent << "endif()\n";
}
}
}
diff --git a/Source/cmSetTestsPropertiesCommand.h b/Source/cmSetTestsPropertiesCommand.h
index 3a59218..f2f2611 100644
--- a/Source/cmSetTestsPropertiesCommand.h
+++ b/Source/cmSetTestsPropertiesCommand.h
@@ -51,7 +51,8 @@ public:
" set_tests_properties(test1 [test2...] PROPERTIES prop1 value1 prop2"
" value2)\n"
"Set a property for the tests. If the property is not found, CMake "
- "will report an error. The properties include:\n"
+ "will report an error. Generator expressions will be expanded the same "
+ "as supported by the test's add_test call. The properties include:\n"
"WILL_FAIL: If set to true, this will invert the pass/fail flag of the"
" test.\n"
"PASS_REGULAR_EXPRESSION: If set, the test output will be checked "
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index ac655da..1c04e4e 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -47,6 +47,8 @@ const char* cmTarget::GetTargetTypeName(TargetType targetType)
return "UTILITY";
case cmTarget::GLOBAL_TARGET:
return "GLOBAL_TARGET";
+ case cmTarget::INTERFACE_LIBRARY:
+ return "INTERFACE_LIBRARY";
case cmTarget::UNKNOWN_LIBRARY:
return "UNKNOWN_LIBRARY";
}
@@ -924,10 +926,24 @@ void cmTarget::DefineProperties(cmake *cm)
"The first configuration in the list found to be provided by the "
"imported target is selected. If this property is set and no matching "
"configurations are available, then the imported target is considered "
- "to be not found. This property is ignored for non-imported targets.",
+ "to be not found. This property is ignored for non-imported targets.\n"
+ "This property is initialized by the value of the variable "
+ "CMAKE_MAP_IMPORTED_CONFIG_<CONFIG> if it is set when a target is "
+ "created.",
false /* TODO: make this chained */ );
cm->DefineProperty
+ ("NO_SYSTEM_FROM_IMPORTED", cmProperty::TARGET,
+ "Do not treat includes from IMPORTED target interfaces as SYSTEM.",
+ "The contents of the INTERFACE_INCLUDE_DIRECTORIES of IMPORTED targets "
+ "are treated as SYSTEM includes by default. If this property is "
+ "enabled, the contents of the INTERFACE_INCLUDE_DIRECTORIES of IMPORTED "
+ "targets are not treated as system includes. "
+ "This property is initialized by the value of the variable "
+ "CMAKE_NO_SYSTEM_FROM_IMPORTED if it is set when a target is "
+ "created.");
+
+ cm->DefineProperty
("OSX_ARCHITECTURES", cmProperty::TARGET,
"Target specific architectures for OS X.",
"The OSX_ARCHITECTURES property sets the target binary architecture "
@@ -1637,6 +1653,7 @@ void cmTarget::SetMakefile(cmMakefile* mf)
this->SetPropertyDefault("WIN32_EXECUTABLE", 0);
this->SetPropertyDefault("MACOSX_BUNDLE", 0);
this->SetPropertyDefault("MACOSX_RPATH", 0);
+ this->SetPropertyDefault("NO_SYSTEM_FROM_IMPORTED", 0);
// Collect the set of configuration types.
@@ -1649,6 +1666,7 @@ void cmTarget::SetMakefile(cmMakefile* mf)
"LIBRARY_OUTPUT_DIRECTORY_",
"RUNTIME_OUTPUT_DIRECTORY_",
"PDB_OUTPUT_DIRECTORY_",
+ "MAP_IMPORTED_CONFIG_",
0};
for(std::vector<std::string>::iterator ci = configNames.begin();
ci != configNames.end(); ++ci)
@@ -1727,6 +1745,14 @@ void cmTarget::SetMakefile(cmMakefile* mf)
CM_FOR_EACH_TARGET_POLICY(CAPTURE_TARGET_POLICY)
#undef CAPTURE_TARGET_POLICY
+
+ if (this->TargetTypeValue == INTERFACE_LIBRARY)
+ {
+ // This policy is checked in a few conditions. The properties relevant
+ // to the policy are always ignored for INTERFACE_LIBRARY targets,
+ // so ensure that the conditions don't lead to nonsense.
+ this->PolicyStatusCMP0022 = cmPolicies::NEW;
+ }
}
//----------------------------------------------------------------------------
@@ -1792,6 +1818,7 @@ bool cmTarget::IsLinkable()
this->GetType() == cmTarget::SHARED_LIBRARY ||
this->GetType() == cmTarget::MODULE_LIBRARY ||
this->GetType() == cmTarget::UNKNOWN_LIBRARY ||
+ this->GetType() == cmTarget::INTERFACE_LIBRARY ||
this->IsExecutableWithExports());
}
@@ -2563,8 +2590,8 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf,
return;
}
- {
cmTarget *tgt = this->Makefile->FindTargetToUse(lib);
+ {
const bool isNonImportedTarget = tgt && !tgt->IsImported();
const std::string libName = (isNonImportedTarget && llt != GENERAL)
@@ -2575,7 +2602,8 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf,
llt).c_str());
}
- if (cmGeneratorExpression::Find(lib) != std::string::npos)
+ if (cmGeneratorExpression::Find(lib) != std::string::npos
+ || (tgt && tgt->GetType() == INTERFACE_LIBRARY))
{
return;
}
@@ -2657,6 +2685,11 @@ void cmTarget::FinalizeSystemIncludeDirectories()
end = this->Internal->LinkInterfacePropertyEntries.end();
it != end; ++it)
{
+ if (!cmGeneratorExpression::IsValidTargetName(it->Value)
+ && cmGeneratorExpression::Find(it->Value) == std::string::npos)
+ {
+ continue;
+ }
{
cmListFileBacktrace lfbt;
cmGeneratorExpression ge(lfbt);
@@ -2664,10 +2697,28 @@ void cmTarget::FinalizeSystemIncludeDirectories()
ge.Parse(it->Value);
std::string targetName = cge->Evaluate(this->Makefile, 0,
false, this, 0, 0);
- if (!this->Makefile->FindTargetToUse(targetName.c_str()))
+ cmTarget *tgt = this->Makefile->FindTargetToUse(targetName.c_str());
+ if (!tgt)
{
continue;
}
+ if (tgt->IsImported()
+ && tgt->GetProperty("INTERFACE_INCLUDE_DIRECTORIES")
+ && !this->GetPropertyAsBool("NO_SYSTEM_FROM_IMPORTED"))
+ {
+ std::string includeGenex = "$<TARGET_PROPERTY:" +
+ it->Value + ",INTERFACE_INCLUDE_DIRECTORIES>";
+ if (cmGeneratorExpression::Find(it->Value) != std::string::npos)
+ {
+ // Because it->Value is a generator expression, ensure that it
+ // evaluates to the non-empty string before being used in the
+ // TARGET_PROPERTY expression.
+ includeGenex = "$<$<BOOL:" + it->Value + ">:" + includeGenex + ">";
+ }
+ this->SystemIncludeDirectories.insert(includeGenex);
+ return; // The INTERFACE_SYSTEM_INCLUDE_DIRECTORIES are a subset
+ // of the INTERFACE_INCLUDE_DIRECTORIES
+ }
}
std::string includeGenex = "$<TARGET_PROPERTY:" +
it->Value + ",INTERFACE_SYSTEM_INCLUDE_DIRECTORIES>";
@@ -3033,15 +3084,11 @@ void cmTarget::SetProperty(const char* prop, const char* value)
if (strcmp(prop, "LINK_LIBRARIES") == 0)
{
this->Internal->LinkInterfacePropertyEntries.clear();
- if (cmGeneratorExpression::IsValidTargetName(value)
- || cmGeneratorExpression::Find(value) != std::string::npos)
- {
- cmListFileBacktrace lfbt;
- this->Makefile->GetBacktrace(lfbt);
- cmValueWithOrigin entry(value, lfbt);
- this->Internal->LinkInterfacePropertyEntries.push_back(entry);
- }
- // Fall through
+ cmListFileBacktrace lfbt;
+ this->Makefile->GetBacktrace(lfbt);
+ cmValueWithOrigin entry(value, lfbt);
+ this->Internal->LinkInterfacePropertyEntries.push_back(entry);
+ return;
}
this->Properties.SetProperty(prop, value, cmProperty::TARGET);
this->MaybeInvalidatePropertyCache(prop);
@@ -3099,15 +3146,11 @@ void cmTarget::AppendProperty(const char* prop, const char* value,
}
if (strcmp(prop, "LINK_LIBRARIES") == 0)
{
- if (cmGeneratorExpression::IsValidTargetName(value)
- || cmGeneratorExpression::Find(value) != std::string::npos)
- {
- cmListFileBacktrace lfbt;
- this->Makefile->GetBacktrace(lfbt);
- cmValueWithOrigin entry(value, lfbt);
- this->Internal->LinkInterfacePropertyEntries.push_back(entry);
- }
- // Fall through
+ cmListFileBacktrace lfbt;
+ this->Makefile->GetBacktrace(lfbt);
+ cmValueWithOrigin entry(value, lfbt);
+ this->Internal->LinkInterfacePropertyEntries.push_back(entry);
+ return;
}
this->Properties.AppendProperty(prop, value, cmProperty::TARGET, asString);
this->MaybeInvalidatePropertyCache(prop);
@@ -3387,6 +3430,11 @@ std::vector<std::string> cmTarget::GetIncludeDirectories(const char *config)
end = this->Internal->LinkInterfacePropertyEntries.end();
it != end; ++it)
{
+ if (!cmGeneratorExpression::IsValidTargetName(it->Value)
+ && cmGeneratorExpression::Find(it->Value) == std::string::npos)
+ {
+ continue;
+ }
{
cmGeneratorExpression ge(lfbt);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
@@ -3585,6 +3633,11 @@ void cmTarget::GetCompileOptions(std::vector<std::string> &result,
end = this->Internal->LinkInterfacePropertyEntries.end();
it != end; ++it)
{
+ if (!cmGeneratorExpression::IsValidTargetName(it->Value)
+ && cmGeneratorExpression::Find(it->Value) == std::string::npos)
+ {
+ continue;
+ }
{
cmGeneratorExpression ge(lfbt);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
@@ -3693,6 +3746,11 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
end = this->Internal->LinkInterfacePropertyEntries.end();
it != end; ++it)
{
+ if (!cmGeneratorExpression::IsValidTargetName(it->Value)
+ && cmGeneratorExpression::Find(it->Value) == std::string::npos)
+ {
+ continue;
+ }
{
cmGeneratorExpression ge(lfbt);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
@@ -4091,6 +4149,7 @@ const char *cmTarget::GetProperty(const char* prop,
this->GetType() == cmTarget::STATIC_LIBRARY ||
this->GetType() == cmTarget::SHARED_LIBRARY ||
this->GetType() == cmTarget::MODULE_LIBRARY ||
+ this->GetType() == cmTarget::INTERFACE_LIBRARY ||
this->GetType() == cmTarget::UNKNOWN_LIBRARY)
{
if(strcmp(prop,"LOCATION") == 0)
@@ -4115,7 +4174,7 @@ const char *cmTarget::GetProperty(const char* prop,
}
else
{
- // Support "<CONFIG>_LOCATION" for compatiblity.
+ // Support "<CONFIG>_LOCATION" for compatibility.
int len = static_cast<int>(strlen(prop));
if(len > 9 && strcmp(prop+len-9, "_LOCATION") == 0)
{
@@ -4181,6 +4240,22 @@ const char *cmTarget::GetProperty(const char* prop,
}
return output.c_str();
}
+ if(strcmp(prop,"LINK_LIBRARIES") == 0)
+ {
+ static std::string output;
+ output = "";
+ std::string sep;
+ for (std::vector<cmValueWithOrigin>::const_iterator
+ it = this->Internal->LinkInterfacePropertyEntries.begin(),
+ end = this->Internal->LinkInterfacePropertyEntries.end();
+ it != end; ++it)
+ {
+ output += sep;
+ output += it->Value;
+ sep = ";";
+ }
+ return output.c_str();
+ }
if (strcmp(prop,"IMPORTED") == 0)
{
@@ -5999,6 +6074,10 @@ cmTarget::GetImportInfo(const char* config, cmTarget *headTarget)
i = this->Internal->ImportInfoMap.insert(entry).first;
}
+ if(this->GetType() == INTERFACE_LIBRARY)
+ {
+ return &i->second;
+ }
// If the location is empty then the target is not available for
// this configuration.
if(i->second.Location.empty() && i->second.ImportLibrary.empty())
@@ -6147,7 +6226,51 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config,
const char* loc = 0;
const char* imp = 0;
std::string suffix;
- if (!this->GetMappedConfig(desired_config, &loc, &imp, suffix))
+ if (this->GetType() != INTERFACE_LIBRARY &&
+ !this->GetMappedConfig(desired_config, &loc, &imp, suffix))
+ {
+ return;
+ }
+
+ // Get the link interface.
+ {
+ std::string linkProp = "INTERFACE_LINK_LIBRARIES";
+ const char *propertyLibs = this->GetProperty(linkProp.c_str());
+
+ if (this->GetType() != INTERFACE_LIBRARY)
+ {
+ if(!propertyLibs)
+ {
+ linkProp = "IMPORTED_LINK_INTERFACE_LIBRARIES";
+ linkProp += suffix;
+ propertyLibs = this->GetProperty(linkProp.c_str());
+ }
+
+ if(!propertyLibs)
+ {
+ linkProp = "IMPORTED_LINK_INTERFACE_LIBRARIES";
+ propertyLibs = this->GetProperty(linkProp.c_str());
+ }
+ }
+ if(propertyLibs)
+ {
+ cmListFileBacktrace lfbt;
+ cmGeneratorExpression ge(lfbt);
+
+ cmGeneratorExpressionDAGChecker dagChecker(lfbt,
+ this->GetName(),
+ linkProp, 0, 0);
+ cmSystemTools::ExpandListArgument(ge.Parse(propertyLibs)
+ ->Evaluate(this->Makefile,
+ desired_config.c_str(),
+ false,
+ headTarget,
+ this,
+ &dagChecker),
+ info.LinkInterface.Libraries);
+ }
+ }
+ if(this->GetType() == INTERFACE_LIBRARY)
{
return;
}
@@ -6224,42 +6347,6 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config,
}
}
- // Get the link interface.
- {
- std::string linkProp = "INTERFACE_LINK_LIBRARIES";
- const char *propertyLibs = this->GetProperty(linkProp.c_str());
-
- if (!propertyLibs)
- {
- linkProp = "IMPORTED_LINK_INTERFACE_LIBRARIES";
- linkProp += suffix;
- propertyLibs = this->GetProperty(linkProp.c_str());
- }
-
- if(!propertyLibs)
- {
- linkProp = "IMPORTED_LINK_INTERFACE_LIBRARIES";
- propertyLibs = this->GetProperty(linkProp.c_str());
- }
- if(propertyLibs)
- {
- cmListFileBacktrace lfbt;
- cmGeneratorExpression ge(lfbt);
-
- cmGeneratorExpressionDAGChecker dagChecker(lfbt,
- this->GetName(),
- linkProp, 0, 0);
- cmSystemTools::ExpandListArgument(ge.Parse(propertyLibs)
- ->Evaluate(this->Makefile,
- desired_config.c_str(),
- false,
- headTarget,
- this,
- &dagChecker),
- info.LinkInterface.Libraries);
- }
- }
-
// Get the link dependencies.
{
std::string linkProp = "IMPORTED_LINK_DEPENDENT_LIBRARIES";
@@ -6520,6 +6607,11 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface,
}
}
}
+ else if (this->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ explicitLibraries = newExplicitLibraries;
+ linkIfaceProp = "INTERFACE_LINK_LIBRARIES";
+ }
// There is no implicit link interface for executables or modules
// so if none was explicitly set then there is no link interface.
@@ -6547,7 +6639,8 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface,
this, &dagChecker), iface.Libraries);
if(this->GetType() == cmTarget::SHARED_LIBRARY
- || this->GetType() == cmTarget::STATIC_LIBRARY)
+ || this->GetType() == cmTarget::STATIC_LIBRARY
+ || this->GetType() == cmTarget::INTERFACE_LIBRARY)
{
// Shared libraries may have runtime implementation dependencies
// on other shared libraries that are not in the interface.
@@ -6823,7 +6916,7 @@ void checkPropertyConsistency(cmTarget *depender, cmTarget *dependee,
pi != props.end(); ++pi)
{
if (depender->GetMakefile()->GetCMakeInstance()
- ->GetIsPropertyDefined(pi->c_str(),
+ ->IsPropertyDefined(pi->c_str(),
cmProperty::TARGET))
{
cmOStringStream e;
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 27b74ca..a88c5ec 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -72,6 +72,7 @@ public:
enum TargetType { EXECUTABLE, STATIC_LIBRARY,
SHARED_LIBRARY, MODULE_LIBRARY,
OBJECT_LIBRARY, UTILITY, GLOBAL_TARGET,
+ INTERFACE_LIBRARY,
UNKNOWN_LIBRARY};
static const char* GetTargetTypeName(TargetType targetType);
enum CustomCommandType { PRE_BUILD, PRE_LINK, POST_BUILD };
@@ -372,7 +373,7 @@ public:
/** Get the soname of the target. Allowed only for a shared library. */
std::string GetSOName(const char* config);
- /** Whether this library has @rpath and platform supports it. */
+ /** Whether this library has \@rpath and platform supports it. */
bool HasMacOSXRpath(const char* config);
/** Test for special case of a third-party shared library that has
@@ -421,12 +422,12 @@ public:
bool IsChrpathUsed(const char* config);
/** Return the install name directory for the target in the
- * build tree. For example: "@rpath/", "@loader_path/",
+ * build tree. For example: "\@rpath/", "\@loader_path/",
* or "/full/path/to/library". */
std::string GetInstallNameDirForBuildTree(const char* config);
/** Return the install name directory for the target in the
- * install tree. For example: "@rpath/" or "@loader_path/". */
+ * install tree. For example: "\@rpath/" or "\@loader_path/". */
std::string GetInstallNameDirForInstallTree();
cmComputeLinkInformation* GetLinkInformation(const char* config,
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index 863b391..22f6a03 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -322,6 +322,15 @@ bool
cmTargetLinkLibrariesCommand::HandleLibrary(const char* lib,
cmTarget::LinkLibraryType llt)
{
+ if(this->Target->GetType() == cmTarget::INTERFACE_LIBRARY
+ && this->CurrentProcessingState != ProcessingKeywordLinkInterface)
+ {
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR,
+ "INTERFACE library can only be used with the INTERFACE keyword of "
+ "target_link_libraries");
+ return false;
+ }
+
cmTarget::TLLSignature sig =
(this->CurrentProcessingState == ProcessingPlainPrivateInterface
|| this->CurrentProcessingState == ProcessingPlainPublicInterface
@@ -407,6 +416,11 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const char* lib,
return true;
}
+ if (this->Target->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ return true;
+ }
+
// Get the list of configurations considered to be DEBUG.
std::vector<std::string> const& debugConfigs =
this->Makefile->GetCMakeInstance()->GetDebugConfigs();
diff --git a/Source/cmTargetPropCommandBase.cxx b/Source/cmTargetPropCommandBase.cxx
index 1862cb6..e7b6999 100644
--- a/Source/cmTargetPropCommandBase.cxx
+++ b/Source/cmTargetPropCommandBase.cxx
@@ -47,6 +47,7 @@ bool cmTargetPropCommandBase
&& (this->Target->GetType() != cmTarget::STATIC_LIBRARY)
&& (this->Target->GetType() != cmTarget::OBJECT_LIBRARY)
&& (this->Target->GetType() != cmTarget::MODULE_LIBRARY)
+ && (this->Target->GetType() != cmTarget::INTERFACE_LIBRARY)
&& (this->Target->GetType() != cmTarget::EXECUTABLE))
{
this->SetError("called with non-compilable target type");
@@ -112,6 +113,14 @@ bool cmTargetPropCommandBase
return false;
}
+ if (this->Target->GetType() == cmTarget::INTERFACE_LIBRARY
+ && scope != "INTERFACE")
+ {
+ this->SetError("may only be set INTERFACE properties on INTERFACE "
+ "targets");
+ return false;
+ }
+
++argIndex;
std::vector<std::string> content;
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index 42f511e..d962fb2 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -39,29 +39,8 @@ cmTestGenerator
void cmTestGenerator::GenerateScriptConfigs(std::ostream& os,
Indent const& indent)
{
- // First create the tests.
+ // Create the tests.
this->cmScriptGenerator::GenerateScriptConfigs(os, indent);
-
- // Now generate the test properties.
- if(this->TestGenerated)
- {
- cmTest* test = this->Test;
- cmMakefile* mf = test->GetMakefile();
- cmLocalGenerator* lg = mf->GetLocalGenerator();
- std::ostream& fout = os;
- cmPropertyMap::const_iterator pit;
- cmPropertyMap* mpit = &test->GetProperties();
- if ( mpit->size() )
- {
- fout << "SET_TESTS_PROPERTIES(" << test->GetName() << " PROPERTIES ";
- for ( pit = mpit->begin(); pit != mpit->end(); ++ pit )
- {
- fout << " " << pit->first
- << " " << lg->EscapeForCMake(pit->second.GetValue());
- }
- fout << ")" << std::endl;
- }
- }
}
//----------------------------------------------------------------------------
@@ -94,7 +73,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
cmGeneratorExpression ge(this->Test->GetBacktrace());
// Start the test command.
- os << indent << "ADD_TEST(" << this->Test->GetName() << " ";
+ os << indent << "add_test(" << this->Test->GetName() << " ";
// Get the test command line to be executed.
std::vector<std::string> const& command = this->Test->GetCommand();
@@ -127,13 +106,29 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
// Finish the test command.
os << ")\n";
+
+ // Output properties for the test.
+ cmPropertyMap& pm = this->Test->GetProperties();
+ if(!pm.empty())
+ {
+ os << indent << "set_tests_properties(" << this->Test->GetName()
+ << " PROPERTIES ";
+ for(cmPropertyMap::const_iterator i = pm.begin();
+ i != pm.end(); ++i)
+ {
+ os << " " << i->first
+ << " " << lg->EscapeForCMake(
+ ge.Parse(i->second.GetValue())->Evaluate(mf, config));
+ }
+ os << ")" << std::endl;
+ }
}
//----------------------------------------------------------------------------
void cmTestGenerator::GenerateScriptNoConfig(std::ostream& os,
Indent const& indent)
{
- os << indent << "ADD_TEST(" << this->Test->GetName() << " NOT_AVAILABLE)\n";
+ os << indent << "add_test(" << this->Test->GetName() << " NOT_AVAILABLE)\n";
}
//----------------------------------------------------------------------------
@@ -157,7 +152,7 @@ void cmTestGenerator::GenerateOldStyle(std::ostream& fout,
std::string exe = command[0];
cmSystemTools::ConvertToUnixSlashes(exe);
fout << indent;
- fout << "ADD_TEST(";
+ fout << "add_test(";
fout << this->Test->GetName() << " \"" << exe << "\"";
for(std::vector<std::string>::const_iterator argit = command.begin()+1;
@@ -181,4 +176,21 @@ void cmTestGenerator::GenerateOldStyle(std::ostream& fout,
fout << "\"";
}
fout << ")" << std::endl;
+
+ // Output properties for the test.
+ cmMakefile* mf = this->Test->GetMakefile();
+ cmLocalGenerator* lg = mf->GetLocalGenerator();
+ cmPropertyMap& pm = this->Test->GetProperties();
+ if(!pm.empty())
+ {
+ fout << indent << "set_tests_properties(" << this->Test->GetName()
+ << " PROPERTIES ";
+ for(cmPropertyMap::const_iterator i = pm.begin();
+ i != pm.end(); ++i)
+ {
+ fout << " " << i->first
+ << " " << lg->EscapeForCMake(i->second.GetValue());
+ }
+ fout << ")" << std::endl;
+ }
}
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index 4fc0b13..879d4fd 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -353,13 +353,13 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
cmsys::SystemTools::ReplaceString(comment, "\n", "\n# ");
file << comment << "\n\n";
- file << "SET( " << this->RunResultVariable << " \n \""
+ file << "set( " << this->RunResultVariable << " \n \""
<< this->Makefile->GetDefinition(this->RunResultVariable.c_str())
<< "\"\n CACHE STRING \"Result from TRY_RUN\" FORCE)\n\n";
if (out!=0)
{
- file << "SET( " << internalRunOutputName << " \n \""
+ file << "set( " << internalRunOutputName << " \n \""
<< this->Makefile->GetDefinition(internalRunOutputName.c_str())
<< "\"\n CACHE STRING \"Output from TRY_RUN\" FORCE)\n\n";
}
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index a26b291..0dbb5eb 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -490,6 +490,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
break;
case cmTarget::GLOBAL_TARGET:
case cmTarget::UNKNOWN_LIBRARY:
+ case cmTarget::INTERFACE_LIBRARY:
break;
}
configType += "</ConfigurationType>\n";
@@ -1701,7 +1702,8 @@ void cmVisualStudio10TargetGenerator::AddLibraries(
libstring += sep;
libstring += path;
}
- else
+ else if (!l->Target
+ || l->Target->GetType() != cmTarget::INTERFACE_LIBRARY)
{
libstring += sep;
libstring += l->Value;
@@ -1836,6 +1838,10 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences()
i != depends.end(); ++i)
{
cmTarget* dt = *i;
+ if(dt->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ continue;
+ }
// skip fortran targets as they can not be processed by MSBuild
// the only reference will be in the .sln file
if(static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator)
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 290aff0..2249323 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -11,7 +11,6 @@
============================================================================*/
#include "cmake.h"
#include "cmDocumentVariables.h"
-#include "time.h"
#include "cmCacheManager.h"
#include "cmMakefile.h"
#include "cmLocalGenerator.h"
@@ -19,23 +18,15 @@
#include "cmCommands.h"
#include "cmCommand.h"
#include "cmFileTimeComparison.h"
-#include "cmGeneratedFileStream.h"
-#include "cmQtAutomoc.h"
#include "cmSourceFile.h"
-#include "cmVersion.h"
#include "cmTest.h"
#include "cmDocumentationFormatterText.h"
#if defined(CMAKE_BUILD_WITH_CMAKE)
# include "cmGraphVizWriter.h"
-# include "cmDependsFortran.h" // For -E cmake_copy_f90_mod callback.
# include "cmVariableWatch.h"
-# include <cmsys/Terminal.h>
-# include <cmsys/CommandLineArguments.hxx>
#endif
-#include <cmsys/Directory.hxx>
-#include <cmsys/Process.h>
#include <cmsys/Glob.hxx>
#include <cmsys/RegularExpression.hxx>
@@ -74,18 +65,11 @@
# endif
# include "cmGlobalMSYSMakefileGenerator.h"
# include "cmGlobalMinGWMakefileGenerator.h"
-# include "cmWin32ProcessExecution.h"
#else
#endif
#include "cmGlobalUnixMakefileGenerator3.h"
#include "cmGlobalNinjaGenerator.h"
-
-#if defined(CMAKE_HAVE_VS_GENERATORS)
-#include "cmCallVisualStudioMacro.h"
-#include "cmVisualStudioWCEPlatformParser.h"
-#endif
-
#if !defined(CMAKE_BOOT_MINGW)
# include "cmExtraCodeBlocksGenerator.h"
#endif
@@ -1132,737 +1116,6 @@ int cmake::AddCMakePaths()
return 1;
}
-
-
-void CMakeCommandUsage(const char* program)
-{
- cmOStringStream errorStream;
-
-#ifdef CMAKE_BUILD_WITH_CMAKE
- errorStream
- << "cmake version " << cmVersion::GetCMakeVersion() << "\n";
-#else
- errorStream
- << "cmake bootstrap\n";
-#endif
- // If you add new commands, change here,
- // and in cmakemain.cxx in the options table
- errorStream
- << "Usage: " << program << " -E [command] [arguments ...]\n"
- << "Available commands: \n"
- << " chdir dir cmd [args]... - run command in a given directory\n"
- << " compare_files file1 file2 - check if file1 is same as file2\n"
- << " copy file destination - copy file to destination (either file "
- "or directory)\n"
- << " copy_directory source destination - copy directory 'source' "
- "content to directory 'destination'\n"
- << " copy_if_different in-file out-file - copy file if input has "
- "changed\n"
- << " echo [string]... - displays arguments as text\n"
- << " echo_append [string]... - displays arguments as text but no new "
- "line\n"
- << " environment - display the current environment\n"
- << " make_directory dir - create a directory\n"
- << " md5sum file1 [...] - compute md5sum of files\n"
- << " remove [-f] file1 file2 ... - remove the file(s), use -f to force "
- "it\n"
- << " 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 ...]\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"
-#if defined(_WIN32) && !defined(__CYGWIN__)
- << "Available on Windows only:\n"
- << " comspec - on windows 9x use this for RunCommand\n"
- << " delete_regv key - delete registry value\n"
- << " env_vs8_wince sdkname - displays a batch file which sets the "
- "environment for the provided Windows CE SDK installed in VS2005\n"
- << " env_vs9_wince sdkname - displays a batch file which sets the "
- "environment for the provided Windows CE SDK installed in VS2008\n"
- << " write_regv key value - write registry value\n"
-#else
- << "Available on UNIX only:\n"
- << " create_symlink old new - create a symbolic link new -> old\n"
-#endif
- ;
-
- cmSystemTools::Error(errorStream.str().c_str());
-}
-
-int cmake::ExecuteCMakeCommand(std::vector<std::string>& args)
-{
- // IF YOU ADD A NEW COMMAND, DOCUMENT IT ABOVE and in cmakemain.cxx
- if (args.size() > 1)
- {
- // Copy file
- if (args[1] == "copy" && args.size() == 4)
- {
- if(!cmSystemTools::cmCopyFile(args[2].c_str(), args[3].c_str()))
- {
- std::cerr << "Error copying file \"" << args[2].c_str()
- << "\" to \"" << args[3].c_str() << "\".\n";
- return 1;
- }
- return 0;
- }
-
- // Copy file if different.
- if (args[1] == "copy_if_different" && args.size() == 4)
- {
- if(!cmSystemTools::CopyFileIfDifferent(args[2].c_str(),
- args[3].c_str()))
- {
- std::cerr << "Error copying file (if different) from \""
- << args[2].c_str() << "\" to \"" << args[3].c_str()
- << "\".\n";
- return 1;
- }
- return 0;
- }
-
- // Copy directory content
- if (args[1] == "copy_directory" && args.size() == 4)
- {
- if(!cmSystemTools::CopyADirectory(args[2].c_str(), args[3].c_str()))
- {
- std::cerr << "Error copying directory from \""
- << args[2].c_str() << "\" to \"" << args[3].c_str()
- << "\".\n";
- return 1;
- }
- return 0;
- }
-
- // Rename a file or directory
- if (args[1] == "rename" && args.size() == 4)
- {
- if(!cmSystemTools::RenameFile(args[2].c_str(), args[3].c_str()))
- {
- std::string e = cmSystemTools::GetLastSystemError();
- std::cerr << "Error renaming from \""
- << args[2].c_str() << "\" to \"" << args[3].c_str()
- << "\": " << e << "\n";
- return 1;
- }
- return 0;
- }
-
- // Compare files
- if (args[1] == "compare_files" && args.size() == 4)
- {
- if(cmSystemTools::FilesDiffer(args[2].c_str(), args[3].c_str()))
- {
- std::cerr << "Files \""
- << args[2].c_str() << "\" to \"" << args[3].c_str()
- << "\" are different.\n";
- return 1;
- }
- return 0;
- }
-
- // Echo string
- else if (args[1] == "echo" )
- {
- unsigned int cc;
- const char* space = "";
- for ( cc = 2; cc < args.size(); cc ++ )
- {
- std::cout << space << args[cc];
- space = " ";
- }
- std::cout << std::endl;
- return 0;
- }
-
- // Echo string no new line
- else if (args[1] == "echo_append" )
- {
- unsigned int cc;
- const char* space = "";
- for ( cc = 2; cc < args.size(); cc ++ )
- {
- std::cout << space << args[cc];
- space = " ";
- }
- return 0;
- }
-
-#if defined(CMAKE_BUILD_WITH_CMAKE)
- // Command to create a symbolic link. Fails on platforms not
- // supporting them.
- else if (args[1] == "environment" )
- {
- std::vector<std::string> env = cmSystemTools::GetEnvironmentVariables();
- std::vector<std::string>::iterator it;
- for ( it = env.begin(); it != env.end(); ++ it )
- {
- std::cout << it->c_str() << std::endl;
- }
- return 0;
- }
-#endif
-
- else if (args[1] == "make_directory" && args.size() == 3)
- {
- if(!cmSystemTools::MakeDirectory(args[2].c_str()))
- {
- std::cerr << "Error making directory \"" << args[2].c_str()
- << "\".\n";
- return 1;
- }
- return 0;
- }
-
- else if (args[1] == "remove_directory" && args.size() == 3)
- {
- if(cmSystemTools::FileIsDirectory(args[2].c_str()) &&
- !cmSystemTools::RemoveADirectory(args[2].c_str()))
- {
- std::cerr << "Error removing directory \"" << args[2].c_str()
- << "\".\n";
- return 1;
- }
- return 0;
- }
-
- // Remove file
- else if (args[1] == "remove" && args.size() > 2)
- {
- bool force = false;
- for (std::string::size_type cc = 2; cc < args.size(); cc ++)
- {
- if(args[cc] == "\\-f" || args[cc] == "-f")
- {
- force = true;
- }
- else
- {
- // Complain if the file could not be removed, still exists,
- // and the -f option was not given.
- if(!cmSystemTools::RemoveFile(args[cc].c_str()) && !force &&
- cmSystemTools::FileExists(args[cc].c_str()))
- {
- return 1;
- }
- }
- }
- return 0;
- }
- // Touch file
- else if (args[1] == "touch" && args.size() > 2)
- {
- for (std::string::size_type cc = 2; cc < args.size(); cc ++)
- {
- // Complain if the file could not be removed, still exists,
- // and the -f option was not given.
- if(!cmSystemTools::Touch(args[cc].c_str(), true))
- {
- return 1;
- }
- }
- return 0;
- }
- // Touch file
- else if (args[1] == "touch_nocreate" && args.size() > 2)
- {
- for (std::string::size_type cc = 2; cc < args.size(); cc ++)
- {
- // Complain if the file could not be removed, still exists,
- // and the -f option was not given.
- if(!cmSystemTools::Touch(args[cc].c_str(), false))
- {
- return 1;
- }
- }
- return 0;
- }
-
- // Clock command
- else if (args[1] == "time" && args.size() > 2)
- {
- std::string command = args[2];
- for (std::string::size_type cc = 3; cc < args.size(); cc ++)
- {
- command += " ";
- command += args[cc];
- }
-
- clock_t clock_start, clock_finish;
- time_t time_start, time_finish;
-
- time(&time_start);
- clock_start = clock();
- int ret =0;
- cmSystemTools::RunSingleCommand(command.c_str(), 0, &ret);
-
- clock_finish = clock();
- time(&time_finish);
-
- double clocks_per_sec = static_cast<double>(CLOCKS_PER_SEC);
- std::cout << "Elapsed time: "
- << static_cast<long>(time_finish - time_start) << " s. (time)"
- << ", "
- << static_cast<double>(clock_finish - clock_start) / clocks_per_sec
- << " s. (clock)"
- << "\n";
- return ret;
- }
- // Command to calculate the md5sum of a file
- else if (args[1] == "md5sum" && args.size() >= 3)
- {
- char md5out[32];
- int retval = 0;
- for (std::string::size_type cc = 2; cc < args.size(); cc ++)
- {
- const char *filename = args[cc].c_str();
- // Cannot compute md5sum of a directory
- if(cmSystemTools::FileIsDirectory(filename))
- {
- std::cerr << "Error: " << filename << " is a directory" << std::endl;
- retval++;
- }
- else if(!cmSystemTools::ComputeFileMD5(filename, md5out))
- {
- // To mimic md5sum behavior in a shell:
- std::cerr << filename << ": No such file or directory" << std::endl;
- retval++;
- }
- else
- {
- std::cout << std::string(md5out,32) << " " << filename << std::endl;
- }
- }
- return retval;
- }
-
- // Command to change directory and run a program.
- else if (args[1] == "chdir" && args.size() >= 4)
- {
- std::string directory = args[2];
- if(!cmSystemTools::FileExists(directory.c_str()))
- {
- cmSystemTools::Error("Directory does not exist for chdir command: ",
- args[2].c_str());
- return 1;
- }
-
- std::string command = "\"";
- command += args[3];
- command += "\"";
- for (std::string::size_type cc = 4; cc < args.size(); cc ++)
- {
- command += " \"";
- command += args[cc];
- command += "\"";
- }
- int retval = 0;
- int timeout = 0;
- if ( cmSystemTools::RunSingleCommand(command.c_str(), 0, &retval,
- directory.c_str(), cmSystemTools::OUTPUT_NORMAL, timeout) )
- {
- return retval;
- }
-
- return 1;
- }
-
- // Command to start progress for a build
- else if (args[1] == "cmake_progress_start" && args.size() == 4)
- {
- // basically remove the directory
- std::string dirName = args[2];
- dirName += "/Progress";
- cmSystemTools::RemoveADirectory(dirName.c_str());
-
- // is the last argument a filename that exists?
- FILE *countFile = fopen(args[3].c_str(),"r");
- int count;
- if (countFile)
- {
- if (1!=fscanf(countFile,"%i",&count))
- {
- cmSystemTools::Message("Could not read from count file.");
- }
- fclose(countFile);
- }
- else
- {
- count = atoi(args[3].c_str());
- }
- if (count)
- {
- cmSystemTools::MakeDirectory(dirName.c_str());
- // write the count into the directory
- std::string fName = dirName;
- fName += "/count.txt";
- FILE *progFile = fopen(fName.c_str(),"w");
- if (progFile)
- {
- fprintf(progFile,"%i\n",count);
- fclose(progFile);
- }
- }
- return 0;
- }
-
- // Command to report progress for a build
- else if (args[1] == "cmake_progress_report" && args.size() >= 3)
- {
- std::string dirName = args[2];
- dirName += "/Progress";
- std::string fName;
- FILE *progFile;
-
- // read the count
- fName = dirName;
- fName += "/count.txt";
- progFile = fopen(fName.c_str(),"r");
- int count = 0;
- if (!progFile)
- {
- return 0;
- }
- else
- {
- if (1!=fscanf(progFile,"%i",&count))
- {
- cmSystemTools::Message("Could not read from progress file.");
- }
- fclose(progFile);
- }
- unsigned int i;
- for (i = 3; i < args.size(); ++i)
- {
- fName = dirName;
- fName += "/";
- fName += args[i];
- progFile = fopen(fName.c_str(),"w");
- if (progFile)
- {
- fprintf(progFile,"empty");
- fclose(progFile);
- }
- }
- int fileNum = static_cast<int>
- (cmsys::Directory::GetNumberOfFilesInDirectory(dirName.c_str()));
- if (count > 0)
- {
- // print the progress
- fprintf(stdout,"[%3i%%] ",((fileNum-3)*100)/count);
- }
- return 0;
- }
-
- // Command to create a symbolic link. Fails on platforms not
- // supporting them.
- else if (args[1] == "create_symlink" && args.size() == 4)
- {
- const char* destinationFileName = args[3].c_str();
- if ( cmSystemTools::FileExists(destinationFileName) )
- {
- if ( cmSystemTools::FileIsSymlink(destinationFileName) )
- {
- if ( !cmSystemTools::RemoveFile(destinationFileName) ||
- cmSystemTools::FileExists(destinationFileName) )
- {
- return 0;
- }
- }
- else
- {
- return 0;
- }
- }
- return cmSystemTools::CreateSymlink(args[2].c_str(),
- args[3].c_str())? 0:1;
- }
-
- // Internal CMake shared library support.
- else if (args[1] == "cmake_symlink_library" && args.size() == 5)
- {
- return cmake::SymlinkLibrary(args);
- }
- // Internal CMake versioned executable support.
- else if (args[1] == "cmake_symlink_executable" && args.size() == 4)
- {
- return cmake::SymlinkExecutable(args);
- }
-
-#if defined(CMAKE_HAVE_VS_GENERATORS)
- // Internal CMake support for calling Visual Studio macros.
- else if (args[1] == "cmake_call_visual_studio_macro" && args.size() >= 4)
- {
- // args[2] = full path to .sln file or "ALL"
- // args[3] = name of Visual Studio macro to call
- // args[4..args.size()-1] = [optional] args for Visual Studio macro
-
- std::string macroArgs;
-
- if (args.size() > 4)
- {
- macroArgs = args[4];
-
- for (size_t i = 5; i < args.size(); ++i)
- {
- macroArgs += " ";
- macroArgs += args[i];
- }
- }
-
- return cmCallVisualStudioMacro::CallMacro(args[2], args[3],
- macroArgs, true);
- }
-#endif
-
- // Internal CMake dependency scanning support.
- else if (args[1] == "cmake_depends" && args.size() >= 6)
- {
- // Use the make system's VERBOSE environment variable to enable
- // verbose output. This can be skipped by also setting CMAKE_NO_VERBOSE
- // (which is set by the Eclipse and KDevelop generators).
- bool verbose = ((cmSystemTools::GetEnv("VERBOSE") != 0)
- && (cmSystemTools::GetEnv("CMAKE_NO_VERBOSE") == 0));
-
- // Create a cmake object instance to process dependencies.
- cmake cm;
- std::string gen;
- std::string homeDir;
- std::string startDir;
- std::string homeOutDir;
- std::string startOutDir;
- std::string depInfo;
- bool color = false;
- if(args.size() >= 8)
- {
- // Full signature:
- //
- // -E cmake_depends <generator>
- // <home-src-dir> <start-src-dir>
- // <home-out-dir> <start-out-dir>
- // <dep-info> [--color=$(COLOR)]
- //
- // All paths are provided.
- gen = args[2];
- homeDir = args[3];
- startDir = args[4];
- homeOutDir = args[5];
- startOutDir = args[6];
- depInfo = args[7];
- if(args.size() >= 9 &&
- args[8].length() >= 8 &&
- args[8].substr(0, 8) == "--color=")
- {
- // Enable or disable color based on the switch value.
- color = (args[8].size() == 8 ||
- cmSystemTools::IsOn(args[8].substr(8).c_str()));
- }
- }
- else
- {
- // Support older signature for existing makefiles:
- //
- // -E cmake_depends <generator>
- // <home-out-dir> <start-out-dir>
- // <dep-info>
- //
- // Just pretend the source directories are the same as the
- // binary directories so at least scanning will work.
- gen = args[2];
- homeDir = args[3];
- startDir = args[4];
- homeOutDir = args[3];
- startOutDir = args[3];
- depInfo = args[5];
- }
-
- // Create a local generator configured for the directory in
- // which dependencies will be scanned.
- homeDir = cmSystemTools::CollapseFullPath(homeDir.c_str());
- startDir = cmSystemTools::CollapseFullPath(startDir.c_str());
- homeOutDir = cmSystemTools::CollapseFullPath(homeOutDir.c_str());
- startOutDir = cmSystemTools::CollapseFullPath(startOutDir.c_str());
- cm.SetHomeDirectory(homeDir.c_str());
- cm.SetStartDirectory(startDir.c_str());
- cm.SetHomeOutputDirectory(homeOutDir.c_str());
- cm.SetStartOutputDirectory(startOutDir.c_str());
- if(cmGlobalGenerator* ggd = cm.CreateGlobalGenerator(gen.c_str()))
- {
- cm.SetGlobalGenerator(ggd);
- cmsys::auto_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator());
- lgd->GetMakefile()->SetStartDirectory(startDir.c_str());
- lgd->GetMakefile()->SetStartOutputDirectory(startOutDir.c_str());
- lgd->GetMakefile()->MakeStartDirectoriesCurrent();
-
- // Actually scan dependencies.
- return lgd->UpdateDependencies(depInfo.c_str(),
- verbose, color)? 0 : 2;
- }
- return 1;
- }
-
- // Internal CMake link script support.
- else if (args[1] == "cmake_link_script" && args.size() >= 3)
- {
- return cmake::ExecuteLinkScript(args);
- }
-
- // Internal CMake unimplemented feature notification.
- else if (args[1] == "cmake_unimplemented_variable")
- {
- std::cerr << "Feature not implemented for this platform.";
- if(args.size() == 3)
- {
- std::cerr << " Variable " << args[2] << " is not set.";
- }
- std::cerr << std::endl;
- return 1;
- }
- else if (args[1] == "vs_link_exe")
- {
- return cmake::VisualStudioLink(args, 1);
- }
- else if (args[1] == "vs_link_dll")
- {
- return cmake::VisualStudioLink(args, 2);
- }
-#ifdef CMAKE_BUILD_WITH_CMAKE
- // Internal CMake color makefile support.
- else if (args[1] == "cmake_echo_color")
- {
- return cmake::ExecuteEchoColor(args);
- }
- else if (args[1] == "cmake_automoc")
- {
- cmQtAutomoc automoc;
- const char *config = args[3].empty() ? 0 : args[3].c_str();
- bool automocSuccess = automoc.Run(args[2].c_str(), config);
- return automocSuccess ? 0 : 1;
- }
-#endif
-
- // Tar files
- else if (args[1] == "tar" && args.size() > 3)
- {
- std::string flags = args[2];
- std::string outFile = args[3];
- std::vector<cmStdString> files;
- for (std::string::size_type cc = 4; cc < args.size(); cc ++)
- {
- files.push_back(args[cc]);
- }
- bool gzip = false;
- bool bzip2 = false;
- bool verbose = false;
- if ( flags.find_first_of('j') != flags.npos )
- {
- bzip2 = true;
- }
- if ( flags.find_first_of('z') != flags.npos )
- {
- gzip = true;
- }
- if ( flags.find_first_of('v') != flags.npos )
- {
- verbose = true;
- }
-
- if ( flags.find_first_of('t') != flags.npos )
- {
- if ( !cmSystemTools::ListTar(outFile.c_str(), gzip, verbose) )
- {
- cmSystemTools::Error("Problem creating tar: ", outFile.c_str());
- return 1;
- }
- }
- else if ( flags.find_first_of('c') != flags.npos )
- {
- if ( !cmSystemTools::CreateTar(
- outFile.c_str(), files, gzip, bzip2, verbose) )
- {
- cmSystemTools::Error("Problem creating tar: ", outFile.c_str());
- return 1;
- }
- }
- else if ( flags.find_first_of('x') != flags.npos )
- {
- if ( !cmSystemTools::ExtractTar(
- outFile.c_str(), gzip, verbose) )
- {
- cmSystemTools::Error("Problem extracting tar: ", outFile.c_str());
- return 1;
- }
-#ifdef WIN32
- // OK, on windows 7 after we untar some files,
- // sometimes we can not rename the directory after
- // the untar is done. This breaks the external project
- // untar and rename code. So, by default we will wait
- // 1/10th of a second after the untar. If CMAKE_UNTAR_DELAY
- // is set in the env, its value will be used instead of 100.
- int delay = 100;
- const char* delayVar = cmSystemTools::GetEnv("CMAKE_UNTAR_DELAY");
- if(delayVar)
- {
- delay = atoi(delayVar);
- }
- if(delay)
- {
- cmSystemTools::Delay(delay);
- }
-#endif
- }
- return 0;
- }
-
-#if defined(CMAKE_BUILD_WITH_CMAKE)
- // Internal CMake Fortran module support.
- else if (args[1] == "cmake_copy_f90_mod" && args.size() >= 4)
- {
- return cmDependsFortran::CopyModule(args)? 0 : 1;
- }
-#endif
-
-#if defined(_WIN32) && !defined(__CYGWIN__)
- // Write registry value
- else if (args[1] == "write_regv" && args.size() > 3)
- {
- return cmSystemTools::WriteRegistryValue(args[2].c_str(),
- args[3].c_str()) ? 0 : 1;
- }
-
- // Delete registry value
- else if (args[1] == "delete_regv" && args.size() > 2)
- {
- return cmSystemTools::DeleteRegistryValue(args[2].c_str()) ? 0 : 1;
- }
- // Remove file
- else if (args[1] == "comspec" && args.size() > 2)
- {
- unsigned int cc;
- std::string command = args[2];
- for ( cc = 3; cc < args.size(); cc ++ )
- {
- command += " " + args[cc];
- }
- return cmWin32ProcessExecution::Windows9xHack(command.c_str());
- }
- else if (args[1] == "env_vs8_wince" && args.size() == 3)
- {
- return cmake::WindowsCEEnvironment("8.0", args[2]);
- }
- else if (args[1] == "env_vs9_wince" && args.size() == 3)
- {
- return cmake::WindowsCEEnvironment("9.0", args[2]);
- }
-#endif
- }
-
- ::CMakeCommandUsage(args[0].c_str());
- return 1;
-}
-
void cmake::AddExtraGenerator(const char* name,
CreateExtraGeneratorFunctionType newFunction)
{
@@ -2437,11 +1690,6 @@ int cmake::ActualConfigure()
{
this->CacheManager->SaveCache(this->GetHomeOutputDirectory());
}
- if ( !this->GraphVizFile.empty() )
- {
- std::cout << "Generate graphviz: " << this->GraphVizFile << std::endl;
- this->GenerateGraphViz(this->GraphVizFile.c_str());
- }
if(cmSystemTools::GetErrorOccuredFlag())
{
return -1;
@@ -2604,6 +1852,11 @@ int cmake::Generate()
return -1;
}
this->GlobalGenerator->Generate();
+ if ( !this->GraphVizFile.empty() )
+ {
+ std::cout << "Generate graphviz: " << this->GraphVizFile << std::endl;
+ this->GenerateGraphViz(this->GraphVizFile.c_str());
+ }
if(this->WarnUnusedCli)
{
this->RunCheckForUnusedVariables();
@@ -3169,264 +2422,6 @@ void cmake::GenerateGraphViz(const char* fileName) const
#endif
}
-
-//----------------------------------------------------------------------------
-int cmake::SymlinkLibrary(std::vector<std::string>& args)
-{
- int result = 0;
- std::string realName = args[2];
- std::string soName = args[3];
- std::string name = args[4];
- if(soName != realName)
- {
- if(!cmake::SymlinkInternal(realName, soName))
- {
- cmSystemTools::ReportLastSystemError("cmake_symlink_library");
- result = 1;
- }
- }
- if(name != soName)
- {
- if(!cmake::SymlinkInternal(soName, name))
- {
- cmSystemTools::ReportLastSystemError("cmake_symlink_library");
- result = 1;
- }
- }
- return result;
-}
-
-//----------------------------------------------------------------------------
-int cmake::SymlinkExecutable(std::vector<std::string>& args)
-{
- int result = 0;
- std::string realName = args[2];
- std::string name = args[3];
- if(name != realName)
- {
- if(!cmake::SymlinkInternal(realName, name))
- {
- cmSystemTools::ReportLastSystemError("cmake_symlink_executable");
- result = 1;
- }
- }
- return result;
-}
-
-//----------------------------------------------------------------------------
-bool cmake::SymlinkInternal(std::string const& file, std::string const& link)
-{
- if(cmSystemTools::FileExists(link.c_str()) ||
- cmSystemTools::FileIsSymlink(link.c_str()))
- {
- cmSystemTools::RemoveFile(link.c_str());
- }
-#if defined(_WIN32) && !defined(__CYGWIN__)
- return cmSystemTools::CopyFileAlways(file.c_str(), link.c_str());
-#else
- std::string linktext = cmSystemTools::GetFilenameName(file);
- return cmSystemTools::CreateSymlink(linktext.c_str(), link.c_str());
-#endif
-}
-
-//----------------------------------------------------------------------------
-#ifdef CMAKE_BUILD_WITH_CMAKE
-int cmake::ExecuteEchoColor(std::vector<std::string>& args)
-{
- // The arguments are
- // argv[0] == <cmake-executable>
- // argv[1] == cmake_echo_color
-
- bool enabled = true;
- int color = cmsysTerminal_Color_Normal;
- bool newline = true;
- for(unsigned int i=2; i < args.size(); ++i)
- {
- if(args[i].find("--switch=") == 0)
- {
- // Enable or disable color based on the switch value.
- std::string value = args[i].substr(9);
- if(!value.empty())
- {
- if(cmSystemTools::IsOn(value.c_str()))
- {
- enabled = true;
- }
- else
- {
- enabled = false;
- }
- }
- }
- else if(args[i] == "--normal")
- {
- color = cmsysTerminal_Color_Normal;
- }
- else if(args[i] == "--black")
- {
- color = cmsysTerminal_Color_ForegroundBlack;
- }
- else if(args[i] == "--red")
- {
- color = cmsysTerminal_Color_ForegroundRed;
- }
- else if(args[i] == "--green")
- {
- color = cmsysTerminal_Color_ForegroundGreen;
- }
- else if(args[i] == "--yellow")
- {
- color = cmsysTerminal_Color_ForegroundYellow;
- }
- else if(args[i] == "--blue")
- {
- color = cmsysTerminal_Color_ForegroundBlue;
- }
- else if(args[i] == "--magenta")
- {
- color = cmsysTerminal_Color_ForegroundMagenta;
- }
- else if(args[i] == "--cyan")
- {
- color = cmsysTerminal_Color_ForegroundCyan;
- }
- else if(args[i] == "--white")
- {
- color = cmsysTerminal_Color_ForegroundWhite;
- }
- else if(args[i] == "--bold")
- {
- color |= cmsysTerminal_Color_ForegroundBold;
- }
- else if(args[i] == "--no-newline")
- {
- newline = false;
- }
- else if(args[i] == "--newline")
- {
- newline = true;
- }
- else
- {
- // Color is enabled. Print with the current color.
- cmSystemTools::MakefileColorEcho(color, args[i].c_str(),
- newline, enabled);
- }
- }
-
- return 0;
-}
-#else
-int cmake::ExecuteEchoColor(std::vector<std::string>&)
-{
- return 1;
-}
-#endif
-
-//----------------------------------------------------------------------------
-int cmake::ExecuteLinkScript(std::vector<std::string>& args)
-{
- // The arguments are
- // argv[0] == <cmake-executable>
- // argv[1] == cmake_link_script
- // argv[2] == <link-script-name>
- // argv[3] == --verbose=?
- bool verbose = false;
- if(args.size() >= 4)
- {
- if(args[3].find("--verbose=") == 0)
- {
- if(!cmSystemTools::IsOff(args[3].substr(10).c_str()))
- {
- verbose = true;
- }
- }
- }
-
- // Allocate a process instance.
- cmsysProcess* cp = cmsysProcess_New();
- if(!cp)
- {
- std::cerr << "Error allocating process instance in link script."
- << std::endl;
- return 1;
- }
-
- // Children should share stdout and stderr with this process.
- cmsysProcess_SetPipeShared(cp, cmsysProcess_Pipe_STDOUT, 1);
- cmsysProcess_SetPipeShared(cp, cmsysProcess_Pipe_STDERR, 1);
-
- // Run the command lines verbatim.
- cmsysProcess_SetOption(cp, cmsysProcess_Option_Verbatim, 1);
-
- // Read command lines from the script.
- std::ifstream fin(args[2].c_str());
- if(!fin)
- {
- std::cerr << "Error opening link script \""
- << args[2] << "\"" << std::endl;
- return 1;
- }
-
- // Run one command at a time.
- std::string command;
- int result = 0;
- while(result == 0 && cmSystemTools::GetLineFromStream(fin, command))
- {
- // Skip empty command lines.
- if(command.find_first_not_of(" \t") == command.npos)
- {
- continue;
- }
-
- // Setup this command line.
- const char* cmd[2] = {command.c_str(), 0};
- cmsysProcess_SetCommand(cp, cmd);
-
- // Report the command if verbose output is enabled.
- if(verbose)
- {
- std::cout << command << std::endl;
- }
-
- // Run the command and wait for it to exit.
- cmsysProcess_Execute(cp);
- cmsysProcess_WaitForExit(cp, 0);
-
- // Report failure if any.
- switch(cmsysProcess_GetState(cp))
- {
- case cmsysProcess_State_Exited:
- {
- int value = cmsysProcess_GetExitValue(cp);
- if(value != 0)
- {
- result = value;
- }
- }
- break;
- case cmsysProcess_State_Exception:
- std::cerr << "Error running link command: "
- << cmsysProcess_GetExceptionString(cp) << std::endl;
- result = 1;
- break;
- case cmsysProcess_State_Error:
- std::cerr << "Error running link command: "
- << cmsysProcess_GetErrorString(cp) << std::endl;
- result = 2;
- break;
- default:
- break;
- };
- }
-
- // Free the process instance.
- cmsysProcess_Delete(cp);
-
- // Return the final resulting return value.
- return result;
-}
-
void cmake::DefineProperties(cmake *cm)
{
cm->DefineProperty
@@ -3640,13 +2635,6 @@ void cmake::DefineProperty(const char *name, cmProperty::ScopeType scope,
chained);
}
-bool cmake::GetIsPropertyDefined(const char *name,
- cmProperty::ScopeType scope)
-{
- return this->PropertyDefinitions[scope].find(name) !=
- this->PropertyDefinitions[scope].end();
-}
-
cmPropertyDefinition *cmake
::GetPropertyDefinition(const char *name,
cmProperty::ScopeType scope)
@@ -4119,356 +3107,6 @@ static bool cmakeCheckStampList(const char* stampList)
}
//----------------------------------------------------------------------------
-int cmake::WindowsCEEnvironment(const char* version, const std::string& name)
-{
-#if defined(CMAKE_HAVE_VS_GENERATORS)
- cmVisualStudioWCEPlatformParser parser(name.c_str());
- parser.ParseVersion(version);
- if (parser.Found())
- {
- std::cout << "@echo off" << std::endl;
- std::cout << "echo Environment Selection: " << name << std::endl;
- std::cout << "set PATH=" << parser.GetPathDirectories() << std::endl;
- std::cout << "set INCLUDE=" << parser.GetIncludeDirectories() <<std::endl;
- std::cout << "set LIB=" << parser.GetLibraryDirectories() <<std::endl;
- return 0;
- }
-#else
- (void)version;
-#endif
-
- std::cerr << "Could not find " << name;
- return -1;
-}
-
-// For visual studio 2005 and newer manifest files need to be embedded into
-// exe and dll's. This code does that in such a way that incremental linking
-// still works.
-int cmake::VisualStudioLink(std::vector<std::string>& args, int type)
-{
- if(args.size() < 2)
- {
- return -1;
- }
- bool verbose = false;
- if(cmSystemTools::GetEnv("VERBOSE"))
- {
- verbose = true;
- }
- std::vector<std::string> expandedArgs;
- for(std::vector<std::string>::iterator i = args.begin();
- i != args.end(); ++i)
- {
- // check for nmake temporary files
- if((*i)[0] == '@' && i->find("@CMakeFiles") != 0 )
- {
- std::ifstream fin(i->substr(1).c_str());
- std::string line;
- while(cmSystemTools::GetLineFromStream(fin,
- line))
- {
- cmSystemTools::ParseWindowsCommandLine(line.c_str(), expandedArgs);
- }
- }
- else
- {
- expandedArgs.push_back(*i);
- }
- }
- bool hasIncremental = false;
- bool hasManifest = true;
- for(std::vector<std::string>::iterator i = expandedArgs.begin();
- i != expandedArgs.end(); ++i)
- {
- if(cmSystemTools::Strucmp(i->c_str(), "/INCREMENTAL:YES") == 0)
- {
- hasIncremental = true;
- }
- if(cmSystemTools::Strucmp(i->c_str(), "/INCREMENTAL") == 0)
- {
- hasIncremental = true;
- }
- if(cmSystemTools::Strucmp(i->c_str(), "/MANIFEST:NO") == 0)
- {
- hasManifest = false;
- }
- }
- if(hasIncremental && hasManifest)
- {
- if(verbose)
- {
- std::cout << "Visual Studio Incremental Link with embedded manifests\n";
- }
- return cmake::VisualStudioLinkIncremental(expandedArgs, type, verbose);
- }
- if(verbose)
- {
- if(!hasIncremental)
- {
- std::cout << "Visual Studio Non-Incremental Link\n";
- }
- else
- {
- std::cout << "Visual Studio Incremental Link without manifests\n";
- }
- }
- return cmake::VisualStudioLinkNonIncremental(expandedArgs,
- type, hasManifest, verbose);
-}
-
-int cmake::ParseVisualStudioLinkCommand(std::vector<std::string>& args,
- std::vector<cmStdString>& command,
- std::string& targetName)
-{
- std::vector<std::string>::iterator i = args.begin();
- i++; // skip -E
- i++; // skip vs_link_dll or vs_link_exe
- command.push_back(*i);
- i++; // move past link command
- for(; i != args.end(); ++i)
- {
- command.push_back(*i);
- if(i->find("/Fe") == 0)
- {
- targetName = i->substr(3);
- }
- if(i->find("/out:") == 0)
- {
- targetName = i->substr(5);
- }
- }
- if(targetName.size() == 0 || command.size() == 0)
- {
- return -1;
- }
- return 0;
-}
-
-bool cmake::RunCommand(const char* comment,
- std::vector<cmStdString>& command,
- bool verbose,
- int* retCodeOut)
-{
- if(verbose)
- {
- std::cout << comment << ":\n";
- for(std::vector<cmStdString>::iterator i = command.begin();
- i != command.end(); ++i)
- {
- std::cout << i->c_str() << " ";
- }
- std::cout << "\n";
- }
- std::string output;
- int retCode =0;
- // use rc command to create .res file
- cmSystemTools::RunSingleCommand(command,
- &output,
- &retCode, 0, cmSystemTools::OUTPUT_NONE);
- // always print the output of the command, unless
- // it is the dumb rc command banner, but if the command
- // returned an error code then print the output anyway as
- // the banner may be mixed with some other important information.
- if(output.find("Resource Compiler Version") == output.npos
- || retCode !=0)
- {
- std::cout << output;
- }
- // if retCodeOut is requested then always return true
- // and set the retCodeOut to retCode
- if(retCodeOut)
- {
- *retCodeOut = retCode;
- return true;
- }
- if(retCode != 0)
- {
- std::cout << comment << " failed. with " << retCode << "\n";
- }
- return retCode == 0;
-}
-
-int cmake::VisualStudioLinkIncremental(std::vector<std::string>& args,
- int type, bool verbose)
-{
- // This follows the steps listed here:
- // http://blogs.msdn.com/zakramer/archive/2006/05/22/603558.aspx
-
- // 1. Compiler compiles the application and generates the *.obj files.
- // 2. An empty manifest file is generated if this is a clean build and if
- // not the previous one is reused.
- // 3. The resource compiler (rc.exe) compiles the *.manifest file to a
- // *.res file.
- // 4. Linker generates the binary (EXE or DLL) with the /incremental
- // switch and embeds the dummy manifest file. The linker also generates
- // the real manifest file based on the binaries that your binary depends
- // on.
- // 5. The manifest tool (mt.exe) is then used to generate the final
- // manifest.
-
- // If the final manifest is changed, then 6 and 7 are run, if not
- // they are skipped, and it is done.
-
- // 6. The resource compiler is invoked one more time.
- // 7. Finally, the Linker does another incremental link, but since the
- // only thing that has changed is the *.res file that contains the
- // manifest it is a short link.
- std::vector<cmStdString> linkCommand;
- std::string targetName;
- if(cmake::ParseVisualStudioLinkCommand(args, linkCommand, targetName) == -1)
- {
- return -1;
- }
- std::string manifestArg = "/MANIFESTFILE:";
- std::vector<cmStdString> rcCommand;
- rcCommand.push_back(cmSystemTools::FindProgram("rc.exe"));
- std::vector<cmStdString> mtCommand;
- mtCommand.push_back(cmSystemTools::FindProgram("mt.exe"));
- std::string tempManifest;
- tempManifest = targetName;
- tempManifest += ".intermediate.manifest";
- std::string resourceInputFile = targetName;
- resourceInputFile += ".resource.txt";
- if(verbose)
- {
- std::cout << "Create " << resourceInputFile.c_str() << "\n";
- }
- // Create input file for rc command
- std::ofstream fout(resourceInputFile.c_str());
- if(!fout)
- {
- return -1;
- }
- std::string manifestFile = targetName;
- manifestFile += ".embed.manifest";
- std::string fullPath= cmSystemTools::CollapseFullPath(manifestFile.c_str());
- fout << type << " /* CREATEPROCESS_MANIFEST_RESOURCE_ID "
- "*/ 24 /* RT_MANIFEST */ " << "\"" << fullPath.c_str() << "\"";
- fout.close();
- manifestArg += tempManifest;
- // add the manifest arg to the linkCommand
- linkCommand.push_back("/MANIFEST");
- linkCommand.push_back(manifestArg);
- // if manifestFile is not yet created, create an
- // empty one
- if(!cmSystemTools::FileExists(manifestFile.c_str()))
- {
- if(verbose)
- {
- std::cout << "Create empty: " << manifestFile.c_str() << "\n";
- }
- std::ofstream foutTmp(manifestFile.c_str());
- }
- std::string resourceFile = manifestFile;
- resourceFile += ".res";
- // add the resource file to the end of the link command
- linkCommand.push_back(resourceFile);
- std::string outputOpt = "/fo";
- outputOpt += resourceFile;
- rcCommand.push_back(outputOpt);
- rcCommand.push_back(resourceInputFile);
- // Run rc command to create resource
- if(!cmake::RunCommand("RC Pass 1", rcCommand, verbose))
- {
- return -1;
- }
- // Now run the link command to link and create manifest
- if(!cmake::RunCommand("LINK Pass 1", linkCommand, verbose))
- {
- return -1;
- }
- // create mt command
- std::string outArg("/out:");
- outArg+= manifestFile;
- mtCommand.push_back("/nologo");
- mtCommand.push_back(outArg);
- mtCommand.push_back("/notify_update");
- mtCommand.push_back("/manifest");
- mtCommand.push_back(tempManifest);
- // now run mt.exe to create the final manifest file
- int mtRet =0;
- cmake::RunCommand("MT", mtCommand, verbose, &mtRet);
- // if mt returns 0, then the manifest was not changed and
- // we do not need to do another link step
- if(mtRet == 0)
- {
- return 0;
- }
- // check for magic mt return value if mt returns the magic number
- // 1090650113 then it means that it updated the manifest file and we need
- // to do the final link. If mt has any value other than 0 or 1090650113
- // then there was some problem with the command itself and there was an
- // error so return the error code back out of cmake so make can report it.
- if(mtRet != 1090650113)
- {
- return mtRet;
- }
- // update the resource file with the new manifest from the mt command.
- if(!cmake::RunCommand("RC Pass 2", rcCommand, verbose))
- {
- return -1;
- }
- // Run the final incremental link that will put the new manifest resource
- // into the file incrementally.
- if(!cmake::RunCommand("FINAL LINK", linkCommand, verbose))
- {
- return -1;
- }
- return 0;
-}
-
-int cmake::VisualStudioLinkNonIncremental(std::vector<std::string>& args,
- int type,
- bool hasManifest,
- bool verbose)
-{
- std::vector<cmStdString> linkCommand;
- std::string targetName;
- if(cmake::ParseVisualStudioLinkCommand(args, linkCommand, targetName) == -1)
- {
- return -1;
- }
- // Run the link command as given
- if (hasManifest)
- {
- linkCommand.push_back("/MANIFEST");
- }
- if(!cmake::RunCommand("LINK", linkCommand, verbose))
- {
- return -1;
- }
- if(!hasManifest)
- {
- return 0;
- }
- std::vector<cmStdString> mtCommand;
- mtCommand.push_back(cmSystemTools::FindProgram("mt.exe"));
- mtCommand.push_back("/nologo");
- mtCommand.push_back("/manifest");
- std::string manifestFile = targetName;
- manifestFile += ".manifest";
- mtCommand.push_back(manifestFile);
- std::string outresource = "/outputresource:";
- outresource += targetName;
- outresource += ";#";
- if(type == 1)
- {
- outresource += "1";
- }
- else if(type == 2)
- {
- outresource += "2";
- }
- mtCommand.push_back(outresource);
- // Now use the mt tool to embed the manifest into the exe or dll
- if(!cmake::RunCommand("MT", mtCommand, verbose))
- {
- return -1;
- }
- return 0;
-}
-
-//----------------------------------------------------------------------------
void cmake::IssueMessage(cmake::MessageType t, std::string const& text,
cmListFileBacktrace const& backtrace)
{
diff --git a/Source/cmake.h b/Source/cmake.h
index a50c1ed..ccf91e3 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -209,11 +209,6 @@ class cmake
void AddCacheEntry(const char* key, const char* value,
const char* helpString,
int type);
- /**
- * Execute commands during the build process. Supports options such
- * as echo, remove file etc.
- */
- static int ExecuteCMakeCommand(std::vector<std::string>&);
/**
* Get the system information and write it to the file specified
@@ -349,8 +344,6 @@ class cmake
bool chain = false,
const char *variableGroup = 0);
- bool GetIsPropertyDefined(const char *name, cmProperty::ScopeType scope);
-
// get property definition
cmPropertyDefinition *GetPropertyDefinition
(const char *name, cmProperty::ScopeType scope);
@@ -450,29 +443,6 @@ protected:
void GenerateGraphViz(const char* fileName) const;
- static int SymlinkLibrary(std::vector<std::string>& args);
- static int SymlinkExecutable(std::vector<std::string>& args);
- static bool SymlinkInternal(std::string const& file,
- std::string const& link);
- static int ExecuteEchoColor(std::vector<std::string>& args);
- static int ExecuteLinkScript(std::vector<std::string>& args);
- static int WindowsCEEnvironment(const char* version,
- const std::string& name);
- static int VisualStudioLink(std::vector<std::string>& args, int type);
- static int VisualStudioLinkIncremental(std::vector<std::string>& args,
- int type,
- bool verbose);
- static int VisualStudioLinkNonIncremental(std::vector<std::string>& args,
- int type,
- bool hasManifest,
- bool verbose);
- static int ParseVisualStudioLinkCommand(std::vector<std::string>& args,
- std::vector<cmStdString>& command,
- std::string& targetName);
- static bool RunCommand(const char* comment,
- std::vector<cmStdString>& command,
- bool verbose,
- int* retCodeOut = 0);
cmVariableWatch* VariableWatch;
///! Find the full path to one of the cmake programs like ctest, cpack, etc.
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 68d8339..73c76e4 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -17,6 +17,7 @@
#endif
#include "cmake.h"
+#include "cmcmd.h"
#include "cmCacheManager.h"
#include "cmListFileCache.h"
#include "cmakewizard.h"
@@ -510,7 +511,7 @@ int do_cmake(int ac, char** av)
}
if(command)
{
- int ret = cmake::ExecuteCMakeCommand(args);
+ int ret = cmcmd::ExecuteCMakeCommand(args);
return ret;
}
if (wiz)
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
new file mode 100644
index 0000000..48d7d7b
--- /dev/null
+++ b/Source/cmcmd.cxx
@@ -0,0 +1,1374 @@
+/*============================================================================
+ 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.
+============================================================================*/
+#include "cmcmd.h"
+#include "cmMakefile.h"
+#include "cmLocalGenerator.h"
+#include "cmGlobalGenerator.h"
+#include "cmQtAutomoc.h"
+#include "cmVersion.h"
+
+#if defined(CMAKE_BUILD_WITH_CMAKE)
+# include "cmDependsFortran.h" // For -E cmake_copy_f90_mod callback.
+# include <cmsys/Terminal.h>
+#endif
+
+#include <cmsys/Directory.hxx>
+#include <cmsys/Process.h>
+
+#if defined(CMAKE_HAVE_VS_GENERATORS)
+#include "cmCallVisualStudioMacro.h"
+#include "cmVisualStudioWCEPlatformParser.h"
+#endif
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+# include "cmWin32ProcessExecution.h"
+#endif
+
+#include <time.h>
+
+#include <stdlib.h> // required for atoi
+
+void CMakeCommandUsage(const char* program)
+{
+ cmOStringStream errorStream;
+
+#ifdef CMAKE_BUILD_WITH_CMAKE
+ errorStream
+ << "cmake version " << cmVersion::GetCMakeVersion() << "\n";
+#else
+ errorStream
+ << "cmake bootstrap\n";
+#endif
+ // If you add new commands, change here,
+ // and in cmakemain.cxx in the options table
+ errorStream
+ << "Usage: " << program << " -E [command] [arguments ...]\n"
+ << "Available commands: \n"
+ << " chdir dir cmd [args]... - run command in a given directory\n"
+ << " compare_files file1 file2 - check if file1 is same as file2\n"
+ << " copy file destination - copy file to destination (either file "
+ "or directory)\n"
+ << " copy_directory source destination - copy directory 'source' "
+ "content to directory 'destination'\n"
+ << " copy_if_different in-file out-file - copy file if input has "
+ "changed\n"
+ << " echo [string]... - displays arguments as text\n"
+ << " echo_append [string]... - displays arguments as text but no new "
+ "line\n"
+ << " environment - display the current environment\n"
+ << " make_directory dir - create a directory\n"
+ << " md5sum file1 [...] - compute md5sum of files\n"
+ << " remove [-f] file1 file2 ... - remove the file(s), use -f to force "
+ "it\n"
+ << " 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 ...]\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"
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ << "Available on Windows only:\n"
+ << " comspec - on windows 9x use this for RunCommand\n"
+ << " delete_regv key - delete registry value\n"
+ << " env_vs8_wince sdkname - displays a batch file which sets the "
+ "environment for the provided Windows CE SDK installed in VS2005\n"
+ << " env_vs9_wince sdkname - displays a batch file which sets the "
+ "environment for the provided Windows CE SDK installed in VS2008\n"
+ << " write_regv key value - write registry value\n"
+#else
+ << "Available on UNIX only:\n"
+ << " create_symlink old new - create a symbolic link new -> old\n"
+#endif
+ ;
+
+ cmSystemTools::Error(errorStream.str().c_str());
+}
+
+int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
+{
+ // IF YOU ADD A NEW COMMAND, DOCUMENT IT ABOVE and in cmakemain.cxx
+ if (args.size() > 1)
+ {
+ // Copy file
+ if (args[1] == "copy" && args.size() == 4)
+ {
+ if(!cmSystemTools::cmCopyFile(args[2].c_str(), args[3].c_str()))
+ {
+ std::cerr << "Error copying file \"" << args[2].c_str()
+ << "\" to \"" << args[3].c_str() << "\".\n";
+ return 1;
+ }
+ return 0;
+ }
+
+ // Copy file if different.
+ if (args[1] == "copy_if_different" && args.size() == 4)
+ {
+ if(!cmSystemTools::CopyFileIfDifferent(args[2].c_str(),
+ args[3].c_str()))
+ {
+ std::cerr << "Error copying file (if different) from \""
+ << args[2].c_str() << "\" to \"" << args[3].c_str()
+ << "\".\n";
+ return 1;
+ }
+ return 0;
+ }
+
+ // Copy directory content
+ if (args[1] == "copy_directory" && args.size() == 4)
+ {
+ if(!cmSystemTools::CopyADirectory(args[2].c_str(), args[3].c_str()))
+ {
+ std::cerr << "Error copying directory from \""
+ << args[2].c_str() << "\" to \"" << args[3].c_str()
+ << "\".\n";
+ return 1;
+ }
+ return 0;
+ }
+
+ // Rename a file or directory
+ if (args[1] == "rename" && args.size() == 4)
+ {
+ if(!cmSystemTools::RenameFile(args[2].c_str(), args[3].c_str()))
+ {
+ std::string e = cmSystemTools::GetLastSystemError();
+ std::cerr << "Error renaming from \""
+ << args[2].c_str() << "\" to \"" << args[3].c_str()
+ << "\": " << e << "\n";
+ return 1;
+ }
+ return 0;
+ }
+
+ // Compare files
+ if (args[1] == "compare_files" && args.size() == 4)
+ {
+ if(cmSystemTools::FilesDiffer(args[2].c_str(), args[3].c_str()))
+ {
+ std::cerr << "Files \""
+ << args[2].c_str() << "\" to \"" << args[3].c_str()
+ << "\" are different.\n";
+ return 1;
+ }
+ return 0;
+ }
+
+ // Echo string
+ else if (args[1] == "echo" )
+ {
+ unsigned int cc;
+ const char* space = "";
+ for ( cc = 2; cc < args.size(); cc ++ )
+ {
+ std::cout << space << args[cc];
+ space = " ";
+ }
+ std::cout << std::endl;
+ return 0;
+ }
+
+ // Echo string no new line
+ else if (args[1] == "echo_append" )
+ {
+ unsigned int cc;
+ const char* space = "";
+ for ( cc = 2; cc < args.size(); cc ++ )
+ {
+ std::cout << space << args[cc];
+ space = " ";
+ }
+ return 0;
+ }
+
+#if defined(CMAKE_BUILD_WITH_CMAKE)
+ // Command to create a symbolic link. Fails on platforms not
+ // supporting them.
+ else if (args[1] == "environment" )
+ {
+ std::vector<std::string> env = cmSystemTools::GetEnvironmentVariables();
+ std::vector<std::string>::iterator it;
+ for ( it = env.begin(); it != env.end(); ++ it )
+ {
+ std::cout << it->c_str() << std::endl;
+ }
+ return 0;
+ }
+#endif
+
+ else if (args[1] == "make_directory" && args.size() == 3)
+ {
+ if(!cmSystemTools::MakeDirectory(args[2].c_str()))
+ {
+ std::cerr << "Error making directory \"" << args[2].c_str()
+ << "\".\n";
+ return 1;
+ }
+ return 0;
+ }
+
+ else if (args[1] == "remove_directory" && args.size() == 3)
+ {
+ if(cmSystemTools::FileIsDirectory(args[2].c_str()) &&
+ !cmSystemTools::RemoveADirectory(args[2].c_str()))
+ {
+ std::cerr << "Error removing directory \"" << args[2].c_str()
+ << "\".\n";
+ return 1;
+ }
+ return 0;
+ }
+
+ // Remove file
+ else if (args[1] == "remove" && args.size() > 2)
+ {
+ bool force = false;
+ for (std::string::size_type cc = 2; cc < args.size(); cc ++)
+ {
+ if(args[cc] == "\\-f" || args[cc] == "-f")
+ {
+ force = true;
+ }
+ else
+ {
+ // Complain if the file could not be removed, still exists,
+ // and the -f option was not given.
+ if(!cmSystemTools::RemoveFile(args[cc].c_str()) && !force &&
+ cmSystemTools::FileExists(args[cc].c_str()))
+ {
+ return 1;
+ }
+ }
+ }
+ return 0;
+ }
+ // Touch file
+ else if (args[1] == "touch" && args.size() > 2)
+ {
+ for (std::string::size_type cc = 2; cc < args.size(); cc ++)
+ {
+ // Complain if the file could not be removed, still exists,
+ // and the -f option was not given.
+ if(!cmSystemTools::Touch(args[cc].c_str(), true))
+ {
+ return 1;
+ }
+ }
+ return 0;
+ }
+ // Touch file
+ else if (args[1] == "touch_nocreate" && args.size() > 2)
+ {
+ for (std::string::size_type cc = 2; cc < args.size(); cc ++)
+ {
+ // Complain if the file could not be removed, still exists,
+ // and the -f option was not given.
+ if(!cmSystemTools::Touch(args[cc].c_str(), false))
+ {
+ return 1;
+ }
+ }
+ return 0;
+ }
+
+ // Clock command
+ else if (args[1] == "time" && args.size() > 2)
+ {
+ std::string command = args[2];
+ for (std::string::size_type cc = 3; cc < args.size(); cc ++)
+ {
+ command += " ";
+ command += args[cc];
+ }
+
+ clock_t clock_start, clock_finish;
+ time_t time_start, time_finish;
+
+ time(&time_start);
+ clock_start = clock();
+ int ret =0;
+ cmSystemTools::RunSingleCommand(command.c_str(), 0, &ret);
+
+ clock_finish = clock();
+ time(&time_finish);
+
+ double clocks_per_sec = static_cast<double>(CLOCKS_PER_SEC);
+ std::cout << "Elapsed time: "
+ << static_cast<long>(time_finish - time_start) << " s. (time)"
+ << ", "
+ << static_cast<double>(clock_finish - clock_start) / clocks_per_sec
+ << " s. (clock)"
+ << "\n";
+ return ret;
+ }
+ // Command to calculate the md5sum of a file
+ else if (args[1] == "md5sum" && args.size() >= 3)
+ {
+ char md5out[32];
+ int retval = 0;
+ for (std::string::size_type cc = 2; cc < args.size(); cc ++)
+ {
+ const char *filename = args[cc].c_str();
+ // Cannot compute md5sum of a directory
+ if(cmSystemTools::FileIsDirectory(filename))
+ {
+ std::cerr << "Error: " << filename << " is a directory" << std::endl;
+ retval++;
+ }
+ else if(!cmSystemTools::ComputeFileMD5(filename, md5out))
+ {
+ // To mimic md5sum behavior in a shell:
+ std::cerr << filename << ": No such file or directory" << std::endl;
+ retval++;
+ }
+ else
+ {
+ std::cout << std::string(md5out,32) << " " << filename << std::endl;
+ }
+ }
+ return retval;
+ }
+
+ // Command to change directory and run a program.
+ else if (args[1] == "chdir" && args.size() >= 4)
+ {
+ std::string directory = args[2];
+ if(!cmSystemTools::FileExists(directory.c_str()))
+ {
+ cmSystemTools::Error("Directory does not exist for chdir command: ",
+ args[2].c_str());
+ return 1;
+ }
+
+ std::string command = "\"";
+ command += args[3];
+ command += "\"";
+ for (std::string::size_type cc = 4; cc < args.size(); cc ++)
+ {
+ command += " \"";
+ command += args[cc];
+ command += "\"";
+ }
+ int retval = 0;
+ int timeout = 0;
+ if ( cmSystemTools::RunSingleCommand(command.c_str(), 0, &retval,
+ directory.c_str(), cmSystemTools::OUTPUT_NORMAL, timeout) )
+ {
+ return retval;
+ }
+
+ return 1;
+ }
+
+ // Command to start progress for a build
+ else if (args[1] == "cmake_progress_start" && args.size() == 4)
+ {
+ // basically remove the directory
+ std::string dirName = args[2];
+ dirName += "/Progress";
+ cmSystemTools::RemoveADirectory(dirName.c_str());
+
+ // is the last argument a filename that exists?
+ FILE *countFile = fopen(args[3].c_str(),"r");
+ int count;
+ if (countFile)
+ {
+ if (1!=fscanf(countFile,"%i",&count))
+ {
+ cmSystemTools::Message("Could not read from count file.");
+ }
+ fclose(countFile);
+ }
+ else
+ {
+ count = atoi(args[3].c_str());
+ }
+ if (count)
+ {
+ cmSystemTools::MakeDirectory(dirName.c_str());
+ // write the count into the directory
+ std::string fName = dirName;
+ fName += "/count.txt";
+ FILE *progFile = fopen(fName.c_str(),"w");
+ if (progFile)
+ {
+ fprintf(progFile,"%i\n",count);
+ fclose(progFile);
+ }
+ }
+ return 0;
+ }
+
+ // Command to report progress for a build
+ else if (args[1] == "cmake_progress_report" && args.size() >= 3)
+ {
+ std::string dirName = args[2];
+ dirName += "/Progress";
+ std::string fName;
+ FILE *progFile;
+
+ // read the count
+ fName = dirName;
+ fName += "/count.txt";
+ progFile = fopen(fName.c_str(),"r");
+ int count = 0;
+ if (!progFile)
+ {
+ return 0;
+ }
+ else
+ {
+ if (1!=fscanf(progFile,"%i",&count))
+ {
+ cmSystemTools::Message("Could not read from progress file.");
+ }
+ fclose(progFile);
+ }
+ unsigned int i;
+ for (i = 3; i < args.size(); ++i)
+ {
+ fName = dirName;
+ fName += "/";
+ fName += args[i];
+ progFile = fopen(fName.c_str(),"w");
+ if (progFile)
+ {
+ fprintf(progFile,"empty");
+ fclose(progFile);
+ }
+ }
+ int fileNum = static_cast<int>
+ (cmsys::Directory::GetNumberOfFilesInDirectory(dirName.c_str()));
+ if (count > 0)
+ {
+ // print the progress
+ fprintf(stdout,"[%3i%%] ",((fileNum-3)*100)/count);
+ }
+ return 0;
+ }
+
+ // Command to create a symbolic link. Fails on platforms not
+ // supporting them.
+ else if (args[1] == "create_symlink" && args.size() == 4)
+ {
+ const char* destinationFileName = args[3].c_str();
+ if ( cmSystemTools::FileExists(destinationFileName) )
+ {
+ if ( cmSystemTools::FileIsSymlink(destinationFileName) )
+ {
+ if ( !cmSystemTools::RemoveFile(destinationFileName) ||
+ cmSystemTools::FileExists(destinationFileName) )
+ {
+ return 0;
+ }
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ return cmSystemTools::CreateSymlink(args[2].c_str(),
+ args[3].c_str())? 0:1;
+ }
+
+ // Internal CMake shared library support.
+ else if (args[1] == "cmake_symlink_library" && args.size() == 5)
+ {
+ return cmcmd::SymlinkLibrary(args);
+ }
+ // Internal CMake versioned executable support.
+ else if (args[1] == "cmake_symlink_executable" && args.size() == 4)
+ {
+ return cmcmd::SymlinkExecutable(args);
+ }
+
+#if defined(CMAKE_HAVE_VS_GENERATORS)
+ // Internal CMake support for calling Visual Studio macros.
+ else if (args[1] == "cmake_call_visual_studio_macro" && args.size() >= 4)
+ {
+ // args[2] = full path to .sln file or "ALL"
+ // args[3] = name of Visual Studio macro to call
+ // args[4..args.size()-1] = [optional] args for Visual Studio macro
+
+ std::string macroArgs;
+
+ if (args.size() > 4)
+ {
+ macroArgs = args[4];
+
+ for (size_t i = 5; i < args.size(); ++i)
+ {
+ macroArgs += " ";
+ macroArgs += args[i];
+ }
+ }
+
+ return cmCallVisualStudioMacro::CallMacro(args[2], args[3],
+ macroArgs, true);
+ }
+#endif
+
+ // Internal CMake dependency scanning support.
+ else if (args[1] == "cmake_depends" && args.size() >= 6)
+ {
+ // Use the make system's VERBOSE environment variable to enable
+ // verbose output. This can be skipped by also setting CMAKE_NO_VERBOSE
+ // (which is set by the Eclipse and KDevelop generators).
+ bool verbose = ((cmSystemTools::GetEnv("VERBOSE") != 0)
+ && (cmSystemTools::GetEnv("CMAKE_NO_VERBOSE") == 0));
+
+ // Create a cmake object instance to process dependencies.
+ cmake cm;
+ std::string gen;
+ std::string homeDir;
+ std::string startDir;
+ std::string homeOutDir;
+ std::string startOutDir;
+ std::string depInfo;
+ bool color = false;
+ if(args.size() >= 8)
+ {
+ // Full signature:
+ //
+ // -E cmake_depends <generator>
+ // <home-src-dir> <start-src-dir>
+ // <home-out-dir> <start-out-dir>
+ // <dep-info> [--color=$(COLOR)]
+ //
+ // All paths are provided.
+ gen = args[2];
+ homeDir = args[3];
+ startDir = args[4];
+ homeOutDir = args[5];
+ startOutDir = args[6];
+ depInfo = args[7];
+ if(args.size() >= 9 &&
+ args[8].length() >= 8 &&
+ args[8].substr(0, 8) == "--color=")
+ {
+ // Enable or disable color based on the switch value.
+ color = (args[8].size() == 8 ||
+ cmSystemTools::IsOn(args[8].substr(8).c_str()));
+ }
+ }
+ else
+ {
+ // Support older signature for existing makefiles:
+ //
+ // -E cmake_depends <generator>
+ // <home-out-dir> <start-out-dir>
+ // <dep-info>
+ //
+ // Just pretend the source directories are the same as the
+ // binary directories so at least scanning will work.
+ gen = args[2];
+ homeDir = args[3];
+ startDir = args[4];
+ homeOutDir = args[3];
+ startOutDir = args[3];
+ depInfo = args[5];
+ }
+
+ // Create a local generator configured for the directory in
+ // which dependencies will be scanned.
+ homeDir = cmSystemTools::CollapseFullPath(homeDir.c_str());
+ startDir = cmSystemTools::CollapseFullPath(startDir.c_str());
+ homeOutDir = cmSystemTools::CollapseFullPath(homeOutDir.c_str());
+ startOutDir = cmSystemTools::CollapseFullPath(startOutDir.c_str());
+ cm.SetHomeDirectory(homeDir.c_str());
+ cm.SetStartDirectory(startDir.c_str());
+ cm.SetHomeOutputDirectory(homeOutDir.c_str());
+ cm.SetStartOutputDirectory(startOutDir.c_str());
+ if(cmGlobalGenerator* ggd = cm.CreateGlobalGenerator(gen.c_str()))
+ {
+ cm.SetGlobalGenerator(ggd);
+ cmsys::auto_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator());
+ lgd->GetMakefile()->SetStartDirectory(startDir.c_str());
+ lgd->GetMakefile()->SetStartOutputDirectory(startOutDir.c_str());
+ lgd->GetMakefile()->MakeStartDirectoriesCurrent();
+
+ // Actually scan dependencies.
+ return lgd->UpdateDependencies(depInfo.c_str(),
+ verbose, color)? 0 : 2;
+ }
+ return 1;
+ }
+
+ // Internal CMake link script support.
+ else if (args[1] == "cmake_link_script" && args.size() >= 3)
+ {
+ return cmcmd::ExecuteLinkScript(args);
+ }
+
+ // Internal CMake unimplemented feature notification.
+ else if (args[1] == "cmake_unimplemented_variable")
+ {
+ std::cerr << "Feature not implemented for this platform.";
+ if(args.size() == 3)
+ {
+ std::cerr << " Variable " << args[2] << " is not set.";
+ }
+ std::cerr << std::endl;
+ return 1;
+ }
+ else if (args[1] == "vs_link_exe")
+ {
+ return cmcmd::VisualStudioLink(args, 1);
+ }
+ else if (args[1] == "vs_link_dll")
+ {
+ return cmcmd::VisualStudioLink(args, 2);
+ }
+#ifdef CMAKE_BUILD_WITH_CMAKE
+ // Internal CMake color makefile support.
+ else if (args[1] == "cmake_echo_color")
+ {
+ return cmcmd::ExecuteEchoColor(args);
+ }
+ else if (args[1] == "cmake_automoc")
+ {
+ cmQtAutomoc automoc;
+ const char *config = args[3].empty() ? 0 : args[3].c_str();
+ bool automocSuccess = automoc.Run(args[2].c_str(), config);
+ return automocSuccess ? 0 : 1;
+ }
+#endif
+
+ // Tar files
+ else if (args[1] == "tar" && args.size() > 3)
+ {
+ std::string flags = args[2];
+ std::string outFile = args[3];
+ std::vector<cmStdString> files;
+ for (std::string::size_type cc = 4; cc < args.size(); cc ++)
+ {
+ files.push_back(args[cc]);
+ }
+ bool gzip = false;
+ bool bzip2 = false;
+ bool verbose = false;
+ if ( flags.find_first_of('j') != flags.npos )
+ {
+ bzip2 = true;
+ }
+ if ( flags.find_first_of('z') != flags.npos )
+ {
+ gzip = true;
+ }
+ if ( flags.find_first_of('v') != flags.npos )
+ {
+ verbose = true;
+ }
+
+ if ( flags.find_first_of('t') != flags.npos )
+ {
+ if ( !cmSystemTools::ListTar(outFile.c_str(), gzip, verbose) )
+ {
+ cmSystemTools::Error("Problem creating tar: ", outFile.c_str());
+ return 1;
+ }
+ }
+ else if ( flags.find_first_of('c') != flags.npos )
+ {
+ if ( !cmSystemTools::CreateTar(
+ outFile.c_str(), files, gzip, bzip2, verbose) )
+ {
+ cmSystemTools::Error("Problem creating tar: ", outFile.c_str());
+ return 1;
+ }
+ }
+ else if ( flags.find_first_of('x') != flags.npos )
+ {
+ if ( !cmSystemTools::ExtractTar(
+ outFile.c_str(), gzip, verbose) )
+ {
+ cmSystemTools::Error("Problem extracting tar: ", outFile.c_str());
+ return 1;
+ }
+#ifdef WIN32
+ // OK, on windows 7 after we untar some files,
+ // sometimes we can not rename the directory after
+ // the untar is done. This breaks the external project
+ // untar and rename code. So, by default we will wait
+ // 1/10th of a second after the untar. If CMAKE_UNTAR_DELAY
+ // is set in the env, its value will be used instead of 100.
+ int delay = 100;
+ const char* delayVar = cmSystemTools::GetEnv("CMAKE_UNTAR_DELAY");
+ if(delayVar)
+ {
+ delay = atoi(delayVar);
+ }
+ if(delay)
+ {
+ cmSystemTools::Delay(delay);
+ }
+#endif
+ }
+ return 0;
+ }
+
+#if defined(CMAKE_BUILD_WITH_CMAKE)
+ // Internal CMake Fortran module support.
+ else if (args[1] == "cmake_copy_f90_mod" && args.size() >= 4)
+ {
+ return cmDependsFortran::CopyModule(args)? 0 : 1;
+ }
+#endif
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ // Write registry value
+ else if (args[1] == "write_regv" && args.size() > 3)
+ {
+ return cmSystemTools::WriteRegistryValue(args[2].c_str(),
+ args[3].c_str()) ? 0 : 1;
+ }
+
+ // Delete registry value
+ else if (args[1] == "delete_regv" && args.size() > 2)
+ {
+ return cmSystemTools::DeleteRegistryValue(args[2].c_str()) ? 0 : 1;
+ }
+ // Remove file
+ else if (args[1] == "comspec" && args.size() > 2)
+ {
+ unsigned int cc;
+ std::string command = args[2];
+ for ( cc = 3; cc < args.size(); cc ++ )
+ {
+ command += " " + args[cc];
+ }
+ return cmWin32ProcessExecution::Windows9xHack(command.c_str());
+ }
+ else if (args[1] == "env_vs8_wince" && args.size() == 3)
+ {
+ return cmcmd::WindowsCEEnvironment("8.0", args[2]);
+ }
+ else if (args[1] == "env_vs9_wince" && args.size() == 3)
+ {
+ return cmcmd::WindowsCEEnvironment("9.0", args[2]);
+ }
+#endif
+ }
+
+ ::CMakeCommandUsage(args[0].c_str());
+ return 1;
+}
+
+//----------------------------------------------------------------------------
+int cmcmd::SymlinkLibrary(std::vector<std::string>& args)
+{
+ int result = 0;
+ std::string realName = args[2];
+ std::string soName = args[3];
+ std::string name = args[4];
+ if(soName != realName)
+ {
+ if(!cmcmd::SymlinkInternal(realName, soName))
+ {
+ cmSystemTools::ReportLastSystemError("cmake_symlink_library");
+ result = 1;
+ }
+ }
+ if(name != soName)
+ {
+ if(!cmcmd::SymlinkInternal(soName, name))
+ {
+ cmSystemTools::ReportLastSystemError("cmake_symlink_library");
+ result = 1;
+ }
+ }
+ return result;
+}
+
+//----------------------------------------------------------------------------
+int cmcmd::SymlinkExecutable(std::vector<std::string>& args)
+{
+ int result = 0;
+ std::string realName = args[2];
+ std::string name = args[3];
+ if(name != realName)
+ {
+ if(!cmcmd::SymlinkInternal(realName, name))
+ {
+ cmSystemTools::ReportLastSystemError("cmake_symlink_executable");
+ result = 1;
+ }
+ }
+ return result;
+}
+
+//----------------------------------------------------------------------------
+bool cmcmd::SymlinkInternal(std::string const& file, std::string const& link)
+{
+ if(cmSystemTools::FileExists(link.c_str()) ||
+ cmSystemTools::FileIsSymlink(link.c_str()))
+ {
+ cmSystemTools::RemoveFile(link.c_str());
+ }
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ return cmSystemTools::CopyFileAlways(file.c_str(), link.c_str());
+#else
+ std::string linktext = cmSystemTools::GetFilenameName(file);
+ return cmSystemTools::CreateSymlink(linktext.c_str(), link.c_str());
+#endif
+}
+
+//----------------------------------------------------------------------------
+#ifdef CMAKE_BUILD_WITH_CMAKE
+int cmcmd::ExecuteEchoColor(std::vector<std::string>& args)
+{
+ // The arguments are
+ // argv[0] == <cmake-executable>
+ // argv[1] == cmake_echo_color
+
+ bool enabled = true;
+ int color = cmsysTerminal_Color_Normal;
+ bool newline = true;
+ for(unsigned int i=2; i < args.size(); ++i)
+ {
+ if(args[i].find("--switch=") == 0)
+ {
+ // Enable or disable color based on the switch value.
+ std::string value = args[i].substr(9);
+ if(!value.empty())
+ {
+ if(cmSystemTools::IsOn(value.c_str()))
+ {
+ enabled = true;
+ }
+ else
+ {
+ enabled = false;
+ }
+ }
+ }
+ else if(args[i] == "--normal")
+ {
+ color = cmsysTerminal_Color_Normal;
+ }
+ else if(args[i] == "--black")
+ {
+ color = cmsysTerminal_Color_ForegroundBlack;
+ }
+ else if(args[i] == "--red")
+ {
+ color = cmsysTerminal_Color_ForegroundRed;
+ }
+ else if(args[i] == "--green")
+ {
+ color = cmsysTerminal_Color_ForegroundGreen;
+ }
+ else if(args[i] == "--yellow")
+ {
+ color = cmsysTerminal_Color_ForegroundYellow;
+ }
+ else if(args[i] == "--blue")
+ {
+ color = cmsysTerminal_Color_ForegroundBlue;
+ }
+ else if(args[i] == "--magenta")
+ {
+ color = cmsysTerminal_Color_ForegroundMagenta;
+ }
+ else if(args[i] == "--cyan")
+ {
+ color = cmsysTerminal_Color_ForegroundCyan;
+ }
+ else if(args[i] == "--white")
+ {
+ color = cmsysTerminal_Color_ForegroundWhite;
+ }
+ else if(args[i] == "--bold")
+ {
+ color |= cmsysTerminal_Color_ForegroundBold;
+ }
+ else if(args[i] == "--no-newline")
+ {
+ newline = false;
+ }
+ else if(args[i] == "--newline")
+ {
+ newline = true;
+ }
+ else
+ {
+ // Color is enabled. Print with the current color.
+ cmSystemTools::MakefileColorEcho(color, args[i].c_str(),
+ newline, enabled);
+ }
+ }
+
+ return 0;
+}
+#else
+int cmcmd::ExecuteEchoColor(std::vector<std::string>&)
+{
+ return 1;
+}
+#endif
+
+//----------------------------------------------------------------------------
+int cmcmd::ExecuteLinkScript(std::vector<std::string>& args)
+{
+ // The arguments are
+ // argv[0] == <cmake-executable>
+ // argv[1] == cmake_link_script
+ // argv[2] == <link-script-name>
+ // argv[3] == --verbose=?
+ bool verbose = false;
+ if(args.size() >= 4)
+ {
+ if(args[3].find("--verbose=") == 0)
+ {
+ if(!cmSystemTools::IsOff(args[3].substr(10).c_str()))
+ {
+ verbose = true;
+ }
+ }
+ }
+
+ // Allocate a process instance.
+ cmsysProcess* cp = cmsysProcess_New();
+ if(!cp)
+ {
+ std::cerr << "Error allocating process instance in link script."
+ << std::endl;
+ return 1;
+ }
+
+ // Children should share stdout and stderr with this process.
+ cmsysProcess_SetPipeShared(cp, cmsysProcess_Pipe_STDOUT, 1);
+ cmsysProcess_SetPipeShared(cp, cmsysProcess_Pipe_STDERR, 1);
+
+ // Run the command lines verbatim.
+ cmsysProcess_SetOption(cp, cmsysProcess_Option_Verbatim, 1);
+
+ // Read command lines from the script.
+ std::ifstream fin(args[2].c_str());
+ if(!fin)
+ {
+ std::cerr << "Error opening link script \""
+ << args[2] << "\"" << std::endl;
+ return 1;
+ }
+
+ // Run one command at a time.
+ std::string command;
+ int result = 0;
+ while(result == 0 && cmSystemTools::GetLineFromStream(fin, command))
+ {
+ // Skip empty command lines.
+ if(command.find_first_not_of(" \t") == command.npos)
+ {
+ continue;
+ }
+
+ // Setup this command line.
+ const char* cmd[2] = {command.c_str(), 0};
+ cmsysProcess_SetCommand(cp, cmd);
+
+ // Report the command if verbose output is enabled.
+ if(verbose)
+ {
+ std::cout << command << std::endl;
+ }
+
+ // Run the command and wait for it to exit.
+ cmsysProcess_Execute(cp);
+ cmsysProcess_WaitForExit(cp, 0);
+
+ // Report failure if any.
+ switch(cmsysProcess_GetState(cp))
+ {
+ case cmsysProcess_State_Exited:
+ {
+ int value = cmsysProcess_GetExitValue(cp);
+ if(value != 0)
+ {
+ result = value;
+ }
+ }
+ break;
+ case cmsysProcess_State_Exception:
+ std::cerr << "Error running link command: "
+ << cmsysProcess_GetExceptionString(cp) << std::endl;
+ result = 1;
+ break;
+ case cmsysProcess_State_Error:
+ std::cerr << "Error running link command: "
+ << cmsysProcess_GetErrorString(cp) << std::endl;
+ result = 2;
+ break;
+ default:
+ break;
+ };
+ }
+
+ // Free the process instance.
+ cmsysProcess_Delete(cp);
+
+ // Return the final resulting return value.
+ return result;
+}
+
+//----------------------------------------------------------------------------
+int cmcmd::WindowsCEEnvironment(const char* version, const std::string& name)
+{
+#if defined(CMAKE_HAVE_VS_GENERATORS)
+ cmVisualStudioWCEPlatformParser parser(name.c_str());
+ parser.ParseVersion(version);
+ if (parser.Found())
+ {
+ std::cout << "@echo off" << std::endl;
+ std::cout << "echo Environment Selection: " << name << std::endl;
+ std::cout << "set PATH=" << parser.GetPathDirectories() << std::endl;
+ std::cout << "set INCLUDE=" << parser.GetIncludeDirectories() <<std::endl;
+ std::cout << "set LIB=" << parser.GetLibraryDirectories() <<std::endl;
+ return 0;
+ }
+#else
+ (void)version;
+#endif
+
+ std::cerr << "Could not find " << name;
+ return -1;
+}
+
+// For visual studio 2005 and newer manifest files need to be embedded into
+// exe and dll's. This code does that in such a way that incremental linking
+// still works.
+int cmcmd::VisualStudioLink(std::vector<std::string>& args, int type)
+{
+ if(args.size() < 2)
+ {
+ return -1;
+ }
+ bool verbose = false;
+ if(cmSystemTools::GetEnv("VERBOSE"))
+ {
+ verbose = true;
+ }
+ std::vector<std::string> expandedArgs;
+ for(std::vector<std::string>::iterator i = args.begin();
+ i != args.end(); ++i)
+ {
+ // check for nmake temporary files
+ if((*i)[0] == '@' && i->find("@CMakeFiles") != 0 )
+ {
+ std::ifstream fin(i->substr(1).c_str());
+ std::string line;
+ while(cmSystemTools::GetLineFromStream(fin,
+ line))
+ {
+ cmSystemTools::ParseWindowsCommandLine(line.c_str(), expandedArgs);
+ }
+ }
+ else
+ {
+ expandedArgs.push_back(*i);
+ }
+ }
+ bool hasIncremental = false;
+ bool hasManifest = true;
+ for(std::vector<std::string>::iterator i = expandedArgs.begin();
+ i != expandedArgs.end(); ++i)
+ {
+ if(cmSystemTools::Strucmp(i->c_str(), "/INCREMENTAL:YES") == 0)
+ {
+ hasIncremental = true;
+ }
+ if(cmSystemTools::Strucmp(i->c_str(), "/INCREMENTAL") == 0)
+ {
+ hasIncremental = true;
+ }
+ if(cmSystemTools::Strucmp(i->c_str(), "/MANIFEST:NO") == 0)
+ {
+ hasManifest = false;
+ }
+ }
+ if(hasIncremental && hasManifest)
+ {
+ if(verbose)
+ {
+ std::cout << "Visual Studio Incremental Link with embedded manifests\n";
+ }
+ return cmcmd::VisualStudioLinkIncremental(expandedArgs, type, verbose);
+ }
+ if(verbose)
+ {
+ if(!hasIncremental)
+ {
+ std::cout << "Visual Studio Non-Incremental Link\n";
+ }
+ else
+ {
+ std::cout << "Visual Studio Incremental Link without manifests\n";
+ }
+ }
+ return cmcmd::VisualStudioLinkNonIncremental(expandedArgs,
+ type, hasManifest, verbose);
+}
+
+int cmcmd::ParseVisualStudioLinkCommand(std::vector<std::string>& args,
+ std::vector<cmStdString>& command,
+ std::string& targetName)
+{
+ std::vector<std::string>::iterator i = args.begin();
+ i++; // skip -E
+ i++; // skip vs_link_dll or vs_link_exe
+ command.push_back(*i);
+ i++; // move past link command
+ for(; i != args.end(); ++i)
+ {
+ command.push_back(*i);
+ if(i->find("/Fe") == 0)
+ {
+ targetName = i->substr(3);
+ }
+ if(i->find("/out:") == 0)
+ {
+ targetName = i->substr(5);
+ }
+ }
+ if(targetName.size() == 0 || command.size() == 0)
+ {
+ return -1;
+ }
+ return 0;
+}
+
+bool cmcmd::RunCommand(const char* comment,
+ std::vector<cmStdString>& command,
+ bool verbose,
+ int* retCodeOut)
+{
+ if(verbose)
+ {
+ std::cout << comment << ":\n";
+ for(std::vector<cmStdString>::iterator i = command.begin();
+ i != command.end(); ++i)
+ {
+ std::cout << i->c_str() << " ";
+ }
+ std::cout << "\n";
+ }
+ std::string output;
+ int retCode =0;
+ // use rc command to create .res file
+ cmSystemTools::RunSingleCommand(command,
+ &output,
+ &retCode, 0, cmSystemTools::OUTPUT_NONE);
+ // always print the output of the command, unless
+ // it is the dumb rc command banner, but if the command
+ // returned an error code then print the output anyway as
+ // the banner may be mixed with some other important information.
+ if(output.find("Resource Compiler Version") == output.npos
+ || retCode !=0)
+ {
+ std::cout << output;
+ }
+ // if retCodeOut is requested then always return true
+ // and set the retCodeOut to retCode
+ if(retCodeOut)
+ {
+ *retCodeOut = retCode;
+ return true;
+ }
+ if(retCode != 0)
+ {
+ std::cout << comment << " failed. with " << retCode << "\n";
+ }
+ return retCode == 0;
+}
+
+int cmcmd::VisualStudioLinkIncremental(std::vector<std::string>& args,
+ int type, bool verbose)
+{
+ // This follows the steps listed here:
+ // http://blogs.msdn.com/zakramer/archive/2006/05/22/603558.aspx
+
+ // 1. Compiler compiles the application and generates the *.obj files.
+ // 2. An empty manifest file is generated if this is a clean build and if
+ // not the previous one is reused.
+ // 3. The resource compiler (rc.exe) compiles the *.manifest file to a
+ // *.res file.
+ // 4. Linker generates the binary (EXE or DLL) with the /incremental
+ // switch and embeds the dummy manifest file. The linker also generates
+ // the real manifest file based on the binaries that your binary depends
+ // on.
+ // 5. The manifest tool (mt.exe) is then used to generate the final
+ // manifest.
+
+ // If the final manifest is changed, then 6 and 7 are run, if not
+ // they are skipped, and it is done.
+
+ // 6. The resource compiler is invoked one more time.
+ // 7. Finally, the Linker does another incremental link, but since the
+ // only thing that has changed is the *.res file that contains the
+ // manifest it is a short link.
+ std::vector<cmStdString> linkCommand;
+ std::string targetName;
+ if(cmcmd::ParseVisualStudioLinkCommand(args, linkCommand, targetName) == -1)
+ {
+ return -1;
+ }
+ std::string manifestArg = "/MANIFESTFILE:";
+ std::vector<cmStdString> rcCommand;
+ rcCommand.push_back(cmSystemTools::FindProgram("rc.exe"));
+ std::vector<cmStdString> mtCommand;
+ mtCommand.push_back(cmSystemTools::FindProgram("mt.exe"));
+ std::string tempManifest;
+ tempManifest = targetName;
+ tempManifest += ".intermediate.manifest";
+ std::string resourceInputFile = targetName;
+ resourceInputFile += ".resource.txt";
+ if(verbose)
+ {
+ std::cout << "Create " << resourceInputFile.c_str() << "\n";
+ }
+ // Create input file for rc command
+ std::ofstream fout(resourceInputFile.c_str());
+ if(!fout)
+ {
+ return -1;
+ }
+ std::string manifestFile = targetName;
+ manifestFile += ".embed.manifest";
+ std::string fullPath= cmSystemTools::CollapseFullPath(manifestFile.c_str());
+ fout << type << " /* CREATEPROCESS_MANIFEST_RESOURCE_ID "
+ "*/ 24 /* RT_MANIFEST */ " << "\"" << fullPath.c_str() << "\"";
+ fout.close();
+ manifestArg += tempManifest;
+ // add the manifest arg to the linkCommand
+ linkCommand.push_back("/MANIFEST");
+ linkCommand.push_back(manifestArg);
+ // if manifestFile is not yet created, create an
+ // empty one
+ if(!cmSystemTools::FileExists(manifestFile.c_str()))
+ {
+ if(verbose)
+ {
+ std::cout << "Create empty: " << manifestFile.c_str() << "\n";
+ }
+ std::ofstream foutTmp(manifestFile.c_str());
+ }
+ std::string resourceFile = manifestFile;
+ resourceFile += ".res";
+ // add the resource file to the end of the link command
+ linkCommand.push_back(resourceFile);
+ std::string outputOpt = "/fo";
+ outputOpt += resourceFile;
+ rcCommand.push_back(outputOpt);
+ rcCommand.push_back(resourceInputFile);
+ // Run rc command to create resource
+ if(!cmcmd::RunCommand("RC Pass 1", rcCommand, verbose))
+ {
+ return -1;
+ }
+ // Now run the link command to link and create manifest
+ if(!cmcmd::RunCommand("LINK Pass 1", linkCommand, verbose))
+ {
+ return -1;
+ }
+ // create mt command
+ std::string outArg("/out:");
+ outArg+= manifestFile;
+ mtCommand.push_back("/nologo");
+ mtCommand.push_back(outArg);
+ mtCommand.push_back("/notify_update");
+ mtCommand.push_back("/manifest");
+ mtCommand.push_back(tempManifest);
+ // now run mt.exe to create the final manifest file
+ int mtRet =0;
+ cmcmd::RunCommand("MT", mtCommand, verbose, &mtRet);
+ // if mt returns 0, then the manifest was not changed and
+ // we do not need to do another link step
+ if(mtRet == 0)
+ {
+ return 0;
+ }
+ // check for magic mt return value if mt returns the magic number
+ // 1090650113 then it means that it updated the manifest file and we need
+ // to do the final link. If mt has any value other than 0 or 1090650113
+ // then there was some problem with the command itself and there was an
+ // error so return the error code back out of cmake so make can report it.
+ if(mtRet != 1090650113)
+ {
+ return mtRet;
+ }
+ // update the resource file with the new manifest from the mt command.
+ if(!cmcmd::RunCommand("RC Pass 2", rcCommand, verbose))
+ {
+ return -1;
+ }
+ // Run the final incremental link that will put the new manifest resource
+ // into the file incrementally.
+ if(!cmcmd::RunCommand("FINAL LINK", linkCommand, verbose))
+ {
+ return -1;
+ }
+ return 0;
+}
+
+int cmcmd::VisualStudioLinkNonIncremental(std::vector<std::string>& args,
+ int type,
+ bool hasManifest,
+ bool verbose)
+{
+ std::vector<cmStdString> linkCommand;
+ std::string targetName;
+ if(cmcmd::ParseVisualStudioLinkCommand(args, linkCommand, targetName) == -1)
+ {
+ return -1;
+ }
+ // Run the link command as given
+ if (hasManifest)
+ {
+ linkCommand.push_back("/MANIFEST");
+ }
+ if(!cmcmd::RunCommand("LINK", linkCommand, verbose))
+ {
+ return -1;
+ }
+ if(!hasManifest)
+ {
+ return 0;
+ }
+ std::vector<cmStdString> mtCommand;
+ mtCommand.push_back(cmSystemTools::FindProgram("mt.exe"));
+ mtCommand.push_back("/nologo");
+ mtCommand.push_back("/manifest");
+ std::string manifestFile = targetName;
+ manifestFile += ".manifest";
+ mtCommand.push_back(manifestFile);
+ std::string outresource = "/outputresource:";
+ outresource += targetName;
+ outresource += ";#";
+ if(type == 1)
+ {
+ outresource += "1";
+ }
+ else if(type == 2)
+ {
+ outresource += "2";
+ }
+ mtCommand.push_back(outresource);
+ // Now use the mt tool to embed the manifest into the exe or dll
+ if(!cmcmd::RunCommand("MT", mtCommand, verbose))
+ {
+ return -1;
+ }
+ return 0;
+}
diff --git a/Source/cmcmd.h b/Source/cmcmd.h
new file mode 100644
index 0000000..4517ebf
--- /dev/null
+++ b/Source/cmcmd.h
@@ -0,0 +1,54 @@
+/*============================================================================
+ 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.
+============================================================================*/
+
+#ifndef cmcmd_h
+#define cmcmd_h
+
+#include "cmStandardIncludes.h"
+
+class cmcmd
+{
+public:
+
+ /**
+ * Execute commands during the build process. Supports options such
+ * as echo, remove file etc.
+ */
+ static int ExecuteCMakeCommand(std::vector<std::string>&);
+protected:
+
+ static int SymlinkLibrary(std::vector<std::string>& args);
+ static int SymlinkExecutable(std::vector<std::string>& args);
+ static bool SymlinkInternal(std::string const& file,
+ std::string const& link);
+ static int ExecuteEchoColor(std::vector<std::string>& args);
+ static int ExecuteLinkScript(std::vector<std::string>& args);
+ static int WindowsCEEnvironment(const char* version,
+ const std::string& name);
+ static int VisualStudioLink(std::vector<std::string>& args, int type);
+ static int VisualStudioLinkIncremental(std::vector<std::string>& args,
+ int type,
+ bool verbose);
+ static int VisualStudioLinkNonIncremental(std::vector<std::string>& args,
+ int type,
+ bool hasManifest,
+ bool verbose);
+ static int ParseVisualStudioLinkCommand(std::vector<std::string>& args,
+ std::vector<cmStdString>& command,
+ std::string& targetName);
+ static bool RunCommand(const char* comment,
+ std::vector<cmStdString>& command,
+ bool verbose,
+ int* retCodeOut = 0);
+};
+
+#endif
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index e767a16..ece68f5 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -150,6 +150,13 @@ static const char * cmDocumentationOptions[][3] =
{"-U, --union", "Take the Union of -I and -R",
"When both -R and -I are specified by default the intersection of "
"tests are run. By specifying -U the union of tests is run instead."},
+ {"--rerun-failed", "Run only the tests that failed previously",
+ "This option tells ctest to perform only the tests that failed during its "
+ "previous run. When this option is specified, ctest ignores all other "
+ "options intended to modify the list of tests to run "
+ "(-L, -R, -E, -LE, -I, etc). In the event that CTest runs and no tests "
+ "fail, subsequent calls to ctest with the --rerun-failed option will "
+ "run the set of tests that most recently failed (if any)."},
{"--max-width <width>", "Set the max width for a test name to output",
"Set the maximum width for each test name to show in the output. This "
"allows the user to widen the output to avoid clipping the test name which "
diff --git a/Tests/AliasTarget/CMakeLists.txt b/Tests/AliasTarget/CMakeLists.txt
index a5eb0f6..fdb1638 100644
--- a/Tests/AliasTarget/CMakeLists.txt
+++ b/Tests/AliasTarget/CMakeLists.txt
@@ -45,3 +45,6 @@ get_property(_alt2 TARGET PREFIX::Foo PROPERTY ALIASED_TARGET)
if (NOT ${_alt2} STREQUAL foo)
message(SEND_ERROR "ALIASED_TARGET is not foo.")
endif()
+
+add_library(iface INTERFACE)
+add_library(Alias::Iface ALIAS iface)
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 9c3ed59..9afc112 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -246,6 +246,7 @@ if(BUILD_TESTING)
ADD_TEST_MACRO(CompileOptions CompileOptions)
ADD_TEST_MACRO(CompatibleInterface CompatibleInterface)
ADD_TEST_MACRO(AliasTarget AliasTarget)
+ ADD_TEST_MACRO(InterfaceLibrary InterfaceLibrary)
set_tests_properties(EmptyLibrary PROPERTIES
PASS_REGULAR_EXPRESSION "CMake Error: CMake can not determine linker language for target: test")
ADD_TEST_MACRO(CrossCompile CrossCompile)
@@ -263,7 +264,7 @@ if(BUILD_TESTING)
list(APPEND TEST_BUILD_DIRS ${CMake_TEST_INSTALL_PREFIX})
if(NOT QT4_FOUND)
- find_package(Qt4)
+ find_package(Qt4 QUIET)
endif()
if(QT4_FOUND)
@@ -604,6 +605,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
${build_generator_args}
--build-project GeneratorExpression
--build-options -DCMAKE_BUILD_TYPE=\${CTEST_CONFIGURATION_TYPE}
+ --test-command ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} -V
)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/GeneratorExpression")
@@ -1959,6 +1961,25 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
PASS_REGULAR_EXPRESSION
"Process file.*XINDEX.m.*Total LOC:.*125.*Percentage Coverage: 85.60.*"
ENVIRONMENT COVFILE=)
+
+ # Adding a test case for Python Coverage
+ configure_file(
+ "${CMake_SOURCE_DIR}/Tests/PythonCoverage/coverage.xml.in"
+ "${CMake_BINARY_DIR}/Testing/PythonCoverage/coverage.xml")
+ configure_file(
+ "${CMake_SOURCE_DIR}/Tests/PythonCoverage/DartConfiguration.tcl.in"
+ "${CMake_BINARY_DIR}/Testing/PythonCoverage/DartConfiguration.tcl")
+ file(COPY "${CMake_SOURCE_DIR}/Tests/PythonCoverage/coveragetest"
+ DESTINATION "${CMake_BINARY_DIR}/Testing/PythonCoverage")
+ add_test(NAME CTestPythonCoverage
+ COMMAND cmake -E chdir
+ ${CMake_BINARY_DIR}/Testing/PythonCoverage
+ $<TARGET_FILE:ctest> -T Coverage --debug)
+ set_tests_properties(CTestPythonCoverage PROPERTIES
+ PASS_REGULAR_EXPRESSION
+ "Process file.*foo.py.*Total LOC:.*13.*Percentage Coverage: 84.62.*"
+ ENVIRONMENT COVFILE=)
+
# Use macro, not function so that build can still be driven by CMake 2.4.
# After 2.6 is required, this could be a function without the extra 'set'
# calls.
@@ -2139,6 +2160,16 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
set_tests_properties(CTestTestTimeout PROPERTIES
PASS_REGULAR_EXPRESSION "TestTimeout *\\.+ *\\*\\*\\*Timeout.*CheckChild *\\.+ *Passed")
+ # this test only runs correctly if WORKING_DIRECTORY is honored.
+ if (NOT CMAKE_VERSION VERSION_LESS "2.8.4")
+ add_test(
+ NAME CTestTestRerunFailed
+ COMMAND ${CMAKE_CTEST_COMMAND} --rerun-failed)
+ set_tests_properties(CTestTestRerunFailed PROPERTIES
+ PASS_REGULAR_EXPRESSION "1/1 Test #1: TestTimeout" DEPENDS CTestTestTimeout
+ WORKING_DIRECTORY ${CMake_BINARY_DIR}/Tests/CTestTestTimeout)
+ endif ()
+
configure_file(
"${CMake_SOURCE_DIR}/Tests/CTestTestZeroTimeout/test.cmake.in"
"${CMake_BINARY_DIR}/Tests/CTestTestZeroTimeout/test.cmake"
diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt
index 739593c..691728a 100644
--- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt
+++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt
@@ -22,11 +22,18 @@ endmacro()
set(DESIRED_QT_VERSION 4)
set(NO_QT4_MODULES "Qt3" "KDE3")
+# ignore everything that has it's own test in Tests/Module/
+file(GLOB OWN_TEST_MODULES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/../../Module/" "${CMAKE_CURRENT_SOURCE_DIR}/../../Module/Find*")
+foreach(FIND_MODULE IN LISTS OWN_TEST_MODULES)
+ string(REGEX REPLACE "^Find" "" _MOD_NAME "${FIND_MODULE}")
+ list(APPEND NO_FIND_MODULES "${_MOD_NAME}")
+endforeach()
+
# These modules are named Find*.cmake, but are nothing that works in
# find_package().
-set(NO_FIND_MODULES "PackageHandleStandardArgs" "PackageMessage")
+list(APPEND NO_FIND_MODULES "PackageHandleStandardArgs" "PackageMessage")
-foreach(FIND_MODULE ${FIND_MODULES})
+foreach(FIND_MODULE IN LISTS FIND_MODULES)
string(REGEX REPLACE ".*/Find(.*)\\.cmake$" "\\1" MODULE_NAME "${FIND_MODULE}")
list(FIND NO_QT4_MODULES ${MODULE_NAME} NO_QT4_INDEX)
diff --git a/Tests/CMakeOnly/CMakeLists.txt b/Tests/CMakeOnly/CMakeLists.txt
index be7ddbc..7586de6 100644
--- a/Tests/CMakeOnly/CMakeLists.txt
+++ b/Tests/CMakeOnly/CMakeLists.txt
@@ -19,6 +19,8 @@ add_CMakeOnly_test(CheckCXXCompilerFlag)
add_CMakeOnly_test(CheckLanguage)
+add_CMakeOnly_test(CheckStructHasMember)
+
add_CMakeOnly_test(CompilerIdC)
add_CMakeOnly_test(CompilerIdCXX)
if(CMAKE_Fortran_COMPILER)
diff --git a/Tests/CMakeOnly/CheckStructHasMember/CMakeLists.txt b/Tests/CMakeOnly/CheckStructHasMember/CMakeLists.txt
new file mode 100644
index 0000000..f06d5c3
--- /dev/null
+++ b/Tests/CMakeOnly/CheckStructHasMember/CMakeLists.txt
@@ -0,0 +1,93 @@
+cmake_minimum_required(VERSION 2.8)
+
+project(CheckStructHasMember)
+
+set(CMAKE_REQUIRED_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}")
+
+include(CheckStructHasMember)
+
+foreach(_config_type Release RelWithDebInfo MinSizeRel Debug)
+ set(CMAKE_TRY_COMPILE_CONFIGURATION ${_config_type})
+ unset(CSHM_RESULT_S1_${_config_type} CACHE)
+ unset(CSHM_RESULT_S2_${_config_type} CACHE)
+ unset(CSHM_RESULT_S3_${_config_type} CACHE)
+ message(STATUS "Testing configuration ${_config_type}")
+
+ check_struct_has_member("struct non_existent_struct" "foo" "cm_cshm.h" CSHM_RESULT_S1_${_config_type})
+ check_struct_has_member("struct struct_with_member" "non_existent_member" "cm_cshm.h" CSHM_RESULT_S2_${_config_type})
+ check_struct_has_member("struct struct_with_member" "member" "cm_cshm.h" CSHM_RESULT_S3_${_config_type})
+
+ if(CSHM_RESULT_S1_${_config_type} OR CSHM_RESULT_S2_${_config_type})
+ message(SEND_ERROR "CheckStructHasMember reported a nonexistent member as existing in configuration ${_config_type}")
+ endif()
+
+ if(NOT CSHM_RESULT_S3_${_config_type})
+ message(SEND_ERROR "CheckStructHasMember did not report an existent member as existing in configuration ${_config_type}")
+ endif()
+endforeach()
+
+foreach(_config_type Release RelWithDebInfo MinSizeRel Debug)
+ set(CMAKE_TRY_COMPILE_CONFIGURATION ${_config_type})
+ unset(CSHM_RESULT_S1_${_config_type}_C CACHE)
+ unset(CSHM_RESULT_S2_${_config_type}_C CACHE)
+ unset(CSHM_RESULT_S3_${_config_type}_C CACHE)
+ message(STATUS "Testing configuration ${_config_type}")
+
+ check_struct_has_member("struct non_existent_struct" "foo" "cm_cshm.h" CSHM_RESULT_S1_${_config_type}_C LANGUAGE C)
+ check_struct_has_member("struct struct_with_member" "non_existent_member" "cm_cshm.h" CSHM_RESULT_S2_${_config_type}_C LANGUAGE C)
+ check_struct_has_member("struct struct_with_member" "member" "cm_cshm.h" CSHM_RESULT_S3_${_config_type}_C LANGUAGE C)
+
+ if(CSHM_RESULT_S1_${_config_type}_C OR CSHM_RESULT_S2_${_config_type}_C)
+ message(SEND_ERROR "CheckStructHasMember reported a nonexistent member as existing in configuration ${_config_type}")
+ endif()
+
+ if(NOT CSHM_RESULT_S3_${_config_type}_C)
+ message(SEND_ERROR "CheckStructHasMember did not report an existent member as existing in configuration ${_config_type}")
+ endif()
+endforeach()
+
+foreach(_config_type Release RelWithDebInfo MinSizeRel Debug)
+ set(CMAKE_TRY_COMPILE_CONFIGURATION ${_config_type})
+ unset(CSHM_RESULT_S1_${_config_type}_CXX CACHE)
+ unset(CSHM_RESULT_S2_${_config_type}_CXX CACHE)
+ unset(CSHM_RESULT_S3_${_config_type}_CXX CACHE)
+ unset(CSHM_RESULT_C1_${_config_type}_CXX CACHE)
+ unset(CSHM_RESULT_C2_${_config_type}_CXX CACHE)
+ unset(CSHM_RESULT_C3_${_config_type}_CXX CACHE)
+
+ message(STATUS "Testing configuration ${_config_type}")
+
+ check_struct_has_member("non_existent_struct" "foo" "cm_cshm.h" CSHM_RESULT_S1_${_config_type}_CXX LANGUAGE CXX)
+ check_struct_has_member("struct_with_non_existent_members" "non_existent_member" "cm_cshm.h" CSHM_RESULT_S2_${_config_type}_CXX LANGUAGE CXX)
+ check_struct_has_member("struct struct_with_member" "member" "cm_cshm.h" CSHM_RESULT_S3_${_config_type}_CXX LANGUAGE CXX)
+ check_struct_has_member("ns::non_existent_class" "foo" "cm_cshm.hxx" CSHM_RESULT_C1_${_config_type}_CXX LANGUAGE CXX)
+ check_struct_has_member("ns::class_with_non_existent_members" "foo" "cm_cshm.hxx" CSHM_RESULT_C2_${_config_type}_CXX LANGUAGE CXX)
+ check_struct_has_member("ns::class_with_member" "foo" "cm_cshm.hxx" CSHM_RESULT_C3_${_config_type}_CXX LANGUAGE CXX)
+
+ if(CSHM_RESULT_S1_${_config_type}_CXX OR CSHM_RESULT_S2_${_config_type}_CXX OR CSHM_RESULT_C1_${_config_type}_CXX OR CSHM_RESULT_C2_${_config_type}_CXX)
+ message(SEND_ERROR "CheckStructHasMember reported a nonexistent member as existing in configuration ${_config_type}")
+ endif()
+
+ if(NOT CSHM_RESULT_S3_${_config_type}_CXX OR NOT CSHM_RESULT_C3_${_config_type}_CXX)
+ message(SEND_ERROR "CheckStructHasMember did not report an existent member as existing in configuration ${_config_type}")
+ endif()
+endforeach()
+
+
+set(CMAKE_TRY_COMPILE_CONFIGURATION ${CMAKE_BUILD_TYPE})
+
+if (CMAKE_COMPILER_IS_GNUCC)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
+ unset(CSHM_RESULT_O3 CACHE)
+ unset(CSHM_RESULT_O3_C CACHE)
+ unset(CSHM_RESULT_O3_CXX CACHE)
+ message(STATUS "Testing with optimization -O3")
+
+ check_struct_has_member("class_with_non_existent_members" foo "cm_cshm.h" CSHM_RESULT_O3)
+ check_struct_has_member("class_with_non_existent_members" foo "cm_cshm.h" CSHM_RESULT_O3_C LANGUAGE C)
+ check_struct_has_member("class_with_non_existent_members" foo "cm_cshm.h" CSHM_RESULT_O3_CXX LANGUAGE CXX)
+
+ if (CSE_RESULT_O3 OR CSHM_RESULT_O3_C OR CSHM_RESULT_O3_CXX)
+ message(SEND_ERROR "CheckSymbolExists reported a nonexistent symbol as existing with optimization -O3")
+ endif ()
+endif ()
diff --git a/Tests/CMakeOnly/CheckStructHasMember/cm_cshm.h b/Tests/CMakeOnly/CheckStructHasMember/cm_cshm.h
new file mode 100644
index 0000000..82bb049
--- /dev/null
+++ b/Tests/CMakeOnly/CheckStructHasMember/cm_cshm.h
@@ -0,0 +1,9 @@
+#ifndef _CSHM_DUMMY_H
+#define _CSHM_DUMMY_H
+
+struct non_existent_struct;
+struct struct_with_member{
+ int member;
+};
+
+#endif
diff --git a/Tests/CMakeOnly/CheckStructHasMember/cm_cshm.hxx b/Tests/CMakeOnly/CheckStructHasMember/cm_cshm.hxx
new file mode 100644
index 0000000..458a99b
--- /dev/null
+++ b/Tests/CMakeOnly/CheckStructHasMember/cm_cshm.hxx
@@ -0,0 +1,16 @@
+#ifndef _CSHM_DUMMY_HXX
+#define _CSHM_DUMMY_HXX
+
+namespace ns {
+
+class non_existent_class;
+class class_with_non_existent_members {
+};
+class class_with_member {
+public:
+ int foo;
+};
+
+}
+
+#endif
diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt
index 344b772..4c49c6a 100644
--- a/Tests/CMakeTests/CMakeLists.txt
+++ b/Tests/CMakeTests/CMakeLists.txt
@@ -55,6 +55,15 @@ set(GetPrerequisites_PreArgs
)
AddCMakeTest(GetPrerequisites "${GetPrerequisites_PreArgs}")
+if(GIT_EXECUTABLE)
+ set(PolicyCheck_PreArgs
+ "-DCMake_BINARY_DIR:PATH=${CMake_BINARY_DIR}"
+ "-DCMake_SOURCE_DIR:PATH=${CMake_SOURCE_DIR}"
+ "-DGIT_EXECUTABLE:STRING=${GIT_EXECUTABLE}"
+ )
+ AddCMakeTest(PolicyCheck "${PolicyCheck_PreArgs}")
+endif()
+
# Run CheckSourceTree as the very last test in the CMake/CTest/CPack test
# suite. It detects if any changes have been made to the CMake source tree
# by any previous configure, build or test steps.
diff --git a/Tests/CMakeTests/PolicyCheckTest.cmake.in b/Tests/CMakeTests/PolicyCheckTest.cmake.in
new file mode 100644
index 0000000..416dc0a
--- /dev/null
+++ b/Tests/CMakeTests/PolicyCheckTest.cmake.in
@@ -0,0 +1,154 @@
+# Check the CMake source tree for suspicious policy introdcutions...
+#
+message("=============================================================================")
+message("CTEST_FULL_OUTPUT (Avoid ctest truncation of output)")
+message("")
+message("CMake_BINARY_DIR='${CMake_BINARY_DIR}'")
+message("CMake_SOURCE_DIR='${CMake_SOURCE_DIR}'")
+message("GIT_EXECUTABLE='${GIT_EXECUTABLE}'")
+message("")
+
+
+# If this does not appear to be a git checkout, just pass the test here
+# and now. (Do not let the test fail if it is run in a tree *exported* from a
+# repository or unpacked from a .zip file source installer...)
+#
+set(is_git_checkout 0)
+if(EXISTS "${CMake_SOURCE_DIR}/.git")
+ set(is_git_checkout 1)
+endif()
+
+message("is_git_checkout='${is_git_checkout}'")
+message("")
+
+if(NOT is_git_checkout)
+ message("source tree is not a git checkout... test passes by early return...")
+ return()
+endif()
+
+# If no GIT_EXECUTABLE, see if we can figure out which git was used
+# for the ctest_update step on this dashboard...
+#
+if(is_git_checkout AND NOT GIT_EXECUTABLE)
+ set(ctest_ini_file "")
+ set(exe "")
+
+ # Use the old name:
+ if(EXISTS "${CMake_BINARY_DIR}/DartConfiguration.tcl")
+ set(ctest_ini_file "${CMake_BINARY_DIR}/DartConfiguration.tcl")
+ endif()
+
+ # But if it exists, prefer the new name:
+ if(EXISTS "${CMake_BINARY_DIR}/CTestConfiguration.ini")
+ set(ctest_ini_file "${CMake_BINARY_DIR}/CTestConfiguration.ini")
+ endif()
+
+ # If there is a ctest ini file, read the update command or git command
+ # from it:
+ #
+ if(ctest_ini_file)
+ file(STRINGS "${ctest_ini_file}" line REGEX "^GITCommand: (.*)$")
+ string(REGEX REPLACE "^GITCommand: (.*)$" "\\1" line "${line}")
+ if("${line}" MATCHES "^\"")
+ string(REGEX REPLACE "^\"([^\"]+)\" *.*$" "\\1" line "${line}")
+ else()
+ string(REGEX REPLACE "^([^ ]+) *.*$" "\\1" line "${line}")
+ endif()
+ set(exe "${line}")
+ if("${exe}" STREQUAL "GITCOMMAND-NOTFOUND")
+ set(exe "")
+ endif()
+ if(exe)
+ message("info: GIT_EXECUTABLE set by 'GITCommand:' from '${ctest_ini_file}'")
+ endif()
+
+ if(NOT exe)
+ file(STRINGS "${ctest_ini_file}" line REGEX "^UpdateCommand: (.*)$")
+ string(REGEX REPLACE "^UpdateCommand: (.*)$" "\\1" line "${line}")
+ if("${line}" MATCHES "^\"")
+ string(REGEX REPLACE "^\"([^\"]+)\" *.*$" "\\1" line "${line}")
+ else()
+ string(REGEX REPLACE "^([^ ]+) *.*$" "\\1" line "${line}")
+ endif()
+ set(exe "${line}")
+ if("${exe}" STREQUAL "GITCOMMAND-NOTFOUND")
+ set(exe "")
+ endif()
+ if(exe)
+ message("info: GIT_EXECUTABLE set by 'UpdateCommand:' from '${ctest_ini_file}'")
+ endif()
+ endif()
+ else()
+ message("info: no DartConfiguration.tcl or CTestConfiguration.ini file...")
+ endif()
+
+ # If we have still not grokked the exe, look in the Update.xml file to see
+ # if we can parse it from there...
+ #
+ if(NOT exe)
+ file(GLOB_RECURSE update_xml_file "${CMake_BINARY_DIR}/Testing/Update.xml")
+ if(update_xml_file)
+ file(STRINGS "${update_xml_file}" line
+ REGEX "^.*<UpdateCommand>(.*)</UpdateCommand>$" LIMIT_COUNT 1)
+ string(REPLACE "&quot\;" "\"" line "${line}")
+ string(REGEX REPLACE "^.*<UpdateCommand>(.*)</UpdateCommand>$" "\\1" line "${line}")
+ if("${line}" MATCHES "^\"")
+ string(REGEX REPLACE "^\"([^\"]+)\" *.*$" "\\1" line "${line}")
+ else()
+ string(REGEX REPLACE "^([^ ]+) *.*$" "\\1" line "${line}")
+ endif()
+ if(line)
+ set(exe "${line}")
+ endif()
+ if(exe)
+ message("info: GIT_EXECUTABLE set by '<UpdateCommand>' from '${update_xml_file}'")
+ endif()
+ else()
+ message("info: no Update.xml file...")
+ endif()
+ endif()
+
+ if(exe)
+ set(GIT_EXECUTABLE "${exe}")
+ message("GIT_EXECUTABLE='${GIT_EXECUTABLE}'")
+ message("")
+
+ if(NOT EXISTS "${GIT_EXECUTABLE}")
+ message(FATAL_ERROR "GIT_EXECUTABLE does not exist...")
+ endif()
+ else()
+ message(FATAL_ERROR "could not determine GIT_EXECUTABLE...")
+ endif()
+endif()
+
+
+if(is_git_checkout AND GIT_EXECUTABLE)
+ # Check with "git grep" if there are any unacceptable cmPolicies additions
+ #
+ message("=============================================================================")
+ message("This is a git checkout, using git grep to verify no unacceptable policies")
+ message("are being introduced....")
+ message("")
+
+ execute_process(COMMAND ${GIT_EXECUTABLE} grep -En "[0-9][0-9][0-9][0-9][0-9].*cmPolicies"
+ WORKING_DIRECTORY ${CMake_SOURCE_DIR}
+ OUTPUT_VARIABLE grep_output
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ message("=== output of 'git grep -En \"[0-9][0-9][0-9][0-9][0-9].*cmPolicies\"' ===")
+ message("${grep_output}")
+ message("=== end output ===")
+ message("")
+
+ if(NOT "${grep_output}" STREQUAL "")
+ message(FATAL_ERROR "git grep output is non-empty...
+New CMake policies must be introduced in a non-date-based version number.
+Send email to the cmake-developers list to figure out what the target
+version number for this policy should be...")
+ endif()
+endif()
+
+
+# Still here? Good then...
+#
+message("test passes")
+message("")
diff --git a/Tests/CTestTestMemcheck/CMakeLists.txt b/Tests/CTestTestMemcheck/CMakeLists.txt
index 86d7385..b5162c9 100644
--- a/Tests/CTestTestMemcheck/CMakeLists.txt
+++ b/Tests/CTestTestMemcheck/CMakeLists.txt
@@ -35,14 +35,31 @@ target_link_libraries(memcheck_fail CMakeLib)
# same filenames.
add_subdirectory(NoLogDummyChecker)
-if (APPLE)
- # filter out additional messages by Guard Malloc integrated in Xcode
- set(GUARD_MALLOC_MSG "(ctest\([0-9]+\) malloc: [^\n]*\n)*")
- set(NORMAL_CTEST_OUTPUT "\n1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+\\.[0-9]+ sec\n${GUARD_MALLOC_MSG}\n${GUARD_MALLOC_MSG}100% tests passed, 0 tests failed out of 1\n.*\n-- Processing memory checking output: \n${GUARD_MALLOC_MSG}Memory checking results:\n${GUARD_MALLOC_MSG}")
-else ()
- set(NORMAL_CTEST_OUTPUT "\n1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+\\.[0-9]+ sec\n\n100% tests passed, 0 tests failed out of 1\n.*\n-- Processing memory checking output: \nMemory checking results:\n")
-endif ()
-set(BULLSEYE_MSG "(BullseyeCoverage[^\n]*\n)?")
+if(APPLE)
+ # filter out additional messages by Guard Malloc integrated in Xcode
+ set(guard_malloc_msg "ctest\\([0-9]+\\) malloc: ")
+ set(guard_malloc_lines "(${guard_malloc_msg}[^\n]*\n)*")
+ set(guard_malloc_output "${guard_malloc_msg}|")
+else()
+ set(guard_malloc_msg "")
+ set(guard_malloc_lines "")
+ set(guard_malloc_output "")
+endif()
+
+# When this entire test runs under coverage or memcheck tools
+# they may add output to the end, so match known cases:
+# - Bullseye adds a "BullseyeCoverage..." line.
+# - Valgrind memcheck may add extra "==..." lines.
+set(other_tool_output "((${guard_malloc_output}BullseyeCoverage|==)[^\n]*\n)*")
+
+string(REPLACE "\r\n" "\n" ctest_and_tool_outputs "
+1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+\\.[0-9]+ sec
+${guard_malloc_lines}
+100% tests passed, 0 tests failed out of 1
+.*
+-- Processing memory checking output:( )
+${guard_malloc_lines}Memory checking results:
+${other_tool_output}")
function(gen_mc_test_internal NAME CHECKER)
set(SUBTEST_NAME "${NAME}")
@@ -146,7 +163,7 @@ set_tests_properties(CTestTestMemcheckDummyValgrind
CTestTestMemcheckDummyValgrindPrePost
CTestTestMemcheckDummyPurify
PROPERTIES
- PASS_REGULAR_EXPRESSION "${NORMAL_CTEST_OUTPUT}${BULLSEYE_MSG}$")
+ PASS_REGULAR_EXPRESSION "${ctest_and_tool_outputs}$")
foreach (_pp Pre Post)
string(TOLOWER ${_pp} _pp_lower)
@@ -157,7 +174,7 @@ endforeach ()
set_tests_properties(CTestTestMemcheckDummyValgrindIgnoreMemcheck
PROPERTIES
- PASS_REGULAR_EXPRESSION "\n2/2 Test #2: RunCMakeAgain .*${NORMAL_CTEST_OUTPUT}${BULLSEYE_MSG}$")
+ PASS_REGULAR_EXPRESSION "\n2/2 Test #2: RunCMakeAgain .*${ctest_and_tool_outputs}$")
set_tests_properties(CTestTestMemcheckDummyBC PROPERTIES
PASS_REGULAR_EXPRESSION "\n1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+.[0-9]+ sec\n\n100% tests passed, 0 tests failed out of 1\n(.*\n)?Error parsing XML in stream at line 1: no element found\n")
diff --git a/Tests/CompatibleInterface/CMakeLists.txt b/Tests/CompatibleInterface/CMakeLists.txt
index ae1d2fa..5ee9fd7 100644
--- a/Tests/CompatibleInterface/CMakeLists.txt
+++ b/Tests/CompatibleInterface/CMakeLists.txt
@@ -6,7 +6,7 @@ project(CompatibleInterface)
include(GenerateExportHeader)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
-add_library(iface1 empty.cpp)
+add_library(iface1 INTERFACE)
set_property(TARGET iface1 APPEND PROPERTY
COMPATIBLE_INTERFACE_BOOL
BOOL_PROP1
diff --git a/Tests/Contracts/Trilinos-10-6/CMakeLists.txt b/Tests/Contracts/Trilinos/CMakeLists.txt
index 79ed669..f5757b5 100644
--- a/Tests/Contracts/Trilinos-10-6/CMakeLists.txt
+++ b/Tests/Contracts/Trilinos/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 2.8)
-project(Trilinos-10-6)
+project(Trilinos)
include(ExternalProject)
@@ -27,12 +27,12 @@ endif()
message(STATUS "HOME='${HOME}'")
if(NOT DEFINED url)
- set(url "http://www.cmake.org/files/contracts/trilinos-10.6.1.tar.gz")
+ set(url "http://www.cmake.org/files/contracts/trilinos-11.4.1.tar.gz")
endif()
message(STATUS "url='${url}'")
if(NOT DEFINED md5)
- set(md5 "690230465dd21a76e3c6636fd07bd2f0")
+ set(md5 "28b6a3c7c0fb317b3a237997293faa8b")
endif()
message(STATUS "md5='${md5}'")
diff --git a/Tests/Contracts/Trilinos-10-6/Dashboard.cmake.in b/Tests/Contracts/Trilinos/Dashboard.cmake.in
index cc29502..93d4f61 100644
--- a/Tests/Contracts/Trilinos-10-6/Dashboard.cmake.in
+++ b/Tests/Contracts/Trilinos/Dashboard.cmake.in
@@ -14,7 +14,7 @@ set(ENV{CTEST_SITE} "${CTEST_SITE}")
# Allow override of the environment on a per-client basis:
#
-set(ENV_SCRIPT "$ENV{CMAKE_CONTRACT_Trilinos_10_6_ENV_SCRIPT}")
+set(ENV_SCRIPT "$ENV{CMAKE_CONTRACT_Trilinos_ENV_SCRIPT}")
if(ENV_SCRIPT AND EXISTS "${ENV_SCRIPT}")
include("${ENV_SCRIPT}")
endif()
@@ -49,7 +49,7 @@ endif()
#
execute_process(COMMAND
"${CMAKE_CTEST_COMMAND}"
- -S "${CTEST_SOURCE_DIRECTORY}/cmake/ctest/experimental_build_test.cmake"
+ -S "${CTEST_SOURCE_DIRECTORY}/cmake/tribits/ctest/experimental_build_test.cmake"
-VV
WORKING_DIRECTORY "${CTEST_BINARY_DIRECTORY}"
RESULT_VARIABLE rv
diff --git a/Tests/Contracts/Trilinos-10-6/EnvScript.cmake b/Tests/Contracts/Trilinos/EnvScript.cmake
index dacb704..dacb704 100644
--- a/Tests/Contracts/Trilinos-10-6/EnvScript.cmake
+++ b/Tests/Contracts/Trilinos/EnvScript.cmake
diff --git a/Tests/Contracts/Trilinos-10-6/Patch.cmake b/Tests/Contracts/Trilinos/Patch.cmake
index 6c619ac..6c619ac 100644
--- a/Tests/Contracts/Trilinos-10-6/Patch.cmake
+++ b/Tests/Contracts/Trilinos/Patch.cmake
diff --git a/Tests/Contracts/Trilinos-10-6/RunTest.cmake b/Tests/Contracts/Trilinos/RunTest.cmake
index 30124d8..d661a4c 100644
--- a/Tests/Contracts/Trilinos-10-6/RunTest.cmake
+++ b/Tests/Contracts/Trilinos/RunTest.cmake
@@ -4,4 +4,4 @@ set(dir "${CMAKE_CURRENT_BINARY_DIR}/Contracts/${project}")
set(exe "${CMAKE_COMMAND}")
set(args -P "${dir}/ValidateBuild.cmake")
-set(Trilinos-10-6_RUN_TEST ${exe} ${args})
+set(Trilinos_RUN_TEST ${exe} ${args})
diff --git a/Tests/Contracts/Trilinos-10-6/ValidateBuild.cmake.in b/Tests/Contracts/Trilinos/ValidateBuild.cmake.in
index 04bbf21..fa38ada 100644
--- a/Tests/Contracts/Trilinos-10-6/ValidateBuild.cmake.in
+++ b/Tests/Contracts/Trilinos/ValidateBuild.cmake.in
@@ -20,10 +20,10 @@ message(STATUS "Found len='${len}' *.exe files")
# Try to find the Teuchos unit tests executable:
#
-file(GLOB_RECURSE exe "${binary_dir}/Teuchos_UnitTest_UnitTests.exe")
+file(GLOB_RECURSE exe "${binary_dir}/TeuchosCore_UnitTest_UnitTests.exe")
list(LENGTH exe len)
if(NOT len EQUAL 1)
- message(FATAL_ERROR "len='${len}' is not the expected='1' (count of Teuchos_UnitTest_UnitTests.exe)")
+ message(FATAL_ERROR "len='${len}' is not the expected='1' (count of TeuchosCore_UnitTest_UnitTests.exe)")
endif()
message(STATUS "Found exe='${exe}'")
@@ -31,7 +31,7 @@ message(STATUS "Found exe='${exe}'")
# Try to run it:
execute_process(COMMAND ${exe} RESULT_VARIABLE rv)
if(NOT "${rv}" STREQUAL "0")
- message(FATAL_ERROR "rv='${rv}' is not the expected='0' (result of running Teuchos_UnitTest_UnitTests.exe)")
+ message(FATAL_ERROR "rv='${rv}' is not the expected='0' (result of running TeuchosCore_UnitTest_UnitTests.exe)")
endif()
message(STATUS "Ran exe='${exe}' rv='${rv}'")
diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt
index 72ae78f..cbae967 100644
--- a/Tests/ExportImport/Export/CMakeLists.txt
+++ b/Tests/ExportImport/Export/CMakeLists.txt
@@ -298,6 +298,14 @@ set_property(TARGET cmp0022OLD APPEND PROPERTY LINK_INTERFACE_LIBRARIES testLib3
add_library(noIncludesInterface empty.cpp)
+add_library(systemlib SHARED systemlib.cpp)
+install(FILES systemlib.h DESTINATION include/systemlib)
+target_include_directories(systemlib
+ INTERFACE
+ $<INSTALL_INTERFACE:include/systemlib>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
+)
+
install(TARGETS testLibRequired
EXPORT RequiredExp DESTINATION lib
INCLUDES DESTINATION
@@ -366,6 +374,7 @@ install(
testLib6
testLibCycleA testLibCycleB
cmp0022NEW cmp0022OLD
+ systemlib
EXPORT exp
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib NAMELINK_SKIP
@@ -417,6 +426,7 @@ export(TARGETS testExe1 testLib1 testLib2 testLib3
testSharedLibRequired testSharedLibRequiredUser testSharedLibRequiredUser2
testSharedLibDepends renamed_on_export
cmp0022NEW cmp0022OLD
+ systemlib
NAMESPACE bld_
FILE ExportBuildTree.cmake
)
@@ -426,3 +436,5 @@ export(TARGETS testExe2 testLib4 testLib5 testLib6 testExe3 testExe2lib
NAMESPACE bld_
APPEND FILE ExportBuildTree.cmake
)
+
+add_subdirectory(Interface)
diff --git a/Tests/ExportImport/Export/Interface/CMakeLists.txt b/Tests/ExportImport/Export/Interface/CMakeLists.txt
new file mode 100644
index 0000000..fc9c0c7
--- /dev/null
+++ b/Tests/ExportImport/Export/Interface/CMakeLists.txt
@@ -0,0 +1,49 @@
+
+add_library(headeronly INTERFACE)
+set_property(TARGET headeronly PROPERTY INTERFACE_INCLUDE_DIRECTORIES
+ "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/headeronly>"
+ "$<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include/headeronly>"
+)
+set_property(TARGET headeronly PROPERTY INTERFACE_COMPILE_DEFINITIONS "HEADERONLY_DEFINE")
+
+include(GenerateExportHeader)
+add_library(sharedlib SHARED sharedlib.cpp)
+generate_export_header(sharedlib)
+set_property(TARGET sharedlib PROPERTY INCLUDE_DIRECTORIES
+ "${CMAKE_CURRENT_SOURCE_DIR}/sharedlib"
+ "${CMAKE_CURRENT_BINARY_DIR}"
+)
+set_property(TARGET sharedlib PROPERTY INTERFACE_INCLUDE_DIRECTORIES
+ "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/sharedlib;${CMAKE_CURRENT_BINARY_DIR}>"
+ "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include/sharedlib>"
+)
+
+set_property(TARGET sharedlib PROPERTY INTERFACE_COMPILE_DEFINITIONS "SHAREDLIB_DEFINE")
+
+add_library(sharediface INTERFACE)
+target_link_libraries(sharediface INTERFACE sharedlib)
+
+export(TARGETS sharediface sharedlib headeronly
+ NAMESPACE bld_
+ FILE ../ExportInterfaceBuildTree.cmake
+)
+
+install(TARGETS headeronly sharediface sharedlib
+ EXPORT expInterface
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib NAMELINK_SKIP
+ ARCHIVE DESTINATION lib
+ FRAMEWORK DESTINATION Frameworks
+ BUNDLE DESTINATION Applications
+)
+install(FILES
+ headeronly/headeronly.h
+ DESTINATION include/headeronly
+)
+install(FILES
+ sharedlib/sharedlib.h
+ "${CMAKE_CURRENT_BINARY_DIR}/sharedlib_export.h"
+ DESTINATION include/sharedlib
+)
+
+install(EXPORT expInterface NAMESPACE exp_ DESTINATION lib/exp)
diff --git a/Tests/ExportImport/Export/Interface/headeronly/headeronly.h b/Tests/ExportImport/Export/Interface/headeronly/headeronly.h
new file mode 100644
index 0000000..3673c21
--- /dev/null
+++ b/Tests/ExportImport/Export/Interface/headeronly/headeronly.h
@@ -0,0 +1,7 @@
+
+enum { one };
+
+struct HeaderOnly
+{
+ int foo() const { return 0; }
+};
diff --git a/Tests/ExportImport/Export/Interface/sharedlib.cpp b/Tests/ExportImport/Export/Interface/sharedlib.cpp
new file mode 100644
index 0000000..88ca713
--- /dev/null
+++ b/Tests/ExportImport/Export/Interface/sharedlib.cpp
@@ -0,0 +1,7 @@
+
+#include "sharedlib.h"
+
+int SharedLibObject::foo() const
+{
+ return 0;
+}
diff --git a/Tests/ExportImport/Export/Interface/sharedlib/sharedlib.h b/Tests/ExportImport/Export/Interface/sharedlib/sharedlib.h
new file mode 100644
index 0000000..aad9ef3
--- /dev/null
+++ b/Tests/ExportImport/Export/Interface/sharedlib/sharedlib.h
@@ -0,0 +1,7 @@
+
+#include "sharedlib_export.h"
+
+struct SHAREDLIB_EXPORT SharedLibObject
+{
+ int foo() const;
+};
diff --git a/Tests/ExportImport/Export/systemlib.cpp b/Tests/ExportImport/Export/systemlib.cpp
new file mode 100644
index 0000000..ec45148
--- /dev/null
+++ b/Tests/ExportImport/Export/systemlib.cpp
@@ -0,0 +1,7 @@
+
+#include "systemlib.h"
+
+SystemStruct::SystemStruct()
+{
+
+}
diff --git a/Tests/ExportImport/Export/systemlib.h b/Tests/ExportImport/Export/systemlib.h
new file mode 100644
index 0000000..f7900c0
--- /dev/null
+++ b/Tests/ExportImport/Export/systemlib.h
@@ -0,0 +1,22 @@
+
+#ifndef SYSTEMLIB_H
+#define SYSTEMLIB_H
+
+#if defined(_WIN32) || defined(__CYGWIN__)
+# define systemlib_EXPORT __declspec(dllexport)
+#else
+# define systemlib_EXPORT
+#endif
+
+struct systemlib_EXPORT SystemStruct
+{
+ SystemStruct();
+
+ void someMethod()
+ {
+ int unused;
+ // unused warning not issued when this header is used as a system header.
+ }
+};
+
+#endif
diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt
index 2627354..ebe4af2 100644
--- a/Tests/ExportImport/Import/A/CMakeLists.txt
+++ b/Tests/ExportImport/Import/A/CMakeLists.txt
@@ -265,3 +265,50 @@ foreach(_config ${_configs})
)
endforeach()
unset(_configs)
+
+if (((CMAKE_C_COMPILER_ID STREQUAL GNU AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.4)
+ OR CMAKE_C_COMPILER_ID STREQUAL Clang)
+ AND (CMAKE_GENERATOR STREQUAL "Unix Makefiles" OR CMAKE_GENERATOR STREQUAL "Ninja"))
+ include(CheckCXXCompilerFlag)
+ check_cxx_compiler_flag(-Wunused-variable run_sys_includes_test)
+ if(run_sys_includes_test)
+ # The Bullseye wrapper appears to break the -isystem effect.
+ execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version OUTPUT_VARIABLE out ERROR_VARIABLE out)
+ if("x${out}" MATCHES "Bullseye")
+ set(run_sys_includes_test 0)
+ endif()
+ endif()
+ if (run_sys_includes_test)
+ add_executable(test_system_exp test_system.cpp)
+ target_link_libraries(test_system_exp exp_systemlib)
+ target_compile_options(test_system_exp PRIVATE -Wunused-variable -Werror=unused-variable)
+
+ unset(EXP_ERROR_VARIABLE CACHE)
+ try_compile(EXP_ERROR_VARIABLE
+ "${CMAKE_CURRENT_SOURCE_DIR}/test_system"
+ "${CMAKE_CURRENT_SOURCE_DIR}/test_system.cpp"
+ COMPILE_DEFINITIONS "-Wunused-variable -Werror=unused-variable"
+ LINK_LIBRARIES exp_systemlib
+ OUTPUT_VARIABLE OUTPUT
+ )
+ if(NOT EXP_ERROR_VARIABLE)
+ message(SEND_ERROR "EXP_ERROR_VARIABLE try_compile failed, but it was expected to succeed ${OUTPUT}.")
+ endif()
+
+ add_executable(test_system_bld test_system.cpp)
+ target_link_libraries(test_system_bld bld_systemlib)
+ target_compile_options(test_system_bld PRIVATE -Wunused-variable -Werror=unused-variable)
+
+ unset(BLD_ERROR_VARIABLE CACHE)
+ try_compile(BLD_ERROR_VARIABLE
+ "${CMAKE_CURRENT_SOURCE_DIR}/test_system"
+ "${CMAKE_CURRENT_SOURCE_DIR}/test_system.cpp"
+ COMPILE_DEFINITIONS "-Wunused-variable -Werror=unused-variable"
+ LINK_LIBRARIES bld_systemlib
+ OUTPUT_VARIABLE OUTPUT
+ )
+ if(NOT BLD_ERROR_VARIABLE)
+ message(SEND_ERROR "BLD_ERROR_VARIABLE try_compile failed, but it was expected to succeed.")
+ endif()
+ endif()
+endif()
diff --git a/Tests/ExportImport/Import/A/test_system.cpp b/Tests/ExportImport/Import/A/test_system.cpp
new file mode 100644
index 0000000..aae3583
--- /dev/null
+++ b/Tests/ExportImport/Import/A/test_system.cpp
@@ -0,0 +1,9 @@
+
+#include "systemlib.h"
+
+int main()
+{
+ SystemStruct s;
+ (void)s;
+ return 0;
+}
diff --git a/Tests/ExportImport/Import/CMakeLists.txt b/Tests/ExportImport/Import/CMakeLists.txt
index 9c2d597..5e809a2 100644
--- a/Tests/ExportImport/Import/CMakeLists.txt
+++ b/Tests/ExportImport/Import/CMakeLists.txt
@@ -19,3 +19,6 @@ add_executable(imp_testTransExe1b imp_testTransExe1.c)
target_link_libraries(imp_testTransExe1b imp_lib1b)
add_subdirectory(try_compile)
+
+# Test package INTERFACE controls
+add_subdirectory(Interface)
diff --git a/Tests/ExportImport/Import/Interface/CMakeLists.txt b/Tests/ExportImport/Import/Interface/CMakeLists.txt
new file mode 100644
index 0000000..c7bd13e
--- /dev/null
+++ b/Tests/ExportImport/Import/Interface/CMakeLists.txt
@@ -0,0 +1,55 @@
+
+# Import targets from the exported build tree.
+include(${Import_BINARY_DIR}/../Export/ExportInterfaceBuildTree.cmake)
+
+# Import targets from the exported install tree.
+include(${CMAKE_INSTALL_PREFIX}/lib/exp/expInterface.cmake)
+
+add_library(define_iface INTERFACE)
+set_property(TARGET define_iface PROPERTY
+ INTERFACE_COMPILE_DEFINITIONS DEFINE_IFACE_DEFINE)
+
+add_executable(headeronlytest_bld headeronlytest.cpp)
+target_link_libraries(headeronlytest_bld bld_headeronly)
+
+set_property(TARGET bld_sharediface APPEND PROPERTY INTERFACE_LINK_LIBRARIES define_iface)
+
+add_executable(interfacetest_bld interfacetest.cpp)
+target_link_libraries(interfacetest_bld bld_sharediface)
+
+include(CheckCXXSourceCompiles)
+
+macro(do_try_compile prefix)
+
+ set(CMAKE_REQUIRED_LIBRARIES ${prefix}headeronly)
+ check_cxx_source_compiles(
+ "
+ #include \"headeronly.h\"
+
+ #ifndef HEADERONLY_DEFINE
+ #error Expected HEADERONLY_DEFINE
+ #endif
+
+ int main(int,char**)
+ {
+ HeaderOnly ho;
+ return ho.foo();
+ }
+ " ${prefix}IFACE_TRY_COMPILE)
+
+ if(NOT ${prefix}IFACE_TRY_COMPILE)
+ message(SEND_ERROR "${prefix} try_compile with IMPORTED INTERFACE target failed!\n\n${OUTPUT}")
+ endif()
+endmacro()
+
+do_try_compile(bld_)
+
+add_executable(headeronlytest_exp headeronlytest.cpp)
+target_link_libraries(headeronlytest_exp exp_headeronly)
+
+set_property(TARGET exp_sharediface APPEND PROPERTY INTERFACE_LINK_LIBRARIES define_iface)
+
+add_executable(interfacetest_exp interfacetest.cpp)
+target_link_libraries(interfacetest_exp exp_sharediface)
+
+do_try_compile(exp_)
diff --git a/Tests/ExportImport/Import/Interface/headeronlytest.cpp b/Tests/ExportImport/Import/Interface/headeronlytest.cpp
new file mode 100644
index 0000000..20674a7
--- /dev/null
+++ b/Tests/ExportImport/Import/Interface/headeronlytest.cpp
@@ -0,0 +1,17 @@
+
+#include "headeronly.h"
+
+#ifndef HEADERONLY_DEFINE
+#error Expected HEADERONLY_DEFINE
+#endif
+
+#ifdef SHAREDLIB_DEFINE
+#error Unexpected SHAREDLIB_DEFINE
+#endif
+
+
+int main(int,char**)
+{
+ HeaderOnly ho;
+ return ho.foo();
+}
diff --git a/Tests/ExportImport/Import/Interface/interfacetest.cpp b/Tests/ExportImport/Import/Interface/interfacetest.cpp
new file mode 100644
index 0000000..786458d
--- /dev/null
+++ b/Tests/ExportImport/Import/Interface/interfacetest.cpp
@@ -0,0 +1,20 @@
+
+#include "sharedlib.h"
+
+#ifndef SHAREDLIB_DEFINE
+#error Expected SHAREDLIB_DEFINE
+#endif
+
+#ifdef HEADERONLY_DEFINE
+#error Unexpected HEADERONLY_DEFINE
+#endif
+
+#ifndef DEFINE_IFACE_DEFINE
+#error Expected DEFINE_IFACE_DEFINE
+#endif
+
+int main(int,char**)
+{
+ SharedLibObject slo;
+ return slo.foo();
+}
diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt
index 4d8d7ed..e0df8c2 100644
--- a/Tests/GeneratorExpression/CMakeLists.txt
+++ b/Tests/GeneratorExpression/CMakeLists.txt
@@ -1,5 +1,7 @@
cmake_minimum_required (VERSION 2.8.8)
-project(GeneratorExpression CXX)
+project(GeneratorExpression)
+
+include(CTest)
# This test is split into multiple parts as needed to avoid NMake command
# length limits.
@@ -186,7 +188,40 @@ add_custom_target(check-part3 ALL
-Dtest_alias_target_name=$<STREQUAL:$<TARGET_PROPERTY:Alias::SomeLib,NAME>,$<TARGET_PROPERTY:empty1,NAME>>
-Dtest_early_termination_1=$<$<1:>:
-Dtest_early_termination_2=$<$<1:>:,
+ -Dsystem_name=${CMAKE_HOST_SYSTEM_NAME}
+ -Dtest_platform_id=$<PLATFORM_ID>
+ -Dtest_platform_id_Linux=$<PLATFORM_ID:Linux>
+ -Dtest_platform_id_Windows=$<PLATFORM_ID:Windows>
+ -Dtest_platform_id_Darwin=$<PLATFORM_ID:Darwin>
-P ${CMAKE_CURRENT_SOURCE_DIR}/check-part3.cmake
COMMAND ${CMAKE_COMMAND} -E echo "check done (part 3 of 3)"
VERBATIM
)
+
+#-----------------------------------------------------------------------------
+# Cover test properties with generator expressions.
+add_executable(echo echo.c)
+add_executable(pwd pwd.c)
+
+add_test(NAME echo-configuration COMMAND echo $<CONFIGURATION>)
+set_property(TEST echo-configuration PROPERTY
+ PASS_REGULAR_EXPRESSION "^$<CONFIGURATION>\n$")
+
+add_test(NAME echo-target-file COMMAND echo $<TARGET_FILE:echo>)
+set_property(TEST echo-target-file PROPERTY
+ PASS_REGULAR_EXPRESSION "/echo${CMAKE_EXECUTABLE_SUFFIX}\n$")
+set_property(TEST echo-target-file PROPERTY
+ REQUIRED_FILES "$<TARGET_FILE:echo>")
+
+add_test(NAME working-dir-arg
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/WorkingDirectory/$<CONFIGURATION>"
+ COMMAND pwd)
+set_property(TEST working-dir-arg PROPERTY
+ PASS_REGULAR_EXPRESSION "WorkingDirectory/$<CONFIGURATION>\n$")
+foreach(c ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE})
+ file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/WorkingDirectory/${c}")
+endforeach()
+
+add_test(echo-old-style echo "\$<CONFIGURATION>")
+set_property(TEST echo-old-style PROPERTY
+ PASS_REGULAR_EXPRESSION "^\\$<CONFIGURATION>\n$")
diff --git a/Tests/GeneratorExpression/check-part3.cmake b/Tests/GeneratorExpression/check-part3.cmake
index 74a596c..93ea487 100644
--- a/Tests/GeneratorExpression/check-part3.cmake
+++ b/Tests/GeneratorExpression/check-part3.cmake
@@ -26,3 +26,11 @@ check(test_alias_file_lib "1")
check(test_alias_target_name "1")
check(test_early_termination_1 "$<:")
check(test_early_termination_2 "$<:,")
+check(test_platform_id "${system_name}")
+foreach(system Linux Windows Darwin)
+ if(system_name STREQUAL system)
+ check(test_platform_id_${system} 1)
+ else()
+ check(test_platform_id_${system} 0)
+ endif()
+endforeach()
diff --git a/Tests/GeneratorExpression/echo.c b/Tests/GeneratorExpression/echo.c
new file mode 100644
index 0000000..06b0844
--- /dev/null
+++ b/Tests/GeneratorExpression/echo.c
@@ -0,0 +1,8 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(int argc, char* argv[])
+{
+ printf("%s\n", argv[1]);
+ return EXIT_SUCCESS;
+}
diff --git a/Tests/GeneratorExpression/pwd.c b/Tests/GeneratorExpression/pwd.c
new file mode 100644
index 0000000..054b1af
--- /dev/null
+++ b/Tests/GeneratorExpression/pwd.c
@@ -0,0 +1,34 @@
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifdef _WIN32
+#include <direct.h>
+#define getcurdir _getcwd
+#else
+#include <unistd.h>
+#define getcurdir getcwd
+#endif
+
+int main(int argc, char* argv[])
+{
+#define BUFSZ 20000
+ char buf[BUFSZ + 1];
+#ifdef _WIN32
+ char *pos;
+#endif
+ getcurdir(buf, BUFSZ);
+#ifdef _WIN32
+ pos = buf;
+ while (*pos)
+ {
+ if (*pos == '\\')
+ {
+ *pos = '/';
+ }
+ ++pos;
+ }
+#endif
+ printf("%s\n", buf);
+ return EXIT_SUCCESS;
+}
diff --git a/Tests/InterfaceLibrary/CMakeLists.txt b/Tests/InterfaceLibrary/CMakeLists.txt
new file mode 100644
index 0000000..53aeb03
--- /dev/null
+++ b/Tests/InterfaceLibrary/CMakeLists.txt
@@ -0,0 +1,15 @@
+
+cmake_minimum_required(VERSION 2.8)
+
+project(InterfaceLibrary)
+
+add_library(iface_nodepends INTERFACE)
+target_compile_definitions(iface_nodepends INTERFACE IFACE_DEFINE)
+
+add_executable(InterfaceLibrary definetestexe.cpp)
+target_link_libraries(InterfaceLibrary iface_nodepends)
+
+add_subdirectory(libsdir)
+
+add_executable(sharedlibtestexe sharedlibtestexe.cpp)
+target_link_libraries(sharedlibtestexe shared_iface)
diff --git a/Tests/InterfaceLibrary/definetestexe.cpp b/Tests/InterfaceLibrary/definetestexe.cpp
new file mode 100644
index 0000000..decd37c
--- /dev/null
+++ b/Tests/InterfaceLibrary/definetestexe.cpp
@@ -0,0 +1,9 @@
+
+#ifndef IFACE_DEFINE
+#error Expected IFACE_DEFINE
+#endif
+
+int main(int,char**)
+{
+ return 0;
+}
diff --git a/Tests/InterfaceLibrary/libsdir/CMakeLists.txt b/Tests/InterfaceLibrary/libsdir/CMakeLists.txt
new file mode 100644
index 0000000..6999646
--- /dev/null
+++ b/Tests/InterfaceLibrary/libsdir/CMakeLists.txt
@@ -0,0 +1,26 @@
+
+include(GenerateExportHeader)
+
+add_library(sharedlib SHARED sharedlib.cpp)
+generate_export_header(sharedlib)
+
+add_library(shareddependlib SHARED shareddependlib.cpp)
+generate_export_header(shareddependlib)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
+
+target_link_libraries(sharedlib PUBLIC shareddependlib)
+
+target_include_directories(shareddependlib
+ PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/shareddependlib")
+target_compile_definitions(shareddependlib
+ INTERFACE $<1:SHAREDDEPENDLIB_DEFINE>)
+
+target_include_directories(sharedlib
+ PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/sharedlib")
+target_compile_definitions(shareddependlib
+ INTERFACE $<1:SHAREDLIB_DEFINE>)
+
+add_library(shared_iface INTERFACE)
+target_link_libraries(shared_iface INTERFACE sharedlib)
diff --git a/Tests/InterfaceLibrary/libsdir/shareddependlib.cpp b/Tests/InterfaceLibrary/libsdir/shareddependlib.cpp
new file mode 100644
index 0000000..378ba81
--- /dev/null
+++ b/Tests/InterfaceLibrary/libsdir/shareddependlib.cpp
@@ -0,0 +1,7 @@
+
+#include "shareddependlib.h"
+
+int SharedDependLibObject::foo() const
+{
+ return 0;
+}
diff --git a/Tests/InterfaceLibrary/libsdir/shareddependlib/shareddependlib.h b/Tests/InterfaceLibrary/libsdir/shareddependlib/shareddependlib.h
new file mode 100644
index 0000000..ad9b484
--- /dev/null
+++ b/Tests/InterfaceLibrary/libsdir/shareddependlib/shareddependlib.h
@@ -0,0 +1,12 @@
+
+#ifndef SHAREDDEPENDLIB_H
+#define SHAREDDEPENDLIB_H
+
+#include "shareddependlib_export.h"
+
+struct SHAREDDEPENDLIB_EXPORT SharedDependLibObject
+{
+ int foo() const;
+};
+
+#endif
diff --git a/Tests/InterfaceLibrary/libsdir/sharedlib.cpp b/Tests/InterfaceLibrary/libsdir/sharedlib.cpp
new file mode 100644
index 0000000..c49ce90
--- /dev/null
+++ b/Tests/InterfaceLibrary/libsdir/sharedlib.cpp
@@ -0,0 +1,12 @@
+
+#include "sharedlib.h"
+
+SharedDependLibObject SharedLibObject::object() const
+{
+ SharedDependLibObject sdlo;
+ return sdlo;
+}
+int SharedLibObject::foo() const
+{
+ return 0;
+}
diff --git a/Tests/InterfaceLibrary/libsdir/sharedlib/sharedlib.h b/Tests/InterfaceLibrary/libsdir/sharedlib/sharedlib.h
new file mode 100644
index 0000000..5b3c7db
--- /dev/null
+++ b/Tests/InterfaceLibrary/libsdir/sharedlib/sharedlib.h
@@ -0,0 +1,15 @@
+
+#ifndef SHAREDLIB_H
+#define SHAREDLIB_H
+
+#include "sharedlib_export.h"
+
+#include "shareddependlib.h"
+
+struct SHAREDLIB_EXPORT SharedLibObject
+{
+ SharedDependLibObject object() const;
+ int foo() const;
+};
+
+#endif
diff --git a/Tests/InterfaceLibrary/sharedlibtestexe.cpp b/Tests/InterfaceLibrary/sharedlibtestexe.cpp
new file mode 100644
index 0000000..c677f70
--- /dev/null
+++ b/Tests/InterfaceLibrary/sharedlibtestexe.cpp
@@ -0,0 +1,19 @@
+
+#ifndef SHAREDLIB_DEFINE
+#error Expected SHAREDLIB_DEFINE
+#endif
+
+#ifndef SHAREDDEPENDLIB_DEFINE
+#error Expected SHAREDDEPENDLIB_DEFINE
+#endif
+
+#include "sharedlib.h"
+#include "shareddependlib.h"
+
+int main(int,char**)
+{
+ SharedLibObject sl;
+ SharedDependLibObject sdl = sl.object();
+
+ return sdl.foo() + sl.foo();
+}
diff --git a/Tests/MakeClean/ToClean/CMakeLists.txt b/Tests/MakeClean/ToClean/CMakeLists.txt
index 28569dd..37d7292 100644
--- a/Tests/MakeClean/ToClean/CMakeLists.txt
+++ b/Tests/MakeClean/ToClean/CMakeLists.txt
@@ -26,6 +26,18 @@ add_custom_command(OUTPUT ${ToClean_BINARY_DIR}/generated.txt
add_custom_target(generate ALL DEPENDS ${ToClean_BINARY_DIR}/generated.txt)
set(TOCLEAN_FILES ${TOCLEAN_FILES} "${ToClean_BINARY_DIR}/generated.txt")
+# Create a custom command whose output should be cleaned, but whose name
+# is not known until generate-time
+set(copied_exe "$<TARGET_FILE_DIR:toclean>/toclean_copy${CMAKE_EXECUTABLE_SUFFIX}")
+add_custom_command(TARGET toclean POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy $<TARGET_FILE:toclean>
+ ${copied_exe}
+ )
+set_property(DIRECTORY APPEND PROPERTY
+ ADDITIONAL_MAKE_CLEAN_FILES ${copied_exe})
+list(APPEND TOCLEAN_FILES "${ToClean_BINARY_DIR}/toclean_copy${CMAKE_EXECUTABLE_SUFFIX}")
+
# Configure a file listing these build-time-generated files.
configure_file(${ToClean_SOURCE_DIR}/ToCleanFiles.cmake.in
${ToClean_BINARY_DIR}/ToCleanFiles.cmake @ONLY IMMEDIATE)
diff --git a/Tests/PositionIndependentTargets/CMakeLists.txt b/Tests/PositionIndependentTargets/CMakeLists.txt
index eec893d..e79f3b7 100644
--- a/Tests/PositionIndependentTargets/CMakeLists.txt
+++ b/Tests/PositionIndependentTargets/CMakeLists.txt
@@ -9,5 +9,6 @@ include_directories("${CMAKE_CURRENT_SOURCE_DIR}") # For pic_test.h
add_subdirectory(global)
add_subdirectory(targets)
+add_subdirectory(interface)
add_executable(PositionIndependentTargets main.cpp)
diff --git a/Tests/PositionIndependentTargets/interface/CMakeLists.txt b/Tests/PositionIndependentTargets/interface/CMakeLists.txt
new file mode 100644
index 0000000..65f3b76
--- /dev/null
+++ b/Tests/PositionIndependentTargets/interface/CMakeLists.txt
@@ -0,0 +1,27 @@
+
+add_library(piciface INTERFACE)
+set_property(TARGET piciface PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE ON)
+
+add_executable(test_empty_iface "${CMAKE_CURRENT_SOURCE_DIR}/../pic_main.cpp")
+target_link_libraries(test_empty_iface piciface)
+
+add_library(sharedlib SHARED "${CMAKE_CURRENT_SOURCE_DIR}/../pic_lib.cpp")
+target_link_libraries(sharedlib piciface)
+set_property(TARGET sharedlib PROPERTY DEFINE_SYMBOL PIC_TEST_BUILD_DLL)
+
+add_executable(test_iface_via_shared "${CMAKE_CURRENT_SOURCE_DIR}/../pic_main.cpp")
+target_link_libraries(test_iface_via_shared sharedlib)
+
+add_library(sharedlibpic SHARED "${CMAKE_CURRENT_SOURCE_DIR}/../pic_lib.cpp")
+set_property(TARGET sharedlibpic PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE ON)
+set_property(TARGET sharedlibpic PROPERTY DEFINE_SYMBOL PIC_TEST_BUILD_DLL)
+
+add_library(shared_iface INTERFACE)
+target_link_libraries(shared_iface INTERFACE sharedlibpic)
+
+add_executable(test_shared_via_iface "${CMAKE_CURRENT_SOURCE_DIR}/../pic_main.cpp")
+target_link_libraries(test_shared_via_iface shared_iface)
+
+add_executable(test_shared_via_iface_non_conflict "${CMAKE_CURRENT_SOURCE_DIR}/../pic_main.cpp")
+set_property(TARGET test_shared_via_iface_non_conflict PROPERTY POSITION_INDEPENDENT_CODE ON)
+target_link_libraries(test_shared_via_iface_non_conflict shared_iface)
diff --git a/Tests/PythonCoverage/DartConfiguration.tcl.in b/Tests/PythonCoverage/DartConfiguration.tcl.in
new file mode 100644
index 0000000..e29cffe
--- /dev/null
+++ b/Tests/PythonCoverage/DartConfiguration.tcl.in
@@ -0,0 +1,8 @@
+# This file is configured by CMake automatically as DartConfiguration.tcl
+# If you choose not to use CMake, this file may be hand configured, by
+# filling in the required variables.
+
+
+# Configuration directories and files
+SourceDirectory: ${CMake_BINARY_DIR}/Testing/PythonCoverage/coveragetest
+BuildDirectory: ${CMake_BINARY_DIR}/Testing/PythonCoverage
diff --git a/Tests/PythonCoverage/coverage.xml.in b/Tests/PythonCoverage/coverage.xml.in
new file mode 100644
index 0000000..fcc1b1c
--- /dev/null
+++ b/Tests/PythonCoverage/coverage.xml.in
@@ -0,0 +1,35 @@
+<?xml version="1.0" ?>
+<!DOCTYPE coverage
+ SYSTEM 'http://cobertura.sourceforge.net/xml/coverage-03.dtd'>
+<coverage branch-rate="0" line-rate="0.8462" timestamp="1380469411433" version="3.6">
+ <!-- Generated by coverage.py: http://nedbatchelder.com/code/coverage -->
+ <packages>
+ <package branch-rate="0" complexity="0" line-rate="0.8462" name="">
+ <classes>
+ <class branch-rate="0" complexity="0" filename="foo.py" line-rate="0.6667" name="foo">
+ <methods/>
+ <lines>
+ <line hits="1" number="2"/>
+ <line hits="1" number="3"/>
+ <line hits="1" number="4"/>
+ <line hits="1" number="6"/>
+ <line hits="0" number="7"/>
+ <line hits="0" number="8"/>
+ </lines>
+ </class>
+ <class branch-rate="0" complexity="0" filename="test_foo.py" line-rate="1" name="test_foo">
+ <methods/>
+ <lines>
+ <line hits="1" number="2"/>
+ <line hits="1" number="3"/>
+ <line hits="1" number="5"/>
+ <line hits="1" number="7"/>
+ <line hits="1" number="8"/>
+ <line hits="1" number="10"/>
+ <line hits="1" number="11"/>
+ </lines>
+ </class>
+ </classes>
+ </package>
+ </packages>
+</coverage>
diff --git a/Tests/PythonCoverage/coveragetest/foo.py b/Tests/PythonCoverage/coveragetest/foo.py
new file mode 100644
index 0000000..97b5a41
--- /dev/null
+++ b/Tests/PythonCoverage/coveragetest/foo.py
@@ -0,0 +1,8 @@
+
+def foo():
+ x = 3 + 3
+ return x
+
+def bar():
+ y = 2 + 2
+ return y
diff --git a/Tests/PythonCoverage/coveragetest/test_foo.py b/Tests/PythonCoverage/coveragetest/test_foo.py
new file mode 100644
index 0000000..51a69d8
--- /dev/null
+++ b/Tests/PythonCoverage/coveragetest/test_foo.py
@@ -0,0 +1,11 @@
+
+import foo
+import unittest
+
+class TestFoo(unittest.TestCase):
+
+ def testFoo(self):
+ self.assertEquals(foo.foo(), 6, 'foo() == 6')
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/Tests/QtAutomoc/CMakeLists.txt b/Tests/QtAutomoc/CMakeLists.txt
index 69e52ac..8ad693a 100644
--- a/Tests/QtAutomoc/CMakeLists.txt
+++ b/Tests/QtAutomoc/CMakeLists.txt
@@ -41,7 +41,7 @@ add_library(codeeditorLib STATIC codeeditor.cpp)
add_library(privateSlot OBJECT private_slot.cpp)
add_executable(foo main.cpp calwidget.cpp foo.cpp blub.cpp bar.cpp abc.cpp
- xyz.cpp yaf.cpp $<TARGET_OBJECTS:privateSlot>)
+ xyz.cpp yaf.cpp gadget.cpp $<TARGET_OBJECTS:privateSlot>)
set_target_properties(foo codeeditorLib privateSlot PROPERTIES AUTOMOC TRUE)
diff --git a/Tests/QtAutomoc/gadget.cpp b/Tests/QtAutomoc/gadget.cpp
new file mode 100644
index 0000000..23d95fa
--- /dev/null
+++ b/Tests/QtAutomoc/gadget.cpp
@@ -0,0 +1,4 @@
+
+#include "gadget.h"
+
+#include "moc_gadget.cpp"
diff --git a/Tests/QtAutomoc/gadget.h b/Tests/QtAutomoc/gadget.h
new file mode 100644
index 0000000..7c688ee
--- /dev/null
+++ b/Tests/QtAutomoc/gadget.h
@@ -0,0 +1,18 @@
+
+#ifndef GADGET_H
+#define GADGET_H
+
+#include <QObject>
+
+class Gadget
+{
+ Q_GADGET
+ Q_ENUMS(Type)
+public:
+ enum Type {
+ Type0,
+ Type1
+ };
+};
+
+#endif
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index e45aba3..ee490b8 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -100,6 +100,7 @@ add_RunCMake_test(variable_watch)
add_RunCMake_test(CMP0004)
add_RunCMake_test(TargetPolicies)
add_RunCMake_test(alias_targets)
+add_RunCMake_test(interface_library)
find_package(Qt4 QUIET)
find_package(Qt5Core QUIET)
@@ -119,3 +120,4 @@ endif()
add_RunCMake_test(File_Generate)
add_RunCMake_test(ExportWithoutLanguage)
add_RunCMake_test(target_link_libraries)
+add_RunCMake_test(CheckModules)
diff --git a/Tests/RunCMake/CheckModules/CMakeLists.txt b/Tests/RunCMake/CheckModules/CMakeLists.txt
new file mode 100644
index 0000000..65ac8e8
--- /dev/null
+++ b/Tests/RunCMake/CheckModules/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8.11)
+project(${RunCMake_TEST})
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CheckModules/CheckStructHasMemberMissingKey-result.txt b/Tests/RunCMake/CheckModules/CheckStructHasMemberMissingKey-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CheckModules/CheckStructHasMemberMissingKey-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CheckModules/CheckStructHasMemberMissingKey-stderr.txt b/Tests/RunCMake/CheckModules/CheckStructHasMemberMissingKey-stderr.txt
new file mode 100644
index 0000000..1b8603a
--- /dev/null
+++ b/Tests/RunCMake/CheckModules/CheckStructHasMemberMissingKey-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at .*/Modules/CheckStructHasMember.cmake:[0-9]+. \(message\):
+ Unknown arguments:
+
+ C
+
+Call Stack \(most recent call first\):
+ CheckStructHasMemberMissingKey.cmake:[0-9]+ \(check_struct_has_member\)
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/CheckModules/CheckStructHasMemberMissingKey.cmake b/Tests/RunCMake/CheckModules/CheckStructHasMemberMissingKey.cmake
new file mode 100644
index 0000000..49f51ce
--- /dev/null
+++ b/Tests/RunCMake/CheckModules/CheckStructHasMemberMissingKey.cmake
@@ -0,0 +1,2 @@
+include(CheckStructHasMember)
+check_struct_has_member("struct timeval" tv_sec sys/select.h HAVE_TIMEVAL_TV_SEC_K C)
diff --git a/Tests/RunCMake/CheckModules/CheckStructHasMemberMissingLanguage-result.txt b/Tests/RunCMake/CheckModules/CheckStructHasMemberMissingLanguage-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CheckModules/CheckStructHasMemberMissingLanguage-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CheckModules/CheckStructHasMemberMissingLanguage-stderr.txt b/Tests/RunCMake/CheckModules/CheckStructHasMemberMissingLanguage-stderr.txt
new file mode 100644
index 0000000..8fceab0
--- /dev/null
+++ b/Tests/RunCMake/CheckModules/CheckStructHasMemberMissingLanguage-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at .*/Modules/CheckStructHasMember.cmake:[0-9]+. \(message\):
+ Unknown arguments:
+
+ LANGUAGE
+
+Call Stack \(most recent call first\):
+ CheckStructHasMemberMissingLanguage.cmake:[0-9]+ \(check_struct_has_member\)
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/CheckModules/CheckStructHasMemberMissingLanguage.cmake b/Tests/RunCMake/CheckModules/CheckStructHasMemberMissingLanguage.cmake
new file mode 100644
index 0000000..b404d66
--- /dev/null
+++ b/Tests/RunCMake/CheckModules/CheckStructHasMemberMissingLanguage.cmake
@@ -0,0 +1,2 @@
+include(CheckStructHasMember)
+check_struct_has_member("struct timeval" tv_sec sys/select.h HAVE_TIMEVAL_TV_SEC_K LANGUAGE)
diff --git a/Tests/RunCMake/CheckModules/CheckStructHasMemberOk.cmake b/Tests/RunCMake/CheckModules/CheckStructHasMemberOk.cmake
new file mode 100644
index 0000000..b319e18
--- /dev/null
+++ b/Tests/RunCMake/CheckModules/CheckStructHasMemberOk.cmake
@@ -0,0 +1,4 @@
+include(CheckStructHasMember)
+check_struct_has_member("struct timeval" tv_sec sys/select.h HAVE_TIMEVAL_TV_SEC)
+check_struct_has_member("struct timeval" tv_sec sys/select.h HAVE_TIMEVAL_TV_SEC_C LANGUAGE C)
+check_struct_has_member("struct timeval" tv_sec sys/select.h HAVE_TIMEVAL_TV_SEC_CXX LANGUAGE CXX)
diff --git a/Tests/RunCMake/CheckModules/CheckStructHasMemberTooManyArguments-result.txt b/Tests/RunCMake/CheckModules/CheckStructHasMemberTooManyArguments-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CheckModules/CheckStructHasMemberTooManyArguments-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CheckModules/CheckStructHasMemberTooManyArguments-stderr.txt b/Tests/RunCMake/CheckModules/CheckStructHasMemberTooManyArguments-stderr.txt
new file mode 100644
index 0000000..4598867
--- /dev/null
+++ b/Tests/RunCMake/CheckModules/CheckStructHasMemberTooManyArguments-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at .*/Modules/CheckStructHasMember.cmake:[0-9]+. \(message\):
+ Unknown arguments:
+
+ LANGUAGE;C;CXX
+
+Call Stack \(most recent call first\):
+ CheckStructHasMemberTooManyArguments.cmake:[0-9]+ \(check_struct_has_member\)
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/CheckModules/CheckStructHasMemberTooManyArguments.cmake b/Tests/RunCMake/CheckModules/CheckStructHasMemberTooManyArguments.cmake
new file mode 100644
index 0000000..12f8158
--- /dev/null
+++ b/Tests/RunCMake/CheckModules/CheckStructHasMemberTooManyArguments.cmake
@@ -0,0 +1,2 @@
+include(CheckStructHasMember)
+check_struct_has_member("struct timeval" tv_sec sys/select.h HAVE_TIMEVAL_TV_SEC_K LANGUAGE C CXX)
diff --git a/Tests/RunCMake/CheckModules/CheckStructHasMemberUnknownLanguage-result.txt b/Tests/RunCMake/CheckModules/CheckStructHasMemberUnknownLanguage-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CheckModules/CheckStructHasMemberUnknownLanguage-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CheckModules/CheckStructHasMemberUnknownLanguage-stderr.txt b/Tests/RunCMake/CheckModules/CheckStructHasMemberUnknownLanguage-stderr.txt
new file mode 100644
index 0000000..ba9e313
--- /dev/null
+++ b/Tests/RunCMake/CheckModules/CheckStructHasMemberUnknownLanguage-stderr.txt
@@ -0,0 +1,10 @@
+CMake Error at .*/Modules/CheckStructHasMember.cmake:[0-9]+. \(message\):
+ Unknown language:
+
+ FORTRAN
+
+ Supported languages: C, CXX.
+
+Call Stack \(most recent call first\):
+ CheckStructHasMemberUnknownLanguage.cmake:[0-9]+ \(check_struct_has_member\)
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/CheckModules/CheckStructHasMemberUnknownLanguage.cmake b/Tests/RunCMake/CheckModules/CheckStructHasMemberUnknownLanguage.cmake
new file mode 100644
index 0000000..183058d
--- /dev/null
+++ b/Tests/RunCMake/CheckModules/CheckStructHasMemberUnknownLanguage.cmake
@@ -0,0 +1,2 @@
+include(CheckStructHasMember)
+check_struct_has_member("struct timeval" tv_sec sys/select.h HAVE_TIMEVAL_TV_SEC_K LANGUAGE FORTRAN)
diff --git a/Tests/RunCMake/CheckModules/CheckStructHasMemberWrongKey-result.txt b/Tests/RunCMake/CheckModules/CheckStructHasMemberWrongKey-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CheckModules/CheckStructHasMemberWrongKey-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CheckModules/CheckStructHasMemberWrongKey-stderr.txt b/Tests/RunCMake/CheckModules/CheckStructHasMemberWrongKey-stderr.txt
new file mode 100644
index 0000000..b9fbd38
--- /dev/null
+++ b/Tests/RunCMake/CheckModules/CheckStructHasMemberWrongKey-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at .*/Modules/CheckStructHasMember.cmake:[0-9]+. \(message\):
+ Unknown arguments:
+
+ LANGUAG;C
+
+Call Stack \(most recent call first\):
+ CheckStructHasMemberWrongKey.cmake:[0-9]+ \(check_struct_has_member\)
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/CheckModules/CheckStructHasMemberWrongKey.cmake b/Tests/RunCMake/CheckModules/CheckStructHasMemberWrongKey.cmake
new file mode 100644
index 0000000..900eb0a
--- /dev/null
+++ b/Tests/RunCMake/CheckModules/CheckStructHasMemberWrongKey.cmake
@@ -0,0 +1,2 @@
+include(CheckStructHasMember)
+check_struct_has_member("struct timeval" tv_sec sys/select.h HAVE_TIMEVAL_TV_SEC_K LANGUAG C)
diff --git a/Tests/RunCMake/CheckModules/RunCMakeTest.cmake b/Tests/RunCMake/CheckModules/RunCMakeTest.cmake
new file mode 100644
index 0000000..6a6b36e
--- /dev/null
+++ b/Tests/RunCMake/CheckModules/RunCMakeTest.cmake
@@ -0,0 +1,8 @@
+include(RunCMake)
+
+run_cmake(CheckStructHasMemberOk)
+run_cmake(CheckStructHasMemberUnknownLanguage)
+run_cmake(CheckStructHasMemberMissingLanguage)
+run_cmake(CheckStructHasMemberMissingKey)
+run_cmake(CheckStructHasMemberTooManyArguments)
+run_cmake(CheckStructHasMemberWrongKey)
diff --git a/Tests/RunCMake/PositionIndependentCode/Conflict4-result.txt b/Tests/RunCMake/PositionIndependentCode/Conflict4-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/PositionIndependentCode/Conflict4-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/PositionIndependentCode/Conflict4-stderr.txt b/Tests/RunCMake/PositionIndependentCode/Conflict4-stderr.txt
new file mode 100644
index 0000000..76d5ea0
--- /dev/null
+++ b/Tests/RunCMake/PositionIndependentCode/Conflict4-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error: Property POSITION_INDEPENDENT_CODE on target "conflict" is
+implied to be FALSE because it was used to determine the link libraries
+already. The INTERFACE_POSITION_INDEPENDENT_CODE property on
+dependency "picon" is in conflict.
diff --git a/Tests/RunCMake/PositionIndependentCode/Conflict4.cmake b/Tests/RunCMake/PositionIndependentCode/Conflict4.cmake
new file mode 100644
index 0000000..ff5dfb3
--- /dev/null
+++ b/Tests/RunCMake/PositionIndependentCode/Conflict4.cmake
@@ -0,0 +1,8 @@
+
+add_library(piciface INTERFACE)
+
+add_library(picon INTERFACE)
+set_property(TARGET picon PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE ON)
+
+add_executable(conflict "main.cpp")
+target_link_libraries(conflict picon $<$<BOOL:$<TARGET_PROPERTY:POSITION_INDEPENDENT_CODE>>:piciface>)
diff --git a/Tests/RunCMake/PositionIndependentCode/Conflict5-result.txt b/Tests/RunCMake/PositionIndependentCode/Conflict5-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/PositionIndependentCode/Conflict5-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/PositionIndependentCode/Conflict5-stderr.txt b/Tests/RunCMake/PositionIndependentCode/Conflict5-stderr.txt
new file mode 100644
index 0000000..ecd0492
--- /dev/null
+++ b/Tests/RunCMake/PositionIndependentCode/Conflict5-stderr.txt
@@ -0,0 +1,3 @@
+CMake Error: The INTERFACE_POSITION_INDEPENDENT_CODE property of "picoff" does
+not agree with the value of POSITION_INDEPENDENT_CODE already determined
+for "conflict".
diff --git a/Tests/RunCMake/PositionIndependentCode/Conflict5.cmake b/Tests/RunCMake/PositionIndependentCode/Conflict5.cmake
new file mode 100644
index 0000000..e6055f4
--- /dev/null
+++ b/Tests/RunCMake/PositionIndependentCode/Conflict5.cmake
@@ -0,0 +1,9 @@
+
+add_library(picon INTERFACE)
+set_property(TARGET picon PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE ON)
+
+add_library(picoff INTERFACE)
+set_property(TARGET picoff PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE OFF)
+
+add_executable(conflict "main.cpp")
+target_link_libraries(conflict picon picoff)
diff --git a/Tests/RunCMake/PositionIndependentCode/Conflict6-result.txt b/Tests/RunCMake/PositionIndependentCode/Conflict6-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/PositionIndependentCode/Conflict6-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/PositionIndependentCode/Conflict6-stderr.txt b/Tests/RunCMake/PositionIndependentCode/Conflict6-stderr.txt
new file mode 100644
index 0000000..0254e55
--- /dev/null
+++ b/Tests/RunCMake/PositionIndependentCode/Conflict6-stderr.txt
@@ -0,0 +1,4 @@
+Property POSITION_INDEPENDENT_CODE on target "conflict" is
+implied to be FALSE because it was used to determine the link libraries
+already. The INTERFACE_POSITION_INDEPENDENT_CODE property on
+dependency "picon" is in conflict.
diff --git a/Tests/RunCMake/PositionIndependentCode/Conflict6.cmake b/Tests/RunCMake/PositionIndependentCode/Conflict6.cmake
new file mode 100644
index 0000000..7ea7c5f
--- /dev/null
+++ b/Tests/RunCMake/PositionIndependentCode/Conflict6.cmake
@@ -0,0 +1,8 @@
+
+add_library(picoff INTERFACE)
+
+add_library(picon INTERFACE)
+set_property(TARGET picon PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE ON)
+
+add_executable(conflict "main.cpp")
+target_link_libraries(conflict picon $<$<NOT:$<BOOL:$<TARGET_PROPERTY:POSITION_INDEPENDENT_CODE>>>:picoff>)
diff --git a/Tests/RunCMake/PositionIndependentCode/RunCMakeTest.cmake b/Tests/RunCMake/PositionIndependentCode/RunCMakeTest.cmake
index 64a340c..3a2009b 100644
--- a/Tests/RunCMake/PositionIndependentCode/RunCMakeTest.cmake
+++ b/Tests/RunCMake/PositionIndependentCode/RunCMakeTest.cmake
@@ -3,3 +3,6 @@ include(RunCMake)
run_cmake(Conflict1)
run_cmake(Conflict2)
run_cmake(Conflict3)
+run_cmake(Conflict4)
+run_cmake(Conflict5)
+run_cmake(Conflict6)
diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake
index 6e58d62..5c7c05c 100644
--- a/Tests/RunCMake/RunCMake.cmake
+++ b/Tests/RunCMake/RunCMake.cmake
@@ -55,6 +55,7 @@ function(run_cmake test)
set(msg "${msg}Result is [${actual_result}], not [${expect_result}].\n")
endif()
foreach(o out err)
+ string(REGEX REPLACE "(^|\n)(==[0-9]+==[^\n]*\n)+" "\\1" actual_std${o} "${actual_std${o}}")
string(REGEX REPLACE "\n+$" "" actual_std${o} "${actual_std${o}}")
set(expect_${o} "")
if(DEFINED expect_std${o})
diff --git a/Tests/RunCMake/include_directories/RunCMakeTest.cmake b/Tests/RunCMake/include_directories/RunCMakeTest.cmake
index f0704f4..f66823e 100644
--- a/Tests/RunCMake/include_directories/RunCMakeTest.cmake
+++ b/Tests/RunCMake/include_directories/RunCMakeTest.cmake
@@ -10,3 +10,4 @@ run_cmake(ImportedTarget)
run_cmake(RelativePathInGenex)
run_cmake(CMP0021)
run_cmake(install_config)
+run_cmake(incomplete-genex)
diff --git a/Tests/RunCMake/include_directories/incomplete-genex.cmake b/Tests/RunCMake/include_directories/incomplete-genex.cmake
new file mode 100644
index 0000000..b6900a4
--- /dev/null
+++ b/Tests/RunCMake/include_directories/incomplete-genex.cmake
@@ -0,0 +1,23 @@
+project(incomplete-genex)
+
+cmake_policy(SET CMP0022 NEW)
+cmake_policy(SET CMP0023 NEW)
+
+add_library(somelib empty.cpp)
+
+# This test ensures that some internal mechanisms of cmGeneratorExpression
+# do not segfault (#14410).
+
+# Test that cmGeneratorExpression::Preprocess(StripAllGeneratorExpressions)
+# does not segfault
+target_include_directories(somelib PUBLIC
+ "/include;/include/$<BUILD_INTERFACE:subdir"
+)
+
+# Test that cmGeneratorExpression::Preprocess(BuildInterface) does not segfault
+export(TARGETS somelib FILE somelibTargets.cmake)
+
+install(TARGETS somelib EXPORT someExport DESTINATION prefix)
+# Test that cmGeneratorExpression::Preprocess(InstallInterface)
+# and cmGeneratorExpression::Split do not segfault
+install(EXPORT someExport DESTINATION prefix)
diff --git a/Tests/RunCMake/interface_library/CMakeLists.txt b/Tests/RunCMake/interface_library/CMakeLists.txt
new file mode 100644
index 0000000..12cd3c7
--- /dev/null
+++ b/Tests/RunCMake/interface_library/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8.4)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/interface_library/RunCMakeTest.cmake b/Tests/RunCMake/interface_library/RunCMakeTest.cmake
new file mode 100644
index 0000000..56caf68
--- /dev/null
+++ b/Tests/RunCMake/interface_library/RunCMakeTest.cmake
@@ -0,0 +1,4 @@
+include(RunCMake)
+
+run_cmake(invalid_name)
+run_cmake(target_commands)
diff --git a/Tests/RunCMake/interface_library/invalid_name-result.txt b/Tests/RunCMake/interface_library/invalid_name-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/interface_library/invalid_name-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/interface_library/invalid_name-stderr.txt b/Tests/RunCMake/interface_library/invalid_name-stderr.txt
new file mode 100644
index 0000000..e14fcde
--- /dev/null
+++ b/Tests/RunCMake/interface_library/invalid_name-stderr.txt
@@ -0,0 +1,15 @@
+CMake Error at invalid_name.cmake:2 \(add_library\):
+ add_library Invalid name for INTERFACE library target: if\$ace
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error at invalid_name.cmake:4 \(add_library\):
+ add_library Invalid name for INTERFACE library target: iface::target
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error at invalid_name.cmake:6 \(add_library\):
+ add_library Invalid name for IMPORTED INTERFACE library target:
+ if\$target_imported
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/interface_library/invalid_name.cmake b/Tests/RunCMake/interface_library/invalid_name.cmake
new file mode 100644
index 0000000..9a965aa
--- /dev/null
+++ b/Tests/RunCMake/interface_library/invalid_name.cmake
@@ -0,0 +1,6 @@
+
+add_library(if$ace INTERFACE)
+
+add_library(iface::target INTERFACE)
+
+add_library(if$target_imported INTERFACE IMPORTED)
diff --git a/Tests/RunCMake/interface_library/target_commands-result.txt b/Tests/RunCMake/interface_library/target_commands-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/interface_library/target_commands-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/interface_library/target_commands-stderr.txt b/Tests/RunCMake/interface_library/target_commands-stderr.txt
new file mode 100644
index 0000000..be11b77
--- /dev/null
+++ b/Tests/RunCMake/interface_library/target_commands-stderr.txt
@@ -0,0 +1,47 @@
+CMake Error at target_commands.cmake:4 \(target_link_libraries\):
+ INTERFACE library can only be used with the INTERFACE keyword of
+ target_link_libraries
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error at target_commands.cmake:5 \(target_link_libraries\):
+ INTERFACE library can only be used with the INTERFACE keyword of
+ target_link_libraries
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error at target_commands.cmake:6 \(target_link_libraries\):
+ INTERFACE library can only be used with the INTERFACE keyword of
+ target_link_libraries
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error at target_commands.cmake:7 \(target_link_libraries\):
+ INTERFACE library can only be used with the INTERFACE keyword of
+ target_link_libraries
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error at target_commands.cmake:9 \(target_include_directories\):
+ target_include_directories may only be set INTERFACE properties on
+ INTERFACE targets
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error at target_commands.cmake:10 \(target_include_directories\):
+ target_include_directories may only be set INTERFACE properties on
+ INTERFACE targets
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error at target_commands.cmake:12 \(target_compile_definitions\):
+ target_compile_definitions may only be set INTERFACE properties on
+ INTERFACE targets
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
++
+CMake Error at target_commands.cmake:13 \(target_compile_definitions\):
+ target_compile_definitions may only be set INTERFACE properties on
+ INTERFACE targets
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/interface_library/target_commands.cmake b/Tests/RunCMake/interface_library/target_commands.cmake
new file mode 100644
index 0000000..3182e89
--- /dev/null
+++ b/Tests/RunCMake/interface_library/target_commands.cmake
@@ -0,0 +1,13 @@
+
+add_library(iface INTERFACE)
+
+target_link_libraries(iface PRIVATE foo)
+target_link_libraries(iface PUBLIC foo)
+target_link_libraries(iface foo)
+target_link_libraries(iface LINK_INTERFACE_LIBRARIES foo)
+
+target_include_directories(iface PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}")
+target_include_directories(iface PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
+
+target_compile_definitions(iface PRIVATE SOME_DEFINE)
+target_compile_definitions(iface PUBLIC SOME_DEFINE)
diff --git a/Utilities/cmbzip2/compress.c b/Utilities/cmbzip2/compress.c
index 7d9b3da..feea233 100644
--- a/Utilities/cmbzip2/compress.c
+++ b/Utilities/cmbzip2/compress.c
@@ -239,7 +239,7 @@ static
void sendMTFValues ( EState* s )
{
Int32 v, t, i, j, gs, ge, totc, bt, bc, iter;
- Int32 nSelectors, alphaSize, minLen, maxLen, selCtr;
+ Int32 nSelectors = 0, alphaSize, minLen, maxLen, selCtr;
Int32 nGroups, nBytes;
/*--
diff --git a/Utilities/cmcurl/multi.c b/Utilities/cmcurl/multi.c
index b501f29..869d568 100644
--- a/Utilities/cmcurl/multi.c
+++ b/Utilities/cmcurl/multi.c
@@ -763,7 +763,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
struct Curl_message *msg = NULL;
bool connected;
bool async;
- bool protocol_connect;
+ bool protocol_connect = 0;
bool dophase_done;
bool done;
CURLMcode result = CURLM_OK;
diff --git a/Utilities/cmcurl/parsedate.h b/Utilities/cmcurl/parsedate.h
index 0ea2d83..b29fe9b 100644
--- a/Utilities/cmcurl/parsedate.h
+++ b/Utilities/cmcurl/parsedate.h
@@ -1,5 +1,5 @@
#ifndef __PARSEDATE_H
-#define __PARSEDATEL_H
+#define __PARSEDATE_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
diff --git a/bootstrap b/bootstrap
index 9784d5d..88e2732 100755
--- a/bootstrap
+++ b/bootstrap
@@ -197,6 +197,7 @@ CMAKE_CXX_SOURCES="\
cmake \
cmakemain \
cmakewizard \
+ cmcmd \
cmCommandArgumentLexer \
cmCommandArgumentParser \
cmCommandArgumentParserHelper \