diff options
109 files changed, 2584 insertions, 640 deletions
diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake index 613bb9f..692befa 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 4cd11c4..bd90163 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -271,6 +271,7 @@ MACRO (CMAKE_BUILD_UTILITIES) 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) @@ -337,20 +338,38 @@ ENDMACRO (CMAKE_BUILD_UTILITIES) #----------------------------------------------------------------------- # The CMake version number. SET(CMake_VERSION_MAJOR 2) -SET(CMake_VERSION_MINOR 9) -SET(CMake_VERSION_PATCH 0) - -# 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_MINOR 8) +SET(CMake_VERSION_PATCH 1) +#SET(CMake_VERSION_TWEAK 0) +#SET(CMake_VERSION_RC 1) + +# 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() @@ -370,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}") diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index f316852..d5789ed 100644 --- a/CTestCustom.cmake.in +++ b/CTestCustom.cmake.in @@ -31,12 +31,15 @@ SET(CTEST_CUSTOM_WARNING_EXCEPTION "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/Release.*does not exist.*" + "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 new file mode 100644 index 0000000..b935860 --- /dev/null +++ b/ChangeLog.manual @@ -0,0 +1,399 @@ +Changes since CMake 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 + +Changes in CMake 2.8.1 RC 5 +- Fix FindQt4 to work with OpenGL on the mac +- Add .git .bzr and .hg to the list of default CPack ignore directories. + +Changes in CMake 2.8.1 RC 4 +- CTest: Do not hide test GUI windows (fixes 2.8.0 regression) +- Documentation: Clarify CMAKE_MODULE_PATH variable +- FindQt4: Add support for QtDeclartive module +- FortranCInterface: Fix PathScale detection +- Suppress GNU flag -fPIC on Windows (fixes 2.8.1-rc1 regression) + +Changes in CMake 2.8.1 RC 3 +- Add CMAKE_XCODE_ATTRIBUTE_<attr> interface to set compiler (#9125) +- Fix Eclipse files for targets in subdirectories (#9978) +- Fix custom command rule hashes to avoid extra rebuilds +- Print non-make generator name in initial compiler test + +Changes in CMake 2.8.1 RC 2 +- CPack: Avoid deleting long PATH values with NSIS (#10257) +- CTest: Fix and test cost-based test scheduler +- CTest: Fix and test git updates for case of out-dated index +- CTest: Fix regression caused by fix for (#2336) in rc1 +- CTest: Setup command-line dashboard support with Git +- FindCUDA: Improve docs, use -rpath on Apple, fix dependency scanning +- Fix OS X deployment-target and sysroot defaults (#9959,#9898,#10155) +- Recognize the Compaq Fortran compiler + +Changes in CMake 2.8.1 RC 1 +- Add "NMake Makefiles JOM" generator +- Add PathScale compiler support +- Add per-configuration OUTPUT_DIRECTORY properties +- Add per-target OSX_ARCHITECTURES property +- check_type_size(): Handle mixed-size universal binaries +- CPack: Document Mac generators +- CPack: Improve RPM spec files +- Create CMAKE_FORCE_Fortran_COMPILER for cross-compiling +- CTest: Add --http1.0 command-line option +- CTest: Add --timeout command-line option +- CTest: Do not munge UTF-8 output in XML files +- CTest: Document CTEST_USE_LAUNCHERS option +- CTest: Fix killing of whole test process trees +- CTest: Handle failure of running invalid executables +- CTest: Honor the -C arg to ctest (#2336) +- CTest: Improve host system introspection +- CTest: Optionally randomize test order (--schedule-random) +- CTest: Skip tests with unsatisfied REQUIRED_FILES test property +- CTest: Submit arbitrary results with ATTACHED_FILES test property +- ctest_build(): Enhance signature +- ctest_start(): Add APPEND option +- ctest_start(): Move CTEST_CHECKOUT_COMMAND from ctest_update +- ctest_update(): Submit global tree revision in Update.xml +- Cygwin: Do not export all symbols from DLLs (#10122) +- Cygwin: Name DLLs with SOVERSION, not VERSION (#10122) +- Detect 32/64-bit Windows with Intel compiler +- Eclipse generator enhancements +- ExternalProject: Add TIMEOUT parameter +- FindCUDA: Respect CUDA version differences +- FindCURL: Find import libraries on Windows +- FindDCMTK: Look in more places +- FindGTest: Handle spaces better (#10065) +- FindGTK2: Look in fink locations on Mac OS X +- FindHDF5: Follow find-module API conventions +- FindJava: Support for versioned find +- FindJNI: Honor find_package() REQUIRED and QUIET options +- FindMPI: Improve Windows support +- FindOpenSSL: Fix MinGW support +- FindPythonLibs: Look in config for static library +- FindQt4: Misc enhancements, sync with KDE vesion +- FindRuby: Fix version convention on Windows +- FindX11: Improve documentation +- Fortran: Detect address size (#10119) +- FortranCInterface: Honor user flags +- Improve VS 2010 beta2 support +- link_directories(): Treat relative paths consistently (CMP0015) +- Modernize FindLibXslt and FindLibXml.cmake +- Refactor platform info to simplify adding new compilers +- Support cross-compiling versioned DLLs +- UseQt4: Provide dependencies only for static Qt (#10021) +- Address issues: + #2336, #3571, #5041, #7541, #8725, #9011, #9042, #9054, #9163, + #9171, #9450, #9697, #9764, #9782, #9792, #9862, #9894, #9913, + #9916, #9917, #9918, #9949, #9965, #9970, #9982, #9985, #10003, + #10014, #10021, #10032, #10055, #10060, #10065, #10114, #10119, + #10122, #10126, #10136. + +Changes in CMake 2.8.0 Release +- CPack: Honor CPACK_NSIS_DISPLAY_NAME (fixes regression) + +Changes in CMake 2.8.0 RC 7 +- Partially sync FindQt4 with KDE version +- Improve implementation of fix for #9090 +- Fix CTest infinite loop when test executable could not be found +- Fix #9833: Document ctest --help-command +- FindCUDA: Fix -fPIC from being used on executable object files +- Fix #9654: %files section in spec file should not list directories +- Fix #9851: Better STRING(RANDOM) seeding +- Fix double bootstrap build for in source builds +- Fix CTest to use allowed value for valgrind --num-callers +- Remove non-language implicit link dependencies +- Implement LINK_FLAGS_<CONFIG> property on Xcode + +Changes in CMake 2.8.0 RC 6 +- Partially sync FindQt4 with KDE version +- Fix #9090: Teach CTest subdirs() command to handle absolute paths +- Fix CTest bug that could start a test twice + +Changes in CMake 2.8.0 RC 5 +- CTest now detects cycles in test dependency graph +- Warn on set(PARENT_SCOPE) at top scope +- Fix Xcode <= 2.0 projects with CMAKE_BUILD_TYPE +- Fix flags for Intel Fortran on Windows +- Fix #2199: UseSWIG documentation for swig_generated_file_fullname +- Fix #7915: UseSWIG interaction with JNI +- Fix #8971: FindOpenSSL now works on windows +- Fix #9124: CPackDeb documentation +- Fix #9722: cmake-gui reports error when not able to create build directory +- Fix #9767: Match more valgrind-reported leaks in CTest memcheck +- Fix #9777: Sync CMakeDetermineJavaCompiler paths with FindJava +- Fix #9793: FindJNI should find matching jni.h and jni_md.h +- Fix #9817: FindJNI on Solaris +- Fix FindHDF5 when hdf5.h exists without H5pubconf.h +- Fix FindZLIB to follow variable name conventions +- Fix invalid use of auto_ptr on array +- Mention temp var convention in Modules/readme.txt documentation + +Changes in CMake 2.8.0 RC 4 +- Fix try_compile when file cannot be found +- Add new module to test manifest installation issues on windows. +- Add more test coverage +-Improvements in finding MPI on windows. ENH: reorganized searching mpi for mpi components (include,lib,bin) using a single set of search paths instead of seperately mainted lists of paths for each. +- Look for nvcc in the 32 bit bin directory before the 64 bin directory. +- BUG: hardcore some values so output matches cmVS10CLFlagTable.h (addresses bug #9753) +- Avoid Intel linker crash in BuildDepends test +- Fix Intel Fortran SHARED libraries on Linux +- Fix working dir issue for ctest +- Fix if() command and CMP0012 OLD/NEW behavior +- Allow for /D to change install directory on the command line for NSIS +- Move SetErrorMode around calls to generate and configure instead of setting it for the whole application for cmake-gui on windows. Allows for bad installs of windows shell programs to not break file completion. +- Fix Intel and MinGW Fortran DLL import libraries +- Fix Xcode dylib version default +- Fix the showing of non-cpp files in the IDE for VS 10 +- Fix optionally-valued booleans in VS 10 flag table +- Detect and set Unicode character set in VS 10 +- Add support for the g95 Fortran compiler +- Test all target types in Fortran +- Add Xcode file association for Fortran +- Fix VS 10 flag table for precompiled headers +- Fix VS 10 .sln files for Windows Explorer +- Fix Microsoft.Cpp.$(Platform).user.props in VS10b2 +- Fix up file(DOWNLOAD ) a bit, better error checking and uses of long not double for timeout as curl needs, bug# 9748 +- Add a VS 10 Win64 generator +- Fix for bug#9686 convert java_home to a cmake path before using. +- fix for bug# 9751, add check for MSVC10 +- Fix for bugs #9756, #9690 and #9755, header files were not included, and link_directories we incorrect +- Add a module to test an install tree to verify that the MS CRT version is correct. +- Fix seg fault for empty ENV{} call bug #9747 +- Better fix for finding the MSBuild that matches the VS 10 install. +- make testing the CodeBlocks and Eclipse generators easier by not requiring the CMAKE_EDIT_COMMAND variable +- Do not link library dependencies in VS solutions +- Ctest was broken for subdirs. Restored working directory state for tests so that their executables could be found. +- Fixes version detection using osg/Version on Mac OSX when OSG is installed as a framework +- Avoid C++ linker language in VS Fortran project +- Avoid duplicate ZERO_CHECK in VS solutions +- Fixed bug 8319, search for the Python shared library in the standard locations. +- Fix bug#9714, should not crash when version file is not where it should be... +- Fix ctest output alignment for cases where total tests run is not the same width as max test index. +- make it more robust wrt. #9621 +- Add another possible error message that curl might emit with an empty drop location. +- Fix issue #5668 - use CollapseFullPath when determining if covered file is within source or binary tree. Allows gcc/gcov coverage analysis using MinGW on Windows. +- CTest-side support for compiler name and compiler version information. Requires CDash update to show on CDash. +- Add a bunch more testing coverage. + +Changes in CMake 2.8.0 RC 3 +- CTest Added OS Platform (cpu architecture) detection support to windows system +- Several minor FindBoost changes to address posts on mailing list +- Resolve #9685: Fix include dir to be correct path for gnutils +- Fix color check for dependency scanning +- Remove CMP00015 for now as it breaks more things than it fixes +- Reduce duration of ctest_sleep arguments. Add SmallAndFast project. Replace kwsys with SmallAndFast to make CTestTest faster. (I will keep an eye on coverage results after this commit and make sure we still have equivalent ctest coverage.) +- Do not use -fPIC to link executables +- Split Borland compiler information files +- Trimmed off the newline from sw_vers output on mac, it could cause xml parsing errors if left in +- Check for openssl-linked option with Qt 4.4+ before making ssl a dependency. +- Make Complex test of CMakeLib more optional +- Modernize FindVTK module +- Fix find_package() when <pkg>_DIR is wrong +- Do not collapse path of NOTFOUND values +- More robust implicit link line detection regex +- fix Xcode 30 generator +- Use the correct CMake (the freshly built one) to drive the CMakeWizardTest. +- Support more special characters in file(STRINGS) +- Log implicit link line detection regex +- speedup C dependency scanning even more +- Avoid non-root copies of root-only targets +- Added better OS information for Mac OS X +- Use work-around from bug 4772 for C++ and Fortran +- FortranCInterface: Mangling for Intel on Windows +- cmake-gui don't allow consecutive generates without a configure. +- Fix Preprocess test for Intel on Windows +- Teach intel compiler on windows to place .lib files and .pdb files. +- CPack: Fix bash-isms in launch script +- BUG: #0009648 Change "The following tests FAILED" message to print on stdout rather than stderr +- Avoid (Unix|Windows)Paths.cmake multiple include +- When getting include dirs for moc, also watch for framework includes and use -F instead of -I. +- Find locally installed software first +- Add '#!/bin/sh' to cygwin-package.sh +- Fix permsissions of installed SquishRunTestCase.sh +- Fix module docs to be manpage (groff) friendly +- Support GNU/kFreeBSD +- Remove old Encoding field from CMake.desktop +- FindQt3: Prefer (moc|uic)-qt3 names over (moc|uic) +- Match width of ctest "Start xx: " line to line up with the end test line +- Remove old license from FindPkgConfig.cmake module +- Test target link information invalidation +- Invalidate target link info when necessary +- Use new style header generation and get rid of OBJECT_DEPENDS in tutorial +- Fix issue #8649 - move the location of CPACK_NSIS_EXTRA_INSTALL_COMMANDS so that it is not excluded from execution when 'Do not create shortcuts' is checked. +- add the additional features for the dbus macros from KDE's FindQt4.cmake +fc9f7a5 Fix warnings in CMake source code. +- Correct some typos in error messages in the string command. Add a test that covers more of the code implemented in cmStringCommand.cxx, especially the error handlers. +- Create INTERPROCEDURAL_OPTIMIZATION build feature +- Document CMAKE_CURRENT_LIST_FILE more precisely +- Fix the documentation to say what it really does. Bug #9638 +- document how the minimum version can be specified +- Fix warnings in CMake source code. Suppress rampant warnings emanating from Qt files. +- Add documentation for Cocoa flag and move Motif under X11 flag. + +Changes in CMake 2.8.0 RC 2 +- Fix FindQt4 so that QtHelp depends on QtNetwork +- Add missing copyright notice to CMake.cmake module +- Add alternative _UTILITY targets to all VS solutions +- FindGTest.cmake some bugfixes, also added public function for closer integration btwn GoogleTest & CTest, contributed by Dan Blezek. +- Eliminate ExternalProject's use of CMAKE_CFG_INTDIR subdir for Makefile generators. It was causing problems with parallel make -j invocations. Keep it for multi-configuration build systems so that Debug and Release stamp files remain separate. +- Fix for bug #9611, some more paths for OpenJDK. +- Fix get_filename_component() registry view with wow64 +- Fix warnings in CMake source code. +- Fix module definition file reference for VS6 NMake +- Fix for bug #9611 do not hard code archs for search paths of java, look at the machine type. +- Fix bug#9619 add a link to module maintainers page in readme.txt for Modules +- Add cmake-help-command function to emacs-mode +- Add initial XL C compiler flags for safer builds +- Split XL compiler information files +- Fix default install prefix on Haiku +- Fix use of module .def files for MS tools +- Add StringProperty options includeing /def: for VS 10 flag table +- Convert copyright to OSI BSD and clean up licenses +- ENH: Added ctest test coverage for a test timeout +- CTest honors test timeouts again. +- Remove ctest_submit from CTestTestParallel +- Fix shared library creation flag for XL on Linux +- Fix BUG: 0009612: --output-on-failure option doesn't work with + the new parallel CTest handler +- Removed support for cutil library and header file. +- Fixed CUDA_PROPAGATE_HOST_FLAGS, added path for Mac SDK. +- Make sure LINK_FLAGS are seen by generator, fix for part of bug#9613 +- Fix issue #9412 - remove RPATH from files copied by + BundleUtilities.cmake on Linux. Thank +- Fix support for OLD behavior of policy CMP0002 +- Fix issue #8818 - escape quotes in the license file when using the + DragNDrop cpack genera +- Fix .vfproj file version for Intel Fortran 10.1 +- Use BeAPI for per-user package registry on Haiku +- Correct comments and use ASM${ASM_DIALECT} env. var instead of ASM + env. var to initialize +- Fix bug #9529. +- Fix Windows GUI implib and image version in VS 6 +- Convert newlines from CRLF to LF +- Oops. Last commit did not create subdir before doing a touch on a + file in it. So it fails of a type that is expected to have a + location... +- Policies 14 and 15 will be first released in 2.8.0 +- Document full version number with policy default +- Simplify bootstrap script source dir detection +- Documentation fixes, new CUDA_PROPAGATE_HOST_FLAGS, changed output + directory. + +Changes in CMake 2.8.0 RC 1 + +- Qt based GUI cmake-gui is now the default GUI, MFC CMakeSetup is no + longer included in CMake. ccmake is still supported. +- cmake-gui supports multi-state values options. +- CMake now has cmake --build command that can build any CMake generated + project from the command line. +- Visual Studio 2010 beta support has been added. +- KDevelop generator now has color output for builds. +- CTest supports running tests in parallel with a -j N option. +- A new CTest CTEST_USE_LAUNCHERS option can be used to get better + dashboard error reports with make based tools. +- CTest has support for sub-projects and labels which can interact + with CDash. +- CTest now supports Git, Mercurial, and Bazaar. +- It is now possible to use DESTDIR in CPack for any CMake based projects + giving more flexibility on the final path names. +- The CPack Deb generator now computes the arch instead of hard coding it. +- Fortran/C mixed language projects made much easier. CMake now + automatically can compute the run time libraries for a compiler. In + addition, a new FortranCInterface module can determine the correct + name mangling needed to mix C and Fortran. +- Intel compiler support added to OSX, and support for embedded + manifests in the windows intel compiler was added. +- Depend scanning is now much faster with makefiles. +- Many FindQt4 improvements to stay working with current Qt releases +- FindMPI has improvements for windows. +- FindBoost has been updated to work with the most recent boost releases. +- New External Project Module. The 'ExternalProject_Add' function + creates a custom target to drive download, update/patch, configure, + build, install and test steps of an external project. +- xmlrpc dependancy has been removed +- CMAKE_OSX_DEPLOYMENT_TARGET cache variable has been created to set the + deployment OS for a build on OSX. +- Several new policies were added: + CMP0012 + The if() command can recognize named boolean constants. + CMP0013 + Duplicate binary directories are not allowed. + CMP0014 + Input directories must have CMakeLists.txt. + CMP0015 + The set() CACHE mode and option() command make the cache value + visible. +- Lots of bug fixes. diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in index 5d004c7..accda32 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 00ab8e2..4a32823 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/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake new file mode 100644 index 0000000..f7baf68 --- /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 0000000..d3c403a --- /dev/null +++ b/Modules/Compiler/Clang-CXX.cmake @@ -0,0 +1 @@ +include(Compiler/GNU-CXX) diff --git a/Modules/DartConfiguration.tcl.in b/Modules/DartConfiguration.tcl.in index 85b4138..51f514f 100644 --- a/Modules/DartConfiguration.tcl.in +++ b/Modules/DartConfiguration.tcl.in @@ -49,6 +49,7 @@ SVNUpdateOptions: @SVN_UPDATE_OPTIONS@ # Git options GITCommand: @GITCOMMAND@ GITUpdateOptions: @GIT_UPDATE_OPTIONS@ +GITUpdateCustom: @CTEST_GIT_UPDATE_CUSTOM@ # Generic update command UpdateCommand: @UPDATE_COMMAND@ diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 0302d5c..d0845e6 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/FindGit.cmake b/Modules/FindGit.cmake new file mode 100644 index 0000000..2d82142 --- /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/FindQt4.cmake b/Modules/FindQt4.cmake index f2de4c9..654879e 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 diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index 459129b..2a74304 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/FindZLIB.cmake b/Modules/FindZLIB.cmake index 499ae77..b437e6b 100644 --- a/Modules/FindZLIB.cmake +++ b/Modules/FindZLIB.cmake @@ -36,7 +36,7 @@ FIND_LIBRARY(ZLIB_LIBRARY ) MARK_AS_ADVANCED(ZLIB_LIBRARY ZLIB_INCLUDE_DIR) -IF (ZLIB_INCLUDE_DIR) +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() diff --git a/Modules/Platform/CYGWIN-GNU.cmake b/Modules/Platform/CYGWIN-GNU.cmake index 6a80f62..24bb92a 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/Linux-Clang-C.cmake b/Modules/Platform/Linux-Clang-C.cmake new file mode 100644 index 0000000..dbf8956 --- /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 0000000..8fe251c --- /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 5490473..8ee9658 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 652bed4..076410a 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/Windows-GNU-Fortran.cmake b/Modules/Platform/Windows-GNU-Fortran.cmake index c66feed..8273a19 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 6d84940..af03841 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-wcl386.cmake b/Modules/Platform/Windows-wcl386.cmake index b260489..7fc345f 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 '<TARGET_UNQUOTED>' option caseexact file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") + "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name '<TARGET_UNQUOTED>' <LINK_FLAGS> option caseexact file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") SET(CMAKE_CXX_LINK_EXECUTABLE ${CMAKE_C_LINK_EXECUTABLE}) @@ -52,7 +52,7 @@ SET(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -dWIN32 -d+ <DEFINES> -fo<PREPROCESSED_SOURCE> -pl -cc++ <SOURCE>${CMAKE_END_TEMP_FILE}") SET(CMAKE_CXX_CREATE_SHARED_MODULE - "wlink ${CMAKE_START_TEMP_FILE} system nt_dll ${CMAKE_WLINK_QUIET} name '<TARGET_UNQUOTED>' option caseexact file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") + "wlink ${CMAKE_START_TEMP_FILE} system nt_dll ${CMAKE_WLINK_QUIET} name '<TARGET_UNQUOTED>' <LINK_FLAGS> option caseexact file {<OBJECTS>} <LINK_LIBRARIES> ${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 '<TARGET_UNQUOTED>' <OBJECTS> ") +SET(CMAKE_CXX_CREATE_STATIC_LIBRARY "wlib ${CMAKE_LIB_QUIET} -n -b '<TARGET_UNQUOTED>' <LINK_FLAGS> <OBJECTS> ") # 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 ccbc828..1d77c7a 100644 --- a/Modules/Qt4ConfigDependentSettings.cmake +++ b/Modules/Qt4ConfigDependentSettings.cmake @@ -301,8 +301,11 @@ IF(Q_WS_X11) # X11 libraries Qt always depends on SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${X11_Xext_LIB} ${X11_X11_LIB}) - QT_QUERY_QMAKE(QT_LIBS_THREAD "QMAKE_LIBS_THREAD") - SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${QT_LIBS_THREAD}) + 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}) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 49cbda7..dbbb558 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 @@ -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 @@ -502,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 0000000..05e265c --- /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/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 6224b40..4a4b428 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/CTest/cmCTestBuildCommand.h b/Source/CTest/cmCTestBuildCommand.h index 228067e..9eb4907 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/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index da5aed0..55a5225 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" @@ -126,20 +127,6 @@ private: //---------------------------------------------------------------------- -//********************************************************************** -class cmCTestCoverageHandlerContainer -{ -public: - int Error; - std::string SourceDir; - std::string BinaryDir; - typedef std::vector<int> SingleFileCoverageVector; - typedef std::map<std::string, SingleFileCoverageVector> TotalCoverageMap; - TotalCoverageMap TotalCoverage; - std::ostream* OFS; -}; -//********************************************************************** -//---------------------------------------------------------------------- //---------------------------------------------------------------------- cmCTestCoverageHandler::cmCTestCoverageHandler() @@ -395,6 +382,11 @@ int cmCTestCoverageHandler::ProcessHandler() { return error; } + file_count += this->HandlePHPCoverage(&cont); + if ( file_count < 0 ) + { + return error; + } error = cont.Error; std::set<std::string> uncovered = this->FindUncoveredFiles(&cont); @@ -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; @@ -748,6 +740,18 @@ bool IsFileInDir(const std::string &infile, const std::string &indir) } //---------------------------------------------------------------------- +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<int>(cont->TotalCoverage.size()); +} +//---------------------------------------------------------------------- int cmCTestCoverageHandler::HandleGCovCoverage( cmCTestCoverageHandlerContainer* cont) { @@ -2034,8 +2038,12 @@ std::set<std::string> cmCTestCoverageHandler::FindUncoveredFiles( for(std::vector<std::string>::iterator f = files.begin(); f != files.end(); ++f) { - extraMatches.insert(this->CTest->GetShortPathToFile( - f->c_str())); + if(this->ShouldIDoCoverage(f->c_str(), + cont->SourceDir.c_str(), cont->BinaryDir.c_str())) + { + extraMatches.insert(this->CTest->GetShortPathToFile( + f->c_str())); + } } } diff --git a/Source/CTest/cmCTestCoverageHandler.h b/Source/CTest/cmCTestCoverageHandler.h index f0564e8..d3e8503 100644 --- a/Source/CTest/cmCTestCoverageHandler.h +++ b/Source/CTest/cmCTestCoverageHandler.h @@ -20,8 +20,17 @@ #include <cmsys/RegularExpression.hxx> class cmGeneratedFileStream; -class cmCTestCoverageHandlerContainer; - +class cmCTestCoverageHandlerContainer +{ +public: + int Error; + std::string SourceDir; + std::string BinaryDir; + typedef std::vector<int> SingleFileCoverageVector; + typedef std::map<std::string, SingleFileCoverageVector> 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<std::string>& files); + //! Handle coverage using xdebug php coverage + int HandlePHPCoverage(cmCTestCoverageHandlerContainer* cont); + //! Handle coverage using Bullseye int HandleBullseyeCoverage(cmCTestCoverageHandlerContainer* cont); int RunBullseyeSourceSummary(cmCTestCoverageHandlerContainer* cont); @@ -94,54 +106,10 @@ private: std::set<std::string> FindUncoveredFiles( cmCTestCoverageHandlerContainer* cont); - - 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<int> Lines; - bool Show; - }; - std::vector<cmStdString> CustomCoverageExclude; std::vector<cmsys::RegularExpression> CustomCoverageExcludeRegex; std::vector<cmStdString> ExtraCoverageGlobs; - typedef std::map<std::string, cmCTestCoverage> CoverageMap; // Map from source file to label ids. class LabelSet: public std::set<int> {}; diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index 156a938..6c3631c 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -85,16 +85,14 @@ void cmCTestGIT::NoteNewRevision() } //---------------------------------------------------------------------------- -bool cmCTestGIT::UpdateImpl() +bool cmCTestGIT::UpdateByFetchAndReset() { const char* git = this->CommandLineTool.c_str(); - // Use "git pull" to update the working tree. - std::vector<char const*> git_pull; - git_pull.push_back(git); - git_pull.push_back("pull"); - - // TODO: if(this->CTest->GetTestModel() == cmCTest::NIGHTLY) + // Use "git fetch" to get remote commits. + std::vector<char const*> git_fetch; + git_fetch.push_back(git); + git_fetch.push_back("fetch"); // Add user-specified update options. std::string opts = this->CTest->GetCTestConfiguration("UpdateOptions"); @@ -106,22 +104,88 @@ bool cmCTestGIT::UpdateImpl() for(std::vector<cmStdString>::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; + } + + // 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); + } + } + } + } - OutputLogger out(this->Log, "pull-out> "); - OutputLogger err(this->Log, "pull-err> "); - if(this->RunUpdateCommand(&git_pull[0], &out, &err)) + // 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<std::string> git_custom_command; + cmSystemTools::ExpandListArgument(custom, git_custom_command, true); + std::vector<char const*> git_custom; + for(std::vector<std::string>::const_iterator + i = git_custom_command.begin(); i != git_custom_command.end(); ++i) { - char const* git_submodule[] = {git, "submodule", "update", 0}; - OutputLogger out2(this->Log, "submodule-out> "); - OutputLogger err2(this->Log, "submodule-err> "); - return this->RunChild(git_submodule, &out, &err); + git_custom.push_back(i->c_str()); } - return false; + 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); } //---------------------------------------------------------------------------- diff --git a/Source/CTest/cmCTestGIT.h b/Source/CTest/cmCTestGIT.h index 0b6ad2e..d8681fe 100644 --- a/Source/CTest/cmCTestGIT.h +++ b/Source/CTest/cmCTestGIT.h @@ -32,6 +32,10 @@ private: virtual void NoteNewRevision(); virtual bool UpdateImpl(); + bool UpdateByFetchAndReset(); + bool UpdateByCustom(std::string const& custom); + bool UpdateInternal(); + void LoadRevisions(); void LoadModifications(); diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index c1ca9ea..9b8cef5 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -23,6 +23,7 @@ cmCTestMultiProcessHandler::cmCTestMultiProcessHandler() this->ParallelLevel = 1; this->Completed = 0; this->RunningCount = 0; + this->StopTimePassed = false; } cmCTestMultiProcessHandler::~cmCTestMultiProcessHandler() @@ -69,6 +70,10 @@ void cmCTestMultiProcessHandler::RunTests() this->StartNextTests(); while(this->Tests.size() != 0) { + if(this->StopTimePassed) + { + return; + } this->CheckOutput(); this->StartNextTests(); } @@ -102,6 +107,12 @@ void cmCTestMultiProcessHandler::StartTestProcess(int test) { this->RunningTests.insert(testRun); } + else if(testRun->IsStopTimePassed()) + { + this->StopTimePassed = true; + delete testRun; + return; + } else { this->UnlockResources(test); @@ -251,6 +262,10 @@ void cmCTestMultiProcessHandler::StartNextTests() } if(this->StartTest(*test)) { + if(this->StopTimePassed) + { + return; + } numToStart -= processors; this->RunningCount += processors; } @@ -453,15 +468,24 @@ void cmCTestMultiProcessHandler::CreateTestCostList() for(TestMap::iterator i = this->Tests.begin(); i != this->Tests.end(); ++i) { - std::string name = this->Properties[i->first]->Name; - if(std::find(this->LastTestsFailed.begin(), this->LastTestsFailed.end(), - name) != this->LastTestsFailed.end()) + //We only want to schedule them by cost in a parallel situation + if(this->ParallelLevel > 1) { - this->TestCosts[FLT_MAX].insert(i->first); + 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 + else //we ignore their cost { - this->TestCosts[this->Properties[i->first]->Cost].insert(i->first); + this->TestCosts[this->Tests.size() + - this->Properties[i->first]->Index].insert(i->first); } } } diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h index d4f6c71..4f51b0b 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.h +++ b/Source/CTest/cmCTestMultiProcessHandler.h @@ -94,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<int, bool> TestRunningMap; diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 4c9675b..9fb8827 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -32,6 +32,7 @@ cmCTestRunTest::cmCTestRunTest(cmCTestTestHandler* handler) this->ProcessOutput = ""; this->CompressedOutput = ""; this->CompressionRatio = 2; + this->StopTimePassed = false; } cmCTestRunTest::~cmCTestRunTest() @@ -436,8 +437,13 @@ bool cmCTestRunTest::StartTest(size_t total) } this->StartTime = this->CTest->CurrentTime(); - return this->ForkProcess(this->ResolveTimeout(), - &this->TestProperties->Environment); + double timeout = this->ResolveTimeout(); + + if(this->StopTimePassed) + { + return false; + } + return this->ForkProcess(timeout, &this->TestProperties->Environment); } //---------------------------------------------------------------------- @@ -569,8 +575,9 @@ double cmCTestRunTest::ResolveTimeout() if(stop_timeout <= 0 || stop_timeout > this->CTest->LastStopTimeout) { cmCTestLog(this->CTest, ERROR_MESSAGE, "The stop time has been passed. " - "Exiting ctest." << std::endl); - exit(-1); + "Stopping all tests." << std::endl); + this->StopTimePassed = true; + return 0; } return timeout == 0 ? stop_timeout : (timeout < stop_timeout ? timeout : stop_timeout); diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h index d7d3a2f..e0cb888 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; } @@ -90,6 +92,7 @@ private: std::string TestCommand; std::string ActualCommand; std::vector<std::string> Arguments; + bool StopTimePassed; }; inline int getNumWidth(size_t n) diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index b9cee6c..d2742ec 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1036,9 +1036,9 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &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) diff --git a/Source/CTest/cmCTestUpdateCommand.cxx b/Source/CTest/cmCTestUpdateCommand.cxx index 571745d..8414349 100644 --- a/Source/CTest/cmCTestUpdateCommand.cxx +++ b/Source/CTest/cmCTestUpdateCommand.cxx @@ -52,6 +52,8 @@ cmCTestGenericHandler* cmCTestUpdateCommand::InitializeHandler() 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, "HGUpdateOptions", "CTEST_HG_UPDATE_OPTIONS"); diff --git a/Source/CTest/cmParsePHPCoverage.cxx b/Source/CTest/cmParsePHPCoverage.cxx new file mode 100644 index 0000000..32c1ec1 --- /dev/null +++ b/Source/CTest/cmParsePHPCoverage.cxx @@ -0,0 +1,252 @@ +#include "cmStandardIncludes.h" +#include "cmSystemTools.h" +#include "cmParsePHPCoverage.h" +#include <cmsys/Directory.hxx> + +/* + 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<size_t>(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 0000000..ce5741d --- /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<int, int> FileLineCoverage; + std::map<cmStdString, FileLineCoverage> FileToCoverage; + std::map<int, int> FileCoverage; + cmCTestCoverageHandlerContainer& Coverage; + cmCTest* CTest; +}; + + +#endif diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index fc61709..28f4697 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -164,7 +164,7 @@ int main(int argc, char** argv) QStringList args = app.arguments(); if(args.count() == 2) { - cmsys_stl::string filePath = cmSystemTools::CollapseFullPath(".."); + 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 = diff --git a/Source/cmCMakeMinimumRequired.cxx b/Source/cmCMakeMinimumRequired.cxx index b7e939e..126934c 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 05c2505..9bf7ef8 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 ffd0f44..b326865 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/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx index 68b0d57..2ed959f 100644 --- a/Source/cmDocumentVariables.cxx +++ b/Source/cmDocumentVariables.cxx @@ -251,12 +251,22 @@ void cmDocumentVariables::DefineVariables(cmake* cm) " 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 @@ -1314,6 +1324,8 @@ void cmDocumentVariables::DefineVariables(cmake* cm) cmProperty::VARIABLE,0,0); cm->DefineProperty("CMAKE_<LANG>_LINK_FLAGS", cmProperty::VARIABLE,0,0); + cm->DefineProperty("CMAKE_<LANG>_RESPONSE_FILE_LINK_FLAG", + cmProperty::VARIABLE,0,0); cm->DefineProperty("CMAKE_<LANG>_STANDARD_LIBRARIES", cmProperty::VARIABLE,0,0); cm->DefineProperty("CMAKE_<LANG>_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/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 5611527..133c1a1 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -183,24 +183,18 @@ bool cmFileCommand::HandleWriteCommand(std::vector<std::string> 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<std::string> const& args, } file << message; file.close(); - cmSystemTools::SetPermissions(fileName.c_str(), mode); + if(mode) + { + cmSystemTools::SetPermissions(fileName.c_str(), mode); + } return true; } @@ -1507,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 @@ -1519,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; @@ -2443,7 +2447,8 @@ namespace{ fout->write(chPtr, realsize); return realsize; } - + + static size_t cmFileCommandCurlDebugCallback(CURL *, curl_infotype, char *chPtr, size_t size, void *data) @@ -2456,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<int>(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<cURLProgressHelper *>(clientp); + + static_cast<void>(ultotal); + static_cast<void>(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 @@ -2469,8 +2540,8 @@ namespace { cURLEasyGuard(CURL * easy) : Easy(easy) {} - - ~cURLEasyGuard(void) + + ~cURLEasyGuard(void) { if (this->Easy) { @@ -2491,6 +2562,7 @@ namespace { } #endif + bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) @@ -2508,9 +2580,13 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> ++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") @@ -2549,9 +2625,65 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> } 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())) @@ -2570,6 +2702,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> "file for write."); return false; } + ::CURL *curl; ::curl_global_init(CURL_GLOBAL_DEFAULT); curl = ::curl_easy_init(); @@ -2585,28 +2718,31 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> ::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; } @@ -2618,14 +2754,25 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> { 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; } @@ -2637,24 +2784,70 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> { 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<void*>(&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; @@ -2662,7 +2855,44 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> 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); @@ -2680,6 +2910,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> 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 c6da301..e771092 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(<COPY|INSTALL> files... DESTINATION <dir>\n" diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 0d6e389..537a88f 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/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index fd3508e..13d875f 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2249,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 4c2fc22..43bf1e7 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, diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index fce5a9c..004d19a 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 89bfd05..539816d 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()); } @@ -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 diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 2d8197c..136c177 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -915,7 +915,20 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, } fout << "\t\t\t<Tool\n" << "\t\t\t\tName=\"" << tool << "\"\n"; - if(const char* libflags = target.GetProperty("STATIC_LIBRARY_FLAGS")) + + std::string libflags; + if(const char* flags = target.GetProperty("STATIC_LIBRARY_FLAGS")) + { + libflags += flags; + } + std::string libFlagsConfig = "STATIC_LIBRARY_FLAGS_"; + libFlagsConfig += configTypeUpper; + if(const char* flagsConfig = target.GetProperty(libFlagsConfig.c_str())) + { + libflags += " "; + libflags += flagsConfig; + } + if(!libflags.empty()) { fout << "\t\t\t\tAdditionalOptions=\"" << libflags << "\"\n"; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index e3d230e..8eece6b 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2359,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()); diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index d3e6e11..dff91fe 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); } diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index ac727ac..d5d6585 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) @@ -1327,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 && @@ -1621,6 +1624,17 @@ cmMakefileTargetGenerator std::vector<std::string> 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) @@ -1638,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 2d41d40..69d3e51 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 <map> #include <set> #include <queue> @@ -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 aaa3ac0..23064dc 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 853e7ba..c477bb7 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 7182152..392f168 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/cmStandardIncludes.cxx b/Source/cmStandardIncludes.cxx new file mode 100644 index 0000000..a4bdb2e --- /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 9b9cb3b..e8decbb 100644 --- a/Source/cmStandardIncludes.h +++ b/Source/cmStandardIncludes.h @@ -241,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 d914203..5f7cfa3 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -2938,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 ed924dd..da5da31 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -436,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 54b1815..45ba358 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -708,6 +708,11 @@ void cmTarget::DefineProperties(cmake *cm) "Extra flags to use when linking a static library."); cm->DefineProperty + ("STATIC_LIBRARY_FLAGS_<CONFIG>", 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.", "A target property that can be set to override the suffix " diff --git a/Source/cmVersion.cxx b/Source/cmVersion.cxx index bde5f98..047d24d 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 f267ab6..e313524 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 ee6eca7..76bc8fe 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 412db6d..67f58ca 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 4a8e161..59e20d5 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("</Project>\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<cmSourceGroup*>& groupsUsed, + const std::vector<cmSourceGroup>& allGroups + ) +{ + for(std::vector<cmSourceGroup>::const_iterator current = allGroups.begin(); + current != allGroups.end(); ++current) + { + std::vector<cmSourceGroup> const& children = current->GetGroupChildren(); + if(children.empty()) + { + continue; // the group is really empty + } + + this->AddMissingSourceGroups(groupsUsed, children); + + cmSourceGroup* current_ptr = const_cast<cmSourceGroup*>(&(*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<cmSourceGroup>::const_iterator child_it = children.begin(); + while(child_it != children.end()) + { + cmSourceGroup* child_ptr = const_cast<cmSourceGroup*>(&(*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<cmSourceFile*> 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("<Lib>\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("</Lib>\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 989db71..64b2361 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -77,6 +77,10 @@ private: void WriteGroupSources(const char* name, std::vector<cmSourceFile*> const& sources, std::vector<cmSourceGroup>& ); + void AddMissingSourceGroups(std::set<cmSourceGroup*>& groupsUsed, + const std::vector<cmSourceGroup>& allGroups); + + private: typedef cmVisualStudioGeneratorOptions Options; typedef std::map<cmStdString, Options*> OptionsMap; diff --git a/Source/cmWriteFileCommand.cxx b/Source/cmWriteFileCommand.cxx index f46b87f..b2acb2b 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/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index 62042e8..f440ff9 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -309,6 +309,14 @@ IF(NOT KWSYS_IN_SOURCE_BUILD) ${PROJECT_BINARY_DIR}/kwsysPrivate.h COPY_ONLY IMMEDIATE) ENDIF(NOT KWSYS_IN_SOURCE_BUILD) +# Select plugin module file name convention. +IF(NOT KWSYS_DynamicLoader_PREFIX) + SET(KWSYS_DynamicLoader_PREFIX ${CMAKE_SHARED_MODULE_PREFIX}) +ENDIF() +IF(NOT KWSYS_DynamicLoader_SUFFIX) + SET(KWSYS_DynamicLoader_SUFFIX ${CMAKE_SHARED_MODULE_SUFFIX}) +ENDIF() + #----------------------------------------------------------------------------- # We require ANSI support from the C compiler. Add any needed flags. IF(CMAKE_ANSI_CFLAGS) diff --git a/Source/kwsys/DynamicLoader.cxx b/Source/kwsys/DynamicLoader.cxx index 58e02c7..c4ee095 100644 --- a/Source/kwsys/DynamicLoader.cxx +++ b/Source/kwsys/DynamicLoader.cxx @@ -69,19 +69,6 @@ DynamicLoader::GetSymbolAddress(DynamicLoader::LibraryHandle lib, const char* sy return *reinterpret_cast<DynamicLoader::SymbolPointer*>(&result); } -//---------------------------------------------------------------------------- -const char* DynamicLoader::LibPrefix() -{ - return "lib"; -} - -//---------------------------------------------------------------------------- -const char* DynamicLoader::LibExtension() -{ - return ".sl"; -} - -//---------------------------------------------------------------------------- const char* DynamicLoader::LastError() { // TODO: Need implementation with errno/strerror @@ -176,21 +163,6 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( } //---------------------------------------------------------------------------- -const char* DynamicLoader::LibPrefix() -{ - return "lib"; -} - -//---------------------------------------------------------------------------- -const char* DynamicLoader::LibExtension() -{ - // NSCreateObjectFileImageFromFile fail when dealing with dylib image - // it returns NSObjectFileImageInappropriateFile - //return ".dylib"; - return ".so"; -} - -//---------------------------------------------------------------------------- const char* DynamicLoader::LastError() { return 0; @@ -285,22 +257,6 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( } //---------------------------------------------------------------------------- -const char* DynamicLoader::LibPrefix() -{ -#ifdef __MINGW32__ - return "lib"; -#else - return ""; -#endif -} - -//---------------------------------------------------------------------------- -const char* DynamicLoader::LibExtension() -{ - return ".dll"; -} - -//---------------------------------------------------------------------------- const char* DynamicLoader::LastError() { LPVOID lpMsgBuf=NULL; @@ -418,18 +374,6 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( } //---------------------------------------------------------------------------- -const char* DynamicLoader::LibPrefix() -{ - return "lib"; -} - -//---------------------------------------------------------------------------- -const char* DynamicLoader::LibExtension() -{ - return ".so"; -} - -//---------------------------------------------------------------------------- const char* DynamicLoader::LastError() { const char *retval = strerror(last_dynamic_err); @@ -476,18 +420,6 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( } //---------------------------------------------------------------------------- -const char* DynamicLoader::LibPrefix() - { - return "lib"; - } - -//---------------------------------------------------------------------------- -const char* DynamicLoader::LibExtension() - { - return ".a"; - } - -//---------------------------------------------------------------------------- const char* DynamicLoader::LastError() { return "General error"; @@ -540,22 +472,6 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( } //---------------------------------------------------------------------------- -const char* DynamicLoader::LibPrefix() -{ - return "lib"; -} - -//---------------------------------------------------------------------------- -const char* DynamicLoader::LibExtension() -{ -#ifdef __CYGWIN__ - return ".dll"; -#else - return ".so"; -#endif -} - -//---------------------------------------------------------------------------- const char* DynamicLoader::LastError() { return dlerror(); diff --git a/Source/kwsys/DynamicLoader.hxx.in b/Source/kwsys/DynamicLoader.hxx.in index 325e956..64468ec 100644 --- a/Source/kwsys/DynamicLoader.hxx.in +++ b/Source/kwsys/DynamicLoader.hxx.in @@ -86,11 +86,11 @@ public: /** Find the address of the symbol in the given library. */ static SymbolPointer GetSymbolAddress(LibraryHandle, const char*); - /** Return the library prefix for the given architecture */ - static const char* LibPrefix(); + /** Return the default module prefix for the current platform. */ + static const char* LibPrefix() { return "@KWSYS_DynamicLoader_PREFIX@"; } - /** Return the library extension for the given architecture. */ - static const char* LibExtension(); + /** Return the default module suffix for the current platform. */ + static const char* LibExtension() { return "@KWSYS_DynamicLoader_SUFFIX@"; } /** Return the last error produced from a calls made on this class. */ static const char* LastError(); diff --git a/Source/kwsys/ProcessUNIX.c b/Source/kwsys/ProcessUNIX.c index 9cb787a..9c66a44 100644 --- a/Source/kwsys/ProcessUNIX.c +++ b/Source/kwsys/ProcessUNIX.c @@ -720,6 +720,14 @@ void kwsysProcess_Execute(kwsysProcess* cp) return; } + /* Make sure we have something to run. */ + if(cp->NumberOfCommands < 1) + { + strcpy(cp->ErrorMessage, "No command"); + cp->State = kwsysProcess_State_Error; + return; + } + /* Initialize the control structure for a new process. */ if(!kwsysProcessInitialize(cp)) { @@ -2377,6 +2385,9 @@ static pid_t kwsysProcessFork(kwsysProcess* cp, || defined(__OpenBSD__) || defined(__GLIBC__) || defined(__GNU__) # define KWSYSPE_PS_COMMAND "ps axo pid,ppid" # define KWSYSPE_PS_FORMAT "%d %d\n" +#elif defined(__sun) && (defined(__SVR4) || defined(__svr4__)) /* Solaris */ +# define KWSYSPE_PS_COMMAND "ps -e -o pid,ppid" +# define KWSYSPE_PS_FORMAT "%d %d\n" #elif defined(__hpux) || defined(__sun__) || defined(__sgi) || defined(_AIX) \ || defined(__sparc) # define KWSYSPE_PS_COMMAND "ps -ef" diff --git a/Source/kwsys/ProcessWin32.c b/Source/kwsys/ProcessWin32.c index c5ea6db..5aa4d8b 100644 --- a/Source/kwsys/ProcessWin32.c +++ b/Source/kwsys/ProcessWin32.c @@ -987,6 +987,14 @@ void kwsysProcess_Execute(kwsysProcess* cp) return; } + /* Make sure we have something to run. */ + if(cp->NumberOfCommands < 1) + { + strcpy(cp->ErrorMessage, "No command"); + cp->State = kwsysProcess_State_Error; + return; + } + /* Initialize the control structure for a new process. */ if(!kwsysProcessInitialize(cp)) { diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index afc7240..3153235 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -1722,8 +1722,7 @@ kwsys_stl::string SystemTools::ConvertToWindowsOutputPath(const char* path) } bool SystemTools::CopyFileIfDifferent(const char* source, - const char* destination, - bool copyPermissions) + const char* destination) { // special check for a destination that is a directory // FilesDiffer does not handle file to directory compare @@ -1736,8 +1735,7 @@ bool SystemTools::CopyFileIfDifferent(const char* source, new_destination += SystemTools::GetFilenameName(source_name); if(SystemTools::FilesDiffer(source, new_destination.c_str())) { - return SystemTools::CopyFileAlways(source, destination, - copyPermissions); + return SystemTools::CopyFileAlways(source, destination); } else { @@ -1750,7 +1748,7 @@ bool SystemTools::CopyFileIfDifferent(const char* source, // are different if(SystemTools::FilesDiffer(source, destination)) { - return SystemTools::CopyFileAlways(source, destination, copyPermissions); + return SystemTools::CopyFileAlways(source, destination); } // at this point the files must be the same so return true return true; @@ -1836,8 +1834,7 @@ bool SystemTools::FilesDiffer(const char* source, /** * Copy a file named by "source" to the file named by "destination". */ -bool SystemTools::CopyFileAlways(const char* source, const char* destination, - bool copyPermissions) +bool SystemTools::CopyFileAlways(const char* source, const char* destination) { // If files are the same do not copy if ( SystemTools::SameFile(source, destination) ) @@ -1924,23 +1921,11 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination, fin.close(); fout.close(); - // More checks. - struct stat statSource, statDestination; - statSource.st_size = 12345; - statDestination.st_size = 12345; - if(stat(source, &statSource) != 0) - { - return false; - } - else if(stat(destination, &statDestination) != 0) + if(!fout) { return false; } - else if(statSource.st_size != statDestination.st_size) - { - return false; - } - if ( copyPermissions && perms ) + if ( perms ) { if ( !SystemTools::SetPermissions(destination, perm) ) { @@ -1952,15 +1937,15 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination, //---------------------------------------------------------------------------- bool SystemTools::CopyAFile(const char* source, const char* destination, - bool always, bool copyPermissions) + bool always) { if(always) { - return SystemTools::CopyFileAlways(source, destination, copyPermissions); + return SystemTools::CopyFileAlways(source, destination); } else { - return SystemTools::CopyFileIfDifferent(source, destination, copyPermissions); + return SystemTools::CopyFileIfDifferent(source, destination); } } @@ -1969,7 +1954,7 @@ bool SystemTools::CopyAFile(const char* source, const char* destination, * "destination". */ bool SystemTools::CopyADirectory(const char* source, const char* destination, - bool always, bool copyPermissions) + bool always) { Directory dir; dir.Load(source); @@ -1993,16 +1978,14 @@ bool SystemTools::CopyADirectory(const char* source, const char* destination, fullDestPath += dir.GetFile(static_cast<unsigned long>(fileNum)); if (!SystemTools::CopyADirectory(fullPath.c_str(), fullDestPath.c_str(), - always, - copyPermissions)) + always)) { return false; } } else { - if(!SystemTools::CopyAFile(fullPath.c_str(), destination, always, - copyPermissions)) + if(!SystemTools::CopyAFile(fullPath.c_str(), destination, always)) { return false; } diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in index fd35742..ec70320 100644 --- a/Source/kwsys/SystemTools.hxx.in +++ b/Source/kwsys/SystemTools.hxx.in @@ -500,14 +500,10 @@ public: /** * Copy the source file to the destination file only - * if the two files differ. If the "copyPermissions" - * argument is true, the permissions of the copy are - * set to be the same as the permissions of the - * original. + * if the two files differ. */ static bool CopyFileIfDifferent(const char* source, - const char* destination, - bool copyPermissions = true); + const char* destination); /** * Compare the contents of two files. Return true if different @@ -520,22 +516,17 @@ public: static bool SameFile(const char* file1, const char* file2); /** - * Copy a file. If the "copyPermissions" argument is true, the - * permissions of the copy are set to be the same as the permissions - * of the original. + * Copy a file. */ - static bool CopyFileAlways(const char* source, const char* destination, - bool copyPermissions = true); + static bool CopyFileAlways(const char* source, const char* destination); /** * Copy a file. If the "always" argument is true the file is always * copied. If it is false, the file is copied only if it is new or - * has changed. If the "copyPermissions" argument is true, the - * permissions of the copy are set to be the same as the permissions - * of the original. + * has changed. */ static bool CopyAFile(const char* source, const char* destination, - bool always = true, bool copyPermissions = true); + bool always = true); /** * Copy content directory to another directory with all files and @@ -544,7 +535,7 @@ public: * are new are copied. */ static bool CopyADirectory(const char* source, const char* destination, - bool always = true, bool copyPermissions = true); + bool always = true); /** * Remove a file diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 8fd851f..200b4f8 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -15,7 +15,7 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) # KWSys version date month component. Format is MM. -SET(KWSYS_DATE_STAMP_MONTH 05) +SET(KWSYS_DATE_STAMP_MONTH 06) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 12) +SET(KWSYS_DATE_STAMP_DAY 22) diff --git a/Templates/staticLibHeader.dsptemplate b/Templates/staticLibHeader.dsptemplate index 1b5c8bc..16b784e 100644 --- a/Templates/staticLibHeader.dsptemplate +++ b/Templates/staticLibHeader.dsptemplate @@ -67,7 +67,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"OUTPUT_DIRECTORY_RELEASE/OUTPUT_NAME_RELEASE" CM_STATIC_LIB_ARGS
+# ADD LIB32 /nologo /out:"OUTPUT_DIRECTORY_RELEASE/OUTPUT_NAME_RELEASE" CM_STATIC_LIB_ARGS_RELEASE
CMAKE_CUSTOM_RULE_CODE_RELEASE
@@ -97,7 +97,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"OUTPUT_DIRECTORY_DEBUG/OUTPUT_NAME_DEBUG" CM_STATIC_LIB_ARGS
+# ADD LIB32 /nologo /out:"OUTPUT_DIRECTORY_DEBUG/OUTPUT_NAME_DEBUG" CM_STATIC_LIB_ARGS_DEBUG
CMAKE_CUSTOM_RULE_CODE_DEBUG
@@ -128,7 +128,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"OUTPUT_DIRECTORY_MINSIZEREL/OUTPUT_NAME_MINSIZEREL" CM_STATIC_LIB_ARGS
+# ADD LIB32 /nologo /out:"OUTPUT_DIRECTORY_MINSIZEREL/OUTPUT_NAME_MINSIZEREL" CM_STATIC_LIB_ARGS_MINSIZEREL
CMAKE_CUSTOM_RULE_CODE_MINSIZEREL
@@ -158,7 +158,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"OUTPUT_DIRECTORY_RELWITHDEBINFO/OUTPUT_NAME_RELWITHDEBINFO" CM_STATIC_LIB_ARGS
+# ADD LIB32 /nologo /out:"OUTPUT_DIRECTORY_RELWITHDEBINFO/OUTPUT_NAME_RELWITHDEBINFO" CM_STATIC_LIB_ARGS_RELWITHDEBINFO
CMAKE_CUSTOM_RULE_CODE_RELWITHDEBINFO
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 330cf9f..2c7056d 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -174,6 +174,34 @@ IF(BUILD_TESTING) ADD_TEST_MACRO(Module.CheckTypeSize CheckTypeSize) + ADD_TEST(LinkFlags-prepare + ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/LinkFlags" + "${CMake_BINARY_DIR}/Tests/LinkFlags" + --build-generator ${CMAKE_TEST_GENERATOR} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + --build-project LinkFlags + --build-target LinkFlags + --build-options -DTEST_CONFIG=\${CTEST_CONFIGURATION_TYPE} + ) + LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LinkFlags") + + MACRO(ADD_LINK_FLAGS_TEST name depends) + ADD_TEST(LinkFlags-${name} + ${CMAKE_CMAKE_COMMAND} --build "${CMake_BINARY_DIR}/Tests/LinkFlags" + --target LinkFlags_${name} --config \${CTEST_CONFIGURATION_TYPE} + ) + SET_TESTS_PROPERTIES(LinkFlags-${name} PROPERTIES + PASS_REGULAR_EXPRESSION "BADFLAG" DEPENDS LinkFlags-${depends}) + ENDMACRO() + ADD_LINK_FLAGS_TEST(lib prepare) + ADD_LINK_FLAGS_TEST(dll lib) + ADD_LINK_FLAGS_TEST(exe dll) + ADD_LINK_FLAGS_TEST(lib_config exe) + ADD_LINK_FLAGS_TEST(dll_config lib_config) + ADD_LINK_FLAGS_TEST(exe_config dll_config) + # If we are running right now with a UnixMakefiles based generator, # build the "Simple" test with the ExtraGenerators, if available # This doesn't test whether the generated project files work (unfortunately), @@ -270,7 +298,7 @@ IF(BUILD_TESTING) FILE(MAKE_DIRECTORY "${_TEST_DIR}") FILE(WRITE "${_TEST_DIR}/nightly-cmake.sh" "cd ${_TEST_DIR} -${CMake_BINARY_DIR}/bin/cmake -DCMAKE_CREATE_VERSION=master -P ${CMake_SOURCE_DIR}/Utilities/Release/${script} +${CMake_BINARY_DIR}/bin/cmake -DCMAKE_CREATE_VERSION=next -P ${CMake_SOURCE_DIR}/Utilities/Release/${script} ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/Release/upload_release.cmake ") ADD_TEST(${name} /bin/sh ${_TEST_DIR}/nightly-cmake.sh) @@ -1048,7 +1076,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ # Make sure CTest can handle a test with no newline in output. ADD_TEST(CTest.NoNewline - ${CMAKE_COMMAND} -E echo_append "This line has no newline!") + ${CMAKE_CMAKE_COMMAND} -E echo_append "This line has no newline!") # A simple test for ctest in script mode CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestScriptMode/CTestTestScriptMode.cmake.in" @@ -1442,13 +1470,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --output-log "${CMake_BINARY_DIR}/Tests/CTestTest2/testOutput.log" ) - CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestTest3/test.cmake.in" - "${CMake_BINARY_DIR}/Tests/CTestTest3/test.cmake" @ONLY ESCAPE_QUOTES) - ADD_TEST(CTestTest3 ${CMAKE_CTEST_COMMAND} - -S "${CMake_BINARY_DIR}/Tests/CTestTest3/test.cmake" -V - --output-log "${CMake_BINARY_DIR}/Tests/CTestTest3/testOutput.log" - ) - # these tests take a long time, make sure they have it # if timeouts have not already been set GET_TEST_PROPERTY(CTestTest TIMEOUT PREVIOUS_TIMEOUT) @@ -1462,12 +1483,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ SET_TESTS_PROPERTIES ( CTestTest2 PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT}) ENDIF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND) - - GET_TEST_PROPERTY(CTestTest3 TIMEOUT PREVIOUS_TIMEOUT) - IF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND) - SET_TESTS_PROPERTIES ( CTestTest3 - PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT}) - ENDIF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND) ENDIF (CTEST_TEST_CTEST AND CMAKE_RUN_LONG_TESTS AND CMAKE_TESTS_CDASH_SERVER) IF(NOT DEFINED CTEST_RUN_CTestSubmitLargeOutput) @@ -1493,6 +1508,11 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ # SET_TESTS_PROPERTIES(CTestSubmitLargeOutput PROPERTIES PASS_REGULAR_EXPRESSION "Errors occurred during submission") + + # Give this test plenty of time to run on slower machines: + # + SET_TESTS_PROPERTIES(CTestSubmitLargeOutput PROPERTIES + TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT}) ENDIF(CTEST_RUN_CTestSubmitLargeOutput) IF (CMAKE_RUN_LONG_TESTS AND TEST_KDE4_STABLE_BRANCH) @@ -1539,16 +1559,24 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ # If there is CMakeLists.txt in the binary tree, assume in-source build SET(CMAKE_SKIP_BOOTSTRAP_TEST 1) ENDIF(EXISTS "${CMAKE_BINARY_DIR}/CMakeLists.txt") - IF(UNIX AND CMAKE_RUN_LONG_TESTS AND NOT CMAKE_SKIP_BOOTSTRAP_TEST) - - + SET(bootstrap "") + IF(CMAKE_RUN_LONG_TESTS AND NOT CMAKE_SKIP_BOOTSTRAP_TEST) + IF(UNIX) + SET(bootstrap ${CMake_SOURCE_DIR}/bootstrap) + ELSEIF(MSYS) + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/bootstrap.bat.in + ${CMAKE_CURRENT_BINARY_DIR}/bootstrap.bat @ONLY) + SET(bootstrap ${CMAKE_CURRENT_BINARY_DIR}/bootstrap.bat) + ENDIF() + ENDIF() + IF(bootstrap) ADD_TEST(BootstrapTest ${CMAKE_CTEST_COMMAND} --build-and-test ${CMake_SOURCE_DIR} ${CMake_BINARY_DIR}/Tests/BootstrapTest --build-nocmake --build-noclean - --build-makeprogram ${CMake_SOURCE_DIR}/bootstrap + --build-makeprogram ${bootstrap} --build-generator "${CMAKE_TEST_GENERATOR}" --test-command ${CMake_BINARY_DIR}/Tests/BootstrapTest/Bootstrap.cmk/cmake) @@ -1562,7 +1590,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ SET_TESTS_PROPERTIES ( BootstrapTest PROPERTIES TIMEOUT 5400) ENDIF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND) - ENDIF(UNIX AND CMAKE_RUN_LONG_TESTS AND NOT CMAKE_SKIP_BOOTSTRAP_TEST) + ENDIF() # fortran does not work for IDE builds because # CMAKE_STANDARD_LIBRARIES needs to be per language diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt index 7a176e9..8fd52df 100644 --- a/Tests/CMakeTests/CMakeLists.txt +++ b/Tests/CMakeTests/CMakeLists.txt @@ -28,6 +28,11 @@ AddCMakeTest(Math "") AddCMakeTest(CMakeMinimumRequired "") AddCMakeTest(CompilerIdVendor "") +AddCMakeTest(FileDownload "") +set_property(TEST CMake.FileDownload PROPERTY + PASS_REGULAR_EXPRESSION "file already exists with expected MD5 sum" + ) + if(HAVE_ELF_H) AddCMakeTest(ELF "") endif() @@ -46,13 +51,14 @@ AddCMakeTest(GetPrerequisites "${GetPrerequisites_PreArgs}") # suite. It detects if any changes have been made to the CMake source tree # by any previous configure, build or test steps. # -if(do_cvs_tests) +if(do_cvs_tests OR GIT_EXECUTABLE) string(REPLACE "\\" "/" ENV_HOME "$ENV{HOME}") set(CheckSourceTree_PreArgs "-DCMake_BINARY_DIR:PATH=${CMake_BINARY_DIR}" "-DCMake_SOURCE_DIR:PATH=${CMake_SOURCE_DIR}" "-DCVS_EXECUTABLE:STRING=${CVS_EXECUTABLE}" + "-DGIT_EXECUTABLE:STRING=${GIT_EXECUTABLE}" "-DHOME:STRING=${ENV_HOME}" ) AddCMakeTest(CheckSourceTree "${CheckSourceTree_PreArgs}") -endif(do_cvs_tests) +endif(do_cvs_tests OR GIT_EXECUTABLE) diff --git a/Tests/CMakeTests/CheckSourceTreeTest.cmake.in b/Tests/CMakeTests/CheckSourceTreeTest.cmake.in index 1cfadcb..39289f0 100644 --- a/Tests/CMakeTests/CheckSourceTreeTest.cmake.in +++ b/Tests/CMakeTests/CheckSourceTreeTest.cmake.in @@ -6,6 +6,7 @@ message("") message("CMake_BINARY_DIR='${CMake_BINARY_DIR}'") message("CMake_SOURCE_DIR='${CMake_SOURCE_DIR}'") message("CVS_EXECUTABLE='${CVS_EXECUTABLE}'") +message("GIT_EXECUTABLE='${GIT_EXECUTABLE}'") message("HOME='${HOME}'") message("ENV{DASHBOARD_TEST_FROM_CTEST}='$ENV{DASHBOARD_TEST_FROM_CTEST}'") message("") @@ -42,55 +43,161 @@ message("in_source_build='${in_source_build}'") message("") -# If this does not appear to be a CVS checkout, just pass the test here and now. -# (Do not let the test fail if it is run in a tree *exported* from CVS or -# unpacked from a .zip file source installer...) +# If this does not appear to be a git or CVS checkout, just pass the test here +# and now. (Do not let the test fail if it is run in a tree *exported* from a +# repository or unpacked from a .zip file source installer...) # -if(NOT EXISTS "${CMake_SOURCE_DIR}/CVS/Root") - message("source tree is not a CVS checkout... test passes by early return...") - return() +set(is_git_checkout 0) +if(EXISTS "${CMake_SOURCE_DIR}/.git") + set(is_git_checkout 1) endif() +set(is_cvs_checkout 0) +if(EXISTS "${CMake_SOURCE_DIR}/CVS/Root") + set(is_cvs_checkout 1) +endif() -# Check with "cvs -q -n up -dP" if there are any local modifications to the -# CMake source tree: -# -message("=============================================================================") -message("Copy/paste this command to reproduce:") -message("cd \"${CMake_SOURCE_DIR}\" && \"${CVS_EXECUTABLE}\" -q -n up -dP") +message("is_git_checkout='${is_git_checkout}'") +message("is_cvs_checkout='${is_cvs_checkout}'") message("") -# Use the HOME value passed in to the script for calling cvs so it can find -# its .cvspass and other file(s) -# -set(original_ENV_HOME "$ENV{HOME}") -set(ENV{HOME} "${HOME}") - -execute_process(COMMAND ${CVS_EXECUTABLE} -q -n up -dP - WORKING_DIRECTORY ${CMake_SOURCE_DIR} - OUTPUT_VARIABLE ov - ERROR_VARIABLE ev - RESULT_VARIABLE rv) - -set(ENV{HOME} "${original_ENV_HOME}") - -message("Results of running '${CVS_EXECUTABLE} -q -n up -dP'") -message("rv='${rv}'") -message("ov='${ov}'") -message("ev='${ev}'") -message("") +if(NOT is_cvs_checkout) +if(NOT is_git_checkout) + message("source tree is neither git nor CVS checkout... test passes by early return...") + return() +endif() +endif() -if(NOT rv STREQUAL 0) - message(FATAL_ERROR "error: 'cvs -q -n up -dP' attempt failed... (see output above)") +if(is_cvs_checkout) +if(is_git_checkout) + message("warning: source tree has both git *and* CVS file system bits???") + # should this condition be a FATAL_ERROR test failure...? endif() +endif() + -# Analyze cvs output: +# This test looks for the following types of changes in the source tree: # set(additions 0) set(conflicts 0) set(modifications 0) set(nonadditions 0) +# ov == output variable... conditionally filled in by either cvs or git below: +# +set(cmd "") +set(ov "") +set(ev "") +set(rv "") + + +if(is_cvs_checkout AND CVS_EXECUTABLE) + # Check with "cvs -q -n up -dP" if there are any local modifications to the + # CMake source tree: + # + message("=============================================================================") + message("This is a cvs checkout, using cvs to verify source tree....") + message("") + + execute_process(COMMAND ${CVS_EXECUTABLE} --version + WORKING_DIRECTORY ${CMake_SOURCE_DIR} + OUTPUT_VARIABLE version_output + OUTPUT_STRIP_TRAILING_WHITESPACE) + message("=== output of 'cvs --version' ===") + message("${version_output}") + message("=== end output ===") + message("") + + file(READ "${CMake_SOURCE_DIR}/CVS/Root" contents) + message("=== content of CVS/Root ===") + message("${contents}") + message("=== end content ===") + message("") + + file(READ "${CMake_SOURCE_DIR}/CVS/Repository" contents) + message("=== content of CVS/Repository ===") + message("${contents}") + message("=== end content ===") + message("") + + message("Copy/paste this command to reproduce:") + message("cd \"${CMake_SOURCE_DIR}\" && \"${CVS_EXECUTABLE}\" -q -n up -dP") + message("") + + set(cmd ${CVS_EXECUTABLE} -q -n up -dP) +endif() + + +if(is_git_checkout AND GIT_EXECUTABLE) + # Check with "git status" if there are any local modifications to the + # CMake source tree: + # + message("=============================================================================") + message("This is a git checkout, using git to verify source tree....") + message("") + + execute_process(COMMAND ${GIT_EXECUTABLE} --version + WORKING_DIRECTORY ${CMake_SOURCE_DIR} + OUTPUT_VARIABLE version_output + OUTPUT_STRIP_TRAILING_WHITESPACE) + message("=== output of 'git --version' ===") + message("${version_output}") + message("=== end output ===") + message("") + + execute_process(COMMAND ${GIT_EXECUTABLE} branch -a + WORKING_DIRECTORY ${CMake_SOURCE_DIR} + OUTPUT_VARIABLE git_branch_output + OUTPUT_STRIP_TRAILING_WHITESPACE) + message("=== output of 'git branch -a' ===") + message("${git_branch_output}") + message("=== end output ===") + message("") + + message("Copy/paste this command to reproduce:") + message("cd \"${CMake_SOURCE_DIR}\" && \"${GIT_EXECUTABLE}\" status") + message("") + + set(cmd ${GIT_EXECUTABLE} status) +endif() + + +if(cmd) + # Use the HOME value passed in to the script for calling cvs/git so it can + # find its .cvspass or user/global config settings... + # + set(original_ENV_HOME "$ENV{HOME}") + set(ENV{HOME} "${HOME}") + + execute_process(COMMAND ${cmd} + WORKING_DIRECTORY ${CMake_SOURCE_DIR} + OUTPUT_VARIABLE ov + ERROR_VARIABLE ev + RESULT_VARIABLE rv) + + set(ENV{HOME} "${original_ENV_HOME}") + + message("Results of running ${cmd}") + message("rv='${rv}'") + message("ov='${ov}'") + message("ev='${ev}'") + message("") + + if(NOT rv STREQUAL 0) + if(is_git_checkout AND (rv STREQUAL "1")) + # Many builds of git return "1" from a "nothing is changed" git status call... + # Do not fail with an error for rv==1 with git... + else() + message(FATAL_ERROR "error: ${cmd} attempt failed... (see output above)") + endif() + endif() +else() + message(FATAL_ERROR "error: no COMMAND to run to analyze source tree...") +endif() + + +# Analyze output: +# if(NOT ov STREQUAL "") string(REPLACE ";" "\\\\;" lines "${ov}") string(REPLACE "\n" "E;" lines "${lines}") @@ -110,29 +217,44 @@ if(NOT ov STREQUAL "") endif() if(consider) - if(line MATCHES "^A ") - message(" locally added file/directory detected...") - set(additions 1) + if(is_cvs_checkout) + if(line MATCHES "^A ") + message(" locally added file/directory detected...") + set(additions 1) + endif() + + if(line MATCHES "^C ") + message(" conflict detected...") + set(conflicts 1) + endif() + + if(line MATCHES "^M ") + message(" locally modified file detected...") + set(modifications 1) + endif() + + if(line MATCHES "^\\? ") + message(" locally non-added file/directory detected...") + set(nonadditions 1) + endif() endif() - if(line MATCHES "^C ") - message(" conflict detected...") - set(conflicts 1) - endif() + if(is_git_checkout) + if(line MATCHES "^#[ \t]*modified:") + message(" locally modified file detected...") + set(modifications 1) + endif() - if(line MATCHES "^M ") - message(" locally modified file detected...") - set(modifications 1) - endif() - - if(line MATCHES "^\\? ") - message(" locally non-added file/directory detected...") - set(nonadditions 1) + if(line MATCHES "^# Untracked") + message(" locally non-added file/directory detected...") + set(nonadditions 1) + endif() endif() endif() endforeach() endif() + message("=============================================================================") message("additions='${additions}'") message("conflicts='${conflicts}'") @@ -185,14 +307,14 @@ if(nonadditions) message(" warning: test results confounded because this is an 'in-source' build - cannot distinguish between non-added files that are in-source build products and -non-added source files that somebody forgot to 'cvs add'... - this is only ok +non-added source files that somebody forgot to 'git add'... - this is only ok if this is intentionally an in-source dashboard build... Developers should use out-of-source builds to verify a clean source tree with this test... Allowing test to pass despite the warning message... ") else() - message(FATAL_ERROR "test fails: local source tree non-additions: use cvs add before committing, or remove the files from the source tree") + message(FATAL_ERROR "test fails: local source tree non-additions: use git add before committing, or remove the files from the source tree") endif() endif() diff --git a/Tests/CMakeTests/FileDownloadInput.png b/Tests/CMakeTests/FileDownloadInput.png Binary files differnew file mode 100644 index 0000000..7bbcee4 --- /dev/null +++ b/Tests/CMakeTests/FileDownloadInput.png diff --git a/Tests/CMakeTests/FileDownloadTest.cmake.in b/Tests/CMakeTests/FileDownloadTest.cmake.in new file mode 100644 index 0000000..578f510 --- /dev/null +++ b/Tests/CMakeTests/FileDownloadTest.cmake.in @@ -0,0 +1,41 @@ +set(url "file://@CMAKE_CURRENT_SOURCE_DIR@/FileDownloadInput.png") +set(dir "@CMAKE_CURRENT_BINARY_DIR@/downloads") + +message(STATUS "FileDownload:1") +file(DOWNLOAD + ${url} + ${dir}/file1.png + TIMEOUT 2 + ) + +message(STATUS "FileDownload:2") +file(DOWNLOAD + ${url} + ${dir}/file2.png + TIMEOUT 2 + SHOW_PROGRESS + ) + +# Two calls in a row, exactly the same arguments. +# Since downloaded file should exist already for 2nd call, +# the 2nd call will short-circuit and return early... +# +if(EXISTS ${dir}/file3.png) + file(REMOVE ${dir}/file3.png) +endif() + +message(STATUS "FileDownload:3") +file(DOWNLOAD + ${url} + ${dir}/file3.png + TIMEOUT 2 + EXPECTED_MD5 d16778650db435bda3a8c3435c3ff5d1 + ) + +message(STATUS "FileDownload:4") +file(DOWNLOAD + ${url} + ${dir}/file3.png + TIMEOUT 2 + EXPECTED_MD5 d16778650db435bda3a8c3435c3ff5d1 + ) diff --git a/Tests/CTestSubmitLargeOutput/test.cmake.in b/Tests/CTestSubmitLargeOutput/test.cmake.in index bc094b0..17a7c7d 100644 --- a/Tests/CTestSubmitLargeOutput/test.cmake.in +++ b/Tests/CTestSubmitLargeOutput/test.cmake.in @@ -16,6 +16,7 @@ CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) SET(CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE 1000000000) SET(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 1000000000) +SET(CTEST_TEST_TIMEOUT @CMAKE_LONG_TEST_TIMEOUT@) CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/CTestUpdateBZR.cmake.in b/Tests/CTestUpdateBZR.cmake.in index 7f90b50..c654f47 100644 --- a/Tests/CTestUpdateBZR.cmake.in +++ b/Tests/CTestUpdateBZR.cmake.in @@ -142,7 +142,7 @@ run_dashboard_command_line(user-binary) # Test initial checkout and update with a dashboard script. message("Running CTest Dashboard Script...") -create_dashboard_script(dashboard.cmake +create_dashboard_script(dash-binary "# bzr command configuration set(CTEST_BZR_COMMAND \"${BZR}\") set(CTEST_CHECKOUT_COMMAND @@ -150,4 +150,4 @@ set(CTEST_CHECKOUT_COMMAND ") # Run the dashboard script with CTest. -run_dashboard_script(dashboard.cmake) +run_dashboard_script(dash-binary) diff --git a/Tests/CTestUpdateCVS.cmake.in b/Tests/CTestUpdateCVS.cmake.in index 6f31a2c..a04673e 100644 --- a/Tests/CTestUpdateCVS.cmake.in +++ b/Tests/CTestUpdateCVS.cmake.in @@ -147,7 +147,7 @@ run_dashboard_command_line(user-binary) # Test initial checkout and update with a dashboard script. message("Running CTest Dashboard Script...") -create_dashboard_script(dashboard.cmake +create_dashboard_script(dash-binary "# CVS command configuration set(CTEST_CVS_COMMAND \"${CVS}\") set(CTEST_CVS_UPDATE_OPTIONS -dAP) @@ -156,4 +156,4 @@ set(CTEST_CHECKOUT_COMMAND ") # Run the dashboard script with CTest. -run_dashboard_script(dashboard.cmake) +run_dashboard_script(dash-binary) diff --git a/Tests/CTestUpdateCommon.cmake b/Tests/CTestUpdateCommon.cmake index 266f4b3..a52cb14 100644 --- a/Tests/CTestUpdateCommon.cmake +++ b/Tests/CTestUpdateCommon.cmake @@ -165,15 +165,15 @@ endfunction(create_build_tree) #----------------------------------------------------------------------------- # Function to write the dashboard test script. -function(create_dashboard_script name custom_text) +function(create_dashboard_script bin_dir custom_text) # Write the dashboard script. - file(WRITE ${TOP}/dashboard.cmake + file(WRITE ${TOP}/${bin_dir}.cmake "# CTest Dashboard Script set(CTEST_DASHBOARD_ROOT \"${TOP}\") set(CTEST_SITE test.site) set(CTEST_BUILD_NAME dash-test) set(CTEST_SOURCE_DIRECTORY \${CTEST_DASHBOARD_ROOT}/dash-source) -set(CTEST_BINARY_DIRECTORY \${CTEST_DASHBOARD_ROOT}/dash-binary) +set(CTEST_BINARY_DIRECTORY \${CTEST_DASHBOARD_ROOT}/${bin_dir}) ${custom_text} # Start a dashboard and run the update step ctest_start(Experimental) @@ -191,27 +191,31 @@ function(run_dashboard_command_line bin_dir) # Verify the updates reported by CTest. list(APPEND UPDATE_MAYBE Updated{subdir}) + set(_modified Modified{CTestConfig.cmake}) + if(UPDATE_NO_MODIFIED) + set(_modified "") + endif() check_updates(${bin_dir} Updated{foo.txt} Updated{bar.txt} Updated{zot.txt} Updated{subdir/foo.txt} Updated{subdir/bar.txt} - Modified{CTestConfig.cmake} + ${_modified} ) endfunction(run_dashboard_command_line) #----------------------------------------------------------------------------- # Function to run the dashboard through a script -function(run_dashboard_script name) +function(run_dashboard_script bin_dir) run_child( WORKING_DIRECTORY ${TOP} - COMMAND ${CMAKE_CTEST_COMMAND} -S ${name} -V + COMMAND ${CMAKE_CTEST_COMMAND} -S ${bin_dir}.cmake -V ) # Verify the updates reported by CTest. list(APPEND UPDATE_MAYBE Updated{subdir}) - check_updates(dash-binary + check_updates(${bin_dir} Updated{foo.txt} Updated{bar.txt} Updated{zot.txt} diff --git a/Tests/CTestUpdateGIT.cmake.in b/Tests/CTestUpdateGIT.cmake.in index f0a5770..4ac1b31 100644 --- a/Tests/CTestUpdateGIT.cmake.in +++ b/Tests/CTestUpdateGIT.cmake.in @@ -192,15 +192,18 @@ run_child( #----------------------------------------------------------------------------- # Go back to before the changes so we can test updating. -message("Backing up to revision 1...") -run_child( - WORKING_DIRECTORY ${TOP}/user-source - COMMAND ${GIT} reset --hard master~2 - ) -run_child( - WORKING_DIRECTORY ${TOP}/user-source - COMMAND ${GIT} submodule update - ) +macro(rewind_source src_dir) + message("Backing up to revision 1...") + run_child( + WORKING_DIRECTORY ${TOP}/${src_dir} + COMMAND ${GIT} reset --hard origin/master~2 + ) + run_child( + WORKING_DIRECTORY ${TOP}/${src_dir} + COMMAND ${GIT} submodule update + ) +endmacro(rewind_source) +rewind_source(user-source) # Make sure pull does not try to rebase (which does not work with # modified files) even if ~/.gitconfig sets "branch.master.rebase". @@ -224,13 +227,31 @@ UpdateCommand: ${GIT} ") # Run the dashboard command line interface. +set(UPDATE_NO_MODIFIED 1) run_dashboard_command_line(user-binary) +set(UPDATE_NO_MODIFIED 0) + +rewind_source(user-source) +modify_content(user-source) + +message("Running CTest Dashboard Command Line (custom update)...") + +# Create the user build tree. +create_build_tree(user-source user-binary-custom) +file(APPEND ${TOP}/user-binary-custom/CTestConfiguration.ini + "# GIT command configuration +UpdateCommand: ${GIT} +GITUpdateCustom: ${GIT};pull;origin;master +") + +# Run the dashboard command line interface. +run_dashboard_command_line(user-binary-custom) #----------------------------------------------------------------------------- # Test initial checkout and update with a dashboard script. message("Running CTest Dashboard Script...") -create_dashboard_script(dashboard.cmake +create_dashboard_script(dash-binary "# git command configuration set(CTEST_GIT_COMMAND \"${GIT}\") set(CTEST_GIT_UPDATE_OPTIONS) @@ -253,4 +274,20 @@ execute_process( ") # Run the dashboard script with CTest. -run_dashboard_script(dashboard.cmake) +run_dashboard_script(dash-binary) + +rewind_source(dash-source) + +#----------------------------------------------------------------------------- +# Test custom update with a dashboard script. +message("Running CTest Dashboard Script (custom update)...") + +create_dashboard_script(dash-binary-custom + "# git command configuration +set(CTEST_GIT_COMMAND \"${GIT}\") +set(CTEST_GIT_UPDATE_OPTIONS) +set(CTEST_GIT_UPDATE_CUSTOM \${CTEST_GIT_COMMAND} pull origin master) +") + +# Run the dashboard script with CTest. +run_dashboard_script(dash-binary-custom) diff --git a/Tests/CTestUpdateGIT.sh.in b/Tests/CTestUpdateGIT.sh.in index 4761d32..e7586d6 100755 --- a/Tests/CTestUpdateGIT.sh.in +++ b/Tests/CTestUpdateGIT.sh.in @@ -1,5 +1,5 @@ #!/bin/sh -if test "x$1" = "xpull"; then +if test "x$1" = "xpull" -o "x$1" = "xreset"; then "@GIT@" "$@" && sleep 1 && touch foo.txt else exec "@GIT@" "$@" diff --git a/Tests/CTestUpdateHG.cmake.in b/Tests/CTestUpdateHG.cmake.in index f2e5f83..543ddd9 100644 --- a/Tests/CTestUpdateHG.cmake.in +++ b/Tests/CTestUpdateHG.cmake.in @@ -145,7 +145,7 @@ run_dashboard_command_line(user-binary) # Test initial checkout and update with a dashboard script. message("Running CTest Dashboard Script...") -create_dashboard_script(dashboard.cmake +create_dashboard_script(dash-binary "# hg command configuration set(CTEST_HG_COMMAND \"${HG}\") set(CTEST_HG_UPDATE_OPTIONS) @@ -160,4 +160,4 @@ execute_process( ") # Run the dashboard script with CTest. -run_dashboard_script(dashboard.cmake) +run_dashboard_script(dash-binary) diff --git a/Tests/CTestUpdateSVN.cmake.in b/Tests/CTestUpdateSVN.cmake.in index 509597b..97b2a07 100644 --- a/Tests/CTestUpdateSVN.cmake.in +++ b/Tests/CTestUpdateSVN.cmake.in @@ -127,7 +127,7 @@ run_dashboard_command_line(user-binary) # Test initial checkout and update with a dashboard script. message("Running CTest Dashboard Script...") -create_dashboard_script(dashboard.cmake +create_dashboard_script(dash-binary "# Subversion command configuration set(CTEST_SVN_COMMAND \"${SVN}\") set(CTEST_SVN_UPDATE_OPTIONS @@ -137,4 +137,4 @@ set(CTEST_CHECKOUT_COMMAND ") # Run the dashboard script with CTest. -run_dashboard_script(dashboard.cmake) +run_dashboard_script(dash-binary) diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt index f02f2f7..99da9c4 100644 --- a/Tests/ExternalProject/CMakeLists.txt +++ b/Tests/ExternalProject/CMakeLists.txt @@ -1,10 +1,11 @@ -cmake_minimum_required(VERSION 2.6) +cmake_minimum_required(VERSION 2.8) project(ExternalProjectTest NONE) include(ExternalProject) find_package(CVS) find_package(Subversion) +find_package(Git) set(base "${CMAKE_BINARY_DIR}/CMakeExternals") set(binary_base "${base}/Build") @@ -37,8 +38,6 @@ if(NOT DEFINED can_build_tutorial_step5) endif() endif() -message(STATUS "can_build_tutorial_step5='${can_build_tutorial_step5}'") - # Empty projects that test all the known ExternalProject_Add argument key words: # @@ -65,7 +64,9 @@ ExternalProject_Add(${proj} SVN_REPOSITORY "" SVN_REVISION "" TEST_COMMAND "" + TIMEOUT "" URL "" + URL_MD5 "" UPDATE_COMMAND "" ) @@ -96,6 +97,7 @@ endif() set(proj TutorialStep1-LocalTAR) ExternalProject_Add(${proj} URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1.tar" + URL_MD5 a87c5b47c0201c09ddfe1d5738fdb1e3 LIST_SEPARATOR :: PATCH_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/Step1Patch.cmake CMAKE_GENERATOR "${CMAKE_GENERATOR}" @@ -107,6 +109,7 @@ ExternalProject_Add(${proj} set(proj TutorialStep1-LocalNoDirTAR) ExternalProject_Add(${proj} URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.tar" + URL_MD5 d09e3d370c5c908fa035c30939ee438e LIST_SEPARATOR @@ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -G ${CMAKE_GENERATOR} <SOURCE_DIR> -DTEST_LIST:STRING=1@@2@@3 @@ -126,6 +129,7 @@ ExternalProject_Add_Step(${proj} mypatch set(proj TutorialStep1-LocalTGZ) ExternalProject_Add(${proj} URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1.tgz" + URL_MD5 38c648e817339c356f6be00eeed79bd0 CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> -G ${CMAKE_GENERATOR} <SOURCE_DIR> INSTALL_COMMAND "" ) @@ -133,12 +137,63 @@ ExternalProject_Add(${proj} set(proj TutorialStep1-LocalNoDirTGZ) ExternalProject_Add(${proj} URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.tgz" + URL_MD5 0b8182edcecdf40bf1c9d71d7d259f78 CMAKE_GENERATOR "${CMAKE_GENERATOR}" CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> INSTALL_COMMAND "" ) +# Local BZ2: +# +# (The bz2 tests are here just to verify that the bz2 decompression is executed +# during a test suite run... The configure and build commands are set to +# nothing to make the test quicker. To make this more complete, I should add +# a diff between this and the TGZ source tree since that one does build...) +# +set(proj TutorialStep1-LocalBZ2) +ExternalProject_Add(${proj} + URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1.tar.bz2" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" +) + +set(proj TutorialStep1-LocalNoDirBZ2) +ExternalProject_Add(${proj} + URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.tar.bz2" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" +) + + +# Local ZIP: +# +# (The zip tests are here just to verify that the zip decompression is executed +# during a test suite run... The configure and build commands are set to +# nothing to make the test quicker. To make this more complete, I should add +# a diff between this and the TGZ source tree since that one does build...) +# +set(proj TutorialStep1-LocalZIP) +ExternalProject_Add(${proj} + URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1.zip" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" +) + +set(proj TutorialStep1-LocalNoDirZIP) +ExternalProject_Add(${proj} + URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.zip" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" +) + + +# CVS-based tests: +# set(do_cvs_tests 0) if(CVS_EXECUTABLE) @@ -161,8 +216,9 @@ if(do_cvs_tests) ExternalProject_Add(${proj} SOURCE_DIR ${local_cvs_repo} URL ${CMAKE_CURRENT_SOURCE_DIR}/cvsrepo.tgz + URL_MD5 55fc85825ffdd9ed2597123c68b79f7e BUILD_COMMAND "" - CONFIGURE_COMMAND ${CVS_EXECUTABLE} --version + CONFIGURE_COMMAND "${CVS_EXECUTABLE}" --version INSTALL_COMMAND "" ) @@ -215,6 +271,8 @@ if(do_cvs_tests) endif() +# SVN-based tests: +# set(do_svn_tests 0) if(Subversion_SVN_EXECUTABLE) @@ -257,8 +315,9 @@ if(do_svn_tests) ExternalProject_Add(${proj} SOURCE_DIR ${local_svn_repo} URL ${CMAKE_CURRENT_SOURCE_DIR}/svnrepo.tgz + URL_MD5 2f468be4ed1fa96377fca0cc830819c4 BUILD_COMMAND "" - CONFIGURE_COMMAND ${Subversion_SVN_EXECUTABLE} --version + CONFIGURE_COMMAND "${Subversion_SVN_EXECUTABLE}" --version INSTALL_COMMAND "" ) @@ -301,6 +360,80 @@ if(do_svn_tests) endif() +set(do_git_tests 0) + +if(GIT_EXECUTABLE) + set(do_git_tests 1) + + execute_process( + COMMAND "${GIT_EXECUTABLE}" --version + OUTPUT_VARIABLE ov + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + string(REGEX REPLACE "^git version (.+)$" "\\1" git_version "${ov}") + message(STATUS "git_version='${git_version}'") + + if(git_version VERSION_LESS 1.6.5) + message(STATUS "No ExternalProject git tests with git client less than version 1.6.5") + set(do_git_tests 0) + endif() +endif() + + +if(do_git_tests) + set(local_git_repo "../../LocalRepositories/GIT") + + # Unzip/untar the git repository in our source folder so that other + # projects below may use it to test git args of ExternalProject_Add + # + set(proj SetupLocalGITRepository) + ExternalProject_Add(${proj} + SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/LocalRepositories/GIT + URL ${CMAKE_CURRENT_SOURCE_DIR}/gitrepo.tgz + BUILD_COMMAND "" + CONFIGURE_COMMAND "${GIT_EXECUTABLE}" --version + INSTALL_COMMAND "" + ) + + # git by commit id: + # + set(proj TutorialStep1-GIT-byhash) + ExternalProject_Add(${proj} + GIT_REPOSITORY "${local_git_repo}" + GIT_TAG d1970730310fe8bc07e73f15dc570071f9f9654a + UPDATE_COMMAND "" + CMAKE_GENERATOR "${CMAKE_GENERATOR}" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> + INSTALL_COMMAND "" + DEPENDS "SetupLocalGITRepository" + ) + + # git by explicit branch/tag name: + # + set(proj TutorialStep1-GIT-bytag) + ExternalProject_Add(${proj} + GIT_REPOSITORY "${local_git_repo}" + GIT_TAG "origin/master" + UPDATE_COMMAND "" + CMAKE_GENERATOR "${CMAKE_GENERATOR}" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> + INSTALL_COMMAND "" + DEPENDS "SetupLocalGITRepository" + ) + + # Live git / master (no GIT_TAG): + # + set(proj TutorialStep1-GIT-master) + ExternalProject_Add(${proj} + GIT_REPOSITORY "${local_git_repo}" + CMAKE_GENERATOR "${CMAKE_GENERATOR}" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> + INSTALL_COMMAND "" + DEPENDS "SetupLocalGITRepository" + ) +endif() + + # Test the testable built/installed products: # enable_testing() @@ -365,3 +498,10 @@ if(can_build_tutorial_step5) set_property(TEST TutorialStep5-InstallTreeTest APPEND PROPERTY LABELS Step5 InstallTree) endif() + + +message(STATUS "can_build_tutorial_step5='${can_build_tutorial_step5}'") +message(STATUS "do_cvs_tests='${do_cvs_tests}'") +message(STATUS "do_svn_tests='${do_svn_tests}'") +message(STATUS "do_git_tests='${do_git_tests}'") +message(STATUS "GIT_EXECUTABLE='${GIT_EXECUTABLE}'") diff --git a/Tests/ExternalProject/Example/CMakeLists.txt b/Tests/ExternalProject/Example/CMakeLists.txt new file mode 100644 index 0000000..2cadd7d --- /dev/null +++ b/Tests/ExternalProject/Example/CMakeLists.txt @@ -0,0 +1,11 @@ +# This is the canonical simplest ExternalProject example CMakeLists.txt file: +cmake_minimum_required(VERSION 2.8) +project(ExternalProjectExample NONE) +include(ExternalProject) + +ExternalProject_Add( + cmake281 + URL http://www.cmake.org/files/v2.8/cmake-2.8.1.tar.gz + CMAKE_ARGS -D CMAKE_INSTALL_PREFIX=<INSTALL_DIR> + BUILD_COMMAND "" +) diff --git a/Tests/ExternalProject/Step1.tar.bz2 b/Tests/ExternalProject/Step1.tar.bz2 Binary files differnew file mode 100644 index 0000000..49b5f23 --- /dev/null +++ b/Tests/ExternalProject/Step1.tar.bz2 diff --git a/Tests/ExternalProject/Step1.zip b/Tests/ExternalProject/Step1.zip Binary files differnew file mode 100644 index 0000000..49dac24 --- /dev/null +++ b/Tests/ExternalProject/Step1.zip diff --git a/Tests/ExternalProject/Step1NoDir.tar.bz2 b/Tests/ExternalProject/Step1NoDir.tar.bz2 Binary files differnew file mode 100644 index 0000000..92eb480 --- /dev/null +++ b/Tests/ExternalProject/Step1NoDir.tar.bz2 diff --git a/Tests/ExternalProject/Step1NoDir.zip b/Tests/ExternalProject/Step1NoDir.zip Binary files differnew file mode 100644 index 0000000..b42d318 --- /dev/null +++ b/Tests/ExternalProject/Step1NoDir.zip diff --git a/Tests/ExternalProject/gitrepo.tgz b/Tests/ExternalProject/gitrepo.tgz Binary files differnew file mode 100644 index 0000000..0a84bda --- /dev/null +++ b/Tests/ExternalProject/gitrepo.tgz diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt index 31cf0fc..74cc115 100644 --- a/Tests/FindPackageTest/CMakeLists.txt +++ b/Tests/FindPackageTest/CMakeLists.txt @@ -232,4 +232,5 @@ TRY_COMPILE(EXPORTER_COMPILED MESSAGE(STATUS "Searching for export(PACKAGE) test project") SET(CMakeTestExportPackage_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE) -FIND_PACKAGE(CMakeTestExportPackage 1.${CMAKE_VERSION} EXACT REQUIRED) +STRING(REGEX REPLACE "-.*$" "" version ${CMAKE_VERSION}) +FIND_PACKAGE(CMakeTestExportPackage 1.${version} EXACT REQUIRED) diff --git a/Tests/LinkFlags/CMakeLists.txt b/Tests/LinkFlags/CMakeLists.txt new file mode 100644 index 0000000..e06020c --- /dev/null +++ b/Tests/LinkFlags/CMakeLists.txt @@ -0,0 +1,28 @@ +cmake_minimum_required(VERSION 2.8) +project(LinkFlags C) + +string(TOUPPER "${TEST_CONFIG}" TEST_CONFIG_UPPER) +set(obj "${CMAKE_C_OUTPUT_EXTENSION}") +if(BORLAND) + set(pre -) +endif() + +add_library(LinkFlags_lib STATIC LinkFlagsLib.c) +set_property(TARGET LinkFlags_lib PROPERTY STATIC_LIBRARY_FLAGS ${pre}BADFLAG${obj}) + +add_library(LinkFlags_dll SHARED LinkFlagsLib.c) +set_property(TARGET LinkFlags_dll PROPERTY LINK_FLAGS ${pre}BADFLAG${obj}) + +add_executable(LinkFlags_exe LinkFlagsExe.c) +set_property(TARGET LinkFlags_exe PROPERTY LINK_FLAGS ${pre}BADFLAG${obj}) + +add_library(LinkFlags_lib_config STATIC LinkFlagsLib.c) +set_property(TARGET LinkFlags_lib_config PROPERTY STATIC_LIBRARY_FLAGS_${TEST_CONFIG_UPPER} ${pre}BADFLAG_${TEST_CONFIG}${obj}) + +add_library(LinkFlags_dll_config SHARED LinkFlagsLib.c) +set_property(TARGET LinkFlags_dll_config PROPERTY LINK_FLAGS_${TEST_CONFIG_UPPER} ${pre}BADFLAG_${TEST_CONFIG}${obj}) + +add_executable(LinkFlags_exe_config LinkFlagsExe.c) +set_property(TARGET LinkFlags_exe_config PROPERTY LINK_FLAGS_${TEST_CONFIG_UPPER} ${pre}BADFLAG_${TEST_CONFIG}${obj}) + +add_executable(LinkFlags LinkFlags.c) diff --git a/Tests/LinkFlags/LinkFlags.c b/Tests/LinkFlags/LinkFlags.c new file mode 100644 index 0000000..78f2de1 --- /dev/null +++ b/Tests/LinkFlags/LinkFlags.c @@ -0,0 +1 @@ +int main(void) { return 0; } diff --git a/Tests/LinkFlags/LinkFlagsExe.c b/Tests/LinkFlags/LinkFlagsExe.c new file mode 100644 index 0000000..123587a --- /dev/null +++ b/Tests/LinkFlags/LinkFlagsExe.c @@ -0,0 +1,6 @@ +int main(void) { return 0; } + +/* Intel compiler does not reject bad flags or objects! */ +#if defined(__INTEL_COMPILER) +# error BADFLAG +#endif diff --git a/Tests/LinkFlags/LinkFlagsLib.c b/Tests/LinkFlags/LinkFlagsLib.c new file mode 100644 index 0000000..9d8d088 --- /dev/null +++ b/Tests/LinkFlags/LinkFlagsLib.c @@ -0,0 +1,6 @@ +int flags_lib(void) { return 0; } + +/* Intel compiler does not reject bad flags or objects! */ +#if defined(__INTEL_COMPILER) +# error BADFLAG +#endif diff --git a/Tests/bootstrap.bat.in b/Tests/bootstrap.bat.in new file mode 100644 index 0000000..aeb24b1 --- /dev/null +++ b/Tests/bootstrap.bat.in @@ -0,0 +1,2 @@ +@echo off +sh "@CMake_SOURCE_DIR@/bootstrap" %* diff --git a/Utilities/Release/dash2win64_release.cmake b/Utilities/Release/dash2win64_release.cmake index fcf67bc..94decdd 100644 --- a/Utilities/Release/dash2win64_release.cmake +++ b/Utilities/Release/dash2win64_release.cmake @@ -12,7 +12,7 @@ CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE CMAKE_Fortran_COMPILER:FILEPATH=FALSE CMAKE_GENERATOR:INTERNAL=Unix Makefiles BUILD_QtDialog:BOOL:=TRUE -QT_QMAKE_EXECUTABLE:FILEPATH=c:/Dashboards/Support/qt-4.5.3-static/bin/qmake.exe +QT_QMAKE_EXECUTABLE:FILEPATH=c:/Dashboards/Support/qt-build/Qt/bin/qmake.exe ") get_filename_component(path "${CMAKE_CURRENT_LIST_FILE}" PATH) set(GIT_COMMAND git) diff --git a/Utilities/Release/release_cmake.sh.in b/Utilities/Release/release_cmake.sh.in index b2ca348..4189728 100755 --- a/Utilities/Release/release_cmake.sh.in +++ b/Utilities/Release/release_cmake.sh.in @@ -123,7 +123,7 @@ check_exit_value $? "Build cmake" || exit 1 if [ -z "@SKIP_TESTS@" ]; then echo "Run cmake tests" - ./bin/ctest -j @PROCESSORS@ test + ./bin/ctest --output-on-failure -j @PROCESSORS@ test check_exit_value $? "Test cmake" || exit 1 fi @@ -30,17 +30,22 @@ cmake_date_stamp_component() cmake_system=`uname` cmake_source_dir=`cd "\`dirname \"$0\"\`";pwd` cmake_binary_dir=`pwd` + +# Load version information. cmake_version_major="`cmake_version_component MAJOR`" cmake_version_minor="`cmake_version_component MINOR`" -if echo "${cmake_version_minor}" | grep "[0-9]*[13579]" > /dev/null 2>&1; then - cmake_version_patch="`cmake_date_stamp_component YEAR``cmake_date_stamp_component MONTH``cmake_date_stamp_component DAY`" -else - cmake_version_patch="`cmake_version_component PATCH`" +cmake_version_patch="`cmake_version_component PATCH`" +cmake_version="${cmake_version_major}.${cmake_version_minor}.${cmake_version_patch}" +cmake_version_tweak="`cmake_version_component TWEAK`" +if [ "x$cmake_version_tweak" = "x" ]; then + cmake_version_tweak="`cmake_date_stamp_component YEAR``cmake_date_stamp_component MONTH``cmake_date_stamp_component DAY`" fi -cmake_version="${cmake_version_major}.${cmake_version_minor}" -cmake_version_full="${cmake_version_major}.${cmake_version_minor}.${cmake_version_patch}" -cmake_data_dir="/share/cmake-${cmake_version}" -cmake_doc_dir="/doc/cmake-${cmake_version}" +if [ "$cmake_version_tweak" != "0" ]; then + cmake_version="${cmake_version}.${cmake_version_tweak}" +fi + +cmake_data_dir="/share/cmake-${cmake_version_major}.${cmake_version_minor}" +cmake_doc_dir="/doc/cmake-${cmake_version_major}.${cmake_version_minor}" cmake_man_dir="/man" cmake_init_file="" cmake_bootstrap_system_libs="" @@ -161,6 +166,7 @@ CMAKE_UNUSED_SOURCES="\ " CMAKE_CXX_SOURCES="\ + cmStandardIncludes \ cmake \ cmakemain \ cmakewizard \ @@ -312,7 +318,7 @@ Directory and file names: # Display CMake bootstrap usage cmake_version_display() { - echo "CMake ${cmake_version_full}, Copyright 2000-2009 Kitware, Inc." + echo "CMake ${cmake_version}, Copyright 2000-2009 Kitware, Inc." } # Display CMake bootstrap error, display the log file and exit @@ -1246,6 +1252,8 @@ fi cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_MAJOR ${cmake_version_major}" cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_MINOR ${cmake_version_minor}" cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_PATCH ${cmake_version_patch}" +cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_TWEAK ${cmake_version_tweak}" +cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION \"${cmake_version}\"" cmake_report cmConfigure.h${_tmp} "#define CMAKE_ROOT_DIR \"${cmake_root_dir}\"" cmake_report cmConfigure.h${_tmp} "#define CMAKE_DATA_DIR \"${cmake_data_dir}\"" cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP" |