From 328faf3cf375832966fc0fcea702b780218676f0 Mon Sep 17 00:00:00 2001 From: Modestas Vainius Date: Wed, 23 Jun 2010 01:18:35 +0300 Subject: [PATCH] Import cmake 2.8.2-rc3. --- CMakeCPack.cmake | 24 +- CMakeLists.txt | 110 +- CTestConfig.cmake | 2 +- CTestCustom.cmake.in | 14 +- ChangeLog.manual | 130 + Modules/CMakeASMInformation.cmake | 35 + Modules/CMakeCCompilerId.c.in | 3 + Modules/CMakeCXXCompilerId.cpp.in | 3 + Modules/CMakeCompilerABI.h | 10 + Modules/CMakeDetermineCompilerABI.cmake | 2 - Modules/CMakeDetermineCompilerId.cmake | 1 + Modules/CMakeDetermineFortranCompiler.cmake | 7 +- Modules/CMakeFortranCompiler.cmake.in | 4 +- Modules/CMakePrintSystemInformation.cmake | 2 +- Modules/CMakeTestCCompiler.cmake | 1 + Modules/CMakeTestCXXCompiler.cmake | 1 + Modules/CMakeTestFortranCompiler.cmake | 1 + Modules/CMakeVS10FindMake.cmake | 32 +- Modules/CMakeVS8FindMake.cmake | 3 - Modules/CMakeVS9FindMake.cmake | 4 - Modules/CPackRPM.cmake | 32 + Modules/Compiler/Clang-C.cmake | 1 + Modules/Compiler/Clang-CXX.cmake | 1 + Modules/Compiler/SunPro-C.cmake | 4 +- Modules/Compiler/SunPro-CXX.cmake | 4 +- Modules/Compiler/SunPro-Fortran.cmake | 3 +- Modules/Compiler/XL-Fortran.cmake | 1 + Modules/DartConfiguration.tcl.in | 8 + Modules/ExternalProject.cmake | 284 +- Modules/FindASPELL.cmake | 6 - Modules/FindAVIFile.cmake | 20 +- Modules/FindBZip2.cmake | 5 - Modules/FindCUDA.cmake | 4 + Modules/FindCurses.cmake | 9 + Modules/FindDCMTK.cmake | 266 +- Modules/FindDart.cmake | 7 + Modules/FindEXPAT.cmake | 3 - Modules/FindGCCXML.cmake | 5 + Modules/FindGLU.cmake | 4 +- Modules/FindGit.cmake | 46 + Modules/FindHSPELL.cmake | 29 +- Modules/FindJasper.cmake | 11 +- Modules/FindJava.cmake | 57 +- Modules/FindKDE4.cmake | 2 +- Modules/FindLibXml2.cmake | 5 +- Modules/FindLibXslt.cmake | 7 +- Modules/FindMPEG.cmake | 4 +- Modules/FindOpenAL.cmake | 9 +- Modules/FindPNG.cmake | 2 +- Modules/FindPhysFS.cmake | 8 +- Modules/FindPkgConfig.cmake | 27 +- Modules/FindPythonLibs.cmake | 38 +- Modules/FindQt4.cmake | 30 +- Modules/FindQuickTime.cmake | 10 +- Modules/FindSubversion.cmake | 13 +- Modules/FindThreads.cmake | 6 +- Modules/FindX11.cmake | 10 + Modules/FindZLIB.cmake | 43 +- Modules/FindwxWidgets.cmake | 19 +- Modules/GetPrerequisites.cmake | 11 + Modules/Platform/CYGWIN-GNU.cmake | 1 + Modules/Platform/Generic.cmake | 6 + Modules/Platform/Linux-Clang-C.cmake | 1 + Modules/Platform/Linux-Clang-CXX.cmake | 1 + Modules/Platform/Linux-SunPro-CXX.cmake | 9 +- Modules/Platform/OSF1.cmake | 1 + Modules/Platform/OpenBSD.cmake | 16 + Modules/Platform/Windows-G95-Fortran.cmake | 1 + Modules/Platform/Windows-GNU-Fortran.cmake | 1 + Modules/Platform/Windows-GNU.cmake | 2 + Modules/Platform/Windows-cl.cmake | 27 +- Modules/Platform/Windows-cl.cmake.in | 1 + Modules/Platform/Windows-wcl386.cmake | 6 +- Modules/Qt4ConfigDependentSettings.cmake | 111 +- Modules/UseQt4.cmake | 3 +- Modules/readme.txt | 24 +- Source/CMakeLists.txt | 8 +- Source/CMakeVersionSource.cmake | 37 + Source/CPack/cmCPackArchiveGenerator.cxx | 265 + Source/CPack/cmCPackArchiveGenerator.h | 47 + Source/CPack/cmCPackCygwinBinaryGenerator.cxx | 14 +- Source/CPack/cmCPackCygwinSourceGenerator.cxx | 92 +- Source/CPack/cmCPackGenerator.cxx | 4 +- Source/CPack/cmCPackTGZGenerator.cxx | 272 +- Source/CPack/cmCPackTGZGenerator.h | 18 +- Source/CPack/cmCPackTarBZip2Generator.cxx | 156 +- Source/CPack/cmCPackTarBZip2Generator.h | 14 +- Source/CPack/cmCPackTarCompressGenerator.cxx | 231 +- Source/CPack/cmCPackTarCompressGenerator.h | 12 +- Source/CPack/cmCPackZIPGenerator.cxx | 76 +- Source/CPack/cmCPackZIPGenerator.h | 14 +- Source/CTest/cmCTestBZR.cxx | 2 +- Source/CTest/cmCTestBuildCommand.h | 8 +- Source/CTest/cmCTestBuildHandler.cxx | 1 + Source/CTest/cmCTestCoverageHandler.cxx | 132 +- Source/CTest/cmCTestCoverageHandler.h | 63 +- Source/CTest/cmCTestGIT.cxx | 96 +- Source/CTest/cmCTestGIT.h | 5 + Source/CTest/cmCTestHG.cxx | 2 +- Source/CTest/cmCTestMultiProcessHandler.cxx | 206 +- Source/CTest/cmCTestMultiProcessHandler.h | 16 +- Source/CTest/cmCTestRunTest.cxx | 121 +- Source/CTest/cmCTestRunTest.h | 14 +- Source/CTest/cmCTestTestCommand.cxx | 5 + Source/CTest/cmCTestTestCommand.h | 7 +- Source/CTest/cmCTestTestHandler.cxx | 18 +- Source/CTest/cmCTestTestHandler.h | 2 + Source/CTest/cmCTestUpdateCommand.cxx | 2 + Source/CTest/cmCTestUpdateHandler.cxx | 1 + Source/CTest/cmCTestVC.cxx | 1 + Source/CTest/cmCTestVC.h | 1 + Source/CTest/cmParsePHPCoverage.cxx | 252 + Source/CTest/cmParsePHPCoverage.h | 48 + Source/QtDialog/CMakeSetup.cxx | 19 +- Source/QtDialog/CMakeSetupDialog.cxx | 42 +- Source/QtDialog/CMakeSetupDialog.h | 3 +- Source/QtDialog/CMakeSetupDialog.ui | 240 +- Source/cmCMakeMinimumRequired.cxx | 19 +- Source/cmCMakeMinimumRequired.h | 4 +- Source/cmCMakePolicyCommand.h | 2 +- Source/cmCTest.cxx | 67 + Source/cmCTest.h | 11 + Source/cmComputeLinkInformation.cxx | 15 +- Source/cmComputeLinkInformation.h | 3 + Source/cmData.h | 38 - Source/cmDocumentVariables.cxx | 22 +- Source/cmDocumentation.cxx | 43 +- Source/cmDocumentationFormatterHTML.cxx | 66 +- Source/cmDocumentationFormatterText.cxx | 2 +- Source/cmELF.cxx | 2 +- Source/cmExtraCodeBlocksGenerator.cxx | 4 +- Source/cmExtraEclipseCDT4Generator.cxx | 1 - Source/cmFileCommand.cxx | 339 +- Source/cmFileCommand.h | 10 +- Source/cmFindCommon.cxx | 14 + Source/cmFindCommon.h | 2 + Source/cmGetFilenameComponentCommand.h | 12 +- Source/cmGlobalVisualStudio71Generator.cxx | 1 + Source/cmGlobalVisualStudio8Generator.cxx | 2 - Source/cmGlobalXCodeGenerator.cxx | 12 +- Source/cmIncludeExternalMSProjectCommand.h | 5 +- Source/cmLocalGenerator.cxx | 20 +- Source/cmLocalGenerator.h | 4 +- Source/cmLocalUnixMakefileGenerator3.cxx | 22 + Source/cmLocalVisualStudio6Generator.cxx | 122 +- Source/cmLocalVisualStudio7Generator.cxx | 33 +- Source/cmLocalVisualStudioGenerator.cxx | 12 +- Source/cmMakefile.cxx | 65 +- Source/cmMakefile.h | 8 - .../cmMakefileExecutableTargetGenerator.cxx | 2 - Source/cmMakefileLibraryTargetGenerator.cxx | 6 +- Source/cmMakefileTargetGenerator.cxx | 39 +- Source/cmPolicies.cxx | 79 +- Source/cmPolicies.h | 1 + Source/cmSetPropertyCommand.h | 4 +- Source/cmSetSourceFilesPropertiesCommand.h | 36 +- Source/cmSourceFile.cxx | 6 +- Source/cmStandardIncludes.cxx | 16 + Source/cmStandardIncludes.h | 4 +- Source/cmSystemTools.cxx | 626 +- Source/cmSystemTools.h | 9 +- Source/cmTarget.cxx | 7 +- Source/cmTest.cxx | 6 + Source/cmVersion.cxx | 3 +- Source/cmVersion.h | 1 + Source/cmVersionConfig.h.in | 3 +- Source/cmVersionMacros.h | 19 +- Source/cmVisualStudio10TargetGenerator.cxx | 86 +- Source/cmVisualStudio10TargetGenerator.h | 4 + Source/cmWin32ProcessExecution.cxx | 10 +- Source/cmWriteFileCommand.cxx | 21 +- Source/cmake.cxx | 39 +- Source/ctest.cxx | 4 + Source/kwsys/CMakeLists.txt | 8 + Source/kwsys/Configure.h.in | 4 + Source/kwsys/DynamicLoader.cxx | 86 +- Source/kwsys/DynamicLoader.hxx.in | 8 +- Source/kwsys/ProcessUNIX.c | 14 +- Source/kwsys/ProcessWin32.c | 8 + Source/kwsys/SharedForward.h.in | 6 + Source/kwsys/SystemInformation.cxx | 12 +- Source/kwsys/SystemTools.cxx | 129 +- Source/kwsys/SystemTools.hxx.in | 23 +- Source/kwsys/hashtable.hxx.in | 16 +- Source/kwsys/kwsysDateStamp.cmake | 6 +- Source/kwsys/testAutoPtr.cxx | 2 +- Templates/staticLibHeader.dsptemplate | 8 +- Tests/CMakeLists.txt | 152 +- Tests/CMakeTests/CMakeLists.txt | 10 +- Tests/CMakeTests/CheckSourceTreeTest.cmake.in | 276 +- Tests/CMakeTests/FileDownloadInput.png | Bin 0 -> 358 bytes Tests/CMakeTests/FileDownloadTest.cmake.in | 41 + Tests/CTestSubmitLargeOutput/CMakeLists.txt | 8 + .../CTestSubmitLargeOutput/CTestConfig.cmake | 6 + .../GenerateRandomOutput.cmake | 31 + Tests/CTestSubmitLargeOutput/test.cmake.in | 27 + Tests/CTestTest2/test.cmake.in | 14 +- Tests/CTestTest3/test.cmake.in | 13 + Tests/CTestTestResourceLock/CMakeLists.txt | 13 + Tests/CTestTestResourceLock/CTestConfig.cmake | 7 + Tests/CTestTestResourceLock/lockFile.c | 31 + Tests/CTestTestResourceLock/test.cmake.in | 22 + Tests/CTestTestScheduler/CMakeLists.txt | 4 +- Tests/CTestTestScheduler/sleep.c | 4 +- Tests/CTestTestStopTime/CMakeLists.txt | 11 + Tests/CTestTestStopTime/CTestConfig.cmake | 7 + Tests/CTestTestStopTime/GetDate.cmake | 233 + Tests/CTestTestStopTime/sleep.c | 21 + Tests/CTestTestStopTime/test.cmake.in | 34 + Tests/CTestUpdateBZR.cmake.in | 11 +- Tests/CTestUpdateCVS.cmake.in | 4 +- Tests/CTestUpdateCommon.cmake | 22 +- Tests/CTestUpdateGIT.cmake.in | 120 +- Tests/CTestUpdateGIT.sh.in | 2 +- Tests/CTestUpdateHG.cmake.in | 4 +- Tests/CTestUpdateSVN.cmake.in | 4 +- .../CMakeLists.txt | 85 + Tests/Complex/Executable/CMakeLists.txt | 7 +- .../Executable/CMakeLists.txt | 7 +- .../Executable/CMakeLists.txt | 7 +- Tests/ExternalProject/CMakeLists.txt | 150 +- Tests/ExternalProject/Example/CMakeLists.txt | 11 + Tests/ExternalProject/Step1.tar.bz2 | Bin 0 -> 904 bytes Tests/ExternalProject/Step1.zip | Bin 0 -> 1074 bytes Tests/ExternalProject/Step1NoDir.tar.bz2 | Bin 0 -> 852 bytes Tests/ExternalProject/Step1NoDir.zip | Bin 0 -> 1038 bytes Tests/ExternalProject/gitrepo.tgz | Bin 0 -> 1934 bytes Tests/FindPackageTest/CMakeLists.txt | 3 +- Tests/LinkFlags/CMakeLists.txt | 28 + Tests/LinkFlags/LinkFlags.c | 1 + Tests/LinkFlags/LinkFlagsExe.c | 6 + Tests/LinkFlags/LinkFlagsLib.c | 6 + Tests/bootstrap.bat.in | 2 + Utilities/CMakeLists.txt | 78 +- Utilities/Release/create-cmake-release.cmake | 4 +- Utilities/Release/dash2win64_cygwin.cmake | 17 + Utilities/Release/dash2win64_release.cmake | 6 +- Utilities/Release/dashmacmini2_release.cmake | 3 + Utilities/Release/destiny_release.cmake | 1 - Utilities/Release/magrathea_release.cmake | 2 +- Utilities/Release/release_cmake.cmake | 14 +- Utilities/Release/release_cmake.sh.in | 32 +- Utilities/Release/upload_release.cmake | 7 +- Utilities/Release/v20n17_aix_release.cmake | 1 - Utilities/Release/v20n250_aix_release.cmake | 22 + Utilities/cmbzip2/CHANGES | 319 + Utilities/cmbzip2/CMakeLists.txt | 4 + Utilities/cmbzip2/LICENSE | 42 + Utilities/cmbzip2/Makefile-libbz2_so | 59 + Utilities/cmbzip2/README | 210 + Utilities/cmbzip2/README.COMPILATION.PROBLEMS | 58 + Utilities/cmbzip2/README.XML.STUFF | 45 + Utilities/cmbzip2/blocksort.c | 1094 + Utilities/cmbzip2/bz-common.xsl | 39 + Utilities/cmbzip2/bz-fo.xsl | 276 + Utilities/cmbzip2/bz-html.xsl | 20 + Utilities/cmbzip2/bzdiff | 76 + Utilities/cmbzip2/bzdiff.1 | 47 + Utilities/cmbzip2/bzgrep | 75 + Utilities/cmbzip2/bzgrep.1 | 56 + Utilities/cmbzip2/bzip.css | 74 + Utilities/cmbzip2/bzip2.1 | 454 + Utilities/cmbzip2/bzip2.1.preformatted | 399 + Utilities/cmbzip2/bzip2.c | 2034 + Utilities/cmbzip2/bzip2.txt | 391 + Utilities/cmbzip2/bzip2recover.c | 514 + Utilities/cmbzip2/bzlib.c | 1575 + Utilities/cmbzip2/bzlib.h | 282 + Utilities/cmbzip2/bzlib_private.h | 523 + Utilities/cmbzip2/bzmore | 61 + Utilities/cmbzip2/bzmore.1 | 152 + Utilities/cmbzip2/compress.c | 672 + Utilities/cmbzip2/crctable.c | 104 + Utilities/cmbzip2/decompress.c | 626 + Utilities/cmbzip2/dlltest.c | 175 + Utilities/cmbzip2/dlltest.dsp | 93 + Utilities/cmbzip2/entities.xml | 9 + Utilities/cmbzip2/format.pl | 68 + Utilities/cmbzip2/huffman.c | 205 + Utilities/cmbzip2/libbz2.def | 27 + Utilities/cmbzip2/libbz2.dsp | 130 + Utilities/cmbzip2/libbz2.lib | Bin 0 -> 60774 bytes Utilities/cmbzip2/makefile.msc | 63 + Utilities/cmbzip2/manual.html | 2540 + Utilities/cmbzip2/manual.pdf | Bin 0 -> 289422 bytes Utilities/cmbzip2/manual.ps | 82900 ++++++++++++++++ Utilities/cmbzip2/manual.xml | 2964 + Utilities/cmbzip2/mk251.c | 31 + Utilities/cmbzip2/randtable.c | 84 + Utilities/cmbzip2/sample1.bz2 | Bin 0 -> 32558 bytes Utilities/cmbzip2/sample1.rb2 | Bin 0 -> 32558 bytes Utilities/cmbzip2/sample1.ref | Bin 0 -> 98869 bytes Utilities/cmbzip2/sample1.tst | Bin 0 -> 98869 bytes Utilities/cmbzip2/sample2.bz2 | Bin 0 -> 74143 bytes Utilities/cmbzip2/sample2.rb2 | Bin 0 -> 74143 bytes Utilities/cmbzip2/sample2.ref | Bin 0 -> 212610 bytes Utilities/cmbzip2/sample2.tst | Bin 0 -> 212610 bytes Utilities/cmbzip2/sample3.bz2 | Bin 0 -> 238 bytes Utilities/cmbzip2/sample3.rb2 | Bin 0 -> 237 bytes Utilities/cmbzip2/sample3.ref | 30007 ++++++ Utilities/cmbzip2/sample3.tst | 30007 ++++++ Utilities/cmbzip2/spewG.c | 54 + Utilities/cmbzip2/unzcrash.c | 141 + Utilities/cmbzip2/words0 | 9 + Utilities/cmbzip2/words1 | 4 + Utilities/cmbzip2/words2 | 5 + Utilities/cmbzip2/words3 | 30 + Utilities/cmbzip2/xmlproc.sh | 114 + Utilities/cmcurl/CMakeLists.txt | 6 +- Utilities/cmcurl/Testing/curltest.c | 29 +- Utilities/cmlibarchive/CMakeLists.txt | 724 + Utilities/cmlibarchive/COPYING | 60 + Utilities/cmlibarchive/INSTALL | 30 + Utilities/cmlibarchive/Makefile.am | 595 + Utilities/cmlibarchive/NEWS | 499 + Utilities/cmlibarchive/README | 137 + .../build/autoconf/check_stdcall_func.m4 | 51 + .../cmlibarchive/build/autoconf/la_uid_t.m4 | 20 + Utilities/cmlibarchive/build/autogen.sh | 25 + .../build/cmake/CheckFileOffsetBits.c | 14 + .../build/cmake/CheckFileOffsetBits.cmake | 43 + .../cmlibarchive/build/cmake/CheckFuncs.cmake | 47 + .../build/cmake/CheckFuncs_stub.c.in | 16 + .../build/cmake/CheckHeaderDirent.cmake | 32 + .../build/cmake/CheckStructMember.cmake | 43 + .../build/cmake/CheckTypeExists.cmake | 42 + .../cmlibarchive/build/cmake/FindLZMA.cmake | 52 + .../cmlibarchive/build/cmake/config.h.in | 696 + Utilities/cmlibarchive/build/release.sh | 63 + Utilities/cmlibarchive/build/version | 1 + Utilities/cmlibarchive/build/windows/mvcpp.nt | 117 + .../build/windows/vc71/libarchive.sln | 23 + .../build/windows/vc71/libarchive.vcproj | 327 + .../build/windows/vc80/libarchive.sln | 25 + .../build/windows/vc80/libarchive.vcproj | 455 + .../libarchive_test/libarchive_test.vcproj | 495 + .../build/windows/vc90/libarchive.sln | 25 + .../build/windows/vc90/libarchive.vcproj | 456 + .../libarchive_test/libarchive_test.vcproj | 494 + Utilities/cmlibarchive/build/windows/wccpp.nt | 107 + Utilities/cmlibarchive/configure.ac | 448 + Utilities/cmlibarchive/contrib/README | 32 + .../contrib/libarchive.1aix53.spec | 160 + .../cmlibarchive/contrib/libarchive.spec | 147 + .../libarchive_autodetect-st_lib_archive.m4 | 154 + .../contrib/psota-benchmark/results.txt | 122 + .../contrib/psota-benchmark/tcp.sh | 104 + Utilities/cmlibarchive/contrib/shar/shar.1 | 128 + Utilities/cmlibarchive/contrib/shar/shar.c | 314 + Utilities/cmlibarchive/contrib/shar/tree.c | 542 + Utilities/cmlibarchive/contrib/shar/tree.h | 115 + .../cmlibarchive/contrib/shar/tree_config.h | 78 + Utilities/cmlibarchive/contrib/untar.c | 225 + Utilities/cmlibarchive/cpio/CMakeLists.txt | 54 + Utilities/cmlibarchive/cpio/bsdcpio.1 | 405 + Utilities/cmlibarchive/cpio/cmdline.c | 369 + Utilities/cmlibarchive/cpio/config_freebsd.h | 54 + Utilities/cmlibarchive/cpio/cpio.c | 1233 + Utilities/cmlibarchive/cpio/cpio.h | 109 + Utilities/cmlibarchive/cpio/cpio_platform.h | 95 + Utilities/cmlibarchive/cpio/cpio_windows.c | 336 + Utilities/cmlibarchive/cpio/cpio_windows.h | 72 + .../cmlibarchive/cpio/test/CMakeLists.txt | 75 + Utilities/cmlibarchive/cpio/test/main.c | 2059 + Utilities/cmlibarchive/cpio/test/test.h | 277 + Utilities/cmlibarchive/cpio/test/test_0.c | 67 + Utilities/cmlibarchive/cpio/test/test_basic.c | 173 + .../cmlibarchive/cpio/test/test_cmdline.c | 107 + .../cmlibarchive/cpio/test/test_format_newc.c | 294 + .../cpio/test/test_gcpio_compat.c | 108 + .../cpio/test/test_gcpio_compat_ref.bin.uu | 16 + .../cpio/test/test_gcpio_compat_ref.crc.uu | 27 + .../cpio/test/test_gcpio_compat_ref.newc.uu | 27 + .../cpio/test/test_gcpio_compat_ref.ustar.uu | 84 + .../test/test_gcpio_compat_ref_nosym.bin.uu | 15 + .../test/test_gcpio_compat_ref_nosym.crc.uu | 15 + .../test/test_gcpio_compat_ref_nosym.newc.uu | 15 + .../test/test_gcpio_compat_ref_nosym.ustar.uu | 72 + .../cpio/test/test_option_B_upper.c | 52 + .../cpio/test/test_option_C_upper.c | 62 + .../cpio/test/test_option_J_upper.c | 56 + .../cpio/test/test_option_L_upper.c | 96 + .../cpio/test/test_option_Z_upper.c | 56 + .../cmlibarchive/cpio/test/test_option_a.c | 154 + .../cmlibarchive/cpio/test/test_option_c.c | 221 + .../cmlibarchive/cpio/test/test_option_d.c | 64 + .../cmlibarchive/cpio/test/test_option_f.c | 76 + .../cpio/test/test_option_f.cpio.uu | 16 + .../cmlibarchive/cpio/test/test_option_help.c | 81 + .../cmlibarchive/cpio/test/test_option_l.c | 50 + .../cmlibarchive/cpio/test/test_option_lzma.c | 56 + .../cmlibarchive/cpio/test/test_option_m.c | 63 + .../cpio/test/test_option_m.cpio.uu | 16 + .../cmlibarchive/cpio/test/test_option_t.c | 95 + .../cpio/test/test_option_t.cpio.uu | 16 + .../cpio/test/test_option_t.stdout.uu | 5 + .../cpio/test/test_option_tv.stdout.uu | 6 + .../cmlibarchive/cpio/test/test_option_u.c | 81 + .../cpio/test/test_option_version.c | 109 + .../cmlibarchive/cpio/test/test_option_y.c | 57 + .../cmlibarchive/cpio/test/test_option_z.c | 56 + .../cmlibarchive/cpio/test/test_owner_parse.c | 121 + .../cpio/test/test_passthrough_dotdot.c | 76 + .../cpio/test/test_passthrough_reverse.c | 85 + .../cmlibarchive/cpio/test/test_pathmatch.c | 243 + Utilities/cmlibarchive/doc/mdoc2man.awk | 391 + Utilities/cmlibarchive/doc/mdoc2wiki.awk | 448 + Utilities/cmlibarchive/doc/update.sh | 112 + .../cmlibarchive/examples/minitar/README | 12 + .../cmlibarchive/examples/minitar/minitar.c | 421 + Utilities/cmlibarchive/examples/minitar/notes | 50 + .../cmlibarchive/examples/minitar/tree.c | 423 + .../cmlibarchive/examples/minitar/tree.h | 78 + Utilities/cmlibarchive/examples/tarfilter.c | 113 + Utilities/cmlibarchive/examples/untar.c | 262 + .../cmlibarchive/libarchive/CMakeLists.txt | 146 + Utilities/cmlibarchive/libarchive/archive.h | 735 + .../libarchive/archive_check_magic.c | 135 + .../cmlibarchive/libarchive/archive_crc32.h | 64 + .../cmlibarchive/libarchive/archive_endian.h | 163 + .../cmlibarchive/libarchive/archive_entry.3 | 433 + .../cmlibarchive/libarchive/archive_entry.c | 2117 + .../cmlibarchive/libarchive/archive_entry.h | 522 + .../libarchive/archive_entry_copy_bhfi.c | 76 + .../libarchive/archive_entry_copy_stat.c | 77 + .../libarchive/archive_entry_link_resolver.c | 403 + .../libarchive/archive_entry_private.h | 184 + .../libarchive/archive_entry_stat.c | 118 + .../libarchive/archive_entry_strmode.c | 87 + .../libarchive/archive_entry_xattr.c | 165 + .../cmlibarchive/libarchive/archive_haiku.h | 43 + .../cmlibarchive/libarchive/archive_hash.h | 164 + .../libarchive/archive_platform.h | 171 + .../cmlibarchive/libarchive/archive_private.h | 133 + .../cmlibarchive/libarchive/archive_read.3 | 714 + .../cmlibarchive/libarchive/archive_read.c | 1241 + .../libarchive/archive_read_data_into_fd.c | 93 + .../libarchive/archive_read_disk.3 | 308 + .../libarchive/archive_read_disk.c | 198 + .../archive_read_disk_entry_from_file.c | 554 + .../libarchive/archive_read_disk_private.h | 62 + .../archive_read_disk_set_standard_lookup.c | 276 + .../libarchive/archive_read_extract.c | 182 + .../libarchive/archive_read_open_fd.c | 188 + .../libarchive/archive_read_open_file.c | 167 + .../libarchive/archive_read_open_filename.c | 270 + .../libarchive/archive_read_open_memory.c | 156 + .../libarchive/archive_read_private.h | 199 + .../archive_read_support_compression_all.c | 56 + .../archive_read_support_compression_bzip2.c | 354 + ...rchive_read_support_compression_compress.c | 444 + .../archive_read_support_compression_gzip.c | 463 + .../archive_read_support_compression_none.c | 40 + ...archive_read_support_compression_program.c | 457 + .../archive_read_support_compression_xz.c | 644 + .../archive_read_support_format_all.c | 42 + .../archive_read_support_format_ar.c | 587 + .../archive_read_support_format_cpio.c | 774 + .../archive_read_support_format_empty.c | 93 + .../archive_read_support_format_iso9660.c | 2076 + .../archive_read_support_format_mtree.c | 1309 + .../archive_read_support_format_raw.c | 186 + .../archive_read_support_format_tar.c | 2422 + .../archive_read_support_format_zip.c | 903 + .../cmlibarchive/libarchive/archive_string.c | 458 + .../cmlibarchive/libarchive/archive_string.h | 148 + .../libarchive/archive_string_sprintf.c | 164 + .../cmlibarchive/libarchive/archive_util.3 | 160 + .../cmlibarchive/libarchive/archive_util.c | 389 + .../cmlibarchive/libarchive/archive_virtual.c | 94 + .../cmlibarchive/libarchive/archive_windows.c | 1253 + .../cmlibarchive/libarchive/archive_windows.h | 427 + .../cmlibarchive/libarchive/archive_write.3 | 626 + .../cmlibarchive/libarchive/archive_write.c | 467 + .../libarchive/archive_write_disk.3 | 375 + .../libarchive/archive_write_disk.c | 2600 + .../libarchive/archive_write_disk_private.h | 38 + .../archive_write_disk_set_standard_lookup.c | 247 + .../libarchive/archive_write_open_fd.c | 143 + .../libarchive/archive_write_open_file.c | 105 + .../libarchive/archive_write_open_filename.c | 162 + .../libarchive/archive_write_open_memory.c | 126 + .../libarchive/archive_write_private.h | 122 + .../archive_write_set_compression_bzip2.c | 410 + .../archive_write_set_compression_compress.c | 494 + .../archive_write_set_compression_gzip.c | 478 + .../archive_write_set_compression_none.c | 259 + .../archive_write_set_compression_program.c | 349 + .../archive_write_set_compression_xz.c | 439 + .../libarchive/archive_write_set_format.c | 72 + .../libarchive/archive_write_set_format_ar.c | 551 + .../archive_write_set_format_by_name.c | 76 + .../archive_write_set_format_cpio.c | 271 + .../archive_write_set_format_cpio_newc.c | 289 + .../archive_write_set_format_mtree.c | 1050 + .../libarchive/archive_write_set_format_pax.c | 1393 + .../archive_write_set_format_shar.c | 626 + .../archive_write_set_format_ustar.c | 587 + .../libarchive/archive_write_set_format_zip.c | 667 + .../cmlibarchive/libarchive/config_freebsd.h | 149 + .../cmlibarchive/libarchive/config_windows.h | 576 + Utilities/cmlibarchive/libarchive/cpio.5 | 325 + .../cmlibarchive/libarchive/filter_fork.c | 161 + .../cmlibarchive/libarchive/filter_fork.h | 41 + .../libarchive/filter_fork_windows.c | 112 + .../libarchive/libarchive-formats.5 | 346 + .../cmlibarchive/libarchive/libarchive.3 | 331 + .../libarchive/libarchive_internals.3 | 366 + Utilities/cmlibarchive/libarchive/mtree.5 | 269 + Utilities/cmlibarchive/libarchive/o2 | 483 + Utilities/cmlibarchive/libarchive/out | 185 + Utilities/cmlibarchive/libarchive/tar.5 | 817 + .../cmlibarchive/libarchive/test/.cvsignore | 10 + .../libarchive/test/CMakeLists.txt | 145 + Utilities/cmlibarchive/libarchive/test/README | 63 + Utilities/cmlibarchive/libarchive/test/main.c | 2043 + .../libarchive/test/read_open_memory.c | 172 + Utilities/cmlibarchive/libarchive/test/test.h | 285 + .../libarchive/test/test_acl_basic.c | 229 + .../libarchive/test/test_acl_freebsd.c | 255 + .../libarchive/test/test_acl_pax.c | 517 + .../test/test_archive_api_feature.c | 76 + .../libarchive/test/test_bad_fd.c | 41 + .../libarchive/test/test_compat_bzip2.c | 85 + .../test/test_compat_bzip2_1.tbz.uu | 24 + .../test/test_compat_bzip2_2.tbz.uu | 11 + .../libarchive/test/test_compat_gtar.c | 119 + .../libarchive/test/test_compat_gtar_1.tar.uu | 231 + .../libarchive/test/test_compat_gzip.c | 97 + .../libarchive/test/test_compat_gzip_1.tgz.uu | 24 + .../libarchive/test/test_compat_gzip_2.tgz.uu | 11 + .../test/test_compat_solaris_tar_acl.c | 128 + .../test/test_compat_solaris_tar_acl.tar.uu | 61 + .../test/test_compat_tar_hardlink.c | 108 + .../test/test_compat_tar_hardlink_1.tar.uu | 39 + .../libarchive/test/test_compat_xz.c | 84 + .../libarchive/test/test_compat_xz_1.txz.uu | 12 + .../libarchive/test/test_compat_zip.c | 80 + .../libarchive/test/test_compat_zip_1.zip.uu | 15 + .../libarchive/test/test_empty_write.c | 120 + .../cmlibarchive/libarchive/test/test_entry.c | 890 + .../libarchive/test/test_entry_strmode.c | 71 + .../libarchive/test/test_extattr_freebsd.c | 174 + .../cmlibarchive/libarchive/test/test_fuzz.c | 129 + .../libarchive/test/test_fuzz_1.iso.uu | 26993 +++++ .../libarchive/test/test_link_resolver.c | 205 + .../libarchive/test/test_open_fd.c | 122 + .../libarchive/test/test_open_file.c | 108 + .../libarchive/test/test_open_filename.c | 109 + .../test/test_pax_filename_encoding.c | 337 + .../test/test_pax_filename_encoding.tar.uu | 117 + .../test/test_read_compress_program.c | 84 + .../libarchive/test/test_read_data_large.c | 121 + .../libarchive/test/test_read_disk.c | 170 + .../test/test_read_disk_entry_from_file.c | 80 + .../libarchive/test/test_read_extract.c | 168 + .../test/test_read_file_nonexistent.c | 37 + .../libarchive/test/test_read_format_ar.c | 119 + .../test/test_read_format_cpio_bin.c | 64 + .../test/test_read_format_cpio_bin_Z.c | 61 + .../test/test_read_format_cpio_bin_be.c | 55 + .../test/test_read_format_cpio_bin_be.cpio.uu | 8 + .../test/test_read_format_cpio_bin_bz2.c | 58 + .../test/test_read_format_cpio_bin_gz.c | 61 + .../test/test_read_format_cpio_bin_xz.c | 70 + .../test/test_read_format_cpio_odc.c | 68 + .../test/test_read_format_cpio_svr4_gzip.c | 61 + .../test/test_read_format_cpio_svr4c_Z.c | 62 + .../libarchive/test/test_read_format_empty.c | 47 + .../test/test_read_format_gtar_gz.c | 60 + .../test/test_read_format_gtar_lzma.c | 78 + .../test/test_read_format_gtar_sparse.c | 318 + .../test_read_format_gtar_sparse_1_13.tar.uu | 1369 + .../test_read_format_gtar_sparse_1_17.tar.uu | 1369 + ...ead_format_gtar_sparse_1_17_posix00.tar.uu | 1596 + ...ead_format_gtar_sparse_1_17_posix01.tar.uu | 1369 + ...ead_format_gtar_sparse_1_17_posix10.tar.uu | 1369 + ...t_gtar_sparse_1_17_posix10_modified.tar.uu | 1370 + .../libarchive/test/test_read_format_iso_gz.c | 59 + .../test/test_read_format_iso_gz.iso.gz.uu | 15 + .../test/test_read_format_isojoliet_bz2.c | 139 + .../test_read_format_isojoliet_bz2.iso.bz2.uu | 29 + .../test/test_read_format_isojoliet_long.c | 146 + ...test_read_format_isojoliet_long.iso.bz2.uu | 29 + .../test/test_read_format_isojoliet_rr.c | 164 + .../test_read_format_isojoliet_rr.iso.bz2.uu | 31 + .../test/test_read_format_isorr_bz2.c | 210 + .../test_read_format_isorr_bz2.iso.bz2.uu | 26 + .../test/test_read_format_isorr_new_bz2.c | 209 + .../test_read_format_isorr_new_bz2.iso.bz2.uu | 27 + .../test/test_read_format_isozisofs_bz2.c | 189 + .../test_read_format_isozisofs_bz2.iso.bz2.uu | 27 + .../libarchive/test/test_read_format_mtree.c | 135 + .../test/test_read_format_pax_bz2.c | 66 + .../libarchive/test/test_read_format_raw.c | 89 + .../test/test_read_format_raw.data.Z.uu | 4 + .../test/test_read_format_raw.data.uu | 4 + .../libarchive/test/test_read_format_tar.c | 480 + .../test_read_format_tar_empty_filename.c | 66 + ...test_read_format_tar_empty_filename.tar.uu | 39 + .../libarchive/test/test_read_format_tbz.c | 59 + .../libarchive/test/test_read_format_tgz.c | 60 + .../libarchive/test/test_read_format_txz.c | 63 + .../libarchive/test/test_read_format_tz.c | 61 + .../libarchive/test/test_read_format_zip.c | 92 + .../test/test_read_format_zip.zip.uu | 14 + .../libarchive/test/test_read_large.c | 89 + .../libarchive/test/test_read_pax_truncated.c | 288 + .../libarchive/test/test_read_position.c | 94 + .../libarchive/test/test_read_truncated.c | 149 + .../libarchive/test/test_tar_filenames.c | 186 + .../libarchive/test/test_tar_large.c | 312 + .../libarchive/test/test_ustar_filenames.c | 191 + .../libarchive/test/test_write_compress.c | 102 + .../test/test_write_compress_bzip2.c | 228 + .../test/test_write_compress_gzip.c | 252 + .../test/test_write_compress_lzma.c | 245 + .../test/test_write_compress_program.c | 118 + .../libarchive/test/test_write_compress_xz.c | 253 + .../libarchive/test/test_write_disk.c | 323 + .../test/test_write_disk_failures.c | 72 + .../test/test_write_disk_hardlink.c | 223 + .../libarchive/test/test_write_disk_perms.c | 457 + .../libarchive/test/test_write_disk_secure.c | 215 + .../libarchive/test/test_write_disk_sparse.c | 280 + .../libarchive/test/test_write_disk_symlink.c | 117 + .../libarchive/test/test_write_disk_times.c | 167 + .../libarchive/test/test_write_format_ar.c | 209 + .../libarchive/test/test_write_format_cpio.c | 206 + .../test/test_write_format_cpio_empty.c | 75 + .../test/test_write_format_cpio_newc.c | 212 + .../test/test_write_format_cpio_odc.c | 225 + .../libarchive/test/test_write_format_mtree.c | 154 + .../libarchive/test/test_write_format_pax.c | 146 + .../test/test_write_format_shar_empty.c | 58 + .../libarchive/test/test_write_format_tar.c | 114 + .../test/test_write_format_tar_empty.c | 92 + .../test/test_write_format_tar_ustar.c | 347 + .../libarchive/test/test_write_format_zip.c | 180 + .../test/test_write_format_zip_empty.c | 56 + .../test_write_format_zip_no_compression.c | 304 + .../libarchive/test/test_write_open_memory.c | 76 + Utilities/cmlibarchive/libarchive_fe/err.c | 74 + Utilities/cmlibarchive/libarchive_fe/err.h | 34 + .../libarchive_fe/lafe_platform.h | 53 + .../cmlibarchive/libarchive_fe/line_reader.c | 171 + .../cmlibarchive/libarchive_fe/line_reader.h | 35 + .../cmlibarchive/libarchive_fe/matching.c | 284 + .../cmlibarchive/libarchive_fe/matching.h | 46 + .../cmlibarchive/libarchive_fe/pathmatch.c | 257 + .../cmlibarchive/libarchive_fe/pathmatch.h | 42 + Utilities/cmlibarchive/tar/CMakeLists.txt | 58 + Utilities/cmlibarchive/tar/bsdtar.1 | 921 + Utilities/cmlibarchive/tar/bsdtar.c | 730 + Utilities/cmlibarchive/tar/bsdtar.h | 157 + Utilities/cmlibarchive/tar/bsdtar_platform.h | 149 + Utilities/cmlibarchive/tar/bsdtar_windows.c | 296 + Utilities/cmlibarchive/tar/bsdtar_windows.h | 57 + Utilities/cmlibarchive/tar/cmdline.c | 381 + Utilities/cmlibarchive/tar/config_freebsd.h | 83 + Utilities/cmlibarchive/tar/getdate.c | 1037 + Utilities/cmlibarchive/tar/read.c | 440 + Utilities/cmlibarchive/tar/subst.c | 289 + .../cmlibarchive/tar/test/CMakeLists.txt | 62 + Utilities/cmlibarchive/tar/test/main.c | 2057 + Utilities/cmlibarchive/tar/test/test.h | 277 + Utilities/cmlibarchive/tar/test/test_0.c | 67 + Utilities/cmlibarchive/tar/test/test_basic.c | 115 + Utilities/cmlibarchive/tar/test/test_copy.c | 373 + .../cmlibarchive/tar/test/test_getdate.c | 80 + Utilities/cmlibarchive/tar/test/test_help.c | 81 + .../tar/test/test_option_T_upper.c | 188 + .../cmlibarchive/tar/test/test_option_q.c | 129 + .../cmlibarchive/tar/test/test_option_r.c | 117 + .../cmlibarchive/tar/test/test_option_s.c | 107 + .../cmlibarchive/tar/test/test_patterns.c | 184 + .../tar/test/test_patterns_2.tar.uu | 231 + .../tar/test/test_patterns_3.tar.uu | 231 + .../tar/test/test_patterns_4.tar.uu | 641 + Utilities/cmlibarchive/tar/test/test_stdio.c | 128 + .../tar/test/test_strip_components.c | 109 + .../cmlibarchive/tar/test/test_symlink_dir.c | 160 + .../cmlibarchive/tar/test/test_version.c | 97 + .../cmlibarchive/tar/test/test_windows.c | 324 + Utilities/cmlibarchive/tar/tree.c | 795 + Utilities/cmlibarchive/tar/tree.h | 141 + Utilities/cmlibarchive/tar/util.c | 530 + Utilities/cmlibarchive/tar/write.c | 1129 + Utilities/cmtar/CMakeLists.txt | 396 - Utilities/cmtar/COPYRIGHT | 35 - Utilities/cmtar/append.c | 297 - Utilities/cmtar/block.c | 384 - Utilities/cmtar/compat/README | 12 - Utilities/cmtar/compat/basename.c | 76 - Utilities/cmtar/compat/compat.h | 332 - Utilities/cmtar/compat/dirname.c | 79 - Utilities/cmtar/compat/fnmatch.c | 229 - Utilities/cmtar/compat/gethostbyname_r.c | 41 - Utilities/cmtar/compat/gethostname.c | 36 - Utilities/cmtar/compat/getservbyname_r.c | 41 - Utilities/cmtar/compat/glob.c | 874 - Utilities/cmtar/compat/inet_aton.c | 27 - Utilities/cmtar/compat/snprintf.c | 797 - Utilities/cmtar/compat/strdup.c | 62 - Utilities/cmtar/compat/strlcat.c | 72 - Utilities/cmtar/compat/strlcpy.c | 67 - Utilities/cmtar/compat/strmode.c | 185 - Utilities/cmtar/compat/strrstr.c | 40 - Utilities/cmtar/compat/strsep.c | 87 - Utilities/cmtar/config.h.in | 213 - Utilities/cmtar/decode.c | 140 - Utilities/cmtar/encode.c | 231 - Utilities/cmtar/extract.c | 897 - Utilities/cmtar/filesystem.c | 87 - Utilities/cmtar/filesystem.h | 30 - Utilities/cmtar/handle.c | 163 - Utilities/cmtar/internal.h | 35 - Utilities/cmtar/libtar.c | 424 - Utilities/cmtar/libtar.h | 290 - Utilities/cmtar/listhash/hash.c.in | 344 - Utilities/cmtar/listhash/list.c.in | 461 - Utilities/cmtar/listhash/listhash.h.in | 196 - Utilities/cmtar/output.c | 151 - Utilities/cmtar/tar.h | 71 - Utilities/cmtar/util.c | 186 - Utilities/cmtar/wrapper.c | 241 - Utilities/cmzlib/deflate.c | 8 +- bootstrap | 32 +- 728 files changed, 293830 insertions(+), 11127 deletions(-) create mode 100644 Modules/Compiler/Clang-C.cmake create mode 100644 Modules/Compiler/Clang-CXX.cmake create mode 100644 Modules/FindGit.cmake create mode 100644 Modules/Platform/Linux-Clang-C.cmake create mode 100644 Modules/Platform/Linux-Clang-CXX.cmake create mode 100644 Modules/Platform/Windows-G95-Fortran.cmake create mode 100644 Source/CMakeVersionSource.cmake create mode 100644 Source/CPack/cmCPackArchiveGenerator.cxx create mode 100644 Source/CPack/cmCPackArchiveGenerator.h create mode 100644 Source/CTest/cmParsePHPCoverage.cxx create mode 100644 Source/CTest/cmParsePHPCoverage.h delete mode 100644 Source/cmData.h create mode 100644 Source/cmStandardIncludes.cxx create mode 100644 Tests/CMakeTests/FileDownloadInput.png create mode 100644 Tests/CMakeTests/FileDownloadTest.cmake.in create mode 100644 Tests/CTestSubmitLargeOutput/CMakeLists.txt create mode 100644 Tests/CTestSubmitLargeOutput/CTestConfig.cmake create mode 100644 Tests/CTestSubmitLargeOutput/GenerateRandomOutput.cmake create mode 100644 Tests/CTestSubmitLargeOutput/test.cmake.in create mode 100644 Tests/CTestTestResourceLock/CMakeLists.txt create mode 100644 Tests/CTestTestResourceLock/CTestConfig.cmake create mode 100644 Tests/CTestTestResourceLock/lockFile.c create mode 100644 Tests/CTestTestResourceLock/test.cmake.in create mode 100644 Tests/CTestTestStopTime/CMakeLists.txt create mode 100644 Tests/CTestTestStopTime/CTestConfig.cmake create mode 100644 Tests/CTestTestStopTime/GetDate.cmake create mode 100644 Tests/CTestTestStopTime/sleep.c create mode 100644 Tests/CTestTestStopTime/test.cmake.in create mode 100644 Tests/CheckCompilerRelatedVariables/CMakeLists.txt create mode 100644 Tests/ExternalProject/Example/CMakeLists.txt create mode 100644 Tests/ExternalProject/Step1.tar.bz2 create mode 100644 Tests/ExternalProject/Step1.zip create mode 100644 Tests/ExternalProject/Step1NoDir.tar.bz2 create mode 100644 Tests/ExternalProject/Step1NoDir.zip create mode 100644 Tests/ExternalProject/gitrepo.tgz create mode 100644 Tests/LinkFlags/CMakeLists.txt create mode 100644 Tests/LinkFlags/LinkFlags.c create mode 100644 Tests/LinkFlags/LinkFlagsExe.c create mode 100644 Tests/LinkFlags/LinkFlagsLib.c create mode 100644 Tests/bootstrap.bat.in create mode 100644 Utilities/Release/dash2win64_cygwin.cmake create mode 100644 Utilities/Release/v20n250_aix_release.cmake create mode 100644 Utilities/cmbzip2/CHANGES create mode 100644 Utilities/cmbzip2/CMakeLists.txt create mode 100644 Utilities/cmbzip2/LICENSE create mode 100644 Utilities/cmbzip2/Makefile-libbz2_so create mode 100644 Utilities/cmbzip2/README create mode 100644 Utilities/cmbzip2/README.COMPILATION.PROBLEMS create mode 100644 Utilities/cmbzip2/README.XML.STUFF create mode 100644 Utilities/cmbzip2/blocksort.c create mode 100644 Utilities/cmbzip2/bz-common.xsl create mode 100644 Utilities/cmbzip2/bz-fo.xsl create mode 100644 Utilities/cmbzip2/bz-html.xsl create mode 100644 Utilities/cmbzip2/bzdiff create mode 100644 Utilities/cmbzip2/bzdiff.1 create mode 100644 Utilities/cmbzip2/bzgrep create mode 100644 Utilities/cmbzip2/bzgrep.1 create mode 100644 Utilities/cmbzip2/bzip.css create mode 100644 Utilities/cmbzip2/bzip2.1 create mode 100644 Utilities/cmbzip2/bzip2.1.preformatted create mode 100644 Utilities/cmbzip2/bzip2.c create mode 100644 Utilities/cmbzip2/bzip2.txt create mode 100644 Utilities/cmbzip2/bzip2recover.c create mode 100644 Utilities/cmbzip2/bzlib.c create mode 100644 Utilities/cmbzip2/bzlib.h create mode 100644 Utilities/cmbzip2/bzlib_private.h create mode 100644 Utilities/cmbzip2/bzmore create mode 100644 Utilities/cmbzip2/bzmore.1 create mode 100644 Utilities/cmbzip2/compress.c create mode 100644 Utilities/cmbzip2/crctable.c create mode 100644 Utilities/cmbzip2/decompress.c create mode 100644 Utilities/cmbzip2/dlltest.c create mode 100644 Utilities/cmbzip2/dlltest.dsp create mode 100644 Utilities/cmbzip2/entities.xml create mode 100755 Utilities/cmbzip2/format.pl create mode 100644 Utilities/cmbzip2/huffman.c create mode 100644 Utilities/cmbzip2/libbz2.def create mode 100644 Utilities/cmbzip2/libbz2.dsp create mode 100644 Utilities/cmbzip2/libbz2.lib create mode 100644 Utilities/cmbzip2/makefile.msc create mode 100644 Utilities/cmbzip2/manual.html create mode 100644 Utilities/cmbzip2/manual.pdf create mode 100644 Utilities/cmbzip2/manual.ps create mode 100644 Utilities/cmbzip2/manual.xml create mode 100644 Utilities/cmbzip2/mk251.c create mode 100644 Utilities/cmbzip2/randtable.c create mode 100644 Utilities/cmbzip2/sample1.bz2 create mode 100644 Utilities/cmbzip2/sample1.rb2 create mode 100644 Utilities/cmbzip2/sample1.ref create mode 100644 Utilities/cmbzip2/sample1.tst create mode 100644 Utilities/cmbzip2/sample2.bz2 create mode 100644 Utilities/cmbzip2/sample2.rb2 create mode 100644 Utilities/cmbzip2/sample2.ref create mode 100644 Utilities/cmbzip2/sample2.tst create mode 100644 Utilities/cmbzip2/sample3.bz2 create mode 100644 Utilities/cmbzip2/sample3.rb2 create mode 100644 Utilities/cmbzip2/sample3.ref create mode 100644 Utilities/cmbzip2/sample3.tst create mode 100644 Utilities/cmbzip2/spewG.c create mode 100644 Utilities/cmbzip2/unzcrash.c create mode 100644 Utilities/cmbzip2/words0 create mode 100644 Utilities/cmbzip2/words1 create mode 100644 Utilities/cmbzip2/words2 create mode 100644 Utilities/cmbzip2/words3 create mode 100755 Utilities/cmbzip2/xmlproc.sh create mode 100644 Utilities/cmlibarchive/CMakeLists.txt create mode 100644 Utilities/cmlibarchive/COPYING create mode 100644 Utilities/cmlibarchive/INSTALL create mode 100644 Utilities/cmlibarchive/Makefile.am create mode 100644 Utilities/cmlibarchive/NEWS create mode 100644 Utilities/cmlibarchive/README create mode 100644 Utilities/cmlibarchive/build/autoconf/check_stdcall_func.m4 create mode 100644 Utilities/cmlibarchive/build/autoconf/la_uid_t.m4 create mode 100755 Utilities/cmlibarchive/build/autogen.sh create mode 100644 Utilities/cmlibarchive/build/cmake/CheckFileOffsetBits.c create mode 100644 Utilities/cmlibarchive/build/cmake/CheckFileOffsetBits.cmake create mode 100644 Utilities/cmlibarchive/build/cmake/CheckFuncs.cmake create mode 100644 Utilities/cmlibarchive/build/cmake/CheckFuncs_stub.c.in create mode 100644 Utilities/cmlibarchive/build/cmake/CheckHeaderDirent.cmake create mode 100644 Utilities/cmlibarchive/build/cmake/CheckStructMember.cmake create mode 100644 Utilities/cmlibarchive/build/cmake/CheckTypeExists.cmake create mode 100644 Utilities/cmlibarchive/build/cmake/FindLZMA.cmake create mode 100644 Utilities/cmlibarchive/build/cmake/config.h.in create mode 100755 Utilities/cmlibarchive/build/release.sh create mode 100644 Utilities/cmlibarchive/build/version create mode 100644 Utilities/cmlibarchive/build/windows/mvcpp.nt create mode 100644 Utilities/cmlibarchive/build/windows/vc71/libarchive.sln create mode 100644 Utilities/cmlibarchive/build/windows/vc71/libarchive.vcproj create mode 100644 Utilities/cmlibarchive/build/windows/vc80/libarchive.sln create mode 100644 Utilities/cmlibarchive/build/windows/vc80/libarchive.vcproj create mode 100644 Utilities/cmlibarchive/build/windows/vc80/libarchive_test/libarchive_test.vcproj create mode 100644 Utilities/cmlibarchive/build/windows/vc90/libarchive.sln create mode 100644 Utilities/cmlibarchive/build/windows/vc90/libarchive.vcproj create mode 100644 Utilities/cmlibarchive/build/windows/vc90/libarchive_test/libarchive_test.vcproj create mode 100644 Utilities/cmlibarchive/build/windows/wccpp.nt create mode 100644 Utilities/cmlibarchive/configure.ac create mode 100644 Utilities/cmlibarchive/contrib/README create mode 100644 Utilities/cmlibarchive/contrib/libarchive.1aix53.spec create mode 100644 Utilities/cmlibarchive/contrib/libarchive.spec create mode 100644 Utilities/cmlibarchive/contrib/libarchive_autodetect-st_lib_archive.m4 create mode 100644 Utilities/cmlibarchive/contrib/psota-benchmark/results.txt create mode 100755 Utilities/cmlibarchive/contrib/psota-benchmark/tcp.sh create mode 100644 Utilities/cmlibarchive/contrib/shar/shar.1 create mode 100644 Utilities/cmlibarchive/contrib/shar/shar.c create mode 100644 Utilities/cmlibarchive/contrib/shar/tree.c create mode 100644 Utilities/cmlibarchive/contrib/shar/tree.h create mode 100644 Utilities/cmlibarchive/contrib/shar/tree_config.h create mode 100644 Utilities/cmlibarchive/contrib/untar.c create mode 100644 Utilities/cmlibarchive/cpio/CMakeLists.txt create mode 100644 Utilities/cmlibarchive/cpio/bsdcpio.1 create mode 100644 Utilities/cmlibarchive/cpio/cmdline.c create mode 100644 Utilities/cmlibarchive/cpio/config_freebsd.h create mode 100644 Utilities/cmlibarchive/cpio/cpio.c create mode 100644 Utilities/cmlibarchive/cpio/cpio.h create mode 100644 Utilities/cmlibarchive/cpio/cpio_platform.h create mode 100644 Utilities/cmlibarchive/cpio/cpio_windows.c create mode 100644 Utilities/cmlibarchive/cpio/cpio_windows.h create mode 100644 Utilities/cmlibarchive/cpio/test/CMakeLists.txt create mode 100644 Utilities/cmlibarchive/cpio/test/main.c create mode 100644 Utilities/cmlibarchive/cpio/test/test.h create mode 100644 Utilities/cmlibarchive/cpio/test/test_0.c create mode 100644 Utilities/cmlibarchive/cpio/test/test_basic.c create mode 100644 Utilities/cmlibarchive/cpio/test/test_cmdline.c create mode 100644 Utilities/cmlibarchive/cpio/test/test_format_newc.c create mode 100644 Utilities/cmlibarchive/cpio/test/test_gcpio_compat.c create mode 100644 Utilities/cmlibarchive/cpio/test/test_gcpio_compat_ref.bin.uu create mode 100644 Utilities/cmlibarchive/cpio/test/test_gcpio_compat_ref.crc.uu create mode 100644 Utilities/cmlibarchive/cpio/test/test_gcpio_compat_ref.newc.uu create mode 100644 Utilities/cmlibarchive/cpio/test/test_gcpio_compat_ref.ustar.uu create mode 100644 Utilities/cmlibarchive/cpio/test/test_gcpio_compat_ref_nosym.bin.uu create mode 100644 Utilities/cmlibarchive/cpio/test/test_gcpio_compat_ref_nosym.crc.uu create mode 100644 Utilities/cmlibarchive/cpio/test/test_gcpio_compat_ref_nosym.newc.uu create mode 100644 Utilities/cmlibarchive/cpio/test/test_gcpio_compat_ref_nosym.ustar.uu create mode 100644 Utilities/cmlibarchive/cpio/test/test_option_B_upper.c create mode 100644 Utilities/cmlibarchive/cpio/test/test_option_C_upper.c create mode 100644 Utilities/cmlibarchive/cpio/test/test_option_J_upper.c create mode 100644 Utilities/cmlibarchive/cpio/test/test_option_L_upper.c create mode 100644 Utilities/cmlibarchive/cpio/test/test_option_Z_upper.c create mode 100644 Utilities/cmlibarchive/cpio/test/test_option_a.c create mode 100644 Utilities/cmlibarchive/cpio/test/test_option_c.c create mode 100644 Utilities/cmlibarchive/cpio/test/test_option_d.c create mode 100644 Utilities/cmlibarchive/cpio/test/test_option_f.c create mode 100644 Utilities/cmlibarchive/cpio/test/test_option_f.cpio.uu create mode 100644 Utilities/cmlibarchive/cpio/test/test_option_help.c create mode 100644 Utilities/cmlibarchive/cpio/test/test_option_l.c create mode 100644 Utilities/cmlibarchive/cpio/test/test_option_lzma.c create mode 100644 Utilities/cmlibarchive/cpio/test/test_option_m.c create mode 100644 Utilities/cmlibarchive/cpio/test/test_option_m.cpio.uu create mode 100644 Utilities/cmlibarchive/cpio/test/test_option_t.c create mode 100644 Utilities/cmlibarchive/cpio/test/test_option_t.cpio.uu create mode 100644 Utilities/cmlibarchive/cpio/test/test_option_t.stdout.uu create mode 100644 Utilities/cmlibarchive/cpio/test/test_option_tv.stdout.uu create mode 100644 Utilities/cmlibarchive/cpio/test/test_option_u.c create mode 100644 Utilities/cmlibarchive/cpio/test/test_option_version.c create mode 100644 Utilities/cmlibarchive/cpio/test/test_option_y.c create mode 100644 Utilities/cmlibarchive/cpio/test/test_option_z.c create mode 100644 Utilities/cmlibarchive/cpio/test/test_owner_parse.c create mode 100644 Utilities/cmlibarchive/cpio/test/test_passthrough_dotdot.c create mode 100644 Utilities/cmlibarchive/cpio/test/test_passthrough_reverse.c create mode 100644 Utilities/cmlibarchive/cpio/test/test_pathmatch.c create mode 100755 Utilities/cmlibarchive/doc/mdoc2man.awk create mode 100755 Utilities/cmlibarchive/doc/mdoc2wiki.awk create mode 100755 Utilities/cmlibarchive/doc/update.sh create mode 100644 Utilities/cmlibarchive/examples/minitar/README create mode 100644 Utilities/cmlibarchive/examples/minitar/minitar.c create mode 100644 Utilities/cmlibarchive/examples/minitar/notes create mode 100644 Utilities/cmlibarchive/examples/minitar/tree.c create mode 100644 Utilities/cmlibarchive/examples/minitar/tree.h create mode 100644 Utilities/cmlibarchive/examples/tarfilter.c create mode 100644 Utilities/cmlibarchive/examples/untar.c create mode 100644 Utilities/cmlibarchive/libarchive/CMakeLists.txt create mode 100644 Utilities/cmlibarchive/libarchive/archive.h create mode 100644 Utilities/cmlibarchive/libarchive/archive_check_magic.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_crc32.h create mode 100644 Utilities/cmlibarchive/libarchive/archive_endian.h create mode 100644 Utilities/cmlibarchive/libarchive/archive_entry.3 create mode 100644 Utilities/cmlibarchive/libarchive/archive_entry.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_entry.h create mode 100644 Utilities/cmlibarchive/libarchive/archive_entry_copy_bhfi.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_entry_copy_stat.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_entry_link_resolver.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_entry_private.h create mode 100644 Utilities/cmlibarchive/libarchive/archive_entry_stat.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_entry_strmode.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_entry_xattr.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_haiku.h create mode 100644 Utilities/cmlibarchive/libarchive/archive_hash.h create mode 100644 Utilities/cmlibarchive/libarchive/archive_platform.h create mode 100644 Utilities/cmlibarchive/libarchive/archive_private.h create mode 100644 Utilities/cmlibarchive/libarchive/archive_read.3 create mode 100644 Utilities/cmlibarchive/libarchive/archive_read.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_read_data_into_fd.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_read_disk.3 create mode 100644 Utilities/cmlibarchive/libarchive/archive_read_disk.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_read_disk_entry_from_file.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_read_disk_private.h create mode 100644 Utilities/cmlibarchive/libarchive/archive_read_disk_set_standard_lookup.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_read_extract.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_read_open_fd.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_read_open_file.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_read_open_filename.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_read_open_memory.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_read_private.h create mode 100644 Utilities/cmlibarchive/libarchive/archive_read_support_compression_all.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_read_support_compression_bzip2.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_read_support_compression_compress.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_read_support_compression_gzip.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_read_support_compression_none.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_read_support_compression_program.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_read_support_compression_xz.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_read_support_format_all.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_read_support_format_ar.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_read_support_format_cpio.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_read_support_format_empty.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_read_support_format_iso9660.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_read_support_format_mtree.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_read_support_format_raw.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_read_support_format_tar.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_read_support_format_zip.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_string.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_string.h create mode 100644 Utilities/cmlibarchive/libarchive/archive_string_sprintf.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_util.3 create mode 100644 Utilities/cmlibarchive/libarchive/archive_util.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_virtual.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_windows.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_windows.h create mode 100644 Utilities/cmlibarchive/libarchive/archive_write.3 create mode 100644 Utilities/cmlibarchive/libarchive/archive_write.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_write_disk.3 create mode 100644 Utilities/cmlibarchive/libarchive/archive_write_disk.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_write_disk_private.h create mode 100644 Utilities/cmlibarchive/libarchive/archive_write_disk_set_standard_lookup.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_write_open_fd.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_write_open_file.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_write_open_filename.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_write_open_memory.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_write_private.h create mode 100644 Utilities/cmlibarchive/libarchive/archive_write_set_compression_bzip2.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_write_set_compression_compress.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_write_set_compression_gzip.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_write_set_compression_none.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_write_set_compression_program.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_write_set_compression_xz.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_write_set_format.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_write_set_format_ar.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_write_set_format_by_name.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_write_set_format_cpio.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_write_set_format_cpio_newc.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_write_set_format_mtree.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_write_set_format_pax.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_write_set_format_shar.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_write_set_format_ustar.c create mode 100644 Utilities/cmlibarchive/libarchive/archive_write_set_format_zip.c create mode 100644 Utilities/cmlibarchive/libarchive/config_freebsd.h create mode 100644 Utilities/cmlibarchive/libarchive/config_windows.h create mode 100644 Utilities/cmlibarchive/libarchive/cpio.5 create mode 100644 Utilities/cmlibarchive/libarchive/filter_fork.c create mode 100644 Utilities/cmlibarchive/libarchive/filter_fork.h create mode 100644 Utilities/cmlibarchive/libarchive/filter_fork_windows.c create mode 100644 Utilities/cmlibarchive/libarchive/libarchive-formats.5 create mode 100644 Utilities/cmlibarchive/libarchive/libarchive.3 create mode 100644 Utilities/cmlibarchive/libarchive/libarchive_internals.3 create mode 100644 Utilities/cmlibarchive/libarchive/mtree.5 create mode 100644 Utilities/cmlibarchive/libarchive/o2 create mode 100644 Utilities/cmlibarchive/libarchive/out create mode 100644 Utilities/cmlibarchive/libarchive/tar.5 create mode 100644 Utilities/cmlibarchive/libarchive/test/.cvsignore create mode 100644 Utilities/cmlibarchive/libarchive/test/CMakeLists.txt create mode 100644 Utilities/cmlibarchive/libarchive/test/README create mode 100644 Utilities/cmlibarchive/libarchive/test/main.c create mode 100644 Utilities/cmlibarchive/libarchive/test/read_open_memory.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test.h create mode 100644 Utilities/cmlibarchive/libarchive/test/test_acl_basic.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_acl_freebsd.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_acl_pax.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_archive_api_feature.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_bad_fd.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_compat_bzip2.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_compat_bzip2_1.tbz.uu create mode 100644 Utilities/cmlibarchive/libarchive/test/test_compat_bzip2_2.tbz.uu create mode 100644 Utilities/cmlibarchive/libarchive/test/test_compat_gtar.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_compat_gtar_1.tar.uu create mode 100644 Utilities/cmlibarchive/libarchive/test/test_compat_gzip.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_compat_gzip_1.tgz.uu create mode 100644 Utilities/cmlibarchive/libarchive/test/test_compat_gzip_2.tgz.uu create mode 100644 Utilities/cmlibarchive/libarchive/test/test_compat_solaris_tar_acl.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_compat_solaris_tar_acl.tar.uu create mode 100644 Utilities/cmlibarchive/libarchive/test/test_compat_tar_hardlink.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_compat_tar_hardlink_1.tar.uu create mode 100644 Utilities/cmlibarchive/libarchive/test/test_compat_xz.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_compat_xz_1.txz.uu create mode 100644 Utilities/cmlibarchive/libarchive/test/test_compat_zip.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_compat_zip_1.zip.uu create mode 100644 Utilities/cmlibarchive/libarchive/test/test_empty_write.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_entry.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_entry_strmode.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_extattr_freebsd.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_fuzz.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_fuzz_1.iso.uu create mode 100644 Utilities/cmlibarchive/libarchive/test/test_link_resolver.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_open_fd.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_open_file.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_open_filename.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_pax_filename_encoding.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_pax_filename_encoding.tar.uu create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_compress_program.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_data_large.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_disk.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_disk_entry_from_file.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_extract.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_file_nonexistent.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_ar.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_cpio_bin.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_cpio_bin_Z.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_cpio_bin_be.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_cpio_bin_be.cpio.uu create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_cpio_bin_bz2.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_cpio_bin_gz.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_cpio_bin_xz.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_cpio_odc.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_cpio_svr4_gzip.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_cpio_svr4c_Z.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_empty.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_gtar_gz.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_gtar_lzma.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_gtar_sparse.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_gtar_sparse_1_13.tar.uu create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_gtar_sparse_1_17.tar.uu create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_gtar_sparse_1_17_posix00.tar.uu create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_gtar_sparse_1_17_posix01.tar.uu create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_gtar_sparse_1_17_posix10.tar.uu create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_gtar_sparse_1_17_posix10_modified.tar.uu create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_iso_gz.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_iso_gz.iso.gz.uu create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_isojoliet_bz2.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_isojoliet_bz2.iso.bz2.uu create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_isojoliet_long.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_isojoliet_long.iso.bz2.uu create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_isojoliet_rr.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_isojoliet_rr.iso.bz2.uu create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_isorr_bz2.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_isorr_bz2.iso.bz2.uu create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_isorr_new_bz2.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_isorr_new_bz2.iso.bz2.uu create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_isozisofs_bz2.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_isozisofs_bz2.iso.bz2.uu create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_mtree.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_pax_bz2.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_raw.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_raw.data.Z.uu create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_raw.data.uu create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_tar.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_tar_empty_filename.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_tar_empty_filename.tar.uu create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_tbz.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_tgz.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_txz.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_tz.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_zip.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_format_zip.zip.uu create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_large.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_pax_truncated.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_position.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_read_truncated.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_tar_filenames.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_tar_large.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_ustar_filenames.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_write_compress.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_write_compress_bzip2.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_write_compress_gzip.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_write_compress_lzma.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_write_compress_program.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_write_compress_xz.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_write_disk.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_write_disk_failures.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_write_disk_hardlink.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_write_disk_perms.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_write_disk_secure.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_write_disk_sparse.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_write_disk_symlink.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_write_disk_times.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_write_format_ar.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_write_format_cpio.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_write_format_cpio_empty.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_write_format_cpio_newc.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_write_format_cpio_odc.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_write_format_mtree.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_write_format_pax.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_write_format_shar_empty.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_write_format_tar.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_write_format_tar_empty.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_write_format_tar_ustar.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_write_format_zip.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_write_format_zip_empty.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_write_format_zip_no_compression.c create mode 100644 Utilities/cmlibarchive/libarchive/test/test_write_open_memory.c create mode 100644 Utilities/cmlibarchive/libarchive_fe/err.c create mode 100644 Utilities/cmlibarchive/libarchive_fe/err.h create mode 100644 Utilities/cmlibarchive/libarchive_fe/lafe_platform.h create mode 100644 Utilities/cmlibarchive/libarchive_fe/line_reader.c create mode 100644 Utilities/cmlibarchive/libarchive_fe/line_reader.h create mode 100644 Utilities/cmlibarchive/libarchive_fe/matching.c create mode 100644 Utilities/cmlibarchive/libarchive_fe/matching.h create mode 100644 Utilities/cmlibarchive/libarchive_fe/pathmatch.c create mode 100644 Utilities/cmlibarchive/libarchive_fe/pathmatch.h create mode 100644 Utilities/cmlibarchive/tar/CMakeLists.txt create mode 100644 Utilities/cmlibarchive/tar/bsdtar.1 create mode 100644 Utilities/cmlibarchive/tar/bsdtar.c create mode 100644 Utilities/cmlibarchive/tar/bsdtar.h create mode 100644 Utilities/cmlibarchive/tar/bsdtar_platform.h create mode 100644 Utilities/cmlibarchive/tar/bsdtar_windows.c create mode 100644 Utilities/cmlibarchive/tar/bsdtar_windows.h create mode 100644 Utilities/cmlibarchive/tar/cmdline.c create mode 100644 Utilities/cmlibarchive/tar/config_freebsd.h create mode 100644 Utilities/cmlibarchive/tar/getdate.c create mode 100644 Utilities/cmlibarchive/tar/read.c create mode 100644 Utilities/cmlibarchive/tar/subst.c create mode 100644 Utilities/cmlibarchive/tar/test/CMakeLists.txt create mode 100644 Utilities/cmlibarchive/tar/test/main.c create mode 100644 Utilities/cmlibarchive/tar/test/test.h create mode 100644 Utilities/cmlibarchive/tar/test/test_0.c create mode 100644 Utilities/cmlibarchive/tar/test/test_basic.c create mode 100644 Utilities/cmlibarchive/tar/test/test_copy.c create mode 100644 Utilities/cmlibarchive/tar/test/test_getdate.c create mode 100644 Utilities/cmlibarchive/tar/test/test_help.c create mode 100644 Utilities/cmlibarchive/tar/test/test_option_T_upper.c create mode 100644 Utilities/cmlibarchive/tar/test/test_option_q.c create mode 100644 Utilities/cmlibarchive/tar/test/test_option_r.c create mode 100644 Utilities/cmlibarchive/tar/test/test_option_s.c create mode 100644 Utilities/cmlibarchive/tar/test/test_patterns.c create mode 100644 Utilities/cmlibarchive/tar/test/test_patterns_2.tar.uu create mode 100644 Utilities/cmlibarchive/tar/test/test_patterns_3.tar.uu create mode 100644 Utilities/cmlibarchive/tar/test/test_patterns_4.tar.uu create mode 100644 Utilities/cmlibarchive/tar/test/test_stdio.c create mode 100644 Utilities/cmlibarchive/tar/test/test_strip_components.c create mode 100644 Utilities/cmlibarchive/tar/test/test_symlink_dir.c create mode 100644 Utilities/cmlibarchive/tar/test/test_version.c create mode 100644 Utilities/cmlibarchive/tar/test/test_windows.c create mode 100644 Utilities/cmlibarchive/tar/tree.c create mode 100644 Utilities/cmlibarchive/tar/tree.h create mode 100644 Utilities/cmlibarchive/tar/util.c create mode 100644 Utilities/cmlibarchive/tar/write.c delete mode 100644 Utilities/cmtar/CMakeLists.txt delete mode 100644 Utilities/cmtar/COPYRIGHT delete mode 100644 Utilities/cmtar/append.c delete mode 100644 Utilities/cmtar/block.c delete mode 100644 Utilities/cmtar/compat/README delete mode 100644 Utilities/cmtar/compat/basename.c delete mode 100644 Utilities/cmtar/compat/compat.h delete mode 100644 Utilities/cmtar/compat/dirname.c delete mode 100644 Utilities/cmtar/compat/fnmatch.c delete mode 100644 Utilities/cmtar/compat/gethostbyname_r.c delete mode 100644 Utilities/cmtar/compat/gethostname.c delete mode 100644 Utilities/cmtar/compat/getservbyname_r.c delete mode 100644 Utilities/cmtar/compat/glob.c delete mode 100644 Utilities/cmtar/compat/inet_aton.c delete mode 100644 Utilities/cmtar/compat/snprintf.c delete mode 100644 Utilities/cmtar/compat/strdup.c delete mode 100644 Utilities/cmtar/compat/strlcat.c delete mode 100644 Utilities/cmtar/compat/strlcpy.c delete mode 100644 Utilities/cmtar/compat/strmode.c delete mode 100644 Utilities/cmtar/compat/strrstr.c delete mode 100644 Utilities/cmtar/compat/strsep.c delete mode 100644 Utilities/cmtar/config.h.in delete mode 100644 Utilities/cmtar/decode.c delete mode 100644 Utilities/cmtar/encode.c delete mode 100644 Utilities/cmtar/extract.c delete mode 100644 Utilities/cmtar/filesystem.c delete mode 100644 Utilities/cmtar/filesystem.h delete mode 100644 Utilities/cmtar/handle.c delete mode 100644 Utilities/cmtar/internal.h delete mode 100644 Utilities/cmtar/libtar.c delete mode 100644 Utilities/cmtar/libtar.h delete mode 100644 Utilities/cmtar/listhash/hash.c.in delete mode 100644 Utilities/cmtar/listhash/list.c.in delete mode 100644 Utilities/cmtar/listhash/listhash.h.in delete mode 100644 Utilities/cmtar/output.c delete mode 100644 Utilities/cmtar/tar.h delete mode 100644 Utilities/cmtar/util.c delete mode 100644 Utilities/cmtar/wrapper.c diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake index 613bb9f03..692befa2f 100644 --- a/CMakeCPack.cmake +++ b/CMakeCPack.cmake @@ -27,16 +27,9 @@ IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") SET(CPACK_PACKAGE_VENDOR "Kitware") SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt") SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt") - SET(CPACK_PACKAGE_VERSION_MAJOR "${CMake_VERSION_MAJOR}") - SET(CPACK_PACKAGE_VERSION_MINOR "${CMake_VERSION_MINOR}") - SET(CPACK_PACKAGE_VERSION_PATCH "${CMake_VERSION_PATCH}") + SET(CPACK_PACKAGE_VERSION "${CMake_VERSION}") SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") - SET(CPACK_SOURCE_PACKAGE_FILE_NAME - "cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}") - IF(CMake_VERSION_RC) - SET(CPACK_SOURCE_PACKAGE_FILE_NAME - "${CPACK_SOURCE_PACKAGE_FILE_NAME}-rc${CMake_VERSION_RC}") - ENDIF(CMake_VERSION_RC) + SET(CPACK_SOURCE_PACKAGE_FILE_NAME "cmake-${CMake_VERSION}") IF(NOT DEFINED CPACK_SYSTEM_NAME) # make sure package is not Cygwin-unknown, for Cygwin just # cygwin is good for the system name @@ -73,22 +66,11 @@ IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") # cygwin specific packaging stuff IF(CYGWIN) - # if we are on cygwin and have cpack, then force the - # doc, data and man dirs to conform to cygwin style directories - SET(CMAKE_DOC_DIR "/share/doc/${CPACK_PACKAGE_FILE_NAME}") - SET(CMAKE_DATA_DIR "/share/${CPACK_PACKAGE_FILE_NAME}") - SET(CMAKE_MAN_DIR "/share/man") - # let the user know we just forced these values - MESSAGE(STATUS "Setup for Cygwin packaging") - MESSAGE(STATUS "Override cache CMAKE_DOC_DIR = ${CMAKE_DOC_DIR}") - MESSAGE(STATUS "Override cache CMAKE_DATA_DIR = ${CMAKE_DATA_DIR}") - MESSAGE(STATUS "Override cache CMAKE_MAN_DIR = ${CMAKE_MAN_DIR}") - # setup the cygwin package name SET(CPACK_PACKAGE_NAME cmake) # setup the name of the package for cygwin cmake-2.4.3 SET(CPACK_PACKAGE_FILE_NAME - "${CPACK_PACKAGE_NAME}-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}") + "${CPACK_PACKAGE_NAME}-${CMake_VERSION}") # the source has the same name as the binary SET(CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME}) # Create a cygwin version number in case there are changes for cygwin diff --git a/CMakeLists.txt b/CMakeLists.txt index c4ab27a9d..9c2601731 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,11 +79,6 @@ MACRO(CMAKE_HANDLE_SYSTEM_LIBRARIES) CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_ZLIB "Use system-installed zlib" ${CMAKE_USE_SYSTEM_LIBRARIES} "NOT CMAKE_USE_SYSTEM_CURL" ON) - # There is currently no option for system tar because the upstream - # libtar does not have our modifications to allow reentrant - # object-oriented use of the library. - # OPTION(CMAKE_USE_SYSTEM_TAR "Use system-installed tar" OFF) - # Mention to the user what system libraries are being used. FOREACH(util CURL EXPAT XMLRPC ZLIB) IF(CMAKE_USE_SYSTEM_${util}) @@ -248,25 +243,41 @@ MACRO (CMAKE_BUILD_UTILITIES) ENDIF(NOT CMAKE_BUILD_CURL_SHARED) SET(CMAKE_CURL_INCLUDES) SET(CMAKE_CURL_LIBRARIES cmcurl) + IF(CMAKE_TESTS_CDASH_SERVER) + SET(CMAKE_CURL_TEST_URL "${CMAKE_TESTS_CDASH_SERVER}/user.php") + ENDIF(CMAKE_TESTS_CDASH_SERVER) ADD_SUBDIRECTORY(Utilities/cmcurl) ENDIF(CMAKE_USE_SYSTEM_CURL) - #--------------------------------------------------------------------- - # Build Tar library for CTest. - SET(CMTAR_ZLIB_HEADER ${CMAKE_ZLIB_HEADER}) - SET(CMTAR_ZLIB_LIBRARIES ${CMAKE_ZLIB_LIBRARIES}) - SET(CMTAR_ZLIB_INCLUDE_DIRS ${CMAKE_ZLIB_INCLUDES}) - SET(CMAKE_TAR_INCLUDES ${CMAKE_CURRENT_BINARY_DIR}/Utilities/cmtar) - SET(CMAKE_TAR_LIBRARIES cmtar) - SUBDIRS(Utilities/cmtar) - #--------------------------------------------------------------------- # Build Compress library for CTest. SET(CMAKE_COMPRESS_INCLUDES "${CMAKE_CURRENT_BINARY_DIR}/Utilities/cmcompress") SET(CMAKE_COMPRESS_LIBRARIES "cmcompress") ADD_SUBDIRECTORY(Utilities/cmcompress) - + IF(CMAKE_USE_SYSTEM_BZIP2) + FIND_PACKAGE(BZip2) + ELSE() + SET(BZIP2_INCLUDE_DIR + "${CMAKE_CURRENT_SOURCE_DIR}/Utilities/cmbzip2") + SET(BZIP2_LIBRARIES cmbzip2) + ADD_SUBDIRECTORY(Utilities/cmbzip2) + ENDIF() + IF(CMAKE_USE_SYSTEM_LIBARCHIVE) + FIND_PACKAGE(libarchive) + SET(CMAKE_TAR_LIBRARIES libarchive) + ELSE(CMAKE_USE_SYSTEM_LIBARCHIVE) + SET(HAVE_LIBZ 1) + SET(HAVE_ZLIB_H 1) + SET(ZLIB_INCLUDE_DIR ${CMAKE_ZLIB_INCLUDES}) + SET(ZLIB_LIBRARIES ${CMAKE_ZLIB_LIBRARIES}) + SET(ZLIB_LIBRARY ${CMAKE_ZLIB_LIBRARIES}) + SET(BUILD_ARCHIVE_WITHIN_CMAKE TRUE) + ADD_DEFINITIONS(-DLIBARCHIVE_STATIC) + ADD_SUBDIRECTORY(Utilities/cmlibarchive) + SET(CMAKE_TAR_LIBRARIES cmlibarchive ${BZIP2_LIBRARIES}) + ENDIF(CMAKE_USE_SYSTEM_LIBARCHIVE) + #--------------------------------------------------------------------- # Build expat library for CMake and CTest. IF(CMAKE_USE_SYSTEM_EXPAT) @@ -328,20 +339,37 @@ ENDMACRO (CMAKE_BUILD_UTILITIES) # The CMake version number. SET(CMake_VERSION_MAJOR 2) SET(CMake_VERSION_MINOR 8) -SET(CMake_VERSION_PATCH 1) -#SET(CMake_VERSION_RC 5) - -# We use odd minor numbers for development versions. -# Use a date for the development patch level. -IF("${CMake_VERSION_MINOR}" MATCHES "[13579]$") +SET(CMake_VERSION_PATCH 2) +SET(CMake_VERSION_TWEAK 0) +SET(CMake_VERSION_RC 3) + +# Releases define a tweak level. +IF(DEFINED CMake_VERSION_TWEAK) + SET(CMake_VERSION_IS_RELEASE 1) + SET(CMake_VERSION_SOURCE "") +ELSE() + SET(CMake_VERSION_IS_RELEASE 0) + + # Use the date as the tweak level. INCLUDE(${CMake_SOURCE_DIR}/Source/kwsys/kwsysDateStamp.cmake) - SET(CMake_VERSION_PATCH + SET(CMake_VERSION_TWEAK "${KWSYS_DATE_STAMP_YEAR}${KWSYS_DATE_STAMP_MONTH}${KWSYS_DATE_STAMP_DAY}" ) -ENDIF("${CMake_VERSION_MINOR}" MATCHES "[13579]$") -SET(CMake_VERSION "${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") -SET(CMake_VERSION_FULL "${CMake_VERSION}.${CMake_VERSION_PATCH}") + INCLUDE(${CMake_SOURCE_DIR}/Source/CMakeVersionSource.cmake) +ENDIF() + +# Compute the full version string. +SET(CMake_VERSION ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}) +IF(${CMake_VERSION_TWEAK} GREATER 0) + SET(CMake_VERSION ${CMake_VERSION}.${CMake_VERSION_TWEAK}) +ENDIF() +IF(CMake_VERSION_RC) + SET(CMake_VERSION ${CMake_VERSION}-rc${CMake_VERSION_RC}) +ENDIF() +IF(CMake_VERSION_SOURCE) + SET(CMake_VERSION ${CMake_VERSION}-${CMake_VERSION_SOURCE}) +ENDIF() # Include the standard Dart testing module ENABLE_TESTING() @@ -361,13 +389,24 @@ SET(LIBRARY_OUTPUT_PATH "" CACHE INTERNAL # install tree. SET(CMAKE_SKIP_RPATH ON CACHE INTERNAL "CMake does not need RPATHs.") -SET(CMAKE_DATA_DIR "/share/cmake-${CMake_VERSION}" CACHE STRING +SET(CMAKE_DATA_DIR "/share/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}" CACHE STRING "Install location for data (relative to prefix).") -SET(CMAKE_DOC_DIR "/doc/cmake-${CMake_VERSION}" CACHE STRING +SET(CMAKE_DOC_DIR "/doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}" CACHE STRING "Install location for documentation (relative to prefix).") SET(CMAKE_MAN_DIR "/man" CACHE STRING "Install location for man pages (relative to prefix).") MARK_AS_ADVANCED(CMAKE_DATA_DIR CMAKE_DOC_DIR CMAKE_MAN_DIR) +IF(CYGWIN AND EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") + # Force doc, data and man dirs to conform to cygwin layout. + SET(CMAKE_DOC_DIR "/share/doc/cmake-${CMake_VERSION}") + SET(CMAKE_DATA_DIR "/share/cmake-${CMake_VERSION}") + SET(CMAKE_MAN_DIR "/share/man") + # let the user know we just forced these values + MESSAGE(STATUS "Setup for Cygwin packaging") + MESSAGE(STATUS "Override cache CMAKE_DOC_DIR = ${CMAKE_DOC_DIR}") + MESSAGE(STATUS "Override cache CMAKE_DATA_DIR = ${CMAKE_DATA_DIR}") + MESSAGE(STATUS "Override cache CMAKE_MAN_DIR = ${CMAKE_MAN_DIR}") +ENDIF() STRING(REGEX REPLACE "^/" "" CMake_DATA_DEST "${CMAKE_DATA_DIR}") STRING(REGEX REPLACE "^/" "" CMake_DOC_DEST "${CMAKE_DOC_DIR}") @@ -383,6 +422,23 @@ INCLUDE(CheckSymbolExists) CHECK_SYMBOL_EXISTS(unsetenv "stdlib.h" HAVE_UNSETENV) CHECK_SYMBOL_EXISTS(environ "stdlib.h" HAVE_ENVIRON_NOT_REQUIRE_PROTOTYPE) +# CMAKE_TESTS_CDASH_SERVER: CDash server used by CMake/Tests. +# +# If not defined or "", this variable defaults to the server at +# http://www.cdash.org/CDash. +# +# If set explicitly to "NOTFOUND", curl tests and ctest tests that use +# the network are skipped. +# +# If set to something starting with "http://localhost/", the CDash is +# expected to be an instance of CDash used for CDash testing, pointing +# to a cdash4simpletest database. In these cases, the CDash dashboards +# should be run first. +# +IF("x${CMAKE_TESTS_CDASH_SERVER}" STREQUAL "x") + SET(CMAKE_TESTS_CDASH_SERVER "http://www.cdash.org/CDash") +ENDIF("x${CMAKE_TESTS_CDASH_SERVER}" STREQUAL "x") + # build the utilities (a macro defined in this file) CMAKE_BUILD_UTILITIES() diff --git a/CTestConfig.cmake b/CTestConfig.cmake index 0add34b92..39032220e 100644 --- a/CTestConfig.cmake +++ b/CTestConfig.cmake @@ -10,7 +10,7 @@ # See the License for more information. #============================================================================= set(CTEST_PROJECT_NAME "CMake") -set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT") +set(CTEST_NIGHTLY_START_TIME "1:00:00 UTC") set(CTEST_DROP_METHOD "http") set(CTEST_DROP_SITE "www.cdash.org") diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index 343f9b0ad..d5789ede9 100644 --- a/CTestCustom.cmake.in +++ b/CTestCustom.cmake.in @@ -12,22 +12,34 @@ SET(CTEST_CUSTOM_WARNING_EXCEPTION "not sorted slower link editing will result" "stl_deque.h:479" "Utilities.cmzlib." + "Utilities.cmbzip2." "Source.CTest.Curl" "Source.CursesDialog.form" "Utilities.cmcurl" "Utilities.cmexpat." - "Utilities.cmtar" + "Utilities.cmlibarchive" "/usr/include.*warning.*shadowed declaration is here" "/usr/bin/ld.*warning.*-..*directory.name.*bin.*does not exist" "Redeclaration of .send..... with a different storage class specifier" "is not used for resolving any symbol" "Clock skew detected" "remark\\(1209" + "LINK : warning LNK4089: all references to.*ADVAPI32.dll.*discarded by /OPT:REF" + "LINK : warning LNK4089: all references to.*USER32.dll.*discarded by /OPT:REF" + "Warning: library was too large for page size.*" + "Warning: public.*_archive_.*in module.*archive_*clashes with prior module.*archive_.*" + "Warning: public.*BZ2_bz.*in module.*bzlib.*clashes with prior module.*bzlib.*" + "Warning: public.*_archive.*clashes with prior module.*" + "Warning: LINN32: Last line.*is less.*" + "warning.*directory name.*CMake-Xcode.*/bin/.*does not exist.*" "stl_deque.h:1051" "(Lexer|Parser).*warning.*conversion.*may (alter its value|change the sign)" "[Qq]t([Cc]ore|[Gg]ui).*warning.*conversion.*may alter its value" "Parser.cxx.*warning.*2111-D.*statement is unreachable" + "warning:.*is.*very unsafe.*consider using.*" + "warning:.*is.*misused, please use.*" "CMakeSetupManifest.xml.*manifest authoring warning.*Unrecognized Element" + "cc-3968 CC: WARNING File.*" # "implicit" truncation by static_cast ) IF(NOT "@CMAKE_GENERATOR@" MATCHES "Xcode") diff --git a/ChangeLog.manual b/ChangeLog.manual index 847d9b38b..333d005bf 100644 --- a/ChangeLog.manual +++ b/ChangeLog.manual @@ -1,3 +1,133 @@ +Changes in CMake 2.8.2-rc3 (since 2.8.2-rc2) +-------------------------------------------- +Brad King (1): + Preserve ENV{MAKEFLAGS} in CMake script mode + +David Cole (4): + Remove "Microsoft Visual Studio .NET" from VS8 and VS9 find modules. + Use full path file names in generate.stamp.list. + Use full path file names to express dependencies. + Look in the ctest ini file for GitCommand. + +James Bigler (2): + Fixed: CUDA_VERSION_MAJOR/MINOR now computed after first run. + CUDA_VERSION variable passed to REGEX needs quotes to work when not defined. + +Mathieu Malaterre (1): + Cleanup FindDCMTK (using foreach). Fix linking on win32 static libs. + +Zach Mullen (2): + Do not exit if stoptime is passed. + Document ctest_build() TARGET option + +Changes in CMake 2.8.2-rc2 (since 2.8.2-rc1) +-------------------------------------------- + +Bill Hoffman (1): + Make sure libarchive uses cmzlib and not the system libz if found. + +Brad King (12): + Use forward slashes for objects in response files + Use platform variable for response file flag + Use response file for objects on MinGW and MSYS + Generalize CTest.Update* test dashboard script helpers + ctest_update: Support custom Git update command + ctest_update: Support Git upstream branch rewrites + Fix CMake data and doc paths in Cygwin package + Document scope of source file properties + Run CTest.NoNewline test using built CMake + Tru64: Place cmOStringStream vtable uniquely (#10541) + Enable BootstrapTest on MSYS + Tru64: Use full-path include directives in Makefiles (#10569) + +Christoph Watzl (1): + Fix nested source groups with VS 10 (#9863) + +Clinton Stimpson (2): + Support pthreads on irix. + Remove macro for querying qmake for qmake variables. + +David Cole (2): + Fix issue #10346. Error if SOURCE_DIR is empty. + Remove CTestTest3. + +Zach Mullen (1): + Extra coverage glob should subtract the explicitly defined excluded files + +Changes in CMake 2.8.2-rc1 (since 2.8.1): +- Build on Tru64 (#10542) +- Build on mingw-w64 +- Build on old Sun (#10550, #10543) +- CPack: Add native BZip2 support +- CPack: Set compression type in RPM spec (#10363) +- CPack: Try harder to initialize staging directory (#10793) +- CTest: Add --stop-time argument +- CTest: Cost data with '-j' +- CTest: Fix memory report +- CTest: Glob for uncovered files during coverage tests +- CTest: Option to specify cdash server +- CTest: PHP Coverage support +- CTest: Process tree kill for OpenBSD, FreeBSD, kFreeBSD, GNU/Hurd +- CTest: Report failure in Update.xml +- CTest: Submit author email in Update.xml +- CTest: Teach ctest_update about Git submodules +- CTest: Teach ctest_update to handle Git upstream branch rewrites +- Cygwin: Export all symbols with ENABLE_EXPORTS (#10122) +- Do not list file names during 'cmake -E tar xz' +- Documentation: Comply with "XHTML 1.0 Strict" +- Documentation: Fix typo in CMAKE_LIBRARY_PATH (#10291) +- Documentation: Fix typo in HAS_CXX docs (#10578) +- Documentation: More consistent command signatures +- Eclipse: Do not add INCLUDE to environment twice +- Enable extra CodeBlocks generator on Cygwin +- ExternalProject: Support .zip and .bz2 archives, MD5 verification +- ExternalProject: Reconfigure when args change (#10258) +- ExternalProject: Support Git, SVN username/password +- FindCurses: Fix for cygwin ncurses package +- FindHSPELL: Version support +- FindJava: Error if version is not found only when REQUIRED +- FindJava: Support runtime and development components (#9840) +- FindKDE4: Prefer kdeconfig results over system paths +- FindMPEG: Check for 'vo' library +- FindPNG: Support png 1.4 versioned lib names (#10551) +- FindPkgConfig: Add QUIET keyword to pkgconfig macros (see #10469) +- FindZLIB: GnuWin32 support, version support (#5588) +- FindwxWidget: Fix CXX flag parsing (#10209) +- Fix .pdb name attribute in VS project files (#10614) +- Fix CodeBlocks to work with Fortran-only +- Fix VS 2010 custom commands (#10503) +- Fix VS 6 support for COMPILE_DEFINITIONS_MINSIZEREL (#10700) +- Fix cross-compiling from Linux to iPhone (#10526) +- Fix documentation typos +- Fix g95 Fortran compiler support +- Fix uname masking in file(WRITE) and write_file (#10789) +- GetPrerequisites: Provide an override hook +- Handle non-ASCII terminators in file(STRINGS) +- Module fixes: FindPythonLibs, FindQt4, FindX11, FindwxWidgets +- PathScale Fortran compiler tool detection +- Qt4 OpenGL framework fix +- Qt4ConfigDependentSettings.cmake Qt4Macros.cmake UseQt4.cmake +- Recognize ARM ABI/EABI with GNU compilers +- Recognize Clang compiler +- Search basic directories on "Generic" platform +- Set MSVC* variables consistently on all generators, and test +- Support SunPro C++ 5.11 on Linux (new compiler) +- Support VS 10 Express (related to #10670) +- Support compression with 'cmake -E tar' +- Support multiple arguments in CC,CXX,FC environment variables +- Support per-configuration librarian flags (#10768) +- Support per-platform initial ASM language flags (#10577) +- Use Fortran ABI detection results conservatively +- Use libarchive to replace the unmaintained libtar +- UseQt4: Support QtMultimedia (#10675) +- bootstrap: Fix make tool detection (#10544) +- cmake-gui: Add simple grouped view +- cmake-gui: Support build tree under symlink (#9975) +- Cleanup modules FindASPELL, FindAVIFile, FindBZip2, FindDart, + FindEXPAT, FindGCCXML, FindGLU, FindHSPELL, FindJasper, FindLibXml2, + FindLibXslt, FindMPEG, FindOpenAL, FindPhysFS, FindQuickTime, + FindSubversion, FindZLIB. + Changes in CMake 2.8.1 - Fix failing test on cygwin - Add a new serach path for MPICH2 diff --git a/Modules/CMakeASMInformation.cmake b/Modules/CMakeASMInformation.cmake index c49581023..0fad25df7 100644 --- a/Modules/CMakeASMInformation.cmake +++ b/Modules/CMakeASMInformation.cmake @@ -42,10 +42,45 @@ IF(NOT _INCLUDED_FILE) INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_C_COMPILER_ID}-ASM OPTIONAL) ENDIF(NOT _INCLUDED_FILE) +# Set default assembler file extensions: IF(NOT CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS) SET(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS s;S;asm) ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS) + +# Support for CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT and friends: +SET(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT "$ENV{ASM${ASM_DIALECT}FLAGS} ${CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT}") +# avoid just having a space as the initial value for the cache +IF(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT STREQUAL " ") + SET(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT) +ENDIF(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT STREQUAL " ") +SET (CMAKE_ASM${ASM_DIALECT}_FLAGS "${CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT}" CACHE STRING + "Flags used by the assembler during all build types.") + +IF(NOT CMAKE_NOT_USING_CONFIG_FLAGS) +# default build type is none + IF(NOT CMAKE_NO_BUILD_TYPE) + SET (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE_INIT} CACHE STRING + "Choose the type of build, options are: None, Debug Release RelWithDebInfo MinSizeRel.") + ENDIF(NOT CMAKE_NO_BUILD_TYPE) + SET (CMAKE_ASM${ASM_DIALECT}_FLAGS_DEBUG "${CMAKE_ASM${ASM_DIALECT}_FLAGS_DEBUG_INIT}" CACHE STRING + "Flags used by the assembler during debug builds.") + SET (CMAKE_ASM${ASM_DIALECT}_FLAGS_MINSIZEREL "${CMAKE_ASM${ASM_DIALECT}_FLAGS_MINSIZEREL_INIT}" CACHE STRING + "Flags used by the assembler during release minsize builds.") + SET (CMAKE_ASM${ASM_DIALECT}_FLAGS_RELEASE "${CMAKE_ASM${ASM_DIALECT}_FLAGS_RELEASE_INIT}" CACHE STRING + "Flags used by the assembler during release builds.") + SET (CMAKE_ASM${ASM_DIALECT}_FLAGS_RELWITHDEBINFO "${CMAKE_ASM${ASM_DIALECT}_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING + "Flags used by the assembler during Release with Debug Info builds.") +ENDIF(NOT CMAKE_NOT_USING_CONFIG_FLAGS) + +MARK_AS_ADVANCED(CMAKE_ASM${ASM_DIALECT}_FLAGS + CMAKE_ASM${ASM_DIALECT}_FLAGS_DEBUG + CMAKE_ASM${ASM_DIALECT}_FLAGS_MINSIZEREL + CMAKE_ASM${ASM_DIALECT}_FLAGS_RELEASE + CMAKE_ASM${ASM_DIALECT}_FLAGS_RELWITHDEBINFO + ) + + IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT) SET(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT " -o ") ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT) diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in index 5d004c70a..accda3257 100644 --- a/Modules/CMakeCCompilerId.c.in +++ b/Modules/CMakeCCompilerId.c.in @@ -9,6 +9,9 @@ #if defined(__INTEL_COMPILER) || defined(__ICC) # define COMPILER_ID "Intel" +#elif defined(__clang__) +# define COMPILER_ID "Clang" + #elif defined(__BORLANDC__) # define COMPILER_ID "Borland" diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in index 00ab8e217..4a32823f8 100644 --- a/Modules/CMakeCXXCompilerId.cpp.in +++ b/Modules/CMakeCXXCompilerId.cpp.in @@ -11,6 +11,9 @@ #elif defined(__INTEL_COMPILER) || defined(__ICC) # define COMPILER_ID "Intel" +#elif defined(__clang__) +# define COMPILER_ID "Clang" + #elif defined(__BORLANDC__) # define COMPILER_ID "Borland" diff --git a/Modules/CMakeCompilerABI.h b/Modules/CMakeCompilerABI.h index 8980abb5a..26ae4db6a 100644 --- a/Modules/CMakeCompilerABI.h +++ b/Modules/CMakeCompilerABI.h @@ -17,6 +17,16 @@ const char info_sizeof_dptr[] = { # define ABI_ID "ELF N32" #elif defined(__sgi) && defined(_ABI64) # define ABI_ID "ELF 64" + +/* Check for (some) ARM ABIs. + * See e.g. http://wiki.debian.org/ArmEabiPort for some information on this. */ +#elif defined(__GNU__) && defined(__ELF__) && defined(__ARM_EABI__) +# define ABI_ID "ELF ARMEABI" +#elif defined(__GNU__) && defined(__ELF__) && defined(__ARMEB__) +# define ABI_ID "ELF ARM" +#elif defined(__GNU__) && defined(__ELF__) && defined(__ARMEL__) +# define ABI_ID "ELF ARM" + #elif defined(__ELF__) # define ABI_ID "ELF" #endif diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake index c8f4c9940..aa4733b32 100644 --- a/Modules/CMakeDetermineCompilerABI.cmake +++ b/Modules/CMakeDetermineCompilerABI.cmake @@ -49,12 +49,10 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ABI lang src) IF(ABI_SIZEOF_DPTR) SET(CMAKE_${lang}_SIZEOF_DATA_PTR "${ABI_SIZEOF_DPTR}" PARENT_SCOPE) - SET(CMAKE_SIZEOF_VOID_P "${ABI_SIZEOF_DPTR}" PARENT_SCOPE) ENDIF(ABI_SIZEOF_DPTR) IF(ABI_NAME) SET(CMAKE_${lang}_COMPILER_ABI "${ABI_NAME}" PARENT_SCOPE) - SET(CMAKE_INTERNAL_PLATFORM_ABI "${ABI_NAME}" PARENT_SCOPE) ENDIF(ABI_NAME) # Parse implicit linker information for this language, if available. diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index bddd6a1e8..4a800a8ea 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -19,6 +19,7 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) # Make sure the compiler arguments are clean. STRING(STRIP "${CMAKE_${lang}_COMPILER_ARG1}" CMAKE_${lang}_COMPILER_ID_ARG1) + STRING(REGEX REPLACE " +" ";" CMAKE_${lang}_COMPILER_ID_ARG1 "${CMAKE_${lang}_COMPILER_ID_ARG1}") # Make sure user-specified compiler flags are used. IF(CMAKE_${lang}_FLAGS) diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index 0637d20d5..34477a147 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -49,6 +49,7 @@ IF(NOT CMAKE_Fortran_COMPILER) # gfortran: putative GNU Fortran 95+ compiler (in progress) # fort77: native F77 compiler under HP-UX (and some older Crays) # frt: Fujitsu F77 compiler + # pathf90/pathf95/pathf2003: PathScale Fortran compiler # pgf77/pgf90/pgf95: Portland Group F77/F90/F95 compilers # xlf/xlf90/xlf95: IBM (AIX) F77/F90/F95 compilers # lf95: Lahey-Fujitsu F95 compiler @@ -63,14 +64,16 @@ IF(NOT CMAKE_Fortran_COMPILER) # then 77 or older compilers, gnu is always last in the group, # so if you paid for a compiler it is picked by default. SET(CMAKE_Fortran_COMPILER_LIST - ifort ifc efc f95 pgf95 lf95 xlf95 fort gfortran gfortran-4 g95 f90 - pgf90 xlf90 epcf90 fort77 frt pgf77 xlf fl32 af77 g77 f77 + ifort ifc efc f95 pathf2003 pathf95 pgf95 lf95 xlf95 fort + gfortran gfortran-4 g95 f90 pathf90 pgf90 xlf90 epcf90 fort77 + frt pgf77 xlf fl32 af77 g77 f77 ) # Vendor-specific compiler names. SET(_Fortran_COMPILER_NAMES_GNU gfortran gfortran-4 g95 g77) SET(_Fortran_COMPILER_NAMES_Intel ifort ifc efc) SET(_Fortran_COMPILER_NAMES_PGI pgf95 pgf90 pgf77) + SET(_Fortran_COMPILER_NAMES_PathScale pathf2003 pathf95 pathf90) SET(_Fortran_COMPILER_NAMES_XL xlf) SET(_Fortran_COMPILER_NAMES_VisualAge xlf95 xlf90 xlf) diff --git a/Modules/CMakeFortranCompiler.cmake.in b/Modules/CMakeFortranCompiler.cmake.in index ba2b46d63..555865195 100644 --- a/Modules/CMakeFortranCompiler.cmake.in +++ b/Modules/CMakeFortranCompiler.cmake.in @@ -34,9 +34,9 @@ ENDIF(UNIX) SET(CMAKE_Fortran_SIZEOF_DATA_PTR "@CMAKE_Fortran_SIZEOF_DATA_PTR@") SET(CMAKE_Fortran_COMPILER_ABI "@CMAKE_Fortran_COMPILER_ABI@") -IF(CMAKE_Fortran_SIZEOF_DATA_PTR) +IF(CMAKE_Fortran_SIZEOF_DATA_PTR AND NOT CMAKE_SIZEOF_VOID_P) SET(CMAKE_SIZEOF_VOID_P "${CMAKE_Fortran_SIZEOF_DATA_PTR}") -ENDIF(CMAKE_Fortran_SIZEOF_DATA_PTR) +ENDIF() IF(CMAKE_Fortran_COMPILER_ABI) SET(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_Fortran_COMPILER_ABI}") diff --git a/Modules/CMakePrintSystemInformation.cmake b/Modules/CMakePrintSystemInformation.cmake index 1d3d8054e..3f33ce8fa 100644 --- a/Modules/CMakePrintSystemInformation.cmake +++ b/Modules/CMakePrintSystemInformation.cmake @@ -27,7 +27,7 @@ MESSAGE("CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS is ${CMAKE_SHARED_LIBRARY_CREATE_ MESSAGE("CMAKE_DL_LIBS is ${CMAKE_DL_LIBS}") MESSAGE("CMAKE_SHARED_LIBRARY_PREFIX is ${CMAKE_SHARED_LIBRARY_PREFIX}") MESSAGE("CMAKE_SHARED_LIBRARY_SUFFIX is ${CMAKE_SHARED_LIBRARY_SUFFIX}") -MESSAGE("CMAKE_COMPILER_IS_GNUGCC = ${CMAKE_COMPILER_IS_GNUGCC}") +MESSAGE("CMAKE_COMPILER_IS_GNUCC = ${CMAKE_COMPILER_IS_GNUCC}") MESSAGE("CMAKE_COMPILER_IS_GNUCXX = ${CMAKE_COMPILER_IS_GNUCXX}") MESSAGE("CMAKE_CXX_CREATE_SHARED_LIBRARY is ${CMAKE_CXX_CREATE_SHARED_LIBRARY}") diff --git a/Modules/CMakeTestCCompiler.cmake b/Modules/CMakeTestCCompiler.cmake index eeaff7d64..bac993260 100644 --- a/Modules/CMakeTestCCompiler.cmake +++ b/Modules/CMakeTestCCompiler.cmake @@ -74,6 +74,7 @@ ELSE(NOT CMAKE_C_COMPILER_WORKS) ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCCompiler.cmake @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0 ) + INCLUDE(${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCCompiler.cmake) ENDIF(CMAKE_C_COMPILER_FORCED) ENDIF(NOT CMAKE_C_COMPILER_WORKS) diff --git a/Modules/CMakeTestCXXCompiler.cmake b/Modules/CMakeTestCXXCompiler.cmake index 72bb8f2c9..06ef30136 100644 --- a/Modules/CMakeTestCXXCompiler.cmake +++ b/Modules/CMakeTestCXXCompiler.cmake @@ -67,5 +67,6 @@ ELSE(NOT CMAKE_CXX_COMPILER_WORKS) ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCXXCompiler.cmake @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0 ) + INCLUDE(${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCXXCompiler.cmake) ENDIF(CMAKE_CXX_COMPILER_FORCED) ENDIF(NOT CMAKE_CXX_COMPILER_WORKS) diff --git a/Modules/CMakeTestFortranCompiler.cmake b/Modules/CMakeTestFortranCompiler.cmake index 6f419c28b..61d6336a5 100644 --- a/Modules/CMakeTestFortranCompiler.cmake +++ b/Modules/CMakeTestFortranCompiler.cmake @@ -90,5 +90,6 @@ ELSE(NOT CMAKE_Fortran_COMPILER_WORKS) ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeFortranCompiler.cmake @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0 ) + INCLUDE(${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeFortranCompiler.cmake) ENDIF(CMAKE_Fortran_COMPILER_FORCED) ENDIF(NOT CMAKE_Fortran_COMPILER_WORKS) diff --git a/Modules/CMakeVS10FindMake.cmake b/Modules/CMakeVS10FindMake.cmake index 8233e520b..460de25e5 100644 --- a/Modules/CMakeVS10FindMake.cmake +++ b/Modules/CMakeVS10FindMake.cmake @@ -12,38 +12,14 @@ # (To distributed this file outside of CMake, substitute the full # License text for the above reference.) -# VCExpress does not support cross compiling, which is necessary for Win CE -SET( _CMAKE_MAKE_PROGRAM_NAMES devenv) -IF(NOT CMAKE_CROSSCOMPILING) - SET( _CMAKE_MAKE_PROGRAM_NAMES ${_CMAKE_MAKE_PROGRAM_NAMES} VCExpress) -ENDIF(NOT CMAKE_CROSSCOMPILING) - +# We use MSBuild as the build tool for VS 10 FIND_PROGRAM(CMAKE_MAKE_PROGRAM NAMES MSBuild - HINTS + HINTS + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup\\VS;ProductDir] "$ENV{SYSTEMROOT}/Microsoft.NET/Framework/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;CLR Version]/" "c:/WINDOWS/Microsoft.NET/Framework/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;CLR Version]/" - ) - -FIND_PROGRAM(CMAKE_MAKE_PROGRAM - NAMES ${_CMAKE_MAKE_PROGRAM_NAMES} - HINTS - [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup\\VS;EnvironmentDirectory] - [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup;Dbghelp_path] - "$ENV{ProgramFiles}/Microsoft Visual Studio 10.0/Common7/IDE" - "$ENV{ProgramFiles}/Microsoft Visual Studio10.0/Common7/IDE" - "$ENV{ProgramFiles}/Microsoft Visual Studio 10/Common7/IDE" - "$ENV{ProgramFiles}/Microsoft Visual Studio10/Common7/IDE" - "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 10.0/Common7/IDE" - "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio10.0/Common7/IDE" - "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 10/Common7/IDE" - "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio10/Common7/IDE" - "/Program Files/Microsoft Visual Studio 10.0/Common7/IDE/" - "/Program Files/Microsoft Visual Studio 10/Common7/IDE/" - PATHS - "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio .NET/Common7/IDE" - "$ENV{ProgramFiles}/Microsoft Visual Studio .NET/Common7/IDE" - + "$ENV{SYSTEMROOT}/Microsoft.NET/Framework/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\10.0;CLR Version]/" ) MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM) diff --git a/Modules/CMakeVS8FindMake.cmake b/Modules/CMakeVS8FindMake.cmake index 6f45ed589..2f03e60de 100644 --- a/Modules/CMakeVS8FindMake.cmake +++ b/Modules/CMakeVS8FindMake.cmake @@ -28,9 +28,6 @@ FIND_PROGRAM(CMAKE_MAKE_PROGRAM "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 8/Common7/IDE" "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio8/Common7/IDE" "/Program Files/Microsoft Visual Studio 8/Common7/IDE/" - PATHS - "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio .NET/Common7/IDE" - "$ENV{ProgramFiles}/Microsoft Visual Studio .NET/Common7/IDE" ) MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM) SET(MSVC80 1) diff --git a/Modules/CMakeVS9FindMake.cmake b/Modules/CMakeVS9FindMake.cmake index 2741f77d8..4704bcc21 100644 --- a/Modules/CMakeVS9FindMake.cmake +++ b/Modules/CMakeVS9FindMake.cmake @@ -33,10 +33,6 @@ FIND_PROGRAM(CMAKE_MAKE_PROGRAM "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio9/Common7/IDE" "/Program Files/Microsoft Visual Studio 9.0/Common7/IDE/" "/Program Files/Microsoft Visual Studio 9/Common7/IDE/" - PATHS - "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio .NET/Common7/IDE" - "$ENV{ProgramFiles}/Microsoft Visual Studio .NET/Common7/IDE" - ) MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM) SET(MSVC90 1) diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index 29a12184f..3bf8e0e10 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -49,6 +49,14 @@ # CPACK_RPM_PACKAGE_DESCRIPTION # Mandatory : YES # Default : CPACK_PACKAGE_DESCRIPTION_FILE if set or "no package description available" +# CPACK_RPM_COMPRESSION_TYPE +# Mandatory : NO +# Default : - +# May be used to override RPM compression type to be used +# to build the RPM. For example some Linux distribution now default +# to lzma or xz compression whereas older cannot use such RPM. +# Using this one can enforce compression type to be used. +# Possible value are: lzma, xz, bzip2 and gzip. # CPACK_RPM_PACKAGE_REQUIRES # Mandatory : NO # Default : - @@ -265,6 +273,27 @@ IF (NOT CPACK_RPM_PACKAGE_DESCRIPTION) ENDIF (CPACK_PACKAGE_DESCRIPTION_FILE) ENDIF (NOT CPACK_RPM_PACKAGE_DESCRIPTION) +# CPACK_RPM_COMPRESSION_TYPE +# +IF (CPACK_RPM_COMPRESSION_TYPE) + IF(CPACK_RPM_PACKAGE_DEBUG) + MESSAGE("CPackRPM:Debug: User Specified RPM compression type: ${CPACK_RPM_COMPRESSION_TYPE}") + ENDIF(CPACK_RPM_PACKAGE_DEBUG) + IF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "lzma") + SET(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.lzdio") + ENDIF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "lzma") + IF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "xz") + SET(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w7.xzdio") + ENDIF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "xz") + IF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "bzip2") + SET(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.bzdio") + ENDIF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "bzip2") + IF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "gzip") + SET(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.gzdio") + ENDIF(CPACK_RPM_COMPRESSION_TYPE STREQUAL "gzip") +ELSE(CPACK_RPM_COMPRESSION_TYPE) + SET(CPACK_RPM_COMPRESSION_TYPE_TMP "") +ENDIF(CPACK_RPM_COMPRESSION_TYPE) # CPACK_RPM_PACKAGE_REQUIRES # Placeholder used to specify binary RPM dependencies (if any) # see http://www.rpm.org/max-rpm/s1-rpm-depend-manual-dependencies.html @@ -419,6 +448,7 @@ Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@ %define _topdir \@CPACK_RPM_DIRECTORY\@ \@TMP_RPM_SPEC_INSTALL_POST\@ \@CPACK_RPM_SPEC_MORE_DEFINE\@ +\@CPACK_RPM_COMPRESSION_TYPE_TMP\@ %description \@CPACK_RPM_PACKAGE_DESCRIPTION\@ @@ -459,6 +489,8 @@ fi ${CPACK_RPM_INSTALL_FILES} %changelog +* Sun Apr 4 2010 Erk + Add support for specifying RPM compression type * Sat Nov 28 2009 Erk Refix backup/restore install tree for OpenSuSE 11.2 * Sun Nov 22 2009 Erk diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake new file mode 100644 index 000000000..f7baf686a --- /dev/null +++ b/Modules/Compiler/Clang-C.cmake @@ -0,0 +1 @@ +include(Compiler/GNU-C) diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake new file mode 100644 index 000000000..d3c403a69 --- /dev/null +++ b/Modules/Compiler/Clang-CXX.cmake @@ -0,0 +1 @@ +include(Compiler/GNU-CXX) diff --git a/Modules/Compiler/SunPro-C.cmake b/Modules/Compiler/SunPro-C.cmake index 4ac918ed1..656eea624 100644 --- a/Modules/Compiler/SunPro-C.cmake +++ b/Modules/Compiler/SunPro-C.cmake @@ -1,11 +1,11 @@ +SET(CMAKE_C_VERBOSE_FLAG "-#") + SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-KPIC") SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-G") SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-R") SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-h") -SET(CMAKE_C_VERBOSE_FLAG "-#") - SET(CMAKE_C_FLAGS_INIT "") SET(CMAKE_C_FLAGS_DEBUG_INIT "-g") SET(CMAKE_C_FLAGS_MINSIZEREL_INIT "-xO2 -xspace -DNDEBUG") diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake index fe549d637..3e07e8e48 100644 --- a/Modules/Compiler/SunPro-CXX.cmake +++ b/Modules/Compiler/SunPro-CXX.cmake @@ -1,11 +1,11 @@ +SET(CMAKE_CXX_VERBOSE_FLAG "-v") + SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-KPIC") SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-G") SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-R") SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP ":") SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-h") -SET(CMAKE_CXX_VERBOSE_FLAG "-v") - SET(CMAKE_CXX_FLAGS_INIT "") SET(CMAKE_CXX_FLAGS_DEBUG_INIT "-g") SET(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-xO2 -xspace -DNDEBUG") diff --git a/Modules/Compiler/SunPro-Fortran.cmake b/Modules/Compiler/SunPro-Fortran.cmake index ae38f86f7..a41b45456 100644 --- a/Modules/Compiler/SunPro-Fortran.cmake +++ b/Modules/Compiler/SunPro-Fortran.cmake @@ -1,3 +1,5 @@ +SET(CMAKE_Fortran_VERBOSE_FLAG "-v") + SET(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-KPIC") SET(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-G") SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG "-R") @@ -12,4 +14,3 @@ SET(CMAKE_Fortran_FLAGS_RELEASE_INIT "-xO3 -DNDEBUG") SET(CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "-g -xO2") SET(CMAKE_Fortran_MODDIR_FLAG "-moddir=") SET(CMAKE_Fortran_MODPATH_FLAG "-M") -SET(CMAKE_Fortran_VERBOSE_FLAG "-v") diff --git a/Modules/Compiler/XL-Fortran.cmake b/Modules/Compiler/XL-Fortran.cmake index 6133f5638..cf9b2b657 100644 --- a/Modules/Compiler/XL-Fortran.cmake +++ b/Modules/Compiler/XL-Fortran.cmake @@ -1,4 +1,5 @@ SET(CMAKE_Fortran_VERBOSE_FLAG "-V") + SET(CMAKE_Fortran_DEFINE_FLAG "-WF,-D") SET(CMAKE_Fortran_FLAGS_DEBUG_INIT "-g") diff --git a/Modules/DartConfiguration.tcl.in b/Modules/DartConfiguration.tcl.in index be2b691ee..51f514fde 100644 --- a/Modules/DartConfiguration.tcl.in +++ b/Modules/DartConfiguration.tcl.in @@ -7,6 +7,9 @@ SourceDirectory: @PROJECT_SOURCE_DIR@ BuildDirectory: @PROJECT_BINARY_DIR@ +# Where to place the cost data store +CostDataFile: @CTEST_COST_DATA_FILE@ + # Site is something like machine.domain, i.e. pragmatic.crd Site: @SITE@ @@ -43,6 +46,11 @@ CVSUpdateOptions: @CVS_UPDATE_OPTIONS@ SVNCommand: @SVNCOMMAND@ SVNUpdateOptions: @SVN_UPDATE_OPTIONS@ +# Git options +GITCommand: @GITCOMMAND@ +GITUpdateOptions: @GIT_UPDATE_OPTIONS@ +GITUpdateCustom: @CTEST_GIT_UPDATE_CUSTOM@ + # Generic update command UpdateCommand: @UPDATE_COMMAND@ UpdateOptions: @UPDATE_OPTIONS@ diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 0302d5c4b..d0845e6c8 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -16,7 +16,12 @@ # [CVS_TAG tag] # Tag to checkout from CVS repo # [SVN_REPOSITORY url] # URL of Subversion repo # [SVN_REVISION rev] # Revision to checkout from Subversion repo +# [SVN_USERNAME john ] # Username for Subversion checkout and update +# [SVN_PASSWORD doe ] # Password for Subversion checkout and update +# [GIT_REPOSITORY url] # URL of git repo +# [GIT_TAG tag] # Git branch name, commit id or tag # [URL /.../src.tgz] # Full path or URL of source +# [URL_MD5 md5] # MD5 checksum of file at URL # [TIMEOUT seconds] # Time allowed for file download operations # #--Update/Patch step---------- # [UPDATE_COMMAND cmd...] # Source work-tree update command @@ -111,19 +116,19 @@ # License text for the above reference.) # Pre-compute a regex to match documented keywords for each command. -file(STRINGS "${CMAKE_CURRENT_LIST_FILE}" lines LIMIT_COUNT 100 - REGEX "^# ( \\[[A-Z_]+ [^]]*\\] +#.*$|[A-Za-z_]+\\()") +file(STRINGS "${CMAKE_CURRENT_LIST_FILE}" lines LIMIT_COUNT 103 + REGEX "^# ( \\[[A-Z0-9_]+ [^]]*\\] +#.*$|[A-Za-z0-9_]+\\()") foreach(line IN LISTS lines) - if("${line}" MATCHES "^# [A-Za-z_]+\\(") + if("${line}" MATCHES "^# [A-Za-z0-9_]+\\(") if(_ep_func) set(_ep_keywords_${_ep_func} "${_ep_keywords_${_ep_func}})$") endif() - string(REGEX REPLACE "^# ([A-Za-z_]+)\\(.*" "\\1" _ep_func "${line}") + string(REGEX REPLACE "^# ([A-Za-z0-9_]+)\\(.*" "\\1" _ep_func "${line}") #message("function [${_ep_func}]") set(_ep_keywords_${_ep_func} "^(") set(_ep_keyword_sep) else() - string(REGEX REPLACE "^# \\[([A-Z_]+) .*" "\\1" _ep_key "${line}") + string(REGEX REPLACE "^# \\[([A-Z0-9_]+) .*" "\\1" _ep_key "${line}") #message(" keyword [${_ep_key}]") set(_ep_keywords_${_ep_func} "${_ep_keywords_${_ep_func}}${_ep_keyword_sep}${_ep_key}") @@ -148,7 +153,7 @@ function(_ep_parse_arguments f name ns args) foreach(arg IN LISTS args) set(is_value 1) - if(arg MATCHES "^[A-Z][A-Z_][A-Z_]+$" AND + if(arg MATCHES "^[A-Z][A-Z0-9_][A-Z0-9_]+$" AND NOT ((arg STREQUAL "${key}") AND (key STREQUAL "COMMAND")) AND NOT arg MATCHES "^(TRUE|FALSE)$") if(_ep_keywords_${f} AND arg MATCHES "${_ep_keywords_${f}}") @@ -157,6 +162,7 @@ function(_ep_parse_arguments f name ns args) if(NOT (key STREQUAL "COMMAND") AND NOT (key STREQUAL "CVS_MODULE") AND NOT (key STREQUAL "DEPENDS") + AND NOT (key STREQUAL "DOWNLOAD_COMMAND") ) message(AUTHOR_WARNING "unknown ${f} keyword: ${arg}") endif() @@ -203,7 +209,63 @@ define_property(DIRECTORY PROPERTY "EP_PREFIX" INHERITED ) -function(_ep_write_downloadfile_script script_filename remote local timeout) +function(_ep_write_gitclone_script script_filename source_dir git_EXECUTABLE git_repository git_tag src_name work_dir) + file(WRITE ${script_filename} +"if(\"${git_tag}\" STREQUAL \"\") + message(FATAL_ERROR \"Tag for git checkout should not be empty.\") +endif() + +execute_process( + COMMAND \${CMAKE_COMMAND} -E remove_directory \"${source_dir}\" + RESULT_VARIABLE error_code + ) +if(error_code) + message(FATAL_ERROR \"Failed to remove directory: '${source_dir}'\") +endif() + +execute_process( + COMMAND \"${git_EXECUTABLE}\" clone \"${git_repository}\" \"${src_name}\" + WORKING_DIRECTORY \"${work_dir}\" + RESULT_VARIABLE error_code + ) +if(error_code) + message(FATAL_ERROR \"Failed to clone repository: '${git_repository}'\") +endif() + +execute_process( + COMMAND \"${git_EXECUTABLE}\" checkout ${git_tag} + WORKING_DIRECTORY \"${work_dir}/${src_name}\" + RESULT_VARIABLE error_code + ) +if(error_code) + message(FATAL_ERROR \"Failed to checkout tag: '${git_tag}'\") +endif() + +execute_process( + COMMAND \"${git_EXECUTABLE}\" submodule init + WORKING_DIRECTORY \"${work_dir}/${src_name}\" + RESULT_VARIABLE error_code + ) +if(error_code) + message(FATAL_ERROR \"Failed to init submodules in: '${work_dir}/${src_name}'\") +endif() + +execute_process( + COMMAND \"${git_EXECUTABLE}\" submodule update --recursive + WORKING_DIRECTORY \"${work_dir}/${src_name}\" + RESULT_VARIABLE error_code + ) +if(error_code) + message(FATAL_ERROR \"Failed to update submodules in: '${work_dir}/${src_name}'\") +endif() + +" +) + +endfunction(_ep_write_gitclone_script) + + +function(_ep_write_downloadfile_script script_filename remote local timeout md5) if(timeout) set(timeout_args TIMEOUT ${timeout}) set(timeout_msg "${timeout} seconds") @@ -212,6 +274,12 @@ function(_ep_write_downloadfile_script script_filename remote local timeout) set(timeout_msg "none") endif() + if(md5) + set(md5_args EXPECTED_MD5 ${md5}) + else() + set(md5_args "# no EXPECTED_MD5") + endif() + file(WRITE ${script_filename} "message(STATUS \"downloading... src='${remote}' @@ -221,6 +289,8 @@ function(_ep_write_downloadfile_script script_filename remote local timeout) file(DOWNLOAD \"${remote}\" \"${local}\" + SHOW_PROGRESS + ${md5_args} ${timeout_args} STATUS status LOG log) @@ -243,23 +313,64 @@ message(STATUS \"downloading... done\") endfunction(_ep_write_downloadfile_script) -function(_ep_write_extractfile_script script_filename filename tmp directory) - set(args "") +function(_ep_write_verifyfile_script script_filename local md5) + file(WRITE ${script_filename} +"message(STATUS \"verifying file... + file='${local}'\") - if(filename MATCHES ".tar$") - set(args xf) +set(verified 0) + +# If an expected md5 checksum exists, compare against it: +# +if(NOT \"${md5}\" STREQUAL \"\") + execute_process(COMMAND \${CMAKE_COMMAND} -E md5sum \"${local}\" + OUTPUT_VARIABLE ov + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE rv) + + if(NOT rv EQUAL 0) + message(FATAL_ERROR \"error: computing md5sum of '${local}' failed\") endif() - if(filename MATCHES ".tgz$") - set(args xfz) + string(REGEX MATCH \"^([0-9A-Fa-f]+)\" md5_actual \"\${ov}\") + + string(TOLOWER \"\${md5_actual}\" md5_actual) + string(TOLOWER \"${md5}\" md5) + + if(NOT \"\${md5}\" STREQUAL \"\${md5_actual}\") + message(FATAL_ERROR \"error: md5sum of '${local}' does not match expected value + md5_expected: \${md5} + md5_actual: \${md5_actual} +\") endif() - if(filename MATCHES ".tar.gz$") + set(verified 1) +endif() + +if(verified) + message(STATUS \"verifying file... done\") +else() + message(STATUS \"verifying file... warning: did not verify file - no URL_MD5 checksum argument? corrupt file?\") +endif() +" +) + +endfunction(_ep_write_verifyfile_script) + + +function(_ep_write_extractfile_script script_filename filename directory) + set(args "") + + if(filename MATCHES "(\\.bz2|\\.tar\\.gz|\\.tgz|\\.zip)$") set(args xfz) endif() + if(filename MATCHES "\\.tar$") + set(args xf) + endif() + if(args STREQUAL "") - message(SEND_ERROR "error: do not know how to extract '${filename}' -- known types are .tar, .tgz and .tar.gz") + message(SEND_ERROR "error: do not know how to extract '${filename}' -- known types are .bz2, .tar, .tar.gz, .tgz and .zip") return() endif() @@ -267,20 +378,23 @@ function(_ep_write_extractfile_script script_filename filename tmp directory) "# Make file names absolute: # get_filename_component(filename \"${filename}\" ABSOLUTE) -get_filename_component(tmp \"${tmp}\" ABSOLUTE) get_filename_component(directory \"${directory}\" ABSOLUTE) message(STATUS \"extracting... src='\${filename}' dst='\${directory}'\") +if(NOT EXISTS \"\${filename}\") + message(FATAL_ERROR \"error: file to extract does not exist: '\${filename}'\") +endif() + # Prepare a space for extracting: # -set(i 1) -while(EXISTS \"\${tmp}/extract\${i}\") +set(i 1234) +while(EXISTS \"\${directory}/../ex\${i}\") math(EXPR i \"\${i} + 1\") endwhile() -set(ut_dir \"\${tmp}/extract\${i}\") +set(ut_dir \"\${directory}/../ex\${i}\") file(MAKE_DIRECTORY \"\${ut_dir}\") # Extract it: @@ -305,10 +419,12 @@ if(NOT n EQUAL 1 OR NOT IS_DIRECTORY \"\${contents}\") set(contents \"\${ut_dir}\") endif() -# Copy \"the one\" directory to the final directory: +# Move \"the one\" directory to the final directory: # -message(STATUS \"extracting... [copy]\") -file(COPY \"\${contents}/\" DESTINATION \${directory}) +message(STATUS \"extracting... [rename]\") +file(REMOVE_RECURSE \${directory}) +get_filename_component(contents \${contents} ABSOLUTE) +file(RENAME \${contents} \${directory}) # Clean up: # @@ -609,6 +725,29 @@ function(_ep_add_mkdir_command name) endfunction(_ep_add_mkdir_command) +function(_ep_get_git_version git_EXECUTABLE git_version_var) + if(git_EXECUTABLE) + execute_process( + COMMAND "${git_EXECUTABLE}" --version + OUTPUT_VARIABLE ov + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + string(REGEX REPLACE "^git version (.+)$" "\\1" version "${ov}") + set(${git_version_var} "${version}" PARENT_SCOPE) + endif() +endfunction() + + +function(_ep_is_dir_empty dir empty_var) + file(GLOB gr "${dir}/*") + if("${gr}" STREQUAL "") + set(${empty_var} 1 PARENT_SCOPE) + else() + set(${empty_var} 0 PARENT_SCOPE) + endif() +endfunction() + + function(_ep_add_download_command name) ExternalProject_Get_Property(${name} source_dir stamp_dir download_dir tmp_dir) @@ -616,6 +755,7 @@ function(_ep_add_download_command name) get_property(cmd TARGET ${name} PROPERTY _EP_DOWNLOAD_COMMAND) get_property(cvs_repository TARGET ${name} PROPERTY _EP_CVS_REPOSITORY) get_property(svn_repository TARGET ${name} PROPERTY _EP_SVN_REPOSITORY) + get_property(git_repository TARGET ${name} PROPERTY _EP_GIT_REPOSITORY) get_property(url TARGET ${name} PROPERTY _EP_URL) # TODO: Perhaps file:// should be copied to download dir before extraction. @@ -661,8 +801,10 @@ function(_ep_add_download_command name) endif() get_property(svn_revision TARGET ${name} PROPERTY _EP_SVN_REVISION) + get_property(svn_username TARGET ${name} PROPERTY _EP_SVN_USERNAME) + get_property(svn_password TARGET ${name} PROPERTY _EP_SVN_PASSWORD) - set(repository ${svn_repository}) + set(repository "${svn_repository} user=${svn_username} password=${svn_password}") set(module) set(tag ${svn_revision}) configure_file( @@ -674,13 +816,55 @@ function(_ep_add_download_command name) get_filename_component(src_name "${source_dir}" NAME) get_filename_component(work_dir "${source_dir}" PATH) set(comment "Performing download step (SVN checkout) for '${name}'") - set(cmd ${Subversion_SVN_EXECUTABLE} co ${svn_repository} ${svn_revision} ${src_name}) + set(cmd ${Subversion_SVN_EXECUTABLE} co ${svn_repository} ${svn_revision} + --username=${svn_username} --password=${svn_password} ${src_name}) list(APPEND depends ${stamp_dir}/${name}-svninfo.txt) + elseif(git_repository) + find_package(Git) + if(NOT GIT_EXECUTABLE) + message(FATAL_ERROR "error: could not find git for clone of ${name}") + endif() + + # The git submodule update '--recursive' flag requires git >= v1.6.5 + # + _ep_get_git_version("${GIT_EXECUTABLE}" git_version) + if(git_version VERSION_LESS 1.6.5) + message(FATAL_ERROR "error: git version 1.6.5 or later required for 'git submodule update --recursive': git_version='${git_version}'") + endif() + + get_property(git_tag TARGET ${name} PROPERTY _EP_GIT_TAG) + if(NOT git_tag) + set(git_tag "master") + endif() + + set(repository ${git_repository}) + set(module) + set(tag ${git_tag}) + configure_file( + "${CMAKE_ROOT}/Modules/RepositoryInfo.txt.in" + "${stamp_dir}/${name}-gitinfo.txt" + @ONLY + ) + + get_filename_component(src_name "${source_dir}" NAME) + get_filename_component(work_dir "${source_dir}" PATH) + + # Since git clone doesn't succeed if the non-empty source_dir exists, + # create a cmake script to invoke as download command. + # The script will delete the source directory and then call git clone. + # + _ep_write_gitclone_script(${tmp_dir}/${name}-gitclone.cmake ${source_dir} + ${GIT_EXECUTABLE} ${git_repository} ${git_tag} ${src_name} ${work_dir} + ) + set(comment "Performing download step (git clone) for '${name}'") + set(cmd ${CMAKE_COMMAND} -P ${tmp_dir}/${name}-gitclone.cmake) + list(APPEND depends ${stamp_dir}/${name}-gitinfo.txt) elseif(url) get_filename_component(work_dir "${source_dir}" PATH) + get_property(md5 TARGET ${name} PROPERTY _EP_URL_MD5) set(repository "external project URL") set(module "${url}") - set(tag "") + set(tag "${md5}") configure_file( "${CMAKE_ROOT}/Modules/RepositoryInfo.txt.in" "${stamp_dir}/${name}-urlinfo.txt" @@ -696,25 +880,30 @@ function(_ep_add_download_command name) if("${url}" MATCHES "^[a-z]+://") # TODO: Should download and extraction be different steps? string(REGEX MATCH "[^/]*$" fname "${url}") - if(NOT "${fname}" MATCHES "\\.(tar|tgz|tar\\.gz)$") + if(NOT "${fname}" MATCHES "\\.(bz2|tar|tgz|tar\\.gz|zip)$") message(FATAL_ERROR "Could not extract tarball filename from url:\n ${url}") endif() set(file ${download_dir}/${fname}) get_property(timeout TARGET ${name} PROPERTY _EP_TIMEOUT) - _ep_write_downloadfile_script("${stamp_dir}/download-${name}.cmake" "${url}" "${file}" "${timeout}") + _ep_write_downloadfile_script("${stamp_dir}/download-${name}.cmake" "${url}" "${file}" "${timeout}" "${md5}") set(cmd ${CMAKE_COMMAND} -P ${stamp_dir}/download-${name}.cmake COMMAND) - set(comment "Performing download step (download and extract) for '${name}'") + set(comment "Performing download step (download, verify and extract) for '${name}'") else() set(file "${url}") - set(comment "Performing download step (extract) for '${name}'") + set(comment "Performing download step (verify and extract) for '${name}'") endif() + _ep_write_verifyfile_script("${stamp_dir}/verify-${name}.cmake" "${file}" "${md5}") + list(APPEND cmd ${CMAKE_COMMAND} -P ${stamp_dir}/verify-${name}.cmake) # TODO: Support other archive formats. - _ep_write_extractfile_script("${stamp_dir}/extract-${name}.cmake" "${file}" "${tmp_dir}" "${source_dir}") + _ep_write_extractfile_script("${stamp_dir}/extract-${name}.cmake" "${file}" "${source_dir}") list(APPEND cmd ${CMAKE_COMMAND} -P ${stamp_dir}/extract-${name}.cmake) endif() else() - message(SEND_ERROR "error: no download info for '${name}' -- please specify existing SOURCE_DIR or one of URL, CVS_REPOSITORY and CVS_MODULE, SVN_REPOSITORY or DOWNLOAD_COMMAND") + _ep_is_dir_empty("${source_dir}" empty) + if(${empty}) + message(SEND_ERROR "error: no download info for '${name}' -- please specify existing/non-empty SOURCE_DIR or one of URL, CVS_REPOSITORY and CVS_MODULE, SVN_REPOSITORY, GIT_REPOSITORY or DOWNLOAD_COMMAND") + endif() endif() ExternalProject_Add_Step(${name} download @@ -734,6 +923,7 @@ function(_ep_add_update_command name) get_property(cmd TARGET ${name} PROPERTY _EP_UPDATE_COMMAND) get_property(cvs_repository TARGET ${name} PROPERTY _EP_CVS_REPOSITORY) get_property(svn_repository TARGET ${name} PROPERTY _EP_SVN_REPOSITORY) + get_property(git_repository TARGET ${name} PROPERTY _EP_GIT_REPOSITORY) set(work_dir) set(comment) @@ -757,7 +947,25 @@ function(_ep_add_update_command name) set(work_dir ${source_dir}) set(comment "Performing update step (SVN update) for '${name}'") get_property(svn_revision TARGET ${name} PROPERTY _EP_SVN_REVISION) - set(cmd ${Subversion_SVN_EXECUTABLE} up ${svn_revision}) + get_property(svn_username TARGET ${name} PROPERTY _EP_SVN_USERNAME) + get_property(svn_password TARGET ${name} PROPERTY _EP_SVN_PASSWORD) + set(cmd ${Subversion_SVN_EXECUTABLE} up ${svn_revision} + --username=${svn_username} --password=${svn_password}) + set(always 1) + elseif(git_repository) + if(NOT GIT_EXECUTABLE) + message(FATAL_ERROR "error: could not find git for fetch of ${name}") + endif() + set(work_dir ${source_dir}) + set(comment "Performing update step (git fetch) for '${name}'") + get_property(git_tag TARGET ${name} PROPERTY _EP_GIT_TAG) + if(NOT git_tag) + set(git_tag "master") + endif() + set(cmd ${GIT_EXECUTABLE} fetch + COMMAND ${GIT_EXECUTABLE} checkout ${git_tag} + COMMAND ${GIT_EXECUTABLE} submodule update --recursive + ) set(always 1) endif() @@ -793,7 +1001,7 @@ endfunction(_ep_add_patch_command) # TODO: Make sure external projects use the proper compiler function(_ep_add_configure_command name) - ExternalProject_Get_Property(${name} source_dir binary_dir) + ExternalProject_Get_Property(${name} source_dir binary_dir tmp_dir) _ep_get_configuration_subdir_suffix(cfgdir) @@ -827,6 +1035,16 @@ function(_ep_add_configure_command name) endif() endif() + # If anything about the configure command changes, (command itself, cmake + # used, cmake args or cmake generator) then re-run the configure step. + # Fixes issue http://public.kitware.com/Bug/view.php?id=10258 + # + if(NOT EXISTS ${tmp_dir}/${name}-cfgcmd.txt.in) + file(WRITE ${tmp_dir}/${name}-cfgcmd.txt.in "cmd='@cmd@'\n") + endif() + configure_file(${tmp_dir}/${name}-cfgcmd.txt.in ${tmp_dir}/${name}-cfgcmd.txt) + list(APPEND file_deps ${tmp_dir}/${name}-cfgcmd.txt) + ExternalProject_Add_Step(${name} configure COMMAND ${cmd} WORKING_DIRECTORY ${binary_dir} diff --git a/Modules/FindASPELL.cmake b/Modules/FindASPELL.cmake index c11c2e33b..a211ab06f 100644 --- a/Modules/FindASPELL.cmake +++ b/Modules/FindASPELL.cmake @@ -20,11 +20,6 @@ # (To distributed this file outside of CMake, substitute the full # License text for the above reference.) -IF (ASPELL_INCLUDE_DIR AND ASPELL_LIBRARIES) - # Already in cache, be silent - SET(ASPELL_FIND_QUIETLY TRUE) -ENDIF (ASPELL_INCLUDE_DIR AND ASPELL_LIBRARIES) - FIND_PATH(ASPELL_INCLUDE_DIR aspell.h ) FIND_LIBRARY(ASPELL_LIBRARIES NAMES aspell aspell-15 libaspell-15 libaspell) @@ -34,5 +29,4 @@ FIND_LIBRARY(ASPELL_LIBRARIES NAMES aspell aspell-15 libaspell-15 libaspell) INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(ASPELL DEFAULT_MSG ASPELL_LIBRARIES ASPELL_INCLUDE_DIR) - MARK_AS_ADVANCED(ASPELL_INCLUDE_DIR ASPELL_LIBRARIES) diff --git a/Modules/FindAVIFile.cmake b/Modules/FindAVIFile.cmake index ff140f64c..7272ba64e 100644 --- a/Modules/FindAVIFile.cmake +++ b/Modules/FindAVIFile.cmake @@ -35,16 +35,14 @@ IF (UNIX) ENDIF (UNIX) -SET (AVIFILE_FOUND "NO") - -IF(AVIFILE_INCLUDE_DIR) - IF(AVIFILE_AVIPLAY_LIBRARY) - SET( AVIFILE_LIBRARIES ${AVIFILE_AVIPLAY_LIBRARY} ) - SET( AVIFILE_FOUND "YES" ) - SET( AVIFILE_DEFINITIONS "") - - ENDIF(AVIFILE_AVIPLAY_LIBRARY) -ENDIF(AVIFILE_INCLUDE_DIR) - +# handle the QUIETLY and REQUIRED arguments and set AVIFILE_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(AVIFile DEFAULT_MSG AVIFILE_INCLUDE_DIR AVIFILE_AVIPLAY_LIBRARY) + +IF (AVIFILE_FOUND) + SET(AVIFILE_LIBRARIES ${AVIFILE_AVIPLAY_LIBRARY}) + SET(AVIFILE_DEFINITIONS "") +ENDIF() MARK_AS_ADVANCED(AVIFILE_INCLUDE_DIR AVIFILE_AVIPLAY_LIBRARY) diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake index c969e4388..2dcc9b457 100644 --- a/Modules/FindBZip2.cmake +++ b/Modules/FindBZip2.cmake @@ -4,7 +4,6 @@ # BZIP2_FOUND - system has BZip2 # BZIP2_INCLUDE_DIR - the BZip2 include directory # BZIP2_LIBRARIES - Link these to use BZip2 -# BZIP2_DEFINITIONS - Compiler switches required for using BZip2 # BZIP2_NEED_PREFIX - this is set if the functions are prefixed with BZ2_ #============================================================================= @@ -21,10 +20,6 @@ # (To distributed this file outside of CMake, substitute the full # License text for the above reference.) -IF (BZIP2_INCLUDE_DIR AND BZIP2_LIBRARIES) - SET(BZip2_FIND_QUIETLY TRUE) -ENDIF (BZIP2_INCLUDE_DIR AND BZIP2_LIBRARIES) - FIND_PATH(BZIP2_INCLUDE_DIR bzlib.h ) FIND_LIBRARY(BZIP2_LIBRARIES NAMES bz2 bzip2 ) diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 6539057ba..17da9e926 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -484,6 +484,10 @@ if(CUDA_NVCC_EXECUTABLE AND NOT CUDA_VERSION) string(REGEX REPLACE ".*release ([0-9]+)\\.([0-9]+).*" "\\2" CUDA_VERSION_MINOR ${NVCC_OUT}) set(CUDA_VERSION "${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR}" CACHE STRING "Version of CUDA as computed from nvcc.") mark_as_advanced(CUDA_VERSION) +else() + # Need to set these based off of the cached value + string(REGEX REPLACE "([0-9]+)\\.([0-9]+).*" "\\1" CUDA_VERSION_MAJOR "${CUDA_VERSION}") + string(REGEX REPLACE "([0-9]+)\\.([0-9]+).*" "\\2" CUDA_VERSION_MINOR "${CUDA_VERSION}") endif() # Always set this convenience variable diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake index fa6819039..791e6a918 100644 --- a/Modules/FindCurses.cmake +++ b/Modules/FindCurses.cmake @@ -33,6 +33,15 @@ SET(CURSES_USE_NCURSES FALSE) IF(CURSES_NCURSES_LIBRARY AND NOT CURSES_CURSES_LIBRARY) SET(CURSES_USE_NCURSES TRUE) ENDIF(CURSES_NCURSES_LIBRARY AND NOT CURSES_CURSES_LIBRARY) +# http://cygwin.com/ml/cygwin-announce/2010-01/msg00002.html +# cygwin ncurses stopped providing curses.h symlinks see above +# message. Cygwin is an ncurses package, so force ncurses on +# cygwin if the curses.h is missing +IF(CYGWIN) + IF(NOT EXISTS /usr/include/curses.h) + SET(CURSES_USE_NCURSES TRUE) + ENDIF() +ENDIF() # Not sure the logic is correct here. diff --git a/Modules/FindDCMTK.cmake b/Modules/FindDCMTK.cmake index 2c3fce5b9..d35433a27 100644 --- a/Modules/FindDCMTK.cmake +++ b/Modules/FindDCMTK.cmake @@ -1,7 +1,7 @@ # - find DCMTK libraries and applications # -# DCMTK_INCLUDE_DIR - Directories to include to use DCMTK +# DCMTK_INCLUDE_DIRS - Directories to include to use DCMTK # DCMTK_LIBRARIES - Files to link against to use DCMTK # DCMTK_FOUND - If false, don't try to use DCMTK # DCMTK_DIR - (optional) Source directory for DCMTK @@ -13,7 +13,8 @@ #============================================================================= # Copyright 2004-2009 Kitware, Inc. -# Copyright 2009 Mathieu Malaterre +# Copyright 2009-2010 Mathieu Malaterre +# Copyright 2010 Thomas Sondergaard # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -28,155 +29,124 @@ # # Written for VXL by Amitha Perera. # Upgraded for GDCM by Mathieu Malaterre. -# - -IF( NOT DCMTK_FOUND ) - SET( DCMTK_DIR "/usr/include/dcmtk/" - CACHE PATH "Root of DCMTK source tree (optional)." ) - MARK_AS_ADVANCED( DCMTK_DIR ) -ENDIF( NOT DCMTK_FOUND ) - - -FIND_PATH( DCMTK_config_INCLUDE_DIR osconfig.h - ${DCMTK_DIR}/config/include - ${DCMTK_DIR}/config - ${DCMTK_DIR}/include -) - -FIND_PATH( DCMTK_ofstd_INCLUDE_DIR ofstdinc.h - ${DCMTK_DIR}/ofstd/include - ${DCMTK_DIR}/ofstd - ${DCMTK_DIR}/include/ofstd -) - -FIND_LIBRARY( DCMTK_ofstd_LIBRARY ofstd - ${DCMTK_DIR}/ofstd/libsrc - ${DCMTK_DIR}/ofstd/libsrc/Release - ${DCMTK_DIR}/ofstd/libsrc/Debug - ${DCMTK_DIR}/ofstd/Release - ${DCMTK_DIR}/ofstd/Debug - ${DCMTK_DIR}/lib -) - - -FIND_PATH( DCMTK_dcmdata_INCLUDE_DIR dctypes.h - ${DCMTK_DIR}/include/dcmdata - ${DCMTK_DIR}/dcmdata - ${DCMTK_DIR}/dcmdata/include -) - -FIND_LIBRARY( DCMTK_dcmdata_LIBRARY dcmdata - ${DCMTK_DIR}/dcmdata/libsrc - ${DCMTK_DIR}/dcmdata/libsrc/Release - ${DCMTK_DIR}/dcmdata/libsrc/Debug - ${DCMTK_DIR}/dcmdata/Release - ${DCMTK_DIR}/dcmdata/Debug - ${DCMTK_DIR}/lib -) - - -FIND_PATH( DCMTK_dcmimgle_INCLUDE_DIR dcmimage.h - ${DCMTK_DIR}/dcmimgle/include - ${DCMTK_DIR}/dcmimgle - ${DCMTK_DIR}/include/dcmimgle -) - -FIND_LIBRARY( DCMTK_dcmimgle_LIBRARY dcmimgle - ${DCMTK_DIR}/dcmimgle/libsrc - ${DCMTK_DIR}/dcmimgle/libsrc/Release - ${DCMTK_DIR}/dcmimgle/libsrc/Debug - ${DCMTK_DIR}/dcmimgle/Release - ${DCMTK_DIR}/dcmimgle/Debug - ${DCMTK_DIR}/lib -) - -# MM: I could not find this library on debian system / dcmtk 3.5.4 -FIND_LIBRARY(DCMTK_imagedb_LIBRARY imagedb - ${DCMTK_DIR}/imagectn/libsrc/Release - ${DCMTK_DIR}/imagectn/libsrc/ - ${DCMTK_DIR}/imagectn/libsrc/Debug - ) - -FIND_LIBRARY(DCMTK_dcmnet_LIBRARY dcmnet - ${DCMTK_DIR}/dcmnet/libsrc/Release - ${DCMTK_DIR}/dcmnet/libsrc/Debug - ${DCMTK_DIR}/dcmnet/libsrc/ - ) - - -IF( DCMTK_config_INCLUDE_DIR - AND DCMTK_ofstd_INCLUDE_DIR - AND DCMTK_ofstd_LIBRARY - AND DCMTK_dcmdata_INCLUDE_DIR - AND DCMTK_dcmdata_LIBRARY - AND DCMTK_dcmimgle_INCLUDE_DIR - AND DCMTK_dcmimgle_LIBRARY ) - - SET( DCMTK_FOUND "YES" ) - SET( DCMTK_INCLUDE_DIR - ${DCMTK_config_INCLUDE_DIR} +# Modified for EasyViz by Thomas Sondergaard. +# + +if(NOT DCMTK_FOUND AND NOT DCMTK_DIR) + set(DCMTK_DIR + "/usr/include/dcmtk/" + CACHE + PATH + "Root of DCMTK source tree (optional).") + mark_as_advanced(DCMTK_DIR) +endif() + + +foreach(lib + dcmdata + dcmimage + dcmimgle + dcmjpeg + dcmnet + dcmpstat + dcmqrdb + dcmsign + dcmsr + dcmtls + ijg12 + ijg16 + ijg8 + ofstd) + + find_library(DCMTK_${lib}_LIBRARY + ${lib} + PATHS + ${DCMTK_DIR}/${lib}/libsrc + ${DCMTK_DIR}/${lib}/libsrc/Release + ${DCMTK_DIR}/${lib}/libsrc/Debug + ${DCMTK_DIR}/${lib}/Release + ${DCMTK_DIR}/${lib}/Debug + ${DCMTK_DIR}/lib) + + mark_as_advanced(DCMTK_${lib}_LIBRARY) + + if(DCMTK_${lib}_LIBRARY) + list(APPEND DCMTK_LIBRARIES ${DCMTK_${lib}_LIBRARY}) + endif() + +endforeach() + + +set(DCMTK_config_TEST_HEADER osconfig.h) +set(DCMTK_dcmdata_TEST_HEADER dctypes.h) +set(DCMTK_dcmimage_TEST_HEADER dicoimg.h) +set(DCMTK_dcmimgle_TEST_HEADER dcmimage.h) +set(DCMTK_dcmjpeg_TEST_HEADER djdecode.h) +set(DCMTK_dcmnet_TEST_HEADER assoc.h) +set(DCMTK_dcmpstat_TEST_HEADER dcmpstat.h) +set(DCMTK_dcmqrdb_TEST_HEADER dcmqrdba.h) +set(DCMTK_dcmsign_TEST_HEADER sicert.h) +set(DCMTK_dcmsr_TEST_HEADER dsrtree.h) +set(DCMTK_dcmtls_TEST_HEADER tlslayer.h) +set(DCMTK_ofstd_TEST_HEADER ofstdinc.h) + +foreach(dir + config + dcmdata + dcmimage + dcmimgle + dcmjpeg + dcmnet + dcmpstat + dcmqrdb + dcmsign + dcmsr + dcmtls + ofstd) + find_path(DCMTK_${dir}_INCLUDE_DIR + ${DCMTK_${dir}_TEST_HEADER} + PATHS + ${DCMTK_DIR}/${dir}/include + ${DCMTK_DIR}/${dir} + ${DCMTK_DIR}/include/${dir}) + + mark_as_advanced(DCMTK_${dir}_INCLUDE_DIR) + + if(DCMTK_${dir}_INCLUDE_DIR) + list(APPEND + DCMTK_INCLUDE_DIRS + ${DCMTK_${dir}_INCLUDE_DIR}) + endif() +endforeach() + +if(WIN32) + list(APPEND DCMTK_LIBRARIES netapi32 wsock32) +endif() + +if(DCMTK_ofstd_INCLUDE_DIR) + get_filename_component(DCMTK_dcmtk_INCLUDE_DIR ${DCMTK_ofstd_INCLUDE_DIR} - ${DCMTK_dcmdata_INCLUDE_DIR} - ${DCMTK_dcmimgle_INCLUDE_DIR} - ) - - SET( DCMTK_LIBRARIES - ${DCMTK_dcmimgle_LIBRARY} - ${DCMTK_dcmdata_LIBRARY} - ${DCMTK_ofstd_LIBRARY} - ${DCMTK_config_LIBRARY} - ) - - IF(DCMTK_imagedb_LIBRARY) - SET( DCMTK_LIBRARIES - ${DCMTK_LIBRARIES} - ${DCMTK_imagedb_LIBRARY} - ) - ENDIF(DCMTK_imagedb_LIBRARY) - - IF(DCMTK_dcmnet_LIBRARY) - SET( DCMTK_LIBRARIES - ${DCMTK_LIBRARIES} - ${DCMTK_dcmnet_LIBRARY} - ) - ENDIF(DCMTK_dcmnet_LIBRARY) - - IF( WIN32 ) - SET( DCMTK_LIBRARIES ${DCMTK_LIBRARIES} netapi32 ) - ENDIF( WIN32 ) - -ENDIF( DCMTK_config_INCLUDE_DIR - AND DCMTK_ofstd_INCLUDE_DIR - AND DCMTK_ofstd_LIBRARY - AND DCMTK_dcmdata_INCLUDE_DIR - AND DCMTK_dcmdata_LIBRARY - AND DCMTK_dcmimgle_INCLUDE_DIR - AND DCMTK_dcmimgle_LIBRARY ) - -FIND_PROGRAM(DCMTK_DCMDUMP_EXECUTABLE dcmdump - ${DCMTK_DIR}/bin - ) - -FIND_PROGRAM(DCMTK_DCMDJPEG_EXECUTABLE dcmdjpeg - ${DCMTK_DIR}/bin - ) - -FIND_PROGRAM(DCMTK_DCMDRLE_EXECUTABLE dcmdrle - ${DCMTK_DIR}/bin - ) - -MARK_AS_ADVANCED( - DCMTK_DCMDUMP_EXECUTABLE - DCMTK_DCMDJPEG_EXECUTABLE - DCMTK_DCMDRLE_EXECUTABLE + PATH + CACHE) + list(APPEND DCMTK_INCLUDE_DIRS ${DCMTK_dcmtk_INCLUDE_DIR}) + mark_as_advanced(DCMTK_dcmtk_INCLUDE_DIR) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(DCMTK DEFAULT_MSG DCMTK_config_INCLUDE_DIR + DCMTK_ofstd_INCLUDE_DIR + DCMTK_ofstd_LIBRARY DCMTK_dcmdata_INCLUDE_DIR DCMTK_dcmdata_LIBRARY DCMTK_dcmimgle_INCLUDE_DIR - DCMTK_dcmimgle_LIBRARY - DCMTK_imagedb_LIBRARY - DCMTK_dcmnet_LIBRARY - DCMTK_ofstd_INCLUDE_DIR - DCMTK_ofstd_LIBRARY - ) + DCMTK_dcmimgle_LIBRARY) + +# Compatibility: This variable is deprecated +set(DCMTK_INCLUDE_DIR ${DCMTK_INCLUDE_DIRS}) +foreach(executable dcmdump dcmdjpeg dcmdrle) + string(TOUPPER ${executable} EXECUTABLE) + find_program(DCMTK_${EXECUTABLE}_EXECUTABLE ${executable} ${DCMTK_DIR}/bin) + mark_as_advanced(DCMTK_${EXECUTABLE}_EXECUTABLE) +endforeach() diff --git a/Modules/FindDart.cmake b/Modules/FindDart.cmake index f8c274733..65da21a2b 100644 --- a/Modules/FindDart.cmake +++ b/Modules/FindDart.cmake @@ -27,3 +27,10 @@ FIND_PATH(DART_ROOT README.INSTALL [HKEY_LOCAL_MACHINE\\SOFTWARE\\Dart\\InstallPath] DOC "If you have Dart installed, where is it located?" ) + +# handle the QUIETLY and REQUIRED arguments and set DART_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Dart DEFAULT_MSG DART_ROOT) + +MARK_AS_ADVANCED(DART_ROOT) diff --git a/Modules/FindEXPAT.cmake b/Modules/FindEXPAT.cmake index 1c4c16336..22743b113 100644 --- a/Modules/FindEXPAT.cmake +++ b/Modules/FindEXPAT.cmake @@ -33,9 +33,6 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(EXPAT DEFAULT_MSG EXPAT_LIBRARY EXPAT_INCLUDE_ IF(EXPAT_FOUND) SET(EXPAT_LIBRARIES ${EXPAT_LIBRARY}) SET(EXPAT_INCLUDE_DIRS ${EXPAT_INCLUDE_DIR}) -ELSE(EXPAT_FOUND) - SET(EXPAT_LIBRARIES) - SET(EXPAT_INCLUDE_DIRS) ENDIF(EXPAT_FOUND) MARK_AS_ADVANCED(EXPAT_INCLUDE_DIR EXPAT_LIBRARY) diff --git a/Modules/FindGCCXML.cmake b/Modules/FindGCCXML.cmake index d618487b8..52390c30a 100644 --- a/Modules/FindGCCXML.cmake +++ b/Modules/FindGCCXML.cmake @@ -1,4 +1,7 @@ # - Find the GCC-XML front-end executable. +# +# This module will define the following variables: +# GCCXML - the GCC-XML front-end executable. #============================================================================= # Copyright 2001-2009 Kitware, Inc. @@ -20,3 +23,5 @@ FIND_PROGRAM(GCCXML "$ENV{ProgramFiles}/GCC_XML" "C:/Program Files/GCC_XML" ) + +MARK_AS_ADVANCED(GCCXML) diff --git a/Modules/FindGLU.cmake b/Modules/FindGLU.cmake index 96b6dc910..81b3364c1 100644 --- a/Modules/FindGLU.cmake +++ b/Modules/FindGLU.cmake @@ -15,7 +15,9 @@ # Use of this file is deprecated, and is here for backwards compatibility with CMake 1.4 # GLU library is now found by FindOpenGL.cmake # -# + +MESSAGE(STATUS + "WARNING: you are using the obsolete 'GLU' package, please use 'OpenGL' instead") INCLUDE(FindOpenGL) diff --git a/Modules/FindGit.cmake b/Modules/FindGit.cmake new file mode 100644 index 000000000..2d8214287 --- /dev/null +++ b/Modules/FindGit.cmake @@ -0,0 +1,46 @@ +# The module defines the following variables: +# GIT_EXECUTABLE - path to git command line client +# GIT_FOUND - true if the command line client was found +# Example usage: +# find_package(Git) +# if(GIT_FOUND) +# message("git found: ${GIT_EXECUTABLE}") +# endif() + +#============================================================================= +# Copyright 2010 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 distributed this file outside of CMake, substitute the full +# License text for the above reference.) + +# Look for 'git' or 'eg' (easy git) +# +set(git_names git eg) + +# Prefer .cmd variants on Windows unless running in a Makefile +# in the MSYS shell. +# +if(WIN32) + if(NOT CMAKE_GENERATOR MATCHES "MSYS") + set(git_names git.cmd git eg.cmd eg) + endif() +endif() + +find_program(GIT_EXECUTABLE + NAMES ${git_names} + DOC "git command line client" + ) +mark_as_advanced(GIT_EXECUTABLE) + +# Handle the QUIETLY and REQUIRED arguments and set GIT_FOUND to TRUE if +# all listed variables are TRUE + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Git DEFAULT_MSG GIT_EXECUTABLE) diff --git a/Modules/FindHSPELL.cmake b/Modules/FindHSPELL.cmake index 9ae4a52a9..21bc5fd29 100644 --- a/Modules/FindHSPELL.cmake +++ b/Modules/FindHSPELL.cmake @@ -1,10 +1,14 @@ -# - Try to find HSPELL +# - Try to find Hspell # Once done this will define # -# HSPELL_FOUND - system has HSPELL -# HSPELL_INCLUDE_DIR - the HSPELL include directory -# HSPELL_LIBRARIES - The libraries needed to use HSPELL -# HSPELL_DEFINITIONS - Compiler switches required for using HSPELL +# HSPELL_FOUND - system has Hspell +# HSPELL_INCLUDE_DIR - the Hspell include directory +# HSPELL_LIBRARIES - The libraries needed to use Hspell +# HSPELL_DEFINITIONS - Compiler switches required for using Hspell +# +# HSPELL_VERSION_STRING - The version of Hspell found (x.y) +# HSPELL_MAJOR_VERSION - the major version of Hspell +# HSPELL_MINOR_VERSION - The minor version of Hspell #============================================================================= # Copyright 2006-2009 Kitware, Inc. @@ -20,21 +24,20 @@ # (To distributed this file outside of CMake, substitute the full # License text for the above reference.) -IF (HSPELL_INCLUDE_DIR AND HSPELL_LIBRARIES) - # Already in cache, be silent - SET(HSPELL_FIND_QUIETLY TRUE) -ENDIF (HSPELL_INCLUDE_DIR AND HSPELL_LIBRARIES) - +FIND_PATH(HSPELL_INCLUDE_DIR hspell.h) -FIND_PATH(HSPELL_INCLUDE_DIR hspell.h ) +FIND_LIBRARY(HSPELL_LIBRARIES NAMES hspell) -FIND_LIBRARY(HSPELL_LIBRARIES NAMES hspell ) +IF (HSPELL_INCLUDE_DIR) + FILE(READ "${HSPELL_INCLUDE_DIR}/hspell.h" HSPELL_H) + STRING(REGEX REPLACE ".*#define HSPELL_VERSION_MAJOR ([0-9]+).*" "\\1" HSPELL_VERSION_MAJOR "${HSPELL_H}") + STRING(REGEX REPLACE ".*#define HSPELL_VERSION_MINOR ([0-9]+).*" "\\1" HSPELL_VERSION_MINOR "${HSPELL_H}") +ENDIF() # handle the QUIETLY and REQUIRED arguments and set HSPELL_FOUND to TRUE if # all listed variables are TRUE INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(HSPELL DEFAULT_MSG HSPELL_LIBRARIES HSPELL_INCLUDE_DIR) - MARK_AS_ADVANCED(HSPELL_INCLUDE_DIR HSPELL_LIBRARIES) diff --git a/Modules/FindJasper.cmake b/Modules/FindJasper.cmake index 553654e80..4f8ccb705 100644 --- a/Modules/FindJasper.cmake +++ b/Modules/FindJasper.cmake @@ -21,19 +21,10 @@ FIND_PACKAGE(JPEG) -IF (JASPER_INCLUDE_DIR AND JASPER_LIBRARIES AND JPEG_LIBRARIES) - # Already in cache, be silent - SET(Jasper_FIND_QUIETLY TRUE) -ENDIF (JASPER_INCLUDE_DIR AND JASPER_LIBRARIES AND JPEG_LIBRARIES) - FIND_PATH(JASPER_INCLUDE_DIR jasper/jasper.h) FIND_LIBRARY(JASPER_LIBRARY NAMES jasper libjasper) -IF (JASPER_INCLUDE_DIR AND JASPER_LIBRARY AND JPEG_LIBRARIES) - SET(JASPER_LIBRARIES ${JASPER_LIBRARY} ${JPEG_LIBRARIES} ) -ENDIF (JASPER_INCLUDE_DIR AND JASPER_LIBRARY AND JPEG_LIBRARIES) - # handle the QUIETLY and REQUIRED arguments and set JASPER_FOUND to TRUE if # all listed variables are TRUE INCLUDE(FindPackageHandleStandardArgs) @@ -43,4 +34,4 @@ IF (JASPER_FOUND) SET(JASPER_LIBRARIES ${JASPER_LIBRARY} ${JPEG_LIBRARIES} ) ENDIF (JASPER_FOUND) -MARK_AS_ADVANCED(JASPER_INCLUDE_DIR JASPER_LIBRARIES JASPER_LIBRARY) +MARK_AS_ADVANCED(JASPER_INCLUDE_DIR JASPER_LIBRARY) diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake index 7eb6d900c..4cd43899a 100644 --- a/Modules/FindJava.cmake +++ b/Modules/FindJava.cmake @@ -24,9 +24,18 @@ # and # Java_VERSION = 1.6.0 # -# NOTE: At the moment this script will look for javac and jar component, -# which means it will fail if javac or jar is not found.:w -# See Bug #9840 +# For these components the following variables are set: +# +# Java_FOUND - TRUE if all components are found. +# Java_INCLUDE_DIRS - Full paths to all include dirs. +# Java_LIBRARIES - Full paths to all libraries. +# Java__FOUND - TRUE if is found. +# +# Example Usages: +# FIND_PACKAGE(Java) +# FIND_PACKAGE(Java COMPONENTS Runtime) +# FIND_PACKAGE(Java COMPONENTS Development) +# #============================================================================= # Copyright 2002-2009 Kitware, Inc. @@ -82,7 +91,11 @@ IF(Java_JAVA_EXECUTABLE) OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE) IF( res ) - MESSAGE( FATAL_ERROR "Error executing java -version" ) + IF(${Java_FIND_REQUIRED}) + MESSAGE( FATAL_ERROR "Error executing java -version" ) + ELSE() + MESSAGE( STATUS "Warning, could not run java --version") + ENDIF() ELSE() # extract major/minor version and patch level from "java -version" output # Tested on linux using @@ -148,12 +161,36 @@ FIND_PROGRAM(Java_JAVAC_EXECUTABLE ) include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Java DEFAULT_MSG - Java_JAVA_EXECUTABLE - Java_JAR_EXECUTABLE - Java_JAVAC_EXECUTABLE - _java_version_acceptable -) +if(Java_FIND_COMPONENTS) + foreach(component ${Java_FIND_COMPONENTS}) + # User just want to execute some Java byte-compiled + if(component STREQUAL "Runtime") + find_package_handle_standard_args(Java DEFAULT_MSG + Java_JAVA_EXECUTABLE + _java_version_acceptable + ) + elseif(component STREQUAL "Development") + find_package_handle_standard_args(Java DEFAULT_MSG + Java_JAVA_EXECUTABLE + Java_JAR_EXECUTABLE + Java_JAVAC_EXECUTABLE + _java_version_acceptable + ) + else() + message(FATAL_ERROR "Comp: ${component} is not handled") + endif() + set(Java_${component}_FOUND TRUE) + endforeach(component) +else() + # Check for everything + find_package_handle_standard_args(Java DEFAULT_MSG + Java_JAVA_EXECUTABLE + Java_JAR_EXECUTABLE + Java_JAVAC_EXECUTABLE + _java_version_acceptable + ) +endif() + MARK_AS_ADVANCED( Java_JAVA_EXECUTABLE diff --git a/Modules/FindKDE4.cmake b/Modules/FindKDE4.cmake index 12fd30486..42a15304a 100644 --- a/Modules/FindKDE4.cmake +++ b/Modules/FindKDE4.cmake @@ -73,7 +73,7 @@ IF(NOT KDE4_DATA_DIR) EXECUTE_PROCESS(COMMAND "${KDE4_KDECONFIG_EXECUTABLE}" --path data OUTPUT_VARIABLE _data_DIR ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) FILE(TO_CMAKE_PATH "${_data_DIR}" _data_DIR) # then check the data dirs for FindKDE4Internal.cmake - FIND_PATH(KDE4_DATA_DIR cmake/modules/FindKDE4Internal.cmake ${_data_DIR}) + FIND_PATH(KDE4_DATA_DIR cmake/modules/FindKDE4Internal.cmake HINTS ${_data_DIR}) ENDIF(KDE4_KDECONFIG_EXECUTABLE) ENDIF(CMAKE_CROSSCOMPILING) ENDIF(NOT KDE4_DATA_DIR) diff --git a/Modules/FindLibXml2.cmake b/Modules/FindLibXml2.cmake index 9139aad79..67db32122 100644 --- a/Modules/FindLibXml2.cmake +++ b/Modules/FindLibXml2.cmake @@ -24,7 +24,7 @@ # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls FIND_PACKAGE(PkgConfig) -PKG_CHECK_MODULES(PC_LIBXML libxml-2.0) +PKG_CHECK_MODULES(PC_LIBXML libxml-2.0 QUIET) SET(LIBXML2_DEFINITIONS ${PC_LIBXML_CFLAGS_OTHER}) FIND_PATH(LIBXML2_INCLUDE_DIR NAMES libxml/xpath.h @@ -44,10 +44,9 @@ FIND_PROGRAM(LIBXML2_XMLLINT_EXECUTABLE xmllint) # for backwards compat. with KDE 4.0.x: SET(XMLLINT_EXECUTABLE "${LIBXML2_XMLLINT_EXECUTABLE}") -INCLUDE(FindPackageHandleStandardArgs) - # handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if # all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR) MARK_AS_ADVANCED(LIBXML2_INCLUDE_DIR LIBXML2_LIBRARIES LIBXML2_XMLLINT_EXECUTABLE) diff --git a/Modules/FindLibXslt.cmake b/Modules/FindLibXslt.cmake index d16d1ffef..a03aa7c80 100644 --- a/Modules/FindLibXslt.cmake +++ b/Modules/FindLibXslt.cmake @@ -26,9 +26,8 @@ FIND_PACKAGE(PkgConfig) PKG_CHECK_MODULES(PC_LIBXSLT libxslt) SET(LIBXSLT_DEFINITIONS ${PC_LIBXSLT_CFLAGS_OTHER}) - FIND_PATH(LIBXSLT_INCLUDE_DIR NAMES libxslt/xslt.h - HINTS + HINTS ${PC_LIBXSLT_INCLUDEDIR} ${PC_LIBXSLT_INCLUDE_DIRS} ) @@ -39,12 +38,10 @@ FIND_LIBRARY(LIBXSLT_LIBRARIES NAMES xslt libxslt ${PC_LIBXSLT_LIBRARY_DIRS} ) -INCLUDE(FindPackageHandleStandardArgs) - # handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if # all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXslt DEFAULT_MSG LIBXSLT_LIBRARIES LIBXSLT_INCLUDE_DIR) - MARK_AS_ADVANCED(LIBXSLT_INCLUDE_DIR LIBXSLT_LIBRARIES) diff --git a/Modules/FindMPEG.cmake b/Modules/FindMPEG.cmake index a19f73e08..0c06c94c6 100644 --- a/Modules/FindMPEG.cmake +++ b/Modules/FindMPEG.cmake @@ -35,8 +35,10 @@ FIND_LIBRARY( MPEG_vo_LIBRARY vo # handle the QUIETLY and REQUIRED arguments and set MPEG2_FOUND to TRUE if # all listed variables are TRUE INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPEG DEFAULT_MSG MPEG_INCLUDE_DIR MPEG_mpeg2_LIBRARY) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPEG DEFAULT_MSG MPEG_INCLUDE_DIR MPEG_mpeg2_LIBRARY MPEG_vo_LIBRARY) IF(MPEG_FOUND) SET( MPEG_LIBRARIES ${MPEG_mpeg2_LIBRARY} ${MPEG_vo_LIBRARY} ) ENDIF(MPEG_FOUND) + +MARK_AS_ADVANCED(MPEG_INCLUDE_DIR MPEG_mpeg2_LIBRARY MPEG_vo_LIBRARY) diff --git a/Modules/FindOpenAL.cmake b/Modules/FindOpenAL.cmake index b9b707827..f42a69acf 100644 --- a/Modules/FindOpenAL.cmake +++ b/Modules/FindOpenAL.cmake @@ -95,8 +95,9 @@ FIND_LIBRARY(OPENAL_LIBRARY ) -SET(OPENAL_FOUND "NO") -IF(OPENAL_LIBRARY AND OPENAL_INCLUDE_DIR) - SET(OPENAL_FOUND "YES") -ENDIF(OPENAL_LIBRARY AND OPENAL_INCLUDE_DIR) +# handle the QUIETLY and REQUIRED arguments and set OPENAL_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenAL DEFAULT_MSG OPENAL_LIBRARY OPENAL_INCLUDE_DIR) +MARK_AS_ADVANCED(OPENAL_LIBRARY OPENAL_INCLUDE_DIR) diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake index 8df3573e9..bfc5d4aa1 100644 --- a/Modules/FindPNG.cmake +++ b/Modules/FindPNG.cmake @@ -33,7 +33,7 @@ if(ZLIB_FOUND) /usr/local/include/libpng # OpenBSD ) - set(PNG_NAMES ${PNG_NAMES} png libpng png12 libpng12) + set(PNG_NAMES ${PNG_NAMES} png libpng png14 libpng14 png14d libpng14d png12 libpng12 png12d libpng12d) find_library(PNG_LIBRARY NAMES ${PNG_NAMES} ) if (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR) diff --git a/Modules/FindPhysFS.cmake b/Modules/FindPhysFS.cmake index 4775a8ebc..98bebe6eb 100644 --- a/Modules/FindPhysFS.cmake +++ b/Modules/FindPhysFS.cmake @@ -54,8 +54,8 @@ FIND_LIBRARY(PHYSFS_LIBRARY /opt ) -SET(PHYSFS_FOUND "NO") -IF(PHYSFS_LIBRARY AND PHYSFS_INCLUDE_DIR) - SET(PHYSFS_FOUND "YES") -ENDIF(PHYSFS_LIBRARY AND PHYSFS_INCLUDE_DIR) +# handle the QUIETLY and REQUIRED arguments and set PHYSFS_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(PhysFS DEFAULT_MSG PHYSFS_LIBRARY PHYSFS_INCLUDE_DIR) diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index 6e6b802dd..3cbb7af76 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -1,15 +1,17 @@ # - a pkg-config module for CMake # # Usage: -# pkg_check_modules( [REQUIRED] []*) +# pkg_check_modules( [REQUIRED] [QUIET] []*) # checks for all the given modules # -# pkg_search_module( [REQUIRED] []*) +# pkg_search_module( [REQUIRED] [QUIET] []*) # checks for given modules and uses the first working one # # When the 'REQUIRED' argument was set, macros will fail with an error # when module(s) could not be found # +# When the 'QUIET' argument is set, no status messages will be printed. +# # It sets the following variables: # PKG_CONFIG_FOUND ... true if pkg-config works on the system # PKG_CONFIG_EXECUTABLE ... pathname of the pkg-config program @@ -138,17 +140,22 @@ macro(_pkgconfig_invoke_dyn _pkglist _prefix _varname cleanup_regexp) endmacro(_pkgconfig_invoke_dyn) # Splits given arguments into options and a package list -macro(_pkgconfig_parse_options _result _is_req) +macro(_pkgconfig_parse_options _result _is_req _is_silent) set(${_is_req} 0) + set(${_is_silent} 0) foreach(_pkg ${ARGN}) if (_pkg STREQUAL "REQUIRED") set(${_is_req} 1) endif (_pkg STREQUAL "REQUIRED") + if (_pkg STREQUAL "QUIET") + set(${_is_silent} 1) + endif (_pkg STREQUAL "QUIET") endforeach(_pkg ${ARGN}) set(${_result} ${ARGN}) list(REMOVE_ITEM ${_result} "REQUIRED") + list(REMOVE_ITEM ${_result} "QUIET") endmacro(_pkgconfig_parse_options) ### @@ -279,7 +286,9 @@ macro(_pkg_check_modules_internal _is_required _is_silent _prefix) _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" INCLUDEDIR "" --variable=includedir ) _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" LIBDIR "" --variable=libdir ) - message(STATUS " found ${_pkg_check_modules_pkg}, version ${_pkgconfig_VERSION}") + if (NOT ${_is_silent}) + message(STATUS " found ${_pkg_check_modules_pkg}, version ${_pkgconfig_VERSION}") + endif (NOT ${_is_silent}) endforeach(_pkg_check_modules_pkg) # set variables which are combined for multiple modules @@ -307,8 +316,8 @@ endmacro(_pkg_check_modules_internal) macro(pkg_check_modules _prefix _module0) # check cached value if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND) - _pkgconfig_parse_options (_pkg_modules _pkg_is_required "${_module0}" ${ARGN}) - _pkg_check_modules_internal("${_pkg_is_required}" 0 "${_prefix}" ${_pkg_modules}) + _pkgconfig_parse_options (_pkg_modules _pkg_is_required _pkg_is_silent "${_module0}" ${ARGN}) + _pkg_check_modules_internal("${_pkg_is_required}" "${_pkg_is_silent}" "${_prefix}" ${_pkg_modules}) _pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION}) endif(NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND) @@ -319,9 +328,11 @@ macro(pkg_search_module _prefix _module0) # check cached value if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND) set(_pkg_modules_found 0) - _pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required "${_module0}" ${ARGN}) + _pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required _pkg_is_silent "${_module0}" ${ARGN}) - message(STATUS "checking for one of the modules '${_pkg_modules_alt}'") + if (NOT ${_pkg_is_silent}) + message(STATUS "checking for one of the modules '${_pkg_modules_alt}'") + endif (NOT ${_pkg_is_silent}) # iterate through all modules and stop at the first working one. foreach(_pkg_alt ${_pkg_modules_alt}) diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake index 5c99e3fb4..1ba21b507 100644 --- a/Modules/FindPythonLibs.cmake +++ b/Modules/FindPythonLibs.cmake @@ -89,22 +89,6 @@ MARK_AS_ADVANCED( PYTHON_INCLUDE_DIR ) -# Python Should be built and installed as a Framework on OSX -IF(Python_FRAMEWORKS) - # If a framework has been selected for the include path, - # make sure "-framework" is used to link it. - IF("${PYTHON_INCLUDE_DIR}" MATCHES "Python\\.framework") - SET(PYTHON_LIBRARY "") - SET(PYTHON_DEBUG_LIBRARY "") - ENDIF("${PYTHON_INCLUDE_DIR}" MATCHES "Python\\.framework") - IF(NOT PYTHON_LIBRARY) - SET (PYTHON_LIBRARY "-framework Python" CACHE FILEPATH "Python Framework" FORCE) - ENDIF(NOT PYTHON_LIBRARY) - IF(NOT PYTHON_DEBUG_LIBRARY) - SET (PYTHON_DEBUG_LIBRARY "-framework Python" CACHE FILEPATH "Python Framework" FORCE) - ENDIF(NOT PYTHON_DEBUG_LIBRARY) -ENDIF(Python_FRAMEWORKS) - # We use PYTHON_INCLUDE_DIR, PYTHON_LIBRARY and PYTHON_DEBUG_LIBRARY for the # cache entries because they are meant to specify the location of a single # library. We now set the variables listed by the documentation for this @@ -127,7 +111,12 @@ GET_PROPERTY(_TARGET_SUPPORTS_SHARED_LIBS FUNCTION(PYTHON_ADD_MODULE _NAME ) OPTION(PYTHON_ENABLE_MODULE_${_NAME} "Add module ${_NAME}" TRUE) - OPTION(PYTHON_MODULE_${_NAME}_BUILD_SHARED "Add module ${_NAME} shared" ${_TARGET_SUPPORTS_SHARED_LIBS}) + OPTION(PYTHON_MODULE_${_NAME}_BUILD_SHARED + "Add module ${_NAME} shared" ${_TARGET_SUPPORTS_SHARED_LIBS}) + + # Mark these options as advanced + MARK_AS_ADVANCED(PYTHON_ENABLE_MODULE_${_NAME} + PYTHON_MODULE_${_NAME}_BUILD_SHARED) IF(PYTHON_ENABLE_MODULE_${_NAME}) IF(PYTHON_MODULE_${_NAME}_BUILD_SHARED) @@ -150,13 +139,13 @@ FUNCTION(PYTHON_WRITE_MODULES_HEADER _filename) GET_FILENAME_COMPONENT(_name "${_filename}" NAME) STRING(REPLACE "." "_" _name "${_name}") - STRING(TOUPPER ${_name} _name) + STRING(TOUPPER ${_name} _nameUpper) SET(_filenameTmp "${_filename}.in") FILE(WRITE ${_filenameTmp} "/*Created by cmake, do not edit, changes will be lost*/\n") FILE(APPEND ${_filenameTmp} -"#ifndef ${_name} -#define ${_name} +"#ifndef ${_nameUpper} +#define ${_nameUpper} #include @@ -179,14 +168,15 @@ extern \"C\" { FOREACH(_currentModule ${PY_STATIC_MODULES_LIST}) - FILE(APPEND ${_filenameTmp} "int CMakeLoadPythonModule_${_currentModule}(void) \n{\n static char name[]=\"${PYTHON_MODULE_PREFIX}${_currentModule}\"; return PyImport_AppendInittab(name, init${PYTHON_MODULE_PREFIX}${_currentModule});\n}\n\n") + FILE(APPEND ${_filenameTmp} "int ${_name}_${_currentModule}(void) \n{\n static char name[]=\"${PYTHON_MODULE_PREFIX}${_currentModule}\"; return PyImport_AppendInittab(name, init${PYTHON_MODULE_PREFIX}${_currentModule});\n}\n\n") ENDFOREACH(_currentModule ${PY_STATIC_MODULES_LIST}) - FILE(APPEND ${_filenameTmp} "#ifndef EXCLUDE_LOAD_ALL_FUNCTION\nvoid CMakeLoadAllPythonModules(void)\n{\n") + FILE(APPEND ${_filenameTmp} "void ${_name}_LoadAllPythonModules(void)\n{\n") FOREACH(_currentModule ${PY_STATIC_MODULES_LIST}) - FILE(APPEND ${_filenameTmp} " CMakeLoadPythonModule_${_currentModule}();\n") + FILE(APPEND ${_filenameTmp} " ${_name}_${_currentModule}();\n") ENDFOREACH(_currentModule ${PY_STATIC_MODULES_LIST}) - FILE(APPEND ${_filenameTmp} "}\n#endif\n\n#endif\n") + FILE(APPEND ${_filenameTmp} "}\n\n") + FILE(APPEND ${_filenameTmp} "#ifndef EXCLUDE_LOAD_ALL_FUNCTION\nvoid CMakeLoadAllPythonModules(void)\n{\n ${_name}_LoadAllPythonModules();\n}\n#endif\n\n#endif\n") # with CONFIGURE_FILE() cmake complains that you may not use a file created using FILE(WRITE) as input file for CONFIGURE_FILE() EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${_filenameTmp}" "${_filename}" OUTPUT_QUIET ERROR_QUIET) diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index 76d7950c0..654879e3b 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -360,34 +360,6 @@ SET( QT_DEFINITIONS "") SET(QT4_INSTALLED_VERSION_TOO_OLD FALSE) -# macro for asking qmake to process pro files -MACRO(QT_QUERY_QMAKE outvar invar) - IF(QT_QMAKE_EXECUTABLE) - FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake/tmp.pro - "message(CMAKE_MESSAGE<$$${invar}>)") - - # Invoke qmake with the tmp.pro program to get the desired - # information. Use the same variable for both stdout and stderr - # to make sure we get the output on all platforms. - EXECUTE_PROCESS(COMMAND ${QT_QMAKE_EXECUTABLE} - WORKING_DIRECTORY - ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake - OUTPUT_VARIABLE _qmake_query_output - RESULT_VARIABLE _qmake_result - ERROR_VARIABLE _qmake_query_output ) - - FILE(REMOVE_RECURSE - "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmpQmake") - - IF(_qmake_result) - MESSAGE(WARNING " querying qmake for ${invar}. qmake reported:\n${_qmake_query_output}") - ELSE(_qmake_result) - STRING(REGEX REPLACE ".*CMAKE_MESSAGE<([^>]*).*" "\\1" ${outvar} "${_qmake_query_output}") - ENDIF(_qmake_result) - - ENDIF(QT_QMAKE_EXECUTABLE) -ENDMACRO(QT_QUERY_QMAKE) - GET_FILENAME_COMPONENT(qt_install_version "[HKEY_CURRENT_USER\\Software\\trolltech\\Versions;DefaultQtVersion]" NAME) # check for qmake # Debian uses qmake-qt4 @@ -397,6 +369,7 @@ FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake qmake4 qmake-qt4 qmake-mac PATHS "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/bin" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\${qt_install_version};InstallDir]/bin" $ENV{QTDIR}/bin + DOC "The qmake executable for the Qt installation to use" ) IF (QT_QMAKE_EXECUTABLE) @@ -418,6 +391,7 @@ IF (QT_QMAKE_EXECUTABLE) "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/bin" "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/bin" $ENV{QTDIR}/bin + DOC "The qmake executable for the Qt installation to use" ) IF(QT_QMAKE_EXECUTABLE) EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE} diff --git a/Modules/FindQuickTime.cmake b/Modules/FindQuickTime.cmake index aa13ae999..f69354391 100644 --- a/Modules/FindQuickTime.cmake +++ b/Modules/FindQuickTime.cmake @@ -41,9 +41,7 @@ ELSE(APPLE) ) ENDIF(APPLE) -SET(QUICKTIME_FOUND "NO") -IF(QUICKTIME_LIBRARY AND QUICKTIME_INCLUDE_DIR) - SET(QUICKTIME_FOUND "YES") -ENDIF(QUICKTIME_LIBRARY AND QUICKTIME_INCLUDE_DIR) - - +# handle the QUIETLY and REQUIRED arguments and set QUICKTIME_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(QuickTime DEFAULT_MSG QUICKTIME_LIBRARY QUICKTIME_INCLUDE_DIR) diff --git a/Modules/FindSubversion.cmake b/Modules/FindSubversion.cmake index c33df1d42..58a179d04 100644 --- a/Modules/FindSubversion.cmake +++ b/Modules/FindSubversion.cmake @@ -109,14 +109,5 @@ IF(Subversion_SVN_EXECUTABLE) ENDIF(Subversion_SVN_EXECUTABLE) -IF(NOT Subversion_FOUND) - IF(NOT Subversion_FIND_QUIETLY) - MESSAGE(STATUS "Subversion was not found.") - ELSE(NOT Subversion_FIND_QUIETLY) - IF(Subversion_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Subversion was not found.") - ENDIF(Subversion_FIND_REQUIRED) - ENDIF(NOT Subversion_FIND_QUIETLY) -ENDIF(NOT Subversion_FOUND) - -# FindSubversion.cmake ends here. +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Subversion DEFAULT_MSG Subversion_SVN_EXECUTABLE) diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index 459129bc4..2a74304c3 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -5,6 +5,8 @@ # CMAKE_USE_WIN32_THREADS_INIT - using WIN32 threads? # CMAKE_USE_PTHREADS_INIT - are we using pthreads # CMAKE_HP_PTHREADS_INIT - are we using hp pthreads +# For systems with multiple thread libraries, caller can set +# CMAKE_THREAD_PREFER_PTHREADS #============================================================================= # Copyright 2002-2009 Kitware, Inc. @@ -24,11 +26,11 @@ INCLUDE (CheckLibraryExists) SET(Threads_FOUND FALSE) # Do we have sproc? -IF(CMAKE_SYSTEM MATCHES IRIX) +IF(CMAKE_SYSTEM MATCHES IRIX AND NOT CMAKE_THREAD_PREFER_PTHREAD) CHECK_INCLUDE_FILES("sys/types.h;sys/prctl.h" CMAKE_HAVE_SPROC_H) ENDIF() -IF(CMAKE_HAVE_SPROC_H) +IF(CMAKE_HAVE_SPROC_H AND NOT CMAKE_THREAD_PREFER_PTHREAD) # We have sproc SET(CMAKE_USE_SPROC_INIT 1) ELSE() diff --git a/Modules/FindX11.cmake b/Modules/FindX11.cmake index c084df063..f05641302 100644 --- a/Modules/FindX11.cmake +++ b/Modules/FindX11.cmake @@ -22,6 +22,7 @@ # X11_xf86vmode_INCLUDE_PATH, X11_xf86vmode_FOUND # X11_Xfixes_INCLUDE_PATH, X11_Xfixes_LIB, X11_Xfixes_FOUND # X11_Xft_INCLUDE_PATH, X11_Xft_LIB, X11_Xft_FOUND +# X11_Xi_INCLUDE_PATH, X11_Xi_LIB, X11_Xi_FOUND # X11_Xinerama_INCLUDE_PATH, X11_Xinerama_LIB, X11_Xinerama_FOUND # X11_Xinput_INCLUDE_PATH, X11_Xinput_LIB, X11_Xinput_FOUND # X11_Xkb_INCLUDE_PATH, X11_Xkb_FOUND @@ -91,6 +92,7 @@ IF (UNIX) FIND_PATH(X11_xf86vmode_INCLUDE_PATH X11/extensions/xf86vmode.h ${X11_INC_SEARCH_PATH}) FIND_PATH(X11_Xfixes_INCLUDE_PATH X11/extensions/Xfixes.h ${X11_INC_SEARCH_PATH}) FIND_PATH(X11_Xft_INCLUDE_PATH X11/Xft/Xft.h ${X11_INC_SEARCH_PATH}) + FIND_PATH(X11_Xi_INCLUDE_PATH X11/extensions/XInput.h ${X11_INC_SEARCH_PATH}) FIND_PATH(X11_Xinerama_INCLUDE_PATH X11/extensions/Xinerama.h ${X11_INC_SEARCH_PATH}) FIND_PATH(X11_Xinput_INCLUDE_PATH X11/extensions/XInput.h ${X11_INC_SEARCH_PATH}) FIND_PATH(X11_Xkb_INCLUDE_PATH X11/extensions/XKB.h ${X11_INC_SEARCH_PATH}) @@ -120,6 +122,7 @@ IF (UNIX) FIND_LIBRARY(X11_Xext_LIB Xext ${X11_LIB_SEARCH_PATH}) FIND_LIBRARY(X11_Xfixes_LIB Xfixes ${X11_LIB_SEARCH_PATH}) FIND_LIBRARY(X11_Xft_LIB Xft ${X11_LIB_SEARCH_PATH}) + FIND_LIBRARY(X11_Xi_LIB Xi ${X11_LIB_SEARCH_PATH}) FIND_LIBRARY(X11_Xinerama_LIB Xinerama ${X11_LIB_SEARCH_PATH}) FIND_LIBRARY(X11_Xinput_LIB Xi ${X11_LIB_SEARCH_PATH}) FIND_LIBRARY(X11_Xpm_LIB Xpm ${X11_LIB_SEARCH_PATH}) @@ -219,6 +222,11 @@ IF (UNIX) SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_XTest_INCLUDE_PATH}) ENDIF (X11_XTest_INCLUDE_PATH AND X11_XTest_LIB) + IF (X11_Xi_INCLUDE_PATH AND X11_Xi_LIB) + SET(X11_Xi_FOUND TRUE) + SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xi_INCLUDE_PATH}) + ENDIF (X11_Xi_INCLUDE_PATH AND X11_Xi_LIB) + IF (X11_Xinerama_INCLUDE_PATH AND X11_Xinerama_LIB) SET(X11_Xinerama_FOUND TRUE) SET(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xinerama_INCLUDE_PATH}) @@ -396,6 +404,8 @@ IF (UNIX) X11_Xxf86misc_LIB X11_xf86misc_INCLUDE_PATH X11_xf86vmode_INCLUDE_PATH + X11_Xi_LIB + X11_Xi_INCLUDE_PATH X11_Xinerama_LIB X11_Xinerama_INCLUDE_PATH X11_XTest_LIB diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake index 806634306..b437e6b87 100644 --- a/Modules/FindZLIB.cmake +++ b/Modules/FindZLIB.cmake @@ -1,9 +1,14 @@ # - Find zlib # Find the native ZLIB includes and library # -# ZLIB_INCLUDE_DIRS - where to find zlib.h, etc. -# ZLIB_LIBRARIES - List of libraries when using zlib. -# ZLIB_FOUND - True if zlib found. +# ZLIB_INCLUDE_DIRS - where to find zlib.h, etc. +# ZLIB_LIBRARIES - List of libraries when using zlib. +# ZLIB_FOUND - True if zlib found. +# +# ZLIB_VERSION_STRING - The version of zlib found (x.y.z) +# ZLIB_MAJOR_VERSION - the major version of zlib +# ZLIB_MINOR_VERSION - The minor version of zlib +# ZLIB_PATCH_VERSION - The patch version of zlib #============================================================================= # Copyright 2001-2009 Kitware, Inc. @@ -18,23 +23,31 @@ # (To distributed this file outside of CMake, substitute the full # License text for the above reference.) -IF (ZLIB_INCLUDE_DIR) - # Already in cache, be silent - SET(ZLIB_FIND_QUIETLY TRUE) -ENDIF (ZLIB_INCLUDE_DIR) - -FIND_PATH(ZLIB_INCLUDE_DIR zlib.h) +FIND_PATH(ZLIB_INCLUDE_DIR zlib.h + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Zlib;InstallPath]/include" +) SET(ZLIB_NAMES z zlib zdll) -FIND_LIBRARY(ZLIB_LIBRARY NAMES ${ZLIB_NAMES} ) -MARK_AS_ADVANCED( ZLIB_LIBRARY ZLIB_INCLUDE_DIR ) +FIND_LIBRARY(ZLIB_LIBRARY + NAMES + ${ZLIB_NAMES} + PATHS + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Zlib;InstallPath]/lib" +) +MARK_AS_ADVANCED(ZLIB_LIBRARY ZLIB_INCLUDE_DIR) -# Per-recommendation -SET(ZLIB_INCLUDE_DIRS "${ZLIB_INCLUDE_DIR}") -SET(ZLIB_LIBRARIES "${ZLIB_LIBRARY}") +IF (ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h") + FILE(READ "${ZLIB_INCLUDE_DIR}/zlib.h" ZLIB_H) + STRING(REGEX REPLACE ".*#define ZLIB_VERSION \"([0-9]+)\\.([0-9]+)\\.([0-9]+)\".*" "\\1.\\2.\\3" ZLIB_VERSION_STRING "${ZLIB_H}") +ENDIF() # handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if # all listed variables are TRUE INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB DEFAULT_MSG ZLIB_LIBRARIES ZLIB_INCLUDE_DIRS) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB DEFAULT_MSG ZLIB_INCLUDE_DIR ZLIB_LIBRARY) + +IF (ZLIB_FOUND) + SET(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR}) + SET(ZLIB_LIBRARIES ${ZLIB_LIBRARY}) +ENDIF() diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake index 478282b74..85c6568d7 100644 --- a/Modules/FindwxWidgets.cmake +++ b/Modules/FindwxWidgets.cmake @@ -18,6 +18,10 @@ # (e.g., C:/wxWidgets-2.6.3/lib/vc_lib). # wxWidgets_CONFIGURATION - Configuration to use # (e.g., msw, mswd, mswu, mswunivud, etc.) +# wxWidgets_EXCLUDE_COMMON_LIBRARIES +# - Set to TRUE to exclude linking of +# commonly required libs (e.g., png tiff +# jpeg zlib regex expat). # # For unix style it uses the wx-config utility. You can select between # debug/release, unicode/ansi, universal/non-universal, and @@ -213,8 +217,12 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32") ENDIF(wxWidgets_USE_MONOLITHIC) ENDIF(NOT wxWidgets_FIND_COMPONENTS) - # Always add the common required libs. - LIST(APPEND wxWidgets_FIND_COMPONENTS ${wxWidgets_COMMON_LIBRARIES}) + # Add the common (usually required libs) unless + # wxWidgets_EXCLUDE_COMMON_LIBRARIES has been set. + IF(NOT wxWidgets_EXCLUDE_COMMON_LIBRARIES) + LIST(APPEND wxWidgets_FIND_COMPONENTS + ${wxWidgets_COMMON_LIBRARIES}) + ENDIF(NOT wxWidgets_EXCLUDE_COMMON_LIBRARIES) #------------------------------------------------------------------- # WIN32: Helper MACROS @@ -715,10 +723,13 @@ ELSE(wxWidgets_FIND_STYLE STREQUAL "win32") DBG_MSG_V("wxWidgets_CXX_FLAGS=${wxWidgets_CXX_FLAGS}") - # parse definitions from cxxflags; drop -D* from CXXFLAGS and the -D prefix + # parse definitions from cxxflags; + # drop -D* from CXXFLAGS and the -D prefix STRING(REGEX MATCHALL "-D[^;]+" wxWidgets_DEFINITIONS "${wxWidgets_CXX_FLAGS}") - STRING(REGEX REPLACE "-D[^;]+;" "" + STRING(REGEX REPLACE "-D[^;]+(;|$)" "" + wxWidgets_CXX_FLAGS "${wxWidgets_CXX_FLAGS}") + STRING(REGEX REPLACE ";$" "" wxWidgets_CXX_FLAGS "${wxWidgets_CXX_FLAGS}") STRING(REPLACE "-D" "" wxWidgets_DEFINITIONS "${wxWidgets_DEFINITIONS}") diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index 123b4332b..24cee55f9 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -16,6 +16,7 @@ # gp_resolve_item # (projects can override with gp_resolve_item_override) # gp_resolved_file_type +# (projects can override with gp_resolved_file_type_override) # gp_file_type # get_prerequisites # list_prerequisites @@ -345,6 +346,9 @@ endfunction(gp_resolve_item) # embedded # other # +# Override on a per-project basis by providing a project-specific +# gp_resolved_file_type_override function. +# function(gp_resolved_file_type original_file file exepath dirs type_var) #message(STATUS "**") @@ -428,6 +432,13 @@ function(gp_resolved_file_type original_file file exepath dirs type_var) endif() endif() + # Provide a hook so that projects can override the decision on whether a + # library belongs to the system or not by whatever logic they choose: + # + if(COMMAND gp_resolved_file_type_override) + gp_resolved_file_type_override("${resolved_file}" type) + endif() + set(${type_var} "${type}" PARENT_SCOPE) #message(STATUS "**") diff --git a/Modules/Platform/CYGWIN-GNU.cmake b/Modules/Platform/CYGWIN-GNU.cmake index 6a80f62d4..24bb92aa2 100644 --- a/Modules/Platform/CYGWIN-GNU.cmake +++ b/Modules/Platform/CYGWIN-GNU.cmake @@ -45,6 +45,7 @@ macro(__cygwin_compiler_gnu lang) SET(CMAKE_${type}_LINK_DYNAMIC_${lang}_FLAGS "-Wl,-Bdynamic") ENDFOREACH(type) + set(CMAKE_EXE_EXPORTS_${lang}_FLAG "-Wl,--export-all-symbols") # TODO: Is -Wl,--enable-auto-import now always default? set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,--enable-auto-import") set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS}") diff --git a/Modules/Platform/Generic.cmake b/Modules/Platform/Generic.cmake index 00508b248..a4e2ec6c1 100644 --- a/Modules/Platform/Generic.cmake +++ b/Modules/Platform/Generic.cmake @@ -9,3 +9,9 @@ # (embedded) targets without operating system usually don't support shared libraries SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) + +# To help the find_xxx() commands, set at least the following so CMAKE_FIND_ROOT_PATH +# works at least for some simple cases: +SET(CMAKE_SYSTEM_INCLUDE_PATH /include ) +SET(CMAKE_SYSTEM_LIBRARY_PATH /lib ) +SET(CMAKE_SYSTEM_PROGRAM_PATH /bin ) diff --git a/Modules/Platform/Linux-Clang-C.cmake b/Modules/Platform/Linux-Clang-C.cmake new file mode 100644 index 000000000..dbf89564a --- /dev/null +++ b/Modules/Platform/Linux-Clang-C.cmake @@ -0,0 +1 @@ +INCLUDE(Platform/Linux-GNU-C) diff --git a/Modules/Platform/Linux-Clang-CXX.cmake b/Modules/Platform/Linux-Clang-CXX.cmake new file mode 100644 index 000000000..8fe251c4d --- /dev/null +++ b/Modules/Platform/Linux-Clang-CXX.cmake @@ -0,0 +1 @@ +INCLUDE(Platform/Linux-GNU-CXX) diff --git a/Modules/Platform/Linux-SunPro-CXX.cmake b/Modules/Platform/Linux-SunPro-CXX.cmake index 54904733d..8ee96586d 100644 --- a/Modules/Platform/Linux-SunPro-CXX.cmake +++ b/Modules/Platform/Linux-SunPro-CXX.cmake @@ -1,2 +1,9 @@ -SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG "-rpath-link ") +# Sun C++ 5.9 does not support -Wl, but Sun C++ 5.11 does not work without it. +# Query the compiler flags to detect whether to use -Wl. +execute_process(COMMAND ${CMAKE_CXX_COMPILER} -flags OUTPUT_VARIABLE _cxx_flags ERROR_VARIABLE _cxx_error) +if("${_cxx_flags}" MATCHES "\n-W[^\n]*component") + set(CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG "-Wl,-rpath-link,") +else() + set(CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG "-rpath-link ") +endif() SET(CMAKE_EXE_EXPORTS_CXX_FLAG "--export-dynamic") diff --git a/Modules/Platform/OSF1.cmake b/Modules/Platform/OSF1.cmake index 652bed4ba..076410a66 100644 --- a/Modules/Platform/OSF1.cmake +++ b/Modules/Platform/OSF1.cmake @@ -25,6 +25,7 @@ IF(CMAKE_SYSTEM MATCHES "OSF1-V.*") SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") ENDIF(CMAKE_SYSTEM MATCHES "OSF1-V.*") +SET(CMAKE_MAKE_INCLUDE_FROM_ROOT 1) # include $(CMAKE_BINARY_DIR)/... IF(CMAKE_COMPILER_IS_GNUCXX) # include the gcc flags diff --git a/Modules/Platform/OpenBSD.cmake b/Modules/Platform/OpenBSD.cmake index e7df46d97..b4ed66fb0 100644 --- a/Modules/Platform/OpenBSD.cmake +++ b/Modules/Platform/OpenBSD.cmake @@ -1,2 +1,18 @@ INCLUDE(Platform/NetBSD) + +# On OpenBSD, the compile time linker does not share it's configuration with +# the runtime linker. This will extract the library search paths from the +# system's ld.so.hints file which will allow CMake to set the appropriate +# -rpath-link flags +IF(NOT CMAKE_PLATFORM_RUNTIME_PATH) + EXECUTE_PROCESS(COMMAND /sbin/ldconfig -r + OUTPUT_VARIABLE LDCONFIG_HINTS + ERROR_QUIET) + STRING(REGEX REPLACE ".*search\\ directories:\\ ([^\n]*).*" "\\1" + LDCONFIG_HINTS "${LDCONFIG_HINTS}") + STRING(REGEX REPLACE ":" ";" + CMAKE_PLATFORM_RUNTIME_PATH + "${LDCONFIG_HINTS}") +ENDIF() + SET_PROPERTY(GLOBAL PROPERTY FIND_LIBRARY_USE_OPENBSD_VERSIONING 1) diff --git a/Modules/Platform/Windows-G95-Fortran.cmake b/Modules/Platform/Windows-G95-Fortran.cmake new file mode 100644 index 000000000..af0800825 --- /dev/null +++ b/Modules/Platform/Windows-G95-Fortran.cmake @@ -0,0 +1 @@ +include(Platform/Windows-GNU-Fortran) diff --git a/Modules/Platform/Windows-GNU-Fortran.cmake b/Modules/Platform/Windows-GNU-Fortran.cmake index c66feedbb..8273a199f 100644 --- a/Modules/Platform/Windows-GNU-Fortran.cmake +++ b/Modules/Platform/Windows-GNU-Fortran.cmake @@ -1,2 +1,3 @@ include(Platform/Windows-GNU) __windows_compiler_gnu(Fortran) +set(CMAKE_Fortran_USE_RESPONSE_FILE_FOR_OBJECTS 0) diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake index 6d8494073..af038417d 100644 --- a/Modules/Platform/Windows-GNU.cmake +++ b/Modules/Platform/Windows-GNU.cmake @@ -68,6 +68,8 @@ macro(__windows_compiler_gnu lang) endif() set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "") # No -fPIC on Windows + set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 1) + set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "-Wl,@") # Binary link rules. set(CMAKE_${lang}_CREATE_SHARED_MODULE diff --git a/Modules/Platform/Windows-cl.cmake b/Modules/Platform/Windows-cl.cmake index e369ac159..7463c62c5 100644 --- a/Modules/Platform/Windows-cl.cmake +++ b/Modules/Platform/Windows-cl.cmake @@ -23,19 +23,15 @@ ENDIF(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio") IF(CMAKE_GENERATOR MATCHES "Visual Studio 8") SET(CMAKE_COMPILER_2005 1) ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 8") -IF(CMAKE_GENERATOR MATCHES "Visual Studio 9") - SET(CMAKE_COMPILER_2005 1) -ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 9") - # make sure to enable languages after setting configuration types ENABLE_LANGUAGE(RC) SET(CMAKE_COMPILE_RESOURCE "rc /fo ") -# for nmake we need to compute some information about the compiler +# for nmake we need to compute some information about the compiler # that is being used. # the compiler may be free command line, 6, 7, or 71, and -# each have properties that must be determined. +# each have properties that must be determined. # to avoid running these tests with each cmake run, the # test results are saved in CMakeCPlatform.cmake, a file # that is automatically copied into try_compile directories @@ -87,25 +83,12 @@ IF(CMAKE_GENERATOR MATCHES "Makefiles") SET(MSVC80 1) SET(CMAKE_COMPILER_2005 1) ENDIF("${compilerVersion}" EQUAL 1400) - IF("${compilerVersion}" GREATER 1400) - SET(MSVC80 1) - SET(CMAKE_COMPILER_2005 1) - ENDIF("${compilerVersion}" GREATER 1400) - IF("${compilerVersion}" GREATER 1400) - SET(MSVC80 1) - SET(CMAKE_COMPILER_2005 1) - ENDIF("${compilerVersion}" GREATER 1400) IF("${compilerVersion}" EQUAL 1500) SET(MSVC90 1) - SET(MSVC80 0) ENDIF("${compilerVersion}" EQUAL 1500) - IF("${compilerVersion}" GREATER 1500) - SET(MSVC90 1) - SET(MSVC80 0) - ENDIF("${compilerVersion}" GREATER 1500) IF("${compilerVersion}" EQUAL 1600) SET(MSVC10 1) - ENDIF() + ENDIF("${compilerVersion}" EQUAL 1600) SET(MSVC_VERSION "${compilerVersion}") ELSE(NOT CMAKE_COMPILER_RETURN) MESSAGE(STATUS "Check for CL compiler version - failed") @@ -224,7 +207,7 @@ ENDIF(NOT _MACHINE_ARCH_FLAG) SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /STACK:10000000 /machine:${_MACHINE_ARCH_FLAG}") -# add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtyp +# add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtype # on versions that support it SET( MSVC_INCREMENTAL_YES_FLAG "") IF(NOT MSVC_INCREMENTAL_DEFAULT) @@ -256,7 +239,6 @@ SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELW SET (CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT}) SET (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT}) - # save computed information for this platform IF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake") CONFIGURE_FILE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake.in @@ -267,4 +249,3 @@ IF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake") CONFIGURE_FILE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake.in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCXXPlatform.cmake IMMEDIATE) ENDIF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake") - diff --git a/Modules/Platform/Windows-cl.cmake.in b/Modules/Platform/Windows-cl.cmake.in index 1a889f2bd..82a0e595f 100644 --- a/Modules/Platform/Windows-cl.cmake.in +++ b/Modules/Platform/Windows-cl.cmake.in @@ -8,6 +8,7 @@ SET(MSVC70 @MSVC70@) SET(MSVC71 @MSVC71@) SET(MSVC80 @MSVC80@) SET(MSVC90 @MSVC90@) +SET(MSVC10 @MSVC10@) SET(MSVC_IDE @MSVC_IDE@) SET(MSVC_VERSION @MSVC_VERSION@) SET(WIN32 1) diff --git a/Modules/Platform/Windows-wcl386.cmake b/Modules/Platform/Windows-wcl386.cmake index b260489d6..7fc345fee 100644 --- a/Modules/Platform/Windows-wcl386.cmake +++ b/Modules/Platform/Windows-wcl386.cmake @@ -31,7 +31,7 @@ SET(CMAKE_C_CREATE_IMPORT_LIBRARY SET(CMAKE_CXX_CREATE_IMPORT_LIBRARY ${CMAKE_C_CREATE_IMPORT_LIBRARY}) SET(CMAKE_C_LINK_EXECUTABLE - "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name '' option caseexact file {} ${CMAKE_END_TEMP_FILE}") + "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name '' option caseexact file {} ${CMAKE_END_TEMP_FILE}") SET(CMAKE_CXX_LINK_EXECUTABLE ${CMAKE_C_LINK_EXECUTABLE}) @@ -52,7 +52,7 @@ SET(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -dWIN32 -d+ -fo -pl -cc++ ${CMAKE_END_TEMP_FILE}") SET(CMAKE_CXX_CREATE_SHARED_MODULE - "wlink ${CMAKE_START_TEMP_FILE} system nt_dll ${CMAKE_WLINK_QUIET} name '' option caseexact file {} ${CMAKE_END_TEMP_FILE}") + "wlink ${CMAKE_START_TEMP_FILE} system nt_dll ${CMAKE_WLINK_QUIET} name '' option caseexact file {} ${CMAKE_END_TEMP_FILE}") SET(CMAKE_CXX_CREATE_SHARED_LIBRARY ${CMAKE_CXX_CREATE_SHARED_MODULE} ${CMAKE_CXX_CREATE_IMPORT_LIBRARY}) @@ -64,7 +64,7 @@ SET(CMAKE_C_CREATE_SHARED_LIBRARY ${CMAKE_CXX_CREATE_SHARED_LIBRARY}) SET(CMAKE_C_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_MODULE}) # create a C++ static library -SET(CMAKE_CXX_CREATE_STATIC_LIBRARY "wlib ${CMAKE_LIB_QUIET} -n -b '' ") +SET(CMAKE_CXX_CREATE_STATIC_LIBRARY "wlib ${CMAKE_LIB_QUIET} -n -b '' ") # create a C static library SET(CMAKE_C_CREATE_STATIC_LIBRARY ${CMAKE_CXX_CREATE_STATIC_LIBRARY}) diff --git a/Modules/Qt4ConfigDependentSettings.cmake b/Modules/Qt4ConfigDependentSettings.cmake index 1c5293d1a..1d77c7ad4 100644 --- a/Modules/Qt4ConfigDependentSettings.cmake +++ b/Modules/Qt4ConfigDependentSettings.cmake @@ -60,25 +60,13 @@ IF(WIN32 AND NOT QT_IS_STATIC) SET(QT_DEFINITIONS ${QT_DEFINITIONS} -DQT_DLL) ENDIF(WIN32 AND NOT QT_IS_STATIC) +IF(NOT QT_IS_STATIC) + RETURN() +ENDIF(NOT QT_IS_STATIC) # QtOpenGL dependencies -QT_QUERY_QMAKE(QMAKE_LIBS_OPENGL "QMAKE_LIBS_OPENGL") -IF(Q_WS_MAC) -# On the Mac OpenGL is probably frameworks and QMAKE_LIBS_OPENGL can be -# e.g. "-framework OpenGL -framework AGL". The separate_arguments() call in -# the other branch makes "-framework;-OpenGL;-framework;-lAGL" appear in the -# linker command. So we need to protect the "-framework foo" as -# non-separatable strings. We do this by replacing the space after -# "-framework" with an underscore, then calling separate_arguments(), and -# then we replace the underscores again with spaces. So we get proper linker -# commands. Alex - STRING(REGEX REPLACE "-framework +" "-framework_" QMAKE_LIBS_OPENGL "${QMAKE_LIBS_OPENGL}") - SEPARATE_ARGUMENTS(QMAKE_LIBS_OPENGL) - STRING(REGEX REPLACE "-framework_" "-framework " QMAKE_LIBS_OPENGL "${QMAKE_LIBS_OPENGL}") -ELSE(Q_WS_MAC) - SEPARATE_ARGUMENTS(QMAKE_LIBS_OPENGL) -ENDIF(Q_WS_MAC) -SET (QT_QTOPENGL_LIB_DEPENDENCIES ${QT_QTOPENGL_LIB_DEPENDENCIES} ${QMAKE_LIBS_OPENGL}) +find_package(OpenGL) +SET (QT_QTOPENGL_LIB_DEPENDENCIES ${OPENGL_glu_LIBRARY} ${OPENGL_gl_LIBRARY}) ## system png @@ -93,80 +81,63 @@ ENDIF(QT_QCONFIG MATCHES "system-png") # for X11, get X11 library directory IF(Q_WS_X11) - QT_QUERY_QMAKE(QMAKE_LIBDIR_X11 "QMAKE_LIBDIR_X11") + FIND_PACKAGE(X11) ENDIF(Q_WS_X11) ## X11 SM IF(QT_QCONFIG MATCHES "x11sm") - # ask qmake where the x11 libs are - FIND_LIBRARY(QT_X11_SM_LIBRARY NAMES SM PATHS ${QMAKE_LIBDIR_X11}) - FIND_LIBRARY(QT_X11_ICE_LIBRARY NAMES ICE PATHS ${QMAKE_LIBDIR_X11}) - MARK_AS_ADVANCED(QT_X11_SM_LIBRARY) - MARK_AS_ADVANCED(QT_X11_ICE_LIBRARY) - IF(QT_X11_SM_LIBRARY AND QT_X11_ICE_LIBRARY) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_X11_SM_LIBRARY} ${QT_X11_ICE_LIBRARY}) - ENDIF(QT_X11_SM_LIBRARY AND QT_X11_ICE_LIBRARY) + IF(X11_SM_LIB AND X11_ICE_LIB) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_SM_LIB} ${X11_ICE_LIB}) + ENDIF(X11_SM_LIB AND X11_ICE_LIB) ENDIF(QT_QCONFIG MATCHES "x11sm") ## Xi IF(QT_QCONFIG MATCHES "tablet") - FIND_LIBRARY(QT_XI_LIBRARY NAMES Xi PATHS ${QMAKE_LIBDIR_X11}) - MARK_AS_ADVANCED(QT_XI_LIBRARY) - IF(QT_XI_LIBRARY) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XI_LIBRARY}) - ENDIF(QT_XI_LIBRARY) + IF(X11_Xi_LIB) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xi_LIB}) + ENDIF(X11_Xi_LIB) ENDIF(QT_QCONFIG MATCHES "tablet") ## Xrender IF(QT_QCONFIG MATCHES "xrender") - FIND_LIBRARY(QT_XRENDER_LIBRARY NAMES Xrender PATHS ${QMAKE_LIBDIR_X11}) - MARK_AS_ADVANCED(QT_XRENDER_LIBRARY) - IF(QT_XRENDER_LIBRARY) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XRENDER_LIBRARY}) - ENDIF(QT_XRENDER_LIBRARY) + IF(X11_Xrender_LIB) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xrender_LIB}) + ENDIF(X11_Xrender_LIB) ENDIF(QT_QCONFIG MATCHES "xrender") ## Xrandr IF(QT_QCONFIG MATCHES "xrandr") - FIND_LIBRARY(QT_XRANDR_LIBRARY NAMES Xrandr PATHS ${QMAKE_LIBDIR_X11}) - MARK_AS_ADVANCED(QT_XRANDR_LIBRARY) - IF(QT_XRANDR_LIBRARY) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XRANDR_LIBRARY}) - ENDIF(QT_XRANDR_LIBRARY) + IF(X11_Xrandr_LIB) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xrandr_LIB}) + ENDIF(X11_Xrandr_LIB) ENDIF(QT_QCONFIG MATCHES "xrandr") ## Xcursor IF(QT_QCONFIG MATCHES "xcursor") - FIND_LIBRARY(QT_XCURSOR_LIBRARY NAMES Xcursor PATHS ${QMAKE_LIBDIR_X11}) - MARK_AS_ADVANCED(QT_XCURSOR_LIBRARY) - IF(QT_XCURSOR_LIBRARY) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XCURSOR_LIBRARY}) - ENDIF(QT_XCURSOR_LIBRARY) + IF(X11_Xcursor_LIB) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xcursor_LIB}) + ENDIF(X11_Xcursor_LIB) ENDIF(QT_QCONFIG MATCHES "xcursor") ## Xinerama IF(QT_QCONFIG MATCHES "xinerama") - FIND_LIBRARY(QT_XINERAMA_LIBRARY NAMES Xinerama PATHS ${QMAKE_LIBDIR_X11}) - MARK_AS_ADVANCED(QT_XINERAMA_LIBRARY) - IF(QT_XINERAMA_LIBRARY) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XINERAMA_LIBRARY}) - ENDIF(QT_XINERAMA_LIBRARY) + IF(X11_Xinerama_LIB) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xinerama_LIB}) + ENDIF(X11_Xinerama_LIB) ENDIF(QT_QCONFIG MATCHES "xinerama") ## Xfixes IF(QT_QCONFIG MATCHES "xfixes") - FIND_LIBRARY(QT_XFIXES_LIBRARY NAMES Xfixes PATHS ${QMAKE_LIBDIR_X11}) - MARK_AS_ADVANCED(QT_XFIXES_LIBRARY) - IF(QT_XFIXES_LIBRARY) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_XFIXES_LIBRARY}) - ENDIF(QT_XFIXES_LIBRARY) + IF(X11_Xfixes_LIB) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xfixes_LIB}) + ENDIF(X11_Xfixes_LIB) ENDIF(QT_QCONFIG MATCHES "xfixes") @@ -327,24 +298,16 @@ ENDIF(QT_QCONFIG MATCHES "clock-monotonic") IF(Q_WS_X11) - # X11 libraries Qt absolutely depends on - QT_QUERY_QMAKE(QT_LIBS_X11 "QMAKE_LIBS_X11") - SEPARATE_ARGUMENTS(QT_LIBS_X11) - FOREACH(QT_X11_LIB ${QT_LIBS_X11}) - STRING(REGEX REPLACE "-l" "" QT_X11_LIB "${QT_X11_LIB}") - SET(QT_TMP_STR "QT_X11_${QT_X11_LIB}_LIBRARY") - FIND_LIBRARY(${QT_TMP_STR} NAMES "${QT_X11_LIB}" PATHS ${QMAKE_LIBDIR_X11}) - MARK_AS_ADVANCED(${QT_TMP_STR}) - IF(${QT_TMP_STR}) - SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${${QT_TMP_STR}}) - ENDIF(${QT_TMP_STR}) - ENDFOREACH(QT_X11_LIB) - - QT_QUERY_QMAKE(QT_LIBS_THREAD "QMAKE_LIBS_THREAD") - SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${QT_LIBS_THREAD}) - - QT_QUERY_QMAKE(QMAKE_LIBS_DYNLOAD "QMAKE_LIBS_DYNLOAD") - SET (QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${QMAKE_LIBS_DYNLOAD}) + # X11 libraries Qt always depends on + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xext_LIB} ${X11_X11_LIB}) + + set(CMAKE_THREAD_PREFER_PTHREADS 1) + find_package(Threads) + if(CMAKE_USE_PTHREADS_INIT) + SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${CMAKE_THREAD_LIBS_INIT}) + endif(CMAKE_USE_PTHREADS_INIT) + + SET (QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${CMAKE_DL_LIBS}) ENDIF(Q_WS_X11) diff --git a/Modules/UseQt4.cmake b/Modules/UseQt4.cmake index b7b6d59ad..63a091973 100644 --- a/Modules/UseQt4.cmake +++ b/Modules/UseQt4.cmake @@ -65,11 +65,12 @@ SET(QT_QAXSERVER_MODULE_DEPENDS QTGUI QTCORE) SET(QT_QTSCRIPTTOOLS_MODULE_DEPENDS QTGUI QTCORE) SET(QT_QTWEBKIT_MODULE_DEPENDS QTXMLPATTERNS QTGUI QTCORE) SET(QT_QTDECLARATIVE_MODULE_DEPENDS QTWEBKIT QTSCRIPT QTSVG QTSQL QTXMLPATTERNS QTXML QTOPENGL QTGUI QTNETWORK QTCORE) +SET(QT_QTMULTIMEDIA_MODULE_DEPENDS QTGUI QTCORE) # Qt modules (in order of dependence) FOREACH(module QT3SUPPORT QTOPENGL QTASSISTANT QTDESIGNER QTMOTIF QTNSPLUGIN QAXSERVER QAXCONTAINER QTDECLARATIVE QTSCRIPT QTSVG QTUITOOLS QTHELP - QTWEBKIT PHONON QTSCRIPTTOOLS QTGUI QTTEST QTDBUS QTXML QTSQL + QTWEBKIT PHONON QTSCRIPTTOOLS QTMULTIMEDIA QTGUI QTTEST QTDBUS QTXML QTSQL QTXMLPATTERNS QTNETWORK QTCORE) IF (QT_USE_${module} OR QT_USE_${module}_DEPENDS) diff --git a/Modules/readme.txt b/Modules/readme.txt index a292e208e..dd5200097 100644 --- a/Modules/readme.txt +++ b/Modules/readme.txt @@ -8,16 +8,16 @@ We would like all FindXXX.cmake files to produce consistent variable names. Please use the following consistent variable names for general use. XXX_INCLUDE_DIRS The final set of include directories listed in one variable for use by client code. This should not be a cache entry. -XXX_LIBRARIES The libraries to link against to use XXX. These should include full paths. This should not be a cache entry. -XXX_DEFINITIONS Definitions to use when compiling code that uses XXX. This really shouldn't include options such as (-DHAS_JPEG)that a client source-code file uses to decide whether to #include -XXX_EXECUTABLE Where to find the XXX tool. -XXX_YYY_EXECUTABLE Where to find the YYY tool that comes with XXX. +XXX_LIBRARIES The libraries to link against to use XXX. These should include full paths. This should not be a cache entry. +XXX_DEFINITIONS Definitions to use when compiling code that uses XXX. This really shouldn't include options such as (-DHAS_JPEG)that a client source-code file uses to decide whether to #include +XXX_EXECUTABLE Where to find the XXX tool. +XXX_YYY_EXECUTABLE Where to find the YYY tool that comes with XXX. XXX_LIBRARY_DIRS Optionally, the final set of library directories listed in one variable for use by client code. This should not be a cache entry. -XXX_ROOT_DIR Where to find the base directory of XXX. -XXX_VERSION_YY Expect Version YY if true. Make sure at most one of these is ever true. -XXX_WRAP_YY If False, do not try to use the relevent CMake wrapping command. -XXX_YY_FOUND If False, optional YY part of XXX sytem is not available. -XXX_FOUND Set to false, or undefined, if we haven't found, or don't want to use XXX. +XXX_ROOT_DIR Where to find the base directory of XXX. +XXX_VERSION_YY Expect Version YY if true. Make sure at most one of these is ever true. +XXX_WRAP_YY If False, do not try to use the relevent CMake wrapping command. +XXX_YY_FOUND If False, optional YY part of XXX sytem is not available. +XXX_FOUND Set to false, or undefined, if we haven't found, or don't want to use XXX. XXX_RUNTIME_LIBRARY_DIRS Optionally, the runtime library search path for use when running an executable linked to shared libraries. The list should be used by user code to create the PATH on windows or LD_LIBRARY_PATH on unix. This should not be a cache entry. @@ -30,9 +30,9 @@ You do not have to provide all of the above variables. You should provide XXX_FO The following names should not usually be used in CMakeLists.txt files, but they may be usefully modified in users' CMake Caches to control stuff. -XXX_LIBRARY Name of XXX Library. A User may set this and XXX_INCLUDE_DIR to ignore to force non-use of XXX. -XXX_YY_LIBRARY Name of YY library that is part of the XXX system. It may or may not be required to use XXX. -XXX_INCLUDE_DIR Where to find xxx.h, etc. (XXX_INCLUDE_PATH was considered bad because a path includes an actual filename.) +XXX_LIBRARY Name of XXX Library. A User may set this and XXX_INCLUDE_DIR to ignore to force non-use of XXX. +XXX_YY_LIBRARY Name of YY library that is part of the XXX system. It may or may not be required to use XXX. +XXX_INCLUDE_DIR Where to find xxx.h, etc. (XXX_INCLUDE_PATH was considered bad because a path includes an actual filename.) XXX_YY_INCLUDE_DIR Where to find xxx_yy.h, etc. For tidiness's sake, try to keep as many options as possible out of the cache, leaving at least one option which can be used to disable use of the module, or locate a not-found library (e.g. XXX_ROOT_DIR). For the same reason, mark most cache options as advanced. diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 09713efb8..dbbb558ea 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -111,6 +111,7 @@ ENDIF(CMAKE_USE_ELF_PARSER) # Sources for CMakeLib # SET(SRCS + cmStandardIncludes.cxx cmBootstrapCommands.cxx cmCacheManager.cxx cmCacheManager.h @@ -330,10 +331,10 @@ ENDIF (WIN32) # create a library used by the command line and the GUI ADD_LIBRARY(CMakeLib ${SRCS}) -TARGET_LINK_LIBRARIES(CMakeLib cmsys +TARGET_LINK_LIBRARIES(CMakeLib cmsys ${CMAKE_EXPAT_LIBRARIES} ${CMAKE_ZLIB_LIBRARIES} ${CMAKE_TAR_LIBRARIES} ${CMAKE_COMPRESS_LIBRARIES} - ${CMAKE_CURL_LIBRARIES}) + ${CMAKE_CURL_LIBRARIES} ) # On Apple we need Carbon IF(APPLE) @@ -366,6 +367,7 @@ SET(CTEST_SRCS cmCTest.cxx CTest/cmCTestConfigureHandler.cxx CTest/cmCTestCoverageCommand.cxx CTest/cmCTestCoverageHandler.cxx + CTest/cmParsePHPCoverage.cxx CTest/cmCTestEmptyBinaryDirectoryCommand.cxx CTest/cmCTestGenericHandler.cxx CTest/cmCTestHandlerCommand.cxx @@ -410,6 +412,7 @@ TARGET_LINK_LIBRARIES(CTestLib CMakeLib ${CMAKE_CURL_LIBRARIES} ${CMAKE_XMLRPC_L # Sources for CPack # SET(CPACK_SRCS + CPack/cmCPackArchiveGenerator.cxx CPack/cmCPackComponentGroup.cxx CPack/cmCPackGeneratorFactory.cxx CPack/cmCPackGenerator.cxx @@ -501,4 +504,3 @@ IF(APPLE) ENDIF(APPLE) INSTALL_FILES(${CMAKE_DATA_DIR}/include cmCPluginAPI.h) - diff --git a/Source/CMakeVersionSource.cmake b/Source/CMakeVersionSource.cmake new file mode 100644 index 000000000..05e265c03 --- /dev/null +++ b/Source/CMakeVersionSource.cmake @@ -0,0 +1,37 @@ +# Try to identify the current development source version. +set(CMake_VERSION_SOURCE "") +if(EXISTS ${CMake_SOURCE_DIR}/.git/HEAD) + find_program(GIT_EXECUTABLE NAMES git git.cmd) + mark_as_advanced(GIT_EXECUTABLE) + if(GIT_EXECUTABLE) + execute_process( + COMMAND ${GIT_EXECUTABLE} rev-parse --verify -q --short=4 HEAD + OUTPUT_VARIABLE head + OUTPUT_STRIP_TRAILING_WHITESPACE + WORKING_DIRECTORY ${CMake_SOURCE_DIR} + ) + if(head) + set(CMake_VERSION_SOURCE "g${head}") + execute_process( + COMMAND ${GIT_EXECUTABLE} update-index -q --refresh + WORKING_DIRECTORY ${CMake_SOURCE_DIR} + ) + execute_process( + COMMAND ${GIT_EXECUTABLE} diff-index --name-only HEAD -- + OUTPUT_VARIABLE dirty + OUTPUT_STRIP_TRAILING_WHITESPACE + WORKING_DIRECTORY ${CMake_SOURCE_DIR} + ) + if(dirty) + set(CMake_VERSION_SOURCE "${CMake_VERSION_SOURCE}-dirty") + endif() + endif() + endif() +elseif(EXISTS ${CMake_SOURCE_DIR}/CVS/Repository) + file(READ ${CMake_SOURCE_DIR}/CVS/Repository repo) + set(branch "") + if("${repo}" MATCHES "\\.git/") + string(REGEX REPLACE ".*\\.git/([^\r\n]*).*" "-\\1" branch "${repo}") + endif() + set(CMake_VERSION_SOURCE "cvs${branch}") +endif() diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx new file mode 100644 index 000000000..a52d05eea --- /dev/null +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -0,0 +1,265 @@ +/*============================================================================ + 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 "cmCPackArchiveGenerator.h" + +#include "cmake.h" +#include "cmGlobalGenerator.h" +#include "cmLocalGenerator.h" +#include "cmSystemTools.h" +#include "cmMakefile.h" +#include "cmGeneratedFileStream.h" +#include "cmCPackLog.h" +#include + +#include +#include +#include + + +//---------------------------------------------------------------------- +cmCPackArchiveGenerator::cmCPackArchiveGenerator(CompressType t, + ArchiveType at) +{ + this->Compress = t; + this->Archive = at; +} + +//---------------------------------------------------------------------- +cmCPackArchiveGenerator::~cmCPackArchiveGenerator() +{ +} + +static const size_t cmCPackTGZ_Data_BlockSize = 16384; + +// make this an anonymous namespace so that archive.h does not +// have to be included in the .h file for this class +namespace +{ +bool SetArchiveType(struct archive* a, + cmCPackArchiveGenerator::CompressType ct, + cmCPackArchiveGenerator::ArchiveType at) +{ + int res = 0; + // pick the archive type + switch(at) + { + case cmCPackArchiveGenerator::TAR: + // maybe this: + res = archive_write_set_format_pax_restricted(a); + break; + case cmCPackArchiveGenerator::ZIP: + res = archive_write_set_format_zip(a); + break; + } + if(res != ARCHIVE_OK) + { + return false; + } + + // pick a compression type + switch(ct) + { + case cmCPackArchiveGenerator::GZIP: + res = archive_write_set_compression_gzip(a); + break; + case cmCPackArchiveGenerator::BZIP2: + res = archive_write_set_compression_bzip2(a); + break; + case cmCPackArchiveGenerator::COMPRESS: + res = archive_write_set_compression_compress(a); + break; + case cmCPackArchiveGenerator::LZMA: + res = archive_write_set_compression_lzma(a); + break; + case cmCPackArchiveGenerator::NONE: + default: + res = archive_write_set_compression_none(a); + } + if(res != ARCHIVE_OK) + { + return false; + } + // do not pad the last block!! + res = archive_write_set_bytes_in_last_block(a, 1); + if(res != ARCHIVE_OK) + { + return false; + } + + return true; +} + +struct StreamData +{ + StreamData(cmGeneratedFileStream* gfs, + cmCPackArchiveGenerator* ag) + { + this->GeneratedFileStream = gfs; + this->Generator = ag; + } + cmGeneratedFileStream* GeneratedFileStream; + cmCPackArchiveGenerator* Generator; +}; + + +extern "C" +{ +int OpenArchive(struct archive *, void *client_data) +{ + struct StreamData *data = (StreamData*)client_data; + if(data->GeneratedFileStream && + *data->GeneratedFileStream) + { + if(data->Generator-> + GenerateHeader(data->GeneratedFileStream)) + { + return ARCHIVE_OK; + } + } + return (ARCHIVE_FATAL); +} + +__LA_SSIZE_T WriteArchive(struct archive *, + void *client_data, + const void *buff, + size_t n) +{ + struct StreamData *data = (StreamData*)client_data; + data->GeneratedFileStream-> + write(reinterpret_cast(buff),n); + if(!data->GeneratedFileStream->bad()) + { + return n; + } + return 0; +} + + +int CloseArchive(struct archive *, void *client_data) +{ + struct StreamData *data = (StreamData*)client_data; + if(data->GeneratedFileStream->Close()) + { + delete data->GeneratedFileStream; + return ARCHIVE_OK; + } + return ARCHIVE_FATAL; +} +} //extern C +} // anon name space + + +//---------------------------------------------------------------------- +int cmCPackArchiveGenerator::InitializeInternal() +{ + this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "1"); + return this->Superclass::InitializeInternal(); +} + +int cmCPackArchiveGenerator::CompressFiles(const char* outFileName, + const char* toplevel, const std::vector& files) +{ + int res = ARCHIVE_OK; +#define CHECK_ARCHIVE_ERROR(res, msg) \ + if(res != ARCHIVE_OK) \ + {\ + cmCPackLogger(cmCPackLog::LOG_ERROR, msg \ + << archive_error_string(a) \ + << cmSystemTools::GetLastSystemError() \ + << " " << res \ + << "\n"); \ + } + cmCPackLogger(cmCPackLog::LOG_DEBUG, "Toplevel: " + << (toplevel ? toplevel : "(NULL)") << std::endl); + // create a new archive + struct archive* a = archive_write_new(); + // Set the compress and archive types for the archive + SetArchiveType(a, this->Compress, this->Archive); + // Open binary stream + cmGeneratedFileStream* gf = new cmGeneratedFileStream; + gf->Open(outFileName, false, true); + StreamData data(gf, this); + // pass callbacks to archive_write_open to handle stream + res = archive_write_open(a, + &data, + OpenArchive, + WriteArchive, + CloseArchive); + CHECK_ARCHIVE_ERROR(res, "archive_write_open:"); + // create a new disk struct + struct archive* disk = archive_read_disk_new(); +#if !defined(_WIN32) || defined(__CYGWIN__) + res = archive_read_disk_set_standard_lookup(disk); +#endif + CHECK_ARCHIVE_ERROR(res, "archive_read_disk_set_standard_lookup:"); + std::vector::const_iterator fileIt; + std::string dir = cmSystemTools::GetCurrentWorkingDirectory(); + cmSystemTools::ChangeDirectory(toplevel); + for ( fileIt = files.begin(); fileIt != files.end(); ++ fileIt ) + { + // create a new entry for each file + struct archive_entry *entry = archive_entry_new(); + // Get the relative path to the file + std::string rp = cmSystemTools::RelativePath(toplevel, fileIt->c_str()); + // Set the name of the entry to the file name + archive_entry_set_pathname(entry, rp.c_str()); + res = archive_read_disk_entry_from_file(disk, entry, -1, 0); + CHECK_ARCHIVE_ERROR(res, "archive_read_disk_entry_from_file:"); + // write entry header + res = archive_write_header(a, entry); + CHECK_ARCHIVE_ERROR(res, "archive_write_header:"); + // the entry size can be 0 if it is a symlink + if(archive_entry_size(entry) > 0) + { + // now copy contents of file into archive a + FILE* file = fopen(fileIt->c_str(), "rb"); + if(!file) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with fopen(): " + << fileIt->c_str() + << strerror(errno) + << std::endl); + return 0; + } + char buff[cmCPackTGZ_Data_BlockSize]; + size_t len = fread(buff, 1, sizeof(buff), file); + while (len > 0) + { + size_t wlen = archive_write_data(a, buff, len); + if(wlen != len) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, "archive_write_data(): " + << "tried to write " << len << "\n" + << "write " << wlen << "\n"); + return 0; + } + len = fread(buff, 1, sizeof(buff), file); + } + // close the file and free the entry + fclose(file); + } + archive_entry_free(entry); + } + cmSystemTools::ChangeDirectory(dir.c_str()); + // close the archive and finish the write + archive_write_close(a); + archive_write_finish(a); + archive_read_finish(disk); + return 1; +} + +//---------------------------------------------------------------------- +int cmCPackArchiveGenerator::GenerateHeader(std::ostream*) +{ + return 1; +} diff --git a/Source/CPack/cmCPackArchiveGenerator.h b/Source/CPack/cmCPackArchiveGenerator.h new file mode 100644 index 000000000..486db8e5d --- /dev/null +++ b/Source/CPack/cmCPackArchiveGenerator.h @@ -0,0 +1,47 @@ +/*============================================================================ + 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 cmCPackArchiveGenerator_h +#define cmCPackArchiveGenerator_h + +#include "cmCPackGenerator.h" + + +/** \class cmCPackArchiveGenerator + * \brief A generator base for libarchive generation + * + */ +class cmCPackArchiveGenerator : public cmCPackGenerator +{ +public: + enum CompressType{ GZIP, BZIP2, COMPRESS, LZMA, NONE}; + enum ArchiveType{ TAR, ZIP}; + cmTypeMacro(cmCPackArchiveGenerator, cmCPackGenerator); + + /** + * Construct generator + */ + cmCPackArchiveGenerator(CompressType, ArchiveType); + virtual ~cmCPackArchiveGenerator(); + // Used to add a header to the archive + virtual int GenerateHeader(std::ostream* os); + +protected: + virtual int InitializeInternal(); + int CompressFiles(const char* outFileName, const char* toplevel, + const std::vector& files); + virtual const char* GetOutputExtension() = 0; + CompressType Compress; + ArchiveType Archive; +}; + +#endif diff --git a/Source/CPack/cmCPackCygwinBinaryGenerator.cxx b/Source/CPack/cmCPackCygwinBinaryGenerator.cxx index 8a7679cf9..853a1beb6 100644 --- a/Source/CPack/cmCPackCygwinBinaryGenerator.cxx +++ b/Source/CPack/cmCPackCygwinBinaryGenerator.cxx @@ -25,7 +25,6 @@ //---------------------------------------------------------------------- cmCPackCygwinBinaryGenerator::cmCPackCygwinBinaryGenerator() { - this->Compress = false; } //---------------------------------------------------------------------- @@ -38,18 +37,6 @@ int cmCPackCygwinBinaryGenerator::InitializeInternal() { this->SetOptionIfNotSet("CPACK_PACKAGING_INSTALL_PREFIX", "/usr"); this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "0"); - std::vector path; - std::string pkgPath = cmSystemTools::FindProgram("bzip2", path, false); - if ( pkgPath.empty() ) - { - cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find BZip2" << std::endl); - return 0; - } - this->SetOptionIfNotSet("CPACK_INSTALLER_PROGRAM", pkgPath.c_str()); - cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Found Compress program: " - << pkgPath.c_str() - << std::endl); - return this->Superclass::InitializeInternal(); } @@ -85,6 +72,7 @@ int cmCPackCygwinBinaryGenerator::CompressFiles(const char* outFileName, // add the manifest file to the list of all files std::vector filesWithManifest = files; filesWithManifest.push_back(manifestFile); + // create the bzip2 tar file return this->Superclass::CompressFiles(outFileName, toplevel, filesWithManifest); diff --git a/Source/CPack/cmCPackCygwinSourceGenerator.cxx b/Source/CPack/cmCPackCygwinSourceGenerator.cxx index 32c4e38ff..cca833854 100644 --- a/Source/CPack/cmCPackCygwinSourceGenerator.cxx +++ b/Source/CPack/cmCPackCygwinSourceGenerator.cxx @@ -33,7 +33,6 @@ //---------------------------------------------------------------------- cmCPackCygwinSourceGenerator::cmCPackCygwinSourceGenerator() { - this->Compress = false; } //---------------------------------------------------------------------- @@ -45,18 +44,6 @@ cmCPackCygwinSourceGenerator::~cmCPackCygwinSourceGenerator() int cmCPackCygwinSourceGenerator::InitializeInternal() { this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "0"); - std::vector path; - std::string pkgPath = cmSystemTools::FindProgram("bzip2", path, false); - if ( pkgPath.empty() ) - { - cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find BZip2" << std::endl); - return 0; - } - this->SetOptionIfNotSet("CPACK_INSTALLER_PROGRAM", pkgPath.c_str()); - cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Found Compress program: " - << pkgPath.c_str() - << std::endl); - return this->Superclass::InitializeInternal(); } @@ -67,26 +54,22 @@ int cmCPackCygwinSourceGenerator::CompressFiles(const char* outFileName, // Create a tar file of the sources std::string packageDirFileName = this->GetOption("CPACK_TEMPORARY_DIRECTORY"); - packageDirFileName += ".tar"; + packageDirFileName += ".tar.bz2"; std::string output; - // skip one parent up to the cmCPackTGZGenerator to create tar file - this->Compress = false; // just create tar not tar.gz - if ( !this->cmCPackTGZGenerator::CompressFiles(packageDirFileName.c_str(), + // skip one parent up to the cmCPackTarBZip2Generator + // to create tar.bz2 file with the list of source + // files + this->Compress = BZIP2; + if ( !this->cmCPackTarBZip2Generator:: + CompressFiles(packageDirFileName.c_str(), toplevel, files) ) { return 0; } - // Now bzip2 the source tar file - if(!this->BZip2File(packageDirFileName.c_str())) - { - cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running BZip2 on file: " - << packageDirFileName.c_str()); - return 0; - } // Now create a tar file that contains the above .tar.bz2 file // and the CPACK_CYGWIN_PATCH_FILE and CPACK_TOPLEVEL_DIRECTORY // files - std::string compressOutFile = packageDirFileName + ".bz2"; + std::string compressOutFile = packageDirFileName; // at this point compressOutFile is the full path to // _CPack_Package/.../package-2.5.0.tar.bz2 // we want to create a tar _CPack_Package/.../package-2.5.0-1-src.tar.bz2 @@ -95,7 +78,17 @@ int cmCPackCygwinSourceGenerator::CompressFiles(const char* outFileName, // _CPack_Package/.../package-2.5.0-1.sh // _CPack_Package/.../package-2.5.0.tar.bz2 // the -1 is CPACK_CYGWIN_PATCH_NUMBER + + // first copy the patch file and the .sh file + // to the toplevel cpack temp dir + // copy the patch file into place + if(!this->GetOption("CPACK_CYGWIN_PATCH_FILE")) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "No patch file specified for cygwin sources."); + return 0; + } if(!cmSystemTools::CopyFileAlways( this->GetOption("CPACK_CYGWIN_PATCH_FILE"), this->GetOption("CPACK_TOPLEVEL_DIRECTORY"))) @@ -105,6 +98,12 @@ int cmCPackCygwinSourceGenerator::CompressFiles(const char* outFileName, << this->GetOption("CPACK_TOPLEVEL_DIRECTORY") << "]\n"); return 0; } + if(!this->GetOption("CPACK_CYGWIN_BUILD_SCRIPT")) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "No build script specified for cygwin sources."); + return 0; + } // copy the build script into place if(!cmSystemTools::CopyFileAlways( this->GetOption("CPACK_CYGWIN_BUILD_SCRIPT"), @@ -115,7 +114,6 @@ int cmCPackCygwinSourceGenerator::CompressFiles(const char* outFileName, << this->GetOption("CPACK_TOPLEVEL_DIRECTORY") << "]\n"); return 0; } - // create the tar file std::string outerTarFile = this->GetOption("CPACK_TEMPORARY_DIRECTORY"); outerTarFile += "-"; @@ -127,44 +125,34 @@ int cmCPackCygwinSourceGenerator::CompressFiles(const char* outFileName, patch = "1"; } outerTarFile += patch; - outerTarFile += "-src.tar"; - std::string buildScript = cmSystemTools::GetFilenameName( + outerTarFile += "-src.tar.bz2"; + std::string tmpDir = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); + std::string buildScript = tmpDir; + buildScript += "/"; + buildScript += cmSystemTools::GetFilenameName( this->GetOption("CPACK_CYGWIN_BUILD_SCRIPT")); - std::string patchFile = cmSystemTools::GetFilenameName( + std::string patchFile = tmpDir; + patchFile += "/"; + patchFile += cmSystemTools::GetFilenameName( this->GetOption("CPACK_CYGWIN_PATCH_FILE")); - std::vector outerFiles; + std::vector outerFiles; std::string file = cmSystemTools::GetFilenameName(compressOutFile); - std::string path = cmSystemTools::GetFilenamePath(compressOutFile); + std::string sourceTar = cmSystemTools::GetFilenamePath(compressOutFile); + sourceTar += "/"; + sourceTar += file; // a source release in cygwin should have the build script used // to build the package, the patch file that is different from the // regular upstream version of the sources, and a bziped tar file // of the original sources outerFiles.push_back(buildScript); outerFiles.push_back(patchFile); - outerFiles.push_back(file); - std::string saveDir= cmSystemTools::GetCurrentWorkingDirectory(); - cmSystemTools::ChangeDirectory(path.c_str()); - cmSystemTools::CreateTar(outerTarFile.c_str(), - outerFiles, false, false); - cmSystemTools::ChangeDirectory(saveDir.c_str()); - // now compress the outer tar file - if(!this->BZip2File(outerTarFile.c_str())) + outerFiles.push_back(sourceTar); + if ( !this->cmCPackTarBZip2Generator:: + CompressFiles(outerTarFile.c_str(), + tmpDir.c_str(), outerFiles) ) { return 0; } - compressOutFile = outerTarFile; - compressOutFile += ".bz2"; - // now rename the file to its final name - if ( !cmSystemTools::SameFile(compressOutFile.c_str(), outFileName ) ) - { - if ( !this->RenameFile(compressOutFile.c_str(), outFileName) ) - { - cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem renaming: \"" - << compressOutFile.c_str() << "\" to \"" - << (outFileName ? outFileName : "(NULL)") << std::endl); - return 0; - } - } return 1; } diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 6224b4070..4a4b428fc 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -789,7 +789,7 @@ int cmCPackGenerator::DoPackage() cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Remove toplevel directory: " << toplevelDirectory << std::endl); - if ( !cmSystemTools::RemoveADirectory(toplevelDirectory) ) + if ( !cmSystemTools::RepeatedRemoveDirectory(toplevelDirectory) ) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem removing toplevel directory: " @@ -1084,7 +1084,7 @@ int cmCPackGenerator::CleanTemporaryDirectory() cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- Clean temporary : " << tempInstallDirectory << std::endl); - if(!cmsys::SystemTools::RemoveADirectory(tempInstallDirectory)) + if(!cmSystemTools::RepeatedRemoveDirectory(tempInstallDirectory)) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem removing temporary directory: " << diff --git a/Source/CPack/cmCPackTGZGenerator.cxx b/Source/CPack/cmCPackTGZGenerator.cxx index 99574b09f..c6ef8ae1e 100644 --- a/Source/CPack/cmCPackTGZGenerator.cxx +++ b/Source/CPack/cmCPackTGZGenerator.cxx @@ -12,34 +12,11 @@ #include "cmCPackTGZGenerator.h" -#include "cmake.h" -#include "cmGlobalGenerator.h" -#include "cmLocalGenerator.h" -#include "cmSystemTools.h" -#include "cmMakefile.h" -#include "cmGeneratedFileStream.h" -#include "cmCPackLog.h" - -#include -#include -#include -#include -#include - -//---------------------------------------------------------------------- -class cmCPackTGZGeneratorForward -{ - public: - static int GenerateHeader(cmCPackTGZGenerator* gg, std::ostream* os) - { - return gg->GenerateHeader(os); - } -}; - //---------------------------------------------------------------------- cmCPackTGZGenerator::cmCPackTGZGenerator() + :cmCPackArchiveGenerator(cmCPackArchiveGenerator::GZIP, + cmCPackArchiveGenerator::TAR) { - this->Compress = true; } //---------------------------------------------------------------------- @@ -47,248 +24,3 @@ cmCPackTGZGenerator::~cmCPackTGZGenerator() { } -static const size_t cmCPackTGZ_Data_BlockSize = 16384; - -//---------------------------------------------------------------------- -class cmCPackTGZ_Data -{ -public: - cmCPackTGZ_Data(cmCPackTGZGenerator* gen, bool compress) : - OutputStream(0), Generator(gen), - CompressionLevel(Z_DEFAULT_COMPRESSION), - Compress(compress) {} - std::ostream* OutputStream; - cmCPackTGZGenerator* Generator; - char CompressedBuffer[cmCPackTGZ_Data_BlockSize]; - int CompressionLevel; - z_stream ZLibStream; - uLong CRC; - bool Compress; -}; - -//---------------------------------------------------------------------- -extern "C" { - int cmCPackTGZ_Data_Open(void *client_data, const char* name, int oflags, - mode_t mode); - ssize_t cmCPackTGZ_Data_Write(void *client_data, void *buff, size_t n); - int cmCPackTGZ_Data_Close(void *client_data); -} - - -//---------------------------------------------------------------------- -int cmCPackTGZ_Data_Open(void *client_data, const char* pathname, - int, mode_t) -{ - cmCPackTGZ_Data *mydata = (cmCPackTGZ_Data*)client_data; - - if ( mydata->Compress ) - { - mydata->ZLibStream.zalloc = Z_NULL; - mydata->ZLibStream.zfree = Z_NULL; - mydata->ZLibStream.opaque = Z_NULL; - int strategy = Z_DEFAULT_STRATEGY; - if ( deflateInit2(&mydata->ZLibStream, mydata->CompressionLevel, - Z_DEFLATED, -MAX_WBITS, 8, strategy) != Z_OK ) - { - return -1; - } - } - - cmGeneratedFileStream* gf = new cmGeneratedFileStream; - // Open binary - gf->Open(pathname, false, true); - mydata->OutputStream = gf; - if ( !*mydata->OutputStream ) - { - return -1; - } - - if ( !cmCPackTGZGeneratorForward::GenerateHeader(mydata->Generator,gf)) - { - return -1; - } - - if ( mydata->Compress ) - { - mydata->CRC = crc32(0L, Z_NULL, 0); - } - - return 0; -} - -//---------------------------------------------------------------------- -ssize_t cmCPackTGZ_Data_Write(void *client_data, void *buff, size_t n) -{ - cmCPackTGZ_Data *mydata = (cmCPackTGZ_Data*)client_data; - - if ( mydata->Compress ) - { - mydata->ZLibStream.avail_in = static_cast(n); - mydata->ZLibStream.next_in = reinterpret_cast(buff); - - do { - mydata->ZLibStream.avail_out = cmCPackTGZ_Data_BlockSize; - mydata->ZLibStream.next_out - = reinterpret_cast(mydata->CompressedBuffer); - // no bad return value - int ret = deflate(&mydata->ZLibStream, (n?Z_NO_FLUSH:Z_FINISH)); - if(ret == Z_STREAM_ERROR) - { - return 0; - } - - size_t compressedSize - = cmCPackTGZ_Data_BlockSize - mydata->ZLibStream.avail_out; - - mydata->OutputStream->write( - reinterpret_cast(mydata->CompressedBuffer), - compressedSize); - } while ( mydata->ZLibStream.avail_out == 0 ); - - if ( !*mydata->OutputStream ) - { - return 0; - } - if ( n ) - { - mydata->CRC = crc32(mydata->CRC, reinterpret_cast(buff), - static_cast(n)); - } - } - else - { - mydata->OutputStream->write(reinterpret_cast(buff), n); - } - return n; -} - -//---------------------------------------------------------------------- -int cmCPackTGZ_Data_Close(void *client_data) -{ - cmCPackTGZ_Data *mydata = (cmCPackTGZ_Data*)client_data; - - if ( mydata->Compress ) - { - cmCPackTGZ_Data_Write(client_data, 0, 0); - - char buffer[8]; - int n; - uLong x = mydata->CRC; - for (n = 0; n < 4; n++) { - buffer[n] = static_cast(x & 0xff); - x >>= 8; - } - x = mydata->ZLibStream.total_in; - for (n = 0; n < 4; n++) { - buffer[n+4] = static_cast(x & 0xff); - x >>= 8; - } - - mydata->OutputStream->write(buffer, 8); - (void)deflateEnd(&mydata->ZLibStream); - } - delete mydata->OutputStream; - mydata->OutputStream = 0; - return (0); -} - -//---------------------------------------------------------------------- -int cmCPackTGZGenerator::InitializeInternal() -{ - this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "1"); - return this->Superclass::InitializeInternal(); -} - -//---------------------------------------------------------------------- -int cmCPackTGZGenerator::CompressFiles(const char* outFileName, - const char* toplevel, const std::vector& files) -{ - cmCPackLogger(cmCPackLog::LOG_DEBUG, "Toplevel: " - << (toplevel ? toplevel : "(NULL)") << std::endl); - cmCPackTGZ_Data mydata(this, this->Compress); - TAR *t; - char buf[TAR_MAXPATHLEN]; - char pathname[TAR_MAXPATHLEN]; - - tartype_t gztype = { - (openfunc_t)cmCPackTGZ_Data_Open, - (closefunc_t)cmCPackTGZ_Data_Close, - (readfunc_t)0, - (writefunc_t)cmCPackTGZ_Data_Write, - &mydata - }; - - // This libtar is not const safe. Make a non-const copy of outFileName - char* realName = new char[ strlen(outFileName) + 1 ]; - strcpy(realName, outFileName); - int flags = O_WRONLY | O_CREAT; - int options = 0; - if(this->GeneratorVerbose) - { - options |= TAR_VERBOSE; - } -#ifdef __CYGWIN__ - options |= TAR_GNU; -#endif - if (tar_open(&t, realName, - &gztype, - flags, 0644, - options) == -1) - { - cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_open(): " - << strerror(errno) << std::endl); - delete [] realName; - return 0; - } - - delete [] realName; - - std::vector::const_iterator fileIt; - for ( fileIt = files.begin(); fileIt != files.end(); ++ fileIt ) - { - std::string rp = cmSystemTools::RelativePath(toplevel, fileIt->c_str()); - strncpy(pathname, fileIt->c_str(), sizeof(pathname)); - pathname[sizeof(pathname)-1] = 0; - strncpy(buf, rp.c_str(), sizeof(buf)); - buf[sizeof(buf)-1] = 0; - if (tar_append_tree(t, pathname, buf) != 0) - { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem with tar_append_tree(\"" << buf << "\", \"" - << pathname << "\"): " - << strerror(errno) << std::endl); - tar_close(t); - return 0; - } - } - if (tar_append_eof(t) != 0) - { - cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_append_eof(): " - << strerror(errno) << std::endl); - tar_close(t); - return 0; - } - - if (tar_close(t) != 0) - { - cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_close(): " - << strerror(errno) << std::endl); - return 0; - } - return 1; -} - -//---------------------------------------------------------------------- -int cmCPackTGZGenerator::GenerateHeader(std::ostream* os) -{ - if ( this->Compress ) - { - const int gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */ - char header[11]; - sprintf(header, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1], - Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, - 3 /* zlib os code for UNIX, not really used anyway */); - os->write(header, 10); - } - return 1; -} diff --git a/Source/CPack/cmCPackTGZGenerator.h b/Source/CPack/cmCPackTGZGenerator.h index 099775dd8..3a9fc6b41 100644 --- a/Source/CPack/cmCPackTGZGenerator.h +++ b/Source/CPack/cmCPackTGZGenerator.h @@ -13,35 +13,23 @@ #ifndef cmCPackTGZGenerator_h #define cmCPackTGZGenerator_h -#include "cmCPackGenerator.h" - -class cmCPackTGZGeneratorForward; +#include "cmCPackArchiveGenerator.h" /** \class cmCPackTGZGenerator * \brief A generator for TGZ files * - * http://people.freebsd.org/~kientzle/libarchive/ */ -class cmCPackTGZGenerator : public cmCPackGenerator +class cmCPackTGZGenerator : public cmCPackArchiveGenerator { public: - friend class cmCPackTGZGeneratorForward; - cmCPackTypeMacro(cmCPackTGZGenerator, cmCPackGenerator); - + cmCPackTypeMacro(cmCPackTGZGenerator, cmCPackArchiveGenerator); /** * Construct generator */ cmCPackTGZGenerator(); virtual ~cmCPackTGZGenerator(); - protected: - virtual int InitializeInternal(); - virtual int GenerateHeader(std::ostream* os); - int CompressFiles(const char* outFileName, const char* toplevel, - const std::vector& files); virtual const char* GetOutputExtension() { return ".tar.gz"; } - - bool Compress; }; #endif diff --git a/Source/CPack/cmCPackTarBZip2Generator.cxx b/Source/CPack/cmCPackTarBZip2Generator.cxx index de7f16c18..52826dc18 100644 --- a/Source/CPack/cmCPackTarBZip2Generator.cxx +++ b/Source/CPack/cmCPackTarBZip2Generator.cxx @@ -11,29 +11,11 @@ ============================================================================*/ #include "cmCPackTarBZip2Generator.h" - -#include "cmake.h" -#include "cmGlobalGenerator.h" -#include "cmLocalGenerator.h" -#include "cmSystemTools.h" -#include "cmMakefile.h" -#include "cmGeneratedFileStream.h" -#include "cmCPackLog.h" - -#include - -// Includes needed for implementation of RenameFile. This is not in -// system tools because it is not implemented robustly enough to move -// files across directories. -#ifdef _WIN32 -# include -# include -#endif - //---------------------------------------------------------------------- -cmCPackTarBZip2Generator::cmCPackTarBZip2Generator() +cmCPackTarBZip2Generator::cmCPackTarBZip2Generator() + :cmCPackArchiveGenerator(cmCPackArchiveGenerator::BZIP2, + cmCPackArchiveGenerator::TAR) { - this->Compress = false; } //---------------------------------------------------------------------- @@ -41,135 +23,3 @@ cmCPackTarBZip2Generator::~cmCPackTarBZip2Generator() { } -//---------------------------------------------------------------------- -int cmCPackTarBZip2Generator::InitializeInternal() -{ - this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "1"); - std::vector path; - std::string pkgPath = cmSystemTools::FindProgram("bzip2", path, false); - if ( pkgPath.empty() ) - { - cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find BZip2" << std::endl); - return 0; - } - this->SetOptionIfNotSet("CPACK_INSTALLER_PROGRAM", pkgPath.c_str()); - cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Found Compress program: " - << pkgPath.c_str() - << std::endl); - - return this->Superclass::InitializeInternal(); -} - -//---------------------------------------------------------------------- -int cmCPackTarBZip2Generator::BZip2File(const char* packageDirFileName) -{ - int retVal = 0; - cmOStringStream dmgCmd1; - dmgCmd1 << "\"" << this->GetOption("CPACK_INSTALLER_PROGRAM") - << "\" \"" << packageDirFileName - << "\""; - retVal = -1; - std::string output; - int res = cmSystemTools::RunSingleCommand(dmgCmd1.str().c_str(), &output, - &retVal, 0, this->GeneratorVerbose, 0); - if ( !res || retVal ) - { - std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); - tmpFile += "/CompressBZip2.log"; - cmGeneratedFileStream ofs(tmpFile.c_str()); - ofs << "# Run command: " << dmgCmd1.str().c_str() << std::endl - << "# Output:" << std::endl - << output.c_str() << std::endl; - cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running BZip2 command: " - << dmgCmd1.str().c_str() << std::endl - << "Please check " << tmpFile.c_str() << " for errors" << std::endl); - return 0; - } - return 1; -} - -//---------------------------------------------------------------------- -int cmCPackTarBZip2Generator::CompressFiles(const char* outFileName, - const char* toplevel, const std::vector& files) -{ - std::string packageDirFileName - = this->GetOption("CPACK_TEMPORARY_DIRECTORY"); - packageDirFileName += ".tar"; - std::string output; - if ( !this->Superclass::CompressFiles(packageDirFileName.c_str(), - toplevel, files) ) - { - return 0; - } - - if(!this->BZip2File(packageDirFileName.c_str())) - { - return 0; - } - - std::string compressOutFile = packageDirFileName + ".bz2"; - if ( !cmSystemTools::SameFile(compressOutFile.c_str(), outFileName ) ) - { - if ( !this->RenameFile(compressOutFile.c_str(), outFileName) ) - { - cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem renaming: \"" - << compressOutFile.c_str() << "\" to \"" - << (outFileName ? outFileName : "(NULL)") << std::endl); - return 0; - } - } - - return 1; -} - -//---------------------------------------------------------------------------- -int cmCPackTarBZip2Generator::RenameFile(const char* oldname, - const char* newname) -{ -#ifdef _WIN32 - /* On Windows the move functions will not replace existing files. - Check if the destination exists. */ - struct stat newFile; - if(stat(newname, &newFile) == 0) - { - /* The destination exists. We have to replace it carefully. The - MoveFileEx function does what we need but is not available on - Win9x. */ - OSVERSIONINFO osv; - DWORD attrs; - - /* Make sure the destination is not read only. */ - attrs = GetFileAttributes(newname); - if(attrs & FILE_ATTRIBUTE_READONLY) - { - SetFileAttributes(newname, attrs & ~FILE_ATTRIBUTE_READONLY); - } - - /* Check the windows version number. */ - osv.dwOSVersionInfoSize = sizeof(osv); - GetVersionEx(&osv); - if(osv.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) - { - /* This is Win9x. There is no MoveFileEx implementation. We - cannot quite rename the file atomically. Just delete the - destination and then move the file. */ - DeleteFile(newname); - return MoveFile(oldname, newname); - } - else - { - /* This is not Win9x. Use the MoveFileEx implementation. */ - return MoveFileEx(oldname, newname, MOVEFILE_REPLACE_EXISTING); - } - } - else - { - /* The destination does not exist. Just move the file. */ - return MoveFile(oldname, newname); - } -#else - /* On UNIX we have an OS-provided call to do this atomically. */ - return rename(oldname, newname) == 0; -#endif -} - diff --git a/Source/CPack/cmCPackTarBZip2Generator.h b/Source/CPack/cmCPackTarBZip2Generator.h index 7b4ed650e..74c244e5a 100644 --- a/Source/CPack/cmCPackTarBZip2Generator.h +++ b/Source/CPack/cmCPackTarBZip2Generator.h @@ -13,30 +13,22 @@ #ifndef cmCPackTarBZip2Generator_h #define cmCPackTarBZip2Generator_h -#include "cmCPackTGZGenerator.h" +#include "cmCPackArchiveGenerator.h" /** \class cmCPackTarBZip2Generator * \brief A generator for TarBZip2 files */ -class cmCPackTarBZip2Generator : public cmCPackTGZGenerator +class cmCPackTarBZip2Generator : public cmCPackArchiveGenerator { public: - friend class cmCPackTarBZip2GeneratorForward; - cmCPackTypeMacro(cmCPackTarBZip2Generator, cmCPackTGZGenerator); - + cmCPackTypeMacro(cmCPackTarBZip2Generator, cmCPackArchiveGenerator); /** * Construct generator */ cmCPackTarBZip2Generator(); virtual ~cmCPackTarBZip2Generator(); - protected: - virtual int InitializeInternal(); - int CompressFiles(const char* outFileName, const char* toplevel, - const std::vector& files); virtual const char* GetOutputExtension() { return ".tar.bz2"; } - int BZip2File(const char* filename); - int RenameFile(const char* oldname, const char* newname); }; #endif diff --git a/Source/CPack/cmCPackTarCompressGenerator.cxx b/Source/CPack/cmCPackTarCompressGenerator.cxx index 165c18122..e9b5e2e87 100644 --- a/Source/CPack/cmCPackTarCompressGenerator.cxx +++ b/Source/CPack/cmCPackTarCompressGenerator.cxx @@ -12,32 +12,10 @@ #include "cmCPackTarCompressGenerator.h" -#include "cmake.h" -#include "cmGlobalGenerator.h" -#include "cmLocalGenerator.h" -#include "cmSystemTools.h" -#include "cmMakefile.h" -#include "cmGeneratedFileStream.h" -#include "cmCPackLog.h" - -#include -#include -#include -#include -#include - //---------------------------------------------------------------------- -class cmCPackTarCompressGeneratorForward -{ -public: - static int GenerateHeader(cmCPackTarCompressGenerator* gg, std::ostream* os) - { - return gg->GenerateHeader(os); - } -}; - -//---------------------------------------------------------------------- -cmCPackTarCompressGenerator::cmCPackTarCompressGenerator() +cmCPackTarCompressGenerator::cmCPackTarCompressGenerator() + :cmCPackArchiveGenerator(cmCPackArchiveGenerator::COMPRESS, + cmCPackArchiveGenerator::TAR) { } @@ -46,206 +24,3 @@ cmCPackTarCompressGenerator::~cmCPackTarCompressGenerator() { } -//---------------------------------------------------------------------- -class cmCPackTarCompress_Data -{ -public: - cmCPackTarCompress_Data(cmCPackTarCompressGenerator* gen) : - OutputStream(0), Generator(gen) {} - std::ostream* OutputStream; - cmCPackTarCompressGenerator* Generator; - cmcompress_stream CMCompressStream; -}; - -//---------------------------------------------------------------------- -extern "C" { - // For cmTar - int cmCPackTarCompress_Data_Open(void *client_data, const char* name, - int oflags, mode_t mode); - ssize_t cmCPackTarCompress_Data_Write(void *client_data, void *buff, - size_t n); - int cmCPackTarCompress_Data_Close(void *client_data); - - // For cmCompress - int cmCPackTarCompress_Compress_Output(void* cdata, const char* data, - int len); -} - - -//---------------------------------------------------------------------- -int cmCPackTarCompress_Data_Open(void *client_data, const char* pathname, - int, mode_t) -{ - cmCPackTarCompress_Data *mydata = (cmCPackTarCompress_Data*)client_data; - - if ( !cmcompress_compress_initialize(&mydata->CMCompressStream) ) - { - return -1; - } - - mydata->CMCompressStream.client_data = mydata; - mydata->CMCompressStream.output_stream = cmCPackTarCompress_Compress_Output; - - cmGeneratedFileStream* gf = new cmGeneratedFileStream; - // Open binary - gf->Open(pathname, false, true); - mydata->OutputStream = gf; - if ( !*mydata->OutputStream ) - { - return -1; - } - - if ( !cmcompress_compress_start(&mydata->CMCompressStream) ) - { - return -1; - } - - - if ( !cmCPackTarCompressGeneratorForward::GenerateHeader( - mydata->Generator,gf)) - { - return -1; - } - - return 0; -} - -//---------------------------------------------------------------------- -ssize_t cmCPackTarCompress_Data_Write(void *client_data, void *buff, size_t n) -{ - cmCPackTarCompress_Data *mydata = (cmCPackTarCompress_Data*)client_data; - - if ( !cmcompress_compress(&mydata->CMCompressStream, buff, n) ) - { - return 0; - } - return n; -} - -//---------------------------------------------------------------------- -int cmCPackTarCompress_Data_Close(void *client_data) -{ - cmCPackTarCompress_Data *mydata = (cmCPackTarCompress_Data*)client_data; - - if ( !cmcompress_compress_finalize(&mydata->CMCompressStream) ) - { - delete mydata->OutputStream; - return -1; - } - - delete mydata->OutputStream; - mydata->OutputStream = 0; - return (0); -} - -//---------------------------------------------------------------------- -int cmCPackTarCompressGenerator::InitializeInternal() -{ - this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "1"); - return this->Superclass::InitializeInternal(); -} - -//---------------------------------------------------------------------- -int cmCPackTarCompressGenerator::CompressFiles(const char* outFileName, - const char* toplevel, const std::vector& files) -{ - cmCPackLogger(cmCPackLog::LOG_DEBUG, "Toplevel: " - << (toplevel ? toplevel : "(NULL)") << std::endl); - cmCPackTarCompress_Data mydata(this); - TAR *t; - char buf[TAR_MAXPATHLEN]; - char pathname[TAR_MAXPATHLEN]; - - tartype_t compressType = { - (openfunc_t)cmCPackTarCompress_Data_Open, - (closefunc_t)cmCPackTarCompress_Data_Close, - (readfunc_t)0, - (writefunc_t)cmCPackTarCompress_Data_Write, - &mydata - }; - - // This libtar is not const safe. Make a non-const copy of outFileName - char* realName = new char[ strlen(outFileName) + 1 ]; - strcpy(realName, outFileName); - int flags = O_WRONLY | O_CREAT; - int options = 0; - if(this->GeneratorVerbose) - { - options |= TAR_VERBOSE; - } -#ifdef __CYGWIN__ - options |= TAR_GNU; -#endif - if (tar_open(&t, realName, - &compressType, - flags, 0644, - options) == -1) - { - cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_open(): " - << strerror(errno) << std::endl); - delete [] realName; - return 0; - } - - delete [] realName; - - std::vector::const_iterator fileIt; - for ( fileIt = files.begin(); fileIt != files.end(); ++ fileIt ) - { - std::string rp = cmSystemTools::RelativePath(toplevel, fileIt->c_str()); - strncpy(pathname, fileIt->c_str(), sizeof(pathname)); - pathname[sizeof(pathname)-1] = 0; - strncpy(buf, rp.c_str(), sizeof(buf)); - buf[sizeof(buf)-1] = 0; - if (tar_append_tree(t, pathname, buf) != 0) - { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem with tar_append_tree(\"" << buf << "\", \"" - << pathname << "\"): " - << strerror(errno) << std::endl); - tar_close(t); - return 0; - } - } - if (tar_append_eof(t) != 0) - { - cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_append_eof(): " - << strerror(errno) << std::endl); - tar_close(t); - return 0; - } - - if (tar_close(t) != 0) - { - cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_close(): " - << strerror(errno) << std::endl); - return 0; - } - return 1; -} - -//---------------------------------------------------------------------- -int cmCPackTarCompress_Compress_Output(void* client_data, - const char* data, int data_length) -{ - if(!client_data) - { - return 0; - } - cmcompress_stream *cstream = static_cast(client_data); - cmCPackTarCompress_Data *mydata - = static_cast(cstream->client_data); - if ( !mydata->OutputStream ) - { - return 0; - } - mydata->OutputStream->write(data, data_length); - return data_length; -} - -//---------------------------------------------------------------------- -int cmCPackTarCompressGenerator::GenerateHeader(std::ostream* os) -{ - (void)os; - return 1; -} diff --git a/Source/CPack/cmCPackTarCompressGenerator.h b/Source/CPack/cmCPackTarCompressGenerator.h index 3c18056f4..7ff9a0ade 100644 --- a/Source/CPack/cmCPackTarCompressGenerator.h +++ b/Source/CPack/cmCPackTarCompressGenerator.h @@ -18,12 +18,10 @@ /** \class cmCPackTarCompressGenerator * \brief A generator for TarCompress files */ -class cmCPackTarCompressGenerator : public cmCPackTGZGenerator +class cmCPackTarCompressGenerator : public cmCPackArchiveGenerator { public: - friend class cmCPackTarCompressGeneratorForward; - cmCPackTypeMacro(cmCPackTarCompressGenerator, cmCPackTGZGenerator); - + cmCPackTypeMacro(cmCPackTarCompressGenerator, cmCPackArchiveGenerator); /** * Construct generator */ @@ -31,13 +29,7 @@ public: virtual ~cmCPackTarCompressGenerator(); protected: - virtual int InitializeInternal(); - int CompressFiles(const char* outFileName, const char* toplevel, - const std::vector& files); virtual const char* GetOutputExtension() { return ".tar.Z"; } - - int RenameFile(const char* oldname, const char* newname); - int GenerateHeader(std::ostream* os); }; #endif diff --git a/Source/CPack/cmCPackZIPGenerator.cxx b/Source/CPack/cmCPackZIPGenerator.cxx index 992449792..e195f83c7 100644 --- a/Source/CPack/cmCPackZIPGenerator.cxx +++ b/Source/CPack/cmCPackZIPGenerator.cxx @@ -12,14 +12,10 @@ #include "cmCPackZIPGenerator.h" -#include "cmSystemTools.h" -#include "cmGeneratedFileStream.h" -#include "cmCPackLog.h" - -#include - //---------------------------------------------------------------------- cmCPackZIPGenerator::cmCPackZIPGenerator() + :cmCPackArchiveGenerator(cmCPackArchiveGenerator::NONE, + cmCPackArchiveGenerator::ZIP) { } @@ -28,71 +24,3 @@ cmCPackZIPGenerator::~cmCPackZIPGenerator() { } -//---------------------------------------------------------------------- -int cmCPackZIPGenerator::InitializeInternal() -{ - this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "1"); - this->ReadListFile("CPackZIP.cmake"); - if ((!this->IsSet("ZIP_EXECUTABLE")) - || (!this->IsSet("CPACK_ZIP_COMMAND"))) - { - cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find a suitable ZIP program" - << std::endl); - return 0; - } - return this->Superclass::InitializeInternal(); -} - -//---------------------------------------------------------------------- -int cmCPackZIPGenerator::CompressFiles(const char* outFileName, - const char* toplevel, const std::vector& files) -{ - std::string tempFileName; - tempFileName = toplevel; - tempFileName += "/winZip.filelist"; - bool needQuotesInFile = cmSystemTools::IsOn( - this->GetOption("CPACK_ZIP_NEED_QUOTES")); - - std::string cmd = this->GetOption("CPACK_ZIP_COMMAND"); - cmsys::SystemTools::ReplaceString(cmd, "", outFileName); - cmsys::SystemTools::ReplaceString(cmd, "", "winZip.filelist"); - - { // the scope is needed for cmGeneratedFileStream - cmGeneratedFileStream out(tempFileName.c_str()); - std::vector::const_iterator fileIt; - for ( fileIt = files.begin(); fileIt != files.end(); ++ fileIt ) - { - if ( needQuotesInFile ) - { - out << "\""; - } - out << cmSystemTools::RelativePath(toplevel, fileIt->c_str()); - if ( needQuotesInFile ) - { - out << "\""; - } - out << std::endl; - } - } - - - std::string output; - int retVal = -1; - int res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output, - &retVal, toplevel, this->GeneratorVerbose, 0); - - if ( !res || retVal ) - { - std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); - tmpFile += "/CompressZip.log"; - cmGeneratedFileStream ofs(tmpFile.c_str()); - ofs << "# Run command: " << cmd.c_str() << std::endl - << "# Output:" << std::endl - << output.c_str() << std::endl; - cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running zip command: " - << cmd.c_str() << std::endl - << "Please check " << tmpFile.c_str() << " for errors" << std::endl); - return 0; - } - return 1; -} diff --git a/Source/CPack/cmCPackZIPGenerator.h b/Source/CPack/cmCPackZIPGenerator.h index 7ff0dc3b8..70e1a5fa8 100644 --- a/Source/CPack/cmCPackZIPGenerator.h +++ b/Source/CPack/cmCPackZIPGenerator.h @@ -13,18 +13,15 @@ #ifndef cmCPackZIPGenerator_h #define cmCPackZIPGenerator_h -#include "cmCPackGenerator.h" - -class cmCPackZIPGeneratorForward; +#include "cmCPackArchiveGenerator.h" /** \class cmCPackZIPGenerator * \brief A generator for ZIP files */ -class cmCPackZIPGenerator : public cmCPackGenerator +class cmCPackZIPGenerator : public cmCPackArchiveGenerator { public: - friend class cmCPackZIPGeneratorForward; - cmCPackTypeMacro(cmCPackZIPGenerator, cmCPackGenerator); + cmCPackTypeMacro(cmCPackZIPGenerator, cmCPackArchiveGenerator); /** * Construct generator @@ -33,12 +30,7 @@ public: virtual ~cmCPackZIPGenerator(); protected: - virtual int InitializeInternal(); - int CompressFiles(const char* outFileName, const char* toplevel, - const std::vector& files); virtual const char* GetOutputExtension() { return ".zip"; } - - int ZipStyle; }; #endif diff --git a/Source/CTest/cmCTestBZR.cxx b/Source/CTest/cmCTestBZR.cxx index 55b8d5b75..36302df19 100644 --- a/Source/CTest/cmCTestBZR.cxx +++ b/Source/CTest/cmCTestBZR.cxx @@ -292,7 +292,7 @@ private: if(this->EmailRegex.find(this->Rev.Author)) { this->Rev.Author = this->EmailRegex.match(1); - //email = email_regex.match(2); + this->Rev.EMail = this->EmailRegex.match(2); } } else if(strcmp(name, "timestamp") == 0 && !this->CData.empty()) diff --git a/Source/CTest/cmCTestBuildCommand.h b/Source/CTest/cmCTestBuildCommand.h index 228067e44..9eb49071c 100644 --- a/Source/CTest/cmCTestBuildCommand.h +++ b/Source/CTest/cmCTestBuildCommand.h @@ -60,10 +60,12 @@ public: virtual const char* GetFullDocumentation() { return - " ctest_build([BUILD build_dir] [RETURN_VALUE res] [APPEND]\n" - " [NUMBER_ERRORS val] [NUMBER_WARNINGS val])\n" + " ctest_build([BUILD build_dir] [TARGET target] [RETURN_VALUE res]\n" + " [APPEND][NUMBER_ERRORS val] [NUMBER_WARNINGS val])\n" "Builds the given build directory and stores results in Build.xml. " - "If no BUILD is given, the CTEST_BINARY_DIRECTORY variable is used. " + "If no BUILD is given, the CTEST_BINARY_DIRECTORY variable is used.\n" + "The TARGET variable can be used to specify a build target. If none " + "is specified, the \"all\" target will be built.\n" "The RETURN_VALUE option specifies a variable in which to store the " "return value of the native build tool. " "The NUMBER_ERRORS and NUMBER_WARNINGS options specify variables in " diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index a125459a0..bc02fbc6b 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -551,6 +551,7 @@ class cmCTestBuildHandler::FragmentCompare { public: FragmentCompare(cmFileTimeComparison* ftc): FTC(ftc) {} + FragmentCompare(): FTC(0) {} bool operator()(std::string const& l, std::string const& r) { // Order files by modification time. Use lexicographic order diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 10768866e..55a5225e7 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -10,6 +10,7 @@ See the License for more information. ============================================================================*/ #include "cmCTestCoverageHandler.h" +#include "cmParsePHPCoverage.h" #include "cmCTest.h" #include "cmake.h" #include "cmMakefile.h" @@ -125,20 +126,6 @@ private: }; -//---------------------------------------------------------------------- -//********************************************************************** -class cmCTestCoverageHandlerContainer -{ -public: - int Error; - std::string SourceDir; - std::string BinaryDir; - typedef std::vector SingleFileCoverageVector; - typedef std::map TotalCoverageMap; - TotalCoverageMap TotalCoverage; - std::ostream* OFS; -}; -//********************************************************************** //---------------------------------------------------------------------- //---------------------------------------------------------------------- @@ -380,7 +367,6 @@ int cmCTestCoverageHandler::ProcessHandler() cmsys::RegularExpression(rexIt->c_str())); } - if(this->HandleBullseyeCoverage(&cont)) { return cont.Error; @@ -392,12 +378,18 @@ int cmCTestCoverageHandler::ProcessHandler() return error; } file_count += this->HandleTracePyCoverage(&cont); + if ( file_count < 0 ) + { + return error; + } + file_count += this->HandlePHPCoverage(&cont); if ( file_count < 0 ) { return error; } error = cont.Error; + std::set uncovered = this->FindUncoveredFiles(&cont); if ( file_count == 0 ) { @@ -524,7 +516,7 @@ int cmCTestCoverageHandler::ProcessHandler() { cmOStringStream ostr; ostr << "Problem reading source file: " << fullFileName.c_str() - << " line:" << cc; + << " line:" << cc << " out total: " << fcov.size()-1; errorsWhileAccumulating.push_back(ostr.str()); error ++; break; @@ -577,13 +569,58 @@ int cmCTestCoverageHandler::ProcessHandler() this->WriteXMLLabels(covSumFile, shortFileName); covSumFile << "\t" << std::endl; } + + //Handle all the files in the extra coverage globs that have no cov data + for(std::set::iterator i = uncovered.begin(); + i != uncovered.end(); ++i) + { + std::string fileName = cmSystemTools::GetFilenameName(*i); + std::string fullPath = cont.SourceDir + "/" + *i; + + covLogFile << "\t\n" + << "\t\t" << std::endl; + + std::ifstream ifs(fullPath.c_str()); + if (!ifs) + { + cmOStringStream ostr; + ostr << "Cannot open source file: " << fullPath.c_str(); + errorsWhileAccumulating.push_back(ostr.str()); + error ++; + continue; + } + int untested = 0; + std::string line; + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Actually perfoming coverage for: " << i->c_str() << std::endl); + while (cmSystemTools::GetLineFromStream(ifs, line)) + { + covLogFile << "\t\t" + << cmXMLSafe(line) << "" << std::endl; + untested ++; + } + covLogFile << "\t\t\n\t" << std::endl; + + total_untested += untested; + covSumFile << "\tc_str()) + << "\" Covered=\"true\">\n" + << "\t\t0\n" + << "\t\t" << untested << "\n" + << "\t\t0\n" + << "\t\t0\n"; + this->WriteXMLLabels(covSumFile, *i); + covSumFile << "\t" << std::endl; + } + this->EndCoverageLogFile(covLogFile, logFileCount); if ( errorsWhileAccumulating.size() > 0 ) { cmCTestLog(this->CTest, ERROR_MESSAGE, std::endl); cmCTestLog(this->CTest, ERROR_MESSAGE, - "Error(s) while acumulating results:" << std::endl); + "Error(s) while accumulating results:" << std::endl); std::vector::iterator erIt; for ( erIt = errorsWhileAccumulating.begin(); erIt != errorsWhileAccumulating.end(); @@ -654,6 +691,8 @@ void cmCTestCoverageHandler::PopulateCustomVectors(cmMakefile *mf) " Add coverage exclude regular expressions." << std::endl); this->CTest->PopulateCustomVector(mf, "CTEST_CUSTOM_COVERAGE_EXCLUDE", this->CustomCoverageExclude); + this->CTest->PopulateCustomVector(mf, "CTEST_EXTRA_COVERAGE_GLOB", + this->ExtraCoverageGlobs); std::vector::iterator it; for ( it = this->CustomCoverageExclude.begin(); it != this->CustomCoverageExclude.end(); @@ -662,6 +701,12 @@ void cmCTestCoverageHandler::PopulateCustomVectors(cmMakefile *mf) cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Add coverage exclude: " << it->c_str() << std::endl); } + for ( it = this->ExtraCoverageGlobs.begin(); + it != this->ExtraCoverageGlobs.end(); ++it) + { + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Add coverage glob: " + << it->c_str() << std::endl); + } } //---------------------------------------------------------------------- @@ -694,6 +739,18 @@ bool IsFileInDir(const std::string &infile, const std::string &indir) return false; } +//---------------------------------------------------------------------- +int cmCTestCoverageHandler::HandlePHPCoverage( + cmCTestCoverageHandlerContainer* cont) +{ + cmParsePHPCoverage cov(*cont, this->CTest); + std::string coverageDir = this->CTest->GetBinaryDir() + "/xdebugCoverage"; + if(cmSystemTools::FileIsDirectory(coverageDir.c_str())) + { + cov.ReadPHPCoverageDirectory(coverageDir.c_str()); + } + return static_cast(cont->TotalCoverage.size()); +} //---------------------------------------------------------------------- int cmCTestCoverageHandler::HandleGCovCoverage( cmCTestCoverageHandlerContainer* cont) @@ -1703,6 +1760,7 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary( << "" << "" << std::endl; this->CTest->EndXML(covSumFile); + // Now create the coverage information for each file return this->RunBullseyeCoverageBranch(cont, coveredFileNames, @@ -1961,3 +2019,43 @@ bool cmCTestCoverageHandler::IsFilteredOut(std::string const& source) } return true; } + +//---------------------------------------------------------------------- +std::set cmCTestCoverageHandler::FindUncoveredFiles( + cmCTestCoverageHandlerContainer* cont) +{ + std::set extraMatches; + + for(std::vector::iterator i = this->ExtraCoverageGlobs.begin(); + i != this->ExtraCoverageGlobs.end(); ++i) + { + cmsys::Glob gl; + gl.RecurseOn(); + gl.RecurseThroughSymlinksOff(); + std::string glob = cont->SourceDir + "/" + *i; + gl.FindFiles(glob); + std::vector files = gl.GetFiles(); + for(std::vector::iterator f = files.begin(); + f != files.end(); ++f) + { + if(this->ShouldIDoCoverage(f->c_str(), + cont->SourceDir.c_str(), cont->BinaryDir.c_str())) + { + extraMatches.insert(this->CTest->GetShortPathToFile( + f->c_str())); + } + } + } + + if(extraMatches.size()) + { + for(cmCTestCoverageHandlerContainer::TotalCoverageMap::iterator i = + cont->TotalCoverage.begin(); i != cont->TotalCoverage.end(); ++i) + { + std::string shortPath = this->CTest->GetShortPathToFile( + i->first.c_str()); + extraMatches.erase(shortPath); + } + } + return extraMatches; +} diff --git a/Source/CTest/cmCTestCoverageHandler.h b/Source/CTest/cmCTestCoverageHandler.h index b3e4db693..d3e8503e1 100644 --- a/Source/CTest/cmCTestCoverageHandler.h +++ b/Source/CTest/cmCTestCoverageHandler.h @@ -20,8 +20,17 @@ #include class cmGeneratedFileStream; -class cmCTestCoverageHandlerContainer; - +class cmCTestCoverageHandlerContainer +{ +public: + int Error; + std::string SourceDir; + std::string BinaryDir; + typedef std::vector SingleFileCoverageVector; + typedef std::map TotalCoverageMap; + TotalCoverageMap TotalCoverage; + std::ostream* OFS; +}; /** \class cmCTestCoverageHandler * \brief A class that handles coverage computaiton for ctest * @@ -59,6 +68,9 @@ private: int HandleGCovCoverage(cmCTestCoverageHandlerContainer* cont); void FindGCovFiles(std::vector& files); + //! Handle coverage using xdebug php coverage + int HandlePHPCoverage(cmCTestCoverageHandlerContainer* cont); + //! Handle coverage using Bullseye int HandleBullseyeCoverage(cmCTestCoverageHandlerContainer* cont); int RunBullseyeSourceSummary(cmCTestCoverageHandlerContainer* cont); @@ -66,6 +78,7 @@ private: std::set& coveredFileNames, std::vector& files, std::vector& filesFullPath); + int RunBullseyeCommand( cmCTestCoverageHandlerContainer* cont, const char* cmd, @@ -91,52 +104,12 @@ private: std::string FindFile(cmCTestCoverageHandlerContainer* cont, std::string fileName); - struct cmCTestCoverage - { - cmCTestCoverage() - { - this->AbsolutePath = ""; - this->FullPath = ""; - this->Covered = false; - this->Tested = 0; - this->UnTested = 0; - this->Lines.clear(); - this->Show = false; - } - cmCTestCoverage(const cmCTestCoverage& rhs) : - AbsolutePath(rhs.AbsolutePath), - FullPath(rhs.FullPath), - Covered(rhs.Covered), - Tested(rhs.Tested), - UnTested(rhs.UnTested), - Lines(rhs.Lines), - Show(rhs.Show) - { - } - cmCTestCoverage& operator=(const cmCTestCoverage& rhs) - { - this->AbsolutePath = rhs.AbsolutePath; - this->FullPath = rhs.FullPath; - this->Covered = rhs.Covered; - this->Tested = rhs.Tested; - this->UnTested = rhs.UnTested; - this->Lines = rhs.Lines; - this->Show = rhs.Show; - return *this; - } - std::string AbsolutePath; - std::string FullPath; - bool Covered; - int Tested; - int UnTested; - std::vector Lines; - bool Show; - }; - + std::set FindUncoveredFiles( + cmCTestCoverageHandlerContainer* cont); std::vector CustomCoverageExclude; std::vector CustomCoverageExcludeRegex; + std::vector ExtraCoverageGlobs; - typedef std::map CoverageMap; // Map from source file to label ids. class LabelSet: public std::set {}; diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index 6d5bf659c..6c3631c90 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -85,14 +85,14 @@ void cmCTestGIT::NoteNewRevision() } //---------------------------------------------------------------------------- -bool cmCTestGIT::UpdateImpl() +bool cmCTestGIT::UpdateByFetchAndReset() { - // Use "git pull" to update the working tree. - std::vector git_pull; - git_pull.push_back(this->CommandLineTool.c_str()); - git_pull.push_back("pull"); + const char* git = this->CommandLineTool.c_str(); - // TODO: if(this->CTest->GetTestModel() == cmCTest::NIGHTLY) + // Use "git fetch" to get remote commits. + std::vector git_fetch; + git_fetch.push_back(git); + git_fetch.push_back("fetch"); // Add user-specified update options. std::string opts = this->CTest->GetCTestConfiguration("UpdateOptions"); @@ -104,15 +104,88 @@ bool cmCTestGIT::UpdateImpl() for(std::vector::const_iterator ai = args.begin(); ai != args.end(); ++ai) { - git_pull.push_back(ai->c_str()); + git_fetch.push_back(ai->c_str()); } // Sentinel argument. - git_pull.push_back(0); + git_fetch.push_back(0); + + // Fetch upstream refs. + OutputLogger fetch_out(this->Log, "fetch-out> "); + OutputLogger fetch_err(this->Log, "fetch-err> "); + if(!this->RunUpdateCommand(&git_fetch[0], &fetch_out, &fetch_err)) + { + return false; + } - OutputLogger out(this->Log, "pull-out> "); - OutputLogger err(this->Log, "pull-err> "); - return this->RunUpdateCommand(&git_pull[0], &out, &err); + // Identify the merge head that would be used by "git pull". + std::string sha1; + { + std::string fetch_head = this->SourceDirectory + "/.git/FETCH_HEAD"; + std::ifstream fin(fetch_head.c_str(), std::ios::in | std::ios::binary); + std::string line; + while(sha1.empty() && cmSystemTools::GetLineFromStream(fin, line)) + { + if(line.find("\tnot-for-merge\t") == line.npos) + { + std::string::size_type pos = line.find('\t'); + if(pos != line.npos) + { + sha1 = line.substr(0, pos); + } + } + } + } + + // Reset the local branch to point at that tracked from upstream. + char const* git_reset[] = {git, "reset", "--hard", sha1.c_str(), 0}; + OutputLogger reset_out(this->Log, "reset-out> "); + OutputLogger reset_err(this->Log, "reset-err> "); + return this->RunChild(&git_reset[0], &reset_out, &reset_err); +} + +//---------------------------------------------------------------------------- +bool cmCTestGIT::UpdateByCustom(std::string const& custom) +{ + std::vector git_custom_command; + cmSystemTools::ExpandListArgument(custom, git_custom_command, true); + std::vector git_custom; + for(std::vector::const_iterator + i = git_custom_command.begin(); i != git_custom_command.end(); ++i) + { + git_custom.push_back(i->c_str()); + } + git_custom.push_back(0); + + OutputLogger custom_out(this->Log, "custom-out> "); + OutputLogger custom_err(this->Log, "custom-err> "); + return this->RunUpdateCommand(&git_custom[0], &custom_out, &custom_err); +} + +//---------------------------------------------------------------------------- +bool cmCTestGIT::UpdateInternal() +{ + std::string custom = this->CTest->GetCTestConfiguration("GITUpdateCustom"); + if(!custom.empty()) + { + return this->UpdateByCustom(custom); + } + return this->UpdateByFetchAndReset(); +} + +//---------------------------------------------------------------------------- +bool cmCTestGIT::UpdateImpl() +{ + if(!this->UpdateInternal()) + { + return false; + } + + const char* git = this->CommandLineTool.c_str(); + char const* git_submodule[] = {git, "submodule", "update", 0}; + OutputLogger submodule_out(this->Log, "submodule-out> "); + OutputLogger submodule_err(this->Log, "submodule-err> "); + return this->RunChild(git_submodule, &submodule_out, &submodule_err); } //---------------------------------------------------------------------------- @@ -338,6 +411,7 @@ private: Person author; this->ParsePerson(this->Line.c_str()+7, author); this->Rev.Author = author.Name; + this->Rev.EMail = author.EMail; // Convert the time to a human-readable format that is also easy // to machine-parse: "CCYY-MM-DD hh:mm:ss". diff --git a/Source/CTest/cmCTestGIT.h b/Source/CTest/cmCTestGIT.h index 2561ed4e6..d8681fe4f 100644 --- a/Source/CTest/cmCTestGIT.h +++ b/Source/CTest/cmCTestGIT.h @@ -32,9 +32,14 @@ private: virtual void NoteNewRevision(); virtual bool UpdateImpl(); + bool UpdateByFetchAndReset(); + bool UpdateByCustom(std::string const& custom); + bool UpdateInternal(); + void LoadRevisions(); void LoadModifications(); +public: // needed by older Sun compilers // Parsing helper classes. class OneLineParser; class DiffParser; diff --git a/Source/CTest/cmCTestHG.cxx b/Source/CTest/cmCTestHG.cxx index b26367739..86a7617f1 100644 --- a/Source/CTest/cmCTestHG.cxx +++ b/Source/CTest/cmCTestHG.cxx @@ -220,7 +220,7 @@ private: } else if ( strcmp(name, "email") == 0 && !this->CData.empty()) { - // this->Rev.Email.assign(&this->CData[0], this->CData.size()); + this->Rev.EMail.assign(&this->CData[0], this->CData.size()); } else if(strcmp(name, "date") == 0 && !this->CData.empty()) { diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index b6226a3b7..9b8cef5cc 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -16,12 +16,14 @@ #include "cmSystemTools.h" #include #include +#include cmCTestMultiProcessHandler::cmCTestMultiProcessHandler() { this->ParallelLevel = 1; this->Completed = 0; this->RunningCount = 0; + this->StopTimePassed = false; } cmCTestMultiProcessHandler::~cmCTestMultiProcessHandler() @@ -68,6 +70,10 @@ void cmCTestMultiProcessHandler::RunTests() this->StartNextTests(); while(this->Tests.size() != 0) { + if(this->StopTimePassed) + { + return; + } this->CheckOutput(); this->StartNextTests(); } @@ -76,6 +82,7 @@ void cmCTestMultiProcessHandler::RunTests() { } this->MarkFinished(); + this->UpdateCostData(); } //--------------------------------------------------------- @@ -93,12 +100,22 @@ void cmCTestMultiProcessHandler::StartTestProcess(int test) std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory(); cmSystemTools::ChangeDirectory(this->Properties[test]->Directory.c_str()); + // Lock the resources we'll be using + this->LockResources(test); + if(testRun->StartTest(this->Total)) { this->RunningTests.insert(testRun); } + else if(testRun->IsStopTimePassed()) + { + this->StopTimePassed = true; + delete testRun; + return; + } else { + this->UnlockResources(test); this->Completed++; this->TestFinishMap[test] = true; this->TestRunningMap[test] = false; @@ -110,6 +127,28 @@ void cmCTestMultiProcessHandler::StartTestProcess(int test) cmSystemTools::ChangeDirectory(current_dir.c_str()); } +//--------------------------------------------------------- +void cmCTestMultiProcessHandler::LockResources(int index) +{ + for(std::set::iterator i = + this->Properties[index]->LockedResources.begin(); + i != this->Properties[index]->LockedResources.end(); ++i) + { + this->LockedResources.insert(*i); + } +} + +//--------------------------------------------------------- +void cmCTestMultiProcessHandler::UnlockResources(int index) +{ + for(std::set::iterator i = + this->Properties[index]->LockedResources.begin(); + i != this->Properties[index]->LockedResources.end(); ++i) + { + this->LockedResources.erase(*i); + } +} + //--------------------------------------------------------- void cmCTestMultiProcessHandler::EraseTest(int test) { @@ -144,6 +183,17 @@ inline size_t cmCTestMultiProcessHandler::GetProcessorsUsed(int test) //--------------------------------------------------------- bool cmCTestMultiProcessHandler::StartTest(int test) { + //Check for locked resources + for(std::set::iterator i = + this->Properties[test]->LockedResources.begin(); + i != this->Properties[test]->LockedResources.end(); ++i) + { + if(this->LockedResources.find(*i) != this->LockedResources.end()) + { + return false; + } + } + // copy the depend tests locally because when // a test is finished it will be removed from the depend list // and we don't want to be iterating a list while removing from it @@ -212,6 +262,10 @@ void cmCTestMultiProcessHandler::StartNextTests() } if(this->StartTest(*test)) { + if(this->StopTimePassed) + { + return; + } numToStart -= processors; this->RunningCount += processors; } @@ -272,8 +326,7 @@ bool cmCTestMultiProcessHandler::CheckOutput() this->TestRunningMap[test] = false; this->RunningTests.erase(p); this->WriteCheckpoint(test); - this->WriteCostData(test, static_cast( - p->GetTestResults().ExecutionTime)); + this->UnlockResources(test); this->RunningCount -= GetProcessorsUsed(test); delete p; } @@ -281,53 +334,160 @@ bool cmCTestMultiProcessHandler::CheckOutput() } //--------------------------------------------------------- -void cmCTestMultiProcessHandler::ReadCostData() +void cmCTestMultiProcessHandler::UpdateCostData() { - std::string fname = this->CTest->GetBinaryDir() - + "/Testing/Temporary/CTestCostData.txt"; + std::string fname = this->CTest->GetCostDataFile(); + std::string tmpout = fname + ".tmp"; + std::fstream fout; + fout.open(tmpout.c_str(), std::ios::out); + + PropertiesMap temp = this->Properties; - if(cmSystemTools::FileExists(fname.c_str(), true) - && this->ParallelLevel > 1) - { + if(cmSystemTools::FileExists(fname.c_str())) + { std::ifstream fin; fin.open(fname.c_str()); + std::string line; while(std::getline(fin, line)) { + if(line == "---") break; std::vector parts = cmSystemTools::SplitString(line.c_str(), ' '); + //Format: + if(parts.size() < 3) break; + + std::string name = parts[0]; + int prev = atoi(parts[1].c_str()); + float cost = static_cast(atof(parts[2].c_str())); + + int index = this->SearchByName(name); + if(index == -1) + { + // This test is not in memory. We just rewrite the entry + fout << name << " " << prev << " " << cost << "\n"; + } + else + { + // Update with our new average cost + fout << name << " " << this->Properties[index]->PreviousRuns << " " + << this->Properties[index]->Cost << "\n"; + temp.erase(index); + } + } + fin.close(); + cmSystemTools::RemoveFile(fname.c_str()); + } + + // Add all tests not previously listed in the file + for(PropertiesMap::iterator i = temp.begin(); i != temp.end(); ++i) + { + fout << i->second->Name << " " << i->second->PreviousRuns << " " + << i->second->Cost << "\n"; + } + + // Write list of failed tests + fout << "---\n"; + for(std::vector::iterator i = this->Failed->begin(); + i != this->Failed->end(); ++i) + { + fout << i->c_str() << "\n"; + } + fout.close(); + cmSystemTools::RenameFile(tmpout.c_str(), fname.c_str()); +} + +//--------------------------------------------------------- +void cmCTestMultiProcessHandler::ReadCostData() +{ + std::string fname = this->CTest->GetCostDataFile(); + + if(cmSystemTools::FileExists(fname.c_str(), true)) + { + std::ifstream fin; + fin.open(fname.c_str()); + std::string line; + while(std::getline(fin, line)) + { + if(line == "---") break; + + std::vector parts = + cmSystemTools::SplitString(line.c_str(), ' '); + + // Probably an older version of the file, will be fixed next run + if(parts.size() < 3) + { + fin.close(); + return; + } - int index = atoi(parts[0].c_str()); - float cost = static_cast(atof(parts[1].c_str())); + std::string name = parts[0]; + int prev = atoi(parts[1].c_str()); + float cost = static_cast(atof(parts[2].c_str())); + + int index = this->SearchByName(name); + if(index == -1) continue; + + this->Properties[index]->PreviousRuns = prev; if(this->Properties[index] && this->Properties[index]->Cost == 0) { this->Properties[index]->Cost = cost; } } + // Next part of the file is the failed tests + while(std::getline(fin, line)) + { + if(line != "") + { + this->LastTestsFailed.push_back(line); + } + } fin.close(); } - cmSystemTools::RemoveFile(fname.c_str()); } //--------------------------------------------------------- -void cmCTestMultiProcessHandler::CreateTestCostList() +int cmCTestMultiProcessHandler::SearchByName(std::string name) { - for(TestMap::iterator i = this->Tests.begin(); - i != this->Tests.end(); ++i) + int index = -1; + + for(PropertiesMap::iterator i = this->Properties.begin(); + i != this->Properties.end(); ++i) { - this->TestCosts[this->Properties[i->first]->Cost].insert(i->first); + if(i->second->Name == name) + { + index = i->first; + } } + return index; } //--------------------------------------------------------- -void cmCTestMultiProcessHandler::WriteCostData(int index, float cost) +void cmCTestMultiProcessHandler::CreateTestCostList() { - std::string fname = this->CTest->GetBinaryDir() - + "/Testing/Temporary/CTestCostData.txt"; - std::fstream fout; - fout.open(fname.c_str(), std::ios::out | std::ios::app); - fout << index << " " << cost << "\n"; - fout.close(); + for(TestMap::iterator i = this->Tests.begin(); + i != this->Tests.end(); ++i) + { + //We only want to schedule them by cost in a parallel situation + if(this->ParallelLevel > 1) + { + std::string name = this->Properties[i->first]->Name; + if(std::find(this->LastTestsFailed.begin(), this->LastTestsFailed.end(), + name) != this->LastTestsFailed.end()) + { + this->TestCosts[FLT_MAX].insert(i->first); + } + else + { + this->TestCosts[this->Properties[i->first]->Cost].insert(i->first); + } + } + else //we ignore their cost + { + this->TestCosts[this->Tests.size() + - this->Properties[i->first]->Index].insert(i->first); + } + } } //--------------------------------------------------------- @@ -336,7 +496,7 @@ void cmCTestMultiProcessHandler::WriteCheckpoint(int index) std::string fname = this->CTest->GetBinaryDir() + "/Testing/Temporary/CTestCheckpoint.txt"; std::fstream fout; - fout.open(fname.c_str(), std::ios::app); + fout.open(fname.c_str(), std::ios::app | std::ios::out); fout << index << "\n"; fout.close(); } diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h index 16591b043..4f51b0b43 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.h +++ b/Source/CTest/cmCTestMultiProcessHandler.h @@ -55,8 +55,7 @@ public: cmCTestTestHandler * GetTestHandler() { return this->TestHandler; } -protected: - cmCTest* CTest; +protected: // Start the next test or tests as many as are allowed by // ParallelLevel void StartNextTests(); @@ -64,8 +63,12 @@ protected: bool StartTest(int test); // Mark the checkpoint for the given test void WriteCheckpoint(int index); - void WriteCostData(int index, float cost); + + void UpdateCostData(); void ReadCostData(); + // Return index of a test based on its name + int SearchByName(std::string name); + void CreateTestCostList(); // Removes the checkpoint file void MarkFinished(); @@ -80,6 +83,9 @@ protected: bool CheckCycles(); int FindMaxIndex(); inline size_t GetProcessorsUsed(int index); + + void LockResources(int index); + void UnlockResources(int index); // map from test number to set of depend tests TestMap Tests; TestCostMap TestCosts; @@ -88,6 +94,7 @@ protected: //Number of tests that are complete size_t Completed; size_t RunningCount; + bool StopTimePassed; //list of test properties (indices concurrent to the test map) PropertiesMap Properties; std::map TestRunningMap; @@ -95,10 +102,13 @@ protected: std::map TestOutput; std::vector* Passed; std::vector* Failed; + std::vector LastTestsFailed; + std::set LockedResources; std::vector* TestResults; size_t ParallelLevel; // max number of process that can be run at once std::set RunningTests; // current running tests cmCTestTestHandler * TestHandler; + cmCTest* CTest; }; #endif diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 24d1d9f48..9fb8827e9 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -14,6 +14,7 @@ #include "cmCTestMemCheckHandler.h" #include "cmCTest.h" #include "cmSystemTools.h" +#include "cm_curl.h" #include #include @@ -22,7 +23,6 @@ cmCTestRunTest::cmCTestRunTest(cmCTestTestHandler* handler) { this->CTest = handler->CTest; this->TestHandler = handler; - this->ModifyEnv = false; this->TestProcess = 0; this->TestResult.ExecutionTime =0; this->TestResult.ReturnValue = 0; @@ -32,6 +32,7 @@ cmCTestRunTest::cmCTestRunTest(cmCTestTestHandler* handler) this->ProcessOutput = ""; this->CompressedOutput = ""; this->CompressionRatio = 2; + this->StopTimePassed = false; } cmCTestRunTest::~cmCTestRunTest() @@ -138,11 +139,6 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) this->CompressOutput(); } - //restore the old environment - if (this->ModifyEnv) - { - cmSystemTools::RestoreEnv(this->OrigEnv); - } this->WriteLogOutputTop(completed, total); std::string reason; bool passed = true; @@ -334,6 +330,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) this->TestResult.CompletionStatus = "Completed"; this->TestResult.ExecutionTime = this->TestProcess->GetTotalTime(); this->MemCheckPostProcess(); + this->ComputeWeightedCost(); } // Always push the current TestResult onto the // TestHandler vector @@ -342,7 +339,21 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) return passed; } -//-------------------------------------------------------------- +//---------------------------------------------------------------------- +void cmCTestRunTest::ComputeWeightedCost() +{ + int prev = this->TestProperties->PreviousRuns; + float avgcost = this->TestProperties->Cost; + double current = this->TestResult.ExecutionTime; + + if(this->TestResult.Status == cmCTestTestHandler::COMPLETED) + { + this->TestProperties->Cost = ((prev * avgcost) + current) / (prev + 1); + this->TestProperties->PreviousRuns++; + } +} + +//---------------------------------------------------------------------- void cmCTestRunTest::MemCheckPostProcess() { if(!this->TestHandler->MemCheck) @@ -426,13 +437,19 @@ bool cmCTestRunTest::StartTest(size_t total) } this->StartTime = this->CTest->CurrentTime(); - return this->CreateProcess(this->TestProperties->Timeout, - &this->TestProperties->Environment); + double timeout = this->ResolveTimeout(); + + if(this->StopTimePassed) + { + return false; + } + return this->ForkProcess(timeout, &this->TestProperties->Environment); } +//---------------------------------------------------------------------- void cmCTestRunTest::ComputeArguments() { - std::vector::const_iterator j = + std::vector::const_iterator j = this->TestProperties->Args.begin(); ++j; // skip test name @@ -442,10 +459,12 @@ void cmCTestRunTest::ComputeArguments() cmCTestMemCheckHandler * handler = static_cast (this->TestHandler); this->ActualCommand = handler->MemoryTester.c_str(); + this->TestProperties->Args[1] = this->TestHandler->FindTheExecutable( + this->TestProperties->Args[1].c_str()); } else { - this->ActualCommand = + this->ActualCommand = this->TestHandler->FindTheExecutable( this->TestProperties->Args[1].c_str()); ++j; //skip the executable (it will be actualCommand) @@ -459,7 +478,7 @@ void cmCTestRunTest::ComputeArguments() i != this->Arguments.end(); ++i) { this->TestCommand += " "; - this->TestCommand += cmSystemTools::EscapeSpaces(j->c_str()); + this->TestCommand += cmSystemTools::EscapeSpaces(i->c_str()); } for(;j != this->TestProperties->Args.end(); ++j) @@ -500,7 +519,72 @@ void cmCTestRunTest::DartProcessing() } //---------------------------------------------------------------------- -bool cmCTestRunTest::CreateProcess(double testTimeOut, +double cmCTestRunTest::ResolveTimeout() +{ + double timeout = this->TestProperties->Timeout; + + if(this->CTest->GetStopTime() == "") + { + return timeout; + } + struct tm* lctime; + time_t current_time = time(0); + lctime = gmtime(¤t_time); + int gm_hour = lctime->tm_hour; + time_t gm_time = mktime(lctime); + lctime = localtime(¤t_time); + int local_hour = lctime->tm_hour; + + int tzone_offset = local_hour - gm_hour; + if(gm_time > current_time && gm_hour < local_hour) + { + // this means gm_time is on the next day + tzone_offset -= 24; + } + else if(gm_time < current_time && gm_hour > local_hour) + { + // this means gm_time is on the previous day + tzone_offset += 24; + } + + tzone_offset *= 100; + char buf[1024]; + // add todays year day and month to the time in str because + // curl_getdate no longer assumes the day is today + sprintf(buf, "%d%02d%02d %s %+05i", + lctime->tm_year + 1900, + lctime->tm_mon + 1, + lctime->tm_mday, + this->CTest->GetStopTime().c_str(), + tzone_offset); + + time_t stop_time = curl_getdate(buf, ¤t_time); + if(stop_time == -1) + { + return timeout; + } + + //the stop time refers to the next day + if(this->CTest->NextDayStopTime) + { + stop_time += 24*60*60; + } + int stop_timeout = (stop_time - current_time) % (24*60*60); + this->CTest->LastStopTimeout = stop_timeout; + + if(stop_timeout <= 0 || stop_timeout > this->CTest->LastStopTimeout) + { + cmCTestLog(this->CTest, ERROR_MESSAGE, "The stop time has been passed. " + "Stopping all tests." << std::endl); + this->StopTimePassed = true; + return 0; + } + return timeout == 0 ? stop_timeout : + (timeout < stop_timeout ? timeout : stop_timeout); +} + +//---------------------------------------------------------------------- +bool cmCTestRunTest::ForkProcess(double testTimeOut, std::vector* environment) { this->TestProcess = new cmProcess; @@ -510,9 +594,6 @@ bool cmCTestRunTest::CreateProcess(double testTimeOut, this->TestProcess->SetCommand(this->ActualCommand.c_str()); this->TestProcess->SetCommandArguments(this->Arguments); - std::vector origEnv; - this->ModifyEnv = (environment && environment->size()>0); - // determine how much time we have double timeout = this->CTest->GetRemainingTimeAllowed() - 120; if (this->CTest->GetTimeOut() > 0 && this->CTest->GetTimeOut() < timeout) @@ -535,9 +616,13 @@ bool cmCTestRunTest::CreateProcess(double testTimeOut, this->TestProcess->SetTimeout(timeout); - if (this->ModifyEnv) +#ifdef CMAKE_BUILD_WITH_CMAKE + cmSystemTools::SaveRestoreEnvironment sre; +#endif + + if (environment && environment->size()>0) { - this->OrigEnv = cmSystemTools::AppendEnv(environment); + cmSystemTools::AppendEnv(environment); } return this->TestProcess->StartProcess(); diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h index 108464356..e0cb888f8 100644 --- a/Source/CTest/cmCTestRunTest.h +++ b/Source/CTest/cmCTestRunTest.h @@ -39,6 +39,8 @@ public: std::string GetProcessOutput() { return this->ProcessOutput; } + bool IsStopTimePassed() { return this->StopTimePassed; } + cmCTestTestHandler::cmCTestTestResult GetTestResults() { return this->TestResult; } @@ -54,10 +56,14 @@ public: bool EndTest(size_t completed, size_t total, bool started); //Called by ctest -N to log the command string void ComputeArguments(); + + void ComputeWeightedCost(); private: void DartProcessing(); void ExeNotFound(std::string exe); - bool CreateProcess(double testTimeOut, + // Figures out a final timeout which is min(STOP_TIME, NOW+TIMEOUT) + double ResolveTimeout(); + bool ForkProcess(double testTimeOut, std::vector* environment); void WriteLogOutputTop(size_t completed, size_t total); //Run post processing of the process output for MemCheck @@ -73,14 +79,9 @@ private: //if this option is set to false.) //bool OptimizeForCTest; - //flag for whether the env was modified for this run - bool ModifyEnv; - bool UsePrefixCommand; std::string PrefixCommand; - //stores the original environment if we are modifying it - std::vector OrigEnv; std::string ProcessOutput; std::string CompressedOutput; double CompressionRatio; @@ -91,6 +92,7 @@ private: std::string TestCommand; std::string ActualCommand; std::vector Arguments; + bool StopTimePassed; }; inline int getNumWidth(size_t n) diff --git a/Source/CTest/cmCTestTestCommand.cxx b/Source/CTest/cmCTestTestCommand.cxx index b0adf224f..5aee035c7 100644 --- a/Source/CTest/cmCTestTestCommand.cxx +++ b/Source/CTest/cmCTestTestCommand.cxx @@ -25,6 +25,7 @@ cmCTestTestCommand::cmCTestTestCommand() this->Arguments[ctt_INCLUDE_LABEL] = "INCLUDE_LABEL"; this->Arguments[ctt_PARALLEL_LEVEL] = "PARALLEL_LEVEL"; this->Arguments[ctt_SCHEDULE_RANDOM] = "SCHEDULE_RANDOM"; + this->Arguments[ctt_STOP_TIME] = "STOP_TIME"; this->Arguments[ctt_LAST] = 0; this->Last = ctt_LAST; } @@ -98,6 +99,10 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler() handler->SetOption("ScheduleRandom", this->Values[ctt_SCHEDULE_RANDOM]); } + if(this->Values[ctt_STOP_TIME]) + { + this->CTest->SetStopTime(this->Values[ctt_STOP_TIME]); + } return handler; } diff --git a/Source/CTest/cmCTestTestCommand.h b/Source/CTest/cmCTestTestCommand.h index 12314dfe6..c6fd6314c 100644 --- a/Source/CTest/cmCTestTestCommand.h +++ b/Source/CTest/cmCTestTestCommand.h @@ -62,7 +62,8 @@ public: " [EXCLUDE_LABEL exclude regex] \n" " [INCLUDE_LABEL label regex] \n" " [PARALLEL_LEVEL level] \n" - " [SCHEDULE_RANDOM on]) \n" + " [SCHEDULE_RANDOM on] \n" + " [STOP_TIME time of day]) \n" "Tests the given build directory and stores results in Test.xml. The " "second argument is a variable that will hold value. Optionally, " "you can specify the starting test number START, the ending test number " @@ -73,7 +74,8 @@ public: "property LABEL. PARALLEL_LEVEL should be set to a positive number " "representing the number of tests to be run in parallel. " "SCHEDULE_RANDOM will launch tests in a random order, and is " - "typically used to detect implicit test dependencies." + "typically used to detect implicit test dependencies. STOP_TIME is the " + "time of day at which the tests should all stop running." "\n" CTEST_COMMAND_APPEND_OPTION_DOCS; } @@ -96,6 +98,7 @@ protected: ctt_INCLUDE_LABEL, ctt_PARALLEL_LEVEL, ctt_SCHEDULE_RANDOM, + ctt_STOP_TIME, ctt_LAST }; }; diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 78f2c30ac..d2742ecf3 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1036,9 +1036,9 @@ void cmCTestTestHandler::ProcessDirectory(std::vector &passed, bool randomSchedule = this->CTest->GetScheduleType() == "Random"; if(randomSchedule) - { + { srand((unsigned)time(0)); - } + } for (ListOfTests::iterator it = this->TestList.begin(); it != this->TestList.end(); ++it) @@ -1291,7 +1291,7 @@ std::string cmCTestTestHandler::EncodeFile(std::string file) std::vector files; files.push_back(file); - if(!cmSystemTools::CreateTar(tarFile.c_str(), files, true, false)) + if(!cmSystemTools::CreateTar(tarFile.c_str(), files, true, false, false)) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Error creating tar while " "attaching file: " << file << std::endl); @@ -2099,6 +2099,17 @@ bool cmCTestTestHandler::SetTestsProperties( rtit->AttachOnFail.push_back(*f); } } + if ( key == "RESOURCE_LOCK" ) + { + std::vector lval; + cmSystemTools::ExpandListArgument(val.c_str(), lval); + + for(std::vector::iterator f = lval.begin(); + f != lval.end(); ++f) + { + rtit->LockedResources.insert(*f); + } + } if ( key == "TIMEOUT" ) { rtit->Timeout = atof(val.c_str()); @@ -2274,6 +2285,7 @@ bool cmCTestTestHandler::AddTest(const std::vector& args) test.Timeout = 0; test.Cost = 0; test.Processors = 1; + test.PreviousRuns = 0; if (this->UseIncludeRegExpFlag && !this->IncludeTestsRegularExpression.find(testname.c_str())) { diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index 1513410e9..704956468 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -96,6 +96,7 @@ public: bool IsInBasedOnREOptions; bool WillFail; float Cost; + int PreviousRuns; bool RunSerial; double Timeout; int Index; @@ -103,6 +104,7 @@ public: int Processors; std::vector Environment; std::vector Labels; + std::set LockedResources; }; struct cmCTestTestResult diff --git a/Source/CTest/cmCTestUpdateCommand.cxx b/Source/CTest/cmCTestUpdateCommand.cxx index 571745d78..841434911 100644 --- a/Source/CTest/cmCTestUpdateCommand.cxx +++ b/Source/CTest/cmCTestUpdateCommand.cxx @@ -51,6 +51,8 @@ cmCTestGenericHandler* cmCTestUpdateCommand::InitializeHandler() "GITCommand", "CTEST_GIT_COMMAND"); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, "GITUpdateOptions", "CTEST_GIT_UPDATE_OPTIONS"); + this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, + "GITUpdateCustom", "CTEST_GIT_UPDATE_CUSTOM"); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, "HGCommand", "CTEST_HG_COMMAND"); this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index f87b37c84..9eae3f3ac 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -306,6 +306,7 @@ int cmCTestUpdateHandler::ProcessHandler() } if(!updated) { + os << "Update command failed:\n" << vc->GetUpdateCommandLine(); cmCTestLog(this->CTest, ERROR_MESSAGE, " Update command failed: " << vc->GetUpdateCommandLine() << "\n"); } diff --git a/Source/CTest/cmCTestVC.cxx b/Source/CTest/cmCTestVC.cxx index 35f567a5c..f9ad79a0c 100644 --- a/Source/CTest/cmCTestVC.cxx +++ b/Source/CTest/cmCTestVC.cxx @@ -227,6 +227,7 @@ void cmCTestVC::WriteXMLEntry(std::ostream& xml, << "\t\t\t" << cmXMLSafe(full) << "\n" << "\t\t\t" << cmXMLSafe(rev.Date) << "\n" << "\t\t\t" << cmXMLSafe(rev.Author) << "\n" + << "\t\t\t" << cmXMLSafe(rev.EMail) << "\n" << "\t\t\t" << cmXMLSafe(rev.Log) << "\n" << "\t\t\t" << cmXMLSafe(rev.Rev) << "\n" << "\t\t\t" << cmXMLSafe(prior) << "\n" diff --git a/Source/CTest/cmCTestVC.h b/Source/CTest/cmCTestVC.h index e6ea76ddb..d36bc8fa9 100644 --- a/Source/CTest/cmCTestVC.h +++ b/Source/CTest/cmCTestVC.h @@ -73,6 +73,7 @@ protected: std::string Rev; std::string Date; std::string Author; + std::string EMail; std::string Log; }; diff --git a/Source/CTest/cmParsePHPCoverage.cxx b/Source/CTest/cmParsePHPCoverage.cxx new file mode 100644 index 000000000..32c1ec110 --- /dev/null +++ b/Source/CTest/cmParsePHPCoverage.cxx @@ -0,0 +1,252 @@ +#include "cmStandardIncludes.h" +#include "cmSystemTools.h" +#include "cmParsePHPCoverage.h" +#include + +/* + To setup coverage for php. + + - edit php.ini to add auto prepend and append php files from phpunit + auto_prepend_file = + auto_append_file = + - run the tests + - run this program on all the files in c:/tmp + +*/ + +cmParsePHPCoverage::cmParsePHPCoverage(cmCTestCoverageHandlerContainer& cont, + cmCTest* ctest) + :Coverage(cont), CTest(ctest) +{ +} + +bool cmParsePHPCoverage::ReadUntil(std::ifstream& in, char until) +{ + char c = 0; + while(in.get(c) && c != until) + { + } + if(c != until) + { + return false; + } + return true; +} +bool cmParsePHPCoverage::ReadCoverageArray(std::ifstream& in, + cmStdString const& fileName) +{ + cmCTestCoverageHandlerContainer::SingleFileCoverageVector& coverageVector + = this->Coverage.TotalCoverage[fileName]; + + char c; + char buf[4]; + in.read(buf, 3); + buf[3] = 0; + if(strcmp(buf, ";a:") != 0) + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "failed to read start of coverage array, found : " + << buf << "\n"); + return false; + } + int size = 0; + if(!this->ReadInt(in, size)) + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "failed to read size "); + return false; + } + if(!in.get(c) && c == '{') + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "failed to read open {\n"); + return false; + } + for(int i =0; i < size; i++) + { + this->ReadUntil(in, ':'); + int line = 0; + this->ReadInt(in, line); + // ok xdebug may have a bug here + // it seems to be 1 based but often times + // seems to have a 0'th line. + line--; + if(line < 0) + { + line = 0; + } + this->ReadUntil(in, ':'); + int value = 0; + this->ReadInt(in, value); + // make sure the vector is the right size and is + // initialized with -1 for each line + while(coverageVector.size() <= static_cast(line) ) + { + coverageVector.push_back(-1); + } + // if value is less than 0, set it to zero + // TODO figure out the difference between + // -1 and -2 in xdebug coverage?? For now + // assume less than 0 is just not covered + // CDash expects -1 for non executable code (like comments) + // and 0 for uncovered code, and a positive value + // for number of times a line was executed + if(value < 0) + { + value = 0; + } + // if unset then set it to value + if(coverageVector[line] == -1) + { + coverageVector[line] = value; + } + // otherwise increment by value + else + { + coverageVector[line] += value; + } + } + return true; +} + +bool cmParsePHPCoverage::ReadInt(std::ifstream& in, int& v) +{ + std::string s; + char c = 0; + while(in.get(c) && c != ':' && c != ';') + { + s += c; + } + v = atoi(s.c_str()); + return true; +} + +bool cmParsePHPCoverage::ReadArraySize(std::ifstream& in, int& size) +{ + char c = 0; + in.get(c); + if(c != 'a') + { + return false; + } + if(in.get(c) && c == ':') + { + if(this->ReadInt(in, size)) + { + return true; + } + } + return false; +} + +bool cmParsePHPCoverage::ReadFileInformation(std::ifstream& in) +{ + char buf[4]; + in.read(buf, 2); + buf[2] = 0; + if(strcmp(buf, "s:") != 0) + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "failed to read start of file info found: [" << buf << "]\n"); + return false; + } + char c; + int size = 0; + if(this->ReadInt(in, size)) + { + size++; // add one for null termination + char* s = new char[size+1]; + // read open quote + if(in.get(c) && c != '"') + { + return false; + } + // read the string data + in.read(s, size-1); + s[size-1] = 0; + cmStdString fileName = s; + delete [] s; + // read close quote + if(in.get(c) && c != '"') + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "failed to read close quote\n" + << "read [" << c << "]\n"); + return false; + } + if(!this->ReadCoverageArray(in, fileName) ) + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "failed to read coverage array for file: " + << fileName << "\n"); + return false; + } + return true; + } + return false; +} + + +bool cmParsePHPCoverage::ReadPHPData(const char* file) +{ + std::ifstream in(file); + if(!in) + { + return false; + } + int size = 0; + this->ReadArraySize(in, size); + char c = 0; + in.get(c); + if(c != '{') + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "failed to read open array\n"); + return false; + } + for(int i =0; i < size; i++) + { + if(!this->ReadFileInformation(in)) + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Failed to read file #" << i << "\n"); + return false; + } + in.get(c); + if(c != '}') + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "failed to read close array\n"); + return false; + } + } + return true; +} + +bool cmParsePHPCoverage::ReadPHPCoverageDirectory(const char* d) +{ + cmsys::Directory dir; + if(!dir.Load(d)) + { + return false; + } + size_t numf; + unsigned int i; + numf = dir.GetNumberOfFiles(); + for (i = 0; i < numf; i++) + { + std::string file = dir.GetFile(i); + if(file != "." && file != ".." + && !cmSystemTools::FileIsDirectory(file.c_str())) + { + std::string path = d; + path += "/"; + path += file; + if(!this->ReadPHPData(path.c_str())) + { + return false; + } + } + } + return true; +} diff --git a/Source/CTest/cmParsePHPCoverage.h b/Source/CTest/cmParsePHPCoverage.h new file mode 100644 index 000000000..ce5741d0b --- /dev/null +++ b/Source/CTest/cmParsePHPCoverage.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 cmParsePHPCoverage_h +#define cmParsePHPCoverage_h + +#include "cmStandardIncludes.h" +#include "cmCTestCoverageHandler.h" + +/** \class cmParsePHPCoverage + * \brief Parse xdebug PHP coverage information + * + * This class is used to parse php coverage information produced + * by xdebug. The data is stored as a php dump of the array + * return by xdebug coverage. It is an array of arrays. + */ +class cmParsePHPCoverage +{ +public: + cmParsePHPCoverage(cmCTestCoverageHandlerContainer& cont, + cmCTest* ctest); + bool ReadPHPCoverageDirectory(const char* dir); + void PrintCoverage(); +private: + bool ReadPHPData(const char* file); + bool ReadArraySize(std::ifstream& in, int& size); + bool ReadFileInformation(std::ifstream& in); + bool ReadInt(std::ifstream& in, int& v); + bool ReadCoverageArray(std::ifstream& in, cmStdString const&); + bool ReadUntil(std::ifstream& in, char until); + typedef std::map FileLineCoverage; + std::map FileToCoverage; + std::map FileCoverage; + cmCTestCoverageHandlerContainer& Coverage; + cmCTest* CTest; +}; + + +#endif diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index e613a78bc..28f4697d0 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -11,7 +11,6 @@ ============================================================================*/ #include "QCMake.h" // include to disable MS warnings #include -#include #include #include #include @@ -21,6 +20,7 @@ #include "cmake.h" #include "cmVersion.h" #include +#include //---------------------------------------------------------------------------- static const char * cmDocumentationName[][3] = @@ -164,16 +164,19 @@ int main(int argc, char** argv) QStringList args = app.arguments(); if(args.count() == 2) { - QFileInfo buildFileInfo(args[1], "CMakeCache.txt"); - QFileInfo srcFileInfo(args[1], "CMakeLists.txt"); - if(buildFileInfo.exists()) + cmsys_stl::string filePath = cmSystemTools::CollapseFullPath(args[1].toAscii().data()); + cmsys_stl::string buildFilePath = + cmSystemTools::CollapseFullPath("CMakeCache.txt", filePath.c_str()); + cmsys_stl::string srcFilePath = + cmSystemTools::CollapseFullPath("CMakeLists.txt", filePath.c_str()); + if(cmSystemTools::FileExists(buildFilePath.c_str())) { - dialog.setBinaryDirectory(buildFileInfo.absolutePath()); + dialog.setBinaryDirectory(filePath.c_str()); } - else if(srcFileInfo.exists()) + else if(cmSystemTools::FileExists(srcFilePath.c_str())) { - dialog.setSourceDirectory(srcFileInfo.absolutePath()); - dialog.setBinaryDirectory(QDir::currentPath()); + dialog.setSourceDirectory(filePath.c_str()); + dialog.setBinaryDirectory(cmSystemTools::CollapseFullPath(".").c_str()); } } } diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index eb82f2a91..74a3d3594 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -81,11 +81,8 @@ CMakeSetupDialog::CMakeSetupDialog() this->Splitter->restoreState(p); bool groupView = settings.value("GroupView", false).toBool(); - if(groupView) - { - this->setViewType(2); - this->ViewType->setCurrentIndex(2); - } + this->setGroupedView(groupView); + this->groupedCheck->setCheckState(groupView ? Qt::Checked : Qt::Unchecked); QMenu* FileMenu = this->menuBar()->addMenu(tr("&File")); this->ReloadCacheAction = FileMenu->addAction(tr("&Reload Cache")); @@ -217,8 +214,10 @@ void CMakeSetupDialog::initialize() SIGNAL(outputMessage(QString)), this, SLOT(message(QString))); - QObject::connect(this->ViewType, SIGNAL(currentIndexChanged(int)), - this, SLOT(setViewType(int))); + QObject::connect(this->groupedCheck, SIGNAL(toggled(bool)), + this, SLOT(setGroupedView(bool))); + QObject::connect(this->advancedCheck, SIGNAL(toggled(bool)), + this, SLOT(setAdvancedView(bool))); QObject::connect(this->Search, SIGNAL(textChanged(QString)), this, SLOT(setSearchFilter(QString))); @@ -950,33 +949,22 @@ void CMakeSetupDialog::setDebugOutput(bool flag) "setDebugOutput", Qt::QueuedConnection, Q_ARG(bool, flag)); } -void CMakeSetupDialog::setViewType(int v) +void CMakeSetupDialog::setGroupedView(bool v) { - if(v == 0) // simple view - { - this->CacheValues->cacheModel()->setViewType(QCMakeCacheModel::FlatView); - this->CacheValues->setRootIsDecorated(false); - this->CacheValues->setShowAdvanced(false); - } - else if(v == 1) // advanced view - { - this->CacheValues->cacheModel()->setViewType(QCMakeCacheModel::FlatView); - this->CacheValues->setRootIsDecorated(false); - this->CacheValues->setShowAdvanced(true); - } - else if(v == 2) // grouped view - { - this->CacheValues->cacheModel()->setViewType(QCMakeCacheModel::GroupView); - this->CacheValues->setRootIsDecorated(true); - this->CacheValues->setShowAdvanced(true); - } + this->CacheValues->cacheModel()->setViewType(v ? QCMakeCacheModel::GroupView : QCMakeCacheModel::FlatView); + this->CacheValues->setRootIsDecorated(v); QSettings settings; settings.beginGroup("Settings/StartPath"); - settings.setValue("GroupView", v == 2); + settings.setValue("GroupView", v); } +void CMakeSetupDialog::setAdvancedView(bool v) +{ + this->CacheValues->setShowAdvanced(v); +} + void CMakeSetupDialog::showUserChanges() { QSet changes = diff --git a/Source/QtDialog/CMakeSetupDialog.h b/Source/QtDialog/CMakeSetupDialog.h index de7922a45..0e3caec44 100644 --- a/Source/QtDialog/CMakeSetupDialog.h +++ b/Source/QtDialog/CMakeSetupDialog.h @@ -70,7 +70,8 @@ protected slots: void addCacheEntry(); void startSearch(); void setDebugOutput(bool); - void setViewType(int); + void setAdvancedView(bool); + void setGroupedView(bool); void showUserChanges(); void setSearchFilter(const QString& str); diff --git a/Source/QtDialog/CMakeSetupDialog.ui b/Source/QtDialog/CMakeSetupDialog.ui index ae0dca2bc..dc8ee3fbd 100644 --- a/Source/QtDialog/CMakeSetupDialog.ui +++ b/Source/QtDialog/CMakeSetupDialog.ui @@ -1,7 +1,8 @@ - + + CMakeSetupDialog - - + + 0 0 @@ -9,149 +10,126 @@ 582 - - + + 9 - + 6 - - - + + + 0 - + 6 - - - + + + Where is the source code: - - + + - - - + + + Browse &Source... - - - + + + Where to build the binaries: - - - - + + + + 0 0 - + true - - - + + + Browse &Build... - - - + + + Qt::Vertical - - + + QFrame::NoFrame - + QFrame::Raised - - - 0 - - + + 6 + + 0 + - - - 0 - - + + 6 + + 0 + - - - - 0 - 0 + + + 0 0 - + Search: - - - - 7 - 0 + + + 0 0 - - - - - Simple View - - - - - Advanced View - - - - - Grouped View - - - - - + Qt::Horizontal - + QSizePolicy::Minimum - + 40 23 @@ -160,33 +138,49 @@ - - + + + Grouped + + + + + + + Advanced + + + + + + Add New Entry - + &Add Entry - - :/Icons/Plus16.png + + + :/Icons/Plus16.png:/Icons/Plus16.png - + Qt::ToolButtonTextBesideIcon - - + + Remove Selected Entries - + &Remove Entry - - :/Icons/Delete16.png + + + :/Icons/Delete16.png:/Icons/Delete16.png - + Qt::ToolButtonTextBesideIcon @@ -194,69 +188,69 @@ - - + + true - + QAbstractItemView::ExtendedSelection - + QAbstractItemView::SelectRows - - + + Press Configure to update and display new values in red, then press Generate to generate selected build files. - + Qt::AlignCenter - + true - - - 0 - - + + 6 + + 0 + - - + + &Configure - - + + &Generate - - + + Current Generator: - + Qt::Horizontal - + QSizePolicy::Expanding - + 121 27 @@ -265,23 +259,23 @@ - - + + 0 - + 100 - + 0 - + false - + Qt::Horizontal - + QProgressBar::BottomToTop @@ -290,11 +284,11 @@ - - + + QTextEdit::NoWrap - + true @@ -310,7 +304,7 @@ - + diff --git a/Source/cmCMakeMinimumRequired.cxx b/Source/cmCMakeMinimumRequired.cxx index b7e939ee9..126934ceb 100644 --- a/Source/cmCMakeMinimumRequired.cxx +++ b/Source/cmCMakeMinimumRequired.cxx @@ -66,14 +66,17 @@ bool cmCMakeMinimumRequired int current_major = cmVersion::GetMajorVersion(); int current_minor = cmVersion::GetMinorVersion(); int current_patch = cmVersion::GetPatchVersion(); + int current_tweak = cmVersion::GetTweakVersion(); - // Parse the required version number. If no patch-level is given - // use zero. + // Parse at least two components of the version number. + // Use zero for those not specified. int required_major = 0; int required_minor = 0; int required_patch = 0; - if(sscanf(version_string.c_str(), "%d.%d.%d", - &required_major, &required_minor, &required_patch) < 2) + int required_tweak = 0; + if(sscanf(version_string.c_str(), "%u.%u.%u.%u", + &required_major, &required_minor, + &required_patch, &required_tweak) < 2) { cmOStringStream e; e << "could not parse VERSION \"" << version_string.c_str() << "\"."; @@ -87,13 +90,17 @@ bool cmCMakeMinimumRequired current_minor < required_minor) || (current_major == required_major && current_minor == required_minor && - current_patch < required_patch)) + current_patch < required_patch) || + (current_major == required_major && + current_minor == required_minor && + current_patch == required_patch && + current_tweak < required_tweak)) { // The current version is too low. cmOStringStream e; e << "CMake " << version_string.c_str() << " or higher is required. You are running version " - << current_major << "." << current_minor << "." << current_patch; + << cmVersion::GetCMakeVersion(); this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); cmSystemTools::SetFatalErrorOccured(); return true; diff --git a/Source/cmCMakeMinimumRequired.h b/Source/cmCMakeMinimumRequired.h index 05c250542..9bf7ef87f 100644 --- a/Source/cmCMakeMinimumRequired.h +++ b/Source/cmCMakeMinimumRequired.h @@ -61,13 +61,13 @@ public: virtual const char* GetFullDocumentation() { return - " cmake_minimum_required(VERSION major[.minor[.patch]]\n" + " cmake_minimum_required(VERSION major[.minor[.patch[.tweak]]]\n" " [FATAL_ERROR])\n" "If the current version of CMake is lower than that required " "it will stop processing the project and report an error. " "When a version higher than 2.4 is specified the command implicitly " "invokes\n" - " cmake_policy(VERSION major[.minor[.patch]])\n" + " cmake_policy(VERSION major[.minor[.patch[.tweak]]])\n" "which sets the cmake policy version level to the version specified. " "When version 2.4 or lower is given the command implicitly invokes\n" " cmake_policy(VERSION 2.4)\n" diff --git a/Source/cmCMakePolicyCommand.h b/Source/cmCMakePolicyCommand.h index ffd0f44e8..b3268654b 100644 --- a/Source/cmCMakePolicyCommand.h +++ b/Source/cmCMakePolicyCommand.h @@ -80,7 +80,7 @@ public: "behavior. " "While setting policies individually is supported, we encourage " "projects to set policies based on CMake versions.\n" - " cmake_policy(VERSION major.minor[.patch])\n" + " cmake_policy(VERSION major.minor[.patch[.tweak]])\n" "Specify that the current CMake list file is written for the " "given version of CMake. " "All policies introduced in the specified version or earlier " diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 7b25f8e12..bd69d6c5e 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -154,6 +154,17 @@ std::string cmCTest::CurrentTime() return cmXMLSafe(cmCTest::CleanString(current_time)).str(); } +//---------------------------------------------------------------------- +std::string cmCTest::GetCostDataFile() +{ + std::string fname = this->GetCTestConfiguration("CostDataFile"); + if(fname == "") + { + fname= this->GetBinaryDir() + "/Testing/Temporary/CTestCostData.txt"; + } + return fname; +} + #ifdef CMAKE_BUILD_WITH_CMAKE //---------------------------------------------------------------------------- static size_t @@ -300,9 +311,12 @@ cmCTest::cmCTest() this->InteractiveDebugMode = true; this->TimeOut = 0; this->GlobalTimeout = 0; + this->LastStopTimeout = 24 * 60 * 60; this->CompressXMLFiles = false; this->CTestConfigFile = ""; this->ScheduleType = ""; + this->StopTime = ""; + this->NextDayStopTime = false; this->OutputLogFile = 0; this->OutputLogFileLastTag = -1; this->SuppressUpdatingCTestConfiguration = false; @@ -1870,6 +1884,12 @@ void cmCTest::HandleCommandLineArguments(size_t &i, double timeout = (double)atof(args[i].c_str()); this->GlobalTimeout = timeout; } + + if(this->CheckArgument(arg, "--stop-time") && i < args.size() - 1) + { + i++; + this->SetStopTime(args[i]); + } if(this->CheckArgument(arg, "-C", "--build-config") && i < args.size() - 1) @@ -2323,6 +2343,13 @@ void cmCTest::SetNotesFiles(const char* notes) this->NotesFiles = notes; } +//---------------------------------------------------------------------- +void cmCTest::SetStopTime(std::string time) +{ + this->StopTime = time; + this->DetermineNextDayStop(); +} + //---------------------------------------------------------------------- int cmCTest::ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf) { @@ -2524,6 +2551,46 @@ void cmCTest::EmptyCTestConfiguration() this->CTestConfiguration.clear(); } +//---------------------------------------------------------------------- +void cmCTest::DetermineNextDayStop() +{ + struct tm* lctime; + time_t current_time = time(0); + lctime = gmtime(¤t_time); + int gm_hour = lctime->tm_hour; + time_t gm_time = mktime(lctime); + lctime = localtime(¤t_time); + int local_hour = lctime->tm_hour; + + int tzone_offset = local_hour - gm_hour; + if(gm_time > current_time && gm_hour < local_hour) + { + // this means gm_time is on the next day + tzone_offset -= 24; + } + else if(gm_time < current_time && gm_hour > local_hour) + { + // this means gm_time is on the previous day + tzone_offset += 24; + } + + tzone_offset *= 100; + char buf[1024]; + sprintf(buf, "%d%02d%02d %s %+05i", + lctime->tm_year + 1900, + lctime->tm_mon + 1, + lctime->tm_mday, + this->StopTime.c_str(), + tzone_offset); + + time_t stop_time = curl_getdate(buf, ¤t_time); + + if(stop_time < current_time) + { + this->NextDayStopTime = true; + } +} + //---------------------------------------------------------------------- void cmCTest::SetCTestConfiguration(const char *name, const char* value) { diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 8621b10dc..3d7d1179b 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -214,6 +214,9 @@ public: std::string GetCDashVersion(); + std::string GetStopTime() { return this->StopTime; } + void SetStopTime(std::string time); + //Used for parallel ctest job scheduling std::string GetScheduleType() { return this->ScheduleType; } void SetScheduleType(std::string type) { this->ScheduleType = type; } @@ -398,9 +401,13 @@ public: { this->StreamOut = out; this->StreamErr = err; } void AddSiteProperties(std::ostream& ); bool GetLabelSummary() { return this->LabelSummary;} + + std::string GetCostDataFile(); private: std::string ConfigType; std::string ScheduleType; + std::string StopTime; + bool NextDayStopTime; bool Verbose; bool ExtraVerbose; bool ProduceXML; @@ -418,6 +425,8 @@ private: int GenerateNotesFile(const char* files); + void DetermineNextDayStop(); + // these are helper classes typedef std::map t_TestingHandlers; t_TestingHandlers TestingHandlers; @@ -448,6 +457,8 @@ private: double GlobalTimeout; + int LastStopTimeout; + int MaxTestNameWidth; int ParallelLevel; diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 69a4d22bb..1cabed2c5 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -376,6 +376,8 @@ cmComputeLinkInformation { this->OrderDependentRPath ->SetImplicitDirectories(this->ImplicitLinkDirs); + this->OrderDependentRPath + ->AddLanguageDirectories(this->RuntimeLinkDirs); } // Decide whether to enable compatible library search path mode. @@ -1324,13 +1326,12 @@ void cmComputeLinkInformation::AddFrameworkItem(std::string const& item) //---------------------------------------------------------------------------- void cmComputeLinkInformation::AddDirectoryItem(std::string const& item) { -#ifdef __APPLE__ - if(cmSystemTools::IsPathToFramework(item.c_str())) + if(this->Makefile->IsOn("APPLE") + && cmSystemTools::IsPathToFramework(item.c_str())) { this->AddFrameworkItem(item); } else -#endif { this->DropDirectoryItem(item); } @@ -1642,6 +1643,14 @@ void cmComputeLinkInformation::LoadImplicitLinkInfo() this->ImplicitLinkLibs.insert(item); } } + + // Get platform specific rpath link directories + if(const char *rpathDirs = + (this->Makefile->GetDefinition + ("CMAKE_PLATFORM_RUNTIME_PATH"))) + { + cmSystemTools::ExpandListArgument(rpathDirs, this->RuntimeLinkDirs); + } } //---------------------------------------------------------------------------- diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index ad2026bce..bbeed68cd 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -163,6 +163,9 @@ private: std::set ImplicitLinkDirs; std::set ImplicitLinkLibs; + // Additional paths configured by the runtime linker + std::vector RuntimeLinkDirs; + // Linker search path compatibility mode. std::set OldLinkDirMask; std::vector OldLinkDirItems; diff --git a/Source/cmData.h b/Source/cmData.h deleted file mode 100644 index 3ae32f5f2..000000000 --- a/Source/cmData.h +++ /dev/null @@ -1,38 +0,0 @@ -/*============================================================================ - 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 cmData_h -#define cmData_h - -#include "cmStandardIncludes.h" - -/** \class cmData - * \brief Hold extra data on a cmMakefile instance for a command. - * - * When CMake commands need to store extra information in a cmMakefile - * instance, but the information is not needed by the makefile generators, - * it can be held in a subclass of cmData. The cmMakefile class has a map - * from std::string to cmData*. On its destruction, it destroys all the - * extra data through the virtual destructor of cmData. - */ -class cmData -{ -public: - cmData(const char* name): Name(name) {} - virtual ~cmData() {} - - const std::string& GetName() const - { return this->Name; } -protected: - std::string Name; -}; - -#endif diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx index c6f9ba5f7..2ed959f42 100644 --- a/Source/cmDocumentVariables.cxx +++ b/Source/cmDocumentVariables.cxx @@ -250,13 +250,23 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "This specifies the patch version of the CMake" " executable being run.",false, "Variables that Provide Information"); + cm->DefineProperty + ("CMAKE_TWEAK_VERSION", cmProperty::VARIABLE, + "The tweak version of cmake (i.e. the 1 in X.X.X.1).", + "This specifies the tweak version of the CMake executable being run. " + "Releases use tweak < 20000000 and development versions use the date " + "format CCYYMMDD for the tweak level." + ,false, "Variables that Provide Information"); cm->DefineProperty ("CMAKE_VERSION", cmProperty::VARIABLE, - "The full version of cmake in major.minor.patch format.", + "The full version of cmake in major.minor.patch[.tweak[-id]] format.", "This specifies the full version of the CMake executable being run. " "This variable is defined by versions 2.6.3 and higher. " - "See variables CMAKE_MAJOR_VERSION, CMAKE_MINOR_VERSION, and " - "CMAKE_PATCH_VERSION for individual version components.", false, + "See variables CMAKE_MAJOR_VERSION, CMAKE_MINOR_VERSION, " + "CMAKE_PATCH_VERSION, and CMAKE_TWEAK_VERSION " + "for individual version components. " + "The [-id] component appears in non-release versions " + "and may be arbitrary text.", false, "Variables that Provide Information"); cm->DefineProperty @@ -598,7 +608,7 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "will check each of the contained directories for the existence of the " "library which is currently searched. By default it contains the " "standard directories for the current system. It is NOT intended to be " - "modified by the project, use CMAKE_SYSTEM_LIBRARY_PATH for this. See " + "modified by the project, use CMAKE_LIBRARY_PATH for this. See " "also CMAKE_SYSTEM_PREFIX_PATH.", false, "Variables That Change Behavior"); @@ -1314,6 +1324,8 @@ void cmDocumentVariables::DefineVariables(cmake* cm) cmProperty::VARIABLE,0,0); cm->DefineProperty("CMAKE__LINK_FLAGS", cmProperty::VARIABLE,0,0); + cm->DefineProperty("CMAKE__RESPONSE_FILE_LINK_FLAG", + cmProperty::VARIABLE,0,0); cm->DefineProperty("CMAKE__STANDARD_LIBRARIES", cmProperty::VARIABLE,0,0); cm->DefineProperty("CMAKE__STANDARD_LIBRARIES_INIT", @@ -1388,4 +1400,6 @@ void cmDocumentVariables::DefineVariables(cmake* cm) cmProperty::VARIABLE,0,0); cm->DefineProperty("CMAKE_LINK_DEPENDENT_LIBRARY_DIRS", cmProperty::VARIABLE,0,0); + cm->DefineProperty("CMAKE_MAKE_INCLUDE_FROM_ROOT", + cmProperty::VARIABLE,0,0); } diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index fc2fb14f5..bfe11c194 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -606,20 +606,22 @@ bool cmDocumentation::CreateSingleModule(const char* fname, } else { - if(text.length() < 2 && brief.length() == 1) - { - return false; - } - char* pname = strcpy(new char[strlen(moduleName)+1], moduleName); - char* ptext = strcpy(new char[text.length()+1], text.c_str()); - this->ModuleStrings.push_back(pname); - this->ModuleStrings.push_back(ptext); - char* pbrief = strcpy(new char[brief.length()+1], brief.c_str()); - this->ModuleStrings.push_back(pbrief); - moduleSection.Append(pname, pbrief, ptext); - return true; + break; } } + + if(text.length() < 2 && brief.length() == 1) + { + return false; + } + + char* pname = strcpy(new char[strlen(moduleName)+1], moduleName); + char* ptext = strcpy(new char[text.length()+1], text.c_str()); + this->ModuleStrings.push_back(pname); + this->ModuleStrings.push_back(ptext); + char* pbrief = strcpy(new char[brief.length()+1], brief.c_str()); + this->ModuleStrings.push_back(pbrief); + moduleSection.Append(pname, pbrief, ptext); return true; } @@ -1177,11 +1179,18 @@ bool cmDocumentation::PrintDocumentationSingleModule(std::ostream& os) this->CurrentArgument.c_str(), *this->AllSections["Modules"])) { - this->PrintDocumentationCommand - (os, this->AllSections["Modules"]->GetEntries()[0]); - os << "\n Defined in: "; - os << moduleName << "\n"; - return true; + if(this->AllSections["Modules"]->GetEntries().size()) + { + this->PrintDocumentationCommand + (os, this->AllSections["Modules"]->GetEntries()[0]); + os << "\n Defined in: "; + os << moduleName << "\n"; + return true; + } + else + { + return false; + } } } diff --git a/Source/cmDocumentationFormatterHTML.cxx b/Source/cmDocumentationFormatterHTML.cxx index 09aff8d2b..6ced1e4d0 100644 --- a/Source/cmDocumentationFormatterHTML.cxx +++ b/Source/cmDocumentationFormatterHTML.cxx @@ -39,7 +39,7 @@ static void cmDocumentationPrintHTMLChar(std::ostream& os, char c) os << "&"; break; case '\n': - os << "
"; + os << "
"; break; default: os << c; @@ -125,23 +125,33 @@ void cmDocumentationFormatterHTML { if (name) { - os << "

" << name << "

\n"; + os << "

" << name << "

\n"; } - os << "\n" ; } for(std::vector::const_iterator op = entries.begin(); @@ -164,7 +174,7 @@ void cmDocumentationFormatterHTML this->PrintHTMLEscapes(os, op->Brief.c_str()); if(op->Full.size()) { - os << "
\n "; + os << "
\n "; this->PrintFormatted(os, op->Full.c_str()); } os << "\n"; @@ -194,6 +204,7 @@ void cmDocumentationFormatterHTML::PrintParagraph(std::ostream& os, { os << "

"; this->PrintHTMLEscapes(os, text); + os << "

\n"; } //---------------------------------------------------------------------------- @@ -201,7 +212,12 @@ void cmDocumentationFormatterHTML::PrintHeader(const char* docname, const char* appname, std::ostream& os) { - os << ""; + os << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"" + << " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"; + os << "<html xmlns=\"http://www.w3.org/1999/xhtml\"" + << " xml:lang=\"en\" lang=\"en\">\n"; + os << "<head><meta http-equiv=\"Content-Type\" " + << "content=\"text/html;charset=utf-8\" /><title>"; os << docname << " - " << appname; os << "\n"; } @@ -253,16 +269,20 @@ void cmDocumentationFormatterHTML return; } - os << "

Master Index " + os << "

Master Index " << "CMake " << cmVersion::GetCMakeVersion() - << "

\n"; - os << "

\n"; + + if (!sections.empty()) { - std::string name = sections[i]-> - GetName((this->GetForm())); - os << "
  • " << name << "
  • \n"; + os << "
      \n"; + for(unsigned int i=0; i < sections.size(); ++i) + { + std::string name = sections[i]->GetName((this->GetForm())); + os << "
    • " << name << "
    • \n"; + } + os << "
    \n"; } - os << "\n"; } diff --git a/Source/cmDocumentationFormatterText.cxx b/Source/cmDocumentationFormatterText.cxx index 078b8909d..0b04b73d2 100644 --- a/Source/cmDocumentationFormatterText.cxx +++ b/Source/cmDocumentationFormatterText.cxx @@ -96,7 +96,7 @@ void cmDocumentationFormatterText::PrintColumn(std::ostream& os, { // Print text arranged in an indented column of fixed witdh. const char* l = text; - int column = 0; + long column = 0; bool newSentence = false; bool firstLine = true; int width = this->TextWidth - static_cast(strlen(this->TextIndent)); diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx index 763fdd849..147f6accb 100644 --- a/Source/cmELF.cxx +++ b/Source/cmELF.cxx @@ -687,7 +687,7 @@ cmELFInternalImpl::GetDynamicSectionString(int tag) // The value has been read successfully. Report it. se.Position = static_cast(strtab.sh_offset + first); se.Size = last - first; - se.IndexInSection = di - this->DynamicSectionEntries.begin(); + se.IndexInSection = static_cast(di - this->DynamicSectionEntries.begin()); return &se; } } diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 5cbef8c37..4cb2b4860 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -630,8 +630,8 @@ std::string cmExtraCodeBlocksGenerator::GetCBCompilerId(const cmMakefile* mf) std::string hostSystemName = mf->GetSafeDefinition("CMAKE_HOST_SYSTEM_NAME"); std::string systemName = mf->GetSafeDefinition("CMAKE_SYSTEM_NAME"); - std::string compilerId = mf->GetRequiredDefinition(compilerIdVar.c_str()); - std::string compiler = "gcc"; + std::string compilerId = mf->GetSafeDefinition(compilerIdVar.c_str()); + std::string compiler = "gcc"; // default to gcc if (compilerId == "MSVC") { compiler = "msvc8"; diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index fe914fd23..204d5d7f0 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -292,7 +292,6 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile() AddEnvVar(fout, "INCLUDE", mf); AddEnvVar(fout, "LIB", mf); AddEnvVar(fout, "LIBPATH", mf); - AddEnvVar(fout, "INCLUDE", mf); } else if (compilerId == "Intel") { diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index c2e90b672..133c1a196 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -183,24 +183,18 @@ bool cmFileCommand::HandleWriteCommand(std::vector const& args, std::string dir = cmSystemTools::GetFilenamePath(fileName); cmSystemTools::MakeDirectory(dir.c_str()); - mode_t mode = -#if defined( _MSC_VER ) || defined( __MINGW32__ ) - S_IREAD | S_IWRITE -#elif defined( __BORLANDC__ ) - S_IRUSR | S_IWUSR -#else - 0666 -#endif - ; + mode_t mode = 0; // Set permissions to writable if ( cmSystemTools::GetPermissions(fileName.c_str(), mode) ) { cmSystemTools::SetPermissions(fileName.c_str(), #if defined( _MSC_VER ) || defined( __MINGW32__ ) - S_IREAD | S_IWRITE + mode | S_IWRITE +#elif defined( __BORLANDC__ ) + mode | S_IWUSR #else - 0666 + mode | S_IWUSR | S_IWGRP #endif ); } @@ -217,7 +211,10 @@ bool cmFileCommand::HandleWriteCommand(std::vector const& args, } file << message; file.close(); - cmSystemTools::SetPermissions(fileName.c_str(), mode); + if(mode) + { + cmSystemTools::SetPermissions(fileName.c_str(), mode); + } return true; } @@ -529,13 +526,6 @@ bool cmFileCommand::HandleStringsCommand(std::vector const& args) return false; } - // At least one compiler (Portland Group Fortran) produces binaries - // with some extra characters in strings. - char extra[256]; // = {}; // some compilers do not like this - memset(extra, 0, sizeof(extra)); - extra[0x0c] = 1; // FF (form feed) - extra[0x14] = 1; // DC4 (device control 4) - // Parse strings out of the file. int output_size = 0; std::vector strings; @@ -545,28 +535,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector const& args) (limit_input < 0 || static_cast(fin.tellg()) < limit_input) && (c = fin.get(), fin)) { - if(c == '\0') - { - // A terminating null character has been found. Check if the - // current string matches the requirements. Since it was - // terminated by a null character, we require that the length be - // at least one no matter what the user specified. - if(s.length() >= minlen && s.length() >= 1 && - (!have_regex || regex.find(s.c_str()))) - { - output_size += static_cast(s.size()) + 1; - if(limit_output >= 0 && output_size >= limit_output) - { - s = ""; - break; - } - strings.push_back(s); - } - - // Reset the string to empty. - s = ""; - } - else if(c == '\n' && !newline_consume) + if(c == '\n' && !newline_consume) { // The current line has been terminated. Check if the current // string matches the requirements. The length may now be as @@ -590,7 +559,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector const& args) { // Ignore CR character to make output always have UNIX newlines. } - else if((c >= 0x20 && c < 0x7F) || c == '\t' || extra[c] || + else if((c >= 0x20 && c < 0x7F) || c == '\t' || (c == '\n' && newline_consume)) { // This is an ASCII character that may be part of a string. @@ -600,7 +569,23 @@ bool cmFileCommand::HandleStringsCommand(std::vector const& args) } else { - // This is a non-string character. Reset the string to emtpy. + // TODO: Support ENCODING option. See issue #10519. + // A non-string character has been found. Check if the current + // string matches the requirements. We require that the length + // be at least one no matter what the user specified. + if(s.length() >= minlen && s.length() >= 1 && + (!have_regex || regex.find(s.c_str()))) + { + output_size += static_cast(s.size()) + 1; + if(limit_output >= 0 && output_size >= limit_output) + { + s = ""; + break; + } + strings.push_back(s); + } + + // Reset the string to empty. s = ""; } @@ -1519,7 +1504,7 @@ bool cmFileCopier::InstallFile(const char* fromFile, const char* toFile, this->ReportCopy(toFile, TypeFile, copy); // Copy the file. - if(copy && !cmSystemTools::CopyAFile(fromFile, toFile, true, false)) + if(copy && !cmSystemTools::CopyAFile(fromFile, toFile, true)) { cmOStringStream e; e << this->Name << " cannot copy file \"" << fromFile @@ -1531,6 +1516,13 @@ bool cmFileCopier::InstallFile(const char* fromFile, const char* toFile, // Set the file modification time of the destination file. if(copy && !this->Always) { + // Add write permission so we can set the file time. + // Permissions are set unconditionally below anyway. + mode_t perm = 0; + if(cmSystemTools::GetPermissions(toFile, perm)) + { + cmSystemTools::SetPermissions(toFile, perm | mode_owner_write); + } if (!cmSystemTools::CopyFileTime(fromFile, toFile)) { cmOStringStream e; @@ -2455,7 +2447,8 @@ namespace{ fout->write(chPtr, realsize); return realsize; } - + + static size_t cmFileCommandCurlDebugCallback(CURL *, curl_infotype, char *chPtr, size_t size, void *data) @@ -2468,6 +2461,72 @@ namespace{ } + class cURLProgressHelper + { + public: + cURLProgressHelper(cmFileCommand *fc) + { + this->CurrentPercentage = -1; + this->FileCommand = fc; + } + + bool UpdatePercentage(double value, double total, std::string &status) + { + int OldPercentage = this->CurrentPercentage; + + if (0.0 == total) + { + this->CurrentPercentage = 100; + } + else + { + this->CurrentPercentage = static_cast(value/total*100.0 + 0.5); + } + + bool updated = (OldPercentage != this->CurrentPercentage); + + if (updated) + { + cmOStringStream oss; + oss << "[download " << this->CurrentPercentage << "% complete]"; + status = oss.str(); + } + + return updated; + } + + cmFileCommand *GetFileCommand() + { + return this->FileCommand; + } + + private: + int CurrentPercentage; + cmFileCommand *FileCommand; + }; + + + static int + cmFileCommandCurlProgressCallback(void *clientp, + double dltotal, double dlnow, + double ultotal, double ulnow) + { + cURLProgressHelper *helper = + reinterpret_cast(clientp); + + static_cast(ultotal); + static_cast(ulnow); + + std::string status; + if (helper->UpdatePercentage(dlnow, dltotal, status)) + { + cmFileCommand *fc = helper->GetFileCommand(); + cmMakefile *mf = fc->GetMakefile(); + mf->DisplayStatus(status.c_str(), -1); + } + + return 0; + } } #endif @@ -2481,8 +2540,8 @@ namespace { cURLEasyGuard(CURL * easy) : Easy(easy) {} - - ~cURLEasyGuard(void) + + ~cURLEasyGuard(void) { if (this->Easy) { @@ -2503,6 +2562,7 @@ namespace { } #endif + bool cmFileCommand::HandleDownloadCommand(std::vector const& args) @@ -2520,9 +2580,13 @@ cmFileCommand::HandleDownloadCommand(std::vector ++i; std::string file = *i; ++i; + long timeout = 0; std::string verboseLog; std::string statusVar; + std::string expectedMD5sum; + bool showProgress = false; + while(i != args.end()) { if(*i == "TIMEOUT") @@ -2561,9 +2625,65 @@ cmFileCommand::HandleDownloadCommand(std::vector } statusVar = *i; } + else if(*i == "EXPECTED_MD5") + { + ++i; + if( i == args.end()) + { + this->SetError("FILE(DOWNLOAD url file EXPECTED_MD5 sum) missing " + "sum value for EXPECTED_MD5."); + return false; + } + expectedMD5sum = cmSystemTools::LowerCase(*i); + } + else if(*i == "SHOW_PROGRESS") + { + showProgress = true; + } ++i; } + // If file exists already, and caller specified an expected md5 sum, + // and the existing file already has the expected md5 sum, then simply + // return. + // + if(cmSystemTools::FileExists(file.c_str()) && + !expectedMD5sum.empty()) + { + char computedMD5[32]; + + if (!cmSystemTools::ComputeFileMD5(file.c_str(), computedMD5)) + { + this->SetError("FILE(DOWNLOAD ) error; cannot compute MD5 sum on " + "pre-existing file"); + return false; + } + + std::string actualMD5sum = cmSystemTools::LowerCase( + std::string(computedMD5, 32)); + + if (expectedMD5sum == actualMD5sum) + { + this->Makefile->DisplayStatus( + "FILE(DOWNLOAD ) returning early: file already exists with " + "expected MD5 sum", -1); + + if(statusVar.size()) + { + cmOStringStream result; + result << (int)0 << ";\"" + "returning early: file already exists with expected MD5 sum\""; + this->Makefile->AddDefinition(statusVar.c_str(), + result.str().c_str()); + } + + return true; + } + } + + // Make sure parent directory exists so we can write to the file + // as we receive downloaded bits from curl... + // std::string dir = cmSystemTools::GetFilenamePath(file.c_str()); if(!cmSystemTools::FileExists(dir.c_str()) && !cmSystemTools::MakeDirectory(dir.c_str())) @@ -2582,6 +2702,7 @@ cmFileCommand::HandleDownloadCommand(std::vector "file for write."); return false; } + ::CURL *curl; ::curl_global_init(CURL_GLOBAL_DEFAULT); curl = ::curl_easy_init(); @@ -2597,28 +2718,31 @@ cmFileCommand::HandleDownloadCommand(std::vector ::CURLcode res = ::curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); if (res != CURLE_OK) { - std::string errstring = "FILE(DOWNLOAD ) error; cannot set url: "; - errstring += ::curl_easy_strerror(res); + std::string errstring = "FILE(DOWNLOAD ) error; cannot set url: "; + errstring += ::curl_easy_strerror(res); + this->SetError(errstring.c_str()); return false; } res = ::curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, - cmFileCommandWriteMemoryCallback); + cmFileCommandWriteMemoryCallback); if (res != CURLE_OK) - { - std::string errstring = - "FILE(DOWNLOAD ) error; cannot set write function: "; - errstring += ::curl_easy_strerror(res); + { + std::string errstring = + "FILE(DOWNLOAD ) error; cannot set write function: "; + errstring += ::curl_easy_strerror(res); + this->SetError(errstring.c_str()); return false; } res = ::curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, - cmFileCommandCurlDebugCallback); + cmFileCommandCurlDebugCallback); if (res != CURLE_OK) { - std::string errstring = - "FILE(DOWNLOAD ) error; cannot set debug function: "; - errstring += ::curl_easy_strerror(res); + std::string errstring = + "FILE(DOWNLOAD ) error; cannot set debug function: "; + errstring += ::curl_easy_strerror(res); + this->SetError(errstring.c_str()); return false; } @@ -2630,14 +2754,25 @@ cmFileCommand::HandleDownloadCommand(std::vector { std::string errstring = "FILE(DOWNLOAD ) error; cannot set write data: "; errstring += ::curl_easy_strerror(res); + this->SetError(errstring.c_str()); return false; } res = ::curl_easy_setopt(curl, CURLOPT_DEBUGDATA, (void *)&chunkDebug); if (res != CURLE_OK) { - std::string errstring = "FILE(DOWNLOAD ) error; cannot set write data: "; + std::string errstring = "FILE(DOWNLOAD ) error; cannot set debug data: "; + errstring += ::curl_easy_strerror(res); + this->SetError(errstring.c_str()); + return false; + } + + res = ::curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); + if (res != CURLE_OK) + { + std::string errstring = "FILE(DOWNLOAD ) error; cannot set follow-redirect option: "; errstring += ::curl_easy_strerror(res); + this->SetError(errstring.c_str()); return false; } @@ -2649,24 +2784,70 @@ cmFileCommand::HandleDownloadCommand(std::vector { std::string errstring = "FILE(DOWNLOAD ) error; cannot set verbose: "; errstring += ::curl_easy_strerror(res); + this->SetError(errstring.c_str()); return false; } } + if(timeout > 0) { res = ::curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout ); if (res != CURLE_OK) { - std::string errstring = "FILE(DOWNLOAD ) error; cannot set verbose: "; + std::string errstring = "FILE(DOWNLOAD ) error; cannot set timeout: "; + errstring += ::curl_easy_strerror(res); + this->SetError(errstring.c_str()); + return false; + } + } + + // Need the progress helper's scope to last through the duration of + // the curl_easy_perform call... so this object is declared at function + // scope intentionally, rather than inside the "if(showProgress)" + // block... + // + cURLProgressHelper helper(this); + + if(showProgress) + { + res = ::curl_easy_setopt(curl, + CURLOPT_NOPROGRESS, 0); + if (res != CURLE_OK) + { + std::string errstring = "FILE(DOWNLOAD ) error; cannot set noprogress value: "; + errstring += ::curl_easy_strerror(res); + this->SetError(errstring.c_str()); + return false; + } + + res = ::curl_easy_setopt(curl, + CURLOPT_PROGRESSFUNCTION, cmFileCommandCurlProgressCallback); + if (res != CURLE_OK) + { + std::string errstring = "FILE(DOWNLOAD ) error; cannot set progress function: "; + errstring += ::curl_easy_strerror(res); + this->SetError(errstring.c_str()); + return false; + } + + res = ::curl_easy_setopt(curl, + CURLOPT_PROGRESSDATA, reinterpret_cast(&helper)); + if (res != CURLE_OK) + { + std::string errstring = "FILE(DOWNLOAD ) error; cannot set progress data: "; errstring += ::curl_easy_strerror(res); + this->SetError(errstring.c_str()); return false; } } + res = ::curl_easy_perform(curl); + /* always cleanup */ g_curl.release(); ::curl_easy_cleanup(curl); + if(statusVar.size()) { cmOStringStream result; @@ -2674,7 +2855,44 @@ cmFileCommand::HandleDownloadCommand(std::vector this->Makefile->AddDefinition(statusVar.c_str(), result.str().c_str()); } + ::curl_global_cleanup(); + + // Explicitly flush/close so we can measure the md5 accurately. + // + fout.flush(); + fout.close(); + + // Verify MD5 sum if requested: + // + if (!expectedMD5sum.empty()) + { + char computedMD5[32]; + + if (!cmSystemTools::ComputeFileMD5(file.c_str(), computedMD5)) + { + this->SetError("FILE(DOWNLOAD ) error; cannot compute MD5 sum on " + "downloaded file"); + return false; + } + + std::string actualMD5sum = cmSystemTools::LowerCase( + std::string(computedMD5, 32)); + + if (expectedMD5sum != actualMD5sum) + { + cmOStringStream oss; + oss << "FILE(DOWNLOAD ) error; expected and actual MD5 sums differ" + << std::endl + << " for file: [" << file << "]" << std::endl + << " expected MD5 sum: [" << expectedMD5sum << "]" << std::endl + << " actual MD5 sum: [" << actualMD5sum << "]" << std::endl + ; + this->SetError(oss.str().c_str()); + return false; + } + } + if(chunkDebug.size()) { chunkDebug.push_back(0); @@ -2692,6 +2910,7 @@ cmFileCommand::HandleDownloadCommand(std::vector this->Makefile->AddDefinition(verboseLog.c_str(), &*chunkDebug.begin()); } + return true; #else this->SetError("FILE(DOWNLOAD ) " diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h index c6da30125..e77109217 100644 --- a/Source/cmFileCommand.h +++ b/Source/cmFileCommand.h @@ -80,7 +80,8 @@ public: " file(RELATIVE_PATH variable directory file)\n" " file(TO_CMAKE_PATH path result)\n" " file(TO_NATIVE_PATH path result)\n" - " file(DOWNLOAD url file [TIMEOUT timeout] [STATUS status] [LOG log])\n" + " file(DOWNLOAD url file [TIMEOUT timeout] [STATUS status] [LOG log]\n" + " [EXPECTED_MD5 sum] [SHOW_PROGRESS])\n" "WRITE will write a message into a file called 'filename'. It " "overwrites the file if it already exists, and creates the file " "if it does not exist.\n" @@ -152,7 +153,12 @@ public: "and the second element is a string value for the error. A 0 " "numeric error means no error in the operation. " "If TIMEOUT time is specified, the operation will " - "timeout after time seconds, time should be specified as an integer." + "timeout after time seconds, time should be specified as an integer. " + "If EXPECTED_MD5 sum is specified, the operation will verify that the " + "downloaded file's actual md5 sum matches the expected value. If it " + "does not match, the operation fails with an error. " + "If SHOW_PROGRESS is specified, progress information will be printed " + "as status messages until the operation is complete." "\n" "The file() command also provides COPY and INSTALL signatures:\n" " file( files... DESTINATION \n" diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx index f4c00645e..f35217262 100644 --- a/Source/cmFindCommon.cxx +++ b/Source/cmFindCommon.cxx @@ -423,3 +423,17 @@ void cmFindCommon::AddTrailingSlashes(std::vector& paths) } } } + +//---------------------------------------------------------------------------- +void cmFindCommon::SetMakefile(cmMakefile* makefile) +{ + cmCommand::SetMakefile(makefile); + + // If we are building for Apple (OSX or also iphone), make sure + // that frameworks and bundles are searched first. + if(this->Makefile->IsOn("APPLE")) + { + this->SearchFrameworkFirst = true; + this->SearchAppBundleFirst = true; + } +} diff --git a/Source/cmFindCommon.h b/Source/cmFindCommon.h index 08d21586b..2ffbd0053 100644 --- a/Source/cmFindCommon.h +++ b/Source/cmFindCommon.h @@ -61,6 +61,8 @@ protected: PathType pathType); void AddPathInternal(std::string const& in_path, PathType pathType); + void SetMakefile(cmMakefile* makefile); + bool NoDefaultPath; bool NoCMakePath; bool NoCMakeEnvironmentPath; diff --git a/Source/cmGetFilenameComponentCommand.h b/Source/cmGetFilenameComponentCommand.h index c85b29654..aff4d7ea1 100644 --- a/Source/cmGetFilenameComponentCommand.h +++ b/Source/cmGetFilenameComponentCommand.h @@ -62,10 +62,10 @@ public: virtual const char* GetFullDocumentation() { return - " get_filename_component(VarName FileName\n" + " get_filename_component( FileName\n" " PATH|ABSOLUTE|NAME|EXT|NAME_WE|REALPATH\n" " [CACHE])\n" - "Set VarName to be the path (PATH), file name (NAME), file " + "Set to be the path (PATH), file name (NAME), file " "extension (EXT), file name without extension (NAME_WE) of FileName, " "the full path (ABSOLUTE), or the full path with all symlinks " "resolved (REALPATH). " @@ -73,14 +73,14 @@ public: "trailing slashes. The longest file extension is always considered. " "If the optional CACHE argument is specified, the result variable is " "added to the cache.\n" - " get_filename_component(VarName FileName\n" - " PROGRAM [PROGRAM_ARGS ArgVar]\n" + " get_filename_component( FileName\n" + " PROGRAM [PROGRAM_ARGS ]\n" " [CACHE])\n" "The program in FileName will be found in the system search path or " "left as a full path. If PROGRAM_ARGS is present with PROGRAM, then " "any command-line arguments present in the FileName string are split " - "from the program name and stored in ArgVar. This is used to separate " - "a program name from its arguments in a command line string."; + "from the program name and stored in . This is used to " + "separate a program name from its arguments in a command line string."; } cmTypeMacro(cmGetFilenameComponentCommand, cmCommand); diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index d608aac3a..119157549 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -37,6 +37,7 @@ cmLocalGenerator *cmGlobalVisualStudio71Generator::CreateLocalGenerator() void cmGlobalVisualStudio71Generator::AddPlatformDefinitions(cmMakefile* mf) { this->cmGlobalVisualStudio7Generator::AddPlatformDefinitions(mf); + mf->RemoveDefinition("MSVC70"); mf->AddDefinition("MSVC71", "1"); } diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index e42317426..6e0f0480e 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -154,8 +154,6 @@ void cmGlobalVisualStudio8Generator::AddCheckTarget() stampFile += "/"; stampFile += cmake::GetCMakeFilesDirectoryPostSlash(); stampFile += "generate.stamp"; - stampFile = generators[0]->Convert(stampFile.c_str(), - cmLocalGenerator::START_OUTPUT); fout << stampFile << "\n"; stamps.push_back(stampFile); } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 0d6e389ec..537a88f30 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1514,8 +1514,13 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, extraLinkOptions = this->CurrentMakefile-> GetRequiredDefinition("CMAKE_MODULE_LINKER_FLAGS"); } - - const char* targetLinkFlags = target.GetProperty("LINK_FLAGS"); + + const char* linkFlagsProp = "LINK_FLAGS"; + if(target.GetType() == cmTarget::STATIC_LIBRARY) + { + linkFlagsProp = "STATIC_LIBRARY_FLAGS"; + } + const char* targetLinkFlags = target.GetProperty(linkFlagsProp); if(targetLinkFlags) { extraLinkOptions += " "; @@ -1523,7 +1528,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, } if(configName && *configName) { - std::string linkFlagsVar = "LINK_FLAGS_"; + std::string linkFlagsVar = linkFlagsProp; + linkFlagsVar += "_"; linkFlagsVar += cmSystemTools::UpperCase(configName); if(const char* linkFlags = target.GetProperty(linkFlagsVar.c_str())) { diff --git a/Source/cmIncludeExternalMSProjectCommand.h b/Source/cmIncludeExternalMSProjectCommand.h index d14d56497..52690410a 100644 --- a/Source/cmIncludeExternalMSProjectCommand.h +++ b/Source/cmIncludeExternalMSProjectCommand.h @@ -62,9 +62,8 @@ public: " dep1 dep2 ...)\n" "Includes an external Microsoft project in the generated workspace " "file. Currently does nothing on UNIX. This will create a " - "target named INCLUDE_EXTERNAL_MSPROJECT_[projectname]. This can " - "be used in the add_dependencies command to make things depend " - "on the external project."; + "target named [projectname]. This can be used in the add_dependencies " + "command to make things depend on the external project."; } cmTypeMacro(cmIncludeExternalMSProjectCommand, cmCommand); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 851e34f57..13d875f9f 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -712,9 +712,7 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target) std::string langFlags; this->AddLanguageFlags(langFlags, llang, 0); -#ifdef __APPLE__ this->AddArchitectureFlags(langFlags, &target, llang, 0); -#endif /* __APPLE__ */ vars.LanguageCompileFlags = langFlags.c_str(); cmCustomCommandLines commandLines; @@ -1272,8 +1270,8 @@ const char* cmLocalGenerator::GetIncludeFlags(const char* lang) #endif for(i = includes.begin(); i != includes.end(); ++i) { -#ifdef __APPLE__ - if(cmSystemTools::IsPathToFramework(i->c_str())) + if(this->Makefile->IsOn("APPLE") + && cmSystemTools::IsPathToFramework(i->c_str())) { std::string frameworkDir = *i; frameworkDir += "/../"; @@ -1288,7 +1286,7 @@ const char* cmLocalGenerator::GetIncludeFlags(const char* lang) } continue; } -#endif + std::string include = *i; if(!flagUsed || repeatFlag) { @@ -1766,12 +1764,17 @@ void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout, //---------------------------------------------------------------------------- -#ifdef __APPLE__ void cmLocalGenerator::AddArchitectureFlags(std::string& flags, cmTarget* target, const char *lang, const char* config) { + // Only add Mac OS X specific flags on Darwin platforms (OSX and iphone): + if(!this->Makefile->IsOn("APPLE")) + { + return; + } + if(this->EmitUniversalBinaryFlags) { std::vector archs; @@ -1828,7 +1831,6 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags, } } } -#endif /* __APPLE__ */ //---------------------------------------------------------------------------- @@ -2247,6 +2249,10 @@ std::string cmLocalGenerator::ConvertToOutputFormat(const char* source, } result = this->EscapeForShell(result.c_str(), true, false); } + else if(output == RESPONSE) + { + result = this->EscapeForShell(result.c_str(), false, false); + } return result; } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index becdfff7b..43bf1e73b 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -102,7 +102,7 @@ public: * path setting */ enum RelativeRoot { NONE, FULL, HOME, START, HOME_OUTPUT, START_OUTPUT }; - enum OutputFormat { UNCHANGED, MAKEFILE, SHELL }; + enum OutputFormat { UNCHANGED, MAKEFILE, SHELL, RESPONSE }; std::string ConvertToOutputFormat(const char* source, OutputFormat output); std::string Convert(const char* remote, RelativeRoot local, OutputFormat output = UNCHANGED, @@ -133,10 +133,8 @@ public: std::vector& GetChildren() { return this->Children; }; -#ifdef __APPLE__ void AddArchitectureFlags(std::string& flags, cmTarget* target, const char *lang, const char* config); -#endif /* __APPLE__ */ void AddLanguageFlags(std::string& flags, const char* lang, const char* config); diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index fce5a9c9d..004d19a2d 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -973,6 +973,24 @@ cmLocalUnixMakefileGenerator3 this->ConfigurationName.c_str()); if (cmd.size()) { + // Use "call " before any invocations of .bat or .cmd files + // invoked as custom commands in the WindowsShell. + // + bool useCall = false; + + if (this->WindowsShell) + { + std::string suffix; + if (cmd.size() > 4) + { + suffix = cmSystemTools::LowerCase(cmd.substr(cmd.size()-4)); + if (suffix == ".bat" || suffix == ".cmd") + { + useCall = true; + } + } + } + cmSystemTools::ReplaceString(cmd, "/./", "/"); // Convert the command to a relative path only if the current // working directory will be the start-output directory. @@ -1044,6 +1062,10 @@ cmLocalUnixMakefileGenerator3 } } } + if (useCall && launcher.empty()) + { + cmd = "call " + cmd; + } commands1.push_back(cmd); } } diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 2cf840df2..539816d3c 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -1142,6 +1142,10 @@ void cmLocalVisualStudio6Generator // Get extra linker options for this target type. std::string extraLinkOptions; + std::string extraLinkOptionsDebug; + std::string extraLinkOptionsRelease; + std::string extraLinkOptionsMinSizeRel; + std::string extraLinkOptionsRelWithDebInfo; if(target.GetType() == cmTarget::EXECUTABLE) { extraLinkOptions = @@ -1165,6 +1169,33 @@ void cmLocalVisualStudio6Generator extraLinkOptions += targetLinkFlags; } + if(const char* targetLinkFlags = target.GetProperty("LINK_FLAGS_DEBUG")) + { + extraLinkOptionsDebug += " "; + extraLinkOptionsDebug += targetLinkFlags; + } + + if(const char* targetLinkFlags = target.GetProperty("LINK_FLAGS_RELEASE")) + { + extraLinkOptionsRelease += " "; + extraLinkOptionsRelease += targetLinkFlags; + } + + if(const char* targetLinkFlags = target.GetProperty("LINK_FLAGS_MINSIZEREL")) + { + extraLinkOptionsMinSizeRel += " "; + extraLinkOptionsMinSizeRel += targetLinkFlags; + } + + if(const char* targetLinkFlags = target.GetProperty("LINK_FLAGS_RELWITHDEBINFO")) + { + extraLinkOptionsRelWithDebInfo += " "; + extraLinkOptionsRelWithDebInfo += targetLinkFlags; + } + + + + // Get standard libraries for this language. if(targetBuilds) { @@ -1259,13 +1290,21 @@ void cmLocalVisualStudio6Generator target.GetType() == cmTarget::SHARED_LIBRARY || target.GetType() == cmTarget::MODULE_LIBRARY) { - this->ComputeLinkOptions(target, "Debug", extraLinkOptions, + extraLinkOptionsDebug = + extraLinkOptions + " " + extraLinkOptionsDebug; + extraLinkOptionsRelease = + extraLinkOptions + " " + extraLinkOptionsRelease; + extraLinkOptionsMinSizeRel = + extraLinkOptions + " " + extraLinkOptionsMinSizeRel; + extraLinkOptionsRelWithDebInfo = + extraLinkOptions + " " + extraLinkOptionsRelWithDebInfo; + this->ComputeLinkOptions(target, "Debug", extraLinkOptionsDebug, optionsDebug); - this->ComputeLinkOptions(target, "Release", extraLinkOptions, + this->ComputeLinkOptions(target, "Release", extraLinkOptionsRelease, optionsRelease); - this->ComputeLinkOptions(target, "MinSizeRel", extraLinkOptions, + this->ComputeLinkOptions(target, "MinSizeRel", extraLinkOptionsMinSizeRel, optionsMinSizeRel); - this->ComputeLinkOptions(target, "RelWithDebInfo", extraLinkOptions, + this->ComputeLinkOptions(target, "RelWithDebInfo", extraLinkOptionsRelWithDebInfo, optionsRelWithDebInfo); } @@ -1342,11 +1381,43 @@ void cmLocalVisualStudio6Generator cmSystemTools::Error("Error Reading ", this->DSPHeaderTemplate.c_str()); } std::string staticLibOptions; + std::string staticLibOptionsDebug; + std::string staticLibOptionsRelease; + std::string staticLibOptionsMinSizeRel; + std::string staticLibOptionsRelWithDebInfo; if(target.GetType() == cmTarget::STATIC_LIBRARY ) { if(const char* libflags = target.GetProperty("STATIC_LIBRARY_FLAGS")) { staticLibOptions = libflags; + staticLibOptionsDebug = libflags; + staticLibOptionsRelease = libflags; + staticLibOptionsMinSizeRel = libflags; + staticLibOptionsRelWithDebInfo = libflags; + } + if(const char* libflagsDebug = + target.GetProperty("STATIC_LIBRARY_FLAGS_DEBUG")) + { + staticLibOptionsDebug += " "; + staticLibOptionsDebug = libflagsDebug; + } + if(const char* libflagsRelease = + target.GetProperty("STATIC_LIBRARY_FLAGS_RELEASE")) + { + staticLibOptionsRelease += " "; + staticLibOptionsRelease = libflagsRelease; + } + if(const char* libflagsMinSizeRel = + target.GetProperty("STATIC_LIBRARY_FLAGS_MINSIZEREL")) + { + staticLibOptionsMinSizeRel += " "; + staticLibOptionsMinSizeRel = libflagsMinSizeRel; + } + if(const char* libflagsRelWithDebInfo = + target.GetProperty("STATIC_LIBRARY_FLAGS_RELWITHDEBINFO")) + { + staticLibOptionsRelWithDebInfo += " "; + staticLibOptionsRelWithDebInfo = libflagsRelWithDebInfo; } } @@ -1378,6 +1449,14 @@ void cmLocalVisualStudio6Generator mfcFlag); if(target.GetType() == cmTarget::STATIC_LIBRARY ) { + cmSystemTools::ReplaceString(line, "CM_STATIC_LIB_ARGS_DEBUG", + staticLibOptionsDebug.c_str()); + cmSystemTools::ReplaceString(line, "CM_STATIC_LIB_ARGS_RELEASE", + staticLibOptionsRelease.c_str()); + cmSystemTools::ReplaceString(line, "CM_STATIC_LIB_ARGS_MINSIZEREL", + staticLibOptionsMinSizeRel.c_str()); + cmSystemTools::ReplaceString(line, "CM_STATIC_LIB_ARGS_RELWITHDEBINFO", + staticLibOptionsRelWithDebInfo.c_str()); cmSystemTools::ReplaceString(line, "CM_STATIC_LIB_ARGS", staticLibOptions.c_str()); } @@ -1420,7 +1499,7 @@ void cmLocalVisualStudio6Generator outputNameDebug.c_str()); cmSystemTools::ReplaceString(line, "OUTPUT_NAME_RELEASE", outputNameRelease.c_str()); - cmSystemTools::ReplaceString(line, "OUTPUT_NAME_MINSIZEREL", + cmSystemTools::ReplaceString(line, "OUTPUT_NAME_MINSIZEREL", outputNameMinSizeRel.c_str()); cmSystemTools::ReplaceString(line, "OUTPUT_NAME_RELWITHDEBINFO", outputNameRelWithDebInfo.c_str()); @@ -1431,7 +1510,7 @@ void cmLocalVisualStudio6Generator optionsDebug.c_str()); cmSystemTools::ReplaceString(line, "CM_MULTILINE_OPTIONS_RELEASE", optionsRelease.c_str()); - cmSystemTools::ReplaceString(line, "CM_MULTILINE_OPTIONS_MINSIZEREL", + cmSystemTools::ReplaceString(line, "CM_MULTILINE_OPTIONS_MINSIZEREL", optionsMinSizeRel.c_str()); cmSystemTools::ReplaceString(line, "CM_MULTILINE_OPTIONS_RELWITHDEBINFO", optionsRelWithDebInfo.c_str()); @@ -1519,41 +1598,18 @@ void cmLocalVisualStudio6Generator std::string flagVar = baseFlagVar + "_RELEASE"; flagsRelease = this->Makefile->GetSafeDefinition(flagVar.c_str()); flagsRelease += " -DCMAKE_INTDIR=\\\"Release\\\" "; - if(const char* targetLinkFlags = - target.GetProperty("LINK_FLAGS_RELEASE")) - { - flagsRelease += targetLinkFlags; - flagsRelease += " "; - } + flagVar = baseFlagVar + "_MINSIZEREL"; flagsMinSize = this->Makefile->GetSafeDefinition(flagVar.c_str()); flagsMinSize += " -DCMAKE_INTDIR=\\\"MinSizeRel\\\" "; - if(const char* targetLinkFlags = - target.GetProperty("LINK_FLAGS_MINSIZEREL")) - { - flagsMinSize += targetLinkFlags; - flagsMinSize += " "; - } - + flagVar = baseFlagVar + "_DEBUG"; flagsDebug = this->Makefile->GetSafeDefinition(flagVar.c_str()); flagsDebug += " -DCMAKE_INTDIR=\\\"Debug\\\" "; - if(const char* targetLinkFlags = target.GetProperty("LINK_FLAGS_DEBUG")) - { - flagsDebug += targetLinkFlags; - flagsDebug += " "; - } flagVar = baseFlagVar + "_RELWITHDEBINFO"; flagsDebugRel = this->Makefile->GetSafeDefinition(flagVar.c_str()); flagsDebugRel += " -DCMAKE_INTDIR=\\\"RelWithDebInfo\\\" "; - if(const char* targetLinkFlags = - target.GetProperty("LINK_FLAGS_RELWITHDEBINFO")) - { - flagsDebugRel += targetLinkFlags; - flagsDebugRel += " "; - } - } // if unicode is not found, then add -D_MBCS @@ -1619,7 +1675,7 @@ void cmLocalVisualStudio6Generator // There are not separate CXX and C template files, so we use the same // variable names. The previous code sets up flags* variables to contain // the correct C or CXX flags - cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_MINSIZEREL", + cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_MINSIZEREL", flagsMinSize.c_str()); cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_DEBUG", flagsDebug.c_str()); @@ -1629,7 +1685,7 @@ void cmLocalVisualStudio6Generator flagsRelease.c_str()); cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS", flags.c_str()); - cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_MINSIZE", + cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_MINSIZEREL", minsizeDefines.c_str()); cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_DEBUG", debugDefines.c_str()); diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 1af0d1d42..e3f195a05 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -236,7 +236,7 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule() { std::string stampName = cmake::GetCMakeFilesDirectoryPostSlash(); stampName += "generate.stamp"; - const char* dsprule = + const char* dsprule = this->Makefile->GetRequiredDefinition("CMAKE_COMMAND"); cmCustomCommandLine commandLine; commandLine.push_back(dsprule); @@ -261,16 +261,20 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule() START_OUTPUT, UNCHANGED, true); commandLine.push_back(args); commandLine.push_back("--check-stamp-file"); - commandLine.push_back(stampName.c_str()); + std::string stampFilename = this->Convert(stampName.c_str(), FULL, + SHELL); + commandLine.push_back(stampFilename.c_str()); std::vector const& listFiles = this->Makefile->GetListFiles(); cmCustomCommandLines commandLines; commandLines.push_back(commandLine); const char* no_working_directory = 0; - this->Makefile->AddCustomCommandToOutput(stampName.c_str(), listFiles, - makefileIn.c_str(), commandLines, - comment.c_str(), + std::string fullpathStampName = this->Convert(stampName.c_str(), FULL, + UNCHANGED); + this->Makefile->AddCustomCommandToOutput(fullpathStampName.c_str(), + listFiles, makefileIn.c_str(), + commandLines, comment.c_str(), no_working_directory, true); if(cmSourceFile* file = this->Makefile->GetSource(makefileIn.c_str())) { @@ -913,7 +917,20 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, } fout << "\t\t\tConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n"; if(isDebug) { @@ -1053,7 +1070,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, fout << "\"\n"; std::string path = this->ConvertToXMLOutputPathSingle( target.GetDirectory(configName).c_str()); - fout << "\t\t\t\tProgramDataBaseFile=\"" + fout << "\t\t\t\tProgramDatabaseFile=\"" << path << "/" << targetNamePDB << "\"\n"; if(isDebug) diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index 83d8dece2..ed0b07fe1 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -169,7 +169,7 @@ cmLocalVisualStudioGenerator script += newline; newline = newline_text; script += "cd "; - script += this->Convert(workingDirectory, START_OUTPUT, SHELL); + script += this->Convert(workingDirectory, FULL, SHELL); // Change the working drive. if(workingDirectory[0] && workingDirectory[1] == ':') @@ -230,7 +230,15 @@ cmLocalVisualStudioGenerator escapeAllowMakeVars); } } + + // After each custom command, check for an error result. + // If there was an error, jump to the VCReportError label, + // skipping the run of any subsequent commands in this + // sequence. + // + script += newline_text; + script += "if errorlevel 1 goto VCReportError"; } + return script; } - diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index d09188ad2..8eece6b5a 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -124,7 +124,6 @@ cmMakefile::cmMakefile(const cmMakefile& mf): Internal(new Internals) this->LocalGenerator = mf.LocalGenerator; this->FunctionBlockers = mf.FunctionBlockers; - this->DataMap = mf.DataMap; this->MacrosMap = mf.MacrosMap; this->SubDirectoryOrder = mf.SubDirectoryOrder; this->Properties = mf.Properties; @@ -200,14 +199,6 @@ cmMakefile::~cmMakefile() { delete this->UsedCommands[i]; } - for(DataMapType::const_iterator d = this->DataMap.begin(); - d != this->DataMap.end(); ++d) - { - if(d->second) - { - delete d->second; - } - } std::vector::iterator pos; for (pos = this->FunctionBlockers.begin(); pos != this->FunctionBlockers.end(); ++pos) @@ -2368,11 +2359,9 @@ void cmMakefile::AddDefaultDefinitions() this->AddDefinition("CMAKE_MAJOR_VERSION", temp); sprintf(temp, "%d", cmVersion::GetPatchVersion()); this->AddDefinition("CMAKE_PATCH_VERSION", temp); - sprintf(temp, "%u.%u.%u", - cmVersion::GetMajorVersion(), - cmVersion::GetMinorVersion(), - cmVersion::GetPatchVersion()); - this->AddDefinition("CMAKE_VERSION", temp); + sprintf(temp, "%d", cmVersion::GetTweakVersion()); + this->AddDefinition("CMAKE_TWEAK_VERSION", temp); + this->AddDefinition("CMAKE_VERSION", cmVersion::GetCMakeVersion()); this->AddDefinition("CMAKE_FILES_DIRECTORY", cmake::GetCMakeFilesDirectory()); @@ -2593,54 +2582,6 @@ void cmMakefile::SetHomeOutputDirectory(const char* lib) } } - -/** - * Register the given cmData instance with its own name. - */ -void cmMakefile::RegisterData(cmData* data) -{ - std::string name = data->GetName(); - DataMapType::const_iterator d = this->DataMap.find(name); - if((d != this->DataMap.end()) && (d->second != 0) && (d->second != data)) - { - delete d->second; - } - this->DataMap[name] = data; -} - - -/** - * Register the given cmData instance with the given name. This can be used - * to register a NULL pointer. - */ -void cmMakefile::RegisterData(const char* name, cmData* data) -{ - DataMapType::const_iterator d = this->DataMap.find(name); - if((d != this->DataMap.end()) && (d->second != 0) && (d->second != data)) - { - delete d->second; - } - this->DataMap[name] = data; -} - - -/** - * Lookup a cmData instance previously registered with the given name. If - * the instance cannot be found, return NULL. - */ -cmData* cmMakefile::LookupData(const char* name) const -{ - DataMapType::const_iterator d = this->DataMap.find(name); - if(d != this->DataMap.end()) - { - return d->second; - } - else - { - return 0; - } -} - //---------------------------------------------------------------------------- cmSourceFile* cmMakefile::GetSource(const char* sourceName) { diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 63f81b827..4fae7eee2 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -13,7 +13,6 @@ #define cmMakefile_h #include "cmCacheManager.h" -#include "cmData.h" #include "cmExecutionStatus.h" #include "cmListFileCache.h" #include "cmPolicies.h" @@ -692,10 +691,6 @@ public: std::vector &groups); #endif - void RegisterData(cmData*); - void RegisterData(const char*, cmData*); - cmData* LookupData(const char*) const; - /** * Execute a single CMake command. Returns true if the command * succeeded or false if it failed. @@ -916,9 +911,6 @@ private: void PushFunctionBlockerBarrier(); void PopFunctionBlockerBarrier(bool reportError = true); - typedef std::map DataMapType; - DataMapType DataMap; - typedef std::map StringStringMap; StringStringMap MacrosMap; diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index e7c4a7d71..93c981aa0 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -229,10 +229,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) // Add language feature flags. this->AddFeatureFlags(flags, linkLanguage); -#ifdef __APPLE__ this->LocalGenerator->AddArchitectureFlags(flags, this->Target, linkLanguage, this->ConfigName); -#endif /* __APPLE__ */ // Add target-specific linker flags. this->LocalGenerator->AppendFlags diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index f3511740d..dff91fe03 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -122,6 +122,10 @@ void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules() std::string extraFlags; this->LocalGenerator->AppendFlags (extraFlags,this->Target->GetProperty("STATIC_LIBRARY_FLAGS")); + std::string staticLibraryFlagsConfig = "STATIC_LIBRARY_FLAGS_"; + staticLibraryFlagsConfig += cmSystemTools::UpperCase(this->ConfigName); + this->LocalGenerator->AppendFlags + (extraFlags, this->Target->GetProperty(staticLibraryFlagsConfig.c_str())); this->WriteLibraryRules(linkRuleVar.c_str(), extraFlags.c_str(), false); } @@ -682,10 +686,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules std::string langFlags; this->AddFeatureFlags(langFlags, linkLanguage); -#ifdef __APPLE__ this->LocalGenerator->AddArchitectureFlags(langFlags, this->Target, linkLanguage, this->ConfigName); -#endif /* __APPLE__ */ // remove any language flags that might not work with the // particular os diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index dd459507e..d5d65852a 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -189,12 +189,15 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules() //---------------------------------------------------------------------------- void cmMakefileTargetGenerator::WriteCommonCodeRules() { + const char* root = (this->Makefile->IsOn("CMAKE_MAKE_INCLUDE_FROM_ROOT")? + "$(CMAKE_BINARY_DIR)/" : ""); + // Include the dependencies for the target. std::string dependFileNameFull = this->TargetBuildDirectoryFull; dependFileNameFull += "/depend.make"; *this->BuildFileStream << "# Include any dependencies generated for this target.\n" - << this->LocalGenerator->IncludeDirective << " " + << this->LocalGenerator->IncludeDirective << " " << root << this->Convert(dependFileNameFull.c_str(), cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKEFILE) @@ -205,7 +208,7 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules() // Include the progress variables for the target. *this->BuildFileStream << "# Include the progress variables for this target.\n" - << this->LocalGenerator->IncludeDirective << " " + << this->LocalGenerator->IncludeDirective << " " << root << this->Convert(this->ProgressFileNameFull.c_str(), cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKEFILE) @@ -238,7 +241,7 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules() // Include the flags for the target. *this->BuildFileStream << "# Include the compile flags for this target's objects.\n" - << this->LocalGenerator->IncludeDirective << " " + << this->LocalGenerator->IncludeDirective << " " << root << this->Convert(this->FlagFileNameFull.c_str(), cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKEFILE) @@ -294,10 +297,8 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags() // Add language feature flags. this->AddFeatureFlags(flags, lang); -#ifdef __APPLE__ this->LocalGenerator->AddArchitectureFlags(flags, this->Target, lang, this->ConfigName); -#endif /* __APPLE__ */ // Fortran-specific flags computed for this target. if(*l == "Fortran") @@ -1329,7 +1330,7 @@ public: this->NextObject = this->LocalGenerator->Convert(obj.c_str(), cmLocalGenerator::START_OUTPUT, - cmLocalGenerator::SHELL); + cmLocalGenerator::RESPONSE); // Roll over to next string if the limit will be exceeded. if(this->LengthLimit != std::string::npos && @@ -1439,11 +1440,15 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule(const char* main_output, //---------------------------------------------------------------------------- std::string cmMakefileTargetGenerator::GetFrameworkFlags() { -#ifndef __APPLE__ - return std::string(); -#else - std::set emitted; + if(!this->Makefile->IsOn("APPLE")) + { + return std::string(); + } + + std::set emitted; +#ifdef __APPLE__ /* don't insert this when crosscompiling e.g. to iphone */ emitted.insert("/System/Library/Frameworks"); +#endif std::vector includes; this->LocalGenerator->GetIncludeDirectories(includes); std::vector::iterator i; @@ -1475,7 +1480,6 @@ std::string cmMakefileTargetGenerator::GetFrameworkFlags() } } return flags; -#endif } //---------------------------------------------------------------------------- @@ -1620,6 +1624,17 @@ cmMakefileTargetGenerator std::vector object_strings; this->WriteObjectsStrings(object_strings, responseFileLimit); + // Lookup the response file reference flag. + std::string responseFlagVar = "CMAKE_"; + responseFlagVar += this->Target->GetLinkerLanguage(this->ConfigName); + responseFlagVar += "_RESPONSE_FILE_LINK_FLAG"; + const char* responseFlag = + this->Makefile->GetDefinition(responseFlagVar.c_str()); + if(!responseFlag) + { + responseFlag = "@"; + } + // Write a response file for each string. const char* sep = ""; for(unsigned int i = 0; i < object_strings.size(); ++i) @@ -1637,7 +1652,7 @@ cmMakefileTargetGenerator sep = " "; // Reference the response file. - buildObjs += "@"; + buildObjs += responseFlag; buildObjs += this->Convert(objects_rsp.c_str(), cmLocalGenerator::NONE, cmLocalGenerator::SHELL); diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 2d41d403c..69d3e5197 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -3,6 +3,7 @@ #include "cmMakefile.h" #include "cmSourceFile.h" #include "cmVersion.h" +#include "cmVersionMacros.h" #include #include #include @@ -22,6 +23,7 @@ public: unsigned int majorVersionIntroduced, unsigned int minorVersionIntroduced, unsigned int patchVersionIntroduced, + unsigned int tweakVersionIntroduced, cmPolicies::PolicyStatus status) { if (!idString || !shortDescription || ! longDescription) @@ -37,21 +39,26 @@ public: this->MajorVersionIntroduced = majorVersionIntroduced; this->MinorVersionIntroduced = minorVersionIntroduced; this->PatchVersionIntroduced = patchVersionIntroduced; + this->TweakVersionIntroduced = tweakVersionIntroduced; this->Status = status; } std::string GetVersionString() { - cmOStringStream error; - error << this->MajorVersionIntroduced << "." << - this->MinorVersionIntroduced << "." << - this->PatchVersionIntroduced; - return error.str(); + cmOStringStream v; + v << this->MajorVersionIntroduced << "." << this->MinorVersionIntroduced; + v << "." << this->PatchVersionIntroduced; + if(this->TweakVersionIntroduced > 0) + { + v << "." << this->TweakVersionIntroduced; + } + return v.str(); } bool IsPolicyNewerThan(unsigned int majorV, unsigned int minorV, - unsigned int patchV) + unsigned int patchV, + unsigned int tweakV) { if (majorV < this->MajorVersionIntroduced) { @@ -69,7 +76,15 @@ public: { return false; } - return (patchV < this->PatchVersionIntroduced); + if (patchV < this->PatchVersionIntroduced) + { + return true; + } + if (patchV > this->PatchVersionIntroduced) + { + return false; + } + return (tweakV < this->TweakVersionIntroduced); } cmPolicies::PolicyID ID; @@ -79,6 +94,7 @@ public: unsigned int MajorVersionIntroduced; unsigned int MinorVersionIntroduced; unsigned int PatchVersionIntroduced; + unsigned int TweakVersionIntroduced; cmPolicies::PolicyStatus Status; }; @@ -110,7 +126,7 @@ cmPolicies::cmPolicies() "The NEW behavior is to issue an error instead of a warning. " "An included file may set CMP0000 explicitly to affect how this " "policy is enforced for the main CMakeLists.txt file.", - 2,6,0, cmPolicies::WARN + 2,6,0,0, cmPolicies::WARN ); this->DefinePolicy( @@ -126,7 +142,7 @@ cmPolicies::cmPolicies() "and the cmake_policy command. " "However, CMake must still check CMAKE_BACKWARDS_COMPATIBILITY for " "projects written for CMake 2.4 and below.", - 2,6,0, cmPolicies::WARN + 2,6,0,0, cmPolicies::WARN ); this->DefinePolicy( @@ -148,7 +164,7 @@ cmPolicies::cmPolicies() "Custom targets must simply have globally unique names (unless one " "uses the global property ALLOW_DUPLICATE_CUSTOM_TARGETS with a " "Makefiles generator).", - 2,6,0, cmPolicies::WARN + 2,6,0,0, cmPolicies::WARN ); this->DefinePolicy( @@ -213,7 +229,7 @@ cmPolicies::cmPolicies() "Note that the warning for this policy will be issued for at most " "one target. This avoids flooding users with messages for every " "target when setting the policy once will probably fix all targets.", - 2,6,0, cmPolicies::WARN); + 2,6,0,0, cmPolicies::WARN); this->DefinePolicy( CMP0004, "CMP0004", @@ -229,7 +245,7 @@ cmPolicies::cmPolicies() "The setting for this policy used when checking the library names is " "that in effect when the target is created by an add_executable or " "add_library command.", - 2,6,0, cmPolicies::WARN); + 2,6,0,0, cmPolicies::WARN); this->DefinePolicy( CMP0005, "CMP0005", @@ -250,7 +266,7 @@ cmPolicies::cmPolicies() "for all native build tools automatically. " "See documentation of the COMPILE_DEFINITIONS target property for " "limitations of the escaping implementation.", - 2,6,0, cmPolicies::WARN); + 2,6,0,0, cmPolicies::WARN); this->DefinePolicy( CMP0006, "CMP0006", @@ -268,7 +284,7 @@ cmPolicies::cmPolicies() "DESTINATION if a BUNDLE DESTINATION is not given. " "The NEW behavior for this policy is to produce an error if a bundle " "target is installed without a BUNDLE DESTINATION.", - 2,6,0, cmPolicies::WARN); + 2,6,0,0, cmPolicies::WARN); this->DefinePolicy( CMP0007, "CMP0007", @@ -280,7 +296,7 @@ cmPolicies::cmPolicies() "The OLD behavior for this policy is to ignore empty list elements. " "The NEW behavior for this policy is to correctly count empty " "elements in a list. ", - 2,6,0, cmPolicies::WARN); + 2,6,0,0, cmPolicies::WARN); this->DefinePolicy( CMP0008, "CMP0008", @@ -306,7 +322,7 @@ cmPolicies::cmPolicies() "path and ask the linker to search for it. " "The NEW behavior for this policy is to trust the given path and " "pass it directly to the native build tool unchanged.", - 2,6,1, cmPolicies::WARN); + 2,6,1,0, cmPolicies::WARN); this->DefinePolicy( CMP0009, "CMP0009", @@ -322,7 +338,7 @@ cmPolicies::cmPolicies() "The NEW behavior for this policy is not to follow the symlinks " "by default, but only if FOLLOW_SYMLINKS is given as an additional " "argument to the FILE command.", - 2,6,2, cmPolicies::WARN); + 2,6,2,0, cmPolicies::WARN); this->DefinePolicy( CMP0010, "CMP0010", @@ -334,7 +350,7 @@ cmPolicies::cmPolicies() "The OLD behavior for this policy is to warn about the error, leave " "the string untouched, and continue. " "The NEW behavior for this policy is to report an error.", - 2,6,3, cmPolicies::WARN); + 2,6,3,0, cmPolicies::WARN); this->DefinePolicy( CMP0011, "CMP0011", @@ -354,7 +370,7 @@ cmPolicies::cmPolicies() "include() and find_package() commands. " "The NEW behavior for this policy is to allow the commands to do their " "default cmake_policy PUSH and POP.", - 2,6,3, cmPolicies::WARN); + 2,6,3,0, cmPolicies::WARN); this->DefinePolicy( CMP0012, "CMP0012", @@ -376,7 +392,7 @@ cmPolicies::cmPolicies() "named like numbers and boolean constants. " "The NEW behavior for this policy is to recognize numbers and " "boolean constants without dereferencing variables with such names.", - 2,8,0, cmPolicies::WARN); + 2,8,0,0, cmPolicies::WARN); this->DefinePolicy( CMP0013, "CMP0013", @@ -393,7 +409,7 @@ cmPolicies::cmPolicies() "directories. " "The NEW behavior for this policy is to disallow duplicate binary " "directories with an error.", - 2,8,0, cmPolicies::WARN); + 2,8,0,0, cmPolicies::WARN); this->DefinePolicy( CMP0014, "CMP0014", @@ -405,7 +421,7 @@ cmPolicies::cmPolicies() "the case is an error. " "The OLD behavior for this policy is to silently ignore the problem. " "The NEW behavior for this policy is to report an error.", - 2,8,0, cmPolicies::WARN); + 2,8,0,0, cmPolicies::WARN); this->DefinePolicy( CMP0015, "CMP0015", @@ -420,7 +436,7 @@ cmPolicies::cmPolicies() "The NEW behavior for this policy is to convert relative paths to " "absolute paths by appending the relative path to " "CMAKE_CURRENT_SOURCE_DIR.", - 2,8,1, cmPolicies::WARN); + 2,8,1,0, cmPolicies::WARN); } cmPolicies::~cmPolicies() @@ -441,6 +457,7 @@ void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD, unsigned int majorVersionIntroduced, unsigned int minorVersionIntroduced, unsigned int patchVersionIntroduced, + unsigned int tweakVersionIntroduced, cmPolicies::PolicyStatus status) { // a policy must be unique and can only be defined once @@ -457,6 +474,7 @@ void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD, majorVersionIntroduced, minorVersionIntroduced, patchVersionIntroduced, + tweakVersionIntroduced, status); this->PolicyStringMap[idString] = iD; } @@ -475,14 +493,15 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf, unsigned int majorVer = 2; unsigned int minorVer = 0; unsigned int patchVer = 0; + unsigned int tweakVer = 0; // parse the string - if(sscanf(ver.c_str(), "%u.%u.%u", - &majorVer, &minorVer, &patchVer) < 2) + if(sscanf(ver.c_str(), "%u.%u.%u.%u", + &majorVer, &minorVer, &patchVer, &tweakVer) < 2) { cmOStringStream e; e << "Invalid policy version value \"" << ver << "\". " - << "A numeric major.minor[.patch] must be given."; + << "A numeric major.minor[.patch[.tweak]] must be given."; mf->IssueMessage(cmake::FATAL_ERROR, e.str()); return false; } @@ -510,7 +529,11 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf, minorVer > cmVersion::GetMinorVersion()) || (majorVer == cmVersion::GetMajorVersion() && minorVer == cmVersion::GetMinorVersion() && - patchVer > cmVersion::GetPatchVersion())) + patchVer > cmVersion::GetPatchVersion()) || + (majorVer == cmVersion::GetMajorVersion() && + minorVer == cmVersion::GetMinorVersion() && + patchVer == cmVersion::GetPatchVersion() && + tweakVer > cmVersion::GetTweakVersion())) { cmOStringStream e; e << "An attempt was made to set the policy version of CMake to \"" @@ -528,7 +551,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf, = this->Policies.begin(); for (;i != this->Policies.end(); ++i) { - if (i->second->IsPolicyNewerThan(majorVer,minorVer,patchVer)) + if (i->second->IsPolicyNewerThan(majorVer,minorVer,patchVer,tweakVer)) { if(i->second->Status == cmPolicies::REQUIRED_ALWAYS) { diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index aaa3ac0ec..23064dc34 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -72,6 +72,7 @@ public: unsigned int majorVersionIntroduced, unsigned int minorVersionIntroduced, unsigned int patchVersionIntroduced, + unsigned int tweakVersionIntroduced, cmPolicies::PolicyStatus status); ///! Set a policy level for this listfile diff --git a/Source/cmSetPropertyCommand.h b/Source/cmSetPropertyCommand.h index 853e7baa3..c477bb73b 100644 --- a/Source/cmSetPropertyCommand.h +++ b/Source/cmSetPropertyCommand.h @@ -66,7 +66,9 @@ public: "directory (already processed by CMake) may be named by full or " "relative path.\n" "TARGET scope may name zero or more existing targets.\n" - "SOURCE scope may name zero or more source files.\n" + "SOURCE scope may name zero or more source files. " + "Note that source file properties are visible only to targets " + "added in the same directory (CMakeLists.txt).\n" "TEST scope may name zero or more existing tests.\n" "CACHE scope must name zero or more cache existing entries.\n" "The required PROPERTY option is immediately followed by the name " diff --git a/Source/cmSetSourceFilesPropertiesCommand.h b/Source/cmSetSourceFilesPropertiesCommand.h index 7182152d2..392f168ce 100644 --- a/Source/cmSetSourceFilesPropertiesCommand.h +++ b/Source/cmSetSourceFilesPropertiesCommand.h @@ -48,35 +48,15 @@ public: virtual const char* GetFullDocumentation() { return - " set_source_files_properties(file1 file2 ...\n" + " set_source_files_properties([file1 [file2 [...]]]\n" " PROPERTIES prop1 value1\n" - " prop2 value2 ...)\n" - "Set properties on a file. The syntax for the command is to list all " - "the files you want " - "to change, and then provide the values you want to set next. You " - "can make up your own properties as well. " - "The following are used by CMake. " - "The ABSTRACT flag (boolean) is used by some class wrapping " - "commands. " - "If WRAP_EXCLUDE (boolean) is true then many wrapping commands " - "will ignore this file. If GENERATED (boolean) is true then it " - "is not an error if this source file does not exist when it is " - "added to a target. Obviously, " - "it must be created (presumably by a custom command) before the " - "target is built. " - "If the HEADER_FILE_ONLY (boolean) property is true then the " - "file is not compiled. This is useful if you want to add extra " - "non build files to an IDE. " - "OBJECT_DEPENDS (string) adds dependencies to the object file. " - "COMPILE_FLAGS (string) is passed to the compiler as additional " - "command line arguments when the source file is compiled. " - "LANGUAGE (string) CXX|C will change the default compiler used " - "to compile the source file. The languages used need to be enabled " - "in the PROJECT command. " - "If SYMBOLIC (boolean) is set to true the build system will be " - "informed that the source file is not actually created on disk but " - "instead used as a symbolic name for a build rule."; - + " [prop2 value2 [...]])\n" + "Set properties associated with source files using a key/value " + "paired list. " + "See properties documentation for those known to CMake. " + "Unrecognized properties are ignored. " + "Source file properties are visible only to targets " + "added in the same directory (CMakeLists.txt)."; } cmTypeMacro(cmSetSourceFilesPropertiesCommand, cmCommand); diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 3704d6a9d..bc52d7fd2 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -404,7 +404,7 @@ void cmSourceFile::DefineProperties(cmake *cm) "The VS6 IDE does not support definition values with spaces " "(but NMake does). Xcode does not support per-configuration " "definitions on source files.\n" - "Dislaimer: Most native build tools have poor support for escaping " + "Disclaimer: Most native build tools have poor support for escaping " "certain values. CMake has work-arounds for many cases but some " "values may just not be possible to pass correctly. If a value " "does not seem to be escaped correctly, do not attempt to " @@ -433,7 +433,7 @@ void cmSourceFile::DefineProperties(cmake *cm) ("GENERATED", cmProperty::SOURCE_FILE, "Is this source file generated as part of the build process.", "If a source file is generated by the build process CMake will " - "handle it differently in temrs of dependency checking etc. " + "handle it differently in terms of dependency checking etc. " "Otherwise having a non-existent source file could create problems."); cm->DefineProperty @@ -487,7 +487,7 @@ void cmSourceFile::DefineProperties(cmake *cm) "For frameworks the content folder is " "\".framework/Versions/\". " "See the PUBLIC_HEADER, PRIVATE_HEADER, and RESOURCE target " - "properties for specifying files meant for Headers, PrivateHeadres, " + "properties for specifying files meant for Headers, PrivateHeaders, " "or Resources directories."); cm->DefineProperty diff --git a/Source/cmStandardIncludes.cxx b/Source/cmStandardIncludes.cxx new file mode 100644 index 000000000..a4bdb2e32 --- /dev/null +++ b/Source/cmStandardIncludes.cxx @@ -0,0 +1,16 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2010 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 "cmStandardIncludes.h" +#if !defined(CMAKE_NO_ANSI_STRING_STREAM) +cmOStringStream::cmOStringStream() {} +cmOStringStream::~cmOStringStream() {} +#endif diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h index 5db020048..e8decbb96 100644 --- a/Source/cmStandardIncludes.h +++ b/Source/cmStandardIncludes.h @@ -45,6 +45,7 @@ // This is a hack to prevent warnings about these functions being // declared but not referenced. #if defined(__sgi) && !defined(__GNUC__) +# pragma set woff 3970 /* conversion from pointer to same-sized */ # include class cmStandardIncludesHack { @@ -240,7 +241,8 @@ typedef cmsys::String cmStdString; class cmOStringStream: public std::ostringstream { public: - cmOStringStream() {} + cmOStringStream(); + ~cmOStringStream(); private: cmOStringStream(const cmOStringStream&); void operator=(const cmOStringStream&); diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 33e8fb0af..5f7cfa398 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -18,11 +18,13 @@ #ifdef __QNX__ # include /* for malloc/free on QNX */ #endif - +#include #include #include #include #if defined(CMAKE_BUILD_WITH_CMAKE) +#include +#include # include #endif #include @@ -45,9 +47,8 @@ #endif #if defined(CMAKE_BUILD_WITH_CMAKE) -# include +# include // auto_ptr # include -# include # include #endif @@ -1713,166 +1714,147 @@ bool cmSystemTools::IsPathToFramework(const char* path) return false; } -#if defined(CMAKE_BUILD_WITH_CMAKE) -struct cmSystemToolsGZStruct -{ - gzFile GZFile; -}; - -extern "C" { - int cmSystemToolsGZStructOpen(void* call_data, const char *pathname, - int oflags, mode_t mode); - int cmSystemToolsGZStructClose(void* call_data); - ssize_t cmSystemToolsGZStructRead(void* call_data, void* buf, size_t count); - ssize_t cmSystemToolsGZStructWrite(void* call_data, const void* buf, - size_t count); -} - -int cmSystemToolsGZStructOpen(void* call_data, const char *pathname, - int oflags, mode_t mode) -{ - const char *gzoflags; - int fd; - - cmSystemToolsGZStruct* gzf = static_cast(call_data); - - switch (oflags & O_ACCMODE) - { - case O_WRONLY: - gzoflags = "wb"; - break; - case O_RDONLY: - gzoflags = "rb"; - break; - default: - case O_RDWR: - errno = EINVAL; - return -1; - } - - fd = open(pathname, oflags, mode); - if (fd == -1) - { - return -1; - } - -// no fchmod on BeOS 5...do pathname instead. -#if defined(__BEOS__) && !defined(__ZETA__) && !defined(__HAIKU__) - if ((oflags & O_CREAT) && chmod(pathname, mode)) - { - return -1; - } -#elif !defined(_WIN32) || defined(__CYGWIN__) - if ((oflags & O_CREAT) && fchmod(fd, mode)) - { - return -1; - } -#endif - - gzf->GZFile = gzdopen(fd, gzoflags); - if (!gzf->GZFile) - { - errno = ENOMEM; - return -1; - } - - return fd; -} - -int cmSystemToolsGZStructClose(void* call_data) -{ - cmSystemToolsGZStruct* gzf = static_cast(call_data); - return gzclose(gzf->GZFile); -} - -ssize_t cmSystemToolsGZStructRead(void* call_data, void* buf, size_t count) -{ - cmSystemToolsGZStruct* gzf = static_cast(call_data); - return gzread(gzf->GZFile, buf, static_cast(count)); -} - -ssize_t cmSystemToolsGZStructWrite(void* call_data, const void* buf, - size_t count) -{ - cmSystemToolsGZStruct* gzf = static_cast(call_data); - return gzwrite(gzf->GZFile, (void*)buf, static_cast(count)); -} - -#endif - bool cmSystemTools::CreateTar(const char* outFileName, const std::vector& files, - bool gzip, bool verbose) + bool gzip, bool bzip2, bool verbose) { #if defined(CMAKE_BUILD_WITH_CMAKE) - TAR *t; - char buf[TAR_MAXPATHLEN]; - char pathname[TAR_MAXPATHLEN]; - cmSystemToolsGZStruct gzs; - - tartype_t gztype = { - (openfunc_t)cmSystemToolsGZStructOpen, - (closefunc_t)cmSystemToolsGZStructClose, - (readfunc_t)cmSystemToolsGZStructRead, - (writefunc_t)cmSystemToolsGZStructWrite, - &gzs - }; - - // This libtar is not const safe. Make a non-const copy of outFileName - char* realName = new char[ strlen(outFileName) + 1 ]; - strcpy(realName, outFileName); - int options = 0; - if(verbose) - { - options |= TAR_VERBOSE; - } -#ifdef __CYGWIN__ - options |= TAR_GNU; -#endif - if (tar_open(&t, realName, - (gzip? &gztype : NULL), - O_WRONLY | O_CREAT, 0644, - options) == -1) - { - cmSystemTools::Error("Problem with tar_open(): ", strerror(errno)); - delete [] realName; - return false; + + // Create a macro to handle return from libarchive + // functions +#define CHECK_ARCHIVE_ERROR(res, msg)\ + if(res != ARCHIVE_OK)\ + {\ + cmSystemTools::Error(msg, \ + archive_error_string(a));\ + return false;\ } - - delete [] realName; - - std::vector::const_iterator it; - for (it = files.begin(); it != files.end(); ++ it ) - { - strncpy(pathname, it->c_str(), sizeof(pathname)); - pathname[sizeof(pathname)-1] = 0; - strncpy(buf, pathname, sizeof(buf)); - buf[sizeof(buf)-1] = 0; - if (tar_append_tree(t, buf, pathname) != 0) + + std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); + // recursively expand all directories in files so that we have a list + // of files + std::vector expandedFiles; + for(std::vector::const_iterator i = files.begin(); + i != files.end(); ++i) + { + if(cmSystemTools::FileIsDirectory(i->c_str())) + { + cmsys::Glob gl; + std::string findExpr = *i; + if ( findExpr[findExpr.size()-1] != '/' ) + { + findExpr +="/"; + } + findExpr += "*"; + gl.RecurseOn(); + if ( gl.FindFiles(findExpr) ) + { + std::vector dirfiles = gl.GetFiles(); + std::copy(dirfiles.begin(), dirfiles.end(), + std::back_inserter(expandedFiles)); + } + } + else { - cmOStringStream ostr; - ostr << "Problem with tar_append_tree(\"" << buf << "\", \"" - << pathname << "\"): " - << strerror(errno); - cmSystemTools::Error(ostr.str().c_str()); - tar_close(t); - return false; + if(!cmSystemTools::FileIsFullPath(i->c_str())) + { + std::string fullp = cwd + "/" + *i; + expandedFiles.push_back(fullp); + } + else + { + expandedFiles.push_back(*i); + } } } - - if (tar_append_eof(t) != 0) + int res; + // create a new archive + struct archive* a = archive_write_new(); + if(!a) { - cmSystemTools::Error("Problem with tar_append_eof(): ", strerror(errno)); - tar_close(t); + cmSystemTools::Error("Unable to use create archive"); return false; } - if (tar_close(t) != 0) - { - cmSystemTools::Error("Problem with tar_close(): ", strerror(errno)); - return false; - } + if(gzip) + { + res = archive_write_set_compression_gzip(a); + CHECK_ARCHIVE_ERROR(res, "Can not set gzip:"); + } + if(bzip2) + { + res = archive_write_set_compression_bzip2(a); + CHECK_ARCHIVE_ERROR(res, "Can not set bzip2:"); + } + if(!bzip2 && !gzip) + { + res = archive_write_set_compression_none(a); + CHECK_ARCHIVE_ERROR(res, "Can not set none:"); + } + res = archive_write_set_format_pax_restricted(a); + CHECK_ARCHIVE_ERROR(res, "Can not set tar format:"); + res = archive_write_open_file(a, outFileName); + CHECK_ARCHIVE_ERROR(res, "write open:"); + // create a new disk struct + struct archive* disk = archive_read_disk_new(); + archive_read_disk_set_standard_lookup(disk); + std::vector::const_iterator fileIt; + for ( fileIt = expandedFiles.begin(); + fileIt != expandedFiles.end(); ++ fileIt ) + { + // create a new entry for each file + struct archive_entry *entry = archive_entry_new(); + // Get the relative path to the file + std::string rp = cmSystemTools::RelativePath(cwd.c_str(), + fileIt->c_str()); + if(verbose) + { + std::cout << rp << "\n"; + } + // Set the name of the entry to the file name + archive_entry_set_pathname(entry, rp.c_str()); + archive_read_disk_entry_from_file(disk, entry, -1, 0); + CHECK_ARCHIVE_ERROR(res, "read disk entry:"); + // write entry header + res = archive_write_header(a, entry); + CHECK_ARCHIVE_ERROR(res, "write header: "); + if(archive_entry_size(entry) > 0) + { + // now copy contents of file into archive a + FILE* file = fopen(fileIt->c_str(), "rb"); + if(!file) + { + cmSystemTools::Error("Problem with fopen(): ", + fileIt->c_str()); + return false; + } + char buff[16384]; + size_t len = fread(buff, 1, sizeof(buff), file); + while (len > 0) + { + size_t wlen = archive_write_data(a, buff, len); + if(wlen != len) + { + cmOStringStream error; + error << "Problem with archive_write_data\n" + << "Tried to write [" << len << "] bytes.\n" + << "archive_write_data wrote [" << wlen << "] bytes.\n"; + cmSystemTools::Error(error.str().c_str(), + archive_error_string(a) + ); + return false; + } + len = fread(buff, 1, sizeof(buff), file); + } + // close the file and free the entry + fclose(file); + } + archive_entry_free(entry); + } + archive_write_close(a); + archive_write_finish(a); + archive_read_finish(disk); return true; #else (void)outFileName; @@ -1883,134 +1865,253 @@ bool cmSystemTools::CreateTar(const char* outFileName, #endif } -bool cmSystemTools::ExtractTar(const char* outFileName, - const std::vector& files, - bool gzip, bool verbose) -{ - (void)files; #if defined(CMAKE_BUILD_WITH_CMAKE) - TAR *t; - cmSystemToolsGZStruct gzs; - - tartype_t gztype = { - cmSystemToolsGZStructOpen, - cmSystemToolsGZStructClose, - cmSystemToolsGZStructRead, - cmSystemToolsGZStructWrite, - &gzs - }; - - // This libtar is not const safe. Make a non-const copy of outFileName - char* realName = new char[ strlen(outFileName) + 1 ]; - strcpy(realName, outFileName); - if (tar_open(&t, realName, - (gzip? &gztype : NULL), - O_RDONLY -#ifdef _WIN32 - | O_BINARY -#endif - , 0, - (verbose?TAR_VERBOSE:0) - | 0) == -1) +namespace{ +#define BSDTAR_FILESIZE_PRINTF "%lu" +#define BSDTAR_FILESIZE_TYPE unsigned long + void + list_item_verbose(FILE *out, struct archive_entry *entry) +{ + char tmp[100]; + size_t w; + const char *p; + const char *fmt; + time_t tim; + static time_t now; + size_t u_width = 6; + size_t gs_width = 13; + + /* + * We avoid collecting the entire list in memory at once by + * listing things as we see them. However, that also means we can't + * just pre-compute the field widths. Instead, we start with guesses + * and just widen them as necessary. These numbers are completely + * arbitrary. + */ + if (!now) + { + time(&now); + } + fprintf(out, "%s %d ", + archive_entry_strmode(entry), + archive_entry_nlink(entry)); + + /* Use uname if it's present, else uid. */ + p = archive_entry_uname(entry); + if ((p == NULL) || (*p == '\0')) { - cmSystemTools::Error("Problem with tar_open(): ", strerror(errno)); - delete [] realName; - return false; + sprintf(tmp, "%lu ", + (unsigned long)archive_entry_uid(entry)); + p = tmp; } + w = strlen(p); + if (w > u_width) + { + u_width = w; + } + fprintf(out, "%-*s ", (int)u_width, p); + /* Use gname if it's present, else gid. */ + p = archive_entry_gname(entry); + if (p != NULL && p[0] != '\0') + { + fprintf(out, "%s", p); + w = strlen(p); + } + else + { + sprintf(tmp, "%lu", + (unsigned long)archive_entry_gid(entry)); + w = strlen(tmp); + fprintf(out, "%s", tmp); + } + + /* + * Print device number or file size, right-aligned so as to make + * total width of group and devnum/filesize fields be gs_width. + * If gs_width is too small, grow it. + */ + if (archive_entry_filetype(entry) == AE_IFCHR + || archive_entry_filetype(entry) == AE_IFBLK) + { + sprintf(tmp, "%lu,%lu", + (unsigned long)archive_entry_rdevmajor(entry), + (unsigned long)archive_entry_rdevminor(entry)); + } + else + { + /* + * Note the use of platform-dependent macros to format + * the filesize here. We need the format string and the + * corresponding type for the cast. + */ + sprintf(tmp, BSDTAR_FILESIZE_PRINTF, + (BSDTAR_FILESIZE_TYPE)archive_entry_size(entry)); + } + if (w + strlen(tmp) >= gs_width) + { + gs_width = w+strlen(tmp)+1; + } + fprintf(out, "%*s", (int)(gs_width - w), tmp); - delete [] realName; - - if (tar_extract_all(t, 0) != 0) - { - cmSystemTools::Error("Problem with tar_extract_all(): ", strerror(errno)); - return false; - } + /* Format the time using 'ls -l' conventions. */ + tim = archive_entry_mtime(entry); +#define HALF_YEAR (time_t)365 * 86400 / 2 +#if defined(_WIN32) && !defined(__CYGWIN__) + /* Windows' strftime function does not support %e format. */ +#define DAY_FMT "%d" +#else +#define DAY_FMT "%e" /* Day number without leading zeros */ +#endif + if (tim < now - HALF_YEAR || tim > now + HALF_YEAR) + { + fmt = DAY_FMT " %b %Y"; + } + else + { + fmt = DAY_FMT " %b %H:%M"; + } + strftime(tmp, sizeof(tmp), fmt, localtime(&tim)); + fprintf(out, " %s ", tmp); + fprintf(out, "%s", archive_entry_pathname(entry)); - if (tar_close(t) != 0) + /* Extra information for links. */ + if (archive_entry_hardlink(entry)) /* Hard link */ { - cmSystemTools::Error("Problem with tar_close(): ", strerror(errno)); - return false; + fprintf(out, " link to %s", + archive_entry_hardlink(entry)); } - return true; -#else - (void)outFileName; - (void)gzip; - (void)verbose; - return false; + else if (archive_entry_symlink(entry)) /* Symbolic link */ + { + fprintf(out, " -> %s", archive_entry_symlink(entry)); + } +} +#ifdef __BORLANDC__ +# pragma warn -8066 /* unreachable code */ #endif + +int copy_data(struct archive *ar, struct archive *aw) +{ + int r; + const void *buff; + size_t size; + off_t offset; + + for (;;) + { + r = archive_read_data_block(ar, &buff, &size, &offset); + if (r == ARCHIVE_EOF) + { + return (ARCHIVE_OK); + } + if (r != ARCHIVE_OK) + { + return (r); + } + r = archive_write_data_block(aw, buff, size, offset); + if (r != ARCHIVE_OK) + { + cmSystemTools::Message("archive_write_data_block()", + archive_error_string(aw)); + return (r); + } + } + return r; } -bool cmSystemTools::ListTar(const char* outFileName, - std::vector& files, bool gzip, - bool verbose) +bool extract_tar(const char* outFileName, bool verbose, + bool extract) { -#if defined(CMAKE_BUILD_WITH_CMAKE) - TAR *t; - cmSystemToolsGZStruct gzs; - - tartype_t gztype = { - cmSystemToolsGZStructOpen, - cmSystemToolsGZStructClose, - cmSystemToolsGZStructRead, - cmSystemToolsGZStructWrite, - &gzs - }; - - // This libtar is not const safe. Make a non-const copy of outFileName - char* realName = new char[ strlen(outFileName) + 1 ]; - strcpy(realName, outFileName); - if (tar_open(&t, realName, - (gzip? &gztype : NULL), - O_RDONLY -#ifdef _WIN32 - | O_BINARY -#endif - , 0, - (verbose?TAR_VERBOSE:0) - | 0) == -1) - { - cmSystemTools::Error("Problem with tar_open(): ", strerror(errno)); - delete [] realName; + struct archive* a = archive_read_new(); + struct archive *ext = archive_write_disk_new(); + archive_read_support_compression_all(a); + archive_read_support_format_all(a); + struct archive_entry *entry; + int r = archive_read_open_file(a, outFileName, 10240); + if(r) + { + cmSystemTools::Error("Problem with archive_read_open_file(): ", + archive_error_string(a)); return false; } - - delete [] realName; - - while ((th_read(t)) == 0) - { - const char* filename = th_get_pathname(t); - files.push_back(filename); - - if ( verbose ) + for (;;) + { + r = archive_read_next_header(a, &entry); + if (r == ARCHIVE_EOF) { - th_print_long_ls(t); + break; } - else + if (r != ARCHIVE_OK) { - std::cout << filename << std::endl; + cmSystemTools::Error("Problem with archive_read_next_header(): ", + archive_error_string(a)); } - -#ifdef DEBUG - th_print(t); -#endif - if (TH_ISREG(t) && tar_skip_regfile(t) != 0) + if (verbose && extract) { - cmSystemTools::Error("Problem with tar_skip_regfile(): ", - strerror(errno)); - return false; + cmSystemTools::Stdout("x "); + cmSystemTools::Stdout(archive_entry_pathname(entry)); + } + if(verbose && !extract) + { + list_item_verbose(stdout, entry); + } + else if(!extract) + { + cmSystemTools::Stdout(archive_entry_pathname(entry)); + } + if(extract) + { + r = archive_write_header(ext, entry); + if (r != ARCHIVE_OK) + { + cmSystemTools::Error("Problem with archive_write_header(): ", + archive_error_string(a)); + cmSystemTools::Error("Curren file:", + archive_entry_pathname(entry)); + } + else + { + copy_data(a, ext); + r = archive_write_finish_entry(ext); + if (r != ARCHIVE_OK) + { + cmSystemTools::Error("Problem with archive_write_finish_entry(): ", + archive_error_string(ext)); + } + } + } + if (verbose || !extract) + { + cmSystemTools::Stdout("\n"); } - } - - if (tar_close(t) != 0) - { - cmSystemTools::Error("Problem with tar_close(): ", strerror(errno)); - return false; } + archive_read_close(a); + archive_read_finish(a); return true; + +} +} +#endif + +bool cmSystemTools::ExtractTar(const char* outFileName, + bool , bool verbose) +{ +#if defined(CMAKE_BUILD_WITH_CMAKE) + return extract_tar(outFileName, verbose, true); +#else + (void)outFileName; + (void)verbose; + return false; +#endif +} + +bool cmSystemTools::ListTar(const char* outFileName, + bool , + bool verbose) +{ +#if defined(CMAKE_BUILD_WITH_CMAKE) + return extract_tar(outFileName, verbose, false); #else (void)outFileName; - (void)files; - (void)gzip; (void)verbose; return false; #endif @@ -2837,3 +2938,18 @@ bool cmSystemTools::CheckRPath(std::string const& file, return false; #endif } + +//---------------------------------------------------------------------------- +bool cmSystemTools::RepeatedRemoveDirectory(const char* dir) +{ + // Windows sometimes locks files temporarily so try a few times. + for(int i = 0; i < 10; ++i) + { + if(cmSystemTools::RemoveADirectory(dir)) + { + return true; + } + cmSystemTools::Delay(100); + } + return false; +} diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 70d1462cd..da5da319b 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -379,13 +379,11 @@ public: /** Create tar */ static bool ListTar(const char* outFileName, - std::vector& files, bool gzip, bool verbose); static bool CreateTar(const char* outFileName, const std::vector& files, bool gzip, - bool verbose); - static bool ExtractTar(const char* inFileName, - const std::vector& files, bool gzip, + bool bzip2, bool verbose); + static bool ExtractTar(const char* inFileName, bool gzip, bool verbose); // This should be called first thing in main // it will keep child processes from inheriting the @@ -438,6 +436,9 @@ public: static bool CheckRPath(std::string const& file, std::string const& newRPath); + /** Remove a directory; repeat a few times in case of locked files. */ + static bool RepeatedRemoveDirectory(const char* dir); + private: static bool s_ForceUnixPaths; static bool s_RunCommandHideConsole; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 0436bd076..45ba35844 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -202,7 +202,7 @@ void cmTarget::DefineProperties(cmake *cm) cm->DefineProperty ("HAS_CXX", cmProperty::TARGET, - "Link the target using the C++ linker tool (obselete).", + "Link the target using the C++ linker tool (obsolete).", "This is equivalent to setting the LINKER_LANGUAGE property to CXX. " "See that property's documentation for details."); @@ -707,6 +707,11 @@ void cmTarget::DefineProperties(cmake *cm) "Extra flags to use when linking static libraries.", "Extra flags to use when linking a static library."); + cm->DefineProperty + ("STATIC_LIBRARY_FLAGS_", cmProperty::TARGET, + "Per-configuration flags for creating a static library.", + "This is the configuration-specific version of STATIC_LIBRARY_FLAGS."); + cm->DefineProperty ("SUFFIX", cmProperty::TARGET, "What comes after the library name.", diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx index b52bc19eb..4e9b9734b 100644 --- a/Source/cmTest.cxx +++ b/Source/cmTest.cxx @@ -142,6 +142,12 @@ void cmTest::DefineProperties(cmake *cm) "Specify a list of text labels associated with a test.", "The list is reported in dashboard submissions."); + cm->DefineProperty + ("RESOURCE_LOCK", cmProperty::TEST, + "Specify a list of resources that are locked by this test.", + "If multiple tests specify the same resource lock, they are guaranteed " + "not to run concurrently."); + cm->DefineProperty ("MEASUREMENT", cmProperty::TEST, "Specify a CDASH measurement and value to be reported for a test.", diff --git a/Source/cmVersion.cxx b/Source/cmVersion.cxx index bde5f9812..047d24d74 100644 --- a/Source/cmVersion.cxx +++ b/Source/cmVersion.cxx @@ -16,8 +16,9 @@ unsigned int cmVersion::GetMajorVersion() { return CMake_VERSION_MAJOR; } unsigned int cmVersion::GetMinorVersion() { return CMake_VERSION_MINOR; } unsigned int cmVersion::GetPatchVersion() { return CMake_VERSION_PATCH; } +unsigned int cmVersion::GetTweakVersion() { return CMake_VERSION_TWEAK; } const char* cmVersion::GetCMakeVersion() { - return CMake_VERSION_FULL CMake_VERSION_RC_SUFFIX; + return CMake_VERSION; } diff --git a/Source/cmVersion.h b/Source/cmVersion.h index f267ab6f6..e31352476 100644 --- a/Source/cmVersion.h +++ b/Source/cmVersion.h @@ -28,6 +28,7 @@ public: static unsigned int GetMajorVersion(); static unsigned int GetMinorVersion(); static unsigned int GetPatchVersion(); + static unsigned int GetTweakVersion(); static const char* GetCMakeVersion(); }; diff --git a/Source/cmVersionConfig.h.in b/Source/cmVersionConfig.h.in index ee6eca7e0..76bc8fe94 100644 --- a/Source/cmVersionConfig.h.in +++ b/Source/cmVersionConfig.h.in @@ -12,4 +12,5 @@ #define CMake_VERSION_MAJOR @CMake_VERSION_MAJOR@ #define CMake_VERSION_MINOR @CMake_VERSION_MINOR@ #define CMake_VERSION_PATCH @CMake_VERSION_PATCH@ -#cmakedefine CMake_VERSION_RC @CMake_VERSION_RC@ +#define CMake_VERSION_TWEAK @CMake_VERSION_TWEAK@ +#define CMake_VERSION "@CMake_VERSION@" diff --git a/Source/cmVersionMacros.h b/Source/cmVersionMacros.h index 412db6d46..67f58ca41 100644 --- a/Source/cmVersionMacros.h +++ b/Source/cmVersionMacros.h @@ -14,22 +14,9 @@ #include "cmVersionConfig.h" -#define CMAKE_TO_STRING(x) CMAKE_TO_STRING0(x) -#define CMAKE_TO_STRING0(x) #x - -#define CMake_VERSION \ - CMAKE_TO_STRING(CMake_VERSION_MAJOR) "." \ - CMAKE_TO_STRING(CMake_VERSION_MINOR) - -#define CMake_VERSION_FULL \ - CMAKE_TO_STRING(CMake_VERSION_MAJOR) "." \ - CMAKE_TO_STRING(CMake_VERSION_MINOR) "." \ - CMAKE_TO_STRING(CMake_VERSION_PATCH) - -#if !(CMake_VERSION_MINOR & 1) && defined(CMake_VERSION_RC) -# define CMake_VERSION_RC_SUFFIX "-rc" CMAKE_TO_STRING(CMake_VERSION_RC) -#else -# define CMake_VERSION_RC_SUFFIX "" +#define CMake_VERSION_TWEAK_IS_RELEASE(tweak) ((tweak) < 20000000) +#if CMake_VERSION_TWEAK_IS_RELEASE(CMake_VERSION_TWEAK) +# define CMake_VERSION_IS_RELEASE 1 #endif #endif diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 4a8e161f3..59e20d50c 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -435,12 +435,16 @@ void cmVisualStudio10TargetGenerator::WriteGroups() none.push_back(sf); } } + + this->AddMissingSourceGroups(groupsUsed, sourceGroups); + // Write out group file std::string path = this->Makefile->GetStartOutputDirectory(); path += "/"; path += this->Name; path += ".vcxproj.filters"; cmGeneratedFileStream fout(path.c_str()); + fout.SetCopyIfDifferent(true); char magic[] = {0xEF,0xBB, 0xBF}; fout.write(magic, 3); cmGeneratedFileStream* save = this->BuildFileStream; @@ -484,9 +488,60 @@ void cmVisualStudio10TargetGenerator::WriteGroups() this->WriteString("\n", 0); // restore stream pointer this->BuildFileStream = save; + + if (fout.Close()) + { + this->GlobalGenerator->FileReplacedDuringGenerate(path); + } } -void +// Add to groupsUsed empty source groups that have non-empty children. +void +cmVisualStudio10TargetGenerator::AddMissingSourceGroups( + std::set& groupsUsed, + const std::vector& allGroups + ) +{ + for(std::vector::const_iterator current = allGroups.begin(); + current != allGroups.end(); ++current) + { + std::vector const& children = current->GetGroupChildren(); + if(children.empty()) + { + continue; // the group is really empty + } + + this->AddMissingSourceGroups(groupsUsed, children); + + cmSourceGroup* current_ptr = const_cast(&(*current)); + if(groupsUsed.find(current_ptr) != groupsUsed.end()) + { + continue; // group has already been added to set + } + + // check if it least one of the group's descendants is not empty + // (at least one child must already have been added) + std::vector::const_iterator child_it = children.begin(); + while(child_it != children.end()) + { + cmSourceGroup* child_ptr = const_cast(&(*child_it)); + if(groupsUsed.find(child_ptr) != groupsUsed.end()) + { + break; // found a child that was already added => add current group too + } + child_it++; + } + + if(child_it == children.end()) + { + continue; // no descendants have source files => ignore this group + } + + groupsUsed.insert(current_ptr); + } +} + +void cmVisualStudio10TargetGenerator:: WriteGroupSources(const char* name, std::vector const& sources, @@ -854,6 +909,13 @@ OutputLinkIncremental(std::string const& configName) flags += " "; flags += targetLinkFlags; } + std::string flagsProp = "LINK_FLAGS_"; + flagsProp += CONFIG; + if(const char* flagsConfig = this->Target->GetProperty(flagsProp.c_str())) + { + flags += " "; + flags += flagsConfig; + } if(flags.find("INCREMENTAL:NO") != flags.npos) { incremental = "false"; @@ -1010,22 +1072,27 @@ WriteRCOptions(std::string const& , } -void cmVisualStudio10TargetGenerator::WriteLibOptions(std::string const& - ) +void +cmVisualStudio10TargetGenerator::WriteLibOptions(std::string const& config) { if(this->Target->GetType() != cmTarget::STATIC_LIBRARY) { return; } - if(const char* libflags = this->Target - ->GetProperty("STATIC_LIBRARY_FLAGS")) + const char* libflags = this->Target->GetProperty("STATIC_LIBRARY_FLAGS"); + std::string flagsConfigVar = "STATIC_LIBRARY_FLAGS_"; + flagsConfigVar += cmSystemTools::UpperCase(config); + const char* libflagsConfig = + this->Target->GetProperty(flagsConfigVar.c_str()); + if(libflags || libflagsConfig) { this->WriteString("\n", 2); cmVisualStudioGeneratorOptions libOptions(this->LocalGenerator, 10, cmVisualStudioGeneratorOptions::Linker, cmVS10LibFlagTable, 0, this); - libOptions.Parse(libflags); + libOptions.Parse(libflags?libflags:""); + libOptions.Parse(libflagsConfig?libflagsConfig:""); libOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", ""); libOptions.OutputFlagMap(*this->BuildFileStream, " "); this->WriteString("\n", 2); @@ -1093,6 +1160,13 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& flags += " "; flags += targetLinkFlags; } + std::string flagsProp = "LINK_FLAGS_"; + flagsProp += CONFIG; + if(const char* flagsConfig = this->Target->GetProperty(flagsProp.c_str())) + { + flags += " "; + flags += flagsConfig; + } cmVisualStudioGeneratorOptions linkOptions(this->LocalGenerator, 10, cmVisualStudioGeneratorOptions::Linker, diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 989db71a0..64b236147 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -77,6 +77,10 @@ private: void WriteGroupSources(const char* name, std::vector const& sources, std::vector& ); + void AddMissingSourceGroups(std::set& groupsUsed, + const std::vector& allGroups); + + private: typedef cmVisualStudioGeneratorOptions Options; typedef std::map OptionsMap; diff --git a/Source/cmWin32ProcessExecution.cxx b/Source/cmWin32ProcessExecution.cxx index c8b4ae4d4..d9bd26c00 100644 --- a/Source/cmWin32ProcessExecution.cxx +++ b/Source/cmWin32ProcessExecution.cxx @@ -22,7 +22,8 @@ #if defined(__BORLANDC__) # define STRICMP stricmp # define TO_INTPTR(x) ((long)(x)) -#else // Visual studio +#endif // Borland +#if defined(_MSC_VER) // Visual studio # if ( _MSC_VER >= 1300 ) # include # define TO_INTPTR(x) ((intptr_t)(x)) @@ -30,7 +31,12 @@ # define TO_INTPTR(x) ((long)(x)) # endif // Visual studio .NET # define STRICMP _stricmp -#endif // Borland +#endif // Visual Studio +#if defined(__MINGW32__) +# include +# define TO_INTPTR(x) ((intptr_t)(x)) +# define STRICMP _stricmp +#endif // MinGW #define POPEN_1 1 #define POPEN_2 2 diff --git a/Source/cmWriteFileCommand.cxx b/Source/cmWriteFileCommand.cxx index f46b87fed..b2acb2bc1 100644 --- a/Source/cmWriteFileCommand.cxx +++ b/Source/cmWriteFileCommand.cxx @@ -54,24 +54,18 @@ bool cmWriteFileCommand std::string dir = cmSystemTools::GetFilenamePath(fileName); cmSystemTools::MakeDirectory(dir.c_str()); - mode_t mode = -#if defined( _MSC_VER ) || defined( __MINGW32__ ) - S_IREAD | S_IWRITE -#elif defined( __BORLANDC__ ) - S_IRUSR | S_IWUSR -#else - 0666 -#endif - ; + mode_t mode = 0; // Set permissions to writable if ( cmSystemTools::GetPermissions(fileName.c_str(), mode) ) { cmSystemTools::SetPermissions(fileName.c_str(), #if defined( _MSC_VER ) || defined( __MINGW32__ ) - S_IREAD | S_IWRITE + mode | S_IWRITE +#elif defined( __BORLANDC__ ) + mode | S_IWUSR #else - 0666 + mode | S_IWUSR | S_IWGRP #endif ); } @@ -89,7 +83,10 @@ bool cmWriteFileCommand } file << message << std::endl; file.close(); - cmSystemTools::SetPermissions(fileName.c_str(), mode); + if(mode) + { + cmSystemTools::SetPermissions(fileName.c_str(), mode); + } return true; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index ef1febb37..cb2006902 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -162,16 +162,6 @@ cmake::cmake() } #endif - // If MAKEFLAGS are given in the environment, remove the environment - // variable. This will prevent try-compile from succeeding when it - // should fail (if "-i" is an option). We cannot simply test - // whether "-i" is given and remove it because some make programs - // encode the MAKEFLAGS variable in a strange way. - if(getenv("MAKEFLAGS")) - { - cmSystemTools::PutEnv("MAKEFLAGS="); - } - this->Verbose = false; this->InTryCompile = false; this->CacheManager = new cmCacheManager(this); @@ -970,8 +960,9 @@ void CMakeCommandUsage(const char* program) << " remove_directory dir - remove a directory and its contents\n" << " remove [-f] file1 file2 ... - remove the file(s), use -f to force " "it\n" - << " tar [cxt][vfz] file.tar file/dir1 file/dir2 ... - create a tar " - "archive\n" + << " tar [cxt][vfz][cvfj] file.tar " + "file/dir1 file/dir2 ... - create a tar " + "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" @@ -1543,7 +1534,12 @@ int cmake::ExecuteCMakeCommand(std::vector& args) 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; @@ -1555,7 +1551,7 @@ int cmake::ExecuteCMakeCommand(std::vector& args) if ( flags.find_first_of('t') != flags.npos ) { - if ( !cmSystemTools::ListTar(outFile.c_str(), files, gzip, verbose) ) + if ( !cmSystemTools::ListTar(outFile.c_str(), gzip, verbose) ) { cmSystemTools::Error("Problem creating tar: ", outFile.c_str()); return 1; @@ -1564,7 +1560,7 @@ int cmake::ExecuteCMakeCommand(std::vector& args) else if ( flags.find_first_of('c') != flags.npos ) { if ( !cmSystemTools::CreateTar( - outFile.c_str(), files, gzip, verbose) ) + outFile.c_str(), files, gzip, bzip2, verbose) ) { cmSystemTools::Error("Problem creating tar: ", outFile.c_str()); return 1; @@ -1573,7 +1569,7 @@ int cmake::ExecuteCMakeCommand(std::vector& args) else if ( flags.find_first_of('x') != flags.npos ) { if ( !cmSystemTools::ExtractTar( - outFile.c_str(), files, gzip, verbose) ) + outFile.c_str(), gzip, verbose) ) { cmSystemTools::Error("Problem extracting tar: ", outFile.c_str()); return 1; @@ -2225,6 +2221,16 @@ int cmake::Run(const std::vector& args, bool noconfigure) } } + // If MAKEFLAGS are given in the environment, remove the environment + // variable. This will prevent try-compile from succeeding when it + // should fail (if "-i" is an option). We cannot simply test + // whether "-i" is given and remove it because some make programs + // encode the MAKEFLAGS variable in a strange way. + if(getenv("MAKEFLAGS")) + { + cmSystemTools::PutEnv("MAKEFLAGS="); + } + this->PreLoadCMakeFiles(); std::string systemFile = this->GetHomeOutputDirectory(); @@ -3900,6 +3906,9 @@ static bool cmakeCheckStampFile(const char* stampName) // build system is really out of date. std::cout << "CMake is re-running because " << stampName << " is out-of-date.\n"; + std::cout << " the file '" << dep << "'\n"; + std::cout << " is newer than '" << stampDepends << "'\n"; + std::cout << " result='" << result << "'\n"; return false; } } diff --git a/Source/ctest.cxx b/Source/ctest.cxx index c9b875dcb..24921c428 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -218,6 +218,10 @@ static const char * cmDocumentationOptions[][3] = {"--timeout ", "Set a global timeout on all tests.", "This option will set a global timeout on all tests that do not already " "have a timeout set on them."}, + {"--stop-time